/* 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 ETH 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) for TKIP and CCMP keys, only used789* with the get_key() callback, must be in little endian,790* length given by @seq_len.791* @seq_len: length of @seq.792* @vlan_id: vlan_id for VLAN group key (if nonzero)793* @mode: key install mode (RX_TX, NO_TX or SET_TX)794*/795struct key_params {796const u8 *key;797const u8 *seq;798int key_len;799int seq_len;800u16 vlan_id;801u32 cipher;802enum nl80211_key_mode mode;803};804805/**806* struct cfg80211_chan_def - channel definition807* @chan: the (control) channel808* @width: channel width809* @center_freq1: center frequency of first segment810* @center_freq2: center frequency of second segment811* (only with 80+80 MHz)812* @edmg: define the EDMG channels configuration.813* If edmg is requested (i.e. the .channels member is non-zero),814* chan will define the primary channel and all other815* parameters are ignored.816* @freq1_offset: offset from @center_freq1, in KHz817* @punctured: mask of the punctured 20 MHz subchannels, with818* bits turned on being disabled (punctured); numbered819* from lower to higher frequency (like in the spec)820* @s1g_primary_2mhz: Indicates if the control channel pointed to821* by 'chan' exists as a 1MHz primary subchannel within an822* S1G 2MHz primary channel.823*/824struct cfg80211_chan_def {825struct ieee80211_channel *chan;826enum nl80211_chan_width width;827u32 center_freq1;828u32 center_freq2;829struct ieee80211_edmg edmg;830u16 freq1_offset;831u16 punctured;832bool s1g_primary_2mhz;833};834835/*836* cfg80211_bitrate_mask - masks for bitrate control837*/838struct cfg80211_bitrate_mask {839struct {840u32 legacy;841u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];842u16 vht_mcs[NL80211_VHT_NSS_MAX];843u16 he_mcs[NL80211_HE_NSS_MAX];844u16 eht_mcs[NL80211_EHT_NSS_MAX];845enum nl80211_txrate_gi gi;846enum nl80211_he_gi he_gi;847enum nl80211_eht_gi eht_gi;848enum nl80211_he_ltf he_ltf;849enum nl80211_eht_ltf eht_ltf;850} control[NUM_NL80211_BANDS];851};852853854/**855* struct cfg80211_tid_cfg - TID specific configuration856* @config_override: Flag to notify driver to reset TID configuration857* of the peer.858* @tids: bitmap of TIDs to modify859* @mask: bitmap of attributes indicating which parameter changed,860* similar to &nl80211_tid_config_supp.861* @noack: noack configuration value for the TID862* @retry_long: retry count value863* @retry_short: retry count value864* @ampdu: Enable/Disable MPDU aggregation865* @rtscts: Enable/Disable RTS/CTS866* @amsdu: Enable/Disable MSDU aggregation867* @txrate_type: Tx bitrate mask type868* @txrate_mask: Tx bitrate to be applied for the TID869*/870struct cfg80211_tid_cfg {871bool config_override;872u8 tids;873u64 mask;874enum nl80211_tid_config noack;875u8 retry_long, retry_short;876enum nl80211_tid_config ampdu;877enum nl80211_tid_config rtscts;878enum nl80211_tid_config amsdu;879enum nl80211_tx_rate_setting txrate_type;880struct cfg80211_bitrate_mask txrate_mask;881};882883/**884* struct cfg80211_tid_config - TID configuration885* @peer: Station's MAC address886* @n_tid_conf: Number of TID specific configurations to be applied887* @tid_conf: Configuration change info888*/889struct cfg80211_tid_config {890const u8 *peer;891u32 n_tid_conf;892struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf);893};894895/**896* struct cfg80211_fils_aad - FILS AAD data897* @macaddr: STA MAC address898* @kek: FILS KEK899* @kek_len: FILS KEK length900* @snonce: STA Nonce901* @anonce: AP Nonce902*/903struct cfg80211_fils_aad {904const u8 *macaddr;905const u8 *kek;906u8 kek_len;907const u8 *snonce;908const u8 *anonce;909};910911/**912* struct cfg80211_set_hw_timestamp - enable/disable HW timestamping913* @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all914* addresses.915* @enable: if set, enable HW timestamping for the specified MAC address.916* Otherwise disable HW timestamping for the specified MAC address.917*/918struct cfg80211_set_hw_timestamp {919const u8 *macaddr;920bool enable;921};922923/**924* cfg80211_get_chandef_type - return old channel type from chandef925* @chandef: the channel definition926*927* Return: The old channel type (NOHT, HT20, HT40+/-) from a given928* chandef, which must have a bandwidth allowing this conversion.929*/930static inline enum nl80211_channel_type931cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)932{933switch (chandef->width) {934case NL80211_CHAN_WIDTH_20_NOHT:935return NL80211_CHAN_NO_HT;936case NL80211_CHAN_WIDTH_20:937return NL80211_CHAN_HT20;938case NL80211_CHAN_WIDTH_40:939if (chandef->center_freq1 > chandef->chan->center_freq)940return NL80211_CHAN_HT40PLUS;941return NL80211_CHAN_HT40MINUS;942default:943WARN_ON(1);944return NL80211_CHAN_NO_HT;945}946}947948/**949* cfg80211_chandef_create - create channel definition using channel type950* @chandef: the channel definition struct to fill951* @channel: the control channel952* @chantype: the channel type953*954* Given a channel type, create a channel definition.955*/956void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,957struct ieee80211_channel *channel,958enum nl80211_channel_type chantype);959960/**961* cfg80211_chandef_identical - check if two channel definitions are identical962* @chandef1: first channel definition963* @chandef2: second channel definition964*965* Return: %true if the channels defined by the channel definitions are966* identical, %false otherwise.967*/968static inline bool969cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,970const struct cfg80211_chan_def *chandef2)971{972return (chandef1->chan == chandef2->chan &&973chandef1->width == chandef2->width &&974chandef1->center_freq1 == chandef2->center_freq1 &&975chandef1->freq1_offset == chandef2->freq1_offset &&976chandef1->center_freq2 == chandef2->center_freq2 &&977chandef1->punctured == chandef2->punctured);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);10161017/**1018* nl80211_chan_width_to_mhz - get the channel width in MHz1019* @chan_width: the channel width from &enum nl80211_chan_width1020*1021* Return: channel width in MHz if the chan_width from &enum nl80211_chan_width1022* is valid. -1 otherwise.1023*/1024int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width);10251026/**1027* cfg80211_chandef_get_width - return chandef width in MHz1028* @c: chandef to return bandwidth for1029* Return: channel width in MHz for the given chandef; note that it returns1030* 80 for 80+80 configurations1031*/1032static inline int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c)1033{1034return nl80211_chan_width_to_mhz(c->width);1035}10361037/**1038* cfg80211_chandef_valid - check if a channel definition is valid1039* @chandef: the channel definition to check1040* Return: %true if the channel definition is valid. %false otherwise.1041*/1042bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);10431044/**1045* cfg80211_chandef_usable - check if secondary channels can be used1046* @wiphy: the wiphy to validate against1047* @chandef: the channel definition to check1048* @prohibited_flags: the regulatory channel flags that must not be set1049* Return: %true if secondary channels are usable. %false otherwise.1050*/1051bool cfg80211_chandef_usable(struct wiphy *wiphy,1052const struct cfg80211_chan_def *chandef,1053u32 prohibited_flags);10541055/**1056* cfg80211_chandef_dfs_required - checks if radar detection is required1057* @wiphy: the wiphy to validate against1058* @chandef: the channel definition to check1059* @iftype: the interface type as specified in &enum nl80211_iftype1060* Returns:1061* 1 if radar detection is required, 0 if it is not, < 0 on error1062*/1063int cfg80211_chandef_dfs_required(struct wiphy *wiphy,1064const struct cfg80211_chan_def *chandef,1065enum nl80211_iftype iftype);10661067/**1068* cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we1069* can/need start CAC on such channel1070* @wiphy: the wiphy to validate against1071* @chandef: the channel definition to check1072*1073* Return: true if all channels available and at least1074* one channel requires CAC (NL80211_DFS_USABLE)1075*/1076bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,1077const struct cfg80211_chan_def *chandef);10781079/**1080* cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given1081* channel definition1082* @wiphy: the wiphy to validate against1083* @chandef: the channel definition to check1084*1085* Returns: DFS CAC time (in ms) which applies for this channel definition1086*/1087unsigned int1088cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,1089const struct cfg80211_chan_def *chandef);10901091/**1092* cfg80211_chandef_primary - calculate primary 40/80/160 MHz freq1093* @chandef: chandef to calculate for1094* @primary_chan_width: primary channel width to calculate center for1095* @punctured: punctured sub-channel bitmap, will be recalculated1096* according to the new bandwidth, can be %NULL1097*1098* Returns: the primary 40/80/160 MHz channel center frequency, or -11099* for errors, updating the punctured bitmap1100*/1101int cfg80211_chandef_primary(const struct cfg80211_chan_def *chandef,1102enum nl80211_chan_width primary_chan_width,1103u16 *punctured);11041105/**1106* nl80211_send_chandef - sends the channel definition.1107* @msg: the msg to send channel definition1108* @chandef: the channel definition to check1109*1110* Returns: 0 if sent the channel definition to msg, < 0 on error1111**/1112int nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef);11131114/**1115* ieee80211_chandef_max_power - maximum transmission power for the chandef1116*1117* In some regulations, the transmit power may depend on the configured channel1118* bandwidth which may be defined as dBm/MHz. This function returns the actual1119* max_power for non-standard (20 MHz) channels.1120*1121* @chandef: channel definition for the channel1122*1123* Returns: maximum allowed transmission power in dBm for the chandef1124*/1125static inline int1126ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)1127{1128switch (chandef->width) {1129case NL80211_CHAN_WIDTH_5:1130return min(chandef->chan->max_reg_power - 6,1131chandef->chan->max_power);1132case NL80211_CHAN_WIDTH_10:1133return min(chandef->chan->max_reg_power - 3,1134chandef->chan->max_power);1135default:1136break;1137}1138return chandef->chan->max_power;1139}11401141/**1142* cfg80211_any_usable_channels - check for usable channels1143* @wiphy: the wiphy to check for1144* @band_mask: which bands to check on1145* @prohibited_flags: which channels to not consider usable,1146* %IEEE80211_CHAN_DISABLED is always taken into account1147*1148* Return: %true if usable channels found, %false otherwise1149*/1150bool cfg80211_any_usable_channels(struct wiphy *wiphy,1151unsigned long band_mask,1152u32 prohibited_flags);11531154/**1155* enum survey_info_flags - survey information flags1156*1157* @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in1158* @SURVEY_INFO_IN_USE: channel is currently being used1159* @SURVEY_INFO_TIME: active time (in ms) was filled in1160* @SURVEY_INFO_TIME_BUSY: busy time was filled in1161* @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in1162* @SURVEY_INFO_TIME_RX: receive time was filled in1163* @SURVEY_INFO_TIME_TX: transmit time was filled in1164* @SURVEY_INFO_TIME_SCAN: scan time was filled in1165* @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in1166*1167* Used by the driver to indicate which info in &struct survey_info1168* it has filled in during the get_survey().1169*/1170enum survey_info_flags {1171SURVEY_INFO_NOISE_DBM = BIT(0),1172SURVEY_INFO_IN_USE = BIT(1),1173SURVEY_INFO_TIME = BIT(2),1174SURVEY_INFO_TIME_BUSY = BIT(3),1175SURVEY_INFO_TIME_EXT_BUSY = BIT(4),1176SURVEY_INFO_TIME_RX = BIT(5),1177SURVEY_INFO_TIME_TX = BIT(6),1178SURVEY_INFO_TIME_SCAN = BIT(7),1179SURVEY_INFO_TIME_BSS_RX = BIT(8),1180};11811182/**1183* struct survey_info - channel survey response1184*1185* @channel: the channel this survey record reports, may be %NULL for a single1186* record to report global statistics1187* @filled: bitflag of flags from &enum survey_info_flags1188* @noise: channel noise in dBm. This and all following fields are1189* optional1190* @time: amount of time in ms the radio was turn on (on the channel)1191* @time_busy: amount of time the primary channel was sensed busy1192* @time_ext_busy: amount of time the extension channel was sensed busy1193* @time_rx: amount of time the radio spent receiving data1194* @time_tx: amount of time the radio spent transmitting data1195* @time_scan: amount of time the radio spent for scanning1196* @time_bss_rx: amount of time the radio spent receiving data on a local BSS1197*1198* Used by dump_survey() to report back per-channel survey information.1199*1200* This structure can later be expanded with things like1201* channel duty cycle etc.1202*/1203struct survey_info {1204struct ieee80211_channel *channel;1205u64 time;1206u64 time_busy;1207u64 time_ext_busy;1208u64 time_rx;1209u64 time_tx;1210u64 time_scan;1211u64 time_bss_rx;1212u32 filled;1213s8 noise;1214};12151216#define CFG80211_MAX_NUM_AKM_SUITES 1012171218/**1219* struct cfg80211_crypto_settings - Crypto settings1220* @wpa_versions: indicates which, if any, WPA versions are enabled1221* (from enum nl80211_wpa_versions)1222* @cipher_group: group key cipher suite (or 0 if unset)1223* @n_ciphers_pairwise: number of AP supported unicast ciphers1224* @ciphers_pairwise: unicast key cipher suites1225* @n_akm_suites: number of AKM suites1226* @akm_suites: AKM suites1227* @control_port: Whether user space controls IEEE 802.1X port, i.e.,1228* sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is1229* required to assume that the port is unauthorized until authorized by1230* user space. Otherwise, port is marked authorized by default.1231* @control_port_ethertype: the control port protocol that should be1232* allowed through even on unauthorized ports1233* @control_port_no_encrypt: TRUE to prevent encryption of control port1234* protocol frames.1235* @control_port_over_nl80211: TRUE if userspace expects to exchange control1236* port frames over NL80211 instead of the network interface.1237* @control_port_no_preauth: disables pre-auth rx over the nl80211 control1238* port for mac802111239* @psk: PSK (for devices supporting 4-way-handshake offload)1240* @sae_pwd: password for SAE authentication (for devices supporting SAE1241* offload)1242* @sae_pwd_len: length of SAE password (for devices supporting SAE offload)1243* @sae_pwe: The mechanisms allowed for SAE PWE derivation:1244*1245* NL80211_SAE_PWE_UNSPECIFIED1246* Not-specified, used to indicate userspace did not specify any1247* preference. The driver should follow its internal policy in1248* such a scenario.1249*1250* NL80211_SAE_PWE_HUNT_AND_PECK1251* Allow hunting-and-pecking loop only1252*1253* NL80211_SAE_PWE_HASH_TO_ELEMENT1254* Allow hash-to-element only1255*1256* NL80211_SAE_PWE_BOTH1257* Allow either hunting-and-pecking loop or hash-to-element1258*/1259struct cfg80211_crypto_settings {1260u32 wpa_versions;1261u32 cipher_group;1262int n_ciphers_pairwise;1263u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];1264int n_akm_suites;1265u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];1266bool control_port;1267__be16 control_port_ethertype;1268bool control_port_no_encrypt;1269bool control_port_over_nl80211;1270bool control_port_no_preauth;1271const u8 *psk;1272const u8 *sae_pwd;1273u8 sae_pwd_len;1274enum nl80211_sae_pwe_mechanism sae_pwe;1275};12761277/**1278* struct cfg80211_mbssid_config - AP settings for multi bssid1279*1280* @tx_wdev: pointer to the transmitted interface in the MBSSID set1281* @tx_link_id: link ID of the transmitted profile in an MLD.1282* @index: index of this AP in the multi bssid group.1283* @ema: set to true if the beacons should be sent out in EMA mode.1284*/1285struct cfg80211_mbssid_config {1286struct wireless_dev *tx_wdev;1287u8 tx_link_id;1288u8 index;1289bool ema;1290};12911292/**1293* struct cfg80211_mbssid_elems - Multiple BSSID elements1294*1295* @cnt: Number of elements in array %elems.1296*1297* @elem: Array of multiple BSSID element(s) to be added into Beacon frames.1298* @elem.data: Data for multiple BSSID elements.1299* @elem.len: Length of data.1300*/1301struct cfg80211_mbssid_elems {1302u8 cnt;1303struct {1304const u8 *data;1305size_t len;1306} elem[] __counted_by(cnt);1307};13081309/**1310* struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements1311*1312* @cnt: Number of elements in array %elems.1313*1314* @elem: Array of RNR element(s) to be added into Beacon frames.1315* @elem.data: Data for RNR elements.1316* @elem.len: Length of data.1317*/1318struct cfg80211_rnr_elems {1319u8 cnt;1320struct {1321const u8 *data;1322size_t len;1323} elem[] __counted_by(cnt);1324};13251326/**1327* struct cfg80211_beacon_data - beacon data1328* @link_id: the link ID for the AP MLD link sending this beacon1329* @head: head portion of beacon (before TIM IE)1330* or %NULL if not changed1331* @tail: tail portion of beacon (after TIM IE)1332* or %NULL if not changed1333* @head_len: length of @head1334* @tail_len: length of @tail1335* @beacon_ies: extra information element(s) to add into Beacon frames or %NULL1336* @beacon_ies_len: length of beacon_ies in octets1337* @proberesp_ies: extra information element(s) to add into Probe Response1338* frames or %NULL1339* @proberesp_ies_len: length of proberesp_ies in octets1340* @assocresp_ies: extra information element(s) to add into (Re)Association1341* Response frames or %NULL1342* @assocresp_ies_len: length of assocresp_ies in octets1343* @probe_resp_len: length of probe response template (@probe_resp)1344* @probe_resp: probe response template (AP mode only)1345* @mbssid_ies: multiple BSSID elements1346* @rnr_ies: reduced neighbor report elements1347* @ftm_responder: enable FTM responder functionality; -1 for no change1348* (which also implies no change in LCI/civic location data)1349* @lci: Measurement Report element content, starting with Measurement Token1350* (measurement type 8)1351* @civicloc: Measurement Report element content, starting with Measurement1352* Token (measurement type 11)1353* @lci_len: LCI data length1354* @civicloc_len: Civic location data length1355* @he_bss_color: BSS Color settings1356* @he_bss_color_valid: indicates whether bss color1357* attribute is present in beacon data or not.1358*/1359struct cfg80211_beacon_data {1360unsigned int link_id;13611362const u8 *head, *tail;1363const u8 *beacon_ies;1364const u8 *proberesp_ies;1365const u8 *assocresp_ies;1366const u8 *probe_resp;1367const u8 *lci;1368const u8 *civicloc;1369struct cfg80211_mbssid_elems *mbssid_ies;1370struct cfg80211_rnr_elems *rnr_ies;1371s8 ftm_responder;13721373size_t head_len, tail_len;1374size_t beacon_ies_len;1375size_t proberesp_ies_len;1376size_t assocresp_ies_len;1377size_t probe_resp_len;1378size_t lci_len;1379size_t civicloc_len;1380struct cfg80211_he_bss_color he_bss_color;1381bool he_bss_color_valid;1382};13831384struct mac_address {1385u8 addr[ETH_ALEN];1386};13871388/**1389* struct cfg80211_acl_data - Access control list data1390*1391* @acl_policy: ACL policy to be applied on the station's1392* entry specified by mac_addr1393* @n_acl_entries: Number of MAC address entries passed1394* @mac_addrs: List of MAC addresses of stations to be used for ACL1395*/1396struct cfg80211_acl_data {1397enum nl80211_acl_policy acl_policy;1398int n_acl_entries;13991400/* Keep it last */1401struct mac_address mac_addrs[] __counted_by(n_acl_entries);1402};14031404/**1405* struct cfg80211_fils_discovery - FILS discovery parameters from1406* IEEE Std 802.11ai-2016, Annex C.3 MIB detail.1407*1408* @update: Set to true if the feature configuration should be updated.1409* @min_interval: Minimum packet interval in TUs (0 - 10000)1410* @max_interval: Maximum packet interval in TUs (0 - 10000)1411* @tmpl_len: Template length1412* @tmpl: Template data for FILS discovery frame including the action1413* frame headers.1414*/1415struct cfg80211_fils_discovery {1416bool update;1417u32 min_interval;1418u32 max_interval;1419size_t tmpl_len;1420const u8 *tmpl;1421};14221423/**1424* struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe1425* response parameters in 6GHz.1426*1427* @update: Set to true if the feature configuration should be updated.1428* @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned1429* in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive1430* scanning1431* @tmpl_len: Template length1432* @tmpl: Template data for probe response1433*/1434struct cfg80211_unsol_bcast_probe_resp {1435bool update;1436u32 interval;1437size_t tmpl_len;1438const u8 *tmpl;1439};14401441/**1442* struct cfg80211_s1g_short_beacon - S1G short beacon data.1443*1444* @update: Set to true if the feature configuration should be updated.1445* @short_head: Short beacon head.1446* @short_tail: Short beacon tail.1447* @short_head_len: Short beacon head len.1448* @short_tail_len: Short beacon tail len.1449*/1450struct cfg80211_s1g_short_beacon {1451bool update;1452const u8 *short_head;1453const u8 *short_tail;1454size_t short_head_len;1455size_t short_tail_len;1456};14571458/**1459* struct cfg80211_ap_settings - AP configuration1460*1461* Used to configure an AP interface.1462*1463* @chandef: defines the channel to use1464* @beacon: beacon data1465* @beacon_interval: beacon interval1466* @dtim_period: DTIM period1467* @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from1468* user space)1469* @ssid_len: length of @ssid1470* @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames1471* @crypto: crypto settings1472* @privacy: the BSS uses privacy1473* @auth_type: Authentication type (algorithm)1474* @inactivity_timeout: time in seconds to determine station's inactivity.1475* @p2p_ctwindow: P2P CT Window1476* @p2p_opp_ps: P2P opportunistic PS1477* @acl: ACL configuration used by the drivers which has support for1478* MAC address based access control1479* @pbss: If set, start as a PCP instead of AP. Relevant for DMG1480* networks.1481* @beacon_rate: bitrate to be used for beacons1482* @ht_cap: HT capabilities (or %NULL if HT isn't enabled)1483* @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)1484* @he_cap: HE capabilities (or %NULL if HE isn't enabled)1485* @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)1486* @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)1487* @ht_required: stations must support HT1488* @vht_required: stations must support VHT1489* @twt_responder: Enable Target Wait Time1490* @he_required: stations must support HE1491* @sae_h2e_required: stations must support direct H2E technique in SAE1492* @flags: flags, as defined in &enum nl80211_ap_settings_flags1493* @he_obss_pd: OBSS Packet Detection settings1494* @he_oper: HE operation IE (or %NULL if HE isn't enabled)1495* @fils_discovery: FILS discovery transmission parameters1496* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1497* @mbssid_config: AP settings for multiple bssid1498* @s1g_long_beacon_period: S1G long beacon period1499* @s1g_short_beacon: S1G short beacon data1500*/1501struct cfg80211_ap_settings {1502struct cfg80211_chan_def chandef;15031504struct cfg80211_beacon_data beacon;15051506int beacon_interval, dtim_period;1507const u8 *ssid;1508size_t ssid_len;1509enum nl80211_hidden_ssid hidden_ssid;1510struct cfg80211_crypto_settings crypto;1511bool privacy;1512enum nl80211_auth_type auth_type;1513int inactivity_timeout;1514u8 p2p_ctwindow;1515bool p2p_opp_ps;1516const struct cfg80211_acl_data *acl;1517bool pbss;1518struct cfg80211_bitrate_mask beacon_rate;15191520const struct ieee80211_ht_cap *ht_cap;1521const struct ieee80211_vht_cap *vht_cap;1522const struct ieee80211_he_cap_elem *he_cap;1523const struct ieee80211_he_operation *he_oper;1524const struct ieee80211_eht_cap_elem *eht_cap;1525const struct ieee80211_eht_operation *eht_oper;1526bool ht_required, vht_required, he_required, sae_h2e_required;1527bool twt_responder;1528u32 flags;1529struct ieee80211_he_obss_pd he_obss_pd;1530struct cfg80211_fils_discovery fils_discovery;1531struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1532struct cfg80211_mbssid_config mbssid_config;1533u8 s1g_long_beacon_period;1534struct cfg80211_s1g_short_beacon s1g_short_beacon;1535};153615371538/**1539* struct cfg80211_ap_update - AP configuration update1540*1541* Subset of &struct cfg80211_ap_settings, for updating a running AP.1542*1543* @beacon: beacon data1544* @fils_discovery: FILS discovery transmission parameters1545* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1546* @s1g_short_beacon: S1G short beacon data1547*/1548struct cfg80211_ap_update {1549struct cfg80211_beacon_data beacon;1550struct cfg80211_fils_discovery fils_discovery;1551struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1552struct cfg80211_s1g_short_beacon s1g_short_beacon;1553};15541555/**1556* struct cfg80211_csa_settings - channel switch settings1557*1558* Used for channel switch1559*1560* @chandef: defines the channel to use after the switch1561* @beacon_csa: beacon data while performing the switch1562* @counter_offsets_beacon: offsets of the counters within the beacon (tail)1563* @counter_offsets_presp: offsets of the counters within the probe response1564* @n_counter_offsets_beacon: number of csa counters the beacon (tail)1565* @n_counter_offsets_presp: number of csa counters in the probe response1566* @beacon_after: beacon data to be used on the new channel1567* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1568* @radar_required: whether radar detection is required on the new channel1569* @block_tx: whether transmissions should be blocked while changing1570* @count: number of beacons until switch1571* @link_id: defines the link on which channel switch is expected during1572* MLO. 0 in case of non-MLO.1573*/1574struct cfg80211_csa_settings {1575struct cfg80211_chan_def chandef;1576struct cfg80211_beacon_data beacon_csa;1577const u16 *counter_offsets_beacon;1578const u16 *counter_offsets_presp;1579unsigned int n_counter_offsets_beacon;1580unsigned int n_counter_offsets_presp;1581struct cfg80211_beacon_data beacon_after;1582struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1583bool radar_required;1584bool block_tx;1585u8 count;1586u8 link_id;1587};15881589/**1590* struct cfg80211_color_change_settings - color change settings1591*1592* Used for bss color change1593*1594* @beacon_color_change: beacon data while performing the color countdown1595* @counter_offset_beacon: offsets of the counters within the beacon (tail)1596* @counter_offset_presp: offsets of the counters within the probe response1597* @beacon_next: beacon data to be used after the color change1598* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters1599* @count: number of beacons until the color change1600* @color: the color used after the change1601* @link_id: defines the link on which color change is expected during MLO.1602* 0 in case of non-MLO.1603*/1604struct cfg80211_color_change_settings {1605struct cfg80211_beacon_data beacon_color_change;1606u16 counter_offset_beacon;1607u16 counter_offset_presp;1608struct cfg80211_beacon_data beacon_next;1609struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;1610u8 count;1611u8 color;1612u8 link_id;1613};16141615/**1616* struct iface_combination_params - input parameters for interface combinations1617*1618* Used to pass interface combination parameters1619*1620* @radio_idx: wiphy radio index or -1 for global1621* @num_different_channels: the number of different channels we want1622* to use for verification1623* @radar_detect: a bitmap where each bit corresponds to a channel1624* width where radar detection is needed, as in the definition of1625* &struct ieee80211_iface_combination.@radar_detect_widths1626* @iftype_num: array with the number of interfaces of each interface1627* type. The index is the interface type as specified in &enum1628* nl80211_iftype.1629* @new_beacon_int: set this to the beacon interval of a new interface1630* that's not operating yet, if such is to be checked as part of1631* the verification1632*/1633struct iface_combination_params {1634int radio_idx;1635int num_different_channels;1636u8 radar_detect;1637int iftype_num[NUM_NL80211_IFTYPES];1638u32 new_beacon_int;1639};16401641/**1642* enum station_parameters_apply_mask - station parameter values to apply1643* @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)1644* @STATION_PARAM_APPLY_CAPABILITY: apply new capability1645* @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state1646*1647* Not all station parameters have in-band "no change" signalling,1648* for those that don't these flags will are used.1649*/1650enum station_parameters_apply_mask {1651STATION_PARAM_APPLY_UAPSD = BIT(0),1652STATION_PARAM_APPLY_CAPABILITY = BIT(1),1653STATION_PARAM_APPLY_PLINK_STATE = BIT(2),1654};16551656/**1657* struct sta_txpwr - station txpower configuration1658*1659* Used to configure txpower for station.1660*1661* @power: tx power (in dBm) to be used for sending data traffic. If tx power1662* is not provided, the default per-interface tx power setting will be1663* overriding. Driver should be picking up the lowest tx power, either tx1664* power per-interface or per-station.1665* @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power1666* will be less than or equal to specified from userspace, whereas if TPC1667* %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.1668* NL80211_TX_POWER_FIXED is not a valid configuration option for1669* per peer TPC.1670*/1671struct sta_txpwr {1672s16 power;1673enum nl80211_tx_power_setting type;1674};16751676/**1677* struct link_station_parameters - link station parameters1678*1679* Used to change and create a new link station.1680*1681* @mld_mac: MAC address of the station1682* @link_id: the link id (-1 for non-MLD station)1683* @link_mac: MAC address of the link1684* @supported_rates: supported rates in IEEE 802.11 format1685* (or NULL for no change)1686* @supported_rates_len: number of supported rates1687* @ht_capa: HT capabilities of station1688* @vht_capa: VHT capabilities of station1689* @opmode_notif: operating mode field from Operating Mode Notification1690* @opmode_notif_used: information if operating mode field is used1691* @he_capa: HE capabilities of station1692* @he_capa_len: the length of the HE capabilities1693* @txpwr: transmit power for an associated station1694* @txpwr_set: txpwr field is set1695* @he_6ghz_capa: HE 6 GHz Band capabilities of station1696* @eht_capa: EHT capabilities of station1697* @eht_capa_len: the length of the EHT capabilities1698* @s1g_capa: S1G capabilities of station1699*/1700struct link_station_parameters {1701const u8 *mld_mac;1702int link_id;1703const u8 *link_mac;1704const u8 *supported_rates;1705u8 supported_rates_len;1706const struct ieee80211_ht_cap *ht_capa;1707const struct ieee80211_vht_cap *vht_capa;1708u8 opmode_notif;1709bool opmode_notif_used;1710const struct ieee80211_he_cap_elem *he_capa;1711u8 he_capa_len;1712struct sta_txpwr txpwr;1713bool txpwr_set;1714const struct ieee80211_he_6ghz_capa *he_6ghz_capa;1715const struct ieee80211_eht_cap_elem *eht_capa;1716u8 eht_capa_len;1717const struct ieee80211_s1g_cap *s1g_capa;1718};17191720/**1721* struct link_station_del_parameters - link station deletion parameters1722*1723* Used to delete a link station entry (or all stations).1724*1725* @mld_mac: MAC address of the station1726* @link_id: the link id1727*/1728struct link_station_del_parameters {1729const u8 *mld_mac;1730u32 link_id;1731};17321733/**1734* struct cfg80211_ttlm_params: TID to link mapping parameters1735*1736* Used for setting a TID to link mapping.1737*1738* @dlink: Downlink TID to link mapping, as defined in section 9.4.2.3141739* (TID-To-Link Mapping element) in Draft P802.11be_D4.0.1740* @ulink: Uplink TID to link mapping, as defined in section 9.4.2.3141741* (TID-To-Link Mapping element) in Draft P802.11be_D4.0.1742*/1743struct cfg80211_ttlm_params {1744u16 dlink[8];1745u16 ulink[8];1746};17471748/**1749* struct station_parameters - station parameters1750*1751* Used to change and create a new station.1752*1753* @vlan: vlan interface station should belong to1754* @sta_flags_mask: station flags that changed1755* (bitmask of BIT(%NL80211_STA_FLAG_...))1756* @sta_flags_set: station flags values1757* (bitmask of BIT(%NL80211_STA_FLAG_...))1758* @listen_interval: listen interval or -1 for no change1759* @aid: AID or zero for no change1760* @vlan_id: VLAN ID for station (if nonzero)1761* @peer_aid: mesh peer AID or zero for no change1762* @plink_action: plink action to take1763* @plink_state: set the peer link state for a station1764* @uapsd_queues: bitmap of queues configured for uapsd. same format1765* as the AC bitmap in the QoS info field1766* @max_sp: max Service Period. same format as the MAX_SP in the1767* QoS info field (but already shifted down)1768* @sta_modify_mask: bitmap indicating which parameters changed1769* (for those that don't have a natural "no change" value),1770* see &enum station_parameters_apply_mask1771* @local_pm: local link-specific mesh power save mode (no change when set1772* to unknown)1773* @capability: station capability1774* @ext_capab: extended capabilities of the station1775* @ext_capab_len: number of extended capabilities1776* @supported_channels: supported channels in IEEE 802.11 format1777* @supported_channels_len: number of supported channels1778* @supported_oper_classes: supported oper classes in IEEE 802.11 format1779* @supported_oper_classes_len: number of supported operating classes1780* @support_p2p_ps: information if station supports P2P PS mechanism1781* @airtime_weight: airtime scheduler weight for this station1782* @eml_cap_present: Specifies if EML capabilities field (@eml_cap) is1783* present/updated1784* @eml_cap: EML capabilities of this station1785* @link_sta_params: link related params.1786*/1787struct station_parameters {1788struct net_device *vlan;1789u32 sta_flags_mask, sta_flags_set;1790u32 sta_modify_mask;1791int listen_interval;1792u16 aid;1793u16 vlan_id;1794u16 peer_aid;1795u8 plink_action;1796u8 plink_state;1797u8 uapsd_queues;1798u8 max_sp;1799enum nl80211_mesh_power_mode local_pm;1800u16 capability;1801const u8 *ext_capab;1802u8 ext_capab_len;1803const u8 *supported_channels;1804u8 supported_channels_len;1805const u8 *supported_oper_classes;1806u8 supported_oper_classes_len;1807int support_p2p_ps;1808u16 airtime_weight;1809bool eml_cap_present;1810u16 eml_cap;1811struct link_station_parameters link_sta_params;1812};18131814/**1815* struct station_del_parameters - station deletion parameters1816*1817* Used to delete a station entry (or all stations).1818*1819* @mac: MAC address of the station to remove or NULL to remove all stations1820* @subtype: Management frame subtype to use for indicating removal1821* (10 = Disassociation, 12 = Deauthentication)1822* @reason_code: Reason code for the Disassociation/Deauthentication frame1823* @link_id: Link ID indicating a link that stations to be flushed must be1824* using; valid only for MLO, but can also be -1 for MLO to really1825* remove all stations.1826*/1827struct station_del_parameters {1828const u8 *mac;1829u8 subtype;1830u16 reason_code;1831int link_id;1832};18331834/**1835* enum cfg80211_station_type - the type of station being modified1836* @CFG80211_STA_AP_CLIENT: client of an AP interface1837* @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still1838* unassociated (update properties for this type of client is permitted)1839* @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has1840* the AP MLME in the device1841* @CFG80211_STA_AP_STA: AP station on managed interface1842* @CFG80211_STA_IBSS: IBSS station1843* @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry1844* while TDLS setup is in progress, it moves out of this state when1845* being marked authorized; use this only if TDLS with external setup is1846* supported/used)1847* @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active1848* entry that is operating, has been marked authorized by userspace)1849* @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)1850* @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)1851*/1852enum cfg80211_station_type {1853CFG80211_STA_AP_CLIENT,1854CFG80211_STA_AP_CLIENT_UNASSOC,1855CFG80211_STA_AP_MLME_CLIENT,1856CFG80211_STA_AP_STA,1857CFG80211_STA_IBSS,1858CFG80211_STA_TDLS_PEER_SETUP,1859CFG80211_STA_TDLS_PEER_ACTIVE,1860CFG80211_STA_MESH_PEER_KERNEL,1861CFG80211_STA_MESH_PEER_USER,1862};18631864/**1865* cfg80211_check_station_change - validate parameter changes1866* @wiphy: the wiphy this operates on1867* @params: the new parameters for a station1868* @statype: the type of station being modified1869*1870* Utility function for the @change_station driver method. Call this function1871* with the appropriate station type looking up the station (and checking that1872* it exists). It will verify whether the station change is acceptable.1873*1874* Return: 0 if the change is acceptable, otherwise an error code. Note that1875* it may modify the parameters for backward compatibility reasons, so don't1876* use them before calling this.1877*/1878int cfg80211_check_station_change(struct wiphy *wiphy,1879struct station_parameters *params,1880enum cfg80211_station_type statype);18811882/**1883* enum rate_info_flags - bitrate info flags1884*1885* Used by the driver to indicate the specific rate transmission1886* type for 802.11n transmissions.1887*1888* @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS1889* @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS1890* @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval1891* @RATE_INFO_FLAGS_DMG: 60GHz MCS1892* @RATE_INFO_FLAGS_HE_MCS: HE MCS information1893* @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode1894* @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS1895* @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information1896* @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS1897*/1898enum rate_info_flags {1899RATE_INFO_FLAGS_MCS = BIT(0),1900RATE_INFO_FLAGS_VHT_MCS = BIT(1),1901RATE_INFO_FLAGS_SHORT_GI = BIT(2),1902RATE_INFO_FLAGS_DMG = BIT(3),1903RATE_INFO_FLAGS_HE_MCS = BIT(4),1904RATE_INFO_FLAGS_EDMG = BIT(5),1905RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6),1906RATE_INFO_FLAGS_EHT_MCS = BIT(7),1907RATE_INFO_FLAGS_S1G_MCS = BIT(8),1908};19091910/**1911* enum rate_info_bw - rate bandwidth information1912*1913* Used by the driver to indicate the rate bandwidth.1914*1915* @RATE_INFO_BW_5: 5 MHz bandwidth1916* @RATE_INFO_BW_10: 10 MHz bandwidth1917* @RATE_INFO_BW_20: 20 MHz bandwidth1918* @RATE_INFO_BW_40: 40 MHz bandwidth1919* @RATE_INFO_BW_80: 80 MHz bandwidth1920* @RATE_INFO_BW_160: 160 MHz bandwidth1921* @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation1922* @RATE_INFO_BW_320: 320 MHz bandwidth1923* @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation1924* @RATE_INFO_BW_1: 1 MHz bandwidth1925* @RATE_INFO_BW_2: 2 MHz bandwidth1926* @RATE_INFO_BW_4: 4 MHz bandwidth1927* @RATE_INFO_BW_8: 8 MHz bandwidth1928* @RATE_INFO_BW_16: 16 MHz bandwidth1929*/1930enum rate_info_bw {1931RATE_INFO_BW_20 = 0,1932RATE_INFO_BW_5,1933RATE_INFO_BW_10,1934RATE_INFO_BW_40,1935RATE_INFO_BW_80,1936RATE_INFO_BW_160,1937RATE_INFO_BW_HE_RU,1938RATE_INFO_BW_320,1939RATE_INFO_BW_EHT_RU,1940RATE_INFO_BW_1,1941RATE_INFO_BW_2,1942RATE_INFO_BW_4,1943RATE_INFO_BW_8,1944RATE_INFO_BW_16,1945};19461947/**1948* struct rate_info - bitrate information1949*1950* Information about a receiving or transmitting bitrate1951*1952* @flags: bitflag of flags from &enum rate_info_flags1953* @legacy: bitrate in 100kbit/s for 802.11abg1954* @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G rate1955* @nss: number of streams (VHT & HE only)1956* @bw: bandwidth (from &enum rate_info_bw)1957* @he_gi: HE guard interval (from &enum nl80211_he_gi)1958* @he_dcm: HE DCM value1959* @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,1960* only valid if bw is %RATE_INFO_BW_HE_RU)1961* @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)1962* @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)1963* @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,1964* only valid if bw is %RATE_INFO_BW_EHT_RU)1965*/1966struct rate_info {1967u16 flags;1968u16 legacy;1969u8 mcs;1970u8 nss;1971u8 bw;1972u8 he_gi;1973u8 he_dcm;1974u8 he_ru_alloc;1975u8 n_bonded_ch;1976u8 eht_gi;1977u8 eht_ru_alloc;1978};19791980/**1981* enum bss_param_flags - bitrate info flags1982*1983* Used by the driver to indicate the specific rate transmission1984* type for 802.11n transmissions.1985*1986* @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled1987* @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled1988* @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled1989*/1990enum bss_param_flags {1991BSS_PARAM_FLAGS_CTS_PROT = BIT(0),1992BSS_PARAM_FLAGS_SHORT_PREAMBLE = BIT(1),1993BSS_PARAM_FLAGS_SHORT_SLOT_TIME = BIT(2),1994};19951996/**1997* struct sta_bss_parameters - BSS parameters for the attached station1998*1999* Information about the currently associated BSS2000*2001* @flags: bitflag of flags from &enum bss_param_flags2002* @dtim_period: DTIM period for the BSS2003* @beacon_interval: beacon interval2004*/2005struct sta_bss_parameters {2006u8 flags;2007u8 dtim_period;2008u16 beacon_interval;2009};20102011/**2012* struct cfg80211_txq_stats - TXQ statistics for this TID2013* @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to2014* indicate the relevant values in this struct are filled2015* @backlog_bytes: total number of bytes currently backlogged2016* @backlog_packets: total number of packets currently backlogged2017* @flows: number of new flows seen2018* @drops: total number of packets dropped2019* @ecn_marks: total number of packets marked with ECN CE2020* @overlimit: number of drops due to queue space overflow2021* @overmemory: number of drops due to memory limit overflow2022* @collisions: number of hash collisions2023* @tx_bytes: total number of bytes dequeued2024* @tx_packets: total number of packets dequeued2025* @max_flows: maximum number of flows supported2026*/2027struct cfg80211_txq_stats {2028u32 filled;2029u32 backlog_bytes;2030u32 backlog_packets;2031u32 flows;2032u32 drops;2033u32 ecn_marks;2034u32 overlimit;2035u32 overmemory;2036u32 collisions;2037u32 tx_bytes;2038u32 tx_packets;2039u32 max_flows;2040};20412042/**2043* struct cfg80211_tid_stats - per-TID statistics2044* @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to2045* indicate the relevant values in this struct are filled2046* @rx_msdu: number of received MSDUs2047* @tx_msdu: number of (attempted) transmitted MSDUs2048* @tx_msdu_retries: number of retries (not counting the first) for2049* transmitted MSDUs2050* @tx_msdu_failed: number of failed transmitted MSDUs2051* @txq_stats: TXQ statistics2052*/2053struct cfg80211_tid_stats {2054u32 filled;2055u64 rx_msdu;2056u64 tx_msdu;2057u64 tx_msdu_retries;2058u64 tx_msdu_failed;2059struct cfg80211_txq_stats txq_stats;2060};20612062#define IEEE80211_MAX_CHAINS 420632064/**2065* struct link_station_info - link station information2066*2067* Link station information filled by driver for get_station() and2068* dump_station().2069* @filled: bit flag of flags using the bits of &enum nl80211_sta_info to2070* indicate the relevant values in this struct for them2071* @connected_time: time(in secs) since a link of station is last connected2072* @inactive_time: time since last activity for link station(tx/rx)2073* in milliseconds2074* @assoc_at: bootime (ns) of the last association of link of station2075* @rx_bytes: bytes (size of MPDUs) received from this link of station2076* @tx_bytes: bytes (size of MPDUs) transmitted to this link of station2077* @signal: The signal strength, type depends on the wiphy's signal_type.2078* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2079* @signal_avg: Average signal strength, type depends on the wiphy's2080* signal_type. For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_2081* @chains: bitmask for filled values in @chain_signal, @chain_signal_avg2082* @chain_signal: per-chain signal strength of last received packet in dBm2083* @chain_signal_avg: per-chain signal strength average in dBm2084* @txrate: current unicast bitrate from this link of station2085* @rxrate: current unicast bitrate to this link of station2086* @rx_packets: packets (MSDUs & MMPDUs) received from this link of station2087* @tx_packets: packets (MSDUs & MMPDUs) transmitted to this link of station2088* @tx_retries: cumulative retry counts (MPDUs) for this link of station2089* @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)2090* @rx_dropped_misc: Dropped for un-specified reason.2091* @bss_param: current BSS parameters2092* @beacon_loss_count: Number of times beacon loss event has triggered.2093* @expected_throughput: expected throughput in kbps (including 802.11 headers)2094* towards this station.2095* @rx_beacon: number of beacons received from this peer2096* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received2097* from this peer2098* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer2099* @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer2100* @airtime_weight: current airtime scheduling weight2101* @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last2102* (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.2103* Note that this doesn't use the @filled bit, but is used if non-NULL.2104* @ack_signal: signal strength (in dBm) of the last ACK frame.2105* @avg_ack_signal: average rssi value of ack packet for the no of msdu's has2106* been sent.2107* @rx_mpdu_count: number of MPDUs received from this station2108* @fcs_err_count: number of packets (MPDUs) received from this station with2109* an FCS error. This counter should be incremented only when TA of the2110* received packet with an FCS error matches the peer MAC address.2111* @addr: For MLO STA connection, filled with address of the link of station.2112*/2113struct link_station_info {2114u64 filled;2115u32 connected_time;2116u32 inactive_time;2117u64 assoc_at;2118u64 rx_bytes;2119u64 tx_bytes;2120s8 signal;2121s8 signal_avg;21222123u8 chains;2124s8 chain_signal[IEEE80211_MAX_CHAINS];2125s8 chain_signal_avg[IEEE80211_MAX_CHAINS];21262127struct rate_info txrate;2128struct rate_info rxrate;2129u32 rx_packets;2130u32 tx_packets;2131u32 tx_retries;2132u32 tx_failed;2133u32 rx_dropped_misc;2134struct sta_bss_parameters bss_param;21352136u32 beacon_loss_count;21372138u32 expected_throughput;21392140u64 tx_duration;2141u64 rx_duration;2142u64 rx_beacon;2143u8 rx_beacon_signal_avg;21442145u16 airtime_weight;21462147s8 ack_signal;2148s8 avg_ack_signal;2149struct cfg80211_tid_stats *pertid;21502151u32 rx_mpdu_count;2152u32 fcs_err_count;21532154u8 addr[ETH_ALEN] __aligned(2);2155};21562157/**2158* struct station_info - station information2159*2160* Station information filled by driver for get_station() and dump_station.2161*2162* @filled: bitflag of flags using the bits of &enum nl80211_sta_info to2163* indicate the relevant values in this struct for them2164* @connected_time: time(in secs) since a station is last connected2165* @inactive_time: time since last station activity (tx/rx) in milliseconds2166* @assoc_at: bootime (ns) of the last association2167* @rx_bytes: bytes (size of MPDUs) received from this station2168* @tx_bytes: bytes (size of MPDUs) transmitted to this station2169* @signal: The signal strength, type depends on the wiphy's signal_type.2170* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2171* @signal_avg: Average signal strength, type depends on the wiphy's signal_type.2172* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.2173* @chains: bitmask for filled values in @chain_signal, @chain_signal_avg2174* @chain_signal: per-chain signal strength of last received packet in dBm2175* @chain_signal_avg: per-chain signal strength average in dBm2176* @txrate: current unicast bitrate from this station2177* @rxrate: current unicast bitrate to this station2178* @rx_packets: packets (MSDUs & MMPDUs) received from this station2179* @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station2180* @tx_retries: cumulative retry counts (MPDUs)2181* @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)2182* @rx_dropped_misc: Dropped for un-specified reason.2183* @bss_param: current BSS parameters2184* @generation: generation number for nl80211 dumps.2185* This number should increase every time the list of stations2186* changes, i.e. when a station is added or removed, so that2187* userspace can tell whether it got a consistent snapshot.2188* @beacon_loss_count: Number of times beacon loss event has triggered.2189* @assoc_req_ies: IEs from (Re)Association Request.2190* This is used only when in AP mode with drivers that do not use2191* user space MLME/SME implementation. The information is provided for2192* the cfg80211_new_sta() calls to notify user space of the IEs.2193* @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.2194* @sta_flags: station flags mask & values2195* @t_offset: Time offset of the station relative to this host.2196* @llid: mesh local link id2197* @plid: mesh peer link id2198* @plink_state: mesh peer link state2199* @connected_to_gate: true if mesh STA has a path to mesh gate2200* @connected_to_as: true if mesh STA has a path to authentication server2201* @airtime_link_metric: mesh airtime link metric.2202* @local_pm: local mesh STA power save mode2203* @peer_pm: peer mesh STA power save mode2204* @nonpeer_pm: non-peer mesh STA power save mode2205* @expected_throughput: expected throughput in kbps (including 802.11 headers)2206* towards this station.2207* @rx_beacon: number of beacons received from this peer2208* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received2209* from this peer2210* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer2211* @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer2212* @airtime_weight: current airtime scheduling weight2213* @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last2214* (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.2215* Note that this doesn't use the @filled bit, but is used if non-NULL.2216* @ack_signal: signal strength (in dBm) of the last ACK frame.2217* @avg_ack_signal: average rssi value of ack packet for the no of msdu's has2218* been sent.2219* @rx_mpdu_count: number of MPDUs received from this station2220* @fcs_err_count: number of packets (MPDUs) received from this station with2221* an FCS error. This counter should be incremented only when TA of the2222* received packet with an FCS error matches the peer MAC address.2223* @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled2224* by driver. Drivers use this only in cfg80211_new_sta() calls when AP2225* MLD's MLME/SME is offload to driver. Drivers won't fill this2226* information in cfg80211_del_sta_sinfo(), get_station() and2227* dump_station() callbacks.2228* @assoc_link_id: Indicates MLO link ID of the AP, with which the station2229* completed (re)association. This information filled for both MLO2230* and non-MLO STA connections when the AP affiliated with an MLD.2231* @mld_addr: For MLO STA connection, filled with MLD address of the station.2232* For non-MLO STA connection, filled with all zeros.2233* @assoc_resp_ies: IEs from (Re)Association Response.2234* This is used only when in AP mode with drivers that do not use user2235* space MLME/SME implementation. The information is provided only for the2236* cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't2237* fill this information in cfg80211_del_sta_sinfo(), get_station() and2238* dump_station() callbacks. User space needs this information to determine2239* the accepted and rejected affiliated links of the connected station.2240* @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.2241* @valid_links: bitmap of valid links, or 0 for non-MLO. Drivers fill this2242* information in cfg80211_new_sta(), cfg80211_del_sta_sinfo(),2243* get_station() and dump_station() callbacks.2244* @links: reference to Link sta entries for MLO STA, all link specific2245* information is accessed through links[link_id].2246*/2247struct station_info {2248u64 filled;2249u32 connected_time;2250u32 inactive_time;2251u64 assoc_at;2252u64 rx_bytes;2253u64 tx_bytes;2254s8 signal;2255s8 signal_avg;22562257u8 chains;2258s8 chain_signal[IEEE80211_MAX_CHAINS];2259s8 chain_signal_avg[IEEE80211_MAX_CHAINS];22602261struct rate_info txrate;2262struct rate_info rxrate;2263u32 rx_packets;2264u32 tx_packets;2265u32 tx_retries;2266u32 tx_failed;2267u32 rx_dropped_misc;2268struct sta_bss_parameters bss_param;2269struct nl80211_sta_flag_update sta_flags;22702271int generation;22722273u32 beacon_loss_count;22742275const u8 *assoc_req_ies;2276size_t assoc_req_ies_len;22772278s64 t_offset;2279u16 llid;2280u16 plid;2281u8 plink_state;2282u8 connected_to_gate;2283u8 connected_to_as;2284u32 airtime_link_metric;2285enum nl80211_mesh_power_mode local_pm;2286enum nl80211_mesh_power_mode peer_pm;2287enum nl80211_mesh_power_mode nonpeer_pm;22882289u32 expected_throughput;22902291u16 airtime_weight;22922293s8 ack_signal;2294s8 avg_ack_signal;2295struct cfg80211_tid_stats *pertid;22962297u64 tx_duration;2298u64 rx_duration;2299u64 rx_beacon;2300u8 rx_beacon_signal_avg;23012302u32 rx_mpdu_count;2303u32 fcs_err_count;23042305bool mlo_params_valid;2306u8 assoc_link_id;2307u8 mld_addr[ETH_ALEN] __aligned(2);2308const u8 *assoc_resp_ies;2309size_t assoc_resp_ies_len;23102311u16 valid_links;2312struct link_station_info *links[IEEE80211_MLD_MAX_NUM_LINKS];2313};23142315/**2316* struct cfg80211_sar_sub_specs - sub specs limit2317* @power: power limitation in 0.25dbm2318* @freq_range_index: index the power limitation applies to2319*/2320struct cfg80211_sar_sub_specs {2321s32 power;2322u32 freq_range_index;2323};23242325/**2326* struct cfg80211_sar_specs - sar limit specs2327* @type: it's set with power in 0.25dbm or other types2328* @num_sub_specs: number of sar sub specs2329* @sub_specs: memory to hold the sar sub specs2330*/2331struct cfg80211_sar_specs {2332enum nl80211_sar_type type;2333u32 num_sub_specs;2334struct cfg80211_sar_sub_specs sub_specs[] __counted_by(num_sub_specs);2335};233623372338/**2339* struct cfg80211_sar_freq_ranges - sar frequency ranges2340* @start_freq: start range edge frequency2341* @end_freq: end range edge frequency2342*/2343struct cfg80211_sar_freq_ranges {2344u32 start_freq;2345u32 end_freq;2346};23472348/**2349* struct cfg80211_sar_capa - sar limit capability2350* @type: it's set via power in 0.25dbm or other types2351* @num_freq_ranges: number of frequency ranges2352* @freq_ranges: memory to hold the freq ranges.2353*2354* Note: WLAN driver may append new ranges or split an existing2355* range to small ones and then append them.2356*/2357struct cfg80211_sar_capa {2358enum nl80211_sar_type type;2359u32 num_freq_ranges;2360const struct cfg80211_sar_freq_ranges *freq_ranges;2361};23622363#if IS_ENABLED(CONFIG_CFG80211)2364/**2365* cfg80211_get_station - retrieve information about a given station2366* @dev: the device where the station is supposed to be connected to2367* @mac_addr: the mac address of the station of interest2368* @sinfo: pointer to the structure to fill with the information2369*2370* Return: 0 on success and sinfo is filled with the available information2371* otherwise returns a negative error code and the content of sinfo has to be2372* considered undefined.2373*/2374int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,2375struct station_info *sinfo);2376#else2377static inline int cfg80211_get_station(struct net_device *dev,2378const u8 *mac_addr,2379struct station_info *sinfo)2380{2381return -ENOENT;2382}2383#endif23842385/**2386* enum monitor_flags - monitor flags2387*2388* Monitor interface configuration flags. Note that these must be the bits2389* according to the nl80211 flags.2390*2391* @MONITOR_FLAG_CHANGED: set if the flags were changed2392* @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS2393* @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP2394* @MONITOR_FLAG_CONTROL: pass control frames2395* @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering2396* @MONITOR_FLAG_COOK_FRAMES: deprecated, will unconditionally be refused2397* @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address2398* @MONITOR_FLAG_SKIP_TX: do not pass locally transmitted frames2399*/2400enum monitor_flags {2401MONITOR_FLAG_CHANGED = BIT(__NL80211_MNTR_FLAG_INVALID),2402MONITOR_FLAG_FCSFAIL = BIT(NL80211_MNTR_FLAG_FCSFAIL),2403MONITOR_FLAG_PLCPFAIL = BIT(NL80211_MNTR_FLAG_PLCPFAIL),2404MONITOR_FLAG_CONTROL = BIT(NL80211_MNTR_FLAG_CONTROL),2405MONITOR_FLAG_OTHER_BSS = BIT(NL80211_MNTR_FLAG_OTHER_BSS),2406MONITOR_FLAG_COOK_FRAMES = BIT(NL80211_MNTR_FLAG_COOK_FRAMES),2407MONITOR_FLAG_ACTIVE = BIT(NL80211_MNTR_FLAG_ACTIVE),2408MONITOR_FLAG_SKIP_TX = BIT(NL80211_MNTR_FLAG_SKIP_TX),2409};24102411/**2412* enum mpath_info_flags - mesh path information flags2413*2414* Used by the driver to indicate which info in &struct mpath_info it has filled2415* in during get_station() or dump_station().2416*2417* @MPATH_INFO_FRAME_QLEN: @frame_qlen filled2418* @MPATH_INFO_SN: @sn filled2419* @MPATH_INFO_METRIC: @metric filled2420* @MPATH_INFO_EXPTIME: @exptime filled2421* @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled2422* @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled2423* @MPATH_INFO_FLAGS: @flags filled2424* @MPATH_INFO_HOP_COUNT: @hop_count filled2425* @MPATH_INFO_PATH_CHANGE: @path_change_count filled2426*/2427enum mpath_info_flags {2428MPATH_INFO_FRAME_QLEN = BIT(0),2429MPATH_INFO_SN = BIT(1),2430MPATH_INFO_METRIC = BIT(2),2431MPATH_INFO_EXPTIME = BIT(3),2432MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),2433MPATH_INFO_DISCOVERY_RETRIES = BIT(5),2434MPATH_INFO_FLAGS = BIT(6),2435MPATH_INFO_HOP_COUNT = BIT(7),2436MPATH_INFO_PATH_CHANGE = BIT(8),2437};24382439/**2440* struct mpath_info - mesh path information2441*2442* Mesh path information filled by driver for get_mpath() and dump_mpath().2443*2444* @filled: bitfield of flags from &enum mpath_info_flags2445* @frame_qlen: number of queued frames for this destination2446* @sn: target sequence number2447* @metric: metric (cost) of this mesh path2448* @exptime: expiration time for the mesh path from now, in msecs2449* @flags: mesh path flags from &enum mesh_path_flags2450* @discovery_timeout: total mesh path discovery timeout, in msecs2451* @discovery_retries: mesh path discovery retries2452* @generation: generation number for nl80211 dumps.2453* This number should increase every time the list of mesh paths2454* changes, i.e. when a station is added or removed, so that2455* userspace can tell whether it got a consistent snapshot.2456* @hop_count: hops to destination2457* @path_change_count: total number of path changes to destination2458*/2459struct mpath_info {2460u32 filled;2461u32 frame_qlen;2462u32 sn;2463u32 metric;2464u32 exptime;2465u32 discovery_timeout;2466u8 discovery_retries;2467u8 flags;2468u8 hop_count;2469u32 path_change_count;24702471int generation;2472};24732474/**2475* enum wiphy_bss_param_flags - bit positions for supported bss parameters.2476*2477* @WIPHY_BSS_PARAM_CTS_PROT: support changing CTS protection.2478* @WIPHY_BSS_PARAM_SHORT_PREAMBLE: support changing short preamble usage.2479* @WIPHY_BSS_PARAM_SHORT_SLOT_TIME: support changing short slot time usage.2480* @WIPHY_BSS_PARAM_BASIC_RATES: support reconfiguring basic rates.2481* @WIPHY_BSS_PARAM_AP_ISOLATE: support changing AP isolation.2482* @WIPHY_BSS_PARAM_HT_OPMODE: support changing HT operating mode.2483* @WIPHY_BSS_PARAM_P2P_CTWINDOW: support reconfiguring ctwindow.2484* @WIPHY_BSS_PARAM_P2P_OPPPS: support changing P2P opportunistic power-save.2485*/2486enum wiphy_bss_param_flags {2487WIPHY_BSS_PARAM_CTS_PROT = BIT(0),2488WIPHY_BSS_PARAM_SHORT_PREAMBLE = BIT(1),2489WIPHY_BSS_PARAM_SHORT_SLOT_TIME = BIT(2),2490WIPHY_BSS_PARAM_BASIC_RATES = BIT(3),2491WIPHY_BSS_PARAM_AP_ISOLATE = BIT(4),2492WIPHY_BSS_PARAM_HT_OPMODE = BIT(5),2493WIPHY_BSS_PARAM_P2P_CTWINDOW = BIT(6),2494WIPHY_BSS_PARAM_P2P_OPPPS = BIT(7),2495};24962497/**2498* struct bss_parameters - BSS parameters2499*2500* Used to change BSS parameters (mainly for AP mode).2501*2502* @link_id: link_id or -1 for non-MLD2503* @use_cts_prot: Whether to use CTS protection2504* (0 = no, 1 = yes, -1 = do not change)2505* @use_short_preamble: Whether the use of short preambles is allowed2506* (0 = no, 1 = yes, -1 = do not change)2507* @use_short_slot_time: Whether the use of short slot time is allowed2508* (0 = no, 1 = yes, -1 = do not change)2509* @basic_rates: basic rates in IEEE 802.11 format2510* (or NULL for no change)2511* @basic_rates_len: number of basic rates2512* @ap_isolate: do not forward packets between connected stations2513* (0 = no, 1 = yes, -1 = do not change)2514* @ht_opmode: HT Operation mode2515* (u16 = opmode, -1 = do not change)2516* @p2p_ctwindow: P2P CT Window (-1 = no change)2517* @p2p_opp_ps: P2P opportunistic PS (-1 = no change)2518*/2519struct bss_parameters {2520int link_id;2521int use_cts_prot;2522int use_short_preamble;2523int use_short_slot_time;2524const u8 *basic_rates;2525u8 basic_rates_len;2526int ap_isolate;2527int ht_opmode;2528s8 p2p_ctwindow, p2p_opp_ps;2529};25302531/**2532* struct mesh_config - 802.11s mesh configuration2533*2534* These parameters can be changed while the mesh is active.2535*2536* @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used2537* by the Mesh Peering Open message2538* @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units2539* used by the Mesh Peering Open message2540* @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by2541* the mesh peering management to close a mesh peering2542* @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this2543* mesh interface2544* @dot11MeshMaxRetries: the maximum number of peer link open retries that can2545* be sent to establish a new peer link instance in a mesh2546* @dot11MeshTTL: the value of TTL field set at a source mesh STA2547* @element_ttl: the value of TTL field set at a mesh STA for path selection2548* elements2549* @auto_open_plinks: whether we should automatically open peer links when we2550* detect compatible mesh peers2551* @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to2552* synchronize to for 11s default synchronization method2553* @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ2554* that an originator mesh STA can send to a particular path target2555* @path_refresh_time: how frequently to refresh mesh paths in milliseconds2556* @min_discovery_timeout: the minimum length of time to wait until giving up on2557* a path discovery in milliseconds2558* @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs2559* receiving a PREQ shall consider the forwarding information from the2560* root to be valid. (TU = time unit)2561* @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during2562* which a mesh STA can send only one action frame containing a PREQ2563* element2564* @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during2565* which a mesh STA can send only one Action frame containing a PERR2566* element2567* @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that2568* it takes for an HWMP information element to propagate across the mesh2569* @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA2570* @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root2571* announcements are transmitted2572* @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh2573* station has access to a broader network beyond the MBSS. (This is2574* missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true2575* only means that the station will announce others it's a mesh gate, but2576* not necessarily using the gate announcement protocol. Still keeping the2577* same nomenclature to be in sync with the spec)2578* @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding2579* entity (default is TRUE - forwarding entity)2580* @rssi_threshold: the threshold for average signal strength of candidate2581* station to establish a peer link2582* @ht_opmode: mesh HT protection mode2583*2584* @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs2585* receiving a proactive PREQ shall consider the forwarding information to2586* the root mesh STA to be valid.2587*2588* @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive2589* PREQs are transmitted.2590* @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)2591* during which a mesh STA can send only one Action frame containing2592* a PREQ element for root path confirmation.2593* @power_mode: The default mesh power save mode which will be the initial2594* setting for new peer links.2595* @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake2596* after transmitting its beacon.2597* @plink_timeout: If no tx activity is seen from a STA we've established2598* peering with for longer than this time (in seconds), then remove it2599* from the STA's list of peers. Default is 30 minutes.2600* @dot11MeshConnectedToAuthServer: if set to true then this mesh STA2601* will advertise that it is connected to a authentication server2602* in the mesh formation field.2603* @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is2604* connected to a mesh gate in mesh formation info. If false, the2605* value in mesh formation is determined by the presence of root paths2606* in the mesh path table2607* @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP2608* for HWMP) if the destination is a direct neighbor. Note that this might2609* not be the optimal decision as a multi-hop route might be better. So2610* if using this setting you will likely also want to disable2611* dot11MeshForwarding and use another mesh routing protocol on top.2612*/2613struct mesh_config {2614u16 dot11MeshRetryTimeout;2615u16 dot11MeshConfirmTimeout;2616u16 dot11MeshHoldingTimeout;2617u16 dot11MeshMaxPeerLinks;2618u8 dot11MeshMaxRetries;2619u8 dot11MeshTTL;2620u8 element_ttl;2621bool auto_open_plinks;2622u32 dot11MeshNbrOffsetMaxNeighbor;2623u8 dot11MeshHWMPmaxPREQretries;2624u32 path_refresh_time;2625u16 min_discovery_timeout;2626u32 dot11MeshHWMPactivePathTimeout;2627u16 dot11MeshHWMPpreqMinInterval;2628u16 dot11MeshHWMPperrMinInterval;2629u16 dot11MeshHWMPnetDiameterTraversalTime;2630u8 dot11MeshHWMPRootMode;2631bool dot11MeshConnectedToMeshGate;2632bool dot11MeshConnectedToAuthServer;2633u16 dot11MeshHWMPRannInterval;2634bool dot11MeshGateAnnouncementProtocol;2635bool dot11MeshForwarding;2636s32 rssi_threshold;2637u16 ht_opmode;2638u32 dot11MeshHWMPactivePathToRootTimeout;2639u16 dot11MeshHWMProotInterval;2640u16 dot11MeshHWMPconfirmationInterval;2641enum nl80211_mesh_power_mode power_mode;2642u16 dot11MeshAwakeWindowDuration;2643u32 plink_timeout;2644bool dot11MeshNolearn;2645};26462647/**2648* struct mesh_setup - 802.11s mesh setup configuration2649* @chandef: defines the channel to use2650* @mesh_id: the mesh ID2651* @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes2652* @sync_method: which synchronization method to use2653* @path_sel_proto: which path selection protocol to use2654* @path_metric: which metric to use2655* @auth_id: which authentication method this mesh is using2656* @ie: vendor information elements (optional)2657* @ie_len: length of vendor information elements2658* @is_authenticated: this mesh requires authentication2659* @is_secure: this mesh uses security2660* @user_mpm: userspace handles all MPM functions2661* @dtim_period: DTIM period to use2662* @beacon_interval: beacon interval to use2663* @mcast_rate: multicast rate for Mesh Node [6Mbps is the default for 802.11a]2664* @basic_rates: basic rates to use when creating the mesh2665* @beacon_rate: bitrate to be used for beacons2666* @userspace_handles_dfs: whether user space controls DFS operation, i.e.2667* changes the channel when a radar is detected. This is required2668* to operate on DFS channels.2669* @control_port_over_nl80211: TRUE if userspace expects to exchange control2670* port frames over NL80211 instead of the network interface.2671*2672* These parameters are fixed when the mesh is created.2673*/2674struct mesh_setup {2675struct cfg80211_chan_def chandef;2676const u8 *mesh_id;2677u8 mesh_id_len;2678u8 sync_method;2679u8 path_sel_proto;2680u8 path_metric;2681u8 auth_id;2682const u8 *ie;2683u8 ie_len;2684bool is_authenticated;2685bool is_secure;2686bool user_mpm;2687u8 dtim_period;2688u16 beacon_interval;2689int mcast_rate[NUM_NL80211_BANDS];2690u32 basic_rates;2691struct cfg80211_bitrate_mask beacon_rate;2692bool userspace_handles_dfs;2693bool control_port_over_nl80211;2694};26952696/**2697* struct ocb_setup - 802.11p OCB mode setup configuration2698* @chandef: defines the channel to use2699*2700* These parameters are fixed when connecting to the network2701*/2702struct ocb_setup {2703struct cfg80211_chan_def chandef;2704};27052706/**2707* struct ieee80211_txq_params - TX queue parameters2708* @ac: AC identifier2709* @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled2710* @cwmin: Minimum contention window [a value of the form 2^n-1 in the range2711* 1..32767]2712* @cwmax: Maximum contention window [a value of the form 2^n-1 in the range2713* 1..32767]2714* @aifs: Arbitration interframe space [0..255]2715* @link_id: link_id or -1 for non-MLD2716*/2717struct ieee80211_txq_params {2718enum nl80211_ac ac;2719u16 txop;2720u16 cwmin;2721u16 cwmax;2722u8 aifs;2723int link_id;2724};27252726/**2727* DOC: Scanning and BSS list handling2728*2729* The scanning process itself is fairly simple, but cfg80211 offers quite2730* a bit of helper functionality. To start a scan, the scan operation will2731* be invoked with a scan definition. This scan definition contains the2732* channels to scan, and the SSIDs to send probe requests for (including the2733* wildcard, if desired). A passive scan is indicated by having no SSIDs to2734* probe. Additionally, a scan request may contain extra information elements2735* that should be added to the probe request. The IEs are guaranteed to be2736* well-formed, and will not exceed the maximum length the driver advertised2737* in the wiphy structure.2738*2739* When scanning finds a BSS, cfg80211 needs to be notified of that, because2740* it is responsible for maintaining the BSS list; the driver should not2741* maintain a list itself. For this notification, various functions exist.2742*2743* Since drivers do not maintain a BSS list, there are also a number of2744* functions to search for a BSS and obtain information about it from the2745* BSS structure cfg80211 maintains. The BSS list is also made available2746* to userspace.2747*/27482749/**2750* struct cfg80211_ssid - SSID description2751* @ssid: the SSID2752* @ssid_len: length of the ssid2753*/2754struct cfg80211_ssid {2755u8 ssid[IEEE80211_MAX_SSID_LEN];2756u8 ssid_len;2757};27582759/**2760* struct cfg80211_scan_info - information about completed scan2761* @scan_start_tsf: scan start time in terms of the TSF of the BSS that the2762* wireless device that requested the scan is connected to. If this2763* information is not available, this field is left zero.2764* @tsf_bssid: the BSSID according to which %scan_start_tsf is set.2765* @aborted: set to true if the scan was aborted for any reason,2766* userspace will be notified of that2767*/2768struct cfg80211_scan_info {2769u64 scan_start_tsf;2770u8 tsf_bssid[ETH_ALEN] __aligned(2);2771bool aborted;2772};27732774/**2775* struct cfg80211_scan_6ghz_params - relevant for 6 GHz only2776*2777* @short_ssid: short ssid to scan for2778* @bssid: bssid to scan for2779* @channel_idx: idx of the channel in the channel array in the scan request2780* which the above info is relevant to2781* @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU2782* @short_ssid_valid: @short_ssid is valid and can be used2783* @psc_no_listen: when set, and the channel is a PSC channel, no need to wait2784* 20 TUs before starting to send probe requests.2785* @psd_20: The AP's 20 MHz PSD value.2786*/2787struct cfg80211_scan_6ghz_params {2788u32 short_ssid;2789u32 channel_idx;2790u8 bssid[ETH_ALEN];2791bool unsolicited_probe;2792bool short_ssid_valid;2793bool psc_no_listen;2794s8 psd_20;2795};27962797/**2798* struct cfg80211_scan_request - scan request description2799*2800* @ssids: SSIDs to scan for (active scan only)2801* @n_ssids: number of SSIDs2802* @channels: channels to scan on.2803* @n_channels: total number of channels to scan2804* @ie: optional information element(s) to add into Probe Request or %NULL2805* @ie_len: length of ie in octets2806* @duration: how long to listen on each channel, in TUs. If2807* %duration_mandatory is not set, this is the maximum dwell time and2808* the actual dwell time may be shorter.2809* @duration_mandatory: if set, the scan duration must be as specified by the2810* %duration field.2811* @flags: control flags from &enum nl80211_scan_flags2812* @rates: bitmap of rates to advertise for each band2813* @wiphy: the wiphy this was for2814* @scan_start: time (in jiffies) when the scan started2815* @wdev: the wireless device to scan for2816* @no_cck: used to send probe requests at non CCK rate in 2GHz band2817* @mac_addr: MAC address used with randomisation2818* @mac_addr_mask: MAC address mask used with randomisation, bits that2819* are 0 in the mask should be randomised, bits that are 1 should2820* be taken from the @mac_addr2821* @scan_6ghz: relevant for split scan request only,2822* true if this is a 6 GHz scan request2823* @first_part: %true if this is the first part of a split scan request or a2824* scan that was not split. May be %true for a @scan_6ghz scan if no other2825* channels were requested2826* @n_6ghz_params: number of 6 GHz params2827* @scan_6ghz_params: 6 GHz params2828* @bssid: BSSID to scan for (most commonly, the wildcard BSSID)2829* @tsf_report_link_id: for MLO, indicates the link ID of the BSS that should be2830* used for TSF reporting. Can be set to -1 to indicate no preference.2831*/2832struct cfg80211_scan_request {2833struct cfg80211_ssid *ssids;2834int n_ssids;2835u32 n_channels;2836const u8 *ie;2837size_t ie_len;2838u16 duration;2839bool duration_mandatory;2840u32 flags;28412842u32 rates[NUM_NL80211_BANDS];28432844struct wireless_dev *wdev;28452846u8 mac_addr[ETH_ALEN] __aligned(2);2847u8 mac_addr_mask[ETH_ALEN] __aligned(2);2848u8 bssid[ETH_ALEN] __aligned(2);2849struct wiphy *wiphy;2850unsigned long scan_start;2851bool no_cck;2852bool scan_6ghz;2853bool first_part;2854u32 n_6ghz_params;2855struct cfg80211_scan_6ghz_params *scan_6ghz_params;2856s8 tsf_report_link_id;28572858/* keep last */2859struct ieee80211_channel *channels[];2860};28612862static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)2863{2864int i;28652866get_random_bytes(buf, ETH_ALEN);2867for (i = 0; i < ETH_ALEN; i++) {2868buf[i] &= ~mask[i];2869buf[i] |= addr[i] & mask[i];2870}2871}28722873/**2874* struct cfg80211_match_set - sets of attributes to match2875*2876* @ssid: SSID to be matched; may be zero-length in case of BSSID match2877* or no match (RSSI only)2878* @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match2879* or no match (RSSI only)2880* @rssi_thold: don't report scan results below this threshold (in s32 dBm)2881*/2882struct cfg80211_match_set {2883struct cfg80211_ssid ssid;2884u8 bssid[ETH_ALEN];2885s32 rssi_thold;2886};28872888/**2889* struct cfg80211_sched_scan_plan - scan plan for scheduled scan2890*2891* @interval: interval between scheduled scan iterations. In seconds.2892* @iterations: number of scan iterations in this scan plan. Zero means2893* infinite loop.2894* The last scan plan will always have this parameter set to zero,2895* all other scan plans will have a finite number of iterations.2896*/2897struct cfg80211_sched_scan_plan {2898u32 interval;2899u32 iterations;2900};29012902/**2903* struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.2904*2905* @band: band of BSS which should match for RSSI level adjustment.2906* @delta: value of RSSI level adjustment.2907*/2908struct cfg80211_bss_select_adjust {2909enum nl80211_band band;2910s8 delta;2911};29122913/**2914* struct cfg80211_sched_scan_request - scheduled scan request description2915*2916* @reqid: identifies this request.2917* @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)2918* @n_ssids: number of SSIDs2919* @n_channels: total number of channels to scan2920* @ie: optional information element(s) to add into Probe Request or %NULL2921* @ie_len: length of ie in octets2922* @flags: control flags from &enum nl80211_scan_flags2923* @match_sets: sets of parameters to be matched for a scan result2924* entry to be considered valid and to be passed to the host2925* (others are filtered out).2926* If omitted, all results are passed.2927* @n_match_sets: number of match sets2928* @report_results: indicates that results were reported for this request2929* @wiphy: the wiphy this was for2930* @dev: the interface2931* @scan_start: start time of the scheduled scan2932* @channels: channels to scan2933* @min_rssi_thold: for drivers only supporting a single threshold, this2934* contains the minimum over all matchsets2935* @mac_addr: MAC address used with randomisation2936* @mac_addr_mask: MAC address mask used with randomisation, bits that2937* are 0 in the mask should be randomised, bits that are 1 should2938* be taken from the @mac_addr2939* @scan_plans: scan plans to be executed in this scheduled scan. Lowest2940* index must be executed first.2941* @n_scan_plans: number of scan plans, at least 1.2942* @rcu_head: RCU callback used to free the struct2943* @owner_nlportid: netlink portid of owner (if this should is a request2944* owned by a particular socket)2945* @nl_owner_dead: netlink owner socket was closed - this request be freed2946* @list: for keeping list of requests.2947* @delay: delay in seconds to use before starting the first scan2948* cycle. The driver may ignore this parameter and start2949* immediately (or at any other time), if this feature is not2950* supported.2951* @relative_rssi_set: Indicates whether @relative_rssi is set or not.2952* @relative_rssi: Relative RSSI threshold in dB to restrict scan result2953* reporting in connected state to cases where a matching BSS is determined2954* to have better or slightly worse RSSI than the current connected BSS.2955* The relative RSSI threshold values are ignored in disconnected state.2956* @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong2957* to the specified band while deciding whether a better BSS is reported2958* using @relative_rssi. If delta is a negative number, the BSSs that2959* belong to the specified band will be penalized by delta dB in relative2960* comparisons.2961*/2962struct cfg80211_sched_scan_request {2963u64 reqid;2964struct cfg80211_ssid *ssids;2965int n_ssids;2966u32 n_channels;2967const u8 *ie;2968size_t ie_len;2969u32 flags;2970struct cfg80211_match_set *match_sets;2971int n_match_sets;2972s32 min_rssi_thold;2973u32 delay;2974struct cfg80211_sched_scan_plan *scan_plans;2975int n_scan_plans;29762977u8 mac_addr[ETH_ALEN] __aligned(2);2978u8 mac_addr_mask[ETH_ALEN] __aligned(2);29792980bool relative_rssi_set;2981s8 relative_rssi;2982struct cfg80211_bss_select_adjust rssi_adjust;29832984/* internal */2985struct wiphy *wiphy;2986struct net_device *dev;2987unsigned long scan_start;2988bool report_results;2989struct rcu_head rcu_head;2990u32 owner_nlportid;2991bool nl_owner_dead;2992struct list_head list;29932994/* keep last */2995struct ieee80211_channel *channels[] __counted_by(n_channels);2996};29972998/**2999* enum cfg80211_signal_type - signal type3000*3001* @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available3002* @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)3003* @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 1003004*/3005enum cfg80211_signal_type {3006CFG80211_SIGNAL_TYPE_NONE,3007CFG80211_SIGNAL_TYPE_MBM,3008CFG80211_SIGNAL_TYPE_UNSPEC,3009};30103011/**3012* struct cfg80211_inform_bss - BSS inform data3013* @chan: channel the frame was received on3014* @signal: signal strength value, according to the wiphy's3015* signal type3016* @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was3017* received; should match the time when the frame was actually3018* received by the device (not just by the host, in case it was3019* buffered on the device) and be accurate to about 10ms.3020* If the frame isn't buffered, just passing the return value of3021* ktime_get_boottime_ns() is likely appropriate.3022* @parent_tsf: the time at the start of reception of the first octet of the3023* timestamp field of the frame. The time is the TSF of the BSS specified3024* by %parent_bssid.3025* @parent_bssid: the BSS according to which %parent_tsf is set. This is set to3026* the BSS that requested the scan in which the beacon/probe was received.3027* @chains: bitmask for filled values in @chain_signal.3028* @chain_signal: per-chain signal strength of last received BSS in dBm.3029* @restrict_use: restrict usage, if not set, assume @use_for is3030* %NL80211_BSS_USE_FOR_NORMAL.3031* @use_for: bitmap of possible usage for this BSS, see3032* &enum nl80211_bss_use_for3033* @cannot_use_reasons: the reasons (bitmap) for not being able to connect,3034* if @restrict_use is set and @use_for is zero (empty); may be 0 for3035* unspecified reasons; see &enum nl80211_bss_cannot_use_reasons3036* @drv_data: Data to be passed through to @inform_bss3037*/3038struct cfg80211_inform_bss {3039struct ieee80211_channel *chan;3040s32 signal;3041u64 boottime_ns;3042u64 parent_tsf;3043u8 parent_bssid[ETH_ALEN] __aligned(2);3044u8 chains;3045s8 chain_signal[IEEE80211_MAX_CHAINS];30463047u8 restrict_use:1, use_for:7;3048u8 cannot_use_reasons;30493050void *drv_data;3051};30523053/**3054* struct cfg80211_bss_ies - BSS entry IE data3055* @tsf: TSF contained in the frame that carried these IEs3056* @rcu_head: internal use, for freeing3057* @len: length of the IEs3058* @from_beacon: these IEs are known to come from a beacon3059* @data: IE data3060*/3061struct cfg80211_bss_ies {3062u64 tsf;3063struct rcu_head rcu_head;3064int len;3065bool from_beacon;3066u8 data[];3067};30683069/**3070* struct cfg80211_bss - BSS description3071*3072* This structure describes a BSS (which may also be a mesh network)3073* for use in scan results and similar.3074*3075* @channel: channel this BSS is on3076* @bssid: BSSID of the BSS3077* @beacon_interval: the beacon interval as from the frame3078* @capability: the capability field in host byte order3079* @ies: the information elements (Note that there is no guarantee that these3080* are well-formed!); this is a pointer to either the beacon_ies or3081* proberesp_ies depending on whether Probe Response frame has been3082* received. It is always non-%NULL.3083* @beacon_ies: the information elements from the last Beacon frame3084* (implementation note: if @hidden_beacon_bss is set this struct doesn't3085* own the beacon_ies, but they're just pointers to the ones from the3086* @hidden_beacon_bss struct)3087* @proberesp_ies: the information elements from the last Probe Response frame3088* @proberesp_ecsa_stuck: ECSA element is stuck in the Probe Response frame,3089* cannot rely on it having valid data3090* @hidden_beacon_bss: in case this BSS struct represents a probe response from3091* a BSS that hides the SSID in its beacon, this points to the BSS struct3092* that holds the beacon data. @beacon_ies is still valid, of course, and3093* points to the same data as hidden_beacon_bss->beacon_ies in that case.3094* @transmitted_bss: pointer to the transmitted BSS, if this is a3095* non-transmitted one (multi-BSSID support)3096* @nontrans_list: list of non-transmitted BSS, if this is a transmitted one3097* (multi-BSSID support)3098* @signal: signal strength value (type depends on the wiphy's signal_type)3099* @ts_boottime: timestamp of the last BSS update in nanoseconds since boot3100* @chains: bitmask for filled values in @chain_signal.3101* @chain_signal: per-chain signal strength of last received BSS in dBm.3102* @bssid_index: index in the multiple BSS set3103* @max_bssid_indicator: max number of members in the BSS set3104* @use_for: bitmap of possible usage for this BSS, see3105* &enum nl80211_bss_use_for3106* @cannot_use_reasons: the reasons (bitmap) for not being able to connect,3107* if @restrict_use is set and @use_for is zero (empty); may be 0 for3108* unspecified reasons; see &enum nl80211_bss_cannot_use_reasons3109* @priv: private area for driver use, has at least wiphy->bss_priv_size bytes3110*/3111struct cfg80211_bss {3112struct ieee80211_channel *channel;31133114const struct cfg80211_bss_ies __rcu *ies;3115const struct cfg80211_bss_ies __rcu *beacon_ies;3116const struct cfg80211_bss_ies __rcu *proberesp_ies;31173118struct cfg80211_bss *hidden_beacon_bss;3119struct cfg80211_bss *transmitted_bss;3120struct list_head nontrans_list;31213122s32 signal;31233124u64 ts_boottime;31253126u16 beacon_interval;3127u16 capability;31283129u8 bssid[ETH_ALEN];3130u8 chains;3131s8 chain_signal[IEEE80211_MAX_CHAINS];31323133u8 proberesp_ecsa_stuck:1;31343135u8 bssid_index;3136u8 max_bssid_indicator;31373138u8 use_for;3139u8 cannot_use_reasons;31403141u8 priv[] __aligned(sizeof(void *));3142};31433144/**3145* ieee80211_bss_get_elem - find element with given ID3146* @bss: the bss to search3147* @id: the element ID3148*3149* Note that the return value is an RCU-protected pointer, so3150* rcu_read_lock() must be held when calling this function.3151* Return: %NULL if not found.3152*/3153const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);31543155/**3156* ieee80211_bss_get_ie - find IE with given ID3157* @bss: the bss to search3158* @id: the element ID3159*3160* Note that the return value is an RCU-protected pointer, so3161* rcu_read_lock() must be held when calling this function.3162* Return: %NULL if not found.3163*/3164static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)3165{3166return (const void *)ieee80211_bss_get_elem(bss, id);3167}316831693170/**3171* struct cfg80211_auth_request - Authentication request data3172*3173* This structure provides information needed to complete IEEE 802.113174* authentication.3175*3176* @bss: The BSS to authenticate with, the callee must obtain a reference3177* to it if it needs to keep it.3178* @supported_selectors: List of selectors that should be assumed to be3179* supported by the station.3180* SAE_H2E must be assumed supported if set to %NULL.3181* @supported_selectors_len: Length of supported_selectors in octets.3182* @auth_type: Authentication type (algorithm)3183* @ie: Extra IEs to add to Authentication frame or %NULL3184* @ie_len: Length of ie buffer in octets3185* @key_len: length of WEP key for shared key authentication3186* @key_idx: index of WEP key for shared key authentication3187* @key: WEP key for shared key authentication3188* @auth_data: Fields and elements in Authentication frames. This contains3189* the authentication frame body (non-IE and IE data), excluding the3190* Authentication algorithm number, i.e., starting at the Authentication3191* transaction sequence number field.3192* @auth_data_len: Length of auth_data buffer in octets3193* @link_id: if >= 0, indicates authentication should be done as an MLD,3194* the interface address is included as the MLD address and the3195* necessary link (with the given link_id) will be created (and3196* given an MLD address) by the driver3197* @ap_mld_addr: AP MLD address in case of authentication request with3198* an AP MLD, valid iff @link_id >= 03199*/3200struct cfg80211_auth_request {3201struct cfg80211_bss *bss;3202const u8 *ie;3203size_t ie_len;3204const u8 *supported_selectors;3205u8 supported_selectors_len;3206enum nl80211_auth_type auth_type;3207const u8 *key;3208u8 key_len;3209s8 key_idx;3210const u8 *auth_data;3211size_t auth_data_len;3212s8 link_id;3213const u8 *ap_mld_addr;3214};32153216/**3217* struct cfg80211_assoc_link - per-link information for MLO association3218* @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;3219* if this is %NULL for a link, that link is not requested3220* @elems: extra elements for the per-STA profile for this link3221* @elems_len: length of the elements3222* @disabled: If set this link should be included during association etc. but it3223* should not be used until enabled by the AP MLD.3224* @error: per-link error code, must be <= 0. If there is an error, then the3225* operation as a whole must fail.3226*/3227struct cfg80211_assoc_link {3228struct cfg80211_bss *bss;3229const u8 *elems;3230size_t elems_len;3231bool disabled;3232int error;3233};32343235/**3236* struct cfg80211_ml_reconf_req - MLO link reconfiguration request3237* @add_links: data for links to add, see &struct cfg80211_assoc_link3238* @rem_links: bitmap of links to remove3239* @ext_mld_capa_ops: extended MLD capabilities and operations set by3240* userspace for the ML reconfiguration action frame3241*/3242struct cfg80211_ml_reconf_req {3243struct cfg80211_assoc_link add_links[IEEE80211_MLD_MAX_NUM_LINKS];3244u16 rem_links;3245u16 ext_mld_capa_ops;3246};32473248/**3249* enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.3250*3251* @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)3252* @ASSOC_REQ_DISABLE_VHT: Disable VHT3253* @ASSOC_REQ_USE_RRM: Declare RRM capability in this association3254* @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external3255* authentication capability. Drivers can offload authentication to3256* userspace if this flag is set. Only applicable for cfg80211_connect()3257* request (connect callback).3258* @ASSOC_REQ_DISABLE_HE: Disable HE3259* @ASSOC_REQ_DISABLE_EHT: Disable EHT3260* @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.3261* Drivers shall disable MLO features for the current association if this3262* flag is not set.3263* @ASSOC_REQ_SPP_AMSDU: SPP A-MSDUs will be used on this connection (if any)3264*/3265enum cfg80211_assoc_req_flags {3266ASSOC_REQ_DISABLE_HT = BIT(0),3267ASSOC_REQ_DISABLE_VHT = BIT(1),3268ASSOC_REQ_USE_RRM = BIT(2),3269CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),3270ASSOC_REQ_DISABLE_HE = BIT(4),3271ASSOC_REQ_DISABLE_EHT = BIT(5),3272CONNECT_REQ_MLO_SUPPORT = BIT(6),3273ASSOC_REQ_SPP_AMSDU = BIT(7),3274};32753276/**3277* struct cfg80211_assoc_request - (Re)Association request data3278*3279* This structure provides information needed to complete IEEE 802.113280* (re)association.3281* @bss: The BSS to associate with. If the call is successful the driver is3282* given a reference that it must give back to cfg80211_send_rx_assoc()3283* or to cfg80211_assoc_timeout(). To ensure proper refcounting, new3284* association requests while already associating must be rejected.3285* This also applies to the @links.bss parameter, which is used instead3286* of this one (it is %NULL) for MLO associations.3287* @ie: Extra IEs to add to (Re)Association Request frame or %NULL3288* @ie_len: Length of ie buffer in octets3289* @use_mfp: Use management frame protection (IEEE 802.11w) in this association3290* @crypto: crypto settings3291* @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used3292* to indicate a request to reassociate within the ESS instead of a request3293* do the initial association with the ESS. When included, this is set to3294* the BSSID of the current association, i.e., to the value that is3295* included in the Current AP address field of the Reassociation Request3296* frame.3297* @flags: See &enum cfg80211_assoc_req_flags3298* @supported_selectors: supported BSS selectors in IEEE 802.11 format3299* (or %NULL for no change).3300* If %NULL, then support for SAE_H2E should be assumed.3301* @supported_selectors_len: number of supported BSS selectors3302* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3303* will be used in ht_capa. Un-supported values will be ignored.3304* @ht_capa_mask: The bits of ht_capa which are to be used.3305* @vht_capa: VHT capability override3306* @vht_capa_mask: VHT capability mask indicating which fields to use3307* @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or3308* %NULL if FILS is not used.3309* @fils_kek_len: Length of fils_kek in octets3310* @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association3311* Request/Response frame or %NULL if FILS is not used. This field starts3312* with 16 octets of STA Nonce followed by 16 octets of AP Nonce.3313* @s1g_capa: S1G capability override3314* @s1g_capa_mask: S1G capability override mask3315* @links: per-link information for MLO connections3316* @link_id: >= 0 for MLO connections, where links are given, and indicates3317* the link on which the association request should be sent3318* @ap_mld_addr: AP MLD address in case of MLO association request,3319* valid iff @link_id >= 03320* @ext_mld_capa_ops: extended MLD capabilities and operations set by3321* userspace for the association3322*/3323struct cfg80211_assoc_request {3324struct cfg80211_bss *bss;3325const u8 *ie, *prev_bssid;3326size_t ie_len;3327struct cfg80211_crypto_settings crypto;3328bool use_mfp;3329u32 flags;3330const u8 *supported_selectors;3331u8 supported_selectors_len;3332struct ieee80211_ht_cap ht_capa;3333struct ieee80211_ht_cap ht_capa_mask;3334struct ieee80211_vht_cap vht_capa, vht_capa_mask;3335const u8 *fils_kek;3336size_t fils_kek_len;3337const u8 *fils_nonces;3338struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;3339struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];3340const u8 *ap_mld_addr;3341s8 link_id;3342u16 ext_mld_capa_ops;3343};33443345/**3346* struct cfg80211_deauth_request - Deauthentication request data3347*3348* This structure provides information needed to complete IEEE 802.113349* deauthentication.3350*3351* @bssid: the BSSID or AP MLD address to deauthenticate from3352* @ie: Extra IEs to add to Deauthentication frame or %NULL3353* @ie_len: Length of ie buffer in octets3354* @reason_code: The reason code for the deauthentication3355* @local_state_change: if set, change local state only and3356* do not set a deauth frame3357*/3358struct cfg80211_deauth_request {3359const u8 *bssid;3360const u8 *ie;3361size_t ie_len;3362u16 reason_code;3363bool local_state_change;3364};33653366/**3367* struct cfg80211_disassoc_request - Disassociation request data3368*3369* This structure provides information needed to complete IEEE 802.113370* disassociation.3371*3372* @ap_addr: the BSSID or AP MLD address to disassociate from3373* @ie: Extra IEs to add to Disassociation frame or %NULL3374* @ie_len: Length of ie buffer in octets3375* @reason_code: The reason code for the disassociation3376* @local_state_change: This is a request for a local state only, i.e., no3377* Disassociation frame is to be transmitted.3378*/3379struct cfg80211_disassoc_request {3380const u8 *ap_addr;3381const u8 *ie;3382size_t ie_len;3383u16 reason_code;3384bool local_state_change;3385};33863387/**3388* struct cfg80211_ibss_params - IBSS parameters3389*3390* This structure defines the IBSS parameters for the join_ibss()3391* method.3392*3393* @ssid: The SSID, will always be non-null.3394* @ssid_len: The length of the SSID, will always be non-zero.3395* @bssid: Fixed BSSID requested, maybe be %NULL, if set do not3396* search for IBSSs with a different BSSID.3397* @chandef: defines the channel to use if no other IBSS to join can be found3398* @channel_fixed: The channel should be fixed -- do not search for3399* IBSSs to join on other channels.3400* @ie: information element(s) to include in the beacon3401* @ie_len: length of that3402* @beacon_interval: beacon interval to use3403* @privacy: this is a protected network, keys will be configured3404* after joining3405* @control_port: whether user space controls IEEE 802.1X port, i.e.,3406* sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is3407* required to assume that the port is unauthorized until authorized by3408* user space. Otherwise, port is marked authorized by default.3409* @control_port_over_nl80211: TRUE if userspace expects to exchange control3410* port frames over NL80211 instead of the network interface.3411* @userspace_handles_dfs: whether user space controls DFS operation, i.e.3412* changes the channel when a radar is detected. This is required3413* to operate on DFS channels.3414* @basic_rates: bitmap of basic rates to use when creating the IBSS3415* @mcast_rate: per-band multicast rate index + 1 (0: disabled)3416* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3417* will be used in ht_capa. Un-supported values will be ignored.3418* @ht_capa_mask: The bits of ht_capa which are to be used.3419* @wep_keys: static WEP keys, if not NULL points to an array of3420* CFG80211_MAX_WEP_KEYS WEP keys3421* @wep_tx_key: key index (0..3) of the default TX static WEP key3422*/3423struct cfg80211_ibss_params {3424const u8 *ssid;3425const u8 *bssid;3426struct cfg80211_chan_def chandef;3427const u8 *ie;3428u8 ssid_len, ie_len;3429u16 beacon_interval;3430u32 basic_rates;3431bool channel_fixed;3432bool privacy;3433bool control_port;3434bool control_port_over_nl80211;3435bool userspace_handles_dfs;3436int mcast_rate[NUM_NL80211_BANDS];3437struct ieee80211_ht_cap ht_capa;3438struct ieee80211_ht_cap ht_capa_mask;3439struct key_params *wep_keys;3440int wep_tx_key;3441};34423443/**3444* struct cfg80211_bss_selection - connection parameters for BSS selection.3445*3446* @behaviour: requested BSS selection behaviour.3447* @param: parameters for requestion behaviour.3448* @param.band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.3449* @param.adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.3450*/3451struct cfg80211_bss_selection {3452enum nl80211_bss_select_attr behaviour;3453union {3454enum nl80211_band band_pref;3455struct cfg80211_bss_select_adjust adjust;3456} param;3457};34583459/**3460* struct cfg80211_connect_params - Connection parameters3461*3462* This structure provides information needed to complete IEEE 802.113463* authentication and association.3464*3465* @channel: The channel to use or %NULL if not specified (auto-select based3466* on scan results)3467* @channel_hint: The channel of the recommended BSS for initial connection or3468* %NULL if not specified3469* @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan3470* results)3471* @bssid_hint: The recommended AP BSSID for initial connection to the BSS or3472* %NULL if not specified. Unlike the @bssid parameter, the driver is3473* allowed to ignore this @bssid_hint if it has knowledge of a better BSS3474* to use.3475* @ssid: SSID3476* @ssid_len: Length of ssid in octets3477* @auth_type: Authentication type (algorithm)3478* @ie: IEs for association request3479* @ie_len: Length of assoc_ie in octets3480* @privacy: indicates whether privacy-enabled APs should be used3481* @mfp: indicate whether management frame protection is used3482* @crypto: crypto settings3483* @key_len: length of WEP key for shared key authentication3484* @key_idx: index of WEP key for shared key authentication3485* @key: WEP key for shared key authentication3486* @flags: See &enum cfg80211_assoc_req_flags3487* @bg_scan_period: Background scan period in seconds3488* or -1 to indicate that default value is to be used.3489* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask3490* will be used in ht_capa. Un-supported values will be ignored.3491* @ht_capa_mask: The bits of ht_capa which are to be used.3492* @vht_capa: VHT Capability overrides3493* @vht_capa_mask: The bits of vht_capa which are to be used.3494* @pbss: if set, connect to a PCP instead of AP. Valid for DMG3495* networks.3496* @bss_select: criteria to be used for BSS selection.3497* @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used3498* to indicate a request to reassociate within the ESS instead of a request3499* do the initial association with the ESS. When included, this is set to3500* the BSSID of the current association, i.e., to the value that is3501* included in the Current AP address field of the Reassociation Request3502* frame.3503* @fils_erp_username: EAP re-authentication protocol (ERP) username part of the3504* NAI or %NULL if not specified. This is used to construct FILS wrapped3505* data IE.3506* @fils_erp_username_len: Length of @fils_erp_username in octets.3507* @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or3508* %NULL if not specified. This specifies the domain name of ER server and3509* is used to construct FILS wrapped data IE.3510* @fils_erp_realm_len: Length of @fils_erp_realm in octets.3511* @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP3512* messages. This is also used to construct FILS wrapped data IE.3513* @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional3514* keys in FILS or %NULL if not specified.3515* @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.3516* @want_1x: indicates user-space supports and wants to use 802.1X driver3517* offload of 4-way handshake.3518* @edmg: define the EDMG channels.3519* This may specify multiple channels and bonding options for the driver3520* to choose from, based on BSS configuration.3521*/3522struct cfg80211_connect_params {3523struct ieee80211_channel *channel;3524struct ieee80211_channel *channel_hint;3525const u8 *bssid;3526const u8 *bssid_hint;3527const u8 *ssid;3528size_t ssid_len;3529enum nl80211_auth_type auth_type;3530const u8 *ie;3531size_t ie_len;3532bool privacy;3533enum nl80211_mfp mfp;3534struct cfg80211_crypto_settings crypto;3535const u8 *key;3536u8 key_len, key_idx;3537u32 flags;3538int bg_scan_period;3539struct ieee80211_ht_cap ht_capa;3540struct ieee80211_ht_cap ht_capa_mask;3541struct ieee80211_vht_cap vht_capa;3542struct ieee80211_vht_cap vht_capa_mask;3543bool pbss;3544struct cfg80211_bss_selection bss_select;3545const u8 *prev_bssid;3546const u8 *fils_erp_username;3547size_t fils_erp_username_len;3548const u8 *fils_erp_realm;3549size_t fils_erp_realm_len;3550u16 fils_erp_next_seq_num;3551const u8 *fils_erp_rrk;3552size_t fils_erp_rrk_len;3553bool want_1x;3554struct ieee80211_edmg edmg;3555};35563557/**3558* enum cfg80211_connect_params_changed - Connection parameters being updated3559*3560* This enum provides information of all connect parameters that3561* have to be updated as part of update_connect_params() call.3562*3563* @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated3564* @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,3565* username, erp sequence number and rrk) are updated3566* @UPDATE_AUTH_TYPE: Indicates that authentication type is updated3567*/3568enum cfg80211_connect_params_changed {3569UPDATE_ASSOC_IES = BIT(0),3570UPDATE_FILS_ERP_INFO = BIT(1),3571UPDATE_AUTH_TYPE = BIT(2),3572};35733574/**3575* enum wiphy_params_flags - set_wiphy_params bitfield values3576* @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed3577* @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed3578* @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed3579* @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed3580* @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed3581* @WIPHY_PARAM_DYN_ACK: dynack has been enabled3582* @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed3583* @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed3584* @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum3585*/3586enum wiphy_params_flags {3587WIPHY_PARAM_RETRY_SHORT = BIT(0),3588WIPHY_PARAM_RETRY_LONG = BIT(1),3589WIPHY_PARAM_FRAG_THRESHOLD = BIT(2),3590WIPHY_PARAM_RTS_THRESHOLD = BIT(3),3591WIPHY_PARAM_COVERAGE_CLASS = BIT(4),3592WIPHY_PARAM_DYN_ACK = BIT(5),3593WIPHY_PARAM_TXQ_LIMIT = BIT(6),3594WIPHY_PARAM_TXQ_MEMORY_LIMIT = BIT(7),3595WIPHY_PARAM_TXQ_QUANTUM = BIT(8),3596};35973598#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 25635993600/* The per TXQ device queue limit in airtime */3601#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 50003602#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 1200036033604/* The per interface airtime threshold to switch to lower queue limit */3605#define IEEE80211_AQL_THRESHOLD 2400036063607/**3608* struct cfg80211_pmksa - PMK Security Association3609*3610* This structure is passed to the set/del_pmksa() method for PMKSA3611* caching.3612*3613* @bssid: The AP's BSSID (may be %NULL).3614* @pmkid: The identifier to refer a PMKSA.3615* @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key3616* derivation by a FILS STA. Otherwise, %NULL.3617* @pmk_len: Length of the @pmk. The length of @pmk can differ depending on3618* the hash algorithm used to generate this.3619* @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS3620* cache identifier (may be %NULL).3621* @ssid_len: Length of the @ssid in octets.3622* @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the3623* scope of PMKSA. This is valid only if @ssid_len is non-zero (may be3624* %NULL).3625* @pmk_lifetime: Maximum lifetime for PMKSA in seconds3626* (dot11RSNAConfigPMKLifetime) or 0 if not specified.3627* The configured PMKSA must not be used for PMKSA caching after3628* expiration and any keys derived from this PMK become invalid on3629* expiration, i.e., the current association must be dropped if the PMK3630* used for it expires.3631* @pmk_reauth_threshold: Threshold time for reauthentication (percentage of3632* PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.3633* Drivers are expected to trigger a full authentication instead of using3634* this PMKSA for caching when reassociating to a new BSS after this3635* threshold to generate a new PMK before the current one expires.3636*/3637struct cfg80211_pmksa {3638const u8 *bssid;3639const u8 *pmkid;3640const u8 *pmk;3641size_t pmk_len;3642const u8 *ssid;3643size_t ssid_len;3644const u8 *cache_id;3645u32 pmk_lifetime;3646u8 pmk_reauth_threshold;3647};36483649/**3650* struct cfg80211_pkt_pattern - packet pattern3651* @mask: bitmask where to match pattern and where to ignore bytes,3652* one bit per byte, in same format as nl802113653* @pattern: bytes to match where bitmask is 13654* @pattern_len: length of pattern (in bytes)3655* @pkt_offset: packet offset (in bytes)3656*3657* Internal note: @mask and @pattern are allocated in one chunk of3658* memory, free @mask only!3659*/3660struct cfg80211_pkt_pattern {3661const u8 *mask, *pattern;3662int pattern_len;3663int pkt_offset;3664};36653666/**3667* struct cfg80211_wowlan_tcp - TCP connection parameters3668*3669* @sock: (internal) socket for source port allocation3670* @src: source IP address3671* @dst: destination IP address3672* @dst_mac: destination MAC address3673* @src_port: source port3674* @dst_port: destination port3675* @payload_len: data payload length3676* @payload: data payload buffer3677* @payload_seq: payload sequence stamping configuration3678* @data_interval: interval at which to send data packets3679* @wake_len: wakeup payload match length3680* @wake_data: wakeup payload match data3681* @wake_mask: wakeup payload match mask3682* @tokens_size: length of the tokens buffer3683* @payload_tok: payload token usage configuration3684*/3685struct cfg80211_wowlan_tcp {3686struct socket *sock;3687__be32 src, dst;3688u16 src_port, dst_port;3689u8 dst_mac[ETH_ALEN];3690int payload_len;3691const u8 *payload;3692struct nl80211_wowlan_tcp_data_seq payload_seq;3693u32 data_interval;3694u32 wake_len;3695const u8 *wake_data, *wake_mask;3696u32 tokens_size;3697/* must be last, variable member */3698struct nl80211_wowlan_tcp_data_token payload_tok;3699};37003701/**3702* struct cfg80211_wowlan - Wake on Wireless-LAN support info3703*3704* This structure defines the enabled WoWLAN triggers for the device.3705* @any: wake up on any activity -- special trigger if device continues3706* operating as normal during suspend3707* @disconnect: wake up if getting disconnected3708* @magic_pkt: wake up on receiving magic packet3709* @patterns: wake up on receiving packet matching a pattern3710* @n_patterns: number of patterns3711* @gtk_rekey_failure: wake up on GTK rekey failure3712* @eap_identity_req: wake up on EAP identity request packet3713* @four_way_handshake: wake up on 4-way handshake3714* @rfkill_release: wake up when rfkill is released3715* @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.3716* NULL if not configured.3717* @nd_config: configuration for the scan to be used for net detect wake.3718*/3719struct cfg80211_wowlan {3720bool any, disconnect, magic_pkt, gtk_rekey_failure,3721eap_identity_req, four_way_handshake,3722rfkill_release;3723struct cfg80211_pkt_pattern *patterns;3724struct cfg80211_wowlan_tcp *tcp;3725int n_patterns;3726struct cfg80211_sched_scan_request *nd_config;3727};37283729/**3730* struct cfg80211_coalesce_rules - Coalesce rule parameters3731*3732* This structure defines coalesce rule for the device.3733* @delay: maximum coalescing delay in msecs.3734* @condition: condition for packet coalescence.3735* see &enum nl80211_coalesce_condition.3736* @patterns: array of packet patterns3737* @n_patterns: number of patterns3738*/3739struct cfg80211_coalesce_rules {3740int delay;3741enum nl80211_coalesce_condition condition;3742struct cfg80211_pkt_pattern *patterns;3743int n_patterns;3744};37453746/**3747* struct cfg80211_coalesce - Packet coalescing settings3748*3749* This structure defines coalescing settings.3750* @rules: array of coalesce rules3751* @n_rules: number of rules3752*/3753struct cfg80211_coalesce {3754int n_rules;3755struct cfg80211_coalesce_rules rules[] __counted_by(n_rules);3756};37573758/**3759* struct cfg80211_wowlan_nd_match - information about the match3760*3761* @ssid: SSID of the match that triggered the wake up3762* @n_channels: Number of channels where the match occurred. This3763* value may be zero if the driver can't report the channels.3764* @channels: center frequencies of the channels where a match3765* occurred (in MHz)3766*/3767struct cfg80211_wowlan_nd_match {3768struct cfg80211_ssid ssid;3769int n_channels;3770u32 channels[] __counted_by(n_channels);3771};37723773/**3774* struct cfg80211_wowlan_nd_info - net detect wake up information3775*3776* @n_matches: Number of match information instances provided in3777* @matches. This value may be zero if the driver can't provide3778* match information.3779* @matches: Array of pointers to matches containing information about3780* the matches that triggered the wake up.3781*/3782struct cfg80211_wowlan_nd_info {3783int n_matches;3784struct cfg80211_wowlan_nd_match *matches[] __counted_by(n_matches);3785};37863787/**3788* struct cfg80211_wowlan_wakeup - wakeup report3789* @disconnect: woke up by getting disconnected3790* @magic_pkt: woke up by receiving magic packet3791* @gtk_rekey_failure: woke up by GTK rekey failure3792* @eap_identity_req: woke up by EAP identity request packet3793* @four_way_handshake: woke up by 4-way handshake3794* @rfkill_release: woke up by rfkill being released3795* @pattern_idx: pattern that caused wakeup, -1 if not due to pattern3796* @packet_present_len: copied wakeup packet data3797* @packet_len: original wakeup packet length3798* @packet: The packet causing the wakeup, if any.3799* @packet_80211: For pattern match, magic packet and other data3800* frame triggers an 802.3 frame should be reported, for3801* disconnect due to deauth 802.11 frame. This indicates which3802* it is.3803* @tcp_match: TCP wakeup packet received3804* @tcp_connlost: TCP connection lost or failed to establish3805* @tcp_nomoretokens: TCP data ran out of tokens3806* @net_detect: if not %NULL, woke up because of net detect3807* @unprot_deauth_disassoc: woke up due to unprotected deauth or3808* disassoc frame (in MFP).3809*/3810struct cfg80211_wowlan_wakeup {3811bool disconnect, magic_pkt, gtk_rekey_failure,3812eap_identity_req, four_way_handshake,3813rfkill_release, packet_80211,3814tcp_match, tcp_connlost, tcp_nomoretokens,3815unprot_deauth_disassoc;3816s32 pattern_idx;3817u32 packet_present_len, packet_len;3818const void *packet;3819struct cfg80211_wowlan_nd_info *net_detect;3820};38213822/**3823* struct cfg80211_gtk_rekey_data - rekey data3824* @kek: key encryption key (@kek_len bytes)3825* @kck: key confirmation key (@kck_len bytes)3826* @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)3827* @kek_len: length of kek3828* @kck_len: length of kck3829* @akm: akm (oui, id)3830*/3831struct cfg80211_gtk_rekey_data {3832const u8 *kek, *kck, *replay_ctr;3833u32 akm;3834u8 kek_len, kck_len;3835};38363837/**3838* struct cfg80211_update_ft_ies_params - FT IE Information3839*3840* This structure provides information needed to update the fast transition IE3841*3842* @md: The Mobility Domain ID, 2 Octet value3843* @ie: Fast Transition IEs3844* @ie_len: Length of ft_ie in octets3845*/3846struct cfg80211_update_ft_ies_params {3847u16 md;3848const u8 *ie;3849size_t ie_len;3850};38513852/**3853* struct cfg80211_mgmt_tx_params - mgmt tx parameters3854*3855* This structure provides information needed to transmit a mgmt frame3856*3857* @chan: channel to use3858* @offchan: indicates whether off channel operation is required3859* @wait: duration for ROC3860* @buf: buffer to transmit3861* @len: buffer length3862* @no_cck: don't use cck rates for this frame3863* @dont_wait_for_ack: tells the low level not to wait for an ack3864* @n_csa_offsets: length of csa_offsets array3865* @csa_offsets: array of all the csa offsets in the frame3866* @link_id: for MLO, the link ID to transmit on, -1 if not given; note3867* that the link ID isn't validated (much), it's in range but the3868* link might not exist (or be used by the receiver STA)3869*/3870struct cfg80211_mgmt_tx_params {3871struct ieee80211_channel *chan;3872bool offchan;3873unsigned int wait;3874const u8 *buf;3875size_t len;3876bool no_cck;3877bool dont_wait_for_ack;3878int n_csa_offsets;3879const u16 *csa_offsets;3880int link_id;3881};38823883/**3884* struct cfg80211_dscp_exception - DSCP exception3885*3886* @dscp: DSCP value that does not adhere to the user priority range definition3887* @up: user priority value to which the corresponding DSCP value belongs3888*/3889struct cfg80211_dscp_exception {3890u8 dscp;3891u8 up;3892};38933894/**3895* struct cfg80211_dscp_range - DSCP range definition for user priority3896*3897* @low: lowest DSCP value of this user priority range, inclusive3898* @high: highest DSCP value of this user priority range, inclusive3899*/3900struct cfg80211_dscp_range {3901u8 low;3902u8 high;3903};39043905/* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */3906#define IEEE80211_QOS_MAP_MAX_EX 213907#define IEEE80211_QOS_MAP_LEN_MIN 163908#define IEEE80211_QOS_MAP_LEN_MAX \3909(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)39103911/**3912* struct cfg80211_qos_map - QoS Map Information3913*3914* This struct defines the Interworking QoS map setting for DSCP values3915*3916* @num_des: number of DSCP exceptions (0..21)3917* @dscp_exception: optionally up to maximum of 21 DSCP exceptions from3918* the user priority DSCP range definition3919* @up: DSCP range definition for a particular user priority3920*/3921struct cfg80211_qos_map {3922u8 num_des;3923struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];3924struct cfg80211_dscp_range up[8];3925};39263927/**3928* struct cfg80211_nan_band_config - NAN band specific configuration3929*3930* @chan: Pointer to the IEEE 802.11 channel structure. The channel to be used3931* for NAN operations on this band. For 2.4 GHz band, this is always3932* channel 6. For 5 GHz band, the channel is either 44 or 149, according3933* to the regulatory constraints. If chan pointer is NULL the entire band3934* configuration entry is considered invalid and should not be used.3935* @rssi_close: RSSI close threshold used for NAN state transition algorithm3936* as described in chapters 3.3.6 and 3.3.7 "NAN Device Role and State3937* Transition" of Wi-Fi Aware Specification v4.0. If not3938* specified (set to 0), default device value is used. The value should3939* be greater than -60 dBm.3940* @rssi_middle: RSSI middle threshold used for NAN state transition algorithm.3941* as described in chapters 3.3.6 and 3.3.7 "NAN Device Role and State3942* Transition" of Wi-Fi Aware Specification v4.0. If not3943* specified (set to 0), default device value is used. The value should be3944* greater than -75 dBm and less than rssi_close.3945* @awake_dw_interval: Committed DW interval. Valid values range: 0-5. 03946* indicates no wakeup for DW and can't be used on 2.4GHz band, otherwise3947* 2^(n-1).3948* @disable_scan: If true, the device will not scan this band for cluster3949* merge. Disabling scan on 2.4 GHz band is not allowed.3950*/3951struct cfg80211_nan_band_config {3952struct ieee80211_channel *chan;3953s8 rssi_close;3954s8 rssi_middle;3955u8 awake_dw_interval;3956bool disable_scan;3957};39583959/**3960* struct cfg80211_nan_conf - NAN configuration3961*3962* This struct defines NAN configuration parameters3963*3964* @master_pref: master preference (1 - 255)3965* @bands: operating bands, a bitmap of &enum nl80211_band values.3966* For instance, for NL80211_BAND_2GHZ, bit 0 would be set3967* (i.e. BIT(NL80211_BAND_2GHZ)).3968* @cluster_id: cluster ID used for NAN synchronization. This is a MAC address3969* that can take a value from 50-6F-9A-01-00-00 to 50-6F-9A-01-FF-FF.3970* If NULL, the device will pick a random Cluster ID.3971* @scan_period: period (in seconds) between NAN scans.3972* @scan_dwell_time: dwell time (in milliseconds) for NAN scans.3973* @discovery_beacon_interval: interval (in TUs) for discovery beacons.3974* @enable_dw_notification: flag to enable/disable discovery window3975* notifications.3976* @band_cfgs: array of band specific configurations, indexed by3977* &enum nl80211_band values.3978* @extra_nan_attrs: pointer to additional NAN attributes.3979* @extra_nan_attrs_len: length of the additional NAN attributes.3980* @vendor_elems: pointer to vendor-specific elements.3981* @vendor_elems_len: length of the vendor-specific elements.3982*/3983struct cfg80211_nan_conf {3984u8 master_pref;3985u8 bands;3986const u8 *cluster_id;3987u16 scan_period;3988u16 scan_dwell_time;3989u8 discovery_beacon_interval;3990bool enable_dw_notification;3991struct cfg80211_nan_band_config band_cfgs[NUM_NL80211_BANDS];3992const u8 *extra_nan_attrs;3993u16 extra_nan_attrs_len;3994const u8 *vendor_elems;3995u16 vendor_elems_len;3996};39973998/**3999* enum cfg80211_nan_conf_changes - indicates changed fields in NAN4000* configuration4001*4002* @CFG80211_NAN_CONF_CHANGED_PREF: master preference4003* @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands4004* @CFG80211_NAN_CONF_CHANGED_CONFIG: changed additional configuration.4005* When this flag is set, it indicates that some additional attribute(s)4006* (other then master_pref and bands) have been changed. In this case,4007* all the unchanged attributes will be properly configured to their4008* previous values. The driver doesn't need to store any4009* previous configuration besides master_pref and bands.4010*/4011enum cfg80211_nan_conf_changes {4012CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),4013CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),4014CFG80211_NAN_CONF_CHANGED_CONFIG = BIT(2),4015};40164017/**4018* struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter4019*4020* @filter: the content of the filter4021* @len: the length of the filter4022*/4023struct cfg80211_nan_func_filter {4024const u8 *filter;4025u8 len;4026};40274028/**4029* struct cfg80211_nan_func - a NAN function4030*4031* @type: &enum nl80211_nan_function_type4032* @service_id: the service ID of the function4033* @publish_type: &nl80211_nan_publish_type4034* @close_range: if true, the range should be limited. Threshold is4035* implementation specific.4036* @publish_bcast: if true, the solicited publish should be broadcasted4037* @subscribe_active: if true, the subscribe is active4038* @followup_id: the instance ID for follow up4039* @followup_reqid: the requester instance ID for follow up4040* @followup_dest: MAC address of the recipient of the follow up4041* @ttl: time to live counter in DW.4042* @serv_spec_info: Service Specific Info4043* @serv_spec_info_len: Service Specific Info length4044* @srf_include: if true, SRF is inclusive4045* @srf_bf: Bloom Filter4046* @srf_bf_len: Bloom Filter length4047* @srf_bf_idx: Bloom Filter index4048* @srf_macs: SRF MAC addresses4049* @srf_num_macs: number of MAC addresses in SRF4050* @rx_filters: rx filters that are matched with corresponding peer's tx_filter4051* @tx_filters: filters that should be transmitted in the SDF.4052* @num_rx_filters: length of &rx_filters.4053* @num_tx_filters: length of &tx_filters.4054* @instance_id: driver allocated id of the function.4055* @cookie: unique NAN function identifier.4056*/4057struct cfg80211_nan_func {4058enum nl80211_nan_function_type type;4059u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];4060u8 publish_type;4061bool close_range;4062bool publish_bcast;4063bool subscribe_active;4064u8 followup_id;4065u8 followup_reqid;4066struct mac_address followup_dest;4067u32 ttl;4068const u8 *serv_spec_info;4069u8 serv_spec_info_len;4070bool srf_include;4071const u8 *srf_bf;4072u8 srf_bf_len;4073u8 srf_bf_idx;4074struct mac_address *srf_macs;4075int srf_num_macs;4076struct cfg80211_nan_func_filter *rx_filters;4077struct cfg80211_nan_func_filter *tx_filters;4078u8 num_tx_filters;4079u8 num_rx_filters;4080u8 instance_id;4081u64 cookie;4082};40834084/**4085* struct cfg80211_pmk_conf - PMK configuration4086*4087* @aa: authenticator address4088* @pmk_len: PMK length in bytes.4089* @pmk: the PMK material4090* @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK4091* is not PMK-R0). When pmk_r0_name is not NULL, the pmk field4092* holds PMK-R0.4093*/4094struct cfg80211_pmk_conf {4095const u8 *aa;4096u8 pmk_len;4097const u8 *pmk;4098const u8 *pmk_r0_name;4099};41004101/**4102* struct cfg80211_external_auth_params - Trigger External authentication.4103*4104* Commonly used across the external auth request and event interfaces.4105*4106* @action: action type / trigger for external authentication. Only significant4107* for the authentication request event interface (driver to user space).4108* @bssid: BSSID of the peer with which the authentication has4109* to happen. Used by both the authentication request event and4110* authentication response command interface.4111* @ssid: SSID of the AP. Used by both the authentication request event and4112* authentication response command interface.4113* @key_mgmt_suite: AKM suite of the respective authentication. Used by the4114* authentication request event interface.4115* @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,4116* use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you4117* the real status code for failures. Used only for the authentication4118* response command interface (user space to driver).4119* @pmkid: The identifier to refer a PMKSA.4120* @mld_addr: MLD address of the peer. Used by the authentication request event4121* interface. Driver indicates this to enable MLO during the authentication4122* offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT4123* flag capability in NL80211_CMD_CONNECT to know whether the user space4124* supports enabling MLO during the authentication offload.4125* User space should use the address of the interface (on which the4126* authentication request event reported) as self MLD address. User space4127* and driver should use MLD addresses in RA, TA and BSSID fields of4128* authentication frames sent or received via cfg80211. The driver4129* translates the MLD addresses to/from link addresses based on the link4130* chosen for the authentication.4131*/4132struct cfg80211_external_auth_params {4133enum nl80211_external_auth_action action;4134u8 bssid[ETH_ALEN] __aligned(2);4135struct cfg80211_ssid ssid;4136unsigned int key_mgmt_suite;4137u16 status;4138const u8 *pmkid;4139u8 mld_addr[ETH_ALEN] __aligned(2);4140};41414142/**4143* struct cfg80211_ftm_responder_stats - FTM responder statistics4144*4145* @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to4146* indicate the relevant values in this struct for them4147* @success_num: number of FTM sessions in which all frames were successfully4148* answered4149* @partial_num: number of FTM sessions in which part of frames were4150* successfully answered4151* @failed_num: number of failed FTM sessions4152* @asap_num: number of ASAP FTM sessions4153* @non_asap_num: number of non-ASAP FTM sessions4154* @total_duration_ms: total sessions durations - gives an indication4155* of how much time the responder was busy4156* @unknown_triggers_num: number of unknown FTM triggers - triggers from4157* initiators that didn't finish successfully the negotiation phase with4158* the responder4159* @reschedule_requests_num: number of FTM reschedule requests - initiator asks4160* for a new scheduling although it already has scheduled FTM slot4161* @out_of_window_triggers_num: total FTM triggers out of scheduled window4162*/4163struct cfg80211_ftm_responder_stats {4164u32 filled;4165u32 success_num;4166u32 partial_num;4167u32 failed_num;4168u32 asap_num;4169u32 non_asap_num;4170u64 total_duration_ms;4171u32 unknown_triggers_num;4172u32 reschedule_requests_num;4173u32 out_of_window_triggers_num;4174};41754176/**4177* struct cfg80211_pmsr_ftm_result - FTM result4178* @failure_reason: if this measurement failed (PMSR status is4179* %NL80211_PMSR_STATUS_FAILURE), this gives a more precise4180* reason than just "failure"4181* @burst_index: if reporting partial results, this is the index4182* in [0 .. num_bursts-1] of the burst that's being reported4183* @num_ftmr_attempts: number of FTM request frames transmitted4184* @num_ftmr_successes: number of FTM request frames acked4185* @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,4186* fill this to indicate in how many seconds a retry is deemed possible4187* by the responder4188* @num_bursts_exp: actual number of bursts exponent negotiated4189* @burst_duration: actual burst duration negotiated4190* @ftms_per_burst: actual FTMs per burst negotiated4191* @lci_len: length of LCI information (if present)4192* @civicloc_len: length of civic location information (if present)4193* @lci: LCI data (may be %NULL)4194* @civicloc: civic location data (may be %NULL)4195* @rssi_avg: average RSSI over FTM action frames reported4196* @rssi_spread: spread of the RSSI over FTM action frames reported4197* @tx_rate: bitrate for transmitted FTM action frame response4198* @rx_rate: bitrate of received FTM action frame4199* @rtt_avg: average of RTTs measured (must have either this or @dist_avg)4200* @rtt_variance: variance of RTTs measured (note that standard deviation is4201* the square root of the variance)4202* @rtt_spread: spread of the RTTs measured4203* @dist_avg: average of distances (mm) measured4204* (must have either this or @rtt_avg)4205* @dist_variance: variance of distances measured (see also @rtt_variance)4206* @dist_spread: spread of distances measured (see also @rtt_spread)4207* @num_ftmr_attempts_valid: @num_ftmr_attempts is valid4208* @num_ftmr_successes_valid: @num_ftmr_successes is valid4209* @rssi_avg_valid: @rssi_avg is valid4210* @rssi_spread_valid: @rssi_spread is valid4211* @tx_rate_valid: @tx_rate is valid4212* @rx_rate_valid: @rx_rate is valid4213* @rtt_avg_valid: @rtt_avg is valid4214* @rtt_variance_valid: @rtt_variance is valid4215* @rtt_spread_valid: @rtt_spread is valid4216* @dist_avg_valid: @dist_avg is valid4217* @dist_variance_valid: @dist_variance is valid4218* @dist_spread_valid: @dist_spread is valid4219*/4220struct cfg80211_pmsr_ftm_result {4221const u8 *lci;4222const u8 *civicloc;4223unsigned int lci_len;4224unsigned int civicloc_len;4225enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;4226u32 num_ftmr_attempts, num_ftmr_successes;4227s16 burst_index;4228u8 busy_retry_time;4229u8 num_bursts_exp;4230u8 burst_duration;4231u8 ftms_per_burst;4232s32 rssi_avg;4233s32 rssi_spread;4234struct rate_info tx_rate, rx_rate;4235s64 rtt_avg;4236s64 rtt_variance;4237s64 rtt_spread;4238s64 dist_avg;4239s64 dist_variance;4240s64 dist_spread;42414242u16 num_ftmr_attempts_valid:1,4243num_ftmr_successes_valid:1,4244rssi_avg_valid:1,4245rssi_spread_valid:1,4246tx_rate_valid:1,4247rx_rate_valid:1,4248rtt_avg_valid:1,4249rtt_variance_valid:1,4250rtt_spread_valid:1,4251dist_avg_valid:1,4252dist_variance_valid:1,4253dist_spread_valid:1;4254};42554256/**4257* struct cfg80211_pmsr_result - peer measurement result4258* @addr: address of the peer4259* @host_time: host time (use ktime_get_boottime() adjust to the time when the4260* measurement was made)4261* @ap_tsf: AP's TSF at measurement time4262* @status: status of the measurement4263* @final: if reporting partial results, mark this as the last one; if not4264* reporting partial results always set this flag4265* @ap_tsf_valid: indicates the @ap_tsf value is valid4266* @type: type of the measurement reported, note that we only support reporting4267* one type at a time, but you can report multiple results separately and4268* they're all aggregated for userspace.4269* @ftm: FTM result4270*/4271struct cfg80211_pmsr_result {4272u64 host_time, ap_tsf;4273enum nl80211_peer_measurement_status status;42744275u8 addr[ETH_ALEN];42764277u8 final:1,4278ap_tsf_valid:1;42794280enum nl80211_peer_measurement_type type;42814282union {4283struct cfg80211_pmsr_ftm_result ftm;4284};4285};42864287/**4288* struct cfg80211_pmsr_ftm_request_peer - FTM request data4289* @requested: indicates FTM is requested4290* @preamble: frame preamble to use4291* @burst_period: burst period to use4292* @asap: indicates to use ASAP mode4293* @num_bursts_exp: number of bursts exponent4294* @burst_duration: burst duration4295* @ftms_per_burst: number of FTMs per burst4296* @ftmr_retries: number of retries for FTM request4297* @request_lci: request LCI information4298* @request_civicloc: request civic location information4299* @trigger_based: use trigger based ranging for the measurement4300* If neither @trigger_based nor @non_trigger_based is set,4301* EDCA based ranging will be used.4302* @non_trigger_based: use non trigger based ranging for the measurement4303* If neither @trigger_based nor @non_trigger_based is set,4304* EDCA based ranging will be used.4305* @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either4306* @trigger_based or @non_trigger_based is set.4307* @bss_color: the bss color of the responder. Optional. Set to zero to4308* indicate the driver should set the BSS color. Only valid if4309* @non_trigger_based or @trigger_based is set.4310*4311* See also nl80211 for the respective attribute documentation.4312*/4313struct cfg80211_pmsr_ftm_request_peer {4314enum nl80211_preamble preamble;4315u16 burst_period;4316u8 requested:1,4317asap:1,4318request_lci:1,4319request_civicloc:1,4320trigger_based:1,4321non_trigger_based:1,4322lmr_feedback:1;4323u8 num_bursts_exp;4324u8 burst_duration;4325u8 ftms_per_burst;4326u8 ftmr_retries;4327u8 bss_color;4328};43294330/**4331* struct cfg80211_pmsr_request_peer - peer data for a peer measurement request4332* @addr: MAC address4333* @chandef: channel to use4334* @report_ap_tsf: report the associated AP's TSF4335* @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer4336*/4337struct cfg80211_pmsr_request_peer {4338u8 addr[ETH_ALEN];4339struct cfg80211_chan_def chandef;4340u8 report_ap_tsf:1;4341struct cfg80211_pmsr_ftm_request_peer ftm;4342};43434344/**4345* struct cfg80211_pmsr_request - peer measurement request4346* @cookie: cookie, set by cfg802114347* @nl_portid: netlink portid - used by cfg802114348* @drv_data: driver data for this request, if required for aborting,4349* not otherwise freed or anything by cfg802114350* @mac_addr: MAC address used for (randomised) request4351* @mac_addr_mask: MAC address mask used for randomisation, bits that4352* are 0 in the mask should be randomised, bits that are 1 should4353* be taken from the @mac_addr4354* @list: used by cfg80211 to hold on to the request4355* @timeout: timeout (in milliseconds) for the whole operation, if4356* zero it means there's no timeout4357* @n_peers: number of peers to do measurements with4358* @peers: per-peer measurement request data4359*/4360struct cfg80211_pmsr_request {4361u64 cookie;4362void *drv_data;4363u32 n_peers;4364u32 nl_portid;43654366u32 timeout;43674368u8 mac_addr[ETH_ALEN] __aligned(2);4369u8 mac_addr_mask[ETH_ALEN] __aligned(2);43704371struct list_head list;43724373struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers);4374};43754376/**4377* struct cfg80211_update_owe_info - OWE Information4378*4379* This structure provides information needed for the drivers to offload OWE4380* (Opportunistic Wireless Encryption) processing to the user space.4381*4382* Commonly used across update_owe_info request and event interfaces.4383*4384* @peer: MAC address of the peer device for which the OWE processing4385* has to be done.4386* @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info4387* processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space4388* cannot give you the real status code for failures. Used only for4389* OWE update request command interface (user space to driver).4390* @ie: IEs obtained from the peer or constructed by the user space. These are4391* the IEs of the remote peer in the event from the host driver and4392* the constructed IEs by the user space in the request interface.4393* @ie_len: Length of IEs in octets.4394* @assoc_link_id: MLO link ID of the AP, with which (re)association requested4395* by peer. This will be filled by driver for both MLO and non-MLO station4396* connections when the AP affiliated with an MLD. For non-MLD AP mode, it4397* will be -1. Used only with OWE update event (driver to user space).4398* @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO4399* connection, it will be all zeros. This is applicable only when4400* @assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only4401* with OWE update event (driver to user space).4402*/4403struct cfg80211_update_owe_info {4404u8 peer[ETH_ALEN] __aligned(2);4405u16 status;4406const u8 *ie;4407size_t ie_len;4408int assoc_link_id;4409u8 peer_mld_addr[ETH_ALEN] __aligned(2);4410};44114412/**4413* struct mgmt_frame_regs - management frame registrations data4414* @global_stypes: bitmap of management frame subtypes registered4415* for the entire device4416* @interface_stypes: bitmap of management frame subtypes registered4417* for the given interface4418* @global_mcast_stypes: mcast RX is needed globally for these subtypes4419* @interface_mcast_stypes: mcast RX is needed on this interface4420* for these subtypes4421*/4422struct mgmt_frame_regs {4423u32 global_stypes, interface_stypes;4424u32 global_mcast_stypes, interface_mcast_stypes;4425};44264427/**4428* struct cfg80211_ops - backend description for wireless configuration4429*4430* This struct is registered by fullmac card drivers and/or wireless stacks4431* in order to handle configuration requests on their interfaces.4432*4433* All callbacks except where otherwise noted should return 04434* on success or a negative error code.4435*4436* All operations are invoked with the wiphy mutex held. The RTNL may be4437* held in addition (due to wireless extensions) but this cannot be relied4438* upon except in cases where documented below. Note that due to ordering,4439* the RTNL also cannot be acquired in any handlers.4440*4441* @suspend: wiphy device needs to be suspended. The variable @wow will4442* be %NULL or contain the enabled Wake-on-Wireless triggers that are4443* configured for the device.4444* @resume: wiphy device needs to be resumed4445* @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback4446* to call device_set_wakeup_enable() to enable/disable wakeup from4447* the device.4448*4449* @add_virtual_intf: create a new virtual interface with the given name,4450* must set the struct wireless_dev's iftype. Beware: You must create4451* the new netdev in the wiphy's network namespace! Returns the struct4452* wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must4453* also set the address member in the wdev.4454* This additionally holds the RTNL to be able to do netdev changes.4455*4456* @del_virtual_intf: remove the virtual interface4457* This additionally holds the RTNL to be able to do netdev changes.4458*4459* @change_virtual_intf: change type/configuration of virtual interface,4460* keep the struct wireless_dev's iftype updated.4461* This additionally holds the RTNL to be able to do netdev changes.4462*4463* @add_intf_link: Add a new MLO link to the given interface. Note that4464* the wdev->link[] data structure has been updated, so the new link4465* address is available.4466* @del_intf_link: Remove an MLO link from the given interface.4467*4468* @add_key: add a key with the given parameters. @mac_addr will be %NULL4469* when adding a group key. @link_id will be -1 for non-MLO connection.4470* For MLO connection, @link_id will be >= 0 for group key and -1 for4471* pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key.4472*4473* @get_key: get information about the key with the given parameters.4474* @mac_addr will be %NULL when requesting information for a group4475* key. All pointers given to the @callback function need not be valid4476* after it returns. This function should return an error if it is4477* not possible to retrieve the key, -ENOENT if it doesn't exist.4478* @link_id will be -1 for non-MLO connection. For MLO connection,4479* @link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr4480* will be peer's MLD address for MLO pairwise key.4481*4482* @del_key: remove a key given the @mac_addr (%NULL for a group key)4483* and @key_index, return -ENOENT if the key doesn't exist. @link_id will4484* be -1 for non-MLO connection. For MLO connection, @link_id will be >= 04485* for group key and -1 for pairwise key, @mac_addr will be peer's MLD4486* address for MLO pairwise key.4487*4488* @set_default_key: set the default key on an interface. @link_id will be >= 04489* for MLO connection and -1 for non-MLO connection.4490*4491* @set_default_mgmt_key: set the default management frame key on an interface.4492* @link_id will be >= 0 for MLO connection and -1 for non-MLO connection.4493*4494* @set_default_beacon_key: set the default Beacon frame key on an interface.4495* @link_id will be >= 0 for MLO connection and -1 for non-MLO connection.4496*4497* @set_rekey_data: give the data necessary for GTK rekeying to the driver4498*4499* @start_ap: Start acting in AP mode defined by the parameters.4500* @change_beacon: Change the beacon parameters for an access point mode4501* interface. This should reject the call when AP mode wasn't started.4502* @stop_ap: Stop being an AP, including stopping beaconing.4503*4504* @add_station: Add a new station.4505* @del_station: Remove a station4506* @change_station: Modify a given station. Note that flags changes are not much4507* validated in cfg80211, in particular the auth/assoc/authorized flags4508* might come to the driver in invalid combinations -- make sure to check4509* them, also against the existing state! Drivers must call4510* cfg80211_check_station_change() to validate the information.4511* @get_station: get station information for the station identified by @mac4512* @dump_station: dump station callback -- resume dump at index @idx4513*4514* @add_mpath: add a fixed mesh path4515* @del_mpath: delete a given mesh path4516* @change_mpath: change a given mesh path4517* @get_mpath: get a mesh path for the given parameters4518* @dump_mpath: dump mesh path callback -- resume dump at index @idx4519* @get_mpp: get a mesh proxy path for the given parameters4520* @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx4521* @join_mesh: join the mesh network with the specified parameters4522* (invoked with the wireless_dev mutex held)4523* @leave_mesh: leave the current mesh network4524* (invoked with the wireless_dev mutex held)4525*4526* @get_mesh_config: Get the current mesh configuration4527*4528* @update_mesh_config: Update mesh parameters on a running mesh.4529* The mask is a bitfield which tells us which parameters to4530* set, and which to leave alone.4531*4532* @change_bss: Modify parameters for a given BSS.4533*4534* @inform_bss: Called by cfg80211 while being informed about new BSS data4535* for every BSS found within the reported data or frame. This is called4536* from within the cfg8011 inform_bss handlers while holding the bss_lock.4537* The data parameter is passed through from drv_data inside4538* struct cfg80211_inform_bss.4539* The new IE data for the BSS is explicitly passed.4540*4541* @set_txq_params: Set TX queue parameters4542*4543* @libertas_set_mesh_channel: Only for backward compatibility for libertas,4544* as it doesn't implement join_mesh and needs to set the channel to4545* join the mesh instead.4546*4547* @set_monitor_channel: Set the monitor mode channel for the device. If other4548* interfaces are active this callback should reject the configuration.4549* If no interfaces are active or the device is down, the channel should4550* be stored for when a monitor interface becomes active.4551*4552* @scan: Request to do a scan. If returning zero, the scan request is given4553* the driver, and will be valid until passed to cfg80211_scan_done().4554* For scan results, call cfg80211_inform_bss(); you can call this outside4555* the scan/scan_done bracket too.4556* @abort_scan: Tell the driver to abort an ongoing scan. The driver shall4557* indicate the status of the scan through cfg80211_scan_done().4558*4559* @auth: Request to authenticate with the specified peer4560* (invoked with the wireless_dev mutex held)4561* @assoc: Request to (re)associate with the specified peer4562* (invoked with the wireless_dev mutex held)4563* @deauth: Request to deauthenticate from the specified peer4564* (invoked with the wireless_dev mutex held)4565* @disassoc: Request to disassociate from the specified peer4566* (invoked with the wireless_dev mutex held)4567*4568* @connect: Connect to the ESS with the specified parameters. When connected,4569* call cfg80211_connect_result()/cfg80211_connect_bss() with status code4570* %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call4571* cfg80211_connect_result()/cfg80211_connect_bss() with the status code4572* from the AP or cfg80211_connect_timeout() if no frame with status code4573* was received.4574* The driver is allowed to roam to other BSSes within the ESS when the4575* other BSS matches the connect parameters. When such roaming is initiated4576* by the driver, the driver is expected to verify that the target matches4577* the configured security parameters and to use Reassociation Request4578* frame instead of Association Request frame.4579* The connect function can also be used to request the driver to perform a4580* specific roam when connected to an ESS. In that case, the prev_bssid4581* parameter is set to the BSSID of the currently associated BSS as an4582* indication of requesting reassociation.4583* In both the driver-initiated and new connect() call initiated roaming4584* cases, the result of roaming is indicated with a call to4585* cfg80211_roamed(). (invoked with the wireless_dev mutex held)4586* @update_connect_params: Update the connect parameters while connected to a4587* BSS. The updated parameters can be used by driver/firmware for4588* subsequent BSS selection (roaming) decisions and to form the4589* Authentication/(Re)Association Request frames. This call does not4590* request an immediate disassociation or reassociation with the current4591* BSS, i.e., this impacts only subsequent (re)associations. The bits in4592* changed are defined in &enum cfg80211_connect_params_changed.4593* (invoked with the wireless_dev mutex held)4594* @disconnect: Disconnect from the BSS/ESS or stop connection attempts if4595* connection is in progress. Once done, call cfg80211_disconnected() in4596* case connection was already established (invoked with the4597* wireless_dev mutex held), otherwise call cfg80211_connect_timeout().4598*4599* @join_ibss: Join the specified IBSS (or create if necessary). Once done, call4600* cfg80211_ibss_joined(), also call that function when changing BSSID due4601* to a merge.4602* (invoked with the wireless_dev mutex held)4603* @leave_ibss: Leave the IBSS.4604* (invoked with the wireless_dev mutex held)4605*4606* @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or4607* MESH mode)4608*4609* @set_wiphy_params: Notify that wiphy parameters have changed;4610* @changed bitfield (see &enum wiphy_params_flags) describes which values4611* have changed. The actual parameter values are available in4612* struct wiphy. If returning an error, no value should be changed.4613*4614* @set_tx_power: set the transmit power according to the parameters,4615* the power passed is in mBm, to get dBm use MBM_TO_DBM(). The4616* wdev may be %NULL if power was set for the wiphy, and will4617* always be %NULL unless the driver supports per-vif TX power4618* (as advertised by the nl80211 feature flag.)4619* @get_tx_power: store the current TX power into the dbm variable;4620* return 0 if successful4621*4622* @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting4623* functions to adjust rfkill hw state4624*4625* @dump_survey: get site survey information.4626*4627* @remain_on_channel: Request the driver to remain awake on the specified4628* channel for the specified duration to complete an off-channel4629* operation (e.g., public action frame exchange). When the driver is4630* ready on the requested channel, it must indicate this with an event4631* notification by calling cfg80211_ready_on_channel().4632* @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.4633* This allows the operation to be terminated prior to timeout based on4634* the duration value.4635* @mgmt_tx: Transmit a management frame.4636* @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management4637* frame on another channel4638*4639* @testmode_cmd: run a test mode command; @wdev may be %NULL4640* @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be4641* used by the function, but 0 and 1 must not be touched. Additionally,4642* return error codes other than -ENOBUFS and -ENOENT will terminate the4643* dump and return to userspace with an error, so be careful. If any data4644* was passed in from userspace then the data/len arguments will be present4645* and point to the data contained in %NL80211_ATTR_TESTDATA.4646*4647* @set_bitrate_mask: set the bitrate mask configuration4648*4649* @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac4650* devices running firmwares capable of generating the (re) association4651* RSN IE. It allows for faster roaming between WPA2 BSSIDs.4652* @del_pmksa: Delete a cached PMKID.4653* @flush_pmksa: Flush all cached PMKIDs.4654* @set_power_mgmt: Configure WLAN power management. A timeout value of -14655* allows the driver to adjust the dynamic ps timeout value.4656* @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.4657* After configuration, the driver should (soon) send an event indicating4658* the current level is above/below the configured threshold; this may4659* need some care when the configuration is changed (without first being4660* disabled.)4661* @set_cqm_rssi_range_config: Configure two RSSI thresholds in the4662* connection quality monitor. An event is to be sent only when the4663* signal level is found to be outside the two values. The driver should4664* set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.4665* If it is provided then there's no point providing @set_cqm_rssi_config.4666* @set_cqm_txe_config: Configure connection quality monitor TX error4667* thresholds.4668* @sched_scan_start: Tell the driver to start a scheduled scan.4669* @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with4670* given request id. This call must stop the scheduled scan and be ready4671* for starting a new one before it returns, i.e. @sched_scan_start may be4672* called immediately after that again and should not fail in that case.4673* The driver should not call cfg80211_sched_scan_stopped() for a requested4674* stop (when this method returns 0).4675*4676* @update_mgmt_frame_registrations: Notify the driver that management frame4677* registrations were updated. The callback is allowed to sleep.4678*4679* @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.4680* Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may4681* reject TX/RX mask combinations they cannot support by returning -EINVAL4682* (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).4683*4684* @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).4685*4686* @tdls_mgmt: Transmit a TDLS management frame.4687* @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).4688*4689* @probe_client: probe an associated client, must return a cookie that it4690* later passes to cfg80211_probe_status().4691*4692* @set_noack_map: Set the NoAck Map for the TIDs.4693*4694* @get_channel: Get the current operating channel for the virtual interface.4695* For monitor interfaces, it should return %NULL unless there's a single4696* current monitoring channel.4697*4698* @start_p2p_device: Start the given P2P device.4699* @stop_p2p_device: Stop the given P2P device.4700*4701* @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.4702* Parameters include ACL policy, an array of MAC address of stations4703* and the number of MAC addresses. If there is already a list in driver4704* this new list replaces the existing one. Driver has to clear its ACL4705* when number of MAC addresses entries is passed as 0. Drivers which4706* advertise the support for MAC based ACL have to implement this callback.4707*4708* @start_radar_detection: Start radar detection in the driver.4709*4710* @end_cac: End running CAC, probably because a related CAC4711* was finished on another phy.4712*4713* @update_ft_ies: Provide updated Fast BSS Transition information to the4714* driver. If the SME is in the driver/firmware, this information can be4715* used in building Authentication and Reassociation Request frames.4716*4717* @crit_proto_start: Indicates a critical protocol needs more link reliability4718* for a given duration (milliseconds). The protocol is provided so the4719* driver can take the most appropriate actions.4720* @crit_proto_stop: Indicates critical protocol no longer needs increased link4721* reliability. This operation can not fail.4722* @set_coalesce: Set coalesce parameters.4723*4724* @channel_switch: initiate channel-switch procedure (with CSA). Driver is4725* responsible for veryfing if the switch is possible. Since this is4726* inherently tricky driver may decide to disconnect an interface later4727* with cfg80211_stop_iface(). This doesn't mean driver can accept4728* everything. It should do it's best to verify requests and reject them4729* as soon as possible.4730*4731* @set_qos_map: Set QoS mapping information to the driver4732*4733* @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the4734* given interface This is used e.g. for dynamic HT 20/40 MHz channel width4735* changes during the lifetime of the BSS.4736*4737* @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device4738* with the given parameters; action frame exchange has been handled by4739* userspace so this just has to modify the TX path to take the TS into4740* account.4741* If the admitted time is 0 just validate the parameters to make sure4742* the session can be created at all; it is valid to just always return4743* success for that but that may result in inefficient behaviour (handshake4744* with the peer followed by immediate teardown when the addition is later4745* rejected)4746* @del_tx_ts: remove an existing TX TS4747*4748* @join_ocb: join the OCB network with the specified parameters4749* (invoked with the wireless_dev mutex held)4750* @leave_ocb: leave the current OCB network4751* (invoked with the wireless_dev mutex held)4752*4753* @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver4754* is responsible for continually initiating channel-switching operations4755* and returning to the base channel for communication with the AP.4756* @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both4757* peers must be on the base channel when the call completes.4758* @start_nan: Start the NAN interface.4759* @stop_nan: Stop the NAN interface.4760* @add_nan_func: Add a NAN function. Returns negative value on failure.4761* On success @nan_func ownership is transferred to the driver and4762* it may access it outside of the scope of this function. The driver4763* should free the @nan_func when no longer needed by calling4764* cfg80211_free_nan_func().4765* On success the driver should assign an instance_id in the4766* provided @nan_func.4767* @del_nan_func: Delete a NAN function.4768* @nan_change_conf: changes NAN configuration. The changed parameters must4769* be specified in @changes (using &enum cfg80211_nan_conf_changes);4770* All other parameters must be ignored.4771*4772* @set_multicast_to_unicast: configure multicast to unicast conversion for BSS4773*4774* @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this4775* function should return phy stats, and interface stats otherwise.4776*4777* @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.4778* If not deleted through @del_pmk the PMK remains valid until disconnect4779* upon which the driver should clear it.4780* (invoked with the wireless_dev mutex held)4781* @del_pmk: delete the previously configured PMK for the given authenticator.4782* (invoked with the wireless_dev mutex held)4783*4784* @external_auth: indicates result of offloaded authentication processing from4785* user space4786*4787* @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter4788* tells the driver that the frame should not be encrypted.4789*4790* @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.4791* Statistics should be cumulative, currently no way to reset is provided.4792* @start_pmsr: start peer measurement (e.g. FTM)4793* @abort_pmsr: abort peer measurement4794*4795* @update_owe_info: Provide updated OWE info to driver. Driver implementing SME4796* but offloading OWE processing to the user space will get the updated4797* DH IE through this interface.4798*4799* @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame4800* and overrule HWMP path selection algorithm.4801* @set_tid_config: TID specific configuration, this can be peer or BSS specific4802* This callback may sleep.4803* @reset_tid_config: Reset TID specific configuration for the peer, for the4804* given TIDs. This callback may sleep.4805*4806* @set_sar_specs: Update the SAR (TX power) settings.4807*4808* @color_change: Initiate a color change.4809*4810* @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use4811* those to decrypt (Re)Association Request and encrypt (Re)Association4812* Response frame.4813*4814* @set_radar_background: Configure dedicated offchannel chain available for4815* radar/CAC detection on some hw. This chain can't be used to transmit4816* or receive frames and it is bounded to a running wdev.4817* Background radar/CAC detection allows to avoid the CAC downtime4818* switching to a different channel during CAC detection on the selected4819* radar channel.4820* The caller is expected to set chandef pointer to NULL in order to4821* disable background CAC/radar detection.4822* @add_link_station: Add a link to a station.4823* @mod_link_station: Modify a link of a station.4824* @del_link_station: Remove a link of a station.4825*4826* @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.4827* @set_ttlm: set the TID to link mapping.4828* @set_epcs: Enable/Disable EPCS for station mode.4829* @get_radio_mask: get bitmask of radios in use.4830* (invoked with the wiphy mutex held)4831* @assoc_ml_reconf: Request a non-AP MLO connection to perform ML4832* reconfiguration, i.e., add and/or remove links to/from the4833* association using ML reconfiguration action frames. Successfully added4834* links will be added to the set of valid links. Successfully removed4835* links will be removed from the set of valid links. The driver must4836* indicate removed links by calling cfg80211_links_removed() and added4837* links by calling cfg80211_mlo_reconf_add_done(). When calling4838* cfg80211_mlo_reconf_add_done() the bss pointer must be given for each4839* link for which MLO reconfiguration 'add' operation was requested.4840*/4841struct cfg80211_ops {4842int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);4843int (*resume)(struct wiphy *wiphy);4844void (*set_wakeup)(struct wiphy *wiphy, bool enabled);48454846struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,4847const char *name,4848unsigned char name_assign_type,4849enum nl80211_iftype type,4850struct vif_params *params);4851int (*del_virtual_intf)(struct wiphy *wiphy,4852struct wireless_dev *wdev);4853int (*change_virtual_intf)(struct wiphy *wiphy,4854struct net_device *dev,4855enum nl80211_iftype type,4856struct vif_params *params);48574858int (*add_intf_link)(struct wiphy *wiphy,4859struct wireless_dev *wdev,4860unsigned int link_id);4861void (*del_intf_link)(struct wiphy *wiphy,4862struct wireless_dev *wdev,4863unsigned int link_id);48644865int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,4866int link_id, u8 key_index, bool pairwise,4867const u8 *mac_addr, struct key_params *params);4868int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,4869int link_id, u8 key_index, bool pairwise,4870const u8 *mac_addr, void *cookie,4871void (*callback)(void *cookie, struct key_params*));4872int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,4873int link_id, u8 key_index, bool pairwise,4874const u8 *mac_addr);4875int (*set_default_key)(struct wiphy *wiphy,4876struct net_device *netdev, int link_id,4877u8 key_index, bool unicast, bool multicast);4878int (*set_default_mgmt_key)(struct wiphy *wiphy,4879struct net_device *netdev, int link_id,4880u8 key_index);4881int (*set_default_beacon_key)(struct wiphy *wiphy,4882struct net_device *netdev,4883int link_id,4884u8 key_index);48854886int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,4887struct cfg80211_ap_settings *settings);4888int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,4889struct cfg80211_ap_update *info);4890int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev,4891unsigned int link_id);489248934894int (*add_station)(struct wiphy *wiphy, struct net_device *dev,4895const u8 *mac,4896struct station_parameters *params);4897int (*del_station)(struct wiphy *wiphy, struct net_device *dev,4898struct station_del_parameters *params);4899int (*change_station)(struct wiphy *wiphy, struct net_device *dev,4900const u8 *mac,4901struct station_parameters *params);4902int (*get_station)(struct wiphy *wiphy, struct net_device *dev,4903const u8 *mac, struct station_info *sinfo);4904int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,4905int idx, u8 *mac, struct station_info *sinfo);49064907int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,4908const u8 *dst, const u8 *next_hop);4909int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,4910const u8 *dst);4911int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,4912const u8 *dst, const u8 *next_hop);4913int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,4914u8 *dst, u8 *next_hop, struct mpath_info *pinfo);4915int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,4916int idx, u8 *dst, u8 *next_hop,4917struct mpath_info *pinfo);4918int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,4919u8 *dst, u8 *mpp, struct mpath_info *pinfo);4920int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,4921int idx, u8 *dst, u8 *mpp,4922struct mpath_info *pinfo);4923int (*get_mesh_config)(struct wiphy *wiphy,4924struct net_device *dev,4925struct mesh_config *conf);4926int (*update_mesh_config)(struct wiphy *wiphy,4927struct net_device *dev, u32 mask,4928const struct mesh_config *nconf);4929int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,4930const struct mesh_config *conf,4931const struct mesh_setup *setup);4932int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);49334934int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,4935struct ocb_setup *setup);4936int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);49374938int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,4939struct bss_parameters *params);49404941void (*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss,4942const struct cfg80211_bss_ies *ies, void *data);49434944int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,4945struct ieee80211_txq_params *params);49464947int (*libertas_set_mesh_channel)(struct wiphy *wiphy,4948struct net_device *dev,4949struct ieee80211_channel *chan);49504951int (*set_monitor_channel)(struct wiphy *wiphy,4952struct net_device *dev,4953struct cfg80211_chan_def *chandef);49544955int (*scan)(struct wiphy *wiphy,4956struct cfg80211_scan_request *request);4957void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);49584959int (*auth)(struct wiphy *wiphy, struct net_device *dev,4960struct cfg80211_auth_request *req);4961int (*assoc)(struct wiphy *wiphy, struct net_device *dev,4962struct cfg80211_assoc_request *req);4963int (*deauth)(struct wiphy *wiphy, struct net_device *dev,4964struct cfg80211_deauth_request *req);4965int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,4966struct cfg80211_disassoc_request *req);49674968int (*connect)(struct wiphy *wiphy, struct net_device *dev,4969struct cfg80211_connect_params *sme);4970int (*update_connect_params)(struct wiphy *wiphy,4971struct net_device *dev,4972struct cfg80211_connect_params *sme,4973u32 changed);4974int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,4975u16 reason_code);49764977int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,4978struct cfg80211_ibss_params *params);4979int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);49804981int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,4982int rate[NUM_NL80211_BANDS]);49834984int (*set_wiphy_params)(struct wiphy *wiphy, int radio_idx,4985u32 changed);49864987int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,4988int radio_idx,4989enum nl80211_tx_power_setting type, int mbm);4990int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,4991int radio_idx, unsigned int link_id, int *dbm);49924993void (*rfkill_poll)(struct wiphy *wiphy);49944995#ifdef CONFIG_NL80211_TESTMODE4996int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,4997void *data, int len);4998int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,4999struct netlink_callback *cb,5000void *data, int len);5001#endif50025003int (*set_bitrate_mask)(struct wiphy *wiphy,5004struct net_device *dev,5005unsigned int link_id,5006const u8 *peer,5007const struct cfg80211_bitrate_mask *mask);50085009int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,5010int idx, struct survey_info *info);50115012int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,5013struct cfg80211_pmksa *pmksa);5014int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,5015struct cfg80211_pmksa *pmksa);5016int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);50175018int (*remain_on_channel)(struct wiphy *wiphy,5019struct wireless_dev *wdev,5020struct ieee80211_channel *chan,5021unsigned int duration,5022u64 *cookie);5023int (*cancel_remain_on_channel)(struct wiphy *wiphy,5024struct wireless_dev *wdev,5025u64 cookie);50265027int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,5028struct cfg80211_mgmt_tx_params *params,5029u64 *cookie);5030int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,5031struct wireless_dev *wdev,5032u64 cookie);50335034int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,5035bool enabled, int timeout);50365037int (*set_cqm_rssi_config)(struct wiphy *wiphy,5038struct net_device *dev,5039s32 rssi_thold, u32 rssi_hyst);50405041int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,5042struct net_device *dev,5043s32 rssi_low, s32 rssi_high);50445045int (*set_cqm_txe_config)(struct wiphy *wiphy,5046struct net_device *dev,5047u32 rate, u32 pkts, u32 intvl);50485049void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,5050struct wireless_dev *wdev,5051struct mgmt_frame_regs *upd);50525053int (*set_antenna)(struct wiphy *wiphy, int radio_idx,5054u32 tx_ant, u32 rx_ant);5055int (*get_antenna)(struct wiphy *wiphy, int radio_idx,5056u32 *tx_ant, u32 *rx_ant);50575058int (*sched_scan_start)(struct wiphy *wiphy,5059struct net_device *dev,5060struct cfg80211_sched_scan_request *request);5061int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,5062u64 reqid);50635064int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,5065struct cfg80211_gtk_rekey_data *data);50665067int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,5068const u8 *peer, int link_id,5069u8 action_code, u8 dialog_token, u16 status_code,5070u32 peer_capability, bool initiator,5071const u8 *buf, size_t len);5072int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,5073const u8 *peer, enum nl80211_tdls_operation oper);50745075int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,5076const u8 *peer, u64 *cookie);50775078int (*set_noack_map)(struct wiphy *wiphy,5079struct net_device *dev,5080u16 noack_map);50815082int (*get_channel)(struct wiphy *wiphy,5083struct wireless_dev *wdev,5084unsigned int link_id,5085struct cfg80211_chan_def *chandef);50865087int (*start_p2p_device)(struct wiphy *wiphy,5088struct wireless_dev *wdev);5089void (*stop_p2p_device)(struct wiphy *wiphy,5090struct wireless_dev *wdev);50915092int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,5093const struct cfg80211_acl_data *params);50945095int (*start_radar_detection)(struct wiphy *wiphy,5096struct net_device *dev,5097struct cfg80211_chan_def *chandef,5098u32 cac_time_ms, int link_id);5099void (*end_cac)(struct wiphy *wiphy,5100struct net_device *dev, unsigned int link_id);5101int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,5102struct cfg80211_update_ft_ies_params *ftie);5103int (*crit_proto_start)(struct wiphy *wiphy,5104struct wireless_dev *wdev,5105enum nl80211_crit_proto_id protocol,5106u16 duration);5107void (*crit_proto_stop)(struct wiphy *wiphy,5108struct wireless_dev *wdev);5109int (*set_coalesce)(struct wiphy *wiphy,5110struct cfg80211_coalesce *coalesce);51115112int (*channel_switch)(struct wiphy *wiphy,5113struct net_device *dev,5114struct cfg80211_csa_settings *params);51155116int (*set_qos_map)(struct wiphy *wiphy,5117struct net_device *dev,5118struct cfg80211_qos_map *qos_map);51195120int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,5121unsigned int link_id,5122struct cfg80211_chan_def *chandef);51235124int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,5125u8 tsid, const u8 *peer, u8 user_prio,5126u16 admitted_time);5127int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,5128u8 tsid, const u8 *peer);51295130int (*tdls_channel_switch)(struct wiphy *wiphy,5131struct net_device *dev,5132const u8 *addr, u8 oper_class,5133struct cfg80211_chan_def *chandef);5134void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,5135struct net_device *dev,5136const u8 *addr);5137int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,5138struct cfg80211_nan_conf *conf);5139void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);5140int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,5141struct cfg80211_nan_func *nan_func);5142void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,5143u64 cookie);5144int (*nan_change_conf)(struct wiphy *wiphy,5145struct wireless_dev *wdev,5146struct cfg80211_nan_conf *conf,5147u32 changes);51485149int (*set_multicast_to_unicast)(struct wiphy *wiphy,5150struct net_device *dev,5151const bool enabled);51525153int (*get_txq_stats)(struct wiphy *wiphy,5154struct wireless_dev *wdev,5155struct cfg80211_txq_stats *txqstats);51565157int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,5158const struct cfg80211_pmk_conf *conf);5159int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,5160const u8 *aa);5161int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,5162struct cfg80211_external_auth_params *params);51635164int (*tx_control_port)(struct wiphy *wiphy,5165struct net_device *dev,5166const u8 *buf, size_t len,5167const u8 *dest, const __be16 proto,5168const bool noencrypt, int link_id,5169u64 *cookie);51705171int (*get_ftm_responder_stats)(struct wiphy *wiphy,5172struct net_device *dev,5173struct cfg80211_ftm_responder_stats *ftm_stats);51745175int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,5176struct cfg80211_pmsr_request *request);5177void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,5178struct cfg80211_pmsr_request *request);5179int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,5180struct cfg80211_update_owe_info *owe_info);5181int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,5182const u8 *buf, size_t len);5183int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,5184struct cfg80211_tid_config *tid_conf);5185int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,5186const u8 *peer, u8 tids);5187int (*set_sar_specs)(struct wiphy *wiphy,5188struct cfg80211_sar_specs *sar);5189int (*color_change)(struct wiphy *wiphy,5190struct net_device *dev,5191struct cfg80211_color_change_settings *params);5192int (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,5193struct cfg80211_fils_aad *fils_aad);5194int (*set_radar_background)(struct wiphy *wiphy,5195struct cfg80211_chan_def *chandef);5196int (*add_link_station)(struct wiphy *wiphy, struct net_device *dev,5197struct link_station_parameters *params);5198int (*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,5199struct link_station_parameters *params);5200int (*del_link_station)(struct wiphy *wiphy, struct net_device *dev,5201struct link_station_del_parameters *params);5202int (*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,5203struct cfg80211_set_hw_timestamp *hwts);5204int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,5205struct cfg80211_ttlm_params *params);5206u32 (*get_radio_mask)(struct wiphy *wiphy, struct net_device *dev);5207int (*assoc_ml_reconf)(struct wiphy *wiphy, struct net_device *dev,5208struct cfg80211_ml_reconf_req *req);5209int (*set_epcs)(struct wiphy *wiphy, struct net_device *dev,5210bool val);5211};52125213/*5214* wireless hardware and networking interfaces structures5215* and registration/helper functions5216*/52175218/**5219* enum wiphy_flags - wiphy capability flags5220*5221* @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split5222* into two, first for legacy bands and second for 6 GHz.5223* @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this5224* wiphy at all5225* @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled5226* by default -- this flag will be set depending on the kernel's default5227* on wiphy_new(), but can be changed by the driver if it has a good5228* reason to override the default5229* @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station5230* on a VLAN interface). This flag also serves an extra purpose of5231* supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.5232* @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station5233* @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the5234* control port protocol ethertype. The device also honours the5235* control_port_no_encrypt flag.5236* @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.5237* @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing5238* auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.5239* @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the5240* firmware.5241* @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.5242* @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.5243* @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)5244* link setup/discovery operations internally. Setup, discovery and5245* teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT5246* command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be5247* used for asking the driver/firmware to perform a TDLS operation.5248* @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME5249* @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes5250* when there are virtual interfaces in AP mode by calling5251* cfg80211_report_obss_beacon().5252* @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device5253* responds to probe-requests in hardware.5254* @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.5255* @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.5256* @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.5257* @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in5258* beaconing mode (AP, IBSS, Mesh, ...).5259* @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys5260* @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,5261* in order to not have them reachable in normal drivers, until we have5262* complete feature/interface combinations/etc. advertisement. No driver5263* should set this flag for now.5264* @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys.5265* @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for5266* NL80211_REGDOM_SET_BY_DRIVER.5267* @WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON: reg_call_notifier() is called if driver5268* set this flag to update channels on beacon hints.5269* @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link5270* of an NSTR mobile AP MLD.5271* @WIPHY_FLAG_DISABLE_WEXT: disable wireless extensions for this device5272*/5273enum wiphy_flags {5274WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),5275WIPHY_FLAG_SUPPORTS_MLO = BIT(1),5276WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),5277WIPHY_FLAG_NETNS_OK = BIT(3),5278WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),5279WIPHY_FLAG_4ADDR_AP = BIT(5),5280WIPHY_FLAG_4ADDR_STATION = BIT(6),5281WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),5282WIPHY_FLAG_IBSS_RSN = BIT(8),5283WIPHY_FLAG_DISABLE_WEXT = BIT(9),5284WIPHY_FLAG_MESH_AUTH = BIT(10),5285WIPHY_FLAG_SUPPORTS_EXT_KCK_32 = BIT(11),5286WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY = BIT(12),5287WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),5288WIPHY_FLAG_AP_UAPSD = BIT(14),5289WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),5290WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),5291WIPHY_FLAG_HAVE_AP_SME = BIT(17),5292WIPHY_FLAG_REPORTS_OBSS = BIT(18),5293WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),5294WIPHY_FLAG_OFFCHAN_TX = BIT(20),5295WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),5296WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),5297WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),5298WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(24),5299WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON = BIT(25),5300};53015302/**5303* struct ieee80211_iface_limit - limit on certain interface types5304* @max: maximum number of interfaces of these types5305* @types: interface types (bits)5306*/5307struct ieee80211_iface_limit {5308u16 max;5309u16 types;5310};53115312/**5313* struct ieee80211_iface_combination - possible interface combination5314*5315* With this structure the driver can describe which interface5316* combinations it supports concurrently. When set in a struct wiphy_radio,5317* the combinations refer to combinations of interfaces currently active on5318* that radio.5319*5320* Examples:5321*5322* 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:5323*5324* .. code-block:: c5325*5326* struct ieee80211_iface_limit limits1[] = {5327* { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },5328* { .max = 1, .types = BIT(NL80211_IFTYPE_AP), },5329* };5330* struct ieee80211_iface_combination combination1 = {5331* .limits = limits1,5332* .n_limits = ARRAY_SIZE(limits1),5333* .max_interfaces = 2,5334* .beacon_int_infra_match = true,5335* };5336*5337*5338* 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:5339*5340* .. code-block:: c5341*5342* struct ieee80211_iface_limit limits2[] = {5343* { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |5344* BIT(NL80211_IFTYPE_P2P_GO), },5345* };5346* struct ieee80211_iface_combination combination2 = {5347* .limits = limits2,5348* .n_limits = ARRAY_SIZE(limits2),5349* .max_interfaces = 8,5350* .num_different_channels = 1,5351* };5352*5353*5354* 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.5355*5356* This allows for an infrastructure connection and three P2P connections.5357*5358* .. code-block:: c5359*5360* struct ieee80211_iface_limit limits3[] = {5361* { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },5362* { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |5363* BIT(NL80211_IFTYPE_P2P_CLIENT), },5364* };5365* struct ieee80211_iface_combination combination3 = {5366* .limits = limits3,5367* .n_limits = ARRAY_SIZE(limits3),5368* .max_interfaces = 4,5369* .num_different_channels = 2,5370* };5371*5372*/5373struct ieee80211_iface_combination {5374/**5375* @limits:5376* limits for the given interface types5377*/5378const struct ieee80211_iface_limit *limits;53795380/**5381* @num_different_channels:5382* can use up to this many different channels5383*/5384u32 num_different_channels;53855386/**5387* @max_interfaces:5388* maximum number of interfaces in total allowed in this group5389*/5390u16 max_interfaces;53915392/**5393* @n_limits:5394* number of limitations5395*/5396u8 n_limits;53975398/**5399* @beacon_int_infra_match:5400* In this combination, the beacon intervals between infrastructure5401* and AP types must match. This is required only in special cases.5402*/5403bool beacon_int_infra_match;54045405/**5406* @radar_detect_widths:5407* bitmap of channel widths supported for radar detection5408*/5409u8 radar_detect_widths;54105411/**5412* @radar_detect_regions:5413* bitmap of regions supported for radar detection5414*/5415u8 radar_detect_regions;54165417/**5418* @beacon_int_min_gcd:5419* This interface combination supports different beacon intervals.5420*5421* = 05422* all beacon intervals for different interface must be same.5423* > 05424* any beacon interval for the interface part of this combination AND5425* GCD of all beacon intervals from beaconing interfaces of this5426* combination must be greater or equal to this value.5427*/5428u32 beacon_int_min_gcd;5429};54305431struct ieee80211_txrx_stypes {5432u16 tx, rx;5433};54345435/**5436* enum wiphy_wowlan_support_flags - WoWLAN support flags5437* @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"5438* trigger that keeps the device operating as-is and5439* wakes up the host on any activity, for example a5440* received packet that passed filtering; note that the5441* packet should be preserved in that case5442* @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet5443* (see nl80211.h)5444* @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect5445* @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep5446* @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure5447* @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request5448* @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure5449* @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release5450* @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection5451*/5452enum wiphy_wowlan_support_flags {5453WIPHY_WOWLAN_ANY = BIT(0),5454WIPHY_WOWLAN_MAGIC_PKT = BIT(1),5455WIPHY_WOWLAN_DISCONNECT = BIT(2),5456WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),5457WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),5458WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),5459WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),5460WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),5461WIPHY_WOWLAN_NET_DETECT = BIT(8),5462};54635464struct wiphy_wowlan_tcp_support {5465const struct nl80211_wowlan_tcp_data_token_feature *tok;5466u32 data_payload_max;5467u32 data_interval_max;5468u32 wake_payload_max;5469bool seq;5470};54715472/**5473* struct wiphy_wowlan_support - WoWLAN support data5474* @flags: see &enum wiphy_wowlan_support_flags5475* @n_patterns: number of supported wakeup patterns5476* (see nl80211.h for the pattern definition)5477* @pattern_max_len: maximum length of each pattern5478* @pattern_min_len: minimum length of each pattern5479* @max_pkt_offset: maximum Rx packet offset5480* @max_nd_match_sets: maximum number of matchsets for net-detect,5481* similar, but not necessarily identical, to max_match_sets for5482* scheduled scans.5483* See &struct cfg80211_sched_scan_request.@match_sets for more5484* details.5485* @tcp: TCP wakeup support information5486*/5487struct wiphy_wowlan_support {5488u32 flags;5489int n_patterns;5490int pattern_max_len;5491int pattern_min_len;5492int max_pkt_offset;5493int max_nd_match_sets;5494const struct wiphy_wowlan_tcp_support *tcp;5495};54965497/**5498* struct wiphy_coalesce_support - coalesce support data5499* @n_rules: maximum number of coalesce rules5500* @max_delay: maximum supported coalescing delay in msecs5501* @n_patterns: number of supported patterns in a rule5502* (see nl80211.h for the pattern definition)5503* @pattern_max_len: maximum length of each pattern5504* @pattern_min_len: minimum length of each pattern5505* @max_pkt_offset: maximum Rx packet offset5506*/5507struct wiphy_coalesce_support {5508int n_rules;5509int max_delay;5510int n_patterns;5511int pattern_max_len;5512int pattern_min_len;5513int max_pkt_offset;5514};55155516/**5517* enum wiphy_vendor_command_flags - validation flags for vendor commands5518* @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev5519* @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev5520* @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running5521* (must be combined with %_WDEV or %_NETDEV)5522*/5523enum wiphy_vendor_command_flags {5524WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),5525WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),5526WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),5527};55285529/**5530* enum wiphy_opmode_flag - Station's ht/vht operation mode information flags5531*5532* @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed5533* @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed5534* @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed5535*5536*/5537enum wiphy_opmode_flag {5538STA_OPMODE_MAX_BW_CHANGED = BIT(0),5539STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),5540STA_OPMODE_N_SS_CHANGED = BIT(2),5541};55425543/**5544* struct sta_opmode_info - Station's ht/vht operation mode information5545* @changed: contains value from &enum wiphy_opmode_flag5546* @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station5547* @bw: new max bandwidth value from &enum nl80211_chan_width of a station5548* @rx_nss: new rx_nss value of a station5549*/55505551struct sta_opmode_info {5552u32 changed;5553enum nl80211_smps_mode smps_mode;5554enum nl80211_chan_width bw;5555u8 rx_nss;5556};55575558#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))55595560/**5561* struct wiphy_vendor_command - vendor command definition5562* @info: vendor command identifying information, as used in nl802115563* @flags: flags, see &enum wiphy_vendor_command_flags5564* @doit: callback for the operation, note that wdev is %NULL if the5565* flags didn't ask for a wdev and non-%NULL otherwise; the data5566* pointer may be %NULL if userspace provided no data at all5567* @dumpit: dump callback, for transferring bigger/multiple items. The5568* @storage points to cb->args[5], ie. is preserved over the multiple5569* dumpit calls.5570* @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.5571* Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the5572* attribute is just raw data (e.g. a firmware command).5573* @maxattr: highest attribute number in policy5574* It's recommended to not have the same sub command with both @doit and5575* @dumpit, so that userspace can assume certain ones are get and others5576* are used with dump requests.5577*/5578struct wiphy_vendor_command {5579struct nl80211_vendor_cmd_info info;5580u32 flags;5581int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,5582const void *data, int data_len);5583int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,5584struct sk_buff *skb, const void *data, int data_len,5585unsigned long *storage);5586const struct nla_policy *policy;5587unsigned int maxattr;5588};55895590/**5591* struct wiphy_iftype_ext_capab - extended capabilities per interface type5592* @iftype: interface type5593* @extended_capabilities: extended capabilities supported by the driver,5594* additional capabilities might be supported by userspace; these are the5595* 802.11 extended capabilities ("Extended Capabilities element") and are5596* in the same format as in the information element. See IEEE Std5597* 802.11-2012 8.4.2.29 for the defined fields.5598* @extended_capabilities_mask: mask of the valid values5599* @extended_capabilities_len: length of the extended capabilities5600* @eml_capabilities: EML capabilities (for MLO)5601* @mld_capa_and_ops: MLD capabilities and operations (for MLO)5602*/5603struct wiphy_iftype_ext_capab {5604enum nl80211_iftype iftype;5605const u8 *extended_capabilities;5606const u8 *extended_capabilities_mask;5607u8 extended_capabilities_len;5608u16 eml_capabilities;5609u16 mld_capa_and_ops;5610};56115612/**5613* cfg80211_get_iftype_ext_capa - lookup interface type extended capability5614* @wiphy: the wiphy to look up from5615* @type: the interface type to look up5616*5617* Return: The extended capability for the given interface @type, may be %NULL5618*/5619const struct wiphy_iftype_ext_capab *5620cfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);56215622/**5623* struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities5624* @max_peers: maximum number of peers in a single measurement5625* @report_ap_tsf: can report assoc AP's TSF for radio resource measurement5626* @randomize_mac_addr: can randomize MAC address for measurement5627* @ftm: FTM measurement data5628* @ftm.supported: FTM measurement is supported5629* @ftm.asap: ASAP-mode is supported5630* @ftm.non_asap: non-ASAP-mode is supported5631* @ftm.request_lci: can request LCI data5632* @ftm.request_civicloc: can request civic location data5633* @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)5634* @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)5635* @ftm.max_bursts_exponent: maximum burst exponent supported5636* (set to -1 if not limited; note that setting this will necessarily5637* forbid using the value 15 to let the responder pick)5638* @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if5639* not limited)5640* @ftm.trigger_based: trigger based ranging measurement is supported5641* @ftm.non_trigger_based: non trigger based ranging measurement is supported5642*/5643struct cfg80211_pmsr_capabilities {5644unsigned int max_peers;5645u8 report_ap_tsf:1,5646randomize_mac_addr:1;56475648struct {5649u32 preambles;5650u32 bandwidths;5651s8 max_bursts_exponent;5652u8 max_ftms_per_burst;5653u8 supported:1,5654asap:1,5655non_asap:1,5656request_lci:1,5657request_civicloc:1,5658trigger_based:1,5659non_trigger_based:1;5660} ftm;5661};56625663/**5664* struct wiphy_iftype_akm_suites - This structure encapsulates supported akm5665* suites for interface types defined in @iftypes_mask. Each type in the5666* @iftypes_mask must be unique across all instances of iftype_akm_suites.5667*5668* @iftypes_mask: bitmask of interfaces types5669* @akm_suites: points to an array of supported akm suites5670* @n_akm_suites: number of supported AKM suites5671*/5672struct wiphy_iftype_akm_suites {5673u16 iftypes_mask;5674const u32 *akm_suites;5675int n_akm_suites;5676};56775678/**5679* struct wiphy_radio_cfg - physical radio config of a wiphy5680* This structure describes the configurations of a physical radio in a5681* wiphy. It is used to denote per-radio attributes belonging to a wiphy.5682*5683* @rts_threshold: RTS threshold (dot11RTSThreshold);5684* -1 (default) = RTS/CTS disabled5685*/5686struct wiphy_radio_cfg {5687u32 rts_threshold;5688};56895690/**5691* struct wiphy_radio_freq_range - wiphy frequency range5692* @start_freq: start range edge frequency (kHz)5693* @end_freq: end range edge frequency (kHz)5694*/5695struct wiphy_radio_freq_range {5696u32 start_freq;5697u32 end_freq;5698};569957005701/**5702* struct wiphy_radio - physical radio of a wiphy5703* This structure describes a physical radio belonging to a wiphy.5704* It is used to describe concurrent-channel capabilities. Only one channel5705* can be active on the radio described by struct wiphy_radio.5706*5707* @freq_range: frequency range that the radio can operate on.5708* @n_freq_range: number of elements in @freq_range5709*5710* @iface_combinations: Valid interface combinations array, should not5711* list single interface types.5712* @n_iface_combinations: number of entries in @iface_combinations array.5713*5714* @antenna_mask: bitmask of antennas connected to this radio.5715*/5716struct wiphy_radio {5717const struct wiphy_radio_freq_range *freq_range;5718int n_freq_range;57195720const struct ieee80211_iface_combination *iface_combinations;5721int n_iface_combinations;57225723u32 antenna_mask;5724};57255726/**5727* enum wiphy_nan_flags - NAN capabilities5728*5729* @WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC: Device supports NAN configurable5730* synchronization.5731* @WIPHY_NAN_FLAGS_USERSPACE_DE: Device doesn't support DE offload.5732*/5733enum wiphy_nan_flags {5734WIPHY_NAN_FLAGS_CONFIGURABLE_SYNC = BIT(0),5735WIPHY_NAN_FLAGS_USERSPACE_DE = BIT(1),5736};57375738/**5739* struct wiphy_nan_capa - NAN capabilities5740*5741* This structure describes the NAN capabilities of a wiphy.5742*5743* @flags: NAN capabilities flags, see &enum wiphy_nan_flags5744* @op_mode: NAN operation mode, as defined in Wi-Fi Aware (TM) specification5745* Table 81.5746* @n_antennas: number of antennas supported by the device for Tx/Rx. Lower5747* nibble indicates the number of TX antennas and upper nibble indicates the5748* number of RX antennas. Value 0 indicates the information is not5749* available.5750* @max_channel_switch_time: maximum channel switch time in milliseconds.5751* @dev_capabilities: NAN device capabilities as defined in Wi-Fi Aware (TM)5752* specification Table 79 (Capabilities field).5753*/5754struct wiphy_nan_capa {5755u32 flags;5756u8 op_mode;5757u8 n_antennas;5758u16 max_channel_switch_time;5759u8 dev_capabilities;5760};57615762#define CFG80211_HW_TIMESTAMP_ALL_PEERS 0xffff57635764/**5765* struct wiphy - wireless hardware description5766* @mtx: mutex for the data (structures) of this device5767* @reg_notifier: the driver's regulatory notification callback,5768* note that if your driver uses wiphy_apply_custom_regulatory()5769* the reg_notifier's request can be passed as NULL5770* @regd: the driver's regulatory domain, if one was requested via5771* the regulatory_hint() API. This can be used by the driver5772* on the reg_notifier() if it chooses to ignore future5773* regulatory domain changes caused by other drivers.5774* @signal_type: signal type reported in &struct cfg80211_bss.5775* @cipher_suites: supported cipher suites5776* @n_cipher_suites: number of supported cipher suites5777* @akm_suites: supported AKM suites. These are the default AKMs supported if5778* the supported AKMs not advertized for a specific interface type in5779* iftype_akm_suites.5780* @n_akm_suites: number of supported AKM suites5781* @iftype_akm_suites: array of supported akm suites info per interface type.5782* Note that the bits in @iftypes_mask inside this structure cannot5783* overlap (i.e. only one occurrence of each type is allowed across all5784* instances of iftype_akm_suites).5785* @num_iftype_akm_suites: number of interface types for which supported akm5786* suites are specified separately.5787* @retry_short: Retry limit for short frames (dot11ShortRetryLimit)5788* @retry_long: Retry limit for long frames (dot11LongRetryLimit)5789* @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);5790* -1 = fragmentation disabled, only odd values >= 256 used5791* @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled5792* @_net: the network namespace this wiphy currently lives in5793* @perm_addr: permanent MAC address of this device5794* @addr_mask: If the device supports multiple MAC addresses by masking,5795* set this to a mask with variable bits set to 1, e.g. if the last5796* four bits are variable then set it to 00-00-00-00-00-0f. The actual5797* variable bits shall be determined by the interfaces added, with5798* interfaces not matching the mask being rejected to be brought up.5799* @n_addresses: number of addresses in @addresses.5800* @addresses: If the device has more than one address, set this pointer5801* to a list of addresses (6 bytes each). The first one will be used5802* by default for perm_addr. In this case, the mask should be set to5803* all-zeroes. In this case it is assumed that the device can handle5804* the same number of arbitrary MAC addresses.5805* @registered: protects ->resume and ->suspend sysfs callbacks against5806* unregister hardware5807* @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).5808* It will be renamed automatically on wiphy renames5809* @dev: (virtual) struct device for this wiphy. The item in5810* /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()5811* (see below).5812* @wext: wireless extension handlers5813* @priv: driver private data (sized according to wiphy_new() parameter)5814* @interface_modes: bitmask of interfaces types valid for this wiphy,5815* must be set by driver5816* @iface_combinations: Valid interface combinations array, should not5817* list single interface types.5818* @n_iface_combinations: number of entries in @iface_combinations array.5819* @software_iftypes: bitmask of software interface types, these are not5820* subject to any restrictions since they are purely managed in SW.5821* @flags: wiphy flags, see &enum wiphy_flags5822* @regulatory_flags: wiphy regulatory flags, see5823* &enum ieee80211_regulatory_flags5824* @features: features advertised to nl80211, see &enum nl80211_feature_flags.5825* @ext_features: extended features advertised to nl80211, see5826* &enum nl80211_ext_feature_index.5827* @bss_priv_size: each BSS struct has private data allocated with it,5828* this variable determines its size5829* @max_scan_ssids: maximum number of SSIDs the device can scan for in5830* any given scan5831* @max_sched_scan_reqs: maximum number of scheduled scan requests that5832* the device can run concurrently.5833* @max_sched_scan_ssids: maximum number of SSIDs the device can scan5834* for in any given scheduled scan5835* @max_match_sets: maximum number of match sets the device can handle5836* when performing a scheduled scan, 0 if filtering is not5837* supported.5838* @max_scan_ie_len: maximum length of user-controlled IEs device can5839* add to probe request frames transmitted during a scan, must not5840* include fixed IEs like supported rates5841* @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled5842* scans5843* @max_sched_scan_plans: maximum number of scan plans (scan interval and number5844* of iterations) for scheduled scan supported by the device.5845* @max_sched_scan_plan_interval: maximum interval (in seconds) for a5846* single scan plan supported by the device.5847* @max_sched_scan_plan_iterations: maximum number of iterations for a single5848* scan plan supported by the device.5849* @coverage_class: current coverage class5850* @fw_version: firmware version for ethtool reporting5851* @hw_version: hardware version for ethtool reporting5852* @max_num_pmkids: maximum number of PMKIDs supported by device5853* @privid: a pointer that drivers can use to identify if an arbitrary5854* wiphy is theirs, e.g. in global notifiers5855* @bands: information about bands/channels supported by this device5856*5857* @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or5858* transmitted through nl80211, points to an array indexed by interface5859* type5860*5861* @available_antennas_tx: bitmap of antennas which are available to be5862* configured as TX antennas. Antenna configuration commands will be5863* rejected unless this or @available_antennas_rx is set.5864*5865* @available_antennas_rx: bitmap of antennas which are available to be5866* configured as RX antennas. Antenna configuration commands will be5867* rejected unless this or @available_antennas_tx is set.5868*5869* @probe_resp_offload:5870* Bitmap of supported protocols for probe response offloading.5871* See &enum nl80211_probe_resp_offload_support_attr. Only valid5872* when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.5873*5874* @max_remain_on_channel_duration: Maximum time a remain-on-channel operation5875* may request, if implemented.5876*5877* @wowlan: WoWLAN support information5878* @wowlan_config: current WoWLAN configuration; this should usually not be5879* used since access to it is necessarily racy, use the parameter passed5880* to the suspend() operation instead.5881*5882* @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.5883* @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.5884* If null, then none can be over-ridden.5885* @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.5886* If null, then none can be over-ridden.5887*5888* @wdev_list: the list of associated (virtual) interfaces; this list must5889* not be modified by the driver, but can be read with RTNL/RCU protection.5890*5891* @max_acl_mac_addrs: Maximum number of MAC addresses that the device5892* supports for ACL.5893*5894* @extended_capabilities: extended capabilities supported by the driver,5895* additional capabilities might be supported by userspace; these are5896* the 802.11 extended capabilities ("Extended Capabilities element")5897* and are in the same format as in the information element. See5898* 802.11-2012 8.4.2.29 for the defined fields. These are the default5899* extended capabilities to be used if the capabilities are not specified5900* for a specific interface type in iftype_ext_capab.5901* @extended_capabilities_mask: mask of the valid values5902* @extended_capabilities_len: length of the extended capabilities5903* @iftype_ext_capab: array of extended capabilities per interface type5904* @num_iftype_ext_capab: number of interface types for which extended5905* capabilities are specified separately.5906* @coalesce: packet coalescing support information5907*5908* @vendor_commands: array of vendor commands supported by the hardware5909* @n_vendor_commands: number of vendor commands5910* @vendor_events: array of vendor events supported by the hardware5911* @n_vendor_events: number of vendor events5912*5913* @max_ap_assoc_sta: maximum number of associated stations supported in AP mode5914* (including P2P GO) or 0 to indicate no such limit is advertised. The5915* driver is allowed to advertise a theoretical limit that it can reach in5916* some cases, but may not always reach.5917*5918* @max_num_csa_counters: Number of supported csa_counters in beacons5919* and probe responses. This value should be set if the driver5920* wishes to limit the number of csa counters. Default (0) means5921* infinite.5922* @bss_param_support: bitmask indicating which bss_parameters as defined in5923* &struct bss_parameters the driver can actually handle in the5924* .change_bss() callback. The bit positions are defined in &enum5925* wiphy_bss_param_flags.5926*5927* @bss_select_support: bitmask indicating the BSS selection criteria supported5928* by the driver in the .connect() callback. The bit position maps to the5929* attribute indices defined in &enum nl80211_bss_select_attr.5930*5931* @nan_supported_bands: bands supported by the device in NAN mode, a5932* bitmap of &enum nl80211_band values. For instance, for5933* NL80211_BAND_2GHZ, bit 0 would be set5934* (i.e. BIT(NL80211_BAND_2GHZ)).5935* @nan_capa: NAN capabilities5936*5937* @txq_limit: configuration of internal TX queue frame limit5938* @txq_memory_limit: configuration internal TX queue memory limit5939* @txq_quantum: configuration of internal TX queue scheduler quantum5940*5941* @tx_queue_len: allow setting transmit queue len for drivers not using5942* wake_tx_queue5943*5944* @support_mbssid: can HW support association with nontransmitted AP5945* @support_only_he_mbssid: don't parse MBSSID elements if it is not5946* HE AP, in order to avoid compatibility issues.5947* @support_mbssid must be set for this to have any effect.5948*5949* @pmsr_capa: peer measurement capabilities5950*5951* @tid_config_support: describes the per-TID config support that the5952* device has5953* @tid_config_support.vif: bitmap of attributes (configurations)5954* supported by the driver for each vif5955* @tid_config_support.peer: bitmap of attributes (configurations)5956* supported by the driver for each peer5957* @tid_config_support.max_retry: maximum supported retry count for5958* long/short retry configuration5959*5960* @max_data_retry_count: maximum supported per TID retry count for5961* configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and5962* %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes5963* @sar_capa: SAR control capabilities5964* @rfkill: a pointer to the rfkill structure5965*5966* @mbssid_max_interfaces: maximum number of interfaces supported by the driver5967* in a multiple BSSID set. This field must be set to a non-zero value5968* by the driver to advertise MBSSID support.5969* @ema_max_profile_periodicity: maximum profile periodicity supported by5970* the driver. Setting this field to a non-zero value indicates that the5971* driver supports enhanced multi-BSSID advertisements (EMA AP).5972* @max_num_akm_suites: maximum number of AKM suites allowed for5973* configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and5974* %NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by5975* driver. If set by driver minimum allowed value is5976* NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with5977* legacy userspace and maximum allowed value is5978* CFG80211_MAX_NUM_AKM_SUITES.5979*5980* @hw_timestamp_max_peers: maximum number of peers that the driver supports5981* enabling HW timestamping for concurrently. Setting this field to a5982* non-zero value indicates that the driver supports HW timestamping.5983* A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver5984* supports enabling HW timestamping for all peers (i.e. no need to5985* specify a mac address).5986*5987* @radio_cfg: configuration of radios belonging to a muli-radio wiphy. This5988* struct contains a list of all radio specific attributes and should be5989* used only for multi-radio wiphy.5990*5991* @radio: radios belonging to this wiphy5992* @n_radio: number of radios5993*/5994struct wiphy {5995struct mutex mtx;59965997/* assign these fields before you register the wiphy */59985999u8 perm_addr[ETH_ALEN];6000u8 addr_mask[ETH_ALEN];60016002struct mac_address *addresses;60036004const struct ieee80211_txrx_stypes *mgmt_stypes;60056006const struct ieee80211_iface_combination *iface_combinations;6007int n_iface_combinations;6008u16 software_iftypes;60096010u16 n_addresses;60116012/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */6013u16 interface_modes;60146015u16 max_acl_mac_addrs;60166017u32 flags, regulatory_flags, features;6018u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];60196020u32 ap_sme_capa;60216022enum cfg80211_signal_type signal_type;60236024int bss_priv_size;6025u8 max_scan_ssids;6026u8 max_sched_scan_reqs;6027u8 max_sched_scan_ssids;6028u8 max_match_sets;6029u16 max_scan_ie_len;6030u16 max_sched_scan_ie_len;6031u32 max_sched_scan_plans;6032u32 max_sched_scan_plan_interval;6033u32 max_sched_scan_plan_iterations;60346035int n_cipher_suites;6036const u32 *cipher_suites;60376038int n_akm_suites;6039const u32 *akm_suites;60406041const struct wiphy_iftype_akm_suites *iftype_akm_suites;6042unsigned int num_iftype_akm_suites;60436044u8 retry_short;6045u8 retry_long;6046u32 frag_threshold;6047u32 rts_threshold;6048u8 coverage_class;60496050char fw_version[ETHTOOL_FWVERS_LEN];6051u32 hw_version;60526053#ifdef CONFIG_PM6054const struct wiphy_wowlan_support *wowlan;6055struct cfg80211_wowlan *wowlan_config;6056#endif60576058u16 max_remain_on_channel_duration;60596060u8 max_num_pmkids;60616062u32 available_antennas_tx;6063u32 available_antennas_rx;60646065u32 probe_resp_offload;60666067const u8 *extended_capabilities, *extended_capabilities_mask;6068u8 extended_capabilities_len;60696070const struct wiphy_iftype_ext_capab *iftype_ext_capab;6071unsigned int num_iftype_ext_capab;60726073const void *privid;60746075struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];60766077void (*reg_notifier)(struct wiphy *wiphy,6078struct regulatory_request *request);60796080struct wiphy_radio_cfg *radio_cfg;60816082/* fields below are read-only, assigned by cfg80211 */60836084const struct ieee80211_regdomain __rcu *regd;60856086struct device dev;60876088bool registered;60896090struct dentry *debugfsdir;60916092const struct ieee80211_ht_cap *ht_capa_mod_mask;6093const struct ieee80211_vht_cap *vht_capa_mod_mask;60946095struct list_head wdev_list;60966097possible_net_t _net;60986099#ifdef CONFIG_CFG80211_WEXT6100const struct iw_handler_def *wext;6101#endif61026103const struct wiphy_coalesce_support *coalesce;61046105const struct wiphy_vendor_command *vendor_commands;6106const struct nl80211_vendor_cmd_info *vendor_events;6107int n_vendor_commands, n_vendor_events;61086109u16 max_ap_assoc_sta;61106111u8 max_num_csa_counters;61126113u32 bss_param_support;6114u32 bss_select_support;61156116u8 nan_supported_bands;6117struct wiphy_nan_capa nan_capa;61186119u32 txq_limit;6120u32 txq_memory_limit;6121u32 txq_quantum;61226123unsigned long tx_queue_len;61246125u8 support_mbssid:1,6126support_only_he_mbssid:1;61276128const struct cfg80211_pmsr_capabilities *pmsr_capa;61296130struct {6131u64 peer, vif;6132u8 max_retry;6133} tid_config_support;61346135u8 max_data_retry_count;61366137const struct cfg80211_sar_capa *sar_capa;61386139struct rfkill *rfkill;61406141u8 mbssid_max_interfaces;6142u8 ema_max_profile_periodicity;6143u16 max_num_akm_suites;61446145u16 hw_timestamp_max_peers;61466147int n_radio;6148const struct wiphy_radio *radio;61496150char priv[] __aligned(NETDEV_ALIGN);6151};61526153static inline struct net *wiphy_net(struct wiphy *wiphy)6154{6155return read_pnet(&wiphy->_net);6156}61576158static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)6159{6160write_pnet(&wiphy->_net, net);6161}61626163/**6164* wiphy_priv - return priv from wiphy6165*6166* @wiphy: the wiphy whose priv pointer to return6167* Return: The priv of @wiphy.6168*/6169static inline void *wiphy_priv(struct wiphy *wiphy)6170{6171BUG_ON(!wiphy);6172return &wiphy->priv;6173}61746175/**6176* priv_to_wiphy - return the wiphy containing the priv6177*6178* @priv: a pointer previously returned by wiphy_priv6179* Return: The wiphy of @priv.6180*/6181static inline struct wiphy *priv_to_wiphy(void *priv)6182{6183BUG_ON(!priv);6184return container_of(priv, struct wiphy, priv);6185}61866187/**6188* set_wiphy_dev - set device pointer for wiphy6189*6190* @wiphy: The wiphy whose device to bind6191* @dev: The device to parent it to6192*/6193static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)6194{6195wiphy->dev.parent = dev;6196}61976198/**6199* wiphy_dev - get wiphy dev pointer6200*6201* @wiphy: The wiphy whose device struct to look up6202* Return: The dev of @wiphy.6203*/6204static inline struct device *wiphy_dev(struct wiphy *wiphy)6205{6206return wiphy->dev.parent;6207}62086209/**6210* wiphy_name - get wiphy name6211*6212* @wiphy: The wiphy whose name to return6213* Return: The name of @wiphy.6214*/6215static inline const char *wiphy_name(const struct wiphy *wiphy)6216{6217return dev_name(&wiphy->dev);6218}62196220/**6221* wiphy_new_nm - create a new wiphy for use with cfg802116222*6223* @ops: The configuration operations for this device6224* @sizeof_priv: The size of the private area to allocate6225* @requested_name: Request a particular name.6226* NULL is valid value, and means use the default phy%d naming.6227*6228* Create a new wiphy and associate the given operations with it.6229* @sizeof_priv bytes are allocated for private use.6230*6231* Return: A pointer to the new wiphy. This pointer must be6232* assigned to each netdev's ieee80211_ptr for proper operation.6233*/6234struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,6235const char *requested_name);62366237/**6238* wiphy_new - create a new wiphy for use with cfg802116239*6240* @ops: The configuration operations for this device6241* @sizeof_priv: The size of the private area to allocate6242*6243* Create a new wiphy and associate the given operations with it.6244* @sizeof_priv bytes are allocated for private use.6245*6246* Return: A pointer to the new wiphy. This pointer must be6247* assigned to each netdev's ieee80211_ptr for proper operation.6248*/6249static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,6250int sizeof_priv)6251{6252return wiphy_new_nm(ops, sizeof_priv, NULL);6253}62546255/**6256* wiphy_register - register a wiphy with cfg802116257*6258* @wiphy: The wiphy to register.6259*6260* Return: A non-negative wiphy index or a negative error code.6261*/6262int wiphy_register(struct wiphy *wiphy);62636264/* this is a define for better error reporting (file/line) */6265#define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)62666267/**6268* rcu_dereference_wiphy - rcu_dereference with debug checking6269* @wiphy: the wiphy to check the locking on6270* @p: The pointer to read, prior to dereferencing6271*6272* Do an rcu_dereference(p), but check caller either holds rcu_read_lock()6273* or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().6274*/6275#define rcu_dereference_wiphy(wiphy, p) \6276rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))62776278/**6279* wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx6280* @wiphy: the wiphy to check the locking on6281* @p: The pointer to read, prior to dereferencing6282*6283* Return: the value of the specified RCU-protected pointer, but omit the6284* READ_ONCE(), because caller holds the wiphy mutex used for updates.6285*/6286#define wiphy_dereference(wiphy, p) \6287rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))62886289/**6290* get_wiphy_regdom - get custom regdomain for the given wiphy6291* @wiphy: the wiphy to get the regdomain from6292*6293* Context: Requires any of RTNL, wiphy mutex or RCU protection.6294*6295* Return: pointer to the regulatory domain associated with the wiphy6296*/6297const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);62986299/**6300* wiphy_unregister - deregister a wiphy from cfg802116301*6302* @wiphy: The wiphy to unregister.6303*6304* After this call, no more requests can be made with this priv6305* pointer, but the call may sleep to wait for an outstanding6306* request that is being handled.6307*/6308void wiphy_unregister(struct wiphy *wiphy);63096310/**6311* wiphy_free - free wiphy6312*6313* @wiphy: The wiphy to free6314*/6315void wiphy_free(struct wiphy *wiphy);63166317/* internal structs */6318struct cfg80211_conn;6319struct cfg80211_internal_bss;6320struct cfg80211_cached_keys;6321struct cfg80211_cqm_config;63226323/**6324* wiphy_lock - lock the wiphy6325* @wiphy: the wiphy to lock6326*6327* This is needed around registering and unregistering netdevs that6328* aren't created through cfg80211 calls, since that requires locking6329* in cfg80211 when the notifiers is called, but that cannot6330* differentiate which way it's called.6331*6332* It can also be used by drivers for their own purposes.6333*6334* When cfg80211 ops are called, the wiphy is already locked.6335*6336* Note that this makes sure that no workers that have been queued6337* with wiphy_queue_work() are running.6338*/6339static inline void wiphy_lock(struct wiphy *wiphy)6340__acquires(&wiphy->mtx)6341{6342mutex_lock(&wiphy->mtx);6343__acquire(&wiphy->mtx);6344}63456346/**6347* wiphy_unlock - unlock the wiphy again6348* @wiphy: the wiphy to unlock6349*/6350static inline void wiphy_unlock(struct wiphy *wiphy)6351__releases(&wiphy->mtx)6352{6353__release(&wiphy->mtx);6354mutex_unlock(&wiphy->mtx);6355}63566357DEFINE_GUARD(wiphy, struct wiphy *,6358mutex_lock(&_T->mtx),6359mutex_unlock(&_T->mtx))63606361struct wiphy_work;6362typedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *);63636364struct wiphy_work {6365struct list_head entry;6366wiphy_work_func_t func;6367};63686369static inline void wiphy_work_init(struct wiphy_work *work,6370wiphy_work_func_t func)6371{6372INIT_LIST_HEAD(&work->entry);6373work->func = func;6374}63756376/**6377* wiphy_work_queue - queue work for the wiphy6378* @wiphy: the wiphy to queue for6379* @work: the work item6380*6381* This is useful for work that must be done asynchronously, and work6382* queued here has the special property that the wiphy mutex will be6383* held as if wiphy_lock() was called, and that it cannot be running6384* after wiphy_lock() was called. Therefore, wiphy_cancel_work() can6385* use just cancel_work() instead of cancel_work_sync(), it requires6386* being in a section protected by wiphy_lock().6387*/6388void wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work);63896390/**6391* wiphy_work_cancel - cancel previously queued work6392* @wiphy: the wiphy, for debug purposes6393* @work: the work to cancel6394*6395* Cancel the work *without* waiting for it, this assumes being6396* called under the wiphy mutex acquired by wiphy_lock().6397*/6398void wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work);63996400/**6401* wiphy_work_flush - flush previously queued work6402* @wiphy: the wiphy, for debug purposes6403* @work: the work to flush, this can be %NULL to flush all work6404*6405* Flush the work (i.e. run it if pending). This must be called6406* under the wiphy mutex acquired by wiphy_lock().6407*/6408void wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work);64096410struct wiphy_delayed_work {6411struct wiphy_work work;6412struct wiphy *wiphy;6413struct timer_list timer;6414};64156416void wiphy_delayed_work_timer(struct timer_list *t);64176418static inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork,6419wiphy_work_func_t func)6420{6421timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0);6422wiphy_work_init(&dwork->work, func);6423}64246425/**6426* wiphy_delayed_work_queue - queue delayed work for the wiphy6427* @wiphy: the wiphy to queue for6428* @dwork: the delayable worker6429* @delay: number of jiffies to wait before queueing6430*6431* This is useful for work that must be done asynchronously, and work6432* queued here has the special property that the wiphy mutex will be6433* held as if wiphy_lock() was called, and that it cannot be running6434* after wiphy_lock() was called. Therefore, wiphy_cancel_work() can6435* use just cancel_work() instead of cancel_work_sync(), it requires6436* being in a section protected by wiphy_lock().6437*/6438void wiphy_delayed_work_queue(struct wiphy *wiphy,6439struct wiphy_delayed_work *dwork,6440unsigned long delay);64416442/**6443* wiphy_delayed_work_cancel - cancel previously queued delayed work6444* @wiphy: the wiphy, for debug purposes6445* @dwork: the delayed work to cancel6446*6447* Cancel the work *without* waiting for it, this assumes being6448* called under the wiphy mutex acquired by wiphy_lock().6449*/6450void wiphy_delayed_work_cancel(struct wiphy *wiphy,6451struct wiphy_delayed_work *dwork);64526453/**6454* wiphy_delayed_work_flush - flush previously queued delayed work6455* @wiphy: the wiphy, for debug purposes6456* @dwork: the delayed work to flush6457*6458* Flush the work (i.e. run it if pending). This must be called6459* under the wiphy mutex acquired by wiphy_lock().6460*/6461void wiphy_delayed_work_flush(struct wiphy *wiphy,6462struct wiphy_delayed_work *dwork);64636464/**6465* wiphy_delayed_work_pending - Find out whether a wiphy delayable6466* work item is currently pending.6467*6468* @wiphy: the wiphy, for debug purposes6469* @dwork: the delayed work in question6470*6471* Return: true if timer is pending, false otherwise6472*6473* How wiphy_delayed_work_queue() works is by setting a timer which6474* when it expires calls wiphy_work_queue() to queue the wiphy work.6475* Because wiphy_delayed_work_queue() uses mod_timer(), if it is6476* called twice and the second call happens before the first call6477* deadline, the work will rescheduled for the second deadline and6478* won't run before that.6479*6480* wiphy_delayed_work_pending() can be used to detect if calling6481* wiphy_work_delayed_work_queue() would start a new work schedule6482* or delayed a previous one. As seen below it cannot be used to6483* detect precisely if the work has finished to execute nor if it6484* is currently executing.6485*6486* CPU0 CPU16487* wiphy_delayed_work_queue(wk)6488* mod_timer(wk->timer)6489* wiphy_delayed_work_pending(wk) -> true6490*6491* [...]6492* expire_timers(wk->timer)6493* detach_timer(wk->timer)6494* wiphy_delayed_work_pending(wk) -> false6495* wk->timer->function() |6496* wiphy_work_queue(wk) | delayed work pending6497* list_add_tail() | returns false but6498* queue_work(cfg80211_wiphy_work) | wk->func() has not6499* | been run yet6500* [...] |6501* cfg80211_wiphy_work() |6502* wk->func() V6503*6504*/6505bool wiphy_delayed_work_pending(struct wiphy *wiphy,6506struct wiphy_delayed_work *dwork);65076508/**6509* enum ieee80211_ap_reg_power - regulatory power for an Access Point6510*6511* @IEEE80211_REG_UNSET_AP: Access Point has no regulatory power mode6512* @IEEE80211_REG_LPI_AP: Indoor Access Point6513* @IEEE80211_REG_SP_AP: Standard power Access Point6514* @IEEE80211_REG_VLP_AP: Very low power Access Point6515*/6516enum ieee80211_ap_reg_power {6517IEEE80211_REG_UNSET_AP,6518IEEE80211_REG_LPI_AP,6519IEEE80211_REG_SP_AP,6520IEEE80211_REG_VLP_AP,6521};65226523/**6524* struct wireless_dev - wireless device state6525*6526* For netdevs, this structure must be allocated by the driver6527* that uses the ieee80211_ptr field in struct net_device (this6528* is intentional so it can be allocated along with the netdev.)6529* It need not be registered then as netdev registration will6530* be intercepted by cfg80211 to see the new wireless device,6531* however, drivers must lock the wiphy before registering or6532* unregistering netdevs if they pre-create any netdevs (in ops6533* called from cfg80211, the wiphy is already locked.)6534*6535* For non-netdev uses, it must also be allocated by the driver6536* in response to the cfg80211 callbacks that require it, as6537* there's no netdev registration in that case it may not be6538* allocated outside of callback operations that return it.6539*6540* @wiphy: pointer to hardware description6541* @iftype: interface type6542* @registered: is this wdev already registered with cfg802116543* @registering: indicates we're doing registration under wiphy lock6544* for the notifier6545* @list: (private) Used to collect the interfaces6546* @netdev: (private) Used to reference back to the netdev, may be %NULL6547* @identifier: (private) Identifier used in nl80211 to identify this6548* wireless device if it has no netdev6549* @u: union containing data specific to @iftype6550* @connected: indicates if connected or not (STA mode)6551* @wext: (private) Used by the internal wireless extensions compat code6552* @wext.ibss: (private) IBSS data part of wext handling6553* @wext.connect: (private) connection handling data6554* @wext.keys: (private) (WEP) key data6555* @wext.ie: (private) extra elements for association6556* @wext.ie_len: (private) length of extra elements6557* @wext.bssid: (private) selected network BSSID6558* @wext.ssid: (private) selected network SSID6559* @wext.default_key: (private) selected default key index6560* @wext.default_mgmt_key: (private) selected default management key index6561* @wext.prev_bssid: (private) previous BSSID for reassociation6562* @wext.prev_bssid_valid: (private) previous BSSID validity6563* @use_4addr: indicates 4addr mode is used on this interface, must be6564* set by driver (if supported) on add_interface BEFORE registering the6565* netdev and may otherwise be used by driver read-only, will be update6566* by cfg80211 on change_interface6567* @mgmt_registrations: list of registrations for management frames6568* @mgmt_registrations_need_update: mgmt registrations were updated,6569* need to propagate the update to the driver6570* @address: The address for this device, valid only if @netdev is %NULL6571* @is_running: true if this is a non-netdev device that has been started, e.g.6572* the P2P Device.6573* @ps: powersave mode is enabled6574* @ps_timeout: dynamic powersave timeout6575* @ap_unexpected_nlportid: (private) netlink port ID of application6576* registered for unexpected class 3 frames (AP mode)6577* @conn: (private) cfg80211 software SME connection state machine data6578* @connect_keys: (private) keys to set after connection is established6579* @conn_bss_type: connecting/connected BSS type6580* @conn_owner_nlportid: (private) connection owner socket port ID6581* @disconnect_wk: (private) auto-disconnect work6582* @disconnect_bssid: (private) the BSSID to use for auto-disconnect6583* @event_list: (private) list for internal event processing6584* @event_lock: (private) lock for event list6585* @owner_nlportid: (private) owner socket port ID6586* @nl_owner_dead: (private) owner socket went away6587* @cqm_rssi_work: (private) CQM RSSI reporting work6588* @cqm_config: (private) nl80211 RSSI monitor state6589* @pmsr_list: (private) peer measurement requests6590* @pmsr_lock: (private) peer measurements requests/results lock6591* @pmsr_free_wk: (private) peer measurements cleanup work6592* @unprot_beacon_reported: (private) timestamp of last6593* unprotected beacon report6594* @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr6595* @ap and @client for each link6596* @links.cac_started: true if DFS channel availability check has been6597* started6598* @links.cac_start_time: timestamp (jiffies) when the dfs state was6599* entered.6600* @links.cac_time_ms: CAC time in ms6601* @valid_links: bitmap describing what elements of @links are valid6602* @radio_mask: Bitmask of radios that this interface is allowed to operate on.6603*/6604struct wireless_dev {6605struct wiphy *wiphy;6606enum nl80211_iftype iftype;66076608/* the remainder of this struct should be private to cfg80211 */6609struct list_head list;6610struct net_device *netdev;66116612u32 identifier;66136614struct list_head mgmt_registrations;6615u8 mgmt_registrations_need_update:1;66166617bool use_4addr, is_running, registered, registering;66186619u8 address[ETH_ALEN] __aligned(sizeof(u16));66206621/* currently used for IBSS and SME - might be rearranged later */6622struct cfg80211_conn *conn;6623struct cfg80211_cached_keys *connect_keys;6624enum ieee80211_bss_type conn_bss_type;6625u32 conn_owner_nlportid;66266627struct work_struct disconnect_wk;6628u8 disconnect_bssid[ETH_ALEN];66296630struct list_head event_list;6631spinlock_t event_lock;66326633u8 connected:1;66346635bool ps;6636int ps_timeout;66376638u32 ap_unexpected_nlportid;66396640u32 owner_nlportid;6641bool nl_owner_dead;66426643#ifdef CONFIG_CFG80211_WEXT6644/* wext data */6645struct {6646struct cfg80211_ibss_params ibss;6647struct cfg80211_connect_params connect;6648struct cfg80211_cached_keys *keys;6649const u8 *ie;6650size_t ie_len;6651u8 bssid[ETH_ALEN];6652u8 prev_bssid[ETH_ALEN];6653u8 ssid[IEEE80211_MAX_SSID_LEN];6654s8 default_key, default_mgmt_key;6655bool prev_bssid_valid;6656} wext;6657#endif66586659struct wiphy_work cqm_rssi_work;6660struct cfg80211_cqm_config __rcu *cqm_config;66616662struct list_head pmsr_list;6663spinlock_t pmsr_lock;6664struct work_struct pmsr_free_wk;66656666unsigned long unprot_beacon_reported;66676668union {6669struct {6670u8 connected_addr[ETH_ALEN] __aligned(2);6671u8 ssid[IEEE80211_MAX_SSID_LEN];6672u8 ssid_len;6673} client;6674struct {6675int beacon_interval;6676struct cfg80211_chan_def preset_chandef;6677struct cfg80211_chan_def chandef;6678u8 id[IEEE80211_MAX_MESH_ID_LEN];6679u8 id_len, id_up_len;6680} mesh;6681struct {6682struct cfg80211_chan_def preset_chandef;6683u8 ssid[IEEE80211_MAX_SSID_LEN];6684u8 ssid_len;6685} ap;6686struct {6687struct cfg80211_internal_bss *current_bss;6688struct cfg80211_chan_def chandef;6689int beacon_interval;6690u8 ssid[IEEE80211_MAX_SSID_LEN];6691u8 ssid_len;6692} ibss;6693struct {6694struct cfg80211_chan_def chandef;6695} ocb;6696struct {6697u8 cluster_id[ETH_ALEN] __aligned(2);6698} nan;6699} u;67006701struct {6702u8 addr[ETH_ALEN] __aligned(2);6703union {6704struct {6705unsigned int beacon_interval;6706struct cfg80211_chan_def chandef;6707} ap;6708struct {6709struct cfg80211_internal_bss *current_bss;6710} client;6711};67126713bool cac_started;6714unsigned long cac_start_time;6715unsigned int cac_time_ms;6716} links[IEEE80211_MLD_MAX_NUM_LINKS];6717u16 valid_links;67186719u32 radio_mask;6720};67216722static inline const u8 *wdev_address(struct wireless_dev *wdev)6723{6724if (wdev->netdev)6725return wdev->netdev->dev_addr;6726return wdev->address;6727}67286729static inline bool wdev_running(struct wireless_dev *wdev)6730{6731if (wdev->netdev)6732return netif_running(wdev->netdev);6733return wdev->is_running;6734}67356736/**6737* wdev_priv - return wiphy priv from wireless_dev6738*6739* @wdev: The wireless device whose wiphy's priv pointer to return6740* Return: The wiphy priv of @wdev.6741*/6742static inline void *wdev_priv(struct wireless_dev *wdev)6743{6744BUG_ON(!wdev);6745return wiphy_priv(wdev->wiphy);6746}67476748/**6749* wdev_chandef - return chandef pointer from wireless_dev6750* @wdev: the wdev6751* @link_id: the link ID for MLO6752*6753* Return: The chandef depending on the mode, or %NULL.6754*/6755struct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,6756unsigned int link_id);67576758static inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,6759unsigned int link_id)6760{6761WARN_ON(link_id && !wdev->valid_links);6762WARN_ON(wdev->valid_links &&6763!(wdev->valid_links & BIT(link_id)));6764}67656766#define for_each_valid_link(link_info, link_id) \6767for (link_id = 0; \6768link_id < ((link_info)->valid_links ? \6769ARRAY_SIZE((link_info)->links) : 1); \6770link_id++) \6771if (!(link_info)->valid_links || \6772((link_info)->valid_links & BIT(link_id)))67736774/**6775* DOC: Utility functions6776*6777* cfg80211 offers a number of utility functions that can be useful.6778*/67796780/**6781* ieee80211_channel_equal - compare two struct ieee80211_channel6782*6783* @a: 1st struct ieee80211_channel6784* @b: 2nd struct ieee80211_channel6785* Return: true if center frequency of @a == @b6786*/6787static inline bool6788ieee80211_channel_equal(struct ieee80211_channel *a,6789struct ieee80211_channel *b)6790{6791return (a->center_freq == b->center_freq &&6792a->freq_offset == b->freq_offset);6793}67946795/**6796* ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz6797* @chan: struct ieee80211_channel to convert6798* Return: The corresponding frequency (in KHz)6799*/6800static inline u326801ieee80211_channel_to_khz(const struct ieee80211_channel *chan)6802{6803return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;6804}68056806/**6807* ieee80211_channel_to_freq_khz - convert channel number to frequency6808* @chan: channel number6809* @band: band, necessary due to channel number overlap6810* Return: The corresponding frequency (in KHz), or 0 if the conversion failed.6811*/6812u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);68136814/**6815* ieee80211_channel_to_frequency - convert channel number to frequency6816* @chan: channel number6817* @band: band, necessary due to channel number overlap6818* Return: The corresponding frequency (in MHz), or 0 if the conversion failed.6819*/6820static inline int6821ieee80211_channel_to_frequency(int chan, enum nl80211_band band)6822{6823return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));6824}68256826/**6827* ieee80211_freq_khz_to_channel - convert frequency to channel number6828* @freq: center frequency in KHz6829* Return: The corresponding channel, or 0 if the conversion failed.6830*/6831int ieee80211_freq_khz_to_channel(u32 freq);68326833/**6834* ieee80211_frequency_to_channel - convert frequency to channel number6835* @freq: center frequency in MHz6836* Return: The corresponding channel, or 0 if the conversion failed.6837*/6838static inline int6839ieee80211_frequency_to_channel(int freq)6840{6841return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));6842}68436844/**6845* ieee80211_get_channel_khz - get channel struct from wiphy for specified6846* frequency6847* @wiphy: the struct wiphy to get the channel for6848* @freq: the center frequency (in KHz) of the channel6849* Return: The channel struct from @wiphy at @freq.6850*/6851struct ieee80211_channel *6852ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);68536854/**6855* ieee80211_get_channel - get channel struct from wiphy for specified frequency6856*6857* @wiphy: the struct wiphy to get the channel for6858* @freq: the center frequency (in MHz) of the channel6859* Return: The channel struct from @wiphy at @freq.6860*/6861static inline struct ieee80211_channel *6862ieee80211_get_channel(struct wiphy *wiphy, int freq)6863{6864return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));6865}68666867/**6868* cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC6869* @chan: control channel to check6870*6871* The Preferred Scanning Channels (PSC) are defined in6872* Draft IEEE P802.11ax/D5.0, 26.17.2.3.36873*6874* Return: %true if channel is a PSC, %false otherwise6875*/6876static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)6877{6878if (chan->band != NL80211_BAND_6GHZ)6879return false;68806881return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;6882}68836884/**6885* cfg80211_radio_chandef_valid - Check if the radio supports the chandef6886*6887* @radio: wiphy radio6888* @chandef: chandef for current channel6889*6890* Return: whether or not the given chandef is valid for the given radio6891*/6892bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio,6893const struct cfg80211_chan_def *chandef);68946895/**6896* cfg80211_wdev_channel_allowed - Check if the wdev may use the channel6897*6898* @wdev: the wireless device6899* @chan: channel to check6900*6901* Return: whether or not the wdev may use the channel6902*/6903bool cfg80211_wdev_channel_allowed(struct wireless_dev *wdev,6904struct ieee80211_channel *chan);69056906/**6907* ieee80211_get_response_rate - get basic rate for a given rate6908*6909* @sband: the band to look for rates in6910* @basic_rates: bitmap of basic rates6911* @bitrate: the bitrate for which to find the basic rate6912*6913* Return: The basic rate corresponding to a given bitrate, that6914* is the next lower bitrate contained in the basic rate map,6915* which is, for this function, given as a bitmap of indices of6916* rates in the band's bitrate table.6917*/6918const struct ieee80211_rate *6919ieee80211_get_response_rate(struct ieee80211_supported_band *sband,6920u32 basic_rates, int bitrate);69216922/**6923* ieee80211_mandatory_rates - get mandatory rates for a given band6924* @sband: the band to look for rates in6925*6926* Return: a bitmap of the mandatory rates for the given band, bits6927* are set according to the rate position in the bitrates array.6928*/6929u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband);69306931/*6932* Radiotap parsing functions -- for controlled injection support6933*6934* Implemented in net/wireless/radiotap.c6935* Documentation in Documentation/networking/radiotap-headers.rst6936*/69376938struct radiotap_align_size {6939uint8_t align:4, size:4;6940};69416942struct ieee80211_radiotap_namespace {6943const struct radiotap_align_size *align_size;6944int n_bits;6945uint32_t oui;6946uint8_t subns;6947};69486949struct ieee80211_radiotap_vendor_namespaces {6950const struct ieee80211_radiotap_namespace *ns;6951int n_ns;6952};69536954/**6955* struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args6956* @this_arg_index: index of current arg, valid after each successful call6957* to ieee80211_radiotap_iterator_next()6958* @this_arg: pointer to current radiotap arg; it is valid after each6959* call to ieee80211_radiotap_iterator_next() but also after6960* ieee80211_radiotap_iterator_init() where it will point to6961* the beginning of the actual data portion6962* @this_arg_size: length of the current arg, for convenience6963* @current_namespace: pointer to the current namespace definition6964* (or internally %NULL if the current namespace is unknown)6965* @is_radiotap_ns: indicates whether the current namespace is the default6966* radiotap namespace or not6967*6968* @_rtheader: pointer to the radiotap header we are walking through6969* @_max_length: length of radiotap header in cpu byte ordering6970* @_arg_index: next argument index6971* @_arg: next argument pointer6972* @_next_bitmap: internal pointer to next present u326973* @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present6974* @_vns: vendor namespace definitions6975* @_next_ns_data: beginning of the next namespace's data6976* @_reset_on_ext: internal; reset the arg index to 0 when going to the6977* next bitmap word6978*6979* Describes the radiotap parser state. Fields prefixed with an underscore6980* must not be used by users of the parser, only by the parser internally.6981*/69826983struct ieee80211_radiotap_iterator {6984struct ieee80211_radiotap_header *_rtheader;6985const struct ieee80211_radiotap_vendor_namespaces *_vns;6986const struct ieee80211_radiotap_namespace *current_namespace;69876988unsigned char *_arg, *_next_ns_data;6989__le32 *_next_bitmap;69906991unsigned char *this_arg;6992int this_arg_index;6993int this_arg_size;69946995int is_radiotap_ns;69966997int _max_length;6998int _arg_index;6999uint32_t _bitmap_shifter;7000int _reset_on_ext;7001};70027003int7004ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,7005struct ieee80211_radiotap_header *radiotap_header,7006int max_length,7007const struct ieee80211_radiotap_vendor_namespaces *vns);70087009int7010ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);701170127013extern const unsigned char rfc1042_header[6];7014extern const unsigned char bridge_tunnel_header[6];70157016/**7017* ieee80211_get_hdrlen_from_skb - get header length from data7018*7019* @skb: the frame7020*7021* Given an skb with a raw 802.11 header at the data pointer this function7022* returns the 802.11 header length.7023*7024* Return: The 802.11 header length in bytes (not including encryption7025* headers). Or 0 if the data in the sk_buff is too short to contain a valid7026* 802.11 header.7027*/7028unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);70297030/**7031* ieee80211_hdrlen - get header length in bytes from frame control7032* @fc: frame control field in little-endian format7033* Return: The header length in bytes.7034*/7035unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);70367037/**7038* ieee80211_get_mesh_hdrlen - get mesh extension header length7039* @meshhdr: the mesh extension header, only the flags field7040* (first byte) will be accessed7041* Return: The length of the extension header, which is always at7042* least 6 bytes and at most 18 if address 5 and 6 are present.7043*/7044unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);70457046/**7047* DOC: Data path helpers7048*7049* In addition to generic utilities, cfg80211 also offers7050* functions that help implement the data path for devices7051* that do not do the 802.11/802.3 conversion on the device.7052*/70537054/**7055* ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.37056* @skb: the 802.11 data frame7057* @ehdr: pointer to a &struct ethhdr that will get the header, instead7058* of it being pushed into the SKB7059* @addr: the device MAC address7060* @iftype: the virtual interface type7061* @data_offset: offset of payload after the 802.11 header7062* @is_amsdu: true if the 802.11 header is A-MSDU7063* Return: 0 on success. Non-zero on error.7064*/7065int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,7066const u8 *addr, enum nl80211_iftype iftype,7067u8 data_offset, bool is_amsdu);70687069/**7070* ieee80211_data_to_8023 - convert an 802.11 data frame to 802.37071* @skb: the 802.11 data frame7072* @addr: the device MAC address7073* @iftype: the virtual interface type7074* Return: 0 on success. Non-zero on error.7075*/7076static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,7077enum nl80211_iftype iftype)7078{7079return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);7080}70817082/**7083* ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid7084*7085* This is used to detect non-standard A-MSDU frames, e.g. the ones generated7086* by ath10k and ath11k, where the subframe length includes the length of the7087* mesh control field.7088*7089* @skb: The input A-MSDU frame without any headers.7090* @mesh_hdr: the type of mesh header to test7091* 0: non-mesh A-MSDU length field7092* 1: big-endian mesh A-MSDU length field7093* 2: little-endian mesh A-MSDU length field7094* Returns: true if subframe header lengths are valid for the @mesh_hdr mode7095*/7096bool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr);70977098/**7099* ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame7100*7101* Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.7102* The @list will be empty if the decode fails. The @skb must be fully7103* header-less before being passed in here; it is freed in this function.7104*7105* @skb: The input A-MSDU frame without any headers.7106* @list: The output list of 802.3 frames. It must be allocated and7107* initialized by the caller.7108* @addr: The device MAC address.7109* @iftype: The device interface type.7110* @extra_headroom: The hardware extra headroom for SKBs in the @list.7111* @check_da: DA to check in the inner ethernet header, or NULL7112* @check_sa: SA to check in the inner ethernet header, or NULL7113* @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu7114*/7115void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,7116const u8 *addr, enum nl80211_iftype iftype,7117const unsigned int extra_headroom,7118const u8 *check_da, const u8 *check_sa,7119u8 mesh_control);71207121/**7122* ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol7123*7124* Check for RFC1042 or bridge tunnel header and fetch the encapsulated7125* protocol.7126*7127* @hdr: pointer to the MSDU payload7128* @proto: destination pointer to store the protocol7129* Return: true if encapsulation was found7130*/7131bool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto);71327133/**7134* ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames7135*7136* Strip the mesh header, which was left in by ieee80211_data_to_8023 as part7137* of the MSDU data. Also move any source/destination addresses from the mesh7138* header to the ethernet header (if present).7139*7140* @skb: The 802.3 frame with embedded mesh header7141*7142* Return: 0 on success. Non-zero on error.7143*/7144int ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb);71457146/**7147* cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame7148* @skb: the data frame7149* @qos_map: Interworking QoS mapping or %NULL if not in use7150* Return: The 802.1p/1d tag.7151*/7152unsigned int cfg80211_classify8021d(struct sk_buff *skb,7153struct cfg80211_qos_map *qos_map);71547155/**7156* cfg80211_find_elem_match - match information element and byte array in data7157*7158* @eid: element ID7159* @ies: data consisting of IEs7160* @len: length of data7161* @match: byte array to match7162* @match_len: number of bytes in the match array7163* @match_offset: offset in the IE data where the byte array should match.7164* Note the difference to cfg80211_find_ie_match() which considers7165* the offset to start from the element ID byte, but here we take7166* the data portion instead.7167*7168* Return: %NULL if the element ID could not be found or if7169* the element is invalid (claims to be longer than the given7170* data) or if the byte array doesn't match; otherwise return the7171* requested element struct.7172*7173* Note: There are no checks on the element length other than7174* having to fit into the given data and being large enough for the7175* byte array to match.7176*/7177const struct element *7178cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,7179const u8 *match, unsigned int match_len,7180unsigned int match_offset);71817182/**7183* cfg80211_find_ie_match - match information element and byte array in data7184*7185* @eid: element ID7186* @ies: data consisting of IEs7187* @len: length of data7188* @match: byte array to match7189* @match_len: number of bytes in the match array7190* @match_offset: offset in the IE where the byte array should match.7191* If match_len is zero, this must also be set to zero.7192* Otherwise this must be set to 2 or more, because the first7193* byte is the element id, which is already compared to eid, and7194* the second byte is the IE length.7195*7196* Return: %NULL if the element ID could not be found or if7197* the element is invalid (claims to be longer than the given7198* data) or if the byte array doesn't match, or a pointer to the first7199* byte of the requested element, that is the byte containing the7200* element ID.7201*7202* Note: There are no checks on the element length other than7203* having to fit into the given data and being large enough for the7204* byte array to match.7205*/7206static inline const u8 *7207cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,7208const u8 *match, unsigned int match_len,7209unsigned int match_offset)7210{7211/* match_offset can't be smaller than 2, unless match_len is7212* zero, in which case match_offset must be zero as well.7213*/7214if (WARN_ON((match_len && match_offset < 2) ||7215(!match_len && match_offset)))7216return NULL;72177218return (const void *)cfg80211_find_elem_match(eid, ies, len,7219match, match_len,7220match_offset ?7221match_offset - 2 : 0);7222}72237224/**7225* cfg80211_find_elem - find information element in data7226*7227* @eid: element ID7228* @ies: data consisting of IEs7229* @len: length of data7230*7231* Return: %NULL if the element ID could not be found or if7232* the element is invalid (claims to be longer than the given7233* data) or if the byte array doesn't match; otherwise return the7234* requested element struct.7235*7236* Note: There are no checks on the element length other than7237* having to fit into the given data.7238*/7239static inline const struct element *7240cfg80211_find_elem(u8 eid, const u8 *ies, int len)7241{7242return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);7243}72447245/**7246* cfg80211_find_ie - find information element in data7247*7248* @eid: element ID7249* @ies: data consisting of IEs7250* @len: length of data7251*7252* Return: %NULL if the element ID could not be found or if7253* the element is invalid (claims to be longer than the given7254* data), or a pointer to the first byte of the requested7255* element, that is the byte containing the element ID.7256*7257* Note: There are no checks on the element length other than7258* having to fit into the given data.7259*/7260static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)7261{7262return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);7263}72647265/**7266* cfg80211_find_ext_elem - find information element with EID Extension in data7267*7268* @ext_eid: element ID Extension7269* @ies: data consisting of IEs7270* @len: length of data7271*7272* Return: %NULL if the extended element could not be found or if7273* the element is invalid (claims to be longer than the given7274* data) or if the byte array doesn't match; otherwise return the7275* requested element struct.7276*7277* Note: There are no checks on the element length other than7278* having to fit into the given data.7279*/7280static inline const struct element *7281cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)7282{7283return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,7284&ext_eid, 1, 0);7285}72867287/**7288* cfg80211_find_ext_ie - find information element with EID Extension in data7289*7290* @ext_eid: element ID Extension7291* @ies: data consisting of IEs7292* @len: length of data7293*7294* Return: %NULL if the extended element ID could not be found or if7295* the element is invalid (claims to be longer than the given7296* data), or a pointer to the first byte of the requested7297* element, that is the byte containing the element ID.7298*7299* Note: There are no checks on the element length other than7300* having to fit into the given data.7301*/7302static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)7303{7304return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,7305&ext_eid, 1, 2);7306}73077308/**7309* cfg80211_find_vendor_elem - find vendor specific information element in data7310*7311* @oui: vendor OUI7312* @oui_type: vendor-specific OUI type (must be < 0xff), negative means any7313* @ies: data consisting of IEs7314* @len: length of data7315*7316* Return: %NULL if the vendor specific element ID could not be found or if the7317* element is invalid (claims to be longer than the given data); otherwise7318* return the element structure for the requested element.7319*7320* Note: There are no checks on the element length other than having to fit into7321* the given data.7322*/7323const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,7324const u8 *ies,7325unsigned int len);73267327/**7328* cfg80211_find_vendor_ie - find vendor specific information element in data7329*7330* @oui: vendor OUI7331* @oui_type: vendor-specific OUI type (must be < 0xff), negative means any7332* @ies: data consisting of IEs7333* @len: length of data7334*7335* Return: %NULL if the vendor specific element ID could not be found or if the7336* element is invalid (claims to be longer than the given data), or a pointer to7337* the first byte of the requested element, that is the byte containing the7338* element ID.7339*7340* Note: There are no checks on the element length other than having to fit into7341* the given data.7342*/7343static inline const u8 *7344cfg80211_find_vendor_ie(unsigned int oui, int oui_type,7345const u8 *ies, unsigned int len)7346{7347return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);7348}73497350/**7351* enum cfg80211_rnr_iter_ret - reduced neighbor report iteration state7352* @RNR_ITER_CONTINUE: continue iterating with the next entry7353* @RNR_ITER_BREAK: break iteration and return success7354* @RNR_ITER_ERROR: break iteration and return error7355*/7356enum cfg80211_rnr_iter_ret {7357RNR_ITER_CONTINUE,7358RNR_ITER_BREAK,7359RNR_ITER_ERROR,7360};73617362/**7363* cfg80211_iter_rnr - iterate reduced neighbor report entries7364* @elems: the frame elements to iterate RNR elements and then7365* their entries in7366* @elems_len: length of the elements7367* @iter: iteration function, see also &enum cfg80211_rnr_iter_ret7368* for the return value7369* @iter_data: additional data passed to the iteration function7370* Return: %true on success (after successfully iterating all entries7371* or if the iteration function returned %RNR_ITER_BREAK),7372* %false on error (iteration function returned %RNR_ITER_ERROR7373* or elements were malformed.)7374*/7375bool cfg80211_iter_rnr(const u8 *elems, size_t elems_len,7376enum cfg80211_rnr_iter_ret7377(*iter)(void *data, u8 type,7378const struct ieee80211_neighbor_ap_info *info,7379const u8 *tbtt_info, u8 tbtt_info_len),7380void *iter_data);73817382/**7383* cfg80211_defragment_element - Defrag the given element data into a buffer7384*7385* @elem: the element to defragment7386* @ies: elements where @elem is contained7387* @ieslen: length of @ies7388* @data: buffer to store element data, or %NULL to just determine size7389* @data_len: length of @data, or 07390* @frag_id: the element ID of fragments7391*7392* Return: length of @data, or -EINVAL on error7393*7394* Copy out all data from an element that may be fragmented into @data, while7395* skipping all headers.7396*7397* The function uses memmove() internally. It is acceptable to defragment an7398* element in-place.7399*/7400ssize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,7401size_t ieslen, u8 *data, size_t data_len,7402u8 frag_id);74037404/**7405* cfg80211_send_layer2_update - send layer 2 update frame7406*7407* @dev: network device7408* @addr: STA MAC address7409*7410* Wireless drivers can use this function to update forwarding tables in bridge7411* devices upon STA association.7412*/7413void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);74147415/**7416* DOC: Regulatory enforcement infrastructure7417*7418* TODO7419*/74207421/**7422* regulatory_hint - driver hint to the wireless core a regulatory domain7423* @wiphy: the wireless device giving the hint (used only for reporting7424* conflicts)7425* @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain7426* should be in. If @rd is set this should be NULL. Note that if you7427* set this to NULL you should still set rd->alpha2 to some accepted7428* alpha2.7429*7430* Wireless drivers can use this function to hint to the wireless core7431* what it believes should be the current regulatory domain by7432* giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory7433* domain should be in or by providing a completely build regulatory domain.7434* If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried7435* for a regulatory domain structure for the respective country.7436*7437* The wiphy must have been registered to cfg80211 prior to this call.7438* For cfg80211 drivers this means you must first use wiphy_register(),7439* for mac80211 drivers you must first use ieee80211_register_hw().7440*7441* Drivers should check the return value, its possible you can get7442* an -ENOMEM.7443*7444* Return: 0 on success. -ENOMEM.7445*/7446int regulatory_hint(struct wiphy *wiphy, const char *alpha2);74477448/**7449* regulatory_set_wiphy_regd - set regdom info for self managed drivers7450* @wiphy: the wireless device we want to process the regulatory domain on7451* @rd: the regulatory domain information to use for this wiphy7452*7453* Set the regulatory domain information for self-managed wiphys, only they7454* may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more7455* information.7456*7457* Return: 0 on success. -EINVAL, -EPERM7458*/7459int regulatory_set_wiphy_regd(struct wiphy *wiphy,7460struct ieee80211_regdomain *rd);74617462/**7463* regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers7464* @wiphy: the wireless device we want to process the regulatory domain on7465* @rd: the regulatory domain information to use for this wiphy7466*7467* This functions requires the RTNL and the wiphy mutex to be held and7468* applies the new regdomain synchronously to this wiphy. For more details7469* see regulatory_set_wiphy_regd().7470*7471* Return: 0 on success. -EINVAL, -EPERM7472*/7473int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,7474struct ieee80211_regdomain *rd);74757476/**7477* wiphy_apply_custom_regulatory - apply a custom driver regulatory domain7478* @wiphy: the wireless device we want to process the regulatory domain on7479* @regd: the custom regulatory domain to use for this wiphy7480*7481* Drivers can sometimes have custom regulatory domains which do not apply7482* to a specific country. Drivers can use this to apply such custom regulatory7483* domains. This routine must be called prior to wiphy registration. The7484* custom regulatory domain will be trusted completely and as such previous7485* default channel settings will be disregarded. If no rule is found for a7486* channel on the regulatory domain the channel will be disabled.7487* Drivers using this for a wiphy should also set the wiphy flag7488* REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy7489* that called this helper.7490*/7491void wiphy_apply_custom_regulatory(struct wiphy *wiphy,7492const struct ieee80211_regdomain *regd);74937494/**7495* freq_reg_info - get regulatory information for the given frequency7496* @wiphy: the wiphy for which we want to process this rule for7497* @center_freq: Frequency in KHz for which we want regulatory information for7498*7499* Use this function to get the regulatory rule for a specific frequency on7500* a given wireless device. If the device has a specific regulatory domain7501* it wants to follow we respect that unless a country IE has been received7502* and processed already.7503*7504* Return: A valid pointer, or, when an error occurs, for example if no rule7505* can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to7506* check and PTR_ERR() to obtain the numeric return value. The numeric return7507* value will be -ERANGE if we determine the given center_freq does not even7508* have a regulatory rule for a frequency range in the center_freq's band.7509* See freq_in_rule_band() for our current definition of a band -- this is7510* purely subjective and right now it's 802.11 specific.7511*/7512const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,7513u32 center_freq);75147515/**7516* reg_initiator_name - map regulatory request initiator enum to name7517* @initiator: the regulatory request initiator7518*7519* You can use this to map the regulatory request initiator enum to a7520* proper string representation.7521*7522* Return: pointer to string representation of the initiator7523*/7524const char *reg_initiator_name(enum nl80211_reg_initiator initiator);75257526/**7527* regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom7528* @wiphy: wiphy for which pre-CAC capability is checked.7529*7530* Pre-CAC is allowed only in some regdomains (notable ETSI).7531*7532* Return: %true if allowed, %false otherwise7533*/7534bool regulatory_pre_cac_allowed(struct wiphy *wiphy);75357536/**7537* DOC: Internal regulatory db functions7538*7539*/75407541/**7542* reg_query_regdb_wmm - Query internal regulatory db for wmm rule7543* Regulatory self-managed driver can use it to proactively7544*7545* @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.7546* @freq: the frequency (in MHz) to be queried.7547* @rule: pointer to store the wmm rule from the regulatory db.7548*7549* Self-managed wireless drivers can use this function to query7550* the internal regulatory database to check whether the given7551* ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.7552*7553* Drivers should check the return value, its possible you can get7554* an -ENODATA.7555*7556* Return: 0 on success. -ENODATA.7557*/7558int reg_query_regdb_wmm(char *alpha2, int freq,7559struct ieee80211_reg_rule *rule);75607561/*7562* callbacks for asynchronous cfg80211 methods, notification7563* functions and BSS handling helpers7564*/75657566/**7567* cfg80211_scan_done - notify that scan finished7568*7569* @request: the corresponding scan request7570* @info: information about the completed scan7571*/7572void cfg80211_scan_done(struct cfg80211_scan_request *request,7573struct cfg80211_scan_info *info);75747575/**7576* cfg80211_sched_scan_results - notify that new scan results are available7577*7578* @wiphy: the wiphy which got scheduled scan results7579* @reqid: identifier for the related scheduled scan request7580*/7581void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);75827583/**7584* cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped7585*7586* @wiphy: the wiphy on which the scheduled scan stopped7587* @reqid: identifier for the related scheduled scan request7588*7589* The driver can call this function to inform cfg80211 that the7590* scheduled scan had to be stopped, for whatever reason. The driver7591* is then called back via the sched_scan_stop operation when done.7592*/7593void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);75947595/**7596* cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped7597*7598* @wiphy: the wiphy on which the scheduled scan stopped7599* @reqid: identifier for the related scheduled scan request7600*7601* The driver can call this function to inform cfg80211 that the7602* scheduled scan had to be stopped, for whatever reason. The driver7603* is then called back via the sched_scan_stop operation when done.7604* This function should be called with the wiphy mutex held.7605*/7606void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);76077608/**7609* cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame7610* @wiphy: the wiphy reporting the BSS7611* @data: the BSS metadata7612* @mgmt: the management frame (probe response or beacon)7613* @len: length of the management frame7614* @gfp: context flags7615*7616* This informs cfg80211 that BSS information was found and7617* the BSS should be updated/added.7618*7619* Return: A referenced struct, must be released with cfg80211_put_bss()!7620* Or %NULL on error.7621*/7622struct cfg80211_bss * __must_check7623cfg80211_inform_bss_frame_data(struct wiphy *wiphy,7624struct cfg80211_inform_bss *data,7625struct ieee80211_mgmt *mgmt, size_t len,7626gfp_t gfp);76277628static inline struct cfg80211_bss * __must_check7629cfg80211_inform_bss_frame(struct wiphy *wiphy,7630struct ieee80211_channel *rx_channel,7631struct ieee80211_mgmt *mgmt, size_t len,7632s32 signal, gfp_t gfp)7633{7634struct cfg80211_inform_bss data = {7635.chan = rx_channel,7636.signal = signal,7637};76387639return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);7640}76417642/**7643* cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID7644* @bssid: transmitter BSSID7645* @max_bssid: max BSSID indicator, taken from Multiple BSSID element7646* @mbssid_index: BSSID index, taken from Multiple BSSID index element7647* @new_bssid: calculated nontransmitted BSSID7648*/7649static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,7650u8 mbssid_index, u8 *new_bssid)7651{7652u64 bssid_u64 = ether_addr_to_u64(bssid);7653u64 mask = GENMASK_ULL(max_bssid - 1, 0);7654u64 new_bssid_u64;76557656new_bssid_u64 = bssid_u64 & ~mask;76577658new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;76597660u64_to_ether_addr(new_bssid_u64, new_bssid);7661}76627663/**7664* cfg80211_is_element_inherited - returns if element ID should be inherited7665* @element: element to check7666* @non_inherit_element: non inheritance element7667*7668* Return: %true if should be inherited, %false otherwise7669*/7670bool cfg80211_is_element_inherited(const struct element *element,7671const struct element *non_inherit_element);76727673/**7674* cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs7675* @ie: ies7676* @ielen: length of IEs7677* @mbssid_elem: current MBSSID element7678* @sub_elem: current MBSSID subelement (profile)7679* @merged_ie: location of the merged profile7680* @max_copy_len: max merged profile length7681*7682* Return: the number of bytes merged7683*/7684size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,7685const struct element *mbssid_elem,7686const struct element *sub_elem,7687u8 *merged_ie, size_t max_copy_len);76887689/**7690* enum cfg80211_bss_frame_type - frame type that the BSS data came from7691* @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is7692* from a beacon or probe response7693* @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon7694* @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response7695* @CFG80211_BSS_FTYPE_S1G_BEACON: data comes from an S1G beacon7696*/7697enum cfg80211_bss_frame_type {7698CFG80211_BSS_FTYPE_UNKNOWN,7699CFG80211_BSS_FTYPE_BEACON,7700CFG80211_BSS_FTYPE_PRESP,7701CFG80211_BSS_FTYPE_S1G_BEACON,7702};77037704/**7705* cfg80211_get_ies_channel_number - returns the channel number from ies7706* @ie: IEs7707* @ielen: length of IEs7708* @band: enum nl80211_band of the channel7709*7710* Return: the channel number, or -1 if none could be determined.7711*/7712int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,7713enum nl80211_band band);77147715/**7716* cfg80211_ssid_eq - compare two SSIDs7717* @a: first SSID7718* @b: second SSID7719*7720* Return: %true if SSIDs are equal, %false otherwise.7721*/7722static inline bool7723cfg80211_ssid_eq(struct cfg80211_ssid *a, struct cfg80211_ssid *b)7724{7725if (WARN_ON(!a || !b))7726return false;7727if (a->ssid_len != b->ssid_len)7728return false;7729return memcmp(a->ssid, b->ssid, a->ssid_len) ? false : true;7730}77317732/**7733* cfg80211_inform_bss_data - inform cfg80211 of a new BSS7734*7735* @wiphy: the wiphy reporting the BSS7736* @data: the BSS metadata7737* @ftype: frame type (if known)7738* @bssid: the BSSID of the BSS7739* @tsf: the TSF sent by the peer in the beacon/probe response (or 0)7740* @capability: the capability field sent by the peer7741* @beacon_interval: the beacon interval announced by the peer7742* @ie: additional IEs sent by the peer7743* @ielen: length of the additional IEs7744* @gfp: context flags7745*7746* This informs cfg80211 that BSS information was found and7747* the BSS should be updated/added.7748*7749* Return: A referenced struct, must be released with cfg80211_put_bss()!7750* Or %NULL on error.7751*/7752struct cfg80211_bss * __must_check7753cfg80211_inform_bss_data(struct wiphy *wiphy,7754struct cfg80211_inform_bss *data,7755enum cfg80211_bss_frame_type ftype,7756const u8 *bssid, u64 tsf, u16 capability,7757u16 beacon_interval, const u8 *ie, size_t ielen,7758gfp_t gfp);77597760static inline struct cfg80211_bss * __must_check7761cfg80211_inform_bss(struct wiphy *wiphy,7762struct ieee80211_channel *rx_channel,7763enum cfg80211_bss_frame_type ftype,7764const u8 *bssid, u64 tsf, u16 capability,7765u16 beacon_interval, const u8 *ie, size_t ielen,7766s32 signal, gfp_t gfp)7767{7768struct cfg80211_inform_bss data = {7769.chan = rx_channel,7770.signal = signal,7771};77727773return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,7774capability, beacon_interval, ie, ielen,7775gfp);7776}77777778/**7779* __cfg80211_get_bss - get a BSS reference7780* @wiphy: the wiphy this BSS struct belongs to7781* @channel: the channel to search on (or %NULL)7782* @bssid: the desired BSSID (or %NULL)7783* @ssid: the desired SSID (or %NULL)7784* @ssid_len: length of the SSID (or 0)7785* @bss_type: type of BSS, see &enum ieee80211_bss_type7786* @privacy: privacy filter, see &enum ieee80211_privacy7787* @use_for: indicates which use is intended7788*7789* Return: Reference-counted BSS on success. %NULL on error.7790*/7791struct cfg80211_bss *__cfg80211_get_bss(struct wiphy *wiphy,7792struct ieee80211_channel *channel,7793const u8 *bssid,7794const u8 *ssid, size_t ssid_len,7795enum ieee80211_bss_type bss_type,7796enum ieee80211_privacy privacy,7797u32 use_for);77987799/**7800* cfg80211_get_bss - get a BSS reference7801* @wiphy: the wiphy this BSS struct belongs to7802* @channel: the channel to search on (or %NULL)7803* @bssid: the desired BSSID (or %NULL)7804* @ssid: the desired SSID (or %NULL)7805* @ssid_len: length of the SSID (or 0)7806* @bss_type: type of BSS, see &enum ieee80211_bss_type7807* @privacy: privacy filter, see &enum ieee80211_privacy7808*7809* This version implies regular usage, %NL80211_BSS_USE_FOR_NORMAL.7810*7811* Return: Reference-counted BSS on success. %NULL on error.7812*/7813static inline struct cfg80211_bss *7814cfg80211_get_bss(struct wiphy *wiphy, struct ieee80211_channel *channel,7815const u8 *bssid, const u8 *ssid, size_t ssid_len,7816enum ieee80211_bss_type bss_type,7817enum ieee80211_privacy privacy)7818{7819return __cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len,7820bss_type, privacy,7821NL80211_BSS_USE_FOR_NORMAL);7822}78237824static inline struct cfg80211_bss *7825cfg80211_get_ibss(struct wiphy *wiphy,7826struct ieee80211_channel *channel,7827const u8 *ssid, size_t ssid_len)7828{7829return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,7830IEEE80211_BSS_TYPE_IBSS,7831IEEE80211_PRIVACY_ANY);7832}78337834/**7835* cfg80211_ref_bss - reference BSS struct7836* @wiphy: the wiphy this BSS struct belongs to7837* @bss: the BSS struct to reference7838*7839* Increments the refcount of the given BSS struct.7840*/7841void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);78427843/**7844* cfg80211_put_bss - unref BSS struct7845* @wiphy: the wiphy this BSS struct belongs to7846* @bss: the BSS struct7847*7848* Decrements the refcount of the given BSS struct.7849*/7850void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);78517852/**7853* cfg80211_unlink_bss - unlink BSS from internal data structures7854* @wiphy: the wiphy7855* @bss: the bss to remove7856*7857* This function removes the given BSS from the internal data structures7858* thereby making it no longer show up in scan results etc. Use this7859* function when you detect a BSS is gone. Normally BSSes will also time7860* out, so it is not necessary to use this function at all.7861*/7862void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);78637864/**7865* cfg80211_bss_iter - iterate all BSS entries7866*7867* This function iterates over the BSS entries associated with the given wiphy7868* and calls the callback for the iterated BSS. The iterator function is not7869* allowed to call functions that might modify the internal state of the BSS DB.7870*7871* @wiphy: the wiphy7872* @chandef: if given, the iterator function will be called only if the channel7873* of the currently iterated BSS is a subset of the given channel.7874* @iter: the iterator function to call7875* @iter_data: an argument to the iterator function7876*/7877void cfg80211_bss_iter(struct wiphy *wiphy,7878struct cfg80211_chan_def *chandef,7879void (*iter)(struct wiphy *wiphy,7880struct cfg80211_bss *bss,7881void *data),7882void *iter_data);78837884/**7885* cfg80211_rx_mlme_mgmt - notification of processed MLME management frame7886* @dev: network device7887* @buf: authentication frame (header + body)7888* @len: length of the frame data7889*7890* This function is called whenever an authentication, disassociation or7891* deauthentication frame has been received and processed in station mode.7892* After being asked to authenticate via cfg80211_ops::auth() the driver must7893* call either this function or cfg80211_auth_timeout().7894* After being asked to associate via cfg80211_ops::assoc() the driver must7895* call either this function or cfg80211_auth_timeout().7896* While connected, the driver must calls this for received and processed7897* disassociation and deauthentication frames. If the frame couldn't be used7898* because it was unprotected, the driver must call the function7899* cfg80211_rx_unprot_mlme_mgmt() instead.7900*7901* This function may sleep. The caller must hold the corresponding wdev's mutex.7902*/7903void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);79047905/**7906* cfg80211_auth_timeout - notification of timed out authentication7907* @dev: network device7908* @addr: The MAC address of the device with which the authentication timed out7909*7910* This function may sleep. The caller must hold the corresponding wdev's7911* mutex.7912*/7913void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);79147915/**7916* struct cfg80211_rx_assoc_resp_data - association response data7917* @buf: (Re)Association Response frame (header + body)7918* @len: length of the frame data7919* @uapsd_queues: bitmap of queues configured for uapsd. Same format7920* as the AC bitmap in the QoS info field7921* @req_ies: information elements from the (Re)Association Request frame7922* @req_ies_len: length of req_ies data7923* @ap_mld_addr: AP MLD address (in case of MLO)7924* @links: per-link information indexed by link ID, use links[0] for7925* non-MLO connections7926* @links.bss: the BSS that association was requested with, ownership of the7927* pointer moves to cfg80211 in the call to cfg80211_rx_assoc_resp()7928* @links.status: Set this (along with a BSS pointer) for links that7929* were rejected by the AP.7930*/7931struct cfg80211_rx_assoc_resp_data {7932const u8 *buf;7933size_t len;7934const u8 *req_ies;7935size_t req_ies_len;7936int uapsd_queues;7937const u8 *ap_mld_addr;7938struct {7939u8 addr[ETH_ALEN] __aligned(2);7940struct cfg80211_bss *bss;7941u16 status;7942} links[IEEE80211_MLD_MAX_NUM_LINKS];7943};79447945/**7946* cfg80211_rx_assoc_resp - notification of processed association response7947* @dev: network device7948* @data: association response data, &struct cfg80211_rx_assoc_resp_data7949*7950* After being asked to associate via cfg80211_ops::assoc() the driver must7951* call either this function or cfg80211_auth_timeout().7952*7953* This function may sleep. The caller must hold the corresponding wdev's mutex.7954*/7955void cfg80211_rx_assoc_resp(struct net_device *dev,7956const struct cfg80211_rx_assoc_resp_data *data);79577958/**7959* struct cfg80211_assoc_failure - association failure data7960* @ap_mld_addr: AP MLD address, or %NULL7961* @bss: list of BSSes, must use entry 0 for non-MLO connections7962* (@ap_mld_addr is %NULL)7963* @timeout: indicates the association failed due to timeout, otherwise7964* the association was abandoned for a reason reported through some7965* other API (e.g. deauth RX)7966*/7967struct cfg80211_assoc_failure {7968const u8 *ap_mld_addr;7969struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];7970bool timeout;7971};79727973/**7974* cfg80211_assoc_failure - notification of association failure7975* @dev: network device7976* @data: data describing the association failure7977*7978* This function may sleep. The caller must hold the corresponding wdev's mutex.7979*/7980void cfg80211_assoc_failure(struct net_device *dev,7981struct cfg80211_assoc_failure *data);79827983/**7984* cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame7985* @dev: network device7986* @buf: 802.11 frame (header + body)7987* @len: length of the frame data7988* @reconnect: immediate reconnect is desired (include the nl80211 attribute)7989*7990* This function is called whenever deauthentication has been processed in7991* station mode. This includes both received deauthentication frames and7992* locally generated ones. This function may sleep. The caller must hold the7993* corresponding wdev's mutex.7994*/7995void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,7996bool reconnect);79977998/**7999* cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame8000* @dev: network device8001* @buf: received management frame (header + body)8002* @len: length of the frame data8003*8004* This function is called whenever a received deauthentication or dissassoc8005* frame has been dropped in station mode because of MFP being used but the8006* frame was not protected. This is also used to notify reception of a Beacon8007* frame that was dropped because it did not include a valid MME MIC while8008* beacon protection was enabled (BIGTK configured in station mode).8009*8010* This function may sleep.8011*/8012void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,8013const u8 *buf, size_t len);80148015/**8016* cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)8017* @dev: network device8018* @addr: The source MAC address of the frame8019* @key_type: The key type that the received frame used8020* @key_id: Key identifier (0..3). Can be -1 if missing.8021* @tsc: The TSC value of the frame that generated the MIC failure (6 octets)8022* @gfp: allocation flags8023*8024* This function is called whenever the local MAC detects a MIC failure in a8025* received frame. This matches with MLME-MICHAELMICFAILURE.indication()8026* primitive.8027*/8028void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,8029enum nl80211_key_type key_type, int key_id,8030const u8 *tsc, gfp_t gfp);80318032/**8033* cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS8034*8035* @dev: network device8036* @bssid: the BSSID of the IBSS joined8037* @channel: the channel of the IBSS joined8038* @gfp: allocation flags8039*8040* This function notifies cfg80211 that the device joined an IBSS or8041* switched to a different BSSID. Before this function can be called,8042* either a beacon has to have been received from the IBSS, or one of8043* the cfg80211_inform_bss{,_frame} functions must have been called8044* with the locally generated beacon -- this guarantees that there is8045* always a scan result for this IBSS. cfg80211 will handle the rest.8046*/8047void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,8048struct ieee80211_channel *channel, gfp_t gfp);80498050/**8051* cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer8052* candidate8053*8054* @dev: network device8055* @macaddr: the MAC address of the new candidate8056* @ie: information elements advertised by the peer candidate8057* @ie_len: length of the information elements buffer8058* @sig_dbm: signal level in dBm8059* @gfp: allocation flags8060*8061* This function notifies cfg80211 that the mesh peer candidate has been8062* detected, most likely via a beacon or, less likely, via a probe response.8063* cfg80211 then sends a notification to userspace.8064*/8065void cfg80211_notify_new_peer_candidate(struct net_device *dev,8066const u8 *macaddr, const u8 *ie, u8 ie_len,8067int sig_dbm, gfp_t gfp);80688069/**8070* DOC: RFkill integration8071*8072* RFkill integration in cfg80211 is almost invisible to drivers,8073* as cfg80211 automatically registers an rfkill instance for each8074* wireless device it knows about. Soft kill is also translated8075* into disconnecting and turning all interfaces off. Drivers are8076* expected to turn off the device when all interfaces are down.8077*8078* However, devices may have a hard RFkill line, in which case they8079* also need to interact with the rfkill subsystem, via cfg80211.8080* They can do this with a few helper functions documented here.8081*/80828083/**8084* wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state8085* @wiphy: the wiphy8086* @blocked: block status8087* @reason: one of reasons in &enum rfkill_hard_block_reasons8088*/8089void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,8090enum rfkill_hard_block_reasons reason);80918092static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)8093{8094wiphy_rfkill_set_hw_state_reason(wiphy, blocked,8095RFKILL_HARD_BLOCK_SIGNAL);8096}80978098/**8099* wiphy_rfkill_start_polling - start polling rfkill8100* @wiphy: the wiphy8101*/8102void wiphy_rfkill_start_polling(struct wiphy *wiphy);81038104/**8105* wiphy_rfkill_stop_polling - stop polling rfkill8106* @wiphy: the wiphy8107*/8108static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)8109{8110rfkill_pause_polling(wiphy->rfkill);8111}81128113/**8114* DOC: Vendor commands8115*8116* Occasionally, there are special protocol or firmware features that8117* can't be implemented very openly. For this and similar cases, the8118* vendor command functionality allows implementing the features with8119* (typically closed-source) userspace and firmware, using nl80211 as8120* the configuration mechanism.8121*8122* A driver supporting vendor commands must register them as an array8123* in struct wiphy, with handlers for each one. Each command has an8124* OUI and sub command ID to identify it.8125*8126* Note that this feature should not be (ab)used to implement protocol8127* features that could openly be shared across drivers. In particular,8128* it must never be required to use vendor commands to implement any8129* "normal" functionality that higher-level userspace like connection8130* managers etc. need.8131*/81328133struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,8134enum nl80211_commands cmd,8135enum nl80211_attrs attr,8136int approxlen);81378138struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,8139struct wireless_dev *wdev,8140enum nl80211_commands cmd,8141enum nl80211_attrs attr,8142unsigned int portid,8143int vendor_event_idx,8144int approxlen, gfp_t gfp);81458146void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);81478148/**8149* cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply8150* @wiphy: the wiphy8151* @approxlen: an upper bound of the length of the data that will8152* be put into the skb8153*8154* This function allocates and pre-fills an skb for a reply to8155* a vendor command. Since it is intended for a reply, calling8156* it outside of a vendor command's doit() operation is invalid.8157*8158* The returned skb is pre-filled with some identifying data in8159* a way that any data that is put into the skb (with skb_put(),8160* nla_put() or similar) will end up being within the8161* %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done8162* with the skb is adding data for the corresponding userspace tool8163* which can then read that data out of the vendor data attribute.8164* You must not modify the skb in any other way.8165*8166* When done, call cfg80211_vendor_cmd_reply() with the skb and return8167* its error code as the result of the doit() operation.8168*8169* Return: An allocated and pre-filled skb. %NULL if any errors happen.8170*/8171static inline struct sk_buff *8172cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)8173{8174return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,8175NL80211_ATTR_VENDOR_DATA, approxlen);8176}81778178/**8179* cfg80211_vendor_cmd_reply - send the reply skb8180* @skb: The skb, must have been allocated with8181* cfg80211_vendor_cmd_alloc_reply_skb()8182*8183* Since calling this function will usually be the last thing8184* before returning from the vendor command doit() you should8185* return the error code. Note that this function consumes the8186* skb regardless of the return value.8187*8188* Return: An error code or 0 on success.8189*/8190int cfg80211_vendor_cmd_reply(struct sk_buff *skb);81918192/**8193* cfg80211_vendor_cmd_get_sender - get the current sender netlink ID8194* @wiphy: the wiphy8195*8196* Return: the current netlink port ID in a vendor command handler.8197*8198* Context: May only be called from a vendor command handler8199*/8200unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);82018202/**8203* cfg80211_vendor_event_alloc - allocate vendor-specific event skb8204* @wiphy: the wiphy8205* @wdev: the wireless device8206* @event_idx: index of the vendor event in the wiphy's vendor_events8207* @approxlen: an upper bound of the length of the data that will8208* be put into the skb8209* @gfp: allocation flags8210*8211* This function allocates and pre-fills an skb for an event on the8212* vendor-specific multicast group.8213*8214* If wdev != NULL, both the ifindex and identifier of the specified8215* wireless device are added to the event message before the vendor data8216* attribute.8217*8218* When done filling the skb, call cfg80211_vendor_event() with the8219* skb to send the event.8220*8221* Return: An allocated and pre-filled skb. %NULL if any errors happen.8222*/8223static inline struct sk_buff *8224cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,8225int approxlen, int event_idx, gfp_t gfp)8226{8227return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,8228NL80211_ATTR_VENDOR_DATA,82290, event_idx, approxlen, gfp);8230}82318232/**8233* cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb8234* @wiphy: the wiphy8235* @wdev: the wireless device8236* @event_idx: index of the vendor event in the wiphy's vendor_events8237* @portid: port ID of the receiver8238* @approxlen: an upper bound of the length of the data that will8239* be put into the skb8240* @gfp: allocation flags8241*8242* This function allocates and pre-fills an skb for an event to send to8243* a specific (userland) socket. This socket would previously have been8244* obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take8245* care to register a netlink notifier to see when the socket closes.8246*8247* If wdev != NULL, both the ifindex and identifier of the specified8248* wireless device are added to the event message before the vendor data8249* attribute.8250*8251* When done filling the skb, call cfg80211_vendor_event() with the8252* skb to send the event.8253*8254* Return: An allocated and pre-filled skb. %NULL if any errors happen.8255*/8256static inline struct sk_buff *8257cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,8258struct wireless_dev *wdev,8259unsigned int portid, int approxlen,8260int event_idx, gfp_t gfp)8261{8262return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,8263NL80211_ATTR_VENDOR_DATA,8264portid, event_idx, approxlen, gfp);8265}82668267/**8268* cfg80211_vendor_event - send the event8269* @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()8270* @gfp: allocation flags8271*8272* This function sends the given @skb, which must have been allocated8273* by cfg80211_vendor_event_alloc(), as an event. It always consumes it.8274*/8275static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)8276{8277__cfg80211_send_event_skb(skb, gfp);8278}82798280#ifdef CONFIG_NL80211_TESTMODE8281/**8282* DOC: Test mode8283*8284* Test mode is a set of utility functions to allow drivers to8285* interact with driver-specific tools to aid, for instance,8286* factory programming.8287*8288* This chapter describes how drivers interact with it. For more8289* information see the nl80211 book's chapter on it.8290*/82918292/**8293* cfg80211_testmode_alloc_reply_skb - allocate testmode reply8294* @wiphy: the wiphy8295* @approxlen: an upper bound of the length of the data that will8296* be put into the skb8297*8298* This function allocates and pre-fills an skb for a reply to8299* the testmode command. Since it is intended for a reply, calling8300* it outside of the @testmode_cmd operation is invalid.8301*8302* The returned skb is pre-filled with the wiphy index and set up in8303* a way that any data that is put into the skb (with skb_put(),8304* nla_put() or similar) will end up being within the8305* %NL80211_ATTR_TESTDATA attribute, so all that needs to be done8306* with the skb is adding data for the corresponding userspace tool8307* which can then read that data out of the testdata attribute. You8308* must not modify the skb in any other way.8309*8310* When done, call cfg80211_testmode_reply() with the skb and return8311* its error code as the result of the @testmode_cmd operation.8312*8313* Return: An allocated and pre-filled skb. %NULL if any errors happen.8314*/8315static inline struct sk_buff *8316cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)8317{8318return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,8319NL80211_ATTR_TESTDATA, approxlen);8320}83218322/**8323* cfg80211_testmode_reply - send the reply skb8324* @skb: The skb, must have been allocated with8325* cfg80211_testmode_alloc_reply_skb()8326*8327* Since calling this function will usually be the last thing8328* before returning from the @testmode_cmd you should return8329* the error code. Note that this function consumes the skb8330* regardless of the return value.8331*8332* Return: An error code or 0 on success.8333*/8334static inline int cfg80211_testmode_reply(struct sk_buff *skb)8335{8336return cfg80211_vendor_cmd_reply(skb);8337}83388339/**8340* cfg80211_testmode_alloc_event_skb - allocate testmode event8341* @wiphy: the wiphy8342* @approxlen: an upper bound of the length of the data that will8343* be put into the skb8344* @gfp: allocation flags8345*8346* This function allocates and pre-fills an skb for an event on the8347* testmode multicast group.8348*8349* The returned skb is set up in the same way as with8350* cfg80211_testmode_alloc_reply_skb() but prepared for an event. As8351* there, you should simply add data to it that will then end up in the8352* %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb8353* in any other way.8354*8355* When done filling the skb, call cfg80211_testmode_event() with the8356* skb to send the event.8357*8358* Return: An allocated and pre-filled skb. %NULL if any errors happen.8359*/8360static inline struct sk_buff *8361cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)8362{8363return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,8364NL80211_ATTR_TESTDATA, 0, -1,8365approxlen, gfp);8366}83678368/**8369* cfg80211_testmode_event - send the event8370* @skb: The skb, must have been allocated with8371* cfg80211_testmode_alloc_event_skb()8372* @gfp: allocation flags8373*8374* This function sends the given @skb, which must have been allocated8375* by cfg80211_testmode_alloc_event_skb(), as an event. It always8376* consumes it.8377*/8378static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)8379{8380__cfg80211_send_event_skb(skb, gfp);8381}83828383#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),8384#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),8385#else8386#define CFG80211_TESTMODE_CMD(cmd)8387#define CFG80211_TESTMODE_DUMP(cmd)8388#endif83898390/**8391* struct cfg80211_fils_resp_params - FILS connection response params8392* @kek: KEK derived from a successful FILS connection (may be %NULL)8393* @kek_len: Length of @fils_kek in octets8394* @update_erp_next_seq_num: Boolean value to specify whether the value in8395* @erp_next_seq_num is valid.8396* @erp_next_seq_num: The next sequence number to use in ERP message in8397* FILS Authentication. This value should be specified irrespective of the8398* status for a FILS connection.8399* @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).8400* @pmk_len: Length of @pmk in octets8401* @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID8402* used for this FILS connection (may be %NULL).8403*/8404struct cfg80211_fils_resp_params {8405const u8 *kek;8406size_t kek_len;8407bool update_erp_next_seq_num;8408u16 erp_next_seq_num;8409const u8 *pmk;8410size_t pmk_len;8411const u8 *pmkid;8412};84138414/**8415* struct cfg80211_connect_resp_params - Connection response params8416* @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use8417* %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you8418* the real status code for failures. If this call is used to report a8419* failure due to a timeout (e.g., not receiving an Authentication frame8420* from the AP) instead of an explicit rejection by the AP, -1 is used to8421* indicate that this is a failure, but without a status code.8422* @timeout_reason is used to report the reason for the timeout in that8423* case.8424* @req_ie: Association request IEs (may be %NULL)8425* @req_ie_len: Association request IEs length8426* @resp_ie: Association response IEs (may be %NULL)8427* @resp_ie_len: Association response IEs length8428* @fils: FILS connection response parameters.8429* @timeout_reason: Reason for connection timeout. This is used when the8430* connection fails due to a timeout instead of an explicit rejection from8431* the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is8432* not known. This value is used only if @status < 0 to indicate that the8433* failure is due to a timeout and not due to explicit rejection by the AP.8434* This value is ignored in other cases (@status >= 0).8435* @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise8436* zero.8437* @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.8438* @links : For MLO connection, contains link info for the valid links indicated8439* using @valid_links. For non-MLO connection, links[0] contains the8440* connected AP info.8441* @links.addr: For MLO connection, MAC address of the STA link. Otherwise8442* %NULL.8443* @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO8444* connection, links[0].bssid points to the BSSID of the AP (may be %NULL).8445* @links.bss: For MLO connection, entry of bss to which STA link is connected.8446* For non-MLO connection, links[0].bss points to entry of bss to which STA8447* is connected. It can be obtained through cfg80211_get_bss() (may be8448* %NULL). It is recommended to store the bss from the connect_request and8449* hold a reference to it and return through this param to avoid a warning8450* if the bss is expired during the connection, esp. for those drivers8451* implementing connect op. Only one parameter among @bssid and @bss needs8452* to be specified.8453* @links.status: per-link status code, to report a status code that's not8454* %WLAN_STATUS_SUCCESS for a given link, it must also be in the8455* @valid_links bitmap and may have a BSS pointer (which is then released)8456*/8457struct cfg80211_connect_resp_params {8458int status;8459const u8 *req_ie;8460size_t req_ie_len;8461const u8 *resp_ie;8462size_t resp_ie_len;8463struct cfg80211_fils_resp_params fils;8464enum nl80211_timeout_reason timeout_reason;84658466const u8 *ap_mld_addr;8467u16 valid_links;8468struct {8469const u8 *addr;8470const u8 *bssid;8471struct cfg80211_bss *bss;8472u16 status;8473} links[IEEE80211_MLD_MAX_NUM_LINKS];8474};84758476/**8477* cfg80211_connect_done - notify cfg80211 of connection result8478*8479* @dev: network device8480* @params: connection response parameters8481* @gfp: allocation flags8482*8483* It should be called by the underlying driver once execution of the connection8484* request from connect() has been completed. This is similar to8485* cfg80211_connect_bss(), but takes a structure pointer for connection response8486* parameters. Only one of the functions among cfg80211_connect_bss(),8487* cfg80211_connect_result(), cfg80211_connect_timeout(),8488* and cfg80211_connect_done() should be called.8489*/8490void cfg80211_connect_done(struct net_device *dev,8491struct cfg80211_connect_resp_params *params,8492gfp_t gfp);84938494/**8495* cfg80211_connect_bss - notify cfg80211 of connection result8496*8497* @dev: network device8498* @bssid: the BSSID of the AP8499* @bss: Entry of bss to which STA got connected to, can be obtained through8500* cfg80211_get_bss() (may be %NULL). But it is recommended to store the8501* bss from the connect_request and hold a reference to it and return8502* through this param to avoid a warning if the bss is expired during the8503* connection, esp. for those drivers implementing connect op.8504* Only one parameter among @bssid and @bss needs to be specified.8505* @req_ie: association request IEs (maybe be %NULL)8506* @req_ie_len: association request IEs length8507* @resp_ie: association response IEs (may be %NULL)8508* @resp_ie_len: assoc response IEs length8509* @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* @gfp: allocation flags8518* @timeout_reason: reason for connection timeout. This is used when the8519* connection fails due to a timeout instead of an explicit rejection from8520* the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is8521* not known. This value is used only if @status < 0 to indicate that the8522* failure is due to a timeout and not due to explicit rejection by the AP.8523* This value is ignored in other cases (@status >= 0).8524*8525* It should be called by the underlying driver once execution of the connection8526* request from connect() has been completed. This is similar to8527* cfg80211_connect_result(), but with the option of identifying the exact bss8528* entry for the connection. Only one of the functions among8529* cfg80211_connect_bss(), cfg80211_connect_result(),8530* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8531*/8532static inline void8533cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,8534struct cfg80211_bss *bss, const u8 *req_ie,8535size_t req_ie_len, const u8 *resp_ie,8536size_t resp_ie_len, int status, gfp_t gfp,8537enum nl80211_timeout_reason timeout_reason)8538{8539struct cfg80211_connect_resp_params params;85408541memset(¶ms, 0, sizeof(params));8542params.status = status;8543params.links[0].bssid = bssid;8544params.links[0].bss = bss;8545params.req_ie = req_ie;8546params.req_ie_len = req_ie_len;8547params.resp_ie = resp_ie;8548params.resp_ie_len = resp_ie_len;8549params.timeout_reason = timeout_reason;85508551cfg80211_connect_done(dev, ¶ms, gfp);8552}85538554/**8555* cfg80211_connect_result - notify cfg80211 of connection result8556*8557* @dev: network device8558* @bssid: the BSSID of the AP8559* @req_ie: association request IEs (maybe be %NULL)8560* @req_ie_len: association request IEs length8561* @resp_ie: association response IEs (may be %NULL)8562* @resp_ie_len: assoc response IEs length8563* @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use8564* %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you8565* the real status code for failures.8566* @gfp: allocation flags8567*8568* It should be called by the underlying driver once execution of the connection8569* request from connect() has been completed. This is similar to8570* cfg80211_connect_bss() which allows the exact bss entry to be specified. Only8571* one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),8572* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8573*/8574static inline void8575cfg80211_connect_result(struct net_device *dev, const u8 *bssid,8576const u8 *req_ie, size_t req_ie_len,8577const u8 *resp_ie, size_t resp_ie_len,8578u16 status, gfp_t gfp)8579{8580cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,8581resp_ie_len, status, gfp,8582NL80211_TIMEOUT_UNSPECIFIED);8583}85848585/**8586* cfg80211_connect_timeout - notify cfg80211 of connection timeout8587*8588* @dev: network device8589* @bssid: the BSSID of the AP8590* @req_ie: association request IEs (maybe be %NULL)8591* @req_ie_len: association request IEs length8592* @gfp: allocation flags8593* @timeout_reason: reason for connection timeout.8594*8595* It should be called by the underlying driver whenever connect() has failed8596* in a sequence where no explicit authentication/association rejection was8597* received from the AP. This could happen, e.g., due to not being able to send8598* out the Authentication or Association Request frame or timing out while8599* waiting for the response. Only one of the functions among8600* cfg80211_connect_bss(), cfg80211_connect_result(),8601* cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.8602*/8603static inline void8604cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,8605const u8 *req_ie, size_t req_ie_len, gfp_t gfp,8606enum nl80211_timeout_reason timeout_reason)8607{8608cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,8609gfp, timeout_reason);8610}86118612/**8613* struct cfg80211_roam_info - driver initiated roaming information8614*8615* @req_ie: association request IEs (maybe be %NULL)8616* @req_ie_len: association request IEs length8617* @resp_ie: association response IEs (may be %NULL)8618* @resp_ie_len: assoc response IEs length8619* @fils: FILS related roaming information.8620* @valid_links: For MLO roaming, BIT mask of the new valid links is set.8621* Otherwise zero.8622* @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.8623* @links : For MLO roaming, contains new link info for the valid links set in8624* @valid_links. For non-MLO roaming, links[0] contains the new AP info.8625* @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.8626* @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO8627* roaming, links[0].bssid points to the BSSID of the new AP. May be8628* %NULL if %links.bss is set.8629* @links.channel: the channel of the new AP.8630* @links.bss: For MLO roaming, entry of new bss to which STA link got8631* roamed. For non-MLO roaming, links[0].bss points to entry of bss to8632* which STA got roamed (may be %NULL if %links.bssid is set)8633*/8634struct cfg80211_roam_info {8635const u8 *req_ie;8636size_t req_ie_len;8637const u8 *resp_ie;8638size_t resp_ie_len;8639struct cfg80211_fils_resp_params fils;86408641const u8 *ap_mld_addr;8642u16 valid_links;8643struct {8644const u8 *addr;8645const u8 *bssid;8646struct ieee80211_channel *channel;8647struct cfg80211_bss *bss;8648} links[IEEE80211_MLD_MAX_NUM_LINKS];8649};86508651/**8652* cfg80211_roamed - notify cfg80211 of roaming8653*8654* @dev: network device8655* @info: information about the new BSS. struct &cfg80211_roam_info.8656* @gfp: allocation flags8657*8658* This function may be called with the driver passing either the BSSID of the8659* new AP or passing the bss entry to avoid a race in timeout of the bss entry.8660* It should be called by the underlying driver whenever it roamed from one AP8661* to another while connected. Drivers which have roaming implemented in8662* firmware should pass the bss entry to avoid a race in bss entry timeout where8663* the bss entry of the new AP is seen in the driver, but gets timed out by the8664* time it is accessed in __cfg80211_roamed() due to delay in scheduling8665* rdev->event_work. In case of any failures, the reference is released8666* either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be8667* released while disconnecting from the current bss.8668*/8669void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,8670gfp_t gfp);86718672/**8673* cfg80211_port_authorized - notify cfg80211 of successful security association8674*8675* @dev: network device8676* @peer_addr: BSSID of the AP/P2P GO in case of STA/GC or STA/GC MAC address8677* in case of AP/P2P GO8678* @td_bitmap: transition disable policy8679* @td_bitmap_len: Length of transition disable policy8680* @gfp: allocation flags8681*8682* This function should be called by a driver that supports 4 way handshake8683* offload after a security association was successfully established (i.e.,8684* the 4 way handshake was completed successfully). The call to this function8685* should be preceded with a call to cfg80211_connect_result(),8686* cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to8687* indicate the 802.11 association.8688* This function can also be called by AP/P2P GO driver that supports8689* authentication offload. In this case the peer_mac passed is that of8690* associated STA/GC.8691*/8692void cfg80211_port_authorized(struct net_device *dev, const u8 *peer_addr,8693const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);86948695/**8696* cfg80211_disconnected - notify cfg80211 that connection was dropped8697*8698* @dev: network device8699* @ie: information elements of the deauth/disassoc frame (may be %NULL)8700* @ie_len: length of IEs8701* @reason: reason code for the disconnection, set it to 0 if unknown8702* @locally_generated: disconnection was requested locally8703* @gfp: allocation flags8704*8705* After it calls this function, the driver should enter an idle state8706* and not try to connect to any AP any more.8707*/8708void cfg80211_disconnected(struct net_device *dev, u16 reason,8709const u8 *ie, size_t ie_len,8710bool locally_generated, gfp_t gfp);87118712/**8713* cfg80211_ready_on_channel - notification of remain_on_channel start8714* @wdev: wireless device8715* @cookie: the request cookie8716* @chan: The current channel (from remain_on_channel request)8717* @duration: Duration in milliseconds that the driver intents to remain on the8718* channel8719* @gfp: allocation flags8720*/8721void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,8722struct ieee80211_channel *chan,8723unsigned int duration, gfp_t gfp);87248725/**8726* cfg80211_remain_on_channel_expired - remain_on_channel duration expired8727* @wdev: wireless device8728* @cookie: the request cookie8729* @chan: The current channel (from remain_on_channel request)8730* @gfp: allocation flags8731*/8732void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,8733struct ieee80211_channel *chan,8734gfp_t gfp);87358736/**8737* cfg80211_tx_mgmt_expired - tx_mgmt duration expired8738* @wdev: wireless device8739* @cookie: the requested cookie8740* @chan: The current channel (from tx_mgmt request)8741* @gfp: allocation flags8742*/8743void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,8744struct ieee80211_channel *chan, gfp_t gfp);87458746/**8747* cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.8748*8749* @sinfo: the station information8750* @gfp: allocation flags8751*8752* Return: 0 on success. Non-zero on error.8753*/8754int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);87558756/**8757* cfg80211_link_sinfo_alloc_tid_stats - allocate per-tid statistics.8758*8759* @link_sinfo: the link station information8760* @gfp: allocation flags8761*8762* Return: 0 on success. Non-zero on error.8763*/8764int cfg80211_link_sinfo_alloc_tid_stats(struct link_station_info *link_sinfo,8765gfp_t gfp);87668767/**8768* cfg80211_sinfo_release_content - release contents of station info8769* @sinfo: the station information8770*8771* Releases any potentially allocated sub-information of the station8772* information, but not the struct itself (since it's typically on8773* the stack.)8774*/8775static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)8776{8777kfree(sinfo->pertid);87788779for (int link_id = 0; link_id < ARRAY_SIZE(sinfo->links); link_id++) {8780if (sinfo->links[link_id]) {8781kfree(sinfo->links[link_id]->pertid);8782kfree(sinfo->links[link_id]);8783}8784}8785}87868787/**8788* cfg80211_new_sta - notify userspace about station8789*8790* @dev: the netdev8791* @mac_addr: the station's address8792* @sinfo: the station information8793* @gfp: allocation flags8794*/8795void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,8796struct station_info *sinfo, gfp_t gfp);87978798/**8799* cfg80211_del_sta_sinfo - notify userspace about deletion of a station8800* @dev: the netdev8801* @mac_addr: the station's address. For MLD station, MLD address is used.8802* @sinfo: the station information/statistics8803* @gfp: allocation flags8804*/8805void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,8806struct station_info *sinfo, gfp_t gfp);88078808/**8809* cfg80211_del_sta - notify userspace about deletion of a station8810*8811* @dev: the netdev8812* @mac_addr: the station's address. For MLD station, MLD address is used.8813* @gfp: allocation flags8814*/8815static inline void cfg80211_del_sta(struct net_device *dev,8816const u8 *mac_addr, gfp_t gfp)8817{8818cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);8819}88208821/**8822* cfg80211_conn_failed - connection request failed notification8823*8824* @dev: the netdev8825* @mac_addr: the station's address8826* @reason: the reason for connection failure8827* @gfp: allocation flags8828*8829* Whenever a station tries to connect to an AP and if the station8830* could not connect to the AP as the AP has rejected the connection8831* for some reasons, this function is called.8832*8833* The reason for connection failure can be any of the value from8834* nl80211_connect_failed_reason enum8835*/8836void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,8837enum nl80211_connect_failed_reason reason,8838gfp_t gfp);88398840/**8841* struct cfg80211_rx_info - received management frame info8842*8843* @freq: Frequency on which the frame was received in kHz8844* @sig_dbm: signal strength in dBm, or 0 if unknown8845* @have_link_id: indicates the frame was received on a link of8846* an MLD, i.e. the @link_id field is valid8847* @link_id: the ID of the link the frame was received on8848* @buf: Management frame (header + body)8849* @len: length of the frame data8850* @flags: flags, as defined in &enum nl80211_rxmgmt_flags8851* @rx_tstamp: Hardware timestamp of frame RX in nanoseconds8852* @ack_tstamp: Hardware timestamp of ack TX in nanoseconds8853*/8854struct cfg80211_rx_info {8855int freq;8856int sig_dbm;8857bool have_link_id;8858u8 link_id;8859const u8 *buf;8860size_t len;8861u32 flags;8862u64 rx_tstamp;8863u64 ack_tstamp;8864};88658866/**8867* cfg80211_rx_mgmt_ext - management frame notification with extended info8868* @wdev: wireless device receiving the frame8869* @info: RX info as defined in struct cfg80211_rx_info8870*8871* This function is called whenever an Action frame is received for a station8872* mode interface, but is not processed in kernel.8873*8874* Return: %true if a user space application has registered for this frame.8875* For action frames, that makes it responsible for rejecting unrecognized8876* action frames; %false otherwise, in which case for action frames the8877* driver is responsible for rejecting the frame.8878*/8879bool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,8880struct cfg80211_rx_info *info);88818882/**8883* cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame8884* @wdev: wireless device receiving the frame8885* @freq: Frequency on which the frame was received in KHz8886* @sig_dbm: signal strength in dBm, or 0 if unknown8887* @buf: Management frame (header + body)8888* @len: length of the frame data8889* @flags: flags, as defined in enum nl80211_rxmgmt_flags8890*8891* This function is called whenever an Action frame is received for a station8892* mode interface, but is not processed in kernel.8893*8894* Return: %true if a user space application has registered for this frame.8895* For action frames, that makes it responsible for rejecting unrecognized8896* action frames; %false otherwise, in which case for action frames the8897* driver is responsible for rejecting the frame.8898*/8899static inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,8900int sig_dbm, const u8 *buf, size_t len,8901u32 flags)8902{8903struct cfg80211_rx_info info = {8904.freq = freq,8905.sig_dbm = sig_dbm,8906.buf = buf,8907.len = len,8908.flags = flags8909};89108911return cfg80211_rx_mgmt_ext(wdev, &info);8912}89138914/**8915* cfg80211_rx_mgmt - notification of received, unprocessed management frame8916* @wdev: wireless device receiving the frame8917* @freq: Frequency on which the frame was received in MHz8918* @sig_dbm: signal strength in dBm, or 0 if unknown8919* @buf: Management frame (header + body)8920* @len: length of the frame data8921* @flags: flags, as defined in enum nl80211_rxmgmt_flags8922*8923* This function is called whenever an Action frame is received for a station8924* mode interface, but is not processed in kernel.8925*8926* Return: %true if a user space application has registered for this frame.8927* For action frames, that makes it responsible for rejecting unrecognized8928* action frames; %false otherwise, in which case for action frames the8929* driver is responsible for rejecting the frame.8930*/8931static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,8932int sig_dbm, const u8 *buf, size_t len,8933u32 flags)8934{8935struct cfg80211_rx_info info = {8936.freq = MHZ_TO_KHZ(freq),8937.sig_dbm = sig_dbm,8938.buf = buf,8939.len = len,8940.flags = flags8941};89428943return cfg80211_rx_mgmt_ext(wdev, &info);8944}89458946/**8947* struct cfg80211_tx_status - TX status for management frame information8948*8949* @cookie: Cookie returned by cfg80211_ops::mgmt_tx()8950* @tx_tstamp: hardware TX timestamp in nanoseconds8951* @ack_tstamp: hardware ack RX timestamp in nanoseconds8952* @buf: Management frame (header + body)8953* @len: length of the frame data8954* @ack: Whether frame was acknowledged8955*/8956struct cfg80211_tx_status {8957u64 cookie;8958u64 tx_tstamp;8959u64 ack_tstamp;8960const u8 *buf;8961size_t len;8962bool ack;8963};89648965/**8966* cfg80211_mgmt_tx_status_ext - TX status notification with extended info8967* @wdev: wireless device receiving the frame8968* @status: TX status data8969* @gfp: context flags8970*8971* This function is called whenever a management frame was requested to be8972* transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the8973* transmission attempt with extended info.8974*/8975void cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,8976struct cfg80211_tx_status *status, gfp_t gfp);89778978/**8979* cfg80211_mgmt_tx_status - notification of TX status for management frame8980* @wdev: wireless device receiving the frame8981* @cookie: Cookie returned by cfg80211_ops::mgmt_tx()8982* @buf: Management frame (header + body)8983* @len: length of the frame data8984* @ack: Whether frame was acknowledged8985* @gfp: context flags8986*8987* This function is called whenever a management frame was requested to be8988* transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the8989* transmission attempt.8990*/8991static inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,8992u64 cookie, const u8 *buf,8993size_t len, bool ack, gfp_t gfp)8994{8995struct cfg80211_tx_status status = {8996.cookie = cookie,8997.buf = buf,8998.len = len,8999.ack = ack9000};90019002cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);9003}90049005/**9006* cfg80211_control_port_tx_status - notification of TX status for control9007* port frames9008* @wdev: wireless device receiving the frame9009* @cookie: Cookie returned by cfg80211_ops::tx_control_port()9010* @buf: Data frame (header + body)9011* @len: length of the frame data9012* @ack: Whether frame was acknowledged9013* @gfp: context flags9014*9015* This function is called whenever a control port frame was requested to be9016* transmitted with cfg80211_ops::tx_control_port() to report the TX status of9017* the transmission attempt.9018*/9019void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,9020const u8 *buf, size_t len, bool ack,9021gfp_t gfp);90229023/**9024* cfg80211_rx_control_port - notification about a received control port frame9025* @dev: The device the frame matched to9026* @skb: The skbuf with the control port frame. It is assumed that the skbuf9027* is 802.3 formatted (with 802.3 header). The skb can be non-linear.9028* This function does not take ownership of the skb, so the caller is9029* responsible for any cleanup. The caller must also ensure that9030* skb->protocol is set appropriately.9031* @unencrypted: Whether the frame was received unencrypted9032* @link_id: the link the frame was received on, -1 if not applicable or unknown9033*9034* This function is used to inform userspace about a received control port9035* frame. It should only be used if userspace indicated it wants to receive9036* control port frames over nl80211.9037*9038* The frame is the data portion of the 802.3 or 802.11 data frame with all9039* network layer headers removed (e.g. the raw EAPoL frame).9040*9041* Return: %true if the frame was passed to userspace9042*/9043bool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,9044bool unencrypted, int link_id);90459046/**9047* cfg80211_cqm_rssi_notify - connection quality monitoring rssi event9048* @dev: network device9049* @rssi_event: the triggered RSSI event9050* @rssi_level: new RSSI level value or 0 if not available9051* @gfp: context flags9052*9053* This function is called when a configured connection quality monitoring9054* rssi threshold reached event occurs.9055*/9056void cfg80211_cqm_rssi_notify(struct net_device *dev,9057enum nl80211_cqm_rssi_threshold_event rssi_event,9058s32 rssi_level, gfp_t gfp);90599060/**9061* cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer9062* @dev: network device9063* @peer: peer's MAC address9064* @num_packets: how many packets were lost -- should be a fixed threshold9065* but probably no less than maybe 50, or maybe a throughput dependent9066* threshold (to account for temporary interference)9067* @gfp: context flags9068*/9069void cfg80211_cqm_pktloss_notify(struct net_device *dev,9070const u8 *peer, u32 num_packets, gfp_t gfp);90719072/**9073* cfg80211_cqm_txe_notify - TX error rate event9074* @dev: network device9075* @peer: peer's MAC address9076* @num_packets: how many packets were lost9077* @rate: % of packets which failed transmission9078* @intvl: interval (in s) over which the TX failure threshold was breached.9079* @gfp: context flags9080*9081* Notify userspace when configured % TX failures over number of packets in a9082* given interval is exceeded.9083*/9084void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,9085u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);90869087/**9088* cfg80211_cqm_beacon_loss_notify - beacon loss event9089* @dev: network device9090* @gfp: context flags9091*9092* Notify userspace about beacon loss from the connected AP.9093*/9094void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);90959096/**9097* __cfg80211_radar_event - radar detection event9098* @wiphy: the wiphy9099* @chandef: chandef for the current channel9100* @offchan: the radar has been detected on the offchannel chain9101* @gfp: context flags9102*9103* This function is called when a radar is detected on the current chanenl.9104*/9105void __cfg80211_radar_event(struct wiphy *wiphy,9106struct cfg80211_chan_def *chandef,9107bool offchan, gfp_t gfp);91089109static inline void9110cfg80211_radar_event(struct wiphy *wiphy,9111struct cfg80211_chan_def *chandef,9112gfp_t gfp)9113{9114__cfg80211_radar_event(wiphy, chandef, false, gfp);9115}91169117static inline void9118cfg80211_background_radar_event(struct wiphy *wiphy,9119struct cfg80211_chan_def *chandef,9120gfp_t gfp)9121{9122__cfg80211_radar_event(wiphy, chandef, true, gfp);9123}91249125/**9126* cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event9127* @dev: network device9128* @mac: MAC address of a station which opmode got modified9129* @sta_opmode: station's current opmode value9130* @gfp: context flags9131*9132* Driver should call this function when station's opmode modified via action9133* frame.9134*/9135void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,9136struct sta_opmode_info *sta_opmode,9137gfp_t gfp);91389139/**9140* cfg80211_cac_event - Channel availability check (CAC) event9141* @netdev: network device9142* @chandef: chandef for the current channel9143* @event: type of event9144* @gfp: context flags9145* @link_id: valid link_id for MLO operation or 0 otherwise.9146*9147* This function is called when a Channel availability check (CAC) is finished9148* or aborted. This must be called to notify the completion of a CAC process,9149* also by full-MAC drivers.9150*/9151void cfg80211_cac_event(struct net_device *netdev,9152const struct cfg80211_chan_def *chandef,9153enum nl80211_radar_event event, gfp_t gfp,9154unsigned int link_id);91559156/**9157* cfg80211_background_cac_abort - Channel Availability Check offchan abort event9158* @wiphy: the wiphy9159*9160* This function is called by the driver when a Channel Availability Check9161* (CAC) is aborted by a offchannel dedicated chain.9162*/9163void cfg80211_background_cac_abort(struct wiphy *wiphy);91649165/**9166* cfg80211_gtk_rekey_notify - notify userspace about driver rekeying9167* @dev: network device9168* @bssid: BSSID of AP (to avoid races)9169* @replay_ctr: new replay counter9170* @gfp: allocation flags9171*/9172void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,9173const u8 *replay_ctr, gfp_t gfp);91749175/**9176* cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate9177* @dev: network device9178* @index: candidate index (the smaller the index, the higher the priority)9179* @bssid: BSSID of AP9180* @preauth: Whether AP advertises support for RSN pre-authentication9181* @gfp: allocation flags9182*/9183void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,9184const u8 *bssid, bool preauth, gfp_t gfp);91859186/**9187* cfg80211_rx_spurious_frame - inform userspace about a spurious frame9188* @dev: The device the frame matched to9189* @link_id: the link the frame was received on, -1 if not applicable or unknown9190* @addr: the transmitter address9191* @gfp: context flags9192*9193* This function is used in AP mode (only!) to inform userspace that9194* a spurious class 3 frame was received, to be able to deauth the9195* sender.9196* Return: %true if the frame was passed to userspace (or this failed9197* for a reason other than not having a subscription.)9198*/9199bool cfg80211_rx_spurious_frame(struct net_device *dev, const u8 *addr,9200int link_id, gfp_t gfp);92019202/**9203* cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame9204* @dev: The device the frame matched to9205* @addr: the transmitter address9206* @link_id: the link the frame was received on, -1 if not applicable or unknown9207* @gfp: context flags9208*9209* This function is used in AP mode (only!) to inform userspace that9210* an associated station sent a 4addr frame but that wasn't expected.9211* It is allowed and desirable to send this event only once for each9212* station to avoid event flooding.9213* Return: %true if the frame was passed to userspace (or this failed9214* for a reason other than not having a subscription.)9215*/9216bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev, const u8 *addr,9217int link_id, gfp_t gfp);92189219/**9220* cfg80211_probe_status - notify userspace about probe status9221* @dev: the device the probe was sent on9222* @addr: the address of the peer9223* @cookie: the cookie filled in @probe_client previously9224* @acked: indicates whether probe was acked or not9225* @ack_signal: signal strength (in dBm) of the ACK frame.9226* @is_valid_ack_signal: indicates the ack_signal is valid or not.9227* @gfp: allocation flags9228*/9229void cfg80211_probe_status(struct net_device *dev, const u8 *addr,9230u64 cookie, bool acked, s32 ack_signal,9231bool is_valid_ack_signal, gfp_t gfp);92329233/**9234* cfg80211_report_obss_beacon_khz - report beacon from other APs9235* @wiphy: The wiphy that received the beacon9236* @frame: the frame9237* @len: length of the frame9238* @freq: frequency the frame was received on in KHz9239* @sig_dbm: signal strength in dBm, or 0 if unknown9240*9241* Use this function to report to userspace when a beacon was9242* received. It is not useful to call this when there is no9243* netdev that is in AP/GO mode.9244*/9245void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,9246size_t len, int freq, int sig_dbm);92479248/**9249* cfg80211_report_obss_beacon - report beacon from other APs9250* @wiphy: The wiphy that received the beacon9251* @frame: the frame9252* @len: length of the frame9253* @freq: frequency the frame was received on9254* @sig_dbm: signal strength in dBm, or 0 if unknown9255*9256* Use this function to report to userspace when a beacon was9257* received. It is not useful to call this when there is no9258* netdev that is in AP/GO mode.9259*/9260static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,9261const u8 *frame, size_t len,9262int freq, int sig_dbm)9263{9264cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),9265sig_dbm);9266}92679268/**9269* struct cfg80211_beaconing_check_config - beacon check configuration9270* @iftype: the interface type to check for9271* @relax: allow IR-relaxation conditions to apply (e.g. another9272* interface connected already on the same channel)9273* NOTE: If this is set, wiphy mutex must be held.9274* @reg_power: &enum ieee80211_ap_reg_power value indicating the9275* advertised/used 6 GHz regulatory power setting9276*/9277struct cfg80211_beaconing_check_config {9278enum nl80211_iftype iftype;9279enum ieee80211_ap_reg_power reg_power;9280bool relax;9281};92829283/**9284* cfg80211_reg_check_beaconing - check if beaconing is allowed9285* @wiphy: the wiphy9286* @chandef: the channel definition9287* @cfg: additional parameters for the checking9288*9289* Return: %true if there is no secondary channel or the secondary channel(s)9290* can be used for beaconing (i.e. is not a radar channel etc.)9291*/9292bool cfg80211_reg_check_beaconing(struct wiphy *wiphy,9293struct cfg80211_chan_def *chandef,9294struct cfg80211_beaconing_check_config *cfg);92959296/**9297* cfg80211_reg_can_beacon - check if beaconing is allowed9298* @wiphy: the wiphy9299* @chandef: the channel definition9300* @iftype: interface type9301*9302* Return: %true if there is no secondary channel or the secondary channel(s)9303* can be used for beaconing (i.e. is not a radar channel etc.)9304*/9305static inline bool9306cfg80211_reg_can_beacon(struct wiphy *wiphy,9307struct cfg80211_chan_def *chandef,9308enum nl80211_iftype iftype)9309{9310struct cfg80211_beaconing_check_config config = {9311.iftype = iftype,9312};93139314return cfg80211_reg_check_beaconing(wiphy, chandef, &config);9315}93169317/**9318* cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation9319* @wiphy: the wiphy9320* @chandef: the channel definition9321* @iftype: interface type9322*9323* Return: %true if there is no secondary channel or the secondary channel(s)9324* can be used for beaconing (i.e. is not a radar channel etc.). This version9325* also checks if IR-relaxation conditions apply, to allow beaconing under9326* more permissive conditions.9327*9328* Context: Requires the wiphy mutex to be held.9329*/9330static inline bool9331cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,9332struct cfg80211_chan_def *chandef,9333enum nl80211_iftype iftype)9334{9335struct cfg80211_beaconing_check_config config = {9336.iftype = iftype,9337.relax = true,9338};93399340return cfg80211_reg_check_beaconing(wiphy, chandef, &config);9341}93429343/**9344* cfg80211_ch_switch_notify - update wdev channel and notify userspace9345* @dev: the device which switched channels9346* @chandef: the new channel definition9347* @link_id: the link ID for MLO, must be 0 for non-MLO9348*9349* Caller must hold wiphy mutex, therefore must only be called from sleepable9350* driver context!9351*/9352void cfg80211_ch_switch_notify(struct net_device *dev,9353struct cfg80211_chan_def *chandef,9354unsigned int link_id);93559356/**9357* cfg80211_ch_switch_started_notify - notify channel switch start9358* @dev: the device on which the channel switch started9359* @chandef: the future channel definition9360* @link_id: the link ID for MLO, must be 0 for non-MLO9361* @count: the number of TBTTs until the channel switch happens9362* @quiet: whether or not immediate quiet was requested by the AP9363*9364* Inform the userspace about the channel switch that has just9365* started, so that it can take appropriate actions (eg. starting9366* channel switch on other vifs), if necessary.9367*/9368void cfg80211_ch_switch_started_notify(struct net_device *dev,9369struct cfg80211_chan_def *chandef,9370unsigned int link_id, u8 count,9371bool quiet);93729373/**9374* ieee80211_operating_class_to_band - convert operating class to band9375*9376* @operating_class: the operating class to convert9377* @band: band pointer to fill9378*9379* Return: %true if the conversion was successful, %false otherwise.9380*/9381bool ieee80211_operating_class_to_band(u8 operating_class,9382enum nl80211_band *band);93839384/**9385* ieee80211_operating_class_to_chandef - convert operating class to chandef9386*9387* @operating_class: the operating class to convert9388* @chan: the ieee80211_channel to convert9389* @chandef: a pointer to the resulting chandef9390*9391* Return: %true if the conversion was successful, %false otherwise.9392*/9393bool ieee80211_operating_class_to_chandef(u8 operating_class,9394struct ieee80211_channel *chan,9395struct cfg80211_chan_def *chandef);93969397/**9398* ieee80211_chandef_to_operating_class - convert chandef to operation class9399*9400* @chandef: the chandef to convert9401* @op_class: a pointer to the resulting operating class9402*9403* Return: %true if the conversion was successful, %false otherwise.9404*/9405bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,9406u8 *op_class);94079408/**9409* ieee80211_chandef_to_khz - convert chandef to frequency in KHz9410*9411* @chandef: the chandef to convert9412*9413* Return: the center frequency of chandef (1st segment) in KHz.9414*/9415static inline u329416ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)9417{9418return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;9419}94209421/**9422* cfg80211_tdls_oper_request - request userspace to perform TDLS operation9423* @dev: the device on which the operation is requested9424* @peer: the MAC address of the peer device9425* @oper: the requested TDLS operation (NL80211_TDLS_SETUP or9426* NL80211_TDLS_TEARDOWN)9427* @reason_code: the reason code for teardown request9428* @gfp: allocation flags9429*9430* This function is used to request userspace to perform TDLS operation that9431* requires knowledge of keys, i.e., link setup or teardown when the AP9432* connection uses encryption. This is optional mechanism for the driver to use9433* if it can automatically determine when a TDLS link could be useful (e.g.,9434* based on traffic and signal strength for a peer).9435*/9436void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,9437enum nl80211_tdls_operation oper,9438u16 reason_code, gfp_t gfp);94399440/**9441* cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)9442* @rate: given rate_info to calculate bitrate from9443*9444* Return: calculated bitrate9445*/9446u32 cfg80211_calculate_bitrate(struct rate_info *rate);94479448/**9449* cfg80211_unregister_wdev - remove the given wdev9450* @wdev: struct wireless_dev to remove9451*9452* This function removes the device so it can no longer be used. It is necessary9453* to call this function even when cfg80211 requests the removal of the device9454* by calling the del_virtual_intf() callback. The function must also be called9455* when the driver wishes to unregister the wdev, e.g. when the hardware device9456* is unbound from the driver.9457*9458* Context: Requires the RTNL and wiphy mutex to be held.9459*/9460void cfg80211_unregister_wdev(struct wireless_dev *wdev);94619462/**9463* cfg80211_register_netdevice - register the given netdev9464* @dev: the netdev to register9465*9466* Note: In contexts coming from cfg80211 callbacks, you must call this rather9467* than register_netdevice(), unregister_netdev() is impossible as the RTNL is9468* held. Otherwise, both register_netdevice() and register_netdev() are usable9469* instead as well.9470*9471* Context: Requires the RTNL and wiphy mutex to be held.9472*9473* Return: 0 on success. Non-zero on error.9474*/9475int cfg80211_register_netdevice(struct net_device *dev);94769477/**9478* cfg80211_unregister_netdevice - unregister the given netdev9479* @dev: the netdev to register9480*9481* Note: In contexts coming from cfg80211 callbacks, you must call this rather9482* than unregister_netdevice(), unregister_netdev() is impossible as the RTNL9483* is held. Otherwise, both unregister_netdevice() and unregister_netdev() are9484* usable instead as well.9485*9486* Context: Requires the RTNL and wiphy mutex to be held.9487*/9488static inline void cfg80211_unregister_netdevice(struct net_device *dev)9489{9490#if IS_ENABLED(CONFIG_CFG80211)9491cfg80211_unregister_wdev(dev->ieee80211_ptr);9492#endif9493}94949495/**9496* struct cfg80211_ft_event_params - FT Information Elements9497* @ies: FT IEs9498* @ies_len: length of the FT IE in bytes9499* @target_ap: target AP's MAC address9500* @ric_ies: RIC IE9501* @ric_ies_len: length of the RIC IE in bytes9502*/9503struct cfg80211_ft_event_params {9504const u8 *ies;9505size_t ies_len;9506const u8 *target_ap;9507const u8 *ric_ies;9508size_t ric_ies_len;9509};95109511/**9512* cfg80211_ft_event - notify userspace about FT IE and RIC IE9513* @netdev: network device9514* @ft_event: IE information9515*/9516void cfg80211_ft_event(struct net_device *netdev,9517struct cfg80211_ft_event_params *ft_event);95189519/**9520* cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer9521* @ies: the input IE buffer9522* @len: the input length9523* @attr: the attribute ID to find9524* @buf: output buffer, can be %NULL if the data isn't needed, e.g.9525* if the function is only called to get the needed buffer size9526* @bufsize: size of the output buffer9527*9528* The function finds a given P2P attribute in the (vendor) IEs and9529* copies its contents to the given buffer.9530*9531* Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is9532* malformed or the attribute can't be found (respectively), or the9533* length of the found attribute (which can be zero).9534*/9535int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,9536enum ieee80211_p2p_attr_id attr,9537u8 *buf, unsigned int bufsize);95389539/**9540* ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)9541* @ies: the IE buffer9542* @ielen: the length of the IE buffer9543* @ids: an array with element IDs that are allowed before9544* the split. A WLAN_EID_EXTENSION value means that the next9545* EID in the list is a sub-element of the EXTENSION IE.9546* @n_ids: the size of the element ID array9547* @after_ric: array IE types that come after the RIC element9548* @n_after_ric: size of the @after_ric array9549* @offset: offset where to start splitting in the buffer9550*9551* This function splits an IE buffer by updating the @offset9552* variable to point to the location where the buffer should be9553* split.9554*9555* It assumes that the given IE buffer is well-formed, this9556* has to be guaranteed by the caller!9557*9558* It also assumes that the IEs in the buffer are ordered9559* correctly, if not the result of using this function will not9560* be ordered correctly either, i.e. it does no reordering.9561*9562* Return: The offset where the next part of the buffer starts, which9563* may be @ielen if the entire (remainder) of the buffer should be9564* used.9565*/9566size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,9567const u8 *ids, int n_ids,9568const u8 *after_ric, int n_after_ric,9569size_t offset);95709571/**9572* ieee80211_ie_split - split an IE buffer according to ordering9573* @ies: the IE buffer9574* @ielen: the length of the IE buffer9575* @ids: an array with element IDs that are allowed before9576* the split. A WLAN_EID_EXTENSION value means that the next9577* EID in the list is a sub-element of the EXTENSION IE.9578* @n_ids: the size of the element ID array9579* @offset: offset where to start splitting in the buffer9580*9581* This function splits an IE buffer by updating the @offset9582* variable to point to the location where the buffer should be9583* split.9584*9585* It assumes that the given IE buffer is well-formed, this9586* has to be guaranteed by the caller!9587*9588* It also assumes that the IEs in the buffer are ordered9589* correctly, if not the result of using this function will not9590* be ordered correctly either, i.e. it does no reordering.9591*9592* Return: The offset where the next part of the buffer starts, which9593* may be @ielen if the entire (remainder) of the buffer should be9594* used.9595*/9596static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,9597const u8 *ids, int n_ids, size_t offset)9598{9599return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);9600}96019602/**9603* ieee80211_fragment_element - fragment the last element in skb9604* @skb: The skbuf that the element was added to9605* @len_pos: Pointer to length of the element to fragment9606* @frag_id: The element ID to use for fragments9607*9608* This function fragments all data after @len_pos, adding fragmentation9609* elements with the given ID as appropriate. The SKB will grow in size9610* accordingly.9611*/9612void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id);96139614/**9615* cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN9616* @wdev: the wireless device reporting the wakeup9617* @wakeup: the wakeup report9618* @gfp: allocation flags9619*9620* This function reports that the given device woke up. If it9621* caused the wakeup, report the reason(s), otherwise you may9622* pass %NULL as the @wakeup parameter to advertise that something9623* else caused the wakeup.9624*/9625void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,9626struct cfg80211_wowlan_wakeup *wakeup,9627gfp_t gfp);96289629/**9630* cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.9631*9632* @wdev: the wireless device for which critical protocol is stopped.9633* @gfp: allocation flags9634*9635* This function can be called by the driver to indicate it has reverted9636* operation back to normal. One reason could be that the duration given9637* by .crit_proto_start() has expired.9638*/9639void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);96409641/**9642* ieee80211_get_num_supported_channels - get number of channels device has9643* @wiphy: the wiphy9644*9645* Return: the number of channels supported by the device.9646*/9647unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);96489649/**9650* cfg80211_check_combinations - check interface combinations9651*9652* @wiphy: the wiphy9653* @params: the interface combinations parameter9654*9655* This function can be called by the driver to check whether a9656* combination of interfaces and their types are allowed according to9657* the interface combinations.9658*9659* Return: 0 if combinations are allowed. Non-zero on error.9660*/9661int cfg80211_check_combinations(struct wiphy *wiphy,9662struct iface_combination_params *params);96639664/**9665* cfg80211_iter_combinations - iterate over matching combinations9666*9667* @wiphy: the wiphy9668* @params: the interface combinations parameter9669* @iter: function to call for each matching combination9670* @data: pointer to pass to iter function9671*9672* This function can be called by the driver to check what possible9673* combinations it fits in at a given moment, e.g. for channel switching9674* purposes.9675*9676* Return: 0 on success. Non-zero on error.9677*/9678int cfg80211_iter_combinations(struct wiphy *wiphy,9679struct iface_combination_params *params,9680void (*iter)(const struct ieee80211_iface_combination *c,9681void *data),9682void *data);9683/**9684* cfg80211_get_radio_idx_by_chan - get the radio index by the channel9685*9686* @wiphy: the wiphy9687* @chan: channel for which the supported radio index is required9688*9689* Return: radio index on success or -EINVAL otherwise9690*/9691int cfg80211_get_radio_idx_by_chan(struct wiphy *wiphy,9692const struct ieee80211_channel *chan);969396949695/**9696* cfg80211_stop_iface - trigger interface disconnection9697*9698* @wiphy: the wiphy9699* @wdev: wireless device9700* @gfp: context flags9701*9702* Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA9703* disconnected.9704*9705* Note: This doesn't need any locks and is asynchronous.9706*/9707void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,9708gfp_t gfp);97099710/**9711* cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy9712* @wiphy: the wiphy to shut down9713*9714* This function shuts down all interfaces belonging to this wiphy by9715* calling dev_close() (and treating non-netdev interfaces as needed).9716* It shouldn't really be used unless there are some fatal device errors9717* that really can't be recovered in any other way.9718*9719* Callers must hold the RTNL and be able to deal with callbacks into9720* the driver while the function is running.9721*/9722void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);97239724/**9725* wiphy_ext_feature_set - set the extended feature flag9726*9727* @wiphy: the wiphy to modify.9728* @ftidx: extended feature bit index.9729*9730* The extended features are flagged in multiple bytes (see9731* &struct wiphy.@ext_features)9732*/9733static inline void wiphy_ext_feature_set(struct wiphy *wiphy,9734enum nl80211_ext_feature_index ftidx)9735{9736u8 *ft_byte;97379738ft_byte = &wiphy->ext_features[ftidx / 8];9739*ft_byte |= BIT(ftidx % 8);9740}97419742/**9743* wiphy_ext_feature_isset - check the extended feature flag9744*9745* @wiphy: the wiphy to modify.9746* @ftidx: extended feature bit index.9747*9748* The extended features are flagged in multiple bytes (see9749* &struct wiphy.@ext_features)9750*9751* Return: %true if extended feature flag is set, %false otherwise9752*/9753static inline bool9754wiphy_ext_feature_isset(struct wiphy *wiphy,9755enum nl80211_ext_feature_index ftidx)9756{9757u8 ft_byte;97589759ft_byte = wiphy->ext_features[ftidx / 8];9760return (ft_byte & BIT(ftidx % 8)) != 0;9761}97629763/**9764* cfg80211_free_nan_func - free NAN function9765* @f: NAN function that should be freed9766*9767* Frees all the NAN function and all it's allocated members.9768*/9769void cfg80211_free_nan_func(struct cfg80211_nan_func *f);97709771/**9772* struct cfg80211_nan_match_params - NAN match parameters9773* @type: the type of the function that triggered a match. If it is9774* %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.9775* If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery9776* result.9777* If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.9778* @inst_id: the local instance id9779* @peer_inst_id: the instance id of the peer's function9780* @addr: the MAC address of the peer9781* @info_len: the length of the &info9782* @info: the Service Specific Info from the peer (if any)9783* @cookie: unique identifier of the corresponding function9784*/9785struct cfg80211_nan_match_params {9786enum nl80211_nan_function_type type;9787u8 inst_id;9788u8 peer_inst_id;9789const u8 *addr;9790u8 info_len;9791const u8 *info;9792u64 cookie;9793};97949795/**9796* cfg80211_nan_match - report a match for a NAN function.9797* @wdev: the wireless device reporting the match9798* @match: match notification parameters9799* @gfp: allocation flags9800*9801* This function reports that the a NAN function had a match. This9802* can be a subscribe that had a match or a solicited publish that9803* was sent. It can also be a follow up that was received.9804*/9805void cfg80211_nan_match(struct wireless_dev *wdev,9806struct cfg80211_nan_match_params *match, gfp_t gfp);98079808/**9809* cfg80211_nan_func_terminated - notify about NAN function termination.9810*9811* @wdev: the wireless device reporting the match9812* @inst_id: the local instance id9813* @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)9814* @cookie: unique NAN function identifier9815* @gfp: allocation flags9816*9817* This function reports that the a NAN function is terminated.9818*/9819void cfg80211_nan_func_terminated(struct wireless_dev *wdev,9820u8 inst_id,9821enum nl80211_nan_func_term_reason reason,9822u64 cookie, gfp_t gfp);98239824/* ethtool helper */9825void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);98269827/**9828* cfg80211_external_auth_request - userspace request for authentication9829* @netdev: network device9830* @params: External authentication parameters9831* @gfp: allocation flags9832* Returns: 0 on success, < 0 on error9833*/9834int cfg80211_external_auth_request(struct net_device *netdev,9835struct cfg80211_external_auth_params *params,9836gfp_t gfp);98379838/**9839* cfg80211_pmsr_report - report peer measurement result data9840* @wdev: the wireless device reporting the measurement9841* @req: the original measurement request9842* @result: the result data9843* @gfp: allocation flags9844*/9845void cfg80211_pmsr_report(struct wireless_dev *wdev,9846struct cfg80211_pmsr_request *req,9847struct cfg80211_pmsr_result *result,9848gfp_t gfp);98499850/**9851* cfg80211_pmsr_complete - report peer measurement completed9852* @wdev: the wireless device reporting the measurement9853* @req: the original measurement request9854* @gfp: allocation flags9855*9856* Report that the entire measurement completed, after this9857* the request pointer will no longer be valid.9858*/9859void cfg80211_pmsr_complete(struct wireless_dev *wdev,9860struct cfg80211_pmsr_request *req,9861gfp_t gfp);98629863/**9864* cfg80211_iftype_allowed - check whether the interface can be allowed9865* @wiphy: the wiphy9866* @iftype: interface type9867* @is_4addr: use_4addr flag, must be '0' when check_swif is '1'9868* @check_swif: check iftype against software interfaces9869*9870* Check whether the interface is allowed to operate; additionally, this API9871* can be used to check iftype against the software interfaces when9872* check_swif is '1'.9873*9874* Return: %true if allowed, %false otherwise9875*/9876bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,9877bool is_4addr, u8 check_swif);987898799880/**9881* cfg80211_assoc_comeback - notification of association that was9882* temporarily rejected with a comeback9883* @netdev: network device9884* @ap_addr: AP (MLD) address that rejected the association9885* @timeout: timeout interval value TUs.9886*9887* this function may sleep. the caller must hold the corresponding wdev's mutex.9888*/9889void cfg80211_assoc_comeback(struct net_device *netdev,9890const u8 *ap_addr, u32 timeout);98919892/* Logging, debugging and troubleshooting/diagnostic helpers. */98939894/* wiphy_printk helpers, similar to dev_printk */98959896#define wiphy_printk(level, wiphy, format, args...) \9897dev_printk(level, &(wiphy)->dev, format, ##args)9898#define wiphy_emerg(wiphy, format, args...) \9899dev_emerg(&(wiphy)->dev, format, ##args)9900#define wiphy_alert(wiphy, format, args...) \9901dev_alert(&(wiphy)->dev, format, ##args)9902#define wiphy_crit(wiphy, format, args...) \9903dev_crit(&(wiphy)->dev, format, ##args)9904#define wiphy_err(wiphy, format, args...) \9905dev_err(&(wiphy)->dev, format, ##args)9906#define wiphy_warn(wiphy, format, args...) \9907dev_warn(&(wiphy)->dev, format, ##args)9908#define wiphy_notice(wiphy, format, args...) \9909dev_notice(&(wiphy)->dev, format, ##args)9910#define wiphy_info(wiphy, format, args...) \9911dev_info(&(wiphy)->dev, format, ##args)9912#define wiphy_info_once(wiphy, format, args...) \9913dev_info_once(&(wiphy)->dev, format, ##args)99149915#define wiphy_err_ratelimited(wiphy, format, args...) \9916dev_err_ratelimited(&(wiphy)->dev, format, ##args)9917#define wiphy_warn_ratelimited(wiphy, format, args...) \9918dev_warn_ratelimited(&(wiphy)->dev, format, ##args)99199920#define wiphy_debug(wiphy, format, args...) \9921wiphy_printk(KERN_DEBUG, wiphy, format, ##args)99229923#define wiphy_dbg(wiphy, format, args...) \9924dev_dbg(&(wiphy)->dev, format, ##args)99259926#if defined(VERBOSE_DEBUG)9927#define wiphy_vdbg wiphy_dbg9928#else9929#define wiphy_vdbg(wiphy, format, args...) \9930({ \9931if (0) \9932wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \99330; \9934})9935#endif99369937/*9938* wiphy_WARN() acts like wiphy_printk(), but with the key difference9939* of using a WARN/WARN_ON to get the message out, including the9940* file/line information and a backtrace.9941*/9942#define wiphy_WARN(wiphy, format, args...) \9943WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);99449945/**9946* cfg80211_update_owe_info_event - Notify the peer's OWE info to user space9947* @netdev: network device9948* @owe_info: peer's owe info9949* @gfp: allocation flags9950*/9951void cfg80211_update_owe_info_event(struct net_device *netdev,9952struct cfg80211_update_owe_info *owe_info,9953gfp_t gfp);99549955/**9956* cfg80211_bss_flush - resets all the scan entries9957* @wiphy: the wiphy9958*/9959void cfg80211_bss_flush(struct wiphy *wiphy);99609961/**9962* cfg80211_bss_color_notify - notify about bss color event9963* @dev: network device9964* @cmd: the actual event we want to notify9965* @count: the number of TBTTs until the color change happens9966* @color_bitmap: representations of the colors that the local BSS is aware of9967* @link_id: valid link_id in case of MLO or 0 for non-MLO.9968*9969* Return: 0 on success. Non-zero on error.9970*/9971int cfg80211_bss_color_notify(struct net_device *dev,9972enum nl80211_commands cmd, u8 count,9973u64 color_bitmap, u8 link_id);99749975/**9976* cfg80211_obss_color_collision_notify - notify about bss color collision9977* @dev: network device9978* @color_bitmap: representations of the colors that the local BSS is aware of9979* @link_id: valid link_id in case of MLO or 0 for non-MLO.9980*9981* Return: 0 on success. Non-zero on error.9982*/9983static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,9984u64 color_bitmap,9985u8 link_id)9986{9987return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION,99880, color_bitmap, link_id);9989}99909991/**9992* cfg80211_color_change_started_notify - notify color change start9993* @dev: the device on which the color is switched9994* @count: the number of TBTTs until the color change happens9995* @link_id: valid link_id in case of MLO or 0 for non-MLO.9996*9997* Inform the userspace about the color change that has started.9998*9999* Return: 0 on success. Non-zero on error.10000*/10001static inline int cfg80211_color_change_started_notify(struct net_device *dev,10002u8 count, u8 link_id)10003{10004return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED,10005count, 0, link_id);10006}1000710008/**10009* cfg80211_color_change_aborted_notify - notify color change abort10010* @dev: the device on which the color is switched10011* @link_id: valid link_id in case of MLO or 0 for non-MLO.10012*10013* Inform the userspace about the color change that has aborted.10014*10015* Return: 0 on success. Non-zero on error.10016*/10017static inline int cfg80211_color_change_aborted_notify(struct net_device *dev,10018u8 link_id)10019{10020return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED,100210, 0, link_id);10022}1002310024/**10025* cfg80211_color_change_notify - notify color change completion10026* @dev: the device on which the color was switched10027* @link_id: valid link_id in case of MLO or 0 for non-MLO.10028*10029* Inform the userspace about the color change that has completed.10030*10031* Return: 0 on success. Non-zero on error.10032*/10033static inline int cfg80211_color_change_notify(struct net_device *dev,10034u8 link_id)10035{10036return cfg80211_bss_color_notify(dev,10037NL80211_CMD_COLOR_CHANGE_COMPLETED,100380, 0, link_id);10039}1004010041/**10042* cfg80211_links_removed - Notify about removed STA MLD setup links.10043* @dev: network device.10044* @link_mask: BIT mask of removed STA MLD setup link IDs.10045*10046* Inform cfg80211 and the userspace about removed STA MLD setup links due to10047* AP MLD removing the corresponding affiliated APs with Multi-Link10048* reconfiguration. Note that it's not valid to remove all links, in this10049* case disconnect instead.10050* Also note that the wdev mutex must be held.10051*/10052void cfg80211_links_removed(struct net_device *dev, u16 link_mask);1005310054/**10055* struct cfg80211_mlo_reconf_done_data - MLO reconfiguration data10056* @buf: MLO Reconfiguration Response frame (header + body)10057* @len: length of the frame data10058* @driver_initiated: Indicates whether the add links request is initiated by10059* driver. This is set to true when the link reconfiguration request10060* initiated by driver due to AP link recommendation requests10061* (Ex: BTM (BSS Transition Management) request) handling offloaded to10062* driver.10063* @added_links: BIT mask of links successfully added to the association10064* @links: per-link information indexed by link ID10065* @links.bss: the BSS that MLO reconfiguration was requested for, ownership of10066* the pointer moves to cfg80211 in the call to10067* cfg80211_mlo_reconf_add_done().10068*10069* The BSS pointer must be set for each link for which 'add' operation was10070* requested in the assoc_ml_reconf callback.10071*/10072struct cfg80211_mlo_reconf_done_data {10073const u8 *buf;10074size_t len;10075bool driver_initiated;10076u16 added_links;10077struct {10078struct cfg80211_bss *bss;10079u8 *addr;10080} links[IEEE80211_MLD_MAX_NUM_LINKS];10081};1008210083/**10084* cfg80211_mlo_reconf_add_done - Notify about MLO reconfiguration result10085* @dev: network device.10086* @data: MLO reconfiguration done data, &struct cfg80211_mlo_reconf_done_data10087*10088* Inform cfg80211 and the userspace that processing of ML reconfiguration10089* request to add links to the association is done.10090*/10091void cfg80211_mlo_reconf_add_done(struct net_device *dev,10092struct cfg80211_mlo_reconf_done_data *data);1009310094/**10095* cfg80211_schedule_channels_check - schedule regulatory check if needed10096* @wdev: the wireless device to check10097*10098* In case the device supports NO_IR or DFS relaxations, schedule regulatory10099* channels check, as previous concurrent operation conditions may not10100* hold anymore.10101*/10102void cfg80211_schedule_channels_check(struct wireless_dev *wdev);1010310104/**10105* cfg80211_epcs_changed - Notify about a change in EPCS state10106* @netdev: the wireless device whose EPCS state changed10107* @enabled: set to true if EPCS was enabled, otherwise set to false.10108*/10109void cfg80211_epcs_changed(struct net_device *netdev, bool enabled);1011010111/**10112* cfg80211_next_nan_dw_notif - Notify about the next NAN Discovery Window (DW)10113* @wdev: Pointer to the wireless device structure10114* @chan: DW channel (6, 44 or 149)10115* @gfp: Memory allocation flags10116*/10117void cfg80211_next_nan_dw_notif(struct wireless_dev *wdev,10118struct ieee80211_channel *chan, gfp_t gfp);1011910120/**10121* cfg80211_nan_cluster_joined - Notify about NAN cluster join10122* @wdev: Pointer to the wireless device structure10123* @cluster_id: Cluster ID of the NAN cluster that was joined or started10124* @new_cluster: Indicates if this is a new cluster or an existing one10125* @gfp: Memory allocation flags10126*10127* This function is used to notify user space when a NAN cluster has been10128* joined, providing the cluster ID and a flag whether it is a new cluster.10129*/10130void cfg80211_nan_cluster_joined(struct wireless_dev *wdev,10131const u8 *cluster_id, bool new_cluster,10132gfp_t gfp);1013310134#ifdef CONFIG_CFG80211_DEBUGFS10135/**10136* wiphy_locked_debugfs_read - do a locked read in debugfs10137* @wiphy: the wiphy to use10138* @file: the file being read10139* @buf: the buffer to fill and then read from10140* @bufsize: size of the buffer10141* @userbuf: the user buffer to copy to10142* @count: read count10143* @ppos: read position10144* @handler: the read handler to call (under wiphy lock)10145* @data: additional data to pass to the read handler10146*10147* Return: the number of characters read, or a negative errno10148*/10149ssize_t wiphy_locked_debugfs_read(struct wiphy *wiphy, struct file *file,10150char *buf, size_t bufsize,10151char __user *userbuf, size_t count,10152loff_t *ppos,10153ssize_t (*handler)(struct wiphy *wiphy,10154struct file *file,10155char *buf,10156size_t bufsize,10157void *data),10158void *data);1015910160/**10161* wiphy_locked_debugfs_write - do a locked write in debugfs10162* @wiphy: the wiphy to use10163* @file: the file being written to10164* @buf: the buffer to copy the user data to10165* @bufsize: size of the buffer10166* @userbuf: the user buffer to copy from10167* @count: read count10168* @handler: the write handler to call (under wiphy lock)10169* @data: additional data to pass to the write handler10170*10171* Return: the number of characters written, or a negative errno10172*/10173ssize_t wiphy_locked_debugfs_write(struct wiphy *wiphy, struct file *file,10174char *buf, size_t bufsize,10175const char __user *userbuf, size_t count,10176ssize_t (*handler)(struct wiphy *wiphy,10177struct file *file,10178char *buf,10179size_t count,10180void *data),10181void *data);10182#endif1018310184/**10185* cfg80211_s1g_get_start_freq_khz - get S1G chandef start frequency10186* @chandef: the chandef to use10187*10188* Return: the chandefs starting frequency in KHz10189*/10190static inline u3210191cfg80211_s1g_get_start_freq_khz(const struct cfg80211_chan_def *chandef)10192{10193u32 bw_mhz = cfg80211_chandef_get_width(chandef);10194u32 center_khz =10195MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;10196return center_khz - bw_mhz * 500 + 500;10197}1019810199/**10200* cfg80211_s1g_get_end_freq_khz - get S1G chandef end frequency10201* @chandef: the chandef to use10202*10203* Return: the chandefs ending frequency in KHz10204*/10205static inline u3210206cfg80211_s1g_get_end_freq_khz(const struct cfg80211_chan_def *chandef)10207{10208u32 bw_mhz = cfg80211_chandef_get_width(chandef);10209u32 center_khz =10210MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;10211return center_khz + bw_mhz * 500 - 500;10212}1021310214/**10215* cfg80211_s1g_get_primary_sibling - retrieve the sibling 1MHz subchannel10216* for an S1G chandef using a 2MHz primary channel.10217* @wiphy: wiphy the channel belongs to10218* @chandef: the chandef to use10219*10220* When chandef::s1g_primary_2mhz is set to true, we are operating on a 2MHz10221* primary channel. The 1MHz subchannel designated by the primary channel10222* location exists within chandef::chan, whilst the 'sibling' is denoted as10223* being the other 1MHz subchannel that make up the 2MHz primary channel.10224*10225* Returns: the sibling 1MHz &struct ieee80211_channel, or %NULL on failure.10226*/10227static inline struct ieee80211_channel *10228cfg80211_s1g_get_primary_sibling(struct wiphy *wiphy,10229const struct cfg80211_chan_def *chandef)10230{10231int width_mhz = cfg80211_chandef_get_width(chandef);10232u32 pri_1mhz_khz, sibling_1mhz_khz, op_low_1mhz_khz, pri_index;1023310234if (!chandef->s1g_primary_2mhz || width_mhz < 2)10235return NULL;1023610237pri_1mhz_khz = ieee80211_channel_to_khz(chandef->chan);10238op_low_1mhz_khz = cfg80211_s1g_get_start_freq_khz(chandef);1023910240/*10241* Compute the index of the primary 1 MHz subchannel within the10242* operating channel, relative to the lowest 1 MHz center frequency.10243* Flip the least significant bit to select the even/odd sibling,10244* then translate that index back into a channel frequency.10245*/10246pri_index = (pri_1mhz_khz - op_low_1mhz_khz) / 1000;10247sibling_1mhz_khz = op_low_1mhz_khz + ((pri_index ^ 1) * 1000);1024810249return ieee80211_get_channel_khz(wiphy, sibling_1mhz_khz);10250}1025110252#endif /* __NET_CFG80211_H */102531025410255