* [dpdk-dev] [PATCH v1 0/4] Align device close operation with new behavior
@ 2020-09-28 8:57 Sachin Saxena (OSS)
2020-09-28 8:57 ` [dpdk-dev] [PATCH v1 1/4] net/dpaa: release port upon close Sachin Saxena (OSS)
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-28 8:57 UTC (permalink / raw)
To: dev, thomas, ferruh.yigit
From: Sachin Saxena <sachin.saxena@oss.nxp.com>
- patches are rebased on v2 series:
http://patches.dpdk.org/project/dpdk/list/?series=12533
Sachin Saxena (4):
net/dpaa: release port upon close
net/dpaa2: release port upon close
net/pfe: release port upon close
net/enetc: release port upon close
drivers/net/dpaa/dpaa_ethdev.c | 113 ++++++++++++++-----------------
drivers/net/dpaa2/dpaa2_ethdev.c | 90 ++++++++++--------------
drivers/net/enetc/enetc_ethdev.c | 10 +--
drivers/net/pfe/pfe_ethdev.c | 38 ++++-------
4 files changed, 105 insertions(+), 146 deletions(-)
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v1 1/4] net/dpaa: release port upon close
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)
2020-09-28 8:57 ` [dpdk-dev] [PATCH v1 2/4] net/dpaa2: " Sachin Saxena (OSS)
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-28 8:57 UTC (permalink / raw)
To: dev, thomas, ferruh.yigit
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v1 2/4] net/dpaa2: release port upon close
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 ` [dpdk-dev] [PATCH v1 1/4] net/dpaa: release port upon close Sachin Saxena (OSS)
@ 2020-09-28 8:57 ` 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)
3 siblings, 2 replies; 7+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-28 8:57 UTC (permalink / raw)
To: dev, thomas, ferruh.yigit
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/dpaa2/dpaa2_ethdev.c | 86 +++++++++++++-------------------
1 file changed, 35 insertions(+), 51 deletions(-)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index c81e75d53..3b87e8428 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -99,7 +99,6 @@ static const enum rte_filter_op dpaa2_supported_filter_ops[] = {
};
static struct rte_dpaa2_driver rte_dpaa2_pmd;
-static int dpaa2_dev_uninit(struct rte_eth_dev *eth_dev);
static int dpaa2_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
static int dpaa2_dev_set_link_up(struct rte_eth_dev *dev);
@@ -1241,7 +1240,7 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
{
struct dpaa2_dev_priv *priv = dev->data->dev_private;
struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private;
- int ret;
+ int i, ret;
struct rte_eth_link link;
PMD_INIT_FUNC_TRACE();
@@ -1249,8 +1248,12 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- dpaa2_flow_clean(dev);
+ if (!dpni) {
+ DPAA2_PMD_WARN("Already closed or not started");
+ return -1;
+ }
+ dpaa2_flow_clean(dev);
/* Clean the device first */
ret = dpni_reset(dpni, CMD_PRI_LOW, priv->token);
if (ret) {
@@ -1261,6 +1264,27 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
memset(&link, 0, sizeof(link));
rte_eth_linkstatus_set(dev, &link);
+ /* Free private queues memory */
+ dpaa2_free_rx_tx_queues(dev);
+ /* Close the device at underlying layer*/
+ ret = dpni_close(dpni, CMD_PRI_LOW, priv->token);
+ if (ret) {
+ DPAA2_PMD_ERR("Failure closing dpni device with err code %d",
+ ret);
+ }
+
+ /* Free the allocated memory for ethernet private data and dpni*/
+ priv->hw = NULL;
+ dev->process_private = NULL;
+ rte_free(dpni);
+
+ for (i = 0; i < MAX_TCS; i++)
+ rte_free((void *)(size_t)priv->extract.tc_extract_param[i]);
+
+ if (priv->extract.qos_extract_param)
+ rte_free((void *)(size_t)priv->extract.qos_extract_param);
+
+ DPAA2_PMD_INFO("%s: netdev deleted", dev->data->name);
return 0;
}
@@ -2712,52 +2736,12 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
RTE_LOG(INFO, PMD, "%s: netdev created\n", eth_dev->data->name);
return 0;
init_err:
- dpaa2_dev_uninit(eth_dev);
- return ret;
-}
-
-static int
-dpaa2_dev_uninit(struct rte_eth_dev *eth_dev)
-{
- struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
- struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_dev->process_private;
- int i, ret;
-
- PMD_INIT_FUNC_TRACE();
-
- if (rte_eal_process_type() != RTE_PROC_PRIMARY)
- return 0;
-
- if (!dpni) {
- DPAA2_PMD_WARN("Already closed or not started");
- return -1;
- }
-
+ /* With new implementation of .close, port private data
+ * will also be release by close callback.
+ */
dpaa2_dev_close(eth_dev);
- dpaa2_free_rx_tx_queues(eth_dev);
-
- /* Close the device at underlying layer*/
- ret = dpni_close(dpni, CMD_PRI_LOW, priv->token);
- if (ret) {
- DPAA2_PMD_ERR(
- "Failure closing dpni device with err code %d",
- ret);
- }
-
- /* Free the allocated memory for ethernet private data and dpni*/
- priv->hw = NULL;
- eth_dev->process_private = NULL;
- rte_free(dpni);
-
- for (i = 0; i < MAX_TCS; i++)
- rte_free((void *)(size_t)priv->extract.tc_extract_param[i]);
-
- if (priv->extract.qos_extract_param)
- rte_free((void *)(size_t)priv->extract.qos_extract_param);
-
- DPAA2_PMD_INFO("%s: netdev deleted", eth_dev->data->name);
- return 0;
+ return ret;
}
static int
@@ -2826,13 +2810,13 @@ static int
rte_dpaa2_remove(struct rte_dpaa2_device *dpaa2_dev)
{
struct rte_eth_dev *eth_dev;
+ int ret;
eth_dev = dpaa2_dev->eth_dev;
- dpaa2_dev_uninit(eth_dev);
-
- rte_eth_dev_release_port(eth_dev);
+ dpaa2_dev_close(eth_dev);
+ ret = rte_eth_dev_release_port(eth_dev);
- return 0;
+ return ret;
}
static struct rte_dpaa2_driver rte_dpaa2_pmd = {
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v1 3/4] net/pfe: release port upon close
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 ` [dpdk-dev] [PATCH v1 1/4] net/dpaa: release port upon close Sachin Saxena (OSS)
2020-09-28 8:57 ` [dpdk-dev] [PATCH v1 2/4] net/dpaa2: " Sachin Saxena (OSS)
@ 2020-09-28 8:57 ` Sachin Saxena (OSS)
2020-09-28 8:57 ` [dpdk-dev] [PATCH v1 4/4] net/enetc: " Sachin Saxena (OSS)
3 siblings, 0 replies; 7+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-28 8:57 UTC (permalink / raw)
To: dev, thomas, ferruh.yigit
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/pfe/pfe_ethdev.c | 38 +++++++++++++-----------------------
1 file changed, 14 insertions(+), 24 deletions(-)
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index a7e9d97ba..f0de1c8a2 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -385,22 +385,11 @@ pfe_eth_stop(struct rte_eth_dev *dev/*, int wake*/)
dev->tx_pkt_burst = &pfe_dummy_xmit_pkts;
}
-static void
-pfe_eth_exit(struct rte_eth_dev *dev, struct pfe *pfe)
-{
- PMD_INIT_FUNC_TRACE();
-
- pfe_eth_stop(dev);
- /* Close the device file for link status */
- pfe_eth_close_cdev(dev->data->dev_private);
-
- rte_eth_dev_release_port(dev);
- pfe->nb_devs--;
-}
-
static int
pfe_eth_close(struct rte_eth_dev *dev)
{
+ PMD_INIT_FUNC_TRACE();
+
if (!dev)
return -1;
@@ -410,7 +399,12 @@ pfe_eth_close(struct rte_eth_dev *dev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- pfe_eth_exit(dev, g_pfe);
+ pfe_eth_stop(dev);
+ /* Close the device file for link status */
+ pfe_eth_close_cdev(dev->data->dev_private);
+
+ munmap(g_pfe->cbus_baseaddr, g_pfe->cbus_size);
+ g_pfe->nb_devs--;
if (g_pfe->nb_devs == 0) {
pfe_hif_exit(g_pfe);
@@ -1147,6 +1141,7 @@ pmd_pfe_remove(struct rte_vdev_device *vdev)
{
const char *name;
struct rte_eth_dev *eth_dev = NULL;
+ int ret = 0;
name = rte_vdev_device_name(vdev);
if (name == NULL)
@@ -1158,17 +1153,12 @@ pmd_pfe_remove(struct rte_vdev_device *vdev)
return 0;
eth_dev = rte_eth_dev_allocated(name);
- if (eth_dev != NULL)
- pfe_eth_exit(eth_dev, g_pfe);
- munmap(g_pfe->cbus_baseaddr, g_pfe->cbus_size);
-
- if (g_pfe->nb_devs == 0) {
- pfe_hif_exit(g_pfe);
- pfe_hif_lib_exit(g_pfe);
- rte_free(g_pfe);
- g_pfe = NULL;
+ if (eth_dev) {
+ pfe_eth_close(eth_dev);
+ ret = rte_eth_dev_release_port(eth_dev);
}
- return 0;
+
+ return ret;
}
static
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v1 4/4] net/enetc: release port upon close
2020-09-28 8:57 [dpdk-dev] [PATCH v1 0/4] Align device close operation with new behavior Sachin Saxena (OSS)
` (2 preceding siblings ...)
2020-09-28 8:57 ` [dpdk-dev] [PATCH v1 3/4] net/pfe: " Sachin Saxena (OSS)
@ 2020-09-28 8:57 ` Sachin Saxena (OSS)
3 siblings, 0 replies; 7+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-28 8:57 UTC (permalink / raw)
To: dev, thomas, ferruh.yigit
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/enetc/enetc_ethdev.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index d42add3ef..b3dec7e64 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -568,6 +568,9 @@ enetc_dev_close(struct rte_eth_dev *dev)
}
dev->data->nb_tx_queues = 0;
+ if (rte_eal_iova_mode() == RTE_IOVA_PA)
+ dpaax_iova_table_depopulate();
+
return 0;
}
@@ -919,14 +922,11 @@ enetc_dev_init(struct rte_eth_dev *eth_dev)
}
static int
-enetc_dev_uninit(struct rte_eth_dev *eth_dev __rte_unused)
+enetc_dev_uninit(struct rte_eth_dev *eth_dev)
{
PMD_INIT_FUNC_TRACE();
- if (rte_eal_iova_mode() == RTE_IOVA_PA)
- dpaax_iova_table_depopulate();
-
- return 0;
+ return enetc_dev_close(eth_dev);
}
static int
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [PATCH v1 2/4] net/dpaa2: release port upon close
2020-09-28 8:57 ` [dpdk-dev] [PATCH v1 2/4] net/dpaa2: " Sachin Saxena (OSS)
@ 2020-09-28 9:06 ` Thomas Monjalon
2020-09-28 10:54 ` [dpdk-dev] [PATCH v2] " Sachin Saxena (OSS)
1 sibling, 0 replies; 7+ messages in thread
From: Thomas Monjalon @ 2020-09-28 9:06 UTC (permalink / raw)
To: Sachin Saxena (OSS); +Cc: dev, ferruh.yigit
28/09/2020 10:57, Sachin Saxena (OSS):
> + /* With new implementation of .close, port private data
> + * will also be release by close callback.
> + */
> dpaa2_dev_close(eth_dev);
I think this comment is weird.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [dpdk-dev] [PATCH v2] net/dpaa2: release port upon close
2020-09-28 8:57 ` [dpdk-dev] [PATCH v1 2/4] net/dpaa2: " Sachin Saxena (OSS)
2020-09-28 9:06 ` Thomas Monjalon
@ 2020-09-28 10:54 ` Sachin Saxena (OSS)
1 sibling, 0 replies; 7+ messages in thread
From: Sachin Saxena (OSS) @ 2020-09-28 10:54 UTC (permalink / raw)
To: dev, thomas, ferruh.yigit
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/dpaa2/dpaa2_ethdev.c | 83 ++++++++++++--------------------
1 file changed, 32 insertions(+), 51 deletions(-)
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index c81e75d53..ba99a524f 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -99,7 +99,6 @@ static const enum rte_filter_op dpaa2_supported_filter_ops[] = {
};
static struct rte_dpaa2_driver rte_dpaa2_pmd;
-static int dpaa2_dev_uninit(struct rte_eth_dev *eth_dev);
static int dpaa2_dev_link_update(struct rte_eth_dev *dev,
int wait_to_complete);
static int dpaa2_dev_set_link_up(struct rte_eth_dev *dev);
@@ -1241,7 +1240,7 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
{
struct dpaa2_dev_priv *priv = dev->data->dev_private;
struct fsl_mc_io *dpni = (struct fsl_mc_io *)dev->process_private;
- int ret;
+ int i, ret;
struct rte_eth_link link;
PMD_INIT_FUNC_TRACE();
@@ -1249,8 +1248,12 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
- dpaa2_flow_clean(dev);
+ if (!dpni) {
+ DPAA2_PMD_WARN("Already closed or not started");
+ return -1;
+ }
+ dpaa2_flow_clean(dev);
/* Clean the device first */
ret = dpni_reset(dpni, CMD_PRI_LOW, priv->token);
if (ret) {
@@ -1261,6 +1264,27 @@ dpaa2_dev_close(struct rte_eth_dev *dev)
memset(&link, 0, sizeof(link));
rte_eth_linkstatus_set(dev, &link);
+ /* Free private queues memory */
+ dpaa2_free_rx_tx_queues(dev);
+ /* Close the device at underlying layer*/
+ ret = dpni_close(dpni, CMD_PRI_LOW, priv->token);
+ if (ret) {
+ DPAA2_PMD_ERR("Failure closing dpni device with err code %d",
+ ret);
+ }
+
+ /* Free the allocated memory for ethernet private data and dpni*/
+ priv->hw = NULL;
+ dev->process_private = NULL;
+ rte_free(dpni);
+
+ for (i = 0; i < MAX_TCS; i++)
+ rte_free((void *)(size_t)priv->extract.tc_extract_param[i]);
+
+ if (priv->extract.qos_extract_param)
+ rte_free((void *)(size_t)priv->extract.qos_extract_param);
+
+ DPAA2_PMD_INFO("%s: netdev deleted", dev->data->name);
return 0;
}
@@ -2712,52 +2736,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
RTE_LOG(INFO, PMD, "%s: netdev created\n", eth_dev->data->name);
return 0;
init_err:
- dpaa2_dev_uninit(eth_dev);
- return ret;
-}
-
-static int
-dpaa2_dev_uninit(struct rte_eth_dev *eth_dev)
-{
- struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
- struct fsl_mc_io *dpni = (struct fsl_mc_io *)eth_dev->process_private;
- int i, ret;
-
- PMD_INIT_FUNC_TRACE();
-
- if (rte_eal_process_type() != RTE_PROC_PRIMARY)
- return 0;
-
- if (!dpni) {
- DPAA2_PMD_WARN("Already closed or not started");
- return -1;
- }
-
dpaa2_dev_close(eth_dev);
- dpaa2_free_rx_tx_queues(eth_dev);
-
- /* Close the device at underlying layer*/
- ret = dpni_close(dpni, CMD_PRI_LOW, priv->token);
- if (ret) {
- DPAA2_PMD_ERR(
- "Failure closing dpni device with err code %d",
- ret);
- }
-
- /* Free the allocated memory for ethernet private data and dpni*/
- priv->hw = NULL;
- eth_dev->process_private = NULL;
- rte_free(dpni);
-
- for (i = 0; i < MAX_TCS; i++)
- rte_free((void *)(size_t)priv->extract.tc_extract_param[i]);
-
- if (priv->extract.qos_extract_param)
- rte_free((void *)(size_t)priv->extract.qos_extract_param);
-
- DPAA2_PMD_INFO("%s: netdev deleted", eth_dev->data->name);
- return 0;
+ return ret;
}
static int
@@ -2826,13 +2807,13 @@ static int
rte_dpaa2_remove(struct rte_dpaa2_device *dpaa2_dev)
{
struct rte_eth_dev *eth_dev;
+ int ret;
eth_dev = dpaa2_dev->eth_dev;
- dpaa2_dev_uninit(eth_dev);
-
- rte_eth_dev_release_port(eth_dev);
+ dpaa2_dev_close(eth_dev);
+ ret = rte_eth_dev_release_port(eth_dev);
- return 0;
+ return ret;
}
static struct rte_dpaa2_driver rte_dpaa2_pmd = {
--
2.28.0
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-09-28 10:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [dpdk-dev] [PATCH v1 1/4] net/dpaa: release port upon close Sachin Saxena (OSS)
2020-09-28 8:57 ` [dpdk-dev] [PATCH v1 2/4] net/dpaa2: " 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)
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).