xref: /titanic_44/usr/src/uts/common/inet/wifi_ioctl.h (revision e11c3f44f531fdff80941ce57c065d2ae861cefc)
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 /*
27  * Macro and date structures defined for 802.11 wifi config tool.
28  */
29 
30 #ifndef	__WIFI_IOCTL_H
31 #define	__WIFI_IOCTL_H
32 
33 #pragma ident	"%Z%%M%	%I%	%E% SMI"
34 
35 #include <sys/types.h>
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #define	MAX_KEY_LENGTH 26
42 #define	MAX_ESSID_LENGTH (32 + 1)	/* max essid length is 32 */
43 					/* one more for '\0' */
44 #define	MAX_CHANNEL_NUM	99
45 #define	MAX_RSSI 15
46 #define	MAX_NWEPKEYS 4
47 #define	NET_802_11 80211
48 #define	MAX_BUF_LEN 65536
49 #define	MAX_SCAN_SUPPORT_RATES 8
50 
51 /*
52  * ioctls
53  */
54 #define	WLAN_IOCTL_BASE 0x1000
55 #define	WLAN_GET_VERSION (WLAN_IOCTL_BASE + 0x0)
56 #define	WLAN_SET_PARAM (WLAN_IOCTL_BASE + 0x2)
57 #define	WLAN_GET_PARAM (WLAN_IOCTL_BASE + 0x3)
58 #define	WLAN_COMMAND (WLAN_IOCTL_BASE + 0x4)
59 
60 /*
61  * parameters
62  */
63 #define	WL_PARAMETERS_BASE 0x2000
64 #define	WL_BSSID (WL_PARAMETERS_BASE + 0x0)
65 #define	WL_ESSID (WL_PARAMETERS_BASE + 0x1)
66 #define	WL_NODE_NAME (WL_PARAMETERS_BASE + 0x2)
67 #define	WL_PHY_SUPPORT (WL_PARAMETERS_BASE + 0x3)
68 #define	WL_PHY_CONFIG (WL_PARAMETERS_BASE + 0x4)
69 #define	WL_DOMAIN (WL_PARAMETERS_BASE + 0x5)
70 #define	WL_POWER_MODE (WL_PARAMETERS_BASE + 0x6)
71 #define	WL_TX_POWER (WL_PARAMETERS_BASE + 0x7)
72 #define	WL_RSSI (WL_PARAMETERS_BASE + 0x8)
73 #define	WL_RSSI_THRESHOLD (WL_PARAMETERS_BASE + 0x9)
74 #define	WL_ESS_LIST (WL_PARAMETERS_BASE + 0xa)
75 #define	WL_BSS_TYPE (WL_PARAMETERS_BASE + 0xb)
76 #define	WL_CREATE_IBSS (WL_PARAMETERS_BASE + 0xc)
77 #define	WL_RTS_THRESHOLD (WL_PARAMETERS_BASE + 0xd)
78 #define	WL_SHORT_RETRY (WL_PARAMETERS_BASE + 0xe)
79 #define	WL_LONG_RETRY (WL_PARAMETERS_BASE + 0xf)
80 #define	WL_BEACON_PERIOD (WL_PARAMETERS_BASE + 0x10)
81 #define	WL_TX_LIFETIME (WL_PARAMETERS_BASE + 0x11)
82 #define	WL_RX_LIFETIME (WL_PARAMETERS_BASE + 0x12)
83 #define	WL_FRAG_THRESHOLD (WL_PARAMETERS_BASE + 0x13)
84 #define	WL_VENDOR_ID (WL_PARAMETERS_BASE + 0x14)
85 #define	WL_PRODUCT_ID (WL_PARAMETERS_BASE + 0x15)
86 #define	WL_NUM_ANTS (WL_PARAMETERS_BASE + 0x16)
87 #define	WL_RX_ANTENNA (WL_PARAMETERS_BASE + 0x17)
88 #define	WL_TX_ANTENNA (WL_PARAMETERS_BASE + 0x18)
89 #define	WL_SUPPORTED_RATES (WL_PARAMETERS_BASE + 0x19)
90 #define	WL_DESIRED_RATES (WL_PARAMETERS_BASE + 0x1a)
91 #define	WL_WEP_KEY_TAB (WL_PARAMETERS_BASE + 0x1b)
92 #define	WL_WEP_KEY_ID (WL_PARAMETERS_BASE + 0x1c)
93 #define	WL_WEP_MAPPING_TAB (WL_PARAMETERS_BASE + 0x1d)
94 #define	WL_WEP_MAPPING_LEN (WL_PARAMETERS_BASE + 0x1e)
95 #define	WL_ENCRYPTION (WL_PARAMETERS_BASE + 0x1f)
96 #define	WL_AUTH_MODE (WL_PARAMETERS_BASE + 0x20)
97 #define	WL_EXCL_UNENC (WL_PARAMETERS_BASE + 0x21)
98 #define	WL_RFMON (WL_PARAMETERS_BASE + 0x22)
99 #define	WL_RADIO (WL_PARAMETERS_BASE + 0x23)
100 #define	WL_LINKSTATUS (WL_PARAMETERS_BASE + 0x24)
101 #define	WL_DEV_DEPEND (WL_PARAMETERS_BASE + 0x25)
102 /*
103  * commands
104  */
105 #define	WL_COMMAND_BASE 0x3000
106 #define	WL_SCAN (WL_COMMAND_BASE + 0x0)
107 #define	WL_DISASSOCIATE (WL_COMMAND_BASE + 0x1)
108 #define	WL_REASSOCIATE (WL_COMMAND_BASE + 0x2)
109 #define	WL_LOAD_DEFAULTS (WL_COMMAND_BASE + 0x3)
110 #define	WL_ASSOCIAT (WL_COMMAND_BASE + 0x4)
111 
112 /*
113  * domains
114  */
115 /* --USA */
116 #define	WL_DOMAIN_BASE 0x4000
117 #define	WL_DOMAIN_FCC (WL_DOMAIN_BASE + 0x0)
118 /* --Canada */
119 #define	WL_DOMAIN_DOC (WL_DOMAIN_BASE + 0x1)
120 /* --Most of Europe */
121 #define	WL_DOMAIN_ETSI (WL_DOMAIN_BASE + 0x2)
122 /* --Spain */
123 #define	WL_DOMAIN_SPAIN (WL_DOMAIN_BASE + 0x3)
124 /* --France */
125 #define	WL_DOMAIN_FRANCE (WL_DOMAIN_BASE + 0x4)
126 /* --Japan */
127 #define	WL_DOMAIN_MKK (WL_DOMAIN_BASE + 0x5)
128 
129 /*
130  * power mode
131  */
132 
133 #define	WL_PM_AM 0x0
134 #define	WL_PM_MPS 0x1
135 #define	WL_PM_FAST 0x2
136 #define	WL_PM_USER 0x3
137 
138 /*
139  * rates
140  */
141 #define	WL_RATE_BASIC_SET 0x80
142 #define	WL_RATE_1M 2
143 #define	WL_RATE_2M 4
144 #define	WL_RATE_5_5M 11
145 #define	WL_RATE_6M 12
146 #define	WL_RATE_9M 18
147 #define	WL_RATE_11M 22
148 #define	WL_RATE_12M 24
149 #define	WL_RATE_18M 36
150 #define	WL_RATE_22M 44
151 #define	WL_RATE_24M 48
152 #define	WL_RATE_33M 66
153 #define	WL_RATE_36M 72
154 #define	WL_RATE_48M 96
155 #define	WL_RATE_54M 108
156 /*
157  * wep operations
158  */
159 #define	WL_WEP_OPERATION_BASE 0x6000
160 #define	WL_ADD (WL_WEP_OPERATION_BASE + 0x0)
161 #define	WL_DEL (WL_WEP_OPERATION_BASE + 0x1)
162 #define	WL_NUL (WL_WEP_OPERATION_BASE + 0x2)
163 #define	WL_IND (WL_WEP_OPERATION_BASE + 0x3)
164 
165 #define	WL_NOENCRYPTION 0x0
166 #define	WL_ENC_WEP 0x1
167 #define	WL_ENC_WPA 0x2
168 #define	WL_OPENSYSTEM 0x1
169 #define	WL_SHAREDKEY 0x2
170 
171 /*
172  * linkstatus
173  */
174 #define	WL_CONNECTED 0x0
175 #define	WL_NOTCONNECTED 0x1
176 
177 /*
178  * prives
179  */
180 #define	WL_PRIV_BASE 0x7000
181 #define	WL_PRIV_RW (WL_PRIV_BASE + 0x0)
182 #define	WL_PRIV_R (WL_PRIV_BASE + 0x1)
183 #define	WL_PRIV_W (WL_PRIV_BASE + 0x2)
184 #define	WL_PRIV_INT (WL_PRIV_BASE + 0x3)
185 #define	WL_PRIV_INT_ARRAY (WL_PRIV_BASE + 0x4)
186 #define	WL_PRIV_BYTE (WL_PRIV_BASE + 0x5)
187 #define	WL_PRIV_BYTE_ARRAY (WL_PRIV_BASE + 0x6)
188 #define	WL_PRIV_STRING (WL_PRIV_BASE + 0x7)
189 #define	WL_PRIV_STRING_ARRAY (WL_PRIV_BASE + 0x8)
190 /*
191  * return values
192  */
193 #define	WL_SUCCESS 0x0
194 #define	WL_NOTSUPPORTED EINVAL
195 #define	WL_LACK_FEATURE ENOTSUP
196 #define	WL_HW_ERROR EIO
197 #define	WL_ACCESS_DENIED EACCES
198 #define	WL_RETURN_BASE	0x7000
199 #define	WL_READONLY (WL_RETURN_BASE + 0x1)
200 #define	WL_WRITEONLY (WL_RETURN_BASE + 0x2)
201 #define	WL_NOAP (WL_RETURN_BASE + 0x3)
202 /*
203  * other values
204  */
205 #define	WL_OTHER_BASE 0x8000
206 #define	WL_FHSS (WL_OTHER_BASE + 0x0)
207 #define	WL_DSSS (WL_OTHER_BASE + 0x1)
208 #define	WL_IRBASE (WL_OTHER_BASE + 0x2)
209 #define	WL_OFDM (WL_OTHER_BASE + 0x3)
210 #define	WL_HRDS (WL_OTHER_BASE + 0x4)
211 #define	WL_ERP (WL_OTHER_BASE + 0x5)
212 
213 #define	WL_BSS_BSS 1
214 #define	WL_BSS_IBSS 3
215 #define	WL_BSS_ANY 2
216 /*
217  * field_offset
218  */
219 #define	WIFI_BUF_OFFSET		offsetof(wldp_t, wldp_buf)
220 
221 /*
222  * type definationes
223  */
224 typedef boolean_t wl_create_ibss_t;
225 typedef char wl_bssid_t[6];
226 
227 typedef struct wl_essid {
228 	uint32_t wl_essid_length;
229 	char wl_essid_essid[34];
230 }wl_essid_t;
231 
232 typedef struct wl_nodename {
233 	uint32_t wl_nodename_length;
234 	char wl_nodename_name[34];
235 } wl_nodename_t;
236 
237 typedef struct wl_phy_supported {
238 	uint32_t wl_phy_support_num;
239 	uint32_t wl_phy_support_phy_types[1];
240 } wl_phy_supported_t;
241 
242 typedef struct wl_fhss {
243 	uint32_t wl_fhss_subtype;
244 	uint32_t wl_fhss_channel;
245 	uint32_t wl_fhss_hoptime;
246 	uint32_t wl_fhss_hoppattern;
247 	uint32_t wl_fhss_hopset;
248 	uint32_t wl_fhss_dwelltime;
249 } wl_fhss_t;
250 
251 typedef struct wl_dsss {
252 	uint32_t wl_dsss_subtype;
253 	uint32_t wl_dsss_channel;
254 	boolean_t wl_dsss_have_short_preamble;
255 	uint32_t wl_dsss_preamble_mode;
256 	boolean_t wl_dsss_agility_enabled;
257 	boolean_t wl_dsss_have_pbcc;
258 	boolean_t wl_dsss_pbcc_enable;
259 } wl_dsss_t;
260 
261 typedef struct wl_ofdm {
262 	uint32_t wl_ofdm_subtype;
263 	uint32_t wl_ofdm_frequency;
264 	uint32_t wl_ofdm_freq_supported;
265 } wl_ofdm_t;
266 
267 typedef struct wl_erp {
268 	uint32_t wl_erp_subtype;
269 	uint32_t wl_erp_channel;
270 	boolean_t wl_erp_have_short_preamble;
271 	uint32_t wl_erp_preamble_mode;
272 	boolean_t wl_erp_have_agility;
273 	boolean_t wl_erp_agility_enabled;
274 	boolean_t wl_erp_have_pbcc;
275 	boolean_t wl_erp_pbcc_enabled;
276 	boolean_t wl_erp_have_dsss_ofdm;
277 	boolean_t wl_erp_dsss_ofdm_enabled;
278 	boolean_t wl_erp_have_sst;
279 	boolean_t wl_erp_sst_enabled;
280 } wl_erp_t;
281 
282 typedef union wl_phy_conf {
283 	wl_fhss_t wl_phy_fhss_conf;
284 	wl_dsss_t wl_phy_dsss_conf;
285 	wl_ofdm_t wl_phy_ofdm_conf;
286 	wl_erp_t wl_phy_erp_conf;
287 } wl_phy_conf_t;
288 
289 typedef uint32_t wl_domain_t;
290 
291 typedef struct wl_ps_mode {
292 	uint32_t wl_ps_mode;
293 	uint32_t wl_ps_max_sleep;
294 	uint32_t wl_ps_min_sleep;
295 	uint32_t wl_ps_max_awake;
296 	uint32_t wl_ps_min_awake;
297 	boolean_t wl_ps_nobroadcast;
298 } wl_ps_mode_t;
299 
300 typedef uint32_t wl_linkstatus_t;
301 typedef uint32_t wl_tx_pwer_t;
302 typedef uint32_t wl_rssi_t;
303 typedef uint32_t wl_rssi_threshold_t;
304 typedef uint32_t wl_bss_type_t;
305 typedef uint32_t wl_authmode_t;
306 typedef uint32_t wl_encryption_t;
307 typedef uint32_t wl_wep_key_id_t;
308 typedef boolean_t wl_radio_t;
309 typedef uint32_t wl_rts_threshold_t;
310 typedef uint32_t wl_short_retry_t;
311 typedef uint32_t wl_long_retry_t;
312 typedef uint32_t wl_beacon_period_t;
313 typedef uint32_t wl_tx_lifetime_t;
314 typedef uint32_t wl_rx_lifetime_t;
315 typedef uint32_t wl_frag_threshold_t;
316 typedef char wl_vendor_t[128];
317 typedef char wl_product_t[128];
318 typedef uint32_t wl_num_ants_t;
319 typedef uint32_t wl_rx_antenna_t;
320 typedef uint32_t wl_tx_antenna_t;
321 
322 typedef struct wl_rates {
323 	uint32_t wl_rates_num;
324 	char wl_rates_rates[1];
325 } wl_rates_t;
326 
327 typedef struct wl_ess_conf {
328 	uint32_t wl_ess_conf_length;
329 	wl_essid_t wl_ess_conf_essid;
330 	wl_bssid_t wl_ess_conf_bssid;
331 	char wl_ess_conf_reserved[2];
332 	wl_bss_type_t wl_ess_conf_bsstype;
333 	wl_authmode_t wl_ess_conf_authmode;
334 	boolean_t wl_ess_conf_wepenabled;
335 	wl_rssi_t wl_ess_conf_sl;
336 	union {
337 		wl_fhss_t wl_phy_fhss_conf;
338 		wl_dsss_t wl_phy_dsss_conf;
339 		wl_ofdm_t wl_phy_ofdm_conf;
340 		wl_erp_t wl_phy_erp_conf;
341 	} wl_phy_conf;
342 	char wl_supported_rates[MAX_SCAN_SUPPORT_RATES];
343 } wl_ess_conf_t;
344 
345 typedef struct wl_ess_list {
346 	uint32_t wl_ess_list_num;
347 	wl_ess_conf_t wl_ess_list_ess[1];
348 } wl_ess_list_t;
349 
350 typedef struct wl_wep_key {
351 	uint32_t wl_wep_length;
352 	char wl_wep_key[MAX_KEY_LENGTH];
353 	uint32_t wl_wep_operation;
354 } wl_wep_key_t;
355 typedef wl_wep_key_t wl_wep_key_tab_t[MAX_NWEPKEYS];
356 
357 typedef struct wep_mapping {
358 	uint32_t wl_wep_map_index;
359 	boolean_t wl_wep_map_wepon;
360 	char wl_wep_map_mac_addr[6];
361 	char wl_wep_map_reserved[2];
362 	wl_wep_key_t wl_wep_map_wepkey;
363 } wep_mapping_t;
364 typedef wep_mapping_t wep_mapping_tab_t[1];
365 
366 typedef struct wl_priv_param {
367 	char wl_priv_name[8];
368 	uint32_t wl_priv_type;
369 	uint32_t wl_priv_size;
370 	char wl_priv_value[1];
371 } wl_priv_param_t;
372 
373 typedef struct wl_dev_depend {
374 	uint32_t wl_dev_depend_num;
375 	uint32_t wl_dev_depend_ret_idx;
376 	wl_priv_param_t wl_dev_depend_priv[1];
377 } wl_dev_depend_t;
378 
379 typedef struct wlan_ver {
380 	uint32_t wl_ver_major;
381 	uint32_t wl_ver_minor;
382 } wlan_ver_t;
383 
384 typedef struct wldp {
385 	uint32_t wldp_length;
386 	uint32_t wldp_type;
387 	uint32_t wldp_result;
388 	uint32_t wldp_id;
389 	uint32_t wldp_buf[1];
390 } wldp_t;
391 
392 #ifdef __cplusplus
393 }
394 #endif
395 
396 #endif /* __WIFI_IOCTL_H */
397