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 14FBEA04C8; Fri, 18 Sep 2020 11:28:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E2D961D95D; Fri, 18 Sep 2020 11:28:26 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 448981D958 for ; Fri, 18 Sep 2020 11:28:25 +0200 (CEST) IronPort-SDR: Mwvp2GC99/GSDfVKtFWcrgaqWPB6oKJ/1CCKG2ff0D1xr37GTEq7bpT2vTwN5Q/EETw6iRtfoc VumGflES+roQ== X-IronPort-AV: E=McAfee;i="6000,8403,9747"; a="157288232" X-IronPort-AV: E=Sophos;i="5.77,274,1596524400"; d="scan'208";a="157288232" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Sep 2020 02:28:22 -0700 IronPort-SDR: U7ZnfnHrbWMyqh7pV94oslqEieXdRZf/XgBwzsAVEdrIjtvVyZwspeJxwsbxLaV676I8i8If4v 78Mx5wArRB2w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,274,1596524400"; d="scan'208";a="508799359" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga005.fm.intel.com with ESMTP; 18 Sep 2020 02:28:22 -0700 Received: from shsmsx606.ccr.corp.intel.com (10.109.6.216) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 18 Sep 2020 02:28:21 -0700 Received: from shsmsx605.ccr.corp.intel.com (10.109.6.215) by SHSMSX606.ccr.corp.intel.com (10.109.6.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 18 Sep 2020 17:28:19 +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; Fri, 18 Sep 2020 17:28:19 +0800 From: "Cao, Yahui" To: "Yan, Zhirun" , "Zhang, Qi Z" , "dev@dpdk.org" CC: "Wang, Xiao W" , "Su, Simei" , "Guo, Junfeng" Thread-Topic: [PATCH v3 1/2] net/ice: refactor FDIR set conf function Thread-Index: AQHWiyFeDKLcjyW0R0e6yA+9SKrEMKluI90g Date: Fri, 18 Sep 2020 09:28:19 +0000 Message-ID: <392dafe35d544d23bcf69caec8be124a@intel.com> References: <20200908073939.4099976-1-zhirun.yan@intel.com> <20200915052702.3194061-1-zhirun.yan@intel.com> <20200915052702.3194061-2-zhirun.yan@intel.com> In-Reply-To: <20200915052702.3194061-2-zhirun.yan@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.5.1.3 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 v3 1/2] net/ice: refactor FDIR set conf function 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" > -----Original Message----- > From: Yan, Zhirun > Sent: Tuesday, September 15, 2020 1:27 PM > To: Zhang, Qi Z ; dev@dpdk.org > Cc: Cao, Yahui ; Wang, Xiao W > ; Su, Simei ; Guo, Junfeng > ; Yan, Zhirun > Subject: [PATCH v3 1/2] net/ice: refactor FDIR set conf function >=20 > The original set conf function in FDIR was very long. Refactor to increas= e > readability to make it clearer and allow for more convenient further chan= ges. >=20 > No functional change here. >=20 > Signed-off-by: Zhirun Yan > --- > drivers/net/ice/ice_fdir_filter.c | 53 +++++++++++++++++-------------- > 1 file changed, 30 insertions(+), 23 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir= _filter.c > index c4b7265ce..a65523781 100644 > --- a/drivers/net/ice/ice_fdir_filter.c > +++ b/drivers/net/ice/ice_fdir_filter.c > @@ -943,30 +943,9 @@ ice_fdir_input_set_parse(uint64_t inset, enum > ice_flow_field *field) > } > } >=20 > -static int > -ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow, > - uint64_t input_set, enum ice_fdir_tunnel_type ttype) > +static void > +ice_fdir_input_set_hdrs(enum ice_fltr_ptype flow, struct ice_flow_seg_in= fo *seg) [Cao, Yahui]=20 suggest to change function name from ice_fdir_input_set_hdrs to ice_fdir_in= put_set_segs, and all seg related variable can be inited inside this function, so that th= is function init seg header and seg field. And below function can be simplified as(see next = comments) > { > - struct ice_flow_seg_info *seg; > - struct ice_flow_seg_info *seg_tun =3D NULL; > - enum ice_flow_field field[ICE_FLOW_FIELD_IDX_MAX]; > - bool is_tunnel; > - int i, ret; > - > - if (!input_set) > - return -EINVAL; > - > - seg =3D (struct ice_flow_seg_info *) > - ice_malloc(hw, sizeof(*seg)); > - if (!seg) { > - PMD_DRV_LOG(ERR, "No memory can be allocated"); > - return -ENOMEM; > - } > - > - for (i =3D 0; i < ICE_FLOW_FIELD_IDX_MAX; i++) > - field[i] =3D ICE_FLOW_FIELD_IDX_MAX; > - ice_fdir_input_set_parse(input_set, field); > - > switch (flow) { > case ICE_FLTR_PTYPE_NONF_IPV4_UDP: > ICE_FLOW_SET_HDRS(seg, ICE_FLOW_SEG_HDR_UDP | @@ - > 1038,6 +1017,34 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum > ice_fltr_ptype flow, > PMD_DRV_LOG(ERR, "not supported filter type."); > break; > } > +} > + > +static int > +ice_fdir_input_set_conf(struct ice_pf *pf, enum ice_fltr_ptype flow, > + uint64_t input_set, enum ice_fdir_tunnel_type ttype) > { > + struct ice_flow_seg_info *seg; > + struct ice_flow_seg_info *seg_tun =3D NULL; > + enum ice_flow_field field[ICE_FLOW_FIELD_IDX_MAX]; > + bool is_tunnel; > + int i, ret; > + > + if (!input_set) > + return -EINVAL; > + > + seg =3D (struct ice_flow_seg_info *) > + ice_malloc(hw, sizeof(*seg)); > + if (!seg) { > + PMD_DRV_LOG(ERR, "No memory can be allocated"); > + return -ENOMEM; > + } > + [Cao, Yahui]=20 > + for (i =3D 0; i < ICE_FLOW_FIELD_IDX_MAX; i++) > + field[i] =3D ICE_FLOW_FIELD_IDX_MAX; > + > + ice_fdir_input_set_parse(input_set, field); > + > + ice_fdir_input_set_hdrs(flow, seg); [Cao, Yahui]=20 Function above can be replaced by ice_fdir_input_set_segs(seg, input_set, f= low) >=20 > for (i =3D 0; field[i] !=3D ICE_FLOW_FIELD_IDX_MAX; i++) { > ice_flow_set_fld(seg, field[i], > -- > 2.25.1