From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6078BA09FF; Thu, 7 Jan 2021 04:07:27 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DCA78140E6B; Thu, 7 Jan 2021 04:07:26 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 5EC36140E63 for ; Thu, 7 Jan 2021 04:07:25 +0100 (CET) IronPort-SDR: asmGyHwMvLr8KB7JWBkgVmZaXWLXC8E0Hzzc+nDNFaKVOH1M1hEE/0MSq69Mx6IYErP6j3ck1o V7lV3ugYwIcA== X-IronPort-AV: E=McAfee;i="6000,8403,9856"; a="156555195" X-IronPort-AV: E=Sophos;i="5.79,328,1602572400"; d="scan'208";a="156555195" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2021 19:07:23 -0800 IronPort-SDR: bnBkUgakj2K5LzkMmMkfpd3iK78Fh+EXqb/QDAvbgT6iKrUtfZZZcEvzOCaEv5/XovGy5g97VC PELrJME1FjWA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,328,1602572400"; d="scan'208";a="402898043" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by FMSMGA003.fm.intel.com with ESMTP; 06 Jan 2021 19:07:23 -0800 Received: from shsmsx602.ccr.corp.intel.com (10.109.6.142) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Wed, 6 Jan 2021 19:07:22 -0800 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by SHSMSX602.ccr.corp.intel.com (10.109.6.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Thu, 7 Jan 2021 11:07:20 +0800 Received: from shsmsx605.ccr.corp.intel.com ([10.109.6.215]) by SHSMSX605.ccr.corp.intel.com ([10.109.6.215]) with mapi id 15.01.1713.004; Thu, 7 Jan 2021 11:07:20 +0800 From: "Yan, Zhirun" To: "Cao, Yahui" , "dev@dpdk.org" , "Zhang, Qi Z" , "Wang, Xiao W" , "Guo, Junfeng" CC: "Su, Simei" , "Xu, Ting" , "Zhang, Yuying" Thread-Topic: [PATCH v1 2/5] net/ice: refactor flow pattern parser Thread-Index: AQHW12ZfIjsn6KajREyy/sLu/M8Ws6oGxseAgBTNTDA= Date: Thu, 7 Jan 2021 03:07:20 +0000 Message-ID: <18cbad7220074b50a244ee66920f516e@intel.com> References: <20201221065150.1600719-1-zhirun.yan@intel.com> <20201221065150.1600719-3-zhirun.yan@intel.com> <2e7933eca3084b798cffe4a992be1246@intel.com> In-Reply-To: <2e7933eca3084b798cffe4a992be1246@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.36] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1 2/5] net/ice: refactor flow pattern parser 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" > -----Original Message----- > From: Cao, Yahui > Sent: Friday, December 25, 2020 1:22 PM > To: Yan, Zhirun ; dev@dpdk.org; Zhang, Qi Z > ; Wang, Xiao W ; Guo, > Junfeng > Cc: Su, Simei ; Xu, Ting ; Zhang, > Yuying > Subject: RE: [PATCH v1 2/5] net/ice: refactor flow pattern parser >=20 >=20 >=20 > > -----Original Message----- > > From: Yan, Zhirun > > Sent: Monday, December 21, 2020 2:52 PM > > To: dev@dpdk.org; Zhang, Qi Z ; Cao, Yahui > > ; Wang, Xiao W ; Guo, > > Junfeng > > Cc: Su, Simei ; Xu, Ting ; > > Zhang, Yuying ; Yan, Zhirun > > > > Subject: [PATCH v1 2/5] net/ice: refactor flow pattern parser > > > > Distinguish inner/outer input set. And avoid too many nested > > conditionals in each type's parser. input_set_f is used for outer > > fields, input_set_l is used for inner or non-tunnel fields. > > > > Signed-off-by: Zhirun Yan > > --- > > drivers/net/ice/ice_fdir_filter.c | 467 > > +++++++++++++++--------------- > > 1 file changed, 229 insertions(+), 238 deletions(-) > > > > diff --git a/drivers/net/ice/ice_fdir_filter.c > > b/drivers/net/ice/ice_fdir_filter.c > > index 92b8a7e6ad..1f2576a444 100644 > > --- a/drivers/net/ice/ice_fdir_filter.c > > +++ b/drivers/net/ice/ice_fdir_filter.c > > @@ -1646,7 +1646,9 @@ ice_fdir_parse_pattern(__rte_unused struct > ice_adapter *ad, > > const struct rte_flow_item_vxlan *vxlan_spec, *vxlan_mask; > > const struct rte_flow_item_gtp *gtp_spec, *gtp_mask; > > const struct rte_flow_item_gtp_psc *gtp_psc_spec, *gtp_psc_mask; > > - uint64_t input_set =3D ICE_INSET_NONE; > > + uint64_t input_set_l =3D ICE_INSET_NONE; > > + uint64_t input_set_f =3D ICE_INSET_NONE; > > + uint64_t *input_set; > > uint8_t flow_type =3D ICE_FLTR_PTYPE_NONF_NONE; > > uint8_t ipv6_addr_mask[16] =3D { > > 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, @@ -1655,289 > > +1657,276 @@ ice_fdir_parse_pattern(__rte_unused struct ice_adapter > *ad, > > uint32_t vtc_flow_cpu; > > uint16_t ether_type; > > enum rte_flow_item_type next_type; > > + bool is_outer =3D true; > > + struct ice_fdir_extra *p_ext_data; > > + struct ice_fdir_v4 *p_v4; > > + struct ice_fdir_v6 *p_v6; > > > > + for (item =3D pattern; item->type !=3D RTE_FLOW_ITEM_TYPE_END; > item++) { > > + if (item->type =3D=3D RTE_FLOW_ITEM_TYPE_VXLAN) > > + tunnel_type =3D ICE_FDIR_TUNNEL_TYPE_VXLAN; > > + if (item->type =3D=3D RTE_FLOW_ITEM_TYPE_GTPU) > > + tunnel_type =3D ICE_FDIR_TUNNEL_TYPE_GTPU; > > + if (item->type =3D=3D RTE_FLOW_ITEM_TYPE_GTP_PSC) > > + tunnel_type =3D ICE_FDIR_TUNNEL_TYPE_GTPU_EH; > > + } > > + > > + /* This loop parse flow pattern and distinguish Non-tunnel and > tunnel > > + * flow. input_set_l is used for non-tunnel and tunnel inner part. > > + */ >=20 > ... > > > > + input_set =3D (tunnel_type && is_outer) ? > > + &input_set_f : &input_set_l; > [Cao, Yahui] input_set_l used for inner filed or non-tunnel filed looks > confusing, can we just use input_set_l as non-tunnel filed or tunnel oute= r > field ? Yes, both are OK. In my view, Non-tunnel and inner part have no tunnel layer info, they can b= e the same definition. But for tunnel type, the outer part is different. It may contain tunnel lay= er info like VNI in VXLAN.=20 Only this part is specific with tunnel type. > > + > > + if (l3 =3D=3D RTE_FLOW_ITEM_TYPE_IPV4) > > + p_v4 =3D (tunnel_type && is_outer) ? > > + &filter->input.ip_outer.v4 : > > + &filter->input.ip.v4; > > + if (l3 =3D=3D RTE_FLOW_ITEM_TYPE_IPV6) > > + p_v6 =3D (tunnel_type && is_outer) ? > > + &filter->input.ip_outer.v6 : > > + &filter->input.ip.v6; > > + > [Cao, Yahui] p_v4 and p_v6 pointer assignment looks redundant since it wi= ll > be assigned in IPV4 and IPV6 switch case statement. If L3 has no fields, then we could not know whether it is ipv4 or ipv6 for = L4 case. You are right. The p_v4/6 assignment can be set earlier in L3 layer parse. > > switch (item_type) { >=20 > ... > > + > > + p_v4 =3D (tunnel_type && is_outer) ? > > + &filter->input.ip_outer.v4 : > > + &filter->input.ip.v4; > [Cao, Yahui] it is assigned here again Yes, I will move this earlier when set flow item type. > > + p_v4->dst_ip =3D ipv4_spec->hdr.dst_addr; > > + p_v4->src_ip =3D ipv4_spec->hdr.src_addr; > > + p_v4->tos =3D ipv4_spec->hdr.type_of_service; > > break; >=20 > ...... > > + > > + p_v6 =3D (tunnel_type && is_outer) ? > > + &filter->input.ip_outer.v6 : > > + &filter->input.ip.v6; > [Cao, Yahui] it is assigned here again Yes, I will fix it. > > + rte_memcpy(&p_v6->dst_ip, ipv6_spec- > >hdr.dst_addr, 16); > > + rte_memcpy(&p_v6->src_ip, ipv6_spec- > >hdr.src_addr, 16); > > + vtc_flow_cpu =3D rte_be_to_cpu_32(ipv6_spec- > >hdr.vtc_flow); > > + p_v6->tc =3D (uint8_t)(vtc_flow_cpu >> > ICE_FDIR_IPV6_TC_OFFSET); > > + p_v6->proto =3D ipv6_spec->hdr.proto; > > + p_v6->hlim =3D ipv6_spec->hdr.hop_limits; > > break; > ...... > > filter->tunnel_type =3D tunnel_type; > > filter->input.flow_type =3D flow_type; > > - filter->input_set =3D input_set; > > + filter->input_set =3D input_set_l; > > + filter->outer_input_set =3D input_set_f; > [Cao, Yahui] Correspondingly here, input_set and outer_input_set naming i= s > also confusing. input_set is used for tunnel inner part and non-tunnel type. outer_input_set is only for tunnel outer part. Thanks. > > > > return 0; > > } > > -- > > 2.25.1