Commit 4915a0de authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net: introduce __netdev_alloc_skb_ip_align

RX rings should use GFP_KERNEL allocations if possible, add
__netdev_alloc_skb_ip_align() helper to ease this.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 039f02eb
...@@ -1579,16 +1579,22 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev, ...@@ -1579,16 +1579,22 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
return __netdev_alloc_skb(dev, length, GFP_ATOMIC); return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
} }
static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev, static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
unsigned int length) unsigned int length, gfp_t gfp)
{ {
struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN); struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
if (NET_IP_ALIGN && skb) if (NET_IP_ALIGN && skb)
skb_reserve(skb, NET_IP_ALIGN); skb_reserve(skb, NET_IP_ALIGN);
return skb; return skb;
} }
static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
unsigned int length)
{
return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
}
/** /**
* __netdev_alloc_page - allocate a page for ps-rx on a specific device * __netdev_alloc_page - allocate a page for ps-rx on a specific device
* @dev: network device to receive on * @dev: network device to receive on
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment