1 /*- 2 * Copyright (c) 2020-2021 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 * $FreeBSD$ 30 */ 31 32 #ifndef _LINUXKPI_NET_CFG80211_H 33 #define _LINUXKPI_NET_CFG80211_H 34 35 #include <linux/types.h> 36 #include <linux/nl80211.h> 37 #include <linux/ieee80211.h> 38 #include <linux/if_ether.h> 39 #include <linux/device.h> 40 #include <linux/netdevice.h> 41 #include <linux/random.h> 42 #include <linux/skbuff.h> 43 44 /* linux_80211.c */ 45 extern int debug_80211; 46 #ifndef D80211_TODO 47 #define D80211_TODO 0x1 48 #endif 49 #ifndef D80211_IMPROVE 50 #define D80211_IMPROVE 0x2 51 #endif 52 #define TODO() if (debug_80211 & D80211_TODO) \ 53 printf("%s:%d: XXX LKPI80211 TODO\n", __func__, __LINE__) 54 #define IMPROVE(...) if (debug_80211 & D80211_IMPROVE) \ 55 printf("%s:%d: XXX LKPI80211 IMPROVE\n", __func__, __LINE__) 56 57 #define WIPHY_PARAM_FRAG_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */ 58 #define WIPHY_PARAM_RETRY_LONG __LINE__ /* TODO FIXME brcmfmac */ 59 #define WIPHY_PARAM_RETRY_SHORT __LINE__ /* TODO FIXME brcmfmac */ 60 #define WIPHY_PARAM_RTS_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */ 61 62 #define CFG80211_SIGNAL_TYPE_MBM __LINE__ /* TODO FIXME brcmfmac */ 63 64 #define UPDATE_ASSOC_IES 1 65 66 #define IEEE80211_MAX_CHAINS 4 /* net80211: IEEE80211_MAX_CHAINS copied */ 67 68 enum cfg80211_rate_info_flags { 69 RATE_INFO_FLAGS_SHORT_GI = BIT(0), 70 RATE_INFO_FLAGS_MCS = BIT(1), 71 RATE_INFO_FLAGS_VHT_MCS = BIT(2), 72 RATE_INFO_FLAGS_HE_MCS = BIT(3), 73 }; 74 75 extern const uint8_t rfc1042_header[6]; 76 77 enum cfg80211_bss_ftypes { 78 CFG80211_BSS_FTYPE_UNKNOWN, 79 }; 80 81 enum ieee80211_channel_flags { 82 IEEE80211_CHAN_DISABLED = BIT(0), 83 IEEE80211_CHAN_INDOOR_ONLY = BIT(1), 84 IEEE80211_CHAN_IR_CONCURRENT = BIT(2), 85 IEEE80211_CHAN_RADAR = BIT(3), 86 IEEE80211_CHAN_NO_IR = BIT(4), 87 IEEE80211_CHAN_NO_HT40MINUS = BIT(5), 88 IEEE80211_CHAN_NO_HT40PLUS = BIT(6), 89 IEEE80211_CHAN_NO_80MHZ = BIT(7), 90 IEEE80211_CHAN_NO_160MHZ = BIT(8), 91 }; 92 #define IEEE80211_CHAN_NO_HT40 (IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS) 93 94 struct ieee80211_txrx_stypes { 95 uint16_t tx; 96 uint16_t rx; 97 }; 98 99 /* XXX net80211 has an ieee80211_channel as well. */ 100 struct linuxkpi_ieee80211_channel { 101 /* TODO FIXME */ 102 uint32_t hw_value; /* ic_ieee */ 103 uint32_t center_freq; /* ic_freq */ 104 enum ieee80211_channel_flags flags; /* ic_flags */ 105 enum nl80211_band band; 106 int8_t max_power; /* ic_maxpower */ 107 bool beacon_found; 108 int max_antenna_gain, max_reg_power; 109 int orig_flags; 110 }; 111 112 enum ieee80211_vht_mcs_support { 113 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_7, 114 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_8, 115 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_9, 116 }; 117 118 struct cfg80211_bitrate_mask { 119 /* TODO FIXME */ 120 /* This is so weird but nothing else works out...*/ 121 struct { 122 uint64_t legacy; /* XXX? */ 123 uint8_t ht_mcs[16]; /* XXX? */ 124 uint16_t vht_mcs[16]; /* XXX? */ 125 uint16_t he_mcs[16]; /* XXX? */ 126 uint8_t gi; /* NL80211_TXRATE_FORCE_LGI enum? */ 127 } control[NUM_NL80211_BANDS]; 128 }; 129 130 struct rate_info { 131 /* TODO FIXME */ 132 int bw, flags, he_dcm, he_gi, he_ru_alloc, legacy, mcs, nss; 133 }; 134 135 struct ieee80211_rate { 136 /* TODO FIXME */ 137 uint32_t bitrate; 138 uint32_t hw_value; 139 uint32_t hw_value_short; 140 uint32_t flags; 141 }; 142 143 /* XXX net80211 calls these IEEE80211_HTCAP_* */ 144 #define IEEE80211_HT_CAP_LDPC_CODING 0x0001 /* IEEE80211_HTCAP_LDPC */ 145 #define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002 /* IEEE80211_HTCAP_CHWIDTH40 */ 146 #define IEEE80211_HT_CAP_GRN_FLD 0x0010 /* IEEE80211_HTCAP_GREENFIELD */ 147 #define IEEE80211_HT_CAP_SGI_20 0x0020 /* IEEE80211_HTCAP_SHORTGI20 */ 148 #define IEEE80211_HT_CAP_SGI_40 0x0040 /* IEEE80211_HTCAP_SHORTGI40 */ 149 #define IEEE80211_HT_CAP_TX_STBC 0x0080 /* IEEE80211_HTCAP_TXSTBC */ 150 #define IEEE80211_HT_CAP_RX_STBC 0x0100 /* IEEE80211_HTCAP_RXSTBC */ 151 #define IEEE80211_HT_CAP_RX_STBC_SHIFT 8 /* IEEE80211_HTCAP_RXSTBC_S */ 152 #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 /* IEEE80211_HTCAP_MAXAMSDU */ 153 #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 /* IEEE80211_HTCAP_DSSSCCK40 */ 154 155 #define IEEE80211_HT_MCS_TX_DEFINED 0x0001 156 #define IEEE80211_HT_MCS_TX_RX_DIFF 0x0002 157 #define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2 158 #define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3FF 159 160 struct ieee80211_sta_ht_cap { 161 /* TODO FIXME */ 162 int ampdu_density, ampdu_factor; 163 bool ht_supported; 164 uint16_t cap; 165 struct mcs { 166 uint16_t rx_mask[16]; /* XXX ? > 4 (rtw88) */ 167 int rx_highest; 168 uint32_t tx_params; 169 } mcs; 170 }; 171 172 /* XXX net80211 calls these IEEE80211_VHTCAP_* */ 173 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */ 174 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */ 175 #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */ 176 #define IEEE80211_VHT_CAP_MAX_MPDU_MASK 0x00000003 /* IEEE80211_VHTCAP_MAX_MPDU_MASK */ 177 178 #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S) 179 180 #define IEEE80211_VHT_CAP_RXLDPC 0x00000010 /* IEEE80211_VHTCAP_RXLDPC */ 181 182 #define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 /* IEEE80211_VHTCAP_SHORT_GI_80 */ 183 #define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 /* IEEE80211_VHTCAP_SHORT_GI_160 */ 184 185 #define IEEE80211_VHT_CAP_TXSTBC 0x00000080 /* IEEE80211_VHTCAP_TXSTBC */ 186 187 #define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 /* IEEE80211_VHTCAP_RXSTBC_1 */ 188 #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 /* IEEE80211_VHTCAP_RXSTBC_MASK */ 189 190 #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 /* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */ 191 192 #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 /* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */ 193 194 #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 /* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */ 195 196 #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 /* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */ 197 198 #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 /* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */ 199 200 #define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 /* IEEE80211_VHTCAP_HTC_VHT */ 201 202 #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 /* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */ 203 #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 /* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */ 204 205 #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 /* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */ 206 207 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */ 208 #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \ 209 (7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT) /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */ 210 211 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */ 212 #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \ 213 (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */ 214 215 struct ieee80211_sta_vht_cap { 216 /* TODO FIXME */ 217 bool vht_supported; 218 uint32_t cap; 219 struct vht_mcs vht_mcs; 220 }; 221 222 struct cfg80211_connect_resp_params { 223 /* XXX TODO */ 224 uint8_t *bssid; 225 const uint8_t *req_ie; 226 const uint8_t *resp_ie; 227 uint32_t req_ie_len; 228 uint32_t resp_ie_len; 229 int status; 230 }; 231 232 struct cfg80211_inform_bss { 233 /* XXX TODO */ 234 int boottime_ns, scan_width, signal; 235 struct linuxkpi_ieee80211_channel *chan; 236 }; 237 238 struct cfg80211_roam_info { 239 /* XXX TODO */ 240 uint8_t *bssid; 241 const uint8_t *req_ie; 242 const uint8_t *resp_ie; 243 uint32_t req_ie_len; 244 uint32_t resp_ie_len; 245 struct linuxkpi_ieee80211_channel *channel; 246 }; 247 248 struct cfg80211_bss_ies { 249 /* XXX TODO, type is best guess. Fix if more info. */ 250 uint8_t *data; 251 int len; 252 }; 253 254 struct cfg80211_bss { 255 /* XXX TODO */ 256 struct cfg80211_bss_ies *ies; 257 }; 258 259 struct cfg80211_chan_def { 260 /* XXX TODO */ 261 struct linuxkpi_ieee80211_channel *chan; 262 enum nl80211_chan_width width; 263 uint32_t center_freq1; 264 uint32_t center_freq2; 265 }; 266 267 struct cfg80211_ftm_responder_stats { 268 /* XXX TODO */ 269 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; 270 }; 271 272 struct cfg80211_pmsr_capabilities { 273 /* XXX TODO */ 274 int max_peers, randomize_mac_addr, report_ap_tsf; 275 struct { 276 int asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based; 277 } ftm; 278 }; 279 280 struct cfg80211_pmsr_ftm_request { 281 /* XXX TODO */ 282 int asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based; 283 uint8_t bss_color; 284 bool lmr_feedback; 285 }; 286 287 struct cfg80211_pmsr_request_peer { 288 /* XXX TODO */ 289 struct cfg80211_chan_def chandef; 290 struct cfg80211_pmsr_ftm_request ftm; 291 uint8_t addr[ETH_ALEN]; 292 int report_ap_tsf; 293 }; 294 295 struct cfg80211_pmsr_request { 296 /* XXX TODO */ 297 int cookie, n_peers, timeout; 298 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; 299 struct cfg80211_pmsr_request_peer peers[]; 300 }; 301 302 struct cfg80211_pmsr_ftm_result { 303 /* XXX TODO */ 304 int burst_index, busy_retry_time, failure_reason; 305 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; 306 uint8_t *lci; 307 uint8_t *civicloc; 308 int lci_len; 309 int civicloc_len; 310 }; 311 312 struct cfg80211_pmsr_result { 313 /* XXX TODO */ 314 int ap_tsf, ap_tsf_valid, final, host_time, status, type; 315 uint8_t addr[ETH_ALEN]; 316 struct cfg80211_pmsr_ftm_result ftm; 317 }; 318 319 struct cfg80211_sar_freq_ranges { 320 uint32_t start_freq; 321 uint32_t end_freq; 322 }; 323 324 struct cfg80211_sar_sub_specs { 325 uint32_t freq_range_index; 326 int power; 327 }; 328 329 struct cfg80211_sar_specs { 330 enum nl80211_sar_type type; 331 uint32_t num_sub_specs; 332 struct cfg80211_sar_sub_specs sub_specs[]; 333 }; 334 335 struct cfg80211_sar_capa { 336 enum nl80211_sar_type type; 337 uint32_t num_freq_ranges; 338 const struct cfg80211_sar_freq_ranges *freq_ranges; 339 }; 340 341 struct cfg80211_ssid { 342 int ssid_len; 343 uint8_t ssid[IEEE80211_MAX_SSID_LEN]; 344 }; 345 346 struct cfg80211_scan_6ghz_params { 347 /* XXX TODO */ 348 uint8_t *bssid; 349 int channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe; 350 }; 351 352 struct cfg80211_match_set { 353 uint8_t bssid[ETH_ALEN]; 354 struct cfg80211_ssid ssid; 355 int rssi_thold; 356 }; 357 358 struct cfg80211_scan_request { 359 /* XXX TODO */ 360 int duration, duration_mandatory, flags; 361 bool no_cck; 362 bool scan_6ghz; 363 struct wireless_dev *wdev; 364 struct wiphy *wiphy; 365 int ie_len; 366 uint8_t *ie; 367 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; 368 int n_ssids; 369 int n_6ghz_params; 370 int n_channels; 371 struct cfg80211_ssid *ssids; 372 struct cfg80211_scan_6ghz_params *scan_6ghz_params; 373 struct linuxkpi_ieee80211_channel *channels[0]; 374 }; 375 376 struct cfg80211_sched_scan_plan { 377 /* XXX TODO */ 378 int interval, iterations; 379 }; 380 381 struct cfg80211_sched_scan_request { 382 /* XXX TODO */ 383 int delay, flags; 384 uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN]; 385 uint64_t reqid; 386 int n_match_sets; 387 int n_scan_plans; 388 int n_ssids; 389 int n_channels; 390 struct cfg80211_match_set *match_sets; 391 struct cfg80211_sched_scan_plan *scan_plans; 392 struct cfg80211_ssid *ssids; 393 struct linuxkpi_ieee80211_channel *channels[0]; 394 }; 395 396 struct cfg80211_scan_info { 397 uint64_t scan_start_tsf; 398 uint8_t tsf_bssid[ETH_ALEN]; 399 bool aborted; 400 }; 401 402 struct cfg80211_beacon_data { 403 /* XXX TODO */ 404 const uint8_t *head; 405 const uint8_t *tail; 406 uint32_t head_len; 407 uint32_t tail_len; 408 const uint8_t *proberesp_ies; 409 const uint8_t *assocresp_ies; 410 uint32_t proberesp_ies_len; 411 uint32_t assocresp_ies_len; 412 }; 413 414 struct cfg80211_ap_settings { 415 /* XXX TODO */ 416 int auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout; 417 const uint8_t *ssid; 418 size_t ssid_len; 419 struct cfg80211_beacon_data beacon; 420 struct cfg80211_chan_def chandef; 421 }; 422 423 struct cfg80211_bss_selection { 424 /* XXX TODO */ 425 enum nl80211_bss_select_attr behaviour; 426 union { 427 enum nl80211_band band_pref; 428 struct { 429 enum nl80211_band band; 430 uint8_t delta; 431 } adjust; 432 } param; 433 }; 434 435 struct cfg80211_crypto { /* XXX made up name */ 436 /* XXX TODO */ 437 enum nl80211_wpa_versions wpa_versions; 438 uint32_t cipher_group; /* WLAN_CIPHER_SUITE_* */ 439 uint32_t *akm_suites; 440 uint32_t *ciphers_pairwise; 441 const uint8_t *sae_pwd; 442 const uint8_t *psk; 443 int n_akm_suites; 444 int n_ciphers_pairwise; 445 int sae_pwd_len; 446 }; 447 448 struct cfg80211_connect_params { 449 /* XXX TODO */ 450 struct linuxkpi_ieee80211_channel *channel; 451 uint8_t *bssid; 452 const uint8_t *ie; 453 const uint8_t *ssid; 454 uint32_t ie_len; 455 uint32_t ssid_len; 456 const void *key; 457 uint32_t key_len; 458 int auth_type, key_idx, privacy, want_1x; 459 struct cfg80211_bss_selection bss_select; 460 struct cfg80211_crypto crypto; 461 }; 462 463 enum bss_param_flags { /* Used as bitflags. XXX FIXME values? */ 464 BSS_PARAM_FLAGS_CTS_PROT = 0x01, 465 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 0x02, 466 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04, 467 }; 468 469 struct cfg80211_ibss_params { 470 /* XXX TODO */ 471 int basic_rates, beacon_interval; 472 int channel_fixed, ie, ie_len, privacy; 473 int dtim_period; 474 uint8_t *ssid; 475 uint8_t *bssid; 476 int ssid_len; 477 struct cfg80211_chan_def chandef; 478 enum bss_param_flags flags; 479 }; 480 481 struct cfg80211_mgmt_tx_params { 482 /* XXX TODO */ 483 struct linuxkpi_ieee80211_channel *chan; 484 const uint8_t *buf; 485 size_t len; 486 int wait; 487 }; 488 489 struct cfg80211_pmk_conf { 490 /* XXX TODO */ 491 const uint8_t *pmk; 492 uint8_t pmk_len; 493 }; 494 495 struct cfg80211_pmksa { 496 /* XXX TODO */ 497 const uint8_t *bssid; 498 const uint8_t *pmkid; 499 }; 500 501 struct cfg80211_wowlan_nd_match { 502 /* XXX TODO */ 503 struct cfg80211_ssid ssid; 504 int n_channels; 505 uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */ 506 }; 507 508 struct cfg80211_wowlan_nd_info { 509 /* XXX TODO */ 510 int n_matches; 511 struct cfg80211_wowlan_nd_match *matches[0]; 512 }; 513 514 enum wiphy_wowlan_support_flags { 515 WIPHY_WOWLAN_DISCONNECT, 516 WIPHY_WOWLAN_GTK_REKEY_FAILURE, 517 WIPHY_WOWLAN_MAGIC_PKT, 518 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY, 519 WIPHY_WOWLAN_NET_DETECT, 520 }; 521 522 struct wiphy_wowlan_support { 523 /* XXX TODO */ 524 enum wiphy_wowlan_support_flags flags; 525 int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len; 526 }; 527 528 struct station_del_parameters { 529 /* XXX TODO */ 530 const uint8_t *mac; 531 uint32_t reason_code; /* elsewhere uint16_t? */ 532 }; 533 534 struct station_info { 535 /* TODO FIXME */ 536 int assoc_req_ies_len, connected_time; 537 int generation, inactive_time, rx_bytes, rx_dropped_misc, rx_packets, signal, tx_bytes, tx_packets; 538 int filled, rx_beacon, rx_beacon_signal_avg, signal_avg; 539 int rx_duration, tx_failed, tx_retries; 540 541 int chains; 542 uint8_t chain_signal[IEEE80211_MAX_CHAINS]; 543 uint8_t chain_signal_avg[IEEE80211_MAX_CHAINS]; 544 545 uint8_t *assoc_req_ies; 546 struct rate_info rxrate; 547 struct rate_info txrate; 548 struct cfg80211_ibss_params bss_param; 549 struct nl80211_sta_flag_update sta_flags; 550 }; 551 552 struct station_parameters { 553 /* XXX TODO */ 554 int sta_flags_mask, sta_flags_set; 555 }; 556 557 struct key_params { 558 /* XXX TODO */ 559 const uint8_t *key; 560 const uint8_t *seq; 561 int key_len; 562 int seq_len; 563 uint32_t cipher; /* WLAN_CIPHER_SUITE_* */ 564 }; 565 566 struct mgmt_frame_regs { 567 /* XXX TODO */ 568 int interface_stypes; 569 }; 570 571 struct vif_params { 572 /* XXX TODO */ 573 uint8_t macaddr[ETH_ALEN]; 574 }; 575 576 /* That the world needs so many different structs for this is amazing. */ 577 struct mac_address { 578 uint8_t addr[ETH_ALEN]; 579 }; 580 581 #define REG_RULE(_begin, _end, _bw, _gain, _eirp, _x) \ 582 { \ 583 .freq_range.start_freq_khz = (_begin) * 1000, \ 584 .freq_range.end_freq_khz = (_end) * 1000, \ 585 .freq_range.max_bandwidth_khz = (_bw) * 1000, \ 586 .power_rule.max_antenna_gain = DBI_TO_MBI(_gain), \ 587 .power_rule.max_eirp = DBM_TO_MBM(_eirp), \ 588 .flags = (_x), /* ? */ \ 589 /* XXX TODO FIXME */ \ 590 } 591 592 struct ieee80211_reg_rule { 593 /* TODO FIXME */ 594 uint32_t flags; 595 struct freq_range { 596 int start_freq_khz; 597 int end_freq_khz; 598 int max_bandwidth_khz; 599 } freq_range; 600 struct power_rule { 601 int max_antenna_gain; 602 int max_eirp; 603 } power_rule; 604 }; 605 606 struct linuxkpi_ieee80211_regdomain { 607 /* TODO FIXME */ 608 uint8_t alpha2[2]; 609 int n_reg_rules; 610 struct ieee80211_reg_rule reg_rules[]; 611 }; 612 613 /* XXX-BZ this are insensible values probably ... */ 614 #define IEEE80211_HE_MAC_CAP0_HTC_HE 0x1 615 #define IEEE80211_HE_MAC_CAP0_TWT_REQ 0x2 616 617 #define IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION 0x1 618 #define IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8 0x2 619 #define IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US 0x4 620 621 #define IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP 0x1 622 #define IEEE80211_HE_MAC_CAP2_ACK_EN 0x2 623 #define IEEE80211_HE_MAC_CAP2_BSR 0x4 624 #define IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION 0x8 625 #define IEEE80211_HE_MAC_CAP2_BCAST_TWT 0x10 626 #define IEEE80211_HE_MAC_CAP2_ALL_ACK 0x20 627 628 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_VHT_2 0x1 629 #define IEEE80211_HE_MAC_CAP3_OMI_CONTROL 0x2 630 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1 0x10 631 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2 0x20 632 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3 0x40 633 #define IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK 0x70 634 #define IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS 0x80 635 636 #define IEEE80211_HE_MAC_CAP4_AMDSU_IN_AMPDU 0x1 637 #define IEEE80211_HE_MAC_CAP4_BQR 0x2 638 #define IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39 0x4 639 #define IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU 0x8 640 #define IEEE80211_HE_MAC_CAP4_OPS 0x10 641 642 #define IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS 0x1 643 #define IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX 0x2 644 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40 0x4 645 #define IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41 0x8 646 #define IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU 0x10 647 648 #define IEEE80211_HE_MCS_NOT_SUPPORTED 0x0 649 #define IEEE80211_HE_MCS_SUPPORT_0_7 0x1 650 #define IEEE80211_HE_MCS_SUPPORT_0_9 0x2 651 #define IEEE80211_HE_MCS_SUPPORT_0_11 0x4 652 653 #define IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS 0x01 654 #define IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS 0x02 655 #define IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START 0x04 656 #define IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN 0x08 657 #define IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP 0x10 658 659 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G 0x1 660 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G 0x2 661 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G 0x4 662 #define IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G 0x8 663 664 #define IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A 0x1 665 #define IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD 0x2 666 #define IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS 0x4 667 #define IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK 0x8 668 #define IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US 0x10 669 670 #define IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS 0x1 671 #define IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US 0x2 672 #define IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ 0x4 673 #define IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ 0x8 674 #define IEEE80211_HE_PHY_CAP2_DOPPLER_TX 0x10 675 676 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK 0x1 677 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM 0x2 678 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM 0x4 679 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 0x8 680 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1 0x10 681 #define IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER 0x20 682 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM 0x40 683 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM 0x80 684 #define IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2 0x100 685 #define IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU 0x200 686 687 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8 0x1 688 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8 0x2 689 #define IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE 0x4 690 #define IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER 0x8 691 #define IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4 0x10 692 693 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2 0x1 694 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2 0x2 695 #define IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK 0x4 696 #define IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK 0x8 697 #define IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK 0x10 698 699 #define IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT 0x1 700 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB 0x2 701 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB 0x4 702 #define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB 0x8 703 #define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB 0x20 704 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU 0x40 705 #define IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU 0x80 706 #define IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE 0x80 707 708 #define IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI 0x1 709 #define IEEE80211_HE_PHY_CAP7_MAX_NC_1 0x2 710 #define IEEE80211_HE_PHY_CAP7_MAX_NC_2 0x4 711 #define IEEE80211_HE_PHY_CAP7_MAX_NC_MASK 0x6 712 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_AR 0x8 713 #define IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP 0x10 714 #define IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ 0x20 715 716 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU 0x1 717 #define IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G 0x2 718 #define IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU 0x4 719 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996 0x8 720 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242 0x10 721 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI 0x20 722 #define IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996 0x40 723 #define IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI 0x80 724 725 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US 0x1 726 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US 0x2 727 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US 0x4 728 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK 0x8 729 #define IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED 0x10 730 #define IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK 0x20 731 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB 0x40 732 #define IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB 0x80 733 #define IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU 0x100 734 #define IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU 0x200 735 #define IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM 0x400 736 737 #define IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF 0x1 738 739 #define VENDOR_CMD_RAW_DATA (void *)(uintptr_t)(-ENOENT) 740 741 struct ieee80211_he_cap_elem { 742 u8 mac_cap_info[6]; 743 u8 phy_cap_info[11]; 744 } __packed; 745 746 struct ieee80211_he_mcs_nss_supp { 747 /* TODO FIXME */ 748 uint32_t rx_mcs_80; 749 uint32_t tx_mcs_80; 750 uint32_t rx_mcs_160; 751 uint32_t tx_mcs_160; 752 uint32_t rx_mcs_80p80; 753 uint32_t tx_mcs_80p80; 754 }; 755 756 #define IEEE80211_STA_HE_CAP_PPE_THRES_MAX 32 757 struct ieee80211_sta_he_cap { 758 /* TODO FIXME */ 759 int has_he; 760 struct ieee80211_he_cap_elem he_cap_elem; 761 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp; 762 uint8_t ppe_thres[IEEE80211_STA_HE_CAP_PPE_THRES_MAX]; 763 }; 764 765 struct ieee80211_sta_he_6ghz_capa { 766 /* TODO FIXME */ 767 int capa; 768 }; 769 770 struct ieee80211_sband_iftype_data { 771 /* TODO FIXME */ 772 enum nl80211_iftype types_mask; 773 struct ieee80211_sta_he_cap he_cap; 774 struct ieee80211_sta_he_6ghz_capa he_6ghz_capa; 775 struct { 776 const uint8_t *data; 777 size_t len; 778 } vendor_elems; 779 }; 780 781 struct ieee80211_supported_band { 782 /* TODO FIXME */ 783 struct linuxkpi_ieee80211_channel *channels; 784 struct ieee80211_rate *bitrates; 785 struct ieee80211_sband_iftype_data *iftype_data; 786 int n_channels; 787 int n_bitrates; 788 int n_iftype_data; 789 enum nl80211_band band; 790 struct ieee80211_sta_ht_cap ht_cap; 791 struct ieee80211_sta_vht_cap vht_cap; 792 }; 793 794 struct cfg80211_pkt_pattern { 795 /* XXX TODO */ 796 uint8_t *mask; 797 uint8_t *pattern; 798 int pattern_len; 799 int pkt_offset; 800 }; 801 802 struct cfg80211_wowlan { 803 /* XXX TODO */ 804 int disconnect, gtk_rekey_failure, magic_pkt; 805 int n_patterns; 806 struct cfg80211_sched_scan_request *nd_config; 807 struct cfg80211_pkt_pattern *patterns; 808 }; 809 810 struct cfg80211_gtk_rekey_data { 811 /* XXX TODO */ 812 int kck, kek, replay_ctr; 813 }; 814 815 struct ieee80211_iface_limit { 816 /* TODO FIXME */ 817 int max, types; 818 }; 819 820 struct ieee80211_iface_combination { 821 /* TODO FIXME */ 822 const struct ieee80211_iface_limit *limits; 823 int n_limits; 824 int max_interfaces, num_different_channels; 825 int beacon_int_infra_match, beacon_int_min_gcd; 826 }; 827 828 struct iface_combination_params { 829 int num_different_channels; 830 int iftype_num[NUM_NL80211_IFTYPES]; 831 }; 832 833 struct regulatory_request { 834 /* XXX TODO */ 835 uint8_t alpha2[2]; 836 int initiator, dfs_region; 837 }; 838 839 enum wiphy_vendor_cmd_need_flags { 840 WIPHY_VENDOR_CMD_NEED_NETDEV = 0x01, 841 WIPHY_VENDOR_CMD_NEED_RUNNING = 0x02, 842 WIPHY_VENDOR_CMD_NEED_WDEV = 0x04, 843 }; 844 845 struct wiphy_vendor_command { 846 struct { 847 uint32_t vendor_id; 848 uint32_t subcmd; 849 }; 850 uint32_t flags; 851 void *policy; 852 int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int); 853 }; 854 855 struct wiphy_iftype_ext_capab { 856 /* TODO FIXME */ 857 enum nl80211_iftype iftype; 858 const uint8_t *extended_capabilities; 859 const uint8_t *extended_capabilities_mask; 860 uint8_t extended_capabilities_len; 861 862 }; 863 864 enum cfg80211_regulatory { 865 REGULATORY_CUSTOM_REG = BIT(0), 866 REGULATORY_STRICT_REG = BIT(1), 867 REGULATORY_DISABLE_BEACON_HINTS = BIT(2), 868 REGULATORY_ENABLE_RELAX_NO_IR = BIT(3), 869 REGULATORY_WIPHY_SELF_MANAGED = BIT(4), 870 REGULATORY_COUNTRY_IE_IGNORE = BIT(5), 871 }; 872 873 #define WIPHY_FLAG_AP_UAPSD 0x00000001 874 #define WIPHY_FLAG_HAS_CHANNEL_SWITCH 0x00000002 875 #define WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL 0x00000004 876 #define WIPHY_FLAG_HAVE_AP_SME 0x00000008 877 #define WIPHY_FLAG_IBSS_RSN 0x00000010 878 #define WIPHY_FLAG_NETNS_OK 0x00000020 879 #define WIPHY_FLAG_OFFCHAN_TX 0x00000040 880 #define WIPHY_FLAG_PS_ON_BY_DEFAULT 0x00000080 881 #define WIPHY_FLAG_SPLIT_SCAN_6GHZ 0x00000100 882 #define WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK 0x00000200 883 #define WIPHY_FLAG_SUPPORTS_FW_ROAM 0x00000400 884 #define WIPHY_FLAG_SUPPORTS_TDLS 0x00000800 885 #define WIPHY_FLAG_TDLS_EXTERNAL_SETUP 0x00001000 886 887 struct wiphy { 888 889 struct device *dev; 890 struct mac_address *addresses; 891 int n_addresses; 892 uint32_t flags; 893 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS]; 894 uint8_t perm_addr[ETH_ALEN]; 895 896 /* XXX TODO */ 897 const struct cfg80211_pmsr_capabilities *pmsr_capa; 898 const struct cfg80211_sar_capa *sar_capa; 899 const struct wiphy_iftype_ext_capab *iftype_ext_capab; 900 const struct linuxkpi_ieee80211_regdomain *regd; 901 char fw_version[64]; /* XXX TODO */ 902 const struct ieee80211_iface_combination *iface_combinations; 903 const uint32_t *cipher_suites; 904 int n_iface_combinations; 905 int n_cipher_suites; 906 void(*reg_notifier)(struct wiphy *, struct regulatory_request *); 907 enum cfg80211_regulatory regulatory_flags; 908 int n_vendor_commands; 909 const struct wiphy_vendor_command *vendor_commands; 910 const struct ieee80211_txrx_stypes *mgmt_stypes; 911 uint32_t rts_threshold; 912 uint32_t frag_threshold; 913 914 int available_antennas_rx, available_antennas_tx; 915 int features, hw_version; 916 int interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ie_len, 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; 917 int num_iftype_ext_capab; 918 int max_ap_assoc_sta, probe_resp_offload, software_iftypes; 919 int bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type; 920 921 unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)]; 922 struct dentry *debugfsdir; 923 struct cfg80211_wowlan_support *wowlan; 924 /* Lower layer (driver/mac80211) specific data. */ 925 /* Must stay last. */ 926 uint8_t priv[0] __aligned(CACHE_LINE_SIZE); 927 }; 928 929 struct wireless_dev { 930 /* XXX TODO, like ic? */ 931 int iftype; 932 int address; 933 struct net_device *netdev; 934 struct wiphy *wiphy; 935 }; 936 937 struct cfg80211_ops { 938 /* XXX TODO */ 939 struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *); 940 int (*del_virtual_intf)(struct wiphy *, struct wireless_dev *); 941 s32 (*change_virtual_intf)(struct wiphy *, struct net_device *, enum nl80211_iftype, struct vif_params *); 942 s32 (*scan)(struct wiphy *, struct cfg80211_scan_request *); 943 s32 (*set_wiphy_params)(struct wiphy *, u32); 944 s32 (*join_ibss)(struct wiphy *, struct net_device *, struct cfg80211_ibss_params *); 945 s32 (*leave_ibss)(struct wiphy *, struct net_device *); 946 s32 (*get_station)(struct wiphy *, struct net_device *, const u8 *, struct station_info *); 947 int (*dump_station)(struct wiphy *, struct net_device *, int, u8 *, struct station_info *); 948 s32 (*set_tx_power)(struct wiphy *, struct wireless_dev *, enum nl80211_tx_power_setting, s32); 949 s32 (*get_tx_power)(struct wiphy *, struct wireless_dev *, s32 *); 950 s32 (*add_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, struct key_params *); 951 s32 (*del_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *); 952 s32 (*get_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, void *, void(*)(void *, struct key_params *)); 953 s32 (*set_default_key)(struct wiphy *, struct net_device *, u8, bool, bool); 954 s32 (*set_default_mgmt_key)(struct wiphy *, struct net_device *, u8); 955 s32 (*set_power_mgmt)(struct wiphy *, struct net_device *, bool, s32); 956 s32 (*connect)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *); 957 s32 (*disconnect)(struct wiphy *, struct net_device *, u16); 958 s32 (*suspend)(struct wiphy *, struct cfg80211_wowlan *); 959 s32 (*resume)(struct wiphy *); 960 s32 (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *); 961 s32 (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *); 962 s32 (*flush_pmksa)(struct wiphy *, struct net_device *); 963 s32 (*start_ap)(struct wiphy *, struct net_device *, struct cfg80211_ap_settings *); 964 int (*stop_ap)(struct wiphy *, struct net_device *); 965 s32 (*change_beacon)(struct wiphy *, struct net_device *, struct cfg80211_beacon_data *); 966 int (*del_station)(struct wiphy *, struct net_device *, struct station_del_parameters *); 967 int (*change_station)(struct wiphy *, struct net_device *, const u8 *, struct station_parameters *); 968 int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *); 969 int (*sched_scan_stop)(struct wiphy *, struct net_device *, u64); 970 void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *); 971 int (*mgmt_tx)(struct wiphy *, struct wireless_dev *, struct cfg80211_mgmt_tx_params *, u64 *); 972 int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, u64); 973 int (*get_channel)(struct wiphy *, struct wireless_dev *, struct cfg80211_chan_def *); 974 int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, u16); 975 void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *); 976 int (*tdls_oper)(struct wiphy *, struct net_device *, const u8 *, enum nl80211_tdls_operation); 977 int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, u32); 978 int (*set_pmk)(struct wiphy *, struct net_device *, const struct cfg80211_pmk_conf *); 979 int (*del_pmk)(struct wiphy *, struct net_device *, const u8 *); 980 int (*remain_on_channel)(struct wiphy *, struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int, u64 *); 981 int (*start_p2p_device)(struct wiphy *, struct wireless_dev *); 982 void (*stop_p2p_device)(struct wiphy *, struct wireless_dev *); 983 }; 984 985 986 /* -------------------------------------------------------------------------- */ 987 988 /* linux_80211.c */ 989 990 struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t); 991 void linuxkpi_wiphy_free(struct wiphy *wiphy); 992 993 int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 994 struct linuxkpi_ieee80211_regdomain *regd); 995 uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band); 996 uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t); 997 998 /* -------------------------------------------------------------------------- */ 999 1000 static __inline struct wiphy * 1001 wiphy_new(const struct cfg80211_ops *ops, size_t priv_len) 1002 { 1003 1004 return (linuxkpi_wiphy_new(ops, priv_len)); 1005 } 1006 1007 static __inline void 1008 wiphy_free(struct wiphy *wiphy) 1009 { 1010 1011 linuxkpi_wiphy_free(wiphy); 1012 } 1013 1014 static __inline void * 1015 wiphy_priv(struct wiphy *wiphy) 1016 { 1017 1018 return (wiphy->priv); 1019 } 1020 1021 static __inline void 1022 set_wiphy_dev(struct wiphy *wiphy, struct device *dev) 1023 { 1024 1025 wiphy->dev = dev; 1026 } 1027 1028 static __inline struct device * 1029 wiphy_dev(struct wiphy *wiphy) 1030 { 1031 1032 return (wiphy->dev); 1033 } 1034 1035 #define wiphy_err(_wiphy, _fmt, ...) \ 1036 dev_err((_wiphy)->dev, _fmt, __VA_ARGS__) 1037 1038 static __inline const struct linuxkpi_ieee80211_regdomain * 1039 wiphy_dereference(struct wiphy *wiphy, 1040 const struct linuxkpi_ieee80211_regdomain *regd) 1041 { 1042 TODO(); 1043 return (NULL); 1044 } 1045 1046 /* -------------------------------------------------------------------------- */ 1047 1048 static __inline int 1049 reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq, 1050 struct ieee80211_reg_rule *rule) 1051 { 1052 1053 /* ETSI has special rules. FreeBSD regdb needs to learn about them. */ 1054 TODO(); 1055 1056 return (-ENXIO); 1057 } 1058 1059 static __inline const u8 * 1060 cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len, 1061 const u8 *match, int x, int y) 1062 { 1063 TODO(); 1064 return (NULL); 1065 } 1066 1067 static __inline const u8 * 1068 cfg80211_find_ie(uint8_t eid, uint8_t *variable, uint32_t frame_size) 1069 { 1070 TODO(); 1071 return (NULL); 1072 } 1073 1074 static __inline void 1075 cfg80211_pmsr_complete(struct wireless_dev *wdev, 1076 struct cfg80211_pmsr_request *req, gfp_t gfp) 1077 { 1078 TODO(); 1079 } 1080 1081 static __inline void 1082 cfg80211_pmsr_report(struct wireless_dev *wdev, 1083 struct cfg80211_pmsr_request *req, 1084 struct cfg80211_pmsr_result *result, gfp_t gfp) 1085 { 1086 TODO(); 1087 } 1088 1089 static __inline void 1090 cfg80211_chandef_create(struct cfg80211_chan_def *chandef, 1091 struct linuxkpi_ieee80211_channel *chan, enum nl80211_chan_flags chan_flag) 1092 { 1093 1094 KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__)); 1095 KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__)); 1096 1097 chandef->chan = chan; 1098 chandef->center_freq2 = 0; /* Set here and only overwrite if needed. */ 1099 chandef->chan = chan; 1100 1101 switch (chan_flag) { 1102 case NL80211_CHAN_NO_HT: 1103 chandef->width = NL80211_CHAN_WIDTH_20_NOHT; 1104 chandef->center_freq1 = chan->center_freq; 1105 break; 1106 default: 1107 printf("%s: unsupported chan_flag %#0x\n", __func__, chan_flag); 1108 /* XXX-BZ should we panic instead? */ 1109 chandef->width = NL80211_CHAN_WIDTH_20; 1110 chandef->center_freq1 = chan->center_freq; 1111 break; 1112 }; 1113 } 1114 1115 static __inline void 1116 cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef, 1117 void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data) 1118 { 1119 TODO(); 1120 } 1121 1122 struct element { 1123 uint8_t id; 1124 uint8_t datalen; 1125 uint8_t data[0]; 1126 }; 1127 1128 static __inline const struct element * 1129 cfg80211_find_elem(enum ieee80211_eid eid, uint8_t *data, size_t len) 1130 { 1131 TODO(); 1132 return (NULL); 1133 } 1134 1135 static __inline uint32_t 1136 cfg80211_calculate_bitrate(struct rate_info *rate) 1137 { 1138 TODO(); 1139 return (-1); 1140 } 1141 1142 static __inline uint32_t 1143 ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band) 1144 { 1145 1146 return (linuxkpi_ieee80211_channel_to_frequency(channel, band)); 1147 } 1148 1149 static __inline uint32_t 1150 ieee80211_frequency_to_channel(uint32_t freq) 1151 { 1152 1153 return (linuxkpi_ieee80211_frequency_to_channel(freq, 0)); 1154 } 1155 1156 static __inline int 1157 regulatory_set_wiphy_regd_sync(struct wiphy *wiphy, 1158 struct linuxkpi_ieee80211_regdomain *regd) 1159 { 1160 IMPROVE(); 1161 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd)); 1162 } 1163 1164 static __inline int 1165 regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy, 1166 struct linuxkpi_ieee80211_regdomain *regd) 1167 { 1168 1169 IMPROVE(); 1170 return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd)); 1171 } 1172 1173 static __inline int 1174 regulatory_set_wiphy_regd(struct wiphy *wiphy, 1175 struct linuxkpi_ieee80211_regdomain *regd) 1176 { 1177 1178 IMPROVE(); 1179 if (regd == NULL) 1180 return (EINVAL); 1181 1182 /* XXX-BZ wild guessing here based on brcmfmac. */ 1183 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) 1184 wiphy->regd = regd; 1185 else 1186 return (EPERM); 1187 1188 /* XXX FIXME, do we have to do anything with reg_notifier? */ 1189 return (0); 1190 } 1191 1192 static __inline int 1193 regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2) 1194 { 1195 TODO(); 1196 return (-ENXIO); 1197 } 1198 1199 static __inline struct linuxkpi_ieee80211_regdomain * 1200 rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd) 1201 { 1202 TODO(); 1203 return (NULL); 1204 } 1205 1206 static __inline struct ieee80211_reg_rule * 1207 freq_reg_info(struct wiphy *wiphy, uint32_t center_freq) 1208 { 1209 TODO(); 1210 return (NULL); 1211 } 1212 1213 static __inline struct cfg80211_bss * 1214 cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan, 1215 uint8_t *bssid, void *p, int x, uint32_t f1, uint32_t f2) 1216 { 1217 TODO(); 1218 return (NULL); 1219 } 1220 1221 static __inline void 1222 cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss) 1223 { 1224 TODO(); 1225 } 1226 1227 static __inline void 1228 wiphy_apply_custom_regulatory(struct wiphy *wiphy, 1229 const struct linuxkpi_ieee80211_regdomain *regd) 1230 { 1231 TODO(); 1232 } 1233 1234 static __inline char * 1235 wiphy_name(struct wiphy *wiphy) 1236 { 1237 if (wiphy != NULL && wiphy->dev != NULL) 1238 return dev_name(wiphy->dev); 1239 else 1240 return ("wlanNA"); 1241 } 1242 1243 static __inline void 1244 wiphy_read_of_freq_limits(struct wiphy *wiphy) 1245 { 1246 #ifdef FDT 1247 TODO(); 1248 #endif 1249 } 1250 1251 static __inline uint8_t * 1252 cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type, 1253 uint8_t *data, size_t len) 1254 { 1255 TODO(); 1256 return (NULL); 1257 } 1258 1259 static __inline void 1260 wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef) 1261 { 1262 1263 set_bit(ef, wiphy->ext_features); 1264 } 1265 1266 static __inline void * 1267 wiphy_net(struct wiphy *wiphy) 1268 { 1269 TODO(); 1270 return (NULL); /* XXX passed to dev_net_set() */ 1271 } 1272 1273 static __inline int 1274 wiphy_register(struct wiphy *wiphy) 1275 { 1276 TODO(); 1277 return (0); 1278 } 1279 1280 static __inline void 1281 wiphy_unregister(struct wiphy *wiphy) 1282 { 1283 TODO(); 1284 } 1285 1286 static __inline void 1287 wiphy_warn(struct wiphy *wiphy, const char *fmt, ...) 1288 { 1289 TODO(); 1290 } 1291 1292 static __inline int 1293 cfg80211_check_combinations(struct wiphy *wiphy, 1294 struct iface_combination_params *params) 1295 { 1296 TODO(); 1297 return (-ENOENT); 1298 } 1299 1300 static __inline uint8_t 1301 cfg80211_classify8021d(struct sk_buff *skb, void *p) 1302 { 1303 TODO(); 1304 return (0); 1305 } 1306 1307 static __inline void 1308 cfg80211_connect_done(struct net_device *ndev, 1309 struct cfg80211_connect_resp_params *conn_params, gfp_t gfp) 1310 { 1311 TODO(); 1312 } 1313 1314 static __inline void 1315 cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp) 1316 { 1317 TODO(); 1318 } 1319 1320 static __inline void 1321 cfg80211_disconnected(struct net_device *ndev, uint16_t reason, 1322 void *p, int x, bool locally_generated, gfp_t gfp) 1323 { 1324 TODO(); 1325 } 1326 1327 static __inline int 1328 cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len, 1329 enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len) 1330 { 1331 TODO(); 1332 return (-1); 1333 } 1334 1335 static __inline void 1336 cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr, 1337 struct linuxkpi_ieee80211_channel *chan, gfp_t gfp) 1338 { 1339 TODO(); 1340 } 1341 1342 static __inline struct cfg80211_bss * 1343 cfg80211_inform_bss(struct wiphy *wiphy, 1344 struct linuxkpi_ieee80211_channel *channel, 1345 enum cfg80211_bss_ftypes bss_ftype, const uint8_t *bss, int _x, 1346 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, 1347 int signal, gfp_t gfp) 1348 { 1349 TODO(); 1350 return (NULL); 1351 } 1352 1353 static __inline struct cfg80211_bss * 1354 cfg80211_inform_bss_data(struct wiphy *wiphy, 1355 struct cfg80211_inform_bss *bss_data, 1356 enum cfg80211_bss_ftypes bss_ftype, const uint8_t *bss, int _x, 1357 uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp) 1358 { 1359 TODO(); 1360 return (NULL); 1361 } 1362 1363 static __inline void 1364 cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie, 1365 const u8 *buf, size_t len, bool ack, gfp_t gfp) 1366 { 1367 TODO(); 1368 } 1369 1370 static __inline void 1371 cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr, 1372 enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp) 1373 { 1374 TODO(); 1375 } 1376 1377 static __inline void 1378 cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr, 1379 struct station_info *sinfo, gfp_t gfp) 1380 { 1381 TODO(); 1382 } 1383 1384 static __inline void 1385 cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp) 1386 { 1387 TODO(); 1388 } 1389 1390 static __inline void 1391 cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid, 1392 gfp_t gfp) 1393 { 1394 TODO(); 1395 } 1396 1397 static __inline void 1398 cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie, 1399 struct linuxkpi_ieee80211_channel *channel, unsigned int duration, 1400 gfp_t gfp) 1401 { 1402 TODO(); 1403 } 1404 1405 static __inline void 1406 cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, 1407 uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp) 1408 { 1409 TODO(); 1410 } 1411 1412 static __inline void 1413 cfg80211_report_wowlan_wakeup(void) 1414 { 1415 TODO(); 1416 } 1417 1418 static __inline void 1419 cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info, 1420 gfp_t gfp) 1421 { 1422 TODO(); 1423 } 1424 1425 static __inline void 1426 cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x, 1427 uint8_t *p, size_t p_len, int _x2) 1428 { 1429 TODO(); 1430 } 1431 1432 static __inline void 1433 cfg80211_scan_done(struct cfg80211_scan_request *scan_request, 1434 struct cfg80211_scan_info *info) 1435 { 1436 TODO(); 1437 } 1438 1439 static __inline void 1440 cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid) 1441 { 1442 TODO(); 1443 } 1444 1445 static __inline void 1446 cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x) 1447 { 1448 TODO(); 1449 } 1450 1451 static __inline void 1452 cfg80211_unregister_wdev(struct wireless_dev *wdev) 1453 { 1454 TODO(); 1455 } 1456 1457 static __inline struct sk_buff * 1458 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len) 1459 { 1460 TODO(); 1461 return (NULL); 1462 } 1463 1464 static __inline int 1465 cfg80211_vendor_cmd_reply(struct sk_buff *skb) 1466 { 1467 TODO(); 1468 return (-ENXIO); 1469 } 1470 1471 static __inline struct linuxkpi_ieee80211_channel * 1472 ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq) 1473 { 1474 TODO(); 1475 return (NULL); 1476 } 1477 1478 static __inline size_t 1479 ieee80211_get_hdrlen_from_skb(struct sk_buff *skb) 1480 { 1481 1482 TODO(); 1483 return (-1); 1484 } 1485 1486 static __inline void 1487 cfg80211_bss_flush(struct wiphy *wiphy) 1488 { 1489 TODO(); 1490 } 1491 1492 static __inline bool 1493 cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel) 1494 { 1495 1496 /* Only 6Ghz. */ 1497 if (channel->band != NL80211_BAND_6GHZ) 1498 return (false); 1499 1500 TODO(); 1501 return (false); 1502 } 1503 1504 1505 /* Used for scanning at least. */ 1506 static __inline void 1507 get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask) 1508 { 1509 int i; 1510 1511 /* Get a completely random address and then overlay what we want. */ 1512 get_random_bytes(dst, ETH_ALEN); 1513 for (i = 0; i < ETH_ALEN; i++) 1514 dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]); 1515 } 1516 1517 #ifndef LINUXKPI_NET80211 1518 #define ieee80211_channel linuxkpi_ieee80211_channel 1519 #define ieee80211_regdomain linuxkpi_ieee80211_regdomain 1520 /* net80211::IEEE80211_VHT_MCS_SUPPORT_0_n() conflicts */ 1521 #if defined(IEEE80211_VHT_MCS_SUPPORT_0_7) 1522 #undef IEEE80211_VHT_MCS_SUPPORT_0_7 1523 #endif 1524 #if defined(IEEE80211_VHT_MCS_SUPPORT_0_8) 1525 #undef IEEE80211_VHT_MCS_SUPPORT_0_8 1526 #endif 1527 #if defined(IEEE80211_VHT_MCS_SUPPORT_0_9) 1528 #undef IEEE80211_VHT_MCS_SUPPORT_0_9 1529 #endif 1530 #define IEEE80211_VHT_MCS_SUPPORT_0_7 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_7 1531 #define IEEE80211_VHT_MCS_SUPPORT_0_8 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_8 1532 #define IEEE80211_VHT_MCS_SUPPORT_0_9 LKPI_IEEE80211_VHT_MCS_SUPPORT_0_9 1533 #endif 1534 1535 #endif /* _LINUXKPI_NET_CFG80211_H */ 1536