diff options
Diffstat (limited to 'include/linux/skbuff.h')
-rw-r--r-- | include/linux/skbuff.h | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 17e48d0e9..24404cfda 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -153,7 +153,7 @@ struct sk_buff { /* * Handling routines are only of interest to the kernel */ -#include <linux/malloc.h> +#include <linux/slab.h> #include <asm/system.h> @@ -878,29 +878,48 @@ static inline void __skb_queue_purge(struct sk_buff_head *list) } /** - * dev_alloc_skb - allocate an skbuff for sending + * __dev_alloc_skb - allocate an skbuff for sending * @length: length to allocate + * @gfp_mask: get_free_pages mask, passed to alloc_skb * * Allocate a new &sk_buff and assign it a usage count of one. The * buffer has unspecified headroom built in. Users should allocate * the headroom they think they need without accounting for the * built in space. The built in space is used for optimisations. * - * %NULL is returned in there is no free memory. Although this function - * allocates memory it can be called from an interrupt. + * %NULL is returned in there is no free memory. */ -static inline struct sk_buff *dev_alloc_skb(unsigned int length) +static inline struct sk_buff *__dev_alloc_skb(unsigned int length, + int gfp_mask) { struct sk_buff *skb; - skb = alloc_skb(length+16, GFP_ATOMIC); + skb = alloc_skb(length+16, gfp_mask); if (skb) skb_reserve(skb,16); return skb; } /** + * dev_alloc_skb - allocate an skbuff for sending + * @length: length to allocate + * + * Allocate a new &sk_buff and assign it a usage count of one. The + * buffer has unspecified headroom built in. Users should allocate + * the headroom they think they need without accounting for the + * built in space. The built in space is used for optimisations. + * + * %NULL is returned in there is no free memory. Although this function + * allocates memory it can be called from an interrupt. + */ + +static inline struct sk_buff *dev_alloc_skb(unsigned int length) +{ + return __dev_alloc_skb(length, GFP_ATOMIC); +} + +/** * skb_cow - copy a buffer if need be * @skb: buffer to copy * @headroom: needed headroom |