1 /*- 2 * Copyright (c) 2020-2023 The FreeBSD Foundation 3 * Copyright (c) 2021-2022 Bjoern A. Zeeb 4 * 5 * This software was developed by Björn Zeeb under sponsorship from 6 * the FreeBSD Foundation. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 */ 29 30 #ifndef _LINUXKPI_NET_CFG80211_H 31 #define _LINUXKPI_NET_CFG80211_H 32 33 #include <linux/types.h> 34 #include <linux/nl80211.h> 35 #include <linux/ieee80211.h> 36 #include <linux/if_ether.h> 37 #include <linux/ethtool.h> 38 #include <linux/device.h> 39 #include <linux/netdevice.h> 40 #include <linux/random.h> 41 #include <linux/skbuff.h> 42 #include <net/regulatory.h> 43 44 /* linux_80211.c */ 45 extern int linuxkpi_debug_80211; 46 #ifndef D80211_TODO 47 #define D80211_TODO 0x1 48 #endif 49 #ifndef D80211_IMPROVE 50 #define D80211_IMPROVE 0x2 51 #endif 52 #define TODO(...) if (linuxkpi_debug_80211 & D80211_TODO) \ 53 printf("%s:%d: XXX LKPI80211 TODO\n", __func__, __LINE__) 54 #define IMPROVE(...) if (linuxkpi_debug_80211 & D80211_IMPROVE) \ 55 printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__) 56 57 enum rfkill_hard_block_reasons { 58 RFKILL_HARD_BLOCK_NOT_OWNER = BIT(0), 59 }; 60 61 #define WIPHY_PARAM_FRAG_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */ 62 #define WIPHY_PARAM_RETRY_LONG __LINE__ /* TODO FIXME brcmfmac */ 63 #define WIPHY_PARAM_RETRY_SHORT __LINE__ /* TODO FIXME brcmfmac */ 64 #define WIPHY_PARAM_RTS_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */ 65 66 #define CFG80211_SIGNAL_TYPE_MBM __LINE__ /* TODO FIXME brcmfmac */ 67 68 #define UPDATE_ASSOC_IES 1 69 70 #define IEEE80211_MAX_CHAINS 4 /* net80211: IEEE80211_MAX_CHAINS copied */ 71 72 enum cfg80211_rate_info_flags { 73 RATE_INFO_FLAGS_MCS = BIT(0), 74 RATE_INFO_FLAGS_VHT_MCS = BIT(1), 75 RATE_INFO_FLAGS_SHORT_GI = BIT(2), 76 RATE_INFO_FLAGS_HE_MCS = BIT(4), 77 RATE_INFO_FLAGS_EHT_MCS = BIT(7), 78 /* Max 8 bits as used in struct rate_info. */ 79 }; 80 81 extern const uint8_t rfc1042_header[6]; 82 extern const uint8_t bridge_tunnel_header[6]; 83 84 enum ieee80211_privacy { 85 IEEE80211_PRIVACY_ANY, 86 }; 87 88 enum ieee80211_bss_type { 89 IEEE80211_BSS_TYPE_ANY, 90 }; 91 92 enum cfg80211_bss_frame_type { 93 CFG80211_BSS_FTYPE_UNKNOWN, 94 CFG80211_BSS_FTYPE_BEACON, 95 CFG80211_BSS_FTYPE_PRESP, 96 }; 97 98 enum ieee80211_channel_flags { 99 IEEE80211_CHAN_DISABLED = BIT(0), 100 IEEE80211_CHAN_INDOOR_ONLY = BIT(1), 101 IEEE80211_CHAN_IR_CONCURRENT = BIT(2), 102 IEEE80211_CHAN_RADAR = BIT(3), 103 IEEE80211_CHAN_NO_IR = BIT(4), 104 IEEE80211_CHAN_NO_HT40MINUS = BIT(5), 105 IEEE80211_CHAN_NO_HT40PLUS = BIT(6), 106 IEEE80211_CHAN_NO_80MHZ = BIT(7), 107 IEEE80211_CHAN_NO_160MHZ = BIT(8), 108 IEEE80211_CHAN_NO_OFDM = BIT(9), 109 }; 110 #define IEEE80211_CHAN_NO_HT40 (IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS) 111 112 struct ieee80211_txrx_stypes { 113 uint16_t tx; 114 uint16_t rx; 115 }; 116 117 /* XXX net80211 has an ieee80211_channel as well. */ 118 struct linuxkpi_ieee80211_channel { 119 /* TODO FIXME */ 120 uint32_t hw_value; /* ic_ieee */ 121 uint32_t center_freq; /* ic_freq */ 122 enum ieee80211_channel_flags flags; /* ic_flags */ 123 enum nl80211_band band; 124 int8_t max_power; /* ic_maxpower */ 125 bool beacon_found; 126 int max_antenna_gain, max_reg_power; 127 int orig_flags; 128 int dfs_cac_ms, dfs_state; 129 int orig_mpwr; 130 }; 131 132 struct cfg80211_bitrate_mask { 133 /* TODO FIXME */ 134 struct { 135 uint32_t legacy; 136 uint8_t ht_mcs[IEEE80211_HT_MCS_MASK_LEN]; 137 uint16_t vht_mcs[8]; 138 uint16_t he_mcs[8]; 139 enum nl80211_txrate_gi gi; 140 enum nl80211_he_gi he_gi; 141 uint8_t he_ltf; /* XXX enum? */ 142 } control[NUM_NL80211_BANDS]; 143 }; 144 145 enum rate_info_bw { 146 RATE_INFO_BW_20 = 0, 147 RATE_INFO_BW_5, 148 RATE_INFO_BW_10, 149 RATE_INFO_BW_40, 150 RATE_INFO_BW_80, 151 RATE_INFO_BW_160, 152 RATE_INFO_BW_HE_RU, 153 RATE_INFO_BW_320, 154 RATE_INFO_BW_EHT_RU, 155 }; 156 157 struct rate_info { 158 uint8_t flags; /* enum cfg80211_rate_info_flags */ 159 uint8_t bw; 160 uint16_t legacy; 161 uint8_t mcs; 162 uint8_t nss; 163 uint8_t he_dcm; 164 uint8_t he_gi; 165 uint8_t he_ru_alloc; 166 uint8_t eht_gi; 167 }; 168 169 struct ieee80211_rate { 170 /* TODO FIXME */ 171 uint32_t bitrate; 172 uint32_t hw_value; 173 uint32_t hw_value_short; 174 uint32_t flags; 175 }; 176 177 struct ieee80211_sta_ht_cap { 178 bool ht_supported; 179 uint8_t ampdu_density; 180 uint8_t ampdu_factor; 181 uint16_t cap; 182 struct ieee80211_mcs_info mcs; 183 }; 184 185 /* XXX net80211 calls these IEEE80211_VHTCAP_* */ 186 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */ 187 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */ 188 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */ 189 #define IEEE80211_VHT_CAP_MAX_MPDU_MASK 0x00000003 /* IEEE80211_VHTCAP_MAX_MPDU_MASK */ 190 191 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S) 192 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S) 193 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000c /* IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK */ 194 195 #define IEEE80211_VHT_CAP_RXLDPC 0x00000010 /* IEEE80211_VHTCAP_RXLDPC */ 196 197 #define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 /* IEEE80211_VHTCAP_SHORT_GI_80 */ 198 #define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 /* IEEE80211_VHTCAP_SHORT_GI_160 */ 199 200 #define IEEE80211_VHT_CAP_TXSTBC 0x00000080 /* IEEE80211_VHTCAP_TXSTBC */ 201 202 #define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 /* IEEE80211_VHTCAP_RXSTBC_1 */ 203 #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 /* IEEE80211_VHTCAP_RXSTBC_MASK */ 204 205 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 /* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */ 206 207 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 /* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */ 208 209 #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 /* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */ 210 211 #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 /* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */ 212 213 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 /* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */ 214 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT) /* IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK */ 215 216 #define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 /* IEEE80211_VHTCAP_HTC_VHT */ 217 218 #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 /* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */ 219 #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 /* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */ 220 221 #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 /* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */ 222 223 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */ 224 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \ 225 (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT) /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */ 226 227 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */ 228 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ 229 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */ 230 231 #define IEEE80211_VHT_CAP_EXT_NSS_BW_MASK 0xc0000000 232 233 struct ieee80211_sta_vht_cap { 234 /* TODO FIXME */ 235 bool vht_supported; 236 uint32_t cap; 237 struct ieee80211_vht_mcs_info vht_mcs; 238 }; 239 240 enum ieee80211_vht_opmode { 241 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4, 242 }; 243 244 struct cfg80211_connect_resp_params { 245 /* XXX TODO */ 246 uint8_t *bssid; 247 const uint8_t *req_ie; 248 const uint8_t *resp_ie; 249 uint32_t req_ie_len; 250 uint32_t resp_ie_len; 251 int status; 252 }; 253 254 struct cfg80211_inform_bss { 255 /* XXX TODO */ 256 int boottime_ns, scan_width, signal; 257 struct linuxkpi_ieee80211_channel *chan; 258 }; 259 260 struct cfg80211_roam_info { 261 /* XXX TODO */ 262 uint8_t *bssid; 263 const uint8_t *req_ie; 264 const uint8_t *resp_ie; 265 uint32_t req_ie_len; 266 uint32_t resp_ie_len; 267 struct linuxkpi_ieee80211_channel *channel; 268 }; 269 270 struct cfg80211_bss_ies { 271 uint8_t *data; 272 size_t len; 273 }; 274 275 struct cfg80211_bss { 276 /* XXX TODO */ 277 struct cfg80211_bss_ies *ies; 278 }; 279 280 struct cfg80211_chan_def { 281 /* XXX TODO */ 282 struct linuxkpi_ieee80211_channel *chan; 283 enum nl80211_chan_width width; 284 uint32_t center_freq1; 285 uint32_t center_freq2; 286 }; 287 288 struct cfg80211_ftm_responder_stats { 289 /* XXX TODO */ 290 int asap_num, failed_num, filled, non_asap_num, out_of_window_triggers_num, partial_num, reschedule_requests_num, success_num, total_duration_ms, unknown_triggers_num; 291 }; 292 293 struct cfg80211_pmsr_capabilities { 294 /* XXX TODO */ 295 int max_peers, randomize_mac_addr, report_ap_tsf; 296 struct { 297 int asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based; 298 } ftm; 299 }; 300 301 struct cfg80211_pmsr_ftm_request { 302 /* XXX TODO */ 303 int asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based; 304 uint8_t bss_color; 305 bool lmr_feedback; 306 }; 307 308 struct cfg80211_pmsr_request_peer { 309 /* XXX TODO */ 310 struct cfg80211_chan_def chandef; 311 struct cfg80211_pmsr_ftm_request ftm; 312 uint8_t addr[ETH_ALEN]; 313 int report_ap_tsf; 314 }; 315 316 struct cfg80211_pmsr_request { 317 /* XXX TODO */ 318 int cookie, n_peers, timeout; 319 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; 320 struct cfg80211_pmsr_request_peer peers[]; 321 }; 322 323 struct cfg80211_pmsr_ftm_result { 324 /* XXX TODO */ 325 int burst_index, busy_retry_time, failure_reason; 326 int num_ftmr_successes, rssi_avg, rssi_avg_valid, rssi_spread, rssi_spread_valid, rtt_avg, rtt_avg_valid, rtt_spread, rtt_spread_valid, rtt_variance, rtt_variance_valid; 327 uint8_t *lci; 328 uint8_t *civicloc; 329 int lci_len; 330 int civicloc_len; 331 }; 332 333 struct cfg80211_pmsr_result { 334 /* XXX TODO */ 335 int ap_tsf, ap_tsf_valid, final, host_time, status, type; 336 uint8_t addr[ETH_ALEN]; 337 struct cfg80211_pmsr_ftm_result ftm; 338 }; 339 340 struct cfg80211_sar_freq_ranges { 341 uint32_t start_freq; 342 uint32_t end_freq; 343 }; 344 345 struct cfg80211_sar_sub_specs { 346 uint32_t freq_range_index; 347 int power; 348 }; 349 350 struct cfg80211_sar_specs { 351 enum nl80211_sar_type type; 352 uint32_t num_sub_specs; 353 struct cfg80211_sar_sub_specs sub_specs[]; 354 }; 355 356 struct cfg80211_sar_capa { 357 enum nl80211_sar_type type; 358 uint32_t num_freq_ranges; 359 const struct cfg80211_sar_freq_ranges *freq_ranges; 360 }; 361 362 struct cfg80211_ssid { 363 int ssid_len; 364 uint8_t ssid[IEEE80211_MAX_SSID_LEN]; 365 }; 366 367 struct cfg80211_scan_6ghz_params { 368 /* XXX TODO */ 369 uint8_t *bssid; 370 int channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe, psd_20; 371 }; 372 373 struct cfg80211_match_set { 374 uint8_t bssid[ETH_ALEN]; 375 struct cfg80211_ssid ssid; 376 int rssi_thold; 377 }; 378 379 struct cfg80211_scan_request { 380 /* XXX TODO */ 381 int duration, duration_mandatory, flags; 382 bool no_cck; 383 bool scan_6ghz; 384 struct wireless_dev *wdev; 385 struct wiphy *wiphy; 386 int ie_len; 387 uint8_t *ie; 388 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; 389 uint8_t bssid[ETH_ALEN]; 390 int n_ssids; 391 int n_6ghz_params; 392 int n_channels; 393 struct cfg80211_ssid *ssids; 394 struct cfg80211_scan_6ghz_params *scan_6ghz_params; 395 struct linuxkpi_ieee80211_channel *channels[0]; 396 }; 397 398 struct cfg80211_sched_scan_plan { 399 /* XXX TODO */ 400 int interval, iterations; 401 }; 402 403 struct cfg80211_sched_scan_request { 404 /* XXX TODO */ 405 int delay, flags; 406 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; 407 uint64_t reqid; 408 int n_match_sets; 409 int n_scan_plans; 410 int n_ssids; 411 int n_channels; 412 int ie_len; 413 uint8_t *ie; 414 struct cfg80211_match_set *match_sets; 415 struct cfg80211_sched_scan_plan *scan_plans; 416 struct cfg80211_ssid *ssids; 417 struct linuxkpi_ieee80211_channel *channels[0]; 418 }; 419 420 struct cfg80211_scan_info { 421 uint64_t scan_start_tsf; 422 uint8_t tsf_bssid[ETH_ALEN]; 423 bool aborted; 424 }; 425 426 struct cfg80211_beacon_data { 427 /* XXX TODO */ 428 const uint8_t *head; 429 const uint8_t *tail; 430 uint32_t head_len; 431 uint32_t tail_len; 432 const uint8_t *proberesp_ies; 433 const uint8_t *assocresp_ies; 434 uint32_t proberesp_ies_len; 435 uint32_t assocresp_ies_len; 436 }; 437 438 struct cfg80211_ap_settings { 439 /* XXX TODO */ 440 int auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout; 441 const uint8_t *ssid; 442 size_t ssid_len; 443 struct cfg80211_beacon_data beacon; 444 struct cfg80211_chan_def chandef; 445 }; 446 447 struct cfg80211_bss_selection { 448 /* XXX TODO */ 449 enum nl80211_bss_select_attr behaviour; 450 union { 451 enum nl80211_band band_pref; 452 struct { 453 enum nl80211_band band; 454 uint8_t delta; 455 } adjust; 456 } param; 457 }; 458 459 struct cfg80211_crypto { /* XXX made up name */ 460 /* XXX TODO */ 461 enum nl80211_wpa_versions wpa_versions; 462 uint32_t cipher_group; /* WLAN_CIPHER_SUITE_* */ 463 uint32_t *akm_suites; 464 uint32_t *ciphers_pairwise; 465 const uint8_t *sae_pwd; 466 const uint8_t *psk; 467 int n_akm_suites; 468 int n_ciphers_pairwise; 469 int sae_pwd_len; 470 }; 471 472 struct cfg80211_connect_params { 473 /* XXX TODO */ 474 struct linuxkpi_ieee80211_channel *channel; 475 uint8_t *bssid; 476 const uint8_t *ie; 477 const uint8_t *ssid; 478 uint32_t ie_len; 479 uint32_t ssid_len; 480 const void *key; 481 uint32_t key_len; 482 int auth_type, key_idx, privacy, want_1x; 483 struct cfg80211_bss_selection bss_select; 484 struct cfg80211_crypto crypto; 485 }; 486 487 enum bss_param_flags { /* Used as bitflags. XXX FIXME values? */ 488 BSS_PARAM_FLAGS_CTS_PROT = 0x01, 489 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 0x02, 490 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04, 491 }; 492 493 struct cfg80211_ibss_params { 494 /* XXX TODO */ 495 int basic_rates, beacon_interval; 496 int channel_fixed, ie, ie_len, privacy; 497 int dtim_period; 498 uint8_t *ssid; 499 uint8_t *bssid; 500 int ssid_len; 501 struct cfg80211_chan_def chandef; 502 enum bss_param_flags flags; 503 }; 504 505 struct cfg80211_mgmt_tx_params { 506 /* XXX TODO */ 507 struct linuxkpi_ieee80211_channel *chan; 508 const uint8_t *buf; 509 size_t len; 510 int wait; 511 }; 512 513 struct cfg80211_pmk_conf { 514 /* XXX TODO */ 515 const uint8_t *pmk; 516 uint8_t pmk_len; 517 }; 518 519 struct cfg80211_pmksa { 520 /* XXX TODO */ 521 const uint8_t *bssid; 522 const uint8_t *pmkid; 523 }; 524 525 struct station_del_parameters { 526 /* XXX TODO */ 527 const uint8_t *mac; 528 uint32_t reason_code; /* elsewhere uint16_t? */ 529 }; 530 531 struct station_info { 532 /* TODO FIXME */ 533 int assoc_req_ies_len, connected_time; 534 int generation, inactive_time, rx_bytes, rx_dropped_misc, rx_packets, signal, tx_bytes, tx_packets; 535 int filled, rx_beacon, rx_beacon_signal_avg, signal_avg; 536 int rx_duration, tx_duration, tx_failed, tx_retries; 537 int ack_signal, avg_ack_signal; 538 539 int chains; 540 uint8_t chain_signal[IEEE80211_MAX_CHAINS]; 541 uint8_t chain_signal_avg[IEEE80211_MAX_CHAINS]; 542 543 uint8_t *assoc_req_ies; 544 struct rate_info rxrate; 545 struct rate_info txrate; 546 struct cfg80211_ibss_params bss_param; 547 struct nl80211_sta_flag_update sta_flags; 548 }; 549 550 struct station_parameters { 551 /* XXX TODO */ 552 int sta_flags_mask, sta_flags_set; 553 }; 554 555 struct key_params { 556 /* XXX TODO */ 557 const uint8_t *key; 558 const uint8_t *seq; 559 int key_len; 560 int seq_len; 561 uint32_t cipher; /* WLAN_CIPHER_SUITE_* */ 562 }; 563 564 struct mgmt_frame_regs { 565 /* XXX TODO */ 566 int interface_stypes; 567 }; 568 569 struct vif_params { 570 /* XXX TODO */ 571 uint8_t macaddr[ETH_ALEN]; 572 }; 573 574 /* That the world needs so many different structs for this is amazing. */ 575 struct mac_address { 576 uint8_t addr[ETH_ALEN]; 577 }; 578 579 struct ieee80211_reg_rule { 580 /* TODO FIXME */ 581 uint32_t flags; 582 int dfs_cac_ms; 583 struct freq_range { 584 int start_freq_khz; 585 int end_freq_khz; 586 int max_bandwidth_khz; 587 } freq_range; 588 struct power_rule { 589 int max_antenna_gain; 590 int max_eirp; 591 } power_rule; 592 }; 593 594 struct linuxkpi_ieee80211_regdomain { 595 /* TODO FIXME */ 596 uint8_t alpha2[2]; 597 int dfs_region; 598 int n_reg_rules; 599 struct ieee80211_reg_rule reg_rules[]; 600 }; 601 602 /* XXX-BZ this are insensible values probably ... */ 603 #define IEEE80211_HE_MAC_CAP0_HTC_HE 0x1 604 #define IEEE80211_HE_MAC_CAP0_TWT_REQ 0x2 605 #define IEEE80211_HE_MAC_CAP0_TWT_RES 0x4 606 607 #define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION 0x1 608 #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8 0x2 609 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x4 610 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK 0x8 611 612 #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x1 613 #define IEEE80211_HE_MAC_CAP2_ACK_EN 0x2 614 #define IEEE80211_HE_MAC_CAP2_BSR 0x4 615 #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x8 616 #define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10 617 #define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x20 618 #define IEEE80211_HE_MAC_CAP2_MU_CASCADING 0x40 619 #define IEEE80211_HE_MAC_CAP2_TRS 0x80 620 621 #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x02 622 #define IEEE80211_HE_MAC_CAP3_OFDMA_RA 0x04 623 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1 0x08 624 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2 0x10 625 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 0x18 626 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x18 627 #define IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED 0x40 628 #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80 629 630 #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x1 631 #define IEEE80211_HE_MAC_CAP4_BQR 0x2 632 #define IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39 0x4 633 #define IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU 0x8 634 #define IEEE80211_HE_MAC_CAP4_OPS 0x10 635 #define IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG 0x20 636 637 #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x1 638 #define IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX 0x2 639 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x4 640 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x8 641 #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x10 642 #define IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX 0x20 643 #define IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING 0x40 644 #define IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION 0x80 645 646 #define IEEE80211_HE_MCS_NOT_SUPPORTED 0x0 647 #define IEEE80211_HE_MCS_SUPPORT_0_7 0x1 648 #define IEEE80211_HE_MCS_SUPPORT_0_9 0x2 649 #define IEEE80211_HE_MCS_SUPPORT_0_11 0x4 650 651 #define IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS 0x01 652 #define IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS 0x02 653 #define IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START 0x04 654 #define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN 0x08 655 #define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP 0x10 656 #define IEEE80211_HE_6GHZ_CAP_SM_PS 0x20 657 658 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x1 659 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x2 660 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x4 661 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G 0x8 662 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G 0x10 663 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G 0x20 664 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK 0x40 665 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL 0xff 666 667 #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x1 668 #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x2 669 #define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS 0x4 670 #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK 0x8 671 #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x10 672 673 #define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS 0x1 674 #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x2 675 #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x4 676 #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x8 677 #define IEEE80211_HE_PHY_CAP2_DOPPLER_TX 0x10 678 #define IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO 0x20 679 #define IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO 0x40 680 681 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x1 682 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM 0x2 683 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM 0x4 684 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x8 685 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 0x10 686 #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x20 687 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM 0x40 688 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM 0x80 689 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2 0x10 690 #define IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU 0x20 691 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK 0x40 692 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK 0x80 693 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK 0x80 694 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK 0x80 695 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK 0x80 696 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2 0x80 697 698 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8 0x1 699 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 0x2 700 #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x4 701 #define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER 0x8 702 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 0x10 703 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4 0x20 704 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK 0x40 705 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK 0x80 706 707 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 0x1 708 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 0x2 709 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK 0x4 710 #define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK 0x8 711 #define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK 0x10 712 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK 0x20 713 714 #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x1 715 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB 0x2 716 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB 0x4 717 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB 0x8 718 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB 0x20 719 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x40 720 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x80 721 #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x80 722 #define IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB 0x80 723 #define IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO 0x80 724 725 #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x1 726 #define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x2 727 #define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x4 728 #define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK 0x6 729 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR 0x8 730 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP 0x10 731 #define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ 0x20 732 #define IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ 0x40 733 #define IEEE80211_HE_PHY_CAP7_PSR_BASED_SR 0x80 734 735 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x1 736 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G 0x2 737 #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x4 738 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242 0x8 739 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484 0x10 740 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996 0x18 741 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996 0x20 742 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK 0x28 743 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI 0x40 744 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x80 745 746 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US 0x1 747 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2 748 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x4 749 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK 0x8 750 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x10 751 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS 0x0 752 #define IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK 0x20 753 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB 0x4 754 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB 0x8 755 #define IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU 0x10 756 #define IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU 0x20 757 #define IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM 0x40 758 759 #define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF 0x1 760 761 #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED 0x1 762 #define IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET 0x2 763 #define IEEE80211_HE_OPERATION_ER_SU_DISABLE 0x4 764 765 #define IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED 0x01 766 #define IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED 0x02 767 #define IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT 0x04 768 #define IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT 0x08 769 770 #define IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS 0x01 771 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454 0x02 772 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK 0x03 773 #define IEEE80211_EHT_MAC_CAP0_OM_CONTROL 0x04 774 #define IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 0x05 775 #define IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2 0x06 776 #define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_7991 0x07 777 778 #define IEEE80211_EHT_MAC_CAP1_MAX_AMPDU_LEN_MASK 0x01 779 780 #define IEEE80211_EHT_MCS_NSS_RX 0x01 781 #define IEEE80211_EHT_MCS_NSS_TX 0x02 782 783 #define IEEE80211_EHT_PHY_CAP0_242_TONE_RU_GT20MHZ 0x01 784 #define IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ 0x02 785 #define IEEE80211_EHT_PHY_CAP0_BEAMFORMEE_SS_80MHZ_MASK 0x03 786 #define IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI 0x04 787 #define IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO 0x05 788 #define IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE 0x06 789 #define IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER 0x07 790 791 #define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_160MHZ_MASK 0x01 792 #define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_320MHZ_MASK 0x02 793 #define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_80MHZ_MASK 0x03 794 795 #define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_80MHZ_MASK 0x01 796 #define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_160MHZ_MASK 0x02 797 #define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK 0x03 798 799 #define IEEE80211_EHT_PHY_CAP3_CODEBOOK_4_2_SU_FDBK 0x01 800 #define IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK 0x02 801 #define IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK 0x03 802 #define IEEE80211_EHT_PHY_CAP3_NG_16_SU_FEEDBACK 0x04 803 #define IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK 0x05 804 #define IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK 0x06 805 #define IEEE80211_EHT_PHY_CAP3_TRIG_SU_BF_FDBK 0x07 806 #define IEEE80211_EHT_PHY_CAP3_SOUNDING_DIM_320MHZ_MASK 0x08 807 808 #define IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI 0x01 809 #define IEEE80211_EHT_PHY_CAP4_PART_BW_DL_MU_MIMO 0x02 810 #define IEEE80211_EHT_PHY_CAP4_POWER_BOOST_FACT_SUPP 0x03 811 #define IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK 0x04 812 813 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_0US 0x01 814 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_16US 0x02 815 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_20US 0x03 816 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_8US 0x04 817 #define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK 0x05 818 #define IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK 0x06 819 #define IEEE80211_EHT_PHY_CAP5_PPE_THRESHOLD_PRESENT 0x07 820 #define IEEE80211_EHT_PHY_CAP5_RX_LESS_242_TONE_RU_SUPP 0x08 821 #define IEEE80211_EHT_PHY_CAP5_TX_LESS_242_TONE_RU_SUPP 0x09 822 #define IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK 0x0a 823 #define IEEE80211_EHT_PHY_CAP5_SUPP_EXTRA_EHT_LTF 0x0b 824 825 #define IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP 0x01 826 #define IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK 0x02 827 #define IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK 0x03 828 829 #define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ 0x01 830 #define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ 0x02 831 #define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ 0x03 832 #define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ 0x04 833 #define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ 0x05 834 #define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ 0x06 835 836 #define IEEE80211_EHT_PHY_CAP8_RX_1024QAM_WIDER_BW_DL_OFDMA 0x01 837 #define IEEE80211_EHT_PHY_CAP8_RX_4096QAM_WIDER_BW_DL_OFDMA 0x02 838 839 #define IEEE80211_EHT_PPE_THRES_INFO_HEADER_SIZE 0x01 840 #define IEEE80211_EHT_PPE_THRES_NSS_MASK 0x02 841 #define IEEE80211_EHT_PPE_THRES_RU_INDEX_BITMASK_MASK 0x03 842 #define IEEE80211_EHT_PPE_THRES_INFO_PPET_SIZE 0x04 843 844 #define IEEE80211_EML_CAP_EMLSR_SUPP 0x01 845 #define IEEE80211_EML_CAP_TRANSITION_TIMEOUT 0x02 846 #define IEEE80211_EML_CAP_TRANSITION_TIMEOUT_128TU 0x04 847 #define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY 0x08 848 #define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_32US 0x10 849 #define IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY 0x20 850 #define IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_64US 0x40 851 852 #define VENDOR_CMD_RAW_DATA (void *)(uintptr_t)(-ENOENT) 853 854 struct ieee80211_he_cap_elem { 855 u8 mac_cap_info[6]; 856 u8 phy_cap_info[11]; 857 } __packed; 858 859 struct ieee80211_he_mcs_nss_supp { 860 /* TODO FIXME */ 861 uint32_t rx_mcs_80; 862 uint32_t tx_mcs_80; 863 uint32_t rx_mcs_160; 864 uint32_t tx_mcs_160; 865 uint32_t rx_mcs_80p80; 866 uint32_t tx_mcs_80p80; 867 }; 868 869 #define IEEE80211_STA_HE_CAP_PPE_THRES_MAX 32 870 struct ieee80211_sta_he_cap { 871 /* TODO FIXME */ 872 int has_he; 873 struct ieee80211_he_cap_elem he_cap_elem; 874 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; 875 uint8_t ppe_thres[IEEE80211_STA_HE_CAP_PPE_THRES_MAX]; 876 }; 877 878 struct cfg80211_he_bss_color { 879 int color, enabled; 880 }; 881 882 struct ieee80211_he_obss_pd { 883 bool enable; 884 uint8_t min_offset; 885 uint8_t max_offset; 886 uint8_t non_srg_max_offset; 887 uint8_t sr_ctrl; 888 uint8_t bss_color_bitmap[8]; 889 uint8_t partial_bssid_bitmap[8]; 890 }; 891 892 struct ieee80211_sta_he_6ghz_capa { 893 /* TODO FIXME */ 894 int capa; 895 }; 896 897 struct ieee80211_eht_mcs_nss_supp_20mhz_only { 898 uint8_t rx_tx_mcs7_max_nss; 899 uint8_t rx_tx_mcs9_max_nss; 900 uint8_t rx_tx_mcs11_max_nss; 901 uint8_t rx_tx_mcs13_max_nss; 902 }; 903 904 struct ieee80211_eht_mcs_nss_supp_bw { 905 uint8_t rx_tx_mcs9_max_nss; 906 uint8_t rx_tx_mcs11_max_nss; 907 uint8_t rx_tx_mcs13_max_nss; 908 }; 909 910 struct ieee80211_eht_cap_elem_fixed { 911 uint8_t mac_cap_info[2]; 912 uint8_t phy_cap_info[9]; 913 }; 914 915 struct ieee80211_eht_mcs_nss_supp { 916 /* TODO FIXME */ 917 /* Can only have either or... */ 918 union { 919 struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz; 920 struct { 921 struct ieee80211_eht_mcs_nss_supp_bw _80; 922 struct ieee80211_eht_mcs_nss_supp_bw _160; 923 struct ieee80211_eht_mcs_nss_supp_bw _320; 924 } bw; 925 }; 926 }; 927 928 #define IEEE80211_STA_EHT_PPE_THRES_MAX 32 929 struct ieee80211_sta_eht_cap { 930 bool has_eht; 931 struct ieee80211_eht_cap_elem_fixed eht_cap_elem; 932 struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp; 933 uint8_t eht_ppe_thres[IEEE80211_STA_EHT_PPE_THRES_MAX]; 934 }; 935 936 struct ieee80211_sband_iftype_data { 937 /* TODO FIXME */ 938 enum nl80211_iftype types_mask; 939 struct ieee80211_sta_he_cap he_cap; 940 struct ieee80211_sta_he_6ghz_capa he_6ghz_capa; 941 struct ieee80211_sta_eht_cap eht_cap; 942 struct { 943 const uint8_t *data; 944 size_t len; 945 } vendor_elems; 946 }; 947 948 struct ieee80211_supported_band { 949 /* TODO FIXME */ 950 struct linuxkpi_ieee80211_channel *channels; 951 struct ieee80211_rate *bitrates; 952 struct ieee80211_sband_iftype_data *iftype_data; 953 int n_channels; 954 int n_bitrates; 955 int n_iftype_data; 956 enum nl80211_band band; 957 struct ieee80211_sta_ht_cap ht_cap; 958 struct ieee80211_sta_vht_cap vht_cap; 959 }; 960 961 struct cfg80211_pkt_pattern { 962 /* XXX TODO */ 963 uint8_t *mask; 964 uint8_t *pattern; 965 int pattern_len; 966 int pkt_offset; 967 }; 968 969 struct cfg80211_wowlan_nd_match { 970 /* XXX TODO */ 971 struct cfg80211_ssid ssid; 972 int n_channels; 973 uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */ 974 }; 975 976 struct cfg80211_wowlan_nd_info { 977 /* XXX TODO */ 978 int n_matches; 979 struct cfg80211_wowlan_nd_match *matches[0]; 980 }; 981 982 enum wiphy_wowlan_support_flags { 983 WIPHY_WOWLAN_DISCONNECT, 984 WIPHY_WOWLAN_GTK_REKEY_FAILURE, 985 WIPHY_WOWLAN_MAGIC_PKT, 986 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY, 987 WIPHY_WOWLAN_NET_DETECT, 988 }; 989 990 struct wiphy_wowlan_support { 991 /* XXX TODO */ 992 enum wiphy_wowlan_support_flags flags; 993 int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len; 994 }; 995 996 struct cfg80211_wowlan_wakeup { 997 /* XXX TODO */ 998 uint16_t pattern_idx; 999 bool disconnect; 1000 bool eap_identity_req; 1001 bool four_way_handshake; 1002 bool gtk_rekey_failure; 1003 bool magic_pkt; 1004 bool rfkill_release; 1005 bool tcp_connlost; 1006 bool tcp_nomoretokens; 1007 bool tcp_match; 1008 bool packet_80211; 1009 struct cfg80211_wowlan_nd_info *net_detect; 1010 uint8_t *packet; 1011 uint16_t packet_len; 1012 uint16_t packet_present_len; 1013 }; 1014 1015 struct cfg80211_wowlan { 1016 /* XXX TODO */ 1017 int disconnect, gtk_rekey_failure, magic_pkt; 1018 int eap_identity_req, four_way_handshake, rfkill_release, tcp, any; 1019 int n_patterns; 1020 struct cfg80211_sched_scan_request *nd_config; 1021 struct cfg80211_pkt_pattern *patterns; 1022 }; 1023 1024 struct cfg80211_gtk_rekey_data { 1025 /* XXX TODO */ 1026 const uint8_t *kck, *kek, *replay_ctr; 1027 uint32_t akm; 1028 uint8_t kck_len, kek_len; 1029 }; 1030 1031 struct cfg80211_tid_cfg { 1032 /* XXX TODO */ 1033 int mask, noack, retry_long, rtscts, tids, amsdu, ampdu; 1034 enum nl80211_tx_rate_setting txrate_type; 1035 struct cfg80211_bitrate_mask txrate_mask; 1036 }; 1037 1038 struct cfg80211_tid_config { 1039 /* XXX TODO */ 1040 int n_tid_conf; 1041 struct cfg80211_tid_cfg tid_conf[0]; 1042 }; 1043 1044 struct ieee80211_iface_limit { 1045 /* TODO FIXME */ 1046 int max, types; 1047 }; 1048 1049 struct ieee80211_iface_combination { 1050 /* TODO FIXME */ 1051 const struct ieee80211_iface_limit *limits; 1052 int n_limits; 1053 int max_interfaces, num_different_channels; 1054 int beacon_int_infra_match, beacon_int_min_gcd; 1055 int radar_detect_widths; 1056 }; 1057 1058 struct iface_combination_params { 1059 int num_different_channels; 1060 int iftype_num[NUM_NL80211_IFTYPES]; 1061 }; 1062 1063 struct regulatory_request { 1064 /* XXX TODO */ 1065 uint8_t alpha2[2]; 1066 enum environment_cap country_ie_env; 1067 int initiator, dfs_region; 1068 int user_reg_hint_type; 1069 }; 1070 1071 struct cfg80211_set_hw_timestamp { 1072 const uint8_t *macaddr; 1073 bool enable; 1074 }; 1075 1076 enum wiphy_vendor_cmd_need_flags { 1077 WIPHY_VENDOR_CMD_NEED_NETDEV = 0x01, 1078 WIPHY_VENDOR_CMD_NEED_RUNNING = 0x02, 1079 WIPHY_VENDOR_CMD_NEED_WDEV = 0x04, 1080 }; 1081 1082 struct wiphy_vendor_command { 1083 struct { 1084 uint32_t vendor_id; 1085 uint32_t subcmd; 1086 }; 1087 uint32_t flags; 1088 void *policy; 1089 int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int); 1090 }; 1091 1092 struct wiphy_iftype_ext_capab { 1093 /* TODO FIXME */ 1094 enum nl80211_iftype iftype; 1095 const uint8_t *extended_capabilities; 1096 const uint8_t *extended_capabilities_mask; 1097 uint8_t extended_capabilities_len; 1098 uint16_t eml_capabilities; 1099 1100 }; 1101 1102 struct tid_config_support { 1103 /* TODO FIXME */ 1104 uint64_t vif; /* enum nl80211_tid_cfg_attr */ 1105 uint64_t peer; /* enum nl80211_tid_cfg_attr */ 1106 }; 1107 1108 enum cfg80211_regulatory { 1109 REGULATORY_CUSTOM_REG = BIT(0), 1110 REGULATORY_STRICT_REG = BIT(1), 1111 REGULATORY_DISABLE_BEACON_HINTS = BIT(2), 1112 REGULATORY_ENABLE_RELAX_NO_IR = BIT(3), 1113 REGULATORY_WIPHY_SELF_MANAGED = BIT(4), 1114 REGULATORY_COUNTRY_IE_IGNORE = BIT(5), 1115 REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(6), 1116 }; 1117 1118 enum wiphy_flags { 1119 WIPHY_FLAG_AP_UAPSD = BIT(0), 1120 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(1), 1121 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(2), 1122 WIPHY_FLAG_HAVE_AP_SME = BIT(3), 1123 WIPHY_FLAG_IBSS_RSN = BIT(4), 1124 WIPHY_FLAG_NETNS_OK = BIT(5), 1125 WIPHY_FLAG_OFFCHAN_TX = BIT(6), 1126 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(7), 1127 WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(8), 1128 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(9), 1129 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(10), 1130 WIPHY_FLAG_SUPPORTS_TDLS = BIT(11), 1131 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(12), 1132 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(13), 1133 WIPHY_FLAG_4ADDR_AP = BIT(14), 1134 WIPHY_FLAG_4ADDR_STATION = BIT(15), 1135 WIPHY_FLAG_SUPPORTS_MLO = BIT(16), 1136 }; 1137 1138 struct wiphy { 1139 1140 struct device *dev; 1141 struct mac_address *addresses; 1142 int n_addresses; 1143 uint32_t flags; 1144 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 1145 uint8_t perm_addr[ETH_ALEN]; 1146 uint16_t max_scan_ie_len; 1147 1148 /* XXX TODO */ 1149 const struct cfg80211_pmsr_capabilities *pmsr_capa; 1150 const struct cfg80211_sar_capa *sar_capa; 1151 const struct wiphy_iftype_ext_capab *iftype_ext_capab; 1152 const struct linuxkpi_ieee80211_regdomain *regd; 1153 char fw_version[ETHTOOL_FWVERS_LEN]; 1154 const struct ieee80211_iface_combination *iface_combinations; 1155 const uint32_t *cipher_suites; 1156 int n_iface_combinations; 1157 int n_cipher_suites; 1158 void(*reg_notifier)(struct wiphy *, struct regulatory_request *); 1159 enum cfg80211_regulatory regulatory_flags; 1160 int n_vendor_commands; 1161 const struct wiphy_vendor_command *vendor_commands; 1162 const struct ieee80211_txrx_stypes *mgmt_stypes; 1163 uint32_t rts_threshold; 1164 uint32_t frag_threshold; 1165 struct tid_config_support tid_config_support; 1166 uint8_t available_antennas_rx; 1167 uint8_t available_antennas_tx; 1168 1169 int features, hw_version; 1170 int interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ssids, max_sched_scan_ie_len, max_sched_scan_plan_interval, max_sched_scan_plan_iterations, max_sched_scan_plans, max_sched_scan_reqs, max_sched_scan_ssids; 1171 int num_iftype_ext_capab; 1172 int max_ap_assoc_sta, probe_resp_offload, software_iftypes; 1173 int bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type; 1174 int max_data_retry_count; 1175 int tx_queue_len, rfkill; 1176 int mbssid_max_interfaces; 1177 int hw_timestamp_max_peers; 1178 int ema_max_profile_periodicity; 1179 1180 unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)]; 1181 struct dentry *debugfsdir; 1182 struct cfg80211_wowlan_support *wowlan; 1183 /* Lower layer (driver/mac80211) specific data. */ 1184 /* Must stay last. */ 1185 uint8_t priv[0] __aligned(CACHE_LINE_SIZE); 1186 }; 1187 1188 struct wireless_dev { 1189 /* XXX TODO, like ic? */ 1190 int iftype; 1191 int address; 1192 struct net_device *netdev; 1193 struct wiphy *wiphy; 1194 }; 1195 1196 struct cfg80211_ops { 1197 /* XXX TODO */ 1198 struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *); 1199 int (*del_virtual_intf)(struct wiphy *, struct wireless_dev *); 1200 s32 (*change_virtual_intf)(struct wiphy *, struct net_device *, enum nl80211_iftype, struct vif_params *); 1201 s32 (*scan)(struct wiphy *, struct cfg80211_scan_request *); 1202 s32 (*set_wiphy_params)(struct wiphy *, u32); 1203 s32 (*join_ibss)(struct wiphy *, struct net_device *, struct cfg80211_ibss_params *); 1204 s32 (*leave_ibss)(struct wiphy *, struct net_device *); 1205 s32 (*get_station)(struct wiphy *, struct net_device *, const u8 *, struct station_info *); 1206 int (*dump_station)(struct wiphy *, struct net_device *, int, u8 *, struct station_info *); 1207 s32 (*set_tx_power)(struct wiphy *, struct wireless_dev *, enum nl80211_tx_power_setting, s32); 1208 s32 (*get_tx_power)(struct wiphy *, struct wireless_dev *, s32 *); 1209 s32 (*add_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, struct key_params *); 1210 s32 (*del_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *); 1211 s32 (*get_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, void *, void(*)(void *, struct key_params *)); 1212 s32 (*set_default_key)(struct wiphy *, struct net_device *, u8, bool, bool); 1213 s32 (*set_default_mgmt_key)(struct wiphy *, struct net_device *, u8); 1214 s32 (*set_power_mgmt)(struct wiphy *, struct net_device *, bool, s32); 1215 s32 (*connect)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *); 1216 s32 (*disconnect)(struct wiphy *, struct net_device *, u16); 1217 s32 (*suspend)(struct wiphy *, struct cfg80211_wowlan *); 1218 s32 (*resume)(struct wiphy *); 1219 s32 (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *); 1220 s32 (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *); 1221 s32 (*flush_pmksa)(struct wiphy *, struct net_device *); 1222 s32 (*start_ap)(struct wiphy *, struct net_device *, struct cfg80211_ap_settings *); 1223 int (*stop_ap)(struct wiphy *, struct net_device *); 1224 s32 (*change_beacon)(struct wiphy *, struct net_device *, struct cfg80211_beacon_data *); 1225 int (*del_station)(struct wiphy *, struct net_device *, struct station_del_parameters *); 1226 int (*change_station)(struct wiphy *, struct net_device *, const u8 *, struct station_parameters *); 1227 int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *); 1228 int (*sched_scan_stop)(struct wiphy *, struct net_device *, u64); 1229 void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *); 1230 int (*mgmt_tx)(struct wiphy *, struct wireless_dev *, struct cfg80211_mgmt_tx_params *, u64 *); 1231 int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, u64); 1232 int (*get_channel)(struct wiphy *, struct wireless_dev *, struct cfg80211_chan_def *); 1233 int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, u16); 1234 void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *); 1235 int (*tdls_oper)(struct wiphy *, struct net_device *, const u8 *, enum nl80211_tdls_operation); 1236 int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, u32); 1237 int (*set_pmk)(struct wiphy *, struct net_device *, const struct cfg80211_pmk_conf *); 1238 int (*del_pmk)(struct wiphy *, struct net_device *, const u8 *); 1239 int (*remain_on_channel)(struct wiphy *, struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int, u64 *); 1240 int (*start_p2p_device)(struct wiphy *, struct wireless_dev *); 1241 void (*stop_p2p_device)(struct wiphy *, struct wireless_dev *); 1242 }; 1243 1244 1245 /* -------------------------------------------------------------------------- */ 1246 1247 /* linux_80211.c */ 1248 1249 struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t); 1250 void linuxkpi_wiphy_free(struct wiphy *wiphy); 1251 1252 int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 1253 struct linuxkpi_ieee80211_regdomain *regd); 1254 uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band); 1255 uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t); 1256 struct linuxkpi_ieee80211_channel * 1257 linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t); 1258 struct cfg80211_bss *linuxkpi_cfg80211_get_bss(struct wiphy *, 1259 struct linuxkpi_ieee80211_channel *, const uint8_t *, 1260 const uint8_t *, size_t, enum ieee80211_bss_type, enum ieee80211_privacy); 1261 void linuxkpi_cfg80211_put_bss(struct wiphy *, struct cfg80211_bss *); 1262 void linuxkpi_cfg80211_bss_flush(struct wiphy *); 1263 1264 /* -------------------------------------------------------------------------- */ 1265 1266 static __inline struct wiphy * 1267 wiphy_new(const struct cfg80211_ops *ops, size_t priv_len) 1268 { 1269 1270 return (linuxkpi_wiphy_new(ops, priv_len)); 1271 } 1272 1273 static __inline void 1274 wiphy_free(struct wiphy *wiphy) 1275 { 1276 1277 linuxkpi_wiphy_free(wiphy); 1278 } 1279 1280 static __inline void * 1281 wiphy_priv(struct wiphy *wiphy) 1282 { 1283 1284 return (wiphy->priv); 1285 } 1286 1287 static __inline void 1288 set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1289 { 1290 1291 wiphy->dev = dev; 1292 } 1293 1294 static __inline struct device * 1295 wiphy_dev(struct wiphy *wiphy) 1296 { 1297 1298 return (wiphy->dev); 1299 } 1300 1301 #define wiphy_err(_wiphy, _fmt, ...) \ 1302 dev_err((_wiphy)->dev, _fmt, __VA_ARGS__) 1303 1304 static __inline const struct linuxkpi_ieee80211_regdomain * 1305 wiphy_dereference(struct wiphy *wiphy, 1306 const struct linuxkpi_ieee80211_regdomain *regd) 1307 { 1308 TODO(); 1309 return (NULL); 1310 } 1311 1312 static __inline void 1313 wiphy_lock(struct wiphy *wiphy) 1314 { 1315 TODO(); 1316 } 1317 1318 static __inline void 1319 wiphy_unlock(struct wiphy *wiphy) 1320 { 1321 TODO(); 1322 } 1323 1324 static __inline void 1325 wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, 1326 enum rfkill_hard_block_reasons reason) 1327 { 1328 TODO(); 1329 } 1330 1331 /* -------------------------------------------------------------------------- */ 1332 1333 static inline struct cfg80211_bss * 1334 cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan, 1335 const uint8_t *bssid, const uint8_t *ssid, size_t ssid_len, 1336 enum ieee80211_bss_type bss_type, enum ieee80211_privacy privacy) 1337 { 1338 1339 return (linuxkpi_cfg80211_get_bss(wiphy, chan, bssid, ssid, ssid_len, 1340 bss_type, privacy)); 1341 } 1342 1343 static inline void 1344 cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss) 1345 { 1346 1347 linuxkpi_cfg80211_put_bss(wiphy, bss); 1348 } 1349 1350 static inline void 1351 cfg80211_bss_flush(struct wiphy *wiphy) 1352 { 1353 1354 linuxkpi_cfg80211_bss_flush(wiphy); 1355 } 1356 1357 /* -------------------------------------------------------------------------- */ 1358 1359 static __inline bool 1360 rfkill_blocked(int rfkill) /* argument type? */ 1361 { 1362 TODO(); 1363 return (false); 1364 } 1365 1366 static __inline bool 1367 rfkill_soft_blocked(int rfkill) 1368 { 1369 TODO(); 1370 return (false); 1371 } 1372 1373 static __inline int 1374 reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq, 1375 struct ieee80211_reg_rule *rule) 1376 { 1377 1378 /* ETSI has special rules. FreeBSD regdb needs to learn about them. */ 1379 TODO(); 1380 1381 return (-ENXIO); 1382 } 1383 1384 static __inline const u8 * 1385 cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len, 1386 const u8 *match, int x, int y) 1387 { 1388 TODO(); 1389 return (NULL); 1390 } 1391 1392 static __inline const u8 * 1393 cfg80211_find_ie(uint8_t eid, const uint8_t *ie, uint32_t ielen) 1394 { 1395 TODO(); 1396 return (NULL); 1397 } 1398 1399 static __inline void 1400 cfg80211_pmsr_complete(struct wireless_dev *wdev, 1401 struct cfg80211_pmsr_request *req, gfp_t gfp) 1402 { 1403 TODO(); 1404 } 1405 1406 static __inline void 1407 cfg80211_pmsr_report(struct wireless_dev *wdev, 1408 struct cfg80211_pmsr_request *req, 1409 struct cfg80211_pmsr_result *result, gfp_t gfp) 1410 { 1411 TODO(); 1412 } 1413 1414 static __inline void 1415 cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 1416 struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag) 1417 { 1418 1419 KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__)); 1420 KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__)); 1421 1422 memset(chandef, 0, sizeof(*chandef)); 1423 chandef->chan = chan; 1424 chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */ 1425 1426 switch (chan_flag) { 1427 case NL80211_CHAN_NO_HT: 1428 chandef->width = NL80211_CHAN_WIDTH_20_NOHT; 1429 chandef->center_freq1 = chan->center_freq; 1430 break; 1431 default: 1432 IMPROVE("Also depends on our manual settings"); 1433 if (chan->flags & IEEE80211_CHAN_NO_HT40) 1434 chandef->width = NL80211_CHAN_WIDTH_20; 1435 else if (chan->flags & IEEE80211_CHAN_NO_80MHZ) 1436 chandef->width = NL80211_CHAN_WIDTH_40; 1437 else if (chan->flags & IEEE80211_CHAN_NO_160MHZ) 1438 chandef->width = NL80211_CHAN_WIDTH_80; 1439 else { 1440 chandef->width = NL80211_CHAN_WIDTH_160; 1441 IMPROVE("80P80 and 320 ..."); 1442 } 1443 chandef->center_freq1 = chan->center_freq; 1444 break; 1445 }; 1446 } 1447 1448 static __inline void 1449 cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, 1450 void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data) 1451 { 1452 TODO(); 1453 } 1454 1455 struct element { 1456 uint8_t id; 1457 uint8_t datalen; 1458 uint8_t data[0]; 1459 } __packed; 1460 1461 static inline const struct element * 1462 lkpi_cfg80211_find_elem_pattern(enum ieee80211_eid eid, 1463 const uint8_t *data, size_t len, uint8_t *pattern, size_t plen) 1464 { 1465 const struct element *elem; 1466 const uint8_t *p; 1467 size_t ielen; 1468 1469 p = data; 1470 elem = (const struct element *)p; 1471 ielen = len; 1472 while (elem != NULL && ielen > 1) { 1473 if ((2 + elem->datalen) > ielen) 1474 /* Element overruns our memory. */ 1475 return (NULL); 1476 if (elem->id == eid) { 1477 if (pattern == NULL) 1478 return (elem); 1479 if (elem->datalen >= plen && 1480 memcmp(elem->data, pattern, plen) == 0) 1481 return (elem); 1482 } 1483 ielen -= 2 + elem->datalen; 1484 p += 2 + elem->datalen; 1485 elem = (const struct element *)p; 1486 } 1487 1488 return (NULL); 1489 } 1490 1491 static inline const struct element * 1492 cfg80211_find_elem(enum ieee80211_eid eid, const uint8_t *data, size_t len) 1493 { 1494 1495 return (lkpi_cfg80211_find_elem_pattern(eid, data, len, NULL, 0)); 1496 } 1497 1498 static inline const struct element * 1499 ieee80211_bss_get_elem(struct cfg80211_bss *bss, uint32_t eid) 1500 { 1501 1502 if (bss->ies == NULL) 1503 return (NULL); 1504 return (cfg80211_find_elem(eid, bss->ies->data, bss->ies->len)); 1505 } 1506 1507 static inline const uint8_t * 1508 ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t eid) 1509 { 1510 1511 return ((const uint8_t *)ieee80211_bss_get_elem(bss, eid)); 1512 } 1513 1514 static inline uint8_t * 1515 cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 1516 uint8_t *data, size_t len) 1517 { 1518 const struct element *elem; 1519 uint8_t pattern[4] = { oui << 16, oui << 8, oui, oui_type }; 1520 uint8_t plen = 4; /* >= 3? oui_type always part of this? */ 1521 IMPROVE("plen currently always incl. oui_type"); 1522 1523 elem = lkpi_cfg80211_find_elem_pattern(IEEE80211_ELEMID_VENDOR, 1524 data, len, pattern, plen); 1525 if (elem == NULL) 1526 return (NULL); 1527 return (__DECONST(uint8_t *, elem)); 1528 } 1529 1530 static __inline uint32_t 1531 cfg80211_calculate_bitrate(struct rate_info *rate) 1532 { 1533 TODO(); 1534 return (-1); 1535 } 1536 1537 static __inline uint32_t 1538 ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band) 1539 { 1540 1541 return (linuxkpi_ieee80211_channel_to_frequency(channel, band)); 1542 } 1543 1544 static __inline uint32_t 1545 ieee80211_frequency_to_channel(uint32_t freq) 1546 { 1547 1548 return (linuxkpi_ieee80211_frequency_to_channel(freq, 0)); 1549 } 1550 1551 static __inline int 1552 regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 1553 struct linuxkpi_ieee80211_regdomain *regd) 1554 { 1555 IMPROVE(); 1556 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd)); 1557 } 1558 1559 static __inline int 1560 regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 1561 struct linuxkpi_ieee80211_regdomain *regd) 1562 { 1563 1564 IMPROVE(); 1565 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd)); 1566 } 1567 1568 static __inline int 1569 regulatory_set_wiphy_regd(struct wiphy *wiphy, 1570 struct linuxkpi_ieee80211_regdomain *regd) 1571 { 1572 1573 IMPROVE(); 1574 if (regd == NULL) 1575 return (EINVAL); 1576 1577 /* XXX-BZ wild guessing here based on brcmfmac. */ 1578 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 1579 wiphy->regd = regd; 1580 else 1581 return (EPERM); 1582 1583 /* XXX FIXME, do we have to do anything with reg_notifier? */ 1584 return (0); 1585 } 1586 1587 static __inline int 1588 regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2) 1589 { 1590 TODO(); 1591 return (-ENXIO); 1592 } 1593 1594 static __inline const char * 1595 reg_initiator_name(enum nl80211_reg_initiator initiator) 1596 { 1597 TODO(); 1598 return (NULL); 1599 } 1600 1601 static __inline struct linuxkpi_ieee80211_regdomain * 1602 rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd) 1603 { 1604 TODO(); 1605 return (NULL); 1606 } 1607 1608 static __inline struct ieee80211_reg_rule * 1609 freq_reg_info(struct wiphy *wiphy, uint32_t center_freq) 1610 { 1611 TODO(); 1612 return (NULL); 1613 } 1614 1615 static __inline void 1616 wiphy_apply_custom_regulatory(struct wiphy *wiphy, 1617 const struct linuxkpi_ieee80211_regdomain *regd) 1618 { 1619 TODO(); 1620 } 1621 1622 static __inline char * 1623 wiphy_name(struct wiphy *wiphy) 1624 { 1625 if (wiphy != NULL && wiphy->dev != NULL) 1626 return dev_name(wiphy->dev); 1627 else { 1628 IMPROVE("wlanNA"); 1629 return ("wlanNA"); 1630 } 1631 } 1632 1633 static __inline void 1634 wiphy_read_of_freq_limits(struct wiphy *wiphy) 1635 { 1636 #ifdef FDT 1637 TODO(); 1638 #endif 1639 } 1640 1641 static __inline void 1642 wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef) 1643 { 1644 1645 set_bit(ef, wiphy->ext_features); 1646 } 1647 1648 static __inline void * 1649 wiphy_net(struct wiphy *wiphy) 1650 { 1651 TODO(); 1652 return (NULL); /* XXX passed to dev_net_set() */ 1653 } 1654 1655 static __inline int 1656 wiphy_register(struct wiphy *wiphy) 1657 { 1658 TODO(); 1659 return (0); 1660 } 1661 1662 static __inline void 1663 wiphy_unregister(struct wiphy *wiphy) 1664 { 1665 TODO(); 1666 } 1667 1668 static __inline void 1669 wiphy_warn(struct wiphy *wiphy, const char *fmt, ...) 1670 { 1671 TODO(); 1672 } 1673 1674 static __inline int 1675 cfg80211_check_combinations(struct wiphy *wiphy, 1676 struct iface_combination_params *params) 1677 { 1678 TODO(); 1679 return (-ENOENT); 1680 } 1681 1682 static __inline uint8_t 1683 cfg80211_classify8021d(struct sk_buff *skb, void *p) 1684 { 1685 TODO(); 1686 return (0); 1687 } 1688 1689 static __inline void 1690 cfg80211_connect_done(struct net_device *ndev, 1691 struct cfg80211_connect_resp_params *conn_params, gfp_t gfp) 1692 { 1693 TODO(); 1694 } 1695 1696 static __inline void 1697 cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp) 1698 { 1699 TODO(); 1700 } 1701 1702 static __inline void 1703 cfg80211_disconnected(struct net_device *ndev, uint16_t reason, 1704 void *p, int x, bool locally_generated, gfp_t gfp) 1705 { 1706 TODO(); 1707 } 1708 1709 static __inline int 1710 cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len, 1711 enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len) 1712 { 1713 TODO(); 1714 return (-1); 1715 } 1716 1717 static __inline void 1718 cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr, 1719 struct linuxkpi_ieee80211_channel *chan, gfp_t gfp) 1720 { 1721 TODO(); 1722 } 1723 1724 static __inline struct cfg80211_bss * 1725 cfg80211_inform_bss(struct wiphy *wiphy, 1726 struct linuxkpi_ieee80211_channel *channel, 1727 enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x, 1728 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, 1729 int signal, gfp_t gfp) 1730 { 1731 TODO(); 1732 return (NULL); 1733 } 1734 1735 static __inline struct cfg80211_bss * 1736 cfg80211_inform_bss_data(struct wiphy *wiphy, 1737 struct cfg80211_inform_bss *bss_data, 1738 enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x, 1739 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp) 1740 { 1741 TODO(); 1742 return (NULL); 1743 } 1744 1745 static __inline void 1746 cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie, 1747 const u8 *buf, size_t len, bool ack, gfp_t gfp) 1748 { 1749 TODO(); 1750 } 1751 1752 static __inline void 1753 cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr, 1754 enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp) 1755 { 1756 TODO(); 1757 } 1758 1759 static __inline void 1760 cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr, 1761 struct station_info *sinfo, gfp_t gfp) 1762 { 1763 TODO(); 1764 } 1765 1766 static __inline void 1767 cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp) 1768 { 1769 TODO(); 1770 } 1771 1772 static __inline void 1773 cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid, 1774 gfp_t gfp) 1775 { 1776 TODO(); 1777 } 1778 1779 static __inline void 1780 cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie, 1781 struct linuxkpi_ieee80211_channel *channel, unsigned int duration, 1782 gfp_t gfp) 1783 { 1784 TODO(); 1785 } 1786 1787 static __inline void 1788 cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, 1789 uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp) 1790 { 1791 TODO(); 1792 } 1793 1794 static __inline void 1795 cfg80211_report_wowlan_wakeup(void) 1796 { 1797 TODO(); 1798 } 1799 1800 static __inline void 1801 cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info, 1802 gfp_t gfp) 1803 { 1804 TODO(); 1805 } 1806 1807 static __inline void 1808 cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x, 1809 uint8_t *p, size_t p_len, int _x2) 1810 { 1811 TODO(); 1812 } 1813 1814 static __inline void 1815 cfg80211_scan_done(struct cfg80211_scan_request *scan_request, 1816 struct cfg80211_scan_info *info) 1817 { 1818 TODO(); 1819 } 1820 1821 static __inline void 1822 cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid) 1823 { 1824 TODO(); 1825 } 1826 1827 static __inline void 1828 cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x) 1829 { 1830 TODO(); 1831 } 1832 1833 static __inline void 1834 cfg80211_unregister_wdev(struct wireless_dev *wdev) 1835 { 1836 TODO(); 1837 } 1838 1839 static __inline struct sk_buff * 1840 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len) 1841 { 1842 TODO(); 1843 return (NULL); 1844 } 1845 1846 static __inline int 1847 cfg80211_vendor_cmd_reply(struct sk_buff *skb) 1848 { 1849 TODO(); 1850 return (-ENXIO); 1851 } 1852 1853 static __inline struct linuxkpi_ieee80211_channel * 1854 ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq) 1855 { 1856 1857 return (linuxkpi_ieee80211_get_channel(wiphy, freq)); 1858 } 1859 1860 static inline size_t 1861 ieee80211_get_hdrlen_from_skb(struct sk_buff *skb) 1862 { 1863 const struct ieee80211_hdr *hdr; 1864 size_t len; 1865 1866 if (skb->len < 10) /* sizeof(ieee80211_frame_[ack,cts]) */ 1867 return (0); 1868 1869 hdr = (const struct ieee80211_hdr *)skb->data; 1870 len = ieee80211_hdrlen(hdr->frame_control); 1871 1872 /* If larger than what is in the skb return. */ 1873 if (len > skb->len) 1874 return (0); 1875 1876 return (len); 1877 } 1878 1879 static __inline bool 1880 cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel) 1881 { 1882 1883 /* Only 6Ghz. */ 1884 if (channel->band != NL80211_BAND_6GHZ) 1885 return (false); 1886 1887 TODO(); 1888 return (false); 1889 } 1890 1891 static inline int 1892 cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len, 1893 enum nl80211_band band, enum cfg80211_bss_frame_type ftype) 1894 { 1895 const struct element *elem; 1896 1897 switch (band) { 1898 case NL80211_BAND_6GHZ: 1899 TODO(); 1900 break; 1901 case NL80211_BAND_5GHZ: 1902 case NL80211_BAND_2GHZ: 1903 /* DSPARAMS has the channel number. */ 1904 elem = cfg80211_find_elem(IEEE80211_ELEMID_DSPARMS, ie, len); 1905 if (elem != NULL && elem->datalen == 1) 1906 return (elem->data[0]); 1907 /* HTINFO has the primary center channel. */ 1908 elem = cfg80211_find_elem(IEEE80211_ELEMID_HTINFO, ie, len); 1909 if (elem != NULL && 1910 elem->datalen >= (sizeof(struct ieee80211_ie_htinfo) - 2)) { 1911 const struct ieee80211_ie_htinfo *htinfo; 1912 htinfo = (const struct ieee80211_ie_htinfo *)elem; 1913 return (htinfo->hi_ctrlchannel); 1914 } 1915 /* What else? */ 1916 break; 1917 default: 1918 IMPROVE("Unsupported"); 1919 break; 1920 } 1921 return (-1); 1922 } 1923 1924 /* Used for scanning at least. */ 1925 static __inline void 1926 get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask) 1927 { 1928 int i; 1929 1930 /* Get a completely random address and then overlay what we want. */ 1931 get_random_bytes(dst, ETH_ALEN); 1932 for (i = 0; i < ETH_ALEN; i++) 1933 dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]); 1934 } 1935 1936 static __inline void 1937 cfg80211_shutdown_all_interfaces(struct wiphy *wiphy) 1938 { 1939 TODO(); 1940 } 1941 1942 static __inline bool 1943 cfg80211_reg_can_beacon(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, 1944 enum nl80211_iftype iftype) 1945 { 1946 TODO(); 1947 return (false); 1948 } 1949 1950 static __inline void 1951 cfg80211_background_radar_event(struct wiphy *wiphy, 1952 struct cfg80211_chan_def *chandef, gfp_t gfp) 1953 { 1954 TODO(); 1955 } 1956 1957 static __inline const u8 * 1958 cfg80211_find_ext_ie(uint8_t eid, const uint8_t *p, size_t len) 1959 { 1960 TODO(); 1961 return (NULL); 1962 } 1963 1964 static __inline bool 1965 cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) 1966 { 1967 TODO(); 1968 return (false); 1969 } 1970 1971 static __inline const struct ieee80211_sta_eht_cap * 1972 ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *band, 1973 enum nl80211_iftype iftype) 1974 { 1975 TODO(); 1976 return (NULL); 1977 } 1978 1979 #define wiphy_info(wiphy, fmt, ...) \ 1980 printf("%s:%d XXX TODO " fmt, __func__, __LINE__, __VA_ARGS__) 1981 1982 #ifndef LINUXKPI_NET80211 1983 #define ieee80211_channel linuxkpi_ieee80211_channel 1984 #define ieee80211_regdomain linuxkpi_ieee80211_regdomain 1985 #endif 1986 1987 #include <net/mac80211.h> 1988 1989 #endif /* _LINUXKPI_NET_CFG80211_H */ 1990