mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-24 03:24:55 +08:00
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: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Maxim Mikityanskiy <maximmi@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
e2aeac448f
commit
21ecfcb83a
@ -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 @@ err_txqs:
|
||||
|
||||
err_tcs:
|
||||
mlx5e_netdev_set_tcs(netdev, old_num_txqs / old_ntc, old_ntc);
|
||||
err_out:
|
||||
return err;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user