render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
6ae9ed
From 63481085bfecb5463c2a2de5cb7267d9baa51d52 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <63481085bfecb5463c2a2de5cb7267d9baa51d52@dist-git>
6ae9ed
From: Michal Privoznik <mprivozn@redhat.com>
6ae9ed
Date: Sat, 10 Sep 2016 08:25:12 +0200
6ae9ed
Subject: [PATCH] qemu: Implement virtio-net rx_queue_size
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1366989
6ae9ed
6ae9ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6ae9ed
(cherry picked from commit 2692304c94e631720e8e9444e34a3e445e8da61a)
6ae9ed
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
6ae9ed
---
6ae9ed
 src/qemu/qemu_command.c                            |  8 +++++++
6ae9ed
 .../qemuxml2argv-net-virtio-rxqueuesize.args       | 25 ++++++++++++++++++++++
6ae9ed
 tests/qemuxml2argvtest.c                           |  2 ++
6ae9ed
 3 files changed, 35 insertions(+)
6ae9ed
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
6ae9ed
index de121c5..7abe213 100644
6ae9ed
--- a/src/qemu/qemu_command.c
6ae9ed
+++ b/src/qemu/qemu_command.c
6ae9ed
@@ -3556,6 +3556,14 @@ qemuBuildNicDevStr(virDomainDefPtr def,
6ae9ed
             virBufferAsprintf(&buf, ",mq=on,vectors=%zu", 2 * vhostfdSize + 2);
6ae9ed
         }
6ae9ed
     }
6ae9ed
+    if (usingVirtio && net->driver.virtio.rx_queue_size) {
6ae9ed
+        if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE)) {
6ae9ed
+            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
6ae9ed
+                           _("virtio rx_queue_size option is not supported with this QEMU binary"));
6ae9ed
+            goto error;
6ae9ed
+        }
6ae9ed
+        virBufferAsprintf(&buf, ",rx_queue_size=%u", net->driver.virtio.rx_queue_size);
6ae9ed
+    }
6ae9ed
     if (vlan == -1)
6ae9ed
         virBufferAsprintf(&buf, ",netdev=host%s", net->info.alias);
6ae9ed
     else
6ae9ed
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args
6ae9ed
new file mode 100644
6ae9ed
index 0000000..7d275a7
6ae9ed
--- /dev/null
6ae9ed
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-rxqueuesize.args
6ae9ed
@@ -0,0 +1,25 @@
6ae9ed
+LC_ALL=C \
6ae9ed
+PATH=/bin \
6ae9ed
+HOME=/home/test \
6ae9ed
+USER=test \
6ae9ed
+LOGNAME=test \
6ae9ed
+QEMU_AUDIO_DRV=none \
6ae9ed
+/usr/bin/qemu \
6ae9ed
+-name QEMUGuest1 \
6ae9ed
+-S \
6ae9ed
+-M pc \
6ae9ed
+-m 214 \
6ae9ed
+-smp 1,sockets=1,cores=1,threads=1 \
6ae9ed
+-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
6ae9ed
+-nographic \
6ae9ed
+-nodefaults \
6ae9ed
+-monitor unix:/tmp/lib/domain--1-QEMUGuest1/monitor.sock,server,nowait \
6ae9ed
+-no-acpi \
6ae9ed
+-boot c \
6ae9ed
+-usb \
6ae9ed
+-drive file=/dev/HostVG/QEMUGuest1,format=raw,if=none,id=drive-ide0-0-0 \
6ae9ed
+-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 \
6ae9ed
+-device virtio-net-pci,rx_queue_size=512,vlan=0,id=net0,mac=00:11:22:33:44:55,\
6ae9ed
+bus=pci.0,addr=0x3 \
6ae9ed
+-net user,vlan=0,name=hostnet0 \
6ae9ed
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
6ae9ed
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
6ae9ed
index f4054e7..df9c832 100644
6ae9ed
--- a/tests/qemuxml2argvtest.c
6ae9ed
+++ b/tests/qemuxml2argvtest.c
6ae9ed
@@ -1040,6 +1040,8 @@ mymain(void)
6ae9ed
             QEMU_CAPS_VIRTIO_S390);
6ae9ed
     DO_TEST("net-virtio-ccw",
6ae9ed
             QEMU_CAPS_VIRTIO_CCW, QEMU_CAPS_VIRTIO_S390);
6ae9ed
+    DO_TEST("net-virtio-rxqueuesize",
6ae9ed
+            QEMU_CAPS_VIRTIO_NET_RX_QUEUE_SIZE);
6ae9ed
     DO_TEST_PARSE_ERROR("net-virtio-rxqueuesize-invalid-size", NONE);
6ae9ed
     DO_TEST("net-eth", NONE);
6ae9ed
     DO_TEST("net-eth-ifname", NONE);
6ae9ed
-- 
6ae9ed
2.10.0
6ae9ed