From 07d74e3d91f06a2f7d91e180fcf6453ea812985a Mon Sep 17 00:00:00 2001 From: Wenjun Wu Date: Wed, 2 Jun 2021 10:24:39 +0800 Subject: [PATCH] net/iavf: support flow pattern for GRE Add GRE pattern support for AVF FDIR and RSS. Patterns are listed below: 1. eth/ipv4/gre/ipv4 2. eth/ipv4/gre/ipv6 3. eth/ipv6/gre/ipv4 4. eth/ipv6/gre/ipv6 5. eth/ipv4/gre/ipv4/tcp 6. eth/ipv4/gre/ipv6/tcp 7. eth/ipv4/gre/ipv4/udp 8. eth/ipv4/gre/ipv6/udp 9. eth/ipv6/gre/ipv4/tcp 10. eth/ipv6/gre/ipv6/tcp 11. eth/ipv6/gre/ipv4/udp 12. eth/ipv6/gre/ipv6/udp Signed-off-by: Wenjun Wu Acked-by: Qi Zhang --- doc/guides/nics/features/iavf.ini | 1 + drivers/net/iavf/iavf_generic_flow.c | 105 +++++++++++++++++++++++++++ drivers/net/iavf/iavf_generic_flow.h | 14 ++++ 3 files changed, 120 insertions(+) diff --git a/doc/guides/nics/features/iavf.ini b/doc/guides/nics/features/iavf.ini index 7af62d4ce7..43a84a3bda 100644 --- a/doc/guides/nics/features/iavf.ini +++ b/doc/guides/nics/features/iavf.ini @@ -40,6 +40,7 @@ arp_eth_ipv4 = Y ecpri = Y esp = Y eth = Y +gre = Y gtpc = Y gtpu = Y gtp_psc = Y diff --git a/drivers/net/iavf/iavf_generic_flow.c b/drivers/net/iavf/iavf_generic_flow.c index 242bb4abc5..d9ba5735b2 100644 --- a/drivers/net/iavf/iavf_generic_flow.c +++ b/drivers/net/iavf/iavf_generic_flow.c @@ -822,6 +822,111 @@ enum rte_flow_item_type iavf_pattern_eth_ipv4_ecpri[] = { RTE_FLOW_ITEM_TYPE_END, }; +/* GRE */ +enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv4[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv6[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv4[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv4_tcp[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_TCP, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv4_udp[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_UDP, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv6_tcp[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_TCP, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv6_udp[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_UDP, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv4_tcp[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_TCP, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv4_udp[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV4, + RTE_FLOW_ITEM_TYPE_UDP, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6_tcp[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_TCP, + RTE_FLOW_ITEM_TYPE_END, +}; + +enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6_udp[] = { + RTE_FLOW_ITEM_TYPE_ETH, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_GRE, + RTE_FLOW_ITEM_TYPE_IPV6, + RTE_FLOW_ITEM_TYPE_UDP, + RTE_FLOW_ITEM_TYPE_END, +}; + typedef struct iavf_flow_engine * (*parse_engine_t)(struct iavf_adapter *ad, struct rte_flow *flow, struct iavf_parser_list *parser_list, diff --git a/drivers/net/iavf/iavf_generic_flow.h b/drivers/net/iavf/iavf_generic_flow.h index e19da15518..48fd03a973 100644 --- a/drivers/net/iavf/iavf_generic_flow.h +++ b/drivers/net/iavf/iavf_generic_flow.h @@ -308,6 +308,20 @@ extern enum rte_flow_item_type iavf_pattern_eth_ipv6_pfcp[]; extern enum rte_flow_item_type iavf_pattern_eth_ecpri[]; extern enum rte_flow_item_type iavf_pattern_eth_ipv4_ecpri[]; +/* GRE */ +extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv4[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv6[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv4[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv4_tcp[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv6_tcp[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv4_udp[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv4_gre_ipv6_udp[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv4_tcp[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6_tcp[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv4_udp[]; +extern enum rte_flow_item_type iavf_pattern_eth_ipv6_gre_ipv6_udp[]; + extern const struct rte_flow_ops iavf_flow_ops; /* pattern structure */ -- 2.20.1