Skip to content

Commit 2f8b616

Browse files
chumakdSaeed Mahameed
authored andcommitted
net/mlx5: Lag, fix multipath lag activation
When handling FIB_EVENT_ENTRY_REPLACE event for a new multipath route, lag activation can be missed if a stale (struct lag_mp)->mfi pointer exists, which was associated with an older multipath route that had been removed. Normally, when a route is removed, it triggers mlx5_lag_fib_event(), which handles FIB_EVENT_ENTRY_DEL and clears mfi pointer. But, if mlx5_lag_check_prereq() condition isn't met, for example when eswitch is in legacy mode, the fib event is skipped and mfi pointer becomes stale. Fix by resetting mfi pointer to NULL in mlx5_deactivate_lag(). Fixes: 8a66e45 ("net/mlx5: Change ownership model for lag") Signed-off-by: Dima Chumak <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Reviewed-by: Mark Bloch <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 73367f0 commit 2f8b616

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ static int mlx5_deactivate_lag(struct mlx5_lag *ldev)
277277
int err;
278278

279279
ldev->flags &= ~MLX5_LAG_MODE_FLAGS;
280+
mlx5_lag_mp_reset(ldev);
280281

281282
MLX5_SET(destroy_lag_in, in, opcode, MLX5_CMD_OP_DESTROY_LAG);
282283
err = mlx5_cmd_exec_in(dev0, destroy_lag, in);

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,14 @@ static int mlx5_lag_fib_event(struct notifier_block *nb,
302302
return NOTIFY_DONE;
303303
}
304304

305+
void mlx5_lag_mp_reset(struct mlx5_lag *ldev)
306+
{
307+
/* Clear mfi, as it might become stale when a route delete event
308+
* has been missed, see mlx5_lag_fib_route_event().
309+
*/
310+
ldev->lag_mp.mfi = NULL;
311+
}
312+
305313
int mlx5_lag_mp_init(struct mlx5_lag *ldev)
306314
{
307315
struct lag_mp *mp = &ldev->lag_mp;

drivers/net/ethernet/mellanox/mlx5/core/lag_mp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ struct lag_mp {
2121

2222
#ifdef CONFIG_MLX5_ESWITCH
2323

24+
void mlx5_lag_mp_reset(struct mlx5_lag *ldev);
2425
int mlx5_lag_mp_init(struct mlx5_lag *ldev);
2526
void mlx5_lag_mp_cleanup(struct mlx5_lag *ldev);
2627

2728
#else /* CONFIG_MLX5_ESWITCH */
2829

30+
static inline void mlx5_lag_mp_reset(struct mlx5_lag *ldev) {};
2931
static inline int mlx5_lag_mp_init(struct mlx5_lag *ldev) { return 0; }
3032
static inline void mlx5_lag_mp_cleanup(struct mlx5_lag *ldev) {}
3133

0 commit comments

Comments
 (0)