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