]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - include/uapi/linux/if_bridge.h
Merge tag 'upstream-3.12-rc1' of git://git.infradead.org/linux-ubifs
[mirror_ubuntu-jammy-kernel.git] / include / uapi / 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 _UAPI_LINUX_IF_BRIDGE_H
14 #define _UAPI_LINUX_IF_BRIDGE_H
15
16 #include <linux/types.h>
17 #include <linux/if_ether.h>
18
19 #define SYSFS_BRIDGE_ATTR "bridge"
20 #define SYSFS_BRIDGE_FDB "brforward"
21 #define SYSFS_BRIDGE_PORT_SUBDIR "brif"
22 #define SYSFS_BRIDGE_PORT_ATTR "brport"
23 #define SYSFS_BRIDGE_PORT_LINK "bridge"
24
25 #define BRCTL_VERSION 1
26
27 #define BRCTL_GET_VERSION 0
28 #define BRCTL_GET_BRIDGES 1
29 #define BRCTL_ADD_BRIDGE 2
30 #define BRCTL_DEL_BRIDGE 3
31 #define BRCTL_ADD_IF 4
32 #define BRCTL_DEL_IF 5
33 #define BRCTL_GET_BRIDGE_INFO 6
34 #define BRCTL_GET_PORT_LIST 7
35 #define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
36 #define BRCTL_SET_BRIDGE_HELLO_TIME 9
37 #define BRCTL_SET_BRIDGE_MAX_AGE 10
38 #define BRCTL_SET_AGEING_TIME 11
39 #define BRCTL_SET_GC_INTERVAL 12
40 #define BRCTL_GET_PORT_INFO 13
41 #define BRCTL_SET_BRIDGE_STP_STATE 14
42 #define BRCTL_SET_BRIDGE_PRIORITY 15
43 #define BRCTL_SET_PORT_PRIORITY 16
44 #define BRCTL_SET_PATH_COST 17
45 #define BRCTL_GET_FDB_ENTRIES 18
46
47 #define BR_STATE_DISABLED 0
48 #define BR_STATE_LISTENING 1
49 #define BR_STATE_LEARNING 2
50 #define BR_STATE_FORWARDING 3
51 #define BR_STATE_BLOCKING 4
52
53 struct __bridge_info {
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 __u64 designated_root;
77 __u64 designated_bridge;
78 __u16 port_id;
79 __u16 designated_port;
80 __u32 path_cost;
81 __u32 designated_cost;
82 __u8 state;
83 __u8 top_change_ack;
84 __u8 config_pending;
85 __u8 unused0;
86 __u32 message_age_timer_value;
87 __u32 forward_delay_timer_value;
88 __u32 hold_timer_value;
89 };
90
91 struct __fdb_entry {
92 __u8 mac_addr[ETH_ALEN];
93 __u8 port_no;
94 __u8 is_local;
95 __u32 ageing_timer_value;
96 __u8 port_hi;
97 __u8 pad0;
98 __u16 unused;
99 };
100
101 /* Bridge Flags */
102 #define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */
103 #define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */
104
105 #define BRIDGE_MODE_VEB 0 /* Default loopback mode */
106 #define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
107
108 /* Bridge management nested attributes
109 * [IFLA_AF_SPEC] = {
110 * [IFLA_BRIDGE_FLAGS]
111 * [IFLA_BRIDGE_MODE]
112 * [IFLA_BRIDGE_VLAN_INFO]
113 * }
114 */
115 enum {
116 IFLA_BRIDGE_FLAGS,
117 IFLA_BRIDGE_MODE,
118 IFLA_BRIDGE_VLAN_INFO,
119 __IFLA_BRIDGE_MAX,
120 };
121 #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
122
123 #define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */
124 #define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */
125 #define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */
126
127 struct bridge_vlan_info {
128 __u16 flags;
129 __u16 vid;
130 };
131
132 /* Bridge multicast database attributes
133 * [MDBA_MDB] = {
134 * [MDBA_MDB_ENTRY] = {
135 * [MDBA_MDB_ENTRY_INFO]
136 * }
137 * }
138 * [MDBA_ROUTER] = {
139 * [MDBA_ROUTER_PORT]
140 * }
141 */
142 enum {
143 MDBA_UNSPEC,
144 MDBA_MDB,
145 MDBA_ROUTER,
146 __MDBA_MAX,
147 };
148 #define MDBA_MAX (__MDBA_MAX - 1)
149
150 enum {
151 MDBA_MDB_UNSPEC,
152 MDBA_MDB_ENTRY,
153 __MDBA_MDB_MAX,
154 };
155 #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
156
157 enum {
158 MDBA_MDB_ENTRY_UNSPEC,
159 MDBA_MDB_ENTRY_INFO,
160 __MDBA_MDB_ENTRY_MAX,
161 };
162 #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
163
164 enum {
165 MDBA_ROUTER_UNSPEC,
166 MDBA_ROUTER_PORT,
167 __MDBA_ROUTER_MAX,
168 };
169 #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
170
171 struct br_port_msg {
172 __u8 family;
173 __u32 ifindex;
174 };
175
176 struct br_mdb_entry {
177 __u32 ifindex;
178 #define MDB_TEMPORARY 0
179 #define MDB_PERMANENT 1
180 __u8 state;
181 struct {
182 union {
183 __be32 ip4;
184 struct in6_addr ip6;
185 } u;
186 __be16 proto;
187 } addr;
188 };
189
190 enum {
191 MDBA_SET_ENTRY_UNSPEC,
192 MDBA_SET_ENTRY,
193 __MDBA_SET_ENTRY_MAX,
194 };
195 #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
196
197 #endif /* _UAPI_LINUX_IF_BRIDGE_H */