From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Iremonger, Bernard" Subject: Re: [PATCH] librte_ether: release memory in uninit function. Date: Fri, 26 Jun 2015 08:17:30 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C204A42149@IRSMSX108.ger.corp.intel.com> References: <1435242628-8619-1-git-send-email-bernard.iremonger@intel.com> <2601191342CEEE43887BDE71AB97725836A1E193@irsmsx105.ger.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable To: "Ananyev, Konstantin" , "dev@dpdk.org" Return-path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id AB948C7EA for ; Fri, 26 Jun 2015 10:17:32 +0200 (CEST) In-Reply-To: <2601191342CEEE43887BDE71AB97725836A1E193@irsmsx105.ger.corp.intel.com> Content-Language: en-US List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" > -----Original Message----- > From: Ananyev, Konstantin > Sent: Thursday, June 25, 2015 7:33 PM > To: Iremonger, Bernard; dev@dpdk.org > Cc: Zhang, Helin; Qiu, Michael; mukawa@igel.co.jp > Subject: RE: [PATCH] librte_ether: release memory in uninit function. >=20 > Hi Bernard, >=20 > > -----Original Message----- > > From: Iremonger, Bernard > > Sent: Thursday, June 25, 2015 3:30 PM > > To: dev@dpdk.org > > Cc: Zhang, Helin; Ananyev, Konstantin; Qiu, Michael; > > mukawa@igel.co.jp; Iremonger, Bernard > > Subject: [PATCH] librte_ether: release memory in uninit function. > > > > > > Signed-off-by: Bernard Iremonger > > --- > > lib/librte_ether/rte_ethdev.c | 8 +++++++- > > 1 files changed, 7 insertions(+), 1 deletions(-) > > > > diff --git a/lib/librte_ether/rte_ethdev.c > > b/lib/librte_ether/rte_ethdev.c index e13fde5..2404556 100644 > > --- a/lib/librte_ether/rte_ethdev.c > > +++ b/lib/librte_ether/rte_ethdev.c > > @@ -369,8 +369,14 @@ rte_eth_dev_uninit(struct rte_pci_device > *pci_dev) > > /* free ether device */ > > rte_eth_dev_release_port(eth_dev); > > > > - if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) > > + if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) { > > + rte_free(eth_dev->data->rx_queues); > > + rte_free(eth_dev->data->tx_queues); > > rte_free(eth_dev->data->dev_private); > > + rte_free(eth_dev->data->mac_addrs); > > + rte_free(eth_dev->data->hash_mac_addrs); >=20 > Sorry, but I don't understand why you put last 2 rte_free()s here. > You already do relese mac_addrs and hash_mac_addrs memory at each PMD > _uninit routine. > Plus, as Stephen said - it would be better if same component (PMD in that > case) would do both alloc and free. > Apart from that, patch looks good to me. >=20 > Konstantin Hi Konstantin, I thought it might be safer to free the memory here rather than relying on = the PMD to do it. It is probably better if the PMD who does the alloc also does the free. I will send a v2 of the patch. Regards, Bernard. >=20 >=20 > > + memset(eth_dev->data, 0, sizeof(struct > rte_eth_dev_data)); > > + } > > > > eth_dev->pci_dev =3D NULL; > > eth_dev->driver =3D NULL; > > -- > > 1.7.4.1