* [PATCH] net/usbnet: reserve headroom on rx skbs
@ 2012-03-14 16:56 Eric Dumazet
2012-03-15 17:01 ` Oliver Neukum
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2012-03-14 16:56 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Oliver Neukum, Greg Kroah-Hartman
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>
---
drivers/net/usb/usbnet.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 83dcc53..5903aea 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)
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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net/usbnet: reserve headroom on rx skbs
2012-03-14 16:56 [PATCH] net/usbnet: reserve headroom on rx skbs Eric Dumazet
@ 2012-03-15 17:01 ` Oliver Neukum
2012-03-16 9:02 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Oliver Neukum @ 2012-03-15 17:01 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Greg Kroah-Hartman
Am Mittwoch, 14. März 2012, 17:56:25 schrieb Eric Dumazet:
> 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>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net/usbnet: reserve headroom on rx skbs
2012-03-15 17:01 ` Oliver Neukum
@ 2012-03-16 9:02 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2012-03-16 9:02 UTC (permalink / raw)
To: oneukum; +Cc: eric.dumazet, netdev, gregkh
From: Oliver Neukum <oneukum@suse.de>
Date: Thu, 15 Mar 2012 18:01:03 +0100
> Am Mittwoch, 14. März 2012, 17:56:25 schrieb Eric Dumazet:
>> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-16 9:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-14 16:56 [PATCH] net/usbnet: reserve headroom on rx skbs Eric Dumazet
2012-03-15 17:01 ` Oliver Neukum
2012-03-16 9:02 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).