From mboxrd@z Thu Jan 1 00:00:00 1970 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) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP; 26 Jun 2015 01:17:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,683,1427785200"; d="scan'208";a="735063100" Received: from irsmsx107.ger.corp.intel.com ([163.33.3.99]) by fmsmga001.fm.intel.com with ESMTP; 26 Jun 2015 01:17:30 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.201]) by IRSMSX107.ger.corp.intel.com ([169.254.10.39]) with mapi id 14.03.0224.002; Fri, 26 Jun 2015 09:17:30 +0100 From: "Iremonger, Bernard" To: "Ananyev, Konstantin" , "dev@dpdk.org" Thread-Topic: [PATCH] librte_ether: release memory in uninit function. Thread-Index: AQHQr1ODYI6RvIWfakGyy9IaW4okIJ29ifFAgADnT1A= 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> In-Reply-To: <2601191342CEEE43887BDE71AB97725836A1E193@irsmsx105.ger.corp.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] librte_ether: release memory in uninit function. X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Jun 2015 08:17:33 -0000 > -----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