* [PATCH net-next-2.6 1/2] net: introduce __netdev_alloc_skb_ip_align
@ 2011-07-11 21:52 Eric Dumazet
2011-07-11 22:57 ` Ben Hutchings
2011-07-12 3:08 ` David Miller
0 siblings, 2 replies; 5+ messages in thread
From: Eric Dumazet @ 2011-07-11 21:52 UTC (permalink / raw)
To: David Miller; +Cc: netdev
RX rings should use GFP_KERNEL allocations if possible, add
__netdev_alloc_skb_ip_align() helper to ease this.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
include/linux/skbuff.h | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 32ada53..a24218c 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -1579,16 +1579,22 @@ static inline struct sk_buff *netdev_alloc_skb(struct net_device *dev,
return __netdev_alloc_skb(dev, length, GFP_ATOMIC);
}
-static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
- unsigned int length)
+static inline struct sk_buff *__netdev_alloc_skb_ip_align(struct net_device *dev,
+ unsigned int length, gfp_t gfp)
{
- struct sk_buff *skb = netdev_alloc_skb(dev, length + NET_IP_ALIGN);
+ struct sk_buff *skb = __netdev_alloc_skb(dev, length + NET_IP_ALIGN, gfp);
if (NET_IP_ALIGN && skb)
skb_reserve(skb, NET_IP_ALIGN);
return skb;
}
+static inline struct sk_buff *netdev_alloc_skb_ip_align(struct net_device *dev,
+ unsigned int length)
+{
+ return __netdev_alloc_skb_ip_align(dev, length, GFP_ATOMIC);
+}
+
/**
* __netdev_alloc_page - allocate a page for ps-rx on a specific device
* @dev: network device to receive on
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next-2.6 1/2] net: introduce __netdev_alloc_skb_ip_align
2011-07-11 21:52 [PATCH net-next-2.6 1/2] net: introduce __netdev_alloc_skb_ip_align Eric Dumazet
@ 2011-07-11 22:57 ` Ben Hutchings
2011-07-11 23:12 ` Michał Mirosław
2011-07-12 2:32 ` David Miller
2011-07-12 3:08 ` David Miller
1 sibling, 2 replies; 5+ messages in thread
From: Ben Hutchings @ 2011-07-11 22:57 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev
On Mon, 2011-07-11 at 23:52 +0200, Eric Dumazet wrote:
> RX rings should use GFP_KERNEL allocations if possible, add
> __netdev_alloc_skb_ip_align() helper to ease this.
[...]
When it is possible, other than when starting an interface? RX refill
normally has to be done in NAPI context or at least synchronised with
NAPI, so GFP_ATOMIC is required. Not sure how much point there is in
making a special case for the initial fill.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next-2.6 1/2] net: introduce __netdev_alloc_skb_ip_align
2011-07-11 22:57 ` Ben Hutchings
@ 2011-07-11 23:12 ` Michał Mirosław
2011-07-12 2:32 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: Michał Mirosław @ 2011-07-11 23:12 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Eric Dumazet, David Miller, netdev
2011/7/12 Ben Hutchings <bhutchings@solarflare.com>:
> On Mon, 2011-07-11 at 23:52 +0200, Eric Dumazet wrote:
>> RX rings should use GFP_KERNEL allocations if possible, add
>> __netdev_alloc_skb_ip_align() helper to ease this.
> [...]
> When it is possible, other than when starting an interface? RX refill
> normally has to be done in NAPI context or at least synchronised with
> NAPI, so GFP_ATOMIC is required. Not sure how much point there is in
> making a special case for the initial fill.
Drivers can also refill buffers later, even from separate thread. Ring refilling
can be made lockless given proper access ordering is preserved.
Best Regards,
Michał Mirosław
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next-2.6 1/2] net: introduce __netdev_alloc_skb_ip_align
2011-07-11 22:57 ` Ben Hutchings
2011-07-11 23:12 ` Michał Mirosław
@ 2011-07-12 2:32 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2011-07-12 2:32 UTC (permalink / raw)
To: bhutchings; +Cc: eric.dumazet, netdev
From: Ben Hutchings <bhutchings@solarflare.com>
Date: Mon, 11 Jul 2011 23:57:08 +0100
> On Mon, 2011-07-11 at 23:52 +0200, Eric Dumazet wrote:
>> RX rings should use GFP_KERNEL allocations if possible, add
>> __netdev_alloc_skb_ip_align() helper to ease this.
> [...]
>
> When it is possible, other than when starting an interface? RX refill
> normally has to be done in NAPI context or at least synchronised with
> NAPI, so GFP_ATOMIC is required. Not sure how much point there is in
> making a special case for the initial fill.
There is a point, because if this init case fails you lose the
interface entirely.
Whereas the other cases only cause the loss of a few packets.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next-2.6 1/2] net: introduce __netdev_alloc_skb_ip_align
2011-07-11 21:52 [PATCH net-next-2.6 1/2] net: introduce __netdev_alloc_skb_ip_align Eric Dumazet
2011-07-11 22:57 ` Ben Hutchings
@ 2011-07-12 3:08 ` David Miller
1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2011-07-12 3:08 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Mon, 11 Jul 2011 23:52:44 +0200
> RX rings should use GFP_KERNEL allocations if possible, add
> __netdev_alloc_skb_ip_align() helper to ease this.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-07-12 3:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-11 21:52 [PATCH net-next-2.6 1/2] net: introduce __netdev_alloc_skb_ip_align Eric Dumazet
2011-07-11 22:57 ` Ben Hutchings
2011-07-11 23:12 ` Michał Mirosław
2011-07-12 2:32 ` David Miller
2011-07-12 3:08 ` 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).