From fd1ba17c16c6ef697a1e7494c0cfd692347011ac Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Tue, 23 Aug 2016 14:05:44 -0700 Subject: [PATCH] nvme: match devices by class code with DPDK PCI DPDK 16.07 introduced a new PCI ID field for matching by class code instead of vendor/device ID. Use it to match all NVMe devices instead of explicitly listing vendor and device ID pairs. Change-Id: Ib2a5cc6833bf2b793d37d77caab97207f365df8f Signed-off-by: Daniel Verkamp --- lib/nvme/nvme_impl.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/nvme/nvme_impl.h b/lib/nvme/nvme_impl.h index 0ccaf2284..f35ae68f0 100644 --- a/lib/nvme/nvme_impl.h +++ b/lib/nvme/nvme_impl.h @@ -55,6 +55,7 @@ #include #include #include +#include #ifdef SPDK_CONFIG_PCIACCESS #include @@ -239,11 +240,18 @@ nvme_pcicfg_get_bar_addr_len(void *devhandle, uint32_t bar, uint64_t *addr, uint *size = (uint64_t)dev->mem_resource[bar].len; } -/* - * TODO: once DPDK supports matching class code instead of device ID, switch to SPDK_PCI_CLASS_NVME - */ static struct rte_pci_id nvme_pci_driver_id[] = { +#if RTE_VERSION >= RTE_VERSION_NUM(16, 7, 0, 1) + { + .class_id = SPDK_PCI_CLASS_NVME, + .vendor_id = PCI_ANY_ID, + .device_id = PCI_ANY_ID, + .subsystem_vendor_id = PCI_ANY_ID, + .subsystem_device_id = PCI_ANY_ID, + }, +#else {RTE_PCI_DEVICE(0x8086, 0x0953)}, +#endif { .vendor_id = 0, /* sentinel */ }, };