xref: /openbmc/linux/include/uapi/linux/if_bridge.h (revision 83f6d600)
1 /* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
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 _UAPI_LINUX_IF_BRIDGE_H
15 #define _UAPI_LINUX_IF_BRIDGE_H
16 
17 #include <linux/types.h>
18 #include <linux/if_ether.h>
19 #include <linux/in6.h>
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 
55 struct __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 
77 struct __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 
93 struct __fdb_entry {
94 	__u8 mac_addr[ETH_ALEN];
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 */
109 #define BRIDGE_MODE_UNDEF	0xFFFF  /* mode undefined */
110 
111 /* Bridge management nested attributes
112  * [IFLA_AF_SPEC] = {
113  *     [IFLA_BRIDGE_FLAGS]
114  *     [IFLA_BRIDGE_MODE]
115  *     [IFLA_BRIDGE_VLAN_INFO]
116  * }
117  */
118 enum {
119 	IFLA_BRIDGE_FLAGS,
120 	IFLA_BRIDGE_MODE,
121 	IFLA_BRIDGE_VLAN_INFO,
122 	IFLA_BRIDGE_VLAN_TUNNEL_INFO,
123 	IFLA_BRIDGE_MRP,
124 	IFLA_BRIDGE_CFM,
125 	IFLA_BRIDGE_MST,
126 	__IFLA_BRIDGE_MAX,
127 };
128 #define IFLA_BRIDGE_MAX (__IFLA_BRIDGE_MAX - 1)
129 
130 #define BRIDGE_VLAN_INFO_MASTER	(1<<0)	/* Operate on Bridge device as well */
131 #define BRIDGE_VLAN_INFO_PVID	(1<<1)	/* VLAN is PVID, ingress untagged */
132 #define BRIDGE_VLAN_INFO_UNTAGGED	(1<<2)	/* VLAN egresses untagged */
133 #define BRIDGE_VLAN_INFO_RANGE_BEGIN	(1<<3) /* VLAN is start of vlan range */
134 #define BRIDGE_VLAN_INFO_RANGE_END	(1<<4) /* VLAN is end of vlan range */
135 #define BRIDGE_VLAN_INFO_BRENTRY	(1<<5) /* Global bridge VLAN entry */
136 #define BRIDGE_VLAN_INFO_ONLY_OPTS	(1<<6) /* Skip create/delete/flags */
137 
138 struct bridge_vlan_info {
139 	__u16 flags;
140 	__u16 vid;
141 };
142 
143 enum {
144 	IFLA_BRIDGE_VLAN_TUNNEL_UNSPEC,
145 	IFLA_BRIDGE_VLAN_TUNNEL_ID,
146 	IFLA_BRIDGE_VLAN_TUNNEL_VID,
147 	IFLA_BRIDGE_VLAN_TUNNEL_FLAGS,
148 	__IFLA_BRIDGE_VLAN_TUNNEL_MAX,
149 };
150 
151 #define IFLA_BRIDGE_VLAN_TUNNEL_MAX (__IFLA_BRIDGE_VLAN_TUNNEL_MAX - 1)
152 
153 struct bridge_vlan_xstats {
154 	__u64 rx_bytes;
155 	__u64 rx_packets;
156 	__u64 tx_bytes;
157 	__u64 tx_packets;
158 	__u16 vid;
159 	__u16 flags;
160 	__u32 pad2;
161 };
162 
163 enum {
164 	IFLA_BRIDGE_MRP_UNSPEC,
165 	IFLA_BRIDGE_MRP_INSTANCE,
166 	IFLA_BRIDGE_MRP_PORT_STATE,
167 	IFLA_BRIDGE_MRP_PORT_ROLE,
168 	IFLA_BRIDGE_MRP_RING_STATE,
169 	IFLA_BRIDGE_MRP_RING_ROLE,
170 	IFLA_BRIDGE_MRP_START_TEST,
171 	IFLA_BRIDGE_MRP_INFO,
172 	IFLA_BRIDGE_MRP_IN_ROLE,
173 	IFLA_BRIDGE_MRP_IN_STATE,
174 	IFLA_BRIDGE_MRP_START_IN_TEST,
175 	__IFLA_BRIDGE_MRP_MAX,
176 };
177 
178 #define IFLA_BRIDGE_MRP_MAX (__IFLA_BRIDGE_MRP_MAX - 1)
179 
180 enum {
181 	IFLA_BRIDGE_MRP_INSTANCE_UNSPEC,
182 	IFLA_BRIDGE_MRP_INSTANCE_RING_ID,
183 	IFLA_BRIDGE_MRP_INSTANCE_P_IFINDEX,
184 	IFLA_BRIDGE_MRP_INSTANCE_S_IFINDEX,
185 	IFLA_BRIDGE_MRP_INSTANCE_PRIO,
186 	__IFLA_BRIDGE_MRP_INSTANCE_MAX,
187 };
188 
189 #define IFLA_BRIDGE_MRP_INSTANCE_MAX (__IFLA_BRIDGE_MRP_INSTANCE_MAX - 1)
190 
191 enum {
192 	IFLA_BRIDGE_MRP_PORT_STATE_UNSPEC,
193 	IFLA_BRIDGE_MRP_PORT_STATE_STATE,
194 	__IFLA_BRIDGE_MRP_PORT_STATE_MAX,
195 };
196 
197 #define IFLA_BRIDGE_MRP_PORT_STATE_MAX (__IFLA_BRIDGE_MRP_PORT_STATE_MAX - 1)
198 
199 enum {
200 	IFLA_BRIDGE_MRP_PORT_ROLE_UNSPEC,
201 	IFLA_BRIDGE_MRP_PORT_ROLE_ROLE,
202 	__IFLA_BRIDGE_MRP_PORT_ROLE_MAX,
203 };
204 
205 #define IFLA_BRIDGE_MRP_PORT_ROLE_MAX (__IFLA_BRIDGE_MRP_PORT_ROLE_MAX - 1)
206 
207 enum {
208 	IFLA_BRIDGE_MRP_RING_STATE_UNSPEC,
209 	IFLA_BRIDGE_MRP_RING_STATE_RING_ID,
210 	IFLA_BRIDGE_MRP_RING_STATE_STATE,
211 	__IFLA_BRIDGE_MRP_RING_STATE_MAX,
212 };
213 
214 #define IFLA_BRIDGE_MRP_RING_STATE_MAX (__IFLA_BRIDGE_MRP_RING_STATE_MAX - 1)
215 
216 enum {
217 	IFLA_BRIDGE_MRP_RING_ROLE_UNSPEC,
218 	IFLA_BRIDGE_MRP_RING_ROLE_RING_ID,
219 	IFLA_BRIDGE_MRP_RING_ROLE_ROLE,
220 	__IFLA_BRIDGE_MRP_RING_ROLE_MAX,
221 };
222 
223 #define IFLA_BRIDGE_MRP_RING_ROLE_MAX (__IFLA_BRIDGE_MRP_RING_ROLE_MAX - 1)
224 
225 enum {
226 	IFLA_BRIDGE_MRP_START_TEST_UNSPEC,
227 	IFLA_BRIDGE_MRP_START_TEST_RING_ID,
228 	IFLA_BRIDGE_MRP_START_TEST_INTERVAL,
229 	IFLA_BRIDGE_MRP_START_TEST_MAX_MISS,
230 	IFLA_BRIDGE_MRP_START_TEST_PERIOD,
231 	IFLA_BRIDGE_MRP_START_TEST_MONITOR,
232 	__IFLA_BRIDGE_MRP_START_TEST_MAX,
233 };
234 
235 #define IFLA_BRIDGE_MRP_START_TEST_MAX (__IFLA_BRIDGE_MRP_START_TEST_MAX - 1)
236 
237 enum {
238 	IFLA_BRIDGE_MRP_INFO_UNSPEC,
239 	IFLA_BRIDGE_MRP_INFO_RING_ID,
240 	IFLA_BRIDGE_MRP_INFO_P_IFINDEX,
241 	IFLA_BRIDGE_MRP_INFO_S_IFINDEX,
242 	IFLA_BRIDGE_MRP_INFO_PRIO,
243 	IFLA_BRIDGE_MRP_INFO_RING_STATE,
244 	IFLA_BRIDGE_MRP_INFO_RING_ROLE,
245 	IFLA_BRIDGE_MRP_INFO_TEST_INTERVAL,
246 	IFLA_BRIDGE_MRP_INFO_TEST_MAX_MISS,
247 	IFLA_BRIDGE_MRP_INFO_TEST_MONITOR,
248 	IFLA_BRIDGE_MRP_INFO_I_IFINDEX,
249 	IFLA_BRIDGE_MRP_INFO_IN_STATE,
250 	IFLA_BRIDGE_MRP_INFO_IN_ROLE,
251 	IFLA_BRIDGE_MRP_INFO_IN_TEST_INTERVAL,
252 	IFLA_BRIDGE_MRP_INFO_IN_TEST_MAX_MISS,
253 	__IFLA_BRIDGE_MRP_INFO_MAX,
254 };
255 
256 #define IFLA_BRIDGE_MRP_INFO_MAX (__IFLA_BRIDGE_MRP_INFO_MAX - 1)
257 
258 enum {
259 	IFLA_BRIDGE_MRP_IN_STATE_UNSPEC,
260 	IFLA_BRIDGE_MRP_IN_STATE_IN_ID,
261 	IFLA_BRIDGE_MRP_IN_STATE_STATE,
262 	__IFLA_BRIDGE_MRP_IN_STATE_MAX,
263 };
264 
265 #define IFLA_BRIDGE_MRP_IN_STATE_MAX (__IFLA_BRIDGE_MRP_IN_STATE_MAX - 1)
266 
267 enum {
268 	IFLA_BRIDGE_MRP_IN_ROLE_UNSPEC,
269 	IFLA_BRIDGE_MRP_IN_ROLE_RING_ID,
270 	IFLA_BRIDGE_MRP_IN_ROLE_IN_ID,
271 	IFLA_BRIDGE_MRP_IN_ROLE_ROLE,
272 	IFLA_BRIDGE_MRP_IN_ROLE_I_IFINDEX,
273 	__IFLA_BRIDGE_MRP_IN_ROLE_MAX,
274 };
275 
276 #define IFLA_BRIDGE_MRP_IN_ROLE_MAX (__IFLA_BRIDGE_MRP_IN_ROLE_MAX - 1)
277 
278 enum {
279 	IFLA_BRIDGE_MRP_START_IN_TEST_UNSPEC,
280 	IFLA_BRIDGE_MRP_START_IN_TEST_IN_ID,
281 	IFLA_BRIDGE_MRP_START_IN_TEST_INTERVAL,
282 	IFLA_BRIDGE_MRP_START_IN_TEST_MAX_MISS,
283 	IFLA_BRIDGE_MRP_START_IN_TEST_PERIOD,
284 	__IFLA_BRIDGE_MRP_START_IN_TEST_MAX,
285 };
286 
287 #define IFLA_BRIDGE_MRP_START_IN_TEST_MAX (__IFLA_BRIDGE_MRP_START_IN_TEST_MAX - 1)
288 
289 struct br_mrp_instance {
290 	__u32 ring_id;
291 	__u32 p_ifindex;
292 	__u32 s_ifindex;
293 	__u16 prio;
294 };
295 
296 struct br_mrp_ring_state {
297 	__u32 ring_id;
298 	__u32 ring_state;
299 };
300 
301 struct br_mrp_ring_role {
302 	__u32 ring_id;
303 	__u32 ring_role;
304 };
305 
306 struct br_mrp_start_test {
307 	__u32 ring_id;
308 	__u32 interval;
309 	__u32 max_miss;
310 	__u32 period;
311 	__u32 monitor;
312 };
313 
314 struct br_mrp_in_state {
315 	__u32 in_state;
316 	__u16 in_id;
317 };
318 
319 struct br_mrp_in_role {
320 	__u32 ring_id;
321 	__u32 in_role;
322 	__u32 i_ifindex;
323 	__u16 in_id;
324 };
325 
326 struct br_mrp_start_in_test {
327 	__u32 interval;
328 	__u32 max_miss;
329 	__u32 period;
330 	__u16 in_id;
331 };
332 
333 enum {
334 	IFLA_BRIDGE_CFM_UNSPEC,
335 	IFLA_BRIDGE_CFM_MEP_CREATE,
336 	IFLA_BRIDGE_CFM_MEP_DELETE,
337 	IFLA_BRIDGE_CFM_MEP_CONFIG,
338 	IFLA_BRIDGE_CFM_CC_CONFIG,
339 	IFLA_BRIDGE_CFM_CC_PEER_MEP_ADD,
340 	IFLA_BRIDGE_CFM_CC_PEER_MEP_REMOVE,
341 	IFLA_BRIDGE_CFM_CC_RDI,
342 	IFLA_BRIDGE_CFM_CC_CCM_TX,
343 	IFLA_BRIDGE_CFM_MEP_CREATE_INFO,
344 	IFLA_BRIDGE_CFM_MEP_CONFIG_INFO,
345 	IFLA_BRIDGE_CFM_CC_CONFIG_INFO,
346 	IFLA_BRIDGE_CFM_CC_RDI_INFO,
347 	IFLA_BRIDGE_CFM_CC_CCM_TX_INFO,
348 	IFLA_BRIDGE_CFM_CC_PEER_MEP_INFO,
349 	IFLA_BRIDGE_CFM_MEP_STATUS_INFO,
350 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_INFO,
351 	__IFLA_BRIDGE_CFM_MAX,
352 };
353 
354 #define IFLA_BRIDGE_CFM_MAX (__IFLA_BRIDGE_CFM_MAX - 1)
355 
356 enum {
357 	IFLA_BRIDGE_CFM_MEP_CREATE_UNSPEC,
358 	IFLA_BRIDGE_CFM_MEP_CREATE_INSTANCE,
359 	IFLA_BRIDGE_CFM_MEP_CREATE_DOMAIN,
360 	IFLA_BRIDGE_CFM_MEP_CREATE_DIRECTION,
361 	IFLA_BRIDGE_CFM_MEP_CREATE_IFINDEX,
362 	__IFLA_BRIDGE_CFM_MEP_CREATE_MAX,
363 };
364 
365 #define IFLA_BRIDGE_CFM_MEP_CREATE_MAX (__IFLA_BRIDGE_CFM_MEP_CREATE_MAX - 1)
366 
367 enum {
368 	IFLA_BRIDGE_CFM_MEP_DELETE_UNSPEC,
369 	IFLA_BRIDGE_CFM_MEP_DELETE_INSTANCE,
370 	__IFLA_BRIDGE_CFM_MEP_DELETE_MAX,
371 };
372 
373 #define IFLA_BRIDGE_CFM_MEP_DELETE_MAX (__IFLA_BRIDGE_CFM_MEP_DELETE_MAX - 1)
374 
375 enum {
376 	IFLA_BRIDGE_CFM_MEP_CONFIG_UNSPEC,
377 	IFLA_BRIDGE_CFM_MEP_CONFIG_INSTANCE,
378 	IFLA_BRIDGE_CFM_MEP_CONFIG_UNICAST_MAC,
379 	IFLA_BRIDGE_CFM_MEP_CONFIG_MDLEVEL,
380 	IFLA_BRIDGE_CFM_MEP_CONFIG_MEPID,
381 	__IFLA_BRIDGE_CFM_MEP_CONFIG_MAX,
382 };
383 
384 #define IFLA_BRIDGE_CFM_MEP_CONFIG_MAX (__IFLA_BRIDGE_CFM_MEP_CONFIG_MAX - 1)
385 
386 enum {
387 	IFLA_BRIDGE_CFM_CC_CONFIG_UNSPEC,
388 	IFLA_BRIDGE_CFM_CC_CONFIG_INSTANCE,
389 	IFLA_BRIDGE_CFM_CC_CONFIG_ENABLE,
390 	IFLA_BRIDGE_CFM_CC_CONFIG_EXP_INTERVAL,
391 	IFLA_BRIDGE_CFM_CC_CONFIG_EXP_MAID,
392 	__IFLA_BRIDGE_CFM_CC_CONFIG_MAX,
393 };
394 
395 #define IFLA_BRIDGE_CFM_CC_CONFIG_MAX (__IFLA_BRIDGE_CFM_CC_CONFIG_MAX - 1)
396 
397 enum {
398 	IFLA_BRIDGE_CFM_CC_PEER_MEP_UNSPEC,
399 	IFLA_BRIDGE_CFM_CC_PEER_MEP_INSTANCE,
400 	IFLA_BRIDGE_CFM_CC_PEER_MEPID,
401 	__IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX,
402 };
403 
404 #define IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX (__IFLA_BRIDGE_CFM_CC_PEER_MEP_MAX - 1)
405 
406 enum {
407 	IFLA_BRIDGE_CFM_CC_RDI_UNSPEC,
408 	IFLA_BRIDGE_CFM_CC_RDI_INSTANCE,
409 	IFLA_BRIDGE_CFM_CC_RDI_RDI,
410 	__IFLA_BRIDGE_CFM_CC_RDI_MAX,
411 };
412 
413 #define IFLA_BRIDGE_CFM_CC_RDI_MAX (__IFLA_BRIDGE_CFM_CC_RDI_MAX - 1)
414 
415 enum {
416 	IFLA_BRIDGE_CFM_CC_CCM_TX_UNSPEC,
417 	IFLA_BRIDGE_CFM_CC_CCM_TX_INSTANCE,
418 	IFLA_BRIDGE_CFM_CC_CCM_TX_DMAC,
419 	IFLA_BRIDGE_CFM_CC_CCM_TX_SEQ_NO_UPDATE,
420 	IFLA_BRIDGE_CFM_CC_CCM_TX_PERIOD,
421 	IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV,
422 	IFLA_BRIDGE_CFM_CC_CCM_TX_IF_TLV_VALUE,
423 	IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV,
424 	IFLA_BRIDGE_CFM_CC_CCM_TX_PORT_TLV_VALUE,
425 	__IFLA_BRIDGE_CFM_CC_CCM_TX_MAX,
426 };
427 
428 #define IFLA_BRIDGE_CFM_CC_CCM_TX_MAX (__IFLA_BRIDGE_CFM_CC_CCM_TX_MAX - 1)
429 
430 enum {
431 	IFLA_BRIDGE_CFM_MEP_STATUS_UNSPEC,
432 	IFLA_BRIDGE_CFM_MEP_STATUS_INSTANCE,
433 	IFLA_BRIDGE_CFM_MEP_STATUS_OPCODE_UNEXP_SEEN,
434 	IFLA_BRIDGE_CFM_MEP_STATUS_VERSION_UNEXP_SEEN,
435 	IFLA_BRIDGE_CFM_MEP_STATUS_RX_LEVEL_LOW_SEEN,
436 	__IFLA_BRIDGE_CFM_MEP_STATUS_MAX,
437 };
438 
439 #define IFLA_BRIDGE_CFM_MEP_STATUS_MAX (__IFLA_BRIDGE_CFM_MEP_STATUS_MAX - 1)
440 
441 enum {
442 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_UNSPEC,
443 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_INSTANCE,
444 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_PEER_MEPID,
445 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_CCM_DEFECT,
446 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_RDI,
447 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_PORT_TLV_VALUE,
448 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_IF_TLV_VALUE,
449 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEEN,
450 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_TLV_SEEN,
451 	IFLA_BRIDGE_CFM_CC_PEER_STATUS_SEQ_UNEXP_SEEN,
452 	__IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX,
453 };
454 
455 #define IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX (__IFLA_BRIDGE_CFM_CC_PEER_STATUS_MAX - 1)
456 
457 enum {
458 	IFLA_BRIDGE_MST_UNSPEC,
459 	IFLA_BRIDGE_MST_ENTRY,
460 	__IFLA_BRIDGE_MST_MAX,
461 };
462 #define IFLA_BRIDGE_MST_MAX (__IFLA_BRIDGE_MST_MAX - 1)
463 
464 enum {
465 	IFLA_BRIDGE_MST_ENTRY_UNSPEC,
466 	IFLA_BRIDGE_MST_ENTRY_MSTI,
467 	IFLA_BRIDGE_MST_ENTRY_STATE,
468 	__IFLA_BRIDGE_MST_ENTRY_MAX,
469 };
470 #define IFLA_BRIDGE_MST_ENTRY_MAX (__IFLA_BRIDGE_MST_ENTRY_MAX - 1)
471 
472 struct bridge_stp_xstats {
473 	__u64 transition_blk;
474 	__u64 transition_fwd;
475 	__u64 rx_bpdu;
476 	__u64 tx_bpdu;
477 	__u64 rx_tcn;
478 	__u64 tx_tcn;
479 };
480 
481 /* Bridge vlan RTM header */
482 struct br_vlan_msg {
483 	__u8 family;
484 	__u8 reserved1;
485 	__u16 reserved2;
486 	__u32 ifindex;
487 };
488 
489 enum {
490 	BRIDGE_VLANDB_DUMP_UNSPEC,
491 	BRIDGE_VLANDB_DUMP_FLAGS,
492 	__BRIDGE_VLANDB_DUMP_MAX,
493 };
494 #define BRIDGE_VLANDB_DUMP_MAX (__BRIDGE_VLANDB_DUMP_MAX - 1)
495 
496 /* flags used in BRIDGE_VLANDB_DUMP_FLAGS attribute to affect dumps */
497 #define BRIDGE_VLANDB_DUMPF_STATS	(1 << 0) /* Include stats in the dump */
498 #define BRIDGE_VLANDB_DUMPF_GLOBAL	(1 << 1) /* Dump global vlan options only */
499 
500 /* Bridge vlan RTM attributes
501  * [BRIDGE_VLANDB_ENTRY] = {
502  *     [BRIDGE_VLANDB_ENTRY_INFO]
503  *     ...
504  * }
505  * [BRIDGE_VLANDB_GLOBAL_OPTIONS] = {
506  *     [BRIDGE_VLANDB_GOPTS_ID]
507  *     ...
508  * }
509  */
510 enum {
511 	BRIDGE_VLANDB_UNSPEC,
512 	BRIDGE_VLANDB_ENTRY,
513 	BRIDGE_VLANDB_GLOBAL_OPTIONS,
514 	__BRIDGE_VLANDB_MAX,
515 };
516 #define BRIDGE_VLANDB_MAX (__BRIDGE_VLANDB_MAX - 1)
517 
518 enum {
519 	BRIDGE_VLANDB_ENTRY_UNSPEC,
520 	BRIDGE_VLANDB_ENTRY_INFO,
521 	BRIDGE_VLANDB_ENTRY_RANGE,
522 	BRIDGE_VLANDB_ENTRY_STATE,
523 	BRIDGE_VLANDB_ENTRY_TUNNEL_INFO,
524 	BRIDGE_VLANDB_ENTRY_STATS,
525 	BRIDGE_VLANDB_ENTRY_MCAST_ROUTER,
526 	BRIDGE_VLANDB_ENTRY_MCAST_N_GROUPS,
527 	BRIDGE_VLANDB_ENTRY_MCAST_MAX_GROUPS,
528 	BRIDGE_VLANDB_ENTRY_NEIGH_SUPPRESS,
529 	__BRIDGE_VLANDB_ENTRY_MAX,
530 };
531 #define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
532 
533 /* [BRIDGE_VLANDB_ENTRY] = {
534  *     [BRIDGE_VLANDB_ENTRY_TUNNEL_INFO] = {
535  *         [BRIDGE_VLANDB_TINFO_ID]
536  *         ...
537  *     }
538  * }
539  */
540 enum {
541 	BRIDGE_VLANDB_TINFO_UNSPEC,
542 	BRIDGE_VLANDB_TINFO_ID,
543 	BRIDGE_VLANDB_TINFO_CMD,
544 	__BRIDGE_VLANDB_TINFO_MAX,
545 };
546 #define BRIDGE_VLANDB_TINFO_MAX (__BRIDGE_VLANDB_TINFO_MAX - 1)
547 
548 /* [BRIDGE_VLANDB_ENTRY] = {
549  *     [BRIDGE_VLANDB_ENTRY_STATS] = {
550  *         [BRIDGE_VLANDB_STATS_RX_BYTES]
551  *         ...
552  *     }
553  *     ...
554  * }
555  */
556 enum {
557 	BRIDGE_VLANDB_STATS_UNSPEC,
558 	BRIDGE_VLANDB_STATS_RX_BYTES,
559 	BRIDGE_VLANDB_STATS_RX_PACKETS,
560 	BRIDGE_VLANDB_STATS_TX_BYTES,
561 	BRIDGE_VLANDB_STATS_TX_PACKETS,
562 	BRIDGE_VLANDB_STATS_PAD,
563 	__BRIDGE_VLANDB_STATS_MAX,
564 };
565 #define BRIDGE_VLANDB_STATS_MAX (__BRIDGE_VLANDB_STATS_MAX - 1)
566 
567 enum {
568 	BRIDGE_VLANDB_GOPTS_UNSPEC,
569 	BRIDGE_VLANDB_GOPTS_ID,
570 	BRIDGE_VLANDB_GOPTS_RANGE,
571 	BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING,
572 	BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION,
573 	BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION,
574 	BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_CNT,
575 	BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT,
576 	BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_INTVL,
577 	BRIDGE_VLANDB_GOPTS_PAD,
578 	BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL,
579 	BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_INTVL,
580 	BRIDGE_VLANDB_GOPTS_MCAST_QUERY_INTVL,
581 	BRIDGE_VLANDB_GOPTS_MCAST_QUERY_RESPONSE_INTVL,
582 	BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL,
583 	BRIDGE_VLANDB_GOPTS_MCAST_QUERIER,
584 	BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS,
585 	BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE,
586 	BRIDGE_VLANDB_GOPTS_MSTI,
587 	__BRIDGE_VLANDB_GOPTS_MAX
588 };
589 #define BRIDGE_VLANDB_GOPTS_MAX (__BRIDGE_VLANDB_GOPTS_MAX - 1)
590 
591 /* Bridge multicast database attributes
592  * [MDBA_MDB] = {
593  *     [MDBA_MDB_ENTRY] = {
594  *         [MDBA_MDB_ENTRY_INFO] {
595  *		struct br_mdb_entry
596  *		[MDBA_MDB_EATTR attributes]
597  *         }
598  *     }
599  * }
600  * [MDBA_ROUTER] = {
601  *    [MDBA_ROUTER_PORT] = {
602  *        u32 ifindex
603  *        [MDBA_ROUTER_PATTR attributes]
604  *    }
605  * }
606  */
607 enum {
608 	MDBA_UNSPEC,
609 	MDBA_MDB,
610 	MDBA_ROUTER,
611 	__MDBA_MAX,
612 };
613 #define MDBA_MAX (__MDBA_MAX - 1)
614 
615 enum {
616 	MDBA_MDB_UNSPEC,
617 	MDBA_MDB_ENTRY,
618 	__MDBA_MDB_MAX,
619 };
620 #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
621 
622 enum {
623 	MDBA_MDB_ENTRY_UNSPEC,
624 	MDBA_MDB_ENTRY_INFO,
625 	__MDBA_MDB_ENTRY_MAX,
626 };
627 #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
628 
629 /* per mdb entry additional attributes */
630 enum {
631 	MDBA_MDB_EATTR_UNSPEC,
632 	MDBA_MDB_EATTR_TIMER,
633 	MDBA_MDB_EATTR_SRC_LIST,
634 	MDBA_MDB_EATTR_GROUP_MODE,
635 	MDBA_MDB_EATTR_SOURCE,
636 	MDBA_MDB_EATTR_RTPROT,
637 	MDBA_MDB_EATTR_DST,
638 	MDBA_MDB_EATTR_DST_PORT,
639 	MDBA_MDB_EATTR_VNI,
640 	MDBA_MDB_EATTR_IFINDEX,
641 	MDBA_MDB_EATTR_SRC_VNI,
642 	__MDBA_MDB_EATTR_MAX
643 };
644 #define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1)
645 
646 /* per mdb entry source */
647 enum {
648 	MDBA_MDB_SRCLIST_UNSPEC,
649 	MDBA_MDB_SRCLIST_ENTRY,
650 	__MDBA_MDB_SRCLIST_MAX
651 };
652 #define MDBA_MDB_SRCLIST_MAX (__MDBA_MDB_SRCLIST_MAX - 1)
653 
654 /* per mdb entry per source attributes
655  * these are embedded in MDBA_MDB_SRCLIST_ENTRY
656  */
657 enum {
658 	MDBA_MDB_SRCATTR_UNSPEC,
659 	MDBA_MDB_SRCATTR_ADDRESS,
660 	MDBA_MDB_SRCATTR_TIMER,
661 	__MDBA_MDB_SRCATTR_MAX
662 };
663 #define MDBA_MDB_SRCATTR_MAX (__MDBA_MDB_SRCATTR_MAX - 1)
664 
665 /* multicast router types */
666 enum {
667 	MDB_RTR_TYPE_DISABLED,
668 	MDB_RTR_TYPE_TEMP_QUERY,
669 	MDB_RTR_TYPE_PERM,
670 	MDB_RTR_TYPE_TEMP
671 };
672 
673 enum {
674 	MDBA_ROUTER_UNSPEC,
675 	MDBA_ROUTER_PORT,
676 	__MDBA_ROUTER_MAX,
677 };
678 #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
679 
680 /* router port attributes */
681 enum {
682 	MDBA_ROUTER_PATTR_UNSPEC,
683 	MDBA_ROUTER_PATTR_TIMER,
684 	MDBA_ROUTER_PATTR_TYPE,
685 	MDBA_ROUTER_PATTR_INET_TIMER,
686 	MDBA_ROUTER_PATTR_INET6_TIMER,
687 	MDBA_ROUTER_PATTR_VID,
688 	__MDBA_ROUTER_PATTR_MAX
689 };
690 #define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1)
691 
692 struct br_port_msg {
693 	__u8  family;
694 	__u32 ifindex;
695 };
696 
697 struct br_mdb_entry {
698 	__u32 ifindex;
699 #define MDB_TEMPORARY 0
700 #define MDB_PERMANENT 1
701 	__u8 state;
702 #define MDB_FLAGS_OFFLOAD	(1 << 0)
703 #define MDB_FLAGS_FAST_LEAVE	(1 << 1)
704 #define MDB_FLAGS_STAR_EXCL	(1 << 2)
705 #define MDB_FLAGS_BLOCKED	(1 << 3)
706 	__u8 flags;
707 	__u16 vid;
708 	struct {
709 		union {
710 			__be32	ip4;
711 			struct in6_addr ip6;
712 			unsigned char mac_addr[ETH_ALEN];
713 		} u;
714 		__be16		proto;
715 	} addr;
716 };
717 
718 enum {
719 	MDBA_SET_ENTRY_UNSPEC,
720 	MDBA_SET_ENTRY,
721 	MDBA_SET_ENTRY_ATTRS,
722 	__MDBA_SET_ENTRY_MAX,
723 };
724 #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
725 
726 /* [MDBA_SET_ENTRY_ATTRS] = {
727  *    [MDBE_ATTR_xxx]
728  *    ...
729  * }
730  */
731 enum {
732 	MDBE_ATTR_UNSPEC,
733 	MDBE_ATTR_SOURCE,
734 	MDBE_ATTR_SRC_LIST,
735 	MDBE_ATTR_GROUP_MODE,
736 	MDBE_ATTR_RTPROT,
737 	MDBE_ATTR_DST,
738 	MDBE_ATTR_DST_PORT,
739 	MDBE_ATTR_VNI,
740 	MDBE_ATTR_IFINDEX,
741 	MDBE_ATTR_SRC_VNI,
742 	__MDBE_ATTR_MAX,
743 };
744 #define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
745 
746 /* per mdb entry source */
747 enum {
748 	MDBE_SRC_LIST_UNSPEC,
749 	MDBE_SRC_LIST_ENTRY,
750 	__MDBE_SRC_LIST_MAX,
751 };
752 #define MDBE_SRC_LIST_MAX (__MDBE_SRC_LIST_MAX - 1)
753 
754 /* per mdb entry per source attributes
755  * these are embedded in MDBE_SRC_LIST_ENTRY
756  */
757 enum {
758 	MDBE_SRCATTR_UNSPEC,
759 	MDBE_SRCATTR_ADDRESS,
760 	__MDBE_SRCATTR_MAX,
761 };
762 #define MDBE_SRCATTR_MAX (__MDBE_SRCATTR_MAX - 1)
763 
764 /* Embedded inside LINK_XSTATS_TYPE_BRIDGE */
765 enum {
766 	BRIDGE_XSTATS_UNSPEC,
767 	BRIDGE_XSTATS_VLAN,
768 	BRIDGE_XSTATS_MCAST,
769 	BRIDGE_XSTATS_PAD,
770 	BRIDGE_XSTATS_STP,
771 	__BRIDGE_XSTATS_MAX
772 };
773 #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
774 
775 enum {
776 	BR_MCAST_DIR_RX,
777 	BR_MCAST_DIR_TX,
778 	BR_MCAST_DIR_SIZE
779 };
780 
781 /* IGMP/MLD statistics */
782 struct br_mcast_stats {
783 	__u64 igmp_v1queries[BR_MCAST_DIR_SIZE];
784 	__u64 igmp_v2queries[BR_MCAST_DIR_SIZE];
785 	__u64 igmp_v3queries[BR_MCAST_DIR_SIZE];
786 	__u64 igmp_leaves[BR_MCAST_DIR_SIZE];
787 	__u64 igmp_v1reports[BR_MCAST_DIR_SIZE];
788 	__u64 igmp_v2reports[BR_MCAST_DIR_SIZE];
789 	__u64 igmp_v3reports[BR_MCAST_DIR_SIZE];
790 	__u64 igmp_parse_errors;
791 
792 	__u64 mld_v1queries[BR_MCAST_DIR_SIZE];
793 	__u64 mld_v2queries[BR_MCAST_DIR_SIZE];
794 	__u64 mld_leaves[BR_MCAST_DIR_SIZE];
795 	__u64 mld_v1reports[BR_MCAST_DIR_SIZE];
796 	__u64 mld_v2reports[BR_MCAST_DIR_SIZE];
797 	__u64 mld_parse_errors;
798 
799 	__u64 mcast_bytes[BR_MCAST_DIR_SIZE];
800 	__u64 mcast_packets[BR_MCAST_DIR_SIZE];
801 };
802 
803 /* bridge boolean options
804  * BR_BOOLOPT_NO_LL_LEARN - disable learning from link-local packets
805  * BR_BOOLOPT_MCAST_VLAN_SNOOPING - control vlan multicast snooping
806  *
807  * IMPORTANT: if adding a new option do not forget to handle
808  *            it in br_boolopt_toggle/get and bridge sysfs
809  */
810 enum br_boolopt_id {
811 	BR_BOOLOPT_NO_LL_LEARN,
812 	BR_BOOLOPT_MCAST_VLAN_SNOOPING,
813 	BR_BOOLOPT_MST_ENABLE,
814 	BR_BOOLOPT_MAX
815 };
816 
817 /* struct br_boolopt_multi - change multiple bridge boolean options
818  *
819  * @optval: new option values (bit per option)
820  * @optmask: options to change (bit per option)
821  */
822 struct br_boolopt_multi {
823 	__u32 optval;
824 	__u32 optmask;
825 };
826 
827 enum {
828 	BRIDGE_QUERIER_UNSPEC,
829 	BRIDGE_QUERIER_IP_ADDRESS,
830 	BRIDGE_QUERIER_IP_PORT,
831 	BRIDGE_QUERIER_IP_OTHER_TIMER,
832 	BRIDGE_QUERIER_PAD,
833 	BRIDGE_QUERIER_IPV6_ADDRESS,
834 	BRIDGE_QUERIER_IPV6_PORT,
835 	BRIDGE_QUERIER_IPV6_OTHER_TIMER,
836 	__BRIDGE_QUERIER_MAX
837 };
838 #define BRIDGE_QUERIER_MAX (__BRIDGE_QUERIER_MAX - 1)
839 #endif /* _UAPI_LINUX_IF_BRIDGE_H */
840