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 6/6] net/ice/base: support FDIR for GRE tunnel packet
Date: Thu, 27 May 2021 15:48:45 +0800	[thread overview]
Message-ID: <20210527074845.1263679-7-wenjun1.wu@intel.com> (raw)
In-Reply-To: <20210527074845.1263679-1-wenjun1.wu@intel.com>

Add support for FDIR of inner header of GRE tunnel packet.

Signed-off-by: Wenjun Wu <wenjun1.wu@intel.com>
---
 drivers/net/ice/base/ice_fdir.c | 352 ++++++++++++++++++++++++++++++++
 drivers/net/ice/base/ice_fdir.h |   2 +
 drivers/net/ice/base/ice_flow.c |  16 +-
 drivers/net/ice/base/ice_type.h |  14 ++
 4 files changed, 375 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ice/base/ice_fdir.c b/drivers/net/ice/base/ice_fdir.c
index 180508243d..b9fd98d562 100644
--- a/drivers/net/ice/base/ice_fdir.c
+++ b/drivers/net/ice/base/ice_fdir.c
@@ -518,6 +518,180 @@ static const u8 ice_fdir_ipv4_udp_ecpri_tp0_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 };
 
+/* IPV4 GRE INNER IPV4 */
+static const u8 ice_fdir_ipv4_gre4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x2e, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,
+	0x7c, 0x9e, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x16, 0x00, 0x01, 0x00, 0x00, 0x40, 0x00,
+	0x7c, 0xe5, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00,
+};
+
+static const u8 ice_fdir_udp4_gre4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x36, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,
+	0x7c, 0x96, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x1e, 0x00, 0x01, 0x00, 0x00, 0x40, 0x11,
+	0x7c, 0xcc, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a,
+	0x01, 0xd8, 0x00, 0x00,
+};
+
+static const u8 ice_fdir_tcp4_gre4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x42, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,
+	0x7c, 0x8a, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x2a, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06,
+	0x7c, 0xcb, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02,
+	0x20, 0x00, 0x91, 0xde, 0x00, 0x00, 0x00, 0x00,
+};
+
+/* IPV4 GRE INNER IPV6 */
+static const u8 ice_fdir_ipv6_gre4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x42, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,
+	0x7c, 0x8a, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x02, 0x3b, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+};
+
+static const u8 ice_fdir_udp6_gre4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x4a, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,
+	0x7c, 0x82, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x0a, 0x11, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x0a, 0xff, 0xd8, 0x00, 0x00,
+};
+
+static const u8 ice_fdir_tcp6_gre4_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
+	0x00, 0x56, 0x00, 0x01, 0x00, 0x00, 0x40, 0x2f,
+	0x7c, 0x76, 0x7f, 0x00, 0x00, 0x01, 0x7f, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x16, 0x06, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x50, 0x02, 0x20, 0x00, 0x8f, 0xdf,
+	0x00, 0x00, 0x00, 0x00,
+};
+
+/* IPV6 GRE INNER IPV4 */
+static const u8 ice_fdir_ipv4_gre6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x18, 0x2F, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x08, 0x00, 0x45, 0x00, 0x00, 0x14, 0x00, 0x01,
+	0x00, 0x00, 0x40, 0x00, 0x7A, 0xEA, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+};
+
+static const u8 ice_fdir_udp4_gre6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x20, 0x2F, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x08, 0x00, 0x45, 0x00, 0x00, 0x1C, 0x00, 0x01,
+	0x00, 0x00, 0x40, 0x11, 0x7A, 0xD1, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x08, 0xFF, 0xDE, 0x00, 0x00,
+};
+
+static const u8 ice_fdir_tcp4_gre6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x2C, 0x2F, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x08, 0x00, 0x45, 0x00, 0x00, 0x28, 0x00, 0x01,
+	0x00, 0x00, 0x40, 0x06, 0x7A, 0xD0, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x50, 0x02, 0x20, 0x00, 0x8F, 0xE3,
+	0x00, 0x00, 0x00, 0x00,
+};
+
+/* IPV6 GRE INNER IPV6 */
+static const u8 ice_fdir_ipv6_gre6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x2C, 0x2F, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x86, 0xDD, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3B, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x01, 0x00, 0x00,
+};
+
+static const u8 ice_fdir_udp6_gre6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x34, 0x2F, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x08, 0x00, 0x45, 0x00, 0x00, 0x1C, 0x00, 0x01,
+	0x00, 0x00, 0x40, 0x11, 0x7A, 0xD1, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x08, 0xFF, 0xDE, 0x00, 0x00,
+};
+
+static const u8 ice_fdir_tcp6_gre6_pkt[] = {
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
+	0x00, 0x00, 0x00, 0x40, 0x2F, 0x40, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+	0x86, 0xDD, 0x60, 0x00, 0x00, 0x00, 0x00, 0x14,
+	0x06, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x02,
+	0x20, 0x00, 0x8F, 0xE1, 0x00, 0x00, 0x00, 0x00,
+};
+
 static const u8 ice_fdir_ipv6_frag_pkt[] = {
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
@@ -1035,6 +1209,94 @@ static const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
 		sizeof(ice_fdir_ipv4_udp_ecpri_tp0_pkt),
 		ice_fdir_ipv4_udp_ecpri_tp0_pkt,
 	},
