1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */ 3 4 #ifndef __MLX5_LAG_FS_H__ 5 #define __MLX5_LAG_FS_H__ 6 7 #include "lib/fs_ttc.h" 8 9 struct mlx5_lag_definer { 10 struct mlx5_flow_definer *definer; 11 struct mlx5_flow_table *ft; 12 struct mlx5_flow_group *fg; 13 struct mlx5_flow_handle *rules[MLX5_MAX_PORTS]; 14 }; 15 16 struct mlx5_lag_ttc { 17 struct mlx5_ttc_table *ttc; 18 struct mlx5_lag_definer *definers[MLX5_NUM_TT]; 19 }; 20 21 struct mlx5_lag_port_sel { 22 DECLARE_BITMAP(tt_map, MLX5_NUM_TT); 23 bool tunnel; 24 struct mlx5_lag_ttc outer; 25 struct mlx5_lag_ttc inner; 26 }; 27 28 #ifdef CONFIG_MLX5_ESWITCH 29 30 int mlx5_lag_port_sel_modify(struct mlx5_lag *ldev, u8 port1, u8 port2); 31 void mlx5_lag_port_sel_destroy(struct mlx5_lag *ldev); 32 int mlx5_lag_port_sel_create(struct mlx5_lag *ldev, 33 enum netdev_lag_hash hash_type, u8 port1, 34 u8 port2); 35 36 #else /* CONFIG_MLX5_ESWITCH */ 37 static inline int mlx5_lag_port_sel_create(struct mlx5_lag *ldev, 38 enum netdev_lag_hash hash_type, 39 u8 port1, u8 port2) 40 { 41 return 0; 42 } 43 44 static inline int mlx5_lag_port_sel_modify(struct mlx5_lag *ldev, u8 port1, 45 u8 port2) 46 { 47 return 0; 48 } 49 50 static inline void mlx5_lag_port_sel_destroy(struct mlx5_lag *ldev) {} 51 #endif /* CONFIG_MLX5_ESWITCH */ 52 #endif /* __MLX5_LAG_FS_H__ */ 53