Path: blob/main/sys/compat/linuxkpi/common/include/net/mac80211.h
104102 views
/*-1* Copyright (c) 2020-2026 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#define WLAN_AKM_SUITE_FT_OVER_SAE WLAN_AKM_SUITE(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};790791enum mac80211_rate_control_flags {792IEEE80211_TX_RC_40_MHZ_WIDTH = BIT(0),793IEEE80211_TX_RC_80_MHZ_WIDTH = BIT(1),794IEEE80211_TX_RC_160_MHZ_WIDTH = BIT(2),795IEEE80211_TX_RC_GREEN_FIELD = BIT(3),796IEEE80211_TX_RC_MCS = BIT(4),797IEEE80211_TX_RC_SHORT_GI = BIT(5),798IEEE80211_TX_RC_VHT_MCS = BIT(6),799IEEE80211_TX_RC_USE_SHORT_PREAMBLE = BIT(7),800};801802struct ieee80211_tx_rate {803uint8_t idx;804uint16_t count:5,805flags:11; /* enum mac80211_rate_control_flags */806};807808enum ieee80211_vif_driver_flags {809IEEE80211_VIF_BEACON_FILTER = BIT(0),810IEEE80211_VIF_SUPPORTS_CQM_RSSI = BIT(1),811IEEE80211_VIF_SUPPORTS_UAPSD = BIT(2),812#if defined(LINUXKPI_VERSION) && (LINUXKPI_VERSION < 60600) /* v6.6 */813IEEE80211_VIF_DISABLE_SMPS_OVERRIDE = BIT(3), /* Renamed to IEEE80211_VIF_EML_ACTIVE. */814#endif815IEEE80211_VIF_EML_ACTIVE = BIT(4),816IEEE80211_VIF_IGNORE_OFDMA_WIDER_BW = BIT(5),817IEEE80211_VIF_REMOVE_AP_AFTER_DISASSOC = BIT(6),818};819820#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4821822struct ieee80211_vif_cfg {823uint16_t aid;824uint16_t eml_cap;825uint16_t eml_med_sync_delay;826bool assoc;827bool ps;828bool idle;829bool ibss_joined;830int arp_addr_cnt;831size_t ssid_len;832uint32_t arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN]; /* big endian */833uint8_t ssid[IEEE80211_NWID_LEN];834uint8_t ap_addr[ETH_ALEN];835};836837enum ieee80211_offload_flags {838IEEE80211_OFFLOAD_ENCAP_4ADDR,839IEEE80211_OFFLOAD_ENCAP_ENABLED,840IEEE80211_OFFLOAD_DECAP_ENABLED,841};842843struct ieee80211_vif {844/* TODO FIXME */845enum nl80211_iftype type;846int cab_queue;847int offload_flags; /* enum ieee80211_offload_flags */848enum ieee80211_vif_driver_flags driver_flags;849bool p2p;850bool probe_req_reg;851uint8_t addr[ETH_ALEN];852struct ieee80211_vif_cfg cfg;853struct ieee80211_txq *txq;854struct ieee80211_bss_conf bss_conf;855struct ieee80211_bss_conf *link_conf[IEEE80211_MLD_MAX_NUM_LINKS]; /* rcu? */856uint8_t hw_queue[IEEE80211_NUM_ACS];857uint16_t active_links;858uint16_t valid_links;859struct ieee80211_vif *mbssid_tx_vif;860861/* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change structure depending on compile-time option. */862struct dentry *debugfs_dir;863/* #endif */864865/* Must stay last. */866uint8_t drv_priv[0] __aligned(CACHE_LINE_SIZE);867};868869struct ieee80211_vif_chanctx_switch {870struct ieee80211_chanctx_conf *old_ctx, *new_ctx;871struct ieee80211_vif *vif;872struct ieee80211_bss_conf *link_conf;873};874875struct ieee80211_prep_tx_info {876uint16_t duration;877uint16_t subtype;878bool success;879bool was_assoc;880int link_id;881};882883/* XXX-BZ too big, over-reduce size to u8, and array sizes to minuimum to fit in skb->cb. */884/* Also warning: some sizes change by pointer size! This is 64bit only. */885struct ieee80211_tx_info {886enum ieee80211_tx_info_flags flags; /* 32 bits */887/* TODO FIXME */888enum nl80211_band band; /* 3 bits */889uint16_t hw_queue:4, /* 4 bits */890tx_time_est:10; /* 10 bits */891union {892struct {893struct ieee80211_tx_rate rates[4];894bool use_rts;895uint8_t antennas:2;896struct ieee80211_vif *vif;897struct ieee80211_key_conf *hw_key;898enum ieee80211_tx_control_flags flags;899} control;900struct {901struct ieee80211_tx_rate rates[4];902uint32_t ack_signal;903uint8_t ampdu_ack_len;904uint8_t ampdu_len;905uint8_t antenna;906uint16_t tx_time;907uint8_t flags;908void *status_driver_data[16 / sizeof(void *)]; /* XXX TODO */909} status;910#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40911void *driver_data[IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];912};913};914915/* net80211 conflict */916struct linuxkpi_ieee80211_tim_ie {917uint8_t dtim_count;918uint8_t dtim_period;919uint8_t bitmap_ctrl;920uint8_t *virtual_map;921};922#define ieee80211_tim_ie linuxkpi_ieee80211_tim_ie923924enum ieee80211_iface_iter {925IEEE80211_IFACE_ITER_NORMAL = BIT(0),926IEEE80211_IFACE_ITER_RESUME_ALL = BIT(1),927IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER = BIT(2), /* seems to be an iter flag */928IEEE80211_IFACE_ITER_ACTIVE = BIT(3),929930/* Internal flags only. */931IEEE80211_IFACE_ITER__ATOMIC = BIT(6),932IEEE80211_IFACE_ITER__MTX = BIT(8),933};934935enum set_key_cmd {936SET_KEY,937DISABLE_KEY,938};939940/* 802.11-2020, 9.4.2.55.2 HT Capability Information field. */941enum rx_enc_flags {942RX_ENC_FLAG_SHORTPRE = BIT(0),943RX_ENC_FLAG_SHORT_GI = BIT(2),944RX_ENC_FLAG_HT_GF = BIT(3),945RX_ENC_FLAG_STBC_MASK = BIT(4) | BIT(5),946#define RX_ENC_FLAG_STBC_SHIFT 4947RX_ENC_FLAG_LDPC = BIT(6),948RX_ENC_FLAG_BF = BIT(7),949};950951enum sta_notify_cmd {952STA_NOTIFY_AWAKE,953STA_NOTIFY_SLEEP,954};955956struct ieee80211_low_level_stats {957/* Can we make them uint64_t? */958uint32_t dot11ACKFailureCount;959uint32_t dot11FCSErrorCount;960uint32_t dot11RTSFailureCount;961uint32_t dot11RTSSuccessCount;962};963964struct ieee80211_ops {965/* TODO FIXME */966int (*start)(struct ieee80211_hw *);967void (*stop)(struct ieee80211_hw *, bool);968969int (*config)(struct ieee80211_hw *, int, u32);970void (*reconfig_complete)(struct ieee80211_hw *, enum ieee80211_reconfig_type);971972void (*prep_add_interface)(struct ieee80211_hw *, enum nl80211_iftype);973int (*add_interface)(struct ieee80211_hw *, struct ieee80211_vif *);974void (*remove_interface)(struct ieee80211_hw *, struct ieee80211_vif *);975int (*change_interface)(struct ieee80211_hw *, struct ieee80211_vif *, enum nl80211_iftype, bool);976977void (*sw_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, const u8 *);978void (*sw_scan_complete)(struct ieee80211_hw *, struct ieee80211_vif *);979int (*sched_scan_start)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_sched_scan_request *, struct ieee80211_scan_ies *);980int (*sched_scan_stop)(struct ieee80211_hw *, struct ieee80211_vif *);981int (*hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_scan_request *);982void (*cancel_hw_scan)(struct ieee80211_hw *, struct ieee80211_vif *);983984int (*conf_tx)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u16, const struct ieee80211_tx_queue_params *);985void (*tx)(struct ieee80211_hw *, struct ieee80211_tx_control *, struct sk_buff *);986int (*tx_last_beacon)(struct ieee80211_hw *);987void (*wake_tx_queue)(struct ieee80211_hw *, struct ieee80211_txq *);988989void (*mgd_prepare_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);990void (*mgd_complete_tx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_prep_tx_info *);991void (*mgd_protect_tdls_discover)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int);992993void (*flush)(struct ieee80211_hw *, struct ieee80211_vif *, u32, bool);994void (*flush_sta)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);995996int (*set_frag_threshold)(struct ieee80211_hw *, int, u32);997998void (*sync_rx_queues)(struct ieee80211_hw *);9991000void (*allow_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);1001void (*release_buffered_frames)(struct ieee80211_hw *, struct ieee80211_sta *, u16, int, enum ieee80211_frame_release_type, bool);10021003int (*sta_add)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1004int (*sta_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1005int (*sta_set_txpwr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1006void (*sta_statistics)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct station_info *);1007void (*sta_pre_rcu_remove)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1008int (*sta_state)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, enum ieee80211_sta_state, enum ieee80211_sta_state);1009void (*sta_notify)(struct ieee80211_hw *, struct ieee80211_vif *, enum sta_notify_cmd, struct ieee80211_sta *);1010void (*sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u32);1011void (*link_sta_rc_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_link_sta *, u32);1012void (*sta_rate_tbl_update)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1013void (*sta_set_4addr)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);1014void (*sta_set_decap_offload)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, bool);10151016u64 (*prepare_multicast)(struct ieee80211_hw *, struct netdev_hw_addr_list *);10171018int (*ampdu_action)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_ampdu_params *);10191020bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *, struct sk_buff *, struct sk_buff *);10211022int (*pre_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);1023int (*post_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *);1024void (*channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);1025void (*channel_switch_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_chan_def *);1026void (*abort_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *);1027void (*channel_switch_rx_beacon)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel_switch *);1028int (*tdls_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8, struct cfg80211_chan_def *, struct sk_buff *, u32);1029void (*tdls_cancel_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *);1030void (*tdls_recv_channel_switch)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_tdls_ch_sw_params *);10311032int (*add_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);1033void (*remove_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *);1034void (*change_chanctx)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, u32);1035int (*assign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);1036void (*unassign_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct ieee80211_chanctx_conf *);1037int (*switch_vif_chanctx)(struct ieee80211_hw *, struct ieee80211_vif_chanctx_switch *, int, enum ieee80211_chanctx_switch_mode);10381039int (*get_antenna)(struct ieee80211_hw *, int, u32 *, u32 *);1040int (*set_antenna)(struct ieee80211_hw *, int, u32, u32);10411042int (*remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_channel *, int, enum ieee80211_roc_type);1043int (*cancel_remain_on_channel)(struct ieee80211_hw *, struct ieee80211_vif *);10441045void (*configure_filter)(struct ieee80211_hw *, unsigned int, unsigned int *, u64);1046void (*config_iface_filter)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, unsigned int);10471048void (*bss_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);1049void (*link_info_changed)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, u64);10501051int (*set_rts_threshold)(struct ieee80211_hw *, int, u32);1052void (*event_callback)(struct ieee80211_hw *, struct ieee80211_vif *, const struct ieee80211_event *);1053int (*get_survey)(struct ieee80211_hw *, int, struct survey_info *);1054int (*get_ftm_responder_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_ftm_responder_stats *);10551056uint64_t (*get_tsf)(struct ieee80211_hw *, struct ieee80211_vif *);1057void (*set_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, uint64_t);1058void (*offset_tsf)(struct ieee80211_hw *, struct ieee80211_vif *, s64);10591060int (*set_bitrate_mask)(struct ieee80211_hw *, struct ieee80211_vif *, const struct cfg80211_bitrate_mask *);1061void (*set_coverage_class)(struct ieee80211_hw *, int, s16);1062int (*set_tim)(struct ieee80211_hw *, struct ieee80211_sta *, bool);10631064int (*set_key)(struct ieee80211_hw *, enum set_key_cmd, struct ieee80211_vif *, struct ieee80211_sta *, struct ieee80211_key_conf *);1065void (*update_tkip_key)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_key_conf *, struct ieee80211_sta *, u32, u16 *);10661067int (*start_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);1068void (*abort_pmsr)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_pmsr_request *);10691070int (*start_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);1071void (*stop_ap)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *link_conf);1072int (*join_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);1073void (*leave_ibss)(struct ieee80211_hw *, struct ieee80211_vif *);10741075int (*set_sar_specs)(struct ieee80211_hw *, const struct cfg80211_sar_specs *);10761077int (*set_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct cfg80211_tid_config *);1078int (*reset_tid_config)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u8);10791080int (*get_et_sset_count)(struct ieee80211_hw *, struct ieee80211_vif *, int);1081void (*get_et_stats)(struct ieee80211_hw *, struct ieee80211_vif *, struct ethtool_stats *, u64 *);1082void (*get_et_strings)(struct ieee80211_hw *, struct ieee80211_vif *, u32, u8 *);10831084void (*update_vif_offload)(struct ieee80211_hw *, struct ieee80211_vif *);10851086int (*get_txpower)(struct ieee80211_hw *, struct ieee80211_vif *, unsigned int, int *);1087int (*get_stats)(struct ieee80211_hw *, struct ieee80211_low_level_stats *);10881089int (*set_radar_background)(struct ieee80211_hw *, struct cfg80211_chan_def *);10901091void (*add_twt_setup)(struct ieee80211_hw *, struct ieee80211_sta *, struct ieee80211_twt_setup *);1092void (*twt_teardown_request)(struct ieee80211_hw *, struct ieee80211_sta *, u8);10931094int (*set_hw_timestamp)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_set_hw_timestamp *);10951096void (*vif_cfg_changed)(struct ieee80211_hw *, struct ieee80211_vif *, u64);10971098int (*change_vif_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16, u16, struct ieee80211_bss_conf *[IEEE80211_MLD_MAX_NUM_LINKS]);1099int (*change_sta_links)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, u16, u16);1100bool (*can_activate_links)(struct ieee80211_hw *, struct ieee80211_vif *, u16);1101enum ieee80211_neg_ttlm_res (*can_neg_ttlm)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_neg_ttlm *);11021103void (*rfkill_poll)(struct ieee80211_hw *);11041105int (*net_fill_forward_path)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct net_device_path_ctx *, struct net_device_path *);11061107/* #ifdef CONFIG_MAC80211_DEBUGFS */ /* Do not change depending on compile-time option. */1108void (*sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_sta *, struct dentry *);1109void (*vif_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *);1110void (*link_sta_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_link_sta *, struct dentry *);1111void (*link_add_debugfs)(struct ieee80211_hw *, struct ieee80211_vif *, struct ieee80211_bss_conf *, struct dentry *);1112/* #endif */1113/* #ifdef CONFIG_PM_SLEEP */ /* Do not change depending on compile-time option. */1114int (*suspend)(struct ieee80211_hw *, struct cfg80211_wowlan *);1115int (*resume)(struct ieee80211_hw *);1116void (*set_wakeup)(struct ieee80211_hw *, bool);1117void (*set_rekey_data)(struct ieee80211_hw *, struct ieee80211_vif *, struct cfg80211_gtk_rekey_data *);1118void (*set_default_unicast_key)(struct ieee80211_hw *, struct ieee80211_vif *, int);1119/* #if IS_ENABLED(CONFIG_IPV6) */1120void (*ipv6_addr_change)(struct ieee80211_hw *, struct ieee80211_vif *, struct inet6_dev *);1121/* #endif */1122/* #endif CONFIG_PM_SLEEP */1123};11241125/* -------------------------------------------------------------------------- */11261127/* linux_80211.c */1128extern const struct cfg80211_ops linuxkpi_mac80211cfgops;11291130struct ieee80211_hw *linuxkpi_ieee80211_alloc_hw(size_t,1131const struct ieee80211_ops *);1132void linuxkpi_ieee80211_iffree(struct ieee80211_hw *);1133void linuxkpi_set_ieee80211_dev(struct ieee80211_hw *);1134int linuxkpi_ieee80211_ifattach(struct ieee80211_hw *);1135void linuxkpi_ieee80211_ifdetach(struct ieee80211_hw *);1136void linuxkpi_ieee80211_unregister_hw(struct ieee80211_hw *);1137struct ieee80211_hw * linuxkpi_wiphy_to_ieee80211_hw(struct wiphy *);1138void linuxkpi_ieee80211_restart_hw(struct ieee80211_hw *);1139void linuxkpi_ieee80211_iterate_interfaces(1140struct ieee80211_hw *hw, enum ieee80211_iface_iter flags,1141void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1142void *);1143void linuxkpi_ieee80211_iterate_keys(struct ieee80211_hw *,1144struct ieee80211_vif *,1145void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,1146struct ieee80211_sta *, struct ieee80211_key_conf *, void *),1147void *, bool);1148void linuxkpi_ieee80211_iterate_chan_contexts(struct ieee80211_hw *,1149void(*iterfunc)(struct ieee80211_hw *,1150struct ieee80211_chanctx_conf *, void *),1151void *);1152void linuxkpi_ieee80211_iterate_stations_atomic(struct ieee80211_hw *,1153void (*iterfunc)(void *, struct ieee80211_sta *), void *);1154void linuxkpi_ieee80211_scan_completed(struct ieee80211_hw *,1155struct cfg80211_scan_info *);1156void linuxkpi_ieee80211_rx(struct ieee80211_hw *, struct sk_buff *,1157struct ieee80211_sta *, struct napi_struct *, struct list_head *);1158uint8_t linuxkpi_ieee80211_get_tid(struct ieee80211_hdr *, bool);1159struct ieee80211_sta *linuxkpi_ieee80211_find_sta(struct ieee80211_vif *,1160const u8 *);1161struct ieee80211_sta *linuxkpi_ieee80211_find_sta_by_ifaddr(1162struct ieee80211_hw *, const uint8_t *, const uint8_t *);1163struct sk_buff *linuxkpi_ieee80211_tx_dequeue(struct ieee80211_hw *,1164struct ieee80211_txq *);1165bool linuxkpi_ieee80211_is_ie_id_in_ie_buf(const u8, const u8 *, size_t);1166bool linuxkpi_ieee80211_ie_advance(size_t *, const u8 *, size_t);1167void linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *, struct sk_buff *,1168int);1169void linuxkpi_ieee80211_queue_delayed_work(struct ieee80211_hw *,1170struct delayed_work *, int);1171void linuxkpi_ieee80211_queue_work(struct ieee80211_hw *, struct work_struct *);1172struct sk_buff *linuxkpi_ieee80211_pspoll_get(struct ieee80211_hw *,1173struct ieee80211_vif *);1174struct sk_buff *linuxkpi_ieee80211_nullfunc_get(struct ieee80211_hw *,1175struct ieee80211_vif *, int, bool);1176void linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *, unsigned long *,1177unsigned long *);1178struct wireless_dev *linuxkpi_ieee80211_vif_to_wdev(struct ieee80211_vif *);1179void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *);1180void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *);1181struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *,1182const uint8_t *, const uint8_t *, size_t, size_t);1183void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *);1184void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *,1185struct ieee80211_tx_status *);1186void linuxkpi_ieee80211_stop_queues(struct ieee80211_hw *);1187void linuxkpi_ieee80211_wake_queues(struct ieee80211_hw *);1188void linuxkpi_ieee80211_stop_queue(struct ieee80211_hw *, int);1189void linuxkpi_ieee80211_wake_queue(struct ieee80211_hw *, int);1190void linuxkpi_ieee80211_txq_schedule_start(struct ieee80211_hw *, uint8_t);1191struct ieee80211_txq *linuxkpi_ieee80211_next_txq(struct ieee80211_hw *, uint8_t);1192void linuxkpi_ieee80211_schedule_txq(struct ieee80211_hw *,1193struct ieee80211_txq *, bool);1194void linuxkpi_ieee80211_handle_wake_tx_queue(struct ieee80211_hw *,1195struct ieee80211_txq *);11961197/* -------------------------------------------------------------------------- */11981199static __inline void1200_ieee80211_hw_set(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)1201{12021203set_bit(flag, hw->flags);1204}12051206static __inline bool1207__ieee80211_hw_check(struct ieee80211_hw *hw, enum ieee80211_hw_flags flag)1208{12091210return (test_bit(flag, hw->flags));1211}12121213/* They pass in shortened flag names; how confusingly inconsistent. */1214#define ieee80211_hw_set(_hw, _flag) \1215_ieee80211_hw_set(_hw, IEEE80211_HW_ ## _flag)1216#define ieee80211_hw_check(_hw, _flag) \1217__ieee80211_hw_check(_hw, IEEE80211_HW_ ## _flag)12181219/* XXX-BZ add CTASSERTS that size of struct is <= sizeof skb->cb. */1220CTASSERT(sizeof(struct ieee80211_tx_info) <= sizeof(((struct sk_buff *)0)->cb));1221#define IEEE80211_SKB_CB(_skb) \1222((struct ieee80211_tx_info *)((_skb)->cb))12231224CTASSERT(sizeof(struct ieee80211_rx_status) <= sizeof(((struct sk_buff *)0)->cb));1225#define IEEE80211_SKB_RXCB(_skb) \1226((struct ieee80211_rx_status *)((_skb)->cb))12271228static __inline void1229ieee80211_free_hw(struct ieee80211_hw *hw)1230{12311232linuxkpi_ieee80211_iffree(hw);12331234if (hw->wiphy != NULL)1235wiphy_free(hw->wiphy);1236/* Note that *hw is not valid any longer after this. */12371238IMPROVE();1239}12401241static __inline struct ieee80211_hw *1242ieee80211_alloc_hw(size_t priv_len, const struct ieee80211_ops *ops)1243{12441245return (linuxkpi_ieee80211_alloc_hw(priv_len, ops));1246}12471248static __inline void1249SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)1250{12511252set_wiphy_dev(hw->wiphy, dev);1253linuxkpi_set_ieee80211_dev(hw);12541255IMPROVE();1256}12571258static __inline int1259ieee80211_register_hw(struct ieee80211_hw *hw)1260{1261int error;12621263error = wiphy_register(hw->wiphy);1264if (error != 0)1265return (error);12661267/*1268* At this point the driver has set all the options, flags, bands,1269* ciphers, hw address(es), ... basically mac80211/cfg80211 hw/wiphy1270* setup is done.1271* We need to replicate a lot of information from here into net80211.1272*/1273error = linuxkpi_ieee80211_ifattach(hw);12741275IMPROVE();12761277return (error);1278}12791280static inline void1281ieee80211_unregister_hw(struct ieee80211_hw *hw)1282{12831284linuxkpi_ieee80211_unregister_hw(hw);1285}12861287static __inline struct ieee80211_hw *1288wiphy_to_ieee80211_hw(struct wiphy *wiphy)1289{12901291return (linuxkpi_wiphy_to_ieee80211_hw(wiphy));1292}12931294static inline void1295ieee80211_restart_hw(struct ieee80211_hw *hw)1296{1297linuxkpi_ieee80211_restart_hw(hw);1298}12991300static inline void1301ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif)1302{1303TODO();1304}13051306/* -------------------------------------------------------------------------- */13071308#define link_conf_dereference_check(_vif, _linkid) \1309rcu_dereference_check((_vif)->link_conf[_linkid], true)13101311#define link_conf_dereference_protected(_vif, _linkid) \1312rcu_dereference_protected((_vif)->link_conf[_linkid], true)13131314#define link_sta_dereference_check(_sta, _linkid) \1315rcu_dereference_check((_sta)->link[_linkid], true)13161317#define link_sta_dereference_protected(_sta, _linkid) \1318rcu_dereference_protected((_sta)->link[_linkid], true)13191320#define for_each_vif_active_link(_vif, _link, _linkid) \1321for (_linkid = 0; _linkid < nitems((_vif)->link_conf); _linkid++) \1322if ( ((_vif)->active_links == 0 /* no MLO */ || \1323((_vif)->active_links & BIT(_linkid)) != 0) && \1324(_link = rcu_dereference((_vif)->link_conf[_linkid])) )13251326#define for_each_sta_active_link(_vif, _sta, _linksta, _linkid) \1327for (_linkid = 0; _linkid < nitems((_sta)->link); _linkid++) \1328if ( ((_vif)->active_links == 0 /* no MLO */ || \1329((_vif)->active_links & BIT(_linkid)) != 0) && \1330(_linksta = link_sta_dereference_check((_sta), (_linkid))) )13311332/* -------------------------------------------------------------------------- */13331334static __inline bool1335ieee80211_vif_is_mesh(struct ieee80211_vif *vif)1336{1337TODO();1338return (false);1339}134013411342/* -------------------------------------------------------------------------- */1343/* Receive functions (air/driver to mac80211/net80211). */134413451346static __inline void1347ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,1348struct sk_buff *skb, struct napi_struct *napi)1349{13501351linuxkpi_ieee80211_rx(hw, skb, sta, napi, NULL);1352}13531354static __inline void1355ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,1356struct sk_buff *skb, struct list_head *list)1357{13581359linuxkpi_ieee80211_rx(hw, skb, sta, NULL, list);1360}13611362static __inline void1363ieee80211_rx_ni(struct ieee80211_hw *hw, struct sk_buff *skb)1364{13651366linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);1367}13681369static __inline void1370ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)1371{13721373linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);1374}13751376static __inline void1377ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)1378{13791380linuxkpi_ieee80211_rx(hw, skb, NULL, NULL, NULL);1381}13821383/* -------------------------------------------------------------------------- */13841385static inline void1386ieee80211_stop_queues(struct ieee80211_hw *hw)1387{1388linuxkpi_ieee80211_stop_queues(hw);1389}13901391static inline void1392ieee80211_wake_queues(struct ieee80211_hw *hw)1393{1394linuxkpi_ieee80211_wake_queues(hw);1395}13961397static inline void1398ieee80211_stop_queue(struct ieee80211_hw *hw, int qnum)1399{1400linuxkpi_ieee80211_stop_queue(hw, qnum);1401}14021403static inline void1404ieee80211_wake_queue(struct ieee80211_hw *hw, int qnum)1405{1406linuxkpi_ieee80211_wake_queue(hw, qnum);1407}14081409static inline void1410ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)1411{1412linuxkpi_ieee80211_schedule_txq(hw, txq, true);1413}14141415static inline void1416ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,1417bool withoutpkts)1418{1419linuxkpi_ieee80211_schedule_txq(hw, txq, withoutpkts);1420}14211422static inline void1423ieee80211_txq_schedule_start(struct ieee80211_hw *hw, uint8_t ac)1424{1425linuxkpi_ieee80211_txq_schedule_start(hw, ac);1426}14271428static inline void1429ieee80211_txq_schedule_end(struct ieee80211_hw *hw, uint8_t ac)1430{1431/* DO_NADA; */1432}14331434static inline struct ieee80211_txq *1435ieee80211_next_txq(struct ieee80211_hw *hw, uint8_t ac)1436{1437return (linuxkpi_ieee80211_next_txq(hw, ac));1438}14391440static inline void1441ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,1442struct ieee80211_txq *txq)1443{1444linuxkpi_ieee80211_handle_wake_tx_queue(hw, txq);1445}14461447static inline void1448ieee80211_purge_tx_queue(struct ieee80211_hw *hw,1449struct sk_buff_head *skbs)1450{1451TODO();1452}14531454/* -------------------------------------------------------------------------- */14551456static __inline uint8_t1457ieee80211_get_tid(struct ieee80211_hdr *hdr)1458{14591460return (linuxkpi_ieee80211_get_tid(hdr, false));1461}14621463static __inline struct sk_buff *1464ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif,1465uint16_t *tim_offset, uint16_t *tim_len, uint32_t link_id)1466{14671468if (tim_offset != NULL)1469*tim_offset = 0;1470if (tim_len != NULL)1471*tim_len = 0;1472TODO();1473return (NULL);1474}14751476static __inline void1477ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,1478enum ieee80211_iface_iter flags,1479void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1480void *arg)1481{14821483flags |= IEEE80211_IFACE_ITER__ATOMIC;1484flags |= IEEE80211_IFACE_ITER_ACTIVE;1485linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);1486}14871488static __inline void1489ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,1490enum ieee80211_iface_iter flags,1491void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1492void *arg)1493{14941495flags |= IEEE80211_IFACE_ITER_ACTIVE;1496linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);1497}14981499static __inline void1500ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,1501enum ieee80211_iface_iter flags,1502void(*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1503void *arg)1504{1505flags |= IEEE80211_IFACE_ITER_ACTIVE;1506flags |= IEEE80211_IFACE_ITER__MTX;1507linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);1508}15091510static __inline void1511ieee80211_iterate_interfaces(struct ieee80211_hw *hw,1512enum ieee80211_iface_iter flags,1513void (*iterfunc)(void *, uint8_t *, struct ieee80211_vif *),1514void *arg)1515{15161517linuxkpi_ieee80211_iterate_interfaces(hw, flags, iterfunc, arg);1518}15191520static inline void1521ieee80211_iter_keys(struct ieee80211_hw *hw, struct ieee80211_vif *vif,1522void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,1523struct ieee80211_sta *, struct ieee80211_key_conf *, void *),1524void *arg)1525{1526linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg, false);1527}15281529static inline void1530ieee80211_iter_keys_rcu(struct ieee80211_hw *hw, struct ieee80211_vif *vif,1531void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_vif *,1532struct ieee80211_sta *, struct ieee80211_key_conf *, void *),1533void *arg)1534{1535linuxkpi_ieee80211_iterate_keys(hw, vif, iterfunc, arg, true);1536}15371538static __inline void1539ieee80211_iter_chan_contexts_atomic(struct ieee80211_hw *hw,1540void(*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *),1541void *arg)1542{15431544linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg);1545}15461547static __inline void1548ieee80211_iter_chan_contexts_mtx(struct ieee80211_hw *hw,1549void (*iterfunc)(struct ieee80211_hw *, struct ieee80211_chanctx_conf *, void *),1550void *arg)1551{1552IMPROVE("XXX LKPI80211 TODO MTX\n");1553linuxkpi_ieee80211_iterate_chan_contexts(hw, iterfunc, arg);1554}15551556static __inline void1557ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,1558void (*iterfunc)(void *, struct ieee80211_sta *), void *arg)1559{15601561linuxkpi_ieee80211_iterate_stations_atomic(hw, iterfunc, arg);1562}15631564static __inline struct wireless_dev *1565ieee80211_vif_to_wdev(struct ieee80211_vif *vif)1566{15671568return (linuxkpi_ieee80211_vif_to_wdev(vif));1569}15701571static __inline struct sk_buff *1572ieee80211_beacon_get_template(struct ieee80211_hw *hw,1573struct ieee80211_vif *vif, struct ieee80211_mutable_offsets *offs,1574uint32_t link_id)1575{1576TODO();1577return (NULL);1578}15791580static __inline void1581ieee80211_beacon_loss(struct ieee80211_vif *vif)1582{1583linuxkpi_ieee80211_beacon_loss(vif);1584}15851586static __inline void1587ieee80211_chswitch_done(struct ieee80211_vif *vif, bool t, uint32_t link_id)1588{1589TODO();1590}15911592static __inline bool1593ieee80211_csa_is_complete(struct ieee80211_vif *vif)1594{1595TODO();1596return (false);1597}15981599static __inline void1600ieee80211_csa_set_counter(struct ieee80211_vif *vif, uint8_t counter)1601{1602TODO();1603}16041605static __inline int1606ieee80211_csa_update_counter(struct ieee80211_vif *vif)1607{1608TODO();1609return (-1);1610}16111612static __inline void1613ieee80211_csa_finish(struct ieee80211_vif *vif, uint32_t link_id)1614{1615TODO();1616}16171618static inline enum nl80211_iftype1619ieee80211_vif_type_p2p(struct ieee80211_vif *vif)1620{16211622/* If we are not p2p enabled, just return the type. */1623if (!vif->p2p)1624return (vif->type);16251626/* If we are p2p, depending on side, return type. */1627switch (vif->type) {1628case NL80211_IFTYPE_AP:1629return (NL80211_IFTYPE_P2P_GO);1630case NL80211_IFTYPE_STATION:1631return (NL80211_IFTYPE_P2P_CLIENT);1632default:1633fallthrough;1634}1635return (vif->type);1636}16371638static __inline unsigned long1639ieee80211_tu_to_usec(unsigned long tu)1640{16411642return (tu * IEEE80211_DUR_TU);1643}16441645/*1646* Below we assume that the two values from different emums are the same.1647* Make sure this does not accidentally change.1648*/1649CTASSERT((int)IEEE80211_ACTION_SM_TPCREP == (int)IEEE80211_ACTION_RADIO_MEASUREMENT_LMREP);16501651static __inline bool1652ieee80211_action_contains_tpc(struct sk_buff *skb)1653{1654struct ieee80211_mgmt *mgmt;16551656mgmt = (struct ieee80211_mgmt *)skb->data;16571658/* Check that this is a mgmt/action frame? */1659if (!ieee80211_is_action(mgmt->frame_control))1660return (false);16611662/*1663* This is a bit convoluted but according to docs both actions1664* are checked for this. Kind-of makes sense for the only consumer1665* (iwlwifi) I am aware off given the txpower fields are at the1666* same location so firmware can update the value.1667*/1668/* 80211-2020 9.6.2 Spectrum Management Action frames */1669/* 80211-2020 9.6.2.5 TPC Report frame format */1670/* 80211-2020 9.6.6 Radio Measurement action details */1671/* 80211-2020 9.6.6.4 Link Measurement Report frame format */1672/* Check that it is Spectrum Management or Radio Measurement? */1673if (mgmt->u.action.category != IEEE80211_ACTION_CAT_SM &&1674mgmt->u.action.category != IEEE80211_ACTION_CAT_RADIO_MEASUREMENT)1675return (false);16761677/*1678* Check that it is TPC Report or Link Measurement Report?1679* The values of each are the same (see CTASSERT above function).1680*/1681if (mgmt->u.action.u.tpc_report.spec_mgmt != IEEE80211_ACTION_SM_TPCREP)1682return (false);16831684/* 80211-2020 9.4.2.16 TPC Report element */1685/* Check that the ELEMID and length are correct? */1686if (mgmt->u.action.u.tpc_report.tpc_elem_id != IEEE80211_ELEMID_TPCREP ||1687mgmt->u.action.u.tpc_report.tpc_elem_length != 4)1688return (false);16891690/* All the right fields in the right place. */1691return (true);1692}16931694static __inline void1695ieee80211_connection_loss(struct ieee80211_vif *vif)1696{16971698linuxkpi_ieee80211_connection_loss(vif);1699}17001701static __inline struct ieee80211_sta *1702ieee80211_find_sta(struct ieee80211_vif *vif, const u8 *peer)1703{17041705return (linuxkpi_ieee80211_find_sta(vif, peer));1706}17071708static __inline struct ieee80211_sta *1709ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, const uint8_t *addr,1710const uint8_t *ourvifaddr)1711{17121713return (linuxkpi_ieee80211_find_sta_by_ifaddr(hw, addr, ourvifaddr));1714}17151716static __inline size_t1717ieee80211_ie_split(const u8 *ies, size_t ies_len,1718const u8 *ie_ids, size_t ie_ids_len, size_t start)1719{1720size_t x;17211722x = start;17231724/* XXX FIXME, we need to deal with "Element ID Extension" */1725while (x < ies_len) {17261727/* Is this IE[s] one of the ie_ids? */1728if (!linuxkpi_ieee80211_is_ie_id_in_ie_buf(ies[x],1729ie_ids, ie_ids_len))1730break;17311732if (!linuxkpi_ieee80211_ie_advance(&x, ies, ies_len))1733break;1734}17351736return (x);1737}17381739static __inline void1740ieee80211_request_smps(struct ieee80211_vif *vif, u_int link_id,1741enum ieee80211_smps_mode smps)1742{1743static const char *smps_mode_name[] = {1744"SMPS_OFF",1745"SMPS_STATIC",1746"SMPS_DYNAMIC",1747"SMPS_AUTOMATIC",1748};17491750if (vif->type != NL80211_IFTYPE_STATION)1751return;17521753if (smps >= nitems(smps_mode_name))1754panic("%s: unsupported smps value: %d\n", __func__, smps);17551756IMPROVE("XXX LKPI80211 TODO smps %d %s\n", smps, smps_mode_name[smps]);1757}17581759static __inline void1760ieee80211_tdls_oper_request(struct ieee80211_vif *vif, uint8_t *addr,1761enum nl80211_tdls_operation oper, enum ieee80211_reason_code code,1762gfp_t gfp)1763{1764TODO();1765}17661767static __inline void1768wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool state)1769{1770TODO();1771}17721773static __inline void1774ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb)1775{1776IMPROVE();17771778/*1779* This is called on transmit failure.1780* Use a not-so-random random high status error so we can distinguish1781* it from normal low values flying around in net80211 ("ETX").1782*/1783linuxkpi_ieee80211_free_txskb(hw, skb, 0x455458);1784}17851786static __inline void1787ieee80211_ready_on_channel(struct ieee80211_hw *hw)1788{1789TODO();1790/* XXX-BZ We need to see that. */1791}17921793static __inline void1794ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw)1795{1796TODO();1797}17981799static __inline void1800ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,1801enum nl80211_cqm_rssi_threshold_event crte, int sig, gfp_t gfp)1802{1803TODO();1804}18051806/* -------------------------------------------------------------------------- */18071808static inline bool1809ieee80211_sn_less(uint16_t sn1, uint16_t sn2)1810{1811return (IEEE80211_SEQ_BA_BEFORE(sn1, sn2));1812}18131814static inline uint16_t1815ieee80211_sn_inc(uint16_t sn)1816{1817return (IEEE80211_SEQ_INC(sn));1818}18191820static inline uint16_t1821ieee80211_sn_add(uint16_t sn, uint16_t a)1822{1823return (IEEE80211_SEQ_ADD(sn, a));1824}18251826static inline uint16_t1827ieee80211_sn_sub(uint16_t sa, uint16_t sb)1828{1829return (IEEE80211_SEQ_SUB(sa, sb));1830}18311832static __inline void1833ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *sta, uint8_t tid,1834uint32_t ssn, uint64_t bitmap, uint16_t received_mpdu)1835{1836TODO();1837}18381839static __inline void1840ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, uint32_t x, uint8_t *addr)1841{1842TODO();1843}18441845static __inline void1846ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif, uint8_t *addr,1847uint8_t tid)1848{1849TODO();1850}18511852static __inline void1853ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,1854uint8_t tid)1855{1856TODO();1857}18581859static __inline void1860ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif, uint8_t *addr,1861uint8_t tid)1862{1863TODO();1864}18651866/* -------------------------------------------------------------------------- */18671868static inline void1869ieee80211_rate_set_vht(struct ieee80211_tx_rate *r, uint8_t mcs, uint8_t nss)1870{18711872/* XXX-BZ make it KASSERTS? */1873if (((mcs & 0xF0) != 0) || (((nss - 1) & 0xf8) != 0)) {1874printf("%s:%d: mcs %#04x nss %#04x invalid\n",1875__func__, __LINE__, mcs, nss);1876return;1877}18781879r->idx = mcs;1880r->idx |= ((nss - 1) << 4);1881}18821883static inline uint8_t1884ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *r)1885{1886return (((r->idx >> 4) & 0x07) + 1);1887}18881889static inline uint8_t1890ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *r)1891{1892return (r->idx & 0x0f);1893}18941895static inline int1896ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *vht_cap,1897enum ieee80211_vht_chanwidth chanwidth, /* defined in net80211. */1898int mcs /* always 0 */, bool ext_nss_bw_cap /* always true */, int max_nss)1899{1900enum ieee80211_vht_mcs_support mcs_s;1901uint32_t supp_cw, ext_nss_bw;19021903switch (mcs) {1904case 0 ... 7:1905mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_7;1906break;1907case 8:1908mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_8;1909break;1910case 9:1911mcs_s = IEEE80211_VHT_MCS_SUPPORT_0_9;1912break;1913default:1914printf("%s: unsupported mcs value %d\n", __func__, mcs);1915return (0);1916}19171918if (max_nss == 0) {1919uint16_t map;19201921map = le16toh(vht_cap->supp_mcs.rx_mcs_map);1922for (int i = 7; i >= 0; i--) {1923uint8_t val;19241925val = (map >> (2 * i)) & 0x03;1926if (val == IEEE80211_VHT_MCS_NOT_SUPPORTED)1927continue;1928if (val >= mcs_s) {1929max_nss = i + 1;1930break;1931}1932}1933}19341935if (max_nss == 0)1936return (0);19371938if ((le16toh(vht_cap->supp_mcs.tx_mcs_map) &1939IEEE80211_VHT_EXT_NSS_BW_CAPABLE) == 0)1940return (max_nss);19411942supp_cw = le32_get_bits(vht_cap->vht_cap_info,1943IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK);1944ext_nss_bw = le32_get_bits(vht_cap->vht_cap_info,1945IEEE80211_VHT_CAP_EXT_NSS_BW_MASK);19461947/* If requested as ext nss not supported assume ext_nss_bw 0. */1948if (!ext_nss_bw_cap)1949ext_nss_bw = 0;19501951/*1952* Cover 802.11-2016, Table 9-250.1953*/19541955/* Unsupported settings. */1956if (supp_cw == 3)1957return (0);1958if (supp_cw == 2 && (ext_nss_bw == 1 || ext_nss_bw == 2))1959return (0);19601961/* Settings with factor != 1 or unsupported. */1962switch (chanwidth) {1963case IEEE80211_VHT_CHANWIDTH_80P80MHZ:1964if (supp_cw == 0 && (ext_nss_bw == 0 || ext_nss_bw == 1))1965return (0);1966if (supp_cw == 1 && ext_nss_bw == 0)1967return (0);1968if ((supp_cw == 0 || supp_cw == 1) && ext_nss_bw == 2)1969return (max_nss / 2);1970if ((supp_cw == 0 || supp_cw == 1) && ext_nss_bw == 3)1971return (3 * max_nss / 4);1972break;1973case IEEE80211_VHT_CHANWIDTH_160MHZ:1974if (supp_cw == 0 && ext_nss_bw == 0)1975return (0);1976if (supp_cw == 0 && (ext_nss_bw == 1 || ext_nss_bw == 2))1977return (max_nss / 2);1978if (supp_cw == 0 && ext_nss_bw == 3)1979return (3 * max_nss / 4);1980if (supp_cw == 1 && ext_nss_bw == 3)1981return (2 * max_nss);1982break;1983case IEEE80211_VHT_CHANWIDTH_80MHZ:1984case IEEE80211_VHT_CHANWIDTH_USE_HT:1985if ((supp_cw == 1 || supp_cw == 2) && ext_nss_bw == 3)1986return (2 * max_nss);1987break;1988}19891990/* Everything else has a factor of 1. */1991return (max_nss);1992}199319941995static __inline void1996ieee80211_reserve_tid(struct ieee80211_sta *sta, uint8_t tid)1997{1998TODO();1999}20002001static __inline void2002ieee80211_unreserve_tid(struct ieee80211_sta *sta, uint8_t tid)2003{2004TODO();2005}20062007static __inline void2008ieee80211_send_eosp_nullfunc(struct ieee80211_sta *sta, uint8_t tid)2009{2010TODO();2011}20122013static __inline void2014ieee80211_sta_block_awake(struct ieee80211_hw *hw, struct ieee80211_sta *sta,2015bool disable)2016{2017TODO();2018}20192020static __inline void2021ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool sleeping)2022{2023TODO();2024}20252026static __inline void2027ieee80211_sta_pspoll(struct ieee80211_sta *sta)2028{2029TODO();2030}20312032static inline void2033ieee80211_sta_recalc_aggregates(struct ieee80211_sta *sta)2034{2035if (sta->valid_links) {2036TODO();2037}2038}20392040static __inline void2041ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, int ntids)2042{2043TODO();2044}20452046static inline struct sk_buff *2047ieee80211_tx_dequeue(struct ieee80211_hw *hw, struct ieee80211_txq *txq)2048{20492050return (linuxkpi_ieee80211_tx_dequeue(hw, txq));2051}20522053static inline struct sk_buff *2054ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw, struct ieee80211_txq *txq)2055{2056struct sk_buff *skb;20572058local_bh_disable();2059skb = linuxkpi_ieee80211_tx_dequeue(hw, txq);2060local_bh_enable();20612062return (skb);2063}20642065static __inline void2066ieee80211_update_mu_groups(struct ieee80211_vif *vif,2067u_int link_id, const uint8_t *ms, const uint8_t *up)2068{2069TODO();2070}20712072static __inline void2073ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t)2074{2075TODO();2076}20772078static __inline void2079ieee80211_sched_scan_results(struct ieee80211_hw *hw)2080{2081TODO();2082}20832084static __inline void2085ieee80211_sta_eosp(struct ieee80211_sta *sta)2086{2087TODO();2088}20892090static __inline int2091ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid, int x)2092{2093TODO("rtw8x");2094return (-EINVAL);2095}20962097static __inline int2098ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, uint8_t tid)2099{2100TODO("rtw89");2101return (-EINVAL);2102}21032104static __inline void2105ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,2106uint8_t tid)2107{2108TODO("iwlwifi");2109}21102111static __inline void2112ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, uint8_t *addr,2113uint8_t tid)2114{2115TODO("iwlwifi/rtw8x/...");2116}21172118static __inline void2119ieee80211_sched_scan_stopped(struct ieee80211_hw *hw)2120{2121TODO();2122}21232124static __inline void2125ieee80211_scan_completed(struct ieee80211_hw *hw,2126struct cfg80211_scan_info *info)2127{21282129linuxkpi_ieee80211_scan_completed(hw, info);2130}21312132static __inline struct sk_buff *2133ieee80211_beacon_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2134uint32_t link_id)2135{2136TODO();2137return (NULL);2138}21392140static __inline struct sk_buff *2141ieee80211_pspoll_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)2142{21432144/* Only STA needs this. Otherwise return NULL and panic bad drivers. */2145if (vif->type != NL80211_IFTYPE_STATION)2146return (NULL);21472148return (linuxkpi_ieee80211_pspoll_get(hw, vif));2149}21502151static __inline struct sk_buff *2152ieee80211_proberesp_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif)2153{2154TODO();2155return (NULL);2156}21572158static __inline struct sk_buff *2159ieee80211_nullfunc_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2160int linkid, bool qos)2161{21622163/* Only STA needs this. Otherwise return NULL and panic bad drivers. */2164if (vif->type != NL80211_IFTYPE_STATION)2165return (NULL);21662167return (linuxkpi_ieee80211_nullfunc_get(hw, vif, linkid, qos));2168}21692170static __inline struct sk_buff *2171ieee80211_probereq_get(struct ieee80211_hw *hw, const uint8_t *addr,2172const uint8_t *ssid, size_t ssid_len, size_t tailroom)2173{21742175return (linuxkpi_ieee80211_probereq_get(hw, addr, ssid, ssid_len,2176tailroom));2177}21782179static __inline void2180ieee80211_queue_delayed_work(struct ieee80211_hw *hw, struct delayed_work *w,2181int delay)2182{21832184linuxkpi_ieee80211_queue_delayed_work(hw, w, delay);2185}21862187static __inline void2188ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *w)2189{21902191linuxkpi_ieee80211_queue_work(hw, w);2192}21932194static __inline bool2195ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, struct ieee80211_vif *vif,2196struct sk_buff *skb, enum nl80211_band band, struct ieee80211_sta **sta)2197{2198TODO();2199return (false);2200}22012202static __inline void2203ieee80211_tx_status_skb(struct ieee80211_hw *hw, struct sk_buff *skb)2204{2205linuxkpi_ieee80211_tx_status(hw, skb);2206}22072208static inline void2209ieee80211_tx_status_noskb(struct ieee80211_hw *hw, struct ieee80211_sta *sta,2210struct ieee80211_tx_info *info)2211{2212TODO();2213}22142215static __inline void2216ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)2217{2218IMPROVE();2219linuxkpi_ieee80211_tx_status(hw, skb);2220}22212222static __inline void2223ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb)2224{2225IMPROVE();2226linuxkpi_ieee80211_tx_status(hw, skb);2227}22282229static __inline void2230ieee80211_tx_status_ext(struct ieee80211_hw *hw,2231struct ieee80211_tx_status *txstat)2232{22332234linuxkpi_ieee80211_tx_status_ext(hw, txstat);2235}22362237static __inline void2238ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)2239{2240int i;22412242/*2243* Apparently clearing flags and some other fields is not right.2244* Given the function is called "status" we work on that part of2245* the union.2246*/2247for (i = 0; i < nitems(info->status.rates); i++)2248info->status.rates[i].count = 0;2249/*2250* Unclear if ack_signal should be included or not but we clear the2251* "valid" bool so this field is no longer valid.2252*/2253memset(&info->status.ack_signal, 0, sizeof(*info) -2254offsetof(struct ieee80211_tx_info, status.ack_signal));2255}22562257static __inline void2258ieee80211_txq_get_depth(struct ieee80211_txq *txq, unsigned long *frame_cnt,2259unsigned long *byte_cnt)2260{22612262if (frame_cnt == NULL && byte_cnt == NULL)2263return;22642265linuxkpi_ieee80211_txq_get_depth(txq, frame_cnt, byte_cnt);2266}22672268static __inline void2269SET_IEEE80211_PERM_ADDR (struct ieee80211_hw *hw, uint8_t *addr)2270{22712272ether_addr_copy(hw->wiphy->perm_addr, addr);2273}22742275static __inline void2276ieee80211_report_low_ack(struct ieee80211_sta *sta, int x)2277{2278TODO();2279}22802281static __inline void2282ieee80211_tx_rate_update(struct ieee80211_hw *hw, struct ieee80211_sta *sta,2283struct ieee80211_tx_info *info)2284{2285TODO();2286}22872288static __inline bool2289ieee80211_txq_may_transmit(struct ieee80211_hw *hw, struct ieee80211_txq *txq)2290{2291TODO();2292return (false);2293}22942295static __inline void2296ieee80211_radar_detected(struct ieee80211_hw *hw,2297struct ieee80211_chanctx_conf *chanctx_conf)2298{2299TODO();2300}23012302static __inline void2303ieee80211_sta_register_airtime(struct ieee80211_sta *sta,2304uint8_t tid, uint32_t duration, int x)2305{2306IMPROVE("NL80211_EXT_FEATURE_AIRTIME_FAIRNESS and TX queus");2307}23082309static __inline void2310ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter)2311{2312TODO();2313}23142315static __inline int2316ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif, uint32_t link_id)2317{2318TODO();2319return (-1);2320}23212322static __inline bool2323ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif, uint32_t link_id)2324{2325TODO();2326return (true);2327}23282329static __inline void2330ieee80211_disconnect(struct ieee80211_vif *vif, bool _x)2331{2332TODO();2333}23342335static __inline void2336ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif)2337{2338TODO();2339}23402341static __inline uint32_t2342ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,2343struct ieee80211_rx_status *rxstat, int len)2344{2345TODO();2346return (0);2347}23482349static __inline void2350ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,2351struct sk_buff *skb, struct ieee80211_tx_rate *txrate, int nrates)2352{2353TODO();2354}23552356static __inline void2357ieee80211_color_change_finish(struct ieee80211_vif *vif, uint8_t link_id)2358{2359TODO();2360}23612362static __inline struct sk_buff *2363ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,2364struct ieee80211_vif *vif)2365{2366TODO();2367return (NULL);2368}23692370static __inline struct sk_buff *2371ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,2372struct ieee80211_vif *vif)2373{2374TODO();2375return (NULL);2376}23772378static __inline void2379linuxkpi_ieee80211_send_bar(struct ieee80211_vif *vif, uint8_t *ra, uint16_t tid,2380uint16_t ssn)2381{2382TODO();2383}23842385static __inline void2386ieee80211_resume_disconnect(struct ieee80211_vif *vif)2387{2388TODO();2389}23902391static __inline int2392ieee80211_data_to_8023(struct sk_buff *skb, const uint8_t *addr,2393enum nl80211_iftype iftype)2394{2395TODO();2396return (-1);2397}23982399/* -------------------------------------------------------------------------- */24002401static __inline void2402ieee80211_key_mic_failure(struct ieee80211_key_conf *key)2403{2404TODO();2405}24062407static __inline void2408ieee80211_key_replay(struct ieee80211_key_conf *key)2409{2410TODO();2411}24122413static __inline void2414ieee80211_remove_key(struct ieee80211_key_conf *key)2415{2416TODO();2417}24182419static __inline struct ieee80211_key_conf *2420ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,2421uint16_t keyidx, uint8_t *key, size_t keylen, int link_id)2422{2423TODO();2424return (NULL);2425}24262427static __inline void2428ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const uint8_t *bssid,2429const uint8_t *replay_ctr, gfp_t gfp)2430{2431TODO();2432}24332434static __inline void2435ieee80211_tkip_add_iv(u8 *crypto_hdr, struct ieee80211_key_conf *keyconf,2436uint64_t pn)2437{2438TODO();2439}24402441static __inline void2442ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,2443const u8 *addr, uint32_t iv32, u16 *p1k)2444{24452446KASSERT(keyconf != NULL && addr != NULL && p1k != NULL,2447("%s: keyconf %p addr %p p1k %p\n", __func__, keyconf, addr, p1k));24482449TODO();2450memset(p1k, 0xfa, 5 * sizeof(*p1k)); /* Just initializing. */2451}24522453static __inline void2454ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *key,2455uint32_t iv32, uint16_t *p1k)2456{2457TODO();2458}24592460static __inline void2461ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,2462struct sk_buff *skb_frag, u8 *key)2463{2464TODO();2465}24662467static inline void2468ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, int8_t tid,2469struct ieee80211_key_seq *seq)2470{2471const struct ieee80211_key *k;2472const uint8_t *p;24732474KASSERT(keyconf != NULL && seq != NULL, ("%s: keyconf %p seq %p\n",2475__func__, keyconf, seq));2476k = keyconf->_k;2477KASSERT(k != NULL, ("%s: keyconf %p ieee80211_key is NULL\n", __func__, keyconf));24782479switch (keyconf->cipher) {2480case WLAN_CIPHER_SUITE_TKIP:2481if (tid < 0 || tid >= IEEE80211_NUM_TIDS)2482return;2483/* See net80211::tkip_decrypt() */2484seq->tkip.iv32 = TKIP_PN_TO_IV32(k->wk_keyrsc[tid]);2485seq->tkip.iv16 = TKIP_PN_TO_IV16(k->wk_keyrsc[tid]);2486break;2487case WLAN_CIPHER_SUITE_CCMP:2488case WLAN_CIPHER_SUITE_CCMP_256:2489if (tid < -1 || tid >= IEEE80211_NUM_TIDS)2490return;2491if (tid == -1)2492p = (const uint8_t *)&k->wk_keyrsc[IEEE80211_NUM_TIDS]; /* IEEE80211_NONQOS_TID */2493else2494p = (const uint8_t *)&k->wk_keyrsc[tid];2495memcpy(seq->ccmp.pn, p, sizeof(seq->ccmp.pn));2496break;2497case WLAN_CIPHER_SUITE_GCMP:2498case WLAN_CIPHER_SUITE_GCMP_256:2499if (tid < -1 || tid >= IEEE80211_NUM_TIDS)2500return;2501if (tid == -1)2502p = (const uint8_t *)&k->wk_keyrsc[IEEE80211_NUM_TIDS]; /* IEEE80211_NONQOS_TID */2503else2504p = (const uint8_t *)&k->wk_keyrsc[tid];2505memcpy(seq->gcmp.pn, p, sizeof(seq->gcmp.pn));2506break;2507case WLAN_CIPHER_SUITE_AES_CMAC:2508case WLAN_CIPHER_SUITE_BIP_CMAC_256:2509TODO();2510memset(seq->aes_cmac.pn, 0xfa, sizeof(seq->aes_cmac.pn)); /* XXX TODO */2511break;2512case WLAN_CIPHER_SUITE_BIP_GMAC_128:2513case WLAN_CIPHER_SUITE_BIP_GMAC_256:2514TODO();2515memset(seq->aes_gmac.pn, 0xfa, sizeof(seq->aes_gmac.pn)); /* XXX TODO */2516break;2517default:2518pr_debug("%s: unsupported cipher suite %d\n", __func__, keyconf->cipher);2519break;2520}2521}25222523static __inline void2524ieee80211_set_key_rx_seq(struct ieee80211_key_conf *key, int tid,2525struct ieee80211_key_seq *seq)2526{2527TODO();2528}25292530/* -------------------------------------------------------------------------- */25312532static __inline void2533ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,2534struct cfg80211_wowlan_wakeup *wakeup, gfp_t gfp)2535{2536TODO();2537}25382539static __inline void2540ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,2541uint64_t obss_color_bitmap, gfp_t gfp)2542{2543TODO();2544}25452546static __inline void2547ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,2548uint8_t tid)2549{2550TODO();2551}25522553static __inline struct ieee80211_ema_beacons *2554ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,2555struct ieee80211_vif *vif, uint32_t link_id)2556{2557TODO();2558return (NULL);2559}25602561static __inline void2562ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *bcns)2563{2564TODO();2565}25662567static inline bool2568ieee80211_vif_is_mld(const struct ieee80211_vif *vif)2569{25702571/* If valid_links is non-zero, the vif is an MLD. */2572return (vif->valid_links != 0);2573}25742575static inline const struct ieee80211_sta_he_cap *2576ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *band,2577struct ieee80211_vif *vif)2578{2579enum nl80211_iftype iftype;25802581iftype = ieee80211_vif_type_p2p(vif);2582return (ieee80211_get_he_iftype_cap(band, iftype));2583}25842585static inline const struct ieee80211_sta_eht_cap *2586ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *band,2587struct ieee80211_vif *vif)2588{2589enum nl80211_iftype iftype;25902591iftype = ieee80211_vif_type_p2p(vif);2592return (ieee80211_get_eht_iftype_cap(band, iftype));2593}25942595static inline uint32_t2596ieee80211_vif_usable_links(const struct ieee80211_vif *vif)2597{2598IMPROVE("MLO usable links likely are not just valid");2599return (vif->valid_links);2600}26012602static inline bool2603ieee80211_vif_link_active(const struct ieee80211_vif *vif, uint8_t link_id)2604{2605if (ieee80211_vif_is_mld(vif))2606return (vif->active_links & BIT(link_id));2607return (link_id == 0);2608}26092610static inline void2611ieee80211_set_active_links_async(struct ieee80211_vif *vif,2612uint32_t new_active_links)2613{2614TODO();2615}26162617static inline int2618ieee80211_set_active_links(struct ieee80211_vif *vif,2619uint32_t active_links)2620{2621TODO();2622return (-ENXIO);2623}26242625static inline void2626ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp __unused)2627{2628IMPROVE("we notify user space by a vap state change eventually");2629linuxkpi_ieee80211_beacon_loss(vif);2630}26312632#define ieee80211_send_bar(_v, _r, _t, _s) \2633linuxkpi_ieee80211_send_bar(_v, _r, _t, _s)26342635/* -------------------------------------------------------------------------- */26362637int lkpi_80211_update_chandef(struct ieee80211_hw *,2638struct ieee80211_chanctx_conf *);26392640static inline int2641ieee80211_emulate_add_chanctx(struct ieee80211_hw *hw,2642struct ieee80211_chanctx_conf *chanctx_conf)2643{2644int error;26452646hw->conf.radar_enabled = chanctx_conf->radar_enabled;2647error = lkpi_80211_update_chandef(hw, chanctx_conf);2648return (error);2649}26502651static inline void2652ieee80211_emulate_remove_chanctx(struct ieee80211_hw *hw,2653struct ieee80211_chanctx_conf *chanctx_conf __unused)2654{2655hw->conf.radar_enabled = false;2656lkpi_80211_update_chandef(hw, NULL);2657}26582659static inline void2660ieee80211_emulate_change_chanctx(struct ieee80211_hw *hw,2661struct ieee80211_chanctx_conf *chanctx_conf, uint32_t changed __unused)2662{2663hw->conf.radar_enabled = chanctx_conf->radar_enabled;2664lkpi_80211_update_chandef(hw, chanctx_conf);2665}26662667static inline int2668ieee80211_emulate_switch_vif_chanctx(struct ieee80211_hw *hw,2669struct ieee80211_vif_chanctx_switch *vifs, int n_vifs,2670enum ieee80211_chanctx_switch_mode mode __unused)2671{2672struct ieee80211_chanctx_conf *chanctx_conf;2673int error;26742675/* Sanity check. */2676if (n_vifs <= 0)2677return (-EINVAL);2678if (vifs == NULL || vifs[0].new_ctx == NULL)2679return (-EINVAL);26802681/*2682* What to do if n_vifs > 1?2683* Does that make sense for drivers not supporting chanctx?2684*/2685hw->conf.radar_enabled = vifs[0].new_ctx->radar_enabled;2686chanctx_conf = vifs[0].new_ctx;2687error = lkpi_80211_update_chandef(hw, chanctx_conf);2688return (error);2689}26902691/* -------------------------------------------------------------------------- */26922693#endif /* _LINUXKPI_NET_MAC80211_H */269426952696