mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 22:51:42 +00:00
gro: Open-code final pskb_may_pull
As we know the only packets which need the final pskb_may_pull are completely non-linear, and have all the required bits in frag0, we can perform a straight memcpy instead of going through pskb_may_pull and doing skb_copy_bits. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1075f3f65d
commit
cb18978cbf
@ -2452,10 +2452,25 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
|
||||
ret = GRO_HELD;
|
||||
|
||||
pull:
|
||||
if (unlikely(!pskb_may_pull(skb, skb_gro_offset(skb)))) {
|
||||
if (napi->gro_list == skb)
|
||||
napi->gro_list = skb->next;
|
||||
ret = GRO_DROP;
|
||||
if (skb_headlen(skb) < skb_gro_offset(skb)) {
|
||||
int grow = skb_gro_offset(skb) - skb_headlen(skb);
|
||||
|
||||
BUG_ON(skb->end - skb->tail < grow);
|
||||
|
||||
memcpy(skb_tail_pointer(skb), NAPI_GRO_CB(skb)->frag0, grow);
|
||||
|
||||
skb->tail += grow;
|
||||
skb->data_len -= grow;
|
||||
|
||||
skb_shinfo(skb)->frags[0].page_offset += grow;
|
||||
skb_shinfo(skb)->frags[0].size -= grow;
|
||||
|
||||
if (unlikely(!skb_shinfo(skb)->frags[0].size)) {
|
||||
put_page(skb_shinfo(skb)->frags[0].page);
|
||||
memmove(skb_shinfo(skb)->frags,
|
||||
skb_shinfo(skb)->frags + 1,
|
||||
--skb_shinfo(skb)->nr_frags);
|
||||
}
|
||||
}
|
||||
|
||||
ok:
|
||||
|
Loading…
Reference in New Issue
Block a user