Re: [PATCH] sky2: don't do GRO on second port

Eric Dumazet
2010-09-02T10:41:50Z

Le jeudi 02 septembre 2010 à 09:55 +0000, Jarek Poplawski a écrit :

>
> Exactly, but there is no "a single napi --> device mapping". And sky2
> uses the same model. So, there is only a question of cost of this test,
> and a question of probability of gro errors on collisions without such
> a test in normal use. (And if gro can never do such errors for other
> reasons?)

Two vlans might carry packets in different domains, with a clash of IP
space and TCP flows. Even with a probability of 0.000000001%, we cannot
ever merge two packets of different domains. Really !

napi->dev is not used in GRO path, as mentioned earlier,
but in napi_get_frags(), while not needed.

To make this very clear, I suggest following patch :

[PATCH net-next-2.6] gro: remove use of napi->dev

Only use of napi->dev in GRO stack is the one found in napi_get_frags()

We can remove it and use a plain dev_alloc_skb() call.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/core/dev.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index d8c43e7..607057a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3248,9 +3248,11 @@ struct sk_buff *napi_get_frags(struct napi_struct *napi)
struct sk_buff *skb = napi->skb;

if (!skb) {
- skb = netdev_alloc_skb_ip_align(napi->dev, GRO_MAX_HEAD);
- if (skb)
+ skb = dev_alloc_skb(GRO_MAX_HEAD + NET_IP_ALIGN);
+ if (skb) {
+ skb_reserve(skb, NET_IP_ALIGN);
napi->skb = skb;
+ }
}
return skb;
}