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