Some places were not using the function rte_pci_addr_cmp()
to compare 2 PCI addresses.

Signed-off-by: Thomas Monjalon <tho...@monjalon.net>
---
 drivers/net/mana/mana.c          | 6 ++----
 drivers/net/mlx4/mlx4.c          | 5 +----
 drivers/net/mlx5/linux/mlx5_os.c | 5 +----
 3 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c
index 41c3cf2595..781ed76139 100644
--- a/drivers/net/mana/mana.c
+++ b/drivers/net/mana/mana.c
@@ -13,6 +13,7 @@
 #include <ethdev_pci.h>
 #include <rte_kvargs.h>
 #include <rte_eal_paging.h>
+#include <rte_pci.h>
 
 #include <infiniband/verbs.h>
 #include <infiniband/manadv.h>
@@ -1464,10 +1465,7 @@ mana_pci_probe_mac(struct rte_pci_device *pci_dev,
                        continue;
 
                /* Ignore if this IB device is not this PCI device */
-               if (pci_dev->addr.domain != pci_addr.domain ||
-                   pci_dev->addr.bus != pci_addr.bus ||
-                   pci_dev->addr.devid != pci_addr.devid ||
-                   pci_dev->addr.function != pci_addr.function)
+               if (rte_pci_addr_cmp(&pci_dev->addr, &pci_addr) != 0)
                        continue;
 
                ctx = ibv_open_device(ibdev);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 1389b606cc..a1a7e93288 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -817,10 +817,7 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct 
rte_pci_device *pci_dev)
                DEBUG("checking device \"%s\"", list[i]->name);
                if (mlx4_ibv_device_to_pci_addr(list[i], &pci_addr))
                        continue;
-               if ((pci_dev->addr.domain != pci_addr.domain) ||
-                   (pci_dev->addr.bus != pci_addr.bus) ||
-                   (pci_dev->addr.devid != pci_addr.devid) ||
-                   (pci_dev->addr.function != pci_addr.function))
+               if (rte_pci_addr_cmp(&pci_dev->addr, &pci_addr) != 0)
                        continue;
                vf = (pci_dev->id.device_id ==
                      PCI_DEVICE_ID_MELLANOX_CONNECTX3VF);
diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c
index 0706e9e9b2..922490ff97 100644
--- a/drivers/net/mlx5/linux/mlx5_os.c
+++ b/drivers/net/mlx5/linux/mlx5_os.c
@@ -2065,10 +2065,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev,
                        if (mlx5_get_pci_addr(ibv_list[ret]->ibdev_path,
                                              &pci_addr))
                                continue;
-                       if (owner_pci.domain != pci_addr.domain ||
-                           owner_pci.bus != pci_addr.bus ||
-                           owner_pci.devid != pci_addr.devid ||
-                           owner_pci.function != pci_addr.function)
+                       if (rte_pci_addr_cmp(&owner_pci, &pci_addr) != 0)
                                continue;
                        DRV_LOG(INFO, "PCI information matches for device 
\"%s\"",
                                ibv_list[ret]->name);
-- 
2.42.0

Reply via email to