From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 920FBC69E for ; Fri, 19 Jun 2015 09:36:08 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP; 19 Jun 2015 00:36:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,643,1427785200"; d="scan'208";a="590741078" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by orsmga003.jf.intel.com with ESMTP; 19 Jun 2015 00:36:03 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.224.2; Fri, 19 Jun 2015 15:36:02 +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; Fri, 19 Jun 2015 15:36:01 +0800 From: "Qiu, Michael" To: "Iremonger, Bernard" , "dev@dpdk.org" Thread-Topic: [PATCH 1/2 v2] fm10k: Free queues when close port Thread-Index: AQHQqNOTTUF2oB1FAku3jL1Bw1jHFg== Date: Fri, 19 Jun 2015 07:36:00 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E602860469D912@SHSMSX101.ccr.corp.intel.com> References: <1433938895-16331-2-git-send-email-michael.qiu@intel.com> <1434527947-15268-1-git-send-email-michael.qiu@intel.com> <8CEF83825BEC744B83065625E567D7C204A37E03@IRSMSX108.ger.corp.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 Cc: "He, Shaopeng" Subject: Re: [dpdk-dev] [PATCH 1/2 v2] fm10k: Free queues when close port 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, 19 Jun 2015 07:36:09 -0000 On 6/19/2015 12:29 AM, Iremonger, Bernard wrote:=0A= >> -----Original Message-----=0A= >> From: Qiu, Michael=0A= >> Sent: Wednesday, June 17, 2015 8:59 AM=0A= >> To: dev@dpdk.org=0A= >> Cc: Chen, Jing D; Iremonger, Bernard; He, Shaopeng; Qiu, Michael=0A= >> Subject: [PATCH 1/2 v2] fm10k: Free queues when close port=0A= >>=0A= >> When close a port, lots of memory should be released, such as software= =0A= >> rings, queues, etc.=0A= >>=0A= >> Signed-off-by: Michael Qiu =0A= > Hi Michael,=0A= >=0A= > There are two comments inline.=0A= >=0A= >=0A= >> ---=0A= >> change log:=0A= >> v2 --> v1: remove __rte_unused flag=0A= >>=0A= >> drivers/net/fm10k/fm10k_ethdev.c | 37=0A= >> +++++++++++++++++++++++++++++++++----=0A= >> 1 file changed, 33 insertions(+), 4 deletions(-)=0A= >>=0A= >> diff --git a/drivers/net/fm10k/fm10k_ethdev.c=0A= >> b/drivers/net/fm10k/fm10k_ethdev.c=0A= >> index 87852ed..e310698 100644=0A= >> --- a/drivers/net/fm10k/fm10k_ethdev.c=0A= >> +++ b/drivers/net/fm10k/fm10k_ethdev.c=0A= >> @@ -52,6 +52,10 @@=0A= >>=0A= >> static void fm10k_close_mbx_service(struct fm10k_hw *hw);=0A= >>=0A= >> +static void fm10k_tx_queue_release(void *queue);=0A= >> +=0A= >> +static void fm10k_rx_queue_release(void *queue);=0A= >> +=0A= >> static void=0A= >> fm10k_mbx_initlock(struct fm10k_hw *hw) { @@ -665,11 +669,35 @@=0A= >> fm10k_dev_stop(struct rte_eth_dev *dev)=0A= >>=0A= >> PMD_INIT_FUNC_TRACE();=0A= >>=0A= >> - for (i =3D 0; i < dev->data->nb_tx_queues; i++)=0A= >> - fm10k_dev_tx_queue_stop(dev, i);=0A= >> + if (dev->data->tx_queues)=0A= >> + for (i =3D 0; i < dev->data->nb_tx_queues; i++)=0A= >> + fm10k_dev_tx_queue_stop(dev, i);=0A= >> +=0A= >> + if (dev->data->rx_queues)=0A= >> + for (i =3D 0; i < dev->data->nb_rx_queues; i++)=0A= >> + fm10k_dev_rx_queue_stop(dev, i);=0A= >> +}=0A= >>=0A= >> - for (i =3D 0; i < dev->data->nb_rx_queues; i++)=0A= >> - fm10k_dev_rx_queue_stop(dev, i);=0A= >> +static void=0A= >> +fm10k_dev_queue_release(struct rte_eth_dev *dev) {=0A= >> + int i;=0A= >> +=0A= >> + PMD_INIT_FUNC_TRACE();=0A= >> +=0A= >> + if (dev->data->tx_queues) {=0A= >> + for (i =3D 0; i < dev->data->nb_tx_queues; i++)=0A= >> + fm10k_tx_queue_release(dev->data-=0A= >>> tx_queues[i]);=0A= >> + rte_free(dev->data->tx_queues);=0A= >> + dev->data->tx_queues =3D NULL;=0A= > The following line should be added here:=0A= > dev->data->nb_tx_queues =3D 0;=0A= =0A= Hi, Bernard=0A= =0A= dev->data->nb_tx_queues will be init as 0 in rte_eth_dev_tx_queue_config()= =0A= =0A= And it has no issue here, I think. But I can add and send out new version= =0A= =0A= Thanks,=0A= Michael=0A= =0A= >=0A= >> + }=0A= >> +=0A= >> + if (dev->data->rx_queues) {=0A= >> + for (i =3D 0; i < dev->data->nb_rx_queues; i++)=0A= >> + fm10k_rx_queue_release(dev->data-=0A= >>> rx_queues[i]);=0A= >> + rte_free(dev->data->rx_queues);=0A= >> + dev->data->rx_queues =3D NULL;=0A= > The following line should be added here:=0A= > dev->data->nb_rx_queues =3D 0;=0A= >=0A= >> + }=0A= >> }=0A= >>=0A= >> static void=0A= >> @@ -682,6 +710,7 @@ fm10k_dev_close(struct rte_eth_dev *dev)=0A= >> /* Stop mailbox service first */=0A= >> fm10k_close_mbx_service(hw);=0A= >> fm10k_dev_stop(dev);=0A= >> + fm10k_dev_queue_release(dev);=0A= >> fm10k_stop_hw(hw);=0A= >> }=0A= >>=0A= >> --=0A= >> 1.9.3=0A= >=0A= =0A=