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_MAX,
527 };
528 #define BRIDGE_VLANDB_ENTRY_MAX (__BRIDGE_VLANDB_ENTRY_MAX - 1)
529 
530 /* [BRIDGE_VLANDB_ENTRY] = {
531  *     [BRIDGE_VLANDB_ENTRY_TUNNEL_INFO] = {
532  *         [BRIDGE_VLANDB_TINFO_ID]
533  *         ...
534  *     }
535  * }
536  */
537 enum {
538 	BRIDGE_VLANDB_TINFO_UNSPEC,
539 	BRIDGE_VLANDB_TINFO_ID,
540 	BRIDGE_VLANDB_TINFO_CMD,
541 	__BRIDGE_VLANDB_TINFO_MAX,
542 };
543 #define BRIDGE_VLANDB_TINFO_MAX (__BRIDGE_VLANDB_TINFO_MAX - 1)
544 
545 /* [BRIDGE_VLANDB_ENTRY] = {
546  *     [BRIDGE_VLANDB_ENTRY_STATS] = {
547  *         [BRIDGE_VLANDB_STATS_RX_BYTES]
548  *         ...
549  *     }
550  *     ...
551  * }
552  */
553 enum {
554 	BRIDGE_VLANDB_STATS_UNSPEC,
555 	BRIDGE_VLANDB_STATS_RX_BYTES,
556 	BRIDGE_VLANDB_STATS_RX_PACKETS,
557 	BRIDGE_VLANDB_STATS_TX_BYTES,
558 	BRIDGE_VLANDB_STATS_TX_PACKETS,
559 	BRIDGE_VLANDB_STATS_PAD,
560 	__BRIDGE_VLANDB_STATS_MAX,
561 };
562 #define BRIDGE_VLANDB_STATS_MAX (__BRIDGE_VLANDB_STATS_MAX - 1)
563 
564 enum {
565 	BRIDGE_VLANDB_GOPTS_UNSPEC,
566 	BRIDGE_VLANDB_GOPTS_ID,
567 	BRIDGE_VLANDB_GOPTS_RANGE,
568 	BRIDGE_VLANDB_GOPTS_MCAST_SNOOPING,
569 	BRIDGE_VLANDB_GOPTS_MCAST_IGMP_VERSION,
570 	BRIDGE_VLANDB_GOPTS_MCAST_MLD_VERSION,
571 	BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_CNT,
572 	BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_CNT,
573 	BRIDGE_VLANDB_GOPTS_MCAST_LAST_MEMBER_INTVL,
574 	BRIDGE_VLANDB_GOPTS_PAD,
575 	BRIDGE_VLANDB_GOPTS_MCAST_MEMBERSHIP_INTVL,
576 	BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_INTVL,
577 	BRIDGE_VLANDB_GOPTS_MCAST_QUERY_INTVL,
578 	BRIDGE_VLANDB_GOPTS_MCAST_QUERY_RESPONSE_INTVL,
579 	BRIDGE_VLANDB_GOPTS_MCAST_STARTUP_QUERY_INTVL,
580 	BRIDGE_VLANDB_GOPTS_MCAST_QUERIER,
581 	BRIDGE_VLANDB_GOPTS_MCAST_ROUTER_PORTS,
582 	BRIDGE_VLANDB_GOPTS_MCAST_QUERIER_STATE,
583 	BRIDGE_VLANDB_GOPTS_MSTI,
584 	__BRIDGE_VLANDB_GOPTS_MAX
585 };
586 #define BRIDGE_VLANDB_GOPTS_MAX (__BRIDGE_VLANDB_GOPTS_MAX - 1)
587 
588 /* Bridge multicast database attributes
589  * [MDBA_MDB] = {
590  *     [MDBA_MDB_ENTRY] = {
591  *         [MDBA_MDB_ENTRY_INFO] {
592  *		struct br_mdb_entry
593  *		[MDBA_MDB_EATTR attributes]
594  *         }
595  *     }
596  * }
597  * [MDBA_ROUTER] = {
598  *    [MDBA_ROUTER_PORT] = {
599  *        u32 ifindex
600  *        [MDBA_ROUTER_PATTR attributes]
601  *    }
602  * }
603  */
604 enum {
605 	MDBA_UNSPEC,
606 	MDBA_MDB,
607 	MDBA_ROUTER,
608 	__MDBA_MAX,
609 };
610 #define MDBA_MAX (__MDBA_MAX - 1)
611 
612 enum {
613 	MDBA_MDB_UNSPEC,
614 	MDBA_MDB_ENTRY,
615 	__MDBA_MDB_MAX,
616 };
617 #define MDBA_MDB_MAX (__MDBA_MDB_MAX - 1)
618 
619 enum {
620 	MDBA_MDB_ENTRY_UNSPEC,
621 	MDBA_MDB_ENTRY_INFO,
622 	__MDBA_MDB_ENTRY_MAX,
623 };
624 #define MDBA_MDB_ENTRY_MAX (__MDBA_MDB_ENTRY_MAX - 1)
625 
626 /* per mdb entry additional attributes */
627 enum {
628 	MDBA_MDB_EATTR_UNSPEC,
629 	MDBA_MDB_EATTR_TIMER,
630 	MDBA_MDB_EATTR_SRC_LIST,
631 	MDBA_MDB_EATTR_GROUP_MODE,
632 	MDBA_MDB_EATTR_SOURCE,
633 	MDBA_MDB_EATTR_RTPROT,
634 	__MDBA_MDB_EATTR_MAX
635 };
636 #define MDBA_MDB_EATTR_MAX (__MDBA_MDB_EATTR_MAX - 1)
637 
638 /* per mdb entry source */
639 enum {
640 	MDBA_MDB_SRCLIST_UNSPEC,
641 	MDBA_MDB_SRCLIST_ENTRY,
642 	__MDBA_MDB_SRCLIST_MAX
643 };
644 #define MDBA_MDB_SRCLIST_MAX (__MDBA_MDB_SRCLIST_MAX - 1)
645 
646 /* per mdb entry per source attributes
647  * these are embedded in MDBA_MDB_SRCLIST_ENTRY
648  */
649 enum {
650 	MDBA_MDB_SRCATTR_UNSPEC,
651 	MDBA_MDB_SRCATTR_ADDRESS,
652 	MDBA_MDB_SRCATTR_TIMER,
653 	__MDBA_MDB_SRCATTR_MAX
654 };
655 #define MDBA_MDB_SRCATTR_MAX (__MDBA_MDB_SRCATTR_MAX - 1)
656 
657 /* multicast router types */
658 enum {
659 	MDB_RTR_TYPE_DISABLED,
660 	MDB_RTR_TYPE_TEMP_QUERY,
661 	MDB_RTR_TYPE_PERM,
662 	MDB_RTR_TYPE_TEMP
663 };
664 
665 enum {
666 	MDBA_ROUTER_UNSPEC,
667 	MDBA_ROUTER_PORT,
668 	__MDBA_ROUTER_MAX,
669 };
670 #define MDBA_ROUTER_MAX (__MDBA_ROUTER_MAX - 1)
671 
672 /* router port attributes */
673 enum {
674 	MDBA_ROUTER_PATTR_UNSPEC,
675 	MDBA_ROUTER_PATTR_TIMER,
676 	MDBA_ROUTER_PATTR_TYPE,
677 	MDBA_ROUTER_PATTR_INET_TIMER,
678 	MDBA_ROUTER_PATTR_INET6_TIMER,
679 	MDBA_ROUTER_PATTR_VID,
680 	__MDBA_ROUTER_PATTR_MAX
681 };
682 #define MDBA_ROUTER_PATTR_MAX (__MDBA_ROUTER_PATTR_MAX - 1)
683 
684 struct br_port_msg {
685 	__u8  family;
686 	__u32 ifindex;
687 };
688 
689 struct br_mdb_entry {
690 	__u32 ifindex;
691 #define MDB_TEMPORARY 0
692 #define MDB_PERMANENT 1
693 	__u8 state;
694 #define MDB_FLAGS_OFFLOAD	(1 << 0)
695 #define MDB_FLAGS_FAST_LEAVE	(1 << 1)
696 #define MDB_FLAGS_STAR_EXCL	(1 << 2)
697 #define MDB_FLAGS_BLOCKED	(1 << 3)
698 	__u8 flags;
699 	__u16 vid;
700 	struct {
701 		union {
702 			__be32	ip4;
703 			struct in6_addr ip6;
704 			unsigned char mac_addr[ETH_ALEN];
705 		} u;
706 		__be16		proto;
707 	} addr;
708 };
709 
710 enum {
711 	MDBA_SET_ENTRY_UNSPEC,
712 	MDBA_SET_ENTRY,
713 	MDBA_SET_ENTRY_ATTRS,
714 	__MDBA_SET_ENTRY_MAX,
715 };
716 #define MDBA_SET_ENTRY_MAX (__MDBA_SET_ENTRY_MAX - 1)
717 
718 /* [MDBA_SET_ENTRY_ATTRS] = {
719  *    [MDBE_ATTR_xxx]
720  *    ...
721  * }
722  */
723 enum {
724 	MDBE_ATTR_UNSPEC,
725 	MDBE_ATTR_SOURCE,
726 	__MDBE_ATTR_MAX,
727 };
728 #define MDBE_ATTR_MAX (__MDBE_ATTR_MAX - 1)
729 
730 /* Embedded inside LINK_XSTATS_TYPE_BRIDGE */
731 enum {
732 	BRIDGE_XSTATS_UNSPEC,
733 	BRIDGE_XSTATS_VLAN,
734 	BRIDGE_XSTATS_MCAST,
735 	BRIDGE_XSTATS_PAD,
736 	BRIDGE_XSTATS_STP,
737 	__BRIDGE_XSTATS_MAX
738 };
739 #define BRIDGE_XSTATS_MAX (__BRIDGE_XSTATS_MAX - 1)
740 
741 enum {
742 	BR_MCAST_DIR_RX,
743 	BR_MCAST_DIR_TX,
744 	BR_MCAST_DIR_SIZE
745 };
746 
747 /* IGMP/MLD statistics */
748 struct br_mcast_stats {
749 	__u64 igmp_v1queries[BR_MCAST_DIR_SIZE];
750 	__u64 igmp_v2queries[BR_MCAST_DIR_SIZE];
751 	__u64 igmp_v3queries[BR_MCAST_DIR_SIZE];
752 	__u64 igmp_leaves[BR_MCAST_DIR_SIZE];
753 	__u64 igmp_v1reports[BR_MCAST_DIR_SIZE];
754 	__u64 igmp_v2reports[BR_MCAST_DIR_SIZE];
755 	__u64 igmp_v3reports[BR_MCAST_DIR_SIZE];
756 	__u64 igmp_parse_errors;
757 
758 	__u64 mld_v1queries[BR_MCAST_DIR_SIZE];
759 	__u64 mld_v2queries[BR_MCAST_DIR_SIZE];
760 	__u64 mld_leaves[BR_MCAST_DIR_SIZE];
761 	__u64 mld_v1reports[BR_MCAST_DIR_SIZE];
762 	__u64 mld_v2reports[BR_MCAST_DIR_SIZE];
763 	__u64 mld_parse_errors;
764 
765 	__u64 mcast_bytes[BR_MCAST_DIR_SIZE];
766 	__u64 mcast_packets[BR_MCAST_DIR_SIZE];
767 };
768 
769 /* bridge boolean options
770  * BR_BOOLOPT_NO_LL_LEARN - disable learning from link-local packets
771  * BR_BOOLOPT_MCAST_VLAN_SNOOPING - control vlan multicast snooping
772  *
773  * IMPORTANT: if adding a new option do not forget to handle
774  *            it in br_boolopt_toggle/get and bridge sysfs
775  */
776 enum br_boolopt_id {
777 	BR_BOOLOPT_NO_LL_LEARN,
778 	BR_BOOLOPT_MCAST_VLAN_SNOOPING,
779 	BR_BOOLOPT_MST_ENABLE,
780 	BR_BOOLOPT_MAX
781 };
782 
783 /* struct br_boolopt_multi - change multiple bridge boolean options
784  *
785  * @optval: new option values (bit per option)
786  * @optmask: options to change (bit per option)
787  */
788 struct br_boolopt_multi {
789 	__u32 optval;
790 	__u32 optmask;
791 };
792 
793 enum {
794 	BRIDGE_QUERIER_UNSPEC,
795 	BRIDGE_QUERIER_IP_ADDRESS,
796 	BRIDGE_QUERIER_IP_PORT,
797 	BRIDGE_QUERIER_IP_OTHER_TIMER,
798 	BRIDGE_QUERIER_PAD,
799 	BRIDGE_QUERIER_IPV6_ADDRESS,
800 	BRIDGE_QUERIER_IPV6_PORT,
801 	BRIDGE_QUERIER_IPV6_OTHER_TIMER,
802 	__BRIDGE_QUERIER_MAX
803 };
804 #define BRIDGE_QUERIER_MAX (__BRIDGE_QUERIER_MAX - 1)
805 #endif /* _UAPI_LINUX_IF_BRIDGE_H */
806