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 C2D2DA04B7; Fri, 11 Sep 2020 07:53:28 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1B0E91B9B7; Fri, 11 Sep 2020 07:53:28 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 048EC255 for ; Fri, 11 Sep 2020 07:53:25 +0200 (CEST) IronPort-SDR: mBTWIiZLkRQjsRmLZiHPOKy2Fw3KJlSnSf4lEQcrohixB3vuQk/xf91nrAQkWlovnSId/ajBNa 5jj2Oz/8+j0A== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="158734319" X-IronPort-AV: E=Sophos;i="5.76,414,1592895600"; d="scan'208";a="158734319" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 22:53:24 -0700 IronPort-SDR: kc5+JzCu952xsa0ghnM39dkABDndctBePz8gEbcZycluljuHKTYFVjfKzWjf5fq9gk+I4CtdX6 vVRNQRB0Wdbw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,414,1592895600"; d="scan'208";a="334413294" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga008.jf.intel.com with ESMTP; 10 Sep 2020 22:53:24 -0700 Received: from shsmsx603.ccr.corp.intel.com (10.109.6.143) 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; Thu, 10 Sep 2020 22:53:10 -0700 Received: from shsmsx601.ccr.corp.intel.com (10.109.6.141) by SHSMSX603.ccr.corp.intel.com (10.109.6.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Fri, 11 Sep 2020 13:53:08 +0800 Received: from shsmsx601.ccr.corp.intel.com ([10.109.6.141]) by SHSMSX601.ccr.corp.intel.com ([10.109.6.141]) with mapi id 15.01.1713.004; Fri, 11 Sep 2020 13:53:08 +0800 From: "Zhang, Qi Z" To: "Yan, Zhirun" , "dev@dpdk.org" CC: "Cao, Yahui" , "Wang, Xiao W" , "Su, Simei" , "Guo, Junfeng" Thread-Topic: [PATCH v1 2/2] net/ice: merge inner/outer flow seg info for FDIR Thread-Index: AQHWhbOn24Vc62MHe0qRFN6u1YwQ+ali8opg Date: Fri, 11 Sep 2020 05:53:08 +0000 Message-ID: <2b480e7932b7479bbb040d0ef1fc123c@intel.com> References: <20200908073939.4099976-1-zhirun.yan@intel.com> <20200908073939.4099976-3-zhirun.yan@intel.com> In-Reply-To: <20200908073939.4099976-3-zhirun.yan@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-reaction: no-action dlp-version: 11.5.1.3 dlp-product: dlpe-windows x-originating-ip: [10.108.32.68] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v1 2/2] net/ice: merge inner/outer flow seg info for FDIR 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 8, 2020 3:40 PM > To: Zhang, Qi Z ; dev@dpdk.org > Cc: Cao, Yahui ; Wang, Xiao W > ; Su, Simei ; Guo, Junfeng > ; Yan, Zhirun > Subject: [PATCH v1 2/2] net/ice: merge inner/outer flow seg info for FDIR >=20 > For tunnel and non-tunnel packets, it can share the same seg_tun info. > seg_tun[1] can be used for supporting inner fields with tunnel flow rule = or for > non-tunnel packets, seg_tun[0] only used for tunnel outer part. > Add outer_input_set to distinguish inner/outer input set. So we can ident= ify > different fields in outer or inner part. >=20 > Signed-off-by: Zhirun Yan > --- > drivers/net/ice/ice_ethdev.h | 1 + > drivers/net/ice/ice_fdir_filter.c | 65 +++++++++++++++++-------------- > 2 files changed, 37 insertions(+), 29 deletions(-) >=20 > diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h = index > 393dfeab1..6bc6dfbfb 100644 > --- a/drivers/net/ice/ice_ethdev.h > +++ b/drivers/net/ice/ice_ethdev.h > @@ -285,6 +285,7 @@ struct ice_fdir_filter_conf { > struct rte_flow_action_count act_count; >=20 > uint64_t input_set; > + uint64_t outer_input_set; /* only for tunnel packets outer fields */ > }; >=20 > #define ICE_MAX_FDIR_FILTER_NUM (1024 * 16) > diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir= _filter.c > index 593dfd0e2..24fbcdd60 100644 > --- a/drivers/net/ice/ice_fdir_filter.c > +++ b/drivers/net/ice/ice_fdir_filter.c > @@ -1047,51 +1047,59 @@ ice_fdir_input_set_hdrs(enum ice_fltr_ptype > flow, struct ice_flow_seg_info *seg, >=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) > + uint64_t inner_input_set, uint64_t outer_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]; > + uint64_t input_set; > bool is_tunnel; > - int i, ret; > + int k, i, ret =3D 0; >=20 > - if (!input_set) > + if (!(inner_input_set | outer_input_set)) > return -EINVAL; >=20 > - seg =3D (struct ice_flow_seg_info *) > - ice_malloc(hw, sizeof(*seg)); > - if (!seg) { > + seg_tun =3D (struct ice_flow_seg_info *) > + ice_malloc(hw, sizeof(*seg_tun) * ICE_FD_HW_SEG_MAX); > + if (!seg_tun) { > PMD_DRV_LOG(ERR, "No memory can be allocated"); > return -ENOMEM; > } >=20 > - for (i =3D 0; i < ICE_FLOW_FIELD_IDX_MAX; i++) > - field[i] =3D ICE_FLOW_FIELD_IDX_MAX; > + /* use seg_tun[1] to record tunnel inner part or non-tunnel */ > + for (k =3D ICE_FD_HW_SEG_TUN; k >=3D 0; k--) { Why we have to iterate in inverse order, can we start from 0? > + seg =3D &seg_tun[k]; > + if (k =3D=3D ICE_FD_HW_SEG_TUN) { > + if (inner_input_set =3D=3D 0) > + continue; > + input_set =3D inner_input_set; > + } else { > + if (outer_input_set =3D=3D 0) > + break; > + input_set =3D outer_input_set; > + } above code can be simplified as below? for (....) { inputset =3D (k =3D=3D ICE_FD_HW_SEG_TUN) ? inner_input_set : outer_input= _set; if (inputset =3D=3D 0) continue; .... =09 Btw, and I'm ok with all other changes. > + > + for (i =3D 0; i < ICE_FLOW_FIELD_IDX_MAX; i++) > + field[i] =3D ICE_FLOW_FIELD_IDX_MAX; >=20 > - ice_fdir_input_set_parse(input_set, field); > + ice_fdir_input_set_parse(input_set, field); >=20 > - ice_fdir_input_set_hdrs(flow, seg, ttype); > + ice_fdir_input_set_hdrs(flow, seg, ttype); >=20 > - for (i =3D 0; field[i] !=3D ICE_FLOW_FIELD_IDX_MAX; i++) { > - ice_flow_set_fld(seg, field[i], > - ICE_FLOW_FLD_OFF_INVAL, > - ICE_FLOW_FLD_OFF_INVAL, > - ICE_FLOW_FLD_OFF_INVAL, false); > + for (i =3D 0; field[i] !=3D ICE_FLOW_FIELD_IDX_MAX; i++) { > + ice_flow_set_fld(seg, field[i], > + ICE_FLOW_FLD_OFF_INVAL, > + ICE_FLOW_FLD_OFF_INVAL, > + ICE_FLOW_FLD_OFF_INVAL, false); > + } > } >=20 > is_tunnel =3D ice_fdir_is_tunnel_profile(ttype); > if (!is_tunnel) { > ret =3D ice_fdir_hw_tbl_conf(pf, pf->main_vsi, pf->fdir.fdir_vsi, > - seg, flow, false); > + seg_tun + 1, flow, false); > } else { > - seg_tun =3D (struct ice_flow_seg_info *) > - ice_malloc(hw, sizeof(*seg) * ICE_FD_HW_SEG_MAX); > - if (!seg_tun) { > - PMD_DRV_LOG(ERR, "No memory can be allocated"); > - rte_free(seg); > - return -ENOMEM; > - } > - rte_memcpy(&seg_tun[1], seg, sizeof(*seg)); > ret =3D ice_fdir_hw_tbl_conf(pf, pf->main_vsi, pf->fdir.fdir_vsi, > seg_tun, flow, true); > } > @@ -1099,9 +1107,7 @@ ice_fdir_input_set_conf(struct ice_pf *pf, enum > ice_fltr_ptype flow, > if (!ret) { > return ret; > } else if (ret < 0) { > - rte_free(seg); > - if (is_tunnel) > - rte_free(seg_tun); > + rte_free(seg_tun); > return (ret =3D=3D -EEXIST) ? 0 : ret; > } else { > return ret; > @@ -1311,7 +1317,8 @@ ice_fdir_create_filter(struct ice_adapter *ad, > is_tun =3D ice_fdir_is_tunnel_profile(filter->tunnel_type); >=20 > ret =3D ice_fdir_input_set_conf(pf, filter->input.flow_type, > - filter->input_set, filter->tunnel_type); > + filter->input_set, filter->outer_input_set, > + filter->tunnel_type); > if (ret) { > rte_flow_error_set(error, -ret, > RTE_FLOW_ERROR_TYPE_HANDLE, NULL, @@ -2106,7 > +2113,7 @@ ice_fdir_parse(struct ice_adapter *ad, > ret =3D ice_fdir_parse_pattern(ad, pattern, error, filter); > if (ret) > goto error; > - input_set =3D filter->input_set; > + input_set =3D filter->input_set | filter->outer_input_set; > if (!input_set || input_set & ~item->input_set_mask) { > rte_flow_error_set(error, EINVAL, > RTE_FLOW_ERROR_TYPE_ITEM_SPEC, > -- > 2.25.1