xref: /titanic_52/usr/src/uts/common/inet/wifi_ioctl.h (revision 7014882c6a3672fd0e5d60200af8643ae53c5928)
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 2009 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 #include <sys/types.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	MAX_KEY_LENGTH 26
40 #define	MAX_ESSID_LENGTH (32 + 1)	/* max essid length is 32 */
41 					/* one more for '\0' */
42 #define	MAX_CHANNEL_NUM	99
43 #define	MAX_RSSI 15
44 #define	MAX_NWEPKEYS 4
45 #define	NET_802_11 80211
46 #define	MAX_BUF_LEN 65536
47 #define	MAX_SCAN_SUPPORT_RATES 8
48 
49 /*
50  * ioctls
51  */
52 #define	WLAN_IOCTL_BASE 0x1000
53 #define	WLAN_GET_VERSION (WLAN_IOCTL_BASE + 0x0)
54 #define	WLAN_SET_PARAM (WLAN_IOCTL_BASE + 0x2)
55 #define	WLAN_GET_PARAM (WLAN_IOCTL_BASE + 0x3)
56 #define	WLAN_COMMAND (WLAN_IOCTL_BASE + 0x4)
57 
58 /*
59  * parameters
60  */
61 #define	WL_PARAMETERS_BASE 0x2000
62 #define	WL_BSSID (WL_PARAMETERS_BASE + 0x0)
63 #define	WL_ESSID (WL_PARAMETERS_BASE + 0x1)
64 #define	WL_NODE_NAME (WL_PARAMETERS_BASE + 0x2)
65 #define	WL_PHY_SUPPORT (WL_PARAMETERS_BASE + 0x3)
66 #define	WL_PHY_CONFIG (WL_PARAMETERS_BASE + 0x4)
67 #define	WL_DOMAIN (WL_PARAMETERS_BASE + 0x5)
68 #define	WL_POWER_MODE (WL_PARAMETERS_BASE + 0x6)
69 #define	WL_TX_POWER (WL_PARAMETERS_BASE + 0x7)
70 #define	WL_RSSI (WL_PARAMETERS_BASE + 0x8)
71 #define	WL_RSSI_THRESHOLD (WL_PARAMETERS_BASE + 0x9)
72 #define	WL_ESS_LIST (WL_PARAMETERS_BASE + 0xa)
73 #define	WL_BSS_TYPE (WL_PARAMETERS_BASE + 0xb)
74 #define	WL_CREATE_IBSS (WL_PARAMETERS_BASE + 0xc)
75 #define	WL_RTS_THRESHOLD (WL_PARAMETERS_BASE + 0xd)
76 #define	WL_SHORT_RETRY (WL_PARAMETERS_BASE + 0xe)
77 #define	WL_LONG_RETRY (WL_PARAMETERS_BASE + 0xf)
78 #define	WL_BEACON_PERIOD (WL_PARAMETERS_BASE + 0x10)
79 #define	WL_TX_LIFETIME (WL_PARAMETERS_BASE + 0x11)
80 #define	WL_RX_LIFETIME (WL_PARAMETERS_BASE + 0x12)
81 #define	WL_FRAG_THRESHOLD (WL_PARAMETERS_BASE + 0x13)
82 #define	WL_VENDOR_ID (WL_PARAMETERS_BASE + 0x14)
83 #define	WL_PRODUCT_ID (WL_PARAMETERS_BASE + 0x15)
84 #define	WL_NUM_ANTS (WL_PARAMETERS_BASE + 0x16)
85 #define	WL_RX_ANTENNA (WL_PARAMETERS_BASE + 0x17)
86 #define	WL_TX_ANTENNA (WL_PARAMETERS_BASE + 0x18)
87 #define	WL_SUPPORTED_RATES (WL_PARAMETERS_BASE + 0x19)
88 #define	WL_DESIRED_RATES (WL_PARAMETERS_BASE + 0x1a)
89 #define	WL_WEP_KEY_TAB (WL_PARAMETERS_BASE + 0x1b)
90 #define	WL_WEP_KEY_ID (WL_PARAMETERS_BASE + 0x1c)
91 #define	WL_WEP_MAPPING_TAB (WL_PARAMETERS_BASE + 0x1d)
92 #define	WL_WEP_MAPPING_LEN (WL_PARAMETERS_BASE + 0x1e)
93 #define	WL_ENCRYPTION (WL_PARAMETERS_BASE + 0x1f)
94 #define	WL_AUTH_MODE (WL_PARAMETERS_BASE + 0x20)
95 #define	WL_EXCL_UNENC (WL_PARAMETERS_BASE + 0x21)
96 #define	WL_RFMON (WL_PARAMETERS_BASE + 0x22)
97 #define	WL_RADIO (WL_PARAMETERS_BASE + 0x23)
98 #define	WL_LINKSTATUS (WL_PARAMETERS_BASE + 0x24)
99 #define	WL_DEV_DEPEND (WL_PARAMETERS_BASE + 0x25)
100 /*
101  * commands
102  */
103 #define	WL_COMMAND_BASE 0x3000
104 #define	WL_SCAN (WL_COMMAND_BASE + 0x0)
105 #define	WL_DISASSOCIATE (WL_COMMAND_BASE + 0x1)
106 #define	WL_REASSOCIATE (WL_COMMAND_BASE + 0x2)
107 #define	WL_LOAD_DEFAULTS (WL_COMMAND_BASE + 0x3)
108 #define	WL_ASSOCIAT (WL_COMMAND_BASE + 0x4)
109 
110 /*
111  * domains
112  */
113 /* --USA */
114 #define	WL_DOMAIN_BASE 0x4000
115 #define	WL_DOMAIN_FCC (WL_DOMAIN_BASE + 0x0)
116 /* --Canada */
117 #define	WL_DOMAIN_DOC (WL_DOMAIN_BASE + 0x1)
118 /* --Most of Europe */
119 #define	WL_DOMAIN_ETSI (WL_DOMAIN_BASE + 0x2)
120 /* --Spain */
121 #define	WL_DOMAIN_SPAIN (WL_DOMAIN_BASE + 0x3)
122 /* --France */
123 #define	WL_DOMAIN_FRANCE (WL_DOMAIN_BASE + 0x4)
124 /* --Japan */
125 #define	WL_DOMAIN_MKK (WL_DOMAIN_BASE + 0x5)
126 
127 /*
128  * power mode
129  */
130 
131 #define	WL_PM_AM 0x0
132 #define	WL_PM_MPS 0x1
133 #define	WL_PM_FAST 0x2
134 #define	WL_PM_USER 0x3
135 
136 /*
137  * rates
138  */
139 #define	WL_RATE_BASIC_SET 0x80
140 #define	WL_RATE_1M 2
141 #define	WL_RATE_2M 4
142 #define	WL_RATE_5_5M 11
143 #define	WL_RATE_6M 12
144 #define	WL_RATE_9M 18
145 #define	WL_RATE_11M 22
146 #define	WL_RATE_12M 24
147 #define	WL_RATE_18M 36
148 #define	WL_RATE_22M 44
149 #define	WL_RATE_24M 48
150 #define	WL_RATE_33M 66
151 #define	WL_RATE_36M 72
152 #define	WL_RATE_48M 96
153 #define	WL_RATE_54M 108
154 /*
155  * wep operations
156  */
157 #define	WL_WEP_OPERATION_BASE 0x6000
158 #define	WL_ADD (WL_WEP_OPERATION_BASE + 0x0)
159 #define	WL_DEL (WL_WEP_OPERATION_BASE + 0x1)
160 #define	WL_NUL (WL_WEP_OPERATION_BASE + 0x2)
161 #define	WL_IND (WL_WEP_OPERATION_BASE + 0x3)
162 
163 #define	WL_NOENCRYPTION 0x0
164 #define	WL_ENC_WEP 0x1
165 #define	WL_ENC_WPA 0x2
166 #define	WL_OPENSYSTEM 0x1
167 #define	WL_SHAREDKEY 0x2
168 
169 /*
170  * linkstatus
171  */
172 #define	WL_CONNECTED 0x0
173 #define	WL_NOTCONNECTED 0x1
174 
175 /*
176  * prives
177  */
178 #define	WL_PRIV_BASE 0x7000
179 #define	WL_PRIV_RW (WL_PRIV_BASE + 0x0)
180 #define	WL_PRIV_R (WL_PRIV_BASE + 0x1)
181 #define	WL_PRIV_W (WL_PRIV_BASE + 0x2)
182 #define	WL_PRIV_INT (WL_PRIV_BASE + 0x3)
183 #define	WL_PRIV_INT_ARRAY (WL_PRIV_BASE + 0x4)
184 #define	WL_PRIV_BYTE (WL_PRIV_BASE + 0x5)
185 #define	WL_PRIV_BYTE_ARRAY (WL_PRIV_BASE + 0x6)
186 #define	WL_PRIV_STRING (WL_PRIV_BASE + 0x7)
187 #define	WL_PRIV_STRING_ARRAY (WL_PRIV_BASE + 0x8)
188 /*
189  * return values
190  */
191 #define	WL_SUCCESS 0x0
192 #define	WL_NOTSUPPORTED EINVAL
193 #define	WL_LACK_FEATURE ENOTSUP
194 #define	WL_HW_ERROR EIO
195 #define	WL_ACCESS_DENIED EACCES
196 #define	WL_RETURN_BASE	0x7000
197 #define	WL_READONLY (WL_RETURN_BASE + 0x1)
198 #define	WL_WRITEONLY (WL_RETURN_BASE + 0x2)
199 #define	WL_NOAP (WL_RETURN_BASE + 0x3)
200 /*
201  * other values
202  */
203 #define	WL_OTHER_BASE 0x8000
204 #define	WL_FHSS (WL_OTHER_BASE + 0x0)
205 #define	WL_DSSS (WL_OTHER_BASE + 0x1)
206 #define	WL_IRBASE (WL_OTHER_BASE + 0x2)
207 #define	WL_OFDM (WL_OTHER_BASE + 0x3)
208 #define	WL_HRDS (WL_OTHER_BASE + 0x4)
209 #define	WL_ERP (WL_OTHER_BASE + 0x5)
210 
211 #define	WL_BSS_BSS 1
212 #define	WL_BSS_IBSS 3
213 #define	WL_BSS_ANY 2
214 /*
215  * field_offset
216  */
217 #define	WIFI_BUF_OFFSET		offsetof(wldp_t, wldp_buf)
218 
219 /*
220  * type definationes
221  */
222 typedef boolean_t wl_create_ibss_t;
223 typedef char wl_bssid_t[6];
224 
225 typedef struct wl_essid {
226 	uint32_t wl_essid_length;
227 	char wl_essid_essid[34];
228 }wl_essid_t;
229 
230 typedef struct wl_nodename {
231 	uint32_t wl_nodename_length;
232 	char wl_nodename_name[34];
233 } wl_nodename_t;
234 
235 typedef struct wl_phy_supported {
236 	uint32_t wl_phy_support_num;
237 	uint32_t wl_phy_support_phy_types[1];
238 } wl_phy_supported_t;
239 
240 typedef struct wl_fhss {
241 	uint32_t wl_fhss_subtype;
242 	uint32_t wl_fhss_channel;
243 	uint32_t wl_fhss_hoptime;
244 	uint32_t wl_fhss_hoppattern;
245 	uint32_t wl_fhss_hopset;
246 	uint32_t wl_fhss_dwelltime;
247 } wl_fhss_t;
248 
249 typedef struct wl_dsss {
250 	uint32_t wl_dsss_subtype;
251 	uint32_t wl_dsss_channel;
252 	boolean_t wl_dsss_have_short_preamble;
253 	uint32_t wl_dsss_preamble_mode;
254 	boolean_t wl_dsss_agility_enabled;
255 	boolean_t wl_dsss_have_pbcc;
256 	boolean_t wl_dsss_pbcc_enable;
257 } wl_dsss_t;
258 
259 typedef struct wl_ofdm {
260 	uint32_t wl_ofdm_subtype;
261 	uint32_t wl_ofdm_frequency;
262 	uint32_t wl_ofdm_freq_supported;
263 	boolean_t wl_ofdm_ht_enabled;
264 } wl_ofdm_t;
265 
266 typedef struct wl_erp {
267 	uint32_t wl_erp_subtype;
268 	uint32_t wl_erp_channel;
269 	boolean_t wl_erp_have_short_preamble;
270 	uint32_t wl_erp_preamble_mode;
271 	boolean_t wl_erp_have_agility;
272 	boolean_t wl_erp_agility_enabled;
273 	boolean_t wl_erp_have_pbcc;
274 	boolean_t wl_erp_pbcc_enabled;
275 	boolean_t wl_erp_have_dsss_ofdm;
276 	boolean_t wl_erp_dsss_ofdm_enabled;
277 	boolean_t wl_erp_have_sst;
278 	boolean_t wl_erp_sst_enabled;
279 	boolean_t wl_erp_ht_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