• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_INVALID_MGMT_SEQ   0xFFFF
31 
32 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
33 #define WLAN_GET_SEQ_SEQ(seq) \
34 	(((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
35 
36 #define WLAN_FC_TYPE_MGMT		0
37 #define WLAN_FC_TYPE_CTRL		1
38 #define WLAN_FC_TYPE_DATA		2
39 
40 /* management */
41 #define WLAN_FC_STYPE_ASSOC_REQ		0
42 #define WLAN_FC_STYPE_ASSOC_RESP	1
43 #define WLAN_FC_STYPE_REASSOC_REQ	2
44 #define WLAN_FC_STYPE_REASSOC_RESP	3
45 #define WLAN_FC_STYPE_PROBE_REQ		4
46 #define WLAN_FC_STYPE_PROBE_RESP	5
47 #define WLAN_FC_STYPE_BEACON		8
48 #define WLAN_FC_STYPE_ATIM		9
49 #define WLAN_FC_STYPE_DISASSOC		10
50 #define WLAN_FC_STYPE_AUTH		11
51 #define WLAN_FC_STYPE_DEAUTH		12
52 #define WLAN_FC_STYPE_ACTION		13
53 
54 /* control */
55 #define WLAN_FC_STYPE_PSPOLL		10
56 #define WLAN_FC_STYPE_RTS		11
57 #define WLAN_FC_STYPE_CTS		12
58 #define WLAN_FC_STYPE_ACK		13
59 #define WLAN_FC_STYPE_CFEND		14
60 #define WLAN_FC_STYPE_CFENDACK		15
61 
62 /* data */
63 #define WLAN_FC_STYPE_DATA		0
64 #define WLAN_FC_STYPE_DATA_CFACK	1
65 #define WLAN_FC_STYPE_DATA_CFPOLL	2
66 #define WLAN_FC_STYPE_DATA_CFACKPOLL	3
67 #define WLAN_FC_STYPE_NULLFUNC		4
68 #define WLAN_FC_STYPE_CFACK		5
69 #define WLAN_FC_STYPE_CFPOLL		6
70 #define WLAN_FC_STYPE_CFACKPOLL		7
71 #define WLAN_FC_STYPE_QOS_DATA		8
72 #define WLAN_FC_STYPE_QOS_DATA_CFACK	9
73 #define WLAN_FC_STYPE_QOS_DATA_CFPOLL	10
74 #define WLAN_FC_STYPE_QOS_DATA_CFACKPOLL	11
75 #define WLAN_FC_STYPE_QOS_NULL		12
76 #define WLAN_FC_STYPE_QOS_CFPOLL	14
77 #define WLAN_FC_STYPE_QOS_CFACKPOLL	15
78 
79 /* Authentication algorithms */
80 #define WLAN_AUTH_OPEN			0
81 #define WLAN_AUTH_SHARED_KEY		1
82 #define WLAN_AUTH_FT			2
83 #define WLAN_AUTH_SAE			3
84 #define WLAN_AUTH_FILS_SK		4
85 #define WLAN_AUTH_FILS_SK_PFS		5
86 #define WLAN_AUTH_FILS_PK		6
87 #define WLAN_AUTH_LEAP			128
88 
89 #define WLAN_AUTH_CHALLENGE_LEN 128
90 
91 #define WLAN_CAPABILITY_ESS BIT(0)
92 #define WLAN_CAPABILITY_IBSS BIT(1)
93 #define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
94 #define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
95 #define WLAN_CAPABILITY_PRIVACY BIT(4)
96 #define WLAN_CAPABILITY_SHORT_PREAMBLE BIT(5)
97 #define WLAN_CAPABILITY_PBCC BIT(6)
98 #define WLAN_CAPABILITY_CHANNEL_AGILITY BIT(7)
99 #define WLAN_CAPABILITY_SPECTRUM_MGMT BIT(8)
100 #define WLAN_CAPABILITY_QOS BIT(9)
101 #define WLAN_CAPABILITY_SHORT_SLOT_TIME BIT(10)
102 #define WLAN_CAPABILITY_APSD BIT(11)
103 #define WLAN_CAPABILITY_RADIO_MEASUREMENT BIT(12)
104 #define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
105 #define WLAN_CAPABILITY_DELAYED_BLOCK_ACK BIT(14)
106 #define WLAN_CAPABILITY_IMM_BLOCK_ACK BIT(15)
107 
108 /* Status codes (IEEE Std 802.11-2016, 9.4.1.9, Table 9-46) */
109 #define WLAN_STATUS_SUCCESS 0
110 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
111 #define WLAN_STATUS_TDLS_WAKEUP_ALTERNATE 2
112 #define WLAN_STATUS_TDLS_WAKEUP_REJECT 3
113 #define WLAN_STATUS_SECURITY_DISABLED 5
114 #define WLAN_STATUS_UNACCEPTABLE_LIFETIME 6
115 #define WLAN_STATUS_NOT_IN_SAME_BSS 7
116 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
117 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
118 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
119 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
120 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
121 #define WLAN_STATUS_CHALLENGE_FAIL 15
122 #define WLAN_STATUS_AUTH_TIMEOUT 16
123 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
124 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
125 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
126 #define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
127 #define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
128 #define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
129 #define WLAN_STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME 25
130 #define WLAN_STATUS_ASSOC_DENIED_NO_HT 27
131 #define WLAN_STATUS_R0KH_UNREACHABLE 28
132 #define WLAN_STATUS_ASSOC_DENIED_NO_PCO 29
133 #define WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY 30
134 #define WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31
135 #define WLAN_STATUS_UNSPECIFIED_QOS_FAILURE 32
136 #define WLAN_STATUS_DENIED_INSUFFICIENT_BANDWIDTH 33
137 #define WLAN_STATUS_DENIED_POOR_CHANNEL_CONDITIONS 34
138 #define WLAN_STATUS_DENIED_QOS_NOT_SUPPORTED 35
139 #define WLAN_STATUS_REQUEST_DECLINED 37
140 #define WLAN_STATUS_INVALID_PARAMETERS 38
141 #define WLAN_STATUS_REJECTED_WITH_SUGGESTED_CHANGES 39
142 #define WLAN_STATUS_INVALID_IE 40
143 #define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
144 #define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
145 #define WLAN_STATUS_AKMP_NOT_VALID 43
146 #define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
147 #define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
148 #define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
149 #define WLAN_STATUS_TS_NOT_CREATED 47
150 #define WLAN_STATUS_DIRECT_LINK_NOT_ALLOWED 48
151 #define WLAN_STATUS_DEST_STA_NOT_PRESENT 49
152 #define WLAN_STATUS_DEST_STA_NOT_QOS_STA 50
153 #define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51
154 #define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52
155 #define WLAN_STATUS_INVALID_PMKID 53
156 #define WLAN_STATUS_INVALID_MDIE 54
157 #define WLAN_STATUS_INVALID_FTIE 55
158 #define WLAN_STATUS_REQUESTED_TCLAS_NOT_SUPPORTED 56
159 #define WLAN_STATUS_INSUFFICIENT_TCLAS_PROCESSING_RESOURCES 57
160 #define WLAN_STATUS_TRY_ANOTHER_BSS 58
161 #define WLAN_STATUS_GAS_ADV_PROTO_NOT_SUPPORTED 59
162 #define WLAN_STATUS_NO_OUTSTANDING_GAS_REQ 60
163 #define WLAN_STATUS_GAS_RESP_NOT_RECEIVED 61
164 #define WLAN_STATUS_STA_TIMED_OUT_WAITING_FOR_GAS_RESP 62
165 #define WLAN_STATUS_GAS_RESP_LARGER_THAN_LIMIT 63
166 #define WLAN_STATUS_REQ_REFUSED_HOME 64
167 #define WLAN_STATUS_ADV_SRV_UNREACHABLE 65
168 #define WLAN_STATUS_REQ_REFUSED_SSPN 67
169 #define WLAN_STATUS_REQ_REFUSED_UNAUTH_ACCESS 68
170 #define WLAN_STATUS_INVALID_RSNIE 72
171 #define WLAN_STATUS_U_APSD_COEX_NOT_SUPPORTED 73
172 #define WLAN_STATUS_U_APSD_COEX_MODE_NOT_SUPPORTED 74
173 #define WLAN_STATUS_BAD_INTERVAL_WITH_U_APSD_COEX 75
174 #define WLAN_STATUS_ANTI_CLOGGING_TOKEN_REQ 76
175 #define WLAN_STATUS_FINITE_CYCLIC_GROUP_NOT_SUPPORTED 77
176 #define WLAN_STATUS_CANNOT_FIND_ALT_TBTT 78
177 #define WLAN_STATUS_TRANSMISSION_FAILURE 79
178 #define WLAN_STATUS_REQ_TCLAS_NOT_SUPPORTED 80
179 #define WLAN_STATUS_TCLAS_RESOURCES_EXCHAUSTED 81
180 #define WLAN_STATUS_REJECTED_WITH_SUGGESTED_BSS_TRANSITION 82
181 #define WLAN_STATUS_REJECT_WITH_SCHEDULE 83
182 #define WLAN_STATUS_REJECT_NO_WAKEUP_SPECIFIED 84
183 #define WLAN_STATUS_SUCCESS_POWER_SAVE_MODE 85
184 #define WLAN_STATUS_PENDING_ADMITTING_FST_SESSION 86
185 #define WLAN_STATUS_PERFORMING_FST_NOW 87
186 #define WLAN_STATUS_PENDING_GAP_IN_BA_WINDOW 88
187 #define WLAN_STATUS_REJECT_U_PID_SETTING 89
188 #define WLAN_STATUS_REFUSED_EXTERNAL_REASON 92
189 #define WLAN_STATUS_REFUSED_AP_OUT_OF_MEMORY 93
190 #define WLAN_STATUS_REJECTED_EMERGENCY_SERVICE_NOT_SUPPORTED 94
191 #define WLAN_STATUS_QUERY_RESP_OUTSTANDING 95
192 #define WLAN_STATUS_REJECT_DSE_BAND 96
193 #define WLAN_STATUS_TCLAS_PROCESSING_TERMINATED 97
194 #define WLAN_STATUS_TS_SCHEDULE_CONFLICT 98
195 #define WLAN_STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL 99
196 #define WLAN_STATUS_MCCAOP_RESERVATION_CONFLICT 100
197 #define WLAN_STATUS_MAF_LIMIT_EXCEEDED 101
198 #define WLAN_STATUS_MCCA_TRACK_LIMIT_EXCEEDED 102
199 #define WLAN_STATUS_DENIED_DUE_TO_SPECTRUM_MANAGEMENT 103
200 #define WLAN_STATUS_ASSOC_DENIED_NO_VHT 104
201 #define WLAN_STATUS_ENABLEMENT_DENIED 105
202 #define WLAN_STATUS_RESTRICTION_FROM_AUTHORIZED_GDB 106
203 #define WLAN_STATUS_AUTHORIZATION_DEENABLED 107
204 #define WLAN_STATUS_FILS_AUTHENTICATION_FAILURE 112
205 #define WLAN_STATUS_UNKNOWN_AUTHENTICATION_SERVER 113
206 #define WLAN_STATUS_UNKNOWN_PASSWORD_IDENTIFIER 123
207 #define WLAN_STATUS_SAE_HASH_TO_ELEMENT 126
208 
209 /* Reason codes (IEEE Std 802.11-2016, 9.4.1.7, Table 9-45) */
210 #define WLAN_REASON_UNSPECIFIED 1
211 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
212 #define WLAN_REASON_DEAUTH_LEAVING 3
213 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
214 #define WLAN_REASON_DISASSOC_AP_BUSY 5
215 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
216 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
217 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
218 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
219 #define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
220 #define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
221 #define WLAN_REASON_BSS_TRANSITION_DISASSOC 12
222 #define WLAN_REASON_INVALID_IE 13
223 #define WLAN_REASON_MICHAEL_MIC_FAILURE 14
224 #define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
225 #define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
226 #define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
227 #define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
228 #define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
229 #define WLAN_REASON_AKMP_NOT_VALID 20
230 #define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
231 #define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
232 #define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
233 #define WLAN_REASON_CIPHER_SUITE_REJECTED 24
234 #define WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE 25
235 #define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26
236 #define WLAN_REASON_SSP_REQUESTED_DISASSOC 27
237 #define WLAN_REASON_NO_SSP_ROAMING_AGREEMENT 28
238 #define WLAN_REASON_BAD_CIPHER_OR_AKM 29
239 #define WLAN_REASON_NOT_AUTHORIZED_THIS_LOCATION 30
240 #define WLAN_REASON_SERVICE_CHANGE_PRECLUDES_TS 31
241 #define WLAN_REASON_UNSPECIFIED_QOS_REASON 32
242 #define WLAN_REASON_NOT_ENOUGH_BANDWIDTH 33
243 #define WLAN_REASON_DISASSOC_LOW_ACK 34
244 #define WLAN_REASON_EXCEEDED_TXOP 35
245 #define WLAN_REASON_STA_LEAVING 36
246 #define WLAN_REASON_END_TS_BA_DLS 37
247 #define WLAN_REASON_UNKNOWN_TS_BA 38
248 #define WLAN_REASON_TIMEOUT 39
249 #define WLAN_REASON_PEERKEY_MISMATCH 45
250 #define WLAN_REASON_AUTHORIZED_ACCESS_LIMIT_REACHED 46
251 #define WLAN_REASON_EXTERNAL_SERVICE_REQUIREMENTS 47
252 #define WLAN_REASON_INVALID_FT_ACTION_FRAME_COUNT 48
253 #define WLAN_REASON_INVALID_PMKID 49
254 #define WLAN_REASON_INVALID_MDE 50
255 #define WLAN_REASON_INVALID_FTE 51
256 #define WLAN_REASON_MESH_PEERING_CANCELLED 52
257 #define WLAN_REASON_MESH_MAX_PEERS 53
258 #define WLAN_REASON_MESH_CONFIG_POLICY_VIOLATION 54
259 #define WLAN_REASON_MESH_CLOSE_RCVD 55
260 #define WLAN_REASON_MESH_MAX_RETRIES 56
261 #define WLAN_REASON_MESH_CONFIRM_TIMEOUT 57
262 #define WLAN_REASON_MESH_INVALID_GTK 58
263 #define WLAN_REASON_MESH_INCONSISTENT_PARAMS 59
264 #define WLAN_REASON_MESH_INVALID_SECURITY_CAP 60
265 #define WLAN_REASON_MESH_PATH_ERROR_NO_PROXY_INFO 61
266 #define WLAN_REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO 62
267 #define WLAN_REASON_MESH_PATH_ERROR_DEST_UNREACHABLE 63
268 #define WLAN_REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS 64
269 #define WLAN_REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ 65
270 #define WLAN_REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED 66
271 
272 
273 /* Information Element IDs (IEEE Std 802.11-2016, 9.4.2.1, Table 9-77) */
274 #define WLAN_EID_SSID 0
275 #define WLAN_EID_SUPP_RATES 1
276 #define WLAN_EID_DS_PARAMS 3
277 #define WLAN_EID_CF_PARAMS 4
278 #define WLAN_EID_TIM 5
279 #define WLAN_EID_IBSS_PARAMS 6
280 #define WLAN_EID_COUNTRY 7
281 #define WLAN_EID_REQUEST 10
282 #define WLAN_EID_BSS_LOAD 11
283 #define WLAN_EID_EDCA_PARAM_SET 12
284 #define WLAN_EID_TSPEC 13
285 #define WLAN_EID_TCLAS 14
286 #define WLAN_EID_SCHEDULE 15
287 #define WLAN_EID_CHALLENGE 16
288 #define WLAN_EID_PWR_CONSTRAINT 32
289 #define WLAN_EID_PWR_CAPABILITY 33
290 #define WLAN_EID_TPC_REQUEST 34
291 #define WLAN_EID_TPC_REPORT 35
292 #define WLAN_EID_SUPPORTED_CHANNELS 36
293 #define WLAN_EID_CHANNEL_SWITCH 37
294 #define WLAN_EID_MEASURE_REQUEST 38
295 #define WLAN_EID_MEASURE_REPORT 39
296 #define WLAN_EID_QUIET 40
297 #define WLAN_EID_IBSS_DFS 41
298 #define WLAN_EID_ERP_INFO 42
299 #define WLAN_EID_TS_DELAY 43
300 #define WLAN_EID_TCLAS_PROCESSING 44
301 #define WLAN_EID_HT_CAP 45
302 #define WLAN_EID_QOS 46
303 #define WLAN_EID_RSN 48
304 #define WLAN_EID_EXT_SUPP_RATES 50
305 #define WLAN_EID_AP_CHANNEL_REPORT 51
306 #define WLAN_EID_NEIGHBOR_REPORT 52
307 #define WLAN_EID_RCPI 53
308 #define WLAN_EID_MOBILITY_DOMAIN 54
309 #define WLAN_EID_FAST_BSS_TRANSITION 55
310 #define WLAN_EID_TIMEOUT_INTERVAL 56
311 #define WLAN_EID_RIC_DATA 57
312 #define WLAN_EID_DSE_REGISTERED_LOCATION 58
313 #define WLAN_EID_SUPPORTED_OPERATING_CLASSES 59
314 #define WLAN_EID_EXT_CHANSWITCH_ANN 60
315 #define WLAN_EID_HT_OPERATION 61
316 #define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
317 #define WLAN_EID_BSS_AVERAGE_ACCESS_DELAY 63
318 #define WLAN_EID_ANTENNA 64
319 #define WLAN_EID_RSNI 65
320 #define WLAN_EID_MEASUREMENT_PILOT_TRANSMISSION 66
321 #define WLAN_EID_BSS_AVAILABLE_ADM_CAPA 67
322 #define WLAN_EID_BSS_AC_ACCESS_DELAY 68 /* note: also used by WAPI */
323 #define WLAN_EID_TIME_ADVERTISEMENT 69
324 #define WLAN_EID_RRM_ENABLED_CAPABILITIES 70
325 #define WLAN_EID_MULTIPLE_BSSID 71
326 #define WLAN_EID_20_40_BSS_COEXISTENCE 72
327 #define WLAN_EID_20_40_BSS_INTOLERANT 73
328 #define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
329 #define WLAN_EID_RIC_DESCRIPTOR 75
330 #define WLAN_EID_MMIE 76
331 #define WLAN_EID_EVENT_REQUEST 78
332 #define WLAN_EID_EVENT_REPORT 79
333 #define WLAN_EID_DIAGNOSTIC_REQUEST 80
334 #define WLAN_EID_DIAGNOSTIC_REPORT 81
335 #define WLAN_EID_LOCATION_PARAMETERS 82
336 #define WLAN_EID_NONTRANSMITTED_BSSID_CAPA 83
337 #define WLAN_EID_SSID_LIST 84
338 #define WLAN_EID_MULTIPLE_BSSID_INDEX 85
339 #define WLAN_EID_FMS_DESCRIPTOR 86
340 #define WLAN_EID_FMS_REQUEST 87
341 #define WLAN_EID_FMS_RESPONSE 88
342 #define WLAN_EID_QOS_TRAFFIC_CAPABILITY 89
343 #define WLAN_EID_BSS_MAX_IDLE_PERIOD 90
344 #define WLAN_EID_TFS_REQ 91
345 #define WLAN_EID_TFS_RESP 92
346 #define WLAN_EID_WNMSLEEP 93
347 #define WLAN_EID_TIM_BROADCAST_REQUEST 94
348 #define WLAN_EID_TIM_BROADCAST_RESPONSE 95
349 #define WLAN_EID_COLLOCATED_INTERFERENCE_REPORT 96
350 #define WLAN_EID_CHANNEL_USAGE 97
351 #define WLAN_EID_TIME_ZONE 98
352 #define WLAN_EID_DMS_REQUEST 99
353 #define WLAN_EID_DMS_RESPONSE 100
354 #define WLAN_EID_LINK_ID 101
355 #define WLAN_EID_WAKEUP_SCHEDULE 102
356 #define WLAN_EID_CHANNEL_SWITCH_TIMING 104
357 #define WLAN_EID_PTI_CONTROL 105
358 #define WLAN_EID_TPU_BUFFER_STATUS 106
359 #define WLAN_EID_INTERWORKING 107
360 #define WLAN_EID_ADV_PROTO 108
361 #define WLAN_EID_EXPEDITED_BANDWIDTH_REQ 109
362 #define WLAN_EID_QOS_MAP_SET 110
363 #define WLAN_EID_ROAMING_CONSORTIUM 111
364 #define WLAN_EID_EMERGENCY_ALERT_ID 112
365 #define WLAN_EID_MESH_CONFIG 113
366 #define WLAN_EID_MESH_ID 114
367 #define WLAN_EID_MESH_LINK_METRIC_REPORT 115
368 #define WLAN_EID_CONGESTION_NOTIFICATION 116
369 #define WLAN_EID_PEER_MGMT 117
370 #define WLAN_EID_MESH_CHANNEL_SWITCH_PARAMETERS 118
371 #define WLAN_EID_MESH_AWAKE_WINDOW 119
372 #define WLAN_EID_BEACON_TIMING 120
373 #define WLAN_EID_MCCAOP_SETUP_REQUEST 121
374 #define WLAN_EID_MCCAOP_SETUP_REPLY 122
375 #define WLAN_EID_MCCAOP_ADVERTISEMENT 123
376 #define WLAN_EID_MCCAOP_TEARDOWN 124
377 #define WLAN_EID_GANN 125
378 #define WLAN_EID_RANN 126
379 #define WLAN_EID_EXT_CAPAB 127
380 #define WLAN_EID_PREQ 130
381 #define WLAN_EID_PREP 131
382 #define WLAN_EID_PERR 132
383 #define WLAN_EID_PXU 137
384 #define WLAN_EID_PXUC 138
385 #define WLAN_EID_AMPE 139
386 #define WLAN_EID_MIC 140
387 #define WLAN_EID_DESTINATION_URI 141
388 #define WLAN_EID_U_APSD_COEX 142
389 #define WLAN_EID_DMG_WAKEUP_SCHEDULE 143
390 #define WLAN_EID_EXTENDED_SCHEDULE 144
391 #define WLAN_EID_STA_AVAILABILITY 145
392 #define WLAN_EID_DMG_TSPEC 146
393 #define WLAN_EID_NEXT_DMG_ATI 147
394 #define WLAN_EID_DMG_CAPABILITIES 148
395 #define WLAN_EID_DMG_OPERATION 151
396 #define WLAN_EID_DMG_BSS_PARAMETER_CHANGE 152
397 #define WLAN_EID_DMG_BEAM_REFINEMENT 153
398 #define WLAN_EID_CHANNEL_MEASUREMENT_FEEDBACK 154
399 #define WLAN_EID_CCKM 156
400 #define WLAN_EID_AWAKE_WINDOW 157
401 #define WLAN_EID_MULTI_BAND 158
402 #define WLAN_EID_ADDBA_EXTENSION 159
403 #define WLAN_EID_NEXTPCP_LIST 160
404 #define WLAN_EID_PCP_HANDOVER 161
405 #define WLAN_EID_DMG_LINK_MARGIN 162
406 #define WLAN_EID_SWITCHING_STREAM 163
407 #define WLAN_EID_SESSION_TRANSITION 164
408 #define WLAN_EID_DYNAMIC_TONE_PAIRING_REPORT 165
409 #define WLAN_EID_CLUSTER_REPORT 166
410 #define WLAN_EID_REPLAY_CAPABILITIES 167
411 #define WLAN_EID_RELAY_TRANSFER_PARAM_SET 168
412 #define WLAN_EID_BEAMLINK_MAINTENANCE 169
413 #define WLAN_EID_MULTIPLE_MAC_SUBLAYERS 170
414 #define WLAN_EID_U_PID 171
415 #define WLAN_EID_DMG_LINK_ADAPTATION_ACK 172
416 #define WLAN_EID_MCCAOP_ADVERTISEMENT_OVERVIEW 174
417 #define WLAN_EID_QUIET_PERIOD_REQUEST 175
418 #define WLAN_EID_QUIET_PERIOD_RESPONSE 177
419 #define WLAN_EID_QMF_POLICY 181
420 #define WLAN_EID_ECAPC_POLICY 182
421 #define WLAN_EID_CLUSTER_TIME_OFFSET 183
422 #define WLAN_EID_INTRA_ACCESS_CATEGORY_PRIORITY 184
423 #define WLAN_EID_SCS_DESCRIPTOR 185
424 #define WLAN_EID_QLOAD_REPORT 186
425 #define WLAN_EID_HCCA_TXOP_UPDATE_COUNT 187
426 #define WLAN_EID_HIGHER_LAYER_STREAM_ID 188
427 #define WLAN_EID_GCR_GROUP_ADDRESS 189
428 #define WLAN_EID_ANTENNA_SECTOR_ID_PATTERN 190
429 #define WLAN_EID_VHT_CAP 191
430 #define WLAN_EID_VHT_OPERATION 192
431 #define WLAN_EID_VHT_EXTENDED_BSS_LOAD 193
432 #define WLAN_EID_VHT_WIDE_BW_CHSWITCH  194
433 #define WLAN_EID_VHT_TRANSMIT_POWER_ENVELOPE 195
434 #define WLAN_EID_VHT_CHANNEL_SWITCH_WRAPPER 196
435 #define WLAN_EID_VHT_AID 197
436 #define WLAN_EID_VHT_QUIET_CHANNEL 198
437 #define WLAN_EID_VHT_OPERATING_MODE_NOTIFICATION 199
438 #define WLAN_EID_UPSIM 200
439 #define WLAN_EID_REDUCED_NEIGHBOR_REPORT 201
440 #define WLAN_EID_TVHT_OPERATION 202
441 #define WLAN_EID_DEVICE_LOCATION 204
442 #define WLAN_EID_WHITE_SPACE_MAP 205
443 #define WLAN_EID_FTM_PARAMETERS 206
444 #define WLAN_EID_VENDOR_SPECIFIC 221
445 #define WLAN_EID_CAG_NUMBER 237
446 #define WLAN_EID_AP_CSN 239
447 #define WLAN_EID_FILS_INDICATION 240
448 #define WLAN_EID_DILS 241
449 #define WLAN_EID_FRAGMENT 242
450 #define WLAN_EID_RSNX 244
451 #define WLAN_EID_EXTENSION 255
452 
453 /* Element ID Extension (EID 255) values */
454 #define WLAN_EID_EXT_ASSOC_DELAY_INFO 1
455 #define WLAN_EID_EXT_FILS_REQ_PARAMS 2
456 #define WLAN_EID_EXT_FILS_KEY_CONFIRM 3
457 #define WLAN_EID_EXT_FILS_SESSION 4
458 #define WLAN_EID_EXT_FILS_HLP_CONTAINER 5
459 #define WLAN_EID_EXT_FILS_IP_ADDR_ASSIGN 6
460 #define WLAN_EID_EXT_KEY_DELIVERY 7
461 #define WLAN_EID_EXT_WRAPPED_DATA 8
462 #define WLAN_EID_EXT_FTM_SYNC_INFO 9
463 #define WLAN_EID_EXT_EXTENDED_REQUEST 10
464 #define WLAN_EID_EXT_ESTIMATED_SERVICE_PARAMS 11
465 #define WLAN_EID_EXT_FILS_PUBLIC_KEY 12
466 #define WLAN_EID_EXT_FILS_NONCE 13
467 #define WLAN_EID_EXT_FUTURE_CHANNEL_GUIDANCE 14
468 #define WLAN_EID_EXT_OWE_DH_PARAM 32
469 #define WLAN_EID_EXT_PASSWORD_IDENTIFIER 33
470 #define WLAN_EID_EXT_HE_CAPABILITIES 35
471 #define WLAN_EID_EXT_HE_OPERATION 36
472 #define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38
473 #define WLAN_EID_EXT_SPATIAL_REUSE 39
474 #define WLAN_EID_EXT_OCV_OCI 54
475 #define WLAN_EID_EXT_SHORT_SSID_LIST 58
476 #define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59
477 #define WLAN_EID_EXT_EDMG_CAPABILITIES 61
478 #define WLAN_EID_EXT_EDMG_OPERATION 62
479 #define WLAN_EID_EXT_REJECTED_GROUPS 92
480 #define WLAN_EID_EXT_ANTI_CLOGGING_TOKEN 93
481 
482 /* Extended Capabilities field */
483 #define WLAN_EXT_CAPAB_20_40_COEX 0
484 #define WLAN_EXT_CAPAB_GLK 1
485 #define WLAN_EXT_CAPAB_EXT_CHAN_SWITCH 2
486 #define WLAN_EXT_CAPAB_GLK_GCR 3
487 #define WLAN_EXT_CAPAB_PSMP 4
488 /* 5 - Reserved */
489 #define WLAN_EXT_CAPAB_S_PSMP 6
490 #define WLAN_EXT_CAPAB_EVENT 7
491 #define WLAN_EXT_CAPAB_DIAGNOSTICS 8
492 #define WLAN_EXT_CAPAB_MULTICAST_DIAGNOSTICS 9
493 #define WLAN_EXT_CAPAB_LOCATION_TRACKING 10
494 #define WLAN_EXT_CAPAB_FMS 11
495 #define WLAN_EXT_CAPAB_PROXY_ARP 12
496 #define WLAN_EXT_CAPAB_COLL_INTERF_REP 13
497 #define WLAN_EXT_CAPAB_CIVIC_LOCATION 14
498 #define WLAN_EXT_CAPAB_GEOSPATIAL_LOCATION 15
499 #define WLAN_EXT_CAPAB_TFS 16
500 #define WLAN_EXT_CAPAB_WNM_SLEEP_MODE 17
501 #define WLAN_EXT_CAPAB_TIM_BROADCAST 18
502 #define WLAN_EXT_CAPAB_BSS_TRANSITION 19
503 #define WLAN_EXT_CAPAB_QOS_TRAFFIC 20
504 #define WLAN_EXT_CAPAB_AC_STA_COUNT 21
505 #define WLAN_EXT_CAPAB_MULTIPLE_BSSID 22
506 #define WLAN_EXT_CAPAB_TIMING_MEASUREMENT 23
507 #define WLAN_EXT_CAPAB_CHANNEL_USAGE 24
508 #define WLAN_EXT_CAPAB_SSID_LIST 25
509 #define WLAN_EXT_CAPAB_DMS 26
510 #define WLAN_EXT_CAPAB_UTF_TSF_OFFSET 27
511 #define WLAN_EXT_CAPAB_TPU_BUFFER_STA 28
512 #define WLAN_EXT_CAPAB_TDLS_PEER_PSM 29
513 #define WLAN_EXT_CAPAB_TDLS_CHANNEL_SWITCH 30
514 #define WLAN_EXT_CAPAB_INTERWORKING 31
515 #define WLAN_EXT_CAPAB_QOS_MAP 32
516 #define WLAN_EXT_CAPAB_EBR 33
517 #define WLAN_EXT_CAPAB_SSPN_INTERFACE 34
518 /* 35 - Reserved */
519 #define WLAN_EXT_CAPAB_MSGCF 36
520 #define WLAN_EXT_CAPAB_TDLS 37
521 #define WLAN_EXT_CAPAB_TDLS_PROHIBITED 38
522 #define WLAN_EXT_CAPAB_TDLS_CHANNEL_SWITCH_PROHIBITED 39
523 #define WLAN_EXT_CAPAB_REJECT_UNADMITTED_FRAME 40
524 #define WLAN_EXT_CAPAB_
525 /* 41-43 - Service Interval Granularity */
526 #define WLAN_EXT_CAPAB_IDENTIFIER_LOCATION 44
527 #define WLAN_EXT_CAPAB_U_APSD_COEX 45
528 #define WLAN_EXT_CAPAB_WNM_NOTIFCATION 46
529 #define WLAN_EXT_CAPAB_QAB 47
530 #define WLAN_EXT_CAPAB_UTF_8_SSID 48
531 #define WLAN_EXT_CAPAB_QMF 49
532 #define WLAN_EXT_CAPAB_QMF_RECONFIG 50
533 #define WLAN_EXT_CAPAB_ROBUST_AV_STREAMING 51
534 #define WLAN_EXT_CAPAB_ADVANCED_GCR 52
535 #define WLAN_EXT_CAPAB_MESH_GCR 53
536 #define WLAN_EXT_CAPAB_SCS 54
537 #define WLAN_EXT_CAPAB_QLOAD_REPORT 55
538 #define WLAN_EXT_CAPAB_ALT_EDCA 56
539 #define WLAN_EXT_CAPAB_UNPROT_TXOP_NEG 57
540 #define WLAN_EXT_CAPAB_PROT_TXOP_NEG 58
541 /* 59 - Reserved */
542 #define WLAN_EXT_CAPAB_PROT_QLOAD_REPORT 60
543 #define WLAN_EXT_CAPAB_TDLS_WIDER_BW 61
544 #define WLAN_EXT_CAPAB_OPMODE_NOTIF 62
545 #define WLAN_EXT_CAPAB_
546 /* 63-64 - Max Number of MSDUs In A-MSDU */
547 #define WLAN_EXT_CAPAB_CHANNEL_SCHEDULE_MGMT 65
548 #define WLAN_EXT_CAPAB_GEODB_INBAND_ENABLING_SIGNAL 66
549 #define WLAN_EXT_CAPAB_NETWORK_CHANNEL_CTRL 67
550 #define WLAN_EXT_CAPAB_WHITE_SPACE_MAP 68
551 #define WLAN_EXT_CAPAB_CHANNEL_AVAIL_QUERY 69
552 #define WLAN_EXT_CAPAB_FTM_RESPONDER 70
553 #define WLAN_EXT_CAPAB_FTM_INITIATOR 71
554 #define WLAN_EXT_CAPAB_FILS 72
555 #define WLAN_EXT_CAPAB_EXT_SPECTRUM_MGMT 73
556 #define WLAN_EXT_CAPAB_FUTURE_CHANNEL_GUIDANCE 74
557 #define WLAN_EXT_CAPAB_PAD 75
558 /* 76-79 - Reserved */
559 #define WLAN_EXT_CAPAB_COMPLETE_NON_TX_BSSID_PROFILE 80
560 #define WLAN_EXT_CAPAB_SAE_PW_ID 81
561 #define WLAN_EXT_CAPAB_SAE_PW_ID_EXCLUSIVELY 82
562 #define WLAN_EXT_CAPAB_BEACON_PROTECTION 84
563 
564 /* Extended RSN Capabilities */
565 /* bits 0-3: Field length (n-1) */
566 #define WLAN_RSNX_CAPAB_PROTECTED_TWT 4
567 #define WLAN_RSNX_CAPAB_SAE_H2E 5
568 
569 /* Action frame categories (IEEE Std 802.11-2016, 9.4.1.11, Table 9-76) */
570 #define WLAN_ACTION_SPECTRUM_MGMT 0
571 #define WLAN_ACTION_QOS 1
572 #define WLAN_ACTION_DLS 2
573 #define WLAN_ACTION_BLOCK_ACK 3
574 #define WLAN_ACTION_PUBLIC 4
575 #define WLAN_ACTION_RADIO_MEASUREMENT 5
576 #define WLAN_ACTION_FT 6
577 #define WLAN_ACTION_HT 7
578 #define WLAN_ACTION_SA_QUERY 8
579 #define WLAN_ACTION_PROTECTED_DUAL 9
580 #define WLAN_ACTION_WNM 10
581 #define WLAN_ACTION_UNPROTECTED_WNM 11
582 #define WLAN_ACTION_TDLS 12
583 #define WLAN_ACTION_MESH 13
584 #define WLAN_ACTION_MULTIHOP 14
585 #define WLAN_ACTION_SELF_PROTECTED 15
586 #define WLAN_ACTION_DMG 16
587 #define WLAN_ACTION_WMM 17 /* WMM Specification 1.1 */
588 #define WLAN_ACTION_FST 18
589 #define WLAN_ACTION_ROBUST_AV_STREAMING 19
590 #define WLAN_ACTION_UNPROTECTED_DMG 20
591 #define WLAN_ACTION_VHT 21
592 #define WLAN_ACTION_FILS 26
593 #define WLAN_ACTION_VENDOR_SPECIFIC_PROTECTED 126
594 #define WLAN_ACTION_VENDOR_SPECIFIC 127
595 /* Note: 128-255 used to report errors by setting category | 0x80 */
596 
597 /* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */
598 #define WLAN_PA_20_40_BSS_COEX 0
599 #define WLAN_PA_DSE_ENABLEMENT 1
600 #define WLAN_PA_DSE_DEENABLEMENT 2
601 #define WLAN_PA_DSE_REG_LOCATION_ANNOUNCE 3
602 #define WLAN_PA_EXT_CHANNEL_SWITCH_ANNOUNCE 4
603 #define WLAN_PA_DSE_MEASUREMENT_REQ 5
604 #define WLAN_PA_DSE_MEASUREMENT_RESP 6
605 #define WLAN_PA_MEASUREMENT_PILOT 7
606 #define WLAN_PA_DSE_POWER_CONSTRAINT 8
607 #define WLAN_PA_VENDOR_SPECIFIC 9
608 #define WLAN_PA_GAS_INITIAL_REQ 10
609 #define WLAN_PA_GAS_INITIAL_RESP 11
610 #define WLAN_PA_GAS_COMEBACK_REQ 12
611 #define WLAN_PA_GAS_COMEBACK_RESP 13
612 #define WLAN_TDLS_DISCOVERY_RESPONSE 14
613 #define WLAN_PA_LOCATION_TRACK_NOTIFICATION 15
614 #define WLAN_PA_QAB_REQUEST_FRAME 16
615 #define WLAN_PA_QAB_RESPONSE_FRAME 17
616 #define WLAN_PA_QMF_POLICY 18
617 #define WLAN_PA_QMF_POLICY_CHANGE 19
618 #define WLAN_PA_QLOAD_REQUEST 20
619 #define WLAN_PA_QLOAD_REPORT 21
620 #define WLAN_PA_HCCA_TXOP_ADVERTISEMENT 22
621 #define WLAN_PA_HCCA_TXOP_RESPONSE 23
622 #define WLAN_PA_PUBLIC_KEY 24
623 #define WLAN_PA_CHANNEL_AVAILABILITY_QUERY 25
624 #define WLAN_PA_CHANNEL_SCHEDULE_MANAGEMENT 26
625 #define WLAN_PA_CONTACT_VERIFICATION_SIGNAL 27
626 #define WLAN_PA_GDD_ENABLEMENT_REQ 28
627 #define WLAN_PA_GDD_ENABLEMENT_RESP 29
628 #define WLAN_PA_NETWORK_CHANNEL_CONTROL 30
629 #define WLAN_PA_WHITE_SPACE_MAP_ANNOUNCEMENT 31
630 #define WLAN_PA_FTM_REQUEST 32
631 #define WLAN_PA_FTM 33
632 #define WLAN_PA_FILS_DISCOVERY 34
633 
634 /* Protected Dual of Public Action frames (IEEE Std 802.11-2016, 9.6.11,
635  * Table 9-332) */
636 #define WLAN_PROT_DSE_ENABLEMENT 1
637 #define WLAN_PROT_DSE_DEENABLEMENT 2
638 #define WLAN_PROT_EXT_CSA 4
639 #define WLAN_PROT_MEASUREMENT_REQ 5
640 #define WLAN_PROT_MEASUREMENT_REPORT 6
641 #define WLAN_PROT_DSE_POWER_CONSTRAINT 8
642 #define WLAN_PROT_VENDOR_SPECIFIC 9
643 #define WLAN_PROT_GAS_INITIAL_REQ 10
644 #define WLAN_PROT_GAS_INITIAL_RESP 11
645 #define WLAN_PROT_GAS_COMEBACK_REQ 12
646 #define WLAN_PROT_GAS_COMEBACK_RESP 13
647 #define WLAN_PROT_QAB_REQUEST_FRAME 16
648 #define WLAN_PROT_QAB_RESPONSE_FRAME 17
649 #define WLAN_PROT_QMF_POLICY 18
650 #define WLAN_PROT_QMF_POLICY_CHANGE 19
651 #define WLAN_PROT_QLOAD_REQUEST 20
652 #define WLAN_PROT_QLOAD_REPORT 21
653 #define WLAN_PROT_HCCA_TXOP_ADVERTISEMENT 22
654 #define WLAN_PROT_HCCA_TXOP_RESPONSE 23
655 #define WLAN_PROT_CHANNEL_AVAILABILITY_QUERY 25
656 #define WLAN_PROT_CHANNEL_SCHEDULE_MANAGEMENT 26
657 #define WLAN_PROT_CONTACT_VERIFICATION_SIGNAL 27
658 #define WLAN_PROT_GDD_ENABLEMENT_REQ 28
659 #define WLAN_PROT_GDD_ENABLEMENT_RESP 29
660 #define WLAN_PROT_NETWORK_CHANNEL_CONTROL 30
661 #define WLAN_PROT_WHITE_SPACE_MAP_ANNOUNCEMENT 31
662 
663 /* SA Query Action frame (IEEE 802.11w/D8.0, 7.4.9) */
664 #define WLAN_SA_QUERY_REQUEST 0
665 #define WLAN_SA_QUERY_RESPONSE 1
666 
667 #define WLAN_SA_QUERY_TR_ID_LEN 2
668 
669 /* TDLS action codes */
670 #define WLAN_TDLS_SETUP_REQUEST 0
671 #define WLAN_TDLS_SETUP_RESPONSE 1
672 #define WLAN_TDLS_SETUP_CONFIRM 2
673 #define WLAN_TDLS_TEARDOWN 3
674 #define WLAN_TDLS_PEER_TRAFFIC_INDICATION 4
675 #define WLAN_TDLS_CHANNEL_SWITCH_REQUEST 5
676 #define WLAN_TDLS_CHANNEL_SWITCH_RESPONSE 6
677 #define WLAN_TDLS_PEER_PSM_REQUEST 7
678 #define WLAN_TDLS_PEER_PSM_RESPONSE 8
679 #define WLAN_TDLS_PEER_TRAFFIC_RESPONSE 9
680 #define WLAN_TDLS_DISCOVERY_REQUEST 10
681 
682 /* Radio Measurement Action codes */
683 #define WLAN_RRM_RADIO_MEASUREMENT_REQUEST 0
684 #define WLAN_RRM_RADIO_MEASUREMENT_REPORT 1
685 #define WLAN_RRM_LINK_MEASUREMENT_REQUEST 2
686 #define WLAN_RRM_LINK_MEASUREMENT_REPORT 3
687 #define WLAN_RRM_NEIGHBOR_REPORT_REQUEST 4
688 #define WLAN_RRM_NEIGHBOR_REPORT_RESPONSE 5
689 
690 /* Radio Measurement capabilities (from RM Enabled Capabilities element)
691  * IEEE Std 802.11-2016, 9.4.2.45, Table 9-157 */
692 /* byte 1 (out of 5) */
693 #define WLAN_RRM_CAPS_LINK_MEASUREMENT BIT(0)
694 #define WLAN_RRM_CAPS_NEIGHBOR_REPORT BIT(1)
695 #define WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE BIT(4)
696 #define WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE BIT(5)
697 #define WLAN_RRM_CAPS_BEACON_REPORT_TABLE BIT(6)
698 /* byte 2 (out of 5) */
699 #define WLAN_RRM_CAPS_LCI_MEASUREMENT BIT(4)
700 /* byte 5 (out of 5) */
701 #define WLAN_RRM_CAPS_FTM_RANGE_REPORT BIT(2)
702 
703 /*
704  * IEEE P802.11-REVmc/D5.0, 9.4.2.21.19 (Fine Timing Measurement Range
705  * request) - Minimum AP count
706  */
707 #define WLAN_RRM_RANGE_REQ_MAX_MIN_AP 15
708 
709 /* Timeout Interval Type */
710 #define WLAN_TIMEOUT_REASSOC_DEADLINE 1
711 #define WLAN_TIMEOUT_KEY_LIFETIME 2
712 #define WLAN_TIMEOUT_ASSOC_COMEBACK 3
713 
714 /* Interworking element (IEEE 802.11u) - Access Network Options */
715 #define INTERWORKING_ANO_ACCESS_NETWORK_MASK 0x0f
716 #define INTERWORKING_ANO_INTERNET 0x10
717 #define INTERWORKING_ANO_ASRA 0x20
718 #define INTERWORKING_ANO_ESR 0x40
719 #define INTERWORKING_ANO_UESA 0x80
720 
721 #define INTERWORKING_ANT_PRIVATE 0
722 #define INTERWORKING_ANT_PRIVATE_WITH_GUEST 1
723 #define INTERWORKING_ANT_CHARGEABLE_PUBLIC 2
724 #define INTERWORKING_ANT_FREE_PUBLIC 3
725 #define INTERWORKING_ANT_PERSONAL_DEVICE 4
726 #define INTERWORKING_ANT_EMERGENCY_SERVICES 5
727 #define INTERWORKING_ANT_TEST 6
728 #define INTERWORKING_ANT_WILDCARD 15
729 
730 /* Advertisement Protocol ID definitions (IEEE Std 802.11-2016, Table 9-215) */
731 enum adv_proto_id {
732 	ACCESS_NETWORK_QUERY_PROTOCOL = 0,
733 	MIH_INFO_SERVICE = 1,
734 	MIH_CMD_AND_EVENT_DISCOVERY = 2,
735 	EMERGENCY_ALERT_SYSTEM = 3,
736 	REGISTERED_LOCATION_QUERY_PROTO = 4,
737 	ADV_PROTO_VENDOR_SPECIFIC = 221
738 };
739 
740 /* Access Network Query Protocol info ID definitions (IEEE Std 802.11-2016,
741  * Table 9-271; P802.11ai) */
742 enum anqp_info_id {
743 	ANQP_QUERY_LIST = 256,
744 	ANQP_CAPABILITY_LIST = 257,
745 	ANQP_VENUE_NAME = 258,
746 	ANQP_EMERGENCY_CALL_NUMBER = 259,
747 	ANQP_NETWORK_AUTH_TYPE = 260,
748 	ANQP_ROAMING_CONSORTIUM = 261,
749 	ANQP_IP_ADDR_TYPE_AVAILABILITY = 262,
750 	ANQP_NAI_REALM = 263,
751 	ANQP_3GPP_CELLULAR_NETWORK = 264,
752 	ANQP_AP_GEOSPATIAL_LOCATION = 265,
753 	ANQP_AP_CIVIC_LOCATION = 266,
754 	ANQP_AP_LOCATION_PUBLIC_URI = 267,
755 	ANQP_DOMAIN_NAME = 268,
756 	ANQP_EMERGENCY_ALERT_URI = 269,
757 	ANQP_TDLS_CAPABILITY = 270,
758 	ANQP_EMERGENCY_NAI = 271,
759 	ANQP_NEIGHBOR_REPORT = 272,
760 	ANQP_QUERY_AP_LIST = 273,
761 	ANQP_AP_LIST_RESPONSE = 274,
762 	ANQP_FILS_REALM_INFO = 275,
763 	ANQP_CAG = 276,
764 	ANQP_VENUE_URL = 277,
765 	ANQP_ADVICE_OF_CHARGE = 278,
766 	ANQP_LOCAL_CONTENT = 279,
767 	ANQP_NETWORK_AUTH_TYPE_TIMESTAMP = 280,
768 	ANQP_VENDOR_SPECIFIC = 56797
769 };
770 
771 /* NAI Realm list - EAP Method subfield - Authentication Parameter ID */
772 enum nai_realm_eap_auth_param {
773 	NAI_REALM_EAP_AUTH_EXPANDED_EAP_METHOD = 1,
774 	NAI_REALM_EAP_AUTH_NON_EAP_INNER_AUTH = 2,
775 	NAI_REALM_EAP_AUTH_INNER_AUTH_EAP_METHOD = 3,
776 	NAI_REALM_EAP_AUTH_EXPANDED_INNER_EAP_METHOD = 4,
777 	NAI_REALM_EAP_AUTH_CRED_TYPE = 5,
778 	NAI_REALM_EAP_AUTH_TUNNELED_CRED_TYPE = 6,
779 	NAI_REALM_EAP_AUTH_VENDOR_SPECIFIC = 221
780 };
781 
782 enum nai_realm_eap_auth_inner_non_eap {
783 	NAI_REALM_INNER_NON_EAP_PAP = 1,
784 	NAI_REALM_INNER_NON_EAP_CHAP = 2,
785 	NAI_REALM_INNER_NON_EAP_MSCHAP = 3,
786 	NAI_REALM_INNER_NON_EAP_MSCHAPV2 = 4
787 };
788 
789 enum nai_realm_eap_cred_type {
790 	NAI_REALM_CRED_TYPE_SIM = 1,
791 	NAI_REALM_CRED_TYPE_USIM = 2,
792 	NAI_REALM_CRED_TYPE_NFC_SECURE_ELEMENT = 3,
793 	NAI_REALM_CRED_TYPE_HARDWARE_TOKEN = 4,
794 	NAI_REALM_CRED_TYPE_SOFTOKEN = 5,
795 	NAI_REALM_CRED_TYPE_CERTIFICATE = 6,
796 	NAI_REALM_CRED_TYPE_USERNAME_PASSWORD = 7,
797 	NAI_REALM_CRED_TYPE_NONE = 8,
798 	NAI_REALM_CRED_TYPE_ANONYMOUS = 9,
799 	NAI_REALM_CRED_TYPE_VENDOR_SPECIFIC = 10
800 };
801 
802 /*
803  * IEEE P802.11-REVmc/D5.0 Table 9-81 - Measurement type definitions for
804  * measurement requests
805  */
806 enum measure_type {
807 	MEASURE_TYPE_BASIC = 0,
808 	MEASURE_TYPE_CCA = 1,
809 	MEASURE_TYPE_RPI_HIST = 2,
810 	MEASURE_TYPE_CHANNEL_LOAD = 3,
811 	MEASURE_TYPE_NOISE_HIST = 4,
812 	MEASURE_TYPE_BEACON = 5,
813 	MEASURE_TYPE_FRAME = 6,
814 	MEASURE_TYPE_STA_STATISTICS = 7,
815 	MEASURE_TYPE_LCI = 8,
816 	MEASURE_TYPE_TRANSMIT_STREAM = 9,
817 	MEASURE_TYPE_MULTICAST_DIAG = 10,
818 	MEASURE_TYPE_LOCATION_CIVIC = 11,
819 	MEASURE_TYPE_LOCATION_ID = 12,
820 	MEASURE_TYPE_DIRECTIONAL_CHAN_QUALITY = 13,
821 	MEASURE_TYPE_DIRECTIONAL_MEASURE = 14,
822 	MEASURE_TYPE_DIRECTIONAL_STATS = 15,
823 	MEASURE_TYPE_FTM_RANGE = 16,
824 	MEASURE_TYPE_MEASURE_PAUSE = 255,
825 };
826 
827 /* IEEE Std 802.11-2012 Table 8-71 - Location subject definition */
828 enum location_subject {
829 	LOCATION_SUBJECT_LOCAL = 0,
830 	LOCATION_SUBJECT_REMOTE = 1,
831 	LOCATION_SUBJECT_3RD_PARTY = 2,
832 };
833 
834 /*
835  * IEEE P802.11-REVmc/D5.0 Table 9-94 - Optional subelement IDs for LCI request
836  */
837 enum lci_req_subelem {
838 	LCI_REQ_SUBELEM_AZIMUTH_REQ = 1,
839 	LCI_REQ_SUBELEM_ORIGINATOR_MAC_ADDR = 2,
840 	LCI_REQ_SUBELEM_TARGET_MAC_ADDR = 3,
841 	LCI_REQ_SUBELEM_MAX_AGE = 4,
842 };
843 
844 #define FILS_NONCE_LEN 16
845 #define FILS_SESSION_LEN 8
846 #define FILS_CACHE_ID_LEN 2
847 #define FILS_MAX_KEY_AUTH_LEN 48
848 
849 #ifdef _MSC_VER
850 #pragma pack(push, 1)
851 #endif /* _MSC_VER */
852 
853 struct ieee80211_hdr {
854 	le16 frame_control;
855 	le16 duration_id;
856 	u8 addr1[6];
857 	u8 addr2[6];
858 	u8 addr3[6];
859 	le16 seq_ctrl;
860 	/* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
861 	 */
862 } STRUCT_PACKED;
863 
864 #define IEEE80211_DA_FROMDS addr1
865 #define IEEE80211_BSSID_FROMDS addr2
866 #define IEEE80211_SA_FROMDS addr3
867 
868 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
869 
870 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
871 
872 struct ieee80211_mgmt {
873 	le16 frame_control;
874 	le16 duration;
875 	u8 da[6];
876 	u8 sa[6];
877 	u8 bssid[6];
878 	le16 seq_ctrl;
879 	union {
880 		struct {
881 			le16 auth_alg;
882 			le16 auth_transaction;
883 			le16 status_code;
884 			/* possibly followed by Challenge text */
885 			u8 variable[];
886 		} STRUCT_PACKED auth;
887 		struct {
888 			le16 reason_code;
889 			u8 variable[];
890 		} STRUCT_PACKED deauth;
891 		struct {
892 			le16 capab_info;
893 			le16 listen_interval;
894 			/* followed by SSID and Supported rates */
895 			u8 variable[];
896 		} STRUCT_PACKED assoc_req;
897 		struct {
898 			le16 capab_info;
899 			le16 status_code;
900 			le16 aid;
901 			/* followed by Supported rates */
902 			u8 variable[];
903 		} STRUCT_PACKED assoc_resp, reassoc_resp;
904 		struct {
905 			le16 capab_info;
906 			le16 listen_interval;
907 			u8 current_ap[6];
908 			/* followed by SSID and Supported rates */
909 			u8 variable[];
910 		} STRUCT_PACKED reassoc_req;
911 		struct {
912 			le16 reason_code;
913 			u8 variable[];
914 		} STRUCT_PACKED disassoc;
915 		struct {
916 			u8 timestamp[8];
917 			le16 beacon_int;
918 			le16 capab_info;
919 			/* followed by some of SSID, Supported rates,
920 			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
921 			u8 variable[];
922 		} STRUCT_PACKED beacon;
923 		/* probe_req: only variable items: SSID, Supported rates */
924 		struct {
925 			u8 timestamp[8];
926 			le16 beacon_int;
927 			le16 capab_info;
928 			/* followed by some of SSID, Supported rates,
929 			 * FH Params, DS Params, CF Params, IBSS Params */
930 			u8 variable[];
931 		} STRUCT_PACKED probe_resp;
932 		struct {
933 			u8 category;
934 			union {
935 				struct {
936 					u8 action_code;
937 					u8 dialog_token;
938 					u8 status_code;
939 					u8 variable[];
940 				} STRUCT_PACKED wmm_action;
941 				struct{
942 					u8 action_code;
943 					u8 element_id;
944 					u8 length;
945 					u8 switch_mode;
946 					u8 new_chan;
947 					u8 switch_count;
948 				} STRUCT_PACKED chan_switch;
949 				struct {
950 					u8 action;
951 					u8 sta_addr[ETH_ALEN];
952 					u8 target_ap_addr[ETH_ALEN];
953 					u8 variable[]; /* FT Request */
954 				} STRUCT_PACKED ft_action_req;
955 				struct {
956 					u8 action;
957 					u8 sta_addr[ETH_ALEN];
958 					u8 target_ap_addr[ETH_ALEN];
959 					le16 status_code;
960 					u8 variable[]; /* FT Request */
961 				} STRUCT_PACKED ft_action_resp;
962 				struct {
963 					u8 action;
964 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
965 					u8 variable[]; /* OCI element */
966 				} STRUCT_PACKED sa_query_req;
967 				struct {
968 					u8 action; /* */
969 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
970 					u8 variable[]; /* OCI element */
971 				} STRUCT_PACKED sa_query_resp;
972 				struct {
973 					u8 action;
974 					u8 dialogtoken;
975 					u8 variable[];
976 				} STRUCT_PACKED wnm_sleep_req;
977 				struct {
978 					u8 action;
979 					u8 dialogtoken;
980 					le16 keydata_len;
981 					u8 variable[];
982 				} STRUCT_PACKED wnm_sleep_resp;
983 				struct {
984 					u8 action;
985 					u8 variable[];
986 				} STRUCT_PACKED public_action;
987 				struct {
988 					u8 action; /* 9 */
989 					u8 oui[3];
990 					/* Vendor-specific content */
991 					u8 variable[];
992 				} STRUCT_PACKED vs_public_action;
993 				struct {
994 					u8 action; /* 7 */
995 					u8 dialog_token;
996 					u8 req_mode;
997 					le16 disassoc_timer;
998 					u8 validity_interval;
999 					/* BSS Termination Duration (optional),
1000 					 * Session Information URL (optional),
1001 					 * BSS Transition Candidate List
1002 					 * Entries */
1003 					u8 variable[];
1004 				} STRUCT_PACKED bss_tm_req;
1005 				struct {
1006 					u8 action; /* 8 */
1007 					u8 dialog_token;
1008 					u8 status_code;
1009 					u8 bss_termination_delay;
1010 					/* Target BSSID (optional),
1011 					 * BSS Transition Candidate List
1012 					 * Entries (optional) */
1013 					u8 variable[];
1014 				} STRUCT_PACKED bss_tm_resp;
1015 				struct {
1016 					u8 action; /* 6 */
1017 					u8 dialog_token;
1018 					u8 query_reason;
1019 					/* BSS Transition Candidate List
1020 					 * Entries (optional) */
1021 					u8 variable[];
1022 				} STRUCT_PACKED bss_tm_query;
1023 				struct {
1024 					u8 action; /* 11 */
1025 					u8 dialog_token;
1026 					u8 req_info;
1027 				} STRUCT_PACKED coloc_intf_req;
1028 				struct {
1029 					u8 action; /* 12 */
1030 					u8 dialog_token;
1031 					u8 variable[];
1032 				} STRUCT_PACKED coloc_intf_report;
1033 				struct {
1034 					u8 action; /* 15 */
1035 					u8 variable[];
1036 				} STRUCT_PACKED slf_prot_action;
1037 				struct {
1038 					u8 action;
1039 					u8 variable[];
1040 				} STRUCT_PACKED fst_action;
1041 				struct {
1042 					u8 action;
1043 					u8 dialog_token;
1044 					u8 variable[];
1045 				} STRUCT_PACKED rrm;
1046 			} u;
1047 		} STRUCT_PACKED action;
1048 	} u;
1049 } STRUCT_PACKED;
1050 
1051 
1052 #define IEEE80211_MAX_MMPDU_SIZE 2304
1053 
1054 /* Rx MCS bitmask is in the first 77 bits of supported_mcs_set */
1055 #define IEEE80211_HT_MCS_MASK_LEN 10
1056 
1057 /* HT Capabilities element */
1058 struct ieee80211_ht_capabilities {
1059 	le16 ht_capabilities_info;
1060 	u8 a_mpdu_params; /* Maximum A-MPDU Length Exponent B0..B1
1061 			   * Minimum MPDU Start Spacing B2..B4
1062 			   * Reserved B5..B7 */
1063 	u8 supported_mcs_set[16];
1064 	le16 ht_extended_capabilities;
1065 	le32 tx_bf_capability_info;
1066 	u8 asel_capabilities;
1067 } STRUCT_PACKED;
1068 
1069 
1070 /* HT Operation element */
1071 struct ieee80211_ht_operation {
1072 	u8 primary_chan;
1073 	/* Five octets of HT Operation Information */
1074 	u8 ht_param; /* B0..B7 */
1075 	le16 operation_mode; /* B8..B23 */
1076 	le16 param; /* B24..B39 */
1077 	u8 basic_mcs_set[16];
1078 } STRUCT_PACKED;
1079 
1080 
1081 struct ieee80211_obss_scan_parameters {
1082 	le16 scan_passive_dwell;
1083 	le16 scan_active_dwell;
1084 	le16 width_trigger_scan_interval;
1085 	le16 scan_passive_total_per_channel;
1086 	le16 scan_active_total_per_channel;
1087 	le16 channel_transition_delay_factor;
1088 	le16 scan_activity_threshold;
1089 } STRUCT_PACKED;
1090 
1091 
1092 struct ieee80211_vht_capabilities {
1093 	le32 vht_capabilities_info;
1094 	struct {
1095 		le16 rx_map;
1096 		le16 rx_highest;
1097 		le16 tx_map;
1098 		le16 tx_highest;
1099 	} vht_supported_mcs_set;
1100 } STRUCT_PACKED;
1101 
1102 struct ieee80211_vht_operation {
1103 	u8 vht_op_info_chwidth;
1104 	u8 vht_op_info_chan_center_freq_seg0_idx;
1105 	u8 vht_op_info_chan_center_freq_seg1_idx;
1106 	le16 vht_basic_mcs_set;
1107 } STRUCT_PACKED;
1108 
1109 struct ieee80211_vht_operation_info {
1110 	u8 vht_op_info_chwidth;
1111 	u8 vht_op_info_chan_center_freq_seg0_idx;
1112 	u8 vht_op_info_chan_center_freq_seg1_idx;
1113 } STRUCT_PACKED;
1114 
1115 struct ieee80211_ampe_ie {
1116 	u8 selected_pairwise_suite[4];
1117 	u8 local_nonce[32];
1118 	u8 peer_nonce[32];
1119 	/* Followed by
1120 	 * Key Replay Counter[8] (optional)
1121 	 *	(only in Mesh Group Key Inform/Acknowledge frames)
1122 	 * GTKdata[variable] (optional)
1123 	 *	(MGTK[variable] || Key RSC[8] || GTKExpirationTime[4])
1124 	 * IGTKdata[variable] (optional)
1125 	 *	(Key ID[2], IPN[6], IGTK[variable] in IGTK KDE format)
1126 	 */
1127 } STRUCT_PACKED;
1128 
1129 #ifdef _MSC_VER
1130 #pragma pack(pop)
1131 #endif /* _MSC_VER */
1132 
1133 #define ERP_INFO_NON_ERP_PRESENT BIT(0)
1134 #define ERP_INFO_USE_PROTECTION BIT(1)
1135 #define ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
1136 
1137 #define OVERLAPPING_BSS_TRANS_DELAY_FACTOR 5
1138 
1139 /* HT Capabilities Info field within HT Capabilities element */
1140 #define HT_CAP_INFO_LDPC_CODING_CAP		((u16) BIT(0))
1141 #define HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET	((u16) BIT(1))
1142 #define HT_CAP_INFO_SMPS_MASK			((u16) (BIT(2) | BIT(3)))
1143 #define HT_CAP_INFO_SMPS_STATIC			((u16) 0)
1144 #define HT_CAP_INFO_SMPS_DYNAMIC		((u16) BIT(2))
1145 #define HT_CAP_INFO_SMPS_DISABLED		((u16) (BIT(2) | BIT(3)))
1146 #define HT_CAP_INFO_GREEN_FIELD			((u16) BIT(4))
1147 #define HT_CAP_INFO_SHORT_GI20MHZ		((u16) BIT(5))
1148 #define HT_CAP_INFO_SHORT_GI40MHZ		((u16) BIT(6))
1149 #define HT_CAP_INFO_TX_STBC			((u16) BIT(7))
1150 #define HT_CAP_INFO_RX_STBC_MASK		((u16) (BIT(8) | BIT(9)))
1151 #define HT_CAP_INFO_RX_STBC_1			((u16) BIT(8))
1152 #define HT_CAP_INFO_RX_STBC_12			((u16) BIT(9))
1153 #define HT_CAP_INFO_RX_STBC_123			((u16) (BIT(8) | BIT(9)))
1154 #define HT_CAP_INFO_DELAYED_BA			((u16) BIT(10))
1155 #define HT_CAP_INFO_MAX_AMSDU_SIZE		((u16) BIT(11))
1156 #define HT_CAP_INFO_DSSS_CCK40MHZ		((u16) BIT(12))
1157 /* B13 - Reserved (was PSMP support during P802.11n development) */
1158 #define HT_CAP_INFO_40MHZ_INTOLERANT		((u16) BIT(14))
1159 #define HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT	((u16) BIT(15))
1160 
1161 /* HT Extended Capabilities field within HT Capabilities element */
1162 #define EXT_HT_CAP_INFO_PCO			((u16) BIT(0))
1163 #define EXT_HT_CAP_INFO_PCO_TRANS_TIME_MASK	((u16) (BIT(1) | BIT(2)))
1164 #define EXT_HT_CAP_INFO_TRANS_TIME_OFFSET	1
1165 /* B3..B7 - Reserved */
1166 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_MASK	((u16) (BIT(8) | BIT(9)))
1167 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_OFFSET	8
1168 #define EXT_HT_CAP_INFO_HTC_SUPPORT		((u16) BIT(10))
1169 #define EXT_HT_CAP_INFO_RD_RESPONDER		((u16) BIT(11))
1170 /* B12..B15 - Reserved */
1171 
1172 /* Transmit Beanforming Capabilities within HT Capabilities element */
1173 #define TX_BF_CAP_IMPLICIT_TXBF_RX_CAP ((u32) BIT(0))
1174 #define TX_BF_CAP_RX_STAGGERED_SOUNDING_CAP ((u32) BIT(1))
1175 #define TX_BF_CAP_TX_STAGGERED_SOUNDING_CAP ((u32) BIT(2))
1176 #define TX_BF_CAP_RX_NDP_CAP ((u32) BIT(3))
1177 #define TX_BF_CAP_TX_NDP_CAP ((u32) BIT(4))
1178 #define TX_BF_CAP_IMPLICIT_TX_BF_CAP ((u32) BIT(5))
1179 #define TX_BF_CAP_CALIBRATION_MASK ((u32) (BIT(6) | BIT(7))
1180 #define TX_BF_CAP_CALIB_OFFSET 6
1181 #define TX_BF_CAP_EXPLICIT_CSI_TXBF_CAP ((u32) BIT(8))
1182 #define TX_BF_CAP_EXPLICIT_NONCOMPR_STEERING_CAP ((u32) BIT(9))
1183 #define TX_BF_CAP_EXPLICIT_COMPR_STEERING_CAP ((u32) BIT(10))
1184 #define TX_BF_CAP_EXPLICIT_TX_BF_CSI_FEEDBACK_MASK ((u32) (BIT(10) | BIT(11)))
1185 #define TX_BF_CAP_EXPLICIT_BF_CSI_FEEDBACK_OFFSET 11
1186 #define TX_BF_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_FEEDBACK_OFFSET 13
1187 #define TX_BF_CAP_EXPLICIT_COMPRESSED_STEERING_MATRIX_FEEDBACK_OFFSET 15
1188 #define TX_BF_CAP_MINIMAL_GROUPING_OFFSET 17
1189 #define TX_BF_CAP_CSI_NUM_BEAMFORMER_ANT_OFFSET 19
1190 #define TX_BF_CAP_UNCOMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 21
1191 #define TX_BF_CAP_COMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 23
1192 #define TX_BF_CAP_SCI_MAX_OF_ROWS_BEANFORMER_SUPPORTED_OFFSET 25
1193 #define TX_BF_CAP_CHANNEL_ESTIMATION_CAP_MASK ((u32) (BIT(27) | BIT(28)))
1194 #define TX_BF_CAP_CHANNEL_ESTIMATION_CAP_OFFSET 27
1195 /* B29..B31 - Reserved */
1196 
1197 /* ASEL Capability field within HT Capabilities element */
1198 #define ASEL_CAP_ASEL_CAPABLE ((u8) BIT(0))
1199 #define ASEL_CAP_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(1))
1200 #define ASEL_CAP_ANT_INDICES_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(2))
1201 #define ASEL_CAP_EXPLICIT_CSI_FEEDBACK_CAP ((u8) BIT(3))
1202 #define ASEL_CAP_ANT_INDICES_FEEDBACK_CAP ((u8) BIT(4))
1203 #define ASEL_CAP_RX_AS_CAP ((u8) BIT(5))
1204 #define ASEL_CAP_TX_SOUNDING_PPDUS_CAP ((u8) BIT(6))
1205 /* B7 - Reserved */
1206 
1207 /* First octet of HT Operation Information within HT Operation element */
1208 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK	((u8) BIT(0) | BIT(1))
1209 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE		((u8) BIT(0))
1210 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW		((u8) BIT(0) | BIT(1))
1211 #define HT_INFO_HT_PARAM_STA_CHNL_WIDTH			((u8) BIT(2))
1212 #define HT_INFO_HT_PARAM_RIFS_MODE			((u8) BIT(3))
1213 /* B4..B7 - Reserved */
1214 
1215 /* HT Protection (B8..B9 of HT Operation Information) */
1216 #define HT_PROT_NO_PROTECTION           0
1217 #define HT_PROT_NONMEMBER_PROTECTION    1
1218 #define HT_PROT_20MHZ_PROTECTION        2
1219 #define HT_PROT_NON_HT_MIXED            3
1220 /* Bits within ieee80211_ht_operation::operation_mode (BIT(0) maps to B8 in
1221  * HT Operation Information) */
1222 #define HT_OPER_OP_MODE_HT_PROT_MASK ((u16) (BIT(0) | BIT(1))) /* B8..B9 */
1223 #define HT_OPER_OP_MODE_NON_GF_HT_STAS_PRESENT	((u16) BIT(2)) /* B10 */
1224 /* BIT(3), i.e., B11 in HT Operation Information field - Reserved */
1225 #define HT_OPER_OP_MODE_OBSS_NON_HT_STAS_PRESENT	((u16) BIT(4)) /* B12 */
1226 /* BIT(5)..BIT(15), i.e., B13..B23 - Reserved */
1227 
1228 /* Last two octets of HT Operation Information (BIT(0) = B24) */
1229 /* B24..B29 - Reserved */
1230 #define HT_OPER_PARAM_DUAL_BEACON			((u16) BIT(6))
1231 #define HT_OPER_PARAM_DUAL_CTS_PROTECTION		((u16) BIT(7))
1232 #define HT_OPER_PARAM_STBC_BEACON			((u16) BIT(8))
1233 #define HT_OPER_PARAM_LSIG_TXOP_PROT_FULL_SUPP		((u16) BIT(9))
1234 #define HT_OPER_PARAM_PCO_ACTIVE			((u16) BIT(10))
1235 #define HT_OPER_PARAM_PCO_PHASE				((u16) BIT(11))
1236 /* B36..B39 - Reserved */
1237 
1238 #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126
1239 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
1240 #define BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY 123
1241 
1242 /* VHT Defines */
1243 #define VHT_CAP_MAX_MPDU_LENGTH_7991                ((u32) BIT(0))
1244 #define VHT_CAP_MAX_MPDU_LENGTH_11454               ((u32) BIT(1))
1245 #define VHT_CAP_MAX_MPDU_LENGTH_MASK                ((u32) BIT(0) | BIT(1))
1246 #define VHT_CAP_MAX_MPDU_LENGTH_MASK_SHIFT          0
1247 #define VHT_CAP_SUPP_CHAN_WIDTH_160MHZ              ((u32) BIT(2))
1248 #define VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ     ((u32) BIT(3))
1249 #define VHT_CAP_SUPP_CHAN_WIDTH_MASK                ((u32) BIT(2) | BIT(3))
1250 #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT          2
1251 #define VHT_CAP_RXLDPC                              ((u32) BIT(4))
1252 #define VHT_CAP_SHORT_GI_80                         ((u32) BIT(5))
1253 #define VHT_CAP_SHORT_GI_160                        ((u32) BIT(6))
1254 #define VHT_CAP_TXSTBC                              ((u32) BIT(7))
1255 #define VHT_CAP_RXSTBC_1                            ((u32) BIT(8))
1256 #define VHT_CAP_RXSTBC_2                            ((u32) BIT(9))
1257 #define VHT_CAP_RXSTBC_3                            ((u32) BIT(8) | BIT(9))
1258 #define VHT_CAP_RXSTBC_4                            ((u32) BIT(10))
1259 #define VHT_CAP_RXSTBC_MASK                         ((u32) BIT(8) | BIT(9) | \
1260 							   BIT(10))
1261 #define VHT_CAP_RXSTBC_MASK_SHIFT                   8
1262 #define VHT_CAP_SU_BEAMFORMER_CAPABLE               ((u32) BIT(11))
1263 #define VHT_CAP_SU_BEAMFORMEE_CAPABLE               ((u32) BIT(12))
1264 #define VHT_CAP_BEAMFORMEE_STS_MAX                  ((u32) BIT(13) | \
1265 							   BIT(14) | BIT(15))
1266 #define VHT_CAP_BEAMFORMEE_STS_MAX_SHIFT            13
1267 #define VHT_CAP_BEAMFORMEE_STS_OFFSET               13
1268 #define VHT_CAP_SOUNDING_DIMENSION_MAX              ((u32) BIT(16) | \
1269 							   BIT(17) | BIT(18))
1270 #define VHT_CAP_SOUNDING_DIMENSION_MAX_SHIFT        16
1271 #define VHT_CAP_SOUNDING_DIMENSION_OFFSET           16
1272 #define VHT_CAP_MU_BEAMFORMER_CAPABLE               ((u32) BIT(19))
1273 #define VHT_CAP_MU_BEAMFORMEE_CAPABLE               ((u32) BIT(20))
1274 #define VHT_CAP_VHT_TXOP_PS                         ((u32) BIT(21))
1275 #define VHT_CAP_HTC_VHT                             ((u32) BIT(22))
1276 
1277 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_1        ((u32) BIT(23))
1278 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_2        ((u32) BIT(24))
1279 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_3        ((u32) BIT(23) | BIT(24))
1280 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_4        ((u32) BIT(25))
1281 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_5        ((u32) BIT(23) | BIT(25))
1282 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_6        ((u32) BIT(24) | BIT(25))
1283 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX      ((u32) BIT(23) | \
1284 							   BIT(24) | BIT(25))
1285 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX_SHIFT 23
1286 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB   ((u32) BIT(27))
1287 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB     ((u32) BIT(26) | BIT(27))
1288 #define VHT_CAP_RX_ANTENNA_PATTERN                  ((u32) BIT(28))
1289 #define VHT_CAP_TX_ANTENNA_PATTERN                  ((u32) BIT(29))
1290 
1291 #define VHT_OPMODE_CHANNEL_WIDTH_MASK		    ((u8) BIT(0) | BIT(1))
1292 #define VHT_OPMODE_CHANNEL_RxNSS_MASK		    ((u8) BIT(4) | BIT(5) | \
1293 						     BIT(6))
1294 #define VHT_OPMODE_NOTIF_RX_NSS_SHIFT		    4
1295 
1296 #define VHT_RX_NSS_MAX_STREAMS			    8
1297 
1298 /* VHT/EDMG channel widths */
1299 #define CHANWIDTH_USE_HT	0
1300 #define CHANWIDTH_80MHZ		1
1301 #define CHANWIDTH_160MHZ	2
1302 #define CHANWIDTH_80P80MHZ	3
1303 #define CHANWIDTH_2160MHZ	4
1304 #define CHANWIDTH_4320MHZ	5
1305 #define CHANWIDTH_6480MHZ	6
1306 #define CHANWIDTH_8640MHZ	7
1307 
1308 #define HE_NSS_MAX_STREAMS			    8
1309 
1310 #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
1311 				* 00:50:F2 */
1312 #define WPA_IE_VENDOR_TYPE 0x0050f201
1313 #define WMM_IE_VENDOR_TYPE 0x0050f202
1314 #define WPS_IE_VENDOR_TYPE 0x0050f204
1315 #define OUI_WFA 0x506f9a
1316 #define P2P_IE_VENDOR_TYPE 0x506f9a09
1317 #define WFD_IE_VENDOR_TYPE 0x506f9a0a
1318 #define WFD_OUI_TYPE 10
1319 #define HS20_IE_VENDOR_TYPE 0x506f9a10
1320 #define OSEN_IE_VENDOR_TYPE 0x506f9a12
1321 #define MBO_IE_VENDOR_TYPE 0x506f9a16
1322 #define MBO_OUI_TYPE 22
1323 #define OWE_IE_VENDOR_TYPE 0x506f9a1c
1324 #define OWE_OUI_TYPE 28
1325 #define MULTI_AP_OUI_TYPE 0x1B
1326 #define DPP_CC_IE_VENDOR_TYPE 0x506f9a1e
1327 #define DPP_CC_OUI_TYPE 0x1e
1328 
1329 #define MULTI_AP_SUB_ELEM_TYPE 0x06
1330 #define MULTI_AP_TEAR_DOWN BIT(4)
1331 #define MULTI_AP_FRONTHAUL_BSS BIT(5)
1332 #define MULTI_AP_BACKHAUL_BSS BIT(6)
1333 #define MULTI_AP_BACKHAUL_STA BIT(7)
1334 
1335 #define WMM_OUI_TYPE 2
1336 #define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
1337 #define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
1338 #define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
1339 #define WMM_VERSION 1
1340 
1341 #define WMM_ACTION_CODE_ADDTS_REQ 0
1342 #define WMM_ACTION_CODE_ADDTS_RESP 1
1343 #define WMM_ACTION_CODE_DELTS 2
1344 
1345 #define WMM_ADDTS_STATUS_ADMISSION_ACCEPTED 0
1346 #define WMM_ADDTS_STATUS_INVALID_PARAMETERS 1
1347 /* 2 - Reserved */
1348 #define WMM_ADDTS_STATUS_REFUSED 3
1349 /* 4-255 - Reserved */
1350 
1351 /* WMM TSPEC Direction Field Values */
1352 #define WMM_TSPEC_DIRECTION_UPLINK 0
1353 #define WMM_TSPEC_DIRECTION_DOWNLINK 1
1354 /* 2 - Reserved */
1355 #define WMM_TSPEC_DIRECTION_BI_DIRECTIONAL 3
1356 
1357 /*
1358  * WMM Information Element (used in (Re)Association Request frames; may also be
1359  * used in Beacon frames)
1360  */
1361 struct wmm_information_element {
1362 	/* Element ID: 221 (0xdd); Length: 7 */
1363 	/* required fields for WMM version 1 */
1364 	u8 oui[3]; /* 00:50:f2 */
1365 	u8 oui_type; /* 2 */
1366 	u8 oui_subtype; /* 0 */
1367 	u8 version; /* 1 for WMM version 1.0 */
1368 	u8 qos_info; /* AP/STA specific QoS info */
1369 
1370 } STRUCT_PACKED;
1371 
1372 #define WMM_QOSINFO_AP_UAPSD 0x80
1373 
1374 #define WMM_QOSINFO_STA_AC_MASK 0x0f
1375 #define WMM_QOSINFO_STA_SP_MASK 0x03
1376 #define WMM_QOSINFO_STA_SP_SHIFT 5
1377 
1378 #define WMM_AC_AIFSN_MASK 0x0f
1379 #define WMM_AC_AIFNS_SHIFT 0
1380 #define WMM_AC_ACM 0x10
1381 #define WMM_AC_ACI_MASK 0x60
1382 #define WMM_AC_ACI_SHIFT 5
1383 
1384 #define WMM_AC_ECWMIN_MASK 0x0f
1385 #define WMM_AC_ECWMIN_SHIFT 0
1386 #define WMM_AC_ECWMAX_MASK 0xf0
1387 #define WMM_AC_ECWMAX_SHIFT 4
1388 
1389 struct wmm_ac_parameter {
1390 	u8 aci_aifsn; /* AIFSN, ACM, ACI */
1391 	u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
1392 	le16 txop_limit;
1393 }  STRUCT_PACKED;
1394 
1395 /*
1396  * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
1397  * Response frmaes)
1398  */
1399 struct wmm_parameter_element {
1400 	/* Element ID: 221 (0xdd); Length: 24 */
1401 	/* required fields for WMM version 1 */
1402 	u8 oui[3]; /* 00:50:f2 */
1403 	u8 oui_type; /* 2 */
1404 	u8 oui_subtype; /* 1 */
1405 	u8 version; /* 1 for WMM version 1.0 */
1406 	u8 qos_info; /* AP/STA specific QoS info */
1407 	u8 reserved; /* 0 */
1408 	struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
1409 
1410 } STRUCT_PACKED;
1411 
1412 /* WMM TSPEC Element */
1413 struct wmm_tspec_element {
1414 	u8 eid; /* 221 = 0xdd */
1415 	u8 length; /* 6 + 55 = 61 */
1416 	u8 oui[3]; /* 00:50:f2 */
1417 	u8 oui_type; /* 2 */
1418 	u8 oui_subtype; /* 2 */
1419 	u8 version; /* 1 */
1420 	/* WMM TSPEC body (55 octets): */
1421 	u8 ts_info[3];
1422 	le16 nominal_msdu_size;
1423 	le16 maximum_msdu_size;
1424 	le32 minimum_service_interval;
1425 	le32 maximum_service_interval;
1426 	le32 inactivity_interval;
1427 	le32 suspension_interval;
1428 	le32 service_start_time;
1429 	le32 minimum_data_rate;
1430 	le32 mean_data_rate;
1431 	le32 peak_data_rate;
1432 	le32 maximum_burst_size;
1433 	le32 delay_bound;
1434 	le32 minimum_phy_rate;
1435 	le16 surplus_bandwidth_allowance;
1436 	le16 medium_time;
1437 } STRUCT_PACKED;
1438 
1439 
1440 /* Access Categories / ACI to AC coding */
1441 enum wmm_ac {
1442 	WMM_AC_BE = 0 /* Best Effort */,
1443 	WMM_AC_BK = 1 /* Background */,
1444 	WMM_AC_VI = 2 /* Video */,
1445 	WMM_AC_VO = 3 /* Voice */,
1446 	WMM_AC_NUM = 4
1447 };
1448 
1449 
1450 #define HS20_INDICATION_OUI_TYPE 16
1451 #define HS20_ANQP_OUI_TYPE 17
1452 #define HS20_OSEN_OUI_TYPE 18
1453 #define HS20_ROAMING_CONS_SEL_OUI_TYPE 29
1454 #define HS20_STYPE_QUERY_LIST 1
1455 #define HS20_STYPE_CAPABILITY_LIST 2
1456 #define HS20_STYPE_OPERATOR_FRIENDLY_NAME 3
1457 #define HS20_STYPE_WAN_METRICS 4
1458 #define HS20_STYPE_CONNECTION_CAPABILITY 5
1459 #define HS20_STYPE_NAI_HOME_REALM_QUERY 6
1460 #define HS20_STYPE_OPERATING_CLASS 7
1461 #define HS20_STYPE_OSU_PROVIDERS_LIST 8
1462 #define HS20_STYPE_ICON_REQUEST 10
1463 #define HS20_STYPE_ICON_BINARY_FILE 11
1464 #define HS20_STYPE_OPERATOR_ICON_METADATA 12
1465 #define HS20_STYPE_OSU_PROVIDERS_NAI_LIST 13
1466 
1467 #define HS20_DGAF_DISABLED 0x01
1468 #define HS20_PPS_MO_ID_PRESENT 0x02
1469 #define HS20_ANQP_DOMAIN_ID_PRESENT 0x04
1470 #ifndef HS20_VERSION
1471 #define HS20_VERSION 0x20 /* Release 3 */
1472 #endif /* HS20_VERSION */
1473 
1474 /* WNM-Notification WFA vendors specific subtypes */
1475 #define HS20_WNM_SUB_REM_NEEDED 0
1476 #define HS20_WNM_DEAUTH_IMMINENT_NOTICE 1
1477 #define WFA_WNM_NOTIF_SUBELEM_NON_PREF_CHAN_REPORT 2
1478 #define WFA_WNM_NOTIF_SUBELEM_CELL_DATA_CAPA 3
1479 #define HS20_WNM_T_C_ACCEPTANCE 4
1480 
1481 #define HS20_DEAUTH_REASON_CODE_BSS 0
1482 #define HS20_DEAUTH_REASON_CODE_ESS 1
1483 
1484 /* MBO v0.0_r19, 4.2: MBO Attributes */
1485 /* Table 4-5: MBO Attributes */
1486 /* OCE v0.0.10, Table 4-3: OCE Attributes */
1487 enum mbo_attr_id {
1488 	MBO_ATTR_ID_AP_CAPA_IND = 1,
1489 	MBO_ATTR_ID_NON_PREF_CHAN_REPORT = 2,
1490 	MBO_ATTR_ID_CELL_DATA_CAPA = 3,
1491 	MBO_ATTR_ID_ASSOC_DISALLOW = 4,
1492 	MBO_ATTR_ID_CELL_DATA_PREF = 5,
1493 	MBO_ATTR_ID_TRANSITION_REASON = 6,
1494 	MBO_ATTR_ID_TRANSITION_REJECT_REASON = 7,
1495 	MBO_ATTR_ID_ASSOC_RETRY_DELAY = 8,
1496 	OCE_ATTR_ID_CAPA_IND = 101,
1497 	OCE_ATTR_ID_RSSI_BASED_ASSOC_REJECT = 102,
1498 	OCE_ATTR_ID_REDUCED_WAN_METRICS = 103,
1499 	OCE_ATTR_ID_RNR_COMPLETENESS = 104,
1500 };
1501 
1502 /* MBO v0.0_r19, 4.2.1: MBO AP Capability Indication Attribute */
1503 /* Table 4-7: MBO AP Capability Indication Field Values */
1504 #define MBO_AP_CAPA_CELL_AWARE BIT(6)
1505 
1506 /* MBO v0.0_r19, 4.2.2: Non-preferred Channel Report Attribute */
1507 /* Table 4-10: Reason Code Field Values */
1508 enum mbo_non_pref_chan_reason {
1509 	MBO_NON_PREF_CHAN_REASON_UNSPECIFIED = 0,
1510 	MBO_NON_PREF_CHAN_REASON_RSSI = 1,
1511 	MBO_NON_PREF_CHAN_REASON_EXT_INTERFERENCE = 2,
1512 	MBO_NON_PREF_CHAN_REASON_INT_INTERFERENCE = 3,
1513 };
1514 
1515 /* MBO v0.0_r19, 4.2.3: Cellular Data Capabilities Attribute */
1516 /* Table 4-13: Cellular Data Connectivity Field */
1517 enum mbo_cellular_capa {
1518 	MBO_CELL_CAPA_AVAILABLE = 1,
1519 	MBO_CELL_CAPA_NOT_AVAILABLE = 2,
1520 	MBO_CELL_CAPA_NOT_SUPPORTED = 3,
1521 };
1522 
1523 /* MBO v0.0_r19, 4.2.4: Association Disallowed Attribute */
1524 /* Table 4-15: Reason Code Field Values */
1525 enum mbo_assoc_disallow_reason {
1526 	MBO_ASSOC_DISALLOW_REASON_UNSPECIFIED = 1,
1527 	MBO_ASSOC_DISALLOW_REASON_MAX_STA = 2,
1528 	MBO_ASSOC_DISALLOW_REASON_AIR_INTERFERENCE = 3,
1529 	MBO_ASSOC_DISALLOW_REASON_AUTH_SERVER_OVERLOAD = 4,
1530 	MBO_ASSOC_DISALLOW_REASON_LOW_RSSI = 5,
1531 };
1532 
1533 /* MBO v0.0_r19, 4.2.5: Cellular Data Connection Preference Attribute */
1534 /* Table 4-17: Cellular Preference Field Values */
1535 enum mbo_cell_pref {
1536 	MBO_CELL_PREF_EXCLUDED = 0,
1537 	MBO_CELL_PREF_NO_USE = 1,
1538 	MBO_CELL_PREF_USE = 255
1539 };
1540 
1541 /* MBO v0.0_r19, 4.2.6: Transition Reason Code Attribute */
1542 /* Table 4-19: Transition Reason Code Field Values */
1543 enum mbo_transition_reason {
1544 	MBO_TRANSITION_REASON_UNSPECIFIED = 0,
1545 	MBO_TRANSITION_REASON_FRAME_LOSS = 1,
1546 	MBO_TRANSITION_REASON_DELAY = 2,
1547 	MBO_TRANSITION_REASON_BANDWIDTH = 3,
1548 	MBO_TRANSITION_REASON_LOAD_BALANCE = 4,
1549 	MBO_TRANSITION_REASON_RSSI = 5,
1550 	MBO_TRANSITION_REASON_RETRANSMISSIONS = 6,
1551 	MBO_TRANSITION_REASON_INTERFERENCE = 7,
1552 	MBO_TRANSITION_REASON_GRAY_ZONE = 8,
1553 	MBO_TRANSITION_REASON_PREMIUM_AP = 9,
1554 };
1555 
1556 /* MBO v0.0_r19, 4.2.7: Transition Rejection Reason Code Attribute */
1557 /* Table 4-21: Transition Rejection Reason Code Field Values */
1558 enum mbo_transition_reject_reason {
1559 	MBO_TRANSITION_REJECT_REASON_UNSPECIFIED = 0,
1560 	MBO_TRANSITION_REJECT_REASON_FRAME_LOSS = 1,
1561 	MBO_TRANSITION_REJECT_REASON_DELAY = 2,
1562 	MBO_TRANSITION_REJECT_REASON_QOS_CAPACITY = 3,
1563 	MBO_TRANSITION_REJECT_REASON_RSSI = 4,
1564 	MBO_TRANSITION_REJECT_REASON_INTERFERENCE = 5,
1565 	MBO_TRANSITION_REJECT_REASON_SERVICES = 6,
1566 };
1567 
1568 /* MBO v0.0_r27, 4.3: MBO ANQP-elements */
1569 #define MBO_ANQP_OUI_TYPE 0x12
1570 #define MBO_ANQP_SUBTYPE_QUERY_LIST 1
1571 #define MBO_ANQP_SUBTYPE_CELL_CONN_PREF 2
1572 #define MAX_MBO_ANQP_SUBTYPE MBO_ANQP_SUBTYPE_CELL_CONN_PREF
1573 
1574 /* OCE v0.0.10, 4.2.1: OCE Capability Indication Attribute */
1575 #define OCE_RELEASE 1
1576 #define OCE_RELEASE_MASK (BIT(0) | BIT(1) | BIT(2))
1577 #define OCE_IS_STA_CFON BIT(3)
1578 #define OCE_IS_NON_OCE_AP_PRESENT BIT(4)
1579 
1580 /* Wi-Fi Direct (P2P) */
1581 
1582 #define P2P_OUI_TYPE 9
1583 
1584 enum p2p_attr_id {
1585 	P2P_ATTR_STATUS = 0,
1586 	P2P_ATTR_MINOR_REASON_CODE = 1,
1587 	P2P_ATTR_CAPABILITY = 2,
1588 	P2P_ATTR_DEVICE_ID = 3,
1589 	P2P_ATTR_GROUP_OWNER_INTENT = 4,
1590 	P2P_ATTR_CONFIGURATION_TIMEOUT = 5,
1591 	P2P_ATTR_LISTEN_CHANNEL = 6,
1592 	P2P_ATTR_GROUP_BSSID = 7,
1593 	P2P_ATTR_EXT_LISTEN_TIMING = 8,
1594 	P2P_ATTR_INTENDED_INTERFACE_ADDR = 9,
1595 	P2P_ATTR_MANAGEABILITY = 10,
1596 	P2P_ATTR_CHANNEL_LIST = 11,
1597 	P2P_ATTR_NOTICE_OF_ABSENCE = 12,
1598 	P2P_ATTR_DEVICE_INFO = 13,
1599 	P2P_ATTR_GROUP_INFO = 14,
1600 	P2P_ATTR_GROUP_ID = 15,
1601 	P2P_ATTR_INTERFACE = 16,
1602 	P2P_ATTR_OPERATING_CHANNEL = 17,
1603 	P2P_ATTR_INVITATION_FLAGS = 18,
1604 	P2P_ATTR_OOB_GO_NEG_CHANNEL = 19,
1605 	P2P_ATTR_SERVICE_HASH = 21,
1606 	P2P_ATTR_SESSION_INFORMATION_DATA = 22,
1607 	P2P_ATTR_CONNECTION_CAPABILITY = 23,
1608 	P2P_ATTR_ADVERTISEMENT_ID = 24,
1609 	P2P_ATTR_ADVERTISED_SERVICE = 25,
1610 	P2P_ATTR_SESSION_ID = 26,
1611 	P2P_ATTR_FEATURE_CAPABILITY = 27,
1612 	P2P_ATTR_PERSISTENT_GROUP = 28,
1613 	P2P_ATTR_VENDOR_SPECIFIC = 221
1614 };
1615 
1616 #define P2P_MAX_GO_INTENT 15
1617 
1618 /* P2P Capability - Device Capability bitmap */
1619 #define P2P_DEV_CAPAB_SERVICE_DISCOVERY BIT(0)
1620 #define P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY BIT(1)
1621 #define P2P_DEV_CAPAB_CONCURRENT_OPER BIT(2)
1622 #define P2P_DEV_CAPAB_INFRA_MANAGED BIT(3)
1623 #define P2P_DEV_CAPAB_DEVICE_LIMIT BIT(4)
1624 #define P2P_DEV_CAPAB_INVITATION_PROCEDURE BIT(5)
1625 
1626 /* P2P Capability - Group Capability bitmap */
1627 #define P2P_GROUP_CAPAB_GROUP_OWNER BIT(0)
1628 #define P2P_GROUP_CAPAB_PERSISTENT_GROUP BIT(1)
1629 #define P2P_GROUP_CAPAB_GROUP_LIMIT BIT(2)
1630 #define P2P_GROUP_CAPAB_INTRA_BSS_DIST BIT(3)
1631 #define P2P_GROUP_CAPAB_CROSS_CONN BIT(4)
1632 #define P2P_GROUP_CAPAB_PERSISTENT_RECONN BIT(5)
1633 #define P2P_GROUP_CAPAB_GROUP_FORMATION BIT(6)
1634 #define P2P_GROUP_CAPAB_IP_ADDR_ALLOCATION BIT(7)
1635 
1636 /* P2PS Coordination Protocol Transport Bitmap */
1637 #define P2PS_FEATURE_CAPAB_UDP_TRANSPORT BIT(0)
1638 #define P2PS_FEATURE_CAPAB_MAC_TRANSPORT BIT(1)
1639 
1640 struct p2ps_feature_capab {
1641 	u8 cpt;
1642 	u8 reserved;
1643 } STRUCT_PACKED;
1644 
1645 /* Invitation Flags */
1646 #define P2P_INVITATION_FLAGS_TYPE BIT(0)
1647 
1648 /* P2P Manageability */
1649 #define P2P_MAN_DEVICE_MANAGEMENT BIT(0)
1650 #define P2P_MAN_CROSS_CONNECTION_PERMITTED BIT(1)
1651 #define P2P_MAN_COEXISTENCE_OPTIONAL BIT(2)
1652 
1653 enum p2p_status_code {
1654 	P2P_SC_SUCCESS = 0,
1655 	P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE = 1,
1656 	P2P_SC_FAIL_INCOMPATIBLE_PARAMS = 2,
1657 	P2P_SC_FAIL_LIMIT_REACHED = 3,
1658 	P2P_SC_FAIL_INVALID_PARAMS = 4,
1659 	P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE = 5,
1660 	P2P_SC_FAIL_PREV_PROTOCOL_ERROR = 6,
1661 	P2P_SC_FAIL_NO_COMMON_CHANNELS = 7,
1662 	P2P_SC_FAIL_UNKNOWN_GROUP = 8,
1663 	P2P_SC_FAIL_BOTH_GO_INTENT_15 = 9,
1664 	P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD = 10,
1665 	P2P_SC_FAIL_REJECTED_BY_USER = 11,
1666 	P2P_SC_SUCCESS_DEFERRED = 12,
1667 };
1668 
1669 enum p2p_role_indication {
1670 	P2P_DEVICE_NOT_IN_GROUP = 0x00,
1671 	P2P_CLIENT_IN_A_GROUP = 0x01,
1672 	P2P_GO_IN_A_GROUP = 0x02,
1673 };
1674 
1675 #define P2P_WILDCARD_SSID "DIRECT-"
1676 #define P2P_WILDCARD_SSID_LEN 7
1677 
1678 /* P2P action frames */
1679 enum p2p_act_frame_type {
1680 	P2P_NOA = 0,
1681 	P2P_PRESENCE_REQ = 1,
1682 	P2P_PRESENCE_RESP = 2,
1683 	P2P_GO_DISC_REQ = 3
1684 };
1685 
1686 /* P2P public action frames */
1687 enum p2p_action_frame_type {
1688 	P2P_GO_NEG_REQ = 0,
1689 	P2P_GO_NEG_RESP = 1,
1690 	P2P_GO_NEG_CONF = 2,
1691 	P2P_INVITATION_REQ = 3,
1692 	P2P_INVITATION_RESP = 4,
1693 	P2P_DEV_DISC_REQ = 5,
1694 	P2P_DEV_DISC_RESP = 6,
1695 	P2P_PROV_DISC_REQ = 7,
1696 	P2P_PROV_DISC_RESP = 8
1697 };
1698 
1699 enum p2p_service_protocol_type {
1700 	P2P_SERV_ALL_SERVICES = 0,
1701 	P2P_SERV_BONJOUR = 1,
1702 	P2P_SERV_UPNP = 2,
1703 	P2P_SERV_WS_DISCOVERY = 3,
1704 	P2P_SERV_WIFI_DISPLAY = 4,
1705 	P2P_SERV_P2PS = 11,
1706 	P2P_SERV_VENDOR_SPECIFIC = 255
1707 };
1708 
1709 enum p2p_sd_status {
1710 	P2P_SD_SUCCESS = 0,
1711 	P2P_SD_PROTO_NOT_AVAILABLE = 1,
1712 	P2P_SD_REQUESTED_INFO_NOT_AVAILABLE = 2,
1713 	P2P_SD_BAD_REQUEST = 3
1714 };
1715 
1716 
1717 enum wifi_display_subelem {
1718 	WFD_SUBELEM_DEVICE_INFO = 0,
1719 	WFD_SUBELEM_ASSOCIATED_BSSID = 1,
1720 	WFD_SUBELEM_AUDIO_FORMATS = 2,
1721 	WFD_SUBELEM_VIDEO_FORMATS = 3,
1722 	WFD_SUBELEM_3D_VIDEO_FORMATS = 4,
1723 	WFD_SUBELEM_CONTENT_PROTECTION = 5,
1724 	WFD_SUBELEM_COUPLED_SINK = 6,
1725 	WFD_SUBELEM_EXT_CAPAB = 7,
1726 	WFD_SUBELEM_LOCAL_IP_ADDRESS = 8,
1727 	WFD_SUBELEM_SESSION_INFO = 9,
1728 	WFD_SUBELEM_MAC_INFO = 10,
1729 	WFD_SUBELEM_R2_DEVICE_INFO = 11,
1730 };
1731 
1732 /* 802.11s */
1733 #define MESH_SYNC_METHOD_NEIGHBOR_OFFSET 1
1734 #define MESH_SYNC_METHOD_VENDOR		255
1735 #define MESH_PATH_PROTOCOL_HWMP		1
1736 #define MESH_PATH_PROTOCOL_VENDOR	255
1737 #define MESH_PATH_METRIC_AIRTIME	1
1738 #define MESH_PATH_METRIC_VENDOR		255
1739 /* IEEE 802.11s - Mesh Capability */
1740 #define MESH_CAP_ACCEPT_ADDITIONAL_PEER	BIT(0)
1741 #define MESH_CAP_MCCA_SUPPORTED		BIT(1)
1742 #define MESH_CAP_MCCA_ENABLED		BIT(2)
1743 #define MESH_CAP_FORWARDING		BIT(3)
1744 #define MESH_CAP_MBCA_ENABLED		BIT(4)
1745 #define MESH_CAP_TBTT_ADJUSTING		BIT(5)
1746 #define MESH_CAP_MESH_PS_LEVEL		BIT(6)
1747 
1748 enum plink_action_field {
1749 	PLINK_OPEN = 1,
1750 	PLINK_CONFIRM,
1751 	PLINK_CLOSE
1752 };
1753 
1754 #define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
1755 #define VENDOR_VHT_TYPE		0x04
1756 #define VENDOR_VHT_SUBTYPE	0x08
1757 #define VENDOR_VHT_SUBTYPE2	0x00
1758 
1759 #define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
1760 
1761 
1762 /* IEEE 802.11v - WNM Action field values */
1763 enum wnm_action {
1764 	WNM_EVENT_REQ = 0,
1765 	WNM_EVENT_REPORT = 1,
1766 	WNM_DIAGNOSTIC_REQ = 2,
1767 	WNM_DIAGNOSTIC_REPORT = 3,
1768 	WNM_LOCATION_CFG_REQ = 4,
1769 	WNM_LOCATION_CFG_RESP = 5,
1770 	WNM_BSS_TRANS_MGMT_QUERY = 6,
1771 	WNM_BSS_TRANS_MGMT_REQ = 7,
1772 	WNM_BSS_TRANS_MGMT_RESP = 8,
1773 	WNM_FMS_REQ = 9,
1774 	WNM_FMS_RESP = 10,
1775 	WNM_COLLOCATED_INTERFERENCE_REQ = 11,
1776 	WNM_COLLOCATED_INTERFERENCE_REPORT = 12,
1777 	WNM_TFS_REQ = 13,
1778 	WNM_TFS_RESP = 14,
1779 	WNM_TFS_NOTIFY = 15,
1780 	WNM_SLEEP_MODE_REQ = 16,
1781 	WNM_SLEEP_MODE_RESP = 17,
1782 	WNM_TIM_BROADCAST_REQ = 18,
1783 	WNM_TIM_BROADCAST_RESP = 19,
1784 	WNM_QOS_TRAFFIC_CAPAB_UPDATE = 20,
1785 	WNM_CHANNEL_USAGE_REQ = 21,
1786 	WNM_CHANNEL_USAGE_RESP = 22,
1787 	WNM_DMS_REQ = 23,
1788 	WNM_DMS_RESP = 24,
1789 	WNM_TIMING_MEASUREMENT_REQ = 25,
1790 	WNM_NOTIFICATION_REQ = 26,
1791 	WNM_NOTIFICATION_RESP = 27
1792 };
1793 
1794 /* IEEE 802.11v - BSS Transition Management Request - Request Mode */
1795 #define WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED BIT(0)
1796 #define WNM_BSS_TM_REQ_ABRIDGED BIT(1)
1797 #define WNM_BSS_TM_REQ_DISASSOC_IMMINENT BIT(2)
1798 #define WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED BIT(3)
1799 #define WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT BIT(4)
1800 
1801 /* IEEE Std 802.11-2012 - Table 8-253 */
1802 enum bss_trans_mgmt_status_code {
1803 	WNM_BSS_TM_ACCEPT = 0,
1804 	WNM_BSS_TM_REJECT_UNSPECIFIED = 1,
1805 	WNM_BSS_TM_REJECT_INSUFFICIENT_BEACON = 2,
1806 	WNM_BSS_TM_REJECT_INSUFFICIENT_CAPABITY = 3,
1807 	WNM_BSS_TM_REJECT_UNDESIRED = 4,
1808 	WNM_BSS_TM_REJECT_DELAY_REQUEST = 5,
1809 	WNM_BSS_TM_REJECT_STA_CANDIDATE_LIST_PROVIDED = 6,
1810 	WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES = 7,
1811 	WNM_BSS_TM_REJECT_LEAVING_ESS = 8
1812 };
1813 
1814 /*
1815  * IEEE P802.11-REVmc/D5.0 Table 9-150 - Optional subelement IDs for
1816  * neighbor report
1817  */
1818 #define WNM_NEIGHBOR_TSF                         1
1819 #define WNM_NEIGHBOR_CONDENSED_COUNTRY_STRING    2
1820 #define WNM_NEIGHBOR_BSS_TRANSITION_CANDIDATE    3
1821 #define WNM_NEIGHBOR_BSS_TERMINATION_DURATION    4
1822 #define WNM_NEIGHBOR_BEARING                     5
1823 #define WNM_NEIGHBOR_WIDE_BW_CHAN                6
1824 #define WNM_NEIGHBOR_MEASUREMENT_REPORT         39
1825 #define WNM_NEIGHBOR_HT_CAPAB                   45
1826 #define WNM_NEIGHBOR_HT_OPER                    61
1827 #define WNM_NEIGHBOR_SEC_CHAN_OFFSET            62
1828 #define WNM_NEIGHBOR_MEASUREMENT_PILOT          66
1829 #define WNM_NEIGHBOR_RRM_ENABLED_CAPABILITIES   70
1830 #define WNM_NEIGHBOR_MULTIPLE_BSSID             71
1831 #define WNM_NEIGHBOR_VHT_CAPAB                 191
1832 #define WNM_NEIGHBOR_VHT_OPER                  192
1833 
1834 /* QoS action */
1835 enum qos_action {
1836 	QOS_ADDTS_REQ = 0,
1837 	QOS_ADDTS_RESP = 1,
1838 	QOS_DELTS = 2,
1839 	QOS_SCHEDULE = 3,
1840 	QOS_QOS_MAP_CONFIG = 4,
1841 };
1842 
1843 /* IEEE Std 802.11-2012, 8.4.2.62 20/40 BSS Coexistence element */
1844 #define WLAN_20_40_BSS_COEX_INFO_REQ            BIT(0)
1845 #define WLAN_20_40_BSS_COEX_40MHZ_INTOL         BIT(1)
1846 #define WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ     BIT(2)
1847 #define WLAN_20_40_BSS_COEX_OBSS_EXEMPT_REQ     BIT(3)
1848 #define WLAN_20_40_BSS_COEX_OBSS_EXEMPT_GRNT    BIT(4)
1849 
1850 struct ieee80211_2040_bss_coex_ie {
1851 	u8 element_id;
1852 	u8 length;
1853 	u8 coex_param;
1854 } STRUCT_PACKED;
1855 
1856 struct ieee80211_2040_intol_chan_report {
1857 	u8 element_id;
1858 	u8 length;
1859 	u8 op_class;
1860 	u8 variable[0];	/* Channel List */
1861 } STRUCT_PACKED;
1862 
1863 /* IEEE 802.11v - WNM-Sleep Mode element */
1864 struct wnm_sleep_element {
1865 	u8 eid;     /* WLAN_EID_WNMSLEEP */
1866 	u8 len;
1867 	u8 action_type; /* WNM_SLEEP_ENTER/WNM_SLEEP_MODE_EXIT */
1868 	u8 status;
1869 	le16 intval;
1870 } STRUCT_PACKED;
1871 
1872 #define WNM_SLEEP_MODE_ENTER 0
1873 #define WNM_SLEEP_MODE_EXIT 1
1874 
1875 enum wnm_sleep_mode_response_status {
1876 	WNM_STATUS_SLEEP_ACCEPT = 0,
1877 	WNM_STATUS_SLEEP_EXIT_ACCEPT_GTK_UPDATE = 1,
1878 	WNM_STATUS_DENIED_ACTION = 2,
1879 	WNM_STATUS_DENIED_TMP = 3,
1880 	WNM_STATUS_DENIED_KEY = 4,
1881 	WNM_STATUS_DENIED_OTHER_WNM_SERVICE = 5
1882 };
1883 
1884 /* WNM-Sleep Mode subelement IDs */
1885 enum wnm_sleep_mode_subelement_id {
1886 	WNM_SLEEP_SUBELEM_GTK = 0,
1887 	WNM_SLEEP_SUBELEM_IGTK = 1,
1888 	WNM_SLEEP_SUBELEM_BIGTK = 2,
1889 };
1890 
1891 /* WNM notification type (IEEE P802.11-REVmd/D3.0, Table 9-430) */
1892 enum wnm_notification_Type {
1893 	WNM_NOTIF_TYPE_FIRMWARE_UPDATE = 0,
1894 	WNM_NOTIF_TYPE_BEACON_PROTECTION_FAILURE = 2,
1895 	WNM_NOTIF_TYPE_VENDOR_SPECIFIC = 221,
1896 };
1897 
1898 /* Channel Switch modes (802.11h) */
1899 #define CHAN_SWITCH_MODE_ALLOW_TX	0
1900 #define CHAN_SWITCH_MODE_BLOCK_TX	1
1901 
1902 struct tpc_report {
1903 	u8 eid;
1904 	u8 len;
1905 	u8 tx_power;
1906 	u8 link_margin;
1907 } STRUCT_PACKED;
1908 
1909 #define RRM_CAPABILITIES_IE_LEN 5
1910 
1911 /* IEEE Std 802.11-2012, 8.5.7.4 - Link Measurement Request frame format */
1912 struct rrm_link_measurement_request {
1913 	u8 dialog_token;
1914 	s8 tx_power;
1915 	s8 max_tp;
1916 	u8 variable[0];
1917 } STRUCT_PACKED;
1918 
1919 /* IEEE Std 802.11-2012, 8.5.7.5 - Link Measurement Report frame format */
1920 struct rrm_link_measurement_report {
1921 	u8 dialog_token;
1922 	struct tpc_report tpc;
1923 	u8 rx_ant_id;
1924 	u8 tx_ant_id;
1925 	u8 rcpi;
1926 	u8 rsni;
1927 	u8 variable[0];
1928 } STRUCT_PACKED;
1929 
1930 /* IEEE Std 802.11-2016, 9.4.2.21 - Measurement Request element */
1931 struct rrm_measurement_request_element {
1932 	u8 eid; /* Element ID */
1933 	u8 len; /* Length */
1934 	u8 token; /* Measurement Token */
1935 	u8 mode; /* Measurement Request Mode */
1936 	u8 type; /* Measurement Type */
1937 	u8 variable[0]; /* Measurement Request */
1938 } STRUCT_PACKED;
1939 
1940 /* IEEE Std 802.11-2016, Figure 9-148 - Measurement Request Mode field */
1941 #define MEASUREMENT_REQUEST_MODE_PARALLEL BIT(0)
1942 #define MEASUREMENT_REQUEST_MODE_ENABLE BIT(1)
1943 #define MEASUREMENT_REQUEST_MODE_REQUEST BIT(2)
1944 #define MEASUREMENT_REQUEST_MODE_REPORT BIT(3)
1945 #define MEASUREMENT_REQUEST_MODE_DURATION_MANDATORY BIT(4)
1946 
1947 /* IEEE Std 802.11-2016, 9.4.2.21.7 - Beacon request */
1948 struct rrm_measurement_beacon_request {
1949 	u8 oper_class; /* Operating Class */
1950 	u8 channel; /* Channel Number */
1951 	le16 rand_interval; /* Randomization Interval (in TUs) */
1952 	le16 duration; /* Measurement Duration (in TUs) */
1953 	u8 mode; /* Measurement Mode */
1954 	u8 bssid[ETH_ALEN]; /* BSSID */
1955 	u8 variable[0]; /* Optional Subelements */
1956 } STRUCT_PACKED;
1957 
1958 /*
1959  * IEEE Std 802.11-2016, Table 9-87 - Measurement Mode definitions for Beacon
1960  * request
1961  */
1962 enum beacon_report_mode {
1963 	BEACON_REPORT_MODE_PASSIVE = 0,
1964 	BEACON_REPORT_MODE_ACTIVE = 1,
1965 	BEACON_REPORT_MODE_TABLE = 2,
1966 };
1967 
1968 /* IEEE Std 802.11-2016, Table 9-88 - Beacon Request subelement IDs */
1969 /* IEEE P802.11-REVmd/D2.0, Table 9-106 - Optional subelement IDs for
1970  * Beacon request */
1971 #define WLAN_BEACON_REQUEST_SUBELEM_SSID	0
1972 #define WLAN_BEACON_REQUEST_SUBELEM_INFO	1 /* Beacon Reporting */
1973 #define WLAN_BEACON_REQUEST_SUBELEM_DETAIL	2 /* Reporting Detail */
1974 #define WLAN_BEACON_REQUEST_SUBELEM_REQUEST	10
1975 #define WLAN_BEACON_REQUEST_SUBELEM_AP_CHANNEL	51 /* AP Channel Report */
1976 #define WLAN_BEACON_REQUEST_SUBELEM_LAST_INDICATION	164
1977 #define WLAN_BEACON_REQUEST_SUBELEM_VENDOR	221
1978 
1979 /*
1980  * IEEE Std 802.11-2016, Table 9-90 - Reporting Detail values
1981  */
1982 enum beacon_report_detail {
1983 	/* No fixed-length fields or elements */
1984 	BEACON_REPORT_DETAIL_NONE = 0,
1985 	/* All fixed-length fields and any requested elements in the Request
1986 	 * element if present */
1987 	BEACON_REPORT_DETAIL_REQUESTED_ONLY = 1,
1988 	/* All fixed-length fields and elements (default, used when Reporting
1989 	 * Detail subelement is not included in a Beacon request) */
1990 	BEACON_REPORT_DETAIL_ALL_FIELDS_AND_ELEMENTS = 2,
1991 };
1992 
1993 /* IEEE Std 802.11-2016, 9.4.2.22 - Measurement Report element */
1994 struct rrm_measurement_report_element {
1995 	u8 eid; /* Element ID */
1996 	u8 len; /* Length */
1997 	u8 token; /* Measurement Token */
1998 	u8 mode; /* Measurement Report Mode */
1999 	u8 type; /* Measurement Type */
2000 	u8 variable[0]; /* Measurement Report */
2001 } STRUCT_PACKED;
2002 
2003 /* IEEE Std 802.11-2016, Figure 9-192 - Measurement Report Mode field */
2004 #define MEASUREMENT_REPORT_MODE_ACCEPT 0
2005 #define MEASUREMENT_REPORT_MODE_REJECT_LATE BIT(0)
2006 #define MEASUREMENT_REPORT_MODE_REJECT_INCAPABLE BIT(1)
2007 #define MEASUREMENT_REPORT_MODE_REJECT_REFUSED BIT(2)
2008 
2009 /* IEEE Std 802.11-2016, 9.4.2.22.7 - Beacon report */
2010 struct rrm_measurement_beacon_report {
2011 	u8 op_class; /* Operating Class */
2012 	u8 channel; /* Channel Number */
2013 	le64 start_time; /* Actual Measurement Start Time
2014 			  * (in TSF of the BSS requesting the measurement) */
2015 	le16 duration; /* in TUs */
2016 	u8 report_info; /* Reported Frame Information */
2017 	u8 rcpi; /* RCPI */
2018 	u8 rsni; /* RSNI */
2019 	u8 bssid[ETH_ALEN]; /* BSSID */
2020 	u8 antenna_id; /* Antenna ID */
2021 	le32 parent_tsf; /* Parent TSF */
2022 	u8 variable[0]; /* Optional Subelements */
2023 } STRUCT_PACKED;
2024 
2025 /* IEEE Std 802.11-2016, Table 9-112 - Beacon report Subelement IDs */
2026 /* IEEE P802.11-REVmd/D2.0, Table 9-130 - Optional subelement IDs for
2027  * Beacon report */
2028 #define WLAN_BEACON_REPORT_SUBELEM_FRAME_BODY	1
2029 #define WLAN_BEACON_REPORT_SUBELEM_FRAME_BODY_FRAGMENT_ID	2
2030 #define WLAN_BEACON_REPORT_SUBELEM_LAST_INDICATION	164
2031 #define WLAN_BEACON_REPORT_SUBELEM_VENDOR	221
2032 
2033 /* IEEE P802.11-REVmd/D2.0, Table 9-232 - Data field format of the
2034  * Reported Frame Body Fragment ID subelement */
2035 #define REPORTED_FRAME_BODY_SUBELEM_LEN		4
2036 #define REPORTED_FRAME_BODY_MORE_FRAGMENTS	BIT(7)
2037 
2038 /* IEEE P802.11-REVmd/D2.0, 9.4.2.21.7 - Beacon report  */
2039 #define BEACON_REPORT_LAST_INDICATION_SUBELEM_LEN	3
2040 
2041 /* IEEE Std 802.11ad-2012 - Multi-band element */
2042 struct multi_band_ie {
2043 	u8 eid; /* WLAN_EID_MULTI_BAND */
2044 	u8 len;
2045 	u8 mb_ctrl;
2046 	u8 band_id;
2047 	u8 op_class;
2048 	u8 chan;
2049 	u8 bssid[ETH_ALEN];
2050 	le16 beacon_int;
2051 	u8 tsf_offs[8];
2052 	u8 mb_connection_capability;
2053 	u8 fst_session_tmout;
2054 	/* Optional:
2055 	 *   STA MAC Address
2056 	 *   Pairwise Cipher Suite Count
2057 	 *   Pairwise Cipher Suite List
2058 	 */
2059 	u8 variable[0];
2060 } STRUCT_PACKED;
2061 
2062 enum mb_ctrl_sta_role {
2063 	MB_STA_ROLE_AP = 0,
2064 	MB_STA_ROLE_TDLS_STA = 1,
2065 	MB_STA_ROLE_IBSS_STA = 2,
2066 	MB_STA_ROLE_PCP = 3,
2067 	MB_STA_ROLE_NON_PCP_NON_AP = 4
2068 };
2069 
2070 #define MB_CTRL_ROLE_MASK (BIT(0) | BIT(1) | BIT(2))
2071 #define MB_CTRL_ROLE(ctrl) ((u8) ((ctrl) & MB_CTRL_ROLE_MASK))
2072 #define MB_CTRL_STA_MAC_PRESENT ((u8) (BIT(3)))
2073 #define MB_CTRL_PAIRWISE_CIPHER_SUITE_PRESENT ((u8) (BIT(4)))
2074 
2075 enum mb_band_id {
2076 	MB_BAND_ID_WIFI_2_4GHZ = 2, /* 2.4 GHz */
2077 	MB_BAND_ID_WIFI_5GHZ = 4, /* 4.9 and 5 GHz */
2078 	MB_BAND_ID_WIFI_60GHZ = 5, /* 60 GHz */
2079 };
2080 
2081 #define MB_CONNECTION_CAPABILITY_AP ((u8) (BIT(0)))
2082 #define MB_CONNECTION_CAPABILITY_PCP ((u8) (BIT(1)))
2083 #define MB_CONNECTION_CAPABILITY_DLS ((u8) (BIT(2)))
2084 #define MB_CONNECTION_CAPABILITY_TDLS ((u8) (BIT(3)))
2085 #define MB_CONNECTION_CAPABILITY_IBSS ((u8) (BIT(4)))
2086 
2087 /* IEEE Std 802.11ad-2014 - FST Action field */
2088 enum fst_action {
2089 	FST_ACTION_SETUP_REQUEST = 0,
2090 	FST_ACTION_SETUP_RESPONSE = 1,
2091 	FST_ACTION_TEAR_DOWN = 2,
2092 	FST_ACTION_ACK_REQUEST = 3,
2093 	FST_ACTION_ACK_RESPONSE = 4,
2094 	FST_ACTION_ON_CHANNEL_TUNNEL = 5,
2095 };
2096 
2097 /* IEEE Std 802.11ac-2013, Annex C - dot11PHYType */
2098 enum phy_type {
2099 	PHY_TYPE_UNSPECIFIED = 0,
2100 	PHY_TYPE_FHSS = 1,
2101 	PHY_TYPE_DSSS = 2,
2102 	PHY_TYPE_IRBASEBAND = 3,
2103 	PHY_TYPE_OFDM = 4,
2104 	PHY_TYPE_HRDSSS = 5,
2105 	PHY_TYPE_ERP = 6,
2106 	PHY_TYPE_HT = 7,
2107 	PHY_TYPE_DMG = 8,
2108 	PHY_TYPE_VHT = 9,
2109 };
2110 
2111 /* IEEE P802.11-REVmd/D3.0, 9.4.2.36 - Neighbor Report element */
2112 /* BSSID Information Field */
2113 #define NEI_REP_BSSID_INFO_AP_NOT_REACH BIT(0)
2114 #define NEI_REP_BSSID_INFO_AP_UNKNOWN_REACH BIT(1)
2115 #define NEI_REP_BSSID_INFO_AP_REACHABLE (BIT(0) | BIT(1))
2116 #define NEI_REP_BSSID_INFO_SECURITY BIT(2)
2117 #define NEI_REP_BSSID_INFO_KEY_SCOPE BIT(3)
2118 #define NEI_REP_BSSID_INFO_SPECTRUM_MGMT BIT(4)
2119 #define NEI_REP_BSSID_INFO_QOS BIT(5)
2120 #define NEI_REP_BSSID_INFO_APSD BIT(6)
2121 #define NEI_REP_BSSID_INFO_RM BIT(7)
2122 #define NEI_REP_BSSID_INFO_DELAYED_BA BIT(8)
2123 #define NEI_REP_BSSID_INFO_IMM_BA BIT(9)
2124 #define NEI_REP_BSSID_INFO_MOBILITY_DOMAIN BIT(10)
2125 #define NEI_REP_BSSID_INFO_HT BIT(11)
2126 #define NEI_REP_BSSID_INFO_VHT BIT(12)
2127 #define NEI_REP_BSSID_INFO_FTM BIT(13)
2128 #define NEI_REP_BSSID_INFO_HE BIT(14)
2129 
2130 /*
2131  * IEEE P802.11-REVmc/D5.0 Table 9-152 - HT/VHT Operation Information
2132  * subfields.
2133  * Note: These definitions are not the same as other CHANWIDTH_*.
2134  */
2135 enum nr_chan_width {
2136 	NR_CHAN_WIDTH_20 = 0,
2137 	NR_CHAN_WIDTH_40 = 1,
2138 	NR_CHAN_WIDTH_80 = 2,
2139 	NR_CHAN_WIDTH_160 = 3,
2140 	NR_CHAN_WIDTH_80P80 = 4,
2141 };
2142 
2143 struct ieee80211_he_capabilities {
2144 	u8 he_mac_capab_info[6];
2145 	u8 he_phy_capab_info[11];
2146 	struct {
2147 		le16 rx_map;
2148 		le16 tx_map;
2149 	} he_basic_supported_mcs_set;
2150 	/* Followed by 0, 4, or 8 octets of optional supported HE-MCS And NSS Set field
2151 	* and optional variable length PPE Thresholds field. */
2152 	u8 optional[33];
2153 } STRUCT_PACKED;
2154 
2155 struct ieee80211_he_operation {
2156 	le32 he_oper_params; /* HE Operation Parameters[3] and
2157 			      * BSS Color Information[1] */
2158 	le16 he_mcs_nss_set;
2159 	/* Followed by conditional VHT Operation Information (3 octets),
2160 	 * Max Co-Hosted BSSID Indicator subfield (1 octet), and/or 6 GHz
2161 	 * Operation Information subfield (5 octets). */
2162 } STRUCT_PACKED;
2163 
2164 /* IEEE P802.11ax/D6.0, Figure 9-787k - 6 GHz Operation Information field */
2165 struct ieee80211_he_6ghz_oper_info {
2166 	u8 primary_chan;
2167 	u8 control;
2168 	u8 chan_center_freq_seg0;
2169 	u8 chan_center_freq_seg1;
2170 	u8 min_rate;
2171 } STRUCT_PACKED;
2172 
2173 #define HE_6GHZ_OPER_INFO_CTRL_CHAN_WIDTH_MASK	(BIT(0) | BIT(1))
2174 #define HE_6GHZ_OPER_INFO_CTRL_DUP_BEACON	BIT(2)
2175 
2176 /* IEEE P802.11ax/D6.0, 9.4.2.261 HE 6 GHz Band Capabilities element */
2177 struct ieee80211_he_6ghz_band_cap {
2178 	 /* Minimum MPDU Start Spacing B0..B2
2179 	  * Maximum A-MPDU Length Exponent B3..B5
2180 	  * Maximum MPDU Length B6..B7 */
2181 	u8 a_mpdu_params; /* B0..B7 */
2182 	u8 info; /* B8..B15 */
2183 } STRUCT_PACKED;
2184 
2185 #define HE_6GHZ_BAND_CAP_MIN_MPDU_START_SPACE_MASK		0x7
2186 #define HE_6GHZ_BAND_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK	0x7
2187 #define HE_6GHZ_BAND_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT	3
2188 #define HE_6GHZ_BAND_CAP_MAX_MPDU_LENGTH_MASK			0x3
2189 #define HE_6GHZ_BAND_CAP_MAX_MPDU_LENGTH_SHIFT			6
2190 
2191 #define HE_6GHZ_BAND_CAP_SMPS_MASK			  (BIT(1) | BIT(2))
2192 #define HE_6GHZ_BAND_CAP_SMPS_STATIC			  0
2193 #define HE_6GHZ_BAND_CAP_SMPS_DYNAMIC			  BIT(1)
2194 #define HE_6GHZ_BAND_CAP_SMPS_DISABLED			  (BIT(1) | BIT(2))
2195 #define HE_6GHZ_BAND_CAP_RD_RESPONDER			  BIT(3)
2196 #define HE_6GHZ_BAND_CAP_RX_ANTENNA_PATTERN		  BIT(4)
2197 #define HE_6GHZ_BAND_CAP_TX_ANTENNA_PATTERN		  BIT(5)
2198 
2199 /*
2200  * IEEE P802.11ax/D4.0, 9.4.2.246 Spatial Reuse Parameter Set element
2201  */
2202 struct ieee80211_spatial_reuse {
2203 	u8 sr_ctrl; /* SR Control */
2204 	/* Up to 19 octets of parameters:
2205 	 * Non-SRG OBSS PD Max Offset[0 or 1]
2206 	 * SRG OBSS PD Min Offset[0 or 1]
2207 	 * SRG OBSS PD Max Offset[0 or 1]
2208 	 * SRG BSS Color Bitmap[0 or 8]
2209 	 * SRG Partial BSSID Bitmap[0 or 8]
2210 	 */
2211 	u8 params[19];
2212 } STRUCT_PACKED;
2213 
2214 struct ieee80211_6ghz_operation_info {
2215 	u8 primary_chan;
2216 	u8 control;
2217 	u8 chan_center_freq_seg0_idx;
2218 	u8 chan_center_freq_seg1_idx;
2219 	u8 minimum_rate;
2220 } STRUCT_PACKED;
2221 
2222 #define HE_CAPABILITIES_IE_MIN_LEN 21
2223 
2224 /* HE Capabilities Information defines */
2225 #define HE_MACCAP_TWT_RESPONDER			((u8) BIT(2))
2226 #define HE_PHYCAP_CHANNEL_WIDTH_SET_IDX		0
2227 #define HE_PHYCAP_CHANNEL_WIDTH_MASK		((u8) (BIT(1) | BIT(2) | \
2228 						      BIT(3) | BIT(4)))
2229 #define HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_IN_2G         ((u8) BIT(1))
2230 #define HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G	((u8) BIT(2))
2231 #define HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G	((u8) BIT(3))
2232 #define HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G	((u8) BIT(4))
2233 
2234 #define HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX	3
2235 #define HE_PHYCAP_SU_BEAMFORMER_CAPAB		((u8) BIT(7))
2236 #define HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX	4
2237 #define HE_PHYCAP_SU_BEAMFORMEE_CAPAB		((u8) BIT(0))
2238 #define HE_PHYCAP_MU_BEAMFORMER_CAPAB_IDX	4
2239 #define HE_PHYCAP_MU_BEAMFORMER_CAPAB		((u8) BIT(1))
2240 
2241 #define HE_PHYCAP_PPE_THRESHOLD_PRESENT_IDX	6
2242 #define HE_PHYCAP_PPE_THRESHOLD_PRESENT		((u8) BIT(7))
2243 
2244 /* HE PPE Threshold define */
2245 #define HE_PPE_THRES_RU_INDEX_BITMASK_MASK	0xf
2246 #define HE_PPE_THRES_RU_INDEX_BITMASK_SHIFT	3
2247 #define HE_PPE_THRES_NSS_MASK			0x7
2248 
2249 /* HE Operation defines */
2250 /* HE Operation Parameters and BSS Color Information fields */
2251 #define HE_OPERATION_DFLT_PE_DURATION_MASK	((u32) (BIT(0) | BIT(1) | \
2252 							BIT(2)))
2253 #define HE_OPERATION_DFLT_PE_DURATION_OFFSET	0
2254 #define HE_OPERATION_TWT_REQUIRED		((u32) BIT(3))
2255 #define HE_OPERATION_RTS_THRESHOLD_MASK	((u32) (BIT(4) | BIT(5) | \
2256 						BIT(6) | BIT(7) | \
2257 						BIT(8) | BIT(9) | \
2258 						BIT(10) | BIT(11) | \
2259 						BIT(12) | BIT(13)))
2260 #define HE_OPERATION_RTS_THRESHOLD_OFFSET	4
2261 #define HE_OPERATION_VHT_OPER_INFO		((u32) BIT(14))
2262 #define HE_OPERATION_COHOSTED_BSS		((u32) BIT(15))
2263 #define HE_OPERATION_ER_SU_DISABLE		((u32) BIT(16))
2264 #define HE_OPERATION_6GHZ_OPER_INFO		((u32) BIT(17))
2265 #define HE_OPERATION_BSS_COLOR_MASK		((u32) (BIT(24) | BIT(25) | \
2266 							BIT(26) | BIT(27) | \
2267 							BIT(28) | BIT(29)))
2268 #define HE_OPERATION_BSS_COLOR_PARTIAL		((u32) BIT(30))
2269 #define HE_OPERATION_BSS_COLOR_DISABLED		((u32) BIT(31))
2270 #define HE_OPERATION_BSS_COLOR_OFFSET		24
2271 
2272 /* HE operation fields length*/
2273 #define HE_OPERATION_IE_MIN_LEN 6
2274 #define HE_OPERATION_VHT_OPER_INFO_LEN 3
2275 #define HE_OPERATION_COHOSTED_BSSID_INDICATOR_LEN 1
2276 #define HE_OPERATION_6GHZ_OPER_INFO_LEN 5
2277 
2278 /* Spatial Reuse defines */
2279 #define SPATIAL_REUSE_SRP_DISALLOWED		BIT(0)
2280 #define SPATIAL_REUSE_NON_SRG_OBSS_PD_SR_DISALLOWED	BIT(1)
2281 #define SPATIAL_REUSE_NON_SRG_OFFSET_PRESENT	BIT(2)
2282 #define SPATIAL_REUSE_SRG_INFORMATION_PRESENT	BIT(3)
2283 #define SPATIAL_REUSE_HESIGA_SR_VAL15_ALLOWED	BIT(4)
2284 
2285 /* 6GHz operation control field defines*/
2286 #define SIX_GHZ_CONTROL_CHANNEL_WIDTH_MASK 	((u8) BIT(0) | BIT(1))
2287 #define SIX_GHZ_CONTROL_DUPLICATE_BEACON 	BIT(2)
2288 
2289 struct ieee80211_he_mu_edca_parameter_set {
2290 	u8 he_qos_info;
2291 	u8 he_mu_ac_be_param[3];
2292 	u8 he_mu_ac_bk_param[3];
2293 	u8 he_mu_ac_vi_param[3];
2294 	u8 he_mu_ac_vo_param[3];
2295 } STRUCT_PACKED;
2296 
2297 /* HE MU AC parameter record field format */
2298 /* ACI/AIFSN */
2299 #define HE_MU_AC_PARAM_ACI_IDX 0
2300 #define HE_MU_AC_PARAM_AIFSN ((u8) (BIT(0) | BIT(1) | BIT(2) | BIT(3)))
2301 #define HE_MU_AC_PARAM_ACM ((u8) BIT(4))
2302 #define HE_MU_AC_PARAM_ACI ((u8) (BIT(5) | BIT(6)))
2303 /* B7: Reserved */
2304 
2305 /* ECWmin/ECWmax */
2306 #define HE_MU_AC_PARAM_ECW_IDX 1
2307 #define HE_MU_AC_PARAM_ECWMIN ((u8) (BIT(0) | BIT(1) | BIT(2) | BIT(3)))
2308 #define HE_MU_AC_PARAM_ECWMAX ((u8) (BIT(4) | BIT(5) | BIT(6) | BIT(7)))
2309 
2310 /* MU EDCA Timer */
2311 #define HE_MU_AC_PARAM_TIMER_IDX 2
2312 
2313 /* HE QoS Info field */
2314 #define HE_QOS_INFO_EDCA_PARAM_SET_COUNT ((u8) (BIT(0) | BIT(1) | \
2315 						BIT(2) | BIT(3)))
2316 #define HE_QOS_INFO_Q_ACK ((u8) (BIT(4)))
2317 #define HE_QOS_INFO_QUEUE_REQUEST ((u8) (BIT(5)))
2318 #define HE_QOS_INFO_TXOP_REQUEST ((u8) (BIT(6)))
2319 /* B7: Reserved if sent by an AP; More Data Ack if sent by a non-AP STA */
2320 #define HE_QOS_INFO_MORE_DATA_ACK ((u8) (BIT(7)))
2321 
2322 /* IEEE P802.11ay/D4.0, 9.4.2.251 - EDMG Operation element */
2323 #define EDMG_BSS_OPERATING_CHANNELS_OFFSET	6
2324 #define EDMG_OPERATING_CHANNEL_WIDTH_OFFSET	7
2325 
2326 /* IEEE P802.11ay/D4.0, 29.3.4 - Channelization */
2327 enum edmg_channel {
2328 	EDMG_CHANNEL_9	= 9,
2329 	EDMG_CHANNEL_10	= 10,
2330 	EDMG_CHANNEL_11	= 11,
2331 	EDMG_CHANNEL_12	= 12,
2332 	EDMG_CHANNEL_13	= 13,
2333 };
2334 
2335 /* Represent CB2 contiguous channels */
2336 #define EDMG_CHANNEL_9_SUBCHANNELS	(BIT(0) | BIT(1)) /* channels 1 and 2 */
2337 #define EDMG_CHANNEL_10_SUBCHANNELS	(BIT(1) | BIT(2)) /* channels 2 and 3 */
2338 #define EDMG_CHANNEL_11_SUBCHANNELS	(BIT(2) | BIT(3)) /* channels 3 and 4 */
2339 #define EDMG_CHANNEL_12_SUBCHANNELS	(BIT(3) | BIT(4)) /* channels 4 and 5 */
2340 #define EDMG_CHANNEL_13_SUBCHANNELS	(BIT(4) | BIT(5)) /* channels 5 and 6 */
2341 
2342 /**
2343  * enum edmg_bw_config - Allowed channel bandwidth configurations
2344  * @EDMG_BW_CONFIG_4: 2.16 GHz
2345  * @EDMG_BW_CONFIG_5: 2.16 GHz and 4.32 GHz
2346  *
2347  * IEEE P802.11ay/D4.0, 9.4.2.251 (EDMG Operation element),
2348  * Table 13 (Channel BW Configuration subfield definition)
2349  */
2350 enum edmg_bw_config {
2351 	EDMG_BW_CONFIG_4	= 4,
2352 	EDMG_BW_CONFIG_5	= 5,
2353 };
2354 
2355 /* DPP Public Action frame identifiers - OUI_WFA */
2356 #define DPP_OUI_TYPE 0x1A
2357 
2358 #endif /* IEEE802_11_DEFS_H */
2359