From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id EBB19A0471 for ; Thu, 20 Jun 2019 12:21:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 91E111D145; Thu, 20 Jun 2019 12:21:33 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id C60251D144 for ; Thu, 20 Jun 2019 12:21:31 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jun 2019 03:21:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,396,1557212400"; d="scan'208";a="170833499" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 20 Jun 2019 03:21:30 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 20 Jun 2019 03:21:30 -0700 Received: from shsmsx105.ccr.corp.intel.com (10.239.4.158) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 20 Jun 2019 03:21:29 -0700 Received: from shsmsx106.ccr.corp.intel.com ([169.254.10.89]) by SHSMSX105.ccr.corp.intel.com ([169.254.11.72]) with mapi id 14.03.0439.000; Thu, 20 Jun 2019 18:21:27 +0800 From: "Wang, Xiao W" To: "Yang, Qiming" , "dev@dpdk.org" CC: "Zhang, Qi Z" , "Xing, Beilei" Thread-Topic: [dpdk-dev] [PATCH v3 2/3] net/ice: add generic flow API Thread-Index: AQHVJypxllf3MPXjgEmdman3U5/feaakUNaQ Date: Thu, 20 Jun 2019 10:21:27 +0000 Message-ID: References: <1559552722-8970-1-git-send-email-qiming.yang@intel.com> <20190620053449.32959-1-qiming.yang@intel.com> <20190620053449.32959-3-qiming.yang@intel.com> In-Reply-To: <20190620053449.32959-3-qiming.yang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWViZjRlZDQtNWZkNi00MDdiLTljMTktYjhhM2RkZmQxMzFiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicEgzZ3dOTGV4RVBNNzV5aUFIOEpuc0Z0MmhDRWZOYjlyUUJ4TnN6djRyd1ZWRGZVNEYrSlJDbWw4RE15NkVmTiJ9 dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 2/3] net/ice: add generic flow API 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" Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Qiming Yang > Sent: Thursday, June 20, 2019 1:35 PM > To: dev@dpdk.org > Cc: Yang, Qiming > Subject: [dpdk-dev] [PATCH v3 2/3] net/ice: add generic flow API >=20 > This patch adds ice_flow_create, ice_flow_destroy, > ice_flow_flush and ice_flow_validate support, > these are used to handle all the generic filters. >=20 > Signed-off-by: Qiming Yang > --- > drivers/net/ice/Makefile | 1 + > drivers/net/ice/ice_ethdev.c | 44 +++ > drivers/net/ice/ice_ethdev.h | 5 + > drivers/net/ice/ice_generic_flow.c | 682 > +++++++++++++++++++++++++++++++++++++ > drivers/net/ice/ice_generic_flow.h | 654 > +++++++++++++++++++++++++++++++++++ > drivers/net/ice/meson.build | 1 + > 6 files changed, 1387 insertions(+) > create mode 100644 drivers/net/ice/ice_generic_flow.c > create mode 100644 drivers/net/ice/ice_generic_flow.h >=20 [...] > + case RTE_FLOW_ITEM_TYPE_ETH: > + eth_spec =3D item->spec; > + eth_mask =3D item->mask; > + > + if (eth_spec && eth_mask) { > + if (rte_is_broadcast_ether_addr(ð_mask- > >src)) > + input_set |=3D ICE_INSET_SMAC; > + if (rte_is_broadcast_ether_addr(ð_mask- > >dst)) > + input_set |=3D ICE_INSET_DMAC; > + if (eth_mask->type =3D=3D RTE_BE16(0xffff)) > + input_set |=3D ICE_INSET_ETHERTYPE; > + } > + break; > + case RTE_FLOW_ITEM_TYPE_IPV4: > + ipv4_spec =3D item->spec; > + ipv4_mask =3D item->mask; > + > + if (!(ipv4_spec && ipv4_mask)) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "Invalid IPv4 spec or mask."); > + return 0; > + } > + > + /* Check IPv4 mask and update input set */ > + if (ipv4_mask->hdr.version_ihl || > + ipv4_mask->hdr.total_length || > + ipv4_mask->hdr.packet_id || > + ipv4_mask->hdr.hdr_checksum) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, > + "Invalid IPv4 mask."); > + return 0; > + } > + > + if (outer_ip) { > + if (ipv4_mask->hdr.src_addr =3D=3D UINT32_MAX) > + input_set |=3D ICE_INSET_IPV4_SRC; > + if (ipv4_mask->hdr.dst_addr =3D=3D UINT32_MAX) > + input_set |=3D ICE_INSET_IPV4_DST; > + if (ipv4_mask->hdr.type_of_service =3D=3D > UINT8_MAX) > + input_set |=3D ICE_INSET_IPV4_TOS; > + if (ipv4_mask->hdr.time_to_live =3D=3D > UINT8_MAX) > + input_set |=3D ICE_INSET_IPV4_TTL; > + if (ipv4_mask->hdr.fragment_offset =3D=3D 0) Seems a typo. fragment_offset --> next_proto_id =3D=3D UINT8_MAX. > + input_set |=3D ICE_INSET_IPV4_PROTO; > + outer_ip =3D false; > + } else { > + if (ipv4_mask->hdr.src_addr =3D=3D UINT32_MAX) > + input_set |=3D > ICE_INSET_TUN_IPV4_SRC; > + if (ipv4_mask->hdr.dst_addr =3D=3D UINT32_MAX) > + input_set |=3D > ICE_INSET_TUN_IPV4_DST; > + if (ipv4_mask->hdr.time_to_live =3D=3D > UINT8_MAX) > + input_set |=3D > ICE_INSET_TUN_IPV4_TTL; > + if (ipv4_mask->hdr.next_proto_id =3D=3D > UINT8_MAX) > + input_set |=3D > ICE_INSET_TUN_IPV4_PROTO; > + } > + break; > + case RTE_FLOW_ITEM_TYPE_IPV6: > + ipv6_spec =3D item->spec; > + ipv6_mask =3D item->mask; > + > + if (!(ipv6_spec && ipv6_mask)) { > + rte_flow_error_set(error, EINVAL, > + RTE_FLOW_ERROR_TYPE_ITEM, > + item, "Invalid IPv6 spec or mask"); > + return 0; > + } [...] > +/* bit 16 ~ bit 31 */ > +#define ICE_INSET_IPV4_TOS 0x0000000000010000ULL > +#define ICE_INSET_IPV4_PROTO 0x0000000000020000ULL > +#define ICE_INSET_IPV4_TTL 0x0000000000040000ULL > +#define ICE_INSET_IPV6_NEXT_HDR 0x0000000000200000ULL It's better to align the name to "ICE_INSET_IPV6_PROTO". > +#define ICE_INSET_IPV6_HOP_LIMIT 0x0000000000400000ULL > +#define ICE_INSET_ICMP 0x0000000001000000ULL > +#define ICE_INSET_ICMP6 0x0000000002000000ULL > + BRs, Xiao