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