1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* Copyright (c) 2021 Mellanox Technologies. */ 3 4 #ifndef __MLX5_ESW_FT_H__ 5 #define __MLX5_ESW_FT_H__ 6 7 #ifdef CONFIG_MLX5_CLS_ACT 8 9 struct mlx5_esw_indir_table * 10 mlx5_esw_indir_table_init(void); 11 void 12 mlx5_esw_indir_table_destroy(struct mlx5_esw_indir_table *indir); 13 14 struct mlx5_flow_table *mlx5_esw_indir_table_get(struct mlx5_eswitch *esw, 15 struct mlx5_flow_attr *attr, 16 struct mlx5_flow_spec *spec, 17 u16 vport, bool decap); 18 void mlx5_esw_indir_table_put(struct mlx5_eswitch *esw, 19 struct mlx5_flow_attr *attr, 20 u16 vport, bool decap); 21 22 bool 23 mlx5_esw_indir_table_needed(struct mlx5_eswitch *esw, 24 struct mlx5_flow_attr *attr, 25 u16 vport_num, 26 struct mlx5_core_dev *dest_mdev); 27 28 u16 29 mlx5_esw_indir_table_decap_vport(struct mlx5_flow_attr *attr); 30 31 #else 32 /* indir API stubs */ 33 static inline struct mlx5_esw_indir_table * 34 mlx5_esw_indir_table_init(void) 35 { 36 return NULL; 37 } 38 39 static inline void 40 mlx5_esw_indir_table_destroy(struct mlx5_esw_indir_table *indir) 41 { 42 } 43 44 static inline struct mlx5_flow_table * 45 mlx5_esw_indir_table_get(struct mlx5_eswitch *esw, 46 struct mlx5_flow_attr *attr, 47 struct mlx5_flow_spec *spec, 48 u16 vport, bool decap) 49 { 50 return ERR_PTR(-EOPNOTSUPP); 51 } 52 53 static inline void 54 mlx5_esw_indir_table_put(struct mlx5_eswitch *esw, 55 struct mlx5_flow_attr *attr, 56 u16 vport, bool decap) 57 { 58 } 59 60 static inline bool 61 mlx5_esw_indir_table_needed(struct mlx5_eswitch *esw, 62 struct mlx5_flow_attr *attr, 63 u16 vport_num, 64 struct mlx5_core_dev *dest_mdev) 65 { 66 return false; 67 } 68 69 static inline u16 70 mlx5_esw_indir_table_decap_vport(struct mlx5_flow_attr *attr) 71 { 72 return 0; 73 } 74 #endif 75 76 #endif /* __MLX5_ESW_FT_H__ */ 77