1 /*
2  * IEEE 802.11 Frame type definitions
3  * Copyright (c) 2002-2019, Jouni Malinen <j@w1.fi>
4  * Copyright (c) 2007-2008 Intel Corporation
5  *
6  * This software may be distributed under the terms of the BSD license.
7  * See README for more details.
8  */
9 
10 #ifndef IEEE802_11_DEFS_H
11 #define IEEE802_11_DEFS_H
12 
13 #include <utils/common.h>
14 
15 /* IEEE 802.11 defines */
16 
17 #define WLAN_FC_PVER		0x0003
18 #define WLAN_FC_TODS		0x0100
19 #define WLAN_FC_FROMDS		0x0200
20 #define WLAN_FC_MOREFRAG	0x0400
21 #define WLAN_FC_RETRY		0x0800
22 #define WLAN_FC_PWRMGT		0x1000
23 #define WLAN_FC_MOREDATA	0x2000
24 #define WLAN_FC_ISWEP		0x4000
25 #define WLAN_FC_ORDER		0x8000
26 
27 #define WLAN_FC_GET_TYPE(fc)	(((fc) & 0x000c) >> 2)
28 #define WLAN_FC_GET_STYPE(fc)	(((fc) & 0x00f0) >> 4)
29 
30 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
31 #define WLAN_GET_SEQ_SEQ(seq) \
32 	(((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
33 
34 #define WLAN_FC_TYPE_MGMT		0
35 #define WLAN_FC_TYPE_CTRL		1
36 #define WLAN_FC_TYPE_DATA		2
37 
38 /* management */
39 #define WLAN_FC_STYPE_ASSOC_REQ		0
40 #define WLAN_FC_STYPE_ASSOC_RESP	1
41 #define WLAN_FC_STYPE_REASSOC_REQ	2
42 #define WLAN_FC_STYPE_REASSOC_RESP	3
43 #define WLAN_FC_STYPE_PROBE_REQ		4
44 #define WLAN_FC_STYPE_PROBE_RESP	5
45 #define WLAN_FC_STYPE_BEACON		8
46 #define WLAN_FC_STYPE_ATIM		9
47 #define WLAN_FC_STYPE_DISASSOC		10
48 #define WLAN_FC_STYPE_AUTH		11
49 #define WLAN_FC_STYPE_DEAUTH		12
50 #define WLAN_FC_STYPE_ACTION		13
51 
52 /* control */
53 #define WLAN_FC_STYPE_PSPOLL		10
54 #define WLAN_FC_STYPE_RTS		11
55 #define WLAN_FC_STYPE_CTS		12
56 #define WLAN_FC_STYPE_ACK		13
57 #define WLAN_FC_STYPE_CFEND		14
58 #define WLAN_FC_STYPE_CFENDACK		15
59 
60 /* data */
61 #define WLAN_FC_STYPE_DATA		0
62 #define WLAN_FC_STYPE_DATA_CFACK	1
63 #define WLAN_FC_STYPE_DATA_CFPOLL	2
64 #define WLAN_FC_STYPE_DATA_CFACKPOLL	3
65 #define WLAN_FC_STYPE_NULLFUNC		4
66 #define WLAN_FC_STYPE_CFACK		5
67 #define WLAN_FC_STYPE_CFPOLL		6
68 #define WLAN_FC_STYPE_CFACKPOLL		7
69 #define WLAN_FC_STYPE_QOS_DATA		8
70 
71 /* Authentication algorithms */
72 #define WLAN_AUTH_OPEN			0
73 #define WLAN_AUTH_SHARED_KEY		1
74 #define WLAN_AUTH_FT			2
75 #define WLAN_AUTH_LEAP			128
76 
77 #define WLAN_AUTH_CHALLENGE_LEN 128
78 
79 #define WLAN_CAPABILITY_ESS BIT(0)
80 #define WLAN_CAPABILITY_IBSS BIT(1)
81 #define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
82 #define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
83 #define WLAN_CAPABILITY_PRIVACY BIT(4)
84 #define WLAN_CAPABILITY_SHORT_PREAMBLE BIT(5)
85 #define WLAN_CAPABILITY_PBCC BIT(6)
86 #define WLAN_CAPABILITY_CHANNEL_AGILITY BIT(7)
87 #define WLAN_CAPABILITY_SPECTRUM_MGMT BIT(8)
88 #define WLAN_CAPABILITY_QOS BIT(9)
89 #define WLAN_CAPABILITY_SHORT_SLOT_TIME BIT(10)
90 #define WLAN_CAPABILITY_APSD BIT(11)
91 #define WLAN_CAPABILITY_RADIO_MEASUREMENT BIT(12)
92 #define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
93 #define WLAN_CAPABILITY_DELAYED_BLOCK_ACK BIT(14)
94 #define WLAN_CAPABILITY_IMM_BLOCK_ACK BIT(15)
95 
96 /* Status codes (IEEE Std 802.11-2016, 9.4.1.9, Table 9-46) */
97 #define WLAN_STATUS_SUCCESS 0
98 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
99 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
100 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
101 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
102 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
103 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
104 #define WLAN_STATUS_CHALLENGE_FAIL 15
105 #define WLAN_STATUS_AUTH_TIMEOUT 16
106 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
107 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
108 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
109 #define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
110 #define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
111 #define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
112 #define WLAN_STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME 25
113 #define WLAN_STATUS_ASSOC_DENIED_NO_HT 27
114 #define WLAN_STATUS_R0KH_UNREACHABLE 28
115 #define WLAN_STATUS_ASSOC_DENIED_NO_PCO 29
116 #define WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY 30
117 #define WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31
118 #define WLAN_STATUS_UNSPECIFIED_QOS_FAILURE 32
119 #define WLAN_STATUS_DENIED_INSUFFICIENT_BANDWIDTH 33
120 #define WLAN_STATUS_DENIED_POOR_CHANNEL_CONDITIONS 34
121 #define WLAN_STATUS_DENIED_QOS_NOT_SUPPORTED 35
122 #define WLAN_STATUS_REQUEST_DECLINED 37
123 #define WLAN_STATUS_INVALID_PARAMETERS 38
124 #define WLAN_STATUS_REJECTED_WITH_SUGGESTED_CHANGES 39
125 #define WLAN_STATUS_INVALID_IE 40
126 #define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
127 #define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
128 #define WLAN_STATUS_AKMP_NOT_VALID 43
129 #define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
130 #define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
131 #define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
132 #define WLAN_STATUS_TS_NOT_CREATED 47
133 #define WLAN_STATUS_DIRECT_LINK_NOT_ALLOWED 48
134 #define WLAN_STATUS_DEST_STA_NOT_PRESENT 49
135 #define WLAN_STATUS_DEST_STA_NOT_QOS_STA 50
136 #define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51
137 #define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52
138 #define WLAN_STATUS_INVALID_PMKID 53
139 #define WLAN_STATUS_INVALID_MDIE 54
140 #define WLAN_STATUS_INVALID_FTIE 55
141 #define WLAN_STATUS_GAS_ADV_PROTO_NOT_SUPPORTED 59
142 #define WLAN_STATUS_NO_OUTSTANDING_GAS_REQ 60
143 #define WLAN_STATUS_GAS_RESP_NOT_RECEIVED 61
144 #define WLAN_STATUS_STA_TIMED_OUT_WAITING_FOR_GAS_RESP 62
145 #define WLAN_STATUS_GAS_RESP_LARGER_THAN_LIMIT 63
146 #define WLAN_STATUS_REQ_REFUSED_HOME 64
147 #define WLAN_STATUS_ADV_SRV_UNREACHABLE 65
148 #define WLAN_STATUS_REQ_REFUSED_SSPN 67
149 #define WLAN_STATUS_REQ_REFUSED_UNAUTH_ACCESS 68
150 #define WLAN_STATUS_INVALID_RSNIE 72
151 #define WLAN_STATUS_ANTI_CLOGGING_TOKEN_REQ 76
152 #define WLAN_STATUS_FINITE_CYCLIC_GROUP_NOT_SUPPORTED 77
153 #define WLAN_STATUS_TRANSMISSION_FAILURE 79
154 #define WLAN_STATUS_REJECTED_WITH_SUGGESTED_BSS_TRANSITION 82
155 #define WLAN_STATUS_PENDING_ADMITTING_FST_SESSION 86
156 #define WLAN_STATUS_QUERY_RESP_OUTSTANDING 95
157 #define WLAN_STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL 99
158 #define WLAN_STATUS_ASSOC_DENIED_NO_VHT 104
159 #define WLAN_STATUS_UNKNOWN_PASSWORD_IDENTIFIER 123
160 
161 /* Reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45) */
162 #define WLAN_REASON_UNSPECIFIED 1
163 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
164 #define WLAN_REASON_DEAUTH_LEAVING 3
165 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
166 #define WLAN_REASON_DISASSOC_AP_BUSY 5
167 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
168 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
169 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
170 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
171 #define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
172 #define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
173 #define WLAN_REASON_BSS_TRANSITION_DISASSOC 12
174 #define WLAN_REASON_INVALID_IE 13
175 #define WLAN_REASON_MICHAEL_MIC_FAILURE 14
176 #define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
177 #define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
178 #define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
179 #define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
180 #define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
181 #define WLAN_REASON_AKMP_NOT_VALID 20
182 #define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
183 #define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
184 #define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
185 #define WLAN_REASON_CIPHER_SUITE_REJECTED 24
186 
187 /* Information Element IDs (IEEE Std 802.11-2016, 9.4.2.1, Table 9-77) */
188 #define WLAN_EID_SSID 0
189 #define WLAN_EID_SUPP_RATES 1
190 #define WLAN_EID_DS_PARAMS 3
191 #define WLAN_EID_CF_PARAMS 4
192 #define WLAN_EID_TIM 5
193 #define WLAN_EID_IBSS_PARAMS 6
194 #define WLAN_EID_COUNTRY 7
195 #define WLAN_EID_CHALLENGE 16
196 #define WLAN_EID_PWR_CONSTRAINT 32
197 #define WLAN_EID_PWR_CAPABILITY 33
198 #define WLAN_EID_TPC_REQUEST 34
199 #define WLAN_EID_TPC_REPORT 35
200 #define WLAN_EID_SUPPORTED_CHANNELS 36
201 #define WLAN_EID_CHANNEL_SWITCH 37
202 #define WLAN_EID_MEASURE_REQUEST 38
203 #define WLAN_EID_MEASURE_REPORT 39
204 #define WLAN_EID_QUIET 40
205 #define WLAN_EID_IBSS_DFS 41
206 #define WLAN_EID_ERP_INFO 42
207 #define WLAN_EID_HT_CAP 45
208 #define WLAN_EID_RSN 48
209 #define WLAN_EID_EXT_SUPP_RATES 50
210 #define WLAN_EID_NEIGHBOR_REPORT 52
211 #define WLAN_EID_MOBILITY_DOMAIN 54
212 #define WLAN_EID_FAST_BSS_TRANSITION 55
213 #define WLAN_EID_TIMEOUT_INTERVAL 56
214 #define WLAN_EID_RIC_DATA 57
215 #define WLAN_EID_SUPPORTED_OPERATING_CLASSES 59
216 #define WLAN_EID_HT_OPERATION 61
217 #define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
218 #define WLAN_EID_WAPI 68
219 #define WLAN_EID_RRM_ENABLED_CAPABILITIES 70
220 #define WLAN_EID_20_40_BSS_COEXISTENCE 72
221 #define WLAN_EID_20_40_BSS_INTOLERANT 73
222 #define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
223 #define WLAN_EID_MMIE 76
224 #define WLAN_EID_EXT_CAPAB 127
225 #define WLAN_EID_VENDOR_SPECIFIC 221
226 #define WLAN_EID_CAG_NUMBER 237
227 #define WLAN_EID_AP_CSN 239
228 #define WLAN_EID_FILS_INDICATION 240
229 #define WLAN_EID_DILS 241
230 #define WLAN_EID_FRAGMENT 242
231 #define WLAN_EID_EXTENSION 255
232 
233 /* Element ID Extension (EID 255) values */
234 #define WLAN_EID_EXT_ASSOC_DELAY_INFO 1
235 #define WLAN_EID_EXT_FILS_REQ_PARAMS 2
236 #define WLAN_EID_EXT_FILS_KEY_CONFIRM 3
237 #define WLAN_EID_EXT_FILS_SESSION 4
238 #define WLAN_EID_EXT_FILS_HLP_CONTAINER 5
239 #define WLAN_EID_EXT_FILS_IP_ADDR_ASSIGN 6
240 #define WLAN_EID_EXT_KEY_DELIVERY 7
241 #define WLAN_EID_EXT_WRAPPED_DATA 8
242 #define WLAN_EID_EXT_FTM_SYNC_INFO 9
243 #define WLAN_EID_EXT_EXTENDED_REQUEST 10
244 #define WLAN_EID_EXT_ESTIMATED_SERVICE_PARAMS 11
245 #define WLAN_EID_EXT_FILS_PUBLIC_KEY 12
246 #define WLAN_EID_EXT_FILS_NONCE 13
247 #define WLAN_EID_EXT_FUTURE_CHANNEL_GUIDANCE 14
248 #define WLAN_EID_EXT_OWE_DH_PARAM 32
249 #define WLAN_EID_EXT_PASSWORD_IDENTIFIER 33
250 #define WLAN_EID_EXT_HE_CAPABILITIES 35
251 #define WLAN_EID_EXT_HE_OPERATION 36
252 
253 /* Action frame categories (IEEE Std 802.11-2016, 9.4.1.11, Table 9-76) */
254 #define WLAN_ACTION_SPECTRUM_MGMT 0
255 #define WLAN_ACTION_QOS 1
256 #define WLAN_ACTION_DLS 2
257 #define WLAN_ACTION_BLOCK_ACK 3
258 #define WLAN_ACTION_PUBLIC 4
259 #define WLAN_ACTION_RADIO_MEASUREMENT 5
260 #define WLAN_ACTION_FT 6
261 #define WLAN_ACTION_HT 7
262 #define WLAN_ACTION_SA_QUERY 8
263 #define WLAN_ACTION_WNM 10
264 #define WLAN_ACTION_UNPROTECTED_WNM 11
265 #define WLAN_ACTION_WMM 17 /* WMM Specification 1.1 */
266 
267 /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */
268 #define WLAN_PA_VENDOR_SPECIFIC 9
269 #define WLAN_PA_GAS_INITIAL_REQ 10
270 #define WLAN_PA_GAS_INITIAL_RESP 11
271 #define WLAN_PA_GAS_COMEBACK_REQ 12
272 #define WLAN_PA_GAS_COMEBACK_RESP 13
273 
274 /* SA Query Action frame (IEEE 802.11w/D8.0, 7.4.9) */
275 #define WLAN_SA_QUERY_REQUEST 0
276 #define WLAN_SA_QUERY_RESPONSE 1
277 
278 #define WLAN_SA_QUERY_TR_ID_LEN 2
279 
280 /* Timeout Interval Type */
281 #define WLAN_TIMEOUT_REASSOC_DEADLINE 1
282 #define WLAN_TIMEOUT_KEY_LIFETIME 2
283 #define WLAN_TIMEOUT_ASSOC_COMEBACK 3
284 
285 #define OUI_WFA 0x506f9a
286 #define DPP_OUI_TYPE 0x1A
287 
288 #ifdef _MSC_VER
289 #pragma pack(push, 1)
290 #endif /* _MSC_VER */
291 
292 struct ieee80211_hdr {
293 	le16 frame_control;
294 	le16 duration_id;
295 	u8 addr1[6];
296 	u8 addr2[6];
297 	u8 addr3[6];
298 	le16 seq_ctrl;
299 	/* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
300 	 */
301 } STRUCT_PACKED;
302 
303 #define IEEE80211_DA_FROMDS addr1
304 #define IEEE80211_BSSID_FROMDS addr2
305 #define IEEE80211_SA_FROMDS addr3
306 
307 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
308 
309 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
310 /* Radio Measurement Action codes */
311 #define WLAN_RRM_RADIO_MEASUREMENT_REQUEST 0
312 #define WLAN_RRM_RADIO_MEASUREMENT_REPORT 1
313 #define WLAN_RRM_LINK_MEASUREMENT_REQUEST 2
314 #define WLAN_RRM_LINK_MEASUREMENT_REPORT 3
315 #define WLAN_RRM_NEIGHBOR_REPORT_REQUEST 4
316 #define WLAN_RRM_NEIGHBOR_REPORT_RESPONSE 5
317 
318 /* Radio Measurement capabilities (from RM Enabled Capabilities element)
319  * IEEE Std 802.11-2016, 9.4.2.45, Table 9-157 */
320 /* byte 1 (out of 5) */
321 #define WLAN_RRM_CAPS_LINK_MEASUREMENT BIT(0)
322 #define WLAN_RRM_CAPS_NEIGHBOR_REPORT BIT(1)
323 #define WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE BIT(4)
324 #define WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE BIT(5)
325 #define WLAN_RRM_CAPS_BEACON_REPORT_TABLE BIT(6)
326 
327 /*
328  * IEEE P802.11-REVmc/D5.0 Table 9-81 - Measurement type definitions for
329  * measurement requests
330  */
331 enum measure_type {
332 	MEASURE_TYPE_RPI_HIST = 2,
333 	MEASURE_TYPE_BEACON = 5,
334 	MEASURE_TYPE_LCI = 8,
335 	MEASURE_TYPE_LOCATION_CIVIC = 11,
336 	MEASURE_TYPE_MEASURE_PAUSE = 255,
337 };
338 
339 /* IEEE Std 802.11-2012 Table 8-71 - Location subject definition */
340 enum location_subject {
341 	LOCATION_SUBJECT_LOCAL = 0,
342 	LOCATION_SUBJECT_REMOTE = 1,
343 	LOCATION_SUBJECT_3RD_PARTY = 2,
344 };
345 
346 /*
347  * IEEE P802.11-REVmc/D5.0 Table 9-94 - Optional subelement IDs for LCI request
348  */
349 enum lci_req_subelem {
350 	LCI_REQ_SUBELEM_AZIMUTH_REQ = 1,
351 	LCI_REQ_SUBELEM_ORIGINATOR_MAC_ADDR = 2,
352 	LCI_REQ_SUBELEM_TARGET_MAC_ADDR = 3,
353 	LCI_REQ_SUBELEM_MAX_AGE = 4,
354 };
355 
356 #ifdef ESP_SUPPLICANT
357 struct ieee80211_pa_vendor {
358     u8 oui[3];
359     u8 wfa_stype;
360     u8 vendor_data[];
361 } STRUCT_PACKED;
362 
363 struct ieee80211_gas_resp {
364     u8 diag_token;
365     u16 status_code;
366     u16 comeback_delay;
367     u8 type;
368     u8 length;
369     u8 data[];
370 } STRUCT_PACKED;
371 
372 struct ieee80211_public_action {
373     u8 action;
374     union {
375         struct ieee80211_pa_vendor pa_vendor_spec;
376         struct ieee80211_gas_resp pa_gas_resp;
377     } v;
378 } STRUCT_PACKED;
379 
380 struct ieee80211_action {
381     u8 category;
382     union {
383         struct ieee80211_public_action public_action;
384     } u;
385 } STRUCT_PACKED;
386 #endif /* ESP_SUPPLICANT */
387 
388 #define IEEE80211_MAX_MMPDU_SIZE 2304
389 struct ieee80211_ht_capabilities {
390 	le16 ht_capabilities_info;
391 	u8 a_mpdu_params;
392 	u8 supported_mcs_set[16];
393 	le16 ht_extended_capabilities;
394 	le32 tx_bf_capability_info;
395 	u8 asel_capabilities;
396 } STRUCT_PACKED;
397 
398 
399 /* HT Operation element */
400 struct ieee80211_ht_operation {
401 	u8 primary_chan;
402 	/* Five octets of HT Operation Information */
403 	u8 ht_param; /* B0..B7 */
404 	le16 operation_mode; /* B8..B23 */
405 	le16 param; /* B24..B39 */
406 	u8 basic_mcs_set[16];
407 } STRUCT_PACKED;
408 
409 #ifdef _MSC_VER
410 #pragma pack(pop)
411 #endif /* _MSC_VER */
412 
413 #define ERP_INFO_NON_ERP_PRESENT BIT(0)
414 #define ERP_INFO_USE_PROTECTION BIT(1)
415 #define ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
416 
417 #define OVERLAPPING_BSS_TRANS_DELAY_FACTOR 5
418 
419 /* HT Capabilities Info field within HT Capabilities element */
420 #define HT_CAP_INFO_LDPC_CODING_CAP		((u16) BIT(0))
421 #define HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET	((u16) BIT(1))
422 #define HT_CAP_INFO_SMPS_MASK			((u16) (BIT(2) | BIT(3)))
423 #define HT_CAP_INFO_SMPS_STATIC			((u16) 0)
424 #define HT_CAP_INFO_SMPS_DYNAMIC		((u16) BIT(2))
425 #define HT_CAP_INFO_SMPS_DISABLED		((u16) (BIT(2) | BIT(3)))
426 #define HT_CAP_INFO_GREEN_FIELD			((u16) BIT(4))
427 #define HT_CAP_INFO_SHORT_GI20MHZ		((u16) BIT(5))
428 #define HT_CAP_INFO_SHORT_GI40MHZ		((u16) BIT(6))
429 #define HT_CAP_INFO_TX_STBC			((u16) BIT(7))
430 #define HT_CAP_INFO_RX_STBC_MASK		((u16) (BIT(8) | BIT(9)))
431 #define HT_CAP_INFO_RX_STBC_1			((u16) BIT(8))
432 #define HT_CAP_INFO_RX_STBC_12			((u16) BIT(9))
433 #define HT_CAP_INFO_RX_STBC_123			((u16) (BIT(8) | BIT(9)))
434 #define HT_CAP_INFO_DELAYED_BA			((u16) BIT(10))
435 #define HT_CAP_INFO_MAX_AMSDU_SIZE		((u16) BIT(11))
436 #define HT_CAP_INFO_DSSS_CCK40MHZ		((u16) BIT(12))
437 /* B13 - Reserved (was PSMP support during P802.11n development) */
438 #define HT_CAP_INFO_40MHZ_INTOLERANT		((u16) BIT(14))
439 #define HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT	((u16) BIT(15))
440 
441 /* HT Extended Capabilities field within HT Capabilities element */
442 #define EXT_HT_CAP_INFO_PCO			((u16) BIT(0))
443 #define EXT_HT_CAP_INFO_PCO_TRANS_TIME_MASK	((u16) (BIT(1) | BIT(2)))
444 #define EXT_HT_CAP_INFO_TRANS_TIME_OFFSET	1
445 /* B3..B7 - Reserved */
446 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_MASK	((u16) (BIT(8) | BIT(9)))
447 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_OFFSET	8
448 #define EXT_HT_CAP_INFO_HTC_SUPPORT		((u16) BIT(10))
449 #define EXT_HT_CAP_INFO_RD_RESPONDER		((u16) BIT(11))
450 /* B12..B15 - Reserved */
451 
452 /* Transmit Beanforming Capabilities within HT Capabilities element */
453 #define TX_BF_CAP_IMPLICIT_TXBF_RX_CAP ((u32) BIT(0))
454 #define TX_BF_CAP_RX_STAGGERED_SOUNDING_CAP ((u32) BIT(1))
455 #define TX_BF_CAP_TX_STAGGERED_SOUNDING_CAP ((u32) BIT(2))
456 #define TX_BF_CAP_RX_NDP_CAP ((u32) BIT(3))
457 #define TX_BF_CAP_TX_NDP_CAP ((u32) BIT(4))
458 #define TX_BF_CAP_IMPLICIT_TX_BF_CAP ((u32) BIT(5))
459 #define TX_BF_CAP_CALIBRATION_MASK ((u32) (BIT(6) | BIT(7))
460 #define TX_BF_CAP_CALIB_OFFSET 6
461 #define TX_BF_CAP_EXPLICIT_CSI_TXBF_CAP ((u32) BIT(8))
462 #define TX_BF_CAP_EXPLICIT_NONCOMPR_STEERING_CAP ((u32) BIT(9))
463 #define TX_BF_CAP_EXPLICIT_COMPR_STEERING_CAP ((u32) BIT(10))
464 #define TX_BF_CAP_EXPLICIT_TX_BF_CSI_FEEDBACK_MASK ((u32) (BIT(10) | BIT(11)))
465 #define TX_BF_CAP_EXPLICIT_BF_CSI_FEEDBACK_OFFSET 11
466 #define TX_BF_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_FEEDBACK_OFFSET 13
467 #define TX_BF_CAP_EXPLICIT_COMPRESSED_STEERING_MATRIX_FEEDBACK_OFFSET 15
468 #define TX_BF_CAP_MINIMAL_GROUPING_OFFSET 17
469 #define TX_BF_CAP_CSI_NUM_BEAMFORMER_ANT_OFFSET 19
470 #define TX_BF_CAP_UNCOMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 21
471 #define TX_BF_CAP_COMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 23
472 #define TX_BF_CAP_SCI_MAX_OF_ROWS_BEANFORMER_SUPPORTED_OFFSET 25
473 #define TX_BF_CAP_CHANNEL_ESTIMATION_CAP_MASK ((u32) (BIT(27) | BIT(28)))
474 #define TX_BF_CAP_CHANNEL_ESTIMATION_CAP_OFFSET 27
475 /* B29..B31 - Reserved */
476 
477 /* ASEL Capability field within HT Capabilities element */
478 #define ASEL_CAP_ASEL_CAPABLE ((u8) BIT(0))
479 #define ASEL_CAP_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(1))
480 #define ASEL_CAP_ANT_INDICES_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(2))
481 #define ASEL_CAP_EXPLICIT_CSI_FEEDBACK_CAP ((u8) BIT(3))
482 #define ASEL_CAP_ANT_INDICES_FEEDBACK_CAP ((u8) BIT(4))
483 #define ASEL_CAP_RX_AS_CAP ((u8) BIT(5))
484 #define ASEL_CAP_TX_SOUNDING_PPDUS_CAP ((u8) BIT(6))
485 /* B7 - Reserved */
486 
487 /* First octet of HT Operation Information within HT Operation element */
488 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK	((u8) BIT(0) | BIT(1))
489 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE		((u8) BIT(0))
490 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW		((u8) BIT(0) | BIT(1))
491 #define HT_INFO_HT_PARAM_STA_CHNL_WIDTH			((u8) BIT(2))
492 #define HT_INFO_HT_PARAM_RIFS_MODE			((u8) BIT(3))
493 /* B4..B7 - Reserved */
494 
495 /* HT Protection (B8..B9 of HT Operation Information) */
496 #define HT_PROT_NO_PROTECTION           0
497 #define HT_PROT_NONMEMBER_PROTECTION    1
498 #define HT_PROT_20MHZ_PROTECTION        2
499 #define HT_PROT_NON_HT_MIXED            3
500 /* Bits within ieee80211_ht_operation::operation_mode (BIT(0) maps to B8 in
501  * HT Operation Information) */
502 #define HT_OPER_OP_MODE_HT_PROT_MASK ((u16) (BIT(0) | BIT(1))) /* B8..B9 */
503 #define HT_OPER_OP_MODE_NON_GF_HT_STAS_PRESENT	((u16) BIT(2)) /* B10 */
504 /* BIT(3), i.e., B11 in HT Operation Information field - Reserved */
505 #define HT_OPER_OP_MODE_OBSS_NON_HT_STAS_PRESENT	((u16) BIT(4)) /* B12 */
506 /* BIT(5)..BIT(15), i.e., B13..B23 - Reserved */
507 
508 /* Last two octets of HT Operation Information (BIT(0) = B24) */
509 /* B24..B29 - Reserved */
510 #define HT_OPER_PARAM_DUAL_BEACON			((u16) BIT(6))
511 #define HT_OPER_PARAM_DUAL_CTS_PROTECTION		((u16) BIT(7))
512 #define HT_OPER_PARAM_STBC_BEACON			((u16) BIT(8))
513 #define HT_OPER_PARAM_LSIG_TXOP_PROT_FULL_SUPP		((u16) BIT(9))
514 #define HT_OPER_PARAM_PCO_ACTIVE			((u16) BIT(10))
515 #define HT_OPER_PARAM_PCO_PHASE				((u16) BIT(11))
516 /* B36..B39 - Reserved */
517 
518 #define WMM_OUI_TYPE 2
519 #define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
520 #define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
521 #define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
522 #define WMM_VERSION 1
523 
524 #define WMM_ACTION_CODE_ADDTS_REQ 0
525 #define WMM_ACTION_CODE_ADDTS_RESP 1
526 #define WMM_ACTION_CODE_DELTS 2
527 
528 #define WMM_ADDTS_STATUS_ADMISSION_ACCEPTED 0
529 #define WMM_ADDTS_STATUS_INVALID_PARAMETERS 1
530 /* 2 - Reserved */
531 #define WMM_ADDTS_STATUS_REFUSED 3
532 /* 4-255 - Reserved */
533 
534 /* WMM TSPEC Direction Field Values */
535 #define WMM_TSPEC_DIRECTION_UPLINK 0
536 #define WMM_TSPEC_DIRECTION_DOWNLINK 1
537 /* 2 - Reserved */
538 #define WMM_TSPEC_DIRECTION_BI_DIRECTIONAL 3
539 
540 #define MBO_IE_VENDOR_TYPE 0x506f9a16
541 #define OSEN_IE_VENDOR_TYPE 0x506f9a12
542 #define MBO_OUI_TYPE 22
543 #define OCE_STA BIT(0)
544 #define OCE_STA_CFON BIT(1)
545 #define OCE_AP BIT(2)
546 
547 /*
548  * WMM Information Element (used in (Re)Association Request frames; may also be
549  * used in Beacon frames)
550  */
551 struct wmm_information_element {
552 	/* Element ID: 221 (0xdd); Length: 7 */
553 	/* required fields for WMM version 1 */
554 	u8 oui[3]; /* 00:50:f2 */
555 	u8 oui_type; /* 2 */
556 	u8 oui_subtype; /* 0 */
557 	u8 version; /* 1 for WMM version 1.0 */
558 	u8 qos_info; /* AP/STA specific QoS info */
559 
560 } STRUCT_PACKED;
561 
562 #define WMM_AC_AIFSN_MASK 0x0f
563 #define WMM_AC_AIFNS_SHIFT 0
564 #define WMM_AC_ACM 0x10
565 #define WMM_AC_ACI_MASK 0x60
566 #define WMM_AC_ACI_SHIFT 5
567 
568 #define WMM_AC_ECWMIN_MASK 0x0f
569 #define WMM_AC_ECWMIN_SHIFT 0
570 #define WMM_AC_ECWMAX_MASK 0xf0
571 #define WMM_AC_ECWMAX_SHIFT 4
572 
573 struct wmm_ac_parameter {
574 	u8 aci_aifsn; /* AIFSN, ACM, ACI */
575 	u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
576 	le16 txop_limit;
577 }  STRUCT_PACKED;
578 
579 /*
580  * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
581  * Response frmaes)
582  */
583 struct wmm_parameter_element {
584 	/* Element ID: 221 (0xdd); Length: 24 */
585 	/* required fields for WMM version 1 */
586 	u8 oui[3]; /* 00:50:f2 */
587 	u8 oui_type; /* 2 */
588 	u8 oui_subtype; /* 1 */
589 	u8 version; /* 1 for WMM version 1.0 */
590 	u8 qos_info; /* AP/STA specific QoS info */
591 	u8 reserved; /* 0 */
592 	struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
593 
594 } STRUCT_PACKED;
595 
596 /* WMM TSPEC Element */
597 struct wmm_tspec_element {
598 	u8 eid; /* 221 = 0xdd */
599 	u8 length; /* 6 + 55 = 61 */
600 	u8 oui[3]; /* 00:50:f2 */
601 	u8 oui_type; /* 2 */
602 	u8 oui_subtype; /* 2 */
603 	u8 version; /* 1 */
604 	/* WMM TSPEC body (55 octets): */
605 	u8 ts_info[3];
606 	le16 nominal_msdu_size;
607 	le16 maximum_msdu_size;
608 	le32 minimum_service_interval;
609 	le32 maximum_service_interval;
610 	le32 inactivity_interval;
611 	le32 suspension_interval;
612 	le32 service_start_time;
613 	le32 minimum_data_rate;
614 	le32 mean_data_rate;
615 	le32 peak_data_rate;
616 	le32 maximum_burst_size;
617 	le32 delay_bound;
618 	le32 minimum_phy_rate;
619 	le16 surplus_bandwidth_allowance;
620 	le16 medium_time;
621 } STRUCT_PACKED;
622 
623 
624 /* Access Categories / ACI to AC coding */
625 enum wmm_ac {
626 	WMM_AC_BE = 0 /* Best Effort */,
627 	WMM_AC_BK = 1 /* Background */,
628 	WMM_AC_VI = 2 /* Video */,
629 	WMM_AC_VO = 3 /* Voice */,
630 	WMM_AC_NUM = 4
631 };
632 
633 /* MBO v0.0_r19, 4.2: MBO Attributes */
634 /* Table 4-5: MBO Attributes */
635 /* OCE v0.0.10, Table 4-3: OCE Attributes */
636 enum mbo_attr_id {
637 	MBO_ATTR_ID_AP_CAPA_IND = 1,
638 	MBO_ATTR_ID_NON_PREF_CHAN_REPORT = 2,
639 	MBO_ATTR_ID_CELL_DATA_CAPA = 3,
640 	MBO_ATTR_ID_ASSOC_DISALLOW = 4,
641 	MBO_ATTR_ID_CELL_DATA_PREF = 5,
642 	MBO_ATTR_ID_TRANSITION_REASON = 6,
643 	MBO_ATTR_ID_TRANSITION_REJECT_REASON = 7,
644 	MBO_ATTR_ID_ASSOC_RETRY_DELAY = 8,
645 	OCE_ATTR_ID_CAPA_IND = 101,
646 	OCE_ATTR_ID_RSSI_BASED_ASSOC_REJECT = 102,
647 	OCE_ATTR_ID_REDUCED_WAN_METRICS = 103,
648 	OCE_ATTR_ID_RNR_COMPLETENESS = 104,
649 };
650 
651 /* MBO v0.0_r19, 4.2.1: MBO AP Capability Indication Attribute */
652 /* Table 4-7: MBO AP Capability Indication Field Values */
653 #define MBO_AP_CAPA_CELL_AWARE BIT(6)
654 
655 /* MBO v0.0_r19, 4.2.2: Non-preferred Channel Report Attribute */
656 /* Table 4-10: Reason Code Field Values */
657 enum mbo_non_pref_chan_reason {
658 	MBO_NON_PREF_CHAN_REASON_UNSPECIFIED = 0,
659 	MBO_NON_PREF_CHAN_REASON_RSSI = 1,
660 	MBO_NON_PREF_CHAN_REASON_EXT_INTERFERENCE = 2,
661 	MBO_NON_PREF_CHAN_REASON_INT_INTERFERENCE = 3,
662 };
663 
664 /* MBO v0.0_r19, 4.2.3: Cellular Data Capabilities Attribute */
665 /* Table 4-13: Cellular Data Connectivity Field */
666 enum mbo_cellular_capa {
667 	MBO_CELL_CAPA_AVAILABLE = 1,
668 	MBO_CELL_CAPA_NOT_AVAILABLE = 2,
669 	MBO_CELL_CAPA_NOT_SUPPORTED = 3,
670 };
671 
672 /* MBO v0.0_r19, 4.2.7: Transition Rejection Reason Code Attribute */
673 /* Table 4-21: Transition Rejection Reason Code Field Values */
674 enum mbo_transition_reject_reason {
675 	MBO_TRANSITION_REJECT_REASON_UNSPECIFIED = 0,
676 	MBO_TRANSITION_REJECT_REASON_FRAME_LOSS = 1,
677 	MBO_TRANSITION_REJECT_REASON_DELAY = 2,
678 	MBO_TRANSITION_REJECT_REASON_QOS_CAPACITY = 3,
679 	MBO_TRANSITION_REJECT_REASON_RSSI = 4,
680 	MBO_TRANSITION_REJECT_REASON_INTERFERENCE = 5,
681 	MBO_TRANSITION_REJECT_REASON_SERVICES = 6,
682 };
683 
684 /* OCE v0.0.10, 4.2.1: OCE Capability Indication Attribute */
685 #define OCE_RELEASE 1
686 #define OCE_RELEASE_MASK (BIT(0) | BIT(1) | BIT(2))
687 #define OCE_IS_STA_CFON BIT(3)
688 #define OCE_IS_NON_OCE_AP_PRESENT BIT(4)
689 
690 /* IEEE 802.11v - WNM Action field values */
691 enum wnm_action {
692 	WNM_EVENT_REQ = 0,
693 	WNM_EVENT_REPORT = 1,
694 	WNM_DIAGNOSTIC_REQ = 2,
695 	WNM_DIAGNOSTIC_REPORT = 3,
696 	WNM_LOCATION_CFG_REQ = 4,
697 	WNM_LOCATION_CFG_RESP = 5,
698 	WNM_BSS_TRANS_MGMT_QUERY = 6,
699 	WNM_BSS_TRANS_MGMT_REQ = 7,
700 	WNM_BSS_TRANS_MGMT_RESP = 8,
701 	WNM_FMS_REQ = 9,
702 	WNM_FMS_RESP = 10,
703 	WNM_COLLOCATED_INTERFERENCE_REQ = 11,
704 	WNM_COLLOCATED_INTERFERENCE_REPORT = 12,
705 	WNM_TFS_REQ = 13,
706 	WNM_TFS_RESP = 14,
707 	WNM_TFS_NOTIFY = 15,
708 	WNM_SLEEP_MODE_REQ = 16,
709 	WNM_SLEEP_MODE_RESP = 17,
710 	WNM_TIM_BROADCAST_REQ = 18,
711 	WNM_TIM_BROADCAST_RESP = 19,
712 	WNM_QOS_TRAFFIC_CAPAB_UPDATE = 20,
713 	WNM_CHANNEL_USAGE_REQ = 21,
714 	WNM_CHANNEL_USAGE_RESP = 22,
715 	WNM_DMS_REQ = 23,
716 	WNM_DMS_RESP = 24,
717 	WNM_TIMING_MEASUREMENT_REQ = 25,
718 	WNM_NOTIFICATION_REQ = 26,
719 	WNM_NOTIFICATION_RESP = 27
720 };
721 
722 /* IEEE 802.11v - BSS Transition Management Request - Request Mode */
723 #define WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED BIT(0)
724 #define WNM_BSS_TM_REQ_ABRIDGED BIT(1)
725 #define WNM_BSS_TM_REQ_DISASSOC_IMMINENT BIT(2)
726 #define WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED BIT(3)
727 #define WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT BIT(4)
728 
729 /* IEEE Std 802.11-2012 - Table 8-253 */
730 enum bss_trans_mgmt_status_code {
731 	WNM_BSS_TM_ACCEPT = 0,
732 	WNM_BSS_TM_REJECT_UNSPECIFIED = 1,
733 	WNM_BSS_TM_REJECT_INSUFFICIENT_BEACON = 2,
734 	WNM_BSS_TM_REJECT_INSUFFICIENT_CAPABITY = 3,
735 	WNM_BSS_TM_REJECT_UNDESIRED = 4,
736 	WNM_BSS_TM_REJECT_DELAY_REQUEST = 5,
737 	WNM_BSS_TM_REJECT_STA_CANDIDATE_LIST_PROVIDED = 6,
738 	WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES = 7,
739 	WNM_BSS_TM_REJECT_LEAVING_ESS = 8
740 };
741 
742 /*
743  * IEEE P802.11-REVmc/D5.0 Table 9-150 - Optional subelement IDs for
744  * neighbor report
745  */
746 #define WNM_NEIGHBOR_TSF                         1
747 #define WNM_NEIGHBOR_CONDENSED_COUNTRY_STRING    2
748 #define WNM_NEIGHBOR_BSS_TRANSITION_CANDIDATE    3
749 #define WNM_NEIGHBOR_BSS_TERMINATION_DURATION    4
750 #define WNM_NEIGHBOR_BEARING                     5
751 #define WNM_NEIGHBOR_MEASUREMENT_REPORT         39
752 #define WNM_NEIGHBOR_MEASUREMENT_PILOT          66
753 #define WNM_NEIGHBOR_RRM_ENABLED_CAPABILITIES   70
754 #define WNM_NEIGHBOR_MULTIPLE_BSSID             71
755 
756 struct tpc_report {
757 	u8 eid;
758 	u8 len;
759 	u8 tx_power;
760 	u8 link_margin;
761 } STRUCT_PACKED;
762 
763 #define RRM_CAPABILITIES_IE_LEN 5
764 
765 /* IEEE Std 802.11-2012, 8.5.7.4 - Link Measurement Request frame format */
766 struct rrm_link_measurement_request {
767 	u8 dialog_token;
768 	s8 tx_power;
769 	s8 max_tp;
770 	u8 variable[0];
771 } STRUCT_PACKED;
772 
773 /* IEEE Std 802.11-2012, 8.5.7.5 - Link Measurement Report frame format */
774 struct rrm_link_measurement_report {
775 	u8 dialog_token;
776 	struct tpc_report tpc;
777 	u8 rx_ant_id;
778 	u8 tx_ant_id;
779 	u8 rcpi;
780 	u8 rsni;
781 	u8 variable[0];
782 } STRUCT_PACKED;
783 
784 /* IEEE Std 802.11-2016, 9.4.2.21 - Measurement Request element */
785 struct rrm_measurement_request_element {
786 	u8 eid; /* Element ID */
787 	u8 len; /* Length */
788 	u8 token; /* Measurement Token */
789 	u8 mode; /* Measurement Request Mode */
790 	u8 type; /* Measurement Type */
791 	u8 variable[0]; /* Measurement Request */
792 } STRUCT_PACKED;
793 
794 /* IEEE Std 802.11-2016, Figure 9-148 - Measurement Request Mode field */
795 #define MEASUREMENT_REQUEST_MODE_PARALLEL BIT(0)
796 #define MEASUREMENT_REQUEST_MODE_ENABLE BIT(1)
797 #define MEASUREMENT_REQUEST_MODE_REQUEST BIT(2)
798 #define MEASUREMENT_REQUEST_MODE_REPORT BIT(3)
799 #define MEASUREMENT_REQUEST_MODE_DURATION_MANDATORY BIT(4)
800 
801 /* IEEE Std 802.11-2016, 9.4.2.21.7 - Beacon request */
802 struct rrm_measurement_beacon_request {
803 	u8 oper_class; /* Operating Class */
804 	u8 channel; /* Channel Number */
805 	le16 rand_interval; /* Randomization Interval (in TUs) */
806 	le16 duration; /* Measurement Duration (in TUs) */
807 	u8 mode; /* Measurement Mode */
808 	u8 bssid[ETH_ALEN]; /* BSSID */
809 	u8 variable[0]; /* Optional Subelements */
810 } STRUCT_PACKED;
811 
812 /*
813  * IEEE Std 802.11-2016, Table 9-87 - Measurement Mode definitions for Beacon
814  * request
815  */
816 enum beacon_report_mode {
817 	BEACON_REPORT_MODE_PASSIVE = 0,
818 	BEACON_REPORT_MODE_ACTIVE = 1,
819 	BEACON_REPORT_MODE_TABLE = 2,
820 };
821 
822 /* IEEE Std 802.11-2016, Table 9-88 - Beacon Request subelement IDs */
823 /* IEEE P802.11-REVmd/D2.0, Table 9-106 - Optional subelement IDs for
824  * Beacon request */
825 #define WLAN_BEACON_REQUEST_SUBELEM_SSID	0
826 #define WLAN_BEACON_REQUEST_SUBELEM_INFO	1 /* Beacon Reporting */
827 #define WLAN_BEACON_REQUEST_SUBELEM_DETAIL	2 /* Reporting Detail */
828 #define WLAN_BEACON_REQUEST_SUBELEM_REQUEST	10
829 #define WLAN_BEACON_REQUEST_SUBELEM_AP_CHANNEL	51 /* AP Channel Report */
830 #define WLAN_BEACON_REQUEST_SUBELEM_LAST_INDICATION	164
831 #define WLAN_BEACON_REQUEST_SUBELEM_VENDOR	221
832 
833 /*
834  * IEEE Std 802.11-2016, Table 9-90 - Reporting Detail values
835  */
836 enum beacon_report_detail {
837 	/* No fixed-length fields or elements */
838 	BEACON_REPORT_DETAIL_NONE = 0,
839 	/* All fixed-length fields and any requested elements in the Request
840 	 * element if present */
841 	BEACON_REPORT_DETAIL_REQUESTED_ONLY = 1,
842 	/* All fixed-length fields and elements (default, used when Reporting
843 	 * Detail subelement is not included in a Beacon request) */
844 	BEACON_REPORT_DETAIL_ALL_FIELDS_AND_ELEMENTS = 2,
845 };
846 
847 /* IEEE Std 802.11-2016, 9.4.2.22 - Measurement Report element */
848 struct rrm_measurement_report_element {
849 	u8 eid; /* Element ID */
850 	u8 len; /* Length */
851 	u8 token; /* Measurement Token */
852 	u8 mode; /* Measurement Report Mode */
853 	u8 type; /* Measurement Type */
854 	u8 variable[0]; /* Measurement Report */
855 } STRUCT_PACKED;
856 
857 /* IEEE Std 802.11-2016, Figure 9-192 - Measurement Report Mode field */
858 #define MEASUREMENT_REPORT_MODE_ACCEPT 0
859 #define MEASUREMENT_REPORT_MODE_REJECT_LATE BIT(0)
860 #define MEASUREMENT_REPORT_MODE_REJECT_INCAPABLE BIT(1)
861 #define MEASUREMENT_REPORT_MODE_REJECT_REFUSED BIT(2)
862 
863 /* IEEE Std 802.11-2016, 9.4.2.22.7 - Beacon report */
864 struct rrm_measurement_beacon_report {
865 	u8 op_class; /* Operating Class */
866 	u8 channel; /* Channel Number */
867 	le64 start_time; /* Actual Measurement Start Time
868 			  * (in TSF of the BSS requesting the measurement) */
869 	le16 duration; /* in TUs */
870 	u8 report_info; /* Reported Frame Information */
871 	u8 rcpi; /* RCPI */
872 	u8 rsni; /* RSNI */
873 	u8 bssid[ETH_ALEN]; /* BSSID */
874 	u8 antenna_id; /* Antenna ID */
875 	le32 parent_tsf; /* Parent TSF */
876 	u8 variable[0]; /* Optional Subelements */
877 } STRUCT_PACKED;
878 
879 /* IEEE Std 802.11-2016, Table 9-112 - Beacon report Subelement IDs */
880 /* IEEE P802.11-REVmd/D2.0, Table 9-130 - Optional subelement IDs for
881  * Beacon report */
882 #define WLAN_BEACON_REPORT_SUBELEM_FRAME_BODY	1
883 #define WLAN_BEACON_REPORT_SUBELEM_FRAME_BODY_FRAGMENT_ID	2
884 #define WLAN_BEACON_REPORT_SUBELEM_LAST_INDICATION	164
885 
886 /* IEEE P802.11-REVmd/D2.0, Table 9-232 - Data field format of the
887  * Reported Frame Body Fragment ID subelement */
888 #define REPORTED_FRAME_BODY_SUBELEM_LEN		4
889 #define REPORTED_FRAME_BODY_MORE_FRAGMENTS	BIT(7)
890 
891 /* IEEE P802.11-REVmd/D2.0, 9.4.2.21.7 - Beacon report  */
892 #define BEACON_REPORT_LAST_INDICATION_SUBELEM_LEN	3
893 
894 /* IEEE Std 802.11ac-2013, Annex C - dot11PHYType */
895 enum phy_type {
896 	PHY_TYPE_UNSPECIFIED = 0,
897 	PHY_TYPE_FHSS = 1,
898 	PHY_TYPE_DSSS = 2,
899 	PHY_TYPE_IRBASEBAND = 3,
900 	PHY_TYPE_OFDM = 4,
901 	PHY_TYPE_HRDSSS = 5,
902 	PHY_TYPE_ERP = 6,
903 	PHY_TYPE_HT = 7,
904 	PHY_TYPE_DMG = 8,
905 	PHY_TYPE_VHT = 9,
906 };
907 
908 /* IEEE P802.11-REVmc/D5.0, 9.4.2.37 - Neighbor Report element */
909 /* BSSID Information Field */
910 #define NEI_REP_BSSID_INFO_AP_NOT_REACH BIT(0)
911 #define NEI_REP_BSSID_INFO_AP_UNKNOWN_REACH BIT(1)
912 #define NEI_REP_BSSID_INFO_AP_REACHABLE (BIT(0) | BIT(1))
913 #define NEI_REP_BSSID_INFO_SECURITY BIT(2)
914 #define NEI_REP_BSSID_INFO_KEY_SCOPE BIT(3)
915 #define NEI_REP_BSSID_INFO_SPECTRUM_MGMT BIT(4)
916 #define NEI_REP_BSSID_INFO_QOS BIT(5)
917 #define NEI_REP_BSSID_INFO_APSD BIT(6)
918 #define NEI_REP_BSSID_INFO_RM BIT(7)
919 #define NEI_REP_BSSID_INFO_DELAYED_BA BIT(8)
920 #define NEI_REP_BSSID_INFO_IMM_BA BIT(9)
921 #define NEI_REP_BSSID_INFO_MOBILITY_DOMAIN BIT(10)
922 #define NEI_REP_BSSID_INFO_HT BIT(11)
923 #define NEI_REP_BSSID_INFO_VHT BIT(12)
924 #define NEI_REP_BSSID_INFO_FTM BIT(13)
925 
926 #endif /* IEEE802_11_DEFS_H */
927