diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2009-05-26 14:50:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-05-27 06:26:05 -0400 |
commit | 9aaa156cf9b7e9d9ed899f254283b91c4e3c36c8 (patch) | |
tree | b96988e05acc737d97ec2a3f238344ec5bfb917f /net/core | |
parent | 66e92fcf1ded5dd0da30d016ed47882eb183ec71 (diff) |
gro: Store shinfo in local variable in skb_gro_receive
This patch stores the two shinfo pointers in local variables
because they're used over and over again in skb_gro_receive.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/skbuff.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 19afb18abae9..8e815e685f28 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -2664,6 +2664,8 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2664 | { | 2664 | { |
2665 | struct sk_buff *p = *head; | 2665 | struct sk_buff *p = *head; |
2666 | struct sk_buff *nskb; | 2666 | struct sk_buff *nskb; |
2667 | struct skb_shared_info *skbinfo = skb_shinfo(skb); | ||
2668 | struct skb_shared_info *pinfo = skb_shinfo(p); | ||
2667 | unsigned int headroom; | 2669 | unsigned int headroom; |
2668 | unsigned int len = skb_gro_len(skb); | 2670 | unsigned int len = skb_gro_len(skb); |
2669 | unsigned int offset = skb_gro_offset(skb); | 2671 | unsigned int offset = skb_gro_offset(skb); |
@@ -2672,24 +2674,24 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2672 | if (p->len + len >= 65536) | 2674 | if (p->len + len >= 65536) |
2673 | return -E2BIG; | 2675 | return -E2BIG; |
2674 | 2676 | ||
2675 | if (skb_shinfo(p)->frag_list) | 2677 | if (pinfo->frag_list) |
2676 | goto merge; | 2678 | goto merge; |
2677 | else if (headlen <= offset) { | 2679 | else if (headlen <= offset) { |
2678 | skb_frag_t *frag; | 2680 | skb_frag_t *frag; |
2679 | skb_frag_t *frag2; | 2681 | skb_frag_t *frag2; |
2680 | int i = skb_shinfo(skb)->nr_frags; | 2682 | int i = skbinfo->nr_frags; |
2681 | int nr_frags = skb_shinfo(p)->nr_frags + i; | 2683 | int nr_frags = pinfo->nr_frags + i; |
2682 | 2684 | ||
2683 | offset -= headlen; | 2685 | offset -= headlen; |
2684 | 2686 | ||
2685 | if (nr_frags > MAX_SKB_FRAGS) | 2687 | if (nr_frags > MAX_SKB_FRAGS) |
2686 | return -E2BIG; | 2688 | return -E2BIG; |
2687 | 2689 | ||
2688 | skb_shinfo(p)->nr_frags = nr_frags; | 2690 | pinfo->nr_frags = nr_frags; |
2689 | skb_shinfo(skb)->nr_frags = 0; | 2691 | skbinfo->nr_frags = 0; |
2690 | 2692 | ||
2691 | frag = skb_shinfo(p)->frags + nr_frags; | 2693 | frag = pinfo->frags + nr_frags; |
2692 | frag2 = skb_shinfo(skb)->frags + i; | 2694 | frag2 = skbinfo->frags + i; |
2693 | do { | 2695 | do { |
2694 | *--frag = *--frag2; | 2696 | *--frag = *--frag2; |
2695 | } while (--i); | 2697 | } while (--i); |
@@ -2726,7 +2728,7 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2726 | 2728 | ||
2727 | *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p); | 2729 | *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p); |
2728 | skb_shinfo(nskb)->frag_list = p; | 2730 | skb_shinfo(nskb)->frag_list = p; |
2729 | skb_shinfo(nskb)->gso_size = skb_shinfo(p)->gso_size; | 2731 | skb_shinfo(nskb)->gso_size = pinfo->gso_size; |
2730 | skb_header_release(p); | 2732 | skb_header_release(p); |
2731 | nskb->prev = p; | 2733 | nskb->prev = p; |
2732 | 2734 | ||
@@ -2742,8 +2744,8 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb) | |||
2742 | 2744 | ||
2743 | merge: | 2745 | merge: |
2744 | if (offset > headlen) { | 2746 | if (offset > headlen) { |
2745 | skb_shinfo(skb)->frags[0].page_offset += offset - headlen; | 2747 | skbinfo->frags[0].page_offset += offset - headlen; |
2746 | skb_shinfo(skb)->frags[0].size -= offset - headlen; | 2748 | skbinfo->frags[0].size -= offset - headlen; |
2747 | offset = headlen; | 2749 | offset = headlen; |
2748 | } | 2750 | } |
2749 | 2751 | ||