Patchwork vlan: enable GRO if real_dev supports it

login
register
mail settings
Submitter Brandon Philips
Date Sept. 15, 2010, 4:37 p.m.
Message ID <20100915163749.GA4191@mmm.home.ifup.org>
Download mbox | patch
Permalink /patch/64849/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Brandon Philips - Sept. 15, 2010, 4:37 p.m.
Currently vlan devices don't have GRO by default as none of the Ethernet
drivers add NETIF_F_GRO to their vlan_features.

As GRO is a software feature just propogate GRO from the real_dev in the
vlan core. There is no need to have the drivers each add NETIF_F_GRO to
their vlan_features.

Signed-off-by: Brandon Philips <bphilips@suse.de>
---
 net/8021q/vlan_dev.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
Eric Dumazet - Sept. 15, 2010, 5:08 p.m.
Le mercredi 15 septembre 2010 à 09:37 -0700, Brandon Philips a écrit :
> Currently vlan devices don't have GRO by default as none of the Ethernet
> drivers add NETIF_F_GRO to their vlan_features.
> 
> As GRO is a software feature just propogate GRO from the real_dev in the
> vlan core. There is no need to have the drivers each add NETIF_F_GRO to
> their vlan_features.
> 
> Signed-off-by: Brandon Philips <bphilips@suse.de>
> ---
>  net/8021q/vlan_dev.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> index 3bccdd1..6fbc445 100644
> --- a/net/8021q/vlan_dev.c
> +++ b/net/8021q/vlan_dev.c
> @@ -735,6 +735,7 @@ static int vlan_dev_init(struct net_device *dev)
>  					  (1<<__LINK_STATE_DORMANT))) |
>  		      (1<<__LINK_STATE_PRESENT);
>  
> +	dev->features |= real_dev->features & NETIF_F_GRO;
>  	dev->features |= real_dev->features & real_dev->vlan_features;
>  	dev->gso_max_size = real_dev->gso_max_size;
>  

Hmm, this is only part of a generic solution.

If I enable gro with "ethtool -K eth0 gro on", should we propagate GRO
on vlan eth0.555 ?



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Sept. 15, 2010, 5:14 p.m.
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 15 Sep 2010 19:08:40 +0200

> Le mercredi 15 septembre 2010 à 09:37 -0700, Brandon Philips a écrit :
>> Currently vlan devices don't have GRO by default as none of the Ethernet
>> drivers add NETIF_F_GRO to their vlan_features.
>> 
>> As GRO is a software feature just propogate GRO from the real_dev in the
>> vlan core. There is no need to have the drivers each add NETIF_F_GRO to
>> their vlan_features.
>> 
>> Signed-off-by: Brandon Philips <bphilips@suse.de>
>> ---
>>  net/8021q/vlan_dev.c |    1 +
>>  1 files changed, 1 insertions(+), 0 deletions(-)
>> 
>> diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
>> index 3bccdd1..6fbc445 100644
>> --- a/net/8021q/vlan_dev.c
>> +++ b/net/8021q/vlan_dev.c
>> @@ -735,6 +735,7 @@ static int vlan_dev_init(struct net_device *dev)
>>  					  (1<<__LINK_STATE_DORMANT))) |
>>  		      (1<<__LINK_STATE_PRESENT);
>>  
>> +	dev->features |= real_dev->features & NETIF_F_GRO;
>>  	dev->features |= real_dev->features & real_dev->vlan_features;
>>  	dev->gso_max_size = real_dev->gso_max_size;
>>  
> 
> Hmm, this is only part of a generic solution.
> 
> If I enable gro with "ethtool -K eth0 gro on", should we propagate GRO
> on vlan eth0.555 ?

I think a better way to implement this is to set NETIF_F_GRO in
netdev->vlan_features at register_netdev() time if it is set in
netdev->features

