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