net/i40e: fix RSS rule creation with L2 payload
authorShougang Wang <shougangx.wang@intel.com>
Thu, 7 May 2020 09:44:01 +0000 (09:44 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 18 May 2020 18:35:57 +0000 (20:35 +0200)
This patch fixes the issue that failed to create an RSS rule with type
L2-payload.

Fixes: feaae285b342 ("net/i40e: support hash configuration in RSS flow")

Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
Tested-by: Hailin Xu <hailinx.xu@intel.com>
Reviewed-by: Jeff Guo <jia.guo@intel.com>
drivers/net/i40e/i40e_flow.c

index 8ce21f7..72f3527 100644 (file)
@@ -4510,6 +4510,7 @@ i40e_flow_parse_rss_pattern(__rte_unused struct rte_eth_dev *dev,
                { pattern_fdir_ipv6_tcp, ETH_RSS_NONFRAG_IPV6_TCP },
                { pattern_fdir_ipv6_udp, ETH_RSS_NONFRAG_IPV6_UDP },
                { pattern_fdir_ipv6_sctp, ETH_RSS_NONFRAG_IPV6_SCTP },
+               { pattern_ethertype, ETH_RSS_L2_PAYLOAD },
                { pattern_fdir_ipv6_esp, ETH_RSS_ESP },
                { pattern_fdir_ipv6_udp_esp, ETH_RSS_ESP },
        };
@@ -4543,8 +4544,7 @@ i40e_flow_parse_rss_pattern(__rte_unused struct rte_eth_dev *dev,
                if (i40e_match_pattern(i40e_rss_pctype_patterns[i].item_array,
                                        items)) {
                        p_info->types = i40e_rss_pctype_patterns[i].type;
-                       rte_free(items);
-                       return 0;
+                       break;
                }
        }
 
@@ -4579,11 +4579,9 @@ i40e_flow_parse_rss_pattern(__rte_unused struct rte_eth_dev *dev,
                        }
                        break;
                default:
-                       rte_flow_error_set(error, EINVAL,
-                                       RTE_FLOW_ERROR_TYPE_ITEM,
-                                       item,
-                                       "Not support range");
-                       return -rte_errno;
+                       p_info->action_flag = 0;
+                       memset(info, 0, sizeof(struct i40e_queue_regions));
+                       return 0;
                }
        }
 
@@ -4639,7 +4637,7 @@ i40e_flow_parse_rss_action(struct rte_eth_dev *dev,
                return -rte_errno;
        }
 
-       if (p_info.action_flag) {
+       if (p_info.action_flag && rss->queue_num) {
                for (n = 0; n < 64; n++) {
                        if (rss->types & (hf_bit << n)) {
                                conf_info->region[0].hw_flowtype[0] = n;