[PATCH net 6/6] net/mlx5e: Use unsigned for mlx5e_get_max_num_channels

Tariq Toukan posted 6 patches 1 month, 2 weeks ago
[PATCH net 6/6] net/mlx5e: Use unsigned for mlx5e_get_max_num_channels
Posted by Tariq Toukan 1 month, 2 weeks ago
From: Cosmin Ratiu <cratiu@nvidia.com>

The max number of channels is always an unsigned int, use the correct
type to fix compilation errors done with strict type checking, e.g.:

error: call to ‘__compiletime_assert_1110’ declared with attribute
  error: min(mlx5e_get_devlink_param_num_doorbells(mdev),
  mlx5e_get_max_num_channels(mdev)) signedness error

Fixes: 74a8dadac17e ("net/mlx5e: Preparations for supporting larger number of channels")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
index ff4ab4691baf..a06d08576fd4 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
@@ -179,7 +179,8 @@ static inline u16 mlx5_min_rx_wqes(int wq_type, u32 wq_size)
 }
 
 /* Use this function to get max num channels (rxqs/txqs) only to create netdev */
-static inline int mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
+static inline unsigned int
+mlx5e_get_max_num_channels(struct mlx5_core_dev *mdev)
 {
 	return is_kdump_kernel() ?
 		MLX5E_MIN_NUM_CHANNELS :
-- 
2.44.0

Re: [PATCH net 6/6] net/mlx5e: Use unsigned for mlx5e_get_max_num_channels
Posted by Jacob Keller 1 month, 2 weeks ago

On 2/12/2026 2:32 AM, Tariq Toukan wrote:
> From: Cosmin Ratiu <cratiu@nvidia.com>
> 
> The max number of channels is always an unsigned int, use the correct
> type to fix compilation errors done with strict type checking, e.g.:
> 
> error: call to ‘__compiletime_assert_1110’ declared with attribute
>    error: min(mlx5e_get_devlink_param_num_doorbells(mdev),
>    mlx5e_get_max_num_channels(mdev)) signedness error
> 

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>