DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wenjun Wu <wenjun1.wu@intel.com>
To: dev@dpdk.org, jingjing.wu@intel.com, beilei.xing@intel.com
Cc: Wenjun Wu <wenjun1.wu@intel.com>
Subject: [dpdk-dev] [PATCH v1 5/6] net/iavf: support AVF FDIR for GRE tunnel packet
Date: Thu, 27 May 2021 15:48:44 +0800	[thread overview]
Message-ID: <20210527074845.1263679-6-wenjun1.wu@intel.com> (raw)
In-Reply-To: <20210527074845.1263679-1-wenjun1.wu@intel.com>

Support AVF FDIR for inner header of GRE tunnel packet.

+------------------------------+---------------------------------------+
|           Pattern            |            Input Set                  |
+------------------------------+---------------------------------------+
| eth/ipv4/gre/ipv4            | inner: src/dst ip, dscp               |
| eth/ipv4/gre/ipv4/udp        | inner: src/dst ip, dscp, src/dst port |
| eth/ipv4/gre/ipv4/tcp        | inner: src/dst ip, dscp, src/dst port |
| eth/ipv4/gre/eh/ipv6         | inner: src/dst ip, tc                 |
| eth/ipv4/gre/eh/ipv6/udp     | inner: src/dst ip, tc, src/dst port   |
| eth/ipv4/gre/eh/ipv6/tcp     | inner: src/dst ip, tc, src/dst port   |
| eth/ipv6/gre/ipv4            | inner: src/dst ip, dscp               |
| eth/ipv6/gre/ipv4/udp        | inner: src/dst ip, dscp, src/dst port |
| eth/ipv6/gre/ipv4/tcp        | inner: src/dst ip, dscp, src/dst port |
| eth/ipv6/gre/ipv6            | inner: src/dst ip, tc                 |
| eth/ipv6/gre/ipv6/udp        | inner: src/dst ip, tc, src/dst port   |
| eth/ipv6/gre/ipv6/tcp        | inner: src/dst ip, tc, src/dst port   |
+------------------------------+---------------------------------------+

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
 drivers/net/iavf/iavf_fdir.c | 55 ++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c
index f238a83c84..c0b748caca 100644
--- a/drivers/net/iavf/iavf_fdir.c
+++ b/drivers/net/iavf/iavf_fdir.c
@@ -139,6 +139,30 @@
 #define IAVF_FDIR_INSET_ECPRI (\
 	IAVF_INSET_ECPRI)
 
