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 4D446A318B for ; Fri, 18 Oct 2019 02:42:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 20B6B1D44C; Fri, 18 Oct 2019 02:42:46 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 76CD91D41D; Fri, 18 Oct 2019 02:42:41 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Oct 2019 17:42:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,309,1566889200"; d="scan'208";a="221576670" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 17 Oct 2019 17:42:42 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 17 Oct 2019 17:42:40 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.96]) by shsmsx102.ccr.corp.intel.com ([169.254.2.176]) with mapi id 14.03.0439.000; Fri, 18 Oct 2019 08:42:38 +0800 From: "Wang, Ying A" To: "Ye, Xiaolong" CC: "Zhang, Qi Z" , "dev@dpdk.org" , "Yang, Qiming" , "stable@dpdk.org" Thread-Topic: [PATCH] net/ice: cleanup RSS/FDIR profile when device init Thread-Index: AQHVdagzCVYfIfFtqEOs9Ae/iDzXZqdDcKaAgBw9j3A= Date: Fri, 18 Oct 2019 00:42:38 +0000 Message-ID: <44DE8E8A53B4014CA1985CEE86C07F2A0B9A82B0@SHSMSX101.ccr.corp.intel.com> References: <20190927183258.44578-1-ying.a.wang@intel.com> <20190930092545.GD112560@intel.com> In-Reply-To: <20190930092545.GD112560@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDRhZjZjOWQtZDQxNC00ZjZjLTgzZjMtNDliMGY2YzU3ZjRiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiZ2VCVDVJNVJpcGpDcVc2UmZjUXM0Rk5EUVF4N1Y5Y2Q2R25oaHR0XC9QN1N2NzZyTm4wSnU4SVVJbERBTjVCaHIifQ== 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-stable] [PATCH] net/ice: cleanup RSS/FDIR profile when device init X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, Xiaolong Thanks for your comments, will fix them in v2. > -----Original Message----- > From: Ye, Xiaolong > Sent: Monday, September 30, 2019 5:26 PM > To: Wang, Ying A > Cc: Zhang, Qi Z ; dev@dpdk.org; Yang, Qiming > ; stable@dpdk.org > Subject: Re: [PATCH] net/ice: cleanup RSS/FDIR profile when device init >=20 > On 09/28, Ying Wang wrote: > >The patch cleanup RSS/FDIR profile resources when device init to fix > >profile ID increase issue. >=20 > Could you elaborate the profile ID increase issue in the commit log? >=20 > > > >Fixes: d7d150b93070 ("net/ice: enable RSS when device init") > >Cc: stable@dpdk.org > > > >Signed-off-by: Ying Wang > >--- > >--- > >This patch depends on the following patches in patchwork: > >(1) http://patchwork.dpdk.org/project/dpdk/list/?series=3D6557 > >(2) http://patches.dpdk.org/project/dpdk/list/?series=3D6579 > >(3) http://patches.dpdk.org/project/dpdk/list/?series=3D6577 > >--- > > > > drivers/net/ice/ice_ethdev.c | 115 > > +++++++++++++++++++++++++++++++++++++++++++ > > 1 file changed, 115 insertions(+) > > > >diff --git a/drivers/net/ice/ice_ethdev.c > >b/drivers/net/ice/ice_ethdev.c index 3abdaffbc..04102728f 100644 > >--- a/drivers/net/ice/ice_ethdev.c > >+++ b/drivers/net/ice/ice_ethdev.c > >@@ -13,6 +13,7 @@ > > #include "base/ice_sched.h" > > #include "base/ice_flow.h" > > #include "base/ice_dcb.h" > >+#include "base/ice_common.h" > > #include "ice_ethdev.h" > > #include "ice_rxtx.h" > > #include "ice_generic_flow.h" > >@@ -40,6 +41,7 @@ static const char * const ice_valid_args[] =3D { > > #define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package" > > #define ICE_COMMS_PKG_NAME "ICE COMMS Package" > > #define ICE_MAX_PKG_FILENAME_SIZE 256 > >+#define ICE_MAX_RES_DESC_NUM 1024 > > > > int ice_logtype_init; > > int ice_logtype_driver; > >@@ -1851,6 +1853,113 @@ ice_vsi_config_sw_lldp(struct ice_vsi *vsi, boo= l > on) > > return ret; > > } > > > >+static enum ice_status > >+ice_aq_get_res_profs(struct ice_hw *hw, uint16_t num_entries, > >+ struct ice_aqc_get_allocd_res_desc_resp *resp_buf, > >+ uint16_t buf_size, uint16_t res_type, > >+ bool res_shared, uint16_t *desc_id, > >+ struct ice_sq_cd *cd, uint16_t *num_prof) >=20 > May consider use struct to reduce the number of parameters. >=20 > >+{ > >+ struct ice_aq_desc aq_desc; > >+ int ret; > >+ > >+ struct ice_aqc_get_allocd_res_desc *cmd =3D > >+ &aq_desc.params.get_res_desc; > >+ > >+ if (!resp_buf) > >+ return ICE_ERR_PARAM; > >+ > >+ if (buf_size !=3D (num_entries * sizeof(*resp_buf))) > >+ return ICE_ERR_PARAM; > >+ > >+ ice_fill_dflt_direct_cmd_desc(&aq_desc, > >+ ice_aqc_opc_get_allocd_res_desc); > >+ > >+ cmd->ops.cmd.res =3D CPU_TO_LE16(((res_type << ICE_AQC_RES_TYPE_S) > & > >+ ICE_AQC_RES_TYPE_M) | (res_shared ? > >+ ICE_AQC_RES_TYPE_FLAG_SHARED : 0)); > >+ cmd->ops.cmd.first_desc =3D CPU_TO_LE16(*desc_id); > >+ ret =3D ice_aq_send_cmd(hw, &aq_desc, resp_buf, buf_size, cd); > >+ if (!ret) { > >+ *desc_id =3D LE16_TO_CPU(cmd->ops.resp.next_desc); > >+ *num_prof =3D LE16_TO_CPU(cmd->ops.resp.num_desc); > >+ } > >+ return ret; > >+} > >+ > >+static enum ice_status > >+ice_get_hw_res(struct ice_hw *hw, uint16_t type, uint16_t num, uint16_t > *res, > >+ uint16_t *prof_buf, uint16_t *num_prof) { > >+ struct ice_aqc_get_allocd_res_desc_resp *resp_buf; > >+ int ret; > >+ uint16_t buf_len; > >+ > >+ buf_len =3D sizeof(*resp_buf) + sizeof(resp_buf->elem) * (num - 1); >=20 > why (num - 1) here? >=20 > >+ resp_buf =3D (struct ice_aqc_get_allocd_res_desc_resp *) > >+ ice_malloc(hw, buf_len); >=20 > Cast is unnecessary for void * >=20 > >+ if (!resp_buf) > >+ return -ENOMEM; > >+ > >+ ret =3D ice_aq_get_res_profs(hw, num, resp_buf, buf_len, type, 1, > >+ res, NULL, num_prof); > >+ if (ret) > >+ goto exit; > >+ > >+ ice_memcpy(prof_buf, resp_buf->elem, sizeof(resp_buf->elem) * > >+ (*num_prof), ICE_NONDMA_TO_NONDMA); > >+exit: > >+ rte_free(resp_buf); > >+ return ret; > >+} > >+ > >+static int > >+ice_clearup_resource(struct ice_hw *hw, uint16_t res_type) >=20 > s/clearup/cleanup >=20 > >+{ > >+ int ret; > >+ uint16_t prof_id; > >+ uint16_t prof_buf[ICE_MAX_RES_DESC_NUM]; > >+ uint16_t first_desc =3D 1; > >+ uint16_t num_prof =3D 0; > >+ > >+ ret =3D ice_get_hw_res(hw, res_type, ICE_MAX_RES_DESC_NUM, > >+ &first_desc, prof_buf, &num_prof); >=20 > What is purpose of first_desc? Seems there is no reference of it afterwar= ds. >=20 > >+ if (ret) { > >+ PMD_INIT_LOG(ERR, "Failed to get fxp resource"); > >+ return ret; > >+ } > >+ > >+ for (prof_id =3D 0; prof_id < num_prof; prof_id++) { > >+ ret =3D ice_free_hw_res(hw, res_type, 1, &prof_buf[prof_id]); > >+ if (ret) { > >+ PMD_INIT_LOG(ERR, "Failed to free fxp resource"); > >+ return ret; > >+ } > >+ } > >+ > >+ return 0; > >+} > >+ > >+static int > >+ice_reset_fxp_resource(struct ice_hw *hw) { > >+ int ret; > >+ > >+ ret =3D ice_clearup_resource(hw, > ICE_AQC_RES_TYPE_FD_PROF_BLDR_PROFID); > >+ if (ret) { > >+ PMD_INIT_LOG(ERR, "Failed to clearup fdir resource"); > >+ return ret; > >+ } > >+ > >+ ret =3D ice_clearup_resource(hw, > ICE_AQC_RES_TYPE_HASH_PROF_BLDR_PROFID); > >+ if (ret) { > >+ PMD_INIT_LOG(ERR, "Failed to clearup rss resource"); > >+ return ret; > >+ } > >+ > >+ return 0; > >+} >=20 > s/clearup/cleanup >=20 > Thanks, > Xiaolong >=20 > >+ > > static int > > ice_dev_init(struct rte_eth_dev *dev) > > { > >@@ -1983,6 +2092,12 @@ ice_dev_init(struct rte_eth_dev *dev) > > return ret; > > } > > > >+ ret =3D ice_reset_fxp_resource(hw); > >+ if (ret) { > >+ PMD_INIT_LOG(ERR, "Failed to reset fxp resource"); > >+ return ret; > >+ } > >+ > > return 0; > > > > err_pf_setup: > >-- > >2.15.1 > >