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_RQT_H__
5 #define __MLX5_EN_RQT_H__
6 
7 #include <linux/kernel.h>
8 
9 #define MLX5E_INDIR_RQT_SIZE (1 << 8)
10 
11 struct mlx5_core_dev;
12 
13 struct mlx5e_rss_params_indir {
14 	u32 table[MLX5E_INDIR_RQT_SIZE];
15 };
16 
17 void mlx5e_rss_params_indir_init_uniform(struct mlx5e_rss_params_indir *indir,
18 					 unsigned int num_channels);
19 
20 struct mlx5e_rqt {
21 	struct mlx5_core_dev *mdev;
22 	u32 rqtn;
23 	u16 size;
24 };
25 
26 int mlx5e_rqt_init_direct(struct mlx5e_rqt *rqt, struct mlx5_core_dev *mdev,
27 			  bool indir_enabled, u32 init_rqn);
28 int mlx5e_rqt_init_indir(struct mlx5e_rqt *rqt, struct mlx5_core_dev *mdev,
29 			 u32 *rqns, unsigned int num_rqns,
30 			 u8 hfunc, struct mlx5e_rss_params_indir *indir);
31 void mlx5e_rqt_destroy(struct mlx5e_rqt *rqt);
32 
mlx5e_rqt_get_rqtn(struct mlx5e_rqt * rqt)33 static inline u32 mlx5e_rqt_get_rqtn(struct mlx5e_rqt *rqt)
34 {
35 	return rqt->rqtn;
36 }
37 
38 int mlx5e_rqt_redirect_direct(struct mlx5e_rqt *rqt, u32 rqn);
39 int mlx5e_rqt_redirect_indir(struct mlx5e_rqt *rqt, u32 *rqns, unsigned int num_rqns,
40 			     u8 hfunc, struct mlx5e_rss_params_indir *indir);
41 
42 #endif /* __MLX5_EN_RQT_H__ */
43