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 6CF29C72A for ; Thu, 18 Jun 2015 18:30:07 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP; 18 Jun 2015 09:30:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,638,1427785200"; d="scan'208";a="749100430" Received: from irsmsx109.ger.corp.intel.com ([163.33.3.23]) by orsmga002.jf.intel.com with ESMTP; 18 Jun 2015 09:30:05 -0700 Received: from irsmsx108.ger.corp.intel.com ([169.254.11.201]) by IRSMSX109.ger.corp.intel.com ([169.254.13.200]) with mapi id 14.03.0224.002; Thu, 18 Jun 2015 17:29:49 +0100 From: "Iremonger, Bernard" To: "Qiu, Michael" , "dev@dpdk.org" Thread-Topic: [PATCH 1/2 v2] fm10k: Free queues when close port Thread-Index: AQHQqNOUi6AC38cIykGDS8uLuvaBF52ydPCA Date: Thu, 18 Jun 2015 16:29:48 +0000 Message-ID: <8CEF83825BEC744B83065625E567D7C204A37E03@IRSMSX108.ger.corp.intel.com> References: <1433938895-16331-2-git-send-email-michael.qiu@intel.com> <1434527947-15268-1-git-send-email-michael.qiu@intel.com> In-Reply-To: <1434527947-15268-1-git-send-email-michael.qiu@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.182] 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: Thu, 18 Jun 2015 16:30:07 -0000 > -----Original Message----- > From: Qiu, Michael > Sent: Wednesday, June 17, 2015 8:59 AM > To: dev@dpdk.org > Cc: Chen, Jing D; Iremonger, Bernard; He, Shaopeng; Qiu, Michael > Subject: [PATCH 1/2 v2] fm10k: Free queues when close port >=20 > When close a port, lots of memory should be released, such as software > rings, queues, etc. >=20 > Signed-off-by: Michael Qiu Hi Michael, There are two comments inline. > --- > change log: > v2 --> v1: remove __rte_unused flag >=20 > drivers/net/fm10k/fm10k_ethdev.c | 37 > +++++++++++++++++++++++++++++++++---- > 1 file changed, 33 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/fm10k/fm10k_ethdev.c > b/drivers/net/fm10k/fm10k_ethdev.c > index 87852ed..e310698 100644 > --- a/drivers/net/fm10k/fm10k_ethdev.c > +++ b/drivers/net/fm10k/fm10k_ethdev.c > @@ -52,6 +52,10 @@ >=20 > static void fm10k_close_mbx_service(struct fm10k_hw *hw); >=20 > +static void fm10k_tx_queue_release(void *queue); > + > +static void fm10k_rx_queue_release(void *queue); > + > static void > fm10k_mbx_initlock(struct fm10k_hw *hw) { @@ -665,11 +669,35 @@ > fm10k_dev_stop(struct rte_eth_dev *dev) >=20 > PMD_INIT_FUNC_TRACE(); >=20 > - for (i =3D 0; i < dev->data->nb_tx_queues; i++) > - fm10k_dev_tx_queue_stop(dev, i); > + if (dev->data->tx_queues) > + for (i =3D 0; i < dev->data->nb_tx_queues; i++) > + fm10k_dev_tx_queue_stop(dev, i); > + > + if (dev->data->rx_queues) > + for (i =3D 0; i < dev->data->nb_rx_queues; i++) > + fm10k_dev_rx_queue_stop(dev, i); > +} >=20 > - for (i =3D 0; i < dev->data->nb_rx_queues; i++) > - fm10k_dev_rx_queue_stop(dev, i); > +static void > +fm10k_dev_queue_release(struct rte_eth_dev *dev) { > + int i; > + > + PMD_INIT_FUNC_TRACE(); > + > + if (dev->data->tx_queues) { > + for (i =3D 0; i < dev->data->nb_tx_queues; i++) > + fm10k_tx_queue_release(dev->data- > >tx_queues[i]); > + rte_free(dev->data->tx_queues); > + dev->data->tx_queues =3D NULL; The following line should be added here: dev->data->nb_tx_queues =3D 0; > + } > + > + if (dev->data->rx_queues) { > + for (i =3D 0; i < dev->data->nb_rx_queues; i++) > + fm10k_rx_queue_release(dev->data- > >rx_queues[i]); > + rte_free(dev->data->rx_queues); > + dev->data->rx_queues =3D NULL; The following line should be added here: dev->data->nb_rx_queues =3D 0; > + } > } >=20 > static void > @@ -682,6 +710,7 @@ fm10k_dev_close(struct rte_eth_dev *dev) > /* Stop mailbox service first */ > fm10k_close_mbx_service(hw); > fm10k_dev_stop(dev); > + fm10k_dev_queue_release(dev); > fm10k_stop_hw(hw); > } >=20 > -- > 1.9.3