]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net/mlx5: Lag, Fix for loop when checking lag
authorChris Mi <cmi@nvidia.com>
Tue, 29 Nov 2022 09:30:06 +0000 (01:30 -0800)
committerJakub Kicinski <kuba@kernel.org>
Tue, 29 Nov 2022 16:19:59 +0000 (08:19 -0800)
The cited commit adds a for loop to check if each port supports lag
or not. But dev is not initialized correctly. Fix it by initializing
dev for each iteration.

Fixes: e87c6a832f88 ("net/mlx5: E-switch, Fix duplicate lag creation")
Signed-off-by: Chris Mi <cmi@nvidia.com>
Reported-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Link: https://lore.kernel.org/r/20221129093006.378840-2-saeed@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c

index 4070dc1d17cb8f41d2c85d192a7bf11b68f975fa..32c3e0a649a753fabc8508634a52323c158bfedb 100644 (file)
@@ -700,11 +700,13 @@ static bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
                        return false;
 
 #ifdef CONFIG_MLX5_ESWITCH
-       dev = ldev->pf[MLX5_LAG_P1].dev;
-       for (i = 0; i  < ldev->ports; i++)
+       for (i = 0; i < ldev->ports; i++) {
+               dev = ldev->pf[i].dev;
                if (mlx5_eswitch_num_vfs(dev->priv.eswitch) && !is_mdev_switchdev_mode(dev))
                        return false;
+       }
 
+       dev = ldev->pf[MLX5_LAG_P1].dev;
        mode = mlx5_eswitch_mode(dev);
        for (i = 0; i < ldev->ports; i++)
                if (mlx5_eswitch_mode(ldev->pf[i].dev) != mode)