DPDK patches and discussions
 help / color / mirror / Atom feed
From: Chaoyong He <chaoyong.he@corigine.com>
To: dev@dpdk.org
Cc: oss-drivers@corigine.com, Chaoyong He <chaoyong.he@corigine.com>,
	stable@dpdk.org, Long Wu <long.wu@corigine.com>,
	Peng Zhang <peng.zhang@corigine.com>
Subject: [PATCH v2 3/8] net/nfp: fix resource leak for CoreNIC firmware
Date: Mon,  4 Dec 2023 09:57:13 +0800	[thread overview]
Message-ID: <20231204015718.780578-4-chaoyong.he@corigine.com> (raw)
In-Reply-To: <20231204015718.780578-1-chaoyong.he@corigine.com>

Fix the resource leak problem in the logic of CoreNIC firmware
application.

Fixes: 646ea79ce481 ("net/nfp: move PF functions into its own file")
Cc: stable@dpdk.org

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
Reviewed-by: Peng Zhang <peng.zhang@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 2a80a592f2..c132e97d1a 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -317,6 +317,18 @@ nfp_net_keepalive_stop(struct nfp_multi_pf *multi_pf)
 	rte_eal_alarm_cancel(nfp_net_beat_timer, (void *)multi_pf);
 }
 
+static void
+nfp_net_uninit(struct rte_eth_dev *eth_dev)
+{
+	struct nfp_net_hw *net_hw;
+
+	net_hw = eth_dev->data->dev_private;
+	rte_free(net_hw->eth_xstats_base);
+	nfp_ipsec_uninit(eth_dev);
+	if (net_hw->mac_stats_area != NULL)
+		nfp_cpp_area_release_free(net_hw->mac_stats_area);
+}
+
 /* Reset and stop device. The device can not be restarted. */
 static int
 nfp_net_close(struct rte_eth_dev *dev)
@@ -1137,12 +1149,11 @@ nfp_init_app_fw_nic(struct nfp_pf_dev *pf_dev,
 				app_fw_nic->ports[id]->eth_dev != NULL) {
 			struct rte_eth_dev *tmp_dev;
 			tmp_dev = app_fw_nic->ports[id]->eth_dev;
-			nfp_ipsec_uninit(tmp_dev);
+			nfp_net_uninit(tmp_dev);
 			rte_eth_dev_release_port(tmp_dev);
-			app_fw_nic->ports[id] = NULL;
 		}
 	}
-	nfp_cpp_area_free(pf_dev->ctrl_area);
+	nfp_cpp_area_release_free(pf_dev->ctrl_area);
 app_cleanup:
 	rte_free(app_fw_nic);
 
-- 
2.39.1


  parent reply	other threads:[~2023-12-04  1:58 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-30  8:52 [PATCH 0/7] fix resource leak problems Chaoyong He
2023-11-30  8:52 ` [PATCH 1/7] net/nfp: fix resource leak for device initialization Chaoyong He
2023-11-30  8:52 ` [PATCH 2/7] net/nfp: fix resource leak for CoreNIC firmware Chaoyong He
2023-11-30  8:52 ` [PATCH 3/7] net/nfp: fix resource leak for PF initialization Chaoyong He
2023-11-30  8:52 ` [PATCH 4/7] net/nfp: fix resource leak for flower firmware Chaoyong He
2023-11-30  8:52 ` [PATCH 5/7] net/nfp: fix resource leak for exit of CoreNIC firmware Chaoyong He
2023-11-30 11:00   ` Ferruh Yigit
2023-12-01  3:00     ` Chaoyong He
2023-12-01  9:41       ` Ferruh Yigit
2023-12-01 10:03         ` Chaoyong He
2023-11-30  8:52 ` [PATCH 6/7] net/nfp: fix resource leak for exit of flower firmware Chaoyong He
2023-11-30  8:52 ` [PATCH 7/7] net/nfp: fix resource leak for VF Chaoyong He
2023-12-04  1:57 ` [PATCH v2 0/8] fix resource leak problems Chaoyong He
2023-12-04  1:57   ` [PATCH v2 1/8] net/nfp: modify the process private data Chaoyong He
2023-12-04  1:57   ` [PATCH v2 2/8] net/nfp: fix resource leak for device initialization Chaoyong He
2023-12-04  1:57   ` Chaoyong He [this message]
2023-12-04  1:57   ` [PATCH v2 4/8] net/nfp: fix resource leak for PF initialization Chaoyong He
2023-12-04  1:57   ` [PATCH v2 5/8] net/nfp: fix resource leak for flower firmware Chaoyong He
2023-12-04  1:57   ` [PATCH v2 6/8] net/nfp: fix resource leak for exit of CoreNIC firmware Chaoyong He
2023-12-04  1:57   ` [PATCH v2 7/8] net/nfp: fix resource leak for exit of flower firmware Chaoyong He
2023-12-04  1:57   ` [PATCH v2 8/8] net/nfp: fix resource leak for VF Chaoyong He
2023-12-04 12:22   ` [PATCH v2 0/8] fix resource leak problems Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231204015718.780578-4-chaoyong.he@corigine.com \
    --to=chaoyong.he@corigine.com \
    --cc=dev@dpdk.org \
    --cc=long.wu@corigine.com \
    --cc=oss-drivers@corigine.com \
    --cc=peng.zhang@corigine.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).