All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hariprasad Kelam <hkelam@marvell.com>
To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: <kuba@kernel.org>, <davem@davemloft.net>, <sgoutham@marvell.com>,
	<lcherian@marvell.com>, <gakula@marvell.com>,
	<jerinj@marvell.com>, <sbhatta@marvell.com>, <hkelam@marvell.com>
Subject: [net PATCH 1/9] octeontx2-pf: Do not modify number of rules
Date: Tue, 16 Mar 2021 14:57:05 +0530	[thread overview]
Message-ID: <1615886833-71688-2-git-send-email-hkelam@marvell.com> (raw)
In-Reply-To: <1615886833-71688-1-git-send-email-hkelam@marvell.com>

From: Subbaraya Sundeep <sbhatta@marvell.com>

In the ETHTOOL_GRXCLSRLALL ioctl ethtool uses
below structure to read number of rules from the driver.

    struct ethtool_rxnfc {
            __u32                           cmd;
            __u32                           flow_type;
            __u64                           data;
            struct ethtool_rx_flow_spec     fs;
            union {
                    __u32                   rule_cnt;
                    __u32                   rss_context;
            };
            __u32                           rule_locs[0];
    };

Driver must not modify rule_cnt member. But currently driver
modifies it by modifying rss_context. Hence fix it by using a
local variable.

Fixes: 81a43620("octeontx2-pf: Add RSS multi group support")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
Signed-off-by: Sunil Kovvuri Goutham <sgoutham@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
index 0dbbf38..dc17784 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c
@@ -257,17 +257,19 @@ int otx2_get_flow(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc,
 int otx2_get_all_flows(struct otx2_nic *pfvf, struct ethtool_rxnfc *nfc,
 		       u32 *rule_locs)
 {
+	u32 rule_cnt = nfc->rule_cnt;
 	u32 location = 0;
 	int idx = 0;
 	int err = 0;
 
 	nfc->data = pfvf->flow_cfg->ntuple_max_flows;
-	while ((!err || err == -ENOENT) && idx < nfc->rule_cnt) {
+	while ((!err || err == -ENOENT) && idx < rule_cnt) {
 		err = otx2_get_flow(pfvf, nfc, location);
 		if (!err)
 			rule_locs[idx++] = location;
 		location++;
 	}
+	nfc->rule_cnt = rule_cnt;
 
 	return err;
 }
-- 
2.7.4


  reply	other threads:[~2021-03-16  9:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16  9:27 [net PATCH 0/9] octeontx2: miscellaneous fixes Hariprasad Kelam
2021-03-16  9:27 ` Hariprasad Kelam [this message]
2021-03-16 17:02   ` [net PATCH 1/9] octeontx2-pf: Do not modify number of rules Jakub Kicinski
2021-03-16  9:27 ` [net PATCH 2/9] octeontx2-af: Formatting debugfs entry rsrc_alloc Hariprasad Kelam
2021-03-16  9:27 ` [net PATCH 3/9] octeontx2-af: Do not allocate memory for devlink private Hariprasad Kelam
2021-03-16 17:04   ` Jakub Kicinski
2021-03-16 18:03     ` sundeep subbaraya
2021-03-16 20:27       ` Jakub Kicinski
2021-03-17  5:40         ` sundeep subbaraya
2021-03-16  9:27 ` [net PATCH 4/9] octeontx2-af: Remove TOS field from MKEX TX Hariprasad Kelam
2021-03-16 17:06   ` Jakub Kicinski
2021-03-17  6:37     ` sundeep subbaraya
2021-03-17 18:47       ` Jakub Kicinski
2021-03-16  9:27 ` [net PATCH 5/9] octeontx2-af: Return correct CGX RX fifo size Hariprasad Kelam
2021-03-16  9:27 ` [net PATCH 6/9] octeontx2-af: Fix irq free in rvu teardown Hariprasad Kelam
2021-03-16  9:27 ` [net PATCH 7/9] octeontx2-pf: Clear RSS enable flag on interace down Hariprasad Kelam
2021-03-16  9:27 ` [net PATCH 8/9] octeontx2-af: fix infinite loop in unmapping counter Hariprasad Kelam
2021-03-16  9:27 ` [net PATCH 9/9] octeontx2-af: Fix uninitialized variable warning Hariprasad Kelam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1615886833-71688-2-git-send-email-hkelam@marvell.com \
    --to=hkelam@marvell.com \
    --cc=davem@davemloft.net \
    --cc=gakula@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.