summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Iremonger <bernard.iremonger@intel.com>2015-07-02 15:36:51 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-07-19 21:22:14 +0200
commit5b5edfd0406d95a0432db62bd48ad442bebd896b (patch)
treeec50a7ffa201665d070798e43d745dc8d13740a6
parent2866c5f1b87e71badcaf4e9868c7e8a63e64eb5b (diff)
downloaddpdk-5b5edfd0406d95a0432db62bd48ad442bebd896b.zip
dpdk-5b5edfd0406d95a0432db62bd48ad442bebd896b.tar.gz
dpdk-5b5edfd0406d95a0432db62bd48ad442bebd896b.tar.xz
ixgbe: free queue memory when closing
Add ixgbe_dev_free_queues() function and call it from close() functions. Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
-rw-r--r--drivers/net/ixgbe/ixgbe_ethdev.c4
-rw-r--r--drivers/net/ixgbe/ixgbe_ethdev.h2
-rw-r--r--drivers/net/ixgbe/ixgbe_rxtx.c20
3 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index ec470f6..3a8cff0 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1939,6 +1939,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. */
@@ -3338,6 +3340,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 a79d569..c16c11d 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -313,6 +313,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 a7c94a9..9b2d637 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx.c
+++ b/drivers/net/ixgbe/ixgbe_rxtx.c
@@ -2658,6 +2658,26 @@ 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