Commit 67147ba9 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

gro: Localise offset/headlen in skb_gro_offset

This patch stores the offset/headlen in local variables as they're
used repeatedly in skb_gro_offset.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 78a478d0
...@@ -2666,13 +2666,15 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) ...@@ -2666,13 +2666,15 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
struct sk_buff *nskb; struct sk_buff *nskb;
unsigned int headroom; unsigned int headroom;
unsigned int len = skb_gro_len(skb); 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) if (p->len + len >= 65536)
return -E2BIG; return -E2BIG;
if (skb_shinfo(p)->frag_list) if (skb_shinfo(p)->frag_list)
goto merge; goto merge;
else if (skb_headlen(skb) <= skb_gro_offset(skb)) { else if (headlen <= offset) {
skb_frag_t *frag; skb_frag_t *frag;
int i; int i;
...@@ -2680,10 +2682,8 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) ...@@ -2680,10 +2682,8 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
MAX_SKB_FRAGS) MAX_SKB_FRAGS)
return -E2BIG; return -E2BIG;
skb_shinfo(skb)->frags[0].page_offset += skb_shinfo(skb)->frags[0].page_offset += offset - headlen;
skb_gro_offset(skb) - skb_headlen(skb); skb_shinfo(skb)->frags[0].size -= offset - headlen;
skb_shinfo(skb)->frags[0].size -=
skb_gro_offset(skb) - skb_headlen(skb);
frag = skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags; frag = skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags;
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
...@@ -2736,16 +2736,13 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) ...@@ -2736,16 +2736,13 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
p = nskb; p = nskb;
merge: merge:
if (skb_gro_offset(skb) > skb_headlen(skb)) { if (offset > headlen) {
skb_shinfo(skb)->frags[0].page_offset += skb_shinfo(skb)->frags[0].page_offset += offset - headlen;
skb_gro_offset(skb) - skb_headlen(skb); skb_shinfo(skb)->frags[0].size -= offset - headlen;
skb_shinfo(skb)->frags[0].size -= offset = headlen;
skb_gro_offset(skb) - skb_headlen(skb);
skb_gro_reset_offset(skb);
skb_gro_pull(skb, skb_headlen(skb));
} }
__skb_pull(skb, skb_gro_offset(skb)); __skb_pull(skb, offset);
p->prev->next = skb; p->prev->next = skb;
p->prev = skb; p->prev = skb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment