Commit 6d6e71e6 authored by Jiri Pirko's avatar Jiri Pirko Committed by Saeed Mahameed

net/mlx5e: Move devlink port registration to be done before netdev alloc

Move the devlink port registration to be done right after devlink
instance registration.
Signed-off-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
parent c30f3faa
...@@ -5903,12 +5903,19 @@ static int mlx5e_probe(struct auxiliary_device *adev, ...@@ -5903,12 +5903,19 @@ static int mlx5e_probe(struct auxiliary_device *adev,
return PTR_ERR(mlx5e_dev); return PTR_ERR(mlx5e_dev);
auxiliary_set_drvdata(adev, mlx5e_dev); auxiliary_set_drvdata(adev, mlx5e_dev);
err = mlx5e_devlink_port_register(mlx5e_dev, mdev);
if (err) {
mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err);
goto err_devlink_unregister;
}
netdev = mlx5e_create_netdev(mdev, profile); netdev = mlx5e_create_netdev(mdev, profile);
if (!netdev) { if (!netdev) {
mlx5_core_err(mdev, "mlx5e_create_netdev failed\n"); mlx5_core_err(mdev, "mlx5e_create_netdev failed\n");
err = -ENOMEM; err = -ENOMEM;
goto err_devlink_unregister; goto err_devlink_port_unregister;
} }
SET_NETDEV_DEVLINK_PORT(netdev, &mlx5e_dev->dl_port);
mlx5e_build_nic_netdev(netdev); mlx5e_build_nic_netdev(netdev);
...@@ -5921,17 +5928,10 @@ static int mlx5e_probe(struct auxiliary_device *adev, ...@@ -5921,17 +5928,10 @@ static int mlx5e_probe(struct auxiliary_device *adev,
priv->dfs_root = debugfs_create_dir("nic", priv->dfs_root = debugfs_create_dir("nic",
mlx5_debugfs_get_dev_root(priv->mdev)); mlx5_debugfs_get_dev_root(priv->mdev));
err = mlx5e_devlink_port_register(mlx5e_dev, mdev);
if (err) {
mlx5_core_err(mdev, "mlx5e_devlink_port_register failed, %d\n", err);
goto err_destroy_netdev;
}
SET_NETDEV_DEVLINK_PORT(netdev, &mlx5e_dev->dl_port);
err = profile->init(mdev, netdev); err = profile->init(mdev, netdev);
if (err) { if (err) {
mlx5_core_err(mdev, "mlx5e_nic_profile init failed, %d\n", err); mlx5_core_err(mdev, "mlx5e_nic_profile init failed, %d\n", err);
goto err_devlink_cleanup; goto err_destroy_netdev;
} }
err = mlx5e_resume(adev); err = mlx5e_resume(adev);
...@@ -5955,11 +5955,11 @@ static int mlx5e_probe(struct auxiliary_device *adev, ...@@ -5955,11 +5955,11 @@ static int mlx5e_probe(struct auxiliary_device *adev,
mlx5e_suspend(adev, state); mlx5e_suspend(adev, state);
err_profile_cleanup: err_profile_cleanup:
profile->cleanup(priv); profile->cleanup(priv);
err_devlink_cleanup:
mlx5e_devlink_port_unregister(mlx5e_dev);
err_destroy_netdev: err_destroy_netdev:
debugfs_remove_recursive(priv->dfs_root); debugfs_remove_recursive(priv->dfs_root);
mlx5e_destroy_netdev(priv); mlx5e_destroy_netdev(priv);
err_devlink_port_unregister:
mlx5e_devlink_port_unregister(mlx5e_dev);
err_devlink_unregister: err_devlink_unregister:
mlx5e_destroy_devlink(mlx5e_dev); mlx5e_destroy_devlink(mlx5e_dev);
return err; return err;
...@@ -5976,9 +5976,9 @@ static void mlx5e_remove(struct auxiliary_device *adev) ...@@ -5976,9 +5976,9 @@ static void mlx5e_remove(struct auxiliary_device *adev)
unregister_netdev(priv->netdev); unregister_netdev(priv->netdev);
mlx5e_suspend(adev, state); mlx5e_suspend(adev, state);
priv->profile->cleanup(priv); priv->profile->cleanup(priv);
mlx5e_devlink_port_unregister(mlx5e_dev);
debugfs_remove_recursive(priv->dfs_root); debugfs_remove_recursive(priv->dfs_root);
mlx5e_destroy_netdev(priv); mlx5e_destroy_netdev(priv);
mlx5e_devlink_port_unregister(mlx5e_dev);
mlx5e_destroy_devlink(mlx5e_dev); mlx5e_destroy_devlink(mlx5e_dev);
} }
......
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