Hello!
I've found a bug in TUN/TAP driver with offloads - when Qemu is trying
to set offloads on tap device, there is no error, but offloads are not
appied.

The cause of this is that udev in recent systemd is using ethtool to
disable offloads. So, udev is setting tun->dev->wanted_features via
ethtool ioctl to disable TSO, but when qemu is trying to set offloads,
it's using TUN/TAP ioctl which is not setting wanted_features, so
netdev_update_features will not see features qemu wants.

This can be easily reproduced - just run qemu with
guest_tso4=on,guest_tso6=on on systemd with systemd>=226 and after
booting the VM, ethtool -k tap0 will show that TSO4 is disabled and
TSO6 is enabled (systemd is not touching TSO6, that's why it's not
affected at all)
I've attached pretty trivial patch to fix this problem.
--- tun.c	2017-03-08 23:19:40.117615235 +0300
+++ tun.c.new	2017-03-08 23:20:12.886749195 +0300
@@ -1919,6 +1919,8 @@
 		return -EINVAL;
 
 	tun->set_features = features;
+	tun->dev->wanted_features &= ~TUN_USER_FEATURES;
+	tun->dev->wanted_features |= features;
 	netdev_update_features(tun->dev);
 
 	return 0;

Reply via email to