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 						 u16 vport, bool decap);
17 void mlx5_esw_indir_table_put(struct mlx5_eswitch *esw,
18 			      u16 vport, bool decap);
19 
20 bool
21 mlx5_esw_indir_table_needed(struct mlx5_eswitch *esw,
22 			    struct mlx5_flow_attr *attr,
23 			    u16 vport_num,
24 			    struct mlx5_core_dev *dest_mdev);
25 
26 u16
27 mlx5_esw_indir_table_decap_vport(struct mlx5_flow_attr *attr);
28 
29 #else
30 /* indir API stubs */
31 static inline struct mlx5_esw_indir_table *
32 mlx5_esw_indir_table_init(void)
33 {
34 	return NULL;
35 }
36 
37 static inline void
38 mlx5_esw_indir_table_destroy(struct mlx5_esw_indir_table *indir)
39 {
40 }
41 
42 static inline struct mlx5_flow_table *
43 mlx5_esw_indir_table_get(struct mlx5_eswitch *esw,
44 			 struct mlx5_flow_attr *attr,
45 			 u16 vport, bool decap)
46 {
47 	return ERR_PTR(-EOPNOTSUPP);
48 }
49 
50 static inline void
51 mlx5_esw_indir_table_put(struct mlx5_eswitch *esw,
52 			 u16 vport, bool decap)
53 {
54 }
55 
56 static inline bool
57 mlx5_esw_indir_table_needed(struct mlx5_eswitch *esw,
58 			    struct mlx5_flow_attr *attr,
59 			    u16 vport_num,
60 			    struct mlx5_core_dev *dest_mdev)
61 {
62 	return false;
63 }
64 
65 static inline u16
66 mlx5_esw_indir_table_decap_vport(struct mlx5_flow_attr *attr)
67 {
68 	return 0;
69 }
70 #endif
71 
72 #endif /* __MLX5_ESW_FT_H__ */
73