net: Add skb_unclone() helper function.
This function will be used in next GRE_GSO patch. This patch does not change any functionality. Signed-off-by: Pravin B Shelar <pshelar@nicira.com> Acked-by: Eric Dumazet <edumazet@google.com>
This commit is contained in:
committed by
David S. Miller
parent
d887199dc2
commit
14bbd6a565
@@ -804,6 +804,16 @@ static inline int skb_cloned(const struct sk_buff *skb)
|
||||
(atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1;
|
||||
}
|
||||
|
||||
static inline int skb_unclone(struct sk_buff *skb, gfp_t pri)
|
||||
{
|
||||
might_sleep_if(pri & __GFP_WAIT);
|
||||
|
||||
if (skb_cloned(skb))
|
||||
return pskb_expand_head(skb, 0, 0, pri);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* skb_header_cloned - is the header a clone
|
||||
* @skb: buffer to check
|
||||
|
||||
Reference in New Issue
Block a user