| 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 | enum mlx5_flow_namespace_type ns_type; |
| 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 | const char *mlx5_ttc_get_name(enum mlx5_traffic_types tt); |
| 53 | struct mlx5_flow_table *mlx5_get_ttc_flow_table(struct mlx5_ttc_table *ttc); |
| 54 | |
| 55 | struct mlx5_ttc_table *mlx5_create_ttc_table(struct mlx5_core_dev *dev, |
| 56 | struct ttc_params *params); |
| 57 | void mlx5_destroy_ttc_table(struct mlx5_ttc_table *ttc); |
| 58 | |
| 59 | struct mlx5_ttc_table *mlx5_create_inner_ttc_table(struct mlx5_core_dev *dev, |
| 60 | struct ttc_params *params); |
| 61 | |
| 62 | int mlx5_ttc_fwd_dest(struct mlx5_ttc_table *ttc, enum mlx5_traffic_types type, |
| 63 | struct mlx5_flow_destination *new_dest); |
| 64 | struct mlx5_flow_destination |
| 65 | mlx5_ttc_get_default_dest(struct mlx5_ttc_table *ttc, |
| 66 | enum mlx5_traffic_types type); |
| 67 | int mlx5_ttc_fwd_default_dest(struct mlx5_ttc_table *ttc, |
| 68 | enum mlx5_traffic_types type); |
| 69 | |
| 70 | bool mlx5_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev); |
| 71 | u8 mlx5_get_proto_by_tunnel_type(enum mlx5_tunnel_types tt); |
| 72 | |
| 73 | #endif /* __MLX5_FS_TTC_H__ */ |
| 74 | |