diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-02 13:15:52 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-02 13:15:52 -0500 |
commit | 391e572cd1a63aee9c8d4c2d5e3dada91d86bc43 (patch) | |
tree | b89d924e644a7e66cd2b63d978607c6d0d3e7285 /net/core | |
parent | 4ac96572f1f6abe44b5e02e80fdfb5a990129613 (diff) | |
parent | 48dcc33e5e11de0f76b65b113988dbc930d17395 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (33 commits)
af_unix: netns: fix problem of return value
IRDA: remove double inclusion of module.h
udp: multicast packets need to check namespace
net: add documentation for skb recycling
key: fix setkey(8) policy set breakage
bpa10x: free sk_buff with kfree_skb
xfrm: do not leak ESRCH to user space
net: Really remove all of LOOPBACK_TSO code.
netfilter: nf_conntrack_proto_gre: switch to register_pernet_gen_subsys()
netns: add register_pernet_gen_subsys/unregister_pernet_gen_subsys
net: delete excess kernel-doc notation
pppoe: Fix socket leak.
gianfar: Don't reset TBI<->SerDes link if it's already up
gianfar: Fix race in TBI/SerDes configuration
at91_ether: request/free GPIO for PHY interrupt
amd8111e: fix dma_free_coherent context
atl1: fix vlan tag regression
SMC91x: delete unused local variable "lp"
myri10ge: fix stop/go mmio ordering
bonding: fix panic when taking bond interface down before removing module
...
Diffstat (limited to 'net/core')
-rw-r--r-- | net/core/net_namespace.c | 32 | ||||
-rw-r--r-- | net/core/skbuff.c | 12 |
2 files changed, 44 insertions, 0 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index f1d07b5c1e17..1895a4ca9c4f 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c | |||
@@ -325,6 +325,38 @@ void unregister_pernet_subsys(struct pernet_operations *module) | |||
325 | } | 325 | } |
326 | EXPORT_SYMBOL_GPL(unregister_pernet_subsys); | 326 | EXPORT_SYMBOL_GPL(unregister_pernet_subsys); |
327 | 327 | ||
328 | int register_pernet_gen_subsys(int *id, struct pernet_operations *ops) | ||
329 | { | ||
330 | int rv; | ||
331 | |||
332 | mutex_lock(&net_mutex); | ||
333 | again: | ||
334 | rv = ida_get_new_above(&net_generic_ids, 1, id); | ||
335 | if (rv < 0) { | ||
336 | if (rv == -EAGAIN) { | ||
337 | ida_pre_get(&net_generic_ids, GFP_KERNEL); | ||
338 | goto again; | ||
339 | } | ||
340 | goto out; | ||
341 | } | ||
342 | rv = register_pernet_operations(first_device, ops); | ||
343 | if (rv < 0) | ||
344 | ida_remove(&net_generic_ids, *id); | ||
345 | mutex_unlock(&net_mutex); | ||
346 | out: | ||
347 | return rv; | ||
348 | } | ||
349 | EXPORT_SYMBOL_GPL(register_pernet_gen_subsys); | ||
350 | |||
351 | void unregister_pernet_gen_subsys(int id, struct pernet_operations *ops) | ||
352 | { | ||
353 | mutex_lock(&net_mutex); | ||
354 | unregister_pernet_operations(ops); | ||
355 | ida_remove(&net_generic_ids, id); | ||
356 | mutex_unlock(&net_mutex); | ||
357 | } | ||
358 | EXPORT_SYMBOL_GPL(unregister_pernet_gen_subsys); | ||
359 | |||
328 | /** | 360 | /** |
329 | * register_pernet_device - register a network namespace device | 361 | * register_pernet_device - register a network namespace device |
330 | * @ops: pernet operations structure for the subsystem | 362 | * @ops: pernet operations structure for the subsystem |
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 4e22e3a35359..ebb6b94f8af2 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -449,6 +449,18 @@ void kfree_skb(struct sk_buff *skb) | |||
449 | __kfree_skb(skb); | 449 | __kfree_skb(skb); |
450 | } | 450 | } |
451 | 451 | ||
452 | /** | ||
453 | * skb_recycle_check - check if skb can be reused for receive | ||
454 | * @skb: buffer | ||
455 | * @skb_size: minimum receive buffer size | ||
456 | * | ||
457 | * Checks that the skb passed in is not shared or cloned, and | ||
458 | * that it is linear and its head portion at least as large as | ||
459 | * skb_size so that it can be recycled as a receive buffer. | ||
460 | * If these conditions are met, this function does any necessary | ||
461 | * reference count dropping and cleans up the skbuff as if it | ||
462 | * just came from __alloc_skb(). | ||
463 | */ | ||
452 | int skb_recycle_check(struct sk_buff *skb, int skb_size) | 464 | int skb_recycle_check(struct sk_buff *skb, int skb_size) |
453 | { | 465 | { |
454 | struct skb_shared_info *shinfo; | 466 | struct skb_shared_info *shinfo; |