Skip to contentSkip to conversation

net/iavf: fix negative GTP-U flow rules create successfully

PATCH Superseded Murphy Yang 4 participants 13 messages Dec 9, 2020 – Jan 13, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/iavf: fix negative GTP-U flow rules create successfully

Currently, when use 'flow' command to create a negative GTP-U rule, it will be created successfully.

The list shows the impacted outer and inner 'ipv4' GTP-U patterns with 'ipv4' or 'gtpu' type:
- iavf_pattern_eth_ipv4_gtpu_ipv4_udp
- iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp
- iavf_pattern_eth_ipv4_gtpu_ipv4_tcp
- iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp
- more impacted patterns with 'gtpu' type:

Quoted 2 lines

iavf_pattern_eth_ipv4_gtpu_ipv4
iavf_pattern_eth_ipv4_gtpu_eh_ipv4

Same as the outer and inner 'ipv6' GTP-U patterns.

So, this commit modifies the macro define of the 'IAVF_RSS_TYPE_XXX' to make the result correct.

Fixes 91f27b2e39ab ("net/iavf: refactor RSS")
---
 drivers/net/iavf/iavf_hash.c | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)
drivers/net/iavf/iavf_hash.c +10 -20
index c4c73e6644..7a3ea39d66 100644
@@ -326,34 +326,24 @@ struct virtchnl_proto_hdrs ipv6_udp_gtpc_tmplt = {
 					 ETH_RSS_S_VLAN | ETH_RSS_C_VLAN)
 /* IPv4 inner */
 #define IAVF_RSS_TYPE_INNER_IPV4	ETH_RSS_IPV4
-#define IAVF_RSS_TYPE_INNER_IPV4_UDP	(ETH_RSS_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_UDP)
-#define IAVF_RSS_TYPE_INNER_IPV4_TCP	(ETH_RSS_IPV4 | \
-					 ETH_RSS_NONFRAG_IPV4_TCP)
+#define IAVF_RSS_TYPE_INNER_IPV4_UDP	(ETH_RSS_NONFRAG_IPV4_UDP)
+#define IAVF_RSS_TYPE_INNER_IPV4_TCP	(ETH_RSS_NONFRAG_IPV4_TCP)
 #define IAVF_RSS_TYPE_INNER_IPV4_SCTP	(ETH_RSS_IPV4 | \
 					 ETH_RSS_NONFRAG_IPV4_SCTP)
 /* IPv6 inner */
 #define IAVF_RSS_TYPE_INNER_IPV6	ETH_RSS_IPV6
-#define IAVF_RSS_TYPE_INNER_IPV6_UDP	(ETH_RSS_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_UDP)
-#define IAVF_RSS_TYPE_INNER_IPV6_TCP	(ETH_RSS_IPV6 | \
-					 ETH_RSS_NONFRAG_IPV6_TCP)
+#define IAVF_RSS_TYPE_INNER_IPV6_UDP	(ETH_RSS_NONFRAG_IPV6_UDP)
+#define IAVF_RSS_TYPE_INNER_IPV6_TCP	(ETH_RSS_NONFRAG_IPV6_TCP)
 #define IAVF_RSS_TYPE_INNER_IPV6_SCTP	(ETH_RSS_IPV6 | \
 					 ETH_RSS_NONFRAG_IPV6_SCTP)
 /* GTPU IPv4 */
-#define IAVF_RSS_TYPE_GTPU_IPV4		(IAVF_RSS_TYPE_INNER_IPV4 | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_UDP	(IAVF_RSS_TYPE_INNER_IPV4_UDP | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_TCP	(IAVF_RSS_TYPE_INNER_IPV4_TCP | \
-					 ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV4		(IAVF_RSS_TYPE_INNER_IPV4)
+#define IAVF_RSS_TYPE_GTPU_IPV4_UDP	(IAVF_RSS_TYPE_INNER_IPV4_UDP)
+#define IAVF_RSS_TYPE_GTPU_IPV4_TCP	(IAVF_RSS_TYPE_INNER_IPV4_TCP)
 /* GTPU IPv6 */
