e1000: free queue memory when closing
authorBernard Iremonger <bernard.iremonger@intel.com>
Fri, 3 Jul 2015 14:38:27 +0000 (15:38 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Sun, 19 Jul 2015 19:22:03 +0000 (21:22 +0200)
Queues were freed in clear function called in stop function.
Split clearing and freeing in separate functions to
move queue freeing from stop to close function.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
drivers/net/e1000/e1000_ethdev.h
drivers/net/e1000/em_ethdev.c
drivers/net/e1000/em_rxtx.c
drivers/net/e1000/igb_ethdev.c
drivers/net/e1000/igb_rxtx.c

index ee8b872..4e69e44 100644 (file)
@@ -259,6 +259,7 @@ struct e1000_adapter {
 void eth_igb_tx_queue_release(void *txq);
 void eth_igb_rx_queue_release(void *rxq);
 void igb_dev_clear_queues(struct rte_eth_dev *dev);
+void igb_dev_free_queues(struct rte_eth_dev *dev);
 
 int eth_igb_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
                uint16_t nb_rx_desc, unsigned int socket_id,
@@ -313,6 +314,7 @@ void eth_em_tx_queue_release(void *txq);
 void eth_em_rx_queue_release(void *rxq);
 
 void em_dev_clear_queues(struct rte_eth_dev *dev);
+void em_dev_free_queues(struct rte_eth_dev *dev);
 
 int eth_em_rx_queue_setup(struct rte_eth_dev *dev, uint16_t rx_queue_id,
                uint16_t nb_rx_desc, unsigned int socket_id,
index dfabb15..d8c04e7 100644 (file)
@@ -659,6 +659,7 @@ eth_em_close(struct rte_eth_dev *dev)
 
        eth_em_stop(dev);
        adapter->stopped = 1;
+       em_dev_free_queues(dev);
        e1000_phy_hw_reset(hw);
        em_release_manageability(hw);
        em_hw_control_release(hw);
index 6a5410c..3b8776d 100644 (file)
@@ -1513,6 +1513,12 @@ em_dev_clear_queues(struct rte_eth_dev *dev)
                        em_reset_rx_queue(rxq);
                }
        }
+}
+
+void
+em_dev_free_queues(struct rte_eth_dev *dev)
+{
+       uint16_t i;
 
        for (i = 0; i < dev->data->nb_rx_queues; i++) {
                eth_em_rx_queue_release(dev->data->rx_queues[i]);
index 1b9f69a..ddc7186 100644 (file)
@@ -1134,7 +1134,7 @@ eth_igb_close(struct rte_eth_dev *dev)
                E1000_WRITE_REG(hw, E1000_82580_PHY_POWER_MGMT, phpm_reg);
        }
 
-       igb_dev_clear_queues(dev);
+       igb_dev_free_queues(dev);
 
        memset(&link, 0, sizeof(link));
        rte_igb_dev_atomic_write_link_status(dev, &link);
@@ -2417,6 +2417,7 @@ igbvf_dev_close(struct rte_eth_dev *dev)
 
        igbvf_dev_stop(dev);
        adapter->stopped = 1;
+       igb_dev_free_queues(dev);
 }
 
 static int igbvf_set_vfta(struct e1000_hw *hw, uint16_t vid, bool on)
index 3fee735..3a31b21 100644 (file)
@@ -1602,6 +1602,12 @@ igb_dev_clear_queues(struct rte_eth_dev *dev)
                        igb_reset_rx_queue(rxq);
                }
        }
+}
+
+void
+igb_dev_free_queues(struct rte_eth_dev *dev)
+{
+       uint16_t i;
 
        for (i = 0; i < dev->data->nb_rx_queues; i++) {
                eth_igb_rx_queue_release(dev->data->rx_queues[i]);