]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blame - include/net/cfg80211.h
Merge tag 'devicetree-for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git...
[mirror_ubuntu-jammy-kernel.git] / include / net / cfg80211.h
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
704232c2
JB
2#ifndef __NET_CFG80211_H
3#define __NET_CFG80211_H
d3236553
JB
4/*
5 * 802.11 device and configuration interface
6 *
026331c4 7 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
2740f0cf 8 * Copyright 2013-2014 Intel Mobile Communications GmbH
8585989d 9 * Copyright 2015-2017 Intel Deutschland GmbH
7e8d6f12 10 * Copyright (C) 2018-2020 Intel Corporation
d3236553 11 */
704232c2 12
cc69837f 13#include <linux/ethtool.h>
d3236553
JB
14#include <linux/netdevice.h>
15#include <linux/debugfs.h>
16#include <linux/list.h>
187f1882 17#include <linux/bug.h>
704232c2
JB
18#include <linux/netlink.h>
19#include <linux/skbuff.h>
55682965 20#include <linux/nl80211.h>
2a519311
JB
21#include <linux/if_ether.h>
22#include <linux/ieee80211.h>
2a0e047e 23#include <linux/net.h>
d3236553
JB
24#include <net/regulatory.h>
25
d70e9693
JB
26/**
27 * DOC: Introduction
28 *
29 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
30 * userspace and drivers, and offers some utility functionality associated
31 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
32 * by all modern wireless drivers in Linux, so that they offer a consistent
33 * API through nl80211. For backward compatibility, cfg80211 also offers
34 * wireless extensions to userspace, but hides them from drivers completely.
35 *
36 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
37 * use restrictions.
38 */
39
40
41/**
42 * DOC: Device registration
43 *
44 * In order for a driver to use cfg80211, it must register the hardware device
45 * with cfg80211. This happens through a number of hardware capability structs
46 * described below.
47 *
48 * The fundamental structure for each device is the 'wiphy', of which each
49 * instance describes a physical wireless device connected to the system. Each
50 * such wiphy can have zero, one, or many virtual interfaces associated with
51 * it, which need to be identified as such by pointing the network interface's
52 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
53 * the wireless part of the interface, normally this struct is embedded in the
54 * network interface's private data area. Drivers can optionally allow creating
55 * or destroying virtual interfaces on the fly, but without at least one or the
56 * ability to create some the wireless device isn't useful.
57 *
58 * Each wiphy structure contains device capability information, and also has
59 * a pointer to the various operations the driver offers. The definitions and
60 * structures here describe these capabilities in detail.
61 */
62
9f5e8f6e
JB
63struct wiphy;
64
704232c2 65/*
d3236553
JB
66 * wireless hardware capability structures
67 */
68
2ec600d6 69/**
d3236553
JB
70 * enum ieee80211_channel_flags - channel flags
71 *
72 * Channel flags set by the regulatory control code.
73 *
74 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
8fe02e16 75 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
cd9b52bf 76 * sending probe requests or beaconing.
d3236553 77 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
689da1b3 78 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
cd9b52bf 79 * is not permitted.
689da1b3 80 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
cd9b52bf 81 * is not permitted.
03f6b084 82 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
c7a6ee27
JB
83 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
84 * this flag indicates that an 80 MHz channel cannot use this
85 * channel as the control or any of the secondary channels.
86 * This may be due to the driver or due to regulatory bandwidth
87 * restrictions.
88 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
89 * this flag indicates that an 160 MHz channel cannot use this
90 * channel as the control or any of the secondary channels.
91 * This may be due to the driver or due to regulatory bandwidth
92 * restrictions.
570dbde1 93 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
06f207fc 94 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
ea077c1c
RL
95 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
96 * on this channel.
97 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
98 * on this channel.
1e61d82c 99 * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
d65a9770
TP
100 * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
101 * on this channel.
102 * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
103 * on this channel.
104 * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
105 * on this channel.
106 * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
107 * on this channel.
108 * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
109 * on this channel.
570dbde1 110 *
2ec600d6 111 */
d3236553
JB
112enum ieee80211_channel_flags {
113 IEEE80211_CHAN_DISABLED = 1<<0,
8fe02e16
LR
114 IEEE80211_CHAN_NO_IR = 1<<1,
115 /* hole at 1<<2 */
d3236553 116 IEEE80211_CHAN_RADAR = 1<<3,
689da1b3
LR
117 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
118 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
03f6b084 119 IEEE80211_CHAN_NO_OFDM = 1<<6,
c7a6ee27
JB
120 IEEE80211_CHAN_NO_80MHZ = 1<<7,
121 IEEE80211_CHAN_NO_160MHZ = 1<<8,
570dbde1 122 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
06f207fc 123 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
ea077c1c
RL
124 IEEE80211_CHAN_NO_20MHZ = 1<<11,
125 IEEE80211_CHAN_NO_10MHZ = 1<<12,
1e61d82c 126 IEEE80211_CHAN_NO_HE = 1<<13,
d65a9770
TP
127 IEEE80211_CHAN_1MHZ = 1<<14,
128 IEEE80211_CHAN_2MHZ = 1<<15,
129 IEEE80211_CHAN_4MHZ = 1<<16,
130 IEEE80211_CHAN_8MHZ = 1<<17,
131 IEEE80211_CHAN_16MHZ = 1<<18,
2ec600d6
LCC
132};
133
038659e7 134#define IEEE80211_CHAN_NO_HT40 \
689da1b3 135 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
038659e7 136
04f39047
SW
137#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
138#define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
139
d3236553
JB
140/**
141 * struct ieee80211_channel - channel definition
142 *
143 * This structure describes a single channel for use
144 * with cfg80211.
145 *
146 * @center_freq: center frequency in MHz
934f4c7d 147 * @freq_offset: offset from @center_freq, in KHz
d3236553
JB
148 * @hw_value: hardware-specific value for the channel
149 * @flags: channel flags from &enum ieee80211_channel_flags.
150 * @orig_flags: channel flags at registration time, used by regulatory
151 * code to support devices with additional restrictions
152 * @band: band this channel belongs to.
153 * @max_antenna_gain: maximum antenna gain in dBi
154 * @max_power: maximum transmission power (in dBm)
eccc068e 155 * @max_reg_power: maximum regulatory transmission power (in dBm)
d3236553
JB
156 * @beacon_found: helper to regulatory code to indicate when a beacon
157 * has been found on this channel. Use regulatory_hint_found_beacon()
77c2061d 158 * to enable this, this is useful only on 5 GHz band.
d3236553
JB
159 * @orig_mag: internal use
160 * @orig_mpwr: internal use
04f39047
SW
161 * @dfs_state: current state of this channel. Only relevant if radar is required
162 * on this channel.
163 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
089027e5 164 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
179f831b 165 */
d3236553 166struct ieee80211_channel {
57fbcce3 167 enum nl80211_band band;
9cf0a0b4 168 u32 center_freq;
934f4c7d 169 u16 freq_offset;
d3236553
JB
170 u16 hw_value;
171 u32 flags;
172 int max_antenna_gain;
173 int max_power;
eccc068e 174 int max_reg_power;
d3236553
JB
175 bool beacon_found;
176 u32 orig_flags;
177 int orig_mag, orig_mpwr;
04f39047
SW
178 enum nl80211_dfs_state dfs_state;
179 unsigned long dfs_state_entered;
089027e5 180 unsigned int dfs_cac_ms;
d3236553
JB
181};
182
179f831b 183/**
d3236553
JB
184 * enum ieee80211_rate_flags - rate flags
185 *
186 * Hardware/specification flags for rates. These are structured
187 * in a way that allows using the same bitrate structure for
188 * different bands/PHY modes.
189 *
190 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
191 * preamble on this bitrate; only relevant in 2.4GHz band and
192 * with CCK rates.
193 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
194 * when used with 802.11a (on the 5 GHz band); filled by the
195 * core code when registering the wiphy.
196 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
197 * when used with 802.11b (on the 2.4 GHz band); filled by the
198 * core code when registering the wiphy.
199 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
200 * when used with 802.11g (on the 2.4 GHz band); filled by the
201 * core code when registering the wiphy.
202 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
30e74732
SW
203 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
204 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
179f831b 205 */
d3236553
JB
206enum ieee80211_rate_flags {
207 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
208 IEEE80211_RATE_MANDATORY_A = 1<<1,
209 IEEE80211_RATE_MANDATORY_B = 1<<2,
210 IEEE80211_RATE_MANDATORY_G = 1<<3,
211 IEEE80211_RATE_ERP_G = 1<<4,
30e74732
SW
212 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
213 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
d3236553 214};
179f831b 215
6eb18137
DL
216/**
217 * enum ieee80211_bss_type - BSS type filter
218 *
219 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
220 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
221 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
222 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
223 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
224 */
225enum ieee80211_bss_type {
226 IEEE80211_BSS_TYPE_ESS,
227 IEEE80211_BSS_TYPE_PBSS,
228 IEEE80211_BSS_TYPE_IBSS,
229 IEEE80211_BSS_TYPE_MBSS,
230 IEEE80211_BSS_TYPE_ANY
231};
232
233/**
234 * enum ieee80211_privacy - BSS privacy filter
235 *
236 * @IEEE80211_PRIVACY_ON: privacy bit set
237 * @IEEE80211_PRIVACY_OFF: privacy bit clear
238 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
239 */
240enum ieee80211_privacy {
241 IEEE80211_PRIVACY_ON,
242 IEEE80211_PRIVACY_OFF,
243 IEEE80211_PRIVACY_ANY
244};
245
246#define IEEE80211_PRIVACY(x) \
247 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
248
d3236553
JB
249/**
250 * struct ieee80211_rate - bitrate definition
251 *
252 * This structure describes a bitrate that an 802.11 PHY can
253 * operate with. The two values @hw_value and @hw_value_short
254 * are only for driver use when pointers to this structure are
255 * passed around.
256 *
257 * @flags: rate-specific flags
258 * @bitrate: bitrate in units of 100 Kbps
259 * @hw_value: driver/hardware value for this rate
260 * @hw_value_short: driver/hardware value for this rate when
261 * short preamble is used
262 */
263struct ieee80211_rate {
264 u32 flags;
265 u16 bitrate;
266 u16 hw_value, hw_value_short;
267};
179f831b 268
796e90f4
JC
269/**
270 * struct ieee80211_he_obss_pd - AP settings for spatial reuse
271 *
272 * @enable: is the feature enabled.
f5bec330
RM
273 * @sr_ctrl: The SR Control field of SRP element.
274 * @non_srg_max_offset: non-SRG maximum tx power offset
796e90f4
JC
275 * @min_offset: minimal tx power offset an associated station shall use
276 * @max_offset: maximum tx power offset an associated station shall use
f5bec330
RM
277 * @bss_color_bitmap: bitmap that indicates the BSS color values used by
278 * members of the SRG
279 * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
280 * used by members of the SRG
796e90f4
JC
281 */
282struct ieee80211_he_obss_pd {
283 bool enable;
f5bec330
RM
284 u8 sr_ctrl;
285 u8 non_srg_max_offset;
796e90f4
JC
286 u8 min_offset;
287 u8 max_offset;
f5bec330
RM
288 u8 bss_color_bitmap[8];
289 u8 partial_bssid_bitmap[8];
796e90f4
JC
290};
291
5c5e52d1
JC
292/**
293 * struct cfg80211_he_bss_color - AP settings for BSS coloring
294 *
295 * @color: the current color.
75e6b594 296 * @enabled: HE BSS color is used
5c5e52d1
JC
297 * @partial: define the AID equation.
298 */
299struct cfg80211_he_bss_color {
300 u8 color;
75e6b594 301 bool enabled;
5c5e52d1
JC
302 bool partial;
303};
304
d3236553
JB
305/**
306 * struct ieee80211_sta_ht_cap - STA's HT capabilities
307 *
308 * This structure describes most essential parameters needed
309 * to describe 802.11n HT capabilities for an STA.
310 *
311 * @ht_supported: is HT supported by the STA
312 * @cap: HT capabilities map as described in 802.11n spec
313 * @ampdu_factor: Maximum A-MPDU length factor
314 * @ampdu_density: Minimum A-MPDU spacing
315 * @mcs: Supported MCS rates
316 */
317struct ieee80211_sta_ht_cap {
318 u16 cap; /* use IEEE80211_HT_CAP_ */
319 bool ht_supported;
320 u8 ampdu_factor;
321 u8 ampdu_density;
322 struct ieee80211_mcs_info mcs;
179f831b
AG
323};
324
bf0c111e
MP
325/**
326 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
327 *
328 * This structure describes most essential parameters needed
329 * to describe 802.11ac VHT capabilities for an STA.
330 *
331 * @vht_supported: is VHT supported by the STA
332 * @cap: VHT capabilities map as described in 802.11ac spec
333 * @vht_mcs: Supported VHT MCS rates
334 */
335struct ieee80211_sta_vht_cap {
336 bool vht_supported;
337 u32 cap; /* use IEEE80211_VHT_CAP_ */
338 struct ieee80211_vht_mcs_info vht_mcs;
339};
340
c4cbaf79
LC
341#define IEEE80211_HE_PPE_THRES_MAX_LEN 25
342
343/**
344 * struct ieee80211_sta_he_cap - STA's HE capabilities
345 *
346 * This structure describes most essential parameters needed
347 * to describe 802.11ax HE capabilities for a STA.
348 *
349 * @has_he: true iff HE data is valid.
350 * @he_cap_elem: Fixed portion of the HE capabilities element.
351 * @he_mcs_nss_supp: The supported NSS/MCS combinations.
352 * @ppe_thres: Holds the PPE Thresholds data.
353 */
354struct ieee80211_sta_he_cap {
355 bool has_he;
356 struct ieee80211_he_cap_elem he_cap_elem;
357 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
358 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
359};
360
361/**
362 * struct ieee80211_sband_iftype_data
363 *
364 * This structure encapsulates sband data that is relevant for the
365 * interface types defined in @types_mask. Each type in the
366 * @types_mask must be unique across all instances of iftype_data.
367 *
368 * @types_mask: interface types mask
369 * @he_cap: holds the HE capabilities
22395217
JB
370 * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
371 * 6 GHz band channel (and 0 may be valid value).
c4cbaf79
LC
372 */
373struct ieee80211_sband_iftype_data {
374 u16 types_mask;
375 struct ieee80211_sta_he_cap he_cap;
22395217 376 struct ieee80211_he_6ghz_capa he_6ghz_capa;
c4cbaf79
LC
377};
378
2a38075c
AAL
379/**
380 * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
381 *
382 * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
383 * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
384 * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
385 * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
386 * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
387 * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
388 * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
389 * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
390 * 2.16GHz+2.16GHz
391 * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
392 * 4.32GHz + 4.32GHz
393 * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
394 * 4.32GHz + 4.32GHz
395 * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
396 * and 4.32GHz + 4.32GHz
397 * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
398 * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
399 */
400enum ieee80211_edmg_bw_config {
401 IEEE80211_EDMG_BW_CONFIG_4 = 4,
402 IEEE80211_EDMG_BW_CONFIG_5 = 5,
403 IEEE80211_EDMG_BW_CONFIG_6 = 6,
404 IEEE80211_EDMG_BW_CONFIG_7 = 7,
405 IEEE80211_EDMG_BW_CONFIG_8 = 8,
406 IEEE80211_EDMG_BW_CONFIG_9 = 9,
407 IEEE80211_EDMG_BW_CONFIG_10 = 10,
408 IEEE80211_EDMG_BW_CONFIG_11 = 11,
409 IEEE80211_EDMG_BW_CONFIG_12 = 12,
410 IEEE80211_EDMG_BW_CONFIG_13 = 13,
411 IEEE80211_EDMG_BW_CONFIG_14 = 14,
412 IEEE80211_EDMG_BW_CONFIG_15 = 15,
413};
414
415/**
416 * struct ieee80211_edmg - EDMG configuration
417 *
418 * This structure describes most essential parameters needed
419 * to describe 802.11ay EDMG configuration
420 *
421 * @channels: bitmap that indicates the 2.16 GHz channel(s)
422 * that are allowed to be used for transmissions.
423 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
424 * Set to 0 indicate EDMG not supported.
425 * @bw_config: Channel BW Configuration subfield encodes
426 * the allowed channel bandwidth configurations
427 */
428struct ieee80211_edmg {
429 u8 channels;
430 enum ieee80211_edmg_bw_config bw_config;
431};
432
df78a0c0
TP
433/**
434 * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
435 *
436 * This structure describes most essential parameters needed
437 * to describe 802.11ah S1G capabilities for a STA.
438 *
439 * @s1g_supported: is STA an S1G STA
440 * @cap: S1G capabilities information
441 * @nss_mcs: Supported NSS MCS set
442 */
443struct ieee80211_sta_s1g_cap {
444 bool s1g;
445 u8 cap[10]; /* use S1G_CAPAB_ */
446 u8 nss_mcs[5];
447};
448
d3236553
JB
449/**
450 * struct ieee80211_supported_band - frequency band definition
451 *
452 * This structure describes a frequency band a wiphy
453 * is able to operate in.
454 *
085a6c10 455 * @channels: Array of channels the hardware can operate with
d3236553
JB
456 * in this band.
457 * @band: the band this structure represents
458 * @n_channels: Number of channels in @channels
459 * @bitrates: Array of bitrates the hardware can operate with
460 * in this band. Must be sorted to give a valid "supported
461 * rates" IE, i.e. CCK rates first, then OFDM.
462 * @n_bitrates: Number of bitrates in @bitrates
abe37c4b 463 * @ht_cap: HT capabilities in this band
c9a0a302 464 * @vht_cap: VHT capabilities in this band
8a50c057 465 * @s1g_cap: S1G capabilities in this band
2a38075c 466 * @edmg_cap: EDMG capabilities in this band
9ff167e1 467 * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
c4cbaf79
LC
468 * @n_iftype_data: number of iftype data entries
469 * @iftype_data: interface type data entries. Note that the bits in
470 * @types_mask inside this structure cannot overlap (i.e. only
471 * one occurrence of each type is allowed across all instances of
472 * iftype_data).
d3236553
JB
473 */
474struct ieee80211_supported_band {
475 struct ieee80211_channel *channels;
476 struct ieee80211_rate *bitrates;
57fbcce3 477 enum nl80211_band band;
d3236553
JB
478 int n_channels;
479 int n_bitrates;
480 struct ieee80211_sta_ht_cap ht_cap;
bf0c111e 481 struct ieee80211_sta_vht_cap vht_cap;
df78a0c0 482 struct ieee80211_sta_s1g_cap s1g_cap;
2a38075c 483 struct ieee80211_edmg edmg_cap;
c4cbaf79
LC
484 u16 n_iftype_data;
485 const struct ieee80211_sband_iftype_data *iftype_data;
d3236553 486};
179f831b 487
c4cbaf79
LC
488/**
489 * ieee80211_get_sband_iftype_data - return sband data for a given iftype
490 * @sband: the sband to search for the STA on
491 * @iftype: enum nl80211_iftype
492 *
493 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
494 */
495static inline const struct ieee80211_sband_iftype_data *
496ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
497 u8 iftype)
498{
499 int i;
500
501 if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
502 return NULL;
503
504 for (i = 0; i < sband->n_iftype_data; i++) {
505 const struct ieee80211_sband_iftype_data *data =
506 &sband->iftype_data[i];
507
508 if (data->types_mask & BIT(iftype))
509 return data;
510 }
511
512 return NULL;
513}
514
515/**
d7edf40c
JC
516 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
517 * @sband: the sband to search for the iftype on
518 * @iftype: enum nl80211_iftype
c4cbaf79
LC
519 *
520 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
521 */
522static inline const struct ieee80211_sta_he_cap *
d7edf40c
JC
523ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
524 u8 iftype)
c4cbaf79
LC
525{
526 const struct ieee80211_sband_iftype_data *data =
d7edf40c 527 ieee80211_get_sband_iftype_data(sband, iftype);
c4cbaf79
LC
528
529 if (data && data->he_cap.has_he)
530 return &data->he_cap;
531
532 return NULL;
533}
534
d7edf40c
JC
535/**
536 * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
537 * @sband: the sband to search for the STA on
538 *
539 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
540 */
541static inline const struct ieee80211_sta_he_cap *
542ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
543{
544 return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
545}
546
2ad2274c
IP
547/**
548 * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
549 * @sband: the sband to search for the STA on
550 * @iftype: the iftype to search for
551 *
552 * Return: the 6GHz capabilities
553 */
554static inline __le16
555ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
556 enum nl80211_iftype iftype)
557{
558 const struct ieee80211_sband_iftype_data *data =
559 ieee80211_get_sband_iftype_data(sband, iftype);
560
561 if (WARN_ON(!data || !data->he_cap.has_he))
562 return 0;
563
564 return data->he_6ghz_capa.capa;
565}
566
e691ac2f
RM
567/**
568 * wiphy_read_of_freq_limits - read frequency limits from device tree
569 *
570 * @wiphy: the wireless device to get extra limits for
571 *
572 * Some devices may have extra limitations specified in DT. This may be useful
573 * for chipsets that normally support more bands but are limited due to board
574 * design (e.g. by antennas or external power amplifier).
575 *
576 * This function reads info from DT and uses it to *modify* channels (disable
577 * unavailable ones). It's usually a *bad* idea to use it in drivers with
578 * shared channel data as DT limitations are device specific. You should make
579 * sure to call it only if channels in wiphy are copied and can be modified
580 * without affecting other devices.
581 *
582 * As this function access device node it has to be called after set_wiphy_dev.
583 * It also modifies channels so they have to be set first.
584 * If using this helper, call it before wiphy_register().
585 */
586#ifdef CONFIG_OF
587void wiphy_read_of_freq_limits(struct wiphy *wiphy);
588#else /* CONFIG_OF */
589static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
590{
591}
592#endif /* !CONFIG_OF */
593
594
d3236553
JB
595/*
596 * Wireless hardware/device configuration structures and methods
597 */
179f831b 598
d70e9693
JB
599/**
600 * DOC: Actions and configuration
601 *
602 * Each wireless device and each virtual interface offer a set of configuration
603 * operations and other actions that are invoked by userspace. Each of these
604 * actions is described in the operations structure, and the parameters these
605 * operations use are described separately.
606 *
607 * Additionally, some operations are asynchronous and expect to get status
608 * information via some functions that drivers need to call.
609 *
610 * Scanning and BSS list handling with its associated functionality is described
611 * in a separate chapter.
612 */
613
c6e6a0c8
AE
614#define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
615 WLAN_USER_POSITION_LEN)
616
d3236553
JB
617/**
618 * struct vif_params - describes virtual interface parameters
818a986e
JB
619 * @flags: monitor interface flags, unchanged if 0, otherwise
620 * %MONITOR_FLAG_CHANGED will be set
8b787643 621 * @use_4addr: use 4-address frames
e8f479b1
BG
622 * @macaddr: address to use for this virtual interface.
623 * If this parameter is set to zero address the driver may
624 * determine the address as needed.
625 * This feature is only fully supported by drivers that enable the
626 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
627 ** only p2p devices with specified MAC.
b0265024
JB
628 * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
629 * belonging to that MU-MIMO groupID; %NULL if not changed
630 * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
631 * MU-MIMO packets going to the specified station; %NULL if not changed
d3236553
JB
632 */
633struct vif_params {
818a986e 634 u32 flags;
c6e6a0c8
AE
635 int use_4addr;
636 u8 macaddr[ETH_ALEN];
b0265024
JB
637 const u8 *vht_mumimo_groups;
638 const u8 *vht_mumimo_follow_addr;
d3236553 639};
179f831b 640
d3236553 641/**
41ade00f
JB
642 * struct key_params - key information
643 *
644 * Information about a key
645 *
646 * @key: key material
647 * @key_len: length of key material
648 * @cipher: cipher suite selector
649 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
650 * with the get_key() callback, must be in little endian,
651 * length given by @seq_len.
abe37c4b 652 * @seq_len: length of @seq.
14f34e36 653 * @vlan_id: vlan_id for VLAN group key (if nonzero)
6cdd3979 654 * @mode: key install mode (RX_TX, NO_TX or SET_TX)
41ade00f
JB
655 */
656struct key_params {
c1e5f471
JB
657 const u8 *key;
658 const u8 *seq;
41ade00f
JB
659 int key_len;
660 int seq_len;
14f34e36 661 u16 vlan_id;
41ade00f 662 u32 cipher;
6cdd3979 663 enum nl80211_key_mode mode;
41ade00f
JB
664};
665
683b6d3b
JB
666/**
667 * struct cfg80211_chan_def - channel definition
668 * @chan: the (control) channel
3d9d1d66
JB
669 * @width: channel width
670 * @center_freq1: center frequency of first segment
671 * @center_freq2: center frequency of second segment
672 * (only with 80+80 MHz)
2a38075c
AAL
673 * @edmg: define the EDMG channels configuration.
674 * If edmg is requested (i.e. the .channels member is non-zero),
675 * chan will define the primary channel and all other
676 * parameters are ignored.
934f4c7d 677 * @freq1_offset: offset from @center_freq1, in KHz
683b6d3b
JB
678 */
679struct cfg80211_chan_def {
680 struct ieee80211_channel *chan;
3d9d1d66
JB
681 enum nl80211_chan_width width;
682 u32 center_freq1;
683 u32 center_freq2;
2a38075c 684 struct ieee80211_edmg edmg;
934f4c7d 685 u16 freq1_offset;
683b6d3b
JB
686};
687
9a5f6488
TC
688/*
689 * cfg80211_bitrate_mask - masks for bitrate control
690 */
691struct cfg80211_bitrate_mask {
692 struct {
693 u32 legacy;
694 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
695 u16 vht_mcs[NL80211_VHT_NSS_MAX];
eb89a6a6 696 u16 he_mcs[NL80211_HE_NSS_MAX];
9a5f6488 697 enum nl80211_txrate_gi gi;
eb89a6a6
MH
698 enum nl80211_he_gi he_gi;
699 enum nl80211_he_ltf he_ltf;
9a5f6488
TC
700 } control[NUM_NL80211_BANDS];
701};
702
703
77f576de 704/**
3710a8a6 705 * struct cfg80211_tid_cfg - TID specific configuration
77f576de
T
706 * @config_override: Flag to notify driver to reset TID configuration
707 * of the peer.
3710a8a6
JB
708 * @tids: bitmap of TIDs to modify
709 * @mask: bitmap of attributes indicating which parameter changed,
710 * similar to &nl80211_tid_config_supp.
77f576de 711 * @noack: noack configuration value for the TID
6a21d16c
T
712 * @retry_long: retry count value
713 * @retry_short: retry count value
33462e68 714 * @ampdu: Enable/Disable MPDU aggregation
04f7d142 715 * @rtscts: Enable/Disable RTS/CTS
33462e68 716 * @amsdu: Enable/Disable MSDU aggregation
9a5f6488
TC
717 * @txrate_type: Tx bitrate mask type
718 * @txrate_mask: Tx bitrate to be applied for the TID
77f576de 719 */
3710a8a6 720struct cfg80211_tid_cfg {
77f576de 721 bool config_override;
3710a8a6 722 u8 tids;
2d5d9b7f 723 u64 mask;
77f576de 724 enum nl80211_tid_config noack;
6a21d16c 725 u8 retry_long, retry_short;
ade274b2 726 enum nl80211_tid_config ampdu;
04f7d142 727 enum nl80211_tid_config rtscts;
33462e68 728 enum nl80211_tid_config amsdu;
9a5f6488
TC
729 enum nl80211_tx_rate_setting txrate_type;
730 struct cfg80211_bitrate_mask txrate_mask;
77f576de
T
731};
732
733/**
3710a8a6 734 * struct cfg80211_tid_config - TID configuration
77f576de
T
735 * @peer: Station's MAC address
736 * @n_tid_conf: Number of TID specific configurations to be applied
737 * @tid_conf: Configuration change info
738 */
3710a8a6 739struct cfg80211_tid_config {
77f576de
T
740 const u8 *peer;
741 u32 n_tid_conf;
3710a8a6 742 struct cfg80211_tid_cfg tid_conf[];
77f576de
T
743};
744
3d9d1d66
JB
745/**
746 * cfg80211_get_chandef_type - return old channel type from chandef
747 * @chandef: the channel definition
748 *
0ae997dc 749 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
3d9d1d66
JB
750 * chandef, which must have a bandwidth allowing this conversion.
751 */
683b6d3b
JB
752static inline enum nl80211_channel_type
753cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
754{
3d9d1d66
JB
755 switch (chandef->width) {
756 case NL80211_CHAN_WIDTH_20_NOHT:
757 return NL80211_CHAN_NO_HT;
758 case NL80211_CHAN_WIDTH_20:
759 return NL80211_CHAN_HT20;
760 case NL80211_CHAN_WIDTH_40:
761 if (chandef->center_freq1 > chandef->chan->center_freq)
762 return NL80211_CHAN_HT40PLUS;
763 return NL80211_CHAN_HT40MINUS;
764 default:
765 WARN_ON(1);
766 return NL80211_CHAN_NO_HT;
767 }
683b6d3b
JB
768}
769
3d9d1d66
JB
770/**
771 * cfg80211_chandef_create - create channel definition using channel type
772 * @chandef: the channel definition struct to fill
773 * @channel: the control channel
774 * @chantype: the channel type
775 *
776 * Given a channel type, create a channel definition.
777 */
778void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
779 struct ieee80211_channel *channel,
780 enum nl80211_channel_type chantype);
781
782/**
783 * cfg80211_chandef_identical - check if two channel definitions are identical
784 * @chandef1: first channel definition
785 * @chandef2: second channel definition
786 *
0ae997dc 787 * Return: %true if the channels defined by the channel definitions are
3d9d1d66
JB
788 * identical, %false otherwise.
789 */
790static inline bool
791cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
792 const struct cfg80211_chan_def *chandef2)
793{
794 return (chandef1->chan == chandef2->chan &&
795 chandef1->width == chandef2->width &&
796 chandef1->center_freq1 == chandef2->center_freq1 &&
934f4c7d 797 chandef1->freq1_offset == chandef2->freq1_offset &&
3d9d1d66
JB
798 chandef1->center_freq2 == chandef2->center_freq2);
799}
800
2a38075c
AAL
801/**
802 * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
803 *
804 * @chandef: the channel definition
805 *
806 * Return: %true if EDMG defined, %false otherwise.
807 */
808static inline bool
809cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
810{
811 return chandef->edmg.channels || chandef->edmg.bw_config;
812}
813
3d9d1d66
JB
814/**
815 * cfg80211_chandef_compatible - check if two channel definitions are compatible
816 * @chandef1: first channel definition
817 * @chandef2: second channel definition
818 *
0ae997dc 819 * Return: %NULL if the given channel definitions are incompatible,
3d9d1d66
JB
820 * chandef1 or chandef2 otherwise.
821 */
822const struct cfg80211_chan_def *
823cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
824 const struct cfg80211_chan_def *chandef2);
825
9f5e8f6e
JB
826/**
827 * cfg80211_chandef_valid - check if a channel definition is valid
828 * @chandef: the channel definition to check
0ae997dc 829 * Return: %true if the channel definition is valid. %false otherwise.
9f5e8f6e
JB
830 */
831bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
832
833/**
834 * cfg80211_chandef_usable - check if secondary channels can be used
835 * @wiphy: the wiphy to validate against
836 * @chandef: the channel definition to check
0ae997dc
YB
837 * @prohibited_flags: the regulatory channel flags that must not be set
838 * Return: %true if secondary channels are usable. %false otherwise.
9f5e8f6e
JB
839 */
840bool cfg80211_chandef_usable(struct wiphy *wiphy,
841 const struct cfg80211_chan_def *chandef,
842 u32 prohibited_flags);
843
774f0734
SW
844/**
845 * cfg80211_chandef_dfs_required - checks if radar detection is required
846 * @wiphy: the wiphy to validate against
847 * @chandef: the channel definition to check
2beb6dab
LC
848 * @iftype: the interface type as specified in &enum nl80211_iftype
849 * Returns:
850 * 1 if radar detection is required, 0 if it is not, < 0 on error
774f0734
SW
851 */
852int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
2beb6dab 853 const struct cfg80211_chan_def *chandef,
c3d62036 854 enum nl80211_iftype iftype);
774f0734 855
30e74732
SW
856/**
857 * ieee80211_chandef_rate_flags - returns rate flags for a channel
858 *
859 * In some channel types, not all rates may be used - for example CCK
860 * rates may not be used in 5/10 MHz channels.
861 *
862 * @chandef: channel definition for the channel
863 *
864 * Returns: rate flags which apply for this channel
865 */
866static inline enum ieee80211_rate_flags
867ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
868{
869 switch (chandef->width) {
870 case NL80211_CHAN_WIDTH_5:
871 return IEEE80211_RATE_SUPPORTS_5MHZ;
872 case NL80211_CHAN_WIDTH_10:
873 return IEEE80211_RATE_SUPPORTS_10MHZ;
874 default:
875 break;
876 }
877 return 0;
878}
879
0430c883
SW
880/**
881 * ieee80211_chandef_max_power - maximum transmission power for the chandef
882 *
883 * In some regulations, the transmit power may depend on the configured channel
884 * bandwidth which may be defined as dBm/MHz. This function returns the actual
885 * max_power for non-standard (20 MHz) channels.
886 *
887 * @chandef: channel definition for the channel
888 *
889 * Returns: maximum allowed transmission power in dBm for the chandef
890 */
891static inline int
892ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
893{
894 switch (chandef->width) {
895 case NL80211_CHAN_WIDTH_5:
896 return min(chandef->chan->max_reg_power - 6,
897 chandef->chan->max_power);
898 case NL80211_CHAN_WIDTH_10:
899 return min(chandef->chan->max_reg_power - 3,
900 chandef->chan->max_power);
901 default:
902 break;
903 }
904 return chandef->chan->max_power;
905}
906
61fa713c
HS
907/**
908 * enum survey_info_flags - survey information flags
909 *
abe37c4b 910 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
17e5a808 911 * @SURVEY_INFO_IN_USE: channel is currently being used
4ed20beb
JB
912 * @SURVEY_INFO_TIME: active time (in ms) was filled in
913 * @SURVEY_INFO_TIME_BUSY: busy time was filled in
914 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
915 * @SURVEY_INFO_TIME_RX: receive time was filled in
916 * @SURVEY_INFO_TIME_TX: transmit time was filled in
052536ab 917 * @SURVEY_INFO_TIME_SCAN: scan time was filled in
c8cd6e7f 918 * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
abe37c4b 919 *
61fa713c
HS
920 * Used by the driver to indicate which info in &struct survey_info
921 * it has filled in during the get_survey().
922 */
923enum survey_info_flags {
4ed20beb
JB
924 SURVEY_INFO_NOISE_DBM = BIT(0),
925 SURVEY_INFO_IN_USE = BIT(1),
926 SURVEY_INFO_TIME = BIT(2),
927 SURVEY_INFO_TIME_BUSY = BIT(3),
928 SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
929 SURVEY_INFO_TIME_RX = BIT(5),
930 SURVEY_INFO_TIME_TX = BIT(6),
052536ab 931 SURVEY_INFO_TIME_SCAN = BIT(7),
c8cd6e7f 932 SURVEY_INFO_TIME_BSS_RX = BIT(8),
61fa713c
HS
933};
934
935/**
936 * struct survey_info - channel survey response
937 *
11f78ac3
JB
938 * @channel: the channel this survey record reports, may be %NULL for a single
939 * record to report global statistics
61fa713c
HS
940 * @filled: bitflag of flags from &enum survey_info_flags
941 * @noise: channel noise in dBm. This and all following fields are
ad24b0da 942 * optional
4ed20beb
JB
943 * @time: amount of time in ms the radio was turn on (on the channel)
944 * @time_busy: amount of time the primary channel was sensed busy
945 * @time_ext_busy: amount of time the extension channel was sensed busy
946 * @time_rx: amount of time the radio spent receiving data
947 * @time_tx: amount of time the radio spent transmitting data
052536ab 948 * @time_scan: amount of time the radio spent for scanning
c8cd6e7f 949 * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
61fa713c 950 *
abe37c4b
JB
951 * Used by dump_survey() to report back per-channel survey information.
952 *
61fa713c
HS
953 * This structure can later be expanded with things like
954 * channel duty cycle etc.
955 */
956struct survey_info {
957 struct ieee80211_channel *channel;
4ed20beb
JB
958 u64 time;
959 u64 time_busy;
960 u64 time_ext_busy;
961 u64 time_rx;
962 u64 time_tx;
052536ab 963 u64 time_scan;
c8cd6e7f 964 u64 time_bss_rx;
61fa713c
HS
965 u32 filled;
966 s8 noise;
967};
968
b8676221
DS
969#define CFG80211_MAX_WEP_KEYS 4
970
5fb628e9
JM
971/**
972 * struct cfg80211_crypto_settings - Crypto settings
973 * @wpa_versions: indicates which, if any, WPA versions are enabled
974 * (from enum nl80211_wpa_versions)
975 * @cipher_group: group key cipher suite (or 0 if unset)
976 * @n_ciphers_pairwise: number of AP supported unicast ciphers
977 * @ciphers_pairwise: unicast key cipher suites
978 * @n_akm_suites: number of AKM suites
979 * @akm_suites: AKM suites
980 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
981 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
982 * required to assume that the port is unauthorized until authorized by
983 * user space. Otherwise, port is marked authorized by default.
984 * @control_port_ethertype: the control port protocol that should be
985 * allowed through even on unauthorized ports
986 * @control_port_no_encrypt: TRUE to prevent encryption of control port
987 * protocol frames.
64bf3d4b
DK
988 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
989 * port frames over NL80211 instead of the network interface.
a710d214
LR
990 * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
991 * port for mac80211
b8676221
DS
992 * @wep_keys: static WEP keys, if not NULL points to an array of
993 * CFG80211_MAX_WEP_KEYS WEP keys
994 * @wep_tx_key: key index (0..3) of the default TX static WEP key
91b5ab62 995 * @psk: PSK (for devices supporting 4-way-handshake offload)
26f7044e
CHH
996 * @sae_pwd: password for SAE authentication (for devices supporting SAE
997 * offload)
998 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
da1e9dd3
JB
999 * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1000 *
1001 * NL80211_SAE_PWE_UNSPECIFIED
1002 * Not-specified, used to indicate userspace did not specify any
1003 * preference. The driver should follow its internal policy in
1004 * such a scenario.
1005 *
1006 * NL80211_SAE_PWE_HUNT_AND_PECK
1007 * Allow hunting-and-pecking loop only
1008 *
1009 * NL80211_SAE_PWE_HASH_TO_ELEMENT
1010 * Allow hash-to-element only
1011 *
1012 * NL80211_SAE_PWE_BOTH
1013 * Allow either hunting-and-pecking loop or hash-to-element
5fb628e9
JM
1014 */
1015struct cfg80211_crypto_settings {
1016 u32 wpa_versions;
1017 u32 cipher_group;
1018 int n_ciphers_pairwise;
1019 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
1020 int n_akm_suites;
1021 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
1022 bool control_port;
1023 __be16 control_port_ethertype;
1024 bool control_port_no_encrypt;
64bf3d4b 1025 bool control_port_over_nl80211;
7f3f96ce 1026 bool control_port_no_preauth;
b8676221
DS
1027 struct key_params *wep_keys;
1028 int wep_tx_key;
91b5ab62 1029 const u8 *psk;
26f7044e
CHH
1030 const u8 *sae_pwd;
1031 u8 sae_pwd_len;
9f0ffa41 1032 enum nl80211_sae_pwe_mechanism sae_pwe;
5fb628e9
JM
1033};
1034
ed1b6cc7 1035/**
8860020e 1036 * struct cfg80211_beacon_data - beacon data
ed1b6cc7 1037 * @head: head portion of beacon (before TIM IE)
ad24b0da 1038 * or %NULL if not changed
ed1b6cc7 1039 * @tail: tail portion of beacon (after TIM IE)
ad24b0da 1040 * or %NULL if not changed
ed1b6cc7
JB
1041 * @head_len: length of @head
1042 * @tail_len: length of @tail
9946ecfb
JM
1043 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
1044 * @beacon_ies_len: length of beacon_ies in octets
1045 * @proberesp_ies: extra information element(s) to add into Probe Response
1046 * frames or %NULL
1047 * @proberesp_ies_len: length of proberesp_ies in octets
1048 * @assocresp_ies: extra information element(s) to add into (Re)Association
1049 * Response frames or %NULL
1050 * @assocresp_ies_len: length of assocresp_ies in octets
00f740e1
AN
1051 * @probe_resp_len: length of probe response template (@probe_resp)
1052 * @probe_resp: probe response template (AP mode only)
81e54d08
PKC
1053 * @ftm_responder: enable FTM responder functionality; -1 for no change
1054 * (which also implies no change in LCI/civic location data)
30db641e
JB
1055 * @lci: Measurement Report element content, starting with Measurement Token
1056 * (measurement type 8)
1057 * @civicloc: Measurement Report element content, starting with Measurement
1058 * Token (measurement type 11)
81e54d08
PKC
1059 * @lci_len: LCI data length
1060 * @civicloc_len: Civic location data length
ed1b6cc7 1061 */
8860020e
JB
1062struct cfg80211_beacon_data {
1063 const u8 *head, *tail;
1064 const u8 *beacon_ies;
1065 const u8 *proberesp_ies;
1066 const u8 *assocresp_ies;
1067 const u8 *probe_resp;
81e54d08
PKC
1068 const u8 *lci;
1069 const u8 *civicloc;
1070 s8 ftm_responder;
8860020e
JB
1071
1072 size_t head_len, tail_len;
1073 size_t beacon_ies_len;
1074 size_t proberesp_ies_len;
1075 size_t assocresp_ies_len;
1076 size_t probe_resp_len;
81e54d08
PKC
1077 size_t lci_len;
1078 size_t civicloc_len;
8860020e
JB
1079};
1080
6d45a74b
VT
1081struct mac_address {
1082 u8 addr[ETH_ALEN];
1083};
1084
77765eaf
VT
1085/**
1086 * struct cfg80211_acl_data - Access control list data
1087 *
1088 * @acl_policy: ACL policy to be applied on the station's
077f897a 1089 * entry specified by mac_addr
77765eaf
VT
1090 * @n_acl_entries: Number of MAC address entries passed
1091 * @mac_addrs: List of MAC addresses of stations to be used for ACL
1092 */
1093struct cfg80211_acl_data {
1094 enum nl80211_acl_policy acl_policy;
1095 int n_acl_entries;
1096
1097 /* Keep it last */
1098 struct mac_address mac_addrs[];
1099};
1100
291c49de
AD
1101/**
1102 * struct cfg80211_fils_discovery - FILS discovery parameters from
1103 * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1104 *
1105 * @min_interval: Minimum packet interval in TUs (0 - 10000)
1106 * @max_interval: Maximum packet interval in TUs (0 - 10000)
1107 * @tmpl_len: Template length
1108 * @tmpl: Template data for FILS discovery frame including the action
1109 * frame headers.
1110 */
1111struct cfg80211_fils_discovery {
1112 u32 min_interval;
1113 u32 max_interval;
1114 size_t tmpl_len;
1115 const u8 *tmpl;
1116};
1117
7443dcd1
AD
1118/**
1119 * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
1120 * response parameters in 6GHz.
1121 *
1122 * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
1123 * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
1124 * scanning
1125 * @tmpl_len: Template length
1126 * @tmpl: Template data for probe response
1127 */
1128struct cfg80211_unsol_bcast_probe_resp {
1129 u32 interval;
1130 size_t tmpl_len;
1131 const u8 *tmpl;
1132};
1133
fe494370
SD
1134/**
1135 * enum cfg80211_ap_settings_flags - AP settings flags
1136 *
1137 * Used by cfg80211_ap_settings
1138 *
1139 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1140 */
1141enum cfg80211_ap_settings_flags {
1142 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1143};
1144
8860020e
JB
1145/**
1146 * struct cfg80211_ap_settings - AP configuration
1147 *
1148 * Used to configure an AP interface.
1149 *
683b6d3b 1150 * @chandef: defines the channel to use
8860020e
JB
1151 * @beacon: beacon data
1152 * @beacon_interval: beacon interval
1153 * @dtim_period: DTIM period
1154 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
1155 * user space)
1156 * @ssid_len: length of @ssid
1157 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
1158 * @crypto: crypto settings
1159 * @privacy: the BSS uses privacy
1160 * @auth_type: Authentication type (algorithm)
18998c38 1161 * @smps_mode: SMPS mode
1b658f11 1162 * @inactivity_timeout: time in seconds to determine station's inactivity.
53cabad7
JB
1163 * @p2p_ctwindow: P2P CT Window
1164 * @p2p_opp_ps: P2P opportunistic PS
77765eaf
VT
1165 * @acl: ACL configuration used by the drivers which has support for
1166 * MAC address based access control
34d50519
LD
1167 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
1168 * networks.
8564e382 1169 * @beacon_rate: bitrate to be used for beacons
66cd794e
JB
1170 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
1171 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
244eb9ae 1172 * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
66cd794e
JB
1173 * @ht_required: stations must support HT
1174 * @vht_required: stations must support VHT
a0de1ca3 1175 * @twt_responder: Enable Target Wait Time
2a392596 1176 * @he_required: stations must support HE
d6587602 1177 * @sae_h2e_required: stations must support direct H2E technique in SAE
fe494370 1178 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
796e90f4 1179 * @he_obss_pd: OBSS Packet Detection settings
5c5e52d1 1180 * @he_bss_color: BSS Color settings
7e8d6f12 1181 * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
291c49de 1182 * @fils_discovery: FILS discovery transmission parameters
7443dcd1 1183 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
8860020e
JB
1184 */
1185struct cfg80211_ap_settings {
683b6d3b 1186 struct cfg80211_chan_def chandef;
aa430da4 1187
8860020e
JB
1188 struct cfg80211_beacon_data beacon;
1189
1190 int beacon_interval, dtim_period;
32e9de84
JM
1191 const u8 *ssid;
1192 size_t ssid_len;
1193 enum nl80211_hidden_ssid hidden_ssid;
5fb628e9
JM
1194 struct cfg80211_crypto_settings crypto;
1195 bool privacy;
1196 enum nl80211_auth_type auth_type;
18998c38 1197 enum nl80211_smps_mode smps_mode;
1b658f11 1198 int inactivity_timeout;
53cabad7
JB
1199 u8 p2p_ctwindow;
1200 bool p2p_opp_ps;
77765eaf 1201 const struct cfg80211_acl_data *acl;
34d50519 1202 bool pbss;
a7c7fbff 1203 struct cfg80211_bitrate_mask beacon_rate;
66cd794e
JB
1204
1205 const struct ieee80211_ht_cap *ht_cap;
1206 const struct ieee80211_vht_cap *vht_cap;
244eb9ae 1207 const struct ieee80211_he_cap_elem *he_cap;
7e8d6f12 1208 const struct ieee80211_he_operation *he_oper;
d6587602 1209 bool ht_required, vht_required, he_required, sae_h2e_required;
a0de1ca3 1210 bool twt_responder;
fe494370 1211 u32 flags;
796e90f4 1212 struct ieee80211_he_obss_pd he_obss_pd;
5c5e52d1 1213 struct cfg80211_he_bss_color he_bss_color;
291c49de 1214 struct cfg80211_fils_discovery fils_discovery;
7443dcd1 1215 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
ed1b6cc7
JB
1216};
1217
16ef1fe2
SW
1218/**
1219 * struct cfg80211_csa_settings - channel switch settings
1220 *
1221 * Used for channel switch
1222 *
1223 * @chandef: defines the channel to use after the switch
1224 * @beacon_csa: beacon data while performing the switch
9a774c78
AO
1225 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
1226 * @counter_offsets_presp: offsets of the counters within the probe response
1227 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
1228 * @n_counter_offsets_presp: number of csa counters in the probe response
16ef1fe2
SW
1229 * @beacon_after: beacon data to be used on the new channel
1230 * @radar_required: whether radar detection is required on the new channel
1231 * @block_tx: whether transmissions should be blocked while changing
1232 * @count: number of beacons until switch
1233 */
1234struct cfg80211_csa_settings {
1235 struct cfg80211_chan_def chandef;
1236 struct cfg80211_beacon_data beacon_csa;
9a774c78
AO
1237 const u16 *counter_offsets_beacon;
1238 const u16 *counter_offsets_presp;
1239 unsigned int n_counter_offsets_beacon;
1240 unsigned int n_counter_offsets_presp;
16ef1fe2
SW
1241 struct cfg80211_beacon_data beacon_after;
1242 bool radar_required;
1243 bool block_tx;
1244 u8 count;
1245};
1246
51a1aaa6
JB
1247#define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
1248
e227300c
PK
1249/**
1250 * struct iface_combination_params - input parameters for interface combinations
1251 *
1252 * Used to pass interface combination parameters
1253 *
1254 * @num_different_channels: the number of different channels we want
1255 * to use for verification
1256 * @radar_detect: a bitmap where each bit corresponds to a channel
1257 * width where radar detection is needed, as in the definition of
1258 * &struct ieee80211_iface_combination.@radar_detect_widths
1259 * @iftype_num: array with the number of interfaces of each interface
1260 * type. The index is the interface type as specified in &enum
1261 * nl80211_iftype.
4c8dea63
JB
1262 * @new_beacon_int: set this to the beacon interval of a new interface
1263 * that's not operating yet, if such is to be checked as part of
1264 * the verification
e227300c
PK
1265 */
1266struct iface_combination_params {
1267 int num_different_channels;
1268 u8 radar_detect;
1269 int iftype_num[NUM_NL80211_IFTYPES];
4c8dea63 1270 u32 new_beacon_int;
e227300c
PK
1271};
1272
3b9ce80c
JB
1273/**
1274 * enum station_parameters_apply_mask - station parameter values to apply
1275 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
9d62a986 1276 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
f8bacc21 1277 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
3b9ce80c
JB
1278 *
1279 * Not all station parameters have in-band "no change" signalling,
1280 * for those that don't these flags will are used.
1281 */
1282enum station_parameters_apply_mask {
1283 STATION_PARAM_APPLY_UAPSD = BIT(0),
9d62a986 1284 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
f8bacc21 1285 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
e96d1cd2
ARN
1286 STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1287};
1288
1289/**
1290 * struct sta_txpwr - station txpower configuration
1291 *
1292 * Used to configure txpower for station.
1293 *
1294 * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1295 * is not provided, the default per-interface tx power setting will be
1296 * overriding. Driver should be picking up the lowest tx power, either tx
1297 * power per-interface or per-station.
1298 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1299 * will be less than or equal to specified from userspace, whereas if TPC
1300 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1301 * NL80211_TX_POWER_FIXED is not a valid configuration option for
1302 * per peer TPC.
1303 */
1304struct sta_txpwr {
1305 s16 power;
1306 enum nl80211_tx_power_setting type;
3b9ce80c
JB
1307};
1308
5727ef1b
JB
1309/**
1310 * struct station_parameters - station parameters
1311 *
1312 * Used to change and create a new station.
1313 *
1314 * @vlan: vlan interface station should belong to
1315 * @supported_rates: supported rates in IEEE 802.11 format
1316 * (or NULL for no change)
1317 * @supported_rates_len: number of supported rates
eccb8e8f 1318 * @sta_flags_mask: station flags that changed
819bf593 1319 * (bitmask of BIT(%NL80211_STA_FLAG_...))
eccb8e8f 1320 * @sta_flags_set: station flags values
819bf593 1321 * (bitmask of BIT(%NL80211_STA_FLAG_...))
5727ef1b
JB
1322 * @listen_interval: listen interval or -1 for no change
1323 * @aid: AID or zero for no change
14f34e36 1324 * @vlan_id: VLAN ID for station (if nonzero)
7d27a0ba 1325 * @peer_aid: mesh peer AID or zero for no change
abe37c4b 1326 * @plink_action: plink action to take
9c3990aa 1327 * @plink_state: set the peer link state for a station
abe37c4b 1328 * @ht_capa: HT capabilities of station
f461be3e 1329 * @vht_capa: VHT capabilities of station
910868db
EP
1330 * @uapsd_queues: bitmap of queues configured for uapsd. same format
1331 * as the AC bitmap in the QoS info field
1332 * @max_sp: max Service Period. same format as the MAX_SP in the
1333 * QoS info field (but already shifted down)
c26887d2
JB
1334 * @sta_modify_mask: bitmap indicating which parameters changed
1335 * (for those that don't have a natural "no change" value),
1336 * see &enum station_parameters_apply_mask
3b1c5a53
MP
1337 * @local_pm: local link-specific mesh power save mode (no change when set
1338 * to unknown)
9d62a986
JM
1339 * @capability: station capability
1340 * @ext_capab: extended capabilities of the station
1341 * @ext_capab_len: number of extended capabilities
c01fc9ad
SD
1342 * @supported_channels: supported channels in IEEE 802.11 format
1343 * @supported_channels_len: number of supported channels
1344 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1345 * @supported_oper_classes_len: number of supported operating classes
60f4a7b1
MK
1346 * @opmode_notif: operating mode field from Operating Mode Notification
1347 * @opmode_notif_used: information if operating mode field is used
17b94247 1348 * @support_p2p_ps: information if station supports P2P PS mechanism
c4cbaf79
LC
1349 * @he_capa: HE capabilities of station
1350 * @he_capa_len: the length of the HE capabilities
36647055 1351 * @airtime_weight: airtime scheduler weight for this station
a710d214 1352 * @txpwr: transmit power for an associated station
43e64bf3 1353 * @he_6ghz_capa: HE 6 GHz Band capabilities of station
5727ef1b
JB
1354 */
1355struct station_parameters {
2c1aabf3 1356 const u8 *supported_rates;
5727ef1b 1357 struct net_device *vlan;
eccb8e8f 1358 u32 sta_flags_mask, sta_flags_set;
3b9ce80c 1359 u32 sta_modify_mask;
5727ef1b
JB
1360 int listen_interval;
1361 u16 aid;
14f34e36 1362 u16 vlan_id;
7d27a0ba 1363 u16 peer_aid;
5727ef1b 1364 u8 supported_rates_len;
2ec600d6 1365 u8 plink_action;
9c3990aa 1366 u8 plink_state;
2c1aabf3
JB
1367 const struct ieee80211_ht_cap *ht_capa;
1368 const struct ieee80211_vht_cap *vht_capa;
c75786c9
EP
1369 u8 uapsd_queues;
1370 u8 max_sp;
3b1c5a53 1371 enum nl80211_mesh_power_mode local_pm;
9d62a986 1372 u16 capability;
2c1aabf3 1373 const u8 *ext_capab;
9d62a986 1374 u8 ext_capab_len;
c01fc9ad
SD
1375 const u8 *supported_channels;
1376 u8 supported_channels_len;
1377 const u8 *supported_oper_classes;
1378 u8 supported_oper_classes_len;
60f4a7b1
MK
1379 u8 opmode_notif;
1380 bool opmode_notif_used;
17b94247 1381 int support_p2p_ps;
c4cbaf79
LC
1382 const struct ieee80211_he_cap_elem *he_capa;
1383 u8 he_capa_len;
36647055 1384 u16 airtime_weight;
e96d1cd2 1385 struct sta_txpwr txpwr;
43e64bf3 1386 const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
5727ef1b
JB
1387};
1388
89c771e5
JM
1389/**
1390 * struct station_del_parameters - station deletion parameters
1391 *
1392 * Used to delete a station entry (or all stations).
1393 *
1394 * @mac: MAC address of the station to remove or NULL to remove all stations
98856866
JM
1395 * @subtype: Management frame subtype to use for indicating removal
1396 * (10 = Disassociation, 12 = Deauthentication)
1397 * @reason_code: Reason code for the Disassociation/Deauthentication frame
89c771e5
JM
1398 */
1399struct station_del_parameters {
1400 const u8 *mac;
98856866
JM
1401 u8 subtype;
1402 u16 reason_code;
89c771e5
JM
1403};
1404
77ee7c89
JB
1405/**
1406 * enum cfg80211_station_type - the type of station being modified
1407 * @CFG80211_STA_AP_CLIENT: client of an AP interface
47edb11b
AB
1408 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
1409 * unassociated (update properties for this type of client is permitted)
77ee7c89
JB
1410 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
1411 * the AP MLME in the device
1412 * @CFG80211_STA_AP_STA: AP station on managed interface
1413 * @CFG80211_STA_IBSS: IBSS station
1414 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
1415 * while TDLS setup is in progress, it moves out of this state when
1416 * being marked authorized; use this only if TDLS with external setup is
1417 * supported/used)
1418 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
1419 * entry that is operating, has been marked authorized by userspace)
eef941e6
TP
1420 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1421 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
77ee7c89
JB
1422 */
1423enum cfg80211_station_type {
1424 CFG80211_STA_AP_CLIENT,
47edb11b 1425 CFG80211_STA_AP_CLIENT_UNASSOC,
77ee7c89
JB
1426 CFG80211_STA_AP_MLME_CLIENT,
1427 CFG80211_STA_AP_STA,
1428 CFG80211_STA_IBSS,
1429 CFG80211_STA_TDLS_PEER_SETUP,
1430 CFG80211_STA_TDLS_PEER_ACTIVE,
eef941e6
TP
1431 CFG80211_STA_MESH_PEER_KERNEL,
1432 CFG80211_STA_MESH_PEER_USER,
77ee7c89
JB
1433};
1434
1435/**
1436 * cfg80211_check_station_change - validate parameter changes
1437 * @wiphy: the wiphy this operates on
1438 * @params: the new parameters for a station
1439 * @statype: the type of station being modified
1440 *
1441 * Utility function for the @change_station driver method. Call this function
1442 * with the appropriate station type looking up the station (and checking that
1443 * it exists). It will verify whether the station change is acceptable, and if
1444 * not will return an error code. Note that it may modify the parameters for
1445 * backward compatibility reasons, so don't use them before calling this.
1446 */
1447int cfg80211_check_station_change(struct wiphy *wiphy,
1448 struct station_parameters *params,
1449 enum cfg80211_station_type statype);
1450
420e7fab 1451/**
b1e8eb11 1452 * enum rate_info_flags - bitrate info flags
420e7fab
HR
1453 *
1454 * Used by the driver to indicate the specific rate transmission
1455 * type for 802.11n transmissions.
1456 *
db9c64cf
JB
1457 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1458 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
420e7fab 1459 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
2a38075c 1460 * @RATE_INFO_FLAGS_DMG: 60GHz MCS
c4cbaf79 1461 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
2a38075c 1462 * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
420e7fab
HR
1463 */
1464enum rate_info_flags {
db9c64cf
JB
1465 RATE_INFO_FLAGS_MCS = BIT(0),
1466 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
b51f3bee 1467 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
2a38075c 1468 RATE_INFO_FLAGS_DMG = BIT(3),
c4cbaf79 1469 RATE_INFO_FLAGS_HE_MCS = BIT(4),
2a38075c 1470 RATE_INFO_FLAGS_EDMG = BIT(5),
b51f3bee
JB
1471};
1472
1473/**
1474 * enum rate_info_bw - rate bandwidth information
1475 *
1476 * Used by the driver to indicate the rate bandwidth.
1477 *
1478 * @RATE_INFO_BW_5: 5 MHz bandwidth
1479 * @RATE_INFO_BW_10: 10 MHz bandwidth
1480 * @RATE_INFO_BW_20: 20 MHz bandwidth
1481 * @RATE_INFO_BW_40: 40 MHz bandwidth
1482 * @RATE_INFO_BW_80: 80 MHz bandwidth
1483 * @RATE_INFO_BW_160: 160 MHz bandwidth
c4cbaf79 1484 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
b51f3bee
JB
1485 */
1486enum rate_info_bw {
842be75c 1487 RATE_INFO_BW_20 = 0,
b51f3bee
JB
1488 RATE_INFO_BW_5,
1489 RATE_INFO_BW_10,
b51f3bee
JB
1490 RATE_INFO_BW_40,
1491 RATE_INFO_BW_80,
1492 RATE_INFO_BW_160,
c4cbaf79 1493 RATE_INFO_BW_HE_RU,
420e7fab
HR
1494};
1495
1496/**
1497 * struct rate_info - bitrate information
1498 *
1499 * Information about a receiving or transmitting bitrate
1500 *
1501 * @flags: bitflag of flags from &enum rate_info_flags
c4cbaf79 1502 * @mcs: mcs index if struct describes an HT/VHT/HE rate
420e7fab 1503 * @legacy: bitrate in 100kbit/s for 802.11abg
c4cbaf79 1504 * @nss: number of streams (VHT & HE only)
b51f3bee 1505 * @bw: bandwidth (from &enum rate_info_bw)
c4cbaf79
LC
1506 * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1507 * @he_dcm: HE DCM value
1508 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1509 * only valid if bw is %RATE_INFO_BW_HE_RU)
2a38075c 1510 * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
420e7fab
HR
1511 */
1512struct rate_info {
1513 u8 flags;
1514 u8 mcs;
1515 u16 legacy;
db9c64cf 1516 u8 nss;
b51f3bee 1517 u8 bw;
c4cbaf79
LC
1518 u8 he_gi;
1519 u8 he_dcm;
1520 u8 he_ru_alloc;
2a38075c 1521 u8 n_bonded_ch;
fd5b74dc
JB
1522};
1523
f4263c98 1524/**
b1e8eb11 1525 * enum bss_param_flags - bitrate info flags
f4263c98
PS
1526 *
1527 * Used by the driver to indicate the specific rate transmission
1528 * type for 802.11n transmissions.
1529 *
1530 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1531 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1532 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1533 */
1534enum bss_param_flags {
1535 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1536 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1537 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1538};
1539
1540/**
1541 * struct sta_bss_parameters - BSS parameters for the attached station
1542 *
1543 * Information about the currently associated BSS
1544 *
1545 * @flags: bitflag of flags from &enum bss_param_flags
1546 * @dtim_period: DTIM period for the BSS
1547 * @beacon_interval: beacon interval
1548 */
1549struct sta_bss_parameters {
1550 u8 flags;
1551 u8 dtim_period;
1552 u16 beacon_interval;
1553};
1554
52539ca8
THJ
1555/**
1556 * struct cfg80211_txq_stats - TXQ statistics for this TID
1557 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1558 * indicate the relevant values in this struct are filled
1559 * @backlog_bytes: total number of bytes currently backlogged
1560 * @backlog_packets: total number of packets currently backlogged
1561 * @flows: number of new flows seen
1562 * @drops: total number of packets dropped
1563 * @ecn_marks: total number of packets marked with ECN CE
1564 * @overlimit: number of drops due to queue space overflow
1565 * @overmemory: number of drops due to memory limit overflow
1566 * @collisions: number of hash collisions
1567 * @tx_bytes: total number of bytes dequeued
1568 * @tx_packets: total number of packets dequeued
1569 * @max_flows: maximum number of flows supported
1570 */
1571struct cfg80211_txq_stats {
1572 u32 filled;
1573 u32 backlog_bytes;
1574 u32 backlog_packets;
1575 u32 flows;
1576 u32 drops;
1577 u32 ecn_marks;
1578 u32 overlimit;
1579 u32 overmemory;
1580 u32 collisions;
1581 u32 tx_bytes;
1582 u32 tx_packets;
1583 u32 max_flows;
1584};
1585
6de39808
JB
1586/**
1587 * struct cfg80211_tid_stats - per-TID statistics
1588 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1589 * indicate the relevant values in this struct are filled
1590 * @rx_msdu: number of received MSDUs
1591 * @tx_msdu: number of (attempted) transmitted MSDUs
1592 * @tx_msdu_retries: number of retries (not counting the first) for
1593 * transmitted MSDUs
1594 * @tx_msdu_failed: number of failed transmitted MSDUs
52539ca8 1595 * @txq_stats: TXQ statistics
6de39808
JB
1596 */
1597struct cfg80211_tid_stats {
1598 u32 filled;
1599 u64 rx_msdu;
1600 u64 tx_msdu;
1601 u64 tx_msdu_retries;
1602 u64 tx_msdu_failed;
52539ca8 1603 struct cfg80211_txq_stats txq_stats;
6de39808
JB
1604};
1605
119363c7
FF
1606#define IEEE80211_MAX_CHAINS 4
1607
fd5b74dc 1608/**
2ec600d6 1609 * struct station_info - station information
fd5b74dc 1610 *
2ec600d6 1611 * Station information filled by driver for get_station() and dump_station.
fd5b74dc 1612 *
319090bf
JB
1613 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1614 * indicate the relevant values in this struct for them
ebe27c91 1615 * @connected_time: time(in secs) since a station is last connected
fd5b74dc 1616 * @inactive_time: time since last station activity (tx/rx) in milliseconds
6c7a0033 1617 * @assoc_at: bootime (ns) of the last association
8d791361
JB
1618 * @rx_bytes: bytes (size of MPDUs) received from this station
1619 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
2ec600d6
LCC
1620 * @llid: mesh local link id
1621 * @plid: mesh peer link id
1622 * @plink_state: mesh peer link state
73c3df3b
JB
1623 * @signal: The signal strength, type depends on the wiphy's signal_type.
1624 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1625 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1626 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
119363c7
FF
1627 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1628 * @chain_signal: per-chain signal strength of last received packet in dBm
1629 * @chain_signal_avg: per-chain signal strength average in dBm
858022aa
RD
1630 * @txrate: current unicast bitrate from this station
1631 * @rxrate: current unicast bitrate to this station
8d791361
JB
1632 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1633 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1634 * @tx_retries: cumulative retry counts (MPDUs)
1635 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
5a5c731a 1636 * @rx_dropped_misc: Dropped for un-specified reason.
1ba01458 1637 * @bss_param: current BSS parameters
f5ea9120
JB
1638 * @generation: generation number for nl80211 dumps.
1639 * This number should increase every time the list of stations
1640 * changes, i.e. when a station is added or removed, so that
1641 * userspace can tell whether it got a consistent snapshot.
50d3dfb7
JM
1642 * @assoc_req_ies: IEs from (Re)Association Request.
1643 * This is used only when in AP mode with drivers that do not use
1644 * user space MLME/SME implementation. The information is provided for
1645 * the cfg80211_new_sta() calls to notify user space of the IEs.
1646 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
c26887d2 1647 * @sta_flags: station flags mask & values
a85e1d55 1648 * @beacon_loss_count: Number of times beacon loss event has triggered.
d299a1f2 1649 * @t_offset: Time offset of the station relative to this host.
3b1c5a53
MP
1650 * @local_pm: local mesh STA power save mode
1651 * @peer_pm: peer mesh STA power save mode
1652 * @nonpeer_pm: non-peer mesh STA power save mode
867d849f
AQ
1653 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1654 * towards this station.
a76b1942
JB
1655 * @rx_beacon: number of beacons received from this peer
1656 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1657 * from this peer
dbdaee7a 1658 * @connected_to_gate: true if mesh STA has a path to mesh gate
739960f1 1659 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
36647055
THJ
1660 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
1661 * @airtime_weight: current airtime scheduling weight
6de39808
JB
1662 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1663 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
8689c051 1664 * Note that this doesn't use the @filled bit, but is used if non-NULL.
c4b50cd3 1665 * @ack_signal: signal strength (in dBm) of the last ACK frame.
81d5439d
BP
1666 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1667 * been sent.
0d4e14a3
AB
1668 * @rx_mpdu_count: number of MPDUs received from this station
1669 * @fcs_err_count: number of packets (MPDUs) received from this station with
1670 * an FCS error. This counter should be incremented only when TA of the
1671 * received packet with an FCS error matches the peer MAC address.
ab60633c 1672 * @airtime_link_metric: mesh airtime link metric.
1303a51c 1673 * @connected_to_as: true if mesh STA has a path to authentication server
fd5b74dc 1674 */
2ec600d6 1675struct station_info {
739960f1 1676 u64 filled;
ebe27c91 1677 u32 connected_time;
fd5b74dc 1678 u32 inactive_time;
6c7a0033 1679 u64 assoc_at;
42745e03
VK
1680 u64 rx_bytes;
1681 u64 tx_bytes;
2ec600d6
LCC
1682 u16 llid;
1683 u16 plid;
1684 u8 plink_state;
420e7fab 1685 s8 signal;
541a45a1 1686 s8 signal_avg;
119363c7
FF
1687
1688 u8 chains;
1689 s8 chain_signal[IEEE80211_MAX_CHAINS];
1690 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1691
420e7fab 1692 struct rate_info txrate;
c8dcfd8a 1693 struct rate_info rxrate;
98c8a60a
JM
1694 u32 rx_packets;
1695 u32 tx_packets;
b206b4ef
BR
1696 u32 tx_retries;
1697 u32 tx_failed;
5a5c731a 1698 u32 rx_dropped_misc;
f4263c98 1699 struct sta_bss_parameters bss_param;
bb6e753e 1700 struct nl80211_sta_flag_update sta_flags;
f5ea9120
JB
1701
1702 int generation;
50d3dfb7
JM
1703
1704 const u8 *assoc_req_ies;
1705 size_t assoc_req_ies_len;
f612cedf 1706
a85e1d55 1707 u32 beacon_loss_count;
d299a1f2 1708 s64 t_offset;
3b1c5a53
MP
1709 enum nl80211_mesh_power_mode local_pm;
1710 enum nl80211_mesh_power_mode peer_pm;
1711 enum nl80211_mesh_power_mode nonpeer_pm;
a85e1d55 1712
867d849f 1713 u32 expected_throughput;
a76b1942 1714
36647055 1715 u64 tx_duration;
739960f1 1716 u64 rx_duration;
36647055 1717 u64 rx_beacon;
a76b1942 1718 u8 rx_beacon_signal_avg;
dbdaee7a
BC
1719 u8 connected_to_gate;
1720
8689c051 1721 struct cfg80211_tid_stats *pertid;
c4b50cd3 1722 s8 ack_signal;
81d5439d 1723 s8 avg_ack_signal;
0d4e14a3 1724
36647055
THJ
1725 u16 airtime_weight;
1726
0d4e14a3
AB
1727 u32 rx_mpdu_count;
1728 u32 fcs_err_count;
ab60633c
NM
1729
1730 u32 airtime_link_metric;
1303a51c
MT
1731
1732 u8 connected_to_as;
fd5b74dc
JB
1733};
1734
6bdb68ce
CH
1735/**
1736 * struct cfg80211_sar_sub_specs - sub specs limit
1737 * @power: power limitation in 0.25dbm
1738 * @freq_range_index: index the power limitation applies to
1739 */
1740struct cfg80211_sar_sub_specs {
1741 s32 power;
1742 u32 freq_range_index;
1743};
1744
1745/**
1746 * struct cfg80211_sar_specs - sar limit specs
1747 * @type: it's set with power in 0.25dbm or other types
1748 * @num_sub_specs: number of sar sub specs
1749 * @sub_specs: memory to hold the sar sub specs
1750 */
1751struct cfg80211_sar_specs {
1752 enum nl80211_sar_type type;
1753 u32 num_sub_specs;
1754 struct cfg80211_sar_sub_specs sub_specs[];
1755};
1756
1757
1758/**
1759 * @struct cfg80211_sar_chan_ranges - sar frequency ranges
1760 * @start_freq: start range edge frequency
1761 * @end_freq: end range edge frequency
1762 */
1763struct cfg80211_sar_freq_ranges {
1764 u32 start_freq;
1765 u32 end_freq;
1766};
1767
1768/**
1769 * struct cfg80211_sar_capa - sar limit capability
1770 * @type: it's set via power in 0.25dbm or other types
1771 * @num_freq_ranges: number of frequency ranges
1772 * @freq_ranges: memory to hold the freq ranges.
1773 *
1774 * Note: WLAN driver may append new ranges or split an existing
1775 * range to small ones and then append them.
1776 */
1777struct cfg80211_sar_capa {
1778 enum nl80211_sar_type type;
1779 u32 num_freq_ranges;
1780 const struct cfg80211_sar_freq_ranges *freq_ranges;
1781};
1782
61aaa0e8 1783#if IS_ENABLED(CONFIG_CFG80211)
7406353d
AQ
1784/**
1785 * cfg80211_get_station - retrieve information about a given station
1786 * @dev: the device where the station is supposed to be connected to
1787 * @mac_addr: the mac address of the station of interest
1788 * @sinfo: pointer to the structure to fill with the information
1789 *
1790 * Returns 0 on success and sinfo is filled with the available information
1791 * otherwise returns a negative error code and the content of sinfo has to be
1792 * considered undefined.
1793 */
1794int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1795 struct station_info *sinfo);
61aaa0e8
LL
1796#else
1797static inline int cfg80211_get_station(struct net_device *dev,
1798 const u8 *mac_addr,
1799 struct station_info *sinfo)
1800{
1801 return -ENOENT;
1802}
1803#endif
7406353d 1804
66f7ac50
MW
1805/**
1806 * enum monitor_flags - monitor flags
1807 *
1808 * Monitor interface configuration flags. Note that these must be the bits
1809 * according to the nl80211 flags.
1810 *
818a986e 1811 * @MONITOR_FLAG_CHANGED: set if the flags were changed
66f7ac50
MW
1812 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1813 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1814 * @MONITOR_FLAG_CONTROL: pass control frames
1815 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1816 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
e057d3c3 1817 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
66f7ac50
MW
1818 */
1819enum monitor_flags {
818a986e 1820 MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
66f7ac50
MW
1821 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1822 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1823 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1824 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1825 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
e057d3c3 1826 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
66f7ac50
MW
1827};
1828
2ec600d6
LCC
1829/**
1830 * enum mpath_info_flags - mesh path information flags
1831 *
1832 * Used by the driver to indicate which info in &struct mpath_info it has filled
1833 * in during get_station() or dump_station().
1834 *
abe37c4b
JB
1835 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1836 * @MPATH_INFO_SN: @sn filled
1837 * @MPATH_INFO_METRIC: @metric filled
1838 * @MPATH_INFO_EXPTIME: @exptime filled
1839 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1840 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1841 * @MPATH_INFO_FLAGS: @flags filled
cc241636 1842 * @MPATH_INFO_HOP_COUNT: @hop_count filled
9874b71f 1843 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
2ec600d6
LCC
1844 */
1845enum mpath_info_flags {
1846 MPATH_INFO_FRAME_QLEN = BIT(0),
d19b3bf6 1847 MPATH_INFO_SN = BIT(1),
2ec600d6
LCC
1848 MPATH_INFO_METRIC = BIT(2),
1849 MPATH_INFO_EXPTIME = BIT(3),
1850 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1851 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1852 MPATH_INFO_FLAGS = BIT(6),
540bbcb9
JH
1853 MPATH_INFO_HOP_COUNT = BIT(7),
1854 MPATH_INFO_PATH_CHANGE = BIT(8),
2ec600d6
LCC
1855};
1856
1857/**
1858 * struct mpath_info - mesh path information
1859 *
1860 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1861 *
1862 * @filled: bitfield of flags from &enum mpath_info_flags
1863 * @frame_qlen: number of queued frames for this destination
d19b3bf6 1864 * @sn: target sequence number
2ec600d6
LCC
1865 * @metric: metric (cost) of this mesh path
1866 * @exptime: expiration time for the mesh path from now, in msecs
1867 * @flags: mesh path flags
1868 * @discovery_timeout: total mesh path discovery timeout, in msecs
1869 * @discovery_retries: mesh path discovery retries
f5ea9120
JB
1870 * @generation: generation number for nl80211 dumps.
1871 * This number should increase every time the list of mesh paths
1872 * changes, i.e. when a station is added or removed, so that
1873 * userspace can tell whether it got a consistent snapshot.
cc241636 1874 * @hop_count: hops to destination
540bbcb9 1875 * @path_change_count: total number of path changes to destination
2ec600d6
LCC
1876 */
1877struct mpath_info {
1878 u32 filled;
1879 u32 frame_qlen;
d19b3bf6 1880 u32 sn;
2ec600d6
LCC
1881 u32 metric;
1882 u32 exptime;
1883 u32 discovery_timeout;
1884 u8 discovery_retries;
1885 u8 flags;
cc241636 1886 u8 hop_count;
540bbcb9 1887 u32 path_change_count;
f5ea9120
JB
1888
1889 int generation;
2ec600d6
LCC
1890};
1891
9f1ba906
JM
1892/**
1893 * struct bss_parameters - BSS parameters
1894 *
1895 * Used to change BSS parameters (mainly for AP mode).
1896 *
1897 * @use_cts_prot: Whether to use CTS protection
1898 * (0 = no, 1 = yes, -1 = do not change)
1899 * @use_short_preamble: Whether the use of short preambles is allowed
1900 * (0 = no, 1 = yes, -1 = do not change)
1901 * @use_short_slot_time: Whether the use of short slot time is allowed
1902 * (0 = no, 1 = yes, -1 = do not change)
90c97a04
JM
1903 * @basic_rates: basic rates in IEEE 802.11 format
1904 * (or NULL for no change)
1905 * @basic_rates_len: number of basic rates
fd8aaaf3 1906 * @ap_isolate: do not forward packets between connected stations
9d6e371d 1907 * (0 = no, 1 = yes, -1 = do not change)
50b12f59 1908 * @ht_opmode: HT Operation mode
cd9b52bf 1909 * (u16 = opmode, -1 = do not change)
53cabad7
JB
1910 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1911 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
9f1ba906
JM
1912 */
1913struct bss_parameters {
1914 int use_cts_prot;
1915 int use_short_preamble;
1916 int use_short_slot_time;
c1e5f471 1917 const u8 *basic_rates;
90c97a04 1918 u8 basic_rates_len;
fd8aaaf3 1919 int ap_isolate;
50b12f59 1920 int ht_opmode;
53cabad7 1921 s8 p2p_ctwindow, p2p_opp_ps;
9f1ba906 1922};
2ec600d6 1923
3ddd53f3 1924/**
29cbe68c
JB
1925 * struct mesh_config - 802.11s mesh configuration
1926 *
1927 * These parameters can be changed while the mesh is active.
3ddd53f3
CYY
1928 *
1929 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1930 * by the Mesh Peering Open message
1931 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1932 * used by the Mesh Peering Open message
1933 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1934 * the mesh peering management to close a mesh peering
1935 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1936 * mesh interface
1937 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1938 * be sent to establish a new peer link instance in a mesh
1939 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1940 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1941 * elements
1942 * @auto_open_plinks: whether we should automatically open peer links when we
1943 * detect compatible mesh peers
1944 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1945 * synchronize to for 11s default synchronization method
1946 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1947 * that an originator mesh STA can send to a particular path target
1948 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1949 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1950 * a path discovery in milliseconds
1951 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1952 * receiving a PREQ shall consider the forwarding information from the
1953 * root to be valid. (TU = time unit)
1954 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1955 * which a mesh STA can send only one action frame containing a PREQ
1956 * element
1957 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1958 * which a mesh STA can send only one Action frame containing a PERR
1959 * element
1960 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1961 * it takes for an HWMP information element to propagate across the mesh
1962 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1963 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1964 * announcements are transmitted
1965 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1966 * station has access to a broader network beyond the MBSS. (This is
1967 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1968 * only means that the station will announce others it's a mesh gate, but
1969 * not necessarily using the gate announcement protocol. Still keeping the
1970 * same nomenclature to be in sync with the spec)
1971 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1972 * entity (default is TRUE - forwarding entity)
1973 * @rssi_threshold: the threshold for average signal strength of candidate
1974 * station to establish a peer link
1975 * @ht_opmode: mesh HT protection mode
ac1073a6
CYY
1976 *
1977 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1978 * receiving a proactive PREQ shall consider the forwarding information to
1979 * the root mesh STA to be valid.
1980 *
1981 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1982 * PREQs are transmitted.
728b19e5
CYY
1983 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1984 * during which a mesh STA can send only one Action frame containing
1985 * a PREQ element for root path confirmation.
3b1c5a53
MP
1986 * @power_mode: The default mesh power save mode which will be the initial
1987 * setting for new peer links.
1988 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1989 * after transmitting its beacon.
8e7c0538
CT
1990 * @plink_timeout: If no tx activity is seen from a STA we've established
1991 * peering with for longer than this time (in seconds), then remove it
1992 * from the STA's list of peers. Default is 30 minutes.
01d66fbd
BC
1993 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
1994 * connected to a mesh gate in mesh formation info. If false, the
1995 * value in mesh formation is determined by the presence of root paths
1996 * in the mesh path table
e3718a61
LL
1997 * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
1998 * for HWMP) if the destination is a direct neighbor. Note that this might
1999 * not be the optimal decision as a multi-hop route might be better. So
2000 * if using this setting you will likely also want to disable
2001 * dot11MeshForwarding and use another mesh routing protocol on top.
29cbe68c 2002 */
93da9cc1 2003struct mesh_config {
93da9cc1 2004 u16 dot11MeshRetryTimeout;
2005 u16 dot11MeshConfirmTimeout;
2006 u16 dot11MeshHoldingTimeout;
2007 u16 dot11MeshMaxPeerLinks;
a4f606ea
CYY
2008 u8 dot11MeshMaxRetries;
2009 u8 dot11MeshTTL;
2010 u8 element_ttl;
93da9cc1 2011 bool auto_open_plinks;
d299a1f2 2012 u32 dot11MeshNbrOffsetMaxNeighbor;
a4f606ea 2013 u8 dot11MeshHWMPmaxPREQretries;
93da9cc1 2014 u32 path_refresh_time;
2015 u16 min_discovery_timeout;
2016 u32 dot11MeshHWMPactivePathTimeout;
2017 u16 dot11MeshHWMPpreqMinInterval;
dca7e943 2018 u16 dot11MeshHWMPperrMinInterval;
93da9cc1 2019 u16 dot11MeshHWMPnetDiameterTraversalTime;
a4f606ea 2020 u8 dot11MeshHWMPRootMode;
01d66fbd 2021 bool dot11MeshConnectedToMeshGate;
184eebe6 2022 bool dot11MeshConnectedToAuthServer;
0507e159 2023 u16 dot11MeshHWMPRannInterval;
a4f606ea 2024 bool dot11MeshGateAnnouncementProtocol;
94f90656 2025 bool dot11MeshForwarding;
55335137 2026 s32 rssi_threshold;
70c33eaa 2027 u16 ht_opmode;
ac1073a6
CYY
2028 u32 dot11MeshHWMPactivePathToRootTimeout;
2029 u16 dot11MeshHWMProotInterval;
728b19e5 2030 u16 dot11MeshHWMPconfirmationInterval;
3b1c5a53
MP
2031 enum nl80211_mesh_power_mode power_mode;
2032 u16 dot11MeshAwakeWindowDuration;
8e7c0538 2033 u32 plink_timeout;
e3718a61 2034 bool dot11MeshNolearn;
93da9cc1 2035};
2036
29cbe68c
JB
2037/**
2038 * struct mesh_setup - 802.11s mesh setup configuration
683b6d3b 2039 * @chandef: defines the channel to use
29cbe68c
JB
2040 * @mesh_id: the mesh ID
2041 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
d299a1f2 2042 * @sync_method: which synchronization method to use
c80d545d
JC
2043 * @path_sel_proto: which path selection protocol to use
2044 * @path_metric: which metric to use
6e16d90b 2045 * @auth_id: which authentication method this mesh is using
581a8b0f
JC
2046 * @ie: vendor information elements (optional)
2047 * @ie_len: length of vendor information elements
b130e5ce
JC
2048 * @is_authenticated: this mesh requires authentication
2049 * @is_secure: this mesh uses security
bb2798d4 2050 * @user_mpm: userspace handles all MPM functions
9bdbf04d
MP
2051 * @dtim_period: DTIM period to use
2052 * @beacon_interval: beacon interval to use
4bb62344 2053 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
ffb3cf30 2054 * @basic_rates: basic rates to use when creating the mesh
8564e382 2055 * @beacon_rate: bitrate to be used for beacons
d37d49c2
BB
2056 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2057 * changes the channel when a radar is detected. This is required
2058 * to operate on DFS channels.
1224f583
DK
2059 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2060 * port frames over NL80211 instead of the network interface.
29cbe68c
JB
2061 *
2062 * These parameters are fixed when the mesh is created.
2063 */
2064struct mesh_setup {
683b6d3b 2065 struct cfg80211_chan_def chandef;
29cbe68c
JB
2066 const u8 *mesh_id;
2067 u8 mesh_id_len;
d299a1f2
JC
2068 u8 sync_method;
2069 u8 path_sel_proto;
2070 u8 path_metric;
6e16d90b 2071 u8 auth_id;
581a8b0f
JC
2072 const u8 *ie;
2073 u8 ie_len;
b130e5ce 2074 bool is_authenticated;
15d5dda6 2075 bool is_secure;
bb2798d4 2076 bool user_mpm;
9bdbf04d
MP
2077 u8 dtim_period;
2078 u16 beacon_interval;
57fbcce3 2079 int mcast_rate[NUM_NL80211_BANDS];
ffb3cf30 2080 u32 basic_rates;
8564e382 2081 struct cfg80211_bitrate_mask beacon_rate;
d37d49c2 2082 bool userspace_handles_dfs;
1224f583 2083 bool control_port_over_nl80211;
29cbe68c
JB
2084};
2085
6e0bd6c3
RL
2086/**
2087 * struct ocb_setup - 802.11p OCB mode setup configuration
2088 * @chandef: defines the channel to use
2089 *
2090 * These parameters are fixed when connecting to the network
2091 */
2092struct ocb_setup {
2093 struct cfg80211_chan_def chandef;
2094};
2095
31888487
JM
2096/**
2097 * struct ieee80211_txq_params - TX queue parameters
a3304b0a 2098 * @ac: AC identifier
31888487
JM
2099 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
2100 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
2101 * 1..32767]
2102 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
2103 * 1..32767]
2104 * @aifs: Arbitration interframe space [0..255]
2105 */
2106struct ieee80211_txq_params {
a3304b0a 2107 enum nl80211_ac ac;
31888487
JM
2108 u16 txop;
2109 u16 cwmin;
2110 u16 cwmax;
2111 u8 aifs;
2112};
2113
d70e9693
JB
2114/**
2115 * DOC: Scanning and BSS list handling
2116 *
2117 * The scanning process itself is fairly simple, but cfg80211 offers quite
2118 * a bit of helper functionality. To start a scan, the scan operation will
2119 * be invoked with a scan definition. This scan definition contains the
2120 * channels to scan, and the SSIDs to send probe requests for (including the
2121 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2122 * probe. Additionally, a scan request may contain extra information elements
2123 * that should be added to the probe request. The IEs are guaranteed to be
2124 * well-formed, and will not exceed the maximum length the driver advertised
2125 * in the wiphy structure.
2126 *
2127 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2128 * it is responsible for maintaining the BSS list; the driver should not
2129 * maintain a list itself. For this notification, various functions exist.
2130 *
2131 * Since drivers do not maintain a BSS list, there are also a number of
2132 * functions to search for a BSS and obtain information about it from the
2133 * BSS structure cfg80211 maintains. The BSS list is also made available
2134 * to userspace.
2135 */
72bdcf34 2136
2a519311
JB
2137/**
2138 * struct cfg80211_ssid - SSID description
2139 * @ssid: the SSID
2140 * @ssid_len: length of the ssid
2141 */
2142struct cfg80211_ssid {
2143 u8 ssid[IEEE80211_MAX_SSID_LEN];
2144 u8 ssid_len;
2145};
2146
1d76250b
AS
2147/**
2148 * struct cfg80211_scan_info - information about completed scan
2149 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
2150 * wireless device that requested the scan is connected to. If this
2151 * information is not available, this field is left zero.
2152 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
2153 * @aborted: set to true if the scan was aborted for any reason,
2154 * userspace will be notified of that
2155 */
2156struct cfg80211_scan_info {
2157 u64 scan_start_tsf;
2158 u8 tsf_bssid[ETH_ALEN] __aligned(2);
2159 bool aborted;
2160};
2161
c8cb5b85
TM
2162/**
2163 * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2164 *
2165 * @short_bssid: short ssid to scan for
2166 * @bssid: bssid to scan for
2167 * @channel_idx: idx of the channel in the channel array in the scan request
2168 * which the above info relvant to
2169 * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2170 * @short_ssid_valid: short_ssid is valid and can be used
2171 * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2172 * 20 TUs before starting to send probe requests.
2173 */
2174struct cfg80211_scan_6ghz_params {
2175 u32 short_ssid;
2176 u32 channel_idx;
2177 u8 bssid[ETH_ALEN];
2178 bool unsolicited_probe;
2179 bool short_ssid_valid;
2180 bool psc_no_listen;
2181};
2182
2a519311
JB
2183/**
2184 * struct cfg80211_scan_request - scan request description
2185 *
2186 * @ssids: SSIDs to scan for (active scan only)
2187 * @n_ssids: number of SSIDs
2188 * @channels: channels to scan on.
ca3dbc20 2189 * @n_channels: total number of channels to scan
dcd6eac1 2190 * @scan_width: channel width for scanning
70692ad2
JM
2191 * @ie: optional information element(s) to add into Probe Request or %NULL
2192 * @ie_len: length of ie in octets
1d76250b
AS
2193 * @duration: how long to listen on each channel, in TUs. If
2194 * %duration_mandatory is not set, this is the maximum dwell time and
2195 * the actual dwell time may be shorter.
2196 * @duration_mandatory: if set, the scan duration must be as specified by the
2197 * %duration field.
ed473771 2198 * @flags: bit field of flags controlling operation
34850ab2 2199 * @rates: bitmap of rates to advertise for each band
2a519311 2200 * @wiphy: the wiphy this was for
15d6030b 2201 * @scan_start: time (in jiffies) when the scan started
fd014284 2202 * @wdev: the wireless device to scan for
1d76250b 2203 * @info: (internal) information about completed scan
5fe231e8 2204 * @notified: (internal) scan request was notified as done or aborted
e9f935e3 2205 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
ad2b26ab
JB
2206 * @mac_addr: MAC address used with randomisation
2207 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2208 * are 0 in the mask should be randomised, bits that are 1 should
2209 * be taken from the @mac_addr
c8cb5b85
TM
2210 * @scan_6ghz: relevant for split scan request only,
2211 * true if this is the second scan request
2212 * @n_6ghz_params: number of 6 GHz params
2213 * @scan_6ghz_params: 6 GHz params
818965d3 2214 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
2a519311
JB
2215 */
2216struct cfg80211_scan_request {
2217 struct cfg80211_ssid *ssids;
2218 int n_ssids;
2a519311 2219 u32 n_channels;
dcd6eac1 2220 enum nl80211_bss_scan_width scan_width;
de95a54b 2221 const u8 *ie;
70692ad2 2222 size_t ie_len;
1d76250b
AS
2223 u16 duration;
2224 bool duration_mandatory;
ed473771 2225 u32 flags;
2a519311 2226
57fbcce3 2227 u32 rates[NUM_NL80211_BANDS];
34850ab2 2228
fd014284
JB
2229 struct wireless_dev *wdev;
2230
ad2b26ab
JB
2231 u8 mac_addr[ETH_ALEN] __aligned(2);
2232 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
818965d3 2233 u8 bssid[ETH_ALEN] __aligned(2);
ad2b26ab 2234
2a519311
JB
2235 /* internal */
2236 struct wiphy *wiphy;
15d6030b 2237 unsigned long scan_start;
1d76250b
AS
2238 struct cfg80211_scan_info info;
2239 bool notified;
e9f935e3 2240 bool no_cck;
c8cb5b85
TM
2241 bool scan_6ghz;
2242 u32 n_6ghz_params;
2243 struct cfg80211_scan_6ghz_params *scan_6ghz_params;
5ba63533
JB
2244
2245 /* keep last */
396fba0a 2246 struct ieee80211_channel *channels[];
2a519311
JB
2247};
2248
ad2b26ab
JB
2249static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2250{
2251 int i;
2252
2253 get_random_bytes(buf, ETH_ALEN);
2254 for (i = 0; i < ETH_ALEN; i++) {
2255 buf[i] &= ~mask[i];
2256 buf[i] |= addr[i] & mask[i];
2257 }
2258}
2259
a1f1c21c
LC
2260/**
2261 * struct cfg80211_match_set - sets of attributes to match
2262 *
3007e352
AVS
2263 * @ssid: SSID to be matched; may be zero-length in case of BSSID match
2264 * or no match (RSSI only)
2265 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
2266 * or no match (RSSI only)
ea73cbce 2267 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1e1b11b6 2268 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
2269 * for filtering out scan results received. Drivers advertize this support
2270 * of band specific rssi based filtering through the feature capability
2271 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
2272 * specific rssi thresholds take precedence over rssi_thold, if specified.
2273 * If not specified for any band, it will be assigned with rssi_thold of
2274 * corresponding matchset.
a1f1c21c
LC
2275 */
2276struct cfg80211_match_set {
2277 struct cfg80211_ssid ssid;
3007e352 2278 u8 bssid[ETH_ALEN];
ea73cbce 2279 s32 rssi_thold;
1e1b11b6 2280 s32 per_band_rssi_thold[NUM_NL80211_BANDS];
a1f1c21c
LC
2281};
2282
3b06d277
AS
2283/**
2284 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
2285 *
2286 * @interval: interval between scheduled scan iterations. In seconds.
2287 * @iterations: number of scan iterations in this scan plan. Zero means
2288 * infinite loop.
2289 * The last scan plan will always have this parameter set to zero,
2290 * all other scan plans will have a finite number of iterations.
2291 */
2292struct cfg80211_sched_scan_plan {
2293 u32 interval;
2294 u32 iterations;
2295};
2296
bf95ecdb 2297/**
2298 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2299 *
2300 * @band: band of BSS which should match for RSSI level adjustment.
2301 * @delta: value of RSSI level adjustment.
2302 */
2303struct cfg80211_bss_select_adjust {
2304 enum nl80211_band band;
2305 s8 delta;
2306};
2307
807f8a8c
LC
2308/**
2309 * struct cfg80211_sched_scan_request - scheduled scan request description
2310 *
96b08fd6 2311 * @reqid: identifies this request.
807f8a8c
LC
2312 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2313 * @n_ssids: number of SSIDs
2314 * @n_channels: total number of channels to scan
dcd6eac1 2315 * @scan_width: channel width for scanning
807f8a8c
LC
2316 * @ie: optional information element(s) to add into Probe Request or %NULL
2317 * @ie_len: length of ie in octets
ed473771 2318 * @flags: bit field of flags controlling operation
a1f1c21c 2319 * @match_sets: sets of parameters to be matched for a scan result
cd9b52bf
JP
2320 * entry to be considered valid and to be passed to the host
2321 * (others are filtered out).
a1f1c21c
LC
2322 * If ommited, all results are passed.
2323 * @n_match_sets: number of match sets
6406c919 2324 * @report_results: indicates that results were reported for this request
807f8a8c
LC
2325 * @wiphy: the wiphy this was for
2326 * @dev: the interface
077f897a 2327 * @scan_start: start time of the scheduled scan
807f8a8c 2328 * @channels: channels to scan
ea73cbce
JB
2329 * @min_rssi_thold: for drivers only supporting a single threshold, this
2330 * contains the minimum over all matchsets
ad2b26ab
JB
2331 * @mac_addr: MAC address used with randomisation
2332 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2333 * are 0 in the mask should be randomised, bits that are 1 should
2334 * be taken from the @mac_addr
3b06d277
AS
2335 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
2336 * index must be executed first.
2337 * @n_scan_plans: number of scan plans, at least 1.
31a60ed1 2338 * @rcu_head: RCU callback used to free the struct
93a1e86c
JR
2339 * @owner_nlportid: netlink portid of owner (if this should is a request
2340 * owned by a particular socket)
ca986ad9
AVS
2341 * @nl_owner_dead: netlink owner socket was closed - this request be freed
2342 * @list: for keeping list of requests.
9c748934
LC
2343 * @delay: delay in seconds to use before starting the first scan
2344 * cycle. The driver may ignore this parameter and start
2345 * immediately (or at any other time), if this feature is not
2346 * supported.
bf95ecdb 2347 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2348 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2349 * reporting in connected state to cases where a matching BSS is determined
2350 * to have better or slightly worse RSSI than the current connected BSS.
2351 * The relative RSSI threshold values are ignored in disconnected state.
2352 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2353 * to the specified band while deciding whether a better BSS is reported
2354 * using @relative_rssi. If delta is a negative number, the BSSs that
2355 * belong to the specified band will be penalized by delta dB in relative
2356 * comparisions.
807f8a8c
LC
2357 */
2358struct cfg80211_sched_scan_request {
96b08fd6 2359 u64 reqid;
807f8a8c
LC
2360 struct cfg80211_ssid *ssids;
2361 int n_ssids;
2362 u32 n_channels;
dcd6eac1 2363 enum nl80211_bss_scan_width scan_width;
807f8a8c
LC
2364 const u8 *ie;
2365 size_t ie_len;
ed473771 2366 u32 flags;
a1f1c21c
LC
2367 struct cfg80211_match_set *match_sets;
2368 int n_match_sets;
ea73cbce 2369 s32 min_rssi_thold;
9c748934 2370 u32 delay;
3b06d277
AS
2371 struct cfg80211_sched_scan_plan *scan_plans;
2372 int n_scan_plans;
807f8a8c 2373
ad2b26ab
JB
2374 u8 mac_addr[ETH_ALEN] __aligned(2);
2375 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2376
bf95ecdb 2377 bool relative_rssi_set;
2378 s8 relative_rssi;
2379 struct cfg80211_bss_select_adjust rssi_adjust;
2380
807f8a8c
LC
2381 /* internal */
2382 struct wiphy *wiphy;
2383 struct net_device *dev;
15d6030b 2384 unsigned long scan_start;
b34939b9 2385 bool report_results;
31a60ed1 2386 struct rcu_head rcu_head;
93a1e86c 2387 u32 owner_nlportid;
ca986ad9
AVS
2388 bool nl_owner_dead;
2389 struct list_head list;
807f8a8c
LC
2390
2391 /* keep last */
396fba0a 2392 struct ieee80211_channel *channels[];
807f8a8c
LC
2393};
2394
2a519311
JB
2395/**
2396 * enum cfg80211_signal_type - signal type
2397 *
2398 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
2399 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
2400 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
2401 */
2402enum cfg80211_signal_type {
2403 CFG80211_SIGNAL_TYPE_NONE,
2404 CFG80211_SIGNAL_TYPE_MBM,
2405 CFG80211_SIGNAL_TYPE_UNSPEC,
2406};
2407
6e19bc4b
DS
2408/**
2409 * struct cfg80211_inform_bss - BSS inform data
2410 * @chan: channel the frame was received on
2411 * @scan_width: scan width that was used
2412 * @signal: signal strength value, according to the wiphy's
2413 * signal type
2414 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
2415 * received; should match the time when the frame was actually
2416 * received by the device (not just by the host, in case it was
2417 * buffered on the device) and be accurate to about 10ms.
2418 * If the frame isn't buffered, just passing the return value of
9285ec4c 2419 * ktime_get_boottime_ns() is likely appropriate.
1d76250b
AS
2420 * @parent_tsf: the time at the start of reception of the first octet of the
2421 * timestamp field of the frame. The time is the TSF of the BSS specified
2422 * by %parent_bssid.
2423 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
2424 * the BSS that requested the scan in which the beacon/probe was received.
983dafaa
SD
2425 * @chains: bitmask for filled values in @chain_signal.
2426 * @chain_signal: per-chain signal strength of last received BSS in dBm.
6e19bc4b
DS
2427 */
2428struct cfg80211_inform_bss {
2429 struct ieee80211_channel *chan;
2430 enum nl80211_bss_scan_width scan_width;
2431 s32 signal;
2432 u64 boottime_ns;
1d76250b
AS
2433 u64 parent_tsf;
2434 u8 parent_bssid[ETH_ALEN] __aligned(2);
983dafaa
SD
2435 u8 chains;
2436 s8 chain_signal[IEEE80211_MAX_CHAINS];
6e19bc4b
DS
2437};
2438
9caf0364 2439/**
2aa4d456 2440 * struct cfg80211_bss_ies - BSS entry IE data
8cef2c9d 2441 * @tsf: TSF contained in the frame that carried these IEs
9caf0364
JB
2442 * @rcu_head: internal use, for freeing
2443 * @len: length of the IEs
0e227084 2444 * @from_beacon: these IEs are known to come from a beacon
9caf0364
JB
2445 * @data: IE data
2446 */
2447struct cfg80211_bss_ies {
8cef2c9d 2448 u64 tsf;
9caf0364
JB
2449 struct rcu_head rcu_head;
2450 int len;
0e227084 2451 bool from_beacon;
9caf0364
JB
2452 u8 data[];
2453};
2454
2a519311
JB
2455/**
2456 * struct cfg80211_bss - BSS description
2457 *
2458 * This structure describes a BSS (which may also be a mesh network)
2459 * for use in scan results and similar.
2460 *
abe37c4b 2461 * @channel: channel this BSS is on
dcd6eac1 2462 * @scan_width: width of the control channel
2a519311 2463 * @bssid: BSSID of the BSS
2a519311
JB
2464 * @beacon_interval: the beacon interval as from the frame
2465 * @capability: the capability field in host byte order
83c7aa1a
JB
2466 * @ies: the information elements (Note that there is no guarantee that these
2467 * are well-formed!); this is a pointer to either the beacon_ies or
2468 * proberesp_ies depending on whether Probe Response frame has been
2469 * received. It is always non-%NULL.
34a6eddb 2470 * @beacon_ies: the information elements from the last Beacon frame
776b3580
JB
2471 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
2472 * own the beacon_ies, but they're just pointers to the ones from the
2473 * @hidden_beacon_bss struct)
34a6eddb 2474 * @proberesp_ies: the information elements from the last Probe Response frame
776b3580
JB
2475 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2476 * a BSS that hides the SSID in its beacon, this points to the BSS struct
2477 * that holds the beacon data. @beacon_ies is still valid, of course, and
2478 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
851ae31d
JB
2479 * @transmitted_bss: pointer to the transmitted BSS, if this is a
2480 * non-transmitted one (multi-BSSID support)
2481 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2482 * (multi-BSSID support)
77965c97 2483 * @signal: signal strength value (type depends on the wiphy's signal_type)
983dafaa
SD
2484 * @chains: bitmask for filled values in @chain_signal.
2485 * @chain_signal: per-chain signal strength of last received BSS in dBm.
0cd01efb
SS
2486 * @bssid_index: index in the multiple BSS set
2487 * @max_bssid_indicator: max number of members in the BSS set
2a519311
JB
2488 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
2489 */
2490struct cfg80211_bss {
2491 struct ieee80211_channel *channel;
dcd6eac1 2492 enum nl80211_bss_scan_width scan_width;
2a519311 2493
9caf0364
JB
2494 const struct cfg80211_bss_ies __rcu *ies;
2495 const struct cfg80211_bss_ies __rcu *beacon_ies;
2496 const struct cfg80211_bss_ies __rcu *proberesp_ies;
2497
776b3580 2498 struct cfg80211_bss *hidden_beacon_bss;
7011ba58
SS
2499 struct cfg80211_bss *transmitted_bss;
2500 struct list_head nontrans_list;
9caf0364
JB
2501
2502 s32 signal;
2503
2a519311
JB
2504 u16 beacon_interval;
2505 u16 capability;
2a519311 2506
9caf0364 2507 u8 bssid[ETH_ALEN];
983dafaa
SD
2508 u8 chains;
2509 s8 chain_signal[IEEE80211_MAX_CHAINS];
2a519311 2510
0cd01efb
SS
2511 u8 bssid_index;
2512 u8 max_bssid_indicator;
2513
396fba0a 2514 u8 priv[] __aligned(sizeof(void *));
2a519311
JB
2515};
2516
49a68e0d
JB
2517/**
2518 * ieee80211_bss_get_elem - find element with given ID
2519 * @bss: the bss to search
2520 * @id: the element ID
2521 *
2522 * Note that the return value is an RCU-protected pointer, so
2523 * rcu_read_lock() must be held when calling this function.
2524 * Return: %NULL if not found.
2525 */
2526const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
2527
517357c6
JB
2528/**
2529 * ieee80211_bss_get_ie - find IE with given ID
2530 * @bss: the bss to search
49a68e0d 2531 * @id: the element ID
9caf0364
JB
2532 *
2533 * Note that the return value is an RCU-protected pointer, so
2534 * rcu_read_lock() must be held when calling this function.
0ae997dc 2535 * Return: %NULL if not found.
517357c6 2536 */
49a68e0d
JB
2537static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
2538{
2539 return (void *)ieee80211_bss_get_elem(bss, id);
2540}
517357c6
JB
2541
2542
636a5d36
JM
2543/**
2544 * struct cfg80211_auth_request - Authentication request data
2545 *
2546 * This structure provides information needed to complete IEEE 802.11
2547 * authentication.
19957bb3 2548 *
959867fa
JB
2549 * @bss: The BSS to authenticate with, the callee must obtain a reference
2550 * to it if it needs to keep it.
636a5d36
JM
2551 * @auth_type: Authentication type (algorithm)
2552 * @ie: Extra IEs to add to Authentication frame or %NULL
2553 * @ie_len: Length of ie buffer in octets
fffd0934
JB
2554 * @key_len: length of WEP key for shared key authentication
2555 * @key_idx: index of WEP key for shared key authentication
2556 * @key: WEP key for shared key authentication
11b6b5a4
JM
2557 * @auth_data: Fields and elements in Authentication frames. This contains
2558 * the authentication frame body (non-IE and IE data), excluding the
2559 * Authentication algorithm number, i.e., starting at the Authentication
2560 * transaction sequence number field.
2561 * @auth_data_len: Length of auth_data buffer in octets
636a5d36
JM
2562 */
2563struct cfg80211_auth_request {
19957bb3 2564 struct cfg80211_bss *bss;
636a5d36
JM
2565 const u8 *ie;
2566 size_t ie_len;
19957bb3 2567 enum nl80211_auth_type auth_type;
fffd0934
JB
2568 const u8 *key;
2569 u8 key_len, key_idx;
11b6b5a4
JM
2570 const u8 *auth_data;
2571 size_t auth_data_len;
636a5d36
JM
2572};
2573
7e7c8926
BG
2574/**
2575 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
2576 *
2577 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
ee2aca34 2578 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
bab5ab7d 2579 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
40cbfa90
SD
2580 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
2581 * authentication capability. Drivers can offload authentication to
2582 * userspace if this flag is set. Only applicable for cfg80211_connect()
2583 * request (connect callback).
7e7c8926
BG
2584 */
2585enum cfg80211_assoc_req_flags {
40cbfa90
SD
2586 ASSOC_REQ_DISABLE_HT = BIT(0),
2587 ASSOC_REQ_DISABLE_VHT = BIT(1),
2588 ASSOC_REQ_USE_RRM = BIT(2),
2589 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
7e7c8926
BG
2590};
2591
636a5d36
JM
2592/**
2593 * struct cfg80211_assoc_request - (Re)Association request data
2594 *
2595 * This structure provides information needed to complete IEEE 802.11
2596 * (re)association.
959867fa
JB
2597 * @bss: The BSS to associate with. If the call is successful the driver is
2598 * given a reference that it must give back to cfg80211_send_rx_assoc()
2599 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2600 * association requests while already associating must be rejected.
636a5d36
JM
2601 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2602 * @ie_len: Length of ie buffer in octets
dc6382ce 2603 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
b23aa676 2604 * @crypto: crypto settings
35eb8f7b
JM
2605 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2606 * to indicate a request to reassociate within the ESS instead of a request
2607 * do the initial association with the ESS. When included, this is set to
2608 * the BSSID of the current association, i.e., to the value that is
2609 * included in the Current AP address field of the Reassociation Request
2610 * frame.
7e7c8926
BG
2611 * @flags: See &enum cfg80211_assoc_req_flags
2612 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
ad24b0da 2613 * will be used in ht_capa. Un-supported values will be ignored.
7e7c8926 2614 * @ht_capa_mask: The bits of ht_capa which are to be used.
ee2aca34
JB
2615 * @vht_capa: VHT capability override
2616 * @vht_capa_mask: VHT capability mask indicating which fields to use
348bd456
JM
2617 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2618 * %NULL if FILS is not used.
2619 * @fils_kek_len: Length of fils_kek in octets
2620 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2621 * Request/Response frame or %NULL if FILS is not used. This field starts
2622 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
d2b7588a
TP
2623 * @s1g_capa: S1G capability override
2624 * @s1g_capa_mask: S1G capability override mask
636a5d36
JM
2625 */
2626struct cfg80211_assoc_request {
19957bb3 2627 struct cfg80211_bss *bss;
3e5d7649 2628 const u8 *ie, *prev_bssid;
636a5d36 2629 size_t ie_len;
b23aa676 2630 struct cfg80211_crypto_settings crypto;
19957bb3 2631 bool use_mfp;
7e7c8926
BG
2632 u32 flags;
2633 struct ieee80211_ht_cap ht_capa;
2634 struct ieee80211_ht_cap ht_capa_mask;
ee2aca34 2635 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
348bd456
JM
2636 const u8 *fils_kek;
2637 size_t fils_kek_len;
2638 const u8 *fils_nonces;
d2b7588a 2639 struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
636a5d36
JM
2640};
2641
2642/**
2643 * struct cfg80211_deauth_request - Deauthentication request data
2644 *
2645 * This structure provides information needed to complete IEEE 802.11
2646 * deauthentication.
2647 *
95de817b 2648 * @bssid: the BSSID of the BSS to deauthenticate from
636a5d36
JM
2649 * @ie: Extra IEs to add to Deauthentication frame or %NULL
2650 * @ie_len: Length of ie buffer in octets
19957bb3 2651 * @reason_code: The reason code for the deauthentication
077f897a
JB
2652 * @local_state_change: if set, change local state only and
2653 * do not set a deauth frame
636a5d36
JM
2654 */
2655struct cfg80211_deauth_request {
95de817b 2656 const u8 *bssid;
636a5d36
JM
2657 const u8 *ie;
2658 size_t ie_len;
19957bb3 2659 u16 reason_code;
6863255b 2660 bool local_state_change;
636a5d36
JM
2661};
2662
2663/**
2664 * struct cfg80211_disassoc_request - Disassociation request data
2665 *
2666 * This structure provides information needed to complete IEEE 802.11
66f00449 2667 * disassociation.
636a5d36 2668 *
19957bb3 2669 * @bss: the BSS to disassociate from
636a5d36
JM
2670 * @ie: Extra IEs to add to Disassociation frame or %NULL
2671 * @ie_len: Length of ie buffer in octets
19957bb3 2672 * @reason_code: The reason code for the disassociation
d5cdfacb
JM
2673 * @local_state_change: This is a request for a local state only, i.e., no
2674 * Disassociation frame is to be transmitted.
636a5d36
JM
2675 */
2676struct cfg80211_disassoc_request {
19957bb3 2677 struct cfg80211_bss *bss;
636a5d36
JM
2678 const u8 *ie;
2679 size_t ie_len;
19957bb3 2680 u16 reason_code;
d5cdfacb 2681 bool local_state_change;
636a5d36
JM
2682};
2683
04a773ad
JB
2684/**
2685 * struct cfg80211_ibss_params - IBSS parameters
2686 *
2687 * This structure defines the IBSS parameters for the join_ibss()
2688 * method.
2689 *
2690 * @ssid: The SSID, will always be non-null.
2691 * @ssid_len: The length of the SSID, will always be non-zero.
2692 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2693 * search for IBSSs with a different BSSID.
683b6d3b 2694 * @chandef: defines the channel to use if no other IBSS to join can be found
04a773ad
JB
2695 * @channel_fixed: The channel should be fixed -- do not search for
2696 * IBSSs to join on other channels.
2697 * @ie: information element(s) to include in the beacon
2698 * @ie_len: length of that
8e30bc55 2699 * @beacon_interval: beacon interval to use
fffd0934
JB
2700 * @privacy: this is a protected network, keys will be configured
2701 * after joining
267335d6
AQ
2702 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2703 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2704 * required to assume that the port is unauthorized until authorized by
2705 * user space. Otherwise, port is marked authorized by default.
c3bfe1f6
DK
2706 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2707 * port frames over NL80211 instead of the network interface.
5336fa88
SW
2708 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2709 * changes the channel when a radar is detected. This is required
2710 * to operate on DFS channels.
fbd2c8dc 2711 * @basic_rates: bitmap of basic rates to use when creating the IBSS
dd5b4cc7 2712 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
803768f5 2713 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
ad24b0da 2714 * will be used in ht_capa. Un-supported values will be ignored.
803768f5 2715 * @ht_capa_mask: The bits of ht_capa which are to be used.
9ae3b172 2716 * @wep_keys: static WEP keys, if not NULL points to an array of
cd9b52bf 2717 * CFG80211_MAX_WEP_KEYS WEP keys
9ae3b172 2718 * @wep_tx_key: key index (0..3) of the default TX static WEP key
04a773ad
JB
2719 */
2720struct cfg80211_ibss_params {
c1e5f471
JB
2721 const u8 *ssid;
2722 const u8 *bssid;
683b6d3b 2723 struct cfg80211_chan_def chandef;
c1e5f471 2724 const u8 *ie;
04a773ad 2725 u8 ssid_len, ie_len;
8e30bc55 2726 u16 beacon_interval;
fbd2c8dc 2727 u32 basic_rates;
04a773ad 2728 bool channel_fixed;
fffd0934 2729 bool privacy;
267335d6 2730 bool control_port;
c3bfe1f6 2731 bool control_port_over_nl80211;
5336fa88 2732 bool userspace_handles_dfs;
57fbcce3 2733 int mcast_rate[NUM_NL80211_BANDS];
803768f5
SW
2734 struct ieee80211_ht_cap ht_capa;
2735 struct ieee80211_ht_cap ht_capa_mask;
9ae3b172
TM
2736 struct key_params *wep_keys;
2737 int wep_tx_key;
04a773ad
JB
2738};
2739
38de03d2
AS
2740/**
2741 * struct cfg80211_bss_selection - connection parameters for BSS selection.
2742 *
2743 * @behaviour: requested BSS selection behaviour.
2744 * @param: parameters for requestion behaviour.
2745 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2746 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2747 */
2748struct cfg80211_bss_selection {
2749 enum nl80211_bss_select_attr behaviour;
2750 union {
57fbcce3 2751 enum nl80211_band band_pref;
38de03d2
AS
2752 struct cfg80211_bss_select_adjust adjust;
2753 } param;
2754};
2755
b23aa676
SO
2756/**
2757 * struct cfg80211_connect_params - Connection parameters
2758 *
2759 * This structure provides information needed to complete IEEE 802.11
2760 * authentication and association.
2761 *
2762 * @channel: The channel to use or %NULL if not specified (auto-select based
2763 * on scan results)
1df4a510
JM
2764 * @channel_hint: The channel of the recommended BSS for initial connection or
2765 * %NULL if not specified
b23aa676
SO
2766 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2767 * results)
1df4a510
JM
2768 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2769 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2770 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2771 * to use.
b23aa676
SO
2772 * @ssid: SSID
2773 * @ssid_len: Length of ssid in octets
2774 * @auth_type: Authentication type (algorithm)
abe37c4b
JB
2775 * @ie: IEs for association request
2776 * @ie_len: Length of assoc_ie in octets
b23aa676 2777 * @privacy: indicates whether privacy-enabled APs should be used
cee00a95 2778 * @mfp: indicate whether management frame protection is used
b23aa676 2779 * @crypto: crypto settings
fffd0934
JB
2780 * @key_len: length of WEP key for shared key authentication
2781 * @key_idx: index of WEP key for shared key authentication
2782 * @key: WEP key for shared key authentication
7e7c8926 2783 * @flags: See &enum cfg80211_assoc_req_flags
4486ea98 2784 * @bg_scan_period: Background scan period in seconds
ad24b0da 2785 * or -1 to indicate that default value is to be used.
7e7c8926 2786 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
ad24b0da 2787 * will be used in ht_capa. Un-supported values will be ignored.
7e7c8926 2788 * @ht_capa_mask: The bits of ht_capa which are to be used.
ee2aca34
JB
2789 * @vht_capa: VHT Capability overrides
2790 * @vht_capa_mask: The bits of vht_capa which are to be used.
34d50519
LD
2791 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2792 * networks.
38de03d2 2793 * @bss_select: criteria to be used for BSS selection.
35eb8f7b
JM
2794 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2795 * to indicate a request to reassociate within the ESS instead of a request
2796 * do the initial association with the ESS. When included, this is set to
2797 * the BSSID of the current association, i.e., to the value that is
2798 * included in the Current AP address field of the Reassociation Request
2799 * frame.
a3caf744
VK
2800 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2801 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2802 * data IE.
2803 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2804 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2805 * %NULL if not specified. This specifies the domain name of ER server and
2806 * is used to construct FILS wrapped data IE.
2807 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2808 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2809 * messages. This is also used to construct FILS wrapped data IE.
2810 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2811 * keys in FILS or %NULL if not specified.
2812 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
3a00df57
AS
2813 * @want_1x: indicates user-space supports and wants to use 802.1X driver
2814 * offload of 4-way handshake.
2a38075c
AAL
2815 * @edmg: define the EDMG channels.
2816 * This may specify multiple channels and bonding options for the driver
2817 * to choose from, based on BSS configuration.
b23aa676
SO
2818 */
2819struct cfg80211_connect_params {
2820 struct ieee80211_channel *channel;
1df4a510 2821 struct ieee80211_channel *channel_hint;
664834de 2822 const u8 *bssid;
1df4a510 2823 const u8 *bssid_hint;
664834de 2824 const u8 *ssid;
b23aa676
SO
2825 size_t ssid_len;
2826 enum nl80211_auth_type auth_type;
4b5800fe 2827 const u8 *ie;
b23aa676
SO
2828 size_t ie_len;
2829 bool privacy;
cee00a95 2830 enum nl80211_mfp mfp;
b23aa676 2831 struct cfg80211_crypto_settings crypto;
fffd0934
JB
2832 const u8 *key;
2833 u8 key_len, key_idx;
7e7c8926 2834 u32 flags;
4486ea98 2835 int bg_scan_period;
7e7c8926
BG
2836 struct ieee80211_ht_cap ht_capa;
2837 struct ieee80211_ht_cap ht_capa_mask;
ee2aca34
JB
2838 struct ieee80211_vht_cap vht_capa;
2839 struct ieee80211_vht_cap vht_capa_mask;
34d50519 2840 bool pbss;
38de03d2 2841 struct cfg80211_bss_selection bss_select;
ba6fbacf 2842 const u8 *prev_bssid;
a3caf744
VK
2843 const u8 *fils_erp_username;
2844 size_t fils_erp_username_len;
2845 const u8 *fils_erp_realm;
2846 size_t fils_erp_realm_len;
2847 u16 fils_erp_next_seq_num;
2848 const u8 *fils_erp_rrk;
2849 size_t fils_erp_rrk_len;
3a00df57 2850 bool want_1x;
2a38075c 2851 struct ieee80211_edmg edmg;
b23aa676
SO
2852};
2853
088e8df8 2854/**
2855 * enum cfg80211_connect_params_changed - Connection parameters being updated
2856 *
2857 * This enum provides information of all connect parameters that
2858 * have to be updated as part of update_connect_params() call.
2859 *
2860 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
7f9a3e15
VK
2861 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2862 * username, erp sequence number and rrk) are updated
2863 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
088e8df8 2864 */
2865enum cfg80211_connect_params_changed {
2866 UPDATE_ASSOC_IES = BIT(0),
7f9a3e15
VK
2867 UPDATE_FILS_ERP_INFO = BIT(1),
2868 UPDATE_AUTH_TYPE = BIT(2),
088e8df8 2869};
2870
b9a5f8ca
JM
2871/**
2872 * enum wiphy_params_flags - set_wiphy_params bitfield values
abe37c4b
JB
2873 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2874 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2875 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2876 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2877 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
3057dbfd 2878 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
52539ca8
THJ
2879 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2880 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2881 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
b9a5f8ca
JM
2882 */
2883enum wiphy_params_flags {
2884 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2885 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2886 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2887 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
81077e82 2888 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
3057dbfd 2889 WIPHY_PARAM_DYN_ACK = 1 << 5,
52539ca8
THJ
2890 WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2891 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2892 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
b9a5f8ca
JM
2893};
2894
36647055
THJ
2895#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
2896
3ace10f5
KY
2897/* The per TXQ device queue limit in airtime */
2898#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
2899#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
2900
2901/* The per interface airtime threshold to switch to lower queue limit */
2902#define IEEE80211_AQL_THRESHOLD 24000
2903
67fbb16b
SO
2904/**
2905 * struct cfg80211_pmksa - PMK Security Association
2906 *
2907 * This structure is passed to the set/del_pmksa() method for PMKSA
2908 * caching.
2909 *
a3caf744
VK
2910 * @bssid: The AP's BSSID (may be %NULL).
2911 * @pmkid: The identifier to refer a PMKSA.
2912 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2913 * derivation by a FILS STA. Otherwise, %NULL.
2914 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2915 * the hash algorithm used to generate this.
2916 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2917 * cache identifier (may be %NULL).
2918 * @ssid_len: Length of the @ssid in octets.
2919 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2920 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2921 * %NULL).
7fc82af8
VJ
2922 * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
2923 * (dot11RSNAConfigPMKLifetime) or 0 if not specified.
2924 * The configured PMKSA must not be used for PMKSA caching after
2925 * expiration and any keys derived from this PMK become invalid on
2926 * expiration, i.e., the current association must be dropped if the PMK
2927 * used for it expires.
2928 * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
2929 * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
2930 * Drivers are expected to trigger a full authentication instead of using
2931 * this PMKSA for caching when reassociating to a new BSS after this
2932 * threshold to generate a new PMK before the current one expires.
67fbb16b
SO
2933 */
2934struct cfg80211_pmksa {
c1e5f471
JB
2935 const u8 *bssid;
2936 const u8 *pmkid;
a3caf744
VK
2937 const u8 *pmk;
2938 size_t pmk_len;
2939 const u8 *ssid;
2940 size_t ssid_len;
2941 const u8 *cache_id;
7fc82af8
VJ
2942 u32 pmk_lifetime;
2943 u8 pmk_reauth_threshold;
67fbb16b 2944};
9930380f 2945
ff1b6e69 2946/**
50ac6607 2947 * struct cfg80211_pkt_pattern - packet pattern
ff1b6e69
JB
2948 * @mask: bitmask where to match pattern and where to ignore bytes,
2949 * one bit per byte, in same format as nl80211
2950 * @pattern: bytes to match where bitmask is 1
2951 * @pattern_len: length of pattern (in bytes)
bb92d199 2952 * @pkt_offset: packet offset (in bytes)
ff1b6e69
JB
2953 *
2954 * Internal note: @mask and @pattern are allocated in one chunk of
2955 * memory, free @mask only!
2956 */
50ac6607 2957struct cfg80211_pkt_pattern {
922bd80f 2958 const u8 *mask, *pattern;
ff1b6e69 2959 int pattern_len;
bb92d199 2960 int pkt_offset;
ff1b6e69
JB
2961};
2962
2a0e047e
JB
2963/**
2964 * struct cfg80211_wowlan_tcp - TCP connection parameters
2965 *
2966 * @sock: (internal) socket for source port allocation
2967 * @src: source IP address
2968 * @dst: destination IP address
2969 * @dst_mac: destination MAC address
2970 * @src_port: source port
2971 * @dst_port: destination port
2972 * @payload_len: data payload length
2973 * @payload: data payload buffer
2974 * @payload_seq: payload sequence stamping configuration
2975 * @data_interval: interval at which to send data packets
2976 * @wake_len: wakeup payload match length
2977 * @wake_data: wakeup payload match data
2978 * @wake_mask: wakeup payload match mask
2979 * @tokens_size: length of the tokens buffer
2980 * @payload_tok: payload token usage configuration
2981 */
2982struct cfg80211_wowlan_tcp {
2983 struct socket *sock;
2984 __be32 src, dst;
2985 u16 src_port, dst_port;
2986 u8 dst_mac[ETH_ALEN];
2987 int payload_len;
2988 const u8 *payload;
2989 struct nl80211_wowlan_tcp_data_seq payload_seq;
2990 u32 data_interval;
2991 u32 wake_len;
2992 const u8 *wake_data, *wake_mask;
2993 u32 tokens_size;
2994 /* must be last, variable member */
2995 struct nl80211_wowlan_tcp_data_token payload_tok;
ff1b6e69
JB
2996};
2997
2998/**
2999 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3000 *
3001 * This structure defines the enabled WoWLAN triggers for the device.
3002 * @any: wake up on any activity -- special trigger if device continues
3003 * operating as normal during suspend
3004 * @disconnect: wake up if getting disconnected
3005 * @magic_pkt: wake up on receiving magic packet
3006 * @patterns: wake up on receiving packet matching a pattern
3007 * @n_patterns: number of patterns
77dbbb13
JB
3008 * @gtk_rekey_failure: wake up on GTK rekey failure
3009 * @eap_identity_req: wake up on EAP identity request packet
3010 * @four_way_handshake: wake up on 4-way handshake
3011 * @rfkill_release: wake up when rfkill is released
2a0e047e
JB
3012 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
3013 * NULL if not configured.
8cd4d456 3014 * @nd_config: configuration for the scan to be used for net detect wake.
ff1b6e69
JB
3015 */
3016struct cfg80211_wowlan {
77dbbb13
JB
3017 bool any, disconnect, magic_pkt, gtk_rekey_failure,
3018 eap_identity_req, four_way_handshake,
3019 rfkill_release;
50ac6607 3020 struct cfg80211_pkt_pattern *patterns;
2a0e047e 3021 struct cfg80211_wowlan_tcp *tcp;
ff1b6e69 3022 int n_patterns;
8cd4d456 3023 struct cfg80211_sched_scan_request *nd_config;
ff1b6e69
JB
3024};
3025
be29b99a
AK
3026/**
3027 * struct cfg80211_coalesce_rules - Coalesce rule parameters
3028 *
3029 * This structure defines coalesce rule for the device.
3030 * @delay: maximum coalescing delay in msecs.
3031 * @condition: condition for packet coalescence.
3032 * see &enum nl80211_coalesce_condition.
3033 * @patterns: array of packet patterns
3034 * @n_patterns: number of patterns
3035 */
3036struct cfg80211_coalesce_rules {
3037 int delay;
3038 enum nl80211_coalesce_condition condition;
3039 struct cfg80211_pkt_pattern *patterns;
3040 int n_patterns;
3041};
3042
3043/**
3044 * struct cfg80211_coalesce - Packet coalescing settings
3045 *
3046 * This structure defines coalescing settings.
3047 * @rules: array of coalesce rules
3048 * @n_rules: number of rules
3049 */
3050struct cfg80211_coalesce {
3051 struct cfg80211_coalesce_rules *rules;
3052 int n_rules;
3053};
3054
8cd4d456
LC
3055/**
3056 * struct cfg80211_wowlan_nd_match - information about the match
3057 *
3058 * @ssid: SSID of the match that triggered the wake up
3059 * @n_channels: Number of channels where the match occurred. This
3060 * value may be zero if the driver can't report the channels.
3061 * @channels: center frequencies of the channels where a match
3062 * occurred (in MHz)
3063 */
3064struct cfg80211_wowlan_nd_match {
3065 struct cfg80211_ssid ssid;
3066 int n_channels;
3067 u32 channels[];
3068};
3069
3070/**
3071 * struct cfg80211_wowlan_nd_info - net detect wake up information
3072 *
3073 * @n_matches: Number of match information instances provided in
3074 * @matches. This value may be zero if the driver can't provide
3075 * match information.
3076 * @matches: Array of pointers to matches containing information about
3077 * the matches that triggered the wake up.
3078 */
3079struct cfg80211_wowlan_nd_info {
3080 int n_matches;
3081 struct cfg80211_wowlan_nd_match *matches[];
3082};
3083
cd8f7cb4
JB
3084/**
3085 * struct cfg80211_wowlan_wakeup - wakeup report
3086 * @disconnect: woke up by getting disconnected
3087 * @magic_pkt: woke up by receiving magic packet
3088 * @gtk_rekey_failure: woke up by GTK rekey failure
3089 * @eap_identity_req: woke up by EAP identity request packet
3090 * @four_way_handshake: woke up by 4-way handshake
3091 * @rfkill_release: woke up by rfkill being released
3092 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3093 * @packet_present_len: copied wakeup packet data
3094 * @packet_len: original wakeup packet length
3095 * @packet: The packet causing the wakeup, if any.
3096 * @packet_80211: For pattern match, magic packet and other data
3097 * frame triggers an 802.3 frame should be reported, for
3098 * disconnect due to deauth 802.11 frame. This indicates which
3099 * it is.
2a0e047e
JB
3100 * @tcp_match: TCP wakeup packet received
3101 * @tcp_connlost: TCP connection lost or failed to establish
3102 * @tcp_nomoretokens: TCP data ran out of tokens
8cd4d456 3103 * @net_detect: if not %NULL, woke up because of net detect
cd8f7cb4
JB
3104 */
3105struct cfg80211_wowlan_wakeup {
3106 bool disconnect, magic_pkt, gtk_rekey_failure,
3107 eap_identity_req, four_way_handshake,
2a0e047e
JB
3108 rfkill_release, packet_80211,
3109 tcp_match, tcp_connlost, tcp_nomoretokens;
cd8f7cb4
JB
3110 s32 pattern_idx;
3111 u32 packet_present_len, packet_len;
3112 const void *packet;
8cd4d456 3113 struct cfg80211_wowlan_nd_info *net_detect;
cd8f7cb4
JB
3114};
3115
e5497d76
JB
3116/**
3117 * struct cfg80211_gtk_rekey_data - rekey data
093a48d2
NE
3118 * @kek: key encryption key (@kek_len bytes)
3119 * @kck: key confirmation key (@kck_len bytes)
78f686ca 3120 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
093a48d2
NE
3121 * @kek_len: length of kek
3122 * @kck_len length of kck
3123 * @akm: akm (oui, id)
e5497d76
JB
3124 */
3125struct cfg80211_gtk_rekey_data {
78f686ca 3126 const u8 *kek, *kck, *replay_ctr;
093a48d2
NE
3127 u32 akm;
3128 u8 kek_len, kck_len;
e5497d76
JB
3129};
3130
355199e0
JM
3131/**
3132 * struct cfg80211_update_ft_ies_params - FT IE Information
3133 *
3134 * This structure provides information needed to update the fast transition IE
3135 *
3136 * @md: The Mobility Domain ID, 2 Octet value
3137 * @ie: Fast Transition IEs
3138 * @ie_len: Length of ft_ie in octets
3139 */
3140struct cfg80211_update_ft_ies_params {
3141 u16 md;
3142 const u8 *ie;
3143 size_t ie_len;
3144};
3145
b176e629
AO
3146/**
3147 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3148 *
3149 * This structure provides information needed to transmit a mgmt frame
3150 *
3151 * @chan: channel to use
3152 * @offchan: indicates wether off channel operation is required
3153 * @wait: duration for ROC
3154 * @buf: buffer to transmit
3155 * @len: buffer length
3156 * @no_cck: don't use cck rates for this frame
3157 * @dont_wait_for_ack: tells the low level not to wait for an ack
34d22ce2
AO
3158 * @n_csa_offsets: length of csa_offsets array
3159 * @csa_offsets: array of all the csa offsets in the frame
b176e629
AO
3160 */
3161struct cfg80211_mgmt_tx_params {
3162 struct ieee80211_channel *chan;
3163 bool offchan;
3164 unsigned int wait;
3165 const u8 *buf;
3166 size_t len;
3167 bool no_cck;
3168 bool dont_wait_for_ack;
34d22ce2
AO
3169 int n_csa_offsets;
3170 const u16 *csa_offsets;
b176e629
AO
3171};
3172
fa9ffc74
KP
3173/**
3174 * struct cfg80211_dscp_exception - DSCP exception
3175 *
3176 * @dscp: DSCP value that does not adhere to the user priority range definition
3177 * @up: user priority value to which the corresponding DSCP value belongs
3178 */
3179struct cfg80211_dscp_exception {
3180 u8 dscp;
3181 u8 up;
3182};
3183
3184/**
3185 * struct cfg80211_dscp_range - DSCP range definition for user priority
3186 *
3187 * @low: lowest DSCP value of this user priority range, inclusive
3188 * @high: highest DSCP value of this user priority range, inclusive
3189 */
3190struct cfg80211_dscp_range {
3191 u8 low;
3192 u8 high;
3193};
3194
3195/* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3196#define IEEE80211_QOS_MAP_MAX_EX 21
3197#define IEEE80211_QOS_MAP_LEN_MIN 16
3198#define IEEE80211_QOS_MAP_LEN_MAX \
3199 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3200
3201/**
3202 * struct cfg80211_qos_map - QoS Map Information
3203 *
3204 * This struct defines the Interworking QoS map setting for DSCP values
3205 *
3206 * @num_des: number of DSCP exceptions (0..21)
3207 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3208 * the user priority DSCP range definition
3209 * @up: DSCP range definition for a particular user priority
3210 */
3211struct cfg80211_qos_map {
3212 u8 num_des;
3213 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3214 struct cfg80211_dscp_range up[8];
3215};
3216
cb3b7d87
AB
3217/**
3218 * struct cfg80211_nan_conf - NAN configuration
3219 *
3220 * This struct defines NAN configuration parameters
3221 *
3222 * @master_pref: master preference (1 - 255)
8585989d
LC
3223 * @bands: operating bands, a bitmap of &enum nl80211_band values.
3224 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
3225 * (i.e. BIT(NL80211_BAND_2GHZ)).
cb3b7d87
AB
3226 */
3227struct cfg80211_nan_conf {
3228 u8 master_pref;
8585989d 3229 u8 bands;
cb3b7d87
AB
3230};
3231
a5a9dcf2
AB
3232/**
3233 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3234 * configuration
3235 *
3236 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
8585989d 3237 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
a5a9dcf2
AB
3238 */
3239enum cfg80211_nan_conf_changes {
3240 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
8585989d 3241 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
a5a9dcf2
AB
3242};
3243
a442b761
AB
3244/**
3245 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3246 *
3247 * @filter: the content of the filter
3248 * @len: the length of the filter
3249 */
3250struct cfg80211_nan_func_filter {
3251 const u8 *filter;
3252 u8 len;
3253};
3254
3255/**
3256 * struct cfg80211_nan_func - a NAN function
3257 *
3258 * @type: &enum nl80211_nan_function_type
3259 * @service_id: the service ID of the function
3260 * @publish_type: &nl80211_nan_publish_type
3261 * @close_range: if true, the range should be limited. Threshold is
3262 * implementation specific.
3263 * @publish_bcast: if true, the solicited publish should be broadcasted
3264 * @subscribe_active: if true, the subscribe is active
3265 * @followup_id: the instance ID for follow up
3266 * @followup_reqid: the requestor instance ID for follow up
3267 * @followup_dest: MAC address of the recipient of the follow up
3268 * @ttl: time to live counter in DW.
3269 * @serv_spec_info: Service Specific Info
3270 * @serv_spec_info_len: Service Specific Info length
3271 * @srf_include: if true, SRF is inclusive
3272 * @srf_bf: Bloom Filter
3273 * @srf_bf_len: Bloom Filter length
3274 * @srf_bf_idx: Bloom Filter index
3275 * @srf_macs: SRF MAC addresses
3276 * @srf_num_macs: number of MAC addresses in SRF
3277 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3278 * @tx_filters: filters that should be transmitted in the SDF.
3279 * @num_rx_filters: length of &rx_filters.
3280 * @num_tx_filters: length of &tx_filters.
3281 * @instance_id: driver allocated id of the function.
3282 * @cookie: unique NAN function identifier.
3283 */
3284struct cfg80211_nan_func {
3285 enum nl80211_nan_function_type type;
3286 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3287 u8 publish_type;
3288 bool close_range;
3289 bool publish_bcast;
3290 bool subscribe_active;
3291 u8 followup_id;
3292 u8 followup_reqid;
3293 struct mac_address followup_dest;
3294 u32 ttl;
3295 const u8 *serv_spec_info;
3296 u8 serv_spec_info_len;
3297 bool srf_include;
3298 const u8 *srf_bf;
3299 u8 srf_bf_len;
3300 u8 srf_bf_idx;
3301 struct mac_address *srf_macs;
3302 int srf_num_macs;
3303 struct cfg80211_nan_func_filter *rx_filters;
3304 struct cfg80211_nan_func_filter *tx_filters;
3305 u8 num_tx_filters;
3306 u8 num_rx_filters;
3307 u8 instance_id;
3308 u64 cookie;
3309};
3310
3a00df57
AS
3311/**
3312 * struct cfg80211_pmk_conf - PMK configuration
3313 *
3314 * @aa: authenticator address
3315 * @pmk_len: PMK length in bytes.
3316 * @pmk: the PMK material
3317 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
3318 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
3319 * holds PMK-R0.
3320 */
3321struct cfg80211_pmk_conf {
3322 const u8 *aa;
3323 u8 pmk_len;
3324 const u8 *pmk;
3325 const u8 *pmk_r0_name;
3326};
3327
40cbfa90
SD
3328/**
3329 * struct cfg80211_external_auth_params - Trigger External authentication.
3330 *
3331 * Commonly used across the external auth request and event interfaces.
3332 *
3333 * @action: action type / trigger for external authentication. Only significant
3334 * for the authentication request event interface (driver to user space).
3335 * @bssid: BSSID of the peer with which the authentication has
3336 * to happen. Used by both the authentication request event and
3337 * authentication response command interface.
3338 * @ssid: SSID of the AP. Used by both the authentication request event and
3339 * authentication response command interface.
3340 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
3341 * authentication request event interface.
3342 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
3343 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
3344 * the real status code for failures. Used only for the authentication
3345 * response command interface (user space to driver).
fe494370 3346 * @pmkid: The identifier to refer a PMKSA.
40cbfa90
SD
3347 */
3348struct cfg80211_external_auth_params {
3349 enum nl80211_external_auth_action action;
3350 u8 bssid[ETH_ALEN] __aligned(2);
3351 struct cfg80211_ssid ssid;
3352 unsigned int key_mgmt_suite;
3353 u16 status;
fe494370 3354 const u8 *pmkid;
40cbfa90
SD
3355};
3356
81e54d08 3357/**
3453de98 3358 * struct cfg80211_ftm_responder_stats - FTM responder statistics
81e54d08
PKC
3359 *
3360 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
3361 * indicate the relevant values in this struct for them
3362 * @success_num: number of FTM sessions in which all frames were successfully
3363 * answered
3364 * @partial_num: number of FTM sessions in which part of frames were
3365 * successfully answered
3366 * @failed_num: number of failed FTM sessions
3367 * @asap_num: number of ASAP FTM sessions
3368 * @non_asap_num: number of non-ASAP FTM sessions
3369 * @total_duration_ms: total sessions durations - gives an indication
3370 * of how much time the responder was busy
3371 * @unknown_triggers_num: number of unknown FTM triggers - triggers from
3372 * initiators that didn't finish successfully the negotiation phase with
3373 * the responder
3374 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
3375 * for a new scheduling although it already has scheduled FTM slot
3376 * @out_of_window_triggers_num: total FTM triggers out of scheduled window
3377 */
3378struct cfg80211_ftm_responder_stats {
3379 u32 filled;
3380 u32 success_num;
3381 u32 partial_num;
3382 u32 failed_num;
3383 u32 asap_num;
3384 u32 non_asap_num;
3385 u64 total_duration_ms;
3386 u32 unknown_triggers_num;
3387 u32 reschedule_requests_num;
3388 u32 out_of_window_triggers_num;
3389};
3390
9bb7e0f2
JB
3391/**
3392 * struct cfg80211_pmsr_ftm_result - FTM result
3393 * @failure_reason: if this measurement failed (PMSR status is
3394 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
3395 * reason than just "failure"
3396 * @burst_index: if reporting partial results, this is the index
3397 * in [0 .. num_bursts-1] of the burst that's being reported
3398 * @num_ftmr_attempts: number of FTM request frames transmitted
3399 * @num_ftmr_successes: number of FTM request frames acked
3400 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
3401 * fill this to indicate in how many seconds a retry is deemed possible
3402 * by the responder
3403 * @num_bursts_exp: actual number of bursts exponent negotiated
3404 * @burst_duration: actual burst duration negotiated
3405 * @ftms_per_burst: actual FTMs per burst negotiated
3406 * @lci_len: length of LCI information (if present)
3407 * @civicloc_len: length of civic location information (if present)
3408 * @lci: LCI data (may be %NULL)
3409 * @civicloc: civic location data (may be %NULL)
3410 * @rssi_avg: average RSSI over FTM action frames reported
3411 * @rssi_spread: spread of the RSSI over FTM action frames reported
3412 * @tx_rate: bitrate for transmitted FTM action frame response
3413 * @rx_rate: bitrate of received FTM action frame
3414 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
3415 * @rtt_variance: variance of RTTs measured (note that standard deviation is
3416 * the square root of the variance)
3417 * @rtt_spread: spread of the RTTs measured
3418 * @dist_avg: average of distances (mm) measured
3419 * (must have either this or @rtt_avg)
3420 * @dist_variance: variance of distances measured (see also @rtt_variance)
3421 * @dist_spread: spread of distances measured (see also @rtt_spread)
3422 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
3423 * @num_ftmr_successes_valid: @num_ftmr_successes is valid
3424 * @rssi_avg_valid: @rssi_avg is valid
3425 * @rssi_spread_valid: @rssi_spread is valid
3426 * @tx_rate_valid: @tx_rate is valid
3427 * @rx_rate_valid: @rx_rate is valid
3428 * @rtt_avg_valid: @rtt_avg is valid
3429 * @rtt_variance_valid: @rtt_variance is valid
3430 * @rtt_spread_valid: @rtt_spread is valid
3431 * @dist_avg_valid: @dist_avg is valid
3432 * @dist_variance_valid: @dist_variance is valid
3433 * @dist_spread_valid: @dist_spread is valid
3434 */
3435struct cfg80211_pmsr_ftm_result {
3436 const u8 *lci;
3437 const u8 *civicloc;
3438 unsigned int lci_len;
3439 unsigned int civicloc_len;
3440 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
3441 u32 num_ftmr_attempts, num_ftmr_successes;
3442 s16 burst_index;
3443 u8 busy_retry_time;
3444 u8 num_bursts_exp;
3445 u8 burst_duration;
3446 u8 ftms_per_burst;
3447 s32 rssi_avg;
3448 s32 rssi_spread;
3449 struct rate_info tx_rate, rx_rate;
3450 s64 rtt_avg;
3451 s64 rtt_variance;
3452 s64 rtt_spread;
3453 s64 dist_avg;
3454 s64 dist_variance;
3455 s64 dist_spread;
3456
3457 u16 num_ftmr_attempts_valid:1,
3458 num_ftmr_successes_valid:1,
3459 rssi_avg_valid:1,
3460 rssi_spread_valid:1,
3461 tx_rate_valid:1,
3462 rx_rate_valid:1,
3463 rtt_avg_valid:1,
3464 rtt_variance_valid:1,
3465 rtt_spread_valid:1,
3466 dist_avg_valid:1,
3467 dist_variance_valid:1,
3468 dist_spread_valid:1;
3469};
3470
3471/**
3472 * struct cfg80211_pmsr_result - peer measurement result
3473 * @addr: address of the peer
3474 * @host_time: host time (use ktime_get_boottime() adjust to the time when the
3475 * measurement was made)
3476 * @ap_tsf: AP's TSF at measurement time
3477 * @status: status of the measurement
3478 * @final: if reporting partial results, mark this as the last one; if not
3479 * reporting partial results always set this flag
3480 * @ap_tsf_valid: indicates the @ap_tsf value is valid
3481 * @type: type of the measurement reported, note that we only support reporting
3482 * one type at a time, but you can report multiple results separately and
3483 * they're all aggregated for userspace.
3484 */
3485struct cfg80211_pmsr_result {
3486 u64 host_time, ap_tsf;
3487 enum nl80211_peer_measurement_status status;
3488
3489 u8 addr[ETH_ALEN];
3490
3491 u8 final:1,
3492 ap_tsf_valid:1;
3493
3494 enum nl80211_peer_measurement_type type;
3495
3496 union {
3497 struct cfg80211_pmsr_ftm_result ftm;
3498 };
3499};
3500
3501/**
3502 * struct cfg80211_pmsr_ftm_request_peer - FTM request data
3503 * @requested: indicates FTM is requested
3504 * @preamble: frame preamble to use
3505 * @burst_period: burst period to use
3506 * @asap: indicates to use ASAP mode
3507 * @num_bursts_exp: number of bursts exponent
3508 * @burst_duration: burst duration
3509 * @ftms_per_burst: number of FTMs per burst
3510 * @ftmr_retries: number of retries for FTM request
3511 * @request_lci: request LCI information
3512 * @request_civicloc: request civic location information
efb5520d
AS
3513 * @trigger_based: use trigger based ranging for the measurement
3514 * If neither @trigger_based nor @non_trigger_based is set,
3515 * EDCA based ranging will be used.
3516 * @non_trigger_based: use non trigger based ranging for the measurement
3517 * If neither @trigger_based nor @non_trigger_based is set,
3518 * EDCA based ranging will be used.
9bb7e0f2
JB
3519 *
3520 * See also nl80211 for the respective attribute documentation.
3521 */
3522struct cfg80211_pmsr_ftm_request_peer {
3523 enum nl80211_preamble preamble;
3524 u16 burst_period;
3525 u8 requested:1,
3526 asap:1,
3527 request_lci:1,
efb5520d
AS
3528 request_civicloc:1,
3529 trigger_based:1,
3530 non_trigger_based:1;
9bb7e0f2
JB
3531 u8 num_bursts_exp;
3532 u8 burst_duration;
3533 u8 ftms_per_burst;
3534 u8 ftmr_retries;
3535};
3536
3537/**
3538 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
3539 * @addr: MAC address
3540 * @chandef: channel to use
3541 * @report_ap_tsf: report the associated AP's TSF
3542 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
3543 */
3544struct cfg80211_pmsr_request_peer {
3545 u8 addr[ETH_ALEN];
3546 struct cfg80211_chan_def chandef;
3547 u8 report_ap_tsf:1;
3548 struct cfg80211_pmsr_ftm_request_peer ftm;
3549};
3550
3551/**
3552 * struct cfg80211_pmsr_request - peer measurement request
3553 * @cookie: cookie, set by cfg80211
3554 * @nl_portid: netlink portid - used by cfg80211
3555 * @drv_data: driver data for this request, if required for aborting,
3556 * not otherwise freed or anything by cfg80211
3557 * @mac_addr: MAC address used for (randomised) request
3558 * @mac_addr_mask: MAC address mask used for randomisation, bits that
3559 * are 0 in the mask should be randomised, bits that are 1 should
3560 * be taken from the @mac_addr
3561 * @list: used by cfg80211 to hold on to the request
3562 * @timeout: timeout (in milliseconds) for the whole operation, if
3563 * zero it means there's no timeout
3564 * @n_peers: number of peers to do measurements with
3565 * @peers: per-peer measurement request data
3566 */
3567struct cfg80211_pmsr_request {
3568 u64 cookie;
3569 void *drv_data;
3570 u32 n_peers;
3571 u32 nl_portid;
3572
3573 u32 timeout;
3574
3575 u8 mac_addr[ETH_ALEN] __aligned(2);
3576 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3577
3578 struct list_head list;
3579
3580 struct cfg80211_pmsr_request_peer peers[];
3581};
3582
cb74e977
SD
3583/**
3584 * struct cfg80211_update_owe_info - OWE Information
3585 *
3586 * This structure provides information needed for the drivers to offload OWE
3587 * (Opportunistic Wireless Encryption) processing to the user space.
3588 *
3589 * Commonly used across update_owe_info request and event interfaces.
3590 *
3591 * @peer: MAC address of the peer device for which the OWE processing
3592 * has to be done.
3593 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3594 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3595 * cannot give you the real status code for failures. Used only for
3596 * OWE update request command interface (user space to driver).
3597 * @ie: IEs obtained from the peer or constructed by the user space. These are
3598 * the IEs of the remote peer in the event from the host driver and
3599 * the constructed IEs by the user space in the request interface.
3600 * @ie_len: Length of IEs in octets.
3601 */
3602struct cfg80211_update_owe_info {
3603 u8 peer[ETH_ALEN] __aligned(2);
3604 u16 status;
3605 const u8 *ie;
3606 size_t ie_len;
3607};
3608
6cd536fe
JB
3609/**
3610 * struct mgmt_frame_regs - management frame registrations data
3611 * @global_stypes: bitmap of management frame subtypes registered
3612 * for the entire device
3613 * @interface_stypes: bitmap of management frame subtypes registered
3614 * for the given interface
9dba48a6
JB
3615 * @global_mcast_rx: mcast RX is needed globally for these subtypes
3616 * @interface_mcast_stypes: mcast RX is needed on this interface
3617 * for these subtypes
6cd536fe
JB
3618 */
3619struct mgmt_frame_regs {
3620 u32 global_stypes, interface_stypes;
9dba48a6 3621 u32 global_mcast_stypes, interface_mcast_stypes;
6cd536fe
JB
3622};
3623
704232c2
JB
3624/**
3625 * struct cfg80211_ops - backend description for wireless configuration
3626 *
3627 * This struct is registered by fullmac card drivers and/or wireless stacks
3628 * in order to handle configuration requests on their interfaces.
3629 *
3630 * All callbacks except where otherwise noted should return 0
3631 * on success or a negative error code.
3632 *
43fb45cb
JB
3633 * All operations are currently invoked under rtnl for consistency with the
3634 * wireless extensions but this is subject to reevaluation as soon as this
3635 * code is used more widely and we have a first user without wext.
3636 *
ff1b6e69
JB
3637 * @suspend: wiphy device needs to be suspended. The variable @wow will
3638 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
3639 * configured for the device.
0378b3f1 3640 * @resume: wiphy device needs to be resumed
6d52563f
JB
3641 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
3642 * to call device_set_wakeup_enable() to enable/disable wakeup from
3643 * the device.
0378b3f1 3644 *
60719ffd 3645 * @add_virtual_intf: create a new virtual interface with the given name,
463d0183 3646 * must set the struct wireless_dev's iftype. Beware: You must create
84efbb84 3647 * the new netdev in the wiphy's network namespace! Returns the struct
98104fde
JB
3648 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
3649 * also set the address member in the wdev.
704232c2 3650 *
84efbb84 3651 * @del_virtual_intf: remove the virtual interface
55682965 3652 *
60719ffd
JB
3653 * @change_virtual_intf: change type/configuration of virtual interface,
3654 * keep the struct wireless_dev's iftype updated.
55682965 3655 *
41ade00f
JB
3656 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
3657 * when adding a group key.
3658 *
3659 * @get_key: get information about the key with the given parameters.
3660 * @mac_addr will be %NULL when requesting information for a group
3661 * key. All pointers given to the @callback function need not be valid
e3da574a
JB
3662 * after it returns. This function should return an error if it is
3663 * not possible to retrieve the key, -ENOENT if it doesn't exist.
41ade00f
JB
3664 *
3665 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
e3da574a 3666 * and @key_index, return -ENOENT if the key doesn't exist.
41ade00f
JB
3667 *
3668 * @set_default_key: set the default key on an interface
ed1b6cc7 3669 *
3cfcf6ac 3670 * @set_default_mgmt_key: set the default management frame key on an interface
1f7e9f46 3671 *
56be393f 3672 * @set_default_beacon_key: set the default Beacon frame key on an interface
3cfcf6ac 3673 *
e5497d76
JB
3674 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3675 *
c04a4ff7
JB
3676 * @start_ap: Start acting in AP mode defined by the parameters.
3677 * @change_beacon: Change the beacon parameters for an access point mode
3678 * interface. This should reject the call when AP mode wasn't started.
3679 * @stop_ap: Stop being an AP, including stopping beaconing.
5727ef1b
JB
3680 *
3681 * @add_station: Add a new station.
89c771e5 3682 * @del_station: Remove a station
bdd90d5e
JB
3683 * @change_station: Modify a given station. Note that flags changes are not much
3684 * validated in cfg80211, in particular the auth/assoc/authorized flags
3685 * might come to the driver in invalid combinations -- make sure to check
77ee7c89
JB
3686 * them, also against the existing state! Drivers must call
3687 * cfg80211_check_station_change() to validate the information.
abe37c4b
JB
3688 * @get_station: get station information for the station identified by @mac
3689 * @dump_station: dump station callback -- resume dump at index @idx
3690 *
3691 * @add_mpath: add a fixed mesh path
3692 * @del_mpath: delete a given mesh path
3693 * @change_mpath: change a given mesh path
3694 * @get_mpath: get a mesh path for the given parameters
3695 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
66be7d2b
HR
3696 * @get_mpp: get a mesh proxy path for the given parameters
3697 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
f52555a4 3698 * @join_mesh: join the mesh network with the specified parameters
8d61ffa5 3699 * (invoked with the wireless_dev mutex held)
f52555a4 3700 * @leave_mesh: leave the current mesh network
8d61ffa5 3701 * (invoked with the wireless_dev mutex held)
2ec600d6 3702 *
24bdd9f4 3703 * @get_mesh_config: Get the current mesh configuration
93da9cc1 3704 *
24bdd9f4 3705 * @update_mesh_config: Update mesh parameters on a running mesh.
93da9cc1 3706 * The mask is a bitfield which tells us which parameters to
3707 * set, and which to leave alone.
3708 *
9f1ba906 3709 * @change_bss: Modify parameters for a given BSS.
31888487
JM
3710 *
3711 * @set_txq_params: Set TX queue parameters
72bdcf34 3712 *
e8c9bd5b
JB
3713 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3714 * as it doesn't implement join_mesh and needs to set the channel to
3715 * join the mesh instead.
3716 *
3717 * @set_monitor_channel: Set the monitor mode channel for the device. If other
3718 * interfaces are active this callback should reject the configuration.
3719 * If no interfaces are active or the device is down, the channel should
3720 * be stored for when a monitor interface becomes active.
9aed3cc1 3721 *
2a519311
JB
3722 * @scan: Request to do a scan. If returning zero, the scan request is given
3723 * the driver, and will be valid until passed to cfg80211_scan_done().
3724 * For scan results, call cfg80211_inform_bss(); you can call this outside
3725 * the scan/scan_done bracket too.
91d3ab46
VK
3726 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
3727 * indicate the status of the scan through cfg80211_scan_done().
636a5d36
JM
3728 *
3729 * @auth: Request to authenticate with the specified peer
8d61ffa5 3730 * (invoked with the wireless_dev mutex held)
636a5d36 3731 * @assoc: Request to (re)associate with the specified peer
8d61ffa5 3732 * (invoked with the wireless_dev mutex held)
636a5d36 3733 * @deauth: Request to deauthenticate from the specified peer
8d61ffa5 3734 * (invoked with the wireless_dev mutex held)
636a5d36 3735 * @disassoc: Request to disassociate from the specified peer
8d61ffa5 3736 * (invoked with the wireless_dev mutex held)
04a773ad 3737 *
b23aa676 3738 * @connect: Connect to the ESS with the specified parameters. When connected,
bf1ecd21
JM
3739 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3740 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3741 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3742 * from the AP or cfg80211_connect_timeout() if no frame with status code
3743 * was received.
3744 * The driver is allowed to roam to other BSSes within the ESS when the
3745 * other BSS matches the connect parameters. When such roaming is initiated
3746 * by the driver, the driver is expected to verify that the target matches
3747 * the configured security parameters and to use Reassociation Request
3748 * frame instead of Association Request frame.
3749 * The connect function can also be used to request the driver to perform a
3750 * specific roam when connected to an ESS. In that case, the prev_bssid
35eb8f7b 3751 * parameter is set to the BSSID of the currently associated BSS as an
bf1ecd21
JM
3752 * indication of requesting reassociation.
3753 * In both the driver-initiated and new connect() call initiated roaming
3754 * cases, the result of roaming is indicated with a call to
29ce6ecb 3755 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
088e8df8 3756 * @update_connect_params: Update the connect parameters while connected to a
3757 * BSS. The updated parameters can be used by driver/firmware for
3758 * subsequent BSS selection (roaming) decisions and to form the
3759 * Authentication/(Re)Association Request frames. This call does not
3760 * request an immediate disassociation or reassociation with the current
3761 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
3762 * changed are defined in &enum cfg80211_connect_params_changed.
3763 * (invoked with the wireless_dev mutex held)
0711d638
IP
3764 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
3765 * connection is in progress. Once done, call cfg80211_disconnected() in
3766 * case connection was already established (invoked with the
3767 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
b23aa676 3768 *
04a773ad
JB
3769 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
3770 * cfg80211_ibss_joined(), also call that function when changing BSSID due
3771 * to a merge.
8d61ffa5 3772 * (invoked with the wireless_dev mutex held)
04a773ad 3773 * @leave_ibss: Leave the IBSS.
8d61ffa5 3774 * (invoked with the wireless_dev mutex held)
b9a5f8ca 3775 *
f4e583c8
AQ
3776 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3777 * MESH mode)
3778 *
b9a5f8ca
JM
3779 * @set_wiphy_params: Notify that wiphy parameters have changed;
3780 * @changed bitfield (see &enum wiphy_params_flags) describes which values
3781 * have changed. The actual parameter values are available in
3782 * struct wiphy. If returning an error, no value should be changed.
7643a2c3 3783 *
1432de07 3784 * @set_tx_power: set the transmit power according to the parameters,
c8442118
JB
3785 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3786 * wdev may be %NULL if power was set for the wiphy, and will
3787 * always be %NULL unless the driver supports per-vif TX power
3788 * (as advertised by the nl80211 feature flag.)
7643a2c3 3789 * @get_tx_power: store the current TX power into the dbm variable;
1f87f7d3
JB
3790 * return 0 if successful
3791 *
3792 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
3793 * functions to adjust rfkill hw state
aff89a9b 3794 *
61fa713c
HS
3795 * @dump_survey: get site survey information.
3796 *
9588bbd5
JM
3797 * @remain_on_channel: Request the driver to remain awake on the specified
3798 * channel for the specified duration to complete an off-channel
3799 * operation (e.g., public action frame exchange). When the driver is
3800 * ready on the requested channel, it must indicate this with an event
3801 * notification by calling cfg80211_ready_on_channel().
3802 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
3803 * This allows the operation to be terminated prior to timeout based on
3804 * the duration value.
f7ca38df
JB
3805 * @mgmt_tx: Transmit a management frame.
3806 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3807 * frame on another channel
9588bbd5 3808 *
fc73f11f 3809 * @testmode_cmd: run a test mode command; @wdev may be %NULL
71063f0e
WYG
3810 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
3811 * used by the function, but 0 and 1 must not be touched. Additionally,
3812 * return error codes other than -ENOBUFS and -ENOENT will terminate the
3813 * dump and return to userspace with an error, so be careful. If any data
3814 * was passed in from userspace then the data/len arguments will be present
3815 * and point to the data contained in %NL80211_ATTR_TESTDATA.
67fbb16b 3816 *
abe37c4b
JB
3817 * @set_bitrate_mask: set the bitrate mask configuration
3818 *
67fbb16b
SO
3819 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
3820 * devices running firmwares capable of generating the (re) association
3821 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
3822 * @del_pmksa: Delete a cached PMKID.
3823 * @flush_pmksa: Flush all cached PMKIDs.
9043f3b8
JO
3824 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
3825 * allows the driver to adjust the dynamic ps timeout value.
d6dc1a38 3826 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
e86abc68
JB
3827 * After configuration, the driver should (soon) send an event indicating
3828 * the current level is above/below the configured threshold; this may
3829 * need some care when the configuration is changed (without first being
3830 * disabled.)
4a4b8169
AZ
3831 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
3832 * connection quality monitor. An event is to be sent only when the
3833 * signal level is found to be outside the two values. The driver should
3834 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
3835 * If it is provided then there's no point providing @set_cqm_rssi_config.
84f10708
TP
3836 * @set_cqm_txe_config: Configure connection quality monitor TX error
3837 * thresholds.
807f8a8c 3838 * @sched_scan_start: Tell the driver to start a scheduled scan.
3a3ecf1d
AVS
3839 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
3840 * given request id. This call must stop the scheduled scan and be ready
3841 * for starting a new one before it returns, i.e. @sched_scan_start may be
3842 * called immediately after that again and should not fail in that case.
3843 * The driver should not call cfg80211_sched_scan_stopped() for a requested
3844 * stop (when this method returns 0).
67fbb16b 3845 *
6cd536fe
JB
3846 * @update_mgmt_frame_registrations: Notify the driver that management frame
3847 * registrations were updated. The callback is allowed to sleep.
547025d5
BR
3848 *
3849 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3850 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3851 * reject TX/RX mask combinations they cannot support by returning -EINVAL
3852 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3853 *
3854 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
3677713b 3855 *
109086ce
AN
3856 * @tdls_mgmt: Transmit a TDLS management frame.
3857 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
7f6cf311
JB
3858 *
3859 * @probe_client: probe an associated client, must return a cookie that it
3860 * later passes to cfg80211_probe_status().
1d9d9213
SW
3861 *
3862 * @set_noack_map: Set the NoAck Map for the TIDs.
d6199218 3863 *
5b7ccaf3
JB
3864 * @get_channel: Get the current operating channel for the virtual interface.
3865 * For monitor interfaces, it should return %NULL unless there's a single
3866 * current monitoring channel.
98104fde
JB
3867 *
3868 * @start_p2p_device: Start the given P2P device.
3869 * @stop_p2p_device: Stop the given P2P device.
77765eaf
VT
3870 *
3871 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
3872 * Parameters include ACL policy, an array of MAC address of stations
3873 * and the number of MAC addresses. If there is already a list in driver
3874 * this new list replaces the existing one. Driver has to clear its ACL
3875 * when number of MAC addresses entries is passed as 0. Drivers which
3876 * advertise the support for MAC based ACL have to implement this callback.
04f39047
SW
3877 *
3878 * @start_radar_detection: Start radar detection in the driver.
8bf24293 3879 *
26ec17a1
OM
3880 * @end_cac: End running CAC, probably because a related CAC
3881 * was finished on another phy.
3882 *
8bf24293
JM
3883 * @update_ft_ies: Provide updated Fast BSS Transition information to the
3884 * driver. If the SME is in the driver/firmware, this information can be
3885 * used in building Authentication and Reassociation Request frames.
5de17984
AS
3886 *
3887 * @crit_proto_start: Indicates a critical protocol needs more link reliability
3888 * for a given duration (milliseconds). The protocol is provided so the
3889 * driver can take the most appropriate actions.
3890 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
3891 * reliability. This operation can not fail.
be29b99a 3892 * @set_coalesce: Set coalesce parameters.
16ef1fe2 3893 *
97dc94f1
MK
3894 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
3895 * responsible for veryfing if the switch is possible. Since this is
3896 * inherently tricky driver may decide to disconnect an interface later
3897 * with cfg80211_stop_iface(). This doesn't mean driver can accept
3898 * everything. It should do it's best to verify requests and reject them
3899 * as soon as possible.
fa9ffc74
KP
3900 *
3901 * @set_qos_map: Set QoS mapping information to the driver
e16821bc
JM
3902 *
3903 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3904 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3905 * changes during the lifetime of the BSS.
960d01ac
JB
3906 *
3907 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3908 * with the given parameters; action frame exchange has been handled by
3909 * userspace so this just has to modify the TX path to take the TS into
3910 * account.
3911 * If the admitted time is 0 just validate the parameters to make sure
3912 * the session can be created at all; it is valid to just always return
3913 * success for that but that may result in inefficient behaviour (handshake
3914 * with the peer followed by immediate teardown when the addition is later
3915 * rejected)
3916 * @del_tx_ts: remove an existing TX TS
6e0bd6c3
RL
3917 *
3918 * @join_ocb: join the OCB network with the specified parameters
3919 * (invoked with the wireless_dev mutex held)
3920 * @leave_ocb: leave the current OCB network
3921 * (invoked with the wireless_dev mutex held)
1057d35e
AN
3922 *
3923 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
3924 * is responsible for continually initiating channel-switching operations
3925 * and returning to the base channel for communication with the AP.
3926 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
3927 * peers must be on the base channel when the call completes.
cb3b7d87
AB
3928 * @start_nan: Start the NAN interface.
3929 * @stop_nan: Stop the NAN interface.
a442b761
AB
3930 * @add_nan_func: Add a NAN function. Returns negative value on failure.
3931 * On success @nan_func ownership is transferred to the driver and
3932 * it may access it outside of the scope of this function. The driver
3933 * should free the @nan_func when no longer needed by calling
3934 * cfg80211_free_nan_func().
3935 * On success the driver should assign an instance_id in the
3936 * provided @nan_func.
3937 * @del_nan_func: Delete a NAN function.
a5a9dcf2
AB
3938 * @nan_change_conf: changes NAN configuration. The changed parameters must
3939 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
3940 * All other parameters must be ignored.
ce0ce13a
MB
3941 *
3942 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
3a00df57 3943 *
52539ca8
THJ
3944 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3945 * function should return phy stats, and interface stats otherwise.
3946 *
3a00df57
AS
3947 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
3948 * If not deleted through @del_pmk the PMK remains valid until disconnect
3949 * upon which the driver should clear it.
3950 * (invoked with the wireless_dev mutex held)
3951 * @del_pmk: delete the previously configured PMK for the given authenticator.
3952 * (invoked with the wireless_dev mutex held)
40cbfa90
SD
3953 *
3954 * @external_auth: indicates result of offloaded authentication processing from
3955 * user space
2576a9ac
DK
3956 *
3957 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
3958 * tells the driver that the frame should not be encrypted.
81e54d08
PKC
3959 *
3960 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
3961 * Statistics should be cumulative, currently no way to reset is provided.
9bb7e0f2
JB
3962 * @start_pmsr: start peer measurement (e.g. FTM)
3963 * @abort_pmsr: abort peer measurement
cb74e977
SD
3964 *
3965 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3966 * but offloading OWE processing to the user space will get the updated
3967 * DH IE through this interface.
5ab92e7f
RM
3968 *
3969 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
3970 * and overrule HWMP path selection algorithm.
77f576de
T
3971 * @set_tid_config: TID specific configuration, this can be peer or BSS specific
3972 * This callback may sleep.
3710a8a6
JB
3973 * @reset_tid_config: Reset TID specific configuration for the peer, for the
3974 * given TIDs. This callback may sleep.
704232c2
JB
3975 */
3976struct cfg80211_ops {
ff1b6e69 3977 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
0378b3f1 3978 int (*resume)(struct wiphy *wiphy);
6d52563f 3979 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
0378b3f1 3980
84efbb84 3981 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
552bff0c 3982 const char *name,
6bab2e19 3983 unsigned char name_assign_type,
84efbb84 3984 enum nl80211_iftype type,
84efbb84
JB
3985 struct vif_params *params);
3986 int (*del_virtual_intf)(struct wiphy *wiphy,
3987 struct wireless_dev *wdev);
e36d56b6
JB
3988 int (*change_virtual_intf)(struct wiphy *wiphy,
3989 struct net_device *dev,
818a986e 3990 enum nl80211_iftype type,
2ec600d6 3991 struct vif_params *params);
41ade00f
JB
3992
3993 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
e31b8213 3994 u8 key_index, bool pairwise, const u8 *mac_addr,
41ade00f
JB
3995 struct key_params *params);
3996 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
e31b8213
JB
3997 u8 key_index, bool pairwise, const u8 *mac_addr,
3998 void *cookie,
41ade00f
JB
3999 void (*callback)(void *cookie, struct key_params*));
4000 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
e31b8213 4001 u8 key_index, bool pairwise, const u8 *mac_addr);
41ade00f
JB
4002 int (*set_default_key)(struct wiphy *wiphy,
4003 struct net_device *netdev,
dbd2fd65 4004 u8 key_index, bool unicast, bool multicast);
3cfcf6ac
JM
4005 int (*set_default_mgmt_key)(struct wiphy *wiphy,
4006 struct net_device *netdev,
4007 u8 key_index);
56be393f
JM
4008 int (*set_default_beacon_key)(struct wiphy *wiphy,
4009 struct net_device *netdev,
4010 u8 key_index);
ed1b6cc7 4011
8860020e
JB
4012 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
4013 struct cfg80211_ap_settings *settings);
4014 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
4015 struct cfg80211_beacon_data *info);
4016 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
5727ef1b
JB
4017
4018
4019 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162
JB
4020 const u8 *mac,
4021 struct station_parameters *params);
5727ef1b 4022 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
89c771e5 4023 struct station_del_parameters *params);
5727ef1b 4024 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162
JB
4025 const u8 *mac,
4026 struct station_parameters *params);
fd5b74dc 4027 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 4028 const u8 *mac, struct station_info *sinfo);
2ec600d6 4029 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 4030 int idx, u8 *mac, struct station_info *sinfo);
2ec600d6
LCC
4031
4032 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 4033 const u8 *dst, const u8 *next_hop);
2ec600d6 4034 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 4035 const u8 *dst);
2ec600d6 4036 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 4037 const u8 *dst, const u8 *next_hop);
2ec600d6 4038 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 4039 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
2ec600d6 4040 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162
JB
4041 int idx, u8 *dst, u8 *next_hop,
4042 struct mpath_info *pinfo);
66be7d2b
HR
4043 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
4044 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
4045 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
4046 int idx, u8 *dst, u8 *mpp,
4047 struct mpath_info *pinfo);
24bdd9f4 4048 int (*get_mesh_config)(struct wiphy *wiphy,
93da9cc1 4049 struct net_device *dev,
4050 struct mesh_config *conf);
24bdd9f4 4051 int (*update_mesh_config)(struct wiphy *wiphy,
29cbe68c
JB
4052 struct net_device *dev, u32 mask,
4053 const struct mesh_config *nconf);
4054 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
4055 const struct mesh_config *conf,
4056 const struct mesh_setup *setup);
4057 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
4058
6e0bd6c3
RL
4059 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
4060 struct ocb_setup *setup);
4061 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
4062
9f1ba906
JM
4063 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
4064 struct bss_parameters *params);
31888487 4065
f70f01c2 4066 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
31888487 4067 struct ieee80211_txq_params *params);
72bdcf34 4068
e8c9bd5b
JB
4069 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
4070 struct net_device *dev,
4071 struct ieee80211_channel *chan);
4072
4073 int (*set_monitor_channel)(struct wiphy *wiphy,
683b6d3b 4074 struct cfg80211_chan_def *chandef);
9aed3cc1 4075
fd014284 4076 int (*scan)(struct wiphy *wiphy,
2a519311 4077 struct cfg80211_scan_request *request);
91d3ab46 4078 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
636a5d36
JM
4079
4080 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
4081 struct cfg80211_auth_request *req);
4082 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
4083 struct cfg80211_assoc_request *req);
4084 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
63c9c5e7 4085 struct cfg80211_deauth_request *req);
636a5d36 4086 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
63c9c5e7 4087 struct cfg80211_disassoc_request *req);
04a773ad 4088
b23aa676
SO
4089 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
4090 struct cfg80211_connect_params *sme);
088e8df8 4091 int (*update_connect_params)(struct wiphy *wiphy,
4092 struct net_device *dev,
4093 struct cfg80211_connect_params *sme,
4094 u32 changed);
b23aa676
SO
4095 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4096 u16 reason_code);
4097
04a773ad
JB
4098 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
4099 struct cfg80211_ibss_params *params);
4100 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
b9a5f8ca 4101
f4e583c8 4102 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
57fbcce3 4103 int rate[NUM_NL80211_BANDS]);
f4e583c8 4104
b9a5f8ca 4105 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
7643a2c3 4106
c8442118 4107 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
fa61cf70 4108 enum nl80211_tx_power_setting type, int mbm);
c8442118
JB
4109 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4110 int *dbm);
1f87f7d3
JB
4111
4112 void (*rfkill_poll)(struct wiphy *wiphy);
aff89a9b
JB
4113
4114#ifdef CONFIG_NL80211_TESTMODE
fc73f11f
DS
4115 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4116 void *data, int len);
71063f0e
WYG
4117 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
4118 struct netlink_callback *cb,
4119 void *data, int len);
aff89a9b 4120#endif
bc92afd9 4121
9930380f
JB
4122 int (*set_bitrate_mask)(struct wiphy *wiphy,
4123 struct net_device *dev,
4124 const u8 *peer,
4125 const struct cfg80211_bitrate_mask *mask);
4126
61fa713c
HS
4127 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
4128 int idx, struct survey_info *info);
4129
67fbb16b
SO
4130 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4131 struct cfg80211_pmksa *pmksa);
4132 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4133 struct cfg80211_pmksa *pmksa);
4134 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
4135
9588bbd5 4136 int (*remain_on_channel)(struct wiphy *wiphy,
71bbc994 4137 struct wireless_dev *wdev,
9588bbd5 4138 struct ieee80211_channel *chan,
9588bbd5
JM
4139 unsigned int duration,
4140 u64 *cookie);
4141 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
71bbc994 4142 struct wireless_dev *wdev,
9588bbd5
JM
4143 u64 cookie);
4144
71bbc994 4145 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
b176e629
AO
4146 struct cfg80211_mgmt_tx_params *params,
4147 u64 *cookie);
f7ca38df 4148 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
71bbc994 4149 struct wireless_dev *wdev,
f7ca38df 4150 u64 cookie);
026331c4 4151
bc92afd9
JB
4152 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4153 bool enabled, int timeout);
d6dc1a38
JO
4154
4155 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
4156 struct net_device *dev,
4157 s32 rssi_thold, u32 rssi_hyst);
271733cf 4158
4a4b8169
AZ
4159 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
4160 struct net_device *dev,
4161 s32 rssi_low, s32 rssi_high);
4162
84f10708
TP
4163 int (*set_cqm_txe_config)(struct wiphy *wiphy,
4164 struct net_device *dev,
4165 u32 rate, u32 pkts, u32 intvl);
4166
6cd536fe
JB
4167 void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,
4168 struct wireless_dev *wdev,
4169 struct mgmt_frame_regs *upd);
afe0cbf8
BR
4170
4171 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4172 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
3677713b 4173
807f8a8c
LC
4174 int (*sched_scan_start)(struct wiphy *wiphy,
4175 struct net_device *dev,
4176 struct cfg80211_sched_scan_request *request);
3a3ecf1d
AVS
4177 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
4178 u64 reqid);
e5497d76
JB
4179
4180 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4181 struct cfg80211_gtk_rekey_data *data);
109086ce
AN
4182
4183 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 4184 const u8 *peer, u8 action_code, u8 dialog_token,
df942e7b 4185 u16 status_code, u32 peer_capability,
31fa97c5 4186 bool initiator, const u8 *buf, size_t len);
109086ce 4187 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
3b3a0162 4188 const u8 *peer, enum nl80211_tdls_operation oper);
7f6cf311
JB
4189
4190 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
4191 const u8 *peer, u64 *cookie);
e999882a 4192
1d9d9213
SW
4193 int (*set_noack_map)(struct wiphy *wiphy,
4194 struct net_device *dev,
4195 u16 noack_map);
4196
683b6d3b 4197 int (*get_channel)(struct wiphy *wiphy,
5b7ccaf3 4198 struct wireless_dev *wdev,
683b6d3b 4199 struct cfg80211_chan_def *chandef);
98104fde
JB
4200
4201 int (*start_p2p_device)(struct wiphy *wiphy,
4202 struct wireless_dev *wdev);
4203 void (*stop_p2p_device)(struct wiphy *wiphy,
4204 struct wireless_dev *wdev);
77765eaf
VT
4205
4206 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
4207 const struct cfg80211_acl_data *params);
04f39047
SW
4208
4209 int (*start_radar_detection)(struct wiphy *wiphy,
4210 struct net_device *dev,
31559f35
JD
4211 struct cfg80211_chan_def *chandef,
4212 u32 cac_time_ms);
26ec17a1
OM
4213 void (*end_cac)(struct wiphy *wiphy,
4214 struct net_device *dev);
355199e0
JM
4215 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4216 struct cfg80211_update_ft_ies_params *ftie);
5de17984
AS
4217 int (*crit_proto_start)(struct wiphy *wiphy,
4218 struct wireless_dev *wdev,
4219 enum nl80211_crit_proto_id protocol,
4220 u16 duration);
4221 void (*crit_proto_stop)(struct wiphy *wiphy,
4222 struct wireless_dev *wdev);
be29b99a
AK
4223 int (*set_coalesce)(struct wiphy *wiphy,
4224 struct cfg80211_coalesce *coalesce);
16ef1fe2
SW
4225
4226 int (*channel_switch)(struct wiphy *wiphy,
4227 struct net_device *dev,
4228 struct cfg80211_csa_settings *params);
e16821bc 4229
fa9ffc74
KP
4230 int (*set_qos_map)(struct wiphy *wiphy,
4231 struct net_device *dev,
4232 struct cfg80211_qos_map *qos_map);
e16821bc
JM
4233
4234 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4235 struct cfg80211_chan_def *chandef);
960d01ac
JB
4236
4237 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4238 u8 tsid, const u8 *peer, u8 user_prio,
4239 u16 admitted_time);
4240 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4241 u8 tsid, const u8 *peer);
1057d35e
AN
4242
4243 int (*tdls_channel_switch)(struct wiphy *wiphy,
4244 struct net_device *dev,
4245 const u8 *addr, u8 oper_class,
4246 struct cfg80211_chan_def *chandef);
4247 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
4248 struct net_device *dev,
4249 const u8 *addr);
cb3b7d87
AB
4250 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4251 struct cfg80211_nan_conf *conf);
4252 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
a442b761
AB
4253 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4254 struct cfg80211_nan_func *nan_func);
4255 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4256 u64 cookie);
a5a9dcf2
AB
4257 int (*nan_change_conf)(struct wiphy *wiphy,
4258 struct wireless_dev *wdev,
4259 struct cfg80211_nan_conf *conf,
4260 u32 changes);
ce0ce13a
MB
4261
4262 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
4263 struct net_device *dev,
4264 const bool enabled);
3a00df57 4265
52539ca8
THJ
4266 int (*get_txq_stats)(struct wiphy *wiphy,
4267 struct wireless_dev *wdev,
4268 struct cfg80211_txq_stats *txqstats);
4269
3a00df57
AS
4270 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
4271 const struct cfg80211_pmk_conf *conf);
4272 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
4273 const u8 *aa);
40cbfa90
SD
4274 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
4275 struct cfg80211_external_auth_params *params);
2576a9ac
DK
4276
4277 int (*tx_control_port)(struct wiphy *wiphy,
4278 struct net_device *dev,
4279 const u8 *buf, size_t len,
8d74a623 4280 const u8 *dest, const __be16 proto,
dca9ca2d
MT
4281 const bool noencrypt,
4282 u64 *cookie);
81e54d08
PKC
4283
4284 int (*get_ftm_responder_stats)(struct wiphy *wiphy,
4285 struct net_device *dev,
4286 struct cfg80211_ftm_responder_stats *ftm_stats);
9bb7e0f2
JB
4287
4288 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4289 struct cfg80211_pmsr_request *request);
4290 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4291 struct cfg80211_pmsr_request *request);
cb74e977
SD
4292 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4293 struct cfg80211_update_owe_info *owe_info);
5ab92e7f
RM
4294 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
4295 const u8 *buf, size_t len);
77f576de 4296 int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
3710a8a6 4297 struct cfg80211_tid_config *tid_conf);
77f576de 4298 int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
3710a8a6 4299 const u8 *peer, u8 tids);
6bdb68ce
CH
4300 int (*set_sar_specs)(struct wiphy *wiphy,
4301 struct cfg80211_sar_specs *sar);
704232c2
JB
4302};
4303
d3236553
JB
4304/*
4305 * wireless hardware and networking interfaces structures
4306 * and registration/helper functions
4307 */
4308
4309/**
5be83de5
JB
4310 * enum wiphy_flags - wiphy capability flags
4311 *
c8cb5b85
TM
4312 * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4313 * into two, first for legacy bands and second for UHB.
5be83de5
JB
4314 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
4315 * wiphy at all
4316 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
4317 * by default -- this flag will be set depending on the kernel's default
4318 * on wiphy_new(), but can be changed by the driver if it has a good
4319 * reason to override the default
9bc383de 4320 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
33d915d9
MP
4321 * on a VLAN interface). This flag also serves an extra purpose of
4322 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
9bc383de 4323 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
c0692b8f
JB
4324 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4325 * control port protocol ethertype. The device also honours the
4326 * control_port_no_encrypt flag.
e31b8213 4327 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
15d5dda6
JC
4328 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
4329 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
f4b34b55
VN
4330 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4331 * firmware.
cedb5412 4332 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
109086ce
AN
4333 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4334 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4335 * link setup/discovery operations internally. Setup, discovery and
4336 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4337 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4338 * used for asking the driver/firmware to perform a TDLS operation.
562a7480 4339 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
5e760230
JB
4340 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
4341 * when there are virtual interfaces in AP mode by calling
4342 * cfg80211_report_obss_beacon().
87bbbe22
AN
4343 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
4344 * responds to probe-requests in hardware.
7c4ef712
JB
4345 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
4346 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
2f301ab2 4347 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
16ef1fe2
SW
4348 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
4349 * beaconing mode (AP, IBSS, Mesh, ...).
b8676221
DS
4350 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4351 * before connection.
093a48d2 4352 * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
5be83de5
JB
4353 */
4354enum wiphy_flags {
093a48d2 4355 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
a2f73b6c 4356 /* use hole at 1 */
c8cb5b85 4357 WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),
c0692b8f
JB
4358 WIPHY_FLAG_NETNS_OK = BIT(3),
4359 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
4360 WIPHY_FLAG_4ADDR_AP = BIT(5),
4361 WIPHY_FLAG_4ADDR_STATION = BIT(6),
4362 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
309075cf 4363 WIPHY_FLAG_IBSS_RSN = BIT(8),
15d5dda6 4364 WIPHY_FLAG_MESH_AUTH = BIT(10),
ca986ad9 4365 /* use hole at 11 */
8e8b41f9 4366 /* use hole at 12 */
f4b34b55 4367 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
cedb5412 4368 WIPHY_FLAG_AP_UAPSD = BIT(14),
109086ce
AN
4369 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
4370 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
562a7480 4371 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
5e760230 4372 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
87bbbe22 4373 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
7c4ef712
JB
4374 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
4375 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
2f301ab2 4376 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
16ef1fe2 4377 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
b8676221 4378 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
7527a782
JB
4379};
4380
4381/**
4382 * struct ieee80211_iface_limit - limit on certain interface types
4383 * @max: maximum number of interfaces of these types
4384 * @types: interface types (bits)
4385 */
4386struct ieee80211_iface_limit {
4387 u16 max;
4388 u16 types;
4389};
4390
4391/**
4392 * struct ieee80211_iface_combination - possible interface combination
7527a782 4393 *
b80edbc1
LC
4394 * With this structure the driver can describe which interface
4395 * combinations it supports concurrently.
7527a782 4396 *
b80edbc1
LC
4397 * Examples:
4398 *
4399 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
7527a782 4400 *
819bf593
JB
4401 * .. code-block:: c
4402 *
4403 * struct ieee80211_iface_limit limits1[] = {
4404 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4405 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
4406 * };
4407 * struct ieee80211_iface_combination combination1 = {
4408 * .limits = limits1,
4409 * .n_limits = ARRAY_SIZE(limits1),
4410 * .max_interfaces = 2,
4411 * .beacon_int_infra_match = true,
4412 * };
7527a782
JB
4413 *
4414 *
b80edbc1 4415 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
7527a782 4416 *
819bf593
JB
4417 * .. code-block:: c
4418 *
4419 * struct ieee80211_iface_limit limits2[] = {
4420 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
4421 * BIT(NL80211_IFTYPE_P2P_GO), },
4422 * };
4423 * struct ieee80211_iface_combination combination2 = {
4424 * .limits = limits2,
4425 * .n_limits = ARRAY_SIZE(limits2),
4426 * .max_interfaces = 8,
4427 * .num_different_channels = 1,
4428 * };
7527a782
JB
4429 *
4430 *
b80edbc1
LC
4431 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4432 *
819bf593
JB
4433 * This allows for an infrastructure connection and three P2P connections.
4434 *
4435 * .. code-block:: c
4436 *
4437 * struct ieee80211_iface_limit limits3[] = {
4438 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4439 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
4440 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
4441 * };
4442 * struct ieee80211_iface_combination combination3 = {
4443 * .limits = limits3,
4444 * .n_limits = ARRAY_SIZE(limits3),
4445 * .max_interfaces = 4,
4446 * .num_different_channels = 2,
4447 * };
7527a782 4448 *
7527a782
JB
4449 */
4450struct ieee80211_iface_combination {
c6c94aea
JB
4451 /**
4452 * @limits:
4453 * limits for the given interface types
4454 */
7527a782 4455 const struct ieee80211_iface_limit *limits;
c6c94aea
JB
4456
4457 /**
4458 * @num_different_channels:
4459 * can use up to this many different channels
4460 */
7527a782 4461 u32 num_different_channels;
c6c94aea
JB
4462
4463 /**
4464 * @max_interfaces:
4465 * maximum number of interfaces in total allowed in this group
4466 */
7527a782 4467 u16 max_interfaces;
c6c94aea
JB
4468
4469 /**
4470 * @n_limits:
4471 * number of limitations
4472 */
7527a782 4473 u8 n_limits;
c6c94aea
JB
4474
4475 /**
4476 * @beacon_int_infra_match:
4477 * In this combination, the beacon intervals between infrastructure
4478 * and AP types must match. This is required only in special cases.
4479 */
7527a782 4480 bool beacon_int_infra_match;
c6c94aea
JB
4481
4482 /**
4483 * @radar_detect_widths:
4484 * bitmap of channel widths supported for radar detection
4485 */
11c4a075 4486 u8 radar_detect_widths;
c6c94aea
JB
4487
4488 /**
4489 * @radar_detect_regions:
4490 * bitmap of regions supported for radar detection
4491 */
8c48b50a 4492 u8 radar_detect_regions;
c6c94aea
JB
4493
4494 /**
4495 * @beacon_int_min_gcd:
4496 * This interface combination supports different beacon intervals.
4497 *
4498 * = 0
4499 * all beacon intervals for different interface must be same.
4500 * > 0
4501 * any beacon interval for the interface part of this combination AND
4502 * GCD of all beacon intervals from beaconing interfaces of this
4503 * combination must be greater or equal to this value.
4504 */
0c317a02 4505 u32 beacon_int_min_gcd;
5be83de5
JB
4506};
4507
2e161f78
JB
4508struct ieee80211_txrx_stypes {
4509 u16 tx, rx;
4510};
4511
ff1b6e69
JB
4512/**
4513 * enum wiphy_wowlan_support_flags - WoWLAN support flags
4514 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4515 * trigger that keeps the device operating as-is and
4516 * wakes up the host on any activity, for example a
4517 * received packet that passed filtering; note that the
4518 * packet should be preserved in that case
4519 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4520 * (see nl80211.h)
4521 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
77dbbb13
JB
4522 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
4523 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
4524 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
4525 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
4526 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
8cd4d456 4527 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
ff1b6e69
JB
4528 */
4529enum wiphy_wowlan_support_flags {
77dbbb13
JB
4530 WIPHY_WOWLAN_ANY = BIT(0),
4531 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
4532 WIPHY_WOWLAN_DISCONNECT = BIT(2),
4533 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
4534 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
4535 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
4536 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
4537 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
8cd4d456 4538 WIPHY_WOWLAN_NET_DETECT = BIT(8),
ff1b6e69
JB
4539};
4540
2a0e047e
JB
4541struct wiphy_wowlan_tcp_support {
4542 const struct nl80211_wowlan_tcp_data_token_feature *tok;
4543 u32 data_payload_max;
4544 u32 data_interval_max;
4545 u32 wake_payload_max;
4546 bool seq;
4547};
4548
ff1b6e69
JB
4549/**
4550 * struct wiphy_wowlan_support - WoWLAN support data
4551 * @flags: see &enum wiphy_wowlan_support_flags
4552 * @n_patterns: number of supported wakeup patterns
4553 * (see nl80211.h for the pattern definition)
4554 * @pattern_max_len: maximum length of each pattern
4555 * @pattern_min_len: minimum length of each pattern
bb92d199 4556 * @max_pkt_offset: maximum Rx packet offset
8cd4d456
LC
4557 * @max_nd_match_sets: maximum number of matchsets for net-detect,
4558 * similar, but not necessarily identical, to max_match_sets for
4559 * scheduled scans.
4560 * See &struct cfg80211_sched_scan_request.@match_sets for more
4561 * details.
2a0e047e 4562 * @tcp: TCP wakeup support information
ff1b6e69
JB
4563 */
4564struct wiphy_wowlan_support {
4565 u32 flags;
4566 int n_patterns;
4567 int pattern_max_len;
4568 int pattern_min_len;
bb92d199 4569 int max_pkt_offset;
8cd4d456 4570 int max_nd_match_sets;
2a0e047e 4571 const struct wiphy_wowlan_tcp_support *tcp;
ff1b6e69
JB
4572};
4573
be29b99a
AK
4574/**
4575 * struct wiphy_coalesce_support - coalesce support data
4576 * @n_rules: maximum number of coalesce rules
4577 * @max_delay: maximum supported coalescing delay in msecs
4578 * @n_patterns: number of supported patterns in a rule
4579 * (see nl80211.h for the pattern definition)
4580 * @pattern_max_len: maximum length of each pattern
4581 * @pattern_min_len: minimum length of each pattern
4582 * @max_pkt_offset: maximum Rx packet offset
4583 */
4584struct wiphy_coalesce_support {
4585 int n_rules;
4586 int max_delay;
4587 int n_patterns;
4588 int pattern_max_len;
4589 int pattern_min_len;
4590 int max_pkt_offset;
4591};
4592
ad7e718c
JB
4593/**
4594 * enum wiphy_vendor_command_flags - validation flags for vendor commands
4595 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4596 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4597 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4598 * (must be combined with %_WDEV or %_NETDEV)
4599 */
4600enum wiphy_vendor_command_flags {
4601 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4602 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4603 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4604};
4605
466b9936 4606/**
4607 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4608 *
4609 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4610 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4611 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4612 *
4613 */
4614enum wiphy_opmode_flag {
4615 STA_OPMODE_MAX_BW_CHANGED = BIT(0),
4616 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
4617 STA_OPMODE_N_SS_CHANGED = BIT(2),
4618};
4619
4620/**
4621 * struct sta_opmode_info - Station's ht/vht operation mode information
4622 * @changed: contains value from &enum wiphy_opmode_flag
5e78abd0 4623 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
4624 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
466b9936 4625 * @rx_nss: new rx_nss value of a station
4626 */
4627
4628struct sta_opmode_info {
4629 u32 changed;
5e78abd0 4630 enum nl80211_smps_mode smps_mode;
4631 enum nl80211_chan_width bw;
466b9936 4632 u8 rx_nss;
4633};
4634
91046d63 4635#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
901bb989 4636
ad7e718c
JB
4637/**
4638 * struct wiphy_vendor_command - vendor command definition
4639 * @info: vendor command identifying information, as used in nl80211
4640 * @flags: flags, see &enum wiphy_vendor_command_flags
4641 * @doit: callback for the operation, note that wdev is %NULL if the
4642 * flags didn't ask for a wdev and non-%NULL otherwise; the data
4643 * pointer may be %NULL if userspace provided no data at all
7bdbe400
JB
4644 * @dumpit: dump callback, for transferring bigger/multiple items. The
4645 * @storage points to cb->args[5], ie. is preserved over the multiple
4646 * dumpit calls.
901bb989
JB
4647 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4648 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4649 * attribute is just raw data (e.g. a firmware command).
4650 * @maxattr: highest attribute number in policy
7bdbe400
JB
4651 * It's recommended to not have the same sub command with both @doit and
4652 * @dumpit, so that userspace can assume certain ones are get and others
4653 * are used with dump requests.
ad7e718c
JB
4654 */
4655struct wiphy_vendor_command {
4656 struct nl80211_vendor_cmd_info info;
4657 u32 flags;
4658 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4659 const void *data, int data_len);
7bdbe400
JB
4660 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4661 struct sk_buff *skb, const void *data, int data_len,
4662 unsigned long *storage);
901bb989
JB
4663 const struct nla_policy *policy;
4664 unsigned int maxattr;
ad7e718c
JB
4665};
4666
019ae3a9
KV
4667/**
4668 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4669 * @iftype: interface type
4670 * @extended_capabilities: extended capabilities supported by the driver,
4671 * additional capabilities might be supported by userspace; these are the
4672 * 802.11 extended capabilities ("Extended Capabilities element") and are
4673 * in the same format as in the information element. See IEEE Std
4674 * 802.11-2012 8.4.2.29 for the defined fields.
4675 * @extended_capabilities_mask: mask of the valid values
4676 * @extended_capabilities_len: length of the extended capabilities
4677 */
4678struct wiphy_iftype_ext_capab {
4679 enum nl80211_iftype iftype;
4680 const u8 *extended_capabilities;
4681 const u8 *extended_capabilities_mask;
4682 u8 extended_capabilities_len;
4683};
4684
9bb7e0f2
JB
4685/**
4686 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4687 * @max_peers: maximum number of peers in a single measurement
4688 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4689 * @randomize_mac_addr: can randomize MAC address for measurement
4690 * @ftm.supported: FTM measurement is supported
4691 * @ftm.asap: ASAP-mode is supported
4692 * @ftm.non_asap: non-ASAP-mode is supported
4693 * @ftm.request_lci: can request LCI data
4694 * @ftm.request_civicloc: can request civic location data
4695 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4696 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4697 * @ftm.max_bursts_exponent: maximum burst exponent supported
4698 * (set to -1 if not limited; note that setting this will necessarily
4699 * forbid using the value 15 to let the responder pick)
4700 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4701 * not limited)
efb5520d
AS
4702 * @ftm.trigger_based: trigger based ranging measurement is supported
4703 * @ftm.non_trigger_based: non trigger based ranging measurement is supported
9bb7e0f2
JB
4704 */
4705struct cfg80211_pmsr_capabilities {
4706 unsigned int max_peers;
4707 u8 report_ap_tsf:1,
4708 randomize_mac_addr:1;
4709
4710 struct {
4711 u32 preambles;
4712 u32 bandwidths;
4713 s8 max_bursts_exponent;
4714 u8 max_ftms_per_burst;
4715 u8 supported:1,
4716 asap:1,
4717 non_asap:1,
4718 request_lci:1,
efb5520d
AS
4719 request_civicloc:1,
4720 trigger_based:1,
4721 non_trigger_based:1;
9bb7e0f2
JB
4722 } ftm;
4723};
4724
d6039a34
VJ
4725/**
4726 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4727 * suites for interface types defined in @iftypes_mask. Each type in the
4728 * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4729 *
4730 * @iftypes_mask: bitmask of interfaces types
4731 * @akm_suites: points to an array of supported akm suites
4732 * @n_akm_suites: number of supported AKM suites
4733 */
4734struct wiphy_iftype_akm_suites {
4735 u16 iftypes_mask;
4736 const u32 *akm_suites;
4737 int n_akm_suites;
4738};
4739
5be83de5
JB
4740/**
4741 * struct wiphy - wireless hardware description
2784fe91
LR
4742 * @reg_notifier: the driver's regulatory notification callback,
4743 * note that if your driver uses wiphy_apply_custom_regulatory()
4744 * the reg_notifier's request can be passed as NULL
d3236553 4745 * @regd: the driver's regulatory domain, if one was requested via
cd9b52bf 4746 * the regulatory_hint() API. This can be used by the driver
d3236553
JB
4747 * on the reg_notifier() if it chooses to ignore future
4748 * regulatory domain changes caused by other drivers.
4749 * @signal_type: signal type reported in &struct cfg80211_bss.
4750 * @cipher_suites: supported cipher suites
4751 * @n_cipher_suites: number of supported cipher suites
d6039a34
VJ
4752 * @akm_suites: supported AKM suites. These are the default AKMs supported if
4753 * the supported AKMs not advertized for a specific interface type in
4754 * iftype_akm_suites.
ab4dfa20 4755 * @n_akm_suites: number of supported AKM suites
d6039a34
VJ
4756 * @iftype_akm_suites: array of supported akm suites info per interface type.
4757 * Note that the bits in @iftypes_mask inside this structure cannot
4758 * overlap (i.e. only one occurrence of each type is allowed across all
4759 * instances of iftype_akm_suites).
4760 * @num_iftype_akm_suites: number of interface types for which supported akm
4761 * suites are specified separately.
b9a5f8ca
JM
4762 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4763 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4764 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4765 * -1 = fragmentation disabled, only odd values >= 256 used
4766 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
abe37c4b 4767 * @_net: the network namespace this wiphy currently lives in
ef15aac6
JB
4768 * @perm_addr: permanent MAC address of this device
4769 * @addr_mask: If the device supports multiple MAC addresses by masking,
4770 * set this to a mask with variable bits set to 1, e.g. if the last
0fcf8ac5 4771 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
ef15aac6
JB
4772 * variable bits shall be determined by the interfaces added, with
4773 * interfaces not matching the mask being rejected to be brought up.
4774 * @n_addresses: number of addresses in @addresses.
4775 * @addresses: If the device has more than one address, set this pointer
4776 * to a list of addresses (6 bytes each). The first one will be used
4777 * by default for perm_addr. In this case, the mask should be set to
4778 * all-zeroes. In this case it is assumed that the device can handle
4779 * the same number of arbitrary MAC addresses.
fd235913
RD
4780 * @registered: protects ->resume and ->suspend sysfs callbacks against
4781 * unregister hardware
edf77192
JP
4782 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4783 * It will be renamed automatically on wiphy renames
15bc6dfb
JP
4784 * @dev: (virtual) struct device for this wiphy. The item in
4785 * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
4786 * (see below).
abe37c4b
JB
4787 * @wext: wireless extension handlers
4788 * @priv: driver private data (sized according to wiphy_new() parameter)
4789 * @interface_modes: bitmask of interfaces types valid for this wiphy,
4790 * must be set by driver
7527a782
JB
4791 * @iface_combinations: Valid interface combinations array, should not
4792 * list single interface types.
4793 * @n_iface_combinations: number of entries in @iface_combinations array.
4794 * @software_iftypes: bitmask of software interface types, these are not
4795 * subject to any restrictions since they are purely managed in SW.
abe37c4b 4796 * @flags: wiphy flags, see &enum wiphy_flags
a2f73b6c
LR
4797 * @regulatory_flags: wiphy regulatory flags, see
4798 * &enum ieee80211_regulatory_flags
1f074bd8 4799 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
d75bb06b
GKS
4800 * @ext_features: extended features advertised to nl80211, see
4801 * &enum nl80211_ext_feature_index.
abe37c4b
JB
4802 * @bss_priv_size: each BSS struct has private data allocated with it,
4803 * this variable determines its size
4804 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4805 * any given scan
ca986ad9
AVS
4806 * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4807 * the device can run concurrently.
93b6aa69
LC
4808 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
4809 * for in any given scheduled scan
a1f1c21c
LC
4810 * @max_match_sets: maximum number of match sets the device can handle
4811 * when performing a scheduled scan, 0 if filtering is not
4812 * supported.
abe37c4b
JB
4813 * @max_scan_ie_len: maximum length of user-controlled IEs device can
4814 * add to probe request frames transmitted during a scan, must not
4815 * include fixed IEs like supported rates
5a865bad
LC
4816 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
4817 * scans
3b06d277
AS
4818 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
4819 * of iterations) for scheduled scan supported by the device.
4820 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
4821 * single scan plan supported by the device.
4822 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
4823 * scan plan supported by the device.
abe37c4b
JB
4824 * @coverage_class: current coverage class
4825 * @fw_version: firmware version for ethtool reporting
4826 * @hw_version: hardware version for ethtool reporting
4827 * @max_num_pmkids: maximum number of PMKIDs supported by device
4828 * @privid: a pointer that drivers can use to identify if an arbitrary
4829 * wiphy is theirs, e.g. in global notifiers
4830 * @bands: information about bands/channels supported by this device
2e161f78
JB
4831 *
4832 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
4833 * transmitted through nl80211, points to an array indexed by interface
4834 * type
a7ffac95 4835 *
7f531e03
BR
4836 * @available_antennas_tx: bitmap of antennas which are available to be
4837 * configured as TX antennas. Antenna configuration commands will be
4838 * rejected unless this or @available_antennas_rx is set.
4839 *
4840 * @available_antennas_rx: bitmap of antennas which are available to be
4841 * configured as RX antennas. Antenna configuration commands will be
4842 * rejected unless this or @available_antennas_tx is set.
a293911d 4843 *
15f0ebc2
RD
4844 * @probe_resp_offload:
4845 * Bitmap of supported protocols for probe response offloading.
4846 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
4847 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4848 *
a293911d
JB
4849 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4850 * may request, if implemented.
ff1b6e69
JB
4851 *
4852 * @wowlan: WoWLAN support information
6abb9cb9
JB
4853 * @wowlan_config: current WoWLAN configuration; this should usually not be
4854 * used since access to it is necessarily racy, use the parameter passed
4855 * to the suspend() operation instead.
562a7480
JB
4856 *
4857 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
7e7c8926
BG
4858 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
4859 * If null, then none can be over-ridden.
ee2aca34
JB
4860 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
4861 * If null, then none can be over-ridden.
77765eaf 4862 *
53873f13
JB
4863 * @wdev_list: the list of associated (virtual) interfaces; this list must
4864 * not be modified by the driver, but can be read with RTNL/RCU protection.
4865 *
77765eaf
VT
4866 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
4867 * supports for ACL.
a50df0c4
JB
4868 *
4869 * @extended_capabilities: extended capabilities supported by the driver,
4870 * additional capabilities might be supported by userspace; these are
4871 * the 802.11 extended capabilities ("Extended Capabilities element")
4872 * and are in the same format as in the information element. See
019ae3a9
KV
4873 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
4874 * extended capabilities to be used if the capabilities are not specified
4875 * for a specific interface type in iftype_ext_capab.
a50df0c4
JB
4876 * @extended_capabilities_mask: mask of the valid values
4877 * @extended_capabilities_len: length of the extended capabilities
019ae3a9
KV
4878 * @iftype_ext_capab: array of extended capabilities per interface type
4879 * @num_iftype_ext_capab: number of interface types for which extended
4880 * capabilities are specified separately.
be29b99a 4881 * @coalesce: packet coalescing support information
ad7e718c
JB
4882 *
4883 * @vendor_commands: array of vendor commands supported by the hardware
4884 * @n_vendor_commands: number of vendor commands
567ffc35
JB
4885 * @vendor_events: array of vendor events supported by the hardware
4886 * @n_vendor_events: number of vendor events
b43504cf
JM
4887 *
4888 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4889 * (including P2P GO) or 0 to indicate no such limit is advertised. The
4890 * driver is allowed to advertise a theoretical limit that it can reach in
4891 * some cases, but may not always reach.
c2e4323b
LC
4892 *
4893 * @max_num_csa_counters: Number of supported csa_counters in beacons
4894 * and probe responses. This value should be set if the driver
4895 * wishes to limit the number of csa counters. Default (0) means
4896 * infinite.
38de03d2
AS
4897 * @bss_select_support: bitmask indicating the BSS selection criteria supported
4898 * by the driver in the .connect() callback. The bit position maps to the
4899 * attribute indices defined in &enum nl80211_bss_select_attr.
a442b761 4900 *
8585989d
LC
4901 * @nan_supported_bands: bands supported by the device in NAN mode, a
4902 * bitmap of &enum nl80211_band values. For instance, for
4903 * NL80211_BAND_2GHZ, bit 0 would be set
4904 * (i.e. BIT(NL80211_BAND_2GHZ)).
f3a7ca64
JB
4905 *
4906 * @txq_limit: configuration of internal TX queue frame limit
4907 * @txq_memory_limit: configuration internal TX queue memory limit
4908 * @txq_quantum: configuration of internal TX queue scheduler quantum
9bb7e0f2 4909 *
a710d214
LR
4910 * @tx_queue_len: allow setting transmit queue len for drivers not using
4911 * wake_tx_queue
4912 *
213ed579
SS
4913 * @support_mbssid: can HW support association with nontransmitted AP
4914 * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4915 * HE AP, in order to avoid compatibility issues.
4916 * @support_mbssid must be set for this to have any effect.
4917 *
9bb7e0f2 4918 * @pmsr_capa: peer measurement capabilities
3710a8a6
JB
4919 *
4920 * @tid_config_support: describes the per-TID config support that the
4921 * device has
4922 * @tid_config_support.vif: bitmap of attributes (configurations)
4923 * supported by the driver for each vif
4924 * @tid_config_support.peer: bitmap of attributes (configurations)
4925 * supported by the driver for each peer
6a21d16c
T
4926 * @tid_config_support.max_retry: maximum supported retry count for
4927 * long/short retry configuration
a710d214
LR
4928 *
4929 * @max_data_retry_count: maximum supported per TID retry count for
4930 * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
4931 * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
d3236553
JB
4932 */
4933struct wiphy {
4934 /* assign these fields before you register the wiphy */
4935
d3236553 4936 u8 perm_addr[ETH_ALEN];
ef15aac6
JB
4937 u8 addr_mask[ETH_ALEN];
4938
ef15aac6 4939 struct mac_address *addresses;
d3236553 4940
2e161f78
JB
4941 const struct ieee80211_txrx_stypes *mgmt_stypes;
4942
7527a782
JB
4943 const struct ieee80211_iface_combination *iface_combinations;
4944 int n_iface_combinations;
4945 u16 software_iftypes;
4946
2e161f78
JB
4947 u16 n_addresses;
4948
d3236553
JB
4949 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4950 u16 interface_modes;
4951
77765eaf
VT
4952 u16 max_acl_mac_addrs;
4953
a2f73b6c 4954 u32 flags, regulatory_flags, features;
d75bb06b 4955 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
463d0183 4956
562a7480
JB
4957 u32 ap_sme_capa;
4958
d3236553
JB
4959 enum cfg80211_signal_type signal_type;
4960
4961 int bss_priv_size;
4962 u8 max_scan_ssids;
ca986ad9 4963 u8 max_sched_scan_reqs;
93b6aa69 4964 u8 max_sched_scan_ssids;
a1f1c21c 4965 u8 max_match_sets;
d3236553 4966 u16 max_scan_ie_len;
5a865bad 4967 u16 max_sched_scan_ie_len;
3b06d277
AS
4968 u32 max_sched_scan_plans;
4969 u32 max_sched_scan_plan_interval;
4970 u32 max_sched_scan_plan_iterations;
d3236553
JB
4971
4972 int n_cipher_suites;
4973 const u32 *cipher_suites;
4974
ab4dfa20
VJ
4975 int n_akm_suites;
4976 const u32 *akm_suites;
4977
d6039a34
VJ
4978 const struct wiphy_iftype_akm_suites *iftype_akm_suites;
4979 unsigned int num_iftype_akm_suites;
4980
b9a5f8ca
JM
4981 u8 retry_short;
4982 u8 retry_long;
4983 u32 frag_threshold;
4984 u32 rts_threshold;
81077e82 4985 u8 coverage_class;
b9a5f8ca 4986
81135548 4987 char fw_version[ETHTOOL_FWVERS_LEN];
dfce95f5
KV
4988 u32 hw_version;
4989
dfb89c56 4990#ifdef CONFIG_PM
964dc9e2 4991 const struct wiphy_wowlan_support *wowlan;
6abb9cb9 4992 struct cfg80211_wowlan *wowlan_config;
dfb89c56 4993#endif
ff1b6e69 4994
a293911d
JB
4995 u16 max_remain_on_channel_duration;
4996
67fbb16b
SO
4997 u8 max_num_pmkids;
4998
7f531e03
BR
4999 u32 available_antennas_tx;
5000 u32 available_antennas_rx;
a7ffac95 5001
87bbbe22
AN
5002 u32 probe_resp_offload;
5003
a50df0c4
JB
5004 const u8 *extended_capabilities, *extended_capabilities_mask;
5005 u8 extended_capabilities_len;
5006
019ae3a9
KV
5007 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5008 unsigned int num_iftype_ext_capab;
5009
cf5aa2f1 5010 const void *privid;
d3236553 5011
57fbcce3 5012 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
d3236553 5013
0c0280bd
LR
5014 void (*reg_notifier)(struct wiphy *wiphy,
5015 struct regulatory_request *request);
d3236553
JB
5016
5017 /* fields below are read-only, assigned by cfg80211 */
5018
458f4f9e 5019 const struct ieee80211_regdomain __rcu *regd;
d3236553 5020
d3236553
JB
5021 struct device dev;
5022
ecb44335
SG
5023 bool registered;
5024
d3236553
JB
5025 struct dentry *debugfsdir;
5026
7e7c8926 5027 const struct ieee80211_ht_cap *ht_capa_mod_mask;
ee2aca34 5028 const struct ieee80211_vht_cap *vht_capa_mod_mask;
7e7c8926 5029
53873f13
JB
5030 struct list_head wdev_list;
5031
0c5c9fb5 5032 possible_net_t _net;
463d0183 5033
3d23e349
JB
5034#ifdef CONFIG_CFG80211_WEXT
5035 const struct iw_handler_def *wext;
5036#endif
5037
be29b99a
AK
5038 const struct wiphy_coalesce_support *coalesce;
5039
ad7e718c 5040 const struct wiphy_vendor_command *vendor_commands;
567ffc35
JB
5041 const struct nl80211_vendor_cmd_info *vendor_events;
5042 int n_vendor_commands, n_vendor_events;
ad7e718c 5043
b43504cf
JM
5044 u16 max_ap_assoc_sta;
5045
9a774c78
AO
5046 u8 max_num_csa_counters;
5047
38de03d2
AS
5048 u32 bss_select_support;
5049
8585989d
LC
5050 u8 nan_supported_bands;
5051
52539ca8
THJ
5052 u32 txq_limit;
5053 u32 txq_memory_limit;
5054 u32 txq_quantum;
5055
1f6e0baa
JC
5056 unsigned long tx_queue_len;
5057
213ed579
SS
5058 u8 support_mbssid:1,
5059 support_only_he_mbssid:1;
5060
9bb7e0f2
JB
5061 const struct cfg80211_pmsr_capabilities *pmsr_capa;
5062
3710a8a6
JB
5063 struct {
5064 u64 peer, vif;
6a21d16c 5065 u8 max_retry;
3710a8a6
JB
5066 } tid_config_support;
5067
6a21d16c
T
5068 u8 max_data_retry_count;
5069
6bdb68ce
CH
5070 const struct cfg80211_sar_capa *sar_capa;
5071
396fba0a 5072 char priv[] __aligned(NETDEV_ALIGN);
d3236553
JB
5073};
5074
463d0183
JB
5075static inline struct net *wiphy_net(struct wiphy *wiphy)
5076{
c2d9ba9b 5077 return read_pnet(&wiphy->_net);
463d0183
JB
5078}
5079
5080static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5081{
c2d9ba9b 5082 write_pnet(&wiphy->_net, net);
463d0183 5083}
463d0183 5084
d3236553
JB
5085/**
5086 * wiphy_priv - return priv from wiphy
5087 *
5088 * @wiphy: the wiphy whose priv pointer to return
0ae997dc 5089 * Return: The priv of @wiphy.
d3236553
JB
5090 */
5091static inline void *wiphy_priv(struct wiphy *wiphy)
5092{
5093 BUG_ON(!wiphy);
5094 return &wiphy->priv;
5095}
5096
f1f74825
DK
5097/**
5098 * priv_to_wiphy - return the wiphy containing the priv
5099 *
5100 * @priv: a pointer previously returned by wiphy_priv
0ae997dc 5101 * Return: The wiphy of @priv.
f1f74825
DK
5102 */
5103static inline struct wiphy *priv_to_wiphy(void *priv)
5104{
5105 BUG_ON(!priv);
5106 return container_of(priv, struct wiphy, priv);
5107}
5108
d3236553
JB
5109/**
5110 * set_wiphy_dev - set device pointer for wiphy
5111 *
5112 * @wiphy: The wiphy whose device to bind
5113 * @dev: The device to parent it to
5114 */
5115static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5116{
5117 wiphy->dev.parent = dev;
5118}
5119
5120/**
5121 * wiphy_dev - get wiphy dev pointer
5122 *
5123 * @wiphy: The wiphy whose device struct to look up
0ae997dc 5124 * Return: The dev of @wiphy.
d3236553
JB
5125 */
5126static inline struct device *wiphy_dev(struct wiphy *wiphy)
5127{
5128 return wiphy->dev.parent;
5129}
5130
5131/**
5132 * wiphy_name - get wiphy name
5133 *
5134 * @wiphy: The wiphy whose name to return
0ae997dc 5135 * Return: The name of @wiphy.
d3236553 5136 */
e1db74fc 5137static inline const char *wiphy_name(const struct wiphy *wiphy)
d3236553
JB
5138{
5139 return dev_name(&wiphy->dev);
5140}
5141
1998d90a
BG
5142/**
5143 * wiphy_new_nm - create a new wiphy for use with cfg80211
5144 *
5145 * @ops: The configuration operations for this device
5146 * @sizeof_priv: The size of the private area to allocate
5147 * @requested_name: Request a particular name.
5148 * NULL is valid value, and means use the default phy%d naming.
5149 *
5150 * Create a new wiphy and associate the given operations with it.
5151 * @sizeof_priv bytes are allocated for private use.
5152 *
5153 * Return: A pointer to the new wiphy. This pointer must be
5154 * assigned to each netdev's ieee80211_ptr for proper operation.
5155 */
5156struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
5157 const char *requested_name);
5158
d3236553
JB
5159/**
5160 * wiphy_new - create a new wiphy for use with cfg80211
5161 *
5162 * @ops: The configuration operations for this device
5163 * @sizeof_priv: The size of the private area to allocate
5164 *
5165 * Create a new wiphy and associate the given operations with it.
5166 * @sizeof_priv bytes are allocated for private use.
5167 *
0ae997dc
YB
5168 * Return: A pointer to the new wiphy. This pointer must be
5169 * assigned to each netdev's ieee80211_ptr for proper operation.
d3236553 5170 */
1998d90a
BG
5171static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
5172 int sizeof_priv)
5173{
5174 return wiphy_new_nm(ops, sizeof_priv, NULL);
5175}
d3236553
JB
5176
5177/**
5178 * wiphy_register - register a wiphy with cfg80211
5179 *
5180 * @wiphy: The wiphy to register.
5181 *
0ae997dc 5182 * Return: A non-negative wiphy index or a negative error code.
d3236553 5183 */
10dd9b7c 5184int wiphy_register(struct wiphy *wiphy);
d3236553
JB
5185
5186/**
5187 * wiphy_unregister - deregister a wiphy from cfg80211
5188 *
5189 * @wiphy: The wiphy to unregister.
5190 *
5191 * After this call, no more requests can be made with this priv
5192 * pointer, but the call may sleep to wait for an outstanding
5193 * request that is being handled.
5194 */
10dd9b7c 5195void wiphy_unregister(struct wiphy *wiphy);
d3236553
JB
5196
5197/**
5198 * wiphy_free - free wiphy
5199 *
5200 * @wiphy: The wiphy to free
5201 */
10dd9b7c 5202void wiphy_free(struct wiphy *wiphy);
d3236553 5203
fffd0934 5204/* internal structs */
6829c878 5205struct cfg80211_conn;
19957bb3 5206struct cfg80211_internal_bss;
fffd0934 5207struct cfg80211_cached_keys;
4a4b8169 5208struct cfg80211_cqm_config;
19957bb3 5209
d3236553 5210/**
89a54e48 5211 * struct wireless_dev - wireless device state
d3236553 5212 *
89a54e48
JB
5213 * For netdevs, this structure must be allocated by the driver
5214 * that uses the ieee80211_ptr field in struct net_device (this
5215 * is intentional so it can be allocated along with the netdev.)
5216 * It need not be registered then as netdev registration will
5217 * be intercepted by cfg80211 to see the new wireless device.
5218 *
5219 * For non-netdev uses, it must also be allocated by the driver
5220 * in response to the cfg80211 callbacks that require it, as
5221 * there's no netdev registration in that case it may not be
5222 * allocated outside of callback operations that return it.
d3236553
JB
5223 *
5224 * @wiphy: pointer to hardware description
5225 * @iftype: interface type
5226 * @list: (private) Used to collect the interfaces
89a54e48
JB
5227 * @netdev: (private) Used to reference back to the netdev, may be %NULL
5228 * @identifier: (private) Identifier used in nl80211 to identify this
5229 * wireless device if it has no netdev
d3236553 5230 * @current_bss: (private) Used by the internal configuration code
9e0e2961
MK
5231 * @chandef: (private) Used by the internal configuration code to track
5232 * the user-set channel definition.
780b40df 5233 * @preset_chandef: (private) Used by the internal configuration code to
aa430da4 5234 * track the channel to be used for AP later
d3236553
JB
5235 * @bssid: (private) Used by the internal configuration code
5236 * @ssid: (private) Used by the internal configuration code
5237 * @ssid_len: (private) Used by the internal configuration code
29cbe68c
JB
5238 * @mesh_id_len: (private) Used by the internal configuration code
5239 * @mesh_id_up_len: (private) Used by the internal configuration code
d3236553 5240 * @wext: (private) Used by the internal wireless extensions compat code
9874b71f
JB
5241 * @wext.ibss: (private) IBSS data part of wext handling
5242 * @wext.connect: (private) connection handling data
5243 * @wext.keys: (private) (WEP) key data
5244 * @wext.ie: (private) extra elements for association
5245 * @wext.ie_len: (private) length of extra elements
5246 * @wext.bssid: (private) selected network BSSID
5247 * @wext.ssid: (private) selected network SSID
5248 * @wext.default_key: (private) selected default key index
5249 * @wext.default_mgmt_key: (private) selected default management key index
5250 * @wext.prev_bssid: (private) previous BSSID for reassociation
5251 * @wext.prev_bssid_valid: (private) previous BSSID validity
9bc383de
JB
5252 * @use_4addr: indicates 4addr mode is used on this interface, must be
5253 * set by driver (if supported) on add_interface BEFORE registering the
5254 * netdev and may otherwise be used by driver read-only, will be update
5255 * by cfg80211 on change_interface
2e161f78
JB
5256 * @mgmt_registrations: list of registrations for management frames
5257 * @mgmt_registrations_lock: lock for the list
79ea1e12
JB
5258 * @mgmt_registrations_need_update: mgmt registrations were updated,
5259 * need to propagate the update to the driver
8d61ffa5
JB
5260 * @mtx: mutex used to lock data in this struct, may be used by drivers
5261 * and some API functions require it held
56d1893d
JB
5262 * @beacon_interval: beacon interval used on this device for transmitting
5263 * beacons, 0 when not valid
98104fde 5264 * @address: The address for this device, valid only if @netdev is %NULL
73c7da3d
AVS
5265 * @is_running: true if this is a non-netdev device that has been started, e.g.
5266 * the P2P Device.
04f39047
SW
5267 * @cac_started: true if DFS channel availability check has been started
5268 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
31559f35 5269 * @cac_time_ms: CAC time in ms
780b40df
JB
5270 * @ps: powersave mode is enabled
5271 * @ps_timeout: dynamic powersave timeout
5272 * @ap_unexpected_nlportid: (private) netlink port ID of application
5273 * registered for unexpected class 3 frames (AP mode)
5274 * @conn: (private) cfg80211 software SME connection state machine data
5275 * @connect_keys: (private) keys to set after connection is established
34d50519 5276 * @conn_bss_type: connecting/connected BSS type
bd2522b1
AZ
5277 * @conn_owner_nlportid: (private) connection owner socket port ID
5278 * @disconnect_wk: (private) auto-disconnect work
5279 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
780b40df 5280 * @ibss_fixed: (private) IBSS is using fixed BSSID
5336fa88 5281 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
780b40df
JB
5282 * @event_list: (private) list for internal event processing
5283 * @event_lock: (private) lock for event list
78f22b6a 5284 * @owner_nlportid: (private) owner socket port ID
ab81007a 5285 * @nl_owner_dead: (private) owner socket went away
4a4b8169 5286 * @cqm_config: (private) nl80211 RSSI monitor state
9bb7e0f2
JB
5287 * @pmsr_list: (private) peer measurement requests
5288 * @pmsr_lock: (private) peer measurements requests/results lock
5289 * @pmsr_free_wk: (private) peer measurements cleanup work
4d797fce
JM
5290 * @unprot_beacon_reported: (private) timestamp of last
5291 * unprotected beacon report
d3236553
JB
5292 */
5293struct wireless_dev {
5294 struct wiphy *wiphy;
5295 enum nl80211_iftype iftype;
5296
667503dd 5297 /* the remainder of this struct should be private to cfg80211 */
d3236553
JB
5298 struct list_head list;
5299 struct net_device *netdev;
5300
89a54e48
JB
5301 u32 identifier;
5302
2e161f78
JB
5303 struct list_head mgmt_registrations;
5304 spinlock_t mgmt_registrations_lock;
79ea1e12 5305 u8 mgmt_registrations_need_update:1;
026331c4 5306
667503dd
JB
5307 struct mutex mtx;
5308
73c7da3d 5309 bool use_4addr, is_running;
98104fde
JB
5310
5311 u8 address[ETH_ALEN] __aligned(sizeof(u16));
9bc383de 5312
b23aa676 5313 /* currently used for IBSS and SME - might be rearranged later */
d3236553 5314 u8 ssid[IEEE80211_MAX_SSID_LEN];
29cbe68c 5315 u8 ssid_len, mesh_id_len, mesh_id_up_len;
6829c878 5316 struct cfg80211_conn *conn;
fffd0934 5317 struct cfg80211_cached_keys *connect_keys;
34d50519 5318 enum ieee80211_bss_type conn_bss_type;
bd2522b1
AZ
5319 u32 conn_owner_nlportid;
5320
5321 struct work_struct disconnect_wk;
5322 u8 disconnect_bssid[ETH_ALEN];
d3236553 5323
667503dd
JB
5324 struct list_head event_list;
5325 spinlock_t event_lock;
5326
19957bb3 5327 struct cfg80211_internal_bss *current_bss; /* associated / joined */
683b6d3b 5328 struct cfg80211_chan_def preset_chandef;
9e0e2961 5329 struct cfg80211_chan_def chandef;
f4489ebe 5330
c30a3d38 5331 bool ibss_fixed;
5336fa88 5332 bool ibss_dfs_possible;
c30a3d38 5333
ffb9eb3d
KV
5334 bool ps;
5335 int ps_timeout;
5336
56d1893d
JB
5337 int beacon_interval;
5338
15e47304 5339 u32 ap_unexpected_nlportid;
28946da7 5340
ab81007a
JB
5341 u32 owner_nlportid;
5342 bool nl_owner_dead;
5343
04f39047
SW
5344 bool cac_started;
5345 unsigned long cac_start_time;
31559f35 5346 unsigned int cac_time_ms;
04f39047 5347
3d23e349 5348#ifdef CONFIG_CFG80211_WEXT
d3236553 5349 /* wext data */
cbe8fa9c 5350 struct {
c238c8ac
JB
5351 struct cfg80211_ibss_params ibss;
5352 struct cfg80211_connect_params connect;
fffd0934 5353 struct cfg80211_cached_keys *keys;
c1e5f471 5354 const u8 *ie;
f2129354 5355 size_t ie_len;
9874b71f
JB
5356 u8 bssid[ETH_ALEN];
5357 u8 prev_bssid[ETH_ALEN];
f2129354 5358 u8 ssid[IEEE80211_MAX_SSID_LEN];
08645126 5359 s8 default_key, default_mgmt_key;
ffb9eb3d 5360 bool prev_bssid_valid;
cbe8fa9c 5361 } wext;
d3236553 5362#endif
4a4b8169
AZ
5363
5364 struct cfg80211_cqm_config *cqm_config;
9bb7e0f2
JB
5365
5366 struct list_head pmsr_list;
5367 spinlock_t pmsr_lock;
5368 struct work_struct pmsr_free_wk;
4d797fce
JM
5369
5370 unsigned long unprot_beacon_reported;
d3236553
JB
5371};
5372
98104fde
JB
5373static inline u8 *wdev_address(struct wireless_dev *wdev)
5374{
5375 if (wdev->netdev)
5376 return wdev->netdev->dev_addr;
5377 return wdev->address;
5378}
5379
73c7da3d
AVS
5380static inline bool wdev_running(struct wireless_dev *wdev)
5381{
5382 if (wdev->netdev)
5383 return netif_running(wdev->netdev);
5384 return wdev->is_running;
5385}
5386
d3236553
JB
5387/**
5388 * wdev_priv - return wiphy priv from wireless_dev
5389 *
5390 * @wdev: The wireless device whose wiphy's priv pointer to return
0ae997dc 5391 * Return: The wiphy priv of @wdev.
d3236553
JB
5392 */
5393static inline void *wdev_priv(struct wireless_dev *wdev)
5394{
5395 BUG_ON(!wdev);
5396 return wiphy_priv(wdev->wiphy);
5397}
5398
d70e9693
JB
5399/**
5400 * DOC: Utility functions
5401 *
5402 * cfg80211 offers a number of utility functions that can be useful.
d3236553
JB
5403 */
5404
934f4c7d
TP
5405/**
5406 * ieee80211_channel_equal - compare two struct ieee80211_channel
5407 *
5408 * @a: 1st struct ieee80211_channel
5409 * @b: 2nd struct ieee80211_channel
5410 * Return: true if center frequency of @a == @b
5411 */
5412static inline bool
5413ieee80211_channel_equal(struct ieee80211_channel *a,
5414 struct ieee80211_channel *b)
5415{
5416 return (a->center_freq == b->center_freq &&
5417 a->freq_offset == b->freq_offset);
5418}
5419
5420/**
5421 * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5422 * @chan: struct ieee80211_channel to convert
5423 * Return: The corresponding frequency (in KHz)
5424 */
5425static inline u32
5426ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5427{
5428 return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5429}
5430
11b34737
TP
5431/**
5432 * ieee80211_s1g_channel_width - get allowed channel width from @chan
5433 *
5434 * Only allowed for band NL80211_BAND_S1GHZ
5435 * @chan: channel
5436 * Return: The allowed channel width for this center_freq
5437 */
5438enum nl80211_chan_width
5439ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
5440
934f4c7d
TP
5441/**
5442 * ieee80211_channel_to_freq_khz - convert channel number to frequency
5443 * @chan: channel number
5444 * @band: band, necessary due to channel number overlap
5445 * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5446 */
5447u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5448
d3236553
JB
5449/**
5450 * ieee80211_channel_to_frequency - convert channel number to frequency
abe37c4b 5451 * @chan: channel number
59eb21a6 5452 * @band: band, necessary due to channel number overlap
0ae997dc 5453 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
d3236553 5454 */
934f4c7d
TP
5455static inline int
5456ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5457{
5458 return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5459}
5460
5461/**
5462 * ieee80211_freq_khz_to_channel - convert frequency to channel number
5463 * @freq: center frequency in KHz
5464 * Return: The corresponding channel, or 0 if the conversion failed.
5465 */
5466int ieee80211_freq_khz_to_channel(u32 freq);
d3236553
JB
5467
5468/**
5469 * ieee80211_frequency_to_channel - convert frequency to channel number
934f4c7d 5470 * @freq: center frequency in MHz
0ae997dc 5471 * Return: The corresponding channel, or 0 if the conversion failed.
d3236553 5472 */
934f4c7d
TP
5473static inline int
5474ieee80211_frequency_to_channel(int freq)
5475{
5476 return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5477}
5478
5479/**
5480 * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5481 * frequency
5482 * @wiphy: the struct wiphy to get the channel for
5483 * @freq: the center frequency (in KHz) of the channel
5484 * Return: The channel struct from @wiphy at @freq.
5485 */
5486struct ieee80211_channel *
5487ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
d3236553 5488
d3236553
JB
5489/**
5490 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
543b921b 5491 *
abe37c4b 5492 * @wiphy: the struct wiphy to get the channel for
934f4c7d 5493 * @freq: the center frequency (in MHz) of the channel
0ae997dc 5494 * Return: The channel struct from @wiphy at @freq.
d3236553 5495 */
934f4c7d
TP
5496static inline struct ieee80211_channel *
5497ieee80211_get_channel(struct wiphy *wiphy, int freq)
5498{
5499 return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5500}
d3236553 5501
afbc9c9e
JB
5502/**
5503 * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5504 * @chan: control channel to check
5505 *
5506 * The Preferred Scanning Channels (PSC) are defined in
5507 * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5508 */
5509static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5510{
5511 if (chan->band != NL80211_BAND_6GHZ)
5512 return false;
5513
5514 return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5515}
5516
d3236553
JB
5517/**
5518 * ieee80211_get_response_rate - get basic rate for a given rate
5519 *
5520 * @sband: the band to look for rates in
5521 * @basic_rates: bitmap of basic rates
5522 * @bitrate: the bitrate for which to find the basic rate
5523 *
0ae997dc
YB
5524 * Return: The basic rate corresponding to a given bitrate, that
5525 * is the next lower bitrate contained in the basic rate map,
5526 * which is, for this function, given as a bitmap of indices of
5527 * rates in the band's bitrate table.
d3236553
JB
5528 */
5529struct ieee80211_rate *
5530ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5531 u32 basic_rates, int bitrate);
5532
b422c6cd
AN
5533/**
5534 * ieee80211_mandatory_rates - get mandatory rates for a given band
5535 * @sband: the band to look for rates in
74608aca 5536 * @scan_width: width of the control channel
b422c6cd
AN
5537 *
5538 * This function returns a bitmap of the mandatory rates for the given
5539 * band, bits are set according to the rate position in the bitrates array.
5540 */
74608aca
SW
5541u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
5542 enum nl80211_bss_scan_width scan_width);
b422c6cd 5543
d3236553
JB
5544/*
5545 * Radiotap parsing functions -- for controlled injection support
5546 *
5547 * Implemented in net/wireless/radiotap.c
66d495d0 5548 * Documentation in Documentation/networking/radiotap-headers.rst
d3236553
JB
5549 */
5550
33e5a2f7
JB
5551struct radiotap_align_size {
5552 uint8_t align:4, size:4;
5553};
5554
5555struct ieee80211_radiotap_namespace {
5556 const struct radiotap_align_size *align_size;
5557 int n_bits;
5558 uint32_t oui;
5559 uint8_t subns;
5560};
5561
5562struct ieee80211_radiotap_vendor_namespaces {
5563 const struct ieee80211_radiotap_namespace *ns;
5564 int n_ns;
5565};
5566
d3236553
JB
5567/**
5568 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
33e5a2f7
JB
5569 * @this_arg_index: index of current arg, valid after each successful call
5570 * to ieee80211_radiotap_iterator_next()
5571 * @this_arg: pointer to current radiotap arg; it is valid after each
5572 * call to ieee80211_radiotap_iterator_next() but also after
5573 * ieee80211_radiotap_iterator_init() where it will point to
5574 * the beginning of the actual data portion
5575 * @this_arg_size: length of the current arg, for convenience
5576 * @current_namespace: pointer to the current namespace definition
5577 * (or internally %NULL if the current namespace is unknown)
5578 * @is_radiotap_ns: indicates whether the current namespace is the default
5579 * radiotap namespace or not
5580 *
33e5a2f7
JB
5581 * @_rtheader: pointer to the radiotap header we are walking through
5582 * @_max_length: length of radiotap header in cpu byte ordering
5583 * @_arg_index: next argument index
5584 * @_arg: next argument pointer
5585 * @_next_bitmap: internal pointer to next present u32
5586 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
5587 * @_vns: vendor namespace definitions
5588 * @_next_ns_data: beginning of the next namespace's data
5589 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
5590 * next bitmap word
5591 *
5592 * Describes the radiotap parser state. Fields prefixed with an underscore
5593 * must not be used by users of the parser, only by the parser internally.
d3236553
JB
5594 */
5595
5596struct ieee80211_radiotap_iterator {
33e5a2f7
JB
5597 struct ieee80211_radiotap_header *_rtheader;
5598 const struct ieee80211_radiotap_vendor_namespaces *_vns;
5599 const struct ieee80211_radiotap_namespace *current_namespace;
5600
5601 unsigned char *_arg, *_next_ns_data;
67272440 5602 __le32 *_next_bitmap;
33e5a2f7
JB
5603
5604 unsigned char *this_arg;
d3236553 5605 int this_arg_index;
33e5a2f7 5606 int this_arg_size;
d3236553 5607
33e5a2f7
JB
5608 int is_radiotap_ns;
5609
5610 int _max_length;
5611 int _arg_index;
5612 uint32_t _bitmap_shifter;
5613 int _reset_on_ext;
d3236553
JB
5614};
5615
10dd9b7c
JP
5616int
5617ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5618 struct ieee80211_radiotap_header *radiotap_header,
5619 int max_length,
5620 const struct ieee80211_radiotap_vendor_namespaces *vns);
d3236553 5621
10dd9b7c
JP
5622int
5623ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
33e5a2f7 5624
d3236553 5625
e31a16d6
ZY
5626extern const unsigned char rfc1042_header[6];
5627extern const unsigned char bridge_tunnel_header[6];
5628
5629/**
5630 * ieee80211_get_hdrlen_from_skb - get header length from data
5631 *
0ae997dc
YB
5632 * @skb: the frame
5633 *
e31a16d6 5634 * Given an skb with a raw 802.11 header at the data pointer this function
0ae997dc 5635 * returns the 802.11 header length.
e31a16d6 5636 *
0ae997dc
YB
5637 * Return: The 802.11 header length in bytes (not including encryption
5638 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
5639 * 802.11 header.
e31a16d6
ZY
5640 */
5641unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5642
5643/**
5644 * ieee80211_hdrlen - get header length in bytes from frame control
5645 * @fc: frame control field in little-endian format
0ae997dc 5646 * Return: The header length in bytes.
e31a16d6 5647 */
633adf1a 5648unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
e31a16d6 5649
9b395bc3
JB
5650/**
5651 * ieee80211_get_mesh_hdrlen - get mesh extension header length
5652 * @meshhdr: the mesh extension header, only the flags field
5653 * (first byte) will be accessed
0ae997dc 5654 * Return: The length of the extension header, which is always at
9b395bc3
JB
5655 * least 6 bytes and at most 18 if address 5 and 6 are present.
5656 */
5657unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
5658
d70e9693
JB
5659/**
5660 * DOC: Data path helpers
5661 *
5662 * In addition to generic utilities, cfg80211 also offers
5663 * functions that help implement the data path for devices
5664 * that do not do the 802.11/802.3 conversion on the device.
5665 */
5666
7f6990c8
JB
5667/**
5668 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
5669 * @skb: the 802.11 data frame
5670 * @ehdr: pointer to a &struct ethhdr that will get the header, instead
5671 * of it being pushed into the SKB
5672 * @addr: the device MAC address
5673 * @iftype: the virtual interface type
24bba078 5674 * @data_offset: offset of payload after the 802.11 header
7f6990c8
JB
5675 * Return: 0 on success. Non-zero on error.
5676 */
5677int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
24bba078
FF
5678 const u8 *addr, enum nl80211_iftype iftype,
5679 u8 data_offset);
7f6990c8 5680
e31a16d6
ZY
5681/**
5682 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5683 * @skb: the 802.11 data frame
5684 * @addr: the device MAC address
5685 * @iftype: the virtual interface type
0ae997dc 5686 * Return: 0 on success. Non-zero on error.
e31a16d6 5687 */
7f6990c8
JB
5688static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
5689 enum nl80211_iftype iftype)
5690{
24bba078 5691 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
7f6990c8 5692}
e31a16d6 5693
eaf85ca7
ZY
5694/**
5695 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5696 *
7f6990c8
JB
5697 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
5698 * The @list will be empty if the decode fails. The @skb must be fully
5699 * header-less before being passed in here; it is freed in this function.
eaf85ca7 5700 *
7f6990c8 5701 * @skb: The input A-MSDU frame without any headers.
eaf85ca7 5702 * @list: The output list of 802.3 frames. It must be allocated and
085a6c10 5703 * initialized by the caller.
eaf85ca7
ZY
5704 * @addr: The device MAC address.
5705 * @iftype: The device interface type.
5706 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
8b935ee2
JB
5707 * @check_da: DA to check in the inner ethernet header, or NULL
5708 * @check_sa: SA to check in the inner ethernet header, or NULL
eaf85ca7
ZY
5709 */
5710void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5711 const u8 *addr, enum nl80211_iftype iftype,
8b3becad 5712 const unsigned int extra_headroom,
8b935ee2 5713 const u8 *check_da, const u8 *check_sa);
eaf85ca7 5714
e31a16d6
ZY
5715/**
5716 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5717 * @skb: the data frame
fa9ffc74 5718 * @qos_map: Interworking QoS mapping or %NULL if not in use
0ae997dc 5719 * Return: The 802.1p/1d tag.
e31a16d6 5720 */
fa9ffc74
KP
5721unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5722 struct cfg80211_qos_map *qos_map);
e31a16d6 5723
49a68e0d
JB
5724/**
5725 * cfg80211_find_elem_match - match information element and byte array in data
5726 *
5727 * @eid: element ID
5728 * @ies: data consisting of IEs
5729 * @len: length of data
5730 * @match: byte array to match
5731 * @match_len: number of bytes in the match array
5732 * @match_offset: offset in the IE data where the byte array should match.
5733 * Note the difference to cfg80211_find_ie_match() which considers
5734 * the offset to start from the element ID byte, but here we take
5735 * the data portion instead.
5736 *
5737 * Return: %NULL if the element ID could not be found or if
5738 * the element is invalid (claims to be longer than the given
5739 * data) or if the byte array doesn't match; otherwise return the
5740 * requested element struct.
5741 *
5742 * Note: There are no checks on the element length other than
5743 * having to fit into the given data and being large enough for the
5744 * byte array to match.
5745 */
5746const struct element *
5747cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
5748 const u8 *match, unsigned int match_len,
5749 unsigned int match_offset);
5750
fbd05e4a
LC
5751/**
5752 * cfg80211_find_ie_match - match information element and byte array in data
5753 *
5754 * @eid: element ID
5755 * @ies: data consisting of IEs
5756 * @len: length of data
5757 * @match: byte array to match
5758 * @match_len: number of bytes in the match array
5759 * @match_offset: offset in the IE where the byte array should match.
5760 * If match_len is zero, this must also be set to zero.
5761 * Otherwise this must be set to 2 or more, because the first
5762 * byte is the element id, which is already compared to eid, and
5763 * the second byte is the IE length.
5764 *
5765 * Return: %NULL if the element ID could not be found or if
5766 * the element is invalid (claims to be longer than the given
5767 * data) or if the byte array doesn't match, or a pointer to the first
5768 * byte of the requested element, that is the byte containing the
5769 * element ID.
5770 *
5771 * Note: There are no checks on the element length other than
5772 * having to fit into the given data and being large enough for the
5773 * byte array to match.
5774 */
49a68e0d
JB
5775static inline const u8 *
5776cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
5777 const u8 *match, unsigned int match_len,
5778 unsigned int match_offset)
5779{
5780 /* match_offset can't be smaller than 2, unless match_len is
5781 * zero, in which case match_offset must be zero as well.
5782 */
5783 if (WARN_ON((match_len && match_offset < 2) ||
5784 (!match_len && match_offset)))
5785 return NULL;
5786
5787 return (void *)cfg80211_find_elem_match(eid, ies, len,
5788 match, match_len,
5789 match_offset ?
5790 match_offset - 2 : 0);
5791}
5792
5793/**
5794 * cfg80211_find_elem - find information element in data
5795 *
5796 * @eid: element ID
5797 * @ies: data consisting of IEs
5798 * @len: length of data
5799 *
5800 * Return: %NULL if the element ID could not be found or if
5801 * the element is invalid (claims to be longer than the given
5802 * data) or if the byte array doesn't match; otherwise return the
5803 * requested element struct.
5804 *
5805 * Note: There are no checks on the element length other than
5806 * having to fit into the given data.
5807 */
5808static inline const struct element *
5809cfg80211_find_elem(u8 eid, const u8 *ies, int len)
5810{
5811 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
5812}
fbd05e4a 5813
c21dbf92
JB
5814/**
5815 * cfg80211_find_ie - find information element in data
5816 *
5817 * @eid: element ID
5818 * @ies: data consisting of IEs
5819 * @len: length of data
5820 *
0ae997dc
YB
5821 * Return: %NULL if the element ID could not be found or if
5822 * the element is invalid (claims to be longer than the given
5823 * data), or a pointer to the first byte of the requested
5824 * element, that is the byte containing the element ID.
5825 *
5826 * Note: There are no checks on the element length other than
5827 * having to fit into the given data.
c21dbf92 5828 */
fbd05e4a
LC
5829static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5830{
5831 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5832}
c21dbf92 5833
49a68e0d
JB
5834/**
5835 * cfg80211_find_ext_elem - find information element with EID Extension in data
5836 *
5837 * @ext_eid: element ID Extension
5838 * @ies: data consisting of IEs
5839 * @len: length of data
5840 *
5841 * Return: %NULL if the etended element could not be found or if
5842 * the element is invalid (claims to be longer than the given
5843 * data) or if the byte array doesn't match; otherwise return the
5844 * requested element struct.
5845 *
5846 * Note: There are no checks on the element length other than
5847 * having to fit into the given data.
5848 */
5849static inline const struct element *
5850cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
5851{
5852 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
5853 &ext_eid, 1, 0);
5854}
5855
3f817fe7
JM
5856/**
5857 * cfg80211_find_ext_ie - find information element with EID Extension in data
5858 *
5859 * @ext_eid: element ID Extension
5860 * @ies: data consisting of IEs
5861 * @len: length of data
5862 *
5863 * Return: %NULL if the extended element ID could not be found or if
5864 * the element is invalid (claims to be longer than the given
5865 * data), or a pointer to the first byte of the requested
5866 * element, that is the byte containing the element ID.
5867 *
5868 * Note: There are no checks on the element length other than
5869 * having to fit into the given data.
5870 */
5871static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
5872{
5873 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
5874 &ext_eid, 1, 2);
5875}
5876
49a68e0d
JB
5877/**
5878 * cfg80211_find_vendor_elem - find vendor specific information element in data
5879 *
5880 * @oui: vendor OUI
5881 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5882 * @ies: data consisting of IEs
5883 * @len: length of data
5884 *
5885 * Return: %NULL if the vendor specific element ID could not be found or if the
5886 * element is invalid (claims to be longer than the given data); otherwise
5887 * return the element structure for the requested element.
5888 *
5889 * Note: There are no checks on the element length other than having to fit into
5890 * the given data.
5891 */
5892const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
5893 const u8 *ies,
5894 unsigned int len);
5895
0c28ec58
EP
5896/**
5897 * cfg80211_find_vendor_ie - find vendor specific information element in data
5898 *
5899 * @oui: vendor OUI
9e9ea439 5900 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
0c28ec58
EP
5901 * @ies: data consisting of IEs
5902 * @len: length of data
5903 *
0ae997dc
YB
5904 * Return: %NULL if the vendor specific element ID could not be found or if the
5905 * element is invalid (claims to be longer than the given data), or a pointer to
5906 * the first byte of the requested element, that is the byte containing the
5907 * element ID.
5908 *
5909 * Note: There are no checks on the element length other than having to fit into
5910 * the given data.
0c28ec58 5911 */
49a68e0d
JB
5912static inline const u8 *
5913cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
5914 const u8 *ies, unsigned int len)
5915{
5916 return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
5917}
0c28ec58 5918
30ca1aa5
DL
5919/**
5920 * cfg80211_send_layer2_update - send layer 2 update frame
5921 *
5922 * @dev: network device
5923 * @addr: STA MAC address
5924 *
5925 * Wireless drivers can use this function to update forwarding tables in bridge
5926 * devices upon STA association.
5927 */
5928void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
5929
d70e9693
JB
5930/**
5931 * DOC: Regulatory enforcement infrastructure
5932 *
5933 * TODO
d3236553
JB
5934 */
5935
5936/**
5937 * regulatory_hint - driver hint to the wireless core a regulatory domain
5938 * @wiphy: the wireless device giving the hint (used only for reporting
5939 * conflicts)
5940 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
cd9b52bf
JP
5941 * should be in. If @rd is set this should be NULL. Note that if you
5942 * set this to NULL you should still set rd->alpha2 to some accepted
5943 * alpha2.
d3236553
JB
5944 *
5945 * Wireless drivers can use this function to hint to the wireless core
5946 * what it believes should be the current regulatory domain by
5947 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5948 * domain should be in or by providing a completely build regulatory domain.
5949 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5950 * for a regulatory domain structure for the respective country.
5951 *
5952 * The wiphy must have been registered to cfg80211 prior to this call.
5953 * For cfg80211 drivers this means you must first use wiphy_register(),
5954 * for mac80211 drivers you must first use ieee80211_register_hw().
5955 *
5956 * Drivers should check the return value, its possible you can get
5957 * an -ENOMEM.
0ae997dc
YB
5958 *
5959 * Return: 0 on success. -ENOMEM.
d3236553 5960 */
10dd9b7c 5961int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
d3236553 5962
b0d7aa59
JD
5963/**
5964 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5965 * @wiphy: the wireless device we want to process the regulatory domain on
5966 * @rd: the regulatory domain informatoin to use for this wiphy
5967 *
5968 * Set the regulatory domain information for self-managed wiphys, only they
5969 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5970 * information.
5971 *
5972 * Return: 0 on success. -EINVAL, -EPERM
5973 */
5974int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5975 struct ieee80211_regdomain *rd);
5976
2c3e861c
AN
5977/**
5978 * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
5979 * @wiphy: the wireless device we want to process the regulatory domain on
5980 * @rd: the regulatory domain information to use for this wiphy
5981 *
5982 * This functions requires the RTNL to be held and applies the new regdomain
5983 * synchronously to this wiphy. For more details see
5984 * regulatory_set_wiphy_regd().
5985 *
5986 * Return: 0 on success. -EINVAL, -EPERM
5987 */
5988int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
5989 struct ieee80211_regdomain *rd);
5990
d3236553
JB
5991/**
5992 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5993 * @wiphy: the wireless device we want to process the regulatory domain on
5994 * @regd: the custom regulatory domain to use for this wiphy
5995 *
5996 * Drivers can sometimes have custom regulatory domains which do not apply
5997 * to a specific country. Drivers can use this to apply such custom regulatory
5998 * domains. This routine must be called prior to wiphy registration. The
5999 * custom regulatory domain will be trusted completely and as such previous
6000 * default channel settings will be disregarded. If no rule is found for a
6001 * channel on the regulatory domain the channel will be disabled.
222ea581 6002 * Drivers using this for a wiphy should also set the wiphy flag
ce26151b 6003 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
222ea581 6004 * that called this helper.
d3236553 6005 */
10dd9b7c
JP
6006void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6007 const struct ieee80211_regdomain *regd);
d3236553
JB
6008
6009/**
6010 * freq_reg_info - get regulatory information for the given frequency
6011 * @wiphy: the wiphy for which we want to process this rule for
6012 * @center_freq: Frequency in KHz for which we want regulatory information for
d3236553
JB
6013 *
6014 * Use this function to get the regulatory rule for a specific frequency on
6015 * a given wireless device. If the device has a specific regulatory domain
6016 * it wants to follow we respect that unless a country IE has been received
6017 * and processed already.
6018 *
0ae997dc
YB
6019 * Return: A valid pointer, or, when an error occurs, for example if no rule
6020 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
6021 * check and PTR_ERR() to obtain the numeric return value. The numeric return
6022 * value will be -ERANGE if we determine the given center_freq does not even
6023 * have a regulatory rule for a frequency range in the center_freq's band.
6024 * See freq_in_rule_band() for our current definition of a band -- this is
6025 * purely subjective and right now it's 802.11 specific.
d3236553 6026 */
361c9c8b
JB
6027const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6028 u32 center_freq);
d3236553 6029
034c6d6e
LR
6030/**
6031 * reg_initiator_name - map regulatory request initiator enum to name
6032 * @initiator: the regulatory request initiator
6033 *
6034 * You can use this to map the regulatory request initiator enum to a
6035 * proper string representation.
6036 */
6037const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6038
dc0c18ed
AK
6039/**
6040 * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6041 * @wiphy: wiphy for which pre-CAC capability is checked.
6042 *
6043 * Pre-CAC is allowed only in some regdomains (notable ETSI).
6044 */
6045bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6046
19d3577e
HD
6047/**
6048 * DOC: Internal regulatory db functions
6049 *
6050 */
6051
6052/**
6053 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
6054 * Regulatory self-managed driver can use it to proactively
6055 *
6056 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
6057 * @freq: the freqency(in MHz) to be queried.
19d3577e
HD
6058 * @rule: pointer to store the wmm rule from the regulatory db.
6059 *
6060 * Self-managed wireless drivers can use this function to query
6061 * the internal regulatory database to check whether the given
6062 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
6063 *
6064 * Drivers should check the return value, its possible you can get
6065 * an -ENODATA.
6066 *
6067 * Return: 0 on success. -ENODATA.
6068 */
38cb87ee
SG
6069int reg_query_regdb_wmm(char *alpha2, int freq,
6070 struct ieee80211_reg_rule *rule);
19d3577e 6071
d3236553
JB
6072/*
6073 * callbacks for asynchronous cfg80211 methods, notification
6074 * functions and BSS handling helpers
6075 */
6076
2a519311
JB
6077/**
6078 * cfg80211_scan_done - notify that scan finished
6079 *
6080 * @request: the corresponding scan request
1d76250b 6081 * @info: information about the completed scan
2a519311 6082 */
1d76250b
AS
6083void cfg80211_scan_done(struct cfg80211_scan_request *request,
6084 struct cfg80211_scan_info *info);
2a519311 6085
807f8a8c
LC
6086/**
6087 * cfg80211_sched_scan_results - notify that new scan results are available
6088 *
6089 * @wiphy: the wiphy which got scheduled scan results
b34939b9 6090 * @reqid: identifier for the related scheduled scan request
807f8a8c 6091 */
b34939b9 6092void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
807f8a8c
LC
6093
6094/**
6095 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6096 *
6097 * @wiphy: the wiphy on which the scheduled scan stopped
b34939b9 6098 * @reqid: identifier for the related scheduled scan request
807f8a8c
LC
6099 *
6100 * The driver can call this function to inform cfg80211 that the
6101 * scheduled scan had to be stopped, for whatever reason. The driver
6102 * is then called back via the sched_scan_stop operation when done.
6103 */
b34939b9 6104void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
807f8a8c 6105
792e6aa7
EP
6106/**
6107 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
6108 *
6109 * @wiphy: the wiphy on which the scheduled scan stopped
b34939b9 6110 * @reqid: identifier for the related scheduled scan request
792e6aa7
EP
6111 *
6112 * The driver can call this function to inform cfg80211 that the
6113 * scheduled scan had to be stopped, for whatever reason. The driver
6114 * is then called back via the sched_scan_stop operation when done.
6115 * This function should be called with rtnl locked.
6116 */
b34939b9 6117void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
807f8a8c 6118
2a519311 6119/**
6e19bc4b 6120 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
2a519311 6121 * @wiphy: the wiphy reporting the BSS
6e19bc4b 6122 * @data: the BSS metadata
abe37c4b
JB
6123 * @mgmt: the management frame (probe response or beacon)
6124 * @len: length of the management frame
2a519311
JB
6125 * @gfp: context flags
6126 *
6127 * This informs cfg80211 that BSS information was found and
6128 * the BSS should be updated/added.
ef100682 6129 *
0ae997dc
YB
6130 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6131 * Or %NULL on error.
2a519311 6132 */
ef100682 6133struct cfg80211_bss * __must_check
6e19bc4b
DS
6134cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
6135 struct cfg80211_inform_bss *data,
6136 struct ieee80211_mgmt *mgmt, size_t len,
6137 gfp_t gfp);
6138
6139static inline struct cfg80211_bss * __must_check
dcd6eac1 6140cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
3afc2167 6141 struct ieee80211_channel *rx_channel,
dcd6eac1
SW
6142 enum nl80211_bss_scan_width scan_width,
6143 struct ieee80211_mgmt *mgmt, size_t len,
6e19bc4b
DS
6144 s32 signal, gfp_t gfp)
6145{
6146 struct cfg80211_inform_bss data = {
6147 .chan = rx_channel,
6148 .scan_width = scan_width,
6149 .signal = signal,
6150 };
6151
6152 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6153}
dcd6eac1
SW
6154
6155static inline struct cfg80211_bss * __must_check
2a519311 6156cfg80211_inform_bss_frame(struct wiphy *wiphy,
3afc2167 6157 struct ieee80211_channel *rx_channel,
2a519311 6158 struct ieee80211_mgmt *mgmt, size_t len,
dcd6eac1
SW
6159 s32 signal, gfp_t gfp)
6160{
6e19bc4b
DS
6161 struct cfg80211_inform_bss data = {
6162 .chan = rx_channel,
6163 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6164 .signal = signal,
6165 };
6166
6167 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
dcd6eac1 6168}
2a519311 6169
7ece9c37
SS
6170/**
6171 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
6172 * @bssid: transmitter BSSID
6173 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
6174 * @mbssid_index: BSSID index, taken from Multiple BSSID index element
5d4071ab 6175 * @new_bssid: calculated nontransmitted BSSID
7ece9c37
SS
6176 */
6177static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
5d4071ab 6178 u8 mbssid_index, u8 *new_bssid)
7ece9c37 6179{
5d4071ab
JB
6180 u64 bssid_u64 = ether_addr_to_u64(bssid);
6181 u64 mask = GENMASK_ULL(max_bssid - 1, 0);
6182 u64 new_bssid_u64;
7ece9c37 6183
5d4071ab 6184 new_bssid_u64 = bssid_u64 & ~mask;
7ece9c37 6185
5d4071ab 6186 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
7ece9c37 6187
5d4071ab 6188 u64_to_ether_addr(new_bssid_u64, new_bssid);
7ece9c37
SS
6189}
6190
f7dacfb1
SS
6191/**
6192 * cfg80211_is_element_inherited - returns if element ID should be inherited
6193 * @element: element to check
6194 * @non_inherit_element: non inheritance element
6195 */
6196bool cfg80211_is_element_inherited(const struct element *element,
6197 const struct element *non_inherit_element);
6198
fe806e49
SS
6199/**
6200 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6201 * @ie: ies
6202 * @ielen: length of IEs
6203 * @mbssid_elem: current MBSSID element
6204 * @sub_elem: current MBSSID subelement (profile)
6205 * @merged_ie: location of the merged profile
6206 * @max_copy_len: max merged profile length
6207 */
6208size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6209 const struct element *mbssid_elem,
6210 const struct element *sub_elem,
5809a5d5 6211 u8 *merged_ie, size_t max_copy_len);
fe806e49 6212
abe37c4b 6213/**
5bc8c1f2
JB
6214 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
6215 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
6216 * from a beacon or probe response
6217 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
6218 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
6219 */
6220enum cfg80211_bss_frame_type {
6221 CFG80211_BSS_FTYPE_UNKNOWN,
6222 CFG80211_BSS_FTYPE_BEACON,
6223 CFG80211_BSS_FTYPE_PRESP,
6224};
6225
6226/**
6e19bc4b 6227 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
abe37c4b
JB
6228 *
6229 * @wiphy: the wiphy reporting the BSS
6e19bc4b 6230 * @data: the BSS metadata
5bc8c1f2 6231 * @ftype: frame type (if known)
abe37c4b 6232 * @bssid: the BSSID of the BSS
7b8bcff2 6233 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
abe37c4b
JB
6234 * @capability: the capability field sent by the peer
6235 * @beacon_interval: the beacon interval announced by the peer
6236 * @ie: additional IEs sent by the peer
6237 * @ielen: length of the additional IEs
abe37c4b
JB
6238 * @gfp: context flags
6239 *
6240 * This informs cfg80211 that BSS information was found and
6241 * the BSS should be updated/added.
ef100682 6242 *
0ae997dc
YB
6243 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6244 * Or %NULL on error.
abe37c4b 6245 */
ef100682 6246struct cfg80211_bss * __must_check
6e19bc4b
DS
6247cfg80211_inform_bss_data(struct wiphy *wiphy,
6248 struct cfg80211_inform_bss *data,
6249 enum cfg80211_bss_frame_type ftype,
6250 const u8 *bssid, u64 tsf, u16 capability,
6251 u16 beacon_interval, const u8 *ie, size_t ielen,
6252 gfp_t gfp);
6253
6254static inline struct cfg80211_bss * __must_check
dcd6eac1 6255cfg80211_inform_bss_width(struct wiphy *wiphy,
3afc2167 6256 struct ieee80211_channel *rx_channel,
dcd6eac1 6257 enum nl80211_bss_scan_width scan_width,
5bc8c1f2 6258 enum cfg80211_bss_frame_type ftype,
dcd6eac1
SW
6259 const u8 *bssid, u64 tsf, u16 capability,
6260 u16 beacon_interval, const u8 *ie, size_t ielen,
6e19bc4b
DS
6261 s32 signal, gfp_t gfp)
6262{
6263 struct cfg80211_inform_bss data = {
6264 .chan = rx_channel,
6265 .scan_width = scan_width,
6266 .signal = signal,
6267 };
6268
6269 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6270 capability, beacon_interval, ie, ielen,
6271 gfp);
6272}
dcd6eac1
SW
6273
6274static inline struct cfg80211_bss * __must_check
06aa7afa 6275cfg80211_inform_bss(struct wiphy *wiphy,
3afc2167 6276 struct ieee80211_channel *rx_channel,
5bc8c1f2 6277 enum cfg80211_bss_frame_type ftype,
7b8bcff2
JB
6278 const u8 *bssid, u64 tsf, u16 capability,
6279 u16 beacon_interval, const u8 *ie, size_t ielen,
dcd6eac1
SW
6280 s32 signal, gfp_t gfp)
6281{
6e19bc4b
DS
6282 struct cfg80211_inform_bss data = {
6283 .chan = rx_channel,
6284 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6285 .signal = signal,
6286 };
6287
6288 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6289 capability, beacon_interval, ie, ielen,
6290 gfp);
dcd6eac1 6291}
06aa7afa 6292
27548677
JB
6293/**
6294 * cfg80211_get_bss - get a BSS reference
6295 * @wiphy: the wiphy this BSS struct belongs to
6296 * @channel: the channel to search on (or %NULL)
6297 * @bssid: the desired BSSID (or %NULL)
6298 * @ssid: the desired SSID (or %NULL)
6299 * @ssid_len: length of the SSID (or 0)
6300 * @bss_type: type of BSS, see &enum ieee80211_bss_type
6301 * @privacy: privacy filter, see &enum ieee80211_privacy
6302 */
2a519311
JB
6303struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
6304 struct ieee80211_channel *channel,
6305 const u8 *bssid,
79420f09 6306 const u8 *ssid, size_t ssid_len,
6eb18137 6307 enum ieee80211_bss_type bss_type,
27548677 6308 enum ieee80211_privacy privacy);
79420f09
JB
6309static inline struct cfg80211_bss *
6310cfg80211_get_ibss(struct wiphy *wiphy,
6311 struct ieee80211_channel *channel,
6312 const u8 *ssid, size_t ssid_len)
6313{
6314 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
6eb18137
DL
6315 IEEE80211_BSS_TYPE_IBSS,
6316 IEEE80211_PRIVACY_ANY);
79420f09
JB
6317}
6318
4c0c0b75
JB
6319/**
6320 * cfg80211_ref_bss - reference BSS struct
5b112d3d 6321 * @wiphy: the wiphy this BSS struct belongs to
4c0c0b75
JB
6322 * @bss: the BSS struct to reference
6323 *
6324 * Increments the refcount of the given BSS struct.
6325 */
5b112d3d 6326void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
4c0c0b75
JB
6327
6328/**
6329 * cfg80211_put_bss - unref BSS struct
5b112d3d 6330 * @wiphy: the wiphy this BSS struct belongs to
4c0c0b75
JB
6331 * @bss: the BSS struct
6332 *
6333 * Decrements the refcount of the given BSS struct.
6334 */
5b112d3d 6335void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
d3236553 6336
d491af19
JB
6337/**
6338 * cfg80211_unlink_bss - unlink BSS from internal data structures
6339 * @wiphy: the wiphy
6340 * @bss: the bss to remove
6341 *
6342 * This function removes the given BSS from the internal data structures
6343 * thereby making it no longer show up in scan results etc. Use this
6344 * function when you detect a BSS is gone. Normally BSSes will also time
6345 * out, so it is not necessary to use this function at all.
6346 */
6347void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
fee52678 6348
4770c8f9
IP
6349/**
6350 * cfg80211_bss_iter - iterate all BSS entries
6351 *
6352 * This function iterates over the BSS entries associated with the given wiphy
6353 * and calls the callback for the iterated BSS. The iterator function is not
6354 * allowed to call functions that might modify the internal state of the BSS DB.
6355 *
6356 * @wiphy: the wiphy
6357 * @chandef: if given, the iterator function will be called only if the channel
6358 * of the currently iterated BSS is a subset of the given channel.
6359 * @iter: the iterator function to call
6360 * @iter_data: an argument to the iterator function
6361 */
6362void cfg80211_bss_iter(struct wiphy *wiphy,
6363 struct cfg80211_chan_def *chandef,
6364 void (*iter)(struct wiphy *wiphy,
6365 struct cfg80211_bss *bss,
6366 void *data),
6367 void *iter_data);
6368
dcd6eac1
SW
6369static inline enum nl80211_bss_scan_width
6370cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6371{
6372 switch (chandef->width) {
6373 case NL80211_CHAN_WIDTH_5:
6374 return NL80211_BSS_CHAN_WIDTH_5;
6375 case NL80211_CHAN_WIDTH_10:
6376 return NL80211_BSS_CHAN_WIDTH_10;
6377 default:
6378 return NL80211_BSS_CHAN_WIDTH_20;
6379 }
6380}
6381
6039f6d2 6382/**
6ff57cf8 6383 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
6039f6d2
JM
6384 * @dev: network device
6385 * @buf: authentication frame (header + body)
6386 * @len: length of the frame data
6387 *
6ff57cf8
JB
6388 * This function is called whenever an authentication, disassociation or
6389 * deauthentication frame has been received and processed in station mode.
6390 * After being asked to authenticate via cfg80211_ops::auth() the driver must
6391 * call either this function or cfg80211_auth_timeout().
6392 * After being asked to associate via cfg80211_ops::assoc() the driver must
6393 * call either this function or cfg80211_auth_timeout().
6394 * While connected, the driver must calls this for received and processed
6395 * disassociation and deauthentication frames. If the frame couldn't be used
6396 * because it was unprotected, the driver must call the function
6397 * cfg80211_rx_unprot_mlme_mgmt() instead.
6398 *
6399 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6039f6d2 6400 */
6ff57cf8 6401void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6039f6d2 6402
1965c853 6403/**
6ff57cf8 6404 * cfg80211_auth_timeout - notification of timed out authentication
1965c853
JM
6405 * @dev: network device
6406 * @addr: The MAC address of the device with which the authentication timed out
cb0b4beb 6407 *
8d61ffa5
JB
6408 * This function may sleep. The caller must hold the corresponding wdev's
6409 * mutex.
1965c853 6410 */
6ff57cf8 6411void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
1965c853 6412
6039f6d2 6413/**
6ff57cf8 6414 * cfg80211_rx_assoc_resp - notification of processed association response
6039f6d2 6415 * @dev: network device
6ff57cf8
JB
6416 * @bss: the BSS that association was requested with, ownership of the pointer
6417 * moves to cfg80211 in this call
4d9ec73d 6418 * @buf: (Re)Association Response frame (header + body)
6039f6d2 6419 * @len: length of the frame data
f438ceb8
EG
6420 * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6421 * as the AC bitmap in the QoS info field
4d9ec73d
JM
6422 * @req_ies: information elements from the (Re)Association Request frame
6423 * @req_ies_len: length of req_ies data
6039f6d2 6424 *
6ff57cf8
JB
6425 * After being asked to associate via cfg80211_ops::assoc() the driver must
6426 * call either this function or cfg80211_auth_timeout().
6427 *
6428 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6039f6d2 6429 */
6ff57cf8
JB
6430void cfg80211_rx_assoc_resp(struct net_device *dev,
6431 struct cfg80211_bss *bss,
b0b6aa2c 6432 const u8 *buf, size_t len,
4d9ec73d
JM
6433 int uapsd_queues,
6434 const u8 *req_ies, size_t req_ies_len);
6039f6d2 6435
1965c853 6436/**
6ff57cf8 6437 * cfg80211_assoc_timeout - notification of timed out association
1965c853 6438 * @dev: network device
959867fa 6439 * @bss: The BSS entry with which association timed out.
cb0b4beb 6440 *
8d61ffa5 6441 * This function may sleep. The caller must hold the corresponding wdev's mutex.
1965c853 6442 */
959867fa 6443void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
1965c853 6444
e6f462df
JB
6445/**
6446 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6447 * @dev: network device
6448 * @bss: The BSS entry with which association was abandoned.
6449 *
6450 * Call this whenever - for reasons reported through other API, like deauth RX,
6451 * an association attempt was abandoned.
6452 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6453 */
6454void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6455
6039f6d2 6456/**
6ff57cf8 6457 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
6039f6d2 6458 * @dev: network device
6ff57cf8 6459 * @buf: 802.11 frame (header + body)
6039f6d2 6460 * @len: length of the frame data
3bb02143 6461 * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
6039f6d2
JM
6462 *
6463 * This function is called whenever deauthentication has been processed in
53b46b84 6464 * station mode. This includes both received deauthentication frames and
8d61ffa5
JB
6465 * locally generated ones. This function may sleep. The caller must hold the
6466 * corresponding wdev's mutex.
6039f6d2 6467 */
3bb02143
JB
6468void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
6469 bool reconnect);
ce470613 6470
6039f6d2 6471/**
6ff57cf8 6472 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
cf4e594e 6473 * @dev: network device
4d797fce 6474 * @buf: received management frame (header + body)
cf4e594e
JM
6475 * @len: length of the frame data
6476 *
6ff57cf8
JB
6477 * This function is called whenever a received deauthentication or dissassoc
6478 * frame has been dropped in station mode because of MFP being used but the
4d797fce
JM
6479 * frame was not protected. This is also used to notify reception of a Beacon
6480 * frame that was dropped because it did not include a valid MME MIC while
6481 * beacon protection was enabled (BIGTK configured in station mode).
6482 *
6483 * This function may sleep.
cf4e594e 6484 */
6ff57cf8
JB
6485void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
6486 const u8 *buf, size_t len);
cf4e594e 6487
a3b8b056
JM
6488/**
6489 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6490 * @dev: network device
6491 * @addr: The source MAC address of the frame
6492 * @key_type: The key type that the received frame used
a66b98db 6493 * @key_id: Key identifier (0..3). Can be -1 if missing.
a3b8b056 6494 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
e6d6e342 6495 * @gfp: allocation flags
a3b8b056
JM
6496 *
6497 * This function is called whenever the local MAC detects a MIC failure in a
6498 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6499 * primitive.
6500 */
6501void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6502 enum nl80211_key_type key_type, int key_id,
e6d6e342 6503 const u8 *tsc, gfp_t gfp);
a3b8b056 6504
04a773ad
JB
6505/**
6506 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
6507 *
6508 * @dev: network device
6509 * @bssid: the BSSID of the IBSS joined
fe94f3a4 6510 * @channel: the channel of the IBSS joined
04a773ad
JB
6511 * @gfp: allocation flags
6512 *
6513 * This function notifies cfg80211 that the device joined an IBSS or
6514 * switched to a different BSSID. Before this function can be called,
6515 * either a beacon has to have been received from the IBSS, or one of
6516 * the cfg80211_inform_bss{,_frame} functions must have been called
6517 * with the locally generated beacon -- this guarantees that there is
6518 * always a scan result for this IBSS. cfg80211 will handle the rest.
6519 */
fe94f3a4
AQ
6520void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6521 struct ieee80211_channel *channel, gfp_t gfp);
04a773ad 6522
c93b5e71 6523/**
b1e8eb11
MCC
6524 * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6525 * candidate
c93b5e71
JC
6526 *
6527 * @dev: network device
6528 * @macaddr: the MAC address of the new candidate
6529 * @ie: information elements advertised by the peer candidate
5ac4a12d 6530 * @ie_len: length of the information elements buffer
c93b5e71
JC
6531 * @gfp: allocation flags
6532 *
6533 * This function notifies cfg80211 that the mesh peer candidate has been
6534 * detected, most likely via a beacon or, less likely, via a probe response.
6535 * cfg80211 then sends a notification to userspace.
6536 */
6537void cfg80211_notify_new_peer_candidate(struct net_device *dev,
ecbc12ad
BC
6538 const u8 *macaddr, const u8 *ie, u8 ie_len,
6539 int sig_dbm, gfp_t gfp);
c93b5e71 6540
d70e9693
JB
6541/**
6542 * DOC: RFkill integration
6543 *
6544 * RFkill integration in cfg80211 is almost invisible to drivers,
6545 * as cfg80211 automatically registers an rfkill instance for each
6546 * wireless device it knows about. Soft kill is also translated
6547 * into disconnecting and turning all interfaces off, drivers are
6548 * expected to turn off the device when all interfaces are down.
6549 *
6550 * However, devices may have a hard RFkill line, in which case they
6551 * also need to interact with the rfkill subsystem, via cfg80211.
6552 * They can do this with a few helper functions documented here.
6553 */
6554
1f87f7d3
JB
6555/**
6556 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
6557 * @wiphy: the wiphy
6558 * @blocked: block status
6559 */
6560void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
6561
6562/**
6563 * wiphy_rfkill_start_polling - start polling rfkill
6564 * @wiphy: the wiphy
6565 */
6566void wiphy_rfkill_start_polling(struct wiphy *wiphy);
6567
6568/**
6569 * wiphy_rfkill_stop_polling - stop polling rfkill
6570 * @wiphy: the wiphy
6571 */
6572void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
6573
ad7e718c
JB
6574/**
6575 * DOC: Vendor commands
6576 *
6577 * Occasionally, there are special protocol or firmware features that
6578 * can't be implemented very openly. For this and similar cases, the
6579 * vendor command functionality allows implementing the features with
6580 * (typically closed-source) userspace and firmware, using nl80211 as
6581 * the configuration mechanism.
6582 *
6583 * A driver supporting vendor commands must register them as an array
6584 * in struct wiphy, with handlers for each one, each command has an
6585 * OUI and sub command ID to identify it.
6586 *
6587 * Note that this feature should not be (ab)used to implement protocol
6588 * features that could openly be shared across drivers. In particular,
6589 * it must never be required to use vendor commands to implement any
6590 * "normal" functionality that higher-level userspace like connection
6591 * managers etc. need.
6592 */
6593
6594struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6595 enum nl80211_commands cmd,
6596 enum nl80211_attrs attr,
6597 int approxlen);
6598
567ffc35 6599struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
6c09e791 6600 struct wireless_dev *wdev,
567ffc35
JB
6601 enum nl80211_commands cmd,
6602 enum nl80211_attrs attr,
55c1fdf0 6603 unsigned int portid,
567ffc35
JB
6604 int vendor_event_idx,
6605 int approxlen, gfp_t gfp);
6606
6607void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6608
ad7e718c
JB
6609/**
6610 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6611 * @wiphy: the wiphy
6612 * @approxlen: an upper bound of the length of the data that will
6613 * be put into the skb
6614 *
6615 * This function allocates and pre-fills an skb for a reply to
6616 * a vendor command. Since it is intended for a reply, calling
6617 * it outside of a vendor command's doit() operation is invalid.
6618 *
6619 * The returned skb is pre-filled with some identifying data in
6620 * a way that any data that is put into the skb (with skb_put(),
6621 * nla_put() or similar) will end up being within the
6622 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6623 * with the skb is adding data for the corresponding userspace tool
6624 * which can then read that data out of the vendor data attribute.
6625 * You must not modify the skb in any other way.
6626 *
6627 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6628 * its error code as the result of the doit() operation.
6629 *
6630 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6631 */
6632static inline struct sk_buff *
6633cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6634{
6635 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6636 NL80211_ATTR_VENDOR_DATA, approxlen);
6637}
6638
6639/**
6640 * cfg80211_vendor_cmd_reply - send the reply skb
6641 * @skb: The skb, must have been allocated with
6642 * cfg80211_vendor_cmd_alloc_reply_skb()
6643 *
6644 * Since calling this function will usually be the last thing
6645 * before returning from the vendor command doit() you should
6646 * return the error code. Note that this function consumes the
6647 * skb regardless of the return value.
6648 *
6649 * Return: An error code or 0 on success.
6650 */
6651int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6652
55c1fdf0
JB
6653/**
6654 * cfg80211_vendor_cmd_get_sender
6655 * @wiphy: the wiphy
6656 *
6657 * Return the current netlink port ID in a vendor command handler.
6658 * Valid to call only there.
6659 */
6660unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
6661
567ffc35
JB
6662/**
6663 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6664 * @wiphy: the wiphy
6c09e791 6665 * @wdev: the wireless device
567ffc35
JB
6666 * @event_idx: index of the vendor event in the wiphy's vendor_events
6667 * @approxlen: an upper bound of the length of the data that will
6668 * be put into the skb
6669 * @gfp: allocation flags
6670 *
6671 * This function allocates and pre-fills an skb for an event on the
6672 * vendor-specific multicast group.
6673 *
6c09e791
AK
6674 * If wdev != NULL, both the ifindex and identifier of the specified
6675 * wireless device are added to the event message before the vendor data
6676 * attribute.
6677 *
567ffc35
JB
6678 * When done filling the skb, call cfg80211_vendor_event() with the
6679 * skb to send the event.
6680 *
6681 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6682 */
6683static inline struct sk_buff *
6c09e791
AK
6684cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
6685 int approxlen, int event_idx, gfp_t gfp)
567ffc35 6686{
6c09e791 6687 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
567ffc35 6688 NL80211_ATTR_VENDOR_DATA,
55c1fdf0
JB
6689 0, event_idx, approxlen, gfp);
6690}
6691
6692/**
6693 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
6694 * @wiphy: the wiphy
6695 * @wdev: the wireless device
6696 * @event_idx: index of the vendor event in the wiphy's vendor_events
6697 * @portid: port ID of the receiver
6698 * @approxlen: an upper bound of the length of the data that will
6699 * be put into the skb
6700 * @gfp: allocation flags
6701 *
6702 * This function allocates and pre-fills an skb for an event to send to
6703 * a specific (userland) socket. This socket would previously have been
6704 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
6705 * care to register a netlink notifier to see when the socket closes.
6706 *
6707 * If wdev != NULL, both the ifindex and identifier of the specified
6708 * wireless device are added to the event message before the vendor data
6709 * attribute.
6710 *
6711 * When done filling the skb, call cfg80211_vendor_event() with the
6712 * skb to send the event.
6713 *
6714 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6715 */
6716static inline struct sk_buff *
6717cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
6718 struct wireless_dev *wdev,
6719 unsigned int portid, int approxlen,
6720 int event_idx, gfp_t gfp)
6721{
6722 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6723 NL80211_ATTR_VENDOR_DATA,
6724 portid, event_idx, approxlen, gfp);
567ffc35
JB
6725}
6726
6727/**
6728 * cfg80211_vendor_event - send the event
6729 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6730 * @gfp: allocation flags
6731 *
6732 * This function sends the given @skb, which must have been allocated
6733 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6734 */
6735static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6736{
6737 __cfg80211_send_event_skb(skb, gfp);
6738}
6739
aff89a9b 6740#ifdef CONFIG_NL80211_TESTMODE
d70e9693
JB
6741/**
6742 * DOC: Test mode
6743 *
6744 * Test mode is a set of utility functions to allow drivers to
6745 * interact with driver-specific tools to aid, for instance,
6746 * factory programming.
6747 *
6748 * This chapter describes how drivers interact with it, for more
6749 * information see the nl80211 book's chapter on it.
6750 */
6751
aff89a9b
JB
6752/**
6753 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6754 * @wiphy: the wiphy
6755 * @approxlen: an upper bound of the length of the data that will
6756 * be put into the skb
6757 *
6758 * This function allocates and pre-fills an skb for a reply to
6759 * the testmode command. Since it is intended for a reply, calling
6760 * it outside of the @testmode_cmd operation is invalid.
6761 *
0ae997dc
YB
6762 * The returned skb is pre-filled with the wiphy index and set up in
6763 * a way that any data that is put into the skb (with skb_put(),
6764 * nla_put() or similar) will end up being within the
6765 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
6766 * with the skb is adding data for the corresponding userspace tool
6767 * which can then read that data out of the testdata attribute. You
6768 * must not modify the skb in any other way.
aff89a9b
JB
6769 *
6770 * When done, call cfg80211_testmode_reply() with the skb and return
6771 * its error code as the result of the @testmode_cmd operation.
0ae997dc
YB
6772 *
6773 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
aff89a9b 6774 */
ad7e718c
JB
6775static inline struct sk_buff *
6776cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6777{
6778 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6779 NL80211_ATTR_TESTDATA, approxlen);
6780}
aff89a9b
JB
6781
6782/**
6783 * cfg80211_testmode_reply - send the reply skb
6784 * @skb: The skb, must have been allocated with
6785 * cfg80211_testmode_alloc_reply_skb()
6786 *
0ae997dc
YB
6787 * Since calling this function will usually be the last thing
6788 * before returning from the @testmode_cmd you should return
6789 * the error code. Note that this function consumes the skb
6790 * regardless of the return value.
6791 *
6792 * Return: An error code or 0 on success.
aff89a9b 6793 */
ad7e718c
JB
6794static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6795{
6796 return cfg80211_vendor_cmd_reply(skb);
6797}
aff89a9b
JB
6798
6799/**
6800 * cfg80211_testmode_alloc_event_skb - allocate testmode event
6801 * @wiphy: the wiphy
6802 * @approxlen: an upper bound of the length of the data that will
6803 * be put into the skb
6804 * @gfp: allocation flags
6805 *
6806 * This function allocates and pre-fills an skb for an event on the
6807 * testmode multicast group.
6808 *
0ae997dc
YB
6809 * The returned skb is set up in the same way as with
6810 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
6811 * there, you should simply add data to it that will then end up in the
6812 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
6813 * in any other way.
aff89a9b
JB
6814 *
6815 * When done filling the skb, call cfg80211_testmode_event() with the
6816 * skb to send the event.
0ae997dc
YB
6817 *
6818 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
aff89a9b 6819 */
567ffc35
JB
6820static inline struct sk_buff *
6821cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6822{
6c09e791 6823 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
55c1fdf0 6824 NL80211_ATTR_TESTDATA, 0, -1,
567ffc35
JB
6825 approxlen, gfp);
6826}
aff89a9b
JB
6827
6828/**
6829 * cfg80211_testmode_event - send the event
6830 * @skb: The skb, must have been allocated with
6831 * cfg80211_testmode_alloc_event_skb()
6832 * @gfp: allocation flags
6833 *
6834 * This function sends the given @skb, which must have been allocated
6835 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6836 * consumes it.
6837 */
567ffc35
JB
6838static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6839{
6840 __cfg80211_send_event_skb(skb, gfp);
6841}
aff89a9b
JB
6842
6843#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
71063f0e 6844#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
aff89a9b
JB
6845#else
6846#define CFG80211_TESTMODE_CMD(cmd)
71063f0e 6847#define CFG80211_TESTMODE_DUMP(cmd)
aff89a9b
JB
6848#endif
6849
76804d28
AVS
6850/**
6851 * struct cfg80211_fils_resp_params - FILS connection response params
6852 * @kek: KEK derived from a successful FILS connection (may be %NULL)
6853 * @kek_len: Length of @fils_kek in octets
6854 * @update_erp_next_seq_num: Boolean value to specify whether the value in
6855 * @erp_next_seq_num is valid.
6856 * @erp_next_seq_num: The next sequence number to use in ERP message in
6857 * FILS Authentication. This value should be specified irrespective of the
6858 * status for a FILS connection.
6859 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
6860 * @pmk_len: Length of @pmk in octets
6861 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
6862 * used for this FILS connection (may be %NULL).
6863 */
6864struct cfg80211_fils_resp_params {
6865 const u8 *kek;
6866 size_t kek_len;
6867 bool update_erp_next_seq_num;
6868 u16 erp_next_seq_num;
6869 const u8 *pmk;
6870 size_t pmk_len;
6871 const u8 *pmkid;
6872};
6873
5349a0f7
VK
6874/**
6875 * struct cfg80211_connect_resp_params - Connection response params
6876 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
6877 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6878 * the real status code for failures. If this call is used to report a
6879 * failure due to a timeout (e.g., not receiving an Authentication frame
6880 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6881 * indicate that this is a failure, but without a status code.
6882 * @timeout_reason is used to report the reason for the timeout in that
6883 * case.
6884 * @bssid: The BSSID of the AP (may be %NULL)
6885 * @bss: Entry of bss to which STA got connected to, can be obtained through
a3ce17d1
CT
6886 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6887 * bss from the connect_request and hold a reference to it and return
6888 * through this param to avoid a warning if the bss is expired during the
6889 * connection, esp. for those drivers implementing connect op.
6890 * Only one parameter among @bssid and @bss needs to be specified.
5349a0f7
VK
6891 * @req_ie: Association request IEs (may be %NULL)
6892 * @req_ie_len: Association request IEs length
6893 * @resp_ie: Association response IEs (may be %NULL)
6894 * @resp_ie_len: Association response IEs length
76804d28 6895 * @fils: FILS connection response parameters.
5349a0f7
VK
6896 * @timeout_reason: Reason for connection timeout. This is used when the
6897 * connection fails due to a timeout instead of an explicit rejection from
6898 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6899 * not known. This value is used only if @status < 0 to indicate that the
6900 * failure is due to a timeout and not due to explicit rejection by the AP.
6901 * This value is ignored in other cases (@status >= 0).
6902 */
6903struct cfg80211_connect_resp_params {
6904 int status;
6905 const u8 *bssid;
6906 struct cfg80211_bss *bss;
6907 const u8 *req_ie;
6908 size_t req_ie_len;
6909 const u8 *resp_ie;
6910 size_t resp_ie_len;
76804d28 6911 struct cfg80211_fils_resp_params fils;
5349a0f7
VK
6912 enum nl80211_timeout_reason timeout_reason;
6913};
6914
6915/**
6916 * cfg80211_connect_done - notify cfg80211 of connection result
6917 *
6918 * @dev: network device
6919 * @params: connection response parameters
6920 * @gfp: allocation flags
6921 *
6922 * It should be called by the underlying driver once execution of the connection
6923 * request from connect() has been completed. This is similar to
6924 * cfg80211_connect_bss(), but takes a structure pointer for connection response
6925 * parameters. Only one of the functions among cfg80211_connect_bss(),
6926 * cfg80211_connect_result(), cfg80211_connect_timeout(),
6927 * and cfg80211_connect_done() should be called.
6928 */
6929void cfg80211_connect_done(struct net_device *dev,
6930 struct cfg80211_connect_resp_params *params,
6931 gfp_t gfp);
6932
e7054989
KV
6933/**
6934 * cfg80211_connect_bss - notify cfg80211 of connection result
6935 *
6936 * @dev: network device
6937 * @bssid: the BSSID of the AP
a3ce17d1
CT
6938 * @bss: Entry of bss to which STA got connected to, can be obtained through
6939 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6940 * bss from the connect_request and hold a reference to it and return
6941 * through this param to avoid a warning if the bss is expired during the
6942 * connection, esp. for those drivers implementing connect op.
6943 * Only one parameter among @bssid and @bss needs to be specified.
e7054989
KV
6944 * @req_ie: association request IEs (maybe be %NULL)
6945 * @req_ie_len: association request IEs length
6946 * @resp_ie: association response IEs (may be %NULL)
6947 * @resp_ie_len: assoc response IEs length
c88215d7
JM
6948 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6949 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6950 * the real status code for failures. If this call is used to report a
6951 * failure due to a timeout (e.g., not receiving an Authentication frame
6952 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6953 * indicate that this is a failure, but without a status code.
6954 * @timeout_reason is used to report the reason for the timeout in that
6955 * case.
e7054989 6956 * @gfp: allocation flags
3093ebbe
PK
6957 * @timeout_reason: reason for connection timeout. This is used when the
6958 * connection fails due to a timeout instead of an explicit rejection from
6959 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6960 * not known. This value is used only if @status < 0 to indicate that the
6961 * failure is due to a timeout and not due to explicit rejection by the AP.
6962 * This value is ignored in other cases (@status >= 0).
e7054989 6963 *
c88215d7
JM
6964 * It should be called by the underlying driver once execution of the connection
6965 * request from connect() has been completed. This is similar to
6966 * cfg80211_connect_result(), but with the option of identifying the exact bss
5349a0f7
VK
6967 * entry for the connection. Only one of the functions among
6968 * cfg80211_connect_bss(), cfg80211_connect_result(),
6969 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
e7054989 6970 */
5349a0f7
VK
6971static inline void
6972cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6973 struct cfg80211_bss *bss, const u8 *req_ie,
6974 size_t req_ie_len, const u8 *resp_ie,
6975 size_t resp_ie_len, int status, gfp_t gfp,
6976 enum nl80211_timeout_reason timeout_reason)
6977{
6978 struct cfg80211_connect_resp_params params;
6979
6980 memset(&params, 0, sizeof(params));
6981 params.status = status;
6982 params.bssid = bssid;
6983 params.bss = bss;
6984 params.req_ie = req_ie;
6985 params.req_ie_len = req_ie_len;
6986 params.resp_ie = resp_ie;
6987 params.resp_ie_len = resp_ie_len;
6988 params.timeout_reason = timeout_reason;
6989
6990 cfg80211_connect_done(dev, &params, gfp);
6991}
e7054989 6992
b23aa676
SO
6993/**
6994 * cfg80211_connect_result - notify cfg80211 of connection result
6995 *
6996 * @dev: network device
6997 * @bssid: the BSSID of the AP
6998 * @req_ie: association request IEs (maybe be %NULL)
6999 * @req_ie_len: association request IEs length
7000 * @resp_ie: association response IEs (may be %NULL)
7001 * @resp_ie_len: assoc response IEs length
c88215d7 7002 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
b23aa676
SO
7003 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7004 * the real status code for failures.
7005 * @gfp: allocation flags
7006 *
c88215d7
JM
7007 * It should be called by the underlying driver once execution of the connection
7008 * request from connect() has been completed. This is similar to
7009 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
5349a0f7
VK
7010 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
7011 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
b23aa676 7012 */
e7054989
KV
7013static inline void
7014cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7015 const u8 *req_ie, size_t req_ie_len,
7016 const u8 *resp_ie, size_t resp_ie_len,
7017 u16 status, gfp_t gfp)
7018{
7019 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
3093ebbe
PK
7020 resp_ie_len, status, gfp,
7021 NL80211_TIMEOUT_UNSPECIFIED);
bf1ecd21
JM
7022}
7023
7024/**
7025 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7026 *
7027 * @dev: network device
7028 * @bssid: the BSSID of the AP
7029 * @req_ie: association request IEs (maybe be %NULL)
7030 * @req_ie_len: association request IEs length
7031 * @gfp: allocation flags
3093ebbe 7032 * @timeout_reason: reason for connection timeout.
bf1ecd21
JM
7033 *
7034 * It should be called by the underlying driver whenever connect() has failed
7035 * in a sequence where no explicit authentication/association rejection was
7036 * received from the AP. This could happen, e.g., due to not being able to send
7037 * out the Authentication or Association Request frame or timing out while
5349a0f7
VK
7038 * waiting for the response. Only one of the functions among
7039 * cfg80211_connect_bss(), cfg80211_connect_result(),
7040 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
bf1ecd21
JM
7041 */
7042static inline void
7043cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
3093ebbe
PK
7044 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
7045 enum nl80211_timeout_reason timeout_reason)
bf1ecd21
JM
7046{
7047 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
3093ebbe 7048 gfp, timeout_reason);
e7054989 7049}
b23aa676
SO
7050
7051/**
29ce6ecb 7052 * struct cfg80211_roam_info - driver initiated roaming information
b23aa676 7053 *
ed9d0102 7054 * @channel: the channel of the new AP
29ce6ecb
AS
7055 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
7056 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
b23aa676
SO
7057 * @req_ie: association request IEs (maybe be %NULL)
7058 * @req_ie_len: association request IEs length
7059 * @resp_ie: association response IEs (may be %NULL)
7060 * @resp_ie_len: assoc response IEs length
e841b7b1 7061 * @fils: FILS related roaming information.
b23aa676 7062 */
29ce6ecb
AS
7063struct cfg80211_roam_info {
7064 struct ieee80211_channel *channel;
7065 struct cfg80211_bss *bss;
7066 const u8 *bssid;
7067 const u8 *req_ie;
7068 size_t req_ie_len;
7069 const u8 *resp_ie;
7070 size_t resp_ie_len;
e841b7b1 7071 struct cfg80211_fils_resp_params fils;
29ce6ecb 7072};
b23aa676 7073
adbde344 7074/**
29ce6ecb 7075 * cfg80211_roamed - notify cfg80211 of roaming
adbde344
VT
7076 *
7077 * @dev: network device
29ce6ecb 7078 * @info: information about the new BSS. struct &cfg80211_roam_info.
adbde344
VT
7079 * @gfp: allocation flags
7080 *
29ce6ecb
AS
7081 * This function may be called with the driver passing either the BSSID of the
7082 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
7083 * It should be called by the underlying driver whenever it roamed from one AP
7084 * to another while connected. Drivers which have roaming implemented in
7085 * firmware should pass the bss entry to avoid a race in bss entry timeout where
7086 * the bss entry of the new AP is seen in the driver, but gets timed out by the
7087 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
adbde344 7088 * rdev->event_work. In case of any failures, the reference is released
29ce6ecb 7089 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
e1b18549 7090 * released while disconnecting from the current bss.
adbde344 7091 */
29ce6ecb
AS
7092void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
7093 gfp_t gfp);
adbde344 7094
503c1fb9
AS
7095/**
7096 * cfg80211_port_authorized - notify cfg80211 of successful security association
7097 *
7098 * @dev: network device
7099 * @bssid: the BSSID of the AP
7100 * @gfp: allocation flags
7101 *
7102 * This function should be called by a driver that supports 4 way handshake
7103 * offload after a security association was successfully established (i.e.,
7104 * the 4 way handshake was completed successfully). The call to this function
7105 * should be preceded with a call to cfg80211_connect_result(),
7106 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7107 * indicate the 802.11 association.
7108 */
7109void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7110 gfp_t gfp);
7111
b23aa676
SO
7112/**
7113 * cfg80211_disconnected - notify cfg80211 that connection was dropped
7114 *
7115 * @dev: network device
7116 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7117 * @ie_len: length of IEs
7118 * @reason: reason code for the disconnection, set it to 0 if unknown
80279fb7 7119 * @locally_generated: disconnection was requested locally
b23aa676
SO
7120 * @gfp: allocation flags
7121 *
7122 * After it calls this function, the driver should enter an idle state
7123 * and not try to connect to any AP any more.
7124 */
7125void cfg80211_disconnected(struct net_device *dev, u16 reason,
80279fb7
JB
7126 const u8 *ie, size_t ie_len,
7127 bool locally_generated, gfp_t gfp);
b23aa676 7128
9588bbd5
JM
7129/**
7130 * cfg80211_ready_on_channel - notification of remain_on_channel start
71bbc994 7131 * @wdev: wireless device
9588bbd5
JM
7132 * @cookie: the request cookie
7133 * @chan: The current channel (from remain_on_channel request)
9588bbd5
JM
7134 * @duration: Duration in milliseconds that the driver intents to remain on the
7135 * channel
7136 * @gfp: allocation flags
7137 */
71bbc994 7138void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
9588bbd5 7139 struct ieee80211_channel *chan,
9588bbd5
JM
7140 unsigned int duration, gfp_t gfp);
7141
7142/**
7143 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
71bbc994 7144 * @wdev: wireless device
9588bbd5
JM
7145 * @cookie: the request cookie
7146 * @chan: The current channel (from remain_on_channel request)
9588bbd5
JM
7147 * @gfp: allocation flags
7148 */
71bbc994 7149void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
9588bbd5 7150 struct ieee80211_channel *chan,
9588bbd5 7151 gfp_t gfp);
b23aa676 7152
1c38c7f2
JP
7153/**
7154 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
7155 * @wdev: wireless device
7156 * @cookie: the requested cookie
7157 * @chan: The current channel (from tx_mgmt request)
7158 * @gfp: allocation flags
7159 */
7160void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
7161 struct ieee80211_channel *chan, gfp_t gfp);
7162
8689c051
AS
7163/**
7164 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
7165 *
7166 * @sinfo: the station information
7167 * @gfp: allocation flags
7168 */
7169int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
98b62183 7170
7ea3e110
JB
7171/**
7172 * cfg80211_sinfo_release_content - release contents of station info
7173 * @sinfo: the station information
7174 *
7175 * Releases any potentially allocated sub-information of the station
7176 * information, but not the struct itself (since it's typically on
7177 * the stack.)
7178 */
7179static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
7180{
7181 kfree(sinfo->pertid);
7182}
7183
98b62183
JB
7184/**
7185 * cfg80211_new_sta - notify userspace about station
7186 *
7187 * @dev: the netdev
7188 * @mac_addr: the station's address
7189 * @sinfo: the station information
7190 * @gfp: allocation flags
7191 */
7192void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
7193 struct station_info *sinfo, gfp_t gfp);
7194
cf5ead82
JB
7195/**
7196 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7197 * @dev: the netdev
7198 * @mac_addr: the station's address
7199 * @sinfo: the station information/statistics
7200 * @gfp: allocation flags
7201 */
7202void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7203 struct station_info *sinfo, gfp_t gfp);
7204
ec15e68b
JM
7205/**
7206 * cfg80211_del_sta - notify userspace about deletion of a station
7207 *
7208 * @dev: the netdev
7209 * @mac_addr: the station's address
7210 * @gfp: allocation flags
7211 */
cf5ead82
JB
7212static inline void cfg80211_del_sta(struct net_device *dev,
7213 const u8 *mac_addr, gfp_t gfp)
7214{
7215 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7216}
ec15e68b 7217
ed44a951
PP
7218/**
7219 * cfg80211_conn_failed - connection request failed notification
7220 *
7221 * @dev: the netdev
7222 * @mac_addr: the station's address
7223 * @reason: the reason for connection failure
7224 * @gfp: allocation flags
7225 *
7226 * Whenever a station tries to connect to an AP and if the station
7227 * could not connect to the AP as the AP has rejected the connection
7228 * for some reasons, this function is called.
7229 *
7230 * The reason for connection failure can be any of the value from
7231 * nl80211_connect_failed_reason enum
7232 */
7233void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7234 enum nl80211_connect_failed_reason reason,
7235 gfp_t gfp);
7236
e76fede8
TP
7237/**
7238 * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7239 * @wdev: wireless device receiving the frame
7240 * @freq: Frequency on which the frame was received in KHz
7241 * @sig_dbm: signal strength in dBm, or 0 if unknown
7242 * @buf: Management frame (header + body)
7243 * @len: length of the frame data
7244 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7245 *
7246 * This function is called whenever an Action frame is received for a station
7247 * mode interface, but is not processed in kernel.
7248 *
7249 * Return: %true if a user space application has registered for this frame.
7250 * For action frames, that makes it responsible for rejecting unrecognized
7251 * action frames; %false otherwise, in which case for action frames the
7252 * driver is responsible for rejecting the frame.
7253 */
7254bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7255 const u8 *buf, size_t len, u32 flags);
7256
026331c4 7257/**
2e161f78 7258 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
71bbc994 7259 * @wdev: wireless device receiving the frame
026331c4 7260 * @freq: Frequency on which the frame was received in MHz
6c2fb1e6 7261 * @sig_dbm: signal strength in dBm, or 0 if unknown
2e161f78 7262 * @buf: Management frame (header + body)
026331c4 7263 * @len: length of the frame data
19504cf5 7264 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
2e161f78 7265 *
0ae997dc
YB
7266 * This function is called whenever an Action frame is received for a station
7267 * mode interface, but is not processed in kernel.
7268 *
7269 * Return: %true if a user space application has registered for this frame.
2e161f78
JB
7270 * For action frames, that makes it responsible for rejecting unrecognized
7271 * action frames; %false otherwise, in which case for action frames the
7272 * driver is responsible for rejecting the frame.
026331c4 7273 */
e76fede8
TP
7274static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7275 int sig_dbm, const u8 *buf, size_t len,
7276 u32 flags)
7277{
7278 return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7279 flags);
7280}
026331c4
JM
7281
7282/**
2e161f78 7283 * cfg80211_mgmt_tx_status - notification of TX status for management frame
71bbc994 7284 * @wdev: wireless device receiving the frame
2e161f78
JB
7285 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
7286 * @buf: Management frame (header + body)
026331c4
JM
7287 * @len: length of the frame data
7288 * @ack: Whether frame was acknowledged
7289 * @gfp: context flags
7290 *
2e161f78
JB
7291 * This function is called whenever a management frame was requested to be
7292 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
026331c4
JM
7293 * transmission attempt.
7294 */
71bbc994 7295void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
2e161f78 7296 const u8 *buf, size_t len, bool ack, gfp_t gfp);
026331c4 7297
dca9ca2d
MT
7298/**
7299 * cfg80211_control_port_tx_status - notification of TX status for control
7300 * port frames
7301 * @wdev: wireless device receiving the frame
7302 * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7303 * @buf: Data frame (header + body)
7304 * @len: length of the frame data
7305 * @ack: Whether frame was acknowledged
7306 * @gfp: context flags
7307 *
7308 * This function is called whenever a control port frame was requested to be
7309 * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7310 * the transmission attempt.
7311 */
7312void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7313 const u8 *buf, size_t len, bool ack,
7314 gfp_t gfp);
d6dc1a38 7315
6a671a50
DK
7316/**
7317 * cfg80211_rx_control_port - notification about a received control port frame
7318 * @dev: The device the frame matched to
a948f713
DK
7319 * @skb: The skbuf with the control port frame. It is assumed that the skbuf
7320 * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
7321 * This function does not take ownership of the skb, so the caller is
7322 * responsible for any cleanup. The caller must also ensure that
7323 * skb->protocol is set appropriately.
6a671a50
DK
7324 * @unencrypted: Whether the frame was received unencrypted
7325 *
7326 * This function is used to inform userspace about a received control port
7327 * frame. It should only be used if userspace indicated it wants to receive
7328 * control port frames over nl80211.
7329 *
7330 * The frame is the data portion of the 802.3 or 802.11 data frame with all
7331 * network layer headers removed (e.g. the raw EAPoL frame).
7332 *
7333 * Return: %true if the frame was passed to userspace
7334 */
7335bool cfg80211_rx_control_port(struct net_device *dev,
a948f713 7336 struct sk_buff *skb, bool unencrypted);
6a671a50 7337
d6dc1a38
JO
7338/**
7339 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7340 * @dev: network device
7341 * @rssi_event: the triggered RSSI event
bee427b8 7342 * @rssi_level: new RSSI level value or 0 if not available
d6dc1a38
JO
7343 * @gfp: context flags
7344 *
7345 * This function is called when a configured connection quality monitoring
7346 * rssi threshold reached event occurs.
7347 */
7348void cfg80211_cqm_rssi_notify(struct net_device *dev,
7349 enum nl80211_cqm_rssi_threshold_event rssi_event,
bee427b8 7350 s32 rssi_level, gfp_t gfp);
d6dc1a38 7351
c063dbf5
JB
7352/**
7353 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7354 * @dev: network device
7355 * @peer: peer's MAC address
7356 * @num_packets: how many packets were lost -- should be a fixed threshold
7357 * but probably no less than maybe 50, or maybe a throughput dependent
7358 * threshold (to account for temporary interference)
7359 * @gfp: context flags
7360 */
7361void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7362 const u8 *peer, u32 num_packets, gfp_t gfp);
7363
84f10708
TP
7364/**
7365 * cfg80211_cqm_txe_notify - TX error rate event
7366 * @dev: network device
7367 * @peer: peer's MAC address
7368 * @num_packets: how many packets were lost
7369 * @rate: % of packets which failed transmission
7370 * @intvl: interval (in s) over which the TX failure threshold was breached.
7371 * @gfp: context flags
7372 *
7373 * Notify userspace when configured % TX failures over number of packets in a
7374 * given interval is exceeded.
7375 */
7376void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
7377 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
7378
98f03342
JB
7379/**
7380 * cfg80211_cqm_beacon_loss_notify - beacon loss event
7381 * @dev: network device
7382 * @gfp: context flags
7383 *
7384 * Notify userspace about beacon loss from the connected AP.
7385 */
7386void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
7387
5b97f49d
JB
7388/**
7389 * cfg80211_radar_event - radar detection event
7390 * @wiphy: the wiphy
7391 * @chandef: chandef for the current channel
7392 * @gfp: context flags
7393 *
7394 * This function is called when a radar is detected on the current chanenl.
7395 */
7396void cfg80211_radar_event(struct wiphy *wiphy,
7397 struct cfg80211_chan_def *chandef, gfp_t gfp);
7398
466b9936 7399/**
7400 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7401 * @dev: network device
7402 * @mac: MAC address of a station which opmode got modified
7403 * @sta_opmode: station's current opmode value
7404 * @gfp: context flags
7405 *
7406 * Driver should call this function when station's opmode modified via action
7407 * frame.
7408 */
7409void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7410 struct sta_opmode_info *sta_opmode,
7411 gfp_t gfp);
7412
5b97f49d
JB
7413/**
7414 * cfg80211_cac_event - Channel availability check (CAC) event
7415 * @netdev: network device
7416 * @chandef: chandef for the current channel
7417 * @event: type of event
7418 * @gfp: context flags
7419 *
7420 * This function is called when a Channel availability check (CAC) is finished
7421 * or aborted. This must be called to notify the completion of a CAC process,
7422 * also by full-MAC drivers.
7423 */
7424void cfg80211_cac_event(struct net_device *netdev,
7425 const struct cfg80211_chan_def *chandef,
7426 enum nl80211_radar_event event, gfp_t gfp);
7427
7428
e5497d76
JB
7429/**
7430 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7431 * @dev: network device
7432 * @bssid: BSSID of AP (to avoid races)
7433 * @replay_ctr: new replay counter
af71ff85 7434 * @gfp: allocation flags
e5497d76
JB
7435 */
7436void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7437 const u8 *replay_ctr, gfp_t gfp);
7438
c9df56b4
JM
7439/**
7440 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7441 * @dev: network device
7442 * @index: candidate index (the smaller the index, the higher the priority)
7443 * @bssid: BSSID of AP
7444 * @preauth: Whether AP advertises support for RSN pre-authentication
7445 * @gfp: allocation flags
7446 */
7447void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7448 const u8 *bssid, bool preauth, gfp_t gfp);
7449
28946da7
JB
7450/**
7451 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
7452 * @dev: The device the frame matched to
7453 * @addr: the transmitter address
7454 * @gfp: context flags
7455 *
7456 * This function is used in AP mode (only!) to inform userspace that
7457 * a spurious class 3 frame was received, to be able to deauth the
7458 * sender.
0ae997dc 7459 * Return: %true if the frame was passed to userspace (or this failed
28946da7
JB
7460 * for a reason other than not having a subscription.)
7461 */
7462bool cfg80211_rx_spurious_frame(struct net_device *dev,
7463 const u8 *addr, gfp_t gfp);
7464
b92ab5d8
JB
7465/**
7466 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7467 * @dev: The device the frame matched to
7468 * @addr: the transmitter address
7469 * @gfp: context flags
7470 *
7471 * This function is used in AP mode (only!) to inform userspace that
7472 * an associated station sent a 4addr frame but that wasn't expected.
7473 * It is allowed and desirable to send this event only once for each
7474 * station to avoid event flooding.
0ae997dc 7475 * Return: %true if the frame was passed to userspace (or this failed
b92ab5d8
JB
7476 * for a reason other than not having a subscription.)
7477 */
7478bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7479 const u8 *addr, gfp_t gfp);
7480
7f6cf311
JB
7481/**
7482 * cfg80211_probe_status - notify userspace about probe status
7483 * @dev: the device the probe was sent on
7484 * @addr: the address of the peer
7485 * @cookie: the cookie filled in @probe_client previously
7486 * @acked: indicates whether probe was acked or not
c4b50cd3
VN
7487 * @ack_signal: signal strength (in dBm) of the ACK frame.
7488 * @is_valid_ack_signal: indicates the ack_signal is valid or not.
7f6cf311
JB
7489 * @gfp: allocation flags
7490 */
7491void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
c4b50cd3
VN
7492 u64 cookie, bool acked, s32 ack_signal,
7493 bool is_valid_ack_signal, gfp_t gfp);
7f6cf311 7494
e76fede8
TP
7495/**
7496 * cfg80211_report_obss_beacon_khz - report beacon from other APs
7497 * @wiphy: The wiphy that received the beacon
7498 * @frame: the frame
7499 * @len: length of the frame
7500 * @freq: frequency the frame was received on in KHz
7501 * @sig_dbm: signal strength in dBm, or 0 if unknown
7502 *
7503 * Use this function to report to userspace when a beacon was
7504 * received. It is not useful to call this when there is no
7505 * netdev that is in AP/GO mode.
7506 */
7507void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7508 size_t len, int freq, int sig_dbm);
7509
5e760230
JB
7510/**
7511 * cfg80211_report_obss_beacon - report beacon from other APs
7512 * @wiphy: The wiphy that received the beacon
7513 * @frame: the frame
7514 * @len: length of the frame
7515 * @freq: frequency the frame was received on
6c2fb1e6 7516 * @sig_dbm: signal strength in dBm, or 0 if unknown
5e760230
JB
7517 *
7518 * Use this function to report to userspace when a beacon was
7519 * received. It is not useful to call this when there is no
7520 * netdev that is in AP/GO mode.
7521 */
e76fede8
TP
7522static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
7523 const u8 *frame, size_t len,
7524 int freq, int sig_dbm)
7525{
7526 cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7527 sig_dbm);
7528}
5e760230 7529
d58e7e37 7530/**
683b6d3b 7531 * cfg80211_reg_can_beacon - check if beaconing is allowed
54858ee5 7532 * @wiphy: the wiphy
683b6d3b 7533 * @chandef: the channel definition
174e0cd2 7534 * @iftype: interface type
d58e7e37 7535 *
0ae997dc
YB
7536 * Return: %true if there is no secondary channel or the secondary channel(s)
7537 * can be used for beaconing (i.e. is not a radar channel etc.)
54858ee5 7538 */
683b6d3b 7539bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
174e0cd2
IP
7540 struct cfg80211_chan_def *chandef,
7541 enum nl80211_iftype iftype);
54858ee5 7542
923b352f
AN
7543/**
7544 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7545 * @wiphy: the wiphy
7546 * @chandef: the channel definition
7547 * @iftype: interface type
7548 *
7549 * Return: %true if there is no secondary channel or the secondary channel(s)
7550 * can be used for beaconing (i.e. is not a radar channel etc.). This version
7551 * also checks if IR-relaxation conditions apply, to allow beaconing under
7552 * more permissive conditions.
7553 *
7554 * Requires the RTNL to be held.
7555 */
7556bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7557 struct cfg80211_chan_def *chandef,
7558 enum nl80211_iftype iftype);
7559
5314526b
TP
7560/*
7561 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
7562 * @dev: the device which switched channels
683b6d3b 7563 * @chandef: the new channel definition
5314526b 7564 *
e487eaeb
SW
7565 * Caller must acquire wdev_lock, therefore must only be called from sleepable
7566 * driver context!
5314526b 7567 */
683b6d3b
JB
7568void cfg80211_ch_switch_notify(struct net_device *dev,
7569 struct cfg80211_chan_def *chandef);
5314526b 7570
f8d7552e
LC
7571/*
7572 * cfg80211_ch_switch_started_notify - notify channel switch start
7573 * @dev: the device on which the channel switch started
7574 * @chandef: the future channel definition
7575 * @count: the number of TBTTs until the channel switch happens
669b8413 7576 * @quiet: whether or not immediate quiet was requested by the AP
f8d7552e
LC
7577 *
7578 * Inform the userspace about the channel switch that has just
7579 * started, so that it can take appropriate actions (eg. starting
7580 * channel switch on other vifs), if necessary.
7581 */
7582void cfg80211_ch_switch_started_notify(struct net_device *dev,
7583 struct cfg80211_chan_def *chandef,
669b8413 7584 u8 count, bool quiet);
f8d7552e 7585
1ce3e82b
JB
7586/**
7587 * ieee80211_operating_class_to_band - convert operating class to band
7588 *
7589 * @operating_class: the operating class to convert
7590 * @band: band pointer to fill
7591 *
7592 * Returns %true if the conversion was successful, %false otherwise.
7593 */
7594bool ieee80211_operating_class_to_band(u8 operating_class,
57fbcce3 7595 enum nl80211_band *band);
1ce3e82b 7596
a38700dd
AN
7597/**
7598 * ieee80211_chandef_to_operating_class - convert chandef to operation class
7599 *
7600 * @chandef: the chandef to convert
7601 * @op_class: a pointer to the resulting operating class
7602 *
7603 * Returns %true if the conversion was successful, %false otherwise.
7604 */
7605bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7606 u8 *op_class);
7607
934f4c7d
TP
7608/**
7609 * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7610 *
7611 * @chandef: the chandef to convert
7612 *
7613 * Returns the center frequency of chandef (1st segment) in KHz.
7614 */
7615static inline u32
7616ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7617{
7618 return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7619}
7620
3475b094
JM
7621/*
7622 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
7623 * @dev: the device on which the operation is requested
7624 * @peer: the MAC address of the peer device
7625 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
7626 * NL80211_TDLS_TEARDOWN)
7627 * @reason_code: the reason code for teardown request
7628 * @gfp: allocation flags
7629 *
7630 * This function is used to request userspace to perform TDLS operation that
7631 * requires knowledge of keys, i.e., link setup or teardown when the AP
7632 * connection uses encryption. This is optional mechanism for the driver to use
7633 * if it can automatically determine when a TDLS link could be useful (e.g.,
7634 * based on traffic and signal strength for a peer).
7635 */
7636void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
7637 enum nl80211_tdls_operation oper,
7638 u16 reason_code, gfp_t gfp);
7639
8097e149
TP
7640/*
7641 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
7642 * @rate: given rate_info to calculate bitrate from
7643 *
7644 * return 0 if MCS index >= 32
7645 */
8eb41c8d 7646u32 cfg80211_calculate_bitrate(struct rate_info *rate);
8097e149 7647
98104fde
JB
7648/**
7649 * cfg80211_unregister_wdev - remove the given wdev
7650 * @wdev: struct wireless_dev to remove
7651 *
7652 * Call this function only for wdevs that have no netdev assigned,
7653 * e.g. P2P Devices. It removes the device from the list so that
7654 * it can no longer be used. It is necessary to call this function
7655 * even when cfg80211 requests the removal of the interface by
7656 * calling the del_virtual_intf() callback. The function must also
7657 * be called when the driver wishes to unregister the wdev, e.g.
7658 * when the device is unbound from the driver.
7659 *
7660 * Requires the RTNL to be held.
7661 */
7662void cfg80211_unregister_wdev(struct wireless_dev *wdev);
7663
355199e0 7664/**
b1e8eb11 7665 * struct cfg80211_ft_event_params - FT Information Elements
355199e0
JM
7666 * @ies: FT IEs
7667 * @ies_len: length of the FT IE in bytes
7668 * @target_ap: target AP's MAC address
7669 * @ric_ies: RIC IE
7670 * @ric_ies_len: length of the RIC IE in bytes
7671 */
7672struct cfg80211_ft_event_params {
7673 const u8 *ies;
7674 size_t ies_len;
7675 const u8 *target_ap;
7676 const u8 *ric_ies;
7677 size_t ric_ies_len;
7678};
7679
7680/**
7681 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7682 * @netdev: network device
7683 * @ft_event: IE information
7684 */
7685void cfg80211_ft_event(struct net_device *netdev,
7686 struct cfg80211_ft_event_params *ft_event);
7687
0ee45355
JB
7688/**
7689 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
7690 * @ies: the input IE buffer
7691 * @len: the input length
7692 * @attr: the attribute ID to find
7693 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
7694 * if the function is only called to get the needed buffer size
7695 * @bufsize: size of the output buffer
7696 *
7697 * The function finds a given P2P attribute in the (vendor) IEs and
7698 * copies its contents to the given buffer.
7699 *
0ae997dc
YB
7700 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
7701 * malformed or the attribute can't be found (respectively), or the
7702 * length of the found attribute (which can be zero).
0ee45355 7703 */
c216e641
AS
7704int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7705 enum ieee80211_p2p_attr_id attr,
7706 u8 *buf, unsigned int bufsize);
0ee45355 7707
29464ccc
JB
7708/**
7709 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
7710 * @ies: the IE buffer
7711 * @ielen: the length of the IE buffer
7712 * @ids: an array with element IDs that are allowed before
2512b1b1
LK
7713 * the split. A WLAN_EID_EXTENSION value means that the next
7714 * EID in the list is a sub-element of the EXTENSION IE.
29464ccc
JB
7715 * @n_ids: the size of the element ID array
7716 * @after_ric: array IE types that come after the RIC element
7717 * @n_after_ric: size of the @after_ric array
7718 * @offset: offset where to start splitting in the buffer
7719 *
7720 * This function splits an IE buffer by updating the @offset
7721 * variable to point to the location where the buffer should be
7722 * split.
7723 *
7724 * It assumes that the given IE buffer is well-formed, this
7725 * has to be guaranteed by the caller!
7726 *
7727 * It also assumes that the IEs in the buffer are ordered
7728 * correctly, if not the result of using this function will not
7729 * be ordered correctly either, i.e. it does no reordering.
7730 *
7731 * The function returns the offset where the next part of the
7732 * buffer starts, which may be @ielen if the entire (remainder)
7733 * of the buffer should be used.
7734 */
7735size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
7736 const u8 *ids, int n_ids,
7737 const u8 *after_ric, int n_after_ric,
7738 size_t offset);
7739
7740/**
7741 * ieee80211_ie_split - split an IE buffer according to ordering
7742 * @ies: the IE buffer
7743 * @ielen: the length of the IE buffer
7744 * @ids: an array with element IDs that are allowed before
2512b1b1
LK
7745 * the split. A WLAN_EID_EXTENSION value means that the next
7746 * EID in the list is a sub-element of the EXTENSION IE.
29464ccc
JB
7747 * @n_ids: the size of the element ID array
7748 * @offset: offset where to start splitting in the buffer
7749 *
7750 * This function splits an IE buffer by updating the @offset
7751 * variable to point to the location where the buffer should be
7752 * split.
7753 *
7754 * It assumes that the given IE buffer is well-formed, this
7755 * has to be guaranteed by the caller!
7756 *
7757 * It also assumes that the IEs in the buffer are ordered
7758 * correctly, if not the result of using this function will not
7759 * be ordered correctly either, i.e. it does no reordering.
7760 *
7761 * The function returns the offset where the next part of the
7762 * buffer starts, which may be @ielen if the entire (remainder)
7763 * of the buffer should be used.
7764 */
0483eeac
JB
7765static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
7766 const u8 *ids, int n_ids, size_t offset)
7767{
7768 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
7769}
29464ccc 7770
cd8f7cb4
JB
7771/**
7772 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7773 * @wdev: the wireless device reporting the wakeup
7774 * @wakeup: the wakeup report
7775 * @gfp: allocation flags
7776 *
7777 * This function reports that the given device woke up. If it
7778 * caused the wakeup, report the reason(s), otherwise you may
7779 * pass %NULL as the @wakeup parameter to advertise that something
7780 * else caused the wakeup.
7781 */
7782void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7783 struct cfg80211_wowlan_wakeup *wakeup,
7784 gfp_t gfp);
7785
5de17984
AS
7786/**
7787 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
7788 *
7789 * @wdev: the wireless device for which critical protocol is stopped.
03f831a6 7790 * @gfp: allocation flags
5de17984
AS
7791 *
7792 * This function can be called by the driver to indicate it has reverted
7793 * operation back to normal. One reason could be that the duration given
7794 * by .crit_proto_start() has expired.
7795 */
7796void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
7797
bdfbec2d
IP
7798/**
7799 * ieee80211_get_num_supported_channels - get number of channels device has
7800 * @wiphy: the wiphy
7801 *
7802 * Return: the number of channels supported by the device.
7803 */
7804unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7805
cb2d956d
LC
7806/**
7807 * cfg80211_check_combinations - check interface combinations
7808 *
7809 * @wiphy: the wiphy
e227300c 7810 * @params: the interface combinations parameter
cb2d956d
LC
7811 *
7812 * This function can be called by the driver to check whether a
7813 * combination of interfaces and their types are allowed according to
7814 * the interface combinations.
7815 */
7816int cfg80211_check_combinations(struct wiphy *wiphy,
e227300c 7817 struct iface_combination_params *params);
cb2d956d 7818
65a124dd
MK
7819/**
7820 * cfg80211_iter_combinations - iterate over matching combinations
7821 *
7822 * @wiphy: the wiphy
e227300c 7823 * @params: the interface combinations parameter
65a124dd
MK
7824 * @iter: function to call for each matching combination
7825 * @data: pointer to pass to iter function
7826 *
7827 * This function can be called by the driver to check what possible
7828 * combinations it fits in at a given moment, e.g. for channel switching
7829 * purposes.
7830 */
7831int cfg80211_iter_combinations(struct wiphy *wiphy,
e227300c 7832 struct iface_combination_params *params,
65a124dd
MK
7833 void (*iter)(const struct ieee80211_iface_combination *c,
7834 void *data),
7835 void *data);
7836
f04c2203
MK
7837/*
7838 * cfg80211_stop_iface - trigger interface disconnection
7839 *
7840 * @wiphy: the wiphy
7841 * @wdev: wireless device
7842 * @gfp: context flags
7843 *
7844 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7845 * disconnected.
7846 *
7847 * Note: This doesn't need any locks and is asynchronous.
7848 */
7849void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7850 gfp_t gfp);
7851
f6837ba8
JB
7852/**
7853 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7854 * @wiphy: the wiphy to shut down
7855 *
7856 * This function shuts down all interfaces belonging to this wiphy by
7857 * calling dev_close() (and treating non-netdev interfaces as needed).
7858 * It shouldn't really be used unless there are some fatal device errors
7859 * that really can't be recovered in any other way.
7860 *
7861 * Callers must hold the RTNL and be able to deal with callbacks into
7862 * the driver while the function is running.
7863 */
7864void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7865
d75bb06b
GKS
7866/**
7867 * wiphy_ext_feature_set - set the extended feature flag
7868 *
7869 * @wiphy: the wiphy to modify.
7870 * @ftidx: extended feature bit index.
7871 *
7872 * The extended features are flagged in multiple bytes (see
7873 * &struct wiphy.@ext_features)
7874 */
7875static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7876 enum nl80211_ext_feature_index ftidx)
7877{
7878 u8 *ft_byte;
7879
7880 ft_byte = &wiphy->ext_features[ftidx / 8];
7881 *ft_byte |= BIT(ftidx % 8);
7882}
7883
7884/**
7885 * wiphy_ext_feature_isset - check the extended feature flag
7886 *
7887 * @wiphy: the wiphy to modify.
7888 * @ftidx: extended feature bit index.
7889 *
7890 * The extended features are flagged in multiple bytes (see
7891 * &struct wiphy.@ext_features)
7892 */
7893static inline bool
7894wiphy_ext_feature_isset(struct wiphy *wiphy,
7895 enum nl80211_ext_feature_index ftidx)
7896{
7897 u8 ft_byte;
7898
7899 ft_byte = wiphy->ext_features[ftidx / 8];
7900 return (ft_byte & BIT(ftidx % 8)) != 0;
7901}
b7ffbd7e 7902
a442b761
AB
7903/**
7904 * cfg80211_free_nan_func - free NAN function
7905 * @f: NAN function that should be freed
7906 *
7907 * Frees all the NAN function and all it's allocated members.
7908 */
7909void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7910
50bcd31d
AB
7911/**
7912 * struct cfg80211_nan_match_params - NAN match parameters
7913 * @type: the type of the function that triggered a match. If it is
7914 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
7915 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
7916 * result.
7917 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
7918 * @inst_id: the local instance id
7919 * @peer_inst_id: the instance id of the peer's function
7920 * @addr: the MAC address of the peer
7921 * @info_len: the length of the &info
7922 * @info: the Service Specific Info from the peer (if any)
7923 * @cookie: unique identifier of the corresponding function
7924 */
7925struct cfg80211_nan_match_params {
7926 enum nl80211_nan_function_type type;
7927 u8 inst_id;
7928 u8 peer_inst_id;
7929 const u8 *addr;
7930 u8 info_len;
7931 const u8 *info;
7932 u64 cookie;
7933};
7934
7935/**
7936 * cfg80211_nan_match - report a match for a NAN function.
7937 * @wdev: the wireless device reporting the match
7938 * @match: match notification parameters
7939 * @gfp: allocation flags
7940 *
7941 * This function reports that the a NAN function had a match. This
7942 * can be a subscribe that had a match or a solicited publish that
7943 * was sent. It can also be a follow up that was received.
7944 */
7945void cfg80211_nan_match(struct wireless_dev *wdev,
7946 struct cfg80211_nan_match_params *match, gfp_t gfp);
7947
368e5a7b
AB
7948/**
7949 * cfg80211_nan_func_terminated - notify about NAN function termination.
7950 *
7951 * @wdev: the wireless device reporting the match
7952 * @inst_id: the local instance id
7953 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7954 * @cookie: unique NAN function identifier
7955 * @gfp: allocation flags
7956 *
7957 * This function reports that the a NAN function is terminated.
7958 */
7959void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7960 u8 inst_id,
7961 enum nl80211_nan_func_term_reason reason,
7962 u64 cookie, gfp_t gfp);
7963
b7ffbd7e
JB
7964/* ethtool helper */
7965void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7966
40cbfa90
SD
7967/**
7968 * cfg80211_external_auth_request - userspace request for authentication
7969 * @netdev: network device
7970 * @params: External authentication parameters
7971 * @gfp: allocation flags
7972 * Returns: 0 on success, < 0 on error
7973 */
7974int cfg80211_external_auth_request(struct net_device *netdev,
7975 struct cfg80211_external_auth_params *params,
7976 gfp_t gfp);
7977
9bb7e0f2
JB
7978/**
7979 * cfg80211_pmsr_report - report peer measurement result data
7980 * @wdev: the wireless device reporting the measurement
7981 * @req: the original measurement request
7982 * @result: the result data
7983 * @gfp: allocation flags
7984 */
7985void cfg80211_pmsr_report(struct wireless_dev *wdev,
7986 struct cfg80211_pmsr_request *req,
7987 struct cfg80211_pmsr_result *result,
7988 gfp_t gfp);
7989
7990/**
7991 * cfg80211_pmsr_complete - report peer measurement completed
7992 * @wdev: the wireless device reporting the measurement
7993 * @req: the original measurement request
7994 * @gfp: allocation flags
7995 *
7996 * Report that the entire measurement completed, after this
7997 * the request pointer will no longer be valid.
7998 */
7999void cfg80211_pmsr_complete(struct wireless_dev *wdev,
8000 struct cfg80211_pmsr_request *req,
8001 gfp_t gfp);
8002
e6f40511
MP
8003/**
8004 * cfg80211_iftype_allowed - check whether the interface can be allowed
8005 * @wiphy: the wiphy
8006 * @iftype: interface type
8007 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
8008 * @check_swif: check iftype against software interfaces
8009 *
8010 * Check whether the interface is allowed to operate; additionally, this API
8011 * can be used to check iftype against the software interfaces when
8012 * check_swif is '1'.
8013 */
8014bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
8015 bool is_4addr, u8 check_swif);
8016
8017
e1db74fc
JP
8018/* Logging, debugging and troubleshooting/diagnostic helpers. */
8019
8020/* wiphy_printk helpers, similar to dev_printk */
8021
8022#define wiphy_printk(level, wiphy, format, args...) \
9c376639 8023 dev_printk(level, &(wiphy)->dev, format, ##args)
e1db74fc 8024#define wiphy_emerg(wiphy, format, args...) \
9c376639 8025 dev_emerg(&(wiphy)->dev, format, ##args)
e1db74fc 8026#define wiphy_alert(wiphy, format, args...) \
9c376639 8027 dev_alert(&(wiphy)->dev, format, ##args)
e1db74fc 8028#define wiphy_crit(wiphy, format, args...) \
9c376639 8029 dev_crit(&(wiphy)->dev, format, ##args)
e1db74fc 8030#define wiphy_err(wiphy, format, args...) \
9c376639 8031 dev_err(&(wiphy)->dev, format, ##args)
e1db74fc 8032#define wiphy_warn(wiphy, format, args...) \
9c376639 8033 dev_warn(&(wiphy)->dev, format, ##args)
e1db74fc 8034#define wiphy_notice(wiphy, format, args...) \
9c376639 8035 dev_notice(&(wiphy)->dev, format, ##args)
e1db74fc 8036#define wiphy_info(wiphy, format, args...) \
9c376639 8037 dev_info(&(wiphy)->dev, format, ##args)
073730d7 8038
a58d7525
SG
8039#define wiphy_err_ratelimited(wiphy, format, args...) \
8040 dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8041#define wiphy_warn_ratelimited(wiphy, format, args...) \
8042 dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8043
9c376639 8044#define wiphy_debug(wiphy, format, args...) \
e1db74fc 8045 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
9c376639 8046
e1db74fc 8047#define wiphy_dbg(wiphy, format, args...) \
9c376639 8048 dev_dbg(&(wiphy)->dev, format, ##args)
e1db74fc
JP
8049
8050#if defined(VERBOSE_DEBUG)
8051#define wiphy_vdbg wiphy_dbg
8052#else
e1db74fc
JP
8053#define wiphy_vdbg(wiphy, format, args...) \
8054({ \
8055 if (0) \
8056 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
9c376639 8057 0; \
e1db74fc
JP
8058})
8059#endif
8060
8061/*
8062 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8063 * of using a WARN/WARN_ON to get the message out, including the
8064 * file/line information and a backtrace.
8065 */
8066#define wiphy_WARN(wiphy, format, args...) \
8067 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8068
cb74e977
SD
8069/**
8070 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8071 * @netdev: network device
8072 * @owe_info: peer's owe info
8073 * @gfp: allocation flags
8074 */
8075void cfg80211_update_owe_info_event(struct net_device *netdev,
8076 struct cfg80211_update_owe_info *owe_info,
8077 gfp_t gfp);
8078
2f1805ea
EG
8079/**
8080 * cfg80211_bss_flush - resets all the scan entries
8081 * @wiphy: the wiphy
8082 */
8083void cfg80211_bss_flush(struct wiphy *wiphy);
8084
704232c2 8085#endif /* __NET_CFG80211_H */