Re: [PATCH RFC 1/3] vdpa/mlx5: Implement susupend virtqueue callback

From: Eugenio Perez Martin
Date: Mon Jun 20 2022 - 06:08:01 EST


> +static int mlx5_vdpa_suspend(struct vdpa_device *vdev, bool suspend)
> +{
> + struct mlx5_vdpa_dev *mvdev = to_mvdev(vdev);
> + struct mlx5_vdpa_net *ndev = to_mlx5_vdpa_ndev(mvdev);
> + struct mlx5_vdpa_virtqueue *mvq;
> + int i;
> +
> + if (!suspend) {
> + mlx5_vdpa_warn(mvdev, "Resume of virtqueues is not supported\n");

If the resume part it's a problem, maybe we can split the vdpa_sim
series so it only adds a callback to suspend() the device. If needed,
we can add a resume() later. suspend is the only operation we need to
perform LM.

Thoughts on this?

Thanks!

> + return -EOPNOTSUPP;
> + }
> +
> + down_write(&ndev->reslock);
> + for (i = 0; i < ndev->cur_num_vqs; i++) {
> + mvq = &ndev->vqs[i];
> + suspend_vq(ndev, mvq);
> + }
> + mlx5_vdpa_cvq_suspend(mvdev, suspend);
> + up_write(&ndev->reslock);
> + return 0;
> +}
> +