Commit 42da6994 authored by Herbert Xu's avatar Herbert Xu Committed by David S. Miller

gro: Open-code frags copy in skb_gro_receive

gcc does a poor job at generating code for the memcpy of the frags
array in skb_gro_receive, which is the primary purpose of that
function when merging frags.  In particular, it can't utilise the
alignment information of the source and destination.  This patch
open-codes the copy so we process words instead of bytes.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0fb2787b
...@@ -2673,6 +2673,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) ...@@ -2673,6 +2673,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
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 (skb_headlen(skb) <= skb_gro_offset(skb)) {
skb_frag_t *frag;
int i;
if (skb_shinfo(p)->nr_frags + skb_shinfo(skb)->nr_frags > if (skb_shinfo(p)->nr_frags + skb_shinfo(skb)->nr_frags >
MAX_SKB_FRAGS) MAX_SKB_FRAGS)
return -E2BIG; return -E2BIG;
...@@ -2682,9 +2685,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) ...@@ -2682,9 +2685,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
skb_shinfo(skb)->frags[0].size -= skb_shinfo(skb)->frags[0].size -=
skb_gro_offset(skb) - skb_headlen(skb); skb_gro_offset(skb) - skb_headlen(skb);
memcpy(skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags, frag = skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags;
skb_shinfo(skb)->frags, for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t)); *frag++ = skb_shinfo(skb)->frags[i];
skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags; skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags;
skb_shinfo(skb)->nr_frags = 0; skb_shinfo(skb)->nr_frags = 0;
......
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