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