Commit 21ecfcb8 authored by Tariq Toukan's avatar Tariq Toukan Committed by Saeed Mahameed

net/mlx5e: Handle errors of netdev_set_num_tc()

Add handling for failures in netdev_set_num_tc().
Let mlx5e_netdev_set_tcs return an int.
Signed-off-by: default avatarTariq Toukan <tariqt@nvidia.com>
Reviewed-by: default avatarMaxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent e2aeac44
......@@ -2263,22 +2263,28 @@ void mlx5e_set_netdev_mtu_boundaries(struct mlx5e_priv *priv)
ETH_MAX_MTU);
}
static void mlx5e_netdev_set_tcs(struct net_device *netdev, u16 nch, u8 ntc)
static int mlx5e_netdev_set_tcs(struct net_device *netdev, u16 nch, u8 ntc)
{
int tc;
int tc, err;
netdev_reset_tc(netdev);
if (ntc == 1)
return;
return 0;
netdev_set_num_tc(netdev, ntc);
err = netdev_set_num_tc(netdev, ntc);
if (err) {
netdev_WARN(netdev, "netdev_set_num_tc failed (%d), ntc = %d\n", err, ntc);
return err;
}
/* Map netdev TCs to offset 0
* We have our own UP to TXQ mapping for QoS
*/
for (tc = 0; tc < ntc; tc++)
netdev_set_tc_queue(netdev, tc, nch, 0);
return 0;
}
int mlx5e_update_tx_netdev_queues(struct mlx5e_priv *priv)
......@@ -2315,8 +2321,9 @@ static int mlx5e_update_netdev_queues(struct mlx5e_priv *priv)
ntc = mlx5e_get_dcb_num_tc(&priv->channels.params);
num_rxqs = nch * priv->profile->rq_groups;
mlx5e_netdev_set_tcs(netdev, nch, ntc);
err = mlx5e_netdev_set_tcs(netdev, nch, ntc);
if (err)
goto err_out;
err = mlx5e_update_tx_netdev_queues(priv);
if (err)
goto err_tcs;
......@@ -2338,6 +2345,7 @@ static int mlx5e_update_netdev_queues(struct mlx5e_priv *priv)
err_tcs:
mlx5e_netdev_set_tcs(netdev, old_num_txqs / old_ntc, old_ntc);
err_out:
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