diff options
Diffstat (limited to 'backport/backport-include/linux/skbuff.h')
| -rw-r--r-- | backport/backport-include/linux/skbuff.h | 46 | 
1 files changed, 46 insertions, 0 deletions
| diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h index 7d04b542..c1b27537 100644 --- a/backport/backport-include/linux/skbuff.h +++ b/backport/backport-include/linux/skbuff.h @@ -224,6 +224,52 @@ static inline void skb_queue_splice_tail(const struct sk_buff_head *list,  		     skb = skb->next)  #endif /* < 2.6.28 */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) +/** + *	__skb_alloc_pages - allocate pages for ps-rx on a skb and preserve pfmemalloc data + *	@gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX + *	@skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used + *	@order: size of the allocation + * + * 	Allocate a new page. + * + * 	%NULL is returned if there is no free memory. +*/ +static inline struct page *__skb_alloc_pages(gfp_t gfp_mask, +					      struct sk_buff *skb, +					      unsigned int order) +{ +	struct page *page; + +	gfp_mask |= __GFP_COLD; +#if 0 +	if (!(gfp_mask & __GFP_NOMEMALLOC)) +		gfp_mask |= __GFP_MEMALLOC; +#endif +	page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order); +#if 0 +	if (skb && page && page->pfmemalloc) +		skb->pfmemalloc = true; +#endif +	return page; +} + +/** + *	__skb_alloc_page - allocate a page for ps-rx for a given skb and preserve pfmemalloc data + *	@gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for network packet RX + *	@skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used + * + * 	Allocate a new page. + * + * 	%NULL is returned if there is no free memory. + */ +static inline struct page *__skb_alloc_page(gfp_t gfp_mask, +					     struct sk_buff *skb) +{ +	return __skb_alloc_pages(gfp_mask, skb, 0); +} +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,0,0) && LINUX_VERSION_CODE < KERNEL_VERSION(3,6,0) */ +  #if LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)  #ifndef NETDEV_FRAG_PAGE_MAX_ORDER  #define NETDEV_FRAG_PAGE_MAX_ORDER get_order(32768) | 