+#define IAVF_FDIR_INSET_GRE_IPV4 (\
+	IAVF_INSET_TUN_IPV4_SRC | IAVF_INSET_TUN_IPV4_DST | \
+	IAVF_INSET_TUN_IPV4_TOS | IAVF_INSET_TUN_IPV4_PROTO)
+
+#define IAVF_FDIR_INSET_GRE_IPV4_TCP (\
+	IAVF_FDIR_INSET_GRE_IPV4 | IAVF_INSET_TUN_TCP_SRC_PORT | \
+	IAVF_INSET_TUN_TCP_DST_PORT)
+
+#define IAVF_FDIR_INSET_GRE_IPV4_UDP (\
+	IAVF_FDIR_INSET_GRE_IPV4 | IAVF_INSET_TUN_UDP_SRC_PORT | \
+	IAVF_INSET_TUN_UDP_DST_PORT)
+
+#define IAVF_FDIR_INSET_GRE_IPV6 (\
+	IAVF_INSET_TUN_IPV6_SRC | IAVF_INSET_TUN_IPV6_DST | \
+	IAVF_INSET_TUN_IPV6_TC | IAVF_INSET_TUN_IPV6_NEXT_HDR)
+
+#define IAVF_FDIR_INSET_GRE_IPV6_TCP (\
+	IAVF_FDIR_INSET_GRE_IPV6 | IAVF_INSET_TUN_TCP_SRC_PORT | \
+	IAVF_INSET_TUN_TCP_DST_PORT)
+
+#define IAVF_FDIR_INSET_GRE_IPV6_UDP (\
+	IAVF_FDIR_INSET_GRE_IPV6 | IAVF_INSET_TUN_UDP_SRC_PORT | \
+	IAVF_INSET_TUN_UDP_DST_PORT)
+
 static struct iavf_pattern_match_item iavf_fdir_pattern[] = {
 	{iavf_pattern_ethertype,		 IAVF_FDIR_INSET_ETH,		IAVF_INSET_NONE},
 	{iavf_pattern_eth_ipv4,			 IAVF_FDIR_INSET_ETH_IPV4,	IAVF_INSET_NONE},
@@ -178,6 +202,18 @@ static struct iavf_pattern_match_item iavf_fdir_pattern[] = {
 	{iavf_pattern_eth_ipv6_pfcp,		 IAVF_FDIR_INSET_PFCP,		IAVF_INSET_NONE},
 	{iavf_pattern_eth_ecpri,		 IAVF_FDIR_INSET_ECPRI,		IAVF_INSET_NONE},
 	{iavf_pattern_eth_ipv4_ecpri,		 IAVF_FDIR_INSET_ECPRI,		IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv4_gre_ipv4,	IAVF_FDIR_INSET_GRE_IPV4,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv4_gre_ipv4_tcp,	IAVF_FDIR_INSET_GRE_IPV4_TCP,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv4_gre_ipv4_udp,	IAVF_FDIR_INSET_GRE_IPV4_UDP,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv4_gre_ipv6,	IAVF_FDIR_INSET_GRE_IPV6,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv4_gre_ipv6_tcp,	IAVF_FDIR_INSET_GRE_IPV6_TCP,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv4_gre_ipv6_udp,	IAVF_FDIR_INSET_GRE_IPV6_UDP,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv6_gre_ipv4,	IAVF_FDIR_INSET_GRE_IPV4,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv6_gre_ipv4_tcp,	IAVF_FDIR_INSET_GRE_IPV4_TCP,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv6_gre_ipv4_udp,	IAVF_FDIR_INSET_GRE_IPV4_UDP,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv6_gre_ipv6,	IAVF_FDIR_INSET_GRE_IPV6,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv6_gre_ipv6_tcp,	IAVF_FDIR_INSET_GRE_IPV6_TCP,	IAVF_INSET_NONE},
+	{iavf_pattern_eth_ipv6_gre_ipv6_udp,	IAVF_FDIR_INSET_GRE_IPV6_UDP,	IAVF_INSET_NONE},
 };
 
 static struct iavf_flow_parser iavf_fdir_parser;
@@ -596,6 +632,7 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 	const struct rte_flow_item_ah *ah_spec, *ah_mask;
 	const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask;
 	const struct rte_flow_item_ecpri *ecpri_spec, *ecpri_mask;
+	const struct rte_flow_item_gre *gre_spec, *gre_mask;
 	const struct rte_flow_item *item = pattern;
 	struct virtchnl_proto_hdr *hdr, *hdr1 = NULL;
 	struct rte_ecpri_common_hdr ecpri_common;
@@ -1195,6 +1232,24 @@ iavf_fdir_parse_pattern(__rte_unused struct iavf_adapter *ad,
 			hdrs->count = ++layer;
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_GRE:
+			gre_spec = item->spec;
+			gre_mask = item->mask;
+
+			hdr = &hdrs->proto_hdr[layer];
+
+			VIRTCHNL_SET_PROTO_HDR_TYPE(hdr, GRE);
+
+			if (gre_spec && gre_mask) {
+				rte_memcpy(hdr->buffer, gre_spec,
+					   sizeof(*gre_spec));
+			}
+
+			tun_inner = 1;
+
+			hdrs->count = ++layer;
+			break;
+
 		case RTE_FLOW_ITEM_TYPE_VOID:
 			break;
 
-- 
2.25.1


  parent reply	other threads:[~2021-05-27  8:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-27  7:48 [dpdk-dev] [PATCH v1 0/6] support AVF RSS and " Wenjun Wu
2021-05-27  7:48 ` [dpdk-dev] [PATCH v1 1/6] net/iavf: support flow pattern for GRE Wenjun Wu
2021-05-27  7:48 ` [dpdk-dev] [PATCH v1 2/6] common/iavf: add header types " Wenjun Wu
2021-05-27  7:48 ` [dpdk-dev] [PATCH v1 3/6] ethdev: add GRE RSS offload type Wenjun Wu
2021-05-27  7:48 ` [dpdk-dev] [PATCH v1 4/6] net/iavf: support AVF RSS for GRE tunnel packet Wenjun Wu
2021-05-27  7:48 ` Wenjun Wu [this message]
2021-05-27  7:48 ` [dpdk-dev] [PATCH v1 6/6] net/ice/base: support FDIR " Wenjun Wu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210527074845.1263679-6-wenjun1.wu@intel.com \
    --to=wenjun1.wu@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).