Re: tun offloads bug

2017-03-16 Thread Yaroslav Isakov
Sorry for this mess! I'll do it properly this time, I hope :)

2017-03-16 22:12 GMT+03:00 David Miller :
>
> This is not how you resubmit a patch.
>
> You must make a fresh patch posting to the mailing list, provide the
> commit message and patch as inline text, and not do it as a reply to
> another posting.
>
> Thank you.


Re: tun offloads bug

2017-03-16 Thread David Miller

This is not how you resubmit a patch.

You must make a fresh patch posting to the mailing list, provide the
commit message and patch as inline text, and not do it as a reply to
another posting.

Thank you.


Re: tun offloads bug

2017-03-16 Thread Yaroslav Isakov
Hello! I'm sending new patch, with proper formatting and signed tag

2017-03-08 23:29 GMT+03:00 Yaroslav Isakov :
> 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.
From 12a5079ef6172c32ac19b606310db151c7ca3e5d Mon Sep 17 00:00:00 2001
From: Yaroslav Isakov 
Date: Thu, 16 Mar 2017 21:08:37 +0300
Subject: [PATCH] tun: fix inability to set offloads after disabling them via
 ethtool

From: Yaroslav Isakov 

Added missing logic in tun driver, which prevents apps to set
offloads using tun ioctl, if offloads were previously disabled via ethtool

Signed-off-by: Yaroslav Isakov 
---
 drivers/net/tun.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 34cc3c5..cc88cd7 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1931,6 +1931,8 @@ static int set_offload(struct tun_struct *tun, unsigned long arg)
 		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;
-- 
2.10.2



Re: tun offloads bug

2017-03-12 Thread David Miller
From: Yaroslav Isakov 
Date: Wed, 8 Mar 2017 23:29:53 +0300

> 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.

Please read Documentation/SubmittingPatches for the proper way to
submit a patch.

In particular you have to provide a proper signoff tag.

Thank you.


tun offloads bug

2017-03-08 Thread Yaroslav Isakov
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;