blob: db31d9f3ee83de4e356b76971900f9b4808b4e7b [file] [log] [blame]
Johannes Berg704232c2007-04-23 12:20:05 -07001#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H
Johannes Bergd3236552009-04-20 14:31:42 +02003/*
4 * 802.11 device and configuration interface
5 *
Jouni Malinen026331c2010-02-15 12:53:10 +02006 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
Johannes Berg2740f0c2014-09-03 15:24:58 +03007 * Copyright 2013-2014 Intel Mobile Communications GmbH
David Spinadelb8676222016-09-22 23:16:50 +03008 * Copyright 2015-2016 Intel Deutschland GmbH
Johannes Bergd3236552009-04-20 14:31:42 +02009 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
Johannes Berg704232c2007-04-23 12:20:05 -070014
Johannes Bergd3236552009-04-20 14:31:42 +020015#include <linux/netdevice.h>
16#include <linux/debugfs.h>
17#include <linux/list.h>
Paul Gortmaker187f1882011-11-23 20:12:59 -050018#include <linux/bug.h>
Johannes Berg704232c2007-04-23 12:20:05 -070019#include <linux/netlink.h>
20#include <linux/skbuff.h>
Johannes Berg55682962007-09-20 13:09:35 -040021#include <linux/nl80211.h>
Johannes Berg2a519312009-02-10 21:25:55 +010022#include <linux/if_ether.h>
23#include <linux/ieee80211.h>
Johannes Berg2a0e0472013-01-23 22:57:40 +010024#include <linux/net.h>
Johannes Bergd3236552009-04-20 14:31:42 +020025#include <net/regulatory.h>
26
Vidyullatha Kanchanapally1b3a7182017-07-21 11:43:48 +053027/* backport support for new cfg80211 ops "update_connect_params" */
28#define CFG80211_UPDATE_CONNECT_PARAMS 1
29
Johannes Bergd70e9692010-08-19 16:11:27 +020030/**
Vidyullatha Kanchanapally8b009922017-07-21 12:07:34 +053031 * backport support for NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA
32 * and NL80211_EXT_FEATURE_MGMT_TX_RANDOM_TA_CONNECTED.
33 */
34#define CFG80211_RAND_TA_FOR_PUBLIC_ACTION_FRAME 1
35
Vidyullatha Kanchanapally7f9676c2017-07-21 12:24:30 +053036/* backport support for NL80211_EXT_FEATURE_SCHED_SCAN_RELATIVE_RSSI */
37#define CFG80211_REPORT_BETTER_BSS_IN_SCHED_SCAN 1
38
Vidyullatha Kanchanapallyb56bf882017-07-21 12:34:12 +053039/* backport support for specifying reason for connect timeout */
40#define CFG80211_CONNECT_TIMEOUT_REASON_CODE 1
41
Vidyullatha Kanchanapallye8373c22017-07-21 13:02:50 +053042/* Indicate backport support for the new connect done api */
43#define CFG80211_CONNECT_DONE 1
44
45/* Indicate backport support for FILS SK offload in cfg80211 */
46#define CFG80211_FILS_SK_OFFLOAD_SUPPORT 1
47
Vidyullatha Kanchanapally84aa3ba2017-05-25 20:20:41 +053048/* Indicate support for including KEK length in rekey data */
49#define CFG80211_REKEY_DATA_KEK_LEN 1
50
Jouni Malinena2be0702020-03-27 18:20:31 +053051/* Indicate backport support for key configuration for Beacon protection*/
52#define CFG80211_BIGTK_CONFIGURATION_SUPPORT 1
53
Vidyullatha Kanchanapally8b009922017-07-21 12:07:34 +053054/**
Vidyullatha Kanchanapally40254fd2017-07-25 16:27:23 +053055 * Indicate backport support for the new cfg80211_roamed event which unifies the
56 * old APIs cfg80211_roamed and cfg80211_roamed_bss and takes a structure to
57 * update roam information to the kernel.
58 */
59#define CFG80211_ROAMED_API_UNIFIED 1
60
Srinivas Dasaridf7d3c62018-01-17 16:44:16 +053061/* Indicate backport support for DBS scan control */
62#define CFG80211_SCAN_DBS_CONTROL_SUPPORT 1
63
64/* Indicate backport support for per chain rssi scan */
65#define CFG80211_SCAN_PER_CHAIN_RSSI_SUPPORT 1
66
Srinivas Dasari97b26bd2018-03-07 19:38:31 +053067/* Indicate backport support for external authentication*/
68#define CFG80211_EXTERNAL_AUTH_SUPPORT 1
69
Amar Singhal13785cd2018-05-16 12:20:18 -070070/* Indicate backport support for processing user cell base hint */
71#define CFG80211_USER_HINT_CELL_BASE_SELF_MANAGED 1
72
Srinivas Dasaria0d5b622019-02-20 19:39:26 +053073/* Indicate backport support for external authentication in AP mode */
74#define CFG80211_EXTERNAL_AUTH_AP_SUPPORT 1
75
Ke Huang1806f9f2019-11-28 16:53:37 +080076/* Indicate backport support for DH IE creation/update*/
77#define CFG80211_EXTERNAL_DH_UPDATE_SUPPORT 1
78
Veerendranath Jakkam4db91792020-02-29 23:00:13 +053079/* Indicate backport support for supported AKM advertisement per interface*/
80#define CFG80211_IFTYPE_AKM_SUITES_SUPPORT 1
81
Vidyullatha Kanchanapally40254fd2017-07-25 16:27:23 +053082/**
Johannes Bergd70e9692010-08-19 16:11:27 +020083 * DOC: Introduction
84 *
85 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
86 * userspace and drivers, and offers some utility functionality associated
87 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
88 * by all modern wireless drivers in Linux, so that they offer a consistent
89 * API through nl80211. For backward compatibility, cfg80211 also offers
90 * wireless extensions to userspace, but hides them from drivers completely.
91 *
92 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
93 * use restrictions.
94 */
95
96
97/**
98 * DOC: Device registration
99 *
100 * In order for a driver to use cfg80211, it must register the hardware device
101 * with cfg80211. This happens through a number of hardware capability structs
102 * described below.
103 *
104 * The fundamental structure for each device is the 'wiphy', of which each
105 * instance describes a physical wireless device connected to the system. Each
106 * such wiphy can have zero, one, or many virtual interfaces associated with
107 * it, which need to be identified as such by pointing the network interface's
108 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
109 * the wireless part of the interface, normally this struct is embedded in the
110 * network interface's private data area. Drivers can optionally allow creating
111 * or destroying virtual interfaces on the fly, but without at least one or the
112 * ability to create some the wireless device isn't useful.
113 *
114 * Each wiphy structure contains device capability information, and also has
115 * a pointer to the various operations the driver offers. The definitions and
116 * structures here describe these capabilities in detail.
117 */
118
Johannes Berg9f5e8f62012-11-22 16:59:45 +0100119struct wiphy;
120
Johannes Berg704232c2007-04-23 12:20:05 -0700121/*
Johannes Bergd3236552009-04-20 14:31:42 +0200122 * wireless hardware capability structures
123 */
124
125/**
Johannes Bergd3236552009-04-20 14:31:42 +0200126 * enum ieee80211_channel_flags - channel flags
127 *
128 * Channel flags set by the regulatory control code.
129 *
130 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
Luis R. Rodriguez8fe02e12013-10-21 19:22:25 +0200131 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
132 * sending probe requests or beaconing.
Johannes Bergd3236552009-04-20 14:31:42 +0200133 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
Luis R. Rodriguez689da1b2009-05-02 00:37:18 -0400134 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
Johannes Bergd3236552009-04-20 14:31:42 +0200135 * is not permitted.
Luis R. Rodriguez689da1b2009-05-02 00:37:18 -0400136 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
Johannes Bergd3236552009-04-20 14:31:42 +0200137 * is not permitted.
Seth Forshee03f6b082012-08-01 15:58:42 -0500138 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
Johannes Bergc7a6ee22012-12-12 17:50:39 +0100139 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
140 * this flag indicates that an 80 MHz channel cannot use this
141 * channel as the control or any of the secondary channels.
142 * This may be due to the driver or due to regulatory bandwidth
143 * restrictions.
144 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
145 * this flag indicates that an 160 MHz channel cannot use this
146 * channel as the control or any of the secondary channels.
147 * This may be due to the driver or due to regulatory bandwidth
148 * restrictions.
David Spinadel570dbde2014-02-23 09:12:59 +0200149 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
Arik Nemtsov06f207f2015-05-06 16:28:31 +0300150 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
Rostislav Lisovyea077c12014-04-15 14:37:55 +0200151 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
152 * on this channel.
153 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
154 * on this channel.
David Spinadel570dbde2014-02-23 09:12:59 +0200155 *
Johannes Bergd3236552009-04-20 14:31:42 +0200156 */
157enum ieee80211_channel_flags {
158 IEEE80211_CHAN_DISABLED = 1<<0,
Luis R. Rodriguez8fe02e12013-10-21 19:22:25 +0200159 IEEE80211_CHAN_NO_IR = 1<<1,
160 /* hole at 1<<2 */
Johannes Bergd3236552009-04-20 14:31:42 +0200161 IEEE80211_CHAN_RADAR = 1<<3,
Luis R. Rodriguez689da1b2009-05-02 00:37:18 -0400162 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
163 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
Seth Forshee03f6b082012-08-01 15:58:42 -0500164 IEEE80211_CHAN_NO_OFDM = 1<<6,
Johannes Bergc7a6ee22012-12-12 17:50:39 +0100165 IEEE80211_CHAN_NO_80MHZ = 1<<7,
166 IEEE80211_CHAN_NO_160MHZ = 1<<8,
David Spinadel570dbde2014-02-23 09:12:59 +0200167 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
Arik Nemtsov06f207f2015-05-06 16:28:31 +0300168 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
Rostislav Lisovyea077c12014-04-15 14:37:55 +0200169 IEEE80211_CHAN_NO_20MHZ = 1<<11,
170 IEEE80211_CHAN_NO_10MHZ = 1<<12,
Johannes Bergd3236552009-04-20 14:31:42 +0200171};
172
Luis R. Rodriguez038659e2009-05-02 00:37:17 -0400173#define IEEE80211_CHAN_NO_HT40 \
Luis R. Rodriguez689da1b2009-05-02 00:37:18 -0400174 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
Luis R. Rodriguez038659e2009-05-02 00:37:17 -0400175
Simon Wunderlich04f39042013-02-08 18:16:19 +0100176#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
177#define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
178
Johannes Bergd3236552009-04-20 14:31:42 +0200179/**
180 * struct ieee80211_channel - channel definition
181 *
182 * This structure describes a single channel for use
183 * with cfg80211.
184 *
185 * @center_freq: center frequency in MHz
Johannes Bergd3236552009-04-20 14:31:42 +0200186 * @hw_value: hardware-specific value for the channel
187 * @flags: channel flags from &enum ieee80211_channel_flags.
188 * @orig_flags: channel flags at registration time, used by regulatory
189 * code to support devices with additional restrictions
190 * @band: band this channel belongs to.
191 * @max_antenna_gain: maximum antenna gain in dBi
192 * @max_power: maximum transmission power (in dBm)
Hong Wueccc0682012-01-11 20:33:39 +0200193 * @max_reg_power: maximum regulatory transmission power (in dBm)
Johannes Bergd3236552009-04-20 14:31:42 +0200194 * @beacon_found: helper to regulatory code to indicate when a beacon
195 * has been found on this channel. Use regulatory_hint_found_beacon()
Walter Goldens77c20612010-05-18 04:44:54 -0700196 * to enable this, this is useful only on 5 GHz band.
Johannes Bergd3236552009-04-20 14:31:42 +0200197 * @orig_mag: internal use
198 * @orig_mpwr: internal use
Simon Wunderlich04f39042013-02-08 18:16:19 +0100199 * @dfs_state: current state of this channel. Only relevant if radar is required
200 * on this channel.
201 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
Janusz Dziedzic089027e2014-02-21 19:46:12 +0100202 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
Johannes Bergd3236552009-04-20 14:31:42 +0200203 */
204struct ieee80211_channel {
Johannes Berg57fbcce2016-04-12 15:56:15 +0200205 enum nl80211_band band;
Johannes Bergd3236552009-04-20 14:31:42 +0200206 u16 center_freq;
Johannes Bergd3236552009-04-20 14:31:42 +0200207 u16 hw_value;
208 u32 flags;
209 int max_antenna_gain;
210 int max_power;
Hong Wueccc0682012-01-11 20:33:39 +0200211 int max_reg_power;
Johannes Bergd3236552009-04-20 14:31:42 +0200212 bool beacon_found;
213 u32 orig_flags;
214 int orig_mag, orig_mpwr;
Simon Wunderlich04f39042013-02-08 18:16:19 +0100215 enum nl80211_dfs_state dfs_state;
216 unsigned long dfs_state_entered;
Janusz Dziedzic089027e2014-02-21 19:46:12 +0100217 unsigned int dfs_cac_ms;
Johannes Bergd3236552009-04-20 14:31:42 +0200218};
219
220/**
221 * enum ieee80211_rate_flags - rate flags
222 *
223 * Hardware/specification flags for rates. These are structured
224 * in a way that allows using the same bitrate structure for
225 * different bands/PHY modes.
226 *
227 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
228 * preamble on this bitrate; only relevant in 2.4GHz band and
229 * with CCK rates.
230 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
231 * when used with 802.11a (on the 5 GHz band); filled by the
232 * core code when registering the wiphy.
233 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
234 * when used with 802.11b (on the 2.4 GHz band); filled by the
235 * core code when registering the wiphy.
236 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
237 * when used with 802.11g (on the 2.4 GHz band); filled by the
238 * core code when registering the wiphy.
239 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
Simon Wunderlich30e74732013-05-16 13:00:29 +0200240 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
241 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
Johannes Bergd3236552009-04-20 14:31:42 +0200242 */
243enum ieee80211_rate_flags {
244 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
245 IEEE80211_RATE_MANDATORY_A = 1<<1,
246 IEEE80211_RATE_MANDATORY_B = 1<<2,
247 IEEE80211_RATE_MANDATORY_G = 1<<3,
248 IEEE80211_RATE_ERP_G = 1<<4,
Simon Wunderlich30e74732013-05-16 13:00:29 +0200249 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
250 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
Johannes Bergd3236552009-04-20 14:31:42 +0200251};
252
253/**
Dedy Lansky6eb18132015-02-08 15:52:03 +0200254 * enum ieee80211_bss_type - BSS type filter
255 *
256 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
257 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
258 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
259 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
260 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
261 */
262enum ieee80211_bss_type {
263 IEEE80211_BSS_TYPE_ESS,
264 IEEE80211_BSS_TYPE_PBSS,
265 IEEE80211_BSS_TYPE_IBSS,
266 IEEE80211_BSS_TYPE_MBSS,
267 IEEE80211_BSS_TYPE_ANY
268};
269
270/**
271 * enum ieee80211_privacy - BSS privacy filter
272 *
273 * @IEEE80211_PRIVACY_ON: privacy bit set
274 * @IEEE80211_PRIVACY_OFF: privacy bit clear
275 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
276 */
277enum ieee80211_privacy {
278 IEEE80211_PRIVACY_ON,
279 IEEE80211_PRIVACY_OFF,
280 IEEE80211_PRIVACY_ANY
281};
282
283#define IEEE80211_PRIVACY(x) \
284 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
285
286/**
Johannes Bergd3236552009-04-20 14:31:42 +0200287 * struct ieee80211_rate - bitrate definition
288 *
289 * This structure describes a bitrate that an 802.11 PHY can
290 * operate with. The two values @hw_value and @hw_value_short
291 * are only for driver use when pointers to this structure are
292 * passed around.
293 *
294 * @flags: rate-specific flags
295 * @bitrate: bitrate in units of 100 Kbps
296 * @hw_value: driver/hardware value for this rate
297 * @hw_value_short: driver/hardware value for this rate when
298 * short preamble is used
299 */
300struct ieee80211_rate {
301 u32 flags;
302 u16 bitrate;
303 u16 hw_value, hw_value_short;
304};
305
306/**
307 * struct ieee80211_sta_ht_cap - STA's HT capabilities
308 *
309 * This structure describes most essential parameters needed
310 * to describe 802.11n HT capabilities for an STA.
311 *
312 * @ht_supported: is HT supported by the STA
313 * @cap: HT capabilities map as described in 802.11n spec
314 * @ampdu_factor: Maximum A-MPDU length factor
315 * @ampdu_density: Minimum A-MPDU spacing
316 * @mcs: Supported MCS rates
317 */
318struct ieee80211_sta_ht_cap {
319 u16 cap; /* use IEEE80211_HT_CAP_ */
320 bool ht_supported;
321 u8 ampdu_factor;
322 u8 ampdu_density;
323 struct ieee80211_mcs_info mcs;
324};
325
326/**
Mahesh Palivelabf0c111e2012-06-22 07:27:46 +0000327 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
328 *
329 * This structure describes most essential parameters needed
330 * to describe 802.11ac VHT capabilities for an STA.
331 *
332 * @vht_supported: is VHT supported by the STA
333 * @cap: VHT capabilities map as described in 802.11ac spec
334 * @vht_mcs: Supported VHT MCS rates
335 */
336struct ieee80211_sta_vht_cap {
337 bool vht_supported;
338 u32 cap; /* use IEEE80211_VHT_CAP_ */
339 struct ieee80211_vht_mcs_info vht_mcs;
340};
341
342/**
Johannes Bergd3236552009-04-20 14:31:42 +0200343 * struct ieee80211_supported_band - frequency band definition
344 *
345 * This structure describes a frequency band a wiphy
346 * is able to operate in.
347 *
348 * @channels: Array of channels the hardware can operate in
349 * in this band.
350 * @band: the band this structure represents
351 * @n_channels: Number of channels in @channels
352 * @bitrates: Array of bitrates the hardware can operate with
353 * in this band. Must be sorted to give a valid "supported
354 * rates" IE, i.e. CCK rates first, then OFDM.
355 * @n_bitrates: Number of bitrates in @bitrates
Johannes Bergabe37c42010-06-07 11:12:27 +0200356 * @ht_cap: HT capabilities in this band
Robert P. J. Dayc9a0a302012-08-26 14:21:47 -0400357 * @vht_cap: VHT capabilities in this band
Johannes Bergd3236552009-04-20 14:31:42 +0200358 */
359struct ieee80211_supported_band {
360 struct ieee80211_channel *channels;
361 struct ieee80211_rate *bitrates;
Johannes Berg57fbcce2016-04-12 15:56:15 +0200362 enum nl80211_band band;
Johannes Bergd3236552009-04-20 14:31:42 +0200363 int n_channels;
364 int n_bitrates;
365 struct ieee80211_sta_ht_cap ht_cap;
Mahesh Palivelabf0c111e2012-06-22 07:27:46 +0000366 struct ieee80211_sta_vht_cap vht_cap;
Johannes Bergd3236552009-04-20 14:31:42 +0200367};
368
369/*
370 * Wireless hardware/device configuration structures and methods
Johannes Berg704232c2007-04-23 12:20:05 -0700371 */
372
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100373/**
Johannes Bergd70e9692010-08-19 16:11:27 +0200374 * DOC: Actions and configuration
375 *
376 * Each wireless device and each virtual interface offer a set of configuration
377 * operations and other actions that are invoked by userspace. Each of these
378 * actions is described in the operations structure, and the parameters these
379 * operations use are described separately.
380 *
381 * Additionally, some operations are asynchronous and expect to get status
382 * information via some functions that drivers need to call.
383 *
384 * Scanning and BSS list handling with its associated functionality is described
385 * in a separate chapter.
386 */
387
Aviya Erenfeldc6e6a0c2016-07-05 15:23:08 +0300388#define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
389 WLAN_USER_POSITION_LEN)
390
Johannes Bergd70e9692010-08-19 16:11:27 +0200391/**
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100392 * struct vif_params - describes virtual interface parameters
Felix Fietkau8b787642009-11-10 18:53:10 +0100393 * @use_4addr: use 4-address frames
Ben Greeare8f479b2014-10-22 12:23:05 -0700394 * @macaddr: address to use for this virtual interface.
395 * If this parameter is set to zero address the driver may
396 * determine the address as needed.
397 * This feature is only fully supported by drivers that enable the
398 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
399 ** only p2p devices with specified MAC.
Aviya Erenfeldc6e6a0c2016-07-05 15:23:08 +0300400 * @vht_mumimo_groups: MU-MIMO groupID. used for monitoring only
401 * packets belonging to that MU-MIMO groupID.
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100402 */
403struct vif_params {
Aviya Erenfeldc6e6a0c2016-07-05 15:23:08 +0300404 int use_4addr;
405 u8 macaddr[ETH_ALEN];
406 u8 vht_mumimo_groups[VHT_MUMIMO_GROUPS_DATA_LEN];
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100407};
408
Andy Green179f8312007-07-10 19:29:38 +0200409/**
Johannes Berg41ade002007-12-19 02:03:29 +0100410 * struct key_params - key information
411 *
412 * Information about a key
413 *
414 * @key: key material
415 * @key_len: length of key material
416 * @cipher: cipher suite selector
417 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
418 * with the get_key() callback, must be in little endian,
419 * length given by @seq_len.
Johannes Bergabe37c42010-06-07 11:12:27 +0200420 * @seq_len: length of @seq.
Johannes Berg41ade002007-12-19 02:03:29 +0100421 */
422struct key_params {
Johannes Bergc1e5f472014-05-19 17:53:16 +0200423 const u8 *key;
424 const u8 *seq;
Johannes Berg41ade002007-12-19 02:03:29 +0100425 int key_len;
426 int seq_len;
427 u32 cipher;
428};
429
Johannes Berged1b6cc2007-12-19 02:03:32 +0100430/**
Johannes Berg683b6d32012-11-08 21:25:48 +0100431 * struct cfg80211_chan_def - channel definition
432 * @chan: the (control) channel
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100433 * @width: channel width
434 * @center_freq1: center frequency of first segment
435 * @center_freq2: center frequency of second segment
436 * (only with 80+80 MHz)
Johannes Berg683b6d32012-11-08 21:25:48 +0100437 */
438struct cfg80211_chan_def {
439 struct ieee80211_channel *chan;
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100440 enum nl80211_chan_width width;
441 u32 center_freq1;
442 u32 center_freq2;
Johannes Berg683b6d32012-11-08 21:25:48 +0100443};
444
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100445/**
446 * cfg80211_get_chandef_type - return old channel type from chandef
447 * @chandef: the channel definition
448 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100449 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100450 * chandef, which must have a bandwidth allowing this conversion.
451 */
Johannes Berg683b6d32012-11-08 21:25:48 +0100452static inline enum nl80211_channel_type
453cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
454{
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100455 switch (chandef->width) {
456 case NL80211_CHAN_WIDTH_20_NOHT:
457 return NL80211_CHAN_NO_HT;
458 case NL80211_CHAN_WIDTH_20:
459 return NL80211_CHAN_HT20;
460 case NL80211_CHAN_WIDTH_40:
461 if (chandef->center_freq1 > chandef->chan->center_freq)
462 return NL80211_CHAN_HT40PLUS;
463 return NL80211_CHAN_HT40MINUS;
464 default:
465 WARN_ON(1);
466 return NL80211_CHAN_NO_HT;
467 }
Johannes Berg683b6d32012-11-08 21:25:48 +0100468}
469
470/**
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100471 * cfg80211_chandef_create - create channel definition using channel type
472 * @chandef: the channel definition struct to fill
473 * @channel: the control channel
474 * @chantype: the channel type
475 *
476 * Given a channel type, create a channel definition.
477 */
478void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
479 struct ieee80211_channel *channel,
480 enum nl80211_channel_type chantype);
481
482/**
483 * cfg80211_chandef_identical - check if two channel definitions are identical
484 * @chandef1: first channel definition
485 * @chandef2: second channel definition
486 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100487 * Return: %true if the channels defined by the channel definitions are
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100488 * identical, %false otherwise.
489 */
490static inline bool
491cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
492 const struct cfg80211_chan_def *chandef2)
493{
494 return (chandef1->chan == chandef2->chan &&
495 chandef1->width == chandef2->width &&
496 chandef1->center_freq1 == chandef2->center_freq1 &&
497 chandef1->center_freq2 == chandef2->center_freq2);
498}
499
500/**
501 * cfg80211_chandef_compatible - check if two channel definitions are compatible
502 * @chandef1: first channel definition
503 * @chandef2: second channel definition
504 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100505 * Return: %NULL if the given channel definitions are incompatible,
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100506 * chandef1 or chandef2 otherwise.
507 */
508const struct cfg80211_chan_def *
509cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
510 const struct cfg80211_chan_def *chandef2);
511
512/**
Johannes Berg9f5e8f62012-11-22 16:59:45 +0100513 * cfg80211_chandef_valid - check if a channel definition is valid
514 * @chandef: the channel definition to check
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100515 * Return: %true if the channel definition is valid. %false otherwise.
Johannes Berg9f5e8f62012-11-22 16:59:45 +0100516 */
517bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
518
519/**
520 * cfg80211_chandef_usable - check if secondary channels can be used
521 * @wiphy: the wiphy to validate against
522 * @chandef: the channel definition to check
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100523 * @prohibited_flags: the regulatory channel flags that must not be set
524 * Return: %true if secondary channels are usable. %false otherwise.
Johannes Berg9f5e8f62012-11-22 16:59:45 +0100525 */
526bool cfg80211_chandef_usable(struct wiphy *wiphy,
527 const struct cfg80211_chan_def *chandef,
528 u32 prohibited_flags);
529
530/**
Simon Wunderlich774f0732013-08-28 13:41:28 +0200531 * cfg80211_chandef_dfs_required - checks if radar detection is required
532 * @wiphy: the wiphy to validate against
533 * @chandef: the channel definition to check
Luciano Coelho2beb6dab2014-02-18 11:40:36 +0200534 * @iftype: the interface type as specified in &enum nl80211_iftype
535 * Returns:
536 * 1 if radar detection is required, 0 if it is not, < 0 on error
Simon Wunderlich774f0732013-08-28 13:41:28 +0200537 */
538int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
Luciano Coelho2beb6dab2014-02-18 11:40:36 +0200539 const struct cfg80211_chan_def *chandef,
Luciano Coelhoc3d62032014-05-07 19:07:05 +0300540 enum nl80211_iftype iftype);
Simon Wunderlich774f0732013-08-28 13:41:28 +0200541
542/**
Simon Wunderlich30e74732013-05-16 13:00:29 +0200543 * ieee80211_chandef_rate_flags - returns rate flags for a channel
544 *
545 * In some channel types, not all rates may be used - for example CCK
546 * rates may not be used in 5/10 MHz channels.
547 *
548 * @chandef: channel definition for the channel
549 *
550 * Returns: rate flags which apply for this channel
551 */
552static inline enum ieee80211_rate_flags
553ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
554{
555 switch (chandef->width) {
556 case NL80211_CHAN_WIDTH_5:
557 return IEEE80211_RATE_SUPPORTS_5MHZ;
558 case NL80211_CHAN_WIDTH_10:
559 return IEEE80211_RATE_SUPPORTS_10MHZ;
560 default:
561 break;
562 }
563 return 0;
564}
565
566/**
Simon Wunderlich0430c882013-07-08 16:55:55 +0200567 * ieee80211_chandef_max_power - maximum transmission power for the chandef
568 *
569 * In some regulations, the transmit power may depend on the configured channel
570 * bandwidth which may be defined as dBm/MHz. This function returns the actual
571 * max_power for non-standard (20 MHz) channels.
572 *
573 * @chandef: channel definition for the channel
574 *
575 * Returns: maximum allowed transmission power in dBm for the chandef
576 */
577static inline int
578ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
579{
580 switch (chandef->width) {
581 case NL80211_CHAN_WIDTH_5:
582 return min(chandef->chan->max_reg_power - 6,
583 chandef->chan->max_power);
584 case NL80211_CHAN_WIDTH_10:
585 return min(chandef->chan->max_reg_power - 3,
586 chandef->chan->max_power);
587 default:
588 break;
589 }
590 return chandef->chan->max_power;
591}
592
593/**
Holger Schurig61fa7132009-11-11 12:25:40 +0100594 * enum survey_info_flags - survey information flags
595 *
Johannes Bergabe37c42010-06-07 11:12:27 +0200596 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
Felix Fietkau17e5a802010-09-29 17:15:30 +0200597 * @SURVEY_INFO_IN_USE: channel is currently being used
Johannes Berg4ed20be2014-11-14 16:35:34 +0100598 * @SURVEY_INFO_TIME: active time (in ms) was filled in
599 * @SURVEY_INFO_TIME_BUSY: busy time was filled in
600 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
601 * @SURVEY_INFO_TIME_RX: receive time was filled in
602 * @SURVEY_INFO_TIME_TX: transmit time was filled in
Johannes Berg052536a2014-11-14 16:44:11 +0100603 * @SURVEY_INFO_TIME_SCAN: scan time was filled in
Johannes Bergabe37c42010-06-07 11:12:27 +0200604 *
Holger Schurig61fa7132009-11-11 12:25:40 +0100605 * Used by the driver to indicate which info in &struct survey_info
606 * it has filled in during the get_survey().
607 */
608enum survey_info_flags {
Johannes Berg4ed20be2014-11-14 16:35:34 +0100609 SURVEY_INFO_NOISE_DBM = BIT(0),
610 SURVEY_INFO_IN_USE = BIT(1),
611 SURVEY_INFO_TIME = BIT(2),
612 SURVEY_INFO_TIME_BUSY = BIT(3),
613 SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
614 SURVEY_INFO_TIME_RX = BIT(5),
615 SURVEY_INFO_TIME_TX = BIT(6),
Johannes Berg052536a2014-11-14 16:44:11 +0100616 SURVEY_INFO_TIME_SCAN = BIT(7),
Holger Schurig61fa7132009-11-11 12:25:40 +0100617};
618
619/**
620 * struct survey_info - channel survey response
621 *
Johannes Berg11f78ac2014-11-14 16:43:50 +0100622 * @channel: the channel this survey record reports, may be %NULL for a single
623 * record to report global statistics
Holger Schurig61fa7132009-11-11 12:25:40 +0100624 * @filled: bitflag of flags from &enum survey_info_flags
625 * @noise: channel noise in dBm. This and all following fields are
Johannes Bergad24b0d2013-07-05 11:53:28 +0200626 * optional
Johannes Berg4ed20be2014-11-14 16:35:34 +0100627 * @time: amount of time in ms the radio was turn on (on the channel)
628 * @time_busy: amount of time the primary channel was sensed busy
629 * @time_ext_busy: amount of time the extension channel was sensed busy
630 * @time_rx: amount of time the radio spent receiving data
631 * @time_tx: amount of time the radio spent transmitting data
Johannes Berg052536a2014-11-14 16:44:11 +0100632 * @time_scan: amount of time the radio spent for scanning
Holger Schurig61fa7132009-11-11 12:25:40 +0100633 *
Johannes Bergabe37c42010-06-07 11:12:27 +0200634 * Used by dump_survey() to report back per-channel survey information.
635 *
Holger Schurig61fa7132009-11-11 12:25:40 +0100636 * This structure can later be expanded with things like
637 * channel duty cycle etc.
638 */
639struct survey_info {
640 struct ieee80211_channel *channel;
Johannes Berg4ed20be2014-11-14 16:35:34 +0100641 u64 time;
642 u64 time_busy;
643 u64 time_ext_busy;
644 u64 time_rx;
645 u64 time_tx;
Johannes Berg052536a2014-11-14 16:44:11 +0100646 u64 time_scan;
Holger Schurig61fa7132009-11-11 12:25:40 +0100647 u32 filled;
648 s8 noise;
649};
650
David Spinadelb8676222016-09-22 23:16:50 +0300651#define CFG80211_MAX_WEP_KEYS 4
652
Holger Schurig61fa7132009-11-11 12:25:40 +0100653/**
Jouni Malinen5fb628e2011-08-10 23:54:35 +0300654 * struct cfg80211_crypto_settings - Crypto settings
655 * @wpa_versions: indicates which, if any, WPA versions are enabled
656 * (from enum nl80211_wpa_versions)
657 * @cipher_group: group key cipher suite (or 0 if unset)
658 * @n_ciphers_pairwise: number of AP supported unicast ciphers
659 * @ciphers_pairwise: unicast key cipher suites
660 * @n_akm_suites: number of AKM suites
661 * @akm_suites: AKM suites
662 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
663 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
664 * required to assume that the port is unauthorized until authorized by
665 * user space. Otherwise, port is marked authorized by default.
666 * @control_port_ethertype: the control port protocol that should be
667 * allowed through even on unauthorized ports
668 * @control_port_no_encrypt: TRUE to prevent encryption of control port
669 * protocol frames.
David Spinadelb8676222016-09-22 23:16:50 +0300670 * @wep_keys: static WEP keys, if not NULL points to an array of
671 * CFG80211_MAX_WEP_KEYS WEP keys
672 * @wep_tx_key: key index (0..3) of the default TX static WEP key
Jouni Malinen5fb628e2011-08-10 23:54:35 +0300673 */
674struct cfg80211_crypto_settings {
675 u32 wpa_versions;
676 u32 cipher_group;
677 int n_ciphers_pairwise;
678 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
679 int n_akm_suites;
680 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
681 bool control_port;
682 __be16 control_port_ethertype;
683 bool control_port_no_encrypt;
David Spinadelb8676222016-09-22 23:16:50 +0300684 struct key_params *wep_keys;
685 int wep_tx_key;
Jouni Malinen5fb628e2011-08-10 23:54:35 +0300686};
687
688/**
Johannes Berg88600202012-02-13 15:17:18 +0100689 * struct cfg80211_beacon_data - beacon data
Johannes Berged1b6cc2007-12-19 02:03:32 +0100690 * @head: head portion of beacon (before TIM IE)
Johannes Bergad24b0d2013-07-05 11:53:28 +0200691 * or %NULL if not changed
Johannes Berged1b6cc2007-12-19 02:03:32 +0100692 * @tail: tail portion of beacon (after TIM IE)
Johannes Bergad24b0d2013-07-05 11:53:28 +0200693 * or %NULL if not changed
Johannes Berged1b6cc2007-12-19 02:03:32 +0100694 * @head_len: length of @head
695 * @tail_len: length of @tail
Jouni Malinen9946ecf2011-08-10 23:55:56 +0300696 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
697 * @beacon_ies_len: length of beacon_ies in octets
698 * @proberesp_ies: extra information element(s) to add into Probe Response
699 * frames or %NULL
700 * @proberesp_ies_len: length of proberesp_ies in octets
701 * @assocresp_ies: extra information element(s) to add into (Re)Association
702 * Response frames or %NULL
703 * @assocresp_ies_len: length of assocresp_ies in octets
Arik Nemtsov00f740e2011-11-10 11:28:56 +0200704 * @probe_resp_len: length of probe response template (@probe_resp)
705 * @probe_resp: probe response template (AP mode only)
Johannes Berged1b6cc2007-12-19 02:03:32 +0100706 */
Johannes Berg88600202012-02-13 15:17:18 +0100707struct cfg80211_beacon_data {
708 const u8 *head, *tail;
709 const u8 *beacon_ies;
710 const u8 *proberesp_ies;
711 const u8 *assocresp_ies;
712 const u8 *probe_resp;
713
714 size_t head_len, tail_len;
715 size_t beacon_ies_len;
716 size_t proberesp_ies_len;
717 size_t assocresp_ies_len;
718 size_t probe_resp_len;
719};
720
Vasanthakumar Thiagarajan6d45a742013-01-18 11:18:44 +0530721struct mac_address {
722 u8 addr[ETH_ALEN];
723};
724
Johannes Berg88600202012-02-13 15:17:18 +0100725/**
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +0530726 * struct cfg80211_acl_data - Access control list data
727 *
728 * @acl_policy: ACL policy to be applied on the station's
Johannes Berg077f8972013-02-08 09:06:36 +0100729 * entry specified by mac_addr
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +0530730 * @n_acl_entries: Number of MAC address entries passed
731 * @mac_addrs: List of MAC addresses of stations to be used for ACL
732 */
733struct cfg80211_acl_data {
734 enum nl80211_acl_policy acl_policy;
735 int n_acl_entries;
736
737 /* Keep it last */
738 struct mac_address mac_addrs[];
739};
740
Purushottam Kushwahaa7c7fbf2016-09-14 17:38:44 +0530741/*
742 * cfg80211_bitrate_mask - masks for bitrate control
743 */
744struct cfg80211_bitrate_mask {
745 struct {
746 u32 legacy;
747 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
748 u16 vht_mcs[NL80211_VHT_NSS_MAX];
749 enum nl80211_txrate_gi gi;
750 } control[NUM_NL80211_BANDS];
751};
752
Johannes Berg88600202012-02-13 15:17:18 +0100753/**
Srinivas Dasari0c095552019-08-12 13:08:43 +0530754 * enum cfg80211_ap_settings_flags - AP settings flags
755 *
756 * Used by cfg80211_ap_settings
757 *
758 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
759 */
760enum cfg80211_ap_settings_flags {
761 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
762};
763
764/**
Johannes Berg88600202012-02-13 15:17:18 +0100765 * struct cfg80211_ap_settings - AP configuration
766 *
767 * Used to configure an AP interface.
768 *
Johannes Berg683b6d32012-11-08 21:25:48 +0100769 * @chandef: defines the channel to use
Johannes Berg88600202012-02-13 15:17:18 +0100770 * @beacon: beacon data
771 * @beacon_interval: beacon interval
772 * @dtim_period: DTIM period
773 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
774 * user space)
775 * @ssid_len: length of @ssid
776 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
777 * @crypto: crypto settings
778 * @privacy: the BSS uses privacy
779 * @auth_type: Authentication type (algorithm)
Eliad Peller18998c32014-09-10 14:07:34 +0300780 * @smps_mode: SMPS mode
Vasanthakumar Thiagarajan1b658f12012-03-02 15:50:02 +0530781 * @inactivity_timeout: time in seconds to determine station's inactivity.
Johannes Berg53cabad2012-11-14 15:17:28 +0100782 * @p2p_ctwindow: P2P CT Window
783 * @p2p_opp_ps: P2P opportunistic PS
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +0530784 * @acl: ACL configuration used by the drivers which has support for
785 * MAC address based access control
Lior David34d50512016-01-28 10:58:25 +0200786 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
787 * networks.
Johannes Berg8564e382016-09-19 09:44:44 +0200788 * @beacon_rate: bitrate to be used for beacons
Srinivas Dasari0c095552019-08-12 13:08:43 +0530789 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
Johannes Berg88600202012-02-13 15:17:18 +0100790 */
791struct cfg80211_ap_settings {
Johannes Berg683b6d32012-11-08 21:25:48 +0100792 struct cfg80211_chan_def chandef;
Johannes Bergaa430da2012-05-16 23:50:18 +0200793
Johannes Berg88600202012-02-13 15:17:18 +0100794 struct cfg80211_beacon_data beacon;
795
796 int beacon_interval, dtim_period;
Jouni Malinen32e9de82011-08-10 23:53:31 +0300797 const u8 *ssid;
798 size_t ssid_len;
799 enum nl80211_hidden_ssid hidden_ssid;
Jouni Malinen5fb628e2011-08-10 23:54:35 +0300800 struct cfg80211_crypto_settings crypto;
801 bool privacy;
802 enum nl80211_auth_type auth_type;
Eliad Peller18998c32014-09-10 14:07:34 +0300803 enum nl80211_smps_mode smps_mode;
Vasanthakumar Thiagarajan1b658f12012-03-02 15:50:02 +0530804 int inactivity_timeout;
Johannes Berg53cabad2012-11-14 15:17:28 +0100805 u8 p2p_ctwindow;
806 bool p2p_opp_ps;
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +0530807 const struct cfg80211_acl_data *acl;
Lior David34d50512016-01-28 10:58:25 +0200808 bool pbss;
Purushottam Kushwahaa7c7fbf2016-09-14 17:38:44 +0530809 struct cfg80211_bitrate_mask beacon_rate;
Srinivas Dasari0c095552019-08-12 13:08:43 +0530810 u32 flags;
Johannes Berged1b6cc2007-12-19 02:03:32 +0100811};
812
Johannes Berg5727ef12007-12-19 02:03:34 +0100813/**
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +0200814 * struct cfg80211_csa_settings - channel switch settings
815 *
816 * Used for channel switch
817 *
818 * @chandef: defines the channel to use after the switch
819 * @beacon_csa: beacon data while performing the switch
Andrei Otcheretianski9a774c72014-05-09 14:11:46 +0300820 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
821 * @counter_offsets_presp: offsets of the counters within the probe response
822 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
823 * @n_counter_offsets_presp: number of csa counters in the probe response
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +0200824 * @beacon_after: beacon data to be used on the new channel
825 * @radar_required: whether radar detection is required on the new channel
826 * @block_tx: whether transmissions should be blocked while changing
827 * @count: number of beacons until switch
828 */
829struct cfg80211_csa_settings {
830 struct cfg80211_chan_def chandef;
831 struct cfg80211_beacon_data beacon_csa;
Andrei Otcheretianski9a774c72014-05-09 14:11:46 +0300832 const u16 *counter_offsets_beacon;
833 const u16 *counter_offsets_presp;
834 unsigned int n_counter_offsets_beacon;
835 unsigned int n_counter_offsets_presp;
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +0200836 struct cfg80211_beacon_data beacon_after;
837 bool radar_required;
838 bool block_tx;
839 u8 count;
840};
841
842/**
Purushottam Kushwaha11716392016-10-12 18:25:35 +0530843 * struct iface_combination_params - input parameters for interface combinations
844 *
845 * Used to pass interface combination parameters
846 *
847 * @num_different_channels: the number of different channels we want
848 * to use for verification
849 * @radar_detect: a bitmap where each bit corresponds to a channel
850 * width where radar detection is needed, as in the definition of
851 * &struct ieee80211_iface_combination.@radar_detect_widths
852 * @iftype_num: array with the number of interfaces of each interface
853 * type. The index is the interface type as specified in &enum
854 * nl80211_iftype.
Johannes Berg654c3b92016-10-21 14:25:13 +0200855 * @new_beacon_int: set this to the beacon interval of a new interface
856 * that's not operating yet, if such is to be checked as part of
857 * the verification
Purushottam Kushwaha11716392016-10-12 18:25:35 +0530858 */
859struct iface_combination_params {
860 int num_different_channels;
861 u8 radar_detect;
862 int iftype_num[NUM_NL80211_IFTYPES];
Johannes Berg654c3b92016-10-21 14:25:13 +0200863 u32 new_beacon_int;
Purushottam Kushwaha11716392016-10-12 18:25:35 +0530864};
865
866/**
Johannes Berg3b9ce802011-09-27 20:56:12 +0200867 * enum station_parameters_apply_mask - station parameter values to apply
868 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
Jouni Malinen9d62a982013-02-14 21:10:13 +0200869 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
Johannes Bergf8bacc22013-02-14 23:27:01 +0100870 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
Johannes Berg3b9ce802011-09-27 20:56:12 +0200871 *
872 * Not all station parameters have in-band "no change" signalling,
873 * for those that don't these flags will are used.
874 */
875enum station_parameters_apply_mask {
876 STATION_PARAM_APPLY_UAPSD = BIT(0),
Jouni Malinen9d62a982013-02-14 21:10:13 +0200877 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
Johannes Bergf8bacc22013-02-14 23:27:01 +0100878 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
Johannes Berg3b9ce802011-09-27 20:56:12 +0200879};
880
881/**
Johannes Berg5727ef12007-12-19 02:03:34 +0100882 * struct station_parameters - station parameters
883 *
884 * Used to change and create a new station.
885 *
886 * @vlan: vlan interface station should belong to
887 * @supported_rates: supported rates in IEEE 802.11 format
888 * (or NULL for no change)
889 * @supported_rates_len: number of supported rates
Johannes Bergeccb8e82009-05-11 21:57:56 +0300890 * @sta_flags_mask: station flags that changed
Johannes Berg819bf592016-10-11 14:56:53 +0200891 * (bitmask of BIT(%NL80211_STA_FLAG_...))
Johannes Bergeccb8e82009-05-11 21:57:56 +0300892 * @sta_flags_set: station flags values
Johannes Berg819bf592016-10-11 14:56:53 +0200893 * (bitmask of BIT(%NL80211_STA_FLAG_...))
Johannes Berg5727ef12007-12-19 02:03:34 +0100894 * @listen_interval: listen interval or -1 for no change
895 * @aid: AID or zero for no change
Masashi Honma7d27a0b2016-07-01 10:19:34 +0900896 * @peer_aid: mesh peer AID or zero for no change
Johannes Bergabe37c42010-06-07 11:12:27 +0200897 * @plink_action: plink action to take
Javier Cardona9c3990a2011-05-03 16:57:11 -0700898 * @plink_state: set the peer link state for a station
Johannes Bergabe37c42010-06-07 11:12:27 +0200899 * @ht_capa: HT capabilities of station
Mahesh Palivelaf461be3e2012-10-11 08:04:52 +0000900 * @vht_capa: VHT capabilities of station
Eliad Peller910868d2011-09-11 09:46:55 +0300901 * @uapsd_queues: bitmap of queues configured for uapsd. same format
902 * as the AC bitmap in the QoS info field
903 * @max_sp: max Service Period. same format as the MAX_SP in the
904 * QoS info field (but already shifted down)
Johannes Bergc26887d2011-11-08 09:20:07 +0100905 * @sta_modify_mask: bitmap indicating which parameters changed
906 * (for those that don't have a natural "no change" value),
907 * see &enum station_parameters_apply_mask
Marco Porsch3b1c5a52013-01-07 16:04:52 +0100908 * @local_pm: local link-specific mesh power save mode (no change when set
909 * to unknown)
Jouni Malinen9d62a982013-02-14 21:10:13 +0200910 * @capability: station capability
911 * @ext_capab: extended capabilities of the station
912 * @ext_capab_len: number of extended capabilities
Sunil Duttc01fc9a2013-10-09 20:45:21 +0530913 * @supported_channels: supported channels in IEEE 802.11 format
914 * @supported_channels_len: number of supported channels
915 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
916 * @supported_oper_classes_len: number of supported operating classes
Marek Kwaczynski60f4a7b2013-12-03 10:04:59 +0100917 * @opmode_notif: operating mode field from Operating Mode Notification
918 * @opmode_notif_used: information if operating mode field is used
Ayala Beker17b94242016-03-17 15:41:38 +0200919 * @support_p2p_ps: information if station supports P2P PS mechanism
Johannes Berg5727ef12007-12-19 02:03:34 +0100920 */
921struct station_parameters {
Johannes Berg2c1aabf2013-02-14 23:33:40 +0100922 const u8 *supported_rates;
Johannes Berg5727ef12007-12-19 02:03:34 +0100923 struct net_device *vlan;
Johannes Bergeccb8e82009-05-11 21:57:56 +0300924 u32 sta_flags_mask, sta_flags_set;
Johannes Berg3b9ce802011-09-27 20:56:12 +0200925 u32 sta_modify_mask;
Johannes Berg5727ef12007-12-19 02:03:34 +0100926 int listen_interval;
927 u16 aid;
Masashi Honma7d27a0b2016-07-01 10:19:34 +0900928 u16 peer_aid;
Johannes Berg5727ef12007-12-19 02:03:34 +0100929 u8 supported_rates_len;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100930 u8 plink_action;
Javier Cardona9c3990a2011-05-03 16:57:11 -0700931 u8 plink_state;
Johannes Berg2c1aabf2013-02-14 23:33:40 +0100932 const struct ieee80211_ht_cap *ht_capa;
933 const struct ieee80211_vht_cap *vht_capa;
Eliad Pellerc75786c2011-08-23 14:37:46 +0300934 u8 uapsd_queues;
935 u8 max_sp;
Marco Porsch3b1c5a52013-01-07 16:04:52 +0100936 enum nl80211_mesh_power_mode local_pm;
Jouni Malinen9d62a982013-02-14 21:10:13 +0200937 u16 capability;
Johannes Berg2c1aabf2013-02-14 23:33:40 +0100938 const u8 *ext_capab;
Jouni Malinen9d62a982013-02-14 21:10:13 +0200939 u8 ext_capab_len;
Sunil Duttc01fc9a2013-10-09 20:45:21 +0530940 const u8 *supported_channels;
941 u8 supported_channels_len;
942 const u8 *supported_oper_classes;
943 u8 supported_oper_classes_len;
Marek Kwaczynski60f4a7b2013-12-03 10:04:59 +0100944 u8 opmode_notif;
945 bool opmode_notif_used;
Ayala Beker17b94242016-03-17 15:41:38 +0200946 int support_p2p_ps;
Johannes Berg5727ef12007-12-19 02:03:34 +0100947};
948
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100949/**
Jouni Malinen89c771e2014-10-10 20:52:40 +0300950 * struct station_del_parameters - station deletion parameters
951 *
952 * Used to delete a station entry (or all stations).
953 *
954 * @mac: MAC address of the station to remove or NULL to remove all stations
Jouni Malinen98856862014-10-20 13:20:45 +0300955 * @subtype: Management frame subtype to use for indicating removal
956 * (10 = Disassociation, 12 = Deauthentication)
957 * @reason_code: Reason code for the Disassociation/Deauthentication frame
Jouni Malinen89c771e2014-10-10 20:52:40 +0300958 */
959struct station_del_parameters {
960 const u8 *mac;
Jouni Malinen98856862014-10-20 13:20:45 +0300961 u8 subtype;
962 u16 reason_code;
Jouni Malinen89c771e2014-10-10 20:52:40 +0300963};
964
965/**
Johannes Berg77ee7c82013-02-15 00:48:33 +0100966 * enum cfg80211_station_type - the type of station being modified
967 * @CFG80211_STA_AP_CLIENT: client of an AP interface
Ayala Beker47edb112015-09-21 15:49:53 +0300968 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
969 * unassociated (update properties for this type of client is permitted)
Johannes Berg77ee7c82013-02-15 00:48:33 +0100970 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
971 * the AP MLME in the device
972 * @CFG80211_STA_AP_STA: AP station on managed interface
973 * @CFG80211_STA_IBSS: IBSS station
974 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
975 * while TDLS setup is in progress, it moves out of this state when
976 * being marked authorized; use this only if TDLS with external setup is
977 * supported/used)
978 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
979 * entry that is operating, has been marked authorized by userspace)
Thomas Pederseneef941e2013-03-04 13:06:11 -0800980 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
981 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
Johannes Berg77ee7c82013-02-15 00:48:33 +0100982 */
983enum cfg80211_station_type {
984 CFG80211_STA_AP_CLIENT,
Ayala Beker47edb112015-09-21 15:49:53 +0300985 CFG80211_STA_AP_CLIENT_UNASSOC,
Johannes Berg77ee7c82013-02-15 00:48:33 +0100986 CFG80211_STA_AP_MLME_CLIENT,
987 CFG80211_STA_AP_STA,
988 CFG80211_STA_IBSS,
989 CFG80211_STA_TDLS_PEER_SETUP,
990 CFG80211_STA_TDLS_PEER_ACTIVE,
Thomas Pederseneef941e2013-03-04 13:06:11 -0800991 CFG80211_STA_MESH_PEER_KERNEL,
992 CFG80211_STA_MESH_PEER_USER,
Johannes Berg77ee7c82013-02-15 00:48:33 +0100993};
994
995/**
996 * cfg80211_check_station_change - validate parameter changes
997 * @wiphy: the wiphy this operates on
998 * @params: the new parameters for a station
999 * @statype: the type of station being modified
1000 *
1001 * Utility function for the @change_station driver method. Call this function
1002 * with the appropriate station type looking up the station (and checking that
1003 * it exists). It will verify whether the station change is acceptable, and if
1004 * not will return an error code. Note that it may modify the parameters for
1005 * backward compatibility reasons, so don't use them before calling this.
1006 */
1007int cfg80211_check_station_change(struct wiphy *wiphy,
1008 struct station_parameters *params,
1009 enum cfg80211_station_type statype);
1010
1011/**
Henning Rogge420e7fa2008-12-11 22:04:19 +01001012 * enum station_info_rate_flags - bitrate info flags
1013 *
1014 * Used by the driver to indicate the specific rate transmission
1015 * type for 802.11n transmissions.
1016 *
Johannes Bergdb9c64c2012-11-09 14:56:41 +01001017 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1018 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
Henning Rogge420e7fa2008-12-11 22:04:19 +01001019 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
Johannes Bergdb9c64c2012-11-09 14:56:41 +01001020 * @RATE_INFO_FLAGS_60G: 60GHz MCS
Henning Rogge420e7fa2008-12-11 22:04:19 +01001021 */
1022enum rate_info_flags {
Johannes Bergdb9c64c2012-11-09 14:56:41 +01001023 RATE_INFO_FLAGS_MCS = BIT(0),
1024 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
Johannes Bergb51f3be2015-01-15 16:14:02 +01001025 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
1026 RATE_INFO_FLAGS_60G = BIT(3),
1027};
1028
1029/**
1030 * enum rate_info_bw - rate bandwidth information
1031 *
1032 * Used by the driver to indicate the rate bandwidth.
1033 *
1034 * @RATE_INFO_BW_5: 5 MHz bandwidth
1035 * @RATE_INFO_BW_10: 10 MHz bandwidth
1036 * @RATE_INFO_BW_20: 20 MHz bandwidth
1037 * @RATE_INFO_BW_40: 40 MHz bandwidth
1038 * @RATE_INFO_BW_80: 80 MHz bandwidth
1039 * @RATE_INFO_BW_160: 160 MHz bandwidth
1040 */
1041enum rate_info_bw {
Johannes Berg9abd45b2017-05-04 08:42:30 +02001042 RATE_INFO_BW_20 = 0,
Johannes Bergb51f3be2015-01-15 16:14:02 +01001043 RATE_INFO_BW_5,
1044 RATE_INFO_BW_10,
Johannes Bergb51f3be2015-01-15 16:14:02 +01001045 RATE_INFO_BW_40,
1046 RATE_INFO_BW_80,
1047 RATE_INFO_BW_160,
Henning Rogge420e7fa2008-12-11 22:04:19 +01001048};
1049
1050/**
1051 * struct rate_info - bitrate information
1052 *
1053 * Information about a receiving or transmitting bitrate
1054 *
1055 * @flags: bitflag of flags from &enum rate_info_flags
1056 * @mcs: mcs index if struct describes a 802.11n bitrate
1057 * @legacy: bitrate in 100kbit/s for 802.11abg
Johannes Bergdb9c64c2012-11-09 14:56:41 +01001058 * @nss: number of streams (VHT only)
Johannes Bergb51f3be2015-01-15 16:14:02 +01001059 * @bw: bandwidth (from &enum rate_info_bw)
Henning Rogge420e7fa2008-12-11 22:04:19 +01001060 */
1061struct rate_info {
1062 u8 flags;
1063 u8 mcs;
1064 u16 legacy;
Johannes Bergdb9c64c2012-11-09 14:56:41 +01001065 u8 nss;
Johannes Bergb51f3be2015-01-15 16:14:02 +01001066 u8 bw;
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001067};
1068
1069/**
Paul Stewartf4263c92011-03-31 09:25:41 -07001070 * enum station_info_rate_flags - bitrate info flags
1071 *
1072 * Used by the driver to indicate the specific rate transmission
1073 * type for 802.11n transmissions.
1074 *
1075 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1076 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1077 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1078 */
1079enum bss_param_flags {
1080 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1081 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1082 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1083};
1084
1085/**
1086 * struct sta_bss_parameters - BSS parameters for the attached station
1087 *
1088 * Information about the currently associated BSS
1089 *
1090 * @flags: bitflag of flags from &enum bss_param_flags
1091 * @dtim_period: DTIM period for the BSS
1092 * @beacon_interval: beacon interval
1093 */
1094struct sta_bss_parameters {
1095 u8 flags;
1096 u8 dtim_period;
1097 u16 beacon_interval;
1098};
1099
Johannes Berg6de39802014-12-19 12:34:00 +01001100/**
1101 * struct cfg80211_tid_stats - per-TID statistics
1102 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1103 * indicate the relevant values in this struct are filled
1104 * @rx_msdu: number of received MSDUs
1105 * @tx_msdu: number of (attempted) transmitted MSDUs
1106 * @tx_msdu_retries: number of retries (not counting the first) for
1107 * transmitted MSDUs
1108 * @tx_msdu_failed: number of failed transmitted MSDUs
1109 */
1110struct cfg80211_tid_stats {
1111 u32 filled;
1112 u64 rx_msdu;
1113 u64 tx_msdu;
1114 u64 tx_msdu_retries;
1115 u64 tx_msdu_failed;
1116};
1117
Felix Fietkau119363c2013-04-22 16:29:30 +02001118#define IEEE80211_MAX_CHAINS 4
1119
Paul Stewartf4263c92011-03-31 09:25:41 -07001120/**
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001121 * struct station_info - station information
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001122 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001123 * Station information filled by driver for get_station() and dump_station.
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001124 *
Johannes Berg319090b2014-11-17 14:08:11 +01001125 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1126 * indicate the relevant values in this struct for them
Mohammed Shafi Shajakhanebe27c92011-04-08 21:24:24 +05301127 * @connected_time: time(in secs) since a station is last connected
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001128 * @inactive_time: time since last station activity (tx/rx) in milliseconds
Johannes Berg8d791362014-11-21 12:40:05 +01001129 * @rx_bytes: bytes (size of MPDUs) received from this station
1130 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001131 * @llid: mesh local link id
1132 * @plid: mesh peer link id
1133 * @plink_state: mesh peer link state
Johannes Berg73c3df32012-06-13 11:17:14 +02001134 * @signal: The signal strength, type depends on the wiphy's signal_type.
1135 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1136 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1137 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
Felix Fietkau119363c2013-04-22 16:29:30 +02001138 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1139 * @chain_signal: per-chain signal strength of last received packet in dBm
1140 * @chain_signal_avg: per-chain signal strength average in dBm
Randy Dunlap858022a2011-03-18 09:33:02 -07001141 * @txrate: current unicast bitrate from this station
1142 * @rxrate: current unicast bitrate to this station
Johannes Berg8d791362014-11-21 12:40:05 +01001143 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1144 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1145 * @tx_retries: cumulative retry counts (MPDUs)
1146 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
Ben Greear5a5c7312010-10-07 16:39:20 -07001147 * @rx_dropped_misc: Dropped for un-specified reason.
Randy Dunlap1ba01452011-05-22 17:16:20 -07001148 * @bss_param: current BSS parameters
Johannes Bergf5ea9122009-08-07 16:17:38 +02001149 * @generation: generation number for nl80211 dumps.
1150 * This number should increase every time the list of stations
1151 * changes, i.e. when a station is added or removed, so that
1152 * userspace can tell whether it got a consistent snapshot.
Jouni Malinen50d3dfb2011-08-08 12:11:52 +03001153 * @assoc_req_ies: IEs from (Re)Association Request.
1154 * This is used only when in AP mode with drivers that do not use
1155 * user space MLME/SME implementation. The information is provided for
1156 * the cfg80211_new_sta() calls to notify user space of the IEs.
1157 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
Johannes Bergc26887d2011-11-08 09:20:07 +01001158 * @sta_flags: station flags mask & values
Paul Stewarta85e1d52011-12-09 11:01:49 -08001159 * @beacon_loss_count: Number of times beacon loss event has triggered.
Javier Cardonad299a1f2012-03-31 11:31:33 -07001160 * @t_offset: Time offset of the station relative to this host.
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001161 * @local_pm: local mesh STA power save mode
1162 * @peer_pm: peer mesh STA power save mode
1163 * @nonpeer_pm: non-peer mesh STA power save mode
Antonio Quartulli867d8492014-05-19 21:53:19 +02001164 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1165 * towards this station.
Johannes Berga76b1942014-11-17 14:12:22 +01001166 * @rx_beacon: number of beacons received from this peer
1167 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1168 * from this peer
Mohammed Shafi Shajakhan739960f2016-04-07 19:59:34 +05301169 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
Johannes Berg6de39802014-12-19 12:34:00 +01001170 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1171 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001172 */
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001173struct station_info {
Mohammed Shafi Shajakhan739960f2016-04-07 19:59:34 +05301174 u64 filled;
Mohammed Shafi Shajakhanebe27c92011-04-08 21:24:24 +05301175 u32 connected_time;
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001176 u32 inactive_time;
Vladimir Kondratiev42745e02013-02-04 13:53:11 +02001177 u64 rx_bytes;
1178 u64 tx_bytes;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001179 u16 llid;
1180 u16 plid;
1181 u8 plink_state;
Henning Rogge420e7fa2008-12-11 22:04:19 +01001182 s8 signal;
Bruno Randolf541a45a2010-12-02 19:12:43 +09001183 s8 signal_avg;
Felix Fietkau119363c2013-04-22 16:29:30 +02001184
1185 u8 chains;
1186 s8 chain_signal[IEEE80211_MAX_CHAINS];
1187 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1188
Henning Rogge420e7fa2008-12-11 22:04:19 +01001189 struct rate_info txrate;
Felix Fietkauc8dcfd82011-02-27 22:08:00 +01001190 struct rate_info rxrate;
Jouni Malinen98c8a60a2009-02-17 13:24:57 +02001191 u32 rx_packets;
1192 u32 tx_packets;
Bruno Randolfb206b4e2010-10-06 18:34:12 +09001193 u32 tx_retries;
1194 u32 tx_failed;
Ben Greear5a5c7312010-10-07 16:39:20 -07001195 u32 rx_dropped_misc;
Paul Stewartf4263c92011-03-31 09:25:41 -07001196 struct sta_bss_parameters bss_param;
Helmut Schaabb6e7532011-10-13 16:30:39 +02001197 struct nl80211_sta_flag_update sta_flags;
Johannes Bergf5ea9122009-08-07 16:17:38 +02001198
1199 int generation;
Jouni Malinen50d3dfb2011-08-08 12:11:52 +03001200
1201 const u8 *assoc_req_ies;
1202 size_t assoc_req_ies_len;
Jouni Malinenf612ced2011-08-11 11:46:22 +03001203
Paul Stewarta85e1d52011-12-09 11:01:49 -08001204 u32 beacon_loss_count;
Javier Cardonad299a1f2012-03-31 11:31:33 -07001205 s64 t_offset;
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001206 enum nl80211_mesh_power_mode local_pm;
1207 enum nl80211_mesh_power_mode peer_pm;
1208 enum nl80211_mesh_power_mode nonpeer_pm;
Paul Stewarta85e1d52011-12-09 11:01:49 -08001209
Antonio Quartulli867d8492014-05-19 21:53:19 +02001210 u32 expected_throughput;
Johannes Berga76b1942014-11-17 14:12:22 +01001211
1212 u64 rx_beacon;
Mohammed Shafi Shajakhan739960f2016-04-07 19:59:34 +05301213 u64 rx_duration;
Johannes Berga76b1942014-11-17 14:12:22 +01001214 u8 rx_beacon_signal_avg;
Johannes Berg6de39802014-12-19 12:34:00 +01001215 struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001216};
1217
Linus Lüssing61aaa0e2016-08-19 22:02:48 +02001218#if IS_ENABLED(CONFIG_CFG80211)
Michael Wu66f7ac52008-01-31 19:48:22 +01001219/**
Antonio Quartulli74063532014-05-19 21:53:21 +02001220 * cfg80211_get_station - retrieve information about a given station
1221 * @dev: the device where the station is supposed to be connected to
1222 * @mac_addr: the mac address of the station of interest
1223 * @sinfo: pointer to the structure to fill with the information
1224 *
1225 * Returns 0 on success and sinfo is filled with the available information
1226 * otherwise returns a negative error code and the content of sinfo has to be
1227 * considered undefined.
1228 */
1229int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1230 struct station_info *sinfo);
Linus Lüssing61aaa0e2016-08-19 22:02:48 +02001231#else
1232static inline int cfg80211_get_station(struct net_device *dev,
1233 const u8 *mac_addr,
1234 struct station_info *sinfo)
1235{
1236 return -ENOENT;
1237}
1238#endif
Antonio Quartulli74063532014-05-19 21:53:21 +02001239
1240/**
Michael Wu66f7ac52008-01-31 19:48:22 +01001241 * enum monitor_flags - monitor flags
1242 *
1243 * Monitor interface configuration flags. Note that these must be the bits
1244 * according to the nl80211 flags.
1245 *
1246 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1247 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1248 * @MONITOR_FLAG_CONTROL: pass control frames
1249 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1250 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
Felix Fietkaue057d3c2013-05-28 13:01:52 +02001251 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
Michael Wu66f7ac52008-01-31 19:48:22 +01001252 */
1253enum monitor_flags {
1254 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1255 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1256 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1257 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1258 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
Felix Fietkaue057d3c2013-05-28 13:01:52 +02001259 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
Michael Wu66f7ac52008-01-31 19:48:22 +01001260};
1261
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001262/**
1263 * enum mpath_info_flags - mesh path information flags
1264 *
1265 * Used by the driver to indicate which info in &struct mpath_info it has filled
1266 * in during get_station() or dump_station().
1267 *
Johannes Bergabe37c42010-06-07 11:12:27 +02001268 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1269 * @MPATH_INFO_SN: @sn filled
1270 * @MPATH_INFO_METRIC: @metric filled
1271 * @MPATH_INFO_EXPTIME: @exptime filled
1272 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1273 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1274 * @MPATH_INFO_FLAGS: @flags filled
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001275 */
1276enum mpath_info_flags {
1277 MPATH_INFO_FRAME_QLEN = BIT(0),
Rui Paulod19b3bf2009-11-09 23:46:55 +00001278 MPATH_INFO_SN = BIT(1),
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001279 MPATH_INFO_METRIC = BIT(2),
1280 MPATH_INFO_EXPTIME = BIT(3),
1281 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1282 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1283 MPATH_INFO_FLAGS = BIT(6),
1284};
1285
1286/**
1287 * struct mpath_info - mesh path information
1288 *
1289 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1290 *
1291 * @filled: bitfield of flags from &enum mpath_info_flags
1292 * @frame_qlen: number of queued frames for this destination
Rui Paulod19b3bf2009-11-09 23:46:55 +00001293 * @sn: target sequence number
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001294 * @metric: metric (cost) of this mesh path
1295 * @exptime: expiration time for the mesh path from now, in msecs
1296 * @flags: mesh path flags
1297 * @discovery_timeout: total mesh path discovery timeout, in msecs
1298 * @discovery_retries: mesh path discovery retries
Johannes Bergf5ea9122009-08-07 16:17:38 +02001299 * @generation: generation number for nl80211 dumps.
1300 * This number should increase every time the list of mesh paths
1301 * changes, i.e. when a station is added or removed, so that
1302 * userspace can tell whether it got a consistent snapshot.
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001303 */
1304struct mpath_info {
1305 u32 filled;
1306 u32 frame_qlen;
Rui Paulod19b3bf2009-11-09 23:46:55 +00001307 u32 sn;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001308 u32 metric;
1309 u32 exptime;
1310 u32 discovery_timeout;
1311 u8 discovery_retries;
1312 u8 flags;
Johannes Bergf5ea9122009-08-07 16:17:38 +02001313
1314 int generation;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001315};
1316
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001317/**
1318 * struct bss_parameters - BSS parameters
1319 *
1320 * Used to change BSS parameters (mainly for AP mode).
1321 *
1322 * @use_cts_prot: Whether to use CTS protection
1323 * (0 = no, 1 = yes, -1 = do not change)
1324 * @use_short_preamble: Whether the use of short preambles is allowed
1325 * (0 = no, 1 = yes, -1 = do not change)
1326 * @use_short_slot_time: Whether the use of short slot time is allowed
1327 * (0 = no, 1 = yes, -1 = do not change)
Jouni Malinen90c97a02008-10-30 16:59:22 +02001328 * @basic_rates: basic rates in IEEE 802.11 format
1329 * (or NULL for no change)
1330 * @basic_rates_len: number of basic rates
Felix Fietkaufd8aaaf2010-04-27 01:23:35 +02001331 * @ap_isolate: do not forward packets between connected stations
Helmut Schaa50b12f52010-11-19 12:40:25 +01001332 * @ht_opmode: HT Operation mode
1333 * (u16 = opmode, -1 = do not change)
Johannes Berg53cabad2012-11-14 15:17:28 +01001334 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1335 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001336 */
1337struct bss_parameters {
1338 int use_cts_prot;
1339 int use_short_preamble;
1340 int use_short_slot_time;
Johannes Bergc1e5f472014-05-19 17:53:16 +02001341 const u8 *basic_rates;
Jouni Malinen90c97a02008-10-30 16:59:22 +02001342 u8 basic_rates_len;
Felix Fietkaufd8aaaf2010-04-27 01:23:35 +02001343 int ap_isolate;
Helmut Schaa50b12f52010-11-19 12:40:25 +01001344 int ht_opmode;
Johannes Berg53cabad2012-11-14 15:17:28 +01001345 s8 p2p_ctwindow, p2p_opp_ps;
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001346};
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001347
Chun-Yeow Yeoh3ddd53f2012-06-11 11:59:10 +08001348/**
Johannes Berg29cbe682010-12-03 09:20:44 +01001349 * struct mesh_config - 802.11s mesh configuration
1350 *
1351 * These parameters can be changed while the mesh is active.
Chun-Yeow Yeoh3ddd53f2012-06-11 11:59:10 +08001352 *
1353 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1354 * by the Mesh Peering Open message
1355 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1356 * used by the Mesh Peering Open message
1357 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1358 * the mesh peering management to close a mesh peering
1359 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1360 * mesh interface
1361 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1362 * be sent to establish a new peer link instance in a mesh
1363 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1364 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1365 * elements
1366 * @auto_open_plinks: whether we should automatically open peer links when we
1367 * detect compatible mesh peers
1368 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1369 * synchronize to for 11s default synchronization method
1370 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1371 * that an originator mesh STA can send to a particular path target
1372 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1373 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1374 * a path discovery in milliseconds
1375 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1376 * receiving a PREQ shall consider the forwarding information from the
1377 * root to be valid. (TU = time unit)
1378 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1379 * which a mesh STA can send only one action frame containing a PREQ
1380 * element
1381 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1382 * which a mesh STA can send only one Action frame containing a PERR
1383 * element
1384 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1385 * it takes for an HWMP information element to propagate across the mesh
1386 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1387 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1388 * announcements are transmitted
1389 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1390 * station has access to a broader network beyond the MBSS. (This is
1391 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1392 * only means that the station will announce others it's a mesh gate, but
1393 * not necessarily using the gate announcement protocol. Still keeping the
1394 * same nomenclature to be in sync with the spec)
1395 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1396 * entity (default is TRUE - forwarding entity)
1397 * @rssi_threshold: the threshold for average signal strength of candidate
1398 * station to establish a peer link
1399 * @ht_opmode: mesh HT protection mode
Chun-Yeow Yeohac1073a2012-06-14 02:06:06 +08001400 *
1401 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1402 * receiving a proactive PREQ shall consider the forwarding information to
1403 * the root mesh STA to be valid.
1404 *
1405 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1406 * PREQs are transmitted.
Chun-Yeow Yeoh728b19e2012-06-14 02:06:10 +08001407 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1408 * during which a mesh STA can send only one Action frame containing
1409 * a PREQ element for root path confirmation.
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001410 * @power_mode: The default mesh power save mode which will be the initial
1411 * setting for new peer links.
1412 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1413 * after transmitting its beacon.
Colleen Twitty8e7c0532013-06-03 09:53:39 -07001414 * @plink_timeout: If no tx activity is seen from a STA we've established
1415 * peering with for longer than this time (in seconds), then remove it
1416 * from the STA's list of peers. Default is 30 minutes.
Johannes Berg29cbe682010-12-03 09:20:44 +01001417 */
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001418struct mesh_config {
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001419 u16 dot11MeshRetryTimeout;
1420 u16 dot11MeshConfirmTimeout;
1421 u16 dot11MeshHoldingTimeout;
1422 u16 dot11MeshMaxPeerLinks;
Chun-Yeow Yeoha4f606e2012-06-11 11:59:36 +08001423 u8 dot11MeshMaxRetries;
1424 u8 dot11MeshTTL;
1425 u8 element_ttl;
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001426 bool auto_open_plinks;
Javier Cardonad299a1f2012-03-31 11:31:33 -07001427 u32 dot11MeshNbrOffsetMaxNeighbor;
Chun-Yeow Yeoha4f606e2012-06-11 11:59:36 +08001428 u8 dot11MeshHWMPmaxPREQretries;
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001429 u32 path_refresh_time;
1430 u16 min_discovery_timeout;
1431 u32 dot11MeshHWMPactivePathTimeout;
1432 u16 dot11MeshHWMPpreqMinInterval;
Thomas Pedersendca7e942011-11-24 17:15:24 -08001433 u16 dot11MeshHWMPperrMinInterval;
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001434 u16 dot11MeshHWMPnetDiameterTraversalTime;
Chun-Yeow Yeoha4f606e2012-06-11 11:59:36 +08001435 u8 dot11MeshHWMPRootMode;
Javier Cardona0507e152011-08-09 16:45:10 -07001436 u16 dot11MeshHWMPRannInterval;
Chun-Yeow Yeoha4f606e2012-06-11 11:59:36 +08001437 bool dot11MeshGateAnnouncementProtocol;
Chun-Yeow Yeoh94f90652012-01-21 01:02:16 +08001438 bool dot11MeshForwarding;
Ashok Nagarajan55335132012-02-28 17:04:08 -08001439 s32 rssi_threshold;
Ashok Nagarajan70c33ea2012-04-30 14:20:32 -07001440 u16 ht_opmode;
Chun-Yeow Yeohac1073a2012-06-14 02:06:06 +08001441 u32 dot11MeshHWMPactivePathToRootTimeout;
1442 u16 dot11MeshHWMProotInterval;
Chun-Yeow Yeoh728b19e2012-06-14 02:06:10 +08001443 u16 dot11MeshHWMPconfirmationInterval;
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001444 enum nl80211_mesh_power_mode power_mode;
1445 u16 dot11MeshAwakeWindowDuration;
Colleen Twitty8e7c0532013-06-03 09:53:39 -07001446 u32 plink_timeout;
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001447};
1448
Jouni Malinen31888482008-10-30 16:59:24 +02001449/**
Johannes Berg29cbe682010-12-03 09:20:44 +01001450 * struct mesh_setup - 802.11s mesh setup configuration
Johannes Berg683b6d32012-11-08 21:25:48 +01001451 * @chandef: defines the channel to use
Johannes Berg29cbe682010-12-03 09:20:44 +01001452 * @mesh_id: the mesh ID
1453 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
Javier Cardonad299a1f2012-03-31 11:31:33 -07001454 * @sync_method: which synchronization method to use
Javier Cardonac80d5452010-12-16 17:37:49 -08001455 * @path_sel_proto: which path selection protocol to use
1456 * @path_metric: which metric to use
Colleen Twitty6e16d902013-05-08 11:45:59 -07001457 * @auth_id: which authentication method this mesh is using
Javier Cardona581a8b02011-04-07 15:08:27 -07001458 * @ie: vendor information elements (optional)
1459 * @ie_len: length of vendor information elements
Javier Cardonab130e5c2011-05-03 16:57:07 -07001460 * @is_authenticated: this mesh requires authentication
1461 * @is_secure: this mesh uses security
Thomas Pedersenbb2798d2013-03-04 13:06:10 -08001462 * @user_mpm: userspace handles all MPM functions
Marco Porsch9bdbf042013-01-07 16:04:51 +01001463 * @dtim_period: DTIM period to use
1464 * @beacon_interval: beacon interval to use
Chun-Yeow Yeoh4bb62342011-11-24 17:15:20 -08001465 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
Ashok Nagarajanffb3cf32013-06-03 10:33:36 -07001466 * @basic_rates: basic rates to use when creating the mesh
Johannes Berg8564e382016-09-19 09:44:44 +02001467 * @beacon_rate: bitrate to be used for beacons
Johannes Berg29cbe682010-12-03 09:20:44 +01001468 *
1469 * These parameters are fixed when the mesh is created.
1470 */
1471struct mesh_setup {
Johannes Berg683b6d32012-11-08 21:25:48 +01001472 struct cfg80211_chan_def chandef;
Johannes Berg29cbe682010-12-03 09:20:44 +01001473 const u8 *mesh_id;
1474 u8 mesh_id_len;
Javier Cardonad299a1f2012-03-31 11:31:33 -07001475 u8 sync_method;
1476 u8 path_sel_proto;
1477 u8 path_metric;
Colleen Twitty6e16d902013-05-08 11:45:59 -07001478 u8 auth_id;
Javier Cardona581a8b02011-04-07 15:08:27 -07001479 const u8 *ie;
1480 u8 ie_len;
Javier Cardonab130e5c2011-05-03 16:57:07 -07001481 bool is_authenticated;
Javier Cardona15d5dda2011-04-07 15:08:28 -07001482 bool is_secure;
Thomas Pedersenbb2798d2013-03-04 13:06:10 -08001483 bool user_mpm;
Marco Porsch9bdbf042013-01-07 16:04:51 +01001484 u8 dtim_period;
1485 u16 beacon_interval;
Johannes Berg57fbcce2016-04-12 15:56:15 +02001486 int mcast_rate[NUM_NL80211_BANDS];
Ashok Nagarajanffb3cf32013-06-03 10:33:36 -07001487 u32 basic_rates;
Johannes Berg8564e382016-09-19 09:44:44 +02001488 struct cfg80211_bitrate_mask beacon_rate;
Johannes Berg29cbe682010-12-03 09:20:44 +01001489};
1490
1491/**
Rostislav Lisovy6e0bd6c2014-11-03 10:33:18 +01001492 * struct ocb_setup - 802.11p OCB mode setup configuration
1493 * @chandef: defines the channel to use
1494 *
1495 * These parameters are fixed when connecting to the network
1496 */
1497struct ocb_setup {
1498 struct cfg80211_chan_def chandef;
1499};
1500
1501/**
Jouni Malinen31888482008-10-30 16:59:24 +02001502 * struct ieee80211_txq_params - TX queue parameters
Johannes Berga3304b02012-03-28 11:04:24 +02001503 * @ac: AC identifier
Jouni Malinen31888482008-10-30 16:59:24 +02001504 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
1505 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
1506 * 1..32767]
1507 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
1508 * 1..32767]
1509 * @aifs: Arbitration interframe space [0..255]
1510 */
1511struct ieee80211_txq_params {
Johannes Berga3304b02012-03-28 11:04:24 +02001512 enum nl80211_ac ac;
Jouni Malinen31888482008-10-30 16:59:24 +02001513 u16 txop;
1514 u16 cwmin;
1515 u16 cwmax;
1516 u8 aifs;
1517};
1518
Johannes Bergd70e9692010-08-19 16:11:27 +02001519/**
1520 * DOC: Scanning and BSS list handling
1521 *
1522 * The scanning process itself is fairly simple, but cfg80211 offers quite
1523 * a bit of helper functionality. To start a scan, the scan operation will
1524 * be invoked with a scan definition. This scan definition contains the
1525 * channels to scan, and the SSIDs to send probe requests for (including the
1526 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1527 * probe. Additionally, a scan request may contain extra information elements
1528 * that should be added to the probe request. The IEs are guaranteed to be
1529 * well-formed, and will not exceed the maximum length the driver advertised
1530 * in the wiphy structure.
1531 *
1532 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1533 * it is responsible for maintaining the BSS list; the driver should not
1534 * maintain a list itself. For this notification, various functions exist.
1535 *
1536 * Since drivers do not maintain a BSS list, there are also a number of
1537 * functions to search for a BSS and obtain information about it from the
1538 * BSS structure cfg80211 maintains. The BSS list is also made available
1539 * to userspace.
1540 */
Jouni Malinen72bdcf32008-11-26 16:15:24 +02001541
Johannes Berg704232c2007-04-23 12:20:05 -07001542/**
Johannes Berg2a519312009-02-10 21:25:55 +01001543 * struct cfg80211_ssid - SSID description
1544 * @ssid: the SSID
1545 * @ssid_len: length of the ssid
1546 */
1547struct cfg80211_ssid {
1548 u8 ssid[IEEE80211_MAX_SSID_LEN];
1549 u8 ssid_len;
1550};
1551
1552/**
Avraham Stern1d762502016-07-05 17:10:13 +03001553 * struct cfg80211_scan_info - information about completed scan
1554 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
1555 * wireless device that requested the scan is connected to. If this
1556 * information is not available, this field is left zero.
1557 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
1558 * @aborted: set to true if the scan was aborted for any reason,
1559 * userspace will be notified of that
1560 */
1561struct cfg80211_scan_info {
1562 u64 scan_start_tsf;
1563 u8 tsf_bssid[ETH_ALEN] __aligned(2);
1564 bool aborted;
1565};
1566
1567/**
Johannes Berg2a519312009-02-10 21:25:55 +01001568 * struct cfg80211_scan_request - scan request description
1569 *
1570 * @ssids: SSIDs to scan for (active scan only)
1571 * @n_ssids: number of SSIDs
1572 * @channels: channels to scan on.
Helmut Schaaca3dbc22009-07-10 14:54:58 +02001573 * @n_channels: total number of channels to scan
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02001574 * @scan_width: channel width for scanning
Jouni Malinen70692ad2009-02-16 19:39:13 +02001575 * @ie: optional information element(s) to add into Probe Request or %NULL
1576 * @ie_len: length of ie in octets
Avraham Stern1d762502016-07-05 17:10:13 +03001577 * @duration: how long to listen on each channel, in TUs. If
1578 * %duration_mandatory is not set, this is the maximum dwell time and
1579 * the actual dwell time may be shorter.
1580 * @duration_mandatory: if set, the scan duration must be as specified by the
1581 * %duration field.
Sam Lefflered4737712012-10-11 21:03:31 -07001582 * @flags: bit field of flags controlling operation
Johannes Berg34850ab2011-07-18 18:08:35 +02001583 * @rates: bitmap of rates to advertise for each band
Johannes Berg2a519312009-02-10 21:25:55 +01001584 * @wiphy: the wiphy this was for
Sam Leffler15d60302012-10-11 21:03:34 -07001585 * @scan_start: time (in jiffies) when the scan started
Johannes Bergfd014282012-06-18 19:17:03 +02001586 * @wdev: the wireless device to scan for
Avraham Stern1d762502016-07-05 17:10:13 +03001587 * @info: (internal) information about completed scan
Johannes Berg5fe231e2013-05-08 21:45:15 +02001588 * @notified: (internal) scan request was notified as done or aborted
Rajkumar Manoharane9f935e2011-09-25 14:53:30 +05301589 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
Johannes Bergad2b26a2014-06-12 21:39:05 +02001590 * @mac_addr: MAC address used with randomisation
1591 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1592 * are 0 in the mask should be randomised, bits that are 1 should
1593 * be taken from the @mac_addr
Jouni Malinen818965d2016-02-26 22:12:47 +02001594 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
Johannes Berg2a519312009-02-10 21:25:55 +01001595 */
1596struct cfg80211_scan_request {
1597 struct cfg80211_ssid *ssids;
1598 int n_ssids;
Johannes Berg2a519312009-02-10 21:25:55 +01001599 u32 n_channels;
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02001600 enum nl80211_bss_scan_width scan_width;
Johannes Bergde95a542009-04-01 11:58:36 +02001601 const u8 *ie;
Jouni Malinen70692ad2009-02-16 19:39:13 +02001602 size_t ie_len;
Avraham Stern1d762502016-07-05 17:10:13 +03001603 u16 duration;
1604 bool duration_mandatory;
Sam Lefflered4737712012-10-11 21:03:31 -07001605 u32 flags;
Johannes Berg2a519312009-02-10 21:25:55 +01001606
Johannes Berg57fbcce2016-04-12 15:56:15 +02001607 u32 rates[NUM_NL80211_BANDS];
Johannes Berg34850ab2011-07-18 18:08:35 +02001608
Johannes Bergfd014282012-06-18 19:17:03 +02001609 struct wireless_dev *wdev;
1610
Johannes Bergad2b26a2014-06-12 21:39:05 +02001611 u8 mac_addr[ETH_ALEN] __aligned(2);
1612 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
Jouni Malinen818965d2016-02-26 22:12:47 +02001613 u8 bssid[ETH_ALEN] __aligned(2);
Johannes Bergad2b26a2014-06-12 21:39:05 +02001614
Johannes Berg2a519312009-02-10 21:25:55 +01001615 /* internal */
1616 struct wiphy *wiphy;
Sam Leffler15d60302012-10-11 21:03:34 -07001617 unsigned long scan_start;
Avraham Stern1d762502016-07-05 17:10:13 +03001618 struct cfg80211_scan_info info;
1619 bool notified;
Rajkumar Manoharane9f935e2011-09-25 14:53:30 +05301620 bool no_cck;
Johannes Berg5ba63532009-08-07 17:54:07 +02001621
1622 /* keep last */
1623 struct ieee80211_channel *channels[0];
Johannes Berg2a519312009-02-10 21:25:55 +01001624};
1625
Johannes Bergad2b26a2014-06-12 21:39:05 +02001626static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
1627{
1628 int i;
1629
1630 get_random_bytes(buf, ETH_ALEN);
1631 for (i = 0; i < ETH_ALEN; i++) {
1632 buf[i] &= ~mask[i];
1633 buf[i] |= addr[i] & mask[i];
1634 }
1635}
1636
Johannes Berg2a519312009-02-10 21:25:55 +01001637/**
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03001638 * struct cfg80211_match_set - sets of attributes to match
1639 *
Johannes Bergea73cbc2014-01-24 10:53:53 +01001640 * @ssid: SSID to be matched; may be zero-length for no match (RSSI only)
1641 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03001642 */
1643struct cfg80211_match_set {
1644 struct cfg80211_ssid ssid;
Johannes Bergea73cbc2014-01-24 10:53:53 +01001645 s32 rssi_thold;
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03001646};
1647
1648/**
Avraham Stern3b06d272015-10-12 09:51:34 +03001649 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
1650 *
1651 * @interval: interval between scheduled scan iterations. In seconds.
1652 * @iterations: number of scan iterations in this scan plan. Zero means
1653 * infinite loop.
1654 * The last scan plan will always have this parameter set to zero,
1655 * all other scan plans will have a finite number of iterations.
1656 */
1657struct cfg80211_sched_scan_plan {
1658 u32 interval;
1659 u32 iterations;
1660};
1661
1662/**
vamsi krishnaf4f1a542017-01-13 01:12:20 +02001663 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
1664 *
1665 * @band: band of BSS which should match for RSSI level adjustment.
1666 * @delta: value of RSSI level adjustment.
1667 */
1668struct cfg80211_bss_select_adjust {
1669 enum nl80211_band band;
1670 s8 delta;
1671};
1672
1673/**
Luciano Coelho807f8a82011-05-11 17:09:35 +03001674 * struct cfg80211_sched_scan_request - scheduled scan request description
1675 *
1676 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1677 * @n_ssids: number of SSIDs
1678 * @n_channels: total number of channels to scan
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02001679 * @scan_width: channel width for scanning
Luciano Coelho807f8a82011-05-11 17:09:35 +03001680 * @ie: optional information element(s) to add into Probe Request or %NULL
1681 * @ie_len: length of ie in octets
Sam Lefflered4737712012-10-11 21:03:31 -07001682 * @flags: bit field of flags controlling operation
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03001683 * @match_sets: sets of parameters to be matched for a scan result
1684 * entry to be considered valid and to be passed to the host
1685 * (others are filtered out).
1686 * If ommited, all results are passed.
1687 * @n_match_sets: number of match sets
Luciano Coelho807f8a82011-05-11 17:09:35 +03001688 * @wiphy: the wiphy this was for
1689 * @dev: the interface
Johannes Berg077f8972013-02-08 09:06:36 +01001690 * @scan_start: start time of the scheduled scan
Luciano Coelho807f8a82011-05-11 17:09:35 +03001691 * @channels: channels to scan
Johannes Bergea73cbc2014-01-24 10:53:53 +01001692 * @min_rssi_thold: for drivers only supporting a single threshold, this
1693 * contains the minimum over all matchsets
Johannes Bergad2b26a2014-06-12 21:39:05 +02001694 * @mac_addr: MAC address used with randomisation
1695 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1696 * are 0 in the mask should be randomised, bits that are 1 should
1697 * be taken from the @mac_addr
Avraham Stern3b06d272015-10-12 09:51:34 +03001698 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
1699 * index must be executed first.
1700 * @n_scan_plans: number of scan plans, at least 1.
Jukka Rissanen31a60ed2014-12-15 13:25:38 +02001701 * @rcu_head: RCU callback used to free the struct
Jukka Rissanen93a1e862014-12-15 13:25:39 +02001702 * @owner_nlportid: netlink portid of owner (if this should is a request
1703 * owned by a particular socket)
Luciano Coelho9c748932015-01-16 16:04:09 +02001704 * @delay: delay in seconds to use before starting the first scan
1705 * cycle. The driver may ignore this parameter and start
1706 * immediately (or at any other time), if this feature is not
1707 * supported.
vamsi krishnaf4f1a542017-01-13 01:12:20 +02001708 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
1709 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
1710 * reporting in connected state to cases where a matching BSS is determined
1711 * to have better or slightly worse RSSI than the current connected BSS.
1712 * The relative RSSI threshold values are ignored in disconnected state.
1713 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
1714 * to the specified band while deciding whether a better BSS is reported
1715 * using @relative_rssi. If delta is a negative number, the BSSs that
1716 * belong to the specified band will be penalized by delta dB in relative
1717 * comparisions.
Luciano Coelho807f8a82011-05-11 17:09:35 +03001718 */
1719struct cfg80211_sched_scan_request {
1720 struct cfg80211_ssid *ssids;
1721 int n_ssids;
1722 u32 n_channels;
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02001723 enum nl80211_bss_scan_width scan_width;
Luciano Coelho807f8a82011-05-11 17:09:35 +03001724 const u8 *ie;
1725 size_t ie_len;
Sam Lefflered4737712012-10-11 21:03:31 -07001726 u32 flags;
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03001727 struct cfg80211_match_set *match_sets;
1728 int n_match_sets;
Johannes Bergea73cbc2014-01-24 10:53:53 +01001729 s32 min_rssi_thold;
Luciano Coelho9c748932015-01-16 16:04:09 +02001730 u32 delay;
Avraham Stern3b06d272015-10-12 09:51:34 +03001731 struct cfg80211_sched_scan_plan *scan_plans;
1732 int n_scan_plans;
Luciano Coelho807f8a82011-05-11 17:09:35 +03001733
Johannes Bergad2b26a2014-06-12 21:39:05 +02001734 u8 mac_addr[ETH_ALEN] __aligned(2);
1735 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1736
vamsi krishnaf4f1a542017-01-13 01:12:20 +02001737 bool relative_rssi_set;
1738 s8 relative_rssi;
1739 struct cfg80211_bss_select_adjust rssi_adjust;
1740
Luciano Coelho807f8a82011-05-11 17:09:35 +03001741 /* internal */
1742 struct wiphy *wiphy;
1743 struct net_device *dev;
Sam Leffler15d60302012-10-11 21:03:34 -07001744 unsigned long scan_start;
Jukka Rissanen31a60ed2014-12-15 13:25:38 +02001745 struct rcu_head rcu_head;
Jukka Rissanen93a1e862014-12-15 13:25:39 +02001746 u32 owner_nlportid;
Luciano Coelho807f8a82011-05-11 17:09:35 +03001747
1748 /* keep last */
1749 struct ieee80211_channel *channels[0];
1750};
1751
1752/**
Johannes Berg2a519312009-02-10 21:25:55 +01001753 * enum cfg80211_signal_type - signal type
1754 *
1755 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
1756 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
1757 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
1758 */
1759enum cfg80211_signal_type {
1760 CFG80211_SIGNAL_TYPE_NONE,
1761 CFG80211_SIGNAL_TYPE_MBM,
1762 CFG80211_SIGNAL_TYPE_UNSPEC,
1763};
1764
1765/**
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02001766 * struct cfg80211_inform_bss - BSS inform data
1767 * @chan: channel the frame was received on
1768 * @scan_width: scan width that was used
1769 * @signal: signal strength value, according to the wiphy's
1770 * signal type
1771 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
1772 * received; should match the time when the frame was actually
1773 * received by the device (not just by the host, in case it was
1774 * buffered on the device) and be accurate to about 10ms.
1775 * If the frame isn't buffered, just passing the return value of
1776 * ktime_get_boot_ns() is likely appropriate.
Avraham Stern1d762502016-07-05 17:10:13 +03001777 * @parent_tsf: the time at the start of reception of the first octet of the
1778 * timestamp field of the frame. The time is the TSF of the BSS specified
1779 * by %parent_bssid.
1780 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
1781 * the BSS that requested the scan in which the beacon/probe was received.
Sunil Dutt0c868482017-12-13 19:51:36 +02001782 * @chains: bitmask for filled values in @chain_signal.
1783 * @chain_signal: per-chain signal strength of last received BSS in dBm.
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02001784 */
1785struct cfg80211_inform_bss {
1786 struct ieee80211_channel *chan;
1787 enum nl80211_bss_scan_width scan_width;
1788 s32 signal;
1789 u64 boottime_ns;
Avraham Stern1d762502016-07-05 17:10:13 +03001790 u64 parent_tsf;
1791 u8 parent_bssid[ETH_ALEN] __aligned(2);
Sunil Dutt0c868482017-12-13 19:51:36 +02001792 u8 chains;
1793 s8 chain_signal[IEEE80211_MAX_CHAINS];
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02001794};
1795
1796/**
Akira Moroo2aa4d452016-03-08 23:17:42 +09001797 * struct cfg80211_bss_ies - BSS entry IE data
Johannes Berg8cef2c92013-02-05 16:54:31 +01001798 * @tsf: TSF contained in the frame that carried these IEs
Johannes Berg9caf0362012-11-29 01:25:20 +01001799 * @rcu_head: internal use, for freeing
1800 * @len: length of the IEs
Johannes Berg0e227082014-08-12 20:34:30 +02001801 * @from_beacon: these IEs are known to come from a beacon
Johannes Berg9caf0362012-11-29 01:25:20 +01001802 * @data: IE data
1803 */
1804struct cfg80211_bss_ies {
Johannes Berg8cef2c92013-02-05 16:54:31 +01001805 u64 tsf;
Johannes Berg9caf0362012-11-29 01:25:20 +01001806 struct rcu_head rcu_head;
1807 int len;
Johannes Berg0e227082014-08-12 20:34:30 +02001808 bool from_beacon;
Johannes Berg9caf0362012-11-29 01:25:20 +01001809 u8 data[];
1810};
1811
1812/**
Johannes Berg2a519312009-02-10 21:25:55 +01001813 * struct cfg80211_bss - BSS description
1814 *
1815 * This structure describes a BSS (which may also be a mesh network)
1816 * for use in scan results and similar.
1817 *
Johannes Bergabe37c42010-06-07 11:12:27 +02001818 * @channel: channel this BSS is on
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02001819 * @scan_width: width of the control channel
Johannes Berg2a519312009-02-10 21:25:55 +01001820 * @bssid: BSSID of the BSS
Johannes Berg2a519312009-02-10 21:25:55 +01001821 * @beacon_interval: the beacon interval as from the frame
1822 * @capability: the capability field in host byte order
Johannes Berg83c7aa12013-02-05 16:51:29 +01001823 * @ies: the information elements (Note that there is no guarantee that these
1824 * are well-formed!); this is a pointer to either the beacon_ies or
1825 * proberesp_ies depending on whether Probe Response frame has been
1826 * received. It is always non-%NULL.
Jouni Malinen34a6edd2010-01-06 16:19:24 +02001827 * @beacon_ies: the information elements from the last Beacon frame
Johannes Berg776b3582013-02-01 02:06:18 +01001828 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
1829 * own the beacon_ies, but they're just pointers to the ones from the
1830 * @hidden_beacon_bss struct)
Jouni Malinen34a6edd2010-01-06 16:19:24 +02001831 * @proberesp_ies: the information elements from the last Probe Response frame
Johannes Berg776b3582013-02-01 02:06:18 +01001832 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
1833 * a BSS that hides the SSID in its beacon, this points to the BSS struct
1834 * that holds the beacon data. @beacon_ies is still valid, of course, and
1835 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
Johannes Berg77965c92009-02-18 18:45:06 +01001836 * @signal: signal strength value (type depends on the wiphy's signal_type)
Sunil Dutt0c868482017-12-13 19:51:36 +02001837 * @chains: bitmask for filled values in @chain_signal.
1838 * @chain_signal: per-chain signal strength of last received BSS in dBm.
Johannes Berg2a519312009-02-10 21:25:55 +01001839 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
1840 */
1841struct cfg80211_bss {
1842 struct ieee80211_channel *channel;
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02001843 enum nl80211_bss_scan_width scan_width;
Johannes Berg2a519312009-02-10 21:25:55 +01001844
Johannes Berg9caf0362012-11-29 01:25:20 +01001845 const struct cfg80211_bss_ies __rcu *ies;
1846 const struct cfg80211_bss_ies __rcu *beacon_ies;
1847 const struct cfg80211_bss_ies __rcu *proberesp_ies;
1848
Johannes Berg776b3582013-02-01 02:06:18 +01001849 struct cfg80211_bss *hidden_beacon_bss;
Johannes Berg2a519312009-02-10 21:25:55 +01001850
1851 s32 signal;
Johannes Berg2a519312009-02-10 21:25:55 +01001852
Johannes Berg9caf0362012-11-29 01:25:20 +01001853 u16 beacon_interval;
1854 u16 capability;
1855
1856 u8 bssid[ETH_ALEN];
Sunil Dutt0c868482017-12-13 19:51:36 +02001857 u8 chains;
1858 s8 chain_signal[IEEE80211_MAX_CHAINS];
Johannes Berg9caf0362012-11-29 01:25:20 +01001859
Johannes Berg1c06ef92012-12-28 12:22:02 +01001860 u8 priv[0] __aligned(sizeof(void *));
Johannes Berg2a519312009-02-10 21:25:55 +01001861};
1862
1863/**
Johannes Berg517357c2009-07-02 17:18:40 +02001864 * ieee80211_bss_get_ie - find IE with given ID
1865 * @bss: the bss to search
1866 * @ie: the IE ID
Johannes Berg9caf0362012-11-29 01:25:20 +01001867 *
1868 * Note that the return value is an RCU-protected pointer, so
1869 * rcu_read_lock() must be held when calling this function.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01001870 * Return: %NULL if not found.
Johannes Berg517357c2009-07-02 17:18:40 +02001871 */
1872const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1873
1874
1875/**
Jouni Malinen636a5d32009-03-19 13:39:22 +02001876 * struct cfg80211_auth_request - Authentication request data
1877 *
1878 * This structure provides information needed to complete IEEE 802.11
1879 * authentication.
Jouni Malinen636a5d32009-03-19 13:39:22 +02001880 *
Johannes Berg959867f2013-06-19 13:05:42 +02001881 * @bss: The BSS to authenticate with, the callee must obtain a reference
1882 * to it if it needs to keep it.
Jouni Malinen636a5d32009-03-19 13:39:22 +02001883 * @auth_type: Authentication type (algorithm)
1884 * @ie: Extra IEs to add to Authentication frame or %NULL
1885 * @ie_len: Length of ie buffer in octets
Johannes Bergfffd0932009-07-08 14:22:54 +02001886 * @key_len: length of WEP key for shared key authentication
1887 * @key_idx: index of WEP key for shared key authentication
1888 * @key: WEP key for shared key authentication
Jouni Malinen3255b4a2016-10-27 00:41:58 +03001889 * @auth_data: Fields and elements in Authentication frames. This contains
1890 * the authentication frame body (non-IE and IE data), excluding the
1891 * Authentication algorithm number, i.e., starting at the Authentication
1892 * transaction sequence number field.
1893 * @auth_data_len: Length of auth_data buffer in octets
Jouni Malinen636a5d32009-03-19 13:39:22 +02001894 */
1895struct cfg80211_auth_request {
Johannes Berg19957bb2009-07-02 17:20:43 +02001896 struct cfg80211_bss *bss;
Jouni Malinen636a5d32009-03-19 13:39:22 +02001897 const u8 *ie;
1898 size_t ie_len;
Johannes Berg19957bb2009-07-02 17:20:43 +02001899 enum nl80211_auth_type auth_type;
Johannes Bergfffd0932009-07-08 14:22:54 +02001900 const u8 *key;
1901 u8 key_len, key_idx;
Jouni Malinen3255b4a2016-10-27 00:41:58 +03001902 const u8 *auth_data;
1903 size_t auth_data_len;
Jouni Malinen636a5d32009-03-19 13:39:22 +02001904};
1905
1906/**
Ben Greear7e7c8922011-11-18 11:31:59 -08001907 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
1908 *
1909 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
Johannes Bergee2aca32013-02-21 17:36:01 +01001910 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
Assaf Kraussbab5ab72014-09-03 15:25:01 +03001911 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
Srinivas Dasarid041a1a2018-02-07 18:32:17 +05301912 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
1913 * authentication capability. Drivers can offload authentication to
1914 * userspace if this flag is set. Only applicable for cfg80211_connect()
1915 * request (connect callback).
Ben Greear7e7c8922011-11-18 11:31:59 -08001916 */
1917enum cfg80211_assoc_req_flags {
Srinivas Dasarid041a1a2018-02-07 18:32:17 +05301918 ASSOC_REQ_DISABLE_HT = BIT(0),
1919 ASSOC_REQ_DISABLE_VHT = BIT(1),
1920 ASSOC_REQ_USE_RRM = BIT(2),
1921 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
Ben Greear7e7c8922011-11-18 11:31:59 -08001922};
1923
1924/**
Jouni Malinen636a5d32009-03-19 13:39:22 +02001925 * struct cfg80211_assoc_request - (Re)Association request data
1926 *
1927 * This structure provides information needed to complete IEEE 802.11
1928 * (re)association.
Johannes Berg959867f2013-06-19 13:05:42 +02001929 * @bss: The BSS to associate with. If the call is successful the driver is
1930 * given a reference that it must give back to cfg80211_send_rx_assoc()
1931 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
1932 * association requests while already associating must be rejected.
Jouni Malinen636a5d32009-03-19 13:39:22 +02001933 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1934 * @ie_len: Length of ie buffer in octets
Jouni Malinendc6382c2009-05-06 22:09:37 +03001935 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
Samuel Ortizb23aa672009-07-01 21:26:54 +02001936 * @crypto: crypto settings
Jouni Malinen35eb8f72016-04-06 17:38:44 +03001937 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
1938 * to indicate a request to reassociate within the ESS instead of a request
1939 * do the initial association with the ESS. When included, this is set to
1940 * the BSSID of the current association, i.e., to the value that is
1941 * included in the Current AP address field of the Reassociation Request
1942 * frame.
Ben Greear7e7c8922011-11-18 11:31:59 -08001943 * @flags: See &enum cfg80211_assoc_req_flags
1944 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
Johannes Bergad24b0d2013-07-05 11:53:28 +02001945 * will be used in ht_capa. Un-supported values will be ignored.
Ben Greear7e7c8922011-11-18 11:31:59 -08001946 * @ht_capa_mask: The bits of ht_capa which are to be used.
Johannes Bergee2aca32013-02-21 17:36:01 +01001947 * @vht_capa: VHT capability override
1948 * @vht_capa_mask: VHT capability mask indicating which fields to use
Jouni Malinenc9a63622016-10-27 00:42:03 +03001949 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
1950 * %NULL if FILS is not used.
1951 * @fils_kek_len: Length of fils_kek in octets
1952 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
1953 * Request/Response frame or %NULL if FILS is not used. This field starts
1954 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
Jouni Malinen636a5d32009-03-19 13:39:22 +02001955 */
1956struct cfg80211_assoc_request {
Johannes Berg19957bb2009-07-02 17:20:43 +02001957 struct cfg80211_bss *bss;
Johannes Berg3e5d7642009-07-07 14:37:26 +02001958 const u8 *ie, *prev_bssid;
Jouni Malinen636a5d32009-03-19 13:39:22 +02001959 size_t ie_len;
Samuel Ortizb23aa672009-07-01 21:26:54 +02001960 struct cfg80211_crypto_settings crypto;
Johannes Berg19957bb2009-07-02 17:20:43 +02001961 bool use_mfp;
Ben Greear7e7c8922011-11-18 11:31:59 -08001962 u32 flags;
1963 struct ieee80211_ht_cap ht_capa;
1964 struct ieee80211_ht_cap ht_capa_mask;
Johannes Bergee2aca32013-02-21 17:36:01 +01001965 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
Jouni Malinenc9a63622016-10-27 00:42:03 +03001966 const u8 *fils_kek;
1967 size_t fils_kek_len;
1968 const u8 *fils_nonces;
Jouni Malinen636a5d32009-03-19 13:39:22 +02001969};
1970
1971/**
1972 * struct cfg80211_deauth_request - Deauthentication request data
1973 *
1974 * This structure provides information needed to complete IEEE 802.11
1975 * deauthentication.
1976 *
Johannes Berg95de8172012-01-20 13:55:25 +01001977 * @bssid: the BSSID of the BSS to deauthenticate from
Jouni Malinen636a5d32009-03-19 13:39:22 +02001978 * @ie: Extra IEs to add to Deauthentication frame or %NULL
1979 * @ie_len: Length of ie buffer in octets
Johannes Berg19957bb2009-07-02 17:20:43 +02001980 * @reason_code: The reason code for the deauthentication
Johannes Berg077f8972013-02-08 09:06:36 +01001981 * @local_state_change: if set, change local state only and
1982 * do not set a deauth frame
Jouni Malinen636a5d32009-03-19 13:39:22 +02001983 */
1984struct cfg80211_deauth_request {
Johannes Berg95de8172012-01-20 13:55:25 +01001985 const u8 *bssid;
Jouni Malinen636a5d32009-03-19 13:39:22 +02001986 const u8 *ie;
1987 size_t ie_len;
Johannes Berg19957bb2009-07-02 17:20:43 +02001988 u16 reason_code;
Stanislaw Gruszka68632552012-10-15 14:52:41 +02001989 bool local_state_change;
Jouni Malinen636a5d32009-03-19 13:39:22 +02001990};
1991
1992/**
1993 * struct cfg80211_disassoc_request - Disassociation request data
1994 *
1995 * This structure provides information needed to complete IEEE 802.11
1996 * disassocation.
1997 *
Johannes Berg19957bb2009-07-02 17:20:43 +02001998 * @bss: the BSS to disassociate from
Jouni Malinen636a5d32009-03-19 13:39:22 +02001999 * @ie: Extra IEs to add to Disassociation frame or %NULL
2000 * @ie_len: Length of ie buffer in octets
Johannes Berg19957bb2009-07-02 17:20:43 +02002001 * @reason_code: The reason code for the disassociation
Jouni Malinend5cdfac2010-04-04 09:37:19 +03002002 * @local_state_change: This is a request for a local state only, i.e., no
2003 * Disassociation frame is to be transmitted.
Jouni Malinen636a5d32009-03-19 13:39:22 +02002004 */
2005struct cfg80211_disassoc_request {
Johannes Berg19957bb2009-07-02 17:20:43 +02002006 struct cfg80211_bss *bss;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002007 const u8 *ie;
2008 size_t ie_len;
Johannes Berg19957bb2009-07-02 17:20:43 +02002009 u16 reason_code;
Jouni Malinend5cdfac2010-04-04 09:37:19 +03002010 bool local_state_change;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002011};
2012
2013/**
Johannes Berg04a773a2009-04-19 21:24:32 +02002014 * struct cfg80211_ibss_params - IBSS parameters
2015 *
2016 * This structure defines the IBSS parameters for the join_ibss()
2017 * method.
2018 *
2019 * @ssid: The SSID, will always be non-null.
2020 * @ssid_len: The length of the SSID, will always be non-zero.
2021 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2022 * search for IBSSs with a different BSSID.
Johannes Berg683b6d32012-11-08 21:25:48 +01002023 * @chandef: defines the channel to use if no other IBSS to join can be found
Johannes Berg04a773a2009-04-19 21:24:32 +02002024 * @channel_fixed: The channel should be fixed -- do not search for
2025 * IBSSs to join on other channels.
2026 * @ie: information element(s) to include in the beacon
2027 * @ie_len: length of that
Johannes Berg8e30bc52009-04-22 17:45:38 +02002028 * @beacon_interval: beacon interval to use
Johannes Bergfffd0932009-07-08 14:22:54 +02002029 * @privacy: this is a protected network, keys will be configured
2030 * after joining
Antonio Quartulli267335d2012-01-31 20:25:47 +01002031 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2032 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2033 * required to assume that the port is unauthorized until authorized by
2034 * user space. Otherwise, port is marked authorized by default.
Simon Wunderlich5336fa82013-10-07 18:41:05 +02002035 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2036 * changes the channel when a radar is detected. This is required
2037 * to operate on DFS channels.
Teemu Paasikivifbd2c8d2010-06-14 12:55:31 +03002038 * @basic_rates: bitmap of basic rates to use when creating the IBSS
Felix Fietkaudd5b4cc2010-11-22 20:58:24 +01002039 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
Simon Wunderlich803768f2013-06-28 10:39:58 +02002040 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
Johannes Bergad24b0d2013-07-05 11:53:28 +02002041 * will be used in ht_capa. Un-supported values will be ignored.
Simon Wunderlich803768f2013-06-28 10:39:58 +02002042 * @ht_capa_mask: The bits of ht_capa which are to be used.
Johannes Berg04a773a2009-04-19 21:24:32 +02002043 */
2044struct cfg80211_ibss_params {
Johannes Bergc1e5f472014-05-19 17:53:16 +02002045 const u8 *ssid;
2046 const u8 *bssid;
Johannes Berg683b6d32012-11-08 21:25:48 +01002047 struct cfg80211_chan_def chandef;
Johannes Bergc1e5f472014-05-19 17:53:16 +02002048 const u8 *ie;
Johannes Berg04a773a2009-04-19 21:24:32 +02002049 u8 ssid_len, ie_len;
Johannes Berg8e30bc52009-04-22 17:45:38 +02002050 u16 beacon_interval;
Teemu Paasikivifbd2c8d2010-06-14 12:55:31 +03002051 u32 basic_rates;
Johannes Berg04a773a2009-04-19 21:24:32 +02002052 bool channel_fixed;
Johannes Bergfffd0932009-07-08 14:22:54 +02002053 bool privacy;
Antonio Quartulli267335d2012-01-31 20:25:47 +01002054 bool control_port;
Simon Wunderlich5336fa82013-10-07 18:41:05 +02002055 bool userspace_handles_dfs;
Johannes Berg57fbcce2016-04-12 15:56:15 +02002056 int mcast_rate[NUM_NL80211_BANDS];
Simon Wunderlich803768f2013-06-28 10:39:58 +02002057 struct ieee80211_ht_cap ht_capa;
2058 struct ieee80211_ht_cap ht_capa_mask;
Johannes Berg04a773a2009-04-19 21:24:32 +02002059};
2060
2061/**
Arend van Spriel38de03d2016-03-02 20:37:18 +01002062 * struct cfg80211_bss_selection - connection parameters for BSS selection.
2063 *
2064 * @behaviour: requested BSS selection behaviour.
2065 * @param: parameters for requestion behaviour.
2066 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2067 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2068 */
2069struct cfg80211_bss_selection {
2070 enum nl80211_bss_select_attr behaviour;
2071 union {
Johannes Berg57fbcce2016-04-12 15:56:15 +02002072 enum nl80211_band band_pref;
Arend van Spriel38de03d2016-03-02 20:37:18 +01002073 struct cfg80211_bss_select_adjust adjust;
2074 } param;
2075};
2076
2077/**
Samuel Ortizb23aa672009-07-01 21:26:54 +02002078 * struct cfg80211_connect_params - Connection parameters
2079 *
2080 * This structure provides information needed to complete IEEE 802.11
2081 * authentication and association.
2082 *
2083 * @channel: The channel to use or %NULL if not specified (auto-select based
2084 * on scan results)
Jouni Malinen1df4a512014-01-15 00:00:47 +02002085 * @channel_hint: The channel of the recommended BSS for initial connection or
2086 * %NULL if not specified
Samuel Ortizb23aa672009-07-01 21:26:54 +02002087 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2088 * results)
Jouni Malinen1df4a512014-01-15 00:00:47 +02002089 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2090 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2091 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2092 * to use.
Samuel Ortizb23aa672009-07-01 21:26:54 +02002093 * @ssid: SSID
2094 * @ssid_len: Length of ssid in octets
2095 * @auth_type: Authentication type (algorithm)
Johannes Bergabe37c42010-06-07 11:12:27 +02002096 * @ie: IEs for association request
2097 * @ie_len: Length of assoc_ie in octets
Samuel Ortizb23aa672009-07-01 21:26:54 +02002098 * @privacy: indicates whether privacy-enabled APs should be used
Jouni Malinencee00a92013-01-15 17:15:57 +02002099 * @mfp: indicate whether management frame protection is used
Samuel Ortizb23aa672009-07-01 21:26:54 +02002100 * @crypto: crypto settings
Johannes Bergfffd0932009-07-08 14:22:54 +02002101 * @key_len: length of WEP key for shared key authentication
2102 * @key_idx: index of WEP key for shared key authentication
2103 * @key: WEP key for shared key authentication
Ben Greear7e7c8922011-11-18 11:31:59 -08002104 * @flags: See &enum cfg80211_assoc_req_flags
Bala Shanmugam4486ea92012-03-07 17:27:12 +05302105 * @bg_scan_period: Background scan period in seconds
Johannes Bergad24b0d2013-07-05 11:53:28 +02002106 * or -1 to indicate that default value is to be used.
Ben Greear7e7c8922011-11-18 11:31:59 -08002107 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
Johannes Bergad24b0d2013-07-05 11:53:28 +02002108 * will be used in ht_capa. Un-supported values will be ignored.
Ben Greear7e7c8922011-11-18 11:31:59 -08002109 * @ht_capa_mask: The bits of ht_capa which are to be used.
Johannes Bergee2aca32013-02-21 17:36:01 +01002110 * @vht_capa: VHT Capability overrides
2111 * @vht_capa_mask: The bits of vht_capa which are to be used.
Lior David34d50512016-01-28 10:58:25 +02002112 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2113 * networks.
Arend van Spriel38de03d2016-03-02 20:37:18 +01002114 * @bss_select: criteria to be used for BSS selection.
Jouni Malinen35eb8f72016-04-06 17:38:44 +03002115 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2116 * to indicate a request to reassociate within the ESS instead of a request
2117 * do the initial association with the ESS. When included, this is set to
2118 * the BSSID of the current association, i.e., to the value that is
2119 * included in the Current AP address field of the Reassociation Request
2120 * frame.
Vidyullatha Kanchanapally36eabf62017-03-31 00:22:34 +03002121 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2122 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2123 * data IE.
2124 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2125 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2126 * %NULL if not specified. This specifies the domain name of ER server and
2127 * is used to construct FILS wrapped data IE.
2128 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2129 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2130 * messages. This is also used to construct FILS wrapped data IE.
2131 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2132 * keys in FILS or %NULL if not specified.
2133 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
Samuel Ortizb23aa672009-07-01 21:26:54 +02002134 */
2135struct cfg80211_connect_params {
2136 struct ieee80211_channel *channel;
Jouni Malinen1df4a512014-01-15 00:00:47 +02002137 struct ieee80211_channel *channel_hint;
Jouni Malinen664834d2014-01-15 00:01:44 +02002138 const u8 *bssid;
Jouni Malinen1df4a512014-01-15 00:00:47 +02002139 const u8 *bssid_hint;
Jouni Malinen664834d2014-01-15 00:01:44 +02002140 const u8 *ssid;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002141 size_t ssid_len;
2142 enum nl80211_auth_type auth_type;
Johannes Berg4b5800f2014-01-15 14:55:59 +01002143 const u8 *ie;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002144 size_t ie_len;
2145 bool privacy;
Jouni Malinencee00a92013-01-15 17:15:57 +02002146 enum nl80211_mfp mfp;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002147 struct cfg80211_crypto_settings crypto;
Johannes Bergfffd0932009-07-08 14:22:54 +02002148 const u8 *key;
2149 u8 key_len, key_idx;
Ben Greear7e7c8922011-11-18 11:31:59 -08002150 u32 flags;
Bala Shanmugam4486ea92012-03-07 17:27:12 +05302151 int bg_scan_period;
Ben Greear7e7c8922011-11-18 11:31:59 -08002152 struct ieee80211_ht_cap ht_capa;
2153 struct ieee80211_ht_cap ht_capa_mask;
Johannes Bergee2aca32013-02-21 17:36:01 +01002154 struct ieee80211_vht_cap vht_capa;
2155 struct ieee80211_vht_cap vht_capa_mask;
Lior David34d50512016-01-28 10:58:25 +02002156 bool pbss;
Arend van Spriel38de03d2016-03-02 20:37:18 +01002157 struct cfg80211_bss_selection bss_select;
Jouni Malinenba6fbac2016-03-29 13:53:27 +03002158 const u8 *prev_bssid;
Vidyullatha Kanchanapally36eabf62017-03-31 00:22:34 +03002159 const u8 *fils_erp_username;
2160 size_t fils_erp_username_len;
2161 const u8 *fils_erp_realm;
2162 size_t fils_erp_realm_len;
2163 u16 fils_erp_next_seq_num;
2164 const u8 *fils_erp_rrk;
2165 size_t fils_erp_rrk_len;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002166};
2167
2168/**
vamsi krishna30da4e82016-10-27 16:51:11 +03002169 * enum cfg80211_connect_params_changed - Connection parameters being updated
2170 *
2171 * This enum provides information of all connect parameters that
2172 * have to be updated as part of update_connect_params() call.
2173 *
2174 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
Vidyullatha Kanchanapally5f5a26b2017-08-02 16:31:40 +05302175 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2176 * username, erp sequence number and rrk) are updated
2177 * @UPDATE_AUTH_TYPE: Indicates that Authentication type is updated
vamsi krishna30da4e82016-10-27 16:51:11 +03002178 */
2179enum cfg80211_connect_params_changed {
2180 UPDATE_ASSOC_IES = BIT(0),
Vidyullatha Kanchanapally5f5a26b2017-08-02 16:31:40 +05302181 UPDATE_FILS_ERP_INFO = BIT(1),
2182 UPDATE_AUTH_TYPE = BIT(2),
vamsi krishna30da4e82016-10-27 16:51:11 +03002183};
2184
2185/**
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02002186 * enum wiphy_params_flags - set_wiphy_params bitfield values
Johannes Bergabe37c42010-06-07 11:12:27 +02002187 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2188 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2189 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2190 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2191 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
Lorenzo Bianconi3057dbf2014-09-04 23:57:40 +02002192 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02002193 */
2194enum wiphy_params_flags {
2195 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2196 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2197 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2198 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
Lukáš Turek81077e82009-12-21 22:50:47 +01002199 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
Lorenzo Bianconi3057dbf2014-09-04 23:57:40 +02002200 WIPHY_PARAM_DYN_ACK = 1 << 5,
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02002201};
2202
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002203/**
2204 * struct cfg80211_pmksa - PMK Security Association
2205 *
2206 * This structure is passed to the set/del_pmksa() method for PMKSA
2207 * caching.
2208 *
Vidyullatha Kanchanapally36eabf62017-03-31 00:22:34 +03002209 * @bssid: The AP's BSSID (may be %NULL).
2210 * @pmkid: The identifier to refer a PMKSA.
2211 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2212 * derivation by a FILS STA. Otherwise, %NULL.
2213 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2214 * the hash algorithm used to generate this.
2215 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2216 * cache identifier (may be %NULL).
2217 * @ssid_len: Length of the @ssid in octets.
2218 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2219 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2220 * %NULL).
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002221 */
2222struct cfg80211_pmksa {
Johannes Bergc1e5f472014-05-19 17:53:16 +02002223 const u8 *bssid;
2224 const u8 *pmkid;
Vidyullatha Kanchanapally36eabf62017-03-31 00:22:34 +03002225 const u8 *pmk;
2226 size_t pmk_len;
2227 const u8 *ssid;
2228 size_t ssid_len;
2229 const u8 *cache_id;
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002230};
Johannes Berg99303802009-07-01 21:26:59 +02002231
Johannes Berg7643a2c2009-06-02 13:01:39 +02002232/**
Amitkumar Karwar50ac6602013-06-25 19:03:56 -07002233 * struct cfg80211_pkt_pattern - packet pattern
Johannes Bergff1b6e62011-05-04 15:37:28 +02002234 * @mask: bitmask where to match pattern and where to ignore bytes,
2235 * one bit per byte, in same format as nl80211
2236 * @pattern: bytes to match where bitmask is 1
2237 * @pattern_len: length of pattern (in bytes)
Amitkumar Karwarbb92d192013-02-12 12:16:26 -08002238 * @pkt_offset: packet offset (in bytes)
Johannes Bergff1b6e62011-05-04 15:37:28 +02002239 *
2240 * Internal note: @mask and @pattern are allocated in one chunk of
2241 * memory, free @mask only!
2242 */
Amitkumar Karwar50ac6602013-06-25 19:03:56 -07002243struct cfg80211_pkt_pattern {
Johannes Berg922bd802014-05-19 17:59:50 +02002244 const u8 *mask, *pattern;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002245 int pattern_len;
Amitkumar Karwarbb92d192013-02-12 12:16:26 -08002246 int pkt_offset;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002247};
2248
2249/**
Johannes Berg2a0e0472013-01-23 22:57:40 +01002250 * struct cfg80211_wowlan_tcp - TCP connection parameters
2251 *
2252 * @sock: (internal) socket for source port allocation
2253 * @src: source IP address
2254 * @dst: destination IP address
2255 * @dst_mac: destination MAC address
2256 * @src_port: source port
2257 * @dst_port: destination port
2258 * @payload_len: data payload length
2259 * @payload: data payload buffer
2260 * @payload_seq: payload sequence stamping configuration
2261 * @data_interval: interval at which to send data packets
2262 * @wake_len: wakeup payload match length
2263 * @wake_data: wakeup payload match data
2264 * @wake_mask: wakeup payload match mask
2265 * @tokens_size: length of the tokens buffer
2266 * @payload_tok: payload token usage configuration
2267 */
2268struct cfg80211_wowlan_tcp {
2269 struct socket *sock;
2270 __be32 src, dst;
2271 u16 src_port, dst_port;
2272 u8 dst_mac[ETH_ALEN];
2273 int payload_len;
2274 const u8 *payload;
2275 struct nl80211_wowlan_tcp_data_seq payload_seq;
2276 u32 data_interval;
2277 u32 wake_len;
2278 const u8 *wake_data, *wake_mask;
2279 u32 tokens_size;
2280 /* must be last, variable member */
2281 struct nl80211_wowlan_tcp_data_token payload_tok;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002282};
2283
2284/**
2285 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2286 *
2287 * This structure defines the enabled WoWLAN triggers for the device.
2288 * @any: wake up on any activity -- special trigger if device continues
2289 * operating as normal during suspend
2290 * @disconnect: wake up if getting disconnected
2291 * @magic_pkt: wake up on receiving magic packet
2292 * @patterns: wake up on receiving packet matching a pattern
2293 * @n_patterns: number of patterns
Johannes Berg77dbbb12011-07-13 10:48:55 +02002294 * @gtk_rekey_failure: wake up on GTK rekey failure
2295 * @eap_identity_req: wake up on EAP identity request packet
2296 * @four_way_handshake: wake up on 4-way handshake
2297 * @rfkill_release: wake up when rfkill is released
Johannes Berg2a0e0472013-01-23 22:57:40 +01002298 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
2299 * NULL if not configured.
Luciano Coelho8cd4d452014-09-17 11:55:28 +03002300 * @nd_config: configuration for the scan to be used for net detect wake.
Johannes Bergff1b6e62011-05-04 15:37:28 +02002301 */
2302struct cfg80211_wowlan {
Johannes Berg77dbbb12011-07-13 10:48:55 +02002303 bool any, disconnect, magic_pkt, gtk_rekey_failure,
2304 eap_identity_req, four_way_handshake,
2305 rfkill_release;
Amitkumar Karwar50ac6602013-06-25 19:03:56 -07002306 struct cfg80211_pkt_pattern *patterns;
Johannes Berg2a0e0472013-01-23 22:57:40 +01002307 struct cfg80211_wowlan_tcp *tcp;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002308 int n_patterns;
Luciano Coelho8cd4d452014-09-17 11:55:28 +03002309 struct cfg80211_sched_scan_request *nd_config;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002310};
2311
2312/**
Amitkumar Karwarbe29b992013-06-28 11:51:26 -07002313 * struct cfg80211_coalesce_rules - Coalesce rule parameters
2314 *
2315 * This structure defines coalesce rule for the device.
2316 * @delay: maximum coalescing delay in msecs.
2317 * @condition: condition for packet coalescence.
2318 * see &enum nl80211_coalesce_condition.
2319 * @patterns: array of packet patterns
2320 * @n_patterns: number of patterns
2321 */
2322struct cfg80211_coalesce_rules {
2323 int delay;
2324 enum nl80211_coalesce_condition condition;
2325 struct cfg80211_pkt_pattern *patterns;
2326 int n_patterns;
2327};
2328
2329/**
2330 * struct cfg80211_coalesce - Packet coalescing settings
2331 *
2332 * This structure defines coalescing settings.
2333 * @rules: array of coalesce rules
2334 * @n_rules: number of rules
2335 */
2336struct cfg80211_coalesce {
2337 struct cfg80211_coalesce_rules *rules;
2338 int n_rules;
2339};
2340
2341/**
Luciano Coelho8cd4d452014-09-17 11:55:28 +03002342 * struct cfg80211_wowlan_nd_match - information about the match
2343 *
2344 * @ssid: SSID of the match that triggered the wake up
2345 * @n_channels: Number of channels where the match occurred. This
2346 * value may be zero if the driver can't report the channels.
2347 * @channels: center frequencies of the channels where a match
2348 * occurred (in MHz)
2349 */
2350struct cfg80211_wowlan_nd_match {
2351 struct cfg80211_ssid ssid;
2352 int n_channels;
2353 u32 channels[];
2354};
2355
2356/**
2357 * struct cfg80211_wowlan_nd_info - net detect wake up information
2358 *
2359 * @n_matches: Number of match information instances provided in
2360 * @matches. This value may be zero if the driver can't provide
2361 * match information.
2362 * @matches: Array of pointers to matches containing information about
2363 * the matches that triggered the wake up.
2364 */
2365struct cfg80211_wowlan_nd_info {
2366 int n_matches;
2367 struct cfg80211_wowlan_nd_match *matches[];
2368};
2369
2370/**
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01002371 * struct cfg80211_wowlan_wakeup - wakeup report
2372 * @disconnect: woke up by getting disconnected
2373 * @magic_pkt: woke up by receiving magic packet
2374 * @gtk_rekey_failure: woke up by GTK rekey failure
2375 * @eap_identity_req: woke up by EAP identity request packet
2376 * @four_way_handshake: woke up by 4-way handshake
2377 * @rfkill_release: woke up by rfkill being released
2378 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2379 * @packet_present_len: copied wakeup packet data
2380 * @packet_len: original wakeup packet length
2381 * @packet: The packet causing the wakeup, if any.
2382 * @packet_80211: For pattern match, magic packet and other data
2383 * frame triggers an 802.3 frame should be reported, for
2384 * disconnect due to deauth 802.11 frame. This indicates which
2385 * it is.
Johannes Berg2a0e0472013-01-23 22:57:40 +01002386 * @tcp_match: TCP wakeup packet received
2387 * @tcp_connlost: TCP connection lost or failed to establish
2388 * @tcp_nomoretokens: TCP data ran out of tokens
Luciano Coelho8cd4d452014-09-17 11:55:28 +03002389 * @net_detect: if not %NULL, woke up because of net detect
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01002390 */
2391struct cfg80211_wowlan_wakeup {
2392 bool disconnect, magic_pkt, gtk_rekey_failure,
2393 eap_identity_req, four_way_handshake,
Johannes Berg2a0e0472013-01-23 22:57:40 +01002394 rfkill_release, packet_80211,
2395 tcp_match, tcp_connlost, tcp_nomoretokens;
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01002396 s32 pattern_idx;
2397 u32 packet_present_len, packet_len;
2398 const void *packet;
Luciano Coelho8cd4d452014-09-17 11:55:28 +03002399 struct cfg80211_wowlan_nd_info *net_detect;
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01002400};
2401
2402/**
Johannes Berge5497d72011-07-05 16:35:40 +02002403 * struct cfg80211_gtk_rekey_data - rekey data
Vidyullatha Kanchanapally84aa3ba2017-05-25 20:20:41 +05302404 * @kek: key encryption key
Johannes Berg78f686c2014-09-10 22:28:06 +03002405 * @kck: key confirmation key (NL80211_KCK_LEN bytes)
2406 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
Vidyullatha Kanchanapally84aa3ba2017-05-25 20:20:41 +05302407 * @kek_len: Length of @kek in octets
Johannes Berge5497d72011-07-05 16:35:40 +02002408 */
2409struct cfg80211_gtk_rekey_data {
Johannes Berg78f686c2014-09-10 22:28:06 +03002410 const u8 *kek, *kck, *replay_ctr;
Vidyullatha Kanchanapally84aa3ba2017-05-25 20:20:41 +05302411 size_t kek_len;
Johannes Berge5497d72011-07-05 16:35:40 +02002412};
2413
2414/**
Jouni Malinen355199e2013-02-27 17:14:27 +02002415 * struct cfg80211_update_ft_ies_params - FT IE Information
2416 *
2417 * This structure provides information needed to update the fast transition IE
2418 *
2419 * @md: The Mobility Domain ID, 2 Octet value
2420 * @ie: Fast Transition IEs
2421 * @ie_len: Length of ft_ie in octets
2422 */
2423struct cfg80211_update_ft_ies_params {
2424 u16 md;
2425 const u8 *ie;
2426 size_t ie_len;
2427};
2428
2429/**
Andrei Otcheretianskib176e622013-11-18 19:06:49 +02002430 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2431 *
2432 * This structure provides information needed to transmit a mgmt frame
2433 *
2434 * @chan: channel to use
2435 * @offchan: indicates wether off channel operation is required
2436 * @wait: duration for ROC
2437 * @buf: buffer to transmit
2438 * @len: buffer length
2439 * @no_cck: don't use cck rates for this frame
2440 * @dont_wait_for_ack: tells the low level not to wait for an ack
Andrei Otcheretianski34d22ce2014-05-09 14:11:44 +03002441 * @n_csa_offsets: length of csa_offsets array
2442 * @csa_offsets: array of all the csa offsets in the frame
Andrei Otcheretianskib176e622013-11-18 19:06:49 +02002443 */
2444struct cfg80211_mgmt_tx_params {
2445 struct ieee80211_channel *chan;
2446 bool offchan;
2447 unsigned int wait;
2448 const u8 *buf;
2449 size_t len;
2450 bool no_cck;
2451 bool dont_wait_for_ack;
Andrei Otcheretianski34d22ce2014-05-09 14:11:44 +03002452 int n_csa_offsets;
2453 const u16 *csa_offsets;
Andrei Otcheretianskib176e622013-11-18 19:06:49 +02002454};
2455
2456/**
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08002457 * struct cfg80211_dscp_exception - DSCP exception
2458 *
2459 * @dscp: DSCP value that does not adhere to the user priority range definition
2460 * @up: user priority value to which the corresponding DSCP value belongs
2461 */
2462struct cfg80211_dscp_exception {
2463 u8 dscp;
2464 u8 up;
2465};
2466
2467/**
2468 * struct cfg80211_dscp_range - DSCP range definition for user priority
2469 *
2470 * @low: lowest DSCP value of this user priority range, inclusive
2471 * @high: highest DSCP value of this user priority range, inclusive
2472 */
2473struct cfg80211_dscp_range {
2474 u8 low;
2475 u8 high;
2476};
2477
2478/* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2479#define IEEE80211_QOS_MAP_MAX_EX 21
2480#define IEEE80211_QOS_MAP_LEN_MIN 16
2481#define IEEE80211_QOS_MAP_LEN_MAX \
2482 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2483
2484/**
2485 * struct cfg80211_qos_map - QoS Map Information
2486 *
2487 * This struct defines the Interworking QoS map setting for DSCP values
2488 *
2489 * @num_des: number of DSCP exceptions (0..21)
2490 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2491 * the user priority DSCP range definition
2492 * @up: DSCP range definition for a particular user priority
2493 */
2494struct cfg80211_qos_map {
2495 u8 num_des;
2496 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2497 struct cfg80211_dscp_range up[8];
2498};
2499
2500/**
Ayala Bekercb3b7d82016-09-20 17:31:13 +03002501 * struct cfg80211_nan_conf - NAN configuration
2502 *
2503 * This struct defines NAN configuration parameters
2504 *
2505 * @master_pref: master preference (1 - 255)
2506 * @dual: dual band operation mode, see &enum nl80211_nan_dual_band_conf
2507 */
2508struct cfg80211_nan_conf {
2509 u8 master_pref;
2510 u8 dual;
2511};
2512
2513/**
Ayala Bekera5a9dcf2016-09-20 17:31:16 +03002514 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
2515 * configuration
2516 *
2517 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
2518 * @CFG80211_NAN_CONF_CHANGED_DUAL: dual band operation
2519 */
2520enum cfg80211_nan_conf_changes {
2521 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
2522 CFG80211_NAN_CONF_CHANGED_DUAL = BIT(1),
2523};
2524
2525/**
Ayala Bekera442b762016-09-20 17:31:15 +03002526 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
2527 *
2528 * @filter: the content of the filter
2529 * @len: the length of the filter
2530 */
2531struct cfg80211_nan_func_filter {
2532 const u8 *filter;
2533 u8 len;
2534};
2535
2536/**
2537 * struct cfg80211_nan_func - a NAN function
2538 *
2539 * @type: &enum nl80211_nan_function_type
2540 * @service_id: the service ID of the function
2541 * @publish_type: &nl80211_nan_publish_type
2542 * @close_range: if true, the range should be limited. Threshold is
2543 * implementation specific.
2544 * @publish_bcast: if true, the solicited publish should be broadcasted
2545 * @subscribe_active: if true, the subscribe is active
2546 * @followup_id: the instance ID for follow up
2547 * @followup_reqid: the requestor instance ID for follow up
2548 * @followup_dest: MAC address of the recipient of the follow up
2549 * @ttl: time to live counter in DW.
2550 * @serv_spec_info: Service Specific Info
2551 * @serv_spec_info_len: Service Specific Info length
2552 * @srf_include: if true, SRF is inclusive
2553 * @srf_bf: Bloom Filter
2554 * @srf_bf_len: Bloom Filter length
2555 * @srf_bf_idx: Bloom Filter index
2556 * @srf_macs: SRF MAC addresses
2557 * @srf_num_macs: number of MAC addresses in SRF
2558 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
2559 * @tx_filters: filters that should be transmitted in the SDF.
2560 * @num_rx_filters: length of &rx_filters.
2561 * @num_tx_filters: length of &tx_filters.
2562 * @instance_id: driver allocated id of the function.
2563 * @cookie: unique NAN function identifier.
2564 */
2565struct cfg80211_nan_func {
2566 enum nl80211_nan_function_type type;
2567 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
2568 u8 publish_type;
2569 bool close_range;
2570 bool publish_bcast;
2571 bool subscribe_active;
2572 u8 followup_id;
2573 u8 followup_reqid;
2574 struct mac_address followup_dest;
2575 u32 ttl;
2576 const u8 *serv_spec_info;
2577 u8 serv_spec_info_len;
2578 bool srf_include;
2579 const u8 *srf_bf;
2580 u8 srf_bf_len;
2581 u8 srf_bf_idx;
2582 struct mac_address *srf_macs;
2583 int srf_num_macs;
2584 struct cfg80211_nan_func_filter *rx_filters;
2585 struct cfg80211_nan_func_filter *tx_filters;
2586 u8 num_tx_filters;
2587 u8 num_rx_filters;
2588 u8 instance_id;
2589 u64 cookie;
2590};
2591
2592/**
Srinivas Dasarid041a1a2018-02-07 18:32:17 +05302593 * struct cfg80211_external_auth_params - Trigger External authentication.
2594 *
2595 * Commonly used across the external auth request and event interfaces.
2596 *
2597 * @action: action type / trigger for external authentication. Only significant
2598 * for the authentication request event interface (driver to user space).
2599 * @bssid: BSSID of the peer with which the authentication has
2600 * to happen. Used by both the authentication request event and
2601 * authentication response command interface.
2602 * @ssid: SSID of the AP. Used by both the authentication request event and
2603 * authentication response command interface.
2604 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
2605 * authentication request event interface.
2606 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
2607 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
2608 * the real status code for failures. Used only for the authentication
2609 * response command interface (user space to driver).
Srinivas Dasari0c095552019-08-12 13:08:43 +05302610 * @pmkid: The identifier to refer a PMKSA.
Srinivas Dasarid041a1a2018-02-07 18:32:17 +05302611 */
2612struct cfg80211_external_auth_params {
2613 enum nl80211_external_auth_action action;
2614 u8 bssid[ETH_ALEN] __aligned(2);
2615 struct cfg80211_ssid ssid;
2616 unsigned int key_mgmt_suite;
2617 u16 status;
Srinivas Dasari0c095552019-08-12 13:08:43 +05302618 const u8 *pmkid;
Srinivas Dasarid041a1a2018-02-07 18:32:17 +05302619};
2620
2621/**
Sunil Dutt6e200822019-04-09 13:09:28 +05302622 * struct cfg80211_update_owe_info - OWE Information
2623 *
2624 * This structure provides information needed for the drivers to offload OWE
2625 * (Opportunistic Wireless Encryption) processing to the user space.
2626 *
2627 * Commonly used across update_owe_info request and event interfaces.
2628 *
2629 * @peer: MAC address of the peer device for which the OWE processing
2630 * has to be done.
2631 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
2632 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
2633 * cannot give you the real status code for failures. Used only for
2634 * OWE update request command interface (user space to driver).
2635 * @ie: IEs obtained from the peer or constructed by the user space. These are
2636 * the IEs of the remote peer in the event from the host driver and
2637 * the constructed IEs by the user space in the request interface.
2638 * @ie_len: Length of IEs in octets.
2639 */
2640struct cfg80211_update_owe_info {
2641 u8 peer[ETH_ALEN] __aligned(2);
2642 u16 status;
2643 const u8 *ie;
2644 size_t ie_len;
2645};
2646
2647/**
Johannes Berg704232c2007-04-23 12:20:05 -07002648 * struct cfg80211_ops - backend description for wireless configuration
2649 *
2650 * This struct is registered by fullmac card drivers and/or wireless stacks
2651 * in order to handle configuration requests on their interfaces.
2652 *
2653 * All callbacks except where otherwise noted should return 0
2654 * on success or a negative error code.
2655 *
Johannes Berg43fb45cb2007-04-24 14:07:27 -07002656 * All operations are currently invoked under rtnl for consistency with the
2657 * wireless extensions but this is subject to reevaluation as soon as this
2658 * code is used more widely and we have a first user without wext.
2659 *
Johannes Bergff1b6e62011-05-04 15:37:28 +02002660 * @suspend: wiphy device needs to be suspended. The variable @wow will
2661 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
2662 * configured for the device.
Johannes Berg0378b3f2009-01-19 11:20:52 -05002663 * @resume: wiphy device needs to be resumed
Johannes Berg6d525632012-04-04 15:05:25 +02002664 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
2665 * to call device_set_wakeup_enable() to enable/disable wakeup from
2666 * the device.
Johannes Berg0378b3f2009-01-19 11:20:52 -05002667 *
Johannes Berg60719ff2008-09-16 14:55:09 +02002668 * @add_virtual_intf: create a new virtual interface with the given name,
Johannes Berg463d0182009-07-14 00:33:35 +02002669 * must set the struct wireless_dev's iftype. Beware: You must create
Johannes Berg84efbb82012-06-16 00:00:26 +02002670 * the new netdev in the wiphy's network namespace! Returns the struct
Johannes Berg98104fde2012-06-16 00:19:54 +02002671 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
2672 * also set the address member in the wdev.
Johannes Berg704232c2007-04-23 12:20:05 -07002673 *
Johannes Berg84efbb82012-06-16 00:00:26 +02002674 * @del_virtual_intf: remove the virtual interface
Johannes Berg55682962007-09-20 13:09:35 -04002675 *
Johannes Berg60719ff2008-09-16 14:55:09 +02002676 * @change_virtual_intf: change type/configuration of virtual interface,
2677 * keep the struct wireless_dev's iftype updated.
Johannes Berg55682962007-09-20 13:09:35 -04002678 *
Johannes Berg41ade002007-12-19 02:03:29 +01002679 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
2680 * when adding a group key.
2681 *
2682 * @get_key: get information about the key with the given parameters.
2683 * @mac_addr will be %NULL when requesting information for a group
2684 * key. All pointers given to the @callback function need not be valid
Johannes Berge3da5742009-05-18 19:56:36 +02002685 * after it returns. This function should return an error if it is
2686 * not possible to retrieve the key, -ENOENT if it doesn't exist.
Johannes Berg41ade002007-12-19 02:03:29 +01002687 *
2688 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
Johannes Berge3da5742009-05-18 19:56:36 +02002689 * and @key_index, return -ENOENT if the key doesn't exist.
Johannes Berg41ade002007-12-19 02:03:29 +01002690 *
2691 * @set_default_key: set the default key on an interface
Johannes Berged1b6cc2007-12-19 02:03:32 +01002692 *
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +02002693 * @set_default_mgmt_key: set the default management frame key on an interface
Jouni Malinena2be0702020-03-27 18:20:31 +05302694
2695 * @set_default_beacon_key: set the default Beacon frame key on an interface
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +02002696 *
Johannes Berge5497d72011-07-05 16:35:40 +02002697 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
2698 *
Johannes Bergc04a4ff2012-03-01 15:28:19 +01002699 * @start_ap: Start acting in AP mode defined by the parameters.
2700 * @change_beacon: Change the beacon parameters for an access point mode
2701 * interface. This should reject the call when AP mode wasn't started.
2702 * @stop_ap: Stop being an AP, including stopping beaconing.
Johannes Berg5727ef12007-12-19 02:03:34 +01002703 *
2704 * @add_station: Add a new station.
Jouni Malinen89c771e2014-10-10 20:52:40 +03002705 * @del_station: Remove a station
Johannes Bergbdd90d52011-12-14 12:20:27 +01002706 * @change_station: Modify a given station. Note that flags changes are not much
2707 * validated in cfg80211, in particular the auth/assoc/authorized flags
2708 * might come to the driver in invalid combinations -- make sure to check
Johannes Berg77ee7c82013-02-15 00:48:33 +01002709 * them, also against the existing state! Drivers must call
2710 * cfg80211_check_station_change() to validate the information.
Johannes Bergabe37c42010-06-07 11:12:27 +02002711 * @get_station: get station information for the station identified by @mac
2712 * @dump_station: dump station callback -- resume dump at index @idx
2713 *
2714 * @add_mpath: add a fixed mesh path
2715 * @del_mpath: delete a given mesh path
2716 * @change_mpath: change a given mesh path
2717 * @get_mpath: get a mesh path for the given parameters
2718 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
Henning Rogge66be7d22014-09-12 08:58:49 +02002719 * @get_mpp: get a mesh proxy path for the given parameters
2720 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
Johannes Bergf52555a2011-01-06 22:36:45 +01002721 * @join_mesh: join the mesh network with the specified parameters
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002722 * (invoked with the wireless_dev mutex held)
Johannes Bergf52555a2011-01-06 22:36:45 +01002723 * @leave_mesh: leave the current mesh network
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002724 * (invoked with the wireless_dev mutex held)
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01002725 *
Javier Cardona24bdd9f2010-12-16 17:37:48 -08002726 * @get_mesh_config: Get the current mesh configuration
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07002727 *
Javier Cardona24bdd9f2010-12-16 17:37:48 -08002728 * @update_mesh_config: Update mesh parameters on a running mesh.
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07002729 * The mask is a bitfield which tells us which parameters to
2730 * set, and which to leave alone.
2731 *
Jouni Malinen9f1ba902008-08-07 20:07:01 +03002732 * @change_bss: Modify parameters for a given BSS.
Jouni Malinen31888482008-10-30 16:59:24 +02002733 *
2734 * @set_txq_params: Set TX queue parameters
Jouni Malinen72bdcf32008-11-26 16:15:24 +02002735 *
Johannes Berge8c9bd52012-06-06 08:18:22 +02002736 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
2737 * as it doesn't implement join_mesh and needs to set the channel to
2738 * join the mesh instead.
2739 *
2740 * @set_monitor_channel: Set the monitor mode channel for the device. If other
2741 * interfaces are active this callback should reject the configuration.
2742 * If no interfaces are active or the device is down, the channel should
2743 * be stored for when a monitor interface becomes active.
Jouni Malinen9aed3cc2009-01-13 16:03:29 +02002744 *
Johannes Berg2a519312009-02-10 21:25:55 +01002745 * @scan: Request to do a scan. If returning zero, the scan request is given
2746 * the driver, and will be valid until passed to cfg80211_scan_done().
2747 * For scan results, call cfg80211_inform_bss(); you can call this outside
2748 * the scan/scan_done bracket too.
Vidyullatha Kanchanapally91d3ab42015-10-30 19:14:49 +05302749 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
2750 * indicate the status of the scan through cfg80211_scan_done().
Jouni Malinen636a5d32009-03-19 13:39:22 +02002751 *
2752 * @auth: Request to authenticate with the specified peer
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002753 * (invoked with the wireless_dev mutex held)
Jouni Malinen636a5d32009-03-19 13:39:22 +02002754 * @assoc: Request to (re)associate with the specified peer
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002755 * (invoked with the wireless_dev mutex held)
Jouni Malinen636a5d32009-03-19 13:39:22 +02002756 * @deauth: Request to deauthenticate from the specified peer
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002757 * (invoked with the wireless_dev mutex held)
Jouni Malinen636a5d32009-03-19 13:39:22 +02002758 * @disassoc: Request to disassociate from the specified peer
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002759 * (invoked with the wireless_dev mutex held)
Johannes Berg04a773a2009-04-19 21:24:32 +02002760 *
Samuel Ortizb23aa672009-07-01 21:26:54 +02002761 * @connect: Connect to the ESS with the specified parameters. When connected,
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03002762 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
2763 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
2764 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
2765 * from the AP or cfg80211_connect_timeout() if no frame with status code
2766 * was received.
2767 * The driver is allowed to roam to other BSSes within the ESS when the
2768 * other BSS matches the connect parameters. When such roaming is initiated
2769 * by the driver, the driver is expected to verify that the target matches
2770 * the configured security parameters and to use Reassociation Request
2771 * frame instead of Association Request frame.
2772 * The connect function can also be used to request the driver to perform a
2773 * specific roam when connected to an ESS. In that case, the prev_bssid
Jouni Malinen35eb8f72016-04-06 17:38:44 +03002774 * parameter is set to the BSSID of the currently associated BSS as an
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03002775 * indication of requesting reassociation.
2776 * In both the driver-initiated and new connect() call initiated roaming
2777 * cases, the result of roaming is indicated with a call to
Avraham Stern9e841a62017-04-26 10:58:49 +03002778 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
vamsi krishna30da4e82016-10-27 16:51:11 +03002779 * @update_connect_params: Update the connect parameters while connected to a
2780 * BSS. The updated parameters can be used by driver/firmware for
2781 * subsequent BSS selection (roaming) decisions and to form the
2782 * Authentication/(Re)Association Request frames. This call does not
2783 * request an immediate disassociation or reassociation with the current
2784 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
2785 * changed are defined in &enum cfg80211_connect_params_changed.
2786 * (invoked with the wireless_dev mutex held)
Emmanuel Grumbach5a1f0442016-08-29 23:25:14 +03002787 * @disconnect: Disconnect from the BSS/ESS. Once done, call
2788 * cfg80211_disconnected().
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002789 * (invoked with the wireless_dev mutex held)
Johannes Berg04a773a2009-04-19 21:24:32 +02002790 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
2791 * cfg80211_ibss_joined(), also call that function when changing BSSID due
2792 * to a merge.
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002793 * (invoked with the wireless_dev mutex held)
Johannes Berg04a773a2009-04-19 21:24:32 +02002794 * @leave_ibss: Leave the IBSS.
Johannes Berg8d61ffa2013-05-10 12:32:47 +02002795 * (invoked with the wireless_dev mutex held)
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02002796 *
Antonio Quartullif4e583c2012-11-02 13:27:48 +01002797 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
2798 * MESH mode)
2799 *
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02002800 * @set_wiphy_params: Notify that wiphy parameters have changed;
2801 * @changed bitfield (see &enum wiphy_params_flags) describes which values
2802 * have changed. The actual parameter values are available in
2803 * struct wiphy. If returning an error, no value should be changed.
Johannes Berg7643a2c2009-06-02 13:01:39 +02002804 *
Luis R. Rodriguez1432de02011-11-28 16:38:46 -05002805 * @set_tx_power: set the transmit power according to the parameters,
Johannes Bergc8442112012-10-24 10:17:18 +02002806 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
2807 * wdev may be %NULL if power was set for the wiphy, and will
2808 * always be %NULL unless the driver supports per-vif TX power
2809 * (as advertised by the nl80211 feature flag.)
Johannes Berg7643a2c2009-06-02 13:01:39 +02002810 * @get_tx_power: store the current TX power into the dbm variable;
Johannes Berg1f87f7d2009-06-02 13:01:41 +02002811 * return 0 if successful
2812 *
Johannes Bergabe37c42010-06-07 11:12:27 +02002813 * @set_wds_peer: set the WDS peer for a WDS interface
2814 *
Johannes Berg1f87f7d2009-06-02 13:01:41 +02002815 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
2816 * functions to adjust rfkill hw state
Johannes Bergaff89a92009-07-01 21:26:51 +02002817 *
Holger Schurig61fa7132009-11-11 12:25:40 +01002818 * @dump_survey: get site survey information.
2819 *
Jouni Malinen9588bbd2009-12-23 13:15:41 +01002820 * @remain_on_channel: Request the driver to remain awake on the specified
2821 * channel for the specified duration to complete an off-channel
2822 * operation (e.g., public action frame exchange). When the driver is
2823 * ready on the requested channel, it must indicate this with an event
2824 * notification by calling cfg80211_ready_on_channel().
2825 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
2826 * This allows the operation to be terminated prior to timeout based on
2827 * the duration value.
Johannes Bergf7ca38d2010-11-25 10:02:29 +01002828 * @mgmt_tx: Transmit a management frame.
2829 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
2830 * frame on another channel
Jouni Malinen9588bbd2009-12-23 13:15:41 +01002831 *
David Spinadelfc73f112013-07-31 18:04:15 +03002832 * @testmode_cmd: run a test mode command; @wdev may be %NULL
Wey-Yi Guy71063f02011-05-20 09:05:54 -07002833 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
2834 * used by the function, but 0 and 1 must not be touched. Additionally,
2835 * return error codes other than -ENOBUFS and -ENOENT will terminate the
2836 * dump and return to userspace with an error, so be careful. If any data
2837 * was passed in from userspace then the data/len arguments will be present
2838 * and point to the data contained in %NL80211_ATTR_TESTDATA.
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002839 *
Johannes Bergabe37c42010-06-07 11:12:27 +02002840 * @set_bitrate_mask: set the bitrate mask configuration
2841 *
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002842 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
2843 * devices running firmwares capable of generating the (re) association
2844 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
2845 * @del_pmksa: Delete a cached PMKID.
2846 * @flush_pmksa: Flush all cached PMKIDs.
Juuso Oikarinen9043f3b2010-04-27 12:47:41 +03002847 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
2848 * allows the driver to adjust the dynamic ps timeout value.
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02002849 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
Johannes Berge86abc62015-10-22 17:35:14 +02002850 * After configuration, the driver should (soon) send an event indicating
2851 * the current level is above/below the configured threshold; this may
2852 * need some care when the configuration is changed (without first being
2853 * disabled.)
Thomas Pedersen84f10702012-07-12 16:17:33 -07002854 * @set_cqm_txe_config: Configure connection quality monitor TX error
2855 * thresholds.
Luciano Coelho807f8a82011-05-11 17:09:35 +03002856 * @sched_scan_start: Tell the driver to start a scheduled scan.
Johannes Bergd9b83962014-02-13 17:16:10 +01002857 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This
2858 * call must stop the scheduled scan and be ready for starting a new one
2859 * before it returns, i.e. @sched_scan_start may be called immediately
2860 * after that again and should not fail in that case. The driver should
2861 * not call cfg80211_sched_scan_stopped() for a requested stop (when this
2862 * method returns 0.)
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002863 *
Johannes Berg271733c2010-10-13 12:06:23 +02002864 * @mgmt_frame_register: Notify driver that a management frame type was
Johannes Berg33d87832015-06-23 17:47:05 +02002865 * registered. The callback is allowed to sleep.
Bruno Randolf547025d2010-12-02 16:23:12 +09002866 *
2867 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2868 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2869 * reject TX/RX mask combinations they cannot support by returning -EINVAL
2870 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
2871 *
2872 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
John W. Linville36777132011-03-07 16:17:59 -05002873 *
Arik Nemtsov109086c2011-09-28 14:12:50 +03002874 * @tdls_mgmt: Transmit a TDLS management frame.
2875 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
Johannes Berg7f6cf312011-11-04 11:18:15 +01002876 *
2877 * @probe_client: probe an associated client, must return a cookie that it
2878 * later passes to cfg80211_probe_status().
Simon Wunderlich1d9d9212011-11-18 14:20:43 +01002879 *
2880 * @set_noack_map: Set the NoAck Map for the TIDs.
Ben Greeard6199212012-04-23 12:50:29 -07002881 *
Johannes Berg5b7ccaf2012-07-12 19:45:08 +02002882 * @get_channel: Get the current operating channel for the virtual interface.
2883 * For monitor interfaces, it should return %NULL unless there's a single
2884 * current monitoring channel.
Johannes Berg98104fde2012-06-16 00:19:54 +02002885 *
2886 * @start_p2p_device: Start the given P2P device.
2887 * @stop_p2p_device: Stop the given P2P device.
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05302888 *
2889 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
2890 * Parameters include ACL policy, an array of MAC address of stations
2891 * and the number of MAC addresses. If there is already a list in driver
2892 * this new list replaces the existing one. Driver has to clear its ACL
2893 * when number of MAC addresses entries is passed as 0. Drivers which
2894 * advertise the support for MAC based ACL have to implement this callback.
Simon Wunderlich04f39042013-02-08 18:16:19 +01002895 *
2896 * @start_radar_detection: Start radar detection in the driver.
Jouni Malinen8bf24292013-03-25 11:15:59 +02002897 *
2898 * @update_ft_ies: Provide updated Fast BSS Transition information to the
2899 * driver. If the SME is in the driver/firmware, this information can be
2900 * used in building Authentication and Reassociation Request frames.
Arend van Spriel5de17982013-04-18 15:49:00 +02002901 *
2902 * @crit_proto_start: Indicates a critical protocol needs more link reliability
2903 * for a given duration (milliseconds). The protocol is provided so the
2904 * driver can take the most appropriate actions.
2905 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
2906 * reliability. This operation can not fail.
Amitkumar Karwarbe29b992013-06-28 11:51:26 -07002907 * @set_coalesce: Set coalesce parameters.
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02002908 *
Michal Kazior97dc94f2014-06-25 12:35:10 +02002909 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
2910 * responsible for veryfing if the switch is possible. Since this is
2911 * inherently tricky driver may decide to disconnect an interface later
2912 * with cfg80211_stop_iface(). This doesn't mean driver can accept
2913 * everything. It should do it's best to verify requests and reject them
2914 * as soon as possible.
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08002915 *
2916 * @set_qos_map: Set QoS mapping information to the driver
Jouni Malinene16821b2014-04-28 11:22:08 +03002917 *
2918 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
2919 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
2920 * changes during the lifetime of the BSS.
Johannes Berg960d01a2014-09-09 22:55:35 +03002921 *
2922 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
2923 * with the given parameters; action frame exchange has been handled by
2924 * userspace so this just has to modify the TX path to take the TS into
2925 * account.
2926 * If the admitted time is 0 just validate the parameters to make sure
2927 * the session can be created at all; it is valid to just always return
2928 * success for that but that may result in inefficient behaviour (handshake
2929 * with the peer followed by immediate teardown when the addition is later
2930 * rejected)
2931 * @del_tx_ts: remove an existing TX TS
Rostislav Lisovy6e0bd6c2014-11-03 10:33:18 +01002932 *
2933 * @join_ocb: join the OCB network with the specified parameters
2934 * (invoked with the wireless_dev mutex held)
2935 * @leave_ocb: leave the current OCB network
2936 * (invoked with the wireless_dev mutex held)
Arik Nemtsov1057d352014-11-19 12:54:26 +02002937 *
2938 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
2939 * is responsible for continually initiating channel-switching operations
2940 * and returning to the base channel for communication with the AP.
2941 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
2942 * peers must be on the base channel when the call completes.
Ayala Bekercb3b7d82016-09-20 17:31:13 +03002943 * @start_nan: Start the NAN interface.
2944 * @stop_nan: Stop the NAN interface.
Ayala Bekera442b762016-09-20 17:31:15 +03002945 * @add_nan_func: Add a NAN function. Returns negative value on failure.
2946 * On success @nan_func ownership is transferred to the driver and
2947 * it may access it outside of the scope of this function. The driver
2948 * should free the @nan_func when no longer needed by calling
2949 * cfg80211_free_nan_func().
2950 * On success the driver should assign an instance_id in the
2951 * provided @nan_func.
2952 * @del_nan_func: Delete a NAN function.
Ayala Bekera5a9dcf2016-09-20 17:31:16 +03002953 * @nan_change_conf: changes NAN configuration. The changed parameters must
2954 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
2955 * All other parameters must be ignored.
Michael Braund757efc2016-10-10 19:12:22 +02002956 *
2957 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
Srinivas Dasarid041a1a2018-02-07 18:32:17 +05302958 *
2959 * @external_auth: indicates result of offloaded authentication processing from
2960 * user space
Sunil Dutt6e200822019-04-09 13:09:28 +05302961 *
2962 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
2963 * but offloading OWE processing to the user space will get the updated
2964 * DH IE through this interface.
Johannes Berg704232c2007-04-23 12:20:05 -07002965 */
2966struct cfg80211_ops {
Johannes Bergff1b6e62011-05-04 15:37:28 +02002967 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
Johannes Berg0378b3f2009-01-19 11:20:52 -05002968 int (*resume)(struct wiphy *wiphy);
Johannes Berg6d525632012-04-04 15:05:25 +02002969 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
Johannes Berg0378b3f2009-01-19 11:20:52 -05002970
Johannes Berg84efbb82012-06-16 00:00:26 +02002971 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
Johannes Berg552bff02012-09-19 09:26:06 +02002972 const char *name,
Tom Gundersen6bab2e192015-03-18 11:13:39 +01002973 unsigned char name_assign_type,
Johannes Berg84efbb82012-06-16 00:00:26 +02002974 enum nl80211_iftype type,
2975 u32 *flags,
2976 struct vif_params *params);
2977 int (*del_virtual_intf)(struct wiphy *wiphy,
2978 struct wireless_dev *wdev);
Johannes Berge36d56b2009-06-09 21:04:43 +02002979 int (*change_virtual_intf)(struct wiphy *wiphy,
2980 struct net_device *dev,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01002981 enum nl80211_iftype type, u32 *flags,
2982 struct vif_params *params);
Johannes Berg41ade002007-12-19 02:03:29 +01002983
2984 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
Johannes Berge31b8212010-10-05 19:39:30 +02002985 u8 key_index, bool pairwise, const u8 *mac_addr,
Johannes Berg41ade002007-12-19 02:03:29 +01002986 struct key_params *params);
2987 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
Johannes Berge31b8212010-10-05 19:39:30 +02002988 u8 key_index, bool pairwise, const u8 *mac_addr,
2989 void *cookie,
Johannes Berg41ade002007-12-19 02:03:29 +01002990 void (*callback)(void *cookie, struct key_params*));
2991 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
Johannes Berge31b8212010-10-05 19:39:30 +02002992 u8 key_index, bool pairwise, const u8 *mac_addr);
Johannes Berg41ade002007-12-19 02:03:29 +01002993 int (*set_default_key)(struct wiphy *wiphy,
2994 struct net_device *netdev,
Johannes Bergdbd2fd62010-12-09 19:58:59 +01002995 u8 key_index, bool unicast, bool multicast);
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +02002996 int (*set_default_mgmt_key)(struct wiphy *wiphy,
2997 struct net_device *netdev,
2998 u8 key_index);
Jouni Malinena2be0702020-03-27 18:20:31 +05302999 int (*set_default_beacon_key)(struct wiphy *wiphy,
3000 struct net_device *netdev,
3001 u8 key_index);
Johannes Berged1b6cc2007-12-19 02:03:32 +01003002
Johannes Berg88600202012-02-13 15:17:18 +01003003 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
3004 struct cfg80211_ap_settings *settings);
3005 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
3006 struct cfg80211_beacon_data *info);
3007 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
Johannes Berg5727ef12007-12-19 02:03:34 +01003008
3009
3010 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003011 const u8 *mac,
3012 struct station_parameters *params);
Johannes Berg5727ef12007-12-19 02:03:34 +01003013 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
Jouni Malinen89c771e2014-10-10 20:52:40 +03003014 struct station_del_parameters *params);
Johannes Berg5727ef12007-12-19 02:03:34 +01003015 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003016 const u8 *mac,
3017 struct station_parameters *params);
Johannes Bergfd5b74d2007-12-19 02:03:36 +01003018 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003019 const u8 *mac, struct station_info *sinfo);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003020 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003021 int idx, u8 *mac, struct station_info *sinfo);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003022
3023 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003024 const u8 *dst, const u8 *next_hop);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003025 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003026 const u8 *dst);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003027 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003028 const u8 *dst, const u8 *next_hop);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003029 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003030 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003031 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003032 int idx, u8 *dst, u8 *next_hop,
3033 struct mpath_info *pinfo);
Henning Rogge66be7d22014-09-12 08:58:49 +02003034 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
3035 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
3036 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
3037 int idx, u8 *dst, u8 *mpp,
3038 struct mpath_info *pinfo);
Javier Cardona24bdd9f2010-12-16 17:37:48 -08003039 int (*get_mesh_config)(struct wiphy *wiphy,
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07003040 struct net_device *dev,
3041 struct mesh_config *conf);
Javier Cardona24bdd9f2010-12-16 17:37:48 -08003042 int (*update_mesh_config)(struct wiphy *wiphy,
Johannes Berg29cbe682010-12-03 09:20:44 +01003043 struct net_device *dev, u32 mask,
3044 const struct mesh_config *nconf);
3045 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
3046 const struct mesh_config *conf,
3047 const struct mesh_setup *setup);
3048 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
3049
Rostislav Lisovy6e0bd6c2014-11-03 10:33:18 +01003050 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
3051 struct ocb_setup *setup);
3052 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
3053
Jouni Malinen9f1ba902008-08-07 20:07:01 +03003054 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
3055 struct bss_parameters *params);
Jouni Malinen31888482008-10-30 16:59:24 +02003056
Eliad Pellerf70f01c2011-09-25 20:06:53 +03003057 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
Jouni Malinen31888482008-10-30 16:59:24 +02003058 struct ieee80211_txq_params *params);
Jouni Malinen72bdcf32008-11-26 16:15:24 +02003059
Johannes Berge8c9bd52012-06-06 08:18:22 +02003060 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
3061 struct net_device *dev,
3062 struct ieee80211_channel *chan);
3063
3064 int (*set_monitor_channel)(struct wiphy *wiphy,
Johannes Berg683b6d32012-11-08 21:25:48 +01003065 struct cfg80211_chan_def *chandef);
Jouni Malinen9aed3cc2009-01-13 16:03:29 +02003066
Johannes Bergfd014282012-06-18 19:17:03 +02003067 int (*scan)(struct wiphy *wiphy,
Johannes Berg2a519312009-02-10 21:25:55 +01003068 struct cfg80211_scan_request *request);
Vidyullatha Kanchanapally91d3ab42015-10-30 19:14:49 +05303069 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
Jouni Malinen636a5d32009-03-19 13:39:22 +02003070
3071 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
3072 struct cfg80211_auth_request *req);
3073 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
3074 struct cfg80211_assoc_request *req);
3075 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg63c9c5e2012-02-24 13:50:51 +01003076 struct cfg80211_deauth_request *req);
Jouni Malinen636a5d32009-03-19 13:39:22 +02003077 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg63c9c5e2012-02-24 13:50:51 +01003078 struct cfg80211_disassoc_request *req);
Johannes Berg04a773a2009-04-19 21:24:32 +02003079
Samuel Ortizb23aa672009-07-01 21:26:54 +02003080 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
3081 struct cfg80211_connect_params *sme);
vamsi krishna30da4e82016-10-27 16:51:11 +03003082 int (*update_connect_params)(struct wiphy *wiphy,
3083 struct net_device *dev,
3084 struct cfg80211_connect_params *sme,
3085 u32 changed);
Samuel Ortizb23aa672009-07-01 21:26:54 +02003086 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
3087 u16 reason_code);
3088
Johannes Berg04a773a2009-04-19 21:24:32 +02003089 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
3090 struct cfg80211_ibss_params *params);
3091 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02003092
Antonio Quartullif4e583c2012-11-02 13:27:48 +01003093 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg57fbcce2016-04-12 15:56:15 +02003094 int rate[NUM_NL80211_BANDS]);
Antonio Quartullif4e583c2012-11-02 13:27:48 +01003095
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02003096 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
Johannes Berg7643a2c2009-06-02 13:01:39 +02003097
Johannes Bergc8442112012-10-24 10:17:18 +02003098 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
Juuso Oikarinenfa61cf72010-06-23 12:12:37 +03003099 enum nl80211_tx_power_setting type, int mbm);
Johannes Bergc8442112012-10-24 10:17:18 +02003100 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3101 int *dbm);
Johannes Berg1f87f7d2009-06-02 13:01:41 +02003102
Johannes Bergab737a42009-07-01 21:26:58 +02003103 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg388ac772010-10-07 13:11:09 +02003104 const u8 *addr);
Johannes Bergab737a42009-07-01 21:26:58 +02003105
Johannes Berg1f87f7d2009-06-02 13:01:41 +02003106 void (*rfkill_poll)(struct wiphy *wiphy);
Johannes Bergaff89a92009-07-01 21:26:51 +02003107
3108#ifdef CONFIG_NL80211_TESTMODE
David Spinadelfc73f112013-07-31 18:04:15 +03003109 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
3110 void *data, int len);
Wey-Yi Guy71063f02011-05-20 09:05:54 -07003111 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
3112 struct netlink_callback *cb,
3113 void *data, int len);
Johannes Bergaff89a92009-07-01 21:26:51 +02003114#endif
Johannes Bergbc92afd2009-07-01 21:26:57 +02003115
Johannes Berg99303802009-07-01 21:26:59 +02003116 int (*set_bitrate_mask)(struct wiphy *wiphy,
3117 struct net_device *dev,
3118 const u8 *peer,
3119 const struct cfg80211_bitrate_mask *mask);
3120
Holger Schurig61fa7132009-11-11 12:25:40 +01003121 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
3122 int idx, struct survey_info *info);
3123
Samuel Ortiz67fbb162009-11-24 23:59:15 +01003124 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
3125 struct cfg80211_pmksa *pmksa);
3126 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
3127 struct cfg80211_pmksa *pmksa);
3128 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
3129
Jouni Malinen9588bbd2009-12-23 13:15:41 +01003130 int (*remain_on_channel)(struct wiphy *wiphy,
Johannes Berg71bbc992012-06-15 15:30:18 +02003131 struct wireless_dev *wdev,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01003132 struct ieee80211_channel *chan,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01003133 unsigned int duration,
3134 u64 *cookie);
3135 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
Johannes Berg71bbc992012-06-15 15:30:18 +02003136 struct wireless_dev *wdev,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01003137 u64 cookie);
3138
Johannes Berg71bbc992012-06-15 15:30:18 +02003139 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
Andrei Otcheretianskib176e622013-11-18 19:06:49 +02003140 struct cfg80211_mgmt_tx_params *params,
3141 u64 *cookie);
Johannes Bergf7ca38d2010-11-25 10:02:29 +01003142 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
Johannes Berg71bbc992012-06-15 15:30:18 +02003143 struct wireless_dev *wdev,
Johannes Bergf7ca38d2010-11-25 10:02:29 +01003144 u64 cookie);
Jouni Malinen026331c2010-02-15 12:53:10 +02003145
Johannes Bergbc92afd2009-07-01 21:26:57 +02003146 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3147 bool enabled, int timeout);
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02003148
3149 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
3150 struct net_device *dev,
3151 s32 rssi_thold, u32 rssi_hyst);
Johannes Berg271733c2010-10-13 12:06:23 +02003152
Thomas Pedersen84f10702012-07-12 16:17:33 -07003153 int (*set_cqm_txe_config)(struct wiphy *wiphy,
3154 struct net_device *dev,
3155 u32 rate, u32 pkts, u32 intvl);
3156
Johannes Berg271733c2010-10-13 12:06:23 +02003157 void (*mgmt_frame_register)(struct wiphy *wiphy,
Johannes Berg71bbc992012-06-15 15:30:18 +02003158 struct wireless_dev *wdev,
Johannes Berg271733c2010-10-13 12:06:23 +02003159 u16 frame_type, bool reg);
Bruno Randolfafe0cbf2010-11-10 12:50:50 +09003160
3161 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
3162 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
John W. Linville36777132011-03-07 16:17:59 -05003163
Luciano Coelho807f8a82011-05-11 17:09:35 +03003164 int (*sched_scan_start)(struct wiphy *wiphy,
3165 struct net_device *dev,
3166 struct cfg80211_sched_scan_request *request);
Luciano Coelho85a99942011-05-12 16:28:29 +03003167 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
Johannes Berge5497d72011-07-05 16:35:40 +02003168
3169 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
3170 struct cfg80211_gtk_rekey_data *data);
Arik Nemtsov109086c2011-09-28 14:12:50 +03003171
3172 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003173 const u8 *peer, u8 action_code, u8 dialog_token,
Sunil Dutt Undekaridf942e72014-02-20 16:22:09 +05303174 u16 status_code, u32 peer_capability,
Arik Nemtsov31fa97c2014-06-11 17:18:21 +03003175 bool initiator, const u8 *buf, size_t len);
Arik Nemtsov109086c2011-09-28 14:12:50 +03003176 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003177 const u8 *peer, enum nl80211_tdls_operation oper);
Johannes Berg7f6cf312011-11-04 11:18:15 +01003178
3179 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
3180 const u8 *peer, u64 *cookie);
Johannes Berge9998822011-11-09 10:30:21 +01003181
Simon Wunderlich1d9d9212011-11-18 14:20:43 +01003182 int (*set_noack_map)(struct wiphy *wiphy,
3183 struct net_device *dev,
3184 u16 noack_map);
3185
Johannes Berg683b6d32012-11-08 21:25:48 +01003186 int (*get_channel)(struct wiphy *wiphy,
Johannes Berg5b7ccaf2012-07-12 19:45:08 +02003187 struct wireless_dev *wdev,
Johannes Berg683b6d32012-11-08 21:25:48 +01003188 struct cfg80211_chan_def *chandef);
Johannes Berg98104fde2012-06-16 00:19:54 +02003189
3190 int (*start_p2p_device)(struct wiphy *wiphy,
3191 struct wireless_dev *wdev);
3192 void (*stop_p2p_device)(struct wiphy *wiphy,
3193 struct wireless_dev *wdev);
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05303194
3195 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
3196 const struct cfg80211_acl_data *params);
Simon Wunderlich04f39042013-02-08 18:16:19 +01003197
3198 int (*start_radar_detection)(struct wiphy *wiphy,
3199 struct net_device *dev,
Janusz Dziedzic31559f32014-02-21 19:46:13 +01003200 struct cfg80211_chan_def *chandef,
3201 u32 cac_time_ms);
Jouni Malinen355199e2013-02-27 17:14:27 +02003202 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
3203 struct cfg80211_update_ft_ies_params *ftie);
Arend van Spriel5de17982013-04-18 15:49:00 +02003204 int (*crit_proto_start)(struct wiphy *wiphy,
3205 struct wireless_dev *wdev,
3206 enum nl80211_crit_proto_id protocol,
3207 u16 duration);
3208 void (*crit_proto_stop)(struct wiphy *wiphy,
3209 struct wireless_dev *wdev);
Amitkumar Karwarbe29b992013-06-28 11:51:26 -07003210 int (*set_coalesce)(struct wiphy *wiphy,
3211 struct cfg80211_coalesce *coalesce);
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02003212
3213 int (*channel_switch)(struct wiphy *wiphy,
3214 struct net_device *dev,
3215 struct cfg80211_csa_settings *params);
Jouni Malinene16821b2014-04-28 11:22:08 +03003216
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08003217 int (*set_qos_map)(struct wiphy *wiphy,
3218 struct net_device *dev,
3219 struct cfg80211_qos_map *qos_map);
Jouni Malinene16821b2014-04-28 11:22:08 +03003220
3221 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
3222 struct cfg80211_chan_def *chandef);
Johannes Berg960d01a2014-09-09 22:55:35 +03003223
3224 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3225 u8 tsid, const u8 *peer, u8 user_prio,
3226 u16 admitted_time);
3227 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3228 u8 tsid, const u8 *peer);
Arik Nemtsov1057d352014-11-19 12:54:26 +02003229
3230 int (*tdls_channel_switch)(struct wiphy *wiphy,
3231 struct net_device *dev,
3232 const u8 *addr, u8 oper_class,
3233 struct cfg80211_chan_def *chandef);
3234 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
3235 struct net_device *dev,
3236 const u8 *addr);
Ayala Bekercb3b7d82016-09-20 17:31:13 +03003237 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
3238 struct cfg80211_nan_conf *conf);
3239 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
Ayala Bekera442b762016-09-20 17:31:15 +03003240 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3241 struct cfg80211_nan_func *nan_func);
3242 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3243 u64 cookie);
Ayala Bekera5a9dcf2016-09-20 17:31:16 +03003244 int (*nan_change_conf)(struct wiphy *wiphy,
3245 struct wireless_dev *wdev,
3246 struct cfg80211_nan_conf *conf,
3247 u32 changes);
Michael Braund757efc2016-10-10 19:12:22 +02003248
3249 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
3250 struct net_device *dev,
3251 const bool enabled);
Srinivas Dasarid041a1a2018-02-07 18:32:17 +05303252 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
3253 struct cfg80211_external_auth_params *params);
Sunil Dutt6e200822019-04-09 13:09:28 +05303254 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
3255 struct cfg80211_update_owe_info *owe_info);
Johannes Berg704232c2007-04-23 12:20:05 -07003256};
3257
Johannes Bergd3236552009-04-20 14:31:42 +02003258/*
3259 * wireless hardware and networking interfaces structures
3260 * and registration/helper functions
3261 */
3262
3263/**
Johannes Berg5be83de2009-11-19 00:56:28 +01003264 * enum wiphy_flags - wiphy capability flags
3265 *
Johannes Berg5be83de2009-11-19 00:56:28 +01003266 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
3267 * wiphy at all
3268 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
3269 * by default -- this flag will be set depending on the kernel's default
3270 * on wiphy_new(), but can be changed by the driver if it has a good
3271 * reason to override the default
Johannes Berg9bc383d2009-11-19 11:55:19 +01003272 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
3273 * on a VLAN interface)
3274 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
Johannes Bergc0692b82010-08-27 14:26:53 +03003275 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
3276 * control port protocol ethertype. The device also honours the
3277 * control_port_no_encrypt flag.
Johannes Berge31b8212010-10-05 19:39:30 +02003278 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
Javier Cardona15d5dda2011-04-07 15:08:28 -07003279 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
3280 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
Randy Dunlap1ba01452011-05-22 17:16:20 -07003281 * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
Vivek Natarajanf4b34b52011-08-29 14:23:03 +05303282 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
3283 * firmware.
Eliad Pellercedb5412011-08-31 11:29:43 +03003284 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
Arik Nemtsov109086c2011-09-28 14:12:50 +03003285 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
3286 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
3287 * link setup/discovery operations internally. Setup, discovery and
3288 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
3289 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
3290 * used for asking the driver/firmware to perform a TDLS operation.
Johannes Berg562a7482011-11-07 12:39:33 +01003291 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
Johannes Berg5e7602302011-11-04 11:18:17 +01003292 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
3293 * when there are virtual interfaces in AP mode by calling
3294 * cfg80211_report_obss_beacon().
Arik Nemtsov87bbbe22011-11-10 11:28:55 +02003295 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
3296 * responds to probe-requests in hardware.
Johannes Berg7c4ef712011-11-18 15:33:48 +01003297 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
3298 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
Simon Wunderlich2f301ab2013-05-16 13:00:28 +02003299 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02003300 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
3301 * beaconing mode (AP, IBSS, Mesh, ...).
David Spinadelb8676222016-09-22 23:16:50 +03003302 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
3303 * before connection.
Amar Singhalaea474e2014-01-06 14:55:18 -08003304 * @WIPHY_FLAG_DFS_OFFLOAD: The driver handles all the DFS related operations.
Johannes Berg5be83de2009-11-19 00:56:28 +01003305 */
3306enum wiphy_flags {
Johannes Berg723e73a2014-10-22 09:25:06 +02003307 /* use hole at 0 */
Luis R. Rodrigueza2f73b62013-11-11 22:15:29 +01003308 /* use hole at 1 */
3309 /* use hole at 2 */
Johannes Bergc0692b82010-08-27 14:26:53 +03003310 WIPHY_FLAG_NETNS_OK = BIT(3),
3311 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
3312 WIPHY_FLAG_4ADDR_AP = BIT(5),
3313 WIPHY_FLAG_4ADDR_STATION = BIT(6),
3314 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
Jussi Kivilinna309075c2010-11-12 08:53:56 +02003315 WIPHY_FLAG_IBSS_RSN = BIT(8),
Javier Cardona15d5dda2011-04-07 15:08:28 -07003316 WIPHY_FLAG_MESH_AUTH = BIT(10),
Luciano Coelho807f8a82011-05-11 17:09:35 +03003317 WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11),
Johannes Berg8e8b41f2012-03-15 10:16:16 +01003318 /* use hole at 12 */
Vivek Natarajanf4b34b52011-08-29 14:23:03 +05303319 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
Eliad Pellercedb5412011-08-31 11:29:43 +03003320 WIPHY_FLAG_AP_UAPSD = BIT(14),
Arik Nemtsov109086c2011-09-28 14:12:50 +03003321 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
3322 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
Johannes Berg562a7482011-11-07 12:39:33 +01003323 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
Johannes Berg5e7602302011-11-04 11:18:17 +01003324 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
Arik Nemtsov87bbbe22011-11-10 11:28:55 +02003325 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
Johannes Berg7c4ef712011-11-18 15:33:48 +01003326 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
3327 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
Simon Wunderlich2f301ab2013-05-16 13:00:28 +02003328 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02003329 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
David Spinadelb8676222016-09-22 23:16:50 +03003330 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
Amar Singhalaea474e2014-01-06 14:55:18 -08003331 WIPHY_FLAG_DFS_OFFLOAD = BIT(25)
Johannes Berg7527a782011-05-13 10:58:57 +02003332};
3333
3334/**
3335 * struct ieee80211_iface_limit - limit on certain interface types
3336 * @max: maximum number of interfaces of these types
3337 * @types: interface types (bits)
3338 */
3339struct ieee80211_iface_limit {
3340 u16 max;
3341 u16 types;
3342};
3343
3344/**
3345 * struct ieee80211_iface_combination - possible interface combination
3346 * @limits: limits for the given interface types
3347 * @n_limits: number of limitations
3348 * @num_different_channels: can use up to this many different channels
3349 * @max_interfaces: maximum number of interfaces in total allowed in this
3350 * group
3351 * @beacon_int_infra_match: In this combination, the beacon intervals
3352 * between infrastructure and AP types must match. This is required
3353 * only in special cases.
Simon Wunderlich11c4a072013-01-08 14:04:07 +01003354 * @radar_detect_widths: bitmap of channel widths supported for radar detection
Felix Fietkau8c48b502014-05-05 11:48:40 +02003355 * @radar_detect_regions: bitmap of regions supported for radar detection
Purushottam Kushwahac6800ff2016-10-12 18:26:51 +05303356 * @beacon_int_min_gcd: This interface combination supports different
3357 * beacon intervals.
3358 * = 0 - all beacon intervals for different interface must be same.
3359 * > 0 - any beacon interval for the interface part of this combination AND
3360 * *GCD* of all beacon intervals from beaconing interfaces of this
3361 * combination must be greater or equal to this value.
Johannes Berg7527a782011-05-13 10:58:57 +02003362 *
Luciano Coelhob80edbc2014-02-20 16:45:34 +02003363 * With this structure the driver can describe which interface
3364 * combinations it supports concurrently.
Johannes Berg7527a782011-05-13 10:58:57 +02003365 *
Luciano Coelhob80edbc2014-02-20 16:45:34 +02003366 * Examples:
3367 *
3368 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
Johannes Berg7527a782011-05-13 10:58:57 +02003369 *
Johannes Berg819bf592016-10-11 14:56:53 +02003370 * .. code-block:: c
3371 *
3372 * struct ieee80211_iface_limit limits1[] = {
3373 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
3374 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
3375 * };
3376 * struct ieee80211_iface_combination combination1 = {
3377 * .limits = limits1,
3378 * .n_limits = ARRAY_SIZE(limits1),
3379 * .max_interfaces = 2,
3380 * .beacon_int_infra_match = true,
3381 * };
Johannes Berg7527a782011-05-13 10:58:57 +02003382 *
3383 *
Luciano Coelhob80edbc2014-02-20 16:45:34 +02003384 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
Johannes Berg7527a782011-05-13 10:58:57 +02003385 *
Johannes Berg819bf592016-10-11 14:56:53 +02003386 * .. code-block:: c
3387 *
3388 * struct ieee80211_iface_limit limits2[] = {
3389 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
3390 * BIT(NL80211_IFTYPE_P2P_GO), },
3391 * };
3392 * struct ieee80211_iface_combination combination2 = {
3393 * .limits = limits2,
3394 * .n_limits = ARRAY_SIZE(limits2),
3395 * .max_interfaces = 8,
3396 * .num_different_channels = 1,
3397 * };
Johannes Berg7527a782011-05-13 10:58:57 +02003398 *
3399 *
Luciano Coelhob80edbc2014-02-20 16:45:34 +02003400 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
3401 *
Johannes Berg819bf592016-10-11 14:56:53 +02003402 * This allows for an infrastructure connection and three P2P connections.
Johannes Berg7527a782011-05-13 10:58:57 +02003403 *
Johannes Berg819bf592016-10-11 14:56:53 +02003404 * .. code-block:: c
3405 *
3406 * struct ieee80211_iface_limit limits3[] = {
3407 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
3408 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
3409 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
3410 * };
3411 * struct ieee80211_iface_combination combination3 = {
3412 * .limits = limits3,
3413 * .n_limits = ARRAY_SIZE(limits3),
3414 * .max_interfaces = 4,
3415 * .num_different_channels = 2,
3416 * };
3417 *
Johannes Berg7527a782011-05-13 10:58:57 +02003418 */
3419struct ieee80211_iface_combination {
3420 const struct ieee80211_iface_limit *limits;
3421 u32 num_different_channels;
3422 u16 max_interfaces;
3423 u8 n_limits;
3424 bool beacon_int_infra_match;
Simon Wunderlich11c4a072013-01-08 14:04:07 +01003425 u8 radar_detect_widths;
Felix Fietkau8c48b502014-05-05 11:48:40 +02003426 u8 radar_detect_regions;
Purushottam Kushwahac6800ff2016-10-12 18:26:51 +05303427 u32 beacon_int_min_gcd;
Johannes Berg5be83de2009-11-19 00:56:28 +01003428};
3429
Johannes Berg2e161f72010-08-12 15:38:38 +02003430struct ieee80211_txrx_stypes {
3431 u16 tx, rx;
3432};
3433
Johannes Berg5be83de2009-11-19 00:56:28 +01003434/**
Johannes Bergff1b6e62011-05-04 15:37:28 +02003435 * enum wiphy_wowlan_support_flags - WoWLAN support flags
3436 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
3437 * trigger that keeps the device operating as-is and
3438 * wakes up the host on any activity, for example a
3439 * received packet that passed filtering; note that the
3440 * packet should be preserved in that case
3441 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
3442 * (see nl80211.h)
3443 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
Johannes Berg77dbbb12011-07-13 10:48:55 +02003444 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
3445 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
3446 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
3447 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
3448 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
Luciano Coelho8cd4d452014-09-17 11:55:28 +03003449 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
Johannes Bergff1b6e62011-05-04 15:37:28 +02003450 */
3451enum wiphy_wowlan_support_flags {
Johannes Berg77dbbb12011-07-13 10:48:55 +02003452 WIPHY_WOWLAN_ANY = BIT(0),
3453 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
3454 WIPHY_WOWLAN_DISCONNECT = BIT(2),
3455 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
3456 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
3457 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
3458 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
3459 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
Luciano Coelho8cd4d452014-09-17 11:55:28 +03003460 WIPHY_WOWLAN_NET_DETECT = BIT(8),
Johannes Bergff1b6e62011-05-04 15:37:28 +02003461};
3462
Johannes Berg2a0e0472013-01-23 22:57:40 +01003463struct wiphy_wowlan_tcp_support {
3464 const struct nl80211_wowlan_tcp_data_token_feature *tok;
3465 u32 data_payload_max;
3466 u32 data_interval_max;
3467 u32 wake_payload_max;
3468 bool seq;
3469};
3470
Johannes Bergff1b6e62011-05-04 15:37:28 +02003471/**
3472 * struct wiphy_wowlan_support - WoWLAN support data
3473 * @flags: see &enum wiphy_wowlan_support_flags
3474 * @n_patterns: number of supported wakeup patterns
3475 * (see nl80211.h for the pattern definition)
3476 * @pattern_max_len: maximum length of each pattern
3477 * @pattern_min_len: minimum length of each pattern
Amitkumar Karwarbb92d192013-02-12 12:16:26 -08003478 * @max_pkt_offset: maximum Rx packet offset
Luciano Coelho8cd4d452014-09-17 11:55:28 +03003479 * @max_nd_match_sets: maximum number of matchsets for net-detect,
3480 * similar, but not necessarily identical, to max_match_sets for
3481 * scheduled scans.
3482 * See &struct cfg80211_sched_scan_request.@match_sets for more
3483 * details.
Johannes Berg2a0e0472013-01-23 22:57:40 +01003484 * @tcp: TCP wakeup support information
Johannes Bergff1b6e62011-05-04 15:37:28 +02003485 */
3486struct wiphy_wowlan_support {
3487 u32 flags;
3488 int n_patterns;
3489 int pattern_max_len;
3490 int pattern_min_len;
Amitkumar Karwarbb92d192013-02-12 12:16:26 -08003491 int max_pkt_offset;
Luciano Coelho8cd4d452014-09-17 11:55:28 +03003492 int max_nd_match_sets;
Johannes Berg2a0e0472013-01-23 22:57:40 +01003493 const struct wiphy_wowlan_tcp_support *tcp;
Johannes Bergff1b6e62011-05-04 15:37:28 +02003494};
3495
3496/**
Amitkumar Karwarbe29b992013-06-28 11:51:26 -07003497 * struct wiphy_coalesce_support - coalesce support data
3498 * @n_rules: maximum number of coalesce rules
3499 * @max_delay: maximum supported coalescing delay in msecs
3500 * @n_patterns: number of supported patterns in a rule
3501 * (see nl80211.h for the pattern definition)
3502 * @pattern_max_len: maximum length of each pattern
3503 * @pattern_min_len: minimum length of each pattern
3504 * @max_pkt_offset: maximum Rx packet offset
3505 */
3506struct wiphy_coalesce_support {
3507 int n_rules;
3508 int max_delay;
3509 int n_patterns;
3510 int pattern_max_len;
3511 int pattern_min_len;
3512 int max_pkt_offset;
3513};
3514
3515/**
Johannes Bergad7e7182013-11-13 13:37:47 +01003516 * enum wiphy_vendor_command_flags - validation flags for vendor commands
3517 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
3518 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
3519 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
3520 * (must be combined with %_WDEV or %_NETDEV)
3521 */
3522enum wiphy_vendor_command_flags {
3523 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
3524 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
3525 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
3526};
3527
3528/**
3529 * struct wiphy_vendor_command - vendor command definition
3530 * @info: vendor command identifying information, as used in nl80211
3531 * @flags: flags, see &enum wiphy_vendor_command_flags
3532 * @doit: callback for the operation, note that wdev is %NULL if the
3533 * flags didn't ask for a wdev and non-%NULL otherwise; the data
3534 * pointer may be %NULL if userspace provided no data at all
Johannes Berg7bdbe402015-08-15 22:39:49 +03003535 * @dumpit: dump callback, for transferring bigger/multiple items. The
3536 * @storage points to cb->args[5], ie. is preserved over the multiple
3537 * dumpit calls.
3538 * It's recommended to not have the same sub command with both @doit and
3539 * @dumpit, so that userspace can assume certain ones are get and others
3540 * are used with dump requests.
Johannes Bergad7e7182013-11-13 13:37:47 +01003541 */
3542struct wiphy_vendor_command {
3543 struct nl80211_vendor_cmd_info info;
3544 u32 flags;
3545 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
3546 const void *data, int data_len);
Johannes Berg7bdbe402015-08-15 22:39:49 +03003547 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
3548 struct sk_buff *skb, const void *data, int data_len,
3549 unsigned long *storage);
Johannes Bergad7e7182013-11-13 13:37:47 +01003550};
3551
3552/**
Kanchanapally, Vidyullatha019ae3a2016-05-16 10:41:04 +05303553 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
3554 * @iftype: interface type
3555 * @extended_capabilities: extended capabilities supported by the driver,
3556 * additional capabilities might be supported by userspace; these are the
3557 * 802.11 extended capabilities ("Extended Capabilities element") and are
3558 * in the same format as in the information element. See IEEE Std
3559 * 802.11-2012 8.4.2.29 for the defined fields.
3560 * @extended_capabilities_mask: mask of the valid values
3561 * @extended_capabilities_len: length of the extended capabilities
3562 */
3563struct wiphy_iftype_ext_capab {
3564 enum nl80211_iftype iftype;
3565 const u8 *extended_capabilities;
3566 const u8 *extended_capabilities_mask;
3567 u8 extended_capabilities_len;
3568};
3569
3570/**
Veerendranath Jakkam4db91792020-02-29 23:00:13 +05303571 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
3572 * suites for interface types defined in @iftypes_mask. Each type in the
3573 * @iftypes_mask must be unique across all instances of iftype_akm_suites.
3574 *
3575 * @iftypes_mask: bitmask of interfaces types
3576 * @akm_suites: points to an array of supported akm suites
3577 * @n_akm_suites: number of supported AKM suites
3578 */
3579struct wiphy_iftype_akm_suites {
3580 u16 iftypes_mask;
3581 const u32 *akm_suites;
3582 int n_akm_suites;
3583};
3584
3585/**
Johannes Berg5be83de2009-11-19 00:56:28 +01003586 * struct wiphy - wireless hardware description
Luis R. Rodriguez2784fe92010-12-15 19:24:11 -08003587 * @reg_notifier: the driver's regulatory notification callback,
3588 * note that if your driver uses wiphy_apply_custom_regulatory()
3589 * the reg_notifier's request can be passed as NULL
Johannes Bergd3236552009-04-20 14:31:42 +02003590 * @regd: the driver's regulatory domain, if one was requested via
3591 * the regulatory_hint() API. This can be used by the driver
3592 * on the reg_notifier() if it chooses to ignore future
3593 * regulatory domain changes caused by other drivers.
3594 * @signal_type: signal type reported in &struct cfg80211_bss.
3595 * @cipher_suites: supported cipher suites
3596 * @n_cipher_suites: number of supported cipher suites
Veerendranath Jakkam4db91792020-02-29 23:00:13 +05303597 * @iftype_akm_suites: array of supported akm suites info per interface type.
3598 * Note that the bits in @iftypes_mask inside this structure cannot
3599 * overlap (i.e. only one occurrence of each type is allowed across all
3600 * instances of iftype_akm_suites).
3601 * @num_iftype_akm_suites: number of interface types for which supported akm
3602 * suites are specified separately.
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02003603 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
3604 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
3605 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
3606 * -1 = fragmentation disabled, only odd values >= 256 used
3607 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
Johannes Bergabe37c42010-06-07 11:12:27 +02003608 * @_net: the network namespace this wiphy currently lives in
Johannes Bergef15aac2010-01-20 12:02:33 +01003609 * @perm_addr: permanent MAC address of this device
3610 * @addr_mask: If the device supports multiple MAC addresses by masking,
3611 * set this to a mask with variable bits set to 1, e.g. if the last
Luciano Coelho0fcf8ac2014-02-20 16:45:33 +02003612 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
Johannes Bergef15aac2010-01-20 12:02:33 +01003613 * variable bits shall be determined by the interfaces added, with
3614 * interfaces not matching the mask being rejected to be brought up.
3615 * @n_addresses: number of addresses in @addresses.
3616 * @addresses: If the device has more than one address, set this pointer
3617 * to a list of addresses (6 bytes each). The first one will be used
3618 * by default for perm_addr. In this case, the mask should be set to
3619 * all-zeroes. In this case it is assumed that the device can handle
3620 * the same number of arbitrary MAC addresses.
Randy Dunlapfd235912011-09-08 10:16:50 -07003621 * @registered: protects ->resume and ->suspend sysfs callbacks against
3622 * unregister hardware
Johannes Bergabe37c42010-06-07 11:12:27 +02003623 * @debugfsdir: debugfs directory used for this wiphy, will be renamed
3624 * automatically on wiphy renames
3625 * @dev: (virtual) struct device for this wiphy
Stanislaw Gruszka4a711a82011-08-25 17:07:24 +02003626 * @registered: helps synchronize suspend/resume with wiphy unregister
Johannes Bergabe37c42010-06-07 11:12:27 +02003627 * @wext: wireless extension handlers
3628 * @priv: driver private data (sized according to wiphy_new() parameter)
3629 * @interface_modes: bitmask of interfaces types valid for this wiphy,
3630 * must be set by driver
Johannes Berg7527a782011-05-13 10:58:57 +02003631 * @iface_combinations: Valid interface combinations array, should not
3632 * list single interface types.
3633 * @n_iface_combinations: number of entries in @iface_combinations array.
3634 * @software_iftypes: bitmask of software interface types, these are not
3635 * subject to any restrictions since they are purely managed in SW.
Johannes Bergabe37c42010-06-07 11:12:27 +02003636 * @flags: wiphy flags, see &enum wiphy_flags
Luis R. Rodrigueza2f73b62013-11-11 22:15:29 +01003637 * @regulatory_flags: wiphy regulatory flags, see
3638 * &enum ieee80211_regulatory_flags
Johannes Berg1f074bd2011-11-06 14:13:33 +01003639 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
Gautam Kumar Shuklad75bb062014-12-23 16:55:19 +01003640 * @ext_features: extended features advertised to nl80211, see
3641 * &enum nl80211_ext_feature_index.
Johannes Bergabe37c42010-06-07 11:12:27 +02003642 * @bss_priv_size: each BSS struct has private data allocated with it,
3643 * this variable determines its size
3644 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
3645 * any given scan
Luciano Coelho93b6aa62011-07-13 14:57:28 +03003646 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
3647 * for in any given scheduled scan
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03003648 * @max_match_sets: maximum number of match sets the device can handle
3649 * when performing a scheduled scan, 0 if filtering is not
3650 * supported.
Johannes Bergabe37c42010-06-07 11:12:27 +02003651 * @max_scan_ie_len: maximum length of user-controlled IEs device can
3652 * add to probe request frames transmitted during a scan, must not
3653 * include fixed IEs like supported rates
Luciano Coelho5a865ba2011-07-13 14:57:29 +03003654 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
3655 * scans
Avraham Stern3b06d272015-10-12 09:51:34 +03003656 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
3657 * of iterations) for scheduled scan supported by the device.
3658 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
3659 * single scan plan supported by the device.
3660 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
3661 * scan plan supported by the device.
Johannes Bergabe37c42010-06-07 11:12:27 +02003662 * @coverage_class: current coverage class
3663 * @fw_version: firmware version for ethtool reporting
3664 * @hw_version: hardware version for ethtool reporting
3665 * @max_num_pmkids: maximum number of PMKIDs supported by device
3666 * @privid: a pointer that drivers can use to identify if an arbitrary
3667 * wiphy is theirs, e.g. in global notifiers
3668 * @bands: information about bands/channels supported by this device
Johannes Berg2e161f72010-08-12 15:38:38 +02003669 *
3670 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
3671 * transmitted through nl80211, points to an array indexed by interface
3672 * type
Bruno Randolfa7ffac92010-12-08 13:59:24 +09003673 *
Bruno Randolf7f531e02010-12-16 11:30:22 +09003674 * @available_antennas_tx: bitmap of antennas which are available to be
3675 * configured as TX antennas. Antenna configuration commands will be
3676 * rejected unless this or @available_antennas_rx is set.
3677 *
3678 * @available_antennas_rx: bitmap of antennas which are available to be
3679 * configured as RX antennas. Antenna configuration commands will be
3680 * rejected unless this or @available_antennas_tx is set.
Johannes Berga2939112010-12-14 17:54:28 +01003681 *
Randy Dunlap15f0ebc2012-01-21 11:03:00 -08003682 * @probe_resp_offload:
3683 * Bitmap of supported protocols for probe response offloading.
3684 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
3685 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
3686 *
Johannes Berga2939112010-12-14 17:54:28 +01003687 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
3688 * may request, if implemented.
Johannes Bergff1b6e62011-05-04 15:37:28 +02003689 *
3690 * @wowlan: WoWLAN support information
Johannes Berg6abb9cb2013-05-15 09:30:07 +02003691 * @wowlan_config: current WoWLAN configuration; this should usually not be
3692 * used since access to it is necessarily racy, use the parameter passed
3693 * to the suspend() operation instead.
Johannes Berg562a7482011-11-07 12:39:33 +01003694 *
3695 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
Ben Greear7e7c8922011-11-18 11:31:59 -08003696 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
3697 * If null, then none can be over-ridden.
Johannes Bergee2aca32013-02-21 17:36:01 +01003698 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
3699 * If null, then none can be over-ridden.
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05303700 *
Johannes Berg53873f12016-05-03 16:52:04 +03003701 * @wdev_list: the list of associated (virtual) interfaces; this list must
3702 * not be modified by the driver, but can be read with RTNL/RCU protection.
3703 *
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05303704 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
3705 * supports for ACL.
Johannes Berga50df0c2013-02-11 14:20:05 +01003706 *
3707 * @extended_capabilities: extended capabilities supported by the driver,
3708 * additional capabilities might be supported by userspace; these are
3709 * the 802.11 extended capabilities ("Extended Capabilities element")
3710 * and are in the same format as in the information element. See
Kanchanapally, Vidyullatha019ae3a2016-05-16 10:41:04 +05303711 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
3712 * extended capabilities to be used if the capabilities are not specified
3713 * for a specific interface type in iftype_ext_capab.
Johannes Berga50df0c2013-02-11 14:20:05 +01003714 * @extended_capabilities_mask: mask of the valid values
3715 * @extended_capabilities_len: length of the extended capabilities
Kanchanapally, Vidyullatha019ae3a2016-05-16 10:41:04 +05303716 * @iftype_ext_capab: array of extended capabilities per interface type
3717 * @num_iftype_ext_capab: number of interface types for which extended
3718 * capabilities are specified separately.
Amitkumar Karwarbe29b992013-06-28 11:51:26 -07003719 * @coalesce: packet coalescing support information
Johannes Bergad7e7182013-11-13 13:37:47 +01003720 *
3721 * @vendor_commands: array of vendor commands supported by the hardware
3722 * @n_vendor_commands: number of vendor commands
Johannes Berg567ffc32013-12-18 14:43:31 +01003723 * @vendor_events: array of vendor events supported by the hardware
3724 * @n_vendor_events: number of vendor events
Jouni Malinenb43504c2014-01-15 00:01:08 +02003725 *
3726 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
3727 * (including P2P GO) or 0 to indicate no such limit is advertised. The
3728 * driver is allowed to advertise a theoretical limit that it can reach in
3729 * some cases, but may not always reach.
Luciano Coelhoc2e43232014-05-15 20:18:09 +03003730 *
3731 * @max_num_csa_counters: Number of supported csa_counters in beacons
3732 * and probe responses. This value should be set if the driver
3733 * wishes to limit the number of csa counters. Default (0) means
3734 * infinite.
Emmanuel Grumbach67af9812014-05-18 10:15:24 +03003735 * @max_adj_channel_rssi_comp: max offset of between the channel on which the
3736 * frame was sent and the channel on which the frame was heard for which
3737 * the reported rssi is still valid. If a driver is able to compensate the
3738 * low rssi when a frame is heard on different channel, then it should set
3739 * this variable to the maximal offset for which it can compensate.
3740 * This value should be set in MHz.
Arend van Spriel38de03d2016-03-02 20:37:18 +01003741 * @bss_select_support: bitmask indicating the BSS selection criteria supported
3742 * by the driver in the .connect() callback. The bit position maps to the
3743 * attribute indices defined in &enum nl80211_bss_select_attr.
Ayala Bekera442b762016-09-20 17:31:15 +03003744 *
3745 * @cookie_counter: unique generic cookie counter, used to identify objects.
Johannes Bergd3236552009-04-20 14:31:42 +02003746 */
3747struct wiphy {
3748 /* assign these fields before you register the wiphy */
3749
Johannes Bergef15aac2010-01-20 12:02:33 +01003750 /* permanent MAC address(es) */
Johannes Bergd3236552009-04-20 14:31:42 +02003751 u8 perm_addr[ETH_ALEN];
Johannes Bergef15aac2010-01-20 12:02:33 +01003752 u8 addr_mask[ETH_ALEN];
3753
Johannes Bergef15aac2010-01-20 12:02:33 +01003754 struct mac_address *addresses;
Johannes Bergd3236552009-04-20 14:31:42 +02003755
Johannes Berg2e161f72010-08-12 15:38:38 +02003756 const struct ieee80211_txrx_stypes *mgmt_stypes;
3757
Johannes Berg7527a782011-05-13 10:58:57 +02003758 const struct ieee80211_iface_combination *iface_combinations;
3759 int n_iface_combinations;
3760 u16 software_iftypes;
3761
Johannes Berg2e161f72010-08-12 15:38:38 +02003762 u16 n_addresses;
3763
Johannes Bergd3236552009-04-20 14:31:42 +02003764 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
3765 u16 interface_modes;
3766
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05303767 u16 max_acl_mac_addrs;
3768
Luis R. Rodrigueza2f73b62013-11-11 22:15:29 +01003769 u32 flags, regulatory_flags, features;
Gautam Kumar Shuklad75bb062014-12-23 16:55:19 +01003770 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
Johannes Berg463d0182009-07-14 00:33:35 +02003771
Johannes Berg562a7482011-11-07 12:39:33 +01003772 u32 ap_sme_capa;
3773
Johannes Bergd3236552009-04-20 14:31:42 +02003774 enum cfg80211_signal_type signal_type;
3775
3776 int bss_priv_size;
3777 u8 max_scan_ssids;
Luciano Coelho93b6aa62011-07-13 14:57:28 +03003778 u8 max_sched_scan_ssids;
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03003779 u8 max_match_sets;
Johannes Bergd3236552009-04-20 14:31:42 +02003780 u16 max_scan_ie_len;
Luciano Coelho5a865ba2011-07-13 14:57:29 +03003781 u16 max_sched_scan_ie_len;
Avraham Stern3b06d272015-10-12 09:51:34 +03003782 u32 max_sched_scan_plans;
3783 u32 max_sched_scan_plan_interval;
3784 u32 max_sched_scan_plan_iterations;
Johannes Bergd3236552009-04-20 14:31:42 +02003785
3786 int n_cipher_suites;
3787 const u32 *cipher_suites;
3788
Veerendranath Jakkam4db91792020-02-29 23:00:13 +05303789 const struct wiphy_iftype_akm_suites *iftype_akm_suites;
3790 unsigned int num_iftype_akm_suites;
3791
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02003792 u8 retry_short;
3793 u8 retry_long;
3794 u32 frag_threshold;
3795 u32 rts_threshold;
Lukáš Turek81077e82009-12-21 22:50:47 +01003796 u8 coverage_class;
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02003797
Jiri Pirko81135542013-01-06 02:12:51 +00003798 char fw_version[ETHTOOL_FWVERS_LEN];
Kalle Valodfce95f2009-09-24 11:02:42 -07003799 u32 hw_version;
3800
Johannes Bergdfb89c52012-06-27 09:23:48 +02003801#ifdef CONFIG_PM
Johannes Berg964dc9e2013-06-03 17:25:34 +02003802 const struct wiphy_wowlan_support *wowlan;
Johannes Berg6abb9cb2013-05-15 09:30:07 +02003803 struct cfg80211_wowlan *wowlan_config;
Johannes Bergdfb89c52012-06-27 09:23:48 +02003804#endif
Johannes Bergff1b6e62011-05-04 15:37:28 +02003805
Johannes Berga2939112010-12-14 17:54:28 +01003806 u16 max_remain_on_channel_duration;
3807
Samuel Ortiz67fbb162009-11-24 23:59:15 +01003808 u8 max_num_pmkids;
3809
Bruno Randolf7f531e02010-12-16 11:30:22 +09003810 u32 available_antennas_tx;
3811 u32 available_antennas_rx;
Bruno Randolfa7ffac92010-12-08 13:59:24 +09003812
Arik Nemtsov87bbbe22011-11-10 11:28:55 +02003813 /*
3814 * Bitmap of supported protocols for probe response offloading
3815 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
3816 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
3817 */
3818 u32 probe_resp_offload;
3819
Johannes Berga50df0c2013-02-11 14:20:05 +01003820 const u8 *extended_capabilities, *extended_capabilities_mask;
3821 u8 extended_capabilities_len;
3822
Kanchanapally, Vidyullatha019ae3a2016-05-16 10:41:04 +05303823 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
3824 unsigned int num_iftype_ext_capab;
3825
Johannes Bergd3236552009-04-20 14:31:42 +02003826 /* If multiple wiphys are registered and you're handed e.g.
3827 * a regular netdev with assigned ieee80211_ptr, you won't
3828 * know whether it points to a wiphy your driver has registered
3829 * or not. Assign this to something global to your driver to
3830 * help determine whether you own this wiphy or not. */
David Kilroycf5aa2f2009-05-16 23:13:47 +01003831 const void *privid;
Johannes Bergd3236552009-04-20 14:31:42 +02003832
Johannes Berg57fbcce2016-04-12 15:56:15 +02003833 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
Johannes Bergd3236552009-04-20 14:31:42 +02003834
3835 /* Lets us get back the wiphy on the callback */
Luis R. Rodriguez0c0280b2013-01-11 18:39:36 +00003836 void (*reg_notifier)(struct wiphy *wiphy,
3837 struct regulatory_request *request);
Johannes Bergd3236552009-04-20 14:31:42 +02003838
3839 /* fields below are read-only, assigned by cfg80211 */
3840
Johannes Berg458f4f92012-12-06 15:47:38 +01003841 const struct ieee80211_regdomain __rcu *regd;
Johannes Bergd3236552009-04-20 14:31:42 +02003842
3843 /* the item in /sys/class/ieee80211/ points to this,
3844 * you need use set_wiphy_dev() (see below) */
3845 struct device dev;
3846
Stanislaw Gruszkaecb44332011-08-12 14:00:59 +02003847 /* protects ->resume, ->suspend sysfs callbacks against unregister hw */
3848 bool registered;
3849
Johannes Bergd3236552009-04-20 14:31:42 +02003850 /* dir in debugfs: ieee80211/<wiphyname> */
3851 struct dentry *debugfsdir;
3852
Ben Greear7e7c8922011-11-18 11:31:59 -08003853 const struct ieee80211_ht_cap *ht_capa_mod_mask;
Johannes Bergee2aca32013-02-21 17:36:01 +01003854 const struct ieee80211_vht_cap *vht_capa_mod_mask;
Ben Greear7e7c8922011-11-18 11:31:59 -08003855
Johannes Berg53873f12016-05-03 16:52:04 +03003856 struct list_head wdev_list;
3857
Johannes Berg463d0182009-07-14 00:33:35 +02003858 /* the network namespace this phy lives in currently */
Eric W. Biederman0c5c9fb2015-03-11 23:06:44 -05003859 possible_net_t _net;
Johannes Berg463d0182009-07-14 00:33:35 +02003860
Johannes Berg3d23e342009-09-29 23:27:28 +02003861#ifdef CONFIG_CFG80211_WEXT
3862 const struct iw_handler_def *wext;
3863#endif
3864
Amitkumar Karwarbe29b992013-06-28 11:51:26 -07003865 const struct wiphy_coalesce_support *coalesce;
3866
Johannes Bergad7e7182013-11-13 13:37:47 +01003867 const struct wiphy_vendor_command *vendor_commands;
Johannes Berg567ffc32013-12-18 14:43:31 +01003868 const struct nl80211_vendor_cmd_info *vendor_events;
3869 int n_vendor_commands, n_vendor_events;
Johannes Bergad7e7182013-11-13 13:37:47 +01003870
Jouni Malinenb43504c2014-01-15 00:01:08 +02003871 u16 max_ap_assoc_sta;
3872
Andrei Otcheretianski9a774c72014-05-09 14:11:46 +03003873 u8 max_num_csa_counters;
Emmanuel Grumbach67af9812014-05-18 10:15:24 +03003874 u8 max_adj_channel_rssi_comp;
Andrei Otcheretianski9a774c72014-05-09 14:11:46 +03003875
Arend van Spriel38de03d2016-03-02 20:37:18 +01003876 u32 bss_select_support;
3877
Ayala Bekera442b762016-09-20 17:31:15 +03003878 u64 cookie_counter;
3879
Johannes Berg1c06ef92012-12-28 12:22:02 +01003880 char priv[0] __aligned(NETDEV_ALIGN);
Johannes Bergd3236552009-04-20 14:31:42 +02003881};
3882
Johannes Berg463d0182009-07-14 00:33:35 +02003883static inline struct net *wiphy_net(struct wiphy *wiphy)
3884{
Eric Dumazetc2d9ba92010-06-01 06:51:19 +00003885 return read_pnet(&wiphy->_net);
Johannes Berg463d0182009-07-14 00:33:35 +02003886}
3887
3888static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
3889{
Eric Dumazetc2d9ba92010-06-01 06:51:19 +00003890 write_pnet(&wiphy->_net, net);
Johannes Berg463d0182009-07-14 00:33:35 +02003891}
Johannes Berg463d0182009-07-14 00:33:35 +02003892
Johannes Bergd3236552009-04-20 14:31:42 +02003893/**
3894 * wiphy_priv - return priv from wiphy
3895 *
3896 * @wiphy: the wiphy whose priv pointer to return
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01003897 * Return: The priv of @wiphy.
Johannes Bergd3236552009-04-20 14:31:42 +02003898 */
3899static inline void *wiphy_priv(struct wiphy *wiphy)
3900{
3901 BUG_ON(!wiphy);
3902 return &wiphy->priv;
3903}
3904
3905/**
David Kilroyf1f74822009-06-18 23:21:13 +01003906 * priv_to_wiphy - return the wiphy containing the priv
3907 *
3908 * @priv: a pointer previously returned by wiphy_priv
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01003909 * Return: The wiphy of @priv.
David Kilroyf1f74822009-06-18 23:21:13 +01003910 */
3911static inline struct wiphy *priv_to_wiphy(void *priv)
3912{
3913 BUG_ON(!priv);
3914 return container_of(priv, struct wiphy, priv);
3915}
3916
3917/**
Johannes Bergd3236552009-04-20 14:31:42 +02003918 * set_wiphy_dev - set device pointer for wiphy
3919 *
3920 * @wiphy: The wiphy whose device to bind
3921 * @dev: The device to parent it to
3922 */
3923static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
3924{
3925 wiphy->dev.parent = dev;
3926}
3927
3928/**
3929 * wiphy_dev - get wiphy dev pointer
3930 *
3931 * @wiphy: The wiphy whose device struct to look up
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01003932 * Return: The dev of @wiphy.
Johannes Bergd3236552009-04-20 14:31:42 +02003933 */
3934static inline struct device *wiphy_dev(struct wiphy *wiphy)
3935{
3936 return wiphy->dev.parent;
3937}
3938
3939/**
3940 * wiphy_name - get wiphy name
3941 *
3942 * @wiphy: The wiphy whose name to return
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01003943 * Return: The name of @wiphy.
Johannes Bergd3236552009-04-20 14:31:42 +02003944 */
Joe Perchese1db74f2010-07-26 14:39:57 -07003945static inline const char *wiphy_name(const struct wiphy *wiphy)
Johannes Bergd3236552009-04-20 14:31:42 +02003946{
3947 return dev_name(&wiphy->dev);
3948}
3949
3950/**
Ben Greear1998d902014-10-22 12:23:00 -07003951 * wiphy_new_nm - create a new wiphy for use with cfg80211
3952 *
3953 * @ops: The configuration operations for this device
3954 * @sizeof_priv: The size of the private area to allocate
3955 * @requested_name: Request a particular name.
3956 * NULL is valid value, and means use the default phy%d naming.
3957 *
3958 * Create a new wiphy and associate the given operations with it.
3959 * @sizeof_priv bytes are allocated for private use.
3960 *
3961 * Return: A pointer to the new wiphy. This pointer must be
3962 * assigned to each netdev's ieee80211_ptr for proper operation.
3963 */
3964struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
3965 const char *requested_name);
3966
3967/**
Johannes Bergd3236552009-04-20 14:31:42 +02003968 * wiphy_new - create a new wiphy for use with cfg80211
3969 *
3970 * @ops: The configuration operations for this device
3971 * @sizeof_priv: The size of the private area to allocate
3972 *
3973 * Create a new wiphy and associate the given operations with it.
3974 * @sizeof_priv bytes are allocated for private use.
3975 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01003976 * Return: A pointer to the new wiphy. This pointer must be
3977 * assigned to each netdev's ieee80211_ptr for proper operation.
Johannes Bergd3236552009-04-20 14:31:42 +02003978 */
Ben Greear1998d902014-10-22 12:23:00 -07003979static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
3980 int sizeof_priv)
3981{
3982 return wiphy_new_nm(ops, sizeof_priv, NULL);
3983}
Johannes Bergd3236552009-04-20 14:31:42 +02003984
3985/**
3986 * wiphy_register - register a wiphy with cfg80211
3987 *
3988 * @wiphy: The wiphy to register.
3989 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01003990 * Return: A non-negative wiphy index or a negative error code.
Johannes Bergd3236552009-04-20 14:31:42 +02003991 */
Joe Perches10dd9b72013-07-31 17:31:37 -07003992int wiphy_register(struct wiphy *wiphy);
Johannes Bergd3236552009-04-20 14:31:42 +02003993
3994/**
3995 * wiphy_unregister - deregister a wiphy from cfg80211
3996 *
3997 * @wiphy: The wiphy to unregister.
3998 *
3999 * After this call, no more requests can be made with this priv
4000 * pointer, but the call may sleep to wait for an outstanding
4001 * request that is being handled.
4002 */
Joe Perches10dd9b72013-07-31 17:31:37 -07004003void wiphy_unregister(struct wiphy *wiphy);
Johannes Bergd3236552009-04-20 14:31:42 +02004004
4005/**
4006 * wiphy_free - free wiphy
4007 *
4008 * @wiphy: The wiphy to free
4009 */
Joe Perches10dd9b72013-07-31 17:31:37 -07004010void wiphy_free(struct wiphy *wiphy);
Johannes Bergd3236552009-04-20 14:31:42 +02004011
Johannes Bergfffd0932009-07-08 14:22:54 +02004012/* internal structs */
Johannes Berg6829c872009-07-02 09:13:27 +02004013struct cfg80211_conn;
Johannes Berg19957bb2009-07-02 17:20:43 +02004014struct cfg80211_internal_bss;
Johannes Bergfffd0932009-07-08 14:22:54 +02004015struct cfg80211_cached_keys;
Johannes Berg19957bb2009-07-02 17:20:43 +02004016
Johannes Bergd3236552009-04-20 14:31:42 +02004017/**
Johannes Berg89a54e42012-06-15 14:33:17 +02004018 * struct wireless_dev - wireless device state
Johannes Bergd3236552009-04-20 14:31:42 +02004019 *
Johannes Berg89a54e42012-06-15 14:33:17 +02004020 * For netdevs, this structure must be allocated by the driver
4021 * that uses the ieee80211_ptr field in struct net_device (this
4022 * is intentional so it can be allocated along with the netdev.)
4023 * It need not be registered then as netdev registration will
4024 * be intercepted by cfg80211 to see the new wireless device.
4025 *
4026 * For non-netdev uses, it must also be allocated by the driver
4027 * in response to the cfg80211 callbacks that require it, as
4028 * there's no netdev registration in that case it may not be
4029 * allocated outside of callback operations that return it.
Johannes Bergd3236552009-04-20 14:31:42 +02004030 *
4031 * @wiphy: pointer to hardware description
4032 * @iftype: interface type
4033 * @list: (private) Used to collect the interfaces
Johannes Berg89a54e42012-06-15 14:33:17 +02004034 * @netdev: (private) Used to reference back to the netdev, may be %NULL
4035 * @identifier: (private) Identifier used in nl80211 to identify this
4036 * wireless device if it has no netdev
Johannes Bergd3236552009-04-20 14:31:42 +02004037 * @current_bss: (private) Used by the internal configuration code
Michal Kazior9e0e2962014-01-29 14:22:27 +01004038 * @chandef: (private) Used by the internal configuration code to track
4039 * the user-set channel definition.
Johannes Berg780b40d2013-06-05 09:32:50 +02004040 * @preset_chandef: (private) Used by the internal configuration code to
Johannes Bergaa430da2012-05-16 23:50:18 +02004041 * track the channel to be used for AP later
Johannes Bergd3236552009-04-20 14:31:42 +02004042 * @bssid: (private) Used by the internal configuration code
4043 * @ssid: (private) Used by the internal configuration code
4044 * @ssid_len: (private) Used by the internal configuration code
Johannes Berg29cbe682010-12-03 09:20:44 +01004045 * @mesh_id_len: (private) Used by the internal configuration code
4046 * @mesh_id_up_len: (private) Used by the internal configuration code
Johannes Bergd3236552009-04-20 14:31:42 +02004047 * @wext: (private) Used by the internal wireless extensions compat code
Johannes Berg9bc383d2009-11-19 11:55:19 +01004048 * @use_4addr: indicates 4addr mode is used on this interface, must be
4049 * set by driver (if supported) on add_interface BEFORE registering the
4050 * netdev and may otherwise be used by driver read-only, will be update
4051 * by cfg80211 on change_interface
Johannes Berg2e161f72010-08-12 15:38:38 +02004052 * @mgmt_registrations: list of registrations for management frames
4053 * @mgmt_registrations_lock: lock for the list
Johannes Berg8d61ffa2013-05-10 12:32:47 +02004054 * @mtx: mutex used to lock data in this struct, may be used by drivers
4055 * and some API functions require it held
Johannes Berg56d18932011-05-09 18:41:15 +02004056 * @beacon_interval: beacon interval used on this device for transmitting
4057 * beacons, 0 when not valid
Johannes Berg98104fde2012-06-16 00:19:54 +02004058 * @address: The address for this device, valid only if @netdev is %NULL
4059 * @p2p_started: true if this is a P2P Device that has been started
Ayala Bekercb3b7d82016-09-20 17:31:13 +03004060 * @nan_started: true if this is a NAN interface that has been started
Simon Wunderlich04f39042013-02-08 18:16:19 +01004061 * @cac_started: true if DFS channel availability check has been started
4062 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
Janusz Dziedzic31559f32014-02-21 19:46:13 +01004063 * @cac_time_ms: CAC time in ms
Johannes Berg780b40d2013-06-05 09:32:50 +02004064 * @ps: powersave mode is enabled
4065 * @ps_timeout: dynamic powersave timeout
4066 * @ap_unexpected_nlportid: (private) netlink port ID of application
4067 * registered for unexpected class 3 frames (AP mode)
4068 * @conn: (private) cfg80211 software SME connection state machine data
4069 * @connect_keys: (private) keys to set after connection is established
Lior David34d50512016-01-28 10:58:25 +02004070 * @conn_bss_type: connecting/connected BSS type
Andrzej Zaborowski5f3f4d32018-02-04 21:57:28 +05304071 * @conn_owner_nlportid: (private) connection owner socket port ID
4072 * @disconnect_wk: (private) auto-disconnect work
4073 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
Johannes Berg780b40d2013-06-05 09:32:50 +02004074 * @ibss_fixed: (private) IBSS is using fixed BSSID
Simon Wunderlich5336fa82013-10-07 18:41:05 +02004075 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
Johannes Berg780b40d2013-06-05 09:32:50 +02004076 * @event_list: (private) list for internal event processing
4077 * @event_lock: (private) lock for event list
Johannes Berg78f22b62014-03-24 17:57:27 +01004078 * @owner_nlportid: (private) owner socket port ID
Johannes Bergd3236552009-04-20 14:31:42 +02004079 */
4080struct wireless_dev {
4081 struct wiphy *wiphy;
4082 enum nl80211_iftype iftype;
4083
Johannes Berg667503dd2009-07-07 03:56:11 +02004084 /* the remainder of this struct should be private to cfg80211 */
Johannes Bergd3236552009-04-20 14:31:42 +02004085 struct list_head list;
4086 struct net_device *netdev;
4087
Johannes Berg89a54e42012-06-15 14:33:17 +02004088 u32 identifier;
4089
Johannes Berg2e161f72010-08-12 15:38:38 +02004090 struct list_head mgmt_registrations;
4091 spinlock_t mgmt_registrations_lock;
Jouni Malinen026331c2010-02-15 12:53:10 +02004092
Johannes Berg667503dd2009-07-07 03:56:11 +02004093 struct mutex mtx;
4094
Ayala Bekercb3b7d82016-09-20 17:31:13 +03004095 bool use_4addr, p2p_started, nan_started;
Johannes Berg98104fde2012-06-16 00:19:54 +02004096
4097 u8 address[ETH_ALEN] __aligned(sizeof(u16));
Johannes Berg9bc383d2009-11-19 11:55:19 +01004098
Samuel Ortizb23aa672009-07-01 21:26:54 +02004099 /* currently used for IBSS and SME - might be rearranged later */
Johannes Bergd3236552009-04-20 14:31:42 +02004100 u8 ssid[IEEE80211_MAX_SSID_LEN];
Johannes Berg29cbe682010-12-03 09:20:44 +01004101 u8 ssid_len, mesh_id_len, mesh_id_up_len;
Johannes Berg6829c872009-07-02 09:13:27 +02004102 struct cfg80211_conn *conn;
Johannes Bergfffd0932009-07-08 14:22:54 +02004103 struct cfg80211_cached_keys *connect_keys;
Lior David34d50512016-01-28 10:58:25 +02004104 enum ieee80211_bss_type conn_bss_type;
Andrzej Zaborowski5f3f4d32018-02-04 21:57:28 +05304105 u32 conn_owner_nlportid;
4106
4107 struct work_struct disconnect_wk;
4108 u8 disconnect_bssid[ETH_ALEN];
Johannes Bergd3236552009-04-20 14:31:42 +02004109
Johannes Berg667503dd2009-07-07 03:56:11 +02004110 struct list_head event_list;
4111 spinlock_t event_lock;
4112
Johannes Berg19957bb2009-07-02 17:20:43 +02004113 struct cfg80211_internal_bss *current_bss; /* associated / joined */
Johannes Berg683b6d32012-11-08 21:25:48 +01004114 struct cfg80211_chan_def preset_chandef;
Michal Kazior9e0e2962014-01-29 14:22:27 +01004115 struct cfg80211_chan_def chandef;
Michal Kaziorf4489eb2012-06-29 12:46:58 +02004116
Michal Kaziorc30a3d32012-06-29 12:46:59 +02004117 bool ibss_fixed;
Simon Wunderlich5336fa82013-10-07 18:41:05 +02004118 bool ibss_dfs_possible;
Michal Kaziorc30a3d32012-06-29 12:46:59 +02004119
Kalle Valoffb9eb32010-02-17 17:58:10 +02004120 bool ps;
4121 int ps_timeout;
4122
Johannes Berg56d18932011-05-09 18:41:15 +02004123 int beacon_interval;
4124
Eric W. Biederman15e47302012-09-07 20:12:54 +00004125 u32 ap_unexpected_nlportid;
Johannes Berg28946da2011-11-04 11:18:12 +01004126
Simon Wunderlich04f39042013-02-08 18:16:19 +01004127 bool cac_started;
4128 unsigned long cac_start_time;
Janusz Dziedzic31559f32014-02-21 19:46:13 +01004129 unsigned int cac_time_ms;
Simon Wunderlich04f39042013-02-08 18:16:19 +01004130
Johannes Berg78f22b62014-03-24 17:57:27 +01004131 u32 owner_nlportid;
4132
Johannes Berg3d23e342009-09-29 23:27:28 +02004133#ifdef CONFIG_CFG80211_WEXT
Johannes Bergd3236552009-04-20 14:31:42 +02004134 /* wext data */
Johannes Bergcbe8fa92009-05-09 20:09:03 +02004135 struct {
Johannes Bergc238c8a2009-07-07 03:56:06 +02004136 struct cfg80211_ibss_params ibss;
4137 struct cfg80211_connect_params connect;
Johannes Bergfffd0932009-07-08 14:22:54 +02004138 struct cfg80211_cached_keys *keys;
Johannes Bergc1e5f472014-05-19 17:53:16 +02004139 const u8 *ie;
Johannes Bergf2129352009-07-01 21:26:56 +02004140 size_t ie_len;
Johannes Bergf401a6f2009-08-07 14:51:05 +02004141 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
Johannes Bergf2129352009-07-01 21:26:56 +02004142 u8 ssid[IEEE80211_MAX_SSID_LEN];
Johannes Berg08645122009-05-11 13:54:58 +02004143 s8 default_key, default_mgmt_key;
Kalle Valoffb9eb32010-02-17 17:58:10 +02004144 bool prev_bssid_valid;
Johannes Bergcbe8fa92009-05-09 20:09:03 +02004145 } wext;
Johannes Bergd3236552009-04-20 14:31:42 +02004146#endif
4147};
4148
Johannes Berg98104fde2012-06-16 00:19:54 +02004149static inline u8 *wdev_address(struct wireless_dev *wdev)
4150{
4151 if (wdev->netdev)
4152 return wdev->netdev->dev_addr;
4153 return wdev->address;
4154}
4155
Johannes Bergd3236552009-04-20 14:31:42 +02004156/**
4157 * wdev_priv - return wiphy priv from wireless_dev
4158 *
4159 * @wdev: The wireless device whose wiphy's priv pointer to return
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004160 * Return: The wiphy priv of @wdev.
Johannes Bergd3236552009-04-20 14:31:42 +02004161 */
4162static inline void *wdev_priv(struct wireless_dev *wdev)
4163{
4164 BUG_ON(!wdev);
4165 return wiphy_priv(wdev->wiphy);
4166}
4167
Johannes Bergd70e9692010-08-19 16:11:27 +02004168/**
4169 * DOC: Utility functions
4170 *
4171 * cfg80211 offers a number of utility functions that can be useful.
Johannes Bergd3236552009-04-20 14:31:42 +02004172 */
4173
4174/**
4175 * ieee80211_channel_to_frequency - convert channel number to frequency
Johannes Bergabe37c42010-06-07 11:12:27 +02004176 * @chan: channel number
Bruno Randolf59eb21a2011-01-17 13:37:28 +09004177 * @band: band, necessary due to channel number overlap
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004178 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
Johannes Bergd3236552009-04-20 14:31:42 +02004179 */
Johannes Berg57fbcce2016-04-12 15:56:15 +02004180int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
Johannes Bergd3236552009-04-20 14:31:42 +02004181
4182/**
4183 * ieee80211_frequency_to_channel - convert frequency to channel number
Johannes Bergabe37c42010-06-07 11:12:27 +02004184 * @freq: center frequency
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004185 * Return: The corresponding channel, or 0 if the conversion failed.
Johannes Bergd3236552009-04-20 14:31:42 +02004186 */
Joe Perches10dd9b72013-07-31 17:31:37 -07004187int ieee80211_frequency_to_channel(int freq);
Johannes Bergd3236552009-04-20 14:31:42 +02004188
4189/*
4190 * Name indirection necessary because the ieee80211 code also has
4191 * a function named "ieee80211_get_channel", so if you include
4192 * cfg80211's header file you get cfg80211's version, if you try
4193 * to include both header files you'll (rightfully!) get a symbol
4194 * clash.
4195 */
Joe Perches10dd9b72013-07-31 17:31:37 -07004196struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
4197 int freq);
Johannes Bergd3236552009-04-20 14:31:42 +02004198/**
4199 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
Johannes Bergabe37c42010-06-07 11:12:27 +02004200 * @wiphy: the struct wiphy to get the channel for
4201 * @freq: the center frequency of the channel
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004202 * Return: The channel struct from @wiphy at @freq.
Johannes Bergd3236552009-04-20 14:31:42 +02004203 */
4204static inline struct ieee80211_channel *
4205ieee80211_get_channel(struct wiphy *wiphy, int freq)
4206{
4207 return __ieee80211_get_channel(wiphy, freq);
4208}
4209
4210/**
4211 * ieee80211_get_response_rate - get basic rate for a given rate
4212 *
4213 * @sband: the band to look for rates in
4214 * @basic_rates: bitmap of basic rates
4215 * @bitrate: the bitrate for which to find the basic rate
4216 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004217 * Return: The basic rate corresponding to a given bitrate, that
4218 * is the next lower bitrate contained in the basic rate map,
4219 * which is, for this function, given as a bitmap of indices of
4220 * rates in the band's bitrate table.
Johannes Bergd3236552009-04-20 14:31:42 +02004221 */
4222struct ieee80211_rate *
4223ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
4224 u32 basic_rates, int bitrate);
4225
Ashok Nagarajanb422c6c2013-05-10 17:50:51 -07004226/**
4227 * ieee80211_mandatory_rates - get mandatory rates for a given band
4228 * @sband: the band to look for rates in
Simon Wunderlich74608ac2013-07-08 16:55:54 +02004229 * @scan_width: width of the control channel
Ashok Nagarajanb422c6c2013-05-10 17:50:51 -07004230 *
4231 * This function returns a bitmap of the mandatory rates for the given
4232 * band, bits are set according to the rate position in the bitrates array.
4233 */
Simon Wunderlich74608ac2013-07-08 16:55:54 +02004234u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
4235 enum nl80211_bss_scan_width scan_width);
Ashok Nagarajanb422c6c2013-05-10 17:50:51 -07004236
Johannes Bergd3236552009-04-20 14:31:42 +02004237/*
4238 * Radiotap parsing functions -- for controlled injection support
4239 *
4240 * Implemented in net/wireless/radiotap.c
4241 * Documentation in Documentation/networking/radiotap-headers.txt
4242 */
4243
Johannes Berg33e5a2f2010-02-03 10:24:30 +01004244struct radiotap_align_size {
4245 uint8_t align:4, size:4;
4246};
4247
4248struct ieee80211_radiotap_namespace {
4249 const struct radiotap_align_size *align_size;
4250 int n_bits;
4251 uint32_t oui;
4252 uint8_t subns;
4253};
4254
4255struct ieee80211_radiotap_vendor_namespaces {
4256 const struct ieee80211_radiotap_namespace *ns;
4257 int n_ns;
4258};
4259
Johannes Bergd3236552009-04-20 14:31:42 +02004260/**
4261 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
Johannes Berg33e5a2f2010-02-03 10:24:30 +01004262 * @this_arg_index: index of current arg, valid after each successful call
4263 * to ieee80211_radiotap_iterator_next()
4264 * @this_arg: pointer to current radiotap arg; it is valid after each
4265 * call to ieee80211_radiotap_iterator_next() but also after
4266 * ieee80211_radiotap_iterator_init() where it will point to
4267 * the beginning of the actual data portion
4268 * @this_arg_size: length of the current arg, for convenience
4269 * @current_namespace: pointer to the current namespace definition
4270 * (or internally %NULL if the current namespace is unknown)
4271 * @is_radiotap_ns: indicates whether the current namespace is the default
4272 * radiotap namespace or not
4273 *
Johannes Berg33e5a2f2010-02-03 10:24:30 +01004274 * @_rtheader: pointer to the radiotap header we are walking through
4275 * @_max_length: length of radiotap header in cpu byte ordering
4276 * @_arg_index: next argument index
4277 * @_arg: next argument pointer
4278 * @_next_bitmap: internal pointer to next present u32
4279 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
4280 * @_vns: vendor namespace definitions
4281 * @_next_ns_data: beginning of the next namespace's data
4282 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
4283 * next bitmap word
4284 *
4285 * Describes the radiotap parser state. Fields prefixed with an underscore
4286 * must not be used by users of the parser, only by the parser internally.
Johannes Bergd3236552009-04-20 14:31:42 +02004287 */
4288
4289struct ieee80211_radiotap_iterator {
Johannes Berg33e5a2f2010-02-03 10:24:30 +01004290 struct ieee80211_radiotap_header *_rtheader;
4291 const struct ieee80211_radiotap_vendor_namespaces *_vns;
4292 const struct ieee80211_radiotap_namespace *current_namespace;
Johannes Bergd3236552009-04-20 14:31:42 +02004293
Johannes Berg33e5a2f2010-02-03 10:24:30 +01004294 unsigned char *_arg, *_next_ns_data;
Johannes Berg67272442010-04-21 10:25:36 +02004295 __le32 *_next_bitmap;
Johannes Berg33e5a2f2010-02-03 10:24:30 +01004296
4297 unsigned char *this_arg;
4298 int this_arg_index;
4299 int this_arg_size;
4300
4301 int is_radiotap_ns;
4302
4303 int _max_length;
4304 int _arg_index;
4305 uint32_t _bitmap_shifter;
4306 int _reset_on_ext;
Johannes Bergd3236552009-04-20 14:31:42 +02004307};
4308
Joe Perches10dd9b72013-07-31 17:31:37 -07004309int
4310ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
4311 struct ieee80211_radiotap_header *radiotap_header,
4312 int max_length,
4313 const struct ieee80211_radiotap_vendor_namespaces *vns);
Johannes Bergd3236552009-04-20 14:31:42 +02004314
Joe Perches10dd9b72013-07-31 17:31:37 -07004315int
4316ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
Johannes Berg33e5a2f2010-02-03 10:24:30 +01004317
Johannes Bergd3236552009-04-20 14:31:42 +02004318
Zhu Yie31a16d2009-05-21 21:47:03 +08004319extern const unsigned char rfc1042_header[6];
4320extern const unsigned char bridge_tunnel_header[6];
4321
4322/**
4323 * ieee80211_get_hdrlen_from_skb - get header length from data
4324 *
Zhu Yie31a16d2009-05-21 21:47:03 +08004325 * @skb: the frame
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004326 *
4327 * Given an skb with a raw 802.11 header at the data pointer this function
4328 * returns the 802.11 header length.
4329 *
4330 * Return: The 802.11 header length in bytes (not including encryption
4331 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
4332 * 802.11 header.
Zhu Yie31a16d2009-05-21 21:47:03 +08004333 */
4334unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
4335
4336/**
4337 * ieee80211_hdrlen - get header length in bytes from frame control
4338 * @fc: frame control field in little-endian format
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004339 * Return: The header length in bytes.
Zhu Yie31a16d2009-05-21 21:47:03 +08004340 */
Johannes Berg633adf12010-08-12 14:49:58 +02004341unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
Zhu Yie31a16d2009-05-21 21:47:03 +08004342
4343/**
Johannes Berg9b395bc2012-10-26 00:36:40 +02004344 * ieee80211_get_mesh_hdrlen - get mesh extension header length
4345 * @meshhdr: the mesh extension header, only the flags field
4346 * (first byte) will be accessed
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004347 * Return: The length of the extension header, which is always at
Johannes Berg9b395bc2012-10-26 00:36:40 +02004348 * least 6 bytes and at most 18 if address 5 and 6 are present.
4349 */
4350unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
4351
4352/**
Johannes Bergd70e9692010-08-19 16:11:27 +02004353 * DOC: Data path helpers
4354 *
4355 * In addition to generic utilities, cfg80211 also offers
4356 * functions that help implement the data path for devices
4357 * that do not do the 802.11/802.3 conversion on the device.
4358 */
4359
4360/**
Johannes Berg7f6990c2016-10-05 15:29:49 +02004361 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
4362 * @skb: the 802.11 data frame
4363 * @ehdr: pointer to a &struct ethhdr that will get the header, instead
4364 * of it being pushed into the SKB
4365 * @addr: the device MAC address
4366 * @iftype: the virtual interface type
4367 * Return: 0 on success. Non-zero on error.
4368 */
4369int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
4370 const u8 *addr, enum nl80211_iftype iftype);
4371
4372/**
Zhu Yie31a16d2009-05-21 21:47:03 +08004373 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
4374 * @skb: the 802.11 data frame
4375 * @addr: the device MAC address
4376 * @iftype: the virtual interface type
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004377 * Return: 0 on success. Non-zero on error.
Zhu Yie31a16d2009-05-21 21:47:03 +08004378 */
Johannes Berg7f6990c2016-10-05 15:29:49 +02004379static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
4380 enum nl80211_iftype iftype)
4381{
4382 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype);
4383}
Zhu Yie31a16d2009-05-21 21:47:03 +08004384
4385/**
Zhu Yieaf85ca2009-12-01 10:18:37 +08004386 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
4387 *
Johannes Berg7f6990c2016-10-05 15:29:49 +02004388 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
4389 * The @list will be empty if the decode fails. The @skb must be fully
4390 * header-less before being passed in here; it is freed in this function.
Zhu Yieaf85ca2009-12-01 10:18:37 +08004391 *
Johannes Berg7f6990c2016-10-05 15:29:49 +02004392 * @skb: The input A-MSDU frame without any headers.
Zhu Yieaf85ca2009-12-01 10:18:37 +08004393 * @list: The output list of 802.3 frames. It must be allocated and
4394 * initialized by by the caller.
4395 * @addr: The device MAC address.
4396 * @iftype: The device interface type.
4397 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
Johannes Berg8b935ee2016-10-05 16:17:01 +02004398 * @check_da: DA to check in the inner ethernet header, or NULL
4399 * @check_sa: SA to check in the inner ethernet header, or NULL
Zhu Yieaf85ca2009-12-01 10:18:37 +08004400 */
4401void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
4402 const u8 *addr, enum nl80211_iftype iftype,
Yogesh Ashok Powar8b3beca2011-05-13 11:22:31 -07004403 const unsigned int extra_headroom,
Johannes Berg8b935ee2016-10-05 16:17:01 +02004404 const u8 *check_da, const u8 *check_sa);
Zhu Yieaf85ca2009-12-01 10:18:37 +08004405
4406/**
Zhu Yie31a16d2009-05-21 21:47:03 +08004407 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
4408 * @skb: the data frame
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08004409 * @qos_map: Interworking QoS mapping or %NULL if not in use
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004410 * Return: The 802.1p/1d tag.
Zhu Yie31a16d2009-05-21 21:47:03 +08004411 */
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08004412unsigned int cfg80211_classify8021d(struct sk_buff *skb,
4413 struct cfg80211_qos_map *qos_map);
Zhu Yie31a16d2009-05-21 21:47:03 +08004414
Johannes Bergc21dbf92010-01-26 14:15:46 +01004415/**
Luca Coelhofbd05e42016-09-15 18:15:09 +03004416 * cfg80211_find_ie_match - match information element and byte array in data
4417 *
4418 * @eid: element ID
4419 * @ies: data consisting of IEs
4420 * @len: length of data
4421 * @match: byte array to match
4422 * @match_len: number of bytes in the match array
4423 * @match_offset: offset in the IE where the byte array should match.
4424 * If match_len is zero, this must also be set to zero.
4425 * Otherwise this must be set to 2 or more, because the first
4426 * byte is the element id, which is already compared to eid, and
4427 * the second byte is the IE length.
4428 *
4429 * Return: %NULL if the element ID could not be found or if
4430 * the element is invalid (claims to be longer than the given
4431 * data) or if the byte array doesn't match, or a pointer to the first
4432 * byte of the requested element, that is the byte containing the
4433 * element ID.
4434 *
4435 * Note: There are no checks on the element length other than
4436 * having to fit into the given data and being large enough for the
4437 * byte array to match.
4438 */
4439const u8 *cfg80211_find_ie_match(u8 eid, const u8 *ies, int len,
4440 const u8 *match, int match_len,
4441 int match_offset);
4442
4443/**
Johannes Bergc21dbf92010-01-26 14:15:46 +01004444 * cfg80211_find_ie - find information element in data
4445 *
4446 * @eid: element ID
4447 * @ies: data consisting of IEs
4448 * @len: length of data
4449 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004450 * Return: %NULL if the element ID could not be found or if
4451 * the element is invalid (claims to be longer than the given
4452 * data), or a pointer to the first byte of the requested
4453 * element, that is the byte containing the element ID.
4454 *
4455 * Note: There are no checks on the element length other than
4456 * having to fit into the given data.
Johannes Bergc21dbf92010-01-26 14:15:46 +01004457 */
Luca Coelhofbd05e42016-09-15 18:15:09 +03004458static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
4459{
4460 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
4461}
Johannes Bergc21dbf92010-01-26 14:15:46 +01004462
Johannes Bergd70e9692010-08-19 16:11:27 +02004463/**
Eliad Peller0c28ec52011-09-15 11:53:01 +03004464 * cfg80211_find_vendor_ie - find vendor specific information element in data
4465 *
4466 * @oui: vendor OUI
Emmanuel Grumbach9e9ea432016-05-03 16:08:07 +03004467 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
Eliad Peller0c28ec52011-09-15 11:53:01 +03004468 * @ies: data consisting of IEs
4469 * @len: length of data
4470 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004471 * Return: %NULL if the vendor specific element ID could not be found or if the
4472 * element is invalid (claims to be longer than the given data), or a pointer to
4473 * the first byte of the requested element, that is the byte containing the
4474 * element ID.
4475 *
4476 * Note: There are no checks on the element length other than having to fit into
4477 * the given data.
Eliad Peller0c28ec52011-09-15 11:53:01 +03004478 */
Emmanuel Grumbach9e9ea432016-05-03 16:08:07 +03004479const u8 *cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
Eliad Peller0c28ec52011-09-15 11:53:01 +03004480 const u8 *ies, int len);
4481
4482/**
Dedy Lanskyab567892018-07-29 14:59:16 +03004483 * cfg80211_send_layer2_update - send layer 2 update frame
4484 *
4485 * @dev: network device
4486 * @addr: STA MAC address
4487 *
4488 * Wireless drivers can use this function to update forwarding tables in bridge
4489 * devices upon STA association.
4490 */
4491void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
4492
4493/**
Johannes Bergd70e9692010-08-19 16:11:27 +02004494 * DOC: Regulatory enforcement infrastructure
4495 *
4496 * TODO
Johannes Bergd3236552009-04-20 14:31:42 +02004497 */
4498
4499/**
4500 * regulatory_hint - driver hint to the wireless core a regulatory domain
4501 * @wiphy: the wireless device giving the hint (used only for reporting
4502 * conflicts)
4503 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
4504 * should be in. If @rd is set this should be NULL. Note that if you
4505 * set this to NULL you should still set rd->alpha2 to some accepted
4506 * alpha2.
4507 *
4508 * Wireless drivers can use this function to hint to the wireless core
4509 * what it believes should be the current regulatory domain by
4510 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
4511 * domain should be in or by providing a completely build regulatory domain.
4512 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
4513 * for a regulatory domain structure for the respective country.
4514 *
4515 * The wiphy must have been registered to cfg80211 prior to this call.
4516 * For cfg80211 drivers this means you must first use wiphy_register(),
4517 * for mac80211 drivers you must first use ieee80211_register_hw().
4518 *
4519 * Drivers should check the return value, its possible you can get
4520 * an -ENOMEM.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004521 *
4522 * Return: 0 on success. -ENOMEM.
Johannes Bergd3236552009-04-20 14:31:42 +02004523 */
Joe Perches10dd9b72013-07-31 17:31:37 -07004524int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
Johannes Bergd3236552009-04-20 14:31:42 +02004525
4526/**
Jonathan Doronb0d7aa52014-12-15 19:26:00 +02004527 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
4528 * @wiphy: the wireless device we want to process the regulatory domain on
4529 * @rd: the regulatory domain informatoin to use for this wiphy
4530 *
4531 * Set the regulatory domain information for self-managed wiphys, only they
4532 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
4533 * information.
4534 *
4535 * Return: 0 on success. -EINVAL, -EPERM
4536 */
4537int regulatory_set_wiphy_regd(struct wiphy *wiphy,
4538 struct ieee80211_regdomain *rd);
4539
4540/**
Arik Nemtsov2c3e8612015-01-07 16:47:19 +02004541 * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
4542 * @wiphy: the wireless device we want to process the regulatory domain on
4543 * @rd: the regulatory domain information to use for this wiphy
4544 *
4545 * This functions requires the RTNL to be held and applies the new regdomain
4546 * synchronously to this wiphy. For more details see
4547 * regulatory_set_wiphy_regd().
4548 *
4549 * Return: 0 on success. -EINVAL, -EPERM
4550 */
4551int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
4552 struct ieee80211_regdomain *rd);
4553
4554/**
Mihir Sheted62103c2013-10-14 00:54:40 +05304555 * regulatory_hint_user - hint to the wireless core a regulatory domain
4556 * which the driver has received from an application
4557 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
4558 * should be in. If @rd is set this should be NULL. Note that if you
4559 * set this to NULL you should still set rd->alpha2 to some accepted
4560 * alpha2.
4561 * @user_reg_hint_type: the type of user regulatory hint.
4562 *
4563 * Wireless drivers can use this function to hint to the wireless core
4564 * the current regulatory domain as specified by trusted applications,
4565 * it is the driver's responsibilty to estbalish which applications it
4566 * trusts.
4567 *
4568 * The wiphy should be registered to cfg80211 prior to this call.
4569 * For cfg80211 drivers this means you must first use wiphy_register(),
4570 * for mac80211 drivers you must first use ieee80211_register_hw().
4571 *
4572 * Drivers should check the return value, its possible you can get
4573 * an -ENOMEM or an -EINVAL.
4574 *
4575 * Return: 0 on success. -ENOMEM, -EINVAL.
4576 */
4577int regulatory_hint_user(const char *alpha2,
4578 enum nl80211_user_reg_hint_type user_reg_hint_type);
4579
4580/**
Johannes Bergd3236552009-04-20 14:31:42 +02004581 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
4582 * @wiphy: the wireless device we want to process the regulatory domain on
4583 * @regd: the custom regulatory domain to use for this wiphy
4584 *
4585 * Drivers can sometimes have custom regulatory domains which do not apply
4586 * to a specific country. Drivers can use this to apply such custom regulatory
4587 * domains. This routine must be called prior to wiphy registration. The
4588 * custom regulatory domain will be trusted completely and as such previous
4589 * default channel settings will be disregarded. If no rule is found for a
4590 * channel on the regulatory domain the channel will be disabled.
Luis R. Rodriguez222ea582013-11-05 09:18:00 -08004591 * Drivers using this for a wiphy should also set the wiphy flag
Kalle Valoce261512014-04-03 10:03:45 +03004592 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
Luis R. Rodriguez222ea582013-11-05 09:18:00 -08004593 * that called this helper.
Johannes Bergd3236552009-04-20 14:31:42 +02004594 */
Joe Perches10dd9b72013-07-31 17:31:37 -07004595void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
4596 const struct ieee80211_regdomain *regd);
Johannes Bergd3236552009-04-20 14:31:42 +02004597
4598/**
4599 * freq_reg_info - get regulatory information for the given frequency
4600 * @wiphy: the wiphy for which we want to process this rule for
4601 * @center_freq: Frequency in KHz for which we want regulatory information for
Johannes Bergd3236552009-04-20 14:31:42 +02004602 *
4603 * Use this function to get the regulatory rule for a specific frequency on
4604 * a given wireless device. If the device has a specific regulatory domain
4605 * it wants to follow we respect that unless a country IE has been received
4606 * and processed already.
4607 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004608 * Return: A valid pointer, or, when an error occurs, for example if no rule
4609 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
4610 * check and PTR_ERR() to obtain the numeric return value. The numeric return
4611 * value will be -ERANGE if we determine the given center_freq does not even
4612 * have a regulatory rule for a frequency range in the center_freq's band.
4613 * See freq_in_rule_band() for our current definition of a band -- this is
4614 * purely subjective and right now it's 802.11 specific.
Johannes Bergd3236552009-04-20 14:31:42 +02004615 */
Johannes Berg361c9c82012-12-06 15:57:14 +01004616const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
4617 u32 center_freq);
Johannes Bergd3236552009-04-20 14:31:42 +02004618
Luis R. Rodriguez034c6d62013-10-14 17:42:06 -07004619/**
4620 * reg_initiator_name - map regulatory request initiator enum to name
4621 * @initiator: the regulatory request initiator
4622 *
4623 * You can use this to map the regulatory request initiator enum to a
4624 * proper string representation.
4625 */
4626const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
4627
Johannes Bergd3236552009-04-20 14:31:42 +02004628/*
Johannes Bergd3236552009-04-20 14:31:42 +02004629 * callbacks for asynchronous cfg80211 methods, notification
4630 * functions and BSS handling helpers
4631 */
4632
Johannes Berg2a519312009-02-10 21:25:55 +01004633/**
4634 * cfg80211_scan_done - notify that scan finished
4635 *
4636 * @request: the corresponding scan request
Avraham Stern1d762502016-07-05 17:10:13 +03004637 * @info: information about the completed scan
Johannes Berg2a519312009-02-10 21:25:55 +01004638 */
Avraham Stern1d762502016-07-05 17:10:13 +03004639void cfg80211_scan_done(struct cfg80211_scan_request *request,
4640 struct cfg80211_scan_info *info);
Johannes Berg2a519312009-02-10 21:25:55 +01004641
4642/**
Luciano Coelho807f8a82011-05-11 17:09:35 +03004643 * cfg80211_sched_scan_results - notify that new scan results are available
4644 *
4645 * @wiphy: the wiphy which got scheduled scan results
4646 */
4647void cfg80211_sched_scan_results(struct wiphy *wiphy);
4648
4649/**
4650 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
4651 *
4652 * @wiphy: the wiphy on which the scheduled scan stopped
4653 *
4654 * The driver can call this function to inform cfg80211 that the
4655 * scheduled scan had to be stopped, for whatever reason. The driver
4656 * is then called back via the sched_scan_stop operation when done.
4657 */
4658void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
4659
4660/**
Eliad Peller792e6aa2014-04-30 16:14:23 +03004661 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
4662 *
4663 * @wiphy: the wiphy on which the scheduled scan stopped
4664 *
4665 * The driver can call this function to inform cfg80211 that the
4666 * scheduled scan had to be stopped, for whatever reason. The driver
4667 * is then called back via the sched_scan_stop operation when done.
4668 * This function should be called with rtnl locked.
4669 */
4670void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy);
4671
4672/**
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004673 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
Johannes Berg2a519312009-02-10 21:25:55 +01004674 * @wiphy: the wiphy reporting the BSS
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004675 * @data: the BSS metadata
Johannes Bergabe37c42010-06-07 11:12:27 +02004676 * @mgmt: the management frame (probe response or beacon)
4677 * @len: length of the management frame
Johannes Berg2a519312009-02-10 21:25:55 +01004678 * @gfp: context flags
4679 *
4680 * This informs cfg80211 that BSS information was found and
4681 * the BSS should be updated/added.
Johannes Bergef100682011-10-27 14:45:02 +02004682 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004683 * Return: A referenced struct, must be released with cfg80211_put_bss()!
4684 * Or %NULL on error.
Johannes Berg2a519312009-02-10 21:25:55 +01004685 */
Johannes Bergef100682011-10-27 14:45:02 +02004686struct cfg80211_bss * __must_check
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004687cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
4688 struct cfg80211_inform_bss *data,
4689 struct ieee80211_mgmt *mgmt, size_t len,
4690 gfp_t gfp);
4691
4692static inline struct cfg80211_bss * __must_check
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004693cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
Emmanuel Grumbach3afc2162014-03-04 16:50:13 +02004694 struct ieee80211_channel *rx_channel,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004695 enum nl80211_bss_scan_width scan_width,
4696 struct ieee80211_mgmt *mgmt, size_t len,
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004697 s32 signal, gfp_t gfp)
4698{
4699 struct cfg80211_inform_bss data = {
4700 .chan = rx_channel,
4701 .scan_width = scan_width,
4702 .signal = signal,
4703 };
4704
4705 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
4706}
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004707
4708static inline struct cfg80211_bss * __must_check
Johannes Berg2a519312009-02-10 21:25:55 +01004709cfg80211_inform_bss_frame(struct wiphy *wiphy,
Emmanuel Grumbach3afc2162014-03-04 16:50:13 +02004710 struct ieee80211_channel *rx_channel,
Johannes Berg2a519312009-02-10 21:25:55 +01004711 struct ieee80211_mgmt *mgmt, size_t len,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004712 s32 signal, gfp_t gfp)
4713{
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004714 struct cfg80211_inform_bss data = {
4715 .chan = rx_channel,
4716 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
4717 .signal = signal,
4718 };
4719
4720 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004721}
Johannes Berg2a519312009-02-10 21:25:55 +01004722
Johannes Bergabe37c42010-06-07 11:12:27 +02004723/**
Johannes Berg5bc8c1f2014-08-12 21:01:28 +02004724 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
4725 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
4726 * from a beacon or probe response
4727 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
4728 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
4729 */
4730enum cfg80211_bss_frame_type {
4731 CFG80211_BSS_FTYPE_UNKNOWN,
4732 CFG80211_BSS_FTYPE_BEACON,
4733 CFG80211_BSS_FTYPE_PRESP,
4734};
4735
4736/**
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004737 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
Johannes Bergabe37c42010-06-07 11:12:27 +02004738 *
4739 * @wiphy: the wiphy reporting the BSS
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004740 * @data: the BSS metadata
Johannes Berg5bc8c1f2014-08-12 21:01:28 +02004741 * @ftype: frame type (if known)
Johannes Bergabe37c42010-06-07 11:12:27 +02004742 * @bssid: the BSSID of the BSS
Johannes Berg7b8bcff2012-03-13 13:57:04 +01004743 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
Johannes Bergabe37c42010-06-07 11:12:27 +02004744 * @capability: the capability field sent by the peer
4745 * @beacon_interval: the beacon interval announced by the peer
4746 * @ie: additional IEs sent by the peer
4747 * @ielen: length of the additional IEs
Johannes Bergabe37c42010-06-07 11:12:27 +02004748 * @gfp: context flags
4749 *
4750 * This informs cfg80211 that BSS information was found and
4751 * the BSS should be updated/added.
Johannes Bergef100682011-10-27 14:45:02 +02004752 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01004753 * Return: A referenced struct, must be released with cfg80211_put_bss()!
4754 * Or %NULL on error.
Johannes Bergabe37c42010-06-07 11:12:27 +02004755 */
Johannes Bergef100682011-10-27 14:45:02 +02004756struct cfg80211_bss * __must_check
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004757cfg80211_inform_bss_data(struct wiphy *wiphy,
4758 struct cfg80211_inform_bss *data,
4759 enum cfg80211_bss_frame_type ftype,
4760 const u8 *bssid, u64 tsf, u16 capability,
4761 u16 beacon_interval, const u8 *ie, size_t ielen,
4762 gfp_t gfp);
4763
4764static inline struct cfg80211_bss * __must_check
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004765cfg80211_inform_bss_width(struct wiphy *wiphy,
Emmanuel Grumbach3afc2162014-03-04 16:50:13 +02004766 struct ieee80211_channel *rx_channel,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004767 enum nl80211_bss_scan_width scan_width,
Johannes Berg5bc8c1f2014-08-12 21:01:28 +02004768 enum cfg80211_bss_frame_type ftype,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004769 const u8 *bssid, u64 tsf, u16 capability,
4770 u16 beacon_interval, const u8 *ie, size_t ielen,
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004771 s32 signal, gfp_t gfp)
4772{
4773 struct cfg80211_inform_bss data = {
4774 .chan = rx_channel,
4775 .scan_width = scan_width,
4776 .signal = signal,
4777 };
4778
4779 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
4780 capability, beacon_interval, ie, ielen,
4781 gfp);
4782}
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004783
4784static inline struct cfg80211_bss * __must_check
Jussi Kivilinna06aa7af2009-03-26 23:40:09 +02004785cfg80211_inform_bss(struct wiphy *wiphy,
Emmanuel Grumbach3afc2162014-03-04 16:50:13 +02004786 struct ieee80211_channel *rx_channel,
Johannes Berg5bc8c1f2014-08-12 21:01:28 +02004787 enum cfg80211_bss_frame_type ftype,
Johannes Berg7b8bcff2012-03-13 13:57:04 +01004788 const u8 *bssid, u64 tsf, u16 capability,
4789 u16 beacon_interval, const u8 *ie, size_t ielen,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004790 s32 signal, gfp_t gfp)
4791{
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02004792 struct cfg80211_inform_bss data = {
4793 .chan = rx_channel,
4794 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
4795 .signal = signal,
4796 };
4797
4798 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
4799 capability, beacon_interval, ie, ielen,
4800 gfp);
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004801}
Jussi Kivilinna06aa7af2009-03-26 23:40:09 +02004802
Johannes Berg2a519312009-02-10 21:25:55 +01004803struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
4804 struct ieee80211_channel *channel,
4805 const u8 *bssid,
Johannes Berg79420f02009-02-10 21:25:59 +01004806 const u8 *ssid, size_t ssid_len,
Dedy Lansky6eb18132015-02-08 15:52:03 +02004807 enum ieee80211_bss_type bss_type,
4808 enum ieee80211_privacy);
Johannes Berg79420f02009-02-10 21:25:59 +01004809static inline struct cfg80211_bss *
4810cfg80211_get_ibss(struct wiphy *wiphy,
4811 struct ieee80211_channel *channel,
4812 const u8 *ssid, size_t ssid_len)
4813{
4814 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
Dedy Lansky6eb18132015-02-08 15:52:03 +02004815 IEEE80211_BSS_TYPE_IBSS,
4816 IEEE80211_PRIVACY_ANY);
Johannes Berg79420f02009-02-10 21:25:59 +01004817}
4818
Johannes Berg4c0c0b72012-01-20 13:55:26 +01004819/**
4820 * cfg80211_ref_bss - reference BSS struct
Johannes Berg5b112d32013-02-01 01:49:58 +01004821 * @wiphy: the wiphy this BSS struct belongs to
Johannes Berg4c0c0b72012-01-20 13:55:26 +01004822 * @bss: the BSS struct to reference
4823 *
4824 * Increments the refcount of the given BSS struct.
4825 */
Johannes Berg5b112d32013-02-01 01:49:58 +01004826void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
Johannes Berg4c0c0b72012-01-20 13:55:26 +01004827
4828/**
4829 * cfg80211_put_bss - unref BSS struct
Johannes Berg5b112d32013-02-01 01:49:58 +01004830 * @wiphy: the wiphy this BSS struct belongs to
Johannes Berg4c0c0b72012-01-20 13:55:26 +01004831 * @bss: the BSS struct
4832 *
4833 * Decrements the refcount of the given BSS struct.
4834 */
Johannes Berg5b112d32013-02-01 01:49:58 +01004835void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
Johannes Bergd3236552009-04-20 14:31:42 +02004836
Johannes Bergd491af12009-02-10 21:25:58 +01004837/**
4838 * cfg80211_unlink_bss - unlink BSS from internal data structures
4839 * @wiphy: the wiphy
4840 * @bss: the bss to remove
4841 *
4842 * This function removes the given BSS from the internal data structures
4843 * thereby making it no longer show up in scan results etc. Use this
4844 * function when you detect a BSS is gone. Normally BSSes will also time
4845 * out, so it is not necessary to use this function at all.
4846 */
4847void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
Johannes Bergfee52672008-11-26 22:36:31 +01004848
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02004849static inline enum nl80211_bss_scan_width
4850cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
4851{
4852 switch (chandef->width) {
4853 case NL80211_CHAN_WIDTH_5:
4854 return NL80211_BSS_CHAN_WIDTH_5;
4855 case NL80211_CHAN_WIDTH_10:
4856 return NL80211_BSS_CHAN_WIDTH_10;
4857 default:
4858 return NL80211_BSS_CHAN_WIDTH_20;
4859 }
4860}
4861
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004862/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004863 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004864 * @dev: network device
4865 * @buf: authentication frame (header + body)
4866 * @len: length of the frame data
4867 *
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004868 * This function is called whenever an authentication, disassociation or
4869 * deauthentication frame has been received and processed in station mode.
4870 * After being asked to authenticate via cfg80211_ops::auth() the driver must
4871 * call either this function or cfg80211_auth_timeout().
4872 * After being asked to associate via cfg80211_ops::assoc() the driver must
4873 * call either this function or cfg80211_auth_timeout().
4874 * While connected, the driver must calls this for received and processed
4875 * disassociation and deauthentication frames. If the frame couldn't be used
4876 * because it was unprotected, the driver must call the function
4877 * cfg80211_rx_unprot_mlme_mgmt() instead.
4878 *
4879 * This function may sleep. The caller must hold the corresponding wdev's mutex.
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004880 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004881void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004882
4883/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004884 * cfg80211_auth_timeout - notification of timed out authentication
Jouni Malinen1965c852009-04-22 21:38:25 +03004885 * @dev: network device
4886 * @addr: The MAC address of the device with which the authentication timed out
Johannes Bergcb0b4be2009-07-07 03:56:07 +02004887 *
Johannes Berg8d61ffa2013-05-10 12:32:47 +02004888 * This function may sleep. The caller must hold the corresponding wdev's
4889 * mutex.
Jouni Malinen1965c852009-04-22 21:38:25 +03004890 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004891void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
Jouni Malinen1965c852009-04-22 21:38:25 +03004892
4893/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004894 * cfg80211_rx_assoc_resp - notification of processed association response
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004895 * @dev: network device
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004896 * @bss: the BSS that association was requested with, ownership of the pointer
4897 * moves to cfg80211 in this call
4898 * @buf: authentication frame (header + body)
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004899 * @len: length of the frame data
Eliad Pellerb0b6aa22014-09-09 17:09:45 +03004900 * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a.
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004901 *
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004902 * After being asked to associate via cfg80211_ops::assoc() the driver must
4903 * call either this function or cfg80211_auth_timeout().
4904 *
4905 * This function may sleep. The caller must hold the corresponding wdev's mutex.
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004906 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004907void cfg80211_rx_assoc_resp(struct net_device *dev,
4908 struct cfg80211_bss *bss,
Eliad Pellerb0b6aa22014-09-09 17:09:45 +03004909 const u8 *buf, size_t len,
4910 int uapsd_queues);
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004911
4912/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004913 * cfg80211_assoc_timeout - notification of timed out association
Jouni Malinen1965c852009-04-22 21:38:25 +03004914 * @dev: network device
Johannes Berg959867f2013-06-19 13:05:42 +02004915 * @bss: The BSS entry with which association timed out.
Johannes Bergcb0b4be2009-07-07 03:56:07 +02004916 *
Johannes Berg8d61ffa2013-05-10 12:32:47 +02004917 * This function may sleep. The caller must hold the corresponding wdev's mutex.
Jouni Malinen1965c852009-04-22 21:38:25 +03004918 */
Johannes Berg959867f2013-06-19 13:05:42 +02004919void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
Jouni Malinen1965c852009-04-22 21:38:25 +03004920
4921/**
Johannes Berg1976c762016-12-08 17:22:09 +01004922 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
4923 * @dev: network device
4924 * @bss: The BSS entry with which association was abandoned.
4925 *
4926 * Call this whenever - for reasons reported through other API, like deauth RX,
4927 * an association attempt was abandoned.
4928 * This function may sleep. The caller must hold the corresponding wdev's mutex.
4929 */
4930void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
4931
4932/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004933 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004934 * @dev: network device
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004935 * @buf: 802.11 frame (header + body)
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004936 * @len: length of the frame data
4937 *
4938 * This function is called whenever deauthentication has been processed in
Jouni Malinen53b46b82009-03-27 20:53:56 +02004939 * station mode. This includes both received deauthentication frames and
Johannes Berg8d61ffa2013-05-10 12:32:47 +02004940 * locally generated ones. This function may sleep. The caller must hold the
4941 * corresponding wdev's mutex.
Jouni Malinen6039f6d2009-03-19 13:39:21 +02004942 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004943void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
Holger Schurigce470612009-10-13 13:28:13 +02004944
4945/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004946 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
Jouni Malinencf4e5942010-12-16 00:52:40 +02004947 * @dev: network device
4948 * @buf: deauthentication frame (header + body)
4949 * @len: length of the frame data
4950 *
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004951 * This function is called whenever a received deauthentication or dissassoc
4952 * frame has been dropped in station mode because of MFP being used but the
Jouni Malinencf4e5942010-12-16 00:52:40 +02004953 * frame was not protected. This function may sleep.
4954 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02004955void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
4956 const u8 *buf, size_t len);
Jouni Malinencf4e5942010-12-16 00:52:40 +02004957
4958/**
Jouni Malinena3b8b052009-03-27 21:59:49 +02004959 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
4960 * @dev: network device
4961 * @addr: The source MAC address of the frame
4962 * @key_type: The key type that the received frame used
Arik Nemtsova66b98d2011-06-23 00:00:24 +03004963 * @key_id: Key identifier (0..3). Can be -1 if missing.
Jouni Malinena3b8b052009-03-27 21:59:49 +02004964 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
Johannes Berge6d6e342009-07-01 21:26:47 +02004965 * @gfp: allocation flags
Jouni Malinena3b8b052009-03-27 21:59:49 +02004966 *
4967 * This function is called whenever the local MAC detects a MIC failure in a
4968 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
4969 * primitive.
4970 */
4971void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
4972 enum nl80211_key_type key_type, int key_id,
Johannes Berge6d6e342009-07-01 21:26:47 +02004973 const u8 *tsc, gfp_t gfp);
Jouni Malinena3b8b052009-03-27 21:59:49 +02004974
Johannes Berg04a773a2009-04-19 21:24:32 +02004975/**
4976 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
4977 *
4978 * @dev: network device
4979 * @bssid: the BSSID of the IBSS joined
Antonio Quartullife94f3a2014-01-29 17:53:43 +01004980 * @channel: the channel of the IBSS joined
Johannes Berg04a773a2009-04-19 21:24:32 +02004981 * @gfp: allocation flags
4982 *
4983 * This function notifies cfg80211 that the device joined an IBSS or
4984 * switched to a different BSSID. Before this function can be called,
4985 * either a beacon has to have been received from the IBSS, or one of
4986 * the cfg80211_inform_bss{,_frame} functions must have been called
4987 * with the locally generated beacon -- this guarantees that there is
4988 * always a scan result for this IBSS. cfg80211 will handle the rest.
4989 */
Antonio Quartullife94f3a2014-01-29 17:53:43 +01004990void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
4991 struct ieee80211_channel *channel, gfp_t gfp);
Johannes Berg04a773a2009-04-19 21:24:32 +02004992
Johannes Berg1f87f7d2009-06-02 13:01:41 +02004993/**
Javier Cardonac93b5e72011-04-07 15:08:34 -07004994 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
4995 *
4996 * @dev: network device
4997 * @macaddr: the MAC address of the new candidate
4998 * @ie: information elements advertised by the peer candidate
4999 * @ie_len: lenght of the information elements buffer
5000 * @gfp: allocation flags
5001 *
5002 * This function notifies cfg80211 that the mesh peer candidate has been
5003 * detected, most likely via a beacon or, less likely, via a probe response.
5004 * cfg80211 then sends a notification to userspace.
5005 */
5006void cfg80211_notify_new_peer_candidate(struct net_device *dev,
5007 const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
5008
5009/**
Johannes Bergd70e9692010-08-19 16:11:27 +02005010 * DOC: RFkill integration
5011 *
5012 * RFkill integration in cfg80211 is almost invisible to drivers,
5013 * as cfg80211 automatically registers an rfkill instance for each
5014 * wireless device it knows about. Soft kill is also translated
5015 * into disconnecting and turning all interfaces off, drivers are
5016 * expected to turn off the device when all interfaces are down.
5017 *
5018 * However, devices may have a hard RFkill line, in which case they
5019 * also need to interact with the rfkill subsystem, via cfg80211.
5020 * They can do this with a few helper functions documented here.
5021 */
5022
5023/**
Johannes Berg1f87f7d2009-06-02 13:01:41 +02005024 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
5025 * @wiphy: the wiphy
5026 * @blocked: block status
5027 */
5028void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
5029
5030/**
5031 * wiphy_rfkill_start_polling - start polling rfkill
5032 * @wiphy: the wiphy
5033 */
5034void wiphy_rfkill_start_polling(struct wiphy *wiphy);
5035
5036/**
5037 * wiphy_rfkill_stop_polling - stop polling rfkill
5038 * @wiphy: the wiphy
5039 */
5040void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
5041
Johannes Bergad7e7182013-11-13 13:37:47 +01005042/**
5043 * DOC: Vendor commands
5044 *
5045 * Occasionally, there are special protocol or firmware features that
5046 * can't be implemented very openly. For this and similar cases, the
5047 * vendor command functionality allows implementing the features with
5048 * (typically closed-source) userspace and firmware, using nl80211 as
5049 * the configuration mechanism.
5050 *
5051 * A driver supporting vendor commands must register them as an array
5052 * in struct wiphy, with handlers for each one, each command has an
5053 * OUI and sub command ID to identify it.
5054 *
5055 * Note that this feature should not be (ab)used to implement protocol
5056 * features that could openly be shared across drivers. In particular,
5057 * it must never be required to use vendor commands to implement any
5058 * "normal" functionality that higher-level userspace like connection
5059 * managers etc. need.
5060 */
5061
5062struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
5063 enum nl80211_commands cmd,
5064 enum nl80211_attrs attr,
5065 int approxlen);
5066
Johannes Berg567ffc32013-12-18 14:43:31 +01005067struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02005068 struct wireless_dev *wdev,
Johannes Berg567ffc32013-12-18 14:43:31 +01005069 enum nl80211_commands cmd,
5070 enum nl80211_attrs attr,
5071 int vendor_event_idx,
5072 int approxlen, gfp_t gfp);
5073
5074void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
5075
Johannes Bergad7e7182013-11-13 13:37:47 +01005076/**
5077 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
5078 * @wiphy: the wiphy
5079 * @approxlen: an upper bound of the length of the data that will
5080 * be put into the skb
5081 *
5082 * This function allocates and pre-fills an skb for a reply to
5083 * a vendor command. Since it is intended for a reply, calling
5084 * it outside of a vendor command's doit() operation is invalid.
5085 *
5086 * The returned skb is pre-filled with some identifying data in
5087 * a way that any data that is put into the skb (with skb_put(),
5088 * nla_put() or similar) will end up being within the
5089 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
5090 * with the skb is adding data for the corresponding userspace tool
5091 * which can then read that data out of the vendor data attribute.
5092 * You must not modify the skb in any other way.
5093 *
5094 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
5095 * its error code as the result of the doit() operation.
5096 *
5097 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
5098 */
5099static inline struct sk_buff *
5100cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
5101{
5102 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
5103 NL80211_ATTR_VENDOR_DATA, approxlen);
5104}
5105
5106/**
5107 * cfg80211_vendor_cmd_reply - send the reply skb
5108 * @skb: The skb, must have been allocated with
5109 * cfg80211_vendor_cmd_alloc_reply_skb()
5110 *
5111 * Since calling this function will usually be the last thing
5112 * before returning from the vendor command doit() you should
5113 * return the error code. Note that this function consumes the
5114 * skb regardless of the return value.
5115 *
5116 * Return: An error code or 0 on success.
5117 */
5118int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
5119
Johannes Berg567ffc32013-12-18 14:43:31 +01005120/**
5121 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
5122 * @wiphy: the wiphy
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02005123 * @wdev: the wireless device
Johannes Berg567ffc32013-12-18 14:43:31 +01005124 * @event_idx: index of the vendor event in the wiphy's vendor_events
5125 * @approxlen: an upper bound of the length of the data that will
5126 * be put into the skb
5127 * @gfp: allocation flags
5128 *
5129 * This function allocates and pre-fills an skb for an event on the
5130 * vendor-specific multicast group.
5131 *
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02005132 * If wdev != NULL, both the ifindex and identifier of the specified
5133 * wireless device are added to the event message before the vendor data
5134 * attribute.
5135 *
Johannes Berg567ffc32013-12-18 14:43:31 +01005136 * When done filling the skb, call cfg80211_vendor_event() with the
5137 * skb to send the event.
5138 *
5139 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
5140 */
5141static inline struct sk_buff *
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02005142cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
5143 int approxlen, int event_idx, gfp_t gfp)
Johannes Berg567ffc32013-12-18 14:43:31 +01005144{
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02005145 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
Johannes Berg567ffc32013-12-18 14:43:31 +01005146 NL80211_ATTR_VENDOR_DATA,
5147 event_idx, approxlen, gfp);
5148}
5149
5150/**
5151 * cfg80211_vendor_event - send the event
5152 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
5153 * @gfp: allocation flags
5154 *
5155 * This function sends the given @skb, which must have been allocated
5156 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
5157 */
5158static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
5159{
5160 __cfg80211_send_event_skb(skb, gfp);
5161}
5162
Johannes Bergaff89a92009-07-01 21:26:51 +02005163#ifdef CONFIG_NL80211_TESTMODE
5164/**
Johannes Bergd70e9692010-08-19 16:11:27 +02005165 * DOC: Test mode
5166 *
5167 * Test mode is a set of utility functions to allow drivers to
5168 * interact with driver-specific tools to aid, for instance,
5169 * factory programming.
5170 *
5171 * This chapter describes how drivers interact with it, for more
5172 * information see the nl80211 book's chapter on it.
5173 */
5174
5175/**
Johannes Bergaff89a92009-07-01 21:26:51 +02005176 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
5177 * @wiphy: the wiphy
5178 * @approxlen: an upper bound of the length of the data that will
5179 * be put into the skb
5180 *
5181 * This function allocates and pre-fills an skb for a reply to
5182 * the testmode command. Since it is intended for a reply, calling
5183 * it outside of the @testmode_cmd operation is invalid.
5184 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005185 * The returned skb is pre-filled with the wiphy index and set up in
5186 * a way that any data that is put into the skb (with skb_put(),
5187 * nla_put() or similar) will end up being within the
5188 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
5189 * with the skb is adding data for the corresponding userspace tool
5190 * which can then read that data out of the testdata attribute. You
5191 * must not modify the skb in any other way.
Johannes Bergaff89a92009-07-01 21:26:51 +02005192 *
5193 * When done, call cfg80211_testmode_reply() with the skb and return
5194 * its error code as the result of the @testmode_cmd operation.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005195 *
5196 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
Johannes Bergaff89a92009-07-01 21:26:51 +02005197 */
Johannes Bergad7e7182013-11-13 13:37:47 +01005198static inline struct sk_buff *
5199cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
5200{
5201 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
5202 NL80211_ATTR_TESTDATA, approxlen);
5203}
Johannes Bergaff89a92009-07-01 21:26:51 +02005204
5205/**
5206 * cfg80211_testmode_reply - send the reply skb
5207 * @skb: The skb, must have been allocated with
5208 * cfg80211_testmode_alloc_reply_skb()
5209 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005210 * Since calling this function will usually be the last thing
5211 * before returning from the @testmode_cmd you should return
5212 * the error code. Note that this function consumes the skb
5213 * regardless of the return value.
5214 *
5215 * Return: An error code or 0 on success.
Johannes Bergaff89a92009-07-01 21:26:51 +02005216 */
Johannes Bergad7e7182013-11-13 13:37:47 +01005217static inline int cfg80211_testmode_reply(struct sk_buff *skb)
5218{
5219 return cfg80211_vendor_cmd_reply(skb);
5220}
Johannes Bergaff89a92009-07-01 21:26:51 +02005221
5222/**
5223 * cfg80211_testmode_alloc_event_skb - allocate testmode event
5224 * @wiphy: the wiphy
5225 * @approxlen: an upper bound of the length of the data that will
5226 * be put into the skb
5227 * @gfp: allocation flags
5228 *
5229 * This function allocates and pre-fills an skb for an event on the
5230 * testmode multicast group.
5231 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005232 * The returned skb is set up in the same way as with
5233 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
5234 * there, you should simply add data to it that will then end up in the
5235 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
5236 * in any other way.
Johannes Bergaff89a92009-07-01 21:26:51 +02005237 *
5238 * When done filling the skb, call cfg80211_testmode_event() with the
5239 * skb to send the event.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005240 *
5241 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
Johannes Bergaff89a92009-07-01 21:26:51 +02005242 */
Johannes Berg567ffc32013-12-18 14:43:31 +01005243static inline struct sk_buff *
5244cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
5245{
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02005246 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
Johannes Berg567ffc32013-12-18 14:43:31 +01005247 NL80211_ATTR_TESTDATA, -1,
5248 approxlen, gfp);
5249}
Johannes Bergaff89a92009-07-01 21:26:51 +02005250
5251/**
5252 * cfg80211_testmode_event - send the event
5253 * @skb: The skb, must have been allocated with
5254 * cfg80211_testmode_alloc_event_skb()
5255 * @gfp: allocation flags
5256 *
5257 * This function sends the given @skb, which must have been allocated
5258 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
5259 * consumes it.
5260 */
Johannes Berg567ffc32013-12-18 14:43:31 +01005261static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
5262{
5263 __cfg80211_send_event_skb(skb, gfp);
5264}
Johannes Bergaff89a92009-07-01 21:26:51 +02005265
5266#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
Wey-Yi Guy71063f02011-05-20 09:05:54 -07005267#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
Johannes Bergaff89a92009-07-01 21:26:51 +02005268#else
5269#define CFG80211_TESTMODE_CMD(cmd)
Wey-Yi Guy71063f02011-05-20 09:05:54 -07005270#define CFG80211_TESTMODE_DUMP(cmd)
Johannes Bergaff89a92009-07-01 21:26:51 +02005271#endif
5272
Samuel Ortizb23aa672009-07-01 21:26:54 +02005273/**
Vidyullatha Kanchanapally3f1905b2017-03-31 00:22:33 +03005274 * struct cfg80211_connect_resp_params - Connection response params
5275 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
5276 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
5277 * the real status code for failures. If this call is used to report a
5278 * failure due to a timeout (e.g., not receiving an Authentication frame
5279 * from the AP) instead of an explicit rejection by the AP, -1 is used to
5280 * indicate that this is a failure, but without a status code.
5281 * @timeout_reason is used to report the reason for the timeout in that
5282 * case.
5283 * @bssid: The BSSID of the AP (may be %NULL)
5284 * @bss: Entry of bss to which STA got connected to, can be obtained through
5285 * cfg80211_get_bss() (may be %NULL). Only one parameter among @bssid and
5286 * @bss needs to be specified.
5287 * @req_ie: Association request IEs (may be %NULL)
5288 * @req_ie_len: Association request IEs length
5289 * @resp_ie: Association response IEs (may be %NULL)
5290 * @resp_ie_len: Association response IEs length
Vidyullatha Kanchanapally36eabf62017-03-31 00:22:34 +03005291 * @fils_kek: KEK derived from a successful FILS connection (may be %NULL)
5292 * @fils_kek_len: Length of @fils_kek in octets
5293 * @update_erp_next_seq_num: Boolean value to specify whether the value in
5294 * @fils_erp_next_seq_num is valid.
5295 * @fils_erp_next_seq_num: The next sequence number to use in ERP message in
5296 * FILS Authentication. This value should be specified irrespective of the
5297 * status for a FILS connection.
5298 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
5299 * @pmk_len: Length of @pmk in octets
5300 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
5301 * used for this FILS connection (may be %NULL).
Vidyullatha Kanchanapally3f1905b2017-03-31 00:22:33 +03005302 * @timeout_reason: Reason for connection timeout. This is used when the
5303 * connection fails due to a timeout instead of an explicit rejection from
5304 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
5305 * not known. This value is used only if @status < 0 to indicate that the
5306 * failure is due to a timeout and not due to explicit rejection by the AP.
5307 * This value is ignored in other cases (@status >= 0).
5308 */
5309struct cfg80211_connect_resp_params {
5310 int status;
5311 const u8 *bssid;
5312 struct cfg80211_bss *bss;
5313 const u8 *req_ie;
5314 size_t req_ie_len;
5315 const u8 *resp_ie;
5316 size_t resp_ie_len;
Vidyullatha Kanchanapally36eabf62017-03-31 00:22:34 +03005317 const u8 *fils_kek;
5318 size_t fils_kek_len;
5319 bool update_erp_next_seq_num;
5320 u16 fils_erp_next_seq_num;
5321 const u8 *pmk;
5322 size_t pmk_len;
5323 const u8 *pmkid;
Vidyullatha Kanchanapally3f1905b2017-03-31 00:22:33 +03005324 enum nl80211_timeout_reason timeout_reason;
5325};
5326
5327/**
5328 * cfg80211_connect_done - notify cfg80211 of connection result
5329 *
5330 * @dev: network device
5331 * @params: connection response parameters
5332 * @gfp: allocation flags
5333 *
5334 * It should be called by the underlying driver once execution of the connection
5335 * request from connect() has been completed. This is similar to
5336 * cfg80211_connect_bss(), but takes a structure pointer for connection response
5337 * parameters. Only one of the functions among cfg80211_connect_bss(),
5338 * cfg80211_connect_result(), cfg80211_connect_timeout(),
5339 * and cfg80211_connect_done() should be called.
5340 */
5341void cfg80211_connect_done(struct net_device *dev,
5342 struct cfg80211_connect_resp_params *params,
5343 gfp_t gfp);
5344
5345/**
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05305346 * cfg80211_connect_bss - notify cfg80211 of connection result
5347 *
5348 * @dev: network device
5349 * @bssid: the BSSID of the AP
5350 * @bss: entry of bss to which STA got connected to, can be obtained
5351 * through cfg80211_get_bss (may be %NULL)
5352 * @req_ie: association request IEs (maybe be %NULL)
5353 * @req_ie_len: association request IEs length
5354 * @resp_ie: association response IEs (may be %NULL)
5355 * @resp_ie_len: assoc response IEs length
Jouni Malinen015028f2017-01-13 01:12:22 +02005356 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
5357 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
5358 * the real status code for failures. If this call is used to report a
5359 * failure due to a timeout (e.g., not receiving an Authentication frame
5360 * from the AP) instead of an explicit rejection by the AP, -1 is used to
5361 * indicate that this is a failure, but without a status code.
5362 * @timeout_reason is used to report the reason for the timeout in that
5363 * case.
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05305364 * @gfp: allocation flags
Purushottam Kushwahadf935062017-01-13 01:12:21 +02005365 * @timeout_reason: reason for connection timeout. This is used when the
5366 * connection fails due to a timeout instead of an explicit rejection from
5367 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
5368 * not known. This value is used only if @status < 0 to indicate that the
5369 * failure is due to a timeout and not due to explicit rejection by the AP.
5370 * This value is ignored in other cases (@status >= 0).
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05305371 *
Jouni Malinen015028f2017-01-13 01:12:22 +02005372 * It should be called by the underlying driver once execution of the connection
5373 * request from connect() has been completed. This is similar to
5374 * cfg80211_connect_result(), but with the option of identifying the exact bss
Vidyullatha Kanchanapally3f1905b2017-03-31 00:22:33 +03005375 * entry for the connection. Only one of the functions among
5376 * cfg80211_connect_bss(), cfg80211_connect_result(),
5377 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05305378 */
Vidyullatha Kanchanapally3f1905b2017-03-31 00:22:33 +03005379static inline void
5380cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
5381 struct cfg80211_bss *bss, const u8 *req_ie,
5382 size_t req_ie_len, const u8 *resp_ie,
5383 size_t resp_ie_len, int status, gfp_t gfp,
5384 enum nl80211_timeout_reason timeout_reason)
5385{
5386 struct cfg80211_connect_resp_params params;
5387
5388 memset(&params, 0, sizeof(params));
5389 params.status = status;
5390 params.bssid = bssid;
5391 params.bss = bss;
5392 params.req_ie = req_ie;
5393 params.req_ie_len = req_ie_len;
5394 params.resp_ie = resp_ie;
5395 params.resp_ie_len = resp_ie_len;
5396 params.timeout_reason = timeout_reason;
5397
5398 cfg80211_connect_done(dev, &params, gfp);
5399}
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05305400
5401/**
Samuel Ortizb23aa672009-07-01 21:26:54 +02005402 * cfg80211_connect_result - notify cfg80211 of connection result
5403 *
5404 * @dev: network device
5405 * @bssid: the BSSID of the AP
5406 * @req_ie: association request IEs (maybe be %NULL)
5407 * @req_ie_len: association request IEs length
5408 * @resp_ie: association response IEs (may be %NULL)
5409 * @resp_ie_len: assoc response IEs length
Jouni Malinen015028f2017-01-13 01:12:22 +02005410 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
Samuel Ortizb23aa672009-07-01 21:26:54 +02005411 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
5412 * the real status code for failures.
5413 * @gfp: allocation flags
5414 *
Jouni Malinen015028f2017-01-13 01:12:22 +02005415 * It should be called by the underlying driver once execution of the connection
5416 * request from connect() has been completed. This is similar to
5417 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
Vidyullatha Kanchanapally3f1905b2017-03-31 00:22:33 +03005418 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
5419 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
Samuel Ortizb23aa672009-07-01 21:26:54 +02005420 */
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05305421static inline void
5422cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
5423 const u8 *req_ie, size_t req_ie_len,
5424 const u8 *resp_ie, size_t resp_ie_len,
5425 u16 status, gfp_t gfp)
5426{
5427 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
Purushottam Kushwahadf935062017-01-13 01:12:21 +02005428 resp_ie_len, status, gfp,
5429 NL80211_TIMEOUT_UNSPECIFIED);
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05305430}
Samuel Ortizb23aa672009-07-01 21:26:54 +02005431
5432/**
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03005433 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
5434 *
5435 * @dev: network device
5436 * @bssid: the BSSID of the AP
5437 * @req_ie: association request IEs (maybe be %NULL)
5438 * @req_ie_len: association request IEs length
5439 * @gfp: allocation flags
Purushottam Kushwahadf935062017-01-13 01:12:21 +02005440 * @timeout_reason: reason for connection timeout.
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03005441 *
5442 * It should be called by the underlying driver whenever connect() has failed
5443 * in a sequence where no explicit authentication/association rejection was
5444 * received from the AP. This could happen, e.g., due to not being able to send
5445 * out the Authentication or Association Request frame or timing out while
Vidyullatha Kanchanapally3f1905b2017-03-31 00:22:33 +03005446 * waiting for the response. Only one of the functions among
5447 * cfg80211_connect_bss(), cfg80211_connect_result(),
5448 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03005449 */
5450static inline void
5451cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
Purushottam Kushwahadf935062017-01-13 01:12:21 +02005452 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
5453 enum nl80211_timeout_reason timeout_reason)
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03005454{
5455 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
Purushottam Kushwahadf935062017-01-13 01:12:21 +02005456 gfp, timeout_reason);
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03005457}
5458
5459/**
Avraham Stern9e841a62017-04-26 10:58:49 +03005460 * struct cfg80211_roam_info - driver initiated roaming information
5461 *
5462 * @channel: the channel of the new AP
5463 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
5464 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
5465 * @req_ie: association request IEs (maybe be %NULL)
5466 * @req_ie_len: association request IEs length
5467 * @resp_ie: association response IEs (may be %NULL)
5468 * @resp_ie_len: assoc response IEs length
Avraham Stern562be6e2017-06-09 13:08:45 +01005469 * @authorized: true if the 802.1X authentication was done by the driver or is
5470 * not needed (e.g., when Fast Transition protocol was used), false
5471 * otherwise. Ignored for networks that don't use 802.1X authentication.
Avraham Stern9e841a62017-04-26 10:58:49 +03005472 */
5473struct cfg80211_roam_info {
5474 struct ieee80211_channel *channel;
5475 struct cfg80211_bss *bss;
5476 const u8 *bssid;
5477 const u8 *req_ie;
5478 size_t req_ie_len;
5479 const u8 *resp_ie;
5480 size_t resp_ie_len;
Avraham Stern562be6e2017-06-09 13:08:45 +01005481 bool authorized;
Avraham Stern9e841a62017-04-26 10:58:49 +03005482};
5483
5484/**
Samuel Ortizb23aa672009-07-01 21:26:54 +02005485 * cfg80211_roamed - notify cfg80211 of roaming
5486 *
5487 * @dev: network device
Avraham Stern9e841a62017-04-26 10:58:49 +03005488 * @info: information about the new BSS. struct &cfg80211_roam_info.
Samuel Ortizb23aa672009-07-01 21:26:54 +02005489 * @gfp: allocation flags
5490 *
Avraham Stern9e841a62017-04-26 10:58:49 +03005491 * This function may be called with the driver passing either the BSSID of the
5492 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
5493 * It should be called by the underlying driver whenever it roamed from one AP
5494 * to another while connected. Drivers which have roaming implemented in
5495 * firmware should pass the bss entry to avoid a race in bss entry timeout where
5496 * the bss entry of the new AP is seen in the driver, but gets timed out by the
5497 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
Vasanthakumar Thiagarajanadbde342011-12-08 14:28:47 +05305498 * rdev->event_work. In case of any failures, the reference is released
Avraham Stern9e841a62017-04-26 10:58:49 +03005499 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
5500 * released while diconneting from the current bss.
Vasanthakumar Thiagarajanadbde342011-12-08 14:28:47 +05305501 */
Avraham Stern9e841a62017-04-26 10:58:49 +03005502void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
5503 gfp_t gfp);
Vasanthakumar Thiagarajanadbde342011-12-08 14:28:47 +05305504
5505/**
Samuel Ortizb23aa672009-07-01 21:26:54 +02005506 * cfg80211_disconnected - notify cfg80211 that connection was dropped
5507 *
5508 * @dev: network device
5509 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
5510 * @ie_len: length of IEs
5511 * @reason: reason code for the disconnection, set it to 0 if unknown
Johannes Berg80279fb2015-05-22 16:22:20 +02005512 * @locally_generated: disconnection was requested locally
Samuel Ortizb23aa672009-07-01 21:26:54 +02005513 * @gfp: allocation flags
5514 *
5515 * After it calls this function, the driver should enter an idle state
5516 * and not try to connect to any AP any more.
5517 */
5518void cfg80211_disconnected(struct net_device *dev, u16 reason,
Johannes Berg80279fb2015-05-22 16:22:20 +02005519 const u8 *ie, size_t ie_len,
5520 bool locally_generated, gfp_t gfp);
Samuel Ortizb23aa672009-07-01 21:26:54 +02005521
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005522/**
5523 * cfg80211_ready_on_channel - notification of remain_on_channel start
Johannes Berg71bbc992012-06-15 15:30:18 +02005524 * @wdev: wireless device
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005525 * @cookie: the request cookie
5526 * @chan: The current channel (from remain_on_channel request)
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005527 * @duration: Duration in milliseconds that the driver intents to remain on the
5528 * channel
5529 * @gfp: allocation flags
5530 */
Johannes Berg71bbc992012-06-15 15:30:18 +02005531void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005532 struct ieee80211_channel *chan,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005533 unsigned int duration, gfp_t gfp);
5534
5535/**
5536 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
Johannes Berg71bbc992012-06-15 15:30:18 +02005537 * @wdev: wireless device
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005538 * @cookie: the request cookie
5539 * @chan: The current channel (from remain_on_channel request)
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005540 * @gfp: allocation flags
5541 */
Johannes Berg71bbc992012-06-15 15:30:18 +02005542void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005543 struct ieee80211_channel *chan,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01005544 gfp_t gfp);
Samuel Ortizb23aa672009-07-01 21:26:54 +02005545
Johannes Berg98b62182009-12-23 13:15:44 +01005546
5547/**
5548 * cfg80211_new_sta - notify userspace about station
5549 *
5550 * @dev: the netdev
5551 * @mac_addr: the station's address
5552 * @sinfo: the station information
5553 * @gfp: allocation flags
5554 */
5555void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
5556 struct station_info *sinfo, gfp_t gfp);
5557
Jouni Malinen026331c2010-02-15 12:53:10 +02005558/**
Johannes Bergcf5ead82014-11-14 17:14:00 +01005559 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
5560 * @dev: the netdev
5561 * @mac_addr: the station's address
5562 * @sinfo: the station information/statistics
5563 * @gfp: allocation flags
5564 */
5565void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
5566 struct station_info *sinfo, gfp_t gfp);
5567
5568/**
Jouni Malinenec15e682011-03-23 15:29:52 +02005569 * cfg80211_del_sta - notify userspace about deletion of a station
5570 *
5571 * @dev: the netdev
5572 * @mac_addr: the station's address
5573 * @gfp: allocation flags
5574 */
Johannes Bergcf5ead82014-11-14 17:14:00 +01005575static inline void cfg80211_del_sta(struct net_device *dev,
5576 const u8 *mac_addr, gfp_t gfp)
5577{
5578 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
5579}
Jouni Malinenec15e682011-03-23 15:29:52 +02005580
5581/**
Pandiyarajan Pitchaimuthued44a952012-09-18 16:50:49 +05305582 * cfg80211_conn_failed - connection request failed notification
5583 *
5584 * @dev: the netdev
5585 * @mac_addr: the station's address
5586 * @reason: the reason for connection failure
5587 * @gfp: allocation flags
5588 *
5589 * Whenever a station tries to connect to an AP and if the station
5590 * could not connect to the AP as the AP has rejected the connection
5591 * for some reasons, this function is called.
5592 *
5593 * The reason for connection failure can be any of the value from
5594 * nl80211_connect_failed_reason enum
5595 */
5596void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
5597 enum nl80211_connect_failed_reason reason,
5598 gfp_t gfp);
5599
5600/**
Johannes Berg2e161f72010-08-12 15:38:38 +02005601 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
Johannes Berg71bbc992012-06-15 15:30:18 +02005602 * @wdev: wireless device receiving the frame
Jouni Malinen026331c2010-02-15 12:53:10 +02005603 * @freq: Frequency on which the frame was received in MHz
Johannes Berg804483e2012-03-05 22:18:41 +01005604 * @sig_dbm: signal strength in mBm, or 0 if unknown
Johannes Berg2e161f72010-08-12 15:38:38 +02005605 * @buf: Management frame (header + body)
Jouni Malinen026331c2010-02-15 12:53:10 +02005606 * @len: length of the frame data
Vladimir Kondratiev19504cf2013-08-15 14:51:28 +03005607 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
Johannes Berg2e161f72010-08-12 15:38:38 +02005608 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005609 * This function is called whenever an Action frame is received for a station
5610 * mode interface, but is not processed in kernel.
5611 *
5612 * Return: %true if a user space application has registered for this frame.
Johannes Berg2e161f72010-08-12 15:38:38 +02005613 * For action frames, that makes it responsible for rejecting unrecognized
5614 * action frames; %false otherwise, in which case for action frames the
5615 * driver is responsible for rejecting the frame.
Jouni Malinen026331c2010-02-15 12:53:10 +02005616 */
Johannes Berg71bbc992012-06-15 15:30:18 +02005617bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
Vladimir Kondratiev970fdfa2014-08-11 03:29:57 -07005618 const u8 *buf, size_t len, u32 flags);
Jouni Malinen026331c2010-02-15 12:53:10 +02005619
5620/**
Johannes Berg2e161f72010-08-12 15:38:38 +02005621 * cfg80211_mgmt_tx_status - notification of TX status for management frame
Johannes Berg71bbc992012-06-15 15:30:18 +02005622 * @wdev: wireless device receiving the frame
Johannes Berg2e161f72010-08-12 15:38:38 +02005623 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
5624 * @buf: Management frame (header + body)
Jouni Malinen026331c2010-02-15 12:53:10 +02005625 * @len: length of the frame data
5626 * @ack: Whether frame was acknowledged
5627 * @gfp: context flags
5628 *
Johannes Berg2e161f72010-08-12 15:38:38 +02005629 * This function is called whenever a management frame was requested to be
5630 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
Jouni Malinen026331c2010-02-15 12:53:10 +02005631 * transmission attempt.
5632 */
Johannes Berg71bbc992012-06-15 15:30:18 +02005633void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
Johannes Berg2e161f72010-08-12 15:38:38 +02005634 const u8 *buf, size_t len, bool ack, gfp_t gfp);
Jouni Malinen026331c2010-02-15 12:53:10 +02005635
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02005636
5637/**
5638 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
5639 * @dev: network device
5640 * @rssi_event: the triggered RSSI event
5641 * @gfp: context flags
5642 *
5643 * This function is called when a configured connection quality monitoring
5644 * rssi threshold reached event occurs.
5645 */
5646void cfg80211_cqm_rssi_notify(struct net_device *dev,
5647 enum nl80211_cqm_rssi_threshold_event rssi_event,
5648 gfp_t gfp);
5649
Johannes Bergc063dbf2010-11-24 08:10:05 +01005650/**
5651 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
5652 * @dev: network device
5653 * @peer: peer's MAC address
5654 * @num_packets: how many packets were lost -- should be a fixed threshold
5655 * but probably no less than maybe 50, or maybe a throughput dependent
5656 * threshold (to account for temporary interference)
5657 * @gfp: context flags
5658 */
5659void cfg80211_cqm_pktloss_notify(struct net_device *dev,
5660 const u8 *peer, u32 num_packets, gfp_t gfp);
5661
Johannes Berge5497d72011-07-05 16:35:40 +02005662/**
Thomas Pedersen84f10702012-07-12 16:17:33 -07005663 * cfg80211_cqm_txe_notify - TX error rate event
5664 * @dev: network device
5665 * @peer: peer's MAC address
5666 * @num_packets: how many packets were lost
5667 * @rate: % of packets which failed transmission
5668 * @intvl: interval (in s) over which the TX failure threshold was breached.
5669 * @gfp: context flags
5670 *
5671 * Notify userspace when configured % TX failures over number of packets in a
5672 * given interval is exceeded.
5673 */
5674void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
5675 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
5676
5677/**
Johannes Berg98f03342014-11-26 12:42:02 +01005678 * cfg80211_cqm_beacon_loss_notify - beacon loss event
5679 * @dev: network device
5680 * @gfp: context flags
5681 *
5682 * Notify userspace about beacon loss from the connected AP.
5683 */
5684void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
5685
5686/**
Johannes Berg5b97f492014-11-26 12:37:43 +01005687 * cfg80211_radar_event - radar detection event
5688 * @wiphy: the wiphy
5689 * @chandef: chandef for the current channel
5690 * @gfp: context flags
5691 *
5692 * This function is called when a radar is detected on the current chanenl.
5693 */
5694void cfg80211_radar_event(struct wiphy *wiphy,
5695 struct cfg80211_chan_def *chandef, gfp_t gfp);
5696
5697/**
5698 * cfg80211_cac_event - Channel availability check (CAC) event
5699 * @netdev: network device
5700 * @chandef: chandef for the current channel
5701 * @event: type of event
5702 * @gfp: context flags
5703 *
5704 * This function is called when a Channel availability check (CAC) is finished
5705 * or aborted. This must be called to notify the completion of a CAC process,
5706 * also by full-MAC drivers.
5707 */
5708void cfg80211_cac_event(struct net_device *netdev,
5709 const struct cfg80211_chan_def *chandef,
5710 enum nl80211_radar_event event, gfp_t gfp);
5711
5712
5713/**
Johannes Berge5497d72011-07-05 16:35:40 +02005714 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
5715 * @dev: network device
5716 * @bssid: BSSID of AP (to avoid races)
5717 * @replay_ctr: new replay counter
Johannes Bergaf71ff82011-07-09 14:48:30 +02005718 * @gfp: allocation flags
Johannes Berge5497d72011-07-05 16:35:40 +02005719 */
5720void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
5721 const u8 *replay_ctr, gfp_t gfp);
5722
Jouni Malinenc9df56b2011-09-16 18:56:23 +03005723/**
5724 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
5725 * @dev: network device
5726 * @index: candidate index (the smaller the index, the higher the priority)
5727 * @bssid: BSSID of AP
5728 * @preauth: Whether AP advertises support for RSN pre-authentication
5729 * @gfp: allocation flags
5730 */
5731void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
5732 const u8 *bssid, bool preauth, gfp_t gfp);
5733
Johannes Berg28946da2011-11-04 11:18:12 +01005734/**
5735 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
5736 * @dev: The device the frame matched to
5737 * @addr: the transmitter address
5738 * @gfp: context flags
5739 *
5740 * This function is used in AP mode (only!) to inform userspace that
5741 * a spurious class 3 frame was received, to be able to deauth the
5742 * sender.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005743 * Return: %true if the frame was passed to userspace (or this failed
Johannes Berg28946da2011-11-04 11:18:12 +01005744 * for a reason other than not having a subscription.)
5745 */
5746bool cfg80211_rx_spurious_frame(struct net_device *dev,
5747 const u8 *addr, gfp_t gfp);
5748
Johannes Berg7f6cf312011-11-04 11:18:15 +01005749/**
Johannes Bergb92ab5d2011-11-04 11:18:19 +01005750 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
5751 * @dev: The device the frame matched to
5752 * @addr: the transmitter address
5753 * @gfp: context flags
5754 *
5755 * This function is used in AP mode (only!) to inform userspace that
5756 * an associated station sent a 4addr frame but that wasn't expected.
5757 * It is allowed and desirable to send this event only once for each
5758 * station to avoid event flooding.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005759 * Return: %true if the frame was passed to userspace (or this failed
Johannes Bergb92ab5d2011-11-04 11:18:19 +01005760 * for a reason other than not having a subscription.)
5761 */
5762bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
5763 const u8 *addr, gfp_t gfp);
5764
5765/**
Johannes Berg7f6cf312011-11-04 11:18:15 +01005766 * cfg80211_probe_status - notify userspace about probe status
5767 * @dev: the device the probe was sent on
5768 * @addr: the address of the peer
5769 * @cookie: the cookie filled in @probe_client previously
5770 * @acked: indicates whether probe was acked or not
5771 * @gfp: allocation flags
5772 */
5773void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
5774 u64 cookie, bool acked, gfp_t gfp);
5775
Johannes Berg5e7602302011-11-04 11:18:17 +01005776/**
5777 * cfg80211_report_obss_beacon - report beacon from other APs
5778 * @wiphy: The wiphy that received the beacon
5779 * @frame: the frame
5780 * @len: length of the frame
5781 * @freq: frequency the frame was received on
Johannes Berg804483e2012-03-05 22:18:41 +01005782 * @sig_dbm: signal strength in mBm, or 0 if unknown
Johannes Berg5e7602302011-11-04 11:18:17 +01005783 *
5784 * Use this function to report to userspace when a beacon was
5785 * received. It is not useful to call this when there is no
5786 * netdev that is in AP/GO mode.
5787 */
5788void cfg80211_report_obss_beacon(struct wiphy *wiphy,
5789 const u8 *frame, size_t len,
Ben Greear37c73b52012-10-26 14:49:25 -07005790 int freq, int sig_dbm);
Johannes Berg5e7602302011-11-04 11:18:17 +01005791
Johannes Bergd58e7e32012-05-16 23:50:17 +02005792/**
Johannes Berg683b6d32012-11-08 21:25:48 +01005793 * cfg80211_reg_can_beacon - check if beaconing is allowed
Alexander Simon54858ee5b2011-11-30 16:56:32 +01005794 * @wiphy: the wiphy
Johannes Berg683b6d32012-11-08 21:25:48 +01005795 * @chandef: the channel definition
Ilan Peer174e0cd2014-02-23 09:13:01 +02005796 * @iftype: interface type
Johannes Bergd58e7e32012-05-16 23:50:17 +02005797 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005798 * Return: %true if there is no secondary channel or the secondary channel(s)
5799 * can be used for beaconing (i.e. is not a radar channel etc.)
Alexander Simon54858ee5b2011-11-30 16:56:32 +01005800 */
Johannes Berg683b6d32012-11-08 21:25:48 +01005801bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
Ilan Peer174e0cd2014-02-23 09:13:01 +02005802 struct cfg80211_chan_def *chandef,
5803 enum nl80211_iftype iftype);
Alexander Simon54858ee5b2011-11-30 16:56:32 +01005804
Arik Nemtsov923b3522015-07-08 15:41:44 +03005805/**
5806 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
5807 * @wiphy: the wiphy
5808 * @chandef: the channel definition
5809 * @iftype: interface type
5810 *
5811 * Return: %true if there is no secondary channel or the secondary channel(s)
5812 * can be used for beaconing (i.e. is not a radar channel etc.). This version
5813 * also checks if IR-relaxation conditions apply, to allow beaconing under
5814 * more permissive conditions.
5815 *
5816 * Requires the RTNL to be held.
5817 */
5818bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
5819 struct cfg80211_chan_def *chandef,
5820 enum nl80211_iftype iftype);
5821
Thomas Pedersen8097e142012-03-05 15:31:47 -08005822/*
Thomas Pedersen53145262012-04-06 13:35:47 -07005823 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
5824 * @dev: the device which switched channels
Johannes Berg683b6d32012-11-08 21:25:48 +01005825 * @chandef: the new channel definition
Thomas Pedersen53145262012-04-06 13:35:47 -07005826 *
Simon Wunderliche487eae2013-11-21 18:19:51 +01005827 * Caller must acquire wdev_lock, therefore must only be called from sleepable
5828 * driver context!
Thomas Pedersen53145262012-04-06 13:35:47 -07005829 */
Johannes Berg683b6d32012-11-08 21:25:48 +01005830void cfg80211_ch_switch_notify(struct net_device *dev,
5831 struct cfg80211_chan_def *chandef);
Thomas Pedersen53145262012-04-06 13:35:47 -07005832
Luciano Coelhof8d75522014-11-07 14:31:35 +02005833/*
5834 * cfg80211_ch_switch_started_notify - notify channel switch start
5835 * @dev: the device on which the channel switch started
5836 * @chandef: the future channel definition
5837 * @count: the number of TBTTs until the channel switch happens
5838 *
5839 * Inform the userspace about the channel switch that has just
5840 * started, so that it can take appropriate actions (eg. starting
5841 * channel switch on other vifs), if necessary.
5842 */
5843void cfg80211_ch_switch_started_notify(struct net_device *dev,
5844 struct cfg80211_chan_def *chandef,
5845 u8 count);
5846
Johannes Berg1ce3e822012-08-01 17:00:55 +02005847/**
5848 * ieee80211_operating_class_to_band - convert operating class to band
5849 *
5850 * @operating_class: the operating class to convert
5851 * @band: band pointer to fill
5852 *
5853 * Returns %true if the conversion was successful, %false otherwise.
5854 */
5855bool ieee80211_operating_class_to_band(u8 operating_class,
Johannes Berg57fbcce2016-04-12 15:56:15 +02005856 enum nl80211_band *band);
Johannes Berg1ce3e822012-08-01 17:00:55 +02005857
Arik Nemtsova38700d2015-03-18 08:46:08 +02005858/**
5859 * ieee80211_chandef_to_operating_class - convert chandef to operation class
5860 *
5861 * @chandef: the chandef to convert
5862 * @op_class: a pointer to the resulting operating class
5863 *
5864 * Returns %true if the conversion was successful, %false otherwise.
5865 */
5866bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
5867 u8 *op_class);
5868
Thomas Pedersen53145262012-04-06 13:35:47 -07005869/*
Jouni Malinen3475b092012-11-16 22:49:57 +02005870 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
5871 * @dev: the device on which the operation is requested
5872 * @peer: the MAC address of the peer device
5873 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
5874 * NL80211_TDLS_TEARDOWN)
5875 * @reason_code: the reason code for teardown request
5876 * @gfp: allocation flags
5877 *
5878 * This function is used to request userspace to perform TDLS operation that
5879 * requires knowledge of keys, i.e., link setup or teardown when the AP
5880 * connection uses encryption. This is optional mechanism for the driver to use
5881 * if it can automatically determine when a TDLS link could be useful (e.g.,
5882 * based on traffic and signal strength for a peer).
5883 */
5884void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
5885 enum nl80211_tdls_operation oper,
5886 u16 reason_code, gfp_t gfp);
5887
5888/*
Thomas Pedersen8097e142012-03-05 15:31:47 -08005889 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
5890 * @rate: given rate_info to calculate bitrate from
5891 *
5892 * return 0 if MCS index >= 32
5893 */
Vladimir Kondratiev8eb41c82012-07-05 14:25:49 +03005894u32 cfg80211_calculate_bitrate(struct rate_info *rate);
Thomas Pedersen8097e142012-03-05 15:31:47 -08005895
Johannes Berg98104fde2012-06-16 00:19:54 +02005896/**
5897 * cfg80211_unregister_wdev - remove the given wdev
5898 * @wdev: struct wireless_dev to remove
5899 *
5900 * Call this function only for wdevs that have no netdev assigned,
5901 * e.g. P2P Devices. It removes the device from the list so that
5902 * it can no longer be used. It is necessary to call this function
5903 * even when cfg80211 requests the removal of the interface by
5904 * calling the del_virtual_intf() callback. The function must also
5905 * be called when the driver wishes to unregister the wdev, e.g.
5906 * when the device is unbound from the driver.
5907 *
5908 * Requires the RTNL to be held.
5909 */
5910void cfg80211_unregister_wdev(struct wireless_dev *wdev);
5911
Johannes Berg0ee45352012-10-29 19:48:40 +01005912/**
Jouni Malinen355199e2013-02-27 17:14:27 +02005913 * struct cfg80211_ft_event - FT Information Elements
5914 * @ies: FT IEs
5915 * @ies_len: length of the FT IE in bytes
5916 * @target_ap: target AP's MAC address
5917 * @ric_ies: RIC IE
5918 * @ric_ies_len: length of the RIC IE in bytes
5919 */
5920struct cfg80211_ft_event_params {
5921 const u8 *ies;
5922 size_t ies_len;
5923 const u8 *target_ap;
5924 const u8 *ric_ies;
5925 size_t ric_ies_len;
5926};
5927
5928/**
5929 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
5930 * @netdev: network device
5931 * @ft_event: IE information
5932 */
5933void cfg80211_ft_event(struct net_device *netdev,
5934 struct cfg80211_ft_event_params *ft_event);
5935
5936/**
Johannes Berg0ee45352012-10-29 19:48:40 +01005937 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
5938 * @ies: the input IE buffer
5939 * @len: the input length
5940 * @attr: the attribute ID to find
5941 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
5942 * if the function is only called to get the needed buffer size
5943 * @bufsize: size of the output buffer
5944 *
5945 * The function finds a given P2P attribute in the (vendor) IEs and
5946 * copies its contents to the given buffer.
5947 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005948 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
5949 * malformed or the attribute can't be found (respectively), or the
5950 * length of the found attribute (which can be zero).
Johannes Berg0ee45352012-10-29 19:48:40 +01005951 */
Arend van Sprielc216e642012-11-25 19:13:28 +01005952int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
5953 enum ieee80211_p2p_attr_id attr,
5954 u8 *buf, unsigned int bufsize);
Johannes Berg0ee45352012-10-29 19:48:40 +01005955
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01005956/**
Johannes Berg29464cc2015-03-31 15:36:22 +02005957 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
5958 * @ies: the IE buffer
5959 * @ielen: the length of the IE buffer
5960 * @ids: an array with element IDs that are allowed before
5961 * the split
5962 * @n_ids: the size of the element ID array
5963 * @after_ric: array IE types that come after the RIC element
5964 * @n_after_ric: size of the @after_ric array
5965 * @offset: offset where to start splitting in the buffer
5966 *
5967 * This function splits an IE buffer by updating the @offset
5968 * variable to point to the location where the buffer should be
5969 * split.
5970 *
5971 * It assumes that the given IE buffer is well-formed, this
5972 * has to be guaranteed by the caller!
5973 *
5974 * It also assumes that the IEs in the buffer are ordered
5975 * correctly, if not the result of using this function will not
5976 * be ordered correctly either, i.e. it does no reordering.
5977 *
5978 * The function returns the offset where the next part of the
5979 * buffer starts, which may be @ielen if the entire (remainder)
5980 * of the buffer should be used.
5981 */
5982size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
5983 const u8 *ids, int n_ids,
5984 const u8 *after_ric, int n_after_ric,
5985 size_t offset);
5986
5987/**
5988 * ieee80211_ie_split - split an IE buffer according to ordering
5989 * @ies: the IE buffer
5990 * @ielen: the length of the IE buffer
5991 * @ids: an array with element IDs that are allowed before
5992 * the split
5993 * @n_ids: the size of the element ID array
5994 * @offset: offset where to start splitting in the buffer
5995 *
5996 * This function splits an IE buffer by updating the @offset
5997 * variable to point to the location where the buffer should be
5998 * split.
5999 *
6000 * It assumes that the given IE buffer is well-formed, this
6001 * has to be guaranteed by the caller!
6002 *
6003 * It also assumes that the IEs in the buffer are ordered
6004 * correctly, if not the result of using this function will not
6005 * be ordered correctly either, i.e. it does no reordering.
6006 *
6007 * The function returns the offset where the next part of the
6008 * buffer starts, which may be @ielen if the entire (remainder)
6009 * of the buffer should be used.
6010 */
Johannes Berg0483eea2015-10-23 09:50:03 +02006011static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
6012 const u8 *ids, int n_ids, size_t offset)
6013{
6014 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
6015}
Johannes Berg29464cc2015-03-31 15:36:22 +02006016
6017/**
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01006018 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
6019 * @wdev: the wireless device reporting the wakeup
6020 * @wakeup: the wakeup report
6021 * @gfp: allocation flags
6022 *
6023 * This function reports that the given device woke up. If it
6024 * caused the wakeup, report the reason(s), otherwise you may
6025 * pass %NULL as the @wakeup parameter to advertise that something
6026 * else caused the wakeup.
6027 */
6028void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
6029 struct cfg80211_wowlan_wakeup *wakeup,
6030 gfp_t gfp);
6031
Arend van Spriel5de17982013-04-18 15:49:00 +02006032/**
6033 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
6034 *
6035 * @wdev: the wireless device for which critical protocol is stopped.
Robert P. J. Day03f831a2013-05-02 07:15:09 -04006036 * @gfp: allocation flags
Arend van Spriel5de17982013-04-18 15:49:00 +02006037 *
6038 * This function can be called by the driver to indicate it has reverted
6039 * operation back to normal. One reason could be that the duration given
6040 * by .crit_proto_start() has expired.
6041 */
6042void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
6043
Ilan Peerbdfbec22014-01-09 11:37:23 +02006044/**
Sameer Thalappilfaa4c4a2013-07-05 14:58:32 -07006045 * cfg80211_ap_stopped - notify userspace that AP mode stopped
6046 * @netdev: network device
6047 * @gfp: context flags
6048 */
6049void cfg80211_ap_stopped(struct net_device *netdev, gfp_t gfp);
6050
6051/**
Ilan Peerbdfbec22014-01-09 11:37:23 +02006052 * ieee80211_get_num_supported_channels - get number of channels device has
6053 * @wiphy: the wiphy
6054 *
6055 * Return: the number of channels supported by the device.
6056 */
6057unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
6058
Luciano Coelhocb2d9562014-02-17 16:52:35 +02006059/**
6060 * cfg80211_check_combinations - check interface combinations
6061 *
6062 * @wiphy: the wiphy
Purushottam Kushwaha11716392016-10-12 18:25:35 +05306063 * @params: the interface combinations parameter
Luciano Coelhocb2d9562014-02-17 16:52:35 +02006064 *
6065 * This function can be called by the driver to check whether a
6066 * combination of interfaces and their types are allowed according to
6067 * the interface combinations.
6068 */
6069int cfg80211_check_combinations(struct wiphy *wiphy,
Purushottam Kushwaha11716392016-10-12 18:25:35 +05306070 struct iface_combination_params *params);
Luciano Coelhocb2d9562014-02-17 16:52:35 +02006071
Michal Kazior65a124d2014-04-09 15:29:22 +02006072/**
6073 * cfg80211_iter_combinations - iterate over matching combinations
6074 *
6075 * @wiphy: the wiphy
Purushottam Kushwaha11716392016-10-12 18:25:35 +05306076 * @params: the interface combinations parameter
Michal Kazior65a124d2014-04-09 15:29:22 +02006077 * @iter: function to call for each matching combination
6078 * @data: pointer to pass to iter function
6079 *
6080 * This function can be called by the driver to check what possible
6081 * combinations it fits in at a given moment, e.g. for channel switching
6082 * purposes.
6083 */
6084int cfg80211_iter_combinations(struct wiphy *wiphy,
Purushottam Kushwaha11716392016-10-12 18:25:35 +05306085 struct iface_combination_params *params,
Michal Kazior65a124d2014-04-09 15:29:22 +02006086 void (*iter)(const struct ieee80211_iface_combination *c,
6087 void *data),
6088 void *data);
6089
Michal Kaziorf04c2202014-04-09 15:11:01 +02006090/*
6091 * cfg80211_stop_iface - trigger interface disconnection
6092 *
6093 * @wiphy: the wiphy
6094 * @wdev: wireless device
6095 * @gfp: context flags
6096 *
6097 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
6098 * disconnected.
6099 *
6100 * Note: This doesn't need any locks and is asynchronous.
6101 */
6102void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
6103 gfp_t gfp);
6104
Johannes Bergf6837ba2014-04-30 14:19:04 +02006105/**
6106 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
6107 * @wiphy: the wiphy to shut down
6108 *
6109 * This function shuts down all interfaces belonging to this wiphy by
6110 * calling dev_close() (and treating non-netdev interfaces as needed).
6111 * It shouldn't really be used unless there are some fatal device errors
6112 * that really can't be recovered in any other way.
6113 *
6114 * Callers must hold the RTNL and be able to deal with callbacks into
6115 * the driver while the function is running.
6116 */
6117void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
6118
Gautam Kumar Shuklad75bb062014-12-23 16:55:19 +01006119/**
6120 * wiphy_ext_feature_set - set the extended feature flag
6121 *
6122 * @wiphy: the wiphy to modify.
6123 * @ftidx: extended feature bit index.
6124 *
6125 * The extended features are flagged in multiple bytes (see
6126 * &struct wiphy.@ext_features)
6127 */
6128static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
6129 enum nl80211_ext_feature_index ftidx)
6130{
6131 u8 *ft_byte;
6132
6133 ft_byte = &wiphy->ext_features[ftidx / 8];
6134 *ft_byte |= BIT(ftidx % 8);
6135}
6136
6137/**
6138 * wiphy_ext_feature_isset - check the extended feature flag
6139 *
6140 * @wiphy: the wiphy to modify.
6141 * @ftidx: extended feature bit index.
6142 *
6143 * The extended features are flagged in multiple bytes (see
6144 * &struct wiphy.@ext_features)
6145 */
6146static inline bool
6147wiphy_ext_feature_isset(struct wiphy *wiphy,
6148 enum nl80211_ext_feature_index ftidx)
6149{
6150 u8 ft_byte;
6151
6152 ft_byte = wiphy->ext_features[ftidx / 8];
6153 return (ft_byte & BIT(ftidx % 8)) != 0;
6154}
Johannes Bergb7ffbd72014-06-04 17:31:56 +02006155
Ayala Bekera442b762016-09-20 17:31:15 +03006156/**
6157 * cfg80211_free_nan_func - free NAN function
6158 * @f: NAN function that should be freed
6159 *
6160 * Frees all the NAN function and all it's allocated members.
6161 */
6162void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
6163
Ayala Beker50bcd312016-09-20 17:31:17 +03006164/**
6165 * struct cfg80211_nan_match_params - NAN match parameters
6166 * @type: the type of the function that triggered a match. If it is
6167 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
6168 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
6169 * result.
6170 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
6171 * @inst_id: the local instance id
6172 * @peer_inst_id: the instance id of the peer's function
6173 * @addr: the MAC address of the peer
6174 * @info_len: the length of the &info
6175 * @info: the Service Specific Info from the peer (if any)
6176 * @cookie: unique identifier of the corresponding function
6177 */
6178struct cfg80211_nan_match_params {
6179 enum nl80211_nan_function_type type;
6180 u8 inst_id;
6181 u8 peer_inst_id;
6182 const u8 *addr;
6183 u8 info_len;
6184 const u8 *info;
6185 u64 cookie;
6186};
6187
6188/**
6189 * cfg80211_nan_match - report a match for a NAN function.
6190 * @wdev: the wireless device reporting the match
6191 * @match: match notification parameters
6192 * @gfp: allocation flags
6193 *
6194 * This function reports that the a NAN function had a match. This
6195 * can be a subscribe that had a match or a solicited publish that
6196 * was sent. It can also be a follow up that was received.
6197 */
6198void cfg80211_nan_match(struct wireless_dev *wdev,
6199 struct cfg80211_nan_match_params *match, gfp_t gfp);
6200
Ayala Beker368e5a72016-09-20 17:31:18 +03006201/**
6202 * cfg80211_nan_func_terminated - notify about NAN function termination.
6203 *
6204 * @wdev: the wireless device reporting the match
6205 * @inst_id: the local instance id
6206 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
6207 * @cookie: unique NAN function identifier
6208 * @gfp: allocation flags
6209 *
6210 * This function reports that the a NAN function is terminated.
6211 */
6212void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
6213 u8 inst_id,
6214 enum nl80211_nan_func_term_reason reason,
6215 u64 cookie, gfp_t gfp);
6216
Johannes Bergb7ffbd72014-06-04 17:31:56 +02006217/* ethtool helper */
6218void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
6219
Johannes Berg7c62e272014-02-25 15:04:46 -08006220/**
6221 * cfg80211_is_gratuitous_arp_unsolicited_na - packet is grat. ARP/unsol. NA
6222 * @skb: the input packet, must be an ethernet frame already
6223 *
6224 * Return: %true if the packet is a gratuitous ARP or unsolicited NA packet.
6225 * This is used to drop packets that shouldn't occur because the AP implements
6226 * a proxy service.
6227 */
6228bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb);
6229
Srinivas Dasarid041a1a2018-02-07 18:32:17 +05306230/**
6231 * cfg80211_external_auth_request - userspace request for authentication
6232 * @netdev: network device
6233 * @params: External authentication parameters
6234 * @gfp: allocation flags
6235 * Returns: 0 on success, < 0 on error
6236 */
6237int cfg80211_external_auth_request(struct net_device *netdev,
6238 struct cfg80211_external_auth_params *params,
6239 gfp_t gfp);
6240
Joe Perchese1db74f2010-07-26 14:39:57 -07006241/* Logging, debugging and troubleshooting/diagnostic helpers. */
6242
6243/* wiphy_printk helpers, similar to dev_printk */
6244
6245#define wiphy_printk(level, wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006246 dev_printk(level, &(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07006247#define wiphy_emerg(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006248 dev_emerg(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07006249#define wiphy_alert(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006250 dev_alert(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07006251#define wiphy_crit(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006252 dev_crit(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07006253#define wiphy_err(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006254 dev_err(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07006255#define wiphy_warn(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006256 dev_warn(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07006257#define wiphy_notice(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006258 dev_notice(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07006259#define wiphy_info(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006260 dev_info(&(wiphy)->dev, format, ##args)
Joe Perches073730d2010-07-26 14:40:00 -07006261
Joe Perches9c376632010-08-20 15:13:59 -07006262#define wiphy_debug(wiphy, format, args...) \
Joe Perchese1db74f2010-07-26 14:39:57 -07006263 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
Joe Perches9c376632010-08-20 15:13:59 -07006264
Joe Perchese1db74f2010-07-26 14:39:57 -07006265#define wiphy_dbg(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07006266 dev_dbg(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07006267
6268#if defined(VERBOSE_DEBUG)
6269#define wiphy_vdbg wiphy_dbg
6270#else
Joe Perchese1db74f2010-07-26 14:39:57 -07006271#define wiphy_vdbg(wiphy, format, args...) \
6272({ \
6273 if (0) \
6274 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
Joe Perches9c376632010-08-20 15:13:59 -07006275 0; \
Joe Perchese1db74f2010-07-26 14:39:57 -07006276})
6277#endif
6278
6279/*
6280 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
6281 * of using a WARN/WARN_ON to get the message out, including the
6282 * file/line information and a backtrace.
6283 */
6284#define wiphy_WARN(wiphy, format, args...) \
6285 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
6286
Sunil Dutt6e200822019-04-09 13:09:28 +05306287/**
6288 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
6289 * @netdev: network device
6290 * @owe_info: peer's owe info
6291 * @gfp: allocation flags
6292 */
6293void cfg80211_update_owe_info_event(struct net_device *netdev,
6294 struct cfg80211_update_owe_info *owe_info,
6295 gfp_t gfp);
6296
Johannes Berg704232c2007-04-23 12:20:05 -07006297#endif /* __NET_CFG80211_H */