Commit 07a2da40 authored by Dragos Tatulea's avatar Dragos Tatulea Committed by Michael S. Tsirkin

vdpa/mlx5: Rename mr destroy functions

Make mlx5_destroy_mr symmetric to mlx5_create_mr.
Acked-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarEugenio Pérez <eperezma@redhat.com>
Signed-off-by: default avatarDragos Tatulea <dtatulea@nvidia.com>
Message-Id: <20231018171456.1624030-11-dtatulea@nvidia.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarSi-Wei Liu <si-wei.liu@oracle.com>
Tested-by: default avatarSi-Wei Liu <si-wei.liu@oracle.com>
Tested-by: default avatarLei Yang <leiyang@redhat.com>
parent 1c06cd56
...@@ -118,8 +118,8 @@ int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *io ...@@ -118,8 +118,8 @@ int mlx5_vdpa_handle_set_map(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *io
bool *change_map, unsigned int asid); bool *change_map, unsigned int asid);
int mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb, int mlx5_vdpa_create_mr(struct mlx5_vdpa_dev *mvdev, struct vhost_iotlb *iotlb,
unsigned int asid); unsigned int asid);
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev); void mlx5_vdpa_destroy_mr_resources(struct mlx5_vdpa_dev *mvdev);
void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid); void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid);
int mlx5_vdpa_update_cvq_iotlb(struct mlx5_vdpa_dev *mvdev, int mlx5_vdpa_update_cvq_iotlb(struct mlx5_vdpa_dev *mvdev,
struct vhost_iotlb *iotlb, struct vhost_iotlb *iotlb,
unsigned int asid); unsigned int asid);
......
...@@ -507,7 +507,7 @@ static void _mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid ...@@ -507,7 +507,7 @@ static void _mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid
mr->initialized = false; mr->initialized = false;
} }
void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid) void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev, unsigned int asid)
{ {
struct mlx5_vdpa_mr *mr = &mvdev->mr; struct mlx5_vdpa_mr *mr = &mvdev->mr;
...@@ -518,9 +518,9 @@ void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid) ...@@ -518,9 +518,9 @@ void mlx5_vdpa_destroy_mr_asid(struct mlx5_vdpa_dev *mvdev, unsigned int asid)
mutex_unlock(&mr->mkey_mtx); mutex_unlock(&mr->mkey_mtx);
} }
void mlx5_vdpa_destroy_mr(struct mlx5_vdpa_dev *mvdev) void mlx5_vdpa_destroy_mr_resources(struct mlx5_vdpa_dev *mvdev)
{ {
mlx5_vdpa_destroy_mr_asid(mvdev, mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]); mlx5_vdpa_destroy_mr(mvdev, mvdev->group2asid[MLX5_VDPA_DATAVQ_GROUP]);
prune_iotlb(mvdev); prune_iotlb(mvdev);
} }
......
...@@ -2684,7 +2684,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, ...@@ -2684,7 +2684,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev,
goto err_mr; goto err_mr;
teardown_driver(ndev); teardown_driver(ndev);
mlx5_vdpa_destroy_mr_asid(mvdev, asid); mlx5_vdpa_destroy_mr(mvdev, asid);
err = mlx5_vdpa_create_mr(mvdev, iotlb, asid); err = mlx5_vdpa_create_mr(mvdev, iotlb, asid);
if (err) if (err)
goto err_mr; goto err_mr;
...@@ -2700,7 +2700,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev, ...@@ -2700,7 +2700,7 @@ static int mlx5_vdpa_change_map(struct mlx5_vdpa_dev *mvdev,
return 0; return 0;
err_setup: err_setup:
mlx5_vdpa_destroy_mr_asid(mvdev, asid); mlx5_vdpa_destroy_mr(mvdev, asid);
err_mr: err_mr:
return err; return err;
} }
...@@ -2841,7 +2841,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status) ...@@ -2841,7 +2841,7 @@ static void mlx5_vdpa_set_status(struct vdpa_device *vdev, u8 status)
err_driver: err_driver:
unregister_link_notifier(ndev); unregister_link_notifier(ndev);
err_setup: err_setup:
mlx5_vdpa_destroy_mr(&ndev->mvdev); mlx5_vdpa_destroy_mr_resources(&ndev->mvdev);
ndev->mvdev.status |= VIRTIO_CONFIG_S_FAILED; ndev->mvdev.status |= VIRTIO_CONFIG_S_FAILED;
err_clear: err_clear:
up_write(&ndev->reslock); up_write(&ndev->reslock);
...@@ -2868,7 +2868,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev) ...@@ -2868,7 +2868,7 @@ static int mlx5_vdpa_reset(struct vdpa_device *vdev)
unregister_link_notifier(ndev); unregister_link_notifier(ndev);
teardown_driver(ndev); teardown_driver(ndev);
clear_vqs_ready(ndev); clear_vqs_ready(ndev);
mlx5_vdpa_destroy_mr(&ndev->mvdev); mlx5_vdpa_destroy_mr_resources(&ndev->mvdev);
ndev->mvdev.status = 0; ndev->mvdev.status = 0;
ndev->mvdev.suspended = false; ndev->mvdev.suspended = false;
ndev->cur_num_vqs = 0; ndev->cur_num_vqs = 0;
...@@ -2988,7 +2988,7 @@ static void mlx5_vdpa_free(struct vdpa_device *vdev) ...@@ -2988,7 +2988,7 @@ static void mlx5_vdpa_free(struct vdpa_device *vdev)
ndev = to_mlx5_vdpa_ndev(mvdev); ndev = to_mlx5_vdpa_ndev(mvdev);
free_resources(ndev); free_resources(ndev);
mlx5_vdpa_destroy_mr(mvdev); mlx5_vdpa_destroy_mr_resources(mvdev);
if (!is_zero_ether_addr(ndev->config.mac)) { if (!is_zero_ether_addr(ndev->config.mac)) {
pfmdev = pci_get_drvdata(pci_physfn(mvdev->mdev->pdev)); pfmdev = pci_get_drvdata(pci_physfn(mvdev->mdev->pdev));
mlx5_mpfs_del_mac(pfmdev, ndev->config.mac); mlx5_mpfs_del_mac(pfmdev, ndev->config.mac);
...@@ -3518,7 +3518,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name, ...@@ -3518,7 +3518,7 @@ static int mlx5_vdpa_dev_add(struct vdpa_mgmt_dev *v_mdev, const char *name,
err_res2: err_res2:
free_resources(ndev); free_resources(ndev);
err_mr: err_mr:
mlx5_vdpa_destroy_mr(mvdev); mlx5_vdpa_destroy_mr_resources(mvdev);
err_res: err_res:
mlx5_vdpa_free_resources(&ndev->mvdev); mlx5_vdpa_free_resources(&ndev->mvdev);
err_mpfs: err_mpfs:
......
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