[dpdk-dev] [PATCH v2 03/12] eal/pci: Rework loops in rte_pci_get_iommu_class
Ben Walker
benjamin.walker at intel.com
Thu May 30 23:29:50 CEST 2019
Make all of the loops first iterate over devices, then
drivers. This is in preparation for combining them
into a single loop.
Signed-off-by: Ben Walker <benjamin.walker at intel.com>
---
drivers/bus/pci/linux/pci.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index d3177916a..70815e4f0 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -589,10 +589,10 @@ rte_pci_get_iommu_class(void)
if (!is_bound)
return RTE_IOVA_DC;
- FOREACH_DRIVER_ON_PCIBUS(drv) {
- if (drv && drv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA) {
- FOREACH_DEVICE_ON_PCIBUS(dev) {
- if (dev->kdrv == RTE_KDRV_VFIO &&
+ FOREACH_DEVICE_ON_PCIBUS(dev) {
+ if (dev->kdrv == RTE_KDRV_VFIO) {
+ FOREACH_DRIVER_ON_PCIBUS(drv) {
+ if (drv->drv_flags & RTE_PCI_DRV_IOVA_AS_VA &&
rte_pci_match(drv, dev)) {
has_iova_va = true;
break;
@@ -631,8 +631,8 @@ rte_pci_get_iommu_class(void)
}
break_out = false;
- FOREACH_DRIVER_ON_PCIBUS(drv) {
- FOREACH_DEVICE_ON_PCIBUS(dev) {
+ FOREACH_DEVICE_ON_PCIBUS(dev) {
+ FOREACH_DRIVER_ON_PCIBUS(drv) {
if (!rte_pci_match(drv, dev))
continue;
/*
--
2.20.1
More information about the dev
mailing list