diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2012-05-04 16:26:56 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-05-06 19:13:19 +0200 |
commit | ec47ea82477404631d49b8e568c71826c9b663ac (patch) | |
tree | 8b7890f23ad078d9eccbd4571e0b2da86b04a6a0 /include | |
parent | skb: Drop "fastpath" variable for skb_cloned check in pskb_expand_head (diff) | |
download | linux-ec47ea82477404631d49b8e568c71826c9b663ac.tar.xz linux-ec47ea82477404631d49b8e568c71826c9b663ac.zip |
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')
-rw-r--r-- | include/linux/skbuff.h | 12 |
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) { return skb->head + skb->end; } + +static inline unsigned int skb_end_offset(const struct sk_buff *skb) +{ + return skb->end; +} #else static inline unsigned char *skb_end_pointer(const struct sk_buff *skb) { return skb->end; } + +static inline unsigned int skb_end_offset(const struct sk_buff *skb) +{ + return skb->end - skb->head; +} #endif /* Internal */ @@ -2558,7 +2568,7 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size) return false; skb_size = SKB_DATA_ALIGN(skb_size + NET_SKB_PAD); - if (skb_end_pointer(skb) - skb->head < skb_size) + if (skb_end_offset(skb) < skb_size) return false; if (skb_shared(skb) || skb_cloned(skb)) |