[dpdk-dev] [PATCH v4 33/39] bnxt: free memory in close operation

Stephen Hurd stephen.hurd at broadcom.com
Tue Jun 7 00:08:37 CEST 2016


From: Ajit Khaparde <ajit.khaparde at broadcom.com>

This patch adds code to free all resources except the one corresponding
to HWRM, which are required to notify the HWRM that the driver is unloaded
(these are freed in uninit()).

Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
Reviewed-by: David Christensen <david.christensen at broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd at broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index d3a624f..4254531 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -62,14 +62,6 @@ static struct rte_pci_id bnxt_pci_id_map[] = {
 	{.device_id = 0},
 };
 
-static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
-{
-	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
-
-	rte_free(eth_dev->data->mac_addrs);
-	bnxt_free_hwrm_resources(bp);
-}
-
 /***********************/
 
 /*
@@ -388,6 +380,16 @@ error:
 	return rc;
 }
 
+static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
+{
+	struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+
+	bnxt_free_tx_mbufs(bp);
+	bnxt_free_rx_mbufs(bp);
+	bnxt_free_mem(bp);
+	rte_free(eth_dev->data->mac_addrs);
+}
+
 /* Unload the driver, release resources */
 static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 {
-- 
1.9.1



More information about the dev mailing list