[dpdk-stable] [ PATCH 17.11 1/2] ethdev: clear ethdev data upon detach

Reshma Pattan reshma.pattan at intel.com
Fri Mar 1 12:53:22 CET 2019


When port is detached its relevant rte_eth_dev_data[port_id]
has to be zeroed, otherwise the next port creations
could get wrong port_id.

Fixes: 92d94d3744 ("ethdev: attach or detach port")
Signed-off-by: Reshma Pattan <reshma.pattan at intel.com>
---
 lib/librte_ether/rte_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 096b35faf..7ba9bc564 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -443,6 +443,7 @@ rte_eth_dev_detach(uint16_t port_id, char *name)
 		goto err;
 
 	rte_eth_devices[port_id].state = RTE_ETH_DEV_UNUSED;
+	memset(&rte_eth_dev_data[port_id], 0, sizeof(struct rte_eth_dev_data));
 	return 0;
 
 err:
-- 
2.17.1



More information about the stable mailing list