[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH v1 12/12] qemu: Enable multiqueue network



---
 src/qemu/qemu_command.c | 10 ++++++----
 src/qemu/qemu_hotplug.c |  5 +++--
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 60873c7..a7d422a 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -5887,12 +5887,13 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
         if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
             cfg->privileged ||
             (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE))) {
-            if (VIR_ALLOC(tapfd) < 0 || VIR_ALLOC(tapfdName) < 0) {
+            if (VIR_ALLOC_N(tapfd, net->driver.virtio.queues) < 0 ||
+                VIR_ALLOC_N(tapfdName, net->driver.virtio.queues) < 0) {
                 virReportOOMError();
                 goto cleanup;
             }
 
-            tapfdSize = 1;
+            tapfdSize = net->driver.virtio.queues;
             if (qemuNetworkIfaceConnect(def, conn, driver, net,
                                         qemuCaps, tapfd, tapfdSize) < 0)
                 goto cleanup;
@@ -5916,11 +5917,12 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
         int useVhost;
         /* Attempt to use vhost-net mode for these types of
            network device */
-        if (VIR_ALLOC(vhostfd) < 0 || VIR_ALLOC(vhostfdName)) {
+        if (VIR_ALLOC_N(vhostfd, net->driver.virtio.queues) < 0 ||
+            VIR_ALLOC_N(vhostfdName, net->driver.virtio.queues)) {
             virReportOOMError();
             goto cleanup;
         }
-        vhostfdSize = 1;
+        vhostfdSize = 1 + net->driver.virtio.queues;
 
         useVhost = qemuOpenVhostNet(def, net, qemuCaps, vhostfd, vhostfdSize);
         if (useVhost < 0)
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 3a00811..d35801d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -743,11 +743,12 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
         if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
             cfg->privileged ||
             (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV_BRIDGE))) {
-            if (VIR_ALLOC(tapfd) < 0 || VIR_ALLOC(vhostfd) < 0) {
+            if (VIR_ALLOC_N(tapfd, net->driver.virtio.queues) < 0 ||
+                VIR_ALLOC_N(vhostfd, net->driver.virtio.queues) < 0) {
                 virReportOOMError();
                 goto cleanup;
             }
-            tapfdSize = vhostfdSize = 1;
+            tapfdSize = vhostfdSize = net->driver.virtio.queues;
             if (qemuNetworkIfaceConnect(vm->def, conn, driver, net,
                                         priv->qemuCaps, tapfd, tapfdSize) < 0)
                 goto cleanup;
-- 
1.8.1.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]