summaryrefslogtreecommitdiffstats
path: root/net/core/skbuff.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-05-26 18:50:19 +0000
committerDavid S. Miller <davem@davemloft.net>2009-05-27 03:25:54 -0700
commit42da6994ca6d20ad1d4e30255dee98047db454e7 (patch)
tree0feb7e6d5d18c5534f080636e809e7df9934f2c6 /net/core/skbuff.c
parent0fb2787bf2fa5dbe02ffd61ca3ce842c50769573 (diff)
downloadtalos-obmc-linux-42da6994ca6d20ad1d4e30255dee98047db454e7.tar.gz
talos-obmc-linux-42da6994ca6d20ad1d4e30255dee98047db454e7.zip
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: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r--net/core/skbuff.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d429c41e0dc4..c88426b51140 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2673,6 +2673,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
if (skb_shinfo(p)->frag_list)
goto merge;
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 >
MAX_SKB_FRAGS)
return -E2BIG;
@@ -2682,9 +2685,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
skb_shinfo(skb)->frags[0].size -=
skb_gro_offset(skb) - skb_headlen(skb);
- memcpy(skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags,
- skb_shinfo(skb)->frags,
- skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
+ frag = skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags;
+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
+ *frag++ = skb_shinfo(skb)->frags[i];
skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags;
skb_shinfo(skb)->nr_frags = 0;
OpenPOWER on IntegriCloud