From patchwork Tue Mar 2 07:23:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 88355 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 983A9A054F; Tue, 2 Mar 2021 08:21:01 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F93A1CC4DC; Tue, 2 Mar 2021 08:20:33 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id BD2701CC56F for ; Tue, 2 Mar 2021 08:20:30 +0100 (CET) IronPort-SDR: 4NwL1cyOKLVJRWTrNVE9G9n82bpscrutJUvRU6rZDkV2mPA8HeVjSF47+HXlGXSGs7XCIzv8yy /cflZlY8umTw== X-IronPort-AV: E=McAfee;i="6000,8403,9910"; a="186775287" X-IronPort-AV: E=Sophos;i="5.81,216,1610438400"; d="scan'208";a="186775287" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2021 23:20:30 -0800 IronPort-SDR: XVBGlUC54gv4il33Jcd9bML/8VvnzUVWMA8uxsVGye0NxmxbWhjxPigXQEYJto45y+R9VlmoPc KIxVt40zF3pA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,216,1610438400"; d="scan'208";a="506230328" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga001.fm.intel.com with ESMTP; 01 Mar 2021 23:20:27 -0800 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, haiyue.wang@intel.com, junfeng.guo@intel.com, Qi Zhang , Kiran Patil Date: Tue, 2 Mar 2021 15:23:50 +0800 Message-Id: <20210302072357.1657556-8-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210302072357.1657556-1-qi.z.zhang@intel.com> References: <20210302072357.1657556-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 07/14] net/ice/base: support for switch filter (GTP tunnel+IP flow) 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" Enabled support for advanced switch filter to satisfy match criteria such as: GTP tunnel + Inner IPv4[6] Signed-off-by: Kiran Patil Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_protocol_type.h | 8 +- drivers/net/ice/base/ice_switch.c | 114 ++++++++++++----------- 2 files changed, 63 insertions(+), 59 deletions(-) diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index d769ad0580..ee1f29d41f 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -75,10 +75,6 @@ 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_IPV6, - ICE_SW_TUN_IPV6_GTPU_IPV4, - ICE_SW_TUN_IPV6_GTPU_IPV6, ICE_SW_TUN_PPPOE, ICE_SW_TUN_PPPOE_PAY, ICE_SW_TUN_PPPOE_IPV4, @@ -109,6 +105,10 @@ 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 4568242c10..2d0dd4b28c 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -912,39 +912,7 @@ static const u8 dummy_ipv6_gtpu_ipv6_udp_packet[] = { 0x00, 0x00, /* 2 bytes for 4 byte alignment */ }; -static const struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = { - { ICE_MAC_OFOS, 0 }, - { ICE_IPV4_OFOS, 14 }, - { ICE_UDP_OF, 34 }, - { ICE_GTP, 42 }, - { ICE_PROTOCOL_LAST, 0 }, -}; - -static const u8 dummy_udp_gtp_packet[] = { - 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x08, 0x00, - - 0x45, 0x00, 0x00, 0x30, /* ICE_IPV4_OFOS 14 */ - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x11, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, - - 0x00, 0x00, 0x08, 0x68, /* ICE_UDP_OF 34 */ - 0x00, 0x1c, 0x00, 0x00, - - 0x34, 0xff, 0x00, 0x0c, /* ICE_GTP 42 */ - 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x85, - - 0x02, 0x00, 0x00, 0x00, /* PDU Session extension header */ - 0x00, 0x00, 0x00, 0x00, -}; - -static const -struct ice_dummy_pkt_offsets dummy_ipv4_gtpu_ipv4_packet_offsets[] = { +static const struct ice_dummy_pkt_offsets dummy_ipv4_gtpu_ipv4_packet_offsets[] = { { ICE_MAC_OFOS, 0 }, { ICE_IPV4_OFOS, 14 }, { ICE_UDP_OF, 34 }, @@ -1126,8 +1094,38 @@ static const u8 dummy_ipv6_gtpu_ipv6_packet[] = { 0x00, 0x00, }; -static const -struct ice_dummy_pkt_offsets dummy_ipv4_gtp_no_pay_packet_offsets[] = { +static const struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_IPV4_OFOS, 14 }, + { ICE_UDP_OF, 34 }, + { ICE_GTP, 42 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +static const u8 dummy_udp_gtp_packet[] = { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, + + 0x45, 0x00, 0x00, 0x30, /* ICE_IPV4_OFOS 14 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x11, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x08, 0x68, /* ICE_UDP_OF 34 */ + 0x00, 0x1c, 0x00, 0x00, + + 0x34, 0xff, 0x00, 0x0c, /* ICE_GTP 42 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x85, + + 0x02, 0x00, 0x00, 0x00, /* PDU Session extension header */ + 0x00, 0x00, 0x00, 0x00, +}; + +static const struct ice_dummy_pkt_offsets dummy_ipv4_gtp_no_pay_packet_offsets[] = { { ICE_MAC_OFOS, 0 }, { ICE_IPV4_OFOS, 14 }, { ICE_UDP_OF, 34 }, @@ -7808,26 +7806,6 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, *pkt_len = sizeof(dummy_ipv6_gtpu_ipv6_packet); *offsets = dummy_ipv6_gtp_no_pay_packet_offsets; return; - } else if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV4) { - *pkt = dummy_ipv4_gtpu_ipv4_packet; - *pkt_len = sizeof(dummy_ipv4_gtpu_ipv4_packet); - *offsets = dummy_ipv4_gtpu_ipv4_packet_offsets; - return; - } else if (tun_type == ICE_SW_TUN_IPV4_GTPU_IPV6) { - *pkt = dummy_ipv4_gtpu_ipv6_packet; - *pkt_len = sizeof(dummy_ipv4_gtpu_ipv6_packet); - *offsets = dummy_ipv4_gtpu_ipv6_packet_offsets; - return; - } else if (tun_type == ICE_SW_TUN_IPV6_GTPU_IPV4) { - *pkt = dummy_ipv6_gtpu_ipv4_packet; - *pkt_len = sizeof(dummy_ipv6_gtpu_ipv4_packet); - *offsets = dummy_ipv6_gtpu_ipv4_packet_offsets; - return; - } else if (tun_type == ICE_SW_TUN_IPV6_GTPU_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_IPV4_ESP) { @@ -7976,6 +7954,32 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, return; } + /* Support GTP tunnel + L3 */ + if (tun_type == ICE_SW_TUN_IPV4_GTPU_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_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_IPV6_GTPU_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_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_ALL_TUNNELS) { *pkt = dummy_gre_udp_packet; *pkt_len = sizeof(dummy_gre_udp_packet);