Commit 2a2a459eeeff48640dc557548ce576d666ab06ed
Committed by
David S. Miller
1 parent
3556485f15
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
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>
Showing 1 changed file with 2 additions and 1 deletions Side-by-side Diff
net/core/dev.c
... | ... | @@ -3560,7 +3560,8 @@ |
3560 | 3560 | static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb) |
3561 | 3561 | { |
3562 | 3562 | __skb_pull(skb, skb_headlen(skb)); |
3563 | - skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb)); | |
3563 | + /* restore the reserve we had after netdev_alloc_skb_ip_align() */ | |
3564 | + skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb)); | |
3564 | 3565 | skb->vlan_tci = 0; |
3565 | 3566 | skb->dev = napi->dev; |
3566 | 3567 | skb->skb_iif = 0; |