nvme: optimization for nvme probe and detachment.

remove the unnecessary rte_eal_pci_probe_one() in function
spdk_pci_device_detach(), this could cause error message when we
terminate the application, it will also not make sense try to probe one
device after we detach it, we could call spdk_pci_nvme_device_attach()
instead of spdk_pci_nvme_enumerate() when we have one given device address,
dpdk will try to scan the device and add it back to pci device list then.

Change-Id: I35f5bb412249bb20da57394f0531c10a49691906
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
Cunyin Chang 2017-03-08 09:54:19 +08:00 committed by Jim Harris
parent f75fe7394a
commit b7349216b9
2 changed files with 5 additions and 6 deletions

View File

@ -87,11 +87,6 @@ spdk_pci_device_detach(struct spdk_pci_device *device)
rte_eal_device_remove(&device->device);
#endif
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

View File

@ -644,7 +644,11 @@ nvme_pcie_ctrlr_scan(const struct spdk_nvme_transport_id *trid,
_nvme_pcie_hotplug_monitor(cb_ctx, probe_cb, remove_cb);
}
return spdk_pci_nvme_enumerate(pcie_nvme_enum_cb, &enum_ctx);
if (enum_ctx.has_pci_addr == false) {
return spdk_pci_nvme_enumerate(pcie_nvme_enum_cb, &enum_ctx);
} else {
return spdk_pci_nvme_device_attach(pcie_nvme_enum_cb, &enum_ctx, &enum_ctx.pci_addr);
}
}
static int