aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/skbuff.h
diff options
context:
space:
mode:
authorAlexander Duyck <alexander.h.duyck@intel.com>2012-05-04 10:26:56 -0400
committerDavid S. Miller <davem@davemloft.net>2012-05-06 13:13:19 -0400
commitec47ea82477404631d49b8e568c71826c9b663ac (patch)
tree8b7890f23ad078d9eccbd4571e0b2da86b04a6a0 /include/linux/skbuff.h
parent3e24591a19bbda6fcb2cbe383b41b4ba794501bf (diff)
skb: Add inline helper for getting the skb end offset from head
With the recent changes for how we compute the skb truesize it occurs to me we are probably going to have a lot of calls to skb_end_pointer - skb->head. Instead of running all over the place doing that it would make more sense to just make it a separate inline skb_end_offset(skb) that way we can return the correct value without having gcc having to do all the optimization to cancel out skb->head - skb->head. Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r--include/linux/skbuff.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 37f539129d89..91ad5e227d1d 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -645,11 +645,21 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
645{ 645{
646 return skb->head + skb->end; 646 return skb->head + skb->end;
647} 647}
648
649static inline unsigned int skb_end_offset(const struct sk_buff *skb)
650{
651 return skb->end;
652}
648#else 653#else
649static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) 654static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
650{ 655{
651 return skb->end; 656 return skb->end;
652} 657}
658
659static inline unsigned int skb_end_offset(const struct sk_buff *skb)
660{
661 return skb->end - skb->head;
662}
653#endif 663#endif
654 664
655/* Internal */ 665/* Internal */
@@ -2558,7 +2568,7 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size)
2558 return false; 2568 return false;
2559 2569
2560 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD); 2570 skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD);
2561 if (skb_end_pointer(skb) - skb->head < skb_size) 2571 if (skb_end_offset(skb) < skb_size)
2562 return false; 2572 return false;
2563 2573
2564 if (skb_shared(skb) || skb_cloned(skb)) 2574 if (skb_shared(skb) || skb_cloned(skb))