|
@@ -951,10 +951,13 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
|
|
EXPORT_SYMBOL(skb_copy);
|
|
EXPORT_SYMBOL(skb_copy);
|
|
|
|
|
|
/**
|
|
/**
|
|
- * __pskb_copy - create copy of an sk_buff with private head.
|
|
|
|
|
|
+ * __pskb_copy_fclone - create copy of an sk_buff with private head.
|
|
* @skb: buffer to copy
|
|
* @skb: buffer to copy
|
|
* @headroom: headroom of new skb
|
|
* @headroom: headroom of new skb
|
|
* @gfp_mask: allocation priority
|
|
* @gfp_mask: allocation priority
|
|
|
|
+ * @fclone: if true allocate the copy of the skb from the fclone
|
|
|
|
+ * cache instead of the head cache; it is recommended to set this
|
|
|
|
+ * to true for the cases where the copy will likely be cloned
|
|
*
|
|
*
|
|
* Make a copy of both an &sk_buff and part of its data, located
|
|
* Make a copy of both an &sk_buff and part of its data, located
|
|
* in header. Fragmented data remain shared. This is used when
|
|
* in header. Fragmented data remain shared. This is used when
|
|
@@ -964,11 +967,12 @@ EXPORT_SYMBOL(skb_copy);
|
|
* The returned buffer has a reference count of 1.
|
|
* The returned buffer has a reference count of 1.
|
|
*/
|
|
*/
|
|
|
|
|
|
-struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask)
|
|
|
|
|
|
+struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom,
|
|
|
|
+ gfp_t gfp_mask, bool fclone)
|
|
{
|
|
{
|
|
unsigned int size = skb_headlen(skb) + headroom;
|
|
unsigned int size = skb_headlen(skb) + headroom;
|
|
- struct sk_buff *n = __alloc_skb(size, gfp_mask,
|
|
|
|
- skb_alloc_rx_flag(skb), NUMA_NO_NODE);
|
|
|
|
|
|
+ int flags = skb_alloc_rx_flag(skb) | (fclone ? SKB_ALLOC_FCLONE : 0);
|
|
|
|
+ struct sk_buff *n = __alloc_skb(size, gfp_mask, flags, NUMA_NO_NODE);
|
|
|
|
|
|
if (!n)
|
|
if (!n)
|
|
goto out;
|
|
goto out;
|
|
@@ -1008,7 +1012,7 @@ struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask)
|
|
out:
|
|
out:
|
|
return n;
|
|
return n;
|
|
}
|
|
}
|
|
-EXPORT_SYMBOL(__pskb_copy);
|
|
|
|
|
|
+EXPORT_SYMBOL(__pskb_copy_fclone);
|
|
|
|
|
|
/**
|
|
/**
|
|
* pskb_expand_head - reallocate header of &sk_buff
|
|
* pskb_expand_head - reallocate header of &sk_buff
|