1 /*- 2 * Copyright (c) 2020-2024 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 30 #ifndef _LINUXKPI_NET_MAC80211_H 31 #define _LINUXKPI_NET_MAC80211_H 32 33 #include <sys/types.h> 34 35 #include <asm/atomic64.h> 36 #include <linux/bitops.h> 37 #include <linux/etherdevice.h> 38 #include <linux/ethtool.h> 39 #include <linux/netdevice.h> 40 #include <linux/skbuff.h> 41 #include <linux/workqueue.h> 42 #include <linux/dcache.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_WPA (1) 49 #define WLAN_OUI_TYPE_MICROSOFT_TPC (8) 50 #define WLAN_OUI_TYPE_WFA_P2P (9) 51 #define WLAN_OUI_WFA (0x506F9A) 52 53 #define IEEE80211_LINK_UNSPECIFIED 0x0f 54 55 /* hw->conf.flags */ 56 enum ieee80211_hw_conf_flags { 57 IEEE80211_CONF_IDLE = BIT(0), 58 IEEE80211_CONF_PS = BIT(1), 59 IEEE80211_CONF_MONITOR = BIT(2), 60 IEEE80211_CONF_OFFCHANNEL = BIT(3), 61 }; 62 63 /* (*ops->config()) */ 64 enum ieee80211_hw_conf_changed_flags { 65 IEEE80211_CONF_CHANGE_CHANNEL = BIT(0), 66 IEEE80211_CONF_CHANGE_IDLE = BIT(1), 67 IEEE80211_CONF_CHANGE_PS = BIT(2), 68 IEEE80211_CONF_CHANGE_MONITOR = BIT(3), 69 IEEE80211_CONF_CHANGE_POWER = BIT(4), 70 }; 71 72 #define CFG80211_TESTMODE_CMD(_x) /* XXX TODO */ 73 #define CFG80211_TESTMODE_DUMP(_x) /* XXX TODO */ 74 75 #define FCS_LEN 4 76 77 /* ops.configure_filter() */ 78 enum mcast_filter_flags { 79 FIF_ALLMULTI = BIT(0), 80 FIF_PROBE_REQ = BIT(1), 81 FIF_BCN_PRBRESP_PROMISC = BIT(2), 82 FIF_FCSFAIL = BIT(3), 83 FIF_OTHER_BSS = BIT(4), 84 FIF_PSPOLL = BIT(5), 85 FIF_CONTROL = BIT(6), 86 FIF_MCAST_ACTION = BIT(7), 87 }; 88 89 enum ieee80211_bss_changed { 90 BSS_CHANGED_ARP_FILTER = BIT(0), 91 BSS_CHANGED_ASSOC = BIT(1), 92 BSS_CHANGED_BANDWIDTH = BIT(2), 93 BSS_CHANGED_BEACON = BIT(3), 94 BSS_CHANGED_BEACON_ENABLED = BIT(4), 95 BSS_CHANGED_BEACON_INFO = BIT(5), 96 BSS_CHANGED_BEACON_INT = BIT(6), 97 BSS_CHANGED_BSSID = BIT(7), 98 BSS_CHANGED_CQM = BIT(8), 99 BSS_CHANGED_ERP_CTS_PROT = BIT(9), 100 BSS_CHANGED_ERP_SLOT = BIT(10), 101 BSS_CHANGED_FTM_RESPONDER = BIT(11), 102 BSS_CHANGED_HT = BIT(12), 103 BSS_CHANGED_IDLE = BIT(13), 104 BSS_CHANGED_MU_GROUPS = BIT(14), 105 BSS_CHANGED_P2P_PS = BIT(15), 106 BSS_CHANGED_PS = BIT(16), 107 BSS_CHANGED_QOS = BIT(17), 108 BSS_CHANGED_TXPOWER = BIT(18), 109 BSS_CHANGED_HE_BSS_COLOR = BIT(19), 110 BSS_CHANGED_AP_PROBE_RESP = BIT(20), 111 BSS_CHANGED_BASIC_RATES = BIT(21), 112 BSS_CHANGED_ERP_PREAMBLE = BIT(22), 113 BSS_CHANGED_IBSS = BIT(23), 114 BSS_CHANGED_MCAST_RATE = BIT(24), 115 BSS_CHANGED_SSID = BIT(25), 116 BSS_CHANGED_FILS_DISCOVERY = BIT(26), 117 BSS_CHANGED_HE_OBSS_PD = BIT(27), 118 BSS_CHANGED_TWT = BIT(28), 119 BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = BIT(30), 120 BSS_CHANGED_EHT_PUNCTURING = BIT(31), 121 BSS_CHANGED_MLD_VALID_LINKS = BIT_ULL(32), 122 BSS_CHANGED_MLD_TTLM = BIT_ULL(33), 123 BSS_CHANGED_TPE = BIT_ULL(34), 124 }; 125 126 /* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */ 127 #define WLAN_CIPHER_SUITE_OUI(_oui, _x) (((_oui) << 8) | ((_x) & 0xff)) 128 129 /* 802.11 Table 9-131 Cipher suite selectors. */ 130 /* 802.1x suite B 11 */ 131 #define WLAN_CIPHER_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x) 132 /* Use group 0 */ 133 #define WLAN_CIPHER_SUITE_WEP40 WLAN_CIPHER_SUITE(1) 134 #define WLAN_CIPHER_SUITE_TKIP WLAN_CIPHER_SUITE(2) 135 /* Reserved 3 */ 136 #define WLAN_CIPHER_SUITE_CCMP WLAN_CIPHER_SUITE(4) /* CCMP-128 */ 137 #define WLAN_CIPHER_SUITE_WEP104 WLAN_CIPHER_SUITE(5) 138 #define WLAN_CIPHER_SUITE_AES_CMAC WLAN_CIPHER_SUITE(6) /* BIP-CMAC-128 */ 139 /* Group addressed traffic not allowed 7 */ 140 #define WLAN_CIPHER_SUITE_GCMP WLAN_CIPHER_SUITE(8) 141 #define WLAN_CIPHER_SUITE_GCMP_256 WLAN_CIPHER_SUITE(9) 142 #define WLAN_CIPHER_SUITE_CCMP_256 WLAN_CIPHER_SUITE(10) 143 #define WLAN_CIPHER_SUITE_BIP_GMAC_128 WLAN_CIPHER_SUITE(11) 144 #define WLAN_CIPHER_SUITE_BIP_GMAC_256 WLAN_CIPHER_SUITE(12) 145 #define WLAN_CIPHER_SUITE_BIP_CMAC_256 WLAN_CIPHER_SUITE(13) 146 /* Reserved 14-255 */ 147 148 /* See ISO/IEC JTC 1 N 9880 Table 11 */ 149 #define WLAN_CIPHER_SUITE_SMS4 WLAN_CIPHER_SUITE_OUI(0x001472, 1) 150 151 152 /* 802.11 Table 9-133 AKM suite selectors. */ 153 #define WLAN_AKM_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x) 154 /* Reserved 0 */ 155 #define WLAN_AKM_SUITE_8021X WLAN_AKM_SUITE(1) 156 #define WLAN_AKM_SUITE_PSK WLAN_AKM_SUITE(2) 157 #define WLAN_AKM_SUITE_FT_8021X WLAN_AKM_SUITE(3) 158 #define WLAN_AKM_SUITE_FT_PSK WLAN_AKM_SUITE(4) 159 #define WLAN_AKM_SUITE_8021X_SHA256 WLAN_AKM_SUITE(5) 160 #define WLAN_AKM_SUITE_PSK_SHA256 WLAN_AKM_SUITE(6) 161 /* TDLS 7 */ 162 #define WLAN_AKM_SUITE_SAE WLAN_AKM_SUITE(8) 163 /* FToSAE 9 */ 164 /* AP peer key 10 */ 165 /* 802.1x suite B 11 */ 166 /* 802.1x suite B 384 12 */ 167 /* FTo802.1x 384 13 */ 168 /* Reserved 14-255 */ 169 /* Apparently 11ax defines more. Seen (19,20) mentioned. */ 170 171 #define TKIP_PN_TO_IV16(_x) ((uint16_t)(_x & 0xffff)) 172 #define TKIP_PN_TO_IV32(_x) ((uint32_t)((_x >> 16) & 0xffffffff)) 173 174 enum ieee80211_neg_ttlm_res { 175 NEG_TTLM_RES_ACCEPT, 176 NEG_TTLM_RES_REJECT, 177 }; 178 179 #define IEEE80211_TTLM_NUM_TIDS 8 180 struct ieee80211_neg_ttlm { 181 uint16_t downlink[IEEE80211_TTLM_NUM_TIDS]; 182 uint16_t uplink[IEEE80211_TTLM_NUM_TIDS]; 183 }; 184 185 /* 802.11-2020 9.4.2.55.3 A-MPDU Parameters field */ 186 #define IEEE80211_HT_AMPDU_PARM_FACTOR 0x3 187 #define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2 188 #define IEEE80211_HT_AMPDU_PARM_DENSITY (0x7 << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT) 189 190 struct ieee80211_sta; 191 192 struct ieee80211_ampdu_params { 193 struct ieee80211_sta *sta; 194 enum ieee80211_ampdu_mlme_action action; 195 uint16_t buf_size; 196 uint16_t timeout; 197 uint16_t ssn; 198 uint8_t tid; 199 bool amsdu; 200 }; 201 202 struct ieee80211_bar { 203 /* TODO FIXME */ 204 int control, start_seq_num; 205 uint8_t *ra; 206 uint16_t frame_control; 207 }; 208 209 struct ieee80211_p2p_noa_desc { 210 uint32_t count; /* uint8_t ? */ 211 uint32_t duration; 212 uint32_t interval; 213 uint32_t start_time; 214 }; 215 216 struct ieee80211_p2p_noa_attr { 217 uint8_t index; 218 uint8_t oppps_ctwindow; 219 struct ieee80211_p2p_noa_desc desc[4]; 220 }; 221 222 struct ieee80211_mutable_offsets { 223 /* TODO FIXME */ 224 uint16_t tim_offset; 225 uint16_t cntdwn_counter_offs[2]; 226 227 int mbssid_off; 228 }; 229 230 struct mac80211_fils_discovery { 231 uint32_t max_interval; 232 }; 233 234 struct ieee80211_chanctx_conf { 235 struct cfg80211_chan_def def; 236 struct cfg80211_chan_def min_def; 237 struct cfg80211_chan_def ap; 238 239 uint8_t rx_chains_dynamic; 240 uint8_t rx_chains_static; 241 bool radar_enabled; 242 243 /* Must stay last. */ 244 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); 245 }; 246 247 struct ieee80211_rate_status { 248 struct rate_info rate_idx; 249 uint8_t try_count; 250 }; 251 252 struct ieee80211_ema_beacons { 253 uint8_t cnt; 254 struct { 255 struct sk_buff *skb; 256 struct ieee80211_mutable_offsets offs; 257 } bcn[0]; 258 }; 259 260 struct ieee80211_chanreq { 261 struct cfg80211_chan_def oper; 262 }; 263 264 #define WLAN_MEMBERSHIP_LEN (8) 265 #define WLAN_USER_POSITION_LEN (16) 266 267 /* 268 * 802.11ac-2013, 8.4.2.164 VHT Transmit Power Envelope element 269 * 802.11-???? ? 270 */ 271 struct ieee80211_parsed_tpe_eirp { 272 int8_t power[5]; 273 uint8_t count; 274 bool valid; 275 }; 276 struct ieee80211_parsed_tpe_psd { 277 int8_t power[16]; 278 uint8_t count; 279 bool valid; 280 }; 281 struct ieee80211_parsed_tpe { 282 /* We see access to [0] so assume at least 2. */ 283 struct ieee80211_parsed_tpe_eirp max_local[2]; 284 struct ieee80211_parsed_tpe_eirp max_reg_client[2]; 285 struct ieee80211_parsed_tpe_psd psd_local[2]; 286 struct ieee80211_parsed_tpe_psd psd_reg_client[2]; 287 }; 288 289 struct ieee80211_bss_conf { 290 /* TODO FIXME */ 291 struct ieee80211_vif *vif; 292 struct cfg80211_bss *bss; 293 const uint8_t *bssid; 294 uint8_t addr[ETH_ALEN]; 295 uint8_t link_id; 296 uint8_t _pad0; 297 uint8_t transmitter_bssid[ETH_ALEN]; 298 struct ieee80211_ftm_responder_params *ftmr_params; 299 struct ieee80211_p2p_noa_attr p2p_noa_attr; 300 struct ieee80211_chanreq chanreq; 301 __be32 arp_addr_list[1]; /* XXX TODO */ 302 struct ieee80211_rate *beacon_rate; 303 struct { 304 uint8_t membership[WLAN_MEMBERSHIP_LEN]; 305 uint8_t position[WLAN_USER_POSITION_LEN]; 306 } mu_group; 307 struct { 308 uint32_t params; 309 /* single field struct? */ 310 } he_oper; 311 struct cfg80211_he_bss_color he_bss_color; 312 struct ieee80211_he_obss_pd he_obss_pd; 313 314 bool ht_ldpc; 315 bool vht_ldpc; 316 bool he_ldpc; 317 bool vht_mu_beamformee; 318 bool vht_mu_beamformer; 319 bool vht_su_beamformee; 320 bool vht_su_beamformer; 321 bool he_mu_beamformer; 322 bool he_su_beamformee; 323 bool he_su_beamformer; 324 bool he_full_ul_mumimo; 325 bool eht_su_beamformee; 326 bool eht_su_beamformer; 327 bool eht_mu_beamformer; 328 329 uint16_t ht_operation_mode; 330 int arp_addr_cnt; 331 uint16_t eht_puncturing; 332 333 uint8_t dtim_period; 334 uint8_t sync_dtim_count; 335 bool qos; 336 bool twt_broadcast; 337 bool use_cts_prot; 338 bool use_short_preamble; 339 bool use_short_slot; 340 bool he_support; 341 bool eht_support; 342 bool csa_active; 343 bool mu_mimo_owner; 344 uint32_t sync_device_ts; 345 uint64_t sync_tsf; 346 uint16_t beacon_int; 347 int16_t txpower; 348 uint32_t basic_rates; 349 int mcast_rate[NUM_NL80211_BANDS]; 350 enum ieee80211_ap_reg_power power_type; 351 struct cfg80211_bitrate_mask beacon_tx_rate; 352 struct mac80211_fils_discovery fils_discovery; 353 struct ieee80211_chanctx_conf *chanctx_conf; 354 struct ieee80211_vif *mbssid_tx_vif; 355 struct ieee80211_parsed_tpe tpe; 356 357 int ack_enabled, bssid_index, bssid_indicator, cqm_rssi_hyst, cqm_rssi_thold, ema_ap, frame_time_rts_th, ftm_responder; 358 int htc_trig_based_pkt_ext; 359 int multi_sta_back_32bit, nontransmitted; 360 int profile_periodicity; 361 int twt_requester, uora_exists, uora_ocw_range; 362 int assoc_capability, enable_beacon, hidden_ssid, ibss_joined, twt_protected; 363 int twt_responder, unsol_bcast_probe_resp_interval; 364 int color_change_active; 365 }; 366 367 struct ieee80211_channel_switch { 368 /* TODO FIXME */ 369 int block_tx, count, delay, device_timestamp, timestamp; 370 uint8_t link_id; 371 struct cfg80211_chan_def chandef; 372 }; 373 374 struct ieee80211_cipher_scheme { 375 uint32_t cipher; 376 uint8_t iftype; /* We do not know the size of this. */ 377 uint8_t hdr_len; 378 uint8_t pn_len; 379 uint8_t pn_off; 380 uint8_t key_idx_off; 381 uint8_t key_idx_mask; 382 uint8_t key_idx_shift; 383 uint8_t mic_len; 384 }; 385 386 enum ieee80211_event_type { 387 BA_FRAME_TIMEOUT, 388 BAR_RX_EVENT, 389 MLME_EVENT, 390 RSSI_EVENT, 391 }; 392 393 enum ieee80211_rssi_event_data { 394 RSSI_EVENT_LOW, 395 RSSI_EVENT_HIGH, 396 }; 397 398 enum ieee80211_mlme_event_data { 399 ASSOC_EVENT, 400 AUTH_EVENT, 401 DEAUTH_RX_EVENT, 402 DEAUTH_TX_EVENT, 403 }; 404 405 enum ieee80211_mlme_event_status { 406 MLME_DENIED, 407 MLME_TIMEOUT, 408 }; 409 410 struct ieee80211_mlme_event { 411 enum ieee80211_mlme_event_data data; 412 enum ieee80211_mlme_event_status status; 413 int reason; 414 }; 415 416 struct ieee80211_event { 417 /* TODO FIXME */ 418 enum ieee80211_event_type type; 419 union { 420 struct { 421 int ssn; 422 struct ieee80211_sta *sta; 423 uint8_t tid; 424 } ba; 425 struct ieee80211_mlme_event mlme; 426 } u; 427 }; 428 429 struct ieee80211_ftm_responder_params { 430 /* TODO FIXME */ 431 uint8_t *lci; 432 uint8_t *civicloc; 433 int lci_len; 434 int civicloc_len; 435 }; 436 437 struct ieee80211_he_mu_edca_param_ac_rec { 438 /* TODO FIXME */ 439 int aifsn, ecw_min_max, mu_edca_timer; 440 }; 441 442 struct ieee80211_conf { 443 int dynamic_ps_timeout; 444 int power_level; 445 uint32_t listen_interval; 446 bool radar_enabled; 447 enum ieee80211_hw_conf_flags flags; 448 struct cfg80211_chan_def chandef; 449 }; 450 451 enum ieee80211_hw_flags { 452 IEEE80211_HW_AMPDU_AGGREGATION, 453 IEEE80211_HW_AP_LINK_PS, 454 IEEE80211_HW_BUFF_MMPDU_TXQ, 455 IEEE80211_HW_CHANCTX_STA_CSA, 456 IEEE80211_HW_CONNECTION_MONITOR, 457 IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, 458 IEEE80211_HW_HAS_RATE_CONTROL, 459 IEEE80211_HW_MFP_CAPABLE, 460 IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR, 461 IEEE80211_HW_REPORTS_TX_ACK_STATUS, 462 IEEE80211_HW_RX_INCLUDES_FCS, 463 IEEE80211_HW_SIGNAL_DBM, 464 IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS, 465 IEEE80211_HW_SPECTRUM_MGMT, 466 IEEE80211_HW_STA_MMPDU_TXQ, 467 IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU, 468 IEEE80211_HW_SUPPORTS_CLONED_SKBS, 469 IEEE80211_HW_SUPPORTS_DYNAMIC_PS, 470 IEEE80211_HW_SUPPORTS_MULTI_BSSID, 471 IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID, 472 IEEE80211_HW_SUPPORTS_PS, 473 IEEE80211_HW_SUPPORTS_REORDERING_BUFFER, 474 IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW, 475 IEEE80211_HW_SUPPORT_FAST_XMIT, 476 IEEE80211_HW_TDLS_WIDER_BW, 477 IEEE80211_HW_TIMING_BEACON_ONLY, 478 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW, 479 IEEE80211_HW_TX_AMSDU, 480 IEEE80211_HW_TX_FRAG_LIST, 481 IEEE80211_HW_USES_RSS, 482 IEEE80211_HW_WANT_MONITOR_VIF, 483 IEEE80211_HW_SW_CRYPTO_CONTROL, 484 IEEE80211_HW_SUPPORTS_TX_FRAG, 485 IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA, 486 IEEE80211_HW_SUPPORTS_PER_STA_GTK, 487 IEEE80211_HW_REPORTS_LOW_ACK, 488 IEEE80211_HW_QUEUE_CONTROL, 489 IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD, 490 IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD, 491 IEEE80211_HW_SUPPORTS_RC_TABLE, 492 IEEE80211_HW_DETECTS_COLOR_COLLISION, 493 IEEE80211_HW_DISALLOW_PUNCTURING, 494 IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ, 495 IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN, 496 IEEE80211_HW_HANDLES_QUIET_CSA, 497 498 /* Keep last. */ 499 NUM_IEEE80211_HW_FLAGS 500 }; 501 502 struct ieee80211_hw { 503 504 struct wiphy *wiphy; 505 506 /* TODO FIXME */ 507 int extra_tx_headroom, weight_multiplier; 508 int max_rate_tries, max_rates, max_report_rates; 509 struct ieee80211_cipher_scheme *cipher_schemes; 510 int n_cipher_schemes; 511 const char *rate_control_algorithm; 512 struct { 513 uint16_t units_pos; /* radiotap "spec" is .. inconsistent. */ 514 uint16_t accuracy; 515 } radiotap_timestamp; 516 size_t sta_data_size; 517 size_t vif_data_size; 518 size_t chanctx_data_size; 519 size_t txq_data_size; 520 uint16_t radiotap_mcs_details; 521 uint16_t radiotap_vht_details; 522 uint16_t queues; 523 uint16_t offchannel_tx_hw_queue; 524 uint16_t uapsd_max_sp_len; 525 uint16_t uapsd_queues; 526 uint16_t max_rx_aggregation_subframes; 527 uint16_t max_tx_aggregation_subframes; 528 uint16_t max_tx_fragments; 529 uint16_t max_listen_interval; 530 uint32_t extra_beacon_tailroom; 531 netdev_features_t netdev_features; 532 unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)]; 533 struct ieee80211_conf conf; 534 535 #if 0 /* leave here for documentation purposes. This does NOT work. */ 536 /* Must stay last. */ 537 uint8_t priv[0] __aligned(CACHE_LINE_SIZE); 538 #else 539 void *priv; 540 #endif 541 }; 542 543 enum ieee802111_key_flag { 544 IEEE80211_KEY_FLAG_GENERATE_IV = BIT(0), 545 IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(1), 546 IEEE80211_KEY_FLAG_PAIRWISE = BIT(2), 547 IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(3), 548 IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(4), 549 IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(5), 550 IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(6), 551 IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(7), 552 IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(8), 553 IEEE80211_KEY_FLAG_SPP_AMSDU = BIT(9), 554 }; 555 556 struct ieee80211_key_conf { 557 atomic64_t tx_pn; 558 uint32_t cipher; 559 uint8_t icv_len; /* __unused nowadays? */ 560 uint8_t iv_len; 561 uint8_t hw_key_idx; /* Set by drv. */ 562 uint8_t keyidx; 563 uint16_t flags; 564 int8_t link_id; /* signed! */ 565 uint8_t keylen; 566 uint8_t key[0]; /* Must stay last! */ 567 }; 568 569 struct ieee80211_key_seq { 570 /* TODO FIXME */ 571 union { 572 struct { 573 uint8_t seq[IEEE80211_MAX_PN_LEN]; 574 uint8_t seq_len; 575 } hw; 576 struct { 577 uint8_t pn[IEEE80211_CCMP_PN_LEN]; 578 } ccmp; 579 struct { 580 uint8_t pn[IEEE80211_CCMP_PN_LEN]; 581 } aes_cmac; 582 struct { 583 uint8_t pn[IEEE80211_CCMP_PN_LEN]; 584 } aes_gmac; 585 struct { 586 uint32_t iv32; 587 uint16_t iv16; 588 } tkip; 589 }; 590 }; 591 592 593 enum ieee80211_rx_status_flags { 594 RX_FLAG_ALLOW_SAME_PN = BIT(0), 595 RX_FLAG_AMPDU_DETAILS = BIT(1), 596 RX_FLAG_AMPDU_EOF_BIT = BIT(2), 597 RX_FLAG_AMPDU_EOF_BIT_KNOWN = BIT(3), 598 RX_FLAG_DECRYPTED = BIT(4), 599 RX_FLAG_DUP_VALIDATED = BIT(5), 600 RX_FLAG_FAILED_FCS_CRC = BIT(6), 601 RX_FLAG_ICV_STRIPPED = BIT(7), 602 RX_FLAG_MACTIME_PLCP_START = BIT(8), 603 RX_FLAG_MACTIME_START = BIT(9), 604 RX_FLAG_MIC_STRIPPED = BIT(10), 605 RX_FLAG_MMIC_ERROR = BIT(11), 606 RX_FLAG_MMIC_STRIPPED = BIT(12), 607 RX_FLAG_NO_PSDU = BIT(13), 608 RX_FLAG_PN_VALIDATED = BIT(14), 609 RX_FLAG_RADIOTAP_HE = BIT(15), 610 RX_FLAG_RADIOTAP_HE_MU = BIT(16), 611 RX_FLAG_RADIOTAP_LSIG = BIT(17), 612 RX_FLAG_RADIOTAP_VENDOR_DATA = BIT(18), 613 RX_FLAG_NO_SIGNAL_VAL = BIT(19), 614 RX_FLAG_IV_STRIPPED = BIT(20), 615 RX_FLAG_AMPDU_IS_LAST = BIT(21), 616 RX_FLAG_AMPDU_LAST_KNOWN = BIT(22), 617 RX_FLAG_AMSDU_MORE = BIT(23), 618 RX_FLAG_MACTIME_END = BIT(24), 619 RX_FLAG_ONLY_MONITOR = BIT(25), 620 RX_FLAG_SKIP_MONITOR = BIT(26), 621 RX_FLAG_8023 = BIT(27), 622 RX_FLAG_RADIOTAP_TLV_AT_END = BIT(28), 623 RX_FLAG_MACTIME = BIT(29), 624 RX_FLAG_MACTIME_IS_RTAP_TS64 = BIT(30), 625 RX_FLAG_FAILED_PLCP_CRC = BIT(31), 626 }; 627 628 enum mac80211_rx_encoding { 629 RX_ENC_LEGACY = 0, 630 RX_ENC_HT, 631 RX_ENC_VHT, 632 RX_ENC_HE, 633 RX_ENC_EHT, 634 }; 635 636 struct ieee80211_rx_status { 637 /* TODO FIXME, this is too large. Over-reduce types to u8 where possible. */ 638 union { 639 uint64_t boottime_ns; 640 int64_t ack_tx_hwtstamp; 641 }; 642 uint64_t mactime; 643 uint32_t device_timestamp; 644 enum ieee80211_rx_status_flags flag; 645 uint16_t freq; 646 uint8_t encoding:3, bw:4; /* enum mac80211_rx_encoding, rate_info_bw */ /* See mt76.h */ 647 uint8_t ampdu_reference; 648 uint8_t band; 649 uint8_t chains; 650 int8_t chain_signal[IEEE80211_MAX_CHAINS]; 651 int8_t signal; 652 uint8_t enc_flags; 653 union { 654 struct { 655 uint8_t he_ru:3; /* nl80211::enum nl80211_he_ru_alloc */ 656 uint8_t he_gi:2; /* nl80211::enum nl80211_he_gi */ 657 uint8_t he_dcm:1; 658 }; 659 struct { 660 uint8_t ru:4; /* nl80211::enum nl80211_eht_ru_alloc */ 661 uint8_t gi:2; /* nl80211::enum nl80211_eht_gi */ 662 } eht; 663 }; 664 bool link_valid; 665 uint8_t link_id; /* very incosistent sizes? */ 666 uint8_t zero_length_psdu_type; 667 uint8_t nss; 668 uint8_t rate_idx; 669 }; 670 671 struct ieee80211_tx_status { 672 struct ieee80211_sta *sta; 673 struct ieee80211_tx_info *info; 674 int64_t ack_hwtstamp; 675 676 u8 n_rates; 677 struct ieee80211_rate_status *rates; 678 679 struct sk_buff *skb; 680 struct list_head *free_list; 681 }; 682 683 struct ieee80211_scan_ies { 684 /* TODO FIXME */ 685 int common_ie_len; 686 int len[NUM_NL80211_BANDS]; 687 uint8_t *common_ies; 688 uint8_t *ies[NUM_NL80211_BANDS]; 689 }; 690 691 struct ieee80211_scan_request { 692 struct ieee80211_scan_ies ies; 693 struct cfg80211_scan_request req; 694 }; 695 696 struct ieee80211_txq { 697 struct ieee80211_sta *sta; 698 struct ieee80211_vif *vif; 699 int ac; 700 uint8_t tid; 701 702 /* Must stay last. */ 703 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); 704 }; 705 706 struct ieee80211_sta_rates { 707 /* XXX TODO */ 708 /* XXX some _rcu thing */ 709 struct { 710 int idx; 711 int flags; 712 } rate[1]; /* XXX what is the real number? */ 713 }; 714 715 struct ieee80211_sta_txpwr { 716 /* XXX TODO */ 717 enum nl80211_tx_power_setting type; 718 short power; 719 }; 720 721 #define IEEE80211_NUM_TIDS 16 /* net80211::WME_NUM_TID */ 722 struct ieee80211_sta_agg { 723 uint16_t max_amsdu_len; 724 uint16_t max_rc_amsdu_len; 725 uint16_t max_tid_amsdu_len[IEEE80211_NUM_TIDS]; 726 }; 727 728 struct ieee80211_link_sta { 729 uint8_t addr[ETH_ALEN]; 730 uint8_t link_id; 731 uint32_t supp_rates[NUM_NL80211_BANDS]; 732 struct ieee80211_sta_ht_cap ht_cap; 733 struct ieee80211_sta_vht_cap vht_cap; 734 struct ieee80211_sta_he_cap he_cap; 735 struct ieee80211_sta_he_6ghz_capa he_6ghz_capa; 736 struct ieee80211_sta_eht_cap eht_cap; 737 uint8_t rx_nss; 738 enum ieee80211_sta_rx_bw bandwidth; 739 enum ieee80211_smps_mode smps_mode; 740 struct ieee80211_sta_agg agg; 741 struct ieee80211_sta_txpwr txpwr; 742 }; 743 744 struct ieee80211_sta { 745 /* TODO FIXME */ 746 int max_amsdu_subframes; 747 int mfp, smps_mode, tdls, tdls_initiator; 748 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; /* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */ 749 struct ieee80211_sta_rates *rates; /* some rcu thing? */ 750 uint8_t addr[ETH_ALEN]; 751 uint16_t aid; 752 bool wme; 753 uint8_t max_sp; 754 uint8_t uapsd_queues; 755 uint16_t valid_links; 756 757 struct ieee80211_link_sta deflink; 758 struct ieee80211_link_sta *link[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */ 759 760 /* Must stay last. */ 761 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); 762 }; 763 764 struct ieee80211_tdls_ch_sw_params { 765 /* TODO FIXME */ 766 int action_code, ch_sw_tm_ie, status, switch_time, switch_timeout, timestamp; 767 struct ieee80211_sta *sta; 768 struct cfg80211_chan_def *chandef; 769 struct sk_buff *tmpl_skb; 770 }; 771 772 struct ieee80211_tx_control { 773 /* TODO FIXME */ 774 struct ieee80211_sta *sta; 775 }; 776 777 struct ieee80211_tx_queue_params { 778 /* These types are based on iwlwifi FW structs. */ 779 uint16_t cw_min; 780 uint16_t cw_max; 781 uint16_t txop; 782 uint8_t aifs; 783 784 /* TODO FIXME */ 785 int acm, mu_edca, uapsd; 786 struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec; 787 }; 788 789 struct ieee80211_tx_rate { 790 uint8_t idx; 791 uint16_t count:5, 792 flags:11; 793 }; 794 795 enum ieee80211_vif_driver_flags { 796 IEEE80211_VIF_BEACON_FILTER = BIT(0), 797 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1), 798 IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2), 799 #if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 60600) /* v6.6 */ 800 IEEE80211_VIF_DISABLE_SMPS_OVERRIDE = BIT(3), /* Renamed to IEEE80211_VIF_EML_ACTIVE. */ 801 #endif 802 IEEE80211_VIF_EML_ACTIVE = BIT(4), 803 IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW = BIT(5), 804 }; 805 806 #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4 807 808 struct ieee80211_vif_cfg { 809 uint16_t aid; 810 uint16_t eml_cap; 811 uint16_t eml_med_sync_delay; 812 bool assoc; 813 bool ps; 814 bool idle; 815 bool ibss_joined; 816 int arp_addr_cnt; 817 size_t ssid_len; 818 uint32_t arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; /* big endian */ 819 uint8_t ssid[IEEE80211_NWID_LEN]; 820 uint8_t ap_addr[ETH_ALEN]; 821 }; 822 823 struct ieee80211_vif { 824 /* TODO FIXME */ 825 enum nl80211_iftype type; 826 int csa_active, mu_mimo_owner; 827 int cab_queue; 828 int color_change_active, offload_flags; 829 enum ieee80211_vif_driver_flags driver_flags; 830 bool p2p; 831 bool probe_req_reg; 832 uint8_t addr[ETH_ALEN]; 833 struct ieee80211_vif_cfg cfg; 834 struct ieee80211_chanctx_conf *chanctx_conf; 835 struct ieee80211_txq *txq; 836 struct ieee80211_bss_conf bss_conf; 837 struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */ 838 uint8_t hw_queue[IEEE80211_NUM_ACS]; 839 uint16_t active_links; 840 uint16_t valid_links; 841 struct ieee80211_vif *mbssid_tx_vif; 842 843 /* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change structure depending on compile-time option. */ 844 struct dentry *debugfs_dir; 845 /* #endif */ 846 847 /* Must stay last. */ 848 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE); 849 }; 850 851 struct ieee80211_vif_chanctx_switch { 852 struct ieee80211_chanctx_conf *old_ctx, *new_ctx; 853 struct ieee80211_vif *vif; 854 struct ieee80211_bss_conf *link_conf; 855 }; 856 857 struct ieee80211_prep_tx_info { 858 u16 duration; 859 bool success; 860 bool was_assoc; 861 int link_id; 862 }; 863 864 /* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */ 865 /* Also warning: some sizes change by pointer size! This is 64bit only. */ 866 struct ieee80211_tx_info { 867 enum ieee80211_tx_info_flags flags; 868 /* TODO FIXME */ 869 u8 band; 870 u8 hw_queue; 871 bool tx_time_est; 872 union { 873 struct { 874 struct ieee80211_tx_rate rates[4]; 875 bool use_rts; 876 uint8_t antennas:2; 877 struct ieee80211_vif *vif; 878 struct ieee80211_key_conf *hw_key; 879 enum ieee80211_tx_control_flags flags; 880 } control; 881 struct { 882 struct ieee80211_tx_rate rates[4]; 883 uint32_t ack_signal; 884 uint8_t ampdu_ack_len; 885 uint8_t ampdu_len; 886 uint8_t antenna; 887 uint16_t tx_time; 888 uint8_t flags; 889 void *status_driver_data[16 / sizeof(void *)]; /* XXX TODO */ 890 } status; 891 #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40 892 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)]; 893 }; 894 }; 895 896 /* net80211 conflict */ 897 struct linuxkpi_ieee80211_tim_ie { 898 uint8_t dtim_count; 899 uint8_t dtim_period; 900 uint8_t bitmap_ctrl; 901 uint8_t *virtual_map; 902 }; 903 #define ieee80211_tim_ie linuxkpi_ieee80211_tim_ie 904 905 struct survey_info { /* net80211::struct ieee80211_channel_survey */ 906 /* TODO FIXME */ 907 uint32_t filled; 908 #define SURVEY_INFO_TIME 0x0001 909 #define SURVEY_INFO_TIME_RX 0x0002 910 #define SURVEY_INFO_TIME_SCAN 0x0004 911 #define SURVEY_INFO_TIME_TX 0x0008 912 #define SURVEY_INFO_TIME_BSS_RX 0x0010 913 #define SURVEY_INFO_TIME_BUSY 0x0020 914 #define SURVEY_INFO_IN_USE 0x0040 915 #define SURVEY_INFO_NOISE_DBM 0x0080 916 uint32_t noise; 917 uint64_t time; 918 uint64_t time_bss_rx; 919 uint64_t time_busy; 920 uint64_t time_rx; 921 uint64_t time_scan; 922 uint64_t time_tx; 923 struct ieee80211_channel *channel; 924 }; 925 926 enum ieee80211_iface_iter { 927 IEEE80211_IFACE_ITER_NORMAL = BIT(0), 928 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(1), 929 IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2), /* seems to be an iter flag */ 930 IEEE80211_IFACE_ITER_ACTIVE = BIT(3), 931 932 /* Internal flags only. */ 933 IEEE80211_IFACE_ITER__ATOMIC = BIT(6), 934 IEEE80211_IFACE_ITER__MTX = BIT(8), 935 }; 936 937 enum set_key_cmd { 938 SET_KEY, 939 DISABLE_KEY, 940 }; 941 942 /* 802.11-2020, 9.4.2.55.2 HT Capability Information field. */ 943 enum rx_enc_flags { 944 RX_ENC_FLAG_SHORTPRE = BIT(0), 945 RX_ENC_FLAG_SHORT_GI = BIT(2), 946 RX_ENC_FLAG_HT_GF = BIT(3), 947 RX_ENC_FLAG_STBC_MASK = BIT(4) | BIT(5), 948 #define RX_ENC_FLAG_STBC_SHIFT 4 949 RX_ENC_FLAG_LDPC = BIT(6), 950 RX_ENC_FLAG_BF = BIT(7), 951 }; 952 953 enum sta_notify_cmd { 954 STA_NOTIFY_AWAKE, 955 STA_NOTIFY_SLEEP, 956 }; 957 958 struct ieee80211_low_level_stats { 959 /* Can we make them uint64_t? */ 960 uint32_t dot11ACKFailureCount; 961 uint32_t dot11FCSErrorCount; 962 uint32_t dot11RTSFailureCount; 963 uint32_t dot11RTSSuccessCount; 964 }; 965 966 enum ieee80211_offload_flags { 967 IEEE80211_OFFLOAD_ENCAP_4ADDR, 968 IEEE80211_OFFLOAD_ENCAP_ENABLED, 969 IEEE80211_OFFLOAD_DECAP_ENABLED, 970 }; 971 972 struct ieee80211_ops { 973 /* TODO FIXME */ 974 int (*start)(struct ieee80211_hw *); 975 void (*stop)(struct ieee80211_hw *, bool); 976 977 int (*config)(struct ieee80211_hw *, u32); 978 void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type); 979 980 int (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *); 981 void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *); 982 int (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool); 983 984 void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *); 985 void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *); 986 int (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *); 987 int (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *); 988 int (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *); 989 void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *); 990 991 int (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u16, const struct ieee80211_tx_queue_params *); 992 void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *); 993 int (*tx_last_beacon)(struct ieee80211_hw *); 994 void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *); 995 996 void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *); 997 void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *); 998 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int); 999 1000 void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool); 1001 void (*flush_sta)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 1002 1003 int (*set_frag_threshold)(struct ieee80211_hw *, u32); 1004 1005 void (*sync_rx_queues)(struct ieee80211_hw *); 1006 1007 void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool); 1008 void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool); 1009 1010 int (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 1011 int (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 1012 int (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 1013 void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *); 1014 void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 1015 int (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state); 1016 void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *); 1017 void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32); 1018 void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 1019 void (*sta_set_4addr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool); 1020 void (*sta_set_decap_offload)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool); 1021 1022 u64 (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *); 1023 1024 int (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *); 1025 1026 bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *); 1027 1028 int (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); 1029 int (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *); 1030 void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); 1031 void (*channel_switch_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_chan_def *); 1032 void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *); 1033 void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *); 1034 int (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32); 1035 void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *); 1036 void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *); 1037 1038 int (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *); 1039 void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *); 1040 void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32); 1041 int (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *); 1042 void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *); 1043 int (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode); 1044 1045 int (*get_antenna)(struct ieee80211_hw *, u32 *, u32 *); 1046 int (*set_antenna)(struct ieee80211_hw *, u32, u32); 1047 1048 int (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type); 1049 int (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *); 1050 1051 void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64); 1052 void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int); 1053 1054 void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64); 1055 void (*link_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64); 1056 1057 int (*set_rts_threshold)(struct ieee80211_hw *, u32); 1058 void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *); 1059 int (*get_survey)(struct ieee80211_hw *, int, struct survey_info *); 1060 int (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *); 1061 1062 uint64_t (*get_tsf)(struct ieee80211_hw *, struct ieee80211_vif *); 1063 void (*set_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, uint64_t); 1064 void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64); 1065 1066 int (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *); 1067 void (*set_coverage_class)(struct ieee80211_hw *, s16); 1068 int (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool); 1069 1070 int (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *); 1071 void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int); 1072 void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *); 1073 void (*set_rekey_data)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_gtk_rekey_data *); 1074 1075 int (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *); 1076 void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *); 1077 1078 int (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf); 1079 void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf); 1080 int (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *); 1081 void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *); 1082 1083 int (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *); 1084 1085 int (*set_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct cfg80211_tid_config *); 1086 int (*reset_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8); 1087 1088 int (*get_et_sset_count)(struct ieee80211_hw *, struct ieee80211_vif *, int); 1089 void (*get_et_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct ethtool_stats *, u64 *); 1090 void (*get_et_strings)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u8 *); 1091 1092 void (*update_vif_offload)(struct ieee80211_hw *, struct ieee80211_vif *); 1093 1094 int (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, int *); 1095 int (*get_stats)(struct ieee80211_hw *, struct ieee80211_low_level_stats *); 1096 1097 int (*set_radar_background)(struct ieee80211_hw *, struct cfg80211_chan_def *); 1098 1099 void (*add_twt_setup)(struct ieee80211_hw *, struct ieee80211_sta *, struct ieee80211_twt_setup *); 1100 void (*twt_teardown_request)(struct ieee80211_hw *, struct ieee80211_sta *, u8); 1101 1102 int (*set_hw_timestamp)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_set_hw_timestamp *); 1103 1104 void (*vif_cfg_changed)(struct ieee80211_hw *, struct ieee80211_vif *, u64); 1105 1106 int (*change_vif_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16, u16, struct ieee80211_bss_conf *[IEEE80211_MLD_MAX_NUM_LINKS]); 1107 int (*change_sta_links)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u16, u16); 1108 bool (*can_activate_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16); 1109 enum ieee80211_neg_ttlm_res (*can_neg_ttlm)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_neg_ttlm *); 1110 1111 /* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change depending on compile-time option. */ 1112 void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *); 1113 /* #endif */ 1114 }; 1115 1116 1117 /* -------------------------------------------------------------------------- */ 1118 1119 /* linux_80211.c */ 1120 extern const struct cfg80211_ops linuxkpi_mac80211cfgops; 1121 1122 struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t, 1123 const struct ieee80211_ops *); 1124 void linuxkpi_ieee80211_iffree(struct ieee80211_hw *); 1125 void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *, char *); 1126 int linuxkpi_ieee80211_ifattach(struct ieee80211_hw *); 1127 void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *); 1128 void linuxkpi_ieee80211_unregister_hw(struct ieee80211_hw *); 1129 struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *); 1130 void linuxkpi_ieee80211_restart_hw(struct ieee80211_hw *); 1131 void linuxkpi_ieee80211_iterate_interfaces( 1132 struct ieee80211_hw *hw, enum ieee80211_iface_iter flags, 1133 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 1134 void *); 1135 void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *, 1136 struct ieee80211_vif *, 1137 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, 1138 struct ieee80211_sta *, struct ieee80211_key_conf *, void *), 1139 void *); 1140 void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *, 1141 void(*iterfunc)(struct ieee80211_hw *, 1142 struct ieee80211_chanctx_conf *, void *), 1143 void *); 1144 void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *, 1145 void (*iterfunc)(void *, struct ieee80211_sta *), void *); 1146 void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *, 1147 struct cfg80211_scan_info *); 1148 void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *, 1149 struct ieee80211_sta *, struct napi_struct *, struct list_head *); 1150 uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool); 1151 struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *, 1152 const u8 *); 1153 struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr( 1154 struct ieee80211_hw *, const uint8_t *, const uint8_t *); 1155 struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *, 1156 struct ieee80211_txq *); 1157 bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t); 1158 bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t); 1159 void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *, 1160 int); 1161 void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *, 1162 struct delayed_work *, int); 1163 void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *); 1164 struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *, 1165 struct ieee80211_vif *); 1166 struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *, 1167 struct ieee80211_vif *, int, bool); 1168 void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, unsigned long *, 1169 unsigned long *); 1170 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *); 1171 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *); 1172 void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *); 1173 struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *, 1174 uint8_t *, uint8_t *, size_t, size_t); 1175 void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *); 1176 void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *, 1177 struct ieee80211_tx_status *); 1178 void linuxkpi_ieee80211_stop_queues(struct ieee80211_hw *); 1179 void linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *); 1180 void linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *, int); 1181 void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *, int); 1182 void linuxkpi_ieee80211_txq_schedule_start(struct ieee80211_hw *, uint8_t); 1183 struct ieee80211_txq *linuxkpi_ieee80211_next_txq(struct ieee80211_hw *, uint8_t); 1184 void linuxkpi_ieee80211_schedule_txq(struct ieee80211_hw *, 1185 struct ieee80211_txq *, bool); 1186 void linuxkpi_ieee80211_handle_wake_tx_queue(struct ieee80211_hw *, 1187 struct ieee80211_txq *); 1188 1189 /* -------------------------------------------------------------------------- */ 1190 1191 static __inline void 1192 _ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag) 1193 { 1194 1195 set_bit(flag, hw->flags); 1196 } 1197 1198 static __inline bool 1199 __ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag) 1200 { 1201 1202 return (test_bit(flag, hw->flags)); 1203 } 1204 1205 /* They pass in shortened flag names; how confusingly inconsistent. */ 1206 #define ieee80211_hw_set(_hw, _flag) \ 1207 _ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag) 1208 #define ieee80211_hw_check(_hw, _flag) \ 1209 __ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag) 1210 1211 /* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */ 1212 CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb)); 1213 #define IEEE80211_SKB_CB(_skb) \ 1214 ((struct ieee80211_tx_info *)((_skb)->cb)) 1215 1216 CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb)); 1217 #define IEEE80211_SKB_RXCB(_skb) \ 1218 ((struct ieee80211_rx_status *)((_skb)->cb)) 1219 1220 static __inline void 1221 ieee80211_free_hw(struct ieee80211_hw *hw) 1222 { 1223 1224 linuxkpi_ieee80211_iffree(hw); 1225 1226 if (hw->wiphy != NULL) 1227 wiphy_free(hw->wiphy); 1228 /* Note that *hw is not valid any longer after this. */ 1229 1230 IMPROVE(); 1231 } 1232 1233 static __inline struct ieee80211_hw * 1234 ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops) 1235 { 1236 1237 return (linuxkpi_ieee80211_alloc_hw(priv_len, ops)); 1238 } 1239 1240 static __inline void 1241 SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev) 1242 { 1243 1244 set_wiphy_dev(hw->wiphy, dev); 1245 linuxkpi_set_ieee80211_dev(hw, dev_name(dev)); 1246 1247 IMPROVE(); 1248 } 1249 1250 static __inline int 1251 ieee80211_register_hw(struct ieee80211_hw *hw) 1252 { 1253 int error; 1254 1255 error = wiphy_register(hw->wiphy); 1256 if (error != 0) 1257 return (error); 1258 1259 /* 1260 * At this point the driver has set all the options, flags, bands, 1261 * ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy 1262 * setup is done. 1263 * We need to replicate a lot of information from here into net80211. 1264 */ 1265 error = linuxkpi_ieee80211_ifattach(hw); 1266 1267 IMPROVE(); 1268 1269 return (error); 1270 } 1271 1272 static inline void 1273 ieee80211_unregister_hw(struct ieee80211_hw *hw) 1274 { 1275 1276 linuxkpi_ieee80211_unregister_hw(hw); 1277 } 1278 1279 static __inline struct ieee80211_hw * 1280 wiphy_to_ieee80211_hw(struct wiphy *wiphy) 1281 { 1282 1283 return (linuxkpi_wiphy_to_ieee80211_hw(wiphy)); 1284 } 1285 1286 static inline void 1287 ieee80211_restart_hw(struct ieee80211_hw *hw) 1288 { 1289 linuxkpi_ieee80211_restart_hw(hw); 1290 } 1291 1292 static inline void 1293 ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif) 1294 { 1295 TODO(); 1296 } 1297 1298 /* -------------------------------------------------------------------------- */ 1299 1300 #define link_conf_dereference_check(_vif, _linkid) \ 1301 rcu_dereference_check((_vif)->link_conf[_linkid], true) 1302 1303 #define link_conf_dereference_protected(_vif, _linkid) \ 1304 rcu_dereference_protected((_vif)->link_conf[_linkid], true) 1305 1306 #define link_sta_dereference_check(_sta, _linkid) \ 1307 rcu_dereference_check((_sta)->link[_linkid], true) 1308 1309 #define link_sta_dereference_protected(_sta, _linkid) \ 1310 rcu_dereference_protected((_sta)->link[_linkid], true) 1311 1312 #define for_each_vif_active_link(_vif, _link, _linkid) \ 1313 for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++) \ 1314 if ( ((_vif)->active_links == 0 /* no MLO */ || \ 1315 ((_vif)->active_links & BIT(_linkid)) != 0) && \ 1316 (_link = rcu_dereference((_vif)->link_conf[_linkid])) ) 1317 1318 #define for_each_sta_active_link(_vif, _sta, _linksta, _linkid) \ 1319 for (_linkid = 0; _linkid < nitems((_sta)->link); _linkid++) \ 1320 if ( ((_vif)->active_links == 0 /* no MLO */ || \ 1321 ((_vif)->active_links & BIT(_linkid)) != 0) && \ 1322 (_linksta = link_sta_dereference_protected((_sta), (_linkid))) ) 1323 1324 /* -------------------------------------------------------------------------- */ 1325 1326 static __inline bool 1327 ieee80211_vif_is_mesh(struct ieee80211_vif *vif) 1328 { 1329 TODO(); 1330 return (false); 1331 } 1332 1333 1334 /* -------------------------------------------------------------------------- */ 1335 /* Receive functions (air/driver to mac80211/net80211). */ 1336 1337 1338 static __inline void 1339 ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1340 struct sk_buff *skb, struct napi_struct *napi) 1341 { 1342 1343 linuxkpi_ieee80211_rx(hw, skb, sta, napi, NULL); 1344 } 1345 1346 static __inline void 1347 ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1348 struct sk_buff *skb, struct list_head *list) 1349 { 1350 1351 linuxkpi_ieee80211_rx(hw, skb, sta, NULL, list); 1352 } 1353 1354 static __inline void 1355 ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb) 1356 { 1357 1358 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL); 1359 } 1360 1361 static __inline void 1362 ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) 1363 { 1364 1365 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL); 1366 } 1367 1368 static __inline void 1369 ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb) 1370 { 1371 1372 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL); 1373 } 1374 1375 /* -------------------------------------------------------------------------- */ 1376 1377 static inline void 1378 ieee80211_stop_queues(struct ieee80211_hw *hw) 1379 { 1380 linuxkpi_ieee80211_stop_queues(hw); 1381 } 1382 1383 static inline void 1384 ieee80211_wake_queues(struct ieee80211_hw *hw) 1385 { 1386 linuxkpi_ieee80211_wake_queues(hw); 1387 } 1388 1389 static inline void 1390 ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum) 1391 { 1392 linuxkpi_ieee80211_stop_queue(hw, qnum); 1393 } 1394 1395 static inline void 1396 ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum) 1397 { 1398 linuxkpi_ieee80211_wake_queue(hw, qnum); 1399 } 1400 1401 static inline void 1402 ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 1403 { 1404 linuxkpi_ieee80211_schedule_txq(hw, txq, true); 1405 } 1406 1407 static inline void 1408 ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq, 1409 bool withoutpkts) 1410 { 1411 linuxkpi_ieee80211_schedule_txq(hw, txq, withoutpkts); 1412 } 1413 1414 static inline void 1415 ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac) 1416 { 1417 linuxkpi_ieee80211_txq_schedule_start(hw, ac); 1418 } 1419 1420 static inline void 1421 ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac) 1422 { 1423 /* DO_NADA; */ 1424 } 1425 1426 static inline struct ieee80211_txq * 1427 ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac) 1428 { 1429 return (linuxkpi_ieee80211_next_txq(hw, ac)); 1430 } 1431 1432 static inline void 1433 ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw, 1434 struct ieee80211_txq *txq) 1435 { 1436 linuxkpi_ieee80211_handle_wake_tx_queue(hw, txq); 1437 } 1438 1439 /* -------------------------------------------------------------------------- */ 1440 1441 static __inline uint8_t 1442 ieee80211_get_tid(struct ieee80211_hdr *hdr) 1443 { 1444 1445 return (linuxkpi_ieee80211_get_tid(hdr, false)); 1446 } 1447 1448 static __inline struct sk_buff * 1449 ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1450 uint16_t *tim_offset, uint16_t *tim_len, uint32_t link_id) 1451 { 1452 1453 if (tim_offset != NULL) 1454 *tim_offset = 0; 1455 if (tim_len != NULL) 1456 *tim_len = 0; 1457 TODO(); 1458 return (NULL); 1459 } 1460 1461 static __inline void 1462 ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw, 1463 enum ieee80211_iface_iter flags, 1464 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 1465 void *arg) 1466 { 1467 1468 flags |= IEEE80211_IFACE_ITER__ATOMIC; 1469 flags |= IEEE80211_IFACE_ITER_ACTIVE; 1470 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); 1471 } 1472 1473 static __inline void 1474 ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, 1475 enum ieee80211_iface_iter flags, 1476 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 1477 void *arg) 1478 { 1479 1480 flags |= IEEE80211_IFACE_ITER_ACTIVE; 1481 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); 1482 } 1483 1484 static __inline void 1485 ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw, 1486 enum ieee80211_iface_iter flags, 1487 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 1488 void *arg) 1489 { 1490 flags |= IEEE80211_IFACE_ITER_ACTIVE; 1491 flags |= IEEE80211_IFACE_ITER__MTX; 1492 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); 1493 } 1494 1495 static __inline void 1496 ieee80211_iterate_interfaces(struct ieee80211_hw *hw, 1497 enum ieee80211_iface_iter flags, 1498 void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *), 1499 void *arg) 1500 { 1501 1502 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg); 1503 } 1504 1505 static __inline void 1506 ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1507 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, 1508 struct ieee80211_sta *, struct ieee80211_key_conf *, void *), 1509 void *arg) 1510 { 1511 1512 linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg); 1513 } 1514 1515 static __inline void 1516 ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 1517 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *, 1518 struct ieee80211_sta *, struct ieee80211_key_conf *, void *), 1519 void *arg) 1520 { 1521 1522 IMPROVE(); /* "rcu" */ 1523 linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg); 1524 } 1525 1526 static __inline void 1527 ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw, 1528 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *), 1529 void *arg) 1530 { 1531 1532 linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg); 1533 } 1534 1535 static __inline void 1536 ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw, 1537 void (*iterfunc)(void *, struct ieee80211_sta *), void *arg) 1538 { 1539 1540 linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg); 1541 } 1542 1543 static __inline struct wireless_dev * 1544 ieee80211_vif_to_wdev(struct ieee80211_vif *vif) 1545 { 1546 1547 return (linuxkpi_ieee80211_vif_to_wdev(vif)); 1548 } 1549 1550 static __inline struct sk_buff * 1551 ieee80211_beacon_get_template(struct ieee80211_hw *hw, 1552 struct ieee80211_vif *vif, struct ieee80211_mutable_offsets *offs, 1553 uint32_t link_id) 1554 { 1555 TODO(); 1556 return (NULL); 1557 } 1558 1559 static __inline void 1560 ieee80211_beacon_loss(struct ieee80211_vif *vif) 1561 { 1562 linuxkpi_ieee80211_beacon_loss(vif); 1563 } 1564 1565 static __inline void 1566 ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t, uint32_t link_id) 1567 { 1568 TODO(); 1569 } 1570 1571 static __inline bool 1572 ieee80211_csa_is_complete(struct ieee80211_vif *vif) 1573 { 1574 TODO(); 1575 return (false); 1576 } 1577 1578 static __inline void 1579 ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter) 1580 { 1581 TODO(); 1582 } 1583 1584 static __inline int 1585 ieee80211_csa_update_counter(struct ieee80211_vif *vif) 1586 { 1587 TODO(); 1588 return (-1); 1589 } 1590 1591 static __inline void 1592 ieee80211_csa_finish(struct ieee80211_vif *vif, uint32_t link_id) 1593 { 1594 TODO(); 1595 } 1596 1597 static __inline enum nl80211_iftype 1598 ieee80211_vif_type_p2p(struct ieee80211_vif *vif) 1599 { 1600 1601 /* If we are not p2p enabled, just return the type. */ 1602 if (!vif->p2p) 1603 return (vif->type); 1604 1605 /* If we are p2p, depending on side, return type. */ 1606 switch (vif->type) { 1607 case NL80211_IFTYPE_AP: 1608 return (NL80211_IFTYPE_P2P_GO); 1609 case NL80211_IFTYPE_STATION: 1610 return (NL80211_IFTYPE_P2P_CLIENT); 1611 default: 1612 fallthrough; 1613 } 1614 return (vif->type); 1615 } 1616 1617 static __inline unsigned long 1618 ieee80211_tu_to_usec(unsigned long tu) 1619 { 1620 1621 return (tu * IEEE80211_DUR_TU); 1622 } 1623 1624 /* 1625 * Below we assume that the two values from different emums are the same. 1626 * Make sure this does not accidentally change. 1627 */ 1628 CTASSERT((int)IEEE80211_ACTION_SM_TPCREP == (int)IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP); 1629 1630 static __inline bool 1631 ieee80211_action_contains_tpc(struct sk_buff *skb) 1632 { 1633 struct ieee80211_mgmt *mgmt; 1634 1635 mgmt = (struct ieee80211_mgmt *)skb->data; 1636 1637 /* Check that this is a mgmt/action frame? */ 1638 if (!ieee80211_is_action(mgmt->frame_control)) 1639 return (false); 1640 1641 /* 1642 * This is a bit convoluted but according to docs both actions 1643 * are checked for this. Kind-of makes sense for the only consumer 1644 * (iwlwifi) I am aware off given the txpower fields are at the 1645 * same location so firmware can update the value. 1646 */ 1647 /* 80211-2020 9.6.2 Spectrum Management Action frames */ 1648 /* 80211-2020 9.6.2.5 TPC Report frame format */ 1649 /* 80211-2020 9.6.6 Radio Measurement action details */ 1650 /* 80211-2020 9.6.6.4 Link Measurement Report frame format */ 1651 /* Check that it is Spectrum Management or Radio Measurement? */ 1652 if (mgmt->u.action.category != IEEE80211_ACTION_CAT_SM && 1653 mgmt->u.action.category != IEEE80211_ACTION_CAT_RADIO_MEASUREMENT) 1654 return (false); 1655 1656 /* 1657 * Check that it is TPC Report or Link Measurement Report? 1658 * The values of each are the same (see CTASSERT above function). 1659 */ 1660 if (mgmt->u.action.u.tpc_report.spec_mgmt != IEEE80211_ACTION_SM_TPCREP) 1661 return (false); 1662 1663 /* 80211-2020 9.4.2.16 TPC Report element */ 1664 /* Check that the ELEMID and length are correct? */ 1665 if (mgmt->u.action.u.tpc_report.tpc_elem_id != IEEE80211_ELEMID_TPCREP || 1666 mgmt->u.action.u.tpc_report.tpc_elem_length != 4) 1667 return (false); 1668 1669 /* All the right fields in the right place. */ 1670 return (true); 1671 } 1672 1673 static __inline void 1674 ieee80211_connection_loss(struct ieee80211_vif *vif) 1675 { 1676 1677 linuxkpi_ieee80211_connection_loss(vif); 1678 } 1679 1680 static __inline struct ieee80211_sta * 1681 ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer) 1682 { 1683 1684 return (linuxkpi_ieee80211_find_sta(vif, peer)); 1685 } 1686 1687 static __inline struct ieee80211_sta * 1688 ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const uint8_t *addr, 1689 const uint8_t *ourvifaddr) 1690 { 1691 1692 return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr)); 1693 } 1694 1695 1696 static __inline void 1697 ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf, 1698 struct sk_buff *skb_frag, u8 *key) 1699 { 1700 TODO(); 1701 } 1702 1703 static __inline void 1704 ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf, 1705 const u8 *addr, uint32_t iv32, u16 *p1k) 1706 { 1707 1708 KASSERT(keyconf != NULL && addr != NULL && p1k != NULL, 1709 ("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k)); 1710 1711 TODO(); 1712 memset(p1k, 0xfa, 5 * sizeof(*p1k)); /* Just initializing. */ 1713 } 1714 1715 static __inline size_t 1716 ieee80211_ie_split(const u8 *ies, size_t ies_len, 1717 const u8 *ie_ids, size_t ie_ids_len, size_t start) 1718 { 1719 size_t x; 1720 1721 x = start; 1722 1723 /* XXX FIXME, we need to deal with "Element ID Extension" */ 1724 while (x < ies_len) { 1725 1726 /* Is this IE[s] one of the ie_ids? */ 1727 if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x], 1728 ie_ids, ie_ids_len)) 1729 break; 1730 1731 if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len)) 1732 break; 1733 } 1734 1735 return (x); 1736 } 1737 1738 static __inline void 1739 ieee80211_request_smps(struct ieee80211_vif *vif, u_int link_id, 1740 enum ieee80211_smps_mode smps) 1741 { 1742 static const char *smps_mode_name[] = { 1743 "SMPS_OFF", 1744 "SMPS_STATIC", 1745 "SMPS_DYNAMIC", 1746 "SMPS_AUTOMATIC", 1747 "SMPS_NUM_MODES" 1748 }; 1749 1750 if (linuxkpi_debug_80211 & D80211_TODO) 1751 printf("%s:%d: XXX LKPI80211 TODO smps %d %s\n", 1752 __func__, __LINE__, smps, smps_mode_name[smps]); 1753 } 1754 1755 static __inline void 1756 ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr, 1757 enum nl80211_tdls_operation oper, enum ieee80211_reason_code code, 1758 gfp_t gfp) 1759 { 1760 TODO(); 1761 } 1762 1763 static __inline void 1764 wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state) 1765 { 1766 TODO(); 1767 } 1768 1769 static __inline void 1770 ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb) 1771 { 1772 IMPROVE(); 1773 1774 /* 1775 * This is called on transmit failure. 1776 * Use a not-so-random random high status error so we can distinguish 1777 * it from normal low values flying around in net80211 ("ETX"). 1778 */ 1779 linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458); 1780 } 1781 1782 static __inline void 1783 ieee80211_ready_on_channel(struct ieee80211_hw *hw) 1784 { 1785 TODO(); 1786 /* XXX-BZ We need to see that. */ 1787 } 1788 1789 static __inline void 1790 ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw) 1791 { 1792 TODO(); 1793 } 1794 1795 static __inline void 1796 ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, 1797 enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp) 1798 { 1799 TODO(); 1800 } 1801 1802 /* -------------------------------------------------------------------------- */ 1803 1804 static inline bool 1805 ieee80211_sn_less(uint16_t sn1, uint16_t sn2) 1806 { 1807 return (IEEE80211_SEQ_BA_BEFORE(sn1, sn2)); 1808 } 1809 1810 static inline uint16_t 1811 ieee80211_sn_inc(uint16_t sn) 1812 { 1813 return (IEEE80211_SEQ_INC(sn)); 1814 } 1815 1816 static inline uint16_t 1817 ieee80211_sn_add(uint16_t sn, uint16_t a) 1818 { 1819 return (IEEE80211_SEQ_ADD(sn, a)); 1820 } 1821 1822 static inline uint16_t 1823 ieee80211_sn_sub(uint16_t sa, uint16_t sb) 1824 { 1825 return (IEEE80211_SEQ_SUB(sa, sb)); 1826 } 1827 1828 static __inline void 1829 ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid, 1830 uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu) 1831 { 1832 TODO(); 1833 } 1834 1835 static __inline void 1836 ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr) 1837 { 1838 TODO(); 1839 } 1840 1841 static __inline void 1842 ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr, 1843 uint8_t tid) 1844 { 1845 TODO(); 1846 } 1847 1848 static __inline void 1849 ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr, 1850 uint8_t tid) 1851 { 1852 TODO(); 1853 } 1854 1855 static __inline void 1856 ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr, 1857 uint8_t tid) 1858 { 1859 TODO(); 1860 } 1861 1862 /* -------------------------------------------------------------------------- */ 1863 1864 static __inline void 1865 ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint32_t f1, uint32_t f2) 1866 { 1867 TODO(); 1868 } 1869 1870 static __inline uint8_t 1871 ieee80211_rate_get_vht_nss(struct ieee80211_tx_rate *r) 1872 { 1873 TODO(); 1874 return (0); 1875 } 1876 1877 static __inline uint8_t 1878 ieee80211_rate_get_vht_mcs(struct ieee80211_tx_rate *r) 1879 { 1880 TODO(); 1881 return (0); 1882 } 1883 1884 static __inline void 1885 ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid) 1886 { 1887 TODO(); 1888 } 1889 1890 static __inline void 1891 ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid) 1892 { 1893 TODO(); 1894 } 1895 1896 static __inline void 1897 ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid) 1898 { 1899 TODO(); 1900 } 1901 1902 static __inline void 1903 ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 1904 bool disable) 1905 { 1906 TODO(); 1907 } 1908 1909 static __inline void 1910 ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping) 1911 { 1912 TODO(); 1913 } 1914 1915 static __inline void 1916 ieee80211_sta_pspoll(struct ieee80211_sta *sta) 1917 { 1918 TODO(); 1919 } 1920 1921 static __inline void 1922 ieee80211_sta_recalc_aggregates(struct ieee80211_sta *sta) 1923 { 1924 TODO(); 1925 } 1926 1927 static __inline void 1928 ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids) 1929 { 1930 TODO(); 1931 } 1932 1933 static __inline void 1934 ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf, 1935 uint64_t pn) 1936 { 1937 TODO(); 1938 } 1939 1940 static inline struct sk_buff * 1941 ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 1942 { 1943 1944 return (linuxkpi_ieee80211_tx_dequeue(hw, txq)); 1945 } 1946 1947 static inline struct sk_buff * 1948 ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 1949 { 1950 struct sk_buff *skb; 1951 1952 local_bh_disable(); 1953 skb = linuxkpi_ieee80211_tx_dequeue(hw, txq); 1954 local_bh_enable(); 1955 1956 return (skb); 1957 } 1958 1959 static __inline void 1960 ieee80211_update_mu_groups(struct ieee80211_vif *vif, 1961 u_int _i, uint8_t *ms, uint8_t *up) 1962 { 1963 TODO(); 1964 } 1965 1966 static __inline void 1967 ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t) 1968 { 1969 TODO(); 1970 } 1971 1972 static __inline void 1973 ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid, 1974 struct ieee80211_key_seq *seq) 1975 { 1976 1977 KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n", 1978 __func__, keyconf, seq)); 1979 1980 TODO(); 1981 switch (keyconf->cipher) { 1982 case WLAN_CIPHER_SUITE_CCMP: 1983 case WLAN_CIPHER_SUITE_CCMP_256: 1984 memset(seq->ccmp.pn, 0xfa, sizeof(seq->ccmp.pn)); /* XXX TODO */ 1985 break; 1986 case WLAN_CIPHER_SUITE_AES_CMAC: 1987 memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn)); /* XXX TODO */ 1988 break; 1989 case WLAN_CIPHER_SUITE_TKIP: 1990 seq->tkip.iv32 = 0xfa; /* XXX TODO */ 1991 seq->tkip.iv16 = 0xfa; /* XXX TODO */ 1992 break; 1993 default: 1994 pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher); 1995 break; 1996 } 1997 } 1998 1999 static __inline void 2000 ieee80211_sched_scan_results(struct ieee80211_hw *hw) 2001 { 2002 TODO(); 2003 } 2004 2005 static __inline void 2006 ieee80211_sta_eosp(struct ieee80211_sta *sta) 2007 { 2008 TODO(); 2009 } 2010 2011 static __inline int 2012 ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x) 2013 { 2014 TODO("rtw8x"); 2015 return (-EINVAL); 2016 } 2017 2018 static __inline int 2019 ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid) 2020 { 2021 TODO("rtw89"); 2022 return (-EINVAL); 2023 } 2024 2025 static __inline void 2026 ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr, 2027 uint8_t tid) 2028 { 2029 TODO("iwlwifi"); 2030 } 2031 2032 static __inline void 2033 ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr, 2034 uint8_t tid) 2035 { 2036 TODO("iwlwifi/rtw8x/..."); 2037 } 2038 2039 static __inline void 2040 ieee80211_sched_scan_stopped(struct ieee80211_hw *hw) 2041 { 2042 TODO(); 2043 } 2044 2045 static __inline void 2046 ieee80211_scan_completed(struct ieee80211_hw *hw, 2047 struct cfg80211_scan_info *info) 2048 { 2049 2050 linuxkpi_ieee80211_scan_completed(hw, info); 2051 } 2052 2053 static __inline struct sk_buff * 2054 ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2055 uint32_t link_id) 2056 { 2057 TODO(); 2058 return (NULL); 2059 } 2060 2061 static __inline struct sk_buff * 2062 ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 2063 { 2064 2065 /* Only STA needs this. Otherwise return NULL and panic bad drivers. */ 2066 if (vif->type != NL80211_IFTYPE_STATION) 2067 return (NULL); 2068 2069 return (linuxkpi_ieee80211_pspoll_get(hw, vif)); 2070 } 2071 2072 static __inline struct sk_buff * 2073 ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif) 2074 { 2075 TODO(); 2076 return (NULL); 2077 } 2078 2079 static __inline struct sk_buff * 2080 ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2081 int linkid, bool qos) 2082 { 2083 2084 /* Only STA needs this. Otherwise return NULL and panic bad drivers. */ 2085 if (vif->type != NL80211_IFTYPE_STATION) 2086 return (NULL); 2087 2088 return (linuxkpi_ieee80211_nullfunc_get(hw, vif, linkid, qos)); 2089 } 2090 2091 static __inline struct sk_buff * 2092 ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr, 2093 uint8_t *ssid, size_t ssid_len, size_t tailroom) 2094 { 2095 2096 return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len, 2097 tailroom)); 2098 } 2099 2100 static __inline void 2101 ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w, 2102 int delay) 2103 { 2104 2105 linuxkpi_ieee80211_queue_delayed_work(hw, w, delay); 2106 } 2107 2108 static __inline void 2109 ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w) 2110 { 2111 2112 linuxkpi_ieee80211_queue_work(hw, w); 2113 } 2114 2115 static __inline void 2116 ieee80211_tx_status_skb(struct ieee80211_hw *hw, struct sk_buff *skb) 2117 { 2118 linuxkpi_ieee80211_tx_status(hw, skb); 2119 } 2120 2121 static __inline void 2122 ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb) 2123 { 2124 IMPROVE(); 2125 linuxkpi_ieee80211_tx_status(hw, skb); 2126 } 2127 2128 static __inline void 2129 ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb) 2130 { 2131 IMPROVE(); 2132 linuxkpi_ieee80211_tx_status(hw, skb); 2133 } 2134 2135 static __inline void 2136 ieee80211_tx_status_ext(struct ieee80211_hw *hw, 2137 struct ieee80211_tx_status *txstat) 2138 { 2139 2140 linuxkpi_ieee80211_tx_status_ext(hw, txstat); 2141 } 2142 2143 static __inline void 2144 ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) 2145 { 2146 int i; 2147 2148 /* 2149 * Apparently clearing flags and some other fields is not right. 2150 * Given the function is called "status" we work on that part of 2151 * the union. 2152 */ 2153 for (i = 0; i < nitems(info->status.rates); i++) 2154 info->status.rates[i].count = 0; 2155 /* 2156 * Unclear if ack_signal should be included or not but we clear the 2157 * "valid" bool so this field is no longer valid. 2158 */ 2159 memset(&info->status.ack_signal, 0, sizeof(*info) - 2160 offsetof(struct ieee80211_tx_info, status.ack_signal)); 2161 } 2162 2163 static __inline void 2164 ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt, 2165 unsigned long *byte_cnt) 2166 { 2167 2168 if (frame_cnt == NULL && byte_cnt == NULL) 2169 return; 2170 2171 linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt); 2172 } 2173 2174 static __inline int 2175 rate_lowest_index(struct ieee80211_supported_band *band, 2176 struct ieee80211_sta *sta) 2177 { 2178 IMPROVE(); 2179 return (0); 2180 } 2181 2182 2183 static __inline void 2184 SET_IEEE80211_PERM_ADDR (struct ieee80211_hw *hw, uint8_t *addr) 2185 { 2186 2187 ether_addr_copy(hw->wiphy->perm_addr, addr); 2188 } 2189 2190 static __inline void 2191 ieee80211_report_low_ack(struct ieee80211_sta *sta, int x) 2192 { 2193 TODO(); 2194 } 2195 2196 static __inline void 2197 ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta, 2198 struct ieee80211_tx_info *info) 2199 { 2200 TODO(); 2201 } 2202 2203 static __inline bool 2204 ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq) 2205 { 2206 TODO(); 2207 return (false); 2208 } 2209 2210 static __inline void 2211 ieee80211_radar_detected(struct ieee80211_hw *hw) 2212 { 2213 TODO(); 2214 } 2215 2216 static __inline void 2217 ieee80211_sta_register_airtime(struct ieee80211_sta *sta, 2218 uint8_t tid, uint32_t duration, int x) 2219 { 2220 TODO(); 2221 } 2222 2223 static __inline void 2224 ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter) 2225 { 2226 TODO(); 2227 } 2228 2229 static __inline int 2230 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif, uint32_t link_id) 2231 { 2232 TODO(); 2233 return (-1); 2234 } 2235 2236 static __inline int 2237 ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap, uint32_t chanwidth, 2238 int x, bool t, int nss) 2239 { 2240 TODO(); 2241 return (-1); 2242 } 2243 2244 static __inline bool 2245 ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif, uint32_t link_id) 2246 { 2247 TODO(); 2248 return (true); 2249 } 2250 2251 static __inline void 2252 ieee80211_disconnect(struct ieee80211_vif *vif, bool _x) 2253 { 2254 TODO(); 2255 } 2256 2257 static __inline void 2258 ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool _x) 2259 { 2260 TODO(); 2261 } 2262 2263 static __inline const struct ieee80211_sta_he_cap * 2264 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band, 2265 enum nl80211_iftype type) 2266 { 2267 TODO(); 2268 return (NULL); 2269 } 2270 2271 static __inline void 2272 ieee80211_key_mic_failure(struct ieee80211_key_conf *key) 2273 { 2274 TODO(); 2275 } 2276 2277 static __inline void 2278 ieee80211_key_replay(struct ieee80211_key_conf *key) 2279 { 2280 TODO(); 2281 } 2282 2283 static __inline uint32_t 2284 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw, 2285 struct ieee80211_rx_status *rxstat, int len) 2286 { 2287 TODO(); 2288 return (0); 2289 } 2290 2291 static __inline void 2292 ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta, 2293 struct sk_buff *skb, struct ieee80211_tx_rate *txrate, int nrates) 2294 { 2295 TODO(); 2296 } 2297 2298 static __inline void 2299 ieee80211_color_change_finish(struct ieee80211_vif *vif) 2300 { 2301 TODO(); 2302 } 2303 2304 static __inline struct sk_buff * 2305 ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw, 2306 struct ieee80211_vif *vif) 2307 { 2308 TODO(); 2309 return (NULL); 2310 } 2311 2312 static __inline struct sk_buff * 2313 ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw, 2314 struct ieee80211_vif *vif) 2315 { 2316 TODO(); 2317 return (NULL); 2318 } 2319 2320 static __inline void 2321 linuxkpi_ieee80211_send_bar(struct ieee80211_vif *vif, uint8_t *ra, uint16_t tid, 2322 uint16_t ssn) 2323 { 2324 TODO(); 2325 } 2326 2327 static __inline void 2328 ieee80211_resume_disconnect(struct ieee80211_vif *vif) 2329 { 2330 TODO(); 2331 } 2332 2333 static __inline int 2334 ieee80211_data_to_8023(struct sk_buff *skb, const uint8_t *addr, 2335 enum nl80211_iftype iftype) 2336 { 2337 TODO(); 2338 return (-1); 2339 } 2340 2341 static __inline void 2342 ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key, 2343 uint32_t iv32, uint16_t *p1k) 2344 { 2345 TODO(); 2346 } 2347 2348 static __inline struct ieee80211_key_conf * 2349 ieee80211_gtk_rekey_add(struct ieee80211_vif *vif, 2350 struct ieee80211_key_conf *key) 2351 { 2352 TODO(); 2353 return (NULL); 2354 } 2355 2356 static __inline void 2357 ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid, 2358 const uint8_t *replay_ctr, gfp_t gfp) 2359 { 2360 TODO(); 2361 } 2362 2363 static __inline void 2364 ieee80211_remove_key(struct ieee80211_key_conf *key) 2365 { 2366 TODO(); 2367 } 2368 2369 static __inline void 2370 ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid, 2371 struct ieee80211_key_seq *seq) 2372 { 2373 TODO(); 2374 } 2375 2376 static __inline void 2377 ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif, 2378 struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp) 2379 { 2380 TODO(); 2381 } 2382 2383 static __inline void 2384 ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif, 2385 uint64_t obss_color_bitmap, gfp_t gfp) 2386 { 2387 TODO(); 2388 } 2389 2390 static __inline void 2391 ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta, 2392 uint8_t tid) 2393 { 2394 TODO(); 2395 } 2396 2397 static __inline struct ieee80211_ema_beacons * 2398 ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw, 2399 struct ieee80211_vif *vif, uint32_t link_id) 2400 { 2401 TODO(); 2402 return (NULL); 2403 } 2404 2405 static __inline void 2406 ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *bcns) 2407 { 2408 TODO(); 2409 } 2410 2411 static inline bool 2412 ieee80211_vif_is_mld(const struct ieee80211_vif *vif) 2413 { 2414 2415 /* If valid_links is non-zero, the vif is an MLD. */ 2416 return (vif->valid_links != 0); 2417 } 2418 2419 static __inline const struct ieee80211_sta_he_cap * 2420 ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band, 2421 struct ieee80211_vif *vif) 2422 { 2423 TODO(); 2424 return (NULL); 2425 } 2426 2427 static __inline const struct ieee80211_sta_eht_cap * 2428 ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band, 2429 struct ieee80211_vif *vif) 2430 { 2431 TODO(); 2432 return (NULL); 2433 } 2434 2435 static inline uint32_t 2436 ieee80211_vif_usable_links(const struct ieee80211_vif *vif) 2437 { 2438 TODO(); 2439 return (1); 2440 } 2441 2442 static inline bool 2443 ieee80211_vif_link_active(const struct ieee80211_vif *vif, uint8_t link_id) 2444 { 2445 if (ieee80211_vif_is_mld(vif)) 2446 return (vif->active_links & BIT(link_id)); 2447 return (link_id == 0); 2448 } 2449 2450 static inline void 2451 ieee80211_set_active_links_async(struct ieee80211_vif *vif, 2452 uint32_t new_active_links) 2453 { 2454 TODO(); 2455 } 2456 2457 static inline int 2458 ieee80211_set_active_links(struct ieee80211_vif *vif, 2459 uint32_t active_links) 2460 { 2461 TODO(); 2462 return (-ENXIO); 2463 } 2464 2465 static inline void 2466 ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp __unused) 2467 { 2468 IMPROVE("we notify user space by a vap state change eventually"); 2469 linuxkpi_ieee80211_beacon_loss(vif); 2470 } 2471 2472 #define ieee80211_send_bar(_v, _r, _t, _s) \ 2473 linuxkpi_ieee80211_send_bar(_v, _r, _t, _s) 2474 2475 /* -------------------------------------------------------------------------- */ 2476 2477 int lkpi_80211_update_chandef(struct ieee80211_hw *, 2478 struct ieee80211_chanctx_conf *); 2479 2480 static inline int 2481 ieee80211_emulate_add_chanctx(struct ieee80211_hw *hw, 2482 struct ieee80211_chanctx_conf *chanctx_conf) 2483 { 2484 int error; 2485 2486 hw->conf.radar_enabled = chanctx_conf->radar_enabled; 2487 error = lkpi_80211_update_chandef(hw, chanctx_conf); 2488 return (error); 2489 } 2490 2491 static inline void 2492 ieee80211_emulate_remove_chanctx(struct ieee80211_hw *hw, 2493 struct ieee80211_chanctx_conf *chanctx_conf __unused) 2494 { 2495 hw->conf.radar_enabled = false; 2496 lkpi_80211_update_chandef(hw, NULL); 2497 } 2498 2499 static inline void 2500 ieee80211_emulate_change_chanctx(struct ieee80211_hw *hw, 2501 struct ieee80211_chanctx_conf *chanctx_conf, uint32_t changed __unused) 2502 { 2503 hw->conf.radar_enabled = chanctx_conf->radar_enabled; 2504 lkpi_80211_update_chandef(hw, chanctx_conf); 2505 } 2506 2507 static inline int 2508 ieee80211_emulate_switch_vif_chanctx(struct ieee80211_hw *hw, 2509 struct ieee80211_vif_chanctx_switch *vifs, int n_vifs, 2510 enum ieee80211_chanctx_switch_mode mode __unused) 2511 { 2512 struct ieee80211_chanctx_conf *chanctx_conf; 2513 int error; 2514 2515 /* Sanity check. */ 2516 if (n_vifs <= 0) 2517 return (-EINVAL); 2518 if (vifs == NULL || vifs[0].new_ctx == NULL) 2519 return (-EINVAL); 2520 2521 /* 2522 * What to do if n_vifs > 1? 2523 * Does that make sense for drivers not supporting chanctx? 2524 */ 2525 hw->conf.radar_enabled = vifs[0].new_ctx->radar_enabled; 2526 chanctx_conf = vifs[0].new_ctx; 2527 error = lkpi_80211_update_chandef(hw, chanctx_conf); 2528 return (error); 2529 } 2530 2531 /* -------------------------------------------------------------------------- */ 2532 2533 #endif /* _LINUXKPI_NET_MAC80211_H */ 2534