+	/* IPV4 GRE INNER IPV4 */
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4,
+		sizeof(ice_fdir_ipv4_gre4_pkt),
+		ice_fdir_ipv4_gre4_pkt,
+		sizeof(ice_fdir_ipv4_gre4_pkt),
+		ice_fdir_ipv4_gre4_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_UDP,
+		sizeof(ice_fdir_udp4_gre4_pkt),
+		ice_fdir_udp4_gre4_pkt,
+		sizeof(ice_fdir_udp4_gre4_pkt),
+		ice_fdir_udp4_gre4_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_TCP,
+		sizeof(ice_fdir_tcp4_gre4_pkt),
+		ice_fdir_tcp4_gre4_pkt,
+		sizeof(ice_fdir_tcp4_gre4_pkt),
+		ice_fdir_tcp4_gre4_pkt,
+	},
+	/* IPV4 GRE INNER IPV6 */
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6,
+		sizeof(ice_fdir_ipv6_gre4_pkt),
+		ice_fdir_ipv6_gre4_pkt,
+		sizeof(ice_fdir_ipv6_gre4_pkt),
+		ice_fdir_ipv6_gre4_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_UDP,
+		sizeof(ice_fdir_udp6_gre4_pkt),
+		ice_fdir_udp6_gre4_pkt,
+		sizeof(ice_fdir_udp6_gre4_pkt),
+		ice_fdir_udp6_gre4_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_TCP,
+		sizeof(ice_fdir_tcp6_gre4_pkt),
+		ice_fdir_tcp6_gre4_pkt,
+		sizeof(ice_fdir_tcp6_gre4_pkt),
+		ice_fdir_tcp6_gre4_pkt,
+	},
+	/* IPV6 GRE INNER IPV4 */
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4,
+		sizeof(ice_fdir_ipv4_gre6_pkt),
+		ice_fdir_ipv4_gre6_pkt,
+		sizeof(ice_fdir_ipv4_gre6_pkt),
+		ice_fdir_ipv4_gre6_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_UDP,
+		sizeof(ice_fdir_udp4_gre6_pkt),
+		ice_fdir_udp4_gre6_pkt,
+		sizeof(ice_fdir_udp4_gre6_pkt),
+		ice_fdir_udp4_gre6_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_TCP,
+		sizeof(ice_fdir_tcp4_gre6_pkt),
+		ice_fdir_tcp4_gre6_pkt,
+		sizeof(ice_fdir_tcp4_gre6_pkt),
+		ice_fdir_tcp4_gre6_pkt,
+	},
+	/* IPV4 GRE INNER IPV6 */
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6,
+		sizeof(ice_fdir_ipv6_gre6_pkt),
+		ice_fdir_ipv6_gre6_pkt,
+		sizeof(ice_fdir_ipv6_gre6_pkt),
+		ice_fdir_ipv6_gre6_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_UDP,
+		sizeof(ice_fdir_udp6_gre6_pkt),
+		ice_fdir_udp6_gre6_pkt,
+		sizeof(ice_fdir_udp6_gre6_pkt),
+		ice_fdir_udp6_gre6_pkt,
+	},
+	{
+		ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_TCP,
+		sizeof(ice_fdir_tcp6_gre6_pkt),
+		ice_fdir_tcp6_gre6_pkt,
+		sizeof(ice_fdir_tcp6_gre6_pkt),
+		ice_fdir_tcp6_gre6_pkt,
+	},
 	{
 		ICE_FLTR_PTYPE_NONF_IPV6_TCP,
 		sizeof(ice_fdir_tcpv6_pkt), ice_fdir_tcpv6_pkt,
@@ -1503,6 +1765,28 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 				   ICE_NONDMA_TO_NONDMA);
 			loc = &pkt[ICE_FDIR_GTPU_EH_INNER_PKT_OFF];
 			break;
