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")

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

diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c
index c4c73e6644..0061eb6652 100644
--- a/drivers/net/iavf/iavf_hash.c
+++ b/drivers/net/iavf/iavf_hash.c
@@ -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];
-- 
2.17.1

Reply via email to