]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuBuildNicDevStr: Add mq=on for multiqueue networking
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Aug 2013 08:19:08 +0000 (10:19 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 22 Aug 2013 11:48:56 +0000 (13:48 +0200)
If user requested multiqueue networking, beside multiple /dev/tap and
/dev/vhost-net openings, we forgot to pass mq=on onto the -device
virtio-net-pci command line. This is advised at:

  http://www.linux-kvm.org/page/Multiqueue#Enable_MQ_feature

src/qemu/qemu_command.c
src/qemu/qemu_command.h
src/qemu/qemu_hotplug.c

index f1511732417984afbd9f82e6db6c95ee3f45d451..b5ac15ad225919021e977ae1c0116b109c40e80f 100644 (file)
@@ -4730,6 +4730,7 @@ qemuBuildNicDevStr(virDomainDefPtr def,
                    virDomainNetDefPtr net,
                    int vlan,
                    int bootindex,
+                   bool multiqueue,
                    virQEMUCapsPtr qemuCaps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -4782,6 +4783,8 @@ qemuBuildNicDevStr(virDomainDefPtr def,
                               virDomainVirtioEventIdxTypeToString(net->driver.virtio.event_idx));
         }
     }
+    if (usingVirtio && multiqueue)
+        virBufferAddLit(&buf, ",mq=on");
     if (vlan == -1)
         virBufferAsprintf(&buf, ",netdev=host%s", net->info.alias);
     else
@@ -7275,7 +7278,10 @@ qemuBuildInterfaceCommandLine(virCommandPtr cmd,
         virCommandAddArgList(cmd, "-netdev", host, NULL);
     }
     if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex, qemuCaps)))
+        bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
+
+        if (!(nic = qemuBuildNicDevStr(def, net, vlan, bootindex,
+                                       multiqueue, qemuCaps)))
             goto cleanup;
         virCommandAddArgList(cmd, "-device", nic, NULL);
     } else {
index 5c5c025bd46a5f310143050ad4c4cf0cb1d3888e..a9854a35a845df912d31e3159d015dd8ca1ec6e3 100644 (file)
@@ -102,6 +102,7 @@ char * qemuBuildNicDevStr(virDomainDefPtr def,
                           virDomainNetDefPtr net,
                           int vlan,
                           int bootindex,
+                          bool multiqueue,
                           virQEMUCapsPtr qemuCaps);
 
 char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
index 478f33183ba1043adc90f9a4c51c59dd466ae5d8..972741094fd61d88e4273634af3ee10e8d36a621 100644 (file)
@@ -859,7 +859,10 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     }
 
     if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0, priv->qemuCaps)))
+        bool multiqueue = tapfdSize > 1 || vhostfdSize > 1;
+
+        if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
+                                          multiqueue, priv->qemuCaps)))
             goto try_remove;
     } else {
         if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))