[dpdk-dev,v6,2/2] ixgbe: release queue memory in close functions
diff mbox

Message ID 1435847811-23293-4-git-send-email-bernard.iremonger@intel.com
State Accepted, archived
Headers show

Commit Message

Iremonger, Bernard July 2, 2015, 2:36 p.m. UTC
add ixgbe_dev_free_queues() function and call it from close() functions.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 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(-)

Patch
diff mbox

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