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