+		case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4:
+		case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_UDP:
+		case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_TCP:
+		case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6:
+		case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_UDP:
+		case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_TCP:
+			ice_memcpy(pkt, ice_fdir_pkt[idx].tun_pkt,
+				   ice_fdir_pkt[idx].tun_pkt_len,
+				   ICE_NONDMA_TO_NONDMA);
+			loc = &pkt[ICE_FDIR_IPV4_GRE_INNER_PKT_OFF];
+			break;
+		case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4:
+		case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_UDP:
+		case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_TCP:
+		case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6:
+		case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_UDP:
+		case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_TCP:
+			ice_memcpy(pkt, ice_fdir_pkt[idx].tun_pkt,
+				   ice_fdir_pkt[idx].tun_pkt_len,
+				   ICE_NONDMA_TO_NONDMA);
+			loc = &pkt[ICE_FDIR_IPV6_GRE_INNER_PKT_OFF];
+			break;
 		default:
 			if (ice_fdir_get_open_tunnel_port(hw, flow, &tnl_port))
 				return ICE_ERR_DOES_NOT_EXIST;
@@ -1787,6 +2071,74 @@ ice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
 		ice_pkt_insert_u16(pkt, ICE_IPV4_UDP_ECPRI_TP0_PC_ID_OFFSET,
 				   input->ecpri_data.pc_id);
 		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4:
