2 * Copyright (c) 2020-2023 The FreeBSD Foundation
3 * Copyright (c) 2020-2022 Bjoern A. Zeeb
5 * This software was developed by Björn Zeeb under sponsorship from
6 * the FreeBSD Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
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.
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
30 #ifndef _LINUXKPI_NET_MAC80211_H
31 #define _LINUXKPI_NET_MAC80211_H
33 #include <sys/types.h>
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>
45 #define ARPHRD_IEEE80211_RADIOTAP __LINE__ /* XXX TODO brcmfmac */
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)
53 #define IEEE80211_LINK_UNSPECIFIED 0x0f
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),
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),
72 #define CFG80211_TESTMODE_CMD(_x) /* XXX TODO */
73 #define CFG80211_TESTMODE_DUMP(_x) /* XXX TODO */
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),
83 FIF_OTHER_BSS = BIT(4),
88 enum ieee80211_bss_changed {
89 BSS_CHANGED_ARP_FILTER = BIT(0),
90 BSS_CHANGED_ASSOC = BIT(1),
91 BSS_CHANGED_BANDWIDTH = BIT(2),
92 BSS_CHANGED_BEACON = BIT(3),
93 BSS_CHANGED_BEACON_ENABLED = BIT(4),
94 BSS_CHANGED_BEACON_INFO = BIT(5),
95 BSS_CHANGED_BEACON_INT = BIT(6),
96 BSS_CHANGED_BSSID = BIT(7),
97 BSS_CHANGED_CQM = BIT(8),
98 BSS_CHANGED_ERP_CTS_PROT = BIT(9),
99 BSS_CHANGED_ERP_SLOT = BIT(10),
100 BSS_CHANGED_FTM_RESPONDER = BIT(11),
101 BSS_CHANGED_HT = BIT(12),
102 BSS_CHANGED_IDLE = BIT(13),
103 BSS_CHANGED_MU_GROUPS = BIT(14),
104 BSS_CHANGED_P2P_PS = BIT(15),
105 BSS_CHANGED_PS = BIT(16),
106 BSS_CHANGED_QOS = BIT(17),
107 BSS_CHANGED_TXPOWER = BIT(18),
108 BSS_CHANGED_HE_BSS_COLOR = BIT(19),
109 BSS_CHANGED_AP_PROBE_RESP = BIT(20),
110 BSS_CHANGED_BASIC_RATES = BIT(21),
111 BSS_CHANGED_ERP_PREAMBLE = BIT(22),
112 BSS_CHANGED_IBSS = BIT(23),
113 BSS_CHANGED_MCAST_RATE = BIT(24),
114 BSS_CHANGED_SSID = BIT(25),
115 BSS_CHANGED_FILS_DISCOVERY = BIT(26),
116 BSS_CHANGED_HE_OBSS_PD = BIT(27),
117 BSS_CHANGED_TWT = BIT(28),
118 BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = BIT(30),
119 BSS_CHANGED_EHT_PUNCTURING = BIT(31),
122 /* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */
123 #define WLAN_CIPHER_SUITE_OUI(_oui, _x) (((_oui) << 8) | ((_x) & 0xff))
125 /* 802.11 Table 9-131 Cipher suite selectors. */
126 /* 802.1x suite B 11 */
127 #define WLAN_CIPHER_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x)
129 #define WLAN_CIPHER_SUITE_WEP40 WLAN_CIPHER_SUITE(1)
130 #define WLAN_CIPHER_SUITE_TKIP WLAN_CIPHER_SUITE(2)
132 #define WLAN_CIPHER_SUITE_CCMP WLAN_CIPHER_SUITE(4) /* CCMP-128 */
133 #define WLAN_CIPHER_SUITE_WEP104 WLAN_CIPHER_SUITE(5)
134 #define WLAN_CIPHER_SUITE_AES_CMAC WLAN_CIPHER_SUITE(6) /* BIP-CMAC-128 */
135 /* Group addressed traffic not allowed 7 */
136 #define WLAN_CIPHER_SUITE_GCMP WLAN_CIPHER_SUITE(8)
137 #define WLAN_CIPHER_SUITE_GCMP_256 WLAN_CIPHER_SUITE(9)
138 #define WLAN_CIPHER_SUITE_CCMP_256 WLAN_CIPHER_SUITE(10)
139 #define WLAN_CIPHER_SUITE_BIP_GMAC_128 WLAN_CIPHER_SUITE(11)
140 #define WLAN_CIPHER_SUITE_BIP_GMAC_256 WLAN_CIPHER_SUITE(12)
141 #define WLAN_CIPHER_SUITE_BIP_CMAC_256 WLAN_CIPHER_SUITE(13)
142 /* Reserved 14-255 */
144 /* See ISO/IEC JTC 1 N 9880 Table 11 */
145 #define WLAN_CIPHER_SUITE_SMS4 WLAN_CIPHER_SUITE_OUI(0x001472, 1)
148 /* 802.11 Table 9-133 AKM suite selectors. */
149 #define WLAN_AKM_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x)
151 #define WLAN_AKM_SUITE_8021X WLAN_AKM_SUITE(1)
152 #define WLAN_AKM_SUITE_PSK WLAN_AKM_SUITE(2)
153 #define WLAN_AKM_SUITE_FT_8021X WLAN_AKM_SUITE(3)
154 #define WLAN_AKM_SUITE_FT_PSK WLAN_AKM_SUITE(4)
155 #define WLAN_AKM_SUITE_8021X_SHA256 WLAN_AKM_SUITE(5)
156 #define WLAN_AKM_SUITE_PSK_SHA256 WLAN_AKM_SUITE(6)
158 #define WLAN_AKM_SUITE_SAE WLAN_AKM_SUITE(8)
161 /* 802.1x suite B 11 */
162 /* 802.1x suite B 384 12 */
163 /* FTo802.1x 384 13 */
164 /* Reserved 14-255 */
165 /* Apparently 11ax defines more. Seen (19,20) mentioned. */
167 #define TKIP_PN_TO_IV16(_x) ((uint16_t)(_x & 0xffff))
168 #define TKIP_PN_TO_IV32(_x) ((uint32_t)((_x >> 16) & 0xffffffff))
170 struct ieee80211_sta;
172 /* 802.11-2020 9.4.2.55.3 A-MPDU Parameters field */
173 #define IEEE80211_HT_AMPDU_PARM_FACTOR 0x3
174 #define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2
175 #define IEEE80211_HT_AMPDU_PARM_DENSITY (0x7 << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT)
177 struct ieee80211_ampdu_params {
178 struct ieee80211_sta *sta;
179 enum ieee80211_ampdu_mlme_action action;
187 struct ieee80211_bar {
189 int control, start_seq_num;
191 uint16_t frame_control;
194 struct ieee80211_p2p_noa_desc {
195 uint32_t count; /* uint8_t ? */
201 struct ieee80211_p2p_noa_attr {
203 uint8_t oppps_ctwindow;
204 struct ieee80211_p2p_noa_desc desc[4];
207 struct ieee80211_mutable_offsets {
210 uint16_t cntdwn_counter_offs[2];
215 struct mac80211_fils_discovery {
216 uint32_t max_interval;
219 struct ieee80211_chanctx_conf {
221 int rx_chains_dynamic, rx_chains_static;
223 struct cfg80211_chan_def def;
224 struct cfg80211_chan_def min_def;
226 /* Must stay last. */
227 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
230 struct ieee80211_rate_status {
231 struct rate_info rate_idx;
235 struct ieee80211_ema_beacons {
239 struct ieee80211_mutable_offsets offs;
243 #define WLAN_MEMBERSHIP_LEN (8)
244 #define WLAN_USER_POSITION_LEN (16)
246 struct ieee80211_bss_conf {
248 struct ieee80211_vif *vif;
249 const uint8_t *bssid;
250 uint8_t addr[ETH_ALEN];
253 uint8_t transmitter_bssid[ETH_ALEN];
254 struct ieee80211_ftm_responder_params *ftmr_params;
255 struct ieee80211_p2p_noa_attr p2p_noa_attr;
256 struct cfg80211_chan_def chandef;
257 __be32 arp_addr_list[1]; /* XXX TODO */
258 struct ieee80211_rate *beacon_rate;
260 uint8_t membership[WLAN_MEMBERSHIP_LEN];
261 uint8_t position[WLAN_USER_POSITION_LEN];
265 /* single field struct? */
267 struct cfg80211_he_bss_color he_bss_color;
268 struct ieee80211_he_obss_pd he_obss_pd;
273 bool vht_mu_beamformee;
274 bool vht_mu_beamformer;
275 bool vht_su_beamformee;
276 bool vht_su_beamformer;
277 bool he_mu_beamformer;
278 bool he_su_beamformee;
279 bool he_su_beamformer;
280 bool he_full_ul_mumimo;
281 bool eht_su_beamformee;
282 bool eht_su_beamformer;
283 bool eht_mu_beamformer;
285 uint16_t ht_operation_mode;
287 uint16_t eht_puncturing;
290 uint8_t sync_dtim_count;
294 bool use_short_preamble;
300 uint32_t sync_device_ts;
304 uint32_t basic_rates;
305 int mcast_rate[NUM_NL80211_BANDS];
306 enum ieee80211_reg_ap_power power_type;
307 struct cfg80211_bitrate_mask beacon_tx_rate;
308 struct mac80211_fils_discovery fils_discovery;
309 struct ieee80211_chanctx_conf *chanctx_conf;
310 struct ieee80211_vif *mbssid_tx_vif;
312 int ack_enabled, bssid_index, bssid_indicator, cqm_rssi_hyst, cqm_rssi_thold, ema_ap, frame_time_rts_th, ftm_responder;
313 int htc_trig_based_pkt_ext;
314 int multi_sta_back_32bit, nontransmitted;
315 int profile_periodicity;
316 int twt_requester, uora_exists, uora_ocw_range;
317 int assoc_capability, enable_beacon, hidden_ssid, ibss_joined, twt_protected;
318 int twt_responder, unsol_bcast_probe_resp_interval;
319 int color_change_active;
322 struct ieee80211_channel_switch {
324 int block_tx, count, delay, device_timestamp, timestamp;
325 struct cfg80211_chan_def chandef;
328 struct ieee80211_cipher_scheme {
330 uint8_t iftype; /* We do not know the size of this. */
335 uint8_t key_idx_mask;
336 uint8_t key_idx_shift;
340 enum ieee80211_event_type {
347 enum ieee80211_rssi_event_data {
352 enum ieee80211_mlme_event_data {
359 enum ieee80211_mlme_event_status {
364 struct ieee80211_mlme_event {
365 enum ieee80211_mlme_event_data data;
366 enum ieee80211_mlme_event_status status;
370 struct ieee80211_event {
372 enum ieee80211_event_type type;
376 struct ieee80211_sta *sta;
379 struct ieee80211_mlme_event mlme;
383 struct ieee80211_ftm_responder_params {
391 struct ieee80211_he_mu_edca_param_ac_rec {
393 int aifsn, ecw_min_max, mu_edca_timer;
396 struct ieee80211_conf {
397 int dynamic_ps_timeout;
399 uint32_t listen_interval;
401 enum ieee80211_hw_conf_flags flags;
402 struct cfg80211_chan_def chandef;
405 enum ieee80211_hw_flags {
406 IEEE80211_HW_AMPDU_AGGREGATION,
407 IEEE80211_HW_AP_LINK_PS,
408 IEEE80211_HW_BUFF_MMPDU_TXQ,
409 IEEE80211_HW_CHANCTX_STA_CSA,
410 IEEE80211_HW_CONNECTION_MONITOR,
411 IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP,
412 IEEE80211_HW_HAS_RATE_CONTROL,
413 IEEE80211_HW_MFP_CAPABLE,
414 IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
415 IEEE80211_HW_REPORTS_TX_ACK_STATUS,
416 IEEE80211_HW_RX_INCLUDES_FCS,
417 IEEE80211_HW_SIGNAL_DBM,
418 IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,
419 IEEE80211_HW_SPECTRUM_MGMT,
420 IEEE80211_HW_STA_MMPDU_TXQ,
421 IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
422 IEEE80211_HW_SUPPORTS_CLONED_SKBS,
423 IEEE80211_HW_SUPPORTS_DYNAMIC_PS,
424 IEEE80211_HW_SUPPORTS_MULTI_BSSID,
425 IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
426 IEEE80211_HW_SUPPORTS_PS,
427 IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
428 IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
429 IEEE80211_HW_SUPPORT_FAST_XMIT,
430 IEEE80211_HW_TDLS_WIDER_BW,
431 IEEE80211_HW_TIMING_BEACON_ONLY,
432 IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
433 IEEE80211_HW_TX_AMSDU,
434 IEEE80211_HW_TX_FRAG_LIST,
435 IEEE80211_HW_USES_RSS,
436 IEEE80211_HW_WANT_MONITOR_VIF,
437 IEEE80211_HW_SW_CRYPTO_CONTROL,
438 IEEE80211_HW_SUPPORTS_TX_FRAG,
439 IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA,
440 IEEE80211_HW_SUPPORTS_PER_STA_GTK,
441 IEEE80211_HW_REPORTS_LOW_ACK,
442 IEEE80211_HW_QUEUE_CONTROL,
443 IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD,
444 IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD,
445 IEEE80211_HW_SUPPORTS_RC_TABLE,
446 IEEE80211_HW_DETECTS_COLOR_COLLISION,
449 NUM_IEEE80211_HW_FLAGS
452 struct ieee80211_hw {
457 int extra_tx_headroom, weight_multiplier;
458 int max_rate_tries, max_rates, max_report_rates;
459 struct ieee80211_cipher_scheme *cipher_schemes;
460 int n_cipher_schemes;
461 const char *rate_control_algorithm;
463 uint16_t units_pos; /* radiotap "spec" is .. inconsistent. */
465 } radiotap_timestamp;
466 size_t sta_data_size;
467 size_t vif_data_size;
468 size_t chanctx_data_size;
469 size_t txq_data_size;
470 uint16_t radiotap_mcs_details;
471 uint16_t radiotap_vht_details;
473 uint16_t offchannel_tx_hw_queue;
474 uint16_t uapsd_max_sp_len;
475 uint16_t uapsd_queues;
476 uint16_t max_rx_aggregation_subframes;
477 uint16_t max_tx_aggregation_subframes;
478 uint16_t max_tx_fragments;
479 uint16_t max_listen_interval;
480 uint32_t extra_beacon_tailroom;
481 netdev_features_t netdev_features;
482 unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];
483 struct ieee80211_conf conf;
485 #if 0 /* leave here for documentation purposes. This does NOT work. */
486 /* Must stay last. */
487 uint8_t priv[0] __aligned(CACHE_LINE_SIZE);
493 enum ieee802111_key_flag {
494 IEEE80211_KEY_FLAG_GENERATE_IV = BIT(0),
495 IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(1),
496 IEEE80211_KEY_FLAG_PAIRWISE = BIT(2),
497 IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(3),
498 IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(4),
499 IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(5),
500 IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(6),
501 IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(7),
502 IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(8),
505 struct ieee80211_key_conf {
508 uint8_t icv_len; /* __unused nowadays? */
510 uint8_t hw_key_idx; /* Set by drv. */
515 int8_t link_id; /* signed! */
518 struct ieee80211_key_seq {
522 uint8_t seq[IEEE80211_MAX_PN_LEN];
526 uint8_t pn[IEEE80211_CCMP_PN_LEN];
529 uint8_t pn[IEEE80211_CCMP_PN_LEN];
539 enum ieee80211_rx_status_flags {
540 RX_FLAG_ALLOW_SAME_PN = BIT(0),
541 RX_FLAG_AMPDU_DETAILS = BIT(1),
542 RX_FLAG_AMPDU_EOF_BIT = BIT(2),
543 RX_FLAG_AMPDU_EOF_BIT_KNOWN = BIT(3),
544 RX_FLAG_DECRYPTED = BIT(4),
545 RX_FLAG_DUP_VALIDATED = BIT(5),
546 RX_FLAG_FAILED_FCS_CRC = BIT(6),
547 RX_FLAG_ICV_STRIPPED = BIT(7),
548 RX_FLAG_MACTIME_PLCP_START = BIT(8),
549 RX_FLAG_MACTIME_START = BIT(9),
550 RX_FLAG_MIC_STRIPPED = BIT(10),
551 RX_FLAG_MMIC_ERROR = BIT(11),
552 RX_FLAG_MMIC_STRIPPED = BIT(12),
553 RX_FLAG_NO_PSDU = BIT(13),
554 RX_FLAG_PN_VALIDATED = BIT(14),
555 RX_FLAG_RADIOTAP_HE = BIT(15),
556 RX_FLAG_RADIOTAP_HE_MU = BIT(16),
557 RX_FLAG_RADIOTAP_LSIG = BIT(17),
558 RX_FLAG_RADIOTAP_VENDOR_DATA = BIT(18),
559 RX_FLAG_NO_SIGNAL_VAL = BIT(19),
560 RX_FLAG_IV_STRIPPED = BIT(20),
561 RX_FLAG_AMPDU_IS_LAST = BIT(21),
562 RX_FLAG_AMPDU_LAST_KNOWN = BIT(22),
563 RX_FLAG_AMSDU_MORE = BIT(23),
564 RX_FLAG_MACTIME_END = BIT(24),
565 RX_FLAG_ONLY_MONITOR = BIT(25),
566 RX_FLAG_SKIP_MONITOR = BIT(26),
567 RX_FLAG_8023 = BIT(27),
568 RX_FLAG_RADIOTAP_TLV_AT_END = BIT(28),
571 enum mac80211_rx_encoding {
579 struct ieee80211_rx_status {
580 /* TODO FIXME, this is too large. Over-reduce types to u8 where possible. */
582 uint64_t boottime_ns;
583 int64_t ack_tx_hwtstamp;
586 uint32_t device_timestamp;
587 enum ieee80211_rx_status_flags flag;
589 uint8_t encoding:3, bw:4; /* enum mac80211_rx_encoding, rate_info_bw */ /* See mt76.h */
590 uint8_t ampdu_reference;
593 int8_t chain_signal[IEEE80211_MAX_CHAINS];
598 uint8_t he_ru:3; /* nl80211::enum nl80211_he_ru_alloc */
599 uint8_t he_gi:2; /* nl80211::enum nl80211_he_gi */
603 uint8_t ru:4; /* nl80211::enum nl80211_eht_ru_alloc */
604 uint8_t gi:2; /* nl80211::enum nl80211_eht_gi */
608 uint8_t link_id; /* very incosistent sizes? */
609 uint8_t zero_length_psdu_type;
614 struct ieee80211_tx_status {
615 struct ieee80211_sta *sta;
616 struct ieee80211_tx_info *info;
617 int64_t ack_hwtstamp;
620 struct ieee80211_rate_status *rates;
623 struct list_head *free_list;
626 struct ieee80211_scan_ies {
629 int len[NUM_NL80211_BANDS];
631 uint8_t *ies[NUM_NL80211_BANDS];
634 struct ieee80211_scan_request {
635 struct ieee80211_scan_ies ies;
636 struct cfg80211_scan_request req;
639 struct ieee80211_txq {
640 struct ieee80211_sta *sta;
641 struct ieee80211_vif *vif;
645 /* Must stay last. */
646 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
649 struct ieee80211_sta_rates {
651 /* XXX some _rcu thing */
655 } rate[1]; /* XXX what is the real number? */
658 struct ieee80211_sta_txpwr {
660 enum nl80211_tx_power_setting type;
664 #define IEEE80211_NUM_TIDS 16 /* net80211::WME_NUM_TID */
665 struct ieee80211_sta_agg {
666 uint16_t max_amsdu_len;
667 uint16_t max_rc_amsdu_len;
668 uint16_t max_tid_amsdu_len[IEEE80211_NUM_TIDS];
671 struct ieee80211_link_sta {
672 uint8_t addr[ETH_ALEN];
674 uint32_t supp_rates[NUM_NL80211_BANDS];
675 struct ieee80211_sta_ht_cap ht_cap;
676 struct ieee80211_sta_vht_cap vht_cap;
677 struct ieee80211_sta_he_cap he_cap;
678 struct ieee80211_sta_he_6ghz_capa he_6ghz_capa;
679 struct ieee80211_sta_eht_cap eht_cap;
681 enum ieee80211_sta_rx_bw bandwidth;
682 enum ieee80211_smps_mode smps_mode;
683 struct ieee80211_sta_agg agg;
684 struct ieee80211_sta_txpwr txpwr;
687 struct ieee80211_sta {
689 int max_amsdu_subframes;
690 int mfp, smps_mode, tdls, tdls_initiator;
691 struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; /* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */
692 struct ieee80211_sta_rates *rates; /* some rcu thing? */
693 uint8_t addr[ETH_ALEN];
697 uint8_t uapsd_queues;
698 uint16_t valid_links;
700 struct ieee80211_link_sta deflink;
701 struct ieee80211_link_sta *link[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */
703 /* Must stay last. */
704 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
707 struct ieee80211_tdls_ch_sw_params {
709 int action_code, ch_sw_tm_ie, status, switch_time, switch_timeout, timestamp;
710 struct ieee80211_sta *sta;
711 struct cfg80211_chan_def *chandef;
712 struct sk_buff *tmpl_skb;
715 struct ieee80211_tx_control {
717 struct ieee80211_sta *sta;
720 struct ieee80211_tx_queue_params {
721 /* These types are based on iwlwifi FW structs. */
728 int acm, mu_edca, uapsd;
729 struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec;
732 struct ieee80211_tx_rate {
738 enum ieee80211_vif_driver_flags {
739 IEEE80211_VIF_BEACON_FILTER = BIT(0),
740 IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),
741 IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2),
742 IEEE80211_VIF_DISABLE_SMPS_OVERRIDE = BIT(3),
745 #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
747 struct ieee80211_vif_cfg {
750 uint16_t eml_med_sync_delay;
757 uint32_t arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; /* big endian */
758 uint8_t ssid[IEEE80211_NWID_LEN];
759 uint8_t ap_addr[ETH_ALEN];
762 struct ieee80211_vif {
764 enum nl80211_iftype type;
765 int csa_active, mu_mimo_owner;
767 int color_change_active, offload_flags;
768 enum ieee80211_vif_driver_flags driver_flags;
771 uint8_t addr[ETH_ALEN];
772 struct ieee80211_vif_cfg cfg;
773 struct ieee80211_chanctx_conf *chanctx_conf;
774 struct ieee80211_txq *txq;
775 struct ieee80211_bss_conf bss_conf;
776 struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */
777 uint8_t hw_queue[IEEE80211_NUM_ACS];
778 uint16_t active_links;
779 uint16_t valid_links;
780 struct ieee80211_vif *mbssid_tx_vif;
782 /* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change structure depending on compile-time option. */
783 struct dentry *debugfs_dir;
786 /* Must stay last. */
787 uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);
790 struct ieee80211_vif_chanctx_switch {
791 struct ieee80211_chanctx_conf *old_ctx, *new_ctx;
792 struct ieee80211_vif *vif;
793 struct ieee80211_bss_conf *link_conf;
796 struct ieee80211_prep_tx_info {
801 /* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */
802 /* Also warning: some sizes change by pointer size! This is 64bit only. */
803 struct ieee80211_tx_info {
804 enum ieee80211_tx_info_flags flags;
811 struct ieee80211_tx_rate rates[4];
813 struct ieee80211_vif *vif;
814 struct ieee80211_key_conf *hw_key;
815 enum ieee80211_tx_control_flags flags;
818 struct ieee80211_tx_rate rates[4];
820 uint8_t ampdu_ack_len;
825 void *status_driver_data[16 / sizeof(void *)]; /* XXX TODO */
827 #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
828 void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
832 /* net80211 conflict */
833 struct linuxkpi_ieee80211_tim_ie {
837 uint8_t *virtual_map;
839 #define ieee80211_tim_ie linuxkpi_ieee80211_tim_ie
841 struct survey_info { /* net80211::struct ieee80211_channel_survey */
844 #define SURVEY_INFO_TIME 0x0001
845 #define SURVEY_INFO_TIME_RX 0x0002
846 #define SURVEY_INFO_TIME_SCAN 0x0004
847 #define SURVEY_INFO_TIME_TX 0x0008
848 #define SURVEY_INFO_TIME_BSS_RX 0x0010
849 #define SURVEY_INFO_TIME_BUSY 0x0020
850 #define SURVEY_INFO_IN_USE 0x0040
851 #define SURVEY_INFO_NOISE_DBM 0x0080
854 uint64_t time_bss_rx;
859 struct ieee80211_channel *channel;
862 enum ieee80211_iface_iter {
863 IEEE80211_IFACE_ITER_NORMAL = BIT(0),
864 IEEE80211_IFACE_ITER_RESUME_ALL = BIT(1),
865 IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2), /* seems to be an iter flag */
866 IEEE80211_IFACE_ITER_ACTIVE = BIT(3),
868 /* Internal flags only. */
869 IEEE80211_IFACE_ITER__ATOMIC = BIT(6),
870 IEEE80211_IFACE_ITER__MTX = BIT(8),
878 /* 802.11-2020, 9.4.2.55.2 HT Capability Information field. */
880 RX_ENC_FLAG_SHORTPRE = BIT(0),
881 RX_ENC_FLAG_SHORT_GI = BIT(2),
882 RX_ENC_FLAG_HT_GF = BIT(3),
883 RX_ENC_FLAG_STBC_MASK = BIT(4) | BIT(5),
884 #define RX_ENC_FLAG_STBC_SHIFT 4
885 RX_ENC_FLAG_LDPC = BIT(6),
886 RX_ENC_FLAG_BF = BIT(7),
889 enum sta_notify_cmd {
894 struct ieee80211_low_level_stats {
895 /* Can we make them uint64_t? */
896 uint32_t dot11ACKFailureCount;
897 uint32_t dot11FCSErrorCount;
898 uint32_t dot11RTSFailureCount;
899 uint32_t dot11RTSSuccessCount;
902 enum ieee80211_offload_flags {
903 IEEE80211_OFFLOAD_ENCAP_4ADDR,
904 IEEE80211_OFFLOAD_ENCAP_ENABLED,
905 IEEE80211_OFFLOAD_DECAP_ENABLED,
908 struct ieee80211_ops {
910 int (*start)(struct ieee80211_hw *);
911 void (*stop)(struct ieee80211_hw *);
913 int (*config)(struct ieee80211_hw *, u32);
914 void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type);
916 int (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *);
917 void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *);
918 int (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool);
920 void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *);
921 void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *);
922 int (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *);
923 int (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *);
924 int (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *);
925 void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *);
927 int (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u16, const struct ieee80211_tx_queue_params *);
928 void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *);
929 int (*tx_last_beacon)(struct ieee80211_hw *);
930 void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *);
932 void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);
933 void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);
934 void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *);
936 void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool);
937 void (*flush_sta)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
939 int (*set_frag_threshold)(struct ieee80211_hw *, u32);
941 void (*sync_rx_queues)(struct ieee80211_hw *);
943 void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);
944 void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);
946 int (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
947 int (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
948 int (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
949 void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *);
950 void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
951 int (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state);
952 void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *);
953 void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32);
954 void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
955 void (*sta_set_4addr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);
956 void (*sta_set_decap_offload)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);
958 u64 (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *);
960 int (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *);
962 bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *);
964 int (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
965 int (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *);
966 void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
967 void (*channel_switch_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_chan_def *);
968 void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *);
969 void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);
970 int (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32);
971 void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);
972 void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *);
974 int (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
975 void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);
976 void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32);
977 int (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
978 void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);
979 int (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode);
981 int (*get_antenna)(struct ieee80211_hw *, u32 *, u32 *);
982 int (*set_antenna)(struct ieee80211_hw *, u32, u32);
984 int (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type);
985 int (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *);
987 void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64);
988 void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int);
990 void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);
991 void (*link_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);
993 int (*set_rts_threshold)(struct ieee80211_hw *, u32);
994 void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *);
995 int (*get_survey)(struct ieee80211_hw *, int, struct survey_info *);
996 int (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *);
998 uint64_t (*get_tsf)(struct ieee80211_hw *, struct ieee80211_vif *);
999 void (*set_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, uint64_t);
1000 void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64);
1002 int (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *);
1003 void (*set_coverage_class)(struct ieee80211_hw *, s16);
1004 int (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool);
1006 int (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *);
1007 void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int);
1008 void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *);
1009 void (*set_rekey_data)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_gtk_rekey_data *);
1011 int (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);
1012 void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);
1014 int (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);
1015 void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);
1016 int (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
1017 void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);
1019 int (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *);
1021 int (*set_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct cfg80211_tid_config *);
1022 int (*reset_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8);
1024 int (*get_et_sset_count)(struct ieee80211_hw *, struct ieee80211_vif *, int);
1025 void (*get_et_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct ethtool_stats *, u64 *);
1026 void (*get_et_strings)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u8 *);
1028 void (*update_vif_offload)(struct ieee80211_hw *, struct ieee80211_vif *);
1030 int (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, int *);
1031 int (*get_stats)(struct ieee80211_hw *, struct ieee80211_low_level_stats *);
1033 int (*set_radar_background)(struct ieee80211_hw *, struct cfg80211_chan_def *);
1035 void (*add_twt_setup)(struct ieee80211_hw *, struct ieee80211_sta *, struct ieee80211_twt_setup *);
1036 void (*twt_teardown_request)(struct ieee80211_hw *, struct ieee80211_sta *, u8);
1038 int (*set_hw_timestamp)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_set_hw_timestamp *);
1040 void (*vif_cfg_changed)(struct ieee80211_hw *, struct ieee80211_vif *, u64);
1042 int (*change_vif_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16, u16, struct ieee80211_bss_conf *[IEEE80211_MLD_MAX_NUM_LINKS]);
1043 int (*change_sta_links)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u16, u16);
1045 /* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change depending on compile-time option. */
1046 void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *);
1051 /* -------------------------------------------------------------------------- */
1054 extern const struct cfg80211_ops linuxkpi_mac80211cfgops;
1056 struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t,
1057 const struct ieee80211_ops *);
1058 void linuxkpi_ieee80211_iffree(struct ieee80211_hw *);
1059 void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *, char *);
1060 int linuxkpi_ieee80211_ifattach(struct ieee80211_hw *);
1061 void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *);
1062 void linuxkpi_ieee80211_unregister_hw(struct ieee80211_hw *);
1063 struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *);
1064 void linuxkpi_ieee80211_restart_hw(struct ieee80211_hw *);
1065 void linuxkpi_ieee80211_iterate_interfaces(
1066 struct ieee80211_hw *hw, enum ieee80211_iface_iter flags,
1067 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1069 void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *,
1070 struct ieee80211_vif *,
1071 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1072 struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1074 void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *,
1075 void(*iterfunc)(struct ieee80211_hw *,
1076 struct ieee80211_chanctx_conf *, void *),
1078 void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *,
1079 void (*iterfunc)(void *, struct ieee80211_sta *), void *);
1080 void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *,
1081 struct cfg80211_scan_info *);
1082 void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *,
1083 struct ieee80211_sta *, struct napi_struct *, struct list_head *);
1084 uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool);
1085 struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *,
1087 struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr(
1088 struct ieee80211_hw *, const uint8_t *, const uint8_t *);
1089 struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *,
1090 struct ieee80211_txq *);
1091 bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t);
1092 bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t);
1093 void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *,
1095 void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *,
1096 struct delayed_work *, int);
1097 void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *);
1098 struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *,
1099 struct ieee80211_vif *);
1100 struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *,
1101 struct ieee80211_vif *, int, bool);
1102 void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, unsigned long *,
1104 struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);
1105 void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);
1106 void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *);
1107 struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *,
1108 uint8_t *, uint8_t *, size_t, size_t);
1109 void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *);
1110 void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *,
1111 struct ieee80211_tx_status *);
1112 void linuxkpi_ieee80211_stop_queues(struct ieee80211_hw *);
1113 void linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *);
1114 void linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *, int);
1115 void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *, int);
1116 void linuxkpi_ieee80211_txq_schedule_start(struct ieee80211_hw *, uint8_t);
1117 struct ieee80211_txq *linuxkpi_ieee80211_next_txq(struct ieee80211_hw *, uint8_t);
1118 void linuxkpi_ieee80211_schedule_txq(struct ieee80211_hw *,
1119 struct ieee80211_txq *, bool);
1121 /* -------------------------------------------------------------------------- */
1123 static __inline void
1124 _ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)
1127 set_bit(flag, hw->flags);
1130 static __inline bool
1131 __ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)
1134 return (test_bit(flag, hw->flags));
1137 /* They pass in shortened flag names; how confusingly inconsistent. */
1138 #define ieee80211_hw_set(_hw, _flag) \
1139 _ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag)
1140 #define ieee80211_hw_check(_hw, _flag) \
1141 __ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag)
1143 /* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */
1144 CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb));
1145 #define IEEE80211_SKB_CB(_skb) \
1146 ((struct ieee80211_tx_info *)((_skb)->cb))
1148 CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb));
1149 #define IEEE80211_SKB_RXCB(_skb) \
1150 ((struct ieee80211_rx_status *)((_skb)->cb))
1152 static __inline void
1153 ieee80211_free_hw(struct ieee80211_hw *hw)
1156 linuxkpi_ieee80211_iffree(hw);
1158 if (hw->wiphy != NULL)
1159 wiphy_free(hw->wiphy);
1160 /* Note that *hw is not valid any longer after this. */
1165 static __inline struct ieee80211_hw *
1166 ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops)
1169 return (linuxkpi_ieee80211_alloc_hw(priv_len, ops));
1172 static __inline void
1173 SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
1176 set_wiphy_dev(hw->wiphy, dev);
1177 linuxkpi_set_ieee80211_dev(hw, dev_name(dev));
1183 ieee80211_register_hw(struct ieee80211_hw *hw)
1187 error = wiphy_register(hw->wiphy);
1192 * At this point the driver has set all the options, flags, bands,
1193 * ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy
1195 * We need to replicate a lot of information from here into net80211.
1197 error = linuxkpi_ieee80211_ifattach(hw);
1205 ieee80211_unregister_hw(struct ieee80211_hw *hw)
1208 linuxkpi_ieee80211_unregister_hw(hw);
1211 static __inline struct ieee80211_hw *
1212 wiphy_to_ieee80211_hw(struct wiphy *wiphy)
1215 return (linuxkpi_wiphy_to_ieee80211_hw(wiphy));
1219 ieee80211_restart_hw(struct ieee80211_hw *hw)
1221 linuxkpi_ieee80211_restart_hw(hw);
1225 ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif)
1230 /* -------------------------------------------------------------------------- */
1232 #define link_conf_dereference_check(_vif, _linkid) \
1233 rcu_dereference_check((_vif)->link_conf[_linkid], true)
1235 #define link_conf_dereference_protected(_vif, _linkid) \
1236 rcu_dereference_protected((_vif)->link_conf[_linkid], true)
1238 #define link_sta_dereference_check(_sta, _linkid) \
1239 rcu_dereference_check((_sta)->link[_linkid], true)
1241 #define link_sta_dereference_protected(_sta, _linkid) \
1242 rcu_dereference_protected((_sta)->link[_linkid], true)
1244 #define for_each_vif_active_link(_vif, _link, _linkid) \
1245 for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++) \
1246 if ( ((_vif)->active_links == 0 /* no MLO */ || \
1247 ((_vif)->active_links & BIT(_linkid)) != 0) && \
1248 (_link = rcu_dereference((_vif)->link_conf[_linkid])) )
1250 #define for_each_sta_active_link(_vif, _sta, _linksta, _linkid) \
1251 for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++) \
1252 if ( ((_vif)->active_links == 0 /* no MLO */ || \
1253 ((_vif)->active_links & BIT(_linkid)) != 0) && \
1254 (_linksta = link_sta_dereference_protected((_sta), (_linkid))) )
1256 /* -------------------------------------------------------------------------- */
1258 static __inline bool
1259 ieee80211_is_action(__le16 fc)
1263 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1264 v = htole16(IEEE80211_FC0_SUBTYPE_ACTION | IEEE80211_FC0_TYPE_MGT);
1269 static __inline bool
1270 ieee80211_is_probe_resp(__le16 fc)
1274 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1275 v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_RESP | IEEE80211_FC0_TYPE_MGT);
1280 static __inline bool
1281 ieee80211_is_auth(__le16 fc)
1285 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1286 v = htole16(IEEE80211_FC0_SUBTYPE_AUTH | IEEE80211_FC0_TYPE_MGT);
1291 static __inline bool
1292 ieee80211_is_assoc_req(__le16 fc)
1296 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1297 v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_REQ | IEEE80211_FC0_TYPE_MGT);
1302 static __inline bool
1303 ieee80211_is_assoc_resp(__le16 fc)
1307 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1308 v = htole16(IEEE80211_FC0_SUBTYPE_ASSOC_RESP | IEEE80211_FC0_TYPE_MGT);
1313 static __inline bool
1314 ieee80211_is_reassoc_req(__le16 fc)
1318 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1319 v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_REQ | IEEE80211_FC0_TYPE_MGT);
1324 static __inline bool
1325 ieee80211_is_reassoc_resp(__le16 fc)
1329 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1330 v = htole16(IEEE80211_FC0_SUBTYPE_REASSOC_RESP | IEEE80211_FC0_TYPE_MGT);
1335 static __inline bool
1336 ieee80211_is_disassoc(__le16 fc)
1340 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1341 v = htole16(IEEE80211_FC0_SUBTYPE_DISASSOC | IEEE80211_FC0_TYPE_MGT);
1346 static __inline bool
1347 ieee80211_is_data_present(__le16 fc)
1351 /* If it is a data frame and NODATA is not present. */
1352 fc &= htole16(IEEE80211_FC0_TYPE_MASK | IEEE80211_FC0_SUBTYPE_NODATA);
1353 v = htole16(IEEE80211_FC0_TYPE_DATA);
1358 static __inline bool
1359 ieee80211_is_deauth(__le16 fc)
1363 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1364 v = htole16(IEEE80211_FC0_SUBTYPE_DEAUTH | IEEE80211_FC0_TYPE_MGT);
1369 static __inline bool
1370 ieee80211_is_beacon(__le16 fc)
1375 * For as much as I get it this comes in LE and unlike FreeBSD
1376 * where we get the entire frame header and u8[], here we get the
1377 * 9.2.4.1 Frame Control field only. Mask and compare.
1379 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1380 v = htole16(IEEE80211_FC0_SUBTYPE_BEACON | IEEE80211_FC0_TYPE_MGT);
1386 static __inline bool
1387 ieee80211_is_probe_req(__le16 fc)
1391 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1392 v = htole16(IEEE80211_FC0_SUBTYPE_PROBE_REQ | IEEE80211_FC0_TYPE_MGT);
1397 static __inline bool
1398 ieee80211_has_protected(__le16 fc)
1401 return (fc & htole16(IEEE80211_FC1_PROTECTED << 8));
1404 static __inline bool
1405 ieee80211_is_back_req(__le16 fc)
1409 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1410 v = htole16(IEEE80211_FC0_SUBTYPE_BAR | IEEE80211_FC0_TYPE_CTL);
1415 static __inline bool
1416 ieee80211_is_bufferable_mmpdu(struct sk_buff *skb)
1418 struct ieee80211_mgmt *mgmt;
1421 mgmt = (struct ieee80211_mgmt *)skb->data;
1422 fc = mgmt->frame_control;
1424 /* 11.2.2 Bufferable MMPDUs, 80211-2020. */
1425 /* XXX we do not care about IBSS yet. */
1427 if (!ieee80211_is_mgmt(fc))
1429 if (ieee80211_is_action(fc)) /* XXX FTM? */
1430 return (true); /* XXX false? */
1431 if (ieee80211_is_disassoc(fc))
1433 if (ieee80211_is_deauth(fc))
1441 static __inline bool
1442 ieee80211_is_nullfunc(__le16 fc)
1446 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1447 v = htole16(IEEE80211_FC0_SUBTYPE_NODATA | IEEE80211_FC0_TYPE_DATA);
1452 static __inline bool
1453 ieee80211_is_qos_nullfunc(__le16 fc)
1457 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1458 v = htole16(IEEE80211_FC0_SUBTYPE_QOS_NULL | IEEE80211_FC0_TYPE_DATA);
1463 static __inline bool
1464 ieee80211_is_any_nullfunc(__le16 fc)
1467 return (ieee80211_is_nullfunc(fc) || ieee80211_is_qos_nullfunc(fc));
1471 ieee80211_is_pspoll(__le16 fc)
1475 fc &= htole16(IEEE80211_FC0_SUBTYPE_MASK | IEEE80211_FC0_TYPE_MASK);
1476 v = htole16(IEEE80211_FC0_SUBTYPE_PS_POLL | IEEE80211_FC0_TYPE_CTL);
1481 static __inline bool
1482 ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1488 static __inline bool
1489 ieee80211_is_frag(struct ieee80211_hdr *hdr)
1495 static __inline bool
1496 ieee80211_is_first_frag(__le16 fc)
1502 static __inline bool
1503 ieee80211_is_robust_mgmt_frame(struct sk_buff *skb)
1509 static __inline bool
1510 ieee80211_is_ftm(struct sk_buff *skb)
1516 static __inline bool
1517 ieee80211_is_timing_measurement(struct sk_buff *skb)
1523 static __inline bool
1524 ieee80211_has_pm(__le16 fc)
1530 static __inline bool
1531 ieee80211_has_a4(__le16 fc)
1535 fc &= htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8);
1536 v = htole16((IEEE80211_FC1_DIR_TODS | IEEE80211_FC1_DIR_FROMDS) << 8);
1541 static __inline bool
1542 ieee80211_has_order(__le16 fc)
1545 return (fc & htole16(IEEE80211_FC1_ORDER << 8));
1548 static __inline bool
1549 ieee80211_has_retry(__le16 fc)
1552 return (fc & htole16(IEEE80211_FC1_RETRY << 8));
1556 static __inline bool
1557 ieee80211_has_fromds(__le16 fc)
1560 return (fc & htole16(IEEE80211_FC1_DIR_FROMDS << 8));
1563 static __inline bool
1564 ieee80211_has_tods(__le16 fc)
1567 return (fc & htole16(IEEE80211_FC1_DIR_TODS << 8));
1570 static __inline uint8_t *
1571 ieee80211_get_SA(struct ieee80211_hdr *hdr)
1574 if (ieee80211_has_a4(hdr->frame_control))
1575 return (hdr->addr4);
1576 if (ieee80211_has_fromds(hdr->frame_control))
1577 return (hdr->addr3);
1578 return (hdr->addr2);
1581 static __inline uint8_t *
1582 ieee80211_get_DA(struct ieee80211_hdr *hdr)
1585 if (ieee80211_has_tods(hdr->frame_control))
1586 return (hdr->addr3);
1587 return (hdr->addr1);
1590 static __inline bool
1591 ieee80211_has_morefrags(__le16 fc)
1594 fc &= htole16(IEEE80211_FC1_MORE_FRAG << 8);
1598 static __inline u8 *
1599 ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
1601 if (ieee80211_has_a4(hdr->frame_control))
1602 return (u8 *)hdr + 30;
1604 return (u8 *)hdr + 24;
1607 /* -------------------------------------------------------------------------- */
1608 /* Receive functions (air/driver to mac80211/net80211). */
1611 static __inline void
1612 ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1613 struct sk_buff *skb, struct napi_struct *napi)
1616 linuxkpi_ieee80211_rx(hw, skb, sta, napi, NULL);
1619 static __inline void
1620 ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
1621 struct sk_buff *skb, struct list_head *list)
1624 linuxkpi_ieee80211_rx(hw, skb, sta, NULL, list);
1627 static __inline void
1628 ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
1631 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1634 static __inline void
1635 ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
1638 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1641 static __inline void
1642 ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
1645 linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);
1648 /* -------------------------------------------------------------------------- */
1651 ieee80211_stop_queues(struct ieee80211_hw *hw)
1653 linuxkpi_ieee80211_stop_queues(hw);
1657 ieee80211_wake_queues(struct ieee80211_hw *hw)
1659 linuxkpi_ieee80211_wake_queues(hw);
1663 ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum)
1665 linuxkpi_ieee80211_stop_queue(hw, qnum);
1669 ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum)
1671 linuxkpi_ieee80211_wake_queue(hw, qnum);
1675 ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
1677 linuxkpi_ieee80211_schedule_txq(hw, txq, true);
1681 ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
1684 linuxkpi_ieee80211_schedule_txq(hw, txq, true);
1688 ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac)
1690 linuxkpi_ieee80211_txq_schedule_start(hw, ac);
1694 ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac)
1699 static inline struct ieee80211_txq *
1700 ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac)
1702 return (linuxkpi_ieee80211_next_txq(hw, ac));
1706 ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,
1707 struct ieee80211_txq *txq)
1712 /* -------------------------------------------------------------------------- */
1714 static __inline uint8_t
1715 ieee80211_get_tid(struct ieee80211_hdr *hdr)
1718 return (linuxkpi_ieee80211_get_tid(hdr, false));
1721 static __inline struct sk_buff *
1722 ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1723 uint16_t *tim_offset, uint16_t *tim_len, uint32_t link_id)
1726 if (tim_offset != NULL)
1728 if (tim_len != NULL)
1734 static __inline void
1735 ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
1736 enum ieee80211_iface_iter flags,
1737 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1741 flags |= IEEE80211_IFACE_ITER__ATOMIC;
1742 flags |= IEEE80211_IFACE_ITER_ACTIVE;
1743 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1746 static __inline void
1747 ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
1748 enum ieee80211_iface_iter flags,
1749 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1753 flags |= IEEE80211_IFACE_ITER_ACTIVE;
1754 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1757 static __inline void
1758 ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,
1759 enum ieee80211_iface_iter flags,
1760 void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1763 flags |= IEEE80211_IFACE_ITER_ACTIVE;
1764 flags |= IEEE80211_IFACE_ITER__MTX;
1765 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1768 static __inline void
1769 ieee80211_iterate_interfaces(struct ieee80211_hw *hw,
1770 enum ieee80211_iface_iter flags,
1771 void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),
1775 linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);
1778 static __inline void
1779 ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1780 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1781 struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1785 linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg);
1788 static __inline void
1789 ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
1790 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,
1791 struct ieee80211_sta *, struct ieee80211_key_conf *, void *),
1795 IMPROVE(); /* "rcu" */
1796 linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg);
1799 static __inline void
1800 ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw,
1801 void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *),
1805 linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg);
1808 static __inline void
1809 ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
1810 void (*iterfunc)(void *, struct ieee80211_sta *), void *arg)
1813 linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg);
1816 static __inline struct wireless_dev *
1817 ieee80211_vif_to_wdev(struct ieee80211_vif *vif)
1820 return (linuxkpi_ieee80211_vif_to_wdev(vif));
1823 static __inline struct sk_buff *
1824 ieee80211_beacon_get_template(struct ieee80211_hw *hw,
1825 struct ieee80211_vif *vif, struct ieee80211_mutable_offsets *offs,
1832 static __inline void
1833 ieee80211_beacon_loss(struct ieee80211_vif *vif)
1835 linuxkpi_ieee80211_beacon_loss(vif);
1838 static __inline void
1839 ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t)
1844 static __inline bool
1845 ieee80211_csa_is_complete(struct ieee80211_vif *vif)
1851 static __inline void
1852 ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter)
1858 ieee80211_csa_update_counter(struct ieee80211_vif *vif)
1864 static __inline void
1865 ieee80211_csa_finish(struct ieee80211_vif *vif)
1870 static __inline enum nl80211_iftype
1871 ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
1874 /* If we are not p2p enabled, just return the type. */
1878 /* If we are p2p, depending on side, return type. */
1879 switch (vif->type) {
1880 case NL80211_IFTYPE_AP:
1881 return (NL80211_IFTYPE_P2P_GO);
1882 case NL80211_IFTYPE_STATION:
1883 return (NL80211_IFTYPE_P2P_CLIENT);
1890 static __inline unsigned long
1891 ieee80211_tu_to_usec(unsigned long tu)
1894 return (tu * IEEE80211_DUR_TU);
1898 * Below we assume that the two values from different emums are the same.
1899 * Make sure this does not accidentally change.
1901 CTASSERT((int)IEEE80211_ACTION_SM_TPCREP == (int)IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP);
1903 static __inline bool
1904 ieee80211_action_contains_tpc(struct sk_buff *skb)
1906 struct ieee80211_mgmt *mgmt;
1908 mgmt = (struct ieee80211_mgmt *)skb->data;
1910 /* Check that this is a mgmt/action frame? */
1911 if (!ieee80211_is_action(mgmt->frame_control))
1915 * This is a bit convoluted but according to docs both actions
1916 * are checked for this. Kind-of makes sense for the only consumer
1917 * (iwlwifi) I am aware off given the txpower fields are at the
1918 * same location so firmware can update the value.
1920 /* 80211-2020 9.6.2 Spectrum Management Action frames */
1921 /* 80211-2020 9.6.2.5 TPC Report frame format */
1922 /* 80211-2020 9.6.6 Radio Measurement action details */
1923 /* 80211-2020 9.6.6.4 Link Measurement Report frame format */
1924 /* Check that it is Spectrum Management or Radio Measurement? */
1925 if (mgmt->u.action.category != IEEE80211_ACTION_CAT_SM &&
1926 mgmt->u.action.category != IEEE80211_ACTION_CAT_RADIO_MEASUREMENT)
1930 * Check that it is TPC Report or Link Measurement Report?
1931 * The values of each are the same (see CTASSERT above function).
1933 if (mgmt->u.action.u.tpc_report.spec_mgmt != IEEE80211_ACTION_SM_TPCREP)
1936 /* 80211-2020 9.4.2.16 TPC Report element */
1937 /* Check that the ELEMID and length are correct? */
1938 if (mgmt->u.action.u.tpc_report.tpc_elem_id != IEEE80211_ELEMID_TPCREP ||
1939 mgmt->u.action.u.tpc_report.tpc_elem_length != 4)
1942 /* All the right fields in the right place. */
1946 static __inline void
1947 ieee80211_connection_loss(struct ieee80211_vif *vif)
1950 linuxkpi_ieee80211_connection_loss(vif);
1953 static __inline struct ieee80211_sta *
1954 ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer)
1957 return (linuxkpi_ieee80211_find_sta(vif, peer));
1960 static __inline struct ieee80211_sta *
1961 ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const uint8_t *addr,
1962 const uint8_t *ourvifaddr)
1965 return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr));
1969 static __inline void
1970 ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
1971 struct sk_buff *skb_frag, u8 *key)
1976 static __inline void
1977 ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
1978 const u8 *addr, uint32_t iv32, u16 *p1k)
1981 KASSERT(keyconf != NULL && addr != NULL && p1k != NULL,
1982 ("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k));
1985 memset(p1k, 0xfa, 5 * sizeof(*p1k)); /* Just initializing. */
1988 static __inline size_t
1989 ieee80211_ie_split(const u8 *ies, size_t ies_len,
1990 const u8 *ie_ids, size_t ie_ids_len, size_t start)
1996 /* XXX FIXME, we need to deal with "Element ID Extension" */
1997 while (x < ies_len) {
1999 /* Is this IE[s] one of the ie_ids? */
2000 if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x],
2001 ie_ids, ie_ids_len))
2004 if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len))
2011 static __inline void
2012 ieee80211_request_smps(struct ieee80211_vif *vif, u_int link_id,
2013 enum ieee80211_smps_mode smps)
2015 static const char *smps_mode_name[] = {
2023 if (linuxkpi_debug_80211 & D80211_TODO)
2024 printf("%s:%d: XXX LKPI80211 TODO smps %d %s\n",
2025 __func__, __LINE__, smps, smps_mode_name[smps]);
2028 static __inline void
2029 ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr,
2030 enum nl80211_tdls_operation oper, enum ieee80211_reason_code code,
2036 static __inline void
2037 wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state)
2042 static __inline void
2043 ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb)
2048 * This is called on transmit failure.
2049 * Use a not-so-random random high status error so we can distinguish
2050 * it from normal low values flying around in net80211 ("ETX").
2052 linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458);
2055 static __inline void
2056 ieee80211_ready_on_channel(struct ieee80211_hw *hw)
2059 /* XXX-BZ We need to see that. */
2062 static __inline void
2063 ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw)
2068 static __inline void
2069 ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
2070 enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp)
2075 static __inline void
2076 ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid,
2077 uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu)
2082 static __inline bool
2083 ieee80211_sn_less(uint16_t sn1, uint16_t sn2)
2089 static __inline uint16_t
2090 ieee80211_sn_inc(uint16_t sn)
2096 static __inline uint16_t
2097 ieee80211_sn_add(uint16_t sn, uint16_t a)
2103 static __inline void
2104 ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr)
2109 static __inline void
2110 ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint32_t f1, uint32_t f2)
2115 static __inline uint8_t
2116 ieee80211_rate_get_vht_nss(struct ieee80211_tx_rate *r)
2122 static __inline uint8_t
2123 ieee80211_rate_get_vht_mcs(struct ieee80211_tx_rate *r)
2129 static __inline void
2130 ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid)
2135 static __inline void
2136 ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid)
2141 static __inline void
2142 ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr,
2148 static __inline void
2149 ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid)
2154 static __inline uint16_t
2155 ieee80211_sn_sub(uint16_t sa, uint16_t sb)
2159 (IEEE80211_SEQ_SEQ_MASK >> IEEE80211_SEQ_SEQ_SHIFT));
2162 static __inline void
2163 ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
2169 static __inline void
2170 ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping)
2175 static __inline void
2176 ieee80211_sta_pspoll(struct ieee80211_sta *sta)
2181 static __inline void
2182 ieee80211_sta_recalc_aggregates(struct ieee80211_sta *sta)
2187 static __inline void
2188 ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids)
2193 static __inline void
2194 ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf,
2200 static __inline struct sk_buff *
2201 ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
2204 return (linuxkpi_ieee80211_tx_dequeue(hw, txq));
2207 static __inline void
2208 ieee80211_update_mu_groups(struct ieee80211_vif *vif,
2209 u_int _i, uint8_t *ms, uint8_t *up)
2214 static __inline void
2215 ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t)
2220 static __inline void
2221 ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid,
2222 struct ieee80211_key_seq *seq)
2225 KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n",
2226 __func__, keyconf, seq));
2229 switch (keyconf->cipher) {
2230 case WLAN_CIPHER_SUITE_CCMP:
2231 case WLAN_CIPHER_SUITE_CCMP_256:
2232 memset(seq->ccmp.pn, 0xfa, sizeof(seq->ccmp.pn)); /* XXX TODO */
2234 case WLAN_CIPHER_SUITE_AES_CMAC:
2235 memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn)); /* XXX TODO */
2237 case WLAN_CIPHER_SUITE_TKIP:
2238 seq->tkip.iv32 = 0xfa; /* XXX TODO */
2239 seq->tkip.iv16 = 0xfa; /* XXX TODO */
2242 pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher);
2247 static __inline void
2248 ieee80211_sched_scan_results(struct ieee80211_hw *hw)
2253 static __inline void
2254 ieee80211_sta_eosp(struct ieee80211_sta *sta)
2260 ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x)
2267 ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid)
2273 static __inline void
2274 ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,
2280 static __inline void
2281 ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,
2284 TODO("iwlwifi/rtw8x/...");
2287 static __inline void
2288 ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)
2293 static __inline void
2294 ieee80211_scan_completed(struct ieee80211_hw *hw,
2295 struct cfg80211_scan_info *info)
2298 linuxkpi_ieee80211_scan_completed(hw, info);
2301 static __inline struct sk_buff *
2302 ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2309 static __inline struct sk_buff *
2310 ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2313 /* Only STA needs this. Otherwise return NULL and panic bad drivers. */
2314 if (vif->type != NL80211_IFTYPE_STATION)
2317 return (linuxkpi_ieee80211_pspoll_get(hw, vif));
2320 static __inline struct sk_buff *
2321 ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
2327 static __inline struct sk_buff *
2328 ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2329 int linkid, bool qos)
2332 /* Only STA needs this. Otherwise return NULL and panic bad drivers. */
2333 if (vif->type != NL80211_IFTYPE_STATION)
2336 return (linuxkpi_ieee80211_nullfunc_get(hw, vif, linkid, qos));
2339 static __inline struct sk_buff *
2340 ieee80211_probereq_get(struct ieee80211_hw *hw, uint8_t *addr,
2341 uint8_t *ssid, size_t ssid_len, size_t tailroom)
2344 return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len,
2348 static __inline void
2349 ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w,
2353 linuxkpi_ieee80211_queue_delayed_work(hw, w, delay);
2356 static __inline void
2357 ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w)
2360 linuxkpi_ieee80211_queue_work(hw, w);
2363 static __inline void
2364 ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
2367 linuxkpi_ieee80211_tx_status(hw, skb);
2370 static __inline void
2371 ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
2374 ieee80211_tx_status(hw, skb);
2377 static __inline void
2378 ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
2381 ieee80211_tx_status(hw, skb);
2384 static __inline void
2385 ieee80211_tx_status_ext(struct ieee80211_hw *hw,
2386 struct ieee80211_tx_status *txstat)
2389 linuxkpi_ieee80211_tx_status_ext(hw, txstat);
2392 static __inline void
2393 ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
2398 * Apparently clearing flags and some other fields is not right.
2399 * Given the function is called "status" we work on that part of
2402 for (i = 0; i < nitems(info->status.rates); i++)
2403 info->status.rates[i].count = 0;
2405 * Unclear if ack_signal should be included or not but we clear the
2406 * "valid" bool so this field is no longer valid.
2408 memset(&info->status.ack_signal, 0, sizeof(*info) -
2409 offsetof(struct ieee80211_tx_info, status.ack_signal));
2412 static __inline void
2413 ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt,
2414 unsigned long *byte_cnt)
2417 if (frame_cnt == NULL && byte_cnt == NULL)
2420 linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt);
2424 rate_lowest_index(struct ieee80211_supported_band *band,
2425 struct ieee80211_sta *sta)
2432 static __inline void
2433 SET_IEEE80211_PERM_ADDR (struct ieee80211_hw *hw, uint8_t *addr)
2436 ether_addr_copy(hw->wiphy->perm_addr, addr);
2439 static __inline void
2440 ieee80211_report_low_ack(struct ieee80211_sta *sta, int x)
2445 static __inline void
2446 ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,
2452 static __inline void
2453 ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,
2459 static __inline struct sk_buff *
2460 ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
2466 static __inline void
2467 ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
2468 struct ieee80211_tx_info *info)
2473 static __inline bool
2474 ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
2480 static __inline void
2481 ieee80211_radar_detected(struct ieee80211_hw *hw)
2486 static __inline void
2487 ieee80211_sta_register_airtime(struct ieee80211_sta *sta,
2488 uint8_t tid, uint32_t duration, int x)
2493 static __inline void
2494 ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter)
2500 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif)
2507 ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap, uint32_t chanwidth,
2508 int x, bool t, int nss)
2514 static __inline bool
2515 ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif)
2521 static __inline void
2522 ieee80211_disconnect(struct ieee80211_vif *vif, bool _x)
2527 static __inline void
2528 ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif, bool _x)
2533 static __inline const struct ieee80211_sta_he_cap *
2534 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,
2535 enum nl80211_iftype type)
2541 static __inline void
2542 ieee80211_key_mic_failure(struct ieee80211_key_conf *key)
2547 static __inline void
2548 ieee80211_key_replay(struct ieee80211_key_conf *key)
2553 static __inline uint32_t
2554 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
2555 struct ieee80211_rx_status *rxstat, int len)
2561 static __inline void
2562 ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
2563 struct sk_buff *skb, struct ieee80211_tx_rate *txrate, int nrates)
2568 static __inline void
2569 ieee80211_color_change_finish(struct ieee80211_vif *vif)
2574 static __inline struct sk_buff *
2575 ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
2576 struct ieee80211_vif *vif)
2582 static __inline struct sk_buff *
2583 ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
2584 struct ieee80211_vif *vif)
2590 static __inline void
2591 linuxkpi_ieee80211_send_bar(struct ieee80211_vif *vif, uint8_t *ra, uint16_t tid,
2597 static __inline void
2598 ieee80211_resume_disconnect(struct ieee80211_vif *vif)
2604 ieee80211_data_to_8023(struct sk_buff *skb, const uint8_t *addr,
2605 enum nl80211_iftype iftype)
2611 static __inline void
2612 ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key,
2613 uint32_t iv32, uint16_t *p1k)
2618 static __inline struct ieee80211_key_conf *
2619 ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
2620 struct ieee80211_key_conf *key)
2626 static __inline void
2627 ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid,
2628 const uint8_t *replay_ctr, gfp_t gfp)
2633 static __inline void
2634 ieee80211_remove_key(struct ieee80211_key_conf *key)
2639 static __inline void
2640 ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid,
2641 struct ieee80211_key_seq *seq)
2646 static __inline void
2647 ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
2648 struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp)
2653 static __inline void
2654 ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
2655 uint64_t obss_color_bitmap, gfp_t gfp)
2660 static __inline void
2661 ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,
2667 static __inline struct ieee80211_ema_beacons *
2668 ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,
2669 struct ieee80211_vif *vif, uint32_t link_id)
2675 static __inline void
2676 ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *bcns)
2682 ieee80211_vif_is_mld(const struct ieee80211_vif *vif)
2685 /* If valid_links is non-zero, the vif is an MLD. */
2686 return (vif->valid_links != 0);
2689 static __inline const struct ieee80211_sta_he_cap *
2690 ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band,
2691 struct ieee80211_vif *vif)
2697 static __inline const struct ieee80211_sta_eht_cap *
2698 ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band,
2699 struct ieee80211_vif *vif)
2705 #define ieee80211_send_bar(_v, _r, _t, _s) \
2706 linuxkpi_ieee80211_send_bar(_v, _r, _t, _s)
2708 #endif /* _LINUXKPI_NET_MAC80211_H */