aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-05-26 14:50:19 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-27 06:25:54 -0400
commit42da6994ca6d20ad1d4e30255dee98047db454e7 (patch)
tree0feb7e6d5d18c5534f080636e809e7df9934f2c6 /net
parent0fb2787bf2fa5dbe02ffd61ca3ce842c50769573 (diff)
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')
-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 d429c41e0dc..c88426b5114 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)
2673 if (skb_shinfo(p)->frag_list) 2673 if (skb_shinfo(p)->frag_list)
2674 goto merge; 2674 goto merge;
2675 else if (skb_headlen(skb) <= skb_gro_offset(skb)) { 2675 else if (skb_headlen(skb) <= skb_gro_offset(skb)) {
2676 skb_frag_t *frag;
2677 int i;
2678
2676 if (skb_shinfo(p)->nr_frags + skb_shinfo(skb)->nr_frags > 2679 if (skb_shinfo(p)->nr_frags + skb_shinfo(skb)->nr_frags >
2677 MAX_SKB_FRAGS) 2680 MAX_SKB_FRAGS)
2678 return -E2BIG; 2681 return -E2BIG;
@@ -2682,9 +2685,9 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2682 skb_shinfo(skb)->frags[0].size -= 2685 skb_shinfo(skb)->frags[0].size -=
2683 skb_gro_offset(skb) - skb_headlen(skb); 2686 skb_gro_offset(skb) - skb_headlen(skb);
2684 2687
2685 memcpy(skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags, 2688 frag = skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags;
2686 skb_shinfo(skb)->frags, 2689 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
2687 skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t)); 2690 *frag++ = skb_shinfo(skb)->frags[i];
2688 2691
2689 skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags; 2692 skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags;
2690 skb_shinfo(skb)->nr_frags = 0; 2693 skb_shinfo(skb)->nr_frags = 0;