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