[dpdk-dev,v7,2/2] e1000: free queue memory in close functions
diff mbox

Message ID 1435934307-4495-3-git-send-email-bernard.iremonger@intel.com
State Accepted, archived
Headers show

Commit Message

Iremonger, Bernard July 3, 2015, 2:38 p.m. UTC
add new functions igb_dev_free_queues() and em_dev_free_queues()

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
---
 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 deletions(-)

Comments

Helin Zhang July 13, 2015, 3:54 p.m. UTC | #1
> -----Original Message-----
> From: Iremonger, Bernard
> Sent: Friday, July 3, 2015 7:38 AM
> To: dev@dpdk.org
> Cc: Zhang, Helin; Qiu, Michael; Iremonger, Bernard
> Subject: [PATCH v7 2/2] e1000: free queue memory in close functions
> 
> add new functions igb_dev_free_queues() and em_dev_free_queues()
> 
> Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

Patch
diff mbox

diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index ee8b872..4e69e44 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 dfabb15..d8c04e7 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 976df60..9913ad0 100644
--- a/drivers/net/e1000/em_rxtx.c
+++ b/drivers/net/e1000/em_rxtx.c
@@ -1512,6 +1512,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 80e4a6c..6e92f2e 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -1089,7 +1089,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);
@@ -2363,6 +2363,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 1bf8c93..0aecf8c 100644
--- a/drivers/net/e1000/igb_rxtx.c
+++ b/drivers/net/e1000/igb_rxtx.c
@@ -1498,6 +1498,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]);