net/iavf: fix GTPU UL and DL support for flow director
authorJunfeng Guo <junfeng.guo@intel.com>
Thu, 31 Dec 2020 05:13:07 +0000 (13:13 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:06 +0000 (16:03 +0100)
For AVF FDIR, GTPU uplink and downlink are not supported in previous
code. This patch distinguishes GTPU with IP/EH/DL/UL for AVF FDIR.

Fixes: 4c7a41ae6b23 ("net/iavf: support flow director GTPU outer IPv4/IPv6")
Cc: stable@dpdk.org
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Tested-by: Hailin Xu <hailinx.xu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_fdir.c

index 64bdb21..cce54f9 100644 (file)
@@ -25,6 +25,9 @@
 #define IAVF_FDIR_IPV6_TC_OFFSET 20
 #define IAVF_IPV6_TC_MASK  (0xFF << IAVF_FDIR_IPV6_TC_OFFSET)
 
+#define IAVF_GTPU_EH_DWLINK 0
+#define IAVF_GTPU_EH_UPLINK 1
+
 #define IAVF_FDIR_INSET_ETH (\
        IAVF_INSET_ETHERTYPE)
 
@@ -814,7 +817,14 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 
                        hdr = &filter->add_fltr.rule_cfg.proto_hdrs.proto_hdr[layer];
 
-                       VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_EH);
+                       if (!gtp_psc_spec)
+                               VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_EH);
+                       else if ((gtp_psc_mask->qfi) && !(gtp_psc_mask->pdu_type))
+                               VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_EH);
+                       else if (gtp_psc_spec->pdu_type == IAVF_GTPU_EH_UPLINK)
+                               VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_EH_PDU_UP);
+                       else if (gtp_psc_spec->pdu_type == IAVF_GTPU_EH_DWLINK)
+                               VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GTPU_EH_PDU_DWN);
 
                        if (gtp_psc_spec && gtp_psc_mask) {
                                if (gtp_psc_mask->qfi == UINT8_MAX) {