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 50893A034F; Tue, 30 Mar 2021 11:24:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CC504406B4; Tue, 30 Mar 2021 11:24:31 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id D0A7540691 for ; Tue, 30 Mar 2021 11:24:29 +0200 (CEST) IronPort-SDR: WYnM6vMV1Vgzs9LQfLzZyverNbE1XgUZNY0Lwu93PrcssHLlV4HBdDBVwB7w1GeY2p/ANwmbyT fgosxZB/NpTg== X-IronPort-AV: E=McAfee;i="6000,8403,9938"; a="276897035" X-IronPort-AV: E=Sophos;i="5.81,290,1610438400"; d="scan'208";a="276897035" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2021 02:24:28 -0700 IronPort-SDR: niCLvxTtNDi5yeFgEBNnLhOe0cyP0aeq3HIF2L/t/03L3jVKsSfnRH2FCjcx+vz6FYCVr07PzT sng6YuLNVW6A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,290,1610438400"; d="scan'208";a="445031902" Received: from dpdk-yyzhang2.sh.intel.com ([10.67.117.129]) by fmsmga002.fm.intel.com with ESMTP; 30 Mar 2021 02:24:26 -0700 From: Yuying Zhang To: dev@dpdk.org, qi.z.zhang@intel.com, yuying.zhang@intel.com Date: Tue, 30 Mar 2021 09:14:51 +0000 Message-Id: <20210330091451.374641-1-yuying.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210318084824.165907-1-yuying.zhang@intel.com> References: <20210318084824.165907-1-yuying.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2] net/ice: support GTPU TEID pattern for switch filter 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" Enable GTPU pattern for CVL switch filter. Support teid and qfi field of GTPU pattern. Patterns without inner l3/l4 field support outer dst/src ip. Patterns with inner l3/l4 field only support inner dst/src ip and inner dst/src port. +-----------------------------------+-------------------------------------+ | Pattern | Input Set | +-----------------------------------+-------------------------------------+ | pattern_eth_ipv4_gtpu | teid, dst/src ip | | pattern_eth_ipv6_gtpu | teid, dst/src ip | | pattern_eth_ipv4_gtpu_ipv4 | teid, dst/src ip | | pattern_eth_ipv4_gtpu_ipv4_tcp | teid, dst/src ip, dst/src port | | pattern_eth_ipv4_gtpu_ipv4_udp | teid, dst/src ip, dst/src port | | pattern_eth_ipv4_gtpu_ipv6 | teid, dst/src ip | | pattern_eth_ipv4_gtpu_ipv6_tcp | teid, dst/src ip, dst/src port | | pattern_eth_ipv4_gtpu_ipv6_udp | teid, dst/src ip, dst/src port | | pattern_eth_ipv6_gtpu_ipv4 | teid, dst/src ip | | pattern_eth_ipv6_gtpu_ipv4_tcp | teid, dst/src ip, dst/src port | | pattern_eth_ipv6_gtpu_ipv4_udp | teid, dst/src ip, dst/src port | | pattern_eth_ipv6_gtpu_ipv6 | teid, dst/src ip | | pattern_eth_ipv6_gtpu_ipv6_tcp | teid, dst/src ip, dst/src port | | pattern_eth_ipv6_gtpu_ipv6_udp | teid, dst/src ip, dst/src port | | pattern_eth_ipv4_gtpu_eh_ipv4 | teid, qfi, dst/src ip | | pattern_eth_ipv4_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port | | pattern_eth_ipv4_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port | | pattern_eth_ipv4_gtpu_eh_ipv6 | teid, qfi, dst/src ip | | pattern_eth_ipv4_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port | | pattern_eth_ipv4_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port | | pattern_eth_ipv6_gtpu_eh_ipv4 | teid, qfi, dst/src ip | | pattern_eth_ipv6_gtpu_eh_ipv4_tcp | teid, qfi, dst/src ip, dst/src port | | pattern_eth_ipv6_gtpu_eh_ipv4_udp | teid, qfi, dst/src ip, dst/src port | | pattern_eth_ipv6_gtpu_eh_ipv6 | teid, qfi, dst/src ip | | pattern_eth_ipv6_gtpu_eh_ipv6_tcp | teid, qfi, dst/src ip, dst/src port | | pattern_eth_ipv6_gtpu_eh_ipv6_udp | teid, qfi, dst/src ip, dst/src port | +-----------------------------------+-------------------------------------+ Signed-off-by: Yuying Zhang --- doc/guides/rel_notes/release_21_05.rst | 4 + drivers/net/ice/base/ice_protocol_type.h | 28 ++- drivers/net/ice/base/ice_switch.c | 184 +++++++++++++- drivers/net/ice/ice_switch_filter.c | 298 ++++++++++++++++++++++- 4 files changed, 492 insertions(+), 22 deletions(-) diff --git a/doc/guides/rel_notes/release_21_05.rst b/doc/guides/rel_notes/release_21_05.rst index d1785c706f..e4ed0acb85 100644 --- a/doc/guides/rel_notes/release_21_05.rst +++ b/doc/guides/rel_notes/release_21_05.rst @@ -136,6 +136,10 @@ New Features * Added flow filter to support GTPU inner L3/L4 fields matching. +* **Updated Intel ice driver.** + + * Added GTP TEID support for DCF switch filter. + Removed Items ------------- diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index ee1f29d41f..077f411ebe 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -75,6 +75,30 @@ enum ice_sw_tunnel_type { ICE_SW_TUN_GTP, ICE_SW_TUN_IPV4_GTPU_NO_PAY, ICE_SW_TUN_IPV6_GTPU_NO_PAY, + ICE_SW_TUN_IPV4_GTPU_IPV4, + ICE_SW_TUN_IPV4_GTPU_EH_IPV4, + ICE_SW_TUN_IPV4_GTPU_IPV4_UDP, + ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP, + ICE_SW_TUN_IPV4_GTPU_IPV4_TCP, + ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP, + ICE_SW_TUN_IPV4_GTPU_IPV6, + ICE_SW_TUN_IPV4_GTPU_EH_IPV6, + ICE_SW_TUN_IPV4_GTPU_IPV6_UDP, + ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP, + ICE_SW_TUN_IPV4_GTPU_IPV6_TCP, + ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP, + ICE_SW_TUN_IPV6_GTPU_IPV4, + ICE_SW_TUN_IPV6_GTPU_EH_IPV4, + ICE_SW_TUN_IPV6_GTPU_IPV4_UDP, + ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP, + ICE_SW_TUN_IPV6_GTPU_IPV4_TCP, + ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP, + ICE_SW_TUN_IPV6_GTPU_IPV6, + ICE_SW_TUN_IPV6_GTPU_EH_IPV6, + ICE_SW_TUN_IPV6_GTPU_IPV6_UDP, + ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP, + ICE_SW_TUN_IPV6_GTPU_IPV6_TCP, + ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP, ICE_SW_TUN_PPPOE, ICE_SW_TUN_PPPOE_PAY, ICE_SW_TUN_PPPOE_IPV4, @@ -105,10 +129,6 @@ enum ice_sw_tunnel_type { ICE_SW_TUN_PPPOE_PAY_QINQ, ICE_SW_TUN_PPPOE_IPV4_QINQ, ICE_SW_TUN_PPPOE_IPV6_QINQ, - ICE_SW_TUN_IPV4_GTPU_IPV4, - ICE_SW_TUN_IPV4_GTPU_IPV6, - ICE_SW_TUN_IPV6_GTPU_IPV4, - ICE_SW_TUN_IPV6_GTPU_IPV6, ICE_ALL_TUNNELS /* All tunnel types including NVGRE */ }; diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 3dc764266b..0090020a78 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -6522,7 +6522,7 @@ static const struct ice_prot_ext_tbl_entry ice_prot_ext[ICE_PROTOCOL_LAST] = { { ICE_GENEVE, { 8, 10, 12, 14 } }, { ICE_VXLAN_GPE, { 8, 10, 12, 14 } }, { ICE_NVGRE, { 0, 2, 4, 6 } }, - { ICE_GTP, { 8, 10, 12, 14, 16, 18, 20 } }, + { ICE_GTP, { 8, 10, 12, 14, 16, 18, 20, 22 } }, { ICE_PPPOE, { 0, 2, 4, 6 } }, { ICE_PFCP, { 8, 10, 12, 14, 16, 18, 20, 22 } }, { ICE_L2TPV3, { 0, 2, 4, 6, 8, 10 } }, @@ -7442,38 +7442,100 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo, case ICE_SW_IPV6_UDP: ice_set_bit(ICE_PROFID_IPV6_UDP, bm); return; + case ICE_SW_TUN_IPV4_GTPU_NO_PAY: + ice_set_bit(ICE_PROFID_IPV4_GTPU_TEID, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_NO_PAY: + ice_set_bit(ICE_PROFID_IPV6_GTPU_TEID, bm); + return; case ICE_SW_TUN_IPV4_GTPU_IPV4: - ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm); ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_OTHER, bm); - ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm); ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm); - ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm); ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm); return; + case ICE_SW_TUN_IPV4_GTPU_IPV4_UDP: + ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_UDP, bm); + return; + case ICE_SW_TUN_IPV4_GTPU_IPV4_TCP: + ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV4_TCP, bm); + return; + case ICE_SW_TUN_IPV4_GTPU_EH_IPV4: + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_OTHER, bm); + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm); + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm); + return; + case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP: + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_UDP, bm); + return; + case ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP: + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV4_TCP, bm); + return; case ICE_SW_TUN_IPV6_GTPU_IPV4: - ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm); ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_OTHER, bm); - ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm); ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm); - ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm); ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm); return; + case ICE_SW_TUN_IPV6_GTPU_IPV4_UDP: + ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_UDP, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_IPV4_TCP: + ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV4_TCP, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_EH_IPV4: + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_OTHER, bm); + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm); + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP: + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_UDP, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP: + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV4_TCP, bm); + return; case ICE_SW_TUN_IPV4_GTPU_IPV6: - ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm); ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_OTHER, bm); - ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm); ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm); - ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm); ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm); return; + case ICE_SW_TUN_IPV4_GTPU_IPV6_UDP: + ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_UDP, bm); + return; + case ICE_SW_TUN_IPV4_GTPU_IPV6_TCP: + ice_set_bit(ICE_PROFID_IPV4_GTPU_IPV6_TCP, bm); + return; + case ICE_SW_TUN_IPV4_GTPU_EH_IPV6: + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_OTHER, bm); + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm); + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm); + return; + case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP: + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_UDP, bm); + return; + case ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP: + ice_set_bit(ICE_PROFID_IPV4_GTPU_EH_IPV6_TCP, bm); + return; case ICE_SW_TUN_IPV6_GTPU_IPV6: - ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm); ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_OTHER, bm); - ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm); ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm); - ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm); ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm); return; + case ICE_SW_TUN_IPV6_GTPU_IPV6_UDP: + ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_UDP, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_IPV6_TCP: + ice_set_bit(ICE_PROFID_IPV6_GTPU_IPV6_TCP, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_EH_IPV6: + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_OTHER, bm); + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm); + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP: + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_UDP, bm); + return; + case ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP: + ice_set_bit(ICE_PROFID_IPV6_GTPU_EH_IPV6_TCP, bm); + return; case ICE_SW_TUN_AND_NON_TUN: case ICE_SW_TUN_AND_NON_TUN_QINQ: default: @@ -7872,6 +7934,102 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, return; } + if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4 || + tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4) { + *pkt = dummy_ipv4_gtpu_ipv4_packet; + *pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_packet); + *offsets = dummy_ipv4_gtpu_ipv4_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_UDP || + tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP) { + *pkt = dummy_ipv4_gtpu_ipv4_udp_packet; + *pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_udp_packet); + *offsets = dummy_ipv4_gtpu_ipv4_udp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4_TCP || + tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP) { + *pkt = dummy_ipv4_gtpu_ipv4_tcp_packet; + *pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_tcp_packet); + *offsets = dummy_ipv4_gtpu_ipv4_tcp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6 || + tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6) { + *pkt = dummy_ipv4_gtpu_ipv6_packet; + *pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_packet); + *offsets = dummy_ipv4_gtpu_ipv6_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_UDP || + tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP) { + *pkt = dummy_ipv4_gtpu_ipv6_udp_packet; + *pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_udp_packet); + *offsets = dummy_ipv4_gtpu_ipv6_udp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6_TCP || + tun_type == ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP) { + *pkt = dummy_ipv4_gtpu_ipv6_tcp_packet; + *pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_tcp_packet); + *offsets = dummy_ipv4_gtpu_ipv6_tcp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4 || + tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4) { + *pkt = dummy_ipv6_gtpu_ipv4_packet; + *pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_packet); + *offsets = dummy_ipv6_gtpu_ipv4_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_UDP || + tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP) { + *pkt = dummy_ipv6_gtpu_ipv4_udp_packet; + *pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_udp_packet); + *offsets = dummy_ipv6_gtpu_ipv4_udp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4_TCP || + tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP) { + *pkt = dummy_ipv6_gtpu_ipv4_tcp_packet; + *pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_tcp_packet); + *offsets = dummy_ipv6_gtpu_ipv4_tcp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6 || + tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6) { + *pkt = dummy_ipv6_gtpu_ipv6_packet; + *pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet); + *offsets = dummy_ipv6_gtpu_ipv6_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_UDP || + tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP) { + *pkt = dummy_ipv6_gtpu_ipv6_udp_packet; + *pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_udp_packet); + *offsets = dummy_ipv6_gtpu_ipv6_udp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV6_TCP || + tun_type == ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP) { + *pkt = dummy_ipv6_gtpu_ipv6_tcp_packet; + *pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_tcp_packet); + *offsets = dummy_ipv6_gtpu_ipv6_tcp_packet_offsets; + return; + } + if (tun_type == ICE_SW_TUN_PPPOE && ipv6) { *pkt = dummy_pppoe_ipv6_packet; *pkt_len = sizeof(dummy_pppoe_ipv6_packet); diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c index ada3ecf60b..27d5bcc325 100644 --- a/drivers/net/ice/ice_switch_filter.c +++ b/drivers/net/ice/ice_switch_filter.c @@ -137,6 +137,84 @@ #define ICE_SW_INSET_MAC_IPV6_PFCP ( \ ICE_SW_INSET_MAC_IPV6 | \ ICE_INSET_PFCP_S_FIELD | ICE_INSET_PFCP_SEID) +#define ICE_SW_INSET_MAC_IPV4_GTPU ( \ + ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID) +#define ICE_SW_INSET_MAC_IPV4_GTPU_EH ( \ + ICE_SW_INSET_MAC_IPV4 | ICE_INSET_GTPU_TEID | \ + ICE_INSET_GTPU_QFI) +#define ICE_SW_INSET_MAC_IPV6_GTPU ( \ + ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID) +#define ICE_SW_INSET_MAC_IPV6_GTPU_EH ( \ + ICE_SW_INSET_MAC_IPV6 | ICE_INSET_GTPU_TEID | \ + ICE_INSET_GTPU_QFI) +#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 ( \ + ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \ + ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST) +#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | ICE_INSET_GTPU_QFI) +#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 ( \ + ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \ + ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST) +#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | ICE_INSET_GTPU_QFI) +#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 ( \ + ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \ + ICE_INSET_TUN_IPV4_SRC | ICE_INSET_TUN_IPV4_DST) +#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | ICE_INSET_GTPU_QFI) +#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 ( \ + ICE_INSET_DMAC | ICE_INSET_GTPU_TEID | \ + ICE_INSET_TUN_IPV6_SRC | ICE_INSET_TUN_IPV6_DST) +#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | ICE_INSET_GTPU_QFI) +#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \ + ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \ + ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_IPV4 | \ + ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4 | \ + ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \ + ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \ + ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_IPV6 | \ + ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP ( \ + ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6 | \ + ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \ + ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \ + ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_IPV4 | \ + ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4 | \ + ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \ + ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \ + ICE_INSET_TUN_UDP_SRC_PORT | ICE_INSET_TUN_UDP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_TCP ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_IPV6 | \ + ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT) +#define ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP ( \ + ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6 | \ + ICE_INSET_TUN_TCP_SRC_PORT | ICE_INSET_TUN_TCP_DST_PORT) struct sw_meta { struct ice_adv_lkup_elem *list; @@ -198,6 +276,34 @@ ice_pattern_match_item ice_switch_pattern_dist_list[] = { {pattern_eth_qinq_pppoes_proto, ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_eth_qinq_pppoes_ipv4, ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_eth_qinq_pppoes_ipv6, ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu, ICE_SW_INSET_MAC_IPV4_GTPU, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh, ICE_SW_INSET_MAC_IPV4_GTPU_EH, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu, ICE_SW_INSET_MAC_IPV6_GTPU, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh, ICE_SW_INSET_MAC_IPV6_GTPU_EH, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv4, ICE_SW_INSET_MAC_IPV4_GTPU_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv4, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv4_udp, ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv4_udp, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv4_tcp, ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv4_tcp, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv6, ICE_SW_INSET_MAC_IPV4_GTPU_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv6, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv6_udp, ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv6_udp, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv6_tcp, ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv6_tcp, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv4, ICE_SW_INSET_MAC_IPV6_GTPU_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv4, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv4_udp, ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv4_udp, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv4_tcp, ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv4_tcp, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv6, ICE_SW_INSET_MAC_IPV6_GTPU_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv6, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv6_udp, ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv6_udp, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv6_tcp, ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv6_tcp, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, }; static struct @@ -251,6 +357,34 @@ ice_pattern_match_item ice_switch_pattern_perm_list[] = { {pattern_eth_qinq_pppoes_proto, ICE_SW_INSET_MAC_PPPOE_PROTO, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_eth_qinq_pppoes_ipv4, ICE_SW_INSET_MAC_PPPOE_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, {pattern_eth_qinq_pppoes_ipv6, ICE_SW_INSET_MAC_PPPOE_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu, ICE_SW_INSET_MAC_IPV4_GTPU, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh, ICE_SW_INSET_MAC_IPV4_GTPU_EH, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu, ICE_SW_INSET_MAC_IPV6_GTPU, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh, ICE_SW_INSET_MAC_IPV6_GTPU_EH, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv4, ICE_SW_INSET_MAC_IPV4_GTPU_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv4, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv4_udp, ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv4_udp, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv4_tcp, ICE_SW_INSET_MAC_IPV4_GTPU_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv4_tcp, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv6, ICE_SW_INSET_MAC_IPV4_GTPU_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv6, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv6_udp, ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv6_udp, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_ipv6_tcp, ICE_SW_INSET_MAC_IPV4_GTPU_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv4_gtpu_eh_ipv6_tcp, ICE_SW_INSET_MAC_IPV4_GTPU_EH_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv4, ICE_SW_INSET_MAC_IPV6_GTPU_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv4, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv4_udp, ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv4_udp, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv4_tcp, ICE_SW_INSET_MAC_IPV6_GTPU_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv4_tcp, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV4_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv6, ICE_SW_INSET_MAC_IPV6_GTPU_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv6, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv6_udp, ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv6_udp, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_ipv6_tcp, ICE_SW_INSET_MAC_IPV6_GTPU_IPV6_UDP, ICE_INSET_NONE, ICE_INSET_NONE}, + {pattern_eth_ipv6_gtpu_eh_ipv6_tcp, ICE_SW_INSET_MAC_IPV6_GTPU_EH_IPV6_TCP, ICE_INSET_NONE, ICE_INSET_NONE}, }; static int @@ -378,6 +512,8 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], const struct rte_flow_item_ah *ah_spec, *ah_mask; const struct rte_flow_item_l2tpv3oip *l2tp_spec, *l2tp_mask; const struct rte_flow_item_pfcp *pfcp_spec, *pfcp_mask; + const struct rte_flow_item_gtp *gtp_spec, *gtp_mask; + const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask; uint64_t input_set = ICE_INSET_NONE; uint16_t input_set_byte = 0; bool pppoe_elem_valid = 0; @@ -393,7 +529,13 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], bool ipv4_valid = 0; bool udp_valid = 0; bool tcp_valid = 0; - uint16_t j, t = 0; + bool gtpu_valid = 0; + bool gtpu_psc_valid = 0; + bool inner_ipv4_valid = 0; + bool inner_ipv6_valid = 0; + bool inner_tcp_valid = 0; + bool inner_udp_valid = 0; + uint16_t j, k, t = 0; for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { @@ -479,7 +621,11 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], case RTE_FLOW_ITEM_TYPE_IPV4: ipv4_spec = item->spec; ipv4_mask = item->mask; - ipv4_valid = 1; + if (tunnel_valid) + inner_ipv4_valid = 1; + else + ipv4_valid = 1; + if (ipv4_spec && ipv4_mask) { /* Check IPv4 mask and update input set */ if (ipv4_mask->hdr.version_ihl || @@ -571,7 +717,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], case RTE_FLOW_ITEM_TYPE_IPV6: ipv6_spec = item->spec; ipv6_mask = item->mask; - ipv6_valid = 1; + if (tunnel_valid) + inner_ipv6_valid = 1; + else + ipv6_valid = 1; if (ipv6_spec && ipv6_mask) { if (ipv6_mask->hdr.payload_len) { rte_flow_error_set(error, EINVAL, @@ -689,7 +838,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], case RTE_FLOW_ITEM_TYPE_UDP: udp_spec = item->spec; udp_mask = item->mask; - udp_valid = 1; + if (tunnel_valid) + inner_udp_valid = 1; + else + udp_valid = 1; if (udp_spec && udp_mask) { /* Check UDP mask and update input set*/ if (udp_mask->hdr.dgram_len || @@ -742,7 +894,10 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], case RTE_FLOW_ITEM_TYPE_TCP: tcp_spec = item->spec; tcp_mask = item->mask; - tcp_valid = 1; + if (tunnel_valid) + inner_tcp_valid = 1; + else + tcp_valid = 1; if (tcp_spec && tcp_mask) { /* Check TCP mask and update input set */ if (tcp_mask->hdr.sent_seq || @@ -1255,6 +1410,71 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], } break; + case RTE_FLOW_ITEM_TYPE_GTPU: + gtp_spec = item->spec; + gtp_mask = item->mask; + if (gtp_spec && !gtp_mask) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid GTP item"); + return 0; + } + if (gtp_spec && gtp_mask) { + if (gtp_mask->v_pt_rsv_flags || + gtp_mask->msg_type || + gtp_mask->msg_len) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid GTP mask"); + return 0; + } + if (gtp_mask->teid) + input_set |= ICE_INSET_GTPU_TEID; + list[t].type = ICE_GTP; + list[t].h_u.gtp_hdr.teid = + gtp_spec->teid; + list[t].m_u.gtp_hdr.teid = + gtp_mask->teid; + input_set_byte += 4; + t++; + } + tunnel_valid = 1; + gtpu_valid = 1; + break; + + case RTE_FLOW_ITEM_TYPE_GTP_PSC: + gtp_psc_spec = item->spec; + gtp_psc_mask = item->mask; + if (gtp_psc_spec && !gtp_psc_mask) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid GTPU_EH item"); + return 0; + } + if (gtp_psc_spec && gtp_psc_mask) { + if (gtp_psc_mask->pdu_type) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, + "Invalid GTPU_EH mask"); + return 0; + } + if (gtp_psc_mask->qfi) + input_set |= ICE_INSET_GTPU_QFI; + list[t].type = ICE_GTP; + list[t].h_u.gtp_hdr.qfi = + gtp_psc_spec->qfi; + list[t].m_u.gtp_hdr.qfi = + gtp_psc_mask->qfi; + input_set_byte += 1; + t++; + } + gtpu_psc_valid = 1; + break; + case RTE_FLOW_ITEM_TYPE_VOID: break; @@ -1302,6 +1522,74 @@ ice_switch_inset_get(const struct rte_flow_item pattern[], *tun_type = ICE_SW_TUN_PPPOE; } + if (gtpu_valid && gtpu_psc_valid) { + if (ipv4_valid && inner_ipv4_valid && inner_udp_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_UDP; + else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4_TCP; + else if (ipv4_valid && inner_ipv4_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV4; + else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_UDP; + else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6_TCP; + else if (ipv4_valid && inner_ipv6_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_EH_IPV6; + else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_UDP; + else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4_TCP; + else if (ipv6_valid && inner_ipv4_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV4; + else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_UDP; + else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6_TCP; + else if (ipv6_valid && inner_ipv6_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_EH_IPV6; + else if (ipv4_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY; + else if (ipv6_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY; + } else if (gtpu_valid) { + if (ipv4_valid && inner_ipv4_valid && inner_udp_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_UDP; + else if (ipv4_valid && inner_ipv4_valid && inner_tcp_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4_TCP; + else if (ipv4_valid && inner_ipv4_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_IPV4; + else if (ipv4_valid && inner_ipv6_valid && inner_udp_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_UDP; + else if (ipv4_valid && inner_ipv6_valid && inner_tcp_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6_TCP; + else if (ipv4_valid && inner_ipv6_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_IPV6; + else if (ipv6_valid && inner_ipv4_valid && inner_udp_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_UDP; + else if (ipv6_valid && inner_ipv4_valid && inner_tcp_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4_TCP; + else if (ipv6_valid && inner_ipv4_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_IPV4; + else if (ipv6_valid && inner_ipv6_valid && inner_udp_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_UDP; + else if (ipv6_valid && inner_ipv6_valid && inner_tcp_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6_TCP; + else if (ipv6_valid && inner_ipv6_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_IPV6; + else if (ipv4_valid) + *tun_type = ICE_SW_TUN_IPV4_GTPU_NO_PAY; + else if (ipv6_valid) + *tun_type = ICE_SW_TUN_IPV6_GTPU_NO_PAY; + } + + if (*tun_type == ICE_SW_TUN_IPV4_GTPU_NO_PAY || + *tun_type == ICE_SW_TUN_IPV6_GTPU_NO_PAY) { + for (k = 0; k < t; k++) { + if (list[k].type == ICE_GTP) + list[k].type = ICE_GTP_NO_PAY; + } + } + if (*tun_type == ICE_NON_TUN) { if (vxlan_valid) *tun_type = ICE_SW_TUN_VXLAN; -- 2.25.1