From 5502004d67e6d6fe9db557261683f3d5916afc26 Mon Sep 17 00:00:00 2001 From: Ben Walker Date: Wed, 8 Feb 2017 21:36:18 -0700 Subject: [PATCH] nvme: After detach, force the device back into DPDK's internal list Change-Id: I0d745034d8319bc864d91e891b7c9bd0f7c25b6d Signed-off-by: Ben Walker --- lib/env_dpdk/pci.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/env_dpdk/pci.c b/lib/env_dpdk/pci.c index 0be2ac559..7b32938f1 100644 --- a/lib/env_dpdk/pci.c +++ b/lib/env_dpdk/pci.c @@ -76,10 +76,22 @@ spdk_pci_device_fini(struct rte_pci_device *device) void spdk_pci_device_detach(struct spdk_pci_device *device) { + struct rte_pci_addr addr; + + addr.domain = device->addr.domain; + addr.bus = device->addr.bus; + addr.devid = device->addr.devid; + addr.function = device->addr.function; + #if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0) rte_eal_device_remove(&device->device); #endif - rte_eal_pci_detach(&device->addr); + rte_eal_pci_detach(&addr); + /* This will not actually load any drivers because our + * callback isn't set, but it will re-add the device + * to DPDK's internal list. + */ + rte_eal_pci_probe_one(&addr); } int