net/bnxt: refactor async event handling
[dpdk.git] / drivers / net / ice / ice_hash.c
index 2bf8983..bc809e9 100644 (file)
@@ -111,7 +111,6 @@ ice_hash_parse_pattern_action(struct ice_adapter *ad,
 /* Rss configuration template */
 struct ice_rss_hash_cfg ipv4_tmplt = {
        ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_IPV4 |
-       ICE_FLOW_SEG_HDR_IPV_FRAG |
        ICE_FLOW_SEG_HDR_IPV_OTHER,
        ICE_FLOW_HASH_ETH | ICE_FLOW_HASH_IPV4,
        ICE_RSS_OUTER_HEADERS,
@@ -152,8 +151,7 @@ struct ice_rss_hash_cfg ipv6_tmplt = {
 
 struct ice_rss_hash_cfg ipv6_frag_tmplt = {
        ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_IPV6 |
-       ICE_FLOW_SEG_HDR_IPV_FRAG |
-       ICE_FLOW_SEG_HDR_IPV_OTHER,
+       ICE_FLOW_SEG_HDR_IPV_FRAG,
        ICE_FLOW_HASH_ETH | ICE_FLOW_HASH_IPV6,
        ICE_RSS_ANY_HEADERS,
        0
@@ -367,6 +365,13 @@ struct ice_rss_hash_cfg empty_tmplt = {
        0
 };
 
+struct ice_rss_hash_cfg eth_tmplt = {
+       ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_ETH_NON_IP,
+       ICE_FLOW_HASH_ETH,
+       ICE_RSS_OUTER_HEADERS,
+       0
+};
+
 /* IPv4 */
 #define ICE_RSS_TYPE_ETH_IPV4          (ETH_RSS_ETH | ETH_RSS_IPV4 | \
                                         ETH_RSS_FRAG_IPV4)
@@ -469,6 +474,9 @@ struct ice_rss_hash_cfg empty_tmplt = {
 #define ICE_RSS_TYPE_IPV4_PFCP         (ETH_RSS_PFCP | ETH_RSS_IPV4)
 #define ICE_RSS_TYPE_IPV6_PFCP         (ETH_RSS_PFCP | ETH_RSS_IPV6)
 
+/* MAC */
+#define ICE_RSS_TYPE_ETH               ETH_RSS_ETH
+
 /**
  * Supported pattern for hash.
  * The first member is pattern item type,
@@ -538,6 +546,8 @@ static struct ice_pattern_match_item ice_hash_pattern_list[] = {
        {pattern_eth_ipv6_pfcp,                 ICE_RSS_TYPE_IPV6_PFCP,         ICE_INSET_NONE, &eth_ipv6_pfcp_tmplt},
        /* PPPOE */
        {pattern_eth_pppoes,                    ICE_RSS_TYPE_PPPOE,             ICE_INSET_NONE, &pppoe_tmplt},
+       /* MAC */
+       {pattern_ethertype,                     ICE_RSS_TYPE_ETH,               ICE_INSET_NONE, &eth_tmplt},
        /* EMPTY */
        {pattern_empty,                         ICE_INSET_NONE,                 ICE_INSET_NONE, &empty_tmplt},
 };
@@ -639,6 +649,11 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
                *addl_hdrs &= ~ICE_FLOW_SEG_HDR_ETH;
        }
 
+       if (*addl_hdrs & ICE_FLOW_SEG_HDR_ETH_NON_IP) {
+               if (rss_type & ETH_RSS_ETH)
+                       *hash_flds |= BIT_ULL(ICE_FLOW_FIELD_IDX_ETH_TYPE);
+       }
+
        if (*addl_hdrs & ICE_FLOW_SEG_HDR_VLAN) {
                if (rss_type & ETH_RSS_C_VLAN)
                        *hash_flds |= BIT_ULL(ICE_FLOW_FIELD_IDX_C_VLAN);
@@ -657,10 +672,13 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
                    ETH_RSS_NONFRAG_IPV4_UDP |
                    ETH_RSS_NONFRAG_IPV4_TCP |
                    ETH_RSS_NONFRAG_IPV4_SCTP)) {
-                       if (rss_type & ETH_RSS_FRAG_IPV4)
-                               *hash_flds &=
-                                       ~(BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_ID));
-                       else if (rss_type & ETH_RSS_L3_SRC_ONLY)
+                       if (rss_type & ETH_RSS_FRAG_IPV4) {
+                               *addl_hdrs |= ICE_FLOW_SEG_HDR_IPV_FRAG;
+                               *addl_hdrs &= ~(ICE_FLOW_SEG_HDR_IPV_OTHER);
+                               *hash_flds |=
+                                       BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_ID);
+                       }
+                       if (rss_type & ETH_RSS_L3_SRC_ONLY)
                                *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_DA));
                        else if (rss_type & ETH_RSS_L3_DST_ONLY)
                                *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_IPV4_SA));
@@ -680,9 +698,9 @@ ice_refine_hash_cfg_l234(struct ice_rss_hash_cfg *hash_cfg,
                    ETH_RSS_NONFRAG_IPV6_TCP |
                    ETH_RSS_NONFRAG_IPV6_SCTP)) {
                        if (rss_type & ETH_RSS_FRAG_IPV6)
-                               *hash_flds &=
-                                       ~(BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_ID));
-                       else if (rss_type & ETH_RSS_L3_SRC_ONLY)
+                               *hash_flds |=
+                                       BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_ID);
+                       if (rss_type & ETH_RSS_L3_SRC_ONLY)
                                *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_DA));
                        else if (rss_type & ETH_RSS_L3_DST_ONLY)
                                *hash_flds &= ~(BIT_ULL(ICE_FLOW_FIELD_IDX_IPV6_SA));