net/iavf: support eCPRI message type 0 for flow director
authorJunfeng Guo <junfeng.guo@intel.com>
Mon, 14 Dec 2020 06:49:12 +0000 (14:49 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Jan 2021 15:03:06 +0000 (16:03 +0100)
For eCPRI MSG Type 0, ecpriRtcid/ecpriPcid field within the eCPRI
header will be extracted to Field Vector for AVF FDIR.

SPEC for eCPRI:
http://www.cpri.info/downloads/eCPRI_v_2.0_2019_05_10c.pdf

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_fdir.c
drivers/net/iavf/iavf_generic_flow.h

index 7054bde..64bdb21 100644 (file)
 #define IAVF_FDIR_INSET_PFCP (\
        IAVF_INSET_PFCP_S_FIELD)
 
+#define IAVF_FDIR_INSET_ECPRI (\
+       IAVF_INSET_ECPRI)
+
 static struct iavf_pattern_match_item iavf_fdir_pattern[] = {
        {iavf_pattern_ethertype,                IAVF_FDIR_INSET_ETH,                    IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4,                 IAVF_FDIR_INSET_ETH_IPV4,               IAVF_INSET_NONE},
@@ -128,6 +131,8 @@ static struct iavf_pattern_match_item iavf_fdir_pattern[] = {
        {iavf_pattern_eth_ipv6_udp_esp,         IAVF_FDIR_INSET_IPV6_NATT_ESP,          IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv4_pfcp,            IAVF_FDIR_INSET_PFCP,                   IAVF_INSET_NONE},
        {iavf_pattern_eth_ipv6_pfcp,            IAVF_FDIR_INSET_PFCP,                   IAVF_INSET_NONE},
+       {iavf_pattern_eth_ecpri,                IAVF_FDIR_INSET_ECPRI,                  IAVF_INSET_NONE},
+       {iavf_pattern_eth_ipv4_ecpri,           IAVF_FDIR_INSET_ECPRI,                  IAVF_INSET_NONE},
 };
 
 static struct iavf_flow_parser iavf_fdir_parser;
@@ -469,6 +474,8 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
        const struct rte_flow_item_esp *esp_spec, *esp_mask;
        const struct rte_flow_item_ah *ah_spec, *ah_mask;
        const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
+       const struct rte_flow_item_ecpri *ecpri_spec, *ecpri_mask;
+       struct rte_ecpri_common_hdr ecpri_common;
        uint64_t input_set = IAVF_INSET_NONE;
 
        enum rte_flow_item_type next_type;
@@ -906,6 +913,31 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
                        filter->add_fltr.rule_cfg.proto_hdrs.count = ++layer;
                        break;
 
+               case RTE_FLOW_ITEM_TYPE_ECPRI:
+                       ecpri_spec = item->spec;
+                       ecpri_mask = item->mask;
+
+                       ecpri_common.u32 = rte_be_to_cpu_32(ecpri_spec->hdr.common.u32);
+
+                       hdr = &filter->add_fltr.rule_cfg.proto_hdrs.proto_hdr[layer];
+
+                       VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, ECPRI);
+
+                       if (ecpri_spec && ecpri_mask) {
+                               if (ecpri_common.type == RTE_ECPRI_MSG_TYPE_IQ_DATA &&
+                                               ecpri_mask->hdr.type0.pc_id == UINT16_MAX) {
+                                       input_set |= IAVF_ECPRI_PC_RTC_ID;
+                                       VIRTCHNL_ADD_PROTO_HDR_FIELD_BIT(hdr, ECPRI,
+                                                                        PC_RTC_ID);
+                               }
+
+                               rte_memcpy(hdr->buffer, ecpri_spec,
+                                       sizeof(*ecpri_spec));
+                       }
+
+                       filter->add_fltr.rule_cfg.proto_hdrs.count = ++layer;
+                       break;
+
                case RTE_FLOW_ITEM_TYPE_VOID:
                        break;
 
index 9e518bd..0ccf590 100644 (file)
@@ -34,6 +34,7 @@
 #define IAVF_PROT_AH               (1ULL << 23)
 #define IAVF_PROT_L2TPV3OIP        (1ULL << 24)
 #define IAVF_PROT_PFCP             (1ULL << 25)
+#define IAVF_PROT_ECPRI                    (1ULL << 26)
 
 
 /* field */
@@ -59,6 +60,7 @@
 #define IAVF_L2TPV3OIP_SESSION_ID   (1ULL << 45)
 #define IAVF_PFCP_S_FIELD          (1ULL << 44)
 #define IAVF_PFCP_SEID             (1ULL << 43)
+#define IAVF_ECPRI_PC_RTC_ID       (1ULL << 42)
 
 /* input set */
 
        (IAVF_PROT_PFCP | IAVF_PFCP_S_FIELD)
 #define IAVF_INSET_PFCP_SEID \
        (IAVF_PROT_PFCP | IAVF_PFCP_S_FIELD | IAVF_PFCP_SEID)
-
+#define IAVF_INSET_ECPRI \
+       (IAVF_PROT_ECPRI | IAVF_ECPRI_PC_RTC_ID)
 
 /* empty pattern */
 extern enum rte_flow_item_type iavf_pattern_empty[];