]> git.droids-corp.org - dpdk.git/commitdiff
i40e: free queue memory when closing
authorBernard Iremonger <bernard.iremonger@intel.com>
Fri, 3 Jul 2015 14:04:00 +0000 (15:04 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 19 Jul 2015 19:36:24 +0000 (21:36 +0200)
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>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev_vf.c
drivers/net/i40e/i40e_rxtx.c
drivers/net/i40e/i40e_rxtx.h

index 62e5572b044c653494982d9fc408a6ae01ab5c81..c855af2b1ff253ad854de99e828d820505b8eca7 100644 (file)
@@ -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);
index 6d1cc6a484ca78d9dd61e587a5737bdd3bdc5a78..568a685c543f535e2057cb0e274ea808245d5fbd 100644 (file)
@@ -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);
 }
index be0d9a0becc1a6ddf32b0fced6c92faa31ef68c3..891a221aeb45f3109cd861ac75c3b66bd73cbbee 100644 (file)
@@ -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
 
index 87222e6f7e4b9273edbbfd06d4db7f050bea1a54..4385142d7ce4e06b1511cee830391a37f26ee093 100644 (file)
@@ -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);