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