Skip to content

Commit

Permalink
vhost-vsock: SOCK_SEQPACKET feature bit support
Browse files Browse the repository at this point in the history
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>
Message-Id: <20210622144747.2949134-1-arseny.krasnov@kaspersky.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
Arseny Krasnov authored and mstsirkin committed Jul 16, 2021
1 parent 98103e8 commit 0c0d224
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions hw/virtio/vhost-vsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
#include "hw/virtio/vhost-vsock.h"
#include "monitor/monitor.h"

const int feature_bits[] = {
VIRTIO_VSOCK_F_SEQPACKET,
VHOST_INVALID_FEATURE_BIT
};

static void vhost_vsock_get_config(VirtIODevice *vdev, uint8_t *config)
{
VHostVSock *vsock = VHOST_VSOCK(vdev);
Expand Down Expand Up @@ -108,8 +113,11 @@ static uint64_t vhost_vsock_get_features(VirtIODevice *vdev,
uint64_t requested_features,
Error **errp)
{
/* No feature bits used yet */
return requested_features;
VHostVSockCommon *vvc = VHOST_VSOCK_COMMON(vdev);

virtio_add_feature(&requested_features, VIRTIO_VSOCK_F_SEQPACKET);
return vhost_get_features(&vvc->vhost_dev, feature_bits,
requested_features);
}

static const VMStateDescription vmstate_virtio_vhost_vsock = {
Expand Down

0 comments on commit 0c0d224

Please sign in to comment.