Blame SOURCES/libvirt-qemuDomainAttachNetDevice-pass-mq-and-vectors-for-vhost-user-with-multiqueue.patch

c8c376
From 9e58c2baa75edb40ec0176c81c32081c10ed8967 Mon Sep 17 00:00:00 2001
c8c376
Message-Id: <9e58c2baa75edb40ec0176c81c32081c10ed8967@dist-git>
c8c376
From: gaohaifeng <gaohaifeng.gao@huawei.com>
c8c376
Date: Thu, 15 Dec 2016 18:17:47 +0100
c8c376
Subject: [PATCH] qemuDomainAttachNetDevice: pass mq and vectors for vhost-user
c8c376
 with multiqueue
c8c376
c8c376
RHEL-7.4: https://bugzilla.redhat.com/show_bug.cgi?id=1386976
c8c376
RHEL-7.3.z: https://bugzilla.redhat.com/show_bug.cgi?id=1404186
c8c376
c8c376
Two reasons:
c8c376
1.in none hotplug, we will pass it. We can see from libvirt function
c8c376
qemuBuildVhostuserCommandLine
c8c376
2.qemu will use this vetcor num to init msix table. If we don't pass, qemu
c8c376
will use default value, this will cause VM can only use default value
c8c376
interrupts at most.
c8c376
c8c376
Signed-off-by: gaohaifeng <gaohaifeng.gao@huawei.com>
c8c376
(cherry picked from commit f81b33b50c6cad384d32067c8e28f404f54a530d)
c8c376
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
c8c376
---
c8c376
 src/qemu/qemu_hotplug.c | 9 ++++++++-
c8c376
 1 file changed, 8 insertions(+), 1 deletion(-)
c8c376
c8c376
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
c8c376
index 7e4a653e6..62e275e94 100644
c8c376
--- a/src/qemu/qemu_hotplug.c
c8c376
+++ b/src/qemu/qemu_hotplug.c
c8c376
@@ -892,6 +892,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
c8c376
     char **vhostfdName = NULL;
c8c376
     int *vhostfd = NULL;
c8c376
     size_t vhostfdSize = 0;
c8c376
+    size_t queueSize = 0;
c8c376
     char *nicstr = NULL;
c8c376
     char *netstr = NULL;
c8c376
     virNetDevVPortProfilePtr vport = NULL;
c8c376
@@ -955,6 +956,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
c8c376
         tapfdSize = vhostfdSize = net->driver.virtio.queues;
c8c376
         if (!tapfdSize)
c8c376
             tapfdSize = vhostfdSize = 1;
c8c376
+        queueSize = tapfdSize;
c8c376
         if (VIR_ALLOC_N(tapfd, tapfdSize) < 0)
c8c376
             goto cleanup;
c8c376
         memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
c8c376
@@ -974,6 +976,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
c8c376
         tapfdSize = vhostfdSize = net->driver.virtio.queues;
c8c376
         if (!tapfdSize)
c8c376
             tapfdSize = vhostfdSize = 1;
c8c376
+        queueSize = tapfdSize;
c8c376
         if (VIR_ALLOC_N(tapfd, tapfdSize) < 0)
c8c376
             goto cleanup;
c8c376
         memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
c8c376
@@ -994,6 +997,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
c8c376
         tapfdSize = vhostfdSize = net->driver.virtio.queues;
c8c376
         if (!tapfdSize)
c8c376
             tapfdSize = vhostfdSize = 1;
c8c376
+        queueSize = tapfdSize;
c8c376
         if (VIR_ALLOC_N(tapfd, tapfdSize) < 0)
c8c376
             goto cleanup;
c8c376
         memset(tapfd, -1, sizeof(*tapfd) * tapfdSize);
c8c376
@@ -1024,6 +1028,9 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
c8c376
         break;
c8c376
 
c8c376
     case VIR_DOMAIN_NET_TYPE_VHOSTUSER:
c8c376
+        queueSize = net->driver.virtio.queues;
c8c376
+        if (!queueSize)
c8c376
+            queueSize = 1;
c8c376
         if (!qemuDomainSupportsNetdev(vm->def, priv->qemuCaps, net)) {
c8c376
             virReportError(VIR_ERR_INTERNAL_ERROR,
c8c376
                            "%s", _("Netdev support unavailable"));
c8c376
@@ -1166,7 +1173,7 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver,
c8c376
         VIR_FORCE_CLOSE(vhostfd[i]);
c8c376
 
c8c376
     if (!(nicstr = qemuBuildNicDevStr(vm->def, net, vlan, 0,
c8c376
-                                      vhostfdSize, priv->qemuCaps)))
c8c376
+                                      queueSize, priv->qemuCaps)))
c8c376
         goto try_remove;
c8c376
 
c8c376
     qemuDomainObjEnterMonitor(driver, vm);
c8c376
-- 
c8c376
2.11.0
c8c376