[dpdk-dev] [PATCH 1/3] ethdev: avoid error on PCI unplug of already closed ethdev

Andrew Rybchenko arybchenko at solarflare.com
Fri Jun 21 11:40:39 CEST 2019

If PCI Ethernet device driver removes it on close
(RTE_ETH_DEV_CLOSE_REMOVE) and later PCI device itself is unplugged,
it should not fail because of Ethernet device is already removed.

Fixes: 23ea57a2a0ce ("ethdev: complete closing of port")
Cc: stable at dpdk.org

Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
Reviewed-by: Ivan Malov <ivan.malov at oktetlabs.ru>
Cc: Thomas Monjalon <thomas at monjalon.net>
Cc: Ferruh Yigit <ferruh.yigit at intel.com>

 lib/librte_ethdev/rte_ethdev_pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_ethdev/rte_ethdev_pci.h b/lib/librte_ethdev/rte_ethdev_pci.h
index 23257e986..ccdbb46ec 100644
--- a/lib/librte_ethdev/rte_ethdev_pci.h
+++ b/lib/librte_ethdev/rte_ethdev_pci.h
@@ -184,7 +184,7 @@ rte_eth_dev_pci_generic_remove(struct rte_pci_device *pci_dev,
 	eth_dev = rte_eth_dev_allocated(pci_dev->device.name);
 	if (!eth_dev)
-		return -ENODEV;
+		return 0;
 	if (dev_uninit) {
 		ret = dev_uninit(eth_dev);

More information about the dev mailing list