[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 01/24] vhost-user: unit test for new messages
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH v6 01/24] vhost-user: unit test for new messages |
Date: |
Tue, 29 Sep 2015 18:34:31 +0200 |
From: "Michael S. Tsirkin" <address@hidden>
Data is empty for now, but do make sure master
sets the new feature bit flag.
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
tests/vhost-user-test.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index e301db7..77b7b68 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -53,6 +53,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,
@@ -69,6 +71,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;
@@ -293,11 +297,26 @@ 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);
break;
+
case VHOST_USER_GET_VRING_BASE:
/* send back vring base to qemu */
msg.flags |= VHOST_USER_REPLY_MASK;
--
2.4.3
- [Qemu-devel] [PATCH v6 15/24] net: add trace_vhost_user_event, (continued)
- [Qemu-devel] [PATCH v6 16/24] vhost user: add support of live migration, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 23/24] vhost-user-test: check ownership during migration, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 22/24] vhost-user-test: add live-migration test, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 24/24] vhost-user: use an enum helper for features mask, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 01/24] vhost-user: unit test for new messages,
marcandre . lureau <=
- [Qemu-devel] [PATCH v6 04/24] util: add linux-only memfd fallback, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 07/24] vhost: document log resizing, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 12/24] vhost-user: add a migration blocker, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 03/24] linux-headers: add unistd.h, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 17/24] vhost user: add rarp sending after live migration for legacy guest, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 20/24] vhost-user-test: wrap server in TestServer struct, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 02/24] configure: probe for memfd, marcandre . lureau, 2015/10/08
- [Qemu-devel] [PATCH v6 05/24] util: add memfd helpers, marcandre . lureau, 2015/10/08