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

Michal Privoznik mprivozn at redhat.com
Mon May 13 17:23:09 UTC 2013


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

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index cdca2db..c6ae820 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6449,12 +6449,14 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
 
     if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
         actualType == VIR_DOMAIN_NET_TYPE_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;
@@ -6477,11 +6479,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 = 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 256c54f..59fd645 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -737,11 +737,12 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
 
     if (actualType == VIR_DOMAIN_NET_TYPE_BRIDGE ||
         actualType == VIR_DOMAIN_NET_TYPE_NETWORK) {
-        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.2.1




More information about the libvir-list mailing list