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