aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2012-03-14 02:56:25 -0400
committerDavid S. Miller <davem@davemloft.net>2012-03-16 05:01:05 -0400
commit7bdd402706cf26bfef9050dfee3f229b7f33ee4f (patch)
tree4db4fac193e40f7a7d86a3ec072337b451af3477
parentc0ea452e422a1fc78ec8c639df64012d0b8dbb4a (diff)
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 NET_IP_ALIGN magic. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Cc: Oliver Neukum <oneukum@suse.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Oliver Neukum <oneukum@suse.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/usb/usbnet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 81b96e303757..59681f01a54e 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -328,13 +328,13 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags)
328 unsigned long lockflags; 328 unsigned long lockflags;
329 size_t size = dev->rx_urb_size; 329 size_t size = dev->rx_urb_size;
330 330
331 if ((skb = alloc_skb (size + NET_IP_ALIGN, flags)) == NULL) { 331 skb = __netdev_alloc_skb_ip_align(dev->net, size, flags);
332 if (!skb) {
332 netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); 333 netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
333 usbnet_defer_kevent (dev, EVENT_RX_MEMORY); 334 usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
334 usb_free_urb (urb); 335 usb_free_urb (urb);
335 return -ENOMEM; 336 return -ENOMEM;
336 } 337 }
337 skb_reserve (skb, NET_IP_ALIGN);
338 338
339 entry = (struct skb_data *) skb->cb; 339 entry = (struct skb_data *) skb->cb;
340 entry->urb = urb; 340 entry->urb = urb;