-#define IAVF_RSS_TYPE_GTPU_IPV6		(IAVF_RSS_TYPE_INNER_IPV6 | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_UDP	(IAVF_RSS_TYPE_INNER_IPV6_UDP | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_TCP	(IAVF_RSS_TYPE_INNER_IPV6_TCP | \
-					 ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV6		(IAVF_RSS_TYPE_INNER_IPV6)
+#define IAVF_RSS_TYPE_GTPU_IPV6_UDP	(IAVF_RSS_TYPE_INNER_IPV6_UDP)
+#define IAVF_RSS_TYPE_GTPU_IPV6_TCP	(IAVF_RSS_TYPE_INNER_IPV6_TCP)
 /* ESP, AH, L2TPV3 and PFCP */
 #define IAVF_RSS_TYPE_IPV4_ESP		(ETH_RSS_ESP | ETH_RSS_IPV4)
 #define IAVF_RSS_TYPE_IPV4_AH		(ETH_RSS_AH | ETH_RSS_IPV4)
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 1/1 net/iavf: fix negative GTP-U flow rules create successfully

Currently, when use 'flow' command to create a negative GTP-U rule, it will be created successfully.

The list shows the impacted outer and inner 'ipv4' GTP-U patterns with 'ipv4' or 'gtpu' type:
- iavf_pattern_eth_ipv4_gtpu_ipv4_udp
- iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp
- iavf_pattern_eth_ipv4_gtpu_ipv4_tcp
- iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp
- more impacted patterns with 'gtpu' type:

Quoted 2 lines

iavf_pattern_eth_ipv4_gtpu_ipv4
iavf_pattern_eth_ipv4_gtpu_eh_ipv4

Same as the outer and inner 'ipv6' GTP-U patterns.

So, this commit adds the invalid RSS combinations in 'invalid_rss_comb' array to make result correct.

The list of added invalid RSS combinations:

 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP
Fixes 91f27b2e39ab ("net/iavf: refactor RSS")

---
v2:
- add invalid RSS combinations

 drivers/net/iavf/iavf_hash.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/iavf/iavf_hash.c +8 -0
index c4c73e6644..8393d8535b 100644
@@ -806,7 +806,15 @@ static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
 	RTE_ETH_RSS_L3_PRE96
Signature · 1 line
2.17.1
#2 lore raw

Hi, murphy

Quoted 30 lines

-----Original Message-----
From: Murphy Yang <[email protected]>
Sent: Friday, December 18, 2020 2:19 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Yang, SteveX <[email protected]>; Guo, Jia <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Yang, MurphyX <[email protected]>
Subject: [PATCH v2] net/iavf: fix negative GTP-U flow rules create successfully

Currently, when use 'flow' command to create a negative GTP-U rule, it will be created successfully.

The list shows the impacted outer and inner 'ipv4' GTP-U patterns with 'ipv4' or 'gtpu' type:
- iavf_pattern_eth_ipv4_gtpu_ipv4_udp
- iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp
- iavf_pattern_eth_ipv4_gtpu_ipv4_tcp
- iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp
- more impacted patterns with 'gtpu' type:

Quoted 2 lines

iavf_pattern_eth_ipv4_gtpu_ipv4
iavf_pattern_eth_ipv4_gtpu_eh_ipv4

Same as the outer and inner 'ipv6' GTP-U patterns.

So, this commit adds the invalid RSS combinations in 'invalid_rss_comb' array to make result correct.

The list of added invalid RSS combinations:

Quoted 9 lines
 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP

Seem that you add some specific negative flow case for the "ipv4(outer/inner) + gtpu" and "ipv4(outer/inner) + ipv4-udp(tcp)" in the currently invalid checking mode, so you commit log could be more clear and clean for that, thanks.

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

