]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5e: Lag, Only handle events from highest priority multipath entry
authorRoi Dayan <roid@nvidia.com>
Wed, 16 Feb 2022 11:56:57 +0000 (13:56 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 9 Mar 2022 19:39:35 +0000 (11:39 -0800)
There could be multiple multipath entries but changing the port affinity
for each one doesn't make much sense and there should be a default one.
So only track the entry with lowest priority value.
The commit doesn't affect existing users with a single entry.

Fixes: 228d27b4425e ("net/mlx5e: Activate HW multipath and handle port affinity based on FIB events")
Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c

index 1ca01a5b6cdd803ed206685be19ddbcd12bcfe52..626aa60b6099b61641de67421611aeab348d3817 100644 (file)
@@ -126,6 +126,10 @@ static void mlx5_lag_fib_route_event(struct mlx5_lag *ldev,
                return;
        }
 
+       /* Handle multipath entry with lower priority value */
+       if (mp->mfi && mp->mfi != fi && fi->fib_priority >= mp->mfi->fib_priority)
+               return;
+
        /* Handle add/replace event */
        nhs = fib_info_num_path(fi);
        if (nhs == 1) {
@@ -135,12 +139,13 @@ static void mlx5_lag_fib_route_event(struct mlx5_lag *ldev,
                        int i = mlx5_lag_dev_get_netdev_idx(ldev, nh_dev);
 
                        if (i < 0)
-                               i = MLX5_LAG_NORMAL_AFFINITY;
-                       else
-                               ++i;
+                               return;
 
+                       i++;
                        mlx5_lag_set_port_affinity(ldev, i);
                }
+
+               mp->mfi = fi;
                return;
        }