* [dpdk-dev] [PATCH] net/bnx2x: enhance old ethdev close behavior
@ 2020-09-25 4:17 Rasesh Mody
2020-09-25 4:17 ` [dpdk-dev] [PATCH] net/qede: " Rasesh Mody
2020-09-25 7:11 ` [dpdk-dev] [PATCH] net/bnx2x: " Thomas Monjalon
0 siblings, 2 replies; 5+ messages in thread
From: Rasesh Mody @ 2020-09-25 4:17 UTC (permalink / raw)
To: thomas, ferruh.yigit; +Cc: dev, irusskikh, dsinghrawat, Rasesh Mody
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.
Signed-off-by: Rasesh Mody <rmody@marvell.com>
---
drivers/net/bnx2x/bnx2x_ethdev.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index b2ea5fafa..00d76b9f8 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -295,6 +295,9 @@ bnx2x_dev_close(struct rte_eth_dev *dev)
/* free ilt */
bnx2x_free_ilt_mem(sc);
+
+ /* mac_addrs must not be freed alone because part of dev_private */
+ dev->data->mac_addrs = NULL;
}
static int
@@ -726,6 +729,11 @@ bnx2x_common_dev_init(struct rte_eth_dev *eth_dev, int is_vf)
goto out;
}
+ /* Pass the information to the rte_eth_dev_close() that it should also
+ * release the private port resources.
+ */
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
return 0;
out:
@@ -753,8 +761,16 @@ eth_bnx2xvf_dev_init(struct rte_eth_dev *eth_dev)
static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev)
{
- /* mac_addrs must not be freed alone because part of dev_private */
- eth_dev->data->mac_addrs = NULL;
+ struct bnx2x_softc *sc = eth_dev->data->dev_private;
+
+ PMD_INIT_FUNC_TRACE(sc);
+
+ /* only uninitialize in the primary process */
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ bnx2x_dev_close(eth_dev);
+
return 0;
}
--
2.18.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH] net/qede: enhance old ethdev close behavior
2020-09-25 4:17 [dpdk-dev] [PATCH] net/bnx2x: enhance old ethdev close behavior Rasesh Mody
@ 2020-09-25 4:17 ` Rasesh Mody
2020-09-25 7:11 ` [dpdk-dev] [PATCH] net/bnx2x: " Thomas Monjalon
1 sibling, 0 replies; 5+ messages in thread
From: Rasesh Mody @ 2020-09-25 4:17 UTC (permalink / raw)
To: thomas, ferruh.yigit; +Cc: dev, irusskikh, dsinghrawat, Rasesh Mody
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.
Signed-off-by: Rasesh Mody <rmody@marvell.com>
---
drivers/net/qede/qede_ethdev.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index 59f1746ee..86a0ea26f 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -1586,6 +1586,10 @@ static void qede_dev_close(struct rte_eth_dev *eth_dev)
if (ECORE_IS_CMT(edev))
rte_eal_alarm_cancel(qede_poll_sp_sb_cb, (void *)eth_dev);
+
+ eth_dev->dev_ops = NULL;
+ eth_dev->rx_pkt_burst = NULL;
+ eth_dev->tx_pkt_burst = NULL;
}
static int
@@ -2701,6 +2705,11 @@ static int qede_common_dev_init(struct rte_eth_dev *eth_dev, bool is_vf)
adapter->ipgre.enable = false;
}
+ /* Pass the information to the rte_eth_dev_close() that it should also
+ * release the private port resources.
+ */
+ eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
DP_INFO(edev, "MAC address : %02x:%02x:%02x:%02x:%02x:%02x\n",
adapter->primary_mac.addr_bytes[0],
adapter->primary_mac.addr_bytes[1],
@@ -2745,10 +2754,6 @@ static int qede_dev_common_uninit(struct rte_eth_dev *eth_dev)
/* safe to close dev here */
qede_dev_close(eth_dev);
- eth_dev->dev_ops = NULL;
- eth_dev->rx_pkt_burst = NULL;
- eth_dev->tx_pkt_burst = NULL;
-
return 0;
}
--
2.18.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] net/bnx2x: enhance old ethdev close behavior
2020-09-25 4:17 [dpdk-dev] [PATCH] net/bnx2x: enhance old ethdev close behavior Rasesh Mody
2020-09-25 4:17 ` [dpdk-dev] [PATCH] net/qede: " Rasesh Mody
@ 2020-09-25 7:11 ` Thomas Monjalon
2020-09-25 19:24 ` [dpdk-dev] [EXT] " Rasesh Mody
1 sibling, 1 reply; 5+ messages in thread
From: Thomas Monjalon @ 2020-09-25 7:11 UTC (permalink / raw)
To: Rasesh Mody; +Cc: ferruh.yigit, dev, irusskikh, dsinghrawat
25/09/2020 06:17, Rasesh Mody:
> Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
> for the port can be freed by rte_eth_dev_close(). With this change the
> private port resources are released in the .dev_close callback.
>
> Signed-off-by: Rasesh Mody <rmody@marvell.com>
> ---
> static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev)
> {
> - /* mac_addrs must not be freed alone because part of dev_private */
> - eth_dev->data->mac_addrs = NULL;
> + struct bnx2x_softc *sc = eth_dev->data->dev_private;
> +
> + PMD_INIT_FUNC_TRACE(sc);
> +
> + /* only uninitialize in the primary process */
> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> + return 0;
> +
> + bnx2x_dev_close(eth_dev);
The check for primary process should be in the close function.
About the title, I would suggest net/bnx2x: release port upon close
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [EXT] Re: [PATCH] net/bnx2x: enhance old ethdev close behavior
2020-09-25 7:11 ` [dpdk-dev] [PATCH] net/bnx2x: " Thomas Monjalon
@ 2020-09-25 19:24 ` Rasesh Mody
2020-09-26 11:40 ` Thomas Monjalon
0 siblings, 1 reply; 5+ messages in thread
From: Rasesh Mody @ 2020-09-25 19:24 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: ferruh.yigit, dev, Igor Russkikh, Devendra Singh Rawat
Hi Thomas,
>From: Thomas Monjalon <thomas@monjalon.net>
>Sent: Friday, September 25, 2020 12:11 AM
>
>25/09/2020 06:17, Rasesh Mody:
>> Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
>> for the port can be freed by rte_eth_dev_close(). With this change the
>> private port resources are released in the .dev_close callback.
>>
>> Signed-off-by: Rasesh Mody <rmody@marvell.com>
>> ---
>> static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev) {
>> - /* mac_addrs must not be freed alone because part of dev_private */
>> - eth_dev->data->mac_addrs = NULL;
>> + struct bnx2x_softc *sc = eth_dev->data->dev_private;
>> +
>> + PMD_INIT_FUNC_TRACE(sc);
>> +
>> + /* only uninitialize in the primary process */
>> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
>> + return 0;
>> +
>> + bnx2x_dev_close(eth_dev);
>
>The check for primary process should be in the close function.
>
PMDs check for primary process as part of PCI probe, hence it was put in as part of PCI remove. I also observed other PMDs implementing a similar scheme.
If it needs to be part of close function, I can move it there.
>About the title, I would suggest net/bnx2x: release port upon close
>
I'll change the title and resubmit.
Thanks!
-Rasesh
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [EXT] Re: [PATCH] net/bnx2x: enhance old ethdev close behavior
2020-09-25 19:24 ` [dpdk-dev] [EXT] " Rasesh Mody
@ 2020-09-26 11:40 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2020-09-26 11:40 UTC (permalink / raw)
To: Rasesh Mody; +Cc: ferruh.yigit, dev, Igor Russkikh, Devendra Singh Rawat
25/09/2020 21:24, Rasesh Mody:
> Hi Thomas,
>
> >From: Thomas Monjalon <thomas@monjalon.net>
> >Sent: Friday, September 25, 2020 12:11 AM
> >
> >25/09/2020 06:17, Rasesh Mody:
> >> Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
> >> for the port can be freed by rte_eth_dev_close(). With this change the
> >> private port resources are released in the .dev_close callback.
> >>
> >> Signed-off-by: Rasesh Mody <rmody@marvell.com>
> >> ---
> >> static int eth_bnx2x_dev_uninit(struct rte_eth_dev *eth_dev) {
> >> - /* mac_addrs must not be freed alone because part of dev_private */
> >> - eth_dev->data->mac_addrs = NULL;
> >> + struct bnx2x_softc *sc = eth_dev->data->dev_private;
> >> +
> >> + PMD_INIT_FUNC_TRACE(sc);
> >> +
> >> + /* only uninitialize in the primary process */
> >> + if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> >> + return 0;
> >> +
> >> + bnx2x_dev_close(eth_dev);
> >
> >The check for primary process should be in the close function.
> >
> PMDs check for primary process as part of PCI probe, hence it was put in as part of PCI remove. I also observed other PMDs implementing a similar scheme.
Yes I am reviewing other PMDs to fix the same.
> If it needs to be part of close function, I can move it there.
Yes please.
> >About the title, I would suggest net/bnx2x: release port upon close
> >
> I'll change the title and resubmit.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-09-26 11:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 4:17 [dpdk-dev] [PATCH] net/bnx2x: enhance old ethdev close behavior Rasesh Mody
2020-09-25 4:17 ` [dpdk-dev] [PATCH] net/qede: " Rasesh Mody
2020-09-25 7:11 ` [dpdk-dev] [PATCH] net/bnx2x: " Thomas Monjalon
2020-09-25 19:24 ` [dpdk-dev] [EXT] " Rasesh Mody
2020-09-26 11:40 ` Thomas Monjalon
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).