---
v2:
- add invalid RSS combinations

 drivers/net/iavf/iavf_hash.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/iavf/iavf_hash.c index renamed from drivers/net/iavf/iavf_hash.c +0 -0

c4c73e6644..8393d8535b 100644

drivers/net/iavf/iavf_hash.c +0 -0
@@ -806,7 +806,15 @@ static void iavf_refine_proto_hdrs(struct
 virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {

drivers/net/iavf/iavf_hash.c static void iavf_refine_proto_hdrs(struct · line 818

Quoted 10 lines
drivers/net/iavf/iavf_hash.c +8 -0
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP,

Shouldn't it be " ETH_RSS_GTPU | ETH_RSS_IPV4" if outer ip case is the same? Whatever you should considerate both if you check one.

Quoted 5 lines
drivers/net/iavf/iavf_hash.c +0 -0
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |

RTE_ETH_RSS_L3_PRE96
--
2.17.1

#3 lore raw

PATCH v3 1/1 net/iavf: fix invalid RSS combinations rule can be created

In reply to Murphy Yang

Currently, when use 'flow' command to create a rule that combine with several RSS types, even the RSS type combination is invalid, it also be created successfully.

Here list some invalid RSS combinations:

 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP
 - ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP

So, this patch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

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

---
v3:
- update the comments.
v2:
- add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/iavf/iavf_hash.c +8 -0
index c4c73e6644..8393d8535b 100644
@@ -806,7 +806,15 @@ static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_UDP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV4_TCP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_UDP,
+	ETH_RSS_GTPU | IAVF_RSS_TYPE_INNER_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
 	RTE_ETH_RSS_L3_PRE96
Signature · 1 line
2.17.1
#4 lore raw

PATCH v4 1/1 net/iavf: fix invalid RSS combinations rule can be created

Currently, when use 'flow' command to create a rule that combine with several RSS types, even the RSS type combination is invalid, it also be created successfully.

Here list some invalid RSS combinations:

 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV4
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV6
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

So, this patch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

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

---
v4:
- use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX' v3:
- update the comments.
v2:
- add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/iavf/iavf_hash.c +8 -0
index c4c73e6644..3ed72f6475 100644
@@ -806,7 +806,15 @@ static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
+	ETH_RSS_GTPU | ETH_RSS_IPV4,
+	ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
+	ETH_RSS_GTPU | ETH_RSS_IPV6,
+	ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
 	RTE_ETH_RSS_L3_PRE96
Signature · 1 line
2.17.1
Acked-by on v4 1/1
#5 lore raw

Re: [dpdk-dev] [PATCH v4] net/iavf: fix invalid RSS combinations rule can be created

Quoted 65 lines

-----Original Message-----
From: Murphy Yang <[email protected]>
Sent: Wednesday, December 23, 2020 4:04 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Guo, Jia <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Yang, MurphyX <[email protected]>
Subject: [PATCH v4] net/iavf: fix invalid RSS combinations rule can be created

Currently, when use 'flow' command to create a rule that combine with several RSS types, even the RSS type combination is invalid, it also be created successfully.

Here list some invalid RSS combinations:

 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV4
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV6
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

So, this patch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

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

---
v4:
- use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX' v3:
- update the comments.
v2:
- add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/iavf/iavf_hash.c index renamed from drivers/net/iavf/iavf_hash.c +0 -0

c4c73e6644..3ed72f6475 100644

drivers/net/iavf/iavf_hash.c +8 -0
@@ -806,7 +806,15 @@ static void iavf_refine_proto_hdrs(struct
 virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
+	ETH_RSS_GTPU | ETH_RSS_IPV4,
+	ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
+	ETH_RSS_GTPU | ETH_RSS_IPV6,
+	ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |

RTE_ETH_RSS_L3_PRE96
--
2.17.1

#6 lore raw

PATCH v5 1/1 net/iavf: fix invalid RSS combinations rule can be created

In reply to Murphy Yang

Currently, when use 'flow' command to create a rule that combine with several RSS types, even the RSS type combination is invalid, it also be created successfully.

Here list some invalid RSS combinations:

 - ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV4
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV6
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

For 'ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP' (same as IPV6), this pathch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

For other 'ETH_RSS_GTPU' invalid combinations, this patch removes the 'ETH_RSS_GTPU' from the input set mask, if the combination is invalid, the 'rss_type' check will be failed, the rule will be created unsuccessful.

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

---
v5:
- remove 'ETH_RSS_GTPU' from input set mask. v4:
- use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX' v3:
- update the comments.
v2:
- add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)
drivers/net/iavf/iavf_hash.c +8 -12
index c4c73e6644..916d6c5dfa 100644
@@ -341,19 +341,13 @@ struct virtchnl_proto_hdrs ipv6_udp_gtpc_tmplt = {
 #define IAVF_RSS_TYPE_INNER_IPV6_SCTP	(ETH_RSS_IPV6 | \
 					 ETH_RSS_NONFRAG_IPV6_SCTP)
 /* GTPU IPv4 */
-#define IAVF_RSS_TYPE_GTPU_IPV4		(IAVF_RSS_TYPE_INNER_IPV4 | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_UDP	(IAVF_RSS_TYPE_INNER_IPV4_UDP | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV4_TCP	(IAVF_RSS_TYPE_INNER_IPV4_TCP | \
-					 ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV4		IAVF_RSS_TYPE_INNER_IPV4
+#define IAVF_RSS_TYPE_GTPU_IPV4_UDP	IAVF_RSS_TYPE_INNER_IPV4_UDP
+#define IAVF_RSS_TYPE_GTPU_IPV4_TCP	IAVF_RSS_TYPE_INNER_IPV4_TCP
 /* GTPU IPv6 */
-#define IAVF_RSS_TYPE_GTPU_IPV6		(IAVF_RSS_TYPE_INNER_IPV6 | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_UDP	(IAVF_RSS_TYPE_INNER_IPV6_UDP | \
-					 ETH_RSS_GTPU)
-#define IAVF_RSS_TYPE_GTPU_IPV6_TCP	(IAVF_RSS_TYPE_INNER_IPV6_TCP | \
-					 ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV6		IAVF_RSS_TYPE_INNER_IPV6
+#define IAVF_RSS_TYPE_GTPU_IPV6_UDP	IAVF_RSS_TYPE_INNER_IPV6_UDP
+#define IAVF_RSS_TYPE_GTPU_IPV6_TCP	IAVF_RSS_TYPE_INNER_IPV6_TCP
 /* ESP, AH, L2TPV3 and PFCP */
 #define IAVF_RSS_TYPE_IPV4_ESP		(ETH_RSS_ESP | ETH_RSS_IPV4)
 #define IAVF_RSS_TYPE_IPV4_AH		(ETH_RSS_AH | ETH_RSS_IPV4)
@@ -806,7 +800,9 @@ static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
 	RTE_ETH_RSS_L3_PRE96
Signature · 1 line
2.17.1
#7 lore raw

PATCH v6 1/1 net/iavf: fix invalid RSS combinations rule can be created

Currently, when use 'flow' command to create a rule that combine with several RSS types, even the RSS type combination is invalid or unsupported, it also be created successfully.

Here list some invalid RSS combinations:
- ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
- ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

Here list some currently unsupported RSS combinations:

 - ETH_RSS_GTPU | ETH_RSS_IPV4
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
 - ETH_RSS_GTPU | ETH_RSS_IPV6
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP
 - ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

For invalid RSS combinations, this
patch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

For unsupported RSS combinations, this patch adds these combinations in 'unsupported_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

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

---
v6:
- add unsupported RSS combinations array.
v5:
- remove 'ETH_RSS_GTPU' from input set mask. v4:
- use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX' v3:
- update the comments.
v2:
- add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
drivers/net/iavf/iavf_hash.c +18 -0
index c4c73e6644..0061eb6652 100644
@@ -806,12 +806,23 @@ static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
 	RTE_ETH_RSS_L3_PRE96
 };
 
+static uint64_t unsupported_rss_comb[] = {
+	ETH_RSS_GTPU | ETH_RSS_IPV4,
+	ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_GTPU | ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
+	ETH_RSS_GTPU | ETH_RSS_IPV6,
+	ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_GTPU | ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP
+};
+
 struct rss_attr_type {
 	uint64_t attr;
 	uint64_t type;
@@ -875,6 +886,13 @@ iavf_any_invalid_rss_type(enum rte_eth_hash_function rss_func,
 			return true;
 	}
 
+	/* check unsupported rss combination */
+	for (i = 0; i < RTE_DIM(unsupported_rss_comb); i++) {
+		if (__builtin_popcountll(rss_type &
+				unsupported_rss_comb[i]) > 1)
+			return true;
+	}
+
 	/* check invalid RSS attribute */
 	for (i = 0; i < RTE_DIM(rss_attr_to_valid_type); i++) {
 		struct rss_attr_type *rat = &rss_attr_to_valid_type[i];
Signature · 1 line
2.17.1
#8 lore raw

PATCH v7 1/1 net/iavf: fix invalid RSS combinations rule can be created

Currently, when use 'flow' command to create a rule that combine with several RSS types, even the RSS type combination is invalid, it also be created successfully.

Here list some invalid RSS combinations:
- ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
- ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

For 'ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP' (same as IPV6), this pathch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

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

---
v7:
- Remove unsupported RSS combinations array.
- Restored 'ETH_RSS_GTPU' in input set mask. v6:
- Add unsupported RSS combinations array.
v5:
- Remove 'ETH_RSS_GTPU' from input set mask. v4:
- Use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX' v3:
- Update the comments.
v2:
- Add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/iavf/iavf_hash.c +2 -0
index 7620876b58..ebaac58254 100644
@@ -863,7 +863,9 @@ static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
 	RTE_ETH_RSS_L3_PRE96
Signature · 1 line
2.17.1
#9 lore raw

PATCH v8 1/1 net/iavf: fix invalid RSS combinations rule can be created

Currently, when use 'flow' command to create a rule with following invalid RSS type combination, it can be created successfully.

Invalid RSS combinations list:
- ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
- ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

This patch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

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

---
v8:
- Update the comments.
v7:
- Remove unsupported RSS combinations array.
- Restored 'ETH_RSS_GTPU' in input set mask. v6:
- Add unsupported RSS combinations array.
v5:
- Remove 'ETH_RSS_GTPU' from input set mask. v4:
- Use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX' v3:
- Update the comments.
v2:
- Add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/iavf/iavf_hash.c +2 -0
index 7620876b58..ebaac58254 100644
@@ -863,7 +863,9 @@ static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
 	RTE_ETH_RSS_L3_PRE96
Signature · 1 line
2.17.1
Acked-by on v8 1/1
#10 lore raw

Re: [dpdk-dev] [PATCH v8] net/iavf: fix invalid RSS combinations rule can be created

Quoted 59 lines

-----Original Message-----
From: Murphy Yang <[email protected]>
Sent: Thursday, January 7, 2021 5:17 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Guo, Jia <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Yang, MurphyX <[email protected]>
Subject: [PATCH v8] net/iavf: fix invalid RSS combinations rule can be created

Currently, when use 'flow' command to create a rule with following invalid RSS type combination, it can be created successfully.

Invalid RSS combinations list:
- ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
- ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

This patch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

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

---
v8:
- Update the comments.
v7:
- Remove unsupported RSS combinations array.
- Restored 'ETH_RSS_GTPU' in input set mask. v6:
- Add unsupported RSS combinations array.
v5:
- Remove 'ETH_RSS_GTPU' from input set mask. v4:
- Use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX' v3:
- Update the comments.
v2:
- Add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/iavf/iavf_hash.c index renamed from drivers/net/iavf/iavf_hash.c +0 -0

7620876b58..ebaac58254 100644

drivers/net/iavf/iavf_hash.c +2 -0
@@ -863,7 +863,9 @@ static void iavf_refine_proto_hdrs(struct
 virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |

RTE_ETH_RSS_L3_PRE96
--
2.17.1

Applied
#11 lore raw

Re: [dpdk-dev] [PATCH v8] net/iavf: fix invalid RSS combinations rule can be created

Quoted 29 lines

-----Original Message-----
From: Guo, Jia <[email protected]>
Sent: Thursday, January 7, 2021 5:33 PM
To: Yang, MurphyX <[email protected]>; [email protected]
Cc: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Yang, MurphyX <[email protected]>
Subject: RE: [PATCH v8] net/iavf: fix invalid RSS combinations rule can be created

Quoted 14 lines

-----Original Message-----
From: Murphy Yang <[email protected]>
Sent: Thursday, January 7, 2021 5:17 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Guo, Jia <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Yang, MurphyX <[email protected]>
Subject: [PATCH v8] net/iavf: fix invalid RSS combinations rule can be created

Currently, when use 'flow' command to create a rule with following invalid RSS type combination, it can be created successfully.

Quoted 11 lines
Quoted 6 lines

Invalid RSS combinations list:
- ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
- ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

This patch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created

unsuccessful.

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

Applied to dpdk-next-net-intel.

Thanks
Qi

Tested-by on v8 1/1
#12 lore raw

Re: [dpdk-dev] [PATCH v8] net/iavf: fix invalid RSS combinations rule can be created

In reply to Murphy Yang

Regards,
HuangZhiMin

Quoted 60 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Murphy Yang
Sent: Thursday, January 7, 2021 5:17 PM
To: [email protected]
Cc: Yang, Qiming <[email protected]>; Guo, Jia <[email protected]>; Zhang, Qi Z <[email protected]>; Yang, SteveX <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Yang, MurphyX <[email protected]>
Subject: [dpdk-dev] [PATCH v8] net/iavf: fix invalid RSS combinations rule can be created

Currently, when use 'flow' command to create a rule with following invalid RSS type combination, it can be created successfully.

Invalid RSS combinations list:
- ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP
- ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP

This patch adds these combinations in 'invalid_rss_comb' array to do valid check, if the combination check failed, the rule will be created unsuccessful.

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

---
v8:
- Update the comments.
v7:
- Remove unsupported RSS combinations array.
- Restored 'ETH_RSS_GTPU' in input set mask. v6:
- Add unsupported RSS combinations array.
v5:
- Remove 'ETH_RSS_GTPU' from input set mask. v4:
- Use 'ETH_RSS_XXX' replace 'IAVF_RSS_TYPE_INNER_XXX' v3:
- Update the comments.
v2:
- Add invalid RSS combinations.

 drivers/net/iavf/iavf_hash.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/iavf/iavf_hash.c index renamed from drivers/net/iavf/iavf_hash.c +0 -0

7620876b58..ebaac58254 100644

drivers/net/iavf/iavf_hash.c +2 -0
@@ -863,7 +863,9 @@ static void iavf_refine_proto_hdrs(struct
 virtchnl_proto_hdrs *proto_hdrs,
 
 static uint64_t invalid_rss_comb[] = {
 	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_UDP,
+	ETH_RSS_IPV4 | ETH_RSS_NONFRAG_IPV4_TCP,
 	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_UDP,
+	ETH_RSS_IPV6 | ETH_RSS_NONFRAG_IPV6_TCP,
 	RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
 	RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |

RTE_ETH_RSS_L3_PRE96
--
2.17.1