Commit fd1ba17c authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

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: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent bfe434fd
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@
#include <rte_cycles.h>
#include <rte_malloc.h>
#include <rte_mempool.h>
#include <rte_version.h>

#ifdef SPDK_CONFIG_PCIACCESS
#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;
}

/*
 * 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 */ },
};