From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 73FC9C438 for ; Mon, 29 Jun 2015 10:58:55 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 29 Jun 2015 01:58:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,698,1427785200"; d="scan'208";a="736728553" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by fmsmga001.fm.intel.com with ESMTP; 29 Jun 2015 01:58:53 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX104.gar.corp.intel.com (10.221.44.91) with Microsoft SMTP Server (TLS) id 14.3.224.2; Mon, 29 Jun 2015 16:55:06 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.246]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.168]) with mapi id 14.03.0224.002; Mon, 29 Jun 2015 16:54:51 +0800 From: "Qiu, Michael" To: "Iremonger, Bernard" , "dev@dpdk.org" Thread-Topic: [PATCH v2] librte_ether: release memory in uninit function. Thread-Index: AQHQr/MWrMnfGSFKL02MpXHseHw6cg== Date: Mon, 29 Jun 2015 08:54:50 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286046A625A@SHSMSX101.ccr.corp.intel.com> References: <1435311160-8679-1-git-send-email-bernard.iremonger@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-dev] [PATCH v2] 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: Mon, 29 Jun 2015 08:58:55 -0000 On 6/26/2015 5:32 PM, Iremonger, Bernard wrote:=0A= > Changes in v2:=0A= > do not free mac_addrs and hash_mac_addrs here.=0A= >=0A= > Signed-off-by: Bernard Iremonger =0A= > ---=0A= > lib/librte_ether/rte_ethdev.c | 6 +++++-=0A= > 1 files changed, 5 insertions(+), 1 deletions(-)=0A= >=0A= > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c=0A= > index e13fde5..7ae101a 100644=0A= > --- a/lib/librte_ether/rte_ethdev.c=0A= > +++ b/lib/librte_ether/rte_ethdev.c=0A= > @@ -369,8 +369,12 @@ rte_eth_dev_uninit(struct rte_pci_device *pci_dev)= =0A= > /* free ether device */=0A= > rte_eth_dev_release_port(eth_dev);=0A= > =0A= > - if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY)=0A= > + if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) {=0A= > + rte_free(eth_dev->data->rx_queues);=0A= > + rte_free(eth_dev->data->tx_queues);=0A= > rte_free(eth_dev->data->dev_private);=0A= > + memset(eth_dev->data, 0, sizeof(struct rte_eth_dev_data));=0A= > + }=0A= > =0A= > eth_dev->pci_dev =3D NULL;=0A= > eth_dev->driver =3D NULL;=0A= =0A= =0A= Actually, This could be put in rte_eth_dev_close() becasue queues should=0A= be released when closed.=0A= =0A= Also before free dev->data->rx_queues you should make sure=0A= dev->data->rx_queues[i] has been freed in PMD close() function, So this=0A= two should be better done at the same time, ether in =0A= rte_eth_dev_close() or in PMD close() function. For hotplug in fm10k, I=0A= put it in PMD close() function.=0A= =0A= Thanks,=0A= Michael=0A=