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 0D842A04AB; Fri, 8 Nov 2019 07:51:32 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6BA951BF66; Fri, 8 Nov 2019 07:51:31 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id C20181BF65 for ; Fri, 8 Nov 2019 07:51:28 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Nov 2019 22:51:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,280,1569308400"; d="scan'208";a="213187748" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga001.fm.intel.com with ESMTP; 07 Nov 2019 22:51:27 -0800 Received: from fmsmsx111.amr.corp.intel.com (10.18.116.5) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 7 Nov 2019 22:51:27 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx111.amr.corp.intel.com (10.18.116.5) with Microsoft SMTP Server (TLS) id 14.3.439.0; Thu, 7 Nov 2019 22:51:26 -0800 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.225]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.149]) with mapi id 14.03.0439.000; Fri, 8 Nov 2019 14:51:25 +0800 From: "Zhang, Qi Z" To: "Ye, Xiaolong" CC: "Yang, Qiming" , "dev@dpdk.org" Thread-Topic: [PATCH] net/ice: clear the HW tables when close device Thread-Index: AQHVlVGZdzFQyG9RlEW8lvebeGN4qKeAR72AgACLM7A= Date: Fri, 8 Nov 2019 06:51:23 +0000 Message-ID: <039ED4275CED7440929022BC67E7061153DC6456@SHSMSX105.ccr.corp.intel.com> References: <20191107095910.29854-1-qi.z.zhang@intel.com> <20191108061749.GK100445@intel.com> In-Reply-To: <20191108061749.GK100445@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGUzOWFhZTMtZWVhNy00YWE0LTg3ZmQtNjY4MjJjZmZiZmM4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiY3VtUW1WWDN6MTdUSFhOY2UwellrOG96UURSZjErTTdoaHdYQ0s3cGtIdUNJWno3Tkp1Y242aFBGRG1jWGVnKyJ9 x-ctpclassification: CTP_NT 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] net/ice: clear the HW tables when close device 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: Ye, Xiaolong > Sent: Friday, November 8, 2019 2:18 PM > To: Zhang, Qi Z > Cc: Yang, Qiming ; dev@dpdk.org > Subject: Re: [PATCH] net/ice: clear the HW tables when close device >=20 > Hi, Qi >=20 > On 11/07, Qi Zhang wrote: > >Clear the HW tables during dev_close. Otherwise HW tables will not be > >initialized correctly after device reset. > > > >Fixes: a4c8c48fe3f4 ("net/ice: load OS default package") > > > >Signed-off-by: Qi Zhang > >--- > > drivers/net/ice/base/ice_flex_pipe.c | 55 > >++++++++++++++++++++++++++++++++++++ > > drivers/net/ice/base/ice_flex_pipe.h | 1 + > > drivers/net/ice/ice_ethdev.c | 1 + > > 3 files changed, 57 insertions(+) > > > >diff --git a/drivers/net/ice/base/ice_flex_pipe.c > >b/drivers/net/ice/base/ice_flex_pipe.c > >index dd098f529..b816ca67f 100644 > >--- a/drivers/net/ice/base/ice_flex_pipe.c > >+++ b/drivers/net/ice/base/ice_flex_pipe.c > >@@ -3618,6 +3618,61 @@ static void ice_init_flow_profs(struct ice_hw > >*hw, u8 blk_idx) } > > > > /** > >+ * ice_clear_hw_tbls - clear HW tables and flow profiles > >+ * @hw: pointer to the hardware structure */ void > >+ice_clear_hw_tbls(struct ice_hw *hw) >=20 > What is the difference between this one and existing ice_free_hw_tbls, ca= n we > use ice_free_hw_tbls directly? The ice_clear_hw_tbls is designed for device reset scenario, it reset all t= he table, but not do free, so during next ice_init_hw_tbls, all the allocat= ion steps can be skipped. Though, I guess ice_free_hw_tbls may also works, but Kernel driver use ice_= clear_hw_tbls during reset, DPDK would better just follow the same implemen= tation to avoid unnecessary evaluation effort. Regards Qi >=20 > Thanks, > Xiaolong >=20 > >+{ > >+ u8 i; > >+ > >+ for (i =3D 0; i < ICE_BLK_COUNT; i++) { > >+ struct ice_prof_redir *prof_redir =3D &hw->blk[i].prof_redir; > >+ struct ice_prof_tcam *prof =3D &hw->blk[i].prof; > >+ struct ice_xlt1 *xlt1 =3D &hw->blk[i].xlt1; > >+ struct ice_xlt2 *xlt2 =3D &hw->blk[i].xlt2; > >+ struct ice_es *es =3D &hw->blk[i].es; > >+ > >+ if (hw->blk[i].is_list_init) { > >+ ice_free_prof_map(hw, i); > >+ ice_free_flow_profs(hw, i); > >+ } > >+ > >+ ice_free_vsig_tbl(hw, (enum ice_block)i); > >+ > >+ ice_memset(xlt1->ptypes, 0, xlt1->count * sizeof(*xlt1->ptypes), > >+ ICE_NONDMA_MEM); > >+ ice_memset(xlt1->ptg_tbl, 0, > >+ ICE_MAX_PTGS * sizeof(*xlt1->ptg_tbl), > >+ ICE_NONDMA_MEM); > >+ ice_memset(xlt1->t, 0, xlt1->count * sizeof(*xlt1->t), > >+ ICE_NONDMA_MEM); > >+ > >+ ice_memset(xlt2->vsis, 0, xlt2->count * sizeof(*xlt2->vsis), > >+ ICE_NONDMA_MEM); > >+ ice_memset(xlt2->vsig_tbl, 0, > >+ xlt2->count * sizeof(*xlt2->vsig_tbl), > >+ ICE_NONDMA_MEM); > >+ ice_memset(xlt2->t, 0, xlt2->count * sizeof(*xlt2->t), > >+ ICE_NONDMA_MEM); > >+ > >+ ice_memset(prof->t, 0, prof->count * sizeof(*prof->t), > >+ ICE_NONDMA_MEM); > >+ ice_memset(prof_redir->t, 0, > >+ prof_redir->count * sizeof(*prof_redir->t), > >+ ICE_NONDMA_MEM); > >+ > >+ ice_memset(es->t, 0, es->count * sizeof(*es->t), > >+ ICE_NONDMA_MEM); > >+ ice_memset(es->ref_count, 0, es->count * sizeof(*es->ref_count), > >+ ICE_NONDMA_MEM); > >+ ice_memset(es->written, 0, es->count * sizeof(*es->written), > >+ ICE_NONDMA_MEM); > >+ ice_memset(es->mask_ena, 0, es->count * sizeof(*es->mask_ena), > >+ ICE_NONDMA_MEM); > >+ } > >+} > >+ > >+/** > > * ice_init_hw_tbls - init hardware table memory > > * @hw: pointer to the hardware structure > > */ > >diff --git a/drivers/net/ice/base/ice_flex_pipe.h > >b/drivers/net/ice/base/ice_flex_pipe.h > >index ee606af15..fa72e386d 100644 > >--- a/drivers/net/ice/base/ice_flex_pipe.h > >+++ b/drivers/net/ice/base/ice_flex_pipe.h > >@@ -71,6 +71,7 @@ ice_copy_and_init_pkg(struct ice_hw *hw, const u8 > >*buf, u32 len); enum ice_status ice_init_hw_tbls(struct ice_hw *hw); > >void ice_free_seg(struct ice_hw *hw); void ice_fill_blk_tbls(struct > >ice_hw *hw); > >+void ice_clear_hw_tbls(struct ice_hw *hw); > > void ice_free_hw_tbls(struct ice_hw *hw); enum ice_status > >ice_rem_prof(struct ice_hw *hw, enum ice_block blk, u64 id); diff --git > >a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index > >d81eb5eeb..0b439cc0b 100644 > >--- a/drivers/net/ice/ice_ethdev.c > >+++ b/drivers/net/ice/ice_ethdev.c > >@@ -2322,6 +2322,7 @@ ice_dev_close(struct rte_eth_dev *dev) > > rte_free(hw->port_info); > > hw->port_info =3D NULL; > > ice_shutdown_all_ctrlq(hw); > >+ ice_clear_hw_tbls(hw); > > rte_free(pf->proto_xtr); > > pf->proto_xtr =3D NULL; > > > >-- > >2.13.6 > >