Skip to content

Commit

Permalink
net/mlx5e: Update max_opened_tc also when channels are closed
Browse files Browse the repository at this point in the history
max_opened_tc is used for stats, so that potentially non-zero stats
won't disappear when num_tc decreases. However, mlx5e_setup_tc_mqprio
fails to update it in the flow where channels are closed.

This commit fixes it. The new value of priv->channels.params.num_tc is
always checked on exit. In case of errors it will just be the old value,
and in case of success it will be the updated value.

Fixes: 05909ba ("net/mlx5e: Avoid reset netdev stats on configuration changes")
Signed-off-by: Maxim Mikityanskiy <[email protected]>
Reviewed-by: Tariq Toukan <[email protected]>
Signed-off-by: Saeed Mahameed <[email protected]>
  • Loading branch information
Maxim Mikityanskiy authored and Saeed Mahameed committed Feb 2, 2021
1 parent a5bfe6b commit 5a2ba25
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/net/ethernet/mellanox/mlx5/core/en_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3627,12 +3627,10 @@ static int mlx5e_setup_tc_mqprio(struct mlx5e_priv *priv,

err = mlx5e_safe_switch_channels(priv, &new_channels,
mlx5e_num_channels_changed_ctx, NULL);
if (err)
goto out;

priv->max_opened_tc = max_t(u8, priv->max_opened_tc,
new_channels.params.num_tc);
out:
priv->max_opened_tc = max_t(u8, priv->max_opened_tc,
priv->channels.params.num_tc);
mutex_unlock(&priv->state_lock);
return err;
}
Expand Down

0 comments on commit 5a2ba25

Please sign in to comment.