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 */ 45extern 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 57enum 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 72enum 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 81extern const uint8_t rfc1042_header[6]; 82extern const uint8_t bridge_tunnel_header[6]; 83 84enum ieee80211_privacy { 85 IEEE80211_PRIVACY_ANY, 86}; 87 88enum ieee80211_bss_type { 89 IEEE80211_BSS_TYPE_ANY, 90}; 91 92enum cfg80211_bss_frame_type { 93 CFG80211_BSS_FTYPE_UNKNOWN, 94 CFG80211_BSS_FTYPE_BEACON, 95 CFG80211_BSS_FTYPE_PRESP, 96}; 97 98enum 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 112struct ieee80211_txrx_stypes { 113 uint16_t tx; 114 uint16_t rx; 115}; 116 117/* XXX net80211 has an ieee80211_channel as well. */ 118struct 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 132struct 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 145enum 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 157struct 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 169struct 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 177struct 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 233struct 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 240enum ieee80211_vht_opmode { 241 IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4, 242}; 243 244struct 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 254struct cfg80211_inform_bss { 255 /* XXX TODO */ 256 int boottime_ns, scan_width, signal; 257 struct linuxkpi_ieee80211_channel *chan; 258}; 259 260struct 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 270struct cfg80211_bss_ies { 271 uint8_t *data; 272 size_t len; 273}; 274 275struct cfg80211_bss { 276 /* XXX TODO */ 277 struct cfg80211_bss_ies *ies; 278}; 279 280struct 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 288struct 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 293struct 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 301struct 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 308struct 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 316struct 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 323struct 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 333struct 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 340struct cfg80211_sar_freq_ranges { 341 uint32_t start_freq; 342 uint32_t end_freq; 343}; 344 345struct cfg80211_sar_sub_specs { 346 uint32_t freq_range_index; 347 int power; 348}; 349 350struct 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 356struct 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 362struct cfg80211_ssid { 363 int ssid_len; 364 uint8_t ssid[IEEE80211_MAX_SSID_LEN]; 365}; 366 367struct 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 373struct cfg80211_match_set { 374 uint8_t bssid[ETH_ALEN]; 375 struct cfg80211_ssid ssid; 376 int rssi_thold; 377}; 378 379struct 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 398struct cfg80211_sched_scan_plan { 399 /* XXX TODO */ 400 int interval, iterations; 401}; 402 403struct 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 420struct cfg80211_scan_info { 421 uint64_t scan_start_tsf; 422 uint8_t tsf_bssid[ETH_ALEN]; 423 bool aborted; 424}; 425 426struct 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 438struct 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 447struct 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 459struct 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 472struct 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 487enum 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 493struct 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 505struct 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 513struct cfg80211_pmk_conf { 514 /* XXX TODO */ 515 const uint8_t *pmk; 516 uint8_t pmk_len; 517}; 518 519struct cfg80211_pmksa { 520 /* XXX TODO */ 521 const uint8_t *bssid; 522 const uint8_t *pmkid; 523}; 524 525struct station_del_parameters { 526 /* XXX TODO */ 527 const uint8_t *mac; 528 uint32_t reason_code; /* elsewhere uint16_t? */ 529}; 530 531struct 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 550struct station_parameters { 551 /* XXX TODO */ 552 int sta_flags_mask, sta_flags_set; 553}; 554 555struct 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 564struct mgmt_frame_regs { 565 /* XXX TODO */ 566 int interface_stypes; 567}; 568 569struct 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. */ 575struct mac_address { 576 uint8_t addr[ETH_ALEN]; 577}; 578 579struct 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 594struct 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 854struct ieee80211_he_cap_elem { 855 u8 mac_cap_info[6]; 856 u8 phy_cap_info[11]; 857} __packed; 858 859struct 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 870struct 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 878struct cfg80211_he_bss_color { 879 int color, enabled; 880}; 881 882struct 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 892struct ieee80211_sta_he_6ghz_capa { 893 /* TODO FIXME */ 894 int capa; 895}; 896 897struct 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 904struct 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 910struct ieee80211_eht_cap_elem_fixed { 911 uint8_t mac_cap_info[2]; 912 uint8_t phy_cap_info[9]; 913}; 914 915struct 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 929struct 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 936struct 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 948struct 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 961struct cfg80211_pkt_pattern { 962 /* XXX TODO */ 963 uint8_t *mask; 964 uint8_t *pattern; 965 int pattern_len; 966 int pkt_offset; 967}; 968 969struct 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 976struct cfg80211_wowlan_nd_info { 977 /* XXX TODO */ 978 int n_matches; 979 struct cfg80211_wowlan_nd_match *matches[0]; 980}; 981 982enum 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 990struct 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 996struct 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 1015struct 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 1024struct 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 1031struct 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 1038struct cfg80211_tid_config { 1039 /* XXX TODO */ 1040 int n_tid_conf; 1041 struct cfg80211_tid_cfg tid_conf[0]; 1042}; 1043 1044struct ieee80211_iface_limit { 1045 /* TODO FIXME */ 1046 int max, types; 1047}; 1048 1049struct 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 1058struct iface_combination_params { 1059 int num_different_channels; 1060 int iftype_num[NUM_NL80211_IFTYPES]; 1061}; 1062 1063struct 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 1071struct cfg80211_set_hw_timestamp { 1072 const uint8_t *macaddr; 1073 bool enable; 1074}; 1075 1076enum 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 1082struct 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 1092struct 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 1102struct 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 1108enum 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 1118enum 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 1138struct 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 1188struct wireless_dev { 1189 /* XXX TODO, like ic? */ 1190 int iftype; 1191 int address; 1192 struct net_device *netdev; 1193 struct wiphy *wiphy; 1194}; 1195 1196struct 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 1249struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t); 1250void linuxkpi_wiphy_free(struct wiphy *wiphy); 1251 1252int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 1253 struct linuxkpi_ieee80211_regdomain *regd); 1254uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band); 1255uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t); 1256struct linuxkpi_ieee80211_channel * 1257 linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t); 1258struct 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); 1261void linuxkpi_cfg80211_put_bss(struct wiphy *, struct cfg80211_bss *); 1262void linuxkpi_cfg80211_bss_flush(struct wiphy *); 1263struct linuxkpi_ieee80211_regdomain * 1264 lkpi_get_linuxkpi_ieee80211_regdomain(size_t); 1265 1266/* -------------------------------------------------------------------------- */ 1267 1268static __inline struct wiphy * 1269wiphy_new(const struct cfg80211_ops *ops, size_t priv_len) 1270{ 1271 1272 return (linuxkpi_wiphy_new(ops, priv_len)); 1273} 1274 1275static __inline void 1276wiphy_free(struct wiphy *wiphy) 1277{ 1278 1279 linuxkpi_wiphy_free(wiphy); 1280} 1281 1282static __inline void * 1283wiphy_priv(struct wiphy *wiphy) 1284{ 1285 1286 return (wiphy->priv); 1287} 1288 1289static __inline void 1290set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1291{ 1292 1293 wiphy->dev = dev; 1294} 1295 1296static __inline struct device * 1297wiphy_dev(struct wiphy *wiphy) 1298{ 1299 1300 return (wiphy->dev); 1301} 1302 1303#define wiphy_err(_wiphy, _fmt, ...) \ 1304 dev_err((_wiphy)->dev, _fmt, __VA_ARGS__) 1305 1306static __inline const struct linuxkpi_ieee80211_regdomain * 1307wiphy_dereference(struct wiphy *wiphy, 1308 const struct linuxkpi_ieee80211_regdomain *regd) 1309{ 1310 TODO(); 1311 return (NULL); 1312} 1313 1314static __inline void 1315wiphy_lock(struct wiphy *wiphy) 1316{ 1317 TODO(); 1318} 1319 1320static __inline void 1321wiphy_unlock(struct wiphy *wiphy) 1322{ 1323 TODO(); 1324} 1325 1326static __inline void 1327wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked, 1328 enum rfkill_hard_block_reasons reason) 1329{ 1330 TODO(); 1331} 1332 1333/* -------------------------------------------------------------------------- */ 1334 1335static inline struct cfg80211_bss * 1336cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan, 1337 const uint8_t *bssid, const uint8_t *ssid, size_t ssid_len, 1338 enum ieee80211_bss_type bss_type, enum ieee80211_privacy privacy) 1339{ 1340 1341 return (linuxkpi_cfg80211_get_bss(wiphy, chan, bssid, ssid, ssid_len, 1342 bss_type, privacy)); 1343} 1344 1345static inline void 1346cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss) 1347{ 1348 1349 linuxkpi_cfg80211_put_bss(wiphy, bss); 1350} 1351 1352static inline void 1353cfg80211_bss_flush(struct wiphy *wiphy) 1354{ 1355 1356 linuxkpi_cfg80211_bss_flush(wiphy); 1357} 1358 1359/* -------------------------------------------------------------------------- */ 1360 1361static __inline bool 1362rfkill_blocked(int rfkill) /* argument type? */ 1363{ 1364 TODO(); 1365 return (false); 1366} 1367 1368static __inline bool 1369rfkill_soft_blocked(int rfkill) 1370{ 1371 TODO(); 1372 return (false); 1373} 1374 1375static __inline int 1376reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq, 1377 struct ieee80211_reg_rule *rule) 1378{ 1379 1380 /* ETSI has special rules. FreeBSD regdb needs to learn about them. */ 1381 TODO(); 1382 1383 return (-ENXIO); 1384} 1385 1386static __inline const u8 * 1387cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len, 1388 const u8 *match, int x, int y) 1389{ 1390 TODO(); 1391 return (NULL); 1392} 1393 1394static __inline const u8 * 1395cfg80211_find_ie(uint8_t eid, const uint8_t *ie, uint32_t ielen) 1396{ 1397 TODO(); 1398 return (NULL); 1399} 1400 1401static __inline void 1402cfg80211_pmsr_complete(struct wireless_dev *wdev, 1403 struct cfg80211_pmsr_request *req, gfp_t gfp) 1404{ 1405 TODO(); 1406} 1407 1408static __inline void 1409cfg80211_pmsr_report(struct wireless_dev *wdev, 1410 struct cfg80211_pmsr_request *req, 1411 struct cfg80211_pmsr_result *result, gfp_t gfp) 1412{ 1413 TODO(); 1414} 1415 1416static __inline void 1417cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 1418 struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag) 1419{ 1420 1421 KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__)); 1422 KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__)); 1423 1424 memset(chandef, 0, sizeof(*chandef)); 1425 chandef->chan = chan; 1426 chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */ 1427 1428 switch (chan_flag) { 1429 case NL80211_CHAN_NO_HT: 1430 chandef->width = NL80211_CHAN_WIDTH_20_NOHT; 1431 chandef->center_freq1 = chan->center_freq; 1432 break; 1433 default: 1434 IMPROVE("Also depends on our manual settings"); 1435 if (chan->flags & IEEE80211_CHAN_NO_HT40) 1436 chandef->width = NL80211_CHAN_WIDTH_20; 1437 else if (chan->flags & IEEE80211_CHAN_NO_80MHZ) 1438 chandef->width = NL80211_CHAN_WIDTH_40; 1439 else if (chan->flags & IEEE80211_CHAN_NO_160MHZ) 1440 chandef->width = NL80211_CHAN_WIDTH_80; 1441 else { 1442 chandef->width = NL80211_CHAN_WIDTH_160; 1443 IMPROVE("80P80 and 320 ..."); 1444 } 1445 chandef->center_freq1 = chan->center_freq; 1446 break; 1447 }; 1448} 1449 1450static __inline void 1451cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, 1452 void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data) 1453{ 1454 TODO(); 1455} 1456 1457struct element { 1458 uint8_t id; 1459 uint8_t datalen; 1460 uint8_t data[0]; 1461} __packed; 1462 1463static inline const struct element * 1464lkpi_cfg80211_find_elem_pattern(enum ieee80211_eid eid, 1465 const uint8_t *data, size_t len, uint8_t *pattern, size_t plen) 1466{ 1467 const struct element *elem; 1468 const uint8_t *p; 1469 size_t ielen; 1470 1471 p = data; 1472 elem = (const struct element *)p; 1473 ielen = len; 1474 while (elem != NULL && ielen > 1) { 1475 if ((2 + elem->datalen) > ielen) 1476 /* Element overruns our memory. */ 1477 return (NULL); 1478 if (elem->id == eid) { 1479 if (pattern == NULL) 1480 return (elem); 1481 if (elem->datalen >= plen && 1482 memcmp(elem->data, pattern, plen) == 0) 1483 return (elem); 1484 } 1485 ielen -= 2 + elem->datalen; 1486 p += 2 + elem->datalen; 1487 elem = (const struct element *)p; 1488 } 1489 1490 return (NULL); 1491} 1492 1493static inline const struct element * 1494cfg80211_find_elem(enum ieee80211_eid eid, const uint8_t *data, size_t len) 1495{ 1496 1497 return (lkpi_cfg80211_find_elem_pattern(eid, data, len, NULL, 0)); 1498} 1499 1500static inline const struct element * 1501ieee80211_bss_get_elem(struct cfg80211_bss *bss, uint32_t eid) 1502{ 1503 1504 if (bss->ies == NULL) 1505 return (NULL); 1506 return (cfg80211_find_elem(eid, bss->ies->data, bss->ies->len)); 1507} 1508 1509static inline const uint8_t * 1510ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t eid) 1511{ 1512 1513 return ((const uint8_t *)ieee80211_bss_get_elem(bss, eid)); 1514} 1515 1516static inline uint8_t * 1517cfg80211_find_vendor_ie(unsigned int oui, int oui_type, 1518 uint8_t *data, size_t len) 1519{ 1520 const struct element *elem; 1521 uint8_t pattern[4] = { oui << 16, oui << 8, oui, oui_type }; 1522 uint8_t plen = 4; /* >= 3? oui_type always part of this? */ 1523 IMPROVE("plen currently always incl. oui_type"); 1524 1525 elem = lkpi_cfg80211_find_elem_pattern(IEEE80211_ELEMID_VENDOR, 1526 data, len, pattern, plen); 1527 if (elem == NULL) 1528 return (NULL); 1529 return (__DECONST(uint8_t *, elem)); 1530} 1531 1532static __inline uint32_t 1533cfg80211_calculate_bitrate(struct rate_info *rate) 1534{ 1535 TODO(); 1536 return (-1); 1537} 1538 1539static __inline uint32_t 1540ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band) 1541{ 1542 1543 return (linuxkpi_ieee80211_channel_to_frequency(channel, band)); 1544} 1545 1546static __inline uint32_t 1547ieee80211_frequency_to_channel(uint32_t freq) 1548{ 1549 1550 return (linuxkpi_ieee80211_frequency_to_channel(freq, 0)); 1551} 1552 1553static __inline int 1554regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 1555 struct linuxkpi_ieee80211_regdomain *regd) 1556{ 1557 IMPROVE(); 1558 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd)); 1559} 1560 1561static __inline int 1562regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 1563 struct linuxkpi_ieee80211_regdomain *regd) 1564{ 1565 1566 IMPROVE(); 1567 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd)); 1568} 1569 1570static __inline int 1571regulatory_set_wiphy_regd(struct wiphy *wiphy, 1572 struct linuxkpi_ieee80211_regdomain *regd) 1573{ 1574 1575 IMPROVE(); 1576 if (regd == NULL) 1577 return (EINVAL); 1578 1579 /* XXX-BZ wild guessing here based on brcmfmac. */ 1580 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 1581 wiphy->regd = regd; 1582 else 1583 return (EPERM); 1584 1585 /* XXX FIXME, do we have to do anything with reg_notifier? */ 1586 return (0); 1587} 1588 1589static __inline int 1590regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2) 1591{ 1592 struct linuxkpi_ieee80211_regdomain *regd; 1593 1594 if (wiphy->regd != NULL) 1595 return (-EBUSY); 1596 1597 regd = lkpi_get_linuxkpi_ieee80211_regdomain(0); 1598 if (regd == NULL) 1599 return (-ENOMEM); 1600 1601 regd->alpha2[0] = alpha2[0]; 1602 regd->alpha2[1] = alpha2[1]; 1603 wiphy->regd = regd; 1604 1605 IMPROVE("are there flags who is managing? update net8011?"); 1606 1607 return (0); 1608} 1609 1610static __inline const char * 1611reg_initiator_name(enum nl80211_reg_initiator initiator) 1612{ 1613 TODO(); 1614 return (NULL); 1615} 1616 1617static __inline struct linuxkpi_ieee80211_regdomain * 1618rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd) 1619{ 1620 TODO(); 1621 return (NULL); 1622} 1623 1624static __inline struct ieee80211_reg_rule * 1625freq_reg_info(struct wiphy *wiphy, uint32_t center_freq) 1626{ 1627 TODO(); 1628 return (NULL); 1629} 1630 1631static __inline void 1632wiphy_apply_custom_regulatory(struct wiphy *wiphy, 1633 const struct linuxkpi_ieee80211_regdomain *regd) 1634{ 1635 TODO(); 1636} 1637 1638static __inline char * 1639wiphy_name(struct wiphy *wiphy) 1640{ 1641 if (wiphy != NULL && wiphy->dev != NULL) 1642 return dev_name(wiphy->dev); 1643 else { 1644 IMPROVE("wlanNA"); 1645 return ("wlanNA"); 1646 } 1647} 1648 1649static __inline void 1650wiphy_read_of_freq_limits(struct wiphy *wiphy) 1651{ 1652#ifdef FDT 1653 TODO(); 1654#endif 1655} 1656 1657static __inline void 1658wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef) 1659{ 1660 1661 set_bit(ef, wiphy->ext_features); 1662} 1663 1664static __inline void * 1665wiphy_net(struct wiphy *wiphy) 1666{ 1667 TODO(); 1668 return (NULL); /* XXX passed to dev_net_set() */ 1669} 1670 1671static __inline int 1672wiphy_register(struct wiphy *wiphy) 1673{ 1674 TODO(); 1675 return (0); 1676} 1677 1678static __inline void 1679wiphy_unregister(struct wiphy *wiphy) 1680{ 1681 TODO(); 1682} 1683 1684static __inline void 1685wiphy_warn(struct wiphy *wiphy, const char *fmt, ...) 1686{ 1687 TODO(); 1688} 1689 1690static __inline int 1691cfg80211_check_combinations(struct wiphy *wiphy, 1692 struct iface_combination_params *params) 1693{ 1694 TODO(); 1695 return (-ENOENT); 1696} 1697 1698static __inline uint8_t 1699cfg80211_classify8021d(struct sk_buff *skb, void *p) 1700{ 1701 TODO(); 1702 return (0); 1703} 1704 1705static __inline void 1706cfg80211_connect_done(struct net_device *ndev, 1707 struct cfg80211_connect_resp_params *conn_params, gfp_t gfp) 1708{ 1709 TODO(); 1710} 1711 1712static __inline void 1713cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp) 1714{ 1715 TODO(); 1716} 1717 1718static __inline void 1719cfg80211_disconnected(struct net_device *ndev, uint16_t reason, 1720 void *p, int x, bool locally_generated, gfp_t gfp) 1721{ 1722 TODO(); 1723} 1724 1725static __inline int 1726cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len, 1727 enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len) 1728{ 1729 TODO(); 1730 return (-1); 1731} 1732 1733static __inline void 1734cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr, 1735 struct linuxkpi_ieee80211_channel *chan, gfp_t gfp) 1736{ 1737 TODO(); 1738} 1739 1740static __inline struct cfg80211_bss * 1741cfg80211_inform_bss(struct wiphy *wiphy, 1742 struct linuxkpi_ieee80211_channel *channel, 1743 enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x, 1744 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, 1745 int signal, gfp_t gfp) 1746{ 1747 TODO(); 1748 return (NULL); 1749} 1750 1751static __inline struct cfg80211_bss * 1752cfg80211_inform_bss_data(struct wiphy *wiphy, 1753 struct cfg80211_inform_bss *bss_data, 1754 enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x, 1755 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp) 1756{ 1757 TODO(); 1758 return (NULL); 1759} 1760 1761static __inline void 1762cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie, 1763 const u8 *buf, size_t len, bool ack, gfp_t gfp) 1764{ 1765 TODO(); 1766} 1767 1768static __inline void 1769cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr, 1770 enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp) 1771{ 1772 TODO(); 1773} 1774 1775static __inline void 1776cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr, 1777 struct station_info *sinfo, gfp_t gfp) 1778{ 1779 TODO(); 1780} 1781 1782static __inline void 1783cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp) 1784{ 1785 TODO(); 1786} 1787 1788static __inline void 1789cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid, 1790 gfp_t gfp) 1791{ 1792 TODO(); 1793} 1794 1795static __inline void 1796cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie, 1797 struct linuxkpi_ieee80211_channel *channel, unsigned int duration, 1798 gfp_t gfp) 1799{ 1800 TODO(); 1801} 1802 1803static __inline void 1804cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, 1805 uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp) 1806{ 1807 TODO(); 1808} 1809 1810static __inline void 1811cfg80211_report_wowlan_wakeup(void) 1812{ 1813 TODO(); 1814} 1815 1816static __inline void 1817cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info, 1818 gfp_t gfp) 1819{ 1820 TODO(); 1821} 1822 1823static __inline void 1824cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x, 1825 uint8_t *p, size_t p_len, int _x2) 1826{ 1827 TODO(); 1828} 1829 1830static __inline void 1831cfg80211_scan_done(struct cfg80211_scan_request *scan_request, 1832 struct cfg80211_scan_info *info) 1833{ 1834 TODO(); 1835} 1836 1837static __inline void 1838cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid) 1839{ 1840 TODO(); 1841} 1842 1843static __inline void 1844cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x) 1845{ 1846 TODO(); 1847} 1848 1849static __inline void 1850cfg80211_unregister_wdev(struct wireless_dev *wdev) 1851{ 1852 TODO(); 1853} 1854 1855static __inline struct sk_buff * 1856cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len) 1857{ 1858 TODO(); 1859 return (NULL); 1860} 1861 1862static __inline int 1863cfg80211_vendor_cmd_reply(struct sk_buff *skb) 1864{ 1865 TODO(); 1866 return (-ENXIO); 1867} 1868 1869static __inline struct linuxkpi_ieee80211_channel * 1870ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq) 1871{ 1872 1873 return (linuxkpi_ieee80211_get_channel(wiphy, freq)); 1874} 1875 1876static inline size_t 1877ieee80211_get_hdrlen_from_skb(struct sk_buff *skb) 1878{ 1879 const struct ieee80211_hdr *hdr; 1880 size_t len; 1881 1882 if (skb->len < 10) /* sizeof(ieee80211_frame_[ack,cts]) */ 1883 return (0); 1884 1885 hdr = (const struct ieee80211_hdr *)skb->data; 1886 len = ieee80211_hdrlen(hdr->frame_control); 1887 1888 /* If larger than what is in the skb return. */ 1889 if (len > skb->len) 1890 return (0); 1891 1892 return (len); 1893} 1894 1895static __inline bool 1896cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel) 1897{ 1898 1899 /* Only 6Ghz. */ 1900 if (channel->band != NL80211_BAND_6GHZ) 1901 return (false); 1902 1903 TODO(); 1904 return (false); 1905} 1906 1907static inline int 1908cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len, 1909 enum nl80211_band band, enum cfg80211_bss_frame_type ftype) 1910{ 1911 const struct element *elem; 1912 1913 switch (band) { 1914 case NL80211_BAND_6GHZ: 1915 TODO(); 1916 break; 1917 case NL80211_BAND_5GHZ: 1918 case NL80211_BAND_2GHZ: 1919 /* DSPARAMS has the channel number. */ 1920 elem = cfg80211_find_elem(IEEE80211_ELEMID_DSPARMS, ie, len); 1921 if (elem != NULL && elem->datalen == 1) 1922 return (elem->data[0]); 1923 /* HTINFO has the primary center channel. */ 1924 elem = cfg80211_find_elem(IEEE80211_ELEMID_HTINFO, ie, len); 1925 if (elem != NULL && 1926 elem->datalen >= (sizeof(struct ieee80211_ie_htinfo) - 2)) { 1927 const struct ieee80211_ie_htinfo *htinfo; 1928 htinfo = (const struct ieee80211_ie_htinfo *)elem; 1929 return (htinfo->hi_ctrlchannel); 1930 } 1931 /* What else? */ 1932 break; 1933 default: 1934 IMPROVE("Unsupported"); 1935 break; 1936 } 1937 return (-1); 1938} 1939 1940/* Used for scanning at least. */ 1941static __inline void 1942get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask) 1943{ 1944 int i; 1945 1946 /* Get a completely random address and then overlay what we want. */ 1947 get_random_bytes(dst, ETH_ALEN); 1948 for (i = 0; i < ETH_ALEN; i++) 1949 dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]); 1950} 1951 1952static __inline void 1953cfg80211_shutdown_all_interfaces(struct wiphy *wiphy) 1954{ 1955 TODO(); 1956} 1957 1958static __inline bool 1959cfg80211_reg_can_beacon(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, 1960 enum nl80211_iftype iftype) 1961{ 1962 TODO(); 1963 return (false); 1964} 1965 1966static __inline void 1967cfg80211_background_radar_event(struct wiphy *wiphy, 1968 struct cfg80211_chan_def *chandef, gfp_t gfp) 1969{ 1970 TODO(); 1971} 1972 1973static __inline const u8 * 1974cfg80211_find_ext_ie(uint8_t eid, const uint8_t *p, size_t len) 1975{ 1976 TODO(); 1977 return (NULL); 1978} 1979 1980static __inline bool 1981cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef) 1982{ 1983 TODO(); 1984 return (false); 1985} 1986 1987static __inline const struct ieee80211_sta_eht_cap * 1988ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *band, 1989 enum nl80211_iftype iftype) 1990{ 1991 TODO(); 1992 return (NULL); 1993} 1994 1995#define wiphy_info(wiphy, fmt, ...) \ 1996 printf("%s:%d XXX TODO " fmt, __func__, __LINE__, __VA_ARGS__) 1997 1998#ifndef LINUXKPI_NET80211 1999#define ieee80211_channel linuxkpi_ieee80211_channel 2000#define ieee80211_regdomain linuxkpi_ieee80211_regdomain 2001#endif 2002 2003#include <net/mac80211.h> 2004 2005#endif /* _LINUXKPI_NET_CFG80211_H */ 2006