Re: [PATCH 1/3] vhost_vdpa: tell vqs about the negotiated

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 22, 2023 at 3:57 AM Shannon Nelson <shannon.nelson@xxxxxxx> wrote:
>
> As is done in the net, iscsi, and vsock vhost support, let the vdpa vqs
> know about the features that have been negotiated.  This allows vhost
> to more safely make decisions based on the features, such as when using
> PACKED vs split queues.
>
> Signed-off-by: Shannon Nelson <shannon.nelson@xxxxxxx>

Acked-by: Jason Wang <jasowang@xxxxxxxxxx>

Thanks

> ---
>  drivers/vhost/vdpa.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c
> index 7be9d9d8f01c..599b8cc238c7 100644
> --- a/drivers/vhost/vdpa.c
> +++ b/drivers/vhost/vdpa.c
> @@ -385,7 +385,10 @@ static long vhost_vdpa_set_features(struct vhost_vdpa *v, u64 __user *featurep)
>  {
>         struct vdpa_device *vdpa = v->vdpa;
>         const struct vdpa_config_ops *ops = vdpa->config;
> +       struct vhost_dev *d = &v->vdev;
> +       u64 actual_features;
>         u64 features;
> +       int i;
>
>         /*
>          * It's not allowed to change the features after they have
> @@ -400,6 +403,16 @@ static long vhost_vdpa_set_features(struct vhost_vdpa *v, u64 __user *featurep)
>         if (vdpa_set_features(vdpa, features))
>                 return -EINVAL;
>
> +       /* let the vqs know what has been configured */
> +       actual_features = ops->get_driver_features(vdpa);
> +       for (i = 0; i < d->nvqs; ++i) {
> +               struct vhost_virtqueue *vq = d->vqs[i];
> +
> +               mutex_lock(&vq->mutex);
> +               vq->acked_features = actual_features;
> +               mutex_unlock(&vq->mutex);
> +       }
> +
>         return 0;
>  }
>
> --
> 2.17.1
>

_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linuxfoundation.org/mailman/listinfo/virtualization




[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux