Staging: Add initial release of brcm80211 - Broadcom 802.11n wireless LAN driver.
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / brcm80211 / include / proto / 802.11.h
1 /*
2 * Copyright (c) 2010 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef _802_11_H_
18 #define _802_11_H_
19
20 #ifndef _TYPEDEFS_H_
21 #include <typedefs.h>
22 #endif
23
24 #ifndef _NET_ETHERNET_H_
25 #include <proto/ethernet.h>
26 #endif
27
28 #include <proto/wpa.h>
29
30 #include <packed_section_start.h>
31
32 #define DOT11_TU_TO_US 1024
33
34 #define DOT11_A3_HDR_LEN 24
35 #define DOT11_A4_HDR_LEN 30
36 #define DOT11_MAC_HDR_LEN DOT11_A3_HDR_LEN
37 #define DOT11_FCS_LEN 4
38 #define DOT11_ICV_LEN 4
39 #define DOT11_ICV_AES_LEN 8
40 #define DOT11_QOS_LEN 2
41 #define DOT11_HTC_LEN 4
42
43 #define DOT11_KEY_INDEX_SHIFT 6
44 #define DOT11_IV_LEN 4
45 #define DOT11_IV_TKIP_LEN 8
46 #define DOT11_IV_AES_OCB_LEN 4
47 #define DOT11_IV_AES_CCM_LEN 8
48 #define DOT11_IV_MAX_LEN 8
49
50 #define DOT11_MAX_MPDU_BODY_LEN 2304
51
52 #define DOT11_MAX_MPDU_LEN (DOT11_A4_HDR_LEN + \
53 DOT11_QOS_LEN + \
54 DOT11_IV_AES_CCM_LEN + \
55 DOT11_MAX_MPDU_BODY_LEN + \
56 DOT11_ICV_LEN + \
57 DOT11_FCS_LEN)
58
59 #define DOT11_MAX_SSID_LEN 32
60
61 #define DOT11_DEFAULT_RTS_LEN 2347
62 #define DOT11_MAX_RTS_LEN 2347
63
64 #define DOT11_MIN_FRAG_LEN 256
65 #define DOT11_MAX_FRAG_LEN 2346
66 #define DOT11_DEFAULT_FRAG_LEN 2346
67
68 #define DOT11_MIN_BEACON_PERIOD 1
69 #define DOT11_MAX_BEACON_PERIOD 0xFFFF
70
71 #define DOT11_MIN_DTIM_PERIOD 1
72 #define DOT11_MAX_DTIM_PERIOD 0xFF
73
74 #define DOT11_LLC_SNAP_HDR_LEN 8
75 #define DOT11_OUI_LEN 3
76 BWL_PRE_PACKED_STRUCT struct dot11_llc_snap_header {
77 uint8 dsap;
78 uint8 ssap;
79 uint8 ctl;
80 uint8 oui[DOT11_OUI_LEN];
81 uint16 type;
82 } BWL_POST_PACKED_STRUCT;
83
84 #define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN)
85
86 BWL_PRE_PACKED_STRUCT struct dot11_header {
87 uint16 fc;
88 uint16 durid;
89 struct ether_addr a1;
90 struct ether_addr a2;
91 struct ether_addr a3;
92 uint16 seq;
93 struct ether_addr a4;
94 } BWL_POST_PACKED_STRUCT;
95
96 BWL_PRE_PACKED_STRUCT struct dot11_rts_frame {
97 uint16 fc;
98 uint16 durid;
99 struct ether_addr ra;
100 struct ether_addr ta;
101 } BWL_POST_PACKED_STRUCT;
102 #define DOT11_RTS_LEN 16
103
104 BWL_PRE_PACKED_STRUCT struct dot11_cts_frame {
105 uint16 fc;
106 uint16 durid;
107 struct ether_addr ra;
108 } BWL_POST_PACKED_STRUCT;
109 #define DOT11_CTS_LEN 10
110
111 BWL_PRE_PACKED_STRUCT struct dot11_ack_frame {
112 uint16 fc;
113 uint16 durid;
114 struct ether_addr ra;
115 } BWL_POST_PACKED_STRUCT;
116 #define DOT11_ACK_LEN 10
117
118 BWL_PRE_PACKED_STRUCT struct dot11_ps_poll_frame {
119 uint16 fc;
120 uint16 durid;
121 struct ether_addr bssid;
122 struct ether_addr ta;
123 } BWL_POST_PACKED_STRUCT;
124 #define DOT11_PS_POLL_LEN 16
125
126 BWL_PRE_PACKED_STRUCT struct dot11_cf_end_frame {
127 uint16 fc;
128 uint16 durid;
129 struct ether_addr ra;
130 struct ether_addr bssid;
131 } BWL_POST_PACKED_STRUCT;
132 #define DOT11_CS_END_LEN 16
133
134 BWL_PRE_PACKED_STRUCT struct dot11_action_wifi_vendor_specific {
135 uint8 category;
136 uint8 OUI[3];
137 uint8 type;
138 uint8 subtype;
139 uint8 data[1040];
140 } BWL_POST_PACKED_STRUCT;
141 typedef struct dot11_action_wifi_vendor_specific
142 dot11_action_wifi_vendor_specific_t;
143
144 BWL_PRE_PACKED_STRUCT struct dot11_action_vs_frmhdr {
145 uint8 category;
146 uint8 OUI[3];
147 uint8 type;
148 uint8 subtype;
149 uint8 data[1];
150 } BWL_POST_PACKED_STRUCT;
151 typedef struct dot11_action_vs_frmhdr dot11_action_vs_frmhdr_t;
152 #define DOT11_ACTION_VS_HDR_LEN 6
153
154 #define BCM_ACTION_OUI_BYTE0 0x00
155 #define BCM_ACTION_OUI_BYTE1 0x90
156 #define BCM_ACTION_OUI_BYTE2 0x4c
157
158 #define DOT11_BA_CTL_POLICY_NORMAL 0x0000
159 #define DOT11_BA_CTL_POLICY_NOACK 0x0001
160 #define DOT11_BA_CTL_POLICY_MASK 0x0001
161
162 #define DOT11_BA_CTL_MTID 0x0002
163 #define DOT11_BA_CTL_COMPRESSED 0x0004
164
165 #define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0
166 #define DOT11_BA_CTL_NUMMSDU_SHIFT 6
167
168 #define DOT11_BA_CTL_TID_MASK 0xF000
169 #define DOT11_BA_CTL_TID_SHIFT 12
170
171 BWL_PRE_PACKED_STRUCT struct dot11_ctl_header {
172 uint16 fc;
173 uint16 durid;
174 struct ether_addr ra;
175 struct ether_addr ta;
176 } BWL_POST_PACKED_STRUCT;
177 #define DOT11_CTL_HDR_LEN 16
178
179 BWL_PRE_PACKED_STRUCT struct dot11_bar {
180 uint16 bar_control;
181 uint16 seqnum;
182 } BWL_POST_PACKED_STRUCT;
183 #define DOT11_BAR_LEN 4
184
185 #define DOT11_BA_BITMAP_LEN 128
186 #define DOT11_BA_CMP_BITMAP_LEN 8
187
188 BWL_PRE_PACKED_STRUCT struct dot11_ba {
189 uint16 ba_control;
190 uint16 seqnum;
191 uint8 bitmap[DOT11_BA_BITMAP_LEN];
192 } BWL_POST_PACKED_STRUCT;
193 #define DOT11_BA_LEN 4
194
195 BWL_PRE_PACKED_STRUCT struct dot11_management_header {
196 uint16 fc;
197 uint16 durid;
198 struct ether_addr da;
199 struct ether_addr sa;
200 struct ether_addr bssid;
201 uint16 seq;
202 } BWL_POST_PACKED_STRUCT;
203 #define DOT11_MGMT_HDR_LEN 24
204
205 BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb {
206 uint32 timestamp[2];
207 uint16 beacon_interval;
208 uint16 capability;
209 } BWL_POST_PACKED_STRUCT;
210 #define DOT11_BCN_PRB_LEN 12
211 #define DOT11_BCN_PRB_FIXED_LEN 12
212
213 BWL_PRE_PACKED_STRUCT struct dot11_auth {
214 uint16 alg;
215 uint16 seq;
216 uint16 status;
217 } BWL_POST_PACKED_STRUCT;
218 #define DOT11_AUTH_FIXED_LEN 6
219
220 BWL_PRE_PACKED_STRUCT struct dot11_assoc_req {
221 uint16 capability;
222 uint16 listen;
223 } BWL_POST_PACKED_STRUCT;
224 #define DOT11_ASSOC_REQ_FIXED_LEN 4
225
226 BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req {
227 uint16 capability;
228 uint16 listen;
229 struct ether_addr ap;
230 } BWL_POST_PACKED_STRUCT;
231 #define DOT11_REASSOC_REQ_FIXED_LEN 10
232
233 BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp {
234 uint16 capability;
235 uint16 status;
236 uint16 aid;
237 } BWL_POST_PACKED_STRUCT;
238 #define DOT11_ASSOC_RESP_FIXED_LEN 6
239
240 BWL_PRE_PACKED_STRUCT struct dot11_action_measure {
241 uint8 category;
242 uint8 action;
243 uint8 token;
244 uint8 data[1];
245 } BWL_POST_PACKED_STRUCT;
246 #define DOT11_ACTION_MEASURE_LEN 3
247
248 BWL_PRE_PACKED_STRUCT struct dot11_action_ht_ch_width {
249 uint8 category;
250 uint8 action;
251 uint8 ch_width;
252 } BWL_POST_PACKED_STRUCT;
253
254 BWL_PRE_PACKED_STRUCT struct dot11_action_ht_mimops {
255 uint8 category;
256 uint8 action;
257 uint8 control;
258 } BWL_POST_PACKED_STRUCT;
259
260 #define SM_PWRSAVE_ENABLE 1
261 #define SM_PWRSAVE_MODE 2
262
263 BWL_PRE_PACKED_STRUCT struct dot11_power_cnst {
264 uint8 id;
265 uint8 len;
266 uint8 power;
267 } BWL_POST_PACKED_STRUCT;
268 typedef struct dot11_power_cnst dot11_power_cnst_t;
269
270 BWL_PRE_PACKED_STRUCT struct dot11_power_cap {
271 uint8 min;
272 uint8 max;
273 } BWL_POST_PACKED_STRUCT;
274 typedef struct dot11_power_cap dot11_power_cap_t;
275
276 BWL_PRE_PACKED_STRUCT struct dot11_tpc_rep {
277 uint8 id;
278 uint8 len;
279 uint8 tx_pwr;
280 uint8 margin;
281 } BWL_POST_PACKED_STRUCT;
282 typedef struct dot11_tpc_rep dot11_tpc_rep_t;
283 #define DOT11_MNG_IE_TPC_REPORT_LEN 2
284
285 BWL_PRE_PACKED_STRUCT struct dot11_supp_channels {
286 uint8 id;
287 uint8 len;
288 uint8 first_channel;
289 uint8 num_channels;
290 } BWL_POST_PACKED_STRUCT;
291 typedef struct dot11_supp_channels dot11_supp_channels_t;
292
293 BWL_PRE_PACKED_STRUCT struct dot11_extch {
294 uint8 id;
295 uint8 len;
296 uint8 extch;
297 } BWL_POST_PACKED_STRUCT;
298 typedef struct dot11_extch dot11_extch_ie_t;
299
300 BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
301 uint8 id;
302 uint8 len;
303 uint8 oui[3];
304 uint8 type;
305 uint8 extch;
306 } BWL_POST_PACKED_STRUCT;
307 typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t;
308
309 #define DOT11_EXTCH_IE_LEN 1
310 #define DOT11_EXT_CH_MASK 0x03
311 #define DOT11_EXT_CH_UPPER 0x01
312 #define DOT11_EXT_CH_LOWER 0x03
313 #define DOT11_EXT_CH_NONE 0x00
314
315 BWL_PRE_PACKED_STRUCT struct dot11_action_frmhdr {
316 uint8 category;
317 uint8 action;
318 uint8 data[1];
319 } BWL_POST_PACKED_STRUCT;
320 #define DOT11_ACTION_FRMHDR_LEN 2
321
322 BWL_PRE_PACKED_STRUCT struct dot11_channel_switch {
323 uint8 id;
324 uint8 len;
325 uint8 mode;
326 uint8 channel;
327 uint8 count;
328 } BWL_POST_PACKED_STRUCT;
329 typedef struct dot11_channel_switch dot11_chan_switch_ie_t;
330
331 #define DOT11_SWITCH_IE_LEN 3
332
333 #define DOT11_CSA_MODE_ADVISORY 0
334 #define DOT11_CSA_MODE_NO_TX 1
335
336 BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel {
337 uint8 category;
338 uint8 action;
339 dot11_chan_switch_ie_t chan_switch_ie;
340 dot11_brcm_extch_ie_t extch_ie;
341 } BWL_POST_PACKED_STRUCT;
342
343 BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
344 uint8 mode;
345 uint8 reg;
346 uint8 channel;
347 uint8 count;
348 } BWL_POST_PACKED_STRUCT;
349
350 BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
351 uint8 id;
352 uint8 len;
353 struct dot11_csa_body b;
354 } BWL_POST_PACKED_STRUCT;
355 typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
356 #define DOT11_EXT_CSA_IE_LEN 4
357
358 BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa {
359 uint8 category;
360 uint8 action;
361 dot11_ext_csa_ie_t chan_switch_ie;
362 } BWL_POST_PACKED_STRUCT;
363
364 BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
365 uint8 category;
366 uint8 action;
367 struct dot11_csa_body b;
368 } BWL_POST_PACKED_STRUCT;
369
370 BWL_PRE_PACKED_STRUCT struct dot11_obss_coex {
371 uint8 id;
372 uint8 len;
373 uint8 info;
374 } BWL_POST_PACKED_STRUCT;
375 typedef struct dot11_obss_coex dot11_obss_coex_t;
376 #define DOT11_OBSS_COEXINFO_LEN 1
377
378 #define DOT11_OBSS_COEX_INFO_REQ 0x01
379 #define DOT11_OBSS_COEX_40MHZ_INTOLERANT 0x02
380 #define DOT11_OBSS_COEX_20MHZ_WIDTH_REQ 0x04
381
382 BWL_PRE_PACKED_STRUCT struct dot11_obss_chanlist {
383 uint8 id;
384 uint8 len;
385 uint8 regclass;
386 uint8 chanlist[1];
387 } BWL_POST_PACKED_STRUCT;
388 typedef struct dot11_obss_chanlist dot11_obss_chanlist_t;
389 #define DOT11_OBSS_CHANLIST_FIXED_LEN 1
390
391 BWL_PRE_PACKED_STRUCT struct dot11_extcap_ie {
392 uint8 id;
393 uint8 len;
394 uint8 cap;
395 } BWL_POST_PACKED_STRUCT;
396 typedef struct dot11_extcap_ie dot11_extcap_ie_t;
397 #define DOT11_EXTCAP_LEN 1
398
399 #define DOT11_MEASURE_TYPE_BASIC 0
400 #define DOT11_MEASURE_TYPE_CCA 1
401 #define DOT11_MEASURE_TYPE_RPI 2
402 #define DOT11_MEASURE_TYPE_CHLOAD 3
403 #define DOT11_MEASURE_TYPE_NOISE 4
404 #define DOT11_MEASURE_TYPE_BEACON 5
405 #define DOT11_MEASURE_TYPE_FRAME 6
406 #define DOT11_MEASURE_TYPE_STATS 7
407 #define DOT11_MEASURE_TYPE_LCI 8
408 #define DOT11_MEASURE_TYPE_TXSTREAM 9
409 #define DOT11_MEASURE_TYPE_PAUSE 255
410
411 #define DOT11_MEASURE_MODE_PARALLEL (1<<0)
412 #define DOT11_MEASURE_MODE_ENABLE (1<<1)
413 #define DOT11_MEASURE_MODE_REQUEST (1<<2)
414 #define DOT11_MEASURE_MODE_REPORT (1<<3)
415 #define DOT11_MEASURE_MODE_DUR (1<<4)
416
417 #define DOT11_MEASURE_MODE_LATE (1<<0)
418 #define DOT11_MEASURE_MODE_INCAPABLE (1<<1)
419 #define DOT11_MEASURE_MODE_REFUSED (1<<2)
420
421 #define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0))
422 #define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1))
423 #define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2))
424 #define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3))
425 #define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4))
426
427 BWL_PRE_PACKED_STRUCT struct dot11_meas_req {
428 uint8 id;
429 uint8 len;
430 uint8 token;
431 uint8 mode;
432 uint8 type;
433 uint8 channel;
434 uint8 start_time[8];
435 uint16 duration;
436 } BWL_POST_PACKED_STRUCT;
437 typedef struct dot11_meas_req dot11_meas_req_t;
438 #define DOT11_MNG_IE_MREQ_LEN 14
439
440 #define DOT11_MNG_IE_MREQ_FIXED_LEN 3
441
442 BWL_PRE_PACKED_STRUCT struct dot11_meas_rep {
443 uint8 id;
444 uint8 len;
445 uint8 token;
446 uint8 mode;
447 uint8 type;
448 BWL_PRE_PACKED_STRUCT union {
449 BWL_PRE_PACKED_STRUCT struct {
450 uint8 channel;
451 uint8 start_time[8];
452 uint16 duration;
453 uint8 map;
454 } BWL_POST_PACKED_STRUCT basic;
455 uint8 data[1];
456 } BWL_POST_PACKED_STRUCT rep;
457 } BWL_POST_PACKED_STRUCT;
458 typedef struct dot11_meas_rep dot11_meas_rep_t;
459
460 #define DOT11_MNG_IE_MREP_FIXED_LEN 3
461
462 BWL_PRE_PACKED_STRUCT struct dot11_meas_rep_basic {
463 uint8 channel;
464 uint8 start_time[8];
465 uint16 duration;
466 uint8 map;
467 } BWL_POST_PACKED_STRUCT;
468 typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
469 #define DOT11_MEASURE_BASIC_REP_LEN 12
470
471 BWL_PRE_PACKED_STRUCT struct dot11_quiet {
472 uint8 id;
473 uint8 len;
474 uint8 count;
475 uint8 period;
476 uint16 duration;
477 uint16 offset;
478 } BWL_POST_PACKED_STRUCT;
479 typedef struct dot11_quiet dot11_quiet_t;
480
481 BWL_PRE_PACKED_STRUCT struct chan_map_tuple {
482 uint8 channel;
483 uint8 map;
484 } BWL_POST_PACKED_STRUCT;
485 typedef struct chan_map_tuple chan_map_tuple_t;
486
487 BWL_PRE_PACKED_STRUCT struct dot11_ibss_dfs {
488 uint8 id;
489 uint8 len;
490 uint8 eaddr[ETHER_ADDR_LEN];
491 uint8 interval;
492 chan_map_tuple_t map[1];
493 } BWL_POST_PACKED_STRUCT;
494 typedef struct dot11_ibss_dfs dot11_ibss_dfs_t;
495
496 #define WME_OUI "\x00\x50\xf2"
497 #define WME_VER 1
498 #define WME_TYPE 2
499 #define WME_SUBTYPE_IE 0
500 #define WME_SUBTYPE_PARAM_IE 1
501 #define WME_SUBTYPE_TSPEC 2
502
503 #define AC_BE 0
504 #define AC_BK 1
505 #define AC_VI 2
506 #define AC_VO 3
507 #define AC_COUNT 4
508
509 typedef uint8 ac_bitmap_t;
510
511 #define AC_BITMAP_NONE 0x0
512 #define AC_BITMAP_ALL 0xf
513 #define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0)
514 #define AC_BITMAP_SET(ab, ac) (((ab) |= (1 << (ac))))
515 #define AC_BITMAP_RESET(ab, ac) (((ab) &= ~(1 << (ac))))
516
517 BWL_PRE_PACKED_STRUCT struct wme_ie {
518 uint8 oui[3];
519 uint8 type;
520 uint8 subtype;
521 uint8 version;
522 uint8 qosinfo;
523 } BWL_POST_PACKED_STRUCT;
524 typedef struct wme_ie wme_ie_t;
525 #define WME_IE_LEN 7
526
527 BWL_PRE_PACKED_STRUCT struct edcf_acparam {
528 uint8 ACI;
529 uint8 ECW;
530 uint16 TXOP;
531 } BWL_POST_PACKED_STRUCT;
532 typedef struct edcf_acparam edcf_acparam_t;
533
534 BWL_PRE_PACKED_STRUCT struct wme_param_ie {
535 uint8 oui[3];
536 uint8 type;
537 uint8 subtype;
538 uint8 version;
539 uint8 qosinfo;
540 uint8 rsvd;
541 edcf_acparam_t acparam[AC_COUNT];
542 } BWL_POST_PACKED_STRUCT;
543 typedef struct wme_param_ie wme_param_ie_t;
544 #define WME_PARAM_IE_LEN 24
545
546 #define WME_QI_AP_APSD_MASK 0x80
547 #define WME_QI_AP_APSD_SHIFT 7
548 #define WME_QI_AP_COUNT_MASK 0x0f
549 #define WME_QI_AP_COUNT_SHIFT 0
550
551 #define WME_QI_STA_MAXSPLEN_MASK 0x60
552 #define WME_QI_STA_MAXSPLEN_SHIFT 5
553 #define WME_QI_STA_APSD_ALL_MASK 0xf
554 #define WME_QI_STA_APSD_ALL_SHIFT 0
555 #define WME_QI_STA_APSD_BE_MASK 0x8
556 #define WME_QI_STA_APSD_BE_SHIFT 3
557 #define WME_QI_STA_APSD_BK_MASK 0x4
558 #define WME_QI_STA_APSD_BK_SHIFT 2
559 #define WME_QI_STA_APSD_VI_MASK 0x2
560 #define WME_QI_STA_APSD_VI_SHIFT 1
561 #define WME_QI_STA_APSD_VO_MASK 0x1
562 #define WME_QI_STA_APSD_VO_SHIFT 0
563
564 #define EDCF_AIFSN_MIN 1
565 #define EDCF_AIFSN_MAX 15
566 #define EDCF_AIFSN_MASK 0x0f
567 #define EDCF_ACM_MASK 0x10
568 #define EDCF_ACI_MASK 0x60
569 #define EDCF_ACI_SHIFT 5
570 #define EDCF_AIFSN_SHIFT 12
571
572 #define EDCF_ECW_MIN 0
573 #define EDCF_ECW_MAX 15
574 #define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)
575 #define EDCF_ECWMIN_MASK 0x0f
576 #define EDCF_ECWMAX_MASK 0xf0
577 #define EDCF_ECWMAX_SHIFT 4
578
579 #define EDCF_TXOP_MIN 0
580 #define EDCF_TXOP_MAX 65535
581 #define EDCF_TXOP2USEC(txop) ((txop) << 5)
582
583 #define NON_EDCF_AC_BE_ACI_STA 0x02
584
585 #define EDCF_AC_BE_ACI_STA 0x03
586 #define EDCF_AC_BE_ECW_STA 0xA4
587 #define EDCF_AC_BE_TXOP_STA 0x0000
588 #define EDCF_AC_BK_ACI_STA 0x27
589 #define EDCF_AC_BK_ECW_STA 0xA4
590 #define EDCF_AC_BK_TXOP_STA 0x0000
591 #define EDCF_AC_VI_ACI_STA 0x42
592 #define EDCF_AC_VI_ECW_STA 0x43
593 #define EDCF_AC_VI_TXOP_STA 0x005e
594 #define EDCF_AC_VO_ACI_STA 0x62
595 #define EDCF_AC_VO_ECW_STA 0x32
596 #define EDCF_AC_VO_TXOP_STA 0x002f
597
598 #define EDCF_AC_BE_ACI_AP 0x03
599 #define EDCF_AC_BE_ECW_AP 0x64
600 #define EDCF_AC_BE_TXOP_AP 0x0000
601 #define EDCF_AC_BK_ACI_AP 0x27
602 #define EDCF_AC_BK_ECW_AP 0xA4
603 #define EDCF_AC_BK_TXOP_AP 0x0000
604 #define EDCF_AC_VI_ACI_AP 0x41
605 #define EDCF_AC_VI_ECW_AP 0x43
606 #define EDCF_AC_VI_TXOP_AP 0x005e
607 #define EDCF_AC_VO_ACI_AP 0x61
608 #define EDCF_AC_VO_ECW_AP 0x32
609 #define EDCF_AC_VO_TXOP_AP 0x002f
610
611 BWL_PRE_PACKED_STRUCT struct edca_param_ie {
612 uint8 qosinfo;
613 uint8 rsvd;
614 edcf_acparam_t acparam[AC_COUNT];
615 } BWL_POST_PACKED_STRUCT;
616 typedef struct edca_param_ie edca_param_ie_t;
617 #define EDCA_PARAM_IE_LEN 18
618
619 BWL_PRE_PACKED_STRUCT struct qos_cap_ie {
620 uint8 qosinfo;
621 } BWL_POST_PACKED_STRUCT;
622 typedef struct qos_cap_ie qos_cap_ie_t;
623
624 BWL_PRE_PACKED_STRUCT struct dot11_qbss_load_ie {
625 uint8 id;
626 uint8 length;
627 uint16 station_count;
628 uint8 channel_utilization;
629 uint16 aac;
630 } BWL_POST_PACKED_STRUCT;
631 typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t;
632
633 #define FIXED_MSDU_SIZE 0x8000
634 #define MSDU_SIZE_MASK 0x7fff
635
636 #define INTEGER_SHIFT 13
637 #define FRACTION_MASK 0x1FFF
638
639 BWL_PRE_PACKED_STRUCT struct dot11_management_notification {
640 uint8 category;
641 uint8 action;
642 uint8 token;
643 uint8 status;
644 uint8 data[1];
645 } BWL_POST_PACKED_STRUCT;
646 #define DOT11_MGMT_NOTIFICATION_LEN 4
647
648 #define WME_ADDTS_REQUEST 0
649 #define WME_ADDTS_RESPONSE 1
650 #define WME_DELTS_REQUEST 2
651
652 #define WME_ADMISSION_ACCEPTED 0
653 #define WME_INVALID_PARAMETERS 1
654 #define WME_ADMISSION_REFUSED 3
655
656 #define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN)
657
658 #define DOT11_OPEN_SYSTEM 0
659 #define DOT11_SHARED_KEY 1
660 #define DOT11_OPEN_SHARED 2
661 #define DOT11_CHALLENGE_LEN 128
662
663 #define FC_PVER_MASK 0x3
664 #define FC_PVER_SHIFT 0
665 #define FC_TYPE_MASK 0xC
666 #define FC_TYPE_SHIFT 2
667 #define FC_SUBTYPE_MASK 0xF0
668 #define FC_SUBTYPE_SHIFT 4
669 #define FC_TODS 0x100
670 #define FC_TODS_SHIFT 8
671 #define FC_FROMDS 0x200
672 #define FC_FROMDS_SHIFT 9
673 #define FC_MOREFRAG 0x400
674 #define FC_MOREFRAG_SHIFT 10
675 #define FC_RETRY 0x800
676 #define FC_RETRY_SHIFT 11
677 #define FC_PM 0x1000
678 #define FC_PM_SHIFT 12
679 #define FC_MOREDATA 0x2000
680 #define FC_MOREDATA_SHIFT 13
681 #define FC_WEP 0x4000
682 #define FC_WEP_SHIFT 14
683 #define FC_ORDER 0x8000
684 #define FC_ORDER_SHIFT 15
685
686 #define SEQNUM_SHIFT 4
687 #define SEQNUM_MAX 0x1000
688 #define FRAGNUM_MASK 0xF
689
690 #define FC_TYPE_MNG 0
691 #define FC_TYPE_CTL 1
692 #define FC_TYPE_DATA 2
693
694 #define FC_SUBTYPE_ASSOC_REQ 0
695 #define FC_SUBTYPE_ASSOC_RESP 1
696 #define FC_SUBTYPE_REASSOC_REQ 2
697 #define FC_SUBTYPE_REASSOC_RESP 3
698 #define FC_SUBTYPE_PROBE_REQ 4
699 #define FC_SUBTYPE_PROBE_RESP 5
700 #define FC_SUBTYPE_BEACON 8
701 #define FC_SUBTYPE_ATIM 9
702 #define FC_SUBTYPE_DISASSOC 10
703 #define FC_SUBTYPE_AUTH 11
704 #define FC_SUBTYPE_DEAUTH 12
705 #define FC_SUBTYPE_ACTION 13
706 #define FC_SUBTYPE_ACTION_NOACK 14
707
708 #define FC_SUBTYPE_CTL_WRAPPER 7
709 #define FC_SUBTYPE_BLOCKACK_REQ 8
710 #define FC_SUBTYPE_BLOCKACK 9
711 #define FC_SUBTYPE_PS_POLL 10
712 #define FC_SUBTYPE_RTS 11
713 #define FC_SUBTYPE_CTS 12
714 #define FC_SUBTYPE_ACK 13
715 #define FC_SUBTYPE_CF_END 14
716 #define FC_SUBTYPE_CF_END_ACK 15
717
718 #define FC_SUBTYPE_DATA 0
719 #define FC_SUBTYPE_DATA_CF_ACK 1
720 #define FC_SUBTYPE_DATA_CF_POLL 2
721 #define FC_SUBTYPE_DATA_CF_ACK_POLL 3
722 #define FC_SUBTYPE_NULL 4
723 #define FC_SUBTYPE_CF_ACK 5
724 #define FC_SUBTYPE_CF_POLL 6
725 #define FC_SUBTYPE_CF_ACK_POLL 7
726 #define FC_SUBTYPE_QOS_DATA 8
727 #define FC_SUBTYPE_QOS_DATA_CF_ACK 9
728 #define FC_SUBTYPE_QOS_DATA_CF_POLL 10
729 #define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11
730 #define FC_SUBTYPE_QOS_NULL 12
731 #define FC_SUBTYPE_QOS_CF_POLL 14
732 #define FC_SUBTYPE_QOS_CF_ACK_POLL 15
733
734 #define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0)
735 #define FC_SUBTYPE_ANY_NULL(s) (((s) & 4) != 0)
736 #define FC_SUBTYPE_ANY_CF_POLL(s) (((s) & 2) != 0)
737 #define FC_SUBTYPE_ANY_CF_ACK(s) (((s) & 1) != 0)
738
739 #define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK)
740
741 #define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))
742
743 #define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT)
744 #define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT)
745
746 #define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)
747 #define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)
748 #define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)
749 #define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)
750 #define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)
751 #define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)
752 #define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)
753 #define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)
754 #define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)
755 #define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)
756 #define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)
757 #define FC_ACTION_NOACK FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK)
758
759 #define FC_CTL_WRAPPER FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER)
760 #define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ)
761 #define FC_BLOCKACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK)
762 #define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)
763 #define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)
764 #define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)
765 #define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)
766 #define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)
767 #define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)
768
769 #define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)
770 #define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)
771 #define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)
772 #define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA)
773 #define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL)
774
775 #define QOS_PRIO_SHIFT 0
776 #define QOS_PRIO_MASK 0x0007
777 #define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT)
778
779 #define QOS_TID_SHIFT 0
780 #define QOS_TID_MASK 0x000f
781 #define QOS_TID(qos) (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT)
782
783 #define QOS_EOSP_SHIFT 4
784 #define QOS_EOSP_MASK 0x0010
785 #define QOS_EOSP(qos) (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT)
786
787 #define QOS_ACK_NORMAL_ACK 0
788 #define QOS_ACK_NO_ACK 1
789 #define QOS_ACK_NO_EXP_ACK 2
790 #define QOS_ACK_BLOCK_ACK 3
791 #define QOS_ACK_SHIFT 5
792 #define QOS_ACK_MASK 0x0060
793 #define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT)
794
795 #define QOS_AMSDU_SHIFT 7
796 #define QOS_AMSDU_MASK 0x0080
797
798 #define DOT11_MNG_AUTH_ALGO_LEN 2
799 #define DOT11_MNG_AUTH_SEQ_LEN 2
800 #define DOT11_MNG_BEACON_INT_LEN 2
801 #define DOT11_MNG_CAP_LEN 2
802 #define DOT11_MNG_AP_ADDR_LEN 6
803 #define DOT11_MNG_LISTEN_INT_LEN 2
804 #define DOT11_MNG_REASON_LEN 2
805 #define DOT11_MNG_AID_LEN 2
806 #define DOT11_MNG_STATUS_LEN 2
807 #define DOT11_MNG_TIMESTAMP_LEN 8
808
809 #define DOT11_AID_MASK 0x3fff
810
811 #define DOT11_RC_RESERVED 0
812 #define DOT11_RC_UNSPECIFIED 1
813 #define DOT11_RC_AUTH_INVAL 2
814 #define DOT11_RC_DEAUTH_LEAVING 3
815 #define DOT11_RC_INACTIVITY 4
816 #define DOT11_RC_BUSY 5
817 #define DOT11_RC_INVAL_CLASS_2 6
818 #define DOT11_RC_INVAL_CLASS_3 7
819 #define DOT11_RC_DISASSOC_LEAVING 8
820 #define DOT11_RC_NOT_AUTH 9
821 #define DOT11_RC_BAD_PC 10
822 #define DOT11_RC_BAD_CHANNELS 11
823
824 #define DOT11_RC_UNSPECIFIED_QOS 32
825 #define DOT11_RC_INSUFFCIENT_BW 33
826 #define DOT11_RC_EXCESSIVE_FRAMES 34
827 #define DOT11_RC_TX_OUTSIDE_TXOP 35
828 #define DOT11_RC_LEAVING_QBSS 36
829 #define DOT11_RC_BAD_MECHANISM 37
830 #define DOT11_RC_SETUP_NEEDED 38
831 #define DOT11_RC_TIMEOUT 39
832
833 #define DOT11_RC_MAX 23
834
835 #define DOT11_SC_SUCCESS 0
836 #define DOT11_SC_FAILURE 1
837 #define DOT11_SC_CAP_MISMATCH 10
838 #define DOT11_SC_REASSOC_FAIL 11
839 #define DOT11_SC_ASSOC_FAIL 12
840 #define DOT11_SC_AUTH_MISMATCH 13
841 #define DOT11_SC_AUTH_SEQ 14
842 #define DOT11_SC_AUTH_CHALLENGE_FAIL 15
843 #define DOT11_SC_AUTH_TIMEOUT 16
844 #define DOT11_SC_ASSOC_BUSY_FAIL 17
845 #define DOT11_SC_ASSOC_RATE_MISMATCH 18
846 #define DOT11_SC_ASSOC_SHORT_REQUIRED 19
847 #define DOT11_SC_ASSOC_PBCC_REQUIRED 20
848 #define DOT11_SC_ASSOC_AGILITY_REQUIRED 21
849 #define DOT11_SC_ASSOC_SPECTRUM_REQUIRED 22
850 #define DOT11_SC_ASSOC_BAD_POWER_CAP 23
851 #define DOT11_SC_ASSOC_BAD_SUP_CHANNELS 24
852 #define DOT11_SC_ASSOC_SHORTSLOT_REQUIRED 25
853 #define DOT11_SC_ASSOC_ERPBCC_REQUIRED 26
854 #define DOT11_SC_ASSOC_DSSOFDM_REQUIRED 27
855
856 #define DOT11_SC_DECLINED 37
857 #define DOT11_SC_INVALID_PARAMS 38
858
859 #define DOT11_MNG_DS_PARAM_LEN 1
860 #define DOT11_MNG_IBSS_PARAM_LEN 2
861
862 #define DOT11_MNG_TIM_FIXED_LEN 3
863 #define DOT11_MNG_TIM_DTIM_COUNT 0
864 #define DOT11_MNG_TIM_DTIM_PERIOD 1
865 #define DOT11_MNG_TIM_BITMAP_CTL 2
866 #define DOT11_MNG_TIM_PVB 3
867
868 #define TLV_TAG_OFF 0
869 #define TLV_LEN_OFF 1
870 #define TLV_HDR_LEN 2
871 #define TLV_BODY_OFF 2
872
873 #define DOT11_MNG_SSID_ID 0
874 #define DOT11_MNG_RATES_ID 1
875 #define DOT11_MNG_FH_PARMS_ID 2
876 #define DOT11_MNG_DS_PARMS_ID 3
877 #define DOT11_MNG_CF_PARMS_ID 4
878 #define DOT11_MNG_TIM_ID 5
879 #define DOT11_MNG_IBSS_PARMS_ID 6
880 #define DOT11_MNG_COUNTRY_ID 7
881 #define DOT11_MNG_HOPPING_PARMS_ID 8
882 #define DOT11_MNG_HOPPING_TABLE_ID 9
883 #define DOT11_MNG_REQUEST_ID 10
884 #define DOT11_MNG_QBSS_LOAD_ID 11
885 #define DOT11_MNG_EDCA_PARAM_ID 12
886 #define DOT11_MNG_CHALLENGE_ID 16
887 #define DOT11_MNG_PWR_CONSTRAINT_ID 32
888 #define DOT11_MNG_PWR_CAP_ID 33
889 #define DOT11_MNG_TPC_REQUEST_ID 34
890 #define DOT11_MNG_TPC_REPORT_ID 35
891 #define DOT11_MNG_SUPP_CHANNELS_ID 36
892 #define DOT11_MNG_CHANNEL_SWITCH_ID 37
893 #define DOT11_MNG_MEASURE_REQUEST_ID 38
894 #define DOT11_MNG_MEASURE_REPORT_ID 39
895 #define DOT11_MNG_QUIET_ID 40
896 #define DOT11_MNG_IBSS_DFS_ID 41
897 #define DOT11_MNG_ERP_ID 42
898 #define DOT11_MNG_TS_DELAY_ID 43
899 #define DOT11_MNG_HT_CAP 45
900 #define DOT11_MNG_QOS_CAP_ID 46
901 #define DOT11_MNG_NONERP_ID 47
902 #define DOT11_MNG_RSN_ID 48
903 #define DOT11_MNG_EXT_RATES_ID 50
904 #define DOT11_MNG_AP_CHREP_ID 51
905 #define DOT11_MNG_NBR_REP_ID 52
906 #define DOT11_MNG_REGCLASS_ID 59
907 #define DOT11_MNG_EXT_CSA_ID 60
908 #define DOT11_MNG_HT_ADD 61
909 #define DOT11_MNG_EXT_CHANNEL_OFFSET 62
910
911 #define DOT11_MNG_RRM_CAP_ID 70
912 #define DOT11_MNG_HT_BSS_COEXINFO_ID 72
913 #define DOT11_MNG_HT_BSS_CHANNEL_REPORT_ID 73
914 #define DOT11_MNG_HT_OBSS_ID 74
915 #define DOT11_MNG_EXT_CAP 127
916 #define DOT11_MNG_WPA_ID 221
917 #define DOT11_MNG_PROPR_ID 221
918
919 #define DOT11_MNG_VS_ID 221
920
921 #define DOT11_RATE_BASIC 0x80
922 #define DOT11_RATE_MASK 0x7F
923
924 #define DOT11_MNG_ERP_LEN 1
925 #define DOT11_MNG_NONERP_PRESENT 0x01
926 #define DOT11_MNG_USE_PROTECTION 0x02
927 #define DOT11_MNG_BARKER_PREAMBLE 0x04
928
929 #define DOT11_MGN_TS_DELAY_LEN 4
930 #define TS_DELAY_FIELD_SIZE 4
931
932 #define DOT11_CAP_ESS 0x0001
933 #define DOT11_CAP_IBSS 0x0002
934 #define DOT11_CAP_POLLABLE 0x0004
935 #define DOT11_CAP_POLL_RQ 0x0008
936 #define DOT11_CAP_PRIVACY 0x0010
937 #define DOT11_CAP_SHORT 0x0020
938 #define DOT11_CAP_PBCC 0x0040
939 #define DOT11_CAP_AGILITY 0x0080
940 #define DOT11_CAP_SPECTRUM 0x0100
941 #define DOT11_CAP_SHORTSLOT 0x0400
942 #define DOT11_CAP_RRM 0x1000
943 #define DOT11_CAP_CCK_OFDM 0x2000
944
945 #define DOT11_OBSS_COEX_MNG_SUPPORT 0x01
946
947 #define DOT11_ACTION_HDR_LEN 2
948
949 #define DOT11_ACTION_CAT_ERR_MASK 0x80
950 #define DOT11_ACTION_CAT_MASK 0x7F
951 #define DOT11_ACTION_CAT_SPECT_MNG 0
952 #define DOT11_ACTION_CAT_QOS 1
953 #define DOT11_ACTION_CAT_DLS 2
954 #define DOT11_ACTION_CAT_BLOCKACK 3
955 #define DOT11_ACTION_CAT_PUBLIC 4
956 #define DOT11_ACTION_CAT_RRM 5
957 #define DOT11_ACTION_CAT_HT 7
958 #define DOT11_ACTION_NOTIFICATION 17
959 #define DOT11_ACTION_CAT_VS 127
960
961 #define DOT11_SM_ACTION_M_REQ 0
962 #define DOT11_SM_ACTION_M_REP 1
963 #define DOT11_SM_ACTION_TPC_REQ 2
964 #define DOT11_SM_ACTION_TPC_REP 3
965 #define DOT11_SM_ACTION_CHANNEL_SWITCH 4
966 #define DOT11_SM_ACTION_EXT_CSA 5
967
968 #define DOT11_ACTION_ID_HT_CH_WIDTH 0
969 #define DOT11_ACTION_ID_HT_MIMO_PS 1
970
971 #define DOT11_PUB_ACTION_BSS_COEX_MNG 0
972 #define DOT11_PUB_ACTION_CHANNEL_SWITCH 4
973
974 #define DOT11_BA_ACTION_ADDBA_REQ 0
975 #define DOT11_BA_ACTION_ADDBA_RESP 1
976 #define DOT11_BA_ACTION_DELBA 2
977
978 #define DOT11_ADDBA_PARAM_AMSDU_SUP 0x0001
979 #define DOT11_ADDBA_PARAM_POLICY_MASK 0x0002
980 #define DOT11_ADDBA_PARAM_POLICY_SHIFT 1
981 #define DOT11_ADDBA_PARAM_TID_MASK 0x003c
982 #define DOT11_ADDBA_PARAM_TID_SHIFT 2
983 #define DOT11_ADDBA_PARAM_BSIZE_MASK 0xffc0
984 #define DOT11_ADDBA_PARAM_BSIZE_SHIFT 6
985
986 #define DOT11_ADDBA_POLICY_DELAYED 0
987 #define DOT11_ADDBA_POLICY_IMMEDIATE 1
988
989 BWL_PRE_PACKED_STRUCT struct dot11_addba_req {
990 uint8 category;
991 uint8 action;
992 uint8 token;
993 uint16 addba_param_set;
994 uint16 timeout;
995 uint16 start_seqnum;
996 } BWL_POST_PACKED_STRUCT;
997 typedef struct dot11_addba_req dot11_addba_req_t;
998 #define DOT11_ADDBA_REQ_LEN 9
999
1000 BWL_PRE_PACKED_STRUCT struct dot11_addba_resp {
1001 uint8 category;
1002 uint8 action;
1003 uint8 token;
1004 uint16 status;
1005 uint16 addba_param_set;
1006 uint16 timeout;
1007 } BWL_POST_PACKED_STRUCT;
1008 typedef struct dot11_addba_resp dot11_addba_resp_t;
1009 #define DOT11_ADDBA_RESP_LEN 9
1010
1011 #define DOT11_DELBA_PARAM_INIT_MASK 0x0800
1012 #define DOT11_DELBA_PARAM_INIT_SHIFT 11
1013 #define DOT11_DELBA_PARAM_TID_MASK 0xf000
1014 #define DOT11_DELBA_PARAM_TID_SHIFT 12
1015
1016 BWL_PRE_PACKED_STRUCT struct dot11_delba {
1017 uint8 category;
1018 uint8 action;
1019 uint16 delba_param_set;
1020 uint16 reason;
1021 } BWL_POST_PACKED_STRUCT;
1022 typedef struct dot11_delba dot11_delba_t;
1023 #define DOT11_DELBA_LEN 6
1024
1025 #define DOT11_RRM_CAP_LEN 5
1026 BWL_PRE_PACKED_STRUCT struct dot11_rrm_cap_ie {
1027 uint8 cap[DOT11_RRM_CAP_LEN];
1028 } BWL_POST_PACKED_STRUCT;
1029 typedef struct dot11_rrm_cap_ie dot11_rrm_cap_ie_t;
1030
1031 #define DOT11_RRM_CAP_LINK 0
1032 #define DOT11_RRM_CAP_NEIGHBOR_REPORT 1
1033 #define DOT11_RRM_CAP_PARALLEL 2
1034 #define DOT11_RRM_CAP_REPEATED 3
1035 #define DOT11_RRM_CAP_BCN_PASSIVE 4
1036 #define DOT11_RRM_CAP_BCN_ACTIVE 5
1037 #define DOT11_RRM_CAP_BCN_TABLE 6
1038 #define DOT11_RRM_CAP_BCN_REP_COND 7
1039 #define DOT11_RRM_CAP_AP_CHANREP 16
1040
1041 #define DOT11_RM_ACTION_RM_REQ 0
1042 #define DOT11_RM_ACTION_RM_REP 1
1043 #define DOT11_RM_ACTION_LM_REQ 2
1044 #define DOT11_RM_ACTION_LM_REP 3
1045 #define DOT11_RM_ACTION_NR_REQ 4
1046 #define DOT11_RM_ACTION_NR_REP 5
1047
1048 BWL_PRE_PACKED_STRUCT struct dot11_rm_action {
1049 uint8 category;
1050 uint8 action;
1051 uint8 token;
1052 uint8 data[1];
1053 } BWL_POST_PACKED_STRUCT;
1054 typedef struct dot11_rm_action dot11_rm_action_t;
1055 #define DOT11_RM_ACTION_LEN 3
1056
1057 BWL_PRE_PACKED_STRUCT struct dot11_rmreq {
1058 uint8 category;
1059 uint8 action;
1060 uint8 token;
1061 uint16 reps;
1062 } BWL_POST_PACKED_STRUCT;
1063 typedef struct dot11_rmreq dot11_rmreq_t;
1064 #define DOT11_RMREQ_LEN 5
1065
1066 BWL_PRE_PACKED_STRUCT struct dot11_rm_ie {
1067 uint8 id;
1068 uint8 len;
1069 uint8 token;
1070 uint8 mode;
1071 uint8 type;
1072 } BWL_POST_PACKED_STRUCT;
1073 typedef struct dot11_rm_ie dot11_rm_ie_t;
1074 #define DOT11_RM_IE_LEN 5
1075
1076 #define DOT11_RMREQ_MODE_PARALLEL 1
1077 #define DOT11_RMREQ_MODE_ENABLE 2
1078 #define DOT11_RMREQ_MODE_REQUEST 4
1079 #define DOT11_RMREQ_MODE_REPORT 8
1080 #define DOT11_RMREQ_MODE_DURMAND 0x10
1081
1082 #define DOT11_RMREP_MODE_LATE 1
1083 #define DOT11_RMREP_MODE_INCAPABLE 2
1084 #define DOT11_RMREP_MODE_REFUSED 4
1085
1086 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_bcn {
1087 uint8 id;
1088 uint8 len;
1089 uint8 token;
1090 uint8 mode;
1091 uint8 type;
1092 uint8 reg;
1093 uint8 channel;
1094 uint16 interval;
1095 uint16 duration;
1096 uint8 bcn_mode;
1097 struct ether_addr bssid;
1098 } BWL_POST_PACKED_STRUCT;
1099 typedef struct dot11_rmreq_bcn dot11_rmreq_bcn_t;
1100 #define DOT11_RMREQ_BCN_LEN 18
1101
1102 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_bcn {
1103 uint8 reg;
1104 uint8 channel;
1105 uint32 starttime[2];
1106 uint16 duration;
1107 uint8 frame_info;
1108 uint8 rcpi;
1109 uint8 rsni;
1110 struct ether_addr bssid;
1111 uint8 antenna_id;
1112 uint32 parent_tsf;
1113 } BWL_POST_PACKED_STRUCT;
1114 typedef struct dot11_rmrep_bcn dot11_rmrep_bcn_t;
1115 #define DOT11_RMREP_BCN_LEN 26
1116
1117 #define DOT11_RMREQ_BCN_PASSIVE 0
1118 #define DOT11_RMREQ_BCN_ACTIVE 1
1119 #define DOT11_RMREQ_BCN_TABLE 2
1120
1121 #define DOT11_RMREQ_BCN_SSID_ID 0
1122 #define DOT11_RMREQ_BCN_REPINFO_ID 1
1123 #define DOT11_RMREQ_BCN_REPDET_ID 2
1124 #define DOT11_RMREQ_BCN_REQUEST_ID 10
1125 #define DOT11_RMREQ_BCN_APCHREP_ID 51
1126
1127 #define DOT11_RMREQ_BCN_REPDET_FIXED 0
1128 #define DOT11_RMREQ_BCN_REPDET_REQUEST 1
1129 #define DOT11_RMREQ_BCN_REPDET_ALL 2
1130
1131 #define DOT11_RMREP_BCN_FRM_BODY 1
1132
1133 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_nbr {
1134 struct ether_addr bssid;
1135 uint32 bssid_info;
1136 uint8 reg;
1137 uint8 channel;
1138 uint8 phytype;
1139 } BWL_POST_PACKED_STRUCT;
1140 typedef struct dot11_rmrep_nbr dot11_rmrep_nbr_t;
1141 #define DOT11_RMREP_NBR_LEN 13
1142
1143 #define DOT11_BSSTYPE_INFRASTRUCTURE 0
1144 #define DOT11_BSSTYPE_INDEPENDENT 1
1145 #define DOT11_BSSTYPE_ANY 2
1146 #define DOT11_SCANTYPE_ACTIVE 0
1147 #define DOT11_SCANTYPE_PASSIVE 1
1148
1149 BWL_PRE_PACKED_STRUCT struct dot11_lmreq {
1150 uint8 category;
1151 uint8 action;
1152 uint8 token;
1153 uint8 txpwr;
1154 uint8 maxtxpwr;
1155 } BWL_POST_PACKED_STRUCT;
1156 typedef struct dot11_lmreq dot11_lmreq_t;
1157 #define DOT11_LMREQ_LEN 5
1158
1159 BWL_PRE_PACKED_STRUCT struct dot11_lmrep {
1160 uint8 category;
1161 uint8 action;
1162 uint8 token;
1163 dot11_tpc_rep_t tpc;
1164 uint8 rxant;
1165 uint8 txant;
1166 uint8 rcpi;
1167 uint8 rsni;
1168 } BWL_POST_PACKED_STRUCT;
1169 typedef struct dot11_lmrep dot11_lmrep_t;
1170 #define DOT11_LMREP_LEN 11
1171
1172 #define PREN_PREAMBLE 24
1173 #define PREN_MM_EXT 12
1174 #define PREN_PREAMBLE_EXT 4
1175
1176 #define RIFS_11N_TIME 2
1177
1178 #define APHY_SLOT_TIME 9
1179 #define APHY_SIFS_TIME 16
1180 #define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))
1181 #define APHY_PREAMBLE_TIME 16
1182 #define APHY_SIGNAL_TIME 4
1183 #define APHY_SYMBOL_TIME 4
1184 #define APHY_SERVICE_NBITS 16
1185 #define APHY_TAIL_NBITS 6
1186 #define APHY_CWMIN 15
1187
1188 #define BPHY_SLOT_TIME 20
1189 #define BPHY_SIFS_TIME 10
1190 #define BPHY_DIFS_TIME 50
1191 #define BPHY_PLCP_TIME 192
1192 #define BPHY_PLCP_SHORT_TIME 96
1193 #define BPHY_CWMIN 31
1194
1195 #define DOT11_OFDM_SIGNAL_EXTENSION 6
1196
1197 #define PHY_CWMAX 1023
1198
1199 #define DOT11_MAXNUMFRAGS 16
1200
1201 typedef struct d11cnt {
1202 uint32 txfrag;
1203 uint32 txmulti;
1204 uint32 txfail;
1205 uint32 txretry;
1206 uint32 txretrie;
1207 uint32 rxdup;
1208 uint32 txrts;
1209 uint32 txnocts;
1210 uint32 txnoack;
1211 uint32 rxfrag;
1212 uint32 rxmulti;
1213 uint32 rxcrc;
1214 uint32 txfrmsnt;
1215 uint32 rxundec;
1216 } d11cnt_t;
1217
1218 #define AB_GUARDCOUNT 10
1219
1220 BWL_PRE_PACKED_STRUCT struct vndr_ie {
1221 uchar id;
1222 uchar len;
1223 uchar oui[3];
1224 uchar data[1];
1225 } BWL_POST_PACKED_STRUCT;
1226 typedef struct vndr_ie vndr_ie_t;
1227
1228 #define VNDR_IE_HDR_LEN 2
1229 #define VNDR_IE_MIN_LEN 3
1230 #define VNDR_IE_MAX_LEN 256
1231
1232 #define MCSSET_LEN 16
1233 #define MAX_MCS_NUM (128)
1234
1235 BWL_PRE_PACKED_STRUCT struct ht_cap_ie {
1236 uint16 cap;
1237 uint8 params;
1238 uint8 supp_mcs[MCSSET_LEN];
1239 uint16 ext_htcap;
1240 uint32 txbf_cap;
1241 uint8 as_cap;
1242 } BWL_POST_PACKED_STRUCT;
1243 typedef struct ht_cap_ie ht_cap_ie_t;
1244
1245 #define HT_CAP_IE_LEN 26
1246 #define HT_CAP_IE_TYPE 51
1247
1248 #define HT_CAP_LDPC_CODING 0x0001
1249 #define HT_CAP_40MHZ 0x0002
1250 #define HT_CAP_MIMO_PS_MASK 0x000C
1251 #define HT_CAP_MIMO_PS_SHIFT 0x0002
1252 #define HT_CAP_MIMO_PS_OFF 0x0003
1253 #define HT_CAP_MIMO_PS_RTS 0x0001
1254 #define HT_CAP_MIMO_PS_ON 0x0000
1255 #define HT_CAP_GF 0x0010
1256 #define HT_CAP_SHORT_GI_20 0x0020
1257 #define HT_CAP_SHORT_GI_40 0x0040
1258 #define HT_CAP_TX_STBC 0x0080
1259 #define HT_CAP_RX_STBC_MASK 0x0300
1260 #define HT_CAP_RX_STBC_SHIFT 8
1261 #define HT_CAP_DELAYED_BA 0x0400
1262 #define HT_CAP_MAX_AMSDU 0x0800
1263 #define HT_CAP_DSSS_CCK 0x1000
1264 #define HT_CAP_PSMP 0x2000
1265 #define HT_CAP_40MHZ_INTOLERANT 0x4000
1266 #define HT_CAP_LSIG_TXOP 0x8000
1267
1268 #define HT_CAP_RX_STBC_NO 0x0
1269 #define HT_CAP_RX_STBC_ONE_STREAM 0x1
1270 #define HT_CAP_RX_STBC_TWO_STREAM 0x2
1271 #define HT_CAP_RX_STBC_THREE_STREAM 0x3
1272
1273 #define HT_MAX_AMSDU 7935
1274 #define HT_MIN_AMSDU 3835
1275
1276 #define HT_PARAMS_RX_FACTOR_MASK 0x03
1277 #define HT_PARAMS_DENSITY_MASK 0x1C
1278 #define HT_PARAMS_DENSITY_SHIFT 2
1279
1280 #define AMPDU_MAX_MPDU_DENSITY 7
1281 #define AMPDU_RX_FACTOR_8K 0
1282 #define AMPDU_RX_FACTOR_16K 1
1283 #define AMPDU_RX_FACTOR_32K 2
1284 #define AMPDU_RX_FACTOR_64K 3
1285 #define AMPDU_RX_FACTOR_BASE 8*1024
1286
1287 #define AMPDU_DELIMITER_LEN 4
1288
1289 BWL_PRE_PACKED_STRUCT struct ht_add_ie {
1290 uint8 ctl_ch;
1291 uint8 byte1;
1292 uint16 opmode;
1293 uint16 misc_bits;
1294 uint8 basic_mcs[MCSSET_LEN];
1295 } BWL_POST_PACKED_STRUCT;
1296 typedef struct ht_add_ie ht_add_ie_t;
1297
1298 #define HT_ADD_IE_LEN 22
1299 #define HT_ADD_IE_TYPE 52
1300
1301 #define HT_BW_ANY 0x04
1302 #define HT_RIFS_PERMITTED 0x08
1303
1304 #define HT_OPMODE_MASK 0x0003
1305 #define HT_OPMODE_SHIFT 0
1306 #define HT_OPMODE_PURE 0x0000
1307 #define HT_OPMODE_OPTIONAL 0x0001
1308 #define HT_OPMODE_HT20IN40 0x0002
1309 #define HT_OPMODE_MIXED 0x0003
1310 #define HT_OPMODE_NONGF 0x0004
1311 #define DOT11N_TXBURST 0x0008
1312 #define DOT11N_OBSS_NONHT 0x0010
1313
1314 #define HT_BASIC_STBC_MCS 0x007f
1315 #define HT_DUAL_STBC_PROT 0x0080
1316 #define HT_SECOND_BCN 0x0100
1317 #define HT_LSIG_TXOP 0x0200
1318 #define HT_PCO_ACTIVE 0x0400
1319 #define HT_PCO_PHASE 0x0800
1320
1321 #define DOT11N_2G_TXBURST_LIMIT 6160
1322 #define DOT11N_5G_TXBURST_LIMIT 3080
1323
1324 #define GET_HT_OPMODE(add_ie) \
1325 ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) >> HT_OPMODE_SHIFT)
1326 #define HT_MIXEDMODE_PRESENT(add_ie) \
1327 ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) == HT_OPMODE_MIXED)
1328 #define HT_HT20_PRESENT(add_ie) \
1329 ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) == HT_OPMODE_HT20IN40)
1330 #define HT_OPTIONAL_PRESENT(add_ie) \
1331 ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) == HT_OPMODE_OPTIONAL)
1332 #define HT_USE_PROTECTION(add_ie) \
1333 (HT_HT20_PRESENT((add_ie)) || HT_MIXEDMODE_PRESENT((add_ie)))
1334 #define HT_NONGF_PRESENT(add_ie) \
1335 ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_NONGF) == HT_OPMODE_NONGF)
1336 #define DOT11N_TXBURST_PRESENT(add_ie) \
1337 ((ltoh16_ua(&add_ie->opmode) & DOT11N_TXBURST) == DOT11N_TXBURST)
1338 #define DOT11N_OBSS_NONHT_PRESENT(add_ie) \
1339 ((ltoh16_ua(&add_ie->opmode) & DOT11N_OBSS_NONHT) == DOT11N_OBSS_NONHT)
1340
1341 BWL_PRE_PACKED_STRUCT struct obss_params {
1342 uint16 passive_dwell;
1343 uint16 active_dwell;
1344 uint16 bss_widthscan_interval;
1345 uint16 passive_total;
1346 uint16 active_total;
1347 uint16 chanwidth_transition_dly;
1348 uint16 activity_threshold;
1349 } BWL_POST_PACKED_STRUCT;
1350 typedef struct obss_params obss_params_t;
1351
1352 BWL_PRE_PACKED_STRUCT struct dot11_obss_ie {
1353 uint8 id;
1354 uint8 len;
1355 obss_params_t obss_params;
1356 } BWL_POST_PACKED_STRUCT;
1357 typedef struct dot11_obss_ie dot11_obss_ie_t;
1358 #define DOT11_OBSS_SCAN_IE_LEN sizeof(obss_params_t)
1359
1360 #define HT_CTRL_LA_TRQ 0x00000002
1361 #define HT_CTRL_LA_MAI 0x0000003C
1362 #define HT_CTRL_LA_MAI_SHIFT 2
1363 #define HT_CTRL_LA_MAI_MRQ 0x00000004
1364 #define HT_CTRL_LA_MAI_MSI 0x00000038
1365 #define HT_CTRL_LA_MFSI 0x000001C0
1366 #define HT_CTRL_LA_MFSI_SHIFT 6
1367 #define HT_CTRL_LA_MFB_ASELC 0x0000FE00
1368 #define HT_CTRL_LA_MFB_ASELC_SH 9
1369 #define HT_CTRL_LA_ASELC_CMD 0x00000C00
1370 #define HT_CTRL_LA_ASELC_DATA 0x0000F000
1371 #define HT_CTRL_CAL_POS 0x00030000
1372 #define HT_CTRL_CAL_SEQ 0x000C0000
1373 #define HT_CTRL_CSI_STEERING 0x00C00000
1374 #define HT_CTRL_CSI_STEER_SHIFT 22
1375 #define HT_CTRL_CSI_STEER_NFB 0
1376 #define HT_CTRL_CSI_STEER_CSI 1
1377 #define HT_CTRL_CSI_STEER_NCOM 2
1378 #define HT_CTRL_CSI_STEER_COM 3
1379 #define HT_CTRL_NDP_ANNOUNCE 0x01000000
1380 #define HT_CTRL_AC_CONSTRAINT 0x40000000
1381 #define HT_CTRL_RDG_MOREPPDU 0x80000000
1382
1383 #define HT_OPMODE_OPTIONAL 0x0001
1384 #define HT_OPMODE_HT20IN40 0x0002
1385 #define HT_OPMODE_MIXED 0x0003
1386 #define HT_OPMODE_NONGF 0x0004
1387 #define DOT11N_TXBURST 0x0008
1388 #define DOT11N_OBSS_NONHT 0x0010
1389
1390 #define WPA_VERSION 1
1391 #define WPA_OUI "\x00\x50\xF2"
1392
1393 #define WPA2_VERSION 1
1394 #define WPA2_VERSION_LEN 2
1395 #define WPA2_OUI "\x00\x0F\xAC"
1396
1397 #define WPA_OUI_LEN 3
1398
1399 #define WFA_OUI "\x00\x50\xF2"
1400 #define WFA_OUI_LEN 3
1401
1402 #define WFA_OUI_TYPE_WPA 1
1403 #define WFA_OUI_TYPE_WPS 4
1404 #define WFA_OUI_TYPE_P2P 9
1405
1406 #define RSN_AKM_NONE 0
1407 #define RSN_AKM_UNSPECIFIED 1
1408 #define RSN_AKM_PSK 2
1409
1410 #define DOT11_MAX_DEFAULT_KEYS 4
1411 #define DOT11_MAX_KEY_SIZE 32
1412 #define DOT11_MAX_IV_SIZE 16
1413 #define DOT11_EXT_IV_FLAG (1<<5)
1414 #define DOT11_WPA_KEY_RSC_LEN 8
1415
1416 #define WEP1_KEY_SIZE 5
1417 #define WEP1_KEY_HEX_SIZE 10
1418 #define WEP128_KEY_SIZE 13
1419 #define WEP128_KEY_HEX_SIZE 26
1420 #define TKIP_MIC_SIZE 8
1421 #define TKIP_EOM_SIZE 7
1422 #define TKIP_EOM_FLAG 0x5a
1423 #define TKIP_KEY_SIZE 32
1424 #define TKIP_MIC_AUTH_TX 16
1425 #define TKIP_MIC_AUTH_RX 24
1426 #define TKIP_MIC_SUP_RX TKIP_MIC_AUTH_TX
1427 #define TKIP_MIC_SUP_TX TKIP_MIC_AUTH_RX
1428 #define AES_KEY_SIZE 16
1429 #define AES_MIC_SIZE 8
1430
1431 #define WCN_OUI "\x00\x50\xf2"
1432 #define WCN_TYPE 4
1433
1434 #include <packed_section_end.h>
1435
1436 #endif /* _802_11_H_ */