aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Jurgens <danielj@mellanox.com>2018-08-27 10:09:46 -0400
committerSaeed Mahameed <saeedm@mellanox.com>2018-09-05 20:08:33 -0400
commitdf7ddb2396cd162e64aaff9401be05e31e438961 (patch)
treeccb449db61d0d45f9788d63847ab9cce6519135c
parent071304772fc747d5df13c51f1cf48a4b922a5e0d (diff)
net/mlx5: Consider PCI domain in search for next dev
The PCI BDF is not unique. PCI domain must also be considered when searching for the next physical device during lag setup. Example below: mlx5_core 0000:01:00.0: MLX5E: StrdRq(1) RqSz(8) StrdSz(128) RxCqeCmprss(0) mlx5_core 0000:01:00.1: MLX5E: StrdRq(1) RqSz(8) StrdSz(128) RxCqeCmprss(0) mlx5_core 0001:01:00.0: MLX5E: StrdRq(1) RqSz(8) StrdSz(128) RxCqeCmprss(0) mlx5_core 0001:01:00.1: MLX5E: StrdRq(1) RqSz(8) StrdSz(128) RxCqeCmprss(0) Signed-off-by: Daniel Jurgens <danielj@mellanox.com> Reviewed-by: Aviv Heller <avivh@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/dev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
index b994b80d5714..ada723bd91b6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
@@ -391,16 +391,17 @@ void mlx5_remove_dev_by_protocol(struct mlx5_core_dev *dev, int protocol)
391 } 391 }
392} 392}
393 393
394static u16 mlx5_gen_pci_id(struct mlx5_core_dev *dev) 394static u32 mlx5_gen_pci_id(struct mlx5_core_dev *dev)
395{ 395{
396 return (u16)((dev->pdev->bus->number << 8) | 396 return (u32)((pci_domain_nr(dev->pdev->bus) << 16) |
397 (dev->pdev->bus->number << 8) |
397 PCI_SLOT(dev->pdev->devfn)); 398 PCI_SLOT(dev->pdev->devfn));
398} 399}
399 400
400/* Must be called with intf_mutex held */ 401/* Must be called with intf_mutex held */
401struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev) 402struct mlx5_core_dev *mlx5_get_next_phys_dev(struct mlx5_core_dev *dev)
402{ 403{
403 u16 pci_id = mlx5_gen_pci_id(dev); 404 u32 pci_id = mlx5_gen_pci_id(dev);
404 struct mlx5_core_dev *res = NULL; 405 struct mlx5_core_dev *res = NULL;
405 struct mlx5_core_dev *tmp_dev; 406 struct mlx5_core_dev *tmp_dev;
406 struct mlx5_priv *priv; 407 struct mlx5_priv *priv;