DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Min Hu (Connor)" <humin29@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <thomas@monjalon.net>
Subject: [PATCH 2/6] net/hns3: fix RSS key with null
Date: Fri, 28 Jan 2022 10:07:04 +0800	[thread overview]
Message-ID: <20220128020708.62787-3-humin29@huawei.com> (raw)
In-Reply-To: <20220128020708.62787-1-humin29@huawei.com>

From: Lijun Ou <oulijun@huawei.com>

Since the patch '1848b117' has initialized the variable 'key' in
'struct rte_flow_action_rss' with 'NULL', the PMD will use the
default RSS key when create the first RSS rule with NULL RSS key.
Then, if create a repeated RSS rule with the above, it will not
identify duplicate rules and return an error message.

To solve the preceding problem, determine whether the current RSS keys
are the same based on whether the length of key_len of rss is 0.

Fixes: 1848b117cca1 ("app/testpmd: fix RSS key for flow API RSS rule")
Cc: stable@dpdk.org

Signed-off-by: Lijun Ou <oulijun@huawei.com>
---
 drivers/net/hns3/hns3_flow.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c
index 56ef6f57b2..aba07aaa6f 100644
--- a/drivers/net/hns3/hns3_flow.c
+++ b/drivers/net/hns3/hns3_flow.c
@@ -1286,6 +1286,7 @@ static bool
 hns3_action_rss_same(const struct rte_flow_action_rss *comp,
 		     const struct rte_flow_action_rss *with)
 {
+	bool rss_key_is_same;
 	bool func_is_same;
 
 	/*
@@ -1302,11 +1303,16 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp,
 		func_is_same = (with->func != RTE_ETH_HASH_FUNCTION_DEFAULT) ?
 				(comp->func == with->func) : true;
 
-	return (func_is_same &&
+	if (with->key_len == 0 || with->key == NULL)
+		rss_key_is_same = 1;
+	else
+		rss_key_is_same = comp->key_len == with->key_len &&
+		!memcmp(comp->key, with->key, with->key_len);
+
+	return (func_is_same && rss_key_is_same &&
 		comp->types == (with->types & HNS3_ETH_RSS_SUPPORT) &&
-		comp->level == with->level && comp->key_len == with->key_len &&
+		comp->level == with->level &&
 		comp->queue_num == with->queue_num &&
-		!memcmp(comp->key, with->key, with->key_len) &&
 		!memcmp(comp->queue, with->queue,
 			sizeof(*with->queue) * with->queue_num));
 }
-- 
2.33.0


  parent reply	other threads:[~2022-01-28  2:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-28  2:07 [PATCH 0/6] bugfixes for hns3 PMD Min Hu (Connor)
2022-01-28  2:07 ` [PATCH 1/6] net/hns3: fix fail to rollback the max packet size in PF Min Hu (Connor)
2022-01-31 13:23   ` Ferruh Yigit
2022-01-28  2:07 ` Min Hu (Connor) [this message]
2022-01-28  2:07 ` [PATCH 3/6] net/hns3: fix insecure way to query MAC statistics Min Hu (Connor)
2022-01-28  2:07 ` [PATCH 4/6] net/hns3: fix double decrement of secondary count Min Hu (Connor)
2022-01-28  2:07 ` [PATCH 5/6] net/hns3: fix operating queue when TCAM table is invalid Min Hu (Connor)
2022-01-28  2:07 ` [PATCH 6/6] net/hns3: delete duplicate code Min Hu (Connor)

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=20220128020708.62787-3-humin29@huawei.com \
    --to=humin29@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).