qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] vhost-vsock: SOCK_SEQPACKET feature bit support
@ 2021-06-22 14:47 Arseny Krasnov
  2021-06-22 14:54 ` Stefano Garzarella
  0 siblings, 1 reply; 2+ messages in thread
From: Arseny Krasnov @ 2021-06-22 14:47 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: sgarzare, arseny.krasnov, oxffffaa

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                       | 12 ++++++++++--
 include/standard-headers/linux/virtio_vsock.h |  3 +++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
index c8f0699b4f..e6339747b3 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -20,6 +20,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);
@@ -107,8 +112,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 = {
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;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] vhost-vsock: SOCK_SEQPACKET feature bit support
  2021-06-22 14:47 [PATCH v3] vhost-vsock: SOCK_SEQPACKET feature bit support Arseny Krasnov
@ 2021-06-22 14:54 ` Stefano Garzarella
  0 siblings, 0 replies; 2+ messages in thread
From: Stefano Garzarella @ 2021-06-22 14:54 UTC (permalink / raw)
  To: Arseny Krasnov; +Cc: qemu-devel, oxffffaa, Michael S. Tsirkin

On Tue, Jun 22, 2021 at 05:47:47PM +0300, 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                       | 12 ++++++++++--
> include/standard-headers/linux/virtio_vsock.h |  3 +++
> 2 files changed, 13 insertions(+), 2 deletions(-)
>
>diff --git a/hw/virtio/vhost-vsock.c b/hw/virtio/vhost-vsock.c
>index c8f0699b4f..e6339747b3 100644
>--- a/hw/virtio/vhost-vsock.c
>+++ b/hw/virtio/vhost-vsock.c
>@@ -20,6 +20,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);
>@@ -107,8 +112,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 = {
>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;
>-- 
>2.25.1
>

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-06-22 14:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 14:47 [PATCH v3] vhost-vsock: SOCK_SEQPACKET feature bit support Arseny Krasnov
2021-06-22 14:54 ` Stefano Garzarella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).