Bug 1155441

Summary: forbid NIC offloads change on the fly using update-device
Product: Red Hat Enterprise Linux 7 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.1CC: dyuan, honzhang, lcheng, mzhan, rbalakri
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.2.8-6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-05 07:46:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hu Jianwei 2014-10-22 07:12:25 UTC
Description of problem:
Allow NIC offloads change on the fly using update-device

Version-Release number of selected component (if applicable):
libvirt-1.2.8-5.el7.x86_64
qemu-kvm-rhev-2.1.2-3.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Define a guest, and print the offloads info
[root@localhost ~]# virsh dumpxml r7| grep "/interface" -B15
    <interface type='network'>
      <mac address='52:54:00:66:70:90'/>
      <source network='default'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
[root@localhost ~]# virsh start r7
Domain r7 started

In host:
[root@localhost ~]# ethtool -k vnet0| head -18
Features for vnet0:
rx-checksumming: off [fixed]
tx-checksumming: on
        tx-checksum-ipv4: off [fixed]
        tx-checksum-ip-generic: on
        tx-checksum-ipv6: off [fixed]
        tx-checksum-fcoe-crc: off [fixed]
        tx-checksum-sctp: off [fixed]
scatter-gather: on
        tx-scatter-gather: on
        tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
        tx-tcp-segmentation: on
        tx-tcp-ecn-segmentation: on
        tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on

In guest:
[root@oolong ~]# ethtool -k eth0| head -18
Features for eth0:
rx-checksumming: on [fixed]
tx-checksumming: on
        tx-checksum-ipv4: off [fixed]
        tx-checksum-ip-generic: on
        tx-checksum-ipv6: off [fixed]
        tx-checksum-fcoe-crc: off [fixed]
        tx-checksum-sctp: off [fixed]
scatter-gather: on
        tx-scatter-gather: on
        tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
        tx-tcp-segmentation: on
        tx-tcp-ecn-segmentation: on
        tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on

2. Using update-device to update offloads for a NIC
[root@localhost ~]# cat nic.xml
<interface type='network'>
  <mac address='52:54:00:66:70:90'/>
  <source network='default'/>
  <model type='virtio'/>
  <driver>
    <host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
    <guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
  </driver>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
[root@localhost ~]# virsh update-device r7 nic.xml
Device updated successfully                                        

3. Check the results
[root@localhost ~]# virsh dumpxml r7| grep "/interface" -B15
    <interface type='network'>
      <mac address='52:54:00:66:70:90'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

In host:
[root@localhost ~]# ethtool -k vnet0| head -18
Features for vnet0:
rx-checksumming: off [fixed]
tx-checksumming: on
        tx-checksum-ipv4: off [fixed]
        tx-checksum-ip-generic: on
        tx-checksum-ipv6: off [fixed]
        tx-checksum-fcoe-crc: off [fixed]
        tx-checksum-sctp: off [fixed]
scatter-gather: on
        tx-scatter-gather: on
        tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
        tx-tcp-segmentation: on
        tx-tcp-ecn-segmentation: on
        tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on

In guest:
[root@oolong ~]# ethtool -k eth0| head -18
Features for eth0:
rx-checksumming: on [fixed]
tx-checksumming: on
        tx-checksum-ipv4: off [fixed]
        tx-checksum-ip-generic: on
        tx-checksum-ipv6: off [fixed]
        tx-checksum-fcoe-crc: off [fixed]
        tx-checksum-sctp: off [fixed]
scatter-gather: on
        tx-scatter-gather: on
        tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
        tx-tcp-segmentation: on
        tx-tcp-ecn-segmentation: on
        tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on

Actual results:
As shown above steps, report update successfully, but do nothing.

Expected results:
1. If libvirt does not support offloads on the fly, please reject such action, like
[root@localhost ~]# cat nic.xml
<interface type='network'>
  <mac address='52:54:00:66:70:90'/>
  <source network='default'/>
  <model type='virtio'/>
  <driver queues='5'/>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
[root@localhost ~]# virsh update-device r7 nic.xml
error: Failed to update device from nic.xml
error: Operation not supported: cannot modify virtio network device driver attributes

2. If libvirt supports it, please do it exactly.

libvirt should either update it or report an error rather than just ignoring it.

Additional info:

Comment 2 Ján Tomko 2014-10-30 13:03:53 UTC
Upstream patch:
https://www.redhat.com/archives/libvir-list/2014-October/msg01048.html

Comment 3 Ján Tomko 2014-10-30 16:19:43 UTC
Now pushed upstream:
commit 4abcf04e7c01ddc1b0a92a4a25d829c51ceadac9
Author:     Ján Tomko <jtomko>
CommitDate: 2014-10-30 13:32:00 +0100

    Reject live update of offloading options
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1155441

git describe: v1.2.10-rc1-20-g4abcf04

Comment 6 lcheng 2014-11-06 03:29:56 UTC
I can reproduce this bug with libvirt-1.2.8-5.el7.

Steps:
1. Define a guest, and print the offloads info
In host:
[root@localhost ~]# virsh start rhel7.0
Domain rhel7.0 started

[root@localhost ~]# virsh dumpxml rhel7.0 | grep interface -A10
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

