DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: ferruh.yigit@amd.com, Gagandeep Singh <g.singh@nxp.com>
Subject: [PATCH v3 16/18] net/dpaa: improve the dpaa port cleanup
Date: Mon, 30 Sep 2024 15:59:44 +0530	[thread overview]
Message-ID: <20240930102946.3236998-17-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20240930102946.3236998-1-hemant.agrawal@nxp.com>

From: Gagandeep Singh <g.singh@nxp.com>

During DPAA cleanup in FMCLESS mode, application can
see segmentation fault in device close API and in DPAA
destructor execution.
Segmentation fault in device close is because driver
reducing the number of queues initialised during
device configuration without releasing the actual queues.

And segmentation fault in DPAA destruction is because
it is trying to access RTE* devices whose memory has
been released in rte_eal_cleanup() call by the application.

This patch improves the behavior.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 33 +++++++++++----------------------
 drivers/net/dpaa/dpaa_flow.c   |  5 ++---
 2 files changed, 13 insertions(+), 25 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 133fbd5bc9..41ae033c75 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -561,10 +561,10 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	if (dpaa_intf->cgr_rx) {
 		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++)
 			qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
+		rte_free(dpaa_intf->cgr_rx);
+		dpaa_intf->cgr_rx = NULL;
 	}
 
-	rte_free(dpaa_intf->cgr_rx);
-	dpaa_intf->cgr_rx = NULL;
 	/* Release TX congestion Groups */
 	if (dpaa_intf->cgr_tx) {
 		for (loop = 0; loop < MAX_DPAA_CORES; loop++)
@@ -578,6 +578,15 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 
 	rte_free(dpaa_intf->tx_queues);
 	dpaa_intf->tx_queues = NULL;
+	if (dpaa_intf->port_handle) {
+		if (dpaa_fm_deconfig(dpaa_intf, fif))
+			DPAA_PMD_WARN("DPAA FM "
+				"deconfig failed\n");
+	}
+	if (fif->num_profiles) {
+		if (dpaa_port_vsp_cleanup(dpaa_intf, fif))
+			DPAA_PMD_WARN("DPAA FM vsp cleanup failed\n");
+	}
 
 	return ret;
 }
@@ -2607,26 +2616,6 @@ static void __attribute__((destructor(102))) dpaa_finish(void)
 		return;
 
 	if (!(default_q || fmc_q)) {
-		unsigned int i;
-
-		for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-			if (rte_eth_devices[i].dev_ops == &dpaa_devops) {
-				struct rte_eth_dev *dev = &rte_eth_devices[i];
-				struct dpaa_if *dpaa_intf =
-					dev->data->dev_private;
-				struct fman_if *fif =
-					dev->process_private;
-				if (dpaa_intf->port_handle)
-					if (dpaa_fm_deconfig(dpaa_intf, fif))
-						DPAA_PMD_WARN("DPAA FM "
-							"deconfig failed");
-				if (fif->num_profiles) {
-					if (dpaa_port_vsp_cleanup(dpaa_intf,
-								  fif))
-						DPAA_PMD_WARN("DPAA FM vsp cleanup failed");
-				}
-			}
-		}
 		if (is_global_init)
 			if (dpaa_fm_term())
 				DPAA_PMD_WARN("DPAA FM term failed");
diff --git a/drivers/net/dpaa/dpaa_flow.c b/drivers/net/dpaa/dpaa_flow.c
index b9cd11efa1..c01d8eaca1 100644
--- a/drivers/net/dpaa/dpaa_flow.c
+++ b/drivers/net/dpaa/dpaa_flow.c
@@ -13,6 +13,7 @@
 #include <rte_dpaa_logs.h>
 #include <fmlib/fm_port_ext.h>
 #include <fmlib/fm_vsp_ext.h>
+#include <rte_pmd_dpaa.h>
 
 #define DPAA_MAX_NUM_ETH_DEV	8
 
@@ -811,8 +812,6 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set)
 		return -1;
 	}
 
