summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/mellanox/mlx4/main.c
diff options
context:
space:
mode:
authorMoshe Shemesh <moshe@nvidia.com>2022-07-28 18:53:46 +0300
committerJakub Kicinski <kuba@kernel.org>2022-07-29 07:58:46 +0300
commit9cb7e94a78b54f935de602f514313e73cc5b8a48 (patch)
tree1399d777b56f3046bc703adce6def8742a2b459b /drivers/net/ethernet/mellanox/mlx4/main.c
parent84a433a40d0ebf3bbf36b8bfa58c6f45dc782344 (diff)
downloadlinux-9cb7e94a78b54f935de602f514313e73cc5b8a48.tar.xz
net/mlx4: Use devl_ API for devlink region create / destroy
Use devl_ API to call devl_region_create() and devl_region_destroy() instead of devlink_region_create() and devlink_region_destroy(). Add devlink instance lock in mlx4 driver paths to these functions. This will be used by the downstream patch to invoke mlx4 devlink reload callbacks with devlink lock held. Signed-off-by: Moshe Shemesh <moshe@nvidia.com> Reviewed-by: Tariq Toukan <tariqt@nvidia.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/mellanox/mlx4/main.c')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/main.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
index b187c210d4d6..f3d13190b959 100644
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ b/drivers/net/ethernet/mellanox/mlx4/main.c
@@ -3732,6 +3732,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
int prb_vf[MLX4_MAX_PORTS + 1] = {0, 0, 0};
const int param_map[MLX4_MAX_PORTS + 1][MLX4_MAX_PORTS + 1] = {
{2, 0, 0}, {0, 1, 2}, {0, 1, 2} };
+ struct devlink *devlink = priv_to_devlink(priv);
unsigned total_vfs = 0;
unsigned int i;
@@ -3844,7 +3845,9 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
}
}
+ devl_lock(devlink);
err = mlx4_crdump_init(&priv->dev);
+ devl_unlock(devlink);
if (err)
goto err_release_regions;
@@ -3862,7 +3865,9 @@ err_catas:
mlx4_catas_end(&priv->dev);
err_crdump:
+ devl_lock(devlink);
mlx4_crdump_end(&priv->dev);
+ devl_unlock(devlink);
err_release_regions:
pci_release_regions(pdev);
@@ -4161,7 +4166,9 @@ static void mlx4_remove_one(struct pci_dev *pdev)
else
mlx4_info(dev, "%s: interface is down\n", __func__);
mlx4_catas_end(dev);
+ devl_lock(devlink);
mlx4_crdump_end(dev);
+ devl_unlock(devlink);
if (dev->flags & MLX4_FLAG_SRIOV && !active_vfs) {
mlx4_warn(dev, "Disabling SR-IOV\n");
pci_disable_sriov(pdev);