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 B9BA437AF for ; Thu, 2 Jul 2015 16:37:05 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 02 Jul 2015 07:37:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,393,1432623600"; d="scan'208";a="721774233" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 02 Jul 2015 07:36:59 -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 t62Eawct003494; Thu, 2 Jul 2015 15:36:58 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id t62Eaw9P023359; Thu, 2 Jul 2015 15:36:58 +0100 Received: (from bairemon@localhost) by sivswdev01.ir.intel.com with id t62EawxN023354; Thu, 2 Jul 2015 15:36:58 +0100 From: Bernard Iremonger To: dev@dpdk.org Date: Thu, 2 Jul 2015 15:36:51 +0100 Message-Id: <1435847811-23293-4-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1435847811-23293-1-git-send-email-bernard.iremonger@intel.com> References: <1435847811-23293-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v6 2/2] ixgbe: 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: Thu, 02 Jul 2015 14:37:06 -0000 add ixgbe_dev_free_queues() function and call it from close() functions. Signed-off-by: Bernard Iremonger --- drivers/net/ixgbe/ixgbe_ethdev.c | 4 ++++ drivers/net/ixgbe/ixgbe_ethdev.h | 2 ++ drivers/net/ixgbe/ixgbe_rxtx.c | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 0 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index f5fe120..4ff1671 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1843,6 +1843,8 @@ ixgbe_dev_close(struct rte_eth_dev *dev) ixgbe_dev_stop(dev); hw->adapter_stopped = 1; + ixgbe_dev_free_queues(dev); + ixgbe_disable_pcie_master(hw); /* reprogram the RAR[0] in case user changed it. */ @@ -3157,6 +3159,8 @@ ixgbevf_dev_close(struct rte_eth_dev *dev) ixgbevf_dev_stop(dev); + ixgbe_dev_free_queues(dev); + /* reprogram the RAR[0] in case user changed it. */ ixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV); } diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h index 710ee87..fb9cea6 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.h +++ b/drivers/net/ixgbe/ixgbe_ethdev.h @@ -311,6 +311,8 @@ struct ixgbe_adapter { */ void ixgbe_dev_clear_queues(struct rte_eth_dev *dev); +void ixgbe_dev_free_queues(struct rte_eth_dev *dev); + void ixgbe_dev_rx_queue_release(void *rxq); void ixgbe_dev_tx_queue_release(void *txq); diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c index 3ace8a8..52ac188 100644 --- a/drivers/net/ixgbe/ixgbe_rxtx.c +++ b/drivers/net/ixgbe/ixgbe_rxtx.c @@ -2496,6 +2496,25 @@ ixgbe_dev_clear_queues(struct rte_eth_dev *dev) } } +void +ixgbe_dev_free_queues(struct rte_eth_dev *dev) +{ + unsigned i; + + PMD_INIT_FUNC_TRACE(); + + for (i = 0; i < dev->data->nb_rx_queues; i++) { + ixgbe_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++) { + ixgbe_dev_tx_queue_release(dev->data->tx_queues[i]); + dev->data->tx_queues[i] = NULL; + } + dev->data->nb_tx_queues = 0; +} /********************************************************************* * * Device RX/TX init functions -- 1.7.4.1