qemuBuildNicDevStr: Add mq=on for multiqueue networking

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
This commit is contained in:
Michal Privoznik 2013-08-22 10:19:08 +02:00
parent fc82f0adde
commit 4c2d0b29d7
3 changed files with 12 additions and 2 deletions

View 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 {

View File

@ -102,6 +102,7 @@ char * qemuBuildNicDevStr(virDomainDefPtr def,
virDomainNetDefPtr net,
int vlan,
int bootindex,
bool multiqueue,
virQEMUCapsPtr qemuCaps);
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,

View 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)))