Skip to content

Commit 61321bb

Browse files
Eric Dumazetdavem330
authored andcommitted
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>
1 parent f373b53 commit 61321bb

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎include/linux/skbuff.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1491,6 +1491,16 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
14911491
return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
14921492
}
14931493

1494+
static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
1495+
unsigned int length)
1496+
{
1497+
struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN);
1498+
1499+
if (NET_IP_ALIGN && skb)
1500+
skb_reserve(skb, NET_IP_ALIGN);
1501+
return skb;
1502+
}
1503+
14941504
extern struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask);
14951505

14961506
/**

0 commit comments

Comments
 (0)