xref: /linux/drivers/net/ethernet/mellanox/mlx5/core/en/rqt.h (revision cffaefd15a8f423cdee5d8eac15d267bc92de314)
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_MIN_RQT_SIZE (BIT(8))
10 
11 struct mlx5_core_dev;
12 
13 struct mlx5e_rss_params_indir {
14 	u32 *table;
15 	u32 actual_table_size;
16 	u32 max_table_size;
17 };
18 
19 void mlx5e_rss_params_indir_init_uniform(struct mlx5e_rss_params_indir *indir,
20 					 unsigned int num_channels);
21 
22 struct mlx5e_rqt {
23 	struct mlx5_core_dev *mdev; /* primary */
24 	u32 rqtn;
25 	u16 size;
26 };
27 
28 int mlx5e_rqt_init_direct(struct mlx5e_rqt *rqt, struct mlx5_core_dev *mdev,
29 			  bool indir_enabled, u32 init_rqn, u32 indir_table_size);
30 int mlx5e_rqt_init_indir(struct mlx5e_rqt *rqt, struct mlx5_core_dev *mdev,
31 			 u32 *rqns, u32 *vhca_ids, unsigned int num_rqns,
32 			 u8 hfunc, struct mlx5e_rss_params_indir *indir);
33 void mlx5e_rqt_destroy(struct mlx5e_rqt *rqt);
34 
35 static inline u32 mlx5e_rqt_get_rqtn(struct mlx5e_rqt *rqt)
36 {
37 	return rqt->rqtn;
38 }
39 
40 u32 mlx5e_rqt_size(struct mlx5_core_dev *mdev, unsigned int num_channels);
41 int mlx5e_rqt_redirect_direct(struct mlx5e_rqt *rqt, u32 rqn, u32 *vhca_id);
42 int mlx5e_rqt_redirect_indir(struct mlx5e_rqt *rqt, u32 *rqns, u32 *vhca_ids,
43 			     unsigned int num_rqns,
44 			     u8 hfunc, struct mlx5e_rss_params_indir *indir);
45 
46 #endif /* __MLX5_EN_RQT_H__ */
47