#include <rte_debug.h>
#include <rte_ether.h>
-#include <rte_ethdev_driver.h>
+#include <ethdev_driver.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_eth_ctrl.h>
#include "iavf.h"
#include "iavf_generic_flow.h"
-enum iavf_pattern_hint_type {
- IAVF_PATTERN_HINT_NONE,
- IAVF_PATTERN_HINT_IPV4,
- IAVF_PATTERN_HINT_IPV4_UDP,
- IAVF_PATTERN_HINT_IPV4_TCP,
- IAVF_PATTERN_HINT_IPV4_SCTP,
- IAVF_PATTERN_HINT_IPV6,
- IAVF_PATTERN_HINT_IPV6_UDP,
- IAVF_PATTERN_HINT_IPV6_TCP,
- IAVF_PATTERN_HINT_IPV6_SCTP,
-};
-
-struct iavf_pattern_match_type {
- enum iavf_pattern_hint_type phint_type;
-};
+#define IAVF_PHINT_NONE 0
+#define IAVF_PHINT_GTPU BIT_ULL(0)
+#define IAVF_PHINT_GTPU_EH BIT_ULL(1)
+#define IAVF_PHINT_GTPU_EH_DWN BIT_ULL(2)
+#define IAVF_PHINT_GTPU_EH_UP BIT_ULL(3)
+#define IAVF_PHINT_OUTER_IPV4 BIT_ULL(4)
+#define IAVF_PHINT_OUTER_IPV6 BIT_ULL(5)
+#define IAVF_PHINT_GRE BIT_ULL(6)
+/* the second IP header of GTPoGRE */
+#define IAVF_PHINT_MID_IPV4 BIT_ULL(7)
+#define IAVF_PHINT_MID_IPV6 BIT_ULL(8)
+/* L2TPv2 */
+#define IAVF_PHINT_L2TPV2 BIT_ULL(9)
+#define IAVF_PHINT_L2TPV2_LEN BIT_ULL(10)
+
+#define IAVF_PHINT_GTPU_MSK (IAVF_PHINT_GTPU | \
+ IAVF_PHINT_GTPU_EH | \
+ IAVF_PHINT_GTPU_EH_DWN | \
+ IAVF_PHINT_GTPU_EH_UP)
+
+#define IAVF_PHINT_LAYERS_MSK (IAVF_PHINT_OUTER_IPV4 | \
+ IAVF_PHINT_OUTER_IPV6)
+
+#define IAVF_GTPU_EH_DWNLINK 0
+#define IAVF_GTPU_EH_UPLINK 1
struct iavf_hash_match_type {
- enum iavf_pattern_hint_type phint_type;
uint64_t hash_type;
struct virtchnl_proto_hdrs *proto_hdrs;
+ uint64_t pattern_hint;
};
struct iavf_rss_meta {
- struct virtchnl_proto_hdrs *proto_hdrs;
- uint32_t hash_function;
+ struct virtchnl_proto_hdrs proto_hdrs;
+ enum virtchnl_rss_algorithm rss_algorithm;
};
struct iavf_hash_flow_cfg {
void **meta,
struct rte_flow_error *error);
-struct iavf_pattern_match_type phint_empty = {
- IAVF_PATTERN_HINT_NONE};
-struct iavf_pattern_match_type phint_eth_ipv4 = {
- IAVF_PATTERN_HINT_IPV4};
-struct iavf_pattern_match_type phint_eth_ipv4_udp = {
- IAVF_PATTERN_HINT_IPV4_UDP};
-struct iavf_pattern_match_type phint_eth_ipv4_tcp = {
- IAVF_PATTERN_HINT_IPV4_TCP};
-struct iavf_pattern_match_type phint_eth_ipv4_sctp = {
- IAVF_PATTERN_HINT_IPV4_SCTP};
-struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh = {
- IAVF_PATTERN_HINT_IPV4_UDP};
-struct iavf_pattern_match_type phint_eth_ipv4_esp = {
- IAVF_PATTERN_HINT_IPV4};
-struct iavf_pattern_match_type phint_eth_ipv4_ah = {
- IAVF_PATTERN_HINT_IPV4};
-struct iavf_pattern_match_type phint_eth_ipv4_l2tpv3 = {
- IAVF_PATTERN_HINT_IPV4};
-struct iavf_pattern_match_type phint_eth_ipv4_pfcp = {
- IAVF_PATTERN_HINT_IPV4_UDP};
-struct iavf_pattern_match_type phint_eth_ipv6 = {
- IAVF_PATTERN_HINT_IPV6};
-struct iavf_pattern_match_type phint_eth_ipv6_udp = {
- IAVF_PATTERN_HINT_IPV6_UDP};
-struct iavf_pattern_match_type phint_eth_ipv6_tcp = {
- IAVF_PATTERN_HINT_IPV6_TCP};
-struct iavf_pattern_match_type phint_eth_ipv6_sctp = {
- IAVF_PATTERN_HINT_IPV6_SCTP};
-struct iavf_pattern_match_type phint_eth_ipv6_esp = {
- IAVF_PATTERN_HINT_IPV6};
-struct iavf_pattern_match_type phint_eth_ipv6_ah = {
- IAVF_PATTERN_HINT_IPV6};
-struct iavf_pattern_match_type phint_eth_ipv6_l2tpv3 = {
- IAVF_PATTERN_HINT_IPV6};
-struct iavf_pattern_match_type phint_eth_ipv6_pfcp = {
- IAVF_PATTERN_HINT_IPV6_UDP};
-
-/**
- * Supported pattern for hash.
- * The first member is pattern item type,
- * the second member is input set mask,
- * the third member is pattern hint for hash.
- */
-static struct iavf_pattern_match_item iavf_hash_pattern_list[] = {
- {iavf_pattern_eth_ipv4, IAVF_INSET_NONE, &phint_eth_ipv4},
- {iavf_pattern_eth_ipv4_udp, IAVF_INSET_NONE, &phint_eth_ipv4_udp},
- {iavf_pattern_eth_ipv4_tcp, IAVF_INSET_NONE, &phint_eth_ipv4_tcp},
- {iavf_pattern_eth_ipv4_sctp, IAVF_INSET_NONE, &phint_eth_ipv4_sctp},
- {iavf_pattern_eth_ipv6, IAVF_INSET_NONE, &phint_eth_ipv6},
- {iavf_pattern_eth_ipv4_gtpu_eh_ipv4, IAVF_INSET_NONE,
- &phint_eth_ipv4_gtpu_eh},
- {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp, IAVF_INSET_NONE,
- &phint_eth_ipv4_gtpu_eh},
- {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp, IAVF_INSET_NONE,
- &phint_eth_ipv4_gtpu_eh},
- {iavf_pattern_eth_ipv4_esp, IAVF_INSET_NONE, &phint_eth_ipv4_esp},
- {iavf_pattern_eth_ipv4_ah, IAVF_INSET_NONE, &phint_eth_ipv4_ah},
- {iavf_pattern_eth_ipv4_l2tpv3, IAVF_INSET_NONE,
- &phint_eth_ipv4_l2tpv3},
- {iavf_pattern_eth_ipv4_pfcp, IAVF_INSET_NONE, &phint_eth_ipv4_pfcp},
- {iavf_pattern_eth_ipv6_udp, IAVF_INSET_NONE, &phint_eth_ipv6_udp},
- {iavf_pattern_eth_ipv6_tcp, IAVF_INSET_NONE, &phint_eth_ipv6_tcp},
- {iavf_pattern_eth_ipv6_sctp, IAVF_INSET_NONE, &phint_eth_ipv6_sctp},
- {iavf_pattern_eth_ipv6_esp, IAVF_INSET_NONE, &phint_eth_ipv6_esp},
- {iavf_pattern_eth_ipv6_ah, IAVF_INSET_NONE, &phint_eth_ipv6_ah},
- {iavf_pattern_eth_ipv6_l2tpv3, IAVF_INSET_NONE,
- &phint_eth_ipv6_l2tpv3},
- {iavf_pattern_eth_ipv6_pfcp, IAVF_INSET_NONE, &phint_eth_ipv6_pfcp},
- {iavf_pattern_empty, IAVF_INSET_NONE, &phint_empty},
-};
-
-#define GTP_EH_PDU_LINK_UP 1
-#define GTP_EH_PDU_LINK_DWN 0
-
-#define TUNNEL_LEVEL_OUTER 0
-#define TUNNEL_LEVEL_FIRST_INNER 1
-
-#define PROTO_COUNT_ONE 1
-#define PROTO_COUNT_TWO 2
-#define PROTO_COUNT_THREE 3
-
+#define FIELD_SELECTOR(proto_hdr_field) \
+ (1UL << ((proto_hdr_field) & PROTO_HDR_FIELD_MASK))
#define BUFF_NOUSED 0
-#define FIELD_FOR_PROTO_ONLY 0
-
-#define proto_hint_eth_src { \
- VIRTCHNL_PROTO_HDR_ETH, VIRTCHNL_PROTO_HDR_ETH_SRC, {BUFF_NOUSED } }
-
-#define proto_hint_eth_dst { \
- VIRTCHNL_PROTO_HDR_ETH, VIRTCHNL_PROTO_HDR_ETH_DST, {BUFF_NOUSED } }
-
-#define proto_hint_eth_only { \
- VIRTCHNL_PROTO_HDR_ETH, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
-#define proto_hint_eth { \
+#define proto_hdr_eth { \
VIRTCHNL_PROTO_HDR_ETH, \
- VIRTCHNL_PROTO_HDR_ETH_SRC | VIRTCHNL_PROTO_HDR_ETH_DST, \
- {BUFF_NOUSED } }
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ETH_SRC) | \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ETH_DST), {BUFF_NOUSED} }
-#define proto_hint_svlan { \
- VIRTCHNL_PROTO_HDR_S_VLAN, VIRTCHNL_PROTO_HDR_S_VLAN_ID, \
- {BUFF_NOUSED } }
+#define proto_hdr_svlan { \
+ VIRTCHNL_PROTO_HDR_S_VLAN, \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_S_VLAN_ID), {BUFF_NOUSED} }
-#define proto_hint_cvlan { \
- VIRTCHNL_PROTO_HDR_C_VLAN, VIRTCHNL_PROTO_HDR_C_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_hint_ipv4_src { \
- VIRTCHNL_PROTO_HDR_IPV4, VIRTCHNL_PROTO_HDR_IPV4_SRC, {BUFF_NOUSED } }
-
-#define proto_hint_ipv4_dst { \
- VIRTCHNL_PROTO_HDR_IPV4, VIRTCHNL_PROTO_HDR_IPV4_DST, {BUFF_NOUSED } }
-
-#define proto_hint_ipv4_only { \
- VIRTCHNL_PROTO_HDR_IPV4, FIELD_FOR_PROTO_ONLY, {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_hint_ipv4 { \
+#define proto_hdr_ipv4_with_prot { \
VIRTCHNL_PROTO_HDR_IPV4, \
- VIRTCHNL_PROTO_HDR_IPV4_SRC | VIRTCHNL_PROTO_HDR_IPV4_DST, \
- {BUFF_NOUSED } }
+ 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_hint_udp_src_port { \
- VIRTCHNL_PROTO_HDR_UDP, VIRTCHNL_PROTO_HDR_UDP_SRC_PORT, \
- {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_hint_udp_dst_port { \
- VIRTCHNL_PROTO_HDR_UDP, VIRTCHNL_PROTO_HDR_UDP_DST_PORT, \
- {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_hint_udp_only { \
- VIRTCHNL_PROTO_HDR_UDP, FIELD_FOR_PROTO_ONLY, {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_hint_udp { \
+#define proto_hdr_udp { \
VIRTCHNL_PROTO_HDR_UDP, \
- VIRTCHNL_PROTO_HDR_UDP_SRC_PORT | VIRTCHNL_PROTO_HDR_UDP_DST_PORT, \
- {BUFF_NOUSED } }
-
-#define proto_hint_tcp_src_port { \
- VIRTCHNL_PROTO_HDR_TCP, VIRTCHNL_PROTO_HDR_TCP_SRC_PORT, \
- {BUFF_NOUSED } }
-
-#define proto_hint_tcp_dst_port { \
- VIRTCHNL_PROTO_HDR_TCP, VIRTCHNL_PROTO_HDR_TCP_DST_PORT, \
- {BUFF_NOUSED } }
-
-#define proto_hint_tcp_only { \
- VIRTCHNL_PROTO_HDR_TCP, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_SRC_PORT) | \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_UDP_DST_PORT), {BUFF_NOUSED} }
-#define proto_hint_tcp { \
+#define proto_hdr_tcp { \
VIRTCHNL_PROTO_HDR_TCP, \
- VIRTCHNL_PROTO_HDR_TCP_SRC_PORT | VIRTCHNL_PROTO_HDR_TCP_DST_PORT, \
- {BUFF_NOUSED } }
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_SRC_PORT) | \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_TCP_DST_PORT), {BUFF_NOUSED} }
-#define proto_hint_sctp_src_port { \
- VIRTCHNL_PROTO_HDR_SCTP, VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT, \
- {BUFF_NOUSED } }
-
-#define proto_hint_sctp_dst_port { \
- VIRTCHNL_PROTO_HDR_SCTP, VIRTCHNL_PROTO_HDR_SCTP_DST_PORT, \
- {BUFF_NOUSED } }
-
-#define proto_hint_sctp_only { \
- VIRTCHNL_PROTO_HDR_SCTP, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
-
-#define proto_hint_sctp { \
+#define proto_hdr_sctp { \
VIRTCHNL_PROTO_HDR_SCTP, \
- VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT | VIRTCHNL_PROTO_HDR_SCTP_DST_PORT, \
- {BUFF_NOUSED } }
-
-#define proto_hint_ipv6_src { \
- VIRTCHNL_PROTO_HDR_IPV6, VIRTCHNL_PROTO_HDR_IPV6_SRC, {BUFF_NOUSED } }
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_SRC_PORT) | \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_SCTP_DST_PORT), {BUFF_NOUSED} }
-#define proto_hint_ipv6_dst { \
- VIRTCHNL_PROTO_HDR_IPV6, VIRTCHNL_PROTO_HDR_IPV6_DST, {BUFF_NOUSED } }
-
-#define proto_hint_ipv6_only { \
- VIRTCHNL_PROTO_HDR_IPV6, FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
-
-#define proto_hint_ipv6 { \
- VIRTCHNL_PROTO_HDR_IPV6, \
- VIRTCHNL_PROTO_HDR_IPV6_SRC | VIRTCHNL_PROTO_HDR_IPV6_DST, \
- {BUFF_NOUSED } }
-
-#define proto_hint_gtpu_up_only { \
- VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_UP, \
- FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
-
-#define proto_hint_gtpu_dwn_only { \
- VIRTCHNL_PROTO_HDR_GTPU_EH_PDU_DWN, \
- FIELD_FOR_PROTO_ONLY, {BUFF_NOUSED } }
-
-#define proto_hint_esp { \
+#define proto_hdr_esp { \
VIRTCHNL_PROTO_HDR_ESP, \
- VIRTCHNL_PROTO_HDR_ESP_SPI, {BUFF_NOUSED } }
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ESP_SPI), {BUFF_NOUSED} }
-#define proto_hint_ah { \
+#define proto_hdr_ah { \
VIRTCHNL_PROTO_HDR_AH, \
- VIRTCHNL_PROTO_HDR_AH_SPI, {BUFF_NOUSED } }
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_AH_SPI), {BUFF_NOUSED} }
-#define proto_hint_l2tpv3 { \
+#define proto_hdr_l2tpv3 { \
VIRTCHNL_PROTO_HDR_L2TPV3, \
- VIRTCHNL_PROTO_HDR_L2TPV3_SESS_ID, {BUFF_NOUSED } }
-
-#define proto_hint_pfcp { \
- VIRTCHNL_PROTO_HDR_PFCP, VIRTCHNL_PROTO_HDR_PFCP_SEID, {BUFF_NOUSED } }
-
-struct virtchnl_proto_hdrs hdrs_hint_eth_src = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_eth_src }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_eth_dst = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_eth_dst }
-};
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_L2TPV3_SESS_ID), {BUFF_NOUSED} }
-struct virtchnl_proto_hdrs hdrs_hint_eth = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_eth }
-};
+#define proto_hdr_pfcp { \
+ VIRTCHNL_PROTO_HDR_PFCP, \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_PFCP_SEID), {BUFF_NOUSED} }
-struct virtchnl_proto_hdrs hdrs_hint_svlan = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_svlan }
-};
+#define proto_hdr_gtpc { \
+ VIRTCHNL_PROTO_HDR_GTPC, 0, {BUFF_NOUSED} }
-struct virtchnl_proto_hdrs hdrs_hint_cvlan = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_cvlan }
-};
+#define proto_hdr_ecpri { \
+ VIRTCHNL_PROTO_HDR_ECPRI, \
+ FIELD_SELECTOR(VIRTCHNL_PROTO_HDR_ECPRI_PC_RTC_ID), {BUFF_NOUSED} }
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_src = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv4_src }
-};
+#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} }
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv4_dst }
-};
+#define proto_hdr_ppp { \
+ VIRTCHNL_PROTO_HDR_PPP, 0, {BUFF_NOUSED} }
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_gtpu_up = {
- TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_up_only,
- proto_hint_ipv4_src }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_gtpu_dwn = {
- TUNNEL_LEVEL_FIRST_INNER, PROTO_COUNT_TWO, {proto_hint_gtpu_dwn_only,
- proto_hint_ipv4_dst }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_esp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_esp }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_ah = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_ah }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_l2tpv3 = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_l2tpv3 }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_pfcp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_pfcp }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4 = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv4 }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src,
- proto_hint_udp_src_port }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_src_udp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src,
- proto_hint_udp_dst_port }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst,
- proto_hint_udp_src_port }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_udp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst,
- proto_hint_udp_dst_port }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_udp_src_port }
-};
-
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_udp_dst_port }
-};
+#define TUNNEL_LEVEL_OUTER 0
+#define TUNNEL_LEVEL_INNER 1
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_udp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4,
- proto_hint_udp }
+/* 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 hdrs_hint_ipv4_src_tcp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src,
- proto_hint_tcp_src_port }
+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 hdrs_hint_ipv4_src_tcp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src,
- proto_hint_tcp_dst_port }
+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 hdrs_hint_ipv4_dst_tcp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst,
- proto_hint_tcp_src_port }
+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 hdrs_hint_ipv4_dst_tcp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst,
- proto_hint_tcp_dst_port }
+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 hdrs_hint_ipv4_tcp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_tcp_src_port }
+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 hdrs_hint_ipv4_tcp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_tcp_dst_port }
+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 hdrs_hint_ipv4_tcp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4,
- proto_hint_tcp }
+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 hdrs_hint_ipv4_src_sctp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src,
- proto_hint_sctp_src_port }
+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 hdrs_hint_ipv4_src_sctp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_src,
- proto_hint_sctp_dst_port }
+struct virtchnl_proto_hdrs inner_ipv4_tmplt = {
+ TUNNEL_LEVEL_INNER, 1, {proto_hdr_ipv4}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_sctp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst,
- proto_hint_sctp_src_port }
+struct virtchnl_proto_hdrs inner_ipv4_udp_tmplt = {
+ TUNNEL_LEVEL_INNER, 2, {proto_hdr_ipv4_with_prot, proto_hdr_udp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_dst_sctp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_dst,
- proto_hint_sctp_dst_port }
+struct virtchnl_proto_hdrs inner_ipv4_tcp_tmplt = {
+ TUNNEL_LEVEL_INNER, 2, {proto_hdr_ipv4_with_prot, proto_hdr_tcp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_sctp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_sctp_src_port }
+struct virtchnl_proto_hdrs second_inner_ipv4_tmplt = {
+ 2, 1, {proto_hdr_ipv4}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_sctp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4_only,
- proto_hint_sctp_dst_port }
+struct virtchnl_proto_hdrs second_inner_ipv4_udp_tmplt = {
+ 2, 2, {proto_hdr_ipv4_with_prot, proto_hdr_udp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv4_sctp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv4,
- proto_hint_sctp }
+struct virtchnl_proto_hdrs second_inner_ipv4_tcp_tmplt = {
+ 2, 2, {proto_hdr_ipv4_with_prot, proto_hdr_tcp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_src = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv6_src }
+struct virtchnl_proto_hdrs second_inner_ipv6_tmplt = {
+ 2, 1, {proto_hdr_ipv6}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv6_dst }
+struct virtchnl_proto_hdrs second_inner_ipv6_udp_tmplt = {
+ 2, 2, {proto_hdr_ipv6_with_prot, proto_hdr_udp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_esp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
- proto_hint_esp }
+struct virtchnl_proto_hdrs second_inner_ipv6_tcp_tmplt = {
+ 2, 2, {proto_hdr_ipv6_with_prot, proto_hdr_tcp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_ah = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
- proto_hint_ah }
+struct virtchnl_proto_hdrs inner_ipv4_sctp_tmplt = {
+ TUNNEL_LEVEL_INNER, 2, {proto_hdr_ipv4, proto_hdr_sctp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_l2tpv3 = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
- proto_hint_l2tpv3 }
+struct virtchnl_proto_hdrs inner_ipv6_tmplt = {
+ TUNNEL_LEVEL_INNER, 1, {proto_hdr_ipv6}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_pfcp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_only,
- proto_hint_pfcp }
+struct virtchnl_proto_hdrs inner_ipv6_udp_tmplt = {
+ TUNNEL_LEVEL_INNER, 2, {proto_hdr_ipv6_with_prot, proto_hdr_udp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6 = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_ONE, {proto_hint_ipv6 }
+struct virtchnl_proto_hdrs inner_ipv6_tcp_tmplt = {
+ TUNNEL_LEVEL_INNER, 2, {proto_hdr_ipv6_with_prot, proto_hdr_tcp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_udp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src,
- proto_hint_udp_src_port }
+struct virtchnl_proto_hdrs inner_ipv6_sctp_tmplt = {
+ TUNNEL_LEVEL_INNER, 2, {proto_hdr_ipv6, proto_hdr_sctp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_udp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src,
- proto_hint_udp_dst_port }
+struct virtchnl_proto_hdrs ipv4_esp_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv4, proto_hdr_esp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_udp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst,
- proto_hint_udp_src_port }
+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 hdrs_hint_ipv6_dst_udp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst,
- proto_hint_udp_dst_port }
+struct virtchnl_proto_hdrs ipv4_ah_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv4, proto_hdr_ah}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_udp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_udp_only,
- proto_hint_udp_src_port }
+struct virtchnl_proto_hdrs ipv6_esp_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv6, proto_hdr_esp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_udp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_udp_only,
- proto_hint_udp_dst_port }
+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 hdrs_hint_ipv6_udp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6,
- proto_hint_udp }
+struct virtchnl_proto_hdrs ipv6_ah_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv6, proto_hdr_ah}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_tcp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src,
- proto_hint_tcp_src_port }
+struct virtchnl_proto_hdrs ipv4_l2tpv3_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv4, proto_hdr_l2tpv3}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_tcp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src,
- proto_hint_tcp_dst_port }
+struct virtchnl_proto_hdrs ipv6_l2tpv3_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv6, proto_hdr_l2tpv3}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_tcp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst,
- proto_hint_tcp_src_port }
+struct virtchnl_proto_hdrs ipv4_pfcp_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv4, proto_hdr_pfcp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_dst_tcp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst,
- proto_hint_tcp_dst_port }
+struct virtchnl_proto_hdrs ipv6_pfcp_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_ipv6, proto_hdr_pfcp}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_tcp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_udp_only,
- proto_hint_tcp_src_port }
+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 hdrs_hint_ipv6_tcp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_udp_only,
- proto_hint_tcp_dst_port }
+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 hdrs_hint_ipv6_tcp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6,
- proto_hint_tcp }
+struct virtchnl_proto_hdrs eth_ecpri_tmplt = {
+ TUNNEL_LEVEL_OUTER, 2, {proto_hdr_eth, proto_hdr_ecpri}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_sctp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src,
- proto_hint_sctp_src_port }
+struct virtchnl_proto_hdrs ipv4_ecpri_tmplt = {
+ TUNNEL_LEVEL_OUTER, 3, {proto_hdr_ipv4, proto_hdr_udp, proto_hdr_ecpri}
};
-struct virtchnl_proto_hdrs hdrs_hint_ipv6_src_sctp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_src,
- proto_hint_sctp_dst_port }
+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 hdrs_hint_ipv6_dst_sctp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst,
- proto_hint_sctp_src_port }
+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 hdrs_hint_ipv6_dst_sctp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6_dst,
- proto_hint_sctp_dst_port }
+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 hdrs_hint_ipv6_sctp_src_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_udp_only,
- proto_hint_sctp_src_port }
+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 hdrs_hint_ipv6_sctp_dst_port = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_udp_only,
- proto_hint_sctp_dst_port }
+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 hdrs_hint_ipv6_sctp = {
- TUNNEL_LEVEL_OUTER, PROTO_COUNT_TWO, {proto_hint_ipv6,
- proto_hint_sctp }
-};
+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 */
+
+/* IPv4 outer */
+#define IAVF_RSS_TYPE_OUTER_IPV4 (RTE_ETH_RSS_ETH | RTE_ETH_RSS_IPV4 | \
+ RTE_ETH_RSS_FRAG_IPV4 | \
+ RTE_ETH_RSS_IPV4_CHKSUM)
+#define IAVF_RSS_TYPE_OUTER_IPV4_UDP (IAVF_RSS_TYPE_OUTER_IPV4 | \
+ RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
+ RTE_ETH_RSS_L4_CHKSUM)
+#define IAVF_RSS_TYPE_OUTER_IPV4_TCP (IAVF_RSS_TYPE_OUTER_IPV4 | \
+ RTE_ETH_RSS_NONFRAG_IPV4_TCP | \
+ RTE_ETH_RSS_L4_CHKSUM)
+#define IAVF_RSS_TYPE_OUTER_IPV4_SCTP (IAVF_RSS_TYPE_OUTER_IPV4 | \
+ RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \
+ RTE_ETH_RSS_L4_CHKSUM)
+/* IPv6 outer */
+#define IAVF_RSS_TYPE_OUTER_IPV6 (RTE_ETH_RSS_ETH | RTE_ETH_RSS_IPV6)
+#define IAVF_RSS_TYPE_OUTER_IPV6_FRAG (IAVF_RSS_TYPE_OUTER_IPV6 | \
+ RTE_ETH_RSS_FRAG_IPV6)
+#define IAVF_RSS_TYPE_OUTER_IPV6_UDP (IAVF_RSS_TYPE_OUTER_IPV6 | \
+ RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
+ RTE_ETH_RSS_L4_CHKSUM)
+#define IAVF_RSS_TYPE_OUTER_IPV6_TCP (IAVF_RSS_TYPE_OUTER_IPV6 | \
+ RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
+ RTE_ETH_RSS_L4_CHKSUM)
+#define IAVF_RSS_TYPE_OUTER_IPV6_SCTP (IAVF_RSS_TYPE_OUTER_IPV6 | \
+ RTE_ETH_RSS_NONFRAG_IPV6_SCTP | \
+ RTE_ETH_RSS_L4_CHKSUM)
+/* VLAN IPV4 */
+#define IAVF_RSS_TYPE_VLAN_IPV4 (IAVF_RSS_TYPE_OUTER_IPV4 | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+#define IAVF_RSS_TYPE_VLAN_IPV4_UDP (IAVF_RSS_TYPE_OUTER_IPV4_UDP | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+#define IAVF_RSS_TYPE_VLAN_IPV4_TCP (IAVF_RSS_TYPE_OUTER_IPV4_TCP | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+#define IAVF_RSS_TYPE_VLAN_IPV4_SCTP (IAVF_RSS_TYPE_OUTER_IPV4_SCTP | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+/* VLAN IPv6 */
+#define IAVF_RSS_TYPE_VLAN_IPV6 (IAVF_RSS_TYPE_OUTER_IPV6 | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+#define IAVF_RSS_TYPE_VLAN_IPV6_FRAG (IAVF_RSS_TYPE_OUTER_IPV6_FRAG | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+#define IAVF_RSS_TYPE_VLAN_IPV6_UDP (IAVF_RSS_TYPE_OUTER_IPV6_UDP | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+#define IAVF_RSS_TYPE_VLAN_IPV6_TCP (IAVF_RSS_TYPE_OUTER_IPV6_TCP | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+#define IAVF_RSS_TYPE_VLAN_IPV6_SCTP (IAVF_RSS_TYPE_OUTER_IPV6_SCTP | \
+ RTE_ETH_RSS_S_VLAN | RTE_ETH_RSS_C_VLAN)
+/* IPv4 inner */
+#define IAVF_RSS_TYPE_INNER_IPV4 RTE_ETH_RSS_IPV4
+#define IAVF_RSS_TYPE_INNER_IPV4_UDP (RTE_ETH_RSS_IPV4 | \
+ RTE_ETH_RSS_NONFRAG_IPV4_UDP)
+#define IAVF_RSS_TYPE_INNER_IPV4_TCP (RTE_ETH_RSS_IPV4 | \
+ RTE_ETH_RSS_NONFRAG_IPV4_TCP)
+#define IAVF_RSS_TYPE_INNER_IPV4_SCTP (RTE_ETH_RSS_IPV4 | \
+ RTE_ETH_RSS_NONFRAG_IPV4_SCTP)
+/* IPv6 inner */
+#define IAVF_RSS_TYPE_INNER_IPV6 RTE_ETH_RSS_IPV6
+#define IAVF_RSS_TYPE_INNER_IPV6_UDP (RTE_ETH_RSS_IPV6 | \
+ RTE_ETH_RSS_NONFRAG_IPV6_UDP)
+#define IAVF_RSS_TYPE_INNER_IPV6_TCP (RTE_ETH_RSS_IPV6 | \
+ RTE_ETH_RSS_NONFRAG_IPV6_TCP)
+#define IAVF_RSS_TYPE_INNER_IPV6_SCTP (RTE_ETH_RSS_IPV6 | \
+ RTE_ETH_RSS_NONFRAG_IPV6_SCTP)
+/* GTPU IPv4 */
+#define IAVF_RSS_TYPE_GTPU_IPV4 (IAVF_RSS_TYPE_INNER_IPV4 | \
+ RTE_ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV4_UDP (IAVF_RSS_TYPE_INNER_IPV4_UDP | \
+ RTE_ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV4_TCP (IAVF_RSS_TYPE_INNER_IPV4_TCP | \
+ RTE_ETH_RSS_GTPU)
+/* GTPU IPv6 */
+#define IAVF_RSS_TYPE_GTPU_IPV6 (IAVF_RSS_TYPE_INNER_IPV6 | \
+ RTE_ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV6_UDP (IAVF_RSS_TYPE_INNER_IPV6_UDP | \
+ RTE_ETH_RSS_GTPU)
+#define IAVF_RSS_TYPE_GTPU_IPV6_TCP (IAVF_RSS_TYPE_INNER_IPV6_TCP | \
+ RTE_ETH_RSS_GTPU)
+/* ESP, AH, L2TPV3 and PFCP */
+#define IAVF_RSS_TYPE_IPV4_ESP (RTE_ETH_RSS_ESP | RTE_ETH_RSS_IPV4)
+#define IAVF_RSS_TYPE_IPV4_AH (RTE_ETH_RSS_AH | RTE_ETH_RSS_IPV4)
+#define IAVF_RSS_TYPE_IPV6_ESP (RTE_ETH_RSS_ESP | RTE_ETH_RSS_IPV6)
+#define IAVF_RSS_TYPE_IPV6_AH (RTE_ETH_RSS_AH | RTE_ETH_RSS_IPV6)
+#define IAVF_RSS_TYPE_IPV4_L2TPV3 (RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_IPV4)
+#define IAVF_RSS_TYPE_IPV6_L2TPV3 (RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_IPV6)
+#define IAVF_RSS_TYPE_IPV4_PFCP (RTE_ETH_RSS_PFCP | RTE_ETH_RSS_IPV4)
+#define IAVF_RSS_TYPE_IPV6_PFCP (RTE_ETH_RSS_PFCP | RTE_ETH_RSS_IPV6)
+
+/* L2TPv2 */
+#define IAVF_RSS_TYPE_ETH_L2TPV2 (RTE_ETH_RSS_ETH | RTE_ETH_RSS_L2TPV2)
/**
- * The first member is pattern hint type,
- * the second member is hash type,
- * the third member is virtchnl protocol hdrs.
+ * Supported pattern for hash.
+ * The first member is pattern item type,
+ * the second member is input set mask,
+ * the third member is virtchnl_proto_hdrs template
*/
-struct iavf_hash_match_type iavf_hash_type_list[] = {
- /* IPV4 */
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_L2_SRC_ONLY, &hdrs_hint_eth_src},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_L2_DST_ONLY, &hdrs_hint_eth_dst},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_ETH, &hdrs_hint_eth},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_S_VLAN, &hdrs_hint_svlan},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_C_VLAN, &hdrs_hint_cvlan},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_L3_SRC_ONLY, &hdrs_hint_ipv4_src},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_L3_DST_ONLY, &hdrs_hint_ipv4_dst},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_ESP, &hdrs_hint_ipv4_esp},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_AH, &hdrs_hint_ipv4_ah},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_L2TPV3, &hdrs_hint_ipv4_l2tpv3},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_IPV4, &hdrs_hint_ipv4},
- /* IPV4 UDP */
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_src_udp_src_port},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_src_udp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_GTPU,
- &hdrs_hint_ipv4_src_gtpu_up},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L3_SRC_ONLY,
- &hdrs_hint_ipv4_src},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_dst_udp_src_port},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_dst_udp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L3_DST_ONLY | ETH_RSS_GTPU,
- &hdrs_hint_ipv4_dst_gtpu_dwn},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L3_DST_ONLY,
- &hdrs_hint_ipv4_dst},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_udp_src_port},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_udp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_PFCP,
- &hdrs_hint_ipv4_pfcp},
- {IAVF_PATTERN_HINT_IPV4_UDP, ETH_RSS_NONFRAG_IPV4_UDP,
- &hdrs_hint_ipv4_udp},
- /* IPV4 TCP */
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_src_tcp_src_port},
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_src_tcp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_L3_SRC_ONLY,
- &hdrs_hint_ipv4_src},
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_dst_tcp_src_port},
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_dst_tcp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_L3_DST_ONLY,
- &hdrs_hint_ipv4_dst},
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_tcp_src_port},
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_tcp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_TCP, ETH_RSS_NONFRAG_IPV4_TCP,
- &hdrs_hint_ipv4_tcp},
- /* IPV4 SCTP */
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_src_sctp_src_port},
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_src_sctp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_L3_SRC_ONLY,
- &hdrs_hint_ipv4_src},
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_dst_sctp_src_port},
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_dst_sctp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_L3_DST_ONLY,
- &hdrs_hint_ipv4_dst},
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv4_sctp_src_port},
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv4_sctp_dst_port},
- {IAVF_PATTERN_HINT_IPV4_SCTP, ETH_RSS_NONFRAG_IPV4_SCTP,
- &hdrs_hint_ipv4_sctp},
- /* IPV6 */
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_L2_SRC_ONLY, &hdrs_hint_eth_src},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_L2_DST_ONLY, &hdrs_hint_eth_dst},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_ETH, &hdrs_hint_eth},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_S_VLAN, &hdrs_hint_svlan},
- {IAVF_PATTERN_HINT_IPV4, ETH_RSS_C_VLAN, &hdrs_hint_cvlan},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_L3_SRC_ONLY, &hdrs_hint_ipv6_src},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_L3_DST_ONLY, &hdrs_hint_ipv6_dst},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_ESP, &hdrs_hint_ipv6_esp},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_AH, &hdrs_hint_ipv6_ah},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_L2TPV3, &hdrs_hint_ipv6_l2tpv3},
- {IAVF_PATTERN_HINT_IPV6, ETH_RSS_IPV6, &hdrs_hint_ipv6},
- /* IPV6 UDP */
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_src_udp_src_port},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_src_udp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_L3_SRC_ONLY,
- &hdrs_hint_ipv6_src},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_dst_udp_src_port},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_dst_udp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_L3_DST_ONLY,
- &hdrs_hint_ipv6_dst},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_udp_src_port},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_udp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_PFCP,
- &hdrs_hint_ipv6_pfcp},
- {IAVF_PATTERN_HINT_IPV6_UDP, ETH_RSS_NONFRAG_IPV6_UDP,
- &hdrs_hint_ipv6_udp},
- /* IPV6 TCP */
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_src_tcp_src_port},
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_src_tcp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_L3_SRC_ONLY,
- &hdrs_hint_ipv6_src},
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_dst_tcp_src_port},
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_dst_tcp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_L3_DST_ONLY,
- &hdrs_hint_ipv6_dst},
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_tcp_src_port},
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_tcp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_TCP, ETH_RSS_NONFRAG_IPV6_TCP,
- &hdrs_hint_ipv6_tcp},
- /* IPV6 SCTP */
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_src_sctp_src_port},
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_L3_SRC_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_src_sctp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_L3_SRC_ONLY,
- &hdrs_hint_ipv6_src},
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_dst_sctp_src_port},
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_L3_DST_ONLY | ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_dst_sctp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_L3_DST_ONLY,
- &hdrs_hint_ipv6_dst},
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_L4_SRC_ONLY,
- &hdrs_hint_ipv6_sctp_src_port},
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_L4_DST_ONLY,
- &hdrs_hint_ipv6_sctp_dst_port},
- {IAVF_PATTERN_HINT_IPV6_SCTP, ETH_RSS_NONFRAG_IPV6_SCTP,
- &hdrs_hint_ipv6_sctp},
+static struct iavf_pattern_match_item iavf_hash_pattern_list[] = {
+ /* IPv4 */
+ {iavf_pattern_eth_ipv4, IAVF_RSS_TYPE_OUTER_IPV4, &outer_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_udp, IAVF_RSS_TYPE_OUTER_IPV4_UDP, &outer_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_tcp, IAVF_RSS_TYPE_OUTER_IPV4_TCP, &outer_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_sctp, IAVF_RSS_TYPE_OUTER_IPV4_SCTP, &outer_ipv4_sctp_tmplt},
+ {iavf_pattern_eth_vlan_ipv4, IAVF_RSS_TYPE_VLAN_IPV4, &outer_ipv4_tmplt},
+ {iavf_pattern_eth_vlan_ipv4_udp, IAVF_RSS_TYPE_VLAN_IPV4_UDP, &outer_ipv4_udp_tmplt},
+ {iavf_pattern_eth_vlan_ipv4_tcp, IAVF_RSS_TYPE_VLAN_IPV4_TCP, &outer_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_vlan_ipv4_sctp, IAVF_RSS_TYPE_VLAN_IPV4_SCTP, &outer_ipv4_sctp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu, RTE_ETH_RSS_IPV4, &outer_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_eh_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_eh_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_eh_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_eh_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_eh_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &second_inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &second_inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &second_inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &second_inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &second_inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &second_inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &second_inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &second_inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &second_inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &second_inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &second_inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &second_inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &second_inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &second_inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &second_inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &second_inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &second_inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &second_inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &second_inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &second_inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &second_inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4, IAVF_RSS_TYPE_GTPU_IPV4, &second_inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4_udp, IAVF_RSS_TYPE_GTPU_IPV4_UDP, &second_inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv4_tcp, IAVF_RSS_TYPE_GTPU_IPV4_TCP, &second_inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_esp, IAVF_RSS_TYPE_IPV4_ESP, &ipv4_esp_tmplt},
+ {iavf_pattern_eth_ipv4_udp_esp, IAVF_RSS_TYPE_IPV4_ESP, &ipv4_udp_esp_tmplt},
+ {iavf_pattern_eth_ipv4_ah, IAVF_RSS_TYPE_IPV4_AH, &ipv4_ah_tmplt},
+ {iavf_pattern_eth_ipv4_l2tpv3, IAVF_RSS_TYPE_IPV4_L2TPV3, &ipv4_l2tpv3_tmplt},
+ {iavf_pattern_eth_ipv4_pfcp, IAVF_RSS_TYPE_IPV4_PFCP, &ipv4_pfcp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpc, RTE_ETH_RSS_IPV4, &ipv4_udp_gtpc_tmplt},
+ {iavf_pattern_eth_ecpri, RTE_ETH_RSS_ECPRI, ð_ecpri_tmplt},
+ {iavf_pattern_eth_ipv4_ecpri, RTE_ETH_RSS_ECPRI, &ipv4_ecpri_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4, IAVF_RSS_TYPE_INNER_IPV4, &inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4, IAVF_RSS_TYPE_INNER_IPV4, &inner_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_tcp, IAVF_RSS_TYPE_INNER_IPV4_TCP, &inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_tcp, IAVF_RSS_TYPE_INNER_IPV4_TCP, &inner_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_udp, IAVF_RSS_TYPE_INNER_IPV4_UDP, &inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_udp, IAVF_RSS_TYPE_INNER_IPV4_UDP, &inner_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2, IAVF_RSS_TYPE_ETH_L2TPV2, &ipv4_l2tpv2_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp, IAVF_RSS_TYPE_ETH_L2TPV2, &ipv4_l2tpv2_ppp_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4, IAVF_RSS_TYPE_INNER_IPV4, &udp_l2tpv2_ppp_ipv4_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_udp, IAVF_RSS_TYPE_INNER_IPV4_UDP, &udp_l2tpv2_ppp_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv4_tcp, IAVF_RSS_TYPE_INNER_IPV4_TCP, &udp_l2tpv2_ppp_ipv4_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4, IAVF_RSS_TYPE_INNER_IPV4, &udp_l2tpv2_ppp_ipv4_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4_udp, IAVF_RSS_TYPE_INNER_IPV4_UDP, &udp_l2tpv2_ppp_ipv4_udp_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv4_tcp, IAVF_RSS_TYPE_INNER_IPV4_TCP, &udp_l2tpv2_ppp_ipv4_tcp_tmplt},
+
+ /* IPv6 */
+ {iavf_pattern_eth_ipv6, IAVF_RSS_TYPE_OUTER_IPV6, &outer_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_frag_ext, IAVF_RSS_TYPE_OUTER_IPV6_FRAG, &outer_ipv6_frag_tmplt},
+ {iavf_pattern_eth_ipv6_udp, IAVF_RSS_TYPE_OUTER_IPV6_UDP, &outer_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_tcp, IAVF_RSS_TYPE_OUTER_IPV6_TCP, &outer_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_sctp, IAVF_RSS_TYPE_OUTER_IPV6_SCTP, &outer_ipv6_sctp_tmplt},
+ {iavf_pattern_eth_vlan_ipv6, IAVF_RSS_TYPE_VLAN_IPV6, &outer_ipv6_tmplt},
+ {iavf_pattern_eth_vlan_ipv6_frag_ext, IAVF_RSS_TYPE_OUTER_IPV6_FRAG, &outer_ipv6_frag_tmplt},
+ {iavf_pattern_eth_vlan_ipv6_udp, IAVF_RSS_TYPE_VLAN_IPV6_UDP, &outer_ipv6_udp_tmplt},
+ {iavf_pattern_eth_vlan_ipv6_tcp, IAVF_RSS_TYPE_VLAN_IPV6_TCP, &outer_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_vlan_ipv6_sctp, IAVF_RSS_TYPE_VLAN_IPV6_SCTP, &outer_ipv6_sctp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu, RTE_ETH_RSS_IPV6, &outer_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_eh_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_eh_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gtpu_eh_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_eh_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_eh_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpu_eh_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &second_inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &second_inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &second_inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &second_inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &second_inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &second_inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &second_inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &second_inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &second_inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &second_inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &second_inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &second_inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &second_inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &second_inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv4_gtpu_eh_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &second_inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &second_inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &second_inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_gtpu_eh_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &second_inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &second_inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &second_inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv4_gtpu_eh_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &second_inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6, IAVF_RSS_TYPE_GTPU_IPV6, &second_inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6_udp, IAVF_RSS_TYPE_GTPU_IPV6_UDP, &second_inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_gtpu_eh_ipv6_tcp, IAVF_RSS_TYPE_GTPU_IPV6_TCP, &second_inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_esp, IAVF_RSS_TYPE_IPV6_ESP, &ipv6_esp_tmplt},
+ {iavf_pattern_eth_ipv6_udp_esp, IAVF_RSS_TYPE_IPV6_ESP, &ipv6_udp_esp_tmplt},
+ {iavf_pattern_eth_ipv6_ah, IAVF_RSS_TYPE_IPV6_AH, &ipv6_ah_tmplt},
+ {iavf_pattern_eth_ipv6_l2tpv3, IAVF_RSS_TYPE_IPV6_L2TPV3, &ipv6_l2tpv3_tmplt},
+ {iavf_pattern_eth_ipv6_pfcp, IAVF_RSS_TYPE_IPV6_PFCP, &ipv6_pfcp_tmplt},
+ {iavf_pattern_eth_ipv6_gtpc, RTE_ETH_RSS_IPV6, &ipv6_udp_gtpc_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6, IAVF_RSS_TYPE_INNER_IPV6, &inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6, IAVF_RSS_TYPE_INNER_IPV6, &inner_ipv6_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_tcp, IAVF_RSS_TYPE_INNER_IPV6_TCP, &inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_tcp, IAVF_RSS_TYPE_INNER_IPV6_TCP, &inner_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv4_gre_ipv6_udp, IAVF_RSS_TYPE_INNER_IPV6_UDP, &inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_gre_ipv6_udp, IAVF_RSS_TYPE_INNER_IPV6_UDP, &inner_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2, IAVF_RSS_TYPE_ETH_L2TPV2, &ipv6_l2tpv2_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp, IAVF_RSS_TYPE_ETH_L2TPV2, &ipv6_l2tpv2_ppp_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6, IAVF_RSS_TYPE_INNER_IPV6, &udp_l2tpv2_ppp_ipv6_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_udp, IAVF_RSS_TYPE_INNER_IPV6_UDP, &udp_l2tpv2_ppp_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv4_udp_l2tpv2_ppp_ipv6_tcp, IAVF_RSS_TYPE_INNER_IPV6_TCP, &udp_l2tpv2_ppp_ipv6_tcp_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6, IAVF_RSS_TYPE_INNER_IPV6, &udp_l2tpv2_ppp_ipv6_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_udp, IAVF_RSS_TYPE_INNER_IPV6_UDP, &udp_l2tpv2_ppp_ipv6_udp_tmplt},
+ {iavf_pattern_eth_ipv6_udp_l2tpv2_ppp_ipv6_tcp, IAVF_RSS_TYPE_INNER_IPV6_TCP, &udp_l2tpv2_ppp_ipv6_tcp_tmplt},
+
};
static struct iavf_flow_engine iavf_hash_engine = {
.stage = IAVF_FLOW_STAGE_RSS,
};
+int
+iavf_rss_hash_set(struct iavf_adapter *ad, uint64_t rss_hf, bool add)
+{
+ struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
+ struct virtchnl_rss_cfg rss_cfg;
+
+#define IAVF_RSS_HF_ALL ( \
+ RTE_ETH_RSS_IPV4 | \
+ RTE_ETH_RSS_IPV6 | \
+ RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
+ RTE_ETH_RSS_NONFRAG_IPV4_TCP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
+ RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_SCTP)
+
+ rss_cfg.rss_algorithm = VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+ if (rss_hf & RTE_ETH_RSS_IPV4) {
+ rss_cfg.proto_hdrs = inner_ipv4_tmplt;
+ iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+ }
+
+ if (rss_hf & RTE_ETH_RSS_NONFRAG_IPV4_UDP) {
+ rss_cfg.proto_hdrs = inner_ipv4_udp_tmplt;
+ iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+ }
+
+ if (rss_hf & RTE_ETH_RSS_NONFRAG_IPV4_TCP) {
+ rss_cfg.proto_hdrs = inner_ipv4_tcp_tmplt;
+ iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+ }
+
+ if (rss_hf & RTE_ETH_RSS_NONFRAG_IPV4_SCTP) {
+ rss_cfg.proto_hdrs = inner_ipv4_sctp_tmplt;
+ iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+ }
+
+ if (rss_hf & RTE_ETH_RSS_IPV6) {
+ rss_cfg.proto_hdrs = inner_ipv6_tmplt;
+ iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+ }
+
+ if (rss_hf & RTE_ETH_RSS_NONFRAG_IPV6_UDP) {
+ rss_cfg.proto_hdrs = inner_ipv6_udp_tmplt;
+ iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+ }
+
+ if (rss_hf & RTE_ETH_RSS_NONFRAG_IPV6_TCP) {
+ rss_cfg.proto_hdrs = inner_ipv6_tcp_tmplt;
+ iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+ }
+
+ if (rss_hf & RTE_ETH_RSS_NONFRAG_IPV6_SCTP) {
+ rss_cfg.proto_hdrs = inner_ipv6_sctp_tmplt;
+ iavf_add_del_rss_cfg(ad, &rss_cfg, add);
+ }
+
+ vf->rss_hf = rss_hf & IAVF_RSS_HF_ALL;
+ return 0;
+}
+
RTE_INIT(iavf_hash_engine_init)
{
struct iavf_flow_engine *engine = &iavf_hash_engine;
{
struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
struct iavf_flow_parser *parser;
+ int ret;
+
+ if (vf->vf_reset)
+ return -EIO;
if (!vf->vf_res)
return -EINVAL;
parser = &iavf_hash_parser;
- return iavf_register_parser(parser, ad);
+ ret = iavf_register_parser(parser, ad);
+ if (ret) {
+ PMD_DRV_LOG(ERR, "fail to register hash parser");
+ return ret;
+ }
+
+ return ret;
}
static int
-iavf_hash_check_inset(const struct rte_flow_item pattern[],
- struct rte_flow_error *error)
+iavf_hash_parse_pattern(const struct rte_flow_item pattern[], uint64_t *phint,
+ struct rte_flow_error *error)
{
const struct rte_flow_item *item = pattern;
+ const struct rte_flow_item_gtp_psc *psc;
+ const struct rte_flow_item_ecpri *ecpri;
+ struct rte_ecpri_common_hdr ecpri_common;
+ const struct rte_flow_item_l2tpv2 *l2tpv2;
+ uint16_t flags_version;
for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
if (item->last) {
"Not support range");
return -rte_errno;
}
+
+ switch (item->type) {
+ case RTE_FLOW_ITEM_TYPE_IPV4:
+ if (!(*phint & IAVF_PHINT_GTPU_MSK) &&
+ !(*phint & IAVF_PHINT_GRE) &&
+ !(*phint & IAVF_PHINT_L2TPV2))
+ *phint |= IAVF_PHINT_OUTER_IPV4;
+ if ((*phint & IAVF_PHINT_GRE) && !(*phint & IAVF_PHINT_GTPU_MSK))
+ *phint |= IAVF_PHINT_MID_IPV4;
+ break;
+ case RTE_FLOW_ITEM_TYPE_IPV6:
+ if (!(*phint & IAVF_PHINT_GTPU_MSK) &&
+ !(*phint & IAVF_PHINT_GRE) &&
+ !(*phint & IAVF_PHINT_L2TPV2))
+ *phint |= IAVF_PHINT_OUTER_IPV6;
+ if ((*phint & IAVF_PHINT_GRE) && !(*phint & IAVF_PHINT_GTPU_MSK))
+ *phint |= IAVF_PHINT_MID_IPV6;
+ break;
+ case RTE_FLOW_ITEM_TYPE_GTPU:
+ *phint |= IAVF_PHINT_GTPU;
+ break;
+ case RTE_FLOW_ITEM_TYPE_GTP_PSC:
+ *phint |= IAVF_PHINT_GTPU_EH;
+ psc = item->spec;
+ if (!psc)
+ break;
+ else if (psc->hdr.type == IAVF_GTPU_EH_UPLINK)
+ *phint |= IAVF_PHINT_GTPU_EH_UP;
+ else if (psc->hdr.type == IAVF_GTPU_EH_DWNLINK)
+ *phint |= IAVF_PHINT_GTPU_EH_DWN;
+ break;
+ case RTE_FLOW_ITEM_TYPE_ECPRI:
+ ecpri = item->spec;
+ if (!ecpri)
+ break;
+
+ ecpri_common.u32 = rte_be_to_cpu_32(ecpri->hdr.common.u32);
+
+ if (ecpri_common.type !=
+ RTE_ECPRI_MSG_TYPE_IQ_DATA) {
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ITEM, item,
+ "Unsupported common type.");
+ return -rte_errno;
+ }
+ break;
+ case RTE_FLOW_ITEM_TYPE_GRE:
+ *phint |= IAVF_PHINT_GRE;
+ break;
+ case RTE_FLOW_ITEM_TYPE_L2TPV2:
+ l2tpv2 = item->spec;
+
+ if (l2tpv2) {
+ flags_version =
+ rte_be_to_cpu_16(l2tpv2->hdr.common.flags_version);
+ if (flags_version & IAVF_L2TPV2_FLAGS_LEN)
+ *phint |= IAVF_PHINT_L2TPV2_LEN;
+ else
+ *phint |= IAVF_PHINT_L2TPV2;
+ } else {
+ *phint |= IAVF_PHINT_L2TPV2;
+ }
+ break;
+ default:
+ break;
+ }
}
return 0;
}
-static uint64_t
-iavf_hash_refine_type(uint64_t rss_type, const struct rte_flow_item pattern[])
+#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)
+
+static void
+iavf_hash_add_fragment_hdr(struct virtchnl_proto_hdrs *hdrs, int layer)
{
- const struct rte_flow_item *item;
+ struct virtchnl_proto_hdr *hdr1;
+ struct virtchnl_proto_hdr *hdr2;
+ int i;
+
+ if (layer < 0 || layer > hdrs->count)
+ return;
+
+ /* shift headers layer */
+ for (i = hdrs->count; i >= layer; i--) {
+ hdr1 = &hdrs->proto_hdr[i];
+ hdr2 = &hdrs->proto_hdr[i - 1];
+ *hdr1 = *hdr2;
+ }
- for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
- if (item->type == RTE_FLOW_ITEM_TYPE_GTP_PSC) {
- const struct rte_flow_item_gtp_psc *psc = item->spec;
+ /* adding dummy fragment header */
+ hdr1 = &hdrs->proto_hdr[layer];
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, IPV4_FRAG);
+ hdrs->count = ++layer;
+}
- if (psc && (psc->pdu_type == GTP_EH_PDU_LINK_UP ||
- psc->pdu_type == GTP_EH_PDU_LINK_DWN)) {
- rss_type |= ETH_RSS_GTPU;
+/* refine proto hdrs base on l2, l3, l4 rss type */
+static void
+iavf_refine_proto_hdrs_l234(struct virtchnl_proto_hdrs *proto_hdrs,
+ uint64_t rss_type)
+{
+ struct virtchnl_proto_hdr *hdr;
+ int i;
+
+ for (i = 0; i < proto_hdrs->count; i++) {
+ hdr = &proto_hdrs->proto_hdr[i];
+ switch (hdr->type) {
+ case VIRTCHNL_PROTO_HDR_ETH:
+ if (!(rss_type & RTE_ETH_RSS_ETH))
+ hdr->field_selector = 0;
+ else if (rss_type & RTE_ETH_RSS_L2_SRC_ONLY)
+ REFINE_PROTO_FLD(DEL, ETH_DST);
+ else if (rss_type & RTE_ETH_RSS_L2_DST_ONLY)
+ REFINE_PROTO_FLD(DEL, ETH_SRC);
+ break;
+ case VIRTCHNL_PROTO_HDR_IPV4:
+ if (rss_type &
+ (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 |
+ RTE_ETH_RSS_NONFRAG_IPV4_UDP |
+ RTE_ETH_RSS_NONFRAG_IPV4_TCP |
+ RTE_ETH_RSS_NONFRAG_IPV4_SCTP)) {
+ if (rss_type & RTE_ETH_RSS_FRAG_IPV4) {
+ iavf_hash_add_fragment_hdr(proto_hdrs, i + 1);
+ } else if (rss_type & RTE_ETH_RSS_L3_SRC_ONLY) {
+ REFINE_PROTO_FLD(DEL, IPV4_DST);
+ } else if (rss_type & RTE_ETH_RSS_L3_DST_ONLY) {
+ REFINE_PROTO_FLD(DEL, IPV4_SRC);
+ } else if (rss_type &
+ (RTE_ETH_RSS_L4_SRC_ONLY |
+ RTE_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 & RTE_ETH_RSS_IPV4_CHKSUM)
+ REFINE_PROTO_FLD(ADD, IPV4_CHKSUM);
+
+ break;
+ case VIRTCHNL_PROTO_HDR_IPV4_FRAG:
+ if (rss_type &
+ (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 |
+ RTE_ETH_RSS_NONFRAG_IPV4_UDP |
+ RTE_ETH_RSS_NONFRAG_IPV4_TCP |
+ RTE_ETH_RSS_NONFRAG_IPV4_SCTP)) {
+ if (rss_type & RTE_ETH_RSS_FRAG_IPV4)
+ REFINE_PROTO_FLD(ADD, IPV4_FRAG_PKID);
+ } else {
+ hdr->field_selector = 0;
+ }
+
+ if (rss_type & RTE_ETH_RSS_IPV4_CHKSUM)
+ REFINE_PROTO_FLD(ADD, IPV4_CHKSUM);
+
+ break;
+ case VIRTCHNL_PROTO_HDR_IPV6:
+ if (rss_type &
+ (RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 |
+ RTE_ETH_RSS_NONFRAG_IPV6_UDP |
+ RTE_ETH_RSS_NONFRAG_IPV6_TCP |
+ RTE_ETH_RSS_NONFRAG_IPV6_SCTP)) {
+ if (rss_type & RTE_ETH_RSS_L3_SRC_ONLY) {
+ REFINE_PROTO_FLD(DEL, IPV6_DST);
+ } else if (rss_type & RTE_ETH_RSS_L3_DST_ONLY) {
+ REFINE_PROTO_FLD(DEL, IPV6_SRC);
+ } else if (rss_type &
+ (RTE_ETH_RSS_L4_SRC_ONLY |
+ RTE_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 & RTE_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 & RTE_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 &
+ (RTE_ETH_RSS_NONFRAG_IPV4_UDP |
+ RTE_ETH_RSS_NONFRAG_IPV6_UDP)) {
+ if (rss_type & RTE_ETH_RSS_L4_SRC_ONLY)
+ REFINE_PROTO_FLD(DEL, UDP_DST_PORT);
+ else if (rss_type & RTE_ETH_RSS_L4_DST_ONLY)
+ REFINE_PROTO_FLD(DEL, UDP_SRC_PORT);
+ else if (rss_type &
+ (RTE_ETH_RSS_L3_SRC_ONLY |
+ RTE_ETH_RSS_L3_DST_ONLY))
+ hdr->field_selector = 0;
+ } else {
+ hdr->field_selector = 0;
+ }
+
+ if (rss_type & RTE_ETH_RSS_L4_CHKSUM)
+ REFINE_PROTO_FLD(ADD, UDP_CHKSUM);
+ break;
+ case VIRTCHNL_PROTO_HDR_TCP:
+ if (rss_type &
+ (RTE_ETH_RSS_NONFRAG_IPV4_TCP |
+ RTE_ETH_RSS_NONFRAG_IPV6_TCP)) {
+ if (rss_type & RTE_ETH_RSS_L4_SRC_ONLY)
+ REFINE_PROTO_FLD(DEL, TCP_DST_PORT);
+ else if (rss_type & RTE_ETH_RSS_L4_DST_ONLY)
+ REFINE_PROTO_FLD(DEL, TCP_SRC_PORT);
+ else if (rss_type &
+ (RTE_ETH_RSS_L3_SRC_ONLY |
+ RTE_ETH_RSS_L3_DST_ONLY))
+ hdr->field_selector = 0;
+ } else {
+ hdr->field_selector = 0;
+ }
+
+ if (rss_type & RTE_ETH_RSS_L4_CHKSUM)
+ REFINE_PROTO_FLD(ADD, TCP_CHKSUM);
+ break;
+ case VIRTCHNL_PROTO_HDR_SCTP:
+ if (rss_type &
+ (RTE_ETH_RSS_NONFRAG_IPV4_SCTP |
+ RTE_ETH_RSS_NONFRAG_IPV6_SCTP)) {
+ if (rss_type & RTE_ETH_RSS_L4_SRC_ONLY)
+ REFINE_PROTO_FLD(DEL, SCTP_DST_PORT);
+ else if (rss_type & RTE_ETH_RSS_L4_DST_ONLY)
+ REFINE_PROTO_FLD(DEL, SCTP_SRC_PORT);
+ else if (rss_type &
+ (RTE_ETH_RSS_L3_SRC_ONLY |
+ RTE_ETH_RSS_L3_DST_ONLY))
+ hdr->field_selector = 0;
+ } else {
+ hdr->field_selector = 0;
+ }
+
+ if (rss_type & RTE_ETH_RSS_L4_CHKSUM)
+ REFINE_PROTO_FLD(ADD, SCTP_CHKSUM);
+ break;
+ case VIRTCHNL_PROTO_HDR_S_VLAN:
+ if (!(rss_type & RTE_ETH_RSS_S_VLAN))
+ hdr->field_selector = 0;
+ break;
+ case VIRTCHNL_PROTO_HDR_C_VLAN:
+ if (!(rss_type & RTE_ETH_RSS_C_VLAN))
+ hdr->field_selector = 0;
+ break;
+ case VIRTCHNL_PROTO_HDR_L2TPV3:
+ if (!(rss_type & RTE_ETH_RSS_L2TPV3))
+ hdr->field_selector = 0;
+ break;
+ case VIRTCHNL_PROTO_HDR_ESP:
+ if (!(rss_type & RTE_ETH_RSS_ESP))
+ hdr->field_selector = 0;
+ break;
+ case VIRTCHNL_PROTO_HDR_AH:
+ if (!(rss_type & RTE_ETH_RSS_AH))
+ hdr->field_selector = 0;
+ break;
+ case VIRTCHNL_PROTO_HDR_PFCP:
+ if (!(rss_type & RTE_ETH_RSS_PFCP))
+ hdr->field_selector = 0;
+ break;
+ case VIRTCHNL_PROTO_HDR_ECPRI:
+ if (!(rss_type & RTE_ETH_RSS_ECPRI))
+ hdr->field_selector = 0;
+ break;
+ case VIRTCHNL_PROTO_HDR_L2TPV2:
+ if (!(rss_type & RTE_ETH_RSS_L2TPV2))
+ hdr->field_selector = 0;
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+/* refine proto hdrs base on gtpu rss type */
+static void
+iavf_refine_proto_hdrs_gtpu(struct virtchnl_proto_hdrs *proto_hdrs,
+ uint64_t rss_type)
+{
+ struct virtchnl_proto_hdr *hdr;
+ int i;
+
+ if (!(rss_type & RTE_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
+iavf_refine_proto_hdrs_by_pattern(struct virtchnl_proto_hdrs *proto_hdrs,
+ uint64_t 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 & IAVF_PHINT_GTPU_MSK) && !(phint & IAVF_PHINT_GRE))
+ return;
+
+ while (tun_lvl) {
+ if (phint & IAVF_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 & IAVF_PHINT_OUTER_IPV4)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr2, IPV4);
+ else if (phint & IAVF_PHINT_OUTER_IPV6)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr2, IPV6);
+ } else if (tun_lvl == TUNNEL_LEVEL_INNER) {
+ if (phint & IAVF_PHINT_MID_IPV4)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr2, IPV4);
+ else if (phint & IAVF_PHINT_MID_IPV6)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr2, IPV6);
+ }
+ }
+
+ hdr1->field_selector = 0;
+ proto_hdrs->count++;
+
+ if (phint & IAVF_PHINT_GTPU_EH_DWN)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, GTPU_EH_PDU_DWN);
+ else if (phint & IAVF_PHINT_GTPU_EH_UP)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, GTPU_EH_PDU_UP);
+ else if (phint & IAVF_PHINT_GTPU_EH)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, GTPU_EH);
+ else if (phint & IAVF_PHINT_GTPU)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, GTPU_IP);
+
+ if (phint & IAVF_PHINT_GRE) {
+ if (phint & IAVF_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);
+ }
+ }
+ }
+ proto_hdrs->tunnel_level = tun_lvl;
+}
+
+static void
+iavf_refine_proto_hdrs_l2tpv2(struct virtchnl_proto_hdrs *proto_hdrs,
+ uint64_t phint)
+{
+ struct virtchnl_proto_hdr *hdr, *hdr1;
+ int i;
+
+ if (!(phint & IAVF_PHINT_L2TPV2) && !(phint & IAVF_PHINT_L2TPV2_LEN))
+ return;
+
+ if (proto_hdrs->tunnel_level == TUNNEL_LEVEL_INNER) {
+ /* shift headers layer */
+ for (i = proto_hdrs->count - 1 + 1; i > 0; i--)
+ proto_hdrs->proto_hdr[i] = proto_hdrs->proto_hdr[i - 1];
+
+ /* adding outer ip header at layer 0 */
+ hdr1 = &proto_hdrs->proto_hdr[0];
+ hdr1->field_selector = 0;
+ proto_hdrs->count++;
+ proto_hdrs->tunnel_level = TUNNEL_LEVEL_OUTER;
+ if (phint & IAVF_PHINT_OUTER_IPV4)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, IPV4);
+ else if (phint & IAVF_PHINT_OUTER_IPV6)
+ VIRTCHNL_SET_PROTO_HDR_TYPE(hdr1, IPV6);
+ } else {
+ for (i = 0; i < proto_hdrs->count; i++) {
+ hdr = &proto_hdrs->proto_hdr[i];
+ if (hdr->type == VIRTCHNL_PROTO_HDR_L2TPV2) {
+ if (phint & IAVF_PHINT_L2TPV2) {
+ REFINE_PROTO_FLD(DEL, L2TPV2_LEN_SESS_ID);
+ } else if (phint & IAVF_PHINT_L2TPV2_LEN) {
+ REFINE_PROTO_FLD(DEL, L2TPV2_SESS_ID);
+ }
}
}
}
- return rss_type;
+}
+
+static void iavf_refine_proto_hdrs(struct virtchnl_proto_hdrs *proto_hdrs,
+ uint64_t rss_type, uint64_t phint)
+{
+ iavf_refine_proto_hdrs_l234(proto_hdrs, rss_type);
+ iavf_refine_proto_hdrs_by_pattern(proto_hdrs, phint);
+ iavf_refine_proto_hdrs_gtpu(proto_hdrs, rss_type);
+ iavf_refine_proto_hdrs_l2tpv2(proto_hdrs, phint);
+}
+
+static uint64_t invalid_rss_comb[] = {
+ RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_UDP,
+ RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_TCP,
+ RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_NONFRAG_IPV6_UDP,
+ RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_NONFRAG_IPV6_TCP,
+ RTE_ETH_RSS_L3_PRE32 | RTE_ETH_RSS_L3_PRE40 |
+ RTE_ETH_RSS_L3_PRE48 | RTE_ETH_RSS_L3_PRE56 |
+ RTE_ETH_RSS_L3_PRE96
+};
+
+struct rss_attr_type {
+ uint64_t attr;
+ uint64_t type;
+};
+
+#define VALID_RSS_IPV4_L4 (RTE_ETH_RSS_NONFRAG_IPV4_UDP | \
+ RTE_ETH_RSS_NONFRAG_IPV4_TCP | \
+ RTE_ETH_RSS_NONFRAG_IPV4_SCTP)
+
+#define VALID_RSS_IPV6_L4 (RTE_ETH_RSS_NONFRAG_IPV6_UDP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_TCP | \
+ RTE_ETH_RSS_NONFRAG_IPV6_SCTP)
+
+#define VALID_RSS_IPV4 (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | \
+ VALID_RSS_IPV4_L4)
+#define VALID_RSS_IPV6 (RTE_ETH_RSS_IPV6 | RTE_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 (RTE_ETH_RSS_L3_SRC_ONLY | \
+ RTE_ETH_RSS_L3_DST_ONLY | \
+ RTE_ETH_RSS_L4_SRC_ONLY | \
+ RTE_ETH_RSS_L4_DST_ONLY | \
+ RTE_ETH_RSS_L2_SRC_ONLY | \
+ RTE_ETH_RSS_L2_DST_ONLY | \
+ RTE_ETH_RSS_L3_PRE64)
+
+#define INVALID_RSS_ATTR (RTE_ETH_RSS_L3_PRE32 | \
+ RTE_ETH_RSS_L3_PRE40 | \
+ RTE_ETH_RSS_L3_PRE48 | \
+ RTE_ETH_RSS_L3_PRE56 | \
+ RTE_ETH_RSS_L3_PRE96)
+
+static struct rss_attr_type rss_attr_to_valid_type[] = {
+ {RTE_ETH_RSS_L2_SRC_ONLY | RTE_ETH_RSS_L2_DST_ONLY, RTE_ETH_RSS_ETH},
+ {RTE_ETH_RSS_L3_SRC_ONLY | RTE_ETH_RSS_L3_DST_ONLY, VALID_RSS_L3},
+ {RTE_ETH_RSS_L4_SRC_ONLY | RTE_ETH_RSS_L4_DST_ONLY, VALID_RSS_L4},
+ /* current ipv6 prefix only supports prefix 64 bits*/
+ {RTE_ETH_RSS_L3_PRE64, VALID_RSS_IPV6},
+ {INVALID_RSS_ATTR, 0}
+};
+
+static bool
+iavf_any_invalid_rss_type(enum rte_eth_hash_function rss_func,
+ uint64_t rss_type, uint64_t allow_rss_type)
+{
+ uint32_t i;
+
+ /**
+ * Check if l3/l4 SRC/DST_ONLY is set for SYMMETRIC_TOEPLITZ
+ * hash function.
+ */
+ if (rss_func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+ if (rss_type & (RTE_ETH_RSS_L3_SRC_ONLY | RTE_ETH_RSS_L3_DST_ONLY |
+ RTE_ETH_RSS_L4_SRC_ONLY | RTE_ETH_RSS_L4_DST_ONLY))
+ return true;
+
+ if (!(rss_type &
+ (RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_IPV6 |
+ RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_NONFRAG_IPV6_UDP |
+ RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_NONFRAG_IPV6_TCP |
+ RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_NONFRAG_IPV6_SCTP)))
+ return true;
+ }
+
+ /* check invalid combination */
+ for (i = 0; i < RTE_DIM(invalid_rss_comb); i++) {
+ if (__builtin_popcountll(rss_type & invalid_rss_comb[i]) > 1)
+ return true;
+ }
+
+ /* check invalid RSS attribute */
+ for (i = 0; i < RTE_DIM(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 true;
+ }
+
+ /* check not allowed RSS type */
+ rss_type &= ~VALID_RSS_ATTR;
+
+ return ((rss_type & allow_rss_type) != rss_type);
}
static int
-iavf_hash_parse_action(struct iavf_pattern_match_item *pattern_match_item,
- const struct rte_flow_item pattern[],
+iavf_hash_parse_action(struct iavf_pattern_match_item *match_item,
const struct rte_flow_action actions[],
- void **meta, struct rte_flow_error *error)
+ uint64_t pattern_hint, struct iavf_rss_meta *rss_meta,
+ struct rte_flow_error *error)
{
- struct iavf_rss_meta *rss_meta = (struct iavf_rss_meta *)*meta;
- uint32_t type_list_len = RTE_DIM(iavf_hash_type_list);
- struct iavf_hash_match_type *type_match_item;
+ struct virtchnl_proto_hdrs *proto_hdrs;
enum rte_flow_action_type action_type;
const struct rte_flow_action_rss *rss;
const struct rte_flow_action *action;
- bool item_found = false;
uint64_t rss_type;
- uint16_t i;
-
- struct iavf_pattern_match_type *tt = (struct iavf_pattern_match_type *)
- (pattern_match_item->meta);
/* Supported action is RSS. */
for (action = actions; action->type !=
rss = action->conf;
rss_type = rss->types;
- /**
- * Check simultaneous use of SRC_ONLY and DST_ONLY
- * of the same level.
- */
- rss_type = rte_eth_rss_hf_refine(rss_type);
-
- /**
- * Refine the hash type base on some specific item of
- * the pattern, such as identify the gtpu hash.
- */
- rss_type = iavf_hash_refine_type(rss_type, pattern);
-
- /* Check if pattern is empty. */
- if (pattern_match_item->pattern_list !=
- iavf_pattern_empty && rss->func ==
- RTE_ETH_HASH_FUNCTION_SIMPLE_XOR)
+ if (rss->func ==
+ RTE_ETH_HASH_FUNCTION_SIMPLE_XOR){
+ rss_meta->rss_algorithm =
+ VIRTCHNL_RSS_ALG_XOR_ASYMMETRIC;
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION, action,
- "Not supported flow");
+ "function simple_xor is not supported");
+ } else if (rss->func ==
+ RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ) {
+ rss_meta->rss_algorithm =
+ VIRTCHNL_RSS_ALG_TOEPLITZ_SYMMETRIC;
+ } else {
+ rss_meta->rss_algorithm =
+ VIRTCHNL_RSS_ALG_TOEPLITZ_ASYMMETRIC;
+ }
if (rss->level)
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION, action,
"a non-NULL RSS queue is not supported");
- /* Check hash function and save it to rss_meta. */
- if (rss->func == RTE_ETH_HASH_FUNCTION_SIMPLE_XOR)
- rss_meta->hash_function =
- RTE_ETH_HASH_FUNCTION_SIMPLE_XOR;
-
- if (rss->func ==
- RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ)
- rss_meta->hash_function =
- RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ;
-
- type_match_item =
- rte_zmalloc("iavf_type_match_item",
- sizeof(struct iavf_hash_match_type), 0);
- if (!type_match_item) {
- rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_HANDLE,
- NULL,
- "No memory for type_match_item");
- return -ENOMEM;
- }
-
- /* Find matched proto hdrs according to hash type. */
- for (i = 0; i < type_list_len; i++) {
- struct iavf_hash_match_type *ht_map =
- &iavf_hash_type_list[i];
- if (rss_type == ht_map->hash_type &&
- tt->phint_type == ht_map->phint_type) {
- type_match_item->hash_type =
- ht_map->hash_type;
- type_match_item->proto_hdrs =
- ht_map->proto_hdrs;
- rss_meta->proto_hdrs =
- type_match_item->proto_hdrs;
- item_found = true;
- }
- }
-
- rte_free(type_match_item);
+ /**
+ * Check simultaneous use of SRC_ONLY and DST_ONLY
+ * of the same level.
+ */
+ rss_type = rte_eth_rss_hf_refine(rss_type);
- if (!item_found)
+ if (iavf_any_invalid_rss_type(rss->func, rss_type,
+ match_item->input_set_mask))
return rte_flow_error_set(error, ENOTSUP,
- RTE_FLOW_ERROR_TYPE_ACTION, action,
- "Not supported flow");
+ RTE_FLOW_ERROR_TYPE_ACTION,
+ action, "RSS type not supported");
+ proto_hdrs = match_item->meta;
+ rss_meta->proto_hdrs = *proto_hdrs;
+ iavf_refine_proto_hdrs(&rss_meta->proto_hdrs,
+ rss_type, pattern_hint);
break;
case RTE_FLOW_ACTION_TYPE_END:
{
struct iavf_pattern_match_item *pattern_match_item;
struct iavf_rss_meta *rss_meta_ptr;
+ uint64_t phint = IAVF_PHINT_NONE;
int ret = 0;
rss_meta_ptr = rte_zmalloc(NULL, sizeof(*rss_meta_ptr), 0);
goto error;
}
- ret = iavf_hash_check_inset(pattern, error);
+ ret = iavf_hash_parse_pattern(pattern, &phint, error);
if (ret)
goto error;
- /* Check rss action. */
- ret = iavf_hash_parse_action(pattern_match_item, pattern, actions,
- (void **)&rss_meta_ptr, error);
+ ret = iavf_hash_parse_action(pattern_match_item, actions, phint,
+ rss_meta_ptr, error);
error:
if (!ret && meta)
return -ENOMEM;
}
- rss_cfg->proto_hdrs = *rss_meta->proto_hdrs;
- rss_cfg->rss_algorithm = rss_meta->hash_function;
+ rss_cfg->proto_hdrs = rss_meta->proto_hdrs;
+ rss_cfg->rss_algorithm = rss_meta->rss_algorithm;
ret = iavf_add_del_rss_cfg(ad, rss_cfg, true);
if (!ret) {
flow->rule = rss_cfg;
} else {
PMD_DRV_LOG(ERR, "fail to add RSS configure");
+ rte_flow_error_set(error, -ret,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Failed to add rss rule.");
rte_free(rss_cfg);
+ return -rte_errno;
}
rte_free(meta);
struct rte_flow *flow,
__rte_unused struct rte_flow_error *error)
{
+ struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
struct virtchnl_rss_cfg *rss_cfg;
int ret = 0;
+ if (vf->vf_reset)
+ return 0;
+
rss_cfg = (struct virtchnl_rss_cfg *)flow->rule;
ret = iavf_add_del_rss_cfg(ad, rss_cfg, false);
- if (ret)
+ if (ret) {
PMD_DRV_LOG(ERR, "fail to del RSS configure");
-
+ rte_flow_error_set(error, -ret,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Failed to delete rss rule.");
+ return -rte_errno;
+ }
return ret;
}
static void
iavf_hash_uninit(struct iavf_adapter *ad)
{
+ struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
+ struct rte_eth_rss_conf *rss_conf;
+
+ if (vf->vf_reset)
+ return;
+
+ if (!vf->vf_res)
+ return;
+
+ if (!(vf->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_ADV_RSS_PF))
+ return;
+
+ rss_conf = &ad->dev_data->dev_conf.rx_adv_conf.rss_conf;
+ if (iavf_rss_hash_set(ad, rss_conf->rss_hf, false))
+ PMD_DRV_LOG(ERR, "fail to delete default RSS");
+
iavf_unregister_parser(&iavf_hash_parser, ad);
}