From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKhdG-0000DQ-Dn for qemu-devel@nongnu.org; Thu, 30 Jul 2015 02:47:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZKhdB-0004eq-Aj for qemu-devel@nongnu.org; Thu, 30 Jul 2015 02:47:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZKhdB-0004eQ-34 for qemu-devel@nongnu.org; Thu, 30 Jul 2015 02:47:53 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id AF9F14C0AE for ; Thu, 30 Jul 2015 06:47:52 +0000 (UTC) Date: Thu, 30 Jul 2015 09:47:50 +0300 From: "Michael S. Tsirkin" Message-ID: <20150730094719-mutt-send-email-mst@redhat.com> References: <1438200409-27381-1-git-send-email-marcel@redhat.com> <1438200409-27381-3-git-send-email-marcel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1438200409-27381-3-git-send-email-marcel@redhat.com> Subject: Re: [Qemu-devel] [PATCH V2 2/2] tests/vhost-user: check vhost-user feature negotiation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum Cc: jasowang@redhat.com, famz@redhat.com, qemu-devel@nongnu.org On Wed, Jul 29, 2015 at 11:06:49PM +0300, Marcel Apfelbaum wrote: > Check the backend receives all declared virtio features > that are also supported by QEMU virtio. > > Signed-off-by: Marcel Apfelbaum > --- > 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 > +#include > #include > #include > #include > @@ -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; > No, this mixes protocol features and virtio features. It's not what was intended. > 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