render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
9119d9
From 8e70457b217ea22feea3ae674e4bf080f6518177 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <8e70457b217ea22feea3ae674e4bf080f6518177@dist-git>
9119d9
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
9119d9
Date: Wed, 24 Sep 2014 16:55:45 +0200
9119d9
Subject: [PATCH] qemu: wire up virtio-net segment offloading options
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1139364
9119d9
9119d9
Format the segment offloading options specified by
9119d9
<driver>
9119d9
  <host .../>
9119d9
  <guest .../>
9119d9
</driver>
9119d9
on virtio-net command line.
9119d9
9119d9
(cherry picked from commit 2d79e1752a0609eb17eef06223e4645f79fbb2cd)
9119d9
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_command.c                            | 44 ++++++++++++++++++++++
9119d9
 .../qemuxml2argv-net-virtio-disable-offloads.args  | 10 +++++
9119d9
 tests/qemuxml2argvtest.c                           |  2 +
9119d9
 3 files changed, 56 insertions(+)
9119d9
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-disable-offloads.args
9119d9
9119d9
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
9119d9
index 7d4f3cc..6c4e2ff 100644
9119d9
--- a/src/qemu/qemu_command.c
9119d9
+++ b/src/qemu/qemu_command.c
9119d9
@@ -4472,6 +4472,50 @@ qemuBuildNicDevStr(virDomainDefPtr def,
9119d9
             virBufferAsprintf(&buf, ",event_idx=%s",
9119d9
                               virTristateSwitchTypeToString(net->driver.virtio.event_idx));
9119d9
         }
9119d9
+        if (net->driver.virtio.host.csum) {
9119d9
+            virBufferAsprintf(&buf, ",csum=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.host.csum));
9119d9
+        }
9119d9
+        if (net->driver.virtio.host.gso) {
9119d9
+            virBufferAsprintf(&buf, ",gso=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.host.gso));
9119d9
+        }
9119d9
+        if (net->driver.virtio.host.tso4) {
9119d9
+            virBufferAsprintf(&buf, ",host_tso4=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.host.tso4));
9119d9
+        }
9119d9
+        if (net->driver.virtio.host.tso6) {
9119d9
+            virBufferAsprintf(&buf, ",host_tso6=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.host.tso6));
9119d9
+        }
9119d9
+        if (net->driver.virtio.host.ecn) {
9119d9
+            virBufferAsprintf(&buf, ",host_ecn=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.host.ecn));
9119d9
+        }
9119d9
+        if (net->driver.virtio.host.ufo) {
9119d9
+            virBufferAsprintf(&buf, ",host_ufo=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.host.ufo));
9119d9
+        }
9119d9
+        if (net->driver.virtio.guest.csum) {
9119d9
+            virBufferAsprintf(&buf, ",guest_csum=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.guest.csum));
9119d9
+        }
9119d9
+        if (net->driver.virtio.guest.tso4) {
9119d9
+            virBufferAsprintf(&buf, ",guest_tso4=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.guest.tso4));
9119d9
+        }
9119d9
+        if (net->driver.virtio.guest.tso6) {
9119d9
+            virBufferAsprintf(&buf, ",guest_tso6=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.guest.tso6));
9119d9
+        }
9119d9
+        if (net->driver.virtio.guest.ecn) {
9119d9
+            virBufferAsprintf(&buf, ",guest_ecn=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.guest.ecn));
9119d9
+        }
9119d9
+        if (net->driver.virtio.guest.ufo) {
9119d9
+            virBufferAsprintf(&buf, ",guest_ufo=%s",
9119d9
+                              virTristateSwitchTypeToString(net->driver.virtio.guest.ufo));
9119d9
+        }
9119d9
     }
9119d9
     if (usingVirtio && vhostfdSize > 1) {
9119d9
         /* As advised at http://www.linux-kvm.org/page/Multiqueue
9119d9
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-disable-offloads.args b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-disable-offloads.args
9119d9
new file mode 100644
9119d9
index 0000000..b7ce282
9119d9
--- /dev/null
9119d9
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-disable-offloads.args
9119d9
@@ -0,0 +1,10 @@
9119d9
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test QEMU_AUDIO_DRV=none \
9119d9
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -nodefconfig -nodefaults \
9119d9
+-monitor unix:/tmp/test-monitor,server,nowait -no-acpi -boot c -usb \
9119d9
+-hda /dev/HostVG/QEMUGuest7 \
9119d9
+-device virtio-net-pci,csum=off,gso=off,\
9119d9
+host_tso4=off,host_tso6=off,host_ecn=off,host_ufo=off,\
9119d9
+guest_csum=off,guest_tso4=off,guest_tso6=off,guest_ecn=off,guest_ufo=off,\
9119d9
+vlan=0,id=net0,mac=00:22:44:66:88:aa,bus=pci.0,addr=0x3 \
9119d9
+-net user,vlan=0,name=hostnet0 \
9119d9
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4
9119d9
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
9119d9
index a9129dc..410540f 100644
9119d9
--- a/tests/qemuxml2argvtest.c
9119d9
+++ b/tests/qemuxml2argvtest.c
9119d9
@@ -969,6 +969,8 @@ mymain(void)
9119d9
     DO_TEST("net-virtio", NONE);
9119d9
     DO_TEST("net-virtio-device",
9119d9
             QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG, QEMU_CAPS_VIRTIO_TX_ALG);
9119d9
+    DO_TEST("net-virtio-disable-offloads",
9119d9
+            QEMU_CAPS_DEVICE, QEMU_CAPS_NODEFCONFIG);
9119d9
     DO_TEST("net-virtio-netdev",
9119d9
             QEMU_CAPS_DEVICE, QEMU_CAPS_NETDEV, QEMU_CAPS_NODEFCONFIG);
9119d9
     DO_TEST("net-virtio-s390",
9119d9
-- 
9119d9
2.1.1
9119d9