-	dpaa_intf->nb_rx_queues = dev->data->nb_rx_queues;
-
 	/* Open FM Port and set it in port info */
 	ret = set_fm_port_handle(dpaa_intf, req_dist_set, fif);
 	if (ret) {
@@ -821,7 +820,7 @@ int dpaa_fm_config(struct rte_eth_dev *dev, uint64_t req_dist_set)
 	}
 
 	if (fif->num_profiles) {
-		for (i = 0; i < dpaa_intf->nb_rx_queues; i++)
+		for (i = 0; i < dev->data->nb_rx_queues; i++)
 			dpaa_intf->rx_queues[i].vsp_id =
 				fm_default_vsp_id(fif);
 
-- 
2.25.1


  parent reply	other threads:[~2024-09-30 10:32 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 10:52 [PATCH 00/17] NXP DPAA ETH driver enhancement and fixes Hemant Agrawal
2024-08-01 10:52 ` [PATCH 01/17] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-08-01 10:52 ` [PATCH 02/17] net/dpaa: fix typecasting ch ID to u32 Hemant Agrawal
2024-08-07 15:37   ` Ferruh Yigit
2024-08-01 10:52 ` [PATCH 03/17] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-08-07 15:38   ` Ferruh Yigit
2024-08-23  7:33     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 04/17] bus/dpaa: add port buffer manager stats Hemant Agrawal
2024-08-07 15:38   ` Ferruh Yigit
2024-08-23  7:33     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 05/17] net/dpaa: support Tx confirmation to enable PTP Hemant Agrawal
2024-08-07 15:38   ` Ferruh Yigit
2024-08-23  7:34     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 06/17] net/dpaa: add support to separate Tx conf queues Hemant Agrawal
2024-08-01 10:53 ` [PATCH 07/17] net/dpaa: share MAC FMC scheme and CC parse Hemant Agrawal
2024-08-07 15:39   ` Ferruh Yigit
2024-08-23  7:34     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 08/17] net/dpaa: support Rx/Tx timestamp read Hemant Agrawal
2024-08-01 10:53 ` [PATCH 09/17] net/dpaa: support IEEE 1588 PTP Hemant Agrawal
2024-08-07 15:39   ` Ferruh Yigit
2024-08-23  7:36     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 10/17] net/dpaa: implement detailed packet parsing Hemant Agrawal
2024-08-07 15:39   ` Ferruh Yigit
2024-08-23  7:34     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 11/17] net/dpaa: enhance DPAA frame display Hemant Agrawal
2024-08-07 15:39   ` Ferruh Yigit
2024-08-23  7:36     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 12/17] net/dpaa: support mempool debug Hemant Agrawal
2024-08-01 10:53 ` [PATCH 13/17] net/dpaa: add Tx rate limiting DPAA PMD API Hemant Agrawal
2024-08-07 15:40   ` Ferruh Yigit
2024-08-23  7:35     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 14/17] bus/dpaa: add OH port mode for dpaa eth Hemant Agrawal
2024-08-07 15:40   ` Ferruh Yigit
2024-08-23  7:35     ` Hemant Agrawal
2024-08-01 10:53 ` [PATCH 15/17] bus/dpaa: add ONIC port mode for the DPAA eth Hemant Agrawal
2024-08-01 10:53 ` [PATCH 16/17] net/dpaa: improve the dpaa port cleanup Hemant Agrawal
2024-08-01 10:53 ` [PATCH 17/17] net/dpaa: improve dpaa errata A010022 handling Hemant Agrawal
2024-08-07 15:41   ` Ferruh Yigit
2024-08-23  7:35     ` Hemant Agrawal
2024-08-07 15:42 ` [PATCH 00/17] NXP DPAA ETH driver enhancement and fixes Ferruh Yigit
2024-08-08  8:51   ` Hemant Agrawal
2024-08-23  7:32 ` [PATCH v2 00/18] " Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 01/18] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 02/18] net/dpaa: fix typecasting ch ID to u32 Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 03/18] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 04/18] bus/dpaa: fix the fman details status Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 05/18] bus/dpaa: add port buffer manager stats Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 06/18] net/dpaa: support Tx confirmation to enable PTP Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 07/18] net/dpaa: add support to separate Tx conf queues Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 08/18] net/dpaa: share MAC FMC scheme and CC parse Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 09/18] net/dpaa: support Rx/Tx timestamp read Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 10/18] net/dpaa: support IEEE 1588 PTP Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 11/18] net/dpaa: implement detailed packet parsing Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 12/18] net/dpaa: enhance DPAA frame display Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 13/18] net/dpaa: support mempool debug Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 14/18] net/dpaa: add Tx rate limiting DPAA PMD API Hemant Agrawal
2024-09-22  3:14     ` Ferruh Yigit
2024-09-22  4:40       ` Hemant Agrawal
2024-09-22 13:10         ` Ferruh Yigit
2024-09-22 13:27         ` Ferruh Yigit
2024-09-22 15:23           ` Ferruh Yigit
2024-08-23  7:32   ` [PATCH v2 15/18] bus/dpaa: add OH port mode for dpaa eth Hemant Agrawal
2024-09-22 15:24     ` Ferruh Yigit
2024-08-23  7:32   ` [PATCH v2 16/18] bus/dpaa: add ONIC port mode for the DPAA eth Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 17/18] net/dpaa: improve the dpaa port cleanup Hemant Agrawal
2024-08-23  7:32   ` [PATCH v2 18/18] net/dpaa: improve dpaa errata A010022 handling Hemant Agrawal
2024-09-22  3:12   ` [PATCH v2 00/18] NXP DPAA ETH driver enhancement and fixes Ferruh Yigit
2024-09-22  4:38     ` Hemant Agrawal
2024-09-30 10:29   ` [PATCH v3 " Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 01/18] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 02/18] net/dpaa: fix typecasting ch ID to u32 Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 03/18] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 04/18] bus/dpaa: fix the fman details status Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 05/18] bus/dpaa: add port buffer manager stats Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 06/18] net/dpaa: support Tx confirmation to enable PTP Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 07/18] net/dpaa: add support to separate Tx conf queues Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 08/18] net/dpaa: share MAC FMC scheme and CC parse Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 09/18] net/dpaa: support Rx/Tx timestamp read Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 10/18] net/dpaa: support IEEE 1588 PTP Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 11/18] net/dpaa: implement detailed packet parsing Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 12/18] net/dpaa: enhance DPAA frame display Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 13/18] net/dpaa: support mempool debug Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 14/18] bus/dpaa: add OH port mode for dpaa eth Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 15/18] bus/dpaa: add ONIC port mode for the DPAA eth Hemant Agrawal
2024-09-30 10:29     ` Hemant Agrawal [this message]
2024-09-30 10:29     ` [PATCH v3 17/18] net/dpaa: improve dpaa errata A010022 handling Hemant Agrawal
2024-09-30 10:29     ` [PATCH v3 18/18] net/dpaa: fix reallocate_mbuf handling Hemant Agrawal
2024-09-30 12:15   ` [PATCH v4 00/18] NXP DPAA ETH driver enhancement and fixes Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 01/18] bus/dpaa: fix PFDRs leaks due to FQRNIs Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 02/18] net/dpaa: fix typecasting ch ID to u32 Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 03/18] bus/dpaa: fix VSP for 1G fm1-mac9 and 10 Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 04/18] bus/dpaa: fix the fman details status Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 05/18] bus/dpaa: add port buffer manager stats Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 06/18] net/dpaa: support Tx confirmation to enable PTP Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 07/18] net/dpaa: add support to separate Tx conf queues Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 08/18] net/dpaa: share MAC FMC scheme and CC parse Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 09/18] net/dpaa: support Rx/Tx timestamp read Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 10/18] net/dpaa: support IEEE 1588 PTP Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 11/18] net/dpaa: implement detailed packet parsing Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 12/18] net/dpaa: enhance DPAA frame display Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 13/18] net/dpaa: support mempool debug Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 14/18] bus/dpaa: add OH port mode for dpaa eth Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 15/18] bus/dpaa: add ONIC port mode for the DPAA eth Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 16/18] net/dpaa: improve the dpaa port cleanup Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 17/18] net/dpaa: improve dpaa errata A010022 handling Hemant Agrawal
2024-09-30 12:15     ` [PATCH v4 18/18] net/dpaa: fix reallocate_mbuf handling Hemant Agrawal

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=20240930102946.3236998-17-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=g.singh@nxp.com \
    /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).