patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] ethdev: fix dev close in secondary process
@ 2022-05-27  2:35 Min Hu (Connor)
  2022-05-31 17:08 ` Andrew Rybchenko
  0 siblings, 1 reply; 4+ messages in thread
From: Min Hu (Connor) @ 2022-05-27  2:35 UTC (permalink / raw)
  To: dev
  Cc: Min Hu, stable, Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko,
	Anatoly Burakov, Ajit Khaparde

From: Min Hu <humin29@huawei.com>

Shared memory like port private resources should only be reserved
by primary process. Secondary process should not start dev, and
the state of 'dev_started' is only meaningful to primary process.
While secondary process need to close dev to release process private
resources.

This patch limited the scope of 'dev_started'.

Fixes: febc855b358e ("ethdev: forbid closing started device")
Cc: stable@dpdk.org

Signed-off-by: Min Hu <humin29@huawei.com>
---
 lib/ethdev/rte_ethdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 09abee6345..f34c6580a4 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -1574,7 +1574,8 @@ rte_eth_dev_close(uint16_t port_id)
 	RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV);
 	dev = &rte_eth_devices[port_id];
 
-	if (dev->data->dev_started) {
+	if (rte_eal_process_type() == RTE_PROC_PRIMARY &&
+			dev->data->dev_started) {
 		RTE_ETHDEV_LOG(ERR, "Cannot close started device (port %u)\n",
 			       port_id);
 		return -EINVAL;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-01  1:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-27  2:35 [PATCH] ethdev: fix dev close in secondary process Min Hu (Connor)
2022-05-31 17:08 ` Andrew Rybchenko
2022-05-31 17:40   ` Stephen Hemminger
2022-06-01  1:33     ` Min Hu (Connor)

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).