]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net: introduce __netdev_alloc_skb_ip_align
authorEric Dumazet <eric.dumazet@gmail.com>
Tue, 12 Jul 2011 03:08:34 +0000 (20:08 -0700)
committerJoe Jin <joe.jin@oracle.com>
Thu, 2 Feb 2012 11:33:37 +0000 (19:33 +0800)
RX rings should use GFP_KERNEL allocations if possible, add
__netdev_alloc_skb_ip_align() helper to ease this.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 4915a0de43c3e9aef92005c1f94a8ff3a6cfced5)

Signed-off-by: Joe Jin <joe.jin@oracle.com>
include/linux/skbuff.h

index b920a72a7a9aa80df64a1a6bad2b0f48e55ff9c4..c52de239944c2e2c378f21cb0943efa142370a4c 100644 (file)
@@ -1562,16 +1562,22 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
        return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
 }
 
-static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
-               unsigned int length)
+static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
+               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)
                skb_reserve(skb, NET_IP_ALIGN);
        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
  *     @dev: network device to receive on