struct sk_buff *nskb;
unsigned int headroom;
unsigned int len = skb_gro_len(skb);
+ unsigned int offset = skb_gro_offset(skb);
+ unsigned int headlen = skb_headlen(skb);
if (p->len + len >= 65536)
return -E2BIG;
if (skb_shinfo(p)->frag_list)
goto merge;
- else if (skb_headlen(skb) <= skb_gro_offset(skb)) {
+ else if (headlen <= offset) {
skb_frag_t *frag;
int i;
MAX_SKB_FRAGS)
return -E2BIG;
- skb_shinfo(skb)->frags[0].page_offset +=
- skb_gro_offset(skb) - skb_headlen(skb);
- skb_shinfo(skb)->frags[0].size -=
- skb_gro_offset(skb) - skb_headlen(skb);
+ skb_shinfo(skb)->frags[0].page_offset += offset - headlen;
+ skb_shinfo(skb)->frags[0].size -= offset - headlen;
frag = skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags;
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
p = nskb;
merge:
- if (skb_gro_offset(skb) > skb_headlen(skb)) {
- skb_shinfo(skb)->frags[0].page_offset +=
- skb_gro_offset(skb) - skb_headlen(skb);
- skb_shinfo(skb)->frags[0].size -=
- skb_gro_offset(skb) - skb_headlen(skb);
- skb_gro_reset_offset(skb);
- skb_gro_pull(skb, skb_headlen(skb));
+ if (offset > headlen) {
+ skb_shinfo(skb)->frags[0].page_offset += offset - headlen;
+ skb_shinfo(skb)->frags[0].size -= offset - headlen;
+ offset = headlen;
}
- __skb_pull(skb, skb_gro_offset(skb));
+ __skb_pull(skb, offset);
p->prev->next = skb;
p->prev = skb;