[root@localhost ~]# ethtool -k vnet0 | head -18
Features for vnet0:
rx-checksumming: off [fixed]
tx-checksumming: on
	tx-checksum-ipv4: off [fixed]
	tx-checksum-ip-generic: on
	tx-checksum-ipv6: off [fixed]
	tx-checksum-fcoe-crc: off [fixed]
	tx-checksum-sctp: off [fixed]
scatter-gather: on
	tx-scatter-gather: on
	tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
	tx-tcp-segmentation: on
	tx-tcp-ecn-segmentation: on
	tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on


In guest:
[root@localhost ~]# ethtool -k eth0 | head -18
Features for eth0:
rx-checksumming: on [fixed]
tx-checksumming: on
	tx-checksum-ipv4: off [fixed]
	tx-checksum-ip-generic: on
	tx-checksum-ipv6: off [fixed]
	tx-checksum-fcoe-crc: off [fixed]
	tx-checksum-sctp: off [fixed]
scatter-gather: on
	tx-scatter-gather: on
	tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
	tx-tcp-segmentation: on
	tx-tcp-ecn-segmentation: on
	tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on


2. Using update-device to update offloads for a NIC
In host:
[root@localhost ~]# cat nic.xml
<interface type='network'>
  <mac address='52:54:00:db:0c:00'/>
  <source network='default'/>
  <model type='virtio'/>
  <driver>
    <host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
    <guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
  </driver>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

[root@localhost ~]# virsh update-device rhel7.0 nic.xml
Device updated successfully


3. Check the results
In host:
[root@localhost ~]# virsh dumpxml rhel7.0 | grep interface -A10
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

[root@localhost ~]# ethtool -k vnet0 | head -18
Features for vnet0:
rx-checksumming: off [fixed]
tx-checksumming: on
	tx-checksum-ipv4: off [fixed]
	tx-checksum-ip-generic: on
	tx-checksum-ipv6: off [fixed]
	tx-checksum-fcoe-crc: off [fixed]
	tx-checksum-sctp: off [fixed]
scatter-gather: on
	tx-scatter-gather: on
	tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
	tx-tcp-segmentation: on
	tx-tcp-ecn-segmentation: on
	tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on


In guest:
[root@localhost ~]# ethtool -k eth0 | head -18
Features for eth0:
rx-checksumming: on [fixed]
tx-checksumming: on
	tx-checksum-ipv4: off [fixed]
	tx-checksum-ip-generic: on
	tx-checksum-ipv6: off [fixed]
	tx-checksum-fcoe-crc: off [fixed]
	tx-checksum-sctp: off [fixed]
scatter-gather: on
	tx-scatter-gather: on
	tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
	tx-tcp-segmentation: on
	tx-tcp-ecn-segmentation: on
	tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on



--------------------------------------------

And verify this bug with libvirt-1.2.8-6.el7. Libvirt does not support offloads on the fly. Move this bug status to VERIFIED.


Steps:
1. Define a guest, and print the offloads info
In host:
[root@localhost ~]# virsh start rhel7.0
Domain rhel7.0 started

[root@localhost ~]# virsh dumpxml rhel7.0 | grep interface -A10
    <interface type='network'>
      <mac address='52:54:00:db:0c:00'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
...

[root@localhost ~]# ethtool -k vnet0 | head -18
Features for vnet0:
rx-checksumming: off [fixed]
tx-checksumming: on
	tx-checksum-ipv4: off [fixed]
	tx-checksum-ip-generic: on
	tx-checksum-ipv6: off [fixed]
	tx-checksum-fcoe-crc: off [fixed]
	tx-checksum-sctp: off [fixed]
scatter-gather: on
	tx-scatter-gather: on
	tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
	tx-tcp-segmentation: on
	tx-tcp-ecn-segmentation: on
	tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on


In guest:
[root@localhost ~]# ethtool -k eth0 | head -18
Features for eth0:
rx-checksumming: on [fixed]
tx-checksumming: on
	tx-checksum-ipv4: off [fixed]
	tx-checksum-ip-generic: on
	tx-checksum-ipv6: off [fixed]
	tx-checksum-fcoe-crc: off [fixed]
	tx-checksum-sctp: off [fixed]
scatter-gather: on
	tx-scatter-gather: on
	tx-scatter-gather-fraglist: on
tcp-segmentation-offload: on
	tx-tcp-segmentation: on
	tx-tcp-ecn-segmentation: on
	tx-tcp6-segmentation: on
udp-fragmentation-offload: on
generic-segmentation-offload: on
generic-receive-offload: on


2. Using update-device to update offloads for a NIC
In host:
[root@localhost ~]# cat nic.xml 
<interface type='network'>
  <mac address='52:54:00:db:0c:00'/>
  <source network='default'/>
  <model type='virtio'/>
  <driver>
    <host csum='off' gso='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
    <guest csum='off' tso4='off' tso6='off' ecn='off' ufo='off'/>
  </driver>
  <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>

[root@localhost ~]# virsh update-device rhel7.0 nic.xml
error: Failed to update device from nic.xml
error: Operation not supported: cannot modify virtio network device driver attributes

Comment 8 errata-xmlrpc 2015-03-05 07:46:28 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHSA-2015-0323.html