From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 61266A04EF; Wed, 3 Jun 2020 04:41:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A0DB1D178; Wed, 3 Jun 2020 04:37:24 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id BE0DD1D172 for ; Wed, 3 Jun 2020 04:37:22 +0200 (CEST) IronPort-SDR: useMsAIkWsebrAOMI5kxwSdMTIXuhv2Nh/IJtswJ+wSvXDQtsEmjePWpanddKi2bd5h64XpyUi 2zlsSUWVKNug== 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:37:22 -0700 IronPort-SDR: dOimqeJ/60ccNf+6hu1xVb5y01kbnFWBeZexPVKvv+BqCx2lc3bJRH43YHk8F3XHirOUvXMdhe q+0P7twTrkdg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,466,1583222400"; d="scan'208";a="347614111" Received: from dpdk51.sh.intel.com ([10.67.111.82]) by orsmga001.jf.intel.com with ESMTP; 02 Jun 2020 19:37:20 -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:39:54 +0800 Message-Id: <20200603024016.30636-31-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 30/52] net/ice/base: add support for more PPPoE packet type 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 dummy packet type for pppoe packet, it enable tcp/udp layer of ipv4/ipv6 for pppoe payload, so we can use L4 dst/src port as input set for switch filter. 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 | 7 + drivers/net/ice/base/ice_switch.c | 252 ++++++++++++++++++++++++++++++- drivers/net/ice/base/ice_switch.h | 7 + 3 files changed, 265 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/base/ice_protocol_type.h b/drivers/net/ice/base/ice_protocol_type.h index 964561d23..85af7513c 100644 --- a/drivers/net/ice/base/ice_protocol_type.h +++ b/drivers/net/ice/base/ice_protocol_type.h @@ -68,6 +68,13 @@ enum ice_sw_tunnel_type { */ ICE_SW_TUN_GTP, ICE_SW_TUN_PPPOE, + ICE_SW_TUN_PPPOE_PAY, + ICE_SW_TUN_PPPOE_IPV4, + ICE_SW_TUN_PPPOE_IPV4_TCP, + ICE_SW_TUN_PPPOE_IPV4_UDP, + ICE_SW_TUN_PPPOE_IPV6, + ICE_SW_TUN_PPPOE_IPV6_TCP, + ICE_SW_TUN_PPPOE_IPV6_UDP, ICE_SW_TUN_IPV4_ESP, ICE_SW_TUN_IPV6_ESP, ICE_SW_TUN_IPV4_AH, diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c index fa3a59e51..94268d560 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -542,6 +542,15 @@ static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_offsets[] = { { ICE_PROTOCOL_LAST, 0 }, }; +static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv4_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14}, + { ICE_PPPOE, 18 }, + { ICE_IPV4_OFOS, 26 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + static const u8 dummy_pppoe_ipv4_packet[] = { 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ 0x00, 0x00, 0x00, 0x00, @@ -565,6 +574,92 @@ static const u8 dummy_pppoe_ipv4_packet[] = { 0x00, 0x00, /* 2 bytes for 4 bytes alignment */ }; +static const +struct ice_dummy_pkt_offsets dummy_pppoe_ipv4_tcp_packet_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14}, + { ICE_PPPOE, 18 }, + { ICE_IPV4_OFOS, 26 }, + { ICE_TCP_IL, 46 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +static const u8 dummy_pppoe_ipv4_tcp_packet[] = { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x81, 0x00, /* ICE_ETYPE_OL 12 */ + + 0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */ + + 0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */ + 0x00, 0x16, + + 0x00, 0x21, /* PPP Link Layer 24 */ + + 0x45, 0x00, 0x00, 0x28, /* ICE_IPV4_OFOS 26 */ + 0x00, 0x01, 0x00, 0x00, + 0x00, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 46 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, /* 2 bytes for 4 bytes alignment */ +}; + +static const +struct ice_dummy_pkt_offsets dummy_pppoe_ipv4_udp_packet_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14}, + { ICE_PPPOE, 18 }, + { ICE_IPV4_OFOS, 26 }, + { ICE_UDP_ILOS, 46 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +static const u8 dummy_pppoe_ipv4_udp_packet[] = { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x81, 0x00, /* ICE_ETYPE_OL 12 */ + + 0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */ + + 0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */ + 0x00, 0x16, + + 0x00, 0x21, /* PPP Link Layer 24 */ + + 0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_OFOS 26 */ + 0x00, 0x01, 0x00, 0x00, + 0x00, 0x11, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 46 */ + 0x00, 0x08, 0x00, 0x00, + + 0x00, 0x00, /* 2 bytes for 4 bytes alignment */ +}; + +static const struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv6_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14}, + { ICE_PPPOE, 18 }, + { ICE_IPV6_OFOS, 26 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + static const u8 dummy_pppoe_ipv6_packet[] = { 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ 0x00, 0x00, 0x00, 0x00, @@ -593,6 +688,93 @@ static const u8 dummy_pppoe_ipv6_packet[] = { 0x00, 0x00, /* 2 bytes for 4 bytes alignment */ }; +static const +struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv6_tcp_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14}, + { ICE_PPPOE, 18 }, + { ICE_IPV6_OFOS, 26 }, + { ICE_TCP_IL, 66 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +static const u8 dummy_pppoe_ipv6_tcp_packet[] = { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x81, 0x00, /* ICE_ETYPE_OL 12 */ + + 0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */ + + 0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */ + 0x00, 0x2a, + + 0x00, 0x57, /* PPP Link Layer 24 */ + + 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 26 */ + 0x00, 0x14, 0x06, 0x00, /* Next header is TCP */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 66 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, /* 2 bytes for 4 bytes alignment */ +}; + +static const +struct ice_dummy_pkt_offsets dummy_pppoe_packet_ipv6_udp_offsets[] = { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14}, + { ICE_PPPOE, 18 }, + { ICE_IPV6_OFOS, 26 }, + { ICE_UDP_ILOS, 66 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +static const u8 dummy_pppoe_ipv6_udp_packet[] = { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x81, 0x00, /* ICE_ETYPE_OL 12 */ + + 0x00, 0x00, 0x88, 0x64, /* ICE_VLAN_OFOS 14 */ + + 0x11, 0x00, 0x00, 0x00, /* ICE_PPPOE 18 */ + 0x00, 0x2a, + + 0x00, 0x57, /* PPP Link Layer 24 */ + + 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 26 */ + 0x00, 0x08, 0x11, 0x00, /* Next header UDP*/ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 66 */ + 0x00, 0x08, 0x00, 0x00, + + 0x00, 0x00, /* 2 bytes for 4 bytes alignment */ +}; + static const struct ice_dummy_pkt_offsets dummy_ipv4_esp_packet_offsets[] = { { ICE_MAC_OFOS, 0 }, { ICE_IPV4_OFOS, 14 }, @@ -6123,6 +6305,31 @@ ice_get_compat_fv_bitmap(struct ice_hw *hw, struct ice_adv_rule_info *rinfo, case ICE_SW_TUN_PPPOE: prof_type = ICE_PROF_TUN_PPPOE; break; + case ICE_SW_TUN_PPPOE_PAY: + ice_set_bit(ICE_PROFID_PPPOE_PAY, bm); + return; + case ICE_SW_TUN_PPPOE_IPV4: + ice_set_bit(ICE_PROFID_PPPOE_IPV4_OTHER, bm); + ice_set_bit(ICE_PROFID_PPPOE_IPV4_UDP, bm); + ice_set_bit(ICE_PROFID_PPPOE_IPV4_TCP, bm); + return; + case ICE_SW_TUN_PPPOE_IPV4_TCP: + ice_set_bit(ICE_PROFID_PPPOE_IPV4_TCP, bm); + return; + case ICE_SW_TUN_PPPOE_IPV4_UDP: + ice_set_bit(ICE_PROFID_PPPOE_IPV4_UDP, bm); + return; + case ICE_SW_TUN_PPPOE_IPV6: + ice_set_bit(ICE_PROFID_PPPOE_IPV6_OTHER, bm); + ice_set_bit(ICE_PROFID_PPPOE_IPV6_UDP, bm); + ice_set_bit(ICE_PROFID_PPPOE_IPV6_TCP, bm); + return; + case ICE_SW_TUN_PPPOE_IPV6_TCP: + ice_set_bit(ICE_PROFID_PPPOE_IPV6_TCP, bm); + return; + case ICE_SW_TUN_PPPOE_IPV6_UDP: + ice_set_bit(ICE_PROFID_PPPOE_IPV6_UDP, bm); + return; case ICE_SW_TUN_PROFID_IPV6_ESP: case ICE_SW_TUN_IPV6_ESP: ice_set_bit(ICE_PROFID_IPV6_ESP, bm); @@ -6527,13 +6734,56 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups, u16 lkups_cnt, *pkt_len = sizeof(dummy_pppoe_ipv6_packet); *offsets = dummy_pppoe_packet_offsets; return; - } else if (tun_type == ICE_SW_TUN_PPPOE) { + } else if (tun_type == ICE_SW_TUN_PPPOE || + tun_type == ICE_SW_TUN_PPPOE_PAY) { *pkt = dummy_pppoe_ipv4_packet; *pkt_len = sizeof(dummy_pppoe_ipv4_packet); *offsets = dummy_pppoe_packet_offsets; return; } + if (tun_type == ICE_SW_TUN_PPPOE_IPV4) { + *pkt = dummy_pppoe_ipv4_packet; + *pkt_len = sizeof(dummy_pppoe_ipv4_packet); + *offsets = dummy_pppoe_packet_ipv4_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_PPPOE_IPV4_TCP) { + *pkt = dummy_pppoe_ipv4_tcp_packet; + *pkt_len = sizeof(dummy_pppoe_ipv4_tcp_packet); + *offsets = dummy_pppoe_ipv4_tcp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_PPPOE_IPV4_UDP) { + *pkt = dummy_pppoe_ipv4_udp_packet; + *pkt_len = sizeof(dummy_pppoe_ipv4_udp_packet); + *offsets = dummy_pppoe_ipv4_udp_packet_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_PPPOE_IPV6) { + *pkt = dummy_pppoe_ipv6_packet; + *pkt_len = sizeof(dummy_pppoe_ipv6_packet); + *offsets = dummy_pppoe_packet_ipv6_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_PPPOE_IPV6_TCP) { + *pkt = dummy_pppoe_ipv6_tcp_packet; + *pkt_len = sizeof(dummy_pppoe_ipv6_tcp_packet); + *offsets = dummy_pppoe_packet_ipv6_tcp_offsets; + return; + } + + if (tun_type == ICE_SW_TUN_PPPOE_IPV6_UDP) { + *pkt = dummy_pppoe_ipv6_udp_packet; + *pkt_len = sizeof(dummy_pppoe_ipv6_udp_packet); + *offsets = dummy_pppoe_packet_ipv6_udp_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 8c7e98bfa..bd634f98f 100644 --- a/drivers/net/ice/base/ice_switch.h +++ b/drivers/net/ice/base/ice_switch.h @@ -16,6 +16,13 @@ #define ICE_FLTR_TX_RX (ICE_FLTR_RX | ICE_FLTR_TX) /* Switch Profile IDs for Profile related switch rules */ +#define ICE_PROFID_PPPOE_PAY 34 +#define ICE_PROFID_PPPOE_IPV4_TCP 35 +#define ICE_PROFID_PPPOE_IPV4_UDP 36 +#define ICE_PROFID_PPPOE_IPV4_OTHER 37 +#define ICE_PROFID_PPPOE_IPV6_TCP 38 +#define ICE_PROFID_PPPOE_IPV6_UDP 39 +#define ICE_PROFID_PPPOE_IPV6_OTHER 40 #define ICE_PROFID_IPV4_ESP 71 #define ICE_PROFID_IPV6_ESP 72 #define ICE_PROFID_IPV4_AH 73 -- 2.13.6