/* SPDX-License-Identifier: GPL-2.0-only */1#ifndef __NET_CFG80211_H2#define __NET_CFG80211_H3/*4* 802.11 device and configuration interface5*6* Copyright 2006-2010 Johannes Berg <[email protected]>7* Copyright 2013-2014 Intel Mobile Communications GmbH8* Copyright 2015-2017 Intel Deutschland GmbH9* Copyright (C) 2018-2025 Intel Corporation10*/1112#include <linux/ethtool.h>13#include <uapi/linux/rfkill.h>14#include <linux/netdevice.h>15#include <linux/debugfs.h>16#include <linux/list.h>17#include <linux/bug.h>18#include <linux/netlink.h>19#include <linux/skbuff.h>20#include <linux/nl80211.h>21#include <linux/if_ether.h>22#include <linux/ieee80211.h>23#include <linux/net.h>24#include <linux/rfkill.h>25#include <net/regulatory.h>2627/**28* DOC: Introduction29*30* cfg80211 is the configuration API for 802.11 devices in Linux. It bridges31* userspace and drivers, and offers some utility functionality associated32* with 802.11. cfg80211 must, directly or indirectly via mac80211, be used33* by all modern wireless drivers in Linux, so that they offer a consistent34* API through nl80211. For backward compatibility, cfg80211 also offers35* wireless extensions to userspace, but hides them from drivers completely.36*37* Additionally, cfg80211 contains code to help enforce regulatory spectrum38* use restrictions.39*/404142/**43* DOC: Device registration44*45* In order for a driver to use cfg80211, it must register the hardware device46* with cfg80211. This happens through a number of hardware capability structs47* described below.48*49* The fundamental structure for each device is the 'wiphy', of which each50* instance describes a physical wireless device connected to the system. Each51* such wiphy can have zero, one, or many virtual interfaces associated with52* it, which need to be identified as such by pointing the network interface's53* @ieee80211_ptr pointer to a &struct wireless_dev which further describes54* the wireless part of the interface. Normally this struct is embedded in the55* network interface's private data area. Drivers can optionally allow creating56* or destroying virtual interfaces on the fly, but without at least one or the57* ability to create some the wireless device isn't useful.58*59* Each wiphy structure contains device capability information, and also has60* a pointer to the various operations the driver offers. The definitions and61* structures here describe these capabilities in detail.62*/6364struct wiphy;6566/*67* wireless hardware capability structures68*/6970/**71* enum ieee80211_channel_flags - channel flags72*73* Channel flags set by the regulatory control code.74*75* @IEEE80211_CHAN_DISABLED: This channel is disabled.76* @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes77* sending probe requests or beaconing.78* @IEEE80211_CHAN_PSD: Power spectral density (in dBm) is set for this79* channel.80* @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.81* @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel82* is not permitted.83* @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel84* is not permitted.85* @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.86* @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,87* this flag indicates that an 80 MHz channel cannot use this88* channel as the control or any of the secondary channels.89* This may be due to the driver or due to regulatory bandwidth90* restrictions.91* @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,92* this flag indicates that an 160 MHz channel cannot use this93* channel as the control or any of the secondary channels.94* This may be due to the driver or due to regulatory bandwidth95* restrictions.96* @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY97* @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT98* @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted99* on this channel.100* @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted101* on this channel.102* @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.103* @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted104* on this channel.105* @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted106* on this channel.107* @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted108* on this channel.109* @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted110* on this channel.111* @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted112* on this channel.113* @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band,114* this flag indicates that a 320 MHz channel cannot use this115* channel as the control or any of the secondary channels.116* This may be due to the driver or due to regulatory bandwidth117* restrictions.118* @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel.119* @IEEE80211_CHAN_DFS_CONCURRENT: See %NL80211_RRF_DFS_CONCURRENT120* @IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT: Client connection with VLP AP121* not permitted using this channel122* @IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT: Client connection with AFC AP123* not permitted using this channel124* @IEEE80211_CHAN_CAN_MONITOR: This channel can be used for monitor125* mode even in the presence of other (regulatory) restrictions,126* even if it is otherwise disabled.127* @IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP: Allow using this channel for AP operation128* with very low power (VLP), even if otherwise set to NO_IR.129* @IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY: Allow activity on a 20 MHz channel,130* even if otherwise set to NO_IR.131*/132enum ieee80211_channel_flags {133IEEE80211_CHAN_DISABLED = BIT(0),134IEEE80211_CHAN_NO_IR = BIT(1),135IEEE80211_CHAN_PSD = BIT(2),136IEEE80211_CHAN_RADAR = BIT(3),137IEEE80211_CHAN_NO_HT40PLUS = BIT(4),138IEEE80211_CHAN_NO_HT40MINUS = BIT(5),139IEEE80211_CHAN_NO_OFDM = BIT(6),140IEEE80211_CHAN_NO_80MHZ = BIT(7),141IEEE80211_CHAN_NO_160MHZ = BIT(8),142IEEE80211_CHAN_INDOOR_ONLY = BIT(9),143IEEE80211_CHAN_IR_CONCURRENT = BIT(10),144IEEE80211_CHAN_NO_20MHZ = BIT(11),145IEEE80211_CHAN_NO_10MHZ = BIT(12),146IEEE80211_CHAN_NO_HE = BIT(13),147IEEE80211_CHAN_1MHZ = BIT(14),148IEEE80211_CHAN_2MHZ = BIT(15),149IEEE80211_CHAN_4MHZ = BIT(16),150IEEE80211_CHAN_8MHZ = BIT(17),151IEEE80211_CHAN_16MHZ = BIT(18),152IEEE80211_CHAN_NO_320MHZ = BIT(19),153IEEE80211_CHAN_NO_EHT = BIT(20),154IEEE80211_CHAN_DFS_CONCURRENT = BIT(21),155IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT = BIT(22),156IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT = BIT(23),157IEEE80211_CHAN_CAN_MONITOR = BIT(24),158IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP = BIT(25),159IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY = BIT(26),160};161162#define IEEE80211_CHAN_NO_HT40 \163(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)164165#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000166#define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)167168/**169* struct ieee80211_channel - channel definition170*171* This structure describes a single channel for use172* with cfg80211.173*174* @center_freq: center frequency in MHz175* @freq_offset: offset from @center_freq, in KHz176* @hw_value: hardware-specific value for the channel177* @flags: channel flags from &enum ieee80211_channel_flags.178* @orig_flags: channel flags at registration time, used by regulatory179* code to support devices with additional restrictions180* @band: band this channel belongs to.181* @max_antenna_gain: maximum antenna gain in dBi182* @max_power: maximum transmission power (in dBm)183* @max_reg_power: maximum regulatory transmission power (in dBm)184* @beacon_found: helper to regulatory code to indicate when a beacon185* has been found on this channel. Use regulatory_hint_found_beacon()186* to enable this, this is useful only on 5 GHz band.187* @orig_mag: internal use188* @orig_mpwr: internal use189* @dfs_state: current state of this channel. Only relevant if radar is required190* on this channel.191* @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.192* @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.193* @psd: power spectral density (in dBm)194*/195struct ieee80211_channel {196enum nl80211_band band;197u32 center_freq;198u16 freq_offset;199u16 hw_value;200u32 flags;201int max_antenna_gain;202int max_power;203int max_reg_power;204bool beacon_found;205u32 orig_flags;206int orig_mag, orig_mpwr;207enum nl80211_dfs_state dfs_state;208unsigned long dfs_state_entered;209unsigned int dfs_cac_ms;210s8 psd;211};212213/**214* enum ieee80211_rate_flags - rate flags215*216* Hardware/specification flags for rates. These are structured217* in a way that allows using the same bitrate structure for218* different bands/PHY modes.219*220* @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short221* preamble on this bitrate; only relevant in 2.4GHz band and222* with CCK rates.223* @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate224* when used with 802.11a (on the 5 GHz band); filled by the225* core code when registering the wiphy.226* @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate227* when used with 802.11b (on the 2.4 GHz band); filled by the228* core code when registering the wiphy.229* @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate230* when used with 802.11g (on the 2.4 GHz band); filled by the231* core code when registering the wiphy.232* @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.233* @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode234* @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode235*/236enum ieee80211_rate_flags {237IEEE80211_RATE_SHORT_PREAMBLE = BIT(0),238IEEE80211_RATE_MANDATORY_A = BIT(1),239IEEE80211_RATE_MANDATORY_B = BIT(2),240IEEE80211_RATE_MANDATORY_G = BIT(3),241IEEE80211_RATE_ERP_G = BIT(4),242IEEE80211_RATE_SUPPORTS_5MHZ = BIT(5),243IEEE80211_RATE_SUPPORTS_10MHZ = BIT(6),244};245246/**247* enum ieee80211_bss_type - BSS type filter248*249* @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS250* @IEEE80211_BSS_TYPE_PBSS: Personal BSS251* @IEEE80211_BSS_TYPE_IBSS: Independent BSS252* @IEEE80211_BSS_TYPE_MBSS: Mesh BSS253* @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type254*/255enum ieee80211_bss_type {256IEEE80211_BSS_TYPE_ESS,257IEEE80211_BSS_TYPE_PBSS,258IEEE80211_BSS_TYPE_IBSS,259IEEE80211_BSS_TYPE_MBSS,260IEEE80211_BSS_TYPE_ANY261};262263/**264* enum ieee80211_privacy - BSS privacy filter265*266* @IEEE80211_PRIVACY_ON: privacy bit set267* @IEEE80211_PRIVACY_OFF: privacy bit clear268* @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting269*/270enum ieee80211_privacy {271IEEE80211_PRIVACY_ON,272IEEE80211_PRIVACY_OFF,273IEEE80211_PRIVACY_ANY274};275276#define IEEE80211_PRIVACY(x) \277((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)278279/**280* struct ieee80211_rate - bitrate definition281*282* This structure describes a bitrate that an 802.11 PHY can283* operate with. The two values @hw_value and @hw_value_short284* are only for driver use when pointers to this structure are285* passed around.286*287* @flags: rate-specific flags from &enum ieee80211_rate_flags288* @bitrate: bitrate in units of 100 Kbps289* @hw_value: driver/hardware value for this rate290* @hw_value_short: driver/hardware value for this rate when291* short preamble is used292*/293struct ieee80211_rate {294u32 flags;295u16 bitrate;296u16 hw_value, hw_value_short;297};298299/**300* struct ieee80211_he_obss_pd - AP settings for spatial reuse301*302* @enable: is the feature enabled.303* @sr_ctrl: The SR Control field of SRP element.304* @non_srg_max_offset: non-SRG maximum tx power offset305* @min_offset: minimal tx power offset an associated station shall use306* @max_offset: maximum tx power offset an associated station shall use307* @bss_color_bitmap: bitmap that indicates the BSS color values used by308* members of the SRG309* @partial_bssid_bitmap: bitmap that indicates the partial BSSID values310* used by members of the SRG311*/312struct ieee80211_he_obss_pd {313bool enable;314u8 sr_ctrl;315u8 non_srg_max_offset;316u8 min_offset;317u8 max_offset;318u8 bss_color_bitmap[8];319u8 partial_bssid_bitmap[8];320};321322/**323* struct cfg80211_he_bss_color - AP settings for BSS coloring324*325* @color: the current color.326* @enabled: HE BSS color is used327* @partial: define the AID equation.328*/329struct cfg80211_he_bss_color {330u8 color;331bool enabled;332bool partial;333};334335/**336* struct ieee80211_sta_ht_cap - STA's HT capabilities337*338* This structure describes most essential parameters needed339* to describe 802.11n HT capabilities for an STA.340*341* @ht_supported: is HT supported by the STA342* @cap: HT capabilities map as described in 802.11n spec343* @ampdu_factor: Maximum A-MPDU length factor344* @ampdu_density: Minimum A-MPDU spacing345* @mcs: Supported MCS rates346*/347struct ieee80211_sta_ht_cap {348u16 cap; /* use IEEE80211_HT_CAP_ */349bool ht_supported;350u8 ampdu_factor;351u8 ampdu_density;352struct ieee80211_mcs_info mcs;353};354355/**356* struct ieee80211_sta_vht_cap - STA's VHT capabilities357*358* This structure describes most essential parameters needed359* to describe 802.11ac VHT capabilities for an STA.360*361* @vht_supported: is VHT supported by the STA362* @cap: VHT capabilities map as described in 802.11ac spec363* @vht_mcs: Supported VHT MCS rates364*/365struct ieee80211_sta_vht_cap {366bool vht_supported;367u32 cap; /* use IEEE80211_VHT_CAP_ */368struct ieee80211_vht_mcs_info vht_mcs;369};370371#define IEEE80211_HE_PPE_THRES_MAX_LEN 25372373/**374* struct ieee80211_sta_he_cap - STA's HE capabilities375*376* This structure describes most essential parameters needed377* to describe 802.11ax HE capabilities for a STA.378*379* @has_he: true iff HE data is valid.380* @he_cap_elem: Fixed portion of the HE capabilities element.381* @he_mcs_nss_supp: The supported NSS/MCS combinations.382* @ppe_thres: Holds the PPE Thresholds data.383*/384struct ieee80211_sta_he_cap {385bool has_he;386struct ieee80211_he_cap_elem he_cap_elem;387struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;388u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];389};390391/**392* struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS393*394* See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS395* and NSS Set field"396*397* @only_20mhz: MCS/NSS support for 20 MHz-only STA.398* @bw: MCS/NSS support for 80, 160 and 320 MHz399* @bw._80: MCS/NSS support for BW <= 80 MHz400* @bw._160: MCS/NSS support for BW = 160 MHz401* @bw._320: MCS/NSS support for BW = 320 MHz402*/403struct ieee80211_eht_mcs_nss_supp {404union {405struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;406struct {407struct ieee80211_eht_mcs_nss_supp_bw _80;408struct ieee80211_eht_mcs_nss_supp_bw _160;409struct ieee80211_eht_mcs_nss_supp_bw _320;410} __packed bw;411} __packed;412} __packed;413414#define IEEE80211_EHT_PPE_THRES_MAX_LEN 32415416/**417* struct ieee80211_sta_eht_cap - STA's EHT capabilities418*419* This structure describes most essential parameters needed420* to describe 802.11be EHT capabilities for a STA.421*422* @has_eht: true iff EHT data is valid.423* @eht_cap_elem: Fixed portion of the eht capabilities element.424* @eht_mcs_nss_supp: The supported NSS/MCS combinations.425* @eht_ppe_thres: Holds the PPE Thresholds data.426*/427struct ieee80211_sta_eht_cap {428bool has_eht;429struct ieee80211_eht_cap_elem_fixed eht_cap_elem;430struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;431u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];432};433434/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */435#ifdef __CHECKER__436/*437* This is used to mark the sband->iftype_data pointer which is supposed438* to be an array with special access semantics (per iftype), but a lot439* of code got it wrong in the past, so with this marking sparse will be440* noisy when the pointer is used directly.441*/442# define __iftd __attribute__((noderef, address_space(__iftype_data)))443#else444# define __iftd445#endif /* __CHECKER__ */446447/**448* struct ieee80211_sband_iftype_data - sband data per interface type449*450* This structure encapsulates sband data that is relevant for the451* interface types defined in @types_mask. Each type in the452* @types_mask must be unique across all instances of iftype_data.453*454* @types_mask: interface types mask455* @he_cap: holds the HE capabilities456* @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a457* 6 GHz band channel (and 0 may be valid value).458* @eht_cap: STA's EHT capabilities459* @vendor_elems: vendor element(s) to advertise460* @vendor_elems.data: vendor element(s) data461* @vendor_elems.len: vendor element(s) length462*/463struct ieee80211_sband_iftype_data {464u16 types_mask;465struct ieee80211_sta_he_cap he_cap;466struct ieee80211_he_6ghz_capa he_6ghz_capa;467struct ieee80211_sta_eht_cap eht_cap;468struct {469const u8 *data;470unsigned int len;471} vendor_elems;472};473474/**475* enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations476*477* @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz478* @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz479* @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz480* @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz481* @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz482* @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz483* @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz484* @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and485* 2.16GHz+2.16GHz486* @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and487* 4.32GHz + 4.32GHz488* @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and489* 4.32GHz + 4.32GHz490* @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz491* and 4.32GHz + 4.32GHz492* @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,493* 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz494*/495enum ieee80211_edmg_bw_config {496IEEE80211_EDMG_BW_CONFIG_4 = 4,497IEEE80211_EDMG_BW_CONFIG_5 = 5,498IEEE80211_EDMG_BW_CONFIG_6 = 6,499IEEE80211_EDMG_BW_CONFIG_7 = 7,500IEEE80211_EDMG_BW_CONFIG_8 = 8,501IEEE80211_EDMG_BW_CONFIG_9 = 9,502IEEE80211_EDMG_BW_CONFIG_10 = 10,503IEEE80211_EDMG_BW_CONFIG_11 = 11,504IEEE80211_EDMG_BW_CONFIG_12 = 12,505IEEE80211_EDMG_BW_CONFIG_13 = 13,506IEEE80211_EDMG_BW_CONFIG_14 = 14,507IEEE80211_EDMG_BW_CONFIG_15 = 15,508};509510/**511* struct ieee80211_edmg - EDMG configuration512*513* This structure describes most essential parameters needed514* to describe 802.11ay EDMG configuration515*516* @channels: bitmap that indicates the 2.16 GHz channel(s)517* that are allowed to be used for transmissions.518* Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.519* Set to 0 indicate EDMG not supported.520* @bw_config: Channel BW Configuration subfield encodes521* the allowed channel bandwidth configurations522*/523struct ieee80211_edmg {524u8 channels;525enum ieee80211_edmg_bw_config bw_config;526};527528/**529* struct ieee80211_sta_s1g_cap - STA's S1G capabilities530*531* This structure describes most essential parameters needed532* to describe 802.11ah S1G capabilities for a STA.533*534* @s1g: is STA an S1G STA535* @cap: S1G capabilities information536* @nss_mcs: Supported NSS MCS set537*/538struct ieee80211_sta_s1g_cap {539bool s1g;540u8 cap[10]; /* use S1G_CAPAB_ */541u8 nss_mcs[5];542};543544/**545* struct ieee80211_supported_band - frequency band definition546*547* This structure describes a frequency band a wiphy548* is able to operate in.549*550* @channels: Array of channels the hardware can operate with551* in this band.552* @band: the band this structure represents553* @n_channels: Number of channels in @channels554* @bitrates: Array of bitrates the hardware can operate with555* in this band. Must be sorted to give a valid "supported556* rates" IE, i.e. CCK rates first, then OFDM.557* @n_bitrates: Number of bitrates in @bitrates558* @ht_cap: HT capabilities in this band559* @vht_cap: VHT capabilities in this band560* @s1g_cap: S1G capabilities in this band561* @edmg_cap: EDMG capabilities in this band562* @s1g_cap: S1G capabilities in this band (S1G band only, of course)563* @n_iftype_data: number of iftype data entries564* @iftype_data: interface type data entries. Note that the bits in565* @types_mask inside this structure cannot overlap (i.e. only566* one occurrence of each type is allowed across all instances of567* iftype_data).568*/569struct ieee80211_supported_band {570struct ieee80211_channel *channels;571struct ieee80211_rate *bitrates;572enum nl80211_band band;573int n_channels;574int n_bitrates;575struct ieee80211_sta_ht_cap ht_cap;576struct ieee80211_sta_vht_cap vht_cap;577struct ieee80211_sta_s1g_cap s1g_cap;578struct ieee80211_edmg edmg_cap;579u16 n_iftype_data;580const struct ieee80211_sband_iftype_data __iftd *iftype_data;581};582583/**584* _ieee80211_set_sband_iftype_data - set sband iftype data array585* @sband: the sband to initialize586* @iftd: the iftype data array pointer587* @n_iftd: the length of the iftype data array588*589* Set the sband iftype data array; use this where the length cannot590* be derived from the ARRAY_SIZE() of the argument, but prefer591* ieee80211_set_sband_iftype_data() where it can be used.592*/593static inline void594_ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *sband,595const struct ieee80211_sband_iftype_data *iftd,596u16 n_iftd)597{598sband->iftype_data = (const void __iftd __force *)iftd;599sband->n_iftype_data = n_iftd;600}601602/**603* ieee80211_set_sband_iftype_data - set sband iftype data array604* @sband: the sband to initialize605* @iftd: the iftype data array606*/607#define ieee80211_set_sband_iftype_data(sband, iftd) \608_ieee80211_set_sband_iftype_data(sband, iftd, ARRAY_SIZE(iftd))609610/**611* for_each_sband_iftype_data - iterate sband iftype data entries612* @sband: the sband whose iftype_data array to iterate613* @i: iterator counter614* @iftd: iftype data pointer to set615*/616#define for_each_sband_iftype_data(sband, i, iftd) \617for (i = 0, iftd = (const void __force *)&(sband)->iftype_data[i]; \618i < (sband)->n_iftype_data; \619i++, iftd = (const void __force *)&(sband)->iftype_data[i])620621/**622* ieee80211_get_sband_iftype_data - return sband data for a given iftype623* @sband: the sband to search for the STA on624* @iftype: enum nl80211_iftype625*626* Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found627*/628static inline const struct ieee80211_sband_iftype_data *629ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,630u8 iftype)631{632const struct ieee80211_sband_iftype_data *data;633int i;634635if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))636return NULL;637638if (iftype == NL80211_IFTYPE_AP_VLAN)639iftype = NL80211_IFTYPE_AP;640641for_each_sband_iftype_data(sband, i, data) {642if (data->types_mask & BIT(iftype))643return data;644}645646return NULL;647}648649/**650* ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype651* @sband: the sband to search for the iftype on652* @iftype: enum nl80211_iftype653*654* Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found655*/656static inline const struct ieee80211_sta_he_cap *657ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,658u8 iftype)659{660const struct ieee80211_sband_iftype_data *data =661ieee80211_get_sband_iftype_data(sband, iftype);662663if (data && data->he_cap.has_he)664return &data->he_cap;665666return NULL;667}668669/**670* ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities671* @sband: the sband to search for the STA on672* @iftype: the iftype to search for673*674* Return: the 6GHz capabilities675*/676static inline __le16677ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,678enum nl80211_iftype iftype)679{680const struct ieee80211_sband_iftype_data *data =681ieee80211_get_sband_iftype_data(sband, iftype);682683if (WARN_ON(!data || !data->he_cap.has_he))684return 0;685686return data->he_6ghz_capa.capa;687}688689/**690* ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype691* @sband: the sband to search for the iftype on692* @iftype: enum nl80211_iftype693*694* Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found695*/696static inline const struct ieee80211_sta_eht_cap *697ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,698enum nl80211_iftype iftype)699{700const struct ieee80211_sband_iftype_data *data =701ieee80211_get_sband_iftype_data(sband, iftype);702703if (data && data->eht_cap.has_eht)704return &data->eht_cap;705706return NULL;707}708709/**710* wiphy_read_of_freq_limits - read frequency limits from device tree711*712* @wiphy: the wireless device to get extra limits for713*714* Some devices may have extra limitations specified in DT. This may be useful715* for chipsets that normally support more bands but are limited due to board716* design (e.g. by antennas or external power amplifier).717*718* This function reads info from DT and uses it to *modify* channels (disable719* unavailable ones). It's usually a *bad* idea to use it in drivers with720* shared channel data as DT limitations are device specific. You should make721* sure to call it only if channels in wiphy are copied and can be modified722* without affecting other devices.723*724* As this function access device node it has to be called after set_wiphy_dev.725* It also modifies channels so they have to be set first.726* If using this helper, call it before wiphy_register().727*/728#ifdef CONFIG_OF729void wiphy_read_of_freq_limits(struct wiphy *wiphy);730#else /* CONFIG_OF */731static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)732{733}734#endif /* !CONFIG_OF */735736737/*738* Wireless hardware/device configuration structures and methods739*/740741/**742* DOC: Actions and configuration743*744* Each wireless device and each virtual interface offer a set of configuration745* operations and other actions that are invoked by userspace. Each of these746* actions is described in the operations structure, and the parameters these747* operations use are described separately.748*749* Additionally, some operations are asynchronous and expect to get status750* information via some functions that drivers need to call.751*752* Scanning and BSS list handling with its associated functionality is described753* in a separate chapter.754*/755756#define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\757WLAN_USER_POSITION_LEN)758759/**760* struct vif_params - describes virtual interface parameters761* @flags: monitor interface flags, unchanged if 0, otherwise762* %MONITOR_FLAG_CHANGED will be set763* @use_4addr: use 4-address frames764* @macaddr: address to use for this virtual interface.765* If this parameter is set to zero address the driver may766* determine the address as needed.767* This feature is only fully supported by drivers that enable the768* %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating769** only p2p devices with specified MAC.770* @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets771* belonging to that MU-MIMO groupID; %NULL if not changed772* @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring773* MU-MIMO packets going to the specified station; %NULL if not changed774*/775struct vif_params {776u32 flags;777int use_4addr;778u8 macaddr[ETH_ALEN];779const u8 *vht_mumimo_groups;780const u8 *vht_mumimo_follow_addr;781};782783/**784* struct key_params - key information785*786* Information about a key787*788* @key: key material789* @key_len: length of key material790* @cipher: cipher suite selector791* @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used792* with the get_key() callback, must be in little endian,793* length given by @seq_len.794* @seq_len: length of @seq.795* @vlan_id: vlan_id for VLAN group key (if nonzero)796* @mode: key install mode (RX_TX, NO_TX or SET_TX)797*/798struct key_params {799const u8 *key;800const u8 *seq;801int key_len;802int seq_len;803u16 vlan_id;804u32 cipher;805enum nl80211_key_mode mode;806};807808/**809* struct cfg80211_chan_def - channel definition810* @chan: the (control) channel811* @width: channel width812* @center_freq1: center frequency of first segment813* @center_freq2: center frequency of second segment814* (only with 80+80 MHz)815* @edmg: define the EDMG channels configuration.816* If edmg is requested (i.e. the .channels member is non-zero),817* chan will define the primary channel and all other818* parameters are ignored.819* @freq1_offset: offset from @center_freq1, in KHz820* @punctured: mask of the punctured 20 MHz subchannels, with821* bits turned on being disabled (punctured); numbered822* from lower to higher frequency (like in the spec)823*/824struct cfg80211_chan_def {825struct ieee80211_channel *chan;826enum nl80211_chan_width width;827u32 center_freq1;828u32 center_freq2;829struct ieee80211_edmg edmg;830u16 freq1_offset;831u16 punctured;832};833834/*835* cfg80211_bitrate_mask - masks for bitrate control836*/837struct cfg80211_bitrate_mask {838struct {839u32 legacy;840u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];841u16 vht_mcs[NL80211_VHT_NSS_MAX];842u16 he_mcs[NL80211_HE_NSS_MAX];843enum nl80211_txrate_gi gi;844enum nl80211_he_gi he_gi;845enum nl80211_he_ltf he_ltf;846} control[NUM_NL80211_BANDS];847};848849850/**851* struct cfg80211_tid_cfg - TID specific configuration852* @config_override: Flag to notify driver to reset TID configuration853* of the peer.854* @tids: bitmap of TIDs to modify855* @mask: bitmap of attributes indicating which parameter changed,856* similar to &nl80211_tid_config_supp.857* @noack: noack configuration value for the TID858* @retry_long: retry count value859* @retry_short: retry count value860* @ampdu: Enable/Disable MPDU aggregation861* @rtscts: Enable/Disable RTS/CTS862* @amsdu: Enable/Disable MSDU aggregation863* @txrate_type: Tx bitrate mask type864* @txrate_mask: Tx bitrate to be applied for the TID865*/866struct cfg80211_tid_cfg {867bool config_override;868u8 tids;869u64 mask;870enum nl80211_tid_config noack;871u8 retry_long, retry_short;872enum nl80211_tid_config ampdu;873enum nl80211_tid_config rtscts;874enum nl80211_tid_config amsdu;875enum nl80211_tx_rate_setting txrate_type;876struct cfg80211_bitrate_mask txrate_mask;877};878879/**880* struct cfg80211_tid_config - TID configuration881* @peer: Station's MAC address882* @n_tid_conf: Number of TID specific configurations to be applied883* @tid_conf: Configuration change info884*/885struct cfg80211_tid_config {886const u8 *peer;887u32 n_tid_conf;888struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf);889};890891/**892* struct cfg80211_fils_aad - FILS AAD data893* @macaddr: STA MAC address894* @kek: FILS KEK895* @kek_len: FILS KEK length896* @snonce: STA Nonce897* @anonce: AP Nonce898*/899struct cfg80211_fils_aad {900const u8 *macaddr;901const u8 *kek;902u8 kek_len;903const u8 *snonce;904const u8 *anonce;905};906907/**908* struct cfg80211_set_hw_timestamp - enable/disable HW timestamping909* @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all910* addresses.911* @enable: if set, enable HW timestamping for the specified MAC address.912* Otherwise disable HW timestamping for the specified MAC address.913*/914struct cfg80211_set_hw_timestamp {915const u8 *macaddr;916bool enable;917};918919/**920* cfg80211_get_chandef_type - return old channel type from chandef921* @chandef: the channel definition922*923* Return: The old channel type (NOHT, HT20, HT40+/-) from a given924* chandef, which must have a bandwidth allowing this conversion.925*/926static inline enum nl80211_channel_type927cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)928{929switch (chandef->width) {930case NL80211_CHAN_WIDTH_20_NOHT:931return NL80211_CHAN_NO_HT;932case NL80211_CHAN_WIDTH_20:933return NL80211_CHAN_HT20;934case NL80211_CHAN_WIDTH_40:935if (chandef->center_freq1 > chandef->chan->center_freq)936return NL80211_CHAN_HT40PLUS;937return NL80211_CHAN_HT40MINUS;938default:939WARN_ON(1);940return NL80211_CHAN_NO_HT;941}942}943944/**945* cfg80211_chandef_create - create channel definition using channel type946* @chandef: the channel definition struct to fill947* @channel: the control channel948* @chantype: the channel type949*950* Given a channel type, create a channel definition.951*/952void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,953struct ieee80211_channel *channel,954enum nl80211_channel_type chantype);955956/**957* cfg80211_chandef_identical - check if two channel definitions are identical958* @chandef1: first channel definition959* @chandef2: second channel definition960*961* Return: %true if the channels defined by the channel definitions are962* identical, %false otherwise.963*/964static inline bool965cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,966const struct cfg80211_chan_def *chandef2)967{968return (chandef1->chan == chandef2->chan &&969chandef1->width == chandef2->width &&970chandef1->center_freq1 == chandef2->center_freq1 &&971chandef1->freq1_offset == chandef2->freq1_offset &&972chandef1->center_freq2 == chandef2->center_freq2 &&973chandef1->punctured == chandef2->punctured);974}975976/**977* cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel978*979* @chandef: the channel definition980*981* Return: %true if EDMG defined, %false otherwise.982*/983static inline bool984cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)985{986return chandef->edmg.channels || chandef->edmg.bw_config;987}988989/**990* cfg80211_chandef_compatible - check if two channel definitions are compatible991* @chandef1: first channel definition992* @chandef2: second channel definition993*994* Return: %NULL if the given channel definitions are incompatible,995* chandef1 or chandef2 otherwise.996*/997const struct cfg80211_chan_def *998cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,999const struct cfg80211_chan_def *chandef2);10001001/**1002* nl80211_chan_width_to_mhz - get the channel width in MHz1003* @chan_width: the channel width from &enum nl80211_chan_width1004*1005* Return: channel width in MHz if the chan_width from &enum nl80211_chan_width1006* is valid. -1 otherwise.1007*/1008int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width);10091010/**1011* cfg80211_chandef_get_width - return chandef width in MHz1012* @c: chandef to return bandwidth for1013* Return: channel width in MHz for the given chandef; note that it returns1014* 80 for 80+80 configurations1015*/1016static inline int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)1017{1018return nl80211_chan_width_to_mhz(c->width);1019}10201021/**1022* cfg80211_chandef_valid - check if a channel definition is valid1023* @chandef: the channel definition to check1024* Return: %true if the channel definition is valid. %false otherwise.1025*/1026bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);10271028/**1029* cfg80211_chandef_usable - check if secondary channels can be used1030* @wiphy: the wiphy to validate against1031* @chandef: the channel definition to check1032* @prohibited_flags: the regulatory channel flags that must not be set1033* Return: %true if secondary channels are usable. %false otherwise.1034*/1035bool cfg80211_chandef_usable(struct wiphy *wiphy,1036const struct cfg80211_chan_def *chandef,1037u32 prohibited_flags);10381039/**1040* cfg80211_chandef_dfs_required - checks if radar detection is required1041* @wiphy: the wiphy to validate against1042* @chandef: the channel definition to check1043* @iftype: the interface type as specified in &enum nl80211_iftype1044* Returns:1045* 1 if radar detection is required, 0 if it is not, < 0 on error1046*/1047int cfg80211_chandef_dfs_required(struct wiphy *wiphy,1048const struct cfg80211_chan_def *chandef,1049enum nl80211_iftype iftype);10501051/**1052* cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we1053* can/need start CAC on such channel1054* @wiphy: the wiphy to validate against1055* @chandef: the channel definition to check1056*1057* Return: true if all channels available and at least1058* one channel requires CAC (NL80211_DFS_USABLE)1059*/1060bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,1061const struct cfg80211_chan_def *chandef);10621063/**1064* cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given1065* channel definition1066* @wiphy: the wiphy to validate against1067* @chandef: the channel definition to check1068*1069* Returns: DFS CAC time (in ms) which applies for this channel definition1070*/1071unsigned int1072cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,1073const struct cfg80211_chan_def *chandef);10741075/**1076* cfg80211_chandef_primary - calculate primary 40/80/160 MHz freq1077* @chandef: chandef to calculate for1078* @primary_chan_width: primary channel width to calculate center for1079* @punctured: punctured sub-channel bitmap, will be recalculated1080* according to the new bandwidth, can be %NULL1081*1082* Returns: the primary 40/80/160 MHz channel center frequency, or -11083* for errors, updating the punctured bitmap1084*/1085int cfg80211_chandef_primary(const struct cfg80211_chan_def *chandef,1086enum nl80211_chan_width primary_chan_width,1087u16 *punctured);10881089/**1090* nl80211_send_chandef - sends the channel definition.1091* @msg: the msg to send channel definition1092* @chandef: the channel definition to check1093*1094* Returns: 0 if sent the channel definition to msg, < 0 on error1095**/1096int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef);10971098/**1099* ieee80211_chandef_max_power - maximum transmission power for the chandef1100*1101* In some regulations, the transmit power may depend on the configured channel1102* bandwidth which may be defined as dBm/MHz. This function returns the actual1103* max_power for non-standard (20 MHz) channels.1104*1105* @chandef: channel definition for the channel1106*1107* Returns: maximum allowed transmission power in dBm for the chandef1108*/1109static inline int1110ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)1111{1112switch (chandef->width) {1113case NL80211_CHAN_WIDTH_5:1114return min(chandef->chan->max_reg_power - 6,1115chandef->chan->max_power);1116case NL80211_CHAN_WIDTH_10:1117return min(chandef->chan->max_reg_power - 3,1118chandef->chan->max_power);1119default:1120break;1121}1122return chandef->chan->max_power;1123}11241125/**1126* cfg80211_any_usable_channels - check for usable channels1127* @wiphy: the wiphy to check for1128* @band_mask: which bands to check on1129* @prohibited_flags: which channels to not consider usable,1130* %IEEE80211_CHAN_DISABLED is always taken into account1131*1132* Return: %true if usable channels found, %false otherwise1133*/1134bool cfg80211_any_usable_channels(struct wiphy *wiphy,1135unsigned long band_mask,1136u32 prohibited_flags);11371138/**1139* enum survey_info_flags - survey information flags1140*1141* @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in1142* @SURVEY_INFO_IN_USE: channel is currently being used1143* @SURVEY_INFO_TIME: active time (in ms) was filled in1144* @SURVEY_INFO_TIME_BUSY: busy time was filled in1145* @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in1146* @SURVEY_INFO_TIME_RX: receive time was filled in1147* @SURVEY_INFO_TIME_TX: transmit time was filled in1148* @SURVEY_INFO_TIME_SCAN: scan time was filled in1149* @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in1150*1151* Used by the driver to indicate which info in &struct survey_info1152* it has filled in during the get_survey().1153*/1154enum survey_info_flags {1155SURVEY_INFO_NOISE_DBM = BIT(0),1156SURVEY_INFO_IN_USE = BIT(1),1157SURVEY_INFO_TIME = BIT(2),1158SURVEY_INFO_TIME_BUSY = BIT(3),1159SURVEY_INFO_TIME_EXT_BUSY = BIT(4),1160SURVEY_INFO_TIME_RX = BIT(5),1161SURVEY_INFO_TIME_TX = BIT(6),1162SURVEY_INFO_TIME_SCAN = BIT(7),1163SURVEY_INFO_TIME_BSS_RX = BIT(8),1164};11651166/**1167* struct survey_info - channel survey response1168*1169* @channel: the channel this survey record reports, may be %NULL for a single1170* record to report global statistics1171* @filled: bitflag of flags from &enum survey_info_flags1172* @noise: channel noise in dBm. This and all following fields are1173* optional1174* @time: amount of time in ms the radio was turn on (on the channel)1175* @time_busy: amount of time the primary channel was sensed busy1176* @time_ext_busy: amount of time the extension channel was sensed busy1177* @time_rx: amount of time the radio spent receiving data1178* @time_tx: amount of time the radio spent transmitting data1179* @time_scan: amount of time the radio spent for scanning1180* @time_bss_rx: amount of time the radio spent receiving data on a local BSS1181*1182* Used by dump_survey() to report back per-channel survey information.1183*1184* This structure can later be expanded with things like1185* channel duty cycle etc.1186*/1187struct survey_info {1188struct ieee80211_channel *channel;1189u64 time;1190u64 time_busy;1191u64 time_ext_busy;1192u64 time_rx;1193u64 time_tx;1194u64 time_scan;1195u64 time_bss_rx;1196u32 filled;1197s8 noise;1198};11991200#define CFG80211_MAX_NUM_AKM_SUITES 1012011202/**1203* struct cfg80211_crypto_settings - Crypto settings1204* @wpa_versions: indicates which, if any, WPA versions are enabled1205* (from enum nl80211_wpa_versions)1206* @cipher_group: group key cipher suite (or 0 if unset)1207* @n_ciphers_pairwise: number of AP supported unicast ciphers1208* @ciphers_pairwise: unicast key cipher suites1209* @n_akm_suites: number of AKM suites1210* @akm_suites: AKM suites1211* @control_port: Whether user space controls IEEE 802.1X port, i.e.,1212* sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is1213* required to assume that the port is unauthorized until authorized by1214* user space. Otherwise, port is marked authorized by default.1215* @control_port_ethertype: the control port protocol that should be1216* allowed through even on unauthorized ports1217* @control_port_no_encrypt: TRUE to prevent encryption of control port1218* protocol frames.1219* @control_port_over_nl80211: TRUE if userspace expects to exchange control1220* port frames over NL80211 instead of the network interface.1221* @control_port_no_preauth: disables pre-auth rx over the nl80211 control1222* port for mac802111223* @psk: PSK (for devices supporting 4-way-handshake offload)1224* @sae_pwd: password for SAE authentication (for devices supporting SAE1225* offload)1226* @sae_pwd_len: length of SAE password (for devices supporting SAE offload)1227* @sae_pwe: The mechanisms allowed for SAE PWE derivation:1228*1229* NL80211_SAE_PWE_UNSPECIFIED1230* Not-specified, used to indicate userspace did not specify any1231* preference. The driver should follow its internal policy in1232* such a scenario.1233*1234* NL80211_SAE_PWE_HUNT_AND_PECK1235* Allow hunting-and-pecking loop only1236*1237* NL80211_SAE_PWE_HASH_TO_ELEMENT1238* Allow hash-to-element only1239*1240* NL80211_SAE_PWE_BOTH1241* Allow either hunting-and-pecking loop or hash-to-element1242*/1243struct cfg80211_crypto_settings {1244u32 wpa_versions;1245u32 cipher_group;1246int n_ciphers_pairwise;1247u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];1248int n_akm_suites;1249u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];1250bool control_port;1251__be16 control_port_ethertype;1252bool control_port_no_encrypt;1253bool control_port_over_nl80211;1254bool control_port_no_preauth;1255const u8 *psk;1256const u8 *sae_pwd;1257u8 sae_pwd_len;1258enum nl80211_sae_pwe_mechanism sae_pwe;1259};12601261/**1262* struct cfg80211_mbssid_config - AP settings for multi bssid1263*1264* @tx_wdev: pointer to the transmitted interface in the MBSSID set1265* @tx_link_id: link ID of the transmitted profile in an MLD.1266* @index: index of this AP in the multi bssid group.1267* @ema: set to true if the beacons should be sent out in EMA mode.1268*/1269struct cfg80211_mbssid_config {1270struct wireless_dev *tx_wdev;1271u8 tx_link_id;1272u8 index;1273bool ema;1274};12751276/**1277* struct cfg80211_mbssid_elems - Multiple BSSID elements1278*1279* @cnt: Number of elements in array %elems.1280*1281* @elem: Array of multiple BSSID element(s) to be added into Beacon frames.1282* @elem.data: Data for multiple BSSID elements.1283* @elem.len: Length of data.1284*/1285struct cfg80211_mbssid_elems {1286u8 cnt;1287struct {1288const u8 *data;1289size_t len;1290} elem[] __counted_by(cnt);1291};12921293/**1294* struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements1295*1296* @cnt: Number of elements in array %elems.1297*1298* @elem: Array of RNR element(s) to be added into Beacon frames.1299* @elem.data: Data for RNR elements.1300* @elem.len: Length of data.1301*/1302struct cfg80211_rnr_elems {1303u8 cnt;1304struct {1305const u8 *data;1306size_t len;1307} elem[] __counted_by(cnt);1308};13091310/**1311* struct cfg80211_beacon_data - beacon data1312* @link_id: the link ID for the AP MLD link sending this beacon1313* @head: head portion of beacon (before TIM IE)1314* or %NULL if not changed1315* @tail: tail portion of beacon (after TIM IE)1316* or %NULL if not changed1317* @head_len: length of @head1318* @tail_len: length of @tail1319* @beacon_ies: extra information element(s) to add into Beacon frames or %NULL1320* @beacon_ies_len: length of beacon_ies in octets1321* @proberesp_ies: extra information element(s) to add into Probe Response1322* frames or %NULL1323* @proberesp_ies_len: length of proberesp_ies in octets1324* @assocresp_ies: extra information element(s) to add into (Re)Association1325* Response frames or %NULL1326* @assocresp_ies_len: length of assocresp_ies in octets1327* @probe_resp_len: length of probe response template (@probe_resp)1328* @probe_resp: probe response template (AP mode only)1329* @mbssid_ies: multiple BSSID elements1330* @rnr_ies: reduced neighbor report elements1331* @ftm_responder: enable FTM responder functionality; -1 for no change1332* (which also implies no change in LCI/civic location data)1333* @lci: Measurement Report element content, starting with Measurement Token1334* (measurement type 8)1335* @civicloc: Measurement Report element content, starting with Measurement1336* Token (measurement type 11)1337* @lci_len: LCI data length1338* @civicloc_len: Civic location data length1339* @he_bss_color: BSS Color settings1340* @he_bss_color_valid: indicates whether bss color1341* attribute is present in beacon data or not.1342*/1343struct cfg80211_beacon_data {1344unsigned int link_id;13451346const u8 *head, *tail;1347const u8 *beacon_ies;1348const u8 *proberesp_ies;1349const u8 *assocresp_ies;1350const u8 *probe_resp;1351const u8 *lci;1352const u8 *civicloc;1353struct cfg80211_mbssid_elems *mbssid_ies;1354struct cfg80211_rnr_elems *rnr_ies;1355s8 ftm_responder;13561357size_t head_len, tail_len;1358size_t beacon_ies_len;1359size_t proberesp_ies_len;1360size_t assocresp_ies_len;1361size_t probe_resp_len;1362size_t lci_len;1363size_t civicloc_len;1364struct cfg80211_he_bss_color he_bss_color;1365bool he_bss_color_valid;1366};13671368struct mac_address {1369u8 addr[ETH_ALEN];1370};13711372/**1373* struct cfg80211_acl_data - Access control list data1374*1375* @acl_policy: ACL policy to be applied on the station's1376* entry specified by mac_addr1377* @n_acl_entries: Number of MAC address entries passed1378* @mac_addrs: List of MAC addresses of stations to be used for ACL1379*/1380struct cfg80211_acl_data {1381enum nl80211_acl_policy acl_policy;1382int n_acl_entries;13831384/* Keep it last */1385struct mac_address mac_addrs[] __counted_by(n_acl_entries);1386};13871388/**1389* struct cfg80211_fils_discovery - FILS discovery parameters from1390* IEEE Std 802.11ai-2016, Annex C.3 MIB detail.1391*1392* @update: Set to true if the feature configuration should be updated.1393* @min_interval: Minimum packet interval in TUs (0 - 10000)1394* @max_interval: Maximum packet interval in TUs (0 - 10000)1395* @tmpl_len: Template length1396* @tmpl: Template data for FILS discovery frame including the action1397* frame headers.1398*/1399struct cfg80211_fils_discovery {1400bool update;1401u32 min_interval;1402u32 max_interval;1403size_t tmpl_len;1404const u8 *tmpl;1405};14061407/**1408* struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe1409* response parameters in 6GHz.1410*1411* @update: Set to true if the feature configuration should be updated.1412* @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned1413* in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive1414* scanning1415* @tmpl_len: Template length1416* @tmpl: Template data for probe response1417*/1418struct cfg80211_unsol_bcast_probe_resp {1419bool update;1420u32 interval;1421size_t tmpl_len;1422const u8 *tmpl;1423};14241425/**1426* struct cfg80211_s1g_short_beacon - S1G short beacon data.1427*1428* @update: Set to true if the feature configuration should be updated.1429* @short_head: Short beacon head.1430* @short_tail: Short beacon tail.1431* @short_head_len: Short beacon head len.1432* @short_tail_len: Short beacon tail len.1433*/1434struct cfg80211_s1g_short_beacon {1435bool update;1436const u8 *short_head;1437const u8 *short_tail;1438size_t short_head_len;1439size_t short_tail_len;1440};14411442/**1443* struct cfg80211_ap_settings - AP configuration1444*1445* Used to configure an AP interface.1446*1447* @chandef: defines the channel to use1448* @beacon: beacon data1449* @beacon_interval: beacon interval1450* @dtim_period: DTIM period1451* @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from1452* user space)1453* @ssid_len: length of @ssid1454* @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames1455* @crypto: crypto settings1456* @privacy: the BSS uses privacy1457* @auth_type: Authentication type (algorithm)1458* @inactivity_timeout: time in seconds to determine station's inactivity.1459* @p2p_ctwindow: P2P CT Window1460* @p2p_opp_ps: P2P opportunistic PS1461* @acl: ACL configuration used by the drivers which has support for1462* MAC address based access control1463* @pbss: If set, start as a PCP instead of AP. Relevant for DMG1464* networks.1465* @beacon_rate: bitrate to be used for beacons1466* @ht_cap: HT capabilities (or %NULL if HT isn't enabled)1467* @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)1468* @he_cap: HE capabilities (or %NULL if HE isn't enabled)1469* @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)1470* @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)1471* @ht_required: stations must support HT1472* @vht_required: stations must support VHT1473* @twt_responder: Enable Target Wait Time1474* @he_required: stations must support HE1475* @sae_h2e_required: stations must support direct H2E technique in SAE1476* @flags: flags, as defined in &enum nl80211_ap_settings_flags1477* @he_obss_pd: OBSS Packet Detection settings1478* @he_oper: HE operation IE (or %NULL if HE isn't enabled)1479* @fils_discovery: FILS discovery transmission parameters1480* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1481* @mbssid_config: AP settings for multiple bssid1482* @s1g_long_beacon_period: S1G long beacon period1483* @s1g_short_beacon: S1G short beacon data1484*/1485struct cfg80211_ap_settings {1486struct cfg80211_chan_def chandef;14871488struct cfg80211_beacon_data beacon;14891490int beacon_interval, dtim_period;1491const u8 *ssid;1492size_t ssid_len;1493enum nl80211_hidden_ssid hidden_ssid;1494struct cfg80211_crypto_settings crypto;1495bool privacy;1496enum nl80211_auth_type auth_type;1497int inactivity_timeout;1498u8 p2p_ctwindow;1499bool p2p_opp_ps;1500const struct cfg80211_acl_data *acl;1501bool pbss;1502struct cfg80211_bitrate_mask beacon_rate;15031504const struct ieee80211_ht_cap *ht_cap;1505const struct ieee80211_vht_cap *vht_cap;1506const struct ieee80211_he_cap_elem *he_cap;1507const struct ieee80211_he_operation *he_oper;1508const struct ieee80211_eht_cap_elem *eht_cap;1509const struct ieee80211_eht_operation *eht_oper;1510bool ht_required, vht_required, he_required, sae_h2e_required;1511bool twt_responder;1512u32 flags;1513struct ieee80211_he_obss_pd he_obss_pd;1514struct cfg80211_fils_discovery fils_discovery;1515struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1516struct cfg80211_mbssid_config mbssid_config;1517u8 s1g_long_beacon_period;1518struct cfg80211_s1g_short_beacon s1g_short_beacon;1519};152015211522/**1523* struct cfg80211_ap_update - AP configuration update1524*1525* Subset of &struct cfg80211_ap_settings, for updating a running AP.1526*1527* @beacon: beacon data1528* @fils_discovery: FILS discovery transmission parameters1529* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1530* @s1g_short_beacon: S1G short beacon data1531*/1532struct cfg80211_ap_update {1533struct cfg80211_beacon_data beacon;1534struct cfg80211_fils_discovery fils_discovery;1535struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1536struct cfg80211_s1g_short_beacon s1g_short_beacon;1537};15381539/**1540* struct cfg80211_csa_settings - channel switch settings1541*1542* Used for channel switch1543*1544* @chandef: defines the channel to use after the switch1545* @beacon_csa: beacon data while performing the switch1546* @counter_offsets_beacon: offsets of the counters within the beacon (tail)1547* @counter_offsets_presp: offsets of the counters within the probe response1548* @n_counter_offsets_beacon: number of csa counters the beacon (tail)1549* @n_counter_offsets_presp: number of csa counters in the probe response1550* @beacon_after: beacon data to be used on the new channel1551* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1552* @radar_required: whether radar detection is required on the new channel1553* @block_tx: whether transmissions should be blocked while changing1554* @count: number of beacons until switch1555* @link_id: defines the link on which channel switch is expected during1556* MLO. 0 in case of non-MLO.1557*/1558struct cfg80211_csa_settings {1559struct cfg80211_chan_def chandef;1560struct cfg80211_beacon_data beacon_csa;1561const u16 *counter_offsets_beacon;1562const u16 *counter_offsets_presp;1563unsigned int n_counter_offsets_beacon;1564unsigned int n_counter_offsets_presp;1565struct cfg80211_beacon_data beacon_after;1566struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1567bool radar_required;1568bool block_tx;1569u8 count;1570u8 link_id;1571};15721573/**1574* struct cfg80211_color_change_settings - color change settings1575*1576* Used for bss color change1577*1578* @beacon_color_change: beacon data while performing the color countdown1579* @counter_offset_beacon: offsets of the counters within the beacon (tail)1580* @counter_offset_presp: offsets of the counters within the probe response1581* @beacon_next: beacon data to be used after the color change1582* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1583* @count: number of beacons until the color change1584* @color: the color used after the change1585* @link_id: defines the link on which color change is expected during MLO.1586* 0 in case of non-MLO.1587*/1588struct cfg80211_color_change_settings {1589struct cfg80211_beacon_data beacon_color_change;1590u16 counter_offset_beacon;1591u16 counter_offset_presp;1592struct cfg80211_beacon_data beacon_next;1593struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1594u8 count;1595u8 color;1596u8 link_id;1597};15981599/**1600* struct iface_combination_params - input parameters for interface combinations1601*1602* Used to pass interface combination parameters1603*1604* @radio_idx: wiphy radio index or -1 for global1605* @num_different_channels: the number of different channels we want1606* to use for verification1607* @radar_detect: a bitmap where each bit corresponds to a channel1608* width where radar detection is needed, as in the definition of1609* &struct ieee80211_iface_combination.@radar_detect_widths1610* @iftype_num: array with the number of interfaces of each interface1611* type. The index is the interface type as specified in &enum1612* nl80211_iftype.1613* @new_beacon_int: set this to the beacon interval of a new interface1614* that's not operating yet, if such is to be checked as part of1615* the verification1616*/1617struct iface_combination_params {1618int radio_idx;1619int num_different_channels;1620u8 radar_detect;1621int iftype_num[NUM_NL80211_IFTYPES];1622u32 new_beacon_int;1623};16241625/**1626* enum station_parameters_apply_mask - station parameter values to apply1627* @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)1628* @STATION_PARAM_APPLY_CAPABILITY: apply new capability1629* @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state1630*1631* Not all station parameters have in-band "no change" signalling,1632* for those that don't these flags will are used.1633*/1634enum station_parameters_apply_mask {1635STATION_PARAM_APPLY_UAPSD = BIT(0),1636STATION_PARAM_APPLY_CAPABILITY = BIT(1),1637STATION_PARAM_APPLY_PLINK_STATE = BIT(2),1638};16391640/**1641* struct sta_txpwr - station txpower configuration1642*1643* Used to configure txpower for station.1644*1645* @power: tx power (in dBm) to be used for sending data traffic. If tx power1646* is not provided, the default per-interface tx power setting will be1647* overriding. Driver should be picking up the lowest tx power, either tx1648* power per-interface or per-station.1649* @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power1650* will be less than or equal to specified from userspace, whereas if TPC1651* %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.1652* NL80211_TX_POWER_FIXED is not a valid configuration option for1653* per peer TPC.1654*/1655struct sta_txpwr {1656s16 power;1657enum nl80211_tx_power_setting type;1658};16591660/**1661* struct link_station_parameters - link station parameters1662*1663* Used to change and create a new link station.1664*1665* @mld_mac: MAC address of the station1666* @link_id: the link id (-1 for non-MLD station)1667* @link_mac: MAC address of the link1668* @supported_rates: supported rates in IEEE 802.11 format1669* (or NULL for no change)1670* @supported_rates_len: number of supported rates1671* @ht_capa: HT capabilities of station1672* @vht_capa: VHT capabilities of station1673* @opmode_notif: operating mode field from Operating Mode Notification1674* @opmode_notif_used: information if operating mode field is used1675* @he_capa: HE capabilities of station1676* @he_capa_len: the length of the HE capabilities1677* @txpwr: transmit power for an associated station1678* @txpwr_set: txpwr field is set1679* @he_6ghz_capa: HE 6 GHz Band capabilities of station1680* @eht_capa: EHT capabilities of station1681* @eht_capa_len: the length of the EHT capabilities1682* @s1g_capa: S1G capabilities of station1683*/1684struct link_station_parameters {1685const u8 *mld_mac;1686int link_id;1687const u8 *link_mac;1688const u8 *supported_rates;1689u8 supported_rates_len;1690const struct ieee80211_ht_cap *ht_capa;1691const struct ieee80211_vht_cap *vht_capa;1692u8 opmode_notif;1693bool opmode_notif_used;1694const struct ieee80211_he_cap_elem *he_capa;1695u8 he_capa_len;1696struct sta_txpwr txpwr;1697bool txpwr_set;1698const struct ieee80211_he_6ghz_capa *he_6ghz_capa;1699const struct ieee80211_eht_cap_elem *eht_capa;1700u8 eht_capa_len;1701const struct ieee80211_s1g_cap *s1g_capa;1702};17031704/**1705* struct link_station_del_parameters - link station deletion parameters1706*1707* Used to delete a link station entry (or all stations).1708*1709* @mld_mac: MAC address of the station1710* @link_id: the link id1711*/1712struct link_station_del_parameters {1713const u8 *mld_mac;1714u32 link_id;1715};17161717/**1718* struct cfg80211_ttlm_params: TID to link mapping parameters1719*1720* Used for setting a TID to link mapping.1721*1722* @dlink: Downlink TID to link mapping, as defined in section 9.4.2.3141723* (TID-To-Link Mapping element) in Draft P802.11be_D4.0.1724* @ulink: Uplink TID to link mapping, as defined in section 9.4.2.3141725* (TID-To-Link Mapping element) in Draft P802.11be_D4.0.1726*/1727struct cfg80211_ttlm_params {1728u16 dlink[8];1729u16 ulink[8];1730};17311732/**1733* struct station_parameters - station parameters1734*1735* Used to change and create a new station.1736*1737* @vlan: vlan interface station should belong to1738* @sta_flags_mask: station flags that changed1739* (bitmask of BIT(%NL80211_STA_FLAG_...))1740* @sta_flags_set: station flags values1741* (bitmask of BIT(%NL80211_STA_FLAG_...))1742* @listen_interval: listen interval or -1 for no change1743* @aid: AID or zero for no change1744* @vlan_id: VLAN ID for station (if nonzero)1745* @peer_aid: mesh peer AID or zero for no change1746* @plink_action: plink action to take1747* @plink_state: set the peer link state for a station1748* @uapsd_queues: bitmap of queues configured for uapsd. same format1749* as the AC bitmap in the QoS info field1750* @max_sp: max Service Period. same format as the MAX_SP in the1751* QoS info field (but already shifted down)1752* @sta_modify_mask: bitmap indicating which parameters changed1753* (for those that don't have a natural "no change" value),1754* see &enum station_parameters_apply_mask1755* @local_pm: local link-specific mesh power save mode (no change when set1756* to unknown)1757* @capability: station capability1758* @ext_capab: extended capabilities of the station1759* @ext_capab_len: number of extended capabilities1760* @supported_channels: supported channels in IEEE 802.11 format1761* @supported_channels_len: number of supported channels1762* @supported_oper_classes: supported oper classes in IEEE 802.11 format1763* @supported_oper_classes_len: number of supported operating classes1764* @support_p2p_ps: information if station supports P2P PS mechanism1765* @airtime_weight: airtime scheduler weight for this station1766* @eml_cap_present: Specifies if EML capabilities field (@eml_cap) is1767* present/updated1768* @eml_cap: EML capabilities of this station1769* @link_sta_params: link related params.1770*/1771struct station_parameters {1772struct net_device *vlan;1773u32 sta_flags_mask, sta_flags_set;1774u32 sta_modify_mask;1775int listen_interval;1776u16 aid;1777u16 vlan_id;1778u16 peer_aid;1779u8 plink_action;1780u8 plink_state;1781u8 uapsd_queues;1782u8 max_sp;1783enum nl80211_mesh_power_mode local_pm;1784u16 capability;1785const u8 *ext_capab;1786u8 ext_capab_len;1787const u8 *supported_channels;1788u8 supported_channels_len;1789const u8 *supported_oper_classes;1790u8 supported_oper_classes_len;1791int support_p2p_ps;1792u16 airtime_weight;1793bool eml_cap_present;1794u16 eml_cap;1795struct link_station_parameters link_sta_params;1796};17971798/**1799* struct station_del_parameters - station deletion parameters1800*1801* Used to delete a station entry (or all stations).1802*1803* @mac: MAC address of the station to remove or NULL to remove all stations1804* @subtype: Management frame subtype to use for indicating removal1805* (10 = Disassociation, 12 = Deauthentication)1806* @reason_code: Reason code for the Disassociation/Deauthentication frame1807* @link_id: Link ID indicating a link that stations to be flushed must be1808* using; valid only for MLO, but can also be -1 for MLO to really1809* remove all stations.1810*/1811struct station_del_parameters {1812const u8 *mac;1813u8 subtype;1814u16 reason_code;1815int link_id;1816};18171818/**1819* enum cfg80211_station_type - the type of station being modified1820* @CFG80211_STA_AP_CLIENT: client of an AP interface1821* @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still1822* unassociated (update properties for this type of client is permitted)1823* @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has1824* the AP MLME in the device1825* @CFG80211_STA_AP_STA: AP station on managed interface1826* @CFG80211_STA_IBSS: IBSS station1827* @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry1828* while TDLS setup is in progress, it moves out of this state when1829* being marked authorized; use this only if TDLS with external setup is1830* supported/used)1831* @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active1832* entry that is operating, has been marked authorized by userspace)1833* @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)1834* @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)1835*/1836enum cfg80211_station_type {1837CFG80211_STA_AP_CLIENT,1838CFG80211_STA_AP_CLIENT_UNASSOC,1839CFG80211_STA_AP_MLME_CLIENT,1840CFG80211_STA_AP_STA,1841CFG80211_STA_IBSS,1842CFG80211_STA_TDLS_PEER_SETUP,1843CFG80211_STA_TDLS_PEER_ACTIVE,1844CFG80211_STA_MESH_PEER_KERNEL,1845CFG80211_STA_MESH_PEER_USER,1846};18471848/**1849* cfg80211_check_station_change - validate parameter changes1850* @wiphy: the wiphy this operates on1851* @params: the new parameters for a station1852* @statype: the type of station being modified1853*1854* Utility function for the @change_station driver method. Call this function1855* with the appropriate station type looking up the station (and checking that1856* it exists). It will verify whether the station change is acceptable.1857*1858* Return: 0 if the change is acceptable, otherwise an error code. Note that1859* it may modify the parameters for backward compatibility reasons, so don't1860* use them before calling this.1861*/1862int cfg80211_check_station_change(struct wiphy *wiphy,1863struct station_parameters *params,1864enum cfg80211_station_type statype);18651866/**1867* enum rate_info_flags - bitrate info flags1868*1869* Used by the driver to indicate the specific rate transmission1870* type for 802.11n transmissions.1871*1872* @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS1873* @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS1874* @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval1875* @RATE_INFO_FLAGS_DMG: 60GHz MCS1876* @RATE_INFO_FLAGS_HE_MCS: HE MCS information1877* @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode1878* @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS1879* @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information1880* @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS1881*/1882enum rate_info_flags {1883RATE_INFO_FLAGS_MCS = BIT(0),1884RATE_INFO_FLAGS_VHT_MCS = BIT(1),1885RATE_INFO_FLAGS_SHORT_GI = BIT(2),1886RATE_INFO_FLAGS_DMG = BIT(3),1887RATE_INFO_FLAGS_HE_MCS = BIT(4),1888RATE_INFO_FLAGS_EDMG = BIT(5),1889RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6),1890RATE_INFO_FLAGS_EHT_MCS = BIT(7),1891RATE_INFO_FLAGS_S1G_MCS = BIT(8),1892};18931894/**1895* enum rate_info_bw - rate bandwidth information1896*1897* Used by the driver to indicate the rate bandwidth.1898*1899* @RATE_INFO_BW_5: 5 MHz bandwidth1900* @RATE_INFO_BW_10: 10 MHz bandwidth1901* @RATE_INFO_BW_20: 20 MHz bandwidth1902* @RATE_INFO_BW_40: 40 MHz bandwidth1903* @RATE_INFO_BW_80: 80 MHz bandwidth1904* @RATE_INFO_BW_160: 160 MHz bandwidth1905* @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation1906* @RATE_INFO_BW_320: 320 MHz bandwidth1907* @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation1908* @RATE_INFO_BW_1: 1 MHz bandwidth1909* @RATE_INFO_BW_2: 2 MHz bandwidth1910* @RATE_INFO_BW_4: 4 MHz bandwidth1911* @RATE_INFO_BW_8: 8 MHz bandwidth1912* @RATE_INFO_BW_16: 16 MHz bandwidth1913*/1914enum rate_info_bw {1915RATE_INFO_BW_20 = 0,1916RATE_INFO_BW_5,1917RATE_INFO_BW_10,1918RATE_INFO_BW_40,1919RATE_INFO_BW_80,1920RATE_INFO_BW_160,1921RATE_INFO_BW_HE_RU,1922RATE_INFO_BW_320,1923RATE_INFO_BW_EHT_RU,1924RATE_INFO_BW_1,1925RATE_INFO_BW_2,1926RATE_INFO_BW_4,1927RATE_INFO_BW_8,1928RATE_INFO_BW_16,1929};19301931/**1932* struct rate_info - bitrate information1933*1934* Information about a receiving or transmitting bitrate1935*1936* @flags: bitflag of flags from &enum rate_info_flags1937* @legacy: bitrate in 100kbit/s for 802.11abg1938* @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G rate1939* @nss: number of streams (VHT & HE only)1940* @bw: bandwidth (from &enum rate_info_bw)1941* @he_gi: HE guard interval (from &enum nl80211_he_gi)1942* @he_dcm: HE DCM value1943* @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,1944* only valid if bw is %RATE_INFO_BW_HE_RU)1945* @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)1946* @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)1947* @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,1948* only valid if bw is %RATE_INFO_BW_EHT_RU)1949*/1950struct rate_info {1951u16 flags;1952u16 legacy;1953u8 mcs;1954u8 nss;1955u8 bw;1956u8 he_gi;1957u8 he_dcm;1958u8 he_ru_alloc;1959u8 n_bonded_ch;1960u8 eht_gi;1961u8 eht_ru_alloc;1962};19631964/**1965* enum bss_param_flags - bitrate info flags1966*1967* Used by the driver to indicate the specific rate transmission1968* type for 802.11n transmissions.1969*1970* @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled1971* @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled1972* @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled1973*/1974enum bss_param_flags {1975BSS_PARAM_FLAGS_CTS_PROT = BIT(0),1976BSS_PARAM_FLAGS_SHORT_PREAMBLE = BIT(1),1977BSS_PARAM_FLAGS_SHORT_SLOT_TIME = BIT(2),1978};19791980/**1981* struct sta_bss_parameters - BSS parameters for the attached station1982*1983* Information about the currently associated BSS1984*1985* @flags: bitflag of flags from &enum bss_param_flags1986* @dtim_period: DTIM period for the BSS1987* @beacon_interval: beacon interval1988*/1989struct sta_bss_parameters {1990u8 flags;1991u8 dtim_period;1992u16 beacon_interval;1993};19941995/**1996* struct cfg80211_txq_stats - TXQ statistics for this TID1997* @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to1998* indicate the relevant values in this struct are filled1999* @backlog_bytes: total number of bytes currently backlogged2000* @backlog_packets: total number of packets currently backlogged2001* @flows: number of new flows seen2002* @drops: total number of packets dropped2003* @ecn_marks: total number of packets marked with ECN CE2004* @overlimit: number of drops due to queue space overflow2005* @overmemory: number of drops due to memory limit overflow2006* @collisions: number of hash collisions2007* @tx_bytes: total number of bytes dequeued2008* @tx_packets: total number of packets dequeued2009* @max_flows: maximum number of flows supported2010*/2011struct cfg80211_txq_stats {2012u32 filled;2013u32 backlog_bytes;2014u32 backlog_packets;2015u32 flows;2016u32 drops;2017u32 ecn_marks;2018u32 overlimit;2019u32 overmemory;2020u32 collisions;2021u32 tx_bytes;2022u32 tx_packets;2023u32 max_flows;2024};20252026/**2027* struct cfg80211_tid_stats - per-TID statistics2028* @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to2029* indicate the relevant values in this struct are filled2030* @rx_msdu: number of received MSDUs2031* @tx_msdu: number of (attempted) transmitted MSDUs2032* @tx_msdu_retries: number of retries (not counting the first) for2033* transmitted MSDUs2034* @tx_msdu_failed: number of failed transmitted MSDUs2035* @txq_stats: TXQ statistics2036*/2037struct cfg80211_tid_stats {2038u32 filled;2039u64 rx_msdu;2040u64 tx_msdu;2041u64 tx_msdu_retries;2042u64 tx_msdu_failed;2043struct cfg80211_txq_stats txq_stats;2044};20452046#define IEEE80211_MAX_CHAINS 420472048/**2049* struct link_station_info - link station information2050*2051* Link station information filled by driver for get_station() and2052* dump_station().2053* @filled: bit flag of flags using the bits of &enum nl80211_sta_info to2054* indicate the relevant values in this struct for them2055* @connected_time: time(in secs) since a link of station is last connected2056* @inactive_time: time since last activity for link station(tx/rx)2057* in milliseconds2058* @assoc_at: bootime (ns) of the last association of link of station2059* @rx_bytes: bytes (size of MPDUs) received from this link of station2060* @tx_bytes: bytes (size of MPDUs) transmitted to this link of station2061* @signal: The signal strength, type depends on the wiphy's signal_type.2062* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2063* @signal_avg: Average signal strength, type depends on the wiphy's2064* signal_type. For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_2065* @chains: bitmask for filled values in @chain_signal, @chain_signal_avg2066* @chain_signal: per-chain signal strength of last received packet in dBm2067* @chain_signal_avg: per-chain signal strength average in dBm2068* @txrate: current unicast bitrate from this link of station2069* @rxrate: current unicast bitrate to this link of station2070* @rx_packets: packets (MSDUs & MMPDUs) received from this link of station2071* @tx_packets: packets (MSDUs & MMPDUs) transmitted to this link of station2072* @tx_retries: cumulative retry counts (MPDUs) for this link of station2073* @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)2074* @rx_dropped_misc: Dropped for un-specified reason.2075* @bss_param: current BSS parameters2076* @beacon_loss_count: Number of times beacon loss event has triggered.2077* @expected_throughput: expected throughput in kbps (including 802.11 headers)2078* towards this station.2079* @rx_beacon: number of beacons received from this peer2080* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received2081* from this peer2082* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer2083* @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer2084* @airtime_weight: current airtime scheduling weight2085* @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last2086* (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.2087* Note that this doesn't use the @filled bit, but is used if non-NULL.2088* @ack_signal: signal strength (in dBm) of the last ACK frame.2089* @avg_ack_signal: average rssi value of ack packet for the no of msdu's has2090* been sent.2091* @rx_mpdu_count: number of MPDUs received from this station2092* @fcs_err_count: number of packets (MPDUs) received from this station with2093* an FCS error. This counter should be incremented only when TA of the2094* received packet with an FCS error matches the peer MAC address.2095* @addr: For MLO STA connection, filled with address of the link of station.2096*/2097struct link_station_info {2098u64 filled;2099u32 connected_time;2100u32 inactive_time;2101u64 assoc_at;2102u64 rx_bytes;2103u64 tx_bytes;2104s8 signal;2105s8 signal_avg;21062107u8 chains;2108s8 chain_signal[IEEE80211_MAX_CHAINS];2109s8 chain_signal_avg[IEEE80211_MAX_CHAINS];21102111struct rate_info txrate;2112struct rate_info rxrate;2113u32 rx_packets;2114u32 tx_packets;2115u32 tx_retries;2116u32 tx_failed;2117u32 rx_dropped_misc;2118struct sta_bss_parameters bss_param;21192120u32 beacon_loss_count;21212122u32 expected_throughput;21232124u64 tx_duration;2125u64 rx_duration;2126u64 rx_beacon;2127u8 rx_beacon_signal_avg;21282129u16 airtime_weight;21302131s8 ack_signal;2132s8 avg_ack_signal;2133struct cfg80211_tid_stats *pertid;21342135u32 rx_mpdu_count;2136u32 fcs_err_count;21372138u8 addr[ETH_ALEN] __aligned(2);2139};21402141/**2142* struct station_info - station information2143*2144* Station information filled by driver for get_station() and dump_station.2145*2146* @filled: bitflag of flags using the bits of &enum nl80211_sta_info to2147* indicate the relevant values in this struct for them2148* @connected_time: time(in secs) since a station is last connected2149* @inactive_time: time since last station activity (tx/rx) in milliseconds2150* @assoc_at: bootime (ns) of the last association2151* @rx_bytes: bytes (size of MPDUs) received from this station2152* @tx_bytes: bytes (size of MPDUs) transmitted to this station2153* @signal: The signal strength, type depends on the wiphy's signal_type.2154* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2155* @signal_avg: Average signal strength, type depends on the wiphy's signal_type.2156* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2157* @chains: bitmask for filled values in @chain_signal, @chain_signal_avg2158* @chain_signal: per-chain signal strength of last received packet in dBm2159* @chain_signal_avg: per-chain signal strength average in dBm2160* @txrate: current unicast bitrate from this station2161* @rxrate: current unicast bitrate to this station2162* @rx_packets: packets (MSDUs & MMPDUs) received from this station2163* @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station2164* @tx_retries: cumulative retry counts (MPDUs)2165* @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)2166* @rx_dropped_misc: Dropped for un-specified reason.2167* @bss_param: current BSS parameters2168* @generation: generation number for nl80211 dumps.2169* This number should increase every time the list of stations2170* changes, i.e. when a station is added or removed, so that2171* userspace can tell whether it got a consistent snapshot.2172* @beacon_loss_count: Number of times beacon loss event has triggered.2173* @assoc_req_ies: IEs from (Re)Association Request.2174* This is used only when in AP mode with drivers that do not use2175* user space MLME/SME implementation. The information is provided for2176* the cfg80211_new_sta() calls to notify user space of the IEs.2177* @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.2178* @sta_flags: station flags mask & values2179* @t_offset: Time offset of the station relative to this host.2180* @llid: mesh local link id2181* @plid: mesh peer link id2182* @plink_state: mesh peer link state2183* @connected_to_gate: true if mesh STA has a path to mesh gate2184* @connected_to_as: true if mesh STA has a path to authentication server2185* @airtime_link_metric: mesh airtime link metric.2186* @local_pm: local mesh STA power save mode2187* @peer_pm: peer mesh STA power save mode2188* @nonpeer_pm: non-peer mesh STA power save mode2189* @expected_throughput: expected throughput in kbps (including 802.11 headers)2190* towards this station.2191* @rx_beacon: number of beacons received from this peer2192* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received2193* from this peer2194* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer2195* @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer2196* @airtime_weight: current airtime scheduling weight2197* @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last2198* (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.2199* Note that this doesn't use the @filled bit, but is used if non-NULL.2200* @ack_signal: signal strength (in dBm) of the last ACK frame.2201* @avg_ack_signal: average rssi value of ack packet for the no of msdu's has2202* been sent.2203* @rx_mpdu_count: number of MPDUs received from this station2204* @fcs_err_count: number of packets (MPDUs) received from this station with2205* an FCS error. This counter should be incremented only when TA of the2206* received packet with an FCS error matches the peer MAC address.2207* @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled2208* by driver. Drivers use this only in cfg80211_new_sta() calls when AP2209* MLD's MLME/SME is offload to driver. Drivers won't fill this2210* information in cfg80211_del_sta_sinfo(), get_station() and2211* dump_station() callbacks.2212* @assoc_link_id: Indicates MLO link ID of the AP, with which the station2213* completed (re)association. This information filled for both MLO2214* and non-MLO STA connections when the AP affiliated with an MLD.2215* @mld_addr: For MLO STA connection, filled with MLD address of the station.2216* For non-MLO STA connection, filled with all zeros.2217* @assoc_resp_ies: IEs from (Re)Association Response.2218* This is used only when in AP mode with drivers that do not use user2219* space MLME/SME implementation. The information is provided only for the2220* cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't2221* fill this information in cfg80211_del_sta_sinfo(), get_station() and2222* dump_station() callbacks. User space needs this information to determine2223* the accepted and rejected affiliated links of the connected station.2224* @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.2225* @valid_links: bitmap of valid links, or 0 for non-MLO. Drivers fill this2226* information in cfg80211_new_sta(), cfg80211_del_sta_sinfo(),2227* get_station() and dump_station() callbacks.2228* @links: reference to Link sta entries for MLO STA, all link specific2229* information is accessed through links[link_id].2230*/2231struct station_info {2232u64 filled;2233u32 connected_time;2234u32 inactive_time;2235u64 assoc_at;2236u64 rx_bytes;2237u64 tx_bytes;2238s8 signal;2239s8 signal_avg;22402241u8 chains;2242s8 chain_signal[IEEE80211_MAX_CHAINS];2243s8 chain_signal_avg[IEEE80211_MAX_CHAINS];22442245struct rate_info txrate;2246struct rate_info rxrate;2247u32 rx_packets;2248u32 tx_packets;2249u32 tx_retries;2250u32 tx_failed;2251u32 rx_dropped_misc;2252struct sta_bss_parameters bss_param;2253struct nl80211_sta_flag_update sta_flags;22542255int generation;22562257u32 beacon_loss_count;22582259const u8 *assoc_req_ies;2260size_t assoc_req_ies_len;22612262s64 t_offset;2263u16 llid;2264u16 plid;2265u8 plink_state;2266u8 connected_to_gate;2267u8 connected_to_as;2268u32 airtime_link_metric;2269enum nl80211_mesh_power_mode local_pm;2270enum nl80211_mesh_power_mode peer_pm;2271enum nl80211_mesh_power_mode nonpeer_pm;22722273u32 expected_throughput;22742275u16 airtime_weight;22762277s8 ack_signal;2278s8 avg_ack_signal;2279struct cfg80211_tid_stats *pertid;22802281u64 tx_duration;2282u64 rx_duration;2283u64 rx_beacon;2284u8 rx_beacon_signal_avg;22852286u32 rx_mpdu_count;2287u32 fcs_err_count;22882289bool mlo_params_valid;2290u8 assoc_link_id;2291u8 mld_addr[ETH_ALEN] __aligned(2);2292const u8 *assoc_resp_ies;2293size_t assoc_resp_ies_len;22942295u16 valid_links;2296struct link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS];2297};22982299/**2300* struct cfg80211_sar_sub_specs - sub specs limit2301* @power: power limitation in 0.25dbm2302* @freq_range_index: index the power limitation applies to2303*/2304struct cfg80211_sar_sub_specs {2305s32 power;2306u32 freq_range_index;2307};23082309/**2310* struct cfg80211_sar_specs - sar limit specs2311* @type: it's set with power in 0.25dbm or other types2312* @num_sub_specs: number of sar sub specs2313* @sub_specs: memory to hold the sar sub specs2314*/2315struct cfg80211_sar_specs {2316enum nl80211_sar_type type;2317u32 num_sub_specs;2318struct cfg80211_sar_sub_specs sub_specs[] __counted_by(num_sub_specs);2319};232023212322/**2323* struct cfg80211_sar_freq_ranges - sar frequency ranges2324* @start_freq: start range edge frequency2325* @end_freq: end range edge frequency2326*/2327struct cfg80211_sar_freq_ranges {2328u32 start_freq;2329u32 end_freq;2330};23312332/**2333* struct cfg80211_sar_capa - sar limit capability2334* @type: it's set via power in 0.25dbm or other types2335* @num_freq_ranges: number of frequency ranges2336* @freq_ranges: memory to hold the freq ranges.2337*2338* Note: WLAN driver may append new ranges or split an existing2339* range to small ones and then append them.2340*/2341struct cfg80211_sar_capa {2342enum nl80211_sar_type type;2343u32 num_freq_ranges;2344const struct cfg80211_sar_freq_ranges *freq_ranges;2345};23462347#if IS_ENABLED(CONFIG_CFG80211)2348/**2349* cfg80211_get_station - retrieve information about a given station2350* @dev: the device where the station is supposed to be connected to2351* @mac_addr: the mac address of the station of interest2352* @sinfo: pointer to the structure to fill with the information2353*2354* Return: 0 on success and sinfo is filled with the available information2355* otherwise returns a negative error code and the content of sinfo has to be2356* considered undefined.2357*/2358int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,2359struct station_info *sinfo);2360#else2361static inline int cfg80211_get_station(struct net_device *dev,2362const u8 *mac_addr,2363struct station_info *sinfo)2364{2365return -ENOENT;2366}2367#endif23682369/**2370* enum monitor_flags - monitor flags2371*2372* Monitor interface configuration flags. Note that these must be the bits2373* according to the nl80211 flags.2374*2375* @MONITOR_FLAG_CHANGED: set if the flags were changed2376* @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS2377* @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP2378* @MONITOR_FLAG_CONTROL: pass control frames2379* @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering2380* @MONITOR_FLAG_COOK_FRAMES: deprecated, will unconditionally be refused2381* @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address2382* @MONITOR_FLAG_SKIP_TX: do not pass locally transmitted frames2383*/2384enum monitor_flags {2385MONITOR_FLAG_CHANGED = BIT(__NL80211_MNTR_FLAG_INVALID),2386MONITOR_FLAG_FCSFAIL = BIT(NL80211_MNTR_FLAG_FCSFAIL),2387MONITOR_FLAG_PLCPFAIL = BIT(NL80211_MNTR_FLAG_PLCPFAIL),2388MONITOR_FLAG_CONTROL = BIT(NL80211_MNTR_FLAG_CONTROL),2389MONITOR_FLAG_OTHER_BSS = BIT(NL80211_MNTR_FLAG_OTHER_BSS),2390MONITOR_FLAG_COOK_FRAMES = BIT(NL80211_MNTR_FLAG_COOK_FRAMES),2391MONITOR_FLAG_ACTIVE = BIT(NL80211_MNTR_FLAG_ACTIVE),2392MONITOR_FLAG_SKIP_TX = BIT(NL80211_MNTR_FLAG_SKIP_TX),2393};23942395/**2396* enum mpath_info_flags - mesh path information flags2397*2398* Used by the driver to indicate which info in &struct mpath_info it has filled2399* in during get_station() or dump_station().2400*2401* @MPATH_INFO_FRAME_QLEN: @frame_qlen filled2402* @MPATH_INFO_SN: @sn filled2403* @MPATH_INFO_METRIC: @metric filled2404* @MPATH_INFO_EXPTIME: @exptime filled2405* @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled2406* @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled2407* @MPATH_INFO_FLAGS: @flags filled2408* @MPATH_INFO_HOP_COUNT: @hop_count filled2409* @MPATH_INFO_PATH_CHANGE: @path_change_count filled2410*/2411enum mpath_info_flags {2412MPATH_INFO_FRAME_QLEN = BIT(0),2413MPATH_INFO_SN = BIT(1),2414MPATH_INFO_METRIC = BIT(2),2415MPATH_INFO_EXPTIME = BIT(3),2416MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),2417MPATH_INFO_DISCOVERY_RETRIES = BIT(5),2418MPATH_INFO_FLAGS = BIT(6),2419MPATH_INFO_HOP_COUNT = BIT(7),2420MPATH_INFO_PATH_CHANGE = BIT(8),2421};24222423/**2424* struct mpath_info - mesh path information2425*2426* Mesh path information filled by driver for get_mpath() and dump_mpath().2427*2428* @filled: bitfield of flags from &enum mpath_info_flags2429* @frame_qlen: number of queued frames for this destination2430* @sn: target sequence number2431* @metric: metric (cost) of this mesh path2432* @exptime: expiration time for the mesh path from now, in msecs2433* @flags: mesh path flags from &enum mesh_path_flags2434* @discovery_timeout: total mesh path discovery timeout, in msecs2435* @discovery_retries: mesh path discovery retries2436* @generation: generation number for nl80211 dumps.2437* This number should increase every time the list of mesh paths2438* changes, i.e. when a station is added or removed, so that2439* userspace can tell whether it got a consistent snapshot.2440* @hop_count: hops to destination2441* @path_change_count: total number of path changes to destination2442*/2443struct mpath_info {2444u32 filled;2445u32 frame_qlen;2446u32 sn;2447u32 metric;2448u32 exptime;2449u32 discovery_timeout;2450u8 discovery_retries;2451u8 flags;2452u8 hop_count;2453u32 path_change_count;24542455int generation;2456};24572458/**2459* struct bss_parameters - BSS parameters2460*2461* Used to change BSS parameters (mainly for AP mode).2462*2463* @link_id: link_id or -1 for non-MLD2464* @use_cts_prot: Whether to use CTS protection2465* (0 = no, 1 = yes, -1 = do not change)2466* @use_short_preamble: Whether the use of short preambles is allowed2467* (0 = no, 1 = yes, -1 = do not change)2468* @use_short_slot_time: Whether the use of short slot time is allowed2469* (0 = no, 1 = yes, -1 = do not change)2470* @basic_rates: basic rates in IEEE 802.11 format2471* (or NULL for no change)2472* @basic_rates_len: number of basic rates2473* @ap_isolate: do not forward packets between connected stations2474* (0 = no, 1 = yes, -1 = do not change)2475* @ht_opmode: HT Operation mode2476* (u16 = opmode, -1 = do not change)2477* @p2p_ctwindow: P2P CT Window (-1 = no change)2478* @p2p_opp_ps: P2P opportunistic PS (-1 = no change)2479*/2480struct bss_parameters {2481int link_id;2482int use_cts_prot;2483int use_short_preamble;2484int use_short_slot_time;2485const u8 *basic_rates;2486u8 basic_rates_len;2487int ap_isolate;2488int ht_opmode;2489s8 p2p_ctwindow, p2p_opp_ps;2490};24912492/**2493* struct mesh_config - 802.11s mesh configuration2494*2495* These parameters can be changed while the mesh is active.2496*2497* @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used2498* by the Mesh Peering Open message2499* @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units2500* used by the Mesh Peering Open message2501* @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by2502* the mesh peering management to close a mesh peering2503* @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this2504* mesh interface2505* @dot11MeshMaxRetries: the maximum number of peer link open retries that can2506* be sent to establish a new peer link instance in a mesh2507* @dot11MeshTTL: the value of TTL field set at a source mesh STA2508* @element_ttl: the value of TTL field set at a mesh STA for path selection2509* elements2510* @auto_open_plinks: whether we should automatically open peer links when we2511* detect compatible mesh peers2512* @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to2513* synchronize to for 11s default synchronization method2514* @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ2515* that an originator mesh STA can send to a particular path target2516* @path_refresh_time: how frequently to refresh mesh paths in milliseconds2517* @min_discovery_timeout: the minimum length of time to wait until giving up on2518* a path discovery in milliseconds2519* @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs2520* receiving a PREQ shall consider the forwarding information from the2521* root to be valid. (TU = time unit)2522* @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during2523* which a mesh STA can send only one action frame containing a PREQ2524* element2525* @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during2526* which a mesh STA can send only one Action frame containing a PERR2527* element2528* @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that2529* it takes for an HWMP information element to propagate across the mesh2530* @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA2531* @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root2532* announcements are transmitted2533* @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh2534* station has access to a broader network beyond the MBSS. (This is2535* missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true2536* only means that the station will announce others it's a mesh gate, but2537* not necessarily using the gate announcement protocol. Still keeping the2538* same nomenclature to be in sync with the spec)2539* @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding2540* entity (default is TRUE - forwarding entity)2541* @rssi_threshold: the threshold for average signal strength of candidate2542* station to establish a peer link2543* @ht_opmode: mesh HT protection mode2544*2545* @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs2546* receiving a proactive PREQ shall consider the forwarding information to2547* the root mesh STA to be valid.2548*2549* @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive2550* PREQs are transmitted.2551* @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)2552* during which a mesh STA can send only one Action frame containing2553* a PREQ element for root path confirmation.2554* @power_mode: The default mesh power save mode which will be the initial2555* setting for new peer links.2556* @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake2557* after transmitting its beacon.2558* @plink_timeout: If no tx activity is seen from a STA we've established2559* peering with for longer than this time (in seconds), then remove it2560* from the STA's list of peers. Default is 30 minutes.2561* @dot11MeshConnectedToAuthServer: if set to true then this mesh STA2562* will advertise that it is connected to a authentication server2563* in the mesh formation field.2564* @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is2565* connected to a mesh gate in mesh formation info. If false, the2566* value in mesh formation is determined by the presence of root paths2567* in the mesh path table2568* @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP2569* for HWMP) if the destination is a direct neighbor. Note that this might2570* not be the optimal decision as a multi-hop route might be better. So2571* if using this setting you will likely also want to disable2572* dot11MeshForwarding and use another mesh routing protocol on top.2573*/2574struct mesh_config {2575u16 dot11MeshRetryTimeout;2576u16 dot11MeshConfirmTimeout;2577u16 dot11MeshHoldingTimeout;2578u16 dot11MeshMaxPeerLinks;2579u8 dot11MeshMaxRetries;2580u8 dot11MeshTTL;2581u8 element_ttl;2582bool auto_open_plinks;2583u32 dot11MeshNbrOffsetMaxNeighbor;2584u8 dot11MeshHWMPmaxPREQretries;2585u32 path_refresh_time;2586u16 min_discovery_timeout;2587u32 dot11MeshHWMPactivePathTimeout;2588u16 dot11MeshHWMPpreqMinInterval;2589u16 dot11MeshHWMPperrMinInterval;2590u16 dot11MeshHWMPnetDiameterTraversalTime;2591u8 dot11MeshHWMPRootMode;2592bool dot11MeshConnectedToMeshGate;2593bool dot11MeshConnectedToAuthServer;2594u16 dot11MeshHWMPRannInterval;2595bool dot11MeshGateAnnouncementProtocol;2596bool dot11MeshForwarding;2597s32 rssi_threshold;2598u16 ht_opmode;2599u32 dot11MeshHWMPactivePathToRootTimeout;2600u16 dot11MeshHWMProotInterval;2601u16 dot11MeshHWMPconfirmationInterval;2602enum nl80211_mesh_power_mode power_mode;2603u16 dot11MeshAwakeWindowDuration;2604u32 plink_timeout;2605bool dot11MeshNolearn;2606};26072608/**2609* struct mesh_setup - 802.11s mesh setup configuration2610* @chandef: defines the channel to use2611* @mesh_id: the mesh ID2612* @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes2613* @sync_method: which synchronization method to use2614* @path_sel_proto: which path selection protocol to use2615* @path_metric: which metric to use2616* @auth_id: which authentication method this mesh is using2617* @ie: vendor information elements (optional)2618* @ie_len: length of vendor information elements2619* @is_authenticated: this mesh requires authentication2620* @is_secure: this mesh uses security2621* @user_mpm: userspace handles all MPM functions2622* @dtim_period: DTIM period to use2623* @beacon_interval: beacon interval to use2624* @mcast_rate: multicast rate for Mesh Node [6Mbps is the default for 802.11a]2625* @basic_rates: basic rates to use when creating the mesh2626* @beacon_rate: bitrate to be used for beacons2627* @userspace_handles_dfs: whether user space controls DFS operation, i.e.2628* changes the channel when a radar is detected. This is required2629* to operate on DFS channels.2630* @control_port_over_nl80211: TRUE if userspace expects to exchange control2631* port frames over NL80211 instead of the network interface.2632*2633* These parameters are fixed when the mesh is created.2634*/2635struct mesh_setup {2636struct cfg80211_chan_def chandef;2637const u8 *mesh_id;2638u8 mesh_id_len;2639u8 sync_method;2640u8 path_sel_proto;2641u8 path_metric;2642u8 auth_id;2643const u8 *ie;2644u8 ie_len;2645bool is_authenticated;2646bool is_secure;2647bool user_mpm;2648u8 dtim_period;2649u16 beacon_interval;2650int mcast_rate[NUM_NL80211_BANDS];2651u32 basic_rates;2652struct cfg80211_bitrate_mask beacon_rate;2653bool userspace_handles_dfs;2654bool control_port_over_nl80211;2655};26562657/**2658* struct ocb_setup - 802.11p OCB mode setup configuration2659* @chandef: defines the channel to use2660*2661* These parameters are fixed when connecting to the network2662*/2663struct ocb_setup {2664struct cfg80211_chan_def chandef;2665};26662667/**2668* struct ieee80211_txq_params - TX queue parameters2669* @ac: AC identifier2670* @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled2671* @cwmin: Minimum contention window [a value of the form 2^n-1 in the range2672* 1..32767]2673* @cwmax: Maximum contention window [a value of the form 2^n-1 in the range2674* 1..32767]2675* @aifs: Arbitration interframe space [0..255]2676* @link_id: link_id or -1 for non-MLD2677*/2678struct ieee80211_txq_params {2679enum nl80211_ac ac;2680u16 txop;2681u16 cwmin;2682u16 cwmax;2683u8 aifs;2684int link_id;2685};26862687/**2688* DOC: Scanning and BSS list handling2689*2690* The scanning process itself is fairly simple, but cfg80211 offers quite2691* a bit of helper functionality. To start a scan, the scan operation will2692* be invoked with a scan definition. This scan definition contains the2693* channels to scan, and the SSIDs to send probe requests for (including the2694* wildcard, if desired). A passive scan is indicated by having no SSIDs to2695* probe. Additionally, a scan request may contain extra information elements2696* that should be added to the probe request. The IEs are guaranteed to be2697* well-formed, and will not exceed the maximum length the driver advertised2698* in the wiphy structure.2699*2700* When scanning finds a BSS, cfg80211 needs to be notified of that, because2701* it is responsible for maintaining the BSS list; the driver should not2702* maintain a list itself. For this notification, various functions exist.2703*2704* Since drivers do not maintain a BSS list, there are also a number of2705* functions to search for a BSS and obtain information about it from the2706* BSS structure cfg80211 maintains. The BSS list is also made available2707* to userspace.2708*/27092710/**2711* struct cfg80211_ssid - SSID description2712* @ssid: the SSID2713* @ssid_len: length of the ssid2714*/2715struct cfg80211_ssid {2716u8 ssid[IEEE80211_MAX_SSID_LEN];2717u8 ssid_len;2718};27192720/**2721* struct cfg80211_scan_info - information about completed scan2722* @scan_start_tsf: scan start time in terms of the TSF of the BSS that the2723* wireless device that requested the scan is connected to. If this2724* information is not available, this field is left zero.2725* @tsf_bssid: the BSSID according to which %scan_start_tsf is set.2726* @aborted: set to true if the scan was aborted for any reason,2727* userspace will be notified of that2728*/2729struct cfg80211_scan_info {2730u64 scan_start_tsf;2731u8 tsf_bssid[ETH_ALEN] __aligned(2);2732bool aborted;2733};27342735/**2736* struct cfg80211_scan_6ghz_params - relevant for 6 GHz only2737*2738* @short_ssid: short ssid to scan for2739* @bssid: bssid to scan for2740* @channel_idx: idx of the channel in the channel array in the scan request2741* which the above info is relevant to2742* @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU2743* @short_ssid_valid: @short_ssid is valid and can be used2744* @psc_no_listen: when set, and the channel is a PSC channel, no need to wait2745* 20 TUs before starting to send probe requests.2746* @psd_20: The AP's 20 MHz PSD value.2747*/2748struct cfg80211_scan_6ghz_params {2749u32 short_ssid;2750u32 channel_idx;2751u8 bssid[ETH_ALEN];2752bool unsolicited_probe;2753bool short_ssid_valid;2754bool psc_no_listen;2755s8 psd_20;2756};27572758/**2759* struct cfg80211_scan_request - scan request description2760*2761* @ssids: SSIDs to scan for (active scan only)2762* @n_ssids: number of SSIDs2763* @channels: channels to scan on.2764* @n_channels: total number of channels to scan2765* @ie: optional information element(s) to add into Probe Request or %NULL2766* @ie_len: length of ie in octets2767* @duration: how long to listen on each channel, in TUs. If2768* %duration_mandatory is not set, this is the maximum dwell time and2769* the actual dwell time may be shorter.2770* @duration_mandatory: if set, the scan duration must be as specified by the2771* %duration field.2772* @flags: control flags from &enum nl80211_scan_flags2773* @rates: bitmap of rates to advertise for each band2774* @wiphy: the wiphy this was for2775* @scan_start: time (in jiffies) when the scan started2776* @wdev: the wireless device to scan for2777* @no_cck: used to send probe requests at non CCK rate in 2GHz band2778* @mac_addr: MAC address used with randomisation2779* @mac_addr_mask: MAC address mask used with randomisation, bits that2780* are 0 in the mask should be randomised, bits that are 1 should2781* be taken from the @mac_addr2782* @scan_6ghz: relevant for split scan request only,2783* true if this is a 6 GHz scan request2784* @first_part: %true if this is the first part of a split scan request or a2785* scan that was not split. May be %true for a @scan_6ghz scan if no other2786* channels were requested2787* @n_6ghz_params: number of 6 GHz params2788* @scan_6ghz_params: 6 GHz params2789* @bssid: BSSID to scan for (most commonly, the wildcard BSSID)2790* @tsf_report_link_id: for MLO, indicates the link ID of the BSS that should be2791* used for TSF reporting. Can be set to -1 to indicate no preference.2792*/2793struct cfg80211_scan_request {2794struct cfg80211_ssid *ssids;2795int n_ssids;2796u32 n_channels;2797const u8 *ie;2798size_t ie_len;2799u16 duration;2800bool duration_mandatory;2801u32 flags;28022803u32 rates[NUM_NL80211_BANDS];28042805struct wireless_dev *wdev;28062807u8 mac_addr[ETH_ALEN] __aligned(2);2808u8 mac_addr_mask[ETH_ALEN] __aligned(2);2809u8 bssid[ETH_ALEN] __aligned(2);2810struct wiphy *wiphy;2811unsigned long scan_start;2812bool no_cck;2813bool scan_6ghz;2814bool first_part;2815u32 n_6ghz_params;2816struct cfg80211_scan_6ghz_params *scan_6ghz_params;2817s8 tsf_report_link_id;28182819/* keep last */2820struct ieee80211_channel *channels[];2821};28222823static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)2824{2825int i;28262827get_random_bytes(buf, ETH_ALEN);2828for (i = 0; i < ETH_ALEN; i++) {2829buf[i] &= ~mask[i];2830buf[i] |= addr[i] & mask[i];2831}2832}28332834/**2835* struct cfg80211_match_set - sets of attributes to match2836*2837* @ssid: SSID to be matched; may be zero-length in case of BSSID match2838* or no match (RSSI only)2839* @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match2840* or no match (RSSI only)2841* @rssi_thold: don't report scan results below this threshold (in s32 dBm)2842*/2843struct cfg80211_match_set {2844struct cfg80211_ssid ssid;2845u8 bssid[ETH_ALEN];2846s32 rssi_thold;2847};28482849/**2850* struct cfg80211_sched_scan_plan - scan plan for scheduled scan2851*2852* @interval: interval between scheduled scan iterations. In seconds.2853* @iterations: number of scan iterations in this scan plan. Zero means2854* infinite loop.2855* The last scan plan will always have this parameter set to zero,2856* all other scan plans will have a finite number of iterations.2857*/2858struct cfg80211_sched_scan_plan {2859u32 interval;2860u32 iterations;2861};28622863/**2864* struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.2865*2866* @band: band of BSS which should match for RSSI level adjustment.2867* @delta: value of RSSI level adjustment.2868*/2869struct cfg80211_bss_select_adjust {2870enum nl80211_band band;2871s8 delta;2872};28732874/**2875* struct cfg80211_sched_scan_request - scheduled scan request description2876*2877* @reqid: identifies this request.2878* @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)2879* @n_ssids: number of SSIDs2880* @n_channels: total number of channels to scan2881* @ie: optional information element(s) to add into Probe Request or %NULL2882* @ie_len: length of ie in octets2883* @flags: control flags from &enum nl80211_scan_flags2884* @match_sets: sets of parameters to be matched for a scan result2885* entry to be considered valid and to be passed to the host2886* (others are filtered out).2887* If omitted, all results are passed.2888* @n_match_sets: number of match sets2889* @report_results: indicates that results were reported for this request2890* @wiphy: the wiphy this was for2891* @dev: the interface2892* @scan_start: start time of the scheduled scan2893* @channels: channels to scan2894* @min_rssi_thold: for drivers only supporting a single threshold, this2895* contains the minimum over all matchsets2896* @mac_addr: MAC address used with randomisation2897* @mac_addr_mask: MAC address mask used with randomisation, bits that2898* are 0 in the mask should be randomised, bits that are 1 should2899* be taken from the @mac_addr2900* @scan_plans: scan plans to be executed in this scheduled scan. Lowest2901* index must be executed first.2902* @n_scan_plans: number of scan plans, at least 1.2903* @rcu_head: RCU callback used to free the struct2904* @owner_nlportid: netlink portid of owner (if this should is a request2905* owned by a particular socket)2906* @nl_owner_dead: netlink owner socket was closed - this request be freed2907* @list: for keeping list of requests.2908* @delay: delay in seconds to use before starting the first scan2909* cycle. The driver may ignore this parameter and start2910* immediately (or at any other time), if this feature is not2911* supported.2912* @relative_rssi_set: Indicates whether @relative_rssi is set or not.2913* @relative_rssi: Relative RSSI threshold in dB to restrict scan result2914* reporting in connected state to cases where a matching BSS is determined2915* to have better or slightly worse RSSI than the current connected BSS.2916* The relative RSSI threshold values are ignored in disconnected state.2917* @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong2918* to the specified band while deciding whether a better BSS is reported2919* using @relative_rssi. If delta is a negative number, the BSSs that2920* belong to the specified band will be penalized by delta dB in relative2921* comparisons.2922*/2923struct cfg80211_sched_scan_request {2924u64 reqid;2925struct cfg80211_ssid *ssids;2926int n_ssids;2927u32 n_channels;2928const u8 *ie;2929size_t ie_len;2930u32 flags;2931struct cfg80211_match_set *match_sets;2932int n_match_sets;2933s32 min_rssi_thold;2934u32 delay;2935struct cfg80211_sched_scan_plan *scan_plans;2936int n_scan_plans;29372938u8 mac_addr[ETH_ALEN] __aligned(2);2939u8 mac_addr_mask[ETH_ALEN] __aligned(2);29402941bool relative_rssi_set;2942s8 relative_rssi;2943struct cfg80211_bss_select_adjust rssi_adjust;29442945/* internal */2946struct wiphy *wiphy;2947struct net_device *dev;2948unsigned long scan_start;2949bool report_results;2950struct rcu_head rcu_head;2951u32 owner_nlportid;2952bool nl_owner_dead;2953struct list_head list;29542955/* keep last */2956struct ieee80211_channel *channels[] __counted_by(n_channels);2957};29582959/**2960* enum cfg80211_signal_type - signal type2961*2962* @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available2963* @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)2964* @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 1002965*/2966enum cfg80211_signal_type {2967CFG80211_SIGNAL_TYPE_NONE,2968CFG80211_SIGNAL_TYPE_MBM,2969CFG80211_SIGNAL_TYPE_UNSPEC,2970};29712972/**2973* struct cfg80211_inform_bss - BSS inform data2974* @chan: channel the frame was received on2975* @signal: signal strength value, according to the wiphy's2976* signal type2977* @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was2978* received; should match the time when the frame was actually2979* received by the device (not just by the host, in case it was2980* buffered on the device) and be accurate to about 10ms.2981* If the frame isn't buffered, just passing the return value of2982* ktime_get_boottime_ns() is likely appropriate.2983* @parent_tsf: the time at the start of reception of the first octet of the2984* timestamp field of the frame. The time is the TSF of the BSS specified2985* by %parent_bssid.2986* @parent_bssid: the BSS according to which %parent_tsf is set. This is set to2987* the BSS that requested the scan in which the beacon/probe was received.2988* @chains: bitmask for filled values in @chain_signal.2989* @chain_signal: per-chain signal strength of last received BSS in dBm.2990* @restrict_use: restrict usage, if not set, assume @use_for is2991* %NL80211_BSS_USE_FOR_NORMAL.2992* @use_for: bitmap of possible usage for this BSS, see2993* &enum nl80211_bss_use_for2994* @cannot_use_reasons: the reasons (bitmap) for not being able to connect,2995* if @restrict_use is set and @use_for is zero (empty); may be 0 for2996* unspecified reasons; see &enum nl80211_bss_cannot_use_reasons2997* @drv_data: Data to be passed through to @inform_bss2998*/2999struct cfg80211_inform_bss {3000struct ieee80211_channel *chan;3001s32 signal;3002u64 boottime_ns;3003u64 parent_tsf;3004u8 parent_bssid[ETH_ALEN] __aligned(2);3005u8 chains;3006s8 chain_signal[IEEE80211_MAX_CHAINS];30073008u8 restrict_use:1, use_for:7;3009u8 cannot_use_reasons;30103011void *drv_data;3012};30133014/**3015* struct cfg80211_bss_ies - BSS entry IE data3016* @tsf: TSF contained in the frame that carried these IEs3017* @rcu_head: internal use, for freeing3018* @len: length of the IEs3019* @from_beacon: these IEs are known to come from a beacon3020* @data: IE data3021*/3022struct cfg80211_bss_ies {3023u64 tsf;3024struct rcu_head rcu_head;3025int len;3026bool from_beacon;3027u8 data[];3028};30293030/**3031* struct cfg80211_bss - BSS description3032*3033* This structure describes a BSS (which may also be a mesh network)3034* for use in scan results and similar.3035*3036* @channel: channel this BSS is on3037* @bssid: BSSID of the BSS3038* @beacon_interval: the beacon interval as from the frame3039* @capability: the capability field in host byte order3040* @ies: the information elements (Note that there is no guarantee that these3041* are well-formed!); this is a pointer to either the beacon_ies or3042* proberesp_ies depending on whether Probe Response frame has been3043* received. It is always non-%NULL.3044* @beacon_ies: the information elements from the last Beacon frame3045* (implementation note: if @hidden_beacon_bss is set this struct doesn't3046* own the beacon_ies, but they're just pointers to the ones from the3047* @hidden_beacon_bss struct)3048* @proberesp_ies: the information elements from the last Probe Response frame3049* @proberesp_ecsa_stuck: ECSA element is stuck in the Probe Response frame,3050* cannot rely on it having valid data3051* @hidden_beacon_bss: in case this BSS struct represents a probe response from3052* a BSS that hides the SSID in its beacon, this points to the BSS struct3053* that holds the beacon data. @beacon_ies is still valid, of course, and3054* points to the same data as hidden_beacon_bss->beacon_ies in that case.3055* @transmitted_bss: pointer to the transmitted BSS, if this is a3056* non-transmitted one (multi-BSSID support)3057* @nontrans_list: list of non-transmitted BSS, if this is a transmitted one3058* (multi-BSSID support)3059* @signal: signal strength value (type depends on the wiphy's signal_type)3060* @ts_boottime: timestamp of the last BSS update in nanoseconds since boot3061* @chains: bitmask for filled values in @chain_signal.3062* @chain_signal: per-chain signal strength of last received BSS in dBm.3063* @bssid_index: index in the multiple BSS set3064* @max_bssid_indicator: max number of members in the BSS set3065* @use_for: bitmap of possible usage for this BSS, see3066* &enum nl80211_bss_use_for3067* @cannot_use_reasons: the reasons (bitmap) for not being able to connect,3068* if @restrict_use is set and @use_for is zero (empty); may be 0 for3069* unspecified reasons; see &enum nl80211_bss_cannot_use_reasons3070* @priv: private area for driver use, has at least wiphy->bss_priv_size bytes3071*/3072struct cfg80211_bss {3073struct ieee80211_channel *channel;30743075const struct cfg80211_bss_ies __rcu *ies;3076const struct cfg80211_bss_ies __rcu *beacon_ies;3077const struct cfg80211_bss_ies __rcu *proberesp_ies;30783079struct cfg80211_bss *hidden_beacon_bss;3080struct cfg80211_bss *transmitted_bss;3081struct list_head nontrans_list;30823083s32 signal;30843085u64 ts_boottime;30863087u16 beacon_interval;3088u16 capability;30893090u8 bssid[ETH_ALEN];3091u8 chains;3092s8 chain_signal[IEEE80211_MAX_CHAINS];30933094u8 proberesp_ecsa_stuck:1;30953096u8 bssid_index;3097u8 max_bssid_indicator;30983099u8 use_for;3100u8 cannot_use_reasons;31013102u8 priv[] __aligned(sizeof(void *));3103};31043105/**3106* ieee80211_bss_get_elem - find element with given ID3107* @bss: the bss to search3108* @id: the element ID3109*3110* Note that the return value is an RCU-protected pointer, so3111* rcu_read_lock() must be held when calling this function.3112* Return: %NULL if not found.3113*/3114const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);31153116/**3117* ieee80211_bss_get_ie - find IE with given ID3118* @bss: the bss to search3119* @id: the element ID3120*3121* Note that the return value is an RCU-protected pointer, so3122* rcu_read_lock() must be held when calling this function.3123* Return: %NULL if not found.3124*/3125static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)3126{3127return (const void *)ieee80211_bss_get_elem(bss, id);3128}312931303131/**3132* struct cfg80211_auth_request - Authentication request data3133*3134* This structure provides information needed to complete IEEE 802.113135* authentication.3136*3137* @bss: The BSS to authenticate with, the callee must obtain a reference3138* to it if it needs to keep it.3139* @supported_selectors: List of selectors that should be assumed to be3140* supported by the station.3141* SAE_H2E must be assumed supported if set to %NULL.3142* @supported_selectors_len: Length of supported_selectors in octets.3143* @auth_type: Authentication type (algorithm)3144* @ie: Extra IEs to add to Authentication frame or %NULL3145* @ie_len: Length of ie buffer in octets3146* @key_len: length of WEP key for shared key authentication3147* @key_idx: index of WEP key for shared key authentication3148* @key: WEP key for shared key authentication3149* @auth_data: Fields and elements in Authentication frames. This contains3150* the authentication frame body (non-IE and IE data), excluding the3151* Authentication algorithm number, i.e., starting at the Authentication3152* transaction sequence number field.3153* @auth_data_len: Length of auth_data buffer in octets3154* @link_id: if >= 0, indicates authentication should be done as an MLD,3155* the interface address is included as the MLD address and the3156* necessary link (with the given link_id) will be created (and3157* given an MLD address) by the driver3158* @ap_mld_addr: AP MLD address in case of authentication request with3159* an AP MLD, valid iff @link_id >= 03160*/3161struct cfg80211_auth_request {3162struct cfg80211_bss *bss;3163const u8 *ie;3164size_t ie_len;3165const u8 *supported_selectors;3166u8 supported_selectors_len;3167enum nl80211_auth_type auth_type;3168const u8 *key;3169u8 key_len;3170s8 key_idx;3171const u8 *auth_data;3172size_t auth_data_len;3173s8 link_id;3174const u8 *ap_mld_addr;3175};31763177/**3178* struct cfg80211_assoc_link - per-link information for MLO association3179* @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;3180* if this is %NULL for a link, that link is not requested3181* @elems: extra elements for the per-STA profile for this link3182* @elems_len: length of the elements3183* @disabled: If set this link should be included during association etc. but it3184* should not be used until enabled by the AP MLD.3185* @error: per-link error code, must be <= 0. If there is an error, then the3186* operation as a whole must fail.3187*/3188struct cfg80211_assoc_link {3189struct cfg80211_bss *bss;3190const u8 *elems;3191size_t elems_len;3192bool disabled;3193int error;3194};31953196/**3197* struct cfg80211_ml_reconf_req - MLO link reconfiguration request3198* @add_links: data for links to add, see &struct cfg80211_assoc_link3199* @rem_links: bitmap of links to remove3200* @ext_mld_capa_ops: extended MLD capabilities and operations set by3201* userspace for the ML reconfiguration action frame3202*/3203struct cfg80211_ml_reconf_req {3204struct cfg80211_assoc_link add_links[IEEE80211_MLD_MAX_NUM_LINKS];3205u16 rem_links;3206u16 ext_mld_capa_ops;3207};32083209/**3210* enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.3211*3212* @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)3213* @ASSOC_REQ_DISABLE_VHT: Disable VHT3214* @ASSOC_REQ_USE_RRM: Declare RRM capability in this association3215* @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external3216* authentication capability. Drivers can offload authentication to3217* userspace if this flag is set. Only applicable for cfg80211_connect()3218* request (connect callback).3219* @ASSOC_REQ_DISABLE_HE: Disable HE3220* @ASSOC_REQ_DISABLE_EHT: Disable EHT3221* @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.3222* Drivers shall disable MLO features for the current association if this3223* flag is not set.3224* @ASSOC_REQ_SPP_AMSDU: SPP A-MSDUs will be used on this connection (if any)3225*/3226enum cfg80211_assoc_req_flags {3227ASSOC_REQ_DISABLE_HT = BIT(0),3228ASSOC_REQ_DISABLE_VHT = BIT(1),3229ASSOC_REQ_USE_RRM = BIT(2),3230CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),3231ASSOC_REQ_DISABLE_HE = BIT(4),3232ASSOC_REQ_DISABLE_EHT = BIT(5),3233CONNECT_REQ_MLO_SUPPORT = BIT(6),3234ASSOC_REQ_SPP_AMSDU = BIT(7),3235};32363237/**3238* struct cfg80211_assoc_request - (Re)Association request data3239*3240* This structure provides information needed to complete IEEE 802.113241* (re)association.3242* @bss: The BSS to associate with. If the call is successful the driver is3243* given a reference that it must give back to cfg80211_send_rx_assoc()3244* or to cfg80211_assoc_timeout(). To ensure proper refcounting, new3245* association requests while already associating must be rejected.3246* This also applies to the @links.bss parameter, which is used instead3247* of this one (it is %NULL) for MLO associations.3248* @ie: Extra IEs to add to (Re)Association Request frame or %NULL3249* @ie_len: Length of ie buffer in octets3250* @use_mfp: Use management frame protection (IEEE 802.11w) in this association3251* @crypto: crypto settings3252* @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used3253* to indicate a request to reassociate within the ESS instead of a request3254* do the initial association with the ESS. When included, this is set to3255* the BSSID of the current association, i.e., to the value that is3256* included in the Current AP address field of the Reassociation Request3257* frame.3258* @flags: See &enum cfg80211_assoc_req_flags3259* @supported_selectors: supported BSS selectors in IEEE 802.11 format3260* (or %NULL for no change).3261* If %NULL, then support for SAE_H2E should be assumed.3262* @supported_selectors_len: number of supported BSS selectors3263* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3264* will be used in ht_capa. Un-supported values will be ignored.3265* @ht_capa_mask: The bits of ht_capa which are to be used.3266* @vht_capa: VHT capability override3267* @vht_capa_mask: VHT capability mask indicating which fields to use3268* @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or3269* %NULL if FILS is not used.3270* @fils_kek_len: Length of fils_kek in octets3271* @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association3272* Request/Response frame or %NULL if FILS is not used. This field starts3273* with 16 octets of STA Nonce followed by 16 octets of AP Nonce.3274* @s1g_capa: S1G capability override3275* @s1g_capa_mask: S1G capability override mask3276* @links: per-link information for MLO connections3277* @link_id: >= 0 for MLO connections, where links are given, and indicates3278* the link on which the association request should be sent3279* @ap_mld_addr: AP MLD address in case of MLO association request,3280* valid iff @link_id >= 03281* @ext_mld_capa_ops: extended MLD capabilities and operations set by3282* userspace for the association3283*/3284struct cfg80211_assoc_request {3285struct cfg80211_bss *bss;3286const u8 *ie, *prev_bssid;3287size_t ie_len;3288struct cfg80211_crypto_settings crypto;3289bool use_mfp;3290u32 flags;3291const u8 *supported_selectors;3292u8 supported_selectors_len;3293struct ieee80211_ht_cap ht_capa;3294struct ieee80211_ht_cap ht_capa_mask;3295struct ieee80211_vht_cap vht_capa, vht_capa_mask;3296const u8 *fils_kek;3297size_t fils_kek_len;3298const u8 *fils_nonces;3299struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;3300struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];3301const u8 *ap_mld_addr;3302s8 link_id;3303u16 ext_mld_capa_ops;3304};33053306/**3307* struct cfg80211_deauth_request - Deauthentication request data3308*3309* This structure provides information needed to complete IEEE 802.113310* deauthentication.3311*3312* @bssid: the BSSID or AP MLD address to deauthenticate from3313* @ie: Extra IEs to add to Deauthentication frame or %NULL3314* @ie_len: Length of ie buffer in octets3315* @reason_code: The reason code for the deauthentication3316* @local_state_change: if set, change local state only and3317* do not set a deauth frame3318*/3319struct cfg80211_deauth_request {3320const u8 *bssid;3321const u8 *ie;3322size_t ie_len;3323u16 reason_code;3324bool local_state_change;3325};33263327/**3328* struct cfg80211_disassoc_request - Disassociation request data3329*3330* This structure provides information needed to complete IEEE 802.113331* disassociation.3332*3333* @ap_addr: the BSSID or AP MLD address to disassociate from3334* @ie: Extra IEs to add to Disassociation frame or %NULL3335* @ie_len: Length of ie buffer in octets3336* @reason_code: The reason code for the disassociation3337* @local_state_change: This is a request for a local state only, i.e., no3338* Disassociation frame is to be transmitted.3339*/3340struct cfg80211_disassoc_request {3341const u8 *ap_addr;3342const u8 *ie;3343size_t ie_len;3344u16 reason_code;3345bool local_state_change;3346};33473348/**3349* struct cfg80211_ibss_params - IBSS parameters3350*3351* This structure defines the IBSS parameters for the join_ibss()3352* method.3353*3354* @ssid: The SSID, will always be non-null.3355* @ssid_len: The length of the SSID, will always be non-zero.3356* @bssid: Fixed BSSID requested, maybe be %NULL, if set do not3357* search for IBSSs with a different BSSID.3358* @chandef: defines the channel to use if no other IBSS to join can be found3359* @channel_fixed: The channel should be fixed -- do not search for3360* IBSSs to join on other channels.3361* @ie: information element(s) to include in the beacon3362* @ie_len: length of that3363* @beacon_interval: beacon interval to use3364* @privacy: this is a protected network, keys will be configured3365* after joining3366* @control_port: whether user space controls IEEE 802.1X port, i.e.,3367* sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is3368* required to assume that the port is unauthorized until authorized by3369* user space. Otherwise, port is marked authorized by default.3370* @control_port_over_nl80211: TRUE if userspace expects to exchange control3371* port frames over NL80211 instead of the network interface.3372* @userspace_handles_dfs: whether user space controls DFS operation, i.e.3373* changes the channel when a radar is detected. This is required3374* to operate on DFS channels.3375* @basic_rates: bitmap of basic rates to use when creating the IBSS3376* @mcast_rate: per-band multicast rate index + 1 (0: disabled)3377* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3378* will be used in ht_capa. Un-supported values will be ignored.3379* @ht_capa_mask: The bits of ht_capa which are to be used.3380* @wep_keys: static WEP keys, if not NULL points to an array of3381* CFG80211_MAX_WEP_KEYS WEP keys3382* @wep_tx_key: key index (0..3) of the default TX static WEP key3383*/3384struct cfg80211_ibss_params {3385const u8 *ssid;3386const u8 *bssid;3387struct cfg80211_chan_def chandef;3388const u8 *ie;3389u8 ssid_len, ie_len;3390u16 beacon_interval;3391u32 basic_rates;3392bool channel_fixed;3393bool privacy;3394bool control_port;3395bool control_port_over_nl80211;3396bool userspace_handles_dfs;3397int mcast_rate[NUM_NL80211_BANDS];3398struct ieee80211_ht_cap ht_capa;3399struct ieee80211_ht_cap ht_capa_mask;3400struct key_params *wep_keys;3401int wep_tx_key;3402};34033404/**3405* struct cfg80211_bss_selection - connection parameters for BSS selection.3406*3407* @behaviour: requested BSS selection behaviour.3408* @param: parameters for requestion behaviour.3409* @param.band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.3410* @param.adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.3411*/3412struct cfg80211_bss_selection {3413enum nl80211_bss_select_attr behaviour;3414union {3415enum nl80211_band band_pref;3416struct cfg80211_bss_select_adjust adjust;3417} param;3418};34193420/**3421* struct cfg80211_connect_params - Connection parameters3422*3423* This structure provides information needed to complete IEEE 802.113424* authentication and association.3425*3426* @channel: The channel to use or %NULL if not specified (auto-select based3427* on scan results)3428* @channel_hint: The channel of the recommended BSS for initial connection or3429* %NULL if not specified3430* @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan3431* results)3432* @bssid_hint: The recommended AP BSSID for initial connection to the BSS or3433* %NULL if not specified. Unlike the @bssid parameter, the driver is3434* allowed to ignore this @bssid_hint if it has knowledge of a better BSS3435* to use.3436* @ssid: SSID3437* @ssid_len: Length of ssid in octets3438* @auth_type: Authentication type (algorithm)3439* @ie: IEs for association request3440* @ie_len: Length of assoc_ie in octets3441* @privacy: indicates whether privacy-enabled APs should be used3442* @mfp: indicate whether management frame protection is used3443* @crypto: crypto settings3444* @key_len: length of WEP key for shared key authentication3445* @key_idx: index of WEP key for shared key authentication3446* @key: WEP key for shared key authentication3447* @flags: See &enum cfg80211_assoc_req_flags3448* @bg_scan_period: Background scan period in seconds3449* or -1 to indicate that default value is to be used.3450* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3451* will be used in ht_capa. Un-supported values will be ignored.3452* @ht_capa_mask: The bits of ht_capa which are to be used.3453* @vht_capa: VHT Capability overrides3454* @vht_capa_mask: The bits of vht_capa which are to be used.3455* @pbss: if set, connect to a PCP instead of AP. Valid for DMG3456* networks.3457* @bss_select: criteria to be used for BSS selection.3458* @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used3459* to indicate a request to reassociate within the ESS instead of a request3460* do the initial association with the ESS. When included, this is set to3461* the BSSID of the current association, i.e., to the value that is3462* included in the Current AP address field of the Reassociation Request3463* frame.3464* @fils_erp_username: EAP re-authentication protocol (ERP) username part of the3465* NAI or %NULL if not specified. This is used to construct FILS wrapped3466* data IE.3467* @fils_erp_username_len: Length of @fils_erp_username in octets.3468* @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or3469* %NULL if not specified. This specifies the domain name of ER server and3470* is used to construct FILS wrapped data IE.3471* @fils_erp_realm_len: Length of @fils_erp_realm in octets.3472* @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP3473* messages. This is also used to construct FILS wrapped data IE.3474* @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional3475* keys in FILS or %NULL if not specified.3476* @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.3477* @want_1x: indicates user-space supports and wants to use 802.1X driver3478* offload of 4-way handshake.3479* @edmg: define the EDMG channels.3480* This may specify multiple channels and bonding options for the driver3481* to choose from, based on BSS configuration.3482*/3483struct cfg80211_connect_params {3484struct ieee80211_channel *channel;3485struct ieee80211_channel *channel_hint;3486const u8 *bssid;3487const u8 *bssid_hint;3488const u8 *ssid;3489size_t ssid_len;3490enum nl80211_auth_type auth_type;3491const u8 *ie;3492size_t ie_len;3493bool privacy;3494enum nl80211_mfp mfp;3495struct cfg80211_crypto_settings crypto;3496const u8 *key;3497u8 key_len, key_idx;3498u32 flags;3499int bg_scan_period;3500struct ieee80211_ht_cap ht_capa;3501struct ieee80211_ht_cap ht_capa_mask;3502struct ieee80211_vht_cap vht_capa;3503struct ieee80211_vht_cap vht_capa_mask;3504bool pbss;3505struct cfg80211_bss_selection bss_select;3506const u8 *prev_bssid;3507const u8 *fils_erp_username;3508size_t fils_erp_username_len;3509const u8 *fils_erp_realm;3510size_t fils_erp_realm_len;3511u16 fils_erp_next_seq_num;3512const u8 *fils_erp_rrk;3513size_t fils_erp_rrk_len;3514bool want_1x;3515struct ieee80211_edmg edmg;3516};35173518/**3519* enum cfg80211_connect_params_changed - Connection parameters being updated3520*3521* This enum provides information of all connect parameters that3522* have to be updated as part of update_connect_params() call.3523*3524* @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated3525* @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,3526* username, erp sequence number and rrk) are updated3527* @UPDATE_AUTH_TYPE: Indicates that authentication type is updated3528*/3529enum cfg80211_connect_params_changed {3530UPDATE_ASSOC_IES = BIT(0),3531UPDATE_FILS_ERP_INFO = BIT(1),3532UPDATE_AUTH_TYPE = BIT(2),3533};35343535/**3536* enum wiphy_params_flags - set_wiphy_params bitfield values3537* @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed3538* @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed3539* @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed3540* @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed3541* @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed3542* @WIPHY_PARAM_DYN_ACK: dynack has been enabled3543* @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed3544* @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed3545* @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum3546*/3547enum wiphy_params_flags {3548WIPHY_PARAM_RETRY_SHORT = BIT(0),3549WIPHY_PARAM_RETRY_LONG = BIT(1),3550WIPHY_PARAM_FRAG_THRESHOLD = BIT(2),3551WIPHY_PARAM_RTS_THRESHOLD = BIT(3),3552WIPHY_PARAM_COVERAGE_CLASS = BIT(4),3553WIPHY_PARAM_DYN_ACK = BIT(5),3554WIPHY_PARAM_TXQ_LIMIT = BIT(6),3555WIPHY_PARAM_TXQ_MEMORY_LIMIT = BIT(7),3556WIPHY_PARAM_TXQ_QUANTUM = BIT(8),3557};35583559#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 25635603561/* The per TXQ device queue limit in airtime */3562#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 50003563#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 1200035643565/* The per interface airtime threshold to switch to lower queue limit */3566#define IEEE80211_AQL_THRESHOLD 2400035673568/**3569* struct cfg80211_pmksa - PMK Security Association3570*3571* This structure is passed to the set/del_pmksa() method for PMKSA3572* caching.3573*3574* @bssid: The AP's BSSID (may be %NULL).3575* @pmkid: The identifier to refer a PMKSA.3576* @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key3577* derivation by a FILS STA. Otherwise, %NULL.3578* @pmk_len: Length of the @pmk. The length of @pmk can differ depending on3579* the hash algorithm used to generate this.3580* @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS3581* cache identifier (may be %NULL).3582* @ssid_len: Length of the @ssid in octets.3583* @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the3584* scope of PMKSA. This is valid only if @ssid_len is non-zero (may be3585* %NULL).3586* @pmk_lifetime: Maximum lifetime for PMKSA in seconds3587* (dot11RSNAConfigPMKLifetime) or 0 if not specified.3588* The configured PMKSA must not be used for PMKSA caching after3589* expiration and any keys derived from this PMK become invalid on3590* expiration, i.e., the current association must be dropped if the PMK3591* used for it expires.3592* @pmk_reauth_threshold: Threshold time for reauthentication (percentage of3593* PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.3594* Drivers are expected to trigger a full authentication instead of using3595* this PMKSA for caching when reassociating to a new BSS after this3596* threshold to generate a new PMK before the current one expires.3597*/3598struct cfg80211_pmksa {3599const u8 *bssid;3600const u8 *pmkid;3601const u8 *pmk;3602size_t pmk_len;3603const u8 *ssid;3604size_t ssid_len;3605const u8 *cache_id;3606u32 pmk_lifetime;3607u8 pmk_reauth_threshold;3608};36093610/**3611* struct cfg80211_pkt_pattern - packet pattern3612* @mask: bitmask where to match pattern and where to ignore bytes,3613* one bit per byte, in same format as nl802113614* @pattern: bytes to match where bitmask is 13615* @pattern_len: length of pattern (in bytes)3616* @pkt_offset: packet offset (in bytes)3617*3618* Internal note: @mask and @pattern are allocated in one chunk of3619* memory, free @mask only!3620*/3621struct cfg80211_pkt_pattern {3622const u8 *mask, *pattern;3623int pattern_len;3624int pkt_offset;3625};36263627/**3628* struct cfg80211_wowlan_tcp - TCP connection parameters3629*3630* @sock: (internal) socket for source port allocation3631* @src: source IP address3632* @dst: destination IP address3633* @dst_mac: destination MAC address3634* @src_port: source port3635* @dst_port: destination port3636* @payload_len: data payload length3637* @payload: data payload buffer3638* @payload_seq: payload sequence stamping configuration3639* @data_interval: interval at which to send data packets3640* @wake_len: wakeup payload match length3641* @wake_data: wakeup payload match data3642* @wake_mask: wakeup payload match mask3643* @tokens_size: length of the tokens buffer3644* @payload_tok: payload token usage configuration3645*/3646struct cfg80211_wowlan_tcp {3647struct socket *sock;3648__be32 src, dst;3649u16 src_port, dst_port;3650u8 dst_mac[ETH_ALEN];3651int payload_len;3652const u8 *payload;3653struct nl80211_wowlan_tcp_data_seq payload_seq;3654u32 data_interval;3655u32 wake_len;3656const u8 *wake_data, *wake_mask;3657u32 tokens_size;3658/* must be last, variable member */3659struct nl80211_wowlan_tcp_data_token payload_tok;3660};36613662/**3663* struct cfg80211_wowlan - Wake on Wireless-LAN support info3664*3665* This structure defines the enabled WoWLAN triggers for the device.3666* @any: wake up on any activity -- special trigger if device continues3667* operating as normal during suspend3668* @disconnect: wake up if getting disconnected3669* @magic_pkt: wake up on receiving magic packet3670* @patterns: wake up on receiving packet matching a pattern3671* @n_patterns: number of patterns3672* @gtk_rekey_failure: wake up on GTK rekey failure3673* @eap_identity_req: wake up on EAP identity request packet3674* @four_way_handshake: wake up on 4-way handshake3675* @rfkill_release: wake up when rfkill is released3676* @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.3677* NULL if not configured.3678* @nd_config: configuration for the scan to be used for net detect wake.3679*/3680struct cfg80211_wowlan {3681bool any, disconnect, magic_pkt, gtk_rekey_failure,3682eap_identity_req, four_way_handshake,3683rfkill_release;3684struct cfg80211_pkt_pattern *patterns;3685struct cfg80211_wowlan_tcp *tcp;3686int n_patterns;3687struct cfg80211_sched_scan_request *nd_config;3688};36893690/**3691* struct cfg80211_coalesce_rules - Coalesce rule parameters3692*3693* This structure defines coalesce rule for the device.3694* @delay: maximum coalescing delay in msecs.3695* @condition: condition for packet coalescence.3696* see &enum nl80211_coalesce_condition.3697* @patterns: array of packet patterns3698* @n_patterns: number of patterns3699*/3700struct cfg80211_coalesce_rules {3701int delay;3702enum nl80211_coalesce_condition condition;3703struct cfg80211_pkt_pattern *patterns;3704int n_patterns;3705};37063707/**3708* struct cfg80211_coalesce - Packet coalescing settings3709*3710* This structure defines coalescing settings.3711* @rules: array of coalesce rules3712* @n_rules: number of rules3713*/3714struct cfg80211_coalesce {3715int n_rules;3716struct cfg80211_coalesce_rules rules[] __counted_by(n_rules);3717};37183719/**3720* struct cfg80211_wowlan_nd_match - information about the match3721*3722* @ssid: SSID of the match that triggered the wake up3723* @n_channels: Number of channels where the match occurred. This3724* value may be zero if the driver can't report the channels.3725* @channels: center frequencies of the channels where a match3726* occurred (in MHz)3727*/3728struct cfg80211_wowlan_nd_match {3729struct cfg80211_ssid ssid;3730int n_channels;3731u32 channels[] __counted_by(n_channels);3732};37333734/**3735* struct cfg80211_wowlan_nd_info - net detect wake up information3736*3737* @n_matches: Number of match information instances provided in3738* @matches. This value may be zero if the driver can't provide3739* match information.3740* @matches: Array of pointers to matches containing information about3741* the matches that triggered the wake up.3742*/3743struct cfg80211_wowlan_nd_info {3744int n_matches;3745struct cfg80211_wowlan_nd_match *matches[] __counted_by(n_matches);3746};37473748/**3749* struct cfg80211_wowlan_wakeup - wakeup report3750* @disconnect: woke up by getting disconnected3751* @magic_pkt: woke up by receiving magic packet3752* @gtk_rekey_failure: woke up by GTK rekey failure3753* @eap_identity_req: woke up by EAP identity request packet3754* @four_way_handshake: woke up by 4-way handshake3755* @rfkill_release: woke up by rfkill being released3756* @pattern_idx: pattern that caused wakeup, -1 if not due to pattern3757* @packet_present_len: copied wakeup packet data3758* @packet_len: original wakeup packet length3759* @packet: The packet causing the wakeup, if any.3760* @packet_80211: For pattern match, magic packet and other data3761* frame triggers an 802.3 frame should be reported, for3762* disconnect due to deauth 802.11 frame. This indicates which3763* it is.3764* @tcp_match: TCP wakeup packet received3765* @tcp_connlost: TCP connection lost or failed to establish3766* @tcp_nomoretokens: TCP data ran out of tokens3767* @net_detect: if not %NULL, woke up because of net detect3768* @unprot_deauth_disassoc: woke up due to unprotected deauth or3769* disassoc frame (in MFP).3770*/3771struct cfg80211_wowlan_wakeup {3772bool disconnect, magic_pkt, gtk_rekey_failure,3773eap_identity_req, four_way_handshake,3774rfkill_release, packet_80211,3775tcp_match, tcp_connlost, tcp_nomoretokens,3776unprot_deauth_disassoc;3777s32 pattern_idx;3778u32 packet_present_len, packet_len;3779const void *packet;3780struct cfg80211_wowlan_nd_info *net_detect;3781};37823783/**3784* struct cfg80211_gtk_rekey_data - rekey data3785* @kek: key encryption key (@kek_len bytes)3786* @kck: key confirmation key (@kck_len bytes)3787* @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)3788* @kek_len: length of kek3789* @kck_len: length of kck3790* @akm: akm (oui, id)3791*/3792struct cfg80211_gtk_rekey_data {3793const u8 *kek, *kck, *replay_ctr;3794u32 akm;3795u8 kek_len, kck_len;3796};37973798/**3799* struct cfg80211_update_ft_ies_params - FT IE Information3800*3801* This structure provides information needed to update the fast transition IE3802*3803* @md: The Mobility Domain ID, 2 Octet value3804* @ie: Fast Transition IEs3805* @ie_len: Length of ft_ie in octets3806*/3807struct cfg80211_update_ft_ies_params {3808u16 md;3809const u8 *ie;3810size_t ie_len;3811};38123813/**3814* struct cfg80211_mgmt_tx_params - mgmt tx parameters3815*3816* This structure provides information needed to transmit a mgmt frame3817*3818* @chan: channel to use3819* @offchan: indicates whether off channel operation is required3820* @wait: duration for ROC3821* @buf: buffer to transmit3822* @len: buffer length3823* @no_cck: don't use cck rates for this frame3824* @dont_wait_for_ack: tells the low level not to wait for an ack3825* @n_csa_offsets: length of csa_offsets array3826* @csa_offsets: array of all the csa offsets in the frame3827* @link_id: for MLO, the link ID to transmit on, -1 if not given; note3828* that the link ID isn't validated (much), it's in range but the3829* link might not exist (or be used by the receiver STA)3830*/3831struct cfg80211_mgmt_tx_params {3832struct ieee80211_channel *chan;3833bool offchan;3834unsigned int wait;3835const u8 *buf;3836size_t len;3837bool no_cck;3838bool dont_wait_for_ack;3839int n_csa_offsets;3840const u16 *csa_offsets;3841int link_id;3842};38433844/**3845* struct cfg80211_dscp_exception - DSCP exception3846*3847* @dscp: DSCP value that does not adhere to the user priority range definition3848* @up: user priority value to which the corresponding DSCP value belongs3849*/3850struct cfg80211_dscp_exception {3851u8 dscp;3852u8 up;3853};38543855/**3856* struct cfg80211_dscp_range - DSCP range definition for user priority3857*3858* @low: lowest DSCP value of this user priority range, inclusive3859* @high: highest DSCP value of this user priority range, inclusive3860*/3861struct cfg80211_dscp_range {3862u8 low;3863u8 high;3864};38653866/* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */3867#define IEEE80211_QOS_MAP_MAX_EX 213868#define IEEE80211_QOS_MAP_LEN_MIN 163869#define IEEE80211_QOS_MAP_LEN_MAX \3870(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)38713872/**3873* struct cfg80211_qos_map - QoS Map Information3874*3875* This struct defines the Interworking QoS map setting for DSCP values3876*3877* @num_des: number of DSCP exceptions (0..21)3878* @dscp_exception: optionally up to maximum of 21 DSCP exceptions from3879* the user priority DSCP range definition3880* @up: DSCP range definition for a particular user priority3881*/3882struct cfg80211_qos_map {3883u8 num_des;3884struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];3885struct cfg80211_dscp_range up[8];3886};38873888/**3889* struct cfg80211_nan_conf - NAN configuration3890*3891* This struct defines NAN configuration parameters3892*3893* @master_pref: master preference (1 - 255)3894* @bands: operating bands, a bitmap of &enum nl80211_band values.3895* For instance, for NL80211_BAND_2GHZ, bit 0 would be set3896* (i.e. BIT(NL80211_BAND_2GHZ)).3897*/3898struct cfg80211_nan_conf {3899u8 master_pref;3900u8 bands;3901};39023903/**3904* enum cfg80211_nan_conf_changes - indicates changed fields in NAN3905* configuration3906*3907* @CFG80211_NAN_CONF_CHANGED_PREF: master preference3908* @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands3909*/3910enum cfg80211_nan_conf_changes {3911CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),3912CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),3913};39143915/**3916* struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter3917*3918* @filter: the content of the filter3919* @len: the length of the filter3920*/3921struct cfg80211_nan_func_filter {3922const u8 *filter;3923u8 len;3924};39253926/**3927* struct cfg80211_nan_func - a NAN function3928*3929* @type: &enum nl80211_nan_function_type3930* @service_id: the service ID of the function3931* @publish_type: &nl80211_nan_publish_type3932* @close_range: if true, the range should be limited. Threshold is3933* implementation specific.3934* @publish_bcast: if true, the solicited publish should be broadcasted3935* @subscribe_active: if true, the subscribe is active3936* @followup_id: the instance ID for follow up3937* @followup_reqid: the requester instance ID for follow up3938* @followup_dest: MAC address of the recipient of the follow up3939* @ttl: time to live counter in DW.3940* @serv_spec_info: Service Specific Info3941* @serv_spec_info_len: Service Specific Info length3942* @srf_include: if true, SRF is inclusive3943* @srf_bf: Bloom Filter3944* @srf_bf_len: Bloom Filter length3945* @srf_bf_idx: Bloom Filter index3946* @srf_macs: SRF MAC addresses3947* @srf_num_macs: number of MAC addresses in SRF3948* @rx_filters: rx filters that are matched with corresponding peer's tx_filter3949* @tx_filters: filters that should be transmitted in the SDF.3950* @num_rx_filters: length of &rx_filters.3951* @num_tx_filters: length of &tx_filters.3952* @instance_id: driver allocated id of the function.3953* @cookie: unique NAN function identifier.3954*/3955struct cfg80211_nan_func {3956enum nl80211_nan_function_type type;3957u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];3958u8 publish_type;3959bool close_range;3960bool publish_bcast;3961bool subscribe_active;3962u8 followup_id;3963u8 followup_reqid;3964struct mac_address followup_dest;3965u32 ttl;3966const u8 *serv_spec_info;3967u8 serv_spec_info_len;3968bool srf_include;3969const u8 *srf_bf;3970u8 srf_bf_len;3971u8 srf_bf_idx;3972struct mac_address *srf_macs;3973int srf_num_macs;3974struct cfg80211_nan_func_filter *rx_filters;3975struct cfg80211_nan_func_filter *tx_filters;3976u8 num_tx_filters;3977u8 num_rx_filters;3978u8 instance_id;3979u64 cookie;3980};39813982/**3983* struct cfg80211_pmk_conf - PMK configuration3984*3985* @aa: authenticator address3986* @pmk_len: PMK length in bytes.3987* @pmk: the PMK material3988* @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK3989* is not PMK-R0). When pmk_r0_name is not NULL, the pmk field3990* holds PMK-R0.3991*/3992struct cfg80211_pmk_conf {3993const u8 *aa;3994u8 pmk_len;3995const u8 *pmk;3996const u8 *pmk_r0_name;3997};39983999/**4000* struct cfg80211_external_auth_params - Trigger External authentication.4001*4002* Commonly used across the external auth request and event interfaces.4003*4004* @action: action type / trigger for external authentication. Only significant4005* for the authentication request event interface (driver to user space).4006* @bssid: BSSID of the peer with which the authentication has4007* to happen. Used by both the authentication request event and4008* authentication response command interface.4009* @ssid: SSID of the AP. Used by both the authentication request event and4010* authentication response command interface.4011* @key_mgmt_suite: AKM suite of the respective authentication. Used by the4012* authentication request event interface.4013* @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,4014* use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you4015* the real status code for failures. Used only for the authentication4016* response command interface (user space to driver).4017* @pmkid: The identifier to refer a PMKSA.4018* @mld_addr: MLD address of the peer. Used by the authentication request event4019* interface. Driver indicates this to enable MLO during the authentication4020* offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT4021* flag capability in NL80211_CMD_CONNECT to know whether the user space4022* supports enabling MLO during the authentication offload.4023* User space should use the address of the interface (on which the4024* authentication request event reported) as self MLD address. User space4025* and driver should use MLD addresses in RA, TA and BSSID fields of4026* authentication frames sent or received via cfg80211. The driver4027* translates the MLD addresses to/from link addresses based on the link4028* chosen for the authentication.4029*/4030struct cfg80211_external_auth_params {4031enum nl80211_external_auth_action action;4032u8 bssid[ETH_ALEN] __aligned(2);4033struct cfg80211_ssid ssid;4034unsigned int key_mgmt_suite;4035u16 status;4036const u8 *pmkid;4037u8 mld_addr[ETH_ALEN] __aligned(2);4038};40394040/**4041* struct cfg80211_ftm_responder_stats - FTM responder statistics4042*4043* @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to4044* indicate the relevant values in this struct for them4045* @success_num: number of FTM sessions in which all frames were successfully4046* answered4047* @partial_num: number of FTM sessions in which part of frames were4048* successfully answered4049* @failed_num: number of failed FTM sessions4050* @asap_num: number of ASAP FTM sessions4051* @non_asap_num: number of non-ASAP FTM sessions4052* @total_duration_ms: total sessions durations - gives an indication4053* of how much time the responder was busy4054* @unknown_triggers_num: number of unknown FTM triggers - triggers from4055* initiators that didn't finish successfully the negotiation phase with4056* the responder4057* @reschedule_requests_num: number of FTM reschedule requests - initiator asks4058* for a new scheduling although it already has scheduled FTM slot4059* @out_of_window_triggers_num: total FTM triggers out of scheduled window4060*/4061struct cfg80211_ftm_responder_stats {4062u32 filled;4063u32 success_num;4064u32 partial_num;4065u32 failed_num;4066u32 asap_num;4067u32 non_asap_num;4068u64 total_duration_ms;4069u32 unknown_triggers_num;4070u32 reschedule_requests_num;4071u32 out_of_window_triggers_num;4072};40734074/**4075* struct cfg80211_pmsr_ftm_result - FTM result4076* @failure_reason: if this measurement failed (PMSR status is4077* %NL80211_PMSR_STATUS_FAILURE), this gives a more precise4078* reason than just "failure"4079* @burst_index: if reporting partial results, this is the index4080* in [0 .. num_bursts-1] of the burst that's being reported4081* @num_ftmr_attempts: number of FTM request frames transmitted4082* @num_ftmr_successes: number of FTM request frames acked4083* @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,4084* fill this to indicate in how many seconds a retry is deemed possible4085* by the responder4086* @num_bursts_exp: actual number of bursts exponent negotiated4087* @burst_duration: actual burst duration negotiated4088* @ftms_per_burst: actual FTMs per burst negotiated4089* @lci_len: length of LCI information (if present)4090* @civicloc_len: length of civic location information (if present)4091* @lci: LCI data (may be %NULL)4092* @civicloc: civic location data (may be %NULL)4093* @rssi_avg: average RSSI over FTM action frames reported4094* @rssi_spread: spread of the RSSI over FTM action frames reported4095* @tx_rate: bitrate for transmitted FTM action frame response4096* @rx_rate: bitrate of received FTM action frame4097* @rtt_avg: average of RTTs measured (must have either this or @dist_avg)4098* @rtt_variance: variance of RTTs measured (note that standard deviation is4099* the square root of the variance)4100* @rtt_spread: spread of the RTTs measured4101* @dist_avg: average of distances (mm) measured4102* (must have either this or @rtt_avg)4103* @dist_variance: variance of distances measured (see also @rtt_variance)4104* @dist_spread: spread of distances measured (see also @rtt_spread)4105* @num_ftmr_attempts_valid: @num_ftmr_attempts is valid4106* @num_ftmr_successes_valid: @num_ftmr_successes is valid4107* @rssi_avg_valid: @rssi_avg is valid4108* @rssi_spread_valid: @rssi_spread is valid4109* @tx_rate_valid: @tx_rate is valid4110* @rx_rate_valid: @rx_rate is valid4111* @rtt_avg_valid: @rtt_avg is valid4112* @rtt_variance_valid: @rtt_variance is valid4113* @rtt_spread_valid: @rtt_spread is valid4114* @dist_avg_valid: @dist_avg is valid4115* @dist_variance_valid: @dist_variance is valid4116* @dist_spread_valid: @dist_spread is valid4117*/4118struct cfg80211_pmsr_ftm_result {4119const u8 *lci;4120const u8 *civicloc;4121unsigned int lci_len;4122unsigned int civicloc_len;4123enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;4124u32 num_ftmr_attempts, num_ftmr_successes;4125s16 burst_index;4126u8 busy_retry_time;4127u8 num_bursts_exp;4128u8 burst_duration;4129u8 ftms_per_burst;4130s32 rssi_avg;4131s32 rssi_spread;4132struct rate_info tx_rate, rx_rate;4133s64 rtt_avg;4134s64 rtt_variance;4135s64 rtt_spread;4136s64 dist_avg;4137s64 dist_variance;4138s64 dist_spread;41394140u16 num_ftmr_attempts_valid:1,4141num_ftmr_successes_valid:1,4142rssi_avg_valid:1,4143rssi_spread_valid:1,4144tx_rate_valid:1,4145rx_rate_valid:1,4146rtt_avg_valid:1,4147rtt_variance_valid:1,4148rtt_spread_valid:1,4149dist_avg_valid:1,4150dist_variance_valid:1,4151dist_spread_valid:1;4152};41534154/**4155* struct cfg80211_pmsr_result - peer measurement result4156* @addr: address of the peer4157* @host_time: host time (use ktime_get_boottime() adjust to the time when the4158* measurement was made)4159* @ap_tsf: AP's TSF at measurement time4160* @status: status of the measurement4161* @final: if reporting partial results, mark this as the last one; if not4162* reporting partial results always set this flag4163* @ap_tsf_valid: indicates the @ap_tsf value is valid4164* @type: type of the measurement reported, note that we only support reporting4165* one type at a time, but you can report multiple results separately and4166* they're all aggregated for userspace.4167* @ftm: FTM result4168*/4169struct cfg80211_pmsr_result {4170u64 host_time, ap_tsf;4171enum nl80211_peer_measurement_status status;41724173u8 addr[ETH_ALEN];41744175u8 final:1,4176ap_tsf_valid:1;41774178enum nl80211_peer_measurement_type type;41794180union {4181struct cfg80211_pmsr_ftm_result ftm;4182};4183};41844185/**4186* struct cfg80211_pmsr_ftm_request_peer - FTM request data4187* @requested: indicates FTM is requested4188* @preamble: frame preamble to use4189* @burst_period: burst period to use4190* @asap: indicates to use ASAP mode4191* @num_bursts_exp: number of bursts exponent4192* @burst_duration: burst duration4193* @ftms_per_burst: number of FTMs per burst4194* @ftmr_retries: number of retries for FTM request4195* @request_lci: request LCI information4196* @request_civicloc: request civic location information4197* @trigger_based: use trigger based ranging for the measurement4198* If neither @trigger_based nor @non_trigger_based is set,4199* EDCA based ranging will be used.4200* @non_trigger_based: use non trigger based ranging for the measurement4201* If neither @trigger_based nor @non_trigger_based is set,4202* EDCA based ranging will be used.4203* @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either4204* @trigger_based or @non_trigger_based is set.4205* @bss_color: the bss color of the responder. Optional. Set to zero to4206* indicate the driver should set the BSS color. Only valid if4207* @non_trigger_based or @trigger_based is set.4208*4209* See also nl80211 for the respective attribute documentation.4210*/4211struct cfg80211_pmsr_ftm_request_peer {4212enum nl80211_preamble preamble;4213u16 burst_period;4214u8 requested:1,4215asap:1,4216request_lci:1,4217request_civicloc:1,4218trigger_based:1,4219non_trigger_based:1,4220lmr_feedback:1;4221u8 num_bursts_exp;4222u8 burst_duration;4223u8 ftms_per_burst;4224u8 ftmr_retries;4225u8 bss_color;4226};42274228/**4229* struct cfg80211_pmsr_request_peer - peer data for a peer measurement request4230* @addr: MAC address4231* @chandef: channel to use4232* @report_ap_tsf: report the associated AP's TSF4233* @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer4234*/4235struct cfg80211_pmsr_request_peer {4236u8 addr[ETH_ALEN];4237struct cfg80211_chan_def chandef;4238u8 report_ap_tsf:1;4239struct cfg80211_pmsr_ftm_request_peer ftm;4240};42414242/**4243* struct cfg80211_pmsr_request - peer measurement request4244* @cookie: cookie, set by cfg802114245* @nl_portid: netlink portid - used by cfg802114246* @drv_data: driver data for this request, if required for aborting,4247* not otherwise freed or anything by cfg802114248* @mac_addr: MAC address used for (randomised) request4249* @mac_addr_mask: MAC address mask used for randomisation, bits that4250* are 0 in the mask should be randomised, bits that are 1 should4251* be taken from the @mac_addr4252* @list: used by cfg80211 to hold on to the request4253* @timeout: timeout (in milliseconds) for the whole operation, if4254* zero it means there's no timeout4255* @n_peers: number of peers to do measurements with4256* @peers: per-peer measurement request data4257*/4258struct cfg80211_pmsr_request {4259u64 cookie;4260void *drv_data;4261u32 n_peers;4262u32 nl_portid;42634264u32 timeout;42654266u8 mac_addr[ETH_ALEN] __aligned(2);4267u8 mac_addr_mask[ETH_ALEN] __aligned(2);42684269struct list_head list;42704271struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers);4272};42734274/**4275* struct cfg80211_update_owe_info - OWE Information4276*4277* This structure provides information needed for the drivers to offload OWE4278* (Opportunistic Wireless Encryption) processing to the user space.4279*4280* Commonly used across update_owe_info request and event interfaces.4281*4282* @peer: MAC address of the peer device for which the OWE processing4283* has to be done.4284* @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info4285* processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space4286* cannot give you the real status code for failures. Used only for4287* OWE update request command interface (user space to driver).4288* @ie: IEs obtained from the peer or constructed by the user space. These are4289* the IEs of the remote peer in the event from the host driver and4290* the constructed IEs by the user space in the request interface.4291* @ie_len: Length of IEs in octets.4292* @assoc_link_id: MLO link ID of the AP, with which (re)association requested4293* by peer. This will be filled by driver for both MLO and non-MLO station4294* connections when the AP affiliated with an MLD. For non-MLD AP mode, it4295* will be -1. Used only with OWE update event (driver to user space).4296* @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO4297* connection, it will be all zeros. This is applicable only when4298* @assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only4299* with OWE update event (driver to user space).4300*/4301struct cfg80211_update_owe_info {4302u8 peer[ETH_ALEN] __aligned(2);4303u16 status;4304const u8 *ie;4305size_t ie_len;4306int assoc_link_id;4307u8 peer_mld_addr[ETH_ALEN] __aligned(2);4308};43094310/**4311* struct mgmt_frame_regs - management frame registrations data4312* @global_stypes: bitmap of management frame subtypes registered4313* for the entire device4314* @interface_stypes: bitmap of management frame subtypes registered4315* for the given interface4316* @global_mcast_stypes: mcast RX is needed globally for these subtypes4317* @interface_mcast_stypes: mcast RX is needed on this interface4318* for these subtypes4319*/4320struct mgmt_frame_regs {4321u32 global_stypes, interface_stypes;4322u32 global_mcast_stypes, interface_mcast_stypes;4323};43244325/**4326* struct cfg80211_ops - backend description for wireless configuration4327*4328* This struct is registered by fullmac card drivers and/or wireless stacks4329* in order to handle configuration requests on their interfaces.4330*4331* All callbacks except where otherwise noted should return 04332* on success or a negative error code.4333*4334* All operations are invoked with the wiphy mutex held. The RTNL may be4335* held in addition (due to wireless extensions) but this cannot be relied4336* upon except in cases where documented below. Note that due to ordering,4337* the RTNL also cannot be acquired in any handlers.4338*4339* @suspend: wiphy device needs to be suspended. The variable @wow will4340* be %NULL or contain the enabled Wake-on-Wireless triggers that are4341* configured for the device.4342* @resume: wiphy device needs to be resumed4343* @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback4344* to call device_set_wakeup_enable() to enable/disable wakeup from4345* the device.4346*4347* @add_virtual_intf: create a new virtual interface with the given name,4348* must set the struct wireless_dev's iftype. Beware: You must create4349* the new netdev in the wiphy's network namespace! Returns the struct4350* wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must4351* also set the address member in the wdev.4352* This additionally holds the RTNL to be able to do netdev changes.4353*4354* @del_virtual_intf: remove the virtual interface4355* This additionally holds the RTNL to be able to do netdev changes.4356*4357* @change_virtual_intf: change type/configuration of virtual interface,4358* keep the struct wireless_dev's iftype updated.4359* This additionally holds the RTNL to be able to do netdev changes.4360*4361* @add_intf_link: Add a new MLO link to the given interface. Note that4362* the wdev->link[] data structure has been updated, so the new link4363* address is available.4364* @del_intf_link: Remove an MLO link from the given interface.4365*4366* @add_key: add a key with the given parameters. @mac_addr will be %NULL4367* when adding a group key. @link_id will be -1 for non-MLO connection.4368* For MLO connection, @link_id will be >= 0 for group key and -1 for4369* pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key.4370*4371* @get_key: get information about the key with the given parameters.4372* @mac_addr will be %NULL when requesting information for a group4373* key. All pointers given to the @callback function need not be valid4374* after it returns. This function should return an error if it is4375* not possible to retrieve the key, -ENOENT if it doesn't exist.4376* @link_id will be -1 for non-MLO connection. For MLO connection,4377* @link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr4378* will be peer's MLD address for MLO pairwise key.4379*4380* @del_key: remove a key given the @mac_addr (%NULL for a group key)4381* and @key_index, return -ENOENT if the key doesn't exist. @link_id will4382* be -1 for non-MLO connection. For MLO connection, @link_id will be >= 04383* for group key and -1 for pairwise key, @mac_addr will be peer's MLD4384* address for MLO pairwise key.4385*4386* @set_default_key: set the default key on an interface. @link_id will be >= 04387* for MLO connection and -1 for non-MLO connection.4388*4389* @set_default_mgmt_key: set the default management frame key on an interface.4390* @link_id will be >= 0 for MLO connection and -1 for non-MLO connection.4391*4392* @set_default_beacon_key: set the default Beacon frame key on an interface.4393* @link_id will be >= 0 for MLO connection and -1 for non-MLO connection.4394*4395* @set_rekey_data: give the data necessary for GTK rekeying to the driver4396*4397* @start_ap: Start acting in AP mode defined by the parameters.4398* @change_beacon: Change the beacon parameters for an access point mode4399* interface. This should reject the call when AP mode wasn't started.4400* @stop_ap: Stop being an AP, including stopping beaconing.4401*4402* @add_station: Add a new station.4403* @del_station: Remove a station4404* @change_station: Modify a given station. Note that flags changes are not much4405* validated in cfg80211, in particular the auth/assoc/authorized flags4406* might come to the driver in invalid combinations -- make sure to check4407* them, also against the existing state! Drivers must call4408* cfg80211_check_station_change() to validate the information.4409* @get_station: get station information for the station identified by @mac4410* @dump_station: dump station callback -- resume dump at index @idx4411*4412* @add_mpath: add a fixed mesh path4413* @del_mpath: delete a given mesh path4414* @change_mpath: change a given mesh path4415* @get_mpath: get a mesh path for the given parameters4416* @dump_mpath: dump mesh path callback -- resume dump at index @idx4417* @get_mpp: get a mesh proxy path for the given parameters4418* @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx4419* @join_mesh: join the mesh network with the specified parameters4420* (invoked with the wireless_dev mutex held)4421* @leave_mesh: leave the current mesh network4422* (invoked with the wireless_dev mutex held)4423*4424* @get_mesh_config: Get the current mesh configuration4425*4426* @update_mesh_config: Update mesh parameters on a running mesh.4427* The mask is a bitfield which tells us which parameters to4428* set, and which to leave alone.4429*4430* @change_bss: Modify parameters for a given BSS.4431*4432* @inform_bss: Called by cfg80211 while being informed about new BSS data4433* for every BSS found within the reported data or frame. This is called4434* from within the cfg8011 inform_bss handlers while holding the bss_lock.4435* The data parameter is passed through from drv_data inside4436* struct cfg80211_inform_bss.4437* The new IE data for the BSS is explicitly passed.4438*4439* @set_txq_params: Set TX queue parameters4440*4441* @libertas_set_mesh_channel: Only for backward compatibility for libertas,4442* as it doesn't implement join_mesh and needs to set the channel to4443* join the mesh instead.4444*4445* @set_monitor_channel: Set the monitor mode channel for the device. If other4446* interfaces are active this callback should reject the configuration.4447* If no interfaces are active or the device is down, the channel should4448* be stored for when a monitor interface becomes active.4449*4450* @scan: Request to do a scan. If returning zero, the scan request is given4451* the driver, and will be valid until passed to cfg80211_scan_done().4452* For scan results, call cfg80211_inform_bss(); you can call this outside4453* the scan/scan_done bracket too.4454* @abort_scan: Tell the driver to abort an ongoing scan. The driver shall4455* indicate the status of the scan through cfg80211_scan_done().4456*4457* @auth: Request to authenticate with the specified peer4458* (invoked with the wireless_dev mutex held)4459* @assoc: Request to (re)associate with the specified peer4460* (invoked with the wireless_dev mutex held)4461* @deauth: Request to deauthenticate from the specified peer4462* (invoked with the wireless_dev mutex held)4463* @disassoc: Request to disassociate from the specified peer4464* (invoked with the wireless_dev mutex held)4465*4466* @connect: Connect to the ESS with the specified parameters. When connected,4467* call cfg80211_connect_result()/cfg80211_connect_bss() with status code4468* %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call4469* cfg80211_connect_result()/cfg80211_connect_bss() with the status code4470* from the AP or cfg80211_connect_timeout() if no frame with status code4471* was received.4472* The driver is allowed to roam to other BSSes within the ESS when the4473* other BSS matches the connect parameters. When such roaming is initiated4474* by the driver, the driver is expected to verify that the target matches4475* the configured security parameters and to use Reassociation Request4476* frame instead of Association Request frame.4477* The connect function can also be used to request the driver to perform a4478* specific roam when connected to an ESS. In that case, the prev_bssid4479* parameter is set to the BSSID of the currently associated BSS as an4480* indication of requesting reassociation.4481* In both the driver-initiated and new connect() call initiated roaming4482* cases, the result of roaming is indicated with a call to4483* cfg80211_roamed(). (invoked with the wireless_dev mutex held)4484* @update_connect_params: Update the connect parameters while connected to a4485* BSS. The updated parameters can be used by driver/firmware for4486* subsequent BSS selection (roaming) decisions and to form the4487* Authentication/(Re)Association Request frames. This call does not4488* request an immediate disassociation or reassociation with the current4489* BSS, i.e., this impacts only subsequent (re)associations. The bits in4490* changed are defined in &enum cfg80211_connect_params_changed.4491* (invoked with the wireless_dev mutex held)4492* @disconnect: Disconnect from the BSS/ESS or stop connection attempts if4493* connection is in progress. Once done, call cfg80211_disconnected() in4494* case connection was already established (invoked with the4495* wireless_dev mutex held), otherwise call cfg80211_connect_timeout().4496*4497* @join_ibss: Join the specified IBSS (or create if necessary). Once done, call4498* cfg80211_ibss_joined(), also call that function when changing BSSID due4499* to a merge.4500* (invoked with the wireless_dev mutex held)4501* @leave_ibss: Leave the IBSS.4502* (invoked with the wireless_dev mutex held)4503*4504* @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or4505* MESH mode)4506*4507* @set_wiphy_params: Notify that wiphy parameters have changed;4508* @changed bitfield (see &enum wiphy_params_flags) describes which values4509* have changed. The actual parameter values are available in4510* struct wiphy. If returning an error, no value should be changed.4511*4512* @set_tx_power: set the transmit power according to the parameters,4513* the power passed is in mBm, to get dBm use MBM_TO_DBM(). The4514* wdev may be %NULL if power was set for the wiphy, and will4515* always be %NULL unless the driver supports per-vif TX power4516* (as advertised by the nl80211 feature flag.)4517* @get_tx_power: store the current TX power into the dbm variable;4518* return 0 if successful4519*4520* @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting4521* functions to adjust rfkill hw state4522*4523* @dump_survey: get site survey information.4524*4525* @remain_on_channel: Request the driver to remain awake on the specified4526* channel for the specified duration to complete an off-channel4527* operation (e.g., public action frame exchange). When the driver is4528* ready on the requested channel, it must indicate this with an event4529* notification by calling cfg80211_ready_on_channel().4530* @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.4531* This allows the operation to be terminated prior to timeout based on4532* the duration value.4533* @mgmt_tx: Transmit a management frame.4534* @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management4535* frame on another channel4536*4537* @testmode_cmd: run a test mode command; @wdev may be %NULL4538* @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be4539* used by the function, but 0 and 1 must not be touched. Additionally,4540* return error codes other than -ENOBUFS and -ENOENT will terminate the4541* dump and return to userspace with an error, so be careful. If any data4542* was passed in from userspace then the data/len arguments will be present4543* and point to the data contained in %NL80211_ATTR_TESTDATA.4544*4545* @set_bitrate_mask: set the bitrate mask configuration4546*4547* @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac4548* devices running firmwares capable of generating the (re) association4549* RSN IE. It allows for faster roaming between WPA2 BSSIDs.4550* @del_pmksa: Delete a cached PMKID.4551* @flush_pmksa: Flush all cached PMKIDs.4552* @set_power_mgmt: Configure WLAN power management. A timeout value of -14553* allows the driver to adjust the dynamic ps timeout value.4554* @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.4555* After configuration, the driver should (soon) send an event indicating4556* the current level is above/below the configured threshold; this may4557* need some care when the configuration is changed (without first being4558* disabled.)4559* @set_cqm_rssi_range_config: Configure two RSSI thresholds in the4560* connection quality monitor. An event is to be sent only when the4561* signal level is found to be outside the two values. The driver should4562* set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.4563* If it is provided then there's no point providing @set_cqm_rssi_config.4564* @set_cqm_txe_config: Configure connection quality monitor TX error4565* thresholds.4566* @sched_scan_start: Tell the driver to start a scheduled scan.4567* @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with4568* given request id. This call must stop the scheduled scan and be ready4569* for starting a new one before it returns, i.e. @sched_scan_start may be4570* called immediately after that again and should not fail in that case.4571* The driver should not call cfg80211_sched_scan_stopped() for a requested4572* stop (when this method returns 0).4573*4574* @update_mgmt_frame_registrations: Notify the driver that management frame4575* registrations were updated. The callback is allowed to sleep.4576*4577* @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.4578* Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may4579* reject TX/RX mask combinations they cannot support by returning -EINVAL4580* (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).4581*4582* @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).4583*4584* @tdls_mgmt: Transmit a TDLS management frame.4585* @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).4586*4587* @probe_client: probe an associated client, must return a cookie that it4588* later passes to cfg80211_probe_status().4589*4590* @set_noack_map: Set the NoAck Map for the TIDs.4591*4592* @get_channel: Get the current operating channel for the virtual interface.4593* For monitor interfaces, it should return %NULL unless there's a single4594* current monitoring channel.4595*4596* @start_p2p_device: Start the given P2P device.4597* @stop_p2p_device: Stop the given P2P device.4598*4599* @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.4600* Parameters include ACL policy, an array of MAC address of stations4601* and the number of MAC addresses. If there is already a list in driver4602* this new list replaces the existing one. Driver has to clear its ACL4603* when number of MAC addresses entries is passed as 0. Drivers which4604* advertise the support for MAC based ACL have to implement this callback.4605*4606* @start_radar_detection: Start radar detection in the driver.4607*4608* @end_cac: End running CAC, probably because a related CAC4609* was finished on another phy.4610*4611* @update_ft_ies: Provide updated Fast BSS Transition information to the4612* driver. If the SME is in the driver/firmware, this information can be4613* used in building Authentication and Reassociation Request frames.4614*4615* @crit_proto_start: Indicates a critical protocol needs more link reliability4616* for a given duration (milliseconds). The protocol is provided so the4617* driver can take the most appropriate actions.4618* @crit_proto_stop: Indicates critical protocol no longer needs increased link4619* reliability. This operation can not fail.4620* @set_coalesce: Set coalesce parameters.4621*4622* @channel_switch: initiate channel-switch procedure (with CSA). Driver is4623* responsible for veryfing if the switch is possible. Since this is4624* inherently tricky driver may decide to disconnect an interface later4625* with cfg80211_stop_iface(). This doesn't mean driver can accept4626* everything. It should do it's best to verify requests and reject them4627* as soon as possible.4628*4629* @set_qos_map: Set QoS mapping information to the driver4630*4631* @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the4632* given interface This is used e.g. for dynamic HT 20/40 MHz channel width4633* changes during the lifetime of the BSS.4634*4635* @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device4636* with the given parameters; action frame exchange has been handled by4637* userspace so this just has to modify the TX path to take the TS into4638* account.4639* If the admitted time is 0 just validate the parameters to make sure4640* the session can be created at all; it is valid to just always return4641* success for that but that may result in inefficient behaviour (handshake4642* with the peer followed by immediate teardown when the addition is later4643* rejected)4644* @del_tx_ts: remove an existing TX TS4645*4646* @join_ocb: join the OCB network with the specified parameters4647* (invoked with the wireless_dev mutex held)4648* @leave_ocb: leave the current OCB network4649* (invoked with the wireless_dev mutex held)4650*4651* @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver4652* is responsible for continually initiating channel-switching operations4653* and returning to the base channel for communication with the AP.4654* @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both4655* peers must be on the base channel when the call completes.4656* @start_nan: Start the NAN interface.4657* @stop_nan: Stop the NAN interface.4658* @add_nan_func: Add a NAN function. Returns negative value on failure.4659* On success @nan_func ownership is transferred to the driver and4660* it may access it outside of the scope of this function. The driver4661* should free the @nan_func when no longer needed by calling4662* cfg80211_free_nan_func().4663* On success the driver should assign an instance_id in the4664* provided @nan_func.4665* @del_nan_func: Delete a NAN function.4666* @nan_change_conf: changes NAN configuration. The changed parameters must4667* be specified in @changes (using &enum cfg80211_nan_conf_changes);4668* All other parameters must be ignored.4669*4670* @set_multicast_to_unicast: configure multicast to unicast conversion for BSS4671*4672* @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this4673* function should return phy stats, and interface stats otherwise.4674*4675* @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.4676* If not deleted through @del_pmk the PMK remains valid until disconnect4677* upon which the driver should clear it.4678* (invoked with the wireless_dev mutex held)4679* @del_pmk: delete the previously configured PMK for the given authenticator.4680* (invoked with the wireless_dev mutex held)4681*4682* @external_auth: indicates result of offloaded authentication processing from4683* user space4684*4685* @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter4686* tells the driver that the frame should not be encrypted.4687*4688* @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.4689* Statistics should be cumulative, currently no way to reset is provided.4690* @start_pmsr: start peer measurement (e.g. FTM)4691* @abort_pmsr: abort peer measurement4692*4693* @update_owe_info: Provide updated OWE info to driver. Driver implementing SME4694* but offloading OWE processing to the user space will get the updated4695* DH IE through this interface.4696*4697* @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame4698* and overrule HWMP path selection algorithm.4699* @set_tid_config: TID specific configuration, this can be peer or BSS specific4700* This callback may sleep.4701* @reset_tid_config: Reset TID specific configuration for the peer, for the4702* given TIDs. This callback may sleep.4703*4704* @set_sar_specs: Update the SAR (TX power) settings.4705*4706* @color_change: Initiate a color change.4707*4708* @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use4709* those to decrypt (Re)Association Request and encrypt (Re)Association4710* Response frame.4711*4712* @set_radar_background: Configure dedicated offchannel chain available for4713* radar/CAC detection on some hw. This chain can't be used to transmit4714* or receive frames and it is bounded to a running wdev.4715* Background radar/CAC detection allows to avoid the CAC downtime4716* switching to a different channel during CAC detection on the selected4717* radar channel.4718* The caller is expected to set chandef pointer to NULL in order to4719* disable background CAC/radar detection.4720* @add_link_station: Add a link to a station.4721* @mod_link_station: Modify a link of a station.4722* @del_link_station: Remove a link of a station.4723*4724* @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.4725* @set_ttlm: set the TID to link mapping.4726* @set_epcs: Enable/Disable EPCS for station mode.4727* @get_radio_mask: get bitmask of radios in use.4728* (invoked with the wiphy mutex held)4729* @assoc_ml_reconf: Request a non-AP MLO connection to perform ML4730* reconfiguration, i.e., add and/or remove links to/from the4731* association using ML reconfiguration action frames. Successfully added4732* links will be added to the set of valid links. Successfully removed4733* links will be removed from the set of valid links. The driver must4734* indicate removed links by calling cfg80211_links_removed() and added4735* links by calling cfg80211_mlo_reconf_add_done(). When calling4736* cfg80211_mlo_reconf_add_done() the bss pointer must be given for each4737* link for which MLO reconfiguration 'add' operation was requested.4738*/4739struct cfg80211_ops {4740int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);4741int (*resume)(struct wiphy *wiphy);4742void (*set_wakeup)(struct wiphy *wiphy, bool enabled);47434744struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,4745const char *name,4746unsigned char name_assign_type,4747enum nl80211_iftype type,4748struct vif_params *params);4749int (*del_virtual_intf)(struct wiphy *wiphy,4750struct wireless_dev *wdev);4751int (*change_virtual_intf)(struct wiphy *wiphy,4752struct net_device *dev,4753enum nl80211_iftype type,4754struct vif_params *params);47554756int (*add_intf_link)(struct wiphy *wiphy,4757struct wireless_dev *wdev,4758unsigned int link_id);4759void (*del_intf_link)(struct wiphy *wiphy,4760struct wireless_dev *wdev,4761unsigned int link_id);47624763int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,4764int link_id, u8 key_index, bool pairwise,4765const u8 *mac_addr, struct key_params *params);4766int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,4767int link_id, u8 key_index, bool pairwise,4768const u8 *mac_addr, void *cookie,4769void (*callback)(void *cookie, struct key_params*));4770int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,4771int link_id, u8 key_index, bool pairwise,4772const u8 *mac_addr);4773int (*set_default_key)(struct wiphy *wiphy,4774struct net_device *netdev, int link_id,4775u8 key_index, bool unicast, bool multicast);4776int (*set_default_mgmt_key)(struct wiphy *wiphy,4777struct net_device *netdev, int link_id,4778u8 key_index);4779int (*set_default_beacon_key)(struct wiphy *wiphy,4780struct net_device *netdev,4781int link_id,4782u8 key_index);47834784int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,4785struct cfg80211_ap_settings *settings);4786int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,4787struct cfg80211_ap_update *info);4788int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev,4789unsigned int link_id);479047914792int (*add_station)(struct wiphy *wiphy, struct net_device *dev,4793const u8 *mac,4794struct station_parameters *params);4795int (*del_station)(struct wiphy *wiphy, struct net_device *dev,4796struct station_del_parameters *params);4797int (*change_station)(struct wiphy *wiphy, struct net_device *dev,4798const u8 *mac,4799struct station_parameters *params);4800int (*get_station)(struct wiphy *wiphy, struct net_device *dev,4801const u8 *mac, struct station_info *sinfo);4802int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,4803int idx, u8 *mac, struct station_info *sinfo);48044805int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,4806const u8 *dst, const u8 *next_hop);4807int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,4808const u8 *dst);4809int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,4810const u8 *dst, const u8 *next_hop);4811int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,4812u8 *dst, u8 *next_hop, struct mpath_info *pinfo);4813int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,4814int idx, u8 *dst, u8 *next_hop,4815struct mpath_info *pinfo);4816int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,4817u8 *dst, u8 *mpp, struct mpath_info *pinfo);4818int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,4819int idx, u8 *dst, u8 *mpp,4820struct mpath_info *pinfo);4821int (*get_mesh_config)(struct wiphy *wiphy,4822struct net_device *dev,4823struct mesh_config *conf);4824int (*update_mesh_config)(struct wiphy *wiphy,4825struct net_device *dev, u32 mask,4826const struct mesh_config *nconf);4827int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,4828const struct mesh_config *conf,4829const struct mesh_setup *setup);4830int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);48314832int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,4833struct ocb_setup *setup);4834int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);48354836int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,4837struct bss_parameters *params);48384839void (*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss,4840const struct cfg80211_bss_ies *ies, void *data);48414842int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,4843struct ieee80211_txq_params *params);48444845int (*libertas_set_mesh_channel)(struct wiphy *wiphy,4846struct net_device *dev,4847struct ieee80211_channel *chan);48484849int (*set_monitor_channel)(struct wiphy *wiphy,4850struct net_device *dev,4851struct cfg80211_chan_def *chandef);48524853int (*scan)(struct wiphy *wiphy,4854struct cfg80211_scan_request *request);4855void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);48564857int (*auth)(struct wiphy *wiphy, struct net_device *dev,4858struct cfg80211_auth_request *req);4859int (*assoc)(struct wiphy *wiphy, struct net_device *dev,4860struct cfg80211_assoc_request *req);4861int (*deauth)(struct wiphy *wiphy, struct net_device *dev,4862struct cfg80211_deauth_request *req);4863int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,4864struct cfg80211_disassoc_request *req);48654866int (*connect)(struct wiphy *wiphy, struct net_device *dev,4867struct cfg80211_connect_params *sme);4868int (*update_connect_params)(struct wiphy *wiphy,4869struct net_device *dev,4870struct cfg80211_connect_params *sme,4871u32 changed);4872int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,4873u16 reason_code);48744875int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,4876struct cfg80211_ibss_params *params);4877int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);48784879int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,4880int rate[NUM_NL80211_BANDS]);48814882int (*set_wiphy_params)(struct wiphy *wiphy, int radio_idx,4883u32 changed);48844885int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,4886int radio_idx,4887enum nl80211_tx_power_setting type, int mbm);4888int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,4889int radio_idx, unsigned int link_id, int *dbm);48904891void (*rfkill_poll)(struct wiphy *wiphy);48924893#ifdef CONFIG_NL80211_TESTMODE4894int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,4895void *data, int len);4896int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,4897struct netlink_callback *cb,4898void *data, int len);4899#endif49004901int (*set_bitrate_mask)(struct wiphy *wiphy,4902struct net_device *dev,4903unsigned int link_id,4904const u8 *peer,4905const struct cfg80211_bitrate_mask *mask);49064907int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,4908int idx, struct survey_info *info);49094910int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,4911struct cfg80211_pmksa *pmksa);4912int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,4913struct cfg80211_pmksa *pmksa);4914int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);49154916int (*remain_on_channel)(struct wiphy *wiphy,4917struct wireless_dev *wdev,4918struct ieee80211_channel *chan,4919unsigned int duration,4920u64 *cookie);4921int (*cancel_remain_on_channel)(struct wiphy *wiphy,4922struct wireless_dev *wdev,4923u64 cookie);49244925int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,4926struct cfg80211_mgmt_tx_params *params,4927u64 *cookie);4928int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,4929struct wireless_dev *wdev,4930u64 cookie);49314932int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,4933bool enabled, int timeout);49344935int (*set_cqm_rssi_config)(struct wiphy *wiphy,4936struct net_device *dev,4937s32 rssi_thold, u32 rssi_hyst);49384939int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,4940struct net_device *dev,4941s32 rssi_low, s32 rssi_high);49424943int (*set_cqm_txe_config)(struct wiphy *wiphy,4944struct net_device *dev,4945u32 rate, u32 pkts, u32 intvl);49464947void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,4948struct wireless_dev *wdev,4949struct mgmt_frame_regs *upd);49504951int (*set_antenna)(struct wiphy *wiphy, int radio_idx,4952u32 tx_ant, u32 rx_ant);4953int (*get_antenna)(struct wiphy *wiphy, int radio_idx,4954u32 *tx_ant, u32 *rx_ant);49554956int (*sched_scan_start)(struct wiphy *wiphy,4957struct net_device *dev,4958struct cfg80211_sched_scan_request *request);4959int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,4960u64 reqid);49614962int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,4963struct cfg80211_gtk_rekey_data *data);49644965int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,4966const u8 *peer, int link_id,4967u8 action_code, u8 dialog_token, u16 status_code,4968u32 peer_capability, bool initiator,4969const u8 *buf, size_t len);4970int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,4971const u8 *peer, enum nl80211_tdls_operation oper);49724973int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,4974const u8 *peer, u64 *cookie);49754976int (*set_noack_map)(struct wiphy *wiphy,4977struct net_device *dev,4978u16 noack_map);49794980int (*get_channel)(struct wiphy *wiphy,4981struct wireless_dev *wdev,4982unsigned int link_id,4983struct cfg80211_chan_def *chandef);49844985int (*start_p2p_device)(struct wiphy *wiphy,4986struct wireless_dev *wdev);4987void (*stop_p2p_device)(struct wiphy *wiphy,4988struct wireless_dev *wdev);49894990int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,4991const struct cfg80211_acl_data *params);49924993int (*start_radar_detection)(struct wiphy *wiphy,4994struct net_device *dev,4995struct cfg80211_chan_def *chandef,4996u32 cac_time_ms, int link_id);4997void (*end_cac)(struct wiphy *wiphy,4998struct net_device *dev, unsigned int link_id);4999int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,5000struct cfg80211_update_ft_ies_params *ftie);5001int (*crit_proto_start)(struct wiphy *wiphy,5002struct wireless_dev *wdev,5003enum nl80211_crit_proto_id protocol,5004u16 duration);5005void (*crit_proto_stop)(struct wiphy *wiphy,5006struct wireless_dev *wdev);5007int (*set_coalesce)(struct wiphy *wiphy,5008struct cfg80211_coalesce *coalesce);50095010int (*channel_switch)(struct wiphy *wiphy,5011struct net_device *dev,5012struct cfg80211_csa_settings *params);50135014int (*set_qos_map)(struct wiphy *wiphy,5015struct net_device *dev,5016struct cfg80211_qos_map *qos_map);50175018int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,5019unsigned int link_id,5020struct cfg80211_chan_def *chandef);50215022int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,5023u8 tsid, const u8 *peer, u8 user_prio,5024u16 admitted_time);5025int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,5026u8 tsid, const u8 *peer);50275028int (*tdls_channel_switch)(struct wiphy *wiphy,5029struct net_device *dev,5030const u8 *addr, u8 oper_class,5031struct cfg80211_chan_def *chandef);5032void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,5033struct net_device *dev,5034const u8 *addr);5035int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,5036struct cfg80211_nan_conf *conf);5037void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);5038int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,5039struct cfg80211_nan_func *nan_func);5040void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,5041u64 cookie);5042int (*nan_change_conf)(struct wiphy *wiphy,5043struct wireless_dev *wdev,5044struct cfg80211_nan_conf *conf,5045u32 changes);50465047int (*set_multicast_to_unicast)(struct wiphy *wiphy,5048struct net_device *dev,5049const bool enabled);50505051int (*get_txq_stats)(struct wiphy *wiphy,5052struct wireless_dev *wdev,5053struct cfg80211_txq_stats *txqstats);50545055int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,5056const struct cfg80211_pmk_conf *conf);5057int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,5058const u8 *aa);5059int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,5060struct cfg80211_external_auth_params *params);50615062int (*tx_control_port)(struct wiphy *wiphy,5063struct net_device *dev,5064const u8 *buf, size_t len,5065const u8 *dest, const __be16 proto,5066const bool noencrypt, int link_id,5067u64 *cookie);50685069int (*get_ftm_responder_stats)(struct wiphy *wiphy,5070struct net_device *dev,5071struct cfg80211_ftm_responder_stats *ftm_stats);50725073int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,5074struct cfg80211_pmsr_request *request);5075void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,5076struct cfg80211_pmsr_request *request);5077int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,5078struct cfg80211_update_owe_info *owe_info);5079int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,5080const u8 *buf, size_t len);5081int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,5082struct cfg80211_tid_config *tid_conf);5083int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,5084const u8 *peer, u8 tids);5085int (*set_sar_specs)(struct wiphy *wiphy,5086struct cfg80211_sar_specs *sar);5087int (*color_change)(struct wiphy *wiphy,5088struct net_device *dev,5089struct cfg80211_color_change_settings *params);5090int (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,5091struct cfg80211_fils_aad *fils_aad);5092int (*set_radar_background)(struct wiphy *wiphy,5093struct cfg80211_chan_def *chandef);5094int (*add_link_station)(struct wiphy *wiphy, struct net_device *dev,5095struct link_station_parameters *params);5096int (*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,5097struct link_station_parameters *params);5098int (*del_link_station)(struct wiphy *wiphy, struct net_device *dev,5099struct link_station_del_parameters *params);5100int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,5101struct cfg80211_set_hw_timestamp *hwts);5102int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,5103struct cfg80211_ttlm_params *params);5104u32 (*get_radio_mask)(struct wiphy *wiphy, struct net_device *dev);5105int (*assoc_ml_reconf)(struct wiphy *wiphy, struct net_device *dev,5106struct cfg80211_ml_reconf_req *req);5107int (*set_epcs)(struct wiphy *wiphy, struct net_device *dev,5108bool val);5109};51105111/*5112* wireless hardware and networking interfaces structures5113* and registration/helper functions5114*/51155116/**5117* enum wiphy_flags - wiphy capability flags5118*5119* @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split5120* into two, first for legacy bands and second for 6 GHz.5121* @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this5122* wiphy at all5123* @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled5124* by default -- this flag will be set depending on the kernel's default5125* on wiphy_new(), but can be changed by the driver if it has a good5126* reason to override the default5127* @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station5128* on a VLAN interface). This flag also serves an extra purpose of5129* supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.5130* @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station5131* @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the5132* control port protocol ethertype. The device also honours the5133* control_port_no_encrypt flag.5134* @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.5135* @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing5136* auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.5137* @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the5138* firmware.5139* @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.5140* @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.5141* @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)5142* link setup/discovery operations internally. Setup, discovery and5143* teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT5144* command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be5145* used for asking the driver/firmware to perform a TDLS operation.5146* @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME5147* @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes5148* when there are virtual interfaces in AP mode by calling5149* cfg80211_report_obss_beacon().5150* @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device5151* responds to probe-requests in hardware.5152* @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.5153* @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.5154* @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.5155* @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in5156* beaconing mode (AP, IBSS, Mesh, ...).5157* @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys5158* @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,5159* in order to not have them reachable in normal drivers, until we have5160* complete feature/interface combinations/etc. advertisement. No driver5161* should set this flag for now.5162* @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys.5163* @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for5164* NL80211_REGDOM_SET_BY_DRIVER.5165* @WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON: reg_call_notifier() is called if driver5166* set this flag to update channels on beacon hints.5167* @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link5168* of an NSTR mobile AP MLD.5169* @WIPHY_FLAG_DISABLE_WEXT: disable wireless extensions for this device5170*/5171enum wiphy_flags {5172WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),5173WIPHY_FLAG_SUPPORTS_MLO = BIT(1),5174WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),5175WIPHY_FLAG_NETNS_OK = BIT(3),5176WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),5177WIPHY_FLAG_4ADDR_AP = BIT(5),5178WIPHY_FLAG_4ADDR_STATION = BIT(6),5179WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),5180WIPHY_FLAG_IBSS_RSN = BIT(8),5181WIPHY_FLAG_DISABLE_WEXT = BIT(9),5182WIPHY_FLAG_MESH_AUTH = BIT(10),5183WIPHY_FLAG_SUPPORTS_EXT_KCK_32 = BIT(11),5184WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY = BIT(12),5185WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),5186WIPHY_FLAG_AP_UAPSD = BIT(14),5187WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),5188WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),5189WIPHY_FLAG_HAVE_AP_SME = BIT(17),5190WIPHY_FLAG_REPORTS_OBSS = BIT(18),5191WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),5192WIPHY_FLAG_OFFCHAN_TX = BIT(20),5193WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),5194WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),5195WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),5196WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(24),5197WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON = BIT(25),5198};51995200/**5201* struct ieee80211_iface_limit - limit on certain interface types5202* @max: maximum number of interfaces of these types5203* @types: interface types (bits)5204*/5205struct ieee80211_iface_limit {5206u16 max;5207u16 types;5208};52095210/**5211* struct ieee80211_iface_combination - possible interface combination5212*5213* With this structure the driver can describe which interface5214* combinations it supports concurrently. When set in a struct wiphy_radio,5215* the combinations refer to combinations of interfaces currently active on5216* that radio.5217*5218* Examples:5219*5220* 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:5221*5222* .. code-block:: c5223*5224* struct ieee80211_iface_limit limits1[] = {5225* { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },5226* { .max = 1, .types = BIT(NL80211_IFTYPE_AP), },5227* };5228* struct ieee80211_iface_combination combination1 = {5229* .limits = limits1,5230* .n_limits = ARRAY_SIZE(limits1),5231* .max_interfaces = 2,5232* .beacon_int_infra_match = true,5233* };5234*5235*5236* 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:5237*5238* .. code-block:: c5239*5240* struct ieee80211_iface_limit limits2[] = {5241* { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |5242* BIT(NL80211_IFTYPE_P2P_GO), },5243* };5244* struct ieee80211_iface_combination combination2 = {5245* .limits = limits2,5246* .n_limits = ARRAY_SIZE(limits2),5247* .max_interfaces = 8,5248* .num_different_channels = 1,5249* };5250*5251*5252* 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.5253*5254* This allows for an infrastructure connection and three P2P connections.5255*5256* .. code-block:: c5257*5258* struct ieee80211_iface_limit limits3[] = {5259* { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },5260* { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |5261* BIT(NL80211_IFTYPE_P2P_CLIENT), },5262* };5263* struct ieee80211_iface_combination combination3 = {5264* .limits = limits3,5265* .n_limits = ARRAY_SIZE(limits3),5266* .max_interfaces = 4,5267* .num_different_channels = 2,5268* };5269*5270*/5271struct ieee80211_iface_combination {5272/**5273* @limits:5274* limits for the given interface types5275*/5276const struct ieee80211_iface_limit *limits;52775278/**5279* @num_different_channels:5280* can use up to this many different channels5281*/5282u32 num_different_channels;52835284/**5285* @max_interfaces:5286* maximum number of interfaces in total allowed in this group5287*/5288u16 max_interfaces;52895290/**5291* @n_limits:5292* number of limitations5293*/5294u8 n_limits;52955296/**5297* @beacon_int_infra_match:5298* In this combination, the beacon intervals between infrastructure5299* and AP types must match. This is required only in special cases.5300*/5301bool beacon_int_infra_match;53025303/**5304* @radar_detect_widths:5305* bitmap of channel widths supported for radar detection5306*/5307u8 radar_detect_widths;53085309/**5310* @radar_detect_regions:5311* bitmap of regions supported for radar detection5312*/5313u8 radar_detect_regions;53145315/**5316* @beacon_int_min_gcd:5317* This interface combination supports different beacon intervals.5318*5319* = 05320* all beacon intervals for different interface must be same.5321* > 05322* any beacon interval for the interface part of this combination AND5323* GCD of all beacon intervals from beaconing interfaces of this5324* combination must be greater or equal to this value.5325*/5326u32 beacon_int_min_gcd;5327};53285329struct ieee80211_txrx_stypes {5330u16 tx, rx;5331};53325333/**5334* enum wiphy_wowlan_support_flags - WoWLAN support flags5335* @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"5336* trigger that keeps the device operating as-is and5337* wakes up the host on any activity, for example a5338* received packet that passed filtering; note that the5339* packet should be preserved in that case5340* @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet5341* (see nl80211.h)5342* @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect5343* @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep5344* @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure5345* @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request5346* @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure5347* @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release5348* @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection5349*/5350enum wiphy_wowlan_support_flags {5351WIPHY_WOWLAN_ANY = BIT(0),5352WIPHY_WOWLAN_MAGIC_PKT = BIT(1),5353WIPHY_WOWLAN_DISCONNECT = BIT(2),5354WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),5355WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),5356WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),5357WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),5358WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),5359WIPHY_WOWLAN_NET_DETECT = BIT(8),5360};53615362struct wiphy_wowlan_tcp_support {5363const struct nl80211_wowlan_tcp_data_token_feature *tok;5364u32 data_payload_max;5365u32 data_interval_max;5366u32 wake_payload_max;5367bool seq;5368};53695370/**5371* struct wiphy_wowlan_support - WoWLAN support data5372* @flags: see &enum wiphy_wowlan_support_flags5373* @n_patterns: number of supported wakeup patterns5374* (see nl80211.h for the pattern definition)5375* @pattern_max_len: maximum length of each pattern5376* @pattern_min_len: minimum length of each pattern5377* @max_pkt_offset: maximum Rx packet offset5378* @max_nd_match_sets: maximum number of matchsets for net-detect,5379* similar, but not necessarily identical, to max_match_sets for5380* scheduled scans.5381* See &struct cfg80211_sched_scan_request.@match_sets for more5382* details.5383* @tcp: TCP wakeup support information5384*/5385struct wiphy_wowlan_support {5386u32 flags;5387int n_patterns;5388int pattern_max_len;5389int pattern_min_len;5390int max_pkt_offset;5391int max_nd_match_sets;5392const struct wiphy_wowlan_tcp_support *tcp;5393};53945395/**5396* struct wiphy_coalesce_support - coalesce support data5397* @n_rules: maximum number of coalesce rules5398* @max_delay: maximum supported coalescing delay in msecs5399* @n_patterns: number of supported patterns in a rule5400* (see nl80211.h for the pattern definition)5401* @pattern_max_len: maximum length of each pattern5402* @pattern_min_len: minimum length of each pattern5403* @max_pkt_offset: maximum Rx packet offset5404*/5405struct wiphy_coalesce_support {5406int n_rules;5407int max_delay;5408int n_patterns;5409int pattern_max_len;5410int pattern_min_len;5411int max_pkt_offset;5412};54135414/**5415* enum wiphy_vendor_command_flags - validation flags for vendor commands5416* @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev5417* @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev5418* @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running5419* (must be combined with %_WDEV or %_NETDEV)5420*/5421enum wiphy_vendor_command_flags {5422WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),5423WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),5424WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),5425};54265427/**5428* enum wiphy_opmode_flag - Station's ht/vht operation mode information flags5429*5430* @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed5431* @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed5432* @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed5433*5434*/5435enum wiphy_opmode_flag {5436STA_OPMODE_MAX_BW_CHANGED = BIT(0),5437STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),5438STA_OPMODE_N_SS_CHANGED = BIT(2),5439};54405441/**5442* struct sta_opmode_info - Station's ht/vht operation mode information5443* @changed: contains value from &enum wiphy_opmode_flag5444* @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station5445* @bw: new max bandwidth value from &enum nl80211_chan_width of a station5446* @rx_nss: new rx_nss value of a station5447*/54485449struct sta_opmode_info {5450u32 changed;5451enum nl80211_smps_mode smps_mode;5452enum nl80211_chan_width bw;5453u8 rx_nss;5454};54555456#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))54575458/**5459* struct wiphy_vendor_command - vendor command definition5460* @info: vendor command identifying information, as used in nl802115461* @flags: flags, see &enum wiphy_vendor_command_flags5462* @doit: callback for the operation, note that wdev is %NULL if the5463* flags didn't ask for a wdev and non-%NULL otherwise; the data5464* pointer may be %NULL if userspace provided no data at all5465* @dumpit: dump callback, for transferring bigger/multiple items. The5466* @storage points to cb->args[5], ie. is preserved over the multiple5467* dumpit calls.5468* @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.5469* Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the5470* attribute is just raw data (e.g. a firmware command).5471* @maxattr: highest attribute number in policy5472* It's recommended to not have the same sub command with both @doit and5473* @dumpit, so that userspace can assume certain ones are get and others5474* are used with dump requests.5475*/5476struct wiphy_vendor_command {5477struct nl80211_vendor_cmd_info info;5478u32 flags;5479int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,5480const void *data, int data_len);5481int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,5482struct sk_buff *skb, const void *data, int data_len,5483unsigned long *storage);5484const struct nla_policy *policy;5485unsigned int maxattr;5486};54875488/**5489* struct wiphy_iftype_ext_capab - extended capabilities per interface type5490* @iftype: interface type5491* @extended_capabilities: extended capabilities supported by the driver,5492* additional capabilities might be supported by userspace; these are the5493* 802.11 extended capabilities ("Extended Capabilities element") and are5494* in the same format as in the information element. See IEEE Std5495* 802.11-2012 8.4.2.29 for the defined fields.5496* @extended_capabilities_mask: mask of the valid values5497* @extended_capabilities_len: length of the extended capabilities5498* @eml_capabilities: EML capabilities (for MLO)5499* @mld_capa_and_ops: MLD capabilities and operations (for MLO)5500*/5501struct wiphy_iftype_ext_capab {5502enum nl80211_iftype iftype;5503const u8 *extended_capabilities;5504const u8 *extended_capabilities_mask;5505u8 extended_capabilities_len;5506u16 eml_capabilities;5507u16 mld_capa_and_ops;5508};55095510/**5511* cfg80211_get_iftype_ext_capa - lookup interface type extended capability5512* @wiphy: the wiphy to look up from5513* @type: the interface type to look up5514*5515* Return: The extended capability for the given interface @type, may be %NULL5516*/5517const struct wiphy_iftype_ext_capab *5518cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);55195520/**5521* struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities5522* @max_peers: maximum number of peers in a single measurement5523* @report_ap_tsf: can report assoc AP's TSF for radio resource measurement5524* @randomize_mac_addr: can randomize MAC address for measurement5525* @ftm: FTM measurement data5526* @ftm.supported: FTM measurement is supported5527* @ftm.asap: ASAP-mode is supported5528* @ftm.non_asap: non-ASAP-mode is supported5529* @ftm.request_lci: can request LCI data5530* @ftm.request_civicloc: can request civic location data5531* @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)5532* @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)5533* @ftm.max_bursts_exponent: maximum burst exponent supported5534* (set to -1 if not limited; note that setting this will necessarily5535* forbid using the value 15 to let the responder pick)5536* @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if5537* not limited)5538* @ftm.trigger_based: trigger based ranging measurement is supported5539* @ftm.non_trigger_based: non trigger based ranging measurement is supported5540*/5541struct cfg80211_pmsr_capabilities {5542unsigned int max_peers;5543u8 report_ap_tsf:1,5544randomize_mac_addr:1;55455546struct {5547u32 preambles;5548u32 bandwidths;5549s8 max_bursts_exponent;5550u8 max_ftms_per_burst;5551u8 supported:1,5552asap:1,5553non_asap:1,5554request_lci:1,5555request_civicloc:1,5556trigger_based:1,5557non_trigger_based:1;5558} ftm;5559};55605561/**5562* struct wiphy_iftype_akm_suites - This structure encapsulates supported akm5563* suites for interface types defined in @iftypes_mask. Each type in the5564* @iftypes_mask must be unique across all instances of iftype_akm_suites.5565*5566* @iftypes_mask: bitmask of interfaces types5567* @akm_suites: points to an array of supported akm suites5568* @n_akm_suites: number of supported AKM suites5569*/5570struct wiphy_iftype_akm_suites {5571u16 iftypes_mask;5572const u32 *akm_suites;5573int n_akm_suites;5574};55755576/**5577* struct wiphy_radio_cfg - physical radio config of a wiphy5578* This structure describes the configurations of a physical radio in a5579* wiphy. It is used to denote per-radio attributes belonging to a wiphy.5580*5581* @rts_threshold: RTS threshold (dot11RTSThreshold);5582* -1 (default) = RTS/CTS disabled5583*/5584struct wiphy_radio_cfg {5585u32 rts_threshold;5586};55875588/**5589* struct wiphy_radio_freq_range - wiphy frequency range5590* @start_freq: start range edge frequency (kHz)5591* @end_freq: end range edge frequency (kHz)5592*/5593struct wiphy_radio_freq_range {5594u32 start_freq;5595u32 end_freq;5596};559755985599/**5600* struct wiphy_radio - physical radio of a wiphy5601* This structure describes a physical radio belonging to a wiphy.5602* It is used to describe concurrent-channel capabilities. Only one channel5603* can be active on the radio described by struct wiphy_radio.5604*5605* @freq_range: frequency range that the radio can operate on.5606* @n_freq_range: number of elements in @freq_range5607*5608* @iface_combinations: Valid interface combinations array, should not5609* list single interface types.5610* @n_iface_combinations: number of entries in @iface_combinations array.5611*5612* @antenna_mask: bitmask of antennas connected to this radio.5613*/5614struct wiphy_radio {5615const struct wiphy_radio_freq_range *freq_range;5616int n_freq_range;56175618const struct ieee80211_iface_combination *iface_combinations;5619int n_iface_combinations;56205621u32 antenna_mask;5622};56235624#define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff56255626/**5627* struct wiphy - wireless hardware description5628* @mtx: mutex for the data (structures) of this device5629* @reg_notifier: the driver's regulatory notification callback,5630* note that if your driver uses wiphy_apply_custom_regulatory()5631* the reg_notifier's request can be passed as NULL5632* @regd: the driver's regulatory domain, if one was requested via5633* the regulatory_hint() API. This can be used by the driver5634* on the reg_notifier() if it chooses to ignore future5635* regulatory domain changes caused by other drivers.5636* @signal_type: signal type reported in &struct cfg80211_bss.5637* @cipher_suites: supported cipher suites5638* @n_cipher_suites: number of supported cipher suites5639* @akm_suites: supported AKM suites. These are the default AKMs supported if5640* the supported AKMs not advertized for a specific interface type in5641* iftype_akm_suites.5642* @n_akm_suites: number of supported AKM suites5643* @iftype_akm_suites: array of supported akm suites info per interface type.5644* Note that the bits in @iftypes_mask inside this structure cannot5645* overlap (i.e. only one occurrence of each type is allowed across all5646* instances of iftype_akm_suites).5647* @num_iftype_akm_suites: number of interface types for which supported akm5648* suites are specified separately.5649* @retry_short: Retry limit for short frames (dot11ShortRetryLimit)5650* @retry_long: Retry limit for long frames (dot11LongRetryLimit)5651* @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);5652* -1 = fragmentation disabled, only odd values >= 256 used5653* @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled5654* @_net: the network namespace this wiphy currently lives in5655* @perm_addr: permanent MAC address of this device5656* @addr_mask: If the device supports multiple MAC addresses by masking,5657* set this to a mask with variable bits set to 1, e.g. if the last5658* four bits are variable then set it to 00-00-00-00-00-0f. The actual5659* variable bits shall be determined by the interfaces added, with5660* interfaces not matching the mask being rejected to be brought up.5661* @n_addresses: number of addresses in @addresses.5662* @addresses: If the device has more than one address, set this pointer5663* to a list of addresses (6 bytes each). The first one will be used5664* by default for perm_addr. In this case, the mask should be set to5665* all-zeroes. In this case it is assumed that the device can handle5666* the same number of arbitrary MAC addresses.5667* @registered: protects ->resume and ->suspend sysfs callbacks against5668* unregister hardware5669* @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).5670* It will be renamed automatically on wiphy renames5671* @dev: (virtual) struct device for this wiphy. The item in5672* /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()5673* (see below).5674* @wext: wireless extension handlers5675* @priv: driver private data (sized according to wiphy_new() parameter)5676* @interface_modes: bitmask of interfaces types valid for this wiphy,5677* must be set by driver5678* @iface_combinations: Valid interface combinations array, should not5679* list single interface types.5680* @n_iface_combinations: number of entries in @iface_combinations array.5681* @software_iftypes: bitmask of software interface types, these are not5682* subject to any restrictions since they are purely managed in SW.5683* @flags: wiphy flags, see &enum wiphy_flags5684* @regulatory_flags: wiphy regulatory flags, see5685* &enum ieee80211_regulatory_flags5686* @features: features advertised to nl80211, see &enum nl80211_feature_flags.5687* @ext_features: extended features advertised to nl80211, see5688* &enum nl80211_ext_feature_index.5689* @bss_priv_size: each BSS struct has private data allocated with it,5690* this variable determines its size5691* @max_scan_ssids: maximum number of SSIDs the device can scan for in5692* any given scan5693* @max_sched_scan_reqs: maximum number of scheduled scan requests that5694* the device can run concurrently.5695* @max_sched_scan_ssids: maximum number of SSIDs the device can scan5696* for in any given scheduled scan5697* @max_match_sets: maximum number of match sets the device can handle5698* when performing a scheduled scan, 0 if filtering is not5699* supported.5700* @max_scan_ie_len: maximum length of user-controlled IEs device can5701* add to probe request frames transmitted during a scan, must not5702* include fixed IEs like supported rates5703* @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled5704* scans5705* @max_sched_scan_plans: maximum number of scan plans (scan interval and number5706* of iterations) for scheduled scan supported by the device.5707* @max_sched_scan_plan_interval: maximum interval (in seconds) for a5708* single scan plan supported by the device.5709* @max_sched_scan_plan_iterations: maximum number of iterations for a single5710* scan plan supported by the device.5711* @coverage_class: current coverage class5712* @fw_version: firmware version for ethtool reporting5713* @hw_version: hardware version for ethtool reporting5714* @max_num_pmkids: maximum number of PMKIDs supported by device5715* @privid: a pointer that drivers can use to identify if an arbitrary5716* wiphy is theirs, e.g. in global notifiers5717* @bands: information about bands/channels supported by this device5718*5719* @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or5720* transmitted through nl80211, points to an array indexed by interface5721* type5722*5723* @available_antennas_tx: bitmap of antennas which are available to be5724* configured as TX antennas. Antenna configuration commands will be5725* rejected unless this or @available_antennas_rx is set.5726*5727* @available_antennas_rx: bitmap of antennas which are available to be5728* configured as RX antennas. Antenna configuration commands will be5729* rejected unless this or @available_antennas_tx is set.5730*5731* @probe_resp_offload:5732* Bitmap of supported protocols for probe response offloading.5733* See &enum nl80211_probe_resp_offload_support_attr. Only valid5734* when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.5735*5736* @max_remain_on_channel_duration: Maximum time a remain-on-channel operation5737* may request, if implemented.5738*5739* @wowlan: WoWLAN support information5740* @wowlan_config: current WoWLAN configuration; this should usually not be5741* used since access to it is necessarily racy, use the parameter passed5742* to the suspend() operation instead.5743*5744* @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.5745* @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.5746* If null, then none can be over-ridden.5747* @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.5748* If null, then none can be over-ridden.5749*5750* @wdev_list: the list of associated (virtual) interfaces; this list must5751* not be modified by the driver, but can be read with RTNL/RCU protection.5752*5753* @max_acl_mac_addrs: Maximum number of MAC addresses that the device5754* supports for ACL.5755*5756* @extended_capabilities: extended capabilities supported by the driver,5757* additional capabilities might be supported by userspace; these are5758* the 802.11 extended capabilities ("Extended Capabilities element")5759* and are in the same format as in the information element. See5760* 802.11-2012 8.4.2.29 for the defined fields. These are the default5761* extended capabilities to be used if the capabilities are not specified5762* for a specific interface type in iftype_ext_capab.5763* @extended_capabilities_mask: mask of the valid values5764* @extended_capabilities_len: length of the extended capabilities5765* @iftype_ext_capab: array of extended capabilities per interface type5766* @num_iftype_ext_capab: number of interface types for which extended5767* capabilities are specified separately.5768* @coalesce: packet coalescing support information5769*5770* @vendor_commands: array of vendor commands supported by the hardware5771* @n_vendor_commands: number of vendor commands5772* @vendor_events: array of vendor events supported by the hardware5773* @n_vendor_events: number of vendor events5774*5775* @max_ap_assoc_sta: maximum number of associated stations supported in AP mode5776* (including P2P GO) or 0 to indicate no such limit is advertised. The5777* driver is allowed to advertise a theoretical limit that it can reach in5778* some cases, but may not always reach.5779*5780* @max_num_csa_counters: Number of supported csa_counters in beacons5781* and probe responses. This value should be set if the driver5782* wishes to limit the number of csa counters. Default (0) means5783* infinite.5784* @bss_select_support: bitmask indicating the BSS selection criteria supported5785* by the driver in the .connect() callback. The bit position maps to the5786* attribute indices defined in &enum nl80211_bss_select_attr.5787*5788* @nan_supported_bands: bands supported by the device in NAN mode, a5789* bitmap of &enum nl80211_band values. For instance, for5790* NL80211_BAND_2GHZ, bit 0 would be set5791* (i.e. BIT(NL80211_BAND_2GHZ)).5792*5793* @txq_limit: configuration of internal TX queue frame limit5794* @txq_memory_limit: configuration internal TX queue memory limit5795* @txq_quantum: configuration of internal TX queue scheduler quantum5796*5797* @tx_queue_len: allow setting transmit queue len for drivers not using5798* wake_tx_queue5799*5800* @support_mbssid: can HW support association with nontransmitted AP5801* @support_only_he_mbssid: don't parse MBSSID elements if it is not5802* HE AP, in order to avoid compatibility issues.5803* @support_mbssid must be set for this to have any effect.5804*5805* @pmsr_capa: peer measurement capabilities5806*5807* @tid_config_support: describes the per-TID config support that the5808* device has5809* @tid_config_support.vif: bitmap of attributes (configurations)5810* supported by the driver for each vif5811* @tid_config_support.peer: bitmap of attributes (configurations)5812* supported by the driver for each peer5813* @tid_config_support.max_retry: maximum supported retry count for5814* long/short retry configuration5815*5816* @max_data_retry_count: maximum supported per TID retry count for5817* configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and5818* %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes5819* @sar_capa: SAR control capabilities5820* @rfkill: a pointer to the rfkill structure5821*5822* @mbssid_max_interfaces: maximum number of interfaces supported by the driver5823* in a multiple BSSID set. This field must be set to a non-zero value5824* by the driver to advertise MBSSID support.5825* @ema_max_profile_periodicity: maximum profile periodicity supported by5826* the driver. Setting this field to a non-zero value indicates that the5827* driver supports enhanced multi-BSSID advertisements (EMA AP).5828* @max_num_akm_suites: maximum number of AKM suites allowed for5829* configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and5830* %NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by5831* driver. If set by driver minimum allowed value is5832* NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with5833* legacy userspace and maximum allowed value is5834* CFG80211_MAX_NUM_AKM_SUITES.5835*5836* @hw_timestamp_max_peers: maximum number of peers that the driver supports5837* enabling HW timestamping for concurrently. Setting this field to a5838* non-zero value indicates that the driver supports HW timestamping.5839* A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver5840* supports enabling HW timestamping for all peers (i.e. no need to5841* specify a mac address).5842*5843* @radio_cfg: configuration of radios belonging to a muli-radio wiphy. This5844* struct contains a list of all radio specific attributes and should be5845* used only for multi-radio wiphy.5846*5847* @radio: radios belonging to this wiphy5848* @n_radio: number of radios5849*/5850struct wiphy {5851struct mutex mtx;58525853/* assign these fields before you register the wiphy */58545855u8 perm_addr[ETH_ALEN];5856u8 addr_mask[ETH_ALEN];58575858struct mac_address *addresses;58595860const struct ieee80211_txrx_stypes *mgmt_stypes;58615862const struct ieee80211_iface_combination *iface_combinations;5863int n_iface_combinations;5864u16 software_iftypes;58655866u16 n_addresses;58675868/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */5869u16 interface_modes;58705871u16 max_acl_mac_addrs;58725873u32 flags, regulatory_flags, features;5874u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];58755876u32 ap_sme_capa;58775878enum cfg80211_signal_type signal_type;58795880int bss_priv_size;5881u8 max_scan_ssids;5882u8 max_sched_scan_reqs;5883u8 max_sched_scan_ssids;5884u8 max_match_sets;5885u16 max_scan_ie_len;5886u16 max_sched_scan_ie_len;5887u32 max_sched_scan_plans;5888u32 max_sched_scan_plan_interval;5889u32 max_sched_scan_plan_iterations;58905891int n_cipher_suites;5892const u32 *cipher_suites;58935894int n_akm_suites;5895const u32 *akm_suites;58965897const struct wiphy_iftype_akm_suites *iftype_akm_suites;5898unsigned int num_iftype_akm_suites;58995900u8 retry_short;5901u8 retry_long;5902u32 frag_threshold;5903u32 rts_threshold;5904u8 coverage_class;59055906char fw_version[ETHTOOL_FWVERS_LEN];5907u32 hw_version;59085909#ifdef CONFIG_PM5910const struct wiphy_wowlan_support *wowlan;5911struct cfg80211_wowlan *wowlan_config;5912#endif59135914u16 max_remain_on_channel_duration;59155916u8 max_num_pmkids;59175918u32 available_antennas_tx;5919u32 available_antennas_rx;59205921u32 probe_resp_offload;59225923const u8 *extended_capabilities, *extended_capabilities_mask;5924u8 extended_capabilities_len;59255926const struct wiphy_iftype_ext_capab *iftype_ext_capab;5927unsigned int num_iftype_ext_capab;59285929const void *privid;59305931struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];59325933void (*reg_notifier)(struct wiphy *wiphy,5934struct regulatory_request *request);59355936struct wiphy_radio_cfg *radio_cfg;59375938/* fields below are read-only, assigned by cfg80211 */59395940const struct ieee80211_regdomain __rcu *regd;59415942struct device dev;59435944bool registered;59455946struct dentry *debugfsdir;59475948const struct ieee80211_ht_cap *ht_capa_mod_mask;5949const struct ieee80211_vht_cap *vht_capa_mod_mask;59505951struct list_head wdev_list;59525953possible_net_t _net;59545955#ifdef CONFIG_CFG80211_WEXT5956const struct iw_handler_def *wext;5957#endif59585959const struct wiphy_coalesce_support *coalesce;59605961const struct wiphy_vendor_command *vendor_commands;5962const struct nl80211_vendor_cmd_info *vendor_events;5963int n_vendor_commands, n_vendor_events;59645965u16 max_ap_assoc_sta;59665967u8 max_num_csa_counters;59685969u32 bss_select_support;59705971u8 nan_supported_bands;59725973u32 txq_limit;5974u32 txq_memory_limit;5975u32 txq_quantum;59765977unsigned long tx_queue_len;59785979u8 support_mbssid:1,5980support_only_he_mbssid:1;59815982const struct cfg80211_pmsr_capabilities *pmsr_capa;59835984struct {5985u64 peer, vif;5986u8 max_retry;5987} tid_config_support;59885989u8 max_data_retry_count;59905991const struct cfg80211_sar_capa *sar_capa;59925993struct rfkill *rfkill;59945995u8 mbssid_max_interfaces;5996u8 ema_max_profile_periodicity;5997u16 max_num_akm_suites;59985999u16 hw_timestamp_max_peers;60006001int n_radio;6002const struct wiphy_radio *radio;60036004char priv[] __aligned(NETDEV_ALIGN);6005};60066007static inline struct net *wiphy_net(struct wiphy *wiphy)6008{6009return read_pnet(&wiphy->_net);6010}60116012static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)6013{6014write_pnet(&wiphy->_net, net);6015}60166017/**6018* wiphy_priv - return priv from wiphy6019*6020* @wiphy: the wiphy whose priv pointer to return6021* Return: The priv of @wiphy.6022*/6023static inline void *wiphy_priv(struct wiphy *wiphy)6024{6025BUG_ON(!wiphy);6026return &wiphy->priv;6027}60286029/**6030* priv_to_wiphy - return the wiphy containing the priv6031*6032* @priv: a pointer previously returned by wiphy_priv6033* Return: The wiphy of @priv.6034*/6035static inline struct wiphy *priv_to_wiphy(void *priv)6036{6037BUG_ON(!priv);6038return container_of(priv, struct wiphy, priv);6039}60406041/**6042* set_wiphy_dev - set device pointer for wiphy6043*6044* @wiphy: The wiphy whose device to bind6045* @dev: The device to parent it to6046*/6047static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)6048{6049wiphy->dev.parent = dev;6050}60516052/**6053* wiphy_dev - get wiphy dev pointer6054*6055* @wiphy: The wiphy whose device struct to look up6056* Return: The dev of @wiphy.6057*/6058static inline struct device *wiphy_dev(struct wiphy *wiphy)6059{6060return wiphy->dev.parent;6061}60626063/**6064* wiphy_name - get wiphy name6065*6066* @wiphy: The wiphy whose name to return6067* Return: The name of @wiphy.6068*/6069static inline const char *wiphy_name(const struct wiphy *wiphy)6070{6071return dev_name(&wiphy->dev);6072}60736074/**6075* wiphy_new_nm - create a new wiphy for use with cfg802116076*6077* @ops: The configuration operations for this device6078* @sizeof_priv: The size of the private area to allocate6079* @requested_name: Request a particular name.6080* NULL is valid value, and means use the default phy%d naming.6081*6082* Create a new wiphy and associate the given operations with it.6083* @sizeof_priv bytes are allocated for private use.6084*6085* Return: A pointer to the new wiphy. This pointer must be6086* assigned to each netdev's ieee80211_ptr for proper operation.6087*/6088struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,6089const char *requested_name);60906091/**6092* wiphy_new - create a new wiphy for use with cfg802116093*6094* @ops: The configuration operations for this device6095* @sizeof_priv: The size of the private area to allocate6096*6097* Create a new wiphy and associate the given operations with it.6098* @sizeof_priv bytes are allocated for private use.6099*6100* Return: A pointer to the new wiphy. This pointer must be6101* assigned to each netdev's ieee80211_ptr for proper operation.6102*/6103static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,6104int sizeof_priv)6105{6106return wiphy_new_nm(ops, sizeof_priv, NULL);6107}61086109/**6110* wiphy_register - register a wiphy with cfg802116111*6112* @wiphy: The wiphy to register.6113*6114* Return: A non-negative wiphy index or a negative error code.6115*/6116int wiphy_register(struct wiphy *wiphy);61176118/* this is a define for better error reporting (file/line) */6119#define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)61206121/**6122* rcu_dereference_wiphy - rcu_dereference with debug checking6123* @wiphy: the wiphy to check the locking on6124* @p: The pointer to read, prior to dereferencing6125*6126* Do an rcu_dereference(p), but check caller either holds rcu_read_lock()6127* or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().6128*/6129#define rcu_dereference_wiphy(wiphy, p) \6130rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))61316132/**6133* wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx6134* @wiphy: the wiphy to check the locking on6135* @p: The pointer to read, prior to dereferencing6136*6137* Return: the value of the specified RCU-protected pointer, but omit the6138* READ_ONCE(), because caller holds the wiphy mutex used for updates.6139*/6140#define wiphy_dereference(wiphy, p) \6141rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))61426143/**6144* get_wiphy_regdom - get custom regdomain for the given wiphy6145* @wiphy: the wiphy to get the regdomain from6146*6147* Context: Requires any of RTNL, wiphy mutex or RCU protection.6148*6149* Return: pointer to the regulatory domain associated with the wiphy6150*/6151const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);61526153/**6154* wiphy_unregister - deregister a wiphy from cfg802116155*6156* @wiphy: The wiphy to unregister.6157*6158* After this call, no more requests can be made with this priv6159* pointer, but the call may sleep to wait for an outstanding6160* request that is being handled.6161*/6162void wiphy_unregister(struct wiphy *wiphy);61636164/**6165* wiphy_free - free wiphy6166*6167* @wiphy: The wiphy to free6168*/6169void wiphy_free(struct wiphy *wiphy);61706171/* internal structs */6172struct cfg80211_conn;6173struct cfg80211_internal_bss;6174struct cfg80211_cached_keys;6175struct cfg80211_cqm_config;61766177/**6178* wiphy_lock - lock the wiphy6179* @wiphy: the wiphy to lock6180*6181* This is needed around registering and unregistering netdevs that6182* aren't created through cfg80211 calls, since that requires locking6183* in cfg80211 when the notifiers is called, but that cannot6184* differentiate which way it's called.6185*6186* It can also be used by drivers for their own purposes.6187*6188* When cfg80211 ops are called, the wiphy is already locked.6189*6190* Note that this makes sure that no workers that have been queued6191* with wiphy_queue_work() are running.6192*/6193static inline void wiphy_lock(struct wiphy *wiphy)6194__acquires(&wiphy->mtx)6195{6196mutex_lock(&wiphy->mtx);6197__acquire(&wiphy->mtx);6198}61996200/**6201* wiphy_unlock - unlock the wiphy again6202* @wiphy: the wiphy to unlock6203*/6204static inline void wiphy_unlock(struct wiphy *wiphy)6205__releases(&wiphy->mtx)6206{6207__release(&wiphy->mtx);6208mutex_unlock(&wiphy->mtx);6209}62106211DEFINE_GUARD(wiphy, struct wiphy *,6212mutex_lock(&_T->mtx),6213mutex_unlock(&_T->mtx))62146215struct wiphy_work;6216typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *);62176218struct wiphy_work {6219struct list_head entry;6220wiphy_work_func_t func;6221};62226223static inline void wiphy_work_init(struct wiphy_work *work,6224wiphy_work_func_t func)6225{6226INIT_LIST_HEAD(&work->entry);6227work->func = func;6228}62296230/**6231* wiphy_work_queue - queue work for the wiphy6232* @wiphy: the wiphy to queue for6233* @work: the work item6234*6235* This is useful for work that must be done asynchronously, and work6236* queued here has the special property that the wiphy mutex will be6237* held as if wiphy_lock() was called, and that it cannot be running6238* after wiphy_lock() was called. Therefore, wiphy_cancel_work() can6239* use just cancel_work() instead of cancel_work_sync(), it requires6240* being in a section protected by wiphy_lock().6241*/6242void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work);62436244/**6245* wiphy_work_cancel - cancel previously queued work6246* @wiphy: the wiphy, for debug purposes6247* @work: the work to cancel6248*6249* Cancel the work *without* waiting for it, this assumes being6250* called under the wiphy mutex acquired by wiphy_lock().6251*/6252void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work);62536254/**6255* wiphy_work_flush - flush previously queued work6256* @wiphy: the wiphy, for debug purposes6257* @work: the work to flush, this can be %NULL to flush all work6258*6259* Flush the work (i.e. run it if pending). This must be called6260* under the wiphy mutex acquired by wiphy_lock().6261*/6262void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work);62636264struct wiphy_delayed_work {6265struct wiphy_work work;6266struct wiphy *wiphy;6267struct timer_list timer;6268};62696270void wiphy_delayed_work_timer(struct timer_list *t);62716272static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork,6273wiphy_work_func_t func)6274{6275timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0);6276wiphy_work_init(&dwork->work, func);6277}62786279/**6280* wiphy_delayed_work_queue - queue delayed work for the wiphy6281* @wiphy: the wiphy to queue for6282* @dwork: the delayable worker6283* @delay: number of jiffies to wait before queueing6284*6285* This is useful for work that must be done asynchronously, and work6286* queued here has the special property that the wiphy mutex will be6287* held as if wiphy_lock() was called, and that it cannot be running6288* after wiphy_lock() was called. Therefore, wiphy_cancel_work() can6289* use just cancel_work() instead of cancel_work_sync(), it requires6290* being in a section protected by wiphy_lock().6291*/6292void wiphy_delayed_work_queue(struct wiphy *wiphy,6293struct wiphy_delayed_work *dwork,6294unsigned long delay);62956296/**6297* wiphy_delayed_work_cancel - cancel previously queued delayed work6298* @wiphy: the wiphy, for debug purposes6299* @dwork: the delayed work to cancel6300*6301* Cancel the work *without* waiting for it, this assumes being6302* called under the wiphy mutex acquired by wiphy_lock().6303*/6304void wiphy_delayed_work_cancel(struct wiphy *wiphy,6305struct wiphy_delayed_work *dwork);63066307/**6308* wiphy_delayed_work_flush - flush previously queued delayed work6309* @wiphy: the wiphy, for debug purposes6310* @dwork: the delayed work to flush6311*6312* Flush the work (i.e. run it if pending). This must be called6313* under the wiphy mutex acquired by wiphy_lock().6314*/6315void wiphy_delayed_work_flush(struct wiphy *wiphy,6316struct wiphy_delayed_work *dwork);63176318/**6319* wiphy_delayed_work_pending - Find out whether a wiphy delayable6320* work item is currently pending.6321*6322* @wiphy: the wiphy, for debug purposes6323* @dwork: the delayed work in question6324*6325* Return: true if timer is pending, false otherwise6326*6327* How wiphy_delayed_work_queue() works is by setting a timer which6328* when it expires calls wiphy_work_queue() to queue the wiphy work.6329* Because wiphy_delayed_work_queue() uses mod_timer(), if it is6330* called twice and the second call happens before the first call6331* deadline, the work will rescheduled for the second deadline and6332* won't run before that.6333*6334* wiphy_delayed_work_pending() can be used to detect if calling6335* wiphy_work_delayed_work_queue() would start a new work schedule6336* or delayed a previous one. As seen below it cannot be used to6337* detect precisely if the work has finished to execute nor if it6338* is currently executing.6339*6340* CPU0 CPU16341* wiphy_delayed_work_queue(wk)6342* mod_timer(wk->timer)6343* wiphy_delayed_work_pending(wk) -> true6344*6345* [...]6346* expire_timers(wk->timer)6347* detach_timer(wk->timer)6348* wiphy_delayed_work_pending(wk) -> false6349* wk->timer->function() |6350* wiphy_work_queue(wk) | delayed work pending6351* list_add_tail() | returns false but6352* queue_work(cfg80211_wiphy_work) | wk->func() has not6353* | been run yet6354* [...] |6355* cfg80211_wiphy_work() |6356* wk->func() V6357*6358*/6359bool wiphy_delayed_work_pending(struct wiphy *wiphy,6360struct wiphy_delayed_work *dwork);63616362/**6363* enum ieee80211_ap_reg_power - regulatory power for an Access Point6364*6365* @IEEE80211_REG_UNSET_AP: Access Point has no regulatory power mode6366* @IEEE80211_REG_LPI_AP: Indoor Access Point6367* @IEEE80211_REG_SP_AP: Standard power Access Point6368* @IEEE80211_REG_VLP_AP: Very low power Access Point6369*/6370enum ieee80211_ap_reg_power {6371IEEE80211_REG_UNSET_AP,6372IEEE80211_REG_LPI_AP,6373IEEE80211_REG_SP_AP,6374IEEE80211_REG_VLP_AP,6375};63766377/**6378* struct wireless_dev - wireless device state6379*6380* For netdevs, this structure must be allocated by the driver6381* that uses the ieee80211_ptr field in struct net_device (this6382* is intentional so it can be allocated along with the netdev.)6383* It need not be registered then as netdev registration will6384* be intercepted by cfg80211 to see the new wireless device,6385* however, drivers must lock the wiphy before registering or6386* unregistering netdevs if they pre-create any netdevs (in ops6387* called from cfg80211, the wiphy is already locked.)6388*6389* For non-netdev uses, it must also be allocated by the driver6390* in response to the cfg80211 callbacks that require it, as6391* there's no netdev registration in that case it may not be6392* allocated outside of callback operations that return it.6393*6394* @wiphy: pointer to hardware description6395* @iftype: interface type6396* @registered: is this wdev already registered with cfg802116397* @registering: indicates we're doing registration under wiphy lock6398* for the notifier6399* @list: (private) Used to collect the interfaces6400* @netdev: (private) Used to reference back to the netdev, may be %NULL6401* @identifier: (private) Identifier used in nl80211 to identify this6402* wireless device if it has no netdev6403* @u: union containing data specific to @iftype6404* @connected: indicates if connected or not (STA mode)6405* @wext: (private) Used by the internal wireless extensions compat code6406* @wext.ibss: (private) IBSS data part of wext handling6407* @wext.connect: (private) connection handling data6408* @wext.keys: (private) (WEP) key data6409* @wext.ie: (private) extra elements for association6410* @wext.ie_len: (private) length of extra elements6411* @wext.bssid: (private) selected network BSSID6412* @wext.ssid: (private) selected network SSID6413* @wext.default_key: (private) selected default key index6414* @wext.default_mgmt_key: (private) selected default management key index6415* @wext.prev_bssid: (private) previous BSSID for reassociation6416* @wext.prev_bssid_valid: (private) previous BSSID validity6417* @use_4addr: indicates 4addr mode is used on this interface, must be6418* set by driver (if supported) on add_interface BEFORE registering the6419* netdev and may otherwise be used by driver read-only, will be update6420* by cfg80211 on change_interface6421* @mgmt_registrations: list of registrations for management frames6422* @mgmt_registrations_need_update: mgmt registrations were updated,6423* need to propagate the update to the driver6424* @address: The address for this device, valid only if @netdev is %NULL6425* @is_running: true if this is a non-netdev device that has been started, e.g.6426* the P2P Device.6427* @ps: powersave mode is enabled6428* @ps_timeout: dynamic powersave timeout6429* @ap_unexpected_nlportid: (private) netlink port ID of application6430* registered for unexpected class 3 frames (AP mode)6431* @conn: (private) cfg80211 software SME connection state machine data6432* @connect_keys: (private) keys to set after connection is established6433* @conn_bss_type: connecting/connected BSS type6434* @conn_owner_nlportid: (private) connection owner socket port ID6435* @disconnect_wk: (private) auto-disconnect work6436* @disconnect_bssid: (private) the BSSID to use for auto-disconnect6437* @event_list: (private) list for internal event processing6438* @event_lock: (private) lock for event list6439* @owner_nlportid: (private) owner socket port ID6440* @nl_owner_dead: (private) owner socket went away6441* @cqm_rssi_work: (private) CQM RSSI reporting work6442* @cqm_config: (private) nl80211 RSSI monitor state6443* @pmsr_list: (private) peer measurement requests6444* @pmsr_lock: (private) peer measurements requests/results lock6445* @pmsr_free_wk: (private) peer measurements cleanup work6446* @unprot_beacon_reported: (private) timestamp of last6447* unprotected beacon report6448* @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr6449* @ap and @client for each link6450* @links.cac_started: true if DFS channel availability check has been6451* started6452* @links.cac_start_time: timestamp (jiffies) when the dfs state was6453* entered.6454* @links.cac_time_ms: CAC time in ms6455* @valid_links: bitmap describing what elements of @links are valid6456* @radio_mask: Bitmask of radios that this interface is allowed to operate on.6457*/6458struct wireless_dev {6459struct wiphy *wiphy;6460enum nl80211_iftype iftype;64616462/* the remainder of this struct should be private to cfg80211 */6463struct list_head list;6464struct net_device *netdev;64656466u32 identifier;64676468struct list_head mgmt_registrations;6469u8 mgmt_registrations_need_update:1;64706471bool use_4addr, is_running, registered, registering;64726473u8 address[ETH_ALEN] __aligned(sizeof(u16));64746475/* currently used for IBSS and SME - might be rearranged later */6476struct cfg80211_conn *conn;6477struct cfg80211_cached_keys *connect_keys;6478enum ieee80211_bss_type conn_bss_type;6479u32 conn_owner_nlportid;64806481struct work_struct disconnect_wk;6482u8 disconnect_bssid[ETH_ALEN];64836484struct list_head event_list;6485spinlock_t event_lock;64866487u8 connected:1;64886489bool ps;6490int ps_timeout;64916492u32 ap_unexpected_nlportid;64936494u32 owner_nlportid;6495bool nl_owner_dead;64966497#ifdef CONFIG_CFG80211_WEXT6498/* wext data */6499struct {6500struct cfg80211_ibss_params ibss;6501struct cfg80211_connect_params connect;6502struct cfg80211_cached_keys *keys;6503const u8 *ie;6504size_t ie_len;6505u8 bssid[ETH_ALEN];6506u8 prev_bssid[ETH_ALEN];6507u8 ssid[IEEE80211_MAX_SSID_LEN];6508s8 default_key, default_mgmt_key;6509bool prev_bssid_valid;6510} wext;6511#endif65126513struct wiphy_work cqm_rssi_work;6514struct cfg80211_cqm_config __rcu *cqm_config;65156516struct list_head pmsr_list;6517spinlock_t pmsr_lock;6518struct work_struct pmsr_free_wk;65196520unsigned long unprot_beacon_reported;65216522union {6523struct {6524u8 connected_addr[ETH_ALEN] __aligned(2);6525u8 ssid[IEEE80211_MAX_SSID_LEN];6526u8 ssid_len;6527} client;6528struct {6529int beacon_interval;6530struct cfg80211_chan_def preset_chandef;6531struct cfg80211_chan_def chandef;6532u8 id[IEEE80211_MAX_MESH_ID_LEN];6533u8 id_len, id_up_len;6534} mesh;6535struct {6536struct cfg80211_chan_def preset_chandef;6537u8 ssid[IEEE80211_MAX_SSID_LEN];6538u8 ssid_len;6539} ap;6540struct {6541struct cfg80211_internal_bss *current_bss;6542struct cfg80211_chan_def chandef;6543int beacon_interval;6544u8 ssid[IEEE80211_MAX_SSID_LEN];6545u8 ssid_len;6546} ibss;6547struct {6548struct cfg80211_chan_def chandef;6549} ocb;6550} u;65516552struct {6553u8 addr[ETH_ALEN] __aligned(2);6554union {6555struct {6556unsigned int beacon_interval;6557struct cfg80211_chan_def chandef;6558} ap;6559struct {6560struct cfg80211_internal_bss *current_bss;6561} client;6562};65636564bool cac_started;6565unsigned long cac_start_time;6566unsigned int cac_time_ms;6567} links[IEEE80211_MLD_MAX_NUM_LINKS];6568u16 valid_links;65696570u32 radio_mask;6571};65726573static inline const u8 *wdev_address(struct wireless_dev *wdev)6574{6575if (wdev->netdev)6576return wdev->netdev->dev_addr;6577return wdev->address;6578}65796580static inline bool wdev_running(struct wireless_dev *wdev)6581{6582if (wdev->netdev)6583return netif_running(wdev->netdev);6584return wdev->is_running;6585}65866587/**6588* wdev_priv - return wiphy priv from wireless_dev6589*6590* @wdev: The wireless device whose wiphy's priv pointer to return6591* Return: The wiphy priv of @wdev.6592*/6593static inline void *wdev_priv(struct wireless_dev *wdev)6594{6595BUG_ON(!wdev);6596return wiphy_priv(wdev->wiphy);6597}65986599/**6600* wdev_chandef - return chandef pointer from wireless_dev6601* @wdev: the wdev6602* @link_id: the link ID for MLO6603*6604* Return: The chandef depending on the mode, or %NULL.6605*/6606struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,6607unsigned int link_id);66086609static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,6610unsigned int link_id)6611{6612WARN_ON(link_id && !wdev->valid_links);6613WARN_ON(wdev->valid_links &&6614!(wdev->valid_links & BIT(link_id)));6615}66166617#define for_each_valid_link(link_info, link_id) \6618for (link_id = 0; \6619link_id < ((link_info)->valid_links ? \6620ARRAY_SIZE((link_info)->links) : 1); \6621link_id++) \6622if (!(link_info)->valid_links || \6623((link_info)->valid_links & BIT(link_id)))66246625/**6626* DOC: Utility functions6627*6628* cfg80211 offers a number of utility functions that can be useful.6629*/66306631/**6632* ieee80211_channel_equal - compare two struct ieee80211_channel6633*6634* @a: 1st struct ieee80211_channel6635* @b: 2nd struct ieee80211_channel6636* Return: true if center frequency of @a == @b6637*/6638static inline bool6639ieee80211_channel_equal(struct ieee80211_channel *a,6640struct ieee80211_channel *b)6641{6642return (a->center_freq == b->center_freq &&6643a->freq_offset == b->freq_offset);6644}66456646/**6647* ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz6648* @chan: struct ieee80211_channel to convert6649* Return: The corresponding frequency (in KHz)6650*/6651static inline u326652ieee80211_channel_to_khz(const struct ieee80211_channel *chan)6653{6654return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;6655}66566657/**6658* ieee80211_s1g_channel_width - get allowed channel width from @chan6659*6660* Only allowed for band NL80211_BAND_S1GHZ6661* @chan: channel6662* Return: The allowed channel width for this center_freq6663*/6664enum nl80211_chan_width6665ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);66666667/**6668* ieee80211_channel_to_freq_khz - convert channel number to frequency6669* @chan: channel number6670* @band: band, necessary due to channel number overlap6671* Return: The corresponding frequency (in KHz), or 0 if the conversion failed.6672*/6673u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);66746675/**6676* ieee80211_channel_to_frequency - convert channel number to frequency6677* @chan: channel number6678* @band: band, necessary due to channel number overlap6679* Return: The corresponding frequency (in MHz), or 0 if the conversion failed.6680*/6681static inline int6682ieee80211_channel_to_frequency(int chan, enum nl80211_band band)6683{6684return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));6685}66866687/**6688* ieee80211_freq_khz_to_channel - convert frequency to channel number6689* @freq: center frequency in KHz6690* Return: The corresponding channel, or 0 if the conversion failed.6691*/6692int ieee80211_freq_khz_to_channel(u32 freq);66936694/**6695* ieee80211_frequency_to_channel - convert frequency to channel number6696* @freq: center frequency in MHz6697* Return: The corresponding channel, or 0 if the conversion failed.6698*/6699static inline int6700ieee80211_frequency_to_channel(int freq)6701{6702return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));6703}67046705/**6706* ieee80211_get_channel_khz - get channel struct from wiphy for specified6707* frequency6708* @wiphy: the struct wiphy to get the channel for6709* @freq: the center frequency (in KHz) of the channel6710* Return: The channel struct from @wiphy at @freq.6711*/6712struct ieee80211_channel *6713ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);67146715/**6716* ieee80211_get_channel - get channel struct from wiphy for specified frequency6717*6718* @wiphy: the struct wiphy to get the channel for6719* @freq: the center frequency (in MHz) of the channel6720* Return: The channel struct from @wiphy at @freq.6721*/6722static inline struct ieee80211_channel *6723ieee80211_get_channel(struct wiphy *wiphy, int freq)6724{6725return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));6726}67276728/**6729* cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC6730* @chan: control channel to check6731*6732* The Preferred Scanning Channels (PSC) are defined in6733* Draft IEEE P802.11ax/D5.0, 26.17.2.3.36734*6735* Return: %true if channel is a PSC, %false otherwise6736*/6737static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)6738{6739if (chan->band != NL80211_BAND_6GHZ)6740return false;67416742return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;6743}67446745/**6746* cfg80211_radio_chandef_valid - Check if the radio supports the chandef6747*6748* @radio: wiphy radio6749* @chandef: chandef for current channel6750*6751* Return: whether or not the given chandef is valid for the given radio6752*/6753bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio,6754const struct cfg80211_chan_def *chandef);67556756/**6757* cfg80211_wdev_channel_allowed - Check if the wdev may use the channel6758*6759* @wdev: the wireless device6760* @chan: channel to check6761*6762* Return: whether or not the wdev may use the channel6763*/6764bool cfg80211_wdev_channel_allowed(struct wireless_dev *wdev,6765struct ieee80211_channel *chan);67666767/**6768* ieee80211_get_response_rate - get basic rate for a given rate6769*6770* @sband: the band to look for rates in6771* @basic_rates: bitmap of basic rates6772* @bitrate: the bitrate for which to find the basic rate6773*6774* Return: The basic rate corresponding to a given bitrate, that6775* is the next lower bitrate contained in the basic rate map,6776* which is, for this function, given as a bitmap of indices of6777* rates in the band's bitrate table.6778*/6779const struct ieee80211_rate *6780ieee80211_get_response_rate(struct ieee80211_supported_band *sband,6781u32 basic_rates, int bitrate);67826783/**6784* ieee80211_mandatory_rates - get mandatory rates for a given band6785* @sband: the band to look for rates in6786*6787* Return: a bitmap of the mandatory rates for the given band, bits6788* are set according to the rate position in the bitrates array.6789*/6790u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband);67916792/*6793* Radiotap parsing functions -- for controlled injection support6794*6795* Implemented in net/wireless/radiotap.c6796* Documentation in Documentation/networking/radiotap-headers.rst6797*/67986799struct radiotap_align_size {6800uint8_t align:4, size:4;6801};68026803struct ieee80211_radiotap_namespace {6804const struct radiotap_align_size *align_size;6805int n_bits;6806uint32_t oui;6807uint8_t subns;6808};68096810struct ieee80211_radiotap_vendor_namespaces {6811const struct ieee80211_radiotap_namespace *ns;6812int n_ns;6813};68146815/**6816* struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args6817* @this_arg_index: index of current arg, valid after each successful call6818* to ieee80211_radiotap_iterator_next()6819* @this_arg: pointer to current radiotap arg; it is valid after each6820* call to ieee80211_radiotap_iterator_next() but also after6821* ieee80211_radiotap_iterator_init() where it will point to6822* the beginning of the actual data portion6823* @this_arg_size: length of the current arg, for convenience6824* @current_namespace: pointer to the current namespace definition6825* (or internally %NULL if the current namespace is unknown)6826* @is_radiotap_ns: indicates whether the current namespace is the default6827* radiotap namespace or not6828*6829* @_rtheader: pointer to the radiotap header we are walking through6830* @_max_length: length of radiotap header in cpu byte ordering6831* @_arg_index: next argument index6832* @_arg: next argument pointer6833* @_next_bitmap: internal pointer to next present u326834* @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present6835* @_vns: vendor namespace definitions6836* @_next_ns_data: beginning of the next namespace's data6837* @_reset_on_ext: internal; reset the arg index to 0 when going to the6838* next bitmap word6839*6840* Describes the radiotap parser state. Fields prefixed with an underscore6841* must not be used by users of the parser, only by the parser internally.6842*/68436844struct ieee80211_radiotap_iterator {6845struct ieee80211_radiotap_header *_rtheader;6846const struct ieee80211_radiotap_vendor_namespaces *_vns;6847const struct ieee80211_radiotap_namespace *current_namespace;68486849unsigned char *_arg, *_next_ns_data;6850__le32 *_next_bitmap;68516852unsigned char *this_arg;6853int this_arg_index;6854int this_arg_size;68556856int is_radiotap_ns;68576858int _max_length;6859int _arg_index;6860uint32_t _bitmap_shifter;6861int _reset_on_ext;6862};68636864int6865ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,6866struct ieee80211_radiotap_header *radiotap_header,6867int max_length,6868const struct ieee80211_radiotap_vendor_namespaces *vns);68696870int6871ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);687268736874extern const unsigned char rfc1042_header[6];6875extern const unsigned char bridge_tunnel_header[6];68766877/**6878* ieee80211_get_hdrlen_from_skb - get header length from data6879*6880* @skb: the frame6881*6882* Given an skb with a raw 802.11 header at the data pointer this function6883* returns the 802.11 header length.6884*6885* Return: The 802.11 header length in bytes (not including encryption6886* headers). Or 0 if the data in the sk_buff is too short to contain a valid6887* 802.11 header.6888*/6889unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);68906891/**6892* ieee80211_hdrlen - get header length in bytes from frame control6893* @fc: frame control field in little-endian format6894* Return: The header length in bytes.6895*/6896unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);68976898/**6899* ieee80211_get_mesh_hdrlen - get mesh extension header length6900* @meshhdr: the mesh extension header, only the flags field6901* (first byte) will be accessed6902* Return: The length of the extension header, which is always at6903* least 6 bytes and at most 18 if address 5 and 6 are present.6904*/6905unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);69066907/**6908* DOC: Data path helpers6909*6910* In addition to generic utilities, cfg80211 also offers6911* functions that help implement the data path for devices6912* that do not do the 802.11/802.3 conversion on the device.6913*/69146915/**6916* ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.36917* @skb: the 802.11 data frame6918* @ehdr: pointer to a &struct ethhdr that will get the header, instead6919* of it being pushed into the SKB6920* @addr: the device MAC address6921* @iftype: the virtual interface type6922* @data_offset: offset of payload after the 802.11 header6923* @is_amsdu: true if the 802.11 header is A-MSDU6924* Return: 0 on success. Non-zero on error.6925*/6926int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,6927const u8 *addr, enum nl80211_iftype iftype,6928u8 data_offset, bool is_amsdu);69296930/**6931* ieee80211_data_to_8023 - convert an 802.11 data frame to 802.36932* @skb: the 802.11 data frame6933* @addr: the device MAC address6934* @iftype: the virtual interface type6935* Return: 0 on success. Non-zero on error.6936*/6937static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,6938enum nl80211_iftype iftype)6939{6940return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);6941}69426943/**6944* ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid6945*6946* This is used to detect non-standard A-MSDU frames, e.g. the ones generated6947* by ath10k and ath11k, where the subframe length includes the length of the6948* mesh control field.6949*6950* @skb: The input A-MSDU frame without any headers.6951* @mesh_hdr: the type of mesh header to test6952* 0: non-mesh A-MSDU length field6953* 1: big-endian mesh A-MSDU length field6954* 2: little-endian mesh A-MSDU length field6955* Returns: true if subframe header lengths are valid for the @mesh_hdr mode6956*/6957bool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr);69586959/**6960* ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame6961*6962* Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.6963* The @list will be empty if the decode fails. The @skb must be fully6964* header-less before being passed in here; it is freed in this function.6965*6966* @skb: The input A-MSDU frame without any headers.6967* @list: The output list of 802.3 frames. It must be allocated and6968* initialized by the caller.6969* @addr: The device MAC address.6970* @iftype: The device interface type.6971* @extra_headroom: The hardware extra headroom for SKBs in the @list.6972* @check_da: DA to check in the inner ethernet header, or NULL6973* @check_sa: SA to check in the inner ethernet header, or NULL6974* @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu6975*/6976void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,6977const u8 *addr, enum nl80211_iftype iftype,6978const unsigned int extra_headroom,6979const u8 *check_da, const u8 *check_sa,6980u8 mesh_control);69816982/**6983* ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol6984*6985* Check for RFC1042 or bridge tunnel header and fetch the encapsulated6986* protocol.6987*6988* @hdr: pointer to the MSDU payload6989* @proto: destination pointer to store the protocol6990* Return: true if encapsulation was found6991*/6992bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto);69936994/**6995* ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames6996*6997* Strip the mesh header, which was left in by ieee80211_data_to_8023 as part6998* of the MSDU data. Also move any source/destination addresses from the mesh6999* header to the ethernet header (if present).7000*7001* @skb: The 802.3 frame with embedded mesh header7002*7003* Return: 0 on success. Non-zero on error.7004*/7005int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb);70067007/**7008* cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame7009* @skb: the data frame7010* @qos_map: Interworking QoS mapping or %NULL if not in use7011* Return: The 802.1p/1d tag.7012*/7013unsigned int cfg80211_classify8021d(struct sk_buff *skb,7014struct cfg80211_qos_map *qos_map);70157016/**7017* cfg80211_find_elem_match - match information element and byte array in data7018*7019* @eid: element ID7020* @ies: data consisting of IEs7021* @len: length of data7022* @match: byte array to match7023* @match_len: number of bytes in the match array7024* @match_offset: offset in the IE data where the byte array should match.7025* Note the difference to cfg80211_find_ie_match() which considers7026* the offset to start from the element ID byte, but here we take7027* the data portion instead.7028*7029* Return: %NULL if the element ID could not be found or if7030* the element is invalid (claims to be longer than the given7031* data) or if the byte array doesn't match; otherwise return the7032* requested element struct.7033*7034* Note: There are no checks on the element length other than7035* having to fit into the given data and being large enough for the7036* byte array to match.7037*/7038const struct element *7039cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,7040const u8 *match, unsigned int match_len,7041unsigned int match_offset);70427043/**7044* cfg80211_find_ie_match - match information element and byte array in data7045*7046* @eid: element ID7047* @ies: data consisting of IEs7048* @len: length of data7049* @match: byte array to match7050* @match_len: number of bytes in the match array7051* @match_offset: offset in the IE where the byte array should match.7052* If match_len is zero, this must also be set to zero.7053* Otherwise this must be set to 2 or more, because the first7054* byte is the element id, which is already compared to eid, and7055* the second byte is the IE length.7056*7057* Return: %NULL if the element ID could not be found or if7058* the element is invalid (claims to be longer than the given7059* data) or if the byte array doesn't match, or a pointer to the first7060* byte of the requested element, that is the byte containing the7061* element ID.7062*7063* Note: There are no checks on the element length other than7064* having to fit into the given data and being large enough for the7065* byte array to match.7066*/7067static inline const u8 *7068cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,7069const u8 *match, unsigned int match_len,7070unsigned int match_offset)7071{7072/* match_offset can't be smaller than 2, unless match_len is7073* zero, in which case match_offset must be zero as well.7074*/7075if (WARN_ON((match_len && match_offset < 2) ||7076(!match_len && match_offset)))7077return NULL;70787079return (const void *)cfg80211_find_elem_match(eid, ies, len,7080match, match_len,7081match_offset ?7082match_offset - 2 : 0);7083}70847085/**7086* cfg80211_find_elem - find information element in data7087*7088* @eid: element ID7089* @ies: data consisting of IEs7090* @len: length of data7091*7092* Return: %NULL if the element ID could not be found or if7093* the element is invalid (claims to be longer than the given7094* data) or if the byte array doesn't match; otherwise return the7095* requested element struct.7096*7097* Note: There are no checks on the element length other than7098* having to fit into the given data.7099*/7100static inline const struct element *7101cfg80211_find_elem(u8 eid, const u8 *ies, int len)7102{7103return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);7104}71057106/**7107* cfg80211_find_ie - find information element in data7108*7109* @eid: element ID7110* @ies: data consisting of IEs7111* @len: length of data7112*7113* Return: %NULL if the element ID could not be found or if7114* the element is invalid (claims to be longer than the given7115* data), or a pointer to the first byte of the requested7116* element, that is the byte containing the element ID.7117*7118* Note: There are no checks on the element length other than7119* having to fit into the given data.7120*/7121static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)7122{7123return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);7124}71257126/**7127* cfg80211_find_ext_elem - find information element with EID Extension in data7128*7129* @ext_eid: element ID Extension7130* @ies: data consisting of IEs7131* @len: length of data7132*7133* Return: %NULL if the extended element could not be found or if7134* the element is invalid (claims to be longer than the given7135* data) or if the byte array doesn't match; otherwise return the7136* requested element struct.7137*7138* Note: There are no checks on the element length other than7139* having to fit into the given data.7140*/7141static inline const struct element *7142cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)7143{7144return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,7145&ext_eid, 1, 0);7146}71477148/**7149* cfg80211_find_ext_ie - find information element with EID Extension in data7150*7151* @ext_eid: element ID Extension7152* @ies: data consisting of IEs7153* @len: length of data7154*7155* Return: %NULL if the extended element ID could not be found or if7156* the element is invalid (claims to be longer than the given7157* data), or a pointer to the first byte of the requested7158* element, that is the byte containing the element ID.7159*7160* Note: There are no checks on the element length other than7161* having to fit into the given data.7162*/7163static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)7164{7165return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,7166&ext_eid, 1, 2);7167}71687169/**7170* cfg80211_find_vendor_elem - find vendor specific information element in data7171*7172* @oui: vendor OUI7173* @oui_type: vendor-specific OUI type (must be < 0xff), negative means any7174* @ies: data consisting of IEs7175* @len: length of data7176*7177* Return: %NULL if the vendor specific element ID could not be found or if the7178* element is invalid (claims to be longer than the given data); otherwise7179* return the element structure for the requested element.7180*7181* Note: There are no checks on the element length other than having to fit into7182* the given data.7183*/7184const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,7185const u8 *ies,7186unsigned int len);71877188/**7189* cfg80211_find_vendor_ie - find vendor specific information element in data7190*7191* @oui: vendor OUI7192* @oui_type: vendor-specific OUI type (must be < 0xff), negative means any7193* @ies: data consisting of IEs7194* @len: length of data7195*7196* Return: %NULL if the vendor specific element ID could not be found or if the7197* element is invalid (claims to be longer than the given data), or a pointer to7198* the first byte of the requested element, that is the byte containing the7199* element ID.7200*7201* Note: There are no checks on the element length other than having to fit into7202* the given data.7203*/7204static inline const u8 *7205cfg80211_find_vendor_ie(unsigned int oui, int oui_type,7206const u8 *ies, unsigned int len)7207{7208return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);7209}72107211/**7212* enum cfg80211_rnr_iter_ret - reduced neighbor report iteration state7213* @RNR_ITER_CONTINUE: continue iterating with the next entry7214* @RNR_ITER_BREAK: break iteration and return success7215* @RNR_ITER_ERROR: break iteration and return error7216*/7217enum cfg80211_rnr_iter_ret {7218RNR_ITER_CONTINUE,7219RNR_ITER_BREAK,7220RNR_ITER_ERROR,7221};72227223/**7224* cfg80211_iter_rnr - iterate reduced neighbor report entries7225* @elems: the frame elements to iterate RNR elements and then7226* their entries in7227* @elems_len: length of the elements7228* @iter: iteration function, see also &enum cfg80211_rnr_iter_ret7229* for the return value7230* @iter_data: additional data passed to the iteration function7231* Return: %true on success (after successfully iterating all entries7232* or if the iteration function returned %RNR_ITER_BREAK),7233* %false on error (iteration function returned %RNR_ITER_ERROR7234* or elements were malformed.)7235*/7236bool cfg80211_iter_rnr(const u8 *elems, size_t elems_len,7237enum cfg80211_rnr_iter_ret7238(*iter)(void *data, u8 type,7239const struct ieee80211_neighbor_ap_info *info,7240const u8 *tbtt_info, u8 tbtt_info_len),7241void *iter_data);72427243/**7244* cfg80211_defragment_element - Defrag the given element data into a buffer7245*7246* @elem: the element to defragment7247* @ies: elements where @elem is contained7248* @ieslen: length of @ies7249* @data: buffer to store element data, or %NULL to just determine size7250* @data_len: length of @data, or 07251* @frag_id: the element ID of fragments7252*7253* Return: length of @data, or -EINVAL on error7254*7255* Copy out all data from an element that may be fragmented into @data, while7256* skipping all headers.7257*7258* The function uses memmove() internally. It is acceptable to defragment an7259* element in-place.7260*/7261ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,7262size_t ieslen, u8 *data, size_t data_len,7263u8 frag_id);72647265/**7266* cfg80211_send_layer2_update - send layer 2 update frame7267*7268* @dev: network device7269* @addr: STA MAC address7270*7271* Wireless drivers can use this function to update forwarding tables in bridge7272* devices upon STA association.7273*/7274void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);72757276/**7277* DOC: Regulatory enforcement infrastructure7278*7279* TODO7280*/72817282/**7283* regulatory_hint - driver hint to the wireless core a regulatory domain7284* @wiphy: the wireless device giving the hint (used only for reporting7285* conflicts)7286* @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain7287* should be in. If @rd is set this should be NULL. Note that if you7288* set this to NULL you should still set rd->alpha2 to some accepted7289* alpha2.7290*7291* Wireless drivers can use this function to hint to the wireless core7292* what it believes should be the current regulatory domain by7293* giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory7294* domain should be in or by providing a completely build regulatory domain.7295* If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried7296* for a regulatory domain structure for the respective country.7297*7298* The wiphy must have been registered to cfg80211 prior to this call.7299* For cfg80211 drivers this means you must first use wiphy_register(),7300* for mac80211 drivers you must first use ieee80211_register_hw().7301*7302* Drivers should check the return value, its possible you can get7303* an -ENOMEM.7304*7305* Return: 0 on success. -ENOMEM.7306*/7307int regulatory_hint(struct wiphy *wiphy, const char *alpha2);73087309/**7310* regulatory_set_wiphy_regd - set regdom info for self managed drivers7311* @wiphy: the wireless device we want to process the regulatory domain on7312* @rd: the regulatory domain information to use for this wiphy7313*7314* Set the regulatory domain information for self-managed wiphys, only they7315* may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more7316* information.7317*7318* Return: 0 on success. -EINVAL, -EPERM7319*/7320int regulatory_set_wiphy_regd(struct wiphy *wiphy,7321struct ieee80211_regdomain *rd);73227323/**7324* regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers7325* @wiphy: the wireless device we want to process the regulatory domain on7326* @rd: the regulatory domain information to use for this wiphy7327*7328* This functions requires the RTNL and the wiphy mutex to be held and7329* applies the new regdomain synchronously to this wiphy. For more details7330* see regulatory_set_wiphy_regd().7331*7332* Return: 0 on success. -EINVAL, -EPERM7333*/7334int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,7335struct ieee80211_regdomain *rd);73367337/**7338* wiphy_apply_custom_regulatory - apply a custom driver regulatory domain7339* @wiphy: the wireless device we want to process the regulatory domain on7340* @regd: the custom regulatory domain to use for this wiphy7341*7342* Drivers can sometimes have custom regulatory domains which do not apply7343* to a specific country. Drivers can use this to apply such custom regulatory7344* domains. This routine must be called prior to wiphy registration. The7345* custom regulatory domain will be trusted completely and as such previous7346* default channel settings will be disregarded. If no rule is found for a7347* channel on the regulatory domain the channel will be disabled.7348* Drivers using this for a wiphy should also set the wiphy flag7349* REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy7350* that called this helper.7351*/7352void wiphy_apply_custom_regulatory(struct wiphy *wiphy,7353const struct ieee80211_regdomain *regd);73547355/**7356* freq_reg_info - get regulatory information for the given frequency7357* @wiphy: the wiphy for which we want to process this rule for7358* @center_freq: Frequency in KHz for which we want regulatory information for7359*7360* Use this function to get the regulatory rule for a specific frequency on7361* a given wireless device. If the device has a specific regulatory domain7362* it wants to follow we respect that unless a country IE has been received7363* and processed already.7364*7365* Return: A valid pointer, or, when an error occurs, for example if no rule7366* can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to7367* check and PTR_ERR() to obtain the numeric return value. The numeric return7368* value will be -ERANGE if we determine the given center_freq does not even7369* have a regulatory rule for a frequency range in the center_freq's band.7370* See freq_in_rule_band() for our current definition of a band -- this is7371* purely subjective and right now it's 802.11 specific.7372*/7373const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,7374u32 center_freq);73757376/**7377* reg_initiator_name - map regulatory request initiator enum to name7378* @initiator: the regulatory request initiator7379*7380* You can use this to map the regulatory request initiator enum to a7381* proper string representation.7382*7383* Return: pointer to string representation of the initiator7384*/7385const char *reg_initiator_name(enum nl80211_reg_initiator initiator);73867387/**7388* regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom7389* @wiphy: wiphy for which pre-CAC capability is checked.7390*7391* Pre-CAC is allowed only in some regdomains (notable ETSI).7392*7393* Return: %true if allowed, %false otherwise7394*/7395bool regulatory_pre_cac_allowed(struct wiphy *wiphy);73967397/**7398* DOC: Internal regulatory db functions7399*7400*/74017402/**7403* reg_query_regdb_wmm - Query internal regulatory db for wmm rule7404* Regulatory self-managed driver can use it to proactively7405*7406* @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.7407* @freq: the frequency (in MHz) to be queried.7408* @rule: pointer to store the wmm rule from the regulatory db.7409*7410* Self-managed wireless drivers can use this function to query7411* the internal regulatory database to check whether the given7412* ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.7413*7414* Drivers should check the return value, its possible you can get7415* an -ENODATA.7416*7417* Return: 0 on success. -ENODATA.7418*/7419int reg_query_regdb_wmm(char *alpha2, int freq,7420struct ieee80211_reg_rule *rule);74217422/*7423* callbacks for asynchronous cfg80211 methods, notification7424* functions and BSS handling helpers7425*/74267427/**7428* cfg80211_scan_done - notify that scan finished7429*7430* @request: the corresponding scan request7431* @info: information about the completed scan7432*/7433void cfg80211_scan_done(struct cfg80211_scan_request *request,7434struct cfg80211_scan_info *info);74357436/**7437* cfg80211_sched_scan_results - notify that new scan results are available7438*7439* @wiphy: the wiphy which got scheduled scan results7440* @reqid: identifier for the related scheduled scan request7441*/7442void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);74437444/**7445* cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped7446*7447* @wiphy: the wiphy on which the scheduled scan stopped7448* @reqid: identifier for the related scheduled scan request7449*7450* The driver can call this function to inform cfg80211 that the7451* scheduled scan had to be stopped, for whatever reason. The driver7452* is then called back via the sched_scan_stop operation when done.7453*/7454void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);74557456/**7457* cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped7458*7459* @wiphy: the wiphy on which the scheduled scan stopped7460* @reqid: identifier for the related scheduled scan request7461*7462* The driver can call this function to inform cfg80211 that the7463* scheduled scan had to be stopped, for whatever reason. The driver7464* is then called back via the sched_scan_stop operation when done.7465* This function should be called with the wiphy mutex held.7466*/7467void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);74687469/**7470* cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame7471* @wiphy: the wiphy reporting the BSS7472* @data: the BSS metadata7473* @mgmt: the management frame (probe response or beacon)7474* @len: length of the management frame7475* @gfp: context flags7476*7477* This informs cfg80211 that BSS information was found and7478* the BSS should be updated/added.7479*7480* Return: A referenced struct, must be released with cfg80211_put_bss()!7481* Or %NULL on error.7482*/7483struct cfg80211_bss * __must_check7484cfg80211_inform_bss_frame_data(struct wiphy *wiphy,7485struct cfg80211_inform_bss *data,7486struct ieee80211_mgmt *mgmt, size_t len,7487gfp_t gfp);74887489static inline struct cfg80211_bss * __must_check7490cfg80211_inform_bss_frame(struct wiphy *wiphy,7491struct ieee80211_channel *rx_channel,7492struct ieee80211_mgmt *mgmt, size_t len,7493s32 signal, gfp_t gfp)7494{7495struct cfg80211_inform_bss data = {7496.chan = rx_channel,7497.signal = signal,7498};74997500return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);7501}75027503/**7504* cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID7505* @bssid: transmitter BSSID7506* @max_bssid: max BSSID indicator, taken from Multiple BSSID element7507* @mbssid_index: BSSID index, taken from Multiple BSSID index element7508* @new_bssid: calculated nontransmitted BSSID7509*/7510static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,7511u8 mbssid_index, u8 *new_bssid)7512{7513u64 bssid_u64 = ether_addr_to_u64(bssid);7514u64 mask = GENMASK_ULL(max_bssid - 1, 0);7515u64 new_bssid_u64;75167517new_bssid_u64 = bssid_u64 & ~mask;75187519new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;75207521u64_to_ether_addr(new_bssid_u64, new_bssid);7522}75237524/**7525* cfg80211_is_element_inherited - returns if element ID should be inherited7526* @element: element to check7527* @non_inherit_element: non inheritance element7528*7529* Return: %true if should be inherited, %false otherwise7530*/7531bool cfg80211_is_element_inherited(const struct element *element,7532const struct element *non_inherit_element);75337534/**7535* cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs7536* @ie: ies7537* @ielen: length of IEs7538* @mbssid_elem: current MBSSID element7539* @sub_elem: current MBSSID subelement (profile)7540* @merged_ie: location of the merged profile7541* @max_copy_len: max merged profile length7542*7543* Return: the number of bytes merged7544*/7545size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,7546const struct element *mbssid_elem,7547const struct element *sub_elem,7548u8 *merged_ie, size_t max_copy_len);75497550/**7551* enum cfg80211_bss_frame_type - frame type that the BSS data came from7552* @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is7553* from a beacon or probe response7554* @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon7555* @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response7556* @CFG80211_BSS_FTYPE_S1G_BEACON: data comes from an S1G beacon7557*/7558enum cfg80211_bss_frame_type {7559CFG80211_BSS_FTYPE_UNKNOWN,7560CFG80211_BSS_FTYPE_BEACON,7561CFG80211_BSS_FTYPE_PRESP,7562CFG80211_BSS_FTYPE_S1G_BEACON,7563};75647565/**7566* cfg80211_get_ies_channel_number - returns the channel number from ies7567* @ie: IEs7568* @ielen: length of IEs7569* @band: enum nl80211_band of the channel7570*7571* Return: the channel number, or -1 if none could be determined.7572*/7573int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,7574enum nl80211_band band);75757576/**7577* cfg80211_ssid_eq - compare two SSIDs7578* @a: first SSID7579* @b: second SSID7580*7581* Return: %true if SSIDs are equal, %false otherwise.7582*/7583static inline bool7584cfg80211_ssid_eq(struct cfg80211_ssid *a, struct cfg80211_ssid *b)7585{7586if (WARN_ON(!a || !b))7587return false;7588if (a->ssid_len != b->ssid_len)7589return false;7590return memcmp(a->ssid, b->ssid, a->ssid_len) ? false : true;7591}75927593/**7594* cfg80211_inform_bss_data - inform cfg80211 of a new BSS7595*7596* @wiphy: the wiphy reporting the BSS7597* @data: the BSS metadata7598* @ftype: frame type (if known)7599* @bssid: the BSSID of the BSS7600* @tsf: the TSF sent by the peer in the beacon/probe response (or 0)7601* @capability: the capability field sent by the peer7602* @beacon_interval: the beacon interval announced by the peer7603* @ie: additional IEs sent by the peer7604* @ielen: length of the additional IEs7605* @gfp: context flags7606*7607* This informs cfg80211 that BSS information was found and7608* the BSS should be updated/added.7609*7610* Return: A referenced struct, must be released with cfg80211_put_bss()!7611* Or %NULL on error.7612*/7613struct cfg80211_bss * __must_check7614cfg80211_inform_bss_data(struct wiphy *wiphy,7615struct cfg80211_inform_bss *data,7616enum cfg80211_bss_frame_type ftype,7617const u8 *bssid, u64 tsf, u16 capability,7618u16 beacon_interval, const u8 *ie, size_t ielen,7619gfp_t gfp);76207621static inline struct cfg80211_bss * __must_check7622cfg80211_inform_bss(struct wiphy *wiphy,7623struct ieee80211_channel *rx_channel,7624enum cfg80211_bss_frame_type ftype,7625const u8 *bssid, u64 tsf, u16 capability,7626u16 beacon_interval, const u8 *ie, size_t ielen,7627s32 signal, gfp_t gfp)7628{7629struct cfg80211_inform_bss data = {7630.chan = rx_channel,7631.signal = signal,7632};76337634return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,7635capability, beacon_interval, ie, ielen,7636gfp);7637}76387639/**7640* __cfg80211_get_bss - get a BSS reference7641* @wiphy: the wiphy this BSS struct belongs to7642* @channel: the channel to search on (or %NULL)7643* @bssid: the desired BSSID (or %NULL)7644* @ssid: the desired SSID (or %NULL)7645* @ssid_len: length of the SSID (or 0)7646* @bss_type: type of BSS, see &enum ieee80211_bss_type7647* @privacy: privacy filter, see &enum ieee80211_privacy7648* @use_for: indicates which use is intended7649*7650* Return: Reference-counted BSS on success. %NULL on error.7651*/7652struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy,7653struct ieee80211_channel *channel,7654const u8 *bssid,7655const u8 *ssid, size_t ssid_len,7656enum ieee80211_bss_type bss_type,7657enum ieee80211_privacy privacy,7658u32 use_for);76597660/**7661* cfg80211_get_bss - get a BSS reference7662* @wiphy: the wiphy this BSS struct belongs to7663* @channel: the channel to search on (or %NULL)7664* @bssid: the desired BSSID (or %NULL)7665* @ssid: the desired SSID (or %NULL)7666* @ssid_len: length of the SSID (or 0)7667* @bss_type: type of BSS, see &enum ieee80211_bss_type7668* @privacy: privacy filter, see &enum ieee80211_privacy7669*7670* This version implies regular usage, %NL80211_BSS_USE_FOR_NORMAL.7671*7672* Return: Reference-counted BSS on success. %NULL on error.7673*/7674static inline struct cfg80211_bss *7675cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel,7676const u8 *bssid, const u8 *ssid, size_t ssid_len,7677enum ieee80211_bss_type bss_type,7678enum ieee80211_privacy privacy)7679{7680return __cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len,7681bss_type, privacy,7682NL80211_BSS_USE_FOR_NORMAL);7683}76847685static inline struct cfg80211_bss *7686cfg80211_get_ibss(struct wiphy *wiphy,7687struct ieee80211_channel *channel,7688const u8 *ssid, size_t ssid_len)7689{7690return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,7691IEEE80211_BSS_TYPE_IBSS,7692IEEE80211_PRIVACY_ANY);7693}76947695/**7696* cfg80211_ref_bss - reference BSS struct7697* @wiphy: the wiphy this BSS struct belongs to7698* @bss: the BSS struct to reference7699*7700* Increments the refcount of the given BSS struct.7701*/7702void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);77037704/**7705* cfg80211_put_bss - unref BSS struct7706* @wiphy: the wiphy this BSS struct belongs to7707* @bss: the BSS struct7708*7709* Decrements the refcount of the given BSS struct.7710*/7711void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);77127713/**7714* cfg80211_unlink_bss - unlink BSS from internal data structures7715* @wiphy: the wiphy7716* @bss: the bss to remove7717*7718* This function removes the given BSS from the internal data structures7719* thereby making it no longer show up in scan results etc. Use this7720* function when you detect a BSS is gone. Normally BSSes will also time7721* out, so it is not necessary to use this function at all.7722*/7723void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);77247725/**7726* cfg80211_bss_iter - iterate all BSS entries7727*7728* This function iterates over the BSS entries associated with the given wiphy7729* and calls the callback for the iterated BSS. The iterator function is not7730* allowed to call functions that might modify the internal state of the BSS DB.7731*7732* @wiphy: the wiphy7733* @chandef: if given, the iterator function will be called only if the channel7734* of the currently iterated BSS is a subset of the given channel.7735* @iter: the iterator function to call7736* @iter_data: an argument to the iterator function7737*/7738void cfg80211_bss_iter(struct wiphy *wiphy,7739struct cfg80211_chan_def *chandef,7740void (*iter)(struct wiphy *wiphy,7741struct cfg80211_bss *bss,7742void *data),7743void *iter_data);77447745/**7746* cfg80211_rx_mlme_mgmt - notification of processed MLME management frame7747* @dev: network device7748* @buf: authentication frame (header + body)7749* @len: length of the frame data7750*7751* This function is called whenever an authentication, disassociation or7752* deauthentication frame has been received and processed in station mode.7753* After being asked to authenticate via cfg80211_ops::auth() the driver must7754* call either this function or cfg80211_auth_timeout().7755* After being asked to associate via cfg80211_ops::assoc() the driver must7756* call either this function or cfg80211_auth_timeout().7757* While connected, the driver must calls this for received and processed7758* disassociation and deauthentication frames. If the frame couldn't be used7759* because it was unprotected, the driver must call the function7760* cfg80211_rx_unprot_mlme_mgmt() instead.7761*7762* This function may sleep. The caller must hold the corresponding wdev's mutex.7763*/7764void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);77657766/**7767* cfg80211_auth_timeout - notification of timed out authentication7768* @dev: network device7769* @addr: The MAC address of the device with which the authentication timed out7770*7771* This function may sleep. The caller must hold the corresponding wdev's7772* mutex.7773*/7774void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);77757776/**7777* struct cfg80211_rx_assoc_resp_data - association response data7778* @buf: (Re)Association Response frame (header + body)7779* @len: length of the frame data7780* @uapsd_queues: bitmap of queues configured for uapsd. Same format7781* as the AC bitmap in the QoS info field7782* @req_ies: information elements from the (Re)Association Request frame7783* @req_ies_len: length of req_ies data7784* @ap_mld_addr: AP MLD address (in case of MLO)7785* @links: per-link information indexed by link ID, use links[0] for7786* non-MLO connections7787* @links.bss: the BSS that association was requested with, ownership of the7788* pointer moves to cfg80211 in the call to cfg80211_rx_assoc_resp()7789* @links.status: Set this (along with a BSS pointer) for links that7790* were rejected by the AP.7791*/7792struct cfg80211_rx_assoc_resp_data {7793const u8 *buf;7794size_t len;7795const u8 *req_ies;7796size_t req_ies_len;7797int uapsd_queues;7798const u8 *ap_mld_addr;7799struct {7800u8 addr[ETH_ALEN] __aligned(2);7801struct cfg80211_bss *bss;7802u16 status;7803} links[IEEE80211_MLD_MAX_NUM_LINKS];7804};78057806/**7807* cfg80211_rx_assoc_resp - notification of processed association response7808* @dev: network device7809* @data: association response data, &struct cfg80211_rx_assoc_resp_data7810*7811* After being asked to associate via cfg80211_ops::assoc() the driver must7812* call either this function or cfg80211_auth_timeout().7813*7814* This function may sleep. The caller must hold the corresponding wdev's mutex.7815*/7816void cfg80211_rx_assoc_resp(struct net_device *dev,7817const struct cfg80211_rx_assoc_resp_data *data);78187819/**7820* struct cfg80211_assoc_failure - association failure data7821* @ap_mld_addr: AP MLD address, or %NULL7822* @bss: list of BSSes, must use entry 0 for non-MLO connections7823* (@ap_mld_addr is %NULL)7824* @timeout: indicates the association failed due to timeout, otherwise7825* the association was abandoned for a reason reported through some7826* other API (e.g. deauth RX)7827*/7828struct cfg80211_assoc_failure {7829const u8 *ap_mld_addr;7830struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];7831bool timeout;7832};78337834/**7835* cfg80211_assoc_failure - notification of association failure7836* @dev: network device7837* @data: data describing the association failure7838*7839* This function may sleep. The caller must hold the corresponding wdev's mutex.7840*/7841void cfg80211_assoc_failure(struct net_device *dev,7842struct cfg80211_assoc_failure *data);78437844/**7845* cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame7846* @dev: network device7847* @buf: 802.11 frame (header + body)7848* @len: length of the frame data7849* @reconnect: immediate reconnect is desired (include the nl80211 attribute)7850*7851* This function is called whenever deauthentication has been processed in7852* station mode. This includes both received deauthentication frames and7853* locally generated ones. This function may sleep. The caller must hold the7854* corresponding wdev's mutex.7855*/7856void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,7857bool reconnect);78587859/**7860* cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame7861* @dev: network device7862* @buf: received management frame (header + body)7863* @len: length of the frame data7864*7865* This function is called whenever a received deauthentication or dissassoc7866* frame has been dropped in station mode because of MFP being used but the7867* frame was not protected. This is also used to notify reception of a Beacon7868* frame that was dropped because it did not include a valid MME MIC while7869* beacon protection was enabled (BIGTK configured in station mode).7870*7871* This function may sleep.7872*/7873void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,7874const u8 *buf, size_t len);78757876/**7877* cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)7878* @dev: network device7879* @addr: The source MAC address of the frame7880* @key_type: The key type that the received frame used7881* @key_id: Key identifier (0..3). Can be -1 if missing.7882* @tsc: The TSC value of the frame that generated the MIC failure (6 octets)7883* @gfp: allocation flags7884*7885* This function is called whenever the local MAC detects a MIC failure in a7886* received frame. This matches with MLME-MICHAELMICFAILURE.indication()7887* primitive.7888*/7889void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,7890enum nl80211_key_type key_type, int key_id,7891const u8 *tsc, gfp_t gfp);78927893/**7894* cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS7895*7896* @dev: network device7897* @bssid: the BSSID of the IBSS joined7898* @channel: the channel of the IBSS joined7899* @gfp: allocation flags7900*7901* This function notifies cfg80211 that the device joined an IBSS or7902* switched to a different BSSID. Before this function can be called,7903* either a beacon has to have been received from the IBSS, or one of7904* the cfg80211_inform_bss{,_frame} functions must have been called7905* with the locally generated beacon -- this guarantees that there is7906* always a scan result for this IBSS. cfg80211 will handle the rest.7907*/7908void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,7909struct ieee80211_channel *channel, gfp_t gfp);79107911/**7912* cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer7913* candidate7914*7915* @dev: network device7916* @macaddr: the MAC address of the new candidate7917* @ie: information elements advertised by the peer candidate7918* @ie_len: length of the information elements buffer7919* @sig_dbm: signal level in dBm7920* @gfp: allocation flags7921*7922* This function notifies cfg80211 that the mesh peer candidate has been7923* detected, most likely via a beacon or, less likely, via a probe response.7924* cfg80211 then sends a notification to userspace.7925*/7926void cfg80211_notify_new_peer_candidate(struct net_device *dev,7927const u8 *macaddr, const u8 *ie, u8 ie_len,7928int sig_dbm, gfp_t gfp);79297930/**7931* DOC: RFkill integration7932*7933* RFkill integration in cfg80211 is almost invisible to drivers,7934* as cfg80211 automatically registers an rfkill instance for each7935* wireless device it knows about. Soft kill is also translated7936* into disconnecting and turning all interfaces off. Drivers are7937* expected to turn off the device when all interfaces are down.7938*7939* However, devices may have a hard RFkill line, in which case they7940* also need to interact with the rfkill subsystem, via cfg80211.7941* They can do this with a few helper functions documented here.7942*/79437944/**7945* wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state7946* @wiphy: the wiphy7947* @blocked: block status7948* @reason: one of reasons in &enum rfkill_hard_block_reasons7949*/7950void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,7951enum rfkill_hard_block_reasons reason);79527953static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)7954{7955wiphy_rfkill_set_hw_state_reason(wiphy, blocked,7956RFKILL_HARD_BLOCK_SIGNAL);7957}79587959/**7960* wiphy_rfkill_start_polling - start polling rfkill7961* @wiphy: the wiphy7962*/7963void wiphy_rfkill_start_polling(struct wiphy *wiphy);79647965/**7966* wiphy_rfkill_stop_polling - stop polling rfkill7967* @wiphy: the wiphy7968*/7969static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)7970{7971rfkill_pause_polling(wiphy->rfkill);7972}79737974/**7975* DOC: Vendor commands7976*7977* Occasionally, there are special protocol or firmware features that7978* can't be implemented very openly. For this and similar cases, the7979* vendor command functionality allows implementing the features with7980* (typically closed-source) userspace and firmware, using nl80211 as7981* the configuration mechanism.7982*7983* A driver supporting vendor commands must register them as an array7984* in struct wiphy, with handlers for each one. Each command has an7985* OUI and sub command ID to identify it.7986*7987* Note that this feature should not be (ab)used to implement protocol7988* features that could openly be shared across drivers. In particular,7989* it must never be required to use vendor commands to implement any7990* "normal" functionality that higher-level userspace like connection7991* managers etc. need.7992*/79937994struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,7995enum nl80211_commands cmd,7996enum nl80211_attrs attr,7997int approxlen);79987999struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,8000struct wireless_dev *wdev,8001enum nl80211_commands cmd,8002enum nl80211_attrs attr,8003unsigned int portid,8004int vendor_event_idx,8005int approxlen, gfp_t gfp);80068007void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);80088009/**8010* cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply8011* @wiphy: the wiphy8012* @approxlen: an upper bound of the length of the data that will8013* be put into the skb8014*8015* This function allocates and pre-fills an skb for a reply to8016* a vendor command. Since it is intended for a reply, calling8017* it outside of a vendor command's doit() operation is invalid.8018*8019* The returned skb is pre-filled with some identifying data in8020* a way that any data that is put into the skb (with skb_put(),8021* nla_put() or similar) will end up being within the8022* %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done8023* with the skb is adding data for the corresponding userspace tool8024* which can then read that data out of the vendor data attribute.8025* You must not modify the skb in any other way.8026*8027* When done, call cfg80211_vendor_cmd_reply() with the skb and return8028* its error code as the result of the doit() operation.8029*8030* Return: An allocated and pre-filled skb. %NULL if any errors happen.8031*/8032static inline struct sk_buff *8033cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)8034{8035return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,8036NL80211_ATTR_VENDOR_DATA, approxlen);8037}80388039/**8040* cfg80211_vendor_cmd_reply - send the reply skb8041* @skb: The skb, must have been allocated with8042* cfg80211_vendor_cmd_alloc_reply_skb()8043*8044* Since calling this function will usually be the last thing8045* before returning from the vendor command doit() you should8046* return the error code. Note that this function consumes the8047* skb regardless of the return value.8048*8049* Return: An error code or 0 on success.8050*/8051int cfg80211_vendor_cmd_reply(struct sk_buff *skb);80528053/**8054* cfg80211_vendor_cmd_get_sender - get the current sender netlink ID8055* @wiphy: the wiphy8056*8057* Return: the current netlink port ID in a vendor command handler.8058*8059* Context: May only be called from a vendor command handler8060*/8061unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);80628063/**8064* cfg80211_vendor_event_alloc - allocate vendor-specific event skb8065* @wiphy: the wiphy8066* @wdev: the wireless device8067* @event_idx: index of the vendor event in the wiphy's vendor_events8068* @approxlen: an upper bound of the length of the data that will8069* be put into the skb8070* @gfp: allocation flags8071*8072* This function allocates and pre-fills an skb for an event on the8073* vendor-specific multicast group.8074*8075* If wdev != NULL, both the ifindex and identifier of the specified8076* wireless device are added to the event message before the vendor data8077* attribute.8078*8079* When done filling the skb, call cfg80211_vendor_event() with the8080* skb to send the event.8081*8082* Return: An allocated and pre-filled skb. %NULL if any errors happen.8083*/8084static inline struct sk_buff *8085cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,8086int approxlen, int event_idx, gfp_t gfp)8087{8088return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,8089NL80211_ATTR_VENDOR_DATA,80900, event_idx, approxlen, gfp);8091}80928093/**8094* cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb8095* @wiphy: the wiphy8096* @wdev: the wireless device8097* @event_idx: index of the vendor event in the wiphy's vendor_events8098* @portid: port ID of the receiver8099* @approxlen: an upper bound of the length of the data that will8100* be put into the skb8101* @gfp: allocation flags8102*8103* This function allocates and pre-fills an skb for an event to send to8104* a specific (userland) socket. This socket would previously have been8105* obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take8106* care to register a netlink notifier to see when the socket closes.8107*8108* If wdev != NULL, both the ifindex and identifier of the specified8109* wireless device are added to the event message before the vendor data8110* attribute.8111*8112* When done filling the skb, call cfg80211_vendor_event() with the8113* skb to send the event.8114*8115* Return: An allocated and pre-filled skb. %NULL if any errors happen.8116*/8117static inline struct sk_buff *8118cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,8119struct wireless_dev *wdev,8120unsigned int portid, int approxlen,8121int event_idx, gfp_t gfp)8122{8123return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,8124NL80211_ATTR_VENDOR_DATA,8125portid, event_idx, approxlen, gfp);8126}81278128/**8129* cfg80211_vendor_event - send the event8130* @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()8131* @gfp: allocation flags8132*8133* This function sends the given @skb, which must have been allocated8134* by cfg80211_vendor_event_alloc(), as an event. It always consumes it.8135*/8136static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)8137{8138__cfg80211_send_event_skb(skb, gfp);8139}81408141#ifdef CONFIG_NL80211_TESTMODE8142/**8143* DOC: Test mode8144*8145* Test mode is a set of utility functions to allow drivers to8146* interact with driver-specific tools to aid, for instance,8147* factory programming.8148*8149* This chapter describes how drivers interact with it. For more8150* information see the nl80211 book's chapter on it.8151*/81528153/**8154* cfg80211_testmode_alloc_reply_skb - allocate testmode reply8155* @wiphy: the wiphy8156* @approxlen: an upper bound of the length of the data that will8157* be put into the skb8158*8159* This function allocates and pre-fills an skb for a reply to8160* the testmode command. Since it is intended for a reply, calling8161* it outside of the @testmode_cmd operation is invalid.8162*8163* The returned skb is pre-filled with the wiphy index and set up in8164* a way that any data that is put into the skb (with skb_put(),8165* nla_put() or similar) will end up being within the8166* %NL80211_ATTR_TESTDATA attribute, so all that needs to be done8167* with the skb is adding data for the corresponding userspace tool8168* which can then read that data out of the testdata attribute. You8169* must not modify the skb in any other way.8170*8171* When done, call cfg80211_testmode_reply() with the skb and return8172* its error code as the result of the @testmode_cmd operation.8173*8174* Return: An allocated and pre-filled skb. %NULL if any errors happen.8175*/8176static inline struct sk_buff *8177cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)8178{8179return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,8180NL80211_ATTR_TESTDATA, approxlen);8181}81828183/**8184* cfg80211_testmode_reply - send the reply skb8185* @skb: The skb, must have been allocated with8186* cfg80211_testmode_alloc_reply_skb()8187*8188* Since calling this function will usually be the last thing8189* before returning from the @testmode_cmd you should return8190* the error code. Note that this function consumes the skb8191* regardless of the return value.8192*8193* Return: An error code or 0 on success.8194*/8195static inline int cfg80211_testmode_reply(struct sk_buff *skb)8196{8197return cfg80211_vendor_cmd_reply(skb);8198}81998200/**8201* cfg80211_testmode_alloc_event_skb - allocate testmode event8202* @wiphy: the wiphy8203* @approxlen: an upper bound of the length of the data that will8204* be put into the skb8205* @gfp: allocation flags8206*8207* This function allocates and pre-fills an skb for an event on the8208* testmode multicast group.8209*8210* The returned skb is set up in the same way as with8211* cfg80211_testmode_alloc_reply_skb() but prepared for an event. As8212* there, you should simply add data to it that will then end up in the8213* %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb8214* in any other way.8215*8216* When done filling the skb, call cfg80211_testmode_event() with the8217* skb to send the event.8218*8219* Return: An allocated and pre-filled skb. %NULL if any errors happen.8220*/8221static inline struct sk_buff *8222cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)8223{8224return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,8225NL80211_ATTR_TESTDATA, 0, -1,8226approxlen, gfp);8227}82288229/**8230* cfg80211_testmode_event - send the event8231* @skb: The skb, must have been allocated with8232* cfg80211_testmode_alloc_event_skb()8233* @gfp: allocation flags8234*8235* This function sends the given @skb, which must have been allocated8236* by cfg80211_testmode_alloc_event_skb(), as an event. It always8237* consumes it.8238*/8239static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)8240{8241__cfg80211_send_event_skb(skb, gfp);8242}82438244#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),8245#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),8246#else8247#define CFG80211_TESTMODE_CMD(cmd)8248#define CFG80211_TESTMODE_DUMP(cmd)8249#endif82508251/**8252* struct cfg80211_fils_resp_params - FILS connection response params8253* @kek: KEK derived from a successful FILS connection (may be %NULL)8254* @kek_len: Length of @fils_kek in octets8255* @update_erp_next_seq_num: Boolean value to specify whether the value in8256* @erp_next_seq_num is valid.8257* @erp_next_seq_num: The next sequence number to use in ERP message in8258* FILS Authentication. This value should be specified irrespective of the8259* status for a FILS connection.8260* @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).8261* @pmk_len: Length of @pmk in octets8262* @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID8263* used for this FILS connection (may be %NULL).8264*/8265struct cfg80211_fils_resp_params {8266const u8 *kek;8267size_t kek_len;8268bool update_erp_next_seq_num;8269u16 erp_next_seq_num;8270const u8 *pmk;8271size_t pmk_len;8272const u8 *pmkid;8273};82748275/**8276* struct cfg80211_connect_resp_params - Connection response params8277* @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use8278* %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you8279* the real status code for failures. If this call is used to report a8280* failure due to a timeout (e.g., not receiving an Authentication frame8281* from the AP) instead of an explicit rejection by the AP, -1 is used to8282* indicate that this is a failure, but without a status code.8283* @timeout_reason is used to report the reason for the timeout in that8284* case.8285* @req_ie: Association request IEs (may be %NULL)8286* @req_ie_len: Association request IEs length8287* @resp_ie: Association response IEs (may be %NULL)8288* @resp_ie_len: Association response IEs length8289* @fils: FILS connection response parameters.8290* @timeout_reason: Reason for connection timeout. This is used when the8291* connection fails due to a timeout instead of an explicit rejection from8292* the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is8293* not known. This value is used only if @status < 0 to indicate that the8294* failure is due to a timeout and not due to explicit rejection by the AP.8295* This value is ignored in other cases (@status >= 0).8296* @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise8297* zero.8298* @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.8299* @links : For MLO connection, contains link info for the valid links indicated8300* using @valid_links. For non-MLO connection, links[0] contains the8301* connected AP info.8302* @links.addr: For MLO connection, MAC address of the STA link. Otherwise8303* %NULL.8304* @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO8305* connection, links[0].bssid points to the BSSID of the AP (may be %NULL).8306* @links.bss: For MLO connection, entry of bss to which STA link is connected.8307* For non-MLO connection, links[0].bss points to entry of bss to which STA8308* is connected. It can be obtained through cfg80211_get_bss() (may be8309* %NULL). It is recommended to store the bss from the connect_request and8310* hold a reference to it and return through this param to avoid a warning8311* if the bss is expired during the connection, esp. for those drivers8312* implementing connect op. Only one parameter among @bssid and @bss needs8313* to be specified.8314* @links.status: per-link status code, to report a status code that's not8315* %WLAN_STATUS_SUCCESS for a given link, it must also be in the8316* @valid_links bitmap and may have a BSS pointer (which is then released)8317*/8318struct cfg80211_connect_resp_params {8319int status;8320const u8 *req_ie;8321size_t req_ie_len;8322const u8 *resp_ie;8323size_t resp_ie_len;8324struct cfg80211_fils_resp_params fils;8325enum nl80211_timeout_reason timeout_reason;83268327const u8 *ap_mld_addr;8328u16 valid_links;8329struct {8330const u8 *addr;8331const u8 *bssid;8332struct cfg80211_bss *bss;8333u16 status;8334} links[IEEE80211_MLD_MAX_NUM_LINKS];8335};83368337/**8338* cfg80211_connect_done - notify cfg80211 of connection result8339*8340* @dev: network device8341* @params: connection response parameters8342* @gfp: allocation flags8343*8344* It should be called by the underlying driver once execution of the connection8345* request from connect() has been completed. This is similar to8346* cfg80211_connect_bss(), but takes a structure pointer for connection response8347* parameters. Only one of the functions among cfg80211_connect_bss(),8348* cfg80211_connect_result(), cfg80211_connect_timeout(),8349* and cfg80211_connect_done() should be called.8350*/8351void cfg80211_connect_done(struct net_device *dev,8352struct cfg80211_connect_resp_params *params,8353gfp_t gfp);83548355/**8356* cfg80211_connect_bss - notify cfg80211 of connection result8357*8358* @dev: network device8359* @bssid: the BSSID of the AP8360* @bss: Entry of bss to which STA got connected to, can be obtained through8361* cfg80211_get_bss() (may be %NULL). But it is recommended to store the8362* bss from the connect_request and hold a reference to it and return8363* through this param to avoid a warning if the bss is expired during the8364* connection, esp. for those drivers implementing connect op.8365* Only one parameter among @bssid and @bss needs to be specified.8366* @req_ie: association request IEs (maybe be %NULL)8367* @req_ie_len: association request IEs length8368* @resp_ie: association response IEs (may be %NULL)8369* @resp_ie_len: assoc response IEs length8370* @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use8371* %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you8372* the real status code for failures. If this call is used to report a8373* failure due to a timeout (e.g., not receiving an Authentication frame8374* from the AP) instead of an explicit rejection by the AP, -1 is used to8375* indicate that this is a failure, but without a status code.8376* @timeout_reason is used to report the reason for the timeout in that8377* case.8378* @gfp: allocation flags8379* @timeout_reason: reason for connection timeout. This is used when the8380* connection fails due to a timeout instead of an explicit rejection from8381* the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is8382* not known. This value is used only if @status < 0 to indicate that the8383* failure is due to a timeout and not due to explicit rejection by the AP.8384* This value is ignored in other cases (@status >= 0).8385*8386* It should be called by the underlying driver once execution of the connection8387* request from connect() has been completed. This is similar to8388* cfg80211_connect_result(), but with the option of identifying the exact bss8389* entry for the connection. Only one of the functions among8390* cfg80211_connect_bss(), cfg80211_connect_result(),8391* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8392*/8393static inline void8394cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,8395struct cfg80211_bss *bss, const u8 *req_ie,8396size_t req_ie_len, const u8 *resp_ie,8397size_t resp_ie_len, int status, gfp_t gfp,8398enum nl80211_timeout_reason timeout_reason)8399{8400struct cfg80211_connect_resp_params params;84018402memset(¶ms, 0, sizeof(params));8403params.status = status;8404params.links[0].bssid = bssid;8405params.links[0].bss = bss;8406params.req_ie = req_ie;8407params.req_ie_len = req_ie_len;8408params.resp_ie = resp_ie;8409params.resp_ie_len = resp_ie_len;8410params.timeout_reason = timeout_reason;84118412cfg80211_connect_done(dev, ¶ms, gfp);8413}84148415/**8416* cfg80211_connect_result - notify cfg80211 of connection result8417*8418* @dev: network device8419* @bssid: the BSSID of the AP8420* @req_ie: association request IEs (maybe be %NULL)8421* @req_ie_len: association request IEs length8422* @resp_ie: association response IEs (may be %NULL)8423* @resp_ie_len: assoc response IEs length8424* @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use8425* %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you8426* the real status code for failures.8427* @gfp: allocation flags8428*8429* It should be called by the underlying driver once execution of the connection8430* request from connect() has been completed. This is similar to8431* cfg80211_connect_bss() which allows the exact bss entry to be specified. Only8432* one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),8433* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8434*/8435static inline void8436cfg80211_connect_result(struct net_device *dev, const u8 *bssid,8437const u8 *req_ie, size_t req_ie_len,8438const u8 *resp_ie, size_t resp_ie_len,8439u16 status, gfp_t gfp)8440{8441cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,8442resp_ie_len, status, gfp,8443NL80211_TIMEOUT_UNSPECIFIED);8444}84458446/**8447* cfg80211_connect_timeout - notify cfg80211 of connection timeout8448*8449* @dev: network device8450* @bssid: the BSSID of the AP8451* @req_ie: association request IEs (maybe be %NULL)8452* @req_ie_len: association request IEs length8453* @gfp: allocation flags8454* @timeout_reason: reason for connection timeout.8455*8456* It should be called by the underlying driver whenever connect() has failed8457* in a sequence where no explicit authentication/association rejection was8458* received from the AP. This could happen, e.g., due to not being able to send8459* out the Authentication or Association Request frame or timing out while8460* waiting for the response. Only one of the functions among8461* cfg80211_connect_bss(), cfg80211_connect_result(),8462* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8463*/8464static inline void8465cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,8466const u8 *req_ie, size_t req_ie_len, gfp_t gfp,8467enum nl80211_timeout_reason timeout_reason)8468{8469cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,8470gfp, timeout_reason);8471}84728473/**8474* struct cfg80211_roam_info - driver initiated roaming information8475*8476* @req_ie: association request IEs (maybe be %NULL)8477* @req_ie_len: association request IEs length8478* @resp_ie: association response IEs (may be %NULL)8479* @resp_ie_len: assoc response IEs length8480* @fils: FILS related roaming information.8481* @valid_links: For MLO roaming, BIT mask of the new valid links is set.8482* Otherwise zero.8483* @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.8484* @links : For MLO roaming, contains new link info for the valid links set in8485* @valid_links. For non-MLO roaming, links[0] contains the new AP info.8486* @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.8487* @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO8488* roaming, links[0].bssid points to the BSSID of the new AP. May be8489* %NULL if %links.bss is set.8490* @links.channel: the channel of the new AP.8491* @links.bss: For MLO roaming, entry of new bss to which STA link got8492* roamed. For non-MLO roaming, links[0].bss points to entry of bss to8493* which STA got roamed (may be %NULL if %links.bssid is set)8494*/8495struct cfg80211_roam_info {8496const u8 *req_ie;8497size_t req_ie_len;8498const u8 *resp_ie;8499size_t resp_ie_len;8500struct cfg80211_fils_resp_params fils;85018502const u8 *ap_mld_addr;8503u16 valid_links;8504struct {8505const u8 *addr;8506const u8 *bssid;8507struct ieee80211_channel *channel;8508struct cfg80211_bss *bss;8509} links[IEEE80211_MLD_MAX_NUM_LINKS];8510};85118512/**8513* cfg80211_roamed - notify cfg80211 of roaming8514*8515* @dev: network device8516* @info: information about the new BSS. struct &cfg80211_roam_info.8517* @gfp: allocation flags8518*8519* This function may be called with the driver passing either the BSSID of the8520* new AP or passing the bss entry to avoid a race in timeout of the bss entry.8521* It should be called by the underlying driver whenever it roamed from one AP8522* to another while connected. Drivers which have roaming implemented in8523* firmware should pass the bss entry to avoid a race in bss entry timeout where8524* the bss entry of the new AP is seen in the driver, but gets timed out by the8525* time it is accessed in __cfg80211_roamed() due to delay in scheduling8526* rdev->event_work. In case of any failures, the reference is released8527* either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be8528* released while disconnecting from the current bss.8529*/8530void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,8531gfp_t gfp);85328533/**8534* cfg80211_port_authorized - notify cfg80211 of successful security association8535*8536* @dev: network device8537* @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address8538* in case of AP/P2P GO8539* @td_bitmap: transition disable policy8540* @td_bitmap_len: Length of transition disable policy8541* @gfp: allocation flags8542*8543* This function should be called by a driver that supports 4 way handshake8544* offload after a security association was successfully established (i.e.,8545* the 4 way handshake was completed successfully). The call to this function8546* should be preceded with a call to cfg80211_connect_result(),8547* cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to8548* indicate the 802.11 association.8549* This function can also be called by AP/P2P GO driver that supports8550* authentication offload. In this case the peer_mac passed is that of8551* associated STA/GC.8552*/8553void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr,8554const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);85558556/**8557* cfg80211_disconnected - notify cfg80211 that connection was dropped8558*8559* @dev: network device8560* @ie: information elements of the deauth/disassoc frame (may be %NULL)8561* @ie_len: length of IEs8562* @reason: reason code for the disconnection, set it to 0 if unknown8563* @locally_generated: disconnection was requested locally8564* @gfp: allocation flags8565*8566* After it calls this function, the driver should enter an idle state8567* and not try to connect to any AP any more.8568*/8569void cfg80211_disconnected(struct net_device *dev, u16 reason,8570const u8 *ie, size_t ie_len,8571bool locally_generated, gfp_t gfp);85728573/**8574* cfg80211_ready_on_channel - notification of remain_on_channel start8575* @wdev: wireless device8576* @cookie: the request cookie8577* @chan: The current channel (from remain_on_channel request)8578* @duration: Duration in milliseconds that the driver intents to remain on the8579* channel8580* @gfp: allocation flags8581*/8582void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,8583struct ieee80211_channel *chan,8584unsigned int duration, gfp_t gfp);85858586/**8587* cfg80211_remain_on_channel_expired - remain_on_channel duration expired8588* @wdev: wireless device8589* @cookie: the request cookie8590* @chan: The current channel (from remain_on_channel request)8591* @gfp: allocation flags8592*/8593void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,8594struct ieee80211_channel *chan,8595gfp_t gfp);85968597/**8598* cfg80211_tx_mgmt_expired - tx_mgmt duration expired8599* @wdev: wireless device8600* @cookie: the requested cookie8601* @chan: The current channel (from tx_mgmt request)8602* @gfp: allocation flags8603*/8604void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,8605struct ieee80211_channel *chan, gfp_t gfp);86068607/**8608* cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.8609*8610* @sinfo: the station information8611* @gfp: allocation flags8612*8613* Return: 0 on success. Non-zero on error.8614*/8615int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);86168617/**8618* cfg80211_link_sinfo_alloc_tid_stats - allocate per-tid statistics.8619*8620* @link_sinfo: the link station information8621* @gfp: allocation flags8622*8623* Return: 0 on success. Non-zero on error.8624*/8625int cfg80211_link_sinfo_alloc_tid_stats(struct link_station_info *link_sinfo,8626gfp_t gfp);86278628/**8629* cfg80211_sinfo_release_content - release contents of station info8630* @sinfo: the station information8631*8632* Releases any potentially allocated sub-information of the station8633* information, but not the struct itself (since it's typically on8634* the stack.)8635*/8636static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)8637{8638kfree(sinfo->pertid);86398640for (int link_id = 0; link_id < ARRAY_SIZE(sinfo->links); link_id++) {8641if (sinfo->links[link_id]) {8642kfree(sinfo->links[link_id]->pertid);8643kfree(sinfo->links[link_id]);8644}8645}8646}86478648/**8649* cfg80211_new_sta - notify userspace about station8650*8651* @dev: the netdev8652* @mac_addr: the station's address8653* @sinfo: the station information8654* @gfp: allocation flags8655*/8656void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,8657struct station_info *sinfo, gfp_t gfp);86588659/**8660* cfg80211_del_sta_sinfo - notify userspace about deletion of a station8661* @dev: the netdev8662* @mac_addr: the station's address. For MLD station, MLD address is used.8663* @sinfo: the station information/statistics8664* @gfp: allocation flags8665*/8666void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,8667struct station_info *sinfo, gfp_t gfp);86688669/**8670* cfg80211_del_sta - notify userspace about deletion of a station8671*8672* @dev: the netdev8673* @mac_addr: the station's address. For MLD station, MLD address is used.8674* @gfp: allocation flags8675*/8676static inline void cfg80211_del_sta(struct net_device *dev,8677const u8 *mac_addr, gfp_t gfp)8678{8679cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);8680}86818682/**8683* cfg80211_conn_failed - connection request failed notification8684*8685* @dev: the netdev8686* @mac_addr: the station's address8687* @reason: the reason for connection failure8688* @gfp: allocation flags8689*8690* Whenever a station tries to connect to an AP and if the station8691* could not connect to the AP as the AP has rejected the connection8692* for some reasons, this function is called.8693*8694* The reason for connection failure can be any of the value from8695* nl80211_connect_failed_reason enum8696*/8697void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,8698enum nl80211_connect_failed_reason reason,8699gfp_t gfp);87008701/**8702* struct cfg80211_rx_info - received management frame info8703*8704* @freq: Frequency on which the frame was received in kHz8705* @sig_dbm: signal strength in dBm, or 0 if unknown8706* @have_link_id: indicates the frame was received on a link of8707* an MLD, i.e. the @link_id field is valid8708* @link_id: the ID of the link the frame was received on8709* @buf: Management frame (header + body)8710* @len: length of the frame data8711* @flags: flags, as defined in &enum nl80211_rxmgmt_flags8712* @rx_tstamp: Hardware timestamp of frame RX in nanoseconds8713* @ack_tstamp: Hardware timestamp of ack TX in nanoseconds8714*/8715struct cfg80211_rx_info {8716int freq;8717int sig_dbm;8718bool have_link_id;8719u8 link_id;8720const u8 *buf;8721size_t len;8722u32 flags;8723u64 rx_tstamp;8724u64 ack_tstamp;8725};87268727/**8728* cfg80211_rx_mgmt_ext - management frame notification with extended info8729* @wdev: wireless device receiving the frame8730* @info: RX info as defined in struct cfg80211_rx_info8731*8732* This function is called whenever an Action frame is received for a station8733* mode interface, but is not processed in kernel.8734*8735* Return: %true if a user space application has registered for this frame.8736* For action frames, that makes it responsible for rejecting unrecognized8737* action frames; %false otherwise, in which case for action frames the8738* driver is responsible for rejecting the frame.8739*/8740bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,8741struct cfg80211_rx_info *info);87428743/**8744* cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame8745* @wdev: wireless device receiving the frame8746* @freq: Frequency on which the frame was received in KHz8747* @sig_dbm: signal strength in dBm, or 0 if unknown8748* @buf: Management frame (header + body)8749* @len: length of the frame data8750* @flags: flags, as defined in enum nl80211_rxmgmt_flags8751*8752* This function is called whenever an Action frame is received for a station8753* mode interface, but is not processed in kernel.8754*8755* Return: %true if a user space application has registered for this frame.8756* For action frames, that makes it responsible for rejecting unrecognized8757* action frames; %false otherwise, in which case for action frames the8758* driver is responsible for rejecting the frame.8759*/8760static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,8761int sig_dbm, const u8 *buf, size_t len,8762u32 flags)8763{8764struct cfg80211_rx_info info = {8765.freq = freq,8766.sig_dbm = sig_dbm,8767.buf = buf,8768.len = len,8769.flags = flags8770};87718772return cfg80211_rx_mgmt_ext(wdev, &info);8773}87748775/**8776* cfg80211_rx_mgmt - notification of received, unprocessed management frame8777* @wdev: wireless device receiving the frame8778* @freq: Frequency on which the frame was received in MHz8779* @sig_dbm: signal strength in dBm, or 0 if unknown8780* @buf: Management frame (header + body)8781* @len: length of the frame data8782* @flags: flags, as defined in enum nl80211_rxmgmt_flags8783*8784* This function is called whenever an Action frame is received for a station8785* mode interface, but is not processed in kernel.8786*8787* Return: %true if a user space application has registered for this frame.8788* For action frames, that makes it responsible for rejecting unrecognized8789* action frames; %false otherwise, in which case for action frames the8790* driver is responsible for rejecting the frame.8791*/8792static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,8793int sig_dbm, const u8 *buf, size_t len,8794u32 flags)8795{8796struct cfg80211_rx_info info = {8797.freq = MHZ_TO_KHZ(freq),8798.sig_dbm = sig_dbm,8799.buf = buf,8800.len = len,8801.flags = flags8802};88038804return cfg80211_rx_mgmt_ext(wdev, &info);8805}88068807/**8808* struct cfg80211_tx_status - TX status for management frame information8809*8810* @cookie: Cookie returned by cfg80211_ops::mgmt_tx()8811* @tx_tstamp: hardware TX timestamp in nanoseconds8812* @ack_tstamp: hardware ack RX timestamp in nanoseconds8813* @buf: Management frame (header + body)8814* @len: length of the frame data8815* @ack: Whether frame was acknowledged8816*/8817struct cfg80211_tx_status {8818u64 cookie;8819u64 tx_tstamp;8820u64 ack_tstamp;8821const u8 *buf;8822size_t len;8823bool ack;8824};88258826/**8827* cfg80211_mgmt_tx_status_ext - TX status notification with extended info8828* @wdev: wireless device receiving the frame8829* @status: TX status data8830* @gfp: context flags8831*8832* This function is called whenever a management frame was requested to be8833* transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the8834* transmission attempt with extended info.8835*/8836void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,8837struct cfg80211_tx_status *status, gfp_t gfp);88388839/**8840* cfg80211_mgmt_tx_status - notification of TX status for management frame8841* @wdev: wireless device receiving the frame8842* @cookie: Cookie returned by cfg80211_ops::mgmt_tx()8843* @buf: Management frame (header + body)8844* @len: length of the frame data8845* @ack: Whether frame was acknowledged8846* @gfp: context flags8847*8848* This function is called whenever a management frame was requested to be8849* transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the8850* transmission attempt.8851*/8852static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,8853u64 cookie, const u8 *buf,8854size_t len, bool ack, gfp_t gfp)8855{8856struct cfg80211_tx_status status = {8857.cookie = cookie,8858.buf = buf,8859.len = len,8860.ack = ack8861};88628863cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);8864}88658866/**8867* cfg80211_control_port_tx_status - notification of TX status for control8868* port frames8869* @wdev: wireless device receiving the frame8870* @cookie: Cookie returned by cfg80211_ops::tx_control_port()8871* @buf: Data frame (header + body)8872* @len: length of the frame data8873* @ack: Whether frame was acknowledged8874* @gfp: context flags8875*8876* This function is called whenever a control port frame was requested to be8877* transmitted with cfg80211_ops::tx_control_port() to report the TX status of8878* the transmission attempt.8879*/8880void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,8881const u8 *buf, size_t len, bool ack,8882gfp_t gfp);88838884/**8885* cfg80211_rx_control_port - notification about a received control port frame8886* @dev: The device the frame matched to8887* @skb: The skbuf with the control port frame. It is assumed that the skbuf8888* is 802.3 formatted (with 802.3 header). The skb can be non-linear.8889* This function does not take ownership of the skb, so the caller is8890* responsible for any cleanup. The caller must also ensure that8891* skb->protocol is set appropriately.8892* @unencrypted: Whether the frame was received unencrypted8893* @link_id: the link the frame was received on, -1 if not applicable or unknown8894*8895* This function is used to inform userspace about a received control port8896* frame. It should only be used if userspace indicated it wants to receive8897* control port frames over nl80211.8898*8899* The frame is the data portion of the 802.3 or 802.11 data frame with all8900* network layer headers removed (e.g. the raw EAPoL frame).8901*8902* Return: %true if the frame was passed to userspace8903*/8904bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,8905bool unencrypted, int link_id);89068907/**8908* cfg80211_cqm_rssi_notify - connection quality monitoring rssi event8909* @dev: network device8910* @rssi_event: the triggered RSSI event8911* @rssi_level: new RSSI level value or 0 if not available8912* @gfp: context flags8913*8914* This function is called when a configured connection quality monitoring8915* rssi threshold reached event occurs.8916*/8917void cfg80211_cqm_rssi_notify(struct net_device *dev,8918enum nl80211_cqm_rssi_threshold_event rssi_event,8919s32 rssi_level, gfp_t gfp);89208921/**8922* cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer8923* @dev: network device8924* @peer: peer's MAC address8925* @num_packets: how many packets were lost -- should be a fixed threshold8926* but probably no less than maybe 50, or maybe a throughput dependent8927* threshold (to account for temporary interference)8928* @gfp: context flags8929*/8930void cfg80211_cqm_pktloss_notify(struct net_device *dev,8931const u8 *peer, u32 num_packets, gfp_t gfp);89328933/**8934* cfg80211_cqm_txe_notify - TX error rate event8935* @dev: network device8936* @peer: peer's MAC address8937* @num_packets: how many packets were lost8938* @rate: % of packets which failed transmission8939* @intvl: interval (in s) over which the TX failure threshold was breached.8940* @gfp: context flags8941*8942* Notify userspace when configured % TX failures over number of packets in a8943* given interval is exceeded.8944*/8945void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,8946u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);89478948/**8949* cfg80211_cqm_beacon_loss_notify - beacon loss event8950* @dev: network device8951* @gfp: context flags8952*8953* Notify userspace about beacon loss from the connected AP.8954*/8955void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);89568957/**8958* __cfg80211_radar_event - radar detection event8959* @wiphy: the wiphy8960* @chandef: chandef for the current channel8961* @offchan: the radar has been detected on the offchannel chain8962* @gfp: context flags8963*8964* This function is called when a radar is detected on the current chanenl.8965*/8966void __cfg80211_radar_event(struct wiphy *wiphy,8967struct cfg80211_chan_def *chandef,8968bool offchan, gfp_t gfp);89698970static inline void8971cfg80211_radar_event(struct wiphy *wiphy,8972struct cfg80211_chan_def *chandef,8973gfp_t gfp)8974{8975__cfg80211_radar_event(wiphy, chandef, false, gfp);8976}89778978static inline void8979cfg80211_background_radar_event(struct wiphy *wiphy,8980struct cfg80211_chan_def *chandef,8981gfp_t gfp)8982{8983__cfg80211_radar_event(wiphy, chandef, true, gfp);8984}89858986/**8987* cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event8988* @dev: network device8989* @mac: MAC address of a station which opmode got modified8990* @sta_opmode: station's current opmode value8991* @gfp: context flags8992*8993* Driver should call this function when station's opmode modified via action8994* frame.8995*/8996void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,8997struct sta_opmode_info *sta_opmode,8998gfp_t gfp);89999000/**9001* cfg80211_cac_event - Channel availability check (CAC) event9002* @netdev: network device9003* @chandef: chandef for the current channel9004* @event: type of event9005* @gfp: context flags9006* @link_id: valid link_id for MLO operation or 0 otherwise.9007*9008* This function is called when a Channel availability check (CAC) is finished9009* or aborted. This must be called to notify the completion of a CAC process,9010* also by full-MAC drivers.9011*/9012void cfg80211_cac_event(struct net_device *netdev,9013const struct cfg80211_chan_def *chandef,9014enum nl80211_radar_event event, gfp_t gfp,9015unsigned int link_id);90169017/**9018* cfg80211_background_cac_abort - Channel Availability Check offchan abort event9019* @wiphy: the wiphy9020*9021* This function is called by the driver when a Channel Availability Check9022* (CAC) is aborted by a offchannel dedicated chain.9023*/9024void cfg80211_background_cac_abort(struct wiphy *wiphy);90259026/**9027* cfg80211_gtk_rekey_notify - notify userspace about driver rekeying9028* @dev: network device9029* @bssid: BSSID of AP (to avoid races)9030* @replay_ctr: new replay counter9031* @gfp: allocation flags9032*/9033void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,9034const u8 *replay_ctr, gfp_t gfp);90359036/**9037* cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate9038* @dev: network device9039* @index: candidate index (the smaller the index, the higher the priority)9040* @bssid: BSSID of AP9041* @preauth: Whether AP advertises support for RSN pre-authentication9042* @gfp: allocation flags9043*/9044void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,9045const u8 *bssid, bool preauth, gfp_t gfp);90469047/**9048* cfg80211_rx_spurious_frame - inform userspace about a spurious frame9049* @dev: The device the frame matched to9050* @link_id: the link the frame was received on, -1 if not applicable or unknown9051* @addr: the transmitter address9052* @gfp: context flags9053*9054* This function is used in AP mode (only!) to inform userspace that9055* a spurious class 3 frame was received, to be able to deauth the9056* sender.9057* Return: %true if the frame was passed to userspace (or this failed9058* for a reason other than not having a subscription.)9059*/9060bool cfg80211_rx_spurious_frame(struct net_device *dev, const u8 *addr,9061int link_id, gfp_t gfp);90629063/**9064* cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame9065* @dev: The device the frame matched to9066* @addr: the transmitter address9067* @link_id: the link the frame was received on, -1 if not applicable or unknown9068* @gfp: context flags9069*9070* This function is used in AP mode (only!) to inform userspace that9071* an associated station sent a 4addr frame but that wasn't expected.9072* It is allowed and desirable to send this event only once for each9073* station to avoid event flooding.9074* Return: %true if the frame was passed to userspace (or this failed9075* for a reason other than not having a subscription.)9076*/9077bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, const u8 *addr,9078int link_id, gfp_t gfp);90799080/**9081* cfg80211_probe_status - notify userspace about probe status9082* @dev: the device the probe was sent on9083* @addr: the address of the peer9084* @cookie: the cookie filled in @probe_client previously9085* @acked: indicates whether probe was acked or not9086* @ack_signal: signal strength (in dBm) of the ACK frame.9087* @is_valid_ack_signal: indicates the ack_signal is valid or not.9088* @gfp: allocation flags9089*/9090void cfg80211_probe_status(struct net_device *dev, const u8 *addr,9091u64 cookie, bool acked, s32 ack_signal,9092bool is_valid_ack_signal, gfp_t gfp);90939094/**9095* cfg80211_report_obss_beacon_khz - report beacon from other APs9096* @wiphy: The wiphy that received the beacon9097* @frame: the frame9098* @len: length of the frame9099* @freq: frequency the frame was received on in KHz9100* @sig_dbm: signal strength in dBm, or 0 if unknown9101*9102* Use this function to report to userspace when a beacon was9103* received. It is not useful to call this when there is no9104* netdev that is in AP/GO mode.9105*/9106void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,9107size_t len, int freq, int sig_dbm);91089109/**9110* cfg80211_report_obss_beacon - report beacon from other APs9111* @wiphy: The wiphy that received the beacon9112* @frame: the frame9113* @len: length of the frame9114* @freq: frequency the frame was received on9115* @sig_dbm: signal strength in dBm, or 0 if unknown9116*9117* Use this function to report to userspace when a beacon was9118* received. It is not useful to call this when there is no9119* netdev that is in AP/GO mode.9120*/9121static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,9122const u8 *frame, size_t len,9123int freq, int sig_dbm)9124{9125cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),9126sig_dbm);9127}91289129/**9130* struct cfg80211_beaconing_check_config - beacon check configuration9131* @iftype: the interface type to check for9132* @relax: allow IR-relaxation conditions to apply (e.g. another9133* interface connected already on the same channel)9134* NOTE: If this is set, wiphy mutex must be held.9135* @reg_power: &enum ieee80211_ap_reg_power value indicating the9136* advertised/used 6 GHz regulatory power setting9137*/9138struct cfg80211_beaconing_check_config {9139enum nl80211_iftype iftype;9140enum ieee80211_ap_reg_power reg_power;9141bool relax;9142};91439144/**9145* cfg80211_reg_check_beaconing - check if beaconing is allowed9146* @wiphy: the wiphy9147* @chandef: the channel definition9148* @cfg: additional parameters for the checking9149*9150* Return: %true if there is no secondary channel or the secondary channel(s)9151* can be used for beaconing (i.e. is not a radar channel etc.)9152*/9153bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,9154struct cfg80211_chan_def *chandef,9155struct cfg80211_beaconing_check_config *cfg);91569157/**9158* cfg80211_reg_can_beacon - check if beaconing is allowed9159* @wiphy: the wiphy9160* @chandef: the channel definition9161* @iftype: interface type9162*9163* Return: %true if there is no secondary channel or the secondary channel(s)9164* can be used for beaconing (i.e. is not a radar channel etc.)9165*/9166static inline bool9167cfg80211_reg_can_beacon(struct wiphy *wiphy,9168struct cfg80211_chan_def *chandef,9169enum nl80211_iftype iftype)9170{9171struct cfg80211_beaconing_check_config config = {9172.iftype = iftype,9173};91749175return cfg80211_reg_check_beaconing(wiphy, chandef, &config);9176}91779178/**9179* cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation9180* @wiphy: the wiphy9181* @chandef: the channel definition9182* @iftype: interface type9183*9184* Return: %true if there is no secondary channel or the secondary channel(s)9185* can be used for beaconing (i.e. is not a radar channel etc.). This version9186* also checks if IR-relaxation conditions apply, to allow beaconing under9187* more permissive conditions.9188*9189* Context: Requires the wiphy mutex to be held.9190*/9191static inline bool9192cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,9193struct cfg80211_chan_def *chandef,9194enum nl80211_iftype iftype)9195{9196struct cfg80211_beaconing_check_config config = {9197.iftype = iftype,9198.relax = true,9199};92009201return cfg80211_reg_check_beaconing(wiphy, chandef, &config);9202}92039204/**9205* cfg80211_ch_switch_notify - update wdev channel and notify userspace9206* @dev: the device which switched channels9207* @chandef: the new channel definition9208* @link_id: the link ID for MLO, must be 0 for non-MLO9209*9210* Caller must hold wiphy mutex, therefore must only be called from sleepable9211* driver context!9212*/9213void cfg80211_ch_switch_notify(struct net_device *dev,9214struct cfg80211_chan_def *chandef,9215unsigned int link_id);92169217/**9218* cfg80211_ch_switch_started_notify - notify channel switch start9219* @dev: the device on which the channel switch started9220* @chandef: the future channel definition9221* @link_id: the link ID for MLO, must be 0 for non-MLO9222* @count: the number of TBTTs until the channel switch happens9223* @quiet: whether or not immediate quiet was requested by the AP9224*9225* Inform the userspace about the channel switch that has just9226* started, so that it can take appropriate actions (eg. starting9227* channel switch on other vifs), if necessary.9228*/9229void cfg80211_ch_switch_started_notify(struct net_device *dev,9230struct cfg80211_chan_def *chandef,9231unsigned int link_id, u8 count,9232bool quiet);92339234/**9235* ieee80211_operating_class_to_band - convert operating class to band9236*9237* @operating_class: the operating class to convert9238* @band: band pointer to fill9239*9240* Return: %true if the conversion was successful, %false otherwise.9241*/9242bool ieee80211_operating_class_to_band(u8 operating_class,9243enum nl80211_band *band);92449245/**9246* ieee80211_operating_class_to_chandef - convert operating class to chandef9247*9248* @operating_class: the operating class to convert9249* @chan: the ieee80211_channel to convert9250* @chandef: a pointer to the resulting chandef9251*9252* Return: %true if the conversion was successful, %false otherwise.9253*/9254bool ieee80211_operating_class_to_chandef(u8 operating_class,9255struct ieee80211_channel *chan,9256struct cfg80211_chan_def *chandef);92579258/**9259* ieee80211_chandef_to_operating_class - convert chandef to operation class9260*9261* @chandef: the chandef to convert9262* @op_class: a pointer to the resulting operating class9263*9264* Return: %true if the conversion was successful, %false otherwise.9265*/9266bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,9267u8 *op_class);92689269/**9270* ieee80211_chandef_to_khz - convert chandef to frequency in KHz9271*9272* @chandef: the chandef to convert9273*9274* Return: the center frequency of chandef (1st segment) in KHz.9275*/9276static inline u329277ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)9278{9279return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;9280}92819282/**9283* cfg80211_tdls_oper_request - request userspace to perform TDLS operation9284* @dev: the device on which the operation is requested9285* @peer: the MAC address of the peer device9286* @oper: the requested TDLS operation (NL80211_TDLS_SETUP or9287* NL80211_TDLS_TEARDOWN)9288* @reason_code: the reason code for teardown request9289* @gfp: allocation flags9290*9291* This function is used to request userspace to perform TDLS operation that9292* requires knowledge of keys, i.e., link setup or teardown when the AP9293* connection uses encryption. This is optional mechanism for the driver to use9294* if it can automatically determine when a TDLS link could be useful (e.g.,9295* based on traffic and signal strength for a peer).9296*/9297void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,9298enum nl80211_tdls_operation oper,9299u16 reason_code, gfp_t gfp);93009301/**9302* cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)9303* @rate: given rate_info to calculate bitrate from9304*9305* Return: calculated bitrate9306*/9307u32 cfg80211_calculate_bitrate(struct rate_info *rate);93089309/**9310* cfg80211_unregister_wdev - remove the given wdev9311* @wdev: struct wireless_dev to remove9312*9313* This function removes the device so it can no longer be used. It is necessary9314* to call this function even when cfg80211 requests the removal of the device9315* by calling the del_virtual_intf() callback. The function must also be called9316* when the driver wishes to unregister the wdev, e.g. when the hardware device9317* is unbound from the driver.9318*9319* Context: Requires the RTNL and wiphy mutex to be held.9320*/9321void cfg80211_unregister_wdev(struct wireless_dev *wdev);93229323/**9324* cfg80211_register_netdevice - register the given netdev9325* @dev: the netdev to register9326*9327* Note: In contexts coming from cfg80211 callbacks, you must call this rather9328* than register_netdevice(), unregister_netdev() is impossible as the RTNL is9329* held. Otherwise, both register_netdevice() and register_netdev() are usable9330* instead as well.9331*9332* Context: Requires the RTNL and wiphy mutex to be held.9333*9334* Return: 0 on success. Non-zero on error.9335*/9336int cfg80211_register_netdevice(struct net_device *dev);93379338/**9339* cfg80211_unregister_netdevice - unregister the given netdev9340* @dev: the netdev to register9341*9342* Note: In contexts coming from cfg80211 callbacks, you must call this rather9343* than unregister_netdevice(), unregister_netdev() is impossible as the RTNL9344* is held. Otherwise, both unregister_netdevice() and unregister_netdev() are9345* usable instead as well.9346*9347* Context: Requires the RTNL and wiphy mutex to be held.9348*/9349static inline void cfg80211_unregister_netdevice(struct net_device *dev)9350{9351#if IS_ENABLED(CONFIG_CFG80211)9352cfg80211_unregister_wdev(dev->ieee80211_ptr);9353#endif9354}93559356/**9357* struct cfg80211_ft_event_params - FT Information Elements9358* @ies: FT IEs9359* @ies_len: length of the FT IE in bytes9360* @target_ap: target AP's MAC address9361* @ric_ies: RIC IE9362* @ric_ies_len: length of the RIC IE in bytes9363*/9364struct cfg80211_ft_event_params {9365const u8 *ies;9366size_t ies_len;9367const u8 *target_ap;9368const u8 *ric_ies;9369size_t ric_ies_len;9370};93719372/**9373* cfg80211_ft_event - notify userspace about FT IE and RIC IE9374* @netdev: network device9375* @ft_event: IE information9376*/9377void cfg80211_ft_event(struct net_device *netdev,9378struct cfg80211_ft_event_params *ft_event);93799380/**9381* cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer9382* @ies: the input IE buffer9383* @len: the input length9384* @attr: the attribute ID to find9385* @buf: output buffer, can be %NULL if the data isn't needed, e.g.9386* if the function is only called to get the needed buffer size9387* @bufsize: size of the output buffer9388*9389* The function finds a given P2P attribute in the (vendor) IEs and9390* copies its contents to the given buffer.9391*9392* Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is9393* malformed or the attribute can't be found (respectively), or the9394* length of the found attribute (which can be zero).9395*/9396int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,9397enum ieee80211_p2p_attr_id attr,9398u8 *buf, unsigned int bufsize);93999400/**9401* ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)9402* @ies: the IE buffer9403* @ielen: the length of the IE buffer9404* @ids: an array with element IDs that are allowed before9405* the split. A WLAN_EID_EXTENSION value means that the next9406* EID in the list is a sub-element of the EXTENSION IE.9407* @n_ids: the size of the element ID array9408* @after_ric: array IE types that come after the RIC element9409* @n_after_ric: size of the @after_ric array9410* @offset: offset where to start splitting in the buffer9411*9412* This function splits an IE buffer by updating the @offset9413* variable to point to the location where the buffer should be9414* split.9415*9416* It assumes that the given IE buffer is well-formed, this9417* has to be guaranteed by the caller!9418*9419* It also assumes that the IEs in the buffer are ordered9420* correctly, if not the result of using this function will not9421* be ordered correctly either, i.e. it does no reordering.9422*9423* Return: The offset where the next part of the buffer starts, which9424* may be @ielen if the entire (remainder) of the buffer should be9425* used.9426*/9427size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,9428const u8 *ids, int n_ids,9429const u8 *after_ric, int n_after_ric,9430size_t offset);94319432/**9433* ieee80211_ie_split - split an IE buffer according to ordering9434* @ies: the IE buffer9435* @ielen: the length of the IE buffer9436* @ids: an array with element IDs that are allowed before9437* the split. A WLAN_EID_EXTENSION value means that the next9438* EID in the list is a sub-element of the EXTENSION IE.9439* @n_ids: the size of the element ID array9440* @offset: offset where to start splitting in the buffer9441*9442* This function splits an IE buffer by updating the @offset9443* variable to point to the location where the buffer should be9444* split.9445*9446* It assumes that the given IE buffer is well-formed, this9447* has to be guaranteed by the caller!9448*9449* It also assumes that the IEs in the buffer are ordered9450* correctly, if not the result of using this function will not9451* be ordered correctly either, i.e. it does no reordering.9452*9453* Return: The offset where the next part of the buffer starts, which9454* may be @ielen if the entire (remainder) of the buffer should be9455* used.9456*/9457static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,9458const u8 *ids, int n_ids, size_t offset)9459{9460return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);9461}94629463/**9464* ieee80211_fragment_element - fragment the last element in skb9465* @skb: The skbuf that the element was added to9466* @len_pos: Pointer to length of the element to fragment9467* @frag_id: The element ID to use for fragments9468*9469* This function fragments all data after @len_pos, adding fragmentation9470* elements with the given ID as appropriate. The SKB will grow in size9471* accordingly.9472*/9473void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id);94749475/**9476* cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN9477* @wdev: the wireless device reporting the wakeup9478* @wakeup: the wakeup report9479* @gfp: allocation flags9480*9481* This function reports that the given device woke up. If it9482* caused the wakeup, report the reason(s), otherwise you may9483* pass %NULL as the @wakeup parameter to advertise that something9484* else caused the wakeup.9485*/9486void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,9487struct cfg80211_wowlan_wakeup *wakeup,9488gfp_t gfp);94899490/**9491* cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.9492*9493* @wdev: the wireless device for which critical protocol is stopped.9494* @gfp: allocation flags9495*9496* This function can be called by the driver to indicate it has reverted9497* operation back to normal. One reason could be that the duration given9498* by .crit_proto_start() has expired.9499*/9500void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);95019502/**9503* ieee80211_get_num_supported_channels - get number of channels device has9504* @wiphy: the wiphy9505*9506* Return: the number of channels supported by the device.9507*/9508unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);95099510/**9511* cfg80211_check_combinations - check interface combinations9512*9513* @wiphy: the wiphy9514* @params: the interface combinations parameter9515*9516* This function can be called by the driver to check whether a9517* combination of interfaces and their types are allowed according to9518* the interface combinations.9519*9520* Return: 0 if combinations are allowed. Non-zero on error.9521*/9522int cfg80211_check_combinations(struct wiphy *wiphy,9523struct iface_combination_params *params);95249525/**9526* cfg80211_iter_combinations - iterate over matching combinations9527*9528* @wiphy: the wiphy9529* @params: the interface combinations parameter9530* @iter: function to call for each matching combination9531* @data: pointer to pass to iter function9532*9533* This function can be called by the driver to check what possible9534* combinations it fits in at a given moment, e.g. for channel switching9535* purposes.9536*9537* Return: 0 on success. Non-zero on error.9538*/9539int cfg80211_iter_combinations(struct wiphy *wiphy,9540struct iface_combination_params *params,9541void (*iter)(const struct ieee80211_iface_combination *c,9542void *data),9543void *data);9544/**9545* cfg80211_get_radio_idx_by_chan - get the radio index by the channel9546*9547* @wiphy: the wiphy9548* @chan: channel for which the supported radio index is required9549*9550* Return: radio index on success or a negative error code9551*/9552int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy,9553const struct ieee80211_channel *chan);955495559556/**9557* cfg80211_stop_iface - trigger interface disconnection9558*9559* @wiphy: the wiphy9560* @wdev: wireless device9561* @gfp: context flags9562*9563* Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA9564* disconnected.9565*9566* Note: This doesn't need any locks and is asynchronous.9567*/9568void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,9569gfp_t gfp);95709571/**9572* cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy9573* @wiphy: the wiphy to shut down9574*9575* This function shuts down all interfaces belonging to this wiphy by9576* calling dev_close() (and treating non-netdev interfaces as needed).9577* It shouldn't really be used unless there are some fatal device errors9578* that really can't be recovered in any other way.9579*9580* Callers must hold the RTNL and be able to deal with callbacks into9581* the driver while the function is running.9582*/9583void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);95849585/**9586* wiphy_ext_feature_set - set the extended feature flag9587*9588* @wiphy: the wiphy to modify.9589* @ftidx: extended feature bit index.9590*9591* The extended features are flagged in multiple bytes (see9592* &struct wiphy.@ext_features)9593*/9594static inline void wiphy_ext_feature_set(struct wiphy *wiphy,9595enum nl80211_ext_feature_index ftidx)9596{9597u8 *ft_byte;95989599ft_byte = &wiphy->ext_features[ftidx / 8];9600*ft_byte |= BIT(ftidx % 8);9601}96029603/**9604* wiphy_ext_feature_isset - check the extended feature flag9605*9606* @wiphy: the wiphy to modify.9607* @ftidx: extended feature bit index.9608*9609* The extended features are flagged in multiple bytes (see9610* &struct wiphy.@ext_features)9611*9612* Return: %true if extended feature flag is set, %false otherwise9613*/9614static inline bool9615wiphy_ext_feature_isset(struct wiphy *wiphy,9616enum nl80211_ext_feature_index ftidx)9617{9618u8 ft_byte;96199620ft_byte = wiphy->ext_features[ftidx / 8];9621return (ft_byte & BIT(ftidx % 8)) != 0;9622}96239624/**9625* cfg80211_free_nan_func - free NAN function9626* @f: NAN function that should be freed9627*9628* Frees all the NAN function and all it's allocated members.9629*/9630void cfg80211_free_nan_func(struct cfg80211_nan_func *f);96319632/**9633* struct cfg80211_nan_match_params - NAN match parameters9634* @type: the type of the function that triggered a match. If it is9635* %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.9636* If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery9637* result.9638* If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.9639* @inst_id: the local instance id9640* @peer_inst_id: the instance id of the peer's function9641* @addr: the MAC address of the peer9642* @info_len: the length of the &info9643* @info: the Service Specific Info from the peer (if any)9644* @cookie: unique identifier of the corresponding function9645*/9646struct cfg80211_nan_match_params {9647enum nl80211_nan_function_type type;9648u8 inst_id;9649u8 peer_inst_id;9650const u8 *addr;9651u8 info_len;9652const u8 *info;9653u64 cookie;9654};96559656/**9657* cfg80211_nan_match - report a match for a NAN function.9658* @wdev: the wireless device reporting the match9659* @match: match notification parameters9660* @gfp: allocation flags9661*9662* This function reports that the a NAN function had a match. This9663* can be a subscribe that had a match or a solicited publish that9664* was sent. It can also be a follow up that was received.9665*/9666void cfg80211_nan_match(struct wireless_dev *wdev,9667struct cfg80211_nan_match_params *match, gfp_t gfp);96689669/**9670* cfg80211_nan_func_terminated - notify about NAN function termination.9671*9672* @wdev: the wireless device reporting the match9673* @inst_id: the local instance id9674* @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)9675* @cookie: unique NAN function identifier9676* @gfp: allocation flags9677*9678* This function reports that the a NAN function is terminated.9679*/9680void cfg80211_nan_func_terminated(struct wireless_dev *wdev,9681u8 inst_id,9682enum nl80211_nan_func_term_reason reason,9683u64 cookie, gfp_t gfp);96849685/* ethtool helper */9686void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);96879688/**9689* cfg80211_external_auth_request - userspace request for authentication9690* @netdev: network device9691* @params: External authentication parameters9692* @gfp: allocation flags9693* Returns: 0 on success, < 0 on error9694*/9695int cfg80211_external_auth_request(struct net_device *netdev,9696struct cfg80211_external_auth_params *params,9697gfp_t gfp);96989699/**9700* cfg80211_pmsr_report - report peer measurement result data9701* @wdev: the wireless device reporting the measurement9702* @req: the original measurement request9703* @result: the result data9704* @gfp: allocation flags9705*/9706void cfg80211_pmsr_report(struct wireless_dev *wdev,9707struct cfg80211_pmsr_request *req,9708struct cfg80211_pmsr_result *result,9709gfp_t gfp);97109711/**9712* cfg80211_pmsr_complete - report peer measurement completed9713* @wdev: the wireless device reporting the measurement9714* @req: the original measurement request9715* @gfp: allocation flags9716*9717* Report that the entire measurement completed, after this9718* the request pointer will no longer be valid.9719*/9720void cfg80211_pmsr_complete(struct wireless_dev *wdev,9721struct cfg80211_pmsr_request *req,9722gfp_t gfp);97239724/**9725* cfg80211_iftype_allowed - check whether the interface can be allowed9726* @wiphy: the wiphy9727* @iftype: interface type9728* @is_4addr: use_4addr flag, must be '0' when check_swif is '1'9729* @check_swif: check iftype against software interfaces9730*9731* Check whether the interface is allowed to operate; additionally, this API9732* can be used to check iftype against the software interfaces when9733* check_swif is '1'.9734*9735* Return: %true if allowed, %false otherwise9736*/9737bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,9738bool is_4addr, u8 check_swif);973997409741/**9742* cfg80211_assoc_comeback - notification of association that was9743* temporarily rejected with a comeback9744* @netdev: network device9745* @ap_addr: AP (MLD) address that rejected the association9746* @timeout: timeout interval value TUs.9747*9748* this function may sleep. the caller must hold the corresponding wdev's mutex.9749*/9750void cfg80211_assoc_comeback(struct net_device *netdev,9751const u8 *ap_addr, u32 timeout);97529753/* Logging, debugging and troubleshooting/diagnostic helpers. */97549755/* wiphy_printk helpers, similar to dev_printk */97569757#define wiphy_printk(level, wiphy, format, args...) \9758dev_printk(level, &(wiphy)->dev, format, ##args)9759#define wiphy_emerg(wiphy, format, args...) \9760dev_emerg(&(wiphy)->dev, format, ##args)9761#define wiphy_alert(wiphy, format, args...) \9762dev_alert(&(wiphy)->dev, format, ##args)9763#define wiphy_crit(wiphy, format, args...) \9764dev_crit(&(wiphy)->dev, format, ##args)9765#define wiphy_err(wiphy, format, args...) \9766dev_err(&(wiphy)->dev, format, ##args)9767#define wiphy_warn(wiphy, format, args...) \9768dev_warn(&(wiphy)->dev, format, ##args)9769#define wiphy_notice(wiphy, format, args...) \9770dev_notice(&(wiphy)->dev, format, ##args)9771#define wiphy_info(wiphy, format, args...) \9772dev_info(&(wiphy)->dev, format, ##args)9773#define wiphy_info_once(wiphy, format, args...) \9774dev_info_once(&(wiphy)->dev, format, ##args)97759776#define wiphy_err_ratelimited(wiphy, format, args...) \9777dev_err_ratelimited(&(wiphy)->dev, format, ##args)9778#define wiphy_warn_ratelimited(wiphy, format, args...) \9779dev_warn_ratelimited(&(wiphy)->dev, format, ##args)97809781#define wiphy_debug(wiphy, format, args...) \9782wiphy_printk(KERN_DEBUG, wiphy, format, ##args)97839784#define wiphy_dbg(wiphy, format, args...) \9785dev_dbg(&(wiphy)->dev, format, ##args)97869787#if defined(VERBOSE_DEBUG)9788#define wiphy_vdbg wiphy_dbg9789#else9790#define wiphy_vdbg(wiphy, format, args...) \9791({ \9792if (0) \9793wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \97940; \9795})9796#endif97979798/*9799* wiphy_WARN() acts like wiphy_printk(), but with the key difference9800* of using a WARN/WARN_ON to get the message out, including the9801* file/line information and a backtrace.9802*/9803#define wiphy_WARN(wiphy, format, args...) \9804WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);98059806/**9807* cfg80211_update_owe_info_event - Notify the peer's OWE info to user space9808* @netdev: network device9809* @owe_info: peer's owe info9810* @gfp: allocation flags9811*/9812void cfg80211_update_owe_info_event(struct net_device *netdev,9813struct cfg80211_update_owe_info *owe_info,9814gfp_t gfp);98159816/**9817* cfg80211_bss_flush - resets all the scan entries9818* @wiphy: the wiphy9819*/9820void cfg80211_bss_flush(struct wiphy *wiphy);98219822/**9823* cfg80211_bss_color_notify - notify about bss color event9824* @dev: network device9825* @cmd: the actual event we want to notify9826* @count: the number of TBTTs until the color change happens9827* @color_bitmap: representations of the colors that the local BSS is aware of9828* @link_id: valid link_id in case of MLO or 0 for non-MLO.9829*9830* Return: 0 on success. Non-zero on error.9831*/9832int cfg80211_bss_color_notify(struct net_device *dev,9833enum nl80211_commands cmd, u8 count,9834u64 color_bitmap, u8 link_id);98359836/**9837* cfg80211_obss_color_collision_notify - notify about bss color collision9838* @dev: network device9839* @color_bitmap: representations of the colors that the local BSS is aware of9840* @link_id: valid link_id in case of MLO or 0 for non-MLO.9841*9842* Return: 0 on success. Non-zero on error.9843*/9844static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,9845u64 color_bitmap,9846u8 link_id)9847{9848return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION,98490, color_bitmap, link_id);9850}98519852/**9853* cfg80211_color_change_started_notify - notify color change start9854* @dev: the device on which the color is switched9855* @count: the number of TBTTs until the color change happens9856* @link_id: valid link_id in case of MLO or 0 for non-MLO.9857*9858* Inform the userspace about the color change that has started.9859*9860* Return: 0 on success. Non-zero on error.9861*/9862static inline int cfg80211_color_change_started_notify(struct net_device *dev,9863u8 count, u8 link_id)9864{9865return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED,9866count, 0, link_id);9867}98689869/**9870* cfg80211_color_change_aborted_notify - notify color change abort9871* @dev: the device on which the color is switched9872* @link_id: valid link_id in case of MLO or 0 for non-MLO.9873*9874* Inform the userspace about the color change that has aborted.9875*9876* Return: 0 on success. Non-zero on error.9877*/9878static inline int cfg80211_color_change_aborted_notify(struct net_device *dev,9879u8 link_id)9880{9881return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED,98820, 0, link_id);9883}98849885/**9886* cfg80211_color_change_notify - notify color change completion9887* @dev: the device on which the color was switched9888* @link_id: valid link_id in case of MLO or 0 for non-MLO.9889*9890* Inform the userspace about the color change that has completed.9891*9892* Return: 0 on success. Non-zero on error.9893*/9894static inline int cfg80211_color_change_notify(struct net_device *dev,9895u8 link_id)9896{9897return cfg80211_bss_color_notify(dev,9898NL80211_CMD_COLOR_CHANGE_COMPLETED,98990, 0, link_id);9900}99019902/**9903* cfg80211_links_removed - Notify about removed STA MLD setup links.9904* @dev: network device.9905* @link_mask: BIT mask of removed STA MLD setup link IDs.9906*9907* Inform cfg80211 and the userspace about removed STA MLD setup links due to9908* AP MLD removing the corresponding affiliated APs with Multi-Link9909* reconfiguration. Note that it's not valid to remove all links, in this9910* case disconnect instead.9911* Also note that the wdev mutex must be held.9912*/9913void cfg80211_links_removed(struct net_device *dev, u16 link_mask);99149915/**9916* struct cfg80211_mlo_reconf_done_data - MLO reconfiguration data9917* @buf: MLO Reconfiguration Response frame (header + body)9918* @len: length of the frame data9919* @driver_initiated: Indicates whether the add links request is initiated by9920* driver. This is set to true when the link reconfiguration request9921* initiated by driver due to AP link recommendation requests9922* (Ex: BTM (BSS Transition Management) request) handling offloaded to9923* driver.9924* @added_links: BIT mask of links successfully added to the association9925* @links: per-link information indexed by link ID9926* @links.bss: the BSS that MLO reconfiguration was requested for, ownership of9927* the pointer moves to cfg80211 in the call to9928* cfg80211_mlo_reconf_add_done().9929*9930* The BSS pointer must be set for each link for which 'add' operation was9931* requested in the assoc_ml_reconf callback.9932*/9933struct cfg80211_mlo_reconf_done_data {9934const u8 *buf;9935size_t len;9936bool driver_initiated;9937u16 added_links;9938struct {9939struct cfg80211_bss *bss;9940u8 *addr;9941} links[IEEE80211_MLD_MAX_NUM_LINKS];9942};99439944/**9945* cfg80211_mlo_reconf_add_done - Notify about MLO reconfiguration result9946* @dev: network device.9947* @data: MLO reconfiguration done data, &struct cfg80211_mlo_reconf_done_data9948*9949* Inform cfg80211 and the userspace that processing of ML reconfiguration9950* request to add links to the association is done.9951*/9952void cfg80211_mlo_reconf_add_done(struct net_device *dev,9953struct cfg80211_mlo_reconf_done_data *data);99549955/**9956* cfg80211_schedule_channels_check - schedule regulatory check if needed9957* @wdev: the wireless device to check9958*9959* In case the device supports NO_IR or DFS relaxations, schedule regulatory9960* channels check, as previous concurrent operation conditions may not9961* hold anymore.9962*/9963void cfg80211_schedule_channels_check(struct wireless_dev *wdev);99649965/**9966* cfg80211_epcs_changed - Notify about a change in EPCS state9967* @netdev: the wireless device whose EPCS state changed9968* @enabled: set to true if EPCS was enabled, otherwise set to false.9969*/9970void cfg80211_epcs_changed(struct net_device *netdev, bool enabled);99719972#ifdef CONFIG_CFG80211_DEBUGFS9973/**9974* wiphy_locked_debugfs_read - do a locked read in debugfs9975* @wiphy: the wiphy to use9976* @file: the file being read9977* @buf: the buffer to fill and then read from9978* @bufsize: size of the buffer9979* @userbuf: the user buffer to copy to9980* @count: read count9981* @ppos: read position9982* @handler: the read handler to call (under wiphy lock)9983* @data: additional data to pass to the read handler9984*9985* Return: the number of characters read, or a negative errno9986*/9987ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,9988char *buf, size_t bufsize,9989char __user *userbuf, size_t count,9990loff_t *ppos,9991ssize_t (*handler)(struct wiphy *wiphy,9992struct file *file,9993char *buf,9994size_t bufsize,9995void *data),9996void *data);99979998/**9999* wiphy_locked_debugfs_write - do a locked write in debugfs10000* @wiphy: the wiphy to use10001* @file: the file being written to10002* @buf: the buffer to copy the user data to10003* @bufsize: size of the buffer10004* @userbuf: the user buffer to copy from10005* @count: read count10006* @handler: the write handler to call (under wiphy lock)10007* @data: additional data to pass to the write handler10008*10009* Return: the number of characters written, or a negative errno10010*/10011ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file,10012char *buf, size_t bufsize,10013const char __user *userbuf, size_t count,10014ssize_t (*handler)(struct wiphy *wiphy,10015struct file *file,10016char *buf,10017size_t count,10018void *data),10019void *data);10020#endif1002110022#endif /* __NET_CFG80211_H */100231002410025