From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A9256A0546; Thu, 27 May 2021 10:06:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2D6D41113; Thu, 27 May 2021 10:06:16 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 885CD41119 for ; Thu, 27 May 2021 10:06:15 +0200 (CEST) IronPort-SDR: OdNPKqUZcjOFJaKBJZqSgwB2zDHTvPs6irKcjqWu6zkXEu5veywoDzlGPCvrLsH80dqJKNv6w3 sLSCHE9v2tGw== X-IronPort-AV: E=McAfee;i="6200,9189,9996"; a="223877771" X-IronPort-AV: E=Sophos;i="5.82,334,1613462400"; d="scan'208";a="223877771" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2021 01:06:15 -0700 IronPort-SDR: 33VOhN2r/riV4VoKq1S02gBmX29esMZ1XP9VES/QKNjrQls9hWThyN/bksEQLFiWa6QBT8NAw9 /kc/Q2HvPOsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,334,1613462400"; d="scan'208";a="477382106" Received: from wuwenjun.sh.intel.com ([10.67.110.159]) by orsmga001.jf.intel.com with ESMTP; 27 May 2021 01:06:13 -0700 From: Wenjun Wu To: dev@dpdk.org, jingjing.wu@intel.com, beilei.xing@intel.com Cc: Wenjun Wu Date: Thu, 27 May 2021 15:48:45 +0800 Message-Id: <20210527074845.1263679-7-wenjun1.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210527074845.1263679-1-wenjun1.wu@intel.com> References: <20210527074845.1263679-1-wenjun1.wu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 6/6] net/ice/base: support FDIR for GRE tunnel packet X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add support for FDIR of inner header of GRE tunnel packet. Signed-off-by: Wenjun Wu --- 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