Commit f060ccc2 authored by Maxim Mikityanskiy's avatar Maxim Mikityanskiy Committed by Jakub Kicinski
Browse files

net/mlx5e: Convert mlx5e_get_max_sq_wqebbs to u8



The return value of mlx5e_get_max_sq_wqebbs is clamped down to
MLX5_SEND_WQE_MAX_WQEBBS = 16, which fits into u8. This commit changes
the return type of this function to u8 for stricter type safety.

Signed-off-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
Reviewed-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 40b72108
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -227,9 +227,11 @@ static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
 * bytes units. Driver hardens the limitation to 1KB (16
 * WQEBBs), unless firmware capability is stricter.
 */
static inline u16 mlx5e_get_max_sq_wqebbs(struct mlx5_core_dev *mdev)
static inline u8 mlx5e_get_max_sq_wqebbs(struct mlx5_core_dev *mdev)
{
	return min_t(u16, MLX5_SEND_WQE_MAX_WQEBBS,
	BUILD_BUG_ON(MLX5_SEND_WQE_MAX_WQEBBS > U8_MAX);

	return (u8)min_t(u16, MLX5_SEND_WQE_MAX_WQEBBS,
			 MLX5_CAP_GEN(mdev, max_wqe_sz_sq) / MLX5_SEND_WQE_BB);
}