From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <jing.d.chen@intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id 982495A0A
 for <dev@dpdk.org>; Fri, 12 Jun 2015 09:27:19 +0200 (CEST)
Received: from fmsmga001.fm.intel.com ([10.253.24.23])
 by orsmga101.jf.intel.com with ESMTP; 12 Jun 2015 00:27:10 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.13,600,1427785200"; d="scan'208";a="725864976"
Received: from pgsmsx108.gar.corp.intel.com ([10.221.44.103])
 by fmsmga001.fm.intel.com with ESMTP; 12 Jun 2015 00:27:10 -0700
Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by
 PGSMSX108.gar.corp.intel.com (10.221.44.103) with Microsoft SMTP Server (TLS)
 id 14.3.224.2; Fri, 12 Jun 2015 15:27:07 +0800
Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.165]) by
 SHSMSX103.ccr.corp.intel.com ([169.254.4.46]) with mapi id 14.03.0224.002;
 Fri, 12 Jun 2015 15:27:06 +0800
From: "Chen, Jing D" <jing.d.chen@intel.com>
To: "Qiu, Michael" <michael.qiu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH 1/2] fm10k: Free queues when close port
Thread-Index: AQHQo3gTtA1DJ2kc2ke75rif77fP+Z2oet7A
Date: Fri, 12 Jun 2015 07:27:06 +0000
Message-ID: <4341B239C0EFF9468EE453F9E9F4604D0170A769@shsmsx102.ccr.corp.intel.com>
References: <1433083021-16701-1-git-send-email-michael.qiu@intel.com>
 <1433938895-16331-1-git-send-email-michael.qiu@intel.com>
 <1433938895-16331-2-git-send-email-michael.qiu@intel.com>
In-Reply-To: <1433938895-16331-2-git-send-email-michael.qiu@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" <shaopeng.he@intel.com>
Subject: Re: [dpdk-dev] [PATCH 1/2] 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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Fri, 12 Jun 2015 07:27:20 -0000

Hi,

> -----Original Message-----
> From: Qiu, Michael
> Sent: Wednesday, June 10, 2015 8:22 PM
> To: dev@dpdk.org
> Cc: Chen, Jing D; Iremonger, Bernard; He, Shaopeng; Qiu, Michael
> Subject: [PATCH 1/2] 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 <michael.qiu@intel.com>
> ---
>  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(__rte_unused struct rte_eth_dev *dev)

Remove __rte_unused ?

> +{
> +	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;
> +	}
> +
> +	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;
> +	}
>  }
>=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