blob: a2ff44e1fb5baed994cb083af5b2d4b93f9e0b47 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Srinivas Girigowdaea4d8062017-10-14 12:40:48 -07002 * Copyright (c) 2011,2014-2017 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
28#ifndef EXTERNAL_USE_ONLY
29#include "osdep.h"
30#endif /* EXTERNAL_USE_ONLY */
31#include "cds_ieee80211_common_i.h"
Leo Chang9b097032016-10-28 11:03:17 -070032#include "cdp_txrx_mob_def.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080033
34#ifndef CDS_COMMON_IEEE80211_H_
35#define CDS_COMMON_IEEE80211_H_
36
37/*
38 * 802.11 protocol definitions.
39 */
40
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080041#define IEEE80211_IS_IPV4_MULTICAST(_a) (*(_a) == 0x01)
42
43#define IEEE80211_IS_IPV6_MULTICAST(_a) \
44 ((_a)[0] == 0x33 && \
45 (_a)[1] == 0x33)
46
47#define IEEE80211_IS_BROADCAST(_a) \
48 ((_a)[0] == 0xff && \
49 (_a)[1] == 0xff && \
50 (_a)[2] == 0xff && \
51 (_a)[3] == 0xff && \
52 (_a)[4] == 0xff && \
53 (_a)[5] == 0xff)
54
55/* IEEE 802.11 PLCP header */
56struct ieee80211_plcp_hdr {
57 uint16_t i_sfd;
58 uint8_t i_signal;
59 uint8_t i_service;
60 uint16_t i_length;
61 uint16_t i_crc;
62} __packed;
63
64#define IEEE80211_PLCP_SFD 0xF3A0
65#define IEEE80211_PLCP_SERVICE 0x00
66
67/*
68 * generic definitions for IEEE 802.11 frames
69 */
70struct ieee80211_frame {
71 uint8_t i_fc[2];
72 uint8_t i_dur[2];
73 union {
74 struct {
75 uint8_t i_addr1[IEEE80211_ADDR_LEN];
76 uint8_t i_addr2[IEEE80211_ADDR_LEN];
77 uint8_t i_addr3[IEEE80211_ADDR_LEN];
78 };
79 uint8_t i_addr_all[3 * IEEE80211_ADDR_LEN];
80 };
81 uint8_t i_seq[2];
82 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
83 /* see below */
84} __packed;
85
86struct ieee80211_qosframe {
87 uint8_t i_fc[2];
88 uint8_t i_dur[2];
89 uint8_t i_addr1[IEEE80211_ADDR_LEN];
90 uint8_t i_addr2[IEEE80211_ADDR_LEN];
91 uint8_t i_addr3[IEEE80211_ADDR_LEN];
92 uint8_t i_seq[2];
93 uint8_t i_qos[2];
94 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
95 /* see below */
96} __packed;
97
98struct ieee80211_qoscntl {
99 uint8_t i_qos[2];
100};
101
102struct ieee80211_frame_addr4 {
103 uint8_t i_fc[2];
104 uint8_t i_dur[2];
105 uint8_t i_addr1[IEEE80211_ADDR_LEN];
106 uint8_t i_addr2[IEEE80211_ADDR_LEN];
107 uint8_t i_addr3[IEEE80211_ADDR_LEN];
108 uint8_t i_seq[2];
109 uint8_t i_addr4[IEEE80211_ADDR_LEN];
110} __packed;
111
112struct ieee80211_qosframe_addr4 {
113 uint8_t i_fc[2];
114 uint8_t i_dur[2];
115 uint8_t i_addr1[IEEE80211_ADDR_LEN];
116 uint8_t i_addr2[IEEE80211_ADDR_LEN];
117 uint8_t i_addr3[IEEE80211_ADDR_LEN];
118 uint8_t i_seq[2];
119 uint8_t i_addr4[IEEE80211_ADDR_LEN];
120 uint8_t i_qos[2];
121} __packed;
122
123/* HTC frame for TxBF*/
124/* for TxBF RC */
125struct ieee80211_frame_min_one {
126 uint8_t i_fc[2];
127 uint8_t i_dur[2];
128 uint8_t i_addr1[IEEE80211_ADDR_LEN];
129
130} __packed; /* For TxBF RC */
131
132struct ieee80211_qosframe_htc {
133 uint8_t i_fc[2];
134 uint8_t i_dur[2];
135 uint8_t i_addr1[IEEE80211_ADDR_LEN];
136 uint8_t i_addr2[IEEE80211_ADDR_LEN];
137 uint8_t i_addr3[IEEE80211_ADDR_LEN];
138 uint8_t i_seq[2];
139 uint8_t i_qos[2];
140 uint8_t i_htc[4];
141 /* possibly followed by addr4[IEEE80211_ADDR_LEN]; */
142 /* see below */
143} __packed;
144struct ieee80211_qosframe_htc_addr4 {
145 uint8_t i_fc[2];
146 uint8_t i_dur[2];
147 uint8_t i_addr1[IEEE80211_ADDR_LEN];
148 uint8_t i_addr2[IEEE80211_ADDR_LEN];
149 uint8_t i_addr3[IEEE80211_ADDR_LEN];
150 uint8_t i_seq[2];
151 uint8_t i_addr4[IEEE80211_ADDR_LEN];
152 uint8_t i_qos[2];
153 uint8_t i_htc[4];
154} __packed;
155struct ieee80211_htc {
156 uint8_t i_htc[4];
157};
158/*HTC frame for TxBF*/
159
160struct ieee80211_ctlframe_addr2 {
161 uint8_t i_fc[2];
162 uint8_t i_aidordur[2]; /* AID or duration */
163 uint8_t i_addr1[IEEE80211_ADDR_LEN];
164 uint8_t i_addr2[IEEE80211_ADDR_LEN];
165} __packed;
166
167#define IEEE80211_WHQ(wh) ((struct ieee80211_qosframe *)(wh))
168#define IEEE80211_WH4(wh) ((struct ieee80211_frame_addr4 *)(wh))
169#define IEEE80211_WHQ4(wh) ((struct ieee80211_qosframe_addr4 *)(wh))
170
171#define IEEE80211_FC0_VERSION_MASK 0x03
172#define IEEE80211_FC0_VERSION_SHIFT 0
173#define IEEE80211_FC0_VERSION_0 0x00
174#define IEEE80211_FC0_TYPE_MASK 0x0c
175#define IEEE80211_FC0_TYPE_SHIFT 2
176#define IEEE80211_FC0_TYPE_MGT 0x00
177#define IEEE80211_FC0_TYPE_CTL 0x04
178#define IEEE80211_FC0_TYPE_DATA 0x08
179
180#define IEEE80211_FC0_SUBTYPE_MASK 0xf0
181#define IEEE80211_FC0_SUBTYPE_SHIFT 4
182/* for TYPE_MGT */
183#define IEEE80211_FC0_SUBTYPE_ASSOC_REQ 0x00
184#define IEEE80211_FC0_SUBTYPE_ASSOC_RESP 0x10
185#define IEEE80211_FC0_SUBTYPE_REASSOC_REQ 0x20
186#define IEEE80211_FC0_SUBTYPE_REASSOC_RESP 0x30
187#define IEEE80211_FC0_SUBTYPE_PROBE_REQ 0x40
188#define IEEE80211_FC0_SUBTYPE_PROBE_RESP 0x50
189#define IEEE80211_FC0_SUBTYPE_BEACON 0x80
190#define IEEE80211_FC0_SUBTYPE_ATIM 0x90
191#define IEEE80211_FC0_SUBTYPE_DISASSOC 0xa0
192#define IEEE80211_FC0_SUBTYPE_AUTH 0xb0
193#define IEEE80211_FC0_SUBTYPE_DEAUTH 0xc0
194#define IEEE80211_FC0_SUBTYPE_ACTION 0xd0
195#define IEEE80211_FCO_SUBTYPE_ACTION_NO_ACK 0xe0
196/* for TYPE_CTL */
197#define IEEE80211_FCO_SUBTYPE_Control_Wrapper 0x70 /* For TxBF RC */
198#define IEEE80211_FC0_SUBTYPE_BAR 0x80
199#define IEEE80211_FC0_SUBTYPE_PS_POLL 0xa0
200#define IEEE80211_FC0_SUBTYPE_RTS 0xb0
201#define IEEE80211_FC0_SUBTYPE_CTS 0xc0
202#define IEEE80211_FC0_SUBTYPE_ACK 0xd0
203#define IEEE80211_FC0_SUBTYPE_CF_END 0xe0
204#define IEEE80211_FC0_SUBTYPE_CF_END_ACK 0xf0
205/* for TYPE_DATA (bit combination) */
206#define IEEE80211_FC0_SUBTYPE_DATA 0x00
207#define IEEE80211_FC0_SUBTYPE_CF_ACK 0x10
208#define IEEE80211_FC0_SUBTYPE_CF_POLL 0x20
209#define IEEE80211_FC0_SUBTYPE_CF_ACPL 0x30
210#define IEEE80211_FC0_SUBTYPE_NODATA 0x40
211#define IEEE80211_FC0_SUBTYPE_CFACK 0x50
212#define IEEE80211_FC0_SUBTYPE_CFPOLL 0x60
213#define IEEE80211_FC0_SUBTYPE_CF_ACK_CF_ACK 0x70
214#define IEEE80211_FC0_SUBTYPE_QOS 0x80
215#define IEEE80211_FC0_SUBTYPE_QOS_NULL 0xc0
216
217#define IEEE80211_FC1_DIR_MASK 0x03
218#define IEEE80211_FC1_DIR_NODS 0x00 /* STA->STA */
219#define IEEE80211_FC1_DIR_TODS 0x01 /* STA->AP */
220#define IEEE80211_FC1_DIR_FROMDS 0x02 /* AP ->STA */
221#define IEEE80211_FC1_DIR_DSTODS 0x03 /* AP ->AP */
222
223#define IEEE80211_FC1_MORE_FRAG 0x04
224#define IEEE80211_FC1_RETRY 0x08
225#define IEEE80211_FC1_PWR_MGT 0x10
226#define IEEE80211_FC1_MORE_DATA 0x20
227#define IEEE80211_FC1_WEP 0x40
228#define IEEE80211_FC1_ORDER 0x80
229
230#define IEEE80211_SEQ_FRAG_MASK 0x000f
231#define IEEE80211_SEQ_FRAG_SHIFT 0
232#define IEEE80211_SEQ_SEQ_MASK 0xfff0
233#define IEEE80211_SEQ_SEQ_SHIFT 4
234#define IEEE80211_SEQ_MAX 4096
235
Srinivas Girigowdaea4d8062017-10-14 12:40:48 -0700236#define IEEE80211_SEQ_LEQ(a, b) ((int)((a) - (b)) <= 0)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800237
238#define IEEE80211_QOS_TXOP 0x00ff
239
240#define IEEE80211_QOS_AMSDU 0x80
241#define IEEE80211_QOS_AMSDU_S 7
242#define IEEE80211_QOS_ACKPOLICY 0x60
243#define IEEE80211_QOS_ACKPOLICY_S 5
244#define IEEE80211_QOS_EOSP 0x10
245#define IEEE80211_QOS_EOSP_S 4
246#define IEEE80211_QOS_TID 0x0f
247#define IEEE80211_MFP_TID 0xff
248
249#define IEEE80211_HTC0_TRQ 0x02
250#define IEEE80211_HTC2_CalPos 0x03
251#define IEEE80211_HTC2_CalSeq 0x0C
252#define IEEE80211_HTC2_CSI_NONCOMP_BF 0x80
253#define IEEE80211_HTC2_CSI_COMP_BF 0xc0
254
255/* Set bits 14 and 15 to 1 when duration field carries Association ID */
256#define IEEE80211_FIELD_TYPE_AID 0xC000
257
258#define IEEE80211_IS_BEACON(_frame) ((((_frame)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT) && \
259 (((_frame)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_BEACON))
260#define IEEE80211_IS_DATA(_frame) (((_frame)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_DATA)
261
262#define IEEE80211_IS_MFP_FRAME(_frame) ((((_frame)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT) && \
263 ((_frame)->i_fc[1] & IEEE80211_FC1_WEP) && \
264 ((((_frame)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_DEAUTH) || \
265 (((_frame)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_DISASSOC) || \
266 (((_frame)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_ACTION)))
267#define IEEE80211_IS_AUTH(_frame) ((((_frame)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT) && \
268 (((_frame)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == IEEE80211_FC0_SUBTYPE_AUTH))
269
270/* MCS Set */
271#define IEEE80211_RX_MCS_1_STREAM_BYTE_OFFSET 0
272#define IEEE80211_RX_MCS_2_STREAM_BYTE_OFFSET 1
273#define IEEE80211_RX_MCS_3_STREAM_BYTE_OFFSET 2
274#define IEEE80211_RX_MCS_ALL_NSTREAM_RATES 0xff
275#define IEEE80211_TX_MCS_OFFSET 12
276
277#define IEEE80211_TX_MCS_SET_DEFINED 0x80
278#define IEEE80211_TX_RX_MCS_SET_NOT_EQUAL 0x40
279#define IEEE80211_TX_1_SPATIAL_STREAMS 0x0
280#define IEEE80211_TX_2_SPATIAL_STREAMS 0x10
281#define IEEE80211_TX_3_SPATIAL_STREAMS 0x20
282#define IEEE80211_TX_4_SPATIAL_STREAMS 0x30
283
284#define IEEE80211_TX_MCS_SET 0xf8
285
286/*
287 * Subtype data: If bit 6 is set then the data frame contains no actual data.
288 */
289#define IEEE80211_FC0_SUBTYPE_NO_DATA_MASK 0x40
290#define IEEE80211_CONTAIN_DATA(_subtype) \
291 (!((_subtype) & IEEE80211_FC0_SUBTYPE_NO_DATA_MASK))
292
293#define IEEE8023_MAX_LEN 0x600 /* 1536 - larger is Ethernet II */
294#define RFC1042_SNAP_ORGCODE_0 0x00
295#define RFC1042_SNAP_ORGCODE_1 0x00
296#define RFC1042_SNAP_ORGCODE_2 0x00
297
298#define BTEP_SNAP_ORGCODE_0 0x00
299#define BTEP_SNAP_ORGCODE_1 0x00
300#define BTEP_SNAP_ORGCODE_2 0xf8
301
302/* BT 3.0 */
303#define BTAMP_SNAP_ORGCODE_0 0x00
304#define BTAMP_SNAP_ORGCODE_1 0x19
305#define BTAMP_SNAP_ORGCODE_2 0x58
306
307/* Aironet OUI Codes */
308#define AIRONET_SNAP_CODE_0 0x00
309#define AIRONET_SNAP_CODE_1 0x40
310#define AIRONET_SNAP_CODE_2 0x96
311
312#define IEEE80211_LSIG_LEN 3
313#define IEEE80211_HTSIG_LEN 6
314#define IEEE80211_SB_LEN 2
315
316/*
317 * Information element header format
318 */
319struct ieee80211_ie_header {
320 uint8_t element_id; /* Element Id */
321 uint8_t length; /* IE Length */
322} __packed;
323
324/*
325 * Country information element.
326 */
327#define IEEE80211_COUNTRY_MAX_TRIPLETS (83)
328struct ieee80211_ie_country {
329 uint8_t country_id;
330 uint8_t country_len;
331 uint8_t country_str[3];
332 uint8_t country_triplet[IEEE80211_COUNTRY_MAX_TRIPLETS * 3];
333} __packed;
334
335/* does frame have QoS sequence control data */
336#define IEEE80211_QOS_HAS_SEQ(wh) \
337 (((wh)->i_fc[0] & \
338 (IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_QOS)) == \
339 (IEEE80211_FC0_TYPE_DATA | IEEE80211_FC0_SUBTYPE_QOS))
340
341#define WME_QOSINFO_UAPSD 0x80 /* Mask for U-APSD field */
342#define WME_QOSINFO_COUNT 0x0f /* Mask for Param Set Count field */
343/*
344 * WME/802.11e information element.
345 */
346struct ieee80211_ie_wme {
347 uint8_t wme_id; /* IEEE80211_ELEMID_VENDOR */
348 uint8_t wme_len; /* length in bytes */
349 uint8_t wme_oui[3]; /* 0x00, 0x50, 0xf2 */
350 uint8_t wme_type; /* OUI type */
351 uint8_t wme_subtype; /* OUI subtype */
352 uint8_t wme_version; /* spec revision */
353 uint8_t wme_info; /* QoS info */
354} __packed;
355
356/*
357 * TS INFO part of the tspec element is a collection of bit flags
358 */
359#if _BYTE_ORDER == _BIG_ENDIAN
360struct ieee80211_tsinfo_bitmap {
361 uint8_t one : 1, direction : 2, tid : 4, reserved1 : 1;
362 uint8_t reserved2 : 2, dot1Dtag : 3, psb : 1, reserved3 : 1, zero : 1;
363 uint8_t reserved5 : 7, reserved4 : 1;
364} __packed;
365#else
366struct ieee80211_tsinfo_bitmap {
367 uint8_t reserved1 : 1, tid : 4, direction : 2, one : 1;
368 uint8_t zero : 1, reserved3 : 1, psb : 1, dot1Dtag : 3, reserved2 : 2;
369 uint8_t reserved4 : 1, reserved5 : 7;
370} __packed;
371#endif
372
373/*
374 * WME/802.11e Tspec Element
375 */
376struct ieee80211_wme_tspec {
377 uint8_t ts_id;
378 uint8_t ts_len;
379 uint8_t ts_oui[3];
380 uint8_t ts_oui_type;
381 uint8_t ts_oui_subtype;
382 uint8_t ts_version;
383 uint8_t ts_tsinfo[3];
384 uint8_t ts_nom_msdu[2];
385 uint8_t ts_max_msdu[2];
386 uint8_t ts_min_svc[4];
387 uint8_t ts_max_svc[4];
388 uint8_t ts_inactv_intv[4];
389 uint8_t ts_susp_intv[4];
390 uint8_t ts_start_svc[4];
391 uint8_t ts_min_rate[4];
392 uint8_t ts_mean_rate[4];
393 uint8_t ts_peak_rate[4];
394 uint8_t ts_max_burst[4];
395 uint8_t ts_delay[4];
396 uint8_t ts_min_phy[4];
397 uint8_t ts_surplus[2];
398 uint8_t ts_medium_time[2];
399} __packed;
400
401/*
402 * WME AC parameter field
403 */
404struct ieee80211_wme_acparams {
405 uint8_t acp_aci_aifsn;
406 uint8_t acp_logcwminmax;
407 uint16_t acp_txop;
408} __packed;
409
410#define IEEE80211_WME_PARAM_LEN 24
411#define WME_NUM_AC 4 /* 4 AC categories */
412
413#define WME_PARAM_ACI 0x60 /* Mask for ACI field */
414#define WME_PARAM_ACI_S 5 /* Shift for ACI field */
415#define WME_PARAM_ACM 0x10 /* Mask for ACM bit */
416#define WME_PARAM_ACM_S 4 /* Shift for ACM bit */
417#define WME_PARAM_AIFSN 0x0f /* Mask for aifsn field */
418#define WME_PARAM_AIFSN_S 0 /* Shift for aifsn field */
419#define WME_PARAM_LOGCWMIN 0x0f /* Mask for CwMin field (in log) */
420#define WME_PARAM_LOGCWMIN_S 0 /* Shift for CwMin field */
421#define WME_PARAM_LOGCWMAX 0xf0 /* Mask for CwMax field (in log) */
422#define WME_PARAM_LOGCWMAX_S 4 /* Shift for CwMax field */
423
424#define WME_AC_TO_TID(_ac) ( \
425 ((_ac) == WME_AC_VO) ? 6 : \
426 ((_ac) == WME_AC_VI) ? 5 : \
427 ((_ac) == WME_AC_BK) ? 1 : \
428 0)
429
430#define TID_TO_WME_AC(_tid) ( \
431 (((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
432 (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
433 (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
434 WME_AC_VO)
435
436/*
437 * WME Parameter Element
438 */
439struct ieee80211_wme_param {
440 uint8_t param_id;
441 uint8_t param_len;
442 uint8_t param_oui[3];
443 uint8_t param_oui_type;
444 uint8_t param_oui_sybtype;
445 uint8_t param_version;
446 uint8_t param_qosInfo;
447 uint8_t param_reserved;
448 struct ieee80211_wme_acparams params_acParams[WME_NUM_AC];
449} __packed;
450
451/*
452 * WME U-APSD qos info field defines
453 */
454#define WME_CAPINFO_UAPSD_EN 0x00000080
455#define WME_CAPINFO_UAPSD_VO 0x00000001
456#define WME_CAPINFO_UAPSD_VI 0x00000002
457#define WME_CAPINFO_UAPSD_BK 0x00000004
458#define WME_CAPINFO_UAPSD_BE 0x00000008
459#define WME_CAPINFO_UAPSD_ACFLAGS_SHIFT 0
460#define WME_CAPINFO_UAPSD_ACFLAGS_MASK 0xF
461#define WME_CAPINFO_UAPSD_MAXSP_SHIFT 5
462#define WME_CAPINFO_UAPSD_MAXSP_MASK 0x3
463#define WME_CAPINFO_IE_OFFSET 8
464#define WME_UAPSD_MAXSP(_qosinfo) (((_qosinfo) >> WME_CAPINFO_UAPSD_MAXSP_SHIFT) & WME_CAPINFO_UAPSD_MAXSP_MASK)
Srinivas Girigowdaea4d8062017-10-14 12:40:48 -0700465#define WME_UAPSD_AC_ENABLED(_ac, _qosinfo) ((1 << (3 - (_ac))) & \
466 (((_qosinfo) >> WME_CAPINFO_UAPSD_ACFLAGS_SHIFT) & WME_CAPINFO_UAPSD_ACFLAGS_MASK))
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800467
468/* Mask used to determined whether all queues are UAPSD-enabled */
469#define WME_CAPINFO_UAPSD_ALL (WME_CAPINFO_UAPSD_VO | \
470 WME_CAPINFO_UAPSD_VI | \
471 WME_CAPINFO_UAPSD_BK | \
472 WME_CAPINFO_UAPSD_BE)
Srinivas Girigowdaea4d8062017-10-14 12:40:48 -0700473#define WME_CAPINFO_UAPSD_NONE 0
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800474
475#define WME_UAPSD_AC_MAX_VAL 1
Srinivas Girigowdaea4d8062017-10-14 12:40:48 -0700476#define WME_UAPSD_AC_INVAL (WME_UAPSD_AC_MAX_VAL + 1)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800477
478/*
479 * Atheros Advanced Capability information element.
480 */
481struct ieee80211_ie_athAdvCap {
482 uint8_t athAdvCap_id; /* IEEE80211_ELEMID_VENDOR */
483 uint8_t athAdvCap_len; /* length in bytes */
484 uint8_t athAdvCap_oui[3]; /* 0x00, 0x03, 0x7f */
485 uint8_t athAdvCap_type; /* OUI type */
486 uint16_t athAdvCap_version; /* spec revision */
487 uint8_t athAdvCap_capability; /* Capability info */
488 uint16_t athAdvCap_defKeyIndex;
489} __packed;
490
491/*
492 * Atheros Extended Capability information element.
493 */
494struct ieee80211_ie_ath_extcap {
495 uint8_t ath_extcap_id; /* IEEE80211_ELEMID_VENDOR */
496 uint8_t ath_extcap_len; /* length in bytes */
497 uint8_t ath_extcap_oui[3]; /* 0x00, 0x03, 0x7f */
498 uint8_t ath_extcap_type; /* OUI type */
499 uint8_t ath_extcap_subtype; /* OUI subtype */
500 uint8_t ath_extcap_version; /* spec revision */
501 uint32_t ath_extcap_extcap : 16, /* B0-15 extended capabilities */
502 ath_extcap_weptkipaggr_rxdelim : 8, /* B16-23 num delimiters for receiving WEP/TKIP aggregates */
503 ath_extcap_reserved : 8; /* B24-31 reserved */
504} __packed;
505
506/*
507 * Atheros XR information element.
508 */
509struct ieee80211_xr_param {
510 uint8_t param_id;
511 uint8_t param_len;
512 uint8_t param_oui[3];
513 uint8_t param_oui_type;
514 uint8_t param_oui_sybtype;
515 uint8_t param_version;
516 uint8_t param_Info;
517 uint8_t param_base_bssid[IEEE80211_ADDR_LEN];
518 uint8_t param_xr_bssid[IEEE80211_ADDR_LEN];
519 uint16_t param_xr_beacon_interval;
520 uint8_t param_base_ath_capability;
521 uint8_t param_xr_ath_capability;
522} __packed;
523
524/*
525 * SFA information element.
526 */
527struct ieee80211_ie_sfa {
528 uint8_t sfa_id; /* IEEE80211_ELEMID_VENDOR */
529 uint8_t sfa_len; /* length in bytes */
530 uint8_t sfa_oui[3]; /* 0x00, 0x40, 0x96 */
531 uint8_t sfa_type; /* OUI type */
532 uint8_t sfa_caps; /* Capabilities */
533} __packed;
534
535/* Atheros capabilities */
536#define IEEE80211_ATHC_TURBOP 0x0001 /* Turbo Prime */
537#define IEEE80211_ATHC_COMP 0x0002 /* Compression */
538#define IEEE80211_ATHC_FF 0x0004 /* Fast Frames */
539#define IEEE80211_ATHC_XR 0x0008 /* Xtended Range support */
540#define IEEE80211_ATHC_AR 0x0010 /* Advanced Radar support */
541#define IEEE80211_ATHC_BURST 0x0020 /* Bursting - not negotiated */
542#define IEEE80211_ATHC_WME 0x0040 /* CWMin tuning */
543#define IEEE80211_ATHC_BOOST 0x0080 /* Boost */
544#define IEEE80211_ATHC_TDLS 0x0100 /* TDLS */
545
546/* Atheros extended capabilities */
547/* OWL device capable of WDS workaround */
548#define IEEE80211_ATHEC_OWLWDSWAR 0x0001
549#define IEEE80211_ATHEC_WEPTKIPAGGR 0x0002
550#define IEEE80211_ATHEC_EXTRADELIMWAR 0x0004
551/*
552 * Management Frames
553 */
554
555/*
556 * *** Platform-specific code?? ***
557 * In Vista one must use bit fields of type (unsigned short = uint16_t) to
558 * ensure data structure is of the correct size. ANSI C used to specify only
559 * "int" bit fields, which led to a larger structure size in Windows (32 bits).
560 *
561 * We must make sure the following construction is valid in all OS's.
562 */
563union ieee80211_capability {
564 struct {
565 uint16_t ess : 1;
566 uint16_t ibss : 1;
567 uint16_t cf_pollable : 1;
568 uint16_t cf_poll_request : 1;
569 uint16_t privacy : 1;
570 uint16_t short_preamble : 1;
571 uint16_t pbcc : 1;
572 uint16_t channel_agility : 1;
573 uint16_t spectrum_management : 1;
574 uint16_t qos : 1;
575 uint16_t short_slot_time : 1;
576 uint16_t apsd : 1;
577 uint16_t reserved2 : 1;
578 uint16_t dsss_ofdm : 1;
579 uint16_t del_block_ack : 1;
580 uint16_t immed_block_ack : 1;
581 };
582
583 uint16_t value;
584} __packed;
585
586struct ieee80211_beacon_frame {
587 uint8_t timestamp[8]; /* the value of sender's TSFTIMER */
588 uint16_t beacon_interval; /* the number of time units between target beacon transmission times */
589 union ieee80211_capability capability;
590/* Value of capability for every bit
591 #define IEEE80211_CAPINFO_ESS 0x0001
592 #define IEEE80211_CAPINFO_IBSS 0x0002
593 #define IEEE80211_CAPINFO_CF_POLLABLE 0x0004
594 #define IEEE80211_CAPINFO_CF_POLLREQ 0x0008
595 #define IEEE80211_CAPINFO_PRIVACY 0x0010
596 #define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020
597 #define IEEE80211_CAPINFO_PBCC 0x0040
598 #define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080
599 #define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100
600 #define IEEE80211_CAPINFO_QOS 0x0200
601 #define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400
602 #define IEEE80211_CAPINFO_APSD 0x0800
603 #define IEEE80211_CAPINFO_RADIOMEAS 0x1000
604 #define IEEE80211_CAPINFO_DSSSOFDM 0x2000
605 bits 14-15 are reserved
606 */
607 struct ieee80211_ie_header info_elements;
608} __packed;
609
610/*
611 * Management Action Frames
612 */
613
614/* generic frame format */
615struct ieee80211_action {
616 uint8_t ia_category;
617 uint8_t ia_action;
618} __packed;
619
620/* spectrum action frame header */
621struct ieee80211_action_measrep_header {
622 struct ieee80211_action action_header;
623 uint8_t dialog_token;
624} __packed;
625
626/* categories */
627#define IEEE80211_ACTION_CAT_SPECTRUM 0 /* Spectrum management */
628#define IEEE80211_ACTION_CAT_QOS 1 /* IEEE QoS */
629#define IEEE80211_ACTION_CAT_DLS 2 /* DLS */
630#define IEEE80211_ACTION_CAT_BA 3 /* BA */
631#define IEEE80211_ACTION_CAT_PUBLIC 4 /* Public Action Frame */
632#define IEEE80211_ACTION_CAT_HT 7 /* HT per IEEE802.11n-D1.06 */
633#define IEEE80211_ACTION_CAT_SA_QUERY 8 /* SA Query per IEEE802.11w, PMF */
634#define IEEE80211_ACTION_CAT_WMM_QOS 17 /* QoS from WMM specification */
635#define IEEE80211_ACTION_CAT_VHT 21 /* VHT Action */
636
637/* Spectrum Management actions */
638#define IEEE80211_ACTION_MEAS_REQUEST 0 /* Measure channels */
639#define IEEE80211_ACTION_MEAS_REPORT 1
640#define IEEE80211_ACTION_TPC_REQUEST 2 /* Transmit Power control */
641#define IEEE80211_ACTION_TPC_REPORT 3
642#define IEEE80211_ACTION_CHAN_SWITCH 4 /* 802.11h Channel Switch Announcement */
643
644/* HT actions */
645#define IEEE80211_ACTION_HT_TXCHWIDTH 0 /* recommended transmission channel width */
646#define IEEE80211_ACTION_HT_SMPOWERSAVE 1 /* Spatial Multiplexing (SM) Power Save */
647#define IEEE80211_ACTION_HT_CSI 4 /* CSI Frame */
648#define IEEE80211_ACTION_HT_NONCOMP_BF 5 /* Non-compressed Beamforming */
649#define IEEE80211_ACTION_HT_COMP_BF 6 /* Compressed Beamforming */
650
651/* VHT actions */
652#define IEEE80211_ACTION_VHT_OPMODE 2 /* Operating mode notification */
653
654/* Spectrum channel switch action frame after IE*/
655/* Public Actions*/
656#define IEEE80211_ACTION_TDLS_DISCRESP 14 /* TDLS Discovery Response frame */
657
658/* HT - recommended transmission channel width */
659struct ieee80211_action_ht_txchwidth {
660 struct ieee80211_action at_header;
661 uint8_t at_chwidth;
662} __packed;
663
664#define IEEE80211_A_HT_TXCHWIDTH_20 0
665#define IEEE80211_A_HT_TXCHWIDTH_2040 1
666
667/* HT - Spatial Multiplexing (SM) Power Save */
668struct ieee80211_action_ht_smpowersave {
669 struct ieee80211_action as_header;
670 uint8_t as_control;
671} __packed;
672
673/*HT - CSI Frame */ /* for TxBF RC */
674#define MIMO_CONTROL_LEN 6
675struct ieee80211_action_ht_CSI {
676 struct ieee80211_action as_header;
677 uint8_t mimo_control[MIMO_CONTROL_LEN];
678} __packed;
679
680/*HT - V/CV report frame*/
681struct ieee80211_action_ht_txbf_rpt {
682 struct ieee80211_action as_header;
683 uint8_t mimo_control[MIMO_CONTROL_LEN];
684} __packed;
685
686/*
687 * 802.11ac Operating Mode Notification
688 */
689struct ieee80211_ie_op_mode {
690#if _BYTE_ORDER == _BIG_ENDIAN
691 uint8_t rx_nss_type : 1, rx_nss : 3, reserved : 2, ch_width : 2;
692#else
693 uint8_t ch_width : 2, reserved : 2, rx_nss : 3, rx_nss_type : 1;
694#endif
695} __packed;
696
697struct ieee80211_ie_op_mode_ntfy {
698 uint8_t elem_id;
699 uint8_t elem_len;
700 struct ieee80211_ie_op_mode opmode;
701} __packed;
702
703/* VHT - recommended Channel width and Nss */
704struct ieee80211_action_vht_opmode {
705 struct ieee80211_action at_header;
706 struct ieee80211_ie_op_mode at_op_mode;
707} __packed;
708
709/* values defined for 'as_control' field per 802.11n-D1.06 */
710#define IEEE80211_A_HT_SMPOWERSAVE_DISABLED 0x00 /* SM Power Save Disabled, SM packets ok */
711#define IEEE80211_A_HT_SMPOWERSAVE_ENABLED 0x01 /* SM Power Save Enabled bit */
712#define IEEE80211_A_HT_SMPOWERSAVE_MODE 0x02 /* SM Power Save Mode bit */
713#define IEEE80211_A_HT_SMPOWERSAVE_RESERVED 0xFC /* SM Power Save Reserved bits */
714
715/* values defined for SM Power Save Mode bit */
716#define IEEE80211_A_HT_SMPOWERSAVE_STATIC 0x00 /* Static, SM packets not ok */
717#define IEEE80211_A_HT_SMPOWERSAVE_DYNAMIC 0x02 /* Dynamic, SM packets ok if preceded by RTS */
718
719/* DLS actions */
720#define IEEE80211_ACTION_DLS_REQUEST 0
721#define IEEE80211_ACTION_DLS_RESPONSE 1
722#define IEEE80211_ACTION_DLS_TEARDOWN 2
723
724struct ieee80211_dls_request {
725 struct ieee80211_action hdr;
726 uint8_t dst_addr[IEEE80211_ADDR_LEN];
727 uint8_t src_addr[IEEE80211_ADDR_LEN];
728 uint16_t capa_info;
729 uint16_t timeout;
730} __packed;
731
732struct ieee80211_dls_response {
733 struct ieee80211_action hdr;
734 uint16_t statuscode;
735 uint8_t dst_addr[IEEE80211_ADDR_LEN];
736 uint8_t src_addr[IEEE80211_ADDR_LEN];
737} __packed;
738
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800739/* BA - ADDBA request */
740struct ieee80211_action_ba_addbarequest {
741 struct ieee80211_action rq_header;
742 uint8_t rq_dialogtoken;
743 struct ieee80211_ba_parameterset rq_baparamset;
744 uint16_t rq_batimeout; /* in TUs */
745 struct ieee80211_ba_seqctrl rq_basequencectrl;
746} __packed;
747
748/* BA - ADDBA response */
749struct ieee80211_action_ba_addbaresponse {
750 struct ieee80211_action rs_header;
751 uint8_t rs_dialogtoken;
752 uint16_t rs_statuscode;
753 struct ieee80211_ba_parameterset rs_baparamset;
754 uint16_t rs_batimeout; /* in TUs */
755} __packed;
756
757/* BA - DELBA */
758struct ieee80211_action_ba_delba {
759 struct ieee80211_action dl_header;
760 struct ieee80211_delba_parameterset dl_delbaparamset;
761 uint16_t dl_reasoncode;
762} __packed;
763
764/* MGT Notif actions */
765#define IEEE80211_WMM_QOS_ACTION_SETUP_REQ 0
766#define IEEE80211_WMM_QOS_ACTION_SETUP_RESP 1
767#define IEEE80211_WMM_QOS_ACTION_TEARDOWN 2
768
769#define IEEE80211_WMM_QOS_DIALOG_TEARDOWN 0
770#define IEEE80211_WMM_QOS_DIALOG_SETUP 1
771
772#define IEEE80211_WMM_QOS_TSID_DATA_TSPEC 6
773#define IEEE80211_WMM_QOS_TSID_SIG_TSPEC 7
774
775struct ieee80211_action_wmm_qos {
776 struct ieee80211_action ts_header;
777 uint8_t ts_dialogtoken;
778 uint8_t ts_statuscode;
779 struct ieee80211_wme_tspec ts_tspecie;
780} __packed;
781
782/*
783 * Control frames.
784 */
785struct ieee80211_frame_min {
786 uint8_t i_fc[2];
787 uint8_t i_dur[2];
788 uint8_t i_addr1[IEEE80211_ADDR_LEN];
789 uint8_t i_addr2[IEEE80211_ADDR_LEN];
790 /* FCS */
791} __packed;
792
793/*
794 * BAR frame format
795 */
796#define IEEE80211_BAR_CTL_TID_M 0xF000 /* tid mask */
797#define IEEE80211_BAR_CTL_TID_S 12 /* tid shift */
798#define IEEE80211_BAR_CTL_NOACK 0x0001 /* no-ack policy */
799#define IEEE80211_BAR_CTL_COMBA 0x0004 /* compressed block-ack */
800
801/*
802 * SA Query Action mgmt Frame
803 */
804struct ieee80211_action_sa_query {
805 struct ieee80211_action sa_header;
806 uint16_t sa_transId;
807};
808
809typedef enum ieee80211_action_sa_query_type {
810 IEEE80211_ACTION_SA_QUERY_REQUEST,
811 IEEE80211_ACTION_SA_QUERY_RESPONSE
812} ieee80211_action_sa_query_type_t;
813
814struct ieee80211_frame_bar {
815 uint8_t i_fc[2];
816 uint8_t i_dur[2];
817 uint8_t i_ra[IEEE80211_ADDR_LEN];
818 uint8_t i_ta[IEEE80211_ADDR_LEN];
819 uint16_t i_ctl;
820 uint16_t i_seq;
821 /* FCS */
822} __packed;
823
824struct ieee80211_frame_rts {
825 uint8_t i_fc[2];
826 uint8_t i_dur[2];
827 uint8_t i_ra[IEEE80211_ADDR_LEN];
828 uint8_t i_ta[IEEE80211_ADDR_LEN];
829 /* FCS */
830} __packed;
831
832struct ieee80211_frame_cts {
833 uint8_t i_fc[2];
834 uint8_t i_dur[2];
835 uint8_t i_ra[IEEE80211_ADDR_LEN];
836 /* FCS */
837} __packed;
838
839struct ieee80211_frame_ack {
840 uint8_t i_fc[2];
841 uint8_t i_dur[2];
842 uint8_t i_ra[IEEE80211_ADDR_LEN];
843 /* FCS */
844} __packed;
845
846struct ieee80211_frame_pspoll {
847 uint8_t i_fc[2];
848 uint8_t i_aid[2];
849 uint8_t i_bssid[IEEE80211_ADDR_LEN];
850 uint8_t i_ta[IEEE80211_ADDR_LEN];
851 /* FCS */
852} __packed;
853
854struct ieee80211_frame_cfend { /* NB: also CF-End+CF-Ack */
855 uint8_t i_fc[2];
856 uint8_t i_dur[2]; /* should be zero */
857 uint8_t i_ra[IEEE80211_ADDR_LEN];
858 uint8_t i_bssid[IEEE80211_ADDR_LEN];
859 /* FCS */
860} __packed;
861
862/*
863 * BEACON management packets
864 *
865 * octet timestamp[8]
866 * octet beacon interval[2]
867 * octet capability information[2]
868 * information element
869 * octet elemid
870 * octet length
871 * octet information[length]
872 */
873
874typedef uint8_t *ieee80211_mgt_beacon_t;
875
876#define IEEE80211_BEACON_INTERVAL(beacon) \
877 ((beacon)[8] | ((beacon)[9] << 8))
878#define IEEE80211_BEACON_CAPABILITY(beacon) \
879 ((beacon)[10] | ((beacon)[11] << 8))
880
881#define IEEE80211_CAPINFO_ESS 0x0001
882#define IEEE80211_CAPINFO_IBSS 0x0002
883#define IEEE80211_CAPINFO_CF_POLLABLE 0x0004
884#define IEEE80211_CAPINFO_CF_POLLREQ 0x0008
885#define IEEE80211_CAPINFO_PRIVACY 0x0010
886#define IEEE80211_CAPINFO_SHORT_PREAMBLE 0x0020
887#define IEEE80211_CAPINFO_PBCC 0x0040
888#define IEEE80211_CAPINFO_CHNL_AGILITY 0x0080
889#define IEEE80211_CAPINFO_SPECTRUM_MGMT 0x0100
890#define IEEE80211_CAPINFO_QOS 0x0200
891#define IEEE80211_CAPINFO_SHORT_SLOTTIME 0x0400
892#define IEEE80211_CAPINFO_APSD 0x0800
893#define IEEE80211_CAPINFO_RADIOMEAS 0x1000
894#define IEEE80211_CAPINFO_DSSSOFDM 0x2000
895/* bits 14-15 are reserved */
896
897/*
898 * 802.11i/WPA information element (maximally sized).
899 */
900struct ieee80211_ie_wpa {
901 uint8_t wpa_id; /* IEEE80211_ELEMID_VENDOR */
902 uint8_t wpa_len; /* length in bytes */
903 uint8_t wpa_oui[3]; /* 0x00, 0x50, 0xf2 */
904 uint8_t wpa_type; /* OUI type */
905 uint16_t wpa_version; /* spec revision */
906 uint32_t wpa_mcipher[1]; /* multicast/group key cipher */
907 uint16_t wpa_uciphercnt; /* # pairwise key ciphers */
908 uint32_t wpa_uciphers[8]; /* ciphers */
909 uint16_t wpa_authselcnt; /* authentication selector cnt */
910 uint32_t wpa_authsels[8]; /* selectors */
911 uint16_t wpa_caps; /* 802.11i capabilities */
912 uint16_t wpa_pmkidcnt; /* 802.11i pmkid count */
913 uint16_t wpa_pmkids[8]; /* 802.11i pmkids */
914} __packed;
915
916#ifndef _BYTE_ORDER
917#error "Don't know native byte order"
918#endif
919
920#ifndef IEEE80211N_IE
921/* Temporary vendor specific IE for 11n pre-standard interoperability */
922#define VENDOR_HT_OUI 0x00904c
923#define VENDOR_HT_CAP_ID 51
924#define VENDOR_HT_INFO_ID 52
925#endif
926
927#ifdef ATH_SUPPORT_TxBF
928union ieee80211_hc_txbf {
929 struct {
930#if _BYTE_ORDER == _BIG_ENDIAN
931 uint32_t reserved : 3,
932 channel_estimation_cap : 2,
933 csi_max_rows_bfer : 2,
934 comp_bfer_antennas : 2,
935 noncomp_bfer_antennas : 2,
936 csi_bfer_antennas : 2,
937 minimal_grouping : 2,
938 explicit_comp_bf : 2,
939 explicit_noncomp_bf : 2,
940 explicit_csi_feedback : 2,
941 explicit_comp_steering : 1,
942 explicit_noncomp_steering : 1,
943 explicit_csi_txbf_capable : 1,
944 calibration : 2,
945 implicit_txbf_capable : 1,
946 tx_ndp_capable : 1,
947 rx_ndp_capable : 1,
948 tx_staggered_sounding : 1,
949 rx_staggered_sounding : 1, implicit_rx_capable : 1;
950#else
951 uint32_t implicit_rx_capable : 1,
952 rx_staggered_sounding : 1,
953 tx_staggered_sounding : 1,
954 rx_ndp_capable : 1,
955 tx_ndp_capable : 1,
956 implicit_txbf_capable : 1,
957 calibration : 2,
958 explicit_csi_txbf_capable : 1,
959 explicit_noncomp_steering : 1,
960 explicit_comp_steering : 1,
961 explicit_csi_feedback : 2,
962 explicit_noncomp_bf : 2,
963 explicit_comp_bf : 2,
964 minimal_grouping : 2,
965 csi_bfer_antennas : 2,
966 noncomp_bfer_antennas : 2,
967 comp_bfer_antennas : 2,
968 csi_max_rows_bfer : 2, channel_estimation_cap : 2, reserved : 3;
969#endif
970 };
971
972 uint32_t value;
973} __packed;
974#endif
975
976struct ieee80211_ie_htcap_cmn {
977 uint16_t hc_cap; /* HT capabilities */
978#if _BYTE_ORDER == _BIG_ENDIAN
979 uint8_t hc_reserved : 3, /* B5-7 reserved */
980 hc_mpdudensity : 3, /* B2-4 MPDU density (aka Minimum MPDU Start Spacing) */
981 hc_maxampdu : 2; /* B0-1 maximum rx A-MPDU factor */
982#else
983 uint8_t hc_maxampdu : 2, /* B0-1 maximum rx A-MPDU factor */
984 hc_mpdudensity : 3, /* B2-4 MPDU density (aka Minimum MPDU Start Spacing) */
985 hc_reserved : 3; /* B5-7 reserved */
986#endif
987 uint8_t hc_mcsset[16]; /* supported MCS set */
988 uint16_t hc_extcap; /* extended HT capabilities */
989#ifdef ATH_SUPPORT_TxBF
990 union ieee80211_hc_txbf hc_txbf; /* txbf capabilities */
991#else
992 uint32_t hc_txbf; /* txbf capabilities */
993#endif
994 uint8_t hc_antenna; /* antenna capabilities */
995} __packed;
996
997/*
998 * 802.11n HT Capability IE
999 */
1000struct ieee80211_ie_htcap {
1001 uint8_t hc_id; /* element ID */
1002 uint8_t hc_len; /* length in bytes */
1003 struct ieee80211_ie_htcap_cmn hc_ie;
1004} __packed;
1005
1006/*
1007 * Temporary vendor private HT Capability IE
1008 */
1009struct vendor_ie_htcap {
1010 uint8_t hc_id; /* element ID */
1011 uint8_t hc_len; /* length in bytes */
1012 uint8_t hc_oui[3];
1013 uint8_t hc_ouitype;
1014 struct ieee80211_ie_htcap_cmn hc_ie;
1015} __packed;
1016
1017/* HT capability flags */
1018#define IEEE80211_HTCAP_C_ADVCODING 0x0001
1019#define IEEE80211_HTCAP_C_CHWIDTH40 0x0002
1020#define IEEE80211_HTCAP_C_SMPOWERSAVE_STATIC 0x0000 /* Capable of SM Power Save (Static) */
1021#define IEEE80211_HTCAP_C_SMPOWERSAVE_DYNAMIC 0x0004 /* Capable of SM Power Save (Dynamic) */
1022#define IEEE80211_HTCAP_C_SM_RESERVED 0x0008 /* Reserved */
1023#define IEEE80211_HTCAP_C_SM_ENABLED 0x000c /* SM enabled, no SM Power Save */
1024#define IEEE80211_HTCAP_C_GREENFIELD 0x0010
1025#define IEEE80211_HTCAP_C_SHORTGI20 0x0020
1026#define IEEE80211_HTCAP_C_SHORTGI40 0x0040
1027#define IEEE80211_HTCAP_C_TXSTBC 0x0080
1028#define IEEE80211_HTCAP_C_TXSTBC_S 7
1029#define IEEE80211_HTCAP_C_RXSTBC 0x0300 /* 2 bits */
1030#define IEEE80211_HTCAP_C_RXSTBC_S 8
1031#define IEEE80211_HTCAP_C_DELAYEDBLKACK 0x0400
1032#define IEEE80211_HTCAP_C_MAXAMSDUSIZE 0x0800 /* 1 = 8K, 0 = 3839B */
1033#define IEEE80211_HTCAP_C_DSSSCCK40 0x1000
1034#define IEEE80211_HTCAP_C_PSMP 0x2000
1035#define IEEE80211_HTCAP_C_INTOLERANT40 0x4000
1036#define IEEE80211_HTCAP_C_LSIGTXOPPROT 0x8000
1037
1038#define IEEE80211_HTCAP_C_SM_MASK 0x000c /* Spatial Multiplexing (SM) capabitlity bitmask */
1039
1040/* B0-1 maximum rx A-MPDU factor 2^(13+Max Rx A-MPDU Factor) */
1041enum {
1042 IEEE80211_HTCAP_MAXRXAMPDU_8192, /* 2 ^ 13 */
1043 IEEE80211_HTCAP_MAXRXAMPDU_16384, /* 2 ^ 14 */
1044 IEEE80211_HTCAP_MAXRXAMPDU_32768, /* 2 ^ 15 */
1045 IEEE80211_HTCAP_MAXRXAMPDU_65536, /* 2 ^ 16 */
1046};
1047#define IEEE80211_HTCAP_MAXRXAMPDU_FACTOR 13
1048
1049/* B2-4 MPDU density (usec) */
1050enum {
1051 IEEE80211_HTCAP_MPDUDENSITY_NA, /* No time restriction */
1052 IEEE80211_HTCAP_MPDUDENSITY_0_25, /* 1/4 usec */
1053 IEEE80211_HTCAP_MPDUDENSITY_0_5, /* 1/2 usec */
1054 IEEE80211_HTCAP_MPDUDENSITY_1, /* 1 usec */
1055 IEEE80211_HTCAP_MPDUDENSITY_2, /* 2 usec */
1056 IEEE80211_HTCAP_MPDUDENSITY_4, /* 4 usec */
1057 IEEE80211_HTCAP_MPDUDENSITY_8, /* 8 usec */
1058 IEEE80211_HTCAP_MPDUDENSITY_16, /* 16 usec */
1059};
1060
1061/* HT extended capability flags */
1062#define IEEE80211_HTCAP_EXTC_PCO 0x0001
1063#define IEEE80211_HTCAP_EXTC_TRANS_TIME_RSVD 0x0000
1064#define IEEE80211_HTCAP_EXTC_TRANS_TIME_400 0x0002 /* 20-40 switch time */
1065#define IEEE80211_HTCAP_EXTC_TRANS_TIME_1500 0x0004 /* in us */
1066#define IEEE80211_HTCAP_EXTC_TRANS_TIME_5000 0x0006
1067#define IEEE80211_HTCAP_EXTC_RSVD_1 0x00f8
1068#define IEEE80211_HTCAP_EXTC_MCS_FEEDBACK_NONE 0x0000
1069#define IEEE80211_HTCAP_EXTC_MCS_FEEDBACK_RSVD 0x0100
1070#define IEEE80211_HTCAP_EXTC_MCS_FEEDBACK_UNSOL 0x0200
1071#define IEEE80211_HTCAP_EXTC_MCS_FEEDBACK_FULL 0x0300
1072#define IEEE80211_HTCAP_EXTC_RSVD_2 0xfc00
1073#ifdef ATH_SUPPORT_TxBF
1074#define IEEE80211_HTCAP_EXTC_HTC_SUPPORT 0x0400
1075#endif
1076
1077struct ieee80211_ie_htinfo_cmn {
1078 uint8_t hi_ctrlchannel; /* control channel */
1079#if _BYTE_ORDER == _BIG_ENDIAN
1080 uint8_t hi_serviceinterval : 3, /* B5-7 svc interval granularity */
1081 hi_ctrlaccess : 1, /* B4 controlled access only */
1082 hi_rifsmode : 1, /* B3 rifs mode */
1083 hi_txchwidth : 1, /* B2 recommended xmiss width set */
1084 hi_extchoff : 2; /* B0-1 extension channel offset */
1085
1086/*
1087
1088 * The following 2 consecutive bytes are defined in word in 80211n spec.
1089
1090 * Some processors store MSB byte into lower memory address which causes wrong
1091
1092 * wrong byte sequence in beacon. Thus we break into byte definition which should
1093
1094 * avoid the problem for all processors
1095
1096 */
1097
1098 uint8_t hi_reserved3 : 3, /* B5-7 reserved */
1099 hi_obssnonhtpresent : 1, /* B4 OBSS non-HT STA present */
1100 hi_txburstlimit : 1, /* B3 transmit burst limit */
1101 hi_nongfpresent : 1, /* B2 non greenfield devices present */
1102 hi_opmode : 2; /* B0-1 operating mode */
1103
1104 uint8_t hi_reserved0; /* B0-7 (B8-15 in 11n) reserved */
1105
1106/* The following 2 consecutive bytes are defined in word in 80211n spec. */
1107
1108 uint8_t hi_dualctsprot : 1, /* B7 dual CTS protection */
1109 hi_dualbeacon : 1, /* B6 dual beacon */
1110 hi_reserved2 : 6; /* B0-5 reserved */
1111 uint8_t hi_reserved1 : 4, /* B4-7 (B12-15 in 11n) reserved */
1112 hi_pcophase : 1, /* B3 (B11 in 11n) pco phase */
1113 hi_pcoactive : 1, /* B2 (B10 in 11n) pco active */
1114 hi_lsigtxopprot : 1, /* B1 (B9 in 11n) l-sig txop protection full support */
1115 hi_stbcbeacon : 1; /* B0 (B8 in 11n) STBC beacon */
1116#else
1117 uint8_t hi_extchoff : 2, /* B0-1 extension channel offset */
1118 hi_txchwidth : 1, /* B2 recommended xmiss width set */
1119 hi_rifsmode : 1, /* B3 rifs mode */
1120 hi_ctrlaccess : 1, /* B4 controlled access only */
1121 hi_serviceinterval : 3; /* B5-7 svc interval granularity */
1122 uint16_t hi_opmode : 2, /* B0-1 operating mode */
1123 hi_nongfpresent : 1, /* B2 non greenfield devices present */
1124 hi_txburstlimit : 1, /* B3 transmit burst limit */
1125 hi_obssnonhtpresent : 1, /* B4 OBSS non-HT STA present */
1126 hi_reserved0 : 11; /* B5-15 reserved */
1127 uint16_t hi_reserved2 : 6, /* B0-5 reserved */
1128 hi_dualbeacon : 1, /* B6 dual beacon */
1129 hi_dualctsprot : 1, /* B7 dual CTS protection */
1130 hi_stbcbeacon : 1, /* B8 STBC beacon */
1131 hi_lsigtxopprot : 1, /* B9 l-sig txop protection full support */
1132 hi_pcoactive : 1, /* B10 pco active */
1133 hi_pcophase : 1, /* B11 pco phase */
1134 hi_reserved1 : 4; /* B12-15 reserved */
1135#endif
1136 uint8_t hi_basicmcsset[16]; /* basic MCS set */
1137} __packed;
1138
1139/*
1140 * 802.11n HT Information IE
1141 */
1142struct ieee80211_ie_htinfo {
1143 uint8_t hi_id; /* element ID */
1144 uint8_t hi_len; /* length in bytes */
1145 struct ieee80211_ie_htinfo_cmn hi_ie;
1146} __packed;
1147
1148/*
1149 * Temporary vendor private HT Information IE
1150 */
1151struct vendor_ie_htinfo {
1152 uint8_t hi_id; /* element ID */
1153 uint8_t hi_len; /* length in bytes */
1154 uint8_t hi_oui[3];
1155 uint8_t hi_ouitype;
1156 struct ieee80211_ie_htinfo_cmn hi_ie;
1157} __packed;
1158
1159/* extension channel offset (2 bit signed number) */
1160enum {
1161 IEEE80211_HTINFO_EXTOFFSET_NA = 0, /* 0 no extension channel is present */
1162 IEEE80211_HTINFO_EXTOFFSET_ABOVE = 1, /* +1 extension channel above control channel */
1163 IEEE80211_HTINFO_EXTOFFSET_UNDEF = 2, /* -2 undefined */
1164 IEEE80211_HTINFO_EXTOFFSET_BELOW = 3 /* -1 extension channel below control channel */
1165};
1166
1167/* recommended transmission width set */
1168enum {
1169 IEEE80211_HTINFO_TXWIDTH_20,
1170 IEEE80211_HTINFO_TXWIDTH_2040
1171};
1172
1173/* operating flags */
1174#define IEEE80211_HTINFO_OPMODE_PURE 0x00 /* no protection */
1175#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_OPT 0x01 /* prot optional (legacy device maybe present) */
1176#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_40 0x02 /* prot required (20 MHz) */
1177#define IEEE80211_HTINFO_OPMODE_MIXED_PROT_ALL 0x03 /* prot required (legacy devices present) */
1178#define IEEE80211_HTINFO_OPMODE_NON_GF_PRESENT 0x04 /* non-greenfield devices present */
1179
1180#define IEEE80211_HTINFO_OPMODE_MASK 0x03 /* For protection 0x00-0x03 */
1181
1182/* Non-greenfield STAs present */
1183enum {
1184 IEEE80211_HTINFO_NON_GF_NOT_PRESENT, /* Non-greenfield STAs not present */
1185 IEEE80211_HTINFO_NON_GF_PRESENT, /* Non-greenfield STAs present */
1186};
1187
1188/* Transmit Burst Limit */
1189enum {
1190 IEEE80211_HTINFO_TXBURST_UNLIMITED, /* Transmit Burst is unlimited */
1191 IEEE80211_HTINFO_TXBURST_LIMITED, /* Transmit Burst is limited */
1192};
1193
1194/* OBSS Non-HT STAs present */
1195enum {
1196 IEEE80211_HTINFO_OBSS_NONHT_NOT_PRESENT, /* OBSS Non-HT STAs not present */
1197 IEEE80211_HTINFO_OBSS_NONHT_PRESENT, /* OBSS Non-HT STAs present */
1198};
1199
1200/* misc flags */
1201#define IEEE80211_HTINFO_DUALBEACON 0x0040 /* B6 dual beacon */
1202#define IEEE80211_HTINFO_DUALCTSPROT 0x0080 /* B7 dual stbc protection */
1203#define IEEE80211_HTINFO_STBCBEACON 0x0100 /* B8 secondary beacon */
1204#define IEEE80211_HTINFO_LSIGTXOPPROT 0x0200 /* B9 lsig txop prot full support */
1205#define IEEE80211_HTINFO_PCOACTIVE 0x0400 /* B10 pco active */
1206#define IEEE80211_HTINFO_PCOPHASE 0x0800 /* B11 pco phase */
1207
1208/* Secondary Channel offset for for 40MHz direct link */
1209#define IEEE80211_SECONDARY_CHANNEL_ABOVE 1
1210#define IEEE80211_SECONDARY_CHANNEL_BELOW 3
1211
1212#define IEEE80211_TDLS_CHAN_SX_PROHIBIT 0x00000002 /* bit-2 TDLS Channel Switch Prohibit */
1213
1214/* RIFS mode */
1215enum {
1216 IEEE80211_HTINFO_RIFSMODE_PROHIBITED, /* use of rifs prohibited */
1217 IEEE80211_HTINFO_RIFSMODE_ALLOWED, /* use of rifs permitted */
1218};
1219
1220/*
1221 * Management information element payloads.
1222 */
1223enum {
1224 IEEE80211_ELEMID_SSID = 0,
1225 IEEE80211_ELEMID_RATES = 1,
1226 IEEE80211_ELEMID_FHPARMS = 2,
1227 IEEE80211_ELEMID_DSPARMS = 3,
1228 IEEE80211_ELEMID_CFPARMS = 4,
1229 IEEE80211_ELEMID_TIM = 5,
1230 IEEE80211_ELEMID_IBSSPARMS = 6,
1231 IEEE80211_ELEMID_COUNTRY = 7,
1232 IEEE80211_ELEMID_REQINFO = 10,
1233 IEEE80211_ELEMID_QBSS_LOAD = 11,
1234 IEEE80211_ELEMID_TCLAS = 14,
1235 IEEE80211_ELEMID_CHALLENGE = 16,
1236 /* 17-31 reserved for challenge text extension */
1237 IEEE80211_ELEMID_PWRCNSTR = 32,
1238 IEEE80211_ELEMID_PWRCAP = 33,
1239 IEEE80211_ELEMID_TPCREQ = 34,
1240 IEEE80211_ELEMID_TPCREP = 35,
1241 IEEE80211_ELEMID_SUPPCHAN = 36,
1242 IEEE80211_ELEMID_CHANSWITCHANN = 37,
1243 IEEE80211_ELEMID_MEASREQ = 38,
1244 IEEE80211_ELEMID_MEASREP = 39,
1245 IEEE80211_ELEMID_QUIET = 40,
1246 IEEE80211_ELEMID_IBSSDFS = 41,
1247 IEEE80211_ELEMID_ERP = 42,
1248 IEEE80211_ELEMID_TCLAS_PROCESS = 44,
1249 IEEE80211_ELEMID_HTCAP_ANA = 45,
1250 IEEE80211_ELEMID_RESERVED_47 = 47,
1251 IEEE80211_ELEMID_RSN = 48,
1252 IEEE80211_ELEMID_XRATES = 50,
1253 IEEE80211_ELEMID_HTCAP = 51,
1254 IEEE80211_ELEMID_HTINFO = 52,
1255 IEEE80211_ELEMID_MOBILITY_DOMAIN = 54,
1256 IEEE80211_ELEMID_FT = 55,
1257 IEEE80211_ELEMID_TIMEOUT_INTERVAL = 56,
1258 IEEE80211_ELEMID_EXTCHANSWITCHANN = 60,
1259 IEEE80211_ELEMID_HTINFO_ANA = 61,
1260 IEEE80211_ELEMID_SECCHANOFFSET = 62,
1261 IEEE80211_ELEMID_WAPI = 68, /*IE for WAPI */
1262 IEEE80211_ELEMID_TIME_ADVERTISEMENT = 69,
1263 IEEE80211_ELEMID_RRM = 70, /* Radio resource measurement */
1264 IEEE80211_ELEMID_2040_COEXT = 72,
1265 IEEE80211_ELEMID_2040_INTOL = 73,
1266 IEEE80211_ELEMID_OBSS_SCAN = 74,
1267 IEEE80211_ELEMID_MMIE = 76, /* 802.11w Management MIC IE */
1268 IEEE80211_ELEMID_FMS_DESCRIPTOR = 86, /* 802.11v FMS descriptor IE */
1269 IEEE80211_ELEMID_FMS_REQUEST = 87, /* 802.11v FMS request IE */
1270 IEEE80211_ELEMID_FMS_RESPONSE = 88, /* 802.11v FMS response IE */
1271 IEEE80211_ELEMID_BSSMAX_IDLE_PERIOD = 90, /* BSS MAX IDLE PERIOD */
1272 IEEE80211_ELEMID_TFS_REQUEST = 91,
1273 IEEE80211_ELEMID_TFS_RESPONSE = 92,
1274 IEEE80211_ELEMID_TIM_BCAST_REQUEST = 94,
1275 IEEE80211_ELEMID_TIM_BCAST_RESPONSE = 95,
1276 IEEE80211_ELEMID_INTERWORKING = 107,
1277 IEEE80211_ELEMID_XCAPS = 127,
1278 IEEE80211_ELEMID_RESERVED_133 = 133,
1279 IEEE80211_ELEMID_TPC = 150,
1280 IEEE80211_ELEMID_CCKM = 156,
1281 IEEE80211_ELEMID_VHTCAP = 191, /* VHT Capabilities */
1282 IEEE80211_ELEMID_VHTOP = 192, /* VHT Operation */
1283 IEEE80211_ELEMID_EXT_BSS_LOAD = 193, /* Extended BSS Load */
1284 IEEE80211_ELEMID_WIDE_BAND_CHAN_SWITCH = 194, /* Wide Band Channel Switch */
1285 IEEE80211_ELEMID_VHT_TX_PWR_ENVLP = 195, /* VHT Transmit Power Envelope */
1286 IEEE80211_ELEMID_CHAN_SWITCH_WRAP = 196, /* Channel Switch Wrapper */
1287 IEEE80211_ELEMID_AID = 197, /* AID */
1288 IEEE80211_ELEMID_QUIET_CHANNEL = 198, /* Quiet Channel */
1289 IEEE80211_ELEMID_OP_MODE_NOTIFY = 199, /* Operating Mode Notification */
1290 IEEE80211_ELEMID_VENDOR = 221, /* vendor private */
1291};
1292
1293#define IEEE80211_MAX_IE_LEN 255
1294#define IEEE80211_RSN_IE_LEN 22
1295
1296#define IEEE80211_CHANSWITCHANN_BYTES 5
1297#define IEEE80211_EXTCHANSWITCHANN_BYTES 6
1298
1299/* TODO -> Need to Check Redefinition Error used in only UMAC */
1300#if 0
1301struct ieee80211_tim_ie {
1302 uint8_t tim_ie; /* IEEE80211_ELEMID_TIM */
1303 uint8_t tim_len;
1304 uint8_t tim_count; /* DTIM count */
1305 uint8_t tim_period; /* DTIM period */
1306 uint8_t tim_bitctl; /* bitmap control */
1307 uint8_t tim_bitmap[1]; /* variable-length bitmap */
1308} __packed;
1309#endif
1310
1311/* Country IE channel triplet */
1312struct country_ie_triplet {
1313 union {
1314 uint8_t schan; /* starting channel */
1315 uint8_t regextid; /* Regulatory Extension Identifier */
1316 };
1317 union {
1318 uint8_t nchan; /* number of channels */
1319 uint8_t regclass; /* Regulatory Class */
1320 };
1321 union {
1322 uint8_t maxtxpwr; /* tx power */
1323 uint8_t coverageclass; /* Coverage Class */
1324 };
1325} __packed;
1326
1327struct ieee80211_country_ie {
1328 uint8_t ie; /* IEEE80211_ELEMID_COUNTRY */
1329 uint8_t len;
1330 uint8_t cc[3]; /* ISO CC+(I)ndoor/(O)utdoor */
1331 struct country_ie_triplet triplet[1];
1332} __packed;
1333
1334struct ieee80211_fh_ie {
1335 uint8_t ie; /* IEEE80211_ELEMID_FHPARMS */
1336 uint8_t len;
1337 uint16_t dwell_time; /* endianess?? */
1338 uint8_t hop_set;
1339 uint8_t hop_pattern;
1340 uint8_t hop_index;
1341} __packed;
1342
1343struct ieee80211_ds_ie {
1344 uint8_t ie; /* IEEE80211_ELEMID_DSPARMS */
1345 uint8_t len;
1346 uint8_t current_channel;
1347} __packed;
1348
1349struct ieee80211_erp_ie {
1350 uint8_t ie; /* IEEE80211_ELEMID_ERP */
1351 uint8_t len;
1352 uint8_t value;
1353} __packed;
1354
1355/* TODO -> Need to Check Redefinition Error used in only UMAC */
1356#if 0
1357struct ieee80211_quiet_ie {
1358 uint8_t ie; /* IEEE80211_ELEMID_QUIET */
1359 uint8_t len;
1360 uint8_t tbttcount; /* quiet start */
1361 uint8_t period; /* beacon intervals between quiets */
1362 uint16_t duration; /* TUs of each quiet */
1363 uint16_t offset; /* TUs of from TBTT of quiet start */
1364} __packed;
1365#endif
1366
1367struct ieee80211_channelswitch_ie {
1368 uint8_t ie; /* IEEE80211_ELEMID_CHANSWITCHANN */
1369 uint8_t len;
1370 uint8_t switchmode;
1371 uint8_t newchannel;
1372 uint8_t tbttcount;
1373} __packed;
1374
1375/* channel switch action frame format definition */
1376struct ieee80211_action_spectrum_channel_switch {
1377 struct ieee80211_action csa_header;
1378 struct ieee80211_channelswitch_ie csa_element;
1379} __packed;
1380
1381struct ieee80211_extendedchannelswitch_ie {
1382 uint8_t ie; /* IEEE80211_ELEMID_EXTCHANSWITCHANN */
1383 uint8_t len;
1384 uint8_t switchmode;
1385 uint8_t newClass;
1386 uint8_t newchannel;
1387 uint8_t tbttcount;
1388} __packed;
1389
1390struct ieee80211_tpc_ie {
1391 uint8_t ie;
1392 uint8_t len;
1393 uint8_t pwrlimit;
1394} __packed;
1395
1396/*
1397 * MHDRIE included in TKIP MFP protected management frames
1398 */
1399struct ieee80211_ese_mhdr_ie {
1400 uint8_t mhdr_id;
1401 uint8_t mhdr_len;
1402 uint8_t mhdr_oui[3];
1403 uint8_t mhdr_oui_type;
1404 uint8_t mhdr_fc[2];
1405 uint8_t mhdr_bssid[IEEE80211_ADDR_LEN];
1406} __packed;
1407
1408/*
1409 * SSID IE
1410 */
1411struct ieee80211_ie_ssid {
1412 uint8_t ssid_id;
1413 uint8_t ssid_len;
1414 uint8_t ssid[32];
1415} __packed;
1416
1417/*
1418 * Supported rates
1419 */
1420#define IEEE80211_MAX_SUPPORTED_RATES 8
1421
1422struct ieee80211_ie_rates {
1423 uint8_t rate_id; /* Element Id */
1424 uint8_t rate_len; /* IE Length */
1425 uint8_t rate[IEEE80211_MAX_SUPPORTED_RATES]; /* IE Length */
1426} __packed;
1427
1428/*
1429 * Extended rates
1430 */
1431#define IEEE80211_MAX_EXTENDED_RATES 256
1432
1433struct ieee80211_ie_xrates {
1434 uint8_t xrate_id; /* Element Id */
1435 uint8_t xrate_len; /* IE Length */
1436 uint8_t xrate[IEEE80211_MAX_EXTENDED_RATES]; /* IE Length */
1437} __packed;
1438
1439/*
1440 * WPS SSID list information element (maximally sized).
1441 */
1442struct ieee80211_ie_ssidl {
1443 uint8_t ssidl_id; /* IEEE80211_ELEMID_VENDOR */
1444 uint8_t ssidl_len; /* length in bytes */
1445 uint8_t ssidl_oui[3]; /* 0x00, 0x50, 0xf2 */
1446 uint8_t ssidl_type; /* OUI type */
1447 uint8_t ssidl_prim_cap; /* Primary capabilities */
1448 uint8_t ssidl_count; /* # of secondary SSIDs */
1449 uint16_t ssidl_value[248];
1450} __packed;
1451
1452#if _BYTE_ORDER == _BIG_ENDIAN
1453struct ieee80211_sec_ssid_cap {
1454 uint32_t reserved0 : 1,
1455 akmlist : 6, reserved1 : 4, reeserved2 : 2, ucipher : 15, mcipher : 4;
1456};
1457#else
1458struct ieee80211_sec_ssid_cap {
1459 uint32_t mcipher : 4,
1460 ucipher : 15, reserved2 : 2, reserved1 : 4, akmlist : 6, reserved0 : 1;
1461};
1462#endif
1463
1464struct ieee80211_ie_qbssload {
1465 uint8_t elem_id; /* IEEE80211_ELEMID_QBSS_LOAD */
1466 uint8_t length; /* length in bytes */
1467 uint16_t station_count; /* number of station associated */
1468 uint8_t channel_utilization; /* channel busy time in 0-255 scale */
1469 uint16_t aac; /* available admission capacity */
1470} __packed;
1471
1472#define SEC_SSID_HEADER_LEN 6
1473#define SSIDL_IE_HEADER_LEN 6
1474
1475struct ieee80211_sec_ssid {
1476 uint8_t sec_ext_cap;
1477 struct ieee80211_sec_ssid_cap sec_cap;
1478 uint8_t sec_ssid_len;
1479 uint8_t sec_ssid[32];
1480} __packed;
1481
1482/* Definitions of SSIDL IE */
1483enum {
1484 CAP_MCIPHER_ENUM_NONE = 0,
1485 CAP_MCIPHER_ENUM_WEP40,
1486 CAP_MCIPHER_ENUM_WEP104,
1487 CAP_MCIPHER_ENUM_TKIP,
1488 CAP_MCIPHER_ENUM_CCMP,
1489 CAP_MCIPHER_ENUM_CKIP_CMIC,
1490 CAP_MCIPHER_ENUM_CKIP,
1491 CAP_MCIPHER_ENUM_CMIC
1492};
1493
1494#define CAP_UCIPHER_BIT_NONE 0x0001
1495#define CAP_UCIPHER_BIT_WEP40 0x0002
1496#define CAP_UCIPHER_BIT_WEP104 0x0004
1497#define CAP_UCIPHER_BIT_TKIP 0x0008
1498#define CAP_UCIPHER_BIT_CCMP 0x0010
1499#define CAP_UCIPHER_BIT_CKIP_CMIC 0x0020
1500#define CAP_UCIPHER_BIT_CKIP 0x0040
1501#define CAP_UCIPHER_BIT_CMIC 0x0080
1502#define CAP_UCIPHER_BIT_WPA2_WEP40 0x0100
1503#define CAP_UCIPHER_BIT_WPA2_WEP104 0x0200
1504#define CAP_UCIPHER_BIT_WPA2_TKIP 0x0400
1505#define CAP_UCIPHER_BIT_WPA2_CCMP 0x0800
1506#define CAP_UCIPHER_BIT_WPA2_CKIP_CMIC 0x1000
1507#define CAP_UCIPHER_BIT_WPA2_CKIP 0x2000
1508#define CAP_UCIPHER_BIT_WPA2_CMIC 0x4000
1509
1510#define CAP_AKM_BIT_WPA1_1X 0x01
1511#define CAP_AKM_BIT_WPA1_PSK 0x02
1512#define CAP_AKM_BIT_WPA2_1X 0x04
1513#define CAP_AKM_BIT_WPA2_PSK 0x08
1514#define CAP_AKM_BIT_WPA1_CCKM 0x10
1515#define CAP_AKM_BIT_WPA2_CCKM 0x20
1516
1517#define IEEE80211_CHALLENGE_LEN 128
1518
1519#define IEEE80211_SUPPCHAN_LEN 26
1520
1521#define IEEE80211_RATE_BASIC 0x80
1522#define IEEE80211_RATE_VAL 0x7f
1523
1524/* EPR information element flags */
1525#define IEEE80211_ERP_NON_ERP_PRESENT 0x01
1526#define IEEE80211_ERP_USE_PROTECTION 0x02
1527#define IEEE80211_ERP_LONG_PREAMBLE 0x04
1528
1529/* Atheros private advanced capabilities info */
1530#define ATHEROS_CAP_TURBO_PRIME 0x01
1531#define ATHEROS_CAP_COMPRESSION 0x02
1532#define ATHEROS_CAP_FAST_FRAME 0x04
1533/* bits 3-6 reserved */
1534#define ATHEROS_CAP_BOOST 0x80
1535
1536#define ATH_OUI 0x7f0300 /* Atheros OUI */
1537#define ATH_OUI_TYPE 0x01
1538#define ATH_OUI_SUBTYPE 0x01
1539#define ATH_OUI_VERSION 0x00
1540#define ATH_OUI_TYPE_XR 0x03
1541#define ATH_OUI_VER_XR 0x01
1542#define ATH_OUI_EXTCAP_TYPE 0x04 /* Atheros Extended Cap Type */
1543#define ATH_OUI_EXTCAP_SUBTYPE 0x01 /* Atheros Extended Cap Sub-type */
1544#define ATH_OUI_EXTCAP_VERSION 0x00 /* Atheros Extended Cap Version */
1545
1546#define WPA_OUI 0xf25000
1547#define WPA_VERSION 1 /* current supported version */
1548#define CSCO_OUI 0x964000 /* Cisco OUI */
1549#define AOW_OUI 0x4a0100 /* AoW OUI, workaround */
1550#define AOW_OUI_TYPE 0x01
1551#define AOW_OUI_VERSION 0x01
1552
1553#define WSC_OUI 0x0050f204
1554
1555#define WPA_CSE_NULL 0x00
1556#define WPA_CSE_WEP40 0x01
1557#define WPA_CSE_TKIP 0x02
1558#define WPA_CSE_CCMP 0x04
1559#define WPA_CSE_WEP104 0x05
1560
1561#define WPA_ASE_NONE 0x00
1562#define WPA_ASE_8021X_UNSPEC 0x01
1563#define WPA_ASE_8021X_PSK 0x02
1564#define WPA_ASE_FT_IEEE8021X 0x20
1565#define WPA_ASE_FT_PSK 0x40
1566#define WPA_ASE_SHA256_IEEE8021X 0x80
1567#define WPA_ASE_SHA256_PSK 0x100
1568#define WPA_ASE_WPS 0x200
1569
1570#define RSN_OUI 0xac0f00
1571#define RSN_VERSION 1 /* current supported version */
1572
1573#define RSN_CSE_NULL 0x00
1574#define RSN_CSE_WEP40 0x01
1575#define RSN_CSE_TKIP 0x02
1576#define RSN_CSE_WRAP 0x03
1577#define RSN_CSE_CCMP 0x04
1578#define RSN_CSE_WEP104 0x05
1579#define RSN_CSE_AES_CMAC 0x06
1580
1581#define RSN_ASE_NONE 0x00
1582#define RSN_ASE_8021X_UNSPEC 0x01
1583#define RSN_ASE_8021X_PSK 0x02
1584#define RSN_ASE_FT_IEEE8021X 0x20
1585#define RSN_ASE_FT_PSK 0x40
1586#define RSN_ASE_SHA256_IEEE8021X 0x80
1587#define RSN_ASE_SHA256_PSK 0x100
1588#define RSN_ASE_WPS 0x200
1589
1590#define AKM_SUITE_TYPE_IEEE8021X 0x01
1591#define AKM_SUITE_TYPE_PSK 0x02
1592#define AKM_SUITE_TYPE_FT_IEEE8021X 0x03
1593#define AKM_SUITE_TYPE_FT_PSK 0x04
1594#define AKM_SUITE_TYPE_SHA256_IEEE8021X 0x05
1595#define AKM_SUITE_TYPE_SHA256_PSK 0x06
1596
1597#define RSN_CAP_PREAUTH 0x01
1598#define RSN_CAP_PTKSA_REPLAYCOUNTER 0x0c
1599#define RSN_CAP_GTKSA_REPLAYCOUNTER 0x30
1600#define RSN_CAP_MFP_REQUIRED 0x40
1601#define RSN_CAP_MFP_ENABLED 0x80
1602
1603#define CCKM_OUI 0x964000
1604#define CCKM_ASE_UNSPEC 0
1605#define WPA_CCKM_AKM 0x00964000
1606#define RSN_CCKM_AKM 0x00964000
1607
1608#define WME_OUI 0xf25000
1609#define WME_OUI_TYPE 0x02
1610#define WME_INFO_OUI_SUBTYPE 0x00
1611#define WME_PARAM_OUI_SUBTYPE 0x01
1612#define WME_TSPEC_OUI_SUBTYPE 0x02
1613
1614#define WME_PARAM_OUI_VERSION 1
1615#define WME_TSPEC_OUI_VERSION 1
1616#define WME_VERSION 1
1617
1618/* WME stream classes */
1619#define WME_AC_BE 0 /* best effort */
1620#define WME_AC_BK 1 /* background */
1621#define WME_AC_VI 2 /* video */
1622#define WME_AC_VO 3 /* voice */
1623
1624/* WCN IE */
1625#define WCN_OUI 0xf25000 /* Microsoft OUI */
1626#define WCN_OUI_TYPE 0x04 /* WCN */
1627
1628/* Atheros htoui for ht vender ie; use Epigram OUI for compatibility with pre11n devices */
1629#define ATH_HTOUI 0x00904c
1630
1631#define SFA_OUI 0x964000
1632#define SFA_OUI_TYPE 0x14
1633#define SFA_IE_CAP_MFP 0x01
1634#define SFA_IE_CAP_DIAG_CHANNEL 0x02
1635#define SFA_IE_CAP_LOCATION_SVCS 0x04
1636#define SFA_IE_CAP_EXP_BANDWIDTH 0x08
1637
1638#define WPA_OUI_BYTES 0x00, 0x50, 0xf2
1639#define RSN_OUI_BYTES 0x00, 0x0f, 0xac
1640#define WME_OUI_BYTES 0x00, 0x50, 0xf2
1641#define ATH_OUI_BYTES 0x00, 0x03, 0x7f
1642#define SFA_OUI_BYTES 0x00, 0x40, 0x96
1643#define CCKM_OUI_BYTES 0x00, 0x40, 0x96
1644#define WPA_SEL(x) (((x)<<24)|WPA_OUI)
1645#define RSN_SEL(x) (((x)<<24)|RSN_OUI)
1646#define SFA_SEL(x) (((x)<<24)|SFA_OUI)
1647#define CCKM_SEL(x) (((x)<<24)|CCKM_OUI)
1648
1649#define IEEE80211_RV(v) ((v) & IEEE80211_RATE_VAL)
1650
1651/*
1652 * AUTH management packets
1653 *
1654 * octet algo[2]
1655 * octet seq[2]
1656 * octet status[2]
1657 * octet chal.id
1658 * octet chal.length
1659 * octet chal.text[253]
1660 */
1661
1662typedef uint8_t *ieee80211_mgt_auth_t;
1663
1664#define IEEE80211_AUTH_ALGORITHM(auth) \
1665 ((auth)[0] | ((auth)[1] << 8))
1666#define IEEE80211_AUTH_TRANSACTION(auth) \
1667 ((auth)[2] | ((auth)[3] << 8))
1668#define IEEE80211_AUTH_STATUS(auth) \
1669 ((auth)[4] | ((auth)[5] << 8))
1670
1671#define IEEE80211_AUTH_ALG_OPEN 0x0000
1672#define IEEE80211_AUTH_ALG_SHARED 0x0001
1673#define IEEE80211_AUTH_ALG_FT 0x0002
1674#define IEEE80211_AUTH_ALG_LEAP 0x0080
1675
1676enum {
1677 IEEE80211_AUTH_OPEN_REQUEST = 1,
1678 IEEE80211_AUTH_OPEN_RESPONSE = 2,
1679};
1680
1681enum {
1682 IEEE80211_AUTH_SHARED_REQUEST = 1,
1683 IEEE80211_AUTH_SHARED_CHALLENGE = 2,
1684 IEEE80211_AUTH_SHARED_RESPONSE = 3,
1685 IEEE80211_AUTH_SHARED_PASS = 4,
1686};
1687
1688/*
1689 * Reason codes
1690 *
1691 * Unlisted codes are reserved
1692 */
1693
1694enum {
1695 IEEE80211_REASON_UNSPECIFIED = 1,
1696 IEEE80211_REASON_AUTH_EXPIRE = 2,
1697 IEEE80211_REASON_AUTH_LEAVE = 3,
1698 IEEE80211_REASON_ASSOC_EXPIRE = 4,
1699 IEEE80211_REASON_ASSOC_TOOMANY = 5,
1700 IEEE80211_REASON_NOT_AUTHED = 6,
1701 IEEE80211_REASON_NOT_ASSOCED = 7,
1702 IEEE80211_REASON_ASSOC_LEAVE = 8,
1703 IEEE80211_REASON_ASSOC_NOT_AUTHED = 9,
1704
1705 IEEE80211_REASON_RSN_REQUIRED = 11,
1706 IEEE80211_REASON_RSN_INCONSISTENT = 12,
1707 IEEE80211_REASON_IE_INVALID = 13,
1708 IEEE80211_REASON_MIC_FAILURE = 14,
1709
1710 IEEE80211_REASON_QOS = 32,
1711 IEEE80211_REASON_QOS_BANDWITDH = 33,
1712 IEEE80211_REASON_QOS_CH_CONDITIONS = 34,
1713 IEEE80211_REASON_QOS_TXOP = 35,
1714 IEEE80211_REASON_QOS_LEAVE = 36,
1715 IEEE80211_REASON_QOS_DECLINED = 37,
1716 IEEE80211_REASON_QOS_SETUP_REQUIRED = 38,
1717 IEEE80211_REASON_QOS_TIMEOUT = 39,
1718 IEEE80211_REASON_QOS_CIPHER = 45,
1719
1720 IEEE80211_STATUS_SUCCESS = 0,
1721 IEEE80211_STATUS_UNSPECIFIED = 1,
1722 IEEE80211_STATUS_CAPINFO = 10,
1723 IEEE80211_STATUS_NOT_ASSOCED = 11,
1724 IEEE80211_STATUS_OTHER = 12,
1725 IEEE80211_STATUS_ALG = 13,
1726 IEEE80211_STATUS_SEQUENCE = 14,
1727 IEEE80211_STATUS_CHALLENGE = 15,
1728 IEEE80211_STATUS_TIMEOUT = 16,
1729 IEEE80211_STATUS_TOOMANY = 17,
1730 IEEE80211_STATUS_BASIC_RATE = 18,
1731 IEEE80211_STATUS_SP_REQUIRED = 19,
1732 IEEE80211_STATUS_PBCC_REQUIRED = 20,
1733 IEEE80211_STATUS_CA_REQUIRED = 21,
1734 IEEE80211_STATUS_TOO_MANY_STATIONS = 22,
1735 IEEE80211_STATUS_RATES = 23,
1736 IEEE80211_STATUS_SHORTSLOT_REQUIRED = 25,
1737 IEEE80211_STATUS_DSSSOFDM_REQUIRED = 26,
1738 IEEE80211_STATUS_NO_HT = 27,
1739 IEEE80211_STATUS_REJECT_TEMP = 30,
1740 IEEE80211_STATUS_MFP_VIOLATION = 31,
1741 IEEE80211_STATUS_REFUSED = 37,
1742 IEEE80211_STATUS_INVALID_PARAM = 38,
1743
1744 IEEE80211_STATUS_DLS_NOT_ALLOWED = 48,
1745};
1746
1747/* private IEEE80211_STATUS */
1748#define IEEE80211_STATUS_CANCEL -1
1749#define IEEE80211_STATUS_INVALID_IE -2
1750#define IEEE80211_STATUS_INVALID_CHANNEL -3
1751
1752#define IEEE80211_WEP_KEYLEN 5 /* 40bit */
1753#define IEEE80211_WEP_IVLEN 3 /* 24bit */
1754#define IEEE80211_WEP_KIDLEN 1 /* 1 octet */
1755#define IEEE80211_WEP_CRCLEN 4 /* CRC-32 */
1756#define IEEE80211_WEP_NKID 4 /* number of key ids */
1757
1758/*
1759 * 802.11i defines an extended IV for use with non-WEP ciphers.
1760 * When the EXTIV bit is set in the key id byte an additional
1761 * 4 bytes immediately follow the IV for TKIP. For CCMP the
1762 * EXTIV bit is likewise set but the 8 bytes represent the
1763 * CCMP header rather than IV+extended-IV.
1764 */
1765#define IEEE80211_WEP_EXTIV 0x20
1766#define IEEE80211_WEP_EXTIVLEN 4 /* extended IV length */
1767#define IEEE80211_WEP_MICLEN 8 /* trailing MIC */
1768
1769#define IEEE80211_CCMP_HEADERLEN 8
1770#define IEEE80211_CCMP_MICLEN 8
1771
1772/*
1773 * 802.11w defines a MMIE chunk to be attached at the end of
1774 * any outgoing broadcast or multicast robust management frame.
1775 * MMIE field is total 18 bytes in size. Following the diagram of MMIE
1776 *
1777 * <------------ 18 Bytes MMIE ----------------------->
1778 * +--------+---------+---------+-----------+---------+
1779 * |Element | Length | Key id | IPN | MIC |
1780 * | id | | | | |
1781 * +--------+---------+---------+-----------+---------+
1782 * bytes 1 1 2 6 8
1783 *
1784 */
1785#define IEEE80211_MMIE_LEN 18
1786#define IEEE80211_MMIE_ELEMENTIDLEN 1
1787#define IEEE80211_MMIE_LENGTHLEN 1
1788#define IEEE80211_MMIE_KEYIDLEN 2
1789#define IEEE80211_MMIE_IPNLEN 6
1790#define IEEE80211_MMIE_MICLEN 8
1791
1792#define IEEE80211_CRC_LEN 4
1793
1794#define IEEE80211_8021Q_HEADER_LEN 4
1795/*
1796 * Maximum acceptable MTU is:
1797 * IEEE80211_MAX_LEN - WEP overhead - CRC -
1798 * QoS overhead - RSN/WPA overhead
1799 * Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default
1800 * mtu is Ethernet-compatible; it's set by ether_ifattach.
1801 */
1802#define IEEE80211_MTU_MAX 2290
1803#define IEEE80211_MTU_MIN 32
1804
1805/* Rather than using this default value, customer platforms can provide a custom value for this constant.
1806 Coustomer platform will use the different define value by themself */
1807#ifndef IEEE80211_MAX_MPDU_LEN
1808#define IEEE80211_MAX_MPDU_LEN (3840 + IEEE80211_CRC_LEN + \
1809 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
1810#endif
1811#define IEEE80211_ACK_LEN \
1812 (sizeof(struct ieee80211_frame_ack) + IEEE80211_CRC_LEN)
1813#define IEEE80211_MIN_LEN \
1814 (sizeof(struct ieee80211_frame_min) + IEEE80211_CRC_LEN)
1815
1816/* An 802.11 data frame can be one of three types:
1817 1. An unaggregated frame: The maximum length of an unaggregated data frame is 2324 bytes + headers.
1818 2. A data frame that is part of an AMPDU: The maximum length of an AMPDU may be upto 65535 bytes, but data frame is limited to 2324 bytes + header.
1819 3. An AMSDU: The maximum length of an AMSDU is eihther 3839 or 7095 bytes.
1820 The maximum frame length supported by hardware is 4095 bytes.
1821 A length of 3839 bytes is chosen here to support unaggregated data frames, any size AMPDUs and 3839 byte AMSDUs.
1822 */
1823#define IEEE80211N_MAX_FRAMELEN 3839
1824#define IEEE80211N_MAX_LEN (IEEE80211N_MAX_FRAMELEN + IEEE80211_CRC_LEN + \
1825 (IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
1826
1827#define IEEE80211_TX_CHAINMASK_MIN 1
1828#define IEEE80211_TX_CHAINMASK_MAX 7
1829
1830#define IEEE80211_RX_CHAINMASK_MIN 1
1831#define IEEE80211_RX_CHAINMASK_MAX 7
1832
1833/*
1834 * The 802.11 spec says at most 2007 stations may be
1835 * associated at once. For most AP's this is way more
1836 * than is feasible so we use a default of 128. This
1837 * number may be overridden by the driver and/or by
1838 * user configuration.
1839 */
1840#define IEEE80211_AID_MAX 2007
1841#define IEEE80211_AID_DEF 128
1842
Srinivas Girigowdaea4d8062017-10-14 12:40:48 -07001843#define IEEE80211_AID(b) ((b) & ~0xc000)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001844
1845/*
1846 * RTS frame length parameters. The default is specified in
1847 * the 802.11 spec. The max may be wrong for jumbo frames.
1848 */
1849#define IEEE80211_RTS_DEFAULT 512
1850#define IEEE80211_RTS_MIN 0
1851#define IEEE80211_RTS_MAX 2347
1852
1853/*
1854 * Fragmentation limits
1855 */
1856#define IEEE80211_FRAGMT_THRESHOLD_MIN 540 /* min frag threshold */
1857#define IEEE80211_FRAGMT_THRESHOLD_MAX 2346 /* max frag threshold */
1858
1859/*
1860 * Regulatory extention identifier for country IE.
1861 */
1862#define IEEE80211_REG_EXT_ID 201
1863
1864/*
1865 * overlapping BSS
1866 */
1867#define IEEE80211_OBSS_SCAN_PASSIVE_DWELL_DEF 20
1868#define IEEE80211_OBSS_SCAN_ACTIVE_DWELL_DEF 10
1869#define IEEE80211_OBSS_SCAN_INTERVAL_DEF 300
1870#define IEEE80211_OBSS_SCAN_PASSIVE_TOTAL_DEF 200
1871#define IEEE80211_OBSS_SCAN_ACTIVE_TOTAL_DEF 20
1872#define IEEE80211_OBSS_SCAN_THRESH_DEF 25
1873#define IEEE80211_OBSS_SCAN_DELAY_DEF 5
1874
1875/*
1876 * overlapping BSS scan ie
1877 */
1878struct ieee80211_ie_obss_scan {
1879 uint8_t elem_id;
1880 uint8_t elem_len;
1881 uint16_t scan_passive_dwell;
1882 uint16_t scan_active_dwell;
1883 uint16_t scan_interval;
1884 uint16_t scan_passive_total;
1885 uint16_t scan_active_total;
1886 uint16_t scan_delay;
1887 uint16_t scan_thresh;
1888} __packed;
1889
1890/*
1891 * Extended capability ie
1892 */
1893struct ieee80211_ie_ext_cap {
1894 uint8_t elem_id;
1895 uint8_t elem_len;
1896 uint32_t ext_capflags;
1897 uint32_t ext_capflags2;
1898} __packed;
1899
1900/* Extended capability IE flags */
1901#define IEEE80211_EXTCAPIE_2040COEXTMGMT 0x00000001
1902#define IEEE80211_EXTCAPIE_TFS 0x00010000
1903#define IEEE80211_EXTCAPIE_FMS 0x00000800
1904#define IEEE80211_EXTCAPIE_WNMSLEEPMODE 0x00020000
1905#define IEEE80211_EXTCAPIE_TIMBROADCAST 0x00040000
1906#define IEEE80211_EXTCAPIE_PROXYARP 0x00001000
1907#define IEEE80211_EXTCAPIE_BSSTRANSITION 0x00080000
1908/* Tunneled Direct Link Setup (TDLS) extended capability bits */
1909#define IEEE80211_EXTCAPIE_PEER_UAPSD_BUF_STA 0x10000000
1910#define IEEE80211_EXTCAPIE_TDLS_PEER_PSM 0x20000000
1911#define IEEE80211_EXTCAPIE_TDLS_CHAN_SX 0x40000000
1912/* 2nd Extended capability IE flags bit32-bit63*/
1913#define IEEE80211_EXTCAPIE_TDLSSUPPORT 0x00000020 /* bit-37 TDLS Support */
1914#define IEEE80211_EXTCAPIE_TDLSPROHIBIT 0x00000040 /* bit-38 TDLS Prohibit Support */
1915#define IEEE80211_EXTCAPIE_TDLSCHANSXPROHIBIT 0x00000080 /* bit-39 TDLS Channel Switch Prohibit */
1916#define IEEE80211_EXTCAPIE_TDLS_WIDE_BAND 0x20000080 /* bit-61 TDLS Wide Bandwidth support */
1917#define IEEE80211_EXTCAPIE_OP_MODE_NOTIFY 0x40000000 /* bit-62 Operating Mode notification */
1918
1919/*
1920 * These caps are populated when we recieve beacon/probe response
1921 * This is used to maintain local TDLS cap bit masks
1922 */
1923
1924#define IEEE80211_TDLS_PROHIBIT 0x00000001 /* bit-1 TDLS Prohibit Support */
1925
1926/*
1927 * 20/40 BSS coexistence ie
1928 */
1929struct ieee80211_ie_bss_coex {
1930 uint8_t elem_id;
1931 uint8_t elem_len;
1932#if _BYTE_ORDER == _BIG_ENDIAN
1933 uint8_t reserved1 : 1,
1934 reserved2 : 1,
1935 reserved3 : 1,
1936 obss_exempt_grant : 1,
1937 obss_exempt_req : 1,
1938 ht20_width_req : 1, ht40_intolerant : 1, inf_request : 1;
1939#else
1940 uint8_t inf_request : 1,
1941 ht40_intolerant : 1,
1942 ht20_width_req : 1,
1943 obss_exempt_req : 1,
1944 obss_exempt_grant : 1, reserved3 : 1, reserved2 : 1, reserved1 : 1;
1945#endif
1946} __packed;
1947
1948/*
1949 * 20/40 BSS intolerant channel report ie
1950 */
1951struct ieee80211_ie_intolerant_report {
1952 uint8_t elem_id;
1953 uint8_t elem_len;
1954 uint8_t reg_class;
1955 uint8_t chan_list[1]; /* variable-length channel list */
1956} __packed;
1957
1958/*
1959 * 20/40 coext management action frame
1960 */
1961struct ieee80211_action_bss_coex_frame {
1962 struct ieee80211_action ac_header;
1963 struct ieee80211_ie_bss_coex coex;
1964 struct ieee80211_ie_intolerant_report chan_report;
1965} __packed;
1966
1967typedef enum ieee80211_tie_interval_type {
1968 IEEE80211_TIE_INTERVAL_TYPE_RESERVED = 0,
1969 IEEE80211_TIE_INTERVAL_TYPE_REASSOC_DEADLINE_INTERVAL = 1,
1970 IEEE80211_TIE_INTERVAL_TYPE_KEY_LIFETIME_INTERVAL = 2,
1971 IEEE80211_TIE_INTERVAL_TYPE_ASSOC_COMEBACK_TIME = 3,
1972} ieee80211_tie_interval_type_t;
1973
1974struct ieee80211_ie_timeout_interval {
1975 uint8_t elem_id;
1976 uint8_t elem_len;
1977 uint8_t interval_type;
1978 uint32_t value;
1979} __packed;
1980
1981/* TODO -> Need to Check Redefinition Error used in only UMAC */
1982#if 0
1983/* Management MIC information element (IEEE 802.11w) */
1984struct ieee80211_mmie {
1985 uint8_t element_id;
1986 uint8_t length;
1987 uint16_t key_id;
1988 uint8_t sequence_number[6];
1989 uint8_t mic[8];
1990} __packed;
1991#endif
1992
1993/*
1994 * 802.11n Secondary Channel Offset element
1995 */
1996#define IEEE80211_SEC_CHAN_OFFSET_SCN 0 /* no secondary channel */
1997#define IEEE80211_SEC_CHAN_OFFSET_SCA 1 /* secondary channel above */
1998#define IEEE80211_SEC_CHAN_OFFSET_SCB 3 /* secondary channel below */
1999
2000struct ieee80211_ie_sec_chan_offset {
2001 uint8_t elem_id;
2002 uint8_t len;
2003 uint8_t sec_chan_offset;
2004} __packed;
2005
2006/*
2007 * 802.11ac Transmit Power Envelope element
2008 */
2009#define IEEE80211_VHT_TXPWR_IS_SUB_ELEMENT 1 /* It checks whether its sub element */
2010#define IEEE80211_VHT_TXPWR_MAX_POWER_COUNT 4 /* Max TX power elements valid */
2011#define IEEE80211_VHT_TXPWR_NUM_POWER_SUPPORTED 3 /* Max TX power elements supported */
2012#define IEEE80211_VHT_TXPWR_LCL_MAX_PWR_UNITS_SHFT 3 /* B3-B5 Local Max transmit power units */
2013
2014struct ieee80211_ie_vht_txpwr_env {
2015 uint8_t elem_id;
2016 uint8_t elem_len;
2017 uint8_t txpwr_info; /* Transmit Power Information */
2018 uint8_t local_max_txpwr[4]; /* Local Max TxPower for 20,40,80,160MHz */
2019} __packed;
2020
2021/*
2022 * 802.11ac Wide Bandwidth Channel Switch Element
2023 */
2024
2025#define IEEE80211_VHT_EXTCH_SWITCH 1 /* For extension channel switch */
2026#define CHWIDTH_VHT20 20 /* Channel width 20 */
2027#define CHWIDTH_VHT40 40 /* Channel width 40 */
2028#define CHWIDTH_VHT80 80 /* Channel width 80 */
2029#define CHWIDTH_VHT160 160 /* Channel width 160 */
2030
2031struct ieee80211_ie_wide_bw_switch {
2032 uint8_t elem_id;
2033 uint8_t elem_len;
2034 uint8_t new_ch_width; /* New channel width */
2035 uint8_t new_ch_freq_seg1; /* Channel Center frequency 1 */
2036 uint8_t new_ch_freq_seg2; /* Channel Center frequency 2 */
2037} __packed;
2038
2039#define IEEE80211_RSSI_RX 0x00000001
2040#define IEEE80211_RSSI_TX 0x00000002
2041#define IEEE80211_RSSI_EXTCHAN 0x00000004
2042#define IEEE80211_RSSI_BEACON 0x00000008
2043#define IEEE80211_RSSI_RXDATA 0x00000010
2044
2045#define IEEE80211_RATE_TX 0
2046#define IEEE80211_RATE_RX 1
2047#define IEEE80211_LASTRATE_TX 2
2048#define IEEE80211_LASTRATE_RX 3
2049#define IEEE80211_RATECODE_TX 4
2050#define IEEE80211_RATECODE_RX 5
2051
2052#define IEEE80211_MAX_RATE_PER_CLIENT 8
2053/* Define for the P2P Wildcard SSID */
2054#define IEEE80211_P2P_WILDCARD_SSID "DIRECT-"
2055
2056#define IEEE80211_P2P_WILDCARD_SSID_LEN (sizeof(IEEE80211_P2P_WILDCARD_SSID) - 1)
2057
2058#endif /* CDS_COMMON_IEEE80211_H_ */