diff mbox series

[08/12] eal/pci: Collapse loops in rte_pci_get_iommu_class

Message ID 20190530174819.1160221-9-benjamin.walker@intel.com (mailing list archive)
State Superseded, archived
Headers show
Series [01/12] eal: Make rte_eal_using_phys_addrs work sooner | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Ben Walker May 30, 2019, 5:48 p.m. UTC
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@intel.com>
Change-Id: Ic97155bb478dddbcbeaa6d51947684ffef219a52
---
 drivers/bus/pci/linux/pci.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
diff mbox series

Patch

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;