History

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.

Eric Dumazet committed 14 years ago

Commit 7bdd4021 parent c0ea4521 file · +2 −2Browse files

Unified · Split

drivers/net/usb/usbnet.c+2−2
@@ -328,13 +328,13 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) · 327 unmodified lines
328328 unsigned long lockflags;
329329 size_t size = dev->rx_urb_size;
330330
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) {
332333 netif_dbg(dev, rx_err, dev->net, "no rx skb\n");
333334 usbnet_defer_kevent (dev, EVENT_RX_MEMORY);
334335 usb_free_urb (urb);
335336 return -ENOMEM;
336337 }
337− skb_reserve (skb, NET_IP_ALIGN);
338338
339339 entry = (struct skb_data *) skb->cb;
340340 entry->urb = urb;