1 /*- 2 * Copyright (c) 2020-2021 The FreeBSD Foundation 3 * Copyright (c) 2020-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_MAC80211_H 33 #define _LINUXKPI_NET_MAC80211_H 34 35 #include <sys/types.h> 36 37 #include <asm/atomic64.h> 38 #include <linux/bitops.h> 39 #include <linux/etherdevice.h> 40 #include <linux/netdevice.h> 41 #include <linux/skbuff.h> 42 #include <linux/workqueue.h> 43 #include <net/cfg80211.h> 44 45 #define ARPHRD_IEEE80211_RADIOTAP __LINE__ /* XXX TODO brcmfmac */ 46 47 #define WLAN_OUI_MICROSOFT (0x0050F2) 48 #define WLAN_OUI_TYPE_MICROSOFT_TPC (8) 49 #define WLAN_OUI_TYPE_WFA_P2P (9) 50 #define WLAN_OUI_WFA (0x506F9A) 51 52 /* hw->conf.flags */ 53 enum ieee80211_hw_conf_flags { 54 IEEE80211_CONF_IDLE = BIT(0), 55 IEEE80211_CONF_PS = BIT(1), 56 }; 57 58 /* (*ops->config()) */ 59 enum ieee80211_hw_conf_changed_flags { 60 IEEE80211_CONF_CHANGE_CHANNEL = BIT(0), 61 IEEE80211_CONF_CHANGE_IDLE = BIT(1), 62 IEEE80211_CONF_CHANGE_PS = BIT(2), 63 }; 64 65 #define CFG80211_TESTMODE_CMD(_x) /* XXX TODO */ 66 67 #define FCS_LEN 4 68 69 /* ops.configure_filter() */ 70 enum mcast_filter_flags { 71 FIF_ALLMULTI = BIT(0), 72 FIF_PROBE_REQ = BIT(1), 73 FIF_BCN_PRBRESP_PROMISC = BIT(2), 74 FIF_FCSFAIL = BIT(3), 75 FIF_OTHER_BSS = BIT(4), 76 }; 77 78 enum ieee80211_bss_changed { 79 BSS_CHANGED_ARP_FILTER = BIT(0), 80 BSS_CHANGED_ASSOC = BIT(1), 81 BSS_CHANGED_BANDWIDTH = BIT(2), 82 BSS_CHANGED_BEACON = BIT(3), 83 BSS_CHANGED_BEACON_ENABLED = BIT(4), 84 BSS_CHANGED_BEACON_INFO = BIT(5), 85 BSS_CHANGED_BEACON_INT = BIT(6), 86 BSS_CHANGED_BSSID = BIT(7), 87 BSS_CHANGED_CQM = BIT(8), 88 BSS_CHANGED_ERP_CTS_PROT = BIT(9), 89 BSS_CHANGED_ERP_SLOT = BIT(10), 90 BSS_CHANGED_FTM_RESPONDER = BIT(11), 91 BSS_CHANGED_HT = BIT(12), 92 BSS_CHANGED_IDLE = BIT(13), 93 BSS_CHANGED_MU_GROUPS = BIT(14), 94 BSS_CHANGED_P2P_PS = BIT(15), 95 BSS_CHANGED_PS = BIT(16), 96 BSS_CHANGED_QOS = BIT(17), 97 BSS_CHANGED_TXPOWER = BIT(18), 98 BSS_CHANGED_HE_BSS_COLOR = BIT(19), 99 }; 100 101 /* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */ 102 #define WLAN_CIPHER_SUITE_OUI(_oui, _x) ((_oui) << 8 | (_x) & 0xff) 103 104 /* 802.11 Table 9-131 Cipher suite selectors. */ 105 /* 802.1x suite B 11 */ 106 #define WLAN_CIPHER_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x) 107 /* Use group 0 */ 108 #define WLAN_CIPHER_SUITE_WEP40 WLAN_CIPHER_SUITE(1) 109 #define WLAN_CIPHER_SUITE_TKIP WLAN_CIPHER_SUITE(2) 110 /* Reserved 3 */ 111 #define WLAN_CIPHER_SUITE_CCMP WLAN_CIPHER_SUITE(4) /* CCMP-128 */ 112 #define WLAN_CIPHER_SUITE_WEP104 WLAN_CIPHER_SUITE(5) 113 #define WLAN_CIPHER_SUITE_AES_CMAC WLAN_CIPHER_SUITE(6) /* BIP-CMAC-128 */ 114 /* Group addressed traffic not allowed 7 */ 115 #define WLAN_CIPHER_SUITE_GCMP WLAN_CIPHER_SUITE(8) 116 #define WLAN_CIPHER_SUITE_GCMP_256 WLAN_CIPHER_SUITE(9) 117 #define WLAN_CIPHER_SUITE_CCMP_256 WLAN_CIPHER_SUITE(10) 118 #define WLAN_CIPHER_SUITE_BIP_GMAC_128 WLAN_CIPHER_SUITE(11) 119 #define WLAN_CIPHER_SUITE_BIP_GMAC_256 WLAN_CIPHER_SUITE(12) 120 #define WLAN_CIPHER_SUITE_BIP_CMAC_256 WLAN_CIPHER_SUITE(13) 121 /* Reserved 14-255 */ 122 123 124 /* 802.11 Table 9-133 AKM suite selectors. */ 125 #define WLAN_AKM_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x) 126 /* Reserved 0 */ 127 #define WLAN_AKM_SUITE_8021X WLAN_AKM_SUITE(1) 128 #define WLAN_AKM_SUITE_PSK WLAN_AKM_SUITE(2) 129 #define WLAN_AKM_SUITE_FT_8021X WLAN_AKM_SUITE(3) 130 #define WLAN_AKM_SUITE_FT_PSK WLAN_AKM_SUITE(4) 131 #define WLAN_AKM_SUITE_8021X_SHA256 WLAN_AKM_SUITE(5) 132 #define WLAN_AKM_SUITE_PSK_SHA256 WLAN_AKM_SUITE(6) 133 /* TDLS 7 */ 134 #define WLAN_AKM_SUITE_SAE WLAN_AKM_SUITE(8) 135 /* FToSAE 9 */ 136 /* AP peer key 10 */ 137 /* 802.1x suite B 11 */ 138 /* 802.1x suite B 384 12 */ 139 /* FTo802.1x 384 13 */ 140 /* Reserved 14-255 */ 141 /* Apparently 11ax defines more. Seen (19,20) mentioned. */ 142 143 144 struct ieee80211_sta; 145 146 struct ieee80211_ampdu_params { 147 /* TODO FIXME */ 148 struct ieee80211_sta *sta; 149 uint8_t tid; 150 uint16_t ssn; 151 int action, amsdu, buf_size, timeout; 152 }; 153 154 struct ieee80211_bar { 155 /* TODO FIXME */ 156 int control, start_seq_num; 157 uint8_t *ra; 158 uint16_t frame_control; 159 }; 160 161 struct ieee80211_p2p_noa_attr { 162 /* TODO FIXME */ 163 int oppps_ctwindow; 164 int desc, index; 165 }; 166 167 #define WLAN_MEMBERSHIP_LEN (8) 168 #define WLAN_USER_POSITION_LEN (16) 169 170 struct ieee80211_bss_conf { 171 /* TODO FIXME */ 172 uint8_t bssid[ETH_ALEN]; 173 uint8_t transmitter_bssid[ETH_ALEN]; 174 struct ieee80211_ftm_responder_params *ftmr_params; 175 struct ieee80211_p2p_noa_attr p2p_noa_attr; 176 struct cfg80211_chan_def chandef; 177 __be32 arp_addr_list[1]; /* XXX TODO */ 178 struct ieee80211_rate *beacon_rate; 179 struct { 180 uint8_t membership[WLAN_MEMBERSHIP_LEN]; 181 uint8_t position[WLAN_USER_POSITION_LEN]; 182 } mu_group; 183 struct { 184 int color; 185 } he_bss_color; 186 size_t ssid_len; 187 uint8_t ssid[IEEE80211_NWID_LEN]; 188 uint16_t aid; 189 uint16_t beacon_int; 190 uint16_t ht_operation_mode; 191 int arp_addr_cnt; 192 uint8_t dtim_period; 193 bool assoc; 194 bool idle; 195 bool qos; 196 bool ps; 197 bool twt_broadcast; 198 bool use_cts_prot; 199 bool use_short_preamble; 200 bool use_short_slot; 201 202 int txpower; 203 int ack_enabled, bssid_index, bssid_indicator, cqm_rssi_hyst, cqm_rssi_thold, ema_ap, frame_time_rts_th, ftm_responder; 204 int htc_trig_based_pkt_ext; 205 int multi_sta_back_32bit, nontransmitted; 206 int profile_periodicity, sync_device_ts, sync_dtim_count, sync_tsf; 207 int twt_requester, uora_exists, uora_ocw_range; 208 int assoc_capability, enable_beacon, hidden_ssid, ibss_joined, mcast_rate, twt_protected; 209 unsigned long basic_rates; 210 bool he_support; 211 }; 212 213 struct ieee80211_chanctx_conf { 214 /* TODO FIXME */ 215 int rx_chains_dynamic, rx_chains_static; 216 bool radar_enabled; 217 struct cfg80211_chan_def def; 218 struct cfg80211_chan_def min_def; 219 220 /* Must stay last. */ 221 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); 222 }; 223 224 struct ieee80211_channel_switch { 225 /* TODO FIXME */ 226 int block_tx, count, delay, device_timestamp, timestamp; 227 struct cfg80211_chan_def chandef; 228 }; 229 230 struct ieee80211_cipher_scheme { 231 uint32_t cipher; 232 uint8_t iftype; /* We do not know the size of this. */ 233 uint8_t hdr_len; 234 uint8_t pn_len; 235 uint8_t pn_off; 236 uint8_t key_idx_off; 237 uint8_t key_idx_mask; 238 uint8_t key_idx_shift; 239 uint8_t mic_len; 240 }; 241 242 enum ieee80211_event_type { 243 BA_FRAME_TIMEOUT, 244 BAR_RX_EVENT, 245 MLME_EVENT, 246 RSSI_EVENT, 247 }; 248 249 enum ieee80211_rssi_event_data { 250 RSSI_EVENT_LOW, 251 RSSI_EVENT_HIGH, 252 }; 253 254 enum ieee80211_mlme_event_data { 255 ASSOC_EVENT, 256 AUTH_EVENT, 257 DEAUTH_RX_EVENT, 258 DEAUTH_TX_EVENT, 259 }; 260 261 enum ieee80211_mlme_event_status { 262 MLME_DENIED, 263 MLME_TIMEOUT, 264 }; 265 266 struct ieee80211_mlme_event { 267 enum ieee80211_mlme_event_data data; 268 enum ieee80211_mlme_event_status status; 269 int reason; 270 }; 271 272 struct ieee80211_event { 273 /* TODO FIXME */ 274 enum ieee80211_event_type type; 275 union { 276 struct { 277 int ssn; 278 struct ieee80211_sta *sta; 279 uint8_t tid; 280 } ba; 281 struct ieee80211_mlme_event mlme; 282 } u; 283 }; 284 285 struct ieee80211_ftm_responder_params { 286 /* TODO FIXME */ 287 uint8_t *lci; 288 uint8_t *civicloc; 289 int lci_len; 290 int civicloc_len; 291 }; 292 293 struct ieee80211_he_mu_edca_param_ac_rec { 294 /* TODO FIXME */ 295 int aifsn, ecw_min_max, mu_edca_timer; 296 }; 297 298 enum ieee80211_hw_flags { 299 IEEE80211_HW_AMPDU_AGGREGATION, 300 IEEE80211_HW_AP_LINK_PS, 301 IEEE80211_HW_BUFF_MMPDU_TXQ, 302 IEEE80211_HW_CHANCTX_STA_CSA, 303 IEEE80211_HW_CONNECTION_MONITOR, 304 IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, 305 IEEE80211_HW_HAS_RATE_CONTROL, 306 IEEE80211_HW_MFP_CAPABLE, 307 IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR, 308 IEEE80211_HW_REPORTS_TX_ACK_STATUS, 309 IEEE80211_HW_RX_INCLUDES_FCS, 310 IEEE80211_HW_SIGNAL_DBM, 311 IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS, 312 IEEE80211_HW_SPECTRUM_MGMT, 313 IEEE80211_HW_STA_MMPDU_TXQ, 314 IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU, 315 IEEE80211_HW_SUPPORTS_CLONED_SKBS, 316 IEEE80211_HW_SUPPORTS_DYNAMIC_PS, 317 IEEE80211_HW_SUPPORTS_MULTI_BSSID, 318 IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, 319 IEEE80211_HW_SUPPORTS_PS, 320 IEEE80211_HW_SUPPORTS_REORDERING_BUFFER, 321 IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW, 322 IEEE80211_HW_SUPPORT_FAST_XMIT, 323 IEEE80211_HW_TDLS_WIDER_BW, 324 IEEE80211_HW_TIMING_BEACON_ONLY, 325 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW, 326 IEEE80211_HW_TX_AMSDU, 327 IEEE80211_HW_TX_FRAG_LIST, 328 IEEE80211_HW_USES_RSS, 329 IEEE80211_HW_WANT_MONITOR_VIF, 330 331 /* Keep last. */ 332 NUM_IEEE80211_HW_FLAGS 333 }; 334 335 struct ieee80211_hw { 336 337 struct wiphy *wiphy; 338 339 /* TODO FIXME */ 340 int max_rx_aggregation_subframes, max_tx_aggregation_subframes; 341 int extra_tx_headroom, weight_multiplier; 342 int max_rate_tries, max_rates, max_report_rates; 343 struct ieee80211_cipher_scheme *cipher_schemes; 344 int n_cipher_schemes; 345 const char *rate_control_algorithm; 346 struct { 347 uint16_t units_pos; /* radiotap "spec" is .. inconsistent. */ 348 uint16_t accuracy; 349 } radiotap_timestamp; 350 size_t sta_data_size; 351 size_t vif_data_size; 352 size_t chanctx_data_size; 353 size_t txq_data_size; 354 uint16_t radiotap_mcs_details; 355 uint16_t radiotap_vht_details; 356 uint16_t queues; 357 uint16_t offchannel_tx_hw_queue; 358 uint16_t uapsd_max_sp_len; 359 uint16_t uapsd_queues; 360 uint16_t max_tx_fragments; 361 uint16_t max_listen_interval; 362 netdev_features_t netdev_features; 363 unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)]; 364 struct { 365 uint32_t listen_interval; 366 enum ieee80211_hw_conf_flags flags; 367 struct cfg80211_chan_def chandef; 368 } conf; 369 370 #if 0 /* leave here for documentation purposes. This does NOT work. */ 371 /* Must stay last. */ 372 uint8_t priv[0] __aligned(CACHE_LINE_SIZE); 373 #else 374 void *priv; 375 #endif 376 }; 377 378 enum ieee802111_key_flag { 379 IEEE80211_KEY_FLAG_GENERATE_IV = BIT(0), 380 IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(1), 381 IEEE80211_KEY_FLAG_PAIRWISE = BIT(2), 382 IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(3), 383 IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(4), 384 IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(5), 385 }; 386 387 struct ieee80211_key_conf { 388 atomic64_t tx_pn; 389 uint32_t cipher; 390 uint8_t icv_len; /* __unused nowadays? */ 391 uint8_t iv_len; 392 uint8_t hw_key_idx; /* Set by drv. */ 393 uint8_t keyidx; 394 uint16_t flags; 395 uint8_t keylen; 396 uint8_t key[0]; 397 }; 398 399 struct ieee80211_key_seq { 400 /* TODO FIXME */ 401 union { 402 struct { 403 uint8_t seq[IEEE80211_MAX_PN_LEN]; 404 uint8_t seq_len; 405 } hw; 406 struct { 407 uint8_t pn[IEEE80211_CCMP_PN_LEN]; 408 } ccmp; 409 struct { 410 uint8_t pn[IEEE80211_CCMP_PN_LEN]; 411 } aes_cmac; 412 struct { 413 uint32_t iv32; 414 uint16_t iv16; 415 } tkip; 416 }; 417 }; 418 419 420 struct ieee80211_p2p_noa_desc { 421 /* TODO FIXME */ 422 }; 423 424 enum ieee80211_rx_status_flags { 425 RX_FLAG_ALLOW_SAME_PN = BIT(0), 426 RX_FLAG_AMPDU_DETAILS = BIT(1), 427 RX_FLAG_AMPDU_EOF_BIT = BIT(2), 428 RX_FLAG_AMPDU_EOF_BIT_KNOWN = BIT(3), 429 RX_FLAG_DECRYPTED = BIT(4), 430 RX_FLAG_DUP_VALIDATED = BIT(5), 431 RX_FLAG_FAILED_FCS_CRC = BIT(6), 432 RX_FLAG_ICV_STRIPPED = BIT(7), 433 RX_FLAG_MACTIME_PLCP_START = BIT(8), 434 RX_FLAG_MACTIME_START = BIT(9), 435 RX_FLAG_MIC_STRIPPED = BIT(10), 436 RX_FLAG_MMIC_ERROR = BIT(11), 437 RX_FLAG_MMIC_STRIPPED = BIT(12), 438 RX_FLAG_NO_PSDU = BIT(13), 439 RX_FLAG_PN_VALIDATED = BIT(14), 440 RX_FLAG_RADIOTAP_HE = BIT(15), 441 RX_FLAG_RADIOTAP_HE_MU = BIT(16), 442 RX_FLAG_RADIOTAP_LSIG = BIT(17), 443 RX_FLAG_RADIOTAP_VENDOR_DATA = BIT(18), 444 RX_FLAG_NO_SIGNAL_VAL = BIT(19), 445 }; 446 447 struct ieee80211_rx_status { 448 /* TODO FIXME, this is too large. Over-reduce types to u8 where possible. */ 449 u8 boottime_ns; 450 u8 mactime; 451 u8 device_timestamp; 452 enum ieee80211_rx_status_flags flag; 453 u16 freq; 454 u8 bw; 455 #define RATE_INFO_BW_20 0x01 456 #define RATE_INFO_BW_40 0x02 457 #define RATE_INFO_BW_80 0x04 458 #define RATE_INFO_BW_160 0x08 459 #define RATE_INFO_BW_HE_RU 0x10 460 u8 encoding; 461 #define RX_ENC_LEGACY 0x00 462 #define RX_ENC_HE 0x01 463 #define RX_ENC_HT 0x02 464 #define RX_ENC_VHT 0x04 465 u8 ampdu_reference; 466 u8 band; 467 u8 chains; 468 u8 chain_signal[3]; 469 u8 signal; 470 u8 enc_flags; 471 u8 he_dcm; 472 u8 he_gi; 473 u8 he_ru; 474 u8 zero_length_psdu_type; 475 uint8_t nss; 476 uint8_t rate_idx; 477 }; 478 479 struct ieee80211_scan_ies { 480 /* TODO FIXME */ 481 int common_ie_len; 482 int len[NUM_NL80211_BANDS]; 483 uint8_t *common_ies; 484 uint8_t *ies[NUM_NL80211_BANDS]; 485 }; 486 487 struct ieee80211_scan_request { 488 struct ieee80211_scan_ies ies; 489 struct cfg80211_scan_request req; 490 }; 491 492 struct ieee80211_txq { 493 struct ieee80211_sta *sta; 494 struct ieee80211_vif *vif; 495 int ac; 496 uint8_t tid; 497 498 /* Must stay last. */ 499 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); 500 }; 501 502 struct ieee80211_sta_rates { 503 /* XXX TODO */ 504 /* XXX some _rcu thing */ 505 struct { 506 int idx; 507 int flags; 508 } rate[1]; /* XXX what is the real number? */ 509 }; 510 511 #define IEEE80211_NUM_TIDS 16 /* net80211::WME_NUM_TID */ 512 struct ieee80211_sta { 513 /* TODO FIXME */ 514 int max_amsdu_len, max_amsdu_subframes, max_rc_amsdu_len, max_sp; 515 int mfp, rx_nss, smps_mode, tdls, tdls_initiator, uapsd_queues, wme, txpwr; 516 enum ieee80211_sta_rx_bw bandwidth; 517 struct ieee80211_sta_ht_cap ht_cap; 518 struct ieee80211_sta_vht_cap vht_cap; 519 struct ieee80211_sta_he_cap he_cap; 520 struct ieee80211_sta_he_6ghz_capa he_6ghz_capa; 521 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; /* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */ 522 struct ieee80211_sta_rates *rates; /* some rcu thing? */ 523 uint32_t max_tid_amsdu_len[IEEE80211_NUM_TIDS]; 524 uint32_t supp_rates[NUM_NL80211_BANDS]; 525 uint8_t addr[ETH_ALEN]; 526 uint16_t aid; 527 528 /* Must stay last. */ 529 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); 530 }; 531 532 struct ieee80211_tdls_ch_sw_params { 533 /* TODO FIXME */ 534 int action_code, ch_sw_tm_ie, status, switch_time, switch_timeout, timestamp; 535 struct ieee80211_sta *sta; 536 struct cfg80211_chan_def *chandef; 537 struct sk_buff *tmpl_skb; 538 }; 539 540 struct ieee80211_tx_control { 541 /* TODO FIXME */ 542 struct ieee80211_sta *sta; 543 }; 544 545 struct ieee80211_tx_queue_params { 546 /* These types are based on iwlwifi FW structs. */ 547 uint16_t cw_min; 548 uint16_t cw_max; 549 uint16_t txop; 550 uint8_t aifs; 551 552 /* TODO FIXME */ 553 int acm, mu_edca, uapsd; 554 struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec; 555 }; 556 557 struct ieee80211_tx_rate { 558 uint8_t idx; 559 uint16_t count:5, 560 flags:11; 561 }; 562 563 enum ieee80211_vif_driver_flags { 564 IEEE80211_VIF_BEACON_FILTER = BIT(0), 565 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), 566 IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2), 567 }; 568 569 struct ieee80211_vif { 570 /* TODO FIXME */ 571 enum nl80211_iftype type; 572 int csa_active, mu_mimo_owner; 573 int cab_queue, hw_queue; 574 enum ieee80211_vif_driver_flags driver_flags; 575 bool p2p; 576 bool probe_req_reg; 577 uint8_t addr[ETH_ALEN]; 578 struct ieee80211_chanctx_conf *chanctx_conf; 579 struct ieee80211_txq *txq; 580 struct ieee80211_bss_conf bss_conf; 581 582 /* Must stay last. */ 583 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); 584 }; 585 586 struct ieee80211_vif_chanctx_switch { 587 struct ieee80211_chanctx_conf *old_ctx, *new_ctx; 588 struct ieee80211_vif *vif; 589 }; 590 591 struct ieee80211_prep_tx_info { 592 u16 duration; 593 bool success; 594 }; 595 596 /* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */ 597 /* Also warning: some sizes change by pointer size! This is 64bit only. */ 598 struct ieee80211_tx_info { 599 enum ieee80211_tx_info_flags flags; 600 /* TODO FIXME */ 601 u8 band; 602 u8 hw_queue; 603 bool tx_time_est; 604 union { 605 struct { 606 struct ieee80211_tx_rate rates[4]; 607 bool use_rts; 608 struct ieee80211_vif *vif; 609 struct ieee80211_key_conf *hw_key; 610 enum ieee80211_tx_control_flags flags; 611 } control; 612 struct { 613 struct ieee80211_tx_rate rates[4]; 614 uint32_t ack_signal; 615 uint8_t ampdu_ack_len; 616 uint8_t ampdu_len; 617 uint8_t antenna; 618 uint16_t tx_time; 619 bool is_valid_ack_signal; 620 void *status_driver_data[2]; /* XXX TODO */ 621 } status; 622 void *driver_data[5]; /* XXX TODO */ 623 }; 624 }; 625 626 /* net80211 conflict */ 627 #ifdef FIXME_TODO 628 struct ieee80211_tim_ie { 629 /* TODO FIXME */ 630 uint8_t dtim_count; 631 uint8_t dtim_period; 632 uint8_t bitmap_ctrl; 633 uint8_t virtual_map; 634 }; 635 #endif 636 637 struct survey_info { /* net80211::struct ieee80211_channel_survey */ 638 /* TODO FIXME */ 639 uint32_t filled; 640 #define SURVEY_INFO_TIME 0x0001 641 #define SURVEY_INFO_TIME_RX 0x0002 642 #define SURVEY_INFO_TIME_SCAN 0x0004 643 #define SURVEY_INFO_TIME_TX 0x0008 644 #define SURVEY_INFO_TIME_BSS_RX 0x0010 645 #define SURVEY_INFO_TIME_BUSY 0x0020 646 #define SURVEY_INFO_IN_USE 0x0040 647 #define SURVEY_INFO_NOISE_DBM 0x0080 648 uint32_t noise; 649 uint64_t time; 650 uint64_t time_bss_rx; 651 uint64_t time_busy; 652 uint64_t time_rx; 653 uint64_t time_scan; 654 uint64_t time_tx; 655 struct ieee80211_channel *channel; 656 }; 657 658 enum ieee80211_iface_iter { 659 IEEE80211_IFACE_ITER_NORMAL = BIT(0), 660 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(1), 661 662 /* Internal flags only. */ 663 /* ieee80211_iterate_active_interfaces*(). */ 664 IEEE80211_IFACE_ITER__ATOMIC = BIT(6), 665 IEEE80211_IFACE_ITER__ACTIVE = BIT(7), 666 }; 667 668 enum set_key_cmd { 669 SET_KEY, 670 DISABLE_KEY, 671 }; 672 673 enum rx_enc_flags { 674 RX_ENC_FLAG_SHORTPRE = BIT(0), 675 RX_ENC_FLAG_SHORT_GI = BIT(1), 676 RX_ENC_FLAG_HT_GF = BIT(2), 677 RX_ENC_FLAG_LDPC = BIT(3), 678 RX_ENC_FLAG_BF = BIT(4), 679 #define RX_ENC_FLAG_STBC_SHIFT 6 680 }; 681 682 enum sta_notify_cmd { 683 STA_NOTIFY_AWAKE, 684 STA_NOTIFY_SLEEP, 685 }; 686 687 struct ieee80211_ops { 688 /* TODO FIXME */ 689 int (*start)(struct ieee80211_hw *); 690 void (*stop)(struct ieee80211_hw *); 691 692 int (*config)(struct ieee80211_hw *, u32); 693 void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type); 694 695 int (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *); 696 void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *); 697 int (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool); 698 699 void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *); 700 void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *); 701 int (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *); 702 int (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *); 703 int (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *); 704 void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *); 705 706 int (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u16, const struct ieee80211_tx_queue_params *); 707 void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *); 708 int (*tx_last_beacon)(struct ieee80211_hw *); 709 void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *); 710 711 void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *); 712 void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *); 713 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *); 714 715 void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool); 716 717 int (*set_frag_threshold)(struct ieee80211_hw *, u32); 718 719 void (*sync_rx_queues)(struct ieee80211_hw *); 720 721 void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool); 722 void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool); 723 724 int (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 725 int (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 726 int (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 727 void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *); 728 void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 729 int (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state); 730 void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *); 731 void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32); 732 void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 733 734 u64 (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *); 735 736 int (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *); 737 738 bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *); 739 740 int (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); 741 int (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *); 742 void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); 743 void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *); 744 void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); 745 int (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32); 746 void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 747 void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *); 748 749 int (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *); 750 void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *); 751 void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32); 752 int (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_chanctx_conf *); 753 void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_chanctx_conf *); 754 int (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode); 755 756 int (*get_antenna)(struct ieee80211_hw *, u32 *, u32 *); 757 int (*set_antenna)(struct ieee80211_hw *, u32, u32); 758 759 int (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type); 760 int (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *); 761 762 void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64); 763 void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int); 764 765 void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u32); 766 int (*set_rts_threshold)(struct ieee80211_hw *, u32); 767 void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *); 768 int (*get_survey)(struct ieee80211_hw *, int, struct survey_info *); 769 int (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *); 770 void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64); 771 int (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *); 772 void (*set_coverage_class)(struct ieee80211_hw *, s16); 773 int (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool); 774 775 int (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *); 776 void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int); 777 void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *); 778 779 int (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *); 780 void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *); 781 782 int (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *); 783 void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *); 784 int (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *); 785 void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *); 786 787 int (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *); 788 789 /* XXX TODO: get_et_sset_count, get_et_stats, get_et_strings */ 790 }; 791 792 793 /* -------------------------------------------------------------------------- */ 794 795 /* linux_80211.c */ 796 extern const struct cfg80211_ops linuxkpi_mac80211cfgops; 797 798 struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t, 799 const struct ieee80211_ops *); 800 void linuxkpi_ieee80211_iffree(struct ieee80211_hw *); 801 void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *, char *); 802 void linuxkpi_ieee80211_ifattach(struct ieee80211_hw *); 803 void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *); 804 struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *); 805 void linuxkpi_ieee80211_iterate_interfaces( 806 struct ieee80211_hw *hw, enum ieee80211_iface_iter flags, 807 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 808 void *); 809 void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *, 810 struct ieee80211_vif *, 811 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, 812 struct ieee80211_sta *, struct ieee80211_key_conf *, void *), 813 void *); 814 void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *, 815 void(*iterfunc)(struct ieee80211_hw *, 816 struct ieee80211_chanctx_conf *, void *), 817 void *); 818 void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *, 819 void (*iterfunc)(void *, struct ieee80211_sta *), void *); 820 void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *, 821 struct cfg80211_scan_info *); 822 void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *, 823 struct ieee80211_sta *, struct napi_struct *); 824 uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *); 825 struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *, 826 const u8 *); 827 struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr( 828 struct ieee80211_hw *, uint8_t *, uint8_t *); 829 struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *, 830 struct ieee80211_txq *); 831 bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t); 832 bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t); 833 void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *, 834 int); 835 void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *, 836 struct delayed_work *, int); 837 void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *); 838 struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *, 839 struct ieee80211_vif *); 840 struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *, 841 struct ieee80211_vif *, bool); 842 void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, uint64_t *, 843 uint64_t *); 844 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *); 845 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *); 846 847 /* -------------------------------------------------------------------------- */ 848 849 static __inline void 850 _ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag) 851 { 852 853 set_bit(flag, hw->flags); 854 } 855 856 static __inline bool 857 __ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag) 858 { 859 860 return (test_bit(flag, hw->flags)); 861 } 862 863 /* They pass in shortened flag names; how confusingly inconsistent. */ 864 #define ieee80211_hw_set(_hw, _flag) \ 865 _ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag) 866 #define ieee80211_hw_check(_hw, _flag) \ 867 __ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag) 868 869 /* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */ 870 CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb)); 871 #define IEEE80211_SKB_CB(_skb) \ 872 ((struct ieee80211_tx_info *)((_skb)->cb)) 873 874 CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb)); 875 #define IEEE80211_SKB_RXCB(_skb) \ 876 ((struct ieee80211_rx_status *)((_skb)->cb)) 877 878 static __inline void 879 ieee80211_free_hw(struct ieee80211_hw *hw) 880 { 881 882 linuxkpi_ieee80211_iffree(hw); 883 884 if (hw->wiphy != NULL) 885 wiphy_free(hw->wiphy); 886 /* Note that *hw is not valid any longer after this. */ 887 888 IMPROVE(); 889 } 890 891 static __inline struct ieee80211_hw * 892 ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops) 893 { 894 895 return (linuxkpi_ieee80211_alloc_hw(priv_len, ops)); 896 } 897 898 static __inline void 899 SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) 900 { 901 902 set_wiphy_dev(hw->wiphy, dev); 903 linuxkpi_set_ieee80211_dev(hw, dev_name(dev)); 904 905 IMPROVE(); 906 } 907 908 static __inline int 909 ieee80211_register_hw(struct ieee80211_hw *hw) 910 { 911 int error; 912 913 error = wiphy_register(hw->wiphy); 914 if (error != 0) 915 return (error); 916 917 /* 918 * At this point the driver has set all the options, flags, bands, 919 * ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy 920 * setup is done. 921 * We need to replicate a lot of information from here into net80211. 922 */ 923 linuxkpi_ieee80211_ifattach(hw); 924 925 IMPROVE(); 926 927 return (0); 928 } 929 930 static __inline void 931 ieee80211_unregister_hw(struct ieee80211_hw *hw) 932 { 933 934 wiphy_unregister(hw->wiphy); 935 linuxkpi_ieee80211_ifdetach(hw); 936 937 IMPROVE(); 938 } 939 940 static __inline struct ieee80211_hw * 941 wiphy_to_ieee80211_hw(struct wiphy *wiphy) 942 { 943 944 return (linuxkpi_wiphy_to_ieee80211_hw(wiphy)); 945 } 946 947 /* -------------------------------------------------------------------------- */ 948 949 static __inline bool 950 ieee80211_is_action(__le16 fc) 951 { 952 __le16 v; 953 954 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 955 v = htole16(IEEE80211_FC0_SUBTYPE_ACTION | IEEE80211_FC0_TYPE_MGT); 956 957 return (fc == v); 958 } 959 960 static __inline bool 961 ieee80211_is_probe_resp(__le16 fc) 962 { 963 __le16 v; 964 965 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 966 v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_RESP | IEEE80211_FC0_TYPE_MGT); 967 968 return (fc == v); 969 } 970 971 static __inline bool 972 ieee80211_is_auth(__le16 fc) 973 { 974 __le16 v; 975 976 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 977 v = htole16(IEEE80211_FC0_SUBTYPE_AUTH | IEEE80211_FC0_TYPE_MGT); 978 979 return (fc == v); 980 } 981 982 static __inline bool 983 ieee80211_is_assoc_req(__le16 fc) 984 { 985 __le16 v; 986 987 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 988 v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_REQ | IEEE80211_FC0_TYPE_MGT); 989 990 return (fc == v); 991 } 992 993 static __inline bool 994 ieee80211_is_assoc_resp(__le16 fc) 995 { 996 __le16 v; 997 998 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 999 v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_RESP | IEEE80211_FC0_TYPE_MGT); 1000 1001 return (fc == v); 1002 } 1003 1004 static __inline bool 1005 ieee80211_is_reassoc_req(__le16 fc) 1006 { 1007 __le16 v; 1008 1009 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1010 v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_REQ | IEEE80211_FC0_TYPE_MGT); 1011 1012 return (fc == v); 1013 } 1014 1015 static __inline bool 1016 ieee80211_is_reassoc_resp(__le16 fc) 1017 { 1018 __le16 v; 1019 1020 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1021 v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_RESP | IEEE80211_FC0_TYPE_MGT); 1022 1023 return (fc == v); 1024 } 1025 1026 static __inline bool 1027 ieee80211_is_disassoc(__le16 fc) 1028 { 1029 __le16 v; 1030 1031 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1032 v = htole16(IEEE80211_FC0_SUBTYPE_DISASSOC | IEEE80211_FC0_TYPE_MGT); 1033 1034 return (fc == v); 1035 } 1036 1037 static __inline bool 1038 ieee80211_is_data_present(__le16 fc) 1039 { 1040 TODO(); 1041 return (false); 1042 } 1043 1044 static __inline bool 1045 ieee80211_is_deauth(__le16 fc) 1046 { 1047 __le16 v; 1048 1049 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1050 v = htole16(IEEE80211_FC0_SUBTYPE_DEAUTH | IEEE80211_FC0_TYPE_MGT); 1051 1052 return (fc == v); 1053 } 1054 1055 static __inline bool 1056 ieee80211_is_beacon(__le16 fc) 1057 { 1058 __le16 v; 1059 1060 /* 1061 * For as much as I get it this comes in LE and unlike FreeBSD 1062 * where we get the entire frame header and u8[], here we get the 1063 * 9.2.4.1 Frame Control field only. Mask and compare. 1064 */ 1065 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1066 v = htole16(IEEE80211_FC0_SUBTYPE_BEACON | IEEE80211_FC0_TYPE_MGT); 1067 1068 return (fc == v); 1069 } 1070 1071 1072 static __inline bool 1073 ieee80211_is_probe_req(__le16 fc) 1074 { 1075 __le16 v; 1076 1077 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1078 v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_REQ | IEEE80211_FC0_TYPE_MGT); 1079 1080 return (fc == v); 1081 } 1082 1083 static __inline bool 1084 ieee80211_has_protected(__le16 fc) 1085 { 1086 1087 return (fc & htole16(IEEE80211_FC1_PROTECTED << 8)); 1088 } 1089 1090 static __inline bool 1091 ieee80211_is_back_req(__le16 fc) 1092 { 1093 __le16 v; 1094 1095 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1096 v = htole16(IEEE80211_FC0_SUBTYPE_BAR | IEEE80211_FC0_TYPE_CTL); 1097 1098 return (fc == v); 1099 } 1100 1101 static __inline bool 1102 ieee80211_is_bufferable_mmpdu(__le16 fc) 1103 { 1104 TODO(); 1105 return (false); 1106 } 1107 1108 static __inline bool 1109 ieee80211_is_nullfunc(__le16 fc) 1110 { 1111 __le16 v; 1112 1113 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1114 v = htole16(IEEE80211_FC0_SUBTYPE_NODATA | IEEE80211_FC0_TYPE_DATA); 1115 1116 return (fc == v); 1117 } 1118 1119 static __inline bool 1120 ieee80211_is_qos_nullfunc(__le16 fc) 1121 { 1122 __le16 v; 1123 1124 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK); 1125 v = htole16(IEEE80211_FC0_SUBTYPE_QOS_NULL | IEEE80211_FC0_TYPE_DATA); 1126 1127 return (fc == v); 1128 } 1129 1130 static __inline bool 1131 ieee80211_is_any_nullfunc(__le16 fc) 1132 { 1133 1134 return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc)); 1135 } 1136 1137 static __inline bool 1138 ieee80211_vif_is_mesh(struct ieee80211_vif *vif) 1139 { 1140 TODO(); 1141 return (false); 1142 } 1143 1144 static __inline bool 1145 ieee80211_has_a4(__le16 fc) 1146 { 1147 __le16 v; 1148 1149 fc &= htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8); 1150 v = htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8); 1151 1152 return (fc == v); 1153 } 1154 1155 static __inline bool 1156 ieee80211_has_order(__le16 fc) 1157 { 1158 1159 return (fc & htole16(IEEE80211_FC1_ORDER << 8)); 1160 } 1161 1162 static __inline bool 1163 ieee80211_has_retry(__le16 fc) 1164 { 1165 1166 return (fc & htole16(IEEE80211_FC1_RETRY << 8)); 1167 } 1168 1169 1170 static __inline bool 1171 ieee80211_has_fromds(__le16 fc) 1172 { 1173 1174 return (fc & htole16(IEEE80211_FC1_DIR_FROMDS << 8)); 1175 } 1176 1177 static __inline bool 1178 ieee80211_has_tods(__le16 fc) 1179 { 1180 1181 return (fc & htole16(IEEE80211_FC1_DIR_TODS << 8)); 1182 } 1183 1184 static __inline uint8_t * 1185 ieee80211_get_SA(struct ieee80211_hdr *hdr) 1186 { 1187 1188 if (ieee80211_has_a4(hdr->frame_control)) 1189 return (hdr->addr4); 1190 if (ieee80211_has_fromds(hdr->frame_control)) 1191 return (hdr->addr3); 1192 return (hdr->addr2); 1193 } 1194 1195 static __inline uint8_t * 1196 ieee80211_get_DA(struct ieee80211_hdr *hdr) 1197 { 1198 1199 if (ieee80211_has_tods(hdr->frame_control)) 1200 return (hdr->addr3); 1201 return (hdr->addr1); 1202 } 1203 1204 static __inline bool 1205 ieee80211_has_morefrags(__le16 fc) 1206 { 1207 1208 fc &= htole16(IEEE80211_FC1_MORE_FRAG << 8); 1209 return (fc != 0); 1210 } 1211 1212 static __inline u8 * 1213 ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr) 1214 { 1215 if (ieee80211_has_a4(hdr->frame_control)) 1216 return (u8 *)hdr + 30; 1217 else 1218 return (u8 *)hdr + 24; 1219 } 1220 1221 /* -------------------------------------------------------------------------- */ 1222 /* Receive functions (air/driver to mac80211/net80211). */ 1223 1224 1225 static __inline void 1226 ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1227 struct sk_buff *skb, struct napi_struct *napi) 1228 { 1229 1230 linuxkpi_ieee80211_rx(hw, skb, sta, napi); 1231 } 1232 1233 static __inline void 1234 ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb) 1235 { 1236 1237 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL); 1238 } 1239 1240 static __inline void 1241 ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) 1242 { 1243 1244 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL); 1245 } 1246 1247 /* -------------------------------------------------------------------------- */ 1248 1249 static __inline uint8_t 1250 ieee80211_get_tid(struct ieee80211_hdr *hdr) 1251 { 1252 1253 return (linuxkpi_ieee80211_get_tid(hdr)); 1254 } 1255 1256 static __inline void 1257 ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw, 1258 enum ieee80211_iface_iter flags, 1259 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 1260 void *arg) 1261 { 1262 1263 flags |= IEEE80211_IFACE_ITER__ATOMIC; 1264 flags |= IEEE80211_IFACE_ITER__ACTIVE; 1265 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); 1266 } 1267 1268 static __inline void 1269 ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 1270 enum ieee80211_iface_iter flags, 1271 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 1272 void *arg) 1273 { 1274 1275 flags |= IEEE80211_IFACE_ITER__ACTIVE; 1276 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); 1277 } 1278 1279 static __inline void 1280 ieee80211_iterate_interfaces(struct ieee80211_hw *hw, 1281 enum ieee80211_iface_iter flags, 1282 void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 1283 void *arg) 1284 { 1285 1286 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); 1287 } 1288 1289 static __inline void 1290 ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1291 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, 1292 struct ieee80211_sta *, struct ieee80211_key_conf *, void *), 1293 void *arg) 1294 { 1295 1296 linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg); 1297 } 1298 1299 static __inline void 1300 ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1301 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, 1302 struct ieee80211_sta *, struct ieee80211_key_conf *, void *), 1303 void *arg) 1304 { 1305 1306 IMPROVE(); /* "rcu" */ 1307 linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg); 1308 } 1309 1310 static __inline void 1311 ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw, 1312 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *), 1313 void *arg) 1314 { 1315 1316 linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg); 1317 } 1318 1319 static __inline void 1320 ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw, 1321 void (*iterfunc)(void *, struct ieee80211_sta *), void *arg) 1322 { 1323 1324 linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg); 1325 } 1326 1327 static __inline struct wireless_dev * 1328 ieee80211_vif_to_wdev(struct ieee80211_vif *vif) 1329 { 1330 1331 return (linuxkpi_ieee80211_vif_to_wdev(vif)); 1332 } 1333 1334 static __inline struct sk_buff * 1335 ieee80211_beacon_get_template(struct ieee80211_hw *hw, 1336 struct ieee80211_vif *vif, void *p /* XXX TODO */) 1337 { 1338 TODO(); 1339 return (NULL); 1340 } 1341 1342 static __inline void 1343 ieee80211_beacon_loss(struct ieee80211_vif *vif) 1344 { 1345 TODO(); 1346 } 1347 1348 static __inline void 1349 ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t) 1350 { 1351 TODO(); 1352 } 1353 1354 static __inline bool 1355 ieee80211_csa_is_complete(struct ieee80211_vif *vif) 1356 { 1357 TODO(); 1358 return (false); 1359 } 1360 1361 static __inline void 1362 ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter) 1363 { 1364 TODO(); 1365 } 1366 1367 static __inline int 1368 ieee80211_csa_update_counter(struct ieee80211_vif *vif) 1369 { 1370 TODO(); 1371 return (-1); 1372 } 1373 1374 static __inline void 1375 ieee80211_csa_finish(struct ieee80211_vif *vif) 1376 { 1377 TODO(); 1378 } 1379 1380 static __inline enum nl80211_iftype 1381 ieee80211_vif_type_p2p(struct ieee80211_vif *vif) 1382 { 1383 1384 /* If we are not p2p enabled, just return the type. */ 1385 if (!vif->p2p) 1386 return (vif->type); 1387 1388 /* If we are p2p, depending on side, return type. */ 1389 switch (vif->type) { 1390 case NL80211_IFTYPE_AP: 1391 return (NL80211_IFTYPE_P2P_GO); 1392 case NL80211_IFTYPE_STATION: 1393 return (NL80211_IFTYPE_P2P_CLIENT); 1394 default: 1395 fallthrough; 1396 } 1397 return (vif->type); 1398 } 1399 1400 static __inline unsigned long 1401 ieee80211_tu_to_usec(unsigned long tu) 1402 { 1403 1404 return (tu * IEEE80211_DUR_TU); 1405 } 1406 1407 1408 static __inline int 1409 ieee80211_action_contains_tpc(struct sk_buff *skb) 1410 { 1411 TODO(); 1412 return (0); 1413 } 1414 1415 static __inline void 1416 ieee80211_connection_loss(struct ieee80211_vif *vif) 1417 { 1418 1419 linuxkpi_ieee80211_connection_loss(vif); 1420 } 1421 1422 static __inline struct ieee80211_sta * 1423 ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer) 1424 { 1425 1426 return (linuxkpi_ieee80211_find_sta(vif, peer)); 1427 } 1428 1429 static __inline struct ieee80211_sta * 1430 ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, uint8_t *addr, 1431 uint8_t *ourvifaddr) 1432 { 1433 1434 return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr)); 1435 } 1436 1437 1438 static __inline void 1439 ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, 1440 struct sk_buff *skb_frag, u8 *key) 1441 { 1442 TODO(); 1443 } 1444 1445 static __inline void 1446 ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, 1447 const u8 *addr, uint32_t iv32, u16 *p1k) 1448 { 1449 TODO(); 1450 } 1451 1452 static __inline size_t 1453 ieee80211_ie_split(const u8 *ies, size_t ies_len, 1454 const u8 *ie_ids, size_t ie_ids_len, size_t start) 1455 { 1456 size_t x; 1457 1458 x = start; 1459 1460 /* XXX FIXME, we need to deal with "Element ID Extension" */ 1461 while (x < ies_len) { 1462 1463 /* Is this IE[s] one of the ie_ids? */ 1464 if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x], 1465 ie_ids, ie_ids_len)) 1466 break; 1467 1468 if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len)) 1469 break; 1470 } 1471 1472 return (x); 1473 } 1474 1475 static __inline void 1476 ieee80211_request_smps(struct ieee80211_vif *vif, enum ieee80211_smps_mode smps) 1477 { 1478 1479 TODO(); 1480 } 1481 1482 static __inline void 1483 ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr, 1484 enum nl80211_tdls_operation oper, enum ieee80211_reason_code code, 1485 gfp_t gfp) 1486 { 1487 TODO(); 1488 } 1489 1490 static __inline void 1491 ieee80211_stop_queues(struct ieee80211_hw *hw) 1492 { 1493 TODO(); 1494 } 1495 1496 static __inline void 1497 ieee80211_wake_queues(struct ieee80211_hw *hw) 1498 { 1499 TODO(); 1500 } 1501 1502 static __inline void 1503 wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state) 1504 { 1505 TODO(); 1506 } 1507 1508 static __inline void 1509 ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb) 1510 { 1511 IMPROVE(); 1512 1513 /* 1514 * This is called on transmit failure. 1515 * Use a not-so-random random high status error so we can distinguish 1516 * it from normal low values flying around in net80211 ("ETX"). 1517 */ 1518 linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458); 1519 } 1520 1521 static __inline void 1522 ieee80211_restart_hw(struct ieee80211_hw *hw) 1523 { 1524 TODO(); 1525 } 1526 1527 static __inline void 1528 ieee80211_ready_on_channel(struct ieee80211_hw *hw) 1529 { 1530 TODO(); 1531 /* XXX-BZ We need to see that. */ 1532 } 1533 1534 static __inline void 1535 ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw) 1536 { 1537 TODO(); 1538 } 1539 1540 static __inline void 1541 ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, 1542 enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp) 1543 { 1544 TODO(); 1545 } 1546 1547 static __inline void 1548 ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid, 1549 uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu) 1550 { 1551 TODO(); 1552 } 1553 1554 static __inline bool 1555 ieee80211_sn_less(uint16_t sn1, uint16_t sn2) 1556 { 1557 TODO(); 1558 return (false); 1559 } 1560 1561 static __inline uint16_t 1562 ieee80211_sn_inc(uint16_t sn) 1563 { 1564 TODO(); 1565 return (sn + 1); 1566 } 1567 1568 static __inline uint16_t 1569 ieee80211_sn_add(uint16_t sn, uint16_t a) 1570 { 1571 TODO(); 1572 return (sn + a); 1573 } 1574 1575 static __inline void 1576 ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr) 1577 { 1578 TODO(); 1579 } 1580 1581 static __inline void 1582 ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint32_t f1, uint32_t f2) 1583 { 1584 TODO(); 1585 } 1586 1587 static __inline void 1588 ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid) 1589 { 1590 TODO(); 1591 } 1592 1593 static __inline void 1594 ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid) 1595 { 1596 TODO(); 1597 } 1598 1599 static __inline void 1600 ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr, 1601 uint8_t tid) 1602 { 1603 TODO(); 1604 } 1605 1606 static __inline void 1607 ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid) 1608 { 1609 TODO(); 1610 } 1611 1612 static __inline uint16_t 1613 ieee80211_sn_sub(uint16_t sn, uint16_t n) 1614 { 1615 TODO(); 1616 1617 return (0); 1618 } 1619 1620 static __inline void 1621 ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1622 bool disable) 1623 { 1624 TODO(); 1625 } 1626 1627 static __inline void 1628 ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping) 1629 { 1630 TODO(); 1631 } 1632 1633 static __inline void 1634 ieee80211_sta_pspoll(struct ieee80211_sta *sta) 1635 { 1636 TODO(); 1637 } 1638 1639 static __inline void 1640 ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids) 1641 { 1642 TODO(); 1643 } 1644 1645 static __inline void 1646 ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr, 1647 uint8_t tid) 1648 { 1649 TODO(); 1650 } 1651 1652 static __inline void 1653 ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf, 1654 uint64_t pn) 1655 { 1656 TODO(); 1657 } 1658 1659 static __inline struct sk_buff * 1660 ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 1661 { 1662 1663 return (linuxkpi_ieee80211_tx_dequeue(hw, txq)); 1664 } 1665 1666 static __inline void 1667 ieee80211_update_mu_groups(struct ieee80211_vif *vif, uint8_t *ms, uint8_t *up) 1668 { 1669 TODO(); 1670 } 1671 1672 static __inline void 1673 ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t) 1674 { 1675 TODO(); 1676 } 1677 1678 static __inline void 1679 ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) 1680 { 1681 struct ieee80211_tx_info *info; 1682 int status; 1683 1684 info = IEEE80211_SKB_CB(skb); 1685 1686 /* XXX-BZ this check is probably over-simplified? */ 1687 /* XXX-BZ but then we have no full feedback in net80211 yet. */ 1688 if (info->flags & IEEE80211_TX_STAT_ACK) 1689 status = 0; /* No error. */ 1690 else 1691 status = 1; 1692 #if 0 1693 printf("XXX-BZ: %s: hw %p skb %p status %d : flags %#x " 1694 "band %u hw_queue %u tx_time_est %d : " 1695 "rates [ %u %u %#x, %u %u %#x, %u %u %#x, %u %u %#x ] " 1696 "ack_signal %u ampdu_ack_len %u ampdu_len %u antenna %u tx_time %u " 1697 "is_valid_ack_signal %u status_driver_data [ %p %p ]\n", 1698 __func__, hw, skb, status, info->flags, 1699 info->band, info->hw_queue, info->tx_time_est, 1700 info->status.rates[0].idx, info->status.rates[0].count, 1701 info->status.rates[0].flags, 1702 info->status.rates[1].idx, info->status.rates[1].count, 1703 info->status.rates[1].flags, 1704 info->status.rates[2].idx, info->status.rates[2].count, 1705 info->status.rates[2].flags, 1706 info->status.rates[3].idx, info->status.rates[3].count, 1707 info->status.rates[3].flags, 1708 info->status.ack_signal, info->status.ampdu_ack_len, 1709 info->status.ampdu_len, info->status.antenna, 1710 info->status.tx_time, info->status.is_valid_ack_signal, 1711 info->status.status_driver_data[0], 1712 info->status.status_driver_data[1]); 1713 #endif 1714 IMPROVE(); 1715 linuxkpi_ieee80211_free_txskb(hw, skb, status); 1716 } 1717 1718 static __inline void 1719 ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid, 1720 struct ieee80211_key_seq *seq) 1721 { 1722 TODO(); 1723 } 1724 1725 static __inline void 1726 ieee80211_sched_scan_results(struct ieee80211_hw *hw) 1727 { 1728 TODO(); 1729 } 1730 1731 static __inline void 1732 ieee80211_sta_eosp(struct ieee80211_sta *sta) 1733 { 1734 TODO(); 1735 } 1736 1737 static __inline void 1738 ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr, 1739 uint8_t tid) 1740 { 1741 TODO(); 1742 } 1743 1744 static __inline void 1745 ieee80211_sched_scan_stopped(struct ieee80211_hw *hw) 1746 { 1747 TODO(); 1748 } 1749 1750 static __inline void 1751 ieee80211_scan_completed(struct ieee80211_hw *hw, 1752 struct cfg80211_scan_info *info) 1753 { 1754 1755 linuxkpi_ieee80211_scan_completed(hw, info); 1756 } 1757 1758 static __inline struct sk_buff * 1759 ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1760 { 1761 TODO(); 1762 return (NULL); 1763 } 1764 1765 static __inline struct sk_buff * 1766 ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1767 { 1768 1769 /* Only STA needs this. Otherwise return NULL and panic bad drivers. */ 1770 if (vif->type != NL80211_IFTYPE_STATION) 1771 return (NULL); 1772 1773 return (linuxkpi_ieee80211_pspoll_get(hw, vif)); 1774 } 1775 1776 static __inline struct sk_buff * 1777 ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 1778 { 1779 TODO(); 1780 return (NULL); 1781 } 1782 1783 static __inline struct sk_buff * 1784 ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1785 bool qos) 1786 { 1787 1788 /* Only STA needs this. Otherwise return NULL and panic bad drivers. */ 1789 if (vif->type != NL80211_IFTYPE_STATION) 1790 return (NULL); 1791 1792 return (linuxkpi_ieee80211_nullfunc_get(hw, vif, qos)); 1793 } 1794 1795 static __inline struct sk_buff * 1796 ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr, 1797 uint8_t *ssid, size_t ssid_len, int _x) 1798 { 1799 TODO(); 1800 return (NULL); 1801 } 1802 1803 static __inline void 1804 ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w, 1805 int delay) 1806 { 1807 1808 linuxkpi_ieee80211_queue_delayed_work(hw, w, delay); 1809 } 1810 1811 static __inline void 1812 ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w) 1813 { 1814 1815 linuxkpi_ieee80211_queue_work(hw, w); 1816 } 1817 1818 static __inline void 1819 ieee80211_stop_queue(struct ieee80211_hw *hw, uint16_t q) 1820 { 1821 TODO(); 1822 } 1823 1824 static __inline void 1825 ieee80211_wake_queue(struct ieee80211_hw *hw, uint16_t q) 1826 { 1827 TODO(); 1828 } 1829 1830 static __inline void 1831 ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) 1832 { 1833 IMPROVE(); 1834 ieee80211_tx_status(hw, skb); 1835 } 1836 1837 static __inline void 1838 ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb) 1839 { 1840 IMPROVE(); 1841 ieee80211_tx_status(hw, skb); 1842 } 1843 1844 static __inline int 1845 ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x) 1846 { 1847 TODO(); 1848 return (ENXIO); 1849 } 1850 1851 static __inline void 1852 ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) 1853 { 1854 int i; 1855 1856 /* 1857 * Apparently clearing flags and some other fields is not right. 1858 * Given the function is called "status" we work on that part of 1859 * the union. 1860 */ 1861 for (i = 0; i < nitems(info->status.rates); i++) 1862 info->status.rates[i].count = 0; 1863 /* 1864 * Unclear if ack_signal should be included or not but we clear the 1865 * "valid" bool so this field is no longer valid. 1866 */ 1867 memset(&info->status.ack_signal, 0, sizeof(*info) - 1868 offsetof(struct ieee80211_tx_info, status.ack_signal)); 1869 } 1870 1871 static __inline void 1872 ieee80211_txq_get_depth(struct ieee80211_txq *txq, uint64_t *frame_cnt, uint64_t *byte_cnt) 1873 { 1874 1875 if (frame_cnt == NULL && byte_cnt == NULL) 1876 return; 1877 1878 linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt); 1879 } 1880 1881 static __inline int 1882 rate_lowest_index(struct ieee80211_supported_band *band, 1883 struct ieee80211_sta *sta) 1884 { 1885 IMPROVE(); 1886 return (0); 1887 } 1888 1889 1890 static __inline void 1891 SET_IEEE80211_PERM_ADDR (struct ieee80211_hw *hw, uint8_t *addr) 1892 { 1893 1894 ether_addr_copy(hw->wiphy->perm_addr, addr); 1895 } 1896 1897 static __inline uint8_t * 1898 ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t x) 1899 { 1900 TODO(); 1901 return (NULL); 1902 } 1903 1904 static __inline void 1905 ieee80211_report_low_ack(struct ieee80211_sta *sta, int x) 1906 { 1907 TODO(); 1908 } 1909 1910 static __inline void 1911 ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr, 1912 uint8_t tid) 1913 { 1914 TODO(); 1915 } 1916 1917 static __inline void 1918 ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr, 1919 uint8_t tid) 1920 { 1921 TODO(); 1922 } 1923 1924 static __inline struct sk_buff * 1925 ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 1926 { 1927 TODO(); 1928 return (NULL); 1929 } 1930 1931 static __inline void 1932 ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1933 struct ieee80211_tx_info *info) 1934 { 1935 TODO(); 1936 } 1937 1938 static __inline bool 1939 ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 1940 { 1941 TODO(); 1942 return (false); 1943 } 1944 1945 static __inline struct ieee80211_txq * 1946 ieee80211_next_txq(struct ieee80211_hw *hw, uint32_t ac) 1947 { 1948 TODO(); 1949 return (NULL); 1950 } 1951 1952 static __inline void 1953 ieee80211_radar_detected(struct ieee80211_hw *hw) 1954 { 1955 TODO(); 1956 } 1957 1958 static __inline void 1959 ieee80211_sta_register_airtime(struct ieee80211_sta *sta, 1960 uint8_t tid, uint32_t duration, int x) 1961 { 1962 TODO(); 1963 } 1964 1965 1966 static __inline void 1967 ieee80211_return_txq(struct ieee80211_hw *hw, 1968 struct ieee80211_txq *txq, bool _t) 1969 { 1970 TODO(); 1971 } 1972 1973 static __inline void 1974 ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint32_t ac) 1975 { 1976 TODO(); 1977 } 1978 1979 static __inline void 1980 ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint32_t ac) 1981 { 1982 TODO(); 1983 } 1984 1985 static __inline void 1986 ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 1987 { 1988 TODO(); 1989 } 1990 1991 static __inline void 1992 ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter) 1993 { 1994 TODO(); 1995 } 1996 1997 static __inline int 1998 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif) 1999 { 2000 TODO(); 2001 return (-1); 2002 } 2003 2004 static __inline int 2005 ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap, uint32_t chanwidth, 2006 int x, bool t, int nss) 2007 { 2008 TODO(); 2009 return (-1); 2010 } 2011 2012 static __inline bool 2013 ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif) 2014 { 2015 TODO(); 2016 return (true); 2017 } 2018 2019 static __inline void 2020 ieee80211_disconnect(struct ieee80211_vif *vif, bool _x) 2021 { 2022 TODO(); 2023 } 2024 2025 static __inline const struct ieee80211_sta_he_cap * 2026 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band, 2027 enum nl80211_iftype type) 2028 { 2029 TODO(); 2030 return (NULL); 2031 } 2032 2033 static __inline void 2034 ieee80211_key_mic_failure(struct ieee80211_key_conf *key) 2035 { 2036 TODO(); 2037 } 2038 2039 static __inline void 2040 ieee80211_key_replay(struct ieee80211_key_conf *key) 2041 { 2042 TODO(); 2043 } 2044 2045 #endif /* _LINUXKPI_NET_MAC80211_H */ 2046