8442 uts: startup_bios_disk() should check for BIOS
[unleashed.git] / include / sys / dld.h
blobfb2a0749d344995fec128ac42ef3d4cc2ea50deb
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _SYS_DLD_H
27 #define _SYS_DLD_H
30 * Data-Link Driver ioctl interfaces.
32 * Note that the datastructures defined here define an ioctl interface
33 * that is shared betwen user and kernel space. The dld driver thus
34 * assumes that the structures have identical layout and size when
35 * compiled in either IPL32 or LP64.
38 #include <sys/types.h>
39 #include <sys/stream.h>
40 #include <sys/mac_flow.h>
41 #include <sys/conf.h>
42 #include <sys/sad.h>
43 #include <sys/mac.h>
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
50 * Data-Link Driver Information (text emitted by modinfo(1m))
52 #define DLD_INFO "Data-Link Driver"
55 * Options: To enable an option set the property name to a non-zero value
56 * in kernel/drv/dld.conf.
60 * Prevent use of the IP fast-path (direct M_DATA transmit).
62 #define DLD_PROP_NO_FASTPATH "no-fastpath"
65 * Prevent advertising of the DL_CAPAB_POLL capability.
67 #define DLD_PROP_NO_POLL "no-poll"
70 * Prevent advertising of the DL_CAPAB_ZEROCOPY capability.
72 #define DLD_PROP_NO_ZEROCOPY "no-zerocopy"
75 * Prevent advertising of the DL_CAPAB_SOFTRING capability.
77 #define DLD_PROP_NO_SOFTRING "no-softring"
80 * The name of the driver.
82 #define DLD_DRIVER_NAME "dld"
84 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
85 #pragma pack(4)
86 #endif
89 * IOCTL codes and data structures.
91 #define DLDIOC_ATTR DLDIOC(0x03)
93 typedef struct dld_ioc_attr {
94 datalink_id_t dia_linkid;
95 uint_t dia_max_sdu;
96 } dld_ioc_attr_t;
98 #define DLDIOC_VLAN_ATTR DLDIOC(0x04)
99 typedef struct dld_ioc_vlan_attr {
100 datalink_id_t div_vlanid;
101 uint16_t div_vid;
102 datalink_id_t div_linkid;
103 boolean_t div_force;
104 } dld_ioc_vlan_attr_t;
106 #define DLDIOC_PHYS_ATTR DLDIOC(0x05)
107 #define DLPI_LINKNAME_MAX 32
109 typedef struct dld_ioc_phys_attr {
110 datalink_id_t dip_linkid;
112 * Whether this physical link supports vanity naming. Note that
113 * physical links whose media type is not supported by GLDv3
114 * can not support vanity naming.
116 boolean_t dip_novanity;
117 char dip_dev[MAXLINKNAMELEN];
118 } dld_ioc_phys_attr_t;
121 * Secure objects ioctls
123 typedef enum {
124 DLD_SECOBJ_CLASS_WEP = 1,
125 DLD_SECOBJ_CLASS_WPA
126 } dld_secobj_class_t;
128 #define DLD_SECOBJ_OPT_CREATE 0x00000001
129 #define DLD_SECOBJ_NAME_MAX 32
130 #define DLD_SECOBJ_VAL_MAX 256
131 typedef struct dld_secobj {
132 char so_name[DLD_SECOBJ_NAME_MAX];
133 dld_secobj_class_t so_class;
134 uint8_t so_val[DLD_SECOBJ_VAL_MAX];
135 uint_t so_len;
136 } dld_secobj_t;
138 #define DLDIOC_SECOBJ_SET DLDIOC(0x06)
139 typedef struct dld_ioc_secobj_set {
140 dld_secobj_t ss_obj;
141 uint_t ss_flags;
142 } dld_ioc_secobj_set_t;
144 #define DLDIOC_SECOBJ_GET DLDIOC(0x07)
145 typedef struct dld_ioc_secobj_get {
146 dld_secobj_t sg_obj;
147 uint_t sg_count;
148 uint_t sg_size;
149 } dld_ioc_secobj_get_t;
152 * The following two slots were used outside of ON, so don't reuse them.
154 * #define DLDIOCHOLDVLAN DLDIOC(0x08)
155 * #define DLDIOCRELEVLAN DLDIOC(0x09)
158 #define DLDIOC_SECOBJ_UNSET DLDIOC(0x0a)
159 typedef struct dld_ioc_secobj_unset {
160 char su_name[DLD_SECOBJ_NAME_MAX];
161 } dld_ioc_secobj_unset_t;
163 #define DLDIOC_CREATE_VLAN DLDIOC(0x0b)
164 typedef struct dld_ioc_create_vlan {
165 datalink_id_t dic_vlanid;
166 datalink_id_t dic_linkid;
167 uint16_t dic_vid;
168 boolean_t dic_force;
169 } dld_ioc_create_vlan_t;
171 #define DLDIOC_DELETE_VLAN DLDIOC(0x0c)
172 typedef struct dld_ioc_delete_vlan {
173 datalink_id_t did_linkid;
174 } dld_ioc_delete_vlan_t;
177 * The following constants have been removed, and the slots are open:
179 * #define DLDIOC_SETAUTOPUSH DLDIOC(0x0d)
180 * #define DLDIOC_GETAUTOPUSH DLDIOC(0x0e)
181 * #define DLDIOC_CLRAUTOPUSH DLDIOC(0x0f)
184 #define DLDIOC_DOORSERVER DLDIOC(0x10)
185 typedef struct dld_ioc_door {
186 boolean_t did_start_door;
187 } dld_ioc_door_t;
189 #define DLDIOC_RENAME DLDIOC(0x11)
190 typedef struct dld_ioc_rename {
191 datalink_id_t dir_linkid1;
192 datalink_id_t dir_linkid2;
193 char dir_link[MAXLINKNAMELEN];
194 } dld_ioc_rename_t;
197 * The following constants have been removed, and the slots are open:
199 * #define DLDIOC_SETZID DLDIOC(0x12)
200 * #define DLDIOC_GETZID DLDIOC(0x13)
203 typedef struct dld_ioc_zid {
204 zoneid_t diz_zid;
205 datalink_id_t diz_linkid;
206 } dld_ioc_zid_t;
209 * data-link autopush configuration.
211 struct dlautopush {
212 uint_t dap_anchor;
213 uint_t dap_npush;
214 char dap_aplist[MAXAPUSH][FMNAMESZ+1];
217 #define DLDIOC_MACADDRGET DLDIOC(0x15)
218 typedef struct dld_ioc_macaddrget {
219 datalink_id_t dig_linkid;
220 uint_t dig_count;
221 uint_t dig_size;
222 } dld_ioc_macaddrget_t;
224 /* possible flags for dmi_flags below */
225 #define DLDIOCMACADDR_USED 0x1 /* address slot used */
227 typedef struct dld_macaddrinfo {
228 uint_t dmi_slot;
229 uint_t dmi_flags;
230 uint_t dmi_addrlen;
231 uchar_t dmi_addr[MAXMACADDRLEN];
232 char dmi_client_name[MAXNAMELEN];
233 datalink_id_t dma_client_linkid;
234 } dld_macaddrinfo_t;
237 * IOCTL codes and data structures for flowadm.
239 #define DLDIOC_ADDFLOW DLDIOC(0x16)
240 typedef struct dld_ioc_addflow {
241 datalink_id_t af_linkid;
242 flow_desc_t af_flow_desc;
243 mac_resource_props_t af_resource_props;
244 char af_name[MAXFLOWNAMELEN];
245 } dld_ioc_addflow_t;
247 #define DLDIOC_REMOVEFLOW DLDIOC(0x17)
248 typedef struct dld_ioc_removeflow {
249 char rf_name[MAXFLOWNAMELEN];
250 } dld_ioc_removeflow_t;
252 #define DLDIOC_MODIFYFLOW DLDIOC(0x18)
253 typedef struct dld_ioc_modifyflow {
254 char mf_name[MAXFLOWNAMELEN];
255 mac_resource_props_t mf_resource_props;
256 } dld_ioc_modifyflow_t;
258 #define DLDIOC_WALKFLOW DLDIOC(0x19)
259 typedef struct dld_ioc_walkflow {
260 datalink_id_t wf_linkid;
261 char wf_name[MAXFLOWNAMELEN];
262 uint32_t wf_nflows;
263 uint_t wf_len;
264 } dld_ioc_walkflow_t;
266 typedef struct dld_flowinfo {
267 datalink_id_t fi_linkid;
268 flow_desc_t fi_flow_desc;
269 mac_resource_props_t fi_resource_props;
270 char fi_flowname[MAXFLOWNAMELEN];
271 uint32_t fi_pad;
272 } dld_flowinfo_t;
274 #define DLDIOC_USAGELOG DLDIOC(0x1a)
275 typedef struct dld_ioc_usagelog {
276 mac_logtype_t ul_type;
277 boolean_t ul_onoff;
278 uint_t ul_interval;
279 } dld_ioc_usagelog_t;
281 #define DLDIOC_SETMACPROP DLDIOC(0x1b)
282 #define DLDIOC_GETMACPROP DLDIOC(0x1c)
284 /* pr_flags can be set to a combination of the following flags */
285 #define DLD_PROP_DEFAULT 0x0001
286 #define DLD_PROP_POSSIBLE 0x0002
288 typedef struct dld_ioc_macprop_s {
289 uint_t pr_flags;
290 datalink_id_t pr_linkid;
291 mac_prop_id_t pr_num;
292 uint_t pr_perm_flags;
293 char pr_name[MAXLINKPROPNAME];
294 uint_t pr_valsize; /* sizeof pr_val */
295 char pr_val[1];
296 } dld_ioc_macprop_t;
298 #define DLDIOC_GETHWGRP DLDIOC(0x1d)
300 typedef struct dld_ioc_hwgrpget {
301 datalink_id_t dih_linkid;
302 uint_t dih_n_groups; /* number of groups included in ioc */
303 uint_t dih_size;
304 } dld_ioc_hwgrpget_t;
306 #define MAXCLIENTNAMELEN 1024
307 typedef struct dld_hwgrpinfo {
308 char dhi_link_name[MAXLINKNAMELEN];
309 uint_t dhi_grp_num;
310 uint_t dhi_grp_type;
311 uint_t dhi_n_rings;
312 uint_t dhi_n_clnts;
313 uint_t dhi_rings[MAX_RINGS_PER_GROUP];
314 char dhi_clnts[MAXCLIENTNAMELEN];
315 } dld_hwgrpinfo_t;
317 #if _LONG_LONG_ALIGNMENT == 8 && _LONG_LONG_ALIGNMENT_32 == 4
318 #pragma pack()
319 #endif
321 #ifdef _KERNEL
323 #define DLD_CAPAB_DIRECT 0x00000001
324 #define DLD_CAPAB_POLL 0x00000002
325 #define DLD_CAPAB_PERIM 0x00000003
326 #define DLD_CAPAB_LSO 0x00000004
328 #define DLD_ENABLE 0x00000001
329 #define DLD_DISABLE 0x00000002
330 #define DLD_QUERY 0x00000003
333 * GLDv3 entry point for negotiating capabilities.
334 * This is exposed to IP after negotiation of DL_CAPAB_DLD.
336 * This function takes the following arguments:
337 * handle: used for identifying the interface to operate on (provided by dld).
338 * type: capability type.
339 * arg: points to a capability-specific structure.
340 * flags: used for indicating whether to enable or disable a capability.
342 * With this function, capability negotiation is reduced from a multi-step
343 * process to just one single function call.
344 * e.g. the following code would pass 'x' from IP to dld and obtain
345 * arg.output_arg from dld:
347 * arg.input_arg = x;
348 * rc = (*dld_capab)(handle, DLD_CAPAB_XXX, &arg, DLD_ENABLE);
349 * ill->info1 = arg.output_arg;
351 typedef int (*dld_capab_func_t)(void *, uint_t, void *, uint_t);
354 * Direct Tx/Rx capability.
356 typedef struct dld_capab_direct_s {
358 * Rx entry point and handle, owned by IP.
360 uintptr_t di_rx_cf;
361 void *di_rx_ch;
364 * Tx entry points and handle, owned by DLD.
366 /* Entry point for transmitting packets */
367 uintptr_t di_tx_df;
368 void *di_tx_dh;
370 /* flow control notification callback */
371 uintptr_t di_tx_cb_df; /* callback registration/de-registration */
372 void *di_tx_cb_dh;
374 /* flow control "can I put on a ring" callback */
375 uintptr_t di_tx_fctl_df; /* canput-like callback */
376 void *di_tx_fctl_dh;
377 } dld_capab_direct_t;
380 * Polling/softring capability.
382 #define POLL_SOFTRING 0x00000001
383 typedef struct dld_capab_poll_s {
384 uintptr_t poll_ring_add_cf;
385 uintptr_t poll_ring_remove_cf;
386 uintptr_t poll_ring_quiesce_cf;
387 uintptr_t poll_ring_restart_cf;
388 uintptr_t poll_ring_bind_cf;
389 void *poll_ring_ch;
390 uintptr_t poll_mac_accept_df;
391 void *poll_mac_dh;
392 } dld_capab_poll_t;
395 * LSO capability
398 * Currently supported flags for LSO.
400 #define DLD_LSO_BASIC_TCP_IPV4 0x01 /* TCP LSO over IPv4 capability */
401 #define DLD_LSO_BASIC_TCP_IPV6 0x02 /* TCP LSO over IPv6 capability */
403 typedef struct dld_capab_lso_s {
404 uint_t lso_flags; /* capability flags */
405 uint_t lso_max; /* maximum payload */
406 } dld_capab_lso_t;
408 int dld_getinfo(dev_info_t *, ddi_info_cmd_t, void *, void **);
409 int dld_devt_to_instance(dev_t);
410 int dld_open(queue_t *, dev_t *, int, int, cred_t *);
411 int dld_close(queue_t *);
412 void dld_wput(queue_t *, mblk_t *);
413 void dld_wsrv(queue_t *);
414 int dld_str_open(queue_t *, dev_t *, void *);
415 int dld_str_close(queue_t *);
416 void *dld_str_private(queue_t *);
417 void dld_init_ops(struct dev_ops *, const char *);
418 void dld_fini_ops(struct dev_ops *);
419 int dld_autopush(dev_t *, struct dlautopush *);
421 int dld_add_flow(datalink_id_t, char *, flow_desc_t *,
422 mac_resource_props_t *);
423 int dld_remove_flow(char *);
424 int dld_modify_flow(char *, mac_resource_props_t *);
425 int dld_walk_flow(dld_ioc_walkflow_t *, intptr_t, cred_t *);
427 #endif
429 #ifdef __cplusplus
431 #endif
433 #endif /* _SYS_DLD_H */