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 959965A43 for ; Fri, 3 Jul 2015 16:04:21 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 03 Jul 2015 07:04:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,400,1432623600"; d="scan'208";a="755507649" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga002.fm.intel.com with ESMTP; 03 Jul 2015 07:04:19 -0700 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t63E4EHm010196; Fri, 3 Jul 2015 15:04:14 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t63E4ErL026366; Fri, 3 Jul 2015 15:04:14 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id t63E4E7m026362; Fri, 3 Jul 2015 15:04:14 +0100 From: Bernard Iremonger To: dev@dpdk.org Date: Fri, 3 Jul 2015 15:04:00 +0100 Message-Id: <1435932240-26064-8-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1435932240-26064-1-git-send-email-bernard.iremonger@intel.com> References: <1435932240-26064-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v6 7/7] i40e: release queue memory in close functions 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, 03 Jul 2015 14:04:22 -0000 add i40e_dev_free_queues() function and call it from close() functions. Signed-off-by: Bernard Iremonger --- drivers/net/i40e/i40e_ethdev.c | 1 + drivers/net/i40e/i40e_ethdev_vf.c | 1 + drivers/net/i40e/i40e_rxtx.c | 20 ++++++++++++++++++++ drivers/net/i40e/i40e_rxtx.h | 1 + 4 files changed, 23 insertions(+), 0 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index bc1bab2..cdb5576 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -1032,6 +1032,7 @@ i40e_dev_close(struct rte_eth_dev *dev) i40e_dev_stop(dev); hw->adapter_stopped = 1; + i40e_dev_free_queues(dev); /* Disable interrupt */ i40e_pf_disable_irq0(hw); diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index d2b86a7..41c0b93 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1756,6 +1756,7 @@ i40evf_dev_close(struct rte_eth_dev *dev) i40evf_dev_stop(dev); hw->adapter_stopped = 1; + i40e_dev_free_queues(dev); i40evf_reset_vf(hw); i40e_shutdown_adminq(hw); } diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c index 2a89e84..6c11c75 100644 --- a/drivers/net/i40e/i40e_rxtx.c +++ b/drivers/net/i40e/i40e_rxtx.c @@ -2588,6 +2588,26 @@ i40e_dev_clear_queues(struct rte_eth_dev *dev) } } +void +i40e_dev_free_queues(struct rte_eth_dev *dev) +{ + uint16_t i; + + PMD_INIT_FUNC_TRACE(); + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + i40e_dev_rx_queue_release(dev->data->rx_queues[i]); + dev->data->rx_queues[i] = NULL; + } + dev->data->nb_rx_queues = 0; + + for (i = 0; i < dev->data->nb_tx_queues; i++) { + i40e_dev_tx_queue_release(dev->data->tx_queues[i]); + dev->data->tx_queues[i] = NULL; + } + dev->data->nb_tx_queues = 0; +} + #define I40E_FDIR_NUM_TX_DESC I40E_MIN_RING_DESC #define I40E_FDIR_NUM_RX_DESC I40E_MIN_RING_DESC diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h index decbc3d..224ebb3 100644 --- a/drivers/net/i40e/i40e_rxtx.h +++ b/drivers/net/i40e/i40e_rxtx.h @@ -198,6 +198,7 @@ int i40e_rx_queue_init(struct i40e_rx_queue *rxq); void i40e_free_tx_resources(struct i40e_tx_queue *txq); void i40e_free_rx_resources(struct i40e_rx_queue *rxq); void i40e_dev_clear_queues(struct rte_eth_dev *dev); +void i40e_dev_free_queues(struct rte_eth_dev *dev); void i40e_reset_rx_queue(struct i40e_rx_queue *rxq); void i40e_reset_tx_queue(struct i40e_tx_queue *txq); void i40e_tx_queue_release_mbufs(struct i40e_tx_queue *txq); -- 1.7.4.1