[Qemu-devel] [PULL 2/9] libqos: Account for the ctrl queue in virtio-net

Thomas Huth posted 9 patches 6 years, 5 months ago
Maintainers: Fam Zheng <fam@euphon.net>, Laurent Vivier <lvivier@redhat.com>, Greg Kurz <groug@kaod.org>, Thomas Huth <thuth@redhat.com>, Keith Busch <keith.busch@intel.com>, Stefan Hajnoczi <stefanha@redhat.com>, Amit Shah <amit@kernel.org>, Markus Armbruster <armbru@redhat.com>, Hannes Reinecke <hare@suse.com>, Gerd Hoffmann <kraxel@redhat.com>, Jason Wang <jasowang@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
[Qemu-devel] [PULL 2/9] libqos: Account for the ctrl queue in virtio-net
Posted by Thomas Huth 6 years, 5 months ago
From: "Oleinik, Alexander" <alxndr@bu.edu>

The number of queues is 2n+1, where n == 1 when multiqueue is disabled

Signed-off-by: Alexander Oleinik <alxndr@bu.edu>
Message-Id: <20190805032400.8054-1-alxndr@bu.edu>
[thuth: fixed "intefaces" typo]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/libqos/virtio-net.c | 1 +
 tests/libqos/virtio-net.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/libqos/virtio-net.c b/tests/libqos/virtio-net.c
index 66405b646e..6567beb553 100644
--- a/tests/libqos/virtio-net.c
+++ b/tests/libqos/virtio-net.c
@@ -53,6 +53,7 @@ static void virtio_net_setup(QVirtioNet *interface)
     } else {
         interface->n_queues = 2;
     }
+    interface->n_queues++; /* Account for the ctrl queue */
 
     interface->queues = g_new(QVirtQueue *, interface->n_queues);
     for (i = 0; i < interface->n_queues; i++) {
diff --git a/tests/libqos/virtio-net.h b/tests/libqos/virtio-net.h
index a5697d7326..855c67d00f 100644
--- a/tests/libqos/virtio-net.h
+++ b/tests/libqos/virtio-net.h
@@ -29,7 +29,7 @@ typedef struct QVirtioNetDevice QVirtioNetDevice;
 
 struct QVirtioNet {
     QVirtioDevice *vdev;
-    int n_queues;
+    int n_queues; /* total number of virtqueues (rx, tx, ctrl) */
     QVirtQueue **queues;
 };
 
-- 
2.18.1