add max essid size to wlioctl.h
[openwrt/openwrt.git] / openwrt / package / openwrt / include / wlioctl.h
1 /*
2 * Custom OID/ioctl definitions for
3 * Broadcom 802.11abg Networking Device Driver
4 *
5 * Definitions subject to change without notice.
6 *
7 * Copyright 2004, Broadcom Corporation
8 * All Rights Reserved.
9 *
10 * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY
11 * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM
12 * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
13 * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE.
14 *
15 * $Id$
16 */
17
18 #ifndef _wlioctl_h_
19 #define _wlioctl_h_
20
21 #include <typedefs.h>
22 #include <proto/ethernet.h>
23 #include <proto/802.11.h>
24
25 #if defined(__GNUC__)
26 #define PACKED __attribute__((packed))
27 #else
28 #define PACKED
29 #endif
30
31 #define WLC_ESSID_MAX_SIZE 32
32
33 #define WL_NUMRATES 255 /* max # of rates in a rateset */
34
35 typedef struct wl_rateset {
36 uint32 count; /* # rates in this set */
37 uint8 rates[WL_NUMRATES]; /* rates in 500kbps units w/hi bit set if basic */
38 } wl_rateset_t;
39
40 #define WL_CHANSPEC_CHAN_MASK 0x0fff
41 #define WL_CHANSPEC_BAND_MASK 0xf000
42 #define WL_CHANSPEC_BAND_SHIFT 12
43 #define WL_CHANSPEC_BAND_A 0x1000
44 #define WL_CHANSPEC_BAND_B 0x2000
45
46 /*
47 * Per-bss information structure.
48 */
49
50 #define WL_LEGACY_BSS_INFO_VERSION 106 /* an older supported version of wl_bss_info struct */
51 #define WL_BSS_INFO_VERSION 107 /* current version of wl_bss_info struct */
52
53 typedef struct wl_bss_info106 {
54 uint version; /* version field */
55 struct ether_addr BSSID;
56 uint8 SSID_len;
57 uint8 SSID[32];
58 uint8 Privacy; /* 0=No WEP, 1=Use WEP */
59 int16 RSSI; /* receive signal strength (in dBm) */
60 uint16 beacon_period; /* units are Kusec */
61 uint16 atim_window; /* units are Kusec */
62 uint8 channel; /* Channel no. */
63 int8 infra; /* 0=IBSS, 1=infrastructure, 2=unknown */
64 struct {
65 uint count; /* # rates in this set */
66 uint8 rates[12]; /* rates in 500kbps units w/hi bit set if basic */
67 } rateset; /* supported rates */
68 uint8 dtim_period; /* DTIM period */
69 int8 phy_noise; /* noise right after tx (in dBm) */
70 uint16 capability; /* Capability information */
71 struct dot11_bcn_prb *prb; /* probe response frame (ioctl na) */
72 uint16 prb_len; /* probe response frame length (ioctl na) */
73 struct {
74 uint8 supported; /* wpa supported */
75 uint8 multicast; /* multicast cipher */
76 uint8 ucount; /* count of unicast ciphers */
77 uint8 unicast[4]; /* unicast ciphers */
78 uint8 acount; /* count of auth modes */
79 uint8 auth[4]; /* Authentication modes */
80 } wpa;
81 } wl_bss_info106_t;
82
83 typedef struct wl_bss_info {
84 uint32 version; /* version field */
85 uint32 length; /* byte length of data in this record, starting at version and including IEs */
86 struct ether_addr BSSID;
87 uint16 beacon_period; /* units are Kusec */
88 uint16 capability; /* Capability information */
89 uint8 SSID_len;
90 uint8 SSID[32];
91 struct {
92 uint count; /* # rates in this set */
93 uint8 rates[16]; /* rates in 500kbps units w/hi bit set if basic */
94 } rateset; /* supported rates */
95 uint8 channel; /* Channel no. */
96 uint16 atim_window; /* units are Kusec */
97 uint8 dtim_period; /* DTIM period */
98 int16 RSSI; /* receive signal strength (in dBm) */
99 int8 phy_noise; /* noise (in dBm) */
100 uint32 ie_length; /* byte length of Information Elements */
101 /* variable length Information Elements */
102 } wl_bss_info_t;
103
104 typedef struct wlc_ssid {
105 uint32 SSID_len;
106 uchar SSID[32];
107 } wlc_ssid_t;
108
109 typedef struct wl_scan_params {
110 wlc_ssid_t ssid; /* default is {0, ""} */
111 struct ether_addr bssid;/* default is bcast */
112 int8 bss_type; /* default is any, DOT11_BSSTYPE_ANY/INFRASTRUCTURE/INDEPENDENT */
113 int8 scan_type; /* -1 use default, DOT11_SCANTYPE_ACTIVE/PASSIVE */
114 int32 nprobes; /* -1 use default, number of probes per channel */
115 int32 active_time; /* -1 use default, dwell time per channel for active scanning */
116 int32 passive_time; /* -1 use default, dwell time per channel for passive scanning */
117 int32 home_time; /* -1 use default, dwell time for the home channel between channel scans */
118 int32 channel_num; /* 0 use default (all available channels), count of channels in channel_list */
119 uint16 channel_list[1]; /* list of chanspecs */
120 } wl_scan_params_t;
121 /* size of wl_scan_params not including variable length array */
122 #define WL_SCAN_PARAMS_FIXED_SIZE 64
123
124 typedef struct wl_scan_results {
125 uint32 buflen;
126 uint32 version;
127 uint32 count;
128 wl_bss_info_t bss_info[1];
129 } wl_scan_results_t;
130 /* size of wl_scan_results not including variable length array */
131 #define WL_SCAN_RESULTS_FIXED_SIZE 12
132
133 /* uint32 list */
134 typedef struct wl_uint32_list {
135 /* in - # of elements, out - # of entries */
136 uint32 count;
137 /* variable length uint32 list */
138 uint32 element[1];
139 } wl_uint32_list_t;
140
141 #define WLC_CNTRY_BUF_SZ 4 /* Country string is 3 bytes + NULL */
142
143 typedef struct wl_channels_in_country {
144 uint32 buflen;
145 uint32 band;
146 char country_abbrev[WLC_CNTRY_BUF_SZ];
147 uint32 count;
148 uint32 channel[1];
149 } wl_channels_in_country_t;
150
151 typedef struct wl_country_list {
152 uint32 buflen;
153 uint32 band_set;
154 uint32 band;
155 uint32 count;
156 char country_abbrev[1];
157 } wl_country_list_t;
158
159 #define WL_RM_TYPE_BASIC 1
160 #define WL_RM_TYPE_CCA 2
161 #define WL_RM_TYPE_RPI 3
162
163 #define WL_RM_FLAG_PARALLEL (1<<0)
164
165 #define WL_RM_FLAG_LATE (1<<1)
166 #define WL_RM_FLAG_INCAPABLE (1<<2)
167 #define WL_RM_FLAG_REFUSED (1<<3)
168
169 typedef struct wl_rm_req_elt {
170 int8 type;
171 int8 flags;
172 uint16 chanspec;
173 uint32 token; /* token for this measurement */
174 uint32 tsf_h; /* TSF high 32-bits of Measurement start time */
175 uint32 tsf_l; /* TSF low 32-bits */
176 uint32 dur; /* TUs */
177 } wl_rm_req_elt_t;
178
179 typedef struct wl_rm_req {
180 uint32 token; /* overall measurement set token */
181 uint32 count; /* number of measurement reqests */
182 wl_rm_req_elt_t req[1]; /* variable length block of requests */
183 } wl_rm_req_t;
184 #define WL_RM_REQ_FIXED_LEN 8
185
186 typedef struct wl_rm_rep_elt {
187 int8 type;
188 int8 flags;
189 uint16 chanspec;
190 uint32 token; /* token for this measurement */
191 uint32 tsf_h; /* TSF high 32-bits of Measurement start time */
192 uint32 tsf_l; /* TSF low 32-bits */
193 uint32 dur; /* TUs */
194 uint32 len; /* byte length of data block */
195 uint8 data[1]; /* variable length data block */
196 } wl_rm_rep_elt_t;
197 #define WL_RM_REP_ELT_FIXED_LEN 24 /* length excluding data block */
198
199 #define WL_RPI_REP_BIN_NUM 8
200 typedef struct wl_rm_rpi_rep {
201 uint8 rpi[WL_RPI_REP_BIN_NUM];
202 int8 rpi_max[WL_RPI_REP_BIN_NUM];
203 } wl_rm_rpi_rep_t;
204
205 typedef struct wl_rm_rep {
206 uint32 token; /* overall measurement set token */
207 uint32 len; /* length of measurement report block */
208 wl_rm_rep_elt_t rep[1]; /* variable length block of reports */
209 } wl_rm_rep_t;
210 #define WL_RM_REP_FIXED_LEN 8
211
212
213 #define WLC_MAX_KEY_SIZE 32 /* max size of any key */
214 #define WLC_MAX_IV_SIZE 16 /* max size of any IV */
215 #define WLC_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */
216 #define WLC_MAX_DEFAULT_KEYS 4 /* # of default WEP keys */
217 #define WLC_MAX_KEYS 54 /* Max # of WEP keys */
218 #define WLC_WEP1_KEY_SIZE 5 /* max size of any WEP key */
219 #define WLC_WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */
220 #define WLC_WEP128_KEY_SIZE 13 /* max size of any WEP key */
221 #define WLC_WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */
222 #define WLC_TKIP_MIC_SIZE 8 /* size of TKIP MIC */
223 #define WLC_TKIP_EOM_SIZE 7 /* max size of TKIP EOM */
224 #define WLC_TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */
225 #define WLC_TKIP_KEY_SIZE 32 /* size of any TKIP key */
226 #define WLC_TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */
227 #define WLC_TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */
228 #define WLC_TKIP_MIC_SUP_RX 16 /* offset to Supplicant MIC RX key */
229 #define WLC_TKIP_MIC_SUP_TX 24 /* offset to Supplicant MIC TX key */
230 #define WLC_TKIP_P1_KEY_SIZE 10 /* size of TKHash Phase1 output, in bytes */
231 #define WLC_TKIP_P2_KEY_SIZE 16 /* size of TKHash Phase2 output */
232 #define WLC_AES_KEY_SIZE 16 /* size of AES key */
233
234
235 typedef enum sup_auth_status {
236 WLC_SUP_DISCONNECTED = 0,
237 WLC_SUP_CONNECTING,
238 WLC_SUP_IDREQUIRED,
239 WLC_SUP_AUTHENTICATING,
240 WLC_SUP_AUTHENTICATED,
241 WLC_SUP_KEYXCHANGE,
242 WLC_SUP_KEYED
243 } sup_auth_status_t;
244
245 /* Enumerate crypto algorithms */
246 #define CRYPTO_ALGO_OFF 0
247 #define CRYPTO_ALGO_WEP1 1
248 #define CRYPTO_ALGO_TKIP 2
249 #define CRYPTO_ALGO_WEP128 3
250 #define CRYPTO_ALGO_AES_CCM 4
251 #define CRYPTO_ALGO_AES_OCB_MSDU 5
252 #define CRYPTO_ALGO_AES_OCB_MPDU 6
253 #define CRYPTO_ALGO_NALG 7
254
255 #define WSEC_GEN_MIC_ERROR 0x0001
256 #define WSEC_GEN_REPLAY 0x0002
257
258 #define WL_SOFT_KEY (1 << 0) /* Indicates this key is using soft encrypt */
259 #define WL_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */
260 #define WL_KF_RES_4 (1 << 4) /* Reserved for backward compat */
261 #define WL_KF_RES_5 (1 << 5) /* Reserved for backward compat */
262
263
264 typedef struct wlc_tkip_info {
265 uint16 phase1[WLC_TKIP_P1_KEY_SIZE/sizeof(uint16)]; /* tkhash phase1 result */
266 uint8 phase2[WLC_TKIP_P2_KEY_SIZE]; /* tkhash phase2 result */
267 uint32 micl;
268 uint32 micr;
269 } tkip_info_t;
270
271 typedef struct _wsec_iv {
272 uint32 hi; /* upper 32 bits of IV */
273 uint16 lo; /* lower 16 bits of IV */
274 } wsec_iv_t;
275
276 typedef struct wsec_key {
277 uint32 index; /* key index */
278 uint32 len; /* key length */
279 uint8 data[WLC_MAX_KEY_SIZE]; /* key data */
280 tkip_info_t tkip_tx; /* tkip transmit state */
281 tkip_info_t tkip_rx; /* tkip receive state */
282 uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
283 uint32 flags; /* misc flags */
284 uint32 algo_hw; /* cache for hw register*/
285 uint32 aes_mode; /* cache for hw register*/
286 int iv_len; /* IV length */
287 int iv_initialized; /* has IV been initialized already? */
288 int icv_len; /* ICV length */
289 wsec_iv_t rxiv; /* Rx IV */
290 wsec_iv_t txiv; /* Tx IV */
291 struct ether_addr ea; /* per station */
292 } wsec_key_t;
293
294
295
296 typedef struct wl_wsec_key {
297 uint32 index; /* key index */
298 uint32 len; /* key length */
299 uint8 data[DOT11_MAX_KEY_SIZE]; /* key data */
300 uint32 pad_1[18];
301 uint32 algo; /* CRYPTO_ALGO_AES_CCM, CRYPTO_ALGO_WEP128, etc */
302 uint32 flags; /* misc flags */
303 uint32 pad_2[2];
304 int pad_3;
305 int iv_initialized; /* has IV been initialized already? */
306 int pad_4;
307 /* Rx IV */
308 struct {
309 uint32 hi; /* upper 32 bits of IV */
310 uint16 lo; /* lower 16 bits of IV */
311 } rxiv;
312 uint32 pad_5[2];
313 struct ether_addr ea; /* per station */
314 } wl_wsec_key_t;
315
316 /* For use with wlc_wep_key.flags */
317 #define WSEC_PRIMARY_KEY (1 << 1) /* Indicates this key is the primary (ie tx) key */
318 #define WSEC_TKIP_ERROR (1 << 2) /* Provoke deliberate error */
319
320 #define WSEC_MIN_PSK_LEN 8
321 #define WSEC_MAX_PSK_LEN 64
322
323 /* Flag for key material needing passhash'ing */
324 #define WSEC_PASSPHRASE (1<<0)
325
326 /* recepticle for WLC_SET_WSEC_PMK parameter */
327 typedef struct {
328 ushort key_len; /* octets in key material */
329 ushort flags; /* key handling qualification */
330 uint8 key[WSEC_MAX_PSK_LEN]; /* PMK material */
331 } wsec_pmk_t;
332
333 /* wireless security bitvec */
334 #define WEP_ENABLED 1
335 #define TKIP_ENABLED 2
336 #define AES_ENABLED 4
337 #define WSEC_SWFLAG 8
338
339 #define WSEC_SW(wsec) ((wsec) & WSEC_SWFLAG)
340 #define WSEC_HW(wsec) (!WSEC_SW(wsec))
341 #define WSEC_WEP_ENABLED(wsec) ((wsec) & WEP_ENABLED)
342 #define WSEC_TKIP_ENABLED(wsec) ((wsec) & TKIP_ENABLED)
343 #define WSEC_AES_ENABLED(wsec) ((wsec) & AES_ENABLED)
344 #define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
345
346
347 /* wireless authentication bit vector */
348 #define WPA_ENABLED 1
349 #define PSK_ENABLED 2
350
351 #define WAUTH_WPA_ENABLED(wauth) ((wauth) & WPA_ENABLED)
352 #define WAUTH_PSK_ENABLED(wauth) ((wauth) & PSK_ENABLED)
353 #define WAUTH_ENABLED(wauth) ((wauth) & (WPA_ENABLED | PSK_ENABLED))
354
355 /* group/mcast cipher */
356 #define WPA_MCAST_CIPHER(wsec) (((wsec) & TKIP_ENABLED) ? WPA_CIPHER_TKIP : \
357 ((wsec) & AES_ENABLED) ? WPA_CIPHER_AES_CCM : \
358 WPA_CIPHER_NONE)
359
360
361 typedef struct wl_led_info {
362 uint32 index; /* led index */
363 uint32 behavior;
364 bool activehi;
365 } wl_led_info_t;
366
367 /*
368 * definitions for driver messages passed from WL to NAS.
369 */
370 /* Use this to recognize wpa and 802.1x driver messages. */
371 static const uint8 wl_wpa_snap_template[] =
372 { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c };
373
374 #define WL_WPA_MSG_IFNAME_MAX 16
375
376 /* WPA driver message */
377 typedef struct wl_wpa_header {
378 struct ether_header eth;
379 struct dot11_llc_snap_header snap;
380 uint8 version;
381 uint8 type;
382 /* version 2 additions */
383 char ifname[WL_WPA_MSG_IFNAME_MAX];
384 /* version specific data */
385 /* uint8 data[1]; */
386 } wl_wpa_header_t PACKED;
387
388 /*
389 * definitions for 802.2 messages passed from WL to NAS.
390 */
391 /* This seems not to be defined outside the kernel on linux. */
392 #ifndef ETH_P_802_2
393 #define ETH_P_802_2 4
394 #endif
395
396 #define WL_WPA_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX)
397
398 /* WPA driver message ethertype - private between wlc and nas */
399 #define WL_WPA_ETHER_TYPE 0x9999
400
401 /* WPA driver message current version */
402 #define WL_WPA_MSG_VERSION 2
403
404 /* Type field values for the 802.2 driver messages for WPA. */
405 #define WLC_ASSOC_MSG 1
406 #define WLC_DISASSOC_MSG 2
407 #define WLC_PTK_MIC_MSG 3
408 #define WLC_GTK_MIC_MSG 4
409
410 /* Use this to recognize 802.2 driver messages. */
411 static const uint8 wpa_snap_template[] =
412 { 0xaa, 0xaa, 0x03, 0x00, 0x90, 0x4c };
413
414
415 /* 802.1x driver message */
416 typedef struct wl_eapol_header {
417 struct ether_header eth;
418 struct dot11_llc_snap_header snap;
419 uint8 version;
420 uint8 reserved;
421 char ifname[WL_WPA_MSG_IFNAME_MAX];
422 /* version specific data */
423 /* uint8 802_1x_msg[1]; */
424 } wl_eapol_header_t PACKED;
425
426 #define WL_EAPOL_HEADER_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN + 2 + WL_WPA_MSG_IFNAME_MAX)
427
428 /* 802.1x driver message ethertype - private between wlc and nas */
429 #define WL_EAPOL_ETHER_TYPE 0x999A
430
431 /* 802.1x driver message current version */
432 #define WL_EAPOL_MSG_VERSION 1
433
434 /* srom read/write struct passed through ioctl */
435 typedef struct {
436 uint byteoff; /* byte offset */
437 uint nbytes; /* number of bytes */
438 uint16 buf[1];
439 } srom_rw_t;
440
441 /* R_REG and W_REG struct passed through ioctl */
442 typedef struct {
443 uint32 byteoff; /* byte offset of the field in d11regs_t */
444 uint32 val; /* read/write value of the field */
445 uint32 size; /* sizeof the field */
446 } rw_reg_t;
447
448 /* Structure used by GET/SET_ATTEN ioctls */
449 typedef struct {
450 uint16 auto_ctrl; /* 1: Automatic control, 0: overriden */
451 uint16 bb; /* Baseband attenuation */
452 uint16 radio; /* Radio attenuation */
453 uint16 txctl1; /* Radio TX_CTL1 value */
454 } atten_t;
455
456 /* Used to get specific STA parameters */
457 typedef struct {
458 uint32 val;
459 struct ether_addr ea;
460 } scb_val_t;
461
462 /* Event data type */
463 typedef struct {
464 uint msg; /* Message (see below) */
465 struct ether_addr *addr; /* Station address (if applicable) */
466 uint status; /* Status code (see below) */
467 uint reason; /* Reason code (if applicable) */
468 uint auth_type; /* WLC_E_AUTH */
469 bool link; /* WLC_E_LINK */
470 bool group; /* WLC_E_MIC_ERROR */
471 bool flush_txq; /* WLC_E_MIC_ERROR */
472 } wlc_event_t;
473
474 typedef struct {
475 uint16 ver; /* version of this struct */
476 uint16 cap; /* sta's advertized capabilities */
477 uint32 flags; /* flags defined below */
478 uint32 idle; /* time since data pkt rx'd from sta */
479 struct ether_addr ea; /* Station address */
480 wl_rateset_t rateset; /* rateset in use */
481 } sta_info_t;
482
483 #define WL_STA_INFO_LEN 300
484 #define WL_STA_VER 1
485
486 /* flags fields */
487 #define WL_STA_BRCM 0x01
488 #define WL_STA_WME 0x02
489 #define WL_STA_ABCAP 0x04
490 #define WL_STA_AUTHE 0x08
491 #define WL_STA_ASSOC 0x10
492 #define WL_STA_AUTHO 0x20
493
494 /* Event messages */
495 #define WLC_E_SET_SSID 1
496 #define WLC_E_JOIN 2
497 #define WLC_E_START 3
498 #define WLC_E_AUTH 4
499 #define WLC_E_AUTH_IND 5
500 #define WLC_E_DEAUTH 6
501 #define WLC_E_DEAUTH_IND 7
502 #define WLC_E_ASSOC 8
503 #define WLC_E_ASSOC_IND 9
504 #define WLC_E_REASSOC 10
505 #define WLC_E_REASSOC_IND 11
506 #define WLC_E_DISASSOC 12
507 #define WLC_E_DISASSOC_IND 13
508 #define WLC_E_QUIET_START 14 /* 802.11h Quiet period started */
509 #define WLC_E_QUIET_END 15 /* 802.11h Quiet period ended */
510 #define WLC_E_GOT_BEACONS 16
511 #define WLC_E_LINK 17 /* Link indication */
512 #define WLC_E_MIC_ERROR 18 /* TKIP MIC error occurred */
513 #define WLC_E_NDIS_LINK 19 /* NDIS style link indication */
514 #define WLC_E_ROAM 20
515 #define WLC_E_LAST 21
516
517 /* Event status codes */
518 #define WLC_E_STATUS_SUCCESS 0
519 #define WLC_E_STATUS_FAIL 1
520 #define WLC_E_STATUS_TIMEOUT 2
521 #define WLC_E_STATUS_NO_NETWORKS 3
522 #define WLC_E_STATUS_ABORT 4
523
524 typedef struct wlc_event_cb {
525 uint msg; /* Event message or 0 for all */
526 void (*fn)(void *, wlc_event_t *); /* Callback function */
527 void *context; /* Passed to callback function */
528 struct wlc_event_cb *next; /* Next in the chain */
529 } wlc_event_cb_t;
530
531 /*
532 * Country locale determines which channels are available to us.
533 */
534 typedef enum _wlc_locale {
535 WLC_WW = 0, /* Worldwide */
536 WLC_THA, /* Thailand */
537 WLC_ISR, /* Israel */
538 WLC_JDN, /* Jordan */
539 WLC_PRC, /* China */
540 WLC_JPN, /* Japan */
541 WLC_FCC, /* USA */
542 WLC_EUR, /* Europe */
543 WLC_USL, /* US Low Band only */
544 WLC_JPH, /* Japan High Band only */
545 WLC_ALL, /* All the channels in this band */
546 WLC_11D, /* Represents locale recieved by 11d beacons */
547 WLC_LAST_LOCALE,
548 WLC_UNDEFINED_LOCALE = 0xf
549 } wlc_locale_t;
550
551 /* channel encoding */
552 typedef struct channel_info {
553 int hw_channel;
554 int target_channel;
555 int scan_channel;
556 } channel_info_t;
557
558 /* For ioctls that take a list of MAC addresses */
559 struct maclist {
560 uint count; /* number of MAC addresses */
561 struct ether_addr ea[1]; /* variable length array of MAC addresses */
562 };
563
564 /* get pkt count struct passed through ioctl */
565 typedef struct get_pktcnt {
566 uint rx_good_pkt;
567 uint rx_bad_pkt;
568 uint tx_good_pkt;
569 uint tx_bad_pkt;
570 } get_pktcnt_t;
571
572 /* Linux network driver ioctl encoding */
573 typedef struct wl_ioctl {
574 uint cmd; /* common ioctl definition */
575 void *buf; /* pointer to user buffer */
576 uint len; /* length of user buffer */
577 bool set; /* get or set request (optional) */
578 uint used; /* bytes read or written (optional) */
579 uint needed; /* bytes needed (optional) */
580 } wl_ioctl_t;
581
582 /*
583 * Structure for passing hardware and software
584 * revision info up from the driver.
585 */
586 typedef struct wlc_rev_info {
587 uint vendorid; /* PCI vendor id */
588 uint deviceid; /* device id of chip */
589 uint radiorev; /* radio revision */
590 uint chiprev; /* chip revision */
591 uint corerev; /* core revision */
592 uint boardid; /* board identifier (usu. PCI sub-device id) */
593 uint boardvendor; /* board vendor (usu. PCI sub-vendor id) */
594 uint boardrev; /* board revision */
595 uint driverrev; /* driver version */
596 uint ucoderev; /* microcode version */
597 uint bus; /* bus type */
598 uint chipnum; /* chip number */
599 } wlc_rev_info_t;
600
601 /* check this magic number */
602 #define WLC_IOCTL_MAGIC 0x14e46c77
603
604 /* bump this number if you change the ioctl interface */
605 #define WLC_IOCTL_VERSION 1
606
607 /* maximum length buffer required */
608 #define WLC_IOCTL_MAXLEN 8192
609
610 /* common ioctl definitions */
611 #define WLC_GET_MAGIC 0
612 #define WLC_GET_VERSION 1
613 #define WLC_UP 2
614 #define WLC_DOWN 3
615 #define WLC_GET_LOOP 4
616 #define WLC_SET_LOOP 5
617 #define WLC_DUMP 6
618 #define WLC_GET_MSGLEVEL 7
619 #define WLC_SET_MSGLEVEL 8
620 #define WLC_GET_PROMISC 9
621 #define WLC_SET_PROMISC 10
622 #define WLC_OBSOLETE 11
623 #define WLC_GET_RATE 12
624 #define WLC_SET_RATE 13
625 #define WLC_GET_INSTANCE 14
626 #define WLC_GET_FRAG 15
627 #define WLC_SET_FRAG 16
628 #define WLC_GET_RTS 17
629 #define WLC_SET_RTS 18
630 #define WLC_GET_INFRA 19
631 #define WLC_SET_INFRA 20
632 #define WLC_GET_AUTH 21
633 #define WLC_SET_AUTH 22
634 #define WLC_GET_BSSID 23
635 #define WLC_SET_BSSID 24
636 #define WLC_GET_SSID 25
637 #define WLC_SET_SSID 26
638 #define WLC_RESTART 27
639 #define WLC_DUMP_SCB 28
640 #define WLC_GET_CHANNEL 29
641 #define WLC_SET_CHANNEL 30
642 #define WLC_GET_SRL 31
643 #define WLC_SET_SRL 32
644 #define WLC_GET_LRL 33
645 #define WLC_SET_LRL 34
646 #define WLC_GET_PLCPHDR 35
647 #define WLC_SET_PLCPHDR 36
648 #define WLC_GET_RADIO 37
649 #define WLC_SET_RADIO 38
650 #define WLC_GET_PHYTYPE 39
651 #define WLC_DUMP_RATE 40
652 #define WLC_SET_RATE_PARAMS 41
653 #define WLC_GET_WEP 42
654 #define WLC_SET_WEP 43
655 #define WLC_GET_KEY 44
656 #define WLC_SET_KEY 45
657 #define WLC_GET_REGULATORY 46
658 #define WLC_SET_REGULATORY 47
659 #define WLC_GET_PASSIVE 48 /* added by nbd */
660 #define WLC_SET_PASSIVE 49 /* added by nbd */
661 #define WLC_SCAN 50
662 #define WLC_SCAN_RESULTS 51
663 #define WLC_DISASSOC 52
664 #define WLC_REASSOC 53
665 #define WLC_GET_ROAM_TRIGGER 54
666 #define WLC_SET_ROAM_TRIGGER 55
667 #define WLC_GET_ROAM_DELTA 56
668 #define WLC_SET_ROAM_DELTA 57
669 #define WLC_GET_ROAM_SCAN_PERIOD 58
670 #define WLC_SET_ROAM_SCAN_PERIOD 59
671 #define WLC_EVM 60
672 #define WLC_GET_TXANT 61
673 #define WLC_SET_TXANT 62
674 #define WLC_GET_ANTDIV 63
675 #define WLC_SET_ANTDIV 64
676 #define WLC_GET_TXPWR 65
677 #define WLC_SET_TXPWR 66
678 #define WLC_GET_CLOSED 67
679 #define WLC_SET_CLOSED 68
680 #define WLC_GET_MACLIST 69
681 #define WLC_SET_MACLIST 70
682 #define WLC_GET_RATESET 71
683 #define WLC_SET_RATESET 72
684 #define WLC_GET_LOCALE 73
685 #define WLC_SET_LOCALE 74
686 #define WLC_GET_BCNPRD 75
687 #define WLC_SET_BCNPRD 76
688 #define WLC_GET_DTIMPRD 77
689 #define WLC_SET_DTIMPRD 78
690 #define WLC_GET_SROM 79
691 #define WLC_SET_SROM 80
692 #define WLC_GET_WEP_RESTRICT 81
693 #define WLC_SET_WEP_RESTRICT 82
694 #define WLC_GET_COUNTRY 83
695 #define WLC_SET_COUNTRY 84
696 #define WLC_GET_PM 85
697 #define WLC_SET_PM 86
698 #define WLC_GET_WAKE 87
699 #define WLC_SET_WAKE 88
700 #define WLC_GET_D11CNTS 89
701 #define WLC_GET_FORCELINK 90 /* ndis only */
702 #define WLC_SET_FORCELINK 91 /* ndis only */
703 #define WLC_FREQ_ACCURACY 92
704 #define WLC_CARRIER_SUPPRESS 93
705 #define WLC_GET_PHYREG 94
706 #define WLC_SET_PHYREG 95
707 #define WLC_GET_RADIOREG 96
708 #define WLC_SET_RADIOREG 97
709 #define WLC_GET_REVINFO 98
710 #define WLC_GET_UCANTDIV 99
711 #define WLC_SET_UCANTDIV 100
712 #define WLC_R_REG 101
713 #define WLC_W_REG 102
714 #define WLC_DIAG_LOOPBACK 103
715 #define WLC_RESET_D11CNTS 104
716 #define WLC_GET_MACMODE 105
717 #define WLC_SET_MACMODE 106
718 #define WLC_GET_MONITOR 107 /* added by nbd */
719 #define WLC_SET_MONITOR 108 /* added by nbd */
720 #define WLC_GET_GMODE 109
721 #define WLC_SET_GMODE 110
722 #define WLC_GET_LEGACY_ERP 111
723 #define WLC_SET_LEGACY_ERP 112
724 #define WLC_GET_RX_ANT 113
725 #define WLC_GET_CURR_RATESET 114 /* current rateset */
726 #define WLC_GET_SCANSUPPRESS 115
727 #define WLC_SET_SCANSUPPRESS 116
728 #define WLC_GET_AP 117
729 #define WLC_SET_AP 118
730 #define WLC_GET_EAP_RESTRICT 119
731 #define WLC_SET_EAP_RESTRICT 120
732 #define WLC_SCB_AUTHORIZE 121
733 #define WLC_SCB_DEAUTHORIZE 122
734 #define WLC_GET_WDSLIST 123
735 #define WLC_SET_WDSLIST 124
736 #define WLC_GET_ATIM 125
737 #define WLC_SET_ATIM 126
738 #define WLC_GET_RSSI 127
739 #define WLC_GET_PHYANTDIV 128
740 #define WLC_SET_PHYANTDIV 129
741 #define WLC_AP_RX_ONLY 130
742 #define WLC_GET_TX_PATH_PWR 131
743 #define WLC_SET_TX_PATH_PWR 132
744 #define WLC_GET_WSEC 133
745 #define WLC_SET_WSEC 134
746 #define WLC_GET_PHY_NOISE 135
747 #define WLC_GET_BSS_INFO 136
748 #define WLC_GET_PKTCNTS 137
749 #define WLC_GET_LAZYWDS 138
750 #define WLC_SET_LAZYWDS 139
751 #define WLC_GET_BANDLIST 140
752 #define WLC_GET_BAND 141
753 #define WLC_SET_BAND 142
754 #define WLC_SCB_DEAUTHENTICATE 143
755 #define WLC_GET_SHORTSLOT 144
756 #define WLC_GET_SHORTSLOT_OVERRIDE 145
757 #define WLC_SET_SHORTSLOT_OVERRIDE 146
758 #define WLC_GET_SHORTSLOT_RESTRICT 147
759 #define WLC_SET_SHORTSLOT_RESTRICT 148
760 #define WLC_GET_GMODE_PROTECTION 149
761 #define WLC_GET_GMODE_PROTECTION_OVERRIDE 150
762 #define WLC_SET_GMODE_PROTECTION_OVERRIDE 151
763 #define WLC_UPGRADE 152
764 #define WLC_GET_MRATE 153
765 #define WLC_SET_MRATE 154
766 #define WLC_GET_IGNORE_BCNS 155
767 #define WLC_SET_IGNORE_BCNS 156
768 #define WLC_GET_SCB_TIMEOUT 157
769 #define WLC_SET_SCB_TIMEOUT 158
770 #define WLC_GET_ASSOCLIST 159
771 #define WLC_GET_CLK 160
772 #define WLC_SET_CLK 161
773 #define WLC_GET_UP 162
774 #define WLC_OUT 163
775 #define WLC_GET_WPA_AUTH 164
776 #define WLC_SET_WPA_AUTH 165
777 #define WLC_GET_UCFLAGS 166
778 #define WLC_SET_UCFLAGS 167
779 #define WLC_GET_PWRIDX 168
780 #define WLC_SET_PWRIDX 169
781 #define WLC_GET_TSSI 170
782 #define WLC_GET_SUP_RATESET_OVERRIDE 171
783 #define WLC_SET_SUP_RATESET_OVERRIDE 172
784 #define WLC_SET_FAST_TIMER 173
785 #define WLC_GET_FAST_TIMER 174
786 #define WLC_SET_SLOW_TIMER 175
787 #define WLC_GET_SLOW_TIMER 176
788 #define WLC_DUMP_PHYREGS 177
789 #define WLC_GET_GMODE_PROTECTION_CONTROL 178
790 #define WLC_SET_GMODE_PROTECTION_CONTROL 179
791 #define WLC_GET_PHYLIST 180
792 #define WLC_ENCRYPT_STRENGTH 181 /* ndis only */
793 #define WLC_DECRYPT_STATUS 182 /* ndis only */
794 #define WLC_GET_KEY_SEQ 183
795 #define WLC_GET_SCAN_CHANNEL_TIME 184
796 #define WLC_SET_SCAN_CHANNEL_TIME 185
797 #define WLC_GET_SCAN_UNASSOC_TIME 186
798 #define WLC_SET_SCAN_UNASSOC_TIME 187
799 #define WLC_GET_SCAN_HOME_TIME 188
800 #define WLC_SET_SCAN_HOME_TIME 189
801 #define WLC_GET_SCAN_PASSES 190
802 #define WLC_SET_SCAN_PASSES 191
803 #define WLC_GET_PRB_RESP_TIMEOUT 192
804 #define WLC_SET_PRB_RESP_TIMEOUT 193
805 #define WLC_GET_ATTEN 194
806 #define WLC_SET_ATTEN 195
807 #define WLC_GET_SHMEM 196 /* diag */
808 #define WLC_SET_SHMEM 197 /* diag */
809 #define WLC_GET_GMODE_PROTECTION_CTS 198
810 #define WLC_SET_GMODE_PROTECTION_CTS 199
811 #define WLC_SET_TKIP_MIC_FLAG 200
812 #define WLC_SCB_DEAUTHENTICATE_FOR_REASON 201
813 #define WLC_TKIP_COUNTERMEASURES 202
814 #define WLC_GET_PIOMODE 203
815 #define WLC_SET_PIOMODE 204
816 #define WLC_SET_LED 209
817 #define WLC_GET_LED 210
818 #define WLC_GET_INTERFERENCE_MODE 211
819 #define WLC_SET_INTERFERENCE_MODE 212
820 #define WLC_GET_CHANNEL_QA 213
821 #define WLC_START_CHANNEL_QA 214
822 #define WLC_GET_CHANNEL_SEL 215
823 #define WLC_START_CHANNEL_SEL 216
824 #define WLC_GET_VALID_CHANNELS 217
825 #define WLC_GET_FAKEFRAG 218
826 #define WLC_SET_FAKEFRAG 219
827 #define WLC_GET_PWROUT_PERCENTAGE 220
828 #define WLC_SET_PWROUT_PERCENTAGE 221
829 #define WLC_SET_BAD_FRAME_PREEMPT 222
830 #define WLC_GET_BAD_FRAME_PREEMPT 223
831 #define WLC_SET_LEAP_LIST 224
832 #define WLC_GET_LEAP_LIST 225
833 #define WLC_GET_CWMIN 226
834 #define WLC_SET_CWMIN 227
835 #define WLC_GET_CWMAX 228
836 #define WLC_SET_CWMAX 229
837 #define WLC_GET_WET 230
838 #define WLC_SET_WET 231
839 #define WLC_GET_KEY_PRIMARY 235
840 #define WLC_SET_KEY_PRIMARY 236
841 #define WLC_WDS_GET_REMOTE_HWADDR 246 /* currently handled in wl_linux.c/wl_vx.c */
842 #define WLC_SET_CS_SCAN_TIMER 248
843 #define WLC_GET_CS_SCAN_TIMER 249
844 #define WLC_CURRENT_PWR 256
845 #define WLC_GET_CHANNELS_IN_COUNTRY 260
846 #define WLC_GET_COUNTRY_LIST 261
847 #define WLC_GET_VAR 262 /* get value of named variable */
848 #define WLC_SET_VAR 263 /* set named variable to value */
849 #define WLC_NVRAM_GET 264
850 #define WLC_NVRAM_SET 265
851 #define WLC_SET_WSEC_PMK 268
852 #define WLC_GET_AUTH_MODE 269
853 #define WLC_SET_AUTH_MODE 270
854 #define WLC_LAST 273 /* do not change - use get_var/set_var */
855
856 /*
857 * Minor kludge alert:
858 * Duplicate a few definitions that irelay requires from epiioctl.h here
859 * so caller doesn't have to include this file and epiioctl.h .
860 * If this grows any more, it would be time to move these irelay-specific
861 * definitions out of the epiioctl.h and into a separate driver common file.
862 */
863 #ifndef EPICTRL_COOKIE
864 #define EPICTRL_COOKIE 0xABADCEDE
865 #endif
866
867 /* vx wlc ioctl's offset */
868 #define CMN_IOCTL_OFF 0x180
869
870 /*
871 * custom OID support
872 *
873 * 0xFF - implementation specific OID
874 * 0xE4 - first byte of Broadcom PCI vendor ID
875 * 0x14 - second byte of Broadcom PCI vendor ID
876 * 0xXX - the custom OID number
877 */
878
879 /* begin 0x1f values beyond the start of the ET driver range. */
880 #define WL_OID_BASE 0xFFE41420
881
882 /* NDIS overrides */
883 #define OID_WL_GETINSTANCE (WL_OID_BASE + WLC_GET_INSTANCE)
884 #define OID_WL_GET_FORCELINK (WL_OID_BASE + WLC_GET_FORCELINK)
885 #define OID_WL_SET_FORCELINK (WL_OID_BASE + WLC_SET_FORCELINK)
886 #define OID_WL_ENCRYPT_STRENGTH (WL_OID_BASE + WLC_ENCRYPT_STRENGTH)
887 #define OID_WL_DECRYPT_STATUS (WL_OID_BASE + WLC_DECRYPT_STATUS)
888
889 #define WL_DECRYPT_STATUS_SUCCESS 1
890 #define WL_DECRYPT_STATUS_FAILURE 2
891 #define WL_DECRYPT_STATUS_UNKNOWN 3
892
893 /* allows user-mode app to poll the status of USB image upgrade */
894 #define WLC_UPGRADE_SUCCESS 0
895 #define WLC_UPGRADE_PENDING 1
896
897 /* Bit masks for radio disabled status - returned by WL_GET_RADIO */
898 #define WL_RADIO_SW_DISABLE (1<<0)
899 #define WL_RADIO_HW_DISABLE (1<<1)
900
901 /* Override bit for WLC_SET_TXPWR. if set, ignore other level limits */
902 #define WL_TXPWR_OVERRIDE (1<<31)
903
904
905 /* Bus types */
906 #define WL_SB_BUS 0 /* Silicon Backplane */
907 #define WL_PCI_BUS 1 /* PCI target */
908 #define WL_PCMCIA_BUS 2 /* PCMCIA target */
909
910 /* band types */
911 #define WLC_BAND_AUTO 0 /* auto-select */
912 #define WLC_BAND_A 1 /* "a" band (5 Ghz) */
913 #define WLC_BAND_B 2 /* "b" band (2.4 Ghz) */
914
915 /* MAC list modes */
916 #define WLC_MACMODE_DISABLED 0 /* MAC list disabled */
917 #define WLC_MACMODE_DENY 1 /* Deny specified (i.e. allow unspecified) */
918 #define WLC_MACMODE_ALLOW 2 /* Allow specified (i.e. deny unspecified) */
919
920
921 /* 54g modes (basic bits may still be overridden) */
922 #define GMODE_LEGACY_B 0 /* Rateset: 1b, 2b, 5.5, 11 */
923 /* Preamble: Long */
924 /* Shortslot: Off */
925 #define GMODE_AUTO 1 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 */
926 /* Extended Rateset: 6, 9, 12, 48 */
927 /* Preamble: Long */
928 /* Shortslot: Auto */
929 #define GMODE_ONLY 2 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24b, 36, 54 */
930 /* Extended Rateset: 6b, 9, 12b, 48 */
931 /* Preamble: Short required */
932 /* Shortslot: Auto */
933 #define GMODE_B_DEFERRED 3 /* Rateset: 1b, 2b, 5.5b, 11b, 18, 24, 36, 54 */
934 /* Extended Rateset: 6, 9, 12, 48 */
935 /* Preamble: Long */
936 /* Shortslot: On */
937 #define GMODE_PERFORMANCE 4 /* Rateset: 1b, 2b, 5.5b, 6b, 9, 11b, 12b, 18, 24b, 36, 48, 54 */
938 /* Preamble: Short required */
939 /* Shortslot: On and required */
940 #define GMODE_LRS 5 /* Rateset: 1b, 2b, 5.5b, 11b */
941 /* Extended Rateset: 6, 9, 12, 18, 24, 36, 48, 54 */
942 /* Preamble: Long */
943 /* Shortslot: Auto */
944 #define GMODE_MAX 6
945
946
947 /* values for PLCPHdr_override */
948 #define WLC_PLCP_AUTO -1
949 #define WLC_PLCP_SHORT 0
950 #define WLC_PLCP_LONG 1
951
952 /* values for g_protection_override */
953 #define WLC_G_PROTECTION_AUTO -1
954 #define WLC_G_PROTECTION_OFF 0
955 #define WLC_G_PROTECTION_ON 1
956
957 /* values for g_protection_control */
958 #define WLC_G_PROTECTION_CTL_OFF 0
959 #define WLC_G_PROTECTION_CTL_LOCAL 1
960 #define WLC_G_PROTECTION_CTL_OVERLAP 2
961
962 /* Values for PM */
963 #define PM_OFF 0
964 #define PM_MAX 1
965 #define PM_FAST 2
966
967 /* interference mitigation options */
968 #define INTERFERE_NONE 0 /* off */
969 #define NON_WLAN 1 /* foreign/non 802.11 interference, no auto detect */
970 #define WLAN_MANUAL 2 /* ACI: no auto detection */
971 #define WLAN_AUTO 3 /* ACI: auto - detact */
972
973 /* Message levels */
974 #define WL_ERROR_VAL 0x0001
975 #define WL_TRACE_VAL 0x0002
976 #define WL_PRHDRS_VAL 0x0004
977 #define WL_PRPKT_VAL 0x0008
978 #define WL_INFORM_VAL 0x0010
979 #define WL_TMP_VAL 0x0020
980 #define WL_OID_VAL 0x0040
981 #define WL_RATE_VAL 0x0080
982 #define WL_ASSOC_VAL 0x0100
983 #define WL_PRUSR_VAL 0x0200
984 #define WL_PS_VAL 0x0400
985 #define WL_TXPWR_VAL 0x0800
986 #define WL_GMODE_VAL 0x1000
987 #define WL_DUAL_VAL 0x2000
988 #define WL_WSEC_VAL 0x4000
989 #define WL_WSEC_DUMP_VAL 0x8000
990 #define WL_LOG_VAL 0x10000
991 #define WL_NRSSI_VAL 0x20000
992 #define WL_LOFT_VAL 0x40000
993 #define WL_REGULATORY_VAL 0x80000
994 #define WL_ACI_VAL 0x100000
995
996
997 /* 802.11h enforcement levels */
998 #define SPECT_MNGMT_OFF 0 /* 11h disabled */
999 #define SPECT_MNGMT_LOOSE 1 /* Allow scan lists to contain non-11h AP */
1000 /* when 11h is enabled */
1001 #define SPECT_MNGMT_STRICT 2 /* Prine out non-11h APs from scan list */
1002
1003
1004
1005 /* max # of leds supported by GPIO (gpio pin# == led index#) */
1006 #define WL_LED_NUMGPIO 16 /* gpio 0-15 */
1007
1008 /* led per-pin behaviors */
1009 #define WL_LED_OFF 0 /* always off */
1010 #define WL_LED_ON 1 /* always on */
1011 #define WL_LED_ACTIVITY 2 /* activity */
1012 #define WL_LED_RADIO 3 /* radio enabled */
1013 #define WL_LED_ARADIO 4 /* 5 Ghz radio enabled */
1014 #define WL_LED_BRADIO 5 /* 2.4Ghz radio enabled */
1015 #define WL_LED_BGMODE 6 /* on if gmode, off if bmode */
1016 #define WL_LED_WI1 7
1017 #define WL_LED_WI2 8
1018 #define WL_LED_WI3 9
1019 #define WL_LED_ASSOC 10 /* associated state indicator */
1020 #define WL_LED_INACTIVE 11 /* null behavior (clears default behavior) */
1021 #define WL_LED_NUMBEHAVIOR 12
1022
1023 /* led behavior numeric value format */
1024 #define WL_LED_BEH_MASK 0x7f /* behavior mask */
1025 #define WL_LED_AL_MASK 0x80 /* activelow (polarity) bit */
1026
1027
1028 /* maximum channels */
1029 #define WL_NUMCHANNELS 64 /* max # of channels in the band */
1030
1031 /* rate check */
1032 #define WL_RATE_OFDM(r) (((r) & 0x7f) == 12 || ((r) & 0x7f) == 18 || \
1033 ((r) & 0x7f) == 24 || ((r) & 0x7f) == 36 || \
1034 ((r) & 0x7f) == 48 || ((r) & 0x7f) == 72 || \
1035 ((r) & 0x7f) == 96 || ((r) & 0x7f) == 108)
1036
1037 /* WDS link local endpoint WPA role */
1038 #define WL_WDS_WPA_ROLE_AUTH 0 /* authenticator */
1039 #define WL_WDS_WPA_ROLE_SUP 1 /* supplicant */
1040 #define WL_WDS_WPA_ROLE_AUTO 255 /* auto, based on mac addr value */
1041
1042 /* afterburner_override */
1043 #define ABO_AUTO -1 /* auto - no override */
1044 #define ABO_OFF 0 /* force afterburner off */
1045 #define ABO_ON 1 /* force afterburner on */
1046
1047 #undef PACKED
1048
1049 #endif /* _wlioctl_h_ */