Skip to content

Commit 58d4d50

Browse files
dtatuleamstsirkin
authored andcommitted
vdpa/mlx5: Rename mr_mtx -> lock
Now that the mr resources have their own namespace in the struct, give the lock a clearer name. Signed-off-by: Dragos Tatulea <[email protected]> Reviewed-by: Cosmin Ratiu <[email protected]> Acked-by: Eugenio Pérez <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent 5fc8567 commit 58d4d50

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

drivers/vdpa/mlx5/core/mlx5_vdpa.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct mlx5_vdpa_mr_resources {
8787
struct mlx5_vdpa_mr *mr[MLX5_VDPA_NUM_AS];
8888
unsigned int group2asid[MLX5_VDPA_NUMVQ_GROUPS];
8989
struct list_head mr_list_head;
90-
struct mutex mr_mtx;
90+
struct mutex lock;
9191
};
9292

9393
struct mlx5_vdpa_dev {

drivers/vdpa/mlx5/core/mr.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -666,9 +666,9 @@ static void _mlx5_vdpa_put_mr(struct mlx5_vdpa_dev *mvdev,
666666
void mlx5_vdpa_put_mr(struct mlx5_vdpa_dev *mvdev,
667667
struct mlx5_vdpa_mr *mr)
668668
{
669-
mutex_lock(&mvdev->mres.mr_mtx);
669+
mutex_lock(&mvdev->mres.lock);
670670
_mlx5_vdpa_put_mr(mvdev, mr);
671-
mutex_unlock(&mvdev->mres.mr_mtx);
671+
mutex_unlock(&mvdev->mres.lock);
672672
}
673673

674674
static void _mlx5_vdpa_get_mr(struct mlx5_vdpa_dev *mvdev,
@@ -683,9 +683,9 @@ static void _mlx5_vdpa_get_mr(struct mlx5_vdpa_dev *mvdev,
683683
void mlx5_vdpa_get_mr(struct mlx5_vdpa_dev *mvdev,
684684
struct mlx5_vdpa_mr *mr)
685685
{
686-
mutex_lock(&mvdev->mres.mr_mtx);
686+
mutex_lock(&mvdev->mres.lock);
687687
_mlx5_vdpa_get_mr(mvdev, mr);
688-
mutex_unlock(&mvdev->mres.mr_mtx);
688+
mutex_unlock(&mvdev->mres.lock);
689689
}
690690

691691
void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,
@@ -694,19 +694,19 @@ void mlx5_vdpa_update_mr(struct mlx5_vdpa_dev *mvdev,
694694
{
695695
struct mlx5_vdpa_mr *old_mr = mvdev->mres.mr[asid];
696696

697-
mutex_lock(&mvdev->mres.mr_mtx);
697+
mutex_lock(&mvdev->mres.lock);
698698

699699
_mlx5_vdpa_put_mr(mvdev, old_mr);
700700
mvdev->mres.mr[asid] = new_mr;
701701

702-
mutex_unlock(&mvdev->mres.mr_mtx);
702+
mutex_unlock(&mvdev->mres.lock);
703703
}
704704

705705
static void mlx5_vdpa_show_mr_leaks(struct mlx5_vdpa_dev *mvdev)
706706
{
707707
struct mlx5_vdpa_mr *mr;
708708

709-
mutex_lock(&mvdev->mres.mr_mtx);
709+
mutex_lock(&mvdev->mres.lock);
710710

711711
list_for_each_entry(mr, &mvdev->mres.mr_list_head, mr_list) {
712712

@@ -715,7 +715,7 @@ static void mlx5_vdpa_show_mr_leaks(struct mlx5_vdpa_dev *mvdev)
715715
mr, mr->mkey, refcount_read(&mr->refcount));
716716
}
717717

718-
mutex_unlock(&mvdev->mres.mr_mtx);
718+
mutex_unlock(&mvdev->mres.lock);
719719

720720
}
721721

@@ -782,9 +782,9 @@ struct mlx5_vdpa_mr *mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev,
782782
if (!mr)
783783
return ERR_PTR(-ENOMEM);
784784

785-
mutex_lock(&mvdev->mres.mr_mtx);
785+
mutex_lock(&mvdev->mres.lock);
786786
err = _mlx5_vdpa_create_mr(mvdev, mr, iotlb);
787-
mutex_unlock(&mvdev->mres.mr_mtx);
787+
mutex_unlock(&mvdev->mres.lock);
788788

789789
if (err)
790790
goto out_err;

drivers/vdpa/mlx5/core/resources.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ int mlx5_vdpa_alloc_resources(struct mlx5_vdpa_dev *mvdev)
256256
mlx5_vdpa_warn(mvdev, "resources already allocated\n");
257257
return -EINVAL;
258258
}
259-
mutex_init(&mvdev->mres.mr_mtx);
259+
mutex_init(&mvdev->mres.lock);
260260
res->uar = mlx5_get_uars_page(mdev);
261261
if (IS_ERR(res->uar)) {
262262
err = PTR_ERR(res->uar);
@@ -301,7 +301,7 @@ int mlx5_vdpa_alloc_resources(struct mlx5_vdpa_dev *mvdev)
301301
err_uctx:
302302
mlx5_put_uars_page(mdev, res->uar);
303303
err_uars:
304-
mutex_destroy(&mvdev->mres.mr_mtx);
304+
mutex_destroy(&mvdev->mres.lock);
305305
return err;
306306
}
307307

@@ -318,7 +318,7 @@ void mlx5_vdpa_free_resources(struct mlx5_vdpa_dev *mvdev)
318318
dealloc_pd(mvdev, res->pdn, res->uid);
319319
destroy_uctx(mvdev, res->uid);
320320
mlx5_put_uars_page(mvdev->mdev, res->uar);
321-
mutex_destroy(&mvdev->mres.mr_mtx);
321+
mutex_destroy(&mvdev->mres.lock);
322322
res->valid = false;
323323
}
324324

drivers/vdpa/mlx5/net/mlx5_vnet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3639,10 +3639,10 @@ static int mlx5_set_group_asid(struct vdpa_device *vdev, u32 group,
36393639

36403640
mvdev->mres.group2asid[group] = asid;
36413641

3642-
mutex_lock(&mvdev->mres.mr_mtx);
3642+
mutex_lock(&mvdev->mres.lock);
36433643
if (group == MLX5_VDPA_CVQ_GROUP && mvdev->mres.mr[asid])
36443644
err = mlx5_vdpa_update_cvq_iotlb(mvdev, mvdev->mres.mr[asid]->iotlb, asid);
3645-
mutex_unlock(&mvdev->mres.mr_mtx);
3645+
mutex_unlock(&mvdev->mres.lock);
36463646

36473647
return err;
36483648
}

0 commit comments

Comments
 (0)