All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arseny Krasnov <arseny.krasnov@kaspersky.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "sgarzare@redhat.com" <sgarzare@redhat.com>,
	"oxffffaa@gmail.com" <oxffffaa@gmail.com>
Subject: Re: [RFC PATCH v1] vhost-vsock: SOCK_SEQPACKET feature bit support
Date: Mon, 21 Jun 2021 17:08:26 +0300	[thread overview]
Message-ID: <43c967ce-0029-3399-1cde-9d57cc35481a@kaspersky.com> (raw)
In-Reply-To: <20210621140741.2628913-1-arseny.krasnov@kaspersky.com>

SOCK_SEQPACKET support for Linux already merged to net-next.
SOCK_SEQPACKET support for spec is here:
https://lists.oasis-open.org/archives/virtio-comment/202105/msg00017.html

On 21.06.2021 17:07, Arseny Krasnov wrote:
> This adds processing of VIRTIO_VSOCK_F_SEQPACKET features bit. Guest
> negotiates it with vhost, thus both will know that SOCK_SEQPACKET
> supported by peer.
>
> Signed-off-by: Arseny Krasnov <arseny.krasnov@kaspersky.com>
> ---
>  hw/virtio/vhost-vsock.c                       | 16 +++++++++++++++-
>  include/standard-headers/linux/virtio_vsock.h |  3 +++
>  2 files changed, 18 insertions(+), 1 deletion(-)
>
> diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
> index 8ddfb9abfe..fc8c143df9 100644
> --- a/hw/virtio/vhost-vsock.c
> +++ b/hw/virtio/vhost-vsock.c
> @@ -108,10 +108,23 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
>                                           uint64_t requested_features,
>                                           Error **errp)
>  {
> -    /* No feature bits used yet */
> +    VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
> +
> +    if (virtio_has_feature(vvc->vhost_dev.features, VIRTIO_VSOCK_F_SEQPACKET)) {
> +        virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
> +    }
> +
>      return requested_features;
>  }
>  
> +static void vhost_vsock_set_features(VirtIODevice *vdev, uint64_t features)
> +{
> +    VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);
> +    const VhostOps *vhost_ops = vvc->vhost_dev.vhost_ops;
> +
> +    vhost_ops->vhost_set_features(&vvc->vhost_dev, features);
> +}
> +
>  static const VMStateDescription vmstate_virtio_vhost_vsock = {
>      .name = "virtio-vhost_vsock",
>      .minimum_version_id = VHOST_VSOCK_SAVEVM_VERSION,
> @@ -224,6 +237,7 @@ static void vhost_vsock_class_init(ObjectClass *klass, void *data)
>      vdc->realize = vhost_vsock_device_realize;
>      vdc->unrealize = vhost_vsock_device_unrealize;
>      vdc->get_features = vhost_vsock_get_features;
> +    vdc->set_features = vhost_vsock_set_features;
>      vdc->get_config = vhost_vsock_get_config;
>      vdc->set_status = vhost_vsock_set_status;
>  }
> diff --git a/include/standard-headers/linux/virtio_vsock.h b/include/standard-headers/linux/virtio_vsock.h
> index be443211ce..5eac522ee2 100644
> --- a/include/standard-headers/linux/virtio_vsock.h
> +++ b/include/standard-headers/linux/virtio_vsock.h
> @@ -38,6 +38,9 @@
>  #include "standard-headers/linux/virtio_ids.h"
>  #include "standard-headers/linux/virtio_config.h"
>  
> +/* The feature bitmap for virtio vsock */
> +#define VIRTIO_VSOCK_F_SEQPACKET       1       /* SOCK_SEQPACKET supported */
> +
>  struct virtio_vsock_config {
>  	uint64_t guest_cid;
>  } QEMU_PACKED;


  reply	other threads:[~2021-06-21 14:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-21 14:07 [RFC PATCH v1] vhost-vsock: SOCK_SEQPACKET feature bit support Arseny Krasnov
2021-06-21 14:08 ` Arseny Krasnov [this message]
2021-06-22  8:24 ` Stefano Garzarella
2021-06-22 12:17   ` Arseny Krasnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43c967ce-0029-3399-1cde-9d57cc35481a@kaspersky.com \
    --to=arseny.krasnov@kaspersky.com \
    --cc=mst@redhat.com \
    --cc=oxffffaa@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.