All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-2.6] net: bug fix for vlan + gro issue
@ 2010-02-12  5:34 Ajit Khaparde
  2010-02-16 11:40 ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Ajit Khaparde @ 2010-02-12  5:34 UTC (permalink / raw)
  To: davem, kaber, herbert; +Cc: Ajit Khaparde, netdev

Traffic doesn't start on a vlan interface when gro is enabled.
Even the tcp handshake was not taking place.
This is because, the eth_type_trans() call before the netif_receive_skb()
in napi_frags_finish() resets the skb->dev to napi->dev from the previously
set vlan netdev interface. This causes the ip_route_input() to drop the
incoming packet considering it as a packet coming from a martian source.

I could repro this on 2.6.32.7 (stable) and 2.6.33-rc7.
With this fix, the traffic starts and the test runs fine. Please review.

Alternatively:
Previously the skb->dev was updated by the driver and I don't know
why it has to be set in eth_type_trans. May be removing that from
eth_type_trans() and expecting the caller to set the skb->dev could be
an alternative fix.

Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
 net/core/dev.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index be9924f..16aac06 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2761,7 +2761,10 @@ gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb,
 	switch (ret) {
 	case GRO_NORMAL:
 	case GRO_HELD:
-		skb->protocol = eth_type_trans(skb, napi->dev);
+		if (skb->vlan_tci)
+			skb->protocol = eth_type_trans(skb, skb->dev);
+		else
+			skb->protocol = eth_type_trans(skb, napi->dev);
 
 		if (ret == GRO_HELD)
 			skb_gro_pull(skb, -ETH_HLEN);
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-2.6] net: bug fix for vlan + gro issue
  2010-02-12  5:34 [PATCH net-2.6] net: bug fix for vlan + gro issue Ajit Khaparde
@ 2010-02-16 11:40 ` Herbert Xu
  2010-02-17  6:25   ` Ajit Khaparde
  0 siblings, 1 reply; 5+ messages in thread
From: Herbert Xu @ 2010-02-16 11:40 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: davem, kaber, netdev

On Fri, Feb 12, 2010 at 11:04:53AM +0530, Ajit Khaparde wrote:
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index be9924f..16aac06 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2761,7 +2761,10 @@ gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb,
>  	switch (ret) {
>  	case GRO_NORMAL:
>  	case GRO_HELD:
> -		skb->protocol = eth_type_trans(skb, napi->dev);
> +		if (skb->vlan_tci)
> +			skb->protocol = eth_type_trans(skb, skb->dev);
> +		else
> +			skb->protocol = eth_type_trans(skb, napi->dev);

We should be able to just use skb->dev here.

Thanks!
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-2.6] net: bug fix for vlan + gro issue
  2010-02-16 11:40 ` Herbert Xu
@ 2010-02-17  6:25   ` Ajit Khaparde
  2010-02-17  6:40     ` Herbert Xu
  2010-02-18  0:02     ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Ajit Khaparde @ 2010-02-17  6:25 UTC (permalink / raw)
  To: Herbert Xu; +Cc: davem, kaber, netdev

On 16/02/10 19:40 +0800, Herbert Xu wrote:
> On Fri, Feb 12, 2010 at 11:04:53AM +0530, Ajit Khaparde wrote:
> >
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index be9924f..16aac06 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -2761,7 +2761,10 @@ gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb,
> >  	switch (ret) {
> >  	case GRO_NORMAL:
> >  	case GRO_HELD:
> > -		skb->protocol = eth_type_trans(skb, napi->dev);
> > +		if (skb->vlan_tci)
> > +			skb->protocol = eth_type_trans(skb, skb->dev);
> > +		else
> > +			skb->protocol = eth_type_trans(skb, napi->dev);
> 
> We should be able to just use skb->dev here.

Thanks Herbert. I think you meant something like this:
+		skb->protocol = eth_type_trans(skb, skb->dev);

Here is the patch:-

Traffic (tcp) doesnot start on a vlan interface when gro is enabled.
Even the tcp handshake was not taking place.
This is because, the eth_type_trans call before the netif_receive_skb
in napi_gro_finish() resets the skb->dev to napi->dev from the previously
set vlan netdev interface. This causes the ip_route_input to drop the
incoming packet considering it as a packet coming from a martian source.

I could repro this on 2.6.32.7 (stable) and 2.6.33-rc7.
With this fix, the traffic starts and the test runs fine on both vlan
and non-vlan interfaces.

CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: Patrick McHardy <kaber@trash.net>
Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>
---
 net/core/dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index be9924f..ec87421 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2761,7 +2761,7 @@ gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb,
 	switch (ret) {
 	case GRO_NORMAL:
 	case GRO_HELD:
-		skb->protocol = eth_type_trans(skb, napi->dev);
+		skb->protocol = eth_type_trans(skb, skb->dev);
 
 		if (ret == GRO_HELD)
 			skb_gro_pull(skb, -ETH_HLEN);
-- 
1.6.3.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-2.6] net: bug fix for vlan + gro issue
  2010-02-17  6:25   ` Ajit Khaparde
