1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2 /* Copyright (c) 2020 Mellanox Technologies. */ 3 4 #ifndef __ML5_ESW_CHAINS_H__ 5 #define __ML5_ESW_CHAINS_H__ 6 7 #include <dev/mlx5/fs.h> 8 9 struct mlx5_fs_chains; 10 11 enum mlx5_chains_flags { 12 MLX5_CHAINS_AND_PRIOS_SUPPORTED = BIT(0), 13 MLX5_CHAINS_IGNORE_FLOW_LEVEL_SUPPORTED = BIT(1), 14 MLX5_CHAINS_FT_TUNNEL_SUPPORTED = BIT(2), 15 }; 16 17 struct mlx5_chains_attr { 18 enum mlx5_flow_namespace_type ns; 19 int fs_base_prio; 20 int fs_base_level; 21 u32 flags; 22 u32 max_grp_num; 23 struct mlx5_flow_table *default_ft; 24 }; 25 26 bool 27 mlx5_chains_prios_supported(struct mlx5_fs_chains *chains); 28 bool mlx5_chains_ignore_flow_level_supported(struct mlx5_fs_chains *chains); 29 bool 30 mlx5_chains_backwards_supported(struct mlx5_fs_chains *chains); 31 u32 32 mlx5_chains_get_prio_range(struct mlx5_fs_chains *chains); 33 u32 34 mlx5_chains_get_chain_range(struct mlx5_fs_chains *chains); 35 u32 36 mlx5_chains_get_nf_ft_chain(struct mlx5_fs_chains *chains); 37 38 struct mlx5_flow_table * 39 mlx5_chains_get_table(struct mlx5_fs_chains *chains, u32 chain, u32 prio, 40 u32 level); 41 void 42 mlx5_chains_put_table(struct mlx5_fs_chains *chains, u32 chain, u32 prio, 43 u32 level); 44 45 struct mlx5_flow_table * 46 mlx5_chains_get_tc_end_ft(struct mlx5_fs_chains *chains); 47 48 struct mlx5_flow_table * 49 mlx5_chains_create_global_table(struct mlx5_fs_chains *chains); 50 void 51 mlx5_chains_destroy_global_table(struct mlx5_fs_chains *chains, 52 struct mlx5_flow_table *ft); 53 54 int 55 mlx5_chains_get_chain_mapping(struct mlx5_fs_chains *chains, u32 chain, 56 u32 *chain_mapping); 57 int 58 mlx5_chains_put_chain_mapping(struct mlx5_fs_chains *chains, 59 u32 chain_mapping); 60 61 struct mlx5_fs_chains * 62 mlx5_chains_create(struct mlx5_core_dev *dev, struct mlx5_chains_attr *attr); 63 void mlx5_chains_destroy(struct mlx5_fs_chains *chains); 64 65 void 66 mlx5_chains_set_end_ft(struct mlx5_fs_chains *chains, 67 struct mlx5_flow_table *ft); 68 void 69 mlx5_chains_print_info(struct mlx5_fs_chains *chains); 70 71 #endif /* __ML5_ESW_CHAINS_H__ */ 72