Browse files

net/usbnet: reserve headroom on rx skbs

network drivers should reserve some headroom on incoming skbs so that we
dont need expensive reallocations, eg forwarding packets in tunnels.

This NET_SKB_PAD padding is done in various helpers, like
__netdev_alloc_skb_ip_align() in this patch, combining NET_SKB_PAD and

Signed-off-by: Eric Dumazet <>
Cc: Oliver Neukum <>
Cc: Greg Kroah-Hartman <>
Acked-by: Oliver Neukum <>
Signed-off-by: David S. Miller <>
  • Loading branch information...
1 parent c0ea452 commit 7bdd402706cf26bfef9050dfee3f229b7f33ee4f Eric Dumazet committed with davem330 Mar 14, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 drivers/net/usb/usbnet.c
@@ -328,13 +328,13 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
unsigned long lockflags;
size_t size = dev->rx_urb_size;
- if ((skb = alloc_skb (size + NET_IP_ALIGN, flags)) == NULL) {
+ skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
+ if (!skb) {
netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
usb_free_urb (urb);
return -ENOMEM;
- skb_reserve (skb, NET_IP_ALIGN);
entry = (struct skb_data *) skb->cb;
entry->urb = urb;

0 comments on commit 7bdd402

Please sign in to comment.