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