summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Iremonger <bernard.iremonger@intel.com>2015-07-03 15:04:00 +0100
committerThomas Monjalon <thomas.monjalon@6wind.com>2015-07-19 21:36:24 +0200
commit6b4537128394ab15b943145f3d1e03a1fb07bbb8 (patch)
tree4dbdd201a5d19b4776ae07408fa46d96f6975bfe
parent1ee9e8228960d2625859e9092825b30dcb0808b2 (diff)
downloaddpdk-6b4537128394ab15b943145f3d1e03a1fb07bbb8.zip
dpdk-6b4537128394ab15b943145f3d1e03a1fb07bbb8.tar.gz
dpdk-6b4537128394ab15b943145f3d1e03a1fb07bbb8.tar.xz
i40e: free queue memory when closing
Add i40e_dev_free_queues() function and call it from close() functions. Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com> Acked-by: Helin Zhang <helin.zhang@intel.com>
-rw-r--r--drivers/net/i40e/i40e_ethdev.c1
-rw-r--r--drivers/net/i40e/i40e_ethdev_vf.c1
-rw-r--r--drivers/net/i40e/i40e_rxtx.c20
-rw-r--r--drivers/net/i40e/i40e_rxtx.h1
4 files changed, 23 insertions, 0 deletions
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 62e5572..c855af2 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1069,6 +1069,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 6d1cc6a..568a685 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1770,6 +1770,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 be0d9a0..891a221 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3209,6 +3209,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 87222e6..4385142 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -199,6 +199,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);