]> git.proxmox.com Git - mirror_iproute2.git/blame - include/uapi/linux/if_bridge.h
Update kernel headers
[mirror_iproute2.git] / include / uapi / linux / if_bridge.h
CommitLineData
ba914908 1/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
08342500
SH
2/*
3 * Linux ethernet bridge
4 *
5 * Authors:
6 * Lennert Buytenhek <buytenh@gnu.org>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13
14#ifndef _LINUX_IF_BRIDGE_H
15#define _LINUX_IF_BRIDGE_H
16
17#include <linux/types.h>
6b2ed935 18#include <linux/if_ether.h>
e9c4b7c3 19#include <linux/in6.h>
08342500
SH
20
21#define SYSFS_BRIDGE_ATTR "bridge"
22#define SYSFS_BRIDGE_FDB "brforward"
23#define SYSFS_BRIDGE_PORT_SUBDIR "brif"
24#define SYSFS_BRIDGE_PORT_ATTR "brport"
25#define SYSFS_BRIDGE_PORT_LINK "bridge"
26
27#define BRCTL_VERSION 1
28
29#define BRCTL_GET_VERSION 0
30#define BRCTL_GET_BRIDGES 1
31#define BRCTL_ADD_BRIDGE 2
32#define BRCTL_DEL_BRIDGE 3
33#define BRCTL_ADD_IF 4
34#define BRCTL_DEL_IF 5
35#define BRCTL_GET_BRIDGE_INFO 6
36#define BRCTL_GET_PORT_LIST 7
37#define BRCTL_SET_BRIDGE_FORWARD_DELAY 8
38#define BRCTL_SET_BRIDGE_HELLO_TIME 9
39#define BRCTL_SET_BRIDGE_MAX_AGE 10
40#define BRCTL_SET_AGEING_TIME 11
41#define BRCTL_SET_GC_INTERVAL 12
42#define BRCTL_GET_PORT_INFO 13
43#define BRCTL_SET_BRIDGE_STP_STATE 14
44#define BRCTL_SET_BRIDGE_PRIORITY 15
45#define BRCTL_SET_PORT_PRIORITY 16
46#define BRCTL_SET_PATH_COST 17
47#define BRCTL_GET_FDB_ENTRIES 18
48
49#define BR_STATE_DISABLED 0
50#define BR_STATE_LISTENING 1
51#define BR_STATE_LEARNING 2
52#define BR_STATE_FORWARDING 3
53#define BR_STATE_BLOCKING 4
54
55struct __bridge_info {
56 __u64 designated_root;
57 __u64 bridge_id;
58 __u32 root_path_cost;
59 __u32 max_age;
60 __u32 hello_time;
61 __u32 forward_delay;
62 __u32 bridge_max_age;
63 __u32 bridge_hello_time;
64 __u32 bridge_forward_delay;
65 __u8 topology_change;
66 __u8 topology_change_detected;
67 __u8 root_port;
68 __u8 stp_enabled;
69 __u32 ageing_time;
70 __u32 gc_interval;
71 __u32 hello_timer_value;
72 __u32 tcn_timer_value;
73 __u32 topology_change_timer_value;
74 __u32 gc_timer_value;
75};
76
77struct __port_info {
78 __u64 designated_root;
79 __u64 designated_bridge;
80 __u16 port_id;
81 __u16 designated_port;
82 __u32 path_cost;
83 __u32 designated_cost;
84 __u8 state;
85 __u8 top_change_ack;
86 __u8 config_pending;
87 __u8 unused0;
88 __u32 message_age_timer_value;
89 __u32 forward_delay_timer_value;
90 __u32 hold_timer_value;
91};
92
93struct __fdb_entry {
6b2ed935 94 __u8 mac_addr[ETH_ALEN];
08342500
SH
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/* Bridge Flags */
104#define BRIDGE_FLAGS_MASTER 1 /* Bridge command to/from master */
105#define BRIDGE_FLAGS_SELF 2 /* Bridge command to/from lowerdev */
106
107#define BRIDGE_MODE_VEB 0 /* Default loopback mode */
108#define BRIDGE_MODE_VEPA 1 /* 802.1Qbg defined VEPA mode */
093f18fd 109#define BRIDGE_MODE_UNDEF 0xFFFF /* mode undefined */
08342500
SH
110
111/* Bridge management nested attributes
112 * [IFLA_AF_SPEC] = {
113 * [IFLA_BRIDGE_FLAGS]
114 * [IFLA_BRIDGE_MODE]
609106d3 115 * [IFLA_BRIDGE_VLAN_INFO]
08342500
SH
116 * }
117 */
118enum {
119 IFLA_BRIDGE_FLAGS,
120 IFLA_BRIDGE_MODE,
609106d3 121 IFLA_BRIDGE_VLAN_INFO,
985091aa 122 IFLA_BRIDGE_VLAN_TUNNEL_INFO,
08342500
SH
123 __IFLA_BRIDGE_MAX,
124};
125#define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
126
609106d3
SH
127#define BRIDGE_VLAN_INFO_MASTER (1<<0) /* Operate on Bridge device as well */
128#define BRIDGE_VLAN_INFO_PVID (1<<1) /* VLAN is PVID, ingress untagged */
129#define BRIDGE_VLAN_INFO_UNTAGGED (1<<2) /* VLAN egresses untagged */
f233410d
SH
130#define BRIDGE_VLAN_INFO_RANGE_BEGIN (1<<3) /* VLAN is start of vlan range */
131#define BRIDGE_VLAN_INFO_RANGE_END (1<<4) /* VLAN is end of vlan range */
23e90509 132#define BRIDGE_VLAN_INFO_BRENTRY (1<<5) /* Global bridge VLAN entry */
f9ed2db5 133#define BRIDGE_VLAN_INFO_ONLY_OPTS (1<<6) /* Skip create/delete/flags */
609106d3
SH
134
135struct bridge_vlan_info {
136 __u16 flags;
137 __u16 vid;
138};
139
985091aa
SH
140enum {
141 IFLA_BRIDGE_VLAN_TUNNEL_UNSPEC,
142 IFLA_BRIDGE_VLAN_TUNNEL_ID,
143 IFLA_BRIDGE_VLAN_TUNNEL_VID,
144 IFLA_BRIDGE_VLAN_TUNNEL_FLAGS,
145 __IFLA_BRIDGE_VLAN_TUNNEL_MAX,
146};
147
148#define IFLA_BRIDGE_VLAN_TUNNEL_MAX (__IFLA_BRIDGE_VLAN_TUNNEL_MAX - 1)
149
31ce6e01
SH
150struct bridge_vlan_xstats {
151 __u64 rx_bytes;
152 __u64 rx_packets;
153 __u64 tx_bytes;
154 __u64 tx_packets;
155 __u16 vid;
380656f8 156 __u16 flags;
31ce6e01
SH
157 __u32 pad2;
158};
159
974f889c
DA
160struct bridge_stp_xstats {
161 __u64 transition_blk;
162 __u64 transition_fwd;
163 __u64 rx_bpdu;
164 __u64 tx_bpdu;
165 __u64 rx_tcn;
166 __u64 tx_tcn;
167};
168
8b802d20
DA
169/* Bridge vlan RTM header */
170struct br_vlan_msg {
171 __u8 family;
172 __u8 reserved1;
173 __u16 reserved2;
174 __u32 ifindex;
175};
176
25091a76
DA
177enum {
178 BRIDGE_VLANDB_DUMP_UNSPEC,
179 BRIDGE_VLANDB_DUMP_FLAGS,
180 __BRIDGE_VLANDB_DUMP_MAX,
181};
182#define BRIDGE_VLANDB_DUMP_MAX (__BRIDGE_VLANDB_DUMP_MAX - 1)
183
184/* flags used in BRIDGE_VLANDB_DUMP_FLAGS attribute to affect dumps */
185#define BRIDGE_VLANDB_DUMPF_STATS (1 << 0) /* Include stats in the dump */
186
8b802d20
DA
187/* Bridge vlan RTM attributes
188 * [BRIDGE_VLANDB_ENTRY] = {
189 * [BRIDGE_VLANDB_ENTRY_INFO]
190 * ...
191 * }
192 */
193enum {
194 BRIDGE_VLANDB_UNSPEC,
195 BRIDGE_VLANDB_ENTRY,
196 __BRIDGE_VLANDB_MAX,
197};
198#define BRIDGE_VLANDB_MAX (__BRIDGE_VLANDB_MAX - 1)
199
200enum {
201 BRIDGE_VLANDB_ENTRY_UNSPEC,
202 BRIDGE_VLANDB_ENTRY_INFO,
203 BRIDGE_VLANDB_ENTRY_RANGE,
f9ed2db5 204 BRIDGE_VLANDB_ENTRY_STATE,
1ff1edb6 205 BRIDGE_VLANDB_ENTRY_TUNNEL_INFO,
25091a76 206 BRIDGE_VLANDB_ENTRY_STATS,
8b802d20
DA
207 __BRIDGE_VLANDB_ENTRY_MAX,
208};
209#define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
210
1ff1edb6
DA
211/* [BRIDGE_VLANDB_ENTRY] = {
212 * [BRIDGE_VLANDB_ENTRY_TUNNEL_INFO] = {
213 * [BRIDGE_VLANDB_TINFO_ID]
214 * ...
215 * }
216 * }
217 */
218enum {
219 BRIDGE_VLANDB_TINFO_UNSPEC,
220 BRIDGE_VLANDB_TINFO_ID,
221 BRIDGE_VLANDB_TINFO_CMD,
222 __BRIDGE_VLANDB_TINFO_MAX,
223};
224#define BRIDGE_VLANDB_TINFO_MAX (__BRIDGE_VLANDB_TINFO_MAX - 1)
225
25091a76
DA
226/* [BRIDGE_VLANDB_ENTRY] = {
227 * [BRIDGE_VLANDB_ENTRY_STATS] = {
228 * [BRIDGE_VLANDB_STATS_RX_BYTES]
229 * ...
230 * }
231 * ...
232 * }
233 */
234enum {
235 BRIDGE_VLANDB_STATS_UNSPEC,
236 BRIDGE_VLANDB_STATS_RX_BYTES,
237 BRIDGE_VLANDB_STATS_RX_PACKETS,
238 BRIDGE_VLANDB_STATS_TX_BYTES,
239 BRIDGE_VLANDB_STATS_TX_PACKETS,
240 BRIDGE_VLANDB_STATS_PAD,
241 __BRIDGE_VLANDB_STATS_MAX,
242};
243#define BRIDGE_VLANDB_STATS_MAX (__BRIDGE_VLANDB_STATS_MAX - 1)
244
08342500
SH
245/* Bridge multicast database attributes
246 * [MDBA_MDB] = {
247 * [MDBA_MDB_ENTRY] = {
2421ab75
SH
248 * [MDBA_MDB_ENTRY_INFO] {
249 * struct br_mdb_entry
250 * [MDBA_MDB_EATTR attributes]
251 * }
08342500
SH
252 * }
253 * }
254 * [MDBA_ROUTER] = {
2421ab75
SH
255 * [MDBA_ROUTER_PORT] = {
256 * u32 ifindex
257 * [MDBA_ROUTER_PATTR attributes]
258 * }
08342500
SH
259 * }
260 */
261enum {
262 MDBA_UNSPEC,
263 MDBA_MDB,
264 MDBA_ROUTER,
265 __MDBA_MAX,
266};
267#define MDBA_MAX (__MDBA_MAX - 1)
268
269enum {
270 MDBA_MDB_UNSPEC,
271 MDBA_MDB_ENTRY,
272 __MDBA_MDB_MAX,
273};
274#define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
275
276enum {
277 MDBA_MDB_ENTRY_UNSPEC,
278 MDBA_MDB_ENTRY_INFO,
279 __MDBA_MDB_ENTRY_MAX,
280};
281#define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
282
2421ab75
SH
283/* per mdb entry additional attributes */
284enum {
285 MDBA_MDB_EATTR_UNSPEC,
286 MDBA_MDB_EATTR_TIMER,
287 __MDBA_MDB_EATTR_MAX
288};
289#define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1)
290
291/* multicast router types */
292enum {
293 MDB_RTR_TYPE_DISABLED,
294 MDB_RTR_TYPE_TEMP_QUERY,
295 MDB_RTR_TYPE_PERM,
296 MDB_RTR_TYPE_TEMP
297};
298
08342500
SH
299enum {
300 MDBA_ROUTER_UNSPEC,
301 MDBA_ROUTER_PORT,
302 __MDBA_ROUTER_MAX,
303};
304#define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
305
2421ab75
SH
306/* router port attributes */
307enum {
308 MDBA_ROUTER_PATTR_UNSPEC,
309 MDBA_ROUTER_PATTR_TIMER,
310 MDBA_ROUTER_PATTR_TYPE,
311 __MDBA_ROUTER_PATTR_MAX
312};
313#define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1)
314
08342500 315struct br_port_msg {
9dca6767 316 __u8 family;
08342500
SH
317 __u32 ifindex;
318};
319
320struct br_mdb_entry {
321 __u32 ifindex;
75e003c2
SH
322#define MDB_TEMPORARY 0
323#define MDB_PERMANENT 1
324 __u8 state;
8593b2ca 325#define MDB_FLAGS_OFFLOAD (1 << 0)
e3af717a 326#define MDB_FLAGS_FAST_LEAVE (1 << 1)
8593b2ca 327 __u8 flags;
a3563ede 328 __u16 vid;
08342500
SH
329 struct {
330 union {
331 __be32 ip4;
332 struct in6_addr ip6;
333 } u;
334 __be16 proto;
335 } addr;
336};
337
9dca6767
CW
338enum {
339 MDBA_SET_ENTRY_UNSPEC,
340 MDBA_SET_ENTRY,
341 __MDBA_SET_ENTRY_MAX,
342};
343#define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
344
31ce6e01
SH
345/* Embedded inside LINK_XSTATS_TYPE_BRIDGE */
346enum {
347 BRIDGE_XSTATS_UNSPEC,
348 BRIDGE_XSTATS_VLAN,
4824bb41
SH
349 BRIDGE_XSTATS_MCAST,
350 BRIDGE_XSTATS_PAD,
974f889c 351 BRIDGE_XSTATS_STP,
31ce6e01
SH
352 __BRIDGE_XSTATS_MAX
353};
354#define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
355
4824bb41
SH
356enum {
357 BR_MCAST_DIR_RX,
358 BR_MCAST_DIR_TX,
359 BR_MCAST_DIR_SIZE
360};
361
362/* IGMP/MLD statistics */
363struct br_mcast_stats {
a9514280
SH
364 __u64 igmp_v1queries[BR_MCAST_DIR_SIZE];
365 __u64 igmp_v2queries[BR_MCAST_DIR_SIZE];
366 __u64 igmp_v3queries[BR_MCAST_DIR_SIZE];
4824bb41
SH
367 __u64 igmp_leaves[BR_MCAST_DIR_SIZE];
368 __u64 igmp_v1reports[BR_MCAST_DIR_SIZE];
369 __u64 igmp_v2reports[BR_MCAST_DIR_SIZE];
370 __u64 igmp_v3reports[BR_MCAST_DIR_SIZE];
371 __u64 igmp_parse_errors;
372
a9514280
SH
373 __u64 mld_v1queries[BR_MCAST_DIR_SIZE];
374 __u64 mld_v2queries[BR_MCAST_DIR_SIZE];
4824bb41
SH
375 __u64 mld_leaves[BR_MCAST_DIR_SIZE];
376 __u64 mld_v1reports[BR_MCAST_DIR_SIZE];
377 __u64 mld_v2reports[BR_MCAST_DIR_SIZE];
378 __u64 mld_parse_errors;
379
380 __u64 mcast_bytes[BR_MCAST_DIR_SIZE];
381 __u64 mcast_packets[BR_MCAST_DIR_SIZE];
382};
17689d30
DA
383
384/* bridge boolean options
385 * BR_BOOLOPT_NO_LL_LEARN - disable learning from link-local packets
386 *
387 * IMPORTANT: if adding a new option do not forget to handle
388 * it in br_boolopt_toggle/get and bridge sysfs
389 */
390enum br_boolopt_id {
391 BR_BOOLOPT_NO_LL_LEARN,
392 BR_BOOLOPT_MAX
393};
394
395/* struct br_boolopt_multi - change multiple bridge boolean options
396 *
397 * @optval: new option values (bit per option)
398 * @optmask: options to change (bit per option)
399 */
400struct br_boolopt_multi {
401 __u32 optval;
402 __u32 optmask;
403};
08342500 404#endif /* _LINUX_IF_BRIDGE_H */