Skip to content

Commit 84c8a87

Browse files
nvmmaxSaeed Mahameed
authored andcommitted
net/mlx5e: Fix division by 0 in mlx5e_select_queue for representors
Commit 846d6da ("net/mlx5e: Fix division by 0 in mlx5e_select_queue") makes mlx5e_build_nic_params assign a non-zero initial value to priv->num_tc_x_num_ch, so that mlx5e_select_queue doesn't fail with division by 0 if called before the first activation of channels. However, the initialization flow of representors doesn't call mlx5e_build_nic_params, so this bug can still happen with representors. This commit fixes the bug by adding the missing assignment to mlx5e_build_rep_params. Fixes: 846d6da ("net/mlx5e: Fix division by 0 in mlx5e_select_queue") Signed-off-by: Maxim Mikityanskiy <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 0bc73ad commit 84c8a87

File tree

1 file changed

+5
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+5
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_rep.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -618,6 +618,11 @@ static void mlx5e_build_rep_params(struct net_device *netdev)
618618
params->mqprio.num_tc = 1;
619619
params->tunneled_offload_en = false;
620620

621+
/* Set an initial non-zero value, so that mlx5e_select_queue won't
622+
* divide by zero if called before first activating channels.
623+
*/
624+
priv->num_tc_x_num_ch = params->num_channels * params->mqprio.num_tc;
625+
621626
mlx5_query_min_inline(mdev, &params->tx_min_inline_mode);
622627
}
623628

0 commit comments

Comments
 (0)