xref: /freebsd/contrib/wpa/src/common/ieee802_11_defs.h (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
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_HTC		0x8000
26 
27 #define WLAN_FC_S1G_BEACON_NEXT_TBTT	0x0100
28 #define WLAN_FC_S1G_BEACON_COMP_SSID	0x0200
29 #define WLAN_FC_S1G_BEACON_ANO		0x0400
30 #define WLAN_FC_S1G_BEACON_BSS_BW	0x3800
31 #define WLAN_FC_S1G_BEACON_SECURITY	0x4000
32 #define WLAN_FC_S1G_BEACON_AP_PM	0x8000
33 
34 #define WLAN_FC_GET_TYPE(fc)	(((fc) & 0x000c) >> 2)
35 #define WLAN_FC_GET_STYPE(fc)	(((fc) & 0x00f0) >> 4)
36 
37 #define WLAN_INVALID_MGMT_SEQ   0xFFFF
38 
39 #define WLAN_GET_SEQ_FRAG(seq) ((seq) & (BIT(3) | BIT(2) | BIT(1) | BIT(0)))
40 #define WLAN_GET_SEQ_SEQ(seq) \
41 	(((seq) & (~(BIT(3) | BIT(2) | BIT(1) | BIT(0)))) >> 4)
42 
43 #define WLAN_FC_TYPE_MGMT		0
44 #define WLAN_FC_TYPE_CTRL		1
45 #define WLAN_FC_TYPE_DATA		2
46 #define WLAN_FC_TYPE_EXT		3
47 
48 /* management */
49 #define WLAN_FC_STYPE_ASSOC_REQ		0
50 #define WLAN_FC_STYPE_ASSOC_RESP	1
51 #define WLAN_FC_STYPE_REASSOC_REQ	2
52 #define WLAN_FC_STYPE_REASSOC_RESP	3
53 #define WLAN_FC_STYPE_PROBE_REQ		4
54 #define WLAN_FC_STYPE_PROBE_RESP	5
55 #define WLAN_FC_STYPE_BEACON		8
56 #define WLAN_FC_STYPE_ATIM		9
57 #define WLAN_FC_STYPE_DISASSOC		10
58 #define WLAN_FC_STYPE_AUTH		11
59 #define WLAN_FC_STYPE_DEAUTH		12
60 #define WLAN_FC_STYPE_ACTION		13
61 #define WLAN_FC_STYPE_ACTION_NO_ACK	14
62 
63 /* control */
64 #define WLAN_FC_STYPE_PSPOLL		10
65 #define WLAN_FC_STYPE_RTS		11
66 #define WLAN_FC_STYPE_CTS		12
67 #define WLAN_FC_STYPE_ACK		13
68 #define WLAN_FC_STYPE_CFEND		14
69 #define WLAN_FC_STYPE_CFENDACK		15
70 
71 /* data */
72 #define WLAN_FC_STYPE_DATA		0
73 #define WLAN_FC_STYPE_DATA_CFACK	1
74 #define WLAN_FC_STYPE_DATA_CFPOLL	2
75 #define WLAN_FC_STYPE_DATA_CFACKPOLL	3
76 #define WLAN_FC_STYPE_NULLFUNC		4
77 #define WLAN_FC_STYPE_CFACK		5
78 #define WLAN_FC_STYPE_CFPOLL		6
79 #define WLAN_FC_STYPE_CFACKPOLL		7
80 #define WLAN_FC_STYPE_QOS_DATA		8
81 #define WLAN_FC_STYPE_QOS_DATA_CFACK	9
82 #define WLAN_FC_STYPE_QOS_DATA_CFPOLL	10
83 #define WLAN_FC_STYPE_QOS_DATA_CFACKPOLL	11
84 #define WLAN_FC_STYPE_QOS_NULL		12
85 #define WLAN_FC_STYPE_QOS_CFPOLL	14
86 #define WLAN_FC_STYPE_QOS_CFACKPOLL	15
87 
88 /* extension */
89 #define WLAN_FC_STYPE_DMG_BEACON	0
90 #define WLAN_FC_STYPE_S1G_BEACON	1
91 
92 /* Authentication algorithms */
93 #define WLAN_AUTH_OPEN			0
94 #define WLAN_AUTH_SHARED_KEY		1
95 #define WLAN_AUTH_FT			2
96 #define WLAN_AUTH_SAE			3
97 #define WLAN_AUTH_FILS_SK		4
98 #define WLAN_AUTH_FILS_SK_PFS		5
99 #define WLAN_AUTH_FILS_PK		6
100 #define WLAN_AUTH_PASN			7
101 #define WLAN_AUTH_LEAP			128
102 
103 #define WLAN_AUTH_CHALLENGE_LEN 128
104 
105 #define WLAN_CAPABILITY_ESS BIT(0)
106 #define WLAN_CAPABILITY_IBSS BIT(1)
107 #define WLAN_CAPABILITY_CF_POLLABLE BIT(2)
108 #define WLAN_CAPABILITY_CF_POLL_REQUEST BIT(3)
109 #define WLAN_CAPABILITY_PRIVACY BIT(4)
110 #define WLAN_CAPABILITY_SHORT_PREAMBLE BIT(5)
111 #define WLAN_CAPABILITY_PBCC BIT(6)
112 #define WLAN_CAPABILITY_CHANNEL_AGILITY BIT(7)
113 #define WLAN_CAPABILITY_SPECTRUM_MGMT BIT(8)
114 #define WLAN_CAPABILITY_QOS BIT(9)
115 #define WLAN_CAPABILITY_SHORT_SLOT_TIME BIT(10)
116 #define WLAN_CAPABILITY_APSD BIT(11)
117 #define WLAN_CAPABILITY_RADIO_MEASUREMENT BIT(12)
118 #define WLAN_CAPABILITY_DSSS_OFDM BIT(13)
119 #define WLAN_CAPABILITY_DELAYED_BLOCK_ACK BIT(14)
120 #define WLAN_CAPABILITY_IMM_BLOCK_ACK BIT(15)
121 
122 /* Status codes (IEEE Std 802.11-2020, 9.4.1.9, Table 9-50) */
123 #define WLAN_STATUS_SUCCESS 0
124 #define WLAN_STATUS_UNSPECIFIED_FAILURE 1
125 #define WLAN_STATUS_TDLS_WAKEUP_ALTERNATE 2
126 #define WLAN_STATUS_TDLS_WAKEUP_REJECT 3
127 #define WLAN_STATUS_SECURITY_DISABLED 5
128 #define WLAN_STATUS_UNACCEPTABLE_LIFETIME 6
129 #define WLAN_STATUS_NOT_IN_SAME_BSS 7
130 #define WLAN_STATUS_CAPS_UNSUPPORTED 10
131 #define WLAN_STATUS_REASSOC_NO_ASSOC 11
132 #define WLAN_STATUS_ASSOC_DENIED_UNSPEC 12
133 #define WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG 13
134 #define WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION 14
135 #define WLAN_STATUS_CHALLENGE_FAIL 15
136 #define WLAN_STATUS_AUTH_TIMEOUT 16
137 #define WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA 17
138 #define WLAN_STATUS_ASSOC_DENIED_RATES 18
139 #define WLAN_STATUS_ASSOC_DENIED_NOSHORT 19
140 #define WLAN_STATUS_SPEC_MGMT_REQUIRED 22
141 #define WLAN_STATUS_PWR_CAPABILITY_NOT_VALID 23
142 #define WLAN_STATUS_SUPPORTED_CHANNEL_NOT_VALID 24
143 #define WLAN_STATUS_ASSOC_DENIED_NO_SHORT_SLOT_TIME 25
144 #define WLAN_STATUS_ASSOC_DENIED_NO_HT 27
145 #define WLAN_STATUS_R0KH_UNREACHABLE 28
146 #define WLAN_STATUS_ASSOC_DENIED_NO_PCO 29
147 #define WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY 30
148 #define WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION 31
149 #define WLAN_STATUS_UNSPECIFIED_QOS_FAILURE 32
150 #define WLAN_STATUS_DENIED_INSUFFICIENT_BANDWIDTH 33
151 #define WLAN_STATUS_DENIED_POOR_CHANNEL_CONDITIONS 34
152 #define WLAN_STATUS_DENIED_QOS_NOT_SUPPORTED 35
153 #define WLAN_STATUS_REQUEST_DECLINED 37
154 #define WLAN_STATUS_INVALID_PARAMETERS 38
155 #define WLAN_STATUS_REJECTED_WITH_SUGGESTED_CHANGES 39
156 #define WLAN_STATUS_INVALID_IE 40
157 #define WLAN_STATUS_GROUP_CIPHER_NOT_VALID 41
158 #define WLAN_STATUS_PAIRWISE_CIPHER_NOT_VALID 42
159 #define WLAN_STATUS_AKMP_NOT_VALID 43
160 #define WLAN_STATUS_UNSUPPORTED_RSN_IE_VERSION 44
161 #define WLAN_STATUS_INVALID_RSN_IE_CAPAB 45
162 #define WLAN_STATUS_CIPHER_REJECTED_PER_POLICY 46
163 #define WLAN_STATUS_TS_NOT_CREATED 47
164 #define WLAN_STATUS_DIRECT_LINK_NOT_ALLOWED 48
165 #define WLAN_STATUS_DEST_STA_NOT_PRESENT 49
166 #define WLAN_STATUS_DEST_STA_NOT_QOS_STA 50
167 #define WLAN_STATUS_ASSOC_DENIED_LISTEN_INT_TOO_LARGE 51
168 #define WLAN_STATUS_INVALID_FT_ACTION_FRAME_COUNT 52
169 #define WLAN_STATUS_INVALID_PMKID 53
170 #define WLAN_STATUS_INVALID_MDIE 54
171 #define WLAN_STATUS_INVALID_FTIE 55
172 #define WLAN_STATUS_REQUESTED_TCLAS_NOT_SUPPORTED 56
173 #define WLAN_STATUS_INSUFFICIENT_TCLAS_PROCESSING_RESOURCES 57
174 #define WLAN_STATUS_TRY_ANOTHER_BSS 58
175 #define WLAN_STATUS_GAS_ADV_PROTO_NOT_SUPPORTED 59
176 #define WLAN_STATUS_NO_OUTSTANDING_GAS_REQ 60
177 #define WLAN_STATUS_GAS_RESP_NOT_RECEIVED 61
178 #define WLAN_STATUS_STA_TIMED_OUT_WAITING_FOR_GAS_RESP 62
179 #define WLAN_STATUS_GAS_RESP_LARGER_THAN_LIMIT 63
180 #define WLAN_STATUS_REQ_REFUSED_HOME 64
181 #define WLAN_STATUS_ADV_SRV_UNREACHABLE 65
182 #define WLAN_STATUS_REQ_REFUSED_SSPN 67
183 #define WLAN_STATUS_REQ_REFUSED_UNAUTH_ACCESS 68
184 #define WLAN_STATUS_INVALID_RSNIE 72
185 #define WLAN_STATUS_U_APSD_COEX_NOT_SUPPORTED 73
186 #define WLAN_STATUS_U_APSD_COEX_MODE_NOT_SUPPORTED 74
187 #define WLAN_STATUS_BAD_INTERVAL_WITH_U_APSD_COEX 75
188 #define WLAN_STATUS_ANTI_CLOGGING_TOKEN_REQ 76
189 #define WLAN_STATUS_FINITE_CYCLIC_GROUP_NOT_SUPPORTED 77
190 #define WLAN_STATUS_CANNOT_FIND_ALT_TBTT 78
191 #define WLAN_STATUS_TRANSMISSION_FAILURE 79
192 #define WLAN_STATUS_REQ_TCLAS_NOT_SUPPORTED 80
193 #define WLAN_STATUS_TCLAS_RESOURCES_EXCHAUSTED 81
194 #define WLAN_STATUS_REJECTED_WITH_SUGGESTED_BSS_TRANSITION 82
195 #define WLAN_STATUS_REJECT_WITH_SCHEDULE 83
196 #define WLAN_STATUS_REJECT_NO_WAKEUP_SPECIFIED 84
197 #define WLAN_STATUS_SUCCESS_POWER_SAVE_MODE 85
198 #define WLAN_STATUS_PENDING_ADMITTING_FST_SESSION 86
199 #define WLAN_STATUS_PERFORMING_FST_NOW 87
200 #define WLAN_STATUS_PENDING_GAP_IN_BA_WINDOW 88
201 #define WLAN_STATUS_REJECT_U_PID_SETTING 89
202 #define WLAN_STATUS_REFUSED_EXTERNAL_REASON 92
203 #define WLAN_STATUS_REFUSED_AP_OUT_OF_MEMORY 93
204 #define WLAN_STATUS_REJECTED_EMERGENCY_SERVICE_NOT_SUPPORTED 94
205 #define WLAN_STATUS_QUERY_RESP_OUTSTANDING 95
206 #define WLAN_STATUS_REJECT_DSE_BAND 96
207 #define WLAN_STATUS_TCLAS_PROCESSING_TERMINATED 97
208 #define WLAN_STATUS_TS_SCHEDULE_CONFLICT 98
209 #define WLAN_STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL 99
210 #define WLAN_STATUS_MCCAOP_RESERVATION_CONFLICT 100
211 #define WLAN_STATUS_MAF_LIMIT_EXCEEDED 101
212 #define WLAN_STATUS_MCCA_TRACK_LIMIT_EXCEEDED 102
213 #define WLAN_STATUS_DENIED_DUE_TO_SPECTRUM_MANAGEMENT 103
214 #define WLAN_STATUS_ASSOC_DENIED_NO_VHT 104
215 #define WLAN_STATUS_ENABLEMENT_DENIED 105
216 #define WLAN_STATUS_RESTRICTION_FROM_AUTHORIZED_GDB 106
217 #define WLAN_STATUS_AUTHORIZATION_DEENABLED 107
218 #define WLAN_STATUS_FILS_AUTHENTICATION_FAILURE 112
219 #define WLAN_STATUS_UNKNOWN_AUTHENTICATION_SERVER 113
220 #define WLAN_STATUS_UNKNOWN_PASSWORD_IDENTIFIER 123
221 #define WLAN_STATUS_DENIED_HE_NOT_SUPPORTED 124
222 #define WLAN_STATUS_SAE_HASH_TO_ELEMENT 126
223 #define WLAN_STATUS_SAE_PK 127
224 #define WLAN_STATUS_DENIED_STA_AFF_WITH_MLD_WITH_EXISTING_ASSOC 130
225 #define WLAN_STATUS_EPCS_DENIED_UNAUTHORIZED 131
226 #define WLAN_STATUS_EPCS_DENIED 132
227 #define WLAN_STATUS_DENIED_TID_TO_LINK_MAPPING 133
228 #define WLAN_STATUS_PREFERRED_TID_TO_LINK_MAPPING_SUGGESTED 134
229 #define WLAN_STATUS_DENIED_EHT_NOT_SUPPORTED 135
230 #define WLAN_STATUS_INVALID_PUBLIC_KEY 136
231 #define WLAN_STATUS_PASN_BASE_AKMP_FAILED 137
232 #define WLAN_STATUS_OCI_MISMATCH 138
233 #define WLAN_STATUS_DENIED_TX_LINK_NOT_ACCEPTED 139
234 #define WLAN_STATUS_EPCS_DENIED_VERIFICATION_FAILURE 140
235 #define WLAN_STATUS_DENIED_OPERATION_PARAMETER_UPDATE 141
236 
237 /* Reason codes (IEEE Std 802.11-2020, 9.4.1.7, Table 9-90) */
238 #define WLAN_REASON_UNSPECIFIED 1
239 #define WLAN_REASON_PREV_AUTH_NOT_VALID 2
240 #define WLAN_REASON_DEAUTH_LEAVING 3
241 #define WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY 4
242 #define WLAN_REASON_DISASSOC_AP_BUSY 5
243 #define WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA 6
244 #define WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA 7
245 #define WLAN_REASON_DISASSOC_STA_HAS_LEFT 8
246 #define WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH 9
247 #define WLAN_REASON_PWR_CAPABILITY_NOT_VALID 10
248 #define WLAN_REASON_SUPPORTED_CHANNEL_NOT_VALID 11
249 #define WLAN_REASON_BSS_TRANSITION_DISASSOC 12
250 #define WLAN_REASON_INVALID_IE 13
251 #define WLAN_REASON_MICHAEL_MIC_FAILURE 14
252 #define WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT 15
253 #define WLAN_REASON_GROUP_KEY_UPDATE_TIMEOUT 16
254 #define WLAN_REASON_IE_IN_4WAY_DIFFERS 17
255 #define WLAN_REASON_GROUP_CIPHER_NOT_VALID 18
256 #define WLAN_REASON_PAIRWISE_CIPHER_NOT_VALID 19
257 #define WLAN_REASON_AKMP_NOT_VALID 20
258 #define WLAN_REASON_UNSUPPORTED_RSN_IE_VERSION 21
259 #define WLAN_REASON_INVALID_RSN_IE_CAPAB 22
260 #define WLAN_REASON_IEEE_802_1X_AUTH_FAILED 23
261 #define WLAN_REASON_CIPHER_SUITE_REJECTED 24
262 #define WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE 25
263 #define WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED 26
264 #define WLAN_REASON_SSP_REQUESTED_DISASSOC 27
265 #define WLAN_REASON_NO_SSP_ROAMING_AGREEMENT 28
266 #define WLAN_REASON_BAD_CIPHER_OR_AKM 29
267 #define WLAN_REASON_NOT_AUTHORIZED_THIS_LOCATION 30
268 #define WLAN_REASON_SERVICE_CHANGE_PRECLUDES_TS 31
269 #define WLAN_REASON_UNSPECIFIED_QOS_REASON 32
270 #define WLAN_REASON_NOT_ENOUGH_BANDWIDTH 33
271 #define WLAN_REASON_DISASSOC_LOW_ACK 34
272 #define WLAN_REASON_EXCEEDED_TXOP 35
273 #define WLAN_REASON_STA_LEAVING 36
274 #define WLAN_REASON_END_TS_BA_DLS 37
275 #define WLAN_REASON_UNKNOWN_TS_BA 38
276 #define WLAN_REASON_TIMEOUT 39
277 #define WLAN_REASON_PEERKEY_MISMATCH 45
278 #define WLAN_REASON_AUTHORIZED_ACCESS_LIMIT_REACHED 46
279 #define WLAN_REASON_EXTERNAL_SERVICE_REQUIREMENTS 47
280 #define WLAN_REASON_INVALID_FT_ACTION_FRAME_COUNT 48
281 #define WLAN_REASON_INVALID_PMKID 49
282 #define WLAN_REASON_INVALID_MDE 50
283 #define WLAN_REASON_INVALID_FTE 51
284 #define WLAN_REASON_MESH_PEERING_CANCELLED 52
285 #define WLAN_REASON_MESH_MAX_PEERS 53
286 #define WLAN_REASON_MESH_CONFIG_POLICY_VIOLATION 54
287 #define WLAN_REASON_MESH_CLOSE_RCVD 55
288 #define WLAN_REASON_MESH_MAX_RETRIES 56
289 #define WLAN_REASON_MESH_CONFIRM_TIMEOUT 57
290 #define WLAN_REASON_MESH_INVALID_GTK 58
291 #define WLAN_REASON_MESH_INCONSISTENT_PARAMS 59
292 #define WLAN_REASON_MESH_INVALID_SECURITY_CAP 60
293 #define WLAN_REASON_MESH_PATH_ERROR_NO_PROXY_INFO 61
294 #define WLAN_REASON_MESH_PATH_ERROR_NO_FORWARDING_INFO 62
295 #define WLAN_REASON_MESH_PATH_ERROR_DEST_UNREACHABLE 63
296 #define WLAN_REASON_MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS 64
297 #define WLAN_REASON_MESH_CHANNEL_SWITCH_REGULATORY_REQ 65
298 #define WLAN_REASON_MESH_CHANNEL_SWITCH_UNSPECIFIED 66
299 
300 
301 /* Element IDs (IEEE Std 802.11-2020, 9.4.2.1, Table 9-92) */
302 #define WLAN_EID_SSID 0
303 #define WLAN_EID_SUPP_RATES 1
304 #define WLAN_EID_DS_PARAMS 3
305 #define WLAN_EID_CF_PARAMS 4
306 #define WLAN_EID_TIM 5
307 #define WLAN_EID_IBSS_PARAMS 6
308 #define WLAN_EID_COUNTRY 7
309 #define WLAN_EID_REQUEST 10
310 #define WLAN_EID_BSS_LOAD 11
311 #define WLAN_EID_EDCA_PARAM_SET 12
312 #define WLAN_EID_TSPEC 13
313 #define WLAN_EID_TCLAS 14
314 #define WLAN_EID_SCHEDULE 15
315 #define WLAN_EID_CHALLENGE 16
316 #define WLAN_EID_PWR_CONSTRAINT 32
317 #define WLAN_EID_PWR_CAPABILITY 33
318 #define WLAN_EID_TPC_REQUEST 34
319 #define WLAN_EID_TPC_REPORT 35
320 #define WLAN_EID_SUPPORTED_CHANNELS 36
321 #define WLAN_EID_CHANNEL_SWITCH 37
322 #define WLAN_EID_MEASURE_REQUEST 38
323 #define WLAN_EID_MEASURE_REPORT 39
324 #define WLAN_EID_QUIET 40
325 #define WLAN_EID_IBSS_DFS 41
326 #define WLAN_EID_ERP_INFO 42
327 #define WLAN_EID_TS_DELAY 43
328 #define WLAN_EID_TCLAS_PROCESSING 44
329 #define WLAN_EID_HT_CAP 45
330 #define WLAN_EID_QOS 46
331 #define WLAN_EID_RSN 48
332 #define WLAN_EID_EXT_SUPP_RATES 50
333 #define WLAN_EID_AP_CHANNEL_REPORT 51
334 #define WLAN_EID_NEIGHBOR_REPORT 52
335 #define WLAN_EID_RCPI 53
336 #define WLAN_EID_MOBILITY_DOMAIN 54
337 #define WLAN_EID_FAST_BSS_TRANSITION 55
338 #define WLAN_EID_TIMEOUT_INTERVAL 56
339 #define WLAN_EID_RIC_DATA 57
340 #define WLAN_EID_DSE_REGISTERED_LOCATION 58
341 #define WLAN_EID_SUPPORTED_OPERATING_CLASSES 59
342 #define WLAN_EID_EXT_CHANSWITCH_ANN 60
343 #define WLAN_EID_HT_OPERATION 61
344 #define WLAN_EID_SECONDARY_CHANNEL_OFFSET 62
345 #define WLAN_EID_BSS_AVERAGE_ACCESS_DELAY 63
346 #define WLAN_EID_ANTENNA 64
347 #define WLAN_EID_RSNI 65
348 #define WLAN_EID_MEASUREMENT_PILOT_TRANSMISSION 66
349 #define WLAN_EID_BSS_AVAILABLE_ADM_CAPA 67
350 #define WLAN_EID_BSS_AC_ACCESS_DELAY 68 /* note: also used by WAPI */
351 #define WLAN_EID_TIME_ADVERTISEMENT 69
352 #define WLAN_EID_RRM_ENABLED_CAPABILITIES 70
353 #define WLAN_EID_MULTIPLE_BSSID 71
354 #define WLAN_EID_20_40_BSS_COEXISTENCE 72
355 #define WLAN_EID_20_40_BSS_INTOLERANT 73
356 #define WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS 74
357 #define WLAN_EID_RIC_DESCRIPTOR 75
358 #define WLAN_EID_MMIE 76
359 #define WLAN_EID_EVENT_REQUEST 78
360 #define WLAN_EID_EVENT_REPORT 79
361 #define WLAN_EID_DIAGNOSTIC_REQUEST 80
362 #define WLAN_EID_DIAGNOSTIC_REPORT 81
363 #define WLAN_EID_LOCATION_PARAMETERS 82
364 #define WLAN_EID_NONTRANSMITTED_BSSID_CAPA 83
365 #define WLAN_EID_SSID_LIST 84
366 #define WLAN_EID_MULTIPLE_BSSID_INDEX 85
367 #define WLAN_EID_FMS_DESCRIPTOR 86
368 #define WLAN_EID_FMS_REQUEST 87
369 #define WLAN_EID_FMS_RESPONSE 88
370 #define WLAN_EID_QOS_TRAFFIC_CAPABILITY 89
371 #define WLAN_EID_BSS_MAX_IDLE_PERIOD 90
372 #define WLAN_EID_TFS_REQ 91
373 #define WLAN_EID_TFS_RESP 92
374 #define WLAN_EID_WNMSLEEP 93
375 #define WLAN_EID_TIM_BROADCAST_REQUEST 94
376 #define WLAN_EID_TIM_BROADCAST_RESPONSE 95
377 #define WLAN_EID_COLLOCATED_INTERFERENCE_REPORT 96
378 #define WLAN_EID_CHANNEL_USAGE 97
379 #define WLAN_EID_TIME_ZONE 98
380 #define WLAN_EID_DMS_REQUEST 99
381 #define WLAN_EID_DMS_RESPONSE 100
382 #define WLAN_EID_LINK_ID 101
383 #define WLAN_EID_WAKEUP_SCHEDULE 102
384 #define WLAN_EID_CHANNEL_SWITCH_TIMING 104
385 #define WLAN_EID_PTI_CONTROL 105
386 #define WLAN_EID_TPU_BUFFER_STATUS 106
387 #define WLAN_EID_INTERWORKING 107
388 #define WLAN_EID_ADV_PROTO 108
389 #define WLAN_EID_EXPEDITED_BANDWIDTH_REQ 109
390 #define WLAN_EID_QOS_MAP_SET 110
391 #define WLAN_EID_ROAMING_CONSORTIUM 111
392 #define WLAN_EID_EMERGENCY_ALERT_ID 112
393 #define WLAN_EID_MESH_CONFIG 113
394 #define WLAN_EID_MESH_ID 114
395 #define WLAN_EID_MESH_LINK_METRIC_REPORT 115
396 #define WLAN_EID_CONGESTION_NOTIFICATION 116
397 #define WLAN_EID_PEER_MGMT 117
398 #define WLAN_EID_MESH_CHANNEL_SWITCH_PARAMETERS 118
399 #define WLAN_EID_MESH_AWAKE_WINDOW 119
400 #define WLAN_EID_BEACON_TIMING 120
401 #define WLAN_EID_MCCAOP_SETUP_REQUEST 121
402 #define WLAN_EID_MCCAOP_SETUP_REPLY 122
403 #define WLAN_EID_MCCAOP_ADVERTISEMENT 123
404 #define WLAN_EID_MCCAOP_TEARDOWN 124
405 #define WLAN_EID_GANN 125
406 #define WLAN_EID_RANN 126
407 #define WLAN_EID_EXT_CAPAB 127
408 #define WLAN_EID_PREQ 130
409 #define WLAN_EID_PREP 131
410 #define WLAN_EID_PERR 132
411 #define WLAN_EID_PXU 137
412 #define WLAN_EID_PXUC 138
413 #define WLAN_EID_AMPE 139
414 #define WLAN_EID_MIC 140
415 #define WLAN_EID_DESTINATION_URI 141
416 #define WLAN_EID_U_APSD_COEX 142
417 #define WLAN_EID_DMG_WAKEUP_SCHEDULE 143
418 #define WLAN_EID_EXTENDED_SCHEDULE 144
419 #define WLAN_EID_STA_AVAILABILITY 145
420 #define WLAN_EID_DMG_TSPEC 146
421 #define WLAN_EID_NEXT_DMG_ATI 147
422 #define WLAN_EID_DMG_CAPABILITIES 148
423 #define WLAN_EID_DMG_OPERATION 151
424 #define WLAN_EID_DMG_BSS_PARAMETER_CHANGE 152
425 #define WLAN_EID_DMG_BEAM_REFINEMENT 153
426 #define WLAN_EID_CHANNEL_MEASUREMENT_FEEDBACK 154
427 #define WLAN_EID_CCKM 156
428 #define WLAN_EID_AWAKE_WINDOW 157
429 #define WLAN_EID_MULTI_BAND 158
430 #define WLAN_EID_ADDBA_EXTENSION 159
431 #define WLAN_EID_NEXTPCP_LIST 160
432 #define WLAN_EID_PCP_HANDOVER 161
433 #define WLAN_EID_DMG_LINK_MARGIN 162
434 #define WLAN_EID_SWITCHING_STREAM 163
435 #define WLAN_EID_SESSION_TRANSITION 164
436 #define WLAN_EID_DYNAMIC_TONE_PAIRING_REPORT 165
437 #define WLAN_EID_CLUSTER_REPORT 166
438 #define WLAN_EID_REPLAY_CAPABILITIES 167
439 #define WLAN_EID_RELAY_TRANSFER_PARAM_SET 168
440 #define WLAN_EID_BEAMLINK_MAINTENANCE 169
441 #define WLAN_EID_MULTIPLE_MAC_SUBLAYERS 170
442 #define WLAN_EID_U_PID 171
443 #define WLAN_EID_DMG_LINK_ADAPTATION_ACK 172
444 #define WLAN_EID_MCCAOP_ADVERTISEMENT_OVERVIEW 174
445 #define WLAN_EID_QUIET_PERIOD_REQUEST 175
446 #define WLAN_EID_QUIET_PERIOD_RESPONSE 177
447 #define WLAN_EID_QMF_POLICY 181
448 #define WLAN_EID_ECAPC_POLICY 182
449 #define WLAN_EID_CLUSTER_TIME_OFFSET 183
450 #define WLAN_EID_INTRA_ACCESS_CATEGORY_PRIORITY 184
451 #define WLAN_EID_SCS_DESCRIPTOR 185
452 #define WLAN_EID_QLOAD_REPORT 186
453 #define WLAN_EID_HCCA_TXOP_UPDATE_COUNT 187
454 #define WLAN_EID_HIGHER_LAYER_STREAM_ID 188
455 #define WLAN_EID_GCR_GROUP_ADDRESS 189
456 #define WLAN_EID_ANTENNA_SECTOR_ID_PATTERN 190
457 #define WLAN_EID_VHT_CAP 191
458 #define WLAN_EID_VHT_OPERATION 192
459 #define WLAN_EID_EXTENDED_BSS_LOAD 193
460 #define WLAN_EID_WIDE_BW_CHSWITCH  194
461 #define WLAN_EID_TRANSMIT_POWER_ENVELOPE 195
462 #define WLAN_EID_CHANNEL_SWITCH_WRAPPER 196
463 #define WLAN_EID_AID 197
464 #define WLAN_EID_QUIET_CHANNEL 198
465 #define WLAN_EID_OPERATING_MODE_NOTIFICATION 199
466 #define WLAN_EID_UPSIM 200
467 #define WLAN_EID_REDUCED_NEIGHBOR_REPORT 201
468 #define WLAN_EID_TVHT_OPERATION 202
469 #define WLAN_EID_DEVICE_LOCATION 204
470 #define WLAN_EID_WHITE_SPACE_MAP 205
471 #define WLAN_EID_FTM_PARAMETERS 206
472 #define WLAN_EID_S1G_BCN_COMPAT 213
473 #define WLAN_EID_TWT 216
474 #define WLAN_EID_S1G_CAPABILITIES 217
475 #define WLAN_EID_VENDOR_SPECIFIC 221
476 #define WLAN_EID_S1G_OPERATION 232
477 #define WLAN_EID_CAG_NUMBER 237
478 #define WLAN_EID_AP_CSN 239
479 #define WLAN_EID_FILS_INDICATION 240
480 #define WLAN_EID_DILS 241
481 #define WLAN_EID_FRAGMENT 242
482 #define WLAN_EID_RSNX 244
483 #define WLAN_EID_EXTENSION 255
484 
485 /* Element ID Extension (EID 255) values */
486 #define WLAN_EID_EXT_ASSOC_DELAY_INFO 1
487 #define WLAN_EID_EXT_FILS_REQ_PARAMS 2
488 #define WLAN_EID_EXT_FILS_KEY_CONFIRM 3
489 #define WLAN_EID_EXT_FILS_SESSION 4
490 #define WLAN_EID_EXT_FILS_HLP_CONTAINER 5
491 #define WLAN_EID_EXT_FILS_IP_ADDR_ASSIGN 6
492 #define WLAN_EID_EXT_KEY_DELIVERY 7
493 #define WLAN_EID_EXT_WRAPPED_DATA 8
494 #define WLAN_EID_EXT_FTM_SYNC_INFO 9
495 #define WLAN_EID_EXT_EXTENDED_REQUEST 10
496 #define WLAN_EID_EXT_ESTIMATED_SERVICE_PARAMS 11
497 #define WLAN_EID_EXT_FILS_PUBLIC_KEY 12
498 #define WLAN_EID_EXT_FILS_NONCE 13
499 #define WLAN_EID_EXT_FUTURE_CHANNEL_GUIDANCE 14
500 #define WLAN_EID_EXT_OWE_DH_PARAM 32
501 #define WLAN_EID_EXT_PASSWORD_IDENTIFIER 33
502 #define WLAN_EID_EXT_HE_CAPABILITIES 35
503 #define WLAN_EID_EXT_HE_OPERATION 36
504 #define WLAN_EID_EXT_HE_MU_EDCA_PARAMS 38
505 #define WLAN_EID_EXT_SPATIAL_REUSE 39
506 #define WLAN_EID_EXT_COLOR_CHANGE_ANNOUNCEMENT 42
507 #define WLAN_EID_EXT_OCV_OCI 54
508 #define WLAN_EID_EXT_MULTIPLE_BSSID_CONFIGURATION 55
509 #define WLAN_EID_EXT_NON_INHERITANCE 56
510 #define WLAN_EID_EXT_KNOWN_BSSID 57
511 #define WLAN_EID_EXT_SHORT_SSID_LIST 58
512 #define WLAN_EID_EXT_HE_6GHZ_BAND_CAP 59
513 #define WLAN_EID_EXT_EDMG_CAPABILITIES 61
514 #define WLAN_EID_EXT_EDMG_OPERATION 62
515 #define WLAN_EID_EXT_MSCS_DESCRIPTOR 88
516 #define WLAN_EID_EXT_TCLAS_MASK 89
517 #define WLAN_EID_EXT_REJECTED_GROUPS 92
518 #define WLAN_EID_EXT_ANTI_CLOGGING_TOKEN 93
519 #define WLAN_EID_EXT_PASN_PARAMS 100
520 #define WLAN_EID_EXT_EHT_OPERATION 106
521 #define WLAN_EID_EXT_MULTI_LINK 107
522 #define WLAN_EID_EXT_EHT_CAPABILITIES 108
523 #define WLAN_EID_EXT_TID_TO_LINK_MAPPING 109
524 #define WLAN_EID_EXT_MULTI_LINK_TRAFFIC_INDICATION 110
525 #define WLAN_EID_EXT_QOS_CHARACTERISTICS 113
526 #define WLAN_EID_EXT_AKM_SUITE_SELECTOR 114
527 
528 /* Extended Capabilities field */
529 #define WLAN_EXT_CAPAB_20_40_COEX 0
530 #define WLAN_EXT_CAPAB_GLK 1
531 #define WLAN_EXT_CAPAB_EXT_CHAN_SWITCH 2
532 #define WLAN_EXT_CAPAB_GLK_GCR 3
533 #define WLAN_EXT_CAPAB_PSMP 4
534 /* 5 - Reserved */
535 #define WLAN_EXT_CAPAB_S_PSMP 6
536 #define WLAN_EXT_CAPAB_EVENT 7
537 #define WLAN_EXT_CAPAB_DIAGNOSTICS 8
538 #define WLAN_EXT_CAPAB_MULTICAST_DIAGNOSTICS 9
539 #define WLAN_EXT_CAPAB_LOCATION_TRACKING 10
540 #define WLAN_EXT_CAPAB_FMS 11
541 #define WLAN_EXT_CAPAB_PROXY_ARP 12
542 #define WLAN_EXT_CAPAB_COLL_INTERF_REP 13
543 #define WLAN_EXT_CAPAB_CIVIC_LOCATION 14
544 #define WLAN_EXT_CAPAB_GEOSPATIAL_LOCATION 15
545 #define WLAN_EXT_CAPAB_TFS 16
546 #define WLAN_EXT_CAPAB_WNM_SLEEP_MODE 17
547 #define WLAN_EXT_CAPAB_TIM_BROADCAST 18
548 #define WLAN_EXT_CAPAB_BSS_TRANSITION 19
549 #define WLAN_EXT_CAPAB_QOS_TRAFFIC 20
550 #define WLAN_EXT_CAPAB_AC_STA_COUNT 21
551 #define WLAN_EXT_CAPAB_MULTIPLE_BSSID 22
552 #define WLAN_EXT_CAPAB_TIMING_MEASUREMENT 23
553 #define WLAN_EXT_CAPAB_CHANNEL_USAGE 24
554 #define WLAN_EXT_CAPAB_SSID_LIST 25
555 #define WLAN_EXT_CAPAB_DMS 26
556 #define WLAN_EXT_CAPAB_UTF_TSF_OFFSET 27
557 #define WLAN_EXT_CAPAB_TPU_BUFFER_STA 28
558 #define WLAN_EXT_CAPAB_TDLS_PEER_PSM 29
559 #define WLAN_EXT_CAPAB_TDLS_CHANNEL_SWITCH 30
560 #define WLAN_EXT_CAPAB_INTERWORKING 31
561 #define WLAN_EXT_CAPAB_QOS_MAP 32
562 #define WLAN_EXT_CAPAB_EBR 33
563 #define WLAN_EXT_CAPAB_SSPN_INTERFACE 34
564 /* 35 - Reserved */
565 #define WLAN_EXT_CAPAB_MSGCF 36
566 #define WLAN_EXT_CAPAB_TDLS 37
567 #define WLAN_EXT_CAPAB_TDLS_PROHIBITED 38
568 #define WLAN_EXT_CAPAB_TDLS_CHANNEL_SWITCH_PROHIBITED 39
569 #define WLAN_EXT_CAPAB_REJECT_UNADMITTED_FRAME 40
570 /* 41-43 - Service Interval Granularity */
571 #define WLAN_EXT_CAPAB_IDENTIFIER_LOCATION 44
572 #define WLAN_EXT_CAPAB_U_APSD_COEX 45
573 #define WLAN_EXT_CAPAB_WNM_NOTIFCATION 46
574 #define WLAN_EXT_CAPAB_QAB 47
575 #define WLAN_EXT_CAPAB_UTF_8_SSID 48
576 #define WLAN_EXT_CAPAB_QMF 49
577 #define WLAN_EXT_CAPAB_QMF_RECONFIG 50
578 #define WLAN_EXT_CAPAB_ROBUST_AV_STREAMING 51
579 #define WLAN_EXT_CAPAB_ADVANCED_GCR 52
580 #define WLAN_EXT_CAPAB_MESH_GCR 53
581 #define WLAN_EXT_CAPAB_SCS 54
582 #define WLAN_EXT_CAPAB_QLOAD_REPORT 55
583 #define WLAN_EXT_CAPAB_ALT_EDCA 56
584 #define WLAN_EXT_CAPAB_UNPROT_TXOP_NEG 57
585 #define WLAN_EXT_CAPAB_PROT_TXOP_NEG 58
586 /* 59 - Reserved */
587 #define WLAN_EXT_CAPAB_PROT_QLOAD_REPORT 60
588 #define WLAN_EXT_CAPAB_TDLS_WIDER_BW 61
589 #define WLAN_EXT_CAPAB_OPMODE_NOTIF 62
590 /* 63-64 - Max Number of MSDUs In A-MSDU */
591 #define WLAN_EXT_CAPAB_CHANNEL_SCHEDULE_MGMT 65
592 #define WLAN_EXT_CAPAB_GEODB_INBAND_ENABLING_SIGNAL 66
593 #define WLAN_EXT_CAPAB_NETWORK_CHANNEL_CTRL 67
594 #define WLAN_EXT_CAPAB_WHITE_SPACE_MAP 68
595 #define WLAN_EXT_CAPAB_CHANNEL_AVAIL_QUERY 69
596 #define WLAN_EXT_CAPAB_FTM_RESPONDER 70
597 #define WLAN_EXT_CAPAB_FTM_INITIATOR 71
598 #define WLAN_EXT_CAPAB_FILS 72
599 #define WLAN_EXT_CAPAB_EXT_SPECTRUM_MGMT 73
600 #define WLAN_EXT_CAPAB_FUTURE_CHANNEL_GUIDANCE 74
601 #define WLAN_EXT_CAPAB_PAD 75
602 /* 76-79 - Reserved */
603 #define WLAN_EXT_CAPAB_COMPLETE_NON_TX_BSSID_PROFILE 80
604 #define WLAN_EXT_CAPAB_SAE_PW_ID 81
605 #define WLAN_EXT_CAPAB_SAE_PW_ID_EXCLUSIVELY 82
606 #define WLAN_EXT_CAPAB_BEACON_PROTECTION 84
607 #define WLAN_EXT_CAPAB_MSCS 85
608 #define WLAN_EXT_CAPAB_SAE_PK_EXCLUSIVELY 88
609 
610 /* Extended RSN Capabilities */
611 /* bits 0-3: Field length (n-1) */
612 #define WLAN_RSNX_CAPAB_PROTECTED_TWT 4
613 #define WLAN_RSNX_CAPAB_SAE_H2E 5
614 #define WLAN_RSNX_CAPAB_SAE_PK 6
615 #define WLAN_RSNX_CAPAB_SECURE_LTF 8
616 #define WLAN_RSNX_CAPAB_SECURE_RTT 9
617 #define WLAN_RSNX_CAPAB_URNM_MFPR_X20 10
618 #define WLAN_RSNX_CAPAB_URNM_MFPR 15
619 #define WLAN_RSNX_CAPAB_SSID_PROTECTION 21
620 
621 /* Multiple BSSID element subelements */
622 #define WLAN_MBSSID_SUBELEMENT_NONTRANSMITTED_BSSID_PROFILE 0
623 
624 /* Action frame categories (IEEE Std 802.11-2020, 9.4.1.11, Table 9-51) */
625 #define WLAN_ACTION_SPECTRUM_MGMT 0
626 #define WLAN_ACTION_QOS 1
627 #define WLAN_ACTION_DLS 2
628 #define WLAN_ACTION_BLOCK_ACK 3
629 #define WLAN_ACTION_PUBLIC 4
630 #define WLAN_ACTION_RADIO_MEASUREMENT 5
631 #define WLAN_ACTION_FT 6
632 #define WLAN_ACTION_HT 7
633 #define WLAN_ACTION_SA_QUERY 8
634 #define WLAN_ACTION_PROTECTED_DUAL 9
635 #define WLAN_ACTION_WNM 10
636 #define WLAN_ACTION_UNPROTECTED_WNM 11
637 #define WLAN_ACTION_TDLS 12
638 #define WLAN_ACTION_MESH 13
639 #define WLAN_ACTION_MULTIHOP 14
640 #define WLAN_ACTION_SELF_PROTECTED 15
641 #define WLAN_ACTION_DMG 16
642 #define WLAN_ACTION_WMM 17 /* WMM Specification 1.1 */
643 #define WLAN_ACTION_FST 18
644 #define WLAN_ACTION_ROBUST_AV_STREAMING 19
645 #define WLAN_ACTION_UNPROTECTED_DMG 20
646 #define WLAN_ACTION_VHT 21
647 #define WLAN_ACTION_UNPROTECTED_S1G 22
648 #define WLAN_ACTION_S1G 23
649 #define WLAN_ACTION_FLOW_CONTROL 24
650 #define WLAN_ACTION_CTRL_RESP_MCS_NEG 25
651 #define WLAN_ACTION_FILS 26
652 #define WLAN_ACTION_CDMG 27
653 #define WLAN_ACTION_CMMG 28
654 #define WLAN_ACTION_GLK 29
655 #define WLAN_ACTION_HE 30
656 #define WLAN_ACTION_PROTECTED_HE 31
657 #define WLAN_ACTION_WUR 32
658 #define WLAN_ACTION_PROTECTED_FTM 34
659 #define WLAN_ACTION_EHT 36
660 #define WLAN_ACTION_PROTECTED_EHT 37
661 #define WLAN_ACTION_VENDOR_SPECIFIC_PROTECTED 126
662 #define WLAN_ACTION_VENDOR_SPECIFIC 127
663 /* Note: 128-255 used to report errors by setting category | 0x80 */
664 
665 /* Public action codes (IEEE Std 802.11-2020, 9.6.7.1, Table 9-364) */
666 #define WLAN_PA_20_40_BSS_COEX 0
667 #define WLAN_PA_DSE_ENABLEMENT 1
668 #define WLAN_PA_DSE_DEENABLEMENT 2
669 #define WLAN_PA_DSE_REG_LOCATION_ANNOUNCE 3
670 #define WLAN_PA_EXT_CHANNEL_SWITCH_ANNOUNCE 4
671 #define WLAN_PA_DSE_MEASUREMENT_REQ 5
672 #define WLAN_PA_DSE_MEASUREMENT_RESP 6
673 #define WLAN_PA_MEASUREMENT_PILOT 7
674 #define WLAN_PA_DSE_POWER_CONSTRAINT 8
675 #define WLAN_PA_VENDOR_SPECIFIC 9
676 #define WLAN_PA_GAS_INITIAL_REQ 10
677 #define WLAN_PA_GAS_INITIAL_RESP 11
678 #define WLAN_PA_GAS_COMEBACK_REQ 12
679 #define WLAN_PA_GAS_COMEBACK_RESP 13
680 #define WLAN_TDLS_DISCOVERY_RESPONSE 14
681 #define WLAN_PA_LOCATION_TRACK_NOTIFICATION 15
682 #define WLAN_PA_QAB_REQUEST_FRAME 16
683 #define WLAN_PA_QAB_RESPONSE_FRAME 17
684 #define WLAN_PA_QMF_POLICY 18
685 #define WLAN_PA_QMF_POLICY_CHANGE 19
686 #define WLAN_PA_QLOAD_REQUEST 20
687 #define WLAN_PA_QLOAD_REPORT 21
688 #define WLAN_PA_HCCA_TXOP_ADVERTISEMENT 22
689 #define WLAN_PA_HCCA_TXOP_RESPONSE 23
690 #define WLAN_PA_PUBLIC_KEY 24
691 #define WLAN_PA_CHANNEL_AVAILABILITY_QUERY 25
692 #define WLAN_PA_CHANNEL_SCHEDULE_MANAGEMENT 26
693 #define WLAN_PA_CONTACT_VERIFICATION_SIGNAL 27
694 #define WLAN_PA_GDD_ENABLEMENT_REQ 28
695 #define WLAN_PA_GDD_ENABLEMENT_RESP 29
696 #define WLAN_PA_NETWORK_CHANNEL_CONTROL 30
697 #define WLAN_PA_WHITE_SPACE_MAP_ANNOUNCEMENT 31
698 #define WLAN_PA_FTM_REQUEST 32
699 #define WLAN_PA_FTM 33
700 #define WLAN_PA_FILS_DISCOVERY 34
701 #define WLAN_PA_LOCATION_MEASUREMENT_REPORT 47
702 
703 /* HT Action field values (IEEE P802.11-REVme/D4.0, 9.6.11.1, Table 9-491) */
704 #define WLAN_HT_ACTION_NOTIFY_CHANWIDTH 0
705 #define WLAN_HT_ACTION_SMPS 1
706 #define WLAN_HT_ACTION_CSI 4
707 #define WLAN_HT_ACTION_NONCOMPRESSED_BF 5
708 #define WLAN_HT_ACTION_COMPRESSED_BF 6
709 #define WLAN_HT_ACTION_ASEL_IDX_FEEDBACK 7
710 
711 /* VHT Action field values (IEEE P802.11-REVme/D4.0, 9.6.22.1, Table 9-579) */
712 #define WLAN_VHT_ACTION_COMPRESSED_BF 0
713 #define WLAN_VHT_ACTION_GROUP_ID_MGMT 1
714 #define WLAN_VHT_ACTION_OPMODE_NOTIF 2
715 
716 /* Protected Dual of Public Action frames (IEEE Std 802.11-2020, 9.6.10,
717  * Table 9-404) */
718 #define WLAN_PROT_DSE_ENABLEMENT 1
719 #define WLAN_PROT_DSE_DEENABLEMENT 2
720 #define WLAN_PROT_EXT_CSA 4
721 #define WLAN_PROT_MEASUREMENT_REQ 5
722 #define WLAN_PROT_MEASUREMENT_REPORT 6
723 #define WLAN_PROT_DSE_POWER_CONSTRAINT 8
724 #define WLAN_PROT_VENDOR_SPECIFIC 9
725 #define WLAN_PROT_GAS_INITIAL_REQ 10
726 #define WLAN_PROT_GAS_INITIAL_RESP 11
727 #define WLAN_PROT_GAS_COMEBACK_REQ 12
728 #define WLAN_PROT_GAS_COMEBACK_RESP 13
729 #define WLAN_PROT_QAB_REQUEST_FRAME 16
730 #define WLAN_PROT_QAB_RESPONSE_FRAME 17
731 #define WLAN_PROT_QMF_POLICY 18
732 #define WLAN_PROT_QMF_POLICY_CHANGE 19
733 #define WLAN_PROT_QLOAD_REQUEST 20
734 #define WLAN_PROT_QLOAD_REPORT 21
735 #define WLAN_PROT_HCCA_TXOP_ADVERTISEMENT 22
736 #define WLAN_PROT_HCCA_TXOP_RESPONSE 23
737 #define WLAN_PROT_CHANNEL_AVAILABILITY_QUERY 25
738 #define WLAN_PROT_CHANNEL_SCHEDULE_MANAGEMENT 26
739 #define WLAN_PROT_CONTACT_VERIFICATION_SIGNAL 27
740 #define WLAN_PROT_GDD_ENABLEMENT_REQ 28
741 #define WLAN_PROT_GDD_ENABLEMENT_RESP 29
742 #define WLAN_PROT_NETWORK_CHANNEL_CONTROL 30
743 #define WLAN_PROT_WHITE_SPACE_MAP_ANNOUNCEMENT 31
744 
745 /* SA Query Action frame (IEEE Std 802.11-2020, 9.6.9) */
746 #define WLAN_SA_QUERY_REQUEST 0
747 #define WLAN_SA_QUERY_RESPONSE 1
748 
749 #define WLAN_SA_QUERY_TR_ID_LEN 2
750 
751 /* TDLS action codes */
752 #define WLAN_TDLS_SETUP_REQUEST 0
753 #define WLAN_TDLS_SETUP_RESPONSE 1
754 #define WLAN_TDLS_SETUP_CONFIRM 2
755 #define WLAN_TDLS_TEARDOWN 3
756 #define WLAN_TDLS_PEER_TRAFFIC_INDICATION 4
757 #define WLAN_TDLS_CHANNEL_SWITCH_REQUEST 5
758 #define WLAN_TDLS_CHANNEL_SWITCH_RESPONSE 6
759 #define WLAN_TDLS_PEER_PSM_REQUEST 7
760 #define WLAN_TDLS_PEER_PSM_RESPONSE 8
761 #define WLAN_TDLS_PEER_TRAFFIC_RESPONSE 9
762 #define WLAN_TDLS_DISCOVERY_REQUEST 10
763 
764 /* Radio Measurement Action codes */
765 #define WLAN_RRM_RADIO_MEASUREMENT_REQUEST 0
766 #define WLAN_RRM_RADIO_MEASUREMENT_REPORT 1
767 #define WLAN_RRM_LINK_MEASUREMENT_REQUEST 2
768 #define WLAN_RRM_LINK_MEASUREMENT_REPORT 3
769 #define WLAN_RRM_NEIGHBOR_REPORT_REQUEST 4
770 #define WLAN_RRM_NEIGHBOR_REPORT_RESPONSE 5
771 
772 /* Protected Fine Timing Frame Action Field value */
773 #define WLAN_PROT_FTM_REQUEST 1
774 #define WLAN_PROT_FTM 2
775 #define WLAN_PROT_FTM_REPORT 3
776 
777 /* Radio Measurement capabilities (from RM Enabled Capabilities element)
778  * IEEE Std 802.11-2020, 9.4.2.44, Table 9-179 */
779 /* byte 1 (out of 5) */
780 #define WLAN_RRM_CAPS_LINK_MEASUREMENT BIT(0)
781 #define WLAN_RRM_CAPS_NEIGHBOR_REPORT BIT(1)
782 #define WLAN_RRM_CAPS_BEACON_REPORT_PASSIVE BIT(4)
783 #define WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE BIT(5)
784 #define WLAN_RRM_CAPS_BEACON_REPORT_TABLE BIT(6)
785 /* byte 2 (out of 5) */
786 #define WLAN_RRM_CAPS_LCI_MEASUREMENT BIT(4)
787 /* byte 5 (out of 5) */
788 #define WLAN_RRM_CAPS_FTM_RANGE_REPORT BIT(2)
789 
790 /*
791  * IEEE Std 802.11-2020, 9.4.2.20.19 (Fine Timing Measurement Range
792  * request) - Minimum AP Count
793  */
794 #define WLAN_RRM_RANGE_REQ_MAX_MIN_AP 15
795 
796 /* Timeout Interval Type */
797 #define WLAN_TIMEOUT_REASSOC_DEADLINE 1
798 #define WLAN_TIMEOUT_KEY_LIFETIME 2
799 #define WLAN_TIMEOUT_ASSOC_COMEBACK 3
800 
801 /* Interworking element (IEEE Std 802.11-2020, 9.4.2.91) -
802  * Access Network Options */
803 #define INTERWORKING_ANO_ACCESS_NETWORK_MASK 0x0f
804 #define INTERWORKING_ANO_INTERNET 0x10
805 #define INTERWORKING_ANO_ASRA 0x20
806 #define INTERWORKING_ANO_ESR 0x40
807 #define INTERWORKING_ANO_UESA 0x80
808 
809 #define INTERWORKING_ANT_PRIVATE 0
810 #define INTERWORKING_ANT_PRIVATE_WITH_GUEST 1
811 #define INTERWORKING_ANT_CHARGEABLE_PUBLIC 2
812 #define INTERWORKING_ANT_FREE_PUBLIC 3
813 #define INTERWORKING_ANT_PERSONAL_DEVICE 4
814 #define INTERWORKING_ANT_EMERGENCY_SERVICES 5
815 #define INTERWORKING_ANT_TEST 6
816 #define INTERWORKING_ANT_WILDCARD 15
817 
818 /* Advertisement Protocol ID definitions (IEEE Std 802.11-2020, Table 9-237) */
819 enum adv_proto_id {
820 	ACCESS_NETWORK_QUERY_PROTOCOL = 0,
821 	MIH_INFO_SERVICE = 1,
822 	MIH_CMD_AND_EVENT_DISCOVERY = 2,
823 	EMERGENCY_ALERT_SYSTEM = 3,
824 	REGISTERED_LOCATION_QUERY_PROTO = 4,
825 	ADV_PROTO_VENDOR_SPECIFIC = 221
826 };
827 
828 /* ANQP-element definitions (IEEE Std 802.11-2020, Table 9-331) */
829 enum anqp_info_id {
830 	ANQP_QUERY_LIST = 256,
831 	ANQP_CAPABILITY_LIST = 257,
832 	ANQP_VENUE_NAME = 258,
833 	ANQP_EMERGENCY_CALL_NUMBER = 259,
834 	ANQP_NETWORK_AUTH_TYPE = 260,
835 	ANQP_ROAMING_CONSORTIUM = 261,
836 	ANQP_IP_ADDR_TYPE_AVAILABILITY = 262,
837 	ANQP_NAI_REALM = 263,
838 	ANQP_3GPP_CELLULAR_NETWORK = 264,
839 	ANQP_AP_GEOSPATIAL_LOCATION = 265,
840 	ANQP_AP_CIVIC_LOCATION = 266,
841 	ANQP_AP_LOCATION_PUBLIC_URI = 267,
842 	ANQP_DOMAIN_NAME = 268,
843 	ANQP_EMERGENCY_ALERT_URI = 269,
844 	ANQP_TDLS_CAPABILITY = 270,
845 	ANQP_EMERGENCY_NAI = 271,
846 	ANQP_NEIGHBOR_REPORT = 272,
847 	ANQP_QUERY_AP_LIST = 273,
848 	ANQP_AP_LIST_RESPONSE = 274,
849 	ANQP_FILS_REALM_INFO = 275,
850 	ANQP_CAG = 276,
851 	ANQP_VENUE_URL = 277,
852 	ANQP_ADVICE_OF_CHARGE = 278,
853 	ANQP_LOCAL_CONTENT = 279,
854 	ANQP_NETWORK_AUTH_TYPE_TIMESTAMP = 280,
855 	ANQP_VENDOR_SPECIFIC = 56797
856 };
857 
858 /* NAI Realm list - EAP Method subfield - Authentication Parameter ID */
859 enum nai_realm_eap_auth_param {
860 	NAI_REALM_EAP_AUTH_EXPANDED_EAP_METHOD = 1,
861 	NAI_REALM_EAP_AUTH_NON_EAP_INNER_AUTH = 2,
862 	NAI_REALM_EAP_AUTH_INNER_AUTH_EAP_METHOD = 3,
863 	NAI_REALM_EAP_AUTH_EXPANDED_INNER_EAP_METHOD = 4,
864 	NAI_REALM_EAP_AUTH_CRED_TYPE = 5,
865 	NAI_REALM_EAP_AUTH_TUNNELED_CRED_TYPE = 6,
866 	NAI_REALM_EAP_AUTH_VENDOR_SPECIFIC = 221
867 };
868 
869 enum nai_realm_eap_auth_inner_non_eap {
870 	NAI_REALM_INNER_NON_EAP_PAP = 1,
871 	NAI_REALM_INNER_NON_EAP_CHAP = 2,
872 	NAI_REALM_INNER_NON_EAP_MSCHAP = 3,
873 	NAI_REALM_INNER_NON_EAP_MSCHAPV2 = 4
874 };
875 
876 enum nai_realm_eap_cred_type {
877 	NAI_REALM_CRED_TYPE_SIM = 1,
878 	NAI_REALM_CRED_TYPE_USIM = 2,
879 	NAI_REALM_CRED_TYPE_NFC_SECURE_ELEMENT = 3,
880 	NAI_REALM_CRED_TYPE_HARDWARE_TOKEN = 4,
881 	NAI_REALM_CRED_TYPE_SOFTOKEN = 5,
882 	NAI_REALM_CRED_TYPE_CERTIFICATE = 6,
883 	NAI_REALM_CRED_TYPE_USERNAME_PASSWORD = 7,
884 	NAI_REALM_CRED_TYPE_NONE = 8,
885 	NAI_REALM_CRED_TYPE_ANONYMOUS = 9,
886 	NAI_REALM_CRED_TYPE_VENDOR_SPECIFIC = 10
887 };
888 
889 /* Unprotected S1G Action field values for WLAN_ACTION_S1G */
890 #define S1G_ACT_AID_SWITCH_REQUEST   0
891 #define S1G_ACT_AID_SWITCH_RESPONSE  1
892 #define S1G_ACT_SYNC_CONTROL         2
893 #define S1G_ACT_STA_INFO_ANNOUNCE    3
894 #define S1G_ACT_EDCA_PARAM_SET       4
895 #define S1G_ACT_EL_OPERATION         5
896 #define S1G_ACT_TWT_SETUP            6
897 #define S1G_ACT_TWT_TEARDOWN         7
898 #define S1G_ACT_SECT_GROUP_ID_LIST   8
899 #define S1G_ACT_SECT_ID_FEEDBACK     9
900 #define S1G_ACT_TWT_INFORMATION      11
901 
902 /*
903  * IEEE Std 802.11-2020, Table 9-98 - Measurement type definitions for
904  * measurement requests
905  */
906 enum measure_type {
907 	MEASURE_TYPE_BASIC = 0,
908 	MEASURE_TYPE_CCA = 1,
909 	MEASURE_TYPE_RPI_HIST = 2,
910 	MEASURE_TYPE_CHANNEL_LOAD = 3,
911 	MEASURE_TYPE_NOISE_HIST = 4,
912 	MEASURE_TYPE_BEACON = 5,
913 	MEASURE_TYPE_FRAME = 6,
914 	MEASURE_TYPE_STA_STATISTICS = 7,
915 	MEASURE_TYPE_LCI = 8,
916 	MEASURE_TYPE_TRANSMIT_STREAM = 9,
917 	MEASURE_TYPE_MULTICAST_DIAG = 10,
918 	MEASURE_TYPE_LOCATION_CIVIC = 11,
919 	MEASURE_TYPE_LOCATION_ID = 12,
920 	MEASURE_TYPE_DIRECTIONAL_CHAN_QUALITY = 13,
921 	MEASURE_TYPE_DIRECTIONAL_MEASURE = 14,
922 	MEASURE_TYPE_DIRECTIONAL_STATS = 15,
923 	MEASURE_TYPE_FTM_RANGE = 16,
924 	MEASURE_TYPE_MEASURE_PAUSE = 255,
925 };
926 
927 /* IEEE Std 802.11-2020, Table 9-110 - Location Subject field definition */
928 enum location_subject {
929 	LOCATION_SUBJECT_LOCAL = 0,
930 	LOCATION_SUBJECT_REMOTE = 1,
931 	LOCATION_SUBJECT_3RD_PARTY = 2,
932 };
933 
934 /*
935  * IEEE Std 802.11-2020, Table 9-111 - Optional subelement IDs for LCI request
936  */
937 enum lci_req_subelem {
938 	LCI_REQ_SUBELEM_AZIMUTH_REQ = 1,
939 	LCI_REQ_SUBELEM_ORIGINATOR_MAC_ADDR = 2,
940 	LCI_REQ_SUBELEM_TARGET_MAC_ADDR = 3,
941 	LCI_REQ_SUBELEM_MAX_AGE = 4,
942 };
943 
944 #define FILS_NONCE_LEN 16
945 #define FILS_SESSION_LEN 8
946 #define FILS_CACHE_ID_LEN 2
947 #define FILS_MAX_KEY_AUTH_LEN 48
948 
949 #ifdef _MSC_VER
950 #pragma pack(push, 1)
951 #endif /* _MSC_VER */
952 
953 struct ieee80211_hdr {
954 	le16 frame_control;
955 	le16 duration_id;
956 	u8 addr1[6];
957 	u8 addr2[6];
958 	u8 addr3[6];
959 	le16 seq_ctrl;
960 	/* followed by 'u8 addr4[6];' if ToDS and FromDS is set in data frame
961 	 */
962 } STRUCT_PACKED;
963 
964 #define IEEE80211_DA_FROMDS addr1
965 #define IEEE80211_BSSID_FROMDS addr2
966 #define IEEE80211_SA_FROMDS addr3
967 
968 #define IEEE80211_HDRLEN (sizeof(struct ieee80211_hdr))
969 
970 struct ieee80211_hdr_s1g_beacon {
971 	le16 frame_control;
972 	le16 duration_id;
973 	u8 sa[6];
974 	u8 timestamp[4];
975 	u8 change_seq[1];
976 	/* followed by:
977 	 *   'u8 next_tbtt[3];' if the Next TBTT Present field in the
978 	 *			Frame Control field is 1
979 	 *   'u8 compressed_ssid[4];' if the Compressed SSID Present field in
980 	 *			the Frame Control is 1
981 	 *   'u8 ano[1];' if the ANO field in the Frame Control field is 1
982 	 */
983 } STRUCT_PACKED;
984 
985 #define IEEE80211_HDRLEN_S1G_BEACON (sizeof(struct ieee80211_hdr_s1g_beacon))
986 
987 #define IEEE80211_FC(type, stype) host_to_le16((type << 2) | (stype << 4))
988 
989 struct ieee80211_mgmt {
990 	le16 frame_control;
991 	le16 duration;
992 	u8 da[6];
993 	u8 sa[6];
994 	u8 bssid[6];
995 	le16 seq_ctrl;
996 	union {
997 		struct {
998 			le16 auth_alg;
999 			le16 auth_transaction;
1000 			le16 status_code;
1001 			/* possibly followed by Challenge text */
1002 			u8 variable[];
1003 		} STRUCT_PACKED auth;
1004 		struct {
1005 			le16 reason_code;
1006 			u8 variable[];
1007 		} STRUCT_PACKED deauth;
1008 		struct {
1009 			le16 capab_info;
1010 			le16 listen_interval;
1011 			/* followed by SSID and Supported rates */
1012 			u8 variable[];
1013 		} STRUCT_PACKED assoc_req;
1014 		struct {
1015 			le16 capab_info;
1016 			le16 status_code;
1017 			le16 aid;
1018 			/* followed by Supported rates */
1019 			u8 variable[];
1020 		} STRUCT_PACKED assoc_resp, reassoc_resp;
1021 		struct {
1022 			le16 capab_info;
1023 			le16 listen_interval;
1024 			u8 current_ap[6];
1025 			/* followed by SSID and Supported rates */
1026 			u8 variable[];
1027 		} STRUCT_PACKED reassoc_req;
1028 		struct {
1029 			le16 reason_code;
1030 			u8 variable[];
1031 		} STRUCT_PACKED disassoc;
1032 		struct {
1033 			u8 timestamp[8];
1034 			le16 beacon_int;
1035 			le16 capab_info;
1036 			/* followed by some of SSID, Supported rates,
1037 			 * FH Params, DS Params, CF Params, IBSS Params, TIM */
1038 			u8 variable[];
1039 		} STRUCT_PACKED beacon;
1040 		/* probe_req: only variable items: SSID, Supported rates */
1041 		struct {
1042 			u8 timestamp[8];
1043 			le16 beacon_int;
1044 			le16 capab_info;
1045 			/* followed by some of SSID, Supported rates,
1046 			 * FH Params, DS Params, CF Params, IBSS Params */
1047 			u8 variable[];
1048 		} STRUCT_PACKED probe_resp;
1049 		struct {
1050 			u8 category;
1051 			union {
1052 				struct {
1053 					u8 action_code;
1054 					u8 dialog_token;
1055 					u8 status_code;
1056 					u8 variable[];
1057 				} STRUCT_PACKED wmm_action;
1058 				struct{
1059 					u8 action_code;
1060 					u8 element_id;
1061 					u8 length;
1062 					u8 switch_mode;
1063 					u8 new_chan;
1064 					u8 switch_count;
1065 				} STRUCT_PACKED chan_switch;
1066 				struct {
1067 					u8 action;
1068 					u8 sta_addr[ETH_ALEN];
1069 					u8 target_ap_addr[ETH_ALEN];
1070 					u8 variable[]; /* FT Request */
1071 				} STRUCT_PACKED ft_action_req;
1072 				struct {
1073 					u8 action;
1074 					u8 sta_addr[ETH_ALEN];
1075 					u8 target_ap_addr[ETH_ALEN];
1076 					le16 status_code;
1077 					u8 variable[]; /* FT Request */
1078 				} STRUCT_PACKED ft_action_resp;
1079 				struct {
1080 					u8 action;
1081 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
1082 					u8 variable[]; /* OCI element */
1083 				} STRUCT_PACKED sa_query_req;
1084 				struct {
1085 					u8 action; /* */
1086 					u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
1087 					u8 variable[]; /* OCI element */
1088 				} STRUCT_PACKED sa_query_resp;
1089 				struct {
1090 					u8 action;
1091 					u8 dialogtoken;
1092 					u8 variable[];
1093 				} STRUCT_PACKED wnm_sleep_req;
1094 				struct {
1095 					u8 action;
1096 					u8 dialogtoken;
1097 					le16 keydata_len;
1098 					u8 variable[];
1099 				} STRUCT_PACKED wnm_sleep_resp;
1100 				struct {
1101 					u8 action;
1102 					u8 variable[];
1103 				} STRUCT_PACKED public_action;
1104 				struct {
1105 					u8 action; /* 9 */
1106 					u8 oui[3];
1107 					/* Vendor-specific content */
1108 					u8 variable[];
1109 				} STRUCT_PACKED vs_public_action;
1110 				struct {
1111 					u8 action; /* 7 */
1112 					u8 dialog_token;
1113 					u8 req_mode;
1114 					le16 disassoc_timer;
1115 					u8 validity_interval;
1116 					/* BSS Termination Duration (optional),
1117 					 * Session Information URL (optional),
1118 					 * BSS Transition Candidate List
1119 					 * Entries */
1120 					u8 variable[];
1121 				} STRUCT_PACKED bss_tm_req;
1122 				struct {
1123 					u8 action; /* 8 */
1124 					u8 dialog_token;
1125 					u8 status_code;
1126 					u8 bss_termination_delay;
1127 					/* Target BSSID (optional),
1128 					 * BSS Transition Candidate List
1129 					 * Entries (optional) */
1130 					u8 variable[];
1131 				} STRUCT_PACKED bss_tm_resp;
1132 				struct {
1133 					u8 action; /* 6 */
1134 					u8 dialog_token;
1135 					u8 query_reason;
1136 					/* BSS Transition Candidate List
1137 					 * Entries (optional) */
1138 					u8 variable[];
1139 				} STRUCT_PACKED bss_tm_query;
1140 				struct {
1141 					u8 action; /* 11 */
1142 					u8 dialog_token;
1143 					u8 req_info;
1144 				} STRUCT_PACKED coloc_intf_req;
1145 				struct {
1146 					u8 action; /* 12 */
1147 					u8 dialog_token;
1148 					u8 variable[];
1149 				} STRUCT_PACKED coloc_intf_report;
1150 				struct {
1151 					u8 action; /* 15 */
1152 					u8 variable[];
1153 				} STRUCT_PACKED slf_prot_action;
1154 				struct {
1155 					u8 action;
1156 					u8 variable[];
1157 				} STRUCT_PACKED fst_action;
1158 				struct {
1159 					u8 action;
1160 					u8 dialog_token;
1161 					u8 variable[];
1162 				} STRUCT_PACKED rrm;
1163 			} u;
1164 		} STRUCT_PACKED action;
1165 	} u;
1166 } STRUCT_PACKED;
1167 
1168 
1169 #define IEEE80211_MAX_MMPDU_SIZE 2304
1170 
1171 /* Rx MCS bitmask is in the first 77 bits of supported_mcs_set */
1172 #define IEEE80211_HT_MCS_MASK_LEN 10
1173 
1174 /* HT Capabilities element */
1175 struct ieee80211_ht_capabilities {
1176 	le16 ht_capabilities_info;
1177 	u8 a_mpdu_params; /* Maximum A-MPDU Length Exponent B0..B1
1178 			   * Minimum MPDU Start Spacing B2..B4
1179 			   * Reserved B5..B7 */
1180 	u8 supported_mcs_set[16];
1181 	le16 ht_extended_capabilities;
1182 	le32 tx_bf_capability_info;
1183 	u8 asel_capabilities;
1184 } STRUCT_PACKED;
1185 
1186 
1187 /* HT Operation element */
1188 struct ieee80211_ht_operation {
1189 	u8 primary_chan;
1190 	/* Five octets of HT Operation Information */
1191 	u8 ht_param; /* B0..B7 */
1192 	le16 operation_mode; /* B8..B23 */
1193 	le16 param; /* B24..B39 */
1194 	u8 basic_mcs_set[16];
1195 } STRUCT_PACKED;
1196 
1197 
1198 struct ieee80211_obss_scan_parameters {
1199 	le16 scan_passive_dwell;
1200 	le16 scan_active_dwell;
1201 	le16 width_trigger_scan_interval;
1202 	le16 scan_passive_total_per_channel;
1203 	le16 scan_active_total_per_channel;
1204 	le16 channel_transition_delay_factor;
1205 	le16 scan_activity_threshold;
1206 } STRUCT_PACKED;
1207 
1208 
1209 struct ieee80211_vht_capabilities {
1210 	le32 vht_capabilities_info;
1211 	struct {
1212 		le16 rx_map;
1213 		le16 rx_highest;
1214 		le16 tx_map;
1215 		le16 tx_highest;
1216 	} vht_supported_mcs_set;
1217 } STRUCT_PACKED;
1218 
1219 struct ieee80211_vht_operation {
1220 	u8 vht_op_info_chwidth;
1221 	u8 vht_op_info_chan_center_freq_seg0_idx;
1222 	u8 vht_op_info_chan_center_freq_seg1_idx;
1223 	le16 vht_basic_mcs_set;
1224 } STRUCT_PACKED;
1225 
1226 struct ieee80211_ampe_ie {
1227 	u8 selected_pairwise_suite[4];
1228 	u8 local_nonce[32];
1229 	u8 peer_nonce[32];
1230 	/* Followed by
1231 	 * Key Replay Counter[8] (optional)
1232 	 *	(only in Mesh Group Key Inform/Acknowledge frames)
1233 	 * GTKdata[variable] (optional)
1234 	 *	(MGTK[variable] || Key RSC[8] || GTKExpirationTime[4])
1235 	 * IGTKdata[variable] (optional)
1236 	 *	(Key ID[2], IPN[6], IGTK[variable] in IGTK KDE format)
1237 	 */
1238 } STRUCT_PACKED;
1239 
1240 
1241 #define ERP_INFO_NON_ERP_PRESENT BIT(0)
1242 #define ERP_INFO_USE_PROTECTION BIT(1)
1243 #define ERP_INFO_BARKER_PREAMBLE_MODE BIT(2)
1244 
1245 #define OVERLAPPING_BSS_TRANS_DELAY_FACTOR 5
1246 
1247 /* HT Capabilities Info field within HT Capabilities element */
1248 #define HT_CAP_INFO_LDPC_CODING_CAP		((u16) BIT(0))
1249 #define HT_CAP_INFO_SUPP_CHANNEL_WIDTH_SET	((u16) BIT(1))
1250 #define HT_CAP_INFO_SMPS_MASK			((u16) (BIT(2) | BIT(3)))
1251 #define HT_CAP_INFO_SMPS_STATIC			((u16) 0)
1252 #define HT_CAP_INFO_SMPS_DYNAMIC		((u16) BIT(2))
1253 #define HT_CAP_INFO_SMPS_DISABLED		((u16) (BIT(2) | BIT(3)))
1254 #define HT_CAP_INFO_GREEN_FIELD			((u16) BIT(4))
1255 #define HT_CAP_INFO_SHORT_GI20MHZ		((u16) BIT(5))
1256 #define HT_CAP_INFO_SHORT_GI40MHZ		((u16) BIT(6))
1257 #define HT_CAP_INFO_TX_STBC			((u16) BIT(7))
1258 #define HT_CAP_INFO_RX_STBC_MASK		((u16) (BIT(8) | BIT(9)))
1259 #define HT_CAP_INFO_RX_STBC_1			((u16) BIT(8))
1260 #define HT_CAP_INFO_RX_STBC_12			((u16) BIT(9))
1261 #define HT_CAP_INFO_RX_STBC_123			((u16) (BIT(8) | BIT(9)))
1262 #define HT_CAP_INFO_DELAYED_BA			((u16) BIT(10))
1263 #define HT_CAP_INFO_MAX_AMSDU_SIZE		((u16) BIT(11))
1264 #define HT_CAP_INFO_DSSS_CCK40MHZ		((u16) BIT(12))
1265 /* B13 - Reserved (was PSMP support during P802.11n development) */
1266 #define HT_CAP_INFO_40MHZ_INTOLERANT		((u16) BIT(14))
1267 #define HT_CAP_INFO_LSIG_TXOP_PROTECT_SUPPORT	((u16) BIT(15))
1268 
1269 /* HT Extended Capabilities field within HT Capabilities element */
1270 #define EXT_HT_CAP_INFO_PCO			((u16) BIT(0))
1271 #define EXT_HT_CAP_INFO_PCO_TRANS_TIME_MASK	((u16) (BIT(1) | BIT(2)))
1272 #define EXT_HT_CAP_INFO_TRANS_TIME_OFFSET	1
1273 /* B3..B7 - Reserved */
1274 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_MASK	((u16) (BIT(8) | BIT(9)))
1275 #define EXT_HT_CAP_INFO_MCS_FEEDBACK_OFFSET	8
1276 #define EXT_HT_CAP_INFO_HTC_SUPPORT		((u16) BIT(10))
1277 #define EXT_HT_CAP_INFO_RD_RESPONDER		((u16) BIT(11))
1278 /* B12..B15 - Reserved */
1279 
1280 /* Transmit Beanforming Capabilities within HT Capabilities element */
1281 #define TX_BF_CAP_IMPLICIT_TXBF_RX_CAP ((u32) BIT(0))
1282 #define TX_BF_CAP_RX_STAGGERED_SOUNDING_CAP ((u32) BIT(1))
1283 #define TX_BF_CAP_TX_STAGGERED_SOUNDING_CAP ((u32) BIT(2))
1284 #define TX_BF_CAP_RX_NDP_CAP ((u32) BIT(3))
1285 #define TX_BF_CAP_TX_NDP_CAP ((u32) BIT(4))
1286 #define TX_BF_CAP_IMPLICIT_TX_BF_CAP ((u32) BIT(5))
1287 #define TX_BF_CAP_CALIBRATION_MASK ((u32) (BIT(6) | BIT(7))
1288 #define TX_BF_CAP_CALIB_OFFSET 6
1289 #define TX_BF_CAP_EXPLICIT_CSI_TXBF_CAP ((u32) BIT(8))
1290 #define TX_BF_CAP_EXPLICIT_NONCOMPR_STEERING_CAP ((u32) BIT(9))
1291 #define TX_BF_CAP_EXPLICIT_COMPR_STEERING_CAP ((u32) BIT(10))
1292 #define TX_BF_CAP_EXPLICIT_TX_BF_CSI_FEEDBACK_MASK ((u32) (BIT(10) | BIT(11)))
1293 #define TX_BF_CAP_EXPLICIT_BF_CSI_FEEDBACK_OFFSET 11
1294 #define TX_BF_CAP_EXPLICIT_UNCOMPR_STEERING_MATRIX_FEEDBACK_OFFSET 13
1295 #define TX_BF_CAP_EXPLICIT_COMPRESSED_STEERING_MATRIX_FEEDBACK_OFFSET 15
1296 #define TX_BF_CAP_MINIMAL_GROUPING_OFFSET 17
1297 #define TX_BF_CAP_CSI_NUM_BEAMFORMER_ANT_OFFSET 19
1298 #define TX_BF_CAP_UNCOMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 21
1299 #define TX_BF_CAP_COMPRESSED_STEERING_MATRIX_BEAMFORMER_ANT_OFFSET 23
1300 #define TX_BF_CAP_SCI_MAX_OF_ROWS_BEANFORMER_SUPPORTED_OFFSET 25
1301 #define TX_BF_CAP_CHANNEL_ESTIMATION_CAP_MASK ((u32) (BIT(27) | BIT(28)))
1302 #define TX_BF_CAP_CHANNEL_ESTIMATION_CAP_OFFSET 27
1303 /* B29..B31 - Reserved */
1304 
1305 /* ASEL Capability field within HT Capabilities element */
1306 #define ASEL_CAP_ASEL_CAPABLE ((u8) BIT(0))
1307 #define ASEL_CAP_EXPLICIT_CSI_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(1))
1308 #define ASEL_CAP_ANT_INDICES_FEEDBACK_BASED_TX_AS_CAP ((u8) BIT(2))
1309 #define ASEL_CAP_EXPLICIT_CSI_FEEDBACK_CAP ((u8) BIT(3))
1310 #define ASEL_CAP_ANT_INDICES_FEEDBACK_CAP ((u8) BIT(4))
1311 #define ASEL_CAP_RX_AS_CAP ((u8) BIT(5))
1312 #define ASEL_CAP_TX_SOUNDING_PPDUS_CAP ((u8) BIT(6))
1313 /* B7 - Reserved */
1314 
1315 /* First octet of HT Operation Information within HT Operation element */
1316 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_OFF_MASK	((u8) BIT(0) | BIT(1))
1317 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_ABOVE		((u8) BIT(0))
1318 #define HT_INFO_HT_PARAM_SECONDARY_CHNL_BELOW		((u8) BIT(0) | BIT(1))
1319 #define HT_INFO_HT_PARAM_STA_CHNL_WIDTH			((u8) BIT(2))
1320 #define HT_INFO_HT_PARAM_RIFS_MODE			((u8) BIT(3))
1321 /* B4..B7 - Reserved */
1322 
1323 /* HT Protection (B8..B9 of HT Operation Information) */
1324 #define HT_PROT_NO_PROTECTION           0
1325 #define HT_PROT_NONMEMBER_PROTECTION    1
1326 #define HT_PROT_20MHZ_PROTECTION        2
1327 #define HT_PROT_NON_HT_MIXED            3
1328 /* Bits within ieee80211_ht_operation::operation_mode (BIT(0) maps to B8 in
1329  * HT Operation Information) */
1330 #define HT_OPER_OP_MODE_HT_PROT_MASK ((u16) (BIT(0) | BIT(1))) /* B8..B9 */
1331 #define HT_OPER_OP_MODE_NON_GF_HT_STAS_PRESENT	((u16) BIT(2)) /* B10 */
1332 /* BIT(3), i.e., B11 in HT Operation Information field - Reserved */
1333 #define HT_OPER_OP_MODE_OBSS_NON_HT_STAS_PRESENT	((u16) BIT(4)) /* B12 */
1334 /* BIT(5)..BIT(15), i.e., B13..B23 - Reserved */
1335 
1336 /* Last two octets of HT Operation Information (BIT(0) = B24) */
1337 /* B24..B29 - Reserved */
1338 #define HT_OPER_PARAM_DUAL_BEACON			((u16) BIT(6))
1339 #define HT_OPER_PARAM_DUAL_CTS_PROTECTION		((u16) BIT(7))
1340 #define HT_OPER_PARAM_STBC_BEACON			((u16) BIT(8))
1341 #define HT_OPER_PARAM_LSIG_TXOP_PROT_FULL_SUPP		((u16) BIT(9))
1342 #define HT_OPER_PARAM_PCO_ACTIVE			((u16) BIT(10))
1343 #define HT_OPER_PARAM_PCO_PHASE				((u16) BIT(11))
1344 /* B36..B39 - Reserved */
1345 
1346 #define BSS_MEMBERSHIP_SELECTOR_HE_PHY 122
1347 #define BSS_MEMBERSHIP_SELECTOR_SAE_H2E_ONLY 123
1348 #define BSS_MEMBERSHIP_SELECTOR_EPD 124
1349 #define BSS_MEMBERSHIP_SELECTOR_GLK 125
1350 #define BSS_MEMBERSHIP_SELECTOR_VHT_PHY 126
1351 #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
1352 
1353 /* VHT Defines */
1354 #define VHT_CAP_MAX_MPDU_LENGTH_7991                ((u32) BIT(0))
1355 #define VHT_CAP_MAX_MPDU_LENGTH_11454               ((u32) BIT(1))
1356 #define VHT_CAP_MAX_MPDU_LENGTH_MASK                ((u32) BIT(0) | BIT(1))
1357 #define VHT_CAP_MAX_MPDU_LENGTH_MASK_SHIFT          0
1358 #define VHT_CAP_SUPP_CHAN_WIDTH_160MHZ              ((u32) BIT(2))
1359 #define VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ     ((u32) BIT(3))
1360 #define VHT_CAP_SUPP_CHAN_WIDTH_MASK                ((u32) BIT(2) | BIT(3))
1361 #define VHT_CAP_SUPP_CHAN_WIDTH_MASK_SHIFT          2
1362 #define VHT_CAP_RXLDPC                              ((u32) BIT(4))
1363 #define VHT_CAP_SHORT_GI_80                         ((u32) BIT(5))
1364 #define VHT_CAP_SHORT_GI_160                        ((u32) BIT(6))
1365 #define VHT_CAP_TXSTBC                              ((u32) BIT(7))
1366 #define VHT_CAP_RXSTBC_1                            ((u32) BIT(8))
1367 #define VHT_CAP_RXSTBC_2                            ((u32) BIT(9))
1368 #define VHT_CAP_RXSTBC_3                            ((u32) BIT(8) | BIT(9))
1369 #define VHT_CAP_RXSTBC_4                            ((u32) BIT(10))
1370 #define VHT_CAP_RXSTBC_MASK                         ((u32) BIT(8) | BIT(9) | \
1371 							   BIT(10))
1372 #define VHT_CAP_RXSTBC_MASK_SHIFT                   8
1373 #define VHT_CAP_SU_BEAMFORMER_CAPABLE               ((u32) BIT(11))
1374 #define VHT_CAP_SU_BEAMFORMEE_CAPABLE               ((u32) BIT(12))
1375 #define VHT_CAP_BEAMFORMEE_STS_MAX                  ((u32) BIT(13) | \
1376 							   BIT(14) | BIT(15))
1377 #define VHT_CAP_BEAMFORMEE_STS_MAX_SHIFT            13
1378 #define VHT_CAP_BEAMFORMEE_STS_OFFSET               13
1379 #define VHT_CAP_SOUNDING_DIMENSION_MAX              ((u32) BIT(16) | \
1380 							   BIT(17) | BIT(18))
1381 #define VHT_CAP_SOUNDING_DIMENSION_MAX_SHIFT        16
1382 #define VHT_CAP_SOUNDING_DIMENSION_OFFSET           16
1383 #define VHT_CAP_MU_BEAMFORMER_CAPABLE               ((u32) BIT(19))
1384 #define VHT_CAP_MU_BEAMFORMEE_CAPABLE               ((u32) BIT(20))
1385 #define VHT_CAP_VHT_TXOP_PS                         ((u32) BIT(21))
1386 #define VHT_CAP_HTC_VHT                             ((u32) BIT(22))
1387 
1388 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_1        ((u32) BIT(23))
1389 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_2        ((u32) BIT(24))
1390 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_3        ((u32) BIT(23) | BIT(24))
1391 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_4        ((u32) BIT(25))
1392 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_5        ((u32) BIT(23) | BIT(25))
1393 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_6        ((u32) BIT(24) | BIT(25))
1394 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX      ((u32) BIT(23) | \
1395 							   BIT(24) | BIT(25))
1396 #define VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MAX_SHIFT 23
1397 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB   ((u32) BIT(27))
1398 #define VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB     ((u32) BIT(26) | BIT(27))
1399 #define VHT_CAP_RX_ANTENNA_PATTERN                  ((u32) BIT(28))
1400 #define VHT_CAP_TX_ANTENNA_PATTERN                  ((u32) BIT(29))
1401 
1402 #define VHT_OPMODE_CHANNEL_WIDTH_MASK		    ((u8) BIT(0) | BIT(1))
1403 #define VHT_OPMODE_CHANNEL_RxNSS_MASK		    ((u8) BIT(4) | BIT(5) | \
1404 						     BIT(6))
1405 #define VHT_OPMODE_NOTIF_RX_NSS_SHIFT		    4
1406 
1407 #define VHT_RX_NSS_MAX_STREAMS			    8
1408 
1409 #define VHT_OPMODE_CHANNEL_40MHZ		    ((u8) BIT(0))
1410 #define VHT_OPMODE_CHANNEL_80MHZ		    ((u8) BIT(1))
1411 #define VHT_OPMODE_CHANNEL_160MHZ		    ((u8) BIT(1) | BIT(2))
1412 
1413 /* VHT operation information - channel widths */
1414 #define CHANWIDTH_USE_HT	0
1415 #define CHANWIDTH_80MHZ		1
1416 #define CHANWIDTH_160MHZ	2
1417 #define CHANWIDTH_80P80MHZ	3
1418 
1419 #define HE_NSS_MAX_STREAMS			    8
1420 
1421 #define OUI_MICROSOFT 0x0050f2 /* Microsoft (also used in Wi-Fi specs)
1422 				* 00:50:F2 */
1423 #define WPA_IE_VENDOR_TYPE 0x0050f201
1424 #define WMM_IE_VENDOR_TYPE 0x0050f202
1425 #define WPS_IE_VENDOR_TYPE 0x0050f204
1426 #define OUI_WFA 0x506f9a
1427 #define P2P_IE_VENDOR_TYPE 0x506f9a09
1428 #define WFD_IE_VENDOR_TYPE 0x506f9a0a
1429 #define WFD_OUI_TYPE 10
1430 #define HS20_IE_VENDOR_TYPE 0x506f9a10
1431 #define OSEN_IE_VENDOR_TYPE 0x506f9a12
1432 #define NAN_IE_VENDOR_TYPE 0x506f9a13
1433 #define NAN_SDF_VENDOR_TYPE 0x506f9a13
1434 #define NAN_OUI_TYPE 0x13
1435 #define MBO_IE_VENDOR_TYPE 0x506f9a16
1436 #define NAN_NAF_VENDOR_TYPE 0x506f9a18
1437 #define MBO_OUI_TYPE 22
1438 #define OWE_IE_VENDOR_TYPE 0x506f9a1c
1439 #define OWE_OUI_TYPE 28
1440 #define MULTI_AP_OUI_TYPE 0x1B
1441 #define DPP_CC_IE_VENDOR_TYPE 0x506f9a1e
1442 #define DPP_CC_OUI_TYPE 0x1e
1443 #define SAE_PK_IE_VENDOR_TYPE 0x506f9a1f
1444 #define SAE_PK_OUI_TYPE 0x1f
1445 #define QM_IE_VENDOR_TYPE 0x506f9a22
1446 #define QM_IE_OUI_TYPE 0x22
1447 #define WFA_CAPA_IE_VENDOR_TYPE 0x506f9a23
1448 #define WFA_CAPA_OUI_TYPE 0x23
1449 
1450 #define MULTI_AP_SUB_ELEM_TYPE 0x06
1451 #define MULTI_AP_PROFILE_SUB_ELEM_TYPE 0x07
1452 #define MULTI_AP_VLAN_SUB_ELEM_TYPE 0x08
1453 
1454 #define MULTI_AP_PROFILE2_BACKHAUL_STA_DISALLOWED BIT(2)
1455 #define MULTI_AP_PROFILE1_BACKHAUL_STA_DISALLOWED BIT(3)
1456 #define MULTI_AP_TEAR_DOWN BIT(4)
1457 #define MULTI_AP_FRONTHAUL_BSS BIT(5)
1458 #define MULTI_AP_BACKHAUL_BSS BIT(6)
1459 #define MULTI_AP_BACKHAUL_STA BIT(7)
1460 
1461 #define MULTI_AP_PROFILE_1	1
1462 #define MULTI_AP_PROFILE_2	2
1463 #define MULTI_AP_PROFILE_MAX	6
1464 
1465 #define WMM_OUI_TYPE 2
1466 #define WMM_OUI_SUBTYPE_INFORMATION_ELEMENT 0
1467 #define WMM_OUI_SUBTYPE_PARAMETER_ELEMENT 1
1468 #define WMM_OUI_SUBTYPE_TSPEC_ELEMENT 2
1469 #define WMM_VERSION 1
1470 
1471 #define WMM_ACTION_CODE_ADDTS_REQ 0
1472 #define WMM_ACTION_CODE_ADDTS_RESP 1
1473 #define WMM_ACTION_CODE_DELTS 2
1474 
1475 #define WMM_ADDTS_STATUS_ADMISSION_ACCEPTED 0
1476 #define WMM_ADDTS_STATUS_INVALID_PARAMETERS 1
1477 /* 2 - Reserved */
1478 #define WMM_ADDTS_STATUS_REFUSED 3
1479 /* 4-255 - Reserved */
1480 
1481 /* WMM TSPEC Direction Field Values */
1482 #define WMM_TSPEC_DIRECTION_UPLINK 0
1483 #define WMM_TSPEC_DIRECTION_DOWNLINK 1
1484 /* 2 - Reserved */
1485 #define WMM_TSPEC_DIRECTION_BI_DIRECTIONAL 3
1486 
1487 /*
1488  * WMM Information Element (used in (Re)Association Request frames; may also be
1489  * used in Beacon frames)
1490  */
1491 struct wmm_information_element {
1492 	/* Element ID: 221 (0xdd); Length: 7 */
1493 	/* required fields for WMM version 1 */
1494 	u8 oui[3]; /* 00:50:f2 */
1495 	u8 oui_type; /* 2 */
1496 	u8 oui_subtype; /* 0 */
1497 	u8 version; /* 1 for WMM version 1.0 */
1498 	u8 qos_info; /* AP/STA specific QoS info */
1499 
1500 } STRUCT_PACKED;
1501 
1502 #define WMM_QOSINFO_AP_UAPSD 0x80
1503 
1504 #define WMM_QOSINFO_STA_AC_MASK 0x0f
1505 #define WMM_QOSINFO_STA_SP_MASK 0x03
1506 #define WMM_QOSINFO_STA_SP_SHIFT 5
1507 
1508 #define WMM_AC_AIFSN_MASK 0x0f
1509 #define WMM_AC_AIFNS_SHIFT 0
1510 #define WMM_AC_ACM 0x10
1511 #define WMM_AC_ACI_MASK 0x60
1512 #define WMM_AC_ACI_SHIFT 5
1513 
1514 #define WMM_AC_ECWMIN_MASK 0x0f
1515 #define WMM_AC_ECWMIN_SHIFT 0
1516 #define WMM_AC_ECWMAX_MASK 0xf0
1517 #define WMM_AC_ECWMAX_SHIFT 4
1518 
1519 struct wmm_ac_parameter {
1520 	u8 aci_aifsn; /* AIFSN, ACM, ACI */
1521 	u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
1522 	le16 txop_limit;
1523 }  STRUCT_PACKED;
1524 
1525 /*
1526  * WMM Parameter Element (used in Beacon, Probe Response, and (Re)Association
1527  * Response frmaes)
1528  */
1529 struct wmm_parameter_element {
1530 	/* Element ID: 221 (0xdd); Length: 24 */
1531 	/* required fields for WMM version 1 */
1532 	u8 oui[3]; /* 00:50:f2 */
1533 	u8 oui_type; /* 2 */
1534 	u8 oui_subtype; /* 1 */
1535 	u8 version; /* 1 for WMM version 1.0 */
1536 	u8 qos_info; /* AP/STA specific QoS info */
1537 	u8 reserved; /* 0 */
1538 	struct wmm_ac_parameter ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
1539 
1540 } STRUCT_PACKED;
1541 
1542 /* WMM TSPEC Element */
1543 struct wmm_tspec_element {
1544 	u8 eid; /* 221 = 0xdd */
1545 	u8 length; /* 6 + 55 = 61 */
1546 	u8 oui[3]; /* 00:50:f2 */
1547 	u8 oui_type; /* 2 */
1548 	u8 oui_subtype; /* 2 */
1549 	u8 version; /* 1 */
1550 	/* WMM TSPEC body (55 octets): */
1551 	u8 ts_info[3];
1552 	le16 nominal_msdu_size;
1553 	le16 maximum_msdu_size;
1554 	le32 minimum_service_interval;
1555 	le32 maximum_service_interval;
1556 	le32 inactivity_interval;
1557 	le32 suspension_interval;
1558 	le32 service_start_time;
1559 	le32 minimum_data_rate;
1560 	le32 mean_data_rate;
1561 	le32 peak_data_rate;
1562 	le32 maximum_burst_size;
1563 	le32 delay_bound;
1564 	le32 minimum_phy_rate;
1565 	le16 surplus_bandwidth_allowance;
1566 	le16 medium_time;
1567 } STRUCT_PACKED;
1568 
1569 
1570 /* Access Categories / ACI to AC coding */
1571 enum wmm_ac {
1572 	WMM_AC_BE = 0 /* Best Effort */,
1573 	WMM_AC_BK = 1 /* Background */,
1574 	WMM_AC_VI = 2 /* Video */,
1575 	WMM_AC_VO = 3 /* Voice */,
1576 	WMM_AC_NUM = 4
1577 };
1578 
1579 
1580 #define HS20_INDICATION_OUI_TYPE 16
1581 #define HS20_ANQP_OUI_TYPE 17
1582 #define HS20_OSEN_OUI_TYPE 18
1583 #define HS20_ROAMING_CONS_SEL_OUI_TYPE 29
1584 #define HS20_STYPE_QUERY_LIST 1
1585 #define HS20_STYPE_CAPABILITY_LIST 2
1586 #define HS20_STYPE_OPERATOR_FRIENDLY_NAME 3
1587 #define HS20_STYPE_WAN_METRICS 4
1588 #define HS20_STYPE_CONNECTION_CAPABILITY 5
1589 #define HS20_STYPE_NAI_HOME_REALM_QUERY 6
1590 #define HS20_STYPE_OPERATING_CLASS 7
1591 #define HS20_STYPE_OSU_PROVIDERS_LIST 8
1592 #define HS20_STYPE_ICON_REQUEST 10
1593 #define HS20_STYPE_ICON_BINARY_FILE 11
1594 #define HS20_STYPE_OPERATOR_ICON_METADATA 12
1595 #define HS20_STYPE_OSU_PROVIDERS_NAI_LIST 13
1596 
1597 #define HS20_DGAF_DISABLED 0x01
1598 #define HS20_PPS_MO_ID_PRESENT 0x02
1599 #define HS20_ANQP_DOMAIN_ID_PRESENT 0x04
1600 #ifndef HS20_VERSION
1601 #define HS20_VERSION 0x20 /* Release 3 */
1602 #endif /* HS20_VERSION */
1603 
1604 /* WNM-Notification WFA vendors specific subtypes */
1605 #define HS20_WNM_SUB_REM_NEEDED 0
1606 #define HS20_WNM_DEAUTH_IMMINENT_NOTICE 1
1607 #define WFA_WNM_NOTIF_SUBELEM_NON_PREF_CHAN_REPORT 2
1608 #define WFA_WNM_NOTIF_SUBELEM_CELL_DATA_CAPA 3
1609 #define HS20_WNM_T_C_ACCEPTANCE 4
1610 
1611 #define HS20_DEAUTH_REASON_CODE_BSS 0
1612 #define HS20_DEAUTH_REASON_CODE_ESS 1
1613 
1614 /* MBO v0.0_r19, 4.2: MBO Attributes */
1615 /* Table 4-5: MBO Attributes */
1616 /* OCE v0.0.10, Table 4-3: OCE Attributes */
1617 enum mbo_attr_id {
1618 	MBO_ATTR_ID_AP_CAPA_IND = 1,
1619 	MBO_ATTR_ID_NON_PREF_CHAN_REPORT = 2,
1620 	MBO_ATTR_ID_CELL_DATA_CAPA = 3,
1621 	MBO_ATTR_ID_ASSOC_DISALLOW = 4,
1622 	MBO_ATTR_ID_CELL_DATA_PREF = 5,
1623 	MBO_ATTR_ID_TRANSITION_REASON = 6,
1624 	MBO_ATTR_ID_TRANSITION_REJECT_REASON = 7,
1625 	MBO_ATTR_ID_ASSOC_RETRY_DELAY = 8,
1626 	OCE_ATTR_ID_CAPA_IND = 101,
1627 	OCE_ATTR_ID_RSSI_BASED_ASSOC_REJECT = 102,
1628 	OCE_ATTR_ID_REDUCED_WAN_METRICS = 103,
1629 	OCE_ATTR_ID_RNR_COMPLETENESS = 104,
1630 };
1631 
1632 /* MBO v0.0_r19, 4.2.1: MBO AP Capability Indication Attribute */
1633 /* Table 4-7: MBO AP Capability Indication Field Values */
1634 #define MBO_AP_CAPA_CELL_AWARE BIT(6)
1635 
1636 /* MBO v0.0_r19, 4.2.2: Non-preferred Channel Report Attribute */
1637 /* Table 4-10: Reason Code Field Values */
1638 enum mbo_non_pref_chan_reason {
1639 	MBO_NON_PREF_CHAN_REASON_UNSPECIFIED = 0,
1640 	MBO_NON_PREF_CHAN_REASON_RSSI = 1,
1641 	MBO_NON_PREF_CHAN_REASON_EXT_INTERFERENCE = 2,
1642 	MBO_NON_PREF_CHAN_REASON_INT_INTERFERENCE = 3,
1643 };
1644 
1645 /* MBO v0.0_r19, 4.2.3: Cellular Data Capabilities Attribute */
1646 /* Table 4-13: Cellular Data Connectivity Field */
1647 enum mbo_cellular_capa {
1648 	MBO_CELL_CAPA_AVAILABLE = 1,
1649 	MBO_CELL_CAPA_NOT_AVAILABLE = 2,
1650 	MBO_CELL_CAPA_NOT_SUPPORTED = 3,
1651 };
1652 
1653 /* MBO v0.0_r19, 4.2.4: Association Disallowed Attribute */
1654 /* Table 4-15: Reason Code Field Values */
1655 enum mbo_assoc_disallow_reason {
1656 	MBO_ASSOC_DISALLOW_REASON_UNSPECIFIED = 1,
1657 	MBO_ASSOC_DISALLOW_REASON_MAX_STA = 2,
1658 	MBO_ASSOC_DISALLOW_REASON_AIR_INTERFERENCE = 3,
1659 	MBO_ASSOC_DISALLOW_REASON_AUTH_SERVER_OVERLOAD = 4,
1660 	MBO_ASSOC_DISALLOW_REASON_LOW_RSSI = 5,
1661 };
1662 
1663 /* MBO v0.0_r19, 4.2.5: Cellular Data Connection Preference Attribute */
1664 /* Table 4-17: Cellular Preference Field Values */
1665 enum mbo_cell_pref {
1666 	MBO_CELL_PREF_EXCLUDED = 0,
1667 	MBO_CELL_PREF_NO_USE = 1,
1668 	MBO_CELL_PREF_USE = 255
1669 };
1670 
1671 /* MBO v0.0_r19, 4.2.6: Transition Reason Code Attribute */
1672 /* Table 4-19: Transition Reason Code Field Values */
1673 enum mbo_transition_reason {
1674 	MBO_TRANSITION_REASON_UNSPECIFIED = 0,
1675 	MBO_TRANSITION_REASON_FRAME_LOSS = 1,
1676 	MBO_TRANSITION_REASON_DELAY = 2,
1677 	MBO_TRANSITION_REASON_BANDWIDTH = 3,
1678 	MBO_TRANSITION_REASON_LOAD_BALANCE = 4,
1679 	MBO_TRANSITION_REASON_RSSI = 5,
1680 	MBO_TRANSITION_REASON_RETRANSMISSIONS = 6,
1681 	MBO_TRANSITION_REASON_INTERFERENCE = 7,
1682 	MBO_TRANSITION_REASON_GRAY_ZONE = 8,
1683 	MBO_TRANSITION_REASON_PREMIUM_AP = 9,
1684 };
1685 
1686 /* MBO v0.0_r19, 4.2.7: Transition Rejection Reason Code Attribute */
1687 /* Table 4-21: Transition Rejection Reason Code Field Values */
1688 enum mbo_transition_reject_reason {
1689 	MBO_TRANSITION_REJECT_REASON_UNSPECIFIED = 0,
1690 	MBO_TRANSITION_REJECT_REASON_FRAME_LOSS = 1,
1691 	MBO_TRANSITION_REJECT_REASON_DELAY = 2,
1692 	MBO_TRANSITION_REJECT_REASON_QOS_CAPACITY = 3,
1693 	MBO_TRANSITION_REJECT_REASON_RSSI = 4,
1694 	MBO_TRANSITION_REJECT_REASON_INTERFERENCE = 5,
1695 	MBO_TRANSITION_REJECT_REASON_SERVICES = 6,
1696 };
1697 
1698 /* MBO v0.0_r27, 4.3: MBO ANQP-elements */
1699 #define MBO_ANQP_OUI_TYPE 0x12
1700 #define MBO_ANQP_SUBTYPE_QUERY_LIST 1
1701 #define MBO_ANQP_SUBTYPE_CELL_CONN_PREF 2
1702 #define MAX_MBO_ANQP_SUBTYPE MBO_ANQP_SUBTYPE_CELL_CONN_PREF
1703 
1704 /* OCE v0.0.10, 4.2.1: OCE Capability Indication Attribute */
1705 #define OCE_RELEASE 1
1706 #define OCE_RELEASE_MASK (BIT(0) | BIT(1) | BIT(2))
1707 #define OCE_IS_STA_CFON BIT(3)
1708 #define OCE_IS_NON_OCE_AP_PRESENT BIT(4)
1709 
1710 /* Wi-Fi Direct (P2P) */
1711 
1712 #define P2P_OUI_TYPE 9
1713 
1714 enum p2p_attr_id {
1715 	P2P_ATTR_STATUS = 0,
1716 	P2P_ATTR_MINOR_REASON_CODE = 1,
1717 	P2P_ATTR_CAPABILITY = 2,
1718 	P2P_ATTR_DEVICE_ID = 3,
1719 	P2P_ATTR_GROUP_OWNER_INTENT = 4,
1720 	P2P_ATTR_CONFIGURATION_TIMEOUT = 5,
1721 	P2P_ATTR_LISTEN_CHANNEL = 6,
1722 	P2P_ATTR_GROUP_BSSID = 7,
1723 	P2P_ATTR_EXT_LISTEN_TIMING = 8,
1724 	P2P_ATTR_INTENDED_INTERFACE_ADDR = 9,
1725 	P2P_ATTR_MANAGEABILITY = 10,
1726 	P2P_ATTR_CHANNEL_LIST = 11,
1727 	P2P_ATTR_NOTICE_OF_ABSENCE = 12,
1728 	P2P_ATTR_DEVICE_INFO = 13,
1729 	P2P_ATTR_GROUP_INFO = 14,
1730 	P2P_ATTR_GROUP_ID = 15,
1731 	P2P_ATTR_INTERFACE = 16,
1732 	P2P_ATTR_OPERATING_CHANNEL = 17,
1733 	P2P_ATTR_INVITATION_FLAGS = 18,
1734 	P2P_ATTR_OOB_GO_NEG_CHANNEL = 19,
1735 	P2P_ATTR_SERVICE_HASH = 21,
1736 	P2P_ATTR_SESSION_INFORMATION_DATA = 22,
1737 	P2P_ATTR_CONNECTION_CAPABILITY = 23,
1738 	P2P_ATTR_ADVERTISEMENT_ID = 24,
1739 	P2P_ATTR_ADVERTISED_SERVICE = 25,
1740 	P2P_ATTR_SESSION_ID = 26,
1741 	P2P_ATTR_FEATURE_CAPABILITY = 27,
1742 	P2P_ATTR_PERSISTENT_GROUP = 28,
1743 	P2P_ATTR_VENDOR_SPECIFIC = 221
1744 };
1745 
1746 #define P2P_MAX_GO_INTENT 15
1747 
1748 /* P2P Capability - Device Capability bitmap */
1749 #define P2P_DEV_CAPAB_SERVICE_DISCOVERY BIT(0)
1750 #define P2P_DEV_CAPAB_CLIENT_DISCOVERABILITY BIT(1)
1751 #define P2P_DEV_CAPAB_CONCURRENT_OPER BIT(2)
1752 #define P2P_DEV_CAPAB_INFRA_MANAGED BIT(3)
1753 #define P2P_DEV_CAPAB_DEVICE_LIMIT BIT(4)
1754 #define P2P_DEV_CAPAB_INVITATION_PROCEDURE BIT(5)
1755 #define P2P_DEV_CAPAB_6GHZ_BAND_CAPABLE BIT(6)
1756 
1757 /* P2P Capability - Group Capability bitmap */
1758 #define P2P_GROUP_CAPAB_GROUP_OWNER BIT(0)
1759 #define P2P_GROUP_CAPAB_PERSISTENT_GROUP BIT(1)
1760 #define P2P_GROUP_CAPAB_GROUP_LIMIT BIT(2)
1761 #define P2P_GROUP_CAPAB_INTRA_BSS_DIST BIT(3)
1762 #define P2P_GROUP_CAPAB_CROSS_CONN BIT(4)
1763 #define P2P_GROUP_CAPAB_PERSISTENT_RECONN BIT(5)
1764 #define P2P_GROUP_CAPAB_GROUP_FORMATION BIT(6)
1765 #define P2P_GROUP_CAPAB_IP_ADDR_ALLOCATION BIT(7)
1766 
1767 /* P2PS Coordination Protocol Transport Bitmap */
1768 #define P2PS_FEATURE_CAPAB_UDP_TRANSPORT BIT(0)
1769 #define P2PS_FEATURE_CAPAB_MAC_TRANSPORT BIT(1)
1770 
1771 struct p2ps_feature_capab {
1772 	u8 cpt;
1773 	u8 reserved;
1774 } STRUCT_PACKED;
1775 
1776 /* Invitation Flags */
1777 #define P2P_INVITATION_FLAGS_TYPE BIT(0)
1778 
1779 /* P2P Manageability */
1780 #define P2P_MAN_DEVICE_MANAGEMENT BIT(0)
1781 #define P2P_MAN_CROSS_CONNECTION_PERMITTED BIT(1)
1782 #define P2P_MAN_COEXISTENCE_OPTIONAL BIT(2)
1783 
1784 enum p2p_status_code {
1785 	P2P_SC_SUCCESS = 0,
1786 	P2P_SC_FAIL_INFO_CURRENTLY_UNAVAILABLE = 1,
1787 	P2P_SC_FAIL_INCOMPATIBLE_PARAMS = 2,
1788 	P2P_SC_FAIL_LIMIT_REACHED = 3,
1789 	P2P_SC_FAIL_INVALID_PARAMS = 4,
1790 	P2P_SC_FAIL_UNABLE_TO_ACCOMMODATE = 5,
1791 	P2P_SC_FAIL_PREV_PROTOCOL_ERROR = 6,
1792 	P2P_SC_FAIL_NO_COMMON_CHANNELS = 7,
1793 	P2P_SC_FAIL_UNKNOWN_GROUP = 8,
1794 	P2P_SC_FAIL_BOTH_GO_INTENT_15 = 9,
1795 	P2P_SC_FAIL_INCOMPATIBLE_PROV_METHOD = 10,
1796 	P2P_SC_FAIL_REJECTED_BY_USER = 11,
1797 	P2P_SC_SUCCESS_DEFERRED = 12,
1798 };
1799 
1800 enum p2p_role_indication {
1801 	P2P_DEVICE_NOT_IN_GROUP = 0x00,
1802 	P2P_CLIENT_IN_A_GROUP = 0x01,
1803 	P2P_GO_IN_A_GROUP = 0x02,
1804 };
1805 
1806 #define P2P_WILDCARD_SSID "DIRECT-"
1807 #define P2P_WILDCARD_SSID_LEN 7
1808 
1809 /* P2P action frames */
1810 enum p2p_act_frame_type {
1811 	P2P_NOA = 0,
1812 	P2P_PRESENCE_REQ = 1,
1813 	P2P_PRESENCE_RESP = 2,
1814 	P2P_GO_DISC_REQ = 3
1815 };
1816 
1817 /* P2P public action frames */
1818 enum p2p_action_frame_type {
1819 	P2P_GO_NEG_REQ = 0,
1820 	P2P_GO_NEG_RESP = 1,
1821 	P2P_GO_NEG_CONF = 2,
1822 	P2P_INVITATION_REQ = 3,
1823 	P2P_INVITATION_RESP = 4,
1824 	P2P_DEV_DISC_REQ = 5,
1825 	P2P_DEV_DISC_RESP = 6,
1826 	P2P_PROV_DISC_REQ = 7,
1827 	P2P_PROV_DISC_RESP = 8
1828 };
1829 
1830 enum p2p_service_protocol_type {
1831 	P2P_SERV_ALL_SERVICES = 0,
1832 	P2P_SERV_BONJOUR = 1,
1833 	P2P_SERV_UPNP = 2,
1834 	P2P_SERV_WS_DISCOVERY = 3,
1835 	P2P_SERV_WIFI_DISPLAY = 4,
1836 	P2P_SERV_P2PS = 11,
1837 	P2P_SERV_VENDOR_SPECIFIC = 255
1838 };
1839 
1840 enum p2p_sd_status {
1841 	P2P_SD_SUCCESS = 0,
1842 	P2P_SD_PROTO_NOT_AVAILABLE = 1,
1843 	P2P_SD_REQUESTED_INFO_NOT_AVAILABLE = 2,
1844 	P2P_SD_BAD_REQUEST = 3
1845 };
1846 
1847 
1848 enum wifi_display_subelem {
1849 	WFD_SUBELEM_DEVICE_INFO = 0,
1850 	WFD_SUBELEM_ASSOCIATED_BSSID = 1,
1851 	WFD_SUBELEM_AUDIO_FORMATS = 2,
1852 	WFD_SUBELEM_VIDEO_FORMATS = 3,
1853 	WFD_SUBELEM_3D_VIDEO_FORMATS = 4,
1854 	WFD_SUBELEM_CONTENT_PROTECTION = 5,
1855 	WFD_SUBELEM_COUPLED_SINK = 6,
1856 	WFD_SUBELEM_EXT_CAPAB = 7,
1857 	WFD_SUBELEM_LOCAL_IP_ADDRESS = 8,
1858 	WFD_SUBELEM_SESSION_INFO = 9,
1859 	WFD_SUBELEM_MAC_INFO = 10,
1860 	WFD_SUBELEM_R2_DEVICE_INFO = 11,
1861 };
1862 
1863 /* 802.11s */
1864 #define MESH_SYNC_METHOD_NEIGHBOR_OFFSET 1
1865 #define MESH_SYNC_METHOD_VENDOR		255
1866 #define MESH_PATH_PROTOCOL_HWMP		1
1867 #define MESH_PATH_PROTOCOL_VENDOR	255
1868 #define MESH_PATH_METRIC_AIRTIME	1
1869 #define MESH_PATH_METRIC_VENDOR		255
1870 /* IEEE 802.11s - Mesh Capability */
1871 #define MESH_CAP_ACCEPT_ADDITIONAL_PEER	BIT(0)
1872 #define MESH_CAP_MCCA_SUPPORTED		BIT(1)
1873 #define MESH_CAP_MCCA_ENABLED		BIT(2)
1874 #define MESH_CAP_FORWARDING		BIT(3)
1875 #define MESH_CAP_MBCA_ENABLED		BIT(4)
1876 #define MESH_CAP_TBTT_ADJUSTING		BIT(5)
1877 #define MESH_CAP_MESH_PS_LEVEL		BIT(6)
1878 
1879 enum plink_action_field {
1880 	PLINK_OPEN = 1,
1881 	PLINK_CONFIRM,
1882 	PLINK_CLOSE
1883 };
1884 
1885 #define OUI_BROADCOM 0x00904c /* Broadcom (Epigram) */
1886 #define VENDOR_VHT_TYPE		0x04
1887 #define VENDOR_VHT_SUBTYPE	0x08
1888 #define VENDOR_VHT_SUBTYPE2	0x00
1889 
1890 #define VENDOR_HT_CAPAB_OUI_TYPE 0x33 /* 00-90-4c:0x33 */
1891 
1892 
1893 /* IEEE 802.11v - WNM Action field values */
1894 enum wnm_action {
1895 	WNM_EVENT_REQ = 0,
1896 	WNM_EVENT_REPORT = 1,
1897 	WNM_DIAGNOSTIC_REQ = 2,
1898 	WNM_DIAGNOSTIC_REPORT = 3,
1899 	WNM_LOCATION_CFG_REQ = 4,
1900 	WNM_LOCATION_CFG_RESP = 5,
1901 	WNM_BSS_TRANS_MGMT_QUERY = 6,
1902 	WNM_BSS_TRANS_MGMT_REQ = 7,
1903 	WNM_BSS_TRANS_MGMT_RESP = 8,
1904 	WNM_FMS_REQ = 9,
1905 	WNM_FMS_RESP = 10,
1906 	WNM_COLLOCATED_INTERFERENCE_REQ = 11,
1907 	WNM_COLLOCATED_INTERFERENCE_REPORT = 12,
1908 	WNM_TFS_REQ = 13,
1909 	WNM_TFS_RESP = 14,
1910 	WNM_TFS_NOTIFY = 15,
1911 	WNM_SLEEP_MODE_REQ = 16,
1912 	WNM_SLEEP_MODE_RESP = 17,
1913 	WNM_TIM_BROADCAST_REQ = 18,
1914 	WNM_TIM_BROADCAST_RESP = 19,
1915 	WNM_QOS_TRAFFIC_CAPAB_UPDATE = 20,
1916 	WNM_CHANNEL_USAGE_REQ = 21,
1917 	WNM_CHANNEL_USAGE_RESP = 22,
1918 	WNM_DMS_REQ = 23,
1919 	WNM_DMS_RESP = 24,
1920 	WNM_TIMING_MEASUREMENT_REQ = 25,
1921 	WNM_NOTIFICATION_REQ = 26,
1922 	WNM_NOTIFICATION_RESP = 27
1923 };
1924 
1925 /* IEEE 802.11v - BSS Transition Management Request - Request Mode */
1926 #define WNM_BSS_TM_REQ_PREF_CAND_LIST_INCLUDED BIT(0)
1927 #define WNM_BSS_TM_REQ_ABRIDGED BIT(1)
1928 #define WNM_BSS_TM_REQ_DISASSOC_IMMINENT BIT(2)
1929 #define WNM_BSS_TM_REQ_BSS_TERMINATION_INCLUDED BIT(3)
1930 #define WNM_BSS_TM_REQ_ESS_DISASSOC_IMMINENT BIT(4)
1931 #define WNM_BSS_TM_REQ_LINK_REMOVAL_IMMINENT BIT(5)
1932 
1933 /* IEEE Std 802.11-2020, Table 9-428 (BTM status code definitions) */
1934 enum bss_trans_mgmt_status_code {
1935 	WNM_BSS_TM_ACCEPT = 0,
1936 	WNM_BSS_TM_REJECT_UNSPECIFIED = 1,
1937 	WNM_BSS_TM_REJECT_INSUFFICIENT_BEACON = 2,
1938 	WNM_BSS_TM_REJECT_INSUFFICIENT_CAPABITY = 3,
1939 	WNM_BSS_TM_REJECT_UNDESIRED = 4,
1940 	WNM_BSS_TM_REJECT_DELAY_REQUEST = 5,
1941 	WNM_BSS_TM_REJECT_STA_CANDIDATE_LIST_PROVIDED = 6,
1942 	WNM_BSS_TM_REJECT_NO_SUITABLE_CANDIDATES = 7,
1943 	WNM_BSS_TM_REJECT_LEAVING_ESS = 8
1944 };
1945 
1946 /* BSS transition management reasons
1947  * IEEE Std 802.11-2020, Table 9-198 (Transition and Transition Query reasons)
1948  */
1949 enum bss_trans_mgmt_reason {
1950 	WNM_TRANSITION_REASON_UNSPECIFIED = 0,
1951 	WNM_TRANSITION_REASON_EXCESSIVE_FRAME_LOSS = 1,
1952 	WNM_TRANSITION_REASON_EXCESSIVE_DELAY = 2,
1953 	WNM_TRANSITION_REASON_INSUFFICIENT_QOS = 3,
1954 	WNM_TRANSITION_REASON_FIRST_ESS_ASSOC = 4,
1955 	WNM_TRANSITION_REASON_LOAD_BALANCING = 5,
1956 	WNM_TRANSITION_REASON_BETTER_AP_FOUND = 6,
1957 	WNM_TRANSITION_REASON_DEAUTH_FROM_PREV_AP = 7,
1958 	WNM_TRANSITION_REASON_AP_FAILED_EAP = 8,
1959 	WNM_TRANSITION_REASON_AP_FAILED_4WAY_HS = 9,
1960 	WNM_TRANSITION_REASON_RX_TOO_MANY_REPLAYS = 10,
1961 	WNM_TRANSITION_REASON_RX_TOO_MANY_MIC_FAILURES = 11,
1962 	WNM_TRANSITION_REASON_EXCEEDED_MAX_RETRANS = 12,
1963 	WNM_TRANSITION_REASON_RX_TOO_MANY_BC_DISASSOC = 13,
1964 	WNM_TRANSITION_REASON_RX_TOO_MANY_BC_DEAUTH = 14,
1965 	WNM_TRANSITION_REASON_PREV_TRANSITION_FAILED = 15,
1966 	WNM_TRANSITION_REASON_LOW_RSSI = 16,
1967 	WNM_TRANSITION_REASON_ROAM_FROM_NON_802_11 = 17,
1968 	WNM_TRANSITION_REASON_TRANSITION_DUE_TO_BTM_REQ = 18,
1969 	WNM_TRANSITION_REASON_PREF_TRANSITION_CANDIDATE_LIST = 19,
1970 	WNM_TRANSITION_REASON_LEAVING_ESS = 20,
1971 };
1972 
1973 /*
1974  * IEEE Std 802.11-2020, Table 9-173 - Optional subelement IDs for
1975  * Neighbor Report
1976  */
1977 #define WNM_NEIGHBOR_TSF                         1
1978 #define WNM_NEIGHBOR_CONDENSED_COUNTRY_STRING    2
1979 #define WNM_NEIGHBOR_BSS_TRANSITION_CANDIDATE    3
1980 #define WNM_NEIGHBOR_BSS_TERMINATION_DURATION    4
1981 #define WNM_NEIGHBOR_BEARING                     5
1982 #define WNM_NEIGHBOR_WIDE_BW_CHAN                6
1983 #define WNM_NEIGHBOR_MEASUREMENT_REPORT         39
1984 #define WNM_NEIGHBOR_HT_CAPAB                   45
1985 #define WNM_NEIGHBOR_HT_OPER                    61
1986 #define WNM_NEIGHBOR_SEC_CHAN_OFFSET            62
1987 #define WNM_NEIGHBOR_MEASUREMENT_PILOT          66
1988 #define WNM_NEIGHBOR_RRM_ENABLED_CAPABILITIES   70
1989 #define WNM_NEIGHBOR_MULTIPLE_BSSID             71
1990 #define WNM_NEIGHBOR_VHT_CAPAB                 191
1991 #define WNM_NEIGHBOR_VHT_OPER                  192
1992 
1993 /* QoS action */
1994 enum qos_action {
1995 	QOS_ADDTS_REQ = 0,
1996 	QOS_ADDTS_RESP = 1,
1997 	QOS_DELTS = 2,
1998 	QOS_SCHEDULE = 3,
1999 	QOS_QOS_MAP_CONFIG = 4,
2000 };
2001 
2002 /* IEEE Std 802.11-2020, 9.4.2.59 (20/40 BSS Coexistence element) */
2003 #define WLAN_20_40_BSS_COEX_INFO_REQ            BIT(0)
2004 #define WLAN_20_40_BSS_COEX_40MHZ_INTOL         BIT(1)
2005 #define WLAN_20_40_BSS_COEX_20MHZ_WIDTH_REQ     BIT(2)
2006 #define WLAN_20_40_BSS_COEX_OBSS_EXEMPT_REQ     BIT(3)
2007 #define WLAN_20_40_BSS_COEX_OBSS_EXEMPT_GRNT    BIT(4)
2008 
2009 struct ieee80211_2040_bss_coex_ie {
2010 	u8 element_id;
2011 	u8 length;
2012 	u8 coex_param;
2013 } STRUCT_PACKED;
2014 
2015 struct ieee80211_2040_intol_chan_report {
2016 	u8 element_id;
2017 	u8 length;
2018 	u8 op_class;
2019 	u8 variable[0];	/* Channel List */
2020 } STRUCT_PACKED;
2021 
2022 /* IEEE 802.11v - WNM-Sleep Mode element */
2023 struct wnm_sleep_element {
2024 	u8 eid;     /* WLAN_EID_WNMSLEEP */
2025 	u8 len;
2026 	u8 action_type; /* WNM_SLEEP_ENTER/WNM_SLEEP_MODE_EXIT */
2027 	u8 status;
2028 	le16 intval;
2029 } STRUCT_PACKED;
2030 
2031 #define WNM_SLEEP_MODE_ENTER 0
2032 #define WNM_SLEEP_MODE_EXIT 1
2033 
2034 enum wnm_sleep_mode_response_status {
2035 	WNM_STATUS_SLEEP_ACCEPT = 0,
2036 	WNM_STATUS_SLEEP_EXIT_ACCEPT_GTK_UPDATE = 1,
2037 	WNM_STATUS_DENIED_ACTION = 2,
2038 	WNM_STATUS_DENIED_TMP = 3,
2039 	WNM_STATUS_DENIED_KEY = 4,
2040 	WNM_STATUS_DENIED_OTHER_WNM_SERVICE = 5
2041 };
2042 
2043 /* WNM-Sleep Mode subelement IDs */
2044 enum wnm_sleep_mode_subelement_id {
2045 	WNM_SLEEP_SUBELEM_GTK = 0,
2046 	WNM_SLEEP_SUBELEM_IGTK = 1,
2047 	WNM_SLEEP_SUBELEM_BIGTK = 2,
2048 };
2049 
2050 /* WNM notification type (IEEE Std 802.11-2020, Table 9-431) */
2051 enum wnm_notification_Type {
2052 	WNM_NOTIF_TYPE_FIRMWARE_UPDATE = 0,
2053 	WNM_NOTIF_TYPE_BEACON_PROTECTION_FAILURE = 2,
2054 	WNM_NOTIF_TYPE_VENDOR_SPECIFIC = 221,
2055 };
2056 
2057 struct wnm_event_report_element {
2058 	u8 eid; /* WLAN_EID_EVENT_REPORT */
2059 	u8 len;
2060 	u8 token;
2061 	u8 type;
2062 	u8 status;
2063 	/* Followed by conditional fields */
2064 	union {
2065 		struct {
2066 			u8 tsf[8]; /* Event TSF */
2067 			u8 color_bitmap[8]; /* Event Report field */
2068 		} STRUCT_PACKED bss_color_collision;
2069 		struct {
2070 			u8 tsf[8]; /* Event TSF */
2071 			u8 color; /* Event Report field */
2072 		} STRUCT_PACKED bss_color_in_use;
2073 	} u;
2074 } STRUCT_PACKED;
2075 
2076 enum wnm_event_report_status {
2077 	WNM_STATUS_SUCCESSFUL = 0,
2078 	WNM_STATUS_REQ_FAILED = 1,
2079 	WNM_STATUS_REQ_REFUSED = 2,
2080 	WNM_STATUS_REQ_INCAPABLE = 3,
2081 	WNM_STATUS_FREQUENT_TRANSITION = 4,
2082 };
2083 
2084 enum wnm_event_report_type {
2085        WNM_EVENT_TYPE_TRANSITION = 0,
2086        WNM_EVENT_TYPE_RSNA = 1,
2087        WNM_EVENT_TYPE_P2P_LINK = 2,
2088        WNM_EVENT_TYPE_WNM_LOG = 3,
2089        WNM_EVENT_TYPE_BSS_COLOR_COLLISION = 4,
2090        WNM_EVENT_TYPE_BSS_COLOR_IN_USE = 5,
2091 };
2092 
2093 /* Channel Switch modes (802.11h) */
2094 #define CHAN_SWITCH_MODE_ALLOW_TX	0
2095 #define CHAN_SWITCH_MODE_BLOCK_TX	1
2096 
2097 struct tpc_report {
2098 	u8 eid;
2099 	u8 len;
2100 	u8 tx_power;
2101 	u8 link_margin;
2102 } STRUCT_PACKED;
2103 
2104 /*
2105  * IEEE Std 802.11ax-2021, Table 9-275a - Maximum Transmit Power
2106  * Interpretation subfield encoding
2107  */
2108 enum max_tx_pwr_interpretation {
2109 	LOCAL_EIRP = 0,
2110 	LOCAL_EIRP_PSD = 1,
2111 	REGULATORY_CLIENT_EIRP = 2,
2112 	REGULATORY_CLIENT_EIRP_PSD = 3,
2113 };
2114 
2115 /*
2116  * IEEE Std 802.11ax-2021, Table E-13 - Maximum Transmit Power
2117  * Category subfield encoding in the United States
2118  */
2119 enum reg_6g_client_type {
2120 	REG_DEFAULT_CLIENT = 0,
2121 	REG_SUBORDINATE_CLIENT = 1,
2122 };
2123 
2124 #define RRM_CAPABILITIES_IE_LEN 5
2125 
2126 /* IEEE Std 802.11-2020, 9.6.6.4 - Link Measurement Request frame format */
2127 struct rrm_link_measurement_request {
2128 	u8 dialog_token;
2129 	s8 tx_power;
2130 	s8 max_tp;
2131 	u8 variable[0];
2132 } STRUCT_PACKED;
2133 
2134 /* IEEE Std 802.11-2020, 9.6.6.5 - Link Measurement Report frame format */
2135 struct rrm_link_measurement_report {
2136 	u8 dialog_token;
2137 	struct tpc_report tpc;
2138 	u8 rx_ant_id;
2139 	u8 tx_ant_id;
2140 	u8 rcpi;
2141 	u8 rsni;
2142 	u8 variable[0];
2143 } STRUCT_PACKED;
2144 
2145 /* IEEE Std 802.11-2020, 9.4.2.20 - Measurement Request element */
2146 struct rrm_measurement_request_element {
2147 	u8 eid; /* Element ID */
2148 	u8 len; /* Length */
2149 	u8 token; /* Measurement Token */
2150 	u8 mode; /* Measurement Request Mode */
2151 	u8 type; /* Measurement Type */
2152 	u8 variable[0]; /* Measurement Request */
2153 } STRUCT_PACKED;
2154 
2155 /* IEEE Std 802.11-2020, Figure 9-180 - Measurement Request Mode field format */
2156 #define MEASUREMENT_REQUEST_MODE_PARALLEL BIT(0)
2157 #define MEASUREMENT_REQUEST_MODE_ENABLE BIT(1)
2158 #define MEASUREMENT_REQUEST_MODE_REQUEST BIT(2)
2159 #define MEASUREMENT_REQUEST_MODE_REPORT BIT(3)
2160 #define MEASUREMENT_REQUEST_MODE_DURATION_MANDATORY BIT(4)
2161 
2162 /* IEEE Std 802.11-2020, 9.4.2.20.7 - Beacon request */
2163 struct rrm_measurement_beacon_request {
2164 	u8 oper_class; /* Operating Class */
2165 	u8 channel; /* Channel Number */
2166 	le16 rand_interval; /* Randomization Interval (in TUs) */
2167 	le16 duration; /* Measurement Duration (in TUs) */
2168 	u8 mode; /* Measurement Mode */
2169 	u8 bssid[ETH_ALEN]; /* BSSID */
2170 	u8 variable[0]; /* Optional Subelements */
2171 } STRUCT_PACKED;
2172 
2173 /*
2174  * IEEE Std 802.11-2020, Table 9-103 - Measurement Mode definitions for Beacon
2175  * request
2176  */
2177 enum beacon_report_mode {
2178 	BEACON_REPORT_MODE_PASSIVE = 0,
2179 	BEACON_REPORT_MODE_ACTIVE = 1,
2180 	BEACON_REPORT_MODE_TABLE = 2,
2181 };
2182 
2183 /* IEEE Std 802.11-2020, Table 9-104 - Optional subelement IDs for
2184  * Beacon request */
2185 #define WLAN_BEACON_REQUEST_SUBELEM_SSID	0
2186 #define WLAN_BEACON_REQUEST_SUBELEM_INFO	1 /* Beacon Reporting */
2187 #define WLAN_BEACON_REQUEST_SUBELEM_DETAIL	2 /* Reporting Detail */
2188 #define WLAN_BEACON_REQUEST_SUBELEM_REQUEST	10
2189 #define WLAN_BEACON_REQUEST_SUBELEM_EXT_REQUEST	11
2190 #define WLAN_BEACON_REQUEST_SUBELEM_AP_CHANNEL	51 /* AP Channel Report */
2191 #define WLAN_BEACON_REQUEST_SUBELEM_WIDE_BW_CS	163
2192 #define WLAN_BEACON_REQUEST_SUBELEM_LAST_INDICATION	164
2193 #define WLAN_BEACON_REQUEST_SUBELEM_VENDOR	221
2194 
2195 /* IEEE Std 802.11-2020, Table 9-106 - Reporting Detail values */
2196 enum beacon_report_detail {
2197 	/* No fixed-length fields or elements */
2198 	BEACON_REPORT_DETAIL_NONE = 0,
2199 	/* All fixed-length fields and any requested elements in the Request
2200 	 * element if present */
2201 	BEACON_REPORT_DETAIL_REQUESTED_ONLY = 1,
2202 	/* All fixed-length fields and elements (default, used when Reporting
2203 	 * Detail subelement is not included in a Beacon request) */
2204 	BEACON_REPORT_DETAIL_ALL_FIELDS_AND_ELEMENTS = 2,
2205 };
2206 
2207 /* IEEE Std 802.11-2020, 9.4.2.21 - Measurement Report element */
2208 struct rrm_measurement_report_element {
2209 	u8 eid; /* Element ID */
2210 	u8 len; /* Length */
2211 	u8 token; /* Measurement Token */
2212 	u8 mode; /* Measurement Report Mode */
2213 	u8 type; /* Measurement Type */
2214 	u8 variable[0]; /* Measurement Report */
2215 } STRUCT_PACKED;
2216 
2217 /* IEEE Std 802.11-2020, Figure 9-223 - Measurement Report Mode field */
2218 #define MEASUREMENT_REPORT_MODE_ACCEPT 0
2219 #define MEASUREMENT_REPORT_MODE_REJECT_LATE BIT(0)
2220 #define MEASUREMENT_REPORT_MODE_REJECT_INCAPABLE BIT(1)
2221 #define MEASUREMENT_REPORT_MODE_REJECT_REFUSED BIT(2)
2222 
2223 /* IEEE Std 802.11-2020, 9.4.2.21.7 - Beacon report */
2224 struct rrm_measurement_beacon_report {
2225 	u8 op_class; /* Operating Class */
2226 	u8 channel; /* Channel Number */
2227 	le64 start_time; /* Actual Measurement Start Time
2228 			  * (in TSF of the BSS requesting the measurement) */
2229 	le16 duration; /* in TUs */
2230 	u8 report_info; /* Reported Frame Information */
2231 	u8 rcpi; /* RCPI */
2232 	u8 rsni; /* RSNI */
2233 	u8 bssid[ETH_ALEN]; /* BSSID */
2234 	u8 antenna_id; /* Antenna ID */
2235 	le32 parent_tsf; /* Parent TSF */
2236 	u8 variable[0]; /* Optional Subelements */
2237 } STRUCT_PACKED;
2238 
2239 /* IEEE Std 802.11-2020, Table 9-130 - Optional subelement IDs for
2240  * Beacon report */
2241 #define WLAN_BEACON_REPORT_SUBELEM_FRAME_BODY	1
2242 #define WLAN_BEACON_REPORT_SUBELEM_FRAME_BODY_FRAGMENT_ID	2
2243 #define WLAN_BEACON_REPORT_SUBELEM_WID_BW_CS	163
2244 #define WLAN_BEACON_REPORT_SUBELEM_LAST_INDICATION	164
2245 #define WLAN_BEACON_REPORT_SUBELEM_VENDOR	221
2246 
2247 /* IEEE Std 802.11-2020, Table 9-232 - Data field format (of the
2248  * Reported Frame Body Fragment ID subelement) */
2249 #define REPORTED_FRAME_BODY_SUBELEM_LEN		4
2250 #define REPORTED_FRAME_BODY_MORE_FRAGMENTS	BIT(7)
2251 
2252 /* IEEE Std 802.11-2020, 9.4.2.21.7 - Beacon report  */
2253 #define BEACON_REPORT_LAST_INDICATION_SUBELEM_LEN	3
2254 
2255 /* IEEE Std 802.11-2020, 9.4.2.138 - Multi-band element */
2256 struct multi_band_ie {
2257 	u8 eid; /* WLAN_EID_MULTI_BAND */
2258 	u8 len;
2259 	u8 mb_ctrl;
2260 	u8 band_id;
2261 	u8 op_class;
2262 	u8 chan;
2263 	u8 bssid[ETH_ALEN];
2264 	le16 beacon_int;
2265 	u8 tsf_offs[8];
2266 	u8 mb_connection_capability;
2267 	u8 fst_session_tmout;
2268 	/* Optional:
2269 	 *   STA MAC Address
2270 	 *   Pairwise Cipher Suite Count
2271 	 *   Pairwise Cipher Suite List
2272 	 */
2273 	u8 variable[0];
2274 } STRUCT_PACKED;
2275 
2276 enum mb_ctrl_sta_role {
2277 	MB_STA_ROLE_AP = 0,
2278 	MB_STA_ROLE_TDLS_STA = 1,
2279 	MB_STA_ROLE_IBSS_STA = 2,
2280 	MB_STA_ROLE_PCP = 3,
2281 	MB_STA_ROLE_NON_PCP_NON_AP = 4
2282 };
2283 
2284 #define MB_CTRL_ROLE_MASK (BIT(0) | BIT(1) | BIT(2))
2285 #define MB_CTRL_ROLE(ctrl) ((u8) ((ctrl) & MB_CTRL_ROLE_MASK))
2286 #define MB_CTRL_STA_MAC_PRESENT ((u8) (BIT(3)))
2287 #define MB_CTRL_PAIRWISE_CIPHER_SUITE_PRESENT ((u8) (BIT(4)))
2288 
2289 enum mb_band_id {
2290 	MB_BAND_ID_WIFI_2_4GHZ = 2, /* 2.4 GHz */
2291 	MB_BAND_ID_WIFI_5GHZ = 4, /* 4.9 and 5 GHz */
2292 	MB_BAND_ID_WIFI_60GHZ = 5, /* 60 GHz */
2293 };
2294 
2295 #define MB_CONNECTION_CAPABILITY_AP ((u8) (BIT(0)))
2296 #define MB_CONNECTION_CAPABILITY_PCP ((u8) (BIT(1)))
2297 #define MB_CONNECTION_CAPABILITY_DLS ((u8) (BIT(2)))
2298 #define MB_CONNECTION_CAPABILITY_TDLS ((u8) (BIT(3)))
2299 #define MB_CONNECTION_CAPABILITY_IBSS ((u8) (BIT(4)))
2300 
2301 /* IEEE Std 802.11-2020, Table 9-479 - FST Action field values */
2302 enum fst_action {
2303 	FST_ACTION_SETUP_REQUEST = 0,
2304 	FST_ACTION_SETUP_RESPONSE = 1,
2305 	FST_ACTION_TEAR_DOWN = 2,
2306 	FST_ACTION_ACK_REQUEST = 3,
2307 	FST_ACTION_ACK_RESPONSE = 4,
2308 	FST_ACTION_ON_CHANNEL_TUNNEL = 5,
2309 };
2310 
2311 /* IEEE Std 802.11-2020, Annex C - dot11PHYType */
2312 enum phy_type {
2313 	PHY_TYPE_UNSPECIFIED = 0,
2314 	PHY_TYPE_DSSS = 2,
2315 	PHY_TYPE_OFDM = 4,
2316 	PHY_TYPE_HRDSSS = 5,
2317 	PHY_TYPE_ERP = 6,
2318 	PHY_TYPE_HT = 7,
2319 	PHY_TYPE_DMG = 8,
2320 	PHY_TYPE_VHT = 9,
2321 	PHY_TYPE_TVHT = 10,
2322 	PHY_TYPE_S1G = 11,
2323 	PHY_TYPE_CDMG = 12,
2324 	PHY_TYPE_CMMG = 13,
2325 };
2326 
2327 /* IEEE Std 802.11-2020, 9.4.2.36 - Neighbor Report element */
2328 /* BSSID Information Field */
2329 #define NEI_REP_BSSID_INFO_AP_NOT_REACH BIT(0)
2330 #define NEI_REP_BSSID_INFO_AP_UNKNOWN_REACH BIT(1)
2331 #define NEI_REP_BSSID_INFO_AP_REACHABLE (BIT(0) | BIT(1))
2332 #define NEI_REP_BSSID_INFO_SECURITY BIT(2)
2333 #define NEI_REP_BSSID_INFO_KEY_SCOPE BIT(3)
2334 #define NEI_REP_BSSID_INFO_SPECTRUM_MGMT BIT(4)
2335 #define NEI_REP_BSSID_INFO_QOS BIT(5)
2336 #define NEI_REP_BSSID_INFO_APSD BIT(6)
2337 #define NEI_REP_BSSID_INFO_RM BIT(7)
2338 #define NEI_REP_BSSID_INFO_DELAYED_BA BIT(8)
2339 #define NEI_REP_BSSID_INFO_IMM_BA BIT(9)
2340 #define NEI_REP_BSSID_INFO_MOBILITY_DOMAIN BIT(10)
2341 #define NEI_REP_BSSID_INFO_HT BIT(11)
2342 #define NEI_REP_BSSID_INFO_VHT BIT(12)
2343 #define NEI_REP_BSSID_INFO_FTM BIT(13)
2344 #define NEI_REP_BSSID_INFO_HE BIT(14)
2345 #define NEI_REP_BSSID_INFO_EHT BIT(21)
2346 
2347 /*
2348  * IEEE Std 802.11-2020, Table 9-175 - HT/VHT Operation Information
2349  * subfields.
2350  * Note: These definitions are not the same as other CHANWIDTH_*.
2351  */
2352 enum nr_chan_width {
2353 	NR_CHAN_WIDTH_20 = 0,
2354 	NR_CHAN_WIDTH_40 = 1,
2355 	NR_CHAN_WIDTH_80 = 2,
2356 	NR_CHAN_WIDTH_160 = 3,
2357 	NR_CHAN_WIDTH_80P80 = 4,
2358 };
2359 
2360 struct ieee80211_he_capabilities {
2361 	u8 he_mac_capab_info[6];
2362 	u8 he_phy_capab_info[11];
2363 	/* Followed by 4, 8, or 12 octets of Supported HE-MCS And NSS Set field
2364 	* and optional variable length PPE Thresholds field. */
2365 	u8 optional[37];
2366 } STRUCT_PACKED;
2367 #define IEEE80211_HE_CAPAB_MIN_LEN (6 + 11)
2368 
2369 struct ieee80211_he_operation {
2370 	le32 he_oper_params; /* HE Operation Parameters[3] and
2371 			      * BSS Color Information[1] */
2372 	le16 he_mcs_nss_set;
2373 	/* Followed by conditional VHT Operation Information (3 octets),
2374 	 * Max Co-Hosted BSSID Indicator subfield (1 octet), and/or 6 GHz
2375 	 * Operation Information subfield (5 octets). */
2376 } STRUCT_PACKED;
2377 
2378 /* IEEE Std 802.11ax-2021, Figure 9-788k - 6 GHz Operation Information field */
2379 struct ieee80211_he_6ghz_oper_info {
2380 	u8 primary_chan;
2381 	u8 control;
2382 	u8 chan_center_freq_seg0;
2383 	u8 chan_center_freq_seg1;
2384 	u8 min_rate;
2385 } STRUCT_PACKED;
2386 
2387 /* IEEE Std 802.11ax-2021, Figure 9-788l - Control field format */
2388 #define HE_6GHZ_OPER_INFO_CTRL_CHAN_WIDTH_MASK	(BIT(0) | BIT(1))
2389 #define HE_6GHZ_OPER_INFO_CTRL_DUP_BEACON	BIT(2)
2390 #define HE_6GHZ_OPER_INFO_CTRL_REG_INFO_MASK	(BIT(3) | BIT(4) | BIT(5))
2391 #define HE_6GHZ_OPER_INFO_CTRL_REG_INFO_SHIFT	3
2392 
2393 /* IEEE Std 802.11ax-2021, 9.4.2.263 HE 6 GHz Band Capabilities element */
2394 struct ieee80211_he_6ghz_band_cap {
2395 	 /* Minimum MPDU Start Spacing B0..B2
2396 	  * Maximum A-MPDU Length Exponent B3..B5
2397 	  * Maximum MPDU Length B6..B7
2398 	  * SM Power Save B9..B10
2399 	  * RD Responder B11
2400 	  * Rx Antenna Pattern Consistency B12
2401 	  * Tx Antenna Consistency B13 */
2402 	le16 capab; /* Capabilities Information field */
2403 } STRUCT_PACKED;
2404 
2405 #define HE_6GHZ_BAND_CAP_MIN_MPDU_START              (BIT(0) | BIT(1) | BIT(2))
2406 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_16K       BIT(3)
2407 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_32K       BIT(4)
2408 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_64K       (BIT(3) | BIT(4))
2409 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_128K      BIT(5)
2410 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_256K      (BIT(3) | BIT(5))
2411 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_512K      (BIT(4) | BIT(5))
2412 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_1024K     (BIT(3) | BIT(4) | BIT(5))
2413 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_MASK      (BIT(3) | BIT(4) | BIT(5))
2414 #define HE_6GHZ_BAND_CAP_MAX_AMPDU_LEN_EXP_SHIFT     3
2415 #define HE_6GHZ_BAND_CAP_MAX_MPDU_LEN_7991           BIT(6)
2416 #define HE_6GHZ_BAND_CAP_MAX_MPDU_LEN_11454          BIT(7)
2417 #define HE_6GHZ_BAND_CAP_MAX_MPDU_LEN_MASK           (BIT(6) | BIT(7))
2418 #define HE_6GHZ_BAND_CAP_MAX_MPDU_LEN_SHIFT	     6
2419 #define HE_6GHZ_BAND_CAP_SMPS_MASK                   (BIT(9) | BIT(10))
2420 #define HE_6GHZ_BAND_CAP_SMPS_STATIC                 0
2421 #define HE_6GHZ_BAND_CAP_SMPS_DYNAMIC                BIT(9)
2422 #define HE_6GHZ_BAND_CAP_SMPS_DISABLED               (BIT(9) | BIT(10))
2423 #define HE_6GHZ_BAND_CAP_RD_RESPONDER                BIT(11)
2424 #define HE_6GHZ_BAND_CAP_RX_ANTPAT_CONS              BIT(12)
2425 #define HE_6GHZ_BAND_CAP_TX_ANTPAT_CONS              BIT(13)
2426 
2427 /*
2428  * IEEE Std 802.11ax-2021, 9.4.2.252 Spatial Reuse Parameter Set element
2429  */
2430 struct ieee80211_spatial_reuse {
2431 	u8 sr_ctrl; /* SR Control */
2432 	/* Up to 19 octets of parameters:
2433 	 * Non-SRG OBSS PD Max Offset[0 or 1]
2434 	 * SRG OBSS PD Min Offset[0 or 1]
2435 	 * SRG OBSS PD Max Offset[0 or 1]
2436 	 * SRG BSS Color Bitmap[0 or 8]
2437 	 * SRG Partial BSSID Bitmap[0 or 8]
2438 	 */
2439 	u8 params[19];
2440 } STRUCT_PACKED;
2441 
2442 /* HE Capabilities Information defines */
2443 
2444 #define HE_MACCAP_TWT_RESPONDER			((u8) BIT(2))
2445 
2446 #define HE_PHYCAP_CHANNEL_WIDTH_SET_IDX		0
2447 #define HE_PHYCAP_CHANNEL_WIDTH_MASK		((u8) (BIT(1) | BIT(2) | \
2448 						      BIT(3) | BIT(4)))
2449 #define HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_IN_2G         ((u8) BIT(1))
2450 #define HE_PHYCAP_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G	((u8) BIT(2))
2451 #define HE_PHYCAP_CHANNEL_WIDTH_SET_160MHZ_IN_5G	((u8) BIT(3))
2452 #define HE_PHYCAP_CHANNEL_WIDTH_SET_80PLUS80MHZ_IN_5G	((u8) BIT(4))
2453 
2454 #define HE_PHYCAP_SU_BEAMFORMER_CAPAB_IDX	3
2455 #define HE_PHYCAP_SU_BEAMFORMER_CAPAB		((u8) BIT(7))
2456 #define HE_PHYCAP_SU_BEAMFORMEE_CAPAB_IDX	4
2457 #define HE_PHYCAP_SU_BEAMFORMEE_CAPAB		((u8) BIT(0))
2458 #define HE_PHYCAP_MU_BEAMFORMER_CAPAB_IDX	4
2459 #define HE_PHYCAP_MU_BEAMFORMER_CAPAB		((u8) BIT(1))
2460 
2461 #define HE_PHYCAP_PPE_THRESHOLD_PRESENT_IDX	6
2462 #define HE_PHYCAP_PPE_THRESHOLD_PRESENT		((u8) BIT(7))
2463 
2464 /* HE PPE Threshold define */
2465 #define HE_PPE_THRES_RU_INDEX_BITMASK_MASK	0xf
2466 #define HE_PPE_THRES_RU_INDEX_BITMASK_SHIFT	3
2467 #define HE_PPE_THRES_NSS_MASK			0x7
2468 
2469 /* HE Operation defines */
2470 /* HE Operation Parameters and BSS Color Information fields */
2471 #define HE_OPERATION_DFLT_PE_DURATION_MASK	((u32) (BIT(0) | BIT(1) | \
2472 							BIT(2)))
2473 #define HE_OPERATION_DFLT_PE_DURATION_OFFSET	0
2474 #define HE_OPERATION_TWT_REQUIRED		((u32) BIT(3))
2475 #define HE_OPERATION_RTS_THRESHOLD_MASK	((u32) (BIT(4) | BIT(5) | \
2476 						BIT(6) | BIT(7) | \
2477 						BIT(8) | BIT(9) | \
2478 						BIT(10) | BIT(11) | \
2479 						BIT(12) | BIT(13)))
2480 #define HE_OPERATION_RTS_THRESHOLD_OFFSET	4
2481 #define HE_OPERATION_VHT_OPER_INFO		((u32) BIT(14))
2482 #define HE_OPERATION_COHOSTED_BSS		((u32) BIT(15))
2483 #define HE_OPERATION_ER_SU_DISABLE		((u32) BIT(16))
2484 #define HE_OPERATION_6GHZ_OPER_INFO		((u32) BIT(17))
2485 #define HE_OPERATION_BSS_COLOR_MASK		((u32) (BIT(24) | BIT(25) | \
2486 							BIT(26) | BIT(27) | \
2487 							BIT(28) | BIT(29)))
2488 #define HE_OPERATION_BSS_COLOR_PARTIAL		((u32) BIT(30))
2489 #define HE_OPERATION_BSS_COLOR_DISABLED		((u32) BIT(31))
2490 #define HE_OPERATION_BSS_COLOR_OFFSET		24
2491 #define HE_OPERATION_BSS_COLOR_MAX		64
2492 
2493 /**
2494  * enum he_reg_info_6ghz_ap_type - Allowed Access Point types for 6 GHz Band
2495  *
2496  * IEEE P802.11-REVme/D4.0, Table E-12 (Regulatory Info subfield encoding)
2497  */
2498 enum he_reg_info_6ghz_ap_type {
2499 	HE_REG_INFO_6GHZ_AP_TYPE_INDOOR         = 0,
2500 	HE_REG_INFO_6GHZ_AP_TYPE_SP		= 1,
2501 	HE_REG_INFO_6GHZ_AP_TYPE_VLP		= 2,
2502 	HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_ENABLED	= 3,
2503 	HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP	= 4,
2504 	HE_REG_INFO_6GHZ_AP_TYPE_MAX = HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP,
2505 };
2506 
2507 static inline bool he_reg_is_indoor(enum he_reg_info_6ghz_ap_type type)
2508 {
2509 	return type == HE_REG_INFO_6GHZ_AP_TYPE_INDOOR ||
2510 		type == HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP;
2511 }
2512 
2513 static inline bool he_reg_is_sp(enum he_reg_info_6ghz_ap_type type)
2514 {
2515 	return type == HE_REG_INFO_6GHZ_AP_TYPE_SP ||
2516 		type == HE_REG_INFO_6GHZ_AP_TYPE_INDOOR_SP;
2517 }
2518 
2519 /* Spatial Reuse defines */
2520 #define SPATIAL_REUSE_SRP_DISALLOWED		BIT(0)
2521 #define SPATIAL_REUSE_NON_SRG_OBSS_PD_SR_DISALLOWED	BIT(1)
2522 #define SPATIAL_REUSE_NON_SRG_OFFSET_PRESENT	BIT(2)
2523 #define SPATIAL_REUSE_SRG_INFORMATION_PRESENT	BIT(3)
2524 #define SPATIAL_REUSE_HESIGA_SR_VAL15_ALLOWED	BIT(4)
2525 
2526 struct ieee80211_he_mu_edca_parameter_set {
2527 	u8 he_qos_info;
2528 	u8 he_mu_ac_be_param[3];
2529 	u8 he_mu_ac_bk_param[3];
2530 	u8 he_mu_ac_vi_param[3];
2531 	u8 he_mu_ac_vo_param[3];
2532 } STRUCT_PACKED;
2533 
2534 /* HE MU AC parameter record field format */
2535 /* ACI/AIFSN */
2536 #define HE_MU_AC_PARAM_ACI_IDX 0
2537 #define HE_MU_AC_PARAM_AIFSN ((u8) (BIT(0) | BIT(1) | BIT(2) | BIT(3)))
2538 #define HE_MU_AC_PARAM_ACM ((u8) BIT(4))
2539 #define HE_MU_AC_PARAM_ACI ((u8) (BIT(5) | BIT(6)))
2540 /* B7: Reserved */
2541 
2542 /* ECWmin/ECWmax */
2543 #define HE_MU_AC_PARAM_ECW_IDX 1
2544 #define HE_MU_AC_PARAM_ECWMIN ((u8) (BIT(0) | BIT(1) | BIT(2) | BIT(3)))
2545 #define HE_MU_AC_PARAM_ECWMAX ((u8) (BIT(4) | BIT(5) | BIT(6) | BIT(7)))
2546 
2547 /* MU EDCA Timer */
2548 #define HE_MU_AC_PARAM_TIMER_IDX 2
2549 
2550 /* HE QoS Info field */
2551 #define HE_QOS_INFO_EDCA_PARAM_SET_COUNT ((u8) (BIT(0) | BIT(1) | \
2552 						BIT(2) | BIT(3)))
2553 #define HE_QOS_INFO_Q_ACK ((u8) (BIT(4)))
2554 #define HE_QOS_INFO_QUEUE_REQUEST ((u8) (BIT(5)))
2555 #define HE_QOS_INFO_TXOP_REQUEST ((u8) (BIT(6)))
2556 /* B7: Reserved if sent by an AP; More Data Ack if sent by a non-AP STA */
2557 #define HE_QOS_INFO_MORE_DATA_ACK ((u8) (BIT(7)))
2558 
2559 /*
2560  * IEEE Std 802.11-2020 and IEEE Std 802.11ax-2021
2561  * 9.4.2.170 Reduced Neighbor Report element
2562  */
2563 #define RNR_HEADER_LEN                              2
2564 #define RNR_TBTT_HEADER_LEN                         4
2565 #define RNR_TBTT_INFO_HDR_TYPE_MSK                  0x03
2566 #define RNR_TBTT_INFO_HDR_FILTERED_AP               0x04
2567 #define RNR_TBTT_INFO_HDR_CNT_MSK                   0xf0
2568 #define RNR_TBTT_INFO_COUNT(x)                      (((x) & 0xf) << 4)
2569 #define RNR_TBTT_INFO_COUNT_MAX                     16
2570 #define RNR_TBTT_INFO_COUNT_VAL(x)                  (((x) & 0xf0) >> 4)
2571 #define RNR_TBTT_INFO_LEN                           13
2572 #define RNR_TBTT_INFO_MLD_LEN                       16
2573 #define RNR_NEIGHBOR_AP_OFFSET_UNKNOWN              255
2574 /* Figure 9-632a - BSS Parameters subfield format */
2575 #define RNR_BSS_PARAM_OCT_RECOMMENDED               BIT(0)
2576 #define RNR_BSS_PARAM_SAME_SSID                     BIT(1)
2577 #define RNR_BSS_PARAM_MULTIPLE_BSSID                BIT(2)
2578 #define RNR_BSS_PARAM_TRANSMITTED_BSSID             BIT(3)
2579 #define RNR_BSS_PARAM_MEMBER_CO_LOCATED_ESS         BIT(4)
2580 #define RNR_BSS_PARAM_UNSOLIC_PROBE_RESP_ACTIVE     BIT(5)
2581 #define RNR_BSS_PARAM_CO_LOCATED                    BIT(6)
2582 /* Maximum transmit power in Y/2 dBm (-127..126); 127 indicates no maximum
2583  * transmit power is specified for the corresponding 20 MHz channel. */
2584 #define RNR_20_MHZ_PSD_MAX_TXPOWER                  127
2585 
2586 /* IEEE P802.11be/D5.0, Figure 9-704c - MLD Parameters subfield format */
2587 /* B0..B7: AP MLD ID */
2588 /* B8..B11: Link ID */
2589 /* B12..B19: BSS Parameters Change Count */
2590 /* B20: All Updates Included */
2591 #define RNR_TBTT_INFO_MLD_PARAM2_ALL_UPDATE_INC 0x10
2592 /* B21: Disabled Link Indication */
2593 #define RNR_TBTT_INFO_MLD_PARAM2_LINK_DISABLED  0x20
2594 
2595 /* IEEE P802.11be/D2.3, 9.4.2.311 - EHT Operation element */
2596 
2597 /* Figure 9-1002b: EHT Operation Parameters field subfields */
2598 #define EHT_OPER_INFO_PRESENT                          BIT(0)
2599 #define EHT_OPER_DISABLED_SUBCHAN_BITMAP_PRESENT       BIT(1)
2600 #define EHT_OPER_DEFAULT_PE_DURATION                   BIT(2)
2601 #define EHT_OPER_GROUP_ADDR_BU_INDICATION_LIMIT        BIT(3)
2602 #define EHT_OPER_GROUP_ADDR_BU_INDICATION_EXPONENT     (BIT(4) | BIT(5))
2603 #define EHT_OPER_DISABLED_SUBCHAN_BITMAP_SIZE          2
2604 
2605 /* Control subfield: Channel Width subfield; see Table 9-401b */
2606 #define EHT_OPER_CHANNEL_WIDTH_20MHZ                   0
2607 #define EHT_OPER_CHANNEL_WIDTH_40MHZ                   1
2608 #define EHT_OPER_CHANNEL_WIDTH_80MHZ                   2
2609 #define EHT_OPER_CHANNEL_WIDTH_160MHZ                  3
2610 #define EHT_OPER_CHANNEL_WIDTH_320MHZ                  4
2611 
2612 /* Figure 9-1002c: EHT Operation Information field format */
2613 struct ieee80211_eht_oper_info {
2614 	u8 control; /* B0..B2: Channel Width */
2615 	u8 ccfs0;
2616 	u8 ccfs1;
2617 	le16 disabled_chan_bitmap; /* 0 or 2 octets */
2618 } STRUCT_PACKED;
2619 
2620 /* Figure 9-1002a: EHT Operation element format */
2621 struct ieee80211_eht_operation {
2622 	u8 oper_params; /* EHT Operation Parameters: EHT_OPER_* bits */
2623 	u8 basic_eht_mcs_nss_set[4];
2624 	struct ieee80211_eht_oper_info oper_info; /* 0 or 3 or 5 octets */
2625 } STRUCT_PACKED;
2626 
2627 /* IEEE P802.11be/D1.5, 9.4.2.313 - EHT Capabilities element */
2628 
2629 /* Figure 9-1002af: EHT MAC Capabilities Information field */
2630 #define EHT_MACCAP_EPCS_PRIO			BIT(0)
2631 #define EHT_MACCAP_OM_CONTROL			BIT(1)
2632 #define EHT_MACCAP_TRIGGERED_TXOP_MODE1		BIT(2)
2633 #define EHT_MACCAP_TRIGGERED_TXOP_MODE2		BIT(3)
2634 #define EHT_MACCAP_RESTRICTED_TWT		BIT(4)
2635 #define EHT_MACCAP_SCS_TRAFFIC_DESC		BIT(5)
2636 #define EHT_MACCAP_MAX_MPDU_LEN_MASK		(BIT(6) | BIT(7))
2637 #define EHT_MACCAP_MAX_MPDU_LEN_3895		0
2638 #define EHT_MACCAP_MAX_MPDU_LEN_7991		BIT(6)
2639 #define EHT_MACCAP_MAX_MPDU_LEN_11454		BIT(7)
2640 #define EHT_MACCAP_MAX_AMPDU_LEN_EXP_EXT	BIT(8)
2641 
2642 /* Figure 9-1002ag: EHT PHY Capabilities Information field format
2643  * _IDX indicates the octet index within the field */
2644 #define EHT_PHY_CAPAB_LEN			9
2645 
2646 #define EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_IDX	0
2647 #define EHT_PHYCAP_320MHZ_IN_6GHZ_SUPPORT_MASK	((u8) BIT(1))
2648 
2649 #define EHT_PHYCAP_SU_BEAMFORMER_IDX		0
2650 #define EHT_PHYCAP_SU_BEAMFORMER		((u8) BIT(5))
2651 #define EHT_PHYCAP_SU_BEAMFORMEE_IDX		0
2652 #define EHT_PHYCAP_SU_BEAMFORMEE		((u8) BIT(6))
2653 
2654 #define EHT_PHYCAP_PPE_THRESHOLD_PRESENT_IDX	5
2655 #define EHT_PHYCAP_PPE_THRESHOLD_PRESENT	((u8) BIT(3))
2656 
2657 #define EHT_PHYCAP_MU_BEAMFORMER_IDX		7
2658 #define EHT_PHYCAP_MU_BEAMFORMER_80MHZ		((u8) BIT(4))
2659 #define EHT_PHYCAP_MU_BEAMFORMER_160MHZ		((u8) BIT(5))
2660 #define EHT_PHYCAP_MU_BEAMFORMER_320MHZ		((u8) BIT(6))
2661 #define EHT_PHYCAP_MU_BEAMFORMER_MASK	(EHT_PHYCAP_MU_BEAMFORMER_80MHZ | \
2662 					 EHT_PHYCAP_MU_BEAMFORMER_160MHZ | \
2663 					 EHT_PHYCAP_MU_BEAMFORMER_320MHZ)
2664 
2665 /* Figure 9-1002ah: Supported EHT-MCS and NSS Set field format */
2666 #define EHT_PHYCAP_MCS_NSS_LEN_20MHZ_ONLY	4
2667 #define EHT_PHYCAP_MCS_NSS_LEN_20MHZ_PLUS	3
2668 
2669 #define EHT_MCS_NSS_CAPAB_LEN			9
2670 /*
2671  * Figure 9-1002ak: EHT PPE Thresholds field format
2672  * Maximum PPE threshold length: 62 octets
2673  * NSS: 4 bits (maximum NSS: 16), RU index: 5 bits, each pair: 6 bits
2674  * 4 + 5 + 5 * 16 * 6 = 489 bits, Padding: 7 bits
2675  */
2676 #define EHT_PPE_THRESH_CAPAB_LEN		62
2677 
2678 /* 9.4.2.313.5: EHT PPE Thresholds field */
2679 #define EHT_PPE_THRES_NSS_SHIFT			0
2680 #define EHT_PPE_THRES_NSS_MASK			((u8) (BIT(0) | BIT(1) | \
2681 						       BIT(2) | BIT(3)))
2682 #define EHT_PPE_THRES_RU_INDEX_SHIFT		4
2683 #define EHT_PPE_THRES_RU_INDEX_MASK		((u16) (BIT(4) | BIT(5) | \
2684 							BIT(6) | BIT(7) | \
2685 							BIT(8)))
2686 
2687 #define EHT_NSS_MAX_STREAMS			8
2688 
2689 /* Figure 9-1002ae: EHT Capabilities element format */
2690 struct ieee80211_eht_capabilities {
2691 	/* EHT MAC Capabilities Information */
2692 	le16 mac_cap;
2693 	/* EHT PHY Capabilities Information */
2694 	u8 phy_cap[EHT_PHY_CAPAB_LEN];
2695 	/* Supported EHT-MCS And NSS Set and EHT PPE thresholds (Optional) */
2696 	u8 optional[EHT_MCS_NSS_CAPAB_LEN + EHT_PPE_THRESH_CAPAB_LEN];
2697 } STRUCT_PACKED;
2698 
2699 #define IEEE80211_EHT_CAPAB_MIN_LEN (2 + 9)
2700 
2701 /* IEEE P802.11be/D2.1, 9.4.2.312 - Multi-Link element */
2702 
2703 /* Figure 9-1002f: Multi-Link Control field */
2704 #define MULTI_LINK_CONTROL_TYPE_MASK			0x07
2705 #define MULTI_LINK_CONTROL_LEN				2
2706 
2707 /* Table 9-401c: Mult-Link element Type subfield encoding */
2708 #define MULTI_LINK_CONTROL_TYPE_BASIC			0
2709 #define MULTI_LINK_CONTROL_TYPE_PROBE_REQ		1
2710 #define MULTI_LINK_CONTROL_TYPE_RECONF			2
2711 #define MULTI_LINK_CONTROL_TYPE_TDLS			3
2712 #define MULTI_LINK_CONTROL_TYPE_PRIOR_ACCESS		4
2713 
2714 /*
2715  * IEEE P802.11be/D2.2, Table 9-401c: Optional subelement IDs for Link Info
2716  * field of the Multi-Link element
2717  */
2718 #define MULTI_LINK_SUB_ELEM_ID_PER_STA_PROFILE		0
2719 #define MULTI_LINK_SUB_ELEM_ID_VENDOR			221
2720 #define MULTI_LINK_SUB_ELEM_ID_FRAGMENT			254
2721 
2722 /* IEEE P802.11be/D2.2, 9.4.2.312.2 - Basic Multi-Link element */
2723 
2724 /* Figure 9-1002g: Presence Bitmap subfield of the Basic Multi-Link element */
2725 #define BASIC_MULTI_LINK_CTRL_PRES_LINK_ID		0x0010
2726 #define BASIC_MULTI_LINK_CTRL_PRES_BSS_PARAM_CH_COUNT	0x0020
2727 #define BASIC_MULTI_LINK_CTRL_PRES_MSD_INFO		0x0040
2728 #define BASIC_MULTI_LINK_CTRL_PRES_EML_CAPA		0x0080
2729 #define BASIC_MULTI_LINK_CTRL_PRES_MLD_CAPA		0x0100
2730 #define BASIC_MULTI_LINK_CTRL_PRES_AP_MLD_ID		0x0200
2731 
2732 /*
2733  * STA Control field definitions of Per-STA Profile subelement in Basic
2734  * Multi-Link element as described in Figure 9-1002n: STA Control field format.
2735  */
2736 #define BASIC_MLE_STA_CTRL_LEN				2
2737 #define BASIC_MLE_STA_CTRL_LINK_ID_MASK			0x000F
2738 #define BASIC_MLE_STA_CTRL_COMPLETE_PROFILE		0x0010
2739 #define BASIC_MLE_STA_CTRL_PRES_STA_MAC			0x0020
2740 #define BASIC_MLE_STA_CTRL_PRES_BEACON_INT		0x0040
2741 #define BASIC_MLE_STA_CTRL_PRES_TSF_OFFSET		0x0080
2742 #define BASIC_MLE_STA_CTRL_PRES_DTIM_INFO		0x0100
2743 #define BASIC_MLE_STA_CTRL_PRES_NSTR_LINK_PAIR		0x0200
2744 #define BASIC_MLE_STA_CTRL_NSTR_BITMAP			0x0400
2745 #define BASIC_MLE_STA_CTRL_PRES_BSS_PARAM_COUNT		0x0800
2746 
2747 #define BASIC_MLE_STA_PROF_STA_MAC_IDX			3
2748 
2749 /* IEEE P802.11be/D2.2, 9.4.2.312.2.3 - Common Info field of the Basic
2750  * Multi-Link element */
2751 struct eht_ml_basic_common_info {
2752 	u8 len;
2753 	u8 mld_addr[ETH_ALEN];
2754 
2755 	/*
2756 	 * Followed by optional fields based on the multi link basic presence
2757 	 * bitmap
2758 	 *
2759 	 * Link ID Info: 1 octet
2760 	 * BSS Parameters Change Count: 1 octet
2761 	 * Medium Synchronization Delay Information: 2 octets
2762 	 * EML Capabilities: 2 octets
2763 	 * MLD Capabilities and Operations: 2 octets
2764 	 * AP MLD ID: 1 octet
2765 	 */
2766 	u8 variable[];
2767 } STRUCT_PACKED;
2768 
2769 #define EHT_ML_LINK_ID_MSK   0x0f
2770 
2771 #define EHT_ML_MEDIUM_SYNC_DELAY_DURATION   0x00ff
2772 #define EHT_ML_MEDIUM_SYNC_DELAY_OFDM_ED_TH 0x0f00
2773 #define EHT_ML_MEDIUM_SYNC_DELAY_MAX_TXOP   0xf000
2774 
2775 #define EHT_ML_EML_CAPA_EMLSR_SUPP               0x0001
2776 #define EHT_ML_EML_CAPA_EMLSR_PADDING_DELAY_MASK 0x000e
2777 #define EHT_ML_EML_CAPA_EMLSR_TRANS_DELAY_MASK   0x0070
2778 #define EHT_ML_EML_CAPA_EMLMR_SUPP               0x0080
2779 #define EHT_ML_EML_CAPA_EMLMR_DELAY_MASK         0x0700
2780 #define EHT_ML_EML_CAPA_TRANSITION_TIMEOUT_MASK  0x7800
2781 
2782 #define EHT_ML_MLD_CAPA_MAX_NUM_SIM_LINKS_MASK        0x000f
2783 #define EHT_ML_MLD_CAPA_SRS_SUPP                      0x0010
2784 #define EHT_ML_MLD_CAPA_TID_TO_LINK_MAP_ALL_TO_ALL    0x0020
2785 #define EHT_ML_MLD_CAPA_TID_TO_LINK_MAP_ALL_TO_ONE    0x0040
2786 #define EHT_ML_MLD_CAPA_TID_TO_LINK_MAP_NEG_SUPP_MSK  0x0060
2787 #define EHT_ML_MLD_CAPA_FREQ_SEP_FOR_STR_MASK         0x0f80
2788 #define EHT_ML_MLD_CAPA_AAR_SUPP                      0x1000
2789 
2790 #define EHT_PER_STA_CTRL_LINK_ID_MSK                  0x000f
2791 #define EHT_PER_STA_CTRL_COMPLETE_PROFILE_MSK         0x0010
2792 #define EHT_PER_STA_CTRL_MAC_ADDR_PRESENT_MSK         0x0020
2793 #define EHT_PER_STA_CTRL_BEACON_INTERVAL_PRESENT_MSK  0x0040
2794 #define EHT_PER_STA_CTRL_TSF_OFFSET_PRESENT_MSK       0x0080
2795 #define EHT_PER_STA_CTRL_DTIM_INFO_PRESENT_MSK        0x0100
2796 #define EHT_PER_STA_CTRL_NSTR_LINK_PAIR_PRESENT_MSK   0x0200
2797 #define EHT_PER_STA_CTRL_NSTR_BM_SIZE_MSK             0x0400
2798 #define EHT_PER_STA_CTRL_BSS_PARAM_CNT_PRESENT_MSK    0x0800
2799 
2800 /* IEEE P802.11be/D4.1, Figure 9-1001x - STA Control field format for the
2801  * Reconfiguration Multi-Link element */
2802 #define EHT_PER_STA_RECONF_CTRL_LINK_ID_MSK        0x000f
2803 #define EHT_PER_STA_RECONF_CTRL_COMPLETE_PROFILE   0x0010
2804 #define EHT_PER_STA_RECONF_CTRL_MAC_ADDR           0x0020
2805 #define EHT_PER_STA_RECONF_CTRL_AP_REMOVAL_TIMER   0x0040
2806 #define EHT_PER_STA_RECONF_CTRL_OP_UPDATE_TYPE_MSK 0x0780
2807 #define EHT_PER_STA_RECONF_CTRL_OP_PARAMS          0x0800
2808 #define EHT_PER_STA_RECONF_CTRL_NSTR_BITMAP_SIZE   0x1000
2809 #define EHT_PER_STA_RECONF_CTRL_NSTR_INDIC_BITMAP  0x2000
2810 
2811 /* IEEE P802.11be/D2.0, 9.4.2.312.2.4 - Per-STA Profile subelement format */
2812 struct ieee80211_eht_per_sta_profile {
2813 	le16 sta_control;
2814 
2815 	/* Followed by STA Info and STA Profile fields */
2816 	u8 variable[];
2817 } STRUCT_PACKED;
2818 
2819 /* IEEE P802.11be/D4.0, 9.4.2.312.3 - Probe Request Multi-Link element
2820  * Presence Bitmap field is B4..B15 of the Multi-Link Control field, i.e.,
2821  * B0 in the presence bitmap is B4 in the control field. */
2822 
2823 #define EHT_ML_PRES_BM_PROBE_REQ_AP_MLD_ID 0x0010
2824 
2825 struct eht_ml_probe_req_common_info {
2826 	u8 len;
2827 
2828 	/*
2829 	 * Followed by optional fields based on the multi link basic presence
2830 	 * bitmap
2831 	 *
2832 	 * AP MLD ID: 1 octet
2833 	 */
2834 	u8 variable[];
2835 } STRUCT_PACKED;
2836 
2837 /* IEEE P802.11be/D4.0, 9.4.2.312.4 - Reconfiguration Multi-Link element */
2838 
2839 #define RECONF_MULTI_LINK_CTRL_PRES_MLD_MAC_ADDR   0x0001
2840 
2841 #define EHT_PER_STA_RECONF_CTRL_LINK_ID_MSK        0x000f
2842 #define EHT_PER_STA_RECONF_CTRL_COMPLETE_PROFILE   0x0010
2843 #define EHT_PER_STA_RECONF_CTRL_MAC_ADDR           0x0020
2844 #define EHT_PER_STA_RECONF_CTRL_AP_REMOVAL_TIMER   0x0040
2845 #define EHT_PER_STA_RECONF_CTRL_OP_UPDATE_TYPE_MSK 0x0780
2846 #define EHT_PER_STA_RECONF_CTRL_OP_PARAMS          0x0800
2847 #define EHT_PER_STA_RECONF_CTRL_NSTR_BITMAP_SIZE   0x1000
2848 
2849 /* IEEE P802.11be/D2.0, 9.4.2.312.1 - Multi-Link element / General */
2850 
2851 struct ieee80211_eht_ml {
2852 	le16 ml_control;
2853 
2854 	/* Followed by Common Info and Link Info fields */
2855 	u8 variable[];
2856 } STRUCT_PACKED;
2857 
2858 /* Table 9-401c - Optional subelement IDs for Link Info field of the
2859  * Multi-Link element */
2860 enum ieee80211_eht_ml_sub_elem {
2861 	EHT_ML_SUB_ELEM_PER_STA_PROFILE = 0,
2862 	EHT_ML_SUB_ELEM_VENDOR = 221,
2863 	EHT_ML_SUB_ELEM_FRAGMENT = 254,
2864 };
2865 
2866 /* IEEE P802.11ay/D4.0, 9.4.2.251 - EDMG Operation element */
2867 #define EDMG_BSS_OPERATING_CHANNELS_OFFSET	6
2868 #define EDMG_OPERATING_CHANNEL_WIDTH_OFFSET	7
2869 
2870 /* IEEE P802.11ay/D4.0, 29.3.4 - Channelization */
2871 enum edmg_channel {
2872 	EDMG_CHANNEL_9	= 9,
2873 	EDMG_CHANNEL_10	= 10,
2874 	EDMG_CHANNEL_11	= 11,
2875 	EDMG_CHANNEL_12	= 12,
2876 	EDMG_CHANNEL_13	= 13,
2877 };
2878 
2879 /* Represent CB2 contiguous channels */
2880 #define EDMG_CHANNEL_9_SUBCHANNELS	(BIT(0) | BIT(1)) /* channels 1 and 2 */
2881 #define EDMG_CHANNEL_10_SUBCHANNELS	(BIT(1) | BIT(2)) /* channels 2 and 3 */
2882 #define EDMG_CHANNEL_11_SUBCHANNELS	(BIT(2) | BIT(3)) /* channels 3 and 4 */
2883 #define EDMG_CHANNEL_12_SUBCHANNELS	(BIT(3) | BIT(4)) /* channels 4 and 5 */
2884 #define EDMG_CHANNEL_13_SUBCHANNELS	(BIT(4) | BIT(5)) /* channels 5 and 6 */
2885 
2886 /**
2887  * enum edmg_bw_config - Allowed channel bandwidth configurations
2888  * @EDMG_BW_CONFIG_4: 2.16 GHz
2889  * @EDMG_BW_CONFIG_5: 2.16 GHz and 4.32 GHz
2890  *
2891  * IEEE P802.11ay/D4.0, 9.4.2.251 (EDMG Operation element),
2892  * Table 13 (Channel BW Configuration subfield definition)
2893  */
2894 enum edmg_bw_config {
2895 	EDMG_BW_CONFIG_4	= 4,
2896 	EDMG_BW_CONFIG_5	= 5,
2897 };
2898 
2899 /* DPP Public Action frame identifiers - OUI_WFA */
2900 #define DPP_OUI_TYPE 0x1A
2901 
2902 /* Robust AV streaming Action field values */
2903 enum robust_av_streaming_action {
2904 	ROBUST_AV_SCS_REQ = 0,
2905 	ROBUST_AV_SCS_RESP = 1,
2906 	ROBUST_AV_GROUP_MEMBERSHIP_REQ = 2,
2907 	ROBUST_AV_GROUP_MEMBERSHIP_RESP = 3,
2908 	ROBUST_AV_MSCS_REQ = 4,
2909 	ROBUST_AV_MSCS_RESP = 5,
2910 };
2911 
2912 enum scs_request_type {
2913 	SCS_REQ_ADD = 0,
2914 	SCS_REQ_REMOVE = 1,
2915 	SCS_REQ_CHANGE = 2,
2916 };
2917 
2918 /*
2919  * IEEE P802.11be/D4.0, 9.4.2.316 QoS Characteristics element,
2920  * Table 9-404s (Direction subfield encoding)
2921  */
2922 enum scs_direction {
2923 	SCS_DIRECTION_UP = 0,
2924 	SCS_DIRECTION_DOWN = 1,
2925 	SCS_DIRECTION_DIRECT = 2,
2926 };
2927 
2928 /*
2929  * IEEE P802.11be/D4.0, 9.4.2.316 QoS Characteristics element,
2930  * Figure 9-1001av (Control Info field format)
2931  */
2932 #define EHT_QOS_CONTROL_INFO_DIRECTION_OFFSET		0
2933 #define EHT_QOS_CONTROL_INFO_TID_OFFSET			2
2934 #define EHT_QOS_CONTROL_INFO_USER_PRIORITY_OFFSET	6
2935 #define EHT_QOS_CONTROL_INFO_PRESENCE_MASK_OFFSET	9
2936 #define EHT_QOS_CONTROL_INFO_LINK_ID_OFFSET		25
2937 
2938 /*
2939  * IEEE P802.11be/D4.0, 9.4.2.316 QoS Characteristics element,
2940  * Presence Bitmap Of Additional Parameters
2941  */
2942 #define SCS_QOS_BIT_MAX_MSDU_SIZE			((u16) BIT(0))
2943 #define SCS_QOS_BIT_SERVICE_START_TIME			((u16) BIT(1))
2944 #define SCS_QOS_BIT_SERVICE_START_TIME_LINKID		((u16) BIT(2))
2945 #define SCS_QOS_BIT_MEAN_DATA_RATE			((u16) BIT(3))
2946 #define SCS_QOS_BIT_DELAYED_BOUNDED_BURST_SIZE		((u16) BIT(4))
2947 #define SCS_QOS_BIT_MSDU_LIFETIME			((u16) BIT(5))
2948 #define SCS_QOS_BIT_MSDU_DELIVERY_INFO			((u16) BIT(6))
2949 #define SCS_QOS_BIT_MEDIUM_TIME				((u16) BIT(7))
2950 
2951 /* Optional subelement IDs for MSCS Descriptor element */
2952 enum mscs_description_subelem {
2953 	MCSC_SUBELEM_STATUS = 1,
2954 };
2955 
2956 /*
2957  * IEEE Std 802.11-2020, 9.6.7.36 FILS Discovery frame format,
2958  * Figure 9-900 - FILS Discovery Frame Control subfield format
2959  */
2960 #define FD_FRAME_CTL_CAP_PRESENT			((u16) BIT(5))
2961 #define FD_FRAME_CTL_SHORT_SSID_PRESENT			((u16) BIT(6))
2962 #define FD_FRAME_CTL_AP_CSN_PRESENT			((u16) BIT(7))
2963 #define FD_FRAME_CTL_ANO_PRESENT			((u16) BIT(8))
2964 #define FD_FRAME_CTL_FREQ_SEG1_PRESENT			((u16) BIT(9))
2965 #define FD_FRAME_CTL_PRI_CHAN_PRESENT			((u16) BIT(10))
2966 #define FD_FRAME_CTL_RSN_INFO_PRESENT			((u16) BIT(11))
2967 #define FD_FRAME_CTL_LENGTH_PRESENT			((u16) BIT(12))
2968 #define FD_FRAME_CTL_MD_PRESENT				((u16) BIT(13))
2969 
2970 /*
2971  * IEEE Std 802.11-2020, 9.6.7.36 FILS Discovery frame format,
2972  * Figure 9-901 - FD Capability subfield format
2973  */
2974 #define FD_CAP_ESS					BIT(0)
2975 #define FD_CAP_PRIVACY					BIT(1)
2976 #define FD_CAP_MULTI_BSSID_PRESENT			BIT(9)
2977 
2978 #define FD_CAP_BSS_CHWIDTH_20				0
2979 #define FD_CAP_BSS_CHWIDTH_40				1
2980 #define FD_CAP_BSS_CHWIDTH_80				2
2981 #define FD_CAP_BSS_CHWIDTH_160_80_80			3
2982 #define FD_CAP_BSS_CHWIDTH_320				4
2983 #define FD_CAP_BSS_CHWIDTH_SHIFT			2
2984 
2985 #define FD_CAP_NSS_1					0
2986 #define FD_CAP_NSS_2					1
2987 #define FD_CAP_NSS_3					2
2988 #define FD_CAP_NSS_4					3
2989 #define FD_CAP_NSS_5_8					4
2990 #define FD_CAP_NSS_SHIFT				5
2991 
2992 #define FD_CAP_PHY_INDEX_HR_DSSS			0
2993 #define FD_CAP_PHY_INDEX_ERP_OFDM			1
2994 #define FD_CAP_PHY_INDEX_HT				2
2995 #define FD_CAP_PHY_INDEX_VHT				3
2996 #define FD_CAP_PHY_INDEX_HE				4 /* P802.11ax */
2997 #define FD_CAP_PHY_INDEX_EHT				5 /* P802.11be */
2998 #define FD_CAP_PHY_INDEX_SHIFT				10
2999 
3000 /*
3001  * IEEE Std 802.11ax-2021, 26.17.2.3.2, AP behavior for fast passive scanning
3002  */
3003 #define FD_MAX_INTERVAL_6GHZ                  20 /* TUs */
3004 
3005 /* IEEE Std 802.11ax-2021, 26.17.3.5.1: AP needs to wait and see the collision
3006  * persists for at least the minimum default timeout
3007  * dot11BSSColorCollisionAPPeriod (50 seconds)
3008  */
3009 #define DOT11BSS_COLOR_COLLISION_AP_PERIOD	50
3010 
3011 /* Protected Vendor-specific QoS Management Action frame identifiers - WFA */
3012 #define QM_ACTION_VENDOR_TYPE 0x506f9a1a
3013 #define QM_ACTION_OUI_TYPE 0x1a
3014 
3015 /* QoS Management Action frame OUI subtypes */
3016 #define QM_DSCP_POLICY_QUERY 0
3017 #define QM_DSCP_POLICY_REQ 1
3018 #define QM_DSCP_POLICY_RESP 2
3019 
3020 /* QoS Management attributes */
3021 enum qm_attr_id {
3022 	QM_ATTR_PORT_RANGE = 1,
3023 	QM_ATTR_DSCP_POLICY = 2,
3024 	QM_ATTR_TCLAS = 3,
3025 	QM_ATTR_DOMAIN_NAME = 4,
3026 };
3027 
3028 /* DSCP Policy attribute - Request Type */
3029 enum dscp_policy_request_type {
3030 	DSCP_POLICY_REQ_ADD = 0, /* ADD/UPDATE */
3031 	DSCP_POLICY_REQ_REMOVE = 1,
3032 };
3033 
3034 /* Request/Response Control field of DSCP Policy Request/Response frame */
3035 #define DSCP_POLICY_CTRL_MORE	BIT(0)
3036 #define DSCP_POLICY_CTRL_RESET	BIT(1)
3037 
3038 /* Wi-Fi Alliance Capabilities element - Capabilities field */
3039 #define WFA_CAPA_QM_DSCP_POLICY BIT(0)
3040 #define WFA_CAPA_QM_UNSOLIC_DSCP BIT(1)
3041 #define WFA_CAPA_QM_NON_EHT_SCS_TRAFFIC_DESC BIT(2)
3042 
3043 struct ieee80211_neighbor_ap_info {
3044 	u8 tbtt_info_hdr;
3045 	u8 tbtt_info_len;
3046 	u8 op_class;
3047 	u8 channel;
3048 
3049 	/* Followed by the rest of the TBTT Information field contents */
3050 	u8 data[0];
3051 } STRUCT_PACKED;
3052 
3053 /* S1G Beacon Compatibility element */
3054 struct ieee80211_s1g_beacon_compat {
3055 	u8 element_id;
3056 	u8 length;
3057 	le16 compat_info;
3058 	le16 beacon_interval;
3059 	le32 tsf_completion;
3060 } STRUCT_PACKED;
3061 
3062 #ifdef _MSC_VER
3063 #pragma pack(pop)
3064 #endif /* _MSC_VER */
3065 
3066 #endif /* IEEE802_11_DEFS_H */
3067