xref: /illumos-gate/usr/src/uts/common/net/bridge.h (revision 56a3cd3d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _NET_BRIDGE_H
28 #define	_NET_BRIDGE_H
29 
30 /*
31  * Private communication interface between bridging related daemons and kernel
32  * layer-two (Ethernet) bridging module.
33  */
34 
35 #include <sys/param.h>
36 #include <sys/dld.h>
37 #include <sys/ethernet.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /* Specified by IEEE 802.1d */
44 #define	BRIDGE_GROUP_ADDRESS	{ 0x01, 0x80, 0xC2, 0, 0, 0 }
45 
46 /* The constant below is "BRG" in hex. */
47 #define	_BRIOC(n)	(0x42524700 + (n))
48 
49 #define	BRIOC_NEWBRIDGE	_BRIOC(1)	/* Create bridge; bridge_newbridge_t */
50 #define	BRIOC_ADDLINK	_BRIOC(2)	/* Add link to bridge; linkid+name */
51 #define	BRIOC_REMLINK	_BRIOC(3)	/* Remove link from bridge; linkid */
52 #define	BRIOC_SETSTATE	_BRIOC(4)	/* bridge_setstate_t */
53 #define	BRIOC_SETPVID	_BRIOC(5)	/* bridge_setpvid_t */
54 #define	BRIOC_VLANENAB	_BRIOC(6)	/* bridge_vlanenab_t */
55 #define	BRIOC_FLUSHFWD	_BRIOC(7)	/* bridge_flushfwd_t */
56 #define	BRIOC_LISTFWD	_BRIOC(8)	/* bridge_listfwd_t */
57 #define	BRIOC_TABLEMAX	_BRIOC(8)	/* uint32_t */
58 
59 #define	BRIDGE_CTL	"bridgectl"
60 #define	BRIDGE_CTLPATH	"/dev/" BRIDGE_CTL
61 
62 typedef struct bridge_newbridge_s {
63 	datalink_id_t	bnb_linkid;		/* bridge link ID */
64 	char		bnb_name[MAXNAMELEN];	/* bridge name */
65 } bridge_newbridge_t;
66 
67 typedef enum bridge_state_e {
68 	BLS_BLOCKLISTEN,		/* blocking or listening state */
69 	BLS_LEARNING,			/* learning state */
70 	BLS_FORWARDING			/* forwarding state */
71 } bridge_state_t;
72 
73 typedef struct bridge_setstate_s {
74 	datalink_id_t	bss_linkid;
75 	bridge_state_t	bss_state;
76 } bridge_setstate_t;
77 
78 typedef struct bridge_setpvid_s {
79 	datalink_id_t	bsv_linkid;
80 	uint_t		bsv_vlan;
81 } bridge_setpvid_t;
82 
83 typedef struct bridge_vlanenab_s {
84 	datalink_id_t	bve_linkid;
85 	uint_t		bve_vlan;
86 	boolean_t	bve_onoff;
87 } bridge_vlanenab_t;
88 
89 typedef struct bridge_flushfwd_s {
90 	datalink_id_t	bff_linkid;
91 	boolean_t	bff_exclude;
92 } bridge_flushfwd_t;
93 
94 typedef struct bridge_listfwd_s {
95 	char		blf_name[MAXNAMELEN];	/* bridge name */
96 	ether_addr_t	blf_dest;
97 	uint16_t	blf_trill_nick;
98 	uint_t		blf_ms_age;
99 	boolean_t	blf_is_local;
100 	datalink_id_t	blf_linkid;
101 } bridge_listfwd_t;
102 
103 /* Upward control messages */
104 typedef struct bridge_ctl_s {
105 	datalink_id_t	bc_linkid;
106 	boolean_t	bc_failed;	/* Max SDU mismatch */
107 } bridge_ctl_t;
108 
109 /* GLDv3 control ioctls used by Bridging */
110 #define	BRIDGE_IOC_LISTFWD	BRIDGEIOC(1)
111 
112 #ifdef __cplusplus
113 }
114 #endif
115 
116 #endif /* _NET_BRIDGE_H */
117