Skip to content

Commit 3105797

Browse files
PatrisiousHaddadkuba-moo
authored andcommitted
net/mlx5: Lag, multipath, give priority for routes with smaller network prefix
Today multipath offload is controlled by a single route and the route controlling is selected if it meets one of the following criteria: 1. No controlling route is set. 2. New route destination is the same as old one. 3. New route metric is lower than old route metric. This can cause unwanted behaviour in case a new route is added with a smaller network prefix which should get the priority. Fix this by adding a new criteria to give priority to new route with a smaller network prefix. Fixes: ad11c4f ("net/mlx5e: Lag, Only handle events from highest priority multipath entry") Signed-off-by: Patrisious Haddad <[email protected]> Signed-off-by: Mark Bloch <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 02d1e1a commit 3105797

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

  • drivers/net/ethernet/mellanox/mlx5/core/lag

drivers/net/ethernet/mellanox/mlx5/core/lag/mp.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,15 @@ static void mlx5_lag_fib_route_event(struct mlx5_lag *ldev, unsigned long event,
173173
}
174174

175175
/* Handle multipath entry with lower priority value */
176-
if (mp->fib.mfi && mp->fib.mfi != fi &&
176+
if (mp->fib.mfi &&
177177
(mp->fib.dst != fen_info->dst || mp->fib.dst_len != fen_info->dst_len) &&
178-
fi->fib_priority >= mp->fib.priority)
178+
mp->fib.dst_len <= fen_info->dst_len &&
179+
!(mp->fib.dst_len == fen_info->dst_len &&
180+
fi->fib_priority < mp->fib.priority)) {
181+
mlx5_core_dbg(ldev->pf[idx].dev,
182+
"Multipath entry with lower priority was rejected\n");
179183
return;
184+
}
180185

181186
nh_dev0 = mlx5_lag_get_next_fib_dev(ldev, fi, NULL);
182187
nh_dev1 = mlx5_lag_get_next_fib_dev(ldev, fi, nh_dev0);

0 commit comments

Comments
 (0)