Commit 6f9485af authored by Saeed Mahameed's avatar Saeed Mahameed

net/mlx5e: Fail safe tc setup

Use the new fail-safe channels switch mechanism to set up new
tc parameters.
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
Reviewed-by: default avatarTariq Toukan <tariqt@mellanox.com>
parent be7e87f9
...@@ -2910,7 +2910,7 @@ int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd) ...@@ -2910,7 +2910,7 @@ int mlx5e_modify_channels_vsd(struct mlx5e_channels *chs, bool vsd)
static int mlx5e_setup_tc(struct net_device *netdev, u8 tc) static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
{ {
struct mlx5e_priv *priv = netdev_priv(netdev); struct mlx5e_priv *priv = netdev_priv(netdev);
bool was_opened; struct mlx5e_channels new_channels = {};
int err = 0; int err = 0;
if (tc && tc != MLX5E_MAX_NUM_TC) if (tc && tc != MLX5E_MAX_NUM_TC)
...@@ -2918,17 +2918,21 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 tc) ...@@ -2918,17 +2918,21 @@ static int mlx5e_setup_tc(struct net_device *netdev, u8 tc)
mutex_lock(&priv->state_lock); mutex_lock(&priv->state_lock);
was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state); new_channels.params = priv->channels.params;
if (was_opened) new_channels.params.num_tc = tc ? tc : 1;
mlx5e_close_locked(priv->netdev);
priv->channels.params.num_tc = tc ? tc : 1; if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
priv->channels.params = new_channels.params;
goto out;
}
if (was_opened) err = mlx5e_open_channels(priv, &new_channels);
err = mlx5e_open_locked(priv->netdev); if (err)
goto out;
mlx5e_switch_priv_channels(priv, &new_channels);
out:
mutex_unlock(&priv->state_lock); mutex_unlock(&priv->state_lock);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment