Skip to content

Commit 8a54318

Browse files
lrw514Saeed Mahameed
authored andcommitted
net/mlx5: Use system_image_guid to determine bonding
With specific NICs, the PFs may have different PCIe ids like 0001:01:00.0/1 and 0002:02:00:00/1. For PFs with the same system_image_guid, driver should consider them under the same physical NIC and they are legal to bond together. If firmware doesn't support system_image_guid, set it to zero and fallback to use PCIe ids. Signed-off-by: Rongwei Liu <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 1021d06 commit 8a54318

File tree

1 file changed

+13
-1
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+13
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/dev.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <linux/mlx5/driver.h>
3434
#include <linux/mlx5/eswitch.h>
3535
#include <linux/mlx5/mlx5_ifc_vdpa.h>
36+
#include <linux/mlx5/vport.h>
3637
#include "mlx5_core.h"
3738

3839
/* intf dev list mutex */
@@ -537,6 +538,16 @@ int mlx5_rescan_drivers_locked(struct mlx5_core_dev *dev)
537538
return add_drivers(dev);
538539
}
539540

541+
static bool mlx5_same_hw_devs(struct mlx5_core_dev *dev, struct mlx5_core_dev *peer_dev)
542+
{
543+
u64 fsystem_guid, psystem_guid;
544+
545+
fsystem_guid = mlx5_query_nic_system_image_guid(dev);
546+
psystem_guid = mlx5_query_nic_system_image_guid(peer_dev);
547+
548+
return (fsystem_guid && psystem_guid && fsystem_guid == psystem_guid);
549+
}
550+
540551
static u32 mlx5_gen_pci_id(const struct mlx5_core_dev *dev)
541552
{
542553
return (u32)((pci_domain_nr(dev->pdev->bus) << 16) |
@@ -556,7 +567,8 @@ static int next_phys_dev(struct device *dev, const void *data)
556567
if (mdev == curr)
557568
return 0;
558569

559-
if (mlx5_gen_pci_id(mdev) != mlx5_gen_pci_id(curr))
570+
if (!mlx5_same_hw_devs(mdev, (struct mlx5_core_dev *)curr) &&
571+
mlx5_gen_pci_id(mdev) != mlx5_gen_pci_id(curr))
560572
return 0;
561573

562574
return 1;

0 commit comments

Comments
 (0)