xref: /linux/drivers/net/ethernet/mellanox/mlx5/core/en/rss.h (revision 79790b6818e96c58fe2bffee1b418c16e64e7b80)
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. */
3 
4 #ifndef __MLX5_EN_RSS_H__
5 #define __MLX5_EN_RSS_H__
6 
7 #include "rqt.h"
8 #include "tir.h"
9 #include "fs.h"
10 
11 enum mlx5e_rss_init_type {
12 	MLX5E_RSS_INIT_NO_TIRS = 0,
13 	MLX5E_RSS_INIT_TIRS
14 };
15 
16 struct mlx5e_rss_params_traffic_type
17 mlx5e_rss_get_default_tt_config(enum mlx5_traffic_types tt);
18 
19 struct mlx5e_rss;
20 
21 int mlx5e_rss_params_indir_init(struct mlx5e_rss_params_indir *indir, struct mlx5_core_dev *mdev,
22 				u32 actual_table_size, u32 max_table_size);
23 void mlx5e_rss_params_indir_cleanup(struct mlx5e_rss_params_indir *indir);
24 void mlx5e_rss_params_indir_modify_actual_size(struct mlx5e_rss *rss, u32 num_channels);
25 struct mlx5e_rss *mlx5e_rss_init(struct mlx5_core_dev *mdev, bool inner_ft_support, u32 drop_rqn,
26 				 const struct mlx5e_packet_merge_param *init_pkt_merge_param,
27 				 enum mlx5e_rss_init_type type, unsigned int nch,
28 				 unsigned int max_nch);
29 int mlx5e_rss_cleanup(struct mlx5e_rss *rss);
30 
31 void mlx5e_rss_refcnt_inc(struct mlx5e_rss *rss);
32 void mlx5e_rss_refcnt_dec(struct mlx5e_rss *rss);
33 unsigned int mlx5e_rss_refcnt_read(struct mlx5e_rss *rss);
34 
35 u32 mlx5e_rss_get_tirn(struct mlx5e_rss *rss, enum mlx5_traffic_types tt,
36 		       bool inner);
37 int mlx5e_rss_obtain_tirn(struct mlx5e_rss *rss,
38 			  enum mlx5_traffic_types tt,
39 			  const struct mlx5e_packet_merge_param *init_pkt_merge_param,
40 			  bool inner, u32 *tirn);
41 
42 void mlx5e_rss_enable(struct mlx5e_rss *rss, u32 *rqns, u32 *vhca_ids, unsigned int num_rqns);
43 void mlx5e_rss_disable(struct mlx5e_rss *rss);
44 
45 int mlx5e_rss_packet_merge_set_param(struct mlx5e_rss *rss,
46 				     struct mlx5e_packet_merge_param *pkt_merge_param);
47 int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc);
48 int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir,
49 		       const u8 *key, const u8 *hfunc,
50 		       u32 *rqns, u32 *vhca_ids, unsigned int num_rqns);
51 struct mlx5e_rss_params_hash mlx5e_rss_get_hash(struct mlx5e_rss *rss);
52 u8 mlx5e_rss_get_hash_fields(struct mlx5e_rss *rss, enum mlx5_traffic_types tt);
53 int mlx5e_rss_set_hash_fields(struct mlx5e_rss *rss, enum mlx5_traffic_types tt,
54 			      u8 rx_hash_fields);
55 void mlx5e_rss_set_indir_uniform(struct mlx5e_rss *rss, unsigned int nch);
56 #endif /* __MLX5_EN_RSS_H__ */
57