Skip to contentSkip to conversation

net/iavf: fix invalid RSS type

PATCH Superseded Simei Su 2 participants 7 messages Oct 30, 2020 – Nov 2, 2020 Network drivers

lore
Share & tools
lore

Simei Su

author
#0 lore raw

PATCH 1/1 net/iavf: fix invalid RSS type

When a RSS rule with symmetric hash function, the RSS type shouldn't carry with SRC/DST_ONLY. This patch adds invalid RSS type check for the case.

Fixes 91f27b2e39ab ("net/iavf: refactor RSS")
---
 drivers/net/iavf/iavf_hash.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/iavf/iavf_hash.c +16 -0
index be821b6..6d0360a 100644
@@ -917,6 +917,22 @@ iavf_hash_parse_action(struct iavf_pattern_match_item *match_item,
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
+			/**
+			 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+			 * hash function.
+			 */
+			if (rss->func ==
+			    RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+				if (rss_type & ((VALID_RSS_ATTR &
+				    ~RTE_ETH_RSS_L3_PRE64) |
+				    ~(VALID_RSS_IPV4 | VALID_RSS_IPV6)))
+					return rte_flow_error_set(error,
+						ENOTSUP,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						action,
+						"invalid rss types");
+			}
+
 			if (iavf_any_invalid_rss_type(rss_type,
 					match_item->input_set_mask))
 				return rte_flow_error_set(error, ENOTSUP,
Signature · 1 line
2.9.5
#1 lore raw
Quoted 34 lines

-----Original Message-----
From: Su, Simei <[email protected]>
Sent: Friday, October 30, 2020 11:17 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Guo, Jia <[email protected]>; Guo, Junfeng <[email protected]>; Su, Simei <[email protected]>
Subject: [PATCH] net/iavf: fix invalid RSS type

When a RSS rule with symmetric hash function, the RSS type shouldn't carry with SRC/DST_ONLY. This patch adds invalid RSS type check for the case.

Fixes 91f27b2e39ab ("net/iavf: refactor RSS")
---
 drivers/net/iavf/iavf_hash.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/iavf/iavf_hash.c index renamed from drivers/net/iavf/iavf_hash.c +0 -0

be821b6..6d0360a 100644

drivers/net/iavf/iavf_hash.c +5 -0
@@ -917,6 +917,22 @@ iavf_hash_parse_action(struct
 iavf_pattern_match_item *match_item,
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
+			/**
+			 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+			 * hash function.
+			 */
+			if (rss->func ==

drivers/net/iavf/iavf_hash.c iavf_hash_parse_action(struct · line 935

Quoted 10 lines
drivers/net/iavf/iavf_hash.c +10 -0
+			    RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+				if (rss_type & ((VALID_RSS_ATTR &
+				    ~RTE_ETH_RSS_L3_PRE64) |
+				    ~(VALID_RSS_IPV4 | VALID_RSS_IPV6)))
+					return rte_flow_error_set(error,
+						ENOTSUP,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						action,
+						"invalid rss types");
+			}

Better to move above check into the below "iavf_any_invalid_rss_type"

Quoted 6 lines
drivers/net/iavf/iavf_hash.c +1 -0
+
 			if (iavf_any_invalid_rss_type(rss_type,
 					match_item->input_set_mask))

return rte_flow_error_set(error, ENOTSUP,
--
2.9.5

author
#2 lore raw
Quoted 39 lines

-----Original Message-----
From: Zhang, Qi Z <[email protected]>
Sent: Friday, October 30, 2020 5:41 PM
To: Su, Simei <[email protected]>
Cc: [email protected]; Guo, Jia <[email protected]>; Guo, Junfeng <[email protected]>
Subject: RE: [PATCH] net/iavf: fix invalid RSS type

Quoted 10 lines

-----Original Message-----
From: Su, Simei <[email protected]>
Sent: Friday, October 30, 2020 11:17 AM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Guo, Jia <[email protected]>; Guo, Junfeng <[email protected]>; Su, Simei <[email protected]>
Subject: [PATCH] net/iavf: fix invalid RSS type

When a RSS rule with symmetric hash function, the RSS type shouldn't carry with SRC/DST_ONLY. This patch adds invalid RSS type check for the

case.

Quoted 17 lines
Fixes 91f27b2e39ab ("net/iavf: refactor RSS")
---
 drivers/net/iavf/iavf_hash.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
(quoted diff) +0 -0

b/drivers/net/iavf/iavf_hash.c index be821b6..6d0360a 100644

drivers/net/iavf/iavf_hash.c +0 -0
@@ -917,6 +917,22 @@ iavf_hash_parse_action(struct
 iavf_pattern_match_item *match_item,
  */
 rss_type = rte_eth_rss_hf_refine(rss_type);
 
Quoted 13 lines

drivers/net/iavf/iavf_hash.c iavf_hash_parse_action(struct iavf_pattern_match_item *match_item,

Quoted 11 lines
drivers/net/iavf/iavf_hash.c +11 -0
+/**
+ * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+ * hash function.
+ */
+if (rss->func ==
+    RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) { if (rss_type &
+((VALID_RSS_ATTR &
+    ~RTE_ETH_RSS_L3_PRE64) |
+    ~(VALID_RSS_IPV4 | VALID_RSS_IPV6))) return
+rte_flow_error_set(error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
+action, "invalid rss types"); }

Better to move above check into the below "iavf_any_invalid_rss_type"

Ok, will move it into " iavf_any_invalid_rss_type" in v2.

Quoted 8 lines
Quoted 7 lines
drivers/net/iavf/iavf_hash.c +1 -1
+
 if (iavf_any_invalid_rss_type(rss_type,
 match_item->input_set_mask))
 return rte_flow_error_set(error, ENOTSUP,
--

2.9.5

author
#3 lore raw

PATCH v2 1/1 net/iavf: fix invalid RSS type

In reply to Simei Su

When a RSS rule with symmetric hash function, the RSS type shouldn't carry with SRC/DST_ONLY. This patch adds invalid RSS type check for the case.

Fixes 91f27b2e39ab ("net/iavf: refactor RSS")
---
 drivers/net/iavf/iavf_hash.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_hash.c +14 -2
index be821b6..c58566c 100644
@@ -834,10 +834,22 @@ static struct rss_attr_type rss_attr_to_valid_type[] = {
 };
 
 static bool
-iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
+iavf_any_invalid_rss_type(enum rte_eth_hash_function func,
+			  uint64_t rss_type, uint64_t allow_rss_type)
 {
 	uint32_t i;
 
+	/**
+	 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+	 * hash function.
+	 */
+	if (func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+		if (rss_type & ((VALID_RSS_ATTR &
+		    ~RTE_ETH_RSS_L3_PRE64) |
+		    ~(VALID_RSS_IPV4 | VALID_RSS_IPV6)))
+			return true;
+	}
+
 	/* check invalid combination */
 	for (i = 0; i < RTE_DIM(invalid_rss_comb); i++) {
 		if (__builtin_popcountll(rss_type & invalid_rss_comb[i]) > 1)
@@ -917,7 +929,7 @@ iavf_hash_parse_action(struct iavf_pattern_match_item *match_item,
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
-			if (iavf_any_invalid_rss_type(rss_type,
+			if (iavf_any_invalid_rss_type(rss->func, rss_type,
 					match_item->input_set_mask))
 				return rte_flow_error_set(error, ENOTSUP,
 						RTE_FLOW_ERROR_TYPE_ACTION,
Signature · 1 line
2.9.5
author
#4 lore raw

PATCH v3 1/1 net/iavf: fix invalid RSS type

When a RSS rule with symmetric hash function, the RSS type shouldn't carry with SRC/DST_ONLY. This patch adds invalid RSS type check for the case.

Fixes 91f27b2e39ab ("net/iavf: refactor RSS")

v3:
* correct invalid case.

v2:
* move invalid check into "iavf_any_invalid_rss_type".

---
 drivers/net/iavf/iavf_hash.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_hash.c +14 -2
index be821b6..c7fef5b 100644
@@ -834,10 +834,22 @@ static struct rss_attr_type rss_attr_to_valid_type[] = {
 };
 
 static bool
-iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
+iavf_any_invalid_rss_type(enum rte_eth_hash_function func,
+			  uint64_t rss_type, uint64_t allow_rss_type)
 {
 	uint32_t i;
 
+	/**
+	 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+	 * hash function.
+	 */
+	if (func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+		if (rss_type & (VALID_RSS_ATTR &
+		    ~(RTE_ETH_RSS_L3_PRE64 | ETH_RSS_L2_SRC_ONLY |
+		    ETH_RSS_L2_DST_ONLY)))
+			return true;
+	}
+
 	/* check invalid combination */
 	for (i = 0; i < RTE_DIM(invalid_rss_comb); i++) {
 		if (__builtin_popcountll(rss_type & invalid_rss_comb[i]) > 1)
@@ -917,7 +929,7 @@ iavf_hash_parse_action(struct iavf_pattern_match_item *match_item,
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
-			if (iavf_any_invalid_rss_type(rss_type,
+			if (iavf_any_invalid_rss_type(rss->func, rss_type,
 					match_item->input_set_mask))
 				return rte_flow_error_set(error, ENOTSUP,
 						RTE_FLOW_ERROR_TYPE_ACTION,
Signature · 1 line
2.9.5
author
#5 lore raw

PATCH v4 1/1 net/iavf: fix invalid RSS type

When a RSS rule with symmetric hash function, the RSS type shouldn't carry with SRC/DST_ONLY. This patch adds invalid RSS type check for the case.

Fixes 91f27b2e39ab ("net/iavf: refactor RSS")

v4:
* Simplify code to be more readable.

v3:
* Correct invalid case.

v2:
* Move invalid check into "iavf_any_invalid_rss_type".

---
 drivers/net/iavf/iavf_hash.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_hash.c +13 -2
index be821b6..915b7c5 100644
@@ -834,10 +834,21 @@ static struct rss_attr_type rss_attr_to_valid_type[] = {
 };
 
 static bool
-iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
+iavf_any_invalid_rss_type(enum rte_eth_hash_function rss_func,
+			  uint64_t rss_type, uint64_t allow_rss_type)
 {
 	uint32_t i;
 
+	/**
+	 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+	 * hash function.
+	 */
+	if (rss_func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+		if (rss_type & (ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY |
+		    ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY))
+			return true;
+	}
+
 	/* check invalid combination */
 	for (i = 0; i < RTE_DIM(invalid_rss_comb); i++) {
 		if (__builtin_popcountll(rss_type & invalid_rss_comb[i]) > 1)
@@ -917,7 +928,7 @@ iavf_hash_parse_action(struct iavf_pattern_match_item *match_item,
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
-			if (iavf_any_invalid_rss_type(rss_type,
+			if (iavf_any_invalid_rss_type(rss->func, rss_type,
 					match_item->input_set_mask))
 				return rte_flow_error_set(error, ENOTSUP,
 						RTE_FLOW_ERROR_TYPE_ACTION,
Signature · 1 line
2.9.5
Acked-by on v4 1/1 Applied
#6 lore raw
Quoted 10 lines

-----Original Message-----
From: Su, Simei <[email protected]>
Sent: Monday, November 2, 2020 7:56 PM
To: Zhang, Qi Z <[email protected]>
Cc: [email protected]; Guo, Junfeng <[email protected]>; Guo, Jia <[email protected]>; Su, Simei <[email protected]>
Subject: [PATCH v4] net/iavf: fix invalid RSS type

Quoted 2 lines

When a RSS rule with symmetric hash function, the RSS type shouldn't carry with SRC/DST_ONLY. This patch adds invalid RSS type check for the case.

Need to specify l3/l4 SRC/DST_ONLY

Quoted 5 lines
Fixes 91f27b2e39ab ("net/iavf: refactor RSS")
Quoted 8 lines

v4:
* Simplify code to be more readable.

v3:
* Correct invalid case.

v2:
* Move invalid check into "iavf_any_invalid_rss_type".

Version tracking should not be part of the commit log.

Quoted 11 lines
---
 drivers/net/iavf/iavf_hash.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_hash.c index renamed from drivers/net/iavf/iavf_hash.c +0 -0

be821b6..915b7c5 100644

drivers/net/iavf/iavf_hash.c +0 -0
@@ -834,10 +834,21 @@ static struct rss_attr_type rss_attr_to_valid_type[] =
 {  };
 

drivers/net/iavf/iavf_hash.c static struct rss_attr_type rss_attr_to_valid_type[] = · line 844

Quoted 10 lines
drivers/net/iavf/iavf_hash.c +5 -1
 static bool
-iavf_any_invalid_rss_type(uint64_t rss_type, uint64_t allow_rss_type)
+iavf_any_invalid_rss_type(enum rte_eth_hash_function rss_func,
+			  uint64_t rss_type, uint64_t allow_rss_type)
 {
 	uint32_t i;
 
+	/**
+	 * Check if SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+	 * hash function.

Need to specifyl3/l4 SRC/DST_ONLY

Quoted 21 lines
drivers/net/iavf/iavf_hash.c +7 -1
+	 */
+	if (rss_func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+		if (rss_type & (ETH_RSS_L3_SRC_ONLY | ETH_RSS_L3_DST_ONLY |
+		    ETH_RSS_L4_SRC_ONLY | ETH_RSS_L4_DST_ONLY))
+			return true;
+	}
+
 	/* check invalid combination */
 	for (i = 0; i < RTE_DIM(invalid_rss_comb); i++) {
 		if (__builtin_popcountll(rss_type & invalid_rss_comb[i]) > 1) @@
-917,7 +928,7 @@ iavf_hash_parse_action(struct iavf_pattern_match_item

*match_item,

drivers/net/iavf/iavf_hash.c +1 -2
 			 */
 			rss_type = rte_eth_rss_hf_refine(rss_type);
 
-			if (iavf_any_invalid_rss_type(rss_type,
+			if (iavf_any_invalid_rss_type(rss->func, rss_type,
 					match_item->input_set_mask))
 				return rte_flow_error_set(error, ENOTSUP,
 						RTE_FLOW_ERROR_TYPE_ACTION,
--
Quoted 1 line

2.9.5

Besides above minor captures

Applied to dpdk-next-net-intel after fix those captures.

Thanks
Qi