/* 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_NO_320MHZ: If the driver supports 320 MHz on the band,104* this flag indicates that a 320 MHz channel cannot use this105* channel as the control or any of the secondary channels.106* This may be due to the driver or due to regulatory bandwidth107* restrictions.108* @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel.109* @IEEE80211_CHAN_DFS_CONCURRENT: See %NL80211_RRF_DFS_CONCURRENT110* @IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT: Client connection with VLP AP111* not permitted using this channel112* @IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT: Client connection with AFC AP113* not permitted using this channel114* @IEEE80211_CHAN_CAN_MONITOR: This channel can be used for monitor115* mode even in the presence of other (regulatory) restrictions,116* even if it is otherwise disabled.117* @IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP: Allow using this channel for AP operation118* with very low power (VLP), even if otherwise set to NO_IR.119* @IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY: Allow activity on a 20 MHz channel,120* even if otherwise set to NO_IR.121* @IEEE80211_CHAN_S1G_NO_PRIMARY: Prevents the channel for use as an S1G122* primary channel. Does not prevent the wider operating channel123* described by the chandef from being used. In order for a 2MHz primary124* to be used, both 1MHz subchannels shall not contain this flag.125* @IEEE80211_CHAN_NO_4MHZ: 4 MHz bandwidth is not permitted on this channel.126* @IEEE80211_CHAN_NO_8MHZ: 8 MHz bandwidth is not permitted on this channel.127* @IEEE80211_CHAN_NO_16MHZ: 16 MHz bandwidth is not permitted on this channel.128*/129enum ieee80211_channel_flags {130IEEE80211_CHAN_DISABLED = BIT(0),131IEEE80211_CHAN_NO_IR = BIT(1),132IEEE80211_CHAN_PSD = BIT(2),133IEEE80211_CHAN_RADAR = BIT(3),134IEEE80211_CHAN_NO_HT40PLUS = BIT(4),135IEEE80211_CHAN_NO_HT40MINUS = BIT(5),136IEEE80211_CHAN_NO_OFDM = BIT(6),137IEEE80211_CHAN_NO_80MHZ = BIT(7),138IEEE80211_CHAN_NO_160MHZ = BIT(8),139IEEE80211_CHAN_INDOOR_ONLY = BIT(9),140IEEE80211_CHAN_IR_CONCURRENT = BIT(10),141IEEE80211_CHAN_NO_20MHZ = BIT(11),142IEEE80211_CHAN_NO_10MHZ = BIT(12),143IEEE80211_CHAN_NO_HE = BIT(13),144/* can use free bits here */145IEEE80211_CHAN_NO_320MHZ = BIT(19),146IEEE80211_CHAN_NO_EHT = BIT(20),147IEEE80211_CHAN_DFS_CONCURRENT = BIT(21),148IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT = BIT(22),149IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT = BIT(23),150IEEE80211_CHAN_CAN_MONITOR = BIT(24),151IEEE80211_CHAN_ALLOW_6GHZ_VLP_AP = BIT(25),152IEEE80211_CHAN_ALLOW_20MHZ_ACTIVITY = BIT(26),153IEEE80211_CHAN_S1G_NO_PRIMARY = BIT(27),154IEEE80211_CHAN_NO_4MHZ = BIT(28),155IEEE80211_CHAN_NO_8MHZ = BIT(29),156IEEE80211_CHAN_NO_16MHZ = BIT(30),157};158159#define IEEE80211_CHAN_NO_HT40 \160(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)161162#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000163#define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)164165/**166* struct ieee80211_channel - channel definition167*168* This structure describes a single channel for use169* with cfg80211.170*171* @center_freq: center frequency in MHz172* @freq_offset: offset from @center_freq, in KHz173* @hw_value: hardware-specific value for the channel174* @flags: channel flags from &enum ieee80211_channel_flags.175* @orig_flags: channel flags at registration time, used by regulatory176* code to support devices with additional restrictions177* @band: band this channel belongs to.178* @max_antenna_gain: maximum antenna gain in dBi179* @max_power: maximum transmission power (in dBm)180* @max_reg_power: maximum regulatory transmission power (in dBm)181* @beacon_found: helper to regulatory code to indicate when a beacon182* has been found on this channel. Use regulatory_hint_found_beacon()183* to enable this, this is useful only on 5 GHz band.184* @orig_mag: internal use185* @orig_mpwr: internal use186* @dfs_state: current state of this channel. Only relevant if radar is required187* on this channel.188* @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.189* @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.190* @psd: power spectral density (in dBm)191*/192struct ieee80211_channel {193enum nl80211_band band;194u32 center_freq;195u16 freq_offset;196u16 hw_value;197u32 flags;198int max_antenna_gain;199int max_power;200int max_reg_power;201bool beacon_found;202u32 orig_flags;203int orig_mag, orig_mpwr;204enum nl80211_dfs_state dfs_state;205unsigned long dfs_state_entered;206unsigned int dfs_cac_ms;207s8 psd;208};209210/**211* enum ieee80211_rate_flags - rate flags212*213* Hardware/specification flags for rates. These are structured214* in a way that allows using the same bitrate structure for215* different bands/PHY modes.216*217* @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short218* preamble on this bitrate; only relevant in 2.4GHz band and219* with CCK rates.220* @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate221* when used with 802.11a (on the 5 GHz band); filled by the222* core code when registering the wiphy.223* @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate224* when used with 802.11b (on the 2.4 GHz band); filled by the225* core code when registering the wiphy.226* @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate227* when used with 802.11g (on the 2.4 GHz band); filled by the228* core code when registering the wiphy.229* @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.230* @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode231* @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode232*/233enum ieee80211_rate_flags {234IEEE80211_RATE_SHORT_PREAMBLE = BIT(0),235IEEE80211_RATE_MANDATORY_A = BIT(1),236IEEE80211_RATE_MANDATORY_B = BIT(2),237IEEE80211_RATE_MANDATORY_G = BIT(3),238IEEE80211_RATE_ERP_G = BIT(4),239IEEE80211_RATE_SUPPORTS_5MHZ = BIT(5),240IEEE80211_RATE_SUPPORTS_10MHZ = BIT(6),241};242243/**244* enum ieee80211_bss_type - BSS type filter245*246* @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS247* @IEEE80211_BSS_TYPE_PBSS: Personal BSS248* @IEEE80211_BSS_TYPE_IBSS: Independent BSS249* @IEEE80211_BSS_TYPE_MBSS: Mesh BSS250* @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type251*/252enum ieee80211_bss_type {253IEEE80211_BSS_TYPE_ESS,254IEEE80211_BSS_TYPE_PBSS,255IEEE80211_BSS_TYPE_IBSS,256IEEE80211_BSS_TYPE_MBSS,257IEEE80211_BSS_TYPE_ANY258};259260/**261* enum ieee80211_privacy - BSS privacy filter262*263* @IEEE80211_PRIVACY_ON: privacy bit set264* @IEEE80211_PRIVACY_OFF: privacy bit clear265* @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting266*/267enum ieee80211_privacy {268IEEE80211_PRIVACY_ON,269IEEE80211_PRIVACY_OFF,270IEEE80211_PRIVACY_ANY271};272273#define IEEE80211_PRIVACY(x) \274((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)275276/**277* struct ieee80211_rate - bitrate definition278*279* This structure describes a bitrate that an 802.11 PHY can280* operate with. The two values @hw_value and @hw_value_short281* are only for driver use when pointers to this structure are282* passed around.283*284* @flags: rate-specific flags from &enum ieee80211_rate_flags285* @bitrate: bitrate in units of 100 Kbps286* @hw_value: driver/hardware value for this rate287* @hw_value_short: driver/hardware value for this rate when288* short preamble is used289*/290struct ieee80211_rate {291u32 flags;292u16 bitrate;293u16 hw_value, hw_value_short;294};295296/**297* struct ieee80211_he_obss_pd - AP settings for spatial reuse298*299* @enable: is the feature enabled.300* @sr_ctrl: The SR Control field of SRP element.301* @non_srg_max_offset: non-SRG maximum tx power offset302* @min_offset: minimal tx power offset an associated station shall use303* @max_offset: maximum tx power offset an associated station shall use304* @bss_color_bitmap: bitmap that indicates the BSS color values used by305* members of the SRG306* @partial_bssid_bitmap: bitmap that indicates the partial BSSID values307* used by members of the SRG308*/309struct ieee80211_he_obss_pd {310bool enable;311u8 sr_ctrl;312u8 non_srg_max_offset;313u8 min_offset;314u8 max_offset;315u8 bss_color_bitmap[8];316u8 partial_bssid_bitmap[8];317};318319/**320* struct cfg80211_he_bss_color - AP settings for BSS coloring321*322* @color: the current color.323* @enabled: HE BSS color is used324* @partial: define the AID equation.325*/326struct cfg80211_he_bss_color {327u8 color;328bool enabled;329bool partial;330};331332/**333* struct ieee80211_sta_ht_cap - STA's HT capabilities334*335* This structure describes most essential parameters needed336* to describe 802.11n HT capabilities for an STA.337*338* @ht_supported: is HT supported by the STA339* @cap: HT capabilities map as described in 802.11n spec340* @ampdu_factor: Maximum A-MPDU length factor341* @ampdu_density: Minimum A-MPDU spacing342* @mcs: Supported MCS rates343*/344struct ieee80211_sta_ht_cap {345u16 cap; /* use IEEE80211_HT_CAP_ */346bool ht_supported;347u8 ampdu_factor;348u8 ampdu_density;349struct ieee80211_mcs_info mcs;350};351352/**353* struct ieee80211_sta_vht_cap - STA's VHT capabilities354*355* This structure describes most essential parameters needed356* to describe 802.11ac VHT capabilities for an STA.357*358* @vht_supported: is VHT supported by the STA359* @cap: VHT capabilities map as described in 802.11ac spec360* @vht_mcs: Supported VHT MCS rates361*/362struct ieee80211_sta_vht_cap {363bool vht_supported;364u32 cap; /* use IEEE80211_VHT_CAP_ */365struct ieee80211_vht_mcs_info vht_mcs;366};367368#define IEEE80211_HE_PPE_THRES_MAX_LEN 25369370/**371* struct ieee80211_sta_he_cap - STA's HE capabilities372*373* This structure describes most essential parameters needed374* to describe 802.11ax HE capabilities for a STA.375*376* @has_he: true iff HE data is valid.377* @he_cap_elem: Fixed portion of the HE capabilities element.378* @he_mcs_nss_supp: The supported NSS/MCS combinations.379* @ppe_thres: Holds the PPE Thresholds data.380*/381struct ieee80211_sta_he_cap {382bool has_he;383struct ieee80211_he_cap_elem he_cap_elem;384struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;385u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];386};387388/**389* struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS390*391* See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS392* and NSS Set field"393*394* @only_20mhz: MCS/NSS support for 20 MHz-only STA.395* @bw: MCS/NSS support for 80, 160 and 320 MHz396* @bw._80: MCS/NSS support for BW <= 80 MHz397* @bw._160: MCS/NSS support for BW = 160 MHz398* @bw._320: MCS/NSS support for BW = 320 MHz399*/400struct ieee80211_eht_mcs_nss_supp {401union {402struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;403struct {404struct ieee80211_eht_mcs_nss_supp_bw _80;405struct ieee80211_eht_mcs_nss_supp_bw _160;406struct ieee80211_eht_mcs_nss_supp_bw _320;407} __packed bw;408} __packed;409} __packed;410411#define IEEE80211_EHT_PPE_THRES_MAX_LEN 32412413/**414* struct ieee80211_sta_eht_cap - STA's EHT capabilities415*416* This structure describes most essential parameters needed417* to describe 802.11be EHT capabilities for a STA.418*419* @has_eht: true iff EHT data is valid.420* @eht_cap_elem: Fixed portion of the eht capabilities element.421* @eht_mcs_nss_supp: The supported NSS/MCS combinations.422* @eht_ppe_thres: Holds the PPE Thresholds data.423*/424struct ieee80211_sta_eht_cap {425bool has_eht;426struct ieee80211_eht_cap_elem_fixed eht_cap_elem;427struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;428u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];429};430431/* sparse defines __CHECKER__; see Documentation/dev-tools/sparse.rst */432#ifdef __CHECKER__433/*434* This is used to mark the sband->iftype_data pointer which is supposed435* to be an array with special access semantics (per iftype), but a lot436* of code got it wrong in the past, so with this marking sparse will be437* noisy when the pointer is used directly.438*/439# define __iftd __attribute__((noderef, address_space(__iftype_data)))440#else441# define __iftd442#endif /* __CHECKER__ */443444/**445* struct ieee80211_sband_iftype_data - sband data per interface type446*447* This structure encapsulates sband data that is relevant for the448* interface types defined in @types_mask. Each type in the449* @types_mask must be unique across all instances of iftype_data.450*451* @types_mask: interface types mask452* @he_cap: holds the HE capabilities453* @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a454* 6 GHz band channel (and 0 may be valid value).455* @eht_cap: STA's EHT capabilities456* @vendor_elems: vendor element(s) to advertise457* @vendor_elems.data: vendor element(s) data458* @vendor_elems.len: vendor element(s) length459*/460struct ieee80211_sband_iftype_data {461u16 types_mask;462struct ieee80211_sta_he_cap he_cap;463struct ieee80211_he_6ghz_capa he_6ghz_capa;464struct ieee80211_sta_eht_cap eht_cap;465struct {466const u8 *data;467unsigned int len;468} vendor_elems;469};470471/**472* enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations473*474* @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz475* @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz476* @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz477* @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz478* @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz479* @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz480* @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz481* @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and482* 2.16GHz+2.16GHz483* @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and484* 4.32GHz + 4.32GHz485* @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and486* 4.32GHz + 4.32GHz487* @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz488* and 4.32GHz + 4.32GHz489* @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,490* 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz491*/492enum ieee80211_edmg_bw_config {493IEEE80211_EDMG_BW_CONFIG_4 = 4,494IEEE80211_EDMG_BW_CONFIG_5 = 5,495IEEE80211_EDMG_BW_CONFIG_6 = 6,496IEEE80211_EDMG_BW_CONFIG_7 = 7,497IEEE80211_EDMG_BW_CONFIG_8 = 8,498IEEE80211_EDMG_BW_CONFIG_9 = 9,499IEEE80211_EDMG_BW_CONFIG_10 = 10,500IEEE80211_EDMG_BW_CONFIG_11 = 11,501IEEE80211_EDMG_BW_CONFIG_12 = 12,502IEEE80211_EDMG_BW_CONFIG_13 = 13,503IEEE80211_EDMG_BW_CONFIG_14 = 14,504IEEE80211_EDMG_BW_CONFIG_15 = 15,505};506507/**508* struct ieee80211_edmg - EDMG configuration509*510* This structure describes most essential parameters needed511* to describe 802.11ay EDMG configuration512*513* @channels: bitmap that indicates the 2.16 GHz channel(s)514* that are allowed to be used for transmissions.515* Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.516* Set to 0 indicate EDMG not supported.517* @bw_config: Channel BW Configuration subfield encodes518* the allowed channel bandwidth configurations519*/520struct ieee80211_edmg {521u8 channels;522enum ieee80211_edmg_bw_config bw_config;523};524525/**526* struct ieee80211_sta_s1g_cap - STA's S1G capabilities527*528* This structure describes most essential parameters needed529* to describe 802.11ah S1G capabilities for a STA.530*531* @s1g: is STA an S1G STA532* @cap: S1G capabilities information533* @nss_mcs: Supported NSS MCS set534*/535struct ieee80211_sta_s1g_cap {536bool s1g;537u8 cap[10]; /* use S1G_CAPAB_ */538u8 nss_mcs[5];539};540541/**542* struct ieee80211_supported_band - frequency band definition543*544* This structure describes a frequency band a wiphy545* is able to operate in.546*547* @channels: Array of channels the hardware can operate with548* in this band.549* @band: the band this structure represents550* @n_channels: Number of channels in @channels551* @bitrates: Array of bitrates the hardware can operate with552* in this band. Must be sorted to give a valid "supported553* rates" IE, i.e. CCK rates first, then OFDM.554* @n_bitrates: Number of bitrates in @bitrates555* @ht_cap: HT capabilities in this band556* @vht_cap: VHT capabilities in this band557* @s1g_cap: S1G capabilities in this band558* @edmg_cap: EDMG capabilities in this band559* @s1g_cap: S1G capabilities in this band (S1G band only, of course)560* @n_iftype_data: number of iftype data entries561* @iftype_data: interface type data entries. Note that the bits in562* @types_mask inside this structure cannot overlap (i.e. only563* one occurrence of each type is allowed across all instances of564* iftype_data).565*/566struct ieee80211_supported_band {567struct ieee80211_channel *channels;568struct ieee80211_rate *bitrates;569enum nl80211_band band;570int n_channels;571int n_bitrates;572struct ieee80211_sta_ht_cap ht_cap;573struct ieee80211_sta_vht_cap vht_cap;574struct ieee80211_sta_s1g_cap s1g_cap;575struct ieee80211_edmg edmg_cap;576u16 n_iftype_data;577const struct ieee80211_sband_iftype_data __iftd *iftype_data;578};579580/**581* _ieee80211_set_sband_iftype_data - set sband iftype data array582* @sband: the sband to initialize583* @iftd: the iftype data array pointer584* @n_iftd: the length of the iftype data array585*586* Set the sband iftype data array; use this where the length cannot587* be derived from the ARRAY_SIZE() of the argument, but prefer588* ieee80211_set_sband_iftype_data() where it can be used.589*/590static inline void591_ieee80211_set_sband_iftype_data(struct ieee80211_supported_band *sband,592const struct ieee80211_sband_iftype_data *iftd,593u16 n_iftd)594{595sband->iftype_data = (const void __iftd __force *)iftd;596sband->n_iftype_data = n_iftd;597}598599/**600* ieee80211_set_sband_iftype_data - set sband iftype data array601* @sband: the sband to initialize602* @iftd: the iftype data array603*/604#define ieee80211_set_sband_iftype_data(sband, iftd) \605_ieee80211_set_sband_iftype_data(sband, iftd, ARRAY_SIZE(iftd))606607/**608* for_each_sband_iftype_data - iterate sband iftype data entries609* @sband: the sband whose iftype_data array to iterate610* @i: iterator counter611* @iftd: iftype data pointer to set612*/613#define for_each_sband_iftype_data(sband, i, iftd) \614for (i = 0, iftd = (const void __force *)&(sband)->iftype_data[i]; \615i < (sband)->n_iftype_data; \616i++, iftd = (const void __force *)&(sband)->iftype_data[i])617618/**619* ieee80211_get_sband_iftype_data - return sband data for a given iftype620* @sband: the sband to search for the STA on621* @iftype: enum nl80211_iftype622*623* Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found624*/625static inline const struct ieee80211_sband_iftype_data *626ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,627u8 iftype)628{629const struct ieee80211_sband_iftype_data *data;630int i;631632if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))633return NULL;634635if (iftype == NL80211_IFTYPE_AP_VLAN)636iftype = NL80211_IFTYPE_AP;637638for_each_sband_iftype_data(sband, i, data) {639if (data->types_mask & BIT(iftype))640return data;641}642643return NULL;644}645646/**647* ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype648* @sband: the sband to search for the iftype on649* @iftype: enum nl80211_iftype650*651* Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found652*/653static inline const struct ieee80211_sta_he_cap *654ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,655u8 iftype)656{657const struct ieee80211_sband_iftype_data *data =658ieee80211_get_sband_iftype_data(sband, iftype);659660if (data && data->he_cap.has_he)661return &data->he_cap;662663return NULL;664}665666/**667* ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities668* @sband: the sband to search for the STA on669* @iftype: the iftype to search for670*671* Return: the 6GHz capabilities672*/673static inline __le16674ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,675enum nl80211_iftype iftype)676{677const struct ieee80211_sband_iftype_data *data =678ieee80211_get_sband_iftype_data(sband, iftype);679680if (WARN_ON(!data || !data->he_cap.has_he))681return 0;682683return data->he_6ghz_capa.capa;684}685686/**687* ieee80211_get_eht_iftype_cap - return EHT capabilities for an sband's iftype688* @sband: the sband to search for the iftype on689* @iftype: enum nl80211_iftype690*691* Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found692*/693static inline const struct ieee80211_sta_eht_cap *694ieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,695enum nl80211_iftype iftype)696{697const struct ieee80211_sband_iftype_data *data =698ieee80211_get_sband_iftype_data(sband, iftype);699700if (data && data->eht_cap.has_eht)701return &data->eht_cap;702703return NULL;704}705706/**707* wiphy_read_of_freq_limits - read frequency limits from device tree708*709* @wiphy: the wireless device to get extra limits for710*711* Some devices may have extra limitations specified in DT. This may be useful712* for chipsets that normally support more bands but are limited due to board713* design (e.g. by antennas or external power amplifier).714*715* This function reads info from DT and uses it to *modify* channels (disable716* unavailable ones). It's usually a *bad* idea to use it in drivers with717* shared channel data as DT limitations are device specific. You should make718* sure to call it only if channels in wiphy are copied and can be modified719* without affecting other devices.720*721* As this function access device node it has to be called after set_wiphy_dev.722* It also modifies channels so they have to be set first.723* If using this helper, call it before wiphy_register().724*/725#ifdef CONFIG_OF726void wiphy_read_of_freq_limits(struct wiphy *wiphy);727#else /* CONFIG_OF */728static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)729{730}731#endif /* !CONFIG_OF */732733734/*735* Wireless hardware/device configuration structures and methods736*/737738/**739* DOC: Actions and configuration740*741* Each wireless device and each virtual interface offer a set of configuration742* operations and other actions that are invoked by userspace. Each of these743* actions is described in the operations structure, and the parameters these744* operations use are described separately.745*746* Additionally, some operations are asynchronous and expect to get status747* information via some functions that drivers need to call.748*749* Scanning and BSS list handling with its associated functionality is described750* in a separate chapter.751*/752753#define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\754WLAN_USER_POSITION_LEN)755756/**757* struct vif_params - describes virtual interface parameters758* @flags: monitor interface flags, unchanged if 0, otherwise759* %MONITOR_FLAG_CHANGED will be set760* @use_4addr: use 4-address frames761* @macaddr: address to use for this virtual interface.762* If this parameter is set to zero address the driver may763* determine the address as needed.764* This feature is only fully supported by drivers that enable the765* %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating766** only p2p devices with specified MAC.767* @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets768* belonging to that MU-MIMO groupID; %NULL if not changed769* @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring770* MU-MIMO packets going to the specified station; %NULL if not changed771*/772struct vif_params {773u32 flags;774int use_4addr;775u8 macaddr[ETH_ALEN];776const u8 *vht_mumimo_groups;777const u8 *vht_mumimo_follow_addr;778};779780/**781* struct key_params - key information782*783* Information about a key784*785* @key: key material786* @key_len: length of key material787* @cipher: cipher suite selector788* @seq: sequence counter (IV/PN), must be in little endian,789* length given by @seq_len.790* @seq_len: length of @seq.791* @vlan_id: vlan_id for VLAN group key (if nonzero)792* @mode: key install mode (RX_TX, NO_TX or SET_TX)793*/794struct key_params {795const u8 *key;796const u8 *seq;797int key_len;798int seq_len;799u16 vlan_id;800u32 cipher;801enum nl80211_key_mode mode;802};803804/**805* struct cfg80211_chan_def - channel definition806* @chan: the (control) channel807* @width: channel width808* @center_freq1: center frequency of first segment809* @center_freq2: center frequency of second segment810* (only with 80+80 MHz)811* @edmg: define the EDMG channels configuration.812* If edmg is requested (i.e. the .channels member is non-zero),813* chan will define the primary channel and all other814* parameters are ignored.815* @freq1_offset: offset from @center_freq1, in KHz816* @punctured: mask of the punctured 20 MHz subchannels, with817* bits turned on being disabled (punctured); numbered818* from lower to higher frequency (like in the spec)819* @s1g_primary_2mhz: Indicates if the control channel pointed to820* by 'chan' exists as a 1MHz primary subchannel within an821* S1G 2MHz primary channel.822*/823struct cfg80211_chan_def {824struct ieee80211_channel *chan;825enum nl80211_chan_width width;826u32 center_freq1;827u32 center_freq2;828struct ieee80211_edmg edmg;829u16 freq1_offset;830u16 punctured;831bool s1g_primary_2mhz;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];843u16 eht_mcs[NL80211_EHT_NSS_MAX];844enum nl80211_txrate_gi gi;845enum nl80211_he_gi he_gi;846enum nl80211_eht_gi eht_gi;847enum nl80211_he_ltf he_ltf;848enum nl80211_eht_ltf eht_ltf;849} control[NUM_NL80211_BANDS];850};851852853/**854* struct cfg80211_tid_cfg - TID specific configuration855* @config_override: Flag to notify driver to reset TID configuration856* of the peer.857* @tids: bitmap of TIDs to modify858* @mask: bitmap of attributes indicating which parameter changed,859* similar to &nl80211_tid_config_supp.860* @noack: noack configuration value for the TID861* @retry_long: retry count value862* @retry_short: retry count value863* @ampdu: Enable/Disable MPDU aggregation864* @rtscts: Enable/Disable RTS/CTS865* @amsdu: Enable/Disable MSDU aggregation866* @txrate_type: Tx bitrate mask type867* @txrate_mask: Tx bitrate to be applied for the TID868*/869struct cfg80211_tid_cfg {870bool config_override;871u8 tids;872u64 mask;873enum nl80211_tid_config noack;874u8 retry_long, retry_short;875enum nl80211_tid_config ampdu;876enum nl80211_tid_config rtscts;877enum nl80211_tid_config amsdu;878enum nl80211_tx_rate_setting txrate_type;879struct cfg80211_bitrate_mask txrate_mask;880};881882/**883* struct cfg80211_tid_config - TID configuration884* @peer: Station's MAC address885* @n_tid_conf: Number of TID specific configurations to be applied886* @tid_conf: Configuration change info887*/888struct cfg80211_tid_config {889const u8 *peer;890u32 n_tid_conf;891struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf);892};893894/**895* struct cfg80211_fils_aad - FILS AAD data896* @macaddr: STA MAC address897* @kek: FILS KEK898* @kek_len: FILS KEK length899* @snonce: STA Nonce900* @anonce: AP Nonce901*/902struct cfg80211_fils_aad {903const u8 *macaddr;904const u8 *kek;905u8 kek_len;906const u8 *snonce;907const u8 *anonce;908};909910/**911* struct cfg80211_set_hw_timestamp - enable/disable HW timestamping912* @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all913* addresses.914* @enable: if set, enable HW timestamping for the specified MAC address.915* Otherwise disable HW timestamping for the specified MAC address.916*/917struct cfg80211_set_hw_timestamp {918const u8 *macaddr;919bool enable;920};921922/**923* cfg80211_get_chandef_type - return old channel type from chandef924* @chandef: the channel definition925*926* Return: The old channel type (NOHT, HT20, HT40+/-) from a given927* chandef, which must have a bandwidth allowing this conversion.928*/929static inline enum nl80211_channel_type930cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)931{932switch (chandef->width) {933case NL80211_CHAN_WIDTH_20_NOHT:934return NL80211_CHAN_NO_HT;935case NL80211_CHAN_WIDTH_20:936return NL80211_CHAN_HT20;937case NL80211_CHAN_WIDTH_40:938if (chandef->center_freq1 > chandef->chan->center_freq)939return NL80211_CHAN_HT40PLUS;940return NL80211_CHAN_HT40MINUS;941default:942WARN_ON(1);943return NL80211_CHAN_NO_HT;944}945}946947/**948* cfg80211_chandef_create - create channel definition using channel type949* @chandef: the channel definition struct to fill950* @channel: the control channel951* @chantype: the channel type952*953* Given a channel type, create a channel definition.954*/955void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,956struct ieee80211_channel *channel,957enum nl80211_channel_type chantype);958959/**960* cfg80211_chandef_identical - check if two channel definitions are identical961* @chandef1: first channel definition962* @chandef2: second channel definition963*964* Return: %true if the channels defined by the channel definitions are965* identical, %false otherwise.966*/967static inline bool968cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,969const struct cfg80211_chan_def *chandef2)970{971return (chandef1->chan == chandef2->chan &&972chandef1->width == chandef2->width &&973chandef1->center_freq1 == chandef2->center_freq1 &&974chandef1->freq1_offset == chandef2->freq1_offset &&975chandef1->center_freq2 == chandef2->center_freq2 &&976chandef1->punctured == chandef2->punctured &&977chandef1->s1g_primary_2mhz == chandef2->s1g_primary_2mhz);978}979980/**981* cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel982*983* @chandef: the channel definition984*985* Return: %true if EDMG defined, %false otherwise.986*/987static inline bool988cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)989{990return chandef->edmg.channels || chandef->edmg.bw_config;991}992993/**994* cfg80211_chandef_is_s1g - check if chandef represents an S1G channel995* @chandef: the channel definition996*997* Return: %true if S1G.998*/999static inline bool1000cfg80211_chandef_is_s1g(const struct cfg80211_chan_def *chandef)1001{1002return chandef->chan->band == NL80211_BAND_S1GHZ;1003}10041005/**1006* cfg80211_chandef_compatible - check if two channel definitions are compatible1007* @chandef1: first channel definition1008* @chandef2: second channel definition1009*1010* Return: %NULL if the given channel definitions are incompatible,1011* chandef1 or chandef2 otherwise.1012*/1013const struct cfg80211_chan_def *1014cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,1015const struct cfg80211_chan_def *chandef2);101610171018/**1019* nl80211_chan_width_to_mhz - get the channel width in MHz1020* @chan_width: the channel width from &enum nl80211_chan_width1021*1022* Return: channel width in MHz if the chan_width from &enum nl80211_chan_width1023* is valid. -1 otherwise.1024*/1025int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width);10261027/**1028* cfg80211_chandef_get_width - return chandef width in MHz1029* @c: chandef to return bandwidth for1030* Return: channel width in MHz for the given chandef; note that it returns1031* 80 for 80+80 configurations1032*/1033static inline int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)1034{1035return nl80211_chan_width_to_mhz(c->width);1036}10371038/**1039* cfg80211_chandef_valid - check if a channel definition is valid1040* @chandef: the channel definition to check1041* Return: %true if the channel definition is valid. %false otherwise.1042*/1043bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);10441045/**1046* cfg80211_chandef_usable - check if secondary channels can be used1047* @wiphy: the wiphy to validate against1048* @chandef: the channel definition to check1049* @prohibited_flags: the regulatory channel flags that must not be set1050* Return: %true if secondary channels are usable. %false otherwise.1051*/1052bool cfg80211_chandef_usable(struct wiphy *wiphy,1053const struct cfg80211_chan_def *chandef,1054u32 prohibited_flags);10551056/**1057* cfg80211_chandef_dfs_required - checks if radar detection is required1058* @wiphy: the wiphy to validate against1059* @chandef: the channel definition to check1060* @iftype: the interface type as specified in &enum nl80211_iftype1061* Returns:1062* 1 if radar detection is required, 0 if it is not, < 0 on error1063*/1064int cfg80211_chandef_dfs_required(struct wiphy *wiphy,1065const struct cfg80211_chan_def *chandef,1066enum nl80211_iftype iftype);10671068/**1069* cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we1070* can/need start CAC on such channel1071* @wiphy: the wiphy to validate against1072* @chandef: the channel definition to check1073*1074* Return: true if all channels available and at least1075* one channel requires CAC (NL80211_DFS_USABLE)1076*/1077bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,1078const struct cfg80211_chan_def *chandef);10791080/**1081* cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given1082* channel definition1083* @wiphy: the wiphy to validate against1084* @chandef: the channel definition to check1085*1086* Returns: DFS CAC time (in ms) which applies for this channel definition1087*/1088unsigned int1089cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,1090const struct cfg80211_chan_def *chandef);10911092/**1093* cfg80211_chandef_primary - calculate primary 40/80/160 MHz freq1094* @chandef: chandef to calculate for1095* @primary_chan_width: primary channel width to calculate center for1096* @punctured: punctured sub-channel bitmap, will be recalculated1097* according to the new bandwidth, can be %NULL1098*1099* Returns: the primary 40/80/160 MHz channel center frequency, or -11100* for errors, updating the punctured bitmap1101*/1102int cfg80211_chandef_primary(const struct cfg80211_chan_def *chandef,1103enum nl80211_chan_width primary_chan_width,1104u16 *punctured);11051106/**1107* nl80211_send_chandef - sends the channel definition.1108* @msg: the msg to send channel definition1109* @chandef: the channel definition to check1110*1111* Returns: 0 if sent the channel definition to msg, < 0 on error1112**/1113int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef);11141115/**1116* ieee80211_chandef_max_power - maximum transmission power for the chandef1117*1118* In some regulations, the transmit power may depend on the configured channel1119* bandwidth which may be defined as dBm/MHz. This function returns the actual1120* max_power for non-standard (20 MHz) channels.1121*1122* @chandef: channel definition for the channel1123*1124* Returns: maximum allowed transmission power in dBm for the chandef1125*/1126static inline int1127ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)1128{1129switch (chandef->width) {1130case NL80211_CHAN_WIDTH_5:1131return min(chandef->chan->max_reg_power - 6,1132chandef->chan->max_power);1133case NL80211_CHAN_WIDTH_10:1134return min(chandef->chan->max_reg_power - 3,1135chandef->chan->max_power);1136default:1137break;1138}1139return chandef->chan->max_power;1140}11411142/**1143* cfg80211_any_usable_channels - check for usable channels1144* @wiphy: the wiphy to check for1145* @band_mask: which bands to check on1146* @prohibited_flags: which channels to not consider usable,1147* %IEEE80211_CHAN_DISABLED is always taken into account1148*1149* Return: %true if usable channels found, %false otherwise1150*/1151bool cfg80211_any_usable_channels(struct wiphy *wiphy,1152unsigned long band_mask,1153u32 prohibited_flags);11541155/**1156* enum survey_info_flags - survey information flags1157*1158* @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in1159* @SURVEY_INFO_IN_USE: channel is currently being used1160* @SURVEY_INFO_TIME: active time (in ms) was filled in1161* @SURVEY_INFO_TIME_BUSY: busy time was filled in1162* @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in1163* @SURVEY_INFO_TIME_RX: receive time was filled in1164* @SURVEY_INFO_TIME_TX: transmit time was filled in1165* @SURVEY_INFO_TIME_SCAN: scan time was filled in1166* @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in1167*1168* Used by the driver to indicate which info in &struct survey_info1169* it has filled in during the get_survey().1170*/1171enum survey_info_flags {1172SURVEY_INFO_NOISE_DBM = BIT(0),1173SURVEY_INFO_IN_USE = BIT(1),1174SURVEY_INFO_TIME = BIT(2),1175SURVEY_INFO_TIME_BUSY = BIT(3),1176SURVEY_INFO_TIME_EXT_BUSY = BIT(4),1177SURVEY_INFO_TIME_RX = BIT(5),1178SURVEY_INFO_TIME_TX = BIT(6),1179SURVEY_INFO_TIME_SCAN = BIT(7),1180SURVEY_INFO_TIME_BSS_RX = BIT(8),1181};11821183/**1184* struct survey_info - channel survey response1185*1186* @channel: the channel this survey record reports, may be %NULL for a single1187* record to report global statistics1188* @filled: bitflag of flags from &enum survey_info_flags1189* @noise: channel noise in dBm. This and all following fields are1190* optional1191* @time: amount of time in ms the radio was turn on (on the channel)1192* @time_busy: amount of time the primary channel was sensed busy1193* @time_ext_busy: amount of time the extension channel was sensed busy1194* @time_rx: amount of time the radio spent receiving data1195* @time_tx: amount of time the radio spent transmitting data1196* @time_scan: amount of time the radio spent for scanning1197* @time_bss_rx: amount of time the radio spent receiving data on a local BSS1198*1199* Used by dump_survey() to report back per-channel survey information.1200*1201* This structure can later be expanded with things like1202* channel duty cycle etc.1203*/1204struct survey_info {1205struct ieee80211_channel *channel;1206u64 time;1207u64 time_busy;1208u64 time_ext_busy;1209u64 time_rx;1210u64 time_tx;1211u64 time_scan;1212u64 time_bss_rx;1213u32 filled;1214s8 noise;1215};12161217#define CFG80211_MAX_NUM_AKM_SUITES 1012181219/**1220* struct cfg80211_crypto_settings - Crypto settings1221* @wpa_versions: indicates which, if any, WPA versions are enabled1222* (from enum nl80211_wpa_versions)1223* @cipher_group: group key cipher suite (or 0 if unset)1224* @n_ciphers_pairwise: number of AP supported unicast ciphers1225* @ciphers_pairwise: unicast key cipher suites1226* @n_akm_suites: number of AKM suites1227* @akm_suites: AKM suites1228* @control_port: Whether user space controls IEEE 802.1X port, i.e.,1229* sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is1230* required to assume that the port is unauthorized until authorized by1231* user space. Otherwise, port is marked authorized by default.1232* @control_port_ethertype: the control port protocol that should be1233* allowed through even on unauthorized ports1234* @control_port_no_encrypt: TRUE to prevent encryption of control port1235* protocol frames.1236* @control_port_over_nl80211: TRUE if userspace expects to exchange control1237* port frames over NL80211 instead of the network interface.1238* @control_port_no_preauth: disables pre-auth rx over the nl80211 control1239* port for mac802111240* @psk: PSK (for devices supporting 4-way-handshake offload)1241* @sae_pwd: password for SAE authentication (for devices supporting SAE1242* offload)1243* @sae_pwd_len: length of SAE password (for devices supporting SAE offload)1244* @sae_pwe: The mechanisms allowed for SAE PWE derivation:1245*1246* NL80211_SAE_PWE_UNSPECIFIED1247* Not-specified, used to indicate userspace did not specify any1248* preference. The driver should follow its internal policy in1249* such a scenario.1250*1251* NL80211_SAE_PWE_HUNT_AND_PECK1252* Allow hunting-and-pecking loop only1253*1254* NL80211_SAE_PWE_HASH_TO_ELEMENT1255* Allow hash-to-element only1256*1257* NL80211_SAE_PWE_BOTH1258* Allow either hunting-and-pecking loop or hash-to-element1259*/1260struct cfg80211_crypto_settings {1261u32 wpa_versions;1262u32 cipher_group;1263int n_ciphers_pairwise;1264u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];1265int n_akm_suites;1266u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];1267bool control_port;1268__be16 control_port_ethertype;1269bool control_port_no_encrypt;1270bool control_port_over_nl80211;1271bool control_port_no_preauth;1272const u8 *psk;1273const u8 *sae_pwd;1274u8 sae_pwd_len;1275enum nl80211_sae_pwe_mechanism sae_pwe;1276};12771278/**1279* struct cfg80211_mbssid_config - AP settings for multi bssid1280*1281* @tx_wdev: pointer to the transmitted interface in the MBSSID set1282* @tx_link_id: link ID of the transmitted profile in an MLD.1283* @index: index of this AP in the multi bssid group.1284* @ema: set to true if the beacons should be sent out in EMA mode.1285*/1286struct cfg80211_mbssid_config {1287struct wireless_dev *tx_wdev;1288u8 tx_link_id;1289u8 index;1290bool ema;1291};12921293/**1294* struct cfg80211_mbssid_elems - Multiple BSSID elements1295*1296* @cnt: Number of elements in array %elems.1297*1298* @elem: Array of multiple BSSID element(s) to be added into Beacon frames.1299* @elem.data: Data for multiple BSSID elements.1300* @elem.len: Length of data.1301*/1302struct cfg80211_mbssid_elems {1303u8 cnt;1304struct {1305const u8 *data;1306size_t len;1307} elem[] __counted_by(cnt);1308};13091310/**1311* struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements1312*1313* @cnt: Number of elements in array %elems.1314*1315* @elem: Array of RNR element(s) to be added into Beacon frames.1316* @elem.data: Data for RNR elements.1317* @elem.len: Length of data.1318*/1319struct cfg80211_rnr_elems {1320u8 cnt;1321struct {1322const u8 *data;1323size_t len;1324} elem[] __counted_by(cnt);1325};13261327/**1328* struct cfg80211_beacon_data - beacon data1329* @link_id: the link ID for the AP MLD link sending this beacon1330* @head: head portion of beacon (before TIM IE)1331* or %NULL if not changed1332* @tail: tail portion of beacon (after TIM IE)1333* or %NULL if not changed1334* @head_len: length of @head1335* @tail_len: length of @tail1336* @beacon_ies: extra information element(s) to add into Beacon frames or %NULL1337* @beacon_ies_len: length of beacon_ies in octets1338* @proberesp_ies: extra information element(s) to add into Probe Response1339* frames or %NULL1340* @proberesp_ies_len: length of proberesp_ies in octets1341* @assocresp_ies: extra information element(s) to add into (Re)Association1342* Response frames or %NULL1343* @assocresp_ies_len: length of assocresp_ies in octets1344* @probe_resp_len: length of probe response template (@probe_resp)1345* @probe_resp: probe response template (AP mode only)1346* @mbssid_ies: multiple BSSID elements1347* @rnr_ies: reduced neighbor report elements1348* @ftm_responder: enable FTM responder functionality; -1 for no change1349* (which also implies no change in LCI/civic location data)1350* @lci: Measurement Report element content, starting with Measurement Token1351* (measurement type 8)1352* @civicloc: Measurement Report element content, starting with Measurement1353* Token (measurement type 11)1354* @lci_len: LCI data length1355* @civicloc_len: Civic location data length1356* @he_bss_color: BSS Color settings1357* @he_bss_color_valid: indicates whether bss color1358* attribute is present in beacon data or not.1359*/1360struct cfg80211_beacon_data {1361unsigned int link_id;13621363const u8 *head, *tail;1364const u8 *beacon_ies;1365const u8 *proberesp_ies;1366const u8 *assocresp_ies;1367const u8 *probe_resp;1368const u8 *lci;1369const u8 *civicloc;1370struct cfg80211_mbssid_elems *mbssid_ies;1371struct cfg80211_rnr_elems *rnr_ies;1372s8 ftm_responder;13731374size_t head_len, tail_len;1375size_t beacon_ies_len;1376size_t proberesp_ies_len;1377size_t assocresp_ies_len;1378size_t probe_resp_len;1379size_t lci_len;1380size_t civicloc_len;1381struct cfg80211_he_bss_color he_bss_color;1382bool he_bss_color_valid;1383};13841385struct mac_address {1386u8 addr[ETH_ALEN];1387};13881389/**1390* struct cfg80211_acl_data - Access control list data1391*1392* @acl_policy: ACL policy to be applied on the station's1393* entry specified by mac_addr1394* @n_acl_entries: Number of MAC address entries passed1395* @mac_addrs: List of MAC addresses of stations to be used for ACL1396*/1397struct cfg80211_acl_data {1398enum nl80211_acl_policy acl_policy;1399int n_acl_entries;14001401/* Keep it last */1402struct mac_address mac_addrs[] __counted_by(n_acl_entries);1403};14041405/**1406* struct cfg80211_fils_discovery - FILS discovery parameters from1407* IEEE Std 802.11ai-2016, Annex C.3 MIB detail.1408*1409* @update: Set to true if the feature configuration should be updated.1410* @min_interval: Minimum packet interval in TUs (0 - 10000)1411* @max_interval: Maximum packet interval in TUs (0 - 10000)1412* @tmpl_len: Template length1413* @tmpl: Template data for FILS discovery frame including the action1414* frame headers.1415*/1416struct cfg80211_fils_discovery {1417bool update;1418u32 min_interval;1419u32 max_interval;1420size_t tmpl_len;1421const u8 *tmpl;1422};14231424/**1425* struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe1426* response parameters in 6GHz.1427*1428* @update: Set to true if the feature configuration should be updated.1429* @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned1430* in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive1431* scanning1432* @tmpl_len: Template length1433* @tmpl: Template data for probe response1434*/1435struct cfg80211_unsol_bcast_probe_resp {1436bool update;1437u32 interval;1438size_t tmpl_len;1439const u8 *tmpl;1440};14411442/**1443* struct cfg80211_s1g_short_beacon - S1G short beacon data.1444*1445* @update: Set to true if the feature configuration should be updated.1446* @short_head: Short beacon head.1447* @short_tail: Short beacon tail.1448* @short_head_len: Short beacon head len.1449* @short_tail_len: Short beacon tail len.1450*/1451struct cfg80211_s1g_short_beacon {1452bool update;1453const u8 *short_head;1454const u8 *short_tail;1455size_t short_head_len;1456size_t short_tail_len;1457};14581459/**1460* struct cfg80211_ap_settings - AP configuration1461*1462* Used to configure an AP interface.1463*1464* @chandef: defines the channel to use1465* @beacon: beacon data1466* @beacon_interval: beacon interval1467* @dtim_period: DTIM period1468* @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from1469* user space)1470* @ssid_len: length of @ssid1471* @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames1472* @crypto: crypto settings1473* @privacy: the BSS uses privacy1474* @auth_type: Authentication type (algorithm)1475* @inactivity_timeout: time in seconds to determine station's inactivity.1476* @p2p_ctwindow: P2P CT Window1477* @p2p_opp_ps: P2P opportunistic PS1478* @acl: ACL configuration used by the drivers which has support for1479* MAC address based access control1480* @pbss: If set, start as a PCP instead of AP. Relevant for DMG1481* networks.1482* @beacon_rate: bitrate to be used for beacons1483* @ht_cap: HT capabilities (or %NULL if HT isn't enabled)1484* @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)1485* @he_cap: HE capabilities (or %NULL if HE isn't enabled)1486* @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)1487* @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)1488* @ht_required: stations must support HT1489* @vht_required: stations must support VHT1490* @twt_responder: Enable Target Wait Time1491* @he_required: stations must support HE1492* @sae_h2e_required: stations must support direct H2E technique in SAE1493* @flags: flags, as defined in &enum nl80211_ap_settings_flags1494* @he_obss_pd: OBSS Packet Detection settings1495* @he_oper: HE operation IE (or %NULL if HE isn't enabled)1496* @fils_discovery: FILS discovery transmission parameters1497* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1498* @mbssid_config: AP settings for multiple bssid1499* @s1g_long_beacon_period: S1G long beacon period1500* @s1g_short_beacon: S1G short beacon data1501*/1502struct cfg80211_ap_settings {1503struct cfg80211_chan_def chandef;15041505struct cfg80211_beacon_data beacon;15061507int beacon_interval, dtim_period;1508const u8 *ssid;1509size_t ssid_len;1510enum nl80211_hidden_ssid hidden_ssid;1511struct cfg80211_crypto_settings crypto;1512bool privacy;1513enum nl80211_auth_type auth_type;1514int inactivity_timeout;1515u8 p2p_ctwindow;1516bool p2p_opp_ps;1517const struct cfg80211_acl_data *acl;1518bool pbss;1519struct cfg80211_bitrate_mask beacon_rate;15201521const struct ieee80211_ht_cap *ht_cap;1522const struct ieee80211_vht_cap *vht_cap;1523const struct ieee80211_he_cap_elem *he_cap;1524const struct ieee80211_he_operation *he_oper;1525const struct ieee80211_eht_cap_elem *eht_cap;1526const struct ieee80211_eht_operation *eht_oper;1527bool ht_required, vht_required, he_required, sae_h2e_required;1528bool twt_responder;1529u32 flags;1530struct ieee80211_he_obss_pd he_obss_pd;1531struct cfg80211_fils_discovery fils_discovery;1532struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1533struct cfg80211_mbssid_config mbssid_config;1534u8 s1g_long_beacon_period;1535struct cfg80211_s1g_short_beacon s1g_short_beacon;1536};153715381539/**1540* struct cfg80211_ap_update - AP configuration update1541*1542* Subset of &struct cfg80211_ap_settings, for updating a running AP.1543*1544* @beacon: beacon data1545* @fils_discovery: FILS discovery transmission parameters1546* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1547* @s1g_short_beacon: S1G short beacon data1548*/1549struct cfg80211_ap_update {1550struct cfg80211_beacon_data beacon;1551struct cfg80211_fils_discovery fils_discovery;1552struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1553struct cfg80211_s1g_short_beacon s1g_short_beacon;1554};15551556/**1557* struct cfg80211_csa_settings - channel switch settings1558*1559* Used for channel switch1560*1561* @chandef: defines the channel to use after the switch1562* @beacon_csa: beacon data while performing the switch1563* @counter_offsets_beacon: offsets of the counters within the beacon (tail)1564* @counter_offsets_presp: offsets of the counters within the probe response1565* @n_counter_offsets_beacon: number of csa counters the beacon (tail)1566* @n_counter_offsets_presp: number of csa counters in the probe response1567* @beacon_after: beacon data to be used on the new channel1568* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1569* @radar_required: whether radar detection is required on the new channel1570* @block_tx: whether transmissions should be blocked while changing1571* @count: number of beacons until switch1572* @link_id: defines the link on which channel switch is expected during1573* MLO. 0 in case of non-MLO.1574*/1575struct cfg80211_csa_settings {1576struct cfg80211_chan_def chandef;1577struct cfg80211_beacon_data beacon_csa;1578const u16 *counter_offsets_beacon;1579const u16 *counter_offsets_presp;1580unsigned int n_counter_offsets_beacon;1581unsigned int n_counter_offsets_presp;1582struct cfg80211_beacon_data beacon_after;1583struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1584bool radar_required;1585bool block_tx;1586u8 count;1587u8 link_id;1588};15891590/**1591* struct cfg80211_color_change_settings - color change settings1592*1593* Used for bss color change1594*1595* @beacon_color_change: beacon data while performing the color countdown1596* @counter_offset_beacon: offsets of the counters within the beacon (tail)1597* @counter_offset_presp: offsets of the counters within the probe response1598* @beacon_next: beacon data to be used after the color change1599* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1600* @count: number of beacons until the color change1601* @color: the color used after the change1602* @link_id: defines the link on which color change is expected during MLO.1603* 0 in case of non-MLO.1604*/1605struct cfg80211_color_change_settings {1606struct cfg80211_beacon_data beacon_color_change;1607u16 counter_offset_beacon;1608u16 counter_offset_presp;1609struct cfg80211_beacon_data beacon_next;1610struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1611u8 count;1612u8 color;1613u8 link_id;1614};16151616/**1617* struct iface_combination_params - input parameters for interface combinations1618*1619* Used to pass interface combination parameters1620*1621* @radio_idx: wiphy radio index or -1 for global1622* @num_different_channels: the number of different channels we want1623* to use for verification1624* @radar_detect: a bitmap where each bit corresponds to a channel1625* width where radar detection is needed, as in the definition of1626* &struct ieee80211_iface_combination.@radar_detect_widths1627* @iftype_num: array with the number of interfaces of each interface1628* type. The index is the interface type as specified in &enum1629* nl80211_iftype.1630* @new_beacon_int: set this to the beacon interval of a new interface1631* that's not operating yet, if such is to be checked as part of1632* the verification1633*/1634struct iface_combination_params {1635int radio_idx;1636int num_different_channels;1637u8 radar_detect;1638int iftype_num[NUM_NL80211_IFTYPES];1639u32 new_beacon_int;1640};16411642/**1643* enum station_parameters_apply_mask - station parameter values to apply1644* @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)1645* @STATION_PARAM_APPLY_CAPABILITY: apply new capability1646* @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state1647*1648* Not all station parameters have in-band "no change" signalling,1649* for those that don't these flags will are used.1650*/1651enum station_parameters_apply_mask {1652STATION_PARAM_APPLY_UAPSD = BIT(0),1653STATION_PARAM_APPLY_CAPABILITY = BIT(1),1654STATION_PARAM_APPLY_PLINK_STATE = BIT(2),1655};16561657/**1658* struct sta_txpwr - station txpower configuration1659*1660* Used to configure txpower for station.1661*1662* @power: tx power (in dBm) to be used for sending data traffic. If tx power1663* is not provided, the default per-interface tx power setting will be1664* overriding. Driver should be picking up the lowest tx power, either tx1665* power per-interface or per-station.1666* @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power1667* will be less than or equal to specified from userspace, whereas if TPC1668* %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.1669* NL80211_TX_POWER_FIXED is not a valid configuration option for1670* per peer TPC.1671*/1672struct sta_txpwr {1673s16 power;1674enum nl80211_tx_power_setting type;1675};16761677/**1678* struct link_station_parameters - link station parameters1679*1680* Used to change and create a new link station.1681*1682* @mld_mac: MAC address of the station1683* @link_id: the link id (-1 for non-MLD station)1684* @link_mac: MAC address of the link1685* @supported_rates: supported rates in IEEE 802.11 format1686* (or NULL for no change)1687* @supported_rates_len: number of supported rates1688* @ht_capa: HT capabilities of station1689* @vht_capa: VHT capabilities of station1690* @opmode_notif: operating mode field from Operating Mode Notification1691* @opmode_notif_used: information if operating mode field is used1692* @he_capa: HE capabilities of station1693* @he_capa_len: the length of the HE capabilities1694* @txpwr: transmit power for an associated station1695* @txpwr_set: txpwr field is set1696* @he_6ghz_capa: HE 6 GHz Band capabilities of station1697* @eht_capa: EHT capabilities of station1698* @eht_capa_len: the length of the EHT capabilities1699* @s1g_capa: S1G capabilities of station1700*/1701struct link_station_parameters {1702const u8 *mld_mac;1703int link_id;1704const u8 *link_mac;1705const u8 *supported_rates;1706u8 supported_rates_len;1707const struct ieee80211_ht_cap *ht_capa;1708const struct ieee80211_vht_cap *vht_capa;1709u8 opmode_notif;1710bool opmode_notif_used;1711const struct ieee80211_he_cap_elem *he_capa;1712u8 he_capa_len;1713struct sta_txpwr txpwr;1714bool txpwr_set;1715const struct ieee80211_he_6ghz_capa *he_6ghz_capa;1716const struct ieee80211_eht_cap_elem *eht_capa;1717u8 eht_capa_len;1718const struct ieee80211_s1g_cap *s1g_capa;1719};17201721/**1722* struct link_station_del_parameters - link station deletion parameters1723*1724* Used to delete a link station entry (or all stations).1725*1726* @mld_mac: MAC address of the station1727* @link_id: the link id1728*/1729struct link_station_del_parameters {1730const u8 *mld_mac;1731u32 link_id;1732};17331734/**1735* struct cfg80211_ttlm_params: TID to link mapping parameters1736*1737* Used for setting a TID to link mapping.1738*1739* @dlink: Downlink TID to link mapping, as defined in section 9.4.2.3141740* (TID-To-Link Mapping element) in Draft P802.11be_D4.0.1741* @ulink: Uplink TID to link mapping, as defined in section 9.4.2.3141742* (TID-To-Link Mapping element) in Draft P802.11be_D4.0.1743*/1744struct cfg80211_ttlm_params {1745u16 dlink[8];1746u16 ulink[8];1747};17481749/**1750* struct station_parameters - station parameters1751*1752* Used to change and create a new station.1753*1754* @vlan: vlan interface station should belong to1755* @sta_flags_mask: station flags that changed1756* (bitmask of BIT(%NL80211_STA_FLAG_...))1757* @sta_flags_set: station flags values1758* (bitmask of BIT(%NL80211_STA_FLAG_...))1759* @listen_interval: listen interval or -1 for no change1760* @aid: AID or zero for no change1761* @vlan_id: VLAN ID for station (if nonzero)1762* @peer_aid: mesh peer AID or zero for no change1763* @plink_action: plink action to take1764* @plink_state: set the peer link state for a station1765* @uapsd_queues: bitmap of queues configured for uapsd. same format1766* as the AC bitmap in the QoS info field1767* @max_sp: max Service Period. same format as the MAX_SP in the1768* QoS info field (but already shifted down)1769* @sta_modify_mask: bitmap indicating which parameters changed1770* (for those that don't have a natural "no change" value),1771* see &enum station_parameters_apply_mask1772* @local_pm: local link-specific mesh power save mode (no change when set1773* to unknown)1774* @capability: station capability1775* @ext_capab: extended capabilities of the station1776* @ext_capab_len: number of extended capabilities1777* @supported_channels: supported channels in IEEE 802.11 format1778* @supported_channels_len: number of supported channels1779* @supported_oper_classes: supported oper classes in IEEE 802.11 format1780* @supported_oper_classes_len: number of supported operating classes1781* @support_p2p_ps: information if station supports P2P PS mechanism1782* @airtime_weight: airtime scheduler weight for this station1783* @eml_cap_present: Specifies if EML capabilities field (@eml_cap) is1784* present/updated1785* @eml_cap: EML capabilities of this station1786* @link_sta_params: link related params.1787*/1788struct station_parameters {1789struct net_device *vlan;1790u32 sta_flags_mask, sta_flags_set;1791u32 sta_modify_mask;1792int listen_interval;1793u16 aid;1794u16 vlan_id;1795u16 peer_aid;1796u8 plink_action;1797u8 plink_state;1798u8 uapsd_queues;1799u8 max_sp;1800enum nl80211_mesh_power_mode local_pm;1801u16 capability;1802const u8 *ext_capab;1803u8 ext_capab_len;1804const u8 *supported_channels;1805u8 supported_channels_len;1806const u8 *supported_oper_classes;1807u8 supported_oper_classes_len;1808int support_p2p_ps;1809u16 airtime_weight;1810bool eml_cap_present;1811u16 eml_cap;1812struct link_station_parameters link_sta_params;1813};18141815/**1816* struct station_del_parameters - station deletion parameters1817*1818* Used to delete a station entry (or all stations).1819*1820* @mac: MAC address of the station to remove or NULL to remove all stations1821* @subtype: Management frame subtype to use for indicating removal1822* (10 = Disassociation, 12 = Deauthentication)1823* @reason_code: Reason code for the Disassociation/Deauthentication frame1824* @link_id: Link ID indicating a link that stations to be flushed must be1825* using; valid only for MLO, but can also be -1 for MLO to really1826* remove all stations.1827*/1828struct station_del_parameters {1829const u8 *mac;1830u8 subtype;1831u16 reason_code;1832int link_id;1833};18341835/**1836* enum cfg80211_station_type - the type of station being modified1837* @CFG80211_STA_AP_CLIENT: client of an AP interface1838* @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still1839* unassociated (update properties for this type of client is permitted)1840* @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has1841* the AP MLME in the device1842* @CFG80211_STA_AP_STA: AP station on managed interface1843* @CFG80211_STA_IBSS: IBSS station1844* @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry1845* while TDLS setup is in progress, it moves out of this state when1846* being marked authorized; use this only if TDLS with external setup is1847* supported/used)1848* @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active1849* entry that is operating, has been marked authorized by userspace)1850* @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)1851* @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)1852*/1853enum cfg80211_station_type {1854CFG80211_STA_AP_CLIENT,1855CFG80211_STA_AP_CLIENT_UNASSOC,1856CFG80211_STA_AP_MLME_CLIENT,1857CFG80211_STA_AP_STA,1858CFG80211_STA_IBSS,1859CFG80211_STA_TDLS_PEER_SETUP,1860CFG80211_STA_TDLS_PEER_ACTIVE,1861CFG80211_STA_MESH_PEER_KERNEL,1862CFG80211_STA_MESH_PEER_USER,1863};18641865/**1866* cfg80211_check_station_change - validate parameter changes1867* @wiphy: the wiphy this operates on1868* @params: the new parameters for a station1869* @statype: the type of station being modified1870*1871* Utility function for the @change_station driver method. Call this function1872* with the appropriate station type looking up the station (and checking that1873* it exists). It will verify whether the station change is acceptable.1874*1875* Return: 0 if the change is acceptable, otherwise an error code. Note that1876* it may modify the parameters for backward compatibility reasons, so don't1877* use them before calling this.1878*/1879int cfg80211_check_station_change(struct wiphy *wiphy,1880struct station_parameters *params,1881enum cfg80211_station_type statype);18821883/**1884* enum rate_info_flags - bitrate info flags1885*1886* Used by the driver to indicate the specific rate transmission1887* type for 802.11n transmissions.1888*1889* @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS1890* @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS1891* @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval1892* @RATE_INFO_FLAGS_DMG: 60GHz MCS1893* @RATE_INFO_FLAGS_HE_MCS: HE MCS information1894* @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode1895* @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS1896* @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information1897* @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS1898*/1899enum rate_info_flags {1900RATE_INFO_FLAGS_MCS = BIT(0),1901RATE_INFO_FLAGS_VHT_MCS = BIT(1),1902RATE_INFO_FLAGS_SHORT_GI = BIT(2),1903RATE_INFO_FLAGS_DMG = BIT(3),1904RATE_INFO_FLAGS_HE_MCS = BIT(4),1905RATE_INFO_FLAGS_EDMG = BIT(5),1906RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6),1907RATE_INFO_FLAGS_EHT_MCS = BIT(7),1908RATE_INFO_FLAGS_S1G_MCS = BIT(8),1909};19101911/**1912* enum rate_info_bw - rate bandwidth information1913*1914* Used by the driver to indicate the rate bandwidth.1915*1916* @RATE_INFO_BW_5: 5 MHz bandwidth1917* @RATE_INFO_BW_10: 10 MHz bandwidth1918* @RATE_INFO_BW_20: 20 MHz bandwidth1919* @RATE_INFO_BW_40: 40 MHz bandwidth1920* @RATE_INFO_BW_80: 80 MHz bandwidth1921* @RATE_INFO_BW_160: 160 MHz bandwidth1922* @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation1923* @RATE_INFO_BW_320: 320 MHz bandwidth1924* @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation1925* @RATE_INFO_BW_1: 1 MHz bandwidth1926* @RATE_INFO_BW_2: 2 MHz bandwidth1927* @RATE_INFO_BW_4: 4 MHz bandwidth1928* @RATE_INFO_BW_8: 8 MHz bandwidth1929* @RATE_INFO_BW_16: 16 MHz bandwidth1930*/1931enum rate_info_bw {1932RATE_INFO_BW_20 = 0,1933RATE_INFO_BW_5,1934RATE_INFO_BW_10,1935RATE_INFO_BW_40,1936RATE_INFO_BW_80,1937RATE_INFO_BW_160,1938RATE_INFO_BW_HE_RU,1939RATE_INFO_BW_320,1940RATE_INFO_BW_EHT_RU,1941RATE_INFO_BW_1,1942RATE_INFO_BW_2,1943RATE_INFO_BW_4,1944RATE_INFO_BW_8,1945RATE_INFO_BW_16,1946};19471948/**1949* struct rate_info - bitrate information1950*1951* Information about a receiving or transmitting bitrate1952*1953* @flags: bitflag of flags from &enum rate_info_flags1954* @legacy: bitrate in 100kbit/s for 802.11abg1955* @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G rate1956* @nss: number of streams (VHT & HE only)1957* @bw: bandwidth (from &enum rate_info_bw)1958* @he_gi: HE guard interval (from &enum nl80211_he_gi)1959* @he_dcm: HE DCM value1960* @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,1961* only valid if bw is %RATE_INFO_BW_HE_RU)1962* @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)1963* @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)1964* @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,1965* only valid if bw is %RATE_INFO_BW_EHT_RU)1966*/1967struct rate_info {1968u16 flags;1969u16 legacy;1970u8 mcs;1971u8 nss;1972u8 bw;1973u8 he_gi;1974u8 he_dcm;1975u8 he_ru_alloc;1976u8 n_bonded_ch;1977u8 eht_gi;1978u8 eht_ru_alloc;1979};19801981/**1982* enum bss_param_flags - bitrate info flags1983*1984* Used by the driver to indicate the specific rate transmission1985* type for 802.11n transmissions.1986*1987* @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled1988* @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled1989* @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled1990*/1991enum bss_param_flags {1992BSS_PARAM_FLAGS_CTS_PROT = BIT(0),1993BSS_PARAM_FLAGS_SHORT_PREAMBLE = BIT(1),1994BSS_PARAM_FLAGS_SHORT_SLOT_TIME = BIT(2),1995};19961997/**1998* struct sta_bss_parameters - BSS parameters for the attached station1999*2000* Information about the currently associated BSS2001*2002* @flags: bitflag of flags from &enum bss_param_flags2003* @dtim_period: DTIM period for the BSS2004* @beacon_interval: beacon interval2005*/2006struct sta_bss_parameters {2007u8 flags;2008u8 dtim_period;2009u16 beacon_interval;2010};20112012/**2013* struct cfg80211_txq_stats - TXQ statistics for this TID2014* @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to2015* indicate the relevant values in this struct are filled2016* @backlog_bytes: total number of bytes currently backlogged2017* @backlog_packets: total number of packets currently backlogged2018* @flows: number of new flows seen2019* @drops: total number of packets dropped2020* @ecn_marks: total number of packets marked with ECN CE2021* @overlimit: number of drops due to queue space overflow2022* @overmemory: number of drops due to memory limit overflow2023* @collisions: number of hash collisions2024* @tx_bytes: total number of bytes dequeued2025* @tx_packets: total number of packets dequeued2026* @max_flows: maximum number of flows supported2027*/2028struct cfg80211_txq_stats {2029u32 filled;2030u32 backlog_bytes;2031u32 backlog_packets;2032u32 flows;2033u32 drops;2034u32 ecn_marks;2035u32 overlimit;2036u32 overmemory;2037u32 collisions;2038u32 tx_bytes;2039u32 tx_packets;2040u32 max_flows;2041};20422043/**2044* struct cfg80211_tid_stats - per-TID statistics2045* @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to2046* indicate the relevant values in this struct are filled2047* @rx_msdu: number of received MSDUs2048* @tx_msdu: number of (attempted) transmitted MSDUs2049* @tx_msdu_retries: number of retries (not counting the first) for2050* transmitted MSDUs2051* @tx_msdu_failed: number of failed transmitted MSDUs2052* @txq_stats: TXQ statistics2053*/2054struct cfg80211_tid_stats {2055u32 filled;2056u64 rx_msdu;2057u64 tx_msdu;2058u64 tx_msdu_retries;2059u64 tx_msdu_failed;2060struct cfg80211_txq_stats txq_stats;2061};20622063#define IEEE80211_MAX_CHAINS 420642065/**2066* struct link_station_info - link station information2067*2068* Link station information filled by driver for get_station() and2069* dump_station().2070* @filled: bit flag of flags using the bits of &enum nl80211_sta_info to2071* indicate the relevant values in this struct for them2072* @connected_time: time(in secs) since a link of station is last connected2073* @inactive_time: time since last activity for link station(tx/rx)2074* in milliseconds2075* @assoc_at: bootime (ns) of the last association of link of station2076* @rx_bytes: bytes (size of MPDUs) received from this link of station2077* @tx_bytes: bytes (size of MPDUs) transmitted to this link of station2078* @signal: The signal strength, type depends on the wiphy's signal_type.2079* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2080* @signal_avg: Average signal strength, type depends on the wiphy's2081* signal_type. For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_2082* @chains: bitmask for filled values in @chain_signal, @chain_signal_avg2083* @chain_signal: per-chain signal strength of last received packet in dBm2084* @chain_signal_avg: per-chain signal strength average in dBm2085* @txrate: current unicast bitrate from this link of station2086* @rxrate: current unicast bitrate to this link of station2087* @rx_packets: packets (MSDUs & MMPDUs) received from this link of station2088* @tx_packets: packets (MSDUs & MMPDUs) transmitted to this link of station2089* @tx_retries: cumulative retry counts (MPDUs) for this link of station2090* @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)2091* @rx_dropped_misc: Dropped for un-specified reason.2092* @bss_param: current BSS parameters2093* @beacon_loss_count: Number of times beacon loss event has triggered.2094* @expected_throughput: expected throughput in kbps (including 802.11 headers)2095* towards this station.2096* @rx_beacon: number of beacons received from this peer2097* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received2098* from this peer2099* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer2100* @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer2101* @airtime_weight: current airtime scheduling weight2102* @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last2103* (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.2104* Note that this doesn't use the @filled bit, but is used if non-NULL.2105* @ack_signal: signal strength (in dBm) of the last ACK frame.2106* @avg_ack_signal: average rssi value of ack packet for the no of msdu's has2107* been sent.2108* @rx_mpdu_count: number of MPDUs received from this station2109* @fcs_err_count: number of packets (MPDUs) received from this station with2110* an FCS error. This counter should be incremented only when TA of the2111* received packet with an FCS error matches the peer MAC address.2112* @addr: For MLO STA connection, filled with address of the link of station.2113*/2114struct link_station_info {2115u64 filled;2116u32 connected_time;2117u32 inactive_time;2118u64 assoc_at;2119u64 rx_bytes;2120u64 tx_bytes;2121s8 signal;2122s8 signal_avg;21232124u8 chains;2125s8 chain_signal[IEEE80211_MAX_CHAINS];2126s8 chain_signal_avg[IEEE80211_MAX_CHAINS];21272128struct rate_info txrate;2129struct rate_info rxrate;2130u32 rx_packets;2131u32 tx_packets;2132u32 tx_retries;2133u32 tx_failed;2134u32 rx_dropped_misc;2135struct sta_bss_parameters bss_param;21362137u32 beacon_loss_count;21382139u32 expected_throughput;21402141u64 tx_duration;2142u64 rx_duration;2143u64 rx_beacon;2144u8 rx_beacon_signal_avg;21452146u16 airtime_weight;21472148s8 ack_signal;2149s8 avg_ack_signal;2150struct cfg80211_tid_stats *pertid;21512152u32 rx_mpdu_count;2153u32 fcs_err_count;21542155u8 addr[ETH_ALEN] __aligned(2);2156};21572158/**2159* struct station_info - station information2160*2161* Station information filled by driver for get_station() and dump_station.2162*2163* @filled: bitflag of flags using the bits of &enum nl80211_sta_info to2164* indicate the relevant values in this struct for them2165* @connected_time: time(in secs) since a station is last connected2166* @inactive_time: time since last station activity (tx/rx) in milliseconds2167* @assoc_at: bootime (ns) of the last association2168* @rx_bytes: bytes (size of MPDUs) received from this station2169* @tx_bytes: bytes (size of MPDUs) transmitted to this station2170* @signal: The signal strength, type depends on the wiphy's signal_type.2171* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2172* @signal_avg: Average signal strength, type depends on the wiphy's signal_type.2173* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2174* @chains: bitmask for filled values in @chain_signal, @chain_signal_avg2175* @chain_signal: per-chain signal strength of last received packet in dBm2176* @chain_signal_avg: per-chain signal strength average in dBm2177* @txrate: current unicast bitrate from this station2178* @rxrate: current unicast bitrate to this station2179* @rx_packets: packets (MSDUs & MMPDUs) received from this station2180* @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station2181* @tx_retries: cumulative retry counts (MPDUs)2182* @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)2183* @rx_dropped_misc: Dropped for un-specified reason.2184* @bss_param: current BSS parameters2185* @generation: generation number for nl80211 dumps.2186* This number should increase every time the list of stations2187* changes, i.e. when a station is added or removed, so that2188* userspace can tell whether it got a consistent snapshot.2189* @beacon_loss_count: Number of times beacon loss event has triggered.2190* @assoc_req_ies: IEs from (Re)Association Request.2191* This is used only when in AP mode with drivers that do not use2192* user space MLME/SME implementation. The information is provided for2193* the cfg80211_new_sta() calls to notify user space of the IEs.2194* @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.2195* @sta_flags: station flags mask & values2196* @t_offset: Time offset of the station relative to this host.2197* @llid: mesh local link id2198* @plid: mesh peer link id2199* @plink_state: mesh peer link state2200* @connected_to_gate: true if mesh STA has a path to mesh gate2201* @connected_to_as: true if mesh STA has a path to authentication server2202* @airtime_link_metric: mesh airtime link metric.2203* @local_pm: local mesh STA power save mode2204* @peer_pm: peer mesh STA power save mode2205* @nonpeer_pm: non-peer mesh STA power save mode2206* @expected_throughput: expected throughput in kbps (including 802.11 headers)2207* towards this station.2208* @rx_beacon: number of beacons received from this peer2209* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received2210* from this peer2211* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer2212* @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer2213* @airtime_weight: current airtime scheduling weight2214* @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last2215* (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.2216* Note that this doesn't use the @filled bit, but is used if non-NULL.2217* @ack_signal: signal strength (in dBm) of the last ACK frame.2218* @avg_ack_signal: average rssi value of ack packet for the no of msdu's has2219* been sent.2220* @rx_mpdu_count: number of MPDUs received from this station2221* @fcs_err_count: number of packets (MPDUs) received from this station with2222* an FCS error. This counter should be incremented only when TA of the2223* received packet with an FCS error matches the peer MAC address.2224* @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled2225* by driver. Drivers use this only in cfg80211_new_sta() calls when AP2226* MLD's MLME/SME is offload to driver. Drivers won't fill this2227* information in cfg80211_del_sta_sinfo(), get_station() and2228* dump_station() callbacks.2229* @assoc_link_id: Indicates MLO link ID of the AP, with which the station2230* completed (re)association. This information filled for both MLO2231* and non-MLO STA connections when the AP affiliated with an MLD.2232* @mld_addr: For MLO STA connection, filled with MLD address of the station.2233* For non-MLO STA connection, filled with all zeros.2234* @assoc_resp_ies: IEs from (Re)Association Response.2235* This is used only when in AP mode with drivers that do not use user2236* space MLME/SME implementation. The information is provided only for the2237* cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't2238* fill this information in cfg80211_del_sta_sinfo(), get_station() and2239* dump_station() callbacks. User space needs this information to determine2240* the accepted and rejected affiliated links of the connected station.2241* @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.2242* @valid_links: bitmap of valid links, or 0 for non-MLO. Drivers fill this2243* information in cfg80211_new_sta(), cfg80211_del_sta_sinfo(),2244* get_station() and dump_station() callbacks.2245* @links: reference to Link sta entries for MLO STA, all link specific2246* information is accessed through links[link_id].2247*/2248struct station_info {2249u64 filled;2250u32 connected_time;2251u32 inactive_time;2252u64 assoc_at;2253u64 rx_bytes;2254u64 tx_bytes;2255s8 signal;2256s8 signal_avg;22572258u8 chains;2259s8 chain_signal[IEEE80211_MAX_CHAINS];2260s8 chain_signal_avg[IEEE80211_MAX_CHAINS];22612262struct rate_info txrate;2263struct rate_info rxrate;2264u32 rx_packets;2265u32 tx_packets;2266u32 tx_retries;2267u32 tx_failed;2268u32 rx_dropped_misc;2269struct sta_bss_parameters bss_param;2270struct nl80211_sta_flag_update sta_flags;22712272int generation;22732274u32 beacon_loss_count;22752276const u8 *assoc_req_ies;2277size_t assoc_req_ies_len;22782279s64 t_offset;2280u16 llid;2281u16 plid;2282u8 plink_state;2283u8 connected_to_gate;2284u8 connected_to_as;2285u32 airtime_link_metric;2286enum nl80211_mesh_power_mode local_pm;2287enum nl80211_mesh_power_mode peer_pm;2288enum nl80211_mesh_power_mode nonpeer_pm;22892290u32 expected_throughput;22912292u16 airtime_weight;22932294s8 ack_signal;2295s8 avg_ack_signal;2296struct cfg80211_tid_stats *pertid;22972298u64 tx_duration;2299u64 rx_duration;2300u64 rx_beacon;2301u8 rx_beacon_signal_avg;23022303u32 rx_mpdu_count;2304u32 fcs_err_count;23052306bool mlo_params_valid;2307u8 assoc_link_id;2308u8 mld_addr[ETH_ALEN] __aligned(2);2309const u8 *assoc_resp_ies;2310size_t assoc_resp_ies_len;23112312u16 valid_links;2313struct link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS];2314};23152316/**2317* struct cfg80211_sar_sub_specs - sub specs limit2318* @power: power limitation in 0.25dbm2319* @freq_range_index: index the power limitation applies to2320*/2321struct cfg80211_sar_sub_specs {2322s32 power;2323u32 freq_range_index;2324};23252326/**2327* struct cfg80211_sar_specs - sar limit specs2328* @type: it's set with power in 0.25dbm or other types2329* @num_sub_specs: number of sar sub specs2330* @sub_specs: memory to hold the sar sub specs2331*/2332struct cfg80211_sar_specs {2333enum nl80211_sar_type type;2334u32 num_sub_specs;2335struct cfg80211_sar_sub_specs sub_specs[] __counted_by(num_sub_specs);2336};233723382339/**2340* struct cfg80211_sar_freq_ranges - sar frequency ranges2341* @start_freq: start range edge frequency2342* @end_freq: end range edge frequency2343*/2344struct cfg80211_sar_freq_ranges {2345u32 start_freq;2346u32 end_freq;2347};23482349/**2350* struct cfg80211_sar_capa - sar limit capability2351* @type: it's set via power in 0.25dbm or other types2352* @num_freq_ranges: number of frequency ranges2353* @freq_ranges: memory to hold the freq ranges.2354*2355* Note: WLAN driver may append new ranges or split an existing2356* range to small ones and then append them.2357*/2358struct cfg80211_sar_capa {2359enum nl80211_sar_type type;2360u32 num_freq_ranges;2361const struct cfg80211_sar_freq_ranges *freq_ranges;2362};23632364#if IS_ENABLED(CONFIG_CFG80211)2365/**2366* cfg80211_get_station - retrieve information about a given station2367* @dev: the device where the station is supposed to be connected to2368* @mac_addr: the mac address of the station of interest2369* @sinfo: pointer to the structure to fill with the information2370*2371* Return: 0 on success and sinfo is filled with the available information2372* otherwise returns a negative error code and the content of sinfo has to be2373* considered undefined.2374*/2375int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,2376struct station_info *sinfo);2377#else2378static inline int cfg80211_get_station(struct net_device *dev,2379const u8 *mac_addr,2380struct station_info *sinfo)2381{2382return -ENOENT;2383}2384#endif23852386/**2387* enum monitor_flags - monitor flags2388*2389* Monitor interface configuration flags. Note that these must be the bits2390* according to the nl80211 flags.2391*2392* @MONITOR_FLAG_CHANGED: set if the flags were changed2393* @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS2394* @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP2395* @MONITOR_FLAG_CONTROL: pass control frames2396* @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering2397* @MONITOR_FLAG_COOK_FRAMES: deprecated, will unconditionally be refused2398* @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address2399* @MONITOR_FLAG_SKIP_TX: do not pass locally transmitted frames2400*/2401enum monitor_flags {2402MONITOR_FLAG_CHANGED = BIT(__NL80211_MNTR_FLAG_INVALID),2403MONITOR_FLAG_FCSFAIL = BIT(NL80211_MNTR_FLAG_FCSFAIL),2404MONITOR_FLAG_PLCPFAIL = BIT(NL80211_MNTR_FLAG_PLCPFAIL),2405MONITOR_FLAG_CONTROL = BIT(NL80211_MNTR_FLAG_CONTROL),2406MONITOR_FLAG_OTHER_BSS = BIT(NL80211_MNTR_FLAG_OTHER_BSS),2407MONITOR_FLAG_COOK_FRAMES = BIT(NL80211_MNTR_FLAG_COOK_FRAMES),2408MONITOR_FLAG_ACTIVE = BIT(NL80211_MNTR_FLAG_ACTIVE),2409MONITOR_FLAG_SKIP_TX = BIT(NL80211_MNTR_FLAG_SKIP_TX),2410};24112412/**2413* enum mpath_info_flags - mesh path information flags2414*2415* Used by the driver to indicate which info in &struct mpath_info it has filled2416* in during get_station() or dump_station().2417*2418* @MPATH_INFO_FRAME_QLEN: @frame_qlen filled2419* @MPATH_INFO_SN: @sn filled2420* @MPATH_INFO_METRIC: @metric filled2421* @MPATH_INFO_EXPTIME: @exptime filled2422* @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled2423* @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled2424* @MPATH_INFO_FLAGS: @flags filled2425* @MPATH_INFO_HOP_COUNT: @hop_count filled2426* @MPATH_INFO_PATH_CHANGE: @path_change_count filled2427*/2428enum mpath_info_flags {2429MPATH_INFO_FRAME_QLEN = BIT(0),2430MPATH_INFO_SN = BIT(1),2431MPATH_INFO_METRIC = BIT(2),2432MPATH_INFO_EXPTIME = BIT(3),2433MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),2434MPATH_INFO_DISCOVERY_RETRIES = BIT(5),2435MPATH_INFO_FLAGS = BIT(6),2436MPATH_INFO_HOP_COUNT = BIT(7),2437MPATH_INFO_PATH_CHANGE = BIT(8),2438};24392440/**2441* struct mpath_info - mesh path information2442*2443* Mesh path information filled by driver for get_mpath() and dump_mpath().2444*2445* @filled: bitfield of flags from &enum mpath_info_flags2446* @frame_qlen: number of queued frames for this destination2447* @sn: target sequence number2448* @metric: metric (cost) of this mesh path2449* @exptime: expiration time for the mesh path from now, in msecs2450* @flags: mesh path flags from &enum mesh_path_flags2451* @discovery_timeout: total mesh path discovery timeout, in msecs2452* @discovery_retries: mesh path discovery retries2453* @generation: generation number for nl80211 dumps.2454* This number should increase every time the list of mesh paths2455* changes, i.e. when a station is added or removed, so that2456* userspace can tell whether it got a consistent snapshot.2457* @hop_count: hops to destination2458* @path_change_count: total number of path changes to destination2459*/2460struct mpath_info {2461u32 filled;2462u32 frame_qlen;2463u32 sn;2464u32 metric;2465u32 exptime;2466u32 discovery_timeout;2467u8 discovery_retries;2468u8 flags;2469u8 hop_count;2470u32 path_change_count;24712472int generation;2473};24742475/**2476* enum wiphy_bss_param_flags - bit positions for supported bss parameters.2477*2478* @WIPHY_BSS_PARAM_CTS_PROT: support changing CTS protection.2479* @WIPHY_BSS_PARAM_SHORT_PREAMBLE: support changing short preamble usage.2480* @WIPHY_BSS_PARAM_SHORT_SLOT_TIME: support changing short slot time usage.2481* @WIPHY_BSS_PARAM_BASIC_RATES: support reconfiguring basic rates.2482* @WIPHY_BSS_PARAM_AP_ISOLATE: support changing AP isolation.2483* @WIPHY_BSS_PARAM_HT_OPMODE: support changing HT operating mode.2484* @WIPHY_BSS_PARAM_P2P_CTWINDOW: support reconfiguring ctwindow.2485* @WIPHY_BSS_PARAM_P2P_OPPPS: support changing P2P opportunistic power-save.2486*/2487enum wiphy_bss_param_flags {2488WIPHY_BSS_PARAM_CTS_PROT = BIT(0),2489WIPHY_BSS_PARAM_SHORT_PREAMBLE = BIT(1),2490WIPHY_BSS_PARAM_SHORT_SLOT_TIME = BIT(2),2491WIPHY_BSS_PARAM_BASIC_RATES = BIT(3),2492WIPHY_BSS_PARAM_AP_ISOLATE = BIT(4),2493WIPHY_BSS_PARAM_HT_OPMODE = BIT(5),2494WIPHY_BSS_PARAM_P2P_CTWINDOW = BIT(6),2495WIPHY_BSS_PARAM_P2P_OPPPS = BIT(7),2496};24972498/**2499* struct bss_parameters - BSS parameters2500*2501* Used to change BSS parameters (mainly for AP mode).2502*2503* @link_id: link_id or -1 for non-MLD2504* @use_cts_prot: Whether to use CTS protection2505* (0 = no, 1 = yes, -1 = do not change)2506* @use_short_preamble: Whether the use of short preambles is allowed2507* (0 = no, 1 = yes, -1 = do not change)2508* @use_short_slot_time: Whether the use of short slot time is allowed2509* (0 = no, 1 = yes, -1 = do not change)2510* @basic_rates: basic rates in IEEE 802.11 format2511* (or NULL for no change)2512* @basic_rates_len: number of basic rates2513* @ap_isolate: do not forward packets between connected stations2514* (0 = no, 1 = yes, -1 = do not change)2515* @ht_opmode: HT Operation mode2516* (u16 = opmode, -1 = do not change)2517* @p2p_ctwindow: P2P CT Window (-1 = no change)2518* @p2p_opp_ps: P2P opportunistic PS (-1 = no change)2519*/2520struct bss_parameters {2521int link_id;2522int use_cts_prot;2523int use_short_preamble;2524int use_short_slot_time;2525const u8 *basic_rates;2526u8 basic_rates_len;2527int ap_isolate;2528int ht_opmode;2529s8 p2p_ctwindow, p2p_opp_ps;2530};25312532/**2533* struct mesh_config - 802.11s mesh configuration2534*2535* These parameters can be changed while the mesh is active.2536*2537* @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used2538* by the Mesh Peering Open message2539* @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units2540* used by the Mesh Peering Open message2541* @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by2542* the mesh peering management to close a mesh peering2543* @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this2544* mesh interface2545* @dot11MeshMaxRetries: the maximum number of peer link open retries that can2546* be sent to establish a new peer link instance in a mesh2547* @dot11MeshTTL: the value of TTL field set at a source mesh STA2548* @element_ttl: the value of TTL field set at a mesh STA for path selection2549* elements2550* @auto_open_plinks: whether we should automatically open peer links when we2551* detect compatible mesh peers2552* @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to2553* synchronize to for 11s default synchronization method2554* @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ2555* that an originator mesh STA can send to a particular path target2556* @path_refresh_time: how frequently to refresh mesh paths in milliseconds2557* @min_discovery_timeout: the minimum length of time to wait until giving up on2558* a path discovery in milliseconds2559* @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs2560* receiving a PREQ shall consider the forwarding information from the2561* root to be valid. (TU = time unit)2562* @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during2563* which a mesh STA can send only one action frame containing a PREQ2564* element2565* @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during2566* which a mesh STA can send only one Action frame containing a PERR2567* element2568* @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that2569* it takes for an HWMP information element to propagate across the mesh2570* @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA2571* @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root2572* announcements are transmitted2573* @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh2574* station has access to a broader network beyond the MBSS. (This is2575* missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true2576* only means that the station will announce others it's a mesh gate, but2577* not necessarily using the gate announcement protocol. Still keeping the2578* same nomenclature to be in sync with the spec)2579* @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding2580* entity (default is TRUE - forwarding entity)2581* @rssi_threshold: the threshold for average signal strength of candidate2582* station to establish a peer link2583* @ht_opmode: mesh HT protection mode2584*2585* @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs2586* receiving a proactive PREQ shall consider the forwarding information to2587* the root mesh STA to be valid.2588*2589* @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive2590* PREQs are transmitted.2591* @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)2592* during which a mesh STA can send only one Action frame containing2593* a PREQ element for root path confirmation.2594* @power_mode: The default mesh power save mode which will be the initial2595* setting for new peer links.2596* @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake2597* after transmitting its beacon.2598* @plink_timeout: If no tx activity is seen from a STA we've established2599* peering with for longer than this time (in seconds), then remove it2600* from the STA's list of peers. Default is 30 minutes.2601* @dot11MeshConnectedToAuthServer: if set to true then this mesh STA2602* will advertise that it is connected to a authentication server2603* in the mesh formation field.2604* @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is2605* connected to a mesh gate in mesh formation info. If false, the2606* value in mesh formation is determined by the presence of root paths2607* in the mesh path table2608* @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP2609* for HWMP) if the destination is a direct neighbor. Note that this might2610* not be the optimal decision as a multi-hop route might be better. So2611* if using this setting you will likely also want to disable2612* dot11MeshForwarding and use another mesh routing protocol on top.2613*/2614struct mesh_config {2615u16 dot11MeshRetryTimeout;2616u16 dot11MeshConfirmTimeout;2617u16 dot11MeshHoldingTimeout;2618u16 dot11MeshMaxPeerLinks;2619u8 dot11MeshMaxRetries;2620u8 dot11MeshTTL;2621u8 element_ttl;2622bool auto_open_plinks;2623u32 dot11MeshNbrOffsetMaxNeighbor;2624u8 dot11MeshHWMPmaxPREQretries;2625u32 path_refresh_time;2626u16 min_discovery_timeout;2627u32 dot11MeshHWMPactivePathTimeout;2628u16 dot11MeshHWMPpreqMinInterval;2629u16 dot11MeshHWMPperrMinInterval;2630u16 dot11MeshHWMPnetDiameterTraversalTime;2631u8 dot11MeshHWMPRootMode;2632bool dot11MeshConnectedToMeshGate;2633bool dot11MeshConnectedToAuthServer;2634u16 dot11MeshHWMPRannInterval;2635bool dot11MeshGateAnnouncementProtocol;2636bool dot11MeshForwarding;2637s32 rssi_threshold;2638u16 ht_opmode;2639u32 dot11MeshHWMPactivePathToRootTimeout;2640u16 dot11MeshHWMProotInterval;2641u16 dot11MeshHWMPconfirmationInterval;2642enum nl80211_mesh_power_mode power_mode;2643u16 dot11MeshAwakeWindowDuration;2644u32 plink_timeout;2645bool dot11MeshNolearn;2646};26472648/**2649* struct mesh_setup - 802.11s mesh setup configuration2650* @chandef: defines the channel to use2651* @mesh_id: the mesh ID2652* @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes2653* @sync_method: which synchronization method to use2654* @path_sel_proto: which path selection protocol to use2655* @path_metric: which metric to use2656* @auth_id: which authentication method this mesh is using2657* @ie: vendor information elements (optional)2658* @ie_len: length of vendor information elements2659* @is_authenticated: this mesh requires authentication2660* @is_secure: this mesh uses security2661* @user_mpm: userspace handles all MPM functions2662* @dtim_period: DTIM period to use2663* @beacon_interval: beacon interval to use2664* @mcast_rate: multicast rate for Mesh Node [6Mbps is the default for 802.11a]2665* @basic_rates: basic rates to use when creating the mesh2666* @beacon_rate: bitrate to be used for beacons2667* @userspace_handles_dfs: whether user space controls DFS operation, i.e.2668* changes the channel when a radar is detected. This is required2669* to operate on DFS channels.2670* @control_port_over_nl80211: TRUE if userspace expects to exchange control2671* port frames over NL80211 instead of the network interface.2672*2673* These parameters are fixed when the mesh is created.2674*/2675struct mesh_setup {2676struct cfg80211_chan_def chandef;2677const u8 *mesh_id;2678u8 mesh_id_len;2679u8 sync_method;2680u8 path_sel_proto;2681u8 path_metric;2682u8 auth_id;2683const u8 *ie;2684u8 ie_len;2685bool is_authenticated;2686bool is_secure;2687bool user_mpm;2688u8 dtim_period;2689u16 beacon_interval;2690int mcast_rate[NUM_NL80211_BANDS];2691u32 basic_rates;2692struct cfg80211_bitrate_mask beacon_rate;2693bool userspace_handles_dfs;2694bool control_port_over_nl80211;2695};26962697/**2698* struct ocb_setup - 802.11p OCB mode setup configuration2699* @chandef: defines the channel to use2700*2701* These parameters are fixed when connecting to the network2702*/2703struct ocb_setup {2704struct cfg80211_chan_def chandef;2705};27062707/**2708* struct ieee80211_txq_params - TX queue parameters2709* @ac: AC identifier2710* @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled2711* @cwmin: Minimum contention window [a value of the form 2^n-1 in the range2712* 1..32767]2713* @cwmax: Maximum contention window [a value of the form 2^n-1 in the range2714* 1..32767]2715* @aifs: Arbitration interframe space [0..255]2716* @link_id: link_id or -1 for non-MLD2717*/2718struct ieee80211_txq_params {2719enum nl80211_ac ac;2720u16 txop;2721u16 cwmin;2722u16 cwmax;2723u8 aifs;2724int link_id;2725};27262727/**2728* DOC: Scanning and BSS list handling2729*2730* The scanning process itself is fairly simple, but cfg80211 offers quite2731* a bit of helper functionality. To start a scan, the scan operation will2732* be invoked with a scan definition. This scan definition contains the2733* channels to scan, and the SSIDs to send probe requests for (including the2734* wildcard, if desired). A passive scan is indicated by having no SSIDs to2735* probe. Additionally, a scan request may contain extra information elements2736* that should be added to the probe request. The IEs are guaranteed to be2737* well-formed, and will not exceed the maximum length the driver advertised2738* in the wiphy structure.2739*2740* When scanning finds a BSS, cfg80211 needs to be notified of that, because2741* it is responsible for maintaining the BSS list; the driver should not2742* maintain a list itself. For this notification, various functions exist.2743*2744* Since drivers do not maintain a BSS list, there are also a number of2745* functions to search for a BSS and obtain information about it from the2746* BSS structure cfg80211 maintains. The BSS list is also made available2747* to userspace.2748*/27492750/**2751* struct cfg80211_ssid - SSID description2752* @ssid: the SSID2753* @ssid_len: length of the ssid2754*/2755struct cfg80211_ssid {2756u8 ssid[IEEE80211_MAX_SSID_LEN];2757u8 ssid_len;2758};27592760/**2761* struct cfg80211_scan_info - information about completed scan2762* @scan_start_tsf: scan start time in terms of the TSF of the BSS that the2763* wireless device that requested the scan is connected to. If this2764* information is not available, this field is left zero.2765* @tsf_bssid: the BSSID according to which %scan_start_tsf is set.2766* @aborted: set to true if the scan was aborted for any reason,2767* userspace will be notified of that2768*/2769struct cfg80211_scan_info {2770u64 scan_start_tsf;2771u8 tsf_bssid[ETH_ALEN] __aligned(2);2772bool aborted;2773};27742775/**2776* struct cfg80211_scan_6ghz_params - relevant for 6 GHz only2777*2778* @short_ssid: short ssid to scan for2779* @bssid: bssid to scan for2780* @channel_idx: idx of the channel in the channel array in the scan request2781* which the above info is relevant to2782* @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU2783* @short_ssid_valid: @short_ssid is valid and can be used2784* @psc_no_listen: when set, and the channel is a PSC channel, no need to wait2785* 20 TUs before starting to send probe requests.2786* @psd_20: The AP's 20 MHz PSD value.2787*/2788struct cfg80211_scan_6ghz_params {2789u32 short_ssid;2790u32 channel_idx;2791u8 bssid[ETH_ALEN];2792bool unsolicited_probe;2793bool short_ssid_valid;2794bool psc_no_listen;2795s8 psd_20;2796};27972798/**2799* struct cfg80211_scan_request - scan request description2800*2801* @ssids: SSIDs to scan for (active scan only)2802* @n_ssids: number of SSIDs2803* @channels: channels to scan on.2804* @n_channels: total number of channels to scan2805* @ie: optional information element(s) to add into Probe Request or %NULL2806* @ie_len: length of ie in octets2807* @duration: how long to listen on each channel, in TUs. If2808* %duration_mandatory is not set, this is the maximum dwell time and2809* the actual dwell time may be shorter.2810* @duration_mandatory: if set, the scan duration must be as specified by the2811* %duration field.2812* @flags: control flags from &enum nl80211_scan_flags2813* @rates: bitmap of rates to advertise for each band2814* @wiphy: the wiphy this was for2815* @scan_start: time (in jiffies) when the scan started2816* @wdev: the wireless device to scan for2817* @no_cck: used to send probe requests at non CCK rate in 2GHz band2818* @mac_addr: MAC address used with randomisation2819* @mac_addr_mask: MAC address mask used with randomisation, bits that2820* are 0 in the mask should be randomised, bits that are 1 should2821* be taken from the @mac_addr2822* @scan_6ghz: relevant for split scan request only,2823* true if this is a 6 GHz scan request2824* @first_part: %true if this is the first part of a split scan request or a2825* scan that was not split. May be %true for a @scan_6ghz scan if no other2826* channels were requested2827* @n_6ghz_params: number of 6 GHz params2828* @scan_6ghz_params: 6 GHz params2829* @bssid: BSSID to scan for (most commonly, the wildcard BSSID)2830* @tsf_report_link_id: for MLO, indicates the link ID of the BSS that should be2831* used for TSF reporting. Can be set to -1 to indicate no preference.2832*/2833struct cfg80211_scan_request {2834struct cfg80211_ssid *ssids;2835int n_ssids;2836u32 n_channels;2837const u8 *ie;2838size_t ie_len;2839u16 duration;2840bool duration_mandatory;2841u32 flags;28422843u32 rates[NUM_NL80211_BANDS];28442845struct wireless_dev *wdev;28462847u8 mac_addr[ETH_ALEN] __aligned(2);2848u8 mac_addr_mask[ETH_ALEN] __aligned(2);2849u8 bssid[ETH_ALEN] __aligned(2);2850struct wiphy *wiphy;2851unsigned long scan_start;2852bool no_cck;2853bool scan_6ghz;2854bool first_part;2855u32 n_6ghz_params;2856struct cfg80211_scan_6ghz_params *scan_6ghz_params;2857s8 tsf_report_link_id;28582859/* keep last */2860struct ieee80211_channel *channels[];2861};28622863static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)2864{2865int i;28662867get_random_bytes(buf, ETH_ALEN);2868for (i = 0; i < ETH_ALEN; i++) {2869buf[i] &= ~mask[i];2870buf[i] |= addr[i] & mask[i];2871}2872}28732874/**2875* struct cfg80211_match_set - sets of attributes to match2876*2877* @ssid: SSID to be matched; may be zero-length in case of BSSID match2878* or no match (RSSI only)2879* @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match2880* or no match (RSSI only)2881* @rssi_thold: don't report scan results below this threshold (in s32 dBm)2882*/2883struct cfg80211_match_set {2884struct cfg80211_ssid ssid;2885u8 bssid[ETH_ALEN];2886s32 rssi_thold;2887};28882889/**2890* struct cfg80211_sched_scan_plan - scan plan for scheduled scan2891*2892* @interval: interval between scheduled scan iterations. In seconds.2893* @iterations: number of scan iterations in this scan plan. Zero means2894* infinite loop.2895* The last scan plan will always have this parameter set to zero,2896* all other scan plans will have a finite number of iterations.2897*/2898struct cfg80211_sched_scan_plan {2899u32 interval;2900u32 iterations;2901};29022903/**2904* struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.2905*2906* @band: band of BSS which should match for RSSI level adjustment.2907* @delta: value of RSSI level adjustment.2908*/2909struct cfg80211_bss_select_adjust {2910enum nl80211_band band;2911s8 delta;2912};29132914/**2915* struct cfg80211_sched_scan_request - scheduled scan request description2916*2917* @reqid: identifies this request.2918* @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)2919* @n_ssids: number of SSIDs2920* @n_channels: total number of channels to scan2921* @ie: optional information element(s) to add into Probe Request or %NULL2922* @ie_len: length of ie in octets2923* @flags: control flags from &enum nl80211_scan_flags2924* @match_sets: sets of parameters to be matched for a scan result2925* entry to be considered valid and to be passed to the host2926* (others are filtered out).2927* If omitted, all results are passed.2928* @n_match_sets: number of match sets2929* @report_results: indicates that results were reported for this request2930* @wiphy: the wiphy this was for2931* @dev: the interface2932* @scan_start: start time of the scheduled scan2933* @channels: channels to scan2934* @min_rssi_thold: for drivers only supporting a single threshold, this2935* contains the minimum over all matchsets2936* @mac_addr: MAC address used with randomisation2937* @mac_addr_mask: MAC address mask used with randomisation, bits that2938* are 0 in the mask should be randomised, bits that are 1 should2939* be taken from the @mac_addr2940* @scan_plans: scan plans to be executed in this scheduled scan. Lowest2941* index must be executed first.2942* @n_scan_plans: number of scan plans, at least 1.2943* @rcu_head: RCU callback used to free the struct2944* @owner_nlportid: netlink portid of owner (if this should is a request2945* owned by a particular socket)2946* @nl_owner_dead: netlink owner socket was closed - this request be freed2947* @list: for keeping list of requests.2948* @delay: delay in seconds to use before starting the first scan2949* cycle. The driver may ignore this parameter and start2950* immediately (or at any other time), if this feature is not2951* supported.2952* @relative_rssi_set: Indicates whether @relative_rssi is set or not.2953* @relative_rssi: Relative RSSI threshold in dB to restrict scan result2954* reporting in connected state to cases where a matching BSS is determined2955* to have better or slightly worse RSSI than the current connected BSS.2956* The relative RSSI threshold values are ignored in disconnected state.2957* @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong2958* to the specified band while deciding whether a better BSS is reported2959* using @relative_rssi. If delta is a negative number, the BSSs that2960* belong to the specified band will be penalized by delta dB in relative2961* comparisons.2962*/2963struct cfg80211_sched_scan_request {2964u64 reqid;2965struct cfg80211_ssid *ssids;2966int n_ssids;2967u32 n_channels;2968const u8 *ie;2969size_t ie_len;2970u32 flags;2971struct cfg80211_match_set *match_sets;2972int n_match_sets;2973s32 min_rssi_thold;2974u32 delay;2975struct cfg80211_sched_scan_plan *scan_plans;2976int n_scan_plans;29772978u8 mac_addr[ETH_ALEN] __aligned(2);2979u8 mac_addr_mask[ETH_ALEN] __aligned(2);29802981bool relative_rssi_set;2982s8 relative_rssi;2983struct cfg80211_bss_select_adjust rssi_adjust;29842985/* internal */2986struct wiphy *wiphy;2987struct net_device *dev;2988unsigned long scan_start;2989bool report_results;2990struct rcu_head rcu_head;2991u32 owner_nlportid;2992bool nl_owner_dead;2993struct list_head list;29942995/* keep last */2996struct ieee80211_channel *channels[] __counted_by(n_channels);2997};29982999/**3000* enum cfg80211_signal_type - signal type3001*3002* @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available3003* @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)3004* @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 1003005*/3006enum cfg80211_signal_type {3007CFG80211_SIGNAL_TYPE_NONE,3008CFG80211_SIGNAL_TYPE_MBM,3009CFG80211_SIGNAL_TYPE_UNSPEC,3010};30113012/**3013* struct cfg80211_inform_bss - BSS inform data3014* @chan: channel the frame was received on3015* @signal: signal strength value, according to the wiphy's3016* signal type3017* @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was3018* received; should match the time when the frame was actually3019* received by the device (not just by the host, in case it was3020* buffered on the device) and be accurate to about 10ms.3021* If the frame isn't buffered, just passing the return value of3022* ktime_get_boottime_ns() is likely appropriate.3023* @parent_tsf: the time at the start of reception of the first octet of the3024* timestamp field of the frame. The time is the TSF of the BSS specified3025* by %parent_bssid.3026* @parent_bssid: the BSS according to which %parent_tsf is set. This is set to3027* the BSS that requested the scan in which the beacon/probe was received.3028* @chains: bitmask for filled values in @chain_signal.3029* @chain_signal: per-chain signal strength of last received BSS in dBm.3030* @restrict_use: restrict usage, if not set, assume @use_for is3031* %NL80211_BSS_USE_FOR_NORMAL.3032* @use_for: bitmap of possible usage for this BSS, see3033* &enum nl80211_bss_use_for3034* @cannot_use_reasons: the reasons (bitmap) for not being able to connect,3035* if @restrict_use is set and @use_for is zero (empty); may be 0 for3036* unspecified reasons; see &enum nl80211_bss_cannot_use_reasons3037* @drv_data: Data to be passed through to @inform_bss3038*/3039struct cfg80211_inform_bss {3040struct ieee80211_channel *chan;3041s32 signal;3042u64 boottime_ns;3043u64 parent_tsf;3044u8 parent_bssid[ETH_ALEN] __aligned(2);3045u8 chains;3046s8 chain_signal[IEEE80211_MAX_CHAINS];30473048u8 restrict_use:1, use_for:7;3049u8 cannot_use_reasons;30503051void *drv_data;3052};30533054/**3055* struct cfg80211_bss_ies - BSS entry IE data3056* @tsf: TSF contained in the frame that carried these IEs3057* @rcu_head: internal use, for freeing3058* @len: length of the IEs3059* @from_beacon: these IEs are known to come from a beacon3060* @data: IE data3061*/3062struct cfg80211_bss_ies {3063u64 tsf;3064struct rcu_head rcu_head;3065int len;3066bool from_beacon;3067u8 data[];3068};30693070/**3071* struct cfg80211_bss - BSS description3072*3073* This structure describes a BSS (which may also be a mesh network)3074* for use in scan results and similar.3075*3076* @channel: channel this BSS is on3077* @bssid: BSSID of the BSS3078* @beacon_interval: the beacon interval as from the frame3079* @capability: the capability field in host byte order3080* @ies: the information elements (Note that there is no guarantee that these3081* are well-formed!); this is a pointer to either the beacon_ies or3082* proberesp_ies depending on whether Probe Response frame has been3083* received. It is always non-%NULL.3084* @beacon_ies: the information elements from the last Beacon frame3085* (implementation note: if @hidden_beacon_bss is set this struct doesn't3086* own the beacon_ies, but they're just pointers to the ones from the3087* @hidden_beacon_bss struct)3088* @proberesp_ies: the information elements from the last Probe Response frame3089* @proberesp_ecsa_stuck: ECSA element is stuck in the Probe Response frame,3090* cannot rely on it having valid data3091* @hidden_beacon_bss: in case this BSS struct represents a probe response from3092* a BSS that hides the SSID in its beacon, this points to the BSS struct3093* that holds the beacon data. @beacon_ies is still valid, of course, and3094* points to the same data as hidden_beacon_bss->beacon_ies in that case.3095* @transmitted_bss: pointer to the transmitted BSS, if this is a3096* non-transmitted one (multi-BSSID support)3097* @nontrans_list: list of non-transmitted BSS, if this is a transmitted one3098* (multi-BSSID support)3099* @signal: signal strength value (type depends on the wiphy's signal_type)3100* @ts_boottime: timestamp of the last BSS update in nanoseconds since boot3101* @chains: bitmask for filled values in @chain_signal.3102* @chain_signal: per-chain signal strength of last received BSS in dBm.3103* @bssid_index: index in the multiple BSS set3104* @max_bssid_indicator: max number of members in the BSS set3105* @use_for: bitmap of possible usage for this BSS, see3106* &enum nl80211_bss_use_for3107* @cannot_use_reasons: the reasons (bitmap) for not being able to connect,3108* if @restrict_use is set and @use_for is zero (empty); may be 0 for3109* unspecified reasons; see &enum nl80211_bss_cannot_use_reasons3110* @priv: private area for driver use, has at least wiphy->bss_priv_size bytes3111*/3112struct cfg80211_bss {3113struct ieee80211_channel *channel;31143115const struct cfg80211_bss_ies __rcu *ies;3116const struct cfg80211_bss_ies __rcu *beacon_ies;3117const struct cfg80211_bss_ies __rcu *proberesp_ies;31183119struct cfg80211_bss *hidden_beacon_bss;3120struct cfg80211_bss *transmitted_bss;3121struct list_head nontrans_list;31223123s32 signal;31243125u64 ts_boottime;31263127u16 beacon_interval;3128u16 capability;31293130u8 bssid[ETH_ALEN];3131u8 chains;3132s8 chain_signal[IEEE80211_MAX_CHAINS];31333134u8 proberesp_ecsa_stuck:1;31353136u8 bssid_index;3137u8 max_bssid_indicator;31383139u8 use_for;3140u8 cannot_use_reasons;31413142u8 priv[] __aligned(sizeof(void *));3143};31443145/**3146* ieee80211_bss_get_elem - find element with given ID3147* @bss: the bss to search3148* @id: the element ID3149*3150* Note that the return value is an RCU-protected pointer, so3151* rcu_read_lock() must be held when calling this function.3152* Return: %NULL if not found.3153*/3154const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);31553156/**3157* ieee80211_bss_get_ie - find IE with given ID3158* @bss: the bss to search3159* @id: the element ID3160*3161* Note that the return value is an RCU-protected pointer, so3162* rcu_read_lock() must be held when calling this function.3163* Return: %NULL if not found.3164*/3165static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)3166{3167return (const void *)ieee80211_bss_get_elem(bss, id);3168}316931703171/**3172* struct cfg80211_auth_request - Authentication request data3173*3174* This structure provides information needed to complete IEEE 802.113175* authentication.3176*3177* @bss: The BSS to authenticate with, the callee must obtain a reference3178* to it if it needs to keep it.3179* @supported_selectors: List of selectors that should be assumed to be3180* supported by the station.3181* SAE_H2E must be assumed supported if set to %NULL.3182* @supported_selectors_len: Length of supported_selectors in octets.3183* @auth_type: Authentication type (algorithm)3184* @ie: Extra IEs to add to Authentication frame or %NULL3185* @ie_len: Length of ie buffer in octets3186* @key_len: length of WEP key for shared key authentication3187* @key_idx: index of WEP key for shared key authentication3188* @key: WEP key for shared key authentication3189* @auth_data: Fields and elements in Authentication frames. This contains3190* the authentication frame body (non-IE and IE data), excluding the3191* Authentication algorithm number, i.e., starting at the Authentication3192* transaction sequence number field.3193* @auth_data_len: Length of auth_data buffer in octets3194* @link_id: if >= 0, indicates authentication should be done as an MLD,3195* the interface address is included as the MLD address and the3196* necessary link (with the given link_id) will be created (and3197* given an MLD address) by the driver3198* @ap_mld_addr: AP MLD address in case of authentication request with3199* an AP MLD, valid iff @link_id >= 03200*/3201struct cfg80211_auth_request {3202struct cfg80211_bss *bss;3203const u8 *ie;3204size_t ie_len;3205const u8 *supported_selectors;3206u8 supported_selectors_len;3207enum nl80211_auth_type auth_type;3208const u8 *key;3209u8 key_len;3210s8 key_idx;3211const u8 *auth_data;3212size_t auth_data_len;3213s8 link_id;3214const u8 *ap_mld_addr;3215};32163217/**3218* struct cfg80211_assoc_link - per-link information for MLO association3219* @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;3220* if this is %NULL for a link, that link is not requested3221* @elems: extra elements for the per-STA profile for this link3222* @elems_len: length of the elements3223* @error: per-link error code, must be <= 0. If there is an error, then the3224* operation as a whole must fail.3225*/3226struct cfg80211_assoc_link {3227struct cfg80211_bss *bss;3228const u8 *elems;3229size_t elems_len;3230int error;3231};32323233/**3234* struct cfg80211_ml_reconf_req - MLO link reconfiguration request3235* @add_links: data for links to add, see &struct cfg80211_assoc_link3236* @rem_links: bitmap of links to remove3237* @ext_mld_capa_ops: extended MLD capabilities and operations set by3238* userspace for the ML reconfiguration action frame3239*/3240struct cfg80211_ml_reconf_req {3241struct cfg80211_assoc_link add_links[IEEE80211_MLD_MAX_NUM_LINKS];3242u16 rem_links;3243u16 ext_mld_capa_ops;3244};32453246/**3247* enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.3248*3249* @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)3250* @ASSOC_REQ_DISABLE_VHT: Disable VHT3251* @ASSOC_REQ_USE_RRM: Declare RRM capability in this association3252* @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external3253* authentication capability. Drivers can offload authentication to3254* userspace if this flag is set. Only applicable for cfg80211_connect()3255* request (connect callback).3256* @ASSOC_REQ_DISABLE_HE: Disable HE3257* @ASSOC_REQ_DISABLE_EHT: Disable EHT3258* @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.3259* Drivers shall disable MLO features for the current association if this3260* flag is not set.3261* @ASSOC_REQ_SPP_AMSDU: SPP A-MSDUs will be used on this connection (if any)3262*/3263enum cfg80211_assoc_req_flags {3264ASSOC_REQ_DISABLE_HT = BIT(0),3265ASSOC_REQ_DISABLE_VHT = BIT(1),3266ASSOC_REQ_USE_RRM = BIT(2),3267CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),3268ASSOC_REQ_DISABLE_HE = BIT(4),3269ASSOC_REQ_DISABLE_EHT = BIT(5),3270CONNECT_REQ_MLO_SUPPORT = BIT(6),3271ASSOC_REQ_SPP_AMSDU = BIT(7),3272};32733274/**3275* struct cfg80211_assoc_request - (Re)Association request data3276*3277* This structure provides information needed to complete IEEE 802.113278* (re)association.3279* @bss: The BSS to associate with. If the call is successful the driver is3280* given a reference that it must give back to cfg80211_send_rx_assoc()3281* or to cfg80211_assoc_timeout(). To ensure proper refcounting, new3282* association requests while already associating must be rejected.3283* This also applies to the @links.bss parameter, which is used instead3284* of this one (it is %NULL) for MLO associations.3285* @ie: Extra IEs to add to (Re)Association Request frame or %NULL3286* @ie_len: Length of ie buffer in octets3287* @use_mfp: Use management frame protection (IEEE 802.11w) in this association3288* @crypto: crypto settings3289* @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used3290* to indicate a request to reassociate within the ESS instead of a request3291* do the initial association with the ESS. When included, this is set to3292* the BSSID of the current association, i.e., to the value that is3293* included in the Current AP address field of the Reassociation Request3294* frame.3295* @flags: See &enum cfg80211_assoc_req_flags3296* @supported_selectors: supported BSS selectors in IEEE 802.11 format3297* (or %NULL for no change).3298* If %NULL, then support for SAE_H2E should be assumed.3299* @supported_selectors_len: number of supported BSS selectors3300* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3301* will be used in ht_capa. Un-supported values will be ignored.3302* @ht_capa_mask: The bits of ht_capa which are to be used.3303* @vht_capa: VHT capability override3304* @vht_capa_mask: VHT capability mask indicating which fields to use3305* @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or3306* %NULL if FILS is not used.3307* @fils_kek_len: Length of fils_kek in octets3308* @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association3309* Request/Response frame or %NULL if FILS is not used. This field starts3310* with 16 octets of STA Nonce followed by 16 octets of AP Nonce.3311* @s1g_capa: S1G capability override3312* @s1g_capa_mask: S1G capability override mask3313* @links: per-link information for MLO connections3314* @link_id: >= 0 for MLO connections, where links are given, and indicates3315* the link on which the association request should be sent3316* @ap_mld_addr: AP MLD address in case of MLO association request,3317* valid iff @link_id >= 03318* @ext_mld_capa_ops: extended MLD capabilities and operations set by3319* userspace for the association3320*/3321struct cfg80211_assoc_request {3322struct cfg80211_bss *bss;3323const u8 *ie, *prev_bssid;3324size_t ie_len;3325struct cfg80211_crypto_settings crypto;3326bool use_mfp;3327u32 flags;3328const u8 *supported_selectors;3329u8 supported_selectors_len;3330struct ieee80211_ht_cap ht_capa;3331struct ieee80211_ht_cap ht_capa_mask;3332struct ieee80211_vht_cap vht_capa, vht_capa_mask;3333const u8 *fils_kek;3334size_t fils_kek_len;3335const u8 *fils_nonces;3336struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;3337struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];3338const u8 *ap_mld_addr;3339s8 link_id;3340u16 ext_mld_capa_ops;3341};33423343/**3344* struct cfg80211_deauth_request - Deauthentication request data3345*3346* This structure provides information needed to complete IEEE 802.113347* deauthentication.3348*3349* @bssid: the BSSID or AP MLD address to deauthenticate from3350* @ie: Extra IEs to add to Deauthentication frame or %NULL3351* @ie_len: Length of ie buffer in octets3352* @reason_code: The reason code for the deauthentication3353* @local_state_change: if set, change local state only and3354* do not set a deauth frame3355*/3356struct cfg80211_deauth_request {3357const u8 *bssid;3358const u8 *ie;3359size_t ie_len;3360u16 reason_code;3361bool local_state_change;3362};33633364/**3365* struct cfg80211_disassoc_request - Disassociation request data3366*3367* This structure provides information needed to complete IEEE 802.113368* disassociation.3369*3370* @ap_addr: the BSSID or AP MLD address to disassociate from3371* @ie: Extra IEs to add to Disassociation frame or %NULL3372* @ie_len: Length of ie buffer in octets3373* @reason_code: The reason code for the disassociation3374* @local_state_change: This is a request for a local state only, i.e., no3375* Disassociation frame is to be transmitted.3376*/3377struct cfg80211_disassoc_request {3378const u8 *ap_addr;3379const u8 *ie;3380size_t ie_len;3381u16 reason_code;3382bool local_state_change;3383};33843385/**3386* struct cfg80211_ibss_params - IBSS parameters3387*3388* This structure defines the IBSS parameters for the join_ibss()3389* method.3390*3391* @ssid: The SSID, will always be non-null.3392* @ssid_len: The length of the SSID, will always be non-zero.3393* @bssid: Fixed BSSID requested, maybe be %NULL, if set do not3394* search for IBSSs with a different BSSID.3395* @chandef: defines the channel to use if no other IBSS to join can be found3396* @channel_fixed: The channel should be fixed -- do not search for3397* IBSSs to join on other channels.3398* @ie: information element(s) to include in the beacon3399* @ie_len: length of that3400* @beacon_interval: beacon interval to use3401* @privacy: this is a protected network, keys will be configured3402* after joining3403* @control_port: whether user space controls IEEE 802.1X port, i.e.,3404* sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is3405* required to assume that the port is unauthorized until authorized by3406* user space. Otherwise, port is marked authorized by default.3407* @control_port_over_nl80211: TRUE if userspace expects to exchange control3408* port frames over NL80211 instead of the network interface.3409* @userspace_handles_dfs: whether user space controls DFS operation, i.e.3410* changes the channel when a radar is detected. This is required3411* to operate on DFS channels.3412* @basic_rates: bitmap of basic rates to use when creating the IBSS3413* @mcast_rate: per-band multicast rate index + 1 (0: disabled)3414* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3415* will be used in ht_capa. Un-supported values will be ignored.3416* @ht_capa_mask: The bits of ht_capa which are to be used.3417* @wep_keys: static WEP keys, if not NULL points to an array of3418* CFG80211_MAX_WEP_KEYS WEP keys3419* @wep_tx_key: key index (0..3) of the default TX static WEP key3420*/3421struct cfg80211_ibss_params {3422const u8 *ssid;3423const u8 *bssid;3424struct cfg80211_chan_def chandef;3425const u8 *ie;3426u8 ssid_len, ie_len;3427u16 beacon_interval;3428u32 basic_rates;3429bool channel_fixed;3430bool privacy;3431bool control_port;3432bool control_port_over_nl80211;3433bool userspace_handles_dfs;3434int mcast_rate[NUM_NL80211_BANDS];3435struct ieee80211_ht_cap ht_capa;3436struct ieee80211_ht_cap ht_capa_mask;3437struct key_params *wep_keys;3438int wep_tx_key;3439};34403441/**3442* struct cfg80211_bss_selection - connection parameters for BSS selection.3443*3444* @behaviour: requested BSS selection behaviour.3445* @param: parameters for requestion behaviour.3446* @param.band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.3447* @param.adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.3448*/3449struct cfg80211_bss_selection {3450enum nl80211_bss_select_attr behaviour;3451union {3452enum nl80211_band band_pref;3453struct cfg80211_bss_select_adjust adjust;3454} param;3455};34563457/**3458* struct cfg80211_connect_params - Connection parameters3459*3460* This structure provides information needed to complete IEEE 802.113461* authentication and association.3462*3463* @channel: The channel to use or %NULL if not specified (auto-select based3464* on scan results)3465* @channel_hint: The channel of the recommended BSS for initial connection or3466* %NULL if not specified3467* @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan3468* results)3469* @bssid_hint: The recommended AP BSSID for initial connection to the BSS or3470* %NULL if not specified. Unlike the @bssid parameter, the driver is3471* allowed to ignore this @bssid_hint if it has knowledge of a better BSS3472* to use.3473* @ssid: SSID3474* @ssid_len: Length of ssid in octets3475* @auth_type: Authentication type (algorithm)3476* @ie: IEs for association request3477* @ie_len: Length of assoc_ie in octets3478* @privacy: indicates whether privacy-enabled APs should be used3479* @mfp: indicate whether management frame protection is used3480* @crypto: crypto settings3481* @key_len: length of WEP key for shared key authentication3482* @key_idx: index of WEP key for shared key authentication3483* @key: WEP key for shared key authentication3484* @flags: See &enum cfg80211_assoc_req_flags3485* @bg_scan_period: Background scan period in seconds3486* or -1 to indicate that default value is to be used.3487* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3488* will be used in ht_capa. Un-supported values will be ignored.3489* @ht_capa_mask: The bits of ht_capa which are to be used.3490* @vht_capa: VHT Capability overrides3491* @vht_capa_mask: The bits of vht_capa which are to be used.3492* @pbss: if set, connect to a PCP instead of AP. Valid for DMG3493* networks.3494* @bss_select: criteria to be used for BSS selection.3495* @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used3496* to indicate a request to reassociate within the ESS instead of a request3497* do the initial association with the ESS. When included, this is set to3498* the BSSID of the current association, i.e., to the value that is3499* included in the Current AP address field of the Reassociation Request3500* frame.3501* @fils_erp_username: EAP re-authentication protocol (ERP) username part of the3502* NAI or %NULL if not specified. This is used to construct FILS wrapped3503* data IE.3504* @fils_erp_username_len: Length of @fils_erp_username in octets.3505* @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or3506* %NULL if not specified. This specifies the domain name of ER server and3507* is used to construct FILS wrapped data IE.3508* @fils_erp_realm_len: Length of @fils_erp_realm in octets.3509* @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP3510* messages. This is also used to construct FILS wrapped data IE.3511* @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional3512* keys in FILS or %NULL if not specified.3513* @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.3514* @want_1x: indicates user-space supports and wants to use 802.1X driver3515* offload of 4-way handshake.3516* @edmg: define the EDMG channels.3517* This may specify multiple channels and bonding options for the driver3518* to choose from, based on BSS configuration.3519*/3520struct cfg80211_connect_params {3521struct ieee80211_channel *channel;3522struct ieee80211_channel *channel_hint;3523const u8 *bssid;3524const u8 *bssid_hint;3525const u8 *ssid;3526size_t ssid_len;3527enum nl80211_auth_type auth_type;3528const u8 *ie;3529size_t ie_len;3530bool privacy;3531enum nl80211_mfp mfp;3532struct cfg80211_crypto_settings crypto;3533const u8 *key;3534u8 key_len, key_idx;3535u32 flags;3536int bg_scan_period;3537struct ieee80211_ht_cap ht_capa;3538struct ieee80211_ht_cap ht_capa_mask;3539struct ieee80211_vht_cap vht_capa;3540struct ieee80211_vht_cap vht_capa_mask;3541bool pbss;3542struct cfg80211_bss_selection bss_select;3543const u8 *prev_bssid;3544const u8 *fils_erp_username;3545size_t fils_erp_username_len;3546const u8 *fils_erp_realm;3547size_t fils_erp_realm_len;3548u16 fils_erp_next_seq_num;3549const u8 *fils_erp_rrk;3550size_t fils_erp_rrk_len;3551bool want_1x;3552struct ieee80211_edmg edmg;3553};35543555/**3556* enum cfg80211_connect_params_changed - Connection parameters being updated3557*3558* This enum provides information of all connect parameters that3559* have to be updated as part of update_connect_params() call.3560*3561* @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated3562* @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,3563* username, erp sequence number and rrk) are updated3564* @UPDATE_AUTH_TYPE: Indicates that authentication type is updated3565*/3566enum cfg80211_connect_params_changed {3567UPDATE_ASSOC_IES = BIT(0),3568UPDATE_FILS_ERP_INFO = BIT(1),3569UPDATE_AUTH_TYPE = BIT(2),3570};35713572/**3573* enum wiphy_params_flags - set_wiphy_params bitfield values3574* @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed3575* @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed3576* @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed3577* @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed3578* @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed3579* @WIPHY_PARAM_DYN_ACK: dynack has been enabled3580* @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed3581* @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed3582* @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum3583*/3584enum wiphy_params_flags {3585WIPHY_PARAM_RETRY_SHORT = BIT(0),3586WIPHY_PARAM_RETRY_LONG = BIT(1),3587WIPHY_PARAM_FRAG_THRESHOLD = BIT(2),3588WIPHY_PARAM_RTS_THRESHOLD = BIT(3),3589WIPHY_PARAM_COVERAGE_CLASS = BIT(4),3590WIPHY_PARAM_DYN_ACK = BIT(5),3591WIPHY_PARAM_TXQ_LIMIT = BIT(6),3592WIPHY_PARAM_TXQ_MEMORY_LIMIT = BIT(7),3593WIPHY_PARAM_TXQ_QUANTUM = BIT(8),3594};35953596#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 25635973598/* The per TXQ device queue limit in airtime */3599#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 50003600#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 1200036013602/* The per interface airtime threshold to switch to lower queue limit */3603#define IEEE80211_AQL_THRESHOLD 2400036043605/**3606* struct cfg80211_pmksa - PMK Security Association3607*3608* This structure is passed to the set/del_pmksa() method for PMKSA3609* caching.3610*3611* @bssid: The AP's BSSID (may be %NULL).3612* @pmkid: The identifier to refer a PMKSA.3613* @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key3614* derivation by a FILS STA. Otherwise, %NULL.3615* @pmk_len: Length of the @pmk. The length of @pmk can differ depending on3616* the hash algorithm used to generate this.3617* @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS3618* cache identifier (may be %NULL).3619* @ssid_len: Length of the @ssid in octets.3620* @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the3621* scope of PMKSA. This is valid only if @ssid_len is non-zero (may be3622* %NULL).3623* @pmk_lifetime: Maximum lifetime for PMKSA in seconds3624* (dot11RSNAConfigPMKLifetime) or 0 if not specified.3625* The configured PMKSA must not be used for PMKSA caching after3626* expiration and any keys derived from this PMK become invalid on3627* expiration, i.e., the current association must be dropped if the PMK3628* used for it expires.3629* @pmk_reauth_threshold: Threshold time for reauthentication (percentage of3630* PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.3631* Drivers are expected to trigger a full authentication instead of using3632* this PMKSA for caching when reassociating to a new BSS after this3633* threshold to generate a new PMK before the current one expires.3634*/3635struct cfg80211_pmksa {3636const u8 *bssid;3637const u8 *pmkid;3638const u8 *pmk;3639size_t pmk_len;3640const u8 *ssid;3641size_t ssid_len;3642const u8 *cache_id;3643u32 pmk_lifetime;3644u8 pmk_reauth_threshold;3645};36463647/**3648* struct cfg80211_pkt_pattern - packet pattern3649* @mask: bitmask where to match pattern and where to ignore bytes,3650* one bit per byte, in same format as nl802113651* @pattern: bytes to match where bitmask is 13652* @pattern_len: length of pattern (in bytes)3653* @pkt_offset: packet offset (in bytes)3654*3655* Internal note: @mask and @pattern are allocated in one chunk of3656* memory, free @mask only!3657*/3658struct cfg80211_pkt_pattern {3659const u8 *mask, *pattern;3660int pattern_len;3661int pkt_offset;3662};36633664/**3665* struct cfg80211_wowlan_tcp - TCP connection parameters3666*3667* @sock: (internal) socket for source port allocation3668* @src: source IP address3669* @dst: destination IP address3670* @dst_mac: destination MAC address3671* @src_port: source port3672* @dst_port: destination port3673* @payload_len: data payload length3674* @payload: data payload buffer3675* @payload_seq: payload sequence stamping configuration3676* @data_interval: interval at which to send data packets3677* @wake_len: wakeup payload match length3678* @wake_data: wakeup payload match data3679* @wake_mask: wakeup payload match mask3680* @tokens_size: length of the tokens buffer3681* @payload_tok: payload token usage configuration3682*/3683struct cfg80211_wowlan_tcp {3684struct socket *sock;3685__be32 src, dst;3686u16 src_port, dst_port;3687u8 dst_mac[ETH_ALEN];3688int payload_len;3689const u8 *payload;3690struct nl80211_wowlan_tcp_data_seq payload_seq;3691u32 data_interval;3692u32 wake_len;3693const u8 *wake_data, *wake_mask;3694u32 tokens_size;3695/* must be last, variable member */3696struct nl80211_wowlan_tcp_data_token payload_tok;3697};36983699/**3700* struct cfg80211_wowlan - Wake on Wireless-LAN support info3701*3702* This structure defines the enabled WoWLAN triggers for the device.3703* @any: wake up on any activity -- special trigger if device continues3704* operating as normal during suspend3705* @disconnect: wake up if getting disconnected3706* @magic_pkt: wake up on receiving magic packet3707* @patterns: wake up on receiving packet matching a pattern3708* @n_patterns: number of patterns3709* @gtk_rekey_failure: wake up on GTK rekey failure3710* @eap_identity_req: wake up on EAP identity request packet3711* @four_way_handshake: wake up on 4-way handshake3712* @rfkill_release: wake up when rfkill is released3713* @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.3714* NULL if not configured.3715* @nd_config: configuration for the scan to be used for net detect wake.3716*/3717struct cfg80211_wowlan {3718bool any, disconnect, magic_pkt, gtk_rekey_failure,3719eap_identity_req, four_way_handshake,3720rfkill_release;3721struct cfg80211_pkt_pattern *patterns;3722struct cfg80211_wowlan_tcp *tcp;3723int n_patterns;3724struct cfg80211_sched_scan_request *nd_config;3725};37263727/**3728* struct cfg80211_coalesce_rules - Coalesce rule parameters3729*3730* This structure defines coalesce rule for the device.3731* @delay: maximum coalescing delay in msecs.3732* @condition: condition for packet coalescence.3733* see &enum nl80211_coalesce_condition.3734* @patterns: array of packet patterns3735* @n_patterns: number of patterns3736*/3737struct cfg80211_coalesce_rules {3738int delay;3739enum nl80211_coalesce_condition condition;3740struct cfg80211_pkt_pattern *patterns;3741int n_patterns;3742};37433744/**3745* struct cfg80211_coalesce - Packet coalescing settings3746*3747* This structure defines coalescing settings.3748* @rules: array of coalesce rules3749* @n_rules: number of rules3750*/3751struct cfg80211_coalesce {3752int n_rules;3753struct cfg80211_coalesce_rules rules[] __counted_by(n_rules);3754};37553756/**3757* struct cfg80211_wowlan_nd_match - information about the match3758*3759* @ssid: SSID of the match that triggered the wake up3760* @n_channels: Number of channels where the match occurred. This3761* value may be zero if the driver can't report the channels.3762* @channels: center frequencies of the channels where a match3763* occurred (in MHz)3764*/3765struct cfg80211_wowlan_nd_match {3766struct cfg80211_ssid ssid;3767int n_channels;3768u32 channels[] __counted_by(n_channels);3769};37703771/**3772* struct cfg80211_wowlan_nd_info - net detect wake up information3773*3774* @n_matches: Number of match information instances provided in3775* @matches. This value may be zero if the driver can't provide3776* match information.3777* @matches: Array of pointers to matches containing information about3778* the matches that triggered the wake up.3779*/3780struct cfg80211_wowlan_nd_info {3781int n_matches;3782struct cfg80211_wowlan_nd_match *matches[] __counted_by(n_matches);3783};37843785/**3786* struct cfg80211_wowlan_wakeup - wakeup report3787* @disconnect: woke up by getting disconnected3788* @magic_pkt: woke up by receiving magic packet3789* @gtk_rekey_failure: woke up by GTK rekey failure3790* @eap_identity_req: woke up by EAP identity request packet3791* @four_way_handshake: woke up by 4-way handshake3792* @rfkill_release: woke up by rfkill being released3793* @pattern_idx: pattern that caused wakeup, -1 if not due to pattern3794* @packet_present_len: copied wakeup packet data3795* @packet_len: original wakeup packet length3796* @packet: The packet causing the wakeup, if any.3797* @packet_80211: For pattern match, magic packet and other data3798* frame triggers an 802.3 frame should be reported, for3799* disconnect due to deauth 802.11 frame. This indicates which3800* it is.3801* @tcp_match: TCP wakeup packet received3802* @tcp_connlost: TCP connection lost or failed to establish3803* @tcp_nomoretokens: TCP data ran out of tokens3804* @net_detect: if not %NULL, woke up because of net detect3805* @unprot_deauth_disassoc: woke up due to unprotected deauth or3806* disassoc frame (in MFP).3807*/3808struct cfg80211_wowlan_wakeup {3809bool disconnect, magic_pkt, gtk_rekey_failure,3810eap_identity_req, four_way_handshake,3811rfkill_release, packet_80211,3812tcp_match, tcp_connlost, tcp_nomoretokens,3813unprot_deauth_disassoc;3814s32 pattern_idx;3815u32 packet_present_len, packet_len;3816const void *packet;3817struct cfg80211_wowlan_nd_info *net_detect;3818};38193820/**3821* struct cfg80211_gtk_rekey_data - rekey data3822* @kek: key encryption key (@kek_len bytes)3823* @kck: key confirmation key (@kck_len bytes)3824* @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)3825* @kek_len: length of kek3826* @kck_len: length of kck3827* @akm: akm (oui, id)3828*/3829struct cfg80211_gtk_rekey_data {3830const u8 *kek, *kck, *replay_ctr;3831u32 akm;3832u8 kek_len, kck_len;3833};38343835/**3836* struct cfg80211_update_ft_ies_params - FT IE Information3837*3838* This structure provides information needed to update the fast transition IE3839*3840* @md: The Mobility Domain ID, 2 Octet value3841* @ie: Fast Transition IEs3842* @ie_len: Length of ft_ie in octets3843*/3844struct cfg80211_update_ft_ies_params {3845u16 md;3846const u8 *ie;3847size_t ie_len;3848};38493850/**3851* struct cfg80211_mgmt_tx_params - mgmt tx parameters3852*3853* This structure provides information needed to transmit a mgmt frame3854*3855* @chan: channel to use3856* @offchan: indicates whether off channel operation is required3857* @wait: duration for ROC3858* @buf: buffer to transmit3859* @len: buffer length3860* @no_cck: don't use cck rates for this frame3861* @dont_wait_for_ack: tells the low level not to wait for an ack3862* @n_csa_offsets: length of csa_offsets array3863* @csa_offsets: array of all the csa offsets in the frame3864* @link_id: for MLO, the link ID to transmit on, -1 if not given; note3865* that the link ID isn't validated (much), it's in range but the3866* link might not exist (or be used by the receiver STA)3867*/3868struct cfg80211_mgmt_tx_params {3869struct ieee80211_channel *chan;3870bool offchan;3871unsigned int wait;3872const u8 *buf;3873size_t len;3874bool no_cck;3875bool dont_wait_for_ack;3876int n_csa_offsets;3877const u16 *csa_offsets;3878int link_id;3879};38803881/**3882* struct cfg80211_dscp_exception - DSCP exception3883*3884* @dscp: DSCP value that does not adhere to the user priority range definition3885* @up: user priority value to which the corresponding DSCP value belongs3886*/3887struct cfg80211_dscp_exception {3888u8 dscp;3889u8 up;3890};38913892/**3893* struct cfg80211_dscp_range - DSCP range definition for user priority3894*3895* @low: lowest DSCP value of this user priority range, inclusive3896* @high: highest DSCP value of this user priority range, inclusive3897*/3898struct cfg80211_dscp_range {3899u8 low;3900u8 high;3901};39023903/* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */3904#define IEEE80211_QOS_MAP_MAX_EX 213905#define IEEE80211_QOS_MAP_LEN_MIN 163906#define IEEE80211_QOS_MAP_LEN_MAX \3907(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)39083909/**3910* struct cfg80211_qos_map - QoS Map Information3911*3912* This struct defines the Interworking QoS map setting for DSCP values3913*3914* @num_des: number of DSCP exceptions (0..21)3915* @dscp_exception: optionally up to maximum of 21 DSCP exceptions from3916* the user priority DSCP range definition3917* @up: DSCP range definition for a particular user priority3918*/3919struct cfg80211_qos_map {3920u8 num_des;3921struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];3922struct cfg80211_dscp_range up[8];3923};39243925/**3926* struct cfg80211_nan_band_config - NAN band specific configuration3927*3928* @chan: Pointer to the IEEE 802.11 channel structure. The channel to be used3929* for NAN operations on this band. For 2.4 GHz band, this is always3930* channel 6. For 5 GHz band, the channel is either 44 or 149, according3931* to the regulatory constraints. If chan pointer is NULL the entire band3932* configuration entry is considered invalid and should not be used.3933* @rssi_close: RSSI close threshold used for NAN state transition algorithm3934* as described in chapters 3.3.6 and 3.3.7 "NAN Device Role and State3935* Transition" of Wi-Fi Aware Specification v4.0. If not3936* specified (set to 0), default device value is used. The value should3937* be greater than -60 dBm.3938* @rssi_middle: RSSI middle threshold used for NAN state transition algorithm.3939* as described in chapters 3.3.6 and 3.3.7 "NAN Device Role and State3940* Transition" of Wi-Fi Aware Specification v4.0. If not3941* specified (set to 0), default device value is used. The value should be3942* greater than -75 dBm and less than rssi_close.3943* @awake_dw_interval: Committed DW interval. Valid values range: 0-5. 03944* indicates no wakeup for DW and can't be used on 2.4GHz band, otherwise3945* 2^(n-1).3946* @disable_scan: If true, the device will not scan this band for cluster3947* merge. Disabling scan on 2.4 GHz band is not allowed.3948*/3949struct cfg80211_nan_band_config {3950struct ieee80211_channel *chan;3951s8 rssi_close;3952s8 rssi_middle;3953u8 awake_dw_interval;3954bool disable_scan;3955};39563957/**3958* struct cfg80211_nan_conf - NAN configuration3959*3960* This struct defines NAN configuration parameters3961*3962* @master_pref: master preference (1 - 255)3963* @bands: operating bands, a bitmap of &enum nl80211_band values.3964* For instance, for NL80211_BAND_2GHZ, bit 0 would be set3965* (i.e. BIT(NL80211_BAND_2GHZ)).3966* @cluster_id: cluster ID used for NAN synchronization. This is a MAC address3967* that can take a value from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF.3968* If NULL, the device will pick a random Cluster ID.3969* @scan_period: period (in seconds) between NAN scans.3970* @scan_dwell_time: dwell time (in milliseconds) for NAN scans.3971* @discovery_beacon_interval: interval (in TUs) for discovery beacons.3972* @enable_dw_notification: flag to enable/disable discovery window3973* notifications.3974* @band_cfgs: array of band specific configurations, indexed by3975* &enum nl80211_band values.3976* @extra_nan_attrs: pointer to additional NAN attributes.3977* @extra_nan_attrs_len: length of the additional NAN attributes.3978* @vendor_elems: pointer to vendor-specific elements.3979* @vendor_elems_len: length of the vendor-specific elements.3980*/3981struct cfg80211_nan_conf {3982u8 master_pref;3983u8 bands;3984const u8 *cluster_id;3985u16 scan_period;3986u16 scan_dwell_time;3987u8 discovery_beacon_interval;3988bool enable_dw_notification;3989struct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS];3990const u8 *extra_nan_attrs;3991u16 extra_nan_attrs_len;3992const u8 *vendor_elems;3993u16 vendor_elems_len;3994};39953996/**3997* enum cfg80211_nan_conf_changes - indicates changed fields in NAN3998* configuration3999*4000* @CFG80211_NAN_CONF_CHANGED_PREF: master preference4001* @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands4002* @CFG80211_NAN_CONF_CHANGED_CONFIG: changed additional configuration.4003* When this flag is set, it indicates that some additional attribute(s)4004* (other then master_pref and bands) have been changed. In this case,4005* all the unchanged attributes will be properly configured to their4006* previous values. The driver doesn't need to store any4007* previous configuration besides master_pref and bands.4008*/4009enum cfg80211_nan_conf_changes {4010CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),4011CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),4012CFG80211_NAN_CONF_CHANGED_CONFIG = BIT(2),4013};40144015/**4016* struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter4017*4018* @filter: the content of the filter4019* @len: the length of the filter4020*/4021struct cfg80211_nan_func_filter {4022const u8 *filter;4023u8 len;4024};40254026/**4027* struct cfg80211_nan_func - a NAN function4028*4029* @type: &enum nl80211_nan_function_type4030* @service_id: the service ID of the function4031* @publish_type: &nl80211_nan_publish_type4032* @close_range: if true, the range should be limited. Threshold is4033* implementation specific.4034* @publish_bcast: if true, the solicited publish should be broadcasted4035* @subscribe_active: if true, the subscribe is active4036* @followup_id: the instance ID for follow up4037* @followup_reqid: the requester instance ID for follow up4038* @followup_dest: MAC address of the recipient of the follow up4039* @ttl: time to live counter in DW.4040* @serv_spec_info: Service Specific Info4041* @serv_spec_info_len: Service Specific Info length4042* @srf_include: if true, SRF is inclusive4043* @srf_bf: Bloom Filter4044* @srf_bf_len: Bloom Filter length4045* @srf_bf_idx: Bloom Filter index4046* @srf_macs: SRF MAC addresses4047* @srf_num_macs: number of MAC addresses in SRF4048* @rx_filters: rx filters that are matched with corresponding peer's tx_filter4049* @tx_filters: filters that should be transmitted in the SDF.4050* @num_rx_filters: length of &rx_filters.4051* @num_tx_filters: length of &tx_filters.4052* @instance_id: driver allocated id of the function.4053* @cookie: unique NAN function identifier.4054*/4055struct cfg80211_nan_func {4056enum nl80211_nan_function_type type;4057u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];4058u8 publish_type;4059bool close_range;4060bool publish_bcast;4061bool subscribe_active;4062u8 followup_id;4063u8 followup_reqid;4064struct mac_address followup_dest;4065u32 ttl;4066const u8 *serv_spec_info;4067u8 serv_spec_info_len;4068bool srf_include;4069const u8 *srf_bf;4070u8 srf_bf_len;4071u8 srf_bf_idx;4072struct mac_address *srf_macs;4073int srf_num_macs;4074struct cfg80211_nan_func_filter *rx_filters;4075struct cfg80211_nan_func_filter *tx_filters;4076u8 num_tx_filters;4077u8 num_rx_filters;4078u8 instance_id;4079u64 cookie;4080};40814082/**4083* struct cfg80211_pmk_conf - PMK configuration4084*4085* @aa: authenticator address4086* @pmk_len: PMK length in bytes.4087* @pmk: the PMK material4088* @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK4089* is not PMK-R0). When pmk_r0_name is not NULL, the pmk field4090* holds PMK-R0.4091*/4092struct cfg80211_pmk_conf {4093const u8 *aa;4094u8 pmk_len;4095const u8 *pmk;4096const u8 *pmk_r0_name;4097};40984099/**4100* struct cfg80211_external_auth_params - Trigger External authentication.4101*4102* Commonly used across the external auth request and event interfaces.4103*4104* @action: action type / trigger for external authentication. Only significant4105* for the authentication request event interface (driver to user space).4106* @bssid: BSSID of the peer with which the authentication has4107* to happen. Used by both the authentication request event and4108* authentication response command interface.4109* @ssid: SSID of the AP. Used by both the authentication request event and4110* authentication response command interface.4111* @key_mgmt_suite: AKM suite of the respective authentication. Used by the4112* authentication request event interface.4113* @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,4114* use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you4115* the real status code for failures. Used only for the authentication4116* response command interface (user space to driver).4117* @pmkid: The identifier to refer a PMKSA.4118* @mld_addr: MLD address of the peer. Used by the authentication request event4119* interface. Driver indicates this to enable MLO during the authentication4120* offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT4121* flag capability in NL80211_CMD_CONNECT to know whether the user space4122* supports enabling MLO during the authentication offload.4123* User space should use the address of the interface (on which the4124* authentication request event reported) as self MLD address. User space4125* and driver should use MLD addresses in RA, TA and BSSID fields of4126* authentication frames sent or received via cfg80211. The driver4127* translates the MLD addresses to/from link addresses based on the link4128* chosen for the authentication.4129*/4130struct cfg80211_external_auth_params {4131enum nl80211_external_auth_action action;4132u8 bssid[ETH_ALEN] __aligned(2);4133struct cfg80211_ssid ssid;4134unsigned int key_mgmt_suite;4135u16 status;4136const u8 *pmkid;4137u8 mld_addr[ETH_ALEN] __aligned(2);4138};41394140/**4141* struct cfg80211_ftm_responder_stats - FTM responder statistics4142*4143* @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to4144* indicate the relevant values in this struct for them4145* @success_num: number of FTM sessions in which all frames were successfully4146* answered4147* @partial_num: number of FTM sessions in which part of frames were4148* successfully answered4149* @failed_num: number of failed FTM sessions4150* @asap_num: number of ASAP FTM sessions4151* @non_asap_num: number of non-ASAP FTM sessions4152* @total_duration_ms: total sessions durations - gives an indication4153* of how much time the responder was busy4154* @unknown_triggers_num: number of unknown FTM triggers - triggers from4155* initiators that didn't finish successfully the negotiation phase with4156* the responder4157* @reschedule_requests_num: number of FTM reschedule requests - initiator asks4158* for a new scheduling although it already has scheduled FTM slot4159* @out_of_window_triggers_num: total FTM triggers out of scheduled window4160*/4161struct cfg80211_ftm_responder_stats {4162u32 filled;4163u32 success_num;4164u32 partial_num;4165u32 failed_num;4166u32 asap_num;4167u32 non_asap_num;4168u64 total_duration_ms;4169u32 unknown_triggers_num;4170u32 reschedule_requests_num;4171u32 out_of_window_triggers_num;4172};41734174/**4175* struct cfg80211_pmsr_ftm_result - FTM result4176* @failure_reason: if this measurement failed (PMSR status is4177* %NL80211_PMSR_STATUS_FAILURE), this gives a more precise4178* reason than just "failure"4179* @burst_index: if reporting partial results, this is the index4180* in [0 .. num_bursts-1] of the burst that's being reported4181* @num_ftmr_attempts: number of FTM request frames transmitted4182* @num_ftmr_successes: number of FTM request frames acked4183* @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,4184* fill this to indicate in how many seconds a retry is deemed possible4185* by the responder4186* @num_bursts_exp: actual number of bursts exponent negotiated4187* @burst_duration: actual burst duration negotiated4188* @ftms_per_burst: actual FTMs per burst negotiated4189* @lci_len: length of LCI information (if present)4190* @civicloc_len: length of civic location information (if present)4191* @lci: LCI data (may be %NULL)4192* @civicloc: civic location data (may be %NULL)4193* @rssi_avg: average RSSI over FTM action frames reported4194* @rssi_spread: spread of the RSSI over FTM action frames reported4195* @tx_rate: bitrate for transmitted FTM action frame response4196* @rx_rate: bitrate of received FTM action frame4197* @rtt_avg: average of RTTs measured (must have either this or @dist_avg)4198* @rtt_variance: variance of RTTs measured (note that standard deviation is4199* the square root of the variance)4200* @rtt_spread: spread of the RTTs measured4201* @dist_avg: average of distances (mm) measured4202* (must have either this or @rtt_avg)4203* @dist_variance: variance of distances measured (see also @rtt_variance)4204* @dist_spread: spread of distances measured (see also @rtt_spread)4205* @num_ftmr_attempts_valid: @num_ftmr_attempts is valid4206* @num_ftmr_successes_valid: @num_ftmr_successes is valid4207* @rssi_avg_valid: @rssi_avg is valid4208* @rssi_spread_valid: @rssi_spread is valid4209* @tx_rate_valid: @tx_rate is valid4210* @rx_rate_valid: @rx_rate is valid4211* @rtt_avg_valid: @rtt_avg is valid4212* @rtt_variance_valid: @rtt_variance is valid4213* @rtt_spread_valid: @rtt_spread is valid4214* @dist_avg_valid: @dist_avg is valid4215* @dist_variance_valid: @dist_variance is valid4216* @dist_spread_valid: @dist_spread is valid4217*/4218struct cfg80211_pmsr_ftm_result {4219const u8 *lci;4220const u8 *civicloc;4221unsigned int lci_len;4222unsigned int civicloc_len;4223enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;4224u32 num_ftmr_attempts, num_ftmr_successes;4225s16 burst_index;4226u8 busy_retry_time;4227u8 num_bursts_exp;4228u8 burst_duration;4229u8 ftms_per_burst;4230s32 rssi_avg;4231s32 rssi_spread;4232struct rate_info tx_rate, rx_rate;4233s64 rtt_avg;4234s64 rtt_variance;4235s64 rtt_spread;4236s64 dist_avg;4237s64 dist_variance;4238s64 dist_spread;42394240u16 num_ftmr_attempts_valid:1,4241num_ftmr_successes_valid:1,4242rssi_avg_valid:1,4243rssi_spread_valid:1,4244tx_rate_valid:1,4245rx_rate_valid:1,4246rtt_avg_valid:1,4247rtt_variance_valid:1,4248rtt_spread_valid:1,4249dist_avg_valid:1,4250dist_variance_valid:1,4251dist_spread_valid:1;4252};42534254/**4255* struct cfg80211_pmsr_result - peer measurement result4256* @addr: address of the peer4257* @host_time: host time (use ktime_get_boottime() adjust to the time when the4258* measurement was made)4259* @ap_tsf: AP's TSF at measurement time4260* @status: status of the measurement4261* @final: if reporting partial results, mark this as the last one; if not4262* reporting partial results always set this flag4263* @ap_tsf_valid: indicates the @ap_tsf value is valid4264* @type: type of the measurement reported, note that we only support reporting4265* one type at a time, but you can report multiple results separately and4266* they're all aggregated for userspace.4267* @ftm: FTM result4268*/4269struct cfg80211_pmsr_result {4270u64 host_time, ap_tsf;4271enum nl80211_peer_measurement_status status;42724273u8 addr[ETH_ALEN];42744275u8 final:1,4276ap_tsf_valid:1;42774278enum nl80211_peer_measurement_type type;42794280union {4281struct cfg80211_pmsr_ftm_result ftm;4282};4283};42844285/**4286* struct cfg80211_pmsr_ftm_request_peer - FTM request data4287* @requested: indicates FTM is requested4288* @preamble: frame preamble to use4289* @burst_period: burst period to use4290* @asap: indicates to use ASAP mode4291* @num_bursts_exp: number of bursts exponent4292* @burst_duration: burst duration4293* @ftms_per_burst: number of FTMs per burst4294* @ftmr_retries: number of retries for FTM request4295* @request_lci: request LCI information4296* @request_civicloc: request civic location information4297* @trigger_based: use trigger based ranging for the measurement4298* If neither @trigger_based nor @non_trigger_based is set,4299* EDCA based ranging will be used.4300* @non_trigger_based: use non trigger based ranging for the measurement4301* If neither @trigger_based nor @non_trigger_based is set,4302* EDCA based ranging will be used.4303* @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either4304* @trigger_based or @non_trigger_based is set.4305* @bss_color: the bss color of the responder. Optional. Set to zero to4306* indicate the driver should set the BSS color. Only valid if4307* @non_trigger_based or @trigger_based is set.4308*4309* See also nl80211 for the respective attribute documentation.4310*/4311struct cfg80211_pmsr_ftm_request_peer {4312enum nl80211_preamble preamble;4313u16 burst_period;4314u8 requested:1,4315asap:1,4316request_lci:1,4317request_civicloc:1,4318trigger_based:1,4319non_trigger_based:1,4320lmr_feedback:1;4321u8 num_bursts_exp;4322u8 burst_duration;4323u8 ftms_per_burst;4324u8 ftmr_retries;4325u8 bss_color;4326};43274328/**4329* struct cfg80211_pmsr_request_peer - peer data for a peer measurement request4330* @addr: MAC address4331* @chandef: channel to use4332* @report_ap_tsf: report the associated AP's TSF4333* @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer4334*/4335struct cfg80211_pmsr_request_peer {4336u8 addr[ETH_ALEN];4337struct cfg80211_chan_def chandef;4338u8 report_ap_tsf:1;4339struct cfg80211_pmsr_ftm_request_peer ftm;4340};43414342/**4343* struct cfg80211_pmsr_request - peer measurement request4344* @cookie: cookie, set by cfg802114345* @nl_portid: netlink portid - used by cfg802114346* @drv_data: driver data for this request, if required for aborting,4347* not otherwise freed or anything by cfg802114348* @mac_addr: MAC address used for (randomised) request4349* @mac_addr_mask: MAC address mask used for randomisation, bits that4350* are 0 in the mask should be randomised, bits that are 1 should4351* be taken from the @mac_addr4352* @list: used by cfg80211 to hold on to the request4353* @timeout: timeout (in milliseconds) for the whole operation, if4354* zero it means there's no timeout4355* @n_peers: number of peers to do measurements with4356* @peers: per-peer measurement request data4357*/4358struct cfg80211_pmsr_request {4359u64 cookie;4360void *drv_data;4361u32 n_peers;4362u32 nl_portid;43634364u32 timeout;43654366u8 mac_addr[ETH_ALEN] __aligned(2);4367u8 mac_addr_mask[ETH_ALEN] __aligned(2);43684369struct list_head list;43704371struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers);4372};43734374/**4375* struct cfg80211_update_owe_info - OWE Information4376*4377* This structure provides information needed for the drivers to offload OWE4378* (Opportunistic Wireless Encryption) processing to the user space.4379*4380* Commonly used across update_owe_info request and event interfaces.4381*4382* @peer: MAC address of the peer device for which the OWE processing4383* has to be done.4384* @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info4385* processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space4386* cannot give you the real status code for failures. Used only for4387* OWE update request command interface (user space to driver).4388* @ie: IEs obtained from the peer or constructed by the user space. These are4389* the IEs of the remote peer in the event from the host driver and4390* the constructed IEs by the user space in the request interface.4391* @ie_len: Length of IEs in octets.4392* @assoc_link_id: MLO link ID of the AP, with which (re)association requested4393* by peer. This will be filled by driver for both MLO and non-MLO station4394* connections when the AP affiliated with an MLD. For non-MLD AP mode, it4395* will be -1. Used only with OWE update event (driver to user space).4396* @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO4397* connection, it will be all zeros. This is applicable only when4398* @assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only4399* with OWE update event (driver to user space).4400*/4401struct cfg80211_update_owe_info {4402u8 peer[ETH_ALEN] __aligned(2);4403u16 status;4404const u8 *ie;4405size_t ie_len;4406int assoc_link_id;4407u8 peer_mld_addr[ETH_ALEN] __aligned(2);4408};44094410/**4411* struct mgmt_frame_regs - management frame registrations data4412* @global_stypes: bitmap of management frame subtypes registered4413* for the entire device4414* @interface_stypes: bitmap of management frame subtypes registered4415* for the given interface4416* @global_mcast_stypes: mcast RX is needed globally for these subtypes4417* @interface_mcast_stypes: mcast RX is needed on this interface4418* for these subtypes4419*/4420struct mgmt_frame_regs {4421u32 global_stypes, interface_stypes;4422u32 global_mcast_stypes, interface_mcast_stypes;4423};44244425/**4426* struct cfg80211_ops - backend description for wireless configuration4427*4428* This struct is registered by fullmac card drivers and/or wireless stacks4429* in order to handle configuration requests on their interfaces.4430*4431* All callbacks except where otherwise noted should return 04432* on success or a negative error code.4433*4434* All operations are invoked with the wiphy mutex held. The RTNL may be4435* held in addition (due to wireless extensions) but this cannot be relied4436* upon except in cases where documented below. Note that due to ordering,4437* the RTNL also cannot be acquired in any handlers.4438*4439* @suspend: wiphy device needs to be suspended. The variable @wow will4440* be %NULL or contain the enabled Wake-on-Wireless triggers that are4441* configured for the device.4442* @resume: wiphy device needs to be resumed4443* @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback4444* to call device_set_wakeup_enable() to enable/disable wakeup from4445* the device.4446*4447* @add_virtual_intf: create a new virtual interface with the given name,4448* must set the struct wireless_dev's iftype. Beware: You must create4449* the new netdev in the wiphy's network namespace! Returns the struct4450* wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must4451* also set the address member in the wdev.4452* This additionally holds the RTNL to be able to do netdev changes.4453*4454* @del_virtual_intf: remove the virtual interface4455* This additionally holds the RTNL to be able to do netdev changes.4456*4457* @change_virtual_intf: change type/configuration of virtual interface,4458* keep the struct wireless_dev's iftype updated.4459* This additionally holds the RTNL to be able to do netdev changes.4460*4461* @add_intf_link: Add a new MLO link to the given interface. Note that4462* the wdev->link[] data structure has been updated, so the new link4463* address is available.4464* @del_intf_link: Remove an MLO link from the given interface.4465*4466* @add_key: add a key with the given parameters. @mac_addr will be %NULL4467* when adding a group key. @link_id will be -1 for non-MLO connection.4468* For MLO connection, @link_id will be >= 0 for group key and -1 for4469* pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key.4470*4471* @get_key: get information about the key with the given parameters.4472* @mac_addr will be %NULL when requesting information for a group4473* key. All pointers given to the @callback function need not be valid4474* after it returns. This function should return an error if it is4475* not possible to retrieve the key, -ENOENT if it doesn't exist.4476* @link_id will be -1 for non-MLO connection. For MLO connection,4477* @link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr4478* will be peer's MLD address for MLO pairwise key.4479*4480* @del_key: remove a key given the @mac_addr (%NULL for a group key)4481* and @key_index, return -ENOENT if the key doesn't exist. @link_id will4482* be -1 for non-MLO connection. For MLO connection, @link_id will be >= 04483* for group key and -1 for pairwise key, @mac_addr will be peer's MLD4484* address for MLO pairwise key.4485*4486* @set_default_key: set the default key on an interface. @link_id will be >= 04487* for MLO connection and -1 for non-MLO connection.4488*4489* @set_default_mgmt_key: set the default management frame key on an interface.4490* @link_id will be >= 0 for MLO connection and -1 for non-MLO connection.4491*4492* @set_default_beacon_key: set the default Beacon frame key on an interface.4493* @link_id will be >= 0 for MLO connection and -1 for non-MLO connection.4494*4495* @set_rekey_data: give the data necessary for GTK rekeying to the driver4496*4497* @start_ap: Start acting in AP mode defined by the parameters.4498* @change_beacon: Change the beacon parameters for an access point mode4499* interface. This should reject the call when AP mode wasn't started.4500* @stop_ap: Stop being an AP, including stopping beaconing.4501*4502* @add_station: Add a new station.4503* @del_station: Remove a station4504* @change_station: Modify a given station. Note that flags changes are not much4505* validated in cfg80211, in particular the auth/assoc/authorized flags4506* might come to the driver in invalid combinations -- make sure to check4507* them, also against the existing state! Drivers must call4508* cfg80211_check_station_change() to validate the information.4509* @get_station: get station information for the station identified by @mac4510* @dump_station: dump station callback -- resume dump at index @idx4511*4512* @add_mpath: add a fixed mesh path4513* @del_mpath: delete a given mesh path4514* @change_mpath: change a given mesh path4515* @get_mpath: get a mesh path for the given parameters4516* @dump_mpath: dump mesh path callback -- resume dump at index @idx4517* @get_mpp: get a mesh proxy path for the given parameters4518* @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx4519* @join_mesh: join the mesh network with the specified parameters4520* (invoked with the wireless_dev mutex held)4521* @leave_mesh: leave the current mesh network4522* (invoked with the wireless_dev mutex held)4523*4524* @get_mesh_config: Get the current mesh configuration4525*4526* @update_mesh_config: Update mesh parameters on a running mesh.4527* The mask is a bitfield which tells us which parameters to4528* set, and which to leave alone.4529*4530* @change_bss: Modify parameters for a given BSS.4531*4532* @inform_bss: Called by cfg80211 while being informed about new BSS data4533* for every BSS found within the reported data or frame. This is called4534* from within the cfg8011 inform_bss handlers while holding the bss_lock.4535* The data parameter is passed through from drv_data inside4536* struct cfg80211_inform_bss.4537* The new IE data for the BSS is explicitly passed.4538*4539* @set_txq_params: Set TX queue parameters4540*4541* @libertas_set_mesh_channel: Only for backward compatibility for libertas,4542* as it doesn't implement join_mesh and needs to set the channel to4543* join the mesh instead.4544*4545* @set_monitor_channel: Set the monitor mode channel for the device. If other4546* interfaces are active this callback should reject the configuration.4547* If no interfaces are active or the device is down, the channel should4548* be stored for when a monitor interface becomes active.4549*4550* @scan: Request to do a scan. If returning zero, the scan request is given4551* the driver, and will be valid until passed to cfg80211_scan_done().4552* For scan results, call cfg80211_inform_bss(); you can call this outside4553* the scan/scan_done bracket too.4554* @abort_scan: Tell the driver to abort an ongoing scan. The driver shall4555* indicate the status of the scan through cfg80211_scan_done().4556*4557* @auth: Request to authenticate with the specified peer4558* (invoked with the wireless_dev mutex held)4559* @assoc: Request to (re)associate with the specified peer4560* (invoked with the wireless_dev mutex held)4561* @deauth: Request to deauthenticate from the specified peer4562* (invoked with the wireless_dev mutex held)4563* @disassoc: Request to disassociate from the specified peer4564* (invoked with the wireless_dev mutex held)4565*4566* @connect: Connect to the ESS with the specified parameters. When connected,4567* call cfg80211_connect_result()/cfg80211_connect_bss() with status code4568* %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call4569* cfg80211_connect_result()/cfg80211_connect_bss() with the status code4570* from the AP or cfg80211_connect_timeout() if no frame with status code4571* was received.4572* The driver is allowed to roam to other BSSes within the ESS when the4573* other BSS matches the connect parameters. When such roaming is initiated4574* by the driver, the driver is expected to verify that the target matches4575* the configured security parameters and to use Reassociation Request4576* frame instead of Association Request frame.4577* The connect function can also be used to request the driver to perform a4578* specific roam when connected to an ESS. In that case, the prev_bssid4579* parameter is set to the BSSID of the currently associated BSS as an4580* indication of requesting reassociation.4581* In both the driver-initiated and new connect() call initiated roaming4582* cases, the result of roaming is indicated with a call to4583* cfg80211_roamed(). (invoked with the wireless_dev mutex held)4584* @update_connect_params: Update the connect parameters while connected to a4585* BSS. The updated parameters can be used by driver/firmware for4586* subsequent BSS selection (roaming) decisions and to form the4587* Authentication/(Re)Association Request frames. This call does not4588* request an immediate disassociation or reassociation with the current4589* BSS, i.e., this impacts only subsequent (re)associations. The bits in4590* changed are defined in &enum cfg80211_connect_params_changed.4591* (invoked with the wireless_dev mutex held)4592* @disconnect: Disconnect from the BSS/ESS or stop connection attempts if4593* connection is in progress. Once done, call cfg80211_disconnected() in4594* case connection was already established (invoked with the4595* wireless_dev mutex held), otherwise call cfg80211_connect_timeout().4596*4597* @join_ibss: Join the specified IBSS (or create if necessary). Once done, call4598* cfg80211_ibss_joined(), also call that function when changing BSSID due4599* to a merge.4600* (invoked with the wireless_dev mutex held)4601* @leave_ibss: Leave the IBSS.4602* (invoked with the wireless_dev mutex held)4603*4604* @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or4605* MESH mode)4606*4607* @set_wiphy_params: Notify that wiphy parameters have changed;4608* @changed bitfield (see &enum wiphy_params_flags) describes which values4609* have changed. The actual parameter values are available in4610* struct wiphy. If returning an error, no value should be changed.4611*4612* @set_tx_power: set the transmit power according to the parameters,4613* the power passed is in mBm, to get dBm use MBM_TO_DBM(). The4614* wdev may be %NULL if power was set for the wiphy, and will4615* always be %NULL unless the driver supports per-vif TX power4616* (as advertised by the nl80211 feature flag.)4617* @get_tx_power: store the current TX power into the dbm variable;4618* return 0 if successful4619*4620* @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting4621* functions to adjust rfkill hw state4622*4623* @dump_survey: get site survey information.4624*4625* @remain_on_channel: Request the driver to remain awake on the specified4626* channel for the specified duration to complete an off-channel4627* operation (e.g., public action frame exchange). When the driver is4628* ready on the requested channel, it must indicate this with an event4629* notification by calling cfg80211_ready_on_channel().4630* @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.4631* This allows the operation to be terminated prior to timeout based on4632* the duration value.4633* @mgmt_tx: Transmit a management frame.4634* @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management4635* frame on another channel4636*4637* @testmode_cmd: run a test mode command; @wdev may be %NULL4638* @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be4639* used by the function, but 0 and 1 must not be touched. Additionally,4640* return error codes other than -ENOBUFS and -ENOENT will terminate the4641* dump and return to userspace with an error, so be careful. If any data4642* was passed in from userspace then the data/len arguments will be present4643* and point to the data contained in %NL80211_ATTR_TESTDATA.4644*4645* @set_bitrate_mask: set the bitrate mask configuration4646*4647* @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac4648* devices running firmwares capable of generating the (re) association4649* RSN IE. It allows for faster roaming between WPA2 BSSIDs.4650* @del_pmksa: Delete a cached PMKID.4651* @flush_pmksa: Flush all cached PMKIDs.4652* @set_power_mgmt: Configure WLAN power management. A timeout value of -14653* allows the driver to adjust the dynamic ps timeout value.4654* @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.4655* After configuration, the driver should (soon) send an event indicating4656* the current level is above/below the configured threshold; this may4657* need some care when the configuration is changed (without first being4658* disabled.)4659* @set_cqm_rssi_range_config: Configure two RSSI thresholds in the4660* connection quality monitor. An event is to be sent only when the4661* signal level is found to be outside the two values. The driver should4662* set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.4663* If it is provided then there's no point providing @set_cqm_rssi_config.4664* @set_cqm_txe_config: Configure connection quality monitor TX error4665* thresholds.4666* @sched_scan_start: Tell the driver to start a scheduled scan.4667* @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with4668* given request id. This call must stop the scheduled scan and be ready4669* for starting a new one before it returns, i.e. @sched_scan_start may be4670* called immediately after that again and should not fail in that case.4671* The driver should not call cfg80211_sched_scan_stopped() for a requested4672* stop (when this method returns 0).4673*4674* @update_mgmt_frame_registrations: Notify the driver that management frame4675* registrations were updated. The callback is allowed to sleep.4676*4677* @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.4678* Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may4679* reject TX/RX mask combinations they cannot support by returning -EINVAL4680* (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).4681*4682* @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).4683*4684* @tdls_mgmt: Transmit a TDLS management frame.4685* @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).4686*4687* @probe_client: probe an associated client, must return a cookie that it4688* later passes to cfg80211_probe_status().4689*4690* @set_noack_map: Set the NoAck Map for the TIDs.4691*4692* @get_channel: Get the current operating channel for the virtual interface.4693* For monitor interfaces, it should return %NULL unless there's a single4694* current monitoring channel.4695*4696* @start_p2p_device: Start the given P2P device.4697* @stop_p2p_device: Stop the given P2P device.4698*4699* @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.4700* Parameters include ACL policy, an array of MAC address of stations4701* and the number of MAC addresses. If there is already a list in driver4702* this new list replaces the existing one. Driver has to clear its ACL4703* when number of MAC addresses entries is passed as 0. Drivers which4704* advertise the support for MAC based ACL have to implement this callback.4705*4706* @start_radar_detection: Start radar detection in the driver.4707*4708* @end_cac: End running CAC, probably because a related CAC4709* was finished on another phy.4710*4711* @update_ft_ies: Provide updated Fast BSS Transition information to the4712* driver. If the SME is in the driver/firmware, this information can be4713* used in building Authentication and Reassociation Request frames.4714*4715* @crit_proto_start: Indicates a critical protocol needs more link reliability4716* for a given duration (milliseconds). The protocol is provided so the4717* driver can take the most appropriate actions.4718* @crit_proto_stop: Indicates critical protocol no longer needs increased link4719* reliability. This operation can not fail.4720* @set_coalesce: Set coalesce parameters.4721*4722* @channel_switch: initiate channel-switch procedure (with CSA). Driver is4723* responsible for veryfing if the switch is possible. Since this is4724* inherently tricky driver may decide to disconnect an interface later4725* with cfg80211_stop_iface(). This doesn't mean driver can accept4726* everything. It should do it's best to verify requests and reject them4727* as soon as possible.4728*4729* @set_qos_map: Set QoS mapping information to the driver4730*4731* @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the4732* given interface This is used e.g. for dynamic HT 20/40 MHz channel width4733* changes during the lifetime of the BSS.4734*4735* @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device4736* with the given parameters; action frame exchange has been handled by4737* userspace so this just has to modify the TX path to take the TS into4738* account.4739* If the admitted time is 0 just validate the parameters to make sure4740* the session can be created at all; it is valid to just always return4741* success for that but that may result in inefficient behaviour (handshake4742* with the peer followed by immediate teardown when the addition is later4743* rejected)4744* @del_tx_ts: remove an existing TX TS4745*4746* @join_ocb: join the OCB network with the specified parameters4747* (invoked with the wireless_dev mutex held)4748* @leave_ocb: leave the current OCB network4749* (invoked with the wireless_dev mutex held)4750*4751* @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver4752* is responsible for continually initiating channel-switching operations4753* and returning to the base channel for communication with the AP.4754* @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both4755* peers must be on the base channel when the call completes.4756* @start_nan: Start the NAN interface.4757* @stop_nan: Stop the NAN interface.4758* @add_nan_func: Add a NAN function. Returns negative value on failure.4759* On success @nan_func ownership is transferred to the driver and4760* it may access it outside of the scope of this function. The driver4761* should free the @nan_func when no longer needed by calling4762* cfg80211_free_nan_func().4763* On success the driver should assign an instance_id in the4764* provided @nan_func.4765* @del_nan_func: Delete a NAN function.4766* @nan_change_conf: changes NAN configuration. The changed parameters must4767* be specified in @changes (using &enum cfg80211_nan_conf_changes);4768* All other parameters must be ignored.4769*4770* @set_multicast_to_unicast: configure multicast to unicast conversion for BSS4771*4772* @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this4773* function should return phy stats, and interface stats otherwise.4774*4775* @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.4776* If not deleted through @del_pmk the PMK remains valid until disconnect4777* upon which the driver should clear it.4778* (invoked with the wireless_dev mutex held)4779* @del_pmk: delete the previously configured PMK for the given authenticator.4780* (invoked with the wireless_dev mutex held)4781*4782* @external_auth: indicates result of offloaded authentication processing from4783* user space4784*4785* @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter4786* tells the driver that the frame should not be encrypted.4787*4788* @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.4789* Statistics should be cumulative, currently no way to reset is provided.4790* @start_pmsr: start peer measurement (e.g. FTM)4791* @abort_pmsr: abort peer measurement4792*4793* @update_owe_info: Provide updated OWE info to driver. Driver implementing SME4794* but offloading OWE processing to the user space will get the updated4795* DH IE through this interface.4796*4797* @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame4798* and overrule HWMP path selection algorithm.4799* @set_tid_config: TID specific configuration, this can be peer or BSS specific4800* This callback may sleep.4801* @reset_tid_config: Reset TID specific configuration for the peer, for the4802* given TIDs. This callback may sleep.4803*4804* @set_sar_specs: Update the SAR (TX power) settings.4805*4806* @color_change: Initiate a color change.4807*4808* @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use4809* those to decrypt (Re)Association Request and encrypt (Re)Association4810* Response frame.4811*4812* @set_radar_background: Configure dedicated offchannel chain available for4813* radar/CAC detection on some hw. This chain can't be used to transmit4814* or receive frames and it is bounded to a running wdev.4815* Background radar/CAC detection allows to avoid the CAC downtime4816* switching to a different channel during CAC detection on the selected4817* radar channel.4818* The caller is expected to set chandef pointer to NULL in order to4819* disable background CAC/radar detection.4820* @add_link_station: Add a link to a station.4821* @mod_link_station: Modify a link of a station.4822* @del_link_station: Remove a link of a station.4823*4824* @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.4825* @set_ttlm: set the TID to link mapping.4826* @set_epcs: Enable/Disable EPCS for station mode.4827* @get_radio_mask: get bitmask of radios in use.4828* (invoked with the wiphy mutex held)4829* @assoc_ml_reconf: Request a non-AP MLO connection to perform ML4830* reconfiguration, i.e., add and/or remove links to/from the4831* association using ML reconfiguration action frames. Successfully added4832* links will be added to the set of valid links. Successfully removed4833* links will be removed from the set of valid links. The driver must4834* indicate removed links by calling cfg80211_links_removed() and added4835* links by calling cfg80211_mlo_reconf_add_done(). When calling4836* cfg80211_mlo_reconf_add_done() the bss pointer must be given for each4837* link for which MLO reconfiguration 'add' operation was requested.4838*/4839struct cfg80211_ops {4840int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);4841int (*resume)(struct wiphy *wiphy);4842void (*set_wakeup)(struct wiphy *wiphy, bool enabled);48434844struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,4845const char *name,4846unsigned char name_assign_type,4847enum nl80211_iftype type,4848struct vif_params *params);4849int (*del_virtual_intf)(struct wiphy *wiphy,4850struct wireless_dev *wdev);4851int (*change_virtual_intf)(struct wiphy *wiphy,4852struct net_device *dev,4853enum nl80211_iftype type,4854struct vif_params *params);48554856int (*add_intf_link)(struct wiphy *wiphy,4857struct wireless_dev *wdev,4858unsigned int link_id);4859void (*del_intf_link)(struct wiphy *wiphy,4860struct wireless_dev *wdev,4861unsigned int link_id);48624863int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,4864int link_id, u8 key_index, bool pairwise,4865const u8 *mac_addr, struct key_params *params);4866int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,4867int link_id, u8 key_index, bool pairwise,4868const u8 *mac_addr, void *cookie,4869void (*callback)(void *cookie, struct key_params*));4870int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,4871int link_id, u8 key_index, bool pairwise,4872const u8 *mac_addr);4873int (*set_default_key)(struct wiphy *wiphy,4874struct net_device *netdev, int link_id,4875u8 key_index, bool unicast, bool multicast);4876int (*set_default_mgmt_key)(struct wiphy *wiphy,4877struct net_device *netdev, int link_id,4878u8 key_index);4879int (*set_default_beacon_key)(struct wiphy *wiphy,4880struct net_device *netdev,4881int link_id,4882u8 key_index);48834884int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,4885struct cfg80211_ap_settings *settings);4886int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,4887struct cfg80211_ap_update *info);4888int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev,4889unsigned int link_id);489048914892int (*add_station)(struct wiphy *wiphy, struct net_device *dev,4893const u8 *mac,4894struct station_parameters *params);4895int (*del_station)(struct wiphy *wiphy, struct net_device *dev,4896struct station_del_parameters *params);4897int (*change_station)(struct wiphy *wiphy, struct net_device *dev,4898const u8 *mac,4899struct station_parameters *params);4900int (*get_station)(struct wiphy *wiphy, struct net_device *dev,4901const u8 *mac, struct station_info *sinfo);4902int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,4903int idx, u8 *mac, struct station_info *sinfo);49044905int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,4906const u8 *dst, const u8 *next_hop);4907int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,4908const u8 *dst);4909int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,4910const u8 *dst, const u8 *next_hop);4911int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,4912u8 *dst, u8 *next_hop, struct mpath_info *pinfo);4913int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,4914int idx, u8 *dst, u8 *next_hop,4915struct mpath_info *pinfo);4916int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,4917u8 *dst, u8 *mpp, struct mpath_info *pinfo);4918int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,4919int idx, u8 *dst, u8 *mpp,4920struct mpath_info *pinfo);4921int (*get_mesh_config)(struct wiphy *wiphy,4922struct net_device *dev,4923struct mesh_config *conf);4924int (*update_mesh_config)(struct wiphy *wiphy,4925struct net_device *dev, u32 mask,4926const struct mesh_config *nconf);4927int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,4928const struct mesh_config *conf,4929const struct mesh_setup *setup);4930int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);49314932int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,4933struct ocb_setup *setup);4934int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);49354936int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,4937struct bss_parameters *params);49384939void (*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss,4940const struct cfg80211_bss_ies *ies, void *data);49414942int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,4943struct ieee80211_txq_params *params);49444945int (*libertas_set_mesh_channel)(struct wiphy *wiphy,4946struct net_device *dev,4947struct ieee80211_channel *chan);49484949int (*set_monitor_channel)(struct wiphy *wiphy,4950struct net_device *dev,4951struct cfg80211_chan_def *chandef);49524953int (*scan)(struct wiphy *wiphy,4954struct cfg80211_scan_request *request);4955void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);49564957int (*auth)(struct wiphy *wiphy, struct net_device *dev,4958struct cfg80211_auth_request *req);4959int (*assoc)(struct wiphy *wiphy, struct net_device *dev,4960struct cfg80211_assoc_request *req);4961int (*deauth)(struct wiphy *wiphy, struct net_device *dev,4962struct cfg80211_deauth_request *req);4963int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,4964struct cfg80211_disassoc_request *req);49654966int (*connect)(struct wiphy *wiphy, struct net_device *dev,4967struct cfg80211_connect_params *sme);4968int (*update_connect_params)(struct wiphy *wiphy,4969struct net_device *dev,4970struct cfg80211_connect_params *sme,4971u32 changed);4972int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,4973u16 reason_code);49744975int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,4976struct cfg80211_ibss_params *params);4977int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);49784979int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,4980int rate[NUM_NL80211_BANDS]);49814982int (*set_wiphy_params)(struct wiphy *wiphy, int radio_idx,4983u32 changed);49844985int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,4986int radio_idx,4987enum nl80211_tx_power_setting type, int mbm);4988int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,4989int radio_idx, unsigned int link_id, int *dbm);49904991void (*rfkill_poll)(struct wiphy *wiphy);49924993#ifdef CONFIG_NL80211_TESTMODE4994int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,4995void *data, int len);4996int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,4997struct netlink_callback *cb,4998void *data, int len);4999#endif50005001int (*set_bitrate_mask)(struct wiphy *wiphy,5002struct net_device *dev,5003unsigned int link_id,5004const u8 *peer,5005const struct cfg80211_bitrate_mask *mask);50065007int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,5008int idx, struct survey_info *info);50095010int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,5011struct cfg80211_pmksa *pmksa);5012int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,5013struct cfg80211_pmksa *pmksa);5014int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);50155016int (*remain_on_channel)(struct wiphy *wiphy,5017struct wireless_dev *wdev,5018struct ieee80211_channel *chan,5019unsigned int duration,5020u64 *cookie);5021int (*cancel_remain_on_channel)(struct wiphy *wiphy,5022struct wireless_dev *wdev,5023u64 cookie);50245025int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,5026struct cfg80211_mgmt_tx_params *params,5027u64 *cookie);5028int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,5029struct wireless_dev *wdev,5030u64 cookie);50315032int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,5033bool enabled, int timeout);50345035int (*set_cqm_rssi_config)(struct wiphy *wiphy,5036struct net_device *dev,5037s32 rssi_thold, u32 rssi_hyst);50385039int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,5040struct net_device *dev,5041s32 rssi_low, s32 rssi_high);50425043int (*set_cqm_txe_config)(struct wiphy *wiphy,5044struct net_device *dev,5045u32 rate, u32 pkts, u32 intvl);50465047void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,5048struct wireless_dev *wdev,5049struct mgmt_frame_regs *upd);50505051int (*set_antenna)(struct wiphy *wiphy, int radio_idx,5052u32 tx_ant, u32 rx_ant);5053int (*get_antenna)(struct wiphy *wiphy, int radio_idx,5054u32 *tx_ant, u32 *rx_ant);50555056int (*sched_scan_start)(struct wiphy *wiphy,5057struct net_device *dev,5058struct cfg80211_sched_scan_request *request);5059int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,5060u64 reqid);50615062int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,5063struct cfg80211_gtk_rekey_data *data);50645065int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,5066const u8 *peer, int link_id,5067u8 action_code, u8 dialog_token, u16 status_code,5068u32 peer_capability, bool initiator,5069const u8 *buf, size_t len);5070int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,5071const u8 *peer, enum nl80211_tdls_operation oper);50725073int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,5074const u8 *peer, u64 *cookie);50755076int (*set_noack_map)(struct wiphy *wiphy,5077struct net_device *dev,5078u16 noack_map);50795080int (*get_channel)(struct wiphy *wiphy,5081struct wireless_dev *wdev,5082unsigned int link_id,5083struct cfg80211_chan_def *chandef);50845085int (*start_p2p_device)(struct wiphy *wiphy,5086struct wireless_dev *wdev);5087void (*stop_p2p_device)(struct wiphy *wiphy,5088struct wireless_dev *wdev);50895090int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,5091const struct cfg80211_acl_data *params);50925093int (*start_radar_detection)(struct wiphy *wiphy,5094struct net_device *dev,5095struct cfg80211_chan_def *chandef,5096u32 cac_time_ms, int link_id);5097void (*end_cac)(struct wiphy *wiphy,5098struct net_device *dev, unsigned int link_id);5099int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,5100struct cfg80211_update_ft_ies_params *ftie);5101int (*crit_proto_start)(struct wiphy *wiphy,5102struct wireless_dev *wdev,5103enum nl80211_crit_proto_id protocol,5104u16 duration);5105void (*crit_proto_stop)(struct wiphy *wiphy,5106struct wireless_dev *wdev);5107int (*set_coalesce)(struct wiphy *wiphy,5108struct cfg80211_coalesce *coalesce);51095110int (*channel_switch)(struct wiphy *wiphy,5111struct net_device *dev,5112struct cfg80211_csa_settings *params);51135114int (*set_qos_map)(struct wiphy *wiphy,5115struct net_device *dev,5116struct cfg80211_qos_map *qos_map);51175118int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,5119unsigned int link_id,5120struct cfg80211_chan_def *chandef);51215122int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,5123u8 tsid, const u8 *peer, u8 user_prio,5124u16 admitted_time);5125int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,5126u8 tsid, const u8 *peer);51275128int (*tdls_channel_switch)(struct wiphy *wiphy,5129struct net_device *dev,5130const u8 *addr, u8 oper_class,5131struct cfg80211_chan_def *chandef);5132void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,5133struct net_device *dev,5134const u8 *addr);5135int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,5136struct cfg80211_nan_conf *conf);5137void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);5138int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,5139struct cfg80211_nan_func *nan_func);5140void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,5141u64 cookie);5142int (*nan_change_conf)(struct wiphy *wiphy,5143struct wireless_dev *wdev,5144struct cfg80211_nan_conf *conf,5145u32 changes);51465147int (*set_multicast_to_unicast)(struct wiphy *wiphy,5148struct net_device *dev,5149const bool enabled);51505151int (*get_txq_stats)(struct wiphy *wiphy,5152struct wireless_dev *wdev,5153struct cfg80211_txq_stats *txqstats);51545155int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,5156const struct cfg80211_pmk_conf *conf);5157int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,5158const u8 *aa);5159int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,5160struct cfg80211_external_auth_params *params);51615162int (*tx_control_port)(struct wiphy *wiphy,5163struct net_device *dev,5164const u8 *buf, size_t len,5165const u8 *dest, const __be16 proto,5166const bool noencrypt, int link_id,5167u64 *cookie);51685169int (*get_ftm_responder_stats)(struct wiphy *wiphy,5170struct net_device *dev,5171struct cfg80211_ftm_responder_stats *ftm_stats);51725173int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,5174struct cfg80211_pmsr_request *request);5175void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,5176struct cfg80211_pmsr_request *request);5177int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,5178struct cfg80211_update_owe_info *owe_info);5179int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,5180const u8 *buf, size_t len);5181int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,5182struct cfg80211_tid_config *tid_conf);5183int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,5184const u8 *peer, u8 tids);5185int (*set_sar_specs)(struct wiphy *wiphy,5186struct cfg80211_sar_specs *sar);5187int (*color_change)(struct wiphy *wiphy,5188struct net_device *dev,5189struct cfg80211_color_change_settings *params);5190int (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,5191struct cfg80211_fils_aad *fils_aad);5192int (*set_radar_background)(struct wiphy *wiphy,5193struct cfg80211_chan_def *chandef);5194int (*add_link_station)(struct wiphy *wiphy, struct net_device *dev,5195struct link_station_parameters *params);5196int (*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,5197struct link_station_parameters *params);5198int (*del_link_station)(struct wiphy *wiphy, struct net_device *dev,5199struct link_station_del_parameters *params);5200int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,5201struct cfg80211_set_hw_timestamp *hwts);5202int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,5203struct cfg80211_ttlm_params *params);5204u32 (*get_radio_mask)(struct wiphy *wiphy, struct net_device *dev);5205int (*assoc_ml_reconf)(struct wiphy *wiphy, struct net_device *dev,5206struct cfg80211_ml_reconf_req *req);5207int (*set_epcs)(struct wiphy *wiphy, struct net_device *dev,5208bool val);5209};52105211/*5212* wireless hardware and networking interfaces structures5213* and registration/helper functions5214*/52155216/**5217* enum wiphy_flags - wiphy capability flags5218*5219* @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split5220* into two, first for legacy bands and second for 6 GHz.5221* @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this5222* wiphy at all5223* @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled5224* by default -- this flag will be set depending on the kernel's default5225* on wiphy_new(), but can be changed by the driver if it has a good5226* reason to override the default5227* @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station5228* on a VLAN interface). This flag also serves an extra purpose of5229* supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.5230* @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station5231* @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the5232* control port protocol ethertype. The device also honours the5233* control_port_no_encrypt flag.5234* @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.5235* @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing5236* auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.5237* @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the5238* firmware.5239* @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.5240* @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.5241* @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)5242* link setup/discovery operations internally. Setup, discovery and5243* teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT5244* command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be5245* used for asking the driver/firmware to perform a TDLS operation.5246* @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME5247* @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes5248* when there are virtual interfaces in AP mode by calling5249* cfg80211_report_obss_beacon().5250* @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device5251* responds to probe-requests in hardware.5252* @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.5253* @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.5254* @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.5255* @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in5256* beaconing mode (AP, IBSS, Mesh, ...).5257* @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys5258* @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,5259* in order to not have them reachable in normal drivers, until we have5260* complete feature/interface combinations/etc. advertisement. No driver5261* should set this flag for now.5262* @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys.5263* @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for5264* NL80211_REGDOM_SET_BY_DRIVER.5265* @WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON: reg_call_notifier() is called if driver5266* set this flag to update channels on beacon hints.5267* @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link5268* of an NSTR mobile AP MLD.5269* @WIPHY_FLAG_DISABLE_WEXT: disable wireless extensions for this device5270*/5271enum wiphy_flags {5272WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),5273WIPHY_FLAG_SUPPORTS_MLO = BIT(1),5274WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),5275WIPHY_FLAG_NETNS_OK = BIT(3),5276WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),5277WIPHY_FLAG_4ADDR_AP = BIT(5),5278WIPHY_FLAG_4ADDR_STATION = BIT(6),5279WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),5280WIPHY_FLAG_IBSS_RSN = BIT(8),5281WIPHY_FLAG_DISABLE_WEXT = BIT(9),5282WIPHY_FLAG_MESH_AUTH = BIT(10),5283WIPHY_FLAG_SUPPORTS_EXT_KCK_32 = BIT(11),5284WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY = BIT(12),5285WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),5286WIPHY_FLAG_AP_UAPSD = BIT(14),5287WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),5288WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),5289WIPHY_FLAG_HAVE_AP_SME = BIT(17),5290WIPHY_FLAG_REPORTS_OBSS = BIT(18),5291WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),5292WIPHY_FLAG_OFFCHAN_TX = BIT(20),5293WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),5294WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),5295WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),5296WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(24),5297WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON = BIT(25),5298};52995300/**5301* struct ieee80211_iface_limit - limit on certain interface types5302* @max: maximum number of interfaces of these types5303* @types: interface types (bits)5304*/5305struct ieee80211_iface_limit {5306u16 max;5307u16 types;5308};53095310/**5311* struct ieee80211_iface_combination - possible interface combination5312*5313* With this structure the driver can describe which interface5314* combinations it supports concurrently. When set in a struct wiphy_radio,5315* the combinations refer to combinations of interfaces currently active on5316* that radio.5317*5318* Examples:5319*5320* 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:5321*5322* .. code-block:: c5323*5324* struct ieee80211_iface_limit limits1[] = {5325* { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },5326* { .max = 1, .types = BIT(NL80211_IFTYPE_AP), },5327* };5328* struct ieee80211_iface_combination combination1 = {5329* .limits = limits1,5330* .n_limits = ARRAY_SIZE(limits1),5331* .max_interfaces = 2,5332* .beacon_int_infra_match = true,5333* };5334*5335*5336* 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:5337*5338* .. code-block:: c5339*5340* struct ieee80211_iface_limit limits2[] = {5341* { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |5342* BIT(NL80211_IFTYPE_P2P_GO), },5343* };5344* struct ieee80211_iface_combination combination2 = {5345* .limits = limits2,5346* .n_limits = ARRAY_SIZE(limits2),5347* .max_interfaces = 8,5348* .num_different_channels = 1,5349* };5350*5351*5352* 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.5353*5354* This allows for an infrastructure connection and three P2P connections.5355*5356* .. code-block:: c5357*5358* struct ieee80211_iface_limit limits3[] = {5359* { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },5360* { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |5361* BIT(NL80211_IFTYPE_P2P_CLIENT), },5362* };5363* struct ieee80211_iface_combination combination3 = {5364* .limits = limits3,5365* .n_limits = ARRAY_SIZE(limits3),5366* .max_interfaces = 4,5367* .num_different_channels = 2,5368* };5369*5370*/5371struct ieee80211_iface_combination {5372/**5373* @limits:5374* limits for the given interface types5375*/5376const struct ieee80211_iface_limit *limits;53775378/**5379* @num_different_channels:5380* can use up to this many different channels5381*/5382u32 num_different_channels;53835384/**5385* @max_interfaces:5386* maximum number of interfaces in total allowed in this group5387*/5388u16 max_interfaces;53895390/**5391* @n_limits:5392* number of limitations5393*/5394u8 n_limits;53955396/**5397* @beacon_int_infra_match:5398* In this combination, the beacon intervals between infrastructure5399* and AP types must match. This is required only in special cases.5400*/5401bool beacon_int_infra_match;54025403/**5404* @radar_detect_widths:5405* bitmap of channel widths supported for radar detection5406*/5407u8 radar_detect_widths;54085409/**5410* @radar_detect_regions:5411* bitmap of regions supported for radar detection5412*/5413u8 radar_detect_regions;54145415/**5416* @beacon_int_min_gcd:5417* This interface combination supports different beacon intervals.5418*5419* = 05420* all beacon intervals for different interface must be same.5421* > 05422* any beacon interval for the interface part of this combination AND5423* GCD of all beacon intervals from beaconing interfaces of this5424* combination must be greater or equal to this value.5425*/5426u32 beacon_int_min_gcd;5427};54285429struct ieee80211_txrx_stypes {5430u16 tx, rx;5431};54325433/**5434* enum wiphy_wowlan_support_flags - WoWLAN support flags5435* @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"5436* trigger that keeps the device operating as-is and5437* wakes up the host on any activity, for example a5438* received packet that passed filtering; note that the5439* packet should be preserved in that case5440* @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet5441* (see nl80211.h)5442* @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect5443* @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep5444* @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure5445* @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request5446* @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure5447* @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release5448* @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection5449*/5450enum wiphy_wowlan_support_flags {5451WIPHY_WOWLAN_ANY = BIT(0),5452WIPHY_WOWLAN_MAGIC_PKT = BIT(1),5453WIPHY_WOWLAN_DISCONNECT = BIT(2),5454WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),5455WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),5456WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),5457WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),5458WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),5459WIPHY_WOWLAN_NET_DETECT = BIT(8),5460};54615462struct wiphy_wowlan_tcp_support {5463const struct nl80211_wowlan_tcp_data_token_feature *tok;5464u32 data_payload_max;5465u32 data_interval_max;5466u32 wake_payload_max;5467bool seq;5468};54695470/**5471* struct wiphy_wowlan_support - WoWLAN support data5472* @flags: see &enum wiphy_wowlan_support_flags5473* @n_patterns: number of supported wakeup patterns5474* (see nl80211.h for the pattern definition)5475* @pattern_max_len: maximum length of each pattern5476* @pattern_min_len: minimum length of each pattern5477* @max_pkt_offset: maximum Rx packet offset5478* @max_nd_match_sets: maximum number of matchsets for net-detect,5479* similar, but not necessarily identical, to max_match_sets for5480* scheduled scans.5481* See &struct cfg80211_sched_scan_request.@match_sets for more5482* details.5483* @tcp: TCP wakeup support information5484*/5485struct wiphy_wowlan_support {5486u32 flags;5487int n_patterns;5488int pattern_max_len;5489int pattern_min_len;5490int max_pkt_offset;5491int max_nd_match_sets;5492const struct wiphy_wowlan_tcp_support *tcp;5493};54945495/**5496* struct wiphy_coalesce_support - coalesce support data5497* @n_rules: maximum number of coalesce rules5498* @max_delay: maximum supported coalescing delay in msecs5499* @n_patterns: number of supported patterns in a rule5500* (see nl80211.h for the pattern definition)5501* @pattern_max_len: maximum length of each pattern5502* @pattern_min_len: minimum length of each pattern5503* @max_pkt_offset: maximum Rx packet offset5504*/5505struct wiphy_coalesce_support {5506int n_rules;5507int max_delay;5508int n_patterns;5509int pattern_max_len;5510int pattern_min_len;5511int max_pkt_offset;5512};55135514/**5515* enum wiphy_vendor_command_flags - validation flags for vendor commands5516* @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev5517* @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev5518* @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running5519* (must be combined with %_WDEV or %_NETDEV)5520*/5521enum wiphy_vendor_command_flags {5522WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),5523WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),5524WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),5525};55265527/**5528* enum wiphy_opmode_flag - Station's ht/vht operation mode information flags5529*5530* @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed5531* @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed5532* @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed5533*5534*/5535enum wiphy_opmode_flag {5536STA_OPMODE_MAX_BW_CHANGED = BIT(0),5537STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),5538STA_OPMODE_N_SS_CHANGED = BIT(2),5539};55405541/**5542* struct sta_opmode_info - Station's ht/vht operation mode information5543* @changed: contains value from &enum wiphy_opmode_flag5544* @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station5545* @bw: new max bandwidth value from &enum nl80211_chan_width of a station5546* @rx_nss: new rx_nss value of a station5547*/55485549struct sta_opmode_info {5550u32 changed;5551enum nl80211_smps_mode smps_mode;5552enum nl80211_chan_width bw;5553u8 rx_nss;5554};55555556#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))55575558/**5559* struct wiphy_vendor_command - vendor command definition5560* @info: vendor command identifying information, as used in nl802115561* @flags: flags, see &enum wiphy_vendor_command_flags5562* @doit: callback for the operation, note that wdev is %NULL if the5563* flags didn't ask for a wdev and non-%NULL otherwise; the data5564* pointer may be %NULL if userspace provided no data at all5565* @dumpit: dump callback, for transferring bigger/multiple items. The5566* @storage points to cb->args[5], ie. is preserved over the multiple5567* dumpit calls.5568* @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.5569* Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the5570* attribute is just raw data (e.g. a firmware command).5571* @maxattr: highest attribute number in policy5572* It's recommended to not have the same sub command with both @doit and5573* @dumpit, so that userspace can assume certain ones are get and others5574* are used with dump requests.5575*/5576struct wiphy_vendor_command {5577struct nl80211_vendor_cmd_info info;5578u32 flags;5579int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,5580const void *data, int data_len);5581int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,5582struct sk_buff *skb, const void *data, int data_len,5583unsigned long *storage);5584const struct nla_policy *policy;5585unsigned int maxattr;5586};55875588/**5589* struct wiphy_iftype_ext_capab - extended capabilities per interface type5590* @iftype: interface type5591* @extended_capabilities: extended capabilities supported by the driver,5592* additional capabilities might be supported by userspace; these are the5593* 802.11 extended capabilities ("Extended Capabilities element") and are5594* in the same format as in the information element. See IEEE Std5595* 802.11-2012 8.4.2.29 for the defined fields.5596* @extended_capabilities_mask: mask of the valid values5597* @extended_capabilities_len: length of the extended capabilities5598* @eml_capabilities: EML capabilities (for MLO)5599* @mld_capa_and_ops: MLD capabilities and operations (for MLO)5600*/5601struct wiphy_iftype_ext_capab {5602enum nl80211_iftype iftype;5603const u8 *extended_capabilities;5604const u8 *extended_capabilities_mask;5605u8 extended_capabilities_len;5606u16 eml_capabilities;5607u16 mld_capa_and_ops;5608};56095610/**5611* cfg80211_get_iftype_ext_capa - lookup interface type extended capability5612* @wiphy: the wiphy to look up from5613* @type: the interface type to look up5614*5615* Return: The extended capability for the given interface @type, may be %NULL5616*/5617const struct wiphy_iftype_ext_capab *5618cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);56195620/**5621* struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities5622* @max_peers: maximum number of peers in a single measurement5623* @report_ap_tsf: can report assoc AP's TSF for radio resource measurement5624* @randomize_mac_addr: can randomize MAC address for measurement5625* @ftm: FTM measurement data5626* @ftm.supported: FTM measurement is supported5627* @ftm.asap: ASAP-mode is supported5628* @ftm.non_asap: non-ASAP-mode is supported5629* @ftm.request_lci: can request LCI data5630* @ftm.request_civicloc: can request civic location data5631* @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)5632* @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)5633* @ftm.max_bursts_exponent: maximum burst exponent supported5634* (set to -1 if not limited; note that setting this will necessarily5635* forbid using the value 15 to let the responder pick)5636* @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if5637* not limited)5638* @ftm.trigger_based: trigger based ranging measurement is supported5639* @ftm.non_trigger_based: non trigger based ranging measurement is supported5640*/5641struct cfg80211_pmsr_capabilities {5642unsigned int max_peers;5643u8 report_ap_tsf:1,5644randomize_mac_addr:1;56455646struct {5647u32 preambles;5648u32 bandwidths;5649s8 max_bursts_exponent;5650u8 max_ftms_per_burst;5651u8 supported:1,5652asap:1,5653non_asap:1,5654request_lci:1,5655request_civicloc:1,5656trigger_based:1,5657non_trigger_based:1;5658} ftm;5659};56605661/**5662* struct wiphy_iftype_akm_suites - This structure encapsulates supported akm5663* suites for interface types defined in @iftypes_mask. Each type in the5664* @iftypes_mask must be unique across all instances of iftype_akm_suites.5665*5666* @iftypes_mask: bitmask of interfaces types5667* @akm_suites: points to an array of supported akm suites5668* @n_akm_suites: number of supported AKM suites5669*/5670struct wiphy_iftype_akm_suites {5671u16 iftypes_mask;5672const u32 *akm_suites;5673int n_akm_suites;5674};56755676/**5677* struct wiphy_radio_cfg - physical radio config of a wiphy5678* This structure describes the configurations of a physical radio in a5679* wiphy. It is used to denote per-radio attributes belonging to a wiphy.5680*5681* @rts_threshold: RTS threshold (dot11RTSThreshold);5682* -1 (default) = RTS/CTS disabled5683* @radio_debugfsdir: Pointer to debugfs directory containing the radio-5684* specific parameters.5685* NULL (default) = Debugfs directory not created5686*/5687struct wiphy_radio_cfg {5688u32 rts_threshold;5689struct dentry *radio_debugfsdir;5690};56915692/**5693* struct wiphy_radio_freq_range - wiphy frequency range5694* @start_freq: start range edge frequency (kHz)5695* @end_freq: end range edge frequency (kHz)5696*/5697struct wiphy_radio_freq_range {5698u32 start_freq;5699u32 end_freq;5700};570157025703/**5704* struct wiphy_radio - physical radio of a wiphy5705* This structure describes a physical radio belonging to a wiphy.5706* It is used to describe concurrent-channel capabilities. Only one channel5707* can be active on the radio described by struct wiphy_radio.5708*5709* @freq_range: frequency range that the radio can operate on.5710* @n_freq_range: number of elements in @freq_range5711*5712* @iface_combinations: Valid interface combinations array, should not5713* list single interface types.5714* @n_iface_combinations: number of entries in @iface_combinations array.5715*5716* @antenna_mask: bitmask of antennas connected to this radio.5717*/5718struct wiphy_radio {5719const struct wiphy_radio_freq_range *freq_range;5720int n_freq_range;57215722const struct ieee80211_iface_combination *iface_combinations;5723int n_iface_combinations;57245725u32 antenna_mask;5726};57275728/**5729* enum wiphy_nan_flags - NAN capabilities5730*5731* @WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC: Device supports NAN configurable5732* synchronization.5733* @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload.5734*/5735enum wiphy_nan_flags {5736WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0),5737WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1),5738};57395740/**5741* struct wiphy_nan_capa - NAN capabilities5742*5743* This structure describes the NAN capabilities of a wiphy.5744*5745* @flags: NAN capabilities flags, see &enum wiphy_nan_flags5746* @op_mode: NAN operation mode, as defined in Wi-Fi Aware (TM) specification5747* Table 81.5748* @n_antennas: number of antennas supported by the device for Tx/Rx. Lower5749* nibble indicates the number of TX antennas and upper nibble indicates the5750* number of RX antennas. Value 0 indicates the information is not5751* available.5752* @max_channel_switch_time: maximum channel switch time in milliseconds.5753* @dev_capabilities: NAN device capabilities as defined in Wi-Fi Aware (TM)5754* specification Table 79 (Capabilities field).5755*/5756struct wiphy_nan_capa {5757u32 flags;5758u8 op_mode;5759u8 n_antennas;5760u16 max_channel_switch_time;5761u8 dev_capabilities;5762};57635764#define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff57655766/**5767* struct wiphy - wireless hardware description5768* @mtx: mutex for the data (structures) of this device5769* @reg_notifier: the driver's regulatory notification callback,5770* note that if your driver uses wiphy_apply_custom_regulatory()5771* the reg_notifier's request can be passed as NULL5772* @regd: the driver's regulatory domain, if one was requested via5773* the regulatory_hint() API. This can be used by the driver5774* on the reg_notifier() if it chooses to ignore future5775* regulatory domain changes caused by other drivers.5776* @signal_type: signal type reported in &struct cfg80211_bss.5777* @cipher_suites: supported cipher suites5778* @n_cipher_suites: number of supported cipher suites5779* @akm_suites: supported AKM suites. These are the default AKMs supported if5780* the supported AKMs not advertized for a specific interface type in5781* iftype_akm_suites.5782* @n_akm_suites: number of supported AKM suites5783* @iftype_akm_suites: array of supported akm suites info per interface type.5784* Note that the bits in @iftypes_mask inside this structure cannot5785* overlap (i.e. only one occurrence of each type is allowed across all5786* instances of iftype_akm_suites).5787* @num_iftype_akm_suites: number of interface types for which supported akm5788* suites are specified separately.5789* @retry_short: Retry limit for short frames (dot11ShortRetryLimit)5790* @retry_long: Retry limit for long frames (dot11LongRetryLimit)5791* @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);5792* -1 = fragmentation disabled, only odd values >= 256 used5793* @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled5794* @_net: the network namespace this wiphy currently lives in5795* @perm_addr: permanent MAC address of this device5796* @addr_mask: If the device supports multiple MAC addresses by masking,5797* set this to a mask with variable bits set to 1, e.g. if the last5798* four bits are variable then set it to 00-00-00-00-00-0f. The actual5799* variable bits shall be determined by the interfaces added, with5800* interfaces not matching the mask being rejected to be brought up.5801* @n_addresses: number of addresses in @addresses.5802* @addresses: If the device has more than one address, set this pointer5803* to a list of addresses (6 bytes each). The first one will be used5804* by default for perm_addr. In this case, the mask should be set to5805* all-zeroes. In this case it is assumed that the device can handle5806* the same number of arbitrary MAC addresses.5807* @registered: protects ->resume and ->suspend sysfs callbacks against5808* unregister hardware5809* @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).5810* It will be renamed automatically on wiphy renames5811* @dev: (virtual) struct device for this wiphy. The item in5812* /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()5813* (see below).5814* @wext: wireless extension handlers5815* @priv: driver private data (sized according to wiphy_new() parameter)5816* @interface_modes: bitmask of interfaces types valid for this wiphy,5817* must be set by driver5818* @iface_combinations: Valid interface combinations array, should not5819* list single interface types.5820* @n_iface_combinations: number of entries in @iface_combinations array.5821* @software_iftypes: bitmask of software interface types, these are not5822* subject to any restrictions since they are purely managed in SW.5823* @flags: wiphy flags, see &enum wiphy_flags5824* @regulatory_flags: wiphy regulatory flags, see5825* &enum ieee80211_regulatory_flags5826* @features: features advertised to nl80211, see &enum nl80211_feature_flags.5827* @ext_features: extended features advertised to nl80211, see5828* &enum nl80211_ext_feature_index.5829* @bss_priv_size: each BSS struct has private data allocated with it,5830* this variable determines its size5831* @max_scan_ssids: maximum number of SSIDs the device can scan for in5832* any given scan5833* @max_sched_scan_reqs: maximum number of scheduled scan requests that5834* the device can run concurrently.5835* @max_sched_scan_ssids: maximum number of SSIDs the device can scan5836* for in any given scheduled scan5837* @max_match_sets: maximum number of match sets the device can handle5838* when performing a scheduled scan, 0 if filtering is not5839* supported.5840* @max_scan_ie_len: maximum length of user-controlled IEs device can5841* add to probe request frames transmitted during a scan, must not5842* include fixed IEs like supported rates5843* @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled5844* scans5845* @max_sched_scan_plans: maximum number of scan plans (scan interval and number5846* of iterations) for scheduled scan supported by the device.5847* @max_sched_scan_plan_interval: maximum interval (in seconds) for a5848* single scan plan supported by the device.5849* @max_sched_scan_plan_iterations: maximum number of iterations for a single5850* scan plan supported by the device.5851* @coverage_class: current coverage class5852* @fw_version: firmware version for ethtool reporting5853* @hw_version: hardware version for ethtool reporting5854* @max_num_pmkids: maximum number of PMKIDs supported by device5855* @privid: a pointer that drivers can use to identify if an arbitrary5856* wiphy is theirs, e.g. in global notifiers5857* @bands: information about bands/channels supported by this device5858*5859* @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or5860* transmitted through nl80211, points to an array indexed by interface5861* type5862*5863* @available_antennas_tx: bitmap of antennas which are available to be5864* configured as TX antennas. Antenna configuration commands will be5865* rejected unless this or @available_antennas_rx is set.5866*5867* @available_antennas_rx: bitmap of antennas which are available to be5868* configured as RX antennas. Antenna configuration commands will be5869* rejected unless this or @available_antennas_tx is set.5870*5871* @probe_resp_offload:5872* Bitmap of supported protocols for probe response offloading.5873* See &enum nl80211_probe_resp_offload_support_attr. Only valid5874* when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.5875*5876* @max_remain_on_channel_duration: Maximum time a remain-on-channel operation5877* may request, if implemented.5878*5879* @wowlan: WoWLAN support information5880* @wowlan_config: current WoWLAN configuration; this should usually not be5881* used since access to it is necessarily racy, use the parameter passed5882* to the suspend() operation instead.5883*5884* @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.5885* @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.5886* If null, then none can be over-ridden.5887* @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.5888* If null, then none can be over-ridden.5889*5890* @wdev_list: the list of associated (virtual) interfaces; this list must5891* not be modified by the driver, but can be read with RTNL/RCU protection.5892*5893* @max_acl_mac_addrs: Maximum number of MAC addresses that the device5894* supports for ACL.5895*5896* @extended_capabilities: extended capabilities supported by the driver,5897* additional capabilities might be supported by userspace; these are5898* the 802.11 extended capabilities ("Extended Capabilities element")5899* and are in the same format as in the information element. See5900* 802.11-2012 8.4.2.29 for the defined fields. These are the default5901* extended capabilities to be used if the capabilities are not specified5902* for a specific interface type in iftype_ext_capab.5903* @extended_capabilities_mask: mask of the valid values5904* @extended_capabilities_len: length of the extended capabilities5905* @iftype_ext_capab: array of extended capabilities per interface type5906* @num_iftype_ext_capab: number of interface types for which extended5907* capabilities are specified separately.5908* @coalesce: packet coalescing support information5909*5910* @vendor_commands: array of vendor commands supported by the hardware5911* @n_vendor_commands: number of vendor commands5912* @vendor_events: array of vendor events supported by the hardware5913* @n_vendor_events: number of vendor events5914*5915* @max_ap_assoc_sta: maximum number of associated stations supported in AP mode5916* (including P2P GO) or 0 to indicate no such limit is advertised. The5917* driver is allowed to advertise a theoretical limit that it can reach in5918* some cases, but may not always reach.5919*5920* @max_num_csa_counters: Number of supported csa_counters in beacons5921* and probe responses. This value should be set if the driver5922* wishes to limit the number of csa counters. Default (0) means5923* infinite.5924* @bss_param_support: bitmask indicating which bss_parameters as defined in5925* &struct bss_parameters the driver can actually handle in the5926* .change_bss() callback. The bit positions are defined in &enum5927* wiphy_bss_param_flags.5928*5929* @bss_select_support: bitmask indicating the BSS selection criteria supported5930* by the driver in the .connect() callback. The bit position maps to the5931* attribute indices defined in &enum nl80211_bss_select_attr.5932*5933* @nan_supported_bands: bands supported by the device in NAN mode, a5934* bitmap of &enum nl80211_band values. For instance, for5935* NL80211_BAND_2GHZ, bit 0 would be set5936* (i.e. BIT(NL80211_BAND_2GHZ)).5937* @nan_capa: NAN capabilities5938*5939* @txq_limit: configuration of internal TX queue frame limit5940* @txq_memory_limit: configuration internal TX queue memory limit5941* @txq_quantum: configuration of internal TX queue scheduler quantum5942*5943* @tx_queue_len: allow setting transmit queue len for drivers not using5944* wake_tx_queue5945*5946* @support_mbssid: can HW support association with nontransmitted AP5947* @support_only_he_mbssid: don't parse MBSSID elements if it is not5948* HE AP, in order to avoid compatibility issues.5949* @support_mbssid must be set for this to have any effect.5950*5951* @pmsr_capa: peer measurement capabilities5952*5953* @tid_config_support: describes the per-TID config support that the5954* device has5955* @tid_config_support.vif: bitmap of attributes (configurations)5956* supported by the driver for each vif5957* @tid_config_support.peer: bitmap of attributes (configurations)5958* supported by the driver for each peer5959* @tid_config_support.max_retry: maximum supported retry count for5960* long/short retry configuration5961*5962* @max_data_retry_count: maximum supported per TID retry count for5963* configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and5964* %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes5965* @sar_capa: SAR control capabilities5966* @rfkill: a pointer to the rfkill structure5967*5968* @mbssid_max_interfaces: maximum number of interfaces supported by the driver5969* in a multiple BSSID set. This field must be set to a non-zero value5970* by the driver to advertise MBSSID support.5971* @ema_max_profile_periodicity: maximum profile periodicity supported by5972* the driver. Setting this field to a non-zero value indicates that the5973* driver supports enhanced multi-BSSID advertisements (EMA AP).5974* @max_num_akm_suites: maximum number of AKM suites allowed for5975* configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and5976* %NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by5977* driver. If set by driver minimum allowed value is5978* NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with5979* legacy userspace and maximum allowed value is5980* CFG80211_MAX_NUM_AKM_SUITES.5981*5982* @hw_timestamp_max_peers: maximum number of peers that the driver supports5983* enabling HW timestamping for concurrently. Setting this field to a5984* non-zero value indicates that the driver supports HW timestamping.5985* A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver5986* supports enabling HW timestamping for all peers (i.e. no need to5987* specify a mac address).5988*5989* @radio_cfg: configuration of radios belonging to a muli-radio wiphy. This5990* struct contains a list of all radio specific attributes and should be5991* used only for multi-radio wiphy.5992*5993* @radio: radios belonging to this wiphy5994* @n_radio: number of radios5995*/5996struct wiphy {5997struct mutex mtx;59985999/* assign these fields before you register the wiphy */60006001u8 perm_addr[ETH_ALEN];6002u8 addr_mask[ETH_ALEN];60036004struct mac_address *addresses;60056006const struct ieee80211_txrx_stypes *mgmt_stypes;60076008const struct ieee80211_iface_combination *iface_combinations;6009int n_iface_combinations;6010u16 software_iftypes;60116012u16 n_addresses;60136014/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */6015u16 interface_modes;60166017u16 max_acl_mac_addrs;60186019u32 flags, regulatory_flags, features;6020u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];60216022u32 ap_sme_capa;60236024enum cfg80211_signal_type signal_type;60256026int bss_priv_size;6027u8 max_scan_ssids;6028u8 max_sched_scan_reqs;6029u8 max_sched_scan_ssids;6030u8 max_match_sets;6031u16 max_scan_ie_len;6032u16 max_sched_scan_ie_len;6033u32 max_sched_scan_plans;6034u32 max_sched_scan_plan_interval;6035u32 max_sched_scan_plan_iterations;60366037int n_cipher_suites;6038const u32 *cipher_suites;60396040int n_akm_suites;6041const u32 *akm_suites;60426043const struct wiphy_iftype_akm_suites *iftype_akm_suites;6044unsigned int num_iftype_akm_suites;60456046u8 retry_short;6047u8 retry_long;6048u32 frag_threshold;6049u32 rts_threshold;6050u8 coverage_class;60516052char fw_version[ETHTOOL_FWVERS_LEN];6053u32 hw_version;60546055#ifdef CONFIG_PM6056const struct wiphy_wowlan_support *wowlan;6057struct cfg80211_wowlan *wowlan_config;6058#endif60596060u16 max_remain_on_channel_duration;60616062u8 max_num_pmkids;60636064u32 available_antennas_tx;6065u32 available_antennas_rx;60666067u32 probe_resp_offload;60686069const u8 *extended_capabilities, *extended_capabilities_mask;6070u8 extended_capabilities_len;60716072const struct wiphy_iftype_ext_capab *iftype_ext_capab;6073unsigned int num_iftype_ext_capab;60746075const void *privid;60766077struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];60786079void (*reg_notifier)(struct wiphy *wiphy,6080struct regulatory_request *request);60816082struct wiphy_radio_cfg *radio_cfg;60836084/* fields below are read-only, assigned by cfg80211 */60856086const struct ieee80211_regdomain __rcu *regd;60876088struct device dev;60896090bool registered;60916092struct dentry *debugfsdir;60936094const struct ieee80211_ht_cap *ht_capa_mod_mask;6095const struct ieee80211_vht_cap *vht_capa_mod_mask;60966097struct list_head wdev_list;60986099possible_net_t _net;61006101#ifdef CONFIG_CFG80211_WEXT6102const struct iw_handler_def *wext;6103#endif61046105const struct wiphy_coalesce_support *coalesce;61066107const struct wiphy_vendor_command *vendor_commands;6108const struct nl80211_vendor_cmd_info *vendor_events;6109int n_vendor_commands, n_vendor_events;61106111u16 max_ap_assoc_sta;61126113u8 max_num_csa_counters;61146115u32 bss_param_support;6116u32 bss_select_support;61176118u8 nan_supported_bands;6119struct wiphy_nan_capa nan_capa;61206121u32 txq_limit;6122u32 txq_memory_limit;6123u32 txq_quantum;61246125unsigned long tx_queue_len;61266127u8 support_mbssid:1,6128support_only_he_mbssid:1;61296130const struct cfg80211_pmsr_capabilities *pmsr_capa;61316132struct {6133u64 peer, vif;6134u8 max_retry;6135} tid_config_support;61366137u8 max_data_retry_count;61386139const struct cfg80211_sar_capa *sar_capa;61406141struct rfkill *rfkill;61426143u8 mbssid_max_interfaces;6144u8 ema_max_profile_periodicity;6145u16 max_num_akm_suites;61466147u16 hw_timestamp_max_peers;61486149int n_radio;6150const struct wiphy_radio *radio;61516152char priv[] __aligned(NETDEV_ALIGN);6153};61546155static inline struct net *wiphy_net(struct wiphy *wiphy)6156{6157return read_pnet(&wiphy->_net);6158}61596160static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)6161{6162write_pnet(&wiphy->_net, net);6163}61646165/**6166* wiphy_priv - return priv from wiphy6167*6168* @wiphy: the wiphy whose priv pointer to return6169* Return: The priv of @wiphy.6170*/6171static inline void *wiphy_priv(struct wiphy *wiphy)6172{6173BUG_ON(!wiphy);6174return &wiphy->priv;6175}61766177/**6178* priv_to_wiphy - return the wiphy containing the priv6179*6180* @priv: a pointer previously returned by wiphy_priv6181* Return: The wiphy of @priv.6182*/6183static inline struct wiphy *priv_to_wiphy(void *priv)6184{6185BUG_ON(!priv);6186return container_of(priv, struct wiphy, priv);6187}61886189/**6190* set_wiphy_dev - set device pointer for wiphy6191*6192* @wiphy: The wiphy whose device to bind6193* @dev: The device to parent it to6194*/6195static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)6196{6197wiphy->dev.parent = dev;6198}61996200/**6201* wiphy_dev - get wiphy dev pointer6202*6203* @wiphy: The wiphy whose device struct to look up6204* Return: The dev of @wiphy.6205*/6206static inline struct device *wiphy_dev(struct wiphy *wiphy)6207{6208return wiphy->dev.parent;6209}62106211/**6212* wiphy_name - get wiphy name6213*6214* @wiphy: The wiphy whose name to return6215* Return: The name of @wiphy.6216*/6217static inline const char *wiphy_name(const struct wiphy *wiphy)6218{6219return dev_name(&wiphy->dev);6220}62216222/**6223* wiphy_new_nm - create a new wiphy for use with cfg802116224*6225* @ops: The configuration operations for this device6226* @sizeof_priv: The size of the private area to allocate6227* @requested_name: Request a particular name.6228* NULL is valid value, and means use the default phy%d naming.6229*6230* Create a new wiphy and associate the given operations with it.6231* @sizeof_priv bytes are allocated for private use.6232*6233* Return: A pointer to the new wiphy. This pointer must be6234* assigned to each netdev's ieee80211_ptr for proper operation.6235*/6236struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,6237const char *requested_name);62386239/**6240* wiphy_new - create a new wiphy for use with cfg802116241*6242* @ops: The configuration operations for this device6243* @sizeof_priv: The size of the private area to allocate6244*6245* Create a new wiphy and associate the given operations with it.6246* @sizeof_priv bytes are allocated for private use.6247*6248* Return: A pointer to the new wiphy. This pointer must be6249* assigned to each netdev's ieee80211_ptr for proper operation.6250*/6251static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,6252int sizeof_priv)6253{6254return wiphy_new_nm(ops, sizeof_priv, NULL);6255}62566257/**6258* wiphy_register - register a wiphy with cfg802116259*6260* @wiphy: The wiphy to register.6261*6262* Return: A non-negative wiphy index or a negative error code.6263*/6264int wiphy_register(struct wiphy *wiphy);62656266/* this is a define for better error reporting (file/line) */6267#define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)62686269/**6270* rcu_dereference_wiphy - rcu_dereference with debug checking6271* @wiphy: the wiphy to check the locking on6272* @p: The pointer to read, prior to dereferencing6273*6274* Do an rcu_dereference(p), but check caller either holds rcu_read_lock()6275* or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().6276*/6277#define rcu_dereference_wiphy(wiphy, p) \6278rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))62796280/**6281* wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx6282* @wiphy: the wiphy to check the locking on6283* @p: The pointer to read, prior to dereferencing6284*6285* Return: the value of the specified RCU-protected pointer, but omit the6286* READ_ONCE(), because caller holds the wiphy mutex used for updates.6287*/6288#define wiphy_dereference(wiphy, p) \6289rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))62906291/**6292* get_wiphy_regdom - get custom regdomain for the given wiphy6293* @wiphy: the wiphy to get the regdomain from6294*6295* Context: Requires any of RTNL, wiphy mutex or RCU protection.6296*6297* Return: pointer to the regulatory domain associated with the wiphy6298*/6299const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);63006301/**6302* wiphy_unregister - deregister a wiphy from cfg802116303*6304* @wiphy: The wiphy to unregister.6305*6306* After this call, no more requests can be made with this priv6307* pointer, but the call may sleep to wait for an outstanding6308* request that is being handled.6309*/6310void wiphy_unregister(struct wiphy *wiphy);63116312/**6313* wiphy_free - free wiphy6314*6315* @wiphy: The wiphy to free6316*/6317void wiphy_free(struct wiphy *wiphy);63186319/* internal structs */6320struct cfg80211_conn;6321struct cfg80211_internal_bss;6322struct cfg80211_cached_keys;6323struct cfg80211_cqm_config;63246325/**6326* wiphy_lock - lock the wiphy6327* @wiphy: the wiphy to lock6328*6329* This is needed around registering and unregistering netdevs that6330* aren't created through cfg80211 calls, since that requires locking6331* in cfg80211 when the notifiers is called, but that cannot6332* differentiate which way it's called.6333*6334* It can also be used by drivers for their own purposes.6335*6336* When cfg80211 ops are called, the wiphy is already locked.6337*6338* Note that this makes sure that no workers that have been queued6339* with wiphy_queue_work() are running.6340*/6341static inline void wiphy_lock(struct wiphy *wiphy)6342__acquires(&wiphy->mtx)6343{6344mutex_lock(&wiphy->mtx);6345__acquire(&wiphy->mtx);6346}63476348/**6349* wiphy_unlock - unlock the wiphy again6350* @wiphy: the wiphy to unlock6351*/6352static inline void wiphy_unlock(struct wiphy *wiphy)6353__releases(&wiphy->mtx)6354{6355__release(&wiphy->mtx);6356mutex_unlock(&wiphy->mtx);6357}63586359DEFINE_GUARD(wiphy, struct wiphy *,6360mutex_lock(&_T->mtx),6361mutex_unlock(&_T->mtx))63626363struct wiphy_work;6364typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *);63656366struct wiphy_work {6367struct list_head entry;6368wiphy_work_func_t func;6369};63706371static inline void wiphy_work_init(struct wiphy_work *work,6372wiphy_work_func_t func)6373{6374INIT_LIST_HEAD(&work->entry);6375work->func = func;6376}63776378/**6379* wiphy_work_queue - queue work for the wiphy6380* @wiphy: the wiphy to queue for6381* @work: the work item6382*6383* This is useful for work that must be done asynchronously, and work6384* queued here has the special property that the wiphy mutex will be6385* held as if wiphy_lock() was called, and that it cannot be running6386* after wiphy_lock() was called. Therefore, wiphy_cancel_work() can6387* use just cancel_work() instead of cancel_work_sync(), it requires6388* being in a section protected by wiphy_lock().6389*/6390void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work);63916392/**6393* wiphy_work_cancel - cancel previously queued work6394* @wiphy: the wiphy, for debug purposes6395* @work: the work to cancel6396*6397* Cancel the work *without* waiting for it, this assumes being6398* called under the wiphy mutex acquired by wiphy_lock().6399*/6400void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work);64016402/**6403* wiphy_work_flush - flush previously queued work6404* @wiphy: the wiphy, for debug purposes6405* @work: the work to flush, this can be %NULL to flush all work6406*6407* Flush the work (i.e. run it if pending). This must be called6408* under the wiphy mutex acquired by wiphy_lock().6409*/6410void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work);64116412struct wiphy_delayed_work {6413struct wiphy_work work;6414struct wiphy *wiphy;6415struct timer_list timer;6416};64176418void wiphy_delayed_work_timer(struct timer_list *t);64196420static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork,6421wiphy_work_func_t func)6422{6423timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0);6424wiphy_work_init(&dwork->work, func);6425}64266427/**6428* wiphy_delayed_work_queue - queue delayed work for the wiphy6429* @wiphy: the wiphy to queue for6430* @dwork: the delayable worker6431* @delay: number of jiffies to wait before queueing6432*6433* This is useful for work that must be done asynchronously, and work6434* queued here has the special property that the wiphy mutex will be6435* held as if wiphy_lock() was called, and that it cannot be running6436* after wiphy_lock() was called. Therefore, wiphy_cancel_work() can6437* use just cancel_work() instead of cancel_work_sync(), it requires6438* being in a section protected by wiphy_lock().6439*6440* Note that these are scheduled with a timer where the accuracy6441* becomes less the longer in the future the scheduled timer is. Use6442* wiphy_hrtimer_work_queue() if the timer must be not be late by more6443* than approximately 10 percent.6444*/6445void wiphy_delayed_work_queue(struct wiphy *wiphy,6446struct wiphy_delayed_work *dwork,6447unsigned long delay);64486449/**6450* wiphy_delayed_work_cancel - cancel previously queued delayed work6451* @wiphy: the wiphy, for debug purposes6452* @dwork: the delayed work to cancel6453*6454* Cancel the work *without* waiting for it, this assumes being6455* called under the wiphy mutex acquired by wiphy_lock().6456*/6457void wiphy_delayed_work_cancel(struct wiphy *wiphy,6458struct wiphy_delayed_work *dwork);64596460/**6461* wiphy_delayed_work_flush - flush previously queued delayed work6462* @wiphy: the wiphy, for debug purposes6463* @dwork: the delayed work to flush6464*6465* Flush the work (i.e. run it if pending). This must be called6466* under the wiphy mutex acquired by wiphy_lock().6467*/6468void wiphy_delayed_work_flush(struct wiphy *wiphy,6469struct wiphy_delayed_work *dwork);64706471/**6472* wiphy_delayed_work_pending - Find out whether a wiphy delayable6473* work item is currently pending.6474*6475* @wiphy: the wiphy, for debug purposes6476* @dwork: the delayed work in question6477*6478* Return: true if timer is pending, false otherwise6479*6480* How wiphy_delayed_work_queue() works is by setting a timer which6481* when it expires calls wiphy_work_queue() to queue the wiphy work.6482* Because wiphy_delayed_work_queue() uses mod_timer(), if it is6483* called twice and the second call happens before the first call6484* deadline, the work will rescheduled for the second deadline and6485* won't run before that.6486*6487* wiphy_delayed_work_pending() can be used to detect if calling6488* wiphy_work_delayed_work_queue() would start a new work schedule6489* or delayed a previous one. As seen below it cannot be used to6490* detect precisely if the work has finished to execute nor if it6491* is currently executing.6492*6493* CPU0 CPU16494* wiphy_delayed_work_queue(wk)6495* mod_timer(wk->timer)6496* wiphy_delayed_work_pending(wk) -> true6497*6498* [...]6499* expire_timers(wk->timer)6500* detach_timer(wk->timer)6501* wiphy_delayed_work_pending(wk) -> false6502* wk->timer->function() |6503* wiphy_work_queue(wk) | delayed work pending6504* list_add_tail() | returns false but6505* queue_work(cfg80211_wiphy_work) | wk->func() has not6506* | been run yet6507* [...] |6508* cfg80211_wiphy_work() |6509* wk->func() V6510*6511*/6512bool wiphy_delayed_work_pending(struct wiphy *wiphy,6513struct wiphy_delayed_work *dwork);65146515struct wiphy_hrtimer_work {6516struct wiphy_work work;6517struct wiphy *wiphy;6518struct hrtimer timer;6519};65206521enum hrtimer_restart wiphy_hrtimer_work_timer(struct hrtimer *t);65226523static inline void wiphy_hrtimer_work_init(struct wiphy_hrtimer_work *hrwork,6524wiphy_work_func_t func)6525{6526hrtimer_setup(&hrwork->timer, wiphy_hrtimer_work_timer,6527CLOCK_BOOTTIME, HRTIMER_MODE_REL);6528wiphy_work_init(&hrwork->work, func);6529}65306531/**6532* wiphy_hrtimer_work_queue - queue hrtimer work for the wiphy6533* @wiphy: the wiphy to queue for6534* @hrwork: the high resolution timer worker6535* @delay: the delay given as a ktime_t6536*6537* Please refer to wiphy_delayed_work_queue(). The difference is that6538* the hrtimer work uses a high resolution timer for scheduling. This6539* may be needed if timeouts might be scheduled further in the future6540* and the accuracy of the normal timer is not sufficient.6541*6542* Expect a delay of a few milliseconds as the timer is scheduled6543* with some slack and some more time may pass between queueing the6544* work and its start.6545*/6546void wiphy_hrtimer_work_queue(struct wiphy *wiphy,6547struct wiphy_hrtimer_work *hrwork,6548ktime_t delay);65496550/**6551* wiphy_hrtimer_work_cancel - cancel previously queued hrtimer work6552* @wiphy: the wiphy, for debug purposes6553* @hrtimer: the hrtimer work to cancel6554*6555* Cancel the work *without* waiting for it, this assumes being6556* called under the wiphy mutex acquired by wiphy_lock().6557*/6558void wiphy_hrtimer_work_cancel(struct wiphy *wiphy,6559struct wiphy_hrtimer_work *hrtimer);65606561/**6562* wiphy_hrtimer_work_flush - flush previously queued hrtimer work6563* @wiphy: the wiphy, for debug purposes6564* @hrwork: the hrtimer work to flush6565*6566* Flush the work (i.e. run it if pending). This must be called6567* under the wiphy mutex acquired by wiphy_lock().6568*/6569void wiphy_hrtimer_work_flush(struct wiphy *wiphy,6570struct wiphy_hrtimer_work *hrwork);65716572/**6573* wiphy_hrtimer_work_pending - Find out whether a wiphy hrtimer6574* work item is currently pending.6575*6576* @wiphy: the wiphy, for debug purposes6577* @hrwork: the hrtimer work in question6578*6579* Return: true if timer is pending, false otherwise6580*6581* Please refer to the wiphy_delayed_work_pending() documentation as6582* this is the equivalent function for hrtimer based delayed work6583* items.6584*/6585bool wiphy_hrtimer_work_pending(struct wiphy *wiphy,6586struct wiphy_hrtimer_work *hrwork);65876588/**6589* enum ieee80211_ap_reg_power - regulatory power for an Access Point6590*6591* @IEEE80211_REG_UNSET_AP: Access Point has no regulatory power mode6592* @IEEE80211_REG_LPI_AP: Indoor Access Point6593* @IEEE80211_REG_SP_AP: Standard power Access Point6594* @IEEE80211_REG_VLP_AP: Very low power Access Point6595*/6596enum ieee80211_ap_reg_power {6597IEEE80211_REG_UNSET_AP,6598IEEE80211_REG_LPI_AP,6599IEEE80211_REG_SP_AP,6600IEEE80211_REG_VLP_AP,6601};66026603/**6604* struct wireless_dev - wireless device state6605*6606* For netdevs, this structure must be allocated by the driver6607* that uses the ieee80211_ptr field in struct net_device (this6608* is intentional so it can be allocated along with the netdev.)6609* It need not be registered then as netdev registration will6610* be intercepted by cfg80211 to see the new wireless device,6611* however, drivers must lock the wiphy before registering or6612* unregistering netdevs if they pre-create any netdevs (in ops6613* called from cfg80211, the wiphy is already locked.)6614*6615* For non-netdev uses, it must also be allocated by the driver6616* in response to the cfg80211 callbacks that require it, as6617* there's no netdev registration in that case it may not be6618* allocated outside of callback operations that return it.6619*6620* @wiphy: pointer to hardware description6621* @iftype: interface type6622* @registered: is this wdev already registered with cfg802116623* @registering: indicates we're doing registration under wiphy lock6624* for the notifier6625* @list: (private) Used to collect the interfaces6626* @netdev: (private) Used to reference back to the netdev, may be %NULL6627* @identifier: (private) Identifier used in nl80211 to identify this6628* wireless device if it has no netdev6629* @u: union containing data specific to @iftype6630* @connected: indicates if connected or not (STA mode)6631* @wext: (private) Used by the internal wireless extensions compat code6632* @wext.ibss: (private) IBSS data part of wext handling6633* @wext.connect: (private) connection handling data6634* @wext.keys: (private) (WEP) key data6635* @wext.ie: (private) extra elements for association6636* @wext.ie_len: (private) length of extra elements6637* @wext.bssid: (private) selected network BSSID6638* @wext.ssid: (private) selected network SSID6639* @wext.default_key: (private) selected default key index6640* @wext.default_mgmt_key: (private) selected default management key index6641* @wext.prev_bssid: (private) previous BSSID for reassociation6642* @wext.prev_bssid_valid: (private) previous BSSID validity6643* @use_4addr: indicates 4addr mode is used on this interface, must be6644* set by driver (if supported) on add_interface BEFORE registering the6645* netdev and may otherwise be used by driver read-only, will be update6646* by cfg80211 on change_interface6647* @mgmt_registrations: list of registrations for management frames6648* @mgmt_registrations_need_update: mgmt registrations were updated,6649* need to propagate the update to the driver6650* @address: The address for this device, valid only if @netdev is %NULL6651* @is_running: true if this is a non-netdev device that has been started, e.g.6652* the P2P Device.6653* @ps: powersave mode is enabled6654* @ps_timeout: dynamic powersave timeout6655* @ap_unexpected_nlportid: (private) netlink port ID of application6656* registered for unexpected class 3 frames (AP mode)6657* @conn: (private) cfg80211 software SME connection state machine data6658* @connect_keys: (private) keys to set after connection is established6659* @conn_bss_type: connecting/connected BSS type6660* @conn_owner_nlportid: (private) connection owner socket port ID6661* @disconnect_wk: (private) auto-disconnect work6662* @disconnect_bssid: (private) the BSSID to use for auto-disconnect6663* @event_list: (private) list for internal event processing6664* @event_lock: (private) lock for event list6665* @owner_nlportid: (private) owner socket port ID6666* @nl_owner_dead: (private) owner socket went away6667* @cqm_rssi_work: (private) CQM RSSI reporting work6668* @cqm_config: (private) nl80211 RSSI monitor state6669* @pmsr_list: (private) peer measurement requests6670* @pmsr_lock: (private) peer measurements requests/results lock6671* @pmsr_free_wk: (private) peer measurements cleanup work6672* @unprot_beacon_reported: (private) timestamp of last6673* unprotected beacon report6674* @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr6675* @ap and @client for each link6676* @links.cac_started: true if DFS channel availability check has been6677* started6678* @links.cac_start_time: timestamp (jiffies) when the dfs state was6679* entered.6680* @links.cac_time_ms: CAC time in ms6681* @valid_links: bitmap describing what elements of @links are valid6682* @radio_mask: Bitmask of radios that this interface is allowed to operate on.6683*/6684struct wireless_dev {6685struct wiphy *wiphy;6686enum nl80211_iftype iftype;66876688/* the remainder of this struct should be private to cfg80211 */6689struct list_head list;6690struct net_device *netdev;66916692u32 identifier;66936694struct list_head mgmt_registrations;6695u8 mgmt_registrations_need_update:1;66966697bool use_4addr, is_running, registered, registering;66986699u8 address[ETH_ALEN] __aligned(sizeof(u16));67006701/* currently used for IBSS and SME - might be rearranged later */6702struct cfg80211_conn *conn;6703struct cfg80211_cached_keys *connect_keys;6704enum ieee80211_bss_type conn_bss_type;6705u32 conn_owner_nlportid;67066707struct work_struct disconnect_wk;6708u8 disconnect_bssid[ETH_ALEN];67096710struct list_head event_list;6711spinlock_t event_lock;67126713u8 connected:1;67146715bool ps;6716int ps_timeout;67176718u32 ap_unexpected_nlportid;67196720u32 owner_nlportid;6721bool nl_owner_dead;67226723#ifdef CONFIG_CFG80211_WEXT6724/* wext data */6725struct {6726struct cfg80211_ibss_params ibss;6727struct cfg80211_connect_params connect;6728struct cfg80211_cached_keys *keys;6729const u8 *ie;6730size_t ie_len;6731u8 bssid[ETH_ALEN];6732u8 prev_bssid[ETH_ALEN];6733u8 ssid[IEEE80211_MAX_SSID_LEN];6734s8 default_key, default_mgmt_key;6735bool prev_bssid_valid;6736} wext;6737#endif67386739struct wiphy_work cqm_rssi_work;6740struct cfg80211_cqm_config __rcu *cqm_config;67416742struct list_head pmsr_list;6743spinlock_t pmsr_lock;6744struct work_struct pmsr_free_wk;67456746unsigned long unprot_beacon_reported;67476748union {6749struct {6750u8 connected_addr[ETH_ALEN] __aligned(2);6751u8 ssid[IEEE80211_MAX_SSID_LEN];6752u8 ssid_len;6753} client;6754struct {6755int beacon_interval;6756struct cfg80211_chan_def preset_chandef;6757struct cfg80211_chan_def chandef;6758u8 id[IEEE80211_MAX_MESH_ID_LEN];6759u8 id_len, id_up_len;6760} mesh;6761struct {6762struct cfg80211_chan_def preset_chandef;6763u8 ssid[IEEE80211_MAX_SSID_LEN];6764u8 ssid_len;6765} ap;6766struct {6767struct cfg80211_internal_bss *current_bss;6768struct cfg80211_chan_def chandef;6769int beacon_interval;6770u8 ssid[IEEE80211_MAX_SSID_LEN];6771u8 ssid_len;6772} ibss;6773struct {6774struct cfg80211_chan_def chandef;6775} ocb;6776struct {6777u8 cluster_id[ETH_ALEN] __aligned(2);6778} nan;6779} u;67806781struct {6782u8 addr[ETH_ALEN] __aligned(2);6783union {6784struct {6785unsigned int beacon_interval;6786struct cfg80211_chan_def chandef;6787} ap;6788struct {6789struct cfg80211_internal_bss *current_bss;6790} client;6791};67926793bool cac_started;6794unsigned long cac_start_time;6795unsigned int cac_time_ms;6796} links[IEEE80211_MLD_MAX_NUM_LINKS];6797u16 valid_links;67986799u32 radio_mask;6800};68016802static inline const u8 *wdev_address(struct wireless_dev *wdev)6803{6804if (wdev->netdev)6805return wdev->netdev->dev_addr;6806return wdev->address;6807}68086809static inline bool wdev_running(struct wireless_dev *wdev)6810{6811if (wdev->netdev)6812return netif_running(wdev->netdev);6813return wdev->is_running;6814}68156816/**6817* wdev_priv - return wiphy priv from wireless_dev6818*6819* @wdev: The wireless device whose wiphy's priv pointer to return6820* Return: The wiphy priv of @wdev.6821*/6822static inline void *wdev_priv(struct wireless_dev *wdev)6823{6824BUG_ON(!wdev);6825return wiphy_priv(wdev->wiphy);6826}68276828/**6829* wdev_chandef - return chandef pointer from wireless_dev6830* @wdev: the wdev6831* @link_id: the link ID for MLO6832*6833* Return: The chandef depending on the mode, or %NULL.6834*/6835struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,6836unsigned int link_id);68376838static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,6839unsigned int link_id)6840{6841WARN_ON(link_id && !wdev->valid_links);6842WARN_ON(wdev->valid_links &&6843!(wdev->valid_links & BIT(link_id)));6844}68456846#define for_each_valid_link(link_info, link_id) \6847for (link_id = 0; \6848link_id < ((link_info)->valid_links ? \6849ARRAY_SIZE((link_info)->links) : 1); \6850link_id++) \6851if (!(link_info)->valid_links || \6852((link_info)->valid_links & BIT(link_id)))68536854/**6855* DOC: Utility functions6856*6857* cfg80211 offers a number of utility functions that can be useful.6858*/68596860/**6861* ieee80211_channel_equal - compare two struct ieee80211_channel6862*6863* @a: 1st struct ieee80211_channel6864* @b: 2nd struct ieee80211_channel6865* Return: true if center frequency of @a == @b6866*/6867static inline bool6868ieee80211_channel_equal(struct ieee80211_channel *a,6869struct ieee80211_channel *b)6870{6871return (a->center_freq == b->center_freq &&6872a->freq_offset == b->freq_offset);6873}68746875/**6876* ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz6877* @chan: struct ieee80211_channel to convert6878* Return: The corresponding frequency (in KHz)6879*/6880static inline u326881ieee80211_channel_to_khz(const struct ieee80211_channel *chan)6882{6883return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;6884}68856886/**6887* ieee80211_channel_to_freq_khz - convert channel number to frequency6888* @chan: channel number6889* @band: band, necessary due to channel number overlap6890* Return: The corresponding frequency (in KHz), or 0 if the conversion failed.6891*/6892u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);68936894/**6895* ieee80211_channel_to_frequency - convert channel number to frequency6896* @chan: channel number6897* @band: band, necessary due to channel number overlap6898* Return: The corresponding frequency (in MHz), or 0 if the conversion failed.6899*/6900static inline int6901ieee80211_channel_to_frequency(int chan, enum nl80211_band band)6902{6903return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));6904}69056906/**6907* ieee80211_freq_khz_to_channel - convert frequency to channel number6908* @freq: center frequency in KHz6909* Return: The corresponding channel, or 0 if the conversion failed.6910*/6911int ieee80211_freq_khz_to_channel(u32 freq);69126913/**6914* ieee80211_frequency_to_channel - convert frequency to channel number6915* @freq: center frequency in MHz6916* Return: The corresponding channel, or 0 if the conversion failed.6917*/6918static inline int6919ieee80211_frequency_to_channel(int freq)6920{6921return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));6922}69236924/**6925* ieee80211_get_channel_khz - get channel struct from wiphy for specified6926* frequency6927* @wiphy: the struct wiphy to get the channel for6928* @freq: the center frequency (in KHz) of the channel6929* Return: The channel struct from @wiphy at @freq.6930*/6931struct ieee80211_channel *6932ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);69336934/**6935* ieee80211_get_channel - get channel struct from wiphy for specified frequency6936*6937* @wiphy: the struct wiphy to get the channel for6938* @freq: the center frequency (in MHz) of the channel6939* Return: The channel struct from @wiphy at @freq.6940*/6941static inline struct ieee80211_channel *6942ieee80211_get_channel(struct wiphy *wiphy, int freq)6943{6944return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));6945}69466947/**6948* cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC6949* @chan: control channel to check6950*6951* The Preferred Scanning Channels (PSC) are defined in6952* Draft IEEE P802.11ax/D5.0, 26.17.2.3.36953*6954* Return: %true if channel is a PSC, %false otherwise6955*/6956static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)6957{6958if (chan->band != NL80211_BAND_6GHZ)6959return false;69606961return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;6962}69636964/**6965* ieee80211_radio_freq_range_valid - Check if the radio supports the6966* specified frequency range6967*6968* @radio: wiphy radio6969* @freq: the frequency (in KHz) to be queried6970* @width: the bandwidth (in KHz) to be queried6971*6972* Return: whether or not the given frequency range is valid for the given radio6973*/6974bool ieee80211_radio_freq_range_valid(const struct wiphy_radio *radio,6975u32 freq, u32 width);69766977/**6978* cfg80211_radio_chandef_valid - Check if the radio supports the chandef6979*6980* @radio: wiphy radio6981* @chandef: chandef for current channel6982*6983* Return: whether or not the given chandef is valid for the given radio6984*/6985bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio,6986const struct cfg80211_chan_def *chandef);69876988/**6989* cfg80211_wdev_channel_allowed - Check if the wdev may use the channel6990*6991* @wdev: the wireless device6992* @chan: channel to check6993*6994* Return: whether or not the wdev may use the channel6995*/6996bool cfg80211_wdev_channel_allowed(struct wireless_dev *wdev,6997struct ieee80211_channel *chan);69986999/**7000* ieee80211_get_response_rate - get basic rate for a given rate7001*7002* @sband: the band to look for rates in7003* @basic_rates: bitmap of basic rates7004* @bitrate: the bitrate for which to find the basic rate7005*7006* Return: The basic rate corresponding to a given bitrate, that7007* is the next lower bitrate contained in the basic rate map,7008* which is, for this function, given as a bitmap of indices of7009* rates in the band's bitrate table.7010*/7011const struct ieee80211_rate *7012ieee80211_get_response_rate(struct ieee80211_supported_band *sband,7013u32 basic_rates, int bitrate);70147015/**7016* ieee80211_mandatory_rates - get mandatory rates for a given band7017* @sband: the band to look for rates in7018*7019* Return: a bitmap of the mandatory rates for the given band, bits7020* are set according to the rate position in the bitrates array.7021*/7022u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband);70237024/*7025* Radiotap parsing functions -- for controlled injection support7026*7027* Implemented in net/wireless/radiotap.c7028* Documentation in Documentation/networking/radiotap-headers.rst7029*/70307031struct radiotap_align_size {7032uint8_t align:4, size:4;7033};70347035struct ieee80211_radiotap_namespace {7036const struct radiotap_align_size *align_size;7037int n_bits;7038uint32_t oui;7039uint8_t subns;7040};70417042struct ieee80211_radiotap_vendor_namespaces {7043const struct ieee80211_radiotap_namespace *ns;7044int n_ns;7045};70467047/**7048* struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args7049* @this_arg_index: index of current arg, valid after each successful call7050* to ieee80211_radiotap_iterator_next()7051* @this_arg: pointer to current radiotap arg; it is valid after each7052* call to ieee80211_radiotap_iterator_next() but also after7053* ieee80211_radiotap_iterator_init() where it will point to7054* the beginning of the actual data portion7055* @this_arg_size: length of the current arg, for convenience7056* @current_namespace: pointer to the current namespace definition7057* (or internally %NULL if the current namespace is unknown)7058* @is_radiotap_ns: indicates whether the current namespace is the default7059* radiotap namespace or not7060*7061* @_rtheader: pointer to the radiotap header we are walking through7062* @_max_length: length of radiotap header in cpu byte ordering7063* @_arg_index: next argument index7064* @_arg: next argument pointer7065* @_next_bitmap: internal pointer to next present u327066* @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present7067* @_vns: vendor namespace definitions7068* @_next_ns_data: beginning of the next namespace's data7069* @_reset_on_ext: internal; reset the arg index to 0 when going to the7070* next bitmap word7071*7072* Describes the radiotap parser state. Fields prefixed with an underscore7073* must not be used by users of the parser, only by the parser internally.7074*/70757076struct ieee80211_radiotap_iterator {7077struct ieee80211_radiotap_header *_rtheader;7078const struct ieee80211_radiotap_vendor_namespaces *_vns;7079const struct ieee80211_radiotap_namespace *current_namespace;70807081unsigned char *_arg, *_next_ns_data;7082__le32 *_next_bitmap;70837084unsigned char *this_arg;7085int this_arg_index;7086int this_arg_size;70877088int is_radiotap_ns;70897090int _max_length;7091int _arg_index;7092uint32_t _bitmap_shifter;7093int _reset_on_ext;7094};70957096int7097ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,7098struct ieee80211_radiotap_header *radiotap_header,7099int max_length,7100const struct ieee80211_radiotap_vendor_namespaces *vns);71017102int7103ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);710471057106extern const unsigned char rfc1042_header[6];7107extern const unsigned char bridge_tunnel_header[6];71087109/**7110* ieee80211_get_hdrlen_from_skb - get header length from data7111*7112* @skb: the frame7113*7114* Given an skb with a raw 802.11 header at the data pointer this function7115* returns the 802.11 header length.7116*7117* Return: The 802.11 header length in bytes (not including encryption7118* headers). Or 0 if the data in the sk_buff is too short to contain a valid7119* 802.11 header.7120*/7121unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);71227123/**7124* ieee80211_hdrlen - get header length in bytes from frame control7125* @fc: frame control field in little-endian format7126* Return: The header length in bytes.7127*/7128unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);71297130/**7131* ieee80211_get_mesh_hdrlen - get mesh extension header length7132* @meshhdr: the mesh extension header, only the flags field7133* (first byte) will be accessed7134* Return: The length of the extension header, which is always at7135* least 6 bytes and at most 18 if address 5 and 6 are present.7136*/7137unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);71387139/**7140* DOC: Data path helpers7141*7142* In addition to generic utilities, cfg80211 also offers7143* functions that help implement the data path for devices7144* that do not do the 802.11/802.3 conversion on the device.7145*/71467147/**7148* ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.37149* @skb: the 802.11 data frame7150* @ehdr: pointer to a &struct ethhdr that will get the header, instead7151* of it being pushed into the SKB7152* @addr: the device MAC address7153* @iftype: the virtual interface type7154* @data_offset: offset of payload after the 802.11 header7155* @is_amsdu: true if the 802.11 header is A-MSDU7156* Return: 0 on success. Non-zero on error.7157*/7158int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,7159const u8 *addr, enum nl80211_iftype iftype,7160u8 data_offset, bool is_amsdu);71617162/**7163* ieee80211_data_to_8023 - convert an 802.11 data frame to 802.37164* @skb: the 802.11 data frame7165* @addr: the device MAC address7166* @iftype: the virtual interface type7167* Return: 0 on success. Non-zero on error.7168*/7169static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,7170enum nl80211_iftype iftype)7171{7172return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);7173}71747175/**7176* ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid7177*7178* This is used to detect non-standard A-MSDU frames, e.g. the ones generated7179* by ath10k and ath11k, where the subframe length includes the length of the7180* mesh control field.7181*7182* @skb: The input A-MSDU frame without any headers.7183* @mesh_hdr: the type of mesh header to test7184* 0: non-mesh A-MSDU length field7185* 1: big-endian mesh A-MSDU length field7186* 2: little-endian mesh A-MSDU length field7187* Returns: true if subframe header lengths are valid for the @mesh_hdr mode7188*/7189bool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr);71907191/**7192* ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame7193*7194* Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.7195* The @list will be empty if the decode fails. The @skb must be fully7196* header-less before being passed in here; it is freed in this function.7197*7198* @skb: The input A-MSDU frame without any headers.7199* @list: The output list of 802.3 frames. It must be allocated and7200* initialized by the caller.7201* @addr: The device MAC address.7202* @iftype: The device interface type.7203* @extra_headroom: The hardware extra headroom for SKBs in the @list.7204* @check_da: DA to check in the inner ethernet header, or NULL7205* @check_sa: SA to check in the inner ethernet header, or NULL7206* @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu7207*/7208void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,7209const u8 *addr, enum nl80211_iftype iftype,7210const unsigned int extra_headroom,7211const u8 *check_da, const u8 *check_sa,7212u8 mesh_control);72137214/**7215* ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol7216*7217* Check for RFC1042 or bridge tunnel header and fetch the encapsulated7218* protocol.7219*7220* @hdr: pointer to the MSDU payload7221* @proto: destination pointer to store the protocol7222* Return: true if encapsulation was found7223*/7224bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto);72257226/**7227* ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames7228*7229* Strip the mesh header, which was left in by ieee80211_data_to_8023 as part7230* of the MSDU data. Also move any source/destination addresses from the mesh7231* header to the ethernet header (if present).7232*7233* @skb: The 802.3 frame with embedded mesh header7234*7235* Return: 0 on success. Non-zero on error.7236*/7237int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb);72387239/**7240* cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame7241* @skb: the data frame7242* @qos_map: Interworking QoS mapping or %NULL if not in use7243* Return: The 802.1p/1d tag.7244*/7245unsigned int cfg80211_classify8021d(struct sk_buff *skb,7246struct cfg80211_qos_map *qos_map);72477248/**7249* cfg80211_find_elem_match - match information element and byte array in data7250*7251* @eid: element ID7252* @ies: data consisting of IEs7253* @len: length of data7254* @match: byte array to match7255* @match_len: number of bytes in the match array7256* @match_offset: offset in the IE data where the byte array should match.7257* Note the difference to cfg80211_find_ie_match() which considers7258* the offset to start from the element ID byte, but here we take7259* the data portion instead.7260*7261* Return: %NULL if the element ID could not be found or if7262* the element is invalid (claims to be longer than the given7263* data) or if the byte array doesn't match; otherwise return the7264* requested element struct.7265*7266* Note: There are no checks on the element length other than7267* having to fit into the given data and being large enough for the7268* byte array to match.7269*/7270const struct element *7271cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,7272const u8 *match, unsigned int match_len,7273unsigned int match_offset);72747275/**7276* cfg80211_find_ie_match - match information element and byte array in data7277*7278* @eid: element ID7279* @ies: data consisting of IEs7280* @len: length of data7281* @match: byte array to match7282* @match_len: number of bytes in the match array7283* @match_offset: offset in the IE where the byte array should match.7284* If match_len is zero, this must also be set to zero.7285* Otherwise this must be set to 2 or more, because the first7286* byte is the element id, which is already compared to eid, and7287* the second byte is the IE length.7288*7289* Return: %NULL if the element ID could not be found or if7290* the element is invalid (claims to be longer than the given7291* data) or if the byte array doesn't match, or a pointer to the first7292* byte of the requested element, that is the byte containing the7293* element ID.7294*7295* Note: There are no checks on the element length other than7296* having to fit into the given data and being large enough for the7297* byte array to match.7298*/7299static inline const u8 *7300cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,7301const u8 *match, unsigned int match_len,7302unsigned int match_offset)7303{7304/* match_offset can't be smaller than 2, unless match_len is7305* zero, in which case match_offset must be zero as well.7306*/7307if (WARN_ON((match_len && match_offset < 2) ||7308(!match_len && match_offset)))7309return NULL;73107311return (const void *)cfg80211_find_elem_match(eid, ies, len,7312match, match_len,7313match_offset ?7314match_offset - 2 : 0);7315}73167317/**7318* cfg80211_find_elem - find information element in data7319*7320* @eid: element ID7321* @ies: data consisting of IEs7322* @len: length of data7323*7324* Return: %NULL if the element ID could not be found or if7325* the element is invalid (claims to be longer than the given7326* data) or if the byte array doesn't match; otherwise return the7327* requested element struct.7328*7329* Note: There are no checks on the element length other than7330* having to fit into the given data.7331*/7332static inline const struct element *7333cfg80211_find_elem(u8 eid, const u8 *ies, int len)7334{7335return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);7336}73377338/**7339* cfg80211_find_ie - find information element in data7340*7341* @eid: element ID7342* @ies: data consisting of IEs7343* @len: length of data7344*7345* Return: %NULL if the element ID could not be found or if7346* the element is invalid (claims to be longer than the given7347* data), or a pointer to the first byte of the requested7348* element, that is the byte containing the element ID.7349*7350* Note: There are no checks on the element length other than7351* having to fit into the given data.7352*/7353static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)7354{7355return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);7356}73577358/**7359* cfg80211_find_ext_elem - find information element with EID Extension in data7360*7361* @ext_eid: element ID Extension7362* @ies: data consisting of IEs7363* @len: length of data7364*7365* Return: %NULL if the extended element could not be found or if7366* the element is invalid (claims to be longer than the given7367* data) or if the byte array doesn't match; otherwise return the7368* requested element struct.7369*7370* Note: There are no checks on the element length other than7371* having to fit into the given data.7372*/7373static inline const struct element *7374cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)7375{7376return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,7377&ext_eid, 1, 0);7378}73797380/**7381* cfg80211_find_ext_ie - find information element with EID Extension in data7382*7383* @ext_eid: element ID Extension7384* @ies: data consisting of IEs7385* @len: length of data7386*7387* Return: %NULL if the extended element ID could not be found or if7388* the element is invalid (claims to be longer than the given7389* data), or a pointer to the first byte of the requested7390* element, that is the byte containing the element ID.7391*7392* Note: There are no checks on the element length other than7393* having to fit into the given data.7394*/7395static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)7396{7397return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,7398&ext_eid, 1, 2);7399}74007401/**7402* cfg80211_find_vendor_elem - find vendor specific information element in data7403*7404* @oui: vendor OUI7405* @oui_type: vendor-specific OUI type (must be < 0xff), negative means any7406* @ies: data consisting of IEs7407* @len: length of data7408*7409* Return: %NULL if the vendor specific element ID could not be found or if the7410* element is invalid (claims to be longer than the given data); otherwise7411* return the element structure for the requested element.7412*7413* Note: There are no checks on the element length other than having to fit into7414* the given data.7415*/7416const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,7417const u8 *ies,7418unsigned int len);74197420/**7421* cfg80211_find_vendor_ie - find vendor specific information element in data7422*7423* @oui: vendor OUI7424* @oui_type: vendor-specific OUI type (must be < 0xff), negative means any7425* @ies: data consisting of IEs7426* @len: length of data7427*7428* Return: %NULL if the vendor specific element ID could not be found or if the7429* element is invalid (claims to be longer than the given data), or a pointer to7430* the first byte of the requested element, that is the byte containing the7431* element ID.7432*7433* Note: There are no checks on the element length other than having to fit into7434* the given data.7435*/7436static inline const u8 *7437cfg80211_find_vendor_ie(unsigned int oui, int oui_type,7438const u8 *ies, unsigned int len)7439{7440return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);7441}74427443/**7444* enum cfg80211_rnr_iter_ret - reduced neighbor report iteration state7445* @RNR_ITER_CONTINUE: continue iterating with the next entry7446* @RNR_ITER_BREAK: break iteration and return success7447* @RNR_ITER_ERROR: break iteration and return error7448*/7449enum cfg80211_rnr_iter_ret {7450RNR_ITER_CONTINUE,7451RNR_ITER_BREAK,7452RNR_ITER_ERROR,7453};74547455/**7456* cfg80211_iter_rnr - iterate reduced neighbor report entries7457* @elems: the frame elements to iterate RNR elements and then7458* their entries in7459* @elems_len: length of the elements7460* @iter: iteration function, see also &enum cfg80211_rnr_iter_ret7461* for the return value7462* @iter_data: additional data passed to the iteration function7463* Return: %true on success (after successfully iterating all entries7464* or if the iteration function returned %RNR_ITER_BREAK),7465* %false on error (iteration function returned %RNR_ITER_ERROR7466* or elements were malformed.)7467*/7468bool cfg80211_iter_rnr(const u8 *elems, size_t elems_len,7469enum cfg80211_rnr_iter_ret7470(*iter)(void *data, u8 type,7471const struct ieee80211_neighbor_ap_info *info,7472const u8 *tbtt_info, u8 tbtt_info_len),7473void *iter_data);74747475/**7476* cfg80211_defragment_element - Defrag the given element data into a buffer7477*7478* @elem: the element to defragment7479* @ies: elements where @elem is contained7480* @ieslen: length of @ies7481* @data: buffer to store element data, or %NULL to just determine size7482* @data_len: length of @data, or 07483* @frag_id: the element ID of fragments7484*7485* Return: length of @data, or -EINVAL on error7486*7487* Copy out all data from an element that may be fragmented into @data, while7488* skipping all headers.7489*7490* The function uses memmove() internally. It is acceptable to defragment an7491* element in-place.7492*/7493ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,7494size_t ieslen, u8 *data, size_t data_len,7495u8 frag_id);74967497/**7498* cfg80211_send_layer2_update - send layer 2 update frame7499*7500* @dev: network device7501* @addr: STA MAC address7502*7503* Wireless drivers can use this function to update forwarding tables in bridge7504* devices upon STA association.7505*/7506void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);75077508/**7509* DOC: Regulatory enforcement infrastructure7510*7511* TODO7512*/75137514/**7515* regulatory_hint - driver hint to the wireless core a regulatory domain7516* @wiphy: the wireless device giving the hint (used only for reporting7517* conflicts)7518* @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain7519* should be in. If @rd is set this should be NULL. Note that if you7520* set this to NULL you should still set rd->alpha2 to some accepted7521* alpha2.7522*7523* Wireless drivers can use this function to hint to the wireless core7524* what it believes should be the current regulatory domain by7525* giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory7526* domain should be in or by providing a completely build regulatory domain.7527* If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried7528* for a regulatory domain structure for the respective country.7529*7530* The wiphy must have been registered to cfg80211 prior to this call.7531* For cfg80211 drivers this means you must first use wiphy_register(),7532* for mac80211 drivers you must first use ieee80211_register_hw().7533*7534* Drivers should check the return value, its possible you can get7535* an -ENOMEM.7536*7537* Return: 0 on success. -ENOMEM.7538*/7539int regulatory_hint(struct wiphy *wiphy, const char *alpha2);75407541/**7542* regulatory_set_wiphy_regd - set regdom info for self managed drivers7543* @wiphy: the wireless device we want to process the regulatory domain on7544* @rd: the regulatory domain information to use for this wiphy7545*7546* Set the regulatory domain information for self-managed wiphys, only they7547* may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more7548* information.7549*7550* Return: 0 on success. -EINVAL, -EPERM7551*/7552int regulatory_set_wiphy_regd(struct wiphy *wiphy,7553struct ieee80211_regdomain *rd);75547555/**7556* regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers7557* @wiphy: the wireless device we want to process the regulatory domain on7558* @rd: the regulatory domain information to use for this wiphy7559*7560* This functions requires the RTNL and the wiphy mutex to be held and7561* applies the new regdomain synchronously to this wiphy. For more details7562* see regulatory_set_wiphy_regd().7563*7564* Return: 0 on success. -EINVAL, -EPERM7565*/7566int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,7567struct ieee80211_regdomain *rd);75687569/**7570* wiphy_apply_custom_regulatory - apply a custom driver regulatory domain7571* @wiphy: the wireless device we want to process the regulatory domain on7572* @regd: the custom regulatory domain to use for this wiphy7573*7574* Drivers can sometimes have custom regulatory domains which do not apply7575* to a specific country. Drivers can use this to apply such custom regulatory7576* domains. This routine must be called prior to wiphy registration. The7577* custom regulatory domain will be trusted completely and as such previous7578* default channel settings will be disregarded. If no rule is found for a7579* channel on the regulatory domain the channel will be disabled.7580* Drivers using this for a wiphy should also set the wiphy flag7581* REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy7582* that called this helper.7583*/7584void wiphy_apply_custom_regulatory(struct wiphy *wiphy,7585const struct ieee80211_regdomain *regd);75867587/**7588* freq_reg_info - get regulatory information for the given frequency7589* @wiphy: the wiphy for which we want to process this rule for7590* @center_freq: Frequency in KHz for which we want regulatory information for7591*7592* Use this function to get the regulatory rule for a specific frequency on7593* a given wireless device. If the device has a specific regulatory domain7594* it wants to follow we respect that unless a country IE has been received7595* and processed already.7596*7597* Return: A valid pointer, or, when an error occurs, for example if no rule7598* can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to7599* check and PTR_ERR() to obtain the numeric return value. The numeric return7600* value will be -ERANGE if we determine the given center_freq does not even7601* have a regulatory rule for a frequency range in the center_freq's band.7602* See freq_in_rule_band() for our current definition of a band -- this is7603* purely subjective and right now it's 802.11 specific.7604*/7605const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,7606u32 center_freq);76077608/**7609* reg_initiator_name - map regulatory request initiator enum to name7610* @initiator: the regulatory request initiator7611*7612* You can use this to map the regulatory request initiator enum to a7613* proper string representation.7614*7615* Return: pointer to string representation of the initiator7616*/7617const char *reg_initiator_name(enum nl80211_reg_initiator initiator);76187619/**7620* regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom7621* @wiphy: wiphy for which pre-CAC capability is checked.7622*7623* Pre-CAC is allowed only in some regdomains (notable ETSI).7624*7625* Return: %true if allowed, %false otherwise7626*/7627bool regulatory_pre_cac_allowed(struct wiphy *wiphy);76287629/**7630* DOC: Internal regulatory db functions7631*7632*/76337634/**7635* reg_query_regdb_wmm - Query internal regulatory db for wmm rule7636* Regulatory self-managed driver can use it to proactively7637*7638* @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.7639* @freq: the frequency (in MHz) to be queried.7640* @rule: pointer to store the wmm rule from the regulatory db.7641*7642* Self-managed wireless drivers can use this function to query7643* the internal regulatory database to check whether the given7644* ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.7645*7646* Drivers should check the return value, its possible you can get7647* an -ENODATA.7648*7649* Return: 0 on success. -ENODATA.7650*/7651int reg_query_regdb_wmm(char *alpha2, int freq,7652struct ieee80211_reg_rule *rule);76537654/*7655* callbacks for asynchronous cfg80211 methods, notification7656* functions and BSS handling helpers7657*/76587659/**7660* cfg80211_scan_done - notify that scan finished7661*7662* @request: the corresponding scan request7663* @info: information about the completed scan7664*/7665void cfg80211_scan_done(struct cfg80211_scan_request *request,7666struct cfg80211_scan_info *info);76677668/**7669* cfg80211_sched_scan_results - notify that new scan results are available7670*7671* @wiphy: the wiphy which got scheduled scan results7672* @reqid: identifier for the related scheduled scan request7673*/7674void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);76757676/**7677* cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped7678*7679* @wiphy: the wiphy on which the scheduled scan stopped7680* @reqid: identifier for the related scheduled scan request7681*7682* The driver can call this function to inform cfg80211 that the7683* scheduled scan had to be stopped, for whatever reason. The driver7684* is then called back via the sched_scan_stop operation when done.7685*/7686void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);76877688/**7689* cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped7690*7691* @wiphy: the wiphy on which the scheduled scan stopped7692* @reqid: identifier for the related scheduled scan request7693*7694* The driver can call this function to inform cfg80211 that the7695* scheduled scan had to be stopped, for whatever reason. The driver7696* is then called back via the sched_scan_stop operation when done.7697* This function should be called with the wiphy mutex held.7698*/7699void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);77007701/**7702* cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame7703* @wiphy: the wiphy reporting the BSS7704* @data: the BSS metadata7705* @mgmt: the management frame (probe response or beacon)7706* @len: length of the management frame7707* @gfp: context flags7708*7709* This informs cfg80211 that BSS information was found and7710* the BSS should be updated/added.7711*7712* Return: A referenced struct, must be released with cfg80211_put_bss()!7713* Or %NULL on error.7714*/7715struct cfg80211_bss * __must_check7716cfg80211_inform_bss_frame_data(struct wiphy *wiphy,7717struct cfg80211_inform_bss *data,7718struct ieee80211_mgmt *mgmt, size_t len,7719gfp_t gfp);77207721static inline struct cfg80211_bss * __must_check7722cfg80211_inform_bss_frame(struct wiphy *wiphy,7723struct ieee80211_channel *rx_channel,7724struct ieee80211_mgmt *mgmt, size_t len,7725s32 signal, gfp_t gfp)7726{7727struct cfg80211_inform_bss data = {7728.chan = rx_channel,7729.signal = signal,7730};77317732return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);7733}77347735/**7736* cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID7737* @bssid: transmitter BSSID7738* @max_bssid: max BSSID indicator, taken from Multiple BSSID element7739* @mbssid_index: BSSID index, taken from Multiple BSSID index element7740* @new_bssid: calculated nontransmitted BSSID7741*/7742static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,7743u8 mbssid_index, u8 *new_bssid)7744{7745u64 bssid_u64 = ether_addr_to_u64(bssid);7746u64 mask = GENMASK_ULL(max_bssid - 1, 0);7747u64 new_bssid_u64;77487749new_bssid_u64 = bssid_u64 & ~mask;77507751new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;77527753u64_to_ether_addr(new_bssid_u64, new_bssid);7754}77557756/**7757* cfg80211_is_element_inherited - returns if element ID should be inherited7758* @element: element to check7759* @non_inherit_element: non inheritance element7760*7761* Return: %true if should be inherited, %false otherwise7762*/7763bool cfg80211_is_element_inherited(const struct element *element,7764const struct element *non_inherit_element);77657766/**7767* cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs7768* @ie: ies7769* @ielen: length of IEs7770* @mbssid_elem: current MBSSID element7771* @sub_elem: current MBSSID subelement (profile)7772* @merged_ie: location of the merged profile7773* @max_copy_len: max merged profile length7774*7775* Return: the number of bytes merged7776*/7777size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,7778const struct element *mbssid_elem,7779const struct element *sub_elem,7780u8 *merged_ie, size_t max_copy_len);77817782/**7783* enum cfg80211_bss_frame_type - frame type that the BSS data came from7784* @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is7785* from a beacon or probe response7786* @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon7787* @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response7788* @CFG80211_BSS_FTYPE_S1G_BEACON: data comes from an S1G beacon7789*/7790enum cfg80211_bss_frame_type {7791CFG80211_BSS_FTYPE_UNKNOWN,7792CFG80211_BSS_FTYPE_BEACON,7793CFG80211_BSS_FTYPE_PRESP,7794CFG80211_BSS_FTYPE_S1G_BEACON,7795};77967797/**7798* cfg80211_get_ies_channel_number - returns the channel number from ies7799* @ie: IEs7800* @ielen: length of IEs7801* @band: enum nl80211_band of the channel7802*7803* Return: the channel number, or -1 if none could be determined.7804*/7805int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,7806enum nl80211_band band);78077808/**7809* cfg80211_ssid_eq - compare two SSIDs7810* @a: first SSID7811* @b: second SSID7812*7813* Return: %true if SSIDs are equal, %false otherwise.7814*/7815static inline bool7816cfg80211_ssid_eq(struct cfg80211_ssid *a, struct cfg80211_ssid *b)7817{7818if (WARN_ON(!a || !b))7819return false;7820if (a->ssid_len != b->ssid_len)7821return false;7822return memcmp(a->ssid, b->ssid, a->ssid_len) ? false : true;7823}78247825/**7826* cfg80211_inform_bss_data - inform cfg80211 of a new BSS7827*7828* @wiphy: the wiphy reporting the BSS7829* @data: the BSS metadata7830* @ftype: frame type (if known)7831* @bssid: the BSSID of the BSS7832* @tsf: the TSF sent by the peer in the beacon/probe response (or 0)7833* @capability: the capability field sent by the peer7834* @beacon_interval: the beacon interval announced by the peer7835* @ie: additional IEs sent by the peer7836* @ielen: length of the additional IEs7837* @gfp: context flags7838*7839* This informs cfg80211 that BSS information was found and7840* the BSS should be updated/added.7841*7842* Return: A referenced struct, must be released with cfg80211_put_bss()!7843* Or %NULL on error.7844*/7845struct cfg80211_bss * __must_check7846cfg80211_inform_bss_data(struct wiphy *wiphy,7847struct cfg80211_inform_bss *data,7848enum cfg80211_bss_frame_type ftype,7849const u8 *bssid, u64 tsf, u16 capability,7850u16 beacon_interval, const u8 *ie, size_t ielen,7851gfp_t gfp);78527853static inline struct cfg80211_bss * __must_check7854cfg80211_inform_bss(struct wiphy *wiphy,7855struct ieee80211_channel *rx_channel,7856enum cfg80211_bss_frame_type ftype,7857const u8 *bssid, u64 tsf, u16 capability,7858u16 beacon_interval, const u8 *ie, size_t ielen,7859s32 signal, gfp_t gfp)7860{7861struct cfg80211_inform_bss data = {7862.chan = rx_channel,7863.signal = signal,7864};78657866return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,7867capability, beacon_interval, ie, ielen,7868gfp);7869}78707871/**7872* __cfg80211_get_bss - get a BSS reference7873* @wiphy: the wiphy this BSS struct belongs to7874* @channel: the channel to search on (or %NULL)7875* @bssid: the desired BSSID (or %NULL)7876* @ssid: the desired SSID (or %NULL)7877* @ssid_len: length of the SSID (or 0)7878* @bss_type: type of BSS, see &enum ieee80211_bss_type7879* @privacy: privacy filter, see &enum ieee80211_privacy7880* @use_for: indicates which use is intended7881*7882* Return: Reference-counted BSS on success. %NULL on error.7883*/7884struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy,7885struct ieee80211_channel *channel,7886const u8 *bssid,7887const u8 *ssid, size_t ssid_len,7888enum ieee80211_bss_type bss_type,7889enum ieee80211_privacy privacy,7890u32 use_for);78917892/**7893* cfg80211_get_bss - get a BSS reference7894* @wiphy: the wiphy this BSS struct belongs to7895* @channel: the channel to search on (or %NULL)7896* @bssid: the desired BSSID (or %NULL)7897* @ssid: the desired SSID (or %NULL)7898* @ssid_len: length of the SSID (or 0)7899* @bss_type: type of BSS, see &enum ieee80211_bss_type7900* @privacy: privacy filter, see &enum ieee80211_privacy7901*7902* This version implies regular usage, %NL80211_BSS_USE_FOR_NORMAL.7903*7904* Return: Reference-counted BSS on success. %NULL on error.7905*/7906static inline struct cfg80211_bss *7907cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel,7908const u8 *bssid, const u8 *ssid, size_t ssid_len,7909enum ieee80211_bss_type bss_type,7910enum ieee80211_privacy privacy)7911{7912return __cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len,7913bss_type, privacy,7914NL80211_BSS_USE_FOR_NORMAL);7915}79167917static inline struct cfg80211_bss *7918cfg80211_get_ibss(struct wiphy *wiphy,7919struct ieee80211_channel *channel,7920const u8 *ssid, size_t ssid_len)7921{7922return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,7923IEEE80211_BSS_TYPE_IBSS,7924IEEE80211_PRIVACY_ANY);7925}79267927/**7928* cfg80211_ref_bss - reference BSS struct7929* @wiphy: the wiphy this BSS struct belongs to7930* @bss: the BSS struct to reference7931*7932* Increments the refcount of the given BSS struct.7933*/7934void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);79357936/**7937* cfg80211_put_bss - unref BSS struct7938* @wiphy: the wiphy this BSS struct belongs to7939* @bss: the BSS struct7940*7941* Decrements the refcount of the given BSS struct.7942*/7943void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);79447945/**7946* cfg80211_unlink_bss - unlink BSS from internal data structures7947* @wiphy: the wiphy7948* @bss: the bss to remove7949*7950* This function removes the given BSS from the internal data structures7951* thereby making it no longer show up in scan results etc. Use this7952* function when you detect a BSS is gone. Normally BSSes will also time7953* out, so it is not necessary to use this function at all.7954*/7955void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);79567957/**7958* cfg80211_bss_iter - iterate all BSS entries7959*7960* This function iterates over the BSS entries associated with the given wiphy7961* and calls the callback for the iterated BSS. The iterator function is not7962* allowed to call functions that might modify the internal state of the BSS DB.7963*7964* @wiphy: the wiphy7965* @chandef: if given, the iterator function will be called only if the channel7966* of the currently iterated BSS is a subset of the given channel.7967* @iter: the iterator function to call7968* @iter_data: an argument to the iterator function7969*/7970void cfg80211_bss_iter(struct wiphy *wiphy,7971struct cfg80211_chan_def *chandef,7972void (*iter)(struct wiphy *wiphy,7973struct cfg80211_bss *bss,7974void *data),7975void *iter_data);79767977/**7978* cfg80211_rx_mlme_mgmt - notification of processed MLME management frame7979* @dev: network device7980* @buf: authentication frame (header + body)7981* @len: length of the frame data7982*7983* This function is called whenever an authentication, disassociation or7984* deauthentication frame has been received and processed in station mode.7985* After being asked to authenticate via cfg80211_ops::auth() the driver must7986* call either this function or cfg80211_auth_timeout().7987* After being asked to associate via cfg80211_ops::assoc() the driver must7988* call either this function or cfg80211_auth_timeout().7989* While connected, the driver must calls this for received and processed7990* disassociation and deauthentication frames. If the frame couldn't be used7991* because it was unprotected, the driver must call the function7992* cfg80211_rx_unprot_mlme_mgmt() instead.7993*7994* This function may sleep. The caller must hold the corresponding wdev's mutex.7995*/7996void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);79977998/**7999* cfg80211_auth_timeout - notification of timed out authentication8000* @dev: network device8001* @addr: The MAC address of the device with which the authentication timed out8002*8003* This function may sleep. The caller must hold the corresponding wdev's8004* mutex.8005*/8006void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);80078008/**8009* struct cfg80211_rx_assoc_resp_data - association response data8010* @buf: (Re)Association Response frame (header + body)8011* @len: length of the frame data8012* @uapsd_queues: bitmap of queues configured for uapsd. Same format8013* as the AC bitmap in the QoS info field8014* @req_ies: information elements from the (Re)Association Request frame8015* @req_ies_len: length of req_ies data8016* @ap_mld_addr: AP MLD address (in case of MLO)8017* @links: per-link information indexed by link ID, use links[0] for8018* non-MLO connections8019* @links.bss: the BSS that association was requested with, ownership of the8020* pointer moves to cfg80211 in the call to cfg80211_rx_assoc_resp()8021* @links.status: Set this (along with a BSS pointer) for links that8022* were rejected by the AP.8023*/8024struct cfg80211_rx_assoc_resp_data {8025const u8 *buf;8026size_t len;8027const u8 *req_ies;8028size_t req_ies_len;8029int uapsd_queues;8030const u8 *ap_mld_addr;8031struct {8032u8 addr[ETH_ALEN] __aligned(2);8033struct cfg80211_bss *bss;8034u16 status;8035} links[IEEE80211_MLD_MAX_NUM_LINKS];8036};80378038/**8039* cfg80211_rx_assoc_resp - notification of processed association response8040* @dev: network device8041* @data: association response data, &struct cfg80211_rx_assoc_resp_data8042*8043* After being asked to associate via cfg80211_ops::assoc() the driver must8044* call either this function or cfg80211_auth_timeout().8045*8046* This function may sleep. The caller must hold the corresponding wdev's mutex.8047*/8048void cfg80211_rx_assoc_resp(struct net_device *dev,8049const struct cfg80211_rx_assoc_resp_data *data);80508051/**8052* struct cfg80211_assoc_failure - association failure data8053* @ap_mld_addr: AP MLD address, or %NULL8054* @bss: list of BSSes, must use entry 0 for non-MLO connections8055* (@ap_mld_addr is %NULL)8056* @timeout: indicates the association failed due to timeout, otherwise8057* the association was abandoned for a reason reported through some8058* other API (e.g. deauth RX)8059*/8060struct cfg80211_assoc_failure {8061const u8 *ap_mld_addr;8062struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];8063bool timeout;8064};80658066/**8067* cfg80211_assoc_failure - notification of association failure8068* @dev: network device8069* @data: data describing the association failure8070*8071* This function may sleep. The caller must hold the corresponding wdev's mutex.8072*/8073void cfg80211_assoc_failure(struct net_device *dev,8074struct cfg80211_assoc_failure *data);80758076/**8077* cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame8078* @dev: network device8079* @buf: 802.11 frame (header + body)8080* @len: length of the frame data8081* @reconnect: immediate reconnect is desired (include the nl80211 attribute)8082*8083* This function is called whenever deauthentication has been processed in8084* station mode. This includes both received deauthentication frames and8085* locally generated ones. This function may sleep. The caller must hold the8086* corresponding wdev's mutex.8087*/8088void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,8089bool reconnect);80908091/**8092* cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame8093* @dev: network device8094* @buf: received management frame (header + body)8095* @len: length of the frame data8096*8097* This function is called whenever a received deauthentication or dissassoc8098* frame has been dropped in station mode because of MFP being used but the8099* frame was not protected. This is also used to notify reception of a Beacon8100* frame that was dropped because it did not include a valid MME MIC while8101* beacon protection was enabled (BIGTK configured in station mode).8102*8103* This function may sleep.8104*/8105void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,8106const u8 *buf, size_t len);81078108/**8109* cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)8110* @dev: network device8111* @addr: The source MAC address of the frame8112* @key_type: The key type that the received frame used8113* @key_id: Key identifier (0..3). Can be -1 if missing.8114* @tsc: The TSC value of the frame that generated the MIC failure (6 octets)8115* @gfp: allocation flags8116*8117* This function is called whenever the local MAC detects a MIC failure in a8118* received frame. This matches with MLME-MICHAELMICFAILURE.indication()8119* primitive.8120*/8121void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,8122enum nl80211_key_type key_type, int key_id,8123const u8 *tsc, gfp_t gfp);81248125/**8126* cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS8127*8128* @dev: network device8129* @bssid: the BSSID of the IBSS joined8130* @channel: the channel of the IBSS joined8131* @gfp: allocation flags8132*8133* This function notifies cfg80211 that the device joined an IBSS or8134* switched to a different BSSID. Before this function can be called,8135* either a beacon has to have been received from the IBSS, or one of8136* the cfg80211_inform_bss{,_frame} functions must have been called8137* with the locally generated beacon -- this guarantees that there is8138* always a scan result for this IBSS. cfg80211 will handle the rest.8139*/8140void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,8141struct ieee80211_channel *channel, gfp_t gfp);81428143/**8144* cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer8145* candidate8146*8147* @dev: network device8148* @macaddr: the MAC address of the new candidate8149* @ie: information elements advertised by the peer candidate8150* @ie_len: length of the information elements buffer8151* @sig_dbm: signal level in dBm8152* @gfp: allocation flags8153*8154* This function notifies cfg80211 that the mesh peer candidate has been8155* detected, most likely via a beacon or, less likely, via a probe response.8156* cfg80211 then sends a notification to userspace.8157*/8158void cfg80211_notify_new_peer_candidate(struct net_device *dev,8159const u8 *macaddr, const u8 *ie, u8 ie_len,8160int sig_dbm, gfp_t gfp);81618162/**8163* DOC: RFkill integration8164*8165* RFkill integration in cfg80211 is almost invisible to drivers,8166* as cfg80211 automatically registers an rfkill instance for each8167* wireless device it knows about. Soft kill is also translated8168* into disconnecting and turning all interfaces off. Drivers are8169* expected to turn off the device when all interfaces are down.8170*8171* However, devices may have a hard RFkill line, in which case they8172* also need to interact with the rfkill subsystem, via cfg80211.8173* They can do this with a few helper functions documented here.8174*/81758176/**8177* wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state8178* @wiphy: the wiphy8179* @blocked: block status8180* @reason: one of reasons in &enum rfkill_hard_block_reasons8181*/8182void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,8183enum rfkill_hard_block_reasons reason);81848185static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)8186{8187wiphy_rfkill_set_hw_state_reason(wiphy, blocked,8188RFKILL_HARD_BLOCK_SIGNAL);8189}81908191/**8192* wiphy_rfkill_start_polling - start polling rfkill8193* @wiphy: the wiphy8194*/8195void wiphy_rfkill_start_polling(struct wiphy *wiphy);81968197/**8198* wiphy_rfkill_stop_polling - stop polling rfkill8199* @wiphy: the wiphy8200*/8201static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)8202{8203rfkill_pause_polling(wiphy->rfkill);8204}82058206/**8207* DOC: Vendor commands8208*8209* Occasionally, there are special protocol or firmware features that8210* can't be implemented very openly. For this and similar cases, the8211* vendor command functionality allows implementing the features with8212* (typically closed-source) userspace and firmware, using nl80211 as8213* the configuration mechanism.8214*8215* A driver supporting vendor commands must register them as an array8216* in struct wiphy, with handlers for each one. Each command has an8217* OUI and sub command ID to identify it.8218*8219* Note that this feature should not be (ab)used to implement protocol8220* features that could openly be shared across drivers. In particular,8221* it must never be required to use vendor commands to implement any8222* "normal" functionality that higher-level userspace like connection8223* managers etc. need.8224*/82258226struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,8227enum nl80211_commands cmd,8228enum nl80211_attrs attr,8229int approxlen);82308231struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,8232struct wireless_dev *wdev,8233enum nl80211_commands cmd,8234enum nl80211_attrs attr,8235unsigned int portid,8236int vendor_event_idx,8237int approxlen, gfp_t gfp);82388239void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);82408241/**8242* cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply8243* @wiphy: the wiphy8244* @approxlen: an upper bound of the length of the data that will8245* be put into the skb8246*8247* This function allocates and pre-fills an skb for a reply to8248* a vendor command. Since it is intended for a reply, calling8249* it outside of a vendor command's doit() operation is invalid.8250*8251* The returned skb is pre-filled with some identifying data in8252* a way that any data that is put into the skb (with skb_put(),8253* nla_put() or similar) will end up being within the8254* %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done8255* with the skb is adding data for the corresponding userspace tool8256* which can then read that data out of the vendor data attribute.8257* You must not modify the skb in any other way.8258*8259* When done, call cfg80211_vendor_cmd_reply() with the skb and return8260* its error code as the result of the doit() operation.8261*8262* Return: An allocated and pre-filled skb. %NULL if any errors happen.8263*/8264static inline struct sk_buff *8265cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)8266{8267return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,8268NL80211_ATTR_VENDOR_DATA, approxlen);8269}82708271/**8272* cfg80211_vendor_cmd_reply - send the reply skb8273* @skb: The skb, must have been allocated with8274* cfg80211_vendor_cmd_alloc_reply_skb()8275*8276* Since calling this function will usually be the last thing8277* before returning from the vendor command doit() you should8278* return the error code. Note that this function consumes the8279* skb regardless of the return value.8280*8281* Return: An error code or 0 on success.8282*/8283int cfg80211_vendor_cmd_reply(struct sk_buff *skb);82848285/**8286* cfg80211_vendor_cmd_get_sender - get the current sender netlink ID8287* @wiphy: the wiphy8288*8289* Return: the current netlink port ID in a vendor command handler.8290*8291* Context: May only be called from a vendor command handler8292*/8293unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);82948295/**8296* cfg80211_vendor_event_alloc - allocate vendor-specific event skb8297* @wiphy: the wiphy8298* @wdev: the wireless device8299* @event_idx: index of the vendor event in the wiphy's vendor_events8300* @approxlen: an upper bound of the length of the data that will8301* be put into the skb8302* @gfp: allocation flags8303*8304* This function allocates and pre-fills an skb for an event on the8305* vendor-specific multicast group.8306*8307* If wdev != NULL, both the ifindex and identifier of the specified8308* wireless device are added to the event message before the vendor data8309* attribute.8310*8311* When done filling the skb, call cfg80211_vendor_event() with the8312* skb to send the event.8313*8314* Return: An allocated and pre-filled skb. %NULL if any errors happen.8315*/8316static inline struct sk_buff *8317cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,8318int approxlen, int event_idx, gfp_t gfp)8319{8320return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,8321NL80211_ATTR_VENDOR_DATA,83220, event_idx, approxlen, gfp);8323}83248325/**8326* cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb8327* @wiphy: the wiphy8328* @wdev: the wireless device8329* @event_idx: index of the vendor event in the wiphy's vendor_events8330* @portid: port ID of the receiver8331* @approxlen: an upper bound of the length of the data that will8332* be put into the skb8333* @gfp: allocation flags8334*8335* This function allocates and pre-fills an skb for an event to send to8336* a specific (userland) socket. This socket would previously have been8337* obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take8338* care to register a netlink notifier to see when the socket closes.8339*8340* If wdev != NULL, both the ifindex and identifier of the specified8341* wireless device are added to the event message before the vendor data8342* attribute.8343*8344* When done filling the skb, call cfg80211_vendor_event() with the8345* skb to send the event.8346*8347* Return: An allocated and pre-filled skb. %NULL if any errors happen.8348*/8349static inline struct sk_buff *8350cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,8351struct wireless_dev *wdev,8352unsigned int portid, int approxlen,8353int event_idx, gfp_t gfp)8354{8355return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,8356NL80211_ATTR_VENDOR_DATA,8357portid, event_idx, approxlen, gfp);8358}83598360/**8361* cfg80211_vendor_event - send the event8362* @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()8363* @gfp: allocation flags8364*8365* This function sends the given @skb, which must have been allocated8366* by cfg80211_vendor_event_alloc(), as an event. It always consumes it.8367*/8368static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)8369{8370__cfg80211_send_event_skb(skb, gfp);8371}83728373#ifdef CONFIG_NL80211_TESTMODE8374/**8375* DOC: Test mode8376*8377* Test mode is a set of utility functions to allow drivers to8378* interact with driver-specific tools to aid, for instance,8379* factory programming.8380*8381* This chapter describes how drivers interact with it. For more8382* information see the nl80211 book's chapter on it.8383*/83848385/**8386* cfg80211_testmode_alloc_reply_skb - allocate testmode reply8387* @wiphy: the wiphy8388* @approxlen: an upper bound of the length of the data that will8389* be put into the skb8390*8391* This function allocates and pre-fills an skb for a reply to8392* the testmode command. Since it is intended for a reply, calling8393* it outside of the @testmode_cmd operation is invalid.8394*8395* The returned skb is pre-filled with the wiphy index and set up in8396* a way that any data that is put into the skb (with skb_put(),8397* nla_put() or similar) will end up being within the8398* %NL80211_ATTR_TESTDATA attribute, so all that needs to be done8399* with the skb is adding data for the corresponding userspace tool8400* which can then read that data out of the testdata attribute. You8401* must not modify the skb in any other way.8402*8403* When done, call cfg80211_testmode_reply() with the skb and return8404* its error code as the result of the @testmode_cmd operation.8405*8406* Return: An allocated and pre-filled skb. %NULL if any errors happen.8407*/8408static inline struct sk_buff *8409cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)8410{8411return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,8412NL80211_ATTR_TESTDATA, approxlen);8413}84148415/**8416* cfg80211_testmode_reply - send the reply skb8417* @skb: The skb, must have been allocated with8418* cfg80211_testmode_alloc_reply_skb()8419*8420* Since calling this function will usually be the last thing8421* before returning from the @testmode_cmd you should return8422* the error code. Note that this function consumes the skb8423* regardless of the return value.8424*8425* Return: An error code or 0 on success.8426*/8427static inline int cfg80211_testmode_reply(struct sk_buff *skb)8428{8429return cfg80211_vendor_cmd_reply(skb);8430}84318432/**8433* cfg80211_testmode_alloc_event_skb - allocate testmode event8434* @wiphy: the wiphy8435* @approxlen: an upper bound of the length of the data that will8436* be put into the skb8437* @gfp: allocation flags8438*8439* This function allocates and pre-fills an skb for an event on the8440* testmode multicast group.8441*8442* The returned skb is set up in the same way as with8443* cfg80211_testmode_alloc_reply_skb() but prepared for an event. As8444* there, you should simply add data to it that will then end up in the8445* %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb8446* in any other way.8447*8448* When done filling the skb, call cfg80211_testmode_event() with the8449* skb to send the event.8450*8451* Return: An allocated and pre-filled skb. %NULL if any errors happen.8452*/8453static inline struct sk_buff *8454cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)8455{8456return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,8457NL80211_ATTR_TESTDATA, 0, -1,8458approxlen, gfp);8459}84608461/**8462* cfg80211_testmode_event - send the event8463* @skb: The skb, must have been allocated with8464* cfg80211_testmode_alloc_event_skb()8465* @gfp: allocation flags8466*8467* This function sends the given @skb, which must have been allocated8468* by cfg80211_testmode_alloc_event_skb(), as an event. It always8469* consumes it.8470*/8471static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)8472{8473__cfg80211_send_event_skb(skb, gfp);8474}84758476#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),8477#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),8478#else8479#define CFG80211_TESTMODE_CMD(cmd)8480#define CFG80211_TESTMODE_DUMP(cmd)8481#endif84828483/**8484* struct cfg80211_fils_resp_params - FILS connection response params8485* @kek: KEK derived from a successful FILS connection (may be %NULL)8486* @kek_len: Length of @fils_kek in octets8487* @update_erp_next_seq_num: Boolean value to specify whether the value in8488* @erp_next_seq_num is valid.8489* @erp_next_seq_num: The next sequence number to use in ERP message in8490* FILS Authentication. This value should be specified irrespective of the8491* status for a FILS connection.8492* @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).8493* @pmk_len: Length of @pmk in octets8494* @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID8495* used for this FILS connection (may be %NULL).8496*/8497struct cfg80211_fils_resp_params {8498const u8 *kek;8499size_t kek_len;8500bool update_erp_next_seq_num;8501u16 erp_next_seq_num;8502const u8 *pmk;8503size_t pmk_len;8504const u8 *pmkid;8505};85068507/**8508* struct cfg80211_connect_resp_params - Connection response params8509* @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use8510* %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you8511* the real status code for failures. If this call is used to report a8512* failure due to a timeout (e.g., not receiving an Authentication frame8513* from the AP) instead of an explicit rejection by the AP, -1 is used to8514* indicate that this is a failure, but without a status code.8515* @timeout_reason is used to report the reason for the timeout in that8516* case.8517* @req_ie: Association request IEs (may be %NULL)8518* @req_ie_len: Association request IEs length8519* @resp_ie: Association response IEs (may be %NULL)8520* @resp_ie_len: Association response IEs length8521* @fils: FILS connection response parameters.8522* @timeout_reason: Reason for connection timeout. This is used when the8523* connection fails due to a timeout instead of an explicit rejection from8524* the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is8525* not known. This value is used only if @status < 0 to indicate that the8526* failure is due to a timeout and not due to explicit rejection by the AP.8527* This value is ignored in other cases (@status >= 0).8528* @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise8529* zero.8530* @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.8531* @links : For MLO connection, contains link info for the valid links indicated8532* using @valid_links. For non-MLO connection, links[0] contains the8533* connected AP info.8534* @links.addr: For MLO connection, MAC address of the STA link. Otherwise8535* %NULL.8536* @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO8537* connection, links[0].bssid points to the BSSID of the AP (may be %NULL).8538* @links.bss: For MLO connection, entry of bss to which STA link is connected.8539* For non-MLO connection, links[0].bss points to entry of bss to which STA8540* is connected. It can be obtained through cfg80211_get_bss() (may be8541* %NULL). It is recommended to store the bss from the connect_request and8542* hold a reference to it and return through this param to avoid a warning8543* if the bss is expired during the connection, esp. for those drivers8544* implementing connect op. Only one parameter among @bssid and @bss needs8545* to be specified.8546* @links.status: per-link status code, to report a status code that's not8547* %WLAN_STATUS_SUCCESS for a given link, it must also be in the8548* @valid_links bitmap and may have a BSS pointer (which is then released)8549*/8550struct cfg80211_connect_resp_params {8551int status;8552const u8 *req_ie;8553size_t req_ie_len;8554const u8 *resp_ie;8555size_t resp_ie_len;8556struct cfg80211_fils_resp_params fils;8557enum nl80211_timeout_reason timeout_reason;85588559const u8 *ap_mld_addr;8560u16 valid_links;8561struct {8562const u8 *addr;8563const u8 *bssid;8564struct cfg80211_bss *bss;8565u16 status;8566} links[IEEE80211_MLD_MAX_NUM_LINKS];8567};85688569/**8570* cfg80211_connect_done - notify cfg80211 of connection result8571*8572* @dev: network device8573* @params: connection response parameters8574* @gfp: allocation flags8575*8576* It should be called by the underlying driver once execution of the connection8577* request from connect() has been completed. This is similar to8578* cfg80211_connect_bss(), but takes a structure pointer for connection response8579* parameters. Only one of the functions among cfg80211_connect_bss(),8580* cfg80211_connect_result(), cfg80211_connect_timeout(),8581* and cfg80211_connect_done() should be called.8582*/8583void cfg80211_connect_done(struct net_device *dev,8584struct cfg80211_connect_resp_params *params,8585gfp_t gfp);85868587/**8588* cfg80211_connect_bss - notify cfg80211 of connection result8589*8590* @dev: network device8591* @bssid: the BSSID of the AP8592* @bss: Entry of bss to which STA got connected to, can be obtained through8593* cfg80211_get_bss() (may be %NULL). But it is recommended to store the8594* bss from the connect_request and hold a reference to it and return8595* through this param to avoid a warning if the bss is expired during the8596* connection, esp. for those drivers implementing connect op.8597* Only one parameter among @bssid and @bss needs to be specified.8598* @req_ie: association request IEs (maybe be %NULL)8599* @req_ie_len: association request IEs length8600* @resp_ie: association response IEs (may be %NULL)8601* @resp_ie_len: assoc response IEs length8602* @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use8603* %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you8604* the real status code for failures. If this call is used to report a8605* failure due to a timeout (e.g., not receiving an Authentication frame8606* from the AP) instead of an explicit rejection by the AP, -1 is used to8607* indicate that this is a failure, but without a status code.8608* @timeout_reason is used to report the reason for the timeout in that8609* case.8610* @gfp: allocation flags8611* @timeout_reason: reason for connection timeout. This is used when the8612* connection fails due to a timeout instead of an explicit rejection from8613* the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is8614* not known. This value is used only if @status < 0 to indicate that the8615* failure is due to a timeout and not due to explicit rejection by the AP.8616* This value is ignored in other cases (@status >= 0).8617*8618* It should be called by the underlying driver once execution of the connection8619* request from connect() has been completed. This is similar to8620* cfg80211_connect_result(), but with the option of identifying the exact bss8621* entry for the connection. Only one of the functions among8622* cfg80211_connect_bss(), cfg80211_connect_result(),8623* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8624*/8625static inline void8626cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,8627struct cfg80211_bss *bss, const u8 *req_ie,8628size_t req_ie_len, const u8 *resp_ie,8629size_t resp_ie_len, int status, gfp_t gfp,8630enum nl80211_timeout_reason timeout_reason)8631{8632struct cfg80211_connect_resp_params params;86338634memset(¶ms, 0, sizeof(params));8635params.status = status;8636params.links[0].bssid = bssid;8637params.links[0].bss = bss;8638params.req_ie = req_ie;8639params.req_ie_len = req_ie_len;8640params.resp_ie = resp_ie;8641params.resp_ie_len = resp_ie_len;8642params.timeout_reason = timeout_reason;86438644cfg80211_connect_done(dev, ¶ms, gfp);8645}86468647/**8648* cfg80211_connect_result - notify cfg80211 of connection result8649*8650* @dev: network device8651* @bssid: the BSSID of the AP8652* @req_ie: association request IEs (maybe be %NULL)8653* @req_ie_len: association request IEs length8654* @resp_ie: association response IEs (may be %NULL)8655* @resp_ie_len: assoc response IEs length8656* @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use8657* %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you8658* the real status code for failures.8659* @gfp: allocation flags8660*8661* It should be called by the underlying driver once execution of the connection8662* request from connect() has been completed. This is similar to8663* cfg80211_connect_bss() which allows the exact bss entry to be specified. Only8664* one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),8665* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8666*/8667static inline void8668cfg80211_connect_result(struct net_device *dev, const u8 *bssid,8669const u8 *req_ie, size_t req_ie_len,8670const u8 *resp_ie, size_t resp_ie_len,8671u16 status, gfp_t gfp)8672{8673cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,8674resp_ie_len, status, gfp,8675NL80211_TIMEOUT_UNSPECIFIED);8676}86778678/**8679* cfg80211_connect_timeout - notify cfg80211 of connection timeout8680*8681* @dev: network device8682* @bssid: the BSSID of the AP8683* @req_ie: association request IEs (maybe be %NULL)8684* @req_ie_len: association request IEs length8685* @gfp: allocation flags8686* @timeout_reason: reason for connection timeout.8687*8688* It should be called by the underlying driver whenever connect() has failed8689* in a sequence where no explicit authentication/association rejection was8690* received from the AP. This could happen, e.g., due to not being able to send8691* out the Authentication or Association Request frame or timing out while8692* waiting for the response. Only one of the functions among8693* cfg80211_connect_bss(), cfg80211_connect_result(),8694* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8695*/8696static inline void8697cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,8698const u8 *req_ie, size_t req_ie_len, gfp_t gfp,8699enum nl80211_timeout_reason timeout_reason)8700{8701cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,8702gfp, timeout_reason);8703}87048705/**8706* struct cfg80211_roam_info - driver initiated roaming information8707*8708* @req_ie: association request IEs (maybe be %NULL)8709* @req_ie_len: association request IEs length8710* @resp_ie: association response IEs (may be %NULL)8711* @resp_ie_len: assoc response IEs length8712* @fils: FILS related roaming information.8713* @valid_links: For MLO roaming, BIT mask of the new valid links is set.8714* Otherwise zero.8715* @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.8716* @links : For MLO roaming, contains new link info for the valid links set in8717* @valid_links. For non-MLO roaming, links[0] contains the new AP info.8718* @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.8719* @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO8720* roaming, links[0].bssid points to the BSSID of the new AP. May be8721* %NULL if %links.bss is set.8722* @links.channel: the channel of the new AP.8723* @links.bss: For MLO roaming, entry of new bss to which STA link got8724* roamed. For non-MLO roaming, links[0].bss points to entry of bss to8725* which STA got roamed (may be %NULL if %links.bssid is set)8726*/8727struct cfg80211_roam_info {8728const u8 *req_ie;8729size_t req_ie_len;8730const u8 *resp_ie;8731size_t resp_ie_len;8732struct cfg80211_fils_resp_params fils;87338734const u8 *ap_mld_addr;8735u16 valid_links;8736struct {8737const u8 *addr;8738const u8 *bssid;8739struct ieee80211_channel *channel;8740struct cfg80211_bss *bss;8741} links[IEEE80211_MLD_MAX_NUM_LINKS];8742};87438744/**8745* cfg80211_roamed - notify cfg80211 of roaming8746*8747* @dev: network device8748* @info: information about the new BSS. struct &cfg80211_roam_info.8749* @gfp: allocation flags8750*8751* This function may be called with the driver passing either the BSSID of the8752* new AP or passing the bss entry to avoid a race in timeout of the bss entry.8753* It should be called by the underlying driver whenever it roamed from one AP8754* to another while connected. Drivers which have roaming implemented in8755* firmware should pass the bss entry to avoid a race in bss entry timeout where8756* the bss entry of the new AP is seen in the driver, but gets timed out by the8757* time it is accessed in __cfg80211_roamed() due to delay in scheduling8758* rdev->event_work. In case of any failures, the reference is released8759* either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be8760* released while disconnecting from the current bss.8761*/8762void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,8763gfp_t gfp);87648765/**8766* cfg80211_port_authorized - notify cfg80211 of successful security association8767*8768* @dev: network device8769* @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address8770* in case of AP/P2P GO8771* @td_bitmap: transition disable policy8772* @td_bitmap_len: Length of transition disable policy8773* @gfp: allocation flags8774*8775* This function should be called by a driver that supports 4 way handshake8776* offload after a security association was successfully established (i.e.,8777* the 4 way handshake was completed successfully). The call to this function8778* should be preceded with a call to cfg80211_connect_result(),8779* cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to8780* indicate the 802.11 association.8781* This function can also be called by AP/P2P GO driver that supports8782* authentication offload. In this case the peer_mac passed is that of8783* associated STA/GC.8784*/8785void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr,8786const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);87878788/**8789* cfg80211_disconnected - notify cfg80211 that connection was dropped8790*8791* @dev: network device8792* @ie: information elements of the deauth/disassoc frame (may be %NULL)8793* @ie_len: length of IEs8794* @reason: reason code for the disconnection, set it to 0 if unknown8795* @locally_generated: disconnection was requested locally8796* @gfp: allocation flags8797*8798* After it calls this function, the driver should enter an idle state8799* and not try to connect to any AP any more.8800*/8801void cfg80211_disconnected(struct net_device *dev, u16 reason,8802const u8 *ie, size_t ie_len,8803bool locally_generated, gfp_t gfp);88048805/**8806* cfg80211_ready_on_channel - notification of remain_on_channel start8807* @wdev: wireless device8808* @cookie: the request cookie8809* @chan: The current channel (from remain_on_channel request)8810* @duration: Duration in milliseconds that the driver intents to remain on the8811* channel8812* @gfp: allocation flags8813*/8814void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,8815struct ieee80211_channel *chan,8816unsigned int duration, gfp_t gfp);88178818/**8819* cfg80211_remain_on_channel_expired - remain_on_channel duration expired8820* @wdev: wireless device8821* @cookie: the request cookie8822* @chan: The current channel (from remain_on_channel request)8823* @gfp: allocation flags8824*/8825void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,8826struct ieee80211_channel *chan,8827gfp_t gfp);88288829/**8830* cfg80211_tx_mgmt_expired - tx_mgmt duration expired8831* @wdev: wireless device8832* @cookie: the requested cookie8833* @chan: The current channel (from tx_mgmt request)8834* @gfp: allocation flags8835*/8836void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,8837struct ieee80211_channel *chan, gfp_t gfp);88388839/**8840* cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.8841*8842* @sinfo: the station information8843* @gfp: allocation flags8844*8845* Return: 0 on success. Non-zero on error.8846*/8847int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);88488849/**8850* cfg80211_link_sinfo_alloc_tid_stats - allocate per-tid statistics.8851*8852* @link_sinfo: the link station information8853* @gfp: allocation flags8854*8855* Return: 0 on success. Non-zero on error.8856*/8857int cfg80211_link_sinfo_alloc_tid_stats(struct link_station_info *link_sinfo,8858gfp_t gfp);88598860/**8861* cfg80211_sinfo_release_content - release contents of station info8862* @sinfo: the station information8863*8864* Releases any potentially allocated sub-information of the station8865* information, but not the struct itself (since it's typically on8866* the stack.)8867*/8868static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)8869{8870kfree(sinfo->pertid);88718872for (int link_id = 0; link_id < ARRAY_SIZE(sinfo->links); link_id++) {8873if (sinfo->links[link_id]) {8874kfree(sinfo->links[link_id]->pertid);8875kfree(sinfo->links[link_id]);8876}8877}8878}88798880/**8881* cfg80211_new_sta - notify userspace about station8882*8883* @dev: the netdev8884* @mac_addr: the station's address8885* @sinfo: the station information8886* @gfp: allocation flags8887*/8888void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,8889struct station_info *sinfo, gfp_t gfp);88908891/**8892* cfg80211_del_sta_sinfo - notify userspace about deletion of a station8893* @dev: the netdev8894* @mac_addr: the station's address. For MLD station, MLD address is used.8895* @sinfo: the station information/statistics8896* @gfp: allocation flags8897*/8898void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,8899struct station_info *sinfo, gfp_t gfp);89008901/**8902* cfg80211_del_sta - notify userspace about deletion of a station8903*8904* @dev: the netdev8905* @mac_addr: the station's address. For MLD station, MLD address is used.8906* @gfp: allocation flags8907*/8908static inline void cfg80211_del_sta(struct net_device *dev,8909const u8 *mac_addr, gfp_t gfp)8910{8911cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);8912}89138914/**8915* cfg80211_conn_failed - connection request failed notification8916*8917* @dev: the netdev8918* @mac_addr: the station's address8919* @reason: the reason for connection failure8920* @gfp: allocation flags8921*8922* Whenever a station tries to connect to an AP and if the station8923* could not connect to the AP as the AP has rejected the connection8924* for some reasons, this function is called.8925*8926* The reason for connection failure can be any of the value from8927* nl80211_connect_failed_reason enum8928*/8929void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,8930enum nl80211_connect_failed_reason reason,8931gfp_t gfp);89328933/**8934* struct cfg80211_rx_info - received management frame info8935*8936* @freq: Frequency on which the frame was received in kHz8937* @sig_dbm: signal strength in dBm, or 0 if unknown8938* @have_link_id: indicates the frame was received on a link of8939* an MLD, i.e. the @link_id field is valid8940* @link_id: the ID of the link the frame was received on8941* @buf: Management frame (header + body)8942* @len: length of the frame data8943* @flags: flags, as defined in &enum nl80211_rxmgmt_flags8944* @rx_tstamp: Hardware timestamp of frame RX in nanoseconds8945* @ack_tstamp: Hardware timestamp of ack TX in nanoseconds8946*/8947struct cfg80211_rx_info {8948int freq;8949int sig_dbm;8950bool have_link_id;8951u8 link_id;8952const u8 *buf;8953size_t len;8954u32 flags;8955u64 rx_tstamp;8956u64 ack_tstamp;8957};89588959/**8960* cfg80211_rx_mgmt_ext - management frame notification with extended info8961* @wdev: wireless device receiving the frame8962* @info: RX info as defined in struct cfg80211_rx_info8963*8964* This function is called whenever an Action frame is received for a station8965* mode interface, but is not processed in kernel.8966*8967* Return: %true if a user space application has registered for this frame.8968* For action frames, that makes it responsible for rejecting unrecognized8969* action frames; %false otherwise, in which case for action frames the8970* driver is responsible for rejecting the frame.8971*/8972bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,8973struct cfg80211_rx_info *info);89748975/**8976* cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame8977* @wdev: wireless device receiving the frame8978* @freq: Frequency on which the frame was received in KHz8979* @sig_dbm: signal strength in dBm, or 0 if unknown8980* @buf: Management frame (header + body)8981* @len: length of the frame data8982* @flags: flags, as defined in enum nl80211_rxmgmt_flags8983*8984* This function is called whenever an Action frame is received for a station8985* mode interface, but is not processed in kernel.8986*8987* Return: %true if a user space application has registered for this frame.8988* For action frames, that makes it responsible for rejecting unrecognized8989* action frames; %false otherwise, in which case for action frames the8990* driver is responsible for rejecting the frame.8991*/8992static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,8993int sig_dbm, const u8 *buf, size_t len,8994u32 flags)8995{8996struct cfg80211_rx_info info = {8997.freq = freq,8998.sig_dbm = sig_dbm,8999.buf = buf,9000.len = len,9001.flags = flags9002};90039004return cfg80211_rx_mgmt_ext(wdev, &info);9005}90069007/**9008* cfg80211_rx_mgmt - notification of received, unprocessed management frame9009* @wdev: wireless device receiving the frame9010* @freq: Frequency on which the frame was received in MHz9011* @sig_dbm: signal strength in dBm, or 0 if unknown9012* @buf: Management frame (header + body)9013* @len: length of the frame data9014* @flags: flags, as defined in enum nl80211_rxmgmt_flags9015*9016* This function is called whenever an Action frame is received for a station9017* mode interface, but is not processed in kernel.9018*9019* Return: %true if a user space application has registered for this frame.9020* For action frames, that makes it responsible for rejecting unrecognized9021* action frames; %false otherwise, in which case for action frames the9022* driver is responsible for rejecting the frame.9023*/9024static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,9025int sig_dbm, const u8 *buf, size_t len,9026u32 flags)9027{9028struct cfg80211_rx_info info = {9029.freq = MHZ_TO_KHZ(freq),9030.sig_dbm = sig_dbm,9031.buf = buf,9032.len = len,9033.flags = flags9034};90359036return cfg80211_rx_mgmt_ext(wdev, &info);9037}90389039/**9040* struct cfg80211_tx_status - TX status for management frame information9041*9042* @cookie: Cookie returned by cfg80211_ops::mgmt_tx()9043* @tx_tstamp: hardware TX timestamp in nanoseconds9044* @ack_tstamp: hardware ack RX timestamp in nanoseconds9045* @buf: Management frame (header + body)9046* @len: length of the frame data9047* @ack: Whether frame was acknowledged9048*/9049struct cfg80211_tx_status {9050u64 cookie;9051u64 tx_tstamp;9052u64 ack_tstamp;9053const u8 *buf;9054size_t len;9055bool ack;9056};90579058/**9059* cfg80211_mgmt_tx_status_ext - TX status notification with extended info9060* @wdev: wireless device receiving the frame9061* @status: TX status data9062* @gfp: context flags9063*9064* This function is called whenever a management frame was requested to be9065* transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the9066* transmission attempt with extended info.9067*/9068void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,9069struct cfg80211_tx_status *status, gfp_t gfp);90709071/**9072* cfg80211_mgmt_tx_status - notification of TX status for management frame9073* @wdev: wireless device receiving the frame9074* @cookie: Cookie returned by cfg80211_ops::mgmt_tx()9075* @buf: Management frame (header + body)9076* @len: length of the frame data9077* @ack: Whether frame was acknowledged9078* @gfp: context flags9079*9080* This function is called whenever a management frame was requested to be9081* transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the9082* transmission attempt.9083*/9084static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,9085u64 cookie, const u8 *buf,9086size_t len, bool ack, gfp_t gfp)9087{9088struct cfg80211_tx_status status = {9089.cookie = cookie,9090.buf = buf,9091.len = len,9092.ack = ack9093};90949095cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);9096}90979098/**9099* cfg80211_control_port_tx_status - notification of TX status for control9100* port frames9101* @wdev: wireless device receiving the frame9102* @cookie: Cookie returned by cfg80211_ops::tx_control_port()9103* @buf: Data frame (header + body)9104* @len: length of the frame data9105* @ack: Whether frame was acknowledged9106* @gfp: context flags9107*9108* This function is called whenever a control port frame was requested to be9109* transmitted with cfg80211_ops::tx_control_port() to report the TX status of9110* the transmission attempt.9111*/9112void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,9113const u8 *buf, size_t len, bool ack,9114gfp_t gfp);91159116/**9117* cfg80211_rx_control_port - notification about a received control port frame9118* @dev: The device the frame matched to9119* @skb: The skbuf with the control port frame. It is assumed that the skbuf9120* is 802.3 formatted (with 802.3 header). The skb can be non-linear.9121* This function does not take ownership of the skb, so the caller is9122* responsible for any cleanup. The caller must also ensure that9123* skb->protocol is set appropriately.9124* @unencrypted: Whether the frame was received unencrypted9125* @link_id: the link the frame was received on, -1 if not applicable or unknown9126*9127* This function is used to inform userspace about a received control port9128* frame. It should only be used if userspace indicated it wants to receive9129* control port frames over nl80211.9130*9131* The frame is the data portion of the 802.3 or 802.11 data frame with all9132* network layer headers removed (e.g. the raw EAPoL frame).9133*9134* Return: %true if the frame was passed to userspace9135*/9136bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,9137bool unencrypted, int link_id);91389139/**9140* cfg80211_cqm_rssi_notify - connection quality monitoring rssi event9141* @dev: network device9142* @rssi_event: the triggered RSSI event9143* @rssi_level: new RSSI level value or 0 if not available9144* @gfp: context flags9145*9146* This function is called when a configured connection quality monitoring9147* rssi threshold reached event occurs.9148*/9149void cfg80211_cqm_rssi_notify(struct net_device *dev,9150enum nl80211_cqm_rssi_threshold_event rssi_event,9151s32 rssi_level, gfp_t gfp);91529153/**9154* cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer9155* @dev: network device9156* @peer: peer's MAC address9157* @num_packets: how many packets were lost -- should be a fixed threshold9158* but probably no less than maybe 50, or maybe a throughput dependent9159* threshold (to account for temporary interference)9160* @gfp: context flags9161*/9162void cfg80211_cqm_pktloss_notify(struct net_device *dev,9163const u8 *peer, u32 num_packets, gfp_t gfp);91649165/**9166* cfg80211_cqm_txe_notify - TX error rate event9167* @dev: network device9168* @peer: peer's MAC address9169* @num_packets: how many packets were lost9170* @rate: % of packets which failed transmission9171* @intvl: interval (in s) over which the TX failure threshold was breached.9172* @gfp: context flags9173*9174* Notify userspace when configured % TX failures over number of packets in a9175* given interval is exceeded.9176*/9177void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,9178u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);91799180/**9181* cfg80211_cqm_beacon_loss_notify - beacon loss event9182* @dev: network device9183* @gfp: context flags9184*9185* Notify userspace about beacon loss from the connected AP.9186*/9187void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);91889189/**9190* __cfg80211_radar_event - radar detection event9191* @wiphy: the wiphy9192* @chandef: chandef for the current channel9193* @offchan: the radar has been detected on the offchannel chain9194* @gfp: context flags9195*9196* This function is called when a radar is detected on the current chanenl.9197*/9198void __cfg80211_radar_event(struct wiphy *wiphy,9199struct cfg80211_chan_def *chandef,9200bool offchan, gfp_t gfp);92019202static inline void9203cfg80211_radar_event(struct wiphy *wiphy,9204struct cfg80211_chan_def *chandef,9205gfp_t gfp)9206{9207__cfg80211_radar_event(wiphy, chandef, false, gfp);9208}92099210static inline void9211cfg80211_background_radar_event(struct wiphy *wiphy,9212struct cfg80211_chan_def *chandef,9213gfp_t gfp)9214{9215__cfg80211_radar_event(wiphy, chandef, true, gfp);9216}92179218/**9219* cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event9220* @dev: network device9221* @mac: MAC address of a station which opmode got modified9222* @sta_opmode: station's current opmode value9223* @gfp: context flags9224*9225* Driver should call this function when station's opmode modified via action9226* frame.9227*/9228void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,9229struct sta_opmode_info *sta_opmode,9230gfp_t gfp);92319232/**9233* cfg80211_cac_event - Channel availability check (CAC) event9234* @netdev: network device9235* @chandef: chandef for the current channel9236* @event: type of event9237* @gfp: context flags9238* @link_id: valid link_id for MLO operation or 0 otherwise.9239*9240* This function is called when a Channel availability check (CAC) is finished9241* or aborted. This must be called to notify the completion of a CAC process,9242* also by full-MAC drivers.9243*/9244void cfg80211_cac_event(struct net_device *netdev,9245const struct cfg80211_chan_def *chandef,9246enum nl80211_radar_event event, gfp_t gfp,9247unsigned int link_id);92489249/**9250* cfg80211_background_cac_abort - Channel Availability Check offchan abort event9251* @wiphy: the wiphy9252*9253* This function is called by the driver when a Channel Availability Check9254* (CAC) is aborted by a offchannel dedicated chain.9255*/9256void cfg80211_background_cac_abort(struct wiphy *wiphy);92579258/**9259* cfg80211_gtk_rekey_notify - notify userspace about driver rekeying9260* @dev: network device9261* @bssid: BSSID of AP (to avoid races)9262* @replay_ctr: new replay counter9263* @gfp: allocation flags9264*/9265void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,9266const u8 *replay_ctr, gfp_t gfp);92679268/**9269* cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate9270* @dev: network device9271* @index: candidate index (the smaller the index, the higher the priority)9272* @bssid: BSSID of AP9273* @preauth: Whether AP advertises support for RSN pre-authentication9274* @gfp: allocation flags9275*/9276void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,9277const u8 *bssid, bool preauth, gfp_t gfp);92789279/**9280* cfg80211_rx_spurious_frame - inform userspace about a spurious frame9281* @dev: The device the frame matched to9282* @link_id: the link the frame was received on, -1 if not applicable or unknown9283* @addr: the transmitter address9284* @gfp: context flags9285*9286* This function is used in AP mode (only!) to inform userspace that9287* a spurious class 3 frame was received, to be able to deauth the9288* sender.9289* Return: %true if the frame was passed to userspace (or this failed9290* for a reason other than not having a subscription.)9291*/9292bool cfg80211_rx_spurious_frame(struct net_device *dev, const u8 *addr,9293int link_id, gfp_t gfp);92949295/**9296* cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame9297* @dev: The device the frame matched to9298* @addr: the transmitter address9299* @link_id: the link the frame was received on, -1 if not applicable or unknown9300* @gfp: context flags9301*9302* This function is used in AP mode (only!) to inform userspace that9303* an associated station sent a 4addr frame but that wasn't expected.9304* It is allowed and desirable to send this event only once for each9305* station to avoid event flooding.9306* Return: %true if the frame was passed to userspace (or this failed9307* for a reason other than not having a subscription.)9308*/9309bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, const u8 *addr,9310int link_id, gfp_t gfp);93119312/**9313* cfg80211_probe_status - notify userspace about probe status9314* @dev: the device the probe was sent on9315* @addr: the address of the peer9316* @cookie: the cookie filled in @probe_client previously9317* @acked: indicates whether probe was acked or not9318* @ack_signal: signal strength (in dBm) of the ACK frame.9319* @is_valid_ack_signal: indicates the ack_signal is valid or not.9320* @gfp: allocation flags9321*/9322void cfg80211_probe_status(struct net_device *dev, const u8 *addr,9323u64 cookie, bool acked, s32 ack_signal,9324bool is_valid_ack_signal, gfp_t gfp);93259326/**9327* cfg80211_report_obss_beacon_khz - report beacon from other APs9328* @wiphy: The wiphy that received the beacon9329* @frame: the frame9330* @len: length of the frame9331* @freq: frequency the frame was received on in KHz9332* @sig_dbm: signal strength in dBm, or 0 if unknown9333*9334* Use this function to report to userspace when a beacon was9335* received. It is not useful to call this when there is no9336* netdev that is in AP/GO mode.9337*/9338void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,9339size_t len, int freq, int sig_dbm);93409341/**9342* cfg80211_report_obss_beacon - report beacon from other APs9343* @wiphy: The wiphy that received the beacon9344* @frame: the frame9345* @len: length of the frame9346* @freq: frequency the frame was received on9347* @sig_dbm: signal strength in dBm, or 0 if unknown9348*9349* Use this function to report to userspace when a beacon was9350* received. It is not useful to call this when there is no9351* netdev that is in AP/GO mode.9352*/9353static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,9354const u8 *frame, size_t len,9355int freq, int sig_dbm)9356{9357cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),9358sig_dbm);9359}93609361/**9362* struct cfg80211_beaconing_check_config - beacon check configuration9363* @iftype: the interface type to check for9364* @relax: allow IR-relaxation conditions to apply (e.g. another9365* interface connected already on the same channel)9366* NOTE: If this is set, wiphy mutex must be held.9367* @reg_power: &enum ieee80211_ap_reg_power value indicating the9368* advertised/used 6 GHz regulatory power setting9369*/9370struct cfg80211_beaconing_check_config {9371enum nl80211_iftype iftype;9372enum ieee80211_ap_reg_power reg_power;9373bool relax;9374};93759376/**9377* cfg80211_reg_check_beaconing - check if beaconing is allowed9378* @wiphy: the wiphy9379* @chandef: the channel definition9380* @cfg: additional parameters for the checking9381*9382* Return: %true if there is no secondary channel or the secondary channel(s)9383* can be used for beaconing (i.e. is not a radar channel etc.)9384*/9385bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,9386struct cfg80211_chan_def *chandef,9387struct cfg80211_beaconing_check_config *cfg);93889389/**9390* cfg80211_reg_can_beacon - check if beaconing is allowed9391* @wiphy: the wiphy9392* @chandef: the channel definition9393* @iftype: interface type9394*9395* Return: %true if there is no secondary channel or the secondary channel(s)9396* can be used for beaconing (i.e. is not a radar channel etc.)9397*/9398static inline bool9399cfg80211_reg_can_beacon(struct wiphy *wiphy,9400struct cfg80211_chan_def *chandef,9401enum nl80211_iftype iftype)9402{9403struct cfg80211_beaconing_check_config config = {9404.iftype = iftype,9405};94069407return cfg80211_reg_check_beaconing(wiphy, chandef, &config);9408}94099410/**9411* cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation9412* @wiphy: the wiphy9413* @chandef: the channel definition9414* @iftype: interface type9415*9416* Return: %true if there is no secondary channel or the secondary channel(s)9417* can be used for beaconing (i.e. is not a radar channel etc.). This version9418* also checks if IR-relaxation conditions apply, to allow beaconing under9419* more permissive conditions.9420*9421* Context: Requires the wiphy mutex to be held.9422*/9423static inline bool9424cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,9425struct cfg80211_chan_def *chandef,9426enum nl80211_iftype iftype)9427{9428struct cfg80211_beaconing_check_config config = {9429.iftype = iftype,9430.relax = true,9431};94329433return cfg80211_reg_check_beaconing(wiphy, chandef, &config);9434}94359436/**9437* cfg80211_ch_switch_notify - update wdev channel and notify userspace9438* @dev: the device which switched channels9439* @chandef: the new channel definition9440* @link_id: the link ID for MLO, must be 0 for non-MLO9441*9442* Caller must hold wiphy mutex, therefore must only be called from sleepable9443* driver context!9444*/9445void cfg80211_ch_switch_notify(struct net_device *dev,9446struct cfg80211_chan_def *chandef,9447unsigned int link_id);94489449/**9450* cfg80211_ch_switch_started_notify - notify channel switch start9451* @dev: the device on which the channel switch started9452* @chandef: the future channel definition9453* @link_id: the link ID for MLO, must be 0 for non-MLO9454* @count: the number of TBTTs until the channel switch happens9455* @quiet: whether or not immediate quiet was requested by the AP9456*9457* Inform the userspace about the channel switch that has just9458* started, so that it can take appropriate actions (eg. starting9459* channel switch on other vifs), if necessary.9460*/9461void cfg80211_ch_switch_started_notify(struct net_device *dev,9462struct cfg80211_chan_def *chandef,9463unsigned int link_id, u8 count,9464bool quiet);94659466/**9467* ieee80211_operating_class_to_band - convert operating class to band9468*9469* @operating_class: the operating class to convert9470* @band: band pointer to fill9471*9472* Return: %true if the conversion was successful, %false otherwise.9473*/9474bool ieee80211_operating_class_to_band(u8 operating_class,9475enum nl80211_band *band);94769477/**9478* ieee80211_operating_class_to_chandef - convert operating class to chandef9479*9480* @operating_class: the operating class to convert9481* @chan: the ieee80211_channel to convert9482* @chandef: a pointer to the resulting chandef9483*9484* Return: %true if the conversion was successful, %false otherwise.9485*/9486bool ieee80211_operating_class_to_chandef(u8 operating_class,9487struct ieee80211_channel *chan,9488struct cfg80211_chan_def *chandef);94899490/**9491* ieee80211_chandef_to_operating_class - convert chandef to operation class9492*9493* @chandef: the chandef to convert9494* @op_class: a pointer to the resulting operating class9495*9496* Return: %true if the conversion was successful, %false otherwise.9497*/9498bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,9499u8 *op_class);95009501/**9502* ieee80211_chandef_to_khz - convert chandef to frequency in KHz9503*9504* @chandef: the chandef to convert9505*9506* Return: the center frequency of chandef (1st segment) in KHz.9507*/9508static inline u329509ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)9510{9511return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;9512}95139514/**9515* cfg80211_tdls_oper_request - request userspace to perform TDLS operation9516* @dev: the device on which the operation is requested9517* @peer: the MAC address of the peer device9518* @oper: the requested TDLS operation (NL80211_TDLS_SETUP or9519* NL80211_TDLS_TEARDOWN)9520* @reason_code: the reason code for teardown request9521* @gfp: allocation flags9522*9523* This function is used to request userspace to perform TDLS operation that9524* requires knowledge of keys, i.e., link setup or teardown when the AP9525* connection uses encryption. This is optional mechanism for the driver to use9526* if it can automatically determine when a TDLS link could be useful (e.g.,9527* based on traffic and signal strength for a peer).9528*/9529void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,9530enum nl80211_tdls_operation oper,9531u16 reason_code, gfp_t gfp);95329533/**9534* cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)9535* @rate: given rate_info to calculate bitrate from9536*9537* Return: calculated bitrate9538*/9539u32 cfg80211_calculate_bitrate(struct rate_info *rate);95409541/**9542* cfg80211_unregister_wdev - remove the given wdev9543* @wdev: struct wireless_dev to remove9544*9545* This function removes the device so it can no longer be used. It is necessary9546* to call this function even when cfg80211 requests the removal of the device9547* by calling the del_virtual_intf() callback. The function must also be called9548* when the driver wishes to unregister the wdev, e.g. when the hardware device9549* is unbound from the driver.9550*9551* Context: Requires the RTNL and wiphy mutex to be held.9552*/9553void cfg80211_unregister_wdev(struct wireless_dev *wdev);95549555/**9556* cfg80211_register_netdevice - register the given netdev9557* @dev: the netdev to register9558*9559* Note: In contexts coming from cfg80211 callbacks, you must call this rather9560* than register_netdevice(), unregister_netdev() is impossible as the RTNL is9561* held. Otherwise, both register_netdevice() and register_netdev() are usable9562* instead as well.9563*9564* Context: Requires the RTNL and wiphy mutex to be held.9565*9566* Return: 0 on success. Non-zero on error.9567*/9568int cfg80211_register_netdevice(struct net_device *dev);95699570/**9571* cfg80211_unregister_netdevice - unregister the given netdev9572* @dev: the netdev to register9573*9574* Note: In contexts coming from cfg80211 callbacks, you must call this rather9575* than unregister_netdevice(), unregister_netdev() is impossible as the RTNL9576* is held. Otherwise, both unregister_netdevice() and unregister_netdev() are9577* usable instead as well.9578*9579* Context: Requires the RTNL and wiphy mutex to be held.9580*/9581static inline void cfg80211_unregister_netdevice(struct net_device *dev)9582{9583#if IS_ENABLED(CONFIG_CFG80211)9584cfg80211_unregister_wdev(dev->ieee80211_ptr);9585#endif9586}95879588/**9589* struct cfg80211_ft_event_params - FT Information Elements9590* @ies: FT IEs9591* @ies_len: length of the FT IE in bytes9592* @target_ap: target AP's MAC address9593* @ric_ies: RIC IE9594* @ric_ies_len: length of the RIC IE in bytes9595*/9596struct cfg80211_ft_event_params {9597const u8 *ies;9598size_t ies_len;9599const u8 *target_ap;9600const u8 *ric_ies;9601size_t ric_ies_len;9602};96039604/**9605* cfg80211_ft_event - notify userspace about FT IE and RIC IE9606* @netdev: network device9607* @ft_event: IE information9608*/9609void cfg80211_ft_event(struct net_device *netdev,9610struct cfg80211_ft_event_params *ft_event);96119612/**9613* cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer9614* @ies: the input IE buffer9615* @len: the input length9616* @attr: the attribute ID to find9617* @buf: output buffer, can be %NULL if the data isn't needed, e.g.9618* if the function is only called to get the needed buffer size9619* @bufsize: size of the output buffer9620*9621* The function finds a given P2P attribute in the (vendor) IEs and9622* copies its contents to the given buffer.9623*9624* Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is9625* malformed or the attribute can't be found (respectively), or the9626* length of the found attribute (which can be zero).9627*/9628int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,9629enum ieee80211_p2p_attr_id attr,9630u8 *buf, unsigned int bufsize);96319632/**9633* ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)9634* @ies: the IE buffer9635* @ielen: the length of the IE buffer9636* @ids: an array with element IDs that are allowed before9637* the split. A WLAN_EID_EXTENSION value means that the next9638* EID in the list is a sub-element of the EXTENSION IE.9639* @n_ids: the size of the element ID array9640* @after_ric: array IE types that come after the RIC element9641* @n_after_ric: size of the @after_ric array9642* @offset: offset where to start splitting in the buffer9643*9644* This function splits an IE buffer by updating the @offset9645* variable to point to the location where the buffer should be9646* split.9647*9648* It assumes that the given IE buffer is well-formed, this9649* has to be guaranteed by the caller!9650*9651* It also assumes that the IEs in the buffer are ordered9652* correctly, if not the result of using this function will not9653* be ordered correctly either, i.e. it does no reordering.9654*9655* Return: The offset where the next part of the buffer starts, which9656* may be @ielen if the entire (remainder) of the buffer should be9657* used.9658*/9659size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,9660const u8 *ids, int n_ids,9661const u8 *after_ric, int n_after_ric,9662size_t offset);96639664/**9665* ieee80211_ie_split - split an IE buffer according to ordering9666* @ies: the IE buffer9667* @ielen: the length of the IE buffer9668* @ids: an array with element IDs that are allowed before9669* the split. A WLAN_EID_EXTENSION value means that the next9670* EID in the list is a sub-element of the EXTENSION IE.9671* @n_ids: the size of the element ID array9672* @offset: offset where to start splitting in the buffer9673*9674* This function splits an IE buffer by updating the @offset9675* variable to point to the location where the buffer should be9676* split.9677*9678* It assumes that the given IE buffer is well-formed, this9679* has to be guaranteed by the caller!9680*9681* It also assumes that the IEs in the buffer are ordered9682* correctly, if not the result of using this function will not9683* be ordered correctly either, i.e. it does no reordering.9684*9685* Return: The offset where the next part of the buffer starts, which9686* may be @ielen if the entire (remainder) of the buffer should be9687* used.9688*/9689static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,9690const u8 *ids, int n_ids, size_t offset)9691{9692return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);9693}96949695/**9696* ieee80211_fragment_element - fragment the last element in skb9697* @skb: The skbuf that the element was added to9698* @len_pos: Pointer to length of the element to fragment9699* @frag_id: The element ID to use for fragments9700*9701* This function fragments all data after @len_pos, adding fragmentation9702* elements with the given ID as appropriate. The SKB will grow in size9703* accordingly.9704*/9705void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id);97069707/**9708* cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN9709* @wdev: the wireless device reporting the wakeup9710* @wakeup: the wakeup report9711* @gfp: allocation flags9712*9713* This function reports that the given device woke up. If it9714* caused the wakeup, report the reason(s), otherwise you may9715* pass %NULL as the @wakeup parameter to advertise that something9716* else caused the wakeup.9717*/9718void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,9719struct cfg80211_wowlan_wakeup *wakeup,9720gfp_t gfp);97219722/**9723* cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.9724*9725* @wdev: the wireless device for which critical protocol is stopped.9726* @gfp: allocation flags9727*9728* This function can be called by the driver to indicate it has reverted9729* operation back to normal. One reason could be that the duration given9730* by .crit_proto_start() has expired.9731*/9732void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);97339734/**9735* ieee80211_get_num_supported_channels - get number of channels device has9736* @wiphy: the wiphy9737*9738* Return: the number of channels supported by the device.9739*/9740unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);97419742/**9743* cfg80211_check_combinations - check interface combinations9744*9745* @wiphy: the wiphy9746* @params: the interface combinations parameter9747*9748* This function can be called by the driver to check whether a9749* combination of interfaces and their types are allowed according to9750* the interface combinations.9751*9752* Return: 0 if combinations are allowed. Non-zero on error.9753*/9754int cfg80211_check_combinations(struct wiphy *wiphy,9755struct iface_combination_params *params);97569757/**9758* cfg80211_iter_combinations - iterate over matching combinations9759*9760* @wiphy: the wiphy9761* @params: the interface combinations parameter9762* @iter: function to call for each matching combination9763* @data: pointer to pass to iter function9764*9765* This function can be called by the driver to check what possible9766* combinations it fits in at a given moment, e.g. for channel switching9767* purposes.9768*9769* Return: 0 on success. Non-zero on error.9770*/9771int cfg80211_iter_combinations(struct wiphy *wiphy,9772struct iface_combination_params *params,9773void (*iter)(const struct ieee80211_iface_combination *c,9774void *data),9775void *data);9776/**9777* cfg80211_get_radio_idx_by_chan - get the radio index by the channel9778*9779* @wiphy: the wiphy9780* @chan: channel for which the supported radio index is required9781*9782* Return: radio index on success or -EINVAL otherwise9783*/9784int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy,9785const struct ieee80211_channel *chan);978697879788/**9789* cfg80211_stop_iface - trigger interface disconnection9790*9791* @wiphy: the wiphy9792* @wdev: wireless device9793* @gfp: context flags9794*9795* Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA9796* disconnected.9797*9798* Note: This doesn't need any locks and is asynchronous.9799*/9800void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,9801gfp_t gfp);98029803/**9804* cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy9805* @wiphy: the wiphy to shut down9806*9807* This function shuts down all interfaces belonging to this wiphy by9808* calling dev_close() (and treating non-netdev interfaces as needed).9809* It shouldn't really be used unless there are some fatal device errors9810* that really can't be recovered in any other way.9811*9812* Callers must hold the RTNL and be able to deal with callbacks into9813* the driver while the function is running.9814*/9815void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);98169817/**9818* wiphy_ext_feature_set - set the extended feature flag9819*9820* @wiphy: the wiphy to modify.9821* @ftidx: extended feature bit index.9822*9823* The extended features are flagged in multiple bytes (see9824* &struct wiphy.@ext_features)9825*/9826static inline void wiphy_ext_feature_set(struct wiphy *wiphy,9827enum nl80211_ext_feature_index ftidx)9828{9829u8 *ft_byte;98309831ft_byte = &wiphy->ext_features[ftidx / 8];9832*ft_byte |= BIT(ftidx % 8);9833}98349835/**9836* wiphy_ext_feature_isset - check the extended feature flag9837*9838* @wiphy: the wiphy to modify.9839* @ftidx: extended feature bit index.9840*9841* The extended features are flagged in multiple bytes (see9842* &struct wiphy.@ext_features)9843*9844* Return: %true if extended feature flag is set, %false otherwise9845*/9846static inline bool9847wiphy_ext_feature_isset(struct wiphy *wiphy,9848enum nl80211_ext_feature_index ftidx)9849{9850u8 ft_byte;98519852ft_byte = wiphy->ext_features[ftidx / 8];9853return (ft_byte & BIT(ftidx % 8)) != 0;9854}98559856/**9857* cfg80211_free_nan_func - free NAN function9858* @f: NAN function that should be freed9859*9860* Frees all the NAN function and all it's allocated members.9861*/9862void cfg80211_free_nan_func(struct cfg80211_nan_func *f);98639864/**9865* struct cfg80211_nan_match_params - NAN match parameters9866* @type: the type of the function that triggered a match. If it is9867* %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.9868* If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery9869* result.9870* If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.9871* @inst_id: the local instance id9872* @peer_inst_id: the instance id of the peer's function9873* @addr: the MAC address of the peer9874* @info_len: the length of the &info9875* @info: the Service Specific Info from the peer (if any)9876* @cookie: unique identifier of the corresponding function9877*/9878struct cfg80211_nan_match_params {9879enum nl80211_nan_function_type type;9880u8 inst_id;9881u8 peer_inst_id;9882const u8 *addr;9883u8 info_len;9884const u8 *info;9885u64 cookie;9886};98879888/**9889* cfg80211_nan_match - report a match for a NAN function.9890* @wdev: the wireless device reporting the match9891* @match: match notification parameters9892* @gfp: allocation flags9893*9894* This function reports that the a NAN function had a match. This9895* can be a subscribe that had a match or a solicited publish that9896* was sent. It can also be a follow up that was received.9897*/9898void cfg80211_nan_match(struct wireless_dev *wdev,9899struct cfg80211_nan_match_params *match, gfp_t gfp);99009901/**9902* cfg80211_nan_func_terminated - notify about NAN function termination.9903*9904* @wdev: the wireless device reporting the match9905* @inst_id: the local instance id9906* @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)9907* @cookie: unique NAN function identifier9908* @gfp: allocation flags9909*9910* This function reports that the a NAN function is terminated.9911*/9912void cfg80211_nan_func_terminated(struct wireless_dev *wdev,9913u8 inst_id,9914enum nl80211_nan_func_term_reason reason,9915u64 cookie, gfp_t gfp);99169917/* ethtool helper */9918void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);99199920/**9921* cfg80211_external_auth_request - userspace request for authentication9922* @netdev: network device9923* @params: External authentication parameters9924* @gfp: allocation flags9925* Returns: 0 on success, < 0 on error9926*/9927int cfg80211_external_auth_request(struct net_device *netdev,9928struct cfg80211_external_auth_params *params,9929gfp_t gfp);99309931/**9932* cfg80211_pmsr_report - report peer measurement result data9933* @wdev: the wireless device reporting the measurement9934* @req: the original measurement request9935* @result: the result data9936* @gfp: allocation flags9937*/9938void cfg80211_pmsr_report(struct wireless_dev *wdev,9939struct cfg80211_pmsr_request *req,9940struct cfg80211_pmsr_result *result,9941gfp_t gfp);99429943/**9944* cfg80211_pmsr_complete - report peer measurement completed9945* @wdev: the wireless device reporting the measurement9946* @req: the original measurement request9947* @gfp: allocation flags9948*9949* Report that the entire measurement completed, after this9950* the request pointer will no longer be valid.9951*/9952void cfg80211_pmsr_complete(struct wireless_dev *wdev,9953struct cfg80211_pmsr_request *req,9954gfp_t gfp);99559956/**9957* cfg80211_iftype_allowed - check whether the interface can be allowed9958* @wiphy: the wiphy9959* @iftype: interface type9960* @is_4addr: use_4addr flag, must be '0' when check_swif is '1'9961* @check_swif: check iftype against software interfaces9962*9963* Check whether the interface is allowed to operate; additionally, this API9964* can be used to check iftype against the software interfaces when9965* check_swif is '1'.9966*9967* Return: %true if allowed, %false otherwise9968*/9969bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,9970bool is_4addr, u8 check_swif);997199729973/**9974* cfg80211_assoc_comeback - notification of association that was9975* temporarily rejected with a comeback9976* @netdev: network device9977* @ap_addr: AP (MLD) address that rejected the association9978* @timeout: timeout interval value TUs.9979*9980* this function may sleep. the caller must hold the corresponding wdev's mutex.9981*/9982void cfg80211_assoc_comeback(struct net_device *netdev,9983const u8 *ap_addr, u32 timeout);99849985/* Logging, debugging and troubleshooting/diagnostic helpers. */99869987/* wiphy_printk helpers, similar to dev_printk */99889989#define wiphy_printk(level, wiphy, format, args...) \9990dev_printk(level, &(wiphy)->dev, format, ##args)9991#define wiphy_emerg(wiphy, format, args...) \9992dev_emerg(&(wiphy)->dev, format, ##args)9993#define wiphy_alert(wiphy, format, args...) \9994dev_alert(&(wiphy)->dev, format, ##args)9995#define wiphy_crit(wiphy, format, args...) \9996dev_crit(&(wiphy)->dev, format, ##args)9997#define wiphy_err(wiphy, format, args...) \9998dev_err(&(wiphy)->dev, format, ##args)9999#define wiphy_warn(wiphy, format, args...) \10000dev_warn(&(wiphy)->dev, format, ##args)10001#define wiphy_notice(wiphy, format, args...) \10002dev_notice(&(wiphy)->dev, format, ##args)10003#define wiphy_info(wiphy, format, args...) \10004dev_info(&(wiphy)->dev, format, ##args)10005#define wiphy_info_once(wiphy, format, args...) \10006dev_info_once(&(wiphy)->dev, format, ##args)1000710008#define wiphy_err_ratelimited(wiphy, format, args...) \10009dev_err_ratelimited(&(wiphy)->dev, format, ##args)10010#define wiphy_warn_ratelimited(wiphy, format, args...) \10011dev_warn_ratelimited(&(wiphy)->dev, format, ##args)1001210013#define wiphy_debug(wiphy, format, args...) \10014wiphy_printk(KERN_DEBUG, wiphy, format, ##args)1001510016#define wiphy_dbg(wiphy, format, args...) \10017dev_dbg(&(wiphy)->dev, format, ##args)1001810019#if defined(VERBOSE_DEBUG)10020#define wiphy_vdbg wiphy_dbg10021#else10022#define wiphy_vdbg(wiphy, format, args...) \10023({ \10024if (0) \10025wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \100260; \10027})10028#endif1002910030/*10031* wiphy_WARN() acts like wiphy_printk(), but with the key difference10032* of using a WARN/WARN_ON to get the message out, including the10033* file/line information and a backtrace.10034*/10035#define wiphy_WARN(wiphy, format, args...) \10036WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);1003710038/**10039* cfg80211_update_owe_info_event - Notify the peer's OWE info to user space10040* @netdev: network device10041* @owe_info: peer's owe info10042* @gfp: allocation flags10043*/10044void cfg80211_update_owe_info_event(struct net_device *netdev,10045struct cfg80211_update_owe_info *owe_info,10046gfp_t gfp);1004710048/**10049* cfg80211_bss_flush - resets all the scan entries10050* @wiphy: the wiphy10051*/10052void cfg80211_bss_flush(struct wiphy *wiphy);1005310054/**10055* cfg80211_bss_color_notify - notify about bss color event10056* @dev: network device10057* @cmd: the actual event we want to notify10058* @count: the number of TBTTs until the color change happens10059* @color_bitmap: representations of the colors that the local BSS is aware of10060* @link_id: valid link_id in case of MLO or 0 for non-MLO.10061*10062* Return: 0 on success. Non-zero on error.10063*/10064int cfg80211_bss_color_notify(struct net_device *dev,10065enum nl80211_commands cmd, u8 count,10066u64 color_bitmap, u8 link_id);1006710068/**10069* cfg80211_obss_color_collision_notify - notify about bss color collision10070* @dev: network device10071* @color_bitmap: representations of the colors that the local BSS is aware of10072* @link_id: valid link_id in case of MLO or 0 for non-MLO.10073*10074* Return: 0 on success. Non-zero on error.10075*/10076static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,10077u64 color_bitmap,10078u8 link_id)10079{10080return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION,100810, color_bitmap, link_id);10082}1008310084/**10085* cfg80211_color_change_started_notify - notify color change start10086* @dev: the device on which the color is switched10087* @count: the number of TBTTs until the color change happens10088* @link_id: valid link_id in case of MLO or 0 for non-MLO.10089*10090* Inform the userspace about the color change that has started.10091*10092* Return: 0 on success. Non-zero on error.10093*/10094static inline int cfg80211_color_change_started_notify(struct net_device *dev,10095u8 count, u8 link_id)10096{10097return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED,10098count, 0, link_id);10099}1010010101/**10102* cfg80211_color_change_aborted_notify - notify color change abort10103* @dev: the device on which the color is switched10104* @link_id: valid link_id in case of MLO or 0 for non-MLO.10105*10106* Inform the userspace about the color change that has aborted.10107*10108* Return: 0 on success. Non-zero on error.10109*/10110static inline int cfg80211_color_change_aborted_notify(struct net_device *dev,10111u8 link_id)10112{10113return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED,101140, 0, link_id);10115}1011610117/**10118* cfg80211_color_change_notify - notify color change completion10119* @dev: the device on which the color was switched10120* @link_id: valid link_id in case of MLO or 0 for non-MLO.10121*10122* Inform the userspace about the color change that has completed.10123*10124* Return: 0 on success. Non-zero on error.10125*/10126static inline int cfg80211_color_change_notify(struct net_device *dev,10127u8 link_id)10128{10129return cfg80211_bss_color_notify(dev,10130NL80211_CMD_COLOR_CHANGE_COMPLETED,101310, 0, link_id);10132}1013310134/**10135* cfg80211_6ghz_power_type - determine AP regulatory power type10136* @control: control flags10137* @client_flags: &enum ieee80211_channel_flags for station mode to enable10138* SP to LPI fallback, zero otherwise.10139*10140* Return: regulatory power type from &enum ieee80211_ap_reg_power10141*/10142static inline enum ieee80211_ap_reg_power10143cfg80211_6ghz_power_type(u8 control, u32 client_flags)10144{10145switch (u8_get_bits(control, IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO)) {10146case IEEE80211_6GHZ_CTRL_REG_LPI_AP:10147case IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP:10148case IEEE80211_6GHZ_CTRL_REG_AP_ROLE_NOT_RELEVANT:10149return IEEE80211_REG_LPI_AP;10150case IEEE80211_6GHZ_CTRL_REG_SP_AP:10151case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP_OLD:10152return IEEE80211_REG_SP_AP;10153case IEEE80211_6GHZ_CTRL_REG_VLP_AP:10154return IEEE80211_REG_VLP_AP;10155case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP:10156if (client_flags & IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT)10157return IEEE80211_REG_LPI_AP;10158return IEEE80211_REG_SP_AP;10159default:10160return IEEE80211_REG_UNSET_AP;10161}10162}1016310164/**10165* cfg80211_links_removed - Notify about removed STA MLD setup links.10166* @dev: network device.10167* @link_mask: BIT mask of removed STA MLD setup link IDs.10168*10169* Inform cfg80211 and the userspace about removed STA MLD setup links due to10170* AP MLD removing the corresponding affiliated APs with Multi-Link10171* reconfiguration. Note that it's not valid to remove all links, in this10172* case disconnect instead.10173* Also note that the wdev mutex must be held.10174*/10175void cfg80211_links_removed(struct net_device *dev, u16 link_mask);1017610177/**10178* struct cfg80211_mlo_reconf_done_data - MLO reconfiguration data10179* @buf: MLO Reconfiguration Response frame (header + body)10180* @len: length of the frame data10181* @driver_initiated: Indicates whether the add links request is initiated by10182* driver. This is set to true when the link reconfiguration request10183* initiated by driver due to AP link recommendation requests10184* (Ex: BTM (BSS Transition Management) request) handling offloaded to10185* driver.10186* @added_links: BIT mask of links successfully added to the association10187* @links: per-link information indexed by link ID10188* @links.bss: the BSS that MLO reconfiguration was requested for, ownership of10189* the pointer moves to cfg80211 in the call to10190* cfg80211_mlo_reconf_add_done().10191*10192* The BSS pointer must be set for each link for which 'add' operation was10193* requested in the assoc_ml_reconf callback.10194*/10195struct cfg80211_mlo_reconf_done_data {10196const u8 *buf;10197size_t len;10198bool driver_initiated;10199u16 added_links;10200struct {10201struct cfg80211_bss *bss;10202u8 *addr;10203} links[IEEE80211_MLD_MAX_NUM_LINKS];10204};1020510206/**10207* cfg80211_mlo_reconf_add_done - Notify about MLO reconfiguration result10208* @dev: network device.10209* @data: MLO reconfiguration done data, &struct cfg80211_mlo_reconf_done_data10210*10211* Inform cfg80211 and the userspace that processing of ML reconfiguration10212* request to add links to the association is done.10213*/10214void cfg80211_mlo_reconf_add_done(struct net_device *dev,10215struct cfg80211_mlo_reconf_done_data *data);1021610217/**10218* cfg80211_schedule_channels_check - schedule regulatory check if needed10219* @wdev: the wireless device to check10220*10221* In case the device supports NO_IR or DFS relaxations, schedule regulatory10222* channels check, as previous concurrent operation conditions may not10223* hold anymore.10224*/10225void cfg80211_schedule_channels_check(struct wireless_dev *wdev);1022610227/**10228* cfg80211_epcs_changed - Notify about a change in EPCS state10229* @netdev: the wireless device whose EPCS state changed10230* @enabled: set to true if EPCS was enabled, otherwise set to false.10231*/10232void cfg80211_epcs_changed(struct net_device *netdev, bool enabled);1023310234/**10235* cfg80211_next_nan_dw_notif - Notify about the next NAN Discovery Window (DW)10236* @wdev: Pointer to the wireless device structure10237* @chan: DW channel (6, 44 or 149)10238* @gfp: Memory allocation flags10239*/10240void cfg80211_next_nan_dw_notif(struct wireless_dev *wdev,10241struct ieee80211_channel *chan, gfp_t gfp);1024210243/**10244* cfg80211_nan_cluster_joined - Notify about NAN cluster join10245* @wdev: Pointer to the wireless device structure10246* @cluster_id: Cluster ID of the NAN cluster that was joined or started10247* @new_cluster: Indicates if this is a new cluster or an existing one10248* @gfp: Memory allocation flags10249*10250* This function is used to notify user space when a NAN cluster has been10251* joined, providing the cluster ID and a flag whether it is a new cluster.10252*/10253void cfg80211_nan_cluster_joined(struct wireless_dev *wdev,10254const u8 *cluster_id, bool new_cluster,10255gfp_t gfp);1025610257#ifdef CONFIG_CFG80211_DEBUGFS10258/**10259* wiphy_locked_debugfs_read - do a locked read in debugfs10260* @wiphy: the wiphy to use10261* @file: the file being read10262* @buf: the buffer to fill and then read from10263* @bufsize: size of the buffer10264* @userbuf: the user buffer to copy to10265* @count: read count10266* @ppos: read position10267* @handler: the read handler to call (under wiphy lock)10268* @data: additional data to pass to the read handler10269*10270* Return: the number of characters read, or a negative errno10271*/10272ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,10273char *buf, size_t bufsize,10274char __user *userbuf, size_t count,10275loff_t *ppos,10276ssize_t (*handler)(struct wiphy *wiphy,10277struct file *file,10278char *buf,10279size_t bufsize,10280void *data),10281void *data);1028210283/**10284* wiphy_locked_debugfs_write - do a locked write in debugfs10285* @wiphy: the wiphy to use10286* @file: the file being written to10287* @buf: the buffer to copy the user data to10288* @bufsize: size of the buffer10289* @userbuf: the user buffer to copy from10290* @count: read count10291* @handler: the write handler to call (under wiphy lock)10292* @data: additional data to pass to the write handler10293*10294* Return: the number of characters written, or a negative errno10295*/10296ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file,10297char *buf, size_t bufsize,10298const char __user *userbuf, size_t count,10299ssize_t (*handler)(struct wiphy *wiphy,10300struct file *file,10301char *buf,10302size_t count,10303void *data),10304void *data);10305#endif1030610307/**10308* cfg80211_s1g_get_start_freq_khz - get S1G chandef start frequency10309* @chandef: the chandef to use10310*10311* Return: the chandefs starting frequency in KHz10312*/10313static inline u3210314cfg80211_s1g_get_start_freq_khz(const struct cfg80211_chan_def *chandef)10315{10316u32 bw_mhz = cfg80211_chandef_get_width(chandef);10317u32 center_khz =10318MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;10319return center_khz - bw_mhz * 500 + 500;10320}1032110322/**10323* cfg80211_s1g_get_end_freq_khz - get S1G chandef end frequency10324* @chandef: the chandef to use10325*10326* Return: the chandefs ending frequency in KHz10327*/10328static inline u3210329cfg80211_s1g_get_end_freq_khz(const struct cfg80211_chan_def *chandef)10330{10331u32 bw_mhz = cfg80211_chandef_get_width(chandef);10332u32 center_khz =10333MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;10334return center_khz + bw_mhz * 500 - 500;10335}1033610337/**10338* cfg80211_s1g_get_primary_sibling - retrieve the sibling 1MHz subchannel10339* for an S1G chandef using a 2MHz primary channel.10340* @wiphy: wiphy the channel belongs to10341* @chandef: the chandef to use10342*10343* When chandef::s1g_primary_2mhz is set to true, we are operating on a 2MHz10344* primary channel. The 1MHz subchannel designated by the primary channel10345* location exists within chandef::chan, whilst the 'sibling' is denoted as10346* being the other 1MHz subchannel that make up the 2MHz primary channel.10347*10348* Returns: the sibling 1MHz &struct ieee80211_channel, or %NULL on failure.10349*/10350static inline struct ieee80211_channel *10351cfg80211_s1g_get_primary_sibling(struct wiphy *wiphy,10352const struct cfg80211_chan_def *chandef)10353{10354int width_mhz = cfg80211_chandef_get_width(chandef);10355u32 pri_1mhz_khz, sibling_1mhz_khz, op_low_1mhz_khz, pri_index;1035610357if (!chandef->s1g_primary_2mhz || width_mhz < 2)10358return NULL;1035910360pri_1mhz_khz = ieee80211_channel_to_khz(chandef->chan);10361op_low_1mhz_khz = cfg80211_s1g_get_start_freq_khz(chandef);1036210363/*10364* Compute the index of the primary 1 MHz subchannel within the10365* operating channel, relative to the lowest 1 MHz center frequency.10366* Flip the least significant bit to select the even/odd sibling,10367* then translate that index back into a channel frequency.10368*/10369pri_index = (pri_1mhz_khz - op_low_1mhz_khz) / 1000;10370sibling_1mhz_khz = op_low_1mhz_khz + ((pri_index ^ 1) * 1000);1037110372return ieee80211_get_channel_khz(wiphy, sibling_1mhz_khz);10373}1037410375#endif /* __NET_CFG80211_H */103761037710378