DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Sachin Saxena (OSS)" <sachin.saxena@oss.nxp.com>
To: dev@dpdk.org, thomas@monjalon.net, ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH v1 1/4] net/dpaa: release port upon close
Date: Mon, 28 Sep 2020 14:27:10 +0530	[thread overview]
Message-ID: <20200928085713.13560-2-sachin.saxena@oss.nxp.com> (raw)
In-Reply-To: <20200928085713.13560-1-sachin.saxena@oss.nxp.com>

From: Sachin Saxena <sachin.saxena@oss.nxp.com>

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
---
 drivers/net/dpaa/dpaa_ethdev.c | 113 ++++++++++++++-------------------
 1 file changed, 49 insertions(+), 64 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index c029dd4f3..7e6a954d7 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -376,12 +376,25 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 	struct rte_device *rdev = dev->device;
 	struct rte_dpaa_device *dpaa_dev;
 	struct rte_intr_handle *intr_handle;
+	struct dpaa_if *dpaa_intf = dev->data->dev_private;
+	int loop;
 
 	PMD_INIT_FUNC_TRACE();
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
+	if (!dpaa_intf) {
+		DPAA_PMD_WARN("Already closed or not started");
+		return -1;
+	}
+
+	/* DPAA FM deconfig */
+	if (!(default_q || fmc_q)) {
+		if (dpaa_fm_deconfig(dpaa_intf, dev->process_private))
+			DPAA_PMD_WARN("DPAA FM deconfig failed\n");
+	}
+
 	dpaa_dev = container_of(rdev, struct rte_dpaa_device, device);
 	intr_handle = &dpaa_dev->intr_handle;
 	__fif = container_of(fif, struct __fman_if, __if);
@@ -396,6 +409,38 @@ static int dpaa_eth_dev_close(struct rte_eth_dev *dev)
 					     (void *)dev);
 	}
 
+	/* release configuration memory */
+	if (dpaa_intf->fc_conf)
+		rte_free(dpaa_intf->fc_conf);
+
+	/* Release RX congestion Groups */
+	if (dpaa_intf->cgr_rx) {
+		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++)
+			qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
+
+		qman_release_cgrid_range(dpaa_intf->cgr_rx[loop].cgrid,
+					 dpaa_intf->nb_rx_queues);
+	}
+
+	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++)
+			qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
+
+		qman_release_cgrid_range(dpaa_intf->cgr_tx[loop].cgrid,
+					 MAX_DPAA_CORES);
+		rte_free(dpaa_intf->cgr_tx);
+		dpaa_intf->cgr_tx = NULL;
+	}
+
+	rte_free(dpaa_intf->rx_queues);
+	dpaa_intf->rx_queues = NULL;
+
+	rte_free(dpaa_intf->tx_queues);
+	dpaa_intf->tx_queues = NULL;
+
 	return 0;
 }
 
@@ -1980,66 +2025,6 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 	return ret;
 }
 
-static int
-dpaa_dev_uninit(struct rte_eth_dev *dev)
-{
-	struct dpaa_if *dpaa_intf = dev->data->dev_private;
-	int loop;
-
-	PMD_INIT_FUNC_TRACE();
-
-	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
-		return -EPERM;
-
-	if (!dpaa_intf) {
-		DPAA_PMD_WARN("Already closed or not started");
-		return -1;
-	}
-
-	/* DPAA FM deconfig */
-	if (!(default_q || fmc_q)) {
-		if (dpaa_fm_deconfig(dpaa_intf, dev->process_private))
-			DPAA_PMD_WARN("DPAA FM deconfig failed\n");
-	}
-
-	dpaa_eth_dev_close(dev);
-
-	/* release configuration memory */
-	if (dpaa_intf->fc_conf)
-		rte_free(dpaa_intf->fc_conf);
-
-	/* Release RX congestion Groups */
-	if (dpaa_intf->cgr_rx) {
-		for (loop = 0; loop < dpaa_intf->nb_rx_queues; loop++)
-			qman_delete_cgr(&dpaa_intf->cgr_rx[loop]);
-
-		qman_release_cgrid_range(dpaa_intf->cgr_rx[loop].cgrid,
-					 dpaa_intf->nb_rx_queues);
-	}
-
-	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++)
-			qman_delete_cgr(&dpaa_intf->cgr_tx[loop]);
-
-		qman_release_cgrid_range(dpaa_intf->cgr_tx[loop].cgrid,
-					 MAX_DPAA_CORES);
-		rte_free(dpaa_intf->cgr_tx);
-		dpaa_intf->cgr_tx = NULL;
-	}
-
-	rte_free(dpaa_intf->rx_queues);
-	dpaa_intf->rx_queues = NULL;
-
-	rte_free(dpaa_intf->tx_queues);
-	dpaa_intf->tx_queues = NULL;
-
-	return 0;
-}
-
 static int
 rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv,
 	       struct rte_dpaa_device *dpaa_dev)
@@ -2156,15 +2141,15 @@ static int
 rte_dpaa_remove(struct rte_dpaa_device *dpaa_dev)
 {
 	struct rte_eth_dev *eth_dev;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
 	eth_dev = dpaa_dev->eth_dev;
-	dpaa_dev_uninit(eth_dev);
-
-	rte_eth_dev_release_port(eth_dev);
+	dpaa_eth_dev_close(eth_dev);
+	ret = rte_eth_dev_release_port(eth_dev);
 
-	return 0;
+	return ret;
 }
 
 static void __attribute__((destructor(102))) dpaa_finish(void)
-- 
2.28.0


  reply	other threads:[~2020-09-28  8:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28  8:57 [dpdk-dev] [PATCH v1 0/4] Align device close operation with new behavior Sachin Saxena (OSS)
2020-09-28  8:57 ` Sachin Saxena (OSS) [this message]
2020-09-28  8:57 ` [dpdk-dev] [PATCH v1 2/4] net/dpaa2: release port upon close Sachin Saxena (OSS)
2020-09-28  9:06   ` Thomas Monjalon
2020-09-28 10:54   ` [dpdk-dev] [PATCH v2] " Sachin Saxena (OSS)
2020-09-28  8:57 ` [dpdk-dev] [PATCH v1 3/4] net/pfe: " Sachin Saxena (OSS)
2020-09-28  8:57 ` [dpdk-dev] [PATCH v1 4/4] net/enetc: " Sachin Saxena (OSS)

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=20200928085713.13560-2-sachin.saxena@oss.nxp.com \
    --to=sachin.saxena@oss.nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=thomas@monjalon.net \
    /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).