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 9977BA0508; Wed, 13 Apr 2022 10:12:20 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A08A42801; Wed, 13 Apr 2022 10:11:22 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 826D442801 for ; Wed, 13 Apr 2022 10:11:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649837481; x=1681373481; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3rmbh29fN3RU4dPLHE6OjOHImGxTUIo8SR2xHknHuBQ=; b=Vf2m7MNEoAO6DsF4zuMiTYxu1VJvglS0pJB7TBb/9l8igixMIfRdbDUx Knsu6SP/XXSQc2JFP/UT0w7mVjMGsK94WQ+DtleZn6jBFm2FSyOg8ElR8 7SBFwtYn0/hn9uaYH78DnJ6j/B2OgwYMqNK9PrKLFhZQYpGtWHdWUoZEP 6BtUrugk7fwMab+34/pxHYR/z/PTbZGt9RIN5AtkYXPDV/Dmds4CPTJM1 nuGZj0igMtRmwLzTt+Jh0u1gnTZNRhdrrHLLqwdjaFSS5HQr+1uy7d2LE Cese9aL6ukbzHPZnRyPc1qzfnXYggFbopkNw5hn80Kd+Id6djnzjSB+Gk g==; X-IronPort-AV: E=McAfee;i="6400,9594,10315"; a="287630024" X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="287630024" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 01:11:20 -0700 X-IronPort-AV: E=Sophos;i="5.90,256,1643702400"; d="scan'208";a="526847678" Received: from intel-cd-odc-kevin.cd.intel.com ([10.240.178.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Apr 2022 01:11:17 -0700 From: Kevin Liu To: dev@dpdk.org Cc: qiming.yang@intel.com, qi.z.zhang@intel.com, stevex.yang@intel.com, Alvin Zhang , Junfeng Guo , Kevin Liu Subject: [PATCH v2 15/33] net/ice/base: support IPv6 GRE UDP pattern Date: Wed, 13 Apr 2022 16:09:14 +0000 Message-Id: <20220413160932.2074781-16-kevinx.liu@intel.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220413160932.2074781-1-kevinx.liu@intel.com> References: <20220407105706.18889-1-kevinx.liu@intel.com> <20220413160932.2074781-1-kevinx.liu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 From: Alvin Zhang Add supports(trainer packet and it's offsets, definitions, pattern matching) for IPv6 GRE UDP pattern. Signed-off-by: Junfeng Guo Signed-off-by: Alvin Zhang Signed-off-by: Kevin Liu --- drivers/net/ice/base/ice_protocol_type.h | 1 + drivers/net/ice/base/ice_switch.c | 43 +++++++++++++++++++++++- 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index d6332c5690..eec9f27823 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -44,6 +44,7 @@ enum ice_protocol_type { ICE_GENEVE, ICE_VXLAN_GPE, ICE_NVGRE, + ICE_GRE, ICE_GTP, ICE_PPPOE, ICE_PFCP, diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index b0c50c8f40..f444a2da07 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -12,6 +12,7 @@ #define ICE_MAX_VLAN_ID 0xFFF #define ICE_IPV6_ETHER_ID 0x86DD #define ICE_IPV4_NVGRE_PROTO_ID 0x002F +#define ICE_IPV6_GRE_PROTO_ID 0x002F #define ICE_PPP_IPV6_PROTO_ID 0x0057 #define ICE_TCP_PROTO_ID 0x06 #define ICE_GTPU_PROFILE 24 @@ -129,6 +130,34 @@ static const u8 dummy_gre_udp_packet[] = { 0x00, 0x08, 0x00, 0x00, }; +static const struct ice_dummy_pkt_offsets +dummy_ipv6_gre_udp_packet_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_IPV6_OFOS, 14 }, + { ICE_GRE, 54 }, + { ICE_IPV6_IL, 58 }, + { ICE_UDP_ILOS, 98 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +static const u8 dummy_ipv6_gre_udp_packet[] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x86, 0xdd, 0x60, 0x00, + 0x00, 0x00, 0x00, 0x36, 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, 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 struct ice_dummy_pkt_offsets dummy_udp_tun_tcp_packet_offsets[] = { { ICE_MAC_OFOS, 0 }, { ICE_ETYPE_OL, 12 }, @@ -8207,8 +8236,13 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, udp = true; else if (lkups[i].type == ICE_TCP_IL) tcp = true; - else if (lkups[i].type == ICE_IPV6_OFOS) + else if (lkups[i].type == ICE_IPV6_OFOS) { ipv6 = true; + if (lkups[i].h_u.ipv6_hdr.next_hdr == + ICE_IPV6_GRE_PROTO_ID && + lkups[i].m_u.ipv6_hdr.next_hdr == 0xFF) + gre = true; + } else if (lkups[i].type == ICE_VLAN_OFOS) vlan = true; else if (lkups[i].type == ICE_ETYPE_OL && @@ -8568,6 +8602,13 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, return; } + if (ipv6 && gre) { + *pkt = dummy_ipv6_gre_udp_packet; + *pkt_len = sizeof(dummy_ipv6_gre_udp_packet); + *offsets = dummy_ipv6_gre_udp_packet_offsets; + return; + } + if (tun_type == ICE_SW_TUN_NVGRE || gre) { if (tcp) { *pkt = dummy_gre_tcp_packet; -- 2.33.1