Path: blob/main/sys/compat/linuxkpi/common/include/net/cfg80211.h
39604 views
/*-1* Copyright (c) 2020-2025 The FreeBSD Foundation2* Copyright (c) 2021-2022 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_CFG80211_H30#define _LINUXKPI_NET_CFG80211_H3132#include <linux/types.h>33#include <linux/nl80211.h>34#include <linux/ieee80211.h>35#include <linux/mutex.h>36#include <linux/if_ether.h>37#include <linux/ethtool.h>38#include <linux/debugfs.h>39#include <linux/device.h>40#include <linux/netdevice.h>41#include <linux/random.h>42#include <linux/skbuff.h>43#include <linux/timer.h>44#include <linux/workqueue.h>45#include <net/regulatory.h>4647#include <net80211/ieee80211.h>4849/* linux_80211.c */50extern int linuxkpi_debug_80211;51#ifndef D80211_TODO52#define D80211_TODO 0x153#endif54#ifndef D80211_IMPROVE55#define D80211_IMPROVE 0x256#endif57#define TODO(fmt, ...) if (linuxkpi_debug_80211 & D80211_TODO) \58printf("%s:%d: XXX LKPI80211 TODO " fmt "\n", __func__, __LINE__, ##__VA_ARGS__)59#define IMPROVE(fmt, ...) if (linuxkpi_debug_80211 & D80211_IMPROVE) \60printf("%s:%d: XXX LKPI80211 IMPROVE " fmt "\n", __func__, __LINE__, ##__VA_ARGS__)6162enum rfkill_hard_block_reasons {63RFKILL_HARD_BLOCK_NOT_OWNER = BIT(0),64};6566#define WIPHY_PARAM_FRAG_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */67#define WIPHY_PARAM_RETRY_LONG __LINE__ /* TODO FIXME brcmfmac */68#define WIPHY_PARAM_RETRY_SHORT __LINE__ /* TODO FIXME brcmfmac */69#define WIPHY_PARAM_RTS_THRESHOLD __LINE__ /* TODO FIXME brcmfmac */7071#define CFG80211_SIGNAL_TYPE_MBM __LINE__ /* TODO FIXME brcmfmac */7273#define UPDATE_ASSOC_IES 17475#define IEEE80211_MAX_CHAINS 4 /* net80211: IEEE80211_MAX_CHAINS copied */7677enum cfg80211_rate_info_flags {78RATE_INFO_FLAGS_MCS = BIT(0),79RATE_INFO_FLAGS_VHT_MCS = BIT(1),80RATE_INFO_FLAGS_SHORT_GI = BIT(2),81RATE_INFO_FLAGS_HE_MCS = BIT(4),82RATE_INFO_FLAGS_EHT_MCS = BIT(7),83/* Max 8 bits as used in struct rate_info. */84};8586#define CFG80211_RATE_INFO_FLAGS_BITS \87"\20\1MCS\2VHT_MCS\3SGI\5HE_MCS\10EHT_MCS"8889extern const uint8_t rfc1042_header[6];90extern const uint8_t bridge_tunnel_header[6];9192enum ieee80211_privacy {93IEEE80211_PRIVACY_ANY,94};9596enum ieee80211_bss_type {97IEEE80211_BSS_TYPE_ANY,98};99100enum cfg80211_bss_frame_type {101CFG80211_BSS_FTYPE_UNKNOWN,102CFG80211_BSS_FTYPE_BEACON,103CFG80211_BSS_FTYPE_PRESP,104};105106enum ieee80211_channel_flags {107IEEE80211_CHAN_DISABLED = BIT(0),108IEEE80211_CHAN_INDOOR_ONLY = BIT(1),109IEEE80211_CHAN_IR_CONCURRENT = BIT(2),110IEEE80211_CHAN_RADAR = BIT(3),111IEEE80211_CHAN_NO_IR = BIT(4),112IEEE80211_CHAN_NO_HT40MINUS = BIT(5),113IEEE80211_CHAN_NO_HT40PLUS = BIT(6),114IEEE80211_CHAN_NO_80MHZ = BIT(7),115IEEE80211_CHAN_NO_160MHZ = BIT(8),116IEEE80211_CHAN_NO_OFDM = BIT(9),117IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT = BIT(10),118IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT = BIT(11),119IEEE80211_CHAN_PSD = BIT(12),120IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP = BIT(13),121IEEE80211_CHAN_CAN_MONITOR = BIT(14),122};123#define IEEE80211_CHAN_NO_HT40 (IEEE80211_CHAN_NO_HT40MINUS|IEEE80211_CHAN_NO_HT40PLUS)124125struct ieee80211_txrx_stypes {126uint16_t tx;127uint16_t rx;128};129130/*131* net80211 has an ieee80211_channel as well; we use the linuxkpi_ version132* interally in LinuxKPI and re-define ieee80211_channel for the drivers133* at the end of the file.134*/135struct linuxkpi_ieee80211_channel {136uint32_t center_freq;137uint16_t hw_value;138enum ieee80211_channel_flags flags;139enum nl80211_band band;140bool beacon_found;141enum nl80211_dfs_state dfs_state;142unsigned int dfs_cac_ms;143int max_antenna_gain;144int max_power;145int max_reg_power;146uint32_t orig_flags;147int orig_mpwr;148};149150struct cfg80211_bitrate_mask {151/* TODO FIXME */152struct {153uint32_t legacy;154uint8_t ht_mcs[IEEE80211_HT_MCS_MASK_LEN];155uint16_t vht_mcs[8];156uint16_t he_mcs[8];157enum nl80211_txrate_gi gi;158enum nl80211_he_gi he_gi;159uint8_t he_ltf; /* XXX enum? */160} control[NUM_NL80211_BANDS];161};162163enum rate_info_bw {164RATE_INFO_BW_20 = 0,165RATE_INFO_BW_5,166RATE_INFO_BW_10,167RATE_INFO_BW_40,168RATE_INFO_BW_80,169RATE_INFO_BW_160,170RATE_INFO_BW_HE_RU,171RATE_INFO_BW_320,172RATE_INFO_BW_EHT_RU,173};174175struct rate_info {176uint8_t flags; /* enum cfg80211_rate_info_flags */177uint8_t bw; /* enum rate_info_bw */178uint16_t legacy;179uint8_t mcs;180uint8_t nss;181uint8_t he_dcm;182uint8_t he_gi;183uint8_t he_ru_alloc;184uint8_t eht_gi;185};186187struct ieee80211_rate {188uint32_t flags; /* enum ieee80211_rate_flags */189uint16_t bitrate;190uint16_t hw_value;191uint16_t hw_value_short;192};193194struct ieee80211_sta_ht_cap {195bool ht_supported;196uint8_t ampdu_density;197uint8_t ampdu_factor;198uint16_t cap;199struct ieee80211_mcs_info mcs;200};201202/* XXX net80211 calls these IEEE80211_VHTCAP_* */203#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_3895 */204#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_7991 */205#define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002 /* IEEE80211_VHTCAP_MAX_MPDU_LENGTH_11454 */206#define IEEE80211_VHT_CAP_MAX_MPDU_MASK 0x00000003 /* IEEE80211_VHTCAP_MAX_MPDU_MASK */207208#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)209#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ << IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S)210#define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK211212#define IEEE80211_VHT_CAP_RXLDPC 0x00000010 /* IEEE80211_VHTCAP_RXLDPC */213214#define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020 /* IEEE80211_VHTCAP_SHORT_GI_80 */215#define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040 /* IEEE80211_VHTCAP_SHORT_GI_160 */216217#define IEEE80211_VHT_CAP_TXSTBC 0x00000080 /* IEEE80211_VHTCAP_TXSTBC */218219#define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100 /* IEEE80211_VHTCAP_RXSTBC_1 */220#define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700 /* IEEE80211_VHTCAP_RXSTBC_MASK */221222#define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800 /* IEEE80211_VHTCAP_SU_BEAMFORMER_CAPABLE */223224#define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000 /* IEEE80211_VHTCAP_SU_BEAMFORMEE_CAPABLE */225226#define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000 /* IEEE80211_VHTCAP_MU_BEAMFORMER_CAPABLE */227228#define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000 /* IEEE80211_VHTCAP_MU_BEAMFORMEE_CAPABLE */229230#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13 /* IEEE80211_VHTCAP_BEAMFORMEE_STS_SHIFT */231#define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT) /* IEEE80211_VHTCAP_BEAMFORMEE_STS_MASK */232233#define IEEE80211_VHT_CAP_HTC_VHT 0x00400000 /* IEEE80211_VHTCAP_HTC_VHT */234235#define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000 /* IEEE80211_VHTCAP_RX_ANTENNA_PATTERN */236#define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000 /* IEEE80211_VHTCAP_TX_ANTENNA_PATTERN */237238#define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000 /* IEEE80211_VHTCAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB */239240#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16 /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT */241#define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \242(7 << IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_SHIFT) /* IEEE80211_VHTCAP_SOUNDING_DIMENSIONS_MASK */243244#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23 /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT */245#define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \246(7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT) /* IEEE80211_VHTCAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK */247248#define IEEE80211_VHT_CAP_EXT_NSS_BW_MASK IEEE80211_VHTCAP_EXT_NSS_BW249#define IEEE80211_VHT_CAP_EXT_NSS_BW_SHIFT IEEE80211_VHTCAP_EXT_NSS_BW_S250251struct ieee80211_sta_vht_cap {252/* TODO FIXME */253bool vht_supported;254uint32_t cap;255struct ieee80211_vht_mcs_info vht_mcs;256};257258enum ieee80211_vht_opmode {259IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,260};261262struct cfg80211_connect_resp_params {263/* XXX TODO */264uint8_t *bssid;265const uint8_t *req_ie;266const uint8_t *resp_ie;267uint32_t req_ie_len;268uint32_t resp_ie_len;269int status;270};271272struct cfg80211_inform_bss {273/* XXX TODO */274int boottime_ns, scan_width, signal;275struct linuxkpi_ieee80211_channel *chan;276};277278struct cfg80211_roam_info {279/* XXX TODO */280uint8_t *bssid;281const uint8_t *req_ie;282const uint8_t *resp_ie;283uint32_t req_ie_len;284uint32_t resp_ie_len;285struct linuxkpi_ieee80211_channel *channel;286};287288struct cfg80211_bss_ies {289uint8_t *data;290size_t len;291};292293struct cfg80211_bss {294/* XXX TODO */295struct cfg80211_bss_ies *ies;296struct cfg80211_bss_ies *beacon_ies;297298int32_t signal;299};300301struct cfg80211_chan_def {302/* XXX TODO */303struct linuxkpi_ieee80211_channel *chan;304enum nl80211_chan_width width;305uint32_t center_freq1;306uint32_t center_freq2;307uint16_t punctured;308};309310struct cfg80211_ftm_responder_stats {311/* XXX TODO */312int asap_num, failed_num, filled, non_asap_num, out_of_window_triggers_num, partial_num, reschedule_requests_num, success_num, total_duration_ms, unknown_triggers_num;313};314315struct cfg80211_pmsr_capabilities {316/* XXX TODO */317int max_peers, randomize_mac_addr, report_ap_tsf;318struct {319int asap, bandwidths, max_bursts_exponent, max_ftms_per_burst, non_asap, non_trigger_based, preambles, request_civicloc, request_lci, supported, trigger_based;320} ftm;321};322323struct cfg80211_pmsr_ftm_request {324/* XXX TODO */325int asap, burst_period, ftmr_retries, ftms_per_burst, non_trigger_based, num_bursts_exp, request_civicloc, request_lci, trigger_based;326uint8_t bss_color;327bool lmr_feedback;328};329330struct cfg80211_pmsr_request_peer {331/* XXX TODO */332struct cfg80211_chan_def chandef;333struct cfg80211_pmsr_ftm_request ftm;334uint8_t addr[ETH_ALEN];335int report_ap_tsf;336};337338struct cfg80211_pmsr_request {339/* XXX TODO */340int cookie, n_peers, timeout;341uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];342struct cfg80211_pmsr_request_peer peers[];343};344345struct cfg80211_pmsr_ftm_result {346/* XXX TODO */347int burst_index, busy_retry_time, failure_reason;348int num_ftmr_successes, rssi_avg, rssi_avg_valid, rssi_spread, rssi_spread_valid, rtt_avg, rtt_avg_valid, rtt_spread, rtt_spread_valid, rtt_variance, rtt_variance_valid;349uint8_t *lci;350uint8_t *civicloc;351int lci_len;352int civicloc_len;353};354355struct cfg80211_pmsr_result {356/* XXX TODO */357int ap_tsf, ap_tsf_valid, final, host_time, status, type;358uint8_t addr[ETH_ALEN];359struct cfg80211_pmsr_ftm_result ftm;360};361362struct cfg80211_sar_freq_ranges {363uint32_t start_freq;364uint32_t end_freq;365};366367struct cfg80211_sar_sub_specs {368uint32_t freq_range_index;369int power;370};371372struct cfg80211_sar_specs {373enum nl80211_sar_type type;374uint32_t num_sub_specs;375struct cfg80211_sar_sub_specs sub_specs[];376};377378struct cfg80211_sar_capa {379enum nl80211_sar_type type;380uint32_t num_freq_ranges;381const struct cfg80211_sar_freq_ranges *freq_ranges;382};383384struct cfg80211_ssid {385int ssid_len;386uint8_t ssid[IEEE80211_MAX_SSID_LEN];387};388389struct cfg80211_scan_6ghz_params {390/* XXX TODO */391uint8_t *bssid;392int channel_idx, psc_no_listen, short_ssid, short_ssid_valid, unsolicited_probe, psd_20;393};394395struct cfg80211_match_set {396uint8_t bssid[ETH_ALEN];397struct cfg80211_ssid ssid;398int rssi_thold;399};400401struct cfg80211_scan_request {402/* XXX TODO */403bool no_cck;404bool scan_6ghz;405bool duration_mandatory;406int8_t tsf_report_link_id;407uint16_t duration;408uint32_t flags;409struct wireless_dev *wdev;410struct wiphy *wiphy;411uint64_t scan_start;412uint32_t rates[NUM_NL80211_BANDS];413int ie_len;414uint8_t *ie;415uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];416uint8_t bssid[ETH_ALEN];417int n_ssids;418int n_6ghz_params;419int n_channels;420struct cfg80211_ssid *ssids;421struct cfg80211_scan_6ghz_params *scan_6ghz_params;422struct linuxkpi_ieee80211_channel *channels[0];423};424425struct cfg80211_sched_scan_plan {426/* XXX TODO */427int interval, iterations;428};429430struct cfg80211_sched_scan_request {431/* XXX TODO */432int delay, flags;433uint8_t mac_addr[ETH_ALEN], mac_addr_mask[ETH_ALEN];434uint64_t reqid;435int n_match_sets;436int n_scan_plans;437int n_ssids;438int n_channels;439int ie_len;440uint8_t *ie;441struct cfg80211_match_set *match_sets;442struct cfg80211_sched_scan_plan *scan_plans;443struct cfg80211_ssid *ssids;444struct linuxkpi_ieee80211_channel *channels[0];445};446447struct cfg80211_scan_info {448uint64_t scan_start_tsf;449uint8_t tsf_bssid[ETH_ALEN];450bool aborted;451};452453struct cfg80211_beacon_data {454/* XXX TODO */455const uint8_t *head;456const uint8_t *tail;457uint32_t head_len;458uint32_t tail_len;459const uint8_t *proberesp_ies;460const uint8_t *assocresp_ies;461uint32_t proberesp_ies_len;462uint32_t assocresp_ies_len;463};464465struct cfg80211_ap_settings {466/* XXX TODO */467int auth_type, beacon_interval, dtim_period, hidden_ssid, inactivity_timeout;468const uint8_t *ssid;469size_t ssid_len;470struct cfg80211_beacon_data beacon;471struct cfg80211_chan_def chandef;472};473474struct cfg80211_bss_selection {475/* XXX TODO */476enum nl80211_bss_select_attr behaviour;477union {478enum nl80211_band band_pref;479struct {480enum nl80211_band band;481uint8_t delta;482} adjust;483} param;484};485486struct cfg80211_crypto { /* XXX made up name */487/* XXX TODO */488enum nl80211_wpa_versions wpa_versions;489uint32_t cipher_group; /* WLAN_CIPHER_SUITE_* */490uint32_t *akm_suites;491uint32_t *ciphers_pairwise;492const uint8_t *sae_pwd;493const uint8_t *psk;494int n_akm_suites;495int n_ciphers_pairwise;496int sae_pwd_len;497};498499struct cfg80211_connect_params {500/* XXX TODO */501struct linuxkpi_ieee80211_channel *channel;502uint8_t *bssid;503const uint8_t *ie;504const uint8_t *ssid;505uint32_t ie_len;506uint32_t ssid_len;507const void *key;508uint32_t key_len;509int auth_type, key_idx, privacy, want_1x;510struct cfg80211_bss_selection bss_select;511struct cfg80211_crypto crypto;512};513514enum bss_param_flags { /* Used as bitflags. XXX FIXME values? */515BSS_PARAM_FLAGS_CTS_PROT = 0x01,516BSS_PARAM_FLAGS_SHORT_PREAMBLE = 0x02,517BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 0x04,518};519520struct cfg80211_ibss_params {521/* XXX TODO */522int basic_rates, beacon_interval;523int channel_fixed, ie, ie_len, privacy;524int dtim_period;525uint8_t *ssid;526uint8_t *bssid;527int ssid_len;528struct cfg80211_chan_def chandef;529enum bss_param_flags flags;530};531532struct cfg80211_mgmt_tx_params {533/* XXX TODO */534struct linuxkpi_ieee80211_channel *chan;535const uint8_t *buf;536size_t len;537int wait;538};539540struct cfg80211_pmk_conf {541/* XXX TODO */542const uint8_t *pmk;543uint8_t pmk_len;544};545546struct cfg80211_pmksa {547/* XXX TODO */548const uint8_t *bssid;549const uint8_t *pmkid;550};551552struct station_del_parameters {553/* XXX TODO */554const uint8_t *mac;555uint32_t reason_code; /* elsewhere uint16_t? */556};557558struct station_info {559uint64_t filled; /* enum nl80211_sta_info */560uint32_t connected_time;561uint32_t inactive_time;562563uint64_t rx_bytes;564uint32_t rx_packets;565uint32_t rx_dropped_misc;566567uint64_t rx_duration;568uint32_t rx_beacon;569uint8_t rx_beacon_signal_avg;570571int8_t signal;572int8_t signal_avg;573int8_t ack_signal;574int8_t avg_ack_signal;575576/* gap */577int generation;578579uint64_t tx_bytes;580uint32_t tx_packets;581uint32_t tx_failed;582uint64_t tx_duration;583uint32_t tx_retries;584585int chains;586uint8_t chain_signal[IEEE80211_MAX_CHAINS];587uint8_t chain_signal_avg[IEEE80211_MAX_CHAINS];588589uint8_t *assoc_req_ies;590size_t assoc_req_ies_len;591592struct rate_info rxrate;593struct rate_info txrate;594struct cfg80211_ibss_params bss_param;595struct nl80211_sta_flag_update sta_flags;596};597598struct station_parameters {599/* XXX TODO */600int sta_flags_mask, sta_flags_set;601};602603struct key_params {604/* XXX TODO */605const uint8_t *key;606const uint8_t *seq;607int key_len;608int seq_len;609uint32_t cipher; /* WLAN_CIPHER_SUITE_* */610};611612struct mgmt_frame_regs {613/* XXX TODO */614int interface_stypes;615};616617struct vif_params {618/* XXX TODO */619uint8_t macaddr[ETH_ALEN];620};621622/* That the world needs so many different structs for this is amazing. */623struct mac_address {624uint8_t addr[ETH_ALEN];625};626627struct ieee80211_reg_rule {628/* TODO FIXME */629uint32_t flags;630int dfs_cac_ms;631struct freq_range {632int start_freq_khz;633int end_freq_khz;634int max_bandwidth_khz;635} freq_range;636struct power_rule {637int max_antenna_gain;638int max_eirp;639} power_rule;640};641642struct linuxkpi_ieee80211_regdomain {643/* TODO FIXME */644uint8_t alpha2[2];645int dfs_region;646int n_reg_rules;647struct ieee80211_reg_rule reg_rules[];648};649650#define IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS 0x01651#define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454 0x02652#define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK 0x03653#define IEEE80211_EHT_MAC_CAP0_OM_CONTROL 0x04654#define IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE1 0x05655#define IEEE80211_EHT_MAC_CAP0_TRIG_TXOP_SHARING_MODE2 0x06656#define IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_7991 0x07657#define IEEE80211_EHT_MAC_CAP0_SCS_TRAFFIC_DESC 0x08658659#define IEEE80211_EHT_MAC_CAP1_MAX_AMPDU_LEN_MASK 0x01660661#define IEEE80211_EHT_MCS_NSS_RX 0x01662#define IEEE80211_EHT_MCS_NSS_TX 0x02663664#define IEEE80211_EHT_PHY_CAP0_242_TONE_RU_GT20MHZ 0x01665#define IEEE80211_EHT_PHY_CAP0_320MHZ_IN_6GHZ 0x02666#define IEEE80211_EHT_PHY_CAP0_BEAMFORMEE_SS_80MHZ_MASK 0x03667#define IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI 0x04668#define IEEE80211_EHT_PHY_CAP0_PARTIAL_BW_UL_MU_MIMO 0x05669#define IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMEE 0x06670#define IEEE80211_EHT_PHY_CAP0_SU_BEAMFORMER 0x07671672#define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_160MHZ_MASK 0x01673#define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_320MHZ_MASK 0x02674#define IEEE80211_EHT_PHY_CAP1_BEAMFORMEE_SS_80MHZ_MASK 0x03675676#define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_80MHZ_MASK 0x01677#define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_160MHZ_MASK 0x02678#define IEEE80211_EHT_PHY_CAP2_SOUNDING_DIM_320MHZ_MASK 0x03679680#define IEEE80211_EHT_PHY_CAP3_CODEBOOK_4_2_SU_FDBK 0x01681#define IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK 0x02682#define IEEE80211_EHT_PHY_CAP3_NG_16_MU_FEEDBACK 0x03683#define IEEE80211_EHT_PHY_CAP3_NG_16_SU_FEEDBACK 0x04684#define IEEE80211_EHT_PHY_CAP3_TRIG_CQI_FDBK 0x05685#define IEEE80211_EHT_PHY_CAP3_TRIG_MU_BF_PART_BW_FDBK 0x06686#define IEEE80211_EHT_PHY_CAP3_TRIG_SU_BF_FDBK 0x07687#define IEEE80211_EHT_PHY_CAP3_SOUNDING_DIM_320MHZ_MASK 0x08688689#define IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI 0x01690#define IEEE80211_EHT_PHY_CAP4_PART_BW_DL_MU_MIMO 0x02691#define IEEE80211_EHT_PHY_CAP4_POWER_BOOST_FACT_SUPP 0x03692#define IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK 0x04693694#define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_0US 0x01695#define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_16US 0x02696#define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_20US 0x03697#define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_8US 0x04698#define IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK 0x05699#define IEEE80211_EHT_PHY_CAP5_NON_TRIG_CQI_FEEDBACK 0x06700#define IEEE80211_EHT_PHY_CAP5_PPE_THRESHOLD_PRESENT 0x07701#define IEEE80211_EHT_PHY_CAP5_RX_LESS_242_TONE_RU_SUPP 0x08702#define IEEE80211_EHT_PHY_CAP5_TX_LESS_242_TONE_RU_SUPP 0x09703#define IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK 0x0a704#define IEEE80211_EHT_PHY_CAP5_SUPP_EXTRA_EHT_LTF 0x0b705706#define IEEE80211_EHT_PHY_CAP6_EHT_DUP_6GHZ_SUPP 0x01707#define IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK 0x02708#define IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK 0x03709710#define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_80MHZ 0x01711#define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_160MHZ 0x02712#define IEEE80211_EHT_PHY_CAP7_MU_BEAMFORMER_320MHZ 0x03713#define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_80MHZ 0x04714#define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_160MHZ 0x05715#define IEEE80211_EHT_PHY_CAP7_NON_OFDMA_UL_MU_MIMO_320MHZ 0x06716717#define IEEE80211_EHT_PHY_CAP8_RX_1024QAM_WIDER_BW_DL_OFDMA 0x01718#define IEEE80211_EHT_PHY_CAP8_RX_4096QAM_WIDER_BW_DL_OFDMA 0x02719720#define IEEE80211_EHT_PPE_THRES_INFO_HEADER_SIZE 0x01721#define IEEE80211_EHT_PPE_THRES_NSS_MASK 0x02722#define IEEE80211_EHT_PPE_THRES_RU_INDEX_BITMASK_MASK 0x03723#define IEEE80211_EHT_PPE_THRES_INFO_PPET_SIZE 0x04724725#define IEEE80211_EML_CAP_EMLSR_SUPP 0x01726#define IEEE80211_EML_CAP_TRANSITION_TIMEOUT 0x02727#define IEEE80211_EML_CAP_TRANSITION_TIMEOUT_128TU 0x04728#define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY 0x08729#define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_32US 0x10730#define IEEE80211_EML_CAP_EMLSR_PADDING_DELAY_256US 0x10731#define IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY 0x20732#define IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_64US 0x40733#define IEEE80211_EML_CAP_EMLSR_TRANSITION_DELAY_256US 0x40734735#define VENDOR_CMD_RAW_DATA (void *)(uintptr_t)(-ENOENT)736737/* net80211::net80211_he_cap */738struct ieee80211_sta_he_cap {739bool has_he;740struct ieee80211_he_cap_elem he_cap_elem;741struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;742uint8_t ppe_thres[IEEE80211_HE_CAP_PPE_THRES_MAX];743};744745struct cfg80211_he_bss_color {746int color, enabled;747};748749struct ieee80211_he_obss_pd {750bool enable;751uint8_t min_offset;752uint8_t max_offset;753uint8_t non_srg_max_offset;754uint8_t sr_ctrl;755uint8_t bss_color_bitmap[8];756uint8_t partial_bssid_bitmap[8];757};758759struct ieee80211_eht_mcs_nss_supp_20mhz_only {760union {761struct {762uint8_t rx_tx_mcs7_max_nss;763uint8_t rx_tx_mcs9_max_nss;764uint8_t rx_tx_mcs11_max_nss;765uint8_t rx_tx_mcs13_max_nss;766};767uint8_t rx_tx_max_nss[4];768};769};770771struct ieee80211_eht_mcs_nss_supp_bw {772union {773struct {774uint8_t rx_tx_mcs9_max_nss;775uint8_t rx_tx_mcs11_max_nss;776uint8_t rx_tx_mcs13_max_nss;777};778uint8_t rx_tx_max_nss[3];779};780};781782struct ieee80211_eht_cap_elem_fixed {783uint8_t mac_cap_info[2];784uint8_t phy_cap_info[9];785};786787struct ieee80211_eht_mcs_nss_supp {788/* TODO FIXME */789/* Can only have either or... */790union {791struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;792struct {793struct ieee80211_eht_mcs_nss_supp_bw _80;794struct ieee80211_eht_mcs_nss_supp_bw _160;795struct ieee80211_eht_mcs_nss_supp_bw _320;796} bw;797};798};799800#define IEEE80211_STA_EHT_PPE_THRES_MAX 32801struct ieee80211_sta_eht_cap {802bool has_eht;803struct ieee80211_eht_cap_elem_fixed eht_cap_elem;804struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;805uint8_t eht_ppe_thres[IEEE80211_STA_EHT_PPE_THRES_MAX];806};807808struct ieee80211_sband_iftype_data {809/* TODO FIXME */810enum nl80211_iftype types_mask;811struct ieee80211_sta_he_cap he_cap;812struct ieee80211_he_6ghz_capa he_6ghz_capa;813struct ieee80211_sta_eht_cap eht_cap;814struct {815const uint8_t *data;816size_t len;817} vendor_elems;818};819820struct ieee80211_supported_band {821/* TODO FIXME */822struct linuxkpi_ieee80211_channel *channels;823struct ieee80211_rate *bitrates;824struct ieee80211_sband_iftype_data *iftype_data;825int n_channels;826int n_bitrates;827int n_iftype_data;828enum nl80211_band band;829struct ieee80211_sta_ht_cap ht_cap;830struct ieee80211_sta_vht_cap vht_cap;831};832833struct cfg80211_pkt_pattern {834/* XXX TODO */835uint8_t *mask;836uint8_t *pattern;837int pattern_len;838int pkt_offset;839};840841struct cfg80211_wowlan_nd_match {842/* XXX TODO */843struct cfg80211_ssid ssid;844int n_channels;845uint32_t channels[0]; /* freq! = ieee80211_channel_to_frequency() */846};847848struct cfg80211_wowlan_nd_info {849/* XXX TODO */850int n_matches;851struct cfg80211_wowlan_nd_match *matches[0];852};853854enum wiphy_wowlan_support_flags {855WIPHY_WOWLAN_DISCONNECT,856WIPHY_WOWLAN_MAGIC_PKT,857WIPHY_WOWLAN_SUPPORTS_GTK_REKEY,858WIPHY_WOWLAN_GTK_REKEY_FAILURE,859WIPHY_WOWLAN_EAP_IDENTITY_REQ,860WIPHY_WOWLAN_4WAY_HANDSHAKE,861WIPHY_WOWLAN_RFKILL_RELEASE,862WIPHY_WOWLAN_NET_DETECT,863};864865struct wiphy_wowlan_support {866/* XXX TODO */867enum wiphy_wowlan_support_flags flags;868int max_nd_match_sets, max_pkt_offset, n_patterns, pattern_max_len, pattern_min_len;869};870871struct cfg80211_wowlan_wakeup {872/* XXX TODO */873uint16_t pattern_idx;874bool disconnect;875bool unprot_deauth_disassoc;876bool eap_identity_req;877bool four_way_handshake;878bool gtk_rekey_failure;879bool magic_pkt;880bool rfkill_release;881bool tcp_connlost;882bool tcp_nomoretokens;883bool tcp_match;884bool packet_80211;885struct cfg80211_wowlan_nd_info *net_detect;886uint8_t *packet;887uint16_t packet_len;888uint16_t packet_present_len;889};890891struct cfg80211_wowlan {892/* XXX TODO */893bool any;894bool disconnect;895bool magic_pkt;896bool gtk_rekey_failure;897bool eap_identity_req;898bool four_way_handshake;899bool rfkill_release;900901/* Magic packet patterns. */902int n_patterns;903struct cfg80211_pkt_pattern *patterns;904905/* netdetect? if not assoc? */906struct cfg80211_sched_scan_request *nd_config;907908void *tcp; /* XXX ? */909};910911struct cfg80211_gtk_rekey_data {912/* XXX TODO */913const uint8_t *kck, *kek, *replay_ctr;914uint32_t akm;915uint8_t kck_len, kek_len;916};917918struct cfg80211_tid_cfg {919/* XXX TODO */920int mask, noack, retry_long, rtscts, tids, amsdu, ampdu;921enum nl80211_tx_rate_setting txrate_type;922struct cfg80211_bitrate_mask txrate_mask;923};924925struct cfg80211_tid_config {926/* XXX TODO */927int n_tid_conf;928struct cfg80211_tid_cfg tid_conf[0];929};930931struct ieee80211_iface_limit {932/* TODO FIXME */933int max, types;934};935936struct ieee80211_iface_combination {937/* TODO FIXME */938const struct ieee80211_iface_limit *limits;939int n_limits;940int max_interfaces, num_different_channels;941int beacon_int_infra_match, beacon_int_min_gcd;942int radar_detect_widths;943};944945struct iface_combination_params {946int num_different_channels;947int iftype_num[NUM_NL80211_IFTYPES];948};949950struct regulatory_request {951/* XXX TODO */952uint8_t alpha2[2];953enum environment_cap country_ie_env;954int initiator, dfs_region;955int user_reg_hint_type;956};957958struct cfg80211_set_hw_timestamp {959const uint8_t *macaddr;960bool enable;961};962963enum wiphy_vendor_cmd_need_flags {964WIPHY_VENDOR_CMD_NEED_NETDEV = 0x01,965WIPHY_VENDOR_CMD_NEED_RUNNING = 0x02,966WIPHY_VENDOR_CMD_NEED_WDEV = 0x04,967};968969struct wiphy_vendor_command {970struct {971uint32_t vendor_id;972uint32_t subcmd;973};974uint32_t flags;975void *policy;976int (*doit)(struct wiphy *, struct wireless_dev *, const void *, int);977};978979struct wiphy_iftype_ext_capab {980/* TODO FIXME */981enum nl80211_iftype iftype;982const uint8_t *extended_capabilities;983const uint8_t *extended_capabilities_mask;984uint8_t extended_capabilities_len;985uint16_t eml_capabilities;986uint16_t mld_capa_and_ops;987};988989struct tid_config_support {990/* TODO FIXME */991uint64_t vif; /* enum nl80211_tid_cfg_attr */992uint64_t peer; /* enum nl80211_tid_cfg_attr */993};994995enum cfg80211_regulatory {996REGULATORY_CUSTOM_REG = BIT(0),997REGULATORY_STRICT_REG = BIT(1),998REGULATORY_DISABLE_BEACON_HINTS = BIT(2),999REGULATORY_ENABLE_RELAX_NO_IR = BIT(3),1000REGULATORY_WIPHY_SELF_MANAGED = BIT(4),1001REGULATORY_COUNTRY_IE_IGNORE = BIT(5),1002REGULATORY_COUNTRY_IE_FOLLOW_POWER = BIT(6),1003};10041005struct wiphy_radio_freq_range {1006uint32_t start_freq;1007uint32_t end_freq;1008};10091010struct wiphy_radio {1011int n_freq_range;1012int n_iface_combinations;1013const struct wiphy_radio_freq_range *freq_range;1014const struct ieee80211_iface_combination *iface_combinations;1015};10161017enum wiphy_flags {1018WIPHY_FLAG_AP_UAPSD = BIT(0),1019WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(1),1020WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(2),1021WIPHY_FLAG_HAVE_AP_SME = BIT(3),1022WIPHY_FLAG_IBSS_RSN = BIT(4),1023WIPHY_FLAG_NETNS_OK = BIT(5),1024WIPHY_FLAG_OFFCHAN_TX = BIT(6),1025WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(7),1026WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(8),1027WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(9),1028WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(10),1029WIPHY_FLAG_SUPPORTS_TDLS = BIT(11),1030WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(12),1031WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(13),1032WIPHY_FLAG_4ADDR_AP = BIT(14),1033WIPHY_FLAG_4ADDR_STATION = BIT(15),1034WIPHY_FLAG_SUPPORTS_MLO = BIT(16),1035WIPHY_FLAG_DISABLE_WEXT = BIT(17),1036};10371038struct wiphy_work;1039typedef void (*wiphy_work_fn)(struct wiphy *, struct wiphy_work *);1040struct wiphy_work {1041struct list_head entry;1042wiphy_work_fn fn;1043};1044struct wiphy_delayed_work {1045struct wiphy_work work;1046struct wiphy *wiphy;1047struct timer_list timer;1048};10491050struct wiphy {1051struct mutex mtx;1052struct device *dev;1053struct mac_address *addresses;1054int n_addresses;1055uint32_t flags;1056struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];1057uint8_t perm_addr[ETH_ALEN];1058uint16_t max_scan_ie_len;10591060/* XXX TODO */1061const struct cfg80211_pmsr_capabilities *pmsr_capa;1062const struct cfg80211_sar_capa *sar_capa;1063const struct wiphy_iftype_ext_capab *iftype_ext_capab;1064const struct linuxkpi_ieee80211_regdomain *regd;1065char fw_version[ETHTOOL_FWVERS_LEN];1066const struct ieee80211_iface_combination *iface_combinations;1067const uint32_t *cipher_suites;1068int n_iface_combinations;1069int n_cipher_suites;1070void(*reg_notifier)(struct wiphy *, struct regulatory_request *);1071enum cfg80211_regulatory regulatory_flags;1072int n_vendor_commands;1073const struct wiphy_vendor_command *vendor_commands;1074const struct ieee80211_txrx_stypes *mgmt_stypes;1075uint32_t rts_threshold;1076uint32_t frag_threshold;1077struct tid_config_support tid_config_support;1078uint8_t available_antennas_rx;1079uint8_t available_antennas_tx;10801081int n_radio;1082const struct wiphy_radio *radio;10831084int features, hw_version;1085int interface_modes, max_match_sets, max_remain_on_channel_duration, max_scan_ssids, max_sched_scan_ie_len, max_sched_scan_plan_interval, max_sched_scan_plan_iterations, max_sched_scan_plans, max_sched_scan_reqs, max_sched_scan_ssids;1086int num_iftype_ext_capab;1087int max_ap_assoc_sta, probe_resp_offload, software_iftypes;1088int bss_select_support, max_num_pmkids, retry_long, retry_short, signal_type;1089int max_data_retry_count;1090int tx_queue_len, rfkill;1091int mbssid_max_interfaces;1092int hw_timestamp_max_peers;1093int ema_max_profile_periodicity;10941095unsigned long ext_features[BITS_TO_LONGS(NUM_NL80211_EXT_FEATURES)];1096struct dentry *debugfsdir;10971098const struct wiphy_wowlan_support *wowlan;1099struct cfg80211_wowlan *wowlan_config;1100/* Lower layer (driver/mac80211) specific data. */1101/* Must stay last. */1102uint8_t priv[0] __aligned(CACHE_LINE_SIZE);1103};11041105#define lockdep_assert_wiphy(wiphy) \1106lockdep_assert_held(&(wiphy)->mtx)11071108struct wireless_dev {1109/* XXX TODO, like ic? */1110enum nl80211_iftype iftype;1111uint32_t radio_mask;1112uint8_t address[ETH_ALEN];1113struct net_device *netdev;1114struct wiphy *wiphy;1115};11161117struct cfg80211_ops {1118/* XXX TODO */1119struct wireless_dev *(*add_virtual_intf)(struct wiphy *, const char *, unsigned char, enum nl80211_iftype, struct vif_params *);1120int (*del_virtual_intf)(struct wiphy *, struct wireless_dev *);1121s32 (*change_virtual_intf)(struct wiphy *, struct net_device *, enum nl80211_iftype, struct vif_params *);1122s32 (*scan)(struct wiphy *, struct cfg80211_scan_request *);1123s32 (*set_wiphy_params)(struct wiphy *, u32);1124s32 (*join_ibss)(struct wiphy *, struct net_device *, struct cfg80211_ibss_params *);1125s32 (*leave_ibss)(struct wiphy *, struct net_device *);1126s32 (*get_station)(struct wiphy *, struct net_device *, const u8 *, struct station_info *);1127int (*dump_station)(struct wiphy *, struct net_device *, int, u8 *, struct station_info *);1128s32 (*set_tx_power)(struct wiphy *, struct wireless_dev *, enum nl80211_tx_power_setting, s32);1129s32 (*get_tx_power)(struct wiphy *, struct wireless_dev *, s32 *);1130s32 (*add_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, struct key_params *);1131s32 (*del_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *);1132s32 (*get_key)(struct wiphy *, struct net_device *, u8, bool, const u8 *, void *, void(*)(void *, struct key_params *));1133s32 (*set_default_key)(struct wiphy *, struct net_device *, u8, bool, bool);1134s32 (*set_default_mgmt_key)(struct wiphy *, struct net_device *, u8);1135s32 (*set_power_mgmt)(struct wiphy *, struct net_device *, bool, s32);1136s32 (*connect)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *);1137s32 (*disconnect)(struct wiphy *, struct net_device *, u16);1138s32 (*suspend)(struct wiphy *, struct cfg80211_wowlan *);1139s32 (*resume)(struct wiphy *);1140s32 (*set_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);1141s32 (*del_pmksa)(struct wiphy *, struct net_device *, struct cfg80211_pmksa *);1142s32 (*flush_pmksa)(struct wiphy *, struct net_device *);1143s32 (*start_ap)(struct wiphy *, struct net_device *, struct cfg80211_ap_settings *);1144int (*stop_ap)(struct wiphy *, struct net_device *);1145s32 (*change_beacon)(struct wiphy *, struct net_device *, struct cfg80211_beacon_data *);1146int (*del_station)(struct wiphy *, struct net_device *, struct station_del_parameters *);1147int (*change_station)(struct wiphy *, struct net_device *, const u8 *, struct station_parameters *);1148int (*sched_scan_start)(struct wiphy *, struct net_device *, struct cfg80211_sched_scan_request *);1149int (*sched_scan_stop)(struct wiphy *, struct net_device *, u64);1150void (*update_mgmt_frame_registrations)(struct wiphy *, struct wireless_dev *, struct mgmt_frame_regs *);1151int (*mgmt_tx)(struct wiphy *, struct wireless_dev *, struct cfg80211_mgmt_tx_params *, u64 *);1152int (*cancel_remain_on_channel)(struct wiphy *, struct wireless_dev *, u64);1153int (*get_channel)(struct wiphy *, struct wireless_dev *, struct cfg80211_chan_def *);1154int (*crit_proto_start)(struct wiphy *, struct wireless_dev *, enum nl80211_crit_proto_id, u16);1155void (*crit_proto_stop)(struct wiphy *, struct wireless_dev *);1156int (*tdls_oper)(struct wiphy *, struct net_device *, const u8 *, enum nl80211_tdls_operation);1157int (*update_connect_params)(struct wiphy *, struct net_device *, struct cfg80211_connect_params *, u32);1158int (*set_pmk)(struct wiphy *, struct net_device *, const struct cfg80211_pmk_conf *);1159int (*del_pmk)(struct wiphy *, struct net_device *, const u8 *);1160int (*remain_on_channel)(struct wiphy *, struct wireless_dev *, struct linuxkpi_ieee80211_channel *, unsigned int, u64 *);1161int (*start_p2p_device)(struct wiphy *, struct wireless_dev *);1162void (*stop_p2p_device)(struct wiphy *, struct wireless_dev *);1163};116411651166/* -------------------------------------------------------------------------- */11671168/* linux_80211.c */11691170struct wiphy *linuxkpi_wiphy_new(const struct cfg80211_ops *, size_t);1171void linuxkpi_wiphy_free(struct wiphy *wiphy);11721173void linuxkpi_wiphy_work_queue(struct wiphy *, struct wiphy_work *);1174void linuxkpi_wiphy_work_cancel(struct wiphy *, struct wiphy_work *);1175void linuxkpi_wiphy_work_flush(struct wiphy *, struct wiphy_work *);1176void lkpi_wiphy_delayed_work_timer(struct timer_list *);1177void linuxkpi_wiphy_delayed_work_queue(struct wiphy *,1178struct wiphy_delayed_work *, unsigned long);1179void linuxkpi_wiphy_delayed_work_cancel(struct wiphy *,1180struct wiphy_delayed_work *);11811182int linuxkpi_regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,1183struct linuxkpi_ieee80211_regdomain *regd);1184uint32_t linuxkpi_cfg80211_calculate_bitrate(struct rate_info *);1185uint32_t linuxkpi_ieee80211_channel_to_frequency(uint32_t, enum nl80211_band);1186uint32_t linuxkpi_ieee80211_frequency_to_channel(uint32_t, uint32_t);1187struct linuxkpi_ieee80211_channel *1188linuxkpi_ieee80211_get_channel(struct wiphy *, uint32_t);1189struct cfg80211_bss *linuxkpi_cfg80211_get_bss(struct wiphy *,1190struct linuxkpi_ieee80211_channel *, const uint8_t *,1191const uint8_t *, size_t, enum ieee80211_bss_type, enum ieee80211_privacy);1192void linuxkpi_cfg80211_put_bss(struct wiphy *, struct cfg80211_bss *);1193void linuxkpi_cfg80211_bss_flush(struct wiphy *);1194struct linuxkpi_ieee80211_regdomain *1195lkpi_get_linuxkpi_ieee80211_regdomain(size_t);11961197/* -------------------------------------------------------------------------- */11981199static __inline struct wiphy *1200wiphy_new(const struct cfg80211_ops *ops, size_t priv_len)1201{12021203return (linuxkpi_wiphy_new(ops, priv_len));1204}12051206static __inline void1207wiphy_free(struct wiphy *wiphy)1208{12091210linuxkpi_wiphy_free(wiphy);1211}12121213static __inline void *1214wiphy_priv(struct wiphy *wiphy)1215{12161217return (wiphy->priv);1218}12191220static __inline void1221set_wiphy_dev(struct wiphy *wiphy, struct device *dev)1222{12231224wiphy->dev = dev;1225}12261227static __inline struct device *1228wiphy_dev(struct wiphy *wiphy)1229{12301231return (wiphy->dev);1232}12331234#define wiphy_dereference(_w, p) \1235rcu_dereference_check(p, lockdep_is_held(&(_w)->mtx))12361237#define wiphy_lock(_w) mutex_lock(&(_w)->mtx)1238#define wiphy_unlock(_w) mutex_unlock(&(_w)->mtx)12391240static __inline void1241wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,1242enum rfkill_hard_block_reasons reason)1243{1244TODO();1245}12461247/* -------------------------------------------------------------------------- */12481249static inline struct cfg80211_bss *1250cfg80211_get_bss(struct wiphy *wiphy, struct linuxkpi_ieee80211_channel *chan,1251const uint8_t *bssid, const uint8_t *ssid, size_t ssid_len,1252enum ieee80211_bss_type bss_type, enum ieee80211_privacy privacy)1253{12541255return (linuxkpi_cfg80211_get_bss(wiphy, chan, bssid, ssid, ssid_len,1256bss_type, privacy));1257}12581259static inline void1260cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss)1261{12621263linuxkpi_cfg80211_put_bss(wiphy, bss);1264}12651266static inline void1267cfg80211_bss_flush(struct wiphy *wiphy)1268{12691270linuxkpi_cfg80211_bss_flush(wiphy);1271}12721273/* -------------------------------------------------------------------------- */12741275static __inline bool1276rfkill_blocked(int rfkill) /* argument type? */1277{1278TODO();1279return (false);1280}12811282static __inline bool1283rfkill_soft_blocked(int rfkill)1284{1285TODO();1286return (false);1287}12881289static __inline void1290wiphy_rfkill_start_polling(struct wiphy *wiphy)1291{1292TODO();1293}12941295static __inline void1296wiphy_rfkill_stop_polling(struct wiphy *wiphy)1297{1298TODO();1299}13001301static __inline int1302reg_query_regdb_wmm(uint8_t *alpha2, uint32_t center_freq,1303struct ieee80211_reg_rule *rule)1304{13051306IMPROVE("regdomain.xml needs to grow wmm information for at least ETSI");13071308return (-ENODATA);1309}13101311static __inline const u8 *1312cfg80211_find_ie_match(uint32_t f, const u8 *ies, size_t ies_len,1313const u8 *match, int x, int y)1314{1315TODO();1316return (NULL);1317}13181319static __inline const u8 *1320cfg80211_find_ie(uint8_t eid, const uint8_t *ie, uint32_t ielen)1321{1322TODO();1323return (NULL);1324}13251326static __inline void1327cfg80211_pmsr_complete(struct wireless_dev *wdev,1328struct cfg80211_pmsr_request *req, gfp_t gfp)1329{1330TODO();1331}13321333static __inline void1334cfg80211_pmsr_report(struct wireless_dev *wdev,1335struct cfg80211_pmsr_request *req,1336struct cfg80211_pmsr_result *result, gfp_t gfp)1337{1338TODO();1339}13401341static inline void1342cfg80211_chandef_create(struct cfg80211_chan_def *chandef,1343struct linuxkpi_ieee80211_channel *chan, enum nl80211_channel_type chan_type)1344{13451346KASSERT(chandef != NULL, ("%s: chandef is NULL\n", __func__));1347KASSERT(chan != NULL, ("%s: chan is NULL\n", __func__));13481349/* memset(chandef, 0, sizeof(*chandef)); */1350chandef->chan = chan;1351chandef->center_freq1 = chan->center_freq;1352/* chandef->width, center_freq2, punctured */13531354switch (chan_type) {1355case NL80211_CHAN_NO_HT:1356chandef->width = NL80211_CHAN_WIDTH_20_NOHT;1357break;1358case NL80211_CHAN_HT20:1359chandef->width = NL80211_CHAN_WIDTH_20;1360break;1361case NL80211_CHAN_HT40MINUS:1362chandef->width = NL80211_CHAN_WIDTH_40;1363chandef->center_freq1 -= 10;1364break;1365case NL80211_CHAN_HT40PLUS:1366chandef->width = NL80211_CHAN_WIDTH_40;1367chandef->center_freq1 += 10;1368break;1369};1370}13711372static __inline bool1373cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef)1374{1375TODO();1376return (false);1377}13781379static __inline bool1380cfg80211_chandef_dfs_usable(struct wiphy *wiphy, const struct cfg80211_chan_def *chandef)1381{1382TODO();1383return (false);1384}13851386static __inline unsigned int1387cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy, const struct cfg80211_chan_def *chandef)1388{1389TODO();1390return (0);1391}13921393static __inline bool1394cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef_1,1395const struct cfg80211_chan_def *chandef_2)1396{1397TODO();1398return (false);1399}14001401static __inline bool1402cfg80211_chandef_usable(struct wiphy *wiphy,1403const struct cfg80211_chan_def *chandef, uint32_t flags)1404{1405TODO();1406return (false);1407}14081409static __inline void1410cfg80211_bss_iter(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,1411void (*iterfunc)(struct wiphy *, struct cfg80211_bss *, void *), void *data)1412{1413TODO();1414}14151416struct element {1417uint8_t id;1418uint8_t datalen;1419uint8_t data[0];1420} __packed;14211422static inline const struct element *1423lkpi_cfg80211_find_elem_pattern(enum ieee80211_eid eid,1424const uint8_t *data, size_t len, uint8_t *pattern, size_t plen)1425{1426const struct element *elem;1427const uint8_t *p;1428size_t ielen;14291430p = data;1431elem = (const struct element *)p;1432ielen = len;1433while (elem != NULL && ielen > 1) {1434if ((2 + elem->datalen) > ielen)1435/* Element overruns our memory. */1436return (NULL);1437if (elem->id == eid) {1438if (pattern == NULL)1439return (elem);1440if (elem->datalen >= plen &&1441memcmp(elem->data, pattern, plen) == 0)1442return (elem);1443}1444ielen -= 2 + elem->datalen;1445p += 2 + elem->datalen;1446elem = (const struct element *)p;1447}14481449return (NULL);1450}14511452static inline const struct element *1453cfg80211_find_elem(enum ieee80211_eid eid, const uint8_t *data, size_t len)1454{14551456return (lkpi_cfg80211_find_elem_pattern(eid, data, len, NULL, 0));1457}14581459static inline const struct element *1460ieee80211_bss_get_elem(struct cfg80211_bss *bss, uint32_t eid)1461{14621463if (bss->ies == NULL)1464return (NULL);1465return (cfg80211_find_elem(eid, bss->ies->data, bss->ies->len));1466}14671468static inline const uint8_t *1469ieee80211_bss_get_ie(struct cfg80211_bss *bss, uint32_t eid)1470{14711472return ((const uint8_t *)ieee80211_bss_get_elem(bss, eid));1473}14741475static inline uint8_t *1476cfg80211_find_vendor_ie(unsigned int oui, int oui_type,1477uint8_t *data, size_t len)1478{1479const struct element *elem;1480uint8_t pattern[4] = { oui << 16, oui << 8, oui, oui_type };1481uint8_t plen = 4; /* >= 3? oui_type always part of this? */1482IMPROVE("plen currently always incl. oui_type");14831484elem = lkpi_cfg80211_find_elem_pattern(IEEE80211_ELEMID_VENDOR,1485data, len, pattern, plen);1486if (elem == NULL)1487return (NULL);1488return (__DECONST(uint8_t *, elem));1489}14901491static inline uint32_t1492cfg80211_calculate_bitrate(struct rate_info *rate)1493{1494return (linuxkpi_cfg80211_calculate_bitrate(rate));1495}14961497static __inline uint32_t1498ieee80211_channel_to_frequency(uint32_t channel, enum nl80211_band band)1499{15001501return (linuxkpi_ieee80211_channel_to_frequency(channel, band));1502}15031504static __inline uint32_t1505ieee80211_frequency_to_channel(uint32_t freq)1506{15071508return (linuxkpi_ieee80211_frequency_to_channel(freq, 0));1509}15101511static __inline int1512regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,1513struct linuxkpi_ieee80211_regdomain *regd)1514{1515IMPROVE();1516return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));1517}15181519static __inline int1520regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,1521struct linuxkpi_ieee80211_regdomain *regd)1522{15231524IMPROVE();1525return (linuxkpi_regulatory_set_wiphy_regd_sync(wiphy, regd));1526}15271528static __inline int1529regulatory_set_wiphy_regd(struct wiphy *wiphy,1530struct linuxkpi_ieee80211_regdomain *regd)1531{15321533IMPROVE();1534if (regd == NULL)1535return (EINVAL);15361537/* XXX-BZ wild guessing here based on brcmfmac. */1538if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)1539wiphy->regd = regd;1540else1541return (EPERM);15421543/* XXX FIXME, do we have to do anything with reg_notifier? */1544return (0);1545}15461547static __inline int1548regulatory_hint(struct wiphy *wiphy, const uint8_t *alpha2)1549{1550struct linuxkpi_ieee80211_regdomain *regd;15511552if (wiphy->regd != NULL)1553return (-EBUSY);15541555regd = lkpi_get_linuxkpi_ieee80211_regdomain(0);1556if (regd == NULL)1557return (-ENOMEM);15581559regd->alpha2[0] = alpha2[0];1560regd->alpha2[1] = alpha2[1];1561wiphy->regd = regd;15621563IMPROVE("are there flags who is managing? update net8011?");15641565return (0);1566}15671568static __inline const char *1569reg_initiator_name(enum nl80211_reg_initiator initiator)1570{1571TODO();1572return (NULL);1573}15741575static __inline struct linuxkpi_ieee80211_regdomain *1576rtnl_dereference(const struct linuxkpi_ieee80211_regdomain *regd)1577{1578TODO();1579return (NULL);1580}15811582static __inline struct ieee80211_reg_rule *1583freq_reg_info(struct wiphy *wiphy, uint32_t center_freq)1584{1585TODO();1586return (NULL);1587}15881589static __inline void1590wiphy_apply_custom_regulatory(struct wiphy *wiphy,1591const struct linuxkpi_ieee80211_regdomain *regd)1592{1593TODO();1594}15951596static __inline char *1597wiphy_name(struct wiphy *wiphy)1598{1599if (wiphy != NULL && wiphy->dev != NULL)1600return dev_name(wiphy->dev);1601else {1602IMPROVE("wlanNA");1603return ("wlanNA");1604}1605}16061607static __inline void1608wiphy_read_of_freq_limits(struct wiphy *wiphy)1609{1610#ifdef FDT1611TODO();1612#endif1613}16141615static __inline void1616wiphy_ext_feature_set(struct wiphy *wiphy, enum nl80211_ext_feature ef)1617{16181619set_bit(ef, wiphy->ext_features);1620}16211622static inline bool1623wiphy_ext_feature_isset(struct wiphy *wiphy, enum nl80211_ext_feature ef)1624{1625return (test_bit(ef, wiphy->ext_features));1626}16271628static __inline void *1629wiphy_net(struct wiphy *wiphy)1630{1631TODO();1632return (NULL); /* XXX passed to dev_net_set() */1633}16341635static __inline int1636wiphy_register(struct wiphy *wiphy)1637{1638TODO();1639return (0);1640}16411642static __inline void1643wiphy_unregister(struct wiphy *wiphy)1644{1645TODO();1646}16471648static __inline void1649wiphy_warn(struct wiphy *wiphy, const char *fmt, ...)1650{1651TODO();1652}16531654static __inline int1655cfg80211_check_combinations(struct wiphy *wiphy,1656struct iface_combination_params *params)1657{1658TODO();1659return (-ENOENT);1660}16611662static __inline uint8_t1663cfg80211_classify8021d(struct sk_buff *skb, void *p)1664{1665TODO();1666return (0);1667}16681669static __inline void1670cfg80211_connect_done(struct net_device *ndev,1671struct cfg80211_connect_resp_params *conn_params, gfp_t gfp)1672{1673TODO();1674}16751676static __inline void1677cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp)1678{1679TODO();1680}16811682static __inline void1683cfg80211_disconnected(struct net_device *ndev, uint16_t reason,1684void *p, int x, bool locally_generated, gfp_t gfp)1685{1686TODO();1687}16881689static __inline int1690cfg80211_get_p2p_attr(const u8 *ie, u32 ie_len,1691enum ieee80211_p2p_attr_ids attr, u8 *p, size_t p_len)1692{1693TODO();1694return (-1);1695}16961697static __inline void1698cfg80211_ibss_joined(struct net_device *ndev, const uint8_t *addr,1699struct linuxkpi_ieee80211_channel *chan, gfp_t gfp)1700{1701TODO();1702}17031704static __inline struct cfg80211_bss *1705cfg80211_inform_bss(struct wiphy *wiphy,1706struct linuxkpi_ieee80211_channel *channel,1707enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,1708uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len,1709int signal, gfp_t gfp)1710{1711TODO();1712return (NULL);1713}17141715static __inline struct cfg80211_bss *1716cfg80211_inform_bss_data(struct wiphy *wiphy,1717struct cfg80211_inform_bss *bss_data,1718enum cfg80211_bss_frame_type bss_ftype, const uint8_t *bss, int _x,1719uint16_t cap, uint16_t intvl, const uint8_t *ie, size_t ie_len, gfp_t gfp)1720{1721TODO();1722return (NULL);1723}17241725static __inline void1726cfg80211_mgmt_tx_status(struct wireless_dev *wdev, uint64_t cookie,1727const u8 *buf, size_t len, bool ack, gfp_t gfp)1728{1729TODO();1730}17311732static __inline void1733cfg80211_michael_mic_failure(struct net_device *ndev, const uint8_t *addr,1734enum nl80211_key_type key_type, int _x, void *p, gfp_t gfp)1735{1736TODO();1737}17381739static __inline void1740cfg80211_new_sta(struct net_device *ndev, const uint8_t *addr,1741struct station_info *sinfo, gfp_t gfp)1742{1743TODO();1744}17451746static __inline void1747cfg80211_del_sta(struct net_device *ndev, const uint8_t *addr, gfp_t gfp)1748{1749TODO();1750}17511752static __inline void1753cfg80211_port_authorized(struct net_device *ndev, const uint8_t *bssid,1754gfp_t gfp)1755{1756TODO();1757}17581759static __inline void1760cfg80211_ready_on_channel(struct wireless_dev *wdev, uint64_t cookie,1761struct linuxkpi_ieee80211_channel *channel, unsigned int duration,1762gfp_t gfp)1763{1764TODO();1765}17661767static __inline void1768cfg80211_remain_on_channel_expired(struct wireless_dev *wdev,1769uint64_t cookie, struct linuxkpi_ieee80211_channel *channel, gfp_t gfp)1770{1771TODO();1772}17731774static __inline void1775cfg80211_report_wowlan_wakeup(void)1776{1777TODO();1778}17791780static __inline void1781cfg80211_roamed(struct net_device *ndev, struct cfg80211_roam_info *roam_info,1782gfp_t gfp)1783{1784TODO();1785}17861787static __inline void1788cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int _x,1789uint8_t *p, size_t p_len, int _x2)1790{1791TODO();1792}17931794static __inline void1795cfg80211_scan_done(struct cfg80211_scan_request *scan_request,1796struct cfg80211_scan_info *info)1797{1798TODO();1799}18001801static __inline void1802cfg80211_sched_scan_results(struct wiphy *wiphy, uint64_t reqid)1803{1804TODO();1805}18061807static __inline void1808cfg80211_sched_scan_stopped(struct wiphy *wiphy, int _x)1809{1810TODO();1811}18121813static __inline void1814cfg80211_unregister_wdev(struct wireless_dev *wdev)1815{1816TODO();1817}18181819static __inline struct sk_buff *1820cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, unsigned int len)1821{1822TODO();1823return (NULL);1824}18251826static __inline int1827cfg80211_vendor_cmd_reply(struct sk_buff *skb)1828{1829TODO();1830return (-ENXIO);1831}18321833static __inline struct linuxkpi_ieee80211_channel *1834ieee80211_get_channel(struct wiphy *wiphy, uint32_t freq)1835{18361837return (linuxkpi_ieee80211_get_channel(wiphy, freq));1838}18391840static inline size_t1841ieee80211_get_hdrlen_from_skb(struct sk_buff *skb)1842{1843const struct ieee80211_hdr *hdr;1844size_t len;18451846if (skb->len < 10) /* sizeof(ieee80211_frame_[ack,cts]) */1847return (0);18481849hdr = (const struct ieee80211_hdr *)skb->data;1850len = ieee80211_hdrlen(hdr->frame_control);18511852/* If larger than what is in the skb return. */1853if (len > skb->len)1854return (0);18551856return (len);1857}18581859static __inline bool1860cfg80211_channel_is_psc(struct linuxkpi_ieee80211_channel *channel)1861{18621863/* Only 6Ghz. */1864if (channel->band != NL80211_BAND_6GHZ)1865return (false);18661867TODO();1868return (false);1869}18701871static inline int1872cfg80211_get_ies_channel_number(const uint8_t *ie, size_t len,1873enum nl80211_band band)1874{1875const struct element *elem;18761877switch (band) {1878case NL80211_BAND_6GHZ:1879TODO();1880break;1881case NL80211_BAND_5GHZ:1882case NL80211_BAND_2GHZ:1883/* DSPARAMS has the channel number. */1884elem = cfg80211_find_elem(IEEE80211_ELEMID_DSPARMS, ie, len);1885if (elem != NULL && elem->datalen == 1)1886return (elem->data[0]);1887/* HTINFO has the primary center channel. */1888elem = cfg80211_find_elem(IEEE80211_ELEMID_HTINFO, ie, len);1889if (elem != NULL &&1890elem->datalen >= (sizeof(struct ieee80211_ie_htinfo) - 2)) {1891const struct ieee80211_ie_htinfo *htinfo;1892htinfo = (const struct ieee80211_ie_htinfo *)elem;1893return (htinfo->hi_ctrlchannel);1894}1895/* What else? */1896break;1897default:1898IMPROVE("Unsupported");1899break;1900}1901return (-1);1902}19031904/* Used for scanning at least. */1905static __inline void1906get_random_mask_addr(uint8_t *dst, const uint8_t *addr, const uint8_t *mask)1907{1908int i;19091910/* Get a completely random address and then overlay what we want. */1911get_random_bytes(dst, ETH_ALEN);1912for (i = 0; i < ETH_ALEN; i++)1913dst[i] = (dst[i] & ~(mask[i])) | (addr[i] & mask[i]);1914}19151916static __inline void1917cfg80211_shutdown_all_interfaces(struct wiphy *wiphy)1918{1919TODO();1920}19211922static __inline bool1923cfg80211_reg_can_beacon(struct wiphy *wiphy, struct cfg80211_chan_def *chandef,1924enum nl80211_iftype iftype)1925{1926TODO();1927return (false);1928}19291930static __inline void1931cfg80211_background_radar_event(struct wiphy *wiphy,1932struct cfg80211_chan_def *chandef, gfp_t gfp)1933{1934TODO();1935}19361937static __inline const u8 *1938cfg80211_find_ext_ie(uint8_t eid, const uint8_t *p, size_t len)1939{1940TODO();1941return (NULL);1942}19431944static inline void1945_ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *band,1946struct ieee80211_sband_iftype_data *iftype_data, size_t nitems)1947{1948band->iftype_data = iftype_data;1949band->n_iftype_data = nitems;1950}19511952static inline const struct ieee80211_sband_iftype_data *1953ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *band,1954enum nl80211_iftype iftype)1955{1956const struct ieee80211_sband_iftype_data *iftype_data;1957int i;19581959for (i = 0; i < band->n_iftype_data; i++) {1960iftype_data = (const void *)&band->iftype_data[i];1961if (iftype_data->types_mask & BIT(iftype))1962return (iftype_data);1963}19641965return (NULL);1966}19671968static inline const struct ieee80211_sta_he_cap *1969ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *band,1970enum nl80211_iftype iftype)1971{1972const struct ieee80211_sband_iftype_data *iftype_data;1973const struct ieee80211_sta_he_cap *he_cap;19741975iftype_data = ieee80211_get_sband_iftype_data(band, iftype);1976if (iftype_data == NULL)1977return (NULL);19781979he_cap = NULL;1980if (iftype_data->he_cap.has_he)1981he_cap = &iftype_data->he_cap;19821983return (he_cap);1984}19851986static inline const struct ieee80211_sta_eht_cap *1987ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *band,1988enum nl80211_iftype iftype)1989{1990const struct ieee80211_sband_iftype_data *iftype_data;1991const struct ieee80211_sta_eht_cap *eht_cap;19921993iftype_data = ieee80211_get_sband_iftype_data(band, iftype);1994if (iftype_data == NULL)1995return (NULL);19961997eht_cap = NULL;1998if (iftype_data->eht_cap.has_eht)1999eht_cap = &iftype_data->eht_cap;20002001return (eht_cap);2002}20032004static inline bool2005cfg80211_ssid_eq(struct cfg80211_ssid *ssid1, struct cfg80211_ssid *ssid2)2006{2007int error;20082009if (ssid1 == NULL || ssid2 == NULL) /* Can we KASSERT this? */2010return (false);20112012if (ssid1->ssid_len != ssid2->ssid_len)2013return (false);2014error = memcmp(ssid1->ssid, ssid2->ssid, ssid2->ssid_len);2015if (error != 0)2016return (false);2017return (true);2018}20192020static inline void2021cfg80211_rx_unprot_mlme_mgmt(struct net_device *ndev, const uint8_t *hdr,2022uint32_t len)2023{2024TODO();2025}20262027static inline const struct wiphy_iftype_ext_capab *2028cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype iftype)2029{20302031TODO();2032return (NULL);2033}20342035static inline uint16_t2036ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,2037enum nl80211_iftype iftype)2038{2039TODO();2040return (0);2041}20422043static inline int2044nl80211_chan_width_to_mhz(enum nl80211_chan_width width)2045{2046switch (width) {2047case NL80211_CHAN_WIDTH_5:2048return (5);2049break;2050case NL80211_CHAN_WIDTH_10:2051return (10);2052break;2053case NL80211_CHAN_WIDTH_20_NOHT:2054case NL80211_CHAN_WIDTH_20:2055return (20);2056break;2057case NL80211_CHAN_WIDTH_40:2058return (40);2059break;2060case NL80211_CHAN_WIDTH_80:2061case NL80211_CHAN_WIDTH_80P80:2062return (80);2063break;2064case NL80211_CHAN_WIDTH_160:2065return (160);2066break;2067case NL80211_CHAN_WIDTH_320:2068return (320);2069break;2070}2071}20722073static __inline ssize_t2074wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,2075char *buf, size_t bufsize, const char __user *userbuf, size_t count,2076loff_t *ppos,2077ssize_t (*handler)(struct wiphy *, struct file *, char *, size_t, void *),2078void *data)2079{2080TODO();2081return (-ENXIO);2082}208320842085static __inline ssize_t2086wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file,2087char *buf, size_t bufsize, const char __user *userbuf, size_t count,2088ssize_t (*handler)(struct wiphy *, struct file *, char *, size_t, void *),2089void *data)2090{2091TODO();2092return (-ENXIO);2093}20942095/* -------------------------------------------------------------------------- */20962097static inline void2098wiphy_work_init(struct wiphy_work *wwk, wiphy_work_fn fn)2099{2100INIT_LIST_HEAD(&wwk->entry);2101wwk->fn = fn;2102}21032104static inline void2105wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *wwk)2106{2107linuxkpi_wiphy_work_queue(wiphy, wwk);2108}21092110static inline void2111wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *wwk)2112{2113linuxkpi_wiphy_work_cancel(wiphy, wwk);2114}21152116static inline void2117wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *wwk)2118{2119linuxkpi_wiphy_work_flush(wiphy, wwk);2120}21212122static inline void2123wiphy_delayed_work_init(struct wiphy_delayed_work *wdwk, wiphy_work_fn fn)2124{2125wiphy_work_init(&wdwk->work, fn);2126timer_setup(&wdwk->timer, lkpi_wiphy_delayed_work_timer, 0);2127}21282129static inline void2130wiphy_delayed_work_queue(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk,2131unsigned long delay)2132{2133linuxkpi_wiphy_delayed_work_queue(wiphy, wdwk, delay);2134}21352136static inline void2137wiphy_delayed_work_cancel(struct wiphy *wiphy, struct wiphy_delayed_work *wdwk)2138{2139linuxkpi_wiphy_delayed_work_cancel(wiphy, wdwk);2140}21412142/* -------------------------------------------------------------------------- */21432144#define wiphy_err(_wiphy, _fmt, ...) \2145dev_err((_wiphy)->dev, _fmt, __VA_ARGS__)2146#define wiphy_info(wiphy, fmt, ...) \2147dev_info((wiphy)->dev, fmt, ##__VA_ARGS__)2148#define wiphy_info_once(wiphy, fmt, ...) \2149dev_info_once((wiphy)->dev, fmt, ##__VA_ARGS__)21502151#ifndef LINUXKPI_NET802112152#define ieee80211_channel linuxkpi_ieee80211_channel2153#define ieee80211_regdomain linuxkpi_ieee80211_regdomain2154#endif21552156#include <net/mac80211.h>21572158#endif /* _LINUXKPI_NET_CFG80211_H */215921602161