Skip to content

Commit

Permalink
net/mlx5e: Fix error path of updating netdev queues
Browse files Browse the repository at this point in the history
commit 5e7923a upstream.

Avoid division by zero in the error flow. In the driver TC number can be
either 1 or 8. When TC count is set to 1, driver zero netdev->num_tc.
Hence, need to convert it back from 0 to 1 in the error flow.

Fixes: fa37487 ("net/mlx5e: Handle errors from netif_set_real_num_{tx,rx}_queues")
Signed-off-by: Aya Levin <ayal@nvidia.com>
Reviewed-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Aya Levin authored and gregkh committed Jun 3, 2021
1 parent df1bb71 commit 18db59b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Expand Up @@ -3027,7 +3027,7 @@ static int mlx5e_update_netdev_queues(struct mlx5e_priv *priv)
int err;

old_num_txqs = netdev->real_num_tx_queues;
old_ntc = netdev->num_tc;
old_ntc = netdev->num_tc ? : 1;

nch = priv->channels.params.num_channels;
ntc = priv->channels.params.num_tc;
Expand Down

0 comments on commit 18db59b

Please sign in to comment.