]> git.droids-corp.org - dpdk.git/commitdiff
vdpa/mlx5: fix PCI address comparison
authorMatan Azrad <matan@mellanox.com>
Mon, 4 May 2020 07:12:09 +0000 (07:12 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 5 May 2020 13:54:26 +0000 (15:54 +0200)
A regular memcmp function was used to compare between two objects of
type `struct rte_pci_addr`.

Due to the alignment rules of compiler structure builders, some memory
is not initiated in the structure even though all the fields were
initiated.

Therefore, the comparison may fail even though the PCI addresses are
identical and to cause false failure in probe.

Use the dedicated API to compare 2 PCI addresses.

Fixes: 75dd0ae91765 ("vdpa/mlx5: disable RoCE")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Tested-by: Noa Ezra <noae@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
drivers/vdpa/mlx5/mlx5_vdpa.c

index 9f7353d3b049d04e5d5dc9ea0b31193944ead5db..1113d6cef027f6e3885ee76f721f3cdbd886ce86 100644 (file)
@@ -305,7 +305,7 @@ mlx5_vdpa_get_ib_device_match(struct rte_pci_addr *addr)
                DRV_LOG(DEBUG, "Checking device \"%s\"..", ibv_list[n]->name);
                if (mlx5_dev_to_pci_addr(ibv_list[n]->ibdev_path, &pci_addr))
                        continue;
-               if (memcmp(addr, &pci_addr, sizeof(pci_addr)))
+               if (rte_pci_addr_cmp(addr, &pci_addr))
                        continue;
                ibv_match = ibv_list[n];
                break;