Commit b1687cd4 authored by sunshihao520's avatar sunshihao520 Committed by Tomasz Zawadzki
Browse files

lib:env_dpdk fix the enum rte_kernel_driver definition deference between dpdk 19.11 and 20.11



In dpdk 19.11, rte_kernel_driver is the old version, add version check before use the members.
Signed-off-by: default avatarsunshihao <sunshihao@huawei.com>
Change-Id: Ic1db37cc0760c7d03692fd2cdcbb6ff1e41f872d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/6252


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent 0e73e10d
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -1238,7 +1238,11 @@ vtophys_iommu_device_event(const char *device_name,
		RTE_DEV_FOREACH(dev, "bus=pci", &dev_iter) {
			if (strcmp(dev->name, device_name) == 0) {
				struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);
#if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0)
				if (pci_dev->kdrv == RTE_KDRV_VFIO) {
#else
				if (pci_dev->kdrv == RTE_PCI_KDRV_VFIO) {
#endif
					/* This is a new PCI device using vfio */
					g_vfio.device_ref++;
				}
@@ -1267,7 +1271,11 @@ vtophys_iommu_device_event(const char *device_name,
		RTE_DEV_FOREACH(dev, "bus=pci", &dev_iter) {
			if (strcmp(dev->name, device_name) == 0) {
				struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);
#if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0)
				if (pci_dev->kdrv == RTE_KDRV_VFIO) {
#else
				if (pci_dev->kdrv == RTE_PCI_KDRV_VFIO) {
#endif
					/* This is a PCI device using vfio */
					g_vfio.device_ref--;
				}
@@ -1362,7 +1370,11 @@ vtophys_iommu_init(void)
	RTE_DEV_FOREACH(dev, "bus=pci", &dev_iter) {
		struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev);

#if RTE_VERSION < RTE_VERSION_NUM(20, 11, 0, 0)
		if (pci_dev->kdrv == RTE_KDRV_VFIO) {
#else
		if (pci_dev->kdrv == RTE_PCI_KDRV_VFIO) {
#endif
			/* This is a PCI device using vfio */
			g_vfio.device_ref++;
		}