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 46A8AA04B3 for ; Mon, 11 Nov 2019 09:13:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C7C682A6C; Mon, 11 Nov 2019 09:13:07 +0100 (CET) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id EB72CCF3; Mon, 11 Nov 2019 09:13:03 +0100 (CET) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Nov 2019 00:13:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,291,1569308400"; d="scan'208";a="197594522" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.117.17]) by orsmga008.jf.intel.com with ESMTP; 11 Nov 2019 00:12:59 -0800 Date: Mon, 11 Nov 2019 16:09:48 +0800 From: Ye Xiaolong To: Wang ShougangX Cc: dev@dpdk.org, qiming.yang@intel.com, beilei.xing@intel.com, stable@dpdk.org Message-ID: <20191111080948.GA5870@intel.com> References: <20191105033806.2878-1-shougangx.wang@intel.com> <20191107022217.41046-1-shougangx.wang@intel.com> <20191107022217.41046-2-shougangx.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191107022217.41046-2-shougangx.wang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) 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" 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. In what scenario it will reserve FDIR memzone twice? >- Free FDIR memzone when teardown and other failure scenarios. > >Fixes: 84dc7a95a2d3 ("net/ice: enable flow director engine") >Cc: stable@dpdk.org No need to cc stable since commit 84dc7a95a2d3 is in this release. > >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 = 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 = mz->addr; > pf->fdir.dma_addr = mz->iova; >+ pf->fdir.mz = mz; > > err = ice_fdir_prof_alloc(hw); > if (err) { > PMD_DRV_LOG(ERR, "Cannot allocate memory for " > "flow director profile."); > err = -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 = NULL; > fail_mem: > ice_rx_queue_release(pf->fdir.rxq); > pf->fdir.rxq = 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 = NULL; >+ >+ if (pf->fdir.mz) { >+ err = rte_memzone_free(pf->fdir.mz); >+ pf->fdir.mz = NULL; >+ if (err) >+ PMD_DRV_LOG(ERR, "Failed to free memezone."); Be more specific about the error, like "Failed to free memzone for flow director." Thanks, Xiaolong >+ } > } > > static int >-- >2.17.1 >