1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2021, Mellanox Technologies inc. All rights reserved. */
3
4 #ifndef __MLX5_EN_TIR_H__
5 #define __MLX5_EN_TIR_H__
6
7 #include <linux/kernel.h>
8
9 struct mlx5e_rss_params_hash {
10 u8 hfunc;
11 u8 toeplitz_hash_key[40];
12 };
13
14 struct mlx5e_rss_params_traffic_type {
15 u8 l3_prot_type;
16 u8 l4_prot_type;
17 u32 rx_hash_fields;
18 };
19
20 struct mlx5e_tir_builder;
21 struct mlx5e_packet_merge_param;
22
23 struct mlx5e_tir_builder *mlx5e_tir_builder_alloc(bool modify);
24 void mlx5e_tir_builder_free(struct mlx5e_tir_builder *builder);
25 void mlx5e_tir_builder_clear(struct mlx5e_tir_builder *builder);
26
27 void mlx5e_tir_builder_build_inline(struct mlx5e_tir_builder *builder, u32 tdn, u32 rqn);
28 void mlx5e_tir_builder_build_rqt(struct mlx5e_tir_builder *builder, u32 tdn,
29 u32 rqtn, bool inner_ft_support);
30 void mlx5e_tir_builder_build_packet_merge(struct mlx5e_tir_builder *builder,
31 const struct mlx5e_packet_merge_param *pkt_merge_param);
32 void mlx5e_tir_builder_build_rss(struct mlx5e_tir_builder *builder,
33 const struct mlx5e_rss_params_hash *rss_hash,
34 const struct mlx5e_rss_params_traffic_type *rss_tt,
35 bool inner);
36 void mlx5e_tir_builder_build_direct(struct mlx5e_tir_builder *builder);
37 void mlx5e_tir_builder_build_tls(struct mlx5e_tir_builder *builder);
38
39 struct mlx5_core_dev;
40
41 struct mlx5e_tir {
42 struct mlx5_core_dev *mdev;
43 u32 tirn;
44 struct list_head list;
45 };
46
47 int mlx5e_tir_init(struct mlx5e_tir *tir, struct mlx5e_tir_builder *builder,
48 struct mlx5_core_dev *mdev, bool reg);
49 void mlx5e_tir_destroy(struct mlx5e_tir *tir);
50
mlx5e_tir_get_tirn(struct mlx5e_tir * tir)51 static inline u32 mlx5e_tir_get_tirn(struct mlx5e_tir *tir)
52 {
53 return tir->tirn;
54 }
55
56 int mlx5e_tir_modify(struct mlx5e_tir *tir, struct mlx5e_tir_builder *builder);
57
58 #endif /* __MLX5_EN_TIR_H__ */
59