Skip to contentSkip to conversation

FAILED: patch "[PATCH] net/mlx5e: Fix division by 0 in mlx5e_select_queue for" failed to apply to 5.14-stable tree

PATCH [email protected] 1 participant 1 message Oct 18, 2021

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 84c8a87402cf073ba7948dd62d4815a3f4a224c8 Mon Sep 17 00:00:00 2001
From: Maxim Mikityanskiy <[email protected]>
Date: Mon, 11 Oct 2021 18:39:35 +0300
Subject: [PATCH] net/mlx5e: Fix division by 0 in mlx5e_select_queue for
representors

Commit 846d6da1fcdb ("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 846d6da1fcdb ("net/mlx5e: Fix division by 0 in mlx5e_select_queue")
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +5 -0
index 0439203fc7d9..0684ac6699b2 100644
@@ -618,6 +618,11 @@ static void mlx5e_build_rep_params(struct net_device *netdev)
 	params->mqprio.num_tc       = 1;
 	params->tunneled_offload_en = false;
 
+	/* Set an initial non-zero value, so that mlx5e_select_queue won't
+	 * divide by zero if called before first activating channels.
+	 */
+	priv->num_tc_x_num_ch = params->num_channels * params->mqprio.num_tc;
+
 	mlx5_query_min_inline(mdev, &params->tx_min_inline_mode);
 }