summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2012-03-21 07:58:03 +0100
committerDavid S. Miller <davem@davemloft.net>2012-03-21 21:52:09 +0100
commit2a2a459eeeff48640dc557548ce576d666ab06ed (patch)
tree01d4a817920961ff68d8bfca618d2d62817a4169
parentMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/... (diff)
downloadlinux-2a2a459eeeff48640dc557548ce576d666ab06ed.tar.xz
linux-2a2a459eeeff48640dc557548ce576d666ab06ed.zip
net: fix napi_reuse_skb() skb reserve
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/core/dev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 0f3eb7d79a2d..452db7090d18 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;