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