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.
Unified · Split
| @@ -328,13 +328,13 @@ static int rx_submit (struct usbnet *dev, struct urb *urb, gfp_t flags) · 327 unmodified lines | ||
| 328 | 328 | unsigned long lockflags; |
| 329 | 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 | 333 | netif_dbg(dev, rx_err, dev->net, "no rx skb\n"); |
| 333 | 334 | usbnet_defer_kevent (dev, EVENT_RX_MEMORY); |
| 334 | 335 | usb_free_urb (urb); |
| 335 | 336 | return -ENOMEM; |
| 336 | 337 | } |
| 337 | − skb_reserve (skb, NET_IP_ALIGN); | |
| 338 | 338 | |
| 339 | 339 | entry = (struct skb_data *) skb->cb; |
| 340 | 340 | entry->urb = urb; |