cleanup
[linux-2.4.21-pre4.git] / net / bridge / br.c
1 /*
2  *      Generic parts
3  *      Linux ethernet bridge
4  *
5  *      Authors:
6  *      Lennert Buytenhek               <buytenh@gnu.org>
7  *
8  *      $Id: br.c,v 1.1.1.1 2005/04/11 02:51:12 jack Exp $
9  *
10  *      This program is free software; you can redistribute it and/or
11  *      modify it under the terms of the GNU General Public License
12  *      as published by the Free Software Foundation; either version
13  *      2 of the License, or (at your option) any later version.
14  */
15
16 #include <linux/config.h>
17 #include <linux/module.h>
18 #include <linux/kernel.h>
19 #include <linux/miscdevice.h>
20 #include <linux/netdevice.h>
21 #include <linux/etherdevice.h>
22 #include <linux/init.h>
23 #include <linux/if_bridge.h>
24 #include <linux/brlock.h>
25 #include <asm/uaccess.h>
26 #include "br_private.h"
27
28 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
29 #include "../atm/lec.h"
30 #endif
31
32 int (*br_should_route_hook) (struct sk_buff **pskb) = NULL;
33
34 void br_dec_use_count()
35 {
36         MOD_DEC_USE_COUNT;
37 }
38
39 void br_inc_use_count()
40 {
41         MOD_INC_USE_COUNT;
42 }
43
44 static int __init br_init(void)
45 {
46         printk(KERN_INFO "NET4: Ethernet Bridge 008 for NET4.0\n");
47
48         br_handle_frame_hook = br_handle_frame;
49         br_ioctl_hook = br_ioctl_deviceless_stub;
50 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
51         br_fdb_get_hook = br_fdb_get;
52         br_fdb_put_hook = br_fdb_put;
53 #endif
54         register_netdevice_notifier(&br_device_notifier);
55
56         return 0;
57 }
58
59 static void __br_clear_ioctl_hook(void)
60 {
61         br_ioctl_hook = NULL;
62 }
63
64 static void __exit br_deinit(void)
65 {
66         unregister_netdevice_notifier(&br_device_notifier);
67         br_call_ioctl_atomic(__br_clear_ioctl_hook);
68
69         br_write_lock_bh(BR_NETPROTO_LOCK);
70         br_handle_frame_hook = NULL;
71         br_write_unlock_bh(BR_NETPROTO_LOCK);
72
73 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
74         br_fdb_get_hook = NULL;
75         br_fdb_put_hook = NULL;
76 #endif
77 }
78
79 EXPORT_SYMBOL(br_should_route_hook);
80
81 module_init(br_init)
82 module_exit(br_deinit)
83 MODULE_LICENSE("GPL");