Path: blob/main/sys/compat/linuxkpi/common/include/net/mac80211.h
39604 views
/*-1* Copyright (c) 2020-2025 The FreeBSD Foundation2* Copyright (c) 2020-2025 Bjoern A. Zeeb3*4* This software was developed by Björn Zeeb under sponsorship from5* the FreeBSD Foundation.6*7* Redistribution and use in source and binary forms, with or without8* modification, are permitted provided that the following conditions9* are met:10* 1. Redistributions of source code must retain the above copyright11* notice, this list of conditions and the following disclaimer.12* 2. Redistributions in binary form must reproduce the above copyright13* notice, this list of conditions and the following disclaimer in the14* documentation and/or other materials provided with the distribution.15*16* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND17* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE18* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE19* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE20* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL21* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS22* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)23* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT24* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY25* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF26* SUCH DAMAGE.27*/2829#ifndef _LINUXKPI_NET_MAC80211_H30#define _LINUXKPI_NET_MAC80211_H3132#include <sys/types.h>3334#include <asm/atomic64.h>35#include <linux/bitops.h>36#include <linux/bitfield.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 <linux/ieee80211.h>44#include <net/cfg80211.h>45#include <net/if_inet6.h>4647#define ARPHRD_IEEE80211_RADIOTAP __LINE__ /* XXX TODO brcmfmac */4849#define WLAN_OUI_MICROSOFT (0x0050F2)50#define WLAN_OUI_TYPE_MICROSOFT_WPA (1)51#define WLAN_OUI_TYPE_MICROSOFT_TPC (8)52#define WLAN_OUI_TYPE_WFA_P2P (9)53#define WLAN_OUI_WFA (0x506F9A)5455#define IEEE80211_LINK_UNSPECIFIED 0x0f5657/* hw->conf.flags */58enum ieee80211_hw_conf_flags {59IEEE80211_CONF_IDLE = BIT(0),60IEEE80211_CONF_PS = BIT(1),61IEEE80211_CONF_MONITOR = BIT(2),62IEEE80211_CONF_OFFCHANNEL = BIT(3),63};6465/* (*ops->config()) */66enum ieee80211_hw_conf_changed_flags {67IEEE80211_CONF_CHANGE_CHANNEL = BIT(0),68IEEE80211_CONF_CHANGE_IDLE = BIT(1),69IEEE80211_CONF_CHANGE_PS = BIT(2),70IEEE80211_CONF_CHANGE_MONITOR = BIT(3),71IEEE80211_CONF_CHANGE_POWER = BIT(4),72};7374#define CFG80211_TESTMODE_CMD(_x) /* XXX TODO */75#define CFG80211_TESTMODE_DUMP(_x) /* XXX TODO */7677#define FCS_LEN 47879/* ops.configure_filter() */80enum mcast_filter_flags {81FIF_ALLMULTI = BIT(0),82FIF_PROBE_REQ = BIT(1),83FIF_BCN_PRBRESP_PROMISC = BIT(2),84FIF_FCSFAIL = BIT(3),85FIF_OTHER_BSS = BIT(4),86FIF_PSPOLL = BIT(5),87FIF_CONTROL = BIT(6),88FIF_MCAST_ACTION = BIT(7),8990/* Must stay last. */91FIF_FLAGS_MASK = BIT(8)-1,92};9394enum ieee80211_bss_changed {95BSS_CHANGED_ARP_FILTER = BIT(0),96BSS_CHANGED_ASSOC = BIT(1),97BSS_CHANGED_BANDWIDTH = BIT(2),98BSS_CHANGED_BEACON = BIT(3),99BSS_CHANGED_BEACON_ENABLED = BIT(4),100BSS_CHANGED_BEACON_INFO = BIT(5),101BSS_CHANGED_BEACON_INT = BIT(6),102BSS_CHANGED_BSSID = BIT(7),103BSS_CHANGED_CQM = BIT(8),104BSS_CHANGED_ERP_CTS_PROT = BIT(9),105BSS_CHANGED_ERP_SLOT = BIT(10),106BSS_CHANGED_FTM_RESPONDER = BIT(11),107BSS_CHANGED_HT = BIT(12),108BSS_CHANGED_IDLE = BIT(13),109BSS_CHANGED_MU_GROUPS = BIT(14),110BSS_CHANGED_P2P_PS = BIT(15),111BSS_CHANGED_PS = BIT(16),112BSS_CHANGED_QOS = BIT(17),113BSS_CHANGED_TXPOWER = BIT(18),114BSS_CHANGED_HE_BSS_COLOR = BIT(19),115BSS_CHANGED_AP_PROBE_RESP = BIT(20),116BSS_CHANGED_BASIC_RATES = BIT(21),117BSS_CHANGED_ERP_PREAMBLE = BIT(22),118BSS_CHANGED_IBSS = BIT(23),119BSS_CHANGED_MCAST_RATE = BIT(24),120BSS_CHANGED_SSID = BIT(25),121BSS_CHANGED_FILS_DISCOVERY = BIT(26),122BSS_CHANGED_HE_OBSS_PD = BIT(27),123BSS_CHANGED_TWT = BIT(28),124BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = BIT(30),125BSS_CHANGED_EHT_PUNCTURING = BIT(31),126BSS_CHANGED_MLD_VALID_LINKS = BIT_ULL(32),127BSS_CHANGED_MLD_TTLM = BIT_ULL(33),128BSS_CHANGED_TPE = BIT_ULL(34),129};130131/* 802.11 Figure 9-256 Suite selector format. [OUI(3), SUITE TYPE(1)] */132#define WLAN_CIPHER_SUITE_OUI(_oui, _x) (((_oui) << 8) | ((_x) & 0xff))133134/* 802.11 Table 9-131 Cipher suite selectors. */135/* 802.1x suite B 11 */136#define WLAN_CIPHER_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x)137/* Use group 0 */138#define WLAN_CIPHER_SUITE_WEP40 WLAN_CIPHER_SUITE(1)139#define WLAN_CIPHER_SUITE_TKIP WLAN_CIPHER_SUITE(2)140/* Reserved 3 */141#define WLAN_CIPHER_SUITE_CCMP WLAN_CIPHER_SUITE(4) /* CCMP-128 */142#define WLAN_CIPHER_SUITE_WEP104 WLAN_CIPHER_SUITE(5)143#define WLAN_CIPHER_SUITE_AES_CMAC WLAN_CIPHER_SUITE(6) /* BIP-CMAC-128 */144/* Group addressed traffic not allowed 7 */145#define WLAN_CIPHER_SUITE_GCMP WLAN_CIPHER_SUITE(8)146#define WLAN_CIPHER_SUITE_GCMP_256 WLAN_CIPHER_SUITE(9)147#define WLAN_CIPHER_SUITE_CCMP_256 WLAN_CIPHER_SUITE(10)148#define WLAN_CIPHER_SUITE_BIP_GMAC_128 WLAN_CIPHER_SUITE(11)149#define WLAN_CIPHER_SUITE_BIP_GMAC_256 WLAN_CIPHER_SUITE(12)150#define WLAN_CIPHER_SUITE_BIP_CMAC_256 WLAN_CIPHER_SUITE(13)151/* Reserved 14-255 */152153/* See ISO/IEC JTC 1 N 9880 Table 11 */154#define WLAN_CIPHER_SUITE_SMS4 WLAN_CIPHER_SUITE_OUI(0x001472, 1)155156157/* 802.11 Table 9-133 AKM suite selectors. */158#define WLAN_AKM_SUITE(_x) WLAN_CIPHER_SUITE_OUI(0x000fac, _x)159/* Reserved 0 */160#define WLAN_AKM_SUITE_8021X WLAN_AKM_SUITE(1)161#define WLAN_AKM_SUITE_PSK WLAN_AKM_SUITE(2)162#define WLAN_AKM_SUITE_FT_8021X WLAN_AKM_SUITE(3)163#define WLAN_AKM_SUITE_FT_PSK WLAN_AKM_SUITE(4)164#define WLAN_AKM_SUITE_8021X_SHA256 WLAN_AKM_SUITE(5)165#define WLAN_AKM_SUITE_PSK_SHA256 WLAN_AKM_SUITE(6)166/* TDLS 7 */167#define WLAN_AKM_SUITE_SAE WLAN_AKM_SUITE(8)168/* FToSAE 9 */169/* AP peer key 10 */170/* 802.1x suite B 11 */171/* 802.1x suite B 384 12 */172/* FTo802.1x 384 13 */173/* Reserved 14-255 */174/* Apparently 11ax defines more. Seen (19,20) mentioned. */175176#define TKIP_PN_TO_IV16(_x) ((uint16_t)(_x & 0xffff))177#define TKIP_PN_TO_IV32(_x) ((uint32_t)((_x >> 16) & 0xffffffff))178179enum ieee80211_neg_ttlm_res {180NEG_TTLM_RES_ACCEPT,181NEG_TTLM_RES_REJECT,182};183184#define IEEE80211_TTLM_NUM_TIDS 8185struct ieee80211_neg_ttlm {186uint16_t downlink[IEEE80211_TTLM_NUM_TIDS];187uint16_t uplink[IEEE80211_TTLM_NUM_TIDS];188};189190/* 802.11-2020 9.4.2.55.3 A-MPDU Parameters field */191#define IEEE80211_HT_AMPDU_PARM_FACTOR 0x3192#define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2193#define IEEE80211_HT_AMPDU_PARM_DENSITY (0x7 << IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT)194195struct ieee80211_sta;196197struct ieee80211_ampdu_params {198struct ieee80211_sta *sta;199enum ieee80211_ampdu_mlme_action action;200uint16_t buf_size;201uint16_t timeout;202uint16_t ssn;203uint8_t tid;204bool amsdu;205};206207struct ieee80211_bar {208/* TODO FIXME */209int control, start_seq_num;210uint8_t *ra;211uint16_t frame_control;212};213214struct ieee80211_mutable_offsets {215/* TODO FIXME */216uint16_t tim_offset;217uint16_t cntdwn_counter_offs[2];218219int mbssid_off;220};221222struct mac80211_fils_discovery {223uint32_t max_interval;224};225226struct ieee80211_chanctx_conf {227struct cfg80211_chan_def def;228struct cfg80211_chan_def min_def;229struct cfg80211_chan_def ap;230231uint8_t rx_chains_dynamic;232uint8_t rx_chains_static;233bool radar_enabled;234235/* Must stay last. */236uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);237};238239struct ieee80211_rate_status {240struct rate_info rate_idx;241uint8_t try_count;242};243244struct ieee80211_ema_beacons {245uint8_t cnt;246struct {247struct sk_buff *skb;248struct ieee80211_mutable_offsets offs;249} bcn[0];250};251252struct ieee80211_chanreq {253struct cfg80211_chan_def oper;254};255256#define WLAN_MEMBERSHIP_LEN (8)257#define WLAN_USER_POSITION_LEN (16)258259/*260* 802.11ac-2013, 8.4.2.164 VHT Transmit Power Envelope element261* 802.11-???? ?262*/263struct ieee80211_parsed_tpe_eirp {264int8_t power[5];265uint8_t count;266bool valid;267};268struct ieee80211_parsed_tpe_psd {269int8_t power[16];270uint8_t count;271bool valid;272};273struct ieee80211_parsed_tpe {274/* We see access to [0] so assume at least 2. */275struct ieee80211_parsed_tpe_eirp max_local[2];276struct ieee80211_parsed_tpe_eirp max_reg_client[2];277struct ieee80211_parsed_tpe_psd psd_local[2];278struct ieee80211_parsed_tpe_psd psd_reg_client[2];279};280281struct ieee80211_bss_conf {282/* TODO FIXME */283struct ieee80211_vif *vif;284struct cfg80211_bss *bss;285const uint8_t *bssid;286uint8_t addr[ETH_ALEN];287uint8_t link_id;288uint8_t _pad0;289uint8_t transmitter_bssid[ETH_ALEN];290struct ieee80211_ftm_responder_params *ftmr_params;291struct ieee80211_p2p_noa_attr p2p_noa_attr;292struct ieee80211_chanreq chanreq;293__be32 arp_addr_list[1]; /* XXX TODO */294struct ieee80211_rate *beacon_rate;295struct {296uint8_t membership[WLAN_MEMBERSHIP_LEN];297uint8_t position[WLAN_USER_POSITION_LEN];298} mu_group;299struct {300uint32_t params;301/* single field struct? */302} he_oper;303struct cfg80211_he_bss_color he_bss_color;304struct ieee80211_he_obss_pd he_obss_pd;305306bool ht_ldpc;307bool vht_ldpc;308bool he_ldpc;309bool vht_mu_beamformee;310bool vht_mu_beamformer;311bool vht_su_beamformee;312bool vht_su_beamformer;313bool he_mu_beamformer;314bool he_su_beamformee;315bool he_su_beamformer;316bool he_full_ul_mumimo;317bool eht_su_beamformee;318bool eht_su_beamformer;319bool eht_mu_beamformer;320321uint16_t ht_operation_mode;322int arp_addr_cnt;323uint16_t eht_puncturing;324325uint8_t dtim_period;326uint8_t sync_dtim_count;327uint8_t bss_param_ch_cnt_link_id;328bool qos;329bool twt_broadcast;330bool use_cts_prot;331bool use_short_preamble;332bool use_short_slot;333bool he_support;334bool eht_support;335bool csa_active;336bool mu_mimo_owner;337bool color_change_active;338uint32_t sync_device_ts;339uint64_t sync_tsf;340uint16_t beacon_int;341int16_t txpower;342uint32_t basic_rates;343int mcast_rate[NUM_NL80211_BANDS];344enum ieee80211_ap_reg_power power_type;345struct cfg80211_bitrate_mask beacon_tx_rate;346struct mac80211_fils_discovery fils_discovery;347struct ieee80211_chanctx_conf *chanctx_conf;348struct ieee80211_vif *mbssid_tx_vif;349struct ieee80211_parsed_tpe tpe;350351int ack_enabled, bssid_index, bssid_indicator, cqm_rssi_hyst, cqm_rssi_thold, ema_ap, frame_time_rts_th, ftm_responder;352int htc_trig_based_pkt_ext;353int multi_sta_back_32bit, nontransmitted;354int profile_periodicity;355int twt_requester, uora_exists, uora_ocw_range;356int assoc_capability, enable_beacon, hidden_ssid, ibss_joined, twt_protected;357int twt_responder, unsol_bcast_probe_resp_interval;358};359360struct ieee80211_channel_switch {361/* TODO FIXME */362int block_tx, count, delay, device_timestamp, timestamp;363uint8_t link_id;364struct cfg80211_chan_def chandef;365};366367enum ieee80211_event_type {368BA_FRAME_TIMEOUT,369BAR_RX_EVENT,370MLME_EVENT,371RSSI_EVENT,372};373374enum ieee80211_rssi_event_data {375RSSI_EVENT_LOW,376RSSI_EVENT_HIGH,377};378379enum ieee80211_mlme_event_data {380ASSOC_EVENT,381AUTH_EVENT,382DEAUTH_RX_EVENT,383DEAUTH_TX_EVENT,384};385386enum ieee80211_mlme_event_status {387MLME_DENIED,388MLME_TIMEOUT,389};390391struct ieee80211_mlme_event {392enum ieee80211_mlme_event_data data;393enum ieee80211_mlme_event_status status;394int reason;395};396397struct ieee80211_event {398/* TODO FIXME */399enum ieee80211_event_type type;400union {401struct {402int ssn;403struct ieee80211_sta *sta;404uint8_t tid;405} ba;406struct ieee80211_mlme_event mlme;407} u;408};409410struct ieee80211_ftm_responder_params {411/* TODO FIXME */412uint8_t *lci;413uint8_t *civicloc;414int lci_len;415int civicloc_len;416};417418struct ieee80211_conf {419int dynamic_ps_timeout;420int power_level;421uint32_t listen_interval;422bool radar_enabled;423enum ieee80211_hw_conf_flags flags;424struct cfg80211_chan_def chandef;425};426427enum ieee80211_hw_flags {428IEEE80211_HW_AMPDU_AGGREGATION,429IEEE80211_HW_AP_LINK_PS,430IEEE80211_HW_BUFF_MMPDU_TXQ,431IEEE80211_HW_CHANCTX_STA_CSA,432IEEE80211_HW_CONNECTION_MONITOR,433IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP,434IEEE80211_HW_HAS_RATE_CONTROL,435IEEE80211_HW_MFP_CAPABLE,436IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,437IEEE80211_HW_REPORTS_TX_ACK_STATUS,438IEEE80211_HW_RX_INCLUDES_FCS,439IEEE80211_HW_SIGNAL_DBM,440IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,441IEEE80211_HW_SPECTRUM_MGMT,442IEEE80211_HW_STA_MMPDU_TXQ,443IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,444IEEE80211_HW_SUPPORTS_CLONED_SKBS,445IEEE80211_HW_SUPPORTS_DYNAMIC_PS,446IEEE80211_HW_SUPPORTS_MULTI_BSSID,447IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,448IEEE80211_HW_SUPPORTS_PS,449IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,450IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,451IEEE80211_HW_SUPPORT_FAST_XMIT,452IEEE80211_HW_TDLS_WIDER_BW,453IEEE80211_HW_TIMING_BEACON_ONLY,454IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,455IEEE80211_HW_TX_AMSDU,456IEEE80211_HW_TX_FRAG_LIST,457IEEE80211_HW_USES_RSS,458IEEE80211_HW_WANT_MONITOR_VIF,459IEEE80211_HW_SW_CRYPTO_CONTROL,460IEEE80211_HW_SUPPORTS_TX_FRAG,461IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA,462IEEE80211_HW_SUPPORTS_PER_STA_GTK,463IEEE80211_HW_REPORTS_LOW_ACK,464IEEE80211_HW_QUEUE_CONTROL,465IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD,466IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD,467IEEE80211_HW_SUPPORTS_RC_TABLE,468IEEE80211_HW_DETECTS_COLOR_COLLISION,469IEEE80211_HW_DISALLOW_PUNCTURING,470IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ,471IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,472IEEE80211_HW_HANDLES_QUIET_CSA,473IEEE80211_HW_NO_VIRTUAL_MONITOR,474475/* Keep last. */476NUM_IEEE80211_HW_FLAGS477};478479struct ieee80211_hw {480481struct wiphy *wiphy;482483/* TODO FIXME */484int extra_tx_headroom, weight_multiplier;485int max_rate_tries, max_rates, max_report_rates;486const char *rate_control_algorithm;487struct {488uint16_t units_pos; /* radiotap "spec" is .. inconsistent. */489uint16_t accuracy;490} radiotap_timestamp;491size_t sta_data_size;492size_t vif_data_size;493size_t chanctx_data_size;494size_t txq_data_size;495uint16_t radiotap_mcs_details;496uint16_t radiotap_vht_details;497uint16_t queues;498uint16_t offchannel_tx_hw_queue;499uint16_t uapsd_max_sp_len;500uint16_t uapsd_queues;501uint16_t max_rx_aggregation_subframes;502uint16_t max_tx_aggregation_subframes;503uint16_t max_tx_fragments;504uint16_t max_listen_interval;505uint32_t extra_beacon_tailroom;506netdev_features_t netdev_features;507unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];508struct ieee80211_conf conf;509510#if 0 /* leave here for documentation purposes. This does NOT work. */511/* Must stay last. */512uint8_t priv[0] __aligned(CACHE_LINE_SIZE);513#else514void *priv;515#endif516};517518enum ieee802111_key_flag {519IEEE80211_KEY_FLAG_GENERATE_IV = BIT(0),520IEEE80211_KEY_FLAG_GENERATE_MMIC = BIT(1),521IEEE80211_KEY_FLAG_PAIRWISE = BIT(2),522IEEE80211_KEY_FLAG_PUT_IV_SPACE = BIT(3),523IEEE80211_KEY_FLAG_PUT_MIC_SPACE = BIT(4),524IEEE80211_KEY_FLAG_SW_MGMT_TX = BIT(5),525IEEE80211_KEY_FLAG_GENERATE_IV_MGMT = BIT(6),526IEEE80211_KEY_FLAG_GENERATE_MMIE = BIT(7),527IEEE80211_KEY_FLAG_RESERVE_TAILROOM = BIT(8),528IEEE80211_KEY_FLAG_SPP_AMSDU = BIT(9),529};530531#define IEEE80211_KEY_FLAG_BITS \532"\20\1GENERATE_IV\2GENERATE_MMIC\3PAIRWISE\4PUT_IV_SPACE" \533"\5PUT_MIC_SPACE\6SW_MGMT_TX\7GENERATE_IV_MGMT\10GENERATE_MMIE" \534"\11RESERVE_TAILROOM\12SPP_AMSDU"535536struct ieee80211_key_conf {537#if defined(__FreeBSD__)538const struct ieee80211_key *_k; /* backpointer to net80211 */539#endif540atomic64_t tx_pn;541uint32_t cipher;542uint8_t icv_len; /* __unused nowadays? */543uint8_t iv_len;544uint8_t hw_key_idx; /* Set by drv. */545uint8_t keyidx;546uint16_t flags;547int8_t link_id; /* signed! */548uint8_t keylen;549uint8_t key[0]; /* Must stay last! */550};551552struct ieee80211_key_seq {553/* TODO FIXME */554union {555struct {556uint8_t seq[IEEE80211_MAX_PN_LEN];557uint8_t seq_len;558} hw;559struct {560uint8_t pn[IEEE80211_CCMP_PN_LEN];561} ccmp;562struct {563uint8_t pn[IEEE80211_GCMP_PN_LEN];564} gcmp;565struct {566uint8_t pn[IEEE80211_CMAC_PN_LEN];567} aes_cmac;568struct {569uint8_t pn[IEEE80211_GMAC_PN_LEN];570} aes_gmac;571struct {572uint32_t iv32;573uint16_t iv16;574} tkip;575};576};577578579enum ieee80211_rx_status_flags {580RX_FLAG_ALLOW_SAME_PN = BIT(0),581RX_FLAG_AMPDU_DETAILS = BIT(1),582RX_FLAG_AMPDU_EOF_BIT = BIT(2),583RX_FLAG_AMPDU_EOF_BIT_KNOWN = BIT(3),584RX_FLAG_DECRYPTED = BIT(4),585RX_FLAG_DUP_VALIDATED = BIT(5),586RX_FLAG_FAILED_FCS_CRC = BIT(6),587RX_FLAG_ICV_STRIPPED = BIT(7),588RX_FLAG_MACTIME = BIT(8) | BIT(9),589RX_FLAG_MACTIME_PLCP_START = 1 << 8,590RX_FLAG_MACTIME_START = 2 << 8,591RX_FLAG_MACTIME_END = 3 << 8,592RX_FLAG_MIC_STRIPPED = BIT(10),593RX_FLAG_MMIC_ERROR = BIT(11),594RX_FLAG_MMIC_STRIPPED = BIT(12),595RX_FLAG_NO_PSDU = BIT(13),596RX_FLAG_PN_VALIDATED = BIT(14),597RX_FLAG_RADIOTAP_HE = BIT(15),598RX_FLAG_RADIOTAP_HE_MU = BIT(16),599RX_FLAG_RADIOTAP_LSIG = BIT(17),600RX_FLAG_RADIOTAP_VENDOR_DATA = BIT(18),601RX_FLAG_NO_SIGNAL_VAL = BIT(19),602RX_FLAG_IV_STRIPPED = BIT(20),603RX_FLAG_AMPDU_IS_LAST = BIT(21),604RX_FLAG_AMPDU_LAST_KNOWN = BIT(22),605RX_FLAG_AMSDU_MORE = BIT(23),606/* = BIT(24), */607RX_FLAG_ONLY_MONITOR = BIT(25),608RX_FLAG_SKIP_MONITOR = BIT(26),609RX_FLAG_8023 = BIT(27),610RX_FLAG_RADIOTAP_TLV_AT_END = BIT(28),611/* = BIT(29), */612RX_FLAG_MACTIME_IS_RTAP_TS64 = BIT(30),613RX_FLAG_FAILED_PLCP_CRC = BIT(31),614};615616#define IEEE80211_RX_STATUS_FLAGS_BITS \617"\20\1ALLOW_SAME_PN\2AMPDU_DETAILS\3AMPDU_EOF_BIT\4AMPDU_EOF_BIT_KNOWN" \618"\5DECRYPTED\6DUP_VALIDATED\7FAILED_FCS_CRC\10ICV_STRIPPED" \619"\11MACTIME_PLCP_START\12MACTIME_START\13MIC_STRIPPED" \620"\14MMIC_ERROR\15MMIC_STRIPPED\16NO_PSDU\17PN_VALIDATED" \621"\20RADIOTAP_HE\21RADIOTAP_HE_MU\22RADIOTAP_LSIG\23RADIOTAP_VENDOR_DATA" \622"\24NO_SIGNAL_VAL\25IV_STRIPPED\26AMPDU_IS_LAST\27AMPDU_LAST_KNOWN" \623"\30AMSDU_MORE\31MACTIME_END\32ONLY_MONITOR\33SKIP_MONITOR" \624"\348023\35RADIOTAP_TLV_AT_END\36MACTIME\37MACTIME_IS_RTAP_TS64" \625"\40FAILED_PLCP_CRC"626627enum mac80211_rx_encoding {628RX_ENC_LEGACY = 0,629RX_ENC_HT,630RX_ENC_VHT,631RX_ENC_HE,632RX_ENC_EHT,633};634635struct ieee80211_rx_status {636/* TODO FIXME, this is too large. Over-reduce types to u8 where possible. */637union {638uint64_t boottime_ns;639int64_t ack_tx_hwtstamp;640};641uint64_t mactime;642uint32_t device_timestamp;643enum ieee80211_rx_status_flags flag;644uint16_t freq;645uint8_t encoding:3, bw:4; /* enum mac80211_rx_encoding, rate_info_bw */ /* See mt76.h */646uint8_t ampdu_reference;647uint8_t band;648uint8_t chains;649int8_t chain_signal[IEEE80211_MAX_CHAINS];650int8_t signal;651uint8_t enc_flags;652union {653struct {654uint8_t he_ru:3; /* nl80211::enum nl80211_he_ru_alloc */655uint8_t he_gi:2; /* nl80211::enum nl80211_he_gi */656uint8_t he_dcm:1;657};658struct {659uint8_t ru:4; /* nl80211::enum nl80211_eht_ru_alloc */660uint8_t gi:2; /* nl80211::enum nl80211_eht_gi */661} eht;662};663bool link_valid;664uint8_t link_id; /* very incosistent sizes? */665uint8_t zero_length_psdu_type;666uint8_t nss;667uint8_t rate_idx;668};669670struct ieee80211_tx_status {671struct ieee80211_sta *sta;672struct ieee80211_tx_info *info;673int64_t ack_hwtstamp;674675u8 n_rates;676struct ieee80211_rate_status *rates;677678struct sk_buff *skb;679struct list_head *free_list;680};681682struct ieee80211_scan_ies {683/* TODO FIXME */684int common_ie_len;685int len[NUM_NL80211_BANDS];686uint8_t *common_ies;687uint8_t *ies[NUM_NL80211_BANDS];688};689690struct ieee80211_scan_request {691struct ieee80211_scan_ies ies;692struct cfg80211_scan_request req;693};694695struct ieee80211_txq {696struct ieee80211_sta *sta;697struct ieee80211_vif *vif;698int ac;699uint8_t tid;700701/* Must stay last. */702uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);703};704705struct ieee80211_sta_rates {706/* XXX TODO */707/* XXX some _rcu thing */708struct {709uint8_t idx;710uint8_t count;711uint16_t flags;712} rate[4]; /* XXX what is the real number? */713};714715struct ieee80211_sta_txpwr {716/* XXX TODO */717enum nl80211_tx_power_setting type;718short power;719};720721#define IEEE80211_NUM_TIDS 16 /* net80211::WME_NUM_TID */722struct ieee80211_sta_agg {723uint16_t max_amsdu_len;724uint16_t max_rc_amsdu_len;725uint16_t max_tid_amsdu_len[IEEE80211_NUM_TIDS];726};727728struct ieee80211_link_sta {729struct ieee80211_sta *sta;730uint8_t addr[ETH_ALEN];731uint8_t link_id;732uint32_t supp_rates[NUM_NL80211_BANDS];733struct ieee80211_sta_ht_cap ht_cap;734struct ieee80211_sta_vht_cap vht_cap;735struct ieee80211_sta_he_cap he_cap;736struct ieee80211_he_6ghz_capa he_6ghz_capa;737struct ieee80211_sta_eht_cap eht_cap;738uint8_t rx_nss;739enum ieee80211_sta_rx_bandwidth bandwidth;740enum ieee80211_smps_mode smps_mode;741struct ieee80211_sta_agg agg;742struct ieee80211_sta_txpwr txpwr;743};744745struct ieee80211_sta {746/* TODO FIXME */747int max_amsdu_subframes;748int mfp, smps_mode, tdls, tdls_initiator;749struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1]; /* iwlwifi: 8 and adds +1 to tid_data, net80211::IEEE80211_TID_SIZE */750struct ieee80211_sta_rates *rates; /* some rcu thing? */751uint8_t addr[ETH_ALEN];752uint16_t aid;753bool wme;754bool mlo;755uint8_t max_sp;756uint8_t uapsd_queues;757uint16_t valid_links;758759struct ieee80211_link_sta deflink;760struct ieee80211_link_sta *link[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */761762/* Must stay last. */763uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);764};765766struct ieee80211_tdls_ch_sw_params {767/* TODO FIXME */768int action_code, ch_sw_tm_ie, status, switch_time, switch_timeout, timestamp;769struct ieee80211_sta *sta;770struct cfg80211_chan_def *chandef;771struct sk_buff *tmpl_skb;772};773774struct ieee80211_tx_control {775/* TODO FIXME */776struct ieee80211_sta *sta;777};778779struct ieee80211_tx_queue_params {780/* These types are based on iwlwifi FW structs. */781uint16_t cw_min;782uint16_t cw_max;783uint16_t txop;784uint8_t aifs;785786/* TODO FIXME */787int acm, mu_edca, uapsd;788struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec;789};790791struct ieee80211_tx_rate {792uint8_t idx;793uint16_t count:5,794flags:11;795};796797enum ieee80211_vif_driver_flags {798IEEE80211_VIF_BEACON_FILTER = BIT(0),799IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),800IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2),801#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 60600) /* v6.6 */802IEEE80211_VIF_DISABLE_SMPS_OVERRIDE = BIT(3), /* Renamed to IEEE80211_VIF_EML_ACTIVE. */803#endif804IEEE80211_VIF_EML_ACTIVE = BIT(4),805IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW = BIT(5),806IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC = BIT(6),807};808809#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4810811struct ieee80211_vif_cfg {812uint16_t aid;813uint16_t eml_cap;814uint16_t eml_med_sync_delay;815bool assoc;816bool ps;817bool idle;818bool ibss_joined;819int arp_addr_cnt;820size_t ssid_len;821uint32_t arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; /* big endian */822uint8_t ssid[IEEE80211_NWID_LEN];823uint8_t ap_addr[ETH_ALEN];824};825826struct ieee80211_vif {827/* TODO FIXME */828enum nl80211_iftype type;829int cab_queue;830int offload_flags;831enum ieee80211_vif_driver_flags driver_flags;832bool p2p;833bool probe_req_reg;834uint8_t addr[ETH_ALEN];835struct ieee80211_vif_cfg cfg;836struct ieee80211_txq *txq;837struct ieee80211_bss_conf bss_conf;838struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */839uint8_t hw_queue[IEEE80211_NUM_ACS];840uint16_t active_links;841uint16_t valid_links;842struct ieee80211_vif *mbssid_tx_vif;843844/* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change structure depending on compile-time option. */845struct dentry *debugfs_dir;846/* #endif */847848/* Must stay last. */849uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);850};851852struct ieee80211_vif_chanctx_switch {853struct ieee80211_chanctx_conf *old_ctx, *new_ctx;854struct ieee80211_vif *vif;855struct ieee80211_bss_conf *link_conf;856};857858struct ieee80211_prep_tx_info {859u16 duration;860bool success;861bool was_assoc;862int link_id;863};864865/* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */866/* Also warning: some sizes change by pointer size! This is 64bit only. */867struct ieee80211_tx_info {868enum ieee80211_tx_info_flags flags; /* 32 bits */869/* TODO FIXME */870enum nl80211_band band; /* 3 bits */871uint16_t hw_queue:4, /* 4 bits */872tx_time_est:10; /* 10 bits */873union {874struct {875struct ieee80211_tx_rate rates[4];876bool use_rts;877uint8_t antennas:2;878struct ieee80211_vif *vif;879struct ieee80211_key_conf *hw_key;880enum ieee80211_tx_control_flags flags;881} control;882struct {883struct ieee80211_tx_rate rates[4];884uint32_t ack_signal;885uint8_t ampdu_ack_len;886uint8_t ampdu_len;887uint8_t antenna;888uint16_t tx_time;889uint8_t flags;890void *status_driver_data[16 / sizeof(void *)]; /* XXX TODO */891} status;892#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40893void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];894};895};896897/* net80211 conflict */898struct linuxkpi_ieee80211_tim_ie {899uint8_t dtim_count;900uint8_t dtim_period;901uint8_t bitmap_ctrl;902uint8_t *virtual_map;903};904#define ieee80211_tim_ie linuxkpi_ieee80211_tim_ie905906struct survey_info { /* net80211::struct ieee80211_channel_survey */907/* TODO FIXME */908uint32_t filled;909#define SURVEY_INFO_TIME 0x0001910#define SURVEY_INFO_TIME_RX 0x0002911#define SURVEY_INFO_TIME_SCAN 0x0004912#define SURVEY_INFO_TIME_TX 0x0008913#define SURVEY_INFO_TIME_BSS_RX 0x0010914#define SURVEY_INFO_TIME_BUSY 0x0020915#define SURVEY_INFO_IN_USE 0x0040916#define SURVEY_INFO_NOISE_DBM 0x0080917uint32_t noise;918uint64_t time;919uint64_t time_bss_rx;920uint64_t time_busy;921uint64_t time_rx;922uint64_t time_scan;923uint64_t time_tx;924struct ieee80211_channel *channel;925};926927enum ieee80211_iface_iter {928IEEE80211_IFACE_ITER_NORMAL = BIT(0),929IEEE80211_IFACE_ITER_RESUME_ALL = BIT(1),930IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2), /* seems to be an iter flag */931IEEE80211_IFACE_ITER_ACTIVE = BIT(3),932933/* Internal flags only. */934IEEE80211_IFACE_ITER__ATOMIC = BIT(6),935IEEE80211_IFACE_ITER__MTX = BIT(8),936};937938enum set_key_cmd {939SET_KEY,940DISABLE_KEY,941};942943/* 802.11-2020, 9.4.2.55.2 HT Capability Information field. */944enum rx_enc_flags {945RX_ENC_FLAG_SHORTPRE = BIT(0),946RX_ENC_FLAG_SHORT_GI = BIT(2),947RX_ENC_FLAG_HT_GF = BIT(3),948RX_ENC_FLAG_STBC_MASK = BIT(4) | BIT(5),949#define RX_ENC_FLAG_STBC_SHIFT 4950RX_ENC_FLAG_LDPC = BIT(6),951RX_ENC_FLAG_BF = BIT(7),952};953954enum sta_notify_cmd {955STA_NOTIFY_AWAKE,956STA_NOTIFY_SLEEP,957};958959struct ieee80211_low_level_stats {960/* Can we make them uint64_t? */961uint32_t dot11ACKFailureCount;962uint32_t dot11FCSErrorCount;963uint32_t dot11RTSFailureCount;964uint32_t dot11RTSSuccessCount;965};966967enum ieee80211_offload_flags {968IEEE80211_OFFLOAD_ENCAP_4ADDR,969IEEE80211_OFFLOAD_ENCAP_ENABLED,970IEEE80211_OFFLOAD_DECAP_ENABLED,971};972973struct ieee80211_ops {974/* TODO FIXME */975int (*start)(struct ieee80211_hw *);976void (*stop)(struct ieee80211_hw *, bool);977978int (*config)(struct ieee80211_hw *, u32);979void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type);980981void (*prep_add_interface)(struct ieee80211_hw *, enum nl80211_iftype);982int (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *);983void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *);984int (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool);985986void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *);987void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *);988int (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *);989int (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *);990int (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *);991void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *);992993int (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u16, const struct ieee80211_tx_queue_params *);994void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *);995int (*tx_last_beacon)(struct ieee80211_hw *);996void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *);997998void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);999void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);1000void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int);10011002void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool);1003void (*flush_sta)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);10041005int (*set_frag_threshold)(struct ieee80211_hw *, u32);10061007void (*sync_rx_queues)(struct ieee80211_hw *);10081009void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);1010void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);10111012int (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1013int (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1014int (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1015void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *);1016void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1017int (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state);1018void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *);1019void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32);1020void (*link_sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_link_sta *, u32);1021void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1022void (*sta_set_4addr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);1023void (*sta_set_decap_offload)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);10241025u64 (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *);10261027int (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *);10281029bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *);10301031int (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);1032int (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *);1033void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);1034void (*channel_switch_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_chan_def *);1035void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *);1036void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);1037int (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32);1038void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1039void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *);10401041int (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);1042void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);1043void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32);1044int (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);1045void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);1046int (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode);10471048int (*get_antenna)(struct ieee80211_hw *, u32 *, u32 *);1049int (*set_antenna)(struct ieee80211_hw *, u32, u32);10501051int (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type);1052int (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *);10531054void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64);1055void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int);10561057void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);1058void (*link_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);10591060int (*set_rts_threshold)(struct ieee80211_hw *, u32);1061void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *);1062int (*get_survey)(struct ieee80211_hw *, int, struct survey_info *);1063int (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *);10641065uint64_t (*get_tsf)(struct ieee80211_hw *, struct ieee80211_vif *);1066void (*set_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, uint64_t);1067void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64);10681069int (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *);1070void (*set_coverage_class)(struct ieee80211_hw *, s16);1071int (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool);10721073int (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *);1074void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *);10751076int (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);1077void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);10781079int (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);1080void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);1081int (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);1082void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);10831084int (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *);10851086int (*set_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct cfg80211_tid_config *);1087int (*reset_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8);10881089int (*get_et_sset_count)(struct ieee80211_hw *, struct ieee80211_vif *, int);1090void (*get_et_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct ethtool_stats *, u64 *);1091void (*get_et_strings)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u8 *);10921093void (*update_vif_offload)(struct ieee80211_hw *, struct ieee80211_vif *);10941095int (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, int *);1096int (*get_stats)(struct ieee80211_hw *, struct ieee80211_low_level_stats *);10971098int (*set_radar_background)(struct ieee80211_hw *, struct cfg80211_chan_def *);10991100void (*add_twt_setup)(struct ieee80211_hw *, struct ieee80211_sta *, struct ieee80211_twt_setup *);1101void (*twt_teardown_request)(struct ieee80211_hw *, struct ieee80211_sta *, u8);11021103int (*set_hw_timestamp)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_set_hw_timestamp *);11041105void (*vif_cfg_changed)(struct ieee80211_hw *, struct ieee80211_vif *, u64);11061107int (*change_vif_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16, u16, struct ieee80211_bss_conf *[IEEE80211_MLD_MAX_NUM_LINKS]);1108int (*change_sta_links)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u16, u16);1109bool (*can_activate_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16);1110enum ieee80211_neg_ttlm_res (*can_neg_ttlm)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_neg_ttlm *);11111112void (*rfkill_poll)(struct ieee80211_hw *);11131114/* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change depending on compile-time option. */1115void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *);1116void (*vif_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *);1117void (*link_sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_link_sta *, struct dentry *);1118void (*link_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct dentry *);1119/* #endif */1120/* #ifdef CONFIG_PM_SLEEP */ /* Do not change depending on compile-time option. */1121int (*suspend)(struct ieee80211_hw *, struct cfg80211_wowlan *);1122int (*resume)(struct ieee80211_hw *);1123void (*set_wakeup)(struct ieee80211_hw *, bool);1124void (*set_rekey_data)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_gtk_rekey_data *);1125void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int);1126/* #if IS_ENABLED(CONFIG_IPV6) */1127void (*ipv6_addr_change)(struct ieee80211_hw *, struct ieee80211_vif *, struct inet6_dev *);1128/* #endif */1129/* #endif CONFIG_PM_SLEEP */1130};11311132/* -------------------------------------------------------------------------- */11331134/* linux_80211.c */1135extern const struct cfg80211_ops linuxkpi_mac80211cfgops;11361137struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t,1138const struct ieee80211_ops *);1139void linuxkpi_ieee80211_iffree(struct ieee80211_hw *);1140void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *);1141int linuxkpi_ieee80211_ifattach(struct ieee80211_hw *);1142void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *);1143void linuxkpi_ieee80211_unregister_hw(struct ieee80211_hw *);1144struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *);1145void linuxkpi_ieee80211_restart_hw(struct ieee80211_hw *);1146void linuxkpi_ieee80211_iterate_interfaces(1147struct ieee80211_hw *hw, enum ieee80211_iface_iter flags,1148void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1149void *);1150void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *,1151struct ieee80211_vif *,1152void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,1153struct ieee80211_sta *, struct ieee80211_key_conf *, void *),1154void *, bool);1155void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *,1156void(*iterfunc)(struct ieee80211_hw *,1157struct ieee80211_chanctx_conf *, void *),1158void *);1159void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *,1160void (*iterfunc)(void *, struct ieee80211_sta *), void *);1161void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *,1162struct cfg80211_scan_info *);1163void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *,1164struct ieee80211_sta *, struct napi_struct *, struct list_head *);1165uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool);1166struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *,1167const u8 *);1168struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr(1169struct ieee80211_hw *, const uint8_t *, const uint8_t *);1170struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *,1171struct ieee80211_txq *);1172bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t);1173bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t);1174void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *,1175int);1176void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *,1177struct delayed_work *, int);1178void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *);1179struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *,1180struct ieee80211_vif *);1181struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *,1182struct ieee80211_vif *, int, bool);1183void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, unsigned long *,1184unsigned long *);1185struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);1186void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);1187void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *);1188struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *,1189const uint8_t *, const uint8_t *, size_t, size_t);1190void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *);1191void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *,1192struct ieee80211_tx_status *);1193void linuxkpi_ieee80211_stop_queues(struct ieee80211_hw *);1194void linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *);1195void linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *, int);1196void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *, int);1197void linuxkpi_ieee80211_txq_schedule_start(struct ieee80211_hw *, uint8_t);1198struct ieee80211_txq *linuxkpi_ieee80211_next_txq(struct ieee80211_hw *, uint8_t);1199void linuxkpi_ieee80211_schedule_txq(struct ieee80211_hw *,1200struct ieee80211_txq *, bool);1201void linuxkpi_ieee80211_handle_wake_tx_queue(struct ieee80211_hw *,1202struct ieee80211_txq *);12031204/* -------------------------------------------------------------------------- */12051206static __inline void1207_ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)1208{12091210set_bit(flag, hw->flags);1211}12121213static __inline bool1214__ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)1215{12161217return (test_bit(flag, hw->flags));1218}12191220/* They pass in shortened flag names; how confusingly inconsistent. */1221#define ieee80211_hw_set(_hw, _flag) \1222_ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag)1223#define ieee80211_hw_check(_hw, _flag) \1224__ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag)12251226/* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */1227CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb));1228#define IEEE80211_SKB_CB(_skb) \1229((struct ieee80211_tx_info *)((_skb)->cb))12301231CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb));1232#define IEEE80211_SKB_RXCB(_skb) \1233((struct ieee80211_rx_status *)((_skb)->cb))12341235static __inline void1236ieee80211_free_hw(struct ieee80211_hw *hw)1237{12381239linuxkpi_ieee80211_iffree(hw);12401241if (hw->wiphy != NULL)1242wiphy_free(hw->wiphy);1243/* Note that *hw is not valid any longer after this. */12441245IMPROVE();1246}12471248static __inline struct ieee80211_hw *1249ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops)1250{12511252return (linuxkpi_ieee80211_alloc_hw(priv_len, ops));1253}12541255static __inline void1256SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)1257{12581259set_wiphy_dev(hw->wiphy, dev);1260linuxkpi_set_ieee80211_dev(hw);12611262IMPROVE();1263}12641265static __inline int1266ieee80211_register_hw(struct ieee80211_hw *hw)1267{1268int error;12691270error = wiphy_register(hw->wiphy);1271if (error != 0)1272return (error);12731274/*1275* At this point the driver has set all the options, flags, bands,1276* ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy1277* setup is done.1278* We need to replicate a lot of information from here into net80211.1279*/1280error = linuxkpi_ieee80211_ifattach(hw);12811282IMPROVE();12831284return (error);1285}12861287static inline void1288ieee80211_unregister_hw(struct ieee80211_hw *hw)1289{12901291linuxkpi_ieee80211_unregister_hw(hw);1292}12931294static __inline struct ieee80211_hw *1295wiphy_to_ieee80211_hw(struct wiphy *wiphy)1296{12971298return (linuxkpi_wiphy_to_ieee80211_hw(wiphy));1299}13001301static inline void1302ieee80211_restart_hw(struct ieee80211_hw *hw)1303{1304linuxkpi_ieee80211_restart_hw(hw);1305}13061307static inline void1308ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif)1309{1310TODO();1311}13121313/* -------------------------------------------------------------------------- */13141315#define link_conf_dereference_check(_vif, _linkid) \1316rcu_dereference_check((_vif)->link_conf[_linkid], true)13171318#define link_conf_dereference_protected(_vif, _linkid) \1319rcu_dereference_protected((_vif)->link_conf[_linkid], true)13201321#define link_sta_dereference_check(_sta, _linkid) \1322rcu_dereference_check((_sta)->link[_linkid], true)13231324#define link_sta_dereference_protected(_sta, _linkid) \1325rcu_dereference_protected((_sta)->link[_linkid], true)13261327#define for_each_vif_active_link(_vif, _link, _linkid) \1328for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++) \1329if ( ((_vif)->active_links == 0 /* no MLO */ || \1330((_vif)->active_links & BIT(_linkid)) != 0) && \1331(_link = rcu_dereference((_vif)->link_conf[_linkid])) )13321333#define for_each_sta_active_link(_vif, _sta, _linksta, _linkid) \1334for (_linkid = 0; _linkid < nitems((_sta)->link); _linkid++) \1335if ( ((_vif)->active_links == 0 /* no MLO */ || \1336((_vif)->active_links & BIT(_linkid)) != 0) && \1337(_linksta = link_sta_dereference_protected((_sta), (_linkid))) )13381339/* -------------------------------------------------------------------------- */13401341static __inline bool1342ieee80211_vif_is_mesh(struct ieee80211_vif *vif)1343{1344TODO();1345return (false);1346}134713481349/* -------------------------------------------------------------------------- */1350/* Receive functions (air/driver to mac80211/net80211). */135113521353static __inline void1354ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,1355struct sk_buff *skb, struct napi_struct *napi)1356{13571358linuxkpi_ieee80211_rx(hw, skb, sta, napi, NULL);1359}13601361static __inline void1362ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,1363struct sk_buff *skb, struct list_head *list)1364{13651366linuxkpi_ieee80211_rx(hw, skb, sta, NULL, list);1367}13681369static __inline void1370ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb)1371{13721373linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);1374}13751376static __inline void1377ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)1378{13791380linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);1381}13821383static __inline void1384ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)1385{13861387linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);1388}13891390/* -------------------------------------------------------------------------- */13911392static inline void1393ieee80211_stop_queues(struct ieee80211_hw *hw)1394{1395linuxkpi_ieee80211_stop_queues(hw);1396}13971398static inline void1399ieee80211_wake_queues(struct ieee80211_hw *hw)1400{1401linuxkpi_ieee80211_wake_queues(hw);1402}14031404static inline void1405ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum)1406{1407linuxkpi_ieee80211_stop_queue(hw, qnum);1408}14091410static inline void1411ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum)1412{1413linuxkpi_ieee80211_wake_queue(hw, qnum);1414}14151416static inline void1417ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)1418{1419linuxkpi_ieee80211_schedule_txq(hw, txq, true);1420}14211422static inline void1423ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,1424bool withoutpkts)1425{1426linuxkpi_ieee80211_schedule_txq(hw, txq, withoutpkts);1427}14281429static inline void1430ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac)1431{1432linuxkpi_ieee80211_txq_schedule_start(hw, ac);1433}14341435static inline void1436ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac)1437{1438/* DO_NADA; */1439}14401441static inline struct ieee80211_txq *1442ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac)1443{1444return (linuxkpi_ieee80211_next_txq(hw, ac));1445}14461447static inline void1448ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,1449struct ieee80211_txq *txq)1450{1451linuxkpi_ieee80211_handle_wake_tx_queue(hw, txq);1452}14531454static inline void1455ieee80211_purge_tx_queue(struct ieee80211_hw *hw,1456struct sk_buff_head *skbs)1457{1458TODO();1459}14601461/* -------------------------------------------------------------------------- */14621463static __inline uint8_t1464ieee80211_get_tid(struct ieee80211_hdr *hdr)1465{14661467return (linuxkpi_ieee80211_get_tid(hdr, false));1468}14691470static __inline struct sk_buff *1471ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif,1472uint16_t *tim_offset, uint16_t *tim_len, uint32_t link_id)1473{14741475if (tim_offset != NULL)1476*tim_offset = 0;1477if (tim_len != NULL)1478*tim_len = 0;1479TODO();1480return (NULL);1481}14821483static __inline void1484ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,1485enum ieee80211_iface_iter flags,1486void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1487void *arg)1488{14891490flags |= IEEE80211_IFACE_ITER__ATOMIC;1491flags |= IEEE80211_IFACE_ITER_ACTIVE;1492linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);1493}14941495static __inline void1496ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,1497enum ieee80211_iface_iter flags,1498void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1499void *arg)1500{15011502flags |= IEEE80211_IFACE_ITER_ACTIVE;1503linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);1504}15051506static __inline void1507ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,1508enum ieee80211_iface_iter flags,1509void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1510void *arg)1511{1512flags |= IEEE80211_IFACE_ITER_ACTIVE;1513flags |= IEEE80211_IFACE_ITER__MTX;1514linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);1515}15161517static __inline void1518ieee80211_iterate_interfaces(struct ieee80211_hw *hw,1519enum ieee80211_iface_iter flags,1520void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1521void *arg)1522{15231524linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);1525}15261527static inline void1528ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif,1529void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,1530struct ieee80211_sta *, struct ieee80211_key_conf *, void *),1531void *arg)1532{1533linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg, false);1534}15351536static inline void1537ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif,1538void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,1539struct ieee80211_sta *, struct ieee80211_key_conf *, void *),1540void *arg)1541{1542linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg, true);1543}15441545static __inline void1546ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw,1547void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *),1548void *arg)1549{15501551linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg);1552}15531554static __inline void1555ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,1556void (*iterfunc)(void *, struct ieee80211_sta *), void *arg)1557{15581559linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg);1560}15611562static __inline struct wireless_dev *1563ieee80211_vif_to_wdev(struct ieee80211_vif *vif)1564{15651566return (linuxkpi_ieee80211_vif_to_wdev(vif));1567}15681569static __inline struct sk_buff *1570ieee80211_beacon_get_template(struct ieee80211_hw *hw,1571struct ieee80211_vif *vif, struct ieee80211_mutable_offsets *offs,1572uint32_t link_id)1573{1574TODO();1575return (NULL);1576}15771578static __inline void1579ieee80211_beacon_loss(struct ieee80211_vif *vif)1580{1581linuxkpi_ieee80211_beacon_loss(vif);1582}15831584static __inline void1585ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t, uint32_t link_id)1586{1587TODO();1588}15891590static __inline bool1591ieee80211_csa_is_complete(struct ieee80211_vif *vif)1592{1593TODO();1594return (false);1595}15961597static __inline void1598ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter)1599{1600TODO();1601}16021603static __inline int1604ieee80211_csa_update_counter(struct ieee80211_vif *vif)1605{1606TODO();1607return (-1);1608}16091610static __inline void1611ieee80211_csa_finish(struct ieee80211_vif *vif, uint32_t link_id)1612{1613TODO();1614}16151616static inline enum nl80211_iftype1617ieee80211_vif_type_p2p(struct ieee80211_vif *vif)1618{16191620/* If we are not p2p enabled, just return the type. */1621if (!vif->p2p)1622return (vif->type);16231624/* If we are p2p, depending on side, return type. */1625switch (vif->type) {1626case NL80211_IFTYPE_AP:1627return (NL80211_IFTYPE_P2P_GO);1628case NL80211_IFTYPE_STATION:1629return (NL80211_IFTYPE_P2P_CLIENT);1630default:1631fallthrough;1632}1633return (vif->type);1634}16351636static __inline unsigned long1637ieee80211_tu_to_usec(unsigned long tu)1638{16391640return (tu * IEEE80211_DUR_TU);1641}16421643/*1644* Below we assume that the two values from different emums are the same.1645* Make sure this does not accidentally change.1646*/1647CTASSERT((int)IEEE80211_ACTION_SM_TPCREP == (int)IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP);16481649static __inline bool1650ieee80211_action_contains_tpc(struct sk_buff *skb)1651{1652struct ieee80211_mgmt *mgmt;16531654mgmt = (struct ieee80211_mgmt *)skb->data;16551656/* Check that this is a mgmt/action frame? */1657if (!ieee80211_is_action(mgmt->frame_control))1658return (false);16591660/*1661* This is a bit convoluted but according to docs both actions1662* are checked for this. Kind-of makes sense for the only consumer1663* (iwlwifi) I am aware off given the txpower fields are at the1664* same location so firmware can update the value.1665*/1666/* 80211-2020 9.6.2 Spectrum Management Action frames */1667/* 80211-2020 9.6.2.5 TPC Report frame format */1668/* 80211-2020 9.6.6 Radio Measurement action details */1669/* 80211-2020 9.6.6.4 Link Measurement Report frame format */1670/* Check that it is Spectrum Management or Radio Measurement? */1671if (mgmt->u.action.category != IEEE80211_ACTION_CAT_SM &&1672mgmt->u.action.category != IEEE80211_ACTION_CAT_RADIO_MEASUREMENT)1673return (false);16741675/*1676* Check that it is TPC Report or Link Measurement Report?1677* The values of each are the same (see CTASSERT above function).1678*/1679if (mgmt->u.action.u.tpc_report.spec_mgmt != IEEE80211_ACTION_SM_TPCREP)1680return (false);16811682/* 80211-2020 9.4.2.16 TPC Report element */1683/* Check that the ELEMID and length are correct? */1684if (mgmt->u.action.u.tpc_report.tpc_elem_id != IEEE80211_ELEMID_TPCREP ||1685mgmt->u.action.u.tpc_report.tpc_elem_length != 4)1686return (false);16871688/* All the right fields in the right place. */1689return (true);1690}16911692static __inline void1693ieee80211_connection_loss(struct ieee80211_vif *vif)1694{16951696linuxkpi_ieee80211_connection_loss(vif);1697}16981699static __inline struct ieee80211_sta *1700ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer)1701{17021703return (linuxkpi_ieee80211_find_sta(vif, peer));1704}17051706static __inline struct ieee80211_sta *1707ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const uint8_t *addr,1708const uint8_t *ourvifaddr)1709{17101711return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr));1712}17131714static __inline size_t1715ieee80211_ie_split(const u8 *ies, size_t ies_len,1716const u8 *ie_ids, size_t ie_ids_len, size_t start)1717{1718size_t x;17191720x = start;17211722/* XXX FIXME, we need to deal with "Element ID Extension" */1723while (x < ies_len) {17241725/* Is this IE[s] one of the ie_ids? */1726if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x],1727ie_ids, ie_ids_len))1728break;17291730if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len))1731break;1732}17331734return (x);1735}17361737static __inline void1738ieee80211_request_smps(struct ieee80211_vif *vif, u_int link_id,1739enum ieee80211_smps_mode smps)1740{1741static const char *smps_mode_name[] = {1742"SMPS_OFF",1743"SMPS_STATIC",1744"SMPS_DYNAMIC",1745"SMPS_AUTOMATIC",1746};17471748if (vif->type != NL80211_IFTYPE_STATION)1749return;17501751if (smps >= nitems(smps_mode_name))1752panic("%s: unsupported smps value: %d\n", __func__, smps);17531754IMPROVE("XXX LKPI80211 TODO smps %d %s\n", smps, smps_mode_name[smps]);1755}17561757static __inline void1758ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr,1759enum nl80211_tdls_operation oper, enum ieee80211_reason_code code,1760gfp_t gfp)1761{1762TODO();1763}17641765static __inline void1766wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state)1767{1768TODO();1769}17701771static __inline void1772ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb)1773{1774IMPROVE();17751776/*1777* This is called on transmit failure.1778* Use a not-so-random random high status error so we can distinguish1779* it from normal low values flying around in net80211 ("ETX").1780*/1781linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458);1782}17831784static __inline void1785ieee80211_ready_on_channel(struct ieee80211_hw *hw)1786{1787TODO();1788/* XXX-BZ We need to see that. */1789}17901791static __inline void1792ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw)1793{1794TODO();1795}17961797static __inline void1798ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,1799enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp)1800{1801TODO();1802}18031804/* -------------------------------------------------------------------------- */18051806static inline bool1807ieee80211_sn_less(uint16_t sn1, uint16_t sn2)1808{1809return (IEEE80211_SEQ_BA_BEFORE(sn1, sn2));1810}18111812static inline uint16_t1813ieee80211_sn_inc(uint16_t sn)1814{1815return (IEEE80211_SEQ_INC(sn));1816}18171818static inline uint16_t1819ieee80211_sn_add(uint16_t sn, uint16_t a)1820{1821return (IEEE80211_SEQ_ADD(sn, a));1822}18231824static inline uint16_t1825ieee80211_sn_sub(uint16_t sa, uint16_t sb)1826{1827return (IEEE80211_SEQ_SUB(sa, sb));1828}18291830static __inline void1831ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid,1832uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu)1833{1834TODO();1835}18361837static __inline void1838ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr)1839{1840TODO();1841}18421843static __inline void1844ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr,1845uint8_t tid)1846{1847TODO();1848}18491850static __inline void1851ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,1852uint8_t tid)1853{1854TODO();1855}18561857static __inline void1858ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,1859uint8_t tid)1860{1861TODO();1862}18631864/* -------------------------------------------------------------------------- */18651866static inline void1867ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint8_t mcs, uint8_t nss)1868{18691870/* XXX-BZ make it KASSERTS? */1871if (((mcs & 0xF0) != 0) || (((nss - 1) & 0xf8) != 0)) {1872printf("%s:%d: mcs %#04x nss %#04x invalid\n",1873__func__, __LINE__, mcs, nss);1874return;1875}18761877r->idx = mcs;1878r->idx |= ((nss - 1) << 4);1879}18801881static inline uint8_t1882ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *r)1883{1884return (((r->idx >> 4) & 0x07) + 1);1885}18861887static inline uint8_t1888ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *r)1889{1890return (r->idx & 0x0f);1891}18921893static inline int1894ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap,1895enum ieee80211_vht_chanwidth chanwidth, /* defined in net80211. */1896int mcs /* always 0 */, bool ext_nss_bw_cap /* always true */, int max_nss)1897{1898enum ieee80211_vht_mcs_support mcs_s;1899uint32_t supp_cw, ext_nss_bw;19001901switch (mcs) {1902case 0 ... 7:1903mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_7;1904break;1905case 8:1906mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_8;1907break;1908case 9:1909mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_9;1910break;1911default:1912printf("%s: unsupported mcs value %d\n", __func__, mcs);1913return (0);1914}19151916if (max_nss == 0) {1917uint16_t map;19181919map = le16toh(vht_cap->supp_mcs.rx_mcs_map);1920for (int i = 7; i >= 0; i--) {1921uint8_t val;19221923val = (map >> (2 * i)) & 0x03;1924if (val == IEEE80211_VHT_MCS_NOT_SUPPORTED)1925continue;1926if (val >= mcs_s) {1927max_nss = i + 1;1928break;1929}1930}1931}19321933if (max_nss == 0)1934return (0);19351936if ((le16toh(vht_cap->supp_mcs.tx_mcs_map) &1937IEEE80211_VHT_EXT_NSS_BW_CAPABLE) == 0)1938return (max_nss);19391940supp_cw = le32_get_bits(vht_cap->vht_cap_info,1941IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK);1942ext_nss_bw = le32_get_bits(vht_cap->vht_cap_info,1943IEEE80211_VHT_CAP_EXT_NSS_BW_MASK);19441945/* If requested as ext nss not supported assume ext_nss_bw 0. */1946if (!ext_nss_bw_cap)1947ext_nss_bw = 0;19481949/*1950* Cover 802.11-2016, Table 9-250.1951*/19521953/* Unsupported settings. */1954if (supp_cw == 3)1955return (0);1956if (supp_cw == 2 && (ext_nss_bw == 1 || ext_nss_bw == 2))1957return (0);19581959/* Settings with factor != 1 or unsupported. */1960switch (chanwidth) {1961case IEEE80211_VHT_CHANWIDTH_80P80MHZ:1962if (supp_cw == 0 && (ext_nss_bw == 0 || ext_nss_bw == 1))1963return (0);1964if (supp_cw == 1 && ext_nss_bw == 0)1965return (0);1966if ((supp_cw == 0 || supp_cw == 1) && ext_nss_bw == 2)1967return (max_nss / 2);1968if ((supp_cw == 0 || supp_cw == 1) && ext_nss_bw == 3)1969return (3 * max_nss / 4);1970break;1971case IEEE80211_VHT_CHANWIDTH_160MHZ:1972if (supp_cw == 0 && ext_nss_bw == 0)1973return (0);1974if (supp_cw == 0 && (ext_nss_bw == 1 || ext_nss_bw == 2))1975return (max_nss / 2);1976if (supp_cw == 0 && ext_nss_bw == 3)1977return (3 * max_nss / 4);1978if (supp_cw == 1 && ext_nss_bw == 3)1979return (2 * max_nss);1980break;1981case IEEE80211_VHT_CHANWIDTH_80MHZ:1982case IEEE80211_VHT_CHANWIDTH_USE_HT:1983if ((supp_cw == 1 || supp_cw == 2) && ext_nss_bw == 3)1984return (2 * max_nss);1985break;1986}19871988/* Everything else has a factor of 1. */1989return (max_nss);1990}199119921993static __inline void1994ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid)1995{1996TODO();1997}19981999static __inline void2000ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid)2001{2002TODO();2003}20042005static __inline void2006ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid)2007{2008TODO();2009}20102011static __inline void2012ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta,2013bool disable)2014{2015TODO();2016}20172018static __inline void2019ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping)2020{2021TODO();2022}20232024static __inline void2025ieee80211_sta_pspoll(struct ieee80211_sta *sta)2026{2027TODO();2028}20292030static inline void2031ieee80211_sta_recalc_aggregates(struct ieee80211_sta *sta)2032{2033if (sta->valid_links) {2034TODO();2035}2036}20372038static __inline void2039ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids)2040{2041TODO();2042}20432044static inline struct sk_buff *2045ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)2046{20472048return (linuxkpi_ieee80211_tx_dequeue(hw, txq));2049}20502051static inline struct sk_buff *2052ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq)2053{2054struct sk_buff *skb;20552056local_bh_disable();2057skb = linuxkpi_ieee80211_tx_dequeue(hw, txq);2058local_bh_enable();20592060return (skb);2061}20622063static __inline void2064ieee80211_update_mu_groups(struct ieee80211_vif *vif,2065u_int _i, uint8_t *ms, uint8_t *up)2066{2067TODO();2068}20692070static __inline void2071ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t)2072{2073TODO();2074}20752076static __inline void2077ieee80211_sched_scan_results(struct ieee80211_hw *hw)2078{2079TODO();2080}20812082static __inline void2083ieee80211_sta_eosp(struct ieee80211_sta *sta)2084{2085TODO();2086}20872088static __inline int2089ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x)2090{2091TODO("rtw8x");2092return (-EINVAL);2093}20942095static __inline int2096ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid)2097{2098TODO("rtw89");2099return (-EINVAL);2100}21012102static __inline void2103ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,2104uint8_t tid)2105{2106TODO("iwlwifi");2107}21082109static __inline void2110ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,2111uint8_t tid)2112{2113TODO("iwlwifi/rtw8x/...");2114}21152116static __inline void2117ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)2118{2119TODO();2120}21212122static __inline void2123ieee80211_scan_completed(struct ieee80211_hw *hw,2124struct cfg80211_scan_info *info)2125{21262127linuxkpi_ieee80211_scan_completed(hw, info);2128}21292130static __inline struct sk_buff *2131ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2132uint32_t link_id)2133{2134TODO();2135return (NULL);2136}21372138static __inline struct sk_buff *2139ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)2140{21412142/* Only STA needs this. Otherwise return NULL and panic bad drivers. */2143if (vif->type != NL80211_IFTYPE_STATION)2144return (NULL);21452146return (linuxkpi_ieee80211_pspoll_get(hw, vif));2147}21482149static __inline struct sk_buff *2150ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)2151{2152TODO();2153return (NULL);2154}21552156static __inline struct sk_buff *2157ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2158int linkid, bool qos)2159{21602161/* Only STA needs this. Otherwise return NULL and panic bad drivers. */2162if (vif->type != NL80211_IFTYPE_STATION)2163return (NULL);21642165return (linuxkpi_ieee80211_nullfunc_get(hw, vif, linkid, qos));2166}21672168static __inline struct sk_buff *2169ieee80211_probereq_get(struct ieee80211_hw *hw, const uint8_t *addr,2170const uint8_t *ssid, size_t ssid_len, size_t tailroom)2171{21722173return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len,2174tailroom));2175}21762177static __inline void2178ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w,2179int delay)2180{21812182linuxkpi_ieee80211_queue_delayed_work(hw, w, delay);2183}21842185static __inline void2186ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w)2187{21882189linuxkpi_ieee80211_queue_work(hw, w);2190}21912192static __inline bool2193ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2194struct sk_buff *skb, enum nl80211_band band, struct ieee80211_sta **sta)2195{2196TODO();2197return (false);2198}21992200static __inline void2201ieee80211_tx_status_skb(struct ieee80211_hw *hw, struct sk_buff *skb)2202{2203linuxkpi_ieee80211_tx_status(hw, skb);2204}22052206static inline void2207ieee80211_tx_status_noskb(struct ieee80211_hw *hw, struct ieee80211_sta *sta,2208struct ieee80211_tx_info *info)2209{2210TODO();2211}22122213static __inline void2214ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)2215{2216IMPROVE();2217linuxkpi_ieee80211_tx_status(hw, skb);2218}22192220static __inline void2221ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb)2222{2223IMPROVE();2224linuxkpi_ieee80211_tx_status(hw, skb);2225}22262227static __inline void2228ieee80211_tx_status_ext(struct ieee80211_hw *hw,2229struct ieee80211_tx_status *txstat)2230{22312232linuxkpi_ieee80211_tx_status_ext(hw, txstat);2233}22342235static __inline void2236ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)2237{2238int i;22392240/*2241* Apparently clearing flags and some other fields is not right.2242* Given the function is called "status" we work on that part of2243* the union.2244*/2245for (i = 0; i < nitems(info->status.rates); i++)2246info->status.rates[i].count = 0;2247/*2248* Unclear if ack_signal should be included or not but we clear the2249* "valid" bool so this field is no longer valid.2250*/2251memset(&info->status.ack_signal, 0, sizeof(*info) -2252offsetof(struct ieee80211_tx_info, status.ack_signal));2253}22542255static __inline void2256ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt,2257unsigned long *byte_cnt)2258{22592260if (frame_cnt == NULL && byte_cnt == NULL)2261return;22622263linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt);2264}22652266static __inline void2267SET_IEEE80211_PERM_ADDR (struct ieee80211_hw *hw, uint8_t *addr)2268{22692270ether_addr_copy(hw->wiphy->perm_addr, addr);2271}22722273static __inline void2274ieee80211_report_low_ack(struct ieee80211_sta *sta, int x)2275{2276TODO();2277}22782279static __inline void2280ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta,2281struct ieee80211_tx_info *info)2282{2283TODO();2284}22852286static __inline bool2287ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq)2288{2289TODO();2290return (false);2291}22922293static __inline void2294ieee80211_radar_detected(struct ieee80211_hw *hw,2295struct ieee80211_chanctx_conf *chanctx_conf)2296{2297TODO();2298}22992300static __inline void2301ieee80211_sta_register_airtime(struct ieee80211_sta *sta,2302uint8_t tid, uint32_t duration, int x)2303{2304TODO();2305}23062307static __inline void2308ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter)2309{2310TODO();2311}23122313static __inline int2314ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif, uint32_t link_id)2315{2316TODO();2317return (-1);2318}23192320static __inline bool2321ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif, uint32_t link_id)2322{2323TODO();2324return (true);2325}23262327static __inline void2328ieee80211_disconnect(struct ieee80211_vif *vif, bool _x)2329{2330TODO();2331}23322333static __inline void2334ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif)2335{2336TODO();2337}23382339static __inline uint32_t2340ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,2341struct ieee80211_rx_status *rxstat, int len)2342{2343TODO();2344return (0);2345}23462347static __inline void2348ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,2349struct sk_buff *skb, struct ieee80211_tx_rate *txrate, int nrates)2350{2351TODO();2352}23532354static __inline void2355ieee80211_color_change_finish(struct ieee80211_vif *vif, uint8_t link_id)2356{2357TODO();2358}23592360static __inline struct sk_buff *2361ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,2362struct ieee80211_vif *vif)2363{2364TODO();2365return (NULL);2366}23672368static __inline struct sk_buff *2369ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,2370struct ieee80211_vif *vif)2371{2372TODO();2373return (NULL);2374}23752376static __inline void2377linuxkpi_ieee80211_send_bar(struct ieee80211_vif *vif, uint8_t *ra, uint16_t tid,2378uint16_t ssn)2379{2380TODO();2381}23822383static __inline void2384ieee80211_resume_disconnect(struct ieee80211_vif *vif)2385{2386TODO();2387}23882389static __inline int2390ieee80211_data_to_8023(struct sk_buff *skb, const uint8_t *addr,2391enum nl80211_iftype iftype)2392{2393TODO();2394return (-1);2395}23962397/* -------------------------------------------------------------------------- */23982399static __inline void2400ieee80211_key_mic_failure(struct ieee80211_key_conf *key)2401{2402TODO();2403}24042405static __inline void2406ieee80211_key_replay(struct ieee80211_key_conf *key)2407{2408TODO();2409}24102411static __inline void2412ieee80211_remove_key(struct ieee80211_key_conf *key)2413{2414TODO();2415}24162417static __inline struct ieee80211_key_conf *2418ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,2419struct ieee80211_key_conf *key, int link_id)2420{2421TODO();2422return (NULL);2423}24242425static __inline void2426ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid,2427const uint8_t *replay_ctr, gfp_t gfp)2428{2429TODO();2430}24312432static __inline void2433ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf,2434uint64_t pn)2435{2436TODO();2437}24382439static __inline void2440ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,2441const u8 *addr, uint32_t iv32, u16 *p1k)2442{24432444KASSERT(keyconf != NULL && addr != NULL && p1k != NULL,2445("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k));24462447TODO();2448memset(p1k, 0xfa, 5 * sizeof(*p1k)); /* Just initializing. */2449}24502451static __inline void2452ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key,2453uint32_t iv32, uint16_t *p1k)2454{2455TODO();2456}24572458static __inline void2459ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,2460struct sk_buff *skb_frag, u8 *key)2461{2462TODO();2463}24642465static inline void2466ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, int8_t tid,2467struct ieee80211_key_seq *seq)2468{2469const struct ieee80211_key *k;2470const uint8_t *p;24712472KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n",2473__func__, keyconf, seq));2474k = keyconf->_k;2475KASSERT(k != NULL, ("%s: keyconf %p ieee80211_key is NULL\n", __func__, keyconf));24762477switch (keyconf->cipher) {2478case WLAN_CIPHER_SUITE_TKIP:2479if (tid < 0 || tid >= IEEE80211_NUM_TIDS)2480return;2481/* See net80211::tkip_decrypt() */2482seq->tkip.iv32 = TKIP_PN_TO_IV32(k->wk_keyrsc[tid]);2483seq->tkip.iv16 = TKIP_PN_TO_IV16(k->wk_keyrsc[tid]);2484break;2485case WLAN_CIPHER_SUITE_CCMP:2486case WLAN_CIPHER_SUITE_CCMP_256:2487if (tid < -1 || tid >= IEEE80211_NUM_TIDS)2488return;2489if (tid == -1)2490p = (const uint8_t *)&k->wk_keyrsc[IEEE80211_NUM_TIDS]; /* IEEE80211_NONQOS_TID */2491else2492p = (const uint8_t *)&k->wk_keyrsc[tid];2493memcpy(seq->ccmp.pn, p, sizeof(seq->ccmp.pn));2494break;2495case WLAN_CIPHER_SUITE_GCMP:2496case WLAN_CIPHER_SUITE_GCMP_256:2497if (tid < -1 || tid >= IEEE80211_NUM_TIDS)2498return;2499if (tid == -1)2500p = (const uint8_t *)&k->wk_keyrsc[IEEE80211_NUM_TIDS]; /* IEEE80211_NONQOS_TID */2501else2502p = (const uint8_t *)&k->wk_keyrsc[tid];2503memcpy(seq->gcmp.pn, p, sizeof(seq->gcmp.pn));2504break;2505case WLAN_CIPHER_SUITE_AES_CMAC:2506case WLAN_CIPHER_SUITE_BIP_CMAC_256:2507TODO();2508memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn)); /* XXX TODO */2509break;2510case WLAN_CIPHER_SUITE_BIP_GMAC_128:2511case WLAN_CIPHER_SUITE_BIP_GMAC_256:2512TODO();2513memset(seq->aes_gmac.pn, 0xfa, sizeof(seq->aes_gmac.pn)); /* XXX TODO */2514break;2515default:2516pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher);2517break;2518}2519}25202521static __inline void2522ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid,2523struct ieee80211_key_seq *seq)2524{2525TODO();2526}25272528/* -------------------------------------------------------------------------- */25292530static __inline void2531ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,2532struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp)2533{2534TODO();2535}25362537static __inline void2538ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,2539uint64_t obss_color_bitmap, gfp_t gfp)2540{2541TODO();2542}25432544static __inline void2545ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,2546uint8_t tid)2547{2548TODO();2549}25502551static __inline struct ieee80211_ema_beacons *2552ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,2553struct ieee80211_vif *vif, uint32_t link_id)2554{2555TODO();2556return (NULL);2557}25582559static __inline void2560ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *bcns)2561{2562TODO();2563}25642565static inline bool2566ieee80211_vif_is_mld(const struct ieee80211_vif *vif)2567{25682569/* If valid_links is non-zero, the vif is an MLD. */2570return (vif->valid_links != 0);2571}25722573static inline const struct ieee80211_sta_he_cap *2574ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band,2575struct ieee80211_vif *vif)2576{2577enum nl80211_iftype iftype;25782579iftype = ieee80211_vif_type_p2p(vif);2580return (ieee80211_get_he_iftype_cap(band, iftype));2581}25822583static inline const struct ieee80211_sta_eht_cap *2584ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band,2585struct ieee80211_vif *vif)2586{2587enum nl80211_iftype iftype;25882589iftype = ieee80211_vif_type_p2p(vif);2590return (ieee80211_get_eht_iftype_cap(band, iftype));2591}25922593static inline uint32_t2594ieee80211_vif_usable_links(const struct ieee80211_vif *vif)2595{2596IMPROVE("MLO usable links likely are not just valid");2597return (vif->valid_links);2598}25992600static inline bool2601ieee80211_vif_link_active(const struct ieee80211_vif *vif, uint8_t link_id)2602{2603if (ieee80211_vif_is_mld(vif))2604return (vif->active_links & BIT(link_id));2605return (link_id == 0);2606}26072608static inline void2609ieee80211_set_active_links_async(struct ieee80211_vif *vif,2610uint32_t new_active_links)2611{2612TODO();2613}26142615static inline int2616ieee80211_set_active_links(struct ieee80211_vif *vif,2617uint32_t active_links)2618{2619TODO();2620return (-ENXIO);2621}26222623static inline void2624ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp __unused)2625{2626IMPROVE("we notify user space by a vap state change eventually");2627linuxkpi_ieee80211_beacon_loss(vif);2628}26292630#define ieee80211_send_bar(_v, _r, _t, _s) \2631linuxkpi_ieee80211_send_bar(_v, _r, _t, _s)26322633/* -------------------------------------------------------------------------- */26342635int lkpi_80211_update_chandef(struct ieee80211_hw *,2636struct ieee80211_chanctx_conf *);26372638static inline int2639ieee80211_emulate_add_chanctx(struct ieee80211_hw *hw,2640struct ieee80211_chanctx_conf *chanctx_conf)2641{2642int error;26432644hw->conf.radar_enabled = chanctx_conf->radar_enabled;2645error = lkpi_80211_update_chandef(hw, chanctx_conf);2646return (error);2647}26482649static inline void2650ieee80211_emulate_remove_chanctx(struct ieee80211_hw *hw,2651struct ieee80211_chanctx_conf *chanctx_conf __unused)2652{2653hw->conf.radar_enabled = false;2654lkpi_80211_update_chandef(hw, NULL);2655}26562657static inline void2658ieee80211_emulate_change_chanctx(struct ieee80211_hw *hw,2659struct ieee80211_chanctx_conf *chanctx_conf, uint32_t changed __unused)2660{2661hw->conf.radar_enabled = chanctx_conf->radar_enabled;2662lkpi_80211_update_chandef(hw, chanctx_conf);2663}26642665static inline int2666ieee80211_emulate_switch_vif_chanctx(struct ieee80211_hw *hw,2667struct ieee80211_vif_chanctx_switch *vifs, int n_vifs,2668enum ieee80211_chanctx_switch_mode mode __unused)2669{2670struct ieee80211_chanctx_conf *chanctx_conf;2671int error;26722673/* Sanity check. */2674if (n_vifs <= 0)2675return (-EINVAL);2676if (vifs == NULL || vifs[0].new_ctx == NULL)2677return (-EINVAL);26782679/*2680* What to do if n_vifs > 1?2681* Does that make sense for drivers not supporting chanctx?2682*/2683hw->conf.radar_enabled = vifs[0].new_ctx->radar_enabled;2684chanctx_conf = vifs[0].new_ctx;2685error = lkpi_80211_update_chandef(hw, chanctx_conf);2686return (error);2687}26882689/* -------------------------------------------------------------------------- */26902691#endif /* _LINUXKPI_NET_MAC80211_H */269226932694