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