1/*
2 * Copyright (C) 2014, 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,v 1.2 2010-12-23 05:37:39 $
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/* BA/BAR Control parameters */
173#define DOT11_BA_CTL_POLICY_NORMAL	0x0000	/* normal ack */
174#define DOT11_BA_CTL_POLICY_NOACK	0x0001	/* no ack */
175#define DOT11_BA_CTL_POLICY_MASK	0x0001	/* ack policy mask */
176
177#define DOT11_BA_CTL_MTID		0x0002	/* multi tid BA */
178#define DOT11_BA_CTL_COMPRESSED		0x0004	/* compressed bitmap */
179
180#define DOT11_BA_CTL_NUMMSDU_MASK	0x0FC0	/* num msdu in bitmap mask */
181#define DOT11_BA_CTL_NUMMSDU_SHIFT	6	/* num msdu in bitmap shift */
182
183#define DOT11_BA_CTL_TID_MASK		0xF000	/* tid mask */
184#define DOT11_BA_CTL_TID_SHIFT		12	/* tid shift */
185
186/* control frame header (BA/BAR) */
187BWL_PRE_PACKED_STRUCT struct dot11_ctl_header {
188	uint16			fc;		/* frame control */
189	uint16			durid;		/* duration/ID */
190	struct ether_addr	ra;		/* receiver address */
191	struct ether_addr	ta;		/* transmitter address */
192} BWL_POST_PACKED_STRUCT;
193#define DOT11_CTL_HDR_LEN	16		/* control frame hdr len */
194
195/* BAR frame payload */
196BWL_PRE_PACKED_STRUCT struct dot11_bar {
197	uint16			bar_control;	/* BAR Control */
198	uint16			seqnum;		/* Starting Sequence control */
199} BWL_POST_PACKED_STRUCT;
200#define DOT11_BAR_LEN		4		/* BAR frame payload length */
201
202#define DOT11_BA_BITMAP_LEN	128		/* bitmap length */
203#define DOT11_BA_CMP_BITMAP_LEN	8		/* compressed bitmap length */
204/* BA frame payload */
205BWL_PRE_PACKED_STRUCT struct dot11_ba {
206	uint16			ba_control;	/* BA Control */
207	uint16			seqnum;		/* Starting Sequence control */
208	uint8			bitmap[DOT11_BA_BITMAP_LEN];	/* Block Ack Bitmap */
209} BWL_POST_PACKED_STRUCT;
210#define DOT11_BA_LEN		4		/* BA frame payload len (wo bitmap) */
211
212/* Management frame header */
213BWL_PRE_PACKED_STRUCT struct dot11_management_header {
214	uint16			fc;		/* frame control */
215	uint16			durid;		/* duration/ID */
216	struct ether_addr	da;		/* receiver address */
217	struct ether_addr	sa;		/* transmitter address */
218	struct ether_addr	bssid;		/* BSS ID */
219	uint16			seq;		/* sequence control */
220} BWL_POST_PACKED_STRUCT;
221#define	DOT11_MGMT_HDR_LEN	24		/* d11 management header length */
222
223/* Management frame payloads */
224
225BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb {
226	uint32			timestamp[2];
227	uint16			beacon_interval;
228	uint16			capability;
229} BWL_POST_PACKED_STRUCT;
230#define	DOT11_BCN_PRB_LEN	12		/* 802.11 beacon/probe frame fixed length */
231#define	DOT11_BCN_PRB_FIXED_LEN	12		/* 802.11 beacon/probe frame fixed length */
232
233BWL_PRE_PACKED_STRUCT struct dot11_auth {
234	uint16			alg;		/* algorithm */
235	uint16			seq;		/* sequence control */
236	uint16			status;		/* status code */
237} BWL_POST_PACKED_STRUCT;
238#define DOT11_AUTH_FIXED_LEN	6		/* length of auth frame without challenge IE */
239
240BWL_PRE_PACKED_STRUCT struct dot11_assoc_req {
241	uint16			capability;	/* capability information */
242	uint16			listen;		/* listen interval */
243} BWL_POST_PACKED_STRUCT;
244#define DOT11_ASSOC_REQ_FIXED_LEN	4	/* length of assoc frame without info elts */
245
246BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req {
247	uint16			capability;	/* capability information */
248	uint16			listen;		/* listen interval */
249	struct ether_addr	ap;		/* Current AP address */
250} BWL_POST_PACKED_STRUCT;
251#define DOT11_REASSOC_REQ_FIXED_LEN	10	/* length of assoc frame without info elts */
252
253BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp {
254	uint16			capability;	/* capability information */
255	uint16			status;		/* status code */
256	uint16			aid;		/* association ID */
257} BWL_POST_PACKED_STRUCT;
258#define DOT11_ASSOC_RESP_FIXED_LEN	6	/* length of assoc resp frame without info elts */
259
260BWL_PRE_PACKED_STRUCT struct dot11_action_measure {
261	uint8	category;
262	uint8	action;
263	uint8	token;
264	uint8	data[1];
265} BWL_POST_PACKED_STRUCT;
266#define DOT11_ACTION_MEASURE_LEN	3	/* d11 action measurement header length */
267
268BWL_PRE_PACKED_STRUCT struct dot11_action_ht_ch_width {
269	uint8	category;
270	uint8	action;
271	uint8	ch_width;
272} BWL_POST_PACKED_STRUCT;
273
274BWL_PRE_PACKED_STRUCT struct dot11_action_ht_mimops {
275	uint8	category;
276	uint8	action;
277	uint8	control;
278} BWL_POST_PACKED_STRUCT;
279
280#define SM_PWRSAVE_ENABLE	1
281#define SM_PWRSAVE_MODE		2
282
283/* ************* 802.11h related definitions. ************* */
284BWL_PRE_PACKED_STRUCT struct dot11_power_cnst {
285	uint8 id;
286	uint8 len;
287	uint8 power;
288} BWL_POST_PACKED_STRUCT;
289typedef struct dot11_power_cnst dot11_power_cnst_t;
290
291BWL_PRE_PACKED_STRUCT struct dot11_power_cap {
292	uint8 min;
293	uint8 max;
294} BWL_POST_PACKED_STRUCT;
295typedef struct dot11_power_cap dot11_power_cap_t;
296
297BWL_PRE_PACKED_STRUCT struct dot11_tpc_rep {
298	uint8 id;
299	uint8 len;
300	uint8 tx_pwr;
301	uint8 margin;
302} BWL_POST_PACKED_STRUCT;
303typedef struct dot11_tpc_rep dot11_tpc_rep_t;
304#define DOT11_MNG_IE_TPC_REPORT_LEN	2 	/* length of IE data, not including 2 byte header */
305
306BWL_PRE_PACKED_STRUCT struct dot11_supp_channels {
307	uint8 id;
308	uint8 len;
309	uint8 first_channel;
310	uint8 num_channels;
311} BWL_POST_PACKED_STRUCT;
312typedef struct dot11_supp_channels dot11_supp_channels_t;
313
314/* Extension Channel Offset IE: 802.11n-D1.0 spec. added sideband
315 * offset for 40MHz operation.  The possible 3 values are:
316 * 1 = above control channel
317 * 3 = below control channel
318 * 0 = no extension channel
319 */
320BWL_PRE_PACKED_STRUCT struct dot11_extch {
321	uint8	id;		/* IE ID, 62, DOT11_MNG_EXT_CHANNEL_OFFSET */
322	uint8	len;		/* IE length */
323	uint8	extch;
324} BWL_POST_PACKED_STRUCT;
325typedef struct dot11_extch dot11_extch_ie_t;
326
327BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
328	uint8	id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
329	uint8	len;		/* IE length */
330	uint8	oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
331	uint8	type;           /* type inidicates what follows */
332	uint8	extch;
333} BWL_POST_PACKED_STRUCT;
334typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t;
335
336#define BRCM_EXTCH_IE_LEN	5
337#define BRCM_EXTCH_IE_TYPE	53	/* 802.11n ID not yet assigned */
338#define DOT11_EXTCH_IE_LEN	1
339#define DOT11_EXT_CH_MASK	0x03	/* extension channel mask */
340#define DOT11_EXT_CH_UPPER	0x01	/* ext. ch. on upper sb */
341#define DOT11_EXT_CH_LOWER	0x03	/* ext. ch. on lower sb */
342#define DOT11_EXT_CH_NONE	0x00	/* no extension ch.  */
343
344BWL_PRE_PACKED_STRUCT struct dot11_action_frmhdr {
345	uint8	category;
346	uint8	action;
347	uint8	data[1];
348} BWL_POST_PACKED_STRUCT;
349#define DOT11_ACTION_FRMHDR_LEN	2
350
351/* CSA IE data structure */
352BWL_PRE_PACKED_STRUCT struct dot11_channel_switch {
353	uint8 id;	/* id DOT11_MNG_CHANNEL_SWITCH_ID */
354	uint8 len;	/* length of IE */
355	uint8 mode;	/* mode 0 or 1 */
356	uint8 channel;	/* channel switch to */
357	uint8 count;	/* number of beacons before switching */
358} BWL_POST_PACKED_STRUCT;
359typedef struct dot11_channel_switch dot11_chan_switch_ie_t;
360
361#define DOT11_SWITCH_IE_LEN	3	/* length of IE data, not including 2 byte header */
362/* CSA mode - 802.11h-2003 $7.3.2.20 */
363#define DOT11_CSA_MODE_ADVISORY		0	/* no DOT11_CSA_MODE_NO_TX restriction imposed */
364#define DOT11_CSA_MODE_NO_TX		1	/* no transmission upon receiving CSA frame. */
365
366BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel {
367	uint8	category;
368	uint8	action;
369	dot11_chan_switch_ie_t chan_switch_ie;	/* for switch IE */
370	dot11_brcm_extch_ie_t extch_ie;		/* extension channel offset */
371} BWL_POST_PACKED_STRUCT;
372
373BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
374	uint8 mode;	/* mode 0 or 1 */
375	uint8 reg;	/* regulatory class */
376	uint8 channel;	/* channel switch to */
377	uint8 count;	/* number of beacons before switching */
378} BWL_POST_PACKED_STRUCT;
379
380/* 11n Extended Channel Switch IE data structure */
381BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
382	uint8 id;	/* id DOT11_MNG_EXT_CHANNEL_SWITCH_ID */
383	uint8 len;	/* length of IE */
384	struct dot11_csa_body b;	/* body of the ie */
385} BWL_POST_PACKED_STRUCT;
386typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
387#define DOT11_EXT_CSA_IE_LEN	4	/* length of extended channel switch IE body */
388
389BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa {
390	uint8	category;
391	uint8	action;
392	dot11_ext_csa_ie_t chan_switch_ie;	/* for switch IE */
393} BWL_POST_PACKED_STRUCT;
394
395BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
396	uint8	category;
397	uint8	action;
398	struct dot11_csa_body b;	/* body of the ie */
399} BWL_POST_PACKED_STRUCT;
400
401BWL_PRE_PACKED_STRUCT struct dot11_obss_coex {
402	uint8	id;
403	uint8	len;
404	uint8	info;
405} BWL_POST_PACKED_STRUCT;
406typedef struct dot11_obss_coex dot11_obss_coex_t;
407#define DOT11_OBSS_COEXINFO_LEN	1	/* length of OBSS Coexistence INFO IE */
408
409#define	DOT11_OBSS_COEX_INFO_REQ		0x01
410#define	DOT11_OBSS_COEX_40MHZ_INTOLERANT	0x02
411#define	DOT11_OBSS_COEX_20MHZ_WIDTH_REQ	0x04
412
413BWL_PRE_PACKED_STRUCT struct dot11_obss_chanlist {
414	uint8	id;
415	uint8	len;
416	uint8	regclass;
417	uint8	chanlist[1];
418} BWL_POST_PACKED_STRUCT;
419typedef struct dot11_obss_chanlist dot11_obss_chanlist_t;
420#define DOT11_OBSS_CHANLIST_FIXED_LEN	1	/* fixed length of regclass */
421
422BWL_PRE_PACKED_STRUCT struct dot11_extcap_ie {
423	uint8 id;
424	uint8 len;
425	uint8 cap;
426} BWL_POST_PACKED_STRUCT;
427typedef struct dot11_extcap_ie dot11_extcap_ie_t;
428#define DOT11_EXTCAP_LEN	1
429
430/* 802.11h/802.11k Measurement Request/Report IEs */
431/* Measurement Type field */
432#define DOT11_MEASURE_TYPE_BASIC 	0	/* d11 measurement basic type */
433#define DOT11_MEASURE_TYPE_CCA 		1	/* d11 measurement CCA type */
434#define DOT11_MEASURE_TYPE_RPI		2	/* d11 measurement RPI type */
435#define DOT11_MEASURE_TYPE_CHLOAD		3	/* d11 measurement Channel Load type */
436#define DOT11_MEASURE_TYPE_NOISE		4	/* d11 measurement Noise Histogram type */
437#define DOT11_MEASURE_TYPE_BEACON		5	/* d11 measurement Beacon type */
438#define DOT11_MEASURE_TYPE_FRAME	6	/* d11 measurement Frame type */
439#define DOT11_MEASURE_TYPE_STATS		7	/* d11 measurement STA Statistics type */
440#define DOT11_MEASURE_TYPE_LCI		8	/* d11 measurement LCI type */
441#define DOT11_MEASURE_TYPE_TXSTREAM		9	/* d11 measurement TX Stream type */
442#define DOT11_MEASURE_TYPE_PAUSE		255	/* d11 measurement pause type */
443
444/* Measurement Request Modes */
445#define DOT11_MEASURE_MODE_PARALLEL 	(1<<0)	/* d11 measurement parallel */
446#define DOT11_MEASURE_MODE_ENABLE 	(1<<1)	/* d11 measurement enable */
447#define DOT11_MEASURE_MODE_REQUEST	(1<<2)	/* d11 measurement request */
448#define DOT11_MEASURE_MODE_REPORT 	(1<<3)	/* d11 measurement report */
449#define DOT11_MEASURE_MODE_DUR 	(1<<4)	/* d11 measurement dur mandatory */
450/* Measurement Report Modes */
451#define DOT11_MEASURE_MODE_LATE 	(1<<0)	/* d11 measurement late */
452#define DOT11_MEASURE_MODE_INCAPABLE	(1<<1)	/* d11 measurement incapable */
453#define DOT11_MEASURE_MODE_REFUSED	(1<<2)	/* d11 measurement refuse */
454/* Basic Measurement Map bits */
455#define DOT11_MEASURE_BASIC_MAP_BSS	((uint8)(1<<0))	/* d11 measurement basic map BSS */
456#define DOT11_MEASURE_BASIC_MAP_OFDM	((uint8)(1<<1))	/* d11 measurement map OFDM */
457#define DOT11_MEASURE_BASIC_MAP_UKNOWN	((uint8)(1<<2))	/* d11 measurement map unknown */
458#define DOT11_MEASURE_BASIC_MAP_RADAR	((uint8)(1<<3))	/* d11 measurement map radar */
459#define DOT11_MEASURE_BASIC_MAP_UNMEAS	((uint8)(1<<4))	/* d11 measurement map unmeasuremnt */
460
461BWL_PRE_PACKED_STRUCT struct dot11_meas_req {
462	uint8 id;
463	uint8 len;
464	uint8 token;
465	uint8 mode;
466	uint8 type;
467	uint8 channel;
468	uint8 start_time[8];
469	uint16 duration;
470} BWL_POST_PACKED_STRUCT;
471typedef struct dot11_meas_req dot11_meas_req_t;
472#define DOT11_MNG_IE_MREQ_LEN 14	/* d11 measurement request IE length */
473/* length of Measure Request IE data not including variable len */
474#define DOT11_MNG_IE_MREQ_FIXED_LEN 3	/* d11 measurement request IE fixed length */
475
476BWL_PRE_PACKED_STRUCT struct dot11_meas_rep {
477	uint8 id;
478	uint8 len;
479	uint8 token;
480	uint8 mode;
481	uint8 type;
482	BWL_PRE_PACKED_STRUCT union
483	{
484		BWL_PRE_PACKED_STRUCT struct {
485			uint8 channel;
486			uint8 start_time[8];
487			uint16 duration;
488			uint8 map;
489		} BWL_POST_PACKED_STRUCT basic;
490		uint8 data[1];
491	} BWL_POST_PACKED_STRUCT rep;
492} BWL_POST_PACKED_STRUCT;
493typedef struct dot11_meas_rep dot11_meas_rep_t;
494
495/* length of Measure Report IE data not including variable len */
496#define DOT11_MNG_IE_MREP_FIXED_LEN	3	/* d11 measurement response IE fixed length */
497
498BWL_PRE_PACKED_STRUCT struct dot11_meas_rep_basic {
499	uint8 channel;
500	uint8 start_time[8];
501	uint16 duration;
502	uint8 map;
503} BWL_POST_PACKED_STRUCT;
504typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
505#define DOT11_MEASURE_BASIC_REP_LEN	12	/* d11 measurement basic report length */
506
507BWL_PRE_PACKED_STRUCT struct dot11_quiet {
508	uint8 id;
509	uint8 len;
510	uint8 count;	/* TBTTs until beacon interval in quiet starts */
511	uint8 period;	/* Beacon intervals between periodic quiet periods ? */
512	uint16 duration;	/* Length of quiet period, in TU's */
513	uint16 offset;	/* TU's offset from TBTT in Count field */
514} BWL_POST_PACKED_STRUCT;
515typedef struct dot11_quiet dot11_quiet_t;
516
517BWL_PRE_PACKED_STRUCT struct chan_map_tuple {
518	uint8 channel;
519	uint8 map;
520} BWL_POST_PACKED_STRUCT;
521typedef struct chan_map_tuple chan_map_tuple_t;
522
523BWL_PRE_PACKED_STRUCT struct dot11_ibss_dfs {
524	uint8 id;
525	uint8 len;
526	uint8 eaddr[ETHER_ADDR_LEN];
527	uint8 interval;
528	chan_map_tuple_t map[1];
529} BWL_POST_PACKED_STRUCT;
530typedef struct dot11_ibss_dfs dot11_ibss_dfs_t;
531
532/* WME Elements */
533#define WME_OUI			"\x00\x50\xf2"	/* WME OUI */
534#define WME_VER			1	/* WME version */
535#define WME_TYPE		2	/* WME type */
536#define WME_SUBTYPE_IE		0	/* Information Element */
537#define WME_SUBTYPE_PARAM_IE	1	/* Parameter Element */
538#define WME_SUBTYPE_TSPEC	2	/* Traffic Specification */
539
540/* WME Access Category Indices (ACIs) */
541#define AC_BE			0	/* Best Effort */
542#define AC_BK			1	/* Background */
543#define AC_VI			2	/* Video */
544#define AC_VO			3	/* Voice */
545#define AC_COUNT		4	/* number of ACs */
546
547typedef uint8 ac_bitmap_t;	/* AC bitmap of (1 << AC_xx) */
548
549#define AC_BITMAP_NONE		0x0	/* No ACs */
550#define AC_BITMAP_ALL		0xf	/* All ACs */
551#define AC_BITMAP_TST(ab, ac)	(((ab) & (1 << (ac))) != 0)
552#define AC_BITMAP_SET(ab, ac)	(((ab) |= (1 << (ac))))
553#define AC_BITMAP_RESET(ab, ac) (((ab) &= ~(1 << (ac))))
554
555/* WME Information Element (IE) */
556BWL_PRE_PACKED_STRUCT struct wme_ie {
557	uint8 oui[3];
558	uint8 type;
559	uint8 subtype;
560	uint8 version;
561	uint8 qosinfo;
562} BWL_POST_PACKED_STRUCT;
563typedef struct wme_ie wme_ie_t;
564#define WME_IE_LEN 7	/* WME IE length */
565
566BWL_PRE_PACKED_STRUCT struct edcf_acparam {
567	uint8	ACI;
568	uint8	ECW;
569	uint16  TXOP;		/* stored in network order (ls octet first) */
570} BWL_POST_PACKED_STRUCT;
571typedef struct edcf_acparam edcf_acparam_t;
572
573/* WME Parameter Element (PE) */
574BWL_PRE_PACKED_STRUCT struct wme_param_ie {
575	uint8 oui[3];
576	uint8 type;
577	uint8 subtype;
578	uint8 version;
579	uint8 qosinfo;
580	uint8 rsvd;
581	edcf_acparam_t acparam[AC_COUNT];
582} BWL_POST_PACKED_STRUCT;
583typedef struct wme_param_ie wme_param_ie_t;
584#define WME_PARAM_IE_LEN            24          /* WME Parameter IE length */
585
586/* QoS Info field for IE as sent from AP */
587#define WME_QI_AP_APSD_MASK         0x80        /* U-APSD Supported mask */
588#define WME_QI_AP_APSD_SHIFT        7           /* U-APSD Supported shift */
589#define WME_QI_AP_COUNT_MASK        0x0f        /* Parameter set count mask */
590#define WME_QI_AP_COUNT_SHIFT       0           /* Parameter set count shift */
591
592/* QoS Info field for IE as sent from STA */
593#define WME_QI_STA_MAXSPLEN_MASK    0x60        /* Max Service Period Length mask */
594#define WME_QI_STA_MAXSPLEN_SHIFT   5           /* Max Service Period Length shift */
595#define WME_QI_STA_APSD_ALL_MASK    0xf         /* APSD all AC bits mask */
596#define WME_QI_STA_APSD_ALL_SHIFT   0           /* APSD all AC bits shift */
597#define WME_QI_STA_APSD_BE_MASK     0x8         /* APSD AC_BE mask */
598#define WME_QI_STA_APSD_BE_SHIFT    3           /* APSD AC_BE shift */
599#define WME_QI_STA_APSD_BK_MASK     0x4         /* APSD AC_BK mask */
600#define WME_QI_STA_APSD_BK_SHIFT    2           /* APSD AC_BK shift */
601#define WME_QI_STA_APSD_VI_MASK     0x2         /* APSD AC_VI mask */
602#define WME_QI_STA_APSD_VI_SHIFT    1           /* APSD AC_VI shift */
603#define WME_QI_STA_APSD_VO_MASK     0x1         /* APSD AC_VO mask */
604#define WME_QI_STA_APSD_VO_SHIFT    0           /* APSD AC_VO shift */
605
606/* ACI */
607#define EDCF_AIFSN_MIN               1           /* AIFSN minimum value */
608#define EDCF_AIFSN_MAX               15          /* AIFSN maximum value */
609#define EDCF_AIFSN_MASK              0x0f        /* AIFSN mask */
610#define EDCF_ACM_MASK                0x10        /* ACM mask */
611#define EDCF_ACI_MASK                0x60        /* ACI mask */
612#define EDCF_ACI_SHIFT               5           /* ACI shift */
613#define EDCF_AIFSN_SHIFT             12          /* 4 MSB(0xFFF) in ifs_ctl for AC idx */
614
615/* ECW */
616#define EDCF_ECW_MIN                 0           /* cwmin/cwmax exponent minimum value */
617#define EDCF_ECW_MAX                 15          /* cwmin/cwmax exponent maximum value */
618#define EDCF_ECW2CW(exp)             ((1 << (exp)) - 1)
619#define EDCF_ECWMIN_MASK             0x0f        /* cwmin exponent form mask */
620#define EDCF_ECWMAX_MASK             0xf0        /* cwmax exponent form mask */
621#define EDCF_ECWMAX_SHIFT            4           /* cwmax exponent form shift */
622
623/* TXOP */
624#define EDCF_TXOP_MIN                0           /* TXOP minimum value */
625#define EDCF_TXOP_MAX                65535       /* TXOP maximum value */
626#define EDCF_TXOP2USEC(txop)         ((txop) << 5)
627
628/* Default BE ACI value for non-WME connection STA */
629#define NON_EDCF_AC_BE_ACI_STA          0x02
630
631/* Default EDCF parameters that AP advertises for STA to use; WMM draft Table 12 */
632#define EDCF_AC_BE_ACI_STA           0x03	/* STA ACI value for best effort AC */
633#define EDCF_AC_BE_ECW_STA           0xA4	/* STA ECW value for best effort AC */
634#define EDCF_AC_BE_TXOP_STA          0x0000	/* STA TXOP value for best effort AC */
635#define EDCF_AC_BK_ACI_STA           0x27	/* STA ACI value for background AC */
636#define EDCF_AC_BK_ECW_STA           0xA4	/* STA ECW value for background AC */
637#define EDCF_AC_BK_TXOP_STA          0x0000	/* STA TXOP value for background AC */
638#define EDCF_AC_VI_ACI_STA           0x42	/* STA ACI value for video AC */
639#define EDCF_AC_VI_ECW_STA           0x43	/* STA ECW value for video AC */
640#define EDCF_AC_VI_TXOP_STA          0x005e	/* STA TXOP value for video AC */
641#define EDCF_AC_VO_ACI_STA           0x62	/* STA ACI value for audio AC */
642#define EDCF_AC_VO_ECW_STA           0x32	/* STA ECW value for audio AC */
643#define EDCF_AC_VO_TXOP_STA          0x002f	/* STA TXOP value for audio AC */
644
645/* Default EDCF parameters that AP uses; WMM draft Table 14 */
646#define EDCF_AC_BE_ACI_AP            0x03	/* AP ACI value for best effort AC */
647#define EDCF_AC_BE_ECW_AP            0x64	/* AP ECW value for best effort AC */
648#define EDCF_AC_BE_TXOP_AP           0x0000	/* AP TXOP value for best effort AC */
649#define EDCF_AC_BK_ACI_AP            0x27	/* AP ACI value for background AC */
650#define EDCF_AC_BK_ECW_AP            0xA4	/* AP ECW value for background AC */
651#define EDCF_AC_BK_TXOP_AP           0x0000	/* AP TXOP value for background AC */
652#define EDCF_AC_VI_ACI_AP            0x41	/* AP ACI value for video AC */
653#define EDCF_AC_VI_ECW_AP            0x43	/* AP ECW value for video AC */
654#define EDCF_AC_VI_TXOP_AP           0x005e	/* AP TXOP value for video AC */
655#define EDCF_AC_VO_ACI_AP            0x61	/* AP ACI value for audio AC */
656#define EDCF_AC_VO_ECW_AP            0x32	/* AP ECW value for audio AC */
657#define EDCF_AC_VO_TXOP_AP           0x002f	/* AP TXOP value for audio AC */
658
659/* EDCA Parameter IE */
660BWL_PRE_PACKED_STRUCT struct edca_param_ie {
661	uint8 qosinfo;
662	uint8 rsvd;
663	edcf_acparam_t acparam[AC_COUNT];
664} BWL_POST_PACKED_STRUCT;
665typedef struct edca_param_ie edca_param_ie_t;
666#define EDCA_PARAM_IE_LEN            18          /* EDCA Parameter IE length */
667
668/* QoS Capability IE */
669BWL_PRE_PACKED_STRUCT struct qos_cap_ie {
670	uint8 qosinfo;
671} BWL_POST_PACKED_STRUCT;
672typedef struct qos_cap_ie qos_cap_ie_t;
673
674BWL_PRE_PACKED_STRUCT struct dot11_qbss_load_ie {
675	uint8 id; 			/* 11, DOT11_MNG_QBSS_LOAD_ID */
676	uint8 length;
677	uint16 station_count; 		/* total number of STAs associated */
678	uint8 channel_utilization;	/* % of time, normalized to 255, QAP sensed medium busy */
679	uint16 aac; 			/* available admission capacity */
680} BWL_POST_PACKED_STRUCT;
681typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t;
682
683/* nom_msdu_size */
684#define FIXED_MSDU_SIZE 0x8000		/* MSDU size is fixed */
685#define MSDU_SIZE_MASK	0x7fff		/* (Nominal or fixed) MSDU size */
686
687/* surplus_bandwidth */
688/* Represented as 3 bits of integer, binary point, 13 bits fraction */
689#define	INTEGER_SHIFT	13	/* integer shift */
690#define FRACTION_MASK	0x1FFF	/* fraction mask */
691
692/* Management Notification Frame */
693BWL_PRE_PACKED_STRUCT struct dot11_management_notification {
694	uint8 category;			/* DOT11_ACTION_NOTIFICATION */
695	uint8 action;
696	uint8 token;
697	uint8 status;
698	uint8 data[1];			/* Elements */
699} BWL_POST_PACKED_STRUCT;
700#define DOT11_MGMT_NOTIFICATION_LEN 4	/* Fixed length */
701
702/* WME Action Codes */
703#define WME_ADDTS_REQUEST	0	/* WME ADDTS request */
704#define WME_ADDTS_RESPONSE	1	/* WME ADDTS response */
705#define WME_DELTS_REQUEST	2	/* WME DELTS request */
706
707/* WME Setup Response Status Codes */
708#define WME_ADMISSION_ACCEPTED		0	/* WME admission accepted */
709#define WME_INVALID_PARAMETERS		1	/* WME invalide parameters */
710#define WME_ADMISSION_REFUSED		3	/* WME admission refused */
711
712/* Macro to take a pointer to a beacon or probe response
713 * body and return the char* pointer to the SSID info element
714 */
715#define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN)
716
717/* Authentication frame payload constants */
718#define DOT11_OPEN_SYSTEM	0	/* d11 open authentication */
719#define DOT11_SHARED_KEY	1	/* d11 shared authentication */
720#define DOT11_OPEN_SHARED	2	/* try open first, then shared if open failed */
721#define DOT11_CHALLENGE_LEN	128	/* d11 challenge text length */
722
723/* Frame control macros */
724#define FC_PVER_MASK		0x3	/* PVER mask */
725#define FC_PVER_SHIFT		0	/* PVER shift */
726#define FC_TYPE_MASK		0xC	/* type mask */
727#define FC_TYPE_SHIFT		2	/* type shift */
728#define FC_SUBTYPE_MASK		0xF0	/* subtype mask */
729#define FC_SUBTYPE_SHIFT	4	/* subtype shift */
730#define FC_TODS			0x100	/* to DS */
731#define FC_TODS_SHIFT		8	/* to DS shift */
732#define FC_FROMDS		0x200	/* from DS */
733#define FC_FROMDS_SHIFT		9	/* from DS shift */
734#define FC_MOREFRAG		0x400	/* more frag. */
735#define FC_MOREFRAG_SHIFT	10	/* more frag. shift */
736#define FC_RETRY		0x800	/* retry */
737#define FC_RETRY_SHIFT		11	/* retry shift */
738#define FC_PM			0x1000	/* PM */
739#define FC_PM_SHIFT		12	/* PM shift */
740#define FC_MOREDATA		0x2000	/* more data */
741#define FC_MOREDATA_SHIFT	13	/* more data shift */
742#define FC_WEP			0x4000	/* WEP */
743#define FC_WEP_SHIFT		14	/* WEP shift */
744#define FC_ORDER		0x8000	/* order */
745#define FC_ORDER_SHIFT		15	/* order shift */
746
747/* sequence control macros */
748#define SEQNUM_SHIFT		4	/* seq. number shift */
749#define SEQNUM_MAX		0x1000	/* max seqnum + 1 */
750#define FRAGNUM_MASK		0xF	/* frag. number mask */
751
752/* Frame Control type/subtype defs */
753
754/* FC Types */
755#define FC_TYPE_MNG		0	/* management type */
756#define FC_TYPE_CTL		1	/* control type */
757#define FC_TYPE_DATA		2	/* data type */
758
759/* Management Subtypes */
760#define FC_SUBTYPE_ASSOC_REQ		0	/* assoc. request */
761#define FC_SUBTYPE_ASSOC_RESP		1	/* assoc. response */
762#define FC_SUBTYPE_REASSOC_REQ		2	/* reassoc. request */
763#define FC_SUBTYPE_REASSOC_RESP		3	/* reassoc. response */
764#define FC_SUBTYPE_PROBE_REQ		4	/* probe request */
765#define FC_SUBTYPE_PROBE_RESP		5	/* probe response */
766#define FC_SUBTYPE_BEACON		8	/* beacon */
767#define FC_SUBTYPE_ATIM			9	/* ATIM */
768#define FC_SUBTYPE_DISASSOC		10	/* disassoc. */
769#define FC_SUBTYPE_AUTH			11	/* authentication */
770#define FC_SUBTYPE_DEAUTH		12	/* de-authentication */
771#define FC_SUBTYPE_ACTION		13	/* action */
772#define FC_SUBTYPE_ACTION_NOACK		14	/* action no-ack */
773
774/* Control Subtypes */
775#define FC_SUBTYPE_CTL_WRAPPER		7	/* Control Wrapper */
776#define FC_SUBTYPE_BLOCKACK_REQ		8	/* Block Ack Req */
777#define FC_SUBTYPE_BLOCKACK		9	/* Block Ack */
778#define FC_SUBTYPE_PS_POLL		10	/* PS poll */
779#define FC_SUBTYPE_RTS			11	/* RTS */
780#define FC_SUBTYPE_CTS			12	/* CTS */
781#define FC_SUBTYPE_ACK			13	/* ACK */
782#define FC_SUBTYPE_CF_END		14	/* CF-END */
783#define FC_SUBTYPE_CF_END_ACK		15	/* CF-END ACK */
784
785/* Data Subtypes */
786#define FC_SUBTYPE_DATA			0	/* Data */
787#define FC_SUBTYPE_DATA_CF_ACK		1	/* Data + CF-ACK */
788#define FC_SUBTYPE_DATA_CF_POLL		2	/* Data + CF-Poll */
789#define FC_SUBTYPE_DATA_CF_ACK_POLL	3	/* Data + CF-Ack + CF-Poll */
790#define FC_SUBTYPE_NULL			4	/* Null */
791#define FC_SUBTYPE_CF_ACK		5	/* CF-Ack */
792#define FC_SUBTYPE_CF_POLL		6	/* CF-Poll */
793#define FC_SUBTYPE_CF_ACK_POLL		7	/* CF-Ack + CF-Poll */
794#define FC_SUBTYPE_QOS_DATA		8	/* QoS Data */
795#define FC_SUBTYPE_QOS_DATA_CF_ACK	9	/* QoS Data + CF-Ack */
796#define FC_SUBTYPE_QOS_DATA_CF_POLL	10	/* QoS Data + CF-Poll */
797#define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL	11	/* QoS Data + CF-Ack + CF-Poll */
798#define FC_SUBTYPE_QOS_NULL		12	/* QoS Null */
799#define FC_SUBTYPE_QOS_CF_POLL		14	/* QoS CF-Poll */
800#define FC_SUBTYPE_QOS_CF_ACK_POLL	15	/* QoS CF-Ack + CF-Poll */
801
802/* Data Subtype Groups */
803#define FC_SUBTYPE_ANY_QOS(s)		(((s) & 8) != 0)
804#define FC_SUBTYPE_ANY_NULL(s)		(((s) & 4) != 0)
805#define FC_SUBTYPE_ANY_CF_POLL(s)	(((s) & 2) != 0)
806#define FC_SUBTYPE_ANY_CF_ACK(s)	(((s) & 1) != 0)
807
808/* Type/Subtype Combos */
809#define FC_KIND_MASK		(FC_TYPE_MASK | FC_SUBTYPE_MASK)	/* FC kind mask */
810
811#define FC_KIND(t, s)	(((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT))	/* FC kind */
812
813#define FC_SUBTYPE(fc)	(((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT)	/* Subtype from FC */
814#define FC_TYPE(fc)	(((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT)	/* Type from FC */
815
816#define FC_ASSOC_REQ	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ)	/* assoc. request */
817#define FC_ASSOC_RESP	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP)	/* assoc. response */
818#define FC_REASSOC_REQ	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ)	/* reassoc. request */
819#define FC_REASSOC_RESP	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP)	/* reassoc. response */
820#define FC_PROBE_REQ	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ)	/* probe request */
821#define FC_PROBE_RESP	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP)	/* probe response */
822#define FC_BEACON	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON)		/* beacon */
823#define FC_DISASSOC	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC)	/* disassoc */
824#define FC_AUTH		FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH)		/* authentication */
825#define FC_DEAUTH	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH)		/* deauthentication */
826#define FC_ACTION	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION)		/* action */
827#define FC_ACTION_NOACK	FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK)	/* action no-ack */
828
829#define FC_CTL_WRAPPER	FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER)	/* Control Wrapper */
830#define FC_BLOCKACK_REQ	FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ)	/* Block Ack Req */
831#define FC_BLOCKACK	FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK)	/* Block Ack */
832#define FC_PS_POLL	FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL)	/* PS poll */
833#define FC_RTS		FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS)		/* RTS */
834#define FC_CTS		FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS)		/* CTS */
835#define FC_ACK		FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK)		/* ACK */
836#define FC_CF_END	FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END)		/* CF-END */
837#define FC_CF_END_ACK	FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK)	/* CF-END ACK */
838
839#define FC_DATA		FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA)		/* data */
840#define FC_NULL_DATA	FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL)		/* null data */
841#define FC_DATA_CF_ACK	FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK)	/* data CF ACK */
842#define FC_QOS_DATA	FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA)	/* QoS data */
843#define FC_QOS_NULL	FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL)	/* QoS null */
844
845/* QoS Control Field */
846
847/* 802.1D Priority */
848#define QOS_PRIO_SHIFT		0	/* QoS priority shift */
849#define QOS_PRIO_MASK		0x0007	/* QoS priority mask */
850#define QOS_PRIO(qos)		(((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT)	/* QoS priority */
851
852/* Traffic Identifier */
853#define QOS_TID_SHIFT		0	/* QoS TID shift */
854#define QOS_TID_MASK		0x000f	/* QoS TID mask */
855#define QOS_TID(qos)		(((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT)	/* QoS TID */
856
857/* End of Service Period (U-APSD) */
858#define QOS_EOSP_SHIFT		4	/* QoS End of Service Period shift */
859#define QOS_EOSP_MASK		0x0010	/* QoS End of Service Period mask */
860#define QOS_EOSP(qos)		(((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT)	/* Qos EOSP */
861
862/* Ack Policy */
863#define QOS_ACK_NORMAL_ACK	0	/* Normal Ack */
864#define QOS_ACK_NO_ACK		1	/* No Ack (eg mcast) */
865#define QOS_ACK_NO_EXP_ACK	2	/* No Explicit Ack */
866#define QOS_ACK_BLOCK_ACK	3	/* Block Ack */
867#define QOS_ACK_SHIFT		5	/* QoS ACK shift */
868#define QOS_ACK_MASK		0x0060	/* QoS ACK mask */
869#define QOS_ACK(qos)		(((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT)	/* QoS ACK */
870
871/* A-MSDU flag */
872#define QOS_AMSDU_SHIFT		7	/* AMSDU shift */
873#define QOS_AMSDU_MASK		0x0080	/* AMSDU mask */
874
875/* Management Frames */
876
877/* Management Frame Constants */
878
879/* Fixed fields */
880#define DOT11_MNG_AUTH_ALGO_LEN		2	/* d11 management auth. algo. length */
881#define DOT11_MNG_AUTH_SEQ_LEN		2	/* d11 management auth. seq. length */
882#define DOT11_MNG_BEACON_INT_LEN	2	/* d11 management beacon interval length */
883#define DOT11_MNG_CAP_LEN		2	/* d11 management cap. length */
884#define DOT11_MNG_AP_ADDR_LEN		6	/* d11 management AP address length */
885#define DOT11_MNG_LISTEN_INT_LEN	2	/* d11 management listen interval length */
886#define DOT11_MNG_REASON_LEN		2	/* d11 management reason length */
887#define DOT11_MNG_AID_LEN		2	/* d11 management AID length */
888#define DOT11_MNG_STATUS_LEN		2	/* d11 management status length */
889#define DOT11_MNG_TIMESTAMP_LEN		8	/* d11 management timestamp length */
890
891/* DUR/ID field in assoc resp is 0xc000 | AID */
892#define DOT11_AID_MASK			0x3fff	/* d11 AID mask */
893
894/* Reason Codes */
895#define DOT11_RC_RESERVED		0	/* d11 RC reserved */
896#define DOT11_RC_UNSPECIFIED		1	/* Unspecified reason */
897#define DOT11_RC_AUTH_INVAL		2	/* Previous authentication no longer valid */
898#define DOT11_RC_DEAUTH_LEAVING		3	/* Deauthenticated because sending station
899						 * is leaving (or has left) IBSS or ESS
900						 */
901#define DOT11_RC_INACTIVITY		4	/* Disassociated due to inactivity */
902#define DOT11_RC_BUSY			5	/* Disassociated because AP is unable to handle
903						 * all currently associated stations
904						 */
905#define DOT11_RC_INVAL_CLASS_2		6	/* Class 2 frame received from
906						 * nonauthenticated station
907						 */
908#define DOT11_RC_INVAL_CLASS_3		7	/* Class 3 frame received from
909						 *  nonassociated station
910						 */
911#define DOT11_RC_DISASSOC_LEAVING	8	/* Disassociated because sending station is
912						 * leaving (or has left) BSS
913						 */
914#define DOT11_RC_NOT_AUTH		9	/* Station requesting (re)association is not
915						 * authenticated with responding station
916						 */
917#define DOT11_RC_BAD_PC			10	/* Unacceptable power capability element */
918#define DOT11_RC_BAD_CHANNELS		11	/* Unacceptable supported channels element */
919/* 12 is unused */
920
921/* 32-39 are QSTA specific reasons added in 11e */
922#define DOT11_RC_UNSPECIFIED_QOS	32	/* unspecified QoS-related reason */
923#define DOT11_RC_INSUFFCIENT_BW		33	/* QAP lacks sufficient bandwidth */
924#define DOT11_RC_EXCESSIVE_FRAMES	34	/* excessive number of frames need ack */
925#define DOT11_RC_TX_OUTSIDE_TXOP	35	/* transmitting outside the limits of txop */
926#define DOT11_RC_LEAVING_QBSS		36	/* QSTA is leaving the QBSS (or restting) */
927#define DOT11_RC_BAD_MECHANISM		37	/* does not want to use the mechanism */
928#define DOT11_RC_SETUP_NEEDED		38	/* mechanism needs a setup */
929#define DOT11_RC_TIMEOUT		39	/* timeout */
930
931#define DOT11_RC_MAX			23	/* Reason codes > 23 are reserved */
932
933/* Status Codes */
934#define DOT11_SC_SUCCESS		0	/* Successful */
935#define DOT11_SC_FAILURE		1	/* Unspecified failure */
936#define DOT11_SC_CAP_MISMATCH		10	/* Cannot support all requested
937						 * capabilities in the Capability
938						 * Information field
939						 */
940#define DOT11_SC_REASSOC_FAIL		11	/* Reassociation denied due to inability
941						 * to confirm that association exists
942						 */
943#define DOT11_SC_ASSOC_FAIL		12	/* Association denied due to reason
944						 * outside the scope of this standard
945						 */
946#define DOT11_SC_AUTH_MISMATCH		13	/* Responding station does not support
947						 * the specified authentication
948						 * algorithm
949						 */
950#define DOT11_SC_AUTH_SEQ		14	/* Received an Authentication frame
951						 * with authentication transaction
952						 * sequence number out of expected
953						 * sequence
954						 */
955#define DOT11_SC_AUTH_CHALLENGE_FAIL	15	/* Authentication rejected because of
956						 * challenge failure
957						 */
958#define DOT11_SC_AUTH_TIMEOUT		16	/* Authentication rejected due to timeout
959						 * waiting for next frame in sequence
960						 */
961#define DOT11_SC_ASSOC_BUSY_FAIL	17	/* Association denied because AP is
962						 * unable to handle additional
963						 * associated stations
964						 */
965#define DOT11_SC_ASSOC_RATE_MISMATCH	18	/* Association denied due to requesting
966						 * station not supporting all of the
967						 * data rates in the BSSBasicRateSet
968						 * parameter
969						 */
970#define DOT11_SC_ASSOC_SHORT_REQUIRED	19	/* Association denied due to requesting
971						 * station not supporting the Short
972						 * Preamble option
973						 */
974#define DOT11_SC_ASSOC_PBCC_REQUIRED	20	/* Association denied due to requesting
975						 * station not supporting the PBCC
976						 * Modulation option
977						 */
978#define DOT11_SC_ASSOC_AGILITY_REQUIRED	21	/* Association denied due to requesting
979						 * station not supporting the Channel
980						 * Agility option
981						 */
982#define DOT11_SC_ASSOC_SPECTRUM_REQUIRED	22	/* Association denied because Spectrum
983							 * Management capability is required.
984							 */
985#define DOT11_SC_ASSOC_BAD_POWER_CAP	23	/* Association denied because the info
986						 * in the Power Cap element is
987						 * unacceptable.
988						 */
989#define DOT11_SC_ASSOC_BAD_SUP_CHANNELS	24	/* Association denied because the info
990						 * in the Supported Channel element is
991						 * unacceptable
992						 */
993#define DOT11_SC_ASSOC_SHORTSLOT_REQUIRED	25	/* Association denied due to requesting
994							 * station not supporting the Short Slot
995							 * Time option
996							 */
997#define DOT11_SC_ASSOC_ERPBCC_REQUIRED	26	/* Association denied due to requesting
998						 * station not supporting the ER-PBCC
999						 * Modulation option
1000						 */
1001#define DOT11_SC_ASSOC_DSSOFDM_REQUIRED	27	/* Association denied due to requesting
1002						 * station not supporting the DSS-OFDM
1003						 * option
1004						 */
1005
1006#define	DOT11_SC_DECLINED		37	/* request declined */
1007#define	DOT11_SC_INVALID_PARAMS		38	/* One or more params have invalid values */
1008
1009/* Info Elts, length of INFORMATION portion of Info Elts */
1010#define DOT11_MNG_DS_PARAM_LEN			1	/* d11 management DS parameter length */
1011#define DOT11_MNG_IBSS_PARAM_LEN		2	/* d11 management IBSS parameter length */
1012
1013/* TIM Info element has 3 bytes fixed info in INFORMATION field,
1014 * followed by 1 to 251 bytes of Partial Virtual Bitmap
1015 */
1016#define DOT11_MNG_TIM_FIXED_LEN			3	/* d11 management TIM fixed length */
1017#define DOT11_MNG_TIM_DTIM_COUNT		0	/* d11 management DTIM count */
1018#define DOT11_MNG_TIM_DTIM_PERIOD		1	/* d11 management DTIM period */
1019#define DOT11_MNG_TIM_BITMAP_CTL		2	/* d11 management TIM BITMAP control  */
1020#define DOT11_MNG_TIM_PVB			3	/* d11 management TIM PVB */
1021
1022/* TLV defines */
1023#define TLV_TAG_OFF		0	/* tag offset */
1024#define TLV_LEN_OFF		1	/* length offset */
1025#define TLV_HDR_LEN		2	/* header length */
1026#define TLV_BODY_OFF		2	/* body offset */
1027
1028/* Management Frame Information Element IDs */
1029#define DOT11_MNG_SSID_ID			0	/* d11 management SSID id */
1030#define DOT11_MNG_RATES_ID			1	/* d11 management rates id */
1031#define DOT11_MNG_FH_PARMS_ID			2	/* d11 management FH parameter id */
1032#define DOT11_MNG_DS_PARMS_ID			3	/* d11 management DS parameter id */
1033#define DOT11_MNG_CF_PARMS_ID			4	/* d11 management CF parameter id */
1034#define DOT11_MNG_TIM_ID			5	/* d11 management TIM id */
1035#define DOT11_MNG_IBSS_PARMS_ID			6	/* d11 management IBSS parameter id */
1036#define DOT11_MNG_COUNTRY_ID			7	/* d11 management country id */
1037#define DOT11_MNG_HOPPING_PARMS_ID		8	/* d11 management hopping parameter id */
1038#define DOT11_MNG_HOPPING_TABLE_ID		9	/* d11 management hopping table id */
1039#define DOT11_MNG_REQUEST_ID			10	/* d11 management request id */
1040#define DOT11_MNG_QBSS_LOAD_ID 			11	/* d11 management QBSS Load id */
1041#define DOT11_MNG_EDCA_PARAM_ID			12	/* 11E EDCA Parameter id */
1042#define DOT11_MNG_CHALLENGE_ID			16	/* d11 management chanllenge id */
1043#define DOT11_MNG_PWR_CONSTRAINT_ID		32	/* 11H PowerConstraint */
1044#define DOT11_MNG_PWR_CAP_ID			33	/* 11H PowerCapability */
1045#define DOT11_MNG_TPC_REQUEST_ID 		34	/* 11H TPC Request */
1046#define DOT11_MNG_TPC_REPORT_ID			35	/* 11H TPC Report */
1047#define DOT11_MNG_SUPP_CHANNELS_ID		36	/* 11H Supported Channels */
1048#define DOT11_MNG_CHANNEL_SWITCH_ID		37	/* 11H ChannelSwitch Announcement */
1049#define DOT11_MNG_MEASURE_REQUEST_ID		38	/* 11H MeasurementRequest */
1050#define DOT11_MNG_MEASURE_REPORT_ID		39	/* 11H MeasurementReport */
1051#define DOT11_MNG_QUIET_ID			40	/* 11H Quiet */
1052#define DOT11_MNG_IBSS_DFS_ID			41	/* 11H IBSS_DFS */
1053#define DOT11_MNG_ERP_ID			42	/* d11 management ERP id */
1054#define DOT11_MNG_TS_DELAY_ID			43	/* d11 management TS Delay id */
1055#define	DOT11_MNG_HT_CAP			45	/* d11 mgmt HT cap id */
1056#define DOT11_MNG_QOS_CAP_ID			46	/* 11E QoS Capability id */
1057#define DOT11_MNG_NONERP_ID			47	/* d11 management NON-ERP id */
1058#define DOT11_MNG_RSN_ID			48	/* d11 management RSN id */
1059#define DOT11_MNG_EXT_RATES_ID			50	/* d11 management ext. rates id */
1060#define DOT11_MNG_AP_CHREP_ID		51	/* 11k AP Channel report id */
1061#define DOT11_MNG_NBR_REP_ID		52	/* 11k Neighbor report id */
1062#define	DOT11_MNG_REGCLASS_ID			59	/* d11 management regulatory class id */
1063#define DOT11_MNG_EXT_CSA_ID			60	/* d11 Extended CSA */
1064#define	DOT11_MNG_HT_ADD			61	/* d11 mgmt additional HT info */
1065#define	DOT11_MNG_EXT_CHANNEL_OFFSET		62	/* d11 mgmt ext channel offset */
1066
1067
1068#define DOT11_MNG_RRM_CAP_ID		70	/* 11k radio measurement capability */
1069#define	DOT11_MNG_HT_BSS_COEXINFO_ID		72	/* d11 mgmt OBSS Coexistence INFO */
1070#define	DOT11_MNG_HT_BSS_CHANNEL_REPORT_ID	73	/* d11 mgmt OBSS Intolerant Channel list */
1071#define	DOT11_MNG_HT_OBSS_ID			74	/* d11 mgmt OBSS HT info */
1072#define	DOT11_MNG_EXT_CAP			127	/* d11 mgmt ext capability */
1073#define DOT11_MNG_WPA_ID			221	/* d11 management WPA id */
1074#define DOT11_MNG_PROPR_ID			221	/* d11 management proprietary id */
1075/* should start using this one instead of above two */
1076#define DOT11_MNG_VS_ID				221	/* d11 management Vendor Specific IE */
1077
1078/* Rate element Basic flag and rate mask */
1079#define DOT11_RATE_BASIC			0x80	/* flag for a Basic Rate */
1080#define DOT11_RATE_MASK				0x7F	/* mask for numeric part of rate */
1081
1082/* ERP info element bit values */
1083#define DOT11_MNG_ERP_LEN			1	/* ERP is currently 1 byte long */
1084#define DOT11_MNG_NONERP_PRESENT		0x01	/* NonERP (802.11b) STAs are present
1085							 *in the BSS
1086							 */
1087#define DOT11_MNG_USE_PROTECTION		0x02	/* Use protection mechanisms for
1088							 *ERP-OFDM frames
1089							 */
1090#define DOT11_MNG_BARKER_PREAMBLE		0x04	/* Short Preambles: 0 == allowed,
1091							 * 1 == not allowed
1092							 */
1093/* TS Delay element offset & size */
1094#define DOT11_MGN_TS_DELAY_LEN		4	/* length of TS DELAY IE */
1095#define TS_DELAY_FIELD_SIZE			4	/* TS DELAY field size */
1096
1097/* Capability Information Field */
1098#define DOT11_CAP_ESS				0x0001	/* d11 cap. ESS */
1099#define DOT11_CAP_IBSS				0x0002	/* d11 cap. IBSS */
1100#define DOT11_CAP_POLLABLE			0x0004	/* d11 cap. pollable */
1101#define DOT11_CAP_POLL_RQ			0x0008	/* d11 cap. poll request */
1102#define DOT11_CAP_PRIVACY			0x0010	/* d11 cap. privacy */
1103#define DOT11_CAP_SHORT				0x0020	/* d11 cap. short */
1104#define DOT11_CAP_PBCC				0x0040	/* d11 cap. PBCC */
1105#define DOT11_CAP_AGILITY			0x0080	/* d11 cap. agility */
1106#define DOT11_CAP_SPECTRUM			0x0100	/* d11 cap. spectrum */
1107#define DOT11_CAP_SHORTSLOT			0x0400	/* d11 cap. shortslot */
1108#define DOT11_CAP_RRM			0x1000	/* d11 cap. 11k radio measurement */
1109#define DOT11_CAP_CCK_OFDM			0x2000	/* d11 cap. CCK/OFDM */
1110
1111/* Extended Capability Information Field */
1112#define DOT11_OBSS_COEX_MNG_SUPPORT	0x01	/* 20/40 BSS Coexistence Management support */
1113
1114/*
1115 * Action Frame Constants
1116 */
1117#define DOT11_ACTION_HDR_LEN		2	/* action frame category + action field */
1118
1119/* Action Category field (sec 7.3.1.11) */
1120#define DOT11_ACTION_CAT_ERR_MASK	0x80	/* category error mask */
1121#define DOT11_ACTION_CAT_MASK		0x7F	/* category mask */
1122#define DOT11_ACTION_CAT_SPECT_MNG	0	/* category spectrum management */
1123#define DOT11_ACTION_CAT_QOS		1	/* category QoS */
1124#define DOT11_ACTION_CAT_DLS		2	/* category DLS */
1125#define DOT11_ACTION_CAT_BLOCKACK	3	/* category block ack */
1126#define DOT11_ACTION_CAT_PUBLIC		4	/* category public */
1127#define DOT11_ACTION_CAT_RRM		5	/* category radio measurements */
1128#define DOT11_ACTION_CAT_HT		7	/* category for HT */
1129#define DOT11_ACTION_NOTIFICATION	17
1130#define DOT11_ACTION_CAT_VS		127	/* category Vendor Specific */
1131
1132/* Spectrum Management Action IDs (sec 7.4.1) */
1133#define DOT11_SM_ACTION_M_REQ		0	/* d11 action measurement request */
1134#define DOT11_SM_ACTION_M_REP		1	/* d11 action measurement response */
1135#define DOT11_SM_ACTION_TPC_REQ		2	/* d11 action TPC request */
1136#define DOT11_SM_ACTION_TPC_REP		3	/* d11 action TPC response */
1137#define DOT11_SM_ACTION_CHANNEL_SWITCH	4	/* d11 action channel switch */
1138#define DOT11_SM_ACTION_EXT_CSA		5	/* d11 extened CSA for 11n */
1139
1140/* HT action ids */
1141#define DOT11_ACTION_ID_HT_CH_WIDTH	0	/* notify channel width action id */
1142#define DOT11_ACTION_ID_HT_MIMO_PS	1	/* mimo ps action id */
1143
1144/* Public action ids */
1145#define DOT11_PUB_ACTION_BSS_COEX_MNG	0	/* 20/40 Coexistence Management action id */
1146#define DOT11_PUB_ACTION_CHANNEL_SWITCH	4	/* d11 action channel switch */
1147
1148/* Block Ack action types */
1149#define DOT11_BA_ACTION_ADDBA_REQ	0	/* ADDBA Req action frame type */
1150#define DOT11_BA_ACTION_ADDBA_RESP	1	/* ADDBA Resp action frame type */
1151#define DOT11_BA_ACTION_DELBA		2	/* DELBA action frame type */
1152
1153/* ADDBA action parameters */
1154#define DOT11_ADDBA_PARAM_AMSDU_SUP	0x0001	/* AMSDU supported under BA */
1155#define DOT11_ADDBA_PARAM_POLICY_MASK	0x0002	/* policy mask(ack vs delayed) */
1156#define DOT11_ADDBA_PARAM_POLICY_SHIFT	1	/* policy shift */
1157#define DOT11_ADDBA_PARAM_TID_MASK	0x003c	/* tid mask */
1158#define DOT11_ADDBA_PARAM_TID_SHIFT	2	/* tid shift */
1159#define DOT11_ADDBA_PARAM_BSIZE_MASK	0xffc0	/* buffer size mask */
1160#define DOT11_ADDBA_PARAM_BSIZE_SHIFT	6	/* buffer size shift */
1161
1162#define DOT11_ADDBA_POLICY_DELAYED	0	/* delayed BA policy */
1163#define DOT11_ADDBA_POLICY_IMMEDIATE	1	/* immediate BA policy */
1164
1165BWL_PRE_PACKED_STRUCT struct dot11_addba_req {
1166	uint8 category;				/* category of action frame (3) */
1167	uint8 action;				/* action: addba req */
1168	uint8 token;				/* identifier */
1169	uint16 addba_param_set;			/* parameter set */
1170	uint16 timeout;				/* timeout in seconds */
1171	uint16 start_seqnum;			/* starting sequence number */
1172} BWL_POST_PACKED_STRUCT;
1173typedef struct dot11_addba_req dot11_addba_req_t;
1174#define DOT11_ADDBA_REQ_LEN		9	/* length of addba req frame */
1175
1176BWL_PRE_PACKED_STRUCT struct dot11_addba_resp {
1177	uint8 category;				/* category of action frame (3) */
1178	uint8 action;				/* action: addba resp */
1179	uint8 token;				/* identifier */
1180	uint16 status;				/* status of add request */
1181	uint16 addba_param_set;			/* negotiated parameter set */
1182	uint16 timeout;				/* negotiated timeout in seconds */
1183} BWL_POST_PACKED_STRUCT;
1184typedef struct dot11_addba_resp dot11_addba_resp_t;
1185#define DOT11_ADDBA_RESP_LEN		9	/* length of addba resp frame */
1186
1187/* DELBA action parameters */
1188#define DOT11_DELBA_PARAM_INIT_MASK	0x0800	/* initiator mask */
1189#define DOT11_DELBA_PARAM_INIT_SHIFT	11	/* initiator shift */
1190#define DOT11_DELBA_PARAM_TID_MASK	0xf000	/* tid mask */
1191#define DOT11_DELBA_PARAM_TID_SHIFT	12	/* tid shift */
1192
1193BWL_PRE_PACKED_STRUCT struct dot11_delba {
1194	uint8 category;				/* category of action frame (3) */
1195	uint8 action;				/* action: addba req */
1196	uint16 delba_param_set;			/* paarmeter set */
1197	uint16 reason;				/* reason for dellba */
1198} BWL_POST_PACKED_STRUCT;
1199typedef struct dot11_delba dot11_delba_t;
1200#define DOT11_DELBA_LEN			6	/* length of delba frame */
1201
1202/* ************* 802.11k related definitions. ************* */
1203
1204/* Radio measurements enabled capability ie */
1205
1206#define DOT11_RRM_CAP_LEN		5	/* length of rrm cap bitmap */
1207BWL_PRE_PACKED_STRUCT struct dot11_rrm_cap_ie {
1208	uint8 cap[DOT11_RRM_CAP_LEN];
1209} BWL_POST_PACKED_STRUCT;
1210typedef struct dot11_rrm_cap_ie dot11_rrm_cap_ie_t;
1211
1212/* Bitmap definitions for cap ie */
1213#define DOT11_RRM_CAP_LINK			0
1214#define DOT11_RRM_CAP_NEIGHBOR_REPORT	1
1215#define DOT11_RRM_CAP_PARALLEL		2
1216#define DOT11_RRM_CAP_REPEATED		3
1217#define DOT11_RRM_CAP_BCN_PASSIVE	4
1218#define DOT11_RRM_CAP_BCN_ACTIVE	5
1219#define DOT11_RRM_CAP_BCN_TABLE		6
1220#define DOT11_RRM_CAP_BCN_REP_COND	7
1221#define DOT11_RRM_CAP_AP_CHANREP	16
1222
1223/* Radio Measurements action ids */
1224#define DOT11_RM_ACTION_RM_REQ		0	/* Radio measurement request */
1225#define DOT11_RM_ACTION_RM_REP		1	/* Radio measurement report */
1226#define DOT11_RM_ACTION_LM_REQ		2	/* Link measurement request */
1227#define DOT11_RM_ACTION_LM_REP		3	/* Link measurement report */
1228#define DOT11_RM_ACTION_NR_REQ		4	/* Neighbor report request */
1229#define DOT11_RM_ACTION_NR_REP		5	/* Neighbor report response */
1230
1231/* Generic radio measurement action frame header */
1232BWL_PRE_PACKED_STRUCT struct dot11_rm_action {
1233	uint8 category;				/* category of action frame (5) */
1234	uint8 action;				/* radio measurement action */
1235	uint8 token;				/* dialog token */
1236	uint8 data[1];
1237} BWL_POST_PACKED_STRUCT;
1238typedef struct dot11_rm_action dot11_rm_action_t;
1239#define DOT11_RM_ACTION_LEN 3
1240
1241BWL_PRE_PACKED_STRUCT struct dot11_rmreq {
1242	uint8 category;				/* category of action frame (5) */
1243	uint8 action;				/* radio measurement action */
1244	uint8 token;				/* dialog token */
1245	uint16 reps;				/* no. of repetitions */
1246} BWL_POST_PACKED_STRUCT;
1247typedef struct dot11_rmreq dot11_rmreq_t;
1248#define DOT11_RMREQ_LEN	5
1249
1250BWL_PRE_PACKED_STRUCT struct dot11_rm_ie {
1251	uint8 id;
1252	uint8 len;
1253	uint8 token;
1254	uint8 mode;
1255	uint8 type;
1256} BWL_POST_PACKED_STRUCT;
1257typedef struct dot11_rm_ie dot11_rm_ie_t;
1258#define DOT11_RM_IE_LEN	5
1259
1260/* Definitions for "mode" bits in rm req */
1261#define DOT11_RMREQ_MODE_PARALLEL	1
1262#define DOT11_RMREQ_MODE_ENABLE		2
1263#define DOT11_RMREQ_MODE_REQUEST	4
1264#define DOT11_RMREQ_MODE_REPORT		8
1265#define DOT11_RMREQ_MODE_DURMAND	0x10	/* Duration Mandatory */
1266
1267/* Definitions for "mode" bits in rm rep */
1268#define DOT11_RMREP_MODE_LATE		1
1269#define DOT11_RMREP_MODE_INCAPABLE	2
1270#define DOT11_RMREP_MODE_REFUSED	4
1271
1272BWL_PRE_PACKED_STRUCT struct dot11_rmreq_bcn {
1273	uint8 id;
1274	uint8 len;
1275	uint8 token;
1276	uint8 mode;
1277	uint8 type;
1278	uint8 reg;
1279	uint8 channel;
1280	uint16 interval;
1281	uint16 duration;
1282	uint8 bcn_mode;
1283	struct ether_addr	bssid;
1284} BWL_POST_PACKED_STRUCT;
1285typedef struct dot11_rmreq_bcn dot11_rmreq_bcn_t;
1286#define DOT11_RMREQ_BCN_LEN	18
1287
1288BWL_PRE_PACKED_STRUCT struct dot11_rmrep_bcn {
1289	uint8 reg;
1290	uint8 channel;
1291	uint32 starttime[2];
1292	uint16 duration;
1293	uint8 frame_info;
1294	uint8 rcpi;
1295	uint8 rsni;
1296	struct ether_addr	bssid;
1297	uint8 antenna_id;
1298	uint32 parent_tsf;
1299} BWL_POST_PACKED_STRUCT;
1300typedef struct dot11_rmrep_bcn dot11_rmrep_bcn_t;
1301#define DOT11_RMREP_BCN_LEN	26
1302
1303/* Beacon request measurement mode */
1304#define DOT11_RMREQ_BCN_PASSIVE	0
1305#define DOT11_RMREQ_BCN_ACTIVE	1
1306#define DOT11_RMREQ_BCN_TABLE	2
1307
1308/* Sub-element IDs for Beacon Request */
1309#define DOT11_RMREQ_BCN_SSID_ID	0
1310#define DOT11_RMREQ_BCN_REPINFO_ID	1
1311#define DOT11_RMREQ_BCN_REPDET_ID	2
1312#define DOT11_RMREQ_BCN_REQUEST_ID	10
1313#define DOT11_RMREQ_BCN_APCHREP_ID	51
1314
1315/* Reporting Detail element definition */
1316#define DOT11_RMREQ_BCN_REPDET_FIXED	0	/* Fixed length fields only */
1317#define DOT11_RMREQ_BCN_REPDET_REQUEST	1	/* + requested information elems */
1318#define DOT11_RMREQ_BCN_REPDET_ALL	2	/* All fields */
1319
1320/* Sub-element IDs for Beacon Report */
1321#define DOT11_RMREP_BCN_FRM_BODY	1
1322
1323/* Neighbor measurement report */
1324BWL_PRE_PACKED_STRUCT struct dot11_rmrep_nbr {
1325	struct ether_addr	bssid;
1326	uint32	bssid_info;
1327	uint8 reg;
1328	uint8 channel;
1329	uint8 phytype;
1330} BWL_POST_PACKED_STRUCT;
1331typedef struct dot11_rmrep_nbr dot11_rmrep_nbr_t;
1332#define DOT11_RMREP_NBR_LEN	13
1333
1334/* MLME Enumerations */
1335#define DOT11_BSSTYPE_INFRASTRUCTURE		0	/* d11 infrastructure */
1336#define DOT11_BSSTYPE_INDEPENDENT		1	/* d11 independent */
1337#define DOT11_BSSTYPE_ANY			2	/* d11 any BSS type */
1338#define DOT11_SCANTYPE_ACTIVE			0	/* d11 scan active */
1339#define DOT11_SCANTYPE_PASSIVE			1	/* d11 scan passive */
1340
1341/* Link Measurement */
1342BWL_PRE_PACKED_STRUCT struct dot11_lmreq {
1343	uint8 category;				/* category of action frame (5) */
1344	uint8 action;				/* radio measurement action */
1345	uint8 token;				/* dialog token */
1346	uint8 txpwr;				/* Transmit Power Used */
1347	uint8 maxtxpwr;				/* Max Transmit Power */
1348} BWL_POST_PACKED_STRUCT;
1349typedef struct dot11_lmreq dot11_lmreq_t;
1350#define DOT11_LMREQ_LEN	5
1351
1352BWL_PRE_PACKED_STRUCT struct dot11_lmrep {
1353	uint8 category;				/* category of action frame (5) */
1354	uint8 action;				/* radio measurement action */
1355	uint8 token;				/* dialog token */
1356	dot11_tpc_rep_t tpc;			/* TPC element */
1357	uint8 rxant;				/* Receive Antenna ID */
1358	uint8 txant;				/* Transmit Antenna ID */
1359	uint8 rcpi;				/* RCPI */
1360	uint8 rsni;				/* RSNI */
1361} BWL_POST_PACKED_STRUCT;
1362typedef struct dot11_lmrep dot11_lmrep_t;
1363#define DOT11_LMREP_LEN	11
1364
1365/* 802.11 BRCM "Compromise" Pre N constants */
1366#define PREN_PREAMBLE		24	/* green field preamble time */
1367#define PREN_MM_EXT		12	/* extra mixed mode preamble time */
1368#define PREN_PREAMBLE_EXT	4	/* extra preamble (multiply by unique_streams-1) */
1369
1370/* 802.11N PHY constants */
1371#define RIFS_11N_TIME		2	/* NPHY RIFS time */
1372
1373/* 802.11 A PHY constants */
1374#define APHY_SLOT_TIME		9	/* APHY slot time */
1375#define APHY_SIFS_TIME		16	/* APHY SIFS time */
1376#define APHY_DIFS_TIME		(APHY_SIFS_TIME + (2 * APHY_SLOT_TIME))	/* APHY DIFS time */
1377#define APHY_PREAMBLE_TIME	16	/* APHY preamble time */
1378#define APHY_SIGNAL_TIME	4	/* APHY signal time */
1379#define APHY_SYMBOL_TIME	4	/* APHY symbol time */
1380#define APHY_SERVICE_NBITS	16	/* APHY service nbits */
1381#define APHY_TAIL_NBITS		6	/* APHY tail nbits */
1382#define	APHY_CWMIN		15	/* APHY cwmin */
1383
1384/* 802.11 B PHY constants */
1385#define BPHY_SLOT_TIME		20	/* BPHY slot time */
1386#define BPHY_SIFS_TIME		10	/* BPHY SIFS time */
1387#define BPHY_DIFS_TIME		50	/* BPHY DIFS time */
1388#define BPHY_PLCP_TIME		192	/* BPHY PLCP time */
1389#define BPHY_PLCP_SHORT_TIME	96	/* BPHY PLCP short time */
1390#define	BPHY_CWMIN		31	/* BPHY cwmin */
1391
1392/* 802.11 G constants */
1393#define DOT11_OFDM_SIGNAL_EXTENSION	6	/* d11 OFDM signal extension */
1394
1395#define PHY_CWMAX		1023	/* PHY cwmax */
1396
1397#define	DOT11_MAXNUMFRAGS	16	/* max # fragments per MSDU */
1398
1399/* dot11Counters Table - 802.11 spec., Annex D */
1400typedef struct d11cnt {
1401	uint32		txfrag;		/* dot11TransmittedFragmentCount */
1402	uint32		txmulti;	/* dot11MulticastTransmittedFrameCount */
1403	uint32		txfail;		/* dot11FailedCount */
1404	uint32		txretry;	/* dot11RetryCount */
1405	uint32		txretrie;	/* dot11MultipleRetryCount */
1406	uint32		rxdup;		/* dot11FrameduplicateCount */
1407	uint32		txrts;		/* dot11RTSSuccessCount */
1408	uint32		txnocts;	/* dot11RTSFailureCount */
1409	uint32		txnoack;	/* dot11ACKFailureCount */
1410	uint32		rxfrag;		/* dot11ReceivedFragmentCount */
1411	uint32		rxmulti;	/* dot11MulticastReceivedFrameCount */
1412	uint32		rxcrc;		/* dot11FCSErrorCount */
1413	uint32		txfrmsnt;	/* dot11TransmittedFrameCount */
1414	uint32		rxundec;	/* dot11WEPUndecryptableCount */
1415} d11cnt_t;
1416
1417/* OUI for BRCM proprietary IE */
1418#define BRCM_PROP_OUI		"\x00\x90\x4C"	/* Broadcom proprietary OUI */
1419
1420#ifndef LINUX_POSTMOGRIFY_REMOVAL
1421/* The following BRCM_PROP_OUI types are currently in use (defined in
1422 * relevant subsections). Each of them will be in a separate proprietary(221) IE
1423 * #define SES_VNDR_IE_TYPE	1   (defined in src/ses/shared/ses.h)
1424 * #define DPT_IE_TYPE		2
1425 * #define HT_CAP_IE_TYPE	51
1426 * #define HT_ADD_IE_TYPE	52
1427 * #define BRCM_EXTCH_IE_TYPE	53
1428 */
1429
1430/* Following is the generic structure for brcm_prop_ie (uses BRCM_PROP_OUI).
1431 * DPT uses this format with type set to DPT_IE_TYPE
1432 */
1433BWL_PRE_PACKED_STRUCT struct brcm_prop_ie_s {
1434	uint8 id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
1435	uint8 len;		/* IE length */
1436	uint8 oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
1437	uint8 type;		/* type of this IE */
1438	uint16 cap;		/* DPT capabilities */
1439} BWL_POST_PACKED_STRUCT;
1440typedef struct brcm_prop_ie_s brcm_prop_ie_t;
1441
1442#define BRCM_PROP_IE_LEN	6	/* len of fixed part of brcm_prop ie */
1443
1444#define DPT_IE_TYPE		2
1445#endif /* LINUX_POSTMOGRIFY_REMOVAL */
1446
1447/* BRCM OUI: Used in the proprietary(221) IE in all broadcom devices */
1448#define BRCM_OUI		"\x00\x10\x18"	/* Broadcom OUI */
1449
1450/* BRCM info element */
1451BWL_PRE_PACKED_STRUCT struct brcm_ie {
1452	uint8	id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
1453	uint8	len;		/* IE length */
1454	uint8	oui[3];		/* Proprietary OUI, BRCM_OUI */
1455	uint8	ver;		/* type/ver of this IE */
1456	uint8	assoc;		/* # of assoc STAs */
1457	uint8	flags;		/* misc flags */
1458	uint8	flags1;		/* misc flags */
1459	uint16	amsdu_mtu_pref;	/* preferred A-MSDU MTU */
1460} BWL_POST_PACKED_STRUCT;
1461typedef	struct brcm_ie brcm_ie_t;
1462#define BRCM_IE_LEN		11	/* BRCM IE length */
1463#define BRCM_IE_VER		2	/* BRCM IE version */
1464#define BRCM_IE_LEGACY_AES_VER	1	/* BRCM IE legacy AES version */
1465
1466/* brcm_ie flags */
1467#define	BRF_LZWDS		0x4	/* lazy wds enabled */
1468#define	BRF_BLOCKACK		0x8	/* BlockACK capable */
1469
1470/* brcm_ie flags1 */
1471#define	BRF1_AMSDU		0x1	/* A-MSDU capable */
1472#define BRF1_WMEPS		0x4	/* AP is capable of handling WME + PS w/o APSD */
1473#define BRF1_PSOFIX		0x8	/* AP has fixed PS mode out-of-order packets */
1474#define	BRF1_RX_LARGE_AGG	0x10	/* device can rx large aggregates */
1475
1476/* Vendor IE structure */
1477BWL_PRE_PACKED_STRUCT struct vndr_ie {
1478	uchar id;
1479	uchar len;
1480	uchar oui [3];
1481	uchar data [1]; 	/* Variable size data */
1482} BWL_POST_PACKED_STRUCT;
1483typedef struct vndr_ie vndr_ie_t;
1484
1485#define VNDR_IE_HDR_LEN		2	/* id + len field */
1486#define VNDR_IE_MIN_LEN		3	/* size of the oui field */
1487#define VNDR_IE_MAX_LEN		256	/* verdor IE max length */
1488
1489/* ************* HT definitions. ************* */
1490#define MCSSET_LEN	16	/* 16-bits per 8-bit set to give 128-bits bitmap of MCS Index */
1491#define MAX_MCS_NUM	(128)	/* max mcs number = 128 */
1492
1493BWL_PRE_PACKED_STRUCT struct ht_cap_ie {
1494	uint16	cap;
1495	uint8	params;
1496	uint8	supp_mcs[MCSSET_LEN];
1497	uint16	ext_htcap;
1498	uint32	txbf_cap;
1499	uint8	as_cap;
1500} BWL_POST_PACKED_STRUCT;
1501typedef struct ht_cap_ie ht_cap_ie_t;
1502
1503/* CAP IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
1504/* the capability IE is primarily used to convey this nodes abilities */
1505BWL_PRE_PACKED_STRUCT struct ht_prop_cap_ie {
1506	uint8	id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
1507	uint8	len;		/* IE length */
1508	uint8	oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
1509	uint8	type;           /* type inidicates what follows */
1510	ht_cap_ie_t cap_ie;
1511} BWL_POST_PACKED_STRUCT;
1512typedef struct ht_prop_cap_ie ht_prop_cap_ie_t;
1513
1514#define HT_PROP_IE_OVERHEAD	4	/* overhead bytes for prop oui ie */
1515#define HT_CAP_IE_LEN		26	/* HT capability len (based on .11n d2.0) */
1516#define HT_CAP_IE_TYPE		51
1517
1518#define HT_CAP_LDPC_CODING	0x0001	/* Support for rx of LDPC coded pkts */
1519#define HT_CAP_40MHZ		0x0002  /* FALSE:20Mhz, TRUE:20/40MHZ supported */
1520#define HT_CAP_MIMO_PS_MASK	0x000C  /* Mimo PS mask */
1521#define HT_CAP_MIMO_PS_SHIFT	0x0002	/* Mimo PS shift */
1522#define HT_CAP_MIMO_PS_OFF	0x0003	/* Mimo PS, no restriction */
1523#define HT_CAP_MIMO_PS_RTS	0x0001	/* Mimo PS, send RTS/CTS around MIMO frames */
1524#define HT_CAP_MIMO_PS_ON	0x0000	/* Mimo PS, MIMO disallowed */
1525#define HT_CAP_GF		0x0010	/* Greenfield preamble support */
1526#define HT_CAP_SHORT_GI_20	0x0020	/* 20MHZ short guard interval support */
1527#define HT_CAP_SHORT_GI_40	0x0040	/* 40Mhz short guard interval support */
1528#define HT_CAP_TX_STBC		0x0080	/* Tx STBC support */
1529#define HT_CAP_RX_STBC_MASK	0x0300	/* Rx STBC mask */
1530#define HT_CAP_RX_STBC_SHIFT	8	/* Rx STBC shift */
1531#define HT_CAP_DELAYED_BA	0x0400	/* delayed BA support */
1532#define HT_CAP_MAX_AMSDU	0x0800	/* Max AMSDU size in bytes , 0=3839, 1=7935 */
1533#define HT_CAP_DSSS_CCK	0x1000	/* DSSS/CCK supported by the BSS */
1534#define HT_CAP_PSMP		0x2000	/* Power Save Multi Poll support */
1535#define HT_CAP_40MHZ_INTOLERANT 0x4000	/* 40MHz Intolerant */
1536#define HT_CAP_LSIG_TXOP	0x8000	/* L-SIG TXOP protection support */
1537
1538#define HT_CAP_RX_STBC_NO		0x0	/* no rx STBC support */
1539#define HT_CAP_RX_STBC_ONE_STREAM	0x1	/* rx STBC support of 1 spatial stream */
1540#define HT_CAP_RX_STBC_TWO_STREAM	0x2	/* rx STBC support of 1-2 spatial streams */
1541#define HT_CAP_RX_STBC_THREE_STREAM	0x3	/* rx STBC support of 1-3 spatial streams */
1542
1543#define HT_MAX_AMSDU		7935	/* max amsdu size (bytes) per the HT spec */
1544#define HT_MIN_AMSDU		3835	/* min amsdu size (bytes) per the HT spec */
1545
1546#define HT_PARAMS_RX_FACTOR_MASK	0x03	/* ampdu rcv factor mask */
1547#define HT_PARAMS_DENSITY_MASK		0x1C	/* ampdu density mask */
1548#define HT_PARAMS_DENSITY_SHIFT	2	/* ampdu density shift */
1549
1550/* HT/AMPDU specific define */
1551#define AMPDU_MAX_MPDU_DENSITY	7	/* max mpdu density; in 1/8 usec units */
1552#define AMPDU_RX_FACTOR_8K	0	/* max rcv ampdu len (8kb) */
1553#define AMPDU_RX_FACTOR_16K	1	/* max rcv ampdu len (16kb) */
1554#define AMPDU_RX_FACTOR_32K	2	/* max rcv ampdu len (32kb) */
1555#define AMPDU_RX_FACTOR_64K	3	/* max rcv ampdu len (64kb) */
1556#define AMPDU_RX_FACTOR_BASE	8*1024	/* ampdu factor base for rx len */
1557
1558#define AMPDU_DELIMITER_LEN	4	/* length of ampdu delimiter */
1559
1560BWL_PRE_PACKED_STRUCT struct ht_add_ie {
1561	uint8	ctl_ch;			/* control channel number */
1562	uint8	byte1;			/* ext ch,rec. ch. width, RIFS support */
1563	uint16	opmode;			/* operation mode */
1564	uint16	misc_bits;		/* misc bits */
1565	uint8	basic_mcs[MCSSET_LEN];  /* required MCS set */
1566} BWL_POST_PACKED_STRUCT;
1567typedef struct ht_add_ie ht_add_ie_t;
1568
1569/* ADD IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
1570/* the additional IE is primarily used to convey the current BSS configuration */
1571BWL_PRE_PACKED_STRUCT struct ht_prop_add_ie {
1572	uint8	id;		/* IE ID, 221, DOT11_MNG_PROPR_ID */
1573	uint8	len;		/* IE length */
1574	uint8	oui[3];		/* Proprietary OUI, BRCM_PROP_OUI */
1575	uint8	type;		/* indicates what follows */
1576	ht_add_ie_t add_ie;
1577} BWL_POST_PACKED_STRUCT;
1578typedef struct ht_prop_add_ie ht_prop_add_ie_t;
1579
1580#define HT_ADD_IE_LEN	22
1581#define HT_ADD_IE_TYPE	52
1582
1583/* byte1 defn's */
1584#define HT_BW_ANY		0x04	/* set, STA can use 20 or 40MHz */
1585#define HT_RIFS_PERMITTED     	0x08	/* RIFS allowed */
1586
1587/* opmode defn's */
1588#define HT_OPMODE_MASK	        0x0003	/* protection mode mask */
1589#define HT_OPMODE_SHIFT		0	/* protection mode shift */
1590#define HT_OPMODE_PURE		0x0000	/* protection mode PURE */
1591#define HT_OPMODE_OPTIONAL	0x0001	/* protection mode optional */
1592#define HT_OPMODE_HT20IN40	0x0002	/* protection mode 20MHz HT in 40MHz BSS */
1593#define HT_OPMODE_MIXED	0x0003	/* protection mode Mixed Mode */
1594#define HT_OPMODE_NONGF	0x0004	/* protection mode non-GF */
1595#define DOT11N_TXBURST		0x0008	/* Tx burst limit */
1596#define DOT11N_OBSS_NONHT	0x0010	/* OBSS Non-HT STA present */
1597
1598/* misc_bites defn's */
1599#define HT_BASIC_STBC_MCS	0x007f	/* basic STBC MCS */
1600#define HT_DUAL_STBC_PROT	0x0080	/* Dual STBC Protection */
1601#define HT_SECOND_BCN		0x0100	/* Secondary beacon support */
1602#define HT_LSIG_TXOP		0x0200	/* L-SIG TXOP Protection full support */
1603#define HT_PCO_ACTIVE		0x0400	/* PCO active */
1604#define HT_PCO_PHASE		0x0800	/* PCO phase */
1605
1606/* Tx Burst Limits */
1607#define DOT11N_2G_TXBURST_LIMIT	6160	/* 2G band Tx burst limit per 802.11n Draft 1.10 (usec) */
1608#define DOT11N_5G_TXBURST_LIMIT	3080	/* 5G band Tx burst limit per 802.11n Draft 1.10 (usec) */
1609
1610/* Macros for opmode */
1611#define GET_HT_OPMODE(add_ie)		((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
1612					>> HT_OPMODE_SHIFT)
1613#define HT_MIXEDMODE_PRESENT(add_ie)	((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
1614					== HT_OPMODE_MIXED)	/* mixed mode present */
1615#define HT_HT20_PRESENT(add_ie)	((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
1616					== HT_OPMODE_HT20IN40)	/* 20MHz HT present */
1617#define HT_OPTIONAL_PRESENT(add_ie)	((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
1618					== HT_OPMODE_OPTIONAL)	/* Optional protection present */
1619#define HT_USE_PROTECTION(add_ie)	(HT_HT20_PRESENT((add_ie)) || \
1620					HT_MIXEDMODE_PRESENT((add_ie))) /* use protection */
1621#define HT_NONGF_PRESENT(add_ie)	((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_NONGF) \
1622					== HT_OPMODE_NONGF)	/* non-GF present */
1623#define DOT11N_TXBURST_PRESENT(add_ie)	((ltoh16_ua(&add_ie->opmode) & DOT11N_TXBURST) \
1624					== DOT11N_TXBURST)	/* Tx Burst present */
1625#define DOT11N_OBSS_NONHT_PRESENT(add_ie)	((ltoh16_ua(&add_ie->opmode) & DOT11N_OBSS_NONHT) \
1626					== DOT11N_OBSS_NONHT)	/* OBSS Non-HT present */
1627
1628BWL_PRE_PACKED_STRUCT struct obss_params {
1629	uint16	passive_dwell;
1630	uint16	active_dwell;
1631	uint16	bss_widthscan_interval;
1632	uint16	passive_total;
1633	uint16	active_total;
1634	uint16	chanwidth_transition_dly;
1635	uint16	activity_threshold;
1636} BWL_POST_PACKED_STRUCT;
1637typedef struct obss_params obss_params_t;
1638
1639BWL_PRE_PACKED_STRUCT struct dot11_obss_ie {
1640	uint8	id;
1641	uint8	len;
1642	obss_params_t obss_params;
1643} BWL_POST_PACKED_STRUCT;
1644typedef struct dot11_obss_ie dot11_obss_ie_t;
1645#define DOT11_OBSS_SCAN_IE_LEN	sizeof(obss_params_t)	/* HT OBSS len (based on 802.11n d3.0) */
1646
1647/* HT control field */
1648#define HT_CTRL_LA_TRQ		0x00000002	/* sounding request */
1649#define HT_CTRL_LA_MAI		0x0000003C	/* MCS request or antenna selection indication */
1650#define HT_CTRL_LA_MAI_SHIFT	2
1651#define HT_CTRL_LA_MAI_MRQ	0x00000004	/* MCS request */
1652#define HT_CTRL_LA_MAI_MSI	0x00000038	/* MCS request sequence identifier */
1653#define HT_CTRL_LA_MFSI		0x000001C0	/* MFB sequence identifier */
1654#define HT_CTRL_LA_MFSI_SHIFT	6
1655#define HT_CTRL_LA_MFB_ASELC	0x0000FE00	/* MCS feedback, antenna selection command/data */
1656#define HT_CTRL_LA_MFB_ASELC_SH	9
1657#define HT_CTRL_LA_ASELC_CMD	0x00000C00	/* ASEL command */
1658#define HT_CTRL_LA_ASELC_DATA	0x0000F000	/* ASEL data */
1659#define HT_CTRL_CAL_POS		0x00030000	/* Calibration position */
1660#define HT_CTRL_CAL_SEQ		0x000C0000	/* Calibration sequence */
1661#define HT_CTRL_CSI_STEERING	0x00C00000	/* CSI/Steering */
1662#define HT_CTRL_CSI_STEER_SHIFT	22
1663#define HT_CTRL_CSI_STEER_NFB	0		/* no fedback required */
1664#define HT_CTRL_CSI_STEER_CSI	1		/* CSI, H matrix */
1665#define HT_CTRL_CSI_STEER_NCOM	2		/* non-compressed beamforming */
1666#define HT_CTRL_CSI_STEER_COM	3		/* compressed beamforming */
1667#define HT_CTRL_NDP_ANNOUNCE	0x01000000	/* NDP announcement */
1668#define HT_CTRL_AC_CONSTRAINT	0x40000000	/* AC Constraint */
1669#define HT_CTRL_RDG_MOREPPDU	0x80000000	/* RDG/More PPDU */
1670
1671#define HT_OPMODE_OPTIONAL	0x0001	/* protection mode optional */
1672#define HT_OPMODE_HT20IN40	0x0002	/* protection mode 20MHz HT in 40MHz BSS */
1673#define HT_OPMODE_MIXED	0x0003	/* protection mode Mixed Mode */
1674#define HT_OPMODE_NONGF	0x0004	/* protection mode non-GF */
1675#define DOT11N_TXBURST		0x0008	/* Tx burst limit */
1676#define DOT11N_OBSS_NONHT	0x0010	/* OBSS Non-HT STA present */
1677
1678
1679/* ************* WPA definitions. ************* */
1680#define WPA_VERSION		1	/* WPA version */
1681#define WPA_OUI			"\x00\x50\xF2"	/* WPA OUI */
1682
1683#define WPA2_VERSION		1	/* WPA2 version */
1684#define WPA2_VERSION_LEN	2	/* WAP2 version length */
1685#define WPA2_OUI		"\x00\x0F\xAC"	/* WPA2 OUI */
1686
1687#define WPA_OUI_LEN	3	/* WPA OUI length */
1688
1689/* ************* WFA definitions. ************* */
1690#define WFA_OUI			"\x00\x50\xF2"	/* WFA OUI */
1691#define WFA_OUI_LEN	3	/* WFA OUI length */
1692
1693#define WFA_OUI_TYPE_WPA	1
1694#define WFA_OUI_TYPE_WPS	4
1695#define WFA_OUI_TYPE_P2P	9
1696
1697/* RSN authenticated key managment suite */
1698#define RSN_AKM_NONE		0	/* None (IBSS) */
1699#define RSN_AKM_UNSPECIFIED	1	/* Over 802.1x */
1700#define RSN_AKM_PSK		2	/* Pre-shared Key */
1701
1702/* Key related defines */
1703#define DOT11_MAX_DEFAULT_KEYS	4	/* number of default keys */
1704#define DOT11_MAX_KEY_SIZE	32	/* max size of any key */
1705#define DOT11_MAX_IV_SIZE	16	/* max size of any IV */
1706#define DOT11_EXT_IV_FLAG	(1<<5)	/* flag to indicate IV is > 4 bytes */
1707#define DOT11_WPA_KEY_RSC_LEN   8       /* WPA RSC key len */
1708
1709#define WEP1_KEY_SIZE		5	/* max size of any WEP key */
1710#define WEP1_KEY_HEX_SIZE	10	/* size of WEP key in hex. */
1711#define WEP128_KEY_SIZE		13	/* max size of any WEP key */
1712#define WEP128_KEY_HEX_SIZE	26	/* size of WEP key in hex. */
1713#define TKIP_MIC_SIZE		8	/* size of TKIP MIC */
1714#define TKIP_EOM_SIZE		7	/* max size of TKIP EOM */
1715#define TKIP_EOM_FLAG		0x5a	/* TKIP EOM flag byte */
1716#define TKIP_KEY_SIZE		32	/* size of any TKIP key */
1717#define TKIP_MIC_AUTH_TX	16	/* offset to Authenticator MIC TX key */
1718#define TKIP_MIC_AUTH_RX	24	/* offset to Authenticator MIC RX key */
1719#define TKIP_MIC_SUP_RX		TKIP_MIC_AUTH_TX	/* offset to Supplicant MIC RX key */
1720#define TKIP_MIC_SUP_TX		TKIP_MIC_AUTH_RX	/* offset to Supplicant MIC TX key */
1721#define AES_KEY_SIZE		16	/* size of AES key */
1722#define AES_MIC_SIZE		8	/* size of AES MIC */
1723
1724/* WCN */
1725#define WCN_OUI			"\x00\x50\xf2"	/* WCN OUI */
1726#define WCN_TYPE		4	/* WCN type */
1727
1728
1729
1730/* This marks the end of a packed structure section. */
1731#include <packed_section_end.h>
1732
1733#endif /* _802_11_H_ */
1734