summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-10-07 17:11:23 +0000
committerDavid S. Miller <davem@davemloft.net>2009-10-13 03:44:03 -0700
commit61321bbd6235ca9a40ba3bc249e8906cc66233c3 (patch)
tree20f50af5ea5cef41ca28dcc8e79f9a7cc2a52579
parentf373b53b5fe67aa4a6f28f921a529cc90f88e79b (diff)
downloadlinux-3.10-61321bbd6235ca9a40ba3bc249e8906cc66233c3.tar.gz
linux-3.10-61321bbd6235ca9a40ba3bc249e8906cc66233c3.tar.bz2
linux-3.10-61321bbd6235ca9a40ba3bc249e8906cc66233c3.zip
net: Add netdev_alloc_skb_ip_align() helper
Instead of hardcoding NET_IP_ALIGN stuff in various network drivers, we can add a helper around netdev_alloc_skb() Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/linux/skbuff.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 8c866b5cb97..0c68fbd6faa 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1491,6 +1491,16 @@ 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)
+{
+ struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN);
+
+ if (NET_IP_ALIGN && skb)
+ skb_reserve(skb, NET_IP_ALIGN);
+ return skb;
+}
+
extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask);
/**