+		ice_pkt_insert_u32(loc, ICE_IPV4_NO_MAC_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u32(loc, ICE_IPV4_NO_MAC_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u8(loc, ICE_IPV4_NO_MAC_TOS_OFFSET, input->ip.v4.tos);
+		ice_pkt_insert_u8(loc, ICE_IPV4_NO_MAC_PROTO_OFFSET,
+				  input->ip.v4.proto);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_TCP:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_TCP:
+		ice_pkt_insert_u32(loc, ICE_IPV4_NO_MAC_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u16(loc, ICE_TCP4_NO_MAC_DST_PORT_OFFSET,
+				   input->ip.v4.src_port);
+		ice_pkt_insert_u32(loc, ICE_IPV4_NO_MAC_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u16(loc, ICE_TCP4_NO_MAC_SRC_PORT_OFFSET,
+				   input->ip.v4.dst_port);
+		ice_pkt_insert_u8(loc, ICE_IPV4_NO_MAC_TOS_OFFSET, input->ip.v4.tos);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_UDP:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_UDP:
+		ice_pkt_insert_u32(loc, ICE_IPV4_NO_MAC_DST_ADDR_OFFSET,
+				   input->ip.v4.src_ip);
+		ice_pkt_insert_u16(loc, ICE_UDP4_NO_MAC_DST_PORT_OFFSET,
+				   input->ip.v4.src_port);
+		ice_pkt_insert_u32(loc, ICE_IPV4_NO_MAC_SRC_ADDR_OFFSET,
+				   input->ip.v4.dst_ip);
+		ice_pkt_insert_u16(loc, ICE_UDP4_NO_MAC_SRC_PORT_OFFSET,
+				   input->ip.v4.dst_port);
+		ice_pkt_insert_u8(loc, ICE_IPV4_NO_MAC_TOS_OFFSET, input->ip.v4.tos);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_NO_MAC_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_NO_MAC_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u8_tc(loc, ICE_IPV6_NO_MAC_TC_OFFSET, input->ip.v6.tc);
+		ice_pkt_insert_u8(loc, ICE_IPV6_NO_MAC_PROTO_OFFSET,
+				  input->ip.v6.proto);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_TCP:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_TCP:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_NO_MAC_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_NO_MAC_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u16(loc, ICE_TCP6_NO_MAC_DST_PORT_OFFSET,
+				   input->ip.v6.src_port);
+		ice_pkt_insert_u16(loc, ICE_TCP6_NO_MAC_SRC_PORT_OFFSET,
+				   input->ip.v6.dst_port);
+		ice_pkt_insert_u8_tc(loc, ICE_IPV6_NO_MAC_TC_OFFSET, input->ip.v6.tc);
+		break;
+	case ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_UDP:
+	case ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_UDP:
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_NO_MAC_DST_ADDR_OFFSET,
+					 input->ip.v6.src_ip);
+		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_NO_MAC_SRC_ADDR_OFFSET,
+					 input->ip.v6.dst_ip);
+		ice_pkt_insert_u16(loc, ICE_UDP6_NO_MAC_DST_PORT_OFFSET,
+				   input->ip.v6.src_port);
+		ice_pkt_insert_u16(loc, ICE_UDP6_NO_MAC_SRC_PORT_OFFSET,
+				   input->ip.v6.dst_port);
+		ice_pkt_insert_u8_tc(loc, ICE_IPV6_NO_MAC_TC_OFFSET, input->ip.v6.tc);
+		break;
 	case ICE_FLTR_PTYPE_NONF_IPV6_TCP:
 		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
 					 input->ip.v6.src_ip);
diff --git a/drivers/net/ice/base/ice_fdir.h b/drivers/net/ice/base/ice_fdir.h
index 0ebf7f326c..771ac3af16 100644
--- a/drivers/net/ice/base/ice_fdir.h
+++ b/drivers/net/ice/base/ice_fdir.h
@@ -16,6 +16,8 @@
 
 #define ICE_FDIR_GTPU_IP_INNER_PKT_OFF 50
 #define ICE_FDIR_GTPU_EH_INNER_PKT_OFF 58
+#define ICE_FDIR_IPV4_GRE_INNER_PKT_OFF 38
+#define ICE_FDIR_IPV6_GRE_INNER_PKT_OFF 58
 
 #define ICE_FDIR_TUN_PKT_OFF		50
 #define ICE_FDIR_MAX_RAW_PKT_SIZE	(512 + ICE_FDIR_TUN_PKT_OFF)
diff --git a/drivers/net/ice/base/ice_flow.c b/drivers/net/ice/base/ice_flow.c
index d6242744cd..dfadb321c3 100644
--- a/drivers/net/ice/base/ice_flow.c
+++ b/drivers/net/ice/base/ice_flow.c
@@ -257,7 +257,7 @@ static const u32 ice_ptypes_ipv4_ofos[] = {
  * IPV4 other PTYPEs
  */
 static const u32 ice_ptypes_ipv4_ofos_all[] = {
-	0x1DC00000, 0x24000800, 0x00000000, 0x00000000,
+	0x1DC00000, 0x27BF7800, 0x00000000, 0x00000000,
 	0x00000000, 0x00000155, 0x00000000, 0x00000000,
 	0x00000000, 0x000FC000, 0x83E0FAA0, 0x00000101,
 	0x03FFD500, 0x00000000, 0x00000000, 0x00000000,
@@ -297,7 +297,7 @@ static const u32 ice_ptypes_ipv6_ofos[] = {
  * IPV6 other PTYPEs
  */
 static const u32 ice_ptypes_ipv6_ofos_all[] = {
-	0x00000000, 0x00000000, 0x77000000, 0x10002000,
+	0x00000000, 0x00000000, 0x77000000, 0x1EFDE000,
 	0x00000000, 0x000002AA, 0x00000000, 0x00000000,
 	0x00000000, 0x03F00000, 0x7C1F0540, 0x00000206,
 	0xFC002A00, 0x0000003F, 0x00000000, 0x00000000,
@@ -444,7 +444,7 @@ static const u32 ice_ptypes_icmp_il[] = {
 /* Packet types for packets with an Outermost/First GRE header */
 static const u32 ice_ptypes_gre_of[] = {
 	0x00000000, 0xBFBF7800, 0x000001DF, 0xFEFDE000,
-	0x0000017E, 0x00000000, 0x00000000, 0x00000000,
+	0x0000077E, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
 	0x00000000, 0x00000000, 0x00000000, 0x00000000,
@@ -803,7 +803,7 @@ struct ice_flow_prof_params {
 	ICE_FLOW_SEG_HDR_ESP | ICE_FLOW_SEG_HDR_AH | \
 	ICE_FLOW_SEG_HDR_NAT_T_ESP | ICE_FLOW_SEG_HDR_GTPU_NON_IP | \
 	ICE_FLOW_SEG_HDR_ECPRI_TP0 | ICE_FLOW_SEG_HDR_UDP_ECPRI_TP0 | \
-	ICE_FLOW_SEG_HDR_L2TPV2 | ICE_FLOW_SEG_HDR_PPP)
+	ICE_FLOW_SEG_HDR_L2TPV2 | ICE_FLOW_SEG_HDR_PPP | ICE_FLOW_SEG_HDR_GRE)
 
 #define ICE_FLOW_SEG_HDRS_L2_MASK	\
 	(ICE_FLOW_SEG_HDR_ETH | ICE_FLOW_SEG_HDR_VLAN)
@@ -1020,11 +1020,9 @@ ice_flow_proc_seg_hdrs(struct ice_flow_prof_params *params)
 			ice_and_bitmap(params->ptypes, params->ptypes, src,
 				       ICE_FLOW_PTYPE_MAX);
 		} else if (hdrs & ICE_FLOW_SEG_HDR_GRE) {
-			if (!i) {
-				src = (const ice_bitmap_t *)ice_ptypes_gre_of;
-				ice_and_bitmap(params->ptypes, params->ptypes,
-					       src, ICE_FLOW_PTYPE_MAX);
-			}
+			src = (const ice_bitmap_t *)ice_ptypes_gre_of;
+			ice_and_bitmap(params->ptypes, params->ptypes,
+				       src, ICE_FLOW_PTYPE_MAX);
 		} else if (hdrs & ICE_FLOW_SEG_HDR_GTPC) {
 			src = (const ice_bitmap_t *)ice_ptypes_gtpc;
 			ice_and_bitmap(params->ptypes, params->ptypes,
diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h
index ce508a02e5..8dba531e1a 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -348,6 +348,20 @@ enum ice_fltr_ptype {
 	ICE_FLTR_PTYPE_NONF_IPV4_UDP_ECPRI_TP0,
 	ICE_FLTR_PTYPE_FRAG_IPV4,
 	ICE_FLTR_PTYPE_FRAG_IPV6,
+	ICE_FLTR_PTYPE_NONF_IPV4_GRE,
+	ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4,
+	ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_UDP,
+	ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV4_TCP,
+	ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6,
+	ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_UDP,
+	ICE_FLTR_PTYPE_NONF_IPV4_GRE_IPV6_TCP,
+	ICE_FLTR_PTYPE_NONF_IPV6_GRE,
+	ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4,
+	ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_UDP,
+	ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV4_TCP,
+	ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6,
+	ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_UDP,
+	ICE_FLTR_PTYPE_NONF_IPV6_GRE_IPV6_TCP,
 	ICE_FLTR_PTYPE_NONF_IPV6_UDP,
 	ICE_FLTR_PTYPE_NONF_IPV6_TCP,
 	ICE_FLTR_PTYPE_NONF_IPV6_SCTP,
-- 
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 ` [dpdk-dev] [PATCH v1 5/6] net/iavf: support AVF FDIR " Wenjun Wu
2021-05-27  7:48 ` Wenjun Wu [this message]

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-7-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).