1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019 Mellanox Technologies. */
3 
4 #ifndef __MLX5_LAG_MP_H__
5 #define __MLX5_LAG_MP_H__
6 
7 #include "lag.h"
8 #include "mlx5_core.h"
9 
10 enum mlx5_lag_port_affinity {
11 	MLX5_LAG_NORMAL_AFFINITY,
12 	MLX5_LAG_P1_AFFINITY,
13 	MLX5_LAG_P2_AFFINITY,
14 };
15 
16 struct lag_mp {
17 	struct notifier_block     fib_nb;
18 	struct {
19 		const void        *mfi; /* used in tracking fib events */
20 		u32               priority;
21 		u32               dst;
22 		int               dst_len;
23 	} fib;
24 	struct workqueue_struct   *wq;
25 };
26 
27 #ifdef CONFIG_MLX5_ESWITCH
28 
29 void mlx5_lag_mp_reset(struct mlx5_lag *ldev);
30 int mlx5_lag_mp_init(struct mlx5_lag *ldev);
31 void mlx5_lag_mp_cleanup(struct mlx5_lag *ldev);
32 bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev);
33 
34 #else /* CONFIG_MLX5_ESWITCH */
35 
mlx5_lag_mp_reset(struct mlx5_lag * ldev)36 static inline void mlx5_lag_mp_reset(struct mlx5_lag *ldev) {};
mlx5_lag_mp_init(struct mlx5_lag * ldev)37 static inline int mlx5_lag_mp_init(struct mlx5_lag *ldev) { return 0; }
mlx5_lag_mp_cleanup(struct mlx5_lag * ldev)38 static inline void mlx5_lag_mp_cleanup(struct mlx5_lag *ldev) {}
mlx5_lag_is_multipath(struct mlx5_core_dev * dev)39 static inline bool mlx5_lag_is_multipath(struct mlx5_core_dev *dev) { return false; }
40 
41 #endif /* CONFIG_MLX5_ESWITCH */
42 #endif /* __MLX5_LAG_MP_H__ */
43