forked from luck/tmp_suning_uos_patched
net/mlx5e: Move devlink port register and unregister calls
Register devlink ports upon NIC init. TX and RX health reporters handle errors which may occur early on at driver initialization. And because these reporters are to be moved to port context, they require devlink ports to be already registered. Signed-off-by: Vladyslav Tarasiuk <vladyslavt@mellanox.com> Reviewed-by: Moshe Shemesh <moshe@mellanox.com> Reviewed-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
15c724b997
commit
4d54d3251e
|
@ -5086,6 +5086,9 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
|
|||
if (err)
|
||||
mlx5_core_err(mdev, "TLS initialization failed, %d\n", err);
|
||||
mlx5e_build_nic_netdev(netdev);
|
||||
err = mlx5e_devlink_port_register(priv);
|
||||
if (err)
|
||||
mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err);
|
||||
mlx5e_health_create_reporters(priv);
|
||||
|
||||
return 0;
|
||||
|
@ -5094,6 +5097,7 @@ static int mlx5e_nic_init(struct mlx5_core_dev *mdev,
|
|||
static void mlx5e_nic_cleanup(struct mlx5e_priv *priv)
|
||||
{
|
||||
mlx5e_health_destroy_reporters(priv);
|
||||
mlx5e_devlink_port_unregister(priv);
|
||||
mlx5e_tls_cleanup(priv);
|
||||
mlx5e_ipsec_cleanup(priv);
|
||||
mlx5e_netdev_cleanup(priv->netdev, priv);
|
||||
|
@ -5526,16 +5530,10 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
|
|||
goto err_destroy_netdev;
|
||||
}
|
||||
|
||||
err = mlx5e_devlink_port_register(priv);
|
||||
if (err) {
|
||||
mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err);
|
||||
goto err_detach;
|
||||
}
|
||||
|
||||
err = register_netdev(netdev);
|
||||
if (err) {
|
||||
mlx5_core_err(mdev, "register_netdev failed, %d\n", err);
|
||||
goto err_devlink_port_unregister;
|
||||
goto err_detach;
|
||||
}
|
||||
|
||||
mlx5e_devlink_port_type_eth_set(priv);
|
||||
|
@ -5543,8 +5541,6 @@ static void *mlx5e_add(struct mlx5_core_dev *mdev)
|
|||
mlx5e_dcbnl_init_app(priv);
|
||||
return priv;
|
||||
|
||||
err_devlink_port_unregister:
|
||||
mlx5e_devlink_port_unregister(priv);
|
||||
err_detach:
|
||||
mlx5e_detach(mdev, priv);
|
||||
err_destroy_netdev:
|
||||
|
@ -5565,7 +5561,6 @@ static void mlx5e_remove(struct mlx5_core_dev *mdev, void *vpriv)
|
|||
priv = vpriv;
|
||||
mlx5e_dcbnl_delete_app(priv);
|
||||
unregister_netdev(priv->netdev);
|
||||
mlx5e_devlink_port_unregister(priv);
|
||||
mlx5e_detach(mdev, vpriv);
|
||||
mlx5e_destroy_netdev(priv);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user