• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 	bool   inner_ttc;
47 	struct mlx5_flow_destination tunnel_dests[MLX5_NUM_TUNNEL_TT];
48 };
49 
50 struct mlx5_flow_table *mlx5_get_ttc_flow_table(struct mlx5_ttc_table *ttc);
51 
52 struct mlx5_ttc_table *mlx5_create_ttc_table(struct mlx5_core_dev *dev,
53 					     struct ttc_params *params);
54 void mlx5_destroy_ttc_table(struct mlx5_ttc_table *ttc);
55 
56 struct mlx5_ttc_table *mlx5_create_inner_ttc_table(struct mlx5_core_dev *dev,
57 						   struct ttc_params *params);
58 
59 int mlx5_ttc_fwd_dest(struct mlx5_ttc_table *ttc, enum mlx5_traffic_types type,
60 		      struct mlx5_flow_destination *new_dest);
61 struct mlx5_flow_destination
62 mlx5_ttc_get_default_dest(struct mlx5_ttc_table *ttc,
63 			  enum mlx5_traffic_types type);
64 int mlx5_ttc_fwd_default_dest(struct mlx5_ttc_table *ttc,
65 			      enum mlx5_traffic_types type);
66 
67 bool mlx5_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev);
68 u8 mlx5_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt);
69 
70 #endif /* __MLX5_FS_TTC_H__ */
71