diff options
author | Xinyao Cai <xinyao.cai@intel.com> | 2023-02-17 16:17:13 +0800 |
---|---|---|
committer | Damjan Marion <dmarion@0xa5.net> | 2023-03-07 11:38:32 +0000 |
commit | 21121f60d2ffd66d5c28d989572fdb68653bc94c (patch) | |
tree | 326fca8ac92e663cd11ca89bd840c433189b6e19 | |
parent | d1dc1060df18fe6d00367368b150b2b90e76fd14 (diff) |
avf: enable rss action of flow
This patch enables RSS action of avf flow.
Type: feature
Signed-off-by: Xinyao Cai <xinyao.cai@intel.com>
Change-Id: I65de18d0c2eaa415893959563ea917a6b1956550
-rw-r--r-- | src/plugins/avf/avf_advanced_flow.h | 314 | ||||
-rw-r--r-- | src/plugins/avf/avf_fdir_lib.c | 40 | ||||
-rw-r--r-- | src/plugins/avf/avf_rss_lib.c | 2597 | ||||
-rw-r--r-- | src/plugins/avf/flow.c | 126 |
4 files changed, 2925 insertions, 152 deletions
diff --git a/src/plugins/avf/avf_advanced_flow.h b/src/plugins/avf/avf_advanced_flow.h index f2a60322b93..4e3ca21b97f 100644 --- a/src/plugins/avf/avf_advanced_flow.h +++ b/src/plugins/avf/avf_advanced_flow.h @@ -178,6 +178,81 @@ #define AVF_INSET_PFCP_S_FIELD (AVF_PROT_PFCP | AVF_PFCP_S_FIELD) #define AVF_INSET_PFCP_SEID (AVF_PROT_PFCP | AVF_PFCP_S_FIELD | AVF_PFCP_SEID) +#define AVF_ETH_RSS_IPV4 BIT_ULL (2) +#define AVF_ETH_RSS_FRAG_IPV4 BIT_ULL (3) +#define AVF_ETH_RSS_NONFRAG_IPV4_TCP BIT_ULL (4) +#define AVF_ETH_RSS_NONFRAG_IPV4_UDP BIT_ULL (5) +#define AVF_ETH_RSS_NONFRAG_IPV4_SCTP BIT_ULL (6) +#define AVF_ETH_RSS_NONFRAG_IPV4_OTHER BIT_ULL (7) +#define AVF_ETH_RSS_IPV6 BIT_ULL (8) +#define AVF_ETH_RSS_FRAG_IPV6 BIT_ULL (9) +#define AVF_ETH_RSS_NONFRAG_IPV6_TCP BIT_ULL (10) +#define AVF_ETH_RSS_NONFRAG_IPV6_UDP BIT_ULL (11) +#define AVF_ETH_RSS_NONFRAG_IPV6_SCTP BIT_ULL (12) +#define AVF_ETH_RSS_NONFRAG_IPV6_OTHER BIT_ULL (13) +#define AVF_ETH_RSS_L2_PAYLOAD BIT_ULL (14) +#define AVF_ETH_RSS_IPV6_EX BIT_ULL (15) +#define AVF_ETH_RSS_IPV6_TCP_EX BIT_ULL (16) +#define AVF_ETH_RSS_IPV6_UDP_EX BIT_ULL (17) +#define AVF_ETH_RSS_PORT BIT_ULL (18) +#define AVF_ETH_RSS_VXLAN BIT_ULL (19) +#define AVF_ETH_RSS_GENEVE BIT_ULL (20) +#define AVF_ETH_RSS_NVGRE BIT_ULL (21) +#define AVF_ETH_RSS_GTPU BIT_ULL (23) +#define AVF_ETH_RSS_ETH BIT_ULL (24) +#define AVF_ETH_RSS_S_VLAN BIT_ULL (25) +#define AVF_ETH_RSS_C_VLAN BIT_ULL (26) +#define AVF_ETH_RSS_ESP BIT_ULL (27) +#define AVF_ETH_RSS_AH BIT_ULL (28) +#define AVF_ETH_RSS_L2TPV3 BIT_ULL (29) +#define AVF_ETH_RSS_PFCP BIT_ULL (30) +#define AVF_ETH_RSS_PPPOE BIT_ULL (31) +#define AVF_ETH_RSS_ECPRI BIT_ULL (32) +#define AVF_ETH_RSS_MPLS BIT_ULL (33) +#define AVF_ETH_RSS_IPV4_CHKSUM BIT_ULL (34) +#define AVF_ETH_RSS_L4_CHKSUM BIT_ULL (35) +#define AVF_ETH_RSS_L2TPV2 BIT_ULL (36) +#define AVF_ETH_RSS_L3_SRC_ONLY BIT_ULL (63) +#define AVF_ETH_RSS_L3_DST_ONLY BIT_ULL (62) +#define AVF_ETH_RSS_L4_SRC_ONLY BIT_ULL (61) +#define AVF_ETH_RSS_L4_DST_ONLY BIT_ULL (60) +#define AVF_ETH_RSS_L2_SRC_ONLY BIT_ULL (59) +#define AVF_ETH_RSS_L2_DST_ONLY BIT_ULL (58) +#define AVF_ETH_RSS_L3_PRE32 BIT_ULL (57) +#define AVF_ETH_RSS_L3_PRE40 BIT_ULL (56) +#define AVF_ETH_RSS_L3_PRE48 BIT_ULL (55) +#define AVF_ETH_RSS_L3_PRE56 BIT_ULL (54) +#define AVF_ETH_RSS_L3_PRE64 BIT_ULL (53) +#define AVF_ETH_RSS_L3_PRE96 BIT_ULL (52) + +#define foreach_avf_rss_hf \ + _ (0, AVF_ETH_RSS_FRAG_IPV4, "ipv4-frag") \ + _ (1, AVF_ETH_RSS_NONFRAG_IPV4_TCP, "ipv4-tcp") \ + _ (2, AVF_ETH_RSS_NONFRAG_IPV4_UDP, "ipv4-udp") \ + _ (3, AVF_ETH_RSS_NONFRAG_IPV4_SCTP, "ipv4-sctp") \ + _ (4, AVF_ETH_RSS_NONFRAG_IPV4_OTHER, "ipv4-other") \ + _ (5, AVF_ETH_RSS_IPV4, "ipv4") \ + _ (6, AVF_ETH_RSS_IPV6_TCP_EX, "ipv6-tcp-ex") \ + _ (7, AVF_ETH_RSS_IPV6_UDP_EX, "ipv6-udp-ex") \ + _ (8, AVF_ETH_RSS_FRAG_IPV6, "ipv6-frag") \ + _ (9, AVF_ETH_RSS_NONFRAG_IPV6_TCP, "ipv6-tcp") \ + _ (10, AVF_ETH_RSS_NONFRAG_IPV6_UDP, "ipv6-udp") \ + _ (11, AVF_ETH_RSS_NONFRAG_IPV6_SCTP, "ipv6-sctp") \ + _ (12, AVF_ETH_RSS_NONFRAG_IPV6_OTHER, "ipv6-other") \ + _ (13, AVF_ETH_RSS_IPV6_EX, "ipv6-ex") \ + _ (14, AVF_ETH_RSS_IPV6, "ipv6") \ + _ (15, AVF_ETH_RSS_L2_PAYLOAD, "l2-payload") \ + _ (16, AVF_ETH_RSS_PORT, "port") \ + _ (17, AVF_ETH_RSS_VXLAN, "vxlan") \ + _ (18, AVF_ETH_RSS_GENEVE, "geneve") \ + _ (19, AVF_ETH_RSS_NVGRE, "nvgre") \ + _ (20, AVF_ETH_RSS_GTPU, "gtpu") \ + _ (21, AVF_ETH_RSS_ESP, "esp") \ + _ (60, AVF_ETH_RSS_L4_DST_ONLY, "l4-dst-only") \ + _ (61, AVF_ETH_RSS_L4_SRC_ONLY, "l4-src-only") \ + _ (62, AVF_ETH_RSS_L3_DST_ONLY, "l3-dst-only") \ + _ (63, AVF_ETH_RSS_L3_SRC_ONLY, "l3-src-only") + /* Protocol header type within a packet segment. A segment consists of one or * more protocol headers that make up a logical group of protocol headers. Each * logical group of protocol headers encapsulates or is encapsulated using/by @@ -203,6 +278,17 @@ enum virtchnl_proto_hdr_type VIRTCHNL_PROTO_HDR_ESP, VIRTCHNL_PROTO_HDR_AH, VIRTCHNL_PROTO_HDR_PFCP, + VIRTCHNL_PROTO_HDR_GTPC, + VIRTCHNL_PROTO_HDR_ECPRI, + VIRTCHNL_PROTO_HDR_L2TPV2, + VIRTCHNL_PROTO_HDR_PPP, + /* IPv4 and IPv6 Fragment header types are only associated to + * VIRTCHNL_PROTO_HDR_IPV4 and VIRTCHNL_PROTO_HDR_IPV6 respectively, + * cannot be used independently. + */ + VIRTCHNL_PROTO_HDR_IPV4_FRAG, + VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG, + VIRTCHNL_PROTO_HDR_GRE, }; /* Protocol header field within a protocol header. */ @@ -225,6 +311,7 @@ enum virtchnl_proto_hdr_field VIRTCHNL_PROTO_HDR_IPV4_DSCP, VIRTCHNL_PROTO_HDR_IPV4_TTL, VIRTCHNL_PROTO_HDR_IPV4_PROT, + VIRTCHNL_PROTO_HDR_IPV4_CHKSUM, /* IPV6 */ VIRTCHNL_PROTO_HDR_IPV6_SRC = PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_IPV6), @@ -232,18 +319,34 @@ enum virtchnl_proto_hdr_field VIRTCHNL_PROTO_HDR_IPV6_TC, VIRTCHNL_PROTO_HDR_IPV6_HOP_LIMIT, VIRTCHNL_PROTO_HDR_IPV6_PROT, + /* IPV6 Prefix */ + VIRTCHNL_PROTO_HDR_IPV6_PREFIX32_SRC, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX32_DST, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX40_SRC, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX40_DST, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX48_SRC, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX48_DST, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX56_SRC, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX56_DST, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX64_SRC, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX64_DST, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX96_SRC, + VIRTCHNL_PROTO_HDR_IPV6_PREFIX96_DST, /* TCP */ VIRTCHNL_PROTO_HDR_TCP_SRC_PORT = PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_TCP), VIRTCHNL_PROTO_HDR_TCP_DST_PORT, + VIRTCHNL_PROTO_HDR_TCP_CHKSUM, /* UDP */ VIRTCHNL_PROTO_HDR_UDP_SRC_PORT = PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_UDP), VIRTCHNL_PROTO_HDR_UDP_DST_PORT, + VIRTCHNL_PROTO_HDR_UDP_CHKSUM, /* SCTP */ VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT = PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_SCTP), VIRTCHNL_PROTO_HDR_SCTP_DST_PORT, + VIRTCHNL_PROTO_HDR_SCTP_CHKSUM, /* GTPU_IP */ VIRTCHNL_PROTO_HDR_GTPU_IP_TEID = PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_GTPU_IP), @@ -265,6 +368,28 @@ enum virtchnl_proto_hdr_field VIRTCHNL_PROTO_HDR_PFCP_S_FIELD = PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_PFCP), VIRTCHNL_PROTO_HDR_PFCP_SEID, + /* GTPC */ + VIRTCHNL_PROTO_HDR_GTPC_TEID = + PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_GTPC), + /* ECPRI */ + VIRTCHNL_PROTO_HDR_ECPRI_MSG_TYPE = + PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_ECPRI), + VIRTCHNL_PROTO_HDR_ECPRI_PC_RTC_ID, + /* IPv4 Dummy Fragment */ + VIRTCHNL_PROTO_HDR_IPV4_FRAG_PKID = + PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_IPV4_FRAG), + /* IPv6 Extension Fragment */ + VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG_PKID = + PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG), + /* GTPU_DWN/UP */ + VIRTCHNL_PROTO_HDR_GTPU_DWN_QFI = + PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN), + VIRTCHNL_PROTO_HDR_GTPU_UP_QFI = + PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP), + /* L2TPv2 */ + VIRTCHNL_PROTO_HDR_L2TPV2_SESS_ID = + PROTO_HDR_FIELD_START (VIRTCHNL_PROTO_HDR_L2TPV2), + VIRTCHNL_PROTO_HDR_L2TPV2_LEN_SESS_ID, }; struct virtchnl_proto_hdr @@ -368,6 +493,140 @@ struct virtchnl_rss_cfg VIRTCHNL_CHECK_STRUCT_LEN (2444, virtchnl_rss_cfg); +struct avf_pattern_match_item +{ + enum avf_flow_item_type *pattern_list; + u64 input_set_mask; + void *meta; +}; + +enum avf_flow_item_type +{ + AVF_FLOW_ITEM_TYPE_END, + AVF_FLOW_ITEM_TYPE_VOID, + AVF_FLOW_ITEM_TYPE_INVERT, + AVF_FLOW_ITEM_TYPE_ANY, + AVF_FLOW_ITEM_TYPE_PORT_ID, + AVF_FLOW_ITEM_TYPE_RAW, + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_ICMP, + AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_SCTP, + AVF_FLOW_ITEM_TYPE_VXLAN, + AVF_FLOW_ITEM_TYPE_E_TAG, + AVF_FLOW_ITEM_TYPE_NVGRE, + AVF_FLOW_ITEM_TYPE_MPLS, + AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_FUZZY, + AVF_FLOW_ITEM_TYPE_GTP, + AVF_FLOW_ITEM_TYPE_GTPC, + AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_ESP, + AVF_FLOW_ITEM_TYPE_GENEVE, + AVF_FLOW_ITEM_TYPE_VXLAN_GPE, + AVF_FLOW_ITEM_TYPE_ARP_ETH_IPV4, + AVF_FLOW_ITEM_TYPE_IPV6_EXT, + AVF_FLOW_ITEM_TYPE_ICMP6, + AVF_FLOW_ITEM_TYPE_ICMP6_ND_NS, + AVF_FLOW_ITEM_TYPE_ICMP6_ND_NA, + AVF_FLOW_ITEM_TYPE_ICMP6_ND_OPT, + AVF_FLOW_ITEM_TYPE_ICMP6_ND_OPT_SLA_ETH, + AVF_FLOW_ITEM_TYPE_ICMP6_ND_OPT_TLA_ETH, + AVF_FLOW_ITEM_TYPE_MARK, + AVF_FLOW_ITEM_TYPE_META, + AVF_FLOW_ITEM_TYPE_GRE_KEY, + AVF_FLOW_ITEM_TYPE_GTP_PSC, + AVF_FLOW_ITEM_TYPE_PPPOES, + AVF_FLOW_ITEM_TYPE_PPPOED, + AVF_FLOW_ITEM_TYPE_PPPOE_PROTO_ID, + AVF_FLOW_ITEM_TYPE_NSH, + AVF_FLOW_ITEM_TYPE_IGMP, + AVF_FLOW_ITEM_TYPE_AH, + AVF_FLOW_ITEM_TYPE_HIGIG2, + AVF_FLOW_ITEM_TYPE_TAG, + AVF_FLOW_ITEM_TYPE_L2TPV3OIP, + AVF_FLOW_ITEM_TYPE_PFCP, + AVF_FLOW_ITEM_TYPE_ECPRI, + AVF_FLOW_ITEM_TYPE_IPV6_FRAG_EXT, + AVF_FLOW_ITEM_TYPE_GENEVE_OPT, + AVF_FLOW_ITEM_TYPE_INTEGRITY, + AVF_FLOW_ITEM_TYPE_CONNTRACK, + AVF_FLOW_ITEM_TYPE_PORT_REPRESENTOR, + AVF_FLOW_ITEM_TYPE_REPRESENTED_PORT, + AVF_FLOW_ITEM_TYPE_FLEX, + AVF_FLOW_ITEM_TYPE_L2TPV2, + AVF_FLOW_ITEM_TYPE_PPP, + AVF_FLOW_ITEM_TYPE_GRE_OPTION, + AVF_FLOW_ITEM_TYPE_MACSEC, + AVF_FLOW_ITEM_TYPE_METER_COLOR, +}; + +enum avf_flow_action_type +{ + AVF_FLOW_ACTION_TYPE_END, + AVF_FLOW_ACTION_TYPE_VOID, + AVF_FLOW_ACTION_TYPE_PASSTHRU, + AVF_FLOW_ACTION_TYPE_JUMP, + AVF_FLOW_ACTION_TYPE_MARK, + AVF_FLOW_ACTION_TYPE_FLAG, + AVF_FLOW_ACTION_TYPE_QUEUE, + AVF_FLOW_ACTION_TYPE_DROP, + AVF_FLOW_ACTION_TYPE_COUNT, + AVF_FLOW_ACTION_TYPE_RSS, + AVF_FLOW_ACTION_TYPE_PF, + AVF_FLOW_ACTION_TYPE_VF, + AVF_FLOW_ACTION_TYPE_PORT_ID, + AVF_FLOW_ACTION_TYPE_METER, + AVF_FLOW_ACTION_TYPE_SECURITY, + AVF_FLOW_ACTION_TYPE_OF_DEC_NW_TTL, + AVF_FLOW_ACTION_TYPE_OF_POP_VLAN, + AVF_FLOW_ACTION_TYPE_OF_PUSH_VLAN, + AVF_FLOW_ACTION_TYPE_OF_SET_VLAN_VID, + AVF_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP, + AVF_FLOW_ACTION_TYPE_OF_POP_MPLS, + AVF_FLOW_ACTION_TYPE_OF_PUSH_MPLS, + AVF_FLOW_ACTION_TYPE_VXLAN_ENCAP, + AVF_FLOW_ACTION_TYPE_VXLAN_DECAP, + AVF_FLOW_ACTION_TYPE_NVGRE_ENCAP, + AVF_FLOW_ACTION_TYPE_NVGRE_DECAP, + AVF_FLOW_ACTION_TYPE_RAW_ENCAP, + AVF_FLOW_ACTION_TYPE_RAW_DECAP, + AVF_FLOW_ACTION_TYPE_SET_IPV4_SRC, + AVF_FLOW_ACTION_TYPE_SET_IPV4_DST, + AVF_FLOW_ACTION_TYPE_SET_IPV6_SRC, + AVF_FLOW_ACTION_TYPE_SET_IPV6_DST, + AVF_FLOW_ACTION_TYPE_SET_TP_SRC, + AVF_FLOW_ACTION_TYPE_SET_TP_DST, + AVF_FLOW_ACTION_TYPE_MAC_SWAP, + AVF_FLOW_ACTION_TYPE_DEC_TTL, + AVF_FLOW_ACTION_TYPE_SET_TTL, + AVF_FLOW_ACTION_TYPE_SET_MAC_SRC, + AVF_FLOW_ACTION_TYPE_SET_MAC_DST, + AVF_FLOW_ACTION_TYPE_INC_TCP_SEQ, + AVF_FLOW_ACTION_TYPE_DEC_TCP_SEQ, + AVF_FLOW_ACTION_TYPE_INC_TCP_ACK, + AVF_FLOW_ACTION_TYPE_DEC_TCP_ACK, + AVF_FLOW_ACTION_TYPE_SET_TAG, + AVF_FLOW_ACTION_TYPE_SET_META, + AVF_FLOW_ACTION_TYPE_SET_IPV4_DSCP, + AVF_FLOW_ACTION_TYPE_SET_IPV6_DSCP, + AVF_FLOW_ACTION_TYPE_AGE, + AVF_FLOW_ACTION_TYPE_SAMPLE, + AVF_FLOW_ACTION_TYPE_SHARED, + AVF_FLOW_ACTION_TYPE_MODIFY_FIELD, + AVF_FLOW_ACTION_TYPE_INDIRECT, + AVF_FLOW_ACTION_TYPE_CONNTRACK, + AVF_FLOW_ACTION_TYPE_METER_COLOR, + AVF_FLOW_ACTION_TYPE_PORT_REPRESENTOR, + AVF_FLOW_ACTION_TYPE_REPRESENTED_PORT, + AVF_FLOW_ACTION_TYPE_METER_MARK, + AVF_FLOW_ACTION_TYPE_SEND_TO_KERNEL, +}; + enum virtchnl_action { /* action types */ @@ -769,13 +1028,13 @@ struct avf_flow_action_mark struct avf_flow_action { - enum virtchnl_action type; /**< Action type. */ + enum avf_flow_action_type type; /**< Action type. */ const void *conf; /**< Pointer to action configuration object. */ }; struct avf_flow_item { - enum virtchnl_proto_hdr_type type; /**< Item type. */ + enum avf_flow_item_type type; /**< Item type. */ const void *spec; /**< Pointer to item specification structure. */ const void *mask; /**< Bit-mask applied to spec and last. */ int is_generic; /* indicate if this item is for a generic flow pattern. */ @@ -1060,48 +1319,14 @@ int avf_fdir_parse_action (const struct avf_flow_action actions[], struct avf_flow_error *error); /* - * Parse avf patterns and set pattern fields for RSS. - * - * @param rss_cfg - * flow config - * @param avf_items - * pattern items - * @param error - * save error cause - * - * @return - * 0 = successful. - * < 0 = failure - */ -int avf_rss_parse_pattern (struct virtchnl_rss_cfg *rss_cfg, - struct avf_flow_item avf_items[], - struct avf_flow_error *error); - -/* - * Parse avf patterns and set pattern fields for RSS generic flow. + * Parse flow patterns and rss actions, set rss config. * - * @param rss_cfg - * flow config * @param avf_items - * pattern items - * @param error - * save error cause - * - * @return - * 0 = successful. - * < 0 = failure - */ -int avf_rss_parse_generic_pattern (struct virtchnl_rss_cfg *rss_cfg, - struct avf_flow_item avf_items[], - struct avf_flow_error *error); - -/* - * Parse RSS flow actions, set actions. - * - * @param actions - * flow actions + * flow pattern + * @param avf_actions + * flow actions * @param rss_cfg - * flow config + * rss config * @param error * save error cause * @@ -1109,9 +1334,10 @@ int avf_rss_parse_generic_pattern (struct virtchnl_rss_cfg *rss_cfg, * 0 = successful. * < 0 = failure */ -int avf_rss_parse_action (const struct avf_flow_action actions[], - struct virtchnl_rss_cfg *rss_cfg, - struct avf_flow_error *error); +int avf_rss_parse_pattern_action (struct avf_flow_item avf_items[], + struct avf_flow_action avf_actions[], + struct virtchnl_rss_cfg *rss_cfg, + struct avf_flow_error *error); /** * Create a RSS rule cfg object. diff --git a/src/plugins/avf/avf_fdir_lib.c b/src/plugins/avf/avf_fdir_lib.c index 52937874186..24b796dc91d 100644 --- a/src/plugins/avf/avf_fdir_lib.c +++ b/src/plugins/avf/avf_fdir_lib.c @@ -100,7 +100,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, const struct avf_flow_eth_hdr *eth_spec, *eth_mask; struct virtchnl_proto_hdr *hdr; - enum virtchnl_proto_hdr_type type; + enum avf_flow_item_type type; u16 ether_type; int ret = 0; @@ -112,7 +112,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, switch (type) { - case VIRTCHNL_PROTO_HDR_ETH: + case AVF_FLOW_ITEM_TYPE_ETH: eth_spec = item->spec; eth_mask = item->mask; @@ -160,7 +160,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, } break; - case VIRTCHNL_PROTO_HDR_IPV4: + case AVF_FLOW_ITEM_TYPE_IPV4: ipv4_spec = item->spec; ipv4_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_IPV4; @@ -211,7 +211,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, } break; - case VIRTCHNL_PROTO_HDR_IPV6: + case AVF_FLOW_ITEM_TYPE_IPV6: ipv6_spec = item->spec; ipv6_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_IPV6; @@ -264,7 +264,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, break; - case VIRTCHNL_PROTO_HDR_UDP: + case AVF_FLOW_ITEM_TYPE_UDP: udp_spec = item->spec; udp_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_UDP; @@ -295,7 +295,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, } break; - case VIRTCHNL_PROTO_HDR_TCP: + case AVF_FLOW_ITEM_TYPE_TCP: tcp_spec = item->spec; tcp_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_TCP; @@ -329,7 +329,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, break; - case VIRTCHNL_PROTO_HDR_SCTP: + case AVF_FLOW_ITEM_TYPE_SCTP: sctp_spec = item->spec; sctp_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_SCTP; @@ -360,7 +360,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, } break; - case VIRTCHNL_PROTO_HDR_GTPU_IP: + case AVF_FLOW_ITEM_TYPE_GTPU: gtp_spec = item->spec; gtp_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_GTPU_IP; @@ -387,7 +387,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, break; - case VIRTCHNL_PROTO_HDR_GTPU_EH: + case AVF_FLOW_ITEM_TYPE_GTP_PSC: gtp_psc_spec = item->spec; gtp_psc_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_GTPU_EH; @@ -405,7 +405,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, break; - case VIRTCHNL_PROTO_HDR_L2TPV3: + case AVF_FLOW_ITEM_TYPE_L2TPV3OIP: l2tpv3oip_spec = item->spec; l2tpv3oip_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_L2TPV3; @@ -422,7 +422,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, } break; - case VIRTCHNL_PROTO_HDR_ESP: + case AVF_FLOW_ITEM_TYPE_ESP: esp_spec = item->spec; esp_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_ESP; @@ -439,7 +439,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, } break; - case VIRTCHNL_PROTO_HDR_AH: + case AVF_FLOW_ITEM_TYPE_AH: ah_spec = item->spec; ah_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_AH; @@ -456,7 +456,7 @@ avf_fdir_rcfg_set_field (struct avf_fdir_conf *rcfg, int layer, } break; - case VIRTCHNL_PROTO_HDR_PFCP: + case AVF_FLOW_ITEM_TYPE_PFCP: pfcp_spec = item->spec; pfcp_mask = item->mask; hdr->type = VIRTCHNL_PROTO_HDR_PFCP; @@ -683,18 +683,18 @@ avf_fdir_parse_action (const struct avf_flow_action actions[], struct virtchnl_fdir_rule *rule_cfg = &rcfg->add_fltr.rule_cfg; - for (; actions->type != VIRTCHNL_ACTION_NONE; actions++, act_idx++) + for (; actions->type != AVF_FLOW_ACTION_TYPE_END; actions++, act_idx++) { switch (actions->type) { - case VIRTCHNL_ACTION_PASSTHRU: + case AVF_FLOW_ACTION_TYPE_PASSTHRU: dest_num++; filter_action = &rule_cfg->action_set.actions[act_idx]; filter_action->type = VIRTCHNL_ACTION_PASSTHRU; rule_cfg->action_set.count++; break; - case VIRTCHNL_ACTION_DROP: + case AVF_FLOW_ACTION_TYPE_DROP: dest_num++; ret = avf_fdir_rcfg_act_drop (rcfg, act_idx); if (ret) @@ -703,7 +703,7 @@ avf_fdir_parse_action (const struct avf_flow_action actions[], rule_cfg->action_set.count++; break; - case VIRTCHNL_ACTION_QUEUE: + case AVF_FLOW_ACTION_TYPE_QUEUE: dest_num++; act_q = actions->conf; @@ -722,7 +722,7 @@ avf_fdir_parse_action (const struct avf_flow_action actions[], rule_cfg->action_set.count++; break; - case VIRTCHNL_ACTION_Q_REGION: + case AVF_FLOW_ACTION_TYPE_RSS: dest_num++; filter_action = &rule_cfg->action_set.actions[act_idx]; ret = avf_fdir_parse_action_qregion (rcfg, actions, act_idx, error); @@ -732,7 +732,7 @@ avf_fdir_parse_action (const struct avf_flow_action actions[], rule_cfg->action_set.count++; break; - case VIRTCHNL_ACTION_MARK: + case AVF_FLOW_ACTION_TYPE_MARK: mark_num++; act_msk = actions->conf; rcfg->mark_flag = 1; @@ -824,7 +824,7 @@ avf_fdir_parse_pattern (struct avf_fdir_conf *rcfg, int ret = 0; struct avf_flow_item *item; - for (item = avf_items; item->type != VIRTCHNL_PROTO_HDR_NONE; item++) + for (item = avf_items; item->type != AVF_FLOW_ITEM_TYPE_END; item++) { ret = avf_fdir_rcfg_set_field (rcfg, layer, item, error); if (ret) diff --git a/src/plugins/avf/avf_rss_lib.c b/src/plugins/avf/avf_rss_lib.c index 45843bdb00d..23b0b59b7cc 100644 --- a/src/plugins/avf/avf_rss_lib.c +++ b/src/plugins/avf/avf_rss_lib.c @@ -18,12 +18,1978 @@ #include <vppinfra/mem.h> #include "avf_advanced_flow.h" +#define AVF_PHINT_NONE 0 +#define AVF_PHINT_GTPU BIT_ULL (0) +#define AVF_PHINT_GTPU_EH BIT_ULL (1) +#define AVF_PHINT_GTPU_EH_DWN BIT_ULL (2) +#define AVF_PHINT_GTPU_EH_UP BIT_ULL (3) +#define AVF_PHINT_OUTER_IPV4 BIT_ULL (4) +#define AVF_PHINT_OUTER_IPV6 BIT_ULL (5) +#define AVF_PHINT_GRE BIT_ULL (6) +/* the second IP header of GTPoGRE */ +#define AVF_PHINT_MID_IPV4 BIT_ULL (7) +#define AVF_PHINT_MID_IPV6 BIT_ULL (8) +/* L2TPv2 */ +#define AVF_PHINT_L2TPV2 BIT_ULL (9) +#define AVF_PHINT_L2TPV2_LEN BIT_ULL (10) +/* Raw */ +#define AVF_PHINT_RAW BIT_ULL (11) + +#define AVF_PHINT_GTPU_MSK \ + (AVF_PHINT_GTPU | AVF_PHINT_GTPU_EH | AVF_PHINT_GTPU_EH_DWN | \ + AVF_PHINT_GTPU_EH_UP) + +#define AVF_PHINT_LAYERS_MSK (AVF_PHINT_OUTER_IPV4 | AVF_PHINT_OUTER_IPV6) + +#define AVF_GTPU_EH_DWNLINK 0 +#define AVF_GTPU_EH_UPLINK 1 + +#define FIELD_SELECTOR(proto_hdr_field) \ + (1UL << ((proto_hdr_field) &PROTO_HDR_FIELD_MASK)) +#define BUFF_NOUSED 0 + +#define REFINE_PROTO_FLD(op, fld) \ + VIRTCHNL_##op##_PROTO_HDR_FIELD (hdr, VIRTCHNL_PROTO_HDR_##fld) +#define REPALCE_PROTO_FLD(fld_1, fld_2) \ + do \ + { \ + REFINE_PROTO_FLD (DEL, fld_1); \ + REFINE_PROTO_FLD (ADD, fld_2); \ + } \ + while (0) + +#define proto_hdr_eth \ + { \ + VIRTCHNL_PROTO_HDR_ETH, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_ETH_SRC) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_ETH_DST), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_svlan \ + { \ + VIRTCHNL_PROTO_HDR_S_VLAN, FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_S_VLAN_ID), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_cvlan \ + { \ + VIRTCHNL_PROTO_HDR_C_VLAN, FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_C_VLAN_ID), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_ipv4 \ + { \ + VIRTCHNL_PROTO_HDR_IPV4, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV4_SRC) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV4_DST), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_ipv4_with_prot \ + { \ + VIRTCHNL_PROTO_HDR_IPV4, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV4_SRC) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV4_DST) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV4_PROT), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_ipv6 \ + { \ + VIRTCHNL_PROTO_HDR_IPV6, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV6_SRC) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV6_DST), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_ipv6_frag \ + { \ + VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG_PKID), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_ipv6_with_prot \ + { \ + VIRTCHNL_PROTO_HDR_IPV6, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV6_SRC) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV6_DST) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_IPV6_PROT), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_udp \ + { \ + VIRTCHNL_PROTO_HDR_UDP, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_UDP_SRC_PORT) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_UDP_DST_PORT), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_tcp \ + { \ + VIRTCHNL_PROTO_HDR_TCP, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_TCP_SRC_PORT) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_TCP_DST_PORT), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_sctp \ + { \ + VIRTCHNL_PROTO_HDR_SCTP, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_SCTP_DST_PORT), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_esp \ + { \ + VIRTCHNL_PROTO_HDR_ESP, FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_ESP_SPI), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_ah \ + { \ + VIRTCHNL_PROTO_HDR_AH, FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_AH_SPI), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_l2tpv3 \ + { \ + VIRTCHNL_PROTO_HDR_L2TPV3, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_L2TPV3_SESS_ID), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_pfcp \ + { \ + VIRTCHNL_PROTO_HDR_PFCP, FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_PFCP_SEID), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_gtpc \ + { \ + VIRTCHNL_PROTO_HDR_GTPC, 0, { BUFF_NOUSED } \ + } + +#define proto_hdr_ecpri \ + { \ + VIRTCHNL_PROTO_HDR_ECPRI, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_ECPRI_PC_RTC_ID), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_l2tpv2 \ + { \ + VIRTCHNL_PROTO_HDR_L2TPV2, \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_L2TPV2_SESS_ID) | \ + FIELD_SELECTOR (VIRTCHNL_PROTO_HDR_L2TPV2_LEN_SESS_ID), \ + { \ + BUFF_NOUSED \ + } \ + } + +#define proto_hdr_ppp \ + { \ + VIRTCHNL_PROTO_HDR_PPP, 0, { BUFF_NOUSED } \ + } + +#define TUNNEL_LEVEL_OUTER 0 +#define TUNNEL_LEVEL_INNER 1 + +/* proto_hdrs template */ +struct virtchnl_proto_hdrs outer_ipv4_tmplt = { + TUNNEL_LEVEL_OUTER, + 4, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, proto_hdr_ipv4 } } +}; + +struct virtchnl_proto_hdrs outer_ipv4_udp_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, + proto_hdr_ipv4_with_prot, proto_hdr_udp } } +}; + +struct virtchnl_proto_hdrs outer_ipv4_tcp_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, + proto_hdr_ipv4_with_prot, proto_hdr_tcp } } +}; + +struct virtchnl_proto_hdrs outer_ipv4_sctp_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, proto_hdr_ipv4, + proto_hdr_sctp } } +}; + +struct virtchnl_proto_hdrs outer_ipv6_tmplt = { + TUNNEL_LEVEL_OUTER, + 4, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, proto_hdr_ipv6 } } +}; + +struct virtchnl_proto_hdrs outer_ipv6_frag_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, proto_hdr_ipv6, + proto_hdr_ipv6_frag } } +}; + +struct virtchnl_proto_hdrs outer_ipv6_udp_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, + proto_hdr_ipv6_with_prot, proto_hdr_udp } } +}; + +struct virtchnl_proto_hdrs outer_ipv6_tcp_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, + proto_hdr_ipv6_with_prot, proto_hdr_tcp } } +}; + +struct virtchnl_proto_hdrs outer_ipv6_sctp_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_svlan, proto_hdr_cvlan, proto_hdr_ipv6, + proto_hdr_sctp } } +}; + +struct virtchnl_proto_hdrs inner_ipv4_tmplt = { TUNNEL_LEVEL_INNER, + 1, + { { proto_hdr_ipv4 } } }; + +struct virtchnl_proto_hdrs inner_ipv4_udp_tmplt = { + TUNNEL_LEVEL_INNER, 2, { { proto_hdr_ipv4_with_prot, proto_hdr_udp } } +}; + +struct virtchnl_proto_hdrs inner_ipv4_tcp_tmplt = { + TUNNEL_LEVEL_INNER, 2, { { proto_hdr_ipv4_with_prot, proto_hdr_tcp } } +}; + +struct virtchnl_proto_hdrs second_inner_ipv4_tmplt = { + 2, 1, { { proto_hdr_ipv4 } } +}; + +struct virtchnl_proto_hdrs second_inner_ipv4_udp_tmplt = { + 2, 2, { { proto_hdr_ipv4_with_prot, proto_hdr_udp } } +}; + +struct virtchnl_proto_hdrs second_inner_ipv4_tcp_tmplt = { + 2, 2, { { proto_hdr_ipv4_with_prot, proto_hdr_tcp } } +}; + +struct virtchnl_proto_hdrs second_inner_ipv6_tmplt = { + 2, 1, { { proto_hdr_ipv6 } } +}; + +struct virtchnl_proto_hdrs second_inner_ipv6_udp_tmplt = { + 2, 2, { { proto_hdr_ipv6_with_prot, proto_hdr_udp } } +}; + +struct virtchnl_proto_hdrs second_inner_ipv6_tcp_tmplt = { + 2, 2, { { proto_hdr_ipv6_with_prot, proto_hdr_tcp } } +}; + +struct virtchnl_proto_hdrs inner_ipv4_sctp_tmplt = { + TUNNEL_LEVEL_INNER, 2, { { proto_hdr_ipv4, proto_hdr_sctp } } +}; + +struct virtchnl_proto_hdrs inner_ipv6_tmplt = { TUNNEL_LEVEL_INNER, + 1, + { { proto_hdr_ipv6 } } }; + +struct virtchnl_proto_hdrs inner_ipv6_udp_tmplt = { + TUNNEL_LEVEL_INNER, 2, { { proto_hdr_ipv6_with_prot, proto_hdr_udp } } +}; + +struct virtchnl_proto_hdrs inner_ipv6_tcp_tmplt = { + TUNNEL_LEVEL_INNER, 2, { { proto_hdr_ipv6_with_prot, proto_hdr_tcp } } +}; + +struct virtchnl_proto_hdrs inner_ipv6_sctp_tmplt = { + TUNNEL_LEVEL_INNER, 2, { { proto_hdr_ipv6, proto_hdr_sctp } } +}; + +struct virtchnl_proto_hdrs ipv4_esp_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_ipv4, proto_hdr_esp } } +}; + +struct virtchnl_proto_hdrs ipv4_udp_esp_tmplt = { + TUNNEL_LEVEL_OUTER, 3, { { proto_hdr_ipv4, proto_hdr_udp, proto_hdr_esp } } +}; + +struct virtchnl_proto_hdrs ipv4_ah_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_ipv4, proto_hdr_ah } } +}; + +struct virtchnl_proto_hdrs ipv6_esp_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_ipv6, proto_hdr_esp } } +}; + +struct virtchnl_proto_hdrs ipv6_udp_esp_tmplt = { + TUNNEL_LEVEL_OUTER, 3, { { proto_hdr_ipv6, proto_hdr_udp, proto_hdr_esp } } +}; + +struct virtchnl_proto_hdrs ipv6_ah_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_ipv6, proto_hdr_ah } } +}; + +struct virtchnl_proto_hdrs ipv4_l2tpv3_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_ipv4, proto_hdr_l2tpv3 } } +}; + +struct virtchnl_proto_hdrs ipv6_l2tpv3_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_ipv6, proto_hdr_l2tpv3 } } +}; + +struct virtchnl_proto_hdrs ipv4_pfcp_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_ipv4, proto_hdr_pfcp } } +}; + +struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_ipv6, proto_hdr_pfcp } } +}; + +struct virtchnl_proto_hdrs ipv4_udp_gtpc_tmplt = { + TUNNEL_LEVEL_OUTER, 3, { { proto_hdr_ipv4, proto_hdr_udp, proto_hdr_gtpc } } +}; + +struct virtchnl_proto_hdrs ipv6_udp_gtpc_tmplt = { + TUNNEL_LEVEL_OUTER, 3, { { proto_hdr_ipv6, proto_hdr_udp, proto_hdr_gtpc } } +}; + +struct virtchnl_proto_hdrs eth_ecpri_tmplt = { + TUNNEL_LEVEL_OUTER, 2, { { proto_hdr_eth, proto_hdr_ecpri } } +}; + +struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = { + TUNNEL_LEVEL_OUTER, 3, { { proto_hdr_ipv4, proto_hdr_udp, proto_hdr_ecpri } } +}; + +struct virtchnl_proto_hdrs udp_l2tpv2_ppp_ipv4_tmplt = { + TUNNEL_LEVEL_INNER, + 3, + { { proto_hdr_l2tpv2, proto_hdr_ppp, proto_hdr_ipv4 } } +}; + +struct virtchnl_proto_hdrs udp_l2tpv2_ppp_ipv6_tmplt = { + TUNNEL_LEVEL_INNER, + 3, + { { proto_hdr_l2tpv2, proto_hdr_ppp, proto_hdr_ipv6 } } +}; + +struct virtchnl_proto_hdrs udp_l2tpv2_ppp_ipv4_udp_tmplt = { + TUNNEL_LEVEL_INNER, + 4, + { { proto_hdr_l2tpv2, proto_hdr_ppp, proto_hdr_ipv4_with_prot, + proto_hdr_udp } } +}; + +struct virtchnl_proto_hdrs udp_l2tpv2_ppp_ipv4_tcp_tmplt = { + TUNNEL_LEVEL_INNER, + 4, + { { proto_hdr_l2tpv2, proto_hdr_ppp, proto_hdr_ipv4_with_prot, + proto_hdr_tcp } } +}; + +struct virtchnl_proto_hdrs udp_l2tpv2_ppp_ipv6_udp_tmplt = { + TUNNEL_LEVEL_INNER, + 4, + { { proto_hdr_l2tpv2, proto_hdr_ppp, proto_hdr_ipv6_with_prot, + proto_hdr_udp } } +}; + +struct virtchnl_proto_hdrs udp_l2tpv2_ppp_ipv6_tcp_tmplt = { + TUNNEL_LEVEL_INNER, + 4, + { { proto_hdr_l2tpv2, proto_hdr_ppp, proto_hdr_ipv6_with_prot, + proto_hdr_tcp } } + +}; + +struct virtchnl_proto_hdrs ipv4_l2tpv2_tmplt = { + TUNNEL_LEVEL_OUTER, + 4, + { { proto_hdr_eth, proto_hdr_ipv4, proto_hdr_udp, proto_hdr_l2tpv2 } } +}; + +struct virtchnl_proto_hdrs ipv6_l2tpv2_tmplt = { + TUNNEL_LEVEL_OUTER, + 4, + { { proto_hdr_eth, proto_hdr_ipv6, proto_hdr_udp, proto_hdr_l2tpv2 } } +}; + +struct virtchnl_proto_hdrs ipv4_l2tpv2_ppp_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_ipv4, proto_hdr_udp, proto_hdr_l2tpv2, + proto_hdr_ppp } } +}; + +struct virtchnl_proto_hdrs ipv6_l2tpv2_ppp_tmplt = { + TUNNEL_LEVEL_OUTER, + 5, + { { proto_hdr_eth, proto_hdr_ipv6, proto_hdr_udp, proto_hdr_l2tpv2, + proto_hdr_ppp } } +}; + +/* rss type super set */ + +#define AVF_INSET_NONE 0ULL + +/* IPv4 outer */ +#define AVF_RSS_TYPE_OUTER_IPV4 \ + (AVF_ETH_RSS_ETH | AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_FRAG_IPV4 | \ + AVF_ETH_RSS_IPV4_CHKSUM) +#define AVF_RSS_TYPE_OUTER_IPV4_UDP \ + (AVF_RSS_TYPE_OUTER_IPV4 | AVF_ETH_RSS_NONFRAG_IPV4_UDP | \ + AVF_ETH_RSS_L4_CHKSUM) +#define AVF_RSS_TYPE_OUTER_IPV4_TCP \ + (AVF_RSS_TYPE_OUTER_IPV4 | AVF_ETH_RSS_NONFRAG_IPV4_TCP | \ + AVF_ETH_RSS_L4_CHKSUM) +#define AVF_RSS_TYPE_OUTER_IPV4_SCTP \ + (AVF_RSS_TYPE_OUTER_IPV4 | AVF_ETH_RSS_NONFRAG_IPV4_SCTP | \ + AVF_ETH_RSS_L4_CHKSUM) +/* IPv6 outer */ +#define AVF_RSS_TYPE_OUTER_IPV6 (AVF_ETH_RSS_ETH | AVF_ETH_RSS_IPV6) +#define AVF_RSS_TYPE_OUTER_IPV6_FRAG \ + (AVF_RSS_TYPE_OUTER_IPV6 | AVF_ETH_RSS_FRAG_IPV6) +#define AVF_RSS_TYPE_OUTER_IPV6_UDP \ + (AVF_RSS_TYPE_OUTER_IPV6 | AVF_ETH_RSS_NONFRAG_IPV6_UDP | \ + AVF_ETH_RSS_L4_CHKSUM) +#define AVF_RSS_TYPE_OUTER_IPV6_TCP \ + (AVF_RSS_TYPE_OUTER_IPV6 | AVF_ETH_RSS_NONFRAG_IPV6_TCP | \ + AVF_ETH_RSS_L4_CHKSUM) +#define AVF_RSS_TYPE_OUTER_IPV6_SCTP \ + (AVF_RSS_TYPE_OUTER_IPV6 | AVF_ETH_RSS_NONFRAG_IPV6_SCTP | \ + AVF_ETH_RSS_L4_CHKSUM) +/* VLAN IPV4 */ +#define AVF_RSS_TYPE_VLAN_IPV4 \ + (AVF_RSS_TYPE_OUTER_IPV4 | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +#define AVF_RSS_TYPE_VLAN_IPV4_UDP \ + (AVF_RSS_TYPE_OUTER_IPV4_UDP | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +#define AVF_RSS_TYPE_VLAN_IPV4_TCP \ + (AVF_RSS_TYPE_OUTER_IPV4_TCP | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +#define AVF_RSS_TYPE_VLAN_IPV4_SCTP \ + (AVF_RSS_TYPE_OUTER_IPV4_SCTP | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +/* VLAN IPv6 */ +#define AVF_RSS_TYPE_VLAN_IPV6 \ + (AVF_RSS_TYPE_OUTER_IPV6 | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +#define AVF_RSS_TYPE_VLAN_IPV6_FRAG \ + (AVF_RSS_TYPE_OUTER_IPV6_FRAG | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +#define AVF_RSS_TYPE_VLAN_IPV6_UDP \ + (AVF_RSS_TYPE_OUTER_IPV6_UDP | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +#define AVF_RSS_TYPE_VLAN_IPV6_TCP \ + (AVF_RSS_TYPE_OUTER_IPV6_TCP | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +#define AVF_RSS_TYPE_VLAN_IPV6_SCTP \ + (AVF_RSS_TYPE_OUTER_IPV6_SCTP | AVF_ETH_RSS_S_VLAN | AVF_ETH_RSS_C_VLAN) +/* IPv4 inner */ +#define AVF_RSS_TYPE_INNER_IPV4 AVF_ETH_RSS_IPV4 +#define AVF_RSS_TYPE_INNER_IPV4_UDP \ + (AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_NONFRAG_IPV4_UDP) +#define AVF_RSS_TYPE_INNER_IPV4_TCP \ + (AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_NONFRAG_IPV4_TCP) +#define AVF_RSS_TYPE_INNER_IPV4_SCTP \ + (AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_NONFRAG_IPV4_SCTP) +/* IPv6 inner */ +#define AVF_RSS_TYPE_INNER_IPV6 AVF_ETH_RSS_IPV6 +#define AVF_RSS_TYPE_INNER_IPV6_UDP \ + (AVF_ETH_RSS_IPV6 | AVF_ETH_RSS_NONFRAG_IPV6_UDP) +#define AVF_RSS_TYPE_INNER_IPV6_TCP \ + (AVF_ETH_RSS_IPV6 | AVF_ETH_RSS_NONFRAG_IPV6_TCP) +#define AVF_RSS_TYPE_INNER_IPV6_SCTP \ + (AVF_ETH_RSS_IPV6 | AVF_ETH_RSS_NONFRAG_IPV6_SCTP) +/* GTPU IPv4 */ +#define AVF_RSS_TYPE_GTPU_IPV4 (AVF_RSS_TYPE_INNER_IPV4 | AVF_ETH_RSS_GTPU) +#define AVF_RSS_TYPE_GTPU_IPV4_UDP \ + (AVF_RSS_TYPE_INNER_IPV4_UDP | AVF_ETH_RSS_GTPU) +#define AVF_RSS_TYPE_GTPU_IPV4_TCP \ + (AVF_RSS_TYPE_INNER_IPV4_TCP | AVF_ETH_RSS_GTPU) +/* GTPU IPv6 */ +#define AVF_RSS_TYPE_GTPU_IPV6 (AVF_RSS_TYPE_INNER_IPV6 | AVF_ETH_RSS_GTPU) +#define AVF_RSS_TYPE_GTPU_IPV6_UDP \ + (AVF_RSS_TYPE_INNER_IPV6_UDP | AVF_ETH_RSS_GTPU) +#define AVF_RSS_TYPE_GTPU_IPV6_TCP \ + (AVF_RSS_TYPE_INNER_IPV6_TCP | AVF_ETH_RSS_GTPU) +/* ESP, AH, L2TPV3 and PFCP */ +#define AVF_RSS_TYPE_IPV4_ESP (AVF_ETH_RSS_ESP | AVF_ETH_RSS_IPV4) +#define AVF_RSS_TYPE_IPV4_AH (AVF_ETH_RSS_AH | AVF_ETH_RSS_IPV4) +#define AVF_RSS_TYPE_IPV6_ESP (AVF_ETH_RSS_ESP | AVF_ETH_RSS_IPV6) +#define AVF_RSS_TYPE_IPV6_AH (AVF_ETH_RSS_AH | AVF_ETH_RSS_IPV6) +#define AVF_RSS_TYPE_IPV4_L2TPV3 (AVF_ETH_RSS_L2TPV3 | AVF_ETH_RSS_IPV4) +#define AVF_RSS_TYPE_IPV6_L2TPV3 (AVF_ETH_RSS_L2TPV3 | AVF_ETH_RSS_IPV6) +#define AVF_RSS_TYPE_IPV4_PFCP (AVF_ETH_RSS_PFCP | AVF_ETH_RSS_IPV4) +#define AVF_RSS_TYPE_IPV6_PFCP (AVF_ETH_RSS_PFCP | AVF_ETH_RSS_IPV6) + +/* L2TPv2 */ +#define AVF_RSS_TYPE_ETH_L2TPV2 (AVF_ETH_RSS_ETH | AVF_ETH_RSS_L2TPV2) + +#define VALID_RSS_IPV4_L4 \ + (AVF_ETH_RSS_NONFRAG_IPV4_UDP | AVF_ETH_RSS_NONFRAG_IPV4_TCP | \ + AVF_ETH_RSS_NONFRAG_IPV4_SCTP) + +#define VALID_RSS_IPV6_L4 \ + (AVF_ETH_RSS_NONFRAG_IPV6_UDP | AVF_ETH_RSS_NONFRAG_IPV6_TCP | \ + AVF_ETH_RSS_NONFRAG_IPV6_SCTP) + +#define VALID_RSS_IPV4 \ + (AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_FRAG_IPV4 | VALID_RSS_IPV4_L4) +#define VALID_RSS_IPV6 \ + (AVF_ETH_RSS_IPV6 | AVF_ETH_RSS_FRAG_IPV6 | VALID_RSS_IPV6_L4) +#define VALID_RSS_L3 (VALID_RSS_IPV4 | VALID_RSS_IPV6) +#define VALID_RSS_L4 (VALID_RSS_IPV4_L4 | VALID_RSS_IPV6_L4) + +#define VALID_RSS_ATTR \ + (AVF_ETH_RSS_L3_SRC_ONLY | AVF_ETH_RSS_L3_DST_ONLY | \ + AVF_ETH_RSS_L4_SRC_ONLY | AVF_ETH_RSS_L4_DST_ONLY | \ + AVF_ETH_RSS_L2_SRC_ONLY | AVF_ETH_RSS_L2_DST_ONLY | AVF_ETH_RSS_L3_PRE64) + +#define INVALID_RSS_ATTR \ + (AVF_ETH_RSS_L3_PRE32 | AVF_ETH_RSS_L3_PRE40 | AVF_ETH_RSS_L3_PRE48 | \ + AVF_ETH_RSS_L3_PRE56 | AVF_ETH_RSS_L3_PRE96) + +static u64 invalid_rss_comb[] = { + AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_NONFRAG_IPV4_UDP, + AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_NONFRAG_IPV4_TCP, + AVF_ETH_RSS_IPV6 | AVF_ETH_RSS_NONFRAG_IPV6_UDP, + AVF_ETH_RSS_IPV6 | AVF_ETH_RSS_NONFRAG_IPV6_TCP, + AVF_ETH_RSS_L3_PRE32 | AVF_ETH_RSS_L3_PRE40 | AVF_ETH_RSS_L3_PRE48 | + AVF_ETH_RSS_L3_PRE56 | AVF_ETH_RSS_L3_PRE96 +}; + +struct rss_attr_type +{ + u64 attr; + u64 type; +}; + +static struct rss_attr_type rss_attr_to_valid_type[] = { + { AVF_ETH_RSS_L2_SRC_ONLY | AVF_ETH_RSS_L2_DST_ONLY, AVF_ETH_RSS_ETH }, + { AVF_ETH_RSS_L3_SRC_ONLY | AVF_ETH_RSS_L3_DST_ONLY, VALID_RSS_L3 }, + { AVF_ETH_RSS_L4_SRC_ONLY | AVF_ETH_RSS_L4_DST_ONLY, VALID_RSS_L4 }, + /* current ipv6 prefix only supports prefix 64 bits*/ + { AVF_ETH_RSS_L3_PRE64, VALID_RSS_IPV6 }, + { INVALID_RSS_ATTR, 0 } +}; + +/* raw */ +enum avf_flow_item_type avf_pattern_raw[] = { + AVF_FLOW_ITEM_TYPE_RAW, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* empty */ +enum avf_flow_item_type avf_pattern_empty[] = { + AVF_FLOW_ITEM_TYPE_END, +}; + +/* L2 */ +enum avf_flow_item_type avf_pattern_ethertype[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_ethertype_vlan[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_ethertype_qinq[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* ARP */ +enum avf_flow_item_type avf_pattern_eth_arp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_ARP_ETH_IPV4, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* non-tunnel IPv4 */ +enum avf_flow_item_type avf_pattern_eth_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_sctp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_SCTP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv4_sctp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_SCTP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv4_sctp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_SCTP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_ICMP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv4_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_ICMP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv4_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_ICMP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* non-tunnel IPv6 */ +enum avf_flow_item_type avf_pattern_eth_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_frag_ext[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_IPV6_FRAG_EXT, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv6_frag_ext[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_IPV6_FRAG_EXT, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv6_frag_ext[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_IPV6_FRAG_EXT, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_sctp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_SCTP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv6_sctp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_SCTP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv6_sctp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_SCTP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_icmp6[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_ICMP6, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_vlan_ipv6_icmp6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_ICMP6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_qinq_ipv6_icmp6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_VLAN, AVF_FLOW_ITEM_TYPE_VLAN, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_ICMP6, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPv4 GTPC */ +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpc[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPC, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GTPU (EH) */ +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPv6 GTPC */ +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpc[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPC, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GTPU (EH) */ +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GTPU IPv4 */ +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_ipv4_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_ICMP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv4 UDP GTPU IPv4*/ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv4 UDP GTPU IPv6*/ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv6 UDP GTPU IPv4*/ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv6 UDP GTPU IPv6*/ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GRE IPv4 UDP GTPU IPv4*/ +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv4 UDP GTPU IPv6*/ +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GRE IPv6 UDP GTPU IPv4*/ +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GRE IPv6 UDP GTPU IPv6*/ +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv4 UDP GTPU EH IPv4*/ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv4 UDP GTPU IPv6*/ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv6 UDP GTPU EH IPv4*/ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv6 UDP GTPU EH IPv6*/ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GRE IPv4 UDP GTPU EH IPv4*/ +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GRE IPv4 UDP GTPU EH IPv6*/ +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GRE IPv6 UDP GTPU EH IPv4*/ +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GRE IPv6 UDP GTPU EH IPv6*/ +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_GTPU, + AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GTPU IPv6 */ +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_ipv6_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_ICMP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GTPU IPv4 */ +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_ipv4_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_ICMP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GTPU IPv6 */ +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_ipv6_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_ICMP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GTPU EH IPv4 */ +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh_ipv4_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_ICMP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV4 GTPU EH IPv6 */ +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gtpu_eh_ipv6_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_ICMP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GTPU EH IPv4 */ +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh_ipv4_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_ICMP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* IPV6 GTPU EH IPv6 */ +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gtpu_eh_ipv6_icmp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_GTPU, AVF_FLOW_ITEM_TYPE_GTP_PSC, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_ICMP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* ESP */ +enum avf_flow_item_type avf_pattern_eth_ipv4_esp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_ESP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_esp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_ESP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_esp[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_ESP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_esp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_ESP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* AH */ +enum avf_flow_item_type avf_pattern_eth_ipv4_ah[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_AH, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_ah[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_AH, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* L2TPV3 */ +enum avf_flow_item_type avf_pattern_eth_ipv4_l2tpv3[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_L2TPV3OIP, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_l2tpv3[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_L2TPV3OIP, + AVF_FLOW_ITEM_TYPE_END, +}; + +/* PFCP */ +enum avf_flow_item_type avf_pattern_eth_ipv4_pfcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_PFCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_pfcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_PFCP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* ECPRI */ +enum avf_flow_item_type avf_pattern_eth_ecpri[] = { + AVF_FLOW_ITEM_TYPE_ETH, + AVF_FLOW_ITEM_TYPE_ECPRI, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_ecpri[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_ECPRI, AVF_FLOW_ITEM_TYPE_END, +}; + +/* GRE */ +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_gre_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_gre_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_GRE, + AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_l2tpv2[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_l2tpv2_ppp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_l2tpv2[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_l2tpv2_ppp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_END, +}; + +/* PPPoL2TPv2oUDP */ +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV4, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV4, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_udp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_UDP, AVF_FLOW_ITEM_TYPE_END, +}; + +enum avf_flow_item_type avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_tcp[] = { + AVF_FLOW_ITEM_TYPE_ETH, AVF_FLOW_ITEM_TYPE_IPV6, AVF_FLOW_ITEM_TYPE_UDP, + AVF_FLOW_ITEM_TYPE_L2TPV2, AVF_FLOW_ITEM_TYPE_PPP, AVF_FLOW_ITEM_TYPE_IPV6, + AVF_FLOW_ITEM_TYPE_TCP, AVF_FLOW_ITEM_TYPE_END, +}; + +static struct avf_pattern_match_item avf_hash_pattern_list[] = { + /* IPv4 */ + { avf_pattern_raw, AVF_INSET_NONE, NULL }, + { avf_pattern_eth_ipv4, AVF_RSS_TYPE_OUTER_IPV4, &outer_ipv4_tmplt }, + { avf_pattern_eth_ipv4_udp, AVF_RSS_TYPE_OUTER_IPV4_UDP, + &outer_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_tcp, AVF_RSS_TYPE_OUTER_IPV4_TCP, + &outer_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv4_sctp, AVF_RSS_TYPE_OUTER_IPV4_SCTP, + &outer_ipv4_sctp_tmplt }, + { avf_pattern_eth_vlan_ipv4, AVF_RSS_TYPE_VLAN_IPV4, &outer_ipv4_tmplt }, + { avf_pattern_eth_vlan_ipv4_udp, AVF_RSS_TYPE_VLAN_IPV4_UDP, + &outer_ipv4_udp_tmplt }, + { avf_pattern_eth_vlan_ipv4_tcp, AVF_RSS_TYPE_VLAN_IPV4_TCP, + &outer_ipv4_tcp_tmplt }, + { avf_pattern_eth_vlan_ipv4_sctp, AVF_RSS_TYPE_VLAN_IPV4_SCTP, + &outer_ipv4_sctp_tmplt }, + { avf_pattern_eth_ipv4_gtpu, AVF_ETH_RSS_IPV4, &outer_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_gtpu_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &inner_ipv4_tmplt }, + { avf_pattern_eth_ipv4_gtpu_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_gtpu_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv6_gtpu_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &inner_ipv4_tmplt }, + { avf_pattern_eth_ipv6_gtpu_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv6_gtpu_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv4_gtpu_eh_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &inner_ipv4_tmplt }, + { avf_pattern_eth_ipv4_gtpu_eh_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv6_gtpu_eh_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &inner_ipv4_tmplt }, + { avf_pattern_eth_ipv6_gtpu_eh_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv6_gtpu_eh_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &second_inner_ipv4_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &second_inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &second_inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &second_inner_ipv4_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &second_inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &second_inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &second_inner_ipv4_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &second_inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &second_inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &second_inner_ipv4_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &second_inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &second_inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &second_inner_ipv4_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &second_inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &second_inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &second_inner_ipv4_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &second_inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &second_inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &second_inner_ipv4_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &second_inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &second_inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4, AVF_RSS_TYPE_GTPU_IPV4, + &second_inner_ipv4_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4_udp, AVF_RSS_TYPE_GTPU_IPV4_UDP, + &second_inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4_tcp, AVF_RSS_TYPE_GTPU_IPV4_TCP, + &second_inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv4_esp, AVF_RSS_TYPE_IPV4_ESP, &ipv4_esp_tmplt }, + { avf_pattern_eth_ipv4_udp_esp, AVF_RSS_TYPE_IPV4_ESP, &ipv4_udp_esp_tmplt }, + { avf_pattern_eth_ipv4_ah, AVF_RSS_TYPE_IPV4_AH, &ipv4_ah_tmplt }, + { avf_pattern_eth_ipv4_l2tpv3, AVF_RSS_TYPE_IPV4_L2TPV3, + &ipv4_l2tpv3_tmplt }, + { avf_pattern_eth_ipv4_pfcp, AVF_RSS_TYPE_IPV4_PFCP, &ipv4_pfcp_tmplt }, + { avf_pattern_eth_ipv4_gtpc, AVF_ETH_RSS_IPV4, &ipv4_udp_gtpc_tmplt }, + { avf_pattern_eth_ecpri, AVF_ETH_RSS_ECPRI, ð_ecpri_tmplt }, + { avf_pattern_eth_ipv4_ecpri, AVF_ETH_RSS_ECPRI, &ipv4_ecpri_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4, AVF_RSS_TYPE_INNER_IPV4, + &inner_ipv4_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4, AVF_RSS_TYPE_INNER_IPV4, + &inner_ipv4_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_tcp, AVF_RSS_TYPE_INNER_IPV4_TCP, + &inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_tcp, AVF_RSS_TYPE_INNER_IPV4_TCP, + &inner_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_udp, AVF_RSS_TYPE_INNER_IPV4_UDP, + &inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_udp, AVF_RSS_TYPE_INNER_IPV4_UDP, + &inner_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_udp_l2tpv2, AVF_RSS_TYPE_ETH_L2TPV2, + &ipv4_l2tpv2_tmplt }, + { avf_pattern_eth_ipv4_udp_l2tpv2_ppp, AVF_RSS_TYPE_ETH_L2TPV2, + &ipv4_l2tpv2_ppp_tmplt }, + { avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4, AVF_RSS_TYPE_INNER_IPV4, + &udp_l2tpv2_ppp_ipv4_tmplt }, + { avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_udp, AVF_RSS_TYPE_INNER_IPV4_UDP, + &udp_l2tpv2_ppp_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_tcp, AVF_RSS_TYPE_INNER_IPV4_TCP, + &udp_l2tpv2_ppp_ipv4_tcp_tmplt }, + { avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4, AVF_RSS_TYPE_INNER_IPV4, + &udp_l2tpv2_ppp_ipv4_tmplt }, + { avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4_udp, AVF_RSS_TYPE_INNER_IPV4_UDP, + &udp_l2tpv2_ppp_ipv4_udp_tmplt }, + { avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4_tcp, AVF_RSS_TYPE_INNER_IPV4_TCP, + &udp_l2tpv2_ppp_ipv4_tcp_tmplt }, + + /* IPv6 */ + { avf_pattern_eth_ipv6, AVF_RSS_TYPE_OUTER_IPV6, &outer_ipv6_tmplt }, + { avf_pattern_eth_ipv6_frag_ext, AVF_RSS_TYPE_OUTER_IPV6_FRAG, + &outer_ipv6_frag_tmplt }, + { avf_pattern_eth_ipv6_udp, AVF_RSS_TYPE_OUTER_IPV6_UDP, + &outer_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_tcp, AVF_RSS_TYPE_OUTER_IPV6_TCP, + &outer_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_sctp, AVF_RSS_TYPE_OUTER_IPV6_SCTP, + &outer_ipv6_sctp_tmplt }, + { avf_pattern_eth_vlan_ipv6, AVF_RSS_TYPE_VLAN_IPV6, &outer_ipv6_tmplt }, + { avf_pattern_eth_vlan_ipv6_frag_ext, AVF_RSS_TYPE_OUTER_IPV6_FRAG, + &outer_ipv6_frag_tmplt }, + { avf_pattern_eth_vlan_ipv6_udp, AVF_RSS_TYPE_VLAN_IPV6_UDP, + &outer_ipv6_udp_tmplt }, + { avf_pattern_eth_vlan_ipv6_tcp, AVF_RSS_TYPE_VLAN_IPV6_TCP, + &outer_ipv6_tcp_tmplt }, + { avf_pattern_eth_vlan_ipv6_sctp, AVF_RSS_TYPE_VLAN_IPV6_SCTP, + &outer_ipv6_sctp_tmplt }, + { avf_pattern_eth_ipv6_gtpu, AVF_ETH_RSS_IPV6, &outer_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv4_gtpu_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &inner_ipv6_tmplt }, + { avf_pattern_eth_ipv4_gtpu_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv4_gtpu_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_gtpu_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &inner_ipv6_tmplt }, + { avf_pattern_eth_ipv6_gtpu_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_gtpu_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv4_gtpu_eh_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &inner_ipv6_tmplt }, + { avf_pattern_eth_ipv4_gtpu_eh_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv4_gtpu_eh_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_gtpu_eh_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &inner_ipv6_tmplt }, + { avf_pattern_eth_ipv6_gtpu_eh_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_gtpu_eh_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &second_inner_ipv6_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &second_inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &second_inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &second_inner_ipv6_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &second_inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &second_inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &second_inner_ipv6_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &second_inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &second_inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &second_inner_ipv6_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &second_inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &second_inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &second_inner_ipv6_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &second_inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &second_inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &second_inner_ipv6_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &second_inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &second_inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &second_inner_ipv6_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &second_inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &second_inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6, AVF_RSS_TYPE_GTPU_IPV6, + &second_inner_ipv6_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6_udp, AVF_RSS_TYPE_GTPU_IPV6_UDP, + &second_inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6_tcp, AVF_RSS_TYPE_GTPU_IPV6_TCP, + &second_inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_esp, AVF_RSS_TYPE_IPV6_ESP, &ipv6_esp_tmplt }, + { avf_pattern_eth_ipv6_udp_esp, AVF_RSS_TYPE_IPV6_ESP, &ipv6_udp_esp_tmplt }, + { avf_pattern_eth_ipv6_ah, AVF_RSS_TYPE_IPV6_AH, &ipv6_ah_tmplt }, + { avf_pattern_eth_ipv6_l2tpv3, AVF_RSS_TYPE_IPV6_L2TPV3, + &ipv6_l2tpv3_tmplt }, + { avf_pattern_eth_ipv6_pfcp, AVF_RSS_TYPE_IPV6_PFCP, &ipv6_pfcp_tmplt }, + { avf_pattern_eth_ipv6_gtpc, AVF_ETH_RSS_IPV6, &ipv6_udp_gtpc_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6, AVF_RSS_TYPE_INNER_IPV6, + &inner_ipv6_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6, AVF_RSS_TYPE_INNER_IPV6, + &inner_ipv6_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_tcp, AVF_RSS_TYPE_INNER_IPV6_TCP, + &inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_tcp, AVF_RSS_TYPE_INNER_IPV6_TCP, + &inner_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv4_gre_ipv6_udp, AVF_RSS_TYPE_INNER_IPV6_UDP, + &inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_gre_ipv6_udp, AVF_RSS_TYPE_INNER_IPV6_UDP, + &inner_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_udp_l2tpv2, AVF_RSS_TYPE_ETH_L2TPV2, + &ipv6_l2tpv2_tmplt }, + { avf_pattern_eth_ipv6_udp_l2tpv2_ppp, AVF_RSS_TYPE_ETH_L2TPV2, + &ipv6_l2tpv2_ppp_tmplt }, + { avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6, AVF_RSS_TYPE_INNER_IPV6, + &udp_l2tpv2_ppp_ipv6_tmplt }, + { avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_udp, AVF_RSS_TYPE_INNER_IPV6_UDP, + &udp_l2tpv2_ppp_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_tcp, AVF_RSS_TYPE_INNER_IPV6_TCP, + &udp_l2tpv2_ppp_ipv6_tcp_tmplt }, + { avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6, AVF_RSS_TYPE_INNER_IPV6, + &udp_l2tpv2_ppp_ipv6_tmplt }, + { avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_udp, AVF_RSS_TYPE_INNER_IPV6_UDP, + &udp_l2tpv2_ppp_ipv6_udp_tmplt }, + { avf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_tcp, AVF_RSS_TYPE_INNER_IPV6_TCP, + &udp_l2tpv2_ppp_ipv6_tcp_tmplt }, + +}; + +static inline u64 +avf_eth_rss_hf_refine (u64 rss_hf) +{ + if ((rss_hf & AVF_ETH_RSS_L3_SRC_ONLY) && (rss_hf & AVF_ETH_RSS_L3_DST_ONLY)) + rss_hf &= ~(AVF_ETH_RSS_L3_SRC_ONLY | AVF_ETH_RSS_L3_DST_ONLY); + + if ((rss_hf & AVF_ETH_RSS_L4_SRC_ONLY) && (rss_hf & AVF_ETH_RSS_L4_DST_ONLY)) + rss_hf &= ~(AVF_ETH_RSS_L4_SRC_ONLY | AVF_ETH_RSS_L4_DST_ONLY); + + return rss_hf; +} + +static int +avf_any_invalid_rss_type (enum avf_eth_hash_function rss_func, u64 rss_type, + u64 allow_rss_type) +{ + u32 i; + + /** + * Check if l3/l4 SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ + * hash function. + */ + if (rss_func == AVF_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) + { + if (rss_type & (AVF_ETH_RSS_L3_SRC_ONLY | AVF_ETH_RSS_L3_DST_ONLY | + AVF_ETH_RSS_L4_SRC_ONLY | AVF_ETH_RSS_L4_DST_ONLY)) + return 1; + + if (!(rss_type & + (AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_IPV6 | + AVF_ETH_RSS_NONFRAG_IPV4_UDP | AVF_ETH_RSS_NONFRAG_IPV6_UDP | + AVF_ETH_RSS_NONFRAG_IPV4_TCP | AVF_ETH_RSS_NONFRAG_IPV6_TCP | + AVF_ETH_RSS_NONFRAG_IPV4_SCTP | AVF_ETH_RSS_NONFRAG_IPV6_SCTP))) + return 1; + } + + /* check invalid combination */ + for (i = 0; i < _vec_len (invalid_rss_comb); i++) + { + if (__builtin_popcountll (rss_type & invalid_rss_comb[i]) > 1) + return 1; + } + + /* check invalid RSS attribute */ + for (i = 0; i < _vec_len (rss_attr_to_valid_type); i++) + { + struct rss_attr_type *rat = &rss_attr_to_valid_type[i]; + + if (rat->attr & rss_type && !(rat->type & rss_type)) + return 1; + } + + /* check not allowed RSS type */ + rss_type &= ~VALID_RSS_ATTR; + + return ((rss_type & allow_rss_type) != rss_type); +} + int avf_rss_cfg_create (struct virtchnl_rss_cfg **rss_cfg, int tunnel_level) { *rss_cfg = clib_mem_alloc (sizeof (**rss_cfg)); - if ((*rss_cfg) == NULL) - return -1; clib_memset (*rss_cfg, 0, sizeof (**rss_cfg)); @@ -40,36 +2006,438 @@ avf_rss_rcfg_destroy (struct virtchnl_rss_cfg *rss_cfg) return 0; } -int -avf_rss_parse_action (const struct avf_flow_action actions[], - struct virtchnl_rss_cfg *rss_cfg, - struct avf_flow_error *error) +/* refine proto hdrs base on gtpu rss type */ +static void +avf_refine_proto_hdrs_gtpu (struct virtchnl_proto_hdrs *proto_hdrs, + u64 rss_type) { - const struct avf_flow_action_rss *rss; - int ret; + struct virtchnl_proto_hdr *hdr; + int i; + + if (!(rss_type & AVF_ETH_RSS_GTPU)) + return; + + for (i = 0; i < proto_hdrs->count; i++) + { + hdr = &proto_hdrs->proto_hdr[i]; + switch (hdr->type) + { + case VIRTCHNL_PROTO_HDR_GTPU_IP: + REFINE_PROTO_FLD (ADD, GTPU_IP_TEID); + break; + default: + break; + } + } +} + +static void +avf_hash_add_fragment_hdr (struct virtchnl_proto_hdrs *hdrs, int layer) +{ + struct virtchnl_proto_hdr *hdr1; + struct virtchnl_proto_hdr *hdr2; + int i; - rss = actions->conf; + if (layer < 0 || layer > hdrs->count) + return; - if (rss->func == AVF_ETH_HASH_FUNCTION_SIMPLE_XOR) + /* shift headers layer */ + for (i = hdrs->count; i >= layer; i--) { - rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC; - ret = avf_flow_error_set (error, AVF_FAILURE, AVF_FLOW_ERROR_TYPE_ACTION, - actions, "simple xor is not supported."); - return ret; + hdr1 = &hdrs->proto_hdr[i]; + hdr2 = &hdrs->proto_hdr[i - 1]; + *hdr1 = *hdr2; } - else if (rss->func == AVF_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) + + /* adding dummy fragment header */ + hdr1 = &hdrs->proto_hdr[layer]; + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr1, IPV4_FRAG); + hdrs->count = ++layer; +} + +/* refine proto hdrs base on l2, l3, l4 rss type */ +static void +avf_refine_proto_hdrs_l234 (struct virtchnl_proto_hdrs *proto_hdrs, + u64 rss_type) +{ + struct virtchnl_proto_hdr *hdr; + int i; + + for (i = 0; i < proto_hdrs->count; i++) { - rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC; + hdr = &proto_hdrs->proto_hdr[i]; + switch (hdr->type) + { + case VIRTCHNL_PROTO_HDR_ETH: + if (!(rss_type & AVF_ETH_RSS_ETH)) + hdr->field_selector = 0; + else if (rss_type & AVF_ETH_RSS_L2_SRC_ONLY) + REFINE_PROTO_FLD (DEL, ETH_DST); + else if (rss_type & AVF_ETH_RSS_L2_DST_ONLY) + REFINE_PROTO_FLD (DEL, ETH_SRC); + break; + case VIRTCHNL_PROTO_HDR_IPV4: + if (rss_type & + (AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_FRAG_IPV4 | + AVF_ETH_RSS_NONFRAG_IPV4_UDP | AVF_ETH_RSS_NONFRAG_IPV4_TCP | + AVF_ETH_RSS_NONFRAG_IPV4_SCTP)) + { + if (rss_type & AVF_ETH_RSS_FRAG_IPV4) + { + avf_hash_add_fragment_hdr (proto_hdrs, i + 1); + } + else if (rss_type & AVF_ETH_RSS_L3_SRC_ONLY) + { + REFINE_PROTO_FLD (DEL, IPV4_DST); + } + else if (rss_type & AVF_ETH_RSS_L3_DST_ONLY) + { + REFINE_PROTO_FLD (DEL, IPV4_SRC); + } + else if (rss_type & + (AVF_ETH_RSS_L4_SRC_ONLY | AVF_ETH_RSS_L4_DST_ONLY)) + { + REFINE_PROTO_FLD (DEL, IPV4_DST); + REFINE_PROTO_FLD (DEL, IPV4_SRC); + } + } + else + { + hdr->field_selector = 0; + } + + if (rss_type & AVF_ETH_RSS_IPV4_CHKSUM) + REFINE_PROTO_FLD (ADD, IPV4_CHKSUM); + + break; + case VIRTCHNL_PROTO_HDR_IPV4_FRAG: + if (rss_type & + (AVF_ETH_RSS_IPV4 | AVF_ETH_RSS_FRAG_IPV4 | + AVF_ETH_RSS_NONFRAG_IPV4_UDP | AVF_ETH_RSS_NONFRAG_IPV4_TCP | + AVF_ETH_RSS_NONFRAG_IPV4_SCTP)) + { + if (rss_type & AVF_ETH_RSS_FRAG_IPV4) + REFINE_PROTO_FLD (ADD, IPV4_FRAG_PKID); + } + else + { + hdr->field_selector = 0; + } + + if (rss_type & AVF_ETH_RSS_IPV4_CHKSUM) + REFINE_PROTO_FLD (ADD, IPV4_CHKSUM); + + break; + case VIRTCHNL_PROTO_HDR_IPV6: + if (rss_type & + (AVF_ETH_RSS_IPV6 | AVF_ETH_RSS_FRAG_IPV6 | + AVF_ETH_RSS_NONFRAG_IPV6_UDP | AVF_ETH_RSS_NONFRAG_IPV6_TCP | + AVF_ETH_RSS_NONFRAG_IPV6_SCTP)) + { + if (rss_type & AVF_ETH_RSS_L3_SRC_ONLY) + { + REFINE_PROTO_FLD (DEL, IPV6_DST); + } + else if (rss_type & AVF_ETH_RSS_L3_DST_ONLY) + { + REFINE_PROTO_FLD (DEL, IPV6_SRC); + } + else if (rss_type & + (AVF_ETH_RSS_L4_SRC_ONLY | AVF_ETH_RSS_L4_DST_ONLY)) + { + REFINE_PROTO_FLD (DEL, IPV6_DST); + REFINE_PROTO_FLD (DEL, IPV6_SRC); + } + } + else + { + hdr->field_selector = 0; + } + if (rss_type & AVF_ETH_RSS_L3_PRE64) + { + if (REFINE_PROTO_FLD (TEST, IPV6_SRC)) + REPALCE_PROTO_FLD (IPV6_SRC, IPV6_PREFIX64_SRC); + if (REFINE_PROTO_FLD (TEST, IPV6_DST)) + REPALCE_PROTO_FLD (IPV6_DST, IPV6_PREFIX64_DST); + } + break; + case VIRTCHNL_PROTO_HDR_IPV6_EH_FRAG: + if (rss_type & AVF_ETH_RSS_FRAG_IPV6) + REFINE_PROTO_FLD (ADD, IPV6_EH_FRAG_PKID); + else + hdr->field_selector = 0; + + break; + case VIRTCHNL_PROTO_HDR_UDP: + if (rss_type & + (AVF_ETH_RSS_NONFRAG_IPV4_UDP | AVF_ETH_RSS_NONFRAG_IPV6_UDP)) + { + if (rss_type & AVF_ETH_RSS_L4_SRC_ONLY) + REFINE_PROTO_FLD (DEL, UDP_DST_PORT); + else if (rss_type & AVF_ETH_RSS_L4_DST_ONLY) + REFINE_PROTO_FLD (DEL, UDP_SRC_PORT); + else if (rss_type & + (AVF_ETH_RSS_L3_SRC_ONLY | AVF_ETH_RSS_L3_DST_ONLY)) + hdr->field_selector = 0; + } + else + { + hdr->field_selector = 0; + } + + if (rss_type & AVF_ETH_RSS_L4_CHKSUM) + REFINE_PROTO_FLD (ADD, UDP_CHKSUM); + break; + case VIRTCHNL_PROTO_HDR_TCP: + if (rss_type & + (AVF_ETH_RSS_NONFRAG_IPV4_TCP | AVF_ETH_RSS_NONFRAG_IPV6_TCP)) + { + if (rss_type & AVF_ETH_RSS_L4_SRC_ONLY) + REFINE_PROTO_FLD (DEL, TCP_DST_PORT); + else if (rss_type & AVF_ETH_RSS_L4_DST_ONLY) + REFINE_PROTO_FLD (DEL, TCP_SRC_PORT); + else if (rss_type & + (AVF_ETH_RSS_L3_SRC_ONLY | AVF_ETH_RSS_L3_DST_ONLY)) + hdr->field_selector = 0; + } + else + { + hdr->field_selector = 0; + } + + if (rss_type & AVF_ETH_RSS_L4_CHKSUM) + REFINE_PROTO_FLD (ADD, TCP_CHKSUM); + break; + case VIRTCHNL_PROTO_HDR_SCTP: + if (rss_type & + (AVF_ETH_RSS_NONFRAG_IPV4_SCTP | AVF_ETH_RSS_NONFRAG_IPV6_SCTP)) + { + if (rss_type & AVF_ETH_RSS_L4_SRC_ONLY) + REFINE_PROTO_FLD (DEL, SCTP_DST_PORT); + else if (rss_type & AVF_ETH_RSS_L4_DST_ONLY) + REFINE_PROTO_FLD (DEL, SCTP_SRC_PORT); + else if (rss_type & + (AVF_ETH_RSS_L3_SRC_ONLY | AVF_ETH_RSS_L3_DST_ONLY)) + hdr->field_selector = 0; + } + else + { + hdr->field_selector = 0; + } + + if (rss_type & AVF_ETH_RSS_L4_CHKSUM) + REFINE_PROTO_FLD (ADD, SCTP_CHKSUM); + break; + case VIRTCHNL_PROTO_HDR_S_VLAN: + if (!(rss_type & AVF_ETH_RSS_S_VLAN)) + hdr->field_selector = 0; + break; + case VIRTCHNL_PROTO_HDR_C_VLAN: + if (!(rss_type & AVF_ETH_RSS_C_VLAN)) + hdr->field_selector = 0; + break; + case VIRTCHNL_PROTO_HDR_L2TPV3: + if (!(rss_type & AVF_ETH_RSS_L2TPV3)) + hdr->field_selector = 0; + break; + case VIRTCHNL_PROTO_HDR_ESP: + if (!(rss_type & AVF_ETH_RSS_ESP)) + hdr->field_selector = 0; + break; + case VIRTCHNL_PROTO_HDR_AH: + if (!(rss_type & AVF_ETH_RSS_AH)) + hdr->field_selector = 0; + break; + case VIRTCHNL_PROTO_HDR_PFCP: + if (!(rss_type & AVF_ETH_RSS_PFCP)) + hdr->field_selector = 0; + break; + case VIRTCHNL_PROTO_HDR_ECPRI: + if (!(rss_type & AVF_ETH_RSS_ECPRI)) + hdr->field_selector = 0; + break; + case VIRTCHNL_PROTO_HDR_L2TPV2: + if (!(rss_type & AVF_ETH_RSS_L2TPV2)) + hdr->field_selector = 0; + break; + default: + break; + } + } +} + +static void +avf_refine_proto_hdrs_by_pattern (struct virtchnl_proto_hdrs *proto_hdrs, + u64 phint) +{ + struct virtchnl_proto_hdr *hdr1; + struct virtchnl_proto_hdr *hdr2; + int i, shift_count = 1; + int tun_lvl = proto_hdrs->tunnel_level; + + if (!(phint & AVF_PHINT_GTPU_MSK) && !(phint & AVF_PHINT_GRE)) + return; + + while (tun_lvl) + { + if (phint & AVF_PHINT_LAYERS_MSK) + shift_count = 2; + + /* shift headers layer */ + for (i = proto_hdrs->count - 1 + shift_count; i > shift_count - 1; i--) + { + hdr1 = &proto_hdrs->proto_hdr[i]; + hdr2 = &proto_hdrs->proto_hdr[i - shift_count]; + *hdr1 = *hdr2; + } + + if (shift_count == 1) + { + /* adding tunnel header at layer 0 */ + hdr1 = &proto_hdrs->proto_hdr[0]; + } + else + { + /* adding tunnel header and outer ip header */ + hdr1 = &proto_hdrs->proto_hdr[1]; + hdr2 = &proto_hdrs->proto_hdr[0]; + hdr2->field_selector = 0; + proto_hdrs->count++; + tun_lvl--; + + if (tun_lvl == TUNNEL_LEVEL_OUTER) + { + if (phint & AVF_PHINT_OUTER_IPV4) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr2, IPV4); + else if (phint & AVF_PHINT_OUTER_IPV6) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr2, IPV6); + } + else if (tun_lvl == TUNNEL_LEVEL_INNER) + { + if (phint & AVF_PHINT_MID_IPV4) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr2, IPV4); + else if (phint & AVF_PHINT_MID_IPV6) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr2, IPV6); + } + } + + hdr1->field_selector = 0; + proto_hdrs->count++; + + if (phint & AVF_PHINT_GTPU_EH_DWN) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr1, GTPU_EH_PDU_DWN); + else if (phint & AVF_PHINT_GTPU_EH_UP) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr1, GTPU_EH_PDU_UP); + else if (phint & AVF_PHINT_GTPU_EH) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr1, GTPU_EH); + else if (phint & AVF_PHINT_GTPU) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr1, GTPU_IP); + + if (phint & AVF_PHINT_GRE) + { + if (phint & AVF_PHINT_GTPU) + { + /* if GTPoGRE, add GRE header at the outer tunnel */ + if (tun_lvl == TUNNEL_LEVEL_OUTER) + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr1, GRE); + } + else + { + VIRTCHNL_SET_PROTO_HDR_TYPE (hdr1, GRE); + } + } } - else + proto_hdrs->tunnel_level = tun_lvl; +} + +static void +avf_refine_proto_hdrs (struct virtchnl_proto_hdrs *proto_hdrs, u64 rss_type, + u64 phint) +{ + avf_refine_proto_hdrs_l234 (proto_hdrs, rss_type); + avf_refine_proto_hdrs_by_pattern (proto_hdrs, phint); + avf_refine_proto_hdrs_gtpu (proto_hdrs, rss_type); +} + +static int +avf_rss_parse_action (const struct avf_flow_action actions[], + struct virtchnl_rss_cfg *rss_cfg, + struct avf_pattern_match_item *match_item, u64 phint, + struct avf_flow_error *error) +{ + const struct avf_flow_action_rss *rss; + const struct avf_flow_action *action; + u64 rss_type; + int ret; + + for (action = actions; action->type != AVF_FLOW_ACTION_TYPE_END; action++) { - rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC; + switch (action->type) + { + case AVF_FLOW_ACTION_TYPE_RSS: + rss = action->conf; + + if (rss->func == AVF_ETH_HASH_FUNCTION_SIMPLE_XOR) + { + rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC; + ret = avf_flow_error_set (error, AVF_FAILURE, + AVF_FLOW_ERROR_TYPE_ACTION, actions, + "simple xor is not supported."); + return ret; + } + else if (rss->func == AVF_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) + { + rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC; + } + else + { + rss_cfg->rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC; + } + + if (rss->level) + return avf_flow_error_set ( + error, AVF_FAILURE, AVF_FLOW_ERROR_TYPE_ACTION, actions, + "a nonzero RSS encapsulation level is not supported"); + + if (rss->key_len) + return avf_flow_error_set ( + error, AVF_FAILURE, AVF_FLOW_ERROR_TYPE_ACTION, actions, + "a nonzero RSS key_len is not supported"); + + if (rss->queue_num) + return avf_flow_error_set ( + error, AVF_FAILURE, AVF_FLOW_ERROR_TYPE_ACTION, actions, + "a non-NULL RSS queue is not supported"); + + if (phint == AVF_PHINT_RAW) + break; + + rss_type = avf_eth_rss_hf_refine (rss->types); + + if (avf_any_invalid_rss_type (rss->func, rss_type, + match_item->input_set_mask)) + return avf_flow_error_set (error, AVF_FAILURE, + AVF_FLOW_ERROR_TYPE_ACTION, actions, + "RSS type not supported"); + + memcpy (&rss_cfg->proto_hdrs, match_item->meta, + sizeof (struct virtchnl_proto_hdrs)); + + avf_refine_proto_hdrs (&rss_cfg->proto_hdrs, rss_type, phint); + + break; + + default: + return avf_flow_error_set (error, AVF_FAILURE, + AVF_FLOW_ERROR_TYPE_ACTION, actions, + "Invalid action."); + } } return 0; } -int +static int avf_rss_parse_generic_pattern (struct virtchnl_rss_cfg *rss_cfg, struct avf_flow_item avf_items[], struct avf_flow_error *error) @@ -99,15 +2467,196 @@ avf_rss_parse_generic_pattern (struct virtchnl_rss_cfg *rss_cfg, return 0; } -/* Used for common flow creation */ -int -avf_rss_parse_pattern (struct virtchnl_rss_cfg *rss_cfg, - struct avf_flow_item avf_items[], - struct avf_flow_error *error) +/* Find the first VOID or non-VOID item pointer */ +static const struct avf_flow_item * +avf_find_first_item (const struct avf_flow_item *item, int is_void) +{ + int is_find; + + while (item->type != AVF_FLOW_ITEM_TYPE_END) + { + if (is_void) + is_find = item->type == AVF_FLOW_ITEM_TYPE_VOID; + else + is_find = item->type != AVF_FLOW_ITEM_TYPE_VOID; + if (is_find) + break; + item++; + } + return item; +} + +/* Skip all VOID items of the pattern */ +static void +avf_pattern_skip_void_item (struct avf_flow_item *items, + const struct avf_flow_item *pattern) +{ + u32 cpy_count = 0; + const struct avf_flow_item *pb = pattern, *pe = pattern; + + for (;;) + { + /* Find a non-void item first */ + pb = avf_find_first_item (pb, 0); + if (pb->type == AVF_FLOW_ITEM_TYPE_END) + { + pe = pb; + break; + } + + /* Find a void item */ + pe = avf_find_first_item (pb + 1, 1); + + cpy_count = pe - pb; + clib_memcpy (items, pb, sizeof (struct avf_flow_item) * cpy_count); + + items += cpy_count; + + if (pe->type == AVF_FLOW_ITEM_TYPE_END) + break; + + pb = pe + 1; + } + /* Copy the END item. */ + clib_memcpy (items, pe, sizeof (struct avf_flow_item)); +} + +/* Check if the pattern matches a supported item type array */ +static int +avf_match_pattern (enum avf_flow_item_type *item_array, + const struct avf_flow_item *pattern) +{ + const struct avf_flow_item *item = pattern; + + while ((*item_array == item->type) && + (*item_array != AVF_FLOW_ITEM_TYPE_END)) + { + item_array++; + item++; + } + + return (*item_array == AVF_FLOW_ITEM_TYPE_END && + item->type == AVF_FLOW_ITEM_TYPE_END); +} + +static int +avf_rss_search_pattern_match_item (const struct avf_flow_item pattern[], + struct avf_pattern_match_item **match_item, + struct avf_flow_error *error) { + u16 i = 0; + struct avf_pattern_match_item *array = avf_hash_pattern_list; + u32 array_len = + sizeof (avf_hash_pattern_list) / sizeof (avf_hash_pattern_list[0]); + /* need free by each filter */ + struct avf_flow_item *items; /* used for pattern without VOID items */ + u32 item_num = 0; /* non-void item number */ + + /* Get the non-void item number of pattern */ + while ((pattern + i)->type != AVF_FLOW_ITEM_TYPE_END) + { + if ((pattern + i)->type != AVF_FLOW_ITEM_TYPE_VOID) + item_num++; + i++; + } + item_num++; + + items = clib_mem_alloc (item_num * sizeof (struct avf_flow_item)); + avf_pattern_skip_void_item (items, pattern); + + for (i = 0; i < array_len; i++) + if (avf_match_pattern (array[i].pattern_list, items)) + { + *match_item = &array[i]; + clib_mem_free (items); + return 0; + } + avf_flow_error_set (error, AVF_FAILURE, AVF_FLOW_ERROR_TYPE_ITEM, pattern, + "Unsupported pattern"); + + *match_item = NULL; + clib_mem_free (items); return -1; } +static void +avf_rss_parse_pattern (const struct avf_flow_item pattern[], u64 *phint) +{ + const struct avf_flow_item *item = pattern; + const struct avf_gtp_psc_hdr *psc; + + for (item = pattern; item->type != AVF_FLOW_ITEM_TYPE_END; item++) + { + + switch (item->type) + { + case AVF_FLOW_ITEM_TYPE_RAW: + *phint |= AVF_PHINT_RAW; + break; + case AVF_FLOW_ITEM_TYPE_IPV4: + if (!(*phint & AVF_PHINT_GTPU_MSK) && !(*phint & AVF_PHINT_GRE) && + !(*phint & AVF_PHINT_L2TPV2)) + *phint |= AVF_PHINT_OUTER_IPV4; + if ((*phint & AVF_PHINT_GRE) && !(*phint & AVF_PHINT_GTPU_MSK)) + *phint |= AVF_PHINT_MID_IPV4; + break; + case AVF_FLOW_ITEM_TYPE_IPV6: + if (!(*phint & AVF_PHINT_GTPU_MSK) && !(*phint & AVF_PHINT_GRE) && + !(*phint & AVF_PHINT_L2TPV2)) + *phint |= AVF_PHINT_OUTER_IPV6; + if ((*phint & AVF_PHINT_GRE) && !(*phint & AVF_PHINT_GTPU_MSK)) + *phint |= AVF_PHINT_MID_IPV6; + break; + case AVF_FLOW_ITEM_TYPE_GTPU: + *phint |= AVF_PHINT_GTPU; + break; + case AVF_FLOW_ITEM_TYPE_GTP_PSC: + *phint |= AVF_PHINT_GTPU_EH; + psc = item->spec; + if (!psc) + break; + else if (psc->pdu_type == AVF_GTPU_EH_UPLINK) + *phint |= AVF_PHINT_GTPU_EH_UP; + else if (psc->pdu_type == AVF_GTPU_EH_DWNLINK) + *phint |= AVF_PHINT_GTPU_EH_DWN; + break; + case AVF_FLOW_ITEM_TYPE_GRE: + *phint |= AVF_PHINT_GRE; + break; + default: + break; + } + } +} + +int +avf_rss_parse_pattern_action (struct avf_flow_item avf_items[], + struct avf_flow_action avf_actions[], + struct virtchnl_rss_cfg *rss_cfg, + struct avf_flow_error *error) +{ + struct avf_pattern_match_item *match_item = NULL; + u64 pattern_hint = 0; + int ret = 0; + + ret = avf_rss_search_pattern_match_item (avf_items, &match_item, error); + if (ret) + return ret; + + avf_rss_parse_pattern (avf_items, &pattern_hint); + + if (pattern_hint == AVF_PHINT_RAW) + { + ret = avf_rss_parse_generic_pattern (rss_cfg, avf_items, error); + if (ret) + return ret; + } + + ret = avf_rss_parse_action (avf_actions, rss_cfg, match_item, pattern_hint, + error); + return ret; +} + int avf_rss_rule_create (struct avf_flow_vc_ctx *ctx, struct virtchnl_rss_cfg *rss_cfg) diff --git a/src/plugins/avf/flow.c b/src/plugins/avf/flow.c index 8d6d6462823..91c5e018c71 100644 --- a/src/plugins/avf/flow.c +++ b/src/plugins/avf/flow.c @@ -64,6 +64,23 @@ (f->type == VNET_FLOW_TYPE_IP4_GTPC) || \ (f->type == VNET_FLOW_TYPE_IP4_GTPU)) +static inline void +avf_flow_convert_rss_types (u64 type, u64 *avf_rss_type) +{ +#define BIT_IS_SET(v, b) ((v) & (u64) 1 << (b)) + + *avf_rss_type = 0; + +#undef _ +#define _(n, f, s) \ + if (n != -1 && BIT_IS_SET (type, n)) \ + *avf_rss_type |= f; + + foreach_avf_rss_hf +#undef _ + return; +} + int avf_flow_vc_op_callback (void *vc_hdl, enum virthnl_adv_ops vc_op, void *in, u32 in_len, void *out, u32 out_len) @@ -281,6 +298,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) /* Handle generic flow first */ if (flow_class == FLOW_GENERIC_CLASS) { + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_RAW; avf_items[layer].is_generic = true; avf_items[layer].spec = f->generic.pattern.spec; avf_items[layer].mask = f->generic.pattern.mask; @@ -291,7 +309,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) } /* Ethernet Layer */ - avf_items[layer].type = VIRTCHNL_PROTO_HDR_ETH; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_ETH; avf_items[layer].spec = NULL; avf_items[layer].mask = NULL; layer++; @@ -301,7 +319,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) vnet_flow_ip4_t *ip4_ptr = &f->ip4; /* IPv4 Layer */ - avf_items[layer].type = VIRTCHNL_PROTO_HDR_IPV4; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_IPV4; avf_items[layer].spec = &ip4_spec; avf_items[layer].mask = &ip4_mask; layer++; @@ -340,7 +358,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) vnet_flow_ip6_t *ip6_ptr = &f->ip6; /* IPv6 Layer */ - avf_items[layer].type = VIRTCHNL_PROTO_HDR_IPV6; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_IPV6; avf_items[layer].spec = &ip6_spec; avf_items[layer].mask = &ip6_mask; layer++; @@ -385,7 +403,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) switch (protocol) { case IP_PROTOCOL_L2TP: - avf_items[layer].type = VIRTCHNL_PROTO_HDR_L2TPV3; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_L2TPV3OIP; avf_items[layer].spec = &l2tpv3_spec; avf_items[layer].mask = &l2tpv3_mask; layer++; @@ -396,7 +414,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) break; case IP_PROTOCOL_IPSEC_ESP: - avf_items[layer].type = VIRTCHNL_PROTO_HDR_ESP; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_ESP; avf_items[layer].spec = &esp_spec; avf_items[layer].mask = &esp_mask; layer++; @@ -407,7 +425,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) break; case IP_PROTOCOL_IPSEC_AH: - avf_items[layer].type = VIRTCHNL_PROTO_HDR_AH; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_AH; avf_items[layer].spec = &ah_spec; avf_items[layer].mask = &ah_mask; layer++; @@ -418,7 +436,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) break; case IP_PROTOCOL_TCP: - avf_items[layer].type = VIRTCHNL_PROTO_HDR_TCP; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_TCP; avf_items[layer].spec = &tcp_spec; avf_items[layer].mask = &tcp_mask; layer++; @@ -436,7 +454,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) break; case IP_PROTOCOL_UDP: - avf_items[layer].type = VIRTCHNL_PROTO_HDR_UDP; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_UDP; avf_items[layer].spec = &udp_spec; avf_items[layer].mask = &udp_mask; layer++; @@ -455,7 +473,7 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) /* handle the UDP tunnels */ if (f->type == VNET_FLOW_TYPE_IP4_GTPU) { - avf_items[layer].type = VIRTCHNL_PROTO_HDR_GTPU_IP; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_GTPU; avf_items[layer].spec = >p_spec; avf_items[layer].mask = >p_mask; layer++; @@ -473,25 +491,42 @@ avf_flow_add (u32 dev_instance, vnet_flow_t *f, avf_flow_entry_t *fe) pattern_end: /* pattern end flag */ - avf_items[layer].type = VIRTCHNL_PROTO_HDR_NONE; + avf_items[layer].type = AVF_FLOW_ITEM_TYPE_END; /* Action */ /* Only one 'fate' can be assigned */ - if (f->actions & VNET_FLOW_ACTION_REDIRECT_TO_QUEUE) + if (f->actions & VNET_FLOW_ACTION_RSS) { - avf_actions[action_count].type = VIRTCHNL_ACTION_QUEUE; - avf_actions[action_count].conf = &act_q; + is_fdir = false; + avf_actions[action_count].conf = &act_rss; + avf_actions[action_count].type = AVF_FLOW_ACTION_TYPE_RSS; + + avf_flow_convert_rss_types (f->rss_types, &act_rss.types); + + if ((act_rss.func = avf_flow_convert_rss_func (f->rss_fun)) == + AVF_ETH_HASH_FUNCTION_MAX) + { + rv = VNET_FLOW_ERROR_NOT_SUPPORTED; + goto done; + } + + if (f->queue_num) + { + /* convert rss queues to array */ + avf_flow_convert_rss_queues (f->queue_index, f->queue_num, &act_rss); + is_fdir = true; + } - act_q.index = f->redirect_queue; fate = true; action_count++; } - if (f->actions & VNET_FLOW_ACTION_DROP) + if (f->actions & VNET_FLOW_ACTION_REDIRECT_TO_QUEUE) { - avf_actions[action_count].type = VIRTCHNL_ACTION_DROP; - avf_actions[action_count].conf = NULL; + avf_actions[action_count].type = AVF_FLOW_ACTION_TYPE_QUEUE; + avf_actions[action_count].conf = &act_q; + act_q.index = f->redirect_queue; if (fate == true) { rv = VNET_FLOW_ERROR_INTERNAL; @@ -503,25 +538,10 @@ pattern_end: action_count++; } - if (f->actions & VNET_FLOW_ACTION_RSS) + if (f->actions & VNET_FLOW_ACTION_DROP) { - avf_actions[action_count].conf = &act_rss; - is_fdir = false; - - if ((act_rss.func = avf_flow_convert_rss_func (f->rss_fun)) == - AVF_ETH_HASH_FUNCTION_MAX) - { - rv = VNET_FLOW_ERROR_NOT_SUPPORTED; - goto done; - } - - if (f->queue_num) - { - /* convert rss queues to array */ - avf_flow_convert_rss_queues (f->queue_index, f->queue_num, &act_rss); - avf_actions[action_count].type = VIRTCHNL_ACTION_Q_REGION; - is_fdir = true; - } + avf_actions[action_count].type = AVF_FLOW_ACTION_TYPE_DROP; + avf_actions[action_count].conf = NULL; if (fate == true) { @@ -535,7 +555,7 @@ pattern_end: if (fate == false) { - avf_actions[action_count].type = VIRTCHNL_ACTION_PASSTHRU; + avf_actions[action_count].type = AVF_FLOW_ACTION_TYPE_PASSTHRU; avf_actions[action_count].conf = NULL; fate = true; @@ -544,7 +564,7 @@ pattern_end: if (f->actions & VNET_FLOW_ACTION_MARK) { - avf_actions[action_count].type = VIRTCHNL_ACTION_MARK; + avf_actions[action_count].type = AVF_FLOW_ACTION_TYPE_MARK; avf_actions[action_count].conf = &act_msk; action_count++; @@ -552,7 +572,7 @@ pattern_end: } /* action end flag */ - avf_actions[action_count].type = VIRTCHNL_ACTION_NONE; + avf_actions[action_count].type = AVF_FLOW_ACTION_TYPE_END; /* parse pattern and actions */ if (is_fdir) @@ -606,37 +626,15 @@ pattern_end: } else { - if (flow_class == FLOW_GENERIC_CLASS) - { - ret = avf_rss_parse_generic_pattern (rss_cfg, avf_items, &error); - if (ret) - { - avf_log_err (ad, "avf rss parse generic pattern failed: %s", - error.message); - rv = VNET_FLOW_ERROR_NOT_SUPPORTED; - goto done; - } - } - else - { - ret = avf_rss_parse_pattern (rss_cfg, avf_items, &error); - if (ret) - { - avf_log_warn (ad, - "avf rss is not supported except generic flow"); - rv = VNET_FLOW_ERROR_NOT_SUPPORTED; - goto done; - } - } - - ret = avf_rss_parse_action (avf_actions, rss_cfg, &error); + ret = + avf_rss_parse_pattern_action (avf_items, avf_actions, rss_cfg, &error); if (ret) { - avf_log_err (ad, "avf rss parse action failed: %s", error.message); + avf_log_err (ad, "avf rss parse pattern action failed: %s", + error.message); rv = VNET_FLOW_ERROR_NOT_SUPPORTED; goto done; } - /* create flow rule, save rule */ ret = avf_rss_rule_create (&vc_ctx, rss_cfg); |