1 /*- 2 * Copyright (c) 2020-2023 The FreeBSD Foundation 3 * 4 * This software was developed by Björn Zeeb under sponsorship from 5 * the FreeBSD Foundation. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29 #ifndef _LINUXKPI_LINUX_NL80211_H 30 #define _LINUXKPI_LINUX_NL80211_H 31 32 #include <linux/bitops.h> 33 34 enum nl80211_feature_flags { 35 NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE = BIT(0), 36 NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES = BIT(1), 37 NL80211_FEATURE_HT_IBSS = BIT(2), 38 NL80211_FEATURE_LOW_PRIORITY_SCAN = BIT(3), 39 NL80211_FEATURE_ND_RANDOM_MAC_ADDR = BIT(4), 40 NL80211_FEATURE_P2P_GO_CTWIN = BIT(5), 41 NL80211_FEATURE_P2P_GO_OPPPS = BIT(6), 42 NL80211_FEATURE_QUIET = BIT(7), 43 NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR = BIT(8), 44 NL80211_FEATURE_SCHED_SCAN_RANDOM_MAC_ADDR = BIT(9), 45 NL80211_FEATURE_DYNAMIC_SMPS = BIT(10), 46 NL80211_FEATURE_STATIC_SMPS = BIT(11), 47 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION = BIT(12), 48 NL80211_FEATURE_TDLS_CHANNEL_SWITCH = BIT(13), 49 NL80211_FEATURE_TX_POWER_INSERTION = BIT(14), 50 NL80211_FEATURE_WFA_TPC_IE_IN_PROBES = BIT(15), 51 NL80211_FEATURE_AP_SCAN = BIT(16), 52 NL80211_FEATURE_ACTIVE_MONITOR = BIT(17), 53 }; 54 55 enum nl80211_pmsr_ftm_failure_flags { 56 NL80211_PMSR_FTM_FAILURE_NO_RESPONSE = BIT(0), 57 NL80211_PMSR_FTM_FAILURE_PEER_BUSY = BIT(1), 58 NL80211_PMSR_FTM_FAILURE_UNSPECIFIED = BIT(2), 59 }; 60 61 enum nl80211_pmsr_status_flags { 62 NL80211_PMSR_STATUS_FAILURE = BIT(0), 63 NL80211_PMSR_STATUS_SUCCESS = BIT(1), 64 NL80211_PMSR_STATUS_TIMEOUT = BIT(2), 65 }; 66 67 #define NL80211_PMSR_TYPE_FTM 1 68 69 enum nl80211_reg_rule_flags { 70 NL80211_RRF_AUTO_BW = BIT(0), 71 NL80211_RRF_DFS = BIT(1), 72 NL80211_RRF_GO_CONCURRENT = BIT(2), 73 NL80211_RRF_NO_IR = BIT(3), 74 NL80211_RRF_NO_OUTDOOR = BIT(4), 75 NL80211_RRF_NO_HT40MINUS = BIT(5), 76 NL80211_RRF_NO_HT40PLUS = BIT(6), 77 NL80211_RRF_NO_80MHZ = BIT(7), 78 NL80211_RRF_NO_160MHZ = BIT(8), 79 NL80211_RRF_NO_HE = BIT(9), 80 NL80211_RRF_NO_OFDM = BIT(10), 81 NL80211_RRF_NO_320MHZ = BIT(11), 82 NL80211_RRF_NO_EHT = BIT(12), 83 }; 84 #define NL80211_RRF_NO_HT40 (NL80211_RRF_NO_HT40MINUS|NL80211_RRF_NO_HT40PLUS) 85 86 enum nl80211_scan_flags { 87 NL80211_SCAN_FLAG_FILS_MAX_CHANNEL_TIME = BIT(0), 88 NL80211_SCAN_FLAG_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION = BIT(1), 89 NL80211_SCAN_FLAG_OCE_PROBE_REQ_HIGH_TX_RATE = BIT(2), 90 NL80211_SCAN_FLAG_RANDOM_ADDR = BIT(3), 91 NL80211_SCAN_FLAG_COLOCATED_6GHZ = BIT(4), 92 NL80211_SCAN_FLAG_RANDOM_SN = BIT(5), 93 NL80211_SCAN_FLAG_ACCEPT_BCAST_PROBE_RESP = BIT(6), 94 }; 95 96 #define NL80211_MAX_SUPP_REG_RULES 512 /* TODO FIXME, random */ 97 98 #define NL80211_BSS_CHAN_WIDTH_20 __LINE__ /* TODO FIXME, brcmfmac */ 99 100 enum nl80211_wpa_versions { 101 NL80211_WPA_VERSION_1 = 1, 102 NL80211_WPA_VERSION_2, 103 NL80211_WPA_VERSION_3, 104 }; 105 106 enum nl80211_bss_select_attr { 107 __NL80211_BSS_SELECT_ATTR_INVALID = 0, 108 NL80211_BSS_SELECT_ATTR_BAND_PREF, 109 NL80211_BSS_SELECT_ATTR_RSSI, 110 NL80211_BSS_SELECT_ATTR_RSSI_ADJUST, 111 }; 112 113 enum nl80211_sta_flag { 114 /* XXX TODO */ 115 NL80211_STA_FLAG_ASSOCIATED, 116 NL80211_STA_FLAG_AUTHENTICATED, 117 NL80211_STA_FLAG_AUTHORIZED, 118 NL80211_STA_FLAG_TDLS_PEER, 119 NL80211_STA_FLAG_WME, 120 }; 121 122 enum nl80211_band { 123 /* XXX TODO */ 124 NL80211_BAND_2GHZ = 0, 125 NL80211_BAND_5GHZ, 126 NL80211_BAND_60GHZ, 127 NL80211_BAND_6GHZ, 128 129 /* Keep this last. */ 130 NUM_NL80211_BANDS 131 }; 132 133 enum nl80211_chan_flags { 134 /* XXX TODO */ 135 NL80211_CHAN_NO_HT, 136 }; 137 138 enum nl80211_chan_width { 139 /* XXX TODO */ 140 NL80211_CHAN_WIDTH_20_NOHT, 141 NL80211_CHAN_WIDTH_20, 142 NL80211_CHAN_WIDTH_40, 143 NL80211_CHAN_WIDTH_80, 144 NL80211_CHAN_WIDTH_80P80, 145 NL80211_CHAN_WIDTH_160, 146 NL80211_CHAN_WIDTH_5, 147 NL80211_CHAN_WIDTH_10, 148 NL80211_CHAN_WIDTH_320, 149 }; 150 151 enum nl80211_iftype { 152 /* XXX TODO */ 153 NL80211_IFTYPE_UNSPECIFIED, 154 NL80211_IFTYPE_ADHOC, 155 NL80211_IFTYPE_STATION, 156 NL80211_IFTYPE_AP, 157 NL80211_IFTYPE_AP_VLAN, 158 NL80211_IFTYPE_MONITOR, 159 NL80211_IFTYPE_P2P_CLIENT, 160 NL80211_IFTYPE_P2P_DEVICE, 161 NL80211_IFTYPE_P2P_GO, 162 NL80211_IFTYPE_MESH_POINT, 163 NL80211_IFTYPE_WDS, 164 NL80211_IFTYPE_OCB, 165 NL80211_IFTYPE_NAN, 166 167 /* Keep this last. */ 168 NUM_NL80211_IFTYPES 169 }; 170 171 enum nl80211_preamble { 172 /* XXX TODO */ 173 NL80211_PREAMBLE_LEGACY, 174 NL80211_PREAMBLE_HT, 175 NL80211_PREAMBLE_VHT, 176 NL80211_PREAMBLE_HE, 177 }; 178 179 enum nl80211_tdls_operation { 180 /* XXX TODO */ 181 NL80211_TDLS_SETUP, 182 NL80211_TDLS_TEARDOWN, 183 NL80211_TDLS_ENABLE_LINK, 184 NL80211_TDLS_DISABLE_LINK, 185 NL80211_TDLS_DISCOVERY_REQ, 186 NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY, 187 NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY, 188 }; 189 190 enum nl80211_cqm_rssi_threshold_event { 191 /* XXX TODO */ 192 NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW, 193 NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH, 194 }; 195 196 enum nl80211_ext_feature { 197 /* XXX TODO */ 198 NL80211_EXT_FEATURE_ACCEPT_BCAST_PROBE_RESP, 199 NL80211_EXT_FEATURE_BSS_PARENT_TSF, 200 NL80211_EXT_FEATURE_CAN_REPLACE_PTK0, 201 NL80211_EXT_FEATURE_DFS_OFFLOAD, 202 NL80211_EXT_FEATURE_ENABLE_FTM_RESPONDER, 203 NL80211_EXT_FEATURE_EXT_KEY_ID, 204 NL80211_EXT_FEATURE_FILS_MAX_CHANNEL_TIME, 205 NL80211_EXT_FEATURE_MU_MIMO_AIR_SNIFFER, 206 NL80211_EXT_FEATURE_OCE_PROBE_REQ_DEFERRAL_SUPPRESSION, 207 NL80211_EXT_FEATURE_OCE_PROBE_REQ_HIGH_TX_RATE, 208 NL80211_EXT_FEATURE_PROTECTED_TWT, 209 NL80211_EXT_FEATURE_SAE_OFFLOAD, 210 NL80211_EXT_FEATURE_SCAN_START_TIME, 211 NL80211_EXT_FEATURE_SET_SCAN_DWELL, 212 NL80211_EXT_FEATURE_VHT_IBSS, 213 NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_1X, 214 NL80211_EXT_FEATURE_4WAY_HANDSHAKE_STA_PSK, 215 NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT, 216 NL80211_EXT_FEATURE_SCAN_RANDOM_SN, 217 NL80211_EXT_FEATURE_STA_TX_PWR, 218 NL80211_EXT_FEATURE_CQM_RSSI_LIST, 219 NL80211_EXT_FEATURE_AQL, 220 NL80211_EXT_FEATURE_AIRTIME_FAIRNESS, 221 NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT, 222 NL80211_EXT_FEATURE_BEACON_RATE_LEGACY, 223 NL80211_EXT_FEATURE_BEACON_RATE_HT, 224 NL80211_EXT_FEATURE_BEACON_RATE_VHT, 225 NL80211_EXT_FEATURE_BEACON_RATE_HE, 226 NL80211_EXT_FEATURE_BSS_COLOR, 227 NL80211_EXT_FEATURE_FILS_DISCOVERY, 228 NL80211_EXT_FEATURE_RADAR_BACKGROUND, 229 NL80211_EXT_FEATURE_UNSOL_BCAST_PROBE_RESP, 230 NL80211_EXT_FEATURE_BEACON_PROTECTION, 231 NL80211_EXT_FEATURE_SCAN_MIN_PREQ_CONTENT, 232 NL80211_EXT_FEATURE_PUNCT, 233 234 /* Keep this last. */ 235 NUM_NL80211_EXT_FEATURES 236 }; 237 238 enum nl80211_sta_info { 239 /* XXX TODO */ 240 NL80211_STA_INFO_BEACON_RX, 241 NL80211_STA_INFO_BEACON_SIGNAL_AVG, 242 NL80211_STA_INFO_BSS_PARAM, 243 NL80211_STA_INFO_CHAIN_SIGNAL, 244 NL80211_STA_INFO_CONNECTED_TIME, 245 NL80211_STA_INFO_INACTIVE_TIME, 246 NL80211_STA_INFO_SIGNAL, 247 NL80211_STA_INFO_SIGNAL_AVG, 248 NL80211_STA_INFO_STA_FLAGS, 249 NL80211_STA_INFO_RX_BITRATE, 250 NL80211_STA_INFO_RX_PACKETS, 251 NL80211_STA_INFO_RX_BYTES, 252 NL80211_STA_INFO_RX_DROP_MISC, 253 NL80211_STA_INFO_TX_BITRATE, 254 NL80211_STA_INFO_TX_PACKETS, 255 NL80211_STA_INFO_TX_BYTES, 256 NL80211_STA_INFO_TX_BYTES64, 257 NL80211_STA_INFO_RX_BYTES64, 258 NL80211_STA_INFO_TX_FAILED, 259 NL80211_STA_INFO_TX_RETRIES, 260 NL80211_STA_INFO_RX_DURATION, 261 NL80211_STA_INFO_TX_DURATION, 262 NL80211_STA_INFO_ACK_SIGNAL, 263 NL80211_STA_INFO_ACK_SIGNAL_AVG, 264 }; 265 266 enum nl80211_ftm_stats { 267 /* XXX TODO */ 268 NL80211_FTM_STATS_ASAP_NUM, 269 NL80211_FTM_STATS_FAILED_NUM, 270 NL80211_FTM_STATS_NON_ASAP_NUM, 271 NL80211_FTM_STATS_OUT_OF_WINDOW_TRIGGERS_NUM, 272 NL80211_FTM_STATS_PARTIAL_NUM, 273 NL80211_FTM_STATS_RESCHEDULE_REQUESTS_NUM, 274 NL80211_FTM_STATS_SUCCESS_NUM, 275 NL80211_FTM_STATS_TOTAL_DURATION_MSEC, 276 NL80211_FTM_STATS_UNKNOWN_TRIGGERS_NUM, 277 }; 278 279 enum nl80211_reg_initiator { 280 /* XXX TODO */ 281 NL80211_REGDOM_SET_BY_USER, 282 NL80211_REGDOM_SET_BY_DRIVER, 283 NL80211_REGDOM_SET_BY_CORE, 284 NL80211_REGDOM_SET_BY_COUNTRY_IE, 285 }; 286 287 struct nl80211_sta_flag_update { 288 /* XXX TODO */ 289 int mask, set; 290 291 }; 292 293 enum nl80211_tx_power_setting { 294 /* XXX TODO */ 295 NL80211_TX_POWER_AUTOMATIC, 296 NL80211_TX_POWER_FIXED, 297 NL80211_TX_POWER_LIMITED, 298 }; 299 300 enum nl80211_crit_proto_id { 301 /* XXX TODO */ 302 NL80211_CRIT_PROTO_DHCP, 303 }; 304 305 enum nl80211_auth_type { 306 NL80211_AUTHTYPE_AUTOMATIC, 307 NL80211_AUTHTYPE_OPEN_SYSTEM, 308 NL80211_AUTHTYPE_SHARED_KEY, 309 NL80211_AUTHTYPE_SAE, 310 }; 311 312 enum nl80211_key_type { 313 NL80211_KEYTYPE_GROUP, 314 NL80211_KEYTYPE_PAIRWISE, 315 }; 316 317 enum nl80211_he_ru_alloc { 318 NL80211_RATE_INFO_HE_RU_ALLOC_26, 319 NL80211_RATE_INFO_HE_RU_ALLOC_52, 320 NL80211_RATE_INFO_HE_RU_ALLOC_106, 321 NL80211_RATE_INFO_HE_RU_ALLOC_242, 322 NL80211_RATE_INFO_HE_RU_ALLOC_484, 323 NL80211_RATE_INFO_HE_RU_ALLOC_996, 324 NL80211_RATE_INFO_HE_RU_ALLOC_2x996, 325 }; 326 327 enum nl80211_he_gi { 328 NL80211_RATE_INFO_HE_GI_0_8, 329 NL80211_RATE_INFO_HE_GI_1_6, 330 NL80211_RATE_INFO_HE_GI_3_2, 331 }; 332 333 enum nl80211_he_ltf { 334 NL80211_RATE_INFO_HE_1XLTF, 335 NL80211_RATE_INFO_HE_2XLTF, 336 NL80211_RATE_INFO_HE_4XLTF, 337 }; 338 339 enum nl80211_eht_gi { 340 NL80211_RATE_INFO_EHT_GI_0_8, 341 NL80211_RATE_INFO_EHT_GI_1_6, 342 NL80211_RATE_INFO_EHT_GI_3_2, 343 }; 344 345 enum nl80211_eht_ru_alloc { 346 NL80211_RATE_INFO_EHT_RU_ALLOC_26, 347 NL80211_RATE_INFO_EHT_RU_ALLOC_52, 348 NL80211_RATE_INFO_EHT_RU_ALLOC_52P26, 349 NL80211_RATE_INFO_EHT_RU_ALLOC_106, 350 NL80211_RATE_INFO_EHT_RU_ALLOC_106P26, 351 NL80211_RATE_INFO_EHT_RU_ALLOC_242, 352 NL80211_RATE_INFO_EHT_RU_ALLOC_484, 353 NL80211_RATE_INFO_EHT_RU_ALLOC_484P242, 354 NL80211_RATE_INFO_EHT_RU_ALLOC_996, 355 NL80211_RATE_INFO_EHT_RU_ALLOC_996P484, 356 NL80211_RATE_INFO_EHT_RU_ALLOC_996P484P242, 357 NL80211_RATE_INFO_EHT_RU_ALLOC_2x996, 358 NL80211_RATE_INFO_EHT_RU_ALLOC_2x996P484, 359 NL80211_RATE_INFO_EHT_RU_ALLOC_3x996, 360 NL80211_RATE_INFO_EHT_RU_ALLOC_3x996P484, 361 NL80211_RATE_INFO_EHT_RU_ALLOC_4x996, 362 }; 363 364 enum nl80211_dfs_regions { 365 NL80211_DFS_UNSET, 366 NL80211_DFS_FCC, 367 NL80211_DFS_ETSI, 368 NL80211_DFS_JP, 369 }; 370 371 enum nl80211_dfs_state { 372 NL80211_DFS_USABLE, 373 }; 374 375 enum nl80211_sar_type { 376 NL80211_SAR_TYPE_POWER, 377 }; 378 379 #define NL80211_VHT_NSS_MAX 8 380 #define NL80211_HE_NSS_MAX 8 381 382 enum nl80211_tid_cfg_attr { 383 NL80211_TID_CONFIG_ATTR_NOACK, 384 NL80211_TID_CONFIG_ATTR_RETRY_SHORT, 385 NL80211_TID_CONFIG_ATTR_TX_RATE_TYPE, 386 NL80211_TID_CONFIG_ATTR_TX_RATE, 387 NL80211_TID_CONFIG_ATTR_RTSCTS_CTRL, 388 NL80211_TID_CONFIG_ATTR_RETRY_LONG, 389 NL80211_TID_CONFIG_ATTR_AMPDU_CTRL, 390 NL80211_TID_CONFIG_ATTR_AMSDU_CTRL, 391 }; 392 393 enum nl80211_tid_config { 394 NL80211_TID_CONFIG_ENABLE, 395 }; 396 397 enum nl80211_tx_rate_setting { 398 NL80211_TX_RATE_AUTOMATIC, 399 NL80211_TX_RATE_FIXED, 400 NL80211_TX_RATE_LIMITED, 401 }; 402 403 enum nl80211_txrate_gi { 404 NL80211_TXRATE_DEFAULT_GI, 405 NL80211_TXRATE_FORCE_SGI, 406 NL80211_TXRATE_FORCE_LGI, 407 }; 408 409 enum nl80211_probe_resp_offload_support { 410 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2, 411 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS, 412 NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P, 413 }; 414 415 enum nl80211_user_reg_hint_type { 416 NL80211_USER_REG_HINT_USER, 417 }; 418 419 #define NL80211_KCK_LEN 16 420 #define NL80211_KCK_EXT_LEN 24 421 #define NL80211_KEK_LEN 16 422 #define NL80211_KEK_EXT_LEN 32 423 #define NL80211_REPLAY_CTR_LEN 8 424 #endif /* _LINUXKPI_LINUX_NL80211_H */ 425