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 struct mlx5e_rss_params_traffic_type
12 mlx5e_rss_get_default_tt_config(enum mlx5_traffic_types tt);
13 
14 struct mlx5e_rss;
15 
16 struct mlx5e_rss *mlx5e_rss_alloc(void);
17 void mlx5e_rss_free(struct mlx5e_rss *rss);
18 int mlx5e_rss_init(struct mlx5e_rss *rss, struct mlx5_core_dev *mdev,
19 		   bool inner_ft_support, u32 drop_rqn,
20 		   const struct mlx5e_packet_merge_param *init_pkt_merge_param);
21 int mlx5e_rss_init_no_tirs(struct mlx5e_rss *rss, struct mlx5_core_dev *mdev,
22 			   bool inner_ft_support, u32 drop_rqn);
23 int mlx5e_rss_cleanup(struct mlx5e_rss *rss);
24 
25 void mlx5e_rss_refcnt_inc(struct mlx5e_rss *rss);
26 void mlx5e_rss_refcnt_dec(struct mlx5e_rss *rss);
27 unsigned int mlx5e_rss_refcnt_read(struct mlx5e_rss *rss);
28 
29 u32 mlx5e_rss_get_tirn(struct mlx5e_rss *rss, enum mlx5_traffic_types tt,
30 		       bool inner);
31 int mlx5e_rss_obtain_tirn(struct mlx5e_rss *rss,
32 			  enum mlx5_traffic_types tt,
33 			  const struct mlx5e_packet_merge_param *init_pkt_merge_param,
34 			  bool inner, u32 *tirn);
35 
36 void mlx5e_rss_enable(struct mlx5e_rss *rss, u32 *rqns, unsigned int num_rqns);
37 void mlx5e_rss_disable(struct mlx5e_rss *rss);
38 
39 int mlx5e_rss_packet_merge_set_param(struct mlx5e_rss *rss,
40 				     struct mlx5e_packet_merge_param *pkt_merge_param);
41 int mlx5e_rss_get_rxfh(struct mlx5e_rss *rss, u32 *indir, u8 *key, u8 *hfunc);
42 int mlx5e_rss_set_rxfh(struct mlx5e_rss *rss, const u32 *indir,
43 		       const u8 *key, const u8 *hfunc,
44 		       u32 *rqns, unsigned int num_rqns);
45 struct mlx5e_rss_params_hash mlx5e_rss_get_hash(struct mlx5e_rss *rss);
46 u8 mlx5e_rss_get_hash_fields(struct mlx5e_rss *rss, enum mlx5_traffic_types tt);
47 int mlx5e_rss_set_hash_fields(struct mlx5e_rss *rss, enum mlx5_traffic_types tt,
48 			      u8 rx_hash_fields);
49 void mlx5e_rss_set_indir_uniform(struct mlx5e_rss *rss, unsigned int nch);
50 #endif /* __MLX5_EN_RSS_H__ */
51