net/ice/base: update IPv4 and IPv6 flow packet type masks
[dpdk.git] / drivers / net / ice / ice_hash.c
index 2e9c1bc..3d58b71 100644 (file)
@@ -79,23 +79,29 @@ ice_hash_parse_pattern_action(struct ice_adapter *ad,
 struct rss_type_match_hdr hint_0 = {
        ICE_FLOW_SEG_HDR_NONE,  0};
 struct rss_type_match_hdr hint_1 = {
-       ICE_FLOW_SEG_HDR_IPV4 ETH_RSS_IPV4};
+       ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_IPV4};
 struct rss_type_match_hdr hint_2 = {
-       ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_UDP, ETH_RSS_NONFRAG_IPV4_UDP};
+       ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_UDP |
+       ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV4_UDP};
 struct rss_type_match_hdr hint_3 = {
-       ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_TCP, ETH_RSS_NONFRAG_IPV4_TCP};
+       ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_TCP |
+       ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV4_TCP};
 struct rss_type_match_hdr hint_4 = {
-       ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_SCTP, ETH_RSS_NONFRAG_IPV4_SCTP};
+       ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_SCTP |
+       ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV4_SCTP};
 struct rss_type_match_hdr hint_5 = {
-       ICE_FLOW_SEG_HDR_IPV6 ETH_RSS_IPV6};
+       ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_IPV6};
 struct rss_type_match_hdr hint_6 = {
-       ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_UDP, ETH_RSS_NONFRAG_IPV6_UDP};
+       ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_UDP |
+       ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV6_UDP};
 struct rss_type_match_hdr hint_7 = {
-       ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_TCP, ETH_RSS_NONFRAG_IPV6_TCP};
+       ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_TCP |
+       ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV6_TCP};
 struct rss_type_match_hdr hint_8 = {
-       ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_SCTP, ETH_RSS_NONFRAG_IPV6_SCTP};
+       ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_SCTP |
+       ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV6_SCTP};
 struct rss_type_match_hdr hint_9 = {
-       ICE_FLOW_SEG_HDR_GTPU_IP,       ETH_RSS_IPV4};
+       ICE_FLOW_SEG_HDR_GTPU_EH, ETH_RSS_IPV4};
 struct rss_type_match_hdr hint_10 = {
        ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_IPV4};
 struct rss_type_match_hdr hint_11 = {
@@ -104,6 +110,10 @@ struct rss_type_match_hdr hint_12 = {
        ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_NONFRAG_IPV4_TCP};
 struct rss_type_match_hdr hint_13 = {
        ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_NONFRAG_IPV4_SCTP};
+struct rss_type_match_hdr hint_14 = {
+       ICE_FLOW_SEG_HDR_GTPU_EH, ETH_RSS_NONFRAG_IPV4_UDP};
+struct rss_type_match_hdr hint_15 = {
+       ICE_FLOW_SEG_HDR_GTPU_EH, ETH_RSS_NONFRAG_IPV4_TCP};
 
 /* Supported pattern for os default package. */
 static struct ice_pattern_match_item ice_hash_pattern_list_os[] = {
@@ -120,22 +130,22 @@ static struct ice_pattern_match_item ice_hash_pattern_list_os[] = {
 
 /* Supported pattern for comms package. */
 static struct ice_pattern_match_item ice_hash_pattern_list_comms[] = {
-       {pattern_eth_ipv4,               ICE_INSET_NONE,  &hint_1},
-       {pattern_eth_ipv4_udp,           ICE_INSET_NONE,  &hint_2},
-       {pattern_eth_ipv4_tcp,           ICE_INSET_NONE,  &hint_3},
-       {pattern_eth_ipv4_sctp,          ICE_INSET_NONE,  &hint_4},
-       {pattern_eth_ipv6,               ICE_INSET_NONE,  &hint_5},
-       {pattern_eth_ipv6_udp,           ICE_INSET_NONE,  &hint_6},
-       {pattern_eth_ipv6_tcp,           ICE_INSET_NONE,  &hint_7},
-       {pattern_eth_ipv6_sctp,          ICE_INSET_NONE,  &hint_8},
-       {pattern_empty,                  ICE_INSET_NONE,  &hint_0},
-       {pattern_eth_ipv4_gtpu_ipv4,     ICE_INSET_NONE,  &hint_9},
-       {pattern_eth_ipv4_gtpu_ipv4_udp, ICE_INSET_NONE,  &hint_9},
-       {pattern_eth_ipv4_gtpu_ipv4_tcp, ICE_INSET_NONE,  &hint_9},
-       {pattern_eth_pppoes_ipv4,        ICE_INSET_NONE,  &hint_10},
-       {pattern_eth_pppoes_ipv4_udp,    ICE_INSET_NONE,  &hint_11},
-       {pattern_eth_pppoes_ipv4_tcp,    ICE_INSET_NONE,  &hint_12},
-       {pattern_eth_pppoes_ipv4_sctp,   ICE_INSET_NONE,  &hint_13},
+       {pattern_eth_ipv4,                  ICE_INSET_NONE,  &hint_1},
+       {pattern_eth_ipv4_udp,              ICE_INSET_NONE,  &hint_2},
+       {pattern_eth_ipv4_tcp,              ICE_INSET_NONE,  &hint_3},
+       {pattern_eth_ipv4_sctp,             ICE_INSET_NONE,  &hint_4},
+       {pattern_eth_ipv6,                  ICE_INSET_NONE,  &hint_5},
+       {pattern_eth_ipv6_udp,              ICE_INSET_NONE,  &hint_6},
+       {pattern_eth_ipv6_tcp,              ICE_INSET_NONE,  &hint_7},
+       {pattern_eth_ipv6_sctp,             ICE_INSET_NONE,  &hint_8},
+       {pattern_empty,                     ICE_INSET_NONE,  &hint_0},
+       {pattern_eth_ipv4_gtpu_eh_ipv4,     ICE_INSET_NONE,  &hint_9},
+       {pattern_eth_ipv4_gtpu_eh_ipv4_udp, ICE_INSET_NONE,  &hint_14},
+       {pattern_eth_ipv4_gtpu_eh_ipv4_tcp, ICE_INSET_NONE,  &hint_15},
+       {pattern_eth_pppoes_ipv4,           ICE_INSET_NONE,  &hint_10},
+       {pattern_eth_pppoes_ipv4_udp,       ICE_INSET_NONE,  &hint_11},
+       {pattern_eth_pppoes_ipv4_tcp,       ICE_INSET_NONE,  &hint_12},
+       {pattern_eth_pppoes_ipv4_sctp,      ICE_INSET_NONE,  &hint_13},
 };
 
 /**
@@ -243,6 +253,9 @@ ice_hash_init(struct ice_adapter *ad)
 {
        struct ice_flow_parser *parser = NULL;
 
+       if (ad->hw.dcf_enabled)
+               return 0;
+
        if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT)
                parser = &ice_hash_parser_os;
        else if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)
@@ -424,26 +437,31 @@ ice_hash_parse_pattern_action(__rte_unused struct ice_adapter *ad,
        /* Check rss supported pattern and find matched pattern. */
        pattern_match_item = ice_search_pattern_match_item(pattern,
                                        array, array_len, error);
-       if (!pattern_match_item)
-               return -rte_errno;
+       if (!pattern_match_item) {
+               ret = -rte_errno;
+               goto error;
+       }
 
        ret = ice_hash_check_inset(pattern, error);
        if (ret)
-               return -rte_errno;
+               goto error;
 
        /* Save protocol header to rss_meta. */
-       *meta = rss_meta_ptr;
-       ((struct rss_meta *)*meta)->pkt_hdr = ((struct rss_type_match_hdr *)
+       rss_meta_ptr->pkt_hdr = ((struct rss_type_match_hdr *)
                (pattern_match_item->meta))->hdr_mask;
 
        /* Check rss action. */
-       ret = ice_hash_parse_action(pattern_match_item, actions, meta, error);
-       if (ret)
-               return -rte_errno;
+       ret = ice_hash_parse_action(pattern_match_item, actions,
+                                   (void **)&rss_meta_ptr, error);
 
+error:
+       if (!ret && meta)
+               *meta = rss_meta_ptr;
+       else
+               rte_free(rss_meta_ptr);
        rte_free(pattern_match_item);
 
-       return 0;
+       return ret;
 }
 
 static int
@@ -560,6 +578,9 @@ error:
 static void
 ice_hash_uninit(struct ice_adapter *ad)
 {
+       if (ad->hw.dcf_enabled)
+               return;
+
        if (ad->active_pkg_type == ICE_PKG_TYPE_OS_DEFAULT)
                ice_unregister_parser(&ice_hash_parser_os, ad);
        else if (ad->active_pkg_type == ICE_PKG_TYPE_COMMS)