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 <daniel.verkamp@intel.com>
This commit is contained in:
Daniel Verkamp 2016-08-23 14:05:44 -07:00
parent bfe434fd88
commit fd1ba17c16

View File

@ -55,6 +55,7 @@
#include <rte_cycles.h> #include <rte_cycles.h>
#include <rte_malloc.h> #include <rte_malloc.h>
#include <rte_mempool.h> #include <rte_mempool.h>
#include <rte_version.h>
#ifdef SPDK_CONFIG_PCIACCESS #ifdef SPDK_CONFIG_PCIACCESS
#include <pciaccess.h> #include <pciaccess.h>
@ -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; *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[] = { 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)}, {RTE_PCI_DEVICE(0x8086, 0x0953)},
#endif
{ .vendor_id = 0, /* sentinel */ }, { .vendor_id = 0, /* sentinel */ },
}; };