lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1278604985.2651.35.camel@edumazet-laptop>
Date:	Thu, 08 Jul 2010 18:03:05 +0200
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	Ben Hutchings <bhutchings@...arflare.com>
Cc:	David Miller <davem@...emloft.net>,
	netdev <netdev@...r.kernel.org>,
	Patrick McHardy <kaber@...sh.net>
Subject: Re: [PATCH v2] vlan: allow TSO setting on vlan interfaces

Le jeudi 08 juillet 2010 à 16:43 +0100, Ben Hutchings a écrit :
> On Thu, 2010-07-08 at 11:39 +0200, Eric Dumazet wrote:
> > When we need to shape traffic with low speeds, we need to disable tso on
> > network interface :
> > 
> > ethtool -K eth0.2240 tso off
> > 
> > It seems vlan interfaces miss the set_tso() ethtool method.
> > Propagating tso changes from lower device is not always wanted, some
> > vlans want TSO on, others want TSO off.
> > 
> > Before enabling TSO, we must check real device supports it.
> > 
> > Signed-off-by: Eric Dumazet <eric.dumazet@...il.com>
> > ---
> >  net/8021q/vlan_dev.c |   13 +++++++++++++
> >  1 file changed, 13 insertions(+)
> > 
> > diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> > index c6456cb..870bc53 100644
> > --- a/net/8021q/vlan_dev.c
> > +++ b/net/8021q/vlan_dev.c
> > @@ -838,12 +838,25 @@ static struct rtnl_link_stats64 *vlan_dev_get_stats64(struct net_device *dev)
> >  	return stats;
> >  }
> >  
> > +static int vlan_ethtool_set_tso(struct net_device *dev, u32 data)
> > +{
> > +	if (data) {
> > +		struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
> > +		unsigned long rdev_vfeatures = real_dev->features & real_dev->vlan_features;
> > +
> > +		dev->features |= (NETIF_F_TSO & rdev_vfeatures);
> > +	} else
> > +		dev->features &= ~NETIF_F_TSO;
> > +	return 0;
> > +}
> [...]
> 
> This should not silently ignore attempts to enable TSO.  I think it
> should be something like:
> 
> static int vlan_ethtool_set_tso(struct net_device *dev, u32 data)
> {
> 	if (data) {
> 		struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
> 
> 		/* Underlying device must support TSO for VLAN-tagged packets
> 		 * and must have TSO enabled now. */
> 		if (!(real_dev->vlan_features & NETIF_F_TSO))
> 			return -EOPNOTSUPP;
> 		if (!(real_dev->features & NETIF_F_TSO))
> 			return -EINVAL;
> 
> 		dev->features |= NETIF_F_TSO;
> 	} else {
> 		dev->features &= ~NETIF_F_TSO;
> 	}
> 
> 	return 0;
> }

I agree.

What about other TSO flags like NETIF_F_TSO6 & NETIF_F_TSO_ECN ?

Not sure if we should manipulate them in set_tso()


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