[dpdk-dev] [PATCH 08/12] eal/pci: Collapse loops in rte_pci_get_iommu_class
Ben Walker
benjamin.walker at intel.com
Thu May 30 19:48:15 CEST 2019
The three loops can now be easily combined into one.
This is slightly less efficient than before because it
doesn't break out early. But that can be addressed
later.
Signed-off-by: Ben Walker <benjamin.walker at intel.com>
Change-Id: Ic97155bb478dddbcbeaa6d51947684ffef219a52
---
drivers/bus/pci/linux/pci.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index f678d2318..11e2e4d1b 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -604,15 +604,7 @@ rte_pci_get_iommu_class(void)
if (dev->kdrv != RTE_KDRV_UNKNOWN &&
dev->kdrv != RTE_KDRV_NONE) {
is_bound = true;
- break;
}
- }
- if (!is_bound)
- return RTE_IOVA_DC;
-
- FOREACH_DEVICE_ON_PCIBUS(dev) {
- if (pci_ignore_device(dev))
- continue;
if (dev->kdrv == RTE_KDRV_VFIO) {
FOREACH_DRIVER_ON_PCIBUS(drv) {
@@ -630,15 +622,7 @@ rte_pci_get_iommu_class(void)
break;
}
}
-
- if (has_iova_va)
- break;
}
- }
-
- FOREACH_DEVICE_ON_PCIBUS(dev) {
- if (pci_ignore_device(dev))
- continue;
if (dev->kdrv == RTE_KDRV_IGB_UIO ||
dev->kdrv == RTE_KDRV_UIO_GENERIC) {
@@ -646,6 +630,9 @@ rte_pci_get_iommu_class(void)
}
}
+ if (!is_bound)
+ return RTE_IOVA_DC;
+
#ifdef VFIO_PRESENT
is_vfio_noiommu_enabled = rte_vfio_noiommu_is_enabled() == true ?
true : false;
--
2.20.1
More information about the dev
mailing list