xref: /titanic_51/usr/src/uts/common/net/bridge.h (revision 6915124bb75bc67ae012532a3a7727adc043a7cb)
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/dld_ioc.h>
38 #include <sys/ethernet.h>
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /* Specified by IEEE 802.1d */
45 #define	BRIDGE_GROUP_ADDRESS	{ 0x01, 0x80, 0xC2, 0, 0, 0 }
46 
47 /* The constant below is "BRG" in hex. */
48 #define	_BRIOC(n)	(0x42524700 + (n))
49 
50 #define	BRIOC_NEWBRIDGE	_BRIOC(1)	/* Create bridge; bridge_newbridge_t */
51 #define	BRIOC_ADDLINK	_BRIOC(2)	/* Add link to bridge; linkid+name */
52 #define	BRIOC_REMLINK	_BRIOC(3)	/* Remove link from bridge; linkid */
53 #define	BRIOC_SETSTATE	_BRIOC(4)	/* bridge_setstate_t */
54 #define	BRIOC_SETPVID	_BRIOC(5)	/* bridge_setpvid_t */
55 #define	BRIOC_VLANENAB	_BRIOC(6)	/* bridge_vlanenab_t */
56 #define	BRIOC_FLUSHFWD	_BRIOC(7)	/* bridge_flushfwd_t */
57 #define	BRIOC_LISTFWD	_BRIOC(8)	/* bridge_listfwd_t */
58 #define	BRIOC_TABLEMAX	_BRIOC(8)	/* uint32_t */
59 
60 #define	BRIDGE_CTL	"bridgectl"
61 #define	BRIDGE_CTLPATH	"/dev/" BRIDGE_CTL
62 
63 typedef struct bridge_newbridge_s {
64 	datalink_id_t	bnb_linkid;		/* bridge link ID */
65 	char		bnb_name[MAXNAMELEN];	/* bridge name */
66 } bridge_newbridge_t;
67 
68 typedef enum bridge_state_e {
69 	BLS_BLOCKLISTEN,		/* blocking or listening state */
70 	BLS_LEARNING,			/* learning state */
71 	BLS_FORWARDING			/* forwarding state */
72 } bridge_state_t;
73 
74 typedef struct bridge_setstate_s {
75 	datalink_id_t	bss_linkid;
76 	bridge_state_t	bss_state;
77 } bridge_setstate_t;
78 
79 typedef struct bridge_setpvid_s {
80 	datalink_id_t	bsv_linkid;
81 	uint_t		bsv_vlan;
82 } bridge_setpvid_t;
83 
84 typedef struct bridge_vlanenab_s {
85 	datalink_id_t	bve_linkid;
86 	uint_t		bve_vlan;
87 	boolean_t	bve_onoff;
88 } bridge_vlanenab_t;
89 
90 typedef struct bridge_flushfwd_s {
91 	datalink_id_t	bff_linkid;
92 	boolean_t	bff_exclude;
93 } bridge_flushfwd_t;
94 
95 typedef struct bridge_listfwd_s {
96 	char		blf_name[MAXNAMELEN];	/* bridge name */
97 	ether_addr_t	blf_dest;
98 	uint16_t	blf_trill_nick;
99 	uint_t		blf_ms_age;
100 	boolean_t	blf_is_local;
101 	datalink_id_t	blf_linkid;
102 } bridge_listfwd_t;
103 
104 /* Upward control messages */
105 typedef struct bridge_ctl_s {
106 	datalink_id_t	bc_linkid;
107 	boolean_t	bc_failed;	/* Max SDU mismatch */
108 } bridge_ctl_t;
109 
110 /* GLDv3 control ioctls used by Bridging */
111 #define	BRIDGE_IOC_LISTFWD	BRIDGEIOC(1)
112 
113 #ifdef __cplusplus
114 }
115 #endif
116 
117 #endif /* _NET_BRIDGE_H */
118