Bug 1387477 - virtual interface offload for virtio - disable host ufo only will not work
virtual interface offload for virtio - disable host ufo only will not work
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.4
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Wei
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-10-20 22:12 EDT by yalzhang@redhat.com
Modified: 2016-12-19 07:08 EST (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-12-08 07:07:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description yalzhang@redhat.com 2016-10-20 22:12:38 EDT
Description of problem:
when set offloads for virtual interface, if only disable UDP related offloads, after set ufo='off' both for host and guest, the "udp-fragmentation-offload" is still on in the guest.

Version-Release number of selected component (if applicable):
libvirt-2.0.0-10.el7.x86_64
qemu-kvm-rhev-2.6.0-28.el7.x86_64
kernel-3.10.0-510.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1. set ufo=off both on guest and host, the <host ufo='off'/> will not work(check on guest).

# virsh dumpxml r7 | grep /interface -B6
      <driver>
        <host ufo='off'/>
        <guest ufo='off'/>
      </driver>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

# ps -aux | grep qemu-kvm
...
-netdev tap,fd=27,id=hostnet0,vhost=on,vhostfd=29 -device virtio-net-pci,host_ufo=off,guest_ufo=off,netdev=hostnet0,id=net0,mac=52:54:00:36:c6:d0,bus=pci.0,addr=0x3 
...

2. On the guest:
# 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: off [fixed]
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

# ethtool -K eth0 ufo off
# ethtool -k eth0 | grep udp-fragmentation
udp-fragmentation-offload: off

3. set gso=on and ufo=off, it works.
# virsh dumpxml r7.3 | grep /interface -B11
    <interface type='network'>
      <mac address='52:54:00:12:fc:9e'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <driver>
        <host gso='off' ufo='off'/>
        <guest ufo='off'/>
      </driver>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>

on guest:
# ethtool -k eth0
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: off [fixed]
tcp-segmentation-offload: on
	tx-tcp-segmentation: on
	tx-tcp-ecn-segmentation: on
	tx-tcp6-segmentation: on
** udp-fragmentation-offload: off [fixed] **
......


Actual results:
In step 2, the udp-fragmentation-offload if on,but in the xml we set <host ufo='off'/>

Expected results:
In step 2, the udp-fragmentation-offload should be off

Additional info:
Have asked this question on this bug, and mst have provided some valuable information https://bugzilla.redhat.com/show_bug.cgi?id=1139364#c18
Comment 2 Wei 2016-11-01 12:17:00 EDT
Yal,
I have tried it with upstream, it doesn't work even with your step 3, can you share your test machine with me?

My cases:
-device virtio-net-pci,host_ufo=off,gso=off,guest_ufo=off,netdev=hn1,mac=52:54:00:11:22:10 

-device virtio-net-pci,host_ufo=off,guest_ufo=off,netdev=hn1,mac=52:54:00:11:22:10 

-device virtio-net-pci,guest_ufo=off,netdev=hn1,mac=52:54:00:11:22:10 \

BTW, can you add me to the cc list of bug 1139364 as well? Seems I don't have permission to access the bz.
Comment 3 Wei 2016-11-01 12:21:04 EDT
Just noticed you were using 'gso=on', also tried that, not working for upstream.

-device virtio-net-pci,host_ufo=off,gso=on,guest_ufo=off,netdev=hn1,mac=52:54:00:11:22:10 \
-device virtio-net-pci,host_ufo=off,gso=off,guest_ufo=off,netdev=hn1,mac=52:54:00:11:22:10 \
-device virtio-net-pci,host_ufo=off,guest_ufo=off,netdev=hn1,mac=52:54:00:11:22:10 \
-device virtio-net-pci,guest_ufo=on,netdev=hn1,mac=52:54:00:11:22:10 \
-device virtio-net-pci,guest_ufo=off,netdev=hn1,mac=52:54:00:11:22:10 \
Comment 4 Wei 2016-11-02 02:44:09 EDT
A bit correction, ufo can only be turned  off via  'host_ufo=off,gso=off,guest_ufo=off'.

From guest's point of view, 'ufo' depends on gso, ufo will turned on if gso has been enabled.

For host side, ufo depends on host ufo as well.

Looks this is by design when probing virtio net device in guest, thus it is not a bug.


if (virtio_has_feature(vdev, VIRTIO_NET_F_GSO)) {
    dev->hw_features |= NETIF_F_TSO | NETIF_F_UFO
        | NETIF_F_TSO_ECN | NETIF_F_TSO6;
}
/* Individual feature bits: what can host handle? */
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO4))
    dev->hw_features |= NETIF_F_TSO;
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_TSO6))
    dev->hw_features |= NETIF_F_TSO6;
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN))
    dev->hw_features |= NETIF_F_TSO_ECN;
if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_UFO))
    dev->hw_features |= NETIF_F_UFO;
Comment 5 jason wang 2016-11-02 03:23:47 EDT
Yes, this looks not like a bug. If you're checking guest ufo (TX) through ethtool, it has nothing to do with guest_ufo (RX).
Comment 6 yalzhang@redhat.com 2016-12-02 02:57:19 EST
Many thanks to jason and Wei, I think I got the meaning. It is not a bug but a wrong usage, it is something about the principle of GSO/TSO/UFO. 
If I want to disable ufo for the guest(both transmit and receive), I should set gso=off together, the xml should like this:

  <driver>
        <host gso='off' ufo='off'/>  ===> for receive
        <guest ufo='off'/>   ====> for transmit
      </driver>

If I want to disable tcp related segments for guest, the xml should be like:

  <driver>
        <host gso='off' tso4='off' tso6='off' ecn='off'/>  ===> for receive
        <guest tso4='off' tso6='off' ecn='off'/> ====> for transmit
      </driver>

Both of them should include the "gso='off'" because tso and gso all depends on gso. Please help to check if I get the point, thank you very much!
Comment 7 Wei 2016-12-07 22:33:30 EST
that is it.

Note You need to log in before you can comment on or make changes to this bug.