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