[dpdk-dev] [PATCH] ethdev: fix device state on close

Shahaf Shuler shahafs at mellanox.com
Wed Aug 16 13:43:08 CEST 2017


Currently device state moves between ATTACHED when device was
successfully probed to UNUSED when device is detached or released.

The device state following rte_eth_dev_close() operation is inconsist,
The device is still in ATTACHED state, however it cannot be used
in any way till it will be probed again.

Fixing it by changing the state to UNUSED.

Fixes: d52268a8b24b ("ethdev: expose device states")
Cc: gaetan.rivet at 6wind.com
Cc: stable at dpdk.org

Signed-off-by: Shahaf Shuler <shahafs at mellanox.com>
---
 lib/librte_ether/rte_ethdev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 0597641ee..98d9e929c 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -992,6 +992,8 @@ rte_eth_dev_close(uint8_t port_id)
 	dev->data->nb_tx_queues = 0;
 	rte_free(dev->data->tx_queues);
 	dev->data->tx_queues = NULL;
+
+	dev->state = RTE_ETH_DEV_UNUSED;
 }
 
 int
-- 
2.12.0



More information about the dev mailing list