From: Marcel Apfelbaum <marcel@redhat.com>
To: qemu-devel@nongnu.org
Cc: marcel@redhat.com, jasowang@redhat.com, famz@redhat.com,
n.nikolaev@virtualopensystems.com, mst@redhat.com
Subject: [Qemu-devel] [PATCH V3 3/3] tests/vhost-user: check vhost-user feature negotiation
Date: Fri, 31 Jul 2015 19:38:20 +0300 [thread overview]
Message-ID: <1438360700-18289-4-git-send-email-marcel@redhat.com> (raw)
In-Reply-To: <1438360700-18289-1-git-send-email-marcel@redhat.com>
Check the backend receives all declared virtio features
that are also supported by QEMU virtio.
Signed-off-by: Marcel Apfelbaum <marcel@redhat.com>
---
tests/vhost-user-test.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index 228acb6..019b880 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -17,6 +17,7 @@
#include "sysemu/sysemu.h"
#include <linux/vhost.h>
+#include <linux/virtio_net.h>
#include <sys/mman.h>
#include <sys/vfs.h>
#include <qemu/sockets.h>
@@ -297,14 +298,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;
+ msg.u64 = (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES) |
+ (0x1ULL << VIRTIO_F_ANY_LAYOUT) |
+ (0x1ULL << VIRTIO_F_VERSION_1) |
+ (0x1ULL << VIRTIO_NET_F_MRG_RXBUF) |
+ (0x1ULL << VIRTIO_NET_F_MQ);
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);
+ g_assert_cmpint(msg.u64 & (0x1ULL << VHOST_USER_F_PROTOCOL_FEATURES),
+ !=, 0ULL);
+ g_assert_cmpint(msg.u64 & (0x1ULL << VIRTIO_F_ANY_LAYOUT),
+ !=, 0ULL);
+ g_assert_cmpint(msg.u64 & (0x1ULL << VIRTIO_F_VERSION_1),
+ !=, 0ULL);
+ g_assert_cmpint(msg.u64 & (0x1ULL << VIRTIO_NET_F_MRG_RXBUF),
+ !=, 0ULL);
+ g_assert_cmpint(msg.u64 & (0x1ULL << VIRTIO_NET_F_MQ),
+ !=, 0ULL);
break;
case VHOST_USER_GET_PROTOCOL_FEATURES:
--
2.1.0
prev parent reply other threads:[~2015-07-31 16:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 16:38 [Qemu-devel] [PATCH V3 0/3] vhost-user: sync backend Marcel Apfelbaum
2015-07-31 16:38 ` [Qemu-devel] [PATCH V3 1/3] hw/vhost-user: remove unnecessary virtio control bits Marcel Apfelbaum
2015-08-05 11:37 ` Marcel Apfelbaum
2015-07-31 16:38 ` [Qemu-devel] [PATCH V3 2/3] hw/vhost-user: sync backend features Marcel Apfelbaum
2015-07-31 16:38 ` Marcel Apfelbaum [this message]
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=1438360700-18289-4-git-send-email-marcel@redhat.com \
--to=marcel@redhat.com \
--cc=famz@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=n.nikolaev@virtualopensystems.com \
--cc=qemu-devel@nongnu.org \
/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).