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 08154A04B3 for ; Mon, 11 Nov 2019 09:39:55 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BB4E12B86; Mon, 11 Nov 2019 09:39:54 +0100 (CET) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id EDFFA2904; Mon, 11 Nov 2019 09:39:48 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 00:39:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,292,1569308400"; d="scan'208";a="247905812" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by FMSMGA003.fm.intel.com with ESMTP; 11 Nov 2019 00:39:48 -0800 Received: from fmsmsx118.amr.corp.intel.com (10.18.116.18) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 11 Nov 2019 00:39:47 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx118.amr.corp.intel.com (10.18.116.18) with Microsoft SMTP Server (TLS) id 14.3.439.0; Mon, 11 Nov 2019 00:39:47 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.213]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.2]) with mapi id 14.03.0439.000; Mon, 11 Nov 2019 16:39:45 +0800 From: "Wang, ShougangX" To: "Ye, Xiaolong" CC: "dev@dpdk.org" , "Yang, Qiming" , "Xing, Beilei" , "stable@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 1/4] net/ice: fix memzone reserve and release in FDIR Thread-Index: AQHVlUjeQjBmrP+tbUyEtIvN8YawcqeFHhcAgACJCyA= Date: Mon, 11 Nov 2019 08:39:45 +0000 Message-ID: <00A8E5A1740DFA49A87AFFAC34B8EDEA3BF646@SHSMSX101.ccr.corp.intel.com> References: <20191105033806.2878-1-shougangx.wang@intel.com> <20191107022217.41046-1-shougangx.wang@intel.com> <20191107022217.41046-2-shougangx.wang@intel.com> <20191111080948.GA5870@intel.com> In-Reply-To: <20191111080948.GA5870@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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] [dpdk-dev] [PATCH v2 1/4] net/ice: fix memzone reserve and release in FDIR 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 > -----Original Message----- > From: Ye, Xiaolong > Sent: Monday, November 11, 2019 4:10 PM > To: Wang, ShougangX > Cc: dev@dpdk.org; Yang, Qiming ; Xing, Beilei > ; stable@dpdk.org > Subject: Re: [dpdk-dev] [PATCH v2 1/4] net/ice: fix memzone reserve and > release in FDIR >=20 > On 11/07, Wang ShougangX wrote: > >To avoid memzone reserve failure and memory leak, following resources > >management should be added. > >- Check if the FDIR Memzone already exists before reserving. >=20 > In what scenario it will reserve FDIR memzone twice? Currently, there is no scenario. It is a failsafe method, just like i40e_memzone_reserve(). >=20 > >- Free FDIR memzone when teardown and other failure scenarios. > > > >Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine") > >Cc: stable@dpdk.org >=20 > No need to cc stable since commit 84dc7a95a2d3 is in this release. Got it. >=20 > > > >Signed-off-by: Wang ShougangX > >--- > > drivers/net/ice/ice_ethdev.h | 1 + > > drivers/net/ice/ice_fdir_filter.c | 19 ++++++++++++++++++- > > 2 files changed, 19 insertions(+), 1 deletion(-) > > > >diff --git a/drivers/net/ice/ice_ethdev.h > >b/drivers/net/ice/ice_ethdev.h index de67e5934..0a39ca6ff 100644 > >--- a/drivers/net/ice/ice_ethdev.h > >+++ b/drivers/net/ice/ice_ethdev.h > >@@ -325,6 +325,7 @@ struct ice_fdir_info { > > struct ice_rx_queue *rxq; > > void *prg_pkt; /* memory for fdir program packet */ > > uint64_t dma_addr; /* physic address of packet memory*/ > >+ const struct rte_memzone *mz; > > struct ice_fdir_filter_conf conf; > > > > struct ice_fdir_filter_conf **hash_map; diff --git > >a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c > >index 736ccd54e..31705c164 100644 > >--- a/drivers/net/ice/ice_fdir_filter.c > >+++ b/drivers/net/ice/ice_fdir_filter.c > >@@ -140,6 +140,12 @@ static struct ice_flow_parser > >ice_fdir_parser_comms; static const struct rte_memzone * > >ice_memzone_reserve(const char *name, uint32_t len, int socket_id) { > >+ const struct rte_memzone *mz; > >+ > >+ mz =3D rte_memzone_lookup(name); > >+ if (mz) > >+ return mz; > >+ > > return rte_memzone_reserve_aligned(name, len, socket_id, > > RTE_MEMZONE_IOVA_CONTIG, > > ICE_RING_BASE_ALIGN); > >@@ -493,19 +499,23 @@ ice_fdir_setup(struct ice_pf *pf) > > } > > pf->fdir.prg_pkt =3D mz->addr; > > pf->fdir.dma_addr =3D mz->iova; > >+ pf->fdir.mz =3D mz; > > > > err =3D ice_fdir_prof_alloc(hw); > > if (err) { > > PMD_DRV_LOG(ERR, "Cannot allocate memory for " > > "flow director profile."); > > err =3D -ENOMEM; > >- goto fail_mem; > >+ goto fail_prof; > > } > > > > PMD_DRV_LOG(INFO, "FDIR setup successfully, with programming > queue %u.", > > vsi->base_queue); > > return ICE_SUCCESS; > > > >+fail_prof: > >+ rte_memzone_free(pf->fdir.mz); > >+ pf->fdir.mz =3D NULL; > > fail_mem: > > ice_rx_queue_release(pf->fdir.rxq); > > pf->fdir.rxq =3D NULL; > >@@ -619,6 +629,13 @@ ice_fdir_teardown(struct ice_pf *pf) > > ice_fdir_prof_free(hw); > > ice_release_vsi(vsi); > > pf->fdir.fdir_vsi =3D NULL; > >+ > >+ if (pf->fdir.mz) { > >+ err =3D rte_memzone_free(pf->fdir.mz); > >+ pf->fdir.mz =3D NULL; > >+ if (err) > >+ PMD_DRV_LOG(ERR, "Failed to free memezone."); >=20 > Be more specific about the error, like "Failed to free memzone for flow > director." Got it. >=20 >=20 >=20 > Thanks, > Xiaolong >=20 > >+ } > > } > > > > static int > >-- > >2.17.1 > > Thanks. Shougang