1 | /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
2 | /* Copyright (c) 2020 Mellanox Technologies. */ |
3 | |
4 | #ifndef __ML5_FS_TTC_H__ |
5 | #define __ML5_FS_TTC_H__ |
6 | |
7 | #include <linux/mlx5/fs.h> |
8 | |
9 | enum mlx5_traffic_types { |
10 | MLX5_TT_IPV4_TCP, |
11 | MLX5_TT_IPV6_TCP, |
12 | MLX5_TT_IPV4_UDP, |
13 | MLX5_TT_IPV6_UDP, |
14 | MLX5_TT_IPV4_IPSEC_AH, |
15 | MLX5_TT_IPV6_IPSEC_AH, |
16 | MLX5_TT_IPV4_IPSEC_ESP, |
17 | MLX5_TT_IPV6_IPSEC_ESP, |
18 | MLX5_TT_IPV4, |
19 | MLX5_TT_IPV6, |
20 | MLX5_TT_ANY, |
21 | MLX5_NUM_TT, |
22 | MLX5_NUM_INDIR_TIRS = MLX5_TT_ANY, |
23 | }; |
24 | |
25 | enum mlx5_tunnel_types { |
26 | MLX5_TT_IPV4_GRE, |
27 | MLX5_TT_IPV6_GRE, |
28 | MLX5_TT_IPV4_IPIP, |
29 | MLX5_TT_IPV6_IPIP, |
30 | MLX5_TT_IPV4_IPV6, |
31 | MLX5_TT_IPV6_IPV6, |
32 | MLX5_NUM_TUNNEL_TT, |
33 | }; |
34 | |
35 | struct mlx5_ttc_rule { |
36 | struct mlx5_flow_handle *rule; |
37 | struct mlx5_flow_destination default_dest; |
38 | }; |
39 | |
40 | struct mlx5_ttc_table; |
41 | |
42 | struct ttc_params { |
43 | struct mlx5_flow_namespace *ns; |
44 | struct mlx5_flow_table_attr ft_attr; |
45 | struct mlx5_flow_destination dests[MLX5_NUM_TT]; |
46 | DECLARE_BITMAP(ignore_dests, MLX5_NUM_TT); |
47 | bool inner_ttc; |
48 | DECLARE_BITMAP(ignore_tunnel_dests, MLX5_NUM_TUNNEL_TT); |
49 | struct mlx5_flow_destination tunnel_dests[MLX5_NUM_TUNNEL_TT]; |
50 | }; |
51 | |
52 | struct mlx5_flow_table *mlx5_get_ttc_flow_table(struct mlx5_ttc_table *ttc); |
53 | |
54 | struct mlx5_ttc_table *mlx5_create_ttc_table(struct mlx5_core_dev *dev, |
55 | struct ttc_params *params); |
56 | void mlx5_destroy_ttc_table(struct mlx5_ttc_table *ttc); |
57 | |
58 | struct mlx5_ttc_table *mlx5_create_inner_ttc_table(struct mlx5_core_dev *dev, |
59 | struct ttc_params *params); |
60 | |
61 | int mlx5_ttc_fwd_dest(struct mlx5_ttc_table *ttc, enum mlx5_traffic_types type, |
62 | struct mlx5_flow_destination *new_dest); |
63 | struct mlx5_flow_destination |
64 | mlx5_ttc_get_default_dest(struct mlx5_ttc_table *ttc, |
65 | enum mlx5_traffic_types type); |
66 | int mlx5_ttc_fwd_default_dest(struct mlx5_ttc_table *ttc, |
67 | enum mlx5_traffic_types type); |
68 | |
69 | bool mlx5_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev); |
70 | u8 mlx5_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt); |
71 | |
72 | #endif /* __MLX5_FS_TTC_H__ */ |
73 | |