xref: /titanic_50/usr/src/uts/common/sys/dld.h (revision 2f79bea12c9814c8829dad82312f3c944423bcce)
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  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_SYS_DLD_H
27 #define	_SYS_DLD_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * Data-Link Driver (public header).
33  */
34 
35 #include <sys/types.h>
36 #include <sys/stream.h>
37 #include <sys/mac.h>
38 #include <sys/dls.h>
39 #include <sys/conf.h>
40 #include <sys/sad.h>
41 #include <net/if.h>
42 
43 #ifdef	__cplusplus
44 extern "C" {
45 #endif
46 
47 /*
48  * Data-Link Driver Information (text emitted by modinfo(1m))
49  */
50 #define	DLD_INFO	"Data-Link Driver v%I%"
51 
52 /*
53  * Options: To enable an option set the property name to a non-zero value
54  *	    in kernel/drv/dld.conf.
55  */
56 
57 /*
58  * Prevent use of the IP fast-path (direct M_DATA transmit).
59  */
60 #define	DLD_PROP_NO_FASTPATH	"no-fastpath"
61 
62 /*
63  * Prevent advertising of the DL_CAPAB_POLL capability.
64  */
65 #define	DLD_PROP_NO_POLL	"no-poll"
66 
67 /*
68  * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
69  */
70 #define	DLD_PROP_NO_ZEROCOPY	"no-zerocopy"
71 
72 /*
73  * Prevent advertising of the DL_CAPAB_SOFTRING capability.
74  */
75 #define	DLD_PROP_NO_SOFTRING	"no-softring"
76 
77 /*
78  * The name of the driver.
79  */
80 #define	DLD_DRIVER_NAME		"dld"
81 
82 /*
83  * The name of the control minor node of dld.
84  */
85 #define	DLD_CONTROL_MINOR_NAME	"ctl"
86 #define	DLD_CONTROL_MINOR	0
87 #define	DLD_CONTROL_DEV		"/devices/pseudo/" DLD_DRIVER_NAME "@0:" \
88 				DLD_CONTROL_MINOR_NAME
89 
90 /*
91  * IOCTL codes and data structures.
92  */
93 #define	DLDIOC		('D' << 24 | 'L' << 16 | 'D' << 8)
94 
95 #define	DLDIOC_ATTR	(DLDIOC | 0x03)
96 
97 typedef struct dld_ioc_attr {
98 	datalink_id_t	dia_linkid;
99 	uint_t		dia_max_sdu;
100 } dld_ioc_attr_t;
101 
102 #define	DLDIOC_VLAN_ATTR	(DLDIOC | 0x04)
103 typedef struct dld_ioc_vlan_attr {
104 	datalink_id_t	div_vlanid;
105 	uint16_t	div_vid;
106 	datalink_id_t	div_linkid;
107 	boolean_t	div_force;
108 	boolean_t	div_implicit;
109 } dld_ioc_vlan_attr_t;
110 
111 #define	DLDIOC_PHYS_ATTR	(DLDIOC | 0x05)
112 typedef struct dld_ioc_phys_attr {
113 	datalink_id_t	dip_linkid;
114 	/*
115 	 * Whether this physical link supports vanity naming. Note that
116 	 * physical links whose media type is not supported by GLDv3
117 	 * can not support vanity naming.
118 	 */
119 	boolean_t	dip_novanity;
120 	char		dip_dev[MAXLINKNAMELEN];
121 } dld_ioc_phys_attr_t;
122 
123 /*
124  * Secure objects ioctls
125  */
126 typedef enum {
127 	DLD_SECOBJ_CLASS_WEP = 1,
128 	DLD_SECOBJ_CLASS_WPA
129 } dld_secobj_class_t;
130 
131 #define	DLD_SECOBJ_OPT_CREATE	0x00000001
132 #define	DLD_SECOBJ_NAME_MAX	32
133 #define	DLD_SECOBJ_VAL_MAX	256
134 typedef struct dld_secobj {
135 	char			so_name[DLD_SECOBJ_NAME_MAX];
136 	dld_secobj_class_t	so_class;
137 	uint8_t			so_val[DLD_SECOBJ_VAL_MAX];
138 	uint_t			so_len;
139 } dld_secobj_t;
140 
141 #define	DLDIOC_SECOBJ_SET	(DLDIOC | 0x06)
142 typedef struct dld_ioc_secobj_set {
143 	dld_secobj_t		ss_obj;
144 	uint_t			ss_flags;
145 } dld_ioc_secobj_set_t;
146 
147 #define	DLDIOC_SECOBJ_GET	(DLDIOC | 0x07)
148 typedef struct dld_ioc_secobj_get {
149 	dld_secobj_t		sg_obj;
150 	uint_t			sg_count;
151 } dld_ioc_secobj_get_t;
152 
153 /*
154  * The following two slots were used outside of ON, so don't reuse them.
155  *
156  * #define DLDIOCHOLDVLAN (DLDIOC | 0x08)
157  * #define DLDIOCRELEVLAN (DLDIOC | 0x09)
158  */
159 
160 #define	DLDIOC_SECOBJ_UNSET	(DLDIOC | 0x0a)
161 typedef struct dld_ioc_secobj_unset {
162 	char			su_name[DLD_SECOBJ_NAME_MAX];
163 } dld_ioc_secobj_unset_t;
164 
165 #define	DLDIOC_CREATE_VLAN	(DLDIOC | 0x0b)
166 typedef struct dld_ioc_create_vlan {
167 	datalink_id_t	dic_vlanid;
168 	datalink_id_t	dic_linkid;
169 	uint16_t	dic_vid;
170 	boolean_t	dic_force;
171 } dld_ioc_create_vlan_t;
172 
173 #define	DLDIOC_DELETE_VLAN	(DLDIOC | 0x0c)
174 typedef struct dld_ioc_delete_vlan {
175 	datalink_id_t	did_linkid;
176 } dld_ioc_delete_vlan_t;
177 
178 #define	DLDIOC_SETAUTOPUSH	(DLDIOC | 0x0d)
179 #define	DLDIOC_GETAUTOPUSH	(DLDIOC | 0x0e)
180 #define	DLDIOC_CLRAUTOPUSH	(DLDIOC | 0x0f)
181 typedef struct dld_ioc_ap {
182 	datalink_id_t	dia_linkid;
183 	uint_t  	dia_anchor;
184 	uint_t		dia_npush;
185 	char		dia_aplist[MAXAPUSH][FMNAMESZ+1];
186 } dld_ioc_ap_t;
187 
188 #define	DLDIOC_DOORSERVER	(DLDIOC | 0x10)
189 typedef struct dld_ioc_door {
190 	boolean_t	did_start_door;
191 } dld_ioc_door_t;
192 
193 #define	DLDIOC_RENAME		(DLDIOC | 0x11)
194 typedef struct dld_ioc_rename {
195 	datalink_id_t	dir_linkid1;
196 	datalink_id_t	dir_linkid2;
197 	char		dir_link[MAXLINKNAMELEN];
198 } dld_ioc_rename_t;
199 
200 /*
201  * DLDIOC_SETZID sets the zoneid of a given link. It could cause a VLAN to be
202  * implicitly created.  Note that we will hold a reference for the given link
203  * whenever it has a zoneid other than the global zone.
204  */
205 #define	DLDIOC_SETZID		(DLDIOC | 0x12)
206 typedef struct dld_ioc_setzid {
207 	char		dis_link[MAXLINKNAMELEN];
208 	zoneid_t	dis_zid;
209 } dld_ioc_setzid_t;
210 
211 #define	DLDIOC_GETZID  		(DLDIOC | 0x13)
212 typedef struct dld_ioc_getzid {
213 	datalink_id_t	dig_linkid;
214 	zoneid_t	dig_zid;
215 } dld_ioc_getzid_t;
216 
217 /*
218  * data-link autopush configuration.
219  */
220 struct dlautopush {
221 	uint_t	dap_anchor;
222 	uint_t	dap_npush;
223 	char	dap_aplist[MAXAPUSH][FMNAMESZ+1];
224 };
225 
226 #ifdef _KERNEL
227 int	dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
228 int	dld_open(queue_t *, dev_t *, int, int, cred_t *);
229 int	dld_close(queue_t *);
230 void	dld_wput(queue_t *, mblk_t *);
231 void	dld_wsrv(queue_t *);
232 void	dld_init_ops(struct dev_ops *, const char *);
233 void	dld_fini_ops(struct dev_ops *);
234 int	dld_autopush(dev_t *, struct dlautopush *);
235 #endif
236 
237 #ifdef	__cplusplus
238 }
239 #endif
240 
241 #endif	/* _SYS_DLD_H */
242