Merge branch 'master' into for-upstream
[linux-2.6] / include / linux / if_bridge.h
1 /*
2  *      Linux ethernet bridge
3  *
4  *      Authors:
5  *      Lennert Buytenhek               <buytenh@gnu.org>
6  *
7  *      This program is free software; you can redistribute it and/or
8  *      modify it under the terms of the GNU General Public License
9  *      as published by the Free Software Foundation; either version
10  *      2 of the License, or (at your option) any later version.
11  */
12
13 #ifndef _LINUX_IF_BRIDGE_H
14 #define _LINUX_IF_BRIDGE_H
15
16 #include <linux/types.h>
17
18 #define SYSFS_BRIDGE_ATTR       "bridge"
19 #define SYSFS_BRIDGE_FDB        "brforward"
20 #define SYSFS_BRIDGE_PORT_SUBDIR "brif"
21 #define SYSFS_BRIDGE_PORT_ATTR  "brport"
22 #define SYSFS_BRIDGE_PORT_LINK  "bridge"
23
24 #define BRCTL_VERSION 1
25
26 #define BRCTL_GET_VERSION 0
27 #define BRCTL_GET_BRIDGES 1
28 #define BRCTL_ADD_BRIDGE 2
29 #define BRCTL_DEL_BRIDGE 3
30 #define BRCTL_ADD_IF 4
31 #define BRCTL_DEL_IF 5
32 #define BRCTL_GET_BRIDGE_INFO 6
33 #define BRCTL_GET_PORT_LIST 7
34 #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
35 #define BRCTL_SET_BRIDGE_HELLO_TIME 9
36 #define BRCTL_SET_BRIDGE_MAX_AGE 10
37 #define BRCTL_SET_AGEING_TIME 11
38 #define BRCTL_SET_GC_INTERVAL 12
39 #define BRCTL_GET_PORT_INFO 13
40 #define BRCTL_SET_BRIDGE_STP_STATE 14
41 #define BRCTL_SET_BRIDGE_PRIORITY 15
42 #define BRCTL_SET_PORT_PRIORITY 16
43 #define BRCTL_SET_PATH_COST 17
44 #define BRCTL_GET_FDB_ENTRIES 18
45
46 #define BR_STATE_DISABLED 0
47 #define BR_STATE_LISTENING 1
48 #define BR_STATE_LEARNING 2
49 #define BR_STATE_FORWARDING 3
50 #define BR_STATE_BLOCKING 4
51
52 struct __bridge_info
53 {
54         __u64 designated_root;
55         __u64 bridge_id;
56         __u32 root_path_cost;
57         __u32 max_age;
58         __u32 hello_time;
59         __u32 forward_delay;
60         __u32 bridge_max_age;
61         __u32 bridge_hello_time;
62         __u32 bridge_forward_delay;
63         __u8 topology_change;
64         __u8 topology_change_detected;
65         __u8 root_port;
66         __u8 stp_enabled;
67         __u32 ageing_time;
68         __u32 gc_interval;
69         __u32 hello_timer_value;
70         __u32 tcn_timer_value;
71         __u32 topology_change_timer_value;
72         __u32 gc_timer_value;
73 };
74
75 struct __port_info
76 {
77         __u64 designated_root;
78         __u64 designated_bridge;
79         __u16 port_id;
80         __u16 designated_port;
81         __u32 path_cost;
82         __u32 designated_cost;
83         __u8 state;
84         __u8 top_change_ack;
85         __u8 config_pending;
86         __u8 unused0;
87         __u32 message_age_timer_value;
88         __u32 forward_delay_timer_value;
89         __u32 hold_timer_value;
90 };
91
92 struct __fdb_entry
93 {
94         __u8 mac_addr[6];
95         __u8 port_no;
96         __u8 is_local;
97         __u32 ageing_timer_value;
98         __u8 port_hi;
99         __u8 pad0;
100         __u16 unused;
101 };
102
103 #ifdef __KERNEL__
104
105 #include <linux/netdevice.h>
106
107 extern void brioctl_set(int (*ioctl_hook)(struct net *, unsigned int, void __user *));
108 extern struct sk_buff *(*br_handle_frame_hook)(struct net_bridge_port *p,
109                                                struct sk_buff *skb);
110 extern int (*br_should_route_hook)(struct sk_buff *skb);
111
112 #endif
113
114 #endif