From 54a385fa474e627a88beb16321c984a3b030c4dc Mon Sep 17 00:00:00 2001 From: Bernard Iremonger Date: Fri, 3 Jul 2015 15:38:27 +0100 Subject: [PATCH] e1000: free queue memory when closing 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 Acked-by: Helin Zhang --- drivers/net/e1000/e1000_ethdev.h | 2 ++ drivers/net/e1000/em_ethdev.c | 1 + drivers/net/e1000/em_rxtx.c | 6 ++++++ drivers/net/e1000/igb_ethdev.c | 3 ++- drivers/net/e1000/igb_rxtx.c | 6 ++++++ 5 files changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h index ee8b87278d..4e69e44207 100644 --- a/drivers/net/e1000/e1000_ethdev.h +++ b/drivers/net/e1000/e1000_ethdev.h @@ -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, diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index dfabb158ca..d8c04e7ca3 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -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); diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c index 6a5410c986..3b8776d1c1 100644 --- a/drivers/net/e1000/em_rxtx.c +++ b/drivers/net/e1000/em_rxtx.c @@ -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]); diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 1b9f69afb9..ddc71865ab 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -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) diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 3fee735346..3a31b211d9 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -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]); -- 2.20.1