Received: from eggs.gnu.org ([2001:4830:134:3::10]:50117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmzVR-00025n-Tu for qemu-devel@nongnu.org; Fri, 16 Oct 2015 03:32:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmzVM-0001Wm-Up for qemu-devel@nongnu.org; Fri, 16 Oct 2015 03:32:49 -0400 Received: from mga11.intel.com ([192.55.52.93]:28115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmzVM-0001We-Pg for qemu-devel@nongnu.org; Fri, 16 Oct 2015 03:32:44 -0400 Date: Fri, 16 Oct 2015 15:33:32 +0800 From: Yuanhan Liu Message-ID: <20151016073332.GB12777@yliu-dev.sh.intel.com> References: <1444979941-8486-1-git-send-email-yuanhan.liu@linux.intel.com> <1444979941-8486-3-git-send-email-yuanhan.liu@linux.intel.com> <20151016101945-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151016101945-mutt-send-email-mst@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/3] vhost-user-test: add multiple queue test List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Jason Wang , qemu-devel@nongnu.org On Fri, Oct 16, 2015 at 10:20:08AM +0300, Michael S. Tsirkin wrote: > On Fri, Oct 16, 2015 at 03:19:01PM +0800, Yuanhan Liu wrote: > > Setting VHOST_USER_PROTOCOL_F_MQ protocol feature bit to claim that we > > support MQ feature, and simply assume we support 2 queue pairs at most. > > Well - let's add a macro, or something? Yeah, a macro is better. --yliu > > > > > Cc: Michael S. Tsirkin > > Cc: Jason Wang > > Signed-off-by: Yuanhan Liu > > --- > > tests/vhost-user-test.c | 18 ++++++++++++++++-- > > 1 file changed, 16 insertions(+), 2 deletions(-) > > > > diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c > > index f181391..f0aa36f 100644 > > --- a/tests/vhost-user-test.c > > +++ b/tests/vhost-user-test.c > > @@ -33,7 +33,7 @@ > > #define QEMU_CMD_MEM " -m 512 -object memory-backend-file,id=mem,size=512M,"\ > > "mem-path=%s,share=on -numa node,memdev=mem" > > #define QEMU_CMD_CHR " -chardev socket,id=chr0,path=%s" > > -#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=chr0,vhostforce" > > +#define QEMU_CMD_NETDEV " -netdev vhost-user,id=net0,chardev=chr0,vhostforce,queues=2" > > #define QEMU_CMD_NET " -device virtio-net-pci,netdev=net0 " > > #define QEMU_CMD_ROM " -option-rom ../pc-bios/pxe-virtio.rom" > > > > @@ -48,6 +48,8 @@ > > > > #define VHOST_USER_F_PROTOCOL_FEATURES 30 > > > > +#define VHOST_USER_PROTOCOL_F_MQ 0 > > + > > typedef enum VhostUserRequest { > > VHOST_USER_NONE = 0, > > VHOST_USER_GET_FEATURES = 1, > > @@ -66,6 +68,8 @@ typedef enum VhostUserRequest { > > VHOST_USER_SET_VRING_ERR = 14, > > VHOST_USER_GET_PROTOCOL_FEATURES = 15, > > VHOST_USER_SET_PROTOCOL_FEATURES = 16, > > + VHOST_USER_GET_QUEUE_NUM = 17, > > + VHOST_USER_SET_VRING_ENABLE = 18, > > VHOST_USER_MAX > > } VhostUserRequest; > > > > @@ -232,7 +236,7 @@ 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 = 0; > > + msg.u64 = (1ULL << VHOST_USER_PROTOCOL_F_MQ); > > p = (uint8_t *) &msg; > > qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); > > break; > > @@ -266,6 +270,16 @@ static void chr_read(void *opaque, const uint8_t *buf, int size) > > */ > > qemu_set_nonblock(fd); > > break; > > + > > + case VHOST_USER_GET_QUEUE_NUM: > > + /* send back the number of queues we support (let it be 2) to qemu */ > > + msg.flags |= VHOST_USER_REPLY_MASK; > > + msg.size = sizeof(m.u64); > > + msg.u64 = 2; > > + p = (uint8_t *) &msg; > > + qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size); > > + break; > > + > > default: > > break; > > } > > -- > > 1.9.0