Skip to content

Commit 9cb7e94

Browse files
mosheshemesh2kuba-moo
authored andcommitted
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 <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Reviewed-by: Jiri Pirko <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 84a433a commit 9cb7e94

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

drivers/net/ethernet/mellanox/mlx4/crdump.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,21 +226,21 @@ int mlx4_crdump_init(struct mlx4_dev *dev)
226226

227227
/* Create cr-space region */
228228
crdump->region_crspace =
229-
devlink_region_create(devlink,
230-
&region_cr_space_ops,
231-
MAX_NUM_OF_DUMPS_TO_STORE,
232-
pci_resource_len(pdev, 0));
229+
devl_region_create(devlink,
230+
&region_cr_space_ops,
231+
MAX_NUM_OF_DUMPS_TO_STORE,
232+
pci_resource_len(pdev, 0));
233233
if (IS_ERR(crdump->region_crspace))
234234
mlx4_warn(dev, "crdump: create devlink region %s err %ld\n",
235235
region_cr_space_str,
236236
PTR_ERR(crdump->region_crspace));
237237

238238
/* Create fw-health region */
239239
crdump->region_fw_health =
240-
devlink_region_create(devlink,
241-
&region_fw_health_ops,
242-
MAX_NUM_OF_DUMPS_TO_STORE,
243-
HEALTH_BUFFER_SIZE);
240+
devl_region_create(devlink,
241+
&region_fw_health_ops,
242+
MAX_NUM_OF_DUMPS_TO_STORE,
243+
HEALTH_BUFFER_SIZE);
244244
if (IS_ERR(crdump->region_fw_health))
245245
mlx4_warn(dev, "crdump: create devlink region %s err %ld\n",
246246
region_fw_health_str,
@@ -253,6 +253,6 @@ void mlx4_crdump_end(struct mlx4_dev *dev)
253253
{
254254
struct mlx4_fw_crdump *crdump = &dev->persist->crdump;
255255

256-
devlink_region_destroy(crdump->region_fw_health);
257-
devlink_region_destroy(crdump->region_crspace);
256+
devl_region_destroy(crdump->region_fw_health);
257+
devl_region_destroy(crdump->region_crspace);
258258
}

drivers/net/ethernet/mellanox/mlx4/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,6 +3732,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
37323732
int prb_vf[MLX4_MAX_PORTS + 1] = {0, 0, 0};
37333733
const int param_map[MLX4_MAX_PORTS + 1][MLX4_MAX_PORTS + 1] = {
37343734
{2, 0, 0}, {0, 1, 2}, {0, 1, 2} };
3735+
struct devlink *devlink = priv_to_devlink(priv);
37353736
unsigned total_vfs = 0;
37363737
unsigned int i;
37373738

@@ -3844,7 +3845,9 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
38443845
}
38453846
}
38463847

3848+
devl_lock(devlink);
38473849
err = mlx4_crdump_init(&priv->dev);
3850+
devl_unlock(devlink);
38483851
if (err)
38493852
goto err_release_regions;
38503853

@@ -3862,7 +3865,9 @@ static int __mlx4_init_one(struct pci_dev *pdev, int pci_dev_data,
38623865
mlx4_catas_end(&priv->dev);
38633866

38643867
err_crdump:
3868+
devl_lock(devlink);
38653869
mlx4_crdump_end(&priv->dev);
3870+
devl_unlock(devlink);
38663871

38673872
err_release_regions:
38683873
pci_release_regions(pdev);
@@ -4161,7 +4166,9 @@ static void mlx4_remove_one(struct pci_dev *pdev)
41614166
else
41624167
mlx4_info(dev, "%s: interface is down\n", __func__);
41634168
mlx4_catas_end(dev);
4169+
devl_lock(devlink);
41644170
mlx4_crdump_end(dev);
4171+
devl_unlock(devlink);
41654172
if (dev->flags & MLX4_FLAG_SRIOV && !active_vfs) {
41664173
mlx4_warn(dev, "Disabling SR-IOV\n");
41674174
pci_disable_sriov(pdev);

0 commit comments

Comments
 (0)