render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
43fe83
From 893a8a0b2313e2634e86fc8dd754957ee6caada4 Mon Sep 17 00:00:00 2001
43fe83
Message-Id: <893a8a0b2313e2634e86fc8dd754957ee6caada4.1377873642.git.jdenemar@redhat.com>
43fe83
From: Michal Privoznik <mprivozn@redhat.com>
43fe83
Date: Thu, 22 Aug 2013 15:24:42 +0200
43fe83
Subject: [PATCH] qemuBuildNicDevStr: Add mq=on for multiqueue networking
43fe83
43fe83
https://bugzilla.redhat.com/show_bug.cgi?id=651941
43fe83
43fe83
If user requested multiqueue networking, beside multiple /dev/tap and
43fe83
/dev/vhost-net openings, we forgot to pass mq=on onto the -device
43fe83
virtio-net-pci command line. This is advised at:
43fe83
43fe83
  http://www.linux-kvm.org/page/Multiqueue#Enable_MQ_feature
43fe83
(cherry picked from commit 4c2d0b29d7790df55d12216a56dbf0b29bcb00e3)
43fe83
---
43fe83
 src/qemu/qemu_command.c | 8 +++++++-
43fe83
 src/qemu/qemu_command.h | 1 +
43fe83
 src/qemu/qemu_hotplug.c | 5 ++++-
43fe83
 3 files changed, 12 insertions(+), 2 deletions(-)
43fe83
43fe83
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
43fe83
index 43934f1..af8a5b4 100644
43fe83
--- a/src/qemu/qemu_command.c
43fe83
+++ b/src/qemu/qemu_command.c
43fe83
@@ -4730,6 +4730,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
43fe83
                    virDomainNetDefPtr net,
43fe83
                    int vlan,
43fe83
                    int bootindex,
43fe83
+                   bool multiqueue,
43fe83
                    virQEMUCapsPtr qemuCaps)
43fe83
 {
43fe83
     virBuffer buf = VIR_BUFFER_INITIALIZER;
43fe83
@@ -4782,6 +4783,8 @@ qemuBuildNicDevStr(virDomainDefPtr def,
43fe83
                               virDomainVirtioEventIdxTypeToString(net->driver.virtio.event_idx));
43fe83
         }
43fe83
     }
43fe83
+    if (usingVirtio && multiqueue)
43fe83
+        virBufferAddLit(&buf, ",mq=on");
43fe83
     if (vlan == -1)
43fe83
         virBufferAsprintf(&buf, ",netdev=host%s", net->info.alias);
43fe83
     else
43fe83
@@ -7275,7 +7278,10 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
43fe83
         virCommandAddArgList(cmd, "-netdev", host, NULL);
43fe83
     }
43fe83
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
43fe83
-        if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex, qemuCaps)))
43fe83
+        bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
43fe83
+
43fe83
+        if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
43fe83
+                                       multiqueue, qemuCaps)))
43fe83
             goto cleanup;
43fe83
         virCommandAddArgList(cmd, "-device", nic, NULL);
43fe83
     } else {
43fe83
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
43fe83
index 5c5c025..a9854a3 100644
43fe83
--- a/src/qemu/qemu_command.h
43fe83
+++ b/src/qemu/qemu_command.h
43fe83
@@ -102,6 +102,7 @@ char * qemuBuildNicDevStr(virDomainDefPtr def,
43fe83
                           virDomainNetDefPtr net,
43fe83
                           int vlan,
43fe83
                           int bootindex,
43fe83
+                          bool multiqueue,
43fe83
                           virQEMUCapsPtr qemuCaps);
43fe83
 
43fe83
 char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
43fe83
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
43fe83
index cbe7072..b1f4586 100644
43fe83
--- a/src/qemu/qemu_hotplug.c
43fe83
+++ b/src/qemu/qemu_hotplug.c
43fe83
@@ -859,7 +859,10 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
43fe83
     }
43fe83
 
43fe83
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
43fe83
-        if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0, priv->qemuCaps)))
43fe83
+        bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
43fe83
+
43fe83
+        if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
43fe83
+                                          multiqueue, priv->qemuCaps)))
43fe83
             goto try_remove;
43fe83
     } else {
43fe83
         if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))
43fe83
-- 
43fe83
1.8.3.2
43fe83