K2.6 patches and update.
[tomato.git] / release / src-rt / include / proto / 802.11.h
blob317e370ea97501286cd838c57e733b15987e36a2
1 /*
2 * Copyright (C) 2010, 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.
16 * Fundamental types and constants relating to 802.11
18 * $Id: 802.11.h,v 9.260.12.12 2010-11-13 00:41:30 Exp $
21 #ifndef _802_11_H_
22 #define _802_11_H_
24 #ifndef _TYPEDEFS_H_
25 #include <typedefs.h>
26 #endif
28 #ifndef _NET_ETHERNET_H_
29 #include <proto/ethernet.h>
30 #endif
32 #include <proto/wpa.h>
34 /* This marks the start of a packed structure section. */
35 #include <packed_section_start.h>
38 #define DOT11_TU_TO_US 1024 /* 802.11 Time Unit is 1024 microseconds */
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 */
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 */
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 */
67 #define DOT11_MAX_SSID_LEN 32 /* d11 max ssid length */
69 /* dot11RTSThreshold */
70 #define DOT11_DEFAULT_RTS_LEN 2347 /* d11 default RTS length */
71 #define DOT11_MAX_RTS_LEN 2347 /* d11 max RTS length */
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
78 #define DOT11_DEFAULT_FRAG_LEN 2346 /* d11 default fragmentation length */
80 /* dot11BeaconPeriod */
81 #define DOT11_MIN_BEACON_PERIOD 1 /* d11 min beacon period */
82 #define DOT11_MAX_BEACON_PERIOD 0xFFFF /* d11 max beacon period */
84 /* dot11DTIMPeriod */
85 #define DOT11_MIN_DTIM_PERIOD 1 /* d11 min DTIM period */
86 #define DOT11_MAX_DTIM_PERIOD 0xFF /* d11 max DTIM period */
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 */
91 BWL_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
98 uint16 type; /* ethertype */
99 } BWL_POST_PACKED_STRUCT;
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 */
104 /* Generic 802.11 MAC header */
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.
110 BWL_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;
120 /* Control frames */
122 BWL_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 */
130 BWL_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 */
137 BWL_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 */
144 BWL_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 */
152 BWL_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 */
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)
163 BWL_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;
170 typedef struct dot11_action_wifi_vendor_specific dot11_action_wifi_vendor_specific_t;
172 /* generic vender specific action frame with variable length */
173 BWL_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;
180 typedef struct dot11_action_vs_frmhdr dot11_action_vs_frmhdr_t;
181 #define DOT11_ACTION_VS_HDR_LEN 6
183 #define BCM_ACTION_OUI_BYTE0 0x00
184 #define BCM_ACTION_OUI_BYTE1 0x90
185 #define BCM_ACTION_OUI_BYTE2 0x4c
187 /* BA/BAR Control parameters */
188 #define DOT11_BA_CTL_POLICY_NORMAL 0x0000 /* normal ack */
189 #define DOT11_BA_CTL_POLICY_NOACK 0x0001 /* no ack */
190 #define DOT11_BA_CTL_POLICY_MASK 0x0001 /* ack policy mask */
192 #define DOT11_BA_CTL_MTID 0x0002 /* multi tid BA */
193 #define DOT11_BA_CTL_COMPRESSED 0x0004 /* compressed bitmap */
195 #define DOT11_BA_CTL_NUMMSDU_MASK 0x0FC0 /* num msdu in bitmap mask */
196 #define DOT11_BA_CTL_NUMMSDU_SHIFT 6 /* num msdu in bitmap shift */
198 #define DOT11_BA_CTL_TID_MASK 0xF000 /* tid mask */
199 #define DOT11_BA_CTL_TID_SHIFT 12 /* tid shift */
201 /* control frame header (BA/BAR) */
202 BWL_PRE_PACKED_STRUCT struct dot11_ctl_header {
203 uint16 fc; /* frame control */
204 uint16 durid; /* duration/ID */
205 struct ether_addr ra; /* receiver address */
206 struct ether_addr ta; /* transmitter address */
207 } BWL_POST_PACKED_STRUCT;
208 #define DOT11_CTL_HDR_LEN 16 /* control frame hdr len */
210 /* BAR frame payload */
211 BWL_PRE_PACKED_STRUCT struct dot11_bar {
212 uint16 bar_control; /* BAR Control */
213 uint16 seqnum; /* Starting Sequence control */
214 } BWL_POST_PACKED_STRUCT;
215 #define DOT11_BAR_LEN 4 /* BAR frame payload length */
217 #define DOT11_BA_BITMAP_LEN 128 /* bitmap length */
218 #define DOT11_BA_CMP_BITMAP_LEN 8 /* compressed bitmap length */
219 /* BA frame payload */
220 BWL_PRE_PACKED_STRUCT struct dot11_ba {
221 uint16 ba_control; /* BA Control */
222 uint16 seqnum; /* Starting Sequence control */
223 uint8 bitmap[DOT11_BA_BITMAP_LEN]; /* Block Ack Bitmap */
224 } BWL_POST_PACKED_STRUCT;
225 #define DOT11_BA_LEN 4 /* BA frame payload len (wo bitmap) */
227 /* Management frame header */
228 BWL_PRE_PACKED_STRUCT struct dot11_management_header {
229 uint16 fc; /* frame control */
230 uint16 durid; /* duration/ID */
231 struct ether_addr da; /* receiver address */
232 struct ether_addr sa; /* transmitter address */
233 struct ether_addr bssid; /* BSS ID */
234 uint16 seq; /* sequence control */
235 } BWL_POST_PACKED_STRUCT;
236 #define DOT11_MGMT_HDR_LEN 24 /* d11 management header length */
238 /* Management frame payloads */
240 BWL_PRE_PACKED_STRUCT struct dot11_bcn_prb {
241 uint32 timestamp[2];
242 uint16 beacon_interval;
243 uint16 capability;
244 } BWL_POST_PACKED_STRUCT;
245 #define DOT11_BCN_PRB_LEN 12 /* 802.11 beacon/probe frame fixed length */
246 #define DOT11_BCN_PRB_FIXED_LEN 12 /* 802.11 beacon/probe frame fixed length */
248 BWL_PRE_PACKED_STRUCT struct dot11_auth {
249 uint16 alg; /* algorithm */
250 uint16 seq; /* sequence control */
251 uint16 status; /* status code */
252 } BWL_POST_PACKED_STRUCT;
253 #define DOT11_AUTH_FIXED_LEN 6 /* length of auth frame without challenge IE */
255 BWL_PRE_PACKED_STRUCT struct dot11_assoc_req {
256 uint16 capability; /* capability information */
257 uint16 listen; /* listen interval */
258 } BWL_POST_PACKED_STRUCT;
259 #define DOT11_ASSOC_REQ_FIXED_LEN 4 /* length of assoc frame without info elts */
261 BWL_PRE_PACKED_STRUCT struct dot11_reassoc_req {
262 uint16 capability; /* capability information */
263 uint16 listen; /* listen interval */
264 struct ether_addr ap; /* Current AP address */
265 } BWL_POST_PACKED_STRUCT;
266 #define DOT11_REASSOC_REQ_FIXED_LEN 10 /* length of assoc frame without info elts */
268 BWL_PRE_PACKED_STRUCT struct dot11_assoc_resp {
269 uint16 capability; /* capability information */
270 uint16 status; /* status code */
271 uint16 aid; /* association ID */
272 } BWL_POST_PACKED_STRUCT;
273 #define DOT11_ASSOC_RESP_FIXED_LEN 6 /* length of assoc resp frame without info elts */
275 BWL_PRE_PACKED_STRUCT struct dot11_action_measure {
276 uint8 category;
277 uint8 action;
278 uint8 token;
279 uint8 data[1];
280 } BWL_POST_PACKED_STRUCT;
281 #define DOT11_ACTION_MEASURE_LEN 3 /* d11 action measurement header length */
283 BWL_PRE_PACKED_STRUCT struct dot11_action_ht_ch_width {
284 uint8 category;
285 uint8 action;
286 uint8 ch_width;
287 } BWL_POST_PACKED_STRUCT;
289 BWL_PRE_PACKED_STRUCT struct dot11_action_ht_mimops {
290 uint8 category;
291 uint8 action;
292 uint8 control;
293 } BWL_POST_PACKED_STRUCT;
295 BWL_PRE_PACKED_STRUCT struct dot11_action_sa_query {
296 uint8 category;
297 uint8 action;
298 uint16 id;
299 } BWL_POST_PACKED_STRUCT;
301 #define SM_PWRSAVE_ENABLE 1
302 #define SM_PWRSAVE_MODE 2
304 /* ************* 802.11h related definitions. ************* */
305 BWL_PRE_PACKED_STRUCT struct dot11_power_cnst {
306 uint8 id;
307 uint8 len;
308 uint8 power;
309 } BWL_POST_PACKED_STRUCT;
310 typedef struct dot11_power_cnst dot11_power_cnst_t;
312 BWL_PRE_PACKED_STRUCT struct dot11_power_cap {
313 uint8 min;
314 uint8 max;
315 } BWL_POST_PACKED_STRUCT;
316 typedef struct dot11_power_cap dot11_power_cap_t;
318 BWL_PRE_PACKED_STRUCT struct dot11_tpc_rep {
319 uint8 id;
320 uint8 len;
321 uint8 tx_pwr;
322 uint8 margin;
323 } BWL_POST_PACKED_STRUCT;
324 typedef struct dot11_tpc_rep dot11_tpc_rep_t;
325 #define DOT11_MNG_IE_TPC_REPORT_LEN 2 /* length of IE data, not including 2 byte header */
327 BWL_PRE_PACKED_STRUCT struct dot11_supp_channels {
328 uint8 id;
329 uint8 len;
330 uint8 first_channel;
331 uint8 num_channels;
332 } BWL_POST_PACKED_STRUCT;
333 typedef struct dot11_supp_channels dot11_supp_channels_t;
335 /* Extension Channel Offset IE: 802.11n-D1.0 spec. added sideband
336 * offset for 40MHz operation. The possible 3 values are:
337 * 1 = above control channel
338 * 3 = below control channel
339 * 0 = no extension channel
341 BWL_PRE_PACKED_STRUCT struct dot11_extch {
342 uint8 id; /* IE ID, 62, DOT11_MNG_EXT_CHANNEL_OFFSET */
343 uint8 len; /* IE length */
344 uint8 extch;
345 } BWL_POST_PACKED_STRUCT;
346 typedef struct dot11_extch dot11_extch_ie_t;
348 BWL_PRE_PACKED_STRUCT struct dot11_brcm_extch {
349 uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
350 uint8 len; /* IE length */
351 uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
352 uint8 type; /* type inidicates what follows */
353 uint8 extch;
354 } BWL_POST_PACKED_STRUCT;
355 typedef struct dot11_brcm_extch dot11_brcm_extch_ie_t;
357 #define BRCM_EXTCH_IE_LEN 5
358 #define BRCM_EXTCH_IE_TYPE 53 /* 802.11n ID not yet assigned */
359 #define DOT11_EXTCH_IE_LEN 1
360 #define DOT11_EXT_CH_MASK 0x03 /* extension channel mask */
361 #define DOT11_EXT_CH_UPPER 0x01 /* ext. ch. on upper sb */
362 #define DOT11_EXT_CH_LOWER 0x03 /* ext. ch. on lower sb */
363 #define DOT11_EXT_CH_NONE 0x00 /* no extension ch. */
365 BWL_PRE_PACKED_STRUCT struct dot11_action_frmhdr {
366 uint8 category;
367 uint8 action;
368 uint8 data[1];
369 } BWL_POST_PACKED_STRUCT;
370 #define DOT11_ACTION_FRMHDR_LEN 2
372 /* CSA IE data structure */
373 BWL_PRE_PACKED_STRUCT struct dot11_channel_switch {
374 uint8 id; /* id DOT11_MNG_CHANNEL_SWITCH_ID */
375 uint8 len; /* length of IE */
376 uint8 mode; /* mode 0 or 1 */
377 uint8 channel; /* channel switch to */
378 uint8 count; /* number of beacons before switching */
379 } BWL_POST_PACKED_STRUCT;
380 typedef struct dot11_channel_switch dot11_chan_switch_ie_t;
382 #define DOT11_SWITCH_IE_LEN 3 /* length of IE data, not including 2 byte header */
383 /* CSA mode - 802.11h-2003 $7.3.2.20 */
384 #define DOT11_CSA_MODE_ADVISORY 0 /* no DOT11_CSA_MODE_NO_TX restriction imposed */
385 #define DOT11_CSA_MODE_NO_TX 1 /* no transmission upon receiving CSA frame. */
387 BWL_PRE_PACKED_STRUCT struct dot11_action_switch_channel {
388 uint8 category;
389 uint8 action;
390 dot11_chan_switch_ie_t chan_switch_ie; /* for switch IE */
391 dot11_brcm_extch_ie_t extch_ie; /* extension channel offset */
392 } BWL_POST_PACKED_STRUCT;
394 BWL_PRE_PACKED_STRUCT struct dot11_csa_body {
395 uint8 mode; /* mode 0 or 1 */
396 uint8 reg; /* regulatory class */
397 uint8 channel; /* channel switch to */
398 uint8 count; /* number of beacons before switching */
399 } BWL_POST_PACKED_STRUCT;
401 /* 11n Extended Channel Switch IE data structure */
402 BWL_PRE_PACKED_STRUCT struct dot11_ext_csa {
403 uint8 id; /* id DOT11_MNG_EXT_CHANNEL_SWITCH_ID */
404 uint8 len; /* length of IE */
405 struct dot11_csa_body b; /* body of the ie */
406 } BWL_POST_PACKED_STRUCT;
407 typedef struct dot11_ext_csa dot11_ext_csa_ie_t;
408 #define DOT11_EXT_CSA_IE_LEN 4 /* length of extended channel switch IE body */
410 BWL_PRE_PACKED_STRUCT struct dot11_action_ext_csa {
411 uint8 category;
412 uint8 action;
413 dot11_ext_csa_ie_t chan_switch_ie; /* for switch IE */
414 } BWL_POST_PACKED_STRUCT;
416 BWL_PRE_PACKED_STRUCT struct dot11y_action_ext_csa {
417 uint8 category;
418 uint8 action;
419 struct dot11_csa_body b; /* body of the ie */
420 } BWL_POST_PACKED_STRUCT;
422 BWL_PRE_PACKED_STRUCT struct dot11_obss_coex {
423 uint8 id;
424 uint8 len;
425 uint8 info;
426 } BWL_POST_PACKED_STRUCT;
427 typedef struct dot11_obss_coex dot11_obss_coex_t;
428 #define DOT11_OBSS_COEXINFO_LEN 1 /* length of OBSS Coexistence INFO IE */
430 #define DOT11_OBSS_COEX_INFO_REQ 0x01
431 #define DOT11_OBSS_COEX_40MHZ_INTOLERANT 0x02
432 #define DOT11_OBSS_COEX_20MHZ_WIDTH_REQ 0x04
434 BWL_PRE_PACKED_STRUCT struct dot11_obss_chanlist {
435 uint8 id;
436 uint8 len;
437 uint8 regclass;
438 uint8 chanlist[1];
439 } BWL_POST_PACKED_STRUCT;
440 typedef struct dot11_obss_chanlist dot11_obss_chanlist_t;
441 #define DOT11_OBSS_CHANLIST_FIXED_LEN 1 /* fixed length of regclass */
443 BWL_PRE_PACKED_STRUCT struct dot11_extcap_ie {
444 uint8 id;
445 uint8 len;
446 uint8 cap[1];
447 } BWL_POST_PACKED_STRUCT;
448 typedef struct dot11_extcap_ie dot11_extcap_ie_t;
450 #define DOT11_EXTCAP_LEN_MAX 5
451 #define DOT11_EXTCAP_LEN_COEX 1
452 #define DOT11_EXTCAP_LEN_BT 4
453 #define DOT11_EXTCAP_LEN_IW 4
455 /* 802.11h/802.11k Measurement Request/Report IEs */
456 /* Measurement Type field */
457 #define DOT11_MEASURE_TYPE_BASIC 0 /* d11 measurement basic type */
458 #define DOT11_MEASURE_TYPE_CCA 1 /* d11 measurement CCA type */
459 #define DOT11_MEASURE_TYPE_RPI 2 /* d11 measurement RPI type */
460 #define DOT11_MEASURE_TYPE_CHLOAD 3 /* d11 measurement Channel Load type */
461 #define DOT11_MEASURE_TYPE_NOISE 4 /* d11 measurement Noise Histogram type */
462 #define DOT11_MEASURE_TYPE_BEACON 5 /* d11 measurement Beacon type */
463 #define DOT11_MEASURE_TYPE_FRAME 6 /* d11 measurement Frame type */
464 #define DOT11_MEASURE_TYPE_STATS 7 /* d11 measurement STA Statistics type */
465 #define DOT11_MEASURE_TYPE_LCI 8 /* d11 measurement LCI type */
466 #define DOT11_MEASURE_TYPE_TXSTREAM 9 /* d11 measurement TX Stream type */
467 #define DOT11_MEASURE_TYPE_PAUSE 255 /* d11 measurement pause type */
469 /* Measurement Request Modes */
470 #define DOT11_MEASURE_MODE_PARALLEL (1<<0) /* d11 measurement parallel */
471 #define DOT11_MEASURE_MODE_ENABLE (1<<1) /* d11 measurement enable */
472 #define DOT11_MEASURE_MODE_REQUEST (1<<2) /* d11 measurement request */
473 #define DOT11_MEASURE_MODE_REPORT (1<<3) /* d11 measurement report */
474 #define DOT11_MEASURE_MODE_DUR (1<<4) /* d11 measurement dur mandatory */
475 /* Measurement Report Modes */
476 #define DOT11_MEASURE_MODE_LATE (1<<0) /* d11 measurement late */
477 #define DOT11_MEASURE_MODE_INCAPABLE (1<<1) /* d11 measurement incapable */
478 #define DOT11_MEASURE_MODE_REFUSED (1<<2) /* d11 measurement refuse */
479 /* Basic Measurement Map bits */
480 #define DOT11_MEASURE_BASIC_MAP_BSS ((uint8)(1<<0)) /* d11 measurement basic map BSS */
481 #define DOT11_MEASURE_BASIC_MAP_OFDM ((uint8)(1<<1)) /* d11 measurement map OFDM */
482 #define DOT11_MEASURE_BASIC_MAP_UKNOWN ((uint8)(1<<2)) /* d11 measurement map unknown */
483 #define DOT11_MEASURE_BASIC_MAP_RADAR ((uint8)(1<<3)) /* d11 measurement map radar */
484 #define DOT11_MEASURE_BASIC_MAP_UNMEAS ((uint8)(1<<4)) /* d11 measurement map unmeasuremnt */
486 BWL_PRE_PACKED_STRUCT struct dot11_meas_req {
487 uint8 id;
488 uint8 len;
489 uint8 token;
490 uint8 mode;
491 uint8 type;
492 uint8 channel;
493 uint8 start_time[8];
494 uint16 duration;
495 } BWL_POST_PACKED_STRUCT;
496 typedef struct dot11_meas_req dot11_meas_req_t;
497 #define DOT11_MNG_IE_MREQ_LEN 14 /* d11 measurement request IE length */
498 /* length of Measure Request IE data not including variable len */
499 #define DOT11_MNG_IE_MREQ_FIXED_LEN 3 /* d11 measurement request IE fixed length */
501 BWL_PRE_PACKED_STRUCT struct dot11_meas_rep {
502 uint8 id;
503 uint8 len;
504 uint8 token;
505 uint8 mode;
506 uint8 type;
507 BWL_PRE_PACKED_STRUCT union
509 BWL_PRE_PACKED_STRUCT struct {
510 uint8 channel;
511 uint8 start_time[8];
512 uint16 duration;
513 uint8 map;
514 } BWL_POST_PACKED_STRUCT basic;
515 uint8 data[1];
516 } BWL_POST_PACKED_STRUCT rep;
517 } BWL_POST_PACKED_STRUCT;
518 typedef struct dot11_meas_rep dot11_meas_rep_t;
520 /* length of Measure Report IE data not including variable len */
521 #define DOT11_MNG_IE_MREP_FIXED_LEN 3 /* d11 measurement response IE fixed length */
523 BWL_PRE_PACKED_STRUCT struct dot11_meas_rep_basic {
524 uint8 channel;
525 uint8 start_time[8];
526 uint16 duration;
527 uint8 map;
528 } BWL_POST_PACKED_STRUCT;
529 typedef struct dot11_meas_rep_basic dot11_meas_rep_basic_t;
530 #define DOT11_MEASURE_BASIC_REP_LEN 12 /* d11 measurement basic report length */
532 BWL_PRE_PACKED_STRUCT struct dot11_quiet {
533 uint8 id;
534 uint8 len;
535 uint8 count; /* TBTTs until beacon interval in quiet starts */
536 uint8 period; /* Beacon intervals between periodic quiet periods ? */
537 uint16 duration; /* Length of quiet period, in TU's */
538 uint16 offset; /* TU's offset from TBTT in Count field */
539 } BWL_POST_PACKED_STRUCT;
540 typedef struct dot11_quiet dot11_quiet_t;
542 BWL_PRE_PACKED_STRUCT struct chan_map_tuple {
543 uint8 channel;
544 uint8 map;
545 } BWL_POST_PACKED_STRUCT;
546 typedef struct chan_map_tuple chan_map_tuple_t;
548 BWL_PRE_PACKED_STRUCT struct dot11_ibss_dfs {
549 uint8 id;
550 uint8 len;
551 uint8 eaddr[ETHER_ADDR_LEN];
552 uint8 interval;
553 chan_map_tuple_t map[1];
554 } BWL_POST_PACKED_STRUCT;
555 typedef struct dot11_ibss_dfs dot11_ibss_dfs_t;
557 /* WME Elements */
558 #define WME_OUI "\x00\x50\xf2" /* WME OUI */
559 #define WME_OUI_LEN 3
560 #define WME_OUI_TYPE 2 /* WME type */
561 #define WME_TYPE 2 /* WME type, deprecated */
562 #define WME_SUBTYPE_IE 0 /* Information Element */
563 #define WME_SUBTYPE_PARAM_IE 1 /* Parameter Element */
564 #define WME_SUBTYPE_TSPEC 2 /* Traffic Specification */
565 #define WME_VER 1 /* WME version */
567 /* WME Access Category Indices (ACIs) */
568 #define AC_BE 0 /* Best Effort */
569 #define AC_BK 1 /* Background */
570 #define AC_VI 2 /* Video */
571 #define AC_VO 3 /* Voice */
572 #define AC_COUNT 4 /* number of ACs */
574 typedef uint8 ac_bitmap_t; /* AC bitmap of (1 << AC_xx) */
576 #define AC_BITMAP_NONE 0x0 /* No ACs */
577 #define AC_BITMAP_ALL 0xf /* All ACs */
578 #define AC_BITMAP_TST(ab, ac) (((ab) & (1 << (ac))) != 0)
579 #define AC_BITMAP_SET(ab, ac) (((ab) |= (1 << (ac))))
580 #define AC_BITMAP_RESET(ab, ac) (((ab) &= ~(1 << (ac))))
582 /* WME Information Element (IE) */
583 BWL_PRE_PACKED_STRUCT struct wme_ie {
584 uint8 oui[3];
585 uint8 type;
586 uint8 subtype;
587 uint8 version;
588 uint8 qosinfo;
589 } BWL_POST_PACKED_STRUCT;
590 typedef struct wme_ie wme_ie_t;
591 #define WME_IE_LEN 7 /* WME IE length */
593 BWL_PRE_PACKED_STRUCT struct edcf_acparam {
594 uint8 ACI;
595 uint8 ECW;
596 uint16 TXOP; /* stored in network order (ls octet first) */
597 } BWL_POST_PACKED_STRUCT;
598 typedef struct edcf_acparam edcf_acparam_t;
600 /* WME Parameter Element (PE) */
601 BWL_PRE_PACKED_STRUCT struct wme_param_ie {
602 uint8 oui[3];
603 uint8 type;
604 uint8 subtype;
605 uint8 version;
606 uint8 qosinfo;
607 uint8 rsvd;
608 edcf_acparam_t acparam[AC_COUNT];
609 } BWL_POST_PACKED_STRUCT;
610 typedef struct wme_param_ie wme_param_ie_t;
611 #define WME_PARAM_IE_LEN 24 /* WME Parameter IE length */
613 /* QoS Info field for IE as sent from AP */
614 #define WME_QI_AP_APSD_MASK 0x80 /* U-APSD Supported mask */
615 #define WME_QI_AP_APSD_SHIFT 7 /* U-APSD Supported shift */
616 #define WME_QI_AP_COUNT_MASK 0x0f /* Parameter set count mask */
617 #define WME_QI_AP_COUNT_SHIFT 0 /* Parameter set count shift */
619 /* QoS Info field for IE as sent from STA */
620 #define WME_QI_STA_MAXSPLEN_MASK 0x60 /* Max Service Period Length mask */
621 #define WME_QI_STA_MAXSPLEN_SHIFT 5 /* Max Service Period Length shift */
622 #define WME_QI_STA_APSD_ALL_MASK 0xf /* APSD all AC bits mask */
623 #define WME_QI_STA_APSD_ALL_SHIFT 0 /* APSD all AC bits shift */
624 #define WME_QI_STA_APSD_BE_MASK 0x8 /* APSD AC_BE mask */
625 #define WME_QI_STA_APSD_BE_SHIFT 3 /* APSD AC_BE shift */
626 #define WME_QI_STA_APSD_BK_MASK 0x4 /* APSD AC_BK mask */
627 #define WME_QI_STA_APSD_BK_SHIFT 2 /* APSD AC_BK shift */
628 #define WME_QI_STA_APSD_VI_MASK 0x2 /* APSD AC_VI mask */
629 #define WME_QI_STA_APSD_VI_SHIFT 1 /* APSD AC_VI shift */
630 #define WME_QI_STA_APSD_VO_MASK 0x1 /* APSD AC_VO mask */
631 #define WME_QI_STA_APSD_VO_SHIFT 0 /* APSD AC_VO shift */
633 /* ACI */
634 #define EDCF_AIFSN_MIN 1 /* AIFSN minimum value */
635 #define EDCF_AIFSN_MAX 15 /* AIFSN maximum value */
636 #define EDCF_AIFSN_MASK 0x0f /* AIFSN mask */
637 #define EDCF_ACM_MASK 0x10 /* ACM mask */
638 #define EDCF_ACI_MASK 0x60 /* ACI mask */
639 #define EDCF_ACI_SHIFT 5 /* ACI shift */
640 #define EDCF_AIFSN_SHIFT 12 /* 4 MSB(0xFFF) in ifs_ctl for AC idx */
642 /* ECW */
643 #define EDCF_ECW_MIN 0 /* cwmin/cwmax exponent minimum value */
644 #define EDCF_ECW_MAX 15 /* cwmin/cwmax exponent maximum value */
645 #define EDCF_ECW2CW(exp) ((1 << (exp)) - 1)
646 #define EDCF_ECWMIN_MASK 0x0f /* cwmin exponent form mask */
647 #define EDCF_ECWMAX_MASK 0xf0 /* cwmax exponent form mask */
648 #define EDCF_ECWMAX_SHIFT 4 /* cwmax exponent form shift */
650 /* TXOP */
651 #define EDCF_TXOP_MIN 0 /* TXOP minimum value */
652 #define EDCF_TXOP_MAX 65535 /* TXOP maximum value */
653 #define EDCF_TXOP2USEC(txop) ((txop) << 5)
655 /* Default BE ACI value for non-WME connection STA */
656 #define NON_EDCF_AC_BE_ACI_STA 0x02
658 /* Default EDCF parameters that AP advertises for STA to use; WMM draft Table 12 */
659 #define EDCF_AC_BE_ACI_STA 0x03 /* STA ACI value for best effort AC */
660 #define EDCF_AC_BE_ECW_STA 0xA4 /* STA ECW value for best effort AC */
661 #define EDCF_AC_BE_TXOP_STA 0x0000 /* STA TXOP value for best effort AC */
662 #define EDCF_AC_BK_ACI_STA 0x27 /* STA ACI value for background AC */
663 #define EDCF_AC_BK_ECW_STA 0xA4 /* STA ECW value for background AC */
664 #define EDCF_AC_BK_TXOP_STA 0x0000 /* STA TXOP value for background AC */
665 #define EDCF_AC_VI_ACI_STA 0x42 /* STA ACI value for video AC */
666 #define EDCF_AC_VI_ECW_STA 0x43 /* STA ECW value for video AC */
667 #define EDCF_AC_VI_TXOP_STA 0x005e /* STA TXOP value for video AC */
668 #define EDCF_AC_VO_ACI_STA 0x62 /* STA ACI value for audio AC */
669 #define EDCF_AC_VO_ECW_STA 0x32 /* STA ECW value for audio AC */
670 #define EDCF_AC_VO_TXOP_STA 0x002f /* STA TXOP value for audio AC */
672 /* Default EDCF parameters that AP uses; WMM draft Table 14 */
673 #define EDCF_AC_BE_ACI_AP 0x03 /* AP ACI value for best effort AC */
674 #define EDCF_AC_BE_ECW_AP 0x64 /* AP ECW value for best effort AC */
675 #define EDCF_AC_BE_TXOP_AP 0x0000 /* AP TXOP value for best effort AC */
676 #define EDCF_AC_BK_ACI_AP 0x27 /* AP ACI value for background AC */
677 #define EDCF_AC_BK_ECW_AP 0xA4 /* AP ECW value for background AC */
678 #define EDCF_AC_BK_TXOP_AP 0x0000 /* AP TXOP value for background AC */
679 #define EDCF_AC_VI_ACI_AP 0x41 /* AP ACI value for video AC */
680 #define EDCF_AC_VI_ECW_AP 0x43 /* AP ECW value for video AC */
681 #define EDCF_AC_VI_TXOP_AP 0x005e /* AP TXOP value for video AC */
682 #define EDCF_AC_VO_ACI_AP 0x61 /* AP ACI value for audio AC */
683 #define EDCF_AC_VO_ECW_AP 0x32 /* AP ECW value for audio AC */
684 #define EDCF_AC_VO_TXOP_AP 0x002f /* AP TXOP value for audio AC */
686 /* EDCA Parameter IE */
687 BWL_PRE_PACKED_STRUCT struct edca_param_ie {
688 uint8 qosinfo;
689 uint8 rsvd;
690 edcf_acparam_t acparam[AC_COUNT];
691 } BWL_POST_PACKED_STRUCT;
692 typedef struct edca_param_ie edca_param_ie_t;
693 #define EDCA_PARAM_IE_LEN 18 /* EDCA Parameter IE length */
695 /* QoS Capability IE */
696 BWL_PRE_PACKED_STRUCT struct qos_cap_ie {
697 uint8 qosinfo;
698 } BWL_POST_PACKED_STRUCT;
699 typedef struct qos_cap_ie qos_cap_ie_t;
701 BWL_PRE_PACKED_STRUCT struct dot11_qbss_load_ie {
702 uint8 id; /* 11, DOT11_MNG_QBSS_LOAD_ID */
703 uint8 length;
704 uint16 station_count; /* total number of STAs associated */
705 uint8 channel_utilization; /* % of time, normalized to 255, QAP sensed medium busy */
706 uint16 aac; /* available admission capacity */
707 } BWL_POST_PACKED_STRUCT;
708 typedef struct dot11_qbss_load_ie dot11_qbss_load_ie_t;
710 /* nom_msdu_size */
711 #define FIXED_MSDU_SIZE 0x8000 /* MSDU size is fixed */
712 #define MSDU_SIZE_MASK 0x7fff /* (Nominal or fixed) MSDU size */
714 /* surplus_bandwidth */
715 /* Represented as 3 bits of integer, binary point, 13 bits fraction */
716 #define INTEGER_SHIFT 13 /* integer shift */
717 #define FRACTION_MASK 0x1FFF /* fraction mask */
719 /* Management Notification Frame */
720 BWL_PRE_PACKED_STRUCT struct dot11_management_notification {
721 uint8 category; /* DOT11_ACTION_NOTIFICATION */
722 uint8 action;
723 uint8 token;
724 uint8 status;
725 uint8 data[1]; /* Elements */
726 } BWL_POST_PACKED_STRUCT;
727 #define DOT11_MGMT_NOTIFICATION_LEN 4 /* Fixed length */
729 /* WME Action Codes */
730 #define WME_ADDTS_REQUEST 0 /* WME ADDTS request */
731 #define WME_ADDTS_RESPONSE 1 /* WME ADDTS response */
732 #define WME_DELTS_REQUEST 2 /* WME DELTS request */
734 /* WME Setup Response Status Codes */
735 #define WME_ADMISSION_ACCEPTED 0 /* WME admission accepted */
736 #define WME_INVALID_PARAMETERS 1 /* WME invalide parameters */
737 #define WME_ADMISSION_REFUSED 3 /* WME admission refused */
739 /* Macro to take a pointer to a beacon or probe response
740 * body and return the char* pointer to the SSID info element
742 #define BCN_PRB_SSID(body) ((char*)(body) + DOT11_BCN_PRB_LEN)
744 /* Authentication frame payload constants */
745 #define DOT11_OPEN_SYSTEM 0 /* d11 open authentication */
746 #define DOT11_SHARED_KEY 1 /* d11 shared authentication */
747 #define DOT11_FAST_BSS 2 /* d11 fast bss authentication */
748 #define DOT11_OPEN_SHARED 3 /* try open first, then shared if open failed */
749 #define DOT11_CHALLENGE_LEN 128 /* d11 challenge text length */
751 /* Frame control macros */
752 #define FC_PVER_MASK 0x3 /* PVER mask */
753 #define FC_PVER_SHIFT 0 /* PVER shift */
754 #define FC_TYPE_MASK 0xC /* type mask */
755 #define FC_TYPE_SHIFT 2 /* type shift */
756 #define FC_SUBTYPE_MASK 0xF0 /* subtype mask */
757 #define FC_SUBTYPE_SHIFT 4 /* subtype shift */
758 #define FC_TODS 0x100 /* to DS */
759 #define FC_TODS_SHIFT 8 /* to DS shift */
760 #define FC_FROMDS 0x200 /* from DS */
761 #define FC_FROMDS_SHIFT 9 /* from DS shift */
762 #define FC_MOREFRAG 0x400 /* more frag. */
763 #define FC_MOREFRAG_SHIFT 10 /* more frag. shift */
764 #define FC_RETRY 0x800 /* retry */
765 #define FC_RETRY_SHIFT 11 /* retry shift */
766 #define FC_PM 0x1000 /* PM */
767 #define FC_PM_SHIFT 12 /* PM shift */
768 #define FC_MOREDATA 0x2000 /* more data */
769 #define FC_MOREDATA_SHIFT 13 /* more data shift */
770 #define FC_WEP 0x4000 /* WEP */
771 #define FC_WEP_SHIFT 14 /* WEP shift */
772 #define FC_ORDER 0x8000 /* order */
773 #define FC_ORDER_SHIFT 15 /* order shift */
775 /* sequence control macros */
776 #define SEQNUM_SHIFT 4 /* seq. number shift */
777 #define SEQNUM_MAX 0x1000 /* max seqnum + 1 */
778 #define FRAGNUM_MASK 0xF /* frag. number mask */
780 /* Frame Control type/subtype defs */
782 /* FC Types */
783 #define FC_TYPE_MNG 0 /* management type */
784 #define FC_TYPE_CTL 1 /* control type */
785 #define FC_TYPE_DATA 2 /* data type */
787 /* Management Subtypes */
788 #define FC_SUBTYPE_ASSOC_REQ 0 /* assoc. request */
789 #define FC_SUBTYPE_ASSOC_RESP 1 /* assoc. response */
790 #define FC_SUBTYPE_REASSOC_REQ 2 /* reassoc. request */
791 #define FC_SUBTYPE_REASSOC_RESP 3 /* reassoc. response */
792 #define FC_SUBTYPE_PROBE_REQ 4 /* probe request */
793 #define FC_SUBTYPE_PROBE_RESP 5 /* probe response */
794 #define FC_SUBTYPE_BEACON 8 /* beacon */
795 #define FC_SUBTYPE_ATIM 9 /* ATIM */
796 #define FC_SUBTYPE_DISASSOC 10 /* disassoc. */
797 #define FC_SUBTYPE_AUTH 11 /* authentication */
798 #define FC_SUBTYPE_DEAUTH 12 /* de-authentication */
799 #define FC_SUBTYPE_ACTION 13 /* action */
800 #define FC_SUBTYPE_ACTION_NOACK 14 /* action no-ack */
802 /* Control Subtypes */
803 #define FC_SUBTYPE_CTL_WRAPPER 7 /* Control Wrapper */
804 #define FC_SUBTYPE_BLOCKACK_REQ 8 /* Block Ack Req */
805 #define FC_SUBTYPE_BLOCKACK 9 /* Block Ack */
806 #define FC_SUBTYPE_PS_POLL 10 /* PS poll */
807 #define FC_SUBTYPE_RTS 11 /* RTS */
808 #define FC_SUBTYPE_CTS 12 /* CTS */
809 #define FC_SUBTYPE_ACK 13 /* ACK */
810 #define FC_SUBTYPE_CF_END 14 /* CF-END */
811 #define FC_SUBTYPE_CF_END_ACK 15 /* CF-END ACK */
813 /* Data Subtypes */
814 #define FC_SUBTYPE_DATA 0 /* Data */
815 #define FC_SUBTYPE_DATA_CF_ACK 1 /* Data + CF-ACK */
816 #define FC_SUBTYPE_DATA_CF_POLL 2 /* Data + CF-Poll */
817 #define FC_SUBTYPE_DATA_CF_ACK_POLL 3 /* Data + CF-Ack + CF-Poll */
818 #define FC_SUBTYPE_NULL 4 /* Null */
819 #define FC_SUBTYPE_CF_ACK 5 /* CF-Ack */
820 #define FC_SUBTYPE_CF_POLL 6 /* CF-Poll */
821 #define FC_SUBTYPE_CF_ACK_POLL 7 /* CF-Ack + CF-Poll */
822 #define FC_SUBTYPE_QOS_DATA 8 /* QoS Data */
823 #define FC_SUBTYPE_QOS_DATA_CF_ACK 9 /* QoS Data + CF-Ack */
824 #define FC_SUBTYPE_QOS_DATA_CF_POLL 10 /* QoS Data + CF-Poll */
825 #define FC_SUBTYPE_QOS_DATA_CF_ACK_POLL 11 /* QoS Data + CF-Ack + CF-Poll */
826 #define FC_SUBTYPE_QOS_NULL 12 /* QoS Null */
827 #define FC_SUBTYPE_QOS_CF_POLL 14 /* QoS CF-Poll */
828 #define FC_SUBTYPE_QOS_CF_ACK_POLL 15 /* QoS CF-Ack + CF-Poll */
830 /* Data Subtype Groups */
831 #define FC_SUBTYPE_ANY_QOS(s) (((s) & 8) != 0)
832 #define FC_SUBTYPE_ANY_NULL(s) (((s) & 4) != 0)
833 #define FC_SUBTYPE_ANY_CF_POLL(s) (((s) & 2) != 0)
834 #define FC_SUBTYPE_ANY_CF_ACK(s) (((s) & 1) != 0)
836 /* Type/Subtype Combos */
837 #define FC_KIND_MASK (FC_TYPE_MASK | FC_SUBTYPE_MASK) /* FC kind mask */
839 #define FC_KIND(t, s) (((t) << FC_TYPE_SHIFT) | ((s) << FC_SUBTYPE_SHIFT)) /* FC kind */
841 #define FC_SUBTYPE(fc) (((fc) & FC_SUBTYPE_MASK) >> FC_SUBTYPE_SHIFT) /* Subtype from FC */
842 #define FC_TYPE(fc) (((fc) & FC_TYPE_MASK) >> FC_TYPE_SHIFT) /* Type from FC */
844 #define FC_ASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_REQ) /* assoc. request */
845 #define FC_ASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ASSOC_RESP) /* assoc. response */
846 #define FC_REASSOC_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_REQ) /* reassoc. request */
847 #define FC_REASSOC_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_REASSOC_RESP) /* reassoc. response */
848 #define FC_PROBE_REQ FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_REQ) /* probe request */
849 #define FC_PROBE_RESP FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_PROBE_RESP) /* probe response */
850 #define FC_BEACON FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_BEACON) /* beacon */
851 #define FC_DISASSOC FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DISASSOC) /* disassoc */
852 #define FC_AUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_AUTH) /* authentication */
853 #define FC_DEAUTH FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_DEAUTH) /* deauthentication */
854 #define FC_ACTION FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION) /* action */
855 #define FC_ACTION_NOACK FC_KIND(FC_TYPE_MNG, FC_SUBTYPE_ACTION_NOACK) /* action no-ack */
857 #define FC_CTL_WRAPPER FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTL_WRAPPER) /* Control Wrapper */
858 #define FC_BLOCKACK_REQ FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK_REQ) /* Block Ack Req */
859 #define FC_BLOCKACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_BLOCKACK) /* Block Ack */
860 #define FC_PS_POLL FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_PS_POLL) /* PS poll */
861 #define FC_RTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_RTS) /* RTS */
862 #define FC_CTS FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CTS) /* CTS */
863 #define FC_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_ACK) /* ACK */
864 #define FC_CF_END FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END) /* CF-END */
865 #define FC_CF_END_ACK FC_KIND(FC_TYPE_CTL, FC_SUBTYPE_CF_END_ACK) /* CF-END ACK */
867 #define FC_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA) /* data */
868 #define FC_NULL_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_NULL) /* null data */
869 #define FC_DATA_CF_ACK FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_DATA_CF_ACK) /* data CF ACK */
870 #define FC_QOS_DATA FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_DATA) /* QoS data */
871 #define FC_QOS_NULL FC_KIND(FC_TYPE_DATA, FC_SUBTYPE_QOS_NULL) /* QoS null */
873 /* QoS Control Field */
875 /* 802.1D Priority */
876 #define QOS_PRIO_SHIFT 0 /* QoS priority shift */
877 #define QOS_PRIO_MASK 0x0007 /* QoS priority mask */
878 #define QOS_PRIO(qos) (((qos) & QOS_PRIO_MASK) >> QOS_PRIO_SHIFT) /* QoS priority */
880 /* Traffic Identifier */
881 #define QOS_TID_SHIFT 0 /* QoS TID shift */
882 #define QOS_TID_MASK 0x000f /* QoS TID mask */
883 #define QOS_TID(qos) (((qos) & QOS_TID_MASK) >> QOS_TID_SHIFT) /* QoS TID */
885 /* End of Service Period (U-APSD) */
886 #define QOS_EOSP_SHIFT 4 /* QoS End of Service Period shift */
887 #define QOS_EOSP_MASK 0x0010 /* QoS End of Service Period mask */
888 #define QOS_EOSP(qos) (((qos) & QOS_EOSP_MASK) >> QOS_EOSP_SHIFT) /* Qos EOSP */
890 /* Ack Policy */
891 #define QOS_ACK_NORMAL_ACK 0 /* Normal Ack */
892 #define QOS_ACK_NO_ACK 1 /* No Ack (eg mcast) */
893 #define QOS_ACK_NO_EXP_ACK 2 /* No Explicit Ack */
894 #define QOS_ACK_BLOCK_ACK 3 /* Block Ack */
895 #define QOS_ACK_SHIFT 5 /* QoS ACK shift */
896 #define QOS_ACK_MASK 0x0060 /* QoS ACK mask */
897 #define QOS_ACK(qos) (((qos) & QOS_ACK_MASK) >> QOS_ACK_SHIFT) /* QoS ACK */
899 /* A-MSDU flag */
900 #define QOS_AMSDU_SHIFT 7 /* AMSDU shift */
901 #define QOS_AMSDU_MASK 0x0080 /* AMSDU mask */
903 /* Management Frames */
905 /* Management Frame Constants */
907 /* Fixed fields */
908 #define DOT11_MNG_AUTH_ALGO_LEN 2 /* d11 management auth. algo. length */
909 #define DOT11_MNG_AUTH_SEQ_LEN 2 /* d11 management auth. seq. length */
910 #define DOT11_MNG_BEACON_INT_LEN 2 /* d11 management beacon interval length */
911 #define DOT11_MNG_CAP_LEN 2 /* d11 management cap. length */
912 #define DOT11_MNG_AP_ADDR_LEN 6 /* d11 management AP address length */
913 #define DOT11_MNG_LISTEN_INT_LEN 2 /* d11 management listen interval length */
914 #define DOT11_MNG_REASON_LEN 2 /* d11 management reason length */
915 #define DOT11_MNG_AID_LEN 2 /* d11 management AID length */
916 #define DOT11_MNG_STATUS_LEN 2 /* d11 management status length */
917 #define DOT11_MNG_TIMESTAMP_LEN 8 /* d11 management timestamp length */
919 /* DUR/ID field in assoc resp is 0xc000 | AID */
920 #define DOT11_AID_MASK 0x3fff /* d11 AID mask */
922 /* Reason Codes */
923 #define DOT11_RC_RESERVED 0 /* d11 RC reserved */
924 #define DOT11_RC_UNSPECIFIED 1 /* Unspecified reason */
925 #define DOT11_RC_AUTH_INVAL 2 /* Previous authentication no longer valid */
926 #define DOT11_RC_DEAUTH_LEAVING 3 /* Deauthenticated because sending station
927 * is leaving (or has left) IBSS or ESS
929 #define DOT11_RC_INACTIVITY 4 /* Disassociated due to inactivity */
930 #define DOT11_RC_BUSY 5 /* Disassociated because AP is unable to handle
931 * all currently associated stations
933 #define DOT11_RC_INVAL_CLASS_2 6 /* Class 2 frame received from
934 * nonauthenticated station
936 #define DOT11_RC_INVAL_CLASS_3 7 /* Class 3 frame received from
937 * nonassociated station
939 #define DOT11_RC_DISASSOC_LEAVING 8 /* Disassociated because sending station is
940 * leaving (or has left) BSS
942 #define DOT11_RC_NOT_AUTH 9 /* Station requesting (re)association is not
943 * authenticated with responding station
945 #define DOT11_RC_BAD_PC 10 /* Unacceptable power capability element */
946 #define DOT11_RC_BAD_CHANNELS 11 /* Unacceptable supported channels element */
947 /* 12 is unused */
949 /* 32-39 are QSTA specific reasons added in 11e */
950 #define DOT11_RC_UNSPECIFIED_QOS 32 /* unspecified QoS-related reason */
951 #define DOT11_RC_INSUFFCIENT_BW 33 /* QAP lacks sufficient bandwidth */
952 #define DOT11_RC_EXCESSIVE_FRAMES 34 /* excessive number of frames need ack */
953 #define DOT11_RC_TX_OUTSIDE_TXOP 35 /* transmitting outside the limits of txop */
954 #define DOT11_RC_LEAVING_QBSS 36 /* QSTA is leaving the QBSS (or restting) */
955 #define DOT11_RC_BAD_MECHANISM 37 /* does not want to use the mechanism */
956 #define DOT11_RC_SETUP_NEEDED 38 /* mechanism needs a setup */
957 #define DOT11_RC_TIMEOUT 39 /* timeout */
959 #define DOT11_RC_MAX 23 /* Reason codes > 23 are reserved */
961 /* Status Codes */
962 #define DOT11_SC_SUCCESS 0 /* Successful */
963 #define DOT11_SC_FAILURE 1 /* Unspecified failure */
964 #define DOT11_SC_CAP_MISMATCH 10 /* Cannot support all requested
965 * capabilities in the Capability
966 * Information field
968 #define DOT11_SC_REASSOC_FAIL 11 /* Reassociation denied due to inability
969 * to confirm that association exists
971 #define DOT11_SC_ASSOC_FAIL 12 /* Association denied due to reason
972 * outside the scope of this standard
974 #define DOT11_SC_AUTH_MISMATCH 13 /* Responding station does not support
975 * the specified authentication
976 * algorithm
978 #define DOT11_SC_AUTH_SEQ 14 /* Received an Authentication frame
979 * with authentication transaction
980 * sequence number out of expected
981 * sequence
983 #define DOT11_SC_AUTH_CHALLENGE_FAIL 15 /* Authentication rejected because of
984 * challenge failure
986 #define DOT11_SC_AUTH_TIMEOUT 16 /* Authentication rejected due to timeout
987 * waiting for next frame in sequence
989 #define DOT11_SC_ASSOC_BUSY_FAIL 17 /* Association denied because AP is
990 * unable to handle additional
991 * associated stations
993 #define DOT11_SC_ASSOC_RATE_MISMATCH 18 /* Association denied due to requesting
994 * station not supporting all of the
995 * data rates in the BSSBasicRateSet
996 * parameter
998 #define DOT11_SC_ASSOC_SHORT_REQUIRED 19 /* Association denied due to requesting
999 * station not supporting the Short
1000 * Preamble option
1002 #define DOT11_SC_ASSOC_PBCC_REQUIRED 20 /* Association denied due to requesting
1003 * station not supporting the PBCC
1004 * Modulation option
1006 #define DOT11_SC_ASSOC_AGILITY_REQUIRED 21 /* Association denied due to requesting
1007 * station not supporting the Channel
1008 * Agility option
1010 #define DOT11_SC_ASSOC_SPECTRUM_REQUIRED 22 /* Association denied because Spectrum
1011 * Management capability is required.
1013 #define DOT11_SC_ASSOC_BAD_POWER_CAP 23 /* Association denied because the info
1014 * in the Power Cap element is
1015 * unacceptable.
1017 #define DOT11_SC_ASSOC_BAD_SUP_CHANNELS 24 /* Association denied because the info
1018 * in the Supported Channel element is
1019 * unacceptable
1021 #define DOT11_SC_ASSOC_SHORTSLOT_REQUIRED 25 /* Association denied due to requesting
1022 * station not supporting the Short Slot
1023 * Time option
1025 #define DOT11_SC_ASSOC_ERPBCC_REQUIRED 26 /* Association denied due to requesting
1026 * station not supporting the ER-PBCC
1027 * Modulation option
1029 #define DOT11_SC_ASSOC_DSSOFDM_REQUIRED 27 /* Association denied due to requesting
1030 * station not supporting the DSS-OFDM
1031 * option
1033 #define DOT11_SC_ASSOC_R0KH_UNREACHABLE 28 /* Association denied due to AP
1034 * being unable to reach the R0 Key Holder
1036 #define DOT11_SC_ASSOC_TRY_LATER 30 /* Association denied temporarily, try again later
1038 #define DOT11_SC_ASSOC_MFP_VIOLATION 31 /* Association denied due to Robust Management
1039 * frame policy violation
1042 #define DOT11_SC_DECLINED 37 /* request declined */
1043 #define DOT11_SC_INVALID_PARAMS 38 /* One or more params have invalid values */
1044 #define DOT11_SC_INVALID_AKMP 43 /* Association denied due to invalid AKMP */
1045 #define DOT11_SC_INVALID_PMKID 53 /* Association denied due to invalid PMKID */
1046 #define DOT11_SC_INVALID_MDID 54 /* Association denied due to invalid MDID */
1047 #define DOT11_SC_INVALID_FTIE 55 /* Association denied due to invalid FTIE */
1049 /* Info Elts, length of INFORMATION portion of Info Elts */
1050 #define DOT11_MNG_DS_PARAM_LEN 1 /* d11 management DS parameter length */
1051 #define DOT11_MNG_IBSS_PARAM_LEN 2 /* d11 management IBSS parameter length */
1053 /* TIM Info element has 3 bytes fixed info in INFORMATION field,
1054 * followed by 1 to 251 bytes of Partial Virtual Bitmap
1056 #define DOT11_MNG_TIM_FIXED_LEN 3 /* d11 management TIM fixed length */
1057 #define DOT11_MNG_TIM_DTIM_COUNT 0 /* d11 management DTIM count */
1058 #define DOT11_MNG_TIM_DTIM_PERIOD 1 /* d11 management DTIM period */
1059 #define DOT11_MNG_TIM_BITMAP_CTL 2 /* d11 management TIM BITMAP control */
1060 #define DOT11_MNG_TIM_PVB 3 /* d11 management TIM PVB */
1062 /* TLV defines */
1063 #define TLV_TAG_OFF 0 /* tag offset */
1064 #define TLV_LEN_OFF 1 /* length offset */
1065 #define TLV_HDR_LEN 2 /* header length */
1066 #define TLV_BODY_OFF 2 /* body offset */
1068 /* Management Frame Information Element IDs */
1069 #define DOT11_MNG_SSID_ID 0 /* d11 management SSID id */
1070 #define DOT11_MNG_RATES_ID 1 /* d11 management rates id */
1071 #define DOT11_MNG_FH_PARMS_ID 2 /* d11 management FH parameter id */
1072 #define DOT11_MNG_DS_PARMS_ID 3 /* d11 management DS parameter id */
1073 #define DOT11_MNG_CF_PARMS_ID 4 /* d11 management CF parameter id */
1074 #define DOT11_MNG_TIM_ID 5 /* d11 management TIM id */
1075 #define DOT11_MNG_IBSS_PARMS_ID 6 /* d11 management IBSS parameter id */
1076 #define DOT11_MNG_COUNTRY_ID 7 /* d11 management country id */
1077 #define DOT11_MNG_HOPPING_PARMS_ID 8 /* d11 management hopping parameter id */
1078 #define DOT11_MNG_HOPPING_TABLE_ID 9 /* d11 management hopping table id */
1079 #define DOT11_MNG_REQUEST_ID 10 /* d11 management request id */
1080 #define DOT11_MNG_QBSS_LOAD_ID 11 /* d11 management QBSS Load id */
1081 #define DOT11_MNG_EDCA_PARAM_ID 12 /* 11E EDCA Parameter id */
1082 #define DOT11_MNG_CHALLENGE_ID 16 /* d11 management chanllenge id */
1083 #define DOT11_MNG_PWR_CONSTRAINT_ID 32 /* 11H PowerConstraint */
1084 #define DOT11_MNG_PWR_CAP_ID 33 /* 11H PowerCapability */
1085 #define DOT11_MNG_TPC_REQUEST_ID 34 /* 11H TPC Request */
1086 #define DOT11_MNG_TPC_REPORT_ID 35 /* 11H TPC Report */
1087 #define DOT11_MNG_SUPP_CHANNELS_ID 36 /* 11H Supported Channels */
1088 #define DOT11_MNG_CHANNEL_SWITCH_ID 37 /* 11H ChannelSwitch Announcement */
1089 #define DOT11_MNG_MEASURE_REQUEST_ID 38 /* 11H MeasurementRequest */
1090 #define DOT11_MNG_MEASURE_REPORT_ID 39 /* 11H MeasurementReport */
1091 #define DOT11_MNG_QUIET_ID 40 /* 11H Quiet */
1092 #define DOT11_MNG_IBSS_DFS_ID 41 /* 11H IBSS_DFS */
1093 #define DOT11_MNG_ERP_ID 42 /* d11 management ERP id */
1094 #define DOT11_MNG_TS_DELAY_ID 43 /* d11 management TS Delay id */
1095 #define DOT11_MNG_HT_CAP 45 /* d11 mgmt HT cap id */
1096 #define DOT11_MNG_QOS_CAP_ID 46 /* 11E QoS Capability id */
1097 #define DOT11_MNG_NONERP_ID 47 /* d11 management NON-ERP id */
1098 #define DOT11_MNG_RSN_ID 48 /* d11 management RSN id */
1099 #define DOT11_MNG_EXT_RATES_ID 50 /* d11 management ext. rates id */
1100 #define DOT11_MNG_AP_CHREP_ID 51 /* 11k AP Channel report id */
1101 #define DOT11_MNG_NBR_REP_ID 52 /* 11k Neighbor report id */
1102 #define DOT11_MNG_MDIE_ID 54 /* 11r Mobility domain id */
1103 #define DOT11_MNG_FTIE_ID 55 /* 11r Fast Bss Transition id */
1104 #define DOT11_MNG_FT_TI_ID 56 /* 11r Timeout Interval id */
1105 #define DOT11_MNG_REGCLASS_ID 59 /* d11 management regulatory class id */
1106 #define DOT11_MNG_EXT_CSA_ID 60 /* d11 Extended CSA */
1107 #define DOT11_MNG_HT_ADD 61 /* d11 mgmt additional HT info */
1108 #define DOT11_MNG_EXT_CHANNEL_OFFSET 62 /* d11 mgmt ext channel offset */
1111 #define DOT11_MNG_TIME_ADVERTISE_ID 69 /* 11p time advertisement */
1112 #define DOT11_MNG_RRM_CAP_ID 70 /* 11k radio measurement capability */
1113 #define DOT11_MNG_HT_BSS_COEXINFO_ID 72 /* d11 mgmt OBSS Coexistence INFO */
1114 #define DOT11_MNG_HT_BSS_CHANNEL_REPORT_ID 73 /* d11 mgmt OBSS Intolerant Channel list */
1115 #define DOT11_MNG_HT_OBSS_ID 74 /* d11 mgmt OBSS HT info */
1116 #define DOT11_MNG_TIME_ZONE_ID 98 /* 11v time zone */
1117 #define DOT11_MNG_LINK_IDENTIFIER_ID 101 /* 11z TDLS Link Identifier IE */
1118 #define DOT11_MNG_WAKEUP_SCHEDULE_ID 102 /* 11z TDLS Wakeup Schedule IE */
1119 #define DOT11_MNG_CHANNEL_SWITCH_TIMING_ID 104 /* 11z TDLS Channel Switch Timing IE */
1120 #define DOT11_MNG_PTI_CONTROL_ID 105 /* 11z TDLS PTI Control IE */
1121 #define DOT11_MNG_PU_BUFFER_STATUS_ID 106 /* 11z TDLS PU Buffer Status IE */
1122 #define DOT11_MNG_INTERWORKING_ID 107 /* 11u interworking */
1123 #define DOT11_MNG_ADVERTISEMENT_ID 108 /* 11u advertisement protocol */
1124 #define DOT11_MNG_EXP_BW_REQ_ID 109 /* 11u expedited bandwith request */
1125 #define DOT11_MNG_QOS_MAP_ID 110 /* 11u QoS map set */
1126 #define DOT11_MNG_ROAM_CONSORT_ID 111 /* 11u roaming consortium */
1127 #define DOT11_MNG_EMERGCY_ALERT_ID 112 /* 11u emergency alert identifier */
1128 #define DOT11_MNG_EXT_CAP_ID 127 /* d11 mgmt ext capability */
1129 #define DOT11_MNG_WPA_ID 221 /* d11 management WPA id */
1130 #define DOT11_MNG_PROPR_ID 221 /* d11 management proprietary id */
1131 /* should start using this one instead of above two */
1132 #define DOT11_MNG_VS_ID 221 /* d11 management Vendor Specific IE */
1134 /* Rate element Basic flag and rate mask */
1135 #define DOT11_RATE_BASIC 0x80 /* flag for a Basic Rate */
1136 #define DOT11_RATE_MASK 0x7F /* mask for numeric part of rate */
1138 /* ERP info element bit values */
1139 #define DOT11_MNG_ERP_LEN 1 /* ERP is currently 1 byte long */
1140 #define DOT11_MNG_NONERP_PRESENT 0x01 /* NonERP (802.11b) STAs are present
1141 *in the BSS
1143 #define DOT11_MNG_USE_PROTECTION 0x02 /* Use protection mechanisms for
1144 *ERP-OFDM frames
1146 #define DOT11_MNG_BARKER_PREAMBLE 0x04 /* Short Preambles: 0 == allowed,
1147 * 1 == not allowed
1149 /* TS Delay element offset & size */
1150 #define DOT11_MGN_TS_DELAY_LEN 4 /* length of TS DELAY IE */
1151 #define TS_DELAY_FIELD_SIZE 4 /* TS DELAY field size */
1153 /* Capability Information Field */
1154 #define DOT11_CAP_ESS 0x0001 /* d11 cap. ESS */
1155 #define DOT11_CAP_IBSS 0x0002 /* d11 cap. IBSS */
1156 #define DOT11_CAP_POLLABLE 0x0004 /* d11 cap. pollable */
1157 #define DOT11_CAP_POLL_RQ 0x0008 /* d11 cap. poll request */
1158 #define DOT11_CAP_PRIVACY 0x0010 /* d11 cap. privacy */
1159 #define DOT11_CAP_SHORT 0x0020 /* d11 cap. short */
1160 #define DOT11_CAP_PBCC 0x0040 /* d11 cap. PBCC */
1161 #define DOT11_CAP_AGILITY 0x0080 /* d11 cap. agility */
1162 #define DOT11_CAP_SPECTRUM 0x0100 /* d11 cap. spectrum */
1163 #define DOT11_CAP_SHORTSLOT 0x0400 /* d11 cap. shortslot */
1164 #define DOT11_CAP_RRM 0x1000 /* d11 cap. 11k radio measurement */
1165 #define DOT11_CAP_CCK_OFDM 0x2000 /* d11 cap. CCK/OFDM */
1167 /* Extended capabilities IE bitfields */
1168 /* 20/40 BSS Coexistence Management support bit position */
1169 #define DOT11_EXT_CAP_OBSS_COEX_MGMT 0
1170 /* BSS Transition Management support bit position */
1171 #define DOT11_EXT_CAP_BSS_TRANSITION_MGMT 19
1172 /* Interworking support bit position */
1173 #define DOT11_EXT_CAP_IW 31
1176 * Action Frame Constants
1178 #define DOT11_ACTION_HDR_LEN 2 /* action frame category + action field */
1179 #define DOT11_ACTION_CAT_OFF 0 /* category offset */
1180 #define DOT11_ACTION_ACT_OFF 1 /* action offset */
1182 /* Action Category field (sec 7.3.1.11) */
1183 #define DOT11_ACTION_CAT_ERR_MASK 0x80 /* category error mask */
1184 #define DOT11_ACTION_CAT_MASK 0x7F /* category mask */
1185 #define DOT11_ACTION_CAT_SPECT_MNG 0 /* category spectrum management */
1186 #define DOT11_ACTION_CAT_QOS 1 /* category QoS */
1187 #define DOT11_ACTION_CAT_DLS 2 /* category DLS */
1188 #define DOT11_ACTION_CAT_BLOCKACK 3 /* category block ack */
1189 #define DOT11_ACTION_CAT_PUBLIC 4 /* category public */
1190 #define DOT11_ACTION_CAT_RRM 5 /* category radio measurements */
1191 #define DOT11_ACTION_CAT_FBT 6 /* category fast bss transition */
1192 #define DOT11_ACTION_CAT_HT 7 /* category for HT */
1193 #if defined(MFP) || defined(WLFBT) || defined(WLWNM)
1194 #define DOT11_ACTION_CAT_SA_QUERY 8 /* security association query */
1195 #define DOT11_ACTION_CAT_PDPA 9 /* protected dual of public action */
1196 #define DOT11_ACTION_CAT_BSSMGMT 10 /* category for BSS transition management */
1197 #define DOT11_ACTION_NOTIFICATION 17
1198 #define DOT11_ACTION_CAT_VSP 126 /* protected vendor specific */
1199 #endif /* MFP || WLFBT */
1200 #define DOT11_ACTION_NOTIFICATION 17
1201 #define DOT11_ACTION_CAT_VS 127 /* category Vendor Specific */
1203 /* Spectrum Management Action IDs (sec 7.4.1) */
1204 #define DOT11_SM_ACTION_M_REQ 0 /* d11 action measurement request */
1205 #define DOT11_SM_ACTION_M_REP 1 /* d11 action measurement response */
1206 #define DOT11_SM_ACTION_TPC_REQ 2 /* d11 action TPC request */
1207 #define DOT11_SM_ACTION_TPC_REP 3 /* d11 action TPC response */
1208 #define DOT11_SM_ACTION_CHANNEL_SWITCH 4 /* d11 action channel switch */
1209 #define DOT11_SM_ACTION_EXT_CSA 5 /* d11 extened CSA for 11n */
1211 /* HT action ids */
1212 #define DOT11_ACTION_ID_HT_CH_WIDTH 0 /* notify channel width action id */
1213 #define DOT11_ACTION_ID_HT_MIMO_PS 1 /* mimo ps action id */
1215 /* Public action ids */
1216 #define DOT11_PUB_ACTION_BSS_COEX_MNG 0 /* 20/40 Coexistence Management action id */
1217 #define DOT11_PUB_ACTION_CHANNEL_SWITCH 4 /* d11 action channel switch */
1219 /* Block Ack action types */
1220 #define DOT11_BA_ACTION_ADDBA_REQ 0 /* ADDBA Req action frame type */
1221 #define DOT11_BA_ACTION_ADDBA_RESP 1 /* ADDBA Resp action frame type */
1222 #define DOT11_BA_ACTION_DELBA 2 /* DELBA action frame type */
1224 /* ADDBA action parameters */
1225 #define DOT11_ADDBA_PARAM_AMSDU_SUP 0x0001 /* AMSDU supported under BA */
1226 #define DOT11_ADDBA_PARAM_POLICY_MASK 0x0002 /* policy mask(ack vs delayed) */
1227 #define DOT11_ADDBA_PARAM_POLICY_SHIFT 1 /* policy shift */
1228 #define DOT11_ADDBA_PARAM_TID_MASK 0x003c /* tid mask */
1229 #define DOT11_ADDBA_PARAM_TID_SHIFT 2 /* tid shift */
1230 #define DOT11_ADDBA_PARAM_BSIZE_MASK 0xffc0 /* buffer size mask */
1231 #define DOT11_ADDBA_PARAM_BSIZE_SHIFT 6 /* buffer size shift */
1233 #define DOT11_ADDBA_POLICY_DELAYED 0 /* delayed BA policy */
1234 #define DOT11_ADDBA_POLICY_IMMEDIATE 1 /* immediate BA policy */
1236 /* Fast Transition action types */
1237 #define DOT11_FT_ACTION_FT_RESERVED 0
1238 #define DOT11_FT_ACTION_FT_REQ 1 /* FBT request - for over-the-DS FBT */
1239 #define DOT11_FT_ACTION_FT_RES 2 /* FBT response - for over-the-DS FBT */
1240 #define DOT11_FT_ACTION_FT_CON 3 /* FBT confirm - for OTDS with RRP */
1241 #define DOT11_FT_ACTION_FT_ACK 4 /* FBT ack */
1244 /* Wireless Network Management (WNM) action types */
1245 #define DOT11_WNM_ACTION_EVENT_REQ 0
1246 #define DOT11_WNM_ACTION_EVENT_REP 1
1247 #define DOT11_WNM_ACTION_DIAG_REQ 2
1248 #define DOT11_WNM_ACTION_DIAG_REP 3
1249 #define DOT11_WNM_ACTION_LOC_CFG_REQ 4
1250 #define DOT11_WNM_ACTION_LOC_RFG_RESP 5
1251 #define DOT11_WNM_ACTION_BSS_TRANS_QURY 6
1252 #define DOT11_WNM_ACTION_BSS_TRANS_REQ 7
1253 #define DOT11_WNM_ACTION_BSS_TRANS_RESP 8
1254 #define DOT11_WNM_ACTION_FMS_REQ 9
1255 #define DOT11_WNM_ACTION_FMS_RESP 10
1256 #define DOT11_WNM_ACTION_COL_INTRFRNCE_REQ 11
1257 #define DOT11_WNM_ACTION_COL_INTRFRNCE_REP 12
1258 #define DOT11_WNM_ACTION_TFS_REQ 13
1259 #define DOT11_WNM_ACTION_TFS_RESP 14
1260 #define DOT11_WNM_ACTION_TFS_NOTIFY 15
1261 #define DOT11_WNM_ACTION_WNM_SLEEP_REQ 16
1262 #define DOT11_WNM_ACTION_WNM_SLEEP_RESP 17
1263 #define DOT11_WNM_ACTION_TIM_BCAST_REQ 18
1264 #define DOT11_WNM_ACTION_TIM_BCAST_RESP 19
1265 #define DOT11_WNM_ACTION_QOS_TRFC_CAP_UPD 20
1266 #define DOT11_WNM_ACTION_CHAN_USAGE_REQ 21
1267 #define DOT11_WNM_ACTION_CHAN_USAGE_RESP 22
1268 #define DOT11_WNM_ACTION_DMS_REQ 23
1269 #define DOT11_WNM_ACTION_DMS_RESP 24
1270 #define DOT11_WNM_ACTION_TMNG_MEASUR_REQ 25
1271 #define DOT11_WNM_ACTION_NOTFCTN_REQ 26
1272 #define DOT11_WNM_ACTION_NOTFCTN_RES 27
1275 /* BSS Management Transition Query frame header */
1276 BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_query {
1277 uint8 category; /* category of action frame (10) */
1278 uint8 action; /* WNM action: trans_query (6) */
1279 uint8 token; /* dialog token */
1280 uint8 reason; /* transition query reason */
1281 uint8 data[1]; /* Elements */
1282 } BWL_POST_PACKED_STRUCT;
1283 typedef struct dot11_bss_trans_query dot11_bss_trans_query_t;
1284 #define DOT11_BSS_TRANS_QUERY_LEN 4 /* Fixed length */
1286 /* BSS Management Transition Request frame header */
1287 BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_req {
1288 uint8 category; /* category of action frame (10) */
1289 uint8 action; /* WNM action: trans_req (7) */
1290 uint8 token; /* dialog token */
1291 uint8 reqmode; /* transition request mode */
1292 uint16 disassoc_tmr; /* disassociation timer */
1293 uint8 validity_intrvl; /* validity interval */
1294 uint8 data[1]; /* optional: BSS term duration, ... */
1295 /* ...session info URL, list */
1296 } BWL_POST_PACKED_STRUCT;
1297 typedef struct dot11_bss_trans_req dot11_bss_trans_req_t;
1298 #define DOT11_BSS_TRANS_REQ_LEN 7 /* Fixed length */
1300 #define DOT11_BSS_TERM_DUR_LEN 12 /* Fixed length if present */
1303 /* BSS Mgmt Transition Request Mode Field - 802.11v */
1304 #define DOT11_BSS_TRNS_REQMODE_PREF_LIST_INCL 0x01
1305 #define DOT11_BSS_TRNS_REQMODE_ABRIDGED 0x02
1306 #define DOT11_BSS_TRNS_REQMODE_DISASSOC_IMMINENT 0x04
1307 #define DOT11_BSS_TRNS_REQMODE_BSS_TERM_INCL 0x08
1308 #define DOT11_BSS_TRNS_REQMODE_ESS_DISASSOC_IMNT 0x10
1311 /* BSS Management transition response frame header */
1312 BWL_PRE_PACKED_STRUCT struct dot11_bss_trans_res {
1313 uint8 category; /* category of action frame (10) */
1314 uint8 action; /* WNM action: trans_res (8) */
1315 uint8 token; /* dialog token */
1316 uint8 status; /* transition status */
1317 uint8 term_delay; /* validity interval */
1318 uint8 data[1]; /* optional: BSS term duration, ... */
1319 /* ...session info URL, list */
1320 } BWL_POST_PACKED_STRUCT;
1321 typedef struct dot11_bss_trans_res dot11_bss_trans_res_t;
1322 #define DOT11_BSS_TRANS_RES_LEN 5 /* Fixed length */
1324 /* BSS Mgmt Transition Response Status Field */
1325 #define DOT11_BSS_TRNS_RES_STATUS_ACCEPT 0
1326 #define DOT11_BSS_TRNS_RES_STATUS_REJECT 1
1327 #define DOT11_BSS_TRNS_RES_STATUS_REJ_INSUFF_BCN 2
1328 #define DOT11_BSS_TRNS_RES_STATUS_REJ_INSUFF_CAP 3
1329 #define DOT11_BSS_TRNS_RES_STATUS_REJ_TERM_UNDESIRED 4
1330 #define DOT11_BSS_TRNS_RES_STATUS_REJ_TERM_DELAY_REQ 5
1331 #define DOT11_BSS_TRNS_RES_STATUS_REJ_BSS_LIST_PROVIDED 6
1332 #define DOT11_BSS_TRNS_RES_STATUS_REJ_NO_SUITABLE_BSS 7
1333 #define DOT11_BSS_TRNS_RES_STATUS_REJ_LEAVING_ESS 8
1336 /* Neighbor Report BSSID Information Field */
1337 #define DOT11_NBR_RPRT_BSSID_INFO_REACHABILTY 0x0003
1338 #define DOT11_NBR_RPRT_BSSID_INFO_SEC 0x0004
1339 #define DOT11_NBR_RPRT_BSSID_INFO_KEY_SCOPE 0x0008
1340 #define DOT11_NBR_RPRT_BSSID_INFO_CAP 0x03f0
1342 #define DOT11_NBR_RPRT_BSSID_INFO_CAP_SPEC_MGMT 0x0010
1343 #define DOT11_NBR_RPRT_BSSID_INFO_CAP_QOS 0x0020
1344 #define DOT11_NBR_RPRT_BSSID_INFO_CAP_APSD 0x0040
1345 #define DOT11_NBR_RPRT_BSSID_INFO_CAP_RDIO_MSMT 0x0080
1346 #define DOT11_NBR_RPRT_BSSID_INFO_CAP_DEL_BA 0x0100
1347 #define DOT11_NBR_RPRT_BSSID_INFO_CAP_IMM_BA 0x0200
1349 /* Neighbor Report Subelements */
1350 #define DOT11_NBR_RPRT_SUBELEM_BSS_CANDDT_PREF_ID 3
1353 BWL_PRE_PACKED_STRUCT struct dot11_addba_req {
1354 uint8 category; /* category of action frame (3) */
1355 uint8 action; /* action: addba req */
1356 uint8 token; /* identifier */
1357 uint16 addba_param_set; /* parameter set */
1358 uint16 timeout; /* timeout in seconds */
1359 uint16 start_seqnum; /* starting sequence number */
1360 } BWL_POST_PACKED_STRUCT;
1361 typedef struct dot11_addba_req dot11_addba_req_t;
1362 #define DOT11_ADDBA_REQ_LEN 9 /* length of addba req frame */
1364 BWL_PRE_PACKED_STRUCT struct dot11_addba_resp {
1365 uint8 category; /* category of action frame (3) */
1366 uint8 action; /* action: addba resp */
1367 uint8 token; /* identifier */
1368 uint16 status; /* status of add request */
1369 uint16 addba_param_set; /* negotiated parameter set */
1370 uint16 timeout; /* negotiated timeout in seconds */
1371 } BWL_POST_PACKED_STRUCT;
1372 typedef struct dot11_addba_resp dot11_addba_resp_t;
1373 #define DOT11_ADDBA_RESP_LEN 9 /* length of addba resp frame */
1375 /* DELBA action parameters */
1376 #define DOT11_DELBA_PARAM_INIT_MASK 0x0800 /* initiator mask */
1377 #define DOT11_DELBA_PARAM_INIT_SHIFT 11 /* initiator shift */
1378 #define DOT11_DELBA_PARAM_TID_MASK 0xf000 /* tid mask */
1379 #define DOT11_DELBA_PARAM_TID_SHIFT 12 /* tid shift */
1381 BWL_PRE_PACKED_STRUCT struct dot11_delba {
1382 uint8 category; /* category of action frame (3) */
1383 uint8 action; /* action: addba req */
1384 uint16 delba_param_set; /* paarmeter set */
1385 uint16 reason; /* reason for dellba */
1386 } BWL_POST_PACKED_STRUCT;
1387 typedef struct dot11_delba dot11_delba_t;
1388 #define DOT11_DELBA_LEN 6 /* length of delba frame */
1390 /* SA Query action field value */
1391 #define SA_QUERY_REQUEST 0
1392 #define SA_QUERY_RESPONSE 1
1394 /* ************* 802.11r related definitions. ************* */
1396 /* Over-the-DS Fast Transition Request frame header */
1397 BWL_PRE_PACKED_STRUCT struct dot11_ft_req {
1398 uint8 category; /* category of action frame (6) */
1399 uint8 action; /* action: ft req */
1400 uint8 sta_addr[ETHER_ADDR_LEN];
1401 uint8 tgt_ap_addr[ETHER_ADDR_LEN];
1402 uint8 data[1]; /* Elements */
1403 } BWL_POST_PACKED_STRUCT;
1404 typedef struct dot11_ft_req dot11_ft_req_t;
1405 #define DOT11_FT_REQ_FIXED_LEN 14
1407 /* Over-the-DS Fast Transition Response frame header */
1408 BWL_PRE_PACKED_STRUCT struct dot11_ft_res {
1409 uint8 category; /* category of action frame (6) */
1410 uint8 action; /* action: ft resp */
1411 uint8 sta_addr[ETHER_ADDR_LEN];
1412 uint8 tgt_ap_addr[ETHER_ADDR_LEN];
1413 uint16 status; /* status code */
1414 uint8 data[1]; /* Elements */
1415 } BWL_POST_PACKED_STRUCT;
1416 typedef struct dot11_ft_res dot11_ft_res_t;
1417 #define DOT11_FT_RES_FIXED_LEN 16
1420 /* ************* 802.11k related definitions. ************* */
1422 /* Radio measurements enabled capability ie */
1424 #define DOT11_RRM_CAP_LEN 5 /* length of rrm cap bitmap */
1425 BWL_PRE_PACKED_STRUCT struct dot11_rrm_cap_ie {
1426 uint8 cap[DOT11_RRM_CAP_LEN];
1427 } BWL_POST_PACKED_STRUCT;
1428 typedef struct dot11_rrm_cap_ie dot11_rrm_cap_ie_t;
1430 /* Bitmap definitions for cap ie */
1431 #define DOT11_RRM_CAP_LINK 0
1432 #define DOT11_RRM_CAP_NEIGHBOR_REPORT 1
1433 #define DOT11_RRM_CAP_PARALLEL 2
1434 #define DOT11_RRM_CAP_REPEATED 3
1435 #define DOT11_RRM_CAP_BCN_PASSIVE 4
1436 #define DOT11_RRM_CAP_BCN_ACTIVE 5
1437 #define DOT11_RRM_CAP_BCN_TABLE 6
1438 #define DOT11_RRM_CAP_BCN_REP_COND 7
1439 #define DOT11_RRM_CAP_AP_CHANREP 16
1442 /* Operating Class (formerly "Regulatory Class") definitions */
1443 #define DOT11_OP_CLASS_NONE 255
1446 /* Radio Measurements action ids */
1447 #define DOT11_RM_ACTION_RM_REQ 0 /* Radio measurement request */
1448 #define DOT11_RM_ACTION_RM_REP 1 /* Radio measurement report */
1449 #define DOT11_RM_ACTION_LM_REQ 2 /* Link measurement request */
1450 #define DOT11_RM_ACTION_LM_REP 3 /* Link measurement report */
1451 #define DOT11_RM_ACTION_NR_REQ 4 /* Neighbor report request */
1452 #define DOT11_RM_ACTION_NR_REP 5 /* Neighbor report response */
1454 /* Generic radio measurement action frame header */
1455 BWL_PRE_PACKED_STRUCT struct dot11_rm_action {
1456 uint8 category; /* category of action frame (5) */
1457 uint8 action; /* radio measurement action */
1458 uint8 token; /* dialog token */
1459 uint8 data[1];
1460 } BWL_POST_PACKED_STRUCT;
1461 typedef struct dot11_rm_action dot11_rm_action_t;
1462 #define DOT11_RM_ACTION_LEN 3
1464 BWL_PRE_PACKED_STRUCT struct dot11_rmreq {
1465 uint8 category; /* category of action frame (5) */
1466 uint8 action; /* radio measurement action */
1467 uint8 token; /* dialog token */
1468 uint16 reps; /* no. of repetitions */
1469 } BWL_POST_PACKED_STRUCT;
1470 typedef struct dot11_rmreq dot11_rmreq_t;
1471 #define DOT11_RMREQ_LEN 5
1473 BWL_PRE_PACKED_STRUCT struct dot11_rm_ie {
1474 uint8 id;
1475 uint8 len;
1476 uint8 token;
1477 uint8 mode;
1478 uint8 type;
1479 } BWL_POST_PACKED_STRUCT;
1480 typedef struct dot11_rm_ie dot11_rm_ie_t;
1481 #define DOT11_RM_IE_LEN 5
1483 /* Definitions for "mode" bits in rm req */
1484 #define DOT11_RMREQ_MODE_PARALLEL 1
1485 #define DOT11_RMREQ_MODE_ENABLE 2
1486 #define DOT11_RMREQ_MODE_REQUEST 4
1487 #define DOT11_RMREQ_MODE_REPORT 8
1488 #define DOT11_RMREQ_MODE_DURMAND 0x10 /* Duration Mandatory */
1490 /* Definitions for "mode" bits in rm rep */
1491 #define DOT11_RMREP_MODE_LATE 1
1492 #define DOT11_RMREP_MODE_INCAPABLE 2
1493 #define DOT11_RMREP_MODE_REFUSED 4
1495 BWL_PRE_PACKED_STRUCT struct dot11_rmreq_bcn {
1496 uint8 id;
1497 uint8 len;
1498 uint8 token;
1499 uint8 mode;
1500 uint8 type;
1501 uint8 reg;
1502 uint8 channel;
1503 uint16 interval;
1504 uint16 duration;
1505 uint8 bcn_mode;
1506 struct ether_addr bssid;
1507 } BWL_POST_PACKED_STRUCT;
1508 typedef struct dot11_rmreq_bcn dot11_rmreq_bcn_t;
1509 #define DOT11_RMREQ_BCN_LEN 18
1511 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_bcn {
1512 uint8 reg;
1513 uint8 channel;
1514 uint32 starttime[2];
1515 uint16 duration;
1516 uint8 frame_info;
1517 uint8 rcpi;
1518 uint8 rsni;
1519 struct ether_addr bssid;
1520 uint8 antenna_id;
1521 uint32 parent_tsf;
1522 } BWL_POST_PACKED_STRUCT;
1523 typedef struct dot11_rmrep_bcn dot11_rmrep_bcn_t;
1524 #define DOT11_RMREP_BCN_LEN 26
1526 /* Beacon request measurement mode */
1527 #define DOT11_RMREQ_BCN_PASSIVE 0
1528 #define DOT11_RMREQ_BCN_ACTIVE 1
1529 #define DOT11_RMREQ_BCN_TABLE 2
1531 /* Sub-element IDs for Beacon Request */
1532 #define DOT11_RMREQ_BCN_SSID_ID 0
1533 #define DOT11_RMREQ_BCN_REPINFO_ID 1
1534 #define DOT11_RMREQ_BCN_REPDET_ID 2
1535 #define DOT11_RMREQ_BCN_REQUEST_ID 10
1536 #define DOT11_RMREQ_BCN_APCHREP_ID 51
1538 /* Reporting Detail element definition */
1539 #define DOT11_RMREQ_BCN_REPDET_FIXED 0 /* Fixed length fields only */
1540 #define DOT11_RMREQ_BCN_REPDET_REQUEST 1 /* + requested information elems */
1541 #define DOT11_RMREQ_BCN_REPDET_ALL 2 /* All fields */
1543 /* Sub-element IDs for Beacon Report */
1544 #define DOT11_RMREP_BCN_FRM_BODY 1
1546 /* Neighbor measurement report */
1547 BWL_PRE_PACKED_STRUCT struct dot11_rmrep_nbr {
1548 struct ether_addr bssid;
1549 uint32 bssid_info;
1550 uint8 reg;
1551 uint8 channel;
1552 uint8 phytype;
1553 uchar sub_elements[1]; /* Variable size data */
1554 } BWL_POST_PACKED_STRUCT;
1555 typedef struct dot11_rmrep_nbr dot11_rmrep_nbr_t;
1556 #define DOT11_RMREP_NBR_LEN 13
1558 /* MLME Enumerations */
1559 #define DOT11_BSSTYPE_INFRASTRUCTURE 0 /* d11 infrastructure */
1560 #define DOT11_BSSTYPE_INDEPENDENT 1 /* d11 independent */
1561 #define DOT11_BSSTYPE_ANY 2 /* d11 any BSS type */
1562 #define DOT11_SCANTYPE_ACTIVE 0 /* d11 scan active */
1563 #define DOT11_SCANTYPE_PASSIVE 1 /* d11 scan passive */
1565 /* Link Measurement */
1566 BWL_PRE_PACKED_STRUCT struct dot11_lmreq {
1567 uint8 category; /* category of action frame (5) */
1568 uint8 action; /* radio measurement action */
1569 uint8 token; /* dialog token */
1570 uint8 txpwr; /* Transmit Power Used */
1571 uint8 maxtxpwr; /* Max Transmit Power */
1572 } BWL_POST_PACKED_STRUCT;
1573 typedef struct dot11_lmreq dot11_lmreq_t;
1574 #define DOT11_LMREQ_LEN 5
1576 BWL_PRE_PACKED_STRUCT struct dot11_lmrep {
1577 uint8 category; /* category of action frame (5) */
1578 uint8 action; /* radio measurement action */
1579 uint8 token; /* dialog token */
1580 dot11_tpc_rep_t tpc; /* TPC element */
1581 uint8 rxant; /* Receive Antenna ID */
1582 uint8 txant; /* Transmit Antenna ID */
1583 uint8 rcpi; /* RCPI */
1584 uint8 rsni; /* RSNI */
1585 } BWL_POST_PACKED_STRUCT;
1586 typedef struct dot11_lmrep dot11_lmrep_t;
1587 #define DOT11_LMREP_LEN 11
1589 /* 802.11 BRCM "Compromise" Pre N constants */
1590 #define PREN_PREAMBLE 24 /* green field preamble time */
1591 #define PREN_MM_EXT 12 /* extra mixed mode preamble time */
1592 #define PREN_PREAMBLE_EXT 4 /* extra preamble (multiply by unique_streams-1) */
1594 /* 802.11N PHY constants */
1595 #define RIFS_11N_TIME 2 /* NPHY RIFS time */
1597 /* 802.11 A PHY constants */
1598 #define APHY_SLOT_TIME 9 /* APHY slot time */
1599 #define APHY_SIFS_TIME 16 /* APHY SIFS time */
1600 #define APHY_DIFS_TIME (APHY_SIFS_TIME + (2 * APHY_SLOT_TIME)) /* APHY DIFS time */
1601 #define APHY_PREAMBLE_TIME 16 /* APHY preamble time */
1602 #define APHY_SIGNAL_TIME 4 /* APHY signal time */
1603 #define APHY_SYMBOL_TIME 4 /* APHY symbol time */
1604 #define APHY_SERVICE_NBITS 16 /* APHY service nbits */
1605 #define APHY_TAIL_NBITS 6 /* APHY tail nbits */
1606 #define APHY_CWMIN 15 /* APHY cwmin */
1608 /* 802.11 B PHY constants */
1609 #define BPHY_SLOT_TIME 20 /* BPHY slot time */
1610 #define BPHY_SIFS_TIME 10 /* BPHY SIFS time */
1611 #define BPHY_DIFS_TIME 50 /* BPHY DIFS time */
1612 #define BPHY_PLCP_TIME 192 /* BPHY PLCP time */
1613 #define BPHY_PLCP_SHORT_TIME 96 /* BPHY PLCP short time */
1614 #define BPHY_CWMIN 31 /* BPHY cwmin */
1616 /* 802.11 G constants */
1617 #define DOT11_OFDM_SIGNAL_EXTENSION 6 /* d11 OFDM signal extension */
1619 #define PHY_CWMAX 1023 /* PHY cwmax */
1621 #define DOT11_MAXNUMFRAGS 16 /* max # fragments per MSDU */
1623 /* dot11Counters Table - 802.11 spec., Annex D */
1624 typedef struct d11cnt {
1625 uint32 txfrag; /* dot11TransmittedFragmentCount */
1626 uint32 txmulti; /* dot11MulticastTransmittedFrameCount */
1627 uint32 txfail; /* dot11FailedCount */
1628 uint32 txretry; /* dot11RetryCount */
1629 uint32 txretrie; /* dot11MultipleRetryCount */
1630 uint32 rxdup; /* dot11FrameduplicateCount */
1631 uint32 txrts; /* dot11RTSSuccessCount */
1632 uint32 txnocts; /* dot11RTSFailureCount */
1633 uint32 txnoack; /* dot11ACKFailureCount */
1634 uint32 rxfrag; /* dot11ReceivedFragmentCount */
1635 uint32 rxmulti; /* dot11MulticastReceivedFrameCount */
1636 uint32 rxcrc; /* dot11FCSErrorCount */
1637 uint32 txfrmsnt; /* dot11TransmittedFrameCount */
1638 uint32 rxundec; /* dot11WEPUndecryptableCount */
1639 } d11cnt_t;
1641 /* OUI for BRCM proprietary IE */
1642 #define BRCM_PROP_OUI "\x00\x90\x4C" /* Broadcom proprietary OUI */
1644 #ifndef LINUX_POSTMOGRIFY_REMOVAL
1645 /* The following BRCM_PROP_OUI types are currently in use (defined in
1646 * relevant subsections). Each of them will be in a separate proprietary(221) IE
1647 * #define SES_VNDR_IE_TYPE 1 (defined in src/ses/shared/ses.h)
1648 * #define DPT_IE_TYPE 2
1649 * #define HT_CAP_IE_TYPE 51
1650 * #define HT_ADD_IE_TYPE 52
1651 * #define BRCM_EXTCH_IE_TYPE 53
1654 /* Following is the generic structure for brcm_prop_ie (uses BRCM_PROP_OUI).
1655 * DPT uses this format with type set to DPT_IE_TYPE
1657 BWL_PRE_PACKED_STRUCT struct brcm_prop_ie_s {
1658 uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
1659 uint8 len; /* IE length */
1660 uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
1661 uint8 type; /* type of this IE */
1662 uint16 cap; /* DPT capabilities */
1663 } BWL_POST_PACKED_STRUCT;
1664 typedef struct brcm_prop_ie_s brcm_prop_ie_t;
1666 #define BRCM_PROP_IE_LEN 6 /* len of fixed part of brcm_prop ie */
1668 #define DPT_IE_TYPE 2
1669 #define WET_TUNNEL_IE_TYPE 3
1670 #endif /* LINUX_POSTMOGRIFY_REMOVAL */
1673 /* BRCM OUI: Used in the proprietary(221) IE in all broadcom devices */
1674 #define BRCM_OUI "\x00\x10\x18" /* Broadcom OUI */
1676 /* BRCM info element */
1677 BWL_PRE_PACKED_STRUCT struct brcm_ie {
1678 uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
1679 uint8 len; /* IE length */
1680 uint8 oui[3]; /* Proprietary OUI, BRCM_OUI */
1681 uint8 ver; /* type/ver of this IE */
1682 uint8 assoc; /* # of assoc STAs */
1683 uint8 flags; /* misc flags */
1684 uint8 flags1; /* misc flags */
1685 uint16 amsdu_mtu_pref; /* preferred A-MSDU MTU */
1686 } BWL_POST_PACKED_STRUCT;
1687 typedef struct brcm_ie brcm_ie_t;
1688 #define BRCM_IE_LEN 11 /* BRCM IE length */
1689 #define BRCM_IE_VER 2 /* BRCM IE version */
1690 #define BRCM_IE_LEGACY_AES_VER 1 /* BRCM IE legacy AES version */
1692 /* brcm_ie flags */
1693 #ifdef WLAFTERBURNER
1694 #define BRF_ABCAP 0x1 /* afterburner capable */
1695 #define BRF_ABRQRD 0x2 /* afterburner requested */
1696 #define BRF_ABCOUNTER_MASK 0xf0 /* afterburner wds "state" counter */
1697 #define BRF_ABCOUNTER_SHIFT 4 /* offset of afterburner wds "state" counter */
1698 #endif /* WLAFTERBURNER */
1699 #define BRF_LZWDS 0x4 /* lazy wds enabled */
1700 #define BRF_BLOCKACK 0x8 /* BlockACK capable */
1702 /* brcm_ie flags1 */
1703 #define BRF1_AMSDU 0x1 /* A-MSDU capable */
1704 #define BRF1_WMEPS 0x4 /* AP is capable of handling WME + PS w/o APSD */
1705 #define BRF1_PSOFIX 0x8 /* AP has fixed PS mode out-of-order packets */
1706 #define BRF1_RX_LARGE_AGG 0x10 /* device can rx large aggregates */
1707 #define BRF1_RFAWARE_DCS 0x20 /* RFAWARE dynamic channel selection (DCS) */
1709 #ifdef WLAFTERBURNER
1710 #define AB_WDS_TIMEOUT_MAX 15 /* AB wds Max count indicating not locally capable */
1711 #define AB_WDS_TIMEOUT_MIN 1 /* AB wds, use zero count as indicating "downrev" */
1712 #endif
1714 #define AB_GUARDCOUNT 10 /* seconds, time to swtich ab <--> 11n */
1716 /* Vendor IE structure */
1717 BWL_PRE_PACKED_STRUCT struct vndr_ie {
1718 uchar id;
1719 uchar len;
1720 uchar oui [3];
1721 uchar data [1]; /* Variable size data */
1722 } BWL_POST_PACKED_STRUCT;
1723 typedef struct vndr_ie vndr_ie_t;
1725 #define VNDR_IE_HDR_LEN 2 /* id + len field */
1726 #define VNDR_IE_MIN_LEN 3 /* size of the oui field */
1727 #define VNDR_IE_MAX_LEN 256 /* verdor IE max length */
1729 /* ************* HT definitions. ************* */
1730 #define MCSSET_LEN 16 /* 16-bits per 8-bit set to give 128-bits bitmap of MCS Index */
1731 #define MAX_MCS_NUM (128) /* max mcs number = 128 */
1733 BWL_PRE_PACKED_STRUCT struct ht_cap_ie {
1734 uint16 cap;
1735 uint8 params;
1736 uint8 supp_mcs[MCSSET_LEN];
1737 uint16 ext_htcap;
1738 uint32 txbf_cap;
1739 uint8 as_cap;
1740 } BWL_POST_PACKED_STRUCT;
1741 typedef struct ht_cap_ie ht_cap_ie_t;
1743 /* CAP IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
1744 /* the capability IE is primarily used to convey this nodes abilities */
1745 BWL_PRE_PACKED_STRUCT struct ht_prop_cap_ie {
1746 uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
1747 uint8 len; /* IE length */
1748 uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
1749 uint8 type; /* type inidicates what follows */
1750 ht_cap_ie_t cap_ie;
1751 } BWL_POST_PACKED_STRUCT;
1752 typedef struct ht_prop_cap_ie ht_prop_cap_ie_t;
1754 #define HT_PROP_IE_OVERHEAD 4 /* overhead bytes for prop oui ie */
1755 #define HT_CAP_IE_LEN 26 /* HT capability len (based on .11n d2.0) */
1756 #define HT_CAP_IE_TYPE 51
1758 #define HT_CAP_LDPC_CODING 0x0001 /* Support for rx of LDPC coded pkts */
1759 #define HT_CAP_40MHZ 0x0002 /* FALSE:20Mhz, TRUE:20/40MHZ supported */
1760 #define HT_CAP_MIMO_PS_MASK 0x000C /* Mimo PS mask */
1761 #define HT_CAP_MIMO_PS_SHIFT 0x0002 /* Mimo PS shift */
1762 #define HT_CAP_MIMO_PS_OFF 0x0003 /* Mimo PS, no restriction */
1763 #define HT_CAP_MIMO_PS_RTS 0x0001 /* Mimo PS, send RTS/CTS around MIMO frames */
1764 #define HT_CAP_MIMO_PS_ON 0x0000 /* Mimo PS, MIMO disallowed */
1765 #define HT_CAP_GF 0x0010 /* Greenfield preamble support */
1766 #define HT_CAP_SHORT_GI_20 0x0020 /* 20MHZ short guard interval support */
1767 #define HT_CAP_SHORT_GI_40 0x0040 /* 40Mhz short guard interval support */
1768 #define HT_CAP_TX_STBC 0x0080 /* Tx STBC support */
1769 #define HT_CAP_RX_STBC_MASK 0x0300 /* Rx STBC mask */
1770 #define HT_CAP_RX_STBC_SHIFT 8 /* Rx STBC shift */
1771 #define HT_CAP_DELAYED_BA 0x0400 /* delayed BA support */
1772 #define HT_CAP_MAX_AMSDU 0x0800 /* Max AMSDU size in bytes , 0=3839, 1=7935 */
1773 #define HT_CAP_DSSS_CCK 0x1000 /* DSSS/CCK supported by the BSS */
1774 #define HT_CAP_PSMP 0x2000 /* Power Save Multi Poll support */
1775 #define HT_CAP_40MHZ_INTOLERANT 0x4000 /* 40MHz Intolerant */
1776 #define HT_CAP_LSIG_TXOP 0x8000 /* L-SIG TXOP protection support */
1778 #define HT_CAP_RX_STBC_NO 0x0 /* no rx STBC support */
1779 #define HT_CAP_RX_STBC_ONE_STREAM 0x1 /* rx STBC support of 1 spatial stream */
1780 #define HT_CAP_RX_STBC_TWO_STREAM 0x2 /* rx STBC support of 1-2 spatial streams */
1781 #define HT_CAP_RX_STBC_THREE_STREAM 0x3 /* rx STBC support of 1-3 spatial streams */
1783 #define HT_MAX_AMSDU 7935 /* max amsdu size (bytes) per the HT spec */
1784 #define HT_MIN_AMSDU 3835 /* min amsdu size (bytes) per the HT spec */
1786 #define HT_PARAMS_RX_FACTOR_MASK 0x03 /* ampdu rcv factor mask */
1787 #define HT_PARAMS_DENSITY_MASK 0x1C /* ampdu density mask */
1788 #define HT_PARAMS_DENSITY_SHIFT 2 /* ampdu density shift */
1790 /* HT/AMPDU specific define */
1791 #define AMPDU_MAX_MPDU_DENSITY 7 /* max mpdu density; in 1/8 usec units */
1792 #define AMPDU_RX_FACTOR_8K 0 /* max rcv ampdu len (8kb) */
1793 #define AMPDU_RX_FACTOR_16K 1 /* max rcv ampdu len (16kb) */
1794 #define AMPDU_RX_FACTOR_32K 2 /* max rcv ampdu len (32kb) */
1795 #define AMPDU_RX_FACTOR_64K 3 /* max rcv ampdu len (64kb) */
1796 #define AMPDU_RX_FACTOR_BASE 8*1024 /* ampdu factor base for rx len */
1798 #define AMPDU_DELIMITER_LEN 4 /* length of ampdu delimiter */
1799 #define AMPDU_DELIMITER_LEN_MAX 63 /* max length of ampdu delimiter(enforced in HW) */
1801 BWL_PRE_PACKED_STRUCT struct ht_add_ie {
1802 uint8 ctl_ch; /* control channel number */
1803 uint8 byte1; /* ext ch,rec. ch. width, RIFS support */
1804 uint16 opmode; /* operation mode */
1805 uint16 misc_bits; /* misc bits */
1806 uint8 basic_mcs[MCSSET_LEN]; /* required MCS set */
1807 } BWL_POST_PACKED_STRUCT;
1808 typedef struct ht_add_ie ht_add_ie_t;
1810 /* ADD IE: HT 1.0 spec. simply stole a 802.11 IE, we use our prop. IE until this is resolved */
1811 /* the additional IE is primarily used to convey the current BSS configuration */
1812 BWL_PRE_PACKED_STRUCT struct ht_prop_add_ie {
1813 uint8 id; /* IE ID, 221, DOT11_MNG_PROPR_ID */
1814 uint8 len; /* IE length */
1815 uint8 oui[3]; /* Proprietary OUI, BRCM_PROP_OUI */
1816 uint8 type; /* indicates what follows */
1817 ht_add_ie_t add_ie;
1818 } BWL_POST_PACKED_STRUCT;
1819 typedef struct ht_prop_add_ie ht_prop_add_ie_t;
1821 #define HT_ADD_IE_LEN 22
1822 #define HT_ADD_IE_TYPE 52
1824 /* byte1 defn's */
1825 #define HT_BW_ANY 0x04 /* set, STA can use 20 or 40MHz */
1826 #define HT_RIFS_PERMITTED 0x08 /* RIFS allowed */
1828 /* opmode defn's */
1829 #define HT_OPMODE_MASK 0x0003 /* protection mode mask */
1830 #define HT_OPMODE_SHIFT 0 /* protection mode shift */
1831 #define HT_OPMODE_PURE 0x0000 /* protection mode PURE */
1832 #define HT_OPMODE_OPTIONAL 0x0001 /* protection mode optional */
1833 #define HT_OPMODE_HT20IN40 0x0002 /* protection mode 20MHz HT in 40MHz BSS */
1834 #define HT_OPMODE_MIXED 0x0003 /* protection mode Mixed Mode */
1835 #define HT_OPMODE_NONGF 0x0004 /* protection mode non-GF */
1836 #define DOT11N_TXBURST 0x0008 /* Tx burst limit */
1837 #define DOT11N_OBSS_NONHT 0x0010 /* OBSS Non-HT STA present */
1839 /* misc_bites defn's */
1840 #define HT_BASIC_STBC_MCS 0x007f /* basic STBC MCS */
1841 #define HT_DUAL_STBC_PROT 0x0080 /* Dual STBC Protection */
1842 #define HT_SECOND_BCN 0x0100 /* Secondary beacon support */
1843 #define HT_LSIG_TXOP 0x0200 /* L-SIG TXOP Protection full support */
1844 #define HT_PCO_ACTIVE 0x0400 /* PCO active */
1845 #define HT_PCO_PHASE 0x0800 /* PCO phase */
1847 /* Tx Burst Limits */
1848 #define DOT11N_2G_TXBURST_LIMIT 6160 /* 2G band Tx burst limit per 802.11n Draft 1.10 (usec) */
1849 #define DOT11N_5G_TXBURST_LIMIT 3080 /* 5G band Tx burst limit per 802.11n Draft 1.10 (usec) */
1851 /* Macros for opmode */
1852 #define GET_HT_OPMODE(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
1853 >> HT_OPMODE_SHIFT)
1854 #define HT_MIXEDMODE_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
1855 == HT_OPMODE_MIXED) /* mixed mode present */
1856 #define HT_HT20_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
1857 == HT_OPMODE_HT20IN40) /* 20MHz HT present */
1858 #define HT_OPTIONAL_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_MASK) \
1859 == HT_OPMODE_OPTIONAL) /* Optional protection present */
1860 #define HT_USE_PROTECTION(add_ie) (HT_HT20_PRESENT((add_ie)) || \
1861 HT_MIXEDMODE_PRESENT((add_ie))) /* use protection */
1862 #define HT_NONGF_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & HT_OPMODE_NONGF) \
1863 == HT_OPMODE_NONGF) /* non-GF present */
1864 #define DOT11N_TXBURST_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_TXBURST) \
1865 == DOT11N_TXBURST) /* Tx Burst present */
1866 #define DOT11N_OBSS_NONHT_PRESENT(add_ie) ((ltoh16_ua(&add_ie->opmode) & DOT11N_OBSS_NONHT) \
1867 == DOT11N_OBSS_NONHT) /* OBSS Non-HT present */
1869 BWL_PRE_PACKED_STRUCT struct obss_params {
1870 uint16 passive_dwell;
1871 uint16 active_dwell;
1872 uint16 bss_widthscan_interval;
1873 uint16 passive_total;
1874 uint16 active_total;
1875 uint16 chanwidth_transition_dly;
1876 uint16 activity_threshold;
1877 } BWL_POST_PACKED_STRUCT;
1878 typedef struct obss_params obss_params_t;
1880 BWL_PRE_PACKED_STRUCT struct dot11_obss_ie {
1881 uint8 id;
1882 uint8 len;
1883 obss_params_t obss_params;
1884 } BWL_POST_PACKED_STRUCT;
1885 typedef struct dot11_obss_ie dot11_obss_ie_t;
1886 #define DOT11_OBSS_SCAN_IE_LEN sizeof(obss_params_t) /* HT OBSS len (based on 802.11n d3.0) */
1888 /* HT control field */
1889 #define HT_CTRL_LA_TRQ 0x00000002 /* sounding request */
1890 #define HT_CTRL_LA_MAI 0x0000003C /* MCS request or antenna selection indication */
1891 #define HT_CTRL_LA_MAI_SHIFT 2
1892 #define HT_CTRL_LA_MAI_MRQ 0x00000004 /* MCS request */
1893 #define HT_CTRL_LA_MAI_MSI 0x00000038 /* MCS request sequence identifier */
1894 #define HT_CTRL_LA_MFSI 0x000001C0 /* MFB sequence identifier */
1895 #define HT_CTRL_LA_MFSI_SHIFT 6
1896 #define HT_CTRL_LA_MFB_ASELC 0x0000FE00 /* MCS feedback, antenna selection command/data */
1897 #define HT_CTRL_LA_MFB_ASELC_SH 9
1898 #define HT_CTRL_LA_ASELC_CMD 0x00000C00 /* ASEL command */
1899 #define HT_CTRL_LA_ASELC_DATA 0x0000F000 /* ASEL data */
1900 #define HT_CTRL_CAL_POS 0x00030000 /* Calibration position */
1901 #define HT_CTRL_CAL_SEQ 0x000C0000 /* Calibration sequence */
1902 #define HT_CTRL_CSI_STEERING 0x00C00000 /* CSI/Steering */
1903 #define HT_CTRL_CSI_STEER_SHIFT 22
1904 #define HT_CTRL_CSI_STEER_NFB 0 /* no fedback required */
1905 #define HT_CTRL_CSI_STEER_CSI 1 /* CSI, H matrix */
1906 #define HT_CTRL_CSI_STEER_NCOM 2 /* non-compressed beamforming */
1907 #define HT_CTRL_CSI_STEER_COM 3 /* compressed beamforming */
1908 #define HT_CTRL_NDP_ANNOUNCE 0x01000000 /* NDP announcement */
1909 #define HT_CTRL_AC_CONSTRAINT 0x40000000 /* AC Constraint */
1910 #define HT_CTRL_RDG_MOREPPDU 0x80000000 /* RDG/More PPDU */
1912 #define HT_OPMODE_OPTIONAL 0x0001 /* protection mode optional */
1913 #define HT_OPMODE_HT20IN40 0x0002 /* protection mode 20MHz HT in 40MHz BSS */
1914 #define HT_OPMODE_MIXED 0x0003 /* protection mode Mixed Mode */
1915 #define HT_OPMODE_NONGF 0x0004 /* protection mode non-GF */
1916 #define DOT11N_TXBURST 0x0008 /* Tx burst limit */
1917 #define DOT11N_OBSS_NONHT 0x0010 /* OBSS Non-HT STA present */
1920 /* ************* WPA definitions. ************* */
1921 #define WPA_OUI "\x00\x50\xF2" /* WPA OUI */
1922 #define WPA_OUI_LEN 3 /* WPA OUI length */
1923 #define WPA_OUI_TYPE 1
1924 #define WPA_VERSION 1 /* WPA version */
1925 #define WPA2_OUI "\x00\x0F\xAC" /* WPA2 OUI */
1926 #define WPA2_OUI_LEN 3 /* WPA2 OUI length */
1927 #define WPA2_VERSION 1 /* WPA2 version */
1928 #define WPA2_VERSION_LEN 2 /* WAP2 version length */
1930 /* ************* WPS definitions. ************* */
1931 #define WPS_OUI "\x00\x50\xF2" /* WPS OUI */
1932 #define WPS_OUI_LEN 3 /* WPS OUI length */
1933 #define WPS_OUI_TYPE 4
1935 /* ************* WFA definitions. ************* */
1936 #if defined(MACOSX) && !defined(WLP2P_NEW_WFA_OUI)
1937 #define WFA_OUI WPS_OUI /* WFA OUI */
1938 #else
1939 #define WFA_OUI "\x50\x6F\x9A" /* WFA OUI */
1940 #endif /* MACOSX && !WLP2P_NEW_WFA_OUI */
1941 #define WFA_OUI_LEN 3 /* WFA OUI length */
1942 #define WFA_OUI_TYPE_TPC 8
1943 #define WFA_OUI_TYPE_P2P 9
1945 /* RSN authenticated key managment suite */
1946 #define RSN_AKM_NONE 0 /* None (IBSS) */
1947 #define RSN_AKM_UNSPECIFIED 1 /* Over 802.1x */
1948 #define RSN_AKM_PSK 2 /* Pre-shared Key */
1949 #define RSN_AKM_FBT_1X 3 /* Fast Bss transition using 802.1X */
1950 #define RSN_AKM_FBT_PSK 4 /* Fast Bss transition using Pre-shared Key */
1951 #define RSN_AKM_MFP_1X 5 /* SHA256 key derivation, using 802.1X */
1952 #define RSN_AKM_MFP_PSK 6 /* SHA256 key derivation, using Pre-shared Key */
1954 /* Key related defines */
1955 #define DOT11_MAX_DEFAULT_KEYS 4 /* number of default keys */
1956 #define DOT11_MAX_KEY_SIZE 32 /* max size of any key */
1957 #define DOT11_MAX_IV_SIZE 16 /* max size of any IV */
1958 #define DOT11_EXT_IV_FLAG (1<<5) /* flag to indicate IV is > 4 bytes */
1959 #define DOT11_WPA_KEY_RSC_LEN 8 /* WPA RSC key len */
1961 #define WEP1_KEY_SIZE 5 /* max size of any WEP key */
1962 #define WEP1_KEY_HEX_SIZE 10 /* size of WEP key in hex. */
1963 #define WEP128_KEY_SIZE 13 /* max size of any WEP key */
1964 #define WEP128_KEY_HEX_SIZE 26 /* size of WEP key in hex. */
1965 #define TKIP_MIC_SIZE 8 /* size of TKIP MIC */
1966 #define TKIP_EOM_SIZE 7 /* max size of TKIP EOM */
1967 #define TKIP_EOM_FLAG 0x5a /* TKIP EOM flag byte */
1968 #define TKIP_KEY_SIZE 32 /* size of any TKIP key */
1969 #define TKIP_MIC_AUTH_TX 16 /* offset to Authenticator MIC TX key */
1970 #define TKIP_MIC_AUTH_RX 24 /* offset to Authenticator MIC RX key */
1971 #define TKIP_MIC_SUP_RX TKIP_MIC_AUTH_TX /* offset to Supplicant MIC RX key */
1972 #define TKIP_MIC_SUP_TX TKIP_MIC_AUTH_RX /* offset to Supplicant MIC TX key */
1973 #define AES_KEY_SIZE 16 /* size of AES key */
1974 #define AES_MIC_SIZE 8 /* size of AES MIC */
1975 #define BIP_KEY_SIZE 16 /* size of BIP key */
1977 /* WCN */
1978 #define WCN_OUI "\x00\x50\xf2" /* WCN OUI */
1979 #define WCN_TYPE 4 /* WCN type */
1981 #ifdef BCMWAPI_WPI
1982 #define SMS4_KEY_LEN 16
1983 #define SMS4_WPI_CBC_MAC_LEN 16
1984 #endif
1986 /* 802.11r protocol definitions */
1988 /* Mobility Domain IE */
1989 BWL_PRE_PACKED_STRUCT struct dot11_mdid_ie {
1990 uint8 id;
1991 uint8 len;
1992 uint16 mdid; /* Mobility Domain Id */
1993 uint8 cap;
1994 } BWL_POST_PACKED_STRUCT;
1995 typedef struct dot11_mdid_ie dot11_mdid_ie_t;
1997 #define FBT_MDID_CAP_OVERDS 0x01 /* Fast Bss transition over the DS support */
1998 #define FBT_MDID_CAP_RRP 0x02 /* Resource request protocol support */
2000 /* Fast Bss Transition IE */
2001 BWL_PRE_PACKED_STRUCT struct dot11_ft_ie {
2002 uint8 id;
2003 uint8 len;
2004 uint16 mic_control; /* Mic Control */
2005 uint8 mic[16];
2006 uint8 anonce[32];
2007 uint8 snonce[32];
2008 } BWL_POST_PACKED_STRUCT;
2009 typedef struct dot11_ft_ie dot11_ft_ie_t;
2011 #define TIE_TYPE_RESERVED 0
2012 #define TIE_TYPE_REASSOC_DEADLINE 1
2013 #define TIE_TYPE_KEY_LIEFTIME 2
2014 #define TIE_TYPE_ASSOC_COMEBACK 3
2015 BWL_PRE_PACKED_STRUCT struct dot11_timeout_ie {
2016 uint8 id;
2017 uint8 len;
2018 uint8 type; /* timeout interval type */
2019 uint32 value; /* timeout interval value */
2020 } BWL_POST_PACKED_STRUCT;
2021 typedef struct dot11_timeout_ie dot11_timeout_ie_t;
2023 /* GTK ie */
2024 BWL_PRE_PACKED_STRUCT struct dot11_gtk_ie {
2025 uint8 id;
2026 uint8 len;
2027 uint16 key_info;
2028 uint8 key_len;
2029 uint8 rsc[8];
2030 uint8 data[1];
2031 } BWL_POST_PACKED_STRUCT;
2032 typedef struct dot11_gtk_ie dot11_gtk_ie_t;
2034 /* This marks the end of a packed structure section. */
2035 #include <packed_section_end.h>
2037 #endif /* _802_11_H_ */