net/i40e: fix available RSS hash function
authorSteve Yang <stevex.yang@intel.com>
Mon, 21 Jun 2021 08:03:42 +0000 (08:03 +0000)
committerQi Zhang <qi.z.zhang@intel.com>
Sun, 4 Jul 2021 14:57:15 +0000 (16:57 +0200)
i40e can support following rss hash function types: default/toeplitz,
symmetric toeplitz, and simple_xor. However, when filter engine parses
pattern action, it only supports symmetric toeplitz & default.

Add simple_xor and toeplitz hash functions support when parsing pattern
action.

Fixes: ef4c16fd9148 ("net/i40e: refactor RSS flow")
Cc: stable@dpdk.org
Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/i40e/i40e_hash.c

index b1cb24f..0cef21c 100644 (file)
@@ -1105,13 +1105,21 @@ i40e_hash_parse_pattern_act(const struct rte_eth_dev *dev,
                                          NULL,
                                          "RSS Queues not supported when pattern specified");
 
-       if (rss_act->func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ)
+       switch (rss_act->func) {
+       case RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ:
                rss_conf->symmetric_enable = true;
-       else if (rss_act->func != RTE_ETH_HASH_FUNCTION_DEFAULT)
-               return rte_flow_error_set(error, -EINVAL,
-                                         RTE_FLOW_ERROR_TYPE_ACTION_CONF,
-                                         NULL,
-                                         "Only symmetric TOEPLITZ supported when pattern specified");
+               break;
+       case RTE_ETH_HASH_FUNCTION_DEFAULT:
+       case RTE_ETH_HASH_FUNCTION_TOEPLITZ:
+       case RTE_ETH_HASH_FUNCTION_SIMPLE_XOR:
+               break;
+       default:
+               return rte_flow_error_set(error, EINVAL,
+                               RTE_FLOW_ERROR_TYPE_ACTION_CONF,
+                               NULL,
+                               "RSS hash function not supported "
+                               "when pattern specified");
+       }
 
        if (!i40e_hash_validate_rss_types(rss_act->types))
                return rte_flow_error_set(error, EINVAL,