That is the implementation I was implying earlier in this thread.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Hutchings - Sept. 15, 2010, 5:24 p.m.
On Wed, 2010-09-15 at 10:14 -0700, David Miller wrote:
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Wed, 15 Sep 2010 19:08:40 +0200
> 
> > Le mercredi 15 septembre 2010 à 09:37 -0700, Brandon Philips a écrit :
> >> Currently vlan devices don't have GRO by default as none of the Ethernet
> >> drivers add NETIF_F_GRO to their vlan_features.
> >> 
> >> As GRO is a software feature just propogate GRO from the real_dev in the
> >> vlan core. There is no need to have the drivers each add NETIF_F_GRO to
> >> their vlan_features.
> >> 
> >> Signed-off-by: Brandon Philips <bphilips@suse.de>
> >> ---
> >>  net/8021q/vlan_dev.c |    1 +
> >>  1 files changed, 1 insertions(+), 0 deletions(-)
> >> 
> >> diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> >> index 3bccdd1..6fbc445 100644
> >> --- a/net/8021q/vlan_dev.c
> >> +++ b/net/8021q/vlan_dev.c
> >> @@ -735,6 +735,7 @@ static int vlan_dev_init(struct net_device *dev)
> >>  					  (1<<__LINK_STATE_DORMANT))) |
> >>  		      (1<<__LINK_STATE_PRESENT);
> >>  
> >> +	dev->features |= real_dev->features & NETIF_F_GRO;
> >>  	dev->features |= real_dev->features & real_dev->vlan_features;
> >>  	dev->gso_max_size = real_dev->gso_max_size;
> >>  
> > 
> > Hmm, this is only part of a generic solution.
> > 
> > If I enable gro with "ethtool -K eth0 gro on", should we propagate GRO
> > on vlan eth0.555 ?
> 
> I think a better way to implement this is to set NETIF_F_GRO in
> netdev->vlan_features at register_netdev() time if it is set in
> netdev->features
> 
> That is the implementation I was implying earlier in this thread.

We can even add it unconditionally there, since we only ever use
dev->features & dev->vlan_features.

Ben.
David Miller - Sept. 15, 2010, 5:29 p.m.
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Wed, 15 Sep 2010 18:24:36 +0100

> On Wed, 2010-09-15 at 10:14 -0700, David Miller wrote:
>> I think a better way to implement this is to set NETIF_F_GRO in
>> netdev->vlan_features at register_netdev() time if it is set in
>> netdev->features
>> 
>> That is the implementation I was implying earlier in this thread.
> 
> We can even add it unconditionally there, since we only ever use
> dev->features & dev->vlan_features.

Good point!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Brandon Philips - Sept. 15, 2010, 6:59 p.m.
On 19:08 Wed 15 Sep 2010, Eric Dumazet wrote:
> Le mercredi 15 septembre 2010 à 09:37 -0700, Brandon Philips a écrit :
> > Currently vlan devices don't have GRO by default as none of the Ethernet
> > drivers add NETIF_F_GRO to their vlan_features.
> > 
> > As GRO is a software feature just propogate GRO from the real_dev in the
> > vlan core. There is no need to have the drivers each add NETIF_F_GRO to
> > their vlan_features.
> > 
> > Signed-off-by: Brandon Philips <bphilips@suse.de>
> > ---
> >  net/8021q/vlan_dev.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
> > index 3bccdd1..6fbc445 100644
> > --- a/net/8021q/vlan_dev.c
> > +++ b/net/8021q/vlan_dev.c
> > @@ -735,6 +735,7 @@ static int vlan_dev_init(struct net_device *dev)
> >  					  (1<<__LINK_STATE_DORMANT))) |
> >  		      (1<<__LINK_STATE_PRESENT);
> >  
> > +	dev->features |= real_dev->features & NETIF_F_GRO;
> >  	dev->features |= real_dev->features & real_dev->vlan_features;
> >  	dev->gso_max_size = real_dev->gso_max_size;
> >  
> 
> Hmm, this is only part of a generic solution.
> 
> If I enable gro with "ethtool -K eth0 gro on", should we propagate GRO
> on vlan eth0.555 ?

That works fine as far as I can see. I don't think it should go the
other way though. 

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

Patch

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 3bccdd1..6fbc445 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -735,6 +735,7 @@  static int vlan_dev_init(struct net_device *dev)
 					  (1<<__LINK_STATE_DORMANT))) |
 		      (1<<__LINK_STATE_PRESENT);
 
+	dev->features |= real_dev->features & NETIF_F_GRO;
 	dev->features |= real_dev->features & real_dev->vlan_features;
 	dev->gso_max_size = real_dev->gso_max_size;