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 0C3FEA04F1; Mon, 6 Jan 2020 16:11:28 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2E4031D6A2; Mon, 6 Jan 2020 16:11:27 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 18E8F1D581 for ; Mon, 6 Jan 2020 05:00:58 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jan 2020 20:00:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,401,1571727600"; d="scan'208";a="370150268" Received: from orsmsx105.amr.corp.intel.com ([10.22.225.132]) by orsmga004.jf.intel.com with ESMTP; 05 Jan 2020 20:00:57 -0800 Received: from orsmsx155.amr.corp.intel.com (10.22.240.21) by ORSMSX105.amr.corp.intel.com (10.22.225.132) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 5 Jan 2020 20:00:57 -0800 Received: from orsmsx111.amr.corp.intel.com ([169.254.12.24]) by ORSMSX155.amr.corp.intel.com ([169.254.7.176]) with mapi id 14.03.0439.000; Sun, 5 Jan 2020 20:00:57 -0800 From: "Patil, Kiran" To: "Zhang, Qi Z" , "Yang, Qiming" CC: "dev@dpdk.org" , "Ye, Xiaolong" , "Stillwell Jr, Paul M" Thread-Topic: [PATCH v2 02/12] net/ice/base: support MAC/VLAN with TCP/UDP in switch Thread-Index: AQHVxEJjJ1ZBQPHOeU2MttxYjSGG/qfdAyVg Date: Mon, 6 Jan 2020 04:00:57 +0000 Message-ID: <4197C471DCF8714FBA1FE32565271C1401486B17FA@ORSMSX111.amr.corp.intel.com> References: <20191205123847.39579-1-qi.z.zhang@intel.com> <20200106033851.43978-1-qi.z.zhang@intel.com> <20200106033851.43978-3-qi.z.zhang@intel.com> In-Reply-To: <20200106033851.43978-3-qi.z.zhang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNmE5OWEzNGQtYTU3OC00MDBjLTg5NDMtYzlmNTBlZmIxOTIxIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiRmNveWVDYzUyRFFJS1pYelZXRWJvY0UrdDhnZ3p4aXU2OUdBWUF1YU56OXV3cVk2N2VkbkMraWw2RkxNcTlyMSJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.22.254.139] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailman-Approved-At: Mon, 06 Jan 2020 16:11:25 +0100 Subject: Re: [dpdk-dev] [PATCH v2 02/12] net/ice/base: support MAC/VLAN with TCP/UDP in switch 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" ACK -----Original Message----- From: Zhang, Qi Z =20 Sent: Sunday, January 5, 2020 7:39 PM To: Yang, Qiming Cc: dev@dpdk.org; Ye, Xiaolong ; Zhang, Qi Z ; Patil, Kiran ; Stillwell Jr, Paul M= Subject: [PATCH v2 02/12] net/ice/base: support MAC/VLAN with TCP/UDP in sw= itch Add a feature to allow user to add switch filter using input like MAC + VLA= N (C-tag only) + L4 (TCP/UDP) port. API "ice_add_adv_rule" is extended to handle this filter type. Signed-off-by: Kiran Patil Signed-off-by: Paul M Stillwell Jr Signed-off-by: Qi Zhang Acked-by: Qiming Yang --- drivers/net/ice/base/ice_switch.c | 206 ++++++++++++++++++++++++++++++++++= ---- 1 file changed, 188 insertions(+), 18 deletions(-) diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_s= witch.c index afa4fe30d..f8f5fde3c 100644 --- a/drivers/net/ice/base/ice_switch.c +++ b/drivers/net/ice/base/ice_switch.c @@ -251,8 +251,8 @@ u8 dummy_udp_tun_udp_packet[] =3D { 0x00, 0x08, 0x00, 0x00, }; =20 -static const -struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[] =3D { +/* offset info for MAC + IPv4 + UDP dummy packet */ static const struct=20 +ice_dummy_pkt_offsets dummy_udp_packet_offsets[] =3D { { ICE_MAC_OFOS, 0 }, { ICE_ETYPE_OL, 12 }, { ICE_IPV4_OFOS, 14 }, @@ -260,8 +260,8 @@ struct ice_dummy_pkt_offsets dummy_udp_packet_offsets[]= =3D { { ICE_PROTOCOL_LAST, 0 }, }; =20 -static const u8 -dummy_udp_packet[] =3D { +/* Dummy packet for MAC + IPv4 + UDP */ static const u8=20 +dummy_udp_packet[] =3D { 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -280,8 +280,40 @@ dummy_udp_packet[] =3D { 0x00, 0x00, /* 2 bytes for 4 byte alignment */ }; =20 -static const -struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] =3D { +/* offset info for MAC + VLAN + IPv4 + UDP dummy packet */ static const=20 +struct ice_dummy_pkt_offsets dummy_vlan_udp_packet_offsets[] =3D { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14 }, + { ICE_IPV4_OFOS, 18 }, + { ICE_UDP_ILOS, 38 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +/* C-tag (801.1Q), IPv4:UDP dummy packet */ static const u8=20 +dummy_vlan_udp_packet[] =3D { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x81, 0x00, /* ICE_ETYPE_OL 12 */ + + 0x00, 0x00, 0x08, 0x00, /* ICE_VLAN_OFOS 14 */ + + 0x45, 0x00, 0x00, 0x1c, /* ICE_IPV4_OFOS 18 */ + 0x00, 0x01, 0x00, 0x00, + 0x00, 0x11, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, /* ICE_UDP_ILOS 38 */ + 0x00, 0x08, 0x00, 0x00, + + 0x00, 0x00, /* 2 bytes for 4 byte alignment */ +}; + +/* offset info for MAC + IPv4 + TCP dummy packet */ static const struct=20 +ice_dummy_pkt_offsets dummy_tcp_packet_offsets[] =3D { { ICE_MAC_OFOS, 0 }, { ICE_ETYPE_OL, 12 }, { ICE_IPV4_OFOS, 14 }, @@ -289,8 +321,8 @@ struct ice_dummy_pkt_offsets dummy_tcp_packet_offsets[]= =3D { { ICE_PROTOCOL_LAST, 0 }, }; =20 -static const u8 -dummy_tcp_packet[] =3D { +/* Dummy packet for MAC + IPv4 + TCP */ static const u8=20 +dummy_tcp_packet[] =3D { 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -312,8 +344,42 @@ dummy_tcp_packet[] =3D { 0x00, 0x00, /* 2 bytes for 4 byte alignment */ }; =20 -static const -struct ice_dummy_pkt_offsets dummy_tcp_ipv6_packet_offsets[] =3D { +/* offset info for MAC + VLAN (C-tag, 802.1Q) + IPv4 + TCP dummy packet=20 +*/ static const struct ice_dummy_pkt_offsets dummy_vlan_tcp_packet_offsets= [] =3D { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14 }, + { ICE_IPV4_OFOS, 18 }, + { ICE_TCP_IL, 38 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +/* C-tag (801.1Q), IPv4:TCP dummy packet */ static const u8=20 +dummy_vlan_tcp_packet[] =3D { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x81, 0x00, /* ICE_ETYPE_OL 12 */ + + 0x00, 0x00, 0x08, 0x00, /* ICE_VLAN_OFOS 14 */ + + 0x45, 0x00, 0x00, 0x28, /* ICE_IPV4_OFOS 18 */ + 0x00, 0x01, 0x00, 0x00, + 0x00, 0x06, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, 0x00, 0x00, /* ICE_TCP_IL 38 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, /* 2 bytes for 4 byte alignment */ +}; + +static const struct ice_dummy_pkt_offsets=20 +dummy_tcp_ipv6_packet_offsets[] =3D { { ICE_MAC_OFOS, 0 }, { ICE_ETYPE_OL, 12 }, { ICE_IPV6_OFOS, 14 }, @@ -349,8 +415,49 @@ dummy_tcp_ipv6_packet[] =3D { 0x00, 0x00, /* 2 bytes for 4 byte alignment */ }; =20 -static const -struct ice_dummy_pkt_offsets dummy_udp_ipv6_packet_offsets[] =3D { +/* C-tag (802.1Q): IPv6 + TCP */ +static const struct ice_dummy_pkt_offsets=20 +dummy_vlan_tcp_ipv6_packet_offsets[] =3D { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14 }, + { ICE_IPV6_OFOS, 18 }, + { ICE_TCP_IL, 58 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +/* C-tag (802.1Q), IPv6 + TCP dummy packet */ static const u8=20 +dummy_vlan_tcp_ipv6_packet[] =3D { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x81, 0x00, /* ICE_ETYPE_OL 12 */ + + 0x00, 0x00, 0x86, 0xDD, /* ICE_VLAN_OFOS 14 */ + + 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 18 */ + 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 58 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + 0x50, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x00, 0x00, /* 2 bytes for 4 byte alignment */ }; + +/* IPv6 + UDP */ +static const struct ice_dummy_pkt_offsets=20 +dummy_udp_ipv6_packet_offsets[] =3D { { ICE_MAC_OFOS, 0 }, { ICE_ETYPE_OL, 12 }, { ICE_IPV6_OFOS, 14 }, @@ -383,8 +490,45 @@ dummy_udp_ipv6_packet[] =3D { 0x00, 0x00, /* 2 bytes for 4 byte alignment */ }; =20 -static const -struct ice_dummy_pkt_offsets dummy_udp_gtp_packet_offsets[] =3D { +/* C-tag (802.1Q): IPv6 + UDP */ +static const struct ice_dummy_pkt_offsets=20 +dummy_vlan_udp_ipv6_packet_offsets[] =3D { + { ICE_MAC_OFOS, 0 }, + { ICE_ETYPE_OL, 12 }, + { ICE_VLAN_OFOS, 14 }, + { ICE_IPV6_OFOS, 18 }, + { ICE_UDP_ILOS, 58 }, + { ICE_PROTOCOL_LAST, 0 }, +}; + +/* C-tag (802.1Q), IPv6 + UDP dummy packet */ static const u8=20 +dummy_vlan_udp_ipv6_packet[] =3D { + 0x00, 0x00, 0x00, 0x00, /* ICE_MAC_OFOS 0 */ + 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, + + 0x81, 0x00, /* ICE_ETYPE_OL 12 */ + + 0x00, 0x00, 0x86, 0xDD, /* ICE_VLAN_OFOS 14 */ + + 0x60, 0x00, 0x00, 0x00, /* ICE_IPV6_OFOS 18 */ + 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 58 */ + 0x00, 0x08, 0x00, 0x00, + + 0x00, 0x00, /* 2 bytes for 4 byte alignment */ }; + +static const struct ice_dummy_pkt_offsets=20 +dummy_udp_gtp_packet_offsets[] =3D { { ICE_MAC_OFOS, 0 }, { ICE_IPV4_OFOS, 14 }, { ICE_UDP_OF, 34 }, @@ -5643,7 +5787,7 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups= , u16 lkups_cnt, u16 *pkt_len, const struct ice_dummy_pkt_offsets **offsets) { - bool tcp =3D false, udp =3D false, ipv6 =3D false; + bool tcp =3D false, udp =3D false, ipv6 =3D false, vlan =3D false; u16 i; =20 if (tun_type =3D=3D ICE_SW_TUN_GTP) { @@ -5665,6 +5809,8 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lkups= , u16 lkups_cnt, tcp =3D true; else if (lkups[i].type =3D=3D ICE_IPV6_OFOS) ipv6 =3D true; + else if (lkups[i].type =3D=3D ICE_VLAN_OFOS) + vlan =3D true; } =20 if (tun_type =3D=3D ICE_ALL_TUNNELS) { @@ -5704,25 +5850,49 @@ ice_find_dummy_packet(struct ice_adv_lkup_elem *lku= ps, u16 lkups_cnt, } =20 if (udp && !ipv6) { + if (vlan) { + *pkt =3D dummy_vlan_udp_packet; + *pkt_len =3D sizeof(dummy_vlan_udp_packet); + *offsets =3D dummy_vlan_udp_packet_offsets; + return; + } *pkt =3D dummy_udp_packet; *pkt_len =3D sizeof(dummy_udp_packet); *offsets =3D dummy_udp_packet_offsets; return; } else if (udp && ipv6) { + if (vlan) { + *pkt =3D dummy_vlan_udp_ipv6_packet; + *pkt_len =3D sizeof(dummy_vlan_udp_ipv6_packet); + *offsets =3D dummy_vlan_udp_ipv6_packet_offsets; + return; + } *pkt =3D dummy_udp_ipv6_packet; *pkt_len =3D sizeof(dummy_udp_ipv6_packet); *offsets =3D dummy_udp_ipv6_packet_offsets; return; } else if ((tcp && ipv6) || ipv6) { + if (vlan) { + *pkt =3D dummy_vlan_tcp_ipv6_packet; + *pkt_len =3D sizeof(dummy_vlan_tcp_ipv6_packet); + *offsets =3D dummy_vlan_tcp_ipv6_packet_offsets; + return; + } *pkt =3D dummy_tcp_ipv6_packet; *pkt_len =3D sizeof(dummy_tcp_ipv6_packet); *offsets =3D dummy_tcp_ipv6_packet_offsets; return; } =20 - *pkt =3D dummy_tcp_packet; - *pkt_len =3D sizeof(dummy_tcp_packet); - *offsets =3D dummy_tcp_packet_offsets; + if (vlan) { + *pkt =3D dummy_vlan_tcp_packet; + *pkt_len =3D sizeof(dummy_vlan_tcp_packet); + *offsets =3D dummy_vlan_tcp_packet_offsets; + } else { + *pkt =3D dummy_tcp_packet; + *pkt_len =3D sizeof(dummy_tcp_packet); + *offsets =3D dummy_tcp_packet_offsets; + } } =20 /** -- 2.13.6