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