env: Adjust for API changes to DPDK PCI in 16.11

Change-Id: Ie76d2d18f65f079f465afef4be5154fa53ab3783
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Ben Walker 2016-10-12 16:26:05 -07:00 committed by Daniel Verkamp
parent 0bd08c4536
commit b697d2809d

25
lib/env/pci.c vendored
View File

@ -165,23 +165,32 @@ spdk_pci_enumerate(enum spdk_pci_device_type type,
{
struct spdk_pci_enum_ctx ctx = {};
int rc;
ctx.enum_cb = enum_cb;
ctx.enum_ctx = enum_ctx;
ctx.driver.devinit = spdk_pci_device_init;
ctx.driver.devuninit = spdk_pci_device_fini;
ctx.driver.drv_flags = RTE_PCI_DRV_NEED_MAPPING;
const char *name;
if (type == SPDK_PCI_DEVICE_NVME) {
ctx.driver.name = "SPDK NVMe";
name = "SPDK NVMe";
ctx.driver.id_table = nvme_pci_driver_id;
} else if (type == SPDK_PCI_DEVICE_IOAT) {
name = "SPDK IOAT";
ctx.driver.id_table = ioat_driver_id;
ctx.driver.name = "SPDK IOAT";
} else {
return -1;
}
ctx.enum_cb = enum_cb;
ctx.enum_ctx = enum_ctx;
ctx.driver.drv_flags = RTE_PCI_DRV_NEED_MAPPING;
#if RTE_VERSION >= RTE_VERSION_NUM(16, 11, 0, 0)
ctx.driver.probe = spdk_pci_device_init;
ctx.driver.remove = spdk_pci_device_fini;
ctx.driver.driver.name = name;
#else
ctx.driver.devinit = spdk_pci_device_init;
ctx.driver.devuninit = spdk_pci_device_fini;
ctx.driver.name = name;
#endif
rte_eal_pci_register(&ctx.driver);
rc = rte_eal_pci_probe();
rte_eal_pci_unregister(&ctx.driver);