diff options
| author | Alexander Duyck <alexander.h.duyck@intel.com> | 2012-05-02 21:09:42 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2012-05-03 13:18:37 -0400 |
| commit | 3a7c1ee4ab89f9250b8f82656a7be0ae14aa3691 (patch) | |
| tree | 9dc10e067f2364fd3590b38cd5db495cd09c32e6 /include/linux | |
| parent | 715dc1f342713816d1be1c37643a2c9e6ee181a7 (diff) | |
skb: Add skb_head_is_locked helper function
This patch adds support for a skb_head_is_locked helper function. It is
meant to be used any time we are considering transferring the head from
skb->head to a paged frag. If the head is locked it means we cannot remove
the head from the skb so it must be copied or we must take the skb as a
whole.
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')
| -rw-r--r-- | include/linux/skbuff.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 988fc49667b1..37f539129d89 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -2566,5 +2566,19 @@ static inline bool skb_is_recycleable(const struct sk_buff *skb, int skb_size) | |||
| 2566 | 2566 | ||
| 2567 | return true; | 2567 | return true; |
| 2568 | } | 2568 | } |
| 2569 | |||
| 2570 | /** | ||
| 2571 | * skb_head_is_locked - Determine if the skb->head is locked down | ||
| 2572 | * @skb: skb to check | ||
| 2573 | * | ||
| 2574 | * The head on skbs build around a head frag can be removed if they are | ||
| 2575 | * not cloned. This function returns true if the skb head is locked down | ||
| 2576 | * due to either being allocated via kmalloc, or by being a clone with | ||
| 2577 | * multiple references to the head. | ||
| 2578 | */ | ||
| 2579 | static inline bool skb_head_is_locked(const struct sk_buff *skb) | ||
| 2580 | { | ||
| 2581 | return !skb->head_frag || skb_cloned(skb); | ||
| 2582 | } | ||
| 2569 | #endif /* __KERNEL__ */ | 2583 | #endif /* __KERNEL__ */ |
| 2570 | #endif /* _LINUX_SKBUFF_H */ | 2584 | #endif /* _LINUX_SKBUFF_H */ |
