|
|
9119d9 |
From 18fd00f5fdad7b2a65e94a0013901a2f8c1c6cde Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <18fd00f5fdad7b2a65e94a0013901a2f8c1c6cde@dist-git>
|
|
|
9119d9 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
9119d9 |
Date: Wed, 24 Sep 2014 16:55:44 +0200
|
|
|
9119d9 |
Subject: [PATCH] conf: add options for disabling segment offloading
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1139364
|
|
|
9119d9 |
|
|
|
9119d9 |
Add options for tuning segment offloading:
|
|
|
9119d9 |
<driver>
|
|
|
9119d9 |
|
|
|
9119d9 |
ecn='off' ufo='off'/>
|
|
|
9119d9 |
<guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
|
|
|
9119d9 |
</driver>
|
|
|
9119d9 |
which control the respective host_ and guest_ properties
|
|
|
9119d9 |
of the virtio-net device.
|
|
|
9119d9 |
|
|
|
9119d9 |
(cherry picked from commit 5b3536ae90a27e6c83ad222e286f08856037c195)
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
docs/formatdomain.html.in | 24 ++-
|
|
|
9119d9 |
docs/schemas/domaincommon.rng | 66 ++++++-
|
|
|
9119d9 |
src/conf/domain_conf.c | 218 ++++++++++++++++++++-
|
|
|
9119d9 |
src/conf/domain_conf.h | 15 ++
|
|
|
9119d9 |
.../qemuxml2argv-net-virtio-disable-offloads.xml | 35 ++++
|
|
|
9119d9 |
tests/qemuxml2xmltest.c | 1 +
|
|
|
9119d9 |
6 files changed, 351 insertions(+), 8 deletions(-)
|
|
|
9119d9 |
create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-net-virtio-disable-offloads.xml
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
|
|
|
9119d9 |
index 8c03ebb..830bfa2 100644
|
|
|
9119d9 |
--- a/docs/formatdomain.html.in
|
|
|
9119d9 |
+++ b/docs/formatdomain.html.in
|
|
|
9119d9 |
@@ -3868,7 +3868,11 @@ qemu-kvm -net nic,model=? /dev/null
|
|
|
9119d9 |
<source network='default'/>
|
|
|
9119d9 |
<target dev='vnet1'/>
|
|
|
9119d9 |
<model type='virtio'/>
|
|
|
9119d9 |
- <driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5'/>
|
|
|
9119d9 |
+ <driver name='vhost' txmode='iothread' ioeventfd='on' event_idx='off' queues='5'>
|
|
|
9119d9 |
+ <host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
|
|
|
9119d9 |
+ <guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
|
|
|
9119d9 |
+ </driver>
|
|
|
9119d9 |
+
|
|
|
9119d9 |
</interface>
|
|
|
9119d9 |
</devices>
|
|
|
9119d9 |
...
|
|
|
9119d9 |
@@ -3972,6 +3976,24 @@ qemu-kvm -net nic,model=? /dev/null
|
|
|
9119d9 |
processor, resulting in much higher throughput.
|
|
|
9119d9 |
Since 1.0.6 (QEMU and KVM only)
|
|
|
9119d9 |
|
|
|
9119d9 |
+ host offloading options
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ The csum , gso , tso4 ,
|
|
|
9119d9 |
+ tso6 , ecn and ufo
|
|
|
9119d9 |
+ attributes with possible values on
|
|
|
9119d9 |
+ and off can be used to turn off host offloading options.
|
|
|
9119d9 |
+ By default, the supported offloads are enabled by QEMU.
|
|
|
9119d9 |
+ Since 1.2.9 (QEMU only)
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ guest offloading options
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ The csum , tso4 ,
|
|
|
9119d9 |
+ tso6 , ecn and ufo
|
|
|
9119d9 |
+ attributes with possible values on
|
|
|
9119d9 |
+ and off can be used to turn off guest offloading options.
|
|
|
9119d9 |
+ By default, the supported offloads are enabled by QEMU.
|
|
|
9119d9 |
+ Since 1.2.9 (QEMU only)
|
|
|
9119d9 |
+
|
|
|
9119d9 |
|
|
|
9119d9 |
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
|
|
|
9119d9 |
index 19dc82f..ccfb511 100644
|
|
|
9119d9 |
--- a/docs/schemas/domaincommon.rng
|
|
|
9119d9 |
+++ b/docs/schemas/domaincommon.rng
|
|
|
9119d9 |
@@ -2364,7 +2364,71 @@
|
|
|
9119d9 |
</optional>
|
|
|
9119d9 |
</group>
|
|
|
9119d9 |
</choice>
|
|
|
9119d9 |
- <empty/>
|
|
|
9119d9 |
+ <interleave>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <element name='host'>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='csum'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='gso'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='tso4'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='tso6'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='ecn'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='ufo'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ </element>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <element name='guest'>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='csum'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='tso4'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='tso6'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='ecn'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ <optional>
|
|
|
9119d9 |
+ <attribute name='ufo'>
|
|
|
9119d9 |
+ <ref name="virOnOff"/>
|
|
|
9119d9 |
+ </attribute>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ </element>
|
|
|
9119d9 |
+ </optional>
|
|
|
9119d9 |
+ </interleave>
|
|
|
9119d9 |
</element>
|
|
|
9119d9 |
</optional>
|
|
|
9119d9 |
<optional>
|
|
|
9119d9 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
9119d9 |
index a4db3c3..4e80467 100644
|
|
|
9119d9 |
--- a/src/conf/domain_conf.c
|
|
|
9119d9 |
+++ b/src/conf/domain_conf.c
|
|
|
9119d9 |
@@ -6893,6 +6893,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
9119d9 |
char *ioeventfd = NULL;
|
|
|
9119d9 |
char *event_idx = NULL;
|
|
|
9119d9 |
char *queues = NULL;
|
|
|
9119d9 |
+ char *str = NULL;
|
|
|
9119d9 |
char *filter = NULL;
|
|
|
9119d9 |
char *internal = NULL;
|
|
|
9119d9 |
char *devaddr = NULL;
|
|
|
9119d9 |
@@ -7381,6 +7382,115 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
9119d9 |
}
|
|
|
9119d9 |
def->driver.virtio.queues = q;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/host/@csum)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown host csum mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.host.csum = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/host/@gso)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown host gso mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.host.gso = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/host/@tso4)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown host tso4 mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.host.tso4 = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/host/@tso6)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown host tso6 mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.host.tso6 = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/host/@ecn)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown host ecn mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.host.ecn = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/host/@ufo)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown host ufo mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.host.ufo = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/guest/@csum)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown guest csum mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.guest.csum = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/guest/@tso4)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown guest tso4 mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.guest.tso4 = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/guest/@tso6)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown guest tso6 mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.guest.tso6 = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/guest/@ecn)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown guest ecn mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.guest.ecn = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
+ if ((str = virXPathString("string(./driver/guest/@ufo)", ctxt))) {
|
|
|
9119d9 |
+ if ((val = virTristateSwitchTypeFromString(str)) <= 0) {
|
|
|
9119d9 |
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
|
|
9119d9 |
+ _("unknown guest ufo mode '%s'"),
|
|
|
9119d9 |
+ str);
|
|
|
9119d9 |
+ goto error;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ def->driver.virtio.guest.ufo = val;
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
def->linkstate = VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DEFAULT;
|
|
|
9119d9 |
@@ -7438,6 +7548,7 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
|
|
9119d9 |
VIR_FREE(ioeventfd);
|
|
|
9119d9 |
VIR_FREE(event_idx);
|
|
|
9119d9 |
VIR_FREE(queues);
|
|
|
9119d9 |
+ VIR_FREE(str);
|
|
|
9119d9 |
VIR_FREE(filter);
|
|
|
9119d9 |
VIR_FREE(type);
|
|
|
9119d9 |
VIR_FREE(internal);
|
|
|
9119d9 |
@@ -16443,6 +16554,80 @@ virDomainActualNetDefFormat(virBufferPtr buf,
|
|
|
9119d9 |
|
|
|
9119d9 |
|
|
|
9119d9 |
static int
|
|
|
9119d9 |
+virDomainVirtioNetGuestOptsFormat(char **outstr,
|
|
|
9119d9 |
+ virDomainNetDefPtr def)
|
|
|
9119d9 |
+{
|
|
|
9119d9 |
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
|
|
|
9119d9 |
+ if (def->driver.virtio.guest.csum) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "csum='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.guest.csum));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.guest.tso4) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "tso4='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.guest.tso4));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.guest.tso6) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "tso6='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.guest.tso6));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.guest.ecn) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "ecn='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.guest.ecn));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.guest.ufo) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "ufo='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.guest.ufo));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ virBufferTrim(&buf, " ", -1);
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (virBufferCheckError(&buf) < 0)
|
|
|
9119d9 |
+ return -1;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ *outstr = virBufferContentAndReset(&buf;;
|
|
|
9119d9 |
+ return 0;
|
|
|
9119d9 |
+}
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+static int
|
|
|
9119d9 |
+virDomainVirtioNetHostOptsFormat(char **outstr,
|
|
|
9119d9 |
+ virDomainNetDefPtr def)
|
|
|
9119d9 |
+{
|
|
|
9119d9 |
+ virBuffer buf = VIR_BUFFER_INITIALIZER;
|
|
|
9119d9 |
+ if (def->driver.virtio.host.csum) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "csum='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.host.csum));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.host.gso) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "gso='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.host.gso));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.host.tso4) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "tso4='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.host.tso4));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.host.tso6) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "tso6='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.host.tso6));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.host.ecn) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "ecn='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.host.ecn));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ if (def->driver.virtio.host.ufo) {
|
|
|
9119d9 |
+ virBufferAsprintf(&buf, "ufo='%s' ",
|
|
|
9119d9 |
+ virTristateSwitchTypeToString(def->driver.virtio.host.ufo));
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+ virBufferTrim(&buf, " ", -1);
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (virBufferCheckError(&buf) < 0)
|
|
|
9119d9 |
+ return -1;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ *outstr = virBufferContentAndReset(&buf;;
|
|
|
9119d9 |
+ return 0;
|
|
|
9119d9 |
+}
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+static int
|
|
|
9119d9 |
virDomainVirtioNetDriverFormat(char **outstr,
|
|
|
9119d9 |
virDomainNetDefPtr def)
|
|
|
9119d9 |
{
|
|
|
9119d9 |
@@ -16493,7 +16678,6 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|
|
9119d9 |
virDomainHostdevDefPtr hostdef = NULL;
|
|
|
9119d9 |
char macstr[VIR_MAC_STRING_BUFLEN];
|
|
|
9119d9 |
|
|
|
9119d9 |
-
|
|
|
9119d9 |
if (publicActual) {
|
|
|
9119d9 |
if (!(typeStr = virDomainNetTypeToString(actualType))) {
|
|
|
9119d9 |
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
9119d9 |
@@ -16652,14 +16836,36 @@ virDomainNetDefFormat(virBufferPtr buf,
|
|
|
9119d9 |
virBufferEscapeString(buf, "<model type='%s'/>\n",
|
|
|
9119d9 |
def->model);
|
|
|
9119d9 |
if (STREQ(def->model, "virtio")) {
|
|
|
9119d9 |
- char *str;
|
|
|
9119d9 |
+ char *str = NULL, *gueststr = NULL, *hoststr = NULL;
|
|
|
9119d9 |
+ int rc = 0;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (virDomainVirtioNetDriverFormat(&str, def) < 0)
|
|
|
9119d9 |
- return -1;
|
|
|
9119d9 |
+ if (virDomainVirtioNetDriverFormat(&str, def) < 0 ||
|
|
|
9119d9 |
+ virDomainVirtioNetGuestOptsFormat(&gueststr, def) < 0 ||
|
|
|
9119d9 |
+ virDomainVirtioNetHostOptsFormat(&hoststr, def) < 0)
|
|
|
9119d9 |
+ rc = -1;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (str)
|
|
|
9119d9 |
- virBufferAsprintf(buf, "<driver %s/>\n", str);
|
|
|
9119d9 |
+ if (!gueststr && !hoststr) {
|
|
|
9119d9 |
+ if (str)
|
|
|
9119d9 |
+ virBufferAsprintf(buf, "<driver %s/>\n", str);
|
|
|
9119d9 |
+ } else {
|
|
|
9119d9 |
+ if (str)
|
|
|
9119d9 |
+ virBufferAsprintf(buf, "<driver %s>\n", str);
|
|
|
9119d9 |
+ else
|
|
|
9119d9 |
+ virBufferAddLit(buf, "<driver>\n");
|
|
|
9119d9 |
+ virBufferAdjustIndent(buf, 2);
|
|
|
9119d9 |
+ if (hoststr)
|
|
|
9119d9 |
+ virBufferAsprintf(buf, "<host %s/>\n", hoststr);
|
|
|
9119d9 |
+ if (gueststr)
|
|
|
9119d9 |
+ virBufferAsprintf(buf, "<guest %s/>\n", gueststr);
|
|
|
9119d9 |
+ virBufferAdjustIndent(buf, -2);
|
|
|
9119d9 |
+ virBufferAddLit(buf, "</driver>\n");
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
VIR_FREE(str);
|
|
|
9119d9 |
+ VIR_FREE(hoststr);
|
|
|
9119d9 |
+ VIR_FREE(gueststr);
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (rc < 0)
|
|
|
9119d9 |
+ return -1;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
}
|
|
|
9119d9 |
if (def->backend.tap || def->backend.vhost) {
|
|
|
9119d9 |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
9119d9 |
index decd4be..39f1948 100644
|
|
|
9119d9 |
--- a/src/conf/domain_conf.h
|
|
|
9119d9 |
+++ b/src/conf/domain_conf.h
|
|
|
9119d9 |
@@ -895,6 +895,21 @@ struct _virDomainNetDef {
|
|
|
9119d9 |
virTristateSwitch ioeventfd;
|
|
|
9119d9 |
virTristateSwitch event_idx;
|
|
|
9119d9 |
unsigned int queues; /* Multiqueue virtio-net */
|
|
|
9119d9 |
+ struct {
|
|
|
9119d9 |
+ virTristateSwitch csum;
|
|
|
9119d9 |
+ virTristateSwitch gso;
|
|
|
9119d9 |
+ virTristateSwitch tso4;
|
|
|
9119d9 |
+ virTristateSwitch tso6;
|
|
|
9119d9 |
+ virTristateSwitch ecn;
|
|
|
9119d9 |
+ virTristateSwitch ufo;
|
|
|
9119d9 |
+ } host;
|
|
|
9119d9 |
+ struct {
|
|
|
9119d9 |
+ virTristateSwitch csum;
|
|
|
9119d9 |
+ virTristateSwitch tso4;
|
|
|
9119d9 |
+ virTristateSwitch tso6;
|
|
|
9119d9 |
+ virTristateSwitch ecn;
|
|
|
9119d9 |
+ virTristateSwitch ufo;
|
|
|
9119d9 |
+ } guest;
|
|
|
9119d9 |
} virtio;
|
|
|
9119d9 |
} driver;
|
|
|
9119d9 |
struct {
|
|
|
9119d9 |
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-disable-offloads.xml b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-disable-offloads.xml
|
|
|
9119d9 |
new file mode 100644
|
|
|
9119d9 |
index 0000000..e368c43
|
|
|
9119d9 |
--- /dev/null
|
|
|
9119d9 |
+++ b/tests/qemuxml2argvdata/qemuxml2argv-net-virtio-disable-offloads.xml
|
|
|
9119d9 |
@@ -0,0 +1,35 @@
|
|
|
9119d9 |
+<domain type='qemu'>
|
|
|
9119d9 |
+ <name>QEMUGuest1</name>
|
|
|
9119d9 |
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
|
|
|
9119d9 |
+ <memory unit='KiB'>219136</memory>
|
|
|
9119d9 |
+ <currentMemory unit='KiB'>219136</currentMemory>
|
|
|
9119d9 |
+ <vcpu placement='static'>1</vcpu>
|
|
|
9119d9 |
+ <os>
|
|
|
9119d9 |
+ <type arch='i686' machine='pc'>hvm</type>
|
|
|
9119d9 |
+ <boot dev='hd'/>
|
|
|
9119d9 |
+ </os>
|
|
|
9119d9 |
+ <clock offset='utc'/>
|
|
|
9119d9 |
+ <on_poweroff>destroy</on_poweroff>
|
|
|
9119d9 |
+ <on_reboot>restart</on_reboot>
|
|
|
9119d9 |
+ <on_crash>destroy</on_crash>
|
|
|
9119d9 |
+ <devices>
|
|
|
9119d9 |
+ <emulator>/usr/bin/qemu</emulator>
|
|
|
9119d9 |
+ <disk type='block' device='disk'>
|
|
|
9119d9 |
+ <source dev='/dev/HostVG/QEMUGuest7'/>
|
|
|
9119d9 |
+ <target dev='hda' bus='ide'/>
|
|
|
9119d9 |
+ <address type='drive' controller='0' bus='0' target='0' unit='0'/>
|
|
|
9119d9 |
+ </disk>
|
|
|
9119d9 |
+ <controller type='usb' index='0'/>
|
|
|
9119d9 |
+ <controller type='ide' index='0'/>
|
|
|
9119d9 |
+ <controller type='pci' index='0' model='pci-root'/>
|
|
|
9119d9 |
+ <interface type='user'>
|
|
|
9119d9 |
+ <mac address='00:22:44:66:88:aa'/>
|
|
|
9119d9 |
+ <model type='virtio'/>
|
|
|
9119d9 |
+ <driver>
|
|
|
9119d9 |
+ <host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
|
|
|
9119d9 |
+ <guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
|
|
|
9119d9 |
+ </driver>
|
|
|
9119d9 |
+ </interface>
|
|
|
9119d9 |
+ <memballoon model='virtio'/>
|
|
|
9119d9 |
+ </devices>
|
|
|
9119d9 |
+</domain>
|
|
|
9119d9 |
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
|
|
|
9119d9 |
index 3ca64d4..ee05212 100644
|
|
|
9119d9 |
--- a/tests/qemuxml2xmltest.c
|
|
|
9119d9 |
+++ b/tests/qemuxml2xmltest.c
|
|
|
9119d9 |
@@ -261,6 +261,7 @@ mymain(void)
|
|
|
9119d9 |
DO_TEST("net-user");
|
|
|
9119d9 |
DO_TEST("net-virtio");
|
|
|
9119d9 |
DO_TEST("net-virtio-device");
|
|
|
9119d9 |
+ DO_TEST("net-virtio-disable-offloads");
|
|
|
9119d9 |
DO_TEST("net-eth");
|
|
|
9119d9 |
DO_TEST("net-eth-ifname");
|
|
|
9119d9 |
DO_TEST("net-virtio-network-portgroup");
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.1
|
|
|
9119d9 |
|