From: Yishai Hadas Since max_io_eqs was added, an administrator can set it to 0 for a VF, or for the host PF from the ECPF. The function then gets only the control EQs, and with ODP enabled get_num_eqs() returns 0 completion EQs. The aRFS version of alloc_rmap() passes the zero value to alloc_irq_cpu_rmap() which results in a divide by zero. Handle the zero case by returning an error for non SFs: aRFS can't function without it. Fixes: 93197c7c509d ("mlx5/core: Support max_io_eqs for a function") Signed-off-by: Yishai Hadas Signed-off-by: Dragos Tatulea Reviewed-by: Shahar Shitrit Signed-off-by: Tariq Toukan --- drivers/net/ethernet/mellanox/mlx5/core/eq.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c b/drivers/net/ethernet/mellanox/mlx5/core/eq.c index d11ec263d53c..0795ee24ad7f 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c @@ -930,6 +930,9 @@ static int alloc_rmap(struct mlx5_core_dev *mdev) if (mlx5_core_is_sf(mdev)) return 0; + if (!eq_table->max_comp_eqs) + return -EINVAL; + eq_table->rmap = alloc_irq_cpu_rmap(eq_table->max_comp_eqs); if (!eq_table->rmap) return -ENOMEM; base-commit: b6c8f45ed340f00bf2004d407cf7316fe3e24c48 -- 2.44.0