Print this page
OS-406
OS-249
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/sys/dld.h
+++ new/usr/src/uts/common/sys/dld.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
13 13 * When distributing Covered Code, include this CDDL HEADER in each
|
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21 /*
22 22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 23 * Use is subject to license terms.
24 + * Copyright 2011 Joyent, Inc. All rights reserved.
24 25 */
25 26
26 27 #ifndef _SYS_DLD_H
27 28 #define _SYS_DLD_H
28 29
29 30 /*
30 31 * Data-Link Driver ioctl interfaces.
31 32 *
32 33 * Note that the datastructures defined here define an ioctl interface
33 34 * that is shared betwen user and kernel space. The dld driver thus
34 35 * assumes that the structures have identical layout and size when
35 36 * compiled in either IPL32 or LP64.
36 37 */
37 38
38 39 #include <sys/types.h>
39 40 #include <sys/stream.h>
40 41 #include <sys/mac_flow.h>
41 42 #include <sys/conf.h>
42 43 #include <sys/sad.h>
43 44 #include <sys/mac.h>
44 45
45 46 #ifdef __cplusplus
46 47 extern "C" {
47 48 #endif
48 49
49 50 /*
50 51 * Data-Link Driver Information (text emitted by modinfo(1m))
51 52 */
52 53 #define DLD_INFO "Data-Link Driver"
53 54
54 55 /*
55 56 * Options: To enable an option set the property name to a non-zero value
56 57 * in kernel/drv/dld.conf.
57 58 */
58 59
59 60 /*
60 61 * Prevent use of the IP fast-path (direct M_DATA transmit).
61 62 */
62 63 #define DLD_PROP_NO_FASTPATH "no-fastpath"
63 64
64 65 /*
65 66 * Prevent advertising of the DL_CAPAB_POLL capability.
66 67 */
67 68 #define DLD_PROP_NO_POLL "no-poll"
68 69
69 70 /*
70 71 * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
71 72 */
72 73 #define DLD_PROP_NO_ZEROCOPY "no-zerocopy"
73 74
74 75 /*
75 76 * Prevent advertising of the DL_CAPAB_SOFTRING capability.
76 77 */
77 78 #define DLD_PROP_NO_SOFTRING "no-softring"
78 79
79 80 /*
80 81 * The name of the driver.
81 82 */
82 83 #define DLD_DRIVER_NAME "dld"
83 84
84 85 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
85 86 #pragma pack(4)
86 87 #endif
87 88
88 89 /*
89 90 * IOCTL codes and data structures.
90 91 */
91 92 #define DLDIOC_ATTR DLDIOC(0x03)
92 93
93 94 typedef struct dld_ioc_attr {
94 95 datalink_id_t dia_linkid;
95 96 uint_t dia_max_sdu;
96 97 } dld_ioc_attr_t;
97 98
98 99 #define DLDIOC_VLAN_ATTR DLDIOC(0x04)
99 100 typedef struct dld_ioc_vlan_attr {
100 101 datalink_id_t div_vlanid;
101 102 uint16_t div_vid;
102 103 datalink_id_t div_linkid;
103 104 boolean_t div_force;
104 105 } dld_ioc_vlan_attr_t;
105 106
106 107 #define DLDIOC_PHYS_ATTR DLDIOC(0x05)
107 108 #define DLPI_LINKNAME_MAX 32
108 109
109 110 typedef struct dld_ioc_phys_attr {
110 111 datalink_id_t dip_linkid;
111 112 /*
112 113 * Whether this physical link supports vanity naming. Note that
113 114 * physical links whose media type is not supported by GLDv3
114 115 * can not support vanity naming.
115 116 */
116 117 boolean_t dip_novanity;
117 118 char dip_dev[MAXLINKNAMELEN];
118 119 } dld_ioc_phys_attr_t;
119 120
120 121 /*
121 122 * Secure objects ioctls
122 123 */
123 124 typedef enum {
124 125 DLD_SECOBJ_CLASS_WEP = 1,
125 126 DLD_SECOBJ_CLASS_WPA
126 127 } dld_secobj_class_t;
127 128
128 129 #define DLD_SECOBJ_OPT_CREATE 0x00000001
129 130 #define DLD_SECOBJ_NAME_MAX 32
130 131 #define DLD_SECOBJ_VAL_MAX 256
131 132 typedef struct dld_secobj {
132 133 char so_name[DLD_SECOBJ_NAME_MAX];
133 134 dld_secobj_class_t so_class;
134 135 uint8_t so_val[DLD_SECOBJ_VAL_MAX];
135 136 uint_t so_len;
136 137 } dld_secobj_t;
137 138
138 139 #define DLDIOC_SECOBJ_SET DLDIOC(0x06)
139 140 typedef struct dld_ioc_secobj_set {
140 141 dld_secobj_t ss_obj;
141 142 uint_t ss_flags;
142 143 } dld_ioc_secobj_set_t;
143 144
144 145 #define DLDIOC_SECOBJ_GET DLDIOC(0x07)
145 146 typedef struct dld_ioc_secobj_get {
146 147 dld_secobj_t sg_obj;
147 148 uint_t sg_count;
148 149 uint_t sg_size;
149 150 } dld_ioc_secobj_get_t;
150 151
151 152 /*
152 153 * The following two slots were used outside of ON, so don't reuse them.
153 154 *
154 155 * #define DLDIOCHOLDVLAN DLDIOC(0x08)
155 156 * #define DLDIOCRELEVLAN DLDIOC(0x09)
156 157 */
157 158
158 159 #define DLDIOC_SECOBJ_UNSET DLDIOC(0x0a)
159 160 typedef struct dld_ioc_secobj_unset {
160 161 char su_name[DLD_SECOBJ_NAME_MAX];
161 162 } dld_ioc_secobj_unset_t;
162 163
163 164 #define DLDIOC_CREATE_VLAN DLDIOC(0x0b)
164 165 typedef struct dld_ioc_create_vlan {
165 166 datalink_id_t dic_vlanid;
166 167 datalink_id_t dic_linkid;
167 168 uint16_t dic_vid;
168 169 boolean_t dic_force;
169 170 } dld_ioc_create_vlan_t;
170 171
171 172 #define DLDIOC_DELETE_VLAN DLDIOC(0x0c)
172 173 typedef struct dld_ioc_delete_vlan {
173 174 datalink_id_t did_linkid;
174 175 } dld_ioc_delete_vlan_t;
175 176
176 177 /*
177 178 * The following constants have been removed, and the slots are open:
178 179 *
179 180 * #define DLDIOC_SETAUTOPUSH DLDIOC(0x0d)
180 181 * #define DLDIOC_GETAUTOPUSH DLDIOC(0x0e)
181 182 * #define DLDIOC_CLRAUTOPUSH DLDIOC(0x0f)
182 183 */
183 184
|
↓ open down ↓ |
150 lines elided |
↑ open up ↑ |
184 185 #define DLDIOC_DOORSERVER DLDIOC(0x10)
185 186 typedef struct dld_ioc_door {
186 187 boolean_t did_start_door;
187 188 } dld_ioc_door_t;
188 189
189 190 #define DLDIOC_RENAME DLDIOC(0x11)
190 191 typedef struct dld_ioc_rename {
191 192 datalink_id_t dir_linkid1;
192 193 datalink_id_t dir_linkid2;
193 194 char dir_link[MAXLINKNAMELEN];
195 + boolean_t dir_zoneinit;
194 196 } dld_ioc_rename_t;
195 197
196 198 /*
197 199 * The following constants have been removed, and the slots are open:
198 200 *
199 201 * #define DLDIOC_SETZID DLDIOC(0x12)
200 202 * #define DLDIOC_GETZID DLDIOC(0x13)
201 203 */
202 204
203 205 typedef struct dld_ioc_zid {
204 206 zoneid_t diz_zid;
205 207 datalink_id_t diz_linkid;
208 + boolean_t diz_transient;
206 209 } dld_ioc_zid_t;
207 210
208 211 /*
209 212 * data-link autopush configuration.
210 213 */
211 214 struct dlautopush {
212 215 uint_t dap_anchor;
213 216 uint_t dap_npush;
214 217 char dap_aplist[MAXAPUSH][FMNAMESZ+1];
215 218 };
216 219
217 220 #define DLDIOC_MACADDRGET DLDIOC(0x15)
218 221 typedef struct dld_ioc_macaddrget {
219 222 datalink_id_t dig_linkid;
220 223 uint_t dig_count;
221 224 uint_t dig_size;
222 225 } dld_ioc_macaddrget_t;
223 226
224 227 /* possible flags for dmi_flags below */
225 228 #define DLDIOCMACADDR_USED 0x1 /* address slot used */
226 229
227 230 typedef struct dld_macaddrinfo {
228 231 uint_t dmi_slot;
229 232 uint_t dmi_flags;
230 233 uint_t dmi_addrlen;
231 234 uchar_t dmi_addr[MAXMACADDRLEN];
232 235 char dmi_client_name[MAXNAMELEN];
233 236 datalink_id_t dma_client_linkid;
234 237 } dld_macaddrinfo_t;
235 238
236 239 /*
237 240 * IOCTL codes and data structures for flowadm.
238 241 */
239 242 #define DLDIOC_ADDFLOW DLDIOC(0x16)
240 243 typedef struct dld_ioc_addflow {
241 244 datalink_id_t af_linkid;
242 245 flow_desc_t af_flow_desc;
243 246 mac_resource_props_t af_resource_props;
244 247 char af_name[MAXFLOWNAMELEN];
245 248 } dld_ioc_addflow_t;
246 249
247 250 #define DLDIOC_REMOVEFLOW DLDIOC(0x17)
248 251 typedef struct dld_ioc_removeflow {
249 252 char rf_name[MAXFLOWNAMELEN];
250 253 } dld_ioc_removeflow_t;
251 254
252 255 #define DLDIOC_MODIFYFLOW DLDIOC(0x18)
253 256 typedef struct dld_ioc_modifyflow {
254 257 char mf_name[MAXFLOWNAMELEN];
255 258 mac_resource_props_t mf_resource_props;
256 259 } dld_ioc_modifyflow_t;
257 260
258 261 #define DLDIOC_WALKFLOW DLDIOC(0x19)
259 262 typedef struct dld_ioc_walkflow {
260 263 datalink_id_t wf_linkid;
261 264 char wf_name[MAXFLOWNAMELEN];
262 265 uint32_t wf_nflows;
263 266 uint_t wf_len;
264 267 } dld_ioc_walkflow_t;
265 268
266 269 typedef struct dld_flowinfo {
267 270 datalink_id_t fi_linkid;
268 271 flow_desc_t fi_flow_desc;
269 272 mac_resource_props_t fi_resource_props;
270 273 char fi_flowname[MAXFLOWNAMELEN];
271 274 uint32_t fi_pad;
272 275 } dld_flowinfo_t;
273 276
274 277 #define DLDIOC_USAGELOG DLDIOC(0x1a)
275 278 typedef struct dld_ioc_usagelog {
276 279 mac_logtype_t ul_type;
277 280 boolean_t ul_onoff;
278 281 uint_t ul_interval;
279 282 } dld_ioc_usagelog_t;
280 283
281 284 #define DLDIOC_SETMACPROP DLDIOC(0x1b)
282 285 #define DLDIOC_GETMACPROP DLDIOC(0x1c)
283 286
284 287 /* pr_flags can be set to a combination of the following flags */
285 288 #define DLD_PROP_DEFAULT 0x0001
286 289 #define DLD_PROP_POSSIBLE 0x0002
287 290
288 291 typedef struct dld_ioc_macprop_s {
289 292 uint_t pr_flags;
290 293 datalink_id_t pr_linkid;
291 294 mac_prop_id_t pr_num;
292 295 uint_t pr_perm_flags;
293 296 char pr_name[MAXLINKPROPNAME];
294 297 uint_t pr_valsize; /* sizeof pr_val */
295 298 char pr_val[1];
296 299 } dld_ioc_macprop_t;
297 300
298 301 #define DLDIOC_GETHWGRP DLDIOC(0x1d)
299 302
300 303 typedef struct dld_ioc_hwgrpget {
301 304 datalink_id_t dih_linkid;
302 305 uint_t dih_n_groups; /* number of groups included in ioc */
303 306 uint_t dih_size;
304 307 } dld_ioc_hwgrpget_t;
305 308
306 309 #define MAXCLIENTNAMELEN 1024
307 310 typedef struct dld_hwgrpinfo {
308 311 char dhi_link_name[MAXLINKNAMELEN];
309 312 uint_t dhi_grp_num;
310 313 uint_t dhi_grp_type;
311 314 uint_t dhi_n_rings;
312 315 uint_t dhi_n_clnts;
313 316 uint_t dhi_rings[MAX_RINGS_PER_GROUP];
314 317 char dhi_clnts[MAXCLIENTNAMELEN];
315 318 } dld_hwgrpinfo_t;
316 319
317 320 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
318 321 #pragma pack()
319 322 #endif
320 323
321 324 #ifdef _KERNEL
322 325
323 326 #define DLD_CAPAB_DIRECT 0x00000001
324 327 #define DLD_CAPAB_POLL 0x00000002
325 328 #define DLD_CAPAB_PERIM 0x00000003
326 329 #define DLD_CAPAB_LSO 0x00000004
327 330
328 331 #define DLD_ENABLE 0x00000001
329 332 #define DLD_DISABLE 0x00000002
330 333 #define DLD_QUERY 0x00000003
331 334
332 335 /*
333 336 * GLDv3 entry point for negotiating capabilities.
334 337 * This is exposed to IP after negotiation of DL_CAPAB_DLD.
335 338 *
336 339 * This function takes the following arguments:
337 340 * handle: used for identifying the interface to operate on (provided by dld).
338 341 * type: capability type.
339 342 * arg: points to a capability-specific structure.
340 343 * flags: used for indicating whether to enable or disable a capability.
341 344 *
342 345 * With this function, capability negotiation is reduced from a multi-step
343 346 * process to just one single function call.
344 347 * e.g. the following code would pass 'x' from IP to dld and obtain
345 348 * arg.output_arg from dld:
346 349 *
347 350 * arg.input_arg = x;
348 351 * rc = (*dld_capab)(handle, DLD_CAPAB_XXX, &arg, DLD_ENABLE);
349 352 * ill->info1 = arg.output_arg;
350 353 */
351 354 typedef int (*dld_capab_func_t)(void *, uint_t, void *, uint_t);
352 355
353 356 /*
354 357 * Direct Tx/Rx capability.
355 358 */
356 359 typedef struct dld_capab_direct_s {
357 360 /*
358 361 * Rx entry point and handle, owned by IP.
359 362 */
360 363 uintptr_t di_rx_cf;
361 364 void *di_rx_ch;
362 365
363 366 /*
364 367 * Tx entry points and handle, owned by DLD.
365 368 */
366 369 /* Entry point for transmitting packets */
367 370 uintptr_t di_tx_df;
368 371 void *di_tx_dh;
369 372
370 373 /* flow control notification callback */
371 374 uintptr_t di_tx_cb_df; /* callback registration/de-registration */
372 375 void *di_tx_cb_dh;
373 376
374 377 /* flow control "can I put on a ring" callback */
375 378 uintptr_t di_tx_fctl_df; /* canput-like callback */
376 379 void *di_tx_fctl_dh;
377 380 } dld_capab_direct_t;
378 381
379 382 /*
380 383 * Polling/softring capability.
381 384 */
382 385 #define POLL_SOFTRING 0x00000001
383 386 typedef struct dld_capab_poll_s {
384 387 uintptr_t poll_ring_add_cf;
385 388 uintptr_t poll_ring_remove_cf;
386 389 uintptr_t poll_ring_quiesce_cf;
387 390 uintptr_t poll_ring_restart_cf;
388 391 uintptr_t poll_ring_bind_cf;
389 392 void *poll_ring_ch;
390 393 uintptr_t poll_mac_accept_df;
391 394 void *poll_mac_dh;
392 395 } dld_capab_poll_t;
393 396
394 397 /*
395 398 * LSO capability
396 399 */
397 400 /*
398 401 * Currently supported flags for LSO.
399 402 */
400 403 #define DLD_LSO_BASIC_TCP_IPV4 0x01 /* TCP LSO over IPv4 capability */
401 404 #define DLD_LSO_BASIC_TCP_IPV6 0x02 /* TCP LSO over IPv6 capability */
402 405
403 406 typedef struct dld_capab_lso_s {
404 407 uint_t lso_flags; /* capability flags */
405 408 uint_t lso_max; /* maximum payload */
406 409 } dld_capab_lso_t;
407 410
408 411 int dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
409 412 int dld_devt_to_instance(dev_t);
410 413 int dld_open(queue_t *, dev_t *, int, int, cred_t *);
411 414 int dld_close(queue_t *);
412 415 void dld_wput(queue_t *, mblk_t *);
413 416 void dld_wsrv(queue_t *);
414 417 int dld_str_open(queue_t *, dev_t *, void *);
415 418 int dld_str_close(queue_t *);
416 419 void *dld_str_private(queue_t *);
417 420 void dld_init_ops(struct dev_ops *, const char *);
418 421 void dld_fini_ops(struct dev_ops *);
419 422 int dld_autopush(dev_t *, struct dlautopush *);
420 423
421 424 int dld_add_flow(datalink_id_t, char *, flow_desc_t *,
422 425 mac_resource_props_t *);
423 426 int dld_remove_flow(char *);
424 427 int dld_modify_flow(char *, mac_resource_props_t *);
425 428 int dld_walk_flow(dld_ioc_walkflow_t *, intptr_t, cred_t *);
426 429
427 430 #endif
428 431
429 432 #ifdef __cplusplus
430 433 }
431 434 #endif
432 435
433 436 #endif /* _SYS_DLD_H */
|
↓ open down ↓ |
218 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX