ixgbe: free queue memory when closing
authorBernard Iremonger <bernard.iremonger@intel.com>
Thu, 2 Jul 2015 14:36:51 +0000 (15:36 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 19 Jul 2015 19:22:14 +0000 (21:22 +0200)
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>
drivers/net/ixgbe/ixgbe_ethdev.c
drivers/net/ixgbe/ixgbe_ethdev.h
drivers/net/ixgbe/ixgbe_rxtx.c

index ec470f6..3a8cff0 100644 (file)
@@ -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);
 }
index a79d569..c16c11d 100644 (file)
@@ -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);
index a7c94a9..9b2d637 100644 (file)
@@ -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