From patchwork Wed Jun 3 02:40:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qi Zhang X-Patchwork-Id: 70810 X-Patchwork-Delegate: xiaolong.ye@intel.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08B4BA04EF; Wed, 3 Jun 2020 04:44:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4F8401D5F0; Wed, 3 Jun 2020 04:38:03 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id CF42F1D5E2 for ; Wed, 3 Jun 2020 04:38:00 +0200 (CEST) IronPort-SDR: qv5F0NLjC/9fqhdwPSe2cmG6xR7Me8jsp9F26A7ePWGOwTYXMn1YLVpy6HUceGft9cfFn4lFo/ V3Kqn0OyGeeA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2020 19:38:00 -0700 IronPort-SDR: 9Jm8zSQ6iAvW1gsIYohSjz/TathQfcDFw4Ql7KpndecdggnuRapNhIpgf03r71Gh++S81i7TGz jZf4YYaub+AQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,466,1583222400"; d="scan'208";a="347614346" Received: from dpdk51.sh.intel.com ([10.67.111.82]) by orsmga001.jf.intel.com with ESMTP; 02 Jun 2020 19:37:58 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: dev@dpdk.org, xiaolong.ye@intel.com, Qi Zhang , Wei Zhao , "Paul M . Stillwell Jr" Date: Wed, 3 Jun 2020 10:40:12 +0800 Message-Id: <20200603024016.30636-49-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20200603024016.30636-1-qi.z.zhang@intel.com> References: <20200603024016.30636-1-qi.z.zhang@intel.com> Subject: [dpdk-dev] [PATCH 48/52] net/ice/base: add more tunnel type for IPv4 and IPv6 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" This patch add more tunnel type defination ipv4/ipv6 packet, it enable tcp/udp layer of ipv4/ipv6 as L4 payload but without L4 dst/src port number as input set for switch filter rule. For example: we can download a switch rule to direct ipv4 packet with specific source and destination ip address to queue index 1. "eth / ipv4 src is 192.168.0.1 dst is 192.168.0.2 / udp / end actions queue index 1 / end" this type of rule will be matched with ipv4/udp file only. Signed-off-by: Wei Zhao Signed-off-by: Paul M. Stillwell Jr Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_protocol_type.h | 4 ++++ drivers/net/ice/base/ice_switch.c | 40 ++++++++++++++++++++++++++++++++ drivers/net/ice/base/ice_switch.h | 4 ++++ 3 files changed, 48 insertions(+) diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index 85af7513c..7cc44c172 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -66,6 +66,10 @@ enum ice_sw_tunnel_type { ICE_SW_TUN_UDP, /* This means all "UDP" tunnel types: VXLAN-GPE, VXLAN * and GENEVE */ + ICE_SW_IPV4_TCP, + ICE_SW_IPV4_UDP, + ICE_SW_IPV6_TCP, + ICE_SW_IPV6_UDP, ICE_SW_TUN_GTP, ICE_SW_TUN_PPPOE, ICE_SW_TUN_PPPOE_PAY, diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index 9c7e55ff9..1b1693dbb 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -6357,6 +6357,18 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo, case ICE_SW_TUN_IPV4_AH: ice_set_bit(ICE_PROFID_IPV4_AH, bm); return; + case ICE_SW_IPV4_TCP: + ice_set_bit(ICE_PROFID_IPV4_TCP, bm); + return; + case ICE_SW_IPV4_UDP: + ice_set_bit(ICE_PROFID_IPV4_UDP, bm); + return; + case ICE_SW_IPV6_TCP: + ice_set_bit(ICE_PROFID_IPV6_TCP, bm); + return; + case ICE_SW_IPV6_UDP: + ice_set_bit(ICE_PROFID_IPV6_UDP, bm); + return; case ICE_SW_TUN_AND_NON_TUN: default: prof_type = ICE_PROF_ALL; @@ -6771,6 +6783,34 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, return; } + if (tun_type == ICE_SW_IPV4_TCP) { + *pkt = dummy_tcp_packet; + *pkt_len = sizeof(dummy_tcp_packet); + *offsets = dummy_tcp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_IPV4_UDP) { + *pkt = dummy_udp_packet; + *pkt_len = sizeof(dummy_udp_packet); + *offsets = dummy_udp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_IPV6_TCP) { + *pkt = dummy_tcp_ipv6_packet; + *pkt_len = sizeof(dummy_tcp_ipv6_packet); + *offsets = dummy_tcp_ipv6_packet_offsets; + return; + } + + if (tun_type == ICE_SW_IPV6_UDP) { + *pkt = dummy_udp_ipv6_packet; + *pkt_len = sizeof(dummy_udp_ipv6_packet); + *offsets = dummy_udp_ipv6_packet_offsets; + return; + } + if (tun_type == ICE_ALL_TUNNELS) { *pkt = dummy_gre_udp_packet; *pkt_len = sizeof(dummy_gre_udp_packet); diff --git a/drivers/net/ice/base/ice_switch.h b/drivers/net/ice/base/ice_switch.h index bd634f98f..1ba85b16b 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -16,6 +16,10 @@ #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX) /* Switch Profile IDs for Profile related switch rules */ +#define ICE_PROFID_IPV4_TCP 4 +#define ICE_PROFID_IPV4_UDP 5 +#define ICE_PROFID_IPV6_TCP 7 +#define ICE_PROFID_IPV6_UDP 8 #define ICE_PROFID_PPPOE_PAY 34 #define ICE_PROFID_PPPOE_IPV4_TCP 35 #define ICE_PROFID_PPPOE_IPV4_UDP 36