[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 11/15] vhost-user: unit test for new messages
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL 11/15] vhost-user: unit test for new messages |
Date: |
Fri, 2 Oct 2015 16:45:43 +0300 |
Data is empty for now, but do make sure master
sets the new feature bit flag.
Signed-off-by: Michael S. Tsirkin <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
---
tests/vhost-user-test.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 0e04f06..87281b9 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -46,6 +46,8 @@
#define VHOST_MEMORY_MAX_NREGIONS 8
+#define VHOST_USER_F_PROTOCOL_FEATURES 30
+
typedef enum VhostUserRequest {
VHOST_USER_NONE = 0,
VHOST_USER_GET_FEATURES = 1,
@@ -62,6 +64,8 @@ typedef enum VhostUserRequest {
VHOST_USER_SET_VRING_KICK = 12,
VHOST_USER_SET_VRING_CALL = 13,
VHOST_USER_SET_VRING_ERR = 14,
+ VHOST_USER_GET_PROTOCOL_FEATURES = 15,
+ VHOST_USER_SET_PROTOCOL_FEATURES = 16,
VHOST_USER_MAX
} VhostUserRequest;
@@ -214,6 +218,20 @@ static void chr_read(void *opaque, const uint8_t *buf, int
size)
/* send back features to qemu */
msg.flags |= VHOST_USER_REPLY_MASK;
msg.size = sizeof(m.u64);
+ msg.u64 = 0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES;
+ p = (uint8_t *) &msg;
+ qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size);
+ break;
+
+ case VHOST_USER_SET_FEATURES:
+ g_assert_cmpint(msg.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES),
+ !=, 0ULL);
+ break;
+
+ case VHOST_USER_GET_PROTOCOL_FEATURES:
+ /* send back features to qemu */
+ msg.flags |= VHOST_USER_REPLY_MASK;
+ msg.size = sizeof(m.u64);
msg.u64 = 0;
p = (uint8_t *) &msg;
qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size);
--
MST
- [Qemu-devel] [PULL 00/15] virtio,pc features, fixes, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 01/15] virtio: introduce virtqueue_unmap_sg(), Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 06/15] exec: allocate PROT_NONE pages on top of RAM, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 08/15] virtio: Notice when the system doesn't support MSIx at all, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 11/15] vhost-user: unit test for new messages,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL 12/15] memhp: extend address auto assignment to support gaps, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 07/15] pc: Add a comment explaining why pc_compat_2_4() doesn't exist, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 03/15] virtio-net: correctly drop truncated packets, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 05/15] oslib: allocate PROT_NONE pages on top of RAM, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 10/15] vhost-user-test: do not reinvent glib-compat.h, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 13/15] pc: memhp: force gaps between DIMM's GPA, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 02/15] virtio: introduce virtqueue_discard(), Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 09/15] virtio-9p: migrate virtio subsections, Michael S. Tsirkin, 2015/10/08
- [Qemu-devel] [PULL 04/15] oslib: rework anonimous RAM allocation, Michael S. Tsirkin, 2015/10/08