Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Patrick McHardy <kaber@trash.net>
Subject: Re: [PATCH v2] vlan: allow TSO setting on vlan interfaces
Date: Thu, 08 Jul 2010 18:03:05 +0200	[thread overview]
Message-ID: <1278604985.2651.35.camel@edumazet-laptop> (raw)
In-Reply-To: <1278603804.16013.24.camel@achroite.uk.solarflarecom.com>

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@gmail.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()



  parent reply	other threads:[~2010-07-08 16:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 17:14 [PATCH] vlan: allow TSO setting on vlan interfaces Eric Dumazet
2010-07-07 17:25 ` Ben Hutchings
2010-07-08  6:46   ` Eric Dumazet
2010-07-08  9:39     ` [PATCH v2] " Eric Dumazet
2010-07-08 15:43       ` Ben Hutchings
2010-07-08 15:49         ` Ben Hutchings
2010-07-08 15:55           ` Patrick McHardy
2010-07-08 16:04             ` Eric Dumazet
2010-07-08 16:00           ` Eric Dumazet
2010-07-08 16:05             ` Ben Hutchings
2010-07-08 16:12               ` Eric Dumazet
2010-07-08 16:03         ` Eric Dumazet [this message]
2010-07-08 16:37           ` [PATCH v3] " Eric Dumazet
2010-07-08 18:25             ` Ben Hutchings
2010-07-09  6:10               ` David Miller
2010-07-09  6:10       ` [PATCH v2] " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1278604985.2651.35.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox