* [PATCH v2] vhost-vsock: SOCK_SEQPACKET feature bit support
@ 2021-06-22 12:16 Arseny Krasnov
2021-06-22 14:41 ` Stefano Garzarella
0 siblings, 1 reply; 3+ messages in thread
From: Arseny Krasnov @ 2021-06-22 12:16 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..0406a5d3dc 100644
--- a/hw/virtio/vhost-vsock.c
+++ b/hw/virtio/vhost-vsock.c
@@ -103,12 +103,20 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
}
}
+const int feature_bits[] = {
+ VIRTIO_VSOCK_F_SEQPACKET,
+ VHOST_INVALID_FEATURE_BIT
+};
+
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] 3+ messages in thread
* Re: [PATCH v2] vhost-vsock: SOCK_SEQPACKET feature bit support
2021-06-22 12:16 [PATCH v2] vhost-vsock: SOCK_SEQPACKET feature bit support Arseny Krasnov
@ 2021-06-22 14:41 ` Stefano Garzarella
2021-06-22 14:48 ` Arseny Krasnov
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Garzarella @ 2021-06-22 14:41 UTC (permalink / raw)
To: Arseny Krasnov; +Cc: qemu-devel, oxffffaa, Michael S. Tsirkin
On Tue, Jun 22, 2021 at 03:16:31PM +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..0406a5d3dc 100644
>--- a/hw/virtio/vhost-vsock.c
>+++ b/hw/virtio/vhost-vsock.c
>@@ -103,12 +103,20 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
> }
> }
>
If you have to resend, better move this to the beginning of the file,
right after the includes.
>+const int feature_bits[] = {
>+ VIRTIO_VSOCK_F_SEQPACKET,
>+ VHOST_INVALID_FEATURE_BIT
>+};
>+
> 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
>
LGTM:
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] vhost-vsock: SOCK_SEQPACKET feature bit support
2021-06-22 14:41 ` Stefano Garzarella
@ 2021-06-22 14:48 ` Arseny Krasnov
0 siblings, 0 replies; 3+ messages in thread
From: Arseny Krasnov @ 2021-06-22 14:48 UTC (permalink / raw)
To: Stefano Garzarella; +Cc: Michael S. Tsirkin, qemu-devel, oxffffaa
On 22.06.2021 17:41, Stefano Garzarella wrote:
> On Tue, Jun 22, 2021 at 03:16:31PM +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..0406a5d3dc 100644
>> --- a/hw/virtio/vhost-vsock.c
>> +++ b/hw/virtio/vhost-vsock.c
>> @@ -103,12 +103,20 @@ static void vhost_vsock_set_status(VirtIODevice *vdev, uint8_t status)
>> }
>> }
>>
> If you have to resend, better move this to the beginning of the file,
> right after the includes.
Done
>> +const int feature_bits[] = {
>> + VIRTIO_VSOCK_F_SEQPACKET,
>> + VHOST_INVALID_FEATURE_BIT
>> +};
>> +
>> 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
>>
> LGTM:
>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-06-22 14:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 12:16 [PATCH v2] vhost-vsock: SOCK_SEQPACKET feature bit support Arseny Krasnov
2021-06-22 14:41 ` Stefano Garzarella
2021-06-22 14:48 ` Arseny Krasnov
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).