From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
haifeng.lin@huawei.com, thibaut.collet@6wind.com,
Nikolay Nikolaev <n.nikolaev@virtualopensystems.com>,
Gonglei <arei.gonglei@huawei.com>,
marcandre.lureau@gmail.com, Stefan Hajnoczi <stefanha@redhat.com>,
fbl@redhat.com, changchun.ouyang@intel.com
Subject: [Qemu-devel] [PATCH 4/4] vhost-user: unit test for new messages
Date: Fri, 17 Jul 2015 17:09:41 +0300 [thread overview]
Message-ID: <1437142095-20217-5-git-send-email-mst@redhat.com> (raw)
In-Reply-To: <1437142095-20217-1-git-send-email-mst@redhat.com>
Data is empty for now, but do make sure master
sets the new feature bit flag.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
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 75fedf0..228acb6 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;
--
MST
next prev parent reply other threads:[~2015-07-17 14:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-17 14:09 [Qemu-devel] [PATCH 0/4] vhost-user: protocol updates Michael S. Tsirkin
2015-07-17 14:09 ` [Qemu-devel] [PATCH 1/4] Revert "vhost-user: add multi queue support" Michael S. Tsirkin
2015-07-17 14:16 ` [Qemu-devel] [PATCH for-2.4 " Eric Blake
2015-07-17 14:09 ` [Qemu-devel] [PATCH 2/4] vhost-user: refactor ioctl translation Michael S. Tsirkin
2015-07-17 14:09 ` [Qemu-devel] [PATCH 3/4] vhost-user: add protocol feature negotiation Michael S. Tsirkin
2015-07-17 18:14 ` Flavio Leitner
2015-07-22 17:53 ` Marc-André Lureau
2015-07-17 14:09 ` Michael S. Tsirkin [this message]
2015-07-23 7:14 ` [Qemu-devel] [PATCH 4/4] vhost-user: unit test for new messages Ouyang, Changchun
2015-07-17 16:05 ` [Qemu-devel] [PATCH 0/4] vhost-user: protocol updates Maxime Leroy
2015-07-17 18:15 ` Flavio Leitner
2015-07-24 15:30 ` Thibaut Collet
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1437142095-20217-5-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=changchun.ouyang@intel.com \
--cc=fbl@redhat.com \
--cc=haifeng.lin@huawei.com \
--cc=marcandre.lureau@gmail.com \
--cc=n.nikolaev@virtualopensystems.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
--cc=thibaut.collet@6wind.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).