@ 2010-02-17  6:40     ` Herbert Xu
  2010-02-18  0:02     ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2010-02-17  6:40 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: davem, kaber, netdev

On Wed, Feb 17, 2010 at 11:55:43AM +0530, Ajit Khaparde wrote:
>
> Here is the patch:-
> 
> Traffic (tcp) doesnot start on a vlan interface when gro is enabled.
> Even the tcp handshake was not taking place.
> This is because, the eth_type_trans call before the netif_receive_skb
> in napi_gro_finish() resets the skb->dev to napi->dev from the previously
> set vlan netdev interface. This causes the ip_route_input to drop the
> incoming packet considering it as a packet coming from a martian source.
> 
> I could repro this on 2.6.32.7 (stable) and 2.6.33-rc7.
> With this fix, the traffic starts and the test runs fine on both vlan
> and non-vlan interfaces.
> 
> CC: Herbert Xu <herbert@gondor.apana.org.au>
> CC: Patrick McHardy <kaber@trash.net>
> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Thanks a lot!
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-2.6] net: bug fix for vlan + gro issue
  2010-02-17  6:25   ` Ajit Khaparde
  2010-02-17  6:40     ` Herbert Xu
@ 2010-02-18  0:02     ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2010-02-18  0:02 UTC (permalink / raw)
  To: ajitk, ajitkhaparde; +Cc: herbert, kaber, netdev

From: Ajit Khaparde <ajitkhaparde@gmail.com>
Date: Wed, 17 Feb 2010 11:55:43 +0530

> Thanks Herbert. I think you meant something like this:
> +		skb->protocol = eth_type_trans(skb, skb->dev);
> 
> Here is the patch:-
> 
> Traffic (tcp) doesnot start on a vlan interface when gro is enabled.
> Even the tcp handshake was not taking place.
> This is because, the eth_type_trans call before the netif_receive_skb
> in napi_gro_finish() resets the skb->dev to napi->dev from the previously
> set vlan netdev interface. This causes the ip_route_input to drop the
> incoming packet considering it as a packet coming from a martian source.
> 
> I could repro this on 2.6.32.7 (stable) and 2.6.33-rc7.
> With this fix, the traffic starts and the test runs fine on both vlan
> and non-vlan interfaces.
> 
> CC: Herbert Xu <herbert@gondor.apana.org.au>
> CC: Patrick McHardy <kaber@trash.net>
> Signed-off-by: Ajit Khaparde <ajitk@serverengines.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-02-18  0:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-12  5:34 [PATCH net-2.6] net: bug fix for vlan + gro issue Ajit Khaparde
2010-02-16 11:40 ` Herbert Xu
2010-02-17  6:25   ` Ajit Khaparde
2010-02-17  6:40     ` Herbert Xu
2010-02-18  0:02     ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.