diff options
author | Jörn Engel <joern@wohnheim.fh-wedel.de> | 2006-03-21 00:28:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 00:28:35 -0500 |
commit | 231d06ae826664b83369166449144304859a62fa (patch) | |
tree | 1c761b91405573f4e787454b454ead8354c3ba23 /net/core | |
parent | 2e1f47c74c26a591fc490eb339f1b3167361158b (diff) |
[NET]: Uninline kfree_skb and allow NULL argument
o Uninline kfree_skb, which saves some 15k of object code on my notebook.
o Allow kfree_skb to be called with a NULL argument.
Subsequent patches can remove conditional from drivers and further
reduce source and object size.
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/skbuff.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 2144952d1c6c..01abf1e8990b 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -356,6 +356,24 @@ void __kfree_skb(struct sk_buff *skb) | |||
356 | } | 356 | } |
357 | 357 | ||
358 | /** | 358 | /** |
359 | * kfree_skb - free an sk_buff | ||
360 | * @skb: buffer to free | ||
361 | * | ||
362 | * Drop a reference to the buffer and free it if the usage count has | ||
363 | * hit zero. | ||
364 | */ | ||
365 | void kfree_skb(struct sk_buff *skb) | ||
366 | { | ||
367 | if (unlikely(!skb)) | ||
368 | return; | ||
369 | if (likely(atomic_read(&skb->users) == 1)) | ||
370 | smp_rmb(); | ||
371 | else if (likely(!atomic_dec_and_test(&skb->users))) | ||
372 | return; | ||
373 | __kfree_skb(skb); | ||
374 | } | ||
375 | |||
376 | /** | ||
359 | * skb_clone - duplicate an sk_buff | 377 | * skb_clone - duplicate an sk_buff |
360 | * @skb: buffer to clone | 378 | * @skb: buffer to clone |
361 | * @gfp_mask: allocation priority | 379 | * @gfp_mask: allocation priority |
@@ -1799,6 +1817,7 @@ void __init skb_init(void) | |||
1799 | 1817 | ||
1800 | EXPORT_SYMBOL(___pskb_trim); | 1818 | EXPORT_SYMBOL(___pskb_trim); |
1801 | EXPORT_SYMBOL(__kfree_skb); | 1819 | EXPORT_SYMBOL(__kfree_skb); |
1820 | EXPORT_SYMBOL(kfree_skb); | ||
1802 | EXPORT_SYMBOL(__pskb_pull_tail); | 1821 | EXPORT_SYMBOL(__pskb_pull_tail); |
1803 | EXPORT_SYMBOL(__alloc_skb); | 1822 | EXPORT_SYMBOL(__alloc_skb); |
1804 | EXPORT_SYMBOL(pskb_copy); | 1823 | EXPORT_SYMBOL(pskb_copy); |