[v5] net/iavf: fix invalid RSS combinations rule can be created

Message ID 20201224022044.84292-1-murphyx.yang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Qi Zhang
Headers
Series [v5] net/iavf: fix invalid RSS combinations rule can be created |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-broadcom-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS

Commit Message

Murphy Yang Dec. 24, 2020, 2:20 a.m. UTC
  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")

Signed-off-by: Murphy Yang <murphyx.yang@intel.com>
---
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(-)
  

Patch

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c4c73e6644..916d6c5dfa 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -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