Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: fix napi_reuse_skb() skb reserve
@ 2012-03-21 16:58 Eric Dumazet
  2012-03-21 20:56 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2012-03-21 16:58 UTC (permalink / raw)
  To: David Miller, Herbert Xu; +Cc: netdev

napi->skb is allocated in napi_get_frags() using
netdev_alloc_skb_ip_align(), with a reserve of NET_SKB_PAD +
NET_IP_ALIGN bytes.

However, when such skb is recycled in napi_reuse_skb(), it ends with a
reserve of NET_IP_ALIGN which is suboptimal.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
---
 net/core/dev.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 0f3eb7d..452db70 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3560,7 +3560,8 @@ EXPORT_SYMBOL(napi_gro_receive);
 static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
 {
 	__skb_pull(skb, skb_headlen(skb));
-	skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb));
+	/* restore the reserve we had after netdev_alloc_skb_ip_align() */
+	skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb));
 	skb->vlan_tci = 0;
 	skb->dev = napi->dev;
 	skb->skb_iif = 0;

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

* Re: [PATCH] net: fix napi_reuse_skb() skb reserve
  2012-03-21 16:58 [PATCH] net: fix napi_reuse_skb() skb reserve Eric Dumazet
@ 2012-03-21 20:56 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-03-21 20:56 UTC (permalink / raw)
  To: eric.dumazet; +Cc: herbert, netdev

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 21 Mar 2012 09:58:03 -0700

> napi->skb is allocated in napi_get_frags() using
> netdev_alloc_skb_ip_align(), with a reserve of NET_SKB_PAD +
> NET_IP_ALIGN bytes.
> 
> However, when such skb is recycled in napi_reuse_skb(), it ends with a
> reserve of NET_IP_ALIGN which is suboptimal.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>

Applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2012-03-21 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-21 16:58 [PATCH] net: fix napi_reuse_skb() skb reserve Eric Dumazet
2012-03-21 20:56 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox