Skip to contentSkip to conversation

net: bug fix for vlan + gro issue

PATCH Applied Ajit Khaparde 3 participants 5 messages Feb 12, 2010 – Feb 18, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: bug fix for vlan + gro issue

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.

---
 net/core/dev.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
net/core/dev.c +4 -1
index be9924f..16aac06 100644
@@ -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);
Signature · 1 line
1.6.3.3
#1 lore raw
Quoted 6 lines · Ajit Khaparde
net/core/dev.c +0 -0
index be9924f..16aac06 100644

net/core/dev.c gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, · line 2767

Quoted 8 lines
net/core/dev.c +4 -1
@@ -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!

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#2 lore raw
Quoted 17 lines · Herbert Xu
Quoted 6 lines · Ajit Khaparde
net/core/dev.c +0 -0
index be9924f..16aac06 100644

net/core/dev.c gro_result_t napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, · line 2767

Quoted 8 lines
net/core/dev.c +4 -1
@@ -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 <[email protected]>
CC Patrick McHardy <[email protected]>
---
 net/core/dev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
net/core/dev.c +1 -1
index be9924f..ec87421 100644
@@ -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);
Signature · 1 line
1.6.3.3
#3 lore raw
Quoted 10 lines · Ajit Khaparde

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.

Quoted 7 lines

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 <[email protected]>
CC Patrick McHardy <[email protected]>

Thanks a lot!

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
maintainer Applied
#4 lore raw
In reply to Ajit Khaparde

From: Ajit Khaparde <[email protected]>
Date: Wed, 17 Feb 2010 11:55:43 +0530

Quoted 12 lines

Thanks Herbert. I think you meant something like this:

net/core/dev.c +1 -0
+		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.

Quoted 7 lines

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 <[email protected]>
CC Patrick McHardy <[email protected]>

Applied, thanks.