net: wifi: rockchip: update broadcom drivers for kernel4.4
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rkwifi / bcmdhd / include / proto / 802.11.h
1 /*
2  * Fundamental types and constants relating to 802.11
3  *
4  * Copyright (C) 1999-2016, Broadcom Corporation
5  * 
6  *      Unless you and Broadcom execute a separate written software license
7  * agreement governing use of this software, this software is licensed to you
8  * under the terms of the GNU General Public License version 2 (the "GPL"),
9  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
10  * following added to such license:
11  * 
12  *      As a special exception, the copyright holders of this software give you
13  * permission to link this software with independent modules, and to copy and
14  * distribute the resulting executable under terms of your choice, provided that
15  * you also meet, for each linked independent module, the terms and conditions of
16  * the license of that module.  An independent module is a module which is not
17  * derived from this software.  The special exception does not apply to any
18  * modifications of the software.
19  * 
20  *      Notwithstanding the above, under no circumstances may you combine this
21  * software in any way with any other Broadcom software provided under a license
22  * other than the GPL, without Broadcom's express prior written consent.
23  *
24  *
25  * <<Broadcom-WL-IPTag/Open:>>
26  *
27  * $Id: 802.11.h 556559 2015-05-14 01:48:17Z $
28  */
29
30 #ifndef _802_11_H_
31 #define _802_11_H_
32
33 #ifndef _TYPEDEFS_H_
34 #include <typedefs.h>
35 #endif
36
37 #ifndef _NET_ETHERNET_H_
38 #include <proto/ethernet.h>
39 #endif
40
41 #include <proto/wpa.h>
42
43 /* This marks the start of a packed structure section. */
44 #include <packed_section_start.h>
45
46
47 #define DOT11_TU_TO_US                  1024    /* 802.11 Time Unit is 1024 microseconds */
48
49 /* Generic 802.11 frame constants */
50 #define DOT11_A3_HDR_LEN                24      /* d11 header length with A3 */
51 #define DOT11_A4_HDR_LEN                30      /* d11 header length with A4 */
52 #define DOT11_MAC_HDR_LEN               DOT11_A3_HDR_LEN        /* MAC header length */
53 #define DOT11_FCS_LEN                   4       /* d11 FCS length */
54 #define DOT11_ICV_LEN                   4       /* d11 ICV length */
55 #define DOT11_ICV_AES_LEN               8       /* d11 ICV/AES length */
56 #define DOT11_QOS_LEN                   2       /* d11 QoS length */
57 #define DOT11_HTC_LEN                   4       /* d11 HT Control field length */
58
59 #define DOT11_KEY_INDEX_SHIFT           6       /* d11 key index shift */
60 #define DOT11_IV_LEN                    4       /* d11 IV length */
61 #define DOT11_IV_TKIP_LEN               8       /* d11 IV TKIP length */
62 #define DOT11_IV_AES_OCB_LEN            4       /* d11 IV/AES/OCB length */
63 #define DOT11_IV_AES_CCM_LEN            8       /* d11 IV/AES/CCM length */
64 #define DOT11_IV_MAX_LEN                8       /* maximum iv len for any encryption */
65
66 /* Includes MIC */
67 #define DOT11_MAX_MPDU_BODY_LEN         2304    /* max MPDU body length */
68 /* A4 header + QoS + CCMP + PDU + ICV + FCS = 2352 */
69 #define DOT11_MAX_MPDU_LEN              (DOT11_A4_HDR_LEN + \
70                                          DOT11_QOS_LEN + \
71                                          DOT11_IV_AES_CCM_LEN + \
72                                          DOT11_MAX_MPDU_BODY_LEN + \
73                                          DOT11_ICV_LEN + \
74                                          DOT11_FCS_LEN) /* d11 max MPDU length */
75
76 #define DOT11_MAX_SSID_LEN              32      /* d11 max ssid length */
77
78 /* dot11RTSThreshold */
79 #define DOT11_DEFAULT_RTS_LEN           2347    /* d11 default RTS length */
80 #define DOT11_MAX_RTS_LEN               2347    /* d11 max RTS length */
81
82 /* dot11FragmentationThreshold */
83 #define DOT11_MIN_FRAG_LEN              256     /* d11 min fragmentation length */
84 #define DOT11_MAX_FRAG_LEN              2346    /* Max frag is also limited by aMPDUMaxLength
85                                                 * of the attached PHY
86                                                 */
87 #define DOT11_DEFAULT_FRAG_LEN          2346    /* d11 default fragmentation length */
88
89 /* dot11BeaconPeriod */
90 #define DOT11_MIN_BEACON_PERIOD         1       /* d11 min beacon period */
91 #define DOT11_MAX_BEACON_PERIOD         0xFFFF  /* d11 max beacon period */
92
93 /* dot11DTIMPeriod */
94 #define DOT11_MIN_DTIM_PERIOD           1       /* d11 min DTIM period */
95 #define DOT11_MAX_DTIM_PERIOD           0xFF    /* d11 max DTIM period */
96
97 /** 802.2 LLC/SNAP header used by 802.11 per 802.1H */
98 #define DOT11_LLC_SNAP_HDR_LEN          8       /* d11 LLC/SNAP header length */
99 #define DOT11_OUI_LEN                   3       /* d11 OUI length */
100 BWL_PRE_PACKED_STRUCT struct dot11_llc_snap_header {
101         uint8   dsap;                           /* always 0xAA */
102         uint8   ssap;                           /* always 0xAA */
103         uint8   ctl;                            /* always 0x03 */
104         uint8   oui[DOT11_OUI_LEN];             /* RFC1042: 0x00 0x00 0x00
105                                                  * Bridge-Tunnel: 0x00 0x00 0xF8
106                                                  */
107         uint16  type;                           /* ethertype */
108 } BWL_POST_PACKED_STRUCT;
109
110 /* RFC1042 header used by 802.11 per 802.1H */
111 #define RFC1042_HDR_LEN (ETHER_HDR_LEN + DOT11_LLC_SNAP_HDR_LEN)        /* RCF1042 header length */
112
113 /* Generic 802.11 MAC header */
114 /**
115  * N.B.: This struct reflects the full 4 address 802.11 MAC header.
116  *               The fields are defined such that the shorter 1, 2, and 3
117  *               address headers just use the first k fields.
118  */
119 BWL_PRE_PACKED_STRUCT struct dot11_header {
120         uint16                  fc;             /* frame control */
121         uint16                  durid;          /* duration/ID */
122         struct ether_addr       a1;             /* address 1 */
123         struct ether_addr       a2;             /* address 2 */
124         struct ether_addr       a3;             /* address 3 */
125         uint16                  seq;            /* sequence control */
126         struct ether_addr       a4;             /* address 4 */
127 } BWL_POST_PACKED_STRUCT;
128
129 /* Control frames */
130
131 BWL_PRE_PACKED_STRUCT struct dot11_rts_frame {
132         uint16                  fc;             /* frame control */
133         uint16                  durid;          /* duration/ID */
134         struct ether_addr       ra;             /* receiver address */
135         struct ether_addr       ta;             /* transmitter address */
136 } BWL_POST_PACKED_STRUCT;
137 #define DOT11_RTS_LEN           16              /* d11 RTS frame length */
138
139 BWL_PRE_PACKED_STRUCT struct dot11_cts_frame {
140         uint16                  fc;             /* frame control */
141         uint16                  durid;          /* duration/ID */
142         struct ether_addr       ra;             /* receiver address */
143 } BWL_POST_PACKED_STRUCT;
144 #define DOT11_CTS_LEN           10              /* d11 CTS frame length */
145
146 BWL_PRE_PACKED_STRUCT struct dot11_ack_frame {
147         uint16                  fc;             /* frame control */
148         uint16                  durid;          /* duration/ID */
149         struct ether_addr       ra;             /* receiver address */
150 } BWL_POST_PACKED_STRUCT;
151 #define DOT11_ACK_LEN           10              /* d11 ACK frame length */
152
153 BWL_PRE_PACKED_STRUCT struct dot11_ps_poll_frame {
154         uint16                  fc;             /* frame control */
155         uint16                  durid;          /* AID */
156         struct ether_addr       bssid;          /* receiver address, STA in AP */
157         struct ether_addr       ta;             /* transmitter address */
158 } BWL_POST_PACKED_STRUCT;
159 #define DOT11_PS_POLL_LEN       16              /* d11 PS poll frame length */
160
161 BWL_PRE_PACKED_STRUCT struct dot11_cf_end_frame {
162         uint16                  fc;             /* frame control */
163         uint16                  durid;          /* duration/ID */
164         struct ether_addr       ra;             /* receiver address */
165         struct ether_addr       bssid;          /* transmitter address, STA in AP */
166 } BWL_POST_PACKED_STRUCT;
167 #define DOT11_CS_END_LEN        16              /* d11 CF-END frame length */
168
169 /**
170  * RWL wifi protocol: The Vendor Specific Action frame is defined for vendor-specific signaling
171  *  category+OUI+vendor specific content ( this can be variable)
172  */
173 BWL_PRE_PACKED_STRUCT struct dot11_action_wifi_vendor_specific {
174         uint8   category;
175         uint8   OUI[3];
176         uint8   type;
177         uint8   subtype;
178         uint8   data[1040];
179 } BWL_POST_PACKED_STRUCT;
180 typedef struct dot11_action_wifi_vendor_specific dot11_action_wifi_vendor_specific_t;
181
182 /** generic vendor specific action frame with variable length */
183 BWL_PRE_PACKED_STRUCT struct dot11_action_vs_frmhdr {
184         uint8   category;
185         uint8   OUI[3];
186         uint8   type;
187         uint8   subtype;
188         uint8   data[1];
189 } BWL_POST_PACKED_STRUCT;
190 typedef struct dot11_action_vs_frmhdr dot11_action_vs_frmhdr_t;
191
192 #define DOT11_ACTION_VS_HDR_LEN 6
193
194 #define BCM_ACTION_OUI_BYTE0    0x00
195 #define BCM_ACTION_OUI_BYTE1    0x90
196 #define BCM_ACTION_OUI_BYTE2    0x4c
197
198 /* BA/BAR Control parameters */
199 #define DOT11_BA_CTL_POLICY_NORMAL      0x0000  /* normal ack */
200 #define DOT11_BA_CTL_POLICY_NOACK       0x0001  /* no ack */
201 #define DOT11_BA_CTL_POLICY_MASK        0x0001  /* ack policy mask */
202
203 #define DOT11_BA_CTL_MTID               0x0002  /* multi tid BA */
204 #define DOT11_BA_CTL_COMPRESSED         0x0004  /* compressed bitmap */
205
206 #define DOT11_BA_CTL_NUMMSDU_MASK       0x0FC0  /* num msdu in bitmap mask */
207 #define DOT11_BA_CTL_NUMMSDU_SHIFT      6       /* num msdu in bitmap shift */
208
209 #define DOT11_BA_CTL_TID_MASK           0xF000  /* tid mask */
210 #define DOT11_BA_CTL_TID_SHIFT          12      /* tid shift */
211
212 /** control frame header (BA/BAR) */
213 BWL_PRE_PACKED_STRUCT struct dot11_ctl_header {
214         uint16                  fc;             /* frame control */
215         uint16                  durid;          /* duration/ID */
216         struct ether_addr       ra;             /* receiver address */
217         struct ether_addr       ta;             /* transmitter address */
218 } BWL_POST_PACKED_STRUCT;
219 #define DOT11_CTL_HDR_LEN       16              /* control frame hdr len */
220
221 /** BAR frame payload */
222 BWL_PRE_PACKED_STRUCT struct dot11_bar {
223         uint16                  bar_control;    /* BAR Control */
224         uint16                  seqnum;         /* Starting Sequence control */
225 } BWL_POST_PACKED_STRUCT;
226 #define DOT11_BAR_LEN           4               /* BAR frame payload length */
227
228 #define DOT11_BA_BITMAP_LEN     128             /* bitmap length */
229 #define DOT11_BA_CMP_BITMAP_LEN 8               /* compressed bitmap length */
230 /** BA frame payload */
231 BWL_PRE_PACKED_STRUCT struct dot11_ba {
232         uint16                  ba_control;     /* BA Control */
233         uint16                  seqnum;         /* Starting Sequence control */
234         uint8                   bitmap[DOT11_BA_BITMAP_LEN];    /* Block Ack Bitmap */
235 } BWL_POST_PACKED_STRUCT;
236 #define DOT11_BA_LEN            4               /* BA frame payload len (wo bitmap) */
237
238 /** Management frame header */
239 BWL_PRE_PACKED_STRUCT struct dot11_management_header {
240         uint16                  fc;             /* frame control */
241         uint16                  durid;          /* duration/ID */
242         struct ether_addr       da;             /* receiver address */
243         struct ether_addr       sa;             /* transmitter address */
244         struct ether_addr       bssid;          /* BSS ID */
245         uint16                  seq;            /* sequence control */
246 } BWL_POST_PACKED_STRUCT;
247 typedef struct dot11_management_header dot11_management_header_t;
248 #define DOT11_MGMT_HDR_LEN      24              /* d11 management header length */
249
250 /* Management frame payloads */
251
252 BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb {
253         uint32                  timestamp[2];
254         uint16                  beacon_interval;
255         uint16                  capability;
256 } BWL_POST_PACKED_STRUCT;
257 #define DOT11_BCN_PRB_LEN       12              /* 802.11 beacon/probe frame fixed length */
258 #define DOT11_BCN_PRB_FIXED_LEN 12              /* 802.11 beacon/probe frame fixed length */
259
260 BWL_PRE_PACKED_STRUCT struct dot11_auth {
261         uint16                  alg;            /* algorithm */
262         uint16                  seq;            /* sequence control */
263         uint16                  status;         /* status code */
264 } BWL_POST_PACKED_STRUCT;
265 #define DOT11_AUTH_FIXED_LEN    6               /* length of auth frame without challenge IE */
266
267 BWL_PRE_PACKED_STRUCT struct dot11_assoc_req {
268         uint16                  capability;     /* capability information */
269         uint16                  listen;         /* listen interval */
270 } BWL_POST_PACKED_STRUCT;
271 #define DOT11_ASSOC_REQ_FIXED_LEN       4       /* length of assoc frame without info elts */
272
273 BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req {
274         uint16                  capability;     /* capability information */
275         uint16                  listen;         /* listen interval */
276         struct ether_addr       ap;             /* Current AP address */
277 } BWL_POST_PACKED_STRUCT;
278 #define DOT11_REASSOC_REQ_FIXED_LEN     10      /* length of assoc frame without info elts */
279
280 BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp {
281         uint16                  capability;     /* capability information */
282         uint16                  status;         /* status code */
283         uint16                  aid;            /* association ID */
284 } BWL_POST_PACKED_STRUCT;
285 #define DOT11_ASSOC_RESP_FIXED_LEN      6       /* length of assoc resp frame without info elts */
286
287 BWL_PRE_PACKED_STRUCT struct dot11_action_measure {
288         uint8   category;
289         uint8   action;
290         uint8   token;
291         uint8   data[1];
292 } BWL_POST_PACKED_STRUCT;
293 #define DOT11_ACTION_MEASURE_LEN        3       /* d11 action measurement header length */
294
295 BWL_PRE_PACKED_STRUCT struct dot11_action_ht_ch_width {
296         uint8   category;
297         uint8   action;
298         uint8   ch_width;
299 } BWL_POST_PACKED_STRUCT;
300
301 BWL_PRE_PACKED_STRUCT struct dot11_action_ht_mimops {
302         uint8   category;
303         uint8   action;
304         uint8   control;
305 } BWL_POST_PACKED_STRUCT;
306
307 BWL_PRE_PACKED_STRUCT struct dot11_action_sa_query {
308         uint8   category;
309         uint8   action;
310         uint16  id;
311 } BWL_POST_PACKED_STRUCT;
312
313 BWL_PRE_PACKED_STRUCT struct dot11_action_vht_oper_mode {
314         uint8   category;
315         uint8   action;
316         uint8   mode;
317 } BWL_POST_PACKED_STRUCT;
318
319 /* These lengths assume 64 MU groups, as specified in 802.11ac-2013 */
320 #define DOT11_ACTION_GID_MEMBERSHIP_LEN  8    /* bytes */
321 #define DOT11_ACTION_GID_USER_POS_LEN   16    /* bytes */
322 BWL_PRE_PACKED_STRUCT struct dot11_action_group_id {
323         uint8   category;
324         uint8   action;
325         uint8   membership_status[DOT11_ACTION_GID_MEMBERSHIP_LEN];
326         uint8   user_position[DOT11_ACTION_GID_USER_POS_LEN];
327 } BWL_POST_PACKED_STRUCT;
328
329 #define SM_PWRSAVE_ENABLE       1
330 #define SM_PWRSAVE_MODE         2
331
332 /* ************* 802.11h related definitions. ************* */
333 BWL_PRE_PACKED_STRUCT struct dot11_power_cnst {
334         uint8 id;
335         uint8 len;
336         uint8 power;
337 } BWL_POST_PACKED_STRUCT;
338 typedef struct dot11_power_cnst dot11_power_cnst_t;
339
340 BWL_PRE_PACKED_STRUCT struct dot11_power_cap {
341         int8 min;
342         int8 max;
343 } BWL_POST_PACKED_STRUCT;
344 typedef struct dot11_power_cap dot11_power_cap_t;
345
346 BWL_PRE_PACKED_STRUCT struct dot11_tpc_rep {
347         uint8 id;
348         uint8 len;
349         uint8 tx_pwr;
350         uint8 margin;
351 } BWL_POST_PACKED_STRUCT;
352 typedef struct dot11_tpc_rep dot11_tpc_rep_t;
353 #define DOT11_MNG_IE_TPC_REPORT_LEN     2       /* length of IE data, not including 2 byte header */
354
355 BWL_PRE_PACKED_STRUCT struct dot11_supp_channels {
356         uint8 id;
357         uint8 len;
358         uint8 first_channel;
359         uint8 num_channels;
360 } BWL_POST_PACKED_STRUCT;
361 typedef struct dot11_supp_channels dot11_supp_channels_t;
362
363 /**
364  * Extension Channel Offset IE: 802.11n-D1.0 spec. added sideband
365  * offset for 40MHz operation.  The possible 3 values are:
366  * 1 = above control channel
367  * 3 = below control channel
368  * 0 = no extension channel
369  */
370 BWL_PRE_PACKED_STRUCT struct dot11_extch {
371         uint8   id;             /* IE ID, 62, DOT11_MNG_EXT_CHANNEL_OFFSET */
372         uint8   len;            /* IE length */
373         uint8   extch;
374 } BWL_POST_PACKED_STRUCT;
375 typedef struct dot11_extch dot11_extch_ie_t;
376
377 BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
378         uint8   id;             /* IE ID, 221, DOT11_MNG_PROPR_ID */
379         uint8   len;            /* IE length */
380         uint8   oui[3];
381         uint8   type;           /* type indicates what follows */
382         uint8   extch;
383 } BWL_POST_PACKED_STRUCT;
384 typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t;
385
386 #define BRCM_EXTCH_IE_LEN       5
387 #define BRCM_EXTCH_IE_TYPE      53      /* 802.11n ID not yet assigned */
388 #define DOT11_EXTCH_IE_LEN      1
389 #define DOT11_EXT_CH_MASK       0x03    /* extension channel mask */
390 #define DOT11_EXT_CH_UPPER      0x01    /* ext. ch. on upper sb */
391 #define DOT11_EXT_CH_LOWER      0x03    /* ext. ch. on lower sb */
392 #define DOT11_EXT_CH_NONE       0x00    /* no extension ch.  */
393
394 BWL_PRE_PACKED_STRUCT struct dot11_action_frmhdr {
395         uint8   category;
396         uint8   action;
397         uint8   data[1];
398 } BWL_POST_PACKED_STRUCT;
399 typedef struct dot11_action_frmhdr dot11_action_frmhdr_t;
400 #define DOT11_ACTION_FRMHDR_LEN 2
401
402 /** CSA IE data structure */
403 BWL_PRE_PACKED_STRUCT struct dot11_channel_switch {
404         uint8 id;       /* id DOT11_MNG_CHANNEL_SWITCH_ID */
405         uint8 len;      /* length of IE */
406         uint8 mode;     /* mode 0 or 1 */
407         uint8 channel;  /* channel switch to */
408         uint8 count;    /* number of beacons before switching */
409 } BWL_POST_PACKED_STRUCT;
410 typedef struct dot11_channel_switch dot11_chan_switch_ie_t;
411
412 #define DOT11_SWITCH_IE_LEN     3       /* length of IE data, not including 2 byte header */
413 /* CSA mode - 802.11h-2003 $7.3.2.20 */
414 #define DOT11_CSA_MODE_ADVISORY         0       /* no DOT11_CSA_MODE_NO_TX restriction imposed */
415 #define DOT11_CSA_MODE_NO_TX            1       /* no transmission upon receiving CSA frame. */
416
417 BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel {
418         uint8   category;
419         uint8   action;
420         dot11_chan_switch_ie_t chan_switch_ie;  /* for switch IE */
421         dot11_brcm_extch_ie_t extch_ie;         /* extension channel offset */
422 } BWL_POST_PACKED_STRUCT;
423
424 BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
425         uint8 mode;     /* mode 0 or 1 */
426         uint8 reg;      /* regulatory class */
427         uint8 channel;  /* channel switch to */
428         uint8 count;    /* number of beacons before switching */
429 } BWL_POST_PACKED_STRUCT;
430
431 /** 11n Extended Channel Switch IE data structure */
432 BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
433         uint8 id;       /* id DOT11_MNG_EXT_CHANNEL_SWITCH_ID */
434         uint8 len;      /* length of IE */
435         struct dot11_csa_body b;        /* body of the ie */
436 } BWL_POST_PACKED_STRUCT;
437 typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
438 #define DOT11_EXT_CSA_IE_LEN    4       /* length of extended channel switch IE body */
439
440 BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa {
441         uint8   category;
442         uint8   action;
443         dot11_ext_csa_ie_t chan_switch_ie;      /* for switch IE */
444 } BWL_POST_PACKED_STRUCT;
445
446 BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
447         uint8   category;
448         uint8   action;
449         struct dot11_csa_body b;        /* body of the ie */
450 } BWL_POST_PACKED_STRUCT;
451
452 /**  Wide Bandwidth Channel Switch IE data structure */
453 BWL_PRE_PACKED_STRUCT struct dot11_wide_bw_channel_switch {
454         uint8 id;                               /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
455         uint8 len;                              /* length of IE */
456         uint8 channel_width;                    /* new channel width */
457         uint8 center_frequency_segment_0;       /* center frequency segment 0 */
458         uint8 center_frequency_segment_1;       /* center frequency segment 1 */
459 } BWL_POST_PACKED_STRUCT;
460 typedef struct dot11_wide_bw_channel_switch dot11_wide_bw_chan_switch_ie_t;
461
462 #define DOT11_WIDE_BW_SWITCH_IE_LEN     3       /* length of IE data, not including 2 byte header */
463
464 /** Channel Switch Wrapper IE data structure */
465 BWL_PRE_PACKED_STRUCT struct dot11_channel_switch_wrapper {
466         uint8 id;                               /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
467         uint8 len;                              /* length of IE */
468         dot11_wide_bw_chan_switch_ie_t wb_chan_switch_ie;
469 } BWL_POST_PACKED_STRUCT;
470 typedef struct dot11_channel_switch_wrapper dot11_chan_switch_wrapper_ie_t;
471
472 /** VHT Transmit Power Envelope IE data structure */
473 BWL_PRE_PACKED_STRUCT struct dot11_vht_transmit_power_envelope {
474         uint8 id;                               /* id DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID */
475         uint8 len;                              /* length of IE */
476         uint8 transmit_power_info;
477         uint8 local_max_transmit_power_20;
478 } BWL_POST_PACKED_STRUCT;
479 typedef struct dot11_vht_transmit_power_envelope dot11_vht_transmit_power_envelope_ie_t;
480
481 /* vht transmit power envelope IE length depends on channel width */
482 #define DOT11_VHT_TRANSMIT_PWR_ENVELOPE_IE_LEN_40MHZ    1
483 #define DOT11_VHT_TRANSMIT_PWR_ENVELOPE_IE_LEN_80MHZ    2
484 #define DOT11_VHT_TRANSMIT_PWR_ENVELOPE_IE_LEN_160MHZ   3
485
486 BWL_PRE_PACKED_STRUCT struct dot11_obss_coex {
487         uint8   id;
488         uint8   len;
489         uint8   info;
490 } BWL_POST_PACKED_STRUCT;
491 typedef struct dot11_obss_coex dot11_obss_coex_t;
492 #define DOT11_OBSS_COEXINFO_LEN 1       /* length of OBSS Coexistence INFO IE */
493
494 #define DOT11_OBSS_COEX_INFO_REQ                0x01
495 #define DOT11_OBSS_COEX_40MHZ_INTOLERANT        0x02
496 #define DOT11_OBSS_COEX_20MHZ_WIDTH_REQ 0x04
497
498 BWL_PRE_PACKED_STRUCT struct dot11_obss_chanlist {
499         uint8   id;
500         uint8   len;
501         uint8   regclass;
502         uint8   chanlist[1];
503 } BWL_POST_PACKED_STRUCT;
504 typedef struct dot11_obss_chanlist dot11_obss_chanlist_t;
505 #define DOT11_OBSS_CHANLIST_FIXED_LEN   1       /* fixed length of regclass */
506
507 BWL_PRE_PACKED_STRUCT struct dot11_extcap_ie {
508         uint8 id;
509         uint8 len;
510         uint8 cap[1];
511 } BWL_POST_PACKED_STRUCT;
512 typedef struct dot11_extcap_ie dot11_extcap_ie_t;
513
514 #define DOT11_EXTCAP_LEN_COEX   1
515 #define DOT11_EXTCAP_LEN_BT     3
516 #define DOT11_EXTCAP_LEN_IW     4
517 #define DOT11_EXTCAP_LEN_SI     6
518
519 #define DOT11_EXTCAP_LEN_TDLS   5
520 #define DOT11_11AC_EXTCAP_LEN_TDLS      8
521
522 #define DOT11_EXTCAP_LEN_FMS                    2
523 #define DOT11_EXTCAP_LEN_PROXY_ARP              2
524 #define DOT11_EXTCAP_LEN_TFS                    3
525 #define DOT11_EXTCAP_LEN_WNM_SLEEP              3
526 #define DOT11_EXTCAP_LEN_TIMBC                  3
527 #define DOT11_EXTCAP_LEN_BSSTRANS               3
528 #define DOT11_EXTCAP_LEN_DMS                    4
529 #define DOT11_EXTCAP_LEN_WNM_NOTIFICATION       6
530 #define DOT11_EXTCAP_LEN_TDLS_WBW               8
531 #define DOT11_EXTCAP_LEN_OPMODE_NOTIFICATION    8
532
533 /* TDLS Capabilities */
534 #define DOT11_TDLS_CAP_TDLS                     37              /* TDLS support */
535 #define DOT11_TDLS_CAP_PU_BUFFER_STA    28              /* TDLS Peer U-APSD buffer STA support */
536 #define DOT11_TDLS_CAP_PEER_PSM         20              /* TDLS Peer PSM support */
537 #define DOT11_TDLS_CAP_CH_SW                    30              /* TDLS Channel switch */
538 #define DOT11_TDLS_CAP_PROH                     38              /* TDLS prohibited */
539 #define DOT11_TDLS_CAP_CH_SW_PROH               39              /* TDLS Channel switch prohibited */
540 #define DOT11_TDLS_CAP_TDLS_WIDER_BW    61      /* TDLS Wider Band-Width */
541
542 #define TDLS_CAP_MAX_BIT                39              /* TDLS max bit defined in ext cap */
543
544 /* 802.11h/802.11k Measurement Request/Report IEs */
545 /* Measurement Type field */
546 #define DOT11_MEASURE_TYPE_BASIC        0   /* d11 measurement basic type */
547 #define DOT11_MEASURE_TYPE_CCA          1   /* d11 measurement CCA type */
548 #define DOT11_MEASURE_TYPE_RPI          2   /* d11 measurement RPI type */
549 #define DOT11_MEASURE_TYPE_CHLOAD       3   /* d11 measurement Channel Load type */
550 #define DOT11_MEASURE_TYPE_NOISE        4   /* d11 measurement Noise Histogram type */
551 #define DOT11_MEASURE_TYPE_BEACON       5   /* d11 measurement Beacon type */
552 #define DOT11_MEASURE_TYPE_FRAME        6   /* d11 measurement Frame type */
553 #define DOT11_MEASURE_TYPE_STAT         7   /* d11 measurement STA Statistics type */
554 #define DOT11_MEASURE_TYPE_LCI          8   /* d11 measurement LCI type */
555 #define DOT11_MEASURE_TYPE_TXSTREAM     9   /* d11 measurement TX Stream type */
556 #define DOT11_MEASURE_TYPE_MCDIAGS      10  /* d11 measurement multicast diagnostics */
557 #define DOT11_MEASURE_TYPE_CIVICLOC     11  /* d11 measurement location civic */
558 #define DOT11_MEASURE_TYPE_LOC_ID       12  /* d11 measurement location identifier */
559 #define DOT11_MEASURE_TYPE_DIRCHANQ     13  /* d11 measurement dir channel quality */
560 #define DOT11_MEASURE_TYPE_DIRMEAS      14  /* d11 measurement directional */
561 #define DOT11_MEASURE_TYPE_DIRSTATS     15  /* d11 measurement directional stats */
562 #define DOT11_MEASURE_TYPE_FTMRANGE     16  /* d11 measurement Fine Timing */
563 #define DOT11_MEASURE_TYPE_PAUSE        255     /* d11 measurement pause type */
564
565 /* Measurement Request Modes */
566 #define DOT11_MEASURE_MODE_PARALLEL     (1<<0)  /* d11 measurement parallel */
567 #define DOT11_MEASURE_MODE_ENABLE       (1<<1)  /* d11 measurement enable */
568 #define DOT11_MEASURE_MODE_REQUEST      (1<<2)  /* d11 measurement request */
569 #define DOT11_MEASURE_MODE_REPORT       (1<<3)  /* d11 measurement report */
570 #define DOT11_MEASURE_MODE_DUR  (1<<4)  /* d11 measurement dur mandatory */
571 /* Measurement Report Modes */
572 #define DOT11_MEASURE_MODE_LATE         (1<<0)  /* d11 measurement late */
573 #define DOT11_MEASURE_MODE_INCAPABLE    (1<<1)  /* d11 measurement incapable */
574 #define DOT11_MEASURE_MODE_REFUSED      (1<<2)  /* d11 measurement refuse */
575 /* Basic Measurement Map bits */
576 #define DOT11_MEASURE_BASIC_MAP_BSS     ((uint8)(1<<0)) /* d11 measurement basic map BSS */
577 #define DOT11_MEASURE_BASIC_MAP_OFDM    ((uint8)(1<<1)) /* d11 measurement map OFDM */
578 #define DOT11_MEASURE_BASIC_MAP_UKNOWN  ((uint8)(1<<2)) /* d11 measurement map unknown */
579 #define DOT11_MEASURE_BASIC_MAP_RADAR   ((uint8)(1<<3)) /* d11 measurement map radar */
580 #define DOT11_MEASURE_BASIC_MAP_UNMEAS  ((uint8)(1<<4)) /* d11 measurement map unmeasuremnt */
581
582 BWL_PRE_PACKED_STRUCT struct dot11_meas_req {
583         uint8 id;
584         uint8 len;
585         uint8 token;
586         uint8 mode;
587         uint8 type;
588         uint8 channel;
589         uint8 start_time[8];
590         uint16 duration;
591 } BWL_POST_PACKED_STRUCT;
592 typedef struct dot11_meas_req dot11_meas_req_t;
593 #define DOT11_MNG_IE_MREQ_LEN 14        /* d11 measurement request IE length */
594 /* length of Measure Request IE data not including variable len */
595 #define DOT11_MNG_IE_MREQ_FIXED_LEN 3   /* d11 measurement request IE fixed length */
596
597 BWL_PRE_PACKED_STRUCT struct dot11_meas_req_loc {
598         uint8 id;
599         uint8 len;
600         uint8 token;
601         uint8 mode;
602         uint8 type;
603         BWL_PRE_PACKED_STRUCT union
604         {
605                 BWL_PRE_PACKED_STRUCT struct {
606                         uint8 subject;
607                         uint8 data[1];
608                 } BWL_POST_PACKED_STRUCT lci;
609                 BWL_PRE_PACKED_STRUCT struct {
610                         uint8 subject;
611                         uint8 type;  /* type of civic location */
612                         uint8 siu;   /* service interval units */
613                         uint16 si; /* service interval */
614                         uint8 data[1];
615                 } BWL_POST_PACKED_STRUCT civic;
616                 BWL_PRE_PACKED_STRUCT struct {
617                         uint16 max_init_delay;          /* maximum random initial delay */
618                         uint8 min_ap_count;
619                         uint8 data[1];
620                 } BWL_POST_PACKED_STRUCT ftm_range;
621         } BWL_POST_PACKED_STRUCT req;
622 } BWL_POST_PACKED_STRUCT;
623 typedef struct dot11_meas_req_loc dot11_meas_req_loc_t;
624 #define DOT11_MNG_IE_MREQ_MIN_LEN           4   /* d11 measurement report IE length */
625 #define DOT11_MNG_IE_MREQ_LCI_FIXED_LEN     4   /* d11 measurement report IE length */
626 #define DOT11_MNG_IE_MREQ_CIVIC_FIXED_LEN   8   /* d11 measurement report IE length */
627 #define DOT11_MNG_IE_MREQ_FRNG_FIXED_LEN    6   /* d11 measurement report IE length */
628
629 BWL_PRE_PACKED_STRUCT struct dot11_lci_subelement {
630         uint8 subelement;
631         uint8 length;
632         uint8 lci_data[1];
633 } BWL_POST_PACKED_STRUCT;
634 typedef struct dot11_lci_subelement dot11_lci_subelement_t;
635
636 BWL_PRE_PACKED_STRUCT struct dot11_civic_subelement {
637         uint8 type;  /* type of civic location */
638         uint8 subelement;
639         uint8 length;
640         uint8 civic_data[1];
641 } BWL_POST_PACKED_STRUCT;
642 typedef struct dot11_civic_subelement dot11_civic_subelement_t;
643
644 BWL_PRE_PACKED_STRUCT struct dot11_meas_rep {
645         uint8 id;
646         uint8 len;
647         uint8 token;
648         uint8 mode;
649         uint8 type;
650         BWL_PRE_PACKED_STRUCT union
651         {
652                 BWL_PRE_PACKED_STRUCT struct {
653                         uint8 channel;
654                         uint8 start_time[8];
655                         uint16 duration;
656                         uint8 map;
657                 } BWL_POST_PACKED_STRUCT basic;
658                 BWL_PRE_PACKED_STRUCT struct {
659                         uint8 subelement;
660                         uint8 length;
661                         uint8 data[1];
662                 } BWL_POST_PACKED_STRUCT lci;
663                 BWL_PRE_PACKED_STRUCT struct {
664                         uint8 type;  /* type of civic location */
665                         uint8 subelement;
666                         uint8 length;
667                         uint8 data[1];
668                 } BWL_POST_PACKED_STRUCT civic;
669                 BWL_PRE_PACKED_STRUCT struct {
670                         uint8 entry_count;
671                         uint8 data[1];
672                 } BWL_POST_PACKED_STRUCT ftm_range;
673                 uint8 data[1];
674         } BWL_POST_PACKED_STRUCT rep;
675 } BWL_POST_PACKED_STRUCT;
676 typedef struct dot11_meas_rep dot11_meas_rep_t;
677 #define DOT11_MNG_IE_MREP_MIN_LEN           5   /* d11 measurement report IE length */
678 #define DOT11_MNG_IE_MREP_LCI_FIXED_LEN     5   /* d11 measurement report IE length */
679 #define DOT11_MNG_IE_MREP_CIVIC_FIXED_LEN   6   /* d11 measurement report IE length */
680 #define DOT11_MNG_IE_MREP_BASIC_FIXED_LEN   15  /* d11 measurement report IE length */
681 #define DOT11_MNG_IE_MREP_FRNG_FIXED_LEN    4
682
683 /* length of Measure Report IE data not including variable len */
684 #define DOT11_MNG_IE_MREP_FIXED_LEN     3       /* d11 measurement response IE fixed length */
685
686 BWL_PRE_PACKED_STRUCT struct dot11_meas_rep_basic {
687         uint8 channel;
688         uint8 start_time[8];
689         uint16 duration;
690         uint8 map;
691 } BWL_POST_PACKED_STRUCT;
692 typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
693 #define DOT11_MEASURE_BASIC_REP_LEN     12      /* d11 measurement basic report length */
694
695 BWL_PRE_PACKED_STRUCT struct dot11_quiet {
696         uint8 id;
697         uint8 len;
698         uint8 count;    /* TBTTs until beacon interval in quiet starts */
699         uint8 period;   /* Beacon intervals between periodic quiet periods ? */
700         uint16 duration;        /* Length of quiet period, in TU's */
701         uint16 offset;  /* TU's offset from TBTT in Count field */
702 } BWL_POST_PACKED_STRUCT;
703 typedef struct dot11_quiet dot11_quiet_t;
704
705 BWL_PRE_PACKED_STRUCT struct chan_map_tuple {
706         uint8 channel;
707         uint8 map;
708 } BWL_POST_PACKED_STRUCT;
709 typedef struct chan_map_tuple chan_map_tuple_t;
710
711 BWL_PRE_PACKED_STRUCT struct dot11_ibss_dfs {
712         uint8 id;
713         uint8 len;
714         uint8 eaddr[ETHER_ADDR_LEN];
715         uint8 interval;
716         chan_map_tuple_t map[1];
717 } BWL_POST_PACKED_STRUCT;
718 typedef struct dot11_ibss_dfs dot11_ibss_dfs_t;
719
720 /* WME Elements */
721 #define WME_OUI                 "\x00\x50\xf2"  /* WME OUI */
722 #define WME_OUI_LEN             3
723 #define WME_OUI_TYPE            2       /* WME type */
724 #define WME_TYPE                2       /* WME type, deprecated */
725 #define WME_SUBTYPE_IE          0       /* Information Element */
726 #define WME_SUBTYPE_PARAM_IE    1       /* Parameter Element */
727 #define WME_SUBTYPE_TSPEC       2       /* Traffic Specification */
728 #define WME_VER                 1       /* WME version */
729
730 /* WME Access Category Indices (ACIs) */
731 #define AC_BE                   0       /* Best Effort */
732 #define AC_BK                   1       /* Background */
733 #define AC_VI                   2       /* Video */
734 #define AC_VO                   3       /* Voice */
735 #define AC_COUNT                4       /* number of ACs */
736
737 typedef uint8 ac_bitmap_t;      /* AC bitmap of (1 << AC_xx) */
738
739 #define AC_BITMAP_NONE          0x0     /* No ACs */
740 #define AC_BITMAP_ALL           0xf     /* All ACs */
741 #define AC_BITMAP_TST(ab, ac)   (((ab) & (1 << (ac))) != 0)
742 #define AC_BITMAP_SET(ab, ac)   (((ab) |= (1 << (ac))))
743 #define AC_BITMAP_RESET(ab, ac) (((ab) &= ~(1 << (ac))))
744
745
746 /** WME Information Element (IE) */
747 BWL_PRE_PACKED_STRUCT struct wme_ie {
748         uint8 oui[3];
749         uint8 type;
750         uint8 subtype;
751         uint8 version;
752         uint8 qosinfo;
753 } BWL_POST_PACKED_STRUCT;
754 typedef struct wme_ie wme_ie_t;
755 #define WME_IE_LEN 7    /* WME IE length */
756
757 BWL_PRE_PACKED_STRUCT struct edcf_acparam {
758         uint8   ACI;
759         uint8   ECW;
760         uint16  TXOP;           /* stored in network order (ls octet first) */
761 } BWL_POST_PACKED_STRUCT;
762 typedef struct edcf_acparam edcf_acparam_t;
763
764 /** WME Parameter Element (PE) */
765 BWL_PRE_PACKED_STRUCT struct wme_param_ie {
766         uint8 oui[3];
767         uint8 type;
768         uint8 subtype;
769         uint8 version;
770         uint8 qosinfo;
771         uint8 rsvd;
772         edcf_acparam_t acparam[AC_COUNT];
773 } BWL_POST_PACKED_STRUCT;
774 typedef struct wme_param_ie wme_param_ie_t;
775 #define WME_PARAM_IE_LEN            24          /* WME Parameter IE length */
776
777 /* QoS Info field for IE as sent from AP */
778 #define WME_QI_AP_APSD_MASK         0x80        /* U-APSD Supported mask */
779 #define WME_QI_AP_APSD_SHIFT        7           /* U-APSD Supported shift */
780 #define WME_QI_AP_COUNT_MASK        0x0f        /* Parameter set count mask */
781 #define WME_QI_AP_COUNT_SHIFT       0           /* Parameter set count shift */
782
783 /* QoS Info field for IE as sent from STA */
784 #define WME_QI_STA_MAXSPLEN_MASK    0x60        /* Max Service Period Length mask */
785 #define WME_QI_STA_MAXSPLEN_SHIFT   5           /* Max Service Period Length shift */
786 #define WME_QI_STA_APSD_ALL_MASK    0xf         /* APSD all AC bits mask */
787 #define WME_QI_STA_APSD_ALL_SHIFT   0           /* APSD all AC bits shift */
788 #define WME_QI_STA_APSD_BE_MASK     0x8         /* APSD AC_BE mask */
789 #define WME_QI_STA_APSD_BE_SHIFT    3           /* APSD AC_BE shift */
790 #define WME_QI_STA_APSD_BK_MASK     0x4         /* APSD AC_BK mask */
791 #define WME_QI_STA_APSD_BK_SHIFT    2           /* APSD AC_BK shift */
792 #define WME_QI_STA_APSD_VI_MASK     0x2         /* APSD AC_VI mask */
793 #define WME_QI_STA_APSD_VI_SHIFT    1           /* APSD AC_VI shift */
794 #define WME_QI_STA_APSD_VO_MASK     0x1         /* APSD AC_VO mask */
795 #define WME_QI_STA_APSD_VO_SHIFT    0           /* APSD AC_VO shift */
796
797 /* ACI */
798 #define EDCF_AIFSN_MIN               1           /* AIFSN minimum value */
799 #define EDCF_AIFSN_MAX               15          /* AIFSN maximum value */
800 #define EDCF_AIFSN_MASK              0x0f        /* AIFSN mask */
801 #define EDCF_ACM_MASK                0x10        /* ACM mask */
802 #define EDCF_ACI_MASK                0x60        /* ACI mask */
803 #define EDCF_ACI_SHIFT               5           /* ACI shift */
804 #define EDCF_AIFSN_SHIFT             12          /* 4 MSB(0xFFF) in ifs_ctl for AC idx */
805
806 /* ECW */
807 #define EDCF_ECW_MIN                 0           /* cwmin/cwmax exponent minimum value */
808 #define EDCF_ECW_MAX                 15          /* cwmin/cwmax exponent maximum value */
809 #define EDCF_ECW2CW(exp)             ((1 << (exp)) - 1)
810 #define EDCF_ECWMIN_MASK             0x0f        /* cwmin exponent form mask */
811 #define EDCF_ECWMAX_MASK             0xf0        /* cwmax exponent form mask */
812 #define EDCF_ECWMAX_SHIFT            4           /* cwmax exponent form shift */
813
814 /* TXOP */
815 #define EDCF_TXOP_MIN                0           /* TXOP minimum value */
816 #define EDCF_TXOP_MAX                65535       /* TXOP maximum value */
817 #define EDCF_TXOP2USEC(txop)         ((txop) << 5)
818
819 /* Default BE ACI value for non-WME connection STA */
820 #define NON_EDCF_AC_BE_ACI_STA          0x02
821
822 /* Default EDCF parameters that AP advertises for STA to use; WMM draft Table 12 */
823 #define EDCF_AC_BE_ACI_STA           0x03       /* STA ACI value for best effort AC */
824 #define EDCF_AC_BE_ECW_STA           0xA4       /* STA ECW value for best effort AC */
825 #define EDCF_AC_BE_TXOP_STA          0x0000     /* STA TXOP value for best effort AC */
826 #define EDCF_AC_BK_ACI_STA           0x27       /* STA ACI value for background AC */
827 #define EDCF_AC_BK_ECW_STA           0xA4       /* STA ECW value for background AC */
828 #define EDCF_AC_BK_TXOP_STA          0x0000     /* STA TXOP value for background AC */
829 #define EDCF_AC_VI_ACI_STA           0x42       /* STA ACI value for video AC */
830 #define EDCF_AC_VI_ECW_STA           0x43       /* STA ECW value for video AC */
831 #define EDCF_AC_VI_TXOP_STA          0x005e     /* STA TXOP value for video AC */
832 #define EDCF_AC_VO_ACI_STA           0x62       /* STA ACI value for audio AC */
833 #define EDCF_AC_VO_ECW_STA           0x32       /* STA ECW value for audio AC */
834 #define EDCF_AC_VO_TXOP_STA          0x002f     /* STA TXOP value for audio AC */
835
836 /* Default EDCF parameters that AP uses; WMM draft Table 14 */
837 #define EDCF_AC_BE_ACI_AP            0x03       /* AP ACI value for best effort AC */
838 #define EDCF_AC_BE_ECW_AP            0x64       /* AP ECW value for best effort AC */
839 #define EDCF_AC_BE_TXOP_AP           0x0000     /* AP TXOP value for best effort AC */
840 #define EDCF_AC_BK_ACI_AP            0x27       /* AP ACI value for background AC */
841 #define EDCF_AC_BK_ECW_AP            0xA4       /* AP ECW value for background AC */
842 #define EDCF_AC_BK_TXOP_AP           0x0000     /* AP TXOP value for background AC */
843 #define EDCF_AC_VI_ACI_AP            0x41       /* AP ACI value for video AC */
844 #define EDCF_AC_VI_ECW_AP            0x43       /* AP ECW value for video AC */
845 #define EDCF_AC_VI_TXOP_AP           0x005e     /* AP TXOP value for video AC */
846 #define EDCF_AC_VO_ACI_AP            0x61       /* AP ACI value for audio AC */
847 #define EDCF_AC_VO_ECW_AP            0x32       /* AP ECW value for audio AC */
848 #define EDCF_AC_VO_TXOP_AP           0x002f     /* AP TXOP value for audio AC */
849
850 /** EDCA Parameter IE */
851 BWL_PRE_PACKED_STRUCT struct edca_param_ie {
852         uint8 qosinfo;
853         uint8 rsvd;
854         edcf_acparam_t acparam[AC_COUNT];
855 } BWL_POST_PACKED_STRUCT;
856 typedef struct edca_param_ie edca_param_ie_t;
857 #define EDCA_PARAM_IE_LEN            18          /* EDCA Parameter IE length */
858
859 /** QoS Capability IE */
860 BWL_PRE_PACKED_STRUCT struct qos_cap_ie {
861         uint8 qosinfo;
862 } BWL_POST_PACKED_STRUCT;
863 typedef struct qos_cap_ie qos_cap_ie_t;
864
865 BWL_PRE_PACKED_STRUCT struct dot11_qbss_load_ie {
866         uint8 id;                       /* 11, DOT11_MNG_QBSS_LOAD_ID */
867         uint8 length;
868         uint16 station_count;           /* total number of STAs associated */
869         uint8 channel_utilization;      /* % of time, normalized to 255, QAP sensed medium busy */
870         uint16 aac;                     /* available admission capacity */
871 } BWL_POST_PACKED_STRUCT;
872 typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t;
873 #define BSS_LOAD_IE_SIZE        7       /* BSS load IE size */
874
875 #define WLC_QBSS_LOAD_CHAN_FREE_MAX     0xff    /* max for channel free score */
876
877 /* nom_msdu_size */
878 #define FIXED_MSDU_SIZE 0x8000          /* MSDU size is fixed */
879 #define MSDU_SIZE_MASK  0x7fff          /* (Nominal or fixed) MSDU size */
880
881 /* surplus_bandwidth */
882 /* Represented as 3 bits of integer, binary point, 13 bits fraction */
883 #define INTEGER_SHIFT   13      /* integer shift */
884 #define FRACTION_MASK   0x1FFF  /* fraction mask */
885
886 /** Management Notification Frame */
887 BWL_PRE_PACKED_STRUCT struct dot11_management_notification {
888         uint8 category;                 /* DOT11_ACTION_NOTIFICATION */
889         uint8 action;
890         uint8 token;
891         uint8 status;
892         uint8 data[1];                  /* Elements */
893 } BWL_POST_PACKED_STRUCT;
894 #define DOT11_MGMT_NOTIFICATION_LEN 4   /* Fixed length */
895
896 /** Timeout Interval IE */
897 BWL_PRE_PACKED_STRUCT struct ti_ie {
898         uint8 ti_type;
899         uint32 ti_val;
900 } BWL_POST_PACKED_STRUCT;
901 typedef struct ti_ie ti_ie_t;
902 #define TI_TYPE_REASSOC_DEADLINE        1
903 #define TI_TYPE_KEY_LIFETIME            2
904
905 /* WME Action Codes */
906 #define WME_ADDTS_REQUEST       0       /* WME ADDTS request */
907 #define WME_ADDTS_RESPONSE      1       /* WME ADDTS response */
908 #define WME_DELTS_REQUEST       2       /* WME DELTS request */
909
910 /* WME Setup Response Status Codes */
911 #define WME_ADMISSION_ACCEPTED          0       /* WME admission accepted */
912 #define WME_INVALID_PARAMETERS          1       /* WME invalide parameters */
913 #define WME_ADMISSION_REFUSED           3       /* WME admission refused */
914
915 /* Macro to take a pointer to a beacon or probe response
916  * body and return the char* pointer to the SSID info element
917  */
918 #define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN)
919
920 /* Authentication frame payload constants */
921 #define DOT11_OPEN_SYSTEM       0       /* d11 open authentication */
922 #define DOT11_SHARED_KEY        1       /* d11 shared authentication */
923 #define DOT11_FAST_BSS          2       /* d11 fast bss authentication */
924 #define DOT11_CHALLENGE_LEN     128     /* d11 challenge text length */
925
926 /* Frame control macros */
927 #define FC_PVER_MASK            0x3     /* PVER mask */
928 #define FC_PVER_SHIFT           0       /* PVER shift */
929 #define FC_TYPE_MASK            0xC     /* type mask */
930 #define FC_TYPE_SHIFT           2       /* type shift */
931 #define FC_SUBTYPE_MASK         0xF0    /* subtype mask */
932 #define FC_SUBTYPE_SHIFT        4       /* subtype shift */
933 #define FC_TODS                 0x100   /* to DS */
934 #define FC_TODS_SHIFT           8       /* to DS shift */
935 #define FC_FROMDS               0x200   /* from DS */
936 #define FC_FROMDS_SHIFT         9       /* from DS shift */
937 #define FC_MOREFRAG             0x400   /* more frag. */
938 #define FC_MOREFRAG_SHIFT       10      /* more frag. shift */
939 #define FC_RETRY                0x800   /* retry */
940 #define FC_RETRY_SHIFT          11      /* retry shift */
941 #define FC_PM                   0x1000  /* PM */
942 #define FC_PM_SHIFT             12      /* PM shift */
943 #define FC_MOREDATA             0x2000  /* more data */
944 #define FC_MOREDATA_SHIFT       13      /* more data shift */
945 #define FC_WEP                  0x4000  /* WEP */
946 #define FC_WEP_SHIFT            14      /* WEP shift */
947 #define FC_ORDER                0x8000  /* order */
948 #define FC_ORDER_SHIFT          15      /* order shift */
949
950 /* sequence control macros */
951 #define SEQNUM_SHIFT            4       /* seq. number shift */
952 #define SEQNUM_MAX              0x1000  /* max seqnum + 1 */
953 #define FRAGNUM_MASK            0xF     /* frag. number mask */
954
955 /* Frame Control type/subtype defs */
956
957 /* FC Types */
958 #define FC_TYPE_MNG             0       /* management type */
959 #define FC_TYPE_CTL             1       /* control type */
960 #define FC_TYPE_DATA            2       /* data type */
961
962 /* Management Subtypes */
963 #define FC_SUBTYPE_ASSOC_REQ            0       /* assoc. request */
964 #define FC_SUBTYPE_ASSOC_RESP           1       /* assoc. response */
965 #define FC_SUBTYPE_REASSOC_REQ          2       /* reassoc. request */
966 #define FC_SUBTYPE_REASSOC_RESP         3       /* reassoc. response */
967 #define FC_SUBTYPE_PROBE_REQ            4       /* probe request */
968 #define FC_SUBTYPE_PROBE_RESP           5       /* probe response */
969 #define FC_SUBTYPE_BEACON               8       /* beacon */
970 #define FC_SUBTYPE_ATIM                 9       /* ATIM */
971 #define FC_SUBTYPE_DISASSOC             10      /* disassoc. */
972 #define FC_SUBTYPE_AUTH                 11      /* authentication */
973 #define FC_SUBTYPE_DEAUTH               12      /* de-authentication */
974 #define FC_SUBTYPE_ACTION               13      /* action */
975 #define FC_SUBTYPE_ACTION_NOACK         14      /* action no-ack */
976
977 /* Control Subtypes */
978 #define FC_SUBTYPE_CTL_WRAPPER          7       /* Control Wrapper */
979 #define FC_SUBTYPE_BLOCKACK_REQ         8       /* Block Ack Req */
980 #define FC_SUBTYPE_BLOCKACK             9       /* Block Ack */
981 #define FC_SUBTYPE_PS_POLL              10      /* PS poll */
982 #define FC_SUBTYPE_RTS                  11      /* RTS */
983 #define FC_SUBTYPE_CTS                  12      /* CTS */
984 #define FC_SUBTYPE_ACK                  13      /* ACK */
985 #define FC_SUBTYPE_CF_END               14      /* CF-END */
986 #define FC_SUBTYPE_CF_END_ACK           15      /* CF-END ACK */
987
988 /* Data Subtypes */
989 #define FC_SUBTYPE_DATA                 0       /* Data */
990 #define FC_SUBTYPE_DATA_CF_ACK          1       /* Data + CF-ACK */
991 #define FC_SUBTYPE_DATA_CF_POLL         2       /* Data + CF-Poll */
992 #define FC_SUBTYPE_DATA_CF_ACK_POLL     3       /* Data + CF-Ack + CF-Poll */
993 #define FC_SUBTYPE_NULL                 4       /* Null */
994 #define FC_SUBTYPE_CF_ACK               5       /* CF-Ack */
995 #define FC_SUBTYPE_CF_POLL              6       /* CF-Poll */
996 #define FC_SUBTYPE_CF_ACK_POLL          7       /* CF-Ack + CF-Poll */
997 #define FC_SUBTYPE_QOS_DATA             8       /* QoS Data */
998 #define FC_SUBTYPE_QOS_DATA_CF_ACK      9       /* QoS Data + CF-Ack */
999 #define FC_SUBTYPE_QOS_DATA_CF_POLL     10      /* QoS Data + CF-Poll */
1000 #define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11      /* QoS Data + CF-Ack + CF-Poll */
1001 #define FC_SUBTYPE_QOS_NULL             12      /* QoS Null */
1002 #define FC_SUBTYPE_QOS_CF_POLL          14      /* QoS CF-Poll */
1003 #define FC_SUBTYPE_QOS_CF_ACK_POLL      15      /* QoS CF-Ack + CF-Poll */
1004
1005 /* Data Subtype Groups */
1006 #define FC_SUBTYPE_ANY_QOS(s)           (((s) & 8) != 0)
1007 #define FC_SUBTYPE_ANY_NULL(s)          (((s) & 4) != 0)
1008 #define FC_SUBTYPE_ANY_CF_POLL(s)       (((s) & 2) != 0)
1009 #define FC_SUBTYPE_ANY_CF_ACK(s)        (((s) & 1) != 0)
1010 #define FC_SUBTYPE_ANY_PSPOLL(s)        (((s) & 10) != 0)
1011
1012 /* Type/Subtype Combos */
1013 #define FC_KIND_MASK            (FC_TYPE_MASK | FC_SUBTYPE_MASK)        /* FC kind mask */
1014
1015 #define FC_KIND(t, s)   (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))    /* FC kind */
1016
1017 #define FC_SUBTYPE(fc)  (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT)  /* Subtype from FC */
1018 #define FC_TYPE(fc)     (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT)        /* Type from FC */
1019
1020 #define FC_ASSOC_REQ    FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)      /* assoc. request */
1021 #define FC_ASSOC_RESP   FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)     /* assoc. response */
1022 #define FC_REASSOC_REQ  FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)    /* reassoc. request */
1023 #define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)   /* reassoc. response */
1024 #define FC_PROBE_REQ    FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)      /* probe request */
1025 #define FC_PROBE_RESP   FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)     /* probe response */
1026 #define FC_BEACON       FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)         /* beacon */
1027 #define FC_ATIM         FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ATIM)           /* ATIM */
1028 #define FC_DISASSOC     FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)       /* disassoc */
1029 #define FC_AUTH         FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)           /* authentication */
1030 #define FC_DEAUTH       FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)         /* deauthentication */
1031 #define FC_ACTION       FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)         /* action */
1032 #define FC_ACTION_NOACK FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK)   /* action no-ack */
1033
1034 #define FC_CTL_WRAPPER  FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER)    /* Control Wrapper */
1035 #define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ)   /* Block Ack Req */
1036 #define FC_BLOCKACK     FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK)       /* Block Ack */
1037 #define FC_PS_POLL      FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)        /* PS poll */
1038 #define FC_RTS          FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)            /* RTS */
1039 #define FC_CTS          FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)            /* CTS */
1040 #define FC_ACK          FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)            /* ACK */
1041 #define FC_CF_END       FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)         /* CF-END */
1042 #define FC_CF_END_ACK   FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)     /* CF-END ACK */
1043
1044 #define FC_DATA         FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)          /* data */
1045 #define FC_NULL_DATA    FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)          /* null data */
1046 #define FC_DATA_CF_ACK  FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)   /* data CF ACK */
1047 #define FC_QOS_DATA     FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA)      /* QoS data */
1048 #define FC_QOS_NULL     FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL)      /* QoS null */
1049
1050 /* QoS Control Field */
1051
1052 /* 802.1D Priority */
1053 #define QOS_PRIO_SHIFT          0       /* QoS priority shift */
1054 #define QOS_PRIO_MASK           0x0007  /* QoS priority mask */
1055 #define QOS_PRIO(qos)           (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT)     /* QoS priority */
1056
1057 /* Traffic Identifier */
1058 #define QOS_TID_SHIFT           0       /* QoS TID shift */
1059 #define QOS_TID_MASK            0x000f  /* QoS TID mask */
1060 #define QOS_TID(qos)            (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT)       /* QoS TID */
1061
1062 /* End of Service Period (U-APSD) */
1063 #define QOS_EOSP_SHIFT          4       /* QoS End of Service Period shift */
1064 #define QOS_EOSP_MASK           0x0010  /* QoS End of Service Period mask */
1065 #define QOS_EOSP(qos)           (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT)     /* Qos EOSP */
1066
1067 /* Ack Policy */
1068 #define QOS_ACK_NORMAL_ACK      0       /* Normal Ack */
1069 #define QOS_ACK_NO_ACK          1       /* No Ack (eg mcast) */
1070 #define QOS_ACK_NO_EXP_ACK      2       /* No Explicit Ack */
1071 #define QOS_ACK_BLOCK_ACK       3       /* Block Ack */
1072 #define QOS_ACK_SHIFT           5       /* QoS ACK shift */
1073 #define QOS_ACK_MASK            0x0060  /* QoS ACK mask */
1074 #define QOS_ACK(qos)            (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT)       /* QoS ACK */
1075
1076 /* A-MSDU flag */
1077 #define QOS_AMSDU_SHIFT         7       /* AMSDU shift */
1078 #define QOS_AMSDU_MASK          0x0080  /* AMSDU mask */
1079
1080 /* Management Frames */
1081
1082 /* Management Frame Constants */
1083
1084 /* Fixed fields */
1085 #define DOT11_MNG_AUTH_ALGO_LEN         2       /* d11 management auth. algo. length */
1086 #define DOT11_MNG_AUTH_SEQ_LEN          2       /* d11 management auth. seq. length */
1087 #define DOT11_MNG_BEACON_INT_LEN        2       /* d11 management beacon interval length */
1088 #define DOT11_MNG_CAP_LEN               2       /* d11 management cap. length */
1089 #define DOT11_MNG_AP_ADDR_LEN           6       /* d11 management AP address length */
1090 #define DOT11_MNG_LISTEN_INT_LEN        2       /* d11 management listen interval length */
1091 #define DOT11_MNG_REASON_LEN            2       /* d11 management reason length */
1092 #define DOT11_MNG_AID_LEN               2       /* d11 management AID length */
1093 #define DOT11_MNG_STATUS_LEN            2       /* d11 management status length */
1094 #define DOT11_MNG_TIMESTAMP_LEN         8       /* d11 management timestamp length */
1095
1096 /* DUR/ID field in assoc resp is 0xc000 | AID */
1097 #define DOT11_AID_MASK                  0x3fff  /* d11 AID mask */
1098
1099 /* Reason Codes */
1100 #define DOT11_RC_RESERVED               0       /* d11 RC reserved */
1101 #define DOT11_RC_UNSPECIFIED            1       /* Unspecified reason */
1102 #define DOT11_RC_AUTH_INVAL             2       /* Previous authentication no longer valid */
1103 #define DOT11_RC_DEAUTH_LEAVING         3       /* Deauthenticated because sending station
1104                                                  * is leaving (or has left) IBSS or ESS
1105                                                  */
1106 #define DOT11_RC_INACTIVITY             4       /* Disassociated due to inactivity */
1107 #define DOT11_RC_BUSY                   5       /* Disassociated because AP is unable to handle
1108                                                  * all currently associated stations
1109                                                  */
1110 #define DOT11_RC_INVAL_CLASS_2          6       /* Class 2 frame received from
1111                                                  * nonauthenticated station
1112                                                  */
1113 #define DOT11_RC_INVAL_CLASS_3          7       /* Class 3 frame received from
1114                                                  *  nonassociated station
1115                                                  */
1116 #define DOT11_RC_DISASSOC_LEAVING       8       /* Disassociated because sending station is
1117                                                  * leaving (or has left) BSS
1118                                                  */
1119 #define DOT11_RC_NOT_AUTH               9       /* Station requesting (re)association is not
1120                                                  * authenticated with responding station
1121                                                  */
1122 #define DOT11_RC_BAD_PC                 10      /* Unacceptable power capability element */
1123 #define DOT11_RC_BAD_CHANNELS           11      /* Unacceptable supported channels element */
1124
1125 /* 12 is unused by STA but could be used by AP/GO */
1126 #define DOT11_RC_DISASSOC_BTM           12      /* Disassociated due to BSS Transition Magmt */
1127
1128
1129 /* 32-39 are QSTA specific reasons added in 11e */
1130 #define DOT11_RC_UNSPECIFIED_QOS        32      /* unspecified QoS-related reason */
1131 #define DOT11_RC_INSUFFCIENT_BW         33      /* QAP lacks sufficient bandwidth */
1132 #define DOT11_RC_EXCESSIVE_FRAMES       34      /* excessive number of frames need ack */
1133 #define DOT11_RC_TX_OUTSIDE_TXOP        35      /* transmitting outside the limits of txop */
1134 #define DOT11_RC_LEAVING_QBSS           36      /* QSTA is leaving the QBSS (or restting) */
1135 #define DOT11_RC_BAD_MECHANISM          37      /* does not want to use the mechanism */
1136 #define DOT11_RC_SETUP_NEEDED           38      /* mechanism needs a setup */
1137 #define DOT11_RC_TIMEOUT                39      /* timeout */
1138
1139 #define DOT11_RC_MESH_PEERING_CANCELLED         52
1140 #define DOT11_RC_MESH_MAX_PEERS                 53
1141 #define DOT11_RC_MESH_CONFIG_POLICY_VIOLN       54
1142 #define DOT11_RC_MESH_CLOSE_RECVD               55
1143 #define DOT11_RC_MESH_MAX_RETRIES               56
1144 #define DOT11_RC_MESH_CONFIRM_TIMEOUT           57
1145 #define DOT11_RC_MESH_INVALID_GTK               58
1146 #define DOT11_RC_MESH_INCONSISTENT_PARAMS       59
1147
1148 #define DOT11_RC_MESH_INVALID_SEC_CAP           60
1149 #define DOT11_RC_MESH_PATHERR_NOPROXYINFO       61
1150 #define DOT11_RC_MESH_PATHERR_NOFWINFO          62
1151 #define DOT11_RC_MESH_PATHERR_DSTUNREACH        63
1152 #define DOT11_RC_MESH_MBSSMAC_EXISTS            64
1153 #define DOT11_RC_MESH_CHANSWITCH_REGREQ         65
1154 #define DOT11_RC_MESH_CHANSWITCH_UNSPEC         66
1155
1156 #define DOT11_RC_MAX                    66      /* Reason codes > 66 are reserved */
1157
1158 #define DOT11_RC_TDLS_PEER_UNREACH      25
1159 #define DOT11_RC_TDLS_DOWN_UNSPECIFIED  26
1160
1161 /* Status Codes */
1162 #define DOT11_SC_SUCCESS                0       /* Successful */
1163 #define DOT11_SC_FAILURE                1       /* Unspecified failure */
1164 #define DOT11_SC_TDLS_WAKEUP_SCH_ALT 2  /* TDLS wakeup schedule rejected but alternative  */
1165                                         /* schedule provided */
1166 #define DOT11_SC_TDLS_WAKEUP_SCH_REJ 3  /* TDLS wakeup schedule rejected */
1167 #define DOT11_SC_TDLS_SEC_DISABLED      5       /* TDLS Security disabled */
1168 #define DOT11_SC_LIFETIME_REJ           6       /* Unacceptable lifetime */
1169 #define DOT11_SC_NOT_SAME_BSS           7       /* Not in same BSS */
1170 #define DOT11_SC_CAP_MISMATCH           10      /* Cannot support all requested
1171                                                  * capabilities in the Capability
1172                                                  * Information field
1173                                                  */
1174 #define DOT11_SC_REASSOC_FAIL           11      /* Reassociation denied due to inability
1175                                                  * to confirm that association exists
1176                                                  */
1177 #define DOT11_SC_ASSOC_FAIL             12      /* Association denied due to reason
1178                                                  * outside the scope of this standard
1179                                                  */
1180 #define DOT11_SC_AUTH_MISMATCH          13      /* Responding station does not support
1181                                                  * the specified authentication
1182                                                  * algorithm
1183                                                  */
1184 #define DOT11_SC_AUTH_SEQ               14      /* Received an Authentication frame
1185                                                  * with authentication transaction
1186                                                  * sequence number out of expected
1187                                                  * sequence
1188                                                  */
1189 #define DOT11_SC_AUTH_CHALLENGE_FAIL    15      /* Authentication rejected because of
1190                                                  * challenge failure
1191                                                  */
1192 #define DOT11_SC_AUTH_TIMEOUT           16      /* Authentication rejected due to timeout
1193                                                  * waiting for next frame in sequence
1194                                                  */
1195 #define DOT11_SC_ASSOC_BUSY_FAIL        17      /* Association denied because AP is
1196                                                  * unable to handle additional
1197                                                  * associated stations
1198                                                  */
1199 #define DOT11_SC_ASSOC_RATE_MISMATCH    18      /* Association denied due to requesting
1200                                                  * station not supporting all of the
1201                                                  * data rates in the BSSBasicRateSet
1202                                                  * parameter
1203                                                  */
1204 #define DOT11_SC_ASSOC_SHORT_REQUIRED   19      /* Association denied due to requesting
1205                                                  * station not supporting the Short
1206                                                  * Preamble option
1207                                                  */
1208 #define DOT11_SC_ASSOC_PBCC_REQUIRED    20      /* Association denied due to requesting
1209                                                  * station not supporting the PBCC
1210                                                  * Modulation option
1211                                                  */
1212 #define DOT11_SC_ASSOC_AGILITY_REQUIRED 21      /* Association denied due to requesting
1213                                                  * station not supporting the Channel
1214                                                  * Agility option
1215                                                  */
1216 #define DOT11_SC_ASSOC_SPECTRUM_REQUIRED        22      /* Association denied because Spectrum
1217                                                          * Management capability is required.
1218                                                          */
1219 #define DOT11_SC_ASSOC_BAD_POWER_CAP    23      /* Association denied because the info
1220                                                  * in the Power Cap element is
1221                                                  * unacceptable.
1222                                                  */
1223 #define DOT11_SC_ASSOC_BAD_SUP_CHANNELS 24      /* Association denied because the info
1224                                                  * in the Supported Channel element is
1225                                                  * unacceptable
1226                                                  */
1227 #define DOT11_SC_ASSOC_SHORTSLOT_REQUIRED       25      /* Association denied due to requesting
1228                                                          * station not supporting the Short Slot
1229                                                          * Time option
1230                                                          */
1231 #define DOT11_SC_ASSOC_DSSSOFDM_REQUIRED 26     /* Association denied because requesting station
1232                                                  * does not support the DSSS-OFDM option
1233                                                  */
1234 #define DOT11_SC_ASSOC_HT_REQUIRED      27      /* Association denied because the requesting
1235                                                  * station does not support HT features
1236                                                  */
1237 #define DOT11_SC_ASSOC_R0KH_UNREACHABLE 28      /* Association denied due to AP
1238                                                  * being unable to reach the R0 Key Holder
1239                                                  */
1240 #define DOT11_SC_ASSOC_TRY_LATER        30      /* Association denied temporarily, try again later
1241                                                  */
1242 #define DOT11_SC_ASSOC_MFP_VIOLATION    31      /* Association denied due to Robust Management
1243                                                  * frame policy violation
1244                                                  */
1245
1246 #define DOT11_SC_DECLINED               37      /* request declined */
1247 #define DOT11_SC_INVALID_PARAMS         38      /* One or more params have invalid values */
1248 #define DOT11_SC_INVALID_PAIRWISE_CIPHER        42 /* invalid pairwise cipher */
1249 #define DOT11_SC_INVALID_AKMP           43      /* Association denied due to invalid AKMP */
1250 #define DOT11_SC_INVALID_RSNIE_CAP      45      /* invalid RSN IE capabilities */
1251 #define DOT11_SC_DLS_NOT_ALLOWED        48      /* DLS is not allowed in the BSS by policy */
1252 #define DOT11_SC_INVALID_PMKID          53      /* Association denied due to invalid PMKID */
1253 #define DOT11_SC_INVALID_MDID           54      /* Association denied due to invalid MDID */
1254 #define DOT11_SC_INVALID_FTIE           55      /* Association denied due to invalid FTIE */
1255
1256 #define DOT11_SC_ADV_PROTO_NOT_SUPPORTED        59      /* ad proto not supported */
1257 #define DOT11_SC_NO_OUTSTAND_REQ                        60      /* no outstanding req */
1258 #define DOT11_SC_RSP_NOT_RX_FROM_SERVER         61      /* no response from server */
1259 #define DOT11_SC_TIMEOUT                                        62      /* timeout */
1260 #define DOT11_SC_QUERY_RSP_TOO_LARGE            63      /* query rsp too large */
1261 #define DOT11_SC_SERVER_UNREACHABLE                     65      /* server unreachable */
1262
1263 #define DOT11_SC_UNEXP_MSG                      70      /* Unexpected message */
1264 #define DOT11_SC_INVALID_SNONCE         71      /* Invalid SNonce */
1265 #define DOT11_SC_INVALID_RSNIE          72      /* Invalid contents of RSNIE */
1266
1267 #define DOT11_SC_ANTICLOG_TOCKEN_REQUIRED       76      /* Anti-clogging tocken required */
1268 #define DOT11_SC_INVALID_FINITE_CYCLIC_GRP      77      /* Invalid contents of RSNIE */
1269
1270 #define DOT11_SC_ASSOC_VHT_REQUIRED     104     /* Association denied because the requesting
1271                                                  * station does not support VHT features.
1272                                                  */
1273
1274 #define DOT11_SC_TRANSMIT_FAILURE       79      /* transmission failure */
1275
1276 /* Info Elts, length of INFORMATION portion of Info Elts */
1277 #define DOT11_MNG_DS_PARAM_LEN                  1       /* d11 management DS parameter length */
1278 #define DOT11_MNG_IBSS_PARAM_LEN                2       /* d11 management IBSS parameter length */
1279
1280 /* TIM Info element has 3 bytes fixed info in INFORMATION field,
1281  * followed by 1 to 251 bytes of Partial Virtual Bitmap
1282  */
1283 #define DOT11_MNG_TIM_FIXED_LEN                 3       /* d11 management TIM fixed length */
1284 #define DOT11_MNG_TIM_DTIM_COUNT                0       /* d11 management DTIM count */
1285 #define DOT11_MNG_TIM_DTIM_PERIOD               1       /* d11 management DTIM period */
1286 #define DOT11_MNG_TIM_BITMAP_CTL                2       /* d11 management TIM BITMAP control  */
1287 #define DOT11_MNG_TIM_PVB                       3       /* d11 management TIM PVB */
1288
1289 /* TLV defines */
1290 #define TLV_TAG_OFF             0       /* tag offset */
1291 #define TLV_LEN_OFF             1       /* length offset */
1292 #define TLV_HDR_LEN             2       /* header length */
1293 #define TLV_BODY_OFF            2       /* body offset */
1294 #define TLV_BODY_LEN_MAX        255     /* max body length */
1295
1296 /* Management Frame Information Element IDs */
1297 #define DOT11_MNG_SSID_ID                       0       /* d11 management SSID id */
1298 #define DOT11_MNG_RATES_ID                      1       /* d11 management rates id */
1299 #define DOT11_MNG_FH_PARMS_ID                   2       /* d11 management FH parameter id */
1300 #define DOT11_MNG_DS_PARMS_ID                   3       /* d11 management DS parameter id */
1301 #define DOT11_MNG_CF_PARMS_ID                   4       /* d11 management CF parameter id */
1302 #define DOT11_MNG_TIM_ID                        5       /* d11 management TIM id */
1303 #define DOT11_MNG_IBSS_PARMS_ID                 6       /* d11 management IBSS parameter id */
1304 #define DOT11_MNG_COUNTRY_ID                    7       /* d11 management country id */
1305 #define DOT11_MNG_HOPPING_PARMS_ID              8       /* d11 management hopping parameter id */
1306 #define DOT11_MNG_HOPPING_TABLE_ID              9       /* d11 management hopping table id */
1307 #define DOT11_MNG_REQUEST_ID                    10      /* d11 management request id */
1308 #define DOT11_MNG_QBSS_LOAD_ID                  11      /* d11 management QBSS Load id */
1309 #define DOT11_MNG_EDCA_PARAM_ID                 12      /* 11E EDCA Parameter id */
1310 #define DOT11_MNG_TSPEC_ID                      13      /* d11 management TSPEC id */
1311 #define DOT11_MNG_TCLAS_ID                      14      /* d11 management TCLAS id */
1312 #define DOT11_MNG_CHALLENGE_ID                  16      /* d11 management chanllenge id */
1313 #define DOT11_MNG_PWR_CONSTRAINT_ID             32      /* 11H PowerConstraint */
1314 #define DOT11_MNG_PWR_CAP_ID                    33      /* 11H PowerCapability */
1315 #define DOT11_MNG_TPC_REQUEST_ID                34      /* 11H TPC Request */
1316 #define DOT11_MNG_TPC_REPORT_ID                 35      /* 11H TPC Report */
1317 #define DOT11_MNG_SUPP_CHANNELS_ID              36      /* 11H Supported Channels */
1318 #define DOT11_MNG_CHANNEL_SWITCH_ID             37      /* 11H ChannelSwitch Announcement */
1319 #define DOT11_MNG_MEASURE_REQUEST_ID            38      /* 11H MeasurementRequest */
1320 #define DOT11_MNG_MEASURE_REPORT_ID             39      /* 11H MeasurementReport */
1321 #define DOT11_MNG_QUIET_ID                      40      /* 11H Quiet */
1322 #define DOT11_MNG_IBSS_DFS_ID                   41      /* 11H IBSS_DFS */
1323 #define DOT11_MNG_ERP_ID                        42      /* d11 management ERP id */
1324 #define DOT11_MNG_TS_DELAY_ID                   43      /* d11 management TS Delay id */
1325 #define DOT11_MNG_TCLAS_PROC_ID                 44      /* d11 management TCLAS processing id */
1326 #define DOT11_MNG_HT_CAP                        45      /* d11 mgmt HT cap id */
1327 #define DOT11_MNG_QOS_CAP_ID                    46      /* 11E QoS Capability id */
1328 #define DOT11_MNG_NONERP_ID                     47      /* d11 management NON-ERP id */
1329 #define DOT11_MNG_RSN_ID                        48      /* d11 management RSN id */
1330 #define DOT11_MNG_EXT_RATES_ID                  50      /* d11 management ext. rates id */
1331 #define DOT11_MNG_AP_CHREP_ID                   51      /* 11k AP Channel report id */
1332 #define DOT11_MNG_NEIGHBOR_REP_ID               52      /* 11k & 11v Neighbor report id */
1333 #define DOT11_MNG_RCPI_ID                       53      /* 11k RCPI */
1334 #define DOT11_MNG_MDIE_ID                       54      /* 11r Mobility domain id */
1335 #define DOT11_MNG_FTIE_ID                       55      /* 11r Fast Bss Transition id */
1336 #define DOT11_MNG_FT_TI_ID                      56      /* 11r Timeout Interval id */
1337 #define DOT11_MNG_RDE_ID                        57      /* 11r RIC Data Element id */
1338 #define DOT11_MNG_REGCLASS_ID                   59      /* d11 management regulatory class id */
1339 #define DOT11_MNG_EXT_CSA_ID                    60      /* d11 Extended CSA */
1340 #define DOT11_MNG_HT_ADD                        61      /* d11 mgmt additional HT info */
1341 #define DOT11_MNG_EXT_CHANNEL_OFFSET            62      /* d11 mgmt ext channel offset */
1342 #define DOT11_MNG_BSS_AVR_ACCESS_DELAY_ID       63      /* 11k bss average access delay */
1343 #define DOT11_MNG_ANTENNA_ID                    64      /* 11k antenna id */
1344 #define DOT11_MNG_RSNI_ID                       65      /* 11k RSNI id */
1345 #define DOT11_MNG_MEASUREMENT_PILOT_TX_ID       66      /* 11k measurement pilot tx info id */
1346 #define DOT11_MNG_BSS_AVAL_ADMISSION_CAP_ID     67      /* 11k bss aval admission cap id */
1347 #define DOT11_MNG_BSS_AC_ACCESS_DELAY_ID        68      /* 11k bss AC access delay id */
1348 #define DOT11_MNG_WAPI_ID                       68      /* d11 management WAPI id */
1349 #define DOT11_MNG_TIME_ADVERTISE_ID     69      /* 11p time advertisement */
1350 #define DOT11_MNG_RRM_CAP_ID            70      /* 11k radio measurement capability */
1351 #define DOT11_MNG_MULTIPLE_BSSID_ID             71      /* 11k multiple BSSID id */
1352 #define DOT11_MNG_HT_BSS_COEXINFO_ID            72      /* d11 mgmt OBSS Coexistence INFO */
1353 #define DOT11_MNG_HT_BSS_CHANNEL_REPORT_ID      73      /* d11 mgmt OBSS Intolerant Channel list */
1354 #define DOT11_MNG_HT_OBSS_ID                    74      /* d11 mgmt OBSS HT info */
1355 #define DOT11_MNG_MMIE_ID                       76      /* d11 mgmt MIC IE */
1356 #define DOT11_MNG_FMS_DESCR_ID                  86      /* 11v FMS descriptor */
1357 #define DOT11_MNG_FMS_REQ_ID                    87      /* 11v FMS request id */
1358 #define DOT11_MNG_FMS_RESP_ID                   88      /* 11v FMS response id */
1359 #define DOT11_MNG_BSS_MAX_IDLE_PERIOD_ID        90      /* 11v bss max idle id */
1360 #define DOT11_MNG_TFS_REQUEST_ID                91      /* 11v tfs request id */
1361 #define DOT11_MNG_TFS_RESPONSE_ID               92      /* 11v tfs response id */
1362 #define DOT11_MNG_WNM_SLEEP_MODE_ID             93      /* 11v wnm-sleep mode id */
1363 #define DOT11_MNG_TIMBC_REQ_ID                  94      /* 11v TIM broadcast request id */
1364 #define DOT11_MNG_TIMBC_RESP_ID                 95      /* 11v TIM broadcast response id */
1365 #define DOT11_MNG_CHANNEL_USAGE                 97      /* 11v channel usage */
1366 #define DOT11_MNG_TIME_ZONE_ID                  98      /* 11v time zone */
1367 #define DOT11_MNG_DMS_REQUEST_ID                99      /* 11v dms request id */
1368 #define DOT11_MNG_DMS_RESPONSE_ID               100     /* 11v dms response id */
1369 #define DOT11_MNG_LINK_IDENTIFIER_ID            101     /* 11z TDLS Link Identifier IE */
1370 #define DOT11_MNG_WAKEUP_SCHEDULE_ID            102     /* 11z TDLS Wakeup Schedule IE */
1371 #define DOT11_MNG_CHANNEL_SWITCH_TIMING_ID      104     /* 11z TDLS Channel Switch Timing IE */
1372 #define DOT11_MNG_PTI_CONTROL_ID                105     /* 11z TDLS PTI Control IE */
1373 #define DOT11_MNG_PU_BUFFER_STATUS_ID   106     /* 11z TDLS PU Buffer Status IE */
1374 #define DOT11_MNG_INTERWORKING_ID               107     /* 11u interworking */
1375 #define DOT11_MNG_ADVERTISEMENT_ID              108     /* 11u advertisement protocol */
1376 #define DOT11_MNG_EXP_BW_REQ_ID                 109     /* 11u expedited bandwith request */
1377 #define DOT11_MNG_QOS_MAP_ID                    110     /* 11u QoS map set */
1378 #define DOT11_MNG_ROAM_CONSORT_ID               111     /* 11u roaming consortium */
1379 #define DOT11_MNG_EMERGCY_ALERT_ID              112     /* 11u emergency alert identifier */
1380 #define DOT11_MNG_MESH_CONFIG                   113     /* Mesh Configuration */
1381 #define DOT11_MNG_MESH_ID                       114     /* Mesh ID */
1382 #define DOT11_MNG_MESH_PEER_MGMT_ID             117     /* Mesh PEER MGMT IE */
1383
1384 #define DOT11_MNG_EXT_CAP_ID                    127     /* d11 mgmt ext capability */
1385 #define DOT11_MNG_EXT_PREQ_ID                   130     /* Mesh PREQ IE */
1386 #define DOT11_MNG_EXT_PREP_ID                   131     /* Mesh PREP IE */
1387 #define DOT11_MNG_EXT_PERR_ID                   132     /* Mesh PERR IE */
1388 #define DOT11_MNG_VHT_CAP_ID                    191     /* d11 mgmt VHT cap id */
1389 #define DOT11_MNG_VHT_OPERATION_ID              192     /* d11 mgmt VHT op id */
1390 #define DOT11_MNG_EXT_BSSLOAD_ID                193     /* d11 mgmt VHT extended bss load id */
1391 #define DOT11_MNG_WIDE_BW_CHANNEL_SWITCH_ID             194     /* Wide BW Channel Switch IE */
1392 #define DOT11_MNG_VHT_TRANSMIT_POWER_ENVELOPE_ID        195     /* VHT transmit Power Envelope IE */
1393 #define DOT11_MNG_CHANNEL_SWITCH_WRAPPER_ID             196     /* Channel Switch Wrapper IE */
1394 #define DOT11_MNG_AID_ID                                        197     /* Association ID  IE */
1395 #define DOT11_MNG_OPER_MODE_NOTIF_ID    199     /* d11 mgmt VHT oper mode notif */
1396 #define DOT11_MNG_FTM_PARAMS_ID                 206
1397
1398 #define DOT11_MNG_WPA_ID                        221     /* d11 management WPA id */
1399 #define DOT11_MNG_PROPR_ID                      221
1400 /* should start using this one instead of above two */
1401 #define DOT11_MNG_VS_ID                         221     /* d11 management Vendor Specific IE */
1402
1403 /* Rate Defines */
1404
1405 /* Valid rates for the Supported Rates and Extended Supported Rates IEs.
1406  * Encoding is the rate in 500kbps units, rouding up for fractional values.
1407  * 802.11-2012, section 6.5.5.2, DATA_RATE parameter enumerates all the values.
1408  * The rate values cover DSSS, HR/DSSS, ERP, and OFDM phy rates.
1409  * The defines below do not cover the rates specific to 10MHz, {3, 4.5, 27},
1410  * and 5MHz, {1.5, 2.25, 3, 4.5, 13.5}, which are not supported by Broadcom devices.
1411  */
1412
1413 #define DOT11_RATE_1M   2       /* 1  Mbps in 500kbps units */
1414 #define DOT11_RATE_2M   4       /* 2  Mbps in 500kbps units */
1415 #define DOT11_RATE_5M5  11      /* 5.5 Mbps in 500kbps units */
1416 #define DOT11_RATE_11M  22      /* 11 Mbps in 500kbps units */
1417 #define DOT11_RATE_6M   12      /* 6  Mbps in 500kbps units */
1418 #define DOT11_RATE_9M   18      /* 9  Mbps in 500kbps units */
1419 #define DOT11_RATE_12M  24      /* 12 Mbps in 500kbps units */
1420 #define DOT11_RATE_18M  36      /* 18 Mbps in 500kbps units */
1421 #define DOT11_RATE_24M  48      /* 24 Mbps in 500kbps units */
1422 #define DOT11_RATE_36M  72      /* 36 Mbps in 500kbps units */
1423 #define DOT11_RATE_48M  96      /* 48 Mbps in 500kbps units */
1424 #define DOT11_RATE_54M  108     /* 54 Mbps in 500kbps units */
1425 #define DOT11_RATE_MAX  108     /* highest rate (54 Mbps) in 500kbps units */
1426
1427 /* Supported Rates and Extended Supported Rates IEs
1428  * The supported rates octets are defined a the MSB indicatin a Basic Rate
1429  * and bits 0-6 as the rate value
1430  */
1431 #define DOT11_RATE_BASIC                0x80 /* flag for a Basic Rate */
1432 #define DOT11_RATE_MASK                 0x7F /* mask for numeric part of rate */
1433
1434 /* BSS Membership Selector parameters
1435  * 802.11-2012 and 802.11ac_D4.0 sec 8.4.2.3
1436  * These selector values are advertised in Supported Rates and Extended Supported Rates IEs
1437  * in the supported rates list with the Basic rate bit set.
1438  * Constants below include the basic bit.
1439  */
1440 #define DOT11_BSS_MEMBERSHIP_HT         0xFF  /* Basic 0x80 + 127, HT Required to join */
1441 #define DOT11_BSS_MEMBERSHIP_VHT        0xFE  /* Basic 0x80 + 126, VHT Required to join */
1442
1443 /* ERP info element bit values */
1444 #define DOT11_MNG_ERP_LEN                       1       /* ERP is currently 1 byte long */
1445 #define DOT11_MNG_NONERP_PRESENT                0x01    /* NonERP (802.11b) STAs are present
1446                                                          *in the BSS
1447                                                          */
1448 #define DOT11_MNG_USE_PROTECTION                0x02    /* Use protection mechanisms for
1449                                                          *ERP-OFDM frames
1450                                                          */
1451 #define DOT11_MNG_BARKER_PREAMBLE               0x04    /* Short Preambles: 0 == allowed,
1452                                                          * 1 == not allowed
1453                                                          */
1454 /* TS Delay element offset & size */
1455 #define DOT11_MGN_TS_DELAY_LEN          4       /* length of TS DELAY IE */
1456 #define TS_DELAY_FIELD_SIZE                     4       /* TS DELAY field size */
1457
1458 /* Capability Information Field */
1459 #define DOT11_CAP_ESS                           0x0001  /* d11 cap. ESS */
1460 #define DOT11_CAP_IBSS                          0x0002  /* d11 cap. IBSS */
1461 #define DOT11_CAP_POLLABLE                      0x0004  /* d11 cap. pollable */
1462 #define DOT11_CAP_POLL_RQ                       0x0008  /* d11 cap. poll request */
1463 #define DOT11_CAP_PRIVACY                       0x0010  /* d11 cap. privacy */
1464 #define DOT11_CAP_SHORT                         0x0020  /* d11 cap. short */
1465 #define DOT11_CAP_PBCC                          0x0040  /* d11 cap. PBCC */
1466 #define DOT11_CAP_AGILITY                       0x0080  /* d11 cap. agility */
1467 #define DOT11_CAP_SPECTRUM                      0x0100  /* d11 cap. spectrum */
1468 #define DOT11_CAP_QOS                           0x0200  /* d11 cap. qos */
1469 #define DOT11_CAP_SHORTSLOT                     0x0400  /* d11 cap. shortslot */
1470 #define DOT11_CAP_APSD                          0x0800  /* d11 cap. apsd */
1471 #define DOT11_CAP_RRM                           0x1000  /* d11 cap. 11k radio measurement */
1472 #define DOT11_CAP_CCK_OFDM                      0x2000  /* d11 cap. CCK/OFDM */
1473 #define DOT11_CAP_DELAY_BA                      0x4000  /* d11 cap. delayed block ack */
1474 #define DOT11_CAP_IMMEDIATE_BA                  0x8000  /* d11 cap. immediate block ack */
1475
1476 /* Extended capabilities IE bitfields */
1477 /* 20/40 BSS Coexistence Management support bit position */
1478 #define DOT11_EXT_CAP_OBSS_COEX_MGMT            0
1479 /* Extended Channel Switching support bit position */
1480 #define DOT11_EXT_CAP_EXT_CHAN_SWITCHING        2
1481 /* scheduled PSMP support bit position */
1482 #define DOT11_EXT_CAP_SPSMP                     6
1483 /*  Flexible Multicast Service */
1484 #define DOT11_EXT_CAP_FMS                       11
1485 /* proxy ARP service support bit position */
1486 #define DOT11_EXT_CAP_PROXY_ARP                 12
1487 /* Civic Location */
1488 #define DOT11_EXT_CAP_CIVIC_LOC                 14
1489 /* Geospatial Location */
1490 #define DOT11_EXT_CAP_LCI                       15
1491 /* Traffic Filter Service */
1492 #define DOT11_EXT_CAP_TFS                       16
1493 /* WNM-Sleep Mode */
1494 #define DOT11_EXT_CAP_WNM_SLEEP                 17
1495 /* TIM Broadcast service */
1496 #define DOT11_EXT_CAP_TIMBC                     18
1497 /* BSS Transition Management support bit position */
1498 #define DOT11_EXT_CAP_BSSTRANS_MGMT             19
1499 /* Direct Multicast Service */
1500 #define DOT11_EXT_CAP_DMS                       26
1501 /* Interworking support bit position */
1502 #define DOT11_EXT_CAP_IW                        31
1503 /* QoS map support bit position */
1504 #define DOT11_EXT_CAP_QOS_MAP           32
1505 /* service Interval granularity bit position and mask */
1506 #define DOT11_EXT_CAP_SI                        41
1507 #define DOT11_EXT_CAP_SI_MASK                   0x0E
1508 /* WNM notification */
1509 #define DOT11_EXT_CAP_WNM_NOTIF                 46
1510 /* Operating mode notification - VHT (11ac D3.0 - 8.4.2.29) */
1511 #define DOT11_EXT_CAP_OPER_MODE_NOTIF           62
1512 /* Fine timing measurement - D3.0 */
1513 #define DOT11_EXT_CAP_FTM_RESPONDER             70
1514 #define DOT11_EXT_CAP_FTM_INITIATOR             71 /* tentative 11mcd3.0 */
1515 #ifdef WL_FTM
1516 #define DOT11_EXT_CAP_MAX_BIT_IDX               95      /* !!!update this please!!! */
1517 #else
1518 #define DOT11_EXT_CAP_MAX_BIT_IDX               62      /* !!!update this please!!! */
1519 #endif
1520
1521 /* extended capability */
1522 #ifndef DOT11_EXTCAP_LEN_MAX
1523 #define DOT11_EXTCAP_LEN_MAX ((DOT11_EXT_CAP_MAX_BIT_IDX + 8) >> 3)
1524 #endif
1525
1526 BWL_PRE_PACKED_STRUCT struct dot11_extcap {
1527         uint8 extcap[DOT11_EXTCAP_LEN_MAX];
1528 } BWL_POST_PACKED_STRUCT;
1529 typedef struct dot11_extcap dot11_extcap_t;
1530
1531 /* VHT Operating mode bit fields -  (11ac D3.0 - 8.4.1.50) */
1532 #define DOT11_OPER_MODE_CHANNEL_WIDTH_SHIFT 0
1533 #define DOT11_OPER_MODE_CHANNEL_WIDTH_MASK 0x3
1534 #define DOT11_OPER_MODE_RXNSS_SHIFT 4
1535 #define DOT11_OPER_MODE_RXNSS_MASK 0x70
1536 #define DOT11_OPER_MODE_RXNSS_TYPE_SHIFT 7
1537 #define DOT11_OPER_MODE_RXNSS_TYPE_MASK 0x80
1538
1539 #define DOT11_OPER_MODE(type, nss, chanw) (\
1540         ((type) << DOT11_OPER_MODE_RXNSS_TYPE_SHIFT &\
1541                  DOT11_OPER_MODE_RXNSS_TYPE_MASK) |\
1542         (((nss) - 1) << DOT11_OPER_MODE_RXNSS_SHIFT & DOT11_OPER_MODE_RXNSS_MASK) |\
1543         ((chanw) << DOT11_OPER_MODE_CHANNEL_WIDTH_SHIFT &\
1544                  DOT11_OPER_MODE_CHANNEL_WIDTH_MASK))
1545
1546 #define DOT11_OPER_MODE_CHANNEL_WIDTH(mode) \
1547         (((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK)\
1548                 >> DOT11_OPER_MODE_CHANNEL_WIDTH_SHIFT)
1549 #define DOT11_OPER_MODE_RXNSS(mode) \
1550         ((((mode) & DOT11_OPER_MODE_RXNSS_MASK)         \
1551                 >> DOT11_OPER_MODE_RXNSS_SHIFT) + 1)
1552 #define DOT11_OPER_MODE_RXNSS_TYPE(mode) \
1553         (((mode) & DOT11_OPER_MODE_RXNSS_TYPE_MASK)\
1554                 >> DOT11_OPER_MODE_RXNSS_TYPE_SHIFT)
1555
1556 #define DOT11_OPER_MODE_20MHZ 0
1557 #define DOT11_OPER_MODE_40MHZ 1
1558 #define DOT11_OPER_MODE_80MHZ 2
1559 #define DOT11_OPER_MODE_160MHZ 3
1560 #define DOT11_OPER_MODE_8080MHZ 3
1561
1562 #define DOT11_OPER_MODE_CHANNEL_WIDTH_20MHZ(mode) (\
1563         ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_20MHZ)
1564 #define DOT11_OPER_MODE_CHANNEL_WIDTH_40MHZ(mode) (\
1565         ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_40MHZ)
1566 #define DOT11_OPER_MODE_CHANNEL_WIDTH_80MHZ(mode) (\
1567         ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_80MHZ)
1568 #define DOT11_OPER_MODE_CHANNEL_WIDTH_160MHZ(mode) (\
1569         ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_160MHZ)
1570 #define DOT11_OPER_MODE_CHANNEL_WIDTH_8080MHZ(mode) (\
1571         ((mode) & DOT11_OPER_MODE_CHANNEL_WIDTH_MASK) == DOT11_OPER_MODE_8080MHZ)
1572
1573 /* Operating mode information element 802.11ac D3.0 - 8.4.2.168 */
1574 BWL_PRE_PACKED_STRUCT struct dot11_oper_mode_notif_ie {
1575         uint8 mode;
1576 } BWL_POST_PACKED_STRUCT;
1577 typedef struct dot11_oper_mode_notif_ie dot11_oper_mode_notif_ie_t;
1578
1579 #define DOT11_OPER_MODE_NOTIF_IE_LEN 1
1580
1581 /* Extended Capability Information Field */
1582 #define DOT11_OBSS_COEX_MNG_SUPPORT     0x01    /* 20/40 BSS Coexistence Management support */
1583
1584 /*
1585  * Action Frame Constants
1586  */
1587 #define DOT11_ACTION_HDR_LEN            2       /* action frame category + action field */
1588 #define DOT11_ACTION_CAT_OFF            0       /* category offset */
1589 #define DOT11_ACTION_ACT_OFF            1       /* action offset */
1590
1591 /* Action Category field (sec 8.4.1.11) */
1592 #define DOT11_ACTION_CAT_ERR_MASK       0x80    /* category error mask */
1593 #define DOT11_ACTION_CAT_MASK           0x7F    /* category mask */
1594 #define DOT11_ACTION_CAT_SPECT_MNG      0       /* category spectrum management */
1595 #define DOT11_ACTION_CAT_QOS            1       /* category QoS */
1596 #define DOT11_ACTION_CAT_DLS            2       /* category DLS */
1597 #define DOT11_ACTION_CAT_BLOCKACK       3       /* category block ack */
1598 #define DOT11_ACTION_CAT_PUBLIC         4       /* category public */
1599 #define DOT11_ACTION_CAT_RRM            5       /* category radio measurements */
1600 #define DOT11_ACTION_CAT_FBT    6       /* category fast bss transition */
1601 #define DOT11_ACTION_CAT_HT             7       /* category for HT */
1602 #define DOT11_ACTION_CAT_SA_QUERY       8       /* security association query */
1603 #define DOT11_ACTION_CAT_PDPA           9       /* protected dual of public action */
1604 #define DOT11_ACTION_CAT_WNM            10      /* category for WNM */
1605 #define DOT11_ACTION_CAT_UWNM           11      /* category for Unprotected WNM */
1606 #define DOT11_ACTION_CAT_MESH           13      /* category for Mesh */
1607 #define DOT11_ACTION_CAT_SELFPROT       15      /* category for Mesh, self protected */
1608 #define DOT11_ACTION_NOTIFICATION       17
1609 #define DOT11_ACTION_CAT_VHT            21      /* VHT action */
1610 #define DOT11_ACTION_CAT_VSP            126     /* protected vendor specific */
1611 #define DOT11_ACTION_CAT_VS             127     /* category Vendor Specific */
1612
1613 /* Spectrum Management Action IDs (sec 7.4.1) */
1614 #define DOT11_SM_ACTION_M_REQ           0       /* d11 action measurement request */
1615 #define DOT11_SM_ACTION_M_REP           1       /* d11 action measurement response */
1616 #define DOT11_SM_ACTION_TPC_REQ         2       /* d11 action TPC request */
1617 #define DOT11_SM_ACTION_TPC_REP         3       /* d11 action TPC response */
1618 #define DOT11_SM_ACTION_CHANNEL_SWITCH  4       /* d11 action channel switch */
1619 #define DOT11_SM_ACTION_EXT_CSA         5       /* d11 extened CSA for 11n */
1620
1621 /* QoS action ids */
1622 #define DOT11_QOS_ACTION_ADDTS_REQ      0       /* d11 action ADDTS request */
1623 #define DOT11_QOS_ACTION_ADDTS_RESP     1       /* d11 action ADDTS response */
1624 #define DOT11_QOS_ACTION_DELTS          2       /* d11 action DELTS */
1625 #define DOT11_QOS_ACTION_SCHEDULE       3       /* d11 action schedule */
1626 #define DOT11_QOS_ACTION_QOS_MAP        4       /* d11 action QOS map */
1627
1628 /* HT action ids */
1629 #define DOT11_ACTION_ID_HT_CH_WIDTH     0       /* notify channel width action id */
1630 #define DOT11_ACTION_ID_HT_MIMO_PS      1       /* mimo ps action id */
1631
1632 /* Public action ids */
1633 #define DOT11_PUB_ACTION_BSS_COEX_MNG   0       /* 20/40 Coexistence Management action id */
1634 #define DOT11_PUB_ACTION_CHANNEL_SWITCH 4       /* d11 action channel switch */
1635 #define DOT11_PUB_ACTION_GAS_CB_REQ     12      /* GAS Comeback Request */
1636 #define DOT11_PUB_ACTION_FTM_REQ        32              /* FTM request */
1637 #define DOT11_PUB_ACTION_FTM            33              /* FTM measurement */
1638
1639 /* Block Ack action types */
1640 #define DOT11_BA_ACTION_ADDBA_REQ       0       /* ADDBA Req action frame type */
1641 #define DOT11_BA_ACTION_ADDBA_RESP      1       /* ADDBA Resp action frame type */
1642 #define DOT11_BA_ACTION_DELBA           2       /* DELBA action frame type */
1643
1644 /* ADDBA action parameters */
1645 #define DOT11_ADDBA_PARAM_AMSDU_SUP     0x0001  /* AMSDU supported under BA */
1646 #define DOT11_ADDBA_PARAM_POLICY_MASK   0x0002  /* policy mask(ack vs delayed) */
1647 #define DOT11_ADDBA_PARAM_POLICY_SHIFT  1       /* policy shift */
1648 #define DOT11_ADDBA_PARAM_TID_MASK      0x003c  /* tid mask */
1649 #define DOT11_ADDBA_PARAM_TID_SHIFT     2       /* tid shift */
1650 #define DOT11_ADDBA_PARAM_BSIZE_MASK    0xffc0  /* buffer size mask */
1651 #define DOT11_ADDBA_PARAM_BSIZE_SHIFT   6       /* buffer size shift */
1652
1653 #define DOT11_ADDBA_POLICY_DELAYED      0       /* delayed BA policy */
1654 #define DOT11_ADDBA_POLICY_IMMEDIATE    1       /* immediate BA policy */
1655
1656 /* Fast Transition action types */
1657 #define DOT11_FT_ACTION_FT_RESERVED             0
1658 #define DOT11_FT_ACTION_FT_REQ                  1       /* FBT request - for over-the-DS FBT */
1659 #define DOT11_FT_ACTION_FT_RES                  2       /* FBT response - for over-the-DS FBT */
1660 #define DOT11_FT_ACTION_FT_CON                  3       /* FBT confirm - for OTDS with RRP */
1661 #define DOT11_FT_ACTION_FT_ACK                  4       /* FBT ack */
1662
1663 /* DLS action types */
1664 #define DOT11_DLS_ACTION_REQ                    0       /* DLS Request */
1665 #define DOT11_DLS_ACTION_RESP                   1       /* DLS Response */
1666 #define DOT11_DLS_ACTION_TD                     2       /* DLS Teardown */
1667
1668 /* Wireless Network Management (WNM) action types */
1669 #define DOT11_WNM_ACTION_EVENT_REQ              0
1670 #define DOT11_WNM_ACTION_EVENT_REP              1
1671 #define DOT11_WNM_ACTION_DIAG_REQ               2
1672 #define DOT11_WNM_ACTION_DIAG_REP               3
1673 #define DOT11_WNM_ACTION_LOC_CFG_REQ            4
1674 #define DOT11_WNM_ACTION_LOC_RFG_RESP           5
1675 #define DOT11_WNM_ACTION_BSSTRANS_QUERY         6
1676 #define DOT11_WNM_ACTION_BSSTRANS_REQ           7
1677 #define DOT11_WNM_ACTION_BSSTRANS_RESP          8
1678 #define DOT11_WNM_ACTION_FMS_REQ                9
1679 #define DOT11_WNM_ACTION_FMS_RESP               10
1680 #define DOT11_WNM_ACTION_COL_INTRFRNCE_REQ      11
1681 #define DOT11_WNM_ACTION_COL_INTRFRNCE_REP      12
1682 #define DOT11_WNM_ACTION_TFS_REQ                13
1683 #define DOT11_WNM_ACTION_TFS_RESP               14
1684 #define DOT11_WNM_ACTION_TFS_NOTIFY_REQ         15
1685 #define DOT11_WNM_ACTION_WNM_SLEEP_REQ          16
1686 #define DOT11_WNM_ACTION_WNM_SLEEP_RESP         17
1687 #define DOT11_WNM_ACTION_TIMBC_REQ              18
1688 #define DOT11_WNM_ACTION_TIMBC_RESP             19
1689 #define DOT11_WNM_ACTION_QOS_TRFC_CAP_UPD       20
1690 #define DOT11_WNM_ACTION_CHAN_USAGE_REQ         21
1691 #define DOT11_WNM_ACTION_CHAN_USAGE_RESP        22
1692 #define DOT11_WNM_ACTION_DMS_REQ                23
1693 #define DOT11_WNM_ACTION_DMS_RESP               24
1694 #define DOT11_WNM_ACTION_TMNG_MEASUR_REQ        25
1695 #define DOT11_WNM_ACTION_NOTFCTN_REQ            26
1696 #define DOT11_WNM_ACTION_NOTFCTN_RESP           27
1697 #define DOT11_WNM_ACTION_TFS_NOTIFY_RESP        28
1698
1699 /* Unprotected Wireless Network Management (WNM) action types */
1700 #define DOT11_UWNM_ACTION_TIM                   0
1701 #define DOT11_UWNM_ACTION_TIMING_MEASUREMENT    1
1702
1703 #define DOT11_MNG_COUNTRY_ID_LEN 3
1704
1705 /* VHT category action types - 802.11ac D3.0 - 8.5.23.1 */
1706 #define DOT11_VHT_ACTION_CBF                            0       /* Compressed Beamforming */
1707 #define DOT11_VHT_ACTION_GID_MGMT                       1       /* Group ID Management */
1708 #define DOT11_VHT_ACTION_OPER_MODE_NOTIF        2       /* Operating mode notif'n */
1709
1710 /** DLS Request frame header */
1711 BWL_PRE_PACKED_STRUCT struct dot11_dls_req {
1712         uint8 category;                 /* category of action frame (2) */
1713         uint8 action;                           /* DLS action: req (0) */
1714         struct ether_addr       da;             /* destination address */
1715         struct ether_addr       sa;             /* source address */
1716         uint16 cap;                             /* capability */
1717         uint16 timeout;                 /* timeout value */
1718         uint8 data[1];                          /* IE:support rate, extend support rate, HT cap */
1719 } BWL_POST_PACKED_STRUCT;
1720 typedef struct dot11_dls_req dot11_dls_req_t;
1721 #define DOT11_DLS_REQ_LEN 18    /* Fixed length */
1722
1723 /** DLS response frame header */
1724 BWL_PRE_PACKED_STRUCT struct dot11_dls_resp {
1725         uint8 category;                 /* category of action frame (2) */
1726         uint8 action;                           /* DLS action: req (0) */
1727         uint16 status;                          /* status code field */
1728         struct ether_addr       da;             /* destination address */
1729         struct ether_addr       sa;             /* source address */
1730         uint8 data[1];                          /* optional: capability, rate ... */
1731 } BWL_POST_PACKED_STRUCT;
1732 typedef struct dot11_dls_resp dot11_dls_resp_t;
1733 #define DOT11_DLS_RESP_LEN 16   /* Fixed length */
1734
1735
1736 /* ************* 802.11v related definitions. ************* */
1737
1738 /** BSS Management Transition Query frame header */
1739 BWL_PRE_PACKED_STRUCT struct dot11_bsstrans_query {
1740         uint8 category;                 /* category of action frame (10) */
1741         uint8 action;                   /* WNM action: trans_query (6) */
1742         uint8 token;                    /* dialog token */
1743         uint8 reason;                   /* transition query reason */
1744         uint8 data[1];                  /* Elements */
1745 } BWL_POST_PACKED_STRUCT;
1746 typedef struct dot11_bsstrans_query dot11_bsstrans_query_t;
1747 #define DOT11_BSSTRANS_QUERY_LEN 4      /* Fixed length */
1748
1749 /* BTM transition reason */
1750 #define DOT11_BSSTRANS_REASON_UNSPECIFIED               0
1751 #define DOT11_BSSTRANS_REASON_EXC_FRAME_LOSS            1
1752 #define DOT11_BSSTRANS_REASON_EXC_TRAFFIC_DELAY         2
1753 #define DOT11_BSSTRANS_REASON_INSUFF_QOS_CAPACITY       3
1754 #define DOT11_BSSTRANS_REASON_FIRST_ASSOC               4
1755 #define DOT11_BSSTRANS_REASON_LOAD_BALANCING            5
1756 #define DOT11_BSSTRANS_REASON_BETTER_AP_FOUND           6
1757 #define DOT11_BSSTRANS_REASON_DEAUTH_RX                 7
1758 #define DOT11_BSSTRANS_REASON_8021X_EAP_AUTH_FAIL       8
1759 #define DOT11_BSSTRANS_REASON_4WAY_HANDSHK_FAIL         9
1760 #define DOT11_BSSTRANS_REASON_MANY_REPLAYCNT_FAIL       10
1761 #define DOT11_BSSTRANS_REASON_MANY_DATAMIC_FAIL         11
1762 #define DOT11_BSSTRANS_REASON_EXCEED_MAX_RETRANS        12
1763 #define DOT11_BSSTRANS_REASON_MANY_BCAST_DISASSOC_RX    13
1764 #define DOT11_BSSTRANS_REASON_MANY_BCAST_DEAUTH_RX      14
1765 #define DOT11_BSSTRANS_REASON_PREV_TRANSITION_FAIL      15
1766 #define DOT11_BSSTRANS_REASON_LOW_RSSI                  16
1767 #define DOT11_BSSTRANS_REASON_ROAM_FROM_NON_80211       17
1768 #define DOT11_BSSTRANS_REASON_RX_BTM_REQ                18
1769 #define DOT11_BSSTRANS_REASON_PREF_LIST_INCLUDED        19
1770 #define DOT11_BSSTRANS_REASON_LEAVING_ESS               20
1771
1772 /** BSS Management Transition Request frame header */
1773 BWL_PRE_PACKED_STRUCT struct dot11_bsstrans_req {
1774         uint8 category;                 /* category of action frame (10) */
1775         uint8 action;                   /* WNM action: trans_req (7) */
1776         uint8 token;                    /* dialog token */
1777         uint8 reqmode;                  /* transition request mode */
1778         uint16 disassoc_tmr;            /* disassociation timer */
1779         uint8 validity_intrvl;          /* validity interval */
1780         uint8 data[1];                  /* optional: BSS term duration, ... */
1781                                                 /* ...session info URL, candidate list */
1782 } BWL_POST_PACKED_STRUCT;
1783 typedef struct dot11_bsstrans_req dot11_bsstrans_req_t;
1784 #define DOT11_BSSTRANS_REQ_LEN 7        /* Fixed length */
1785
1786 /* BSS Mgmt Transition Request Mode Field - 802.11v */
1787 #define DOT11_BSSTRANS_REQMODE_PREF_LIST_INCL           0x01
1788 #define DOT11_BSSTRANS_REQMODE_ABRIDGED                 0x02
1789 #define DOT11_BSSTRANS_REQMODE_DISASSOC_IMMINENT        0x04
1790 #define DOT11_BSSTRANS_REQMODE_BSS_TERM_INCL            0x08
1791 #define DOT11_BSSTRANS_REQMODE_ESS_DISASSOC_IMNT        0x10
1792
1793 /** BSS Management transition response frame header */
1794 BWL_PRE_PACKED_STRUCT struct dot11_bsstrans_resp {
1795         uint8 category;                 /* category of action frame (10) */
1796         uint8 action;                   /* WNM action: trans_resp (8) */
1797         uint8 token;                    /* dialog token */
1798         uint8 status;                   /* transition status */
1799         uint8 term_delay;               /* validity interval */
1800         uint8 data[1];                  /* optional: BSSID target, candidate list */
1801 } BWL_POST_PACKED_STRUCT;
1802 typedef struct dot11_bsstrans_resp dot11_bsstrans_resp_t;
1803 #define DOT11_BSSTRANS_RESP_LEN 5       /* Fixed length */
1804
1805 /* BSS Mgmt Transition Response Status Field */
1806 #define DOT11_BSSTRANS_RESP_STATUS_ACCEPT                       0
1807 #define DOT11_BSSTRANS_RESP_STATUS_REJECT                       1
1808 #define DOT11_BSSTRANS_RESP_STATUS_REJ_INSUFF_BCN               2
1809 #define DOT11_BSSTRANS_RESP_STATUS_REJ_INSUFF_CAP               3
1810 #define DOT11_BSSTRANS_RESP_STATUS_REJ_TERM_UNDESIRED           4
1811 #define DOT11_BSSTRANS_RESP_STATUS_REJ_TERM_DELAY_REQ           5
1812 #define DOT11_BSSTRANS_RESP_STATUS_REJ_BSS_LIST_PROVIDED        6
1813 #define DOT11_BSSTRANS_RESP_STATUS_REJ_NO_SUITABLE_BSS          7
1814 #define DOT11_BSSTRANS_RESP_STATUS_REJ_LEAVING_ESS              8
1815
1816
1817 /** BSS Max Idle Period element */
1818 BWL_PRE_PACKED_STRUCT struct dot11_bss_max_idle_period_ie {
1819         uint8 id;                               /* 90, DOT11_MNG_BSS_MAX_IDLE_PERIOD_ID */
1820         uint8 len;
1821         uint16 max_idle_period;                 /* in unit of 1000 TUs */
1822         uint8 idle_opt;
1823 } BWL_POST_PACKED_STRUCT;
1824 typedef struct dot11_bss_max_idle_period_ie dot11_bss_max_idle_period_ie_t;
1825 #define DOT11_BSS_MAX_IDLE_PERIOD_IE_LEN        3       /* bss max idle period IE size */
1826 #define DOT11_BSS_MAX_IDLE_PERIOD_OPT_PROTECTED 1       /* BSS max idle option */
1827
1828 /** TIM Broadcast request element */
1829 BWL_PRE_PACKED_STRUCT struct dot11_timbc_req_ie {
1830         uint8 id;                               /* 94, DOT11_MNG_TIMBC_REQ_ID */
1831         uint8 len;
1832         uint8 interval;                         /* in unit of beacon interval */
1833 } BWL_POST_PACKED_STRUCT;
1834 typedef struct dot11_timbc_req_ie dot11_timbc_req_ie_t;
1835 #define DOT11_TIMBC_REQ_IE_LEN          1       /* Fixed length */
1836
1837 /** TIM Broadcast request frame header */
1838 BWL_PRE_PACKED_STRUCT struct dot11_timbc_req {
1839         uint8 category;                         /* category of action frame (10) */
1840         uint8 action;                           /* WNM action: DOT11_WNM_ACTION_TIMBC_REQ(18) */
1841         uint8 token;                            /* dialog token */
1842         uint8 data[1];                          /* TIM broadcast request element */
1843 } BWL_POST_PACKED_STRUCT;
1844 typedef struct dot11_timbc_req dot11_timbc_req_t;
1845 #define DOT11_TIMBC_REQ_LEN             3       /* Fixed length */
1846
1847 /** TIM Broadcast response element */
1848 BWL_PRE_PACKED_STRUCT struct dot11_timbc_resp_ie {
1849         uint8 id;                               /* 95, DOT11_MNG_TIM_BROADCAST_RESP_ID */
1850         uint8 len;
1851         uint8 status;                           /* status of add request */
1852         uint8 interval;                         /* in unit of beacon interval */
1853         int32 offset;                           /* in unit of ms */
1854         uint16 high_rate;                       /* in unit of 0.5 Mb/s */
1855         uint16 low_rate;                        /* in unit of 0.5 Mb/s */
1856 } BWL_POST_PACKED_STRUCT;
1857 typedef struct dot11_timbc_resp_ie dot11_timbc_resp_ie_t;
1858 #define DOT11_TIMBC_DENY_RESP_IE_LEN    1       /* Deny. Fixed length */
1859 #define DOT11_TIMBC_ACCEPT_RESP_IE_LEN  10      /* Accept. Fixed length */
1860
1861 #define DOT11_TIMBC_STATUS_ACCEPT               0
1862 #define DOT11_TIMBC_STATUS_ACCEPT_TSTAMP        1
1863 #define DOT11_TIMBC_STATUS_DENY                 2
1864 #define DOT11_TIMBC_STATUS_OVERRIDDEN           3
1865 #define DOT11_TIMBC_STATUS_RESERVED             4
1866
1867 /** TIM Broadcast request frame header */
1868 BWL_PRE_PACKED_STRUCT struct dot11_timbc_resp {
1869         uint8 category;                 /* category of action frame (10) */
1870         uint8 action;                   /* action: DOT11_WNM_ACTION_TIMBC_RESP(19) */
1871         uint8 token;                    /* dialog token */
1872         uint8 data[1];                  /* TIM broadcast response element */
1873 } BWL_POST_PACKED_STRUCT;
1874 typedef struct dot11_timbc_resp dot11_timbc_resp_t;
1875 #define DOT11_TIMBC_RESP_LEN    3       /* Fixed length */
1876
1877 /** TIM element */
1878 BWL_PRE_PACKED_STRUCT struct dot11_tim_ie {
1879         uint8 id;                       /* 5, DOT11_MNG_TIM_ID   */
1880         uint8 len;                      /* 4 - 255 */
1881         uint8 dtim_count;               /* DTIM decrementing counter */
1882         uint8 dtim_period;              /* DTIM period */
1883         uint8 bitmap_control;           /* AID 0 + bitmap offset */
1884         uint8 pvb[1];                   /* Partial Virtual Bitmap, variable length */
1885 } BWL_POST_PACKED_STRUCT;
1886 typedef struct dot11_tim_ie dot11_tim_ie_t;
1887 #define DOT11_TIM_IE_FIXED_LEN  3       /* Fixed length, without id and len */
1888 #define DOT11_TIM_IE_FIXED_TOTAL_LEN    5       /* Fixed length, with id and len */
1889
1890 /** TIM Broadcast frame header */
1891 BWL_PRE_PACKED_STRUCT struct dot11_timbc {
1892         uint8 category;                 /* category of action frame (11) */
1893         uint8 action;                   /* action: TIM (0) */
1894         uint8 check_beacon;             /* need to check-beacon */
1895         uint8 tsf[8];                   /* Time Synchronization Function */
1896         dot11_tim_ie_t tim_ie;          /* TIM element */
1897 } BWL_POST_PACKED_STRUCT;
1898 typedef struct dot11_timbc dot11_timbc_t;
1899 #define DOT11_TIMBC_HDR_LEN     (sizeof(dot11_timbc_t) - sizeof(dot11_tim_ie_t))
1900 #define DOT11_TIMBC_FIXED_LEN   (sizeof(dot11_timbc_t) - 1)     /* Fixed length */
1901 #define DOT11_TIMBC_LEN                 11      /* Fixed length */
1902
1903 /** TCLAS frame classifier type */
1904 BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_hdr {
1905         uint8 type;
1906         uint8 mask;
1907         uint8 data[1];
1908 } BWL_POST_PACKED_STRUCT;
1909 typedef struct dot11_tclas_fc_hdr dot11_tclas_fc_hdr_t;
1910 #define DOT11_TCLAS_FC_HDR_LEN          2       /* Fixed length */
1911
1912 #define DOT11_TCLAS_MASK_0              0x1
1913 #define DOT11_TCLAS_MASK_1              0x2
1914 #define DOT11_TCLAS_MASK_2              0x4
1915 #define DOT11_TCLAS_MASK_3              0x8
1916 #define DOT11_TCLAS_MASK_4              0x10
1917 #define DOT11_TCLAS_MASK_5              0x20
1918 #define DOT11_TCLAS_MASK_6              0x40
1919 #define DOT11_TCLAS_MASK_7              0x80
1920
1921 #define DOT11_TCLAS_FC_0_ETH            0
1922 #define DOT11_TCLAS_FC_1_IP             1
1923 #define DOT11_TCLAS_FC_2_8021Q          2
1924 #define DOT11_TCLAS_FC_3_OFFSET         3
1925 #define DOT11_TCLAS_FC_4_IP_HIGHER      4
1926 #define DOT11_TCLAS_FC_5_8021D          5
1927
1928 /** TCLAS frame classifier type 0 parameters for Ethernet */
1929 BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_0_eth {
1930         uint8 type;
1931         uint8 mask;
1932         uint8 sa[ETHER_ADDR_LEN];
1933         uint8 da[ETHER_ADDR_LEN];
1934         uint16 eth_type;
1935 } BWL_POST_PACKED_STRUCT;
1936 typedef struct dot11_tclas_fc_0_eth dot11_tclas_fc_0_eth_t;
1937 #define DOT11_TCLAS_FC_0_ETH_LEN        16
1938
1939 /** TCLAS frame classifier type 1 parameters for IPV4 */
1940 BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_1_ipv4 {
1941         uint8 type;
1942         uint8 mask;
1943         uint8 version;
1944         uint32 src_ip;
1945         uint32 dst_ip;
1946         uint16 src_port;
1947         uint16 dst_port;
1948         uint8 dscp;
1949         uint8 protocol;
1950         uint8 reserved;
1951 } BWL_POST_PACKED_STRUCT;
1952 typedef struct dot11_tclas_fc_1_ipv4 dot11_tclas_fc_1_ipv4_t;
1953 #define DOT11_TCLAS_FC_1_IPV4_LEN       18
1954
1955 /** TCLAS frame classifier type 2 parameters for 802.1Q */
1956 BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_2_8021q {
1957         uint8 type;
1958         uint8 mask;
1959         uint16 tci;
1960 } BWL_POST_PACKED_STRUCT;
1961 typedef struct dot11_tclas_fc_2_8021q dot11_tclas_fc_2_8021q_t;
1962 #define DOT11_TCLAS_FC_2_8021Q_LEN      4
1963
1964 /** TCLAS frame classifier type 3 parameters for filter offset */
1965 BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_3_filter {
1966         uint8 type;
1967         uint8 mask;
1968         uint16 offset;
1969         uint8 data[1];
1970 } BWL_POST_PACKED_STRUCT;
1971 typedef struct dot11_tclas_fc_3_filter dot11_tclas_fc_3_filter_t;
1972 #define DOT11_TCLAS_FC_3_FILTER_LEN     4
1973
1974 /** TCLAS frame classifier type 4 parameters for IPV4 is the same as TCLAS type 1 */
1975 typedef struct dot11_tclas_fc_1_ipv4 dot11_tclas_fc_4_ipv4_t;
1976 #define DOT11_TCLAS_FC_4_IPV4_LEN       DOT11_TCLAS_FC_1_IPV4_LEN
1977
1978 /** TCLAS frame classifier type 4 parameters for IPV6 */
1979 BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_4_ipv6 {
1980         uint8 type;
1981         uint8 mask;
1982         uint8 version;
1983         uint8 saddr[16];
1984         uint8 daddr[16];
1985         uint16 src_port;
1986         uint16 dst_port;
1987         uint8 dscp;
1988         uint8 nexthdr;
1989         uint8 flow_lbl[3];
1990 } BWL_POST_PACKED_STRUCT;
1991 typedef struct dot11_tclas_fc_4_ipv6 dot11_tclas_fc_4_ipv6_t;
1992 #define DOT11_TCLAS_FC_4_IPV6_LEN       44
1993
1994 /** TCLAS frame classifier type 5 parameters for 802.1D */
1995 BWL_PRE_PACKED_STRUCT struct dot11_tclas_fc_5_8021d {
1996         uint8 type;
1997         uint8 mask;
1998         uint8 pcp;
1999         uint8 cfi;
2000         uint16 vid;
2001 } BWL_POST_PACKED_STRUCT;
2002 typedef struct dot11_tclas_fc_5_8021d dot11_tclas_fc_5_8021d_t;
2003 #define DOT11_TCLAS_FC_5_8021D_LEN      6
2004
2005 /** TCLAS frame classifier type parameters */
2006 BWL_PRE_PACKED_STRUCT union dot11_tclas_fc {
2007         uint8 data[1];
2008         dot11_tclas_fc_hdr_t hdr;
2009         dot11_tclas_fc_0_eth_t t0_eth;
2010         dot11_tclas_fc_1_ipv4_t t1_ipv4;
2011         dot11_tclas_fc_2_8021q_t t2_8021q;
2012         dot11_tclas_fc_3_filter_t t3_filter;
2013         dot11_tclas_fc_4_ipv4_t t4_ipv4;
2014         dot11_tclas_fc_4_ipv6_t t4_ipv6;
2015         dot11_tclas_fc_5_8021d_t t5_8021d;
2016 } BWL_POST_PACKED_STRUCT;
2017 typedef union dot11_tclas_fc dot11_tclas_fc_t;
2018
2019 #define DOT11_TCLAS_FC_MIN_LEN          4       /* Classifier Type 2 has the min size */
2020 #define DOT11_TCLAS_FC_MAX_LEN          254
2021
2022 /** TCLAS element */
2023 BWL_PRE_PACKED_STRUCT struct dot11_tclas_ie {
2024         uint8 id;                               /* 14, DOT11_MNG_TCLAS_ID */
2025         uint8 len;
2026         uint8 user_priority;
2027         dot11_tclas_fc_t fc;
2028 } BWL_POST_PACKED_STRUCT;
2029 typedef struct dot11_tclas_ie dot11_tclas_ie_t;
2030 #define DOT11_TCLAS_IE_LEN              3       /* Fixed length, include id and len */
2031
2032 /** TCLAS processing element */
2033 BWL_PRE_PACKED_STRUCT struct dot11_tclas_proc_ie {
2034         uint8 id;                               /* 44, DOT11_MNG_TCLAS_PROC_ID */
2035         uint8 len;
2036         uint8 process;
2037 } BWL_POST_PACKED_STRUCT;
2038 typedef struct dot11_tclas_proc_ie dot11_tclas_proc_ie_t;
2039 #define DOT11_TCLAS_PROC_IE_LEN         3       /* Fixed length, include id and len */
2040
2041 #define DOT11_TCLAS_PROC_MATCHALL       0       /* All high level element need to match */
2042 #define DOT11_TCLAS_PROC_MATCHONE       1       /* One high level element need to match */
2043 #define DOT11_TCLAS_PROC_NONMATCH       2       /* Non match to any high level element */
2044
2045
2046 /* TSPEC element defined in 802.11 std section 8.4.2.32 - Not supported */
2047 #define DOT11_TSPEC_IE_LEN              57      /* Fixed length */
2048
2049 /** TFS request element */
2050 BWL_PRE_PACKED_STRUCT struct dot11_tfs_req_ie {
2051         uint8 id;                               /* 91, DOT11_MNG_TFS_REQUEST_ID */
2052         uint8 len;
2053         uint8 tfs_id;
2054         uint8 actcode;
2055         uint8 data[1];
2056 } BWL_POST_PACKED_STRUCT;
2057 typedef struct dot11_tfs_req_ie dot11_tfs_req_ie_t;
2058 #define DOT11_TFS_REQ_IE_LEN            2       /* Fixed length, without id and len */
2059
2060 /** TFS request action codes (bitfield) */
2061 #define DOT11_TFS_ACTCODE_DELETE        1
2062 #define DOT11_TFS_ACTCODE_NOTIFY        2
2063
2064 /** TFS request subelement IDs */
2065 #define DOT11_TFS_REQ_TFS_SE_ID         1
2066 #define DOT11_TFS_REQ_VENDOR_SE_ID      221
2067
2068 /** TFS subelement */
2069 BWL_PRE_PACKED_STRUCT struct dot11_tfs_se {
2070         uint8 sub_id;
2071         uint8 len;
2072         uint8 data[1];                          /* TCLAS element(s) + optional TCLAS proc */
2073 } BWL_POST_PACKED_STRUCT;
2074 typedef struct dot11_tfs_se dot11_tfs_se_t;
2075
2076
2077 /** TFS response element */
2078 BWL_PRE_PACKED_STRUCT struct dot11_tfs_resp_ie {
2079         uint8 id;                               /* 92, DOT11_MNG_TFS_RESPONSE_ID */
2080         uint8 len;
2081         uint8 tfs_id;
2082         uint8 data[1];
2083 } BWL_POST_PACKED_STRUCT;
2084 typedef struct dot11_tfs_resp_ie dot11_tfs_resp_ie_t;
2085 #define DOT11_TFS_RESP_IE_LEN           1       /* Fixed length, without id and len */
2086
2087 /** TFS response subelement IDs (same subelments, but different IDs than in TFS request */
2088 #define DOT11_TFS_RESP_TFS_STATUS_SE_ID         1
2089 #define DOT11_TFS_RESP_TFS_SE_ID                2
2090 #define DOT11_TFS_RESP_VENDOR_SE_ID             221
2091
2092 /** TFS status subelement */
2093 BWL_PRE_PACKED_STRUCT struct dot11_tfs_status_se {
2094         uint8 sub_id;                           /* 92, DOT11_MNG_TFS_RESPONSE_ID */
2095         uint8 len;
2096         uint8 resp_st;
2097         uint8 data[1];                          /* Potential dot11_tfs_se_t included */
2098 } BWL_POST_PACKED_STRUCT;
2099 typedef struct dot11_tfs_status_se dot11_tfs_status_se_t;
2100 #define DOT11_TFS_STATUS_SE_LEN                 1       /* Fixed length, without id and len */
2101
2102 /* Following Definition should be merged to FMS_TFS macro below */
2103 /* TFS Response status code. Identical to FMS Element status, without N/A  */
2104 #define DOT11_TFS_STATUS_ACCEPT                 0
2105 #define DOT11_TFS_STATUS_DENY_FORMAT            1
2106 #define DOT11_TFS_STATUS_DENY_RESOURCE          2
2107 #define DOT11_TFS_STATUS_DENY_POLICY            4
2108 #define DOT11_TFS_STATUS_DENY_UNSPECIFIED       5
2109 #define DOT11_TFS_STATUS_ALTPREF_POLICY         7
2110 #define DOT11_TFS_STATUS_ALTPREF_TCLAS_UNSUPP   14
2111
2112 /* FMS Element Status and TFS Response Status Definition */
2113 #define DOT11_FMS_TFS_STATUS_ACCEPT             0
2114 #define DOT11_FMS_TFS_STATUS_DENY_FORMAT        1
2115 #define DOT11_FMS_TFS_STATUS_DENY_RESOURCE      2
2116 #define DOT11_FMS_TFS_STATUS_DENY_MULTIPLE_DI   3
2117 #define DOT11_FMS_TFS_STATUS_DENY_POLICY        4
2118 #define DOT11_FMS_TFS_STATUS_DENY_UNSPECIFIED   5
2119 #define DOT11_FMS_TFS_STATUS_ALT_DIFF_DI        6
2120 #define DOT11_FMS_TFS_STATUS_ALT_POLICY         7
2121 #define DOT11_FMS_TFS_STATUS_ALT_CHANGE_DI      8
2122 #define DOT11_FMS_TFS_STATUS_ALT_MCRATE         9
2123 #define DOT11_FMS_TFS_STATUS_TERM_POLICY        10
2124 #define DOT11_FMS_TFS_STATUS_TERM_RESOURCE      11
2125 #define DOT11_FMS_TFS_STATUS_TERM_HIGHER_PRIO   12
2126 #define DOT11_FMS_TFS_STATUS_ALT_CHANGE_MDI     13
2127 #define DOT11_FMS_TFS_STATUS_ALT_TCLAS_UNSUPP   14
2128
2129 /** TFS Management Request frame header */
2130 BWL_PRE_PACKED_STRUCT struct dot11_tfs_req {
2131         uint8 category;                         /* category of action frame (10) */
2132         uint8 action;                           /* WNM action: TFS request (13) */
2133         uint8 token;                            /* dialog token */
2134         uint8 data[1];                          /* Elements */
2135 } BWL_POST_PACKED_STRUCT;
2136 typedef struct dot11_tfs_req dot11_tfs_req_t;
2137 #define DOT11_TFS_REQ_LEN               3       /* Fixed length */
2138
2139 /** TFS Management Response frame header */
2140 BWL_PRE_PACKED_STRUCT struct dot11_tfs_resp {
2141         uint8 category;                         /* category of action frame (10) */
2142         uint8 action;                           /* WNM action: TFS request (14) */
2143         uint8 token;                            /* dialog token */
2144         uint8 data[1];                          /* Elements */
2145 } BWL_POST_PACKED_STRUCT;
2146 typedef struct dot11_tfs_resp dot11_tfs_resp_t;
2147 #define DOT11_TFS_RESP_LEN              3       /* Fixed length */
2148
2149 /** TFS Management Notify frame request header */
2150 BWL_PRE_PACKED_STRUCT struct dot11_tfs_notify_req {
2151         uint8 category;                         /* category of action frame (10) */
2152         uint8 action;                           /* WNM action: TFS notify request (15) */
2153         uint8 tfs_id_cnt;                       /* TFS IDs count */
2154         uint8 tfs_id[1];                        /* Array of TFS IDs */
2155 } BWL_POST_PACKED_STRUCT;
2156 typedef struct dot11_tfs_notify_req dot11_tfs_notify_req_t;
2157 #define DOT11_TFS_NOTIFY_REQ_LEN        3       /* Fixed length */
2158
2159 /** TFS Management Notify frame response header */
2160 BWL_PRE_PACKED_STRUCT struct dot11_tfs_notify_resp {
2161         uint8 category;                         /* category of action frame (10) */
2162         uint8 action;                           /* WNM action: TFS notify response (28) */
2163         uint8 tfs_id_cnt;                       /* TFS IDs count */
2164         uint8 tfs_id[1];                        /* Array of TFS IDs */
2165 } BWL_POST_PACKED_STRUCT;
2166 typedef struct dot11_tfs_notify_resp dot11_tfs_notify_resp_t;
2167 #define DOT11_TFS_NOTIFY_RESP_LEN       3       /* Fixed length */
2168
2169
2170 /** WNM-Sleep Management Request frame header */
2171 BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_req {
2172         uint8 category;                         /* category of action frame (10) */
2173         uint8 action;                           /* WNM action: wnm-sleep request (16) */
2174         uint8 token;                            /* dialog token */
2175         uint8 data[1];                          /* Elements */
2176 } BWL_POST_PACKED_STRUCT;
2177 typedef struct dot11_wnm_sleep_req dot11_wnm_sleep_req_t;
2178 #define DOT11_WNM_SLEEP_REQ_LEN         3       /* Fixed length */
2179
2180 /** WNM-Sleep Management Response frame header */
2181 BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_resp {
2182         uint8 category;                         /* category of action frame (10) */
2183         uint8 action;                           /* WNM action: wnm-sleep request (17) */
2184         uint8 token;                            /* dialog token */
2185         uint16 key_len;                         /* key data length */
2186         uint8 data[1];                          /* Elements */
2187 } BWL_POST_PACKED_STRUCT;
2188 typedef struct dot11_wnm_sleep_resp dot11_wnm_sleep_resp_t;
2189 #define DOT11_WNM_SLEEP_RESP_LEN        5       /* Fixed length */
2190
2191 #define DOT11_WNM_SLEEP_SUBELEM_ID_GTK  0
2192 #define DOT11_WNM_SLEEP_SUBELEM_ID_IGTK 1
2193
2194 BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_subelem_gtk {
2195         uint8 sub_id;
2196         uint8 len;
2197         uint16 key_info;
2198         uint8 key_length;
2199         uint8 rsc[8];
2200         uint8 key[1];
2201 } BWL_POST_PACKED_STRUCT;
2202 typedef struct dot11_wnm_sleep_subelem_gtk dot11_wnm_sleep_subelem_gtk_t;
2203 #define DOT11_WNM_SLEEP_SUBELEM_GTK_FIXED_LEN   11      /* without sub_id, len, and key */
2204 #define DOT11_WNM_SLEEP_SUBELEM_GTK_MAX_LEN     43      /* without sub_id and len */
2205
2206 BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_subelem_igtk {
2207         uint8 sub_id;
2208         uint8 len;
2209         uint16 key_id;
2210         uint8 pn[6];
2211         uint8 key[16];
2212 } BWL_POST_PACKED_STRUCT;
2213 typedef struct dot11_wnm_sleep_subelem_igtk dot11_wnm_sleep_subelem_igtk_t;
2214 #define DOT11_WNM_SLEEP_SUBELEM_IGTK_LEN 24     /* Fixed length */
2215
2216 BWL_PRE_PACKED_STRUCT struct dot11_wnm_sleep_ie {
2217         uint8 id;                               /* 93, DOT11_MNG_WNM_SLEEP_MODE_ID */
2218         uint8 len;
2219         uint8 act_type;
2220         uint8 resp_status;
2221         uint16 interval;
2222 } BWL_POST_PACKED_STRUCT;
2223 typedef struct dot11_wnm_sleep_ie dot11_wnm_sleep_ie_t;
2224 #define DOT11_WNM_SLEEP_IE_LEN          4       /* Fixed length */
2225
2226 #define DOT11_WNM_SLEEP_ACT_TYPE_ENTER  0
2227 #define DOT11_WNM_SLEEP_ACT_TYPE_EXIT   1
2228
2229 #define DOT11_WNM_SLEEP_RESP_ACCEPT     0
2230 #define DOT11_WNM_SLEEP_RESP_UPDATE     1
2231 #define DOT11_WNM_SLEEP_RESP_DENY       2
2232 #define DOT11_WNM_SLEEP_RESP_DENY_TEMP  3
2233 #define DOT11_WNM_SLEEP_RESP_DENY_KEY   4
2234 #define DOT11_WNM_SLEEP_RESP_DENY_INUSE 5
2235 #define DOT11_WNM_SLEEP_RESP_LAST       6
2236
2237 /** DMS Management Request frame header */
2238 BWL_PRE_PACKED_STRUCT struct dot11_dms_req {
2239         uint8 category;                         /* category of action frame (10) */
2240         uint8 action;                           /* WNM action: dms request (23) */
2241         uint8 token;                            /* dialog token */
2242         uint8 data[1];                          /* Elements */
2243 } BWL_POST_PACKED_STRUCT;
2244 typedef struct dot11_dms_req dot11_dms_req_t;
2245 #define DOT11_DMS_REQ_LEN               3       /* Fixed length */
2246
2247 /** DMS Management Response frame header */
2248 BWL_PRE_PACKED_STRUCT struct dot11_dms_resp {
2249         uint8 category;                         /* category of action frame (10) */
2250         uint8 action;                           /* WNM action: dms request (24) */
2251         uint8 token;                            /* dialog token */
2252         uint8 data[1];                          /* Elements */
2253 } BWL_POST_PACKED_STRUCT;
2254 typedef struct dot11_dms_resp dot11_dms_resp_t;
2255 #define DOT11_DMS_RESP_LEN              3       /* Fixed length */
2256
2257 /** DMS request element */
2258 BWL_PRE_PACKED_STRUCT struct dot11_dms_req_ie {
2259         uint8 id;                               /* 99, DOT11_MNG_DMS_REQUEST_ID */
2260         uint8 len;
2261         uint8 data[1];
2262 } BWL_POST_PACKED_STRUCT;
2263 typedef struct dot11_dms_req_ie dot11_dms_req_ie_t;
2264 #define DOT11_DMS_REQ_IE_LEN            2       /* Fixed length */
2265
2266 /** DMS response element */
2267 BWL_PRE_PACKED_STRUCT struct dot11_dms_resp_ie {
2268         uint8 id;                               /* 100, DOT11_MNG_DMS_RESPONSE_ID */
2269         uint8 len;
2270         uint8 data[1];
2271 } BWL_POST_PACKED_STRUCT;
2272 typedef struct dot11_dms_resp_ie dot11_dms_resp_ie_t;
2273 #define DOT11_DMS_RESP_IE_LEN           2       /* Fixed length */
2274
2275 /** DMS request descriptor */
2276 BWL_PRE_PACKED_STRUCT struct dot11_dms_req_desc {
2277         uint8 dms_id;
2278         uint8 len;
2279         uint8 type;
2280         uint8 data[1];
2281 } BWL_POST_PACKED_STRUCT;
2282 typedef struct dot11_dms_req_desc dot11_dms_req_desc_t;
2283 #define DOT11_DMS_REQ_DESC_LEN          3       /* Fixed length */
2284
2285 #define DOT11_DMS_REQ_TYPE_ADD          0
2286 #define DOT11_DMS_REQ_TYPE_REMOVE       1
2287 #define DOT11_DMS_REQ_TYPE_CHANGE       2
2288
2289 /** DMS response status */
2290 BWL_PRE_PACKED_STRUCT struct dot11_dms_resp_st {
2291         uint8 dms_id;
2292         uint8 len;
2293         uint8 type;
2294         uint16 lsc;
2295         uint8 data[1];
2296 } BWL_POST_PACKED_STRUCT;
2297 typedef struct dot11_dms_resp_st dot11_dms_resp_st_t;
2298 #define DOT11_DMS_RESP_STATUS_LEN       5       /* Fixed length */
2299
2300 #define DOT11_DMS_RESP_TYPE_ACCEPT      0
2301 #define DOT11_DMS_RESP_TYPE_DENY        1
2302 #define DOT11_DMS_RESP_TYPE_TERM        2
2303
2304 #define DOT11_DMS_RESP_LSC_UNSUPPORTED  0xFFFF
2305
2306 /** FMS Management Request frame header */
2307 BWL_PRE_PACKED_STRUCT struct dot11_fms_req {
2308         uint8 category;                         /* category of action frame (10) */
2309         uint8 action;                           /* WNM action: fms request (9) */
2310         uint8 token;                            /* dialog token */
2311         uint8 data[1];                          /* Elements */
2312 } BWL_POST_PACKED_STRUCT;
2313 typedef struct dot11_fms_req dot11_fms_req_t;
2314 #define DOT11_FMS_REQ_LEN               3       /* Fixed length */
2315
2316 /** FMS Management Response frame header */
2317 BWL_PRE_PACKED_STRUCT struct dot11_fms_resp {
2318         uint8 category;                         /* category of action frame (10) */
2319         uint8 action;                           /* WNM action: fms request (10) */
2320         uint8 token;                            /* dialog token */
2321         uint8 data[1];                          /* Elements */
2322 } BWL_POST_PACKED_STRUCT;
2323 typedef struct dot11_fms_resp dot11_fms_resp_t;
2324 #define DOT11_FMS_RESP_LEN              3       /* Fixed length */
2325
2326 /** FMS Descriptor element */
2327 BWL_PRE_PACKED_STRUCT struct dot11_fms_desc {
2328         uint8 id;
2329         uint8 len;
2330         uint8 num_fms_cnt;
2331         uint8 data[1];
2332 } BWL_POST_PACKED_STRUCT;
2333 typedef struct dot11_fms_desc dot11_fms_desc_t;
2334 #define DOT11_FMS_DESC_LEN              1       /* Fixed length */
2335
2336 #define DOT11_FMS_CNTR_MAX              0x8
2337 #define DOT11_FMS_CNTR_ID_MASK          0x7
2338 #define DOT11_FMS_CNTR_ID_SHIFT         0x0
2339 #define DOT11_FMS_CNTR_COUNT_MASK       0xf1
2340 #define DOT11_FMS_CNTR_SHIFT            0x3
2341
2342 /** FMS request element */
2343 BWL_PRE_PACKED_STRUCT struct dot11_fms_req_ie {
2344         uint8 id;
2345         uint8 len;
2346         uint8 fms_token;                        /* token used to identify fms stream set */
2347         uint8 data[1];
2348 } BWL_POST_PACKED_STRUCT;
2349 typedef struct dot11_fms_req_ie dot11_fms_req_ie_t;
2350 #define DOT11_FMS_REQ_IE_FIX_LEN                1       /* Fixed length */
2351
2352 BWL_PRE_PACKED_STRUCT struct dot11_rate_id_field {
2353         uint8 mask;
2354         uint8 mcs_idx;
2355         uint16 rate;
2356 } BWL_POST_PACKED_STRUCT;
2357 typedef struct dot11_rate_id_field dot11_rate_id_field_t;
2358 #define DOT11_RATE_ID_FIELD_MCS_SEL_MASK        0x7
2359 #define DOT11_RATE_ID_FIELD_MCS_SEL_OFFSET      0
2360 #define DOT11_RATE_ID_FIELD_RATETYPE_MASK       0x18
2361 #define DOT11_RATE_ID_FIELD_RATETYPE_OFFSET     3
2362 #define DOT11_RATE_ID_FIELD_LEN         sizeof(dot11_rate_id_field_t)
2363
2364 /** FMS request subelements */
2365 BWL_PRE_PACKED_STRUCT struct dot11_fms_se {
2366         uint8 sub_id;
2367         uint8 len;
2368         uint8 interval;
2369         uint8 max_interval;
2370         dot11_rate_id_field_t rate;
2371         uint8 data[1];
2372 } BWL_POST_PACKED_STRUCT;
2373 typedef struct dot11_fms_se dot11_fms_se_t;
2374 #define DOT11_FMS_REQ_SE_LEN            6       /* Fixed length */
2375
2376 #define DOT11_FMS_REQ_SE_ID_FMS         1       /* FMS subelement */
2377 #define DOT11_FMS_REQ_SE_ID_VS          221     /* Vendor Specific subelement */
2378
2379 /** FMS response element */
2380 BWL_PRE_PACKED_STRUCT struct dot11_fms_resp_ie {
2381         uint8 id;
2382         uint8 len;
2383         uint8 fms_token;
2384         uint8 data[1];
2385 } BWL_POST_PACKED_STRUCT;
2386 typedef struct dot11_fms_resp_ie dot11_fms_resp_ie_t;
2387 #define DOT11_FMS_RESP_IE_FIX_LEN               1       /* Fixed length */
2388
2389 /* FMS status subelements */
2390 #define DOT11_FMS_STATUS_SE_ID_FMS      1       /* FMS Status */
2391 #define DOT11_FMS_STATUS_SE_ID_TCLAS    2       /* TCLAS Status */
2392 #define DOT11_FMS_STATUS_SE_ID_VS       221     /* Vendor Specific subelement */
2393
2394 /** FMS status subelement */
2395 BWL_PRE_PACKED_STRUCT struct dot11_fms_status_se {
2396         uint8 sub_id;
2397         uint8 len;
2398         uint8 status;
2399         uint8 interval;
2400         uint8 max_interval;
2401         uint8 fmsid;
2402         uint8 counter;
2403         dot11_rate_id_field_t rate;
2404         uint8 mcast_addr[ETHER_ADDR_LEN];
2405 } BWL_POST_PACKED_STRUCT;
2406 typedef struct dot11_fms_status_se dot11_fms_status_se_t;
2407 #define DOT11_FMS_STATUS_SE_LEN         15      /* Fixed length */
2408
2409 /** TCLAS status subelement */
2410 BWL_PRE_PACKED_STRUCT struct dot11_tclas_status_se {
2411         uint8 sub_id;
2412         uint8 len;
2413         uint8 fmsid;
2414         uint8 data[1];
2415 } BWL_POST_PACKED_STRUCT;
2416 typedef struct dot11_tclas_status_se dot11_tclas_status_se_t;
2417 #define DOT11_TCLAS_STATUS_SE_LEN               1       /* Fixed length */
2418
2419 BWL_PRE_PACKED_STRUCT struct dot11_addba_req {
2420         uint8 category;                         /* category of action frame (3) */
2421         uint8 action;                           /* action: addba req */
2422         uint8 token;                            /* identifier */
2423         uint16 addba_param_set;         /* parameter set */
2424         uint16 timeout;                         /* timeout in seconds */
2425         uint16 start_seqnum;            /* starting sequence number */
2426 } BWL_POST_PACKED_STRUCT;
2427 typedef struct dot11_addba_req dot11_addba_req_t;
2428 #define DOT11_ADDBA_REQ_LEN             9       /* length of addba req frame */
2429
2430 BWL_PRE_PACKED_STRUCT struct dot11_addba_resp {
2431         uint8 category;                         /* category of action frame (3) */
2432         uint8 action;                           /* action: addba resp */
2433         uint8 token;                            /* identifier */
2434         uint16 status;                          /* status of add request */
2435         uint16 addba_param_set;                 /* negotiated parameter set */
2436         uint16 timeout;                         /* negotiated timeout in seconds */
2437 } BWL_POST_PACKED_STRUCT;
2438 typedef struct dot11_addba_resp dot11_addba_resp_t;
2439 #define DOT11_ADDBA_RESP_LEN            9       /* length of addba resp frame */
2440
2441 /* DELBA action parameters */
2442 #define DOT11_DELBA_PARAM_INIT_MASK     0x0800  /* initiator mask */
2443 #define DOT11_DELBA_PARAM_INIT_SHIFT    11      /* initiator shift */
2444 #define DOT11_DELBA_PARAM_TID_MASK      0xf000  /* tid mask */
2445 #define DOT11_DELBA_PARAM_TID_SHIFT     12      /* tid shift */
2446
2447 BWL_PRE_PACKED_STRUCT struct dot11_delba {
2448         uint8 category;                         /* category of action frame (3) */
2449         uint8 action;                           /* action: addba req */
2450         uint16 delba_param_set;                 /* paarmeter set */
2451         uint16 reason;                          /* reason for dellba */
2452 } BWL_POST_PACKED_STRUCT;
2453 typedef struct dot11_delba dot11_delba_t;
2454 #define DOT11_DELBA_LEN                 6       /* length of delba frame */
2455
2456 /* SA Query action field value */
2457 #define SA_QUERY_REQUEST                0
2458 #define SA_QUERY_RESPONSE               1
2459
2460 /* ************* 802.11r related definitions. ************* */
2461
2462 /** Over-the-DS Fast Transition Request frame header */
2463 BWL_PRE_PACKED_STRUCT struct dot11_ft_req {
2464         uint8 category;                 /* category of action frame (6) */
2465         uint8 action;                   /* action: ft req */
2466         uint8 sta_addr[ETHER_ADDR_LEN];
2467         uint8 tgt_ap_addr[ETHER_ADDR_LEN];
2468         uint8 data[1];                  /* Elements */
2469 } BWL_POST_PACKED_STRUCT;
2470 typedef struct dot11_ft_req dot11_ft_req_t;
2471 #define DOT11_FT_REQ_FIXED_LEN 14
2472
2473 /** Over-the-DS Fast Transition Response frame header */
2474 BWL_PRE_PACKED_STRUCT struct dot11_ft_res {
2475         uint8 category;                 /* category of action frame (6) */
2476         uint8 action;                   /* action: ft resp */
2477         uint8 sta_addr[ETHER_ADDR_LEN];
2478         uint8 tgt_ap_addr[ETHER_ADDR_LEN];
2479         uint16 status;                  /* status code */
2480         uint8 data[1];                  /* Elements */
2481 } BWL_POST_PACKED_STRUCT;
2482 typedef struct dot11_ft_res dot11_ft_res_t;
2483 #define DOT11_FT_RES_FIXED_LEN 16
2484
2485 /** RDE RIC Data Element. */
2486 BWL_PRE_PACKED_STRUCT struct dot11_rde_ie {
2487         uint8 id;                       /* 11r, DOT11_MNG_RDE_ID */
2488         uint8 length;
2489         uint8 rde_id;                   /* RDE identifier. */
2490         uint8 rd_count;                 /* Resource Descriptor Count. */
2491         uint16 status;                  /* Status Code. */
2492 } BWL_POST_PACKED_STRUCT;
2493 typedef struct dot11_rde_ie dot11_rde_ie_t;
2494
2495 /* 11r - Size of the RDE (RIC Data Element) IE, including TLV header. */
2496 #define DOT11_MNG_RDE_IE_LEN sizeof(dot11_rde_ie_t)
2497
2498
2499 /* ************* 802.11k related definitions. ************* */
2500
2501 /* Radio measurements enabled capability ie */
2502 #define DOT11_RRM_CAP_LEN               5       /* length of rrm cap bitmap */
2503 #define RCPI_IE_LEN 1
2504 #define RSNI_IE_LEN 1
2505 BWL_PRE_PACKED_STRUCT struct dot11_rrm_cap_ie {
2506         uint8 cap[DOT11_RRM_CAP_LEN];
2507 } BWL_POST_PACKED_STRUCT;
2508 typedef struct dot11_rrm_cap_ie dot11_rrm_cap_ie_t;
2509
2510 /* Bitmap definitions for cap ie */
2511 #define DOT11_RRM_CAP_LINK              0
2512 #define DOT11_RRM_CAP_NEIGHBOR_REPORT   1
2513 #define DOT11_RRM_CAP_PARALLEL          2
2514 #define DOT11_RRM_CAP_REPEATED          3
2515 #define DOT11_RRM_CAP_BCN_PASSIVE       4
2516 #define DOT11_RRM_CAP_BCN_ACTIVE        5
2517 #define DOT11_RRM_CAP_BCN_TABLE         6
2518 #define DOT11_RRM_CAP_BCN_REP_COND      7
2519 #define DOT11_RRM_CAP_FM                8
2520 #define DOT11_RRM_CAP_CLM               9
2521 #define DOT11_RRM_CAP_NHM               10
2522 #define DOT11_RRM_CAP_SM                11
2523 #define DOT11_RRM_CAP_LCIM              12
2524 #define DOT11_RRM_CAP_LCIA              13
2525 #define DOT11_RRM_CAP_TSCM              14
2526 #define DOT11_RRM_CAP_TTSCM             15
2527 #define DOT11_RRM_CAP_AP_CHANREP        16
2528 #define DOT11_RRM_CAP_RMMIB             17
2529 /* bit18-bit26, not used for RRM_IOVAR */
2530 #define DOT11_RRM_CAP_MPTI              27
2531 #define DOT11_RRM_CAP_NBRTSFO           28
2532 #define DOT11_RRM_CAP_RCPI              29
2533 #define DOT11_RRM_CAP_RSNI              30
2534 #define DOT11_RRM_CAP_BSSAAD            31
2535 #define DOT11_RRM_CAP_BSSAAC            32
2536 #define DOT11_RRM_CAP_AI                33
2537 #define DOT11_RRM_CAP_FTM_RANGE         34
2538 #define DOT11_RRM_CAP_CIVIC_LOC         35
2539 #define DOT11_RRM_CAP_LAST              35
2540
2541 /* Operating Class (formerly "Regulatory Class") definitions */
2542 #define DOT11_OP_CLASS_NONE                     255
2543
2544 BWL_PRE_PACKED_STRUCT struct do11_ap_chrep {
2545         uint8 id;
2546         uint8 len;
2547         uint8 reg;
2548         uint8 chanlist[1];
2549 } BWL_POST_PACKED_STRUCT;
2550 typedef struct do11_ap_chrep dot11_ap_chrep_t;
2551
2552 /* Radio Measurements action ids */
2553 #define DOT11_RM_ACTION_RM_REQ          0       /* Radio measurement request */
2554 #define DOT11_RM_ACTION_RM_REP          1       /* Radio measurement report */
2555 #define DOT11_RM_ACTION_LM_REQ          2       /* Link measurement request */
2556 #define DOT11_RM_ACTION_LM_REP          3       /* Link measurement report */
2557 #define DOT11_RM_ACTION_NR_REQ          4       /* Neighbor report request */
2558 #define DOT11_RM_ACTION_NR_REP          5       /* Neighbor report response */
2559
2560 /** Generic radio measurement action frame header */
2561 BWL_PRE_PACKED_STRUCT struct dot11_rm_action {
2562         uint8 category;                         /* category of action frame (5) */
2563         uint8 action;                           /* radio measurement action */
2564         uint8 token;                            /* dialog token */
2565         uint8 data[1];
2566 } BWL_POST_PACKED_STRUCT;
2567 typedef struct dot11_rm_action dot11_rm_action_t;
2568 #define DOT11_RM_ACTION_LEN 3
2569
2570 BWL_PRE_PACKED_STRUCT struct dot11_rmreq {
2571         uint8 category;                         /* category of action frame (5) */
2572         uint8 action;                           /* radio measurement action */
2573         uint8 token;                            /* dialog token */
2574         uint16 reps;                            /* no. of repetitions */
2575         uint8 data[1];
2576 } BWL_POST_PACKED_STRUCT;
2577 typedef struct dot11_rmreq dot11_rmreq_t;
2578 #define DOT11_RMREQ_LEN 5
2579
2580 BWL_PRE_PACKED_STRUCT struct dot11_rm_ie {
2581         uint8 id;
2582         uint8 len;
2583         uint8 token;
2584         uint8 mode;
2585         uint8 type;
2586 } BWL_POST_PACKED_STRUCT;
2587 typedef struct dot11_rm_ie dot11_rm_ie_t;
2588 #define DOT11_RM_IE_LEN 5
2589
2590 /* Definitions for "mode" bits in rm req */
2591 #define DOT11_RMREQ_MODE_PARALLEL       1
2592 #define DOT11_RMREQ_MODE_ENABLE         2
2593 #define DOT11_RMREQ_MODE_REQUEST        4
2594 #define DOT11_RMREQ_MODE_REPORT         8
2595 #define DOT11_RMREQ_MODE_DURMAND        0x10    /* Duration Mandatory */
2596
2597 /* Definitions for "mode" bits in rm rep */
2598 #define DOT11_RMREP_MODE_LATE           1
2599 #define DOT11_RMREP_MODE_INCAPABLE      2
2600 #define DOT11_RMREP_MODE_REFUSED        4
2601
2602 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_bcn {
2603         uint8 id;
2604         uint8 len;
2605         uint8 token;
2606         uint8 mode;
2607         uint8 type;
2608         uint8 reg;
2609         uint8 channel;
2610         uint16 interval;
2611         uint16 duration;
2612         uint8 bcn_mode;
2613         struct ether_addr       bssid;
2614 } BWL_POST_PACKED_STRUCT;
2615 typedef struct dot11_rmreq_bcn dot11_rmreq_bcn_t;
2616 #define DOT11_RMREQ_BCN_LEN     18
2617
2618 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_bcn {
2619         uint8 reg;
2620         uint8 channel;
2621         uint32 starttime[2];
2622         uint16 duration;
2623         uint8 frame_info;
2624         uint8 rcpi;
2625         uint8 rsni;
2626         struct ether_addr       bssid;
2627         uint8 antenna_id;
2628         uint32 parent_tsf;
2629 } BWL_POST_PACKED_STRUCT;
2630 typedef struct dot11_rmrep_bcn dot11_rmrep_bcn_t;
2631 #define DOT11_RMREP_BCN_LEN     26
2632
2633 /* Beacon request measurement mode */
2634 #define DOT11_RMREQ_BCN_PASSIVE 0
2635 #define DOT11_RMREQ_BCN_ACTIVE  1
2636 #define DOT11_RMREQ_BCN_TABLE   2
2637
2638 /* Sub-element IDs for Beacon Request */
2639 #define DOT11_RMREQ_BCN_SSID_ID 0
2640 #define DOT11_RMREQ_BCN_REPINFO_ID  1
2641 #define DOT11_RMREQ_BCN_REPDET_ID   2
2642 #define DOT11_RMREQ_BCN_REQUEST_ID  10
2643 #define DOT11_RMREQ_BCN_APCHREP_ID  DOT11_MNG_AP_CHREP_ID
2644
2645 /* Reporting Detail element definition */
2646 #define DOT11_RMREQ_BCN_REPDET_FIXED    0       /* Fixed length fields only */
2647 #define DOT11_RMREQ_BCN_REPDET_REQUEST  1       /* + requested information elems */
2648 #define DOT11_RMREQ_BCN_REPDET_ALL      2       /* All fields */
2649
2650 /* Reporting Information (reporting condition) element definition */
2651 #define DOT11_RMREQ_BCN_REPINFO_LEN     2       /* Beacon Reporting Information length */
2652 #define DOT11_RMREQ_BCN_REPCOND_DEFAULT 0       /* Report to be issued after each measurement */
2653
2654 /* Sub-element IDs for Beacon Report */
2655 #define DOT11_RMREP_BCN_FRM_BODY        1
2656 #define DOT11_RMREP_BCN_FRM_BODY_LEN_MAX        224 /* 802.11k-2008 7.3.2.22.6 */
2657
2658 /* Sub-element IDs for Frame Report */
2659 #define DOT11_RMREP_FRAME_COUNT_REPORT 1
2660
2661 /* Statistics Group Report: Group IDs */
2662 #define DOT11_RRM_STATS_GRP_ID_0        0
2663
2664 /* Statistics Group Report: Group Data length  */
2665 #define DOT11_RRM_STATS_RPT_LEN_GRP_ID_0        28
2666
2667 /* Channel load request */
2668 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_chanload {
2669         uint8 id;
2670         uint8 len;
2671         uint8 token;
2672         uint8 mode;
2673         uint8 type;
2674         uint8 reg;
2675         uint8 channel;
2676         uint16 interval;
2677         uint16 duration;
2678 } BWL_POST_PACKED_STRUCT;
2679 typedef struct dot11_rmreq_chanload dot11_rmreq_chanload_t;
2680 #define DOT11_RMREQ_CHANLOAD_LEN        11
2681
2682 /** Channel load report */
2683 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_chanload {
2684         uint8 reg;
2685         uint8 channel;
2686         uint32 starttime[2];
2687         uint16 duration;
2688         uint8 channel_load;
2689 } BWL_POST_PACKED_STRUCT;
2690 typedef struct dot11_rmrep_chanload dot11_rmrep_chanload_t;
2691 #define DOT11_RMREP_CHANLOAD_LEN        13
2692
2693 /** Noise histogram request */
2694 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_noise {
2695         uint8 id;
2696         uint8 len;
2697         uint8 token;
2698         uint8 mode;
2699         uint8 type;
2700         uint8 reg;
2701         uint8 channel;
2702         uint16 interval;
2703         uint16 duration;
2704 } BWL_POST_PACKED_STRUCT;
2705 typedef struct dot11_rmreq_noise dot11_rmreq_noise_t;
2706 #define DOT11_RMREQ_NOISE_LEN 11
2707
2708 /** Noise histogram report */
2709 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_noise {
2710         uint8 reg;
2711         uint8 channel;
2712         uint32 starttime[2];
2713         uint16 duration;
2714         uint8 antid;
2715         uint8 anpi;
2716         uint8 ipi0_dens;
2717         uint8 ipi1_dens;
2718         uint8 ipi2_dens;
2719         uint8 ipi3_dens;
2720         uint8 ipi4_dens;
2721         uint8 ipi5_dens;
2722         uint8 ipi6_dens;
2723         uint8 ipi7_dens;
2724         uint8 ipi8_dens;
2725         uint8 ipi9_dens;
2726         uint8 ipi10_dens;
2727 } BWL_POST_PACKED_STRUCT;
2728 typedef struct dot11_rmrep_noise dot11_rmrep_noise_t;
2729 #define DOT11_RMREP_NOISE_LEN 25
2730
2731 /** Frame request */
2732 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_frame {
2733         uint8 id;
2734         uint8 len;
2735         uint8 token;
2736         uint8 mode;
2737         uint8 type;
2738         uint8 reg;
2739         uint8 channel;
2740         uint16 interval;
2741         uint16 duration;
2742         uint8 req_type;
2743         struct ether_addr       ta;
2744 } BWL_POST_PACKED_STRUCT;
2745 typedef struct dot11_rmreq_frame dot11_rmreq_frame_t;
2746 #define DOT11_RMREQ_FRAME_LEN 18
2747
2748 /** Frame report */
2749 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_frame {
2750         uint8 reg;
2751         uint8 channel;
2752         uint32 starttime[2];
2753         uint16 duration;
2754 } BWL_POST_PACKED_STRUCT;
2755 typedef struct dot11_rmrep_frame dot11_rmrep_frame_t;
2756 #define DOT11_RMREP_FRAME_LEN 12
2757
2758 /** Frame report entry */
2759 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_frmentry {
2760         struct ether_addr       ta;
2761         struct ether_addr       bssid;
2762         uint8 phy_type;
2763         uint8 avg_rcpi;
2764         uint8 last_rsni;
2765         uint8 last_rcpi;
2766         uint8 ant_id;
2767         uint16 frame_cnt;
2768 } BWL_POST_PACKED_STRUCT;
2769 typedef struct dot11_rmrep_frmentry dot11_rmrep_frmentry_t;
2770 #define DOT11_RMREP_FRMENTRY_LEN 19
2771
2772 /** STA statistics request */
2773 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_stat {
2774         uint8 id;
2775         uint8 len;
2776         uint8 token;
2777         uint8 mode;
2778         uint8 type;
2779         struct ether_addr       peer;
2780         uint16 interval;
2781         uint16 duration;
2782         uint8 group_id;
2783 } BWL_POST_PACKED_STRUCT;
2784 typedef struct dot11_rmreq_stat dot11_rmreq_stat_t;
2785 #define DOT11_RMREQ_STAT_LEN 16
2786
2787 /** STA statistics report */
2788 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_stat {
2789         uint16 duration;
2790         uint8 group_id;
2791 } BWL_POST_PACKED_STRUCT;
2792 typedef struct dot11_rmrep_stat dot11_rmrep_stat_t;
2793
2794 /** Transmit stream/category measurement request */
2795 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_tx_stream {
2796         uint8 id;
2797         uint8 len;
2798         uint8 token;
2799         uint8 mode;
2800         uint8 type;
2801         uint16 interval;
2802         uint16 duration;
2803         struct ether_addr       peer;
2804         uint8 traffic_id;
2805         uint8 bin0_range;
2806 } BWL_POST_PACKED_STRUCT;
2807 typedef struct dot11_rmreq_tx_stream dot11_rmreq_tx_stream_t;
2808
2809 /** Transmit stream/category measurement report */
2810 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_tx_stream {
2811         uint32 starttime[2];
2812         uint16 duration;
2813         struct ether_addr       peer;
2814         uint8 traffic_id;
2815         uint8 reason;
2816         uint32 txmsdu_cnt;
2817         uint32 msdu_discarded_cnt;
2818         uint32 msdufailed_cnt;
2819         uint32 msduretry_cnt;
2820         uint32 cfpolls_lost_cnt;
2821         uint32 avrqueue_delay;
2822         uint32 avrtx_delay;
2823         uint8 bin0_range;
2824         uint32 bin0;
2825         uint32 bin1;
2826         uint32 bin2;
2827         uint32 bin3;
2828         uint32 bin4;
2829         uint32 bin5;
2830 } BWL_POST_PACKED_STRUCT;
2831 typedef struct dot11_rmrep_tx_stream dot11_rmrep_tx_stream_t;
2832
2833 enum {
2834         DOT11_FTM_LOCATION_SUBJ_LOCAL = 0,              /* Where am I? */
2835         DOT11_FTM_LOCATION_SUBJ_REMOTE = 1,             /* Where are you? */
2836         DOT11_FTM_LOCATION_SUBJ_THIRDPARTY = 2   /* Where is he/she? */
2837 };
2838
2839 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_ftm_lci {
2840         uint8 id;
2841         uint8 len;
2842         uint8 token;
2843         uint8 mode;
2844         uint8 type;
2845         uint8 subj;
2846
2847         /* Following 3 fields are unused. Keep for ROM compatibility. */
2848         uint8 lat_res;
2849         uint8 lon_res;
2850         uint8 alt_res;
2851
2852         /* optional sub-elements */
2853 } BWL_POST_PACKED_STRUCT;
2854 typedef struct dot11_rmreq_ftm_lci dot11_rmreq_ftm_lci_t;
2855
2856 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_ftm_lci {
2857         uint8 id;
2858         uint8 len;
2859         uint8 token;
2860         uint8 mode;
2861         uint8 type;
2862         uint8 lci_sub_id;
2863         uint8 lci_sub_len;
2864         /* optional LCI field */
2865         /* optional sub-elements */
2866 } BWL_POST_PACKED_STRUCT;
2867 typedef struct dot11_rmrep_ftm_lci dot11_rmrep_ftm_lci_t;
2868
2869 #define DOT11_FTM_LCI_SUBELEM_ID                0
2870 #define DOT11_FTM_LCI_SUBELEM_LEN               2
2871 #define DOT11_FTM_LCI_FIELD_LEN                 16
2872 #define DOT11_FTM_LCI_UNKNOWN_LEN               2
2873
2874 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_ftm_civic {
2875         uint8 id;
2876         uint8 len;
2877         uint8 token;
2878         uint8 mode;
2879         uint8 type;
2880         uint8 subj;
2881         uint8 civloc_type;
2882         uint8 siu;      /* service interval units */
2883         uint16 si;  /* service interval */
2884         /* optional sub-elements */
2885 } BWL_POST_PACKED_STRUCT;
2886 typedef struct dot11_rmreq_ftm_civic dot11_rmreq_ftm_civic_t;
2887
2888 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_ftm_civic {
2889         uint8 id;
2890         uint8 len;
2891         uint8 token;
2892         uint8 mode;
2893         uint8 type;
2894         uint8 civloc_type;
2895         uint8 civloc_sub_id;
2896         uint8 civloc_sub_len;
2897         /* optional location civic field */
2898         /* optional sub-elements */
2899 } BWL_POST_PACKED_STRUCT;
2900 typedef struct dot11_rmrep_ftm_civic dot11_rmrep_ftm_civic_t;
2901
2902 #define DOT11_FTM_CIVIC_LOC_TYPE_RFC4776        0
2903 #define DOT11_FTM_CIVIC_SUBELEM_ID                      0
2904 #define DOT11_FTM_CIVIC_SUBELEM_LEN             2
2905 #define DOT11_FTM_CIVIC_LOC_SI_NONE                     0
2906 #define DOT11_FTM_CIVIC_TYPE_LEN                        1
2907 #define DOT11_FTM_CIVIC_UNKNOWN_LEN             3
2908
2909 BWL_PRE_PACKED_STRUCT struct dot11_ftm_range_subel {
2910         uint8 id;
2911         uint8 len;
2912         uint16 max_age;
2913 } BWL_POST_PACKED_STRUCT;
2914 typedef struct dot11_ftm_range_subel dot11_ftm_range_subel_t;
2915 #define DOT11_FTM_RANGE_SUBELEM_ID      4
2916 #define DOT11_FTM_RANGE_SUBELEM_LEN     2
2917
2918 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_ftm_range {
2919         uint8 id;
2920         uint8 len;
2921         uint8 token;
2922         uint8 mode;
2923         uint8 type;
2924         uint16 max_init_delay;          /* maximum random initial delay */
2925         uint8 min_ap_count;
2926         uint8 data[1];
2927         /* neighbor report sub-elements */
2928         /* optional sub-elements */
2929 } BWL_POST_PACKED_STRUCT;
2930 typedef struct dot11_rmreq_ftm_range dot11_rmreq_ftm_range_t;
2931 #define DOT11_RMREQ_FTM_RANGE_LEN 8
2932
2933 BWL_PRE_PACKED_STRUCT struct dot11_ftm_range_entry {
2934         uint32 start_tsf;               /* 4 lsb of tsf */
2935         struct ether_addr bssid;
2936         uint16 range;
2937         uint16 max_err;
2938         uint8  rsvd;
2939 } BWL_POST_PACKED_STRUCT;
2940 typedef struct dot11_ftm_range_entry dot11_ftm_range_entry_t;
2941 #define DOT11_FTM_RANGE_ENTRY_MAX_COUNT   15
2942
2943 enum {
2944         DOT11_FTM_RANGE_ERROR_AP_INCAPABLE = 3,
2945         DOT11_FTM_RANGE_ERROR_AP_FAILED = 4,
2946         DOT11_FTM_RANGE_ERROR_TX_FAILED = 8,
2947         DOT11_FTM_RANGE_ERROR_MAX
2948 };
2949
2950 BWL_PRE_PACKED_STRUCT struct dot11_ftm_range_error_entry {
2951         uint32 start_tsf;               /* 4 lsb of tsf */
2952         struct ether_addr bssid;
2953         uint8  code;
2954 } BWL_POST_PACKED_STRUCT;
2955 typedef struct dot11_ftm_range_error_entry dot11_ftm_range_error_entry_t;
2956 #define DOT11_FTM_RANGE_ERROR_ENTRY_MAX_COUNT   11
2957
2958 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_ftm_range {
2959     uint8 id;
2960     uint8 len;
2961     uint8 token;
2962     uint8 mode;
2963     uint8 type;
2964     uint8 entry_count;
2965     uint8 data[2]; /* includes pad */
2966         /*
2967         dot11_ftm_range_entry_t entries[entry_count];
2968         uint8 error_count;
2969         dot11_ftm_error_entry_t errors[error_count];
2970          */
2971 } BWL_POST_PACKED_STRUCT;
2972 typedef struct dot11_rmrep_ftm_range dot11_rmrep_ftm_range_t;
2973
2974 #define DOT11_FTM_RANGE_REP_MIN_LEN     6       /* No extra byte for error_count */
2975 #define DOT11_FTM_RANGE_ENTRY_CNT_MAX   15
2976 #define DOT11_FTM_RANGE_ERROR_CNT_MAX   11
2977 #define DOT11_FTM_RANGE_REP_FIXED_LEN   1       /* No extra byte for error_count */
2978 /** Measurement pause request */
2979 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_pause_time {
2980         uint8 id;
2981         uint8 len;
2982         uint8 token;
2983         uint8 mode;
2984         uint8 type;
2985         uint16 pause_time;
2986 } BWL_POST_PACKED_STRUCT;
2987 typedef struct dot11_rmreq_pause_time dot11_rmreq_pause_time_t;
2988
2989
2990 /* Neighbor Report subelements ID (11k & 11v) */
2991 #define DOT11_NGBR_TSF_INFO_SE_ID       1
2992 #define DOT11_NGBR_CCS_SE_ID            2
2993 #define DOT11_NGBR_BSSTRANS_PREF_SE_ID  3
2994 #define DOT11_NGBR_BSS_TERM_DUR_SE_ID   4
2995 #define DOT11_NGBR_BEARING_SE_ID        5
2996
2997 /** Neighbor Report, BSS Transition Candidate Preference subelement */
2998 BWL_PRE_PACKED_STRUCT struct dot11_ngbr_bsstrans_pref_se {
2999         uint8 sub_id;
3000         uint8 len;
3001         uint8 preference;
3002 } BWL_POST_PACKED_STRUCT;
3003 typedef struct dot11_ngbr_bsstrans_pref_se dot11_ngbr_bsstrans_pref_se_t;
3004 #define DOT11_NGBR_BSSTRANS_PREF_SE_LEN 1
3005
3006 /** Neighbor Report, BSS Termination Duration subelement */
3007 BWL_PRE_PACKED_STRUCT struct dot11_ngbr_bss_term_dur_se {
3008         uint8 sub_id;
3009         uint8 len;
3010         uint8 tsf[8];
3011         uint16 duration;
3012 } BWL_POST_PACKED_STRUCT;
3013 typedef struct dot11_ngbr_bss_term_dur_se dot11_ngbr_bss_term_dur_se_t;
3014 #define DOT11_NGBR_BSS_TERM_DUR_SE_LEN  10
3015
3016 /* Neighbor Report BSSID Information Field */
3017 #define DOT11_NGBR_BI_REACHABILTY_UNKN  0x0002
3018 #define DOT11_NGBR_BI_REACHABILTY       0x0003
3019 #define DOT11_NGBR_BI_SEC               0x0004
3020 #define DOT11_NGBR_BI_KEY_SCOPE         0x0008
3021 #define DOT11_NGBR_BI_CAP               0x03f0
3022 #define DOT11_NGBR_BI_CAP_SPEC_MGMT     0x0010
3023 #define DOT11_NGBR_BI_CAP_QOS           0x0020
3024 #define DOT11_NGBR_BI_CAP_APSD          0x0040
3025 #define DOT11_NGBR_BI_CAP_RDIO_MSMT     0x0080
3026 #define DOT11_NGBR_BI_CAP_DEL_BA        0x0100
3027 #define DOT11_NGBR_BI_CAP_IMM_BA        0x0200
3028 #define DOT11_NGBR_BI_MOBILITY          0x0400
3029 #define DOT11_NGBR_BI_HT                0x0800
3030 #define DOT11_NGBR_BI_VHT               0x1000
3031 #define DOT11_NGBR_BI_FTM               0x2000
3032
3033 /** Neighbor Report element (11k & 11v) */
3034 BWL_PRE_PACKED_STRUCT struct dot11_neighbor_rep_ie {
3035         uint8 id;
3036         uint8 len;
3037         struct ether_addr bssid;
3038         uint32 bssid_info;
3039         uint8 reg;              /* Operating class */
3040         uint8 channel;
3041         uint8 phytype;
3042         uint8 data[1];          /* Variable size subelements */
3043 } BWL_POST_PACKED_STRUCT;
3044 typedef struct dot11_neighbor_rep_ie dot11_neighbor_rep_ie_t;
3045 #define DOT11_NEIGHBOR_REP_IE_FIXED_LEN 13
3046
3047
3048 /* MLME Enumerations */
3049 #define DOT11_BSSTYPE_INFRASTRUCTURE            0       /* d11 infrastructure */
3050 #define DOT11_BSSTYPE_INDEPENDENT               1       /* d11 independent */
3051 #define DOT11_BSSTYPE_ANY                       2       /* d11 any BSS type */
3052 #define DOT11_BSSTYPE_MESH                      3       /* d11 Mesh */
3053 #define DOT11_SCANTYPE_ACTIVE                   0       /* d11 scan active */
3054 #define DOT11_SCANTYPE_PASSIVE                  1       /* d11 scan passive */
3055
3056 /** Link Measurement */
3057 BWL_PRE_PACKED_STRUCT struct dot11_lmreq {
3058         uint8 category;                         /* category of action frame (5) */
3059         uint8 action;                           /* radio measurement action */
3060         uint8 token;                            /* dialog token */
3061         uint8 txpwr;                            /* Transmit Power Used */
3062         uint8 maxtxpwr;                         /* Max Transmit Power */
3063 } BWL_POST_PACKED_STRUCT;
3064 typedef struct dot11_lmreq dot11_lmreq_t;
3065 #define DOT11_LMREQ_LEN 5
3066
3067 BWL_PRE_PACKED_STRUCT struct dot11_lmrep {
3068         uint8 category;                         /* category of action frame (5) */
3069         uint8 action;                           /* radio measurement action */
3070         uint8 token;                            /* dialog token */
3071         dot11_tpc_rep_t tpc;                    /* TPC element */
3072         uint8 rxant;                            /* Receive Antenna ID */
3073         uint8 txant;                            /* Transmit Antenna ID */
3074         uint8 rcpi;                             /* RCPI */
3075         uint8 rsni;                             /* RSNI */
3076 } BWL_POST_PACKED_STRUCT;
3077 typedef struct dot11_lmrep dot11_lmrep_t;
3078 #define DOT11_LMREP_LEN 11
3079
3080 /* 802.11 BRCM "Compromise" Pre N constants */
3081 #define PREN_PREAMBLE           24      /* green field preamble time */
3082 #define PREN_MM_EXT             12      /* extra mixed mode preamble time */
3083 #define PREN_PREAMBLE_EXT       4       /* extra preamble (multiply by unique_streams-1) */
3084
3085 /* 802.11N PHY constants */
3086 #define RIFS_11N_TIME           2       /* NPHY RIFS time */
3087
3088 /* 802.11 HT PLCP format 802.11n-2009, sec 20.3.9.4.3
3089  * HT-SIG is composed of two 24 bit parts, HT-SIG1 and HT-SIG2
3090  */
3091 /* HT-SIG1 */
3092 #define HT_SIG1_MCS_MASK        0x00007F
3093 #define HT_SIG1_CBW             0x000080
3094 #define HT_SIG1_HT_LENGTH       0xFFFF00
3095
3096 /* HT-SIG2 */
3097 #define HT_SIG2_SMOOTHING       0x000001
3098 #define HT_SIG2_NOT_SOUNDING    0x000002
3099 #define HT_SIG2_RESERVED        0x000004
3100 #define HT_SIG2_AGGREGATION     0x000008
3101 #define HT_SIG2_STBC_MASK       0x000030
3102 #define HT_SIG2_STBC_SHIFT      4
3103 #define HT_SIG2_FEC_CODING      0x000040
3104 #define HT_SIG2_SHORT_GI        0x000080
3105 #define HT_SIG2_ESS_MASK        0x000300
3106 #define HT_SIG2_ESS_SHIFT       8
3107 #define HT_SIG2_CRC             0x03FC00
3108 #define HT_SIG2_TAIL            0x1C0000
3109
3110 /* HT Timing-related parameters (802.11-2012, sec 20.3.6) */
3111 #define HT_T_LEG_PREAMBLE      16
3112 #define HT_T_L_SIG              4
3113 #define HT_T_SIG                8
3114 #define HT_T_LTF1               4
3115 #define HT_T_GF_LTF1            8
3116 #define HT_T_LTFs               4
3117 #define HT_T_STF                4
3118 #define HT_T_GF_STF             8
3119 #define HT_T_SYML               4
3120
3121 #define HT_N_SERVICE           16       /* bits in SERVICE field */
3122 #define HT_N_TAIL               6       /* tail bits per BCC encoder */
3123
3124 /* 802.11 A PHY constants */
3125 #define APHY_SLOT_TIME          9       /* APHY slot time */
3126 #define APHY_SIFS_TIME          16      /* APHY SIFS time */
3127 #define APHY_DIFS_TIME          (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))  /* APHY DIFS time */
3128 #define APHY_PREAMBLE_TIME      16      /* APHY preamble time */
3129 #define APHY_SIGNAL_TIME        4       /* APHY signal time */
3130 #define APHY_SYMBOL_TIME        4       /* APHY symbol time */
3131 #define APHY_SERVICE_NBITS      16      /* APHY service nbits */
3132 #define APHY_TAIL_NBITS         6       /* APHY tail nbits */
3133 #define APHY_CWMIN              15      /* APHY cwmin */
3134 #define APHY_PHYHDR_DUR         20      /* APHY PHY Header Duration */
3135
3136 /* 802.11 B PHY constants */
3137 #define BPHY_SLOT_TIME          20      /* BPHY slot time */
3138 #define BPHY_SIFS_TIME          10      /* BPHY SIFS time */
3139 #define BPHY_DIFS_TIME          50      /* BPHY DIFS time */
3140 #define BPHY_PLCP_TIME          192     /* BPHY PLCP time */
3141 #define BPHY_PLCP_SHORT_TIME    96      /* BPHY PLCP short time */
3142 #define BPHY_CWMIN              31      /* BPHY cwmin */
3143 #define BPHY_SHORT_PHYHDR_DUR   96      /* BPHY Short PHY Header Duration */
3144 #define BPHY_LONG_PHYHDR_DUR    192     /* BPHY Long PHY Header Duration */
3145
3146 /* 802.11 G constants */
3147 #define DOT11_OFDM_SIGNAL_EXTENSION     6       /* d11 OFDM signal extension */
3148
3149 #define PHY_CWMAX               1023    /* PHY cwmax */
3150
3151 #define DOT11_MAXNUMFRAGS       16      /* max # fragments per MSDU */
3152
3153 /* 802.11 VHT constants */
3154
3155 typedef int vht_group_id_t;
3156
3157 /* for VHT-A1 */
3158 /* SIG-A1 reserved bits */
3159 #define VHT_SIGA1_CONST_MASK            0x800004
3160
3161 #define VHT_SIGA1_BW_MASK               0x000003
3162 #define VHT_SIGA1_20MHZ_VAL             0x000000
3163 #define VHT_SIGA1_40MHZ_VAL             0x000001
3164 #define VHT_SIGA1_80MHZ_VAL             0x000002
3165 #define VHT_SIGA1_160MHZ_VAL            0x000003
3166
3167 #define VHT_SIGA1_STBC                  0x000008
3168
3169 #define VHT_SIGA1_GID_MASK              0x0003f0
3170 #define VHT_SIGA1_GID_SHIFT             4
3171 #define VHT_SIGA1_GID_TO_AP             0x00
3172 #define VHT_SIGA1_GID_NOT_TO_AP         0x3f
3173 #define VHT_SIGA1_GID_MAX_GID           0x3f
3174
3175 #define VHT_SIGA1_NSTS_SHIFT_MASK_USER0 0x001C00
3176 #define VHT_SIGA1_NSTS_SHIFT            10
3177 #define VHT_SIGA1_MAX_USERPOS           3
3178
3179 #define VHT_SIGA1_PARTIAL_AID_MASK      0x3fe000
3180 #define VHT_SIGA1_PARTIAL_AID_SHIFT     13
3181
3182 #define VHT_SIGA1_TXOP_PS_NOT_ALLOWED   0x400000
3183
3184 /* for VHT-A2 */
3185 #define VHT_SIGA2_GI_NONE               0x000000
3186 #define VHT_SIGA2_GI_SHORT              0x000001
3187 #define VHT_SIGA2_GI_W_MOD10            0x000002
3188 #define VHT_SIGA2_CODING_LDPC           0x000004
3189 #define VHT_SIGA2_LDPC_EXTRA_OFDM_SYM   0x000008
3190 #define VHT_SIGA2_BEAMFORM_ENABLE       0x000100
3191 #define VHT_SIGA2_MCS_SHIFT             4
3192
3193 #define VHT_SIGA2_B9_RESERVED           0x000200
3194 #define VHT_SIGA2_TAIL_MASK             0xfc0000
3195 #define VHT_SIGA2_TAIL_VALUE            0x000000
3196
3197 /* VHT Timing-related parameters (802.11ac D4.0, sec 22.3.6) */
3198 #define VHT_T_LEG_PREAMBLE      16
3199 #define VHT_T_L_SIG              4
3200 #define VHT_T_SIG_A              8
3201 #define VHT_T_LTF                4
3202 #define VHT_T_STF                4
3203 #define VHT_T_SIG_B              4
3204 #define VHT_T_SYML               4
3205
3206 #define VHT_N_SERVICE           16      /* bits in SERVICE field */
3207 #define VHT_N_TAIL               6      /* tail bits per BCC encoder */
3208
3209
3210 /** dot11Counters Table - 802.11 spec., Annex D */
3211 typedef struct d11cnt {
3212         uint32          txfrag;         /* dot11TransmittedFragmentCount */
3213         uint32          txmulti;        /* dot11MulticastTransmittedFrameCount */
3214         uint32          txfail;         /* dot11FailedCount */
3215         uint32          txretry;        /* dot11RetryCount */
3216         uint32          txretrie;       /* dot11MultipleRetryCount */
3217         uint32          rxdup;          /* dot11FrameduplicateCount */
3218         uint32          txrts;          /* dot11RTSSuccessCount */
3219         uint32          txnocts;        /* dot11RTSFailureCount */
3220         uint32          txnoack;        /* dot11ACKFailureCount */
3221         uint32          rxfrag;         /* dot11ReceivedFragmentCount */
3222         uint32          rxmulti;        /* dot11MulticastReceivedFrameCount */
3223         uint32          rxcrc;          /* dot11FCSErrorCount */
3224         uint32          txfrmsnt;       /* dot11TransmittedFrameCount */
3225         uint32          rxundec;        /* dot11WEPUndecryptableCount */
3226 } d11cnt_t;
3227
3228 #define BRCM_PROP_OUI           "\x00\x90\x4C"
3229
3230
3231 /* Action frame type for FTM Initiator Report */
3232 #define BRCM_FTM_VS_AF_TYPE     14
3233 enum {
3234         BRCM_FTM_VS_INITIATOR_RPT_SUBTYPE = 1,  /* FTM Initiator Report */
3235         BRCM_FTM_VS_COLLECT_SUBTYPE = 2,        /* FTM Collect debug protocol */
3236 };
3237
3238 /* Action frame type for RWL */
3239 #define RWL_WIFI_DEFAULT                0
3240 #define RWL_WIFI_FIND_MY_PEER           9 /* Used while finding server */
3241 #define RWL_WIFI_FOUND_PEER             10 /* Server response to the client  */
3242 #define RWL_ACTION_WIFI_FRAG_TYPE       85 /* Fragment indicator for receiver */
3243
3244 #define PROXD_AF_TYPE                   11 /* Wifi proximity action frame type */
3245 #define BRCM_RELMACST_AF_TYPE           12 /* RMC action frame type */
3246
3247
3248
3249 /* brcm syscap_ie cap */
3250 #define BRCM_SYSCAP_WET_TUNNEL  0x0100  /* Device with WET_TUNNEL support */
3251
3252 #define BRCM_OUI                "\x00\x10\x18"  /* Broadcom OUI */
3253
3254 /** BRCM info element */
3255 BWL_PRE_PACKED_STRUCT struct brcm_ie {
3256         uint8   id;             /* IE ID, 221, DOT11_MNG_PROPR_ID */
3257         uint8   len;            /* IE length */
3258         uint8   oui[3];
3259         uint8   ver;            /* type/ver of this IE */
3260         uint8   assoc;          /* # of assoc STAs */
3261         uint8   flags;          /* misc flags */
3262         uint8   flags1;         /* misc flags */
3263         uint16  amsdu_mtu_pref; /* preferred A-MSDU MTU */
3264 } BWL_POST_PACKED_STRUCT;
3265 typedef struct brcm_ie brcm_ie_t;
3266 #define BRCM_IE_LEN             11      /* BRCM IE length */
3267 #define BRCM_IE_VER             2       /* BRCM IE version */
3268 #define BRCM_IE_LEGACY_AES_VER  1       /* BRCM IE legacy AES version */
3269
3270 /* brcm_ie flags */
3271 #define BRF_ABCAP               0x1     /* afterburner is obsolete,  defined for backward compat */
3272 #define BRF_ABRQRD              0x2     /* afterburner is obsolete,  defined for backward compat */
3273 #define BRF_LZWDS               0x4     /* lazy wds enabled */
3274 #define BRF_BLOCKACK            0x8     /* BlockACK capable */
3275 #define BRF_ABCOUNTER_MASK      0xf0    /* afterburner is obsolete,  defined for backward compat */
3276 #define BRF_PROP_11N_MCS        0x10    /* re-use afterburner bit */
3277 #define BRF_MEDIA_CLIENT        0x20    /* re-use afterburner bit to indicate media client device */
3278
3279 #define GET_BRF_PROP_11N_MCS(brcm_ie) \
3280         (!((brcm_ie)->flags & BRF_ABCAP) && ((brcm_ie)->flags & BRF_PROP_11N_MCS))
3281
3282 /* brcm_ie flags1 */
3283 #define BRF1_AMSDU              0x1     /* A-MSDU capable */
3284 #define BRF1_WNM                0x2     /* WNM capable */
3285 #define BRF1_WMEPS              0x4     /* AP is capable of handling WME + PS w/o APSD */
3286 #define BRF1_PSOFIX             0x8     /* AP has fixed PS mode out-of-order packets */
3287 #define BRF1_RX_LARGE_AGG       0x10    /* device can rx large aggregates */
3288 #define BRF1_RFAWARE_DCS        0x20    /* RFAWARE dynamic channel selection (DCS) */
3289 #define BRF1_SOFTAP             0x40    /* Configure as Broadcom SOFTAP */
3290 #define BRF1_DWDS               0x80    /* DWDS capable */
3291
3292 /** Vendor IE structure */
3293 BWL_PRE_PACKED_STRUCT struct vndr_ie {
3294         uchar id;
3295         uchar len;
3296         uchar oui [3];
3297         uchar data [1];         /* Variable size data */
3298 } BWL_POST_PACKED_STRUCT;
3299 typedef struct vndr_ie vndr_ie_t;
3300
3301 #define VNDR_IE_HDR_LEN         2       /* id + len field */
3302 #define VNDR_IE_MIN_LEN         3       /* size of the oui field */
3303 #define VNDR_IE_FIXED_LEN       (VNDR_IE_HDR_LEN + VNDR_IE_MIN_LEN)
3304
3305 #define VNDR_IE_MAX_LEN         255     /* vendor IE max length, without ID and len */
3306
3307 /** BRCM PROP DEVICE PRIMARY MAC ADDRESS IE */
3308 BWL_PRE_PACKED_STRUCT struct member_of_brcm_prop_ie {
3309         uchar id;
3310         uchar len;
3311         uchar oui[3];
3312         uint8   type;           /* type indicates what follows */
3313         struct ether_addr ea;   /* Device Primary MAC Adrress */
3314 } BWL_POST_PACKED_STRUCT;
3315 typedef struct member_of_brcm_prop_ie member_of_brcm_prop_ie_t;
3316
3317 #define MEMBER_OF_BRCM_PROP_IE_LEN              10      /* IE max length */
3318 #define MEMBER_OF_BRCM_PROP_IE_HDRLEN           (sizeof(member_of_brcm_prop_ie_t))
3319 #define MEMBER_OF_BRCM_PROP_IE_TYPE             54
3320
3321 /** BRCM Reliable Multicast IE */
3322 BWL_PRE_PACKED_STRUCT struct relmcast_brcm_prop_ie {
3323         uint8 id;
3324         uint8 len;
3325         uint8 oui[3];
3326         uint8 type;           /* type indicates what follows */
3327         struct ether_addr ea;   /* The ack sender's MAC Adrress */
3328         struct ether_addr mcast_ea;  /* The multicast MAC address */
3329         uint8 updtmo; /* time interval(second) for client to send null packet to report its rssi */
3330 } BWL_POST_PACKED_STRUCT;
3331 typedef struct relmcast_brcm_prop_ie relmcast_brcm_prop_ie_t;
3332
3333 /* IE length */
3334 /* BRCM_PROP_IE_LEN = sizeof(relmcast_brcm_prop_ie_t)-((sizeof (id) + sizeof (len)))? */
3335 #define RELMCAST_BRCM_PROP_IE_LEN       (sizeof(relmcast_brcm_prop_ie_t)-(2*sizeof(uint8)))
3336
3337 #define RELMCAST_BRCM_PROP_IE_TYPE      55
3338
3339 /* BRCM BTC IE */
3340 BWL_PRE_PACKED_STRUCT struct btc_brcm_prop_ie {
3341         uint8 id;
3342         uint8 len;
3343         uint8 oui[3];
3344         uint8 type;           /* type inidicates what follows */
3345         uint32 info;
3346 } BWL_POST_PACKED_STRUCT;
3347 typedef struct btc_brcm_prop_ie btc_brcm_prop_ie_t;
3348
3349 #define BTC_INFO_BRCM_PROP_IE_TYPE      90
3350 #define BRCM_BTC_INFO_TYPE_LEN  (sizeof(btc_brcm_prop_ie_t) - (2 * sizeof(uint8)))
3351
3352 /* ************* HT definitions. ************* */
3353 #define MCSSET_LEN      16      /* 16-bits per 8-bit set to give 128-bits bitmap of MCS Index */
3354 #define MAX_MCS_NUM     (128)   /* max mcs number = 128 */
3355
3356 BWL_PRE_PACKED_STRUCT struct ht_cap_ie {
3357         uint16  cap;
3358         uint8   params;
3359         uint8   supp_mcs[MCSSET_LEN];
3360         uint16  ext_htcap;
3361         uint32  txbf_cap;
3362         uint8   as_cap;
3363 } BWL_POST_PACKED_STRUCT;
3364 typedef struct ht_cap_ie ht_cap_ie_t;
3365
3366 BWL_PRE_PACKED_STRUCT struct dot11_ht_cap_ie {
3367         uint8   id;
3368         uint8   len;
3369         ht_cap_ie_t ht_cap;
3370 } BWL_POST_PACKED_STRUCT;
3371 typedef struct dot11_ht_cap_ie dot11_ht_cap_ie_t;
3372
3373 /* CAP IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
3374 /* the capability IE is primarily used to convey this nodes abilities */
3375 BWL_PRE_PACKED_STRUCT struct ht_prop_cap_ie {
3376         uint8   id;             /* IE ID, 221, DOT11_MNG_PROPR_ID */
3377         uint8   len;            /* IE length */
3378         uint8   oui[3];
3379         uint8   type;           /* type indicates what follows */
3380         ht_cap_ie_t cap_ie;
3381 } BWL_POST_PACKED_STRUCT;
3382 typedef struct ht_prop_cap_ie ht_prop_cap_ie_t;
3383
3384 #define HT_PROP_IE_OVERHEAD     4       /* overhead bytes for prop oui ie */
3385 #define HT_CAP_IE_LEN           26      /* HT capability len (based on .11n d2.0) */
3386 #define HT_CAP_IE_TYPE          51
3387
3388 #define HT_CAP_LDPC_CODING      0x0001  /* Support for rx of LDPC coded pkts */
3389 #define HT_CAP_40MHZ            0x0002  /* FALSE:20Mhz, TRUE:20/40MHZ supported */
3390 #define HT_CAP_MIMO_PS_MASK     0x000C  /* Mimo PS mask */
3391 #define HT_CAP_MIMO_PS_SHIFT    0x0002  /* Mimo PS shift */
3392 #define HT_CAP_MIMO_PS_OFF      0x0003  /* Mimo PS, no restriction */
3393 #define HT_CAP_MIMO_PS_RTS      0x0001  /* Mimo PS, send RTS/CTS around MIMO frames */
3394 #define HT_CAP_MIMO_PS_ON       0x0000  /* Mimo PS, MIMO disallowed */
3395 #define HT_CAP_GF               0x0010  /* Greenfield preamble support */
3396 #define HT_CAP_SHORT_GI_20      0x0020  /* 20MHZ short guard interval support */
3397 #define HT_CAP_SHORT_GI_40      0x0040  /* 40Mhz short guard interval support */
3398 #define HT_CAP_TX_STBC          0x0080  /* Tx STBC support */
3399 #define HT_CAP_RX_STBC_MASK     0x0300  /* Rx STBC mask */
3400 #define HT_CAP_RX_STBC_SHIFT    8       /* Rx STBC shift */
3401 #define HT_CAP_DELAYED_BA       0x0400  /* delayed BA support */
3402 #define HT_CAP_MAX_AMSDU        0x0800  /* Max AMSDU size in bytes , 0=3839, 1=7935 */
3403
3404 #define HT_CAP_DSSS_CCK 0x1000  /* DSSS/CCK supported by the BSS */
3405 #define HT_CAP_PSMP             0x2000  /* Power Save Multi Poll support */
3406 #define HT_CAP_40MHZ_INTOLERANT 0x4000  /* 40MHz Intolerant */
3407 #define HT_CAP_LSIG_TXOP        0x8000  /* L-SIG TXOP protection support */
3408
3409 #define HT_CAP_RX_STBC_NO               0x0     /* no rx STBC support */
3410 #define HT_CAP_RX_STBC_ONE_STREAM       0x1     /* rx STBC support of 1 spatial stream */
3411 #define HT_CAP_RX_STBC_TWO_STREAM       0x2     /* rx STBC support of 1-2 spatial streams */
3412 #define HT_CAP_RX_STBC_THREE_STREAM     0x3     /* rx STBC support of 1-3 spatial streams */
3413
3414
3415 #define HT_CAP_TXBF_CAP_IMPLICIT_TXBF_RX        0x1
3416 #define HT_CAP_TXBF_CAP_NDP_RX                  0x8
3417 #define HT_CAP_TXBF_CAP_NDP_TX                  0x10
3418 #define HT_CAP_TXBF_CAP_EXPLICIT_CSI            0x100
3419 #define HT_CAP_TXBF_CAP_EXPLICIT_NC_STEERING    0x200
3420 #define HT_CAP_TXBF_CAP_EXPLICIT_C_STEERING     0x400
3421 #define HT_CAP_TXBF_CAP_EXPLICIT_CSI_FB_MASK    0x1800
3422 #define HT_CAP_TXBF_CAP_EXPLICIT_CSI_FB_SHIFT   11
3423 #define HT_CAP_TXBF_CAP_EXPLICIT_NC_FB_MASK     0x6000
3424 #define HT_CAP_TXBF_CAP_EXPLICIT_NC_FB_SHIFT    13
3425 #define HT_CAP_TXBF_CAP_EXPLICIT_C_FB_MASK      0x18000
3426 #define HT_CAP_TXBF_CAP_EXPLICIT_C_FB_SHIFT     15
3427 #define HT_CAP_TXBF_CAP_CSI_BFR_ANT_SHIFT       19
3428 #define HT_CAP_TXBF_CAP_NC_BFR_ANT_SHIFT        21
3429 #define HT_CAP_TXBF_CAP_C_BFR_ANT_SHIFT         23
3430 #define HT_CAP_TXBF_CAP_C_BFR_ANT_MASK          0x1800000
3431
3432 #define HT_CAP_TXBF_CAP_CHAN_ESTIM_SHIFT        27
3433 #define HT_CAP_TXBF_CAP_CHAN_ESTIM_MASK         0x18000000
3434
3435 #define HT_CAP_TXBF_FB_TYPE_NONE        0
3436 #define HT_CAP_TXBF_FB_TYPE_DELAYED     1
3437 #define HT_CAP_TXBF_FB_TYPE_IMMEDIATE   2
3438 #define HT_CAP_TXBF_FB_TYPE_BOTH        3
3439
3440 #define HT_CAP_TX_BF_CAP_EXPLICIT_CSI_FB_MASK   0x400
3441 #define HT_CAP_TX_BF_CAP_EXPLICIT_CSI_FB_SHIFT  10
3442 #define HT_CAP_TX_BF_CAP_EXPLICIT_COMPRESSED_FB_MASK 0x18000
3443 #define HT_CAP_TX_BF_CAP_EXPLICIT_COMPRESSED_FB_SHIFT 15
3444
3445 #define VHT_MAX_MPDU            11454   /* max mpdu size for now (bytes) */
3446 #define VHT_MPDU_MSDU_DELTA     56              /* Difference in spec - vht mpdu, amsdu len */
3447 /* Max AMSDU len - per spec */
3448 #define VHT_MAX_AMSDU           (VHT_MAX_MPDU - VHT_MPDU_MSDU_DELTA)
3449
3450 #define HT_MAX_AMSDU            7935    /* max amsdu size (bytes) per the HT spec */
3451 #define HT_MIN_AMSDU            3835    /* min amsdu size (bytes) per the HT spec */
3452
3453 #define HT_PARAMS_RX_FACTOR_MASK        0x03    /* ampdu rcv factor mask */
3454 #define HT_PARAMS_DENSITY_MASK          0x1C    /* ampdu density mask */
3455 #define HT_PARAMS_DENSITY_SHIFT 2       /* ampdu density shift */
3456
3457 /* HT/AMPDU specific define */
3458 #define AMPDU_MAX_MPDU_DENSITY  7       /* max mpdu density; in 1/4 usec units */
3459 #define AMPDU_DENSITY_NONE      0       /* No density requirement */
3460 #define AMPDU_DENSITY_1over4_US 1       /* 1/4 us density */
3461 #define AMPDU_DENSITY_1over2_US 2       /* 1/2 us density */
3462 #define AMPDU_DENSITY_1_US      3       /*   1 us density */
3463 #define AMPDU_DENSITY_2_US      4       /*   2 us density */
3464 #define AMPDU_DENSITY_4_US      5       /*   4 us density */
3465 #define AMPDU_DENSITY_8_US      6       /*   8 us density */
3466 #define AMPDU_DENSITY_16_US     7       /*  16 us density */
3467 #define AMPDU_RX_FACTOR_8K      0       /* max rcv ampdu len (8kb) */
3468 #define AMPDU_RX_FACTOR_16K     1       /* max rcv ampdu len (16kb) */
3469 #define AMPDU_RX_FACTOR_32K     2       /* max rcv ampdu len (32kb) */
3470 #define AMPDU_RX_FACTOR_64K     3       /* max rcv ampdu len (64kb) */
3471
3472 /* AMPDU RX factors for VHT rates */
3473 #define AMPDU_RX_FACTOR_128K    4       /* max rcv ampdu len (128kb) */
3474 #define AMPDU_RX_FACTOR_256K    5       /* max rcv ampdu len (256kb) */
3475 #define AMPDU_RX_FACTOR_512K    6       /* max rcv ampdu len (512kb) */
3476 #define AMPDU_RX_FACTOR_1024K   7       /* max rcv ampdu len (1024kb) */
3477
3478 #define AMPDU_RX_FACTOR_BASE    8*1024  /* ampdu factor base for rx len */
3479 #define AMPDU_RX_FACTOR_BASE_PWR        13      /* ampdu factor base for rx len in power of 2 */
3480
3481 #define AMPDU_DELIMITER_LEN     4       /* length of ampdu delimiter */
3482 #define AMPDU_DELIMITER_LEN_MAX 63      /* max length of ampdu delimiter(enforced in HW) */
3483
3484 #define HT_CAP_EXT_PCO                  0x0001
3485 #define HT_CAP_EXT_PCO_TTIME_MASK       0x0006
3486 #define HT_CAP_EXT_PCO_TTIME_SHIFT      1
3487 #define HT_CAP_EXT_MCS_FEEDBACK_MASK    0x0300
3488 #define HT_CAP_EXT_MCS_FEEDBACK_SHIFT   8
3489 #define HT_CAP_EXT_HTC                  0x0400
3490 #define HT_CAP_EXT_RD_RESP              0x0800
3491
3492 /** 'ht_add' is called 'HT Operation' information element in the 802.11 standard */
3493 BWL_PRE_PACKED_STRUCT struct ht_add_ie {
3494         uint8   ctl_ch;                 /* control channel number */
3495         uint8   byte1;                  /* ext ch,rec. ch. width, RIFS support */
3496         uint16  opmode;                 /* operation mode */
3497         uint16  misc_bits;              /* misc bits */
3498         uint8   basic_mcs[MCSSET_LEN];  /* required MCS set */
3499 } BWL_POST_PACKED_STRUCT;
3500 typedef struct ht_add_ie ht_add_ie_t;
3501
3502 /* ADD IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
3503 /* the additional IE is primarily used to convey the current BSS configuration */
3504 BWL_PRE_PACKED_STRUCT struct ht_prop_add_ie {
3505         uint8   id;             /* IE ID, 221, DOT11_MNG_PROPR_ID */
3506         uint8   len;            /* IE length */
3507         uint8   oui[3];
3508         uint8   type;           /* indicates what follows */
3509         ht_add_ie_t add_ie;
3510 } BWL_POST_PACKED_STRUCT;
3511 typedef struct ht_prop_add_ie ht_prop_add_ie_t;
3512
3513 #define HT_ADD_IE_LEN   22
3514 #define HT_ADD_IE_TYPE  52
3515
3516 /* byte1 defn's */
3517 #define HT_BW_ANY               0x04    /* set, STA can use 20 or 40MHz */
3518 #define HT_RIFS_PERMITTED       0x08    /* RIFS allowed */
3519
3520 /* opmode defn's */
3521 #define HT_OPMODE_MASK          0x0003  /* protection mode mask */
3522 #define HT_OPMODE_SHIFT         0       /* protection mode shift */
3523 #define HT_OPMODE_PURE          0x0000  /* protection mode PURE */
3524 #define HT_OPMODE_OPTIONAL      0x0001  /* protection mode optional */
3525 #define HT_OPMODE_HT20IN40      0x0002  /* protection mode 20MHz HT in 40MHz BSS */
3526 #define HT_OPMODE_MIXED 0x0003  /* protection mode Mixed Mode */
3527 #define HT_OPMODE_NONGF 0x0004  /* protection mode non-GF */
3528 #define DOT11N_TXBURST          0x0008  /* Tx burst limit */
3529 #define DOT11N_OBSS_NONHT       0x0010  /* OBSS Non-HT STA present */
3530
3531 /* misc_bites defn's */
3532 #define HT_BASIC_STBC_MCS       0x007f  /* basic STBC MCS */
3533 #define HT_DUAL_STBC_PROT       0x0080  /* Dual STBC Protection */
3534 #define HT_SECOND_BCN           0x0100  /* Secondary beacon support */
3535 #define HT_LSIG_TXOP            0x0200  /* L-SIG TXOP Protection full support */
3536 #define HT_PCO_ACTIVE           0x0400  /* PCO active */
3537 #define HT_PCO_PHASE            0x0800  /* PCO phase */
3538 #define HT_DUALCTS_PROTECTION   0x0080  /* DUAL CTS protection needed */
3539
3540 /* Tx Burst Limits */
3541 #define DOT11N_2G_TXBURST_LIMIT 6160    /* 2G band Tx burst limit per 802.11n Draft 1.10 (usec) */
3542 #define DOT11N_5G_TXBURST_LIMIT 3080    /* 5G band Tx burst limit per 802.11n Draft 1.10 (usec) */
3543
3544 /* Macros for opmode */
3545 #define GET_HT_OPMODE(add_ie)           ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
3546                                         >> HT_OPMODE_SHIFT)
3547 #define HT_MIXEDMODE_PRESENT(add_ie)    ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
3548                                         == HT_OPMODE_MIXED)     /* mixed mode present */
3549 #define HT_HT20_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
3550                                         == HT_OPMODE_HT20IN40)  /* 20MHz HT present */
3551 #define HT_OPTIONAL_PRESENT(add_ie)     ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
3552                                         == HT_OPMODE_OPTIONAL)  /* Optional protection present */
3553 #define HT_USE_PROTECTION(add_ie)       (HT_HT20_PRESENT((add_ie)) || \
3554                                         HT_MIXEDMODE_PRESENT((add_ie))) /* use protection */
3555 #define HT_NONGF_PRESENT(add_ie)        ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_NONGF) \
3556                                         == HT_OPMODE_NONGF)     /* non-GF present */
3557 #define DOT11N_TXBURST_PRESENT(add_ie)  ((ltoh16_ua(&add_ie->opmode) & DOT11N_TXBURST) \
3558                                         == DOT11N_TXBURST)      /* Tx Burst present */
3559 #define DOT11N_OBSS_NONHT_PRESENT(add_ie)       ((ltoh16_ua(&add_ie->opmode) & DOT11N_OBSS_NONHT) \
3560                                         == DOT11N_OBSS_NONHT)   /* OBSS Non-HT present */
3561
3562 BWL_PRE_PACKED_STRUCT struct obss_params {
3563         uint16  passive_dwell;
3564         uint16  active_dwell;
3565         uint16  bss_widthscan_interval;
3566         uint16  passive_total;
3567         uint16  active_total;
3568         uint16  chanwidth_transition_dly;
3569         uint16  activity_threshold;
3570 } BWL_POST_PACKED_STRUCT;
3571 typedef struct obss_params obss_params_t;
3572
3573 BWL_PRE_PACKED_STRUCT struct dot11_obss_ie {
3574         uint8   id;
3575         uint8   len;
3576         obss_params_t obss_params;
3577 } BWL_POST_PACKED_STRUCT;
3578 typedef struct dot11_obss_ie dot11_obss_ie_t;
3579 #define DOT11_OBSS_SCAN_IE_LEN  sizeof(obss_params_t)   /* HT OBSS len (based on 802.11n d3.0) */
3580
3581 /* HT control field */
3582 #define HT_CTRL_LA_TRQ          0x00000002      /* sounding request */
3583 #define HT_CTRL_LA_MAI          0x0000003C      /* MCS request or antenna selection indication */
3584 #define HT_CTRL_LA_MAI_SHIFT    2
3585 #define HT_CTRL_LA_MAI_MRQ      0x00000004      /* MCS request */
3586 #define HT_CTRL_LA_MAI_MSI      0x00000038      /* MCS request sequence identifier */
3587 #define HT_CTRL_LA_MFSI         0x000001C0      /* MFB sequence identifier */
3588 #define HT_CTRL_LA_MFSI_SHIFT   6
3589 #define HT_CTRL_LA_MFB_ASELC    0x0000FE00      /* MCS feedback, antenna selection command/data */
3590 #define HT_CTRL_LA_MFB_ASELC_SH 9
3591 #define HT_CTRL_LA_ASELC_CMD    0x00000C00      /* ASEL command */
3592 #define HT_CTRL_LA_ASELC_DATA   0x0000F000      /* ASEL data */
3593 #define HT_CTRL_CAL_POS         0x00030000      /* Calibration position */
3594 #define HT_CTRL_CAL_SEQ         0x000C0000      /* Calibration sequence */
3595 #define HT_CTRL_CSI_STEERING    0x00C00000      /* CSI/Steering */
3596 #define HT_CTRL_CSI_STEER_SHIFT 22
3597 #define HT_CTRL_CSI_STEER_NFB   0               /* no fedback required */
3598 #define HT_CTRL_CSI_STEER_CSI   1               /* CSI, H matrix */
3599 #define HT_CTRL_CSI_STEER_NCOM  2               /* non-compressed beamforming */
3600 #define HT_CTRL_CSI_STEER_COM   3               /* compressed beamforming */
3601 #define HT_CTRL_NDP_ANNOUNCE    0x01000000      /* NDP announcement */
3602 #define HT_CTRL_AC_CONSTRAINT   0x40000000      /* AC Constraint */
3603 #define HT_CTRL_RDG_MOREPPDU    0x80000000      /* RDG/More PPDU */
3604
3605 /* ************* VHT definitions. ************* */
3606
3607 /**
3608  * VHT Capabilites IE (sec 8.4.2.160)
3609  */
3610
3611 BWL_PRE_PACKED_STRUCT struct vht_cap_ie {
3612         uint32  vht_cap_info;
3613         /* supported MCS set - 64 bit field */
3614         uint16  rx_mcs_map;
3615         uint16  rx_max_rate;
3616         uint16  tx_mcs_map;
3617         uint16  tx_max_rate;
3618 } BWL_POST_PACKED_STRUCT;
3619 typedef struct vht_cap_ie vht_cap_ie_t;
3620
3621 /* 4B cap_info + 8B supp_mcs */
3622 #define VHT_CAP_IE_LEN 12
3623
3624 /* VHT Capabilities Info field - 32bit - in VHT Cap IE */
3625 #define VHT_CAP_INFO_MAX_MPDU_LEN_MASK          0x00000003
3626 #define VHT_CAP_INFO_SUPP_CHAN_WIDTH_MASK       0x0000000c
3627 #define VHT_CAP_INFO_LDPC                       0x00000010
3628 #define VHT_CAP_INFO_SGI_80MHZ                  0x00000020
3629 #define VHT_CAP_INFO_SGI_160MHZ                 0x00000040
3630 #define VHT_CAP_INFO_TX_STBC                    0x00000080
3631 #define VHT_CAP_INFO_RX_STBC_MASK               0x00000700
3632 #define VHT_CAP_INFO_RX_STBC_SHIFT              8
3633 #define VHT_CAP_INFO_SU_BEAMFMR                 0x00000800
3634 #define VHT_CAP_INFO_SU_BEAMFMEE                0x00001000
3635 #define VHT_CAP_INFO_NUM_BMFMR_ANT_MASK         0x0000e000
3636 #define VHT_CAP_INFO_NUM_BMFMR_ANT_SHIFT        13
3637 #define VHT_CAP_INFO_NUM_SOUNDING_DIM_MASK      0x00070000
3638 #define VHT_CAP_INFO_NUM_SOUNDING_DIM_SHIFT     16
3639 #define VHT_CAP_INFO_MU_BEAMFMR                 0x00080000
3640 #define VHT_CAP_INFO_MU_BEAMFMEE                0x00100000
3641 #define VHT_CAP_INFO_TXOPPS                     0x00200000
3642 #define VHT_CAP_INFO_HTCVHT                     0x00400000
3643 #define VHT_CAP_INFO_AMPDU_MAXLEN_EXP_MASK      0x03800000
3644 #define VHT_CAP_INFO_AMPDU_MAXLEN_EXP_SHIFT     23
3645 #define VHT_CAP_INFO_LINK_ADAPT_CAP_MASK        0x0c000000
3646 #define VHT_CAP_INFO_LINK_ADAPT_CAP_SHIFT       26
3647
3648 /* VHT Supported MCS Set - 64-bit - in VHT Cap IE */
3649 #define VHT_CAP_SUPP_MCS_RX_HIGHEST_RATE_MASK   0x1fff
3650 #define VHT_CAP_SUPP_MCS_RX_HIGHEST_RATE_SHIFT  0
3651
3652 #define VHT_CAP_SUPP_MCS_TX_HIGHEST_RATE_MASK   0x1fff
3653 #define VHT_CAP_SUPP_MCS_TX_HIGHEST_RATE_SHIFT  0
3654
3655 #define VHT_CAP_MCS_MAP_0_7                     0
3656 #define VHT_CAP_MCS_MAP_0_8                     1
3657 #define VHT_CAP_MCS_MAP_0_9                     2
3658 #define VHT_CAP_MCS_MAP_NONE                    3
3659 #define VHT_CAP_MCS_MAP_S                       2 /* num bits for 1-stream */
3660 #define VHT_CAP_MCS_MAP_M                       0x3 /* mask for 1-stream */
3661 /* assumes VHT_CAP_MCS_MAP_NONE is 3 and 2 bits are used for encoding */
3662 #define VHT_CAP_MCS_MAP_NONE_ALL                0xffff
3663
3664 /* VHT rates bitmap */
3665 #define VHT_CAP_MCS_0_7_RATEMAP         0x00ff
3666 #define VHT_CAP_MCS_0_8_RATEMAP         0x01ff
3667 #define VHT_CAP_MCS_0_9_RATEMAP         0x03ff
3668 #define VHT_CAP_MCS_FULL_RATEMAP        VHT_CAP_MCS_0_9_RATEMAP
3669
3670 #define VHT_PROP_MCS_MAP_10_11                   0
3671 #define VHT_PROP_MCS_MAP_UNUSED1                 1
3672 #define VHT_PROP_MCS_MAP_UNUSED2                 2
3673 #define VHT_PROP_MCS_MAP_NONE                    3
3674 #define VHT_PROP_MCS_MAP_NONE_ALL                0xffff
3675
3676 /* VHT prop rates bitmap */
3677 #define VHT_PROP_MCS_10_11_RATEMAP      0x0c00
3678 #define VHT_PROP_MCS_FULL_RATEMAP       VHT_PROP_MCS_10_11_RATEMAP
3679
3680 #if !defined(VHT_CAP_MCS_MAP_0_9_NSS3)
3681 /* mcsmap with MCS0-9 for Nss = 3 */
3682 #define VHT_CAP_MCS_MAP_0_9_NSS3 \
3683                 ((VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(1)) | \
3684                  (VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(2)) | \
3685                  (VHT_CAP_MCS_MAP_0_9 << VHT_MCS_MAP_GET_SS_IDX(3)))
3686 #endif /* !VHT_CAP_MCS_MAP_0_9_NSS3 */
3687
3688 #define VHT_CAP_MCS_MAP_NSS_MAX                 8
3689
3690 /* get mcsmap with given mcs for given nss streams */
3691 #define VHT_CAP_MCS_MAP_CREATE(mcsmap, nss, mcs) \
3692         do { \
3693                 int i; \
3694                 for (i = 1; i <= nss; i++) { \
3695                         VHT_MCS_MAP_SET_MCS_PER_SS(i, mcs, mcsmap); \
3696                 } \
3697         } while (0)
3698
3699 /* Map the mcs code to mcs bit map */
3700 #define VHT_MCS_CODE_TO_MCS_MAP(mcs_code) \
3701         ((mcs_code == VHT_CAP_MCS_MAP_0_7) ? VHT_CAP_MCS_0_7_RATEMAP : \
3702          (mcs_code == VHT_CAP_MCS_MAP_0_8) ? VHT_CAP_MCS_0_8_RATEMAP : \
3703          (mcs_code == VHT_CAP_MCS_MAP_0_9) ? VHT_CAP_MCS_0_9_RATEMAP : 0)
3704
3705 #define VHT_PROP_MCS_CODE_TO_PROP_MCS_MAP(mcs_code) \
3706         ((mcs_code == VHT_PROP_MCS_MAP_10_11) ? VHT_PROP_MCS_10_11_RATEMAP : 0)
3707
3708 /* Map the mcs bit map to mcs code */
3709 #define VHT_MCS_MAP_TO_MCS_CODE(mcs_map) \
3710         ((mcs_map == VHT_CAP_MCS_0_7_RATEMAP) ? VHT_CAP_MCS_MAP_0_7 : \
3711          (mcs_map == VHT_CAP_MCS_0_8_RATEMAP) ? VHT_CAP_MCS_MAP_0_8 : \
3712          (mcs_map == VHT_CAP_MCS_0_9_RATEMAP) ? VHT_CAP_MCS_MAP_0_9 : VHT_CAP_MCS_MAP_NONE)
3713
3714 #define VHT_PROP_MCS_MAP_TO_PROP_MCS_CODE(mcs_map) \
3715         (((mcs_map & 0xc00) == 0xc00)  ? VHT_PROP_MCS_MAP_10_11 : VHT_PROP_MCS_MAP_NONE)
3716
3717 /** VHT Capabilities Supported Channel Width */
3718 typedef enum vht_cap_chan_width {
3719         VHT_CAP_CHAN_WIDTH_SUPPORT_MANDATORY = 0x00,
3720         VHT_CAP_CHAN_WIDTH_SUPPORT_160       = 0x04,
3721         VHT_CAP_CHAN_WIDTH_SUPPORT_160_8080  = 0x08
3722 } vht_cap_chan_width_t;
3723
3724 /** VHT Capabilities Supported max MPDU LEN (sec 8.4.2.160.2) */
3725 typedef enum vht_cap_max_mpdu_len {
3726         VHT_CAP_MPDU_MAX_4K     = 0x00,
3727         VHT_CAP_MPDU_MAX_8K     = 0x01,
3728         VHT_CAP_MPDU_MAX_11K    = 0x02
3729 } vht_cap_max_mpdu_len_t;
3730
3731 /* Maximum MPDU Length byte counts for the VHT Capabilities advertised limits */
3732 #define VHT_MPDU_LIMIT_4K        3895
3733 #define VHT_MPDU_LIMIT_8K        7991
3734 #define VHT_MPDU_LIMIT_11K      11454
3735
3736
3737 /**
3738  * VHT Operation IE (sec 8.4.2.161)
3739  */
3740
3741 BWL_PRE_PACKED_STRUCT struct vht_op_ie {
3742         uint8   chan_width;
3743         uint8   chan1;
3744         uint8   chan2;
3745         uint16  supp_mcs;  /*  same def as above in vht cap */
3746 } BWL_POST_PACKED_STRUCT;
3747 typedef struct vht_op_ie vht_op_ie_t;
3748
3749 /* 3B VHT Op info + 2B Basic MCS */
3750 #define VHT_OP_IE_LEN 5
3751
3752 typedef enum vht_op_chan_width {
3753         VHT_OP_CHAN_WIDTH_20_40 = 0,
3754         VHT_OP_CHAN_WIDTH_80    = 1,
3755         VHT_OP_CHAN_WIDTH_160   = 2,
3756         VHT_OP_CHAN_WIDTH_80_80 = 3
3757 } vht_op_chan_width_t;
3758
3759 /* AID length */
3760 #define AID_IE_LEN              2
3761 /**
3762  * BRCM vht features IE header
3763  * The header if the fixed part of the IE
3764  * On the 5GHz band this is the entire IE,
3765  * on 2.4GHz the VHT IEs as defined in the 802.11ac
3766  * specification follows
3767  *
3768  *
3769  * VHT features rates  bitmap.
3770  * Bit0:                5G MCS 0-9 BW 160MHz
3771  * Bit1:                5G MCS 0-9 support BW 80MHz
3772  * Bit2:                5G MCS 0-9 support BW 20MHz
3773  * Bit3:                2.4G MCS 0-9 support BW 20MHz
3774  * Bits:4-7     Reserved for future use
3775  *
3776  */
3777 #define VHT_FEATURES_IE_TYPE    0x4
3778 BWL_PRE_PACKED_STRUCT struct vht_features_ie_hdr {
3779         uint8 oui[3];
3780         uint8 type;             /* type of this IE = 4 */
3781         uint8 rate_mask;        /* VHT rate mask */
3782 } BWL_POST_PACKED_STRUCT;
3783 typedef struct vht_features_ie_hdr vht_features_ie_hdr_t;
3784
3785 /* Def for rx & tx basic mcs maps - ea ss num has 2 bits of info */
3786 #define VHT_MCS_MAP_GET_SS_IDX(nss) (((nss)-1) * VHT_CAP_MCS_MAP_S)
3787 #define VHT_MCS_MAP_GET_MCS_PER_SS(nss, mcsMap) \
3788         (((mcsMap) >> VHT_MCS_MAP_GET_SS_IDX(nss)) & VHT_CAP_MCS_MAP_M)
3789 #define VHT_MCS_MAP_SET_MCS_PER_SS(nss, numMcs, mcsMap) \
3790         do { \
3791          (mcsMap) &= (~(VHT_CAP_MCS_MAP_M << VHT_MCS_MAP_GET_SS_IDX(nss))); \
3792          (mcsMap) |= (((numMcs) & VHT_CAP_MCS_MAP_M) << VHT_MCS_MAP_GET_SS_IDX(nss)); \
3793         } while (0)
3794 #define VHT_MCS_SS_SUPPORTED(nss, mcsMap) \
3795                  (VHT_MCS_MAP_GET_MCS_PER_SS((nss), (mcsMap)) != VHT_CAP_MCS_MAP_NONE)
3796
3797
3798 /* ************* WPA definitions. ************* */
3799 #define WPA_OUI                 "\x00\x50\xF2"  /* WPA OUI */
3800 #define WPA_OUI_LEN             3               /* WPA OUI length */
3801 #define WPA_OUI_TYPE            1
3802 #define WPA_VERSION             1               /* WPA version */
3803 #define WPA2_OUI                "\x00\x0F\xAC"  /* WPA2 OUI */
3804 #define WPA2_OUI_LEN            3               /* WPA2 OUI length */
3805 #define WPA2_VERSION            1               /* WPA2 version */
3806 #define WPA2_VERSION_LEN        2               /* WAP2 version length */
3807
3808 /* ************* WPS definitions. ************* */
3809 #define WPS_OUI                 "\x00\x50\xF2"  /* WPS OUI */
3810 #define WPS_OUI_LEN             3               /* WPS OUI length */
3811 #define WPS_OUI_TYPE            4
3812
3813 /* ************* WFA definitions. ************* */
3814
3815 #ifdef P2P_IE_OVRD
3816 #define WFA_OUI                 MAC_OUI
3817 #else
3818 #define WFA_OUI                 "\x50\x6F\x9A"  /* WFA OUI */
3819 #endif /* P2P_IE_OVRD */
3820 #define WFA_OUI_LEN             3               /* WFA OUI length */
3821 #ifdef P2P_IE_OVRD
3822 #define WFA_OUI_TYPE_P2P        MAC_OUI_TYPE_P2P
3823 #else
3824 #define WFA_OUI_TYPE_TPC        8
3825 #define WFA_OUI_TYPE_P2P        9
3826 #endif
3827
3828 #define WFA_OUI_TYPE_TPC        8
3829 #ifdef WLTDLS
3830 #define WFA_OUI_TYPE_TPQ        4       /* WFD Tunneled Probe ReQuest */
3831 #define WFA_OUI_TYPE_TPS        5       /* WFD Tunneled Probe ReSponse */
3832 #define WFA_OUI_TYPE_WFD        10
3833 #endif /* WTDLS */
3834 #define WFA_OUI_TYPE_HS20       0x10
3835 #define WFA_OUI_TYPE_OSEN       0x12
3836 #define WFA_OUI_TYPE_NAN        0x13
3837
3838 /* RSN authenticated key managment suite */
3839 #define RSN_AKM_NONE            0       /* None (IBSS) */
3840 #define RSN_AKM_UNSPECIFIED     1       /* Over 802.1x */
3841 #define RSN_AKM_PSK             2       /* Pre-shared Key */
3842 #define RSN_AKM_FBT_1X          3       /* Fast Bss transition using 802.1X */
3843 #define RSN_AKM_FBT_PSK         4       /* Fast Bss transition using Pre-shared Key */
3844 /* RSN_AKM_MFP_1X and RSN_AKM_MFP_PSK are not used any more
3845  * Just kept here to avoid build issue in BISON/CARIBOU branch
3846  */
3847 #define RSN_AKM_MFP_1X          5       /* SHA256 key derivation, using 802.1X */
3848 #define RSN_AKM_MFP_PSK         6       /* SHA256 key derivation, using Pre-shared Key */
3849 #define RSN_AKM_SHA256_1X       5       /* SHA256 key derivation, using 802.1X */
3850 #define RSN_AKM_SHA256_PSK      6       /* SHA256 key derivation, using Pre-shared Key */
3851 #define RSN_AKM_TPK             7       /* TPK(TDLS Peer Key) handshake */
3852
3853 /* OSEN authenticated key managment suite */
3854 #define OSEN_AKM_UNSPECIFIED    RSN_AKM_UNSPECIFIED     /* Over 802.1x */
3855
3856 /* Key related defines */
3857 #define DOT11_MAX_DEFAULT_KEYS  4       /* number of default keys */
3858 #define DOT11_MAX_IGTK_KEYS             2
3859 #define DOT11_MAX_KEY_SIZE      32      /* max size of any key */
3860 #define DOT11_MAX_IV_SIZE       16      /* max size of any IV */
3861 #define DOT11_EXT_IV_FLAG       (1<<5)  /* flag to indicate IV is > 4 bytes */
3862 #define DOT11_WPA_KEY_RSC_LEN   8       /* WPA RSC key len */
3863
3864 #define WEP1_KEY_SIZE           5       /* max size of any WEP key */
3865 #define WEP1_KEY_HEX_SIZE       10      /* size of WEP key in hex. */
3866 #define WEP128_KEY_SIZE         13      /* max size of any WEP key */
3867 #define WEP128_KEY_HEX_SIZE     26      /* size of WEP key in hex. */
3868 #define TKIP_MIC_SIZE           8       /* size of TKIP MIC */
3869 #define TKIP_EOM_SIZE           7       /* max size of TKIP EOM */
3870 #define TKIP_EOM_FLAG           0x5a    /* TKIP EOM flag byte */
3871 #define TKIP_KEY_SIZE           32      /* size of any TKIP key, includs MIC keys */
3872 #define TKIP_TK_SIZE            16
3873 #define TKIP_MIC_KEY_SIZE       8
3874 #define TKIP_MIC_AUTH_TX        16      /* offset to Authenticator MIC TX key */
3875 #define TKIP_MIC_AUTH_RX        24      /* offset to Authenticator MIC RX key */
3876 #define TKIP_MIC_SUP_RX         TKIP_MIC_AUTH_TX        /* offset to Supplicant MIC RX key */
3877 #define TKIP_MIC_SUP_TX         TKIP_MIC_AUTH_RX        /* offset to Supplicant MIC TX key */
3878 #define AES_KEY_SIZE            16      /* size of AES key */
3879 #define AES_MIC_SIZE            8       /* size of AES MIC */
3880 #define BIP_KEY_SIZE            16      /* size of BIP key */
3881 #define BIP_MIC_SIZE            8   /* sizeof BIP MIC */
3882
3883 #define AES_GCM_MIC_SIZE        16      /* size of MIC for 128-bit GCM - .11adD9 */
3884
3885 #define AES256_KEY_SIZE         32      /* size of AES 256 key - .11acD5 */
3886 #define AES256_MIC_SIZE         16      /* size of MIC for 256 bit keys, incl BIP */
3887
3888 /* WCN */
3889 #define WCN_OUI                 "\x00\x50\xf2"  /* WCN OUI */
3890 #define WCN_TYPE                4       /* WCN type */
3891
3892
3893 /* 802.11r protocol definitions */
3894
3895 /** Mobility Domain IE */
3896 BWL_PRE_PACKED_STRUCT struct dot11_mdid_ie {
3897         uint8 id;
3898         uint8 len;
3899         uint16 mdid;            /* Mobility Domain Id */
3900         uint8 cap;
3901 } BWL_POST_PACKED_STRUCT;
3902 typedef struct dot11_mdid_ie dot11_mdid_ie_t;
3903
3904 #define FBT_MDID_CAP_OVERDS     0x01    /* Fast Bss transition over the DS support */
3905 #define FBT_MDID_CAP_RRP        0x02    /* Resource request protocol support */
3906
3907 /** Fast Bss Transition IE */
3908 BWL_PRE_PACKED_STRUCT struct dot11_ft_ie {
3909         uint8 id;
3910         uint8 len;
3911         uint16 mic_control;             /* Mic Control */
3912         uint8 mic[16];
3913         uint8 anonce[32];
3914         uint8 snonce[32];
3915 } BWL_POST_PACKED_STRUCT;
3916 typedef struct dot11_ft_ie dot11_ft_ie_t;
3917
3918 #define TIE_TYPE_RESERVED               0
3919 #define TIE_TYPE_REASSOC_DEADLINE       1
3920 #define TIE_TYPE_KEY_LIEFTIME           2
3921 #define TIE_TYPE_ASSOC_COMEBACK         3
3922 BWL_PRE_PACKED_STRUCT struct dot11_timeout_ie {
3923         uint8 id;
3924         uint8 len;
3925         uint8 type;             /* timeout interval type */
3926         uint32 value;           /* timeout interval value */
3927 } BWL_POST_PACKED_STRUCT;
3928 typedef struct dot11_timeout_ie dot11_timeout_ie_t;
3929
3930 /** GTK ie */
3931 BWL_PRE_PACKED_STRUCT struct dot11_gtk_ie {
3932         uint8 id;
3933         uint8 len;
3934         uint16 key_info;
3935         uint8 key_len;
3936         uint8 rsc[8];
3937         uint8 data[1];
3938 } BWL_POST_PACKED_STRUCT;
3939 typedef struct dot11_gtk_ie dot11_gtk_ie_t;
3940
3941 /** Management MIC ie */
3942 BWL_PRE_PACKED_STRUCT struct mmic_ie {
3943         uint8   id;                                     /* IE ID: DOT11_MNG_MMIE_ID */
3944         uint8   len;                            /* IE length */
3945         uint16  key_id;                         /* key id */
3946         uint8   ipn[6];                         /* ipn */
3947         uint8   mic[16];                        /* mic */
3948 } BWL_POST_PACKED_STRUCT;
3949 typedef struct mmic_ie mmic_ie_t;
3950
3951 /* 802.11r-2008, 11A.10.3 - RRB frame format */
3952 BWL_PRE_PACKED_STRUCT struct dot11_ft_rrb_frame {
3953         uint8  frame_type; /* 1 for RRB */
3954         uint8  packet_type; /* 0 for Request 1 for Response */
3955         uint16 len;
3956         uint8  cur_ap_addr[ETHER_ADDR_LEN];
3957         uint8  data[1]; /* IEs Received/Sent in FT Action Req/Resp Frame */
3958 } BWL_POST_PACKED_STRUCT;
3959
3960 typedef struct dot11_ft_rrb_frame dot11_ft_rrb_frame_t;
3961
3962 #define DOT11_FT_RRB_FIXED_LEN 10
3963 #define DOT11_FT_REMOTE_FRAME_TYPE 1
3964 #define DOT11_FT_PACKET_REQ 0
3965 #define DOT11_FT_PACKET_RESP 1
3966
3967 #define BSSID_INVALID           "\x00\x00\x00\x00\x00\x00"
3968 #define BSSID_BROADCAST         "\xFF\xFF\xFF\xFF\xFF\xFF"
3969
3970
3971 /* ************* WMM Parameter definitions. ************* */
3972 #define WMM_OUI                 "\x00\x50\xF2"  /* WNN OUI */
3973 #define WMM_OUI_LEN             3               /* WMM OUI length */
3974 #define WMM_OUI_TYPE    2               /* WMM OUT type */
3975 #define WMM_VERSION             1
3976 #define WMM_VERSION_LEN 1
3977
3978 /* WMM OUI subtype */
3979 #define WMM_OUI_SUBTYPE_PARAMETER       1
3980 #define WMM_PARAMETER_IE_LEN            24
3981
3982 /** Link Identifier Element */
3983 BWL_PRE_PACKED_STRUCT struct link_id_ie {
3984         uint8 id;
3985         uint8 len;
3986         struct ether_addr       bssid;
3987         struct ether_addr       tdls_init_mac;
3988         struct ether_addr       tdls_resp_mac;
3989 } BWL_POST_PACKED_STRUCT;
3990 typedef struct link_id_ie link_id_ie_t;
3991 #define TDLS_LINK_ID_IE_LEN             18
3992
3993 /** Link Wakeup Schedule Element */
3994 BWL_PRE_PACKED_STRUCT struct wakeup_sch_ie {
3995         uint8 id;
3996         uint8 len;
3997         uint32 offset;                  /* in ms between TSF0 and start of 1st Awake Window */
3998         uint32 interval;                /* in ms bwtween the start of 2 Awake Windows */
3999         uint32 awake_win_slots; /* in backof slots, duration of Awake Window */
4000         uint32 max_wake_win;    /* in ms, max duration of Awake Window */
4001         uint16 idle_cnt;                /* number of consecutive Awake Windows */
4002 } BWL_POST_PACKED_STRUCT;
4003 typedef struct wakeup_sch_ie wakeup_sch_ie_t;
4004 #define TDLS_WAKEUP_SCH_IE_LEN          18
4005
4006 /** Channel Switch Timing Element */
4007 BWL_PRE_PACKED_STRUCT struct channel_switch_timing_ie {
4008         uint8 id;
4009         uint8 len;
4010         uint16 switch_time;             /* in ms, time to switch channels */
4011         uint16 switch_timeout;  /* in ms */
4012 } BWL_POST_PACKED_STRUCT;
4013 typedef struct channel_switch_timing_ie channel_switch_timing_ie_t;
4014 #define TDLS_CHANNEL_SWITCH_TIMING_IE_LEN               4
4015
4016 /** PTI Control Element */
4017 BWL_PRE_PACKED_STRUCT struct pti_control_ie {
4018         uint8 id;
4019         uint8 len;
4020         uint8 tid;
4021         uint16 seq_control;
4022 } BWL_POST_PACKED_STRUCT;
4023 typedef struct pti_control_ie pti_control_ie_t;
4024 #define TDLS_PTI_CONTROL_IE_LEN         3
4025
4026 /** PU Buffer Status Element */
4027 BWL_PRE_PACKED_STRUCT struct pu_buffer_status_ie {
4028         uint8 id;
4029         uint8 len;
4030         uint8 status;
4031 } BWL_POST_PACKED_STRUCT;
4032 typedef struct pu_buffer_status_ie pu_buffer_status_ie_t;
4033 #define TDLS_PU_BUFFER_STATUS_IE_LEN    1
4034 #define TDLS_PU_BUFFER_STATUS_AC_BK             1
4035 #define TDLS_PU_BUFFER_STATUS_AC_BE             2
4036 #define TDLS_PU_BUFFER_STATUS_AC_VI             4
4037 #define TDLS_PU_BUFFER_STATUS_AC_VO             8
4038
4039 /* TDLS Action Field Values */
4040 #define TDLS_SETUP_REQ                          0
4041 #define TDLS_SETUP_RESP                         1
4042 #define TDLS_SETUP_CONFIRM                      2
4043 #define TDLS_TEARDOWN                           3
4044 #define TDLS_PEER_TRAFFIC_IND                   4
4045 #define TDLS_CHANNEL_SWITCH_REQ                 5
4046 #define TDLS_CHANNEL_SWITCH_RESP                6
4047 #define TDLS_PEER_PSM_REQ                       7
4048 #define TDLS_PEER_PSM_RESP                      8
4049 #define TDLS_PEER_TRAFFIC_RESP                  9
4050 #define TDLS_DISCOVERY_REQ                      10
4051
4052 /* 802.11z TDLS Public Action Frame action field */
4053 #define TDLS_DISCOVERY_RESP                     14
4054
4055 /* 802.11u GAS action frames */
4056 #define GAS_REQUEST_ACTION_FRAME                                10
4057 #define GAS_RESPONSE_ACTION_FRAME                               11
4058 #define GAS_COMEBACK_REQUEST_ACTION_FRAME               12
4059 #define GAS_COMEBACK_RESPONSE_ACTION_FRAME              13
4060
4061 /* FTM - fine timing measurement public action frames */
4062 BWL_PRE_PACKED_STRUCT struct dot11_ftm_req {
4063         uint8 category;                         /* category of action frame (4) */
4064         uint8 action;                           /* public action (32) */
4065         uint8 trigger;                          /* trigger/continue? */
4066         /* optional lci, civic loc, ftm params */
4067 } BWL_POST_PACKED_STRUCT;
4068 typedef struct dot11_ftm_req dot11_ftm_req_t;
4069
4070 BWL_PRE_PACKED_STRUCT struct dot11_ftm {
4071         uint8 category;                         /* category of action frame (4) */
4072         uint8 action;                           /* public action (33) */
4073         uint8 dialog;                           /* dialog token */
4074         uint8 follow_up;                        /* follow up dialog token */
4075         uint8 tod[6];                           /* t1 - last depart timestamp */
4076         uint8 toa[6];                           /* t4 - last ack arrival timestamp */
4077         uint8 tod_err[2];                       /* t1 error */
4078         uint8 toa_err[2];                       /* t4 error */
4079         /* optional lci report, civic loc report, ftm params */
4080 } BWL_POST_PACKED_STRUCT;
4081 typedef struct dot11_ftm dot11_ftm_t;
4082
4083 #define DOT11_FTM_ERR_NOT_CONT_OFFSET 0
4084 #define DOT11_FTM_ERR_NOT_CONT_MASK 0x0001
4085 #define DOT11_FTM_ERR_NOT_CONT_SHIFT 0
4086 #define DOT11_FTM_ERR_NOT_CONT(_err) (((_err)[DOT11_FTM_ERR_NOT_CONT_OFFSET] & \
4087         DOT11_FTM_ERR_NOT_CONT_MASK) >> DOT11_FTM_ERR_NOT_CONT_SHIFT)
4088 #define DOT11_FTM_ERR_SET_NOT_CONT(_err, _val) do {\
4089         uint8 _err2 = (_err)[DOT11_FTM_ERR_NOT_CONT_OFFSET]; \
4090         _err2 &= ~DOT11_FTM_ERR_NOT_CONT_MASK; \
4091         _err2 |= ((_val) << DOT11_FTM_ERR_NOT_CONT_SHIFT) & DOT11_FTM_ERR_NOT_CONT_MASK; \
4092         (_err)[DOT11_FTM_ERR_NOT_CONT_OFFSET] = _err2; \
4093 } while (0)
4094
4095 #define DOT11_FTM_ERR_MAX_ERR_OFFSET 0
4096 #define DOT11_FTM_ERR_MAX_ERR_MASK 0xfff7
4097 #define DOT11_FTM_ERR_MAX_ERR_SHIFT 1
4098 #define DOT11_FTM_ERR_MAX_ERR(_err) ((((_err)[1] << 7) | (_err)[0]) >> 1)
4099 #define DOT11_FTM_ERR_SET_MAX_ERR(_err, _val) do {\
4100         uint16 _val2; \
4101         _val2 =  (((_val) << DOT11_FTM_ERR_MAX_ERR_SHIFT) |\
4102                  ((_err)[DOT11_FTM_ERR_NOT_CONT_OFFSET] & DOT11_FTM_ERR_NOT_CONT_MASK)); \
4103         (_err)[0] = _val2 & 0xff; \
4104         (_err)[1] = _val2 >> 8 & 0xff; \
4105 } while (0)
4106
4107 BWL_PRE_PACKED_STRUCT struct dot11_ftm_params {
4108         uint8 id;               /* DOT11_MNG_FTM_PARAM_ID 8.4.2.166 11mcd2.6/2014 - revisit */
4109         uint8 len;
4110         uint8 info[9];
4111 } BWL_POST_PACKED_STRUCT;
4112 typedef struct dot11_ftm_params dot11_ftm_params_t;
4113 #define DOT11_FTM_PARAMS_IE_LEN (sizeof(dot11_ftm_params_t) - 2)
4114
4115 #define FTM_PARAMS_FIELD(_p, _off, _mask, _shift) (((_p)->info[(_off)] & (_mask)) >> (_shift))
4116 #define FTM_PARAMS_SET_FIELD(_p, _off, _mask, _shift, _val) do {\
4117         uint8 _ptmp = (_p)->info[_off] & ~(_mask); \
4118         (_p)->info[(_off)] = _ptmp | (((_val) << (_shift)) & (_mask)); \
4119 } while (0)
4120
4121 #define FTM_PARAMS_STATUS_OFFSET 0
4122 #define FTM_PARAMS_STATUS_MASK 0x03
4123 #define FTM_PARAMS_STATUS_SHIFT 0
4124 #define FTM_PARAMS_STATUS(_p) FTM_PARAMS_FIELD(_p, FTM_PARAMS_STATUS_OFFSET, \
4125         FTM_PARAMS_STATUS_MASK, FTM_PARAMS_STATUS_SHIFT)
4126 #define FTM_PARAMS_SET_STATUS(_p, _status) FTM_PARAMS_SET_FIELD(_p, \
4127         FTM_PARAMS_STATUS_OFFSET, FTM_PARAMS_STATUS_MASK, FTM_PARAMS_STATUS_SHIFT, _status)
4128
4129 #define FTM_PARAMS_VALUE_OFFSET 0
4130 #define FTM_PARAMS_VALUE_MASK 0x7c
4131 #define FTM_PARAMS_VALUE_SHIFT 2
4132 #define FTM_PARAMS_VALUE(_p) FTM_PARAMS_FIELD(_p, FTM_PARAMS_VALUE_OFFSET, \
4133         FTM_PARAMS_VALUE_MASK, FTM_PARAMS_VALUE_SHIFT)
4134 #define FTM_PARAMS_SET_VALUE(_p, _value) FTM_PARAMS_SET_FIELD(_p, \
4135         FTM_PARAMS_VALUE_OFFSET, FTM_PARAMS_VALUE_MASK, FTM_PARAMS_VALUE_SHIFT, _value)
4136 #define FTM_PARAMS_MAX_VALUE 32
4137
4138 #define FTM_PARAMS_NBURSTEXP_OFFSET 1
4139 #define FTM_PARAMS_NBURSTEXP_MASK 0x0f
4140 #define FTM_PARAMS_NBURSTEXP_SHIFT 0
4141 #define FTM_PARAMS_NBURSTEXP(_p) FTM_PARAMS_FIELD(_p, FTM_PARAMS_NBURSTEXP_OFFSET, \
4142         FTM_PARAMS_NBURSTEXP_MASK, FTM_PARAMS_NBURSTEXP_SHIFT)
4143 #define FTM_PARAMS_SET_NBURSTEXP(_p, _bexp) FTM_PARAMS_SET_FIELD(_p, \
4144         FTM_PARAMS_NBURSTEXP_OFFSET, FTM_PARAMS_NBURSTEXP_MASK, FTM_PARAMS_NBURSTEXP_SHIFT, \
4145         _bexp)
4146
4147 #define FTM_PARAMS_NBURST(_p) (1 << FTM_PARAMS_NBURSTEXP(_p))
4148
4149 enum {
4150         FTM_PARAMS_BURSTTMO_NOPREF = 15
4151 };
4152
4153 #define FTM_PARAMS_BURSTTMO_OFFSET 1
4154 #define FTM_PARAMS_BURSTTMO_MASK 0xf0
4155 #define FTM_PARAMS_BURSTTMO_SHIFT 4
4156 #define FTM_PARAMS_BURSTTMO(_p) FTM_PARAMS_FIELD(_p, FTM_PARAMS_BURSTTMO_OFFSET, \
4157         FTM_PARAMS_BURSTTMO_MASK, FTM_PARAMS_BURSTTMO_SHIFT)
4158 /* set timeout in params using _tmo where timeout = 2^(_tmo) * 250us */
4159 #define FTM_PARAMS_SET_BURSTTMO(_p, _tmo) FTM_PARAMS_SET_FIELD(_p, \
4160         FTM_PARAMS_BURSTTMO_OFFSET, FTM_PARAMS_BURSTTMO_MASK, FTM_PARAMS_BURSTTMO_SHIFT, (_tmo)+2)
4161
4162 #define FTM_PARAMS_BURSTTMO_USEC(_val) ((1 << ((_val)-2)) * 250)
4163 #define FTM_PARAMS_BURSTTMO_VALID(_val) ((((_val) < 12 && (_val) > 1)) || \
4164         (_val) == FTM_PARAMS_BURSTTMO_NOPREF)
4165 #define FTM_PARAMS_BURSTTMO_MAX_MSEC 128 /* 2^9 * 250us */
4166 #define FTM_PARAMS_BURSTTMO_MAX_USEC 128000 /* 2^9 * 250us */
4167
4168 #define FTM_PARAMS_MINDELTA_OFFSET 2
4169 #define FTM_PARAMS_MINDELTA_USEC(_p) ((_p)->info[FTM_PARAMS_MINDELTA_OFFSET] * 100)
4170 #define FTM_PARAMS_SET_MINDELTA_USEC(_p, _delta) do { \
4171         (_p)->info[FTM_PARAMS_MINDELTA_OFFSET] = (_delta) / 100; \
4172 } while (0)
4173
4174 #define FTM_PARAMS_PARTIAL_TSF(_p) ((_p)->info[4] << 8 | (_p)->info[3])
4175 #define FTM_PARAMS_SET_PARTIAL_TSF(_p, _partial_tsf) do { \
4176         (_p)->info[3] = (_partial_tsf) & 0xff; \
4177         (_p)->info[4] = ((_partial_tsf) >> 8) & 0xff; \
4178 } while (0)
4179
4180 #define FTM_PARAMS_PARTIAL_TSF_MASK 0x0000000003fffc00ULL
4181 #define FTM_PARAMS_PARTIAL_TSF_SHIFT 10
4182 #define FTM_PARAMS_PARTIAL_TSF_BIT_LEN 16
4183 #define FTM_PARAMS_PARTIAL_TSF_MAX 0xffff
4184
4185 #define FTM_PARAMS_ASAP_OFFSET 5
4186 #define FTM_PARAMS_ASAP_MASK 0x4
4187 #define FTM_PARAMS_ASAP_SHIFT 2
4188 #define FTM_PARAMS_ASAP(_p) FTM_PARAMS_FIELD(_p, FTM_PARAMS_ASAP_OFFSET, \
4189         FTM_PARAMS_ASAP_MASK, FTM_PARAMS_ASAP_SHIFT)
4190 #define FTM_PARAMS_SET_ASAP(_p, _asap) FTM_PARAMS_SET_FIELD(_p, \
4191         FTM_PARAMS_ASAP_OFFSET, FTM_PARAMS_ASAP_MASK, FTM_PARAMS_ASAP_SHIFT, _asap)
4192
4193 #define FTM_PARAMS_FTM1_OFFSET 5
4194 #define FTM_PARAMS_FTM1_MASK 0x02
4195 #define FTM_PARAMS_FTM1_SHIFT 1
4196 #define FTM_PARAMS_FTM1(_p) FTM_PARAMS_FIELD(_p, FTM_PARAMS_FTM1_OFFSET, \
4197         FTM_PARAMS_FTM1_MASK, FTM_PARAMS_FTM1_SHIFT)
4198 #define FTM_PARAMS_SET_FTM1(_p, _ftm1) FTM_PARAMS_SET_FIELD(_p, \
4199         FTM_PARAMS_FTM1_OFFSET, FTM_PARAMS_FTM1_MASK, FTM_PARAMS_FTM1_SHIFT, _ftm1)
4200
4201 #define FTM_PARAMS_FTMS_PER_BURST_OFFSET 5
4202 #define FTM_PARAMS_FTMS_PER_BURST_MASK 0xf8
4203 #define FTM_PARAMS_FTMS_PER_BURST_SHIFT 3
4204 #define FTM_PARAMS_FTMS_PER_BURST(_p) FTM_PARAMS_FIELD(_p, FTM_PARAMS_FTMS_PER_BURST_OFFSET, \
4205         FTM_PARAMS_FTMS_PER_BURST_MASK, FTM_PARAMS_FTMS_PER_BURST_SHIFT)
4206 #define FTM_PARAMS_SET_FTMS_PER_BURST(_p, _nftms) FTM_PARAMS_SET_FIELD(_p, \
4207         FTM_PARAMS_FTMS_PER_BURST_OFFSET, FTM_PARAMS_FTMS_PER_BURST_MASK, \
4208         FTM_PARAMS_FTMS_PER_BURST_SHIFT, _nftms)
4209
4210 #define FTM_PARAMS_CHAN_INFO_OFFSET 6
4211 #define FTM_PARAMS_CHAN_INFO_MASK 0xfc
4212 #define FTM_PARAMS_CHAN_INFO_SHIFT 2
4213 #define FTM_PARAMS_CHAN_INFO(_p) FTM_PARAMS_FIELD(_p, FTM_PARAMS_CHAN_INFO_OFFSET, \
4214         FTM_PARAMS_CHAN_INFO_MASK, FTM_PARAMS_CHAN_INFO_SHIFT)
4215 #define FTM_PARAMS_SET_CHAN_INFO(_p, _ci) FTM_PARAMS_SET_FIELD(_p, \
4216         FTM_PARAMS_CHAN_INFO_OFFSET, FTM_PARAMS_CHAN_INFO_MASK, FTM_PARAMS_CHAN_INFO_SHIFT, _ci)
4217
4218 /* burst period - units of 100ms */
4219 #define FTM_PARAMS_BURST_PERIOD(_p) (((_p)->info[8] << 8) | (_p)->info[7])
4220 #define FTM_PARAMS_SET_BURST_PERIOD(_p, _bp) do {\
4221         (_p)->info[7] = (_bp) & 0xff; \
4222         (_p)->info[8] = ((_bp) >> 8) & 0xff; \
4223 } while (0)
4224
4225 #define FTM_PARAMS_BURST_PERIOD_MS(_p) (FTM_PARAMS_BURST_PERIOD(_p) * 100)
4226
4227 /* FTM status values - last updated from 11mcD4.0 */
4228 enum {
4229         FTM_PARAMS_STATUS_RESERVED      = 0,
4230         FTM_PARAMS_STATUS_SUCCESSFUL = 1,
4231         FTM_PARAMS_STATUS_INCAPABLE = 2,
4232         FTM_PARAMS_STATUS_FAILED = 3,
4233         /* Below are obsolte */
4234         FTM_PARAMS_STATUS_OVERRIDDEN = 4,
4235         FTM_PARAMS_STATUS_ASAP_INCAPABLE = 5,
4236         FTM_PARAMS_STATUS_ASAP_FAILED = 6,
4237         /* rest are reserved */
4238 };
4239
4240 enum {
4241         FTM_PARAMS_CHAN_INFO_NO_PREF            = 0,
4242         FTM_PARAMS_CHAN_INFO_RESERVE1           = 1,
4243         FTM_PARAMS_CHAN_INFO_RESERVE2           = 2,
4244         FTM_PARAMS_CHAN_INFO_RESERVE3           = 3,
4245         FTM_PARAMS_CHAN_INFO_NON_HT_5           = 4,
4246         FTM_PARAMS_CHAN_INFO_RESERVE5           = 5,
4247         FTM_PARAMS_CHAN_INFO_NON_HT_10          = 6,
4248         FTM_PARAMS_CHAN_INFO_RESERVE7           = 7,
4249         FTM_PARAMS_CHAN_INFO_NON_HT_20          = 8, /* excludes 2.4G, and High rate DSSS */
4250         FTM_PARAMS_CHAN_INFO_HT_MF_20           = 9,
4251         FTM_PARAMS_CHAN_INFO_VHT_20             = 10,
4252         FTM_PARAMS_CHAN_INFO_HT_MF_40           = 11,
4253         FTM_PARAMS_CHAN_INFO_VHT_40             = 12,
4254         FTM_PARAMS_CHAN_INFO_VHT_80             = 13,
4255         FTM_PARAMS_CHAN_INFO_VHT_80_80          = 14,
4256         FTM_PARAMS_CHAN_INFO_VHT_160_2_RFLOS    = 15,
4257         FTM_PARAMS_CHAN_INFO_VHT_160            = 16,
4258         /* Reserved from 17 - 30 */
4259         FTM_PARAMS_CHAN_INFO_DMG_2160           = 31,
4260         /* Reserved from 32 - 63 */
4261         FTM_PARAMS_CHAN_INFO_MAX                = 63
4262 };
4263
4264 /* 802.11u interworking access network options */
4265 #define IW_ANT_MASK                                     0x0f
4266 #define IW_INTERNET_MASK                                0x10
4267 #define IW_ASRA_MASK                                    0x20
4268 #define IW_ESR_MASK                                     0x40
4269 #define IW_UESA_MASK                                    0x80
4270
4271 /* 802.11u interworking access network type */
4272 #define IW_ANT_PRIVATE_NETWORK                          0
4273 #define IW_ANT_PRIVATE_NETWORK_WITH_GUEST               1
4274 #define IW_ANT_CHARGEABLE_PUBLIC_NETWORK                2
4275 #define IW_ANT_FREE_PUBLIC_NETWORK                      3
4276 #define IW_ANT_PERSONAL_DEVICE_NETWORK                  4
4277 #define IW_ANT_EMERGENCY_SERVICES_NETWORK               5
4278 #define IW_ANT_TEST_NETWORK                             14
4279 #define IW_ANT_WILDCARD_NETWORK                         15
4280
4281 /* 802.11u advertisement protocol */
4282 #define ADVP_ANQP_PROTOCOL_ID                           0
4283 #define ADVP_MIH_PROTOCOL_ID                            1
4284
4285 /* 802.11u advertisement protocol masks */
4286 #define ADVP_QRL_MASK                                   0x7f
4287 #define ADVP_PAME_BI_MASK                               0x80
4288
4289 /* 802.11u advertisement protocol values */
4290 #define ADVP_QRL_REQUEST                                0x00
4291 #define ADVP_QRL_RESPONSE                               0x7f
4292 #define ADVP_PAME_BI_DEPENDENT                          0x00
4293 #define ADVP_PAME_BI_INDEPENDENT                        ADVP_PAME_BI_MASK
4294
4295 /* 802.11u ANQP information ID */
4296 #define ANQP_ID_QUERY_LIST                              256
4297 #define ANQP_ID_CAPABILITY_LIST                         257
4298 #define ANQP_ID_VENUE_NAME_INFO                         258
4299 #define ANQP_ID_EMERGENCY_CALL_NUMBER_INFO              259
4300 #define ANQP_ID_NETWORK_AUTHENTICATION_TYPE_INFO        260
4301 #define ANQP_ID_ROAMING_CONSORTIUM_LIST                 261
4302 #define ANQP_ID_IP_ADDRESS_TYPE_AVAILABILITY_INFO       262
4303 #define ANQP_ID_NAI_REALM_LIST                          263
4304 #define ANQP_ID_G3PP_CELLULAR_NETWORK_INFO              264
4305 #define ANQP_ID_AP_GEOSPATIAL_LOCATION                  265
4306 #define ANQP_ID_AP_CIVIC_LOCATION                       266
4307 #define ANQP_ID_AP_LOCATION_PUBLIC_ID_URI               267
4308 #define ANQP_ID_DOMAIN_NAME_LIST                        268
4309 #define ANQP_ID_EMERGENCY_ALERT_ID_URI                  269
4310 #define ANQP_ID_EMERGENCY_NAI                           271
4311 #define ANQP_ID_VENDOR_SPECIFIC_LIST                    56797
4312
4313 /* 802.11u ANQP OUI */
4314 #define ANQP_OUI_SUBTYPE                                9
4315
4316 /* 802.11u venue name */
4317 #define VENUE_LANGUAGE_CODE_SIZE                        3
4318 #define VENUE_NAME_SIZE                                 255
4319
4320 /* 802.11u venue groups */
4321 #define VENUE_UNSPECIFIED                               0
4322 #define VENUE_ASSEMBLY                                  1
4323 #define VENUE_BUSINESS                                  2
4324 #define VENUE_EDUCATIONAL                               3
4325 #define VENUE_FACTORY                                   4
4326 #define VENUE_INSTITUTIONAL                             5
4327 #define VENUE_MERCANTILE                                6
4328 #define VENUE_RESIDENTIAL                               7
4329 #define VENUE_STORAGE                                   8
4330 #define VENUE_UTILITY                                   9
4331 #define VENUE_VEHICULAR                                 10
4332 #define VENUE_OUTDOOR                                   11
4333
4334 /* 802.11u network authentication type indicator */
4335 #define NATI_UNSPECIFIED                                -1
4336 #define NATI_ACCEPTANCE_OF_TERMS_CONDITIONS             0
4337 #define NATI_ONLINE_ENROLLMENT_SUPPORTED                1
4338 #define NATI_HTTP_HTTPS_REDIRECTION                     2
4339 #define NATI_DNS_REDIRECTION                            3
4340
4341 /* 802.11u IP address type availability - IPv6 */
4342 #define IPA_IPV6_SHIFT                                  0
4343 #define IPA_IPV6_MASK                                   (0x03 << IPA_IPV6_SHIFT)
4344 #define IPA_IPV6_NOT_AVAILABLE                          0x00
4345 #define IPA_IPV6_AVAILABLE                              0x01
4346 #define IPA_IPV6_UNKNOWN_AVAILABILITY                   0x02
4347
4348 /* 802.11u IP address type availability - IPv4 */
4349 #define IPA_IPV4_SHIFT                                  2
4350 #define IPA_IPV4_MASK                                   (0x3f << IPA_IPV4_SHIFT)
4351 #define IPA_IPV4_NOT_AVAILABLE                          0x00
4352 #define IPA_IPV4_PUBLIC                                 0x01
4353 #define IPA_IPV4_PORT_RESTRICT                          0x02
4354 #define IPA_IPV4_SINGLE_NAT                             0x03
4355 #define IPA_IPV4_DOUBLE_NAT                             0x04
4356 #define IPA_IPV4_PORT_RESTRICT_SINGLE_NAT               0x05
4357 #define IPA_IPV4_PORT_RESTRICT_DOUBLE_NAT               0x06
4358 #define IPA_IPV4_UNKNOWN_AVAILABILITY                   0x07
4359
4360 /* 802.11u NAI realm encoding */
4361 #define REALM_ENCODING_RFC4282                          0
4362 #define REALM_ENCODING_UTF8                             1
4363
4364 /* 802.11u IANA EAP method type numbers */
4365 #define REALM_EAP_TLS                                   13
4366 #define REALM_EAP_LEAP                                  17
4367 #define REALM_EAP_SIM                                   18
4368 #define REALM_EAP_TTLS                                  21
4369 #define REALM_EAP_AKA                                   23
4370 #define REALM_EAP_PEAP                                  25
4371 #define REALM_EAP_FAST                                  43
4372 #define REALM_EAP_PSK                                   47
4373 #define REALM_EAP_AKAP                                  50
4374 #define REALM_EAP_EXPANDED                              254
4375
4376 /* 802.11u authentication ID */
4377 #define REALM_EXPANDED_EAP                              1
4378 #define REALM_NON_EAP_INNER_AUTHENTICATION              2
4379 #define REALM_INNER_AUTHENTICATION_EAP                  3
4380 #define REALM_EXPANDED_INNER_EAP                        4
4381 #define REALM_CREDENTIAL                                5
4382 #define REALM_TUNNELED_EAP_CREDENTIAL                   6
4383 #define REALM_VENDOR_SPECIFIC_EAP                       221
4384
4385 /* 802.11u non-EAP inner authentication type */
4386 #define REALM_RESERVED_AUTH                             0
4387 #define REALM_PAP                                       1
4388 #define REALM_CHAP                                      2
4389 #define REALM_MSCHAP                                    3
4390 #define REALM_MSCHAPV2                                  4
4391
4392 /* 802.11u credential type */
4393 #define REALM_SIM                                       1
4394 #define REALM_USIM                                      2
4395 #define REALM_NFC                                       3
4396 #define REALM_HARDWARE_TOKEN                            4
4397 #define REALM_SOFTOKEN                                  5
4398 #define REALM_CERTIFICATE                               6
4399 #define REALM_USERNAME_PASSWORD                         7
4400 #define REALM_SERVER_SIDE                               8
4401 #define REALM_RESERVED_CRED                             9
4402 #define REALM_VENDOR_SPECIFIC_CRED                      10
4403
4404 /* 802.11u 3GPP PLMN */
4405 #define G3PP_GUD_VERSION                                0
4406 #define G3PP_PLMN_LIST_IE                               0
4407
4408 /** hotspot2.0 indication element (vendor specific) */
4409 BWL_PRE_PACKED_STRUCT struct hs20_ie {
4410         uint8 oui[3];
4411         uint8 type;
4412         uint8 config;
4413 } BWL_POST_PACKED_STRUCT;
4414 typedef struct hs20_ie hs20_ie_t;
4415 #define HS20_IE_LEN 5   /* HS20 IE length */
4416
4417 /** IEEE 802.11 Annex E */
4418 typedef enum {
4419         DOT11_2GHZ_20MHZ_CLASS_12       = 81,   /* Ch 1-11 */
4420         DOT11_5GHZ_20MHZ_CLASS_1        = 115,  /* Ch 36-48 */
4421         DOT11_5GHZ_20MHZ_CLASS_2_DFS    = 118,  /* Ch 52-64 */
4422         DOT11_5GHZ_20MHZ_CLASS_3        = 124,  /* Ch 149-161 */
4423         DOT11_5GHZ_20MHZ_CLASS_4_DFS    = 121,  /* Ch 100-140 */
4424         DOT11_5GHZ_20MHZ_CLASS_5        = 125,  /* Ch 149-165 */
4425         DOT11_5GHZ_40MHZ_CLASS_22       = 116,  /* Ch 36-44,   lower */
4426         DOT11_5GHZ_40MHZ_CLASS_23_DFS   = 119,  /* Ch 52-60,   lower */
4427         DOT11_5GHZ_40MHZ_CLASS_24_DFS   = 122,  /* Ch 100-132, lower */
4428         DOT11_5GHZ_40MHZ_CLASS_25       = 126,  /* Ch 149-157, lower */
4429         DOT11_5GHZ_40MHZ_CLASS_27       = 117,  /* Ch 40-48,   upper */
4430         DOT11_5GHZ_40MHZ_CLASS_28_DFS   = 120,  /* Ch 56-64,   upper */
4431         DOT11_5GHZ_40MHZ_CLASS_29_DFS   = 123,  /* Ch 104-136, upper */
4432         DOT11_5GHZ_40MHZ_CLASS_30       = 127,  /* Ch 153-161, upper */
4433         DOT11_2GHZ_40MHZ_CLASS_32       = 83,   /* Ch 1-7,     lower */
4434         DOT11_2GHZ_40MHZ_CLASS_33       = 84,   /* Ch 5-11,    upper */
4435 } dot11_op_class_t;
4436
4437 /* QoS map */
4438 #define QOS_MAP_FIXED_LENGTH    (8 * 2) /* DSCP ranges fixed with 8 entries */
4439
4440 #define BCM_AIBSS_IE_TYPE 56
4441
4442 /* This marks the end of a packed structure section. */
4443 #include <packed_section_end.h>
4444
4445 #endif /* _802_11_H_ */