diff options
author | Octavian Purdila <octavian.purdila@intel.com> | 2014-06-11 18:36:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-06-11 18:38:02 -0400 |
commit | bad93e9d4eeb0d2d6b79204d6cedc7f2e7b256f1 (patch) | |
tree | 816931467196e2a89ac47919bfb2b2fc45969209 /include/linux/skbuff.h | |
parent | 1a0b20b257326523ec2a6cb51dd6f26ef179eb84 (diff) |
net: add __pskb_copy_fclone and pskb_copy_for_clone
There are several instances where a pskb_copy or __pskb_copy is
immediately followed by an skb_clone.
Add a couple of new functions to allow the copy skb to be allocated
from the fclone cache and thus speed up subsequent skb_clone calls.
Cc: Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Marek Lindner <mareklindner@neomailbox.ch>
Cc: Simon Wunderlich <sw@simonwunderlich.de>
Cc: Antonio Quartulli <antonio@meshcoding.com>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Arvid Brodin <arvid.brodin@alten.se>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Lauro Ramos Venancio <lauro.venancio@openbossa.org>
Cc: Aloisio Almeida Jr <aloisio.almeida@openbossa.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Jon Maloy <jon.maloy@ericsson.com>
Cc: Allan Stephens <allan.stephens@windriver.com>
Cc: Andrew Hendry <andrew.hendry@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Reviewed-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index c705808bef9c..1f50bfe2243d 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -744,7 +744,13 @@ struct sk_buff *skb_morph(struct sk_buff *dst, struct sk_buff *src); | |||
744 | int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); | 744 | int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask); |
745 | struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); | 745 | struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t priority); |
746 | struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority); | 746 | struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t priority); |
747 | struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, gfp_t gfp_mask); | 747 | struct sk_buff *__pskb_copy_fclone(struct sk_buff *skb, int headroom, |
748 | gfp_t gfp_mask, bool fclone); | ||
749 | static inline struct sk_buff *__pskb_copy(struct sk_buff *skb, int headroom, | ||
750 | gfp_t gfp_mask) | ||
751 | { | ||
752 | return __pskb_copy_fclone(skb, headroom, gfp_mask, false); | ||
753 | } | ||
748 | 754 | ||
749 | int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask); | 755 | int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask); |
750 | struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, | 756 | struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, |
@@ -2238,6 +2244,14 @@ static inline struct sk_buff *pskb_copy(struct sk_buff *skb, | |||
2238 | return __pskb_copy(skb, skb_headroom(skb), gfp_mask); | 2244 | return __pskb_copy(skb, skb_headroom(skb), gfp_mask); |
2239 | } | 2245 | } |
2240 | 2246 | ||
2247 | |||
2248 | static inline struct sk_buff *pskb_copy_for_clone(struct sk_buff *skb, | ||
2249 | gfp_t gfp_mask) | ||
2250 | { | ||
2251 | return __pskb_copy_fclone(skb, skb_headroom(skb), gfp_mask, true); | ||
2252 | } | ||
2253 | |||
2254 | |||
2241 | /** | 2255 | /** |
2242 | * skb_clone_writable - is the header of a clone writable | 2256 | * skb_clone_writable - is the header of a clone writable |
2243 | * @skb: buffer to check | 2257 | * @skb: buffer to check |