diff options
| author | Pravin B Shelar <pshelar@nicira.com> | 2013-02-14 04:44:49 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-02-15 15:10:37 -0500 |
| commit | 14bbd6a565e1bcdc240d44687edb93f721cfdf99 (patch) | |
| tree | b2001bb985856d2177212451273d1f6ebcc55035 /include/linux | |
| parent | d887199dc28c46788b155b234274d5ff41afed8e (diff) | |
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>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/skbuff.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 9da99520ccd5..ca6ee7d93edb 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
| @@ -804,6 +804,16 @@ static inline int skb_cloned(const struct sk_buff *skb) | |||
| 804 | (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; | 804 | (atomic_read(&skb_shinfo(skb)->dataref) & SKB_DATAREF_MASK) != 1; |
| 805 | } | 805 | } |
| 806 | 806 | ||
| 807 | static inline int skb_unclone(struct sk_buff *skb, gfp_t pri) | ||
| 808 | { | ||
| 809 | might_sleep_if(pri & __GFP_WAIT); | ||
| 810 | |||
| 811 | if (skb_cloned(skb)) | ||
| 812 | return pskb_expand_head(skb, 0, 0, pri); | ||
| 813 | |||
| 814 | return 0; | ||
| 815 | } | ||
| 816 | |||
| 807 | /** | 817 | /** |
| 808 | * skb_header_cloned - is the header a clone | 818 | * skb_header_cloned - is the header a clone |
| 809 | * @skb: buffer to check | 819 | * @skb: buffer to check |
