All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
To: qemu-devel@nongnu.org
Cc: Yuanhan Liu <yuanhan.liu@linux.intel.com>,
	Jason Wang <jasowang@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: [Qemu-devel] [PATCH v2 3/5] vhost-user-test: add multiple queue test
Date: Wed, 21 Oct 2015 17:07:16 +0800	[thread overview]
Message-ID: <1445418438-24244-3-git-send-email-yuanhan.liu@linux.intel.com> (raw)
In-Reply-To: <1445418438-24244-1-git-send-email-yuanhan.liu@linux.intel.com>

Setting VHOST_USER_PROTOCOL_F_MQ protocol feature bit to claim that we
support MQ feature, and simply assume we support 0xff queue pairs at most.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>

---
v2: use macro to define the max queues we support
---
 tests/vhost-user-test.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c
index f181391..8162e64 100644
--- a/tests/vhost-user-test.c
+++ b/tests/vhost-user-test.c
@@ -29,11 +29,14 @@
 #define HAVE_MONOTONIC_TIME
 #endif
 
+#define MAX_QUEUS       0xff
+
 #define QEMU_CMD_ACCEL  " -machine accel=tcg"
 #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 +51,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 +71,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 +239,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 +273,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 = MAX_QUEUS;
+        p = (uint8_t *) &msg;
+        qemu_chr_fe_write_all(chr, p, VHOST_USER_HDR_SIZE + msg.size);
+        break;
+
     default:
         break;
     }
-- 
1.9.0

  parent reply	other threads:[~2015-10-21  9:07 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-21  9:07 [Qemu-devel] [PATCH v2 1/5] Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE" Yuanhan Liu
2015-10-21  9:07 ` [Qemu-devel] [PATCH v2 2/5] doc: vhost-user: request naming fix Yuanhan Liu
2015-10-21  9:07 ` Yuanhan Liu [this message]
2015-10-21 10:34   ` [Qemu-devel] [PATCH v2 3/5] vhost-user-test: add multiple queue test Michael S. Tsirkin
2015-10-21  9:07 ` [Qemu-devel] [PATCH v2 4/5] Revert "vhost-user: Send VHOST_RESET_OWNER on vhost stop" Yuanhan Liu
2015-10-21 10:35   ` Michael S. Tsirkin
2015-10-21 10:39   ` Michael S. Tsirkin
2015-10-21  9:07 ` [Qemu-devel] [PATCH v2 5/5] vhost: send VHOST_USER_SET_VRING_ENABLE at start/stop Yuanhan Liu
2015-10-21 10:39   ` Michael S. Tsirkin
2015-10-21 13:43     ` Yuanhan Liu
2015-10-21 14:11       ` Michael S. Tsirkin
2015-10-21 14:55         ` Yuanhan Liu
2015-10-21 14:59           ` Michael S. Tsirkin
2015-10-21 10:40 ` [Qemu-devel] [PATCH v2 1/5] Revert "vhost: rename VHOST_RESET_OWNER to VHOST_RESET_DEVICE" Michael S. Tsirkin
2015-10-21 13:04   ` Yuanhan Liu
2015-10-21 14:13     ` Michael S. Tsirkin
2015-10-21 14:18       ` Yuanhan Liu

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=1445418438-24244-3-git-send-email-yuanhan.liu@linux.intel.com \
    --to=yuanhan.liu@linux.intel.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.