blob: d9b67eed4f75973da818b13f785dd1c15bb407f5 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Johannes Berg704232c2007-04-23 12:20:05 -07002#ifndef __NET_CFG80211_H
3#define __NET_CFG80211_H
Johannes Bergd3236552009-04-20 14:31:42 +02004/*
5 * 802.11 device and configuration interface
6 *
Jouni Malinen026331c2010-02-15 12:53:10 +02007 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
Johannes Berg2740f0c2014-09-03 15:24:58 +03008 * Copyright 2013-2014 Intel Mobile Communications GmbH
Luca Coelho85859892017-02-08 15:00:34 +02009 * Copyright 2015-2017 Intel Deutschland GmbH
Shaul Triebitz7e8d6f12020-01-31 13:12:54 +020010 * Copyright (C) 2018-2020 Intel Corporation
Johannes Bergd3236552009-04-20 14:31:42 +020011 */
Johannes Berg704232c2007-04-23 12:20:05 -070012
Jakub Kicinskicc698372020-11-20 14:50:52 -080013#include <linux/ethtool.h>
Johannes Bergd3236552009-04-20 14:31:42 +020014#include <linux/netdevice.h>
15#include <linux/debugfs.h>
16#include <linux/list.h>
Paul Gortmaker187f1882011-11-23 20:12:59 -050017#include <linux/bug.h>
Johannes Berg704232c2007-04-23 12:20:05 -070018#include <linux/netlink.h>
19#include <linux/skbuff.h>
Johannes Berg55682962007-09-20 13:09:35 -040020#include <linux/nl80211.h>
Johannes Berg2a519312009-02-10 21:25:55 +010021#include <linux/if_ether.h>
22#include <linux/ieee80211.h>
Johannes Berg2a0e0472013-01-23 22:57:40 +010023#include <linux/net.h>
Johannes Bergd3236552009-04-20 14:31:42 +020024#include <net/regulatory.h>
25
Johannes Bergd70e9692010-08-19 16:11:27 +020026/**
27 * DOC: Introduction
28 *
29 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
30 * userspace and drivers, and offers some utility functionality associated
31 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
32 * by all modern wireless drivers in Linux, so that they offer a consistent
33 * API through nl80211. For backward compatibility, cfg80211 also offers
34 * wireless extensions to userspace, but hides them from drivers completely.
35 *
36 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
37 * use restrictions.
38 */
39
40
41/**
42 * DOC: Device registration
43 *
44 * In order for a driver to use cfg80211, it must register the hardware device
45 * with cfg80211. This happens through a number of hardware capability structs
46 * described below.
47 *
48 * The fundamental structure for each device is the 'wiphy', of which each
49 * instance describes a physical wireless device connected to the system. Each
50 * such wiphy can have zero, one, or many virtual interfaces associated with
51 * it, which need to be identified as such by pointing the network interface's
52 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
53 * the wireless part of the interface, normally this struct is embedded in the
54 * network interface's private data area. Drivers can optionally allow creating
55 * or destroying virtual interfaces on the fly, but without at least one or the
56 * ability to create some the wireless device isn't useful.
57 *
58 * Each wiphy structure contains device capability information, and also has
59 * a pointer to the various operations the driver offers. The definitions and
60 * structures here describe these capabilities in detail.
61 */
62
Johannes Berg9f5e8f62012-11-22 16:59:45 +010063struct wiphy;
64
Johannes Berg704232c2007-04-23 12:20:05 -070065/*
Johannes Bergd3236552009-04-20 14:31:42 +020066 * wireless hardware capability structures
67 */
68
69/**
Johannes Bergd3236552009-04-20 14:31:42 +020070 * enum ieee80211_channel_flags - channel flags
71 *
72 * Channel flags set by the regulatory control code.
73 *
74 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
Luis R. Rodriguez8fe02e12013-10-21 19:22:25 +020075 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
Jérôme Pouillercd9b52b2020-02-21 12:56:04 +010076 * sending probe requests or beaconing.
Johannes Bergd3236552009-04-20 14:31:42 +020077 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
Luis R. Rodriguez689da1b2009-05-02 00:37:18 -040078 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
Jérôme Pouillercd9b52b2020-02-21 12:56:04 +010079 * is not permitted.
Luis R. Rodriguez689da1b2009-05-02 00:37:18 -040080 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
Jérôme Pouillercd9b52b2020-02-21 12:56:04 +010081 * is not permitted.
Seth Forshee03f6b082012-08-01 15:58:42 -050082 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
Johannes Bergc7a6ee22012-12-12 17:50:39 +010083 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
84 * this flag indicates that an 80 MHz channel cannot use this
85 * channel as the control or any of the secondary channels.
86 * This may be due to the driver or due to regulatory bandwidth
87 * restrictions.
88 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
89 * this flag indicates that an 160 MHz channel cannot use this
90 * channel as the control or any of the secondary channels.
91 * This may be due to the driver or due to regulatory bandwidth
92 * restrictions.
David Spinadel570dbde2014-02-23 09:12:59 +020093 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
Arik Nemtsov06f207f2015-05-06 16:28:31 +030094 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
Rostislav Lisovyea077c12014-04-15 14:37:55 +020095 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
96 * on this channel.
97 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
98 * on this channel.
Haim Dreyfuss1e61d822020-01-21 10:12:13 +020099 * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
Thomas Pedersend65a9772020-09-08 12:03:03 -0700100 * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
101 * on this channel.
102 * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
103 * on this channel.
104 * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
105 * on this channel.
106 * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
107 * on this channel.
108 * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
109 * on this channel.
David Spinadel570dbde2014-02-23 09:12:59 +0200110 *
Johannes Bergd3236552009-04-20 14:31:42 +0200111 */
112enum ieee80211_channel_flags {
113 IEEE80211_CHAN_DISABLED = 1<<0,
Luis R. Rodriguez8fe02e12013-10-21 19:22:25 +0200114 IEEE80211_CHAN_NO_IR = 1<<1,
115 /* hole at 1<<2 */
Johannes Bergd3236552009-04-20 14:31:42 +0200116 IEEE80211_CHAN_RADAR = 1<<3,
Luis R. Rodriguez689da1b2009-05-02 00:37:18 -0400117 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
118 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
Seth Forshee03f6b082012-08-01 15:58:42 -0500119 IEEE80211_CHAN_NO_OFDM = 1<<6,
Johannes Bergc7a6ee22012-12-12 17:50:39 +0100120 IEEE80211_CHAN_NO_80MHZ = 1<<7,
121 IEEE80211_CHAN_NO_160MHZ = 1<<8,
David Spinadel570dbde2014-02-23 09:12:59 +0200122 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
Arik Nemtsov06f207f2015-05-06 16:28:31 +0300123 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
Rostislav Lisovyea077c12014-04-15 14:37:55 +0200124 IEEE80211_CHAN_NO_20MHZ = 1<<11,
125 IEEE80211_CHAN_NO_10MHZ = 1<<12,
Haim Dreyfuss1e61d822020-01-21 10:12:13 +0200126 IEEE80211_CHAN_NO_HE = 1<<13,
Thomas Pedersend65a9772020-09-08 12:03:03 -0700127 IEEE80211_CHAN_1MHZ = 1<<14,
128 IEEE80211_CHAN_2MHZ = 1<<15,
129 IEEE80211_CHAN_4MHZ = 1<<16,
130 IEEE80211_CHAN_8MHZ = 1<<17,
131 IEEE80211_CHAN_16MHZ = 1<<18,
Johannes Bergd3236552009-04-20 14:31:42 +0200132};
133
Luis R. Rodriguez038659e2009-05-02 00:37:17 -0400134#define IEEE80211_CHAN_NO_HT40 \
Luis R. Rodriguez689da1b2009-05-02 00:37:18 -0400135 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
Luis R. Rodriguez038659e2009-05-02 00:37:17 -0400136
Simon Wunderlich04f39042013-02-08 18:16:19 +0100137#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
138#define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
139
Johannes Bergd3236552009-04-20 14:31:42 +0200140/**
141 * struct ieee80211_channel - channel definition
142 *
143 * This structure describes a single channel for use
144 * with cfg80211.
145 *
146 * @center_freq: center frequency in MHz
Thomas Pedersen934f4c72020-04-01 18:18:03 -0700147 * @freq_offset: offset from @center_freq, in KHz
Johannes Bergd3236552009-04-20 14:31:42 +0200148 * @hw_value: hardware-specific value for the channel
149 * @flags: channel flags from &enum ieee80211_channel_flags.
150 * @orig_flags: channel flags at registration time, used by regulatory
151 * code to support devices with additional restrictions
152 * @band: band this channel belongs to.
153 * @max_antenna_gain: maximum antenna gain in dBi
154 * @max_power: maximum transmission power (in dBm)
Hong Wueccc0682012-01-11 20:33:39 +0200155 * @max_reg_power: maximum regulatory transmission power (in dBm)
Johannes Bergd3236552009-04-20 14:31:42 +0200156 * @beacon_found: helper to regulatory code to indicate when a beacon
157 * has been found on this channel. Use regulatory_hint_found_beacon()
Walter Goldens77c20612010-05-18 04:44:54 -0700158 * to enable this, this is useful only on 5 GHz band.
Johannes Bergd3236552009-04-20 14:31:42 +0200159 * @orig_mag: internal use
160 * @orig_mpwr: internal use
Simon Wunderlich04f39042013-02-08 18:16:19 +0100161 * @dfs_state: current state of this channel. Only relevant if radar is required
162 * on this channel.
163 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
Janusz Dziedzic089027e2014-02-21 19:46:12 +0100164 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
Johannes Bergd3236552009-04-20 14:31:42 +0200165 */
166struct ieee80211_channel {
Johannes Berg57fbcce2016-04-12 15:56:15 +0200167 enum nl80211_band band;
Alexei Avshalom Lazar9cf0a0b2018-08-13 15:33:00 +0300168 u32 center_freq;
Thomas Pedersen934f4c72020-04-01 18:18:03 -0700169 u16 freq_offset;
Johannes Bergd3236552009-04-20 14:31:42 +0200170 u16 hw_value;
171 u32 flags;
172 int max_antenna_gain;
173 int max_power;
Hong Wueccc0682012-01-11 20:33:39 +0200174 int max_reg_power;
Johannes Bergd3236552009-04-20 14:31:42 +0200175 bool beacon_found;
176 u32 orig_flags;
177 int orig_mag, orig_mpwr;
Simon Wunderlich04f39042013-02-08 18:16:19 +0100178 enum nl80211_dfs_state dfs_state;
179 unsigned long dfs_state_entered;
Janusz Dziedzic089027e2014-02-21 19:46:12 +0100180 unsigned int dfs_cac_ms;
Johannes Bergd3236552009-04-20 14:31:42 +0200181};
182
183/**
184 * enum ieee80211_rate_flags - rate flags
185 *
186 * Hardware/specification flags for rates. These are structured
187 * in a way that allows using the same bitrate structure for
188 * different bands/PHY modes.
189 *
190 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
191 * preamble on this bitrate; only relevant in 2.4GHz band and
192 * with CCK rates.
193 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
194 * when used with 802.11a (on the 5 GHz band); filled by the
195 * core code when registering the wiphy.
196 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
197 * when used with 802.11b (on the 2.4 GHz band); filled by the
198 * core code when registering the wiphy.
199 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
200 * when used with 802.11g (on the 2.4 GHz band); filled by the
201 * core code when registering the wiphy.
202 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
Simon Wunderlich30e74732013-05-16 13:00:29 +0200203 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
204 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
Johannes Bergd3236552009-04-20 14:31:42 +0200205 */
206enum ieee80211_rate_flags {
207 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
208 IEEE80211_RATE_MANDATORY_A = 1<<1,
209 IEEE80211_RATE_MANDATORY_B = 1<<2,
210 IEEE80211_RATE_MANDATORY_G = 1<<3,
211 IEEE80211_RATE_ERP_G = 1<<4,
Simon Wunderlich30e74732013-05-16 13:00:29 +0200212 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
213 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
Johannes Bergd3236552009-04-20 14:31:42 +0200214};
215
216/**
Dedy Lansky6eb18132015-02-08 15:52:03 +0200217 * enum ieee80211_bss_type - BSS type filter
218 *
219 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
220 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
221 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
222 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
223 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
224 */
225enum ieee80211_bss_type {
226 IEEE80211_BSS_TYPE_ESS,
227 IEEE80211_BSS_TYPE_PBSS,
228 IEEE80211_BSS_TYPE_IBSS,
229 IEEE80211_BSS_TYPE_MBSS,
230 IEEE80211_BSS_TYPE_ANY
231};
232
233/**
234 * enum ieee80211_privacy - BSS privacy filter
235 *
236 * @IEEE80211_PRIVACY_ON: privacy bit set
237 * @IEEE80211_PRIVACY_OFF: privacy bit clear
238 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
239 */
240enum ieee80211_privacy {
241 IEEE80211_PRIVACY_ON,
242 IEEE80211_PRIVACY_OFF,
243 IEEE80211_PRIVACY_ANY
244};
245
246#define IEEE80211_PRIVACY(x) \
247 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
248
249/**
Johannes Bergd3236552009-04-20 14:31:42 +0200250 * struct ieee80211_rate - bitrate definition
251 *
252 * This structure describes a bitrate that an 802.11 PHY can
253 * operate with. The two values @hw_value and @hw_value_short
254 * are only for driver use when pointers to this structure are
255 * passed around.
256 *
257 * @flags: rate-specific flags
258 * @bitrate: bitrate in units of 100 Kbps
259 * @hw_value: driver/hardware value for this rate
260 * @hw_value_short: driver/hardware value for this rate when
261 * short preamble is used
262 */
263struct ieee80211_rate {
264 u32 flags;
265 u16 bitrate;
266 u16 hw_value, hw_value_short;
267};
268
269/**
John Crispin796e90f2019-07-30 18:37:00 +0200270 * struct ieee80211_he_obss_pd - AP settings for spatial reuse
271 *
272 * @enable: is the feature enabled.
Rajkumar Manoharanf5bec332020-09-28 00:28:11 -0700273 * @sr_ctrl: The SR Control field of SRP element.
274 * @non_srg_max_offset: non-SRG maximum tx power offset
John Crispin796e90f2019-07-30 18:37:00 +0200275 * @min_offset: minimal tx power offset an associated station shall use
276 * @max_offset: maximum tx power offset an associated station shall use
Rajkumar Manoharanf5bec332020-09-28 00:28:11 -0700277 * @bss_color_bitmap: bitmap that indicates the BSS color values used by
278 * members of the SRG
279 * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
280 * used by members of the SRG
John Crispin796e90f2019-07-30 18:37:00 +0200281 */
282struct ieee80211_he_obss_pd {
283 bool enable;
Rajkumar Manoharanf5bec332020-09-28 00:28:11 -0700284 u8 sr_ctrl;
285 u8 non_srg_max_offset;
John Crispin796e90f2019-07-30 18:37:00 +0200286 u8 min_offset;
287 u8 max_offset;
Rajkumar Manoharanf5bec332020-09-28 00:28:11 -0700288 u8 bss_color_bitmap[8];
289 u8 partial_bssid_bitmap[8];
John Crispin796e90f2019-07-30 18:37:00 +0200290};
291
292/**
John Crispin5c5e52d2019-12-17 15:19:18 +0100293 * struct cfg80211_he_bss_color - AP settings for BSS coloring
294 *
295 * @color: the current color.
Johannes Berg75e6b592020-07-30 13:00:52 +0200296 * @enabled: HE BSS color is used
John Crispin5c5e52d2019-12-17 15:19:18 +0100297 * @partial: define the AID equation.
298 */
299struct cfg80211_he_bss_color {
300 u8 color;
Johannes Berg75e6b592020-07-30 13:00:52 +0200301 bool enabled;
John Crispin5c5e52d2019-12-17 15:19:18 +0100302 bool partial;
303};
304
305/**
John Crispindd56e902019-12-17 15:19:19 +0100306 * struct ieee80211_he_bss_color - AP settings for BSS coloring
307 *
308 * @color: the current color.
309 * @disabled: is the feature disabled.
310 * @partial: define the AID equation.
311 */
312struct ieee80211_he_bss_color {
313 u8 color;
314 bool disabled;
315 bool partial;
316};
317
318/**
Johannes Bergd3236552009-04-20 14:31:42 +0200319 * struct ieee80211_sta_ht_cap - STA's HT capabilities
320 *
321 * This structure describes most essential parameters needed
322 * to describe 802.11n HT capabilities for an STA.
323 *
324 * @ht_supported: is HT supported by the STA
325 * @cap: HT capabilities map as described in 802.11n spec
326 * @ampdu_factor: Maximum A-MPDU length factor
327 * @ampdu_density: Minimum A-MPDU spacing
328 * @mcs: Supported MCS rates
329 */
330struct ieee80211_sta_ht_cap {
331 u16 cap; /* use IEEE80211_HT_CAP_ */
332 bool ht_supported;
333 u8 ampdu_factor;
334 u8 ampdu_density;
335 struct ieee80211_mcs_info mcs;
336};
337
338/**
Mahesh Palivelabf0c111e2012-06-22 07:27:46 +0000339 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
340 *
341 * This structure describes most essential parameters needed
342 * to describe 802.11ac VHT capabilities for an STA.
343 *
344 * @vht_supported: is VHT supported by the STA
345 * @cap: VHT capabilities map as described in 802.11ac spec
346 * @vht_mcs: Supported VHT MCS rates
347 */
348struct ieee80211_sta_vht_cap {
349 bool vht_supported;
350 u32 cap; /* use IEEE80211_VHT_CAP_ */
351 struct ieee80211_vht_mcs_info vht_mcs;
352};
353
Luca Coelhoc4cbaf72018-06-09 09:14:42 +0300354#define IEEE80211_HE_PPE_THRES_MAX_LEN 25
355
356/**
357 * struct ieee80211_sta_he_cap - STA's HE capabilities
358 *
359 * This structure describes most essential parameters needed
360 * to describe 802.11ax HE capabilities for a STA.
361 *
362 * @has_he: true iff HE data is valid.
363 * @he_cap_elem: Fixed portion of the HE capabilities element.
364 * @he_mcs_nss_supp: The supported NSS/MCS combinations.
365 * @ppe_thres: Holds the PPE Thresholds data.
366 */
367struct ieee80211_sta_he_cap {
368 bool has_he;
369 struct ieee80211_he_cap_elem he_cap_elem;
370 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
371 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
372};
373
374/**
375 * struct ieee80211_sband_iftype_data
376 *
377 * This structure encapsulates sband data that is relevant for the
378 * interface types defined in @types_mask. Each type in the
379 * @types_mask must be unique across all instances of iftype_data.
380 *
381 * @types_mask: interface types mask
382 * @he_cap: holds the HE capabilities
Johannes Berg22395212020-05-28 21:34:31 +0200383 * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
384 * 6 GHz band channel (and 0 may be valid value).
Luca Coelhoc4cbaf72018-06-09 09:14:42 +0300385 */
386struct ieee80211_sband_iftype_data {
387 u16 types_mask;
388 struct ieee80211_sta_he_cap he_cap;
Johannes Berg22395212020-05-28 21:34:31 +0200389 struct ieee80211_he_6ghz_capa he_6ghz_capa;
Luca Coelhoc4cbaf72018-06-09 09:14:42 +0300390};
391
Mahesh Palivelabf0c111e2012-06-22 07:27:46 +0000392/**
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +0300393 * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
394 *
395 * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
396 * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
397 * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
398 * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
399 * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
400 * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
401 * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
402 * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
403 * 2.16GHz+2.16GHz
404 * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
405 * 4.32GHz + 4.32GHz
406 * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
407 * 4.32GHz + 4.32GHz
408 * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
409 * and 4.32GHz + 4.32GHz
410 * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
411 * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
412 */
413enum ieee80211_edmg_bw_config {
414 IEEE80211_EDMG_BW_CONFIG_4 = 4,
415 IEEE80211_EDMG_BW_CONFIG_5 = 5,
416 IEEE80211_EDMG_BW_CONFIG_6 = 6,
417 IEEE80211_EDMG_BW_CONFIG_7 = 7,
418 IEEE80211_EDMG_BW_CONFIG_8 = 8,
419 IEEE80211_EDMG_BW_CONFIG_9 = 9,
420 IEEE80211_EDMG_BW_CONFIG_10 = 10,
421 IEEE80211_EDMG_BW_CONFIG_11 = 11,
422 IEEE80211_EDMG_BW_CONFIG_12 = 12,
423 IEEE80211_EDMG_BW_CONFIG_13 = 13,
424 IEEE80211_EDMG_BW_CONFIG_14 = 14,
425 IEEE80211_EDMG_BW_CONFIG_15 = 15,
426};
427
428/**
429 * struct ieee80211_edmg - EDMG configuration
430 *
431 * This structure describes most essential parameters needed
432 * to describe 802.11ay EDMG configuration
433 *
434 * @channels: bitmap that indicates the 2.16 GHz channel(s)
435 * that are allowed to be used for transmissions.
436 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
437 * Set to 0 indicate EDMG not supported.
438 * @bw_config: Channel BW Configuration subfield encodes
439 * the allowed channel bandwidth configurations
440 */
441struct ieee80211_edmg {
442 u8 channels;
443 enum ieee80211_edmg_bw_config bw_config;
444};
445
446/**
Thomas Pedersendf78a0c2020-06-01 23:22:47 -0700447 * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
448 *
449 * This structure describes most essential parameters needed
450 * to describe 802.11ah S1G capabilities for a STA.
451 *
452 * @s1g_supported: is STA an S1G STA
453 * @cap: S1G capabilities information
454 * @nss_mcs: Supported NSS MCS set
455 */
456struct ieee80211_sta_s1g_cap {
457 bool s1g;
458 u8 cap[10]; /* use S1G_CAPAB_ */
459 u8 nss_mcs[5];
460};
461
462/**
Johannes Bergd3236552009-04-20 14:31:42 +0200463 * struct ieee80211_supported_band - frequency band definition
464 *
465 * This structure describes a frequency band a wiphy
466 * is able to operate in.
467 *
Randy Dunlap085a6c12020-07-15 09:43:23 -0700468 * @channels: Array of channels the hardware can operate with
Johannes Bergd3236552009-04-20 14:31:42 +0200469 * in this band.
470 * @band: the band this structure represents
471 * @n_channels: Number of channels in @channels
472 * @bitrates: Array of bitrates the hardware can operate with
473 * in this band. Must be sorted to give a valid "supported
474 * rates" IE, i.e. CCK rates first, then OFDM.
475 * @n_bitrates: Number of bitrates in @bitrates
Johannes Bergabe37c42010-06-07 11:12:27 +0200476 * @ht_cap: HT capabilities in this band
Robert P. J. Dayc9a0a302012-08-26 14:21:47 -0400477 * @vht_cap: VHT capabilities in this band
Mauro Carvalho Chehab8a50c052020-09-10 10:06:47 +0200478 * @s1g_cap: S1G capabilities in this band
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +0300479 * @edmg_cap: EDMG capabilities in this band
Johannes Berg9ff167e2020-09-18 13:19:22 +0200480 * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
Luca Coelhoc4cbaf72018-06-09 09:14:42 +0300481 * @n_iftype_data: number of iftype data entries
482 * @iftype_data: interface type data entries. Note that the bits in
483 * @types_mask inside this structure cannot overlap (i.e. only
484 * one occurrence of each type is allowed across all instances of
485 * iftype_data).
Johannes Bergd3236552009-04-20 14:31:42 +0200486 */
487struct ieee80211_supported_band {
488 struct ieee80211_channel *channels;
489 struct ieee80211_rate *bitrates;
Johannes Berg57fbcce2016-04-12 15:56:15 +0200490 enum nl80211_band band;
Johannes Bergd3236552009-04-20 14:31:42 +0200491 int n_channels;
492 int n_bitrates;
493 struct ieee80211_sta_ht_cap ht_cap;
Mahesh Palivelabf0c111e2012-06-22 07:27:46 +0000494 struct ieee80211_sta_vht_cap vht_cap;
Thomas Pedersendf78a0c2020-06-01 23:22:47 -0700495 struct ieee80211_sta_s1g_cap s1g_cap;
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +0300496 struct ieee80211_edmg edmg_cap;
Luca Coelhoc4cbaf72018-06-09 09:14:42 +0300497 u16 n_iftype_data;
498 const struct ieee80211_sband_iftype_data *iftype_data;
Johannes Bergd3236552009-04-20 14:31:42 +0200499};
500
Rafał Miłeckie691ac22017-01-04 18:58:31 +0100501/**
Luca Coelhoc4cbaf72018-06-09 09:14:42 +0300502 * ieee80211_get_sband_iftype_data - return sband data for a given iftype
503 * @sband: the sband to search for the STA on
504 * @iftype: enum nl80211_iftype
505 *
506 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
507 */
508static inline const struct ieee80211_sband_iftype_data *
509ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
510 u8 iftype)
511{
512 int i;
513
514 if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
515 return NULL;
516
517 for (i = 0; i < sband->n_iftype_data; i++) {
518 const struct ieee80211_sband_iftype_data *data =
519 &sband->iftype_data[i];
520
521 if (data->types_mask & BIT(iftype))
522 return data;
523 }
524
525 return NULL;
526}
527
528/**
John Crispind7edf402019-05-21 17:02:58 +0200529 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
530 * @sband: the sband to search for the iftype on
531 * @iftype: enum nl80211_iftype
532 *
533 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
534 */
535static inline const struct ieee80211_sta_he_cap *
536ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
537 u8 iftype)
538{
539 const struct ieee80211_sband_iftype_data *data =
540 ieee80211_get_sband_iftype_data(sband, iftype);
541
542 if (data && data->he_cap.has_he)
543 return &data->he_cap;
544
545 return NULL;
546}
547
548/**
Luca Coelhoc4cbaf72018-06-09 09:14:42 +0300549 * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
550 * @sband: the sband to search for the STA on
551 *
552 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
553 */
554static inline const struct ieee80211_sta_he_cap *
555ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
556{
John Crispind7edf402019-05-21 17:02:58 +0200557 return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
Luca Coelhoc4cbaf72018-06-09 09:14:42 +0300558}
559
560/**
Ilan Peer2ad22742020-05-28 21:34:39 +0200561 * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
562 * @sband: the sband to search for the STA on
563 * @iftype: the iftype to search for
564 *
565 * Return: the 6GHz capabilities
566 */
567static inline __le16
568ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
569 enum nl80211_iftype iftype)
570{
571 const struct ieee80211_sband_iftype_data *data =
572 ieee80211_get_sband_iftype_data(sband, iftype);
573
574 if (WARN_ON(!data || !data->he_cap.has_he))
575 return 0;
576
577 return data->he_6ghz_capa.capa;
578}
579
580/**
Rafał Miłeckie691ac22017-01-04 18:58:31 +0100581 * wiphy_read_of_freq_limits - read frequency limits from device tree
582 *
583 * @wiphy: the wireless device to get extra limits for
584 *
585 * Some devices may have extra limitations specified in DT. This may be useful
586 * for chipsets that normally support more bands but are limited due to board
587 * design (e.g. by antennas or external power amplifier).
588 *
589 * This function reads info from DT and uses it to *modify* channels (disable
590 * unavailable ones). It's usually a *bad* idea to use it in drivers with
591 * shared channel data as DT limitations are device specific. You should make
592 * sure to call it only if channels in wiphy are copied and can be modified
593 * without affecting other devices.
594 *
595 * As this function access device node it has to be called after set_wiphy_dev.
596 * It also modifies channels so they have to be set first.
597 * If using this helper, call it before wiphy_register().
598 */
599#ifdef CONFIG_OF
600void wiphy_read_of_freq_limits(struct wiphy *wiphy);
601#else /* CONFIG_OF */
602static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
603{
604}
605#endif /* !CONFIG_OF */
606
607
Johannes Bergd3236552009-04-20 14:31:42 +0200608/*
609 * Wireless hardware/device configuration structures and methods
Johannes Berg704232c2007-04-23 12:20:05 -0700610 */
611
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100612/**
Johannes Bergd70e9692010-08-19 16:11:27 +0200613 * DOC: Actions and configuration
614 *
615 * Each wireless device and each virtual interface offer a set of configuration
616 * operations and other actions that are invoked by userspace. Each of these
617 * actions is described in the operations structure, and the parameters these
618 * operations use are described separately.
619 *
620 * Additionally, some operations are asynchronous and expect to get status
621 * information via some functions that drivers need to call.
622 *
623 * Scanning and BSS list handling with its associated functionality is described
624 * in a separate chapter.
625 */
626
Aviya Erenfeldc6e6a0c2016-07-05 15:23:08 +0300627#define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
628 WLAN_USER_POSITION_LEN)
629
Johannes Bergd70e9692010-08-19 16:11:27 +0200630/**
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100631 * struct vif_params - describes virtual interface parameters
Johannes Berg818a9862017-04-12 11:23:28 +0200632 * @flags: monitor interface flags, unchanged if 0, otherwise
633 * %MONITOR_FLAG_CHANGED will be set
Felix Fietkau8b787642009-11-10 18:53:10 +0100634 * @use_4addr: use 4-address frames
Ben Greeare8f479b2014-10-22 12:23:05 -0700635 * @macaddr: address to use for this virtual interface.
636 * If this parameter is set to zero address the driver may
637 * determine the address as needed.
638 * This feature is only fully supported by drivers that enable the
639 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
640 ** only p2p devices with specified MAC.
Johannes Bergb0265022017-04-12 10:43:49 +0200641 * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
642 * belonging to that MU-MIMO groupID; %NULL if not changed
643 * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
644 * MU-MIMO packets going to the specified station; %NULL if not changed
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100645 */
646struct vif_params {
Johannes Berg818a9862017-04-12 11:23:28 +0200647 u32 flags;
Aviya Erenfeldc6e6a0c2016-07-05 15:23:08 +0300648 int use_4addr;
649 u8 macaddr[ETH_ALEN];
Johannes Bergb0265022017-04-12 10:43:49 +0200650 const u8 *vht_mumimo_groups;
651 const u8 *vht_mumimo_follow_addr;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100652};
653
Andy Green179f8312007-07-10 19:29:38 +0200654/**
Johannes Berg41ade002007-12-19 02:03:29 +0100655 * struct key_params - key information
656 *
657 * Information about a key
658 *
659 * @key: key material
660 * @key_len: length of key material
661 * @cipher: cipher suite selector
662 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
663 * with the get_key() callback, must be in little endian,
664 * length given by @seq_len.
Johannes Bergabe37c42010-06-07 11:12:27 +0200665 * @seq_len: length of @seq.
Gurumoorthi Gnanasambandhan14f34e362019-10-31 23:46:40 +0200666 * @vlan_id: vlan_id for VLAN group key (if nonzero)
Alexander Wetzel6cdd3972019-03-19 21:34:07 +0100667 * @mode: key install mode (RX_TX, NO_TX or SET_TX)
Johannes Berg41ade002007-12-19 02:03:29 +0100668 */
669struct key_params {
Johannes Bergc1e5f472014-05-19 17:53:16 +0200670 const u8 *key;
671 const u8 *seq;
Johannes Berg41ade002007-12-19 02:03:29 +0100672 int key_len;
673 int seq_len;
Gurumoorthi Gnanasambandhan14f34e362019-10-31 23:46:40 +0200674 u16 vlan_id;
Johannes Berg41ade002007-12-19 02:03:29 +0100675 u32 cipher;
Alexander Wetzel6cdd3972019-03-19 21:34:07 +0100676 enum nl80211_key_mode mode;
Johannes Berg41ade002007-12-19 02:03:29 +0100677};
678
Johannes Berged1b6cc2007-12-19 02:03:32 +0100679/**
Johannes Berg683b6d32012-11-08 21:25:48 +0100680 * struct cfg80211_chan_def - channel definition
681 * @chan: the (control) channel
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100682 * @width: channel width
683 * @center_freq1: center frequency of first segment
684 * @center_freq2: center frequency of second segment
685 * (only with 80+80 MHz)
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +0300686 * @edmg: define the EDMG channels configuration.
687 * If edmg is requested (i.e. the .channels member is non-zero),
688 * chan will define the primary channel and all other
689 * parameters are ignored.
Thomas Pedersen934f4c72020-04-01 18:18:03 -0700690 * @freq1_offset: offset from @center_freq1, in KHz
Johannes Berg683b6d32012-11-08 21:25:48 +0100691 */
692struct cfg80211_chan_def {
693 struct ieee80211_channel *chan;
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100694 enum nl80211_chan_width width;
695 u32 center_freq1;
696 u32 center_freq2;
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +0300697 struct ieee80211_edmg edmg;
Thomas Pedersen934f4c72020-04-01 18:18:03 -0700698 u16 freq1_offset;
Johannes Berg683b6d32012-11-08 21:25:48 +0100699};
700
Tamizh Chelvam9a5f6482020-05-13 13:41:44 +0530701/*
702 * cfg80211_bitrate_mask - masks for bitrate control
703 */
704struct cfg80211_bitrate_mask {
705 struct {
706 u32 legacy;
707 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
708 u16 vht_mcs[NL80211_VHT_NSS_MAX];
Miles Hueb89a6a2020-08-04 10:16:29 +0200709 u16 he_mcs[NL80211_HE_NSS_MAX];
Tamizh Chelvam9a5f6482020-05-13 13:41:44 +0530710 enum nl80211_txrate_gi gi;
Miles Hueb89a6a2020-08-04 10:16:29 +0200711 enum nl80211_he_gi he_gi;
712 enum nl80211_he_ltf he_ltf;
Tamizh Chelvam9a5f6482020-05-13 13:41:44 +0530713 } control[NUM_NL80211_BANDS];
714};
715
716
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530717/**
Johannes Berg3710a8a2020-02-24 11:34:25 +0100718 * struct cfg80211_tid_cfg - TID specific configuration
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530719 * @config_override: Flag to notify driver to reset TID configuration
720 * of the peer.
Johannes Berg3710a8a2020-02-24 11:34:25 +0100721 * @tids: bitmap of TIDs to modify
722 * @mask: bitmap of attributes indicating which parameter changed,
723 * similar to &nl80211_tid_config_supp.
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530724 * @noack: noack configuration value for the TID
Tamizh chelvam6a21d162020-01-20 13:21:23 +0530725 * @retry_long: retry count value
726 * @retry_short: retry count value
Sergey Matyukevich33462e62020-04-24 14:29:03 +0300727 * @ampdu: Enable/Disable MPDU aggregation
Tamizh chelvam04f7d142020-01-20 13:21:25 +0530728 * @rtscts: Enable/Disable RTS/CTS
Sergey Matyukevich33462e62020-04-24 14:29:03 +0300729 * @amsdu: Enable/Disable MSDU aggregation
Tamizh Chelvam9a5f6482020-05-13 13:41:44 +0530730 * @txrate_type: Tx bitrate mask type
731 * @txrate_mask: Tx bitrate to be applied for the TID
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530732 */
Johannes Berg3710a8a2020-02-24 11:34:25 +0100733struct cfg80211_tid_cfg {
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530734 bool config_override;
Johannes Berg3710a8a2020-02-24 11:34:25 +0100735 u8 tids;
Sergey Matyukevich2d5d9b72020-04-24 14:29:01 +0300736 u64 mask;
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530737 enum nl80211_tid_config noack;
Tamizh chelvam6a21d162020-01-20 13:21:23 +0530738 u8 retry_long, retry_short;
Tamizh chelvamade274b2020-01-20 13:21:24 +0530739 enum nl80211_tid_config ampdu;
Tamizh chelvam04f7d142020-01-20 13:21:25 +0530740 enum nl80211_tid_config rtscts;
Sergey Matyukevich33462e62020-04-24 14:29:03 +0300741 enum nl80211_tid_config amsdu;
Tamizh Chelvam9a5f6482020-05-13 13:41:44 +0530742 enum nl80211_tx_rate_setting txrate_type;
743 struct cfg80211_bitrate_mask txrate_mask;
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530744};
745
746/**
Johannes Berg3710a8a2020-02-24 11:34:25 +0100747 * struct cfg80211_tid_config - TID configuration
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530748 * @peer: Station's MAC address
749 * @n_tid_conf: Number of TID specific configurations to be applied
750 * @tid_conf: Configuration change info
751 */
Johannes Berg3710a8a2020-02-24 11:34:25 +0100752struct cfg80211_tid_config {
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530753 const u8 *peer;
754 u32 n_tid_conf;
Johannes Berg3710a8a2020-02-24 11:34:25 +0100755 struct cfg80211_tid_cfg tid_conf[];
Tamizh chelvam77f576d2020-01-20 13:21:22 +0530756};
757
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100758/**
759 * cfg80211_get_chandef_type - return old channel type from chandef
760 * @chandef: the channel definition
761 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100762 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100763 * chandef, which must have a bandwidth allowing this conversion.
764 */
Johannes Berg683b6d32012-11-08 21:25:48 +0100765static inline enum nl80211_channel_type
766cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
767{
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100768 switch (chandef->width) {
769 case NL80211_CHAN_WIDTH_20_NOHT:
770 return NL80211_CHAN_NO_HT;
771 case NL80211_CHAN_WIDTH_20:
772 return NL80211_CHAN_HT20;
773 case NL80211_CHAN_WIDTH_40:
774 if (chandef->center_freq1 > chandef->chan->center_freq)
775 return NL80211_CHAN_HT40PLUS;
776 return NL80211_CHAN_HT40MINUS;
777 default:
778 WARN_ON(1);
779 return NL80211_CHAN_NO_HT;
780 }
Johannes Berg683b6d32012-11-08 21:25:48 +0100781}
782
783/**
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100784 * cfg80211_chandef_create - create channel definition using channel type
785 * @chandef: the channel definition struct to fill
786 * @channel: the control channel
787 * @chantype: the channel type
788 *
789 * Given a channel type, create a channel definition.
790 */
791void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
792 struct ieee80211_channel *channel,
793 enum nl80211_channel_type chantype);
794
795/**
796 * cfg80211_chandef_identical - check if two channel definitions are identical
797 * @chandef1: first channel definition
798 * @chandef2: second channel definition
799 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100800 * Return: %true if the channels defined by the channel definitions are
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100801 * identical, %false otherwise.
802 */
803static inline bool
804cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
805 const struct cfg80211_chan_def *chandef2)
806{
807 return (chandef1->chan == chandef2->chan &&
808 chandef1->width == chandef2->width &&
809 chandef1->center_freq1 == chandef2->center_freq1 &&
Thomas Pedersen934f4c72020-04-01 18:18:03 -0700810 chandef1->freq1_offset == chandef2->freq1_offset &&
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100811 chandef1->center_freq2 == chandef2->center_freq2);
812}
813
814/**
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +0300815 * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
816 *
817 * @chandef: the channel definition
818 *
819 * Return: %true if EDMG defined, %false otherwise.
820 */
821static inline bool
822cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
823{
824 return chandef->edmg.channels || chandef->edmg.bw_config;
825}
826
827/**
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100828 * cfg80211_chandef_compatible - check if two channel definitions are compatible
829 * @chandef1: first channel definition
830 * @chandef2: second channel definition
831 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100832 * Return: %NULL if the given channel definitions are incompatible,
Johannes Berg3d9d1d62012-11-08 23:14:50 +0100833 * chandef1 or chandef2 otherwise.
834 */
835const struct cfg80211_chan_def *
836cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
837 const struct cfg80211_chan_def *chandef2);
838
839/**
Johannes Berg9f5e8f62012-11-22 16:59:45 +0100840 * cfg80211_chandef_valid - check if a channel definition is valid
841 * @chandef: the channel definition to check
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100842 * Return: %true if the channel definition is valid. %false otherwise.
Johannes Berg9f5e8f62012-11-22 16:59:45 +0100843 */
844bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
845
846/**
847 * cfg80211_chandef_usable - check if secondary channels can be used
848 * @wiphy: the wiphy to validate against
849 * @chandef: the channel definition to check
Yacine Belkadi0ae997d2013-01-12 13:54:14 +0100850 * @prohibited_flags: the regulatory channel flags that must not be set
851 * Return: %true if secondary channels are usable. %false otherwise.
Johannes Berg9f5e8f62012-11-22 16:59:45 +0100852 */
853bool cfg80211_chandef_usable(struct wiphy *wiphy,
854 const struct cfg80211_chan_def *chandef,
855 u32 prohibited_flags);
856
857/**
Simon Wunderlich774f0732013-08-28 13:41:28 +0200858 * cfg80211_chandef_dfs_required - checks if radar detection is required
859 * @wiphy: the wiphy to validate against
860 * @chandef: the channel definition to check
Luciano Coelho2beb6dab2014-02-18 11:40:36 +0200861 * @iftype: the interface type as specified in &enum nl80211_iftype
862 * Returns:
863 * 1 if radar detection is required, 0 if it is not, < 0 on error
Simon Wunderlich774f0732013-08-28 13:41:28 +0200864 */
865int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
Luciano Coelho2beb6dab2014-02-18 11:40:36 +0200866 const struct cfg80211_chan_def *chandef,
Luciano Coelhoc3d62032014-05-07 19:07:05 +0300867 enum nl80211_iftype iftype);
Simon Wunderlich774f0732013-08-28 13:41:28 +0200868
869/**
Simon Wunderlich30e74732013-05-16 13:00:29 +0200870 * ieee80211_chandef_rate_flags - returns rate flags for a channel
871 *
872 * In some channel types, not all rates may be used - for example CCK
873 * rates may not be used in 5/10 MHz channels.
874 *
875 * @chandef: channel definition for the channel
876 *
877 * Returns: rate flags which apply for this channel
878 */
879static inline enum ieee80211_rate_flags
880ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
881{
882 switch (chandef->width) {
883 case NL80211_CHAN_WIDTH_5:
884 return IEEE80211_RATE_SUPPORTS_5MHZ;
885 case NL80211_CHAN_WIDTH_10:
886 return IEEE80211_RATE_SUPPORTS_10MHZ;
887 default:
888 break;
889 }
890 return 0;
891}
892
893/**
Simon Wunderlich0430c882013-07-08 16:55:55 +0200894 * ieee80211_chandef_max_power - maximum transmission power for the chandef
895 *
896 * In some regulations, the transmit power may depend on the configured channel
897 * bandwidth which may be defined as dBm/MHz. This function returns the actual
898 * max_power for non-standard (20 MHz) channels.
899 *
900 * @chandef: channel definition for the channel
901 *
902 * Returns: maximum allowed transmission power in dBm for the chandef
903 */
904static inline int
905ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
906{
907 switch (chandef->width) {
908 case NL80211_CHAN_WIDTH_5:
909 return min(chandef->chan->max_reg_power - 6,
910 chandef->chan->max_power);
911 case NL80211_CHAN_WIDTH_10:
912 return min(chandef->chan->max_reg_power - 3,
913 chandef->chan->max_power);
914 default:
915 break;
916 }
917 return chandef->chan->max_power;
918}
919
920/**
Holger Schurig61fa7132009-11-11 12:25:40 +0100921 * enum survey_info_flags - survey information flags
922 *
Johannes Bergabe37c42010-06-07 11:12:27 +0200923 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
Felix Fietkau17e5a802010-09-29 17:15:30 +0200924 * @SURVEY_INFO_IN_USE: channel is currently being used
Johannes Berg4ed20be2014-11-14 16:35:34 +0100925 * @SURVEY_INFO_TIME: active time (in ms) was filled in
926 * @SURVEY_INFO_TIME_BUSY: busy time was filled in
927 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
928 * @SURVEY_INFO_TIME_RX: receive time was filled in
929 * @SURVEY_INFO_TIME_TX: transmit time was filled in
Johannes Berg052536a2014-11-14 16:44:11 +0100930 * @SURVEY_INFO_TIME_SCAN: scan time was filled in
Felix Fietkauc8cd6e72019-08-28 12:20:42 +0200931 * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
Johannes Bergabe37c42010-06-07 11:12:27 +0200932 *
Holger Schurig61fa7132009-11-11 12:25:40 +0100933 * Used by the driver to indicate which info in &struct survey_info
934 * it has filled in during the get_survey().
935 */
936enum survey_info_flags {
Johannes Berg4ed20be2014-11-14 16:35:34 +0100937 SURVEY_INFO_NOISE_DBM = BIT(0),
938 SURVEY_INFO_IN_USE = BIT(1),
939 SURVEY_INFO_TIME = BIT(2),
940 SURVEY_INFO_TIME_BUSY = BIT(3),
941 SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
942 SURVEY_INFO_TIME_RX = BIT(5),
943 SURVEY_INFO_TIME_TX = BIT(6),
Johannes Berg052536a2014-11-14 16:44:11 +0100944 SURVEY_INFO_TIME_SCAN = BIT(7),
Felix Fietkauc8cd6e72019-08-28 12:20:42 +0200945 SURVEY_INFO_TIME_BSS_RX = BIT(8),
Holger Schurig61fa7132009-11-11 12:25:40 +0100946};
947
948/**
949 * struct survey_info - channel survey response
950 *
Johannes Berg11f78ac2014-11-14 16:43:50 +0100951 * @channel: the channel this survey record reports, may be %NULL for a single
952 * record to report global statistics
Holger Schurig61fa7132009-11-11 12:25:40 +0100953 * @filled: bitflag of flags from &enum survey_info_flags
954 * @noise: channel noise in dBm. This and all following fields are
Johannes Bergad24b0d2013-07-05 11:53:28 +0200955 * optional
Johannes Berg4ed20be2014-11-14 16:35:34 +0100956 * @time: amount of time in ms the radio was turn on (on the channel)
957 * @time_busy: amount of time the primary channel was sensed busy
958 * @time_ext_busy: amount of time the extension channel was sensed busy
959 * @time_rx: amount of time the radio spent receiving data
960 * @time_tx: amount of time the radio spent transmitting data
Johannes Berg052536a2014-11-14 16:44:11 +0100961 * @time_scan: amount of time the radio spent for scanning
Felix Fietkauc8cd6e72019-08-28 12:20:42 +0200962 * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
Holger Schurig61fa7132009-11-11 12:25:40 +0100963 *
Johannes Bergabe37c42010-06-07 11:12:27 +0200964 * Used by dump_survey() to report back per-channel survey information.
965 *
Holger Schurig61fa7132009-11-11 12:25:40 +0100966 * This structure can later be expanded with things like
967 * channel duty cycle etc.
968 */
969struct survey_info {
970 struct ieee80211_channel *channel;
Johannes Berg4ed20be2014-11-14 16:35:34 +0100971 u64 time;
972 u64 time_busy;
973 u64 time_ext_busy;
974 u64 time_rx;
975 u64 time_tx;
Johannes Berg052536a2014-11-14 16:44:11 +0100976 u64 time_scan;
Felix Fietkauc8cd6e72019-08-28 12:20:42 +0200977 u64 time_bss_rx;
Holger Schurig61fa7132009-11-11 12:25:40 +0100978 u32 filled;
979 s8 noise;
980};
981
David Spinadelb8676222016-09-22 23:16:50 +0300982#define CFG80211_MAX_WEP_KEYS 4
983
Holger Schurig61fa7132009-11-11 12:25:40 +0100984/**
Jouni Malinen5fb628e2011-08-10 23:54:35 +0300985 * struct cfg80211_crypto_settings - Crypto settings
986 * @wpa_versions: indicates which, if any, WPA versions are enabled
987 * (from enum nl80211_wpa_versions)
988 * @cipher_group: group key cipher suite (or 0 if unset)
989 * @n_ciphers_pairwise: number of AP supported unicast ciphers
990 * @ciphers_pairwise: unicast key cipher suites
991 * @n_akm_suites: number of AKM suites
992 * @akm_suites: AKM suites
993 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
994 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
995 * required to assume that the port is unauthorized until authorized by
996 * user space. Otherwise, port is marked authorized by default.
997 * @control_port_ethertype: the control port protocol that should be
998 * allowed through even on unauthorized ports
999 * @control_port_no_encrypt: TRUE to prevent encryption of control port
1000 * protocol frames.
Denis Kenzior64bf3d42018-03-26 12:52:43 -05001001 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
1002 * port frames over NL80211 instead of the network interface.
Lothar Rubuscha710d212020-04-08 23:10:13 +00001003 * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1004 * port for mac80211
David Spinadelb8676222016-09-22 23:16:50 +03001005 * @wep_keys: static WEP keys, if not NULL points to an array of
1006 * CFG80211_MAX_WEP_KEYS WEP keys
1007 * @wep_tx_key: key index (0..3) of the default TX static WEP key
Eliad Peller91b5ab62017-06-09 13:08:42 +01001008 * @psk: PSK (for devices supporting 4-way-handshake offload)
Chung-Hsien Hsu26f70442019-05-09 09:49:06 +00001009 * @sae_pwd: password for SAE authentication (for devices supporting SAE
1010 * offload)
1011 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
Johannes Bergda1e9dd32020-11-10 09:49:11 +01001012 * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1013 *
1014 * NL80211_SAE_PWE_UNSPECIFIED
1015 * Not-specified, used to indicate userspace did not specify any
1016 * preference. The driver should follow its internal policy in
1017 * such a scenario.
1018 *
1019 * NL80211_SAE_PWE_HUNT_AND_PECK
1020 * Allow hunting-and-pecking loop only
1021 *
1022 * NL80211_SAE_PWE_HASH_TO_ELEMENT
1023 * Allow hash-to-element only
1024 *
1025 * NL80211_SAE_PWE_BOTH
1026 * Allow either hunting-and-pecking loop or hash-to-element
Jouni Malinen5fb628e2011-08-10 23:54:35 +03001027 */
1028struct cfg80211_crypto_settings {
1029 u32 wpa_versions;
1030 u32 cipher_group;
1031 int n_ciphers_pairwise;
1032 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
1033 int n_akm_suites;
1034 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
1035 bool control_port;
1036 __be16 control_port_ethertype;
1037 bool control_port_no_encrypt;
Denis Kenzior64bf3d42018-03-26 12:52:43 -05001038 bool control_port_over_nl80211;
Markus Theil7f3f96c2020-03-12 10:10:54 +01001039 bool control_port_no_preauth;
David Spinadelb8676222016-09-22 23:16:50 +03001040 struct key_params *wep_keys;
1041 int wep_tx_key;
Eliad Peller91b5ab62017-06-09 13:08:42 +01001042 const u8 *psk;
Chung-Hsien Hsu26f70442019-05-09 09:49:06 +00001043 const u8 *sae_pwd;
1044 u8 sae_pwd_len;
Rohan Dutta9f0ffa42020-10-27 12:09:10 +02001045 enum nl80211_sae_pwe_mechanism sae_pwe;
Jouni Malinen5fb628e2011-08-10 23:54:35 +03001046};
1047
1048/**
Johannes Berg88600202012-02-13 15:17:18 +01001049 * struct cfg80211_beacon_data - beacon data
Johannes Berged1b6cc2007-12-19 02:03:32 +01001050 * @head: head portion of beacon (before TIM IE)
Johannes Bergad24b0d2013-07-05 11:53:28 +02001051 * or %NULL if not changed
Johannes Berged1b6cc2007-12-19 02:03:32 +01001052 * @tail: tail portion of beacon (after TIM IE)
Johannes Bergad24b0d2013-07-05 11:53:28 +02001053 * or %NULL if not changed
Johannes Berged1b6cc2007-12-19 02:03:32 +01001054 * @head_len: length of @head
1055 * @tail_len: length of @tail
Jouni Malinen9946ecf2011-08-10 23:55:56 +03001056 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
1057 * @beacon_ies_len: length of beacon_ies in octets
1058 * @proberesp_ies: extra information element(s) to add into Probe Response
1059 * frames or %NULL
1060 * @proberesp_ies_len: length of proberesp_ies in octets
1061 * @assocresp_ies: extra information element(s) to add into (Re)Association
1062 * Response frames or %NULL
1063 * @assocresp_ies_len: length of assocresp_ies in octets
Arik Nemtsov00f740e2011-11-10 11:28:56 +02001064 * @probe_resp_len: length of probe response template (@probe_resp)
1065 * @probe_resp: probe response template (AP mode only)
Pradeep Kumar Chitrapu81e54d02018-09-20 17:30:09 -07001066 * @ftm_responder: enable FTM responder functionality; -1 for no change
1067 * (which also implies no change in LCI/civic location data)
Johannes Berg30db6412018-12-15 11:03:23 +02001068 * @lci: Measurement Report element content, starting with Measurement Token
1069 * (measurement type 8)
1070 * @civicloc: Measurement Report element content, starting with Measurement
1071 * Token (measurement type 11)
Pradeep Kumar Chitrapu81e54d02018-09-20 17:30:09 -07001072 * @lci_len: LCI data length
1073 * @civicloc_len: Civic location data length
Johannes Berged1b6cc2007-12-19 02:03:32 +01001074 */
Johannes Berg88600202012-02-13 15:17:18 +01001075struct cfg80211_beacon_data {
1076 const u8 *head, *tail;
1077 const u8 *beacon_ies;
1078 const u8 *proberesp_ies;
1079 const u8 *assocresp_ies;
1080 const u8 *probe_resp;
Pradeep Kumar Chitrapu81e54d02018-09-20 17:30:09 -07001081 const u8 *lci;
1082 const u8 *civicloc;
1083 s8 ftm_responder;
Johannes Berg88600202012-02-13 15:17:18 +01001084
1085 size_t head_len, tail_len;
1086 size_t beacon_ies_len;
1087 size_t proberesp_ies_len;
1088 size_t assocresp_ies_len;
1089 size_t probe_resp_len;
Pradeep Kumar Chitrapu81e54d02018-09-20 17:30:09 -07001090 size_t lci_len;
1091 size_t civicloc_len;
Johannes Berg88600202012-02-13 15:17:18 +01001092};
1093
Vasanthakumar Thiagarajan6d45a742013-01-18 11:18:44 +05301094struct mac_address {
1095 u8 addr[ETH_ALEN];
1096};
1097
Johannes Berg88600202012-02-13 15:17:18 +01001098/**
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05301099 * struct cfg80211_acl_data - Access control list data
1100 *
1101 * @acl_policy: ACL policy to be applied on the station's
Johannes Berg077f8972013-02-08 09:06:36 +01001102 * entry specified by mac_addr
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05301103 * @n_acl_entries: Number of MAC address entries passed
1104 * @mac_addrs: List of MAC addresses of stations to be used for ACL
1105 */
1106struct cfg80211_acl_data {
1107 enum nl80211_acl_policy acl_policy;
1108 int n_acl_entries;
1109
1110 /* Keep it last */
1111 struct mac_address mac_addrs[];
1112};
1113
Johannes Berg88600202012-02-13 15:17:18 +01001114/**
Aloka Dixit291c49d2020-09-11 00:05:29 +00001115 * struct cfg80211_fils_discovery - FILS discovery parameters from
1116 * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1117 *
1118 * @min_interval: Minimum packet interval in TUs (0 - 10000)
1119 * @max_interval: Maximum packet interval in TUs (0 - 10000)
1120 * @tmpl_len: Template length
1121 * @tmpl: Template data for FILS discovery frame including the action
1122 * frame headers.
1123 */
1124struct cfg80211_fils_discovery {
1125 u32 min_interval;
1126 u32 max_interval;
1127 size_t tmpl_len;
1128 const u8 *tmpl;
1129};
1130
1131/**
Aloka Dixit7443dcd2020-09-11 00:33:00 +00001132 * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
1133 * response parameters in 6GHz.
1134 *
1135 * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
1136 * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
1137 * scanning
1138 * @tmpl_len: Template length
1139 * @tmpl: Template data for probe response
1140 */
1141struct cfg80211_unsol_bcast_probe_resp {
1142 u32 interval;
1143 size_t tmpl_len;
1144 const u8 *tmpl;
1145};
1146
1147/**
Srinivas Dasarife494372019-01-23 18:06:56 +05301148 * enum cfg80211_ap_settings_flags - AP settings flags
1149 *
1150 * Used by cfg80211_ap_settings
1151 *
1152 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1153 */
1154enum cfg80211_ap_settings_flags {
1155 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1156};
1157
1158/**
Johannes Berg88600202012-02-13 15:17:18 +01001159 * struct cfg80211_ap_settings - AP configuration
1160 *
1161 * Used to configure an AP interface.
1162 *
Johannes Berg683b6d32012-11-08 21:25:48 +01001163 * @chandef: defines the channel to use
Johannes Berg88600202012-02-13 15:17:18 +01001164 * @beacon: beacon data
1165 * @beacon_interval: beacon interval
1166 * @dtim_period: DTIM period
1167 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
1168 * user space)
1169 * @ssid_len: length of @ssid
1170 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
1171 * @crypto: crypto settings
1172 * @privacy: the BSS uses privacy
1173 * @auth_type: Authentication type (algorithm)
Eliad Peller18998c32014-09-10 14:07:34 +03001174 * @smps_mode: SMPS mode
Vasanthakumar Thiagarajan1b658f12012-03-02 15:50:02 +05301175 * @inactivity_timeout: time in seconds to determine station's inactivity.
Johannes Berg53cabad2012-11-14 15:17:28 +01001176 * @p2p_ctwindow: P2P CT Window
1177 * @p2p_opp_ps: P2P opportunistic PS
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05301178 * @acl: ACL configuration used by the drivers which has support for
1179 * MAC address based access control
Lior David34d50512016-01-28 10:58:25 +02001180 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
1181 * networks.
Johannes Berg8564e382016-09-19 09:44:44 +02001182 * @beacon_rate: bitrate to be used for beacons
Johannes Berg66cd7942017-02-07 22:40:44 +02001183 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
1184 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
Shaul Triebitz244eb9a2018-08-31 11:31:14 +03001185 * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
Johannes Berg66cd7942017-02-07 22:40:44 +02001186 * @ht_required: stations must support HT
1187 * @vht_required: stations must support VHT
John Crispina0de1ca32019-05-28 13:49:48 +02001188 * @twt_responder: Enable Target Wait Time
Ilan Peer2a392592020-03-26 15:09:35 +02001189 * @he_required: stations must support HE
Ilan Peerd6587602020-11-29 17:30:46 +02001190 * @sae_h2e_required: stations must support direct H2E technique in SAE
Srinivas Dasarife494372019-01-23 18:06:56 +05301191 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
John Crispin796e90f2019-07-30 18:37:00 +02001192 * @he_obss_pd: OBSS Packet Detection settings
John Crispin5c5e52d2019-12-17 15:19:18 +01001193 * @he_bss_color: BSS Color settings
Shaul Triebitz7e8d6f12020-01-31 13:12:54 +02001194 * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
Aloka Dixit291c49d2020-09-11 00:05:29 +00001195 * @fils_discovery: FILS discovery transmission parameters
Aloka Dixit7443dcd2020-09-11 00:33:00 +00001196 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
Johannes Berg88600202012-02-13 15:17:18 +01001197 */
1198struct cfg80211_ap_settings {
Johannes Berg683b6d32012-11-08 21:25:48 +01001199 struct cfg80211_chan_def chandef;
Johannes Bergaa430da2012-05-16 23:50:18 +02001200
Johannes Berg88600202012-02-13 15:17:18 +01001201 struct cfg80211_beacon_data beacon;
1202
1203 int beacon_interval, dtim_period;
Jouni Malinen32e9de82011-08-10 23:53:31 +03001204 const u8 *ssid;
1205 size_t ssid_len;
1206 enum nl80211_hidden_ssid hidden_ssid;
Jouni Malinen5fb628e2011-08-10 23:54:35 +03001207 struct cfg80211_crypto_settings crypto;
1208 bool privacy;
1209 enum nl80211_auth_type auth_type;
Eliad Peller18998c32014-09-10 14:07:34 +03001210 enum nl80211_smps_mode smps_mode;
Vasanthakumar Thiagarajan1b658f12012-03-02 15:50:02 +05301211 int inactivity_timeout;
Johannes Berg53cabad2012-11-14 15:17:28 +01001212 u8 p2p_ctwindow;
1213 bool p2p_opp_ps;
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05301214 const struct cfg80211_acl_data *acl;
Lior David34d50512016-01-28 10:58:25 +02001215 bool pbss;
Purushottam Kushwahaa7c7fbf2016-09-14 17:38:44 +05301216 struct cfg80211_bitrate_mask beacon_rate;
Johannes Berg66cd7942017-02-07 22:40:44 +02001217
1218 const struct ieee80211_ht_cap *ht_cap;
1219 const struct ieee80211_vht_cap *vht_cap;
Shaul Triebitz244eb9a2018-08-31 11:31:14 +03001220 const struct ieee80211_he_cap_elem *he_cap;
Shaul Triebitz7e8d6f12020-01-31 13:12:54 +02001221 const struct ieee80211_he_operation *he_oper;
Ilan Peerd6587602020-11-29 17:30:46 +02001222 bool ht_required, vht_required, he_required, sae_h2e_required;
John Crispina0de1ca32019-05-28 13:49:48 +02001223 bool twt_responder;
Srinivas Dasarife494372019-01-23 18:06:56 +05301224 u32 flags;
John Crispin796e90f2019-07-30 18:37:00 +02001225 struct ieee80211_he_obss_pd he_obss_pd;
John Crispin5c5e52d2019-12-17 15:19:18 +01001226 struct cfg80211_he_bss_color he_bss_color;
Aloka Dixit291c49d2020-09-11 00:05:29 +00001227 struct cfg80211_fils_discovery fils_discovery;
Aloka Dixit7443dcd2020-09-11 00:33:00 +00001228 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
Johannes Berged1b6cc2007-12-19 02:03:32 +01001229};
1230
Johannes Berg5727ef12007-12-19 02:03:34 +01001231/**
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02001232 * struct cfg80211_csa_settings - channel switch settings
1233 *
1234 * Used for channel switch
1235 *
1236 * @chandef: defines the channel to use after the switch
1237 * @beacon_csa: beacon data while performing the switch
Andrei Otcheretianski9a774c72014-05-09 14:11:46 +03001238 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
1239 * @counter_offsets_presp: offsets of the counters within the probe response
1240 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
1241 * @n_counter_offsets_presp: number of csa counters in the probe response
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02001242 * @beacon_after: beacon data to be used on the new channel
1243 * @radar_required: whether radar detection is required on the new channel
1244 * @block_tx: whether transmissions should be blocked while changing
1245 * @count: number of beacons until switch
1246 */
1247struct cfg80211_csa_settings {
1248 struct cfg80211_chan_def chandef;
1249 struct cfg80211_beacon_data beacon_csa;
Andrei Otcheretianski9a774c72014-05-09 14:11:46 +03001250 const u16 *counter_offsets_beacon;
1251 const u16 *counter_offsets_presp;
1252 unsigned int n_counter_offsets_beacon;
1253 unsigned int n_counter_offsets_presp;
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02001254 struct cfg80211_beacon_data beacon_after;
1255 bool radar_required;
1256 bool block_tx;
1257 u8 count;
1258};
1259
Johannes Berg51a1aaa2018-01-15 09:32:36 +01001260#define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
1261
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02001262/**
Purushottam Kushwahae2273002016-10-12 18:25:35 +05301263 * struct iface_combination_params - input parameters for interface combinations
1264 *
1265 * Used to pass interface combination parameters
1266 *
1267 * @num_different_channels: the number of different channels we want
1268 * to use for verification
1269 * @radar_detect: a bitmap where each bit corresponds to a channel
1270 * width where radar detection is needed, as in the definition of
1271 * &struct ieee80211_iface_combination.@radar_detect_widths
1272 * @iftype_num: array with the number of interfaces of each interface
1273 * type. The index is the interface type as specified in &enum
1274 * nl80211_iftype.
Johannes Berg4c8dea62016-10-21 14:25:13 +02001275 * @new_beacon_int: set this to the beacon interval of a new interface
1276 * that's not operating yet, if such is to be checked as part of
1277 * the verification
Purushottam Kushwahae2273002016-10-12 18:25:35 +05301278 */
1279struct iface_combination_params {
1280 int num_different_channels;
1281 u8 radar_detect;
1282 int iftype_num[NUM_NL80211_IFTYPES];
Johannes Berg4c8dea62016-10-21 14:25:13 +02001283 u32 new_beacon_int;
Purushottam Kushwahae2273002016-10-12 18:25:35 +05301284};
1285
1286/**
Johannes Berg3b9ce802011-09-27 20:56:12 +02001287 * enum station_parameters_apply_mask - station parameter values to apply
1288 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
Jouni Malinen9d62a982013-02-14 21:10:13 +02001289 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
Johannes Bergf8bacc22013-02-14 23:27:01 +01001290 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
Johannes Berg3b9ce802011-09-27 20:56:12 +02001291 *
1292 * Not all station parameters have in-band "no change" signalling,
1293 * for those that don't these flags will are used.
1294 */
1295enum station_parameters_apply_mask {
1296 STATION_PARAM_APPLY_UAPSD = BIT(0),
Jouni Malinen9d62a982013-02-14 21:10:13 +02001297 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
Johannes Bergf8bacc22013-02-14 23:27:01 +01001298 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
Ashok Raj Nagarajane96d1cd2019-03-29 16:18:21 +05301299 STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1300};
1301
1302/**
1303 * struct sta_txpwr - station txpower configuration
1304 *
1305 * Used to configure txpower for station.
1306 *
1307 * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1308 * is not provided, the default per-interface tx power setting will be
1309 * overriding. Driver should be picking up the lowest tx power, either tx
1310 * power per-interface or per-station.
1311 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1312 * will be less than or equal to specified from userspace, whereas if TPC
1313 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1314 * NL80211_TX_POWER_FIXED is not a valid configuration option for
1315 * per peer TPC.
1316 */
1317struct sta_txpwr {
1318 s16 power;
1319 enum nl80211_tx_power_setting type;
Johannes Berg3b9ce802011-09-27 20:56:12 +02001320};
1321
1322/**
Johannes Berg5727ef12007-12-19 02:03:34 +01001323 * struct station_parameters - station parameters
1324 *
1325 * Used to change and create a new station.
1326 *
1327 * @vlan: vlan interface station should belong to
1328 * @supported_rates: supported rates in IEEE 802.11 format
1329 * (or NULL for no change)
1330 * @supported_rates_len: number of supported rates
Johannes Bergeccb8e82009-05-11 21:57:56 +03001331 * @sta_flags_mask: station flags that changed
Johannes Berg819bf592016-10-11 14:56:53 +02001332 * (bitmask of BIT(%NL80211_STA_FLAG_...))
Johannes Bergeccb8e82009-05-11 21:57:56 +03001333 * @sta_flags_set: station flags values
Johannes Berg819bf592016-10-11 14:56:53 +02001334 * (bitmask of BIT(%NL80211_STA_FLAG_...))
Johannes Berg5727ef12007-12-19 02:03:34 +01001335 * @listen_interval: listen interval or -1 for no change
1336 * @aid: AID or zero for no change
Gurumoorthi Gnanasambandhan14f34e362019-10-31 23:46:40 +02001337 * @vlan_id: VLAN ID for station (if nonzero)
Masashi Honma7d27a0b2016-07-01 10:19:34 +09001338 * @peer_aid: mesh peer AID or zero for no change
Johannes Bergabe37c42010-06-07 11:12:27 +02001339 * @plink_action: plink action to take
Javier Cardona9c3990a2011-05-03 16:57:11 -07001340 * @plink_state: set the peer link state for a station
Johannes Bergabe37c42010-06-07 11:12:27 +02001341 * @ht_capa: HT capabilities of station
Mahesh Palivelaf461be3e2012-10-11 08:04:52 +00001342 * @vht_capa: VHT capabilities of station
Eliad Peller910868d2011-09-11 09:46:55 +03001343 * @uapsd_queues: bitmap of queues configured for uapsd. same format
1344 * as the AC bitmap in the QoS info field
1345 * @max_sp: max Service Period. same format as the MAX_SP in the
1346 * QoS info field (but already shifted down)
Johannes Bergc26887d2011-11-08 09:20:07 +01001347 * @sta_modify_mask: bitmap indicating which parameters changed
1348 * (for those that don't have a natural "no change" value),
1349 * see &enum station_parameters_apply_mask
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001350 * @local_pm: local link-specific mesh power save mode (no change when set
1351 * to unknown)
Jouni Malinen9d62a982013-02-14 21:10:13 +02001352 * @capability: station capability
1353 * @ext_capab: extended capabilities of the station
1354 * @ext_capab_len: number of extended capabilities
Sunil Duttc01fc9a2013-10-09 20:45:21 +05301355 * @supported_channels: supported channels in IEEE 802.11 format
1356 * @supported_channels_len: number of supported channels
1357 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1358 * @supported_oper_classes_len: number of supported operating classes
Marek Kwaczynski60f4a7b2013-12-03 10:04:59 +01001359 * @opmode_notif: operating mode field from Operating Mode Notification
1360 * @opmode_notif_used: information if operating mode field is used
Ayala Beker17b94242016-03-17 15:41:38 +02001361 * @support_p2p_ps: information if station supports P2P PS mechanism
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001362 * @he_capa: HE capabilities of station
1363 * @he_capa_len: the length of the HE capabilities
Toke Høiland-Jørgensen36647052018-12-18 17:02:07 -08001364 * @airtime_weight: airtime scheduler weight for this station
Lothar Rubuscha710d212020-04-08 23:10:13 +00001365 * @txpwr: transmit power for an associated station
Rajkumar Manoharan43e64bf2020-05-28 21:34:29 +02001366 * @he_6ghz_capa: HE 6 GHz Band capabilities of station
Johannes Berg5727ef12007-12-19 02:03:34 +01001367 */
1368struct station_parameters {
Johannes Berg2c1aabf2013-02-14 23:33:40 +01001369 const u8 *supported_rates;
Johannes Berg5727ef12007-12-19 02:03:34 +01001370 struct net_device *vlan;
Johannes Bergeccb8e82009-05-11 21:57:56 +03001371 u32 sta_flags_mask, sta_flags_set;
Johannes Berg3b9ce802011-09-27 20:56:12 +02001372 u32 sta_modify_mask;
Johannes Berg5727ef12007-12-19 02:03:34 +01001373 int listen_interval;
1374 u16 aid;
Gurumoorthi Gnanasambandhan14f34e362019-10-31 23:46:40 +02001375 u16 vlan_id;
Masashi Honma7d27a0b2016-07-01 10:19:34 +09001376 u16 peer_aid;
Johannes Berg5727ef12007-12-19 02:03:34 +01001377 u8 supported_rates_len;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001378 u8 plink_action;
Javier Cardona9c3990a2011-05-03 16:57:11 -07001379 u8 plink_state;
Johannes Berg2c1aabf2013-02-14 23:33:40 +01001380 const struct ieee80211_ht_cap *ht_capa;
1381 const struct ieee80211_vht_cap *vht_capa;
Eliad Pellerc75786c2011-08-23 14:37:46 +03001382 u8 uapsd_queues;
1383 u8 max_sp;
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001384 enum nl80211_mesh_power_mode local_pm;
Jouni Malinen9d62a982013-02-14 21:10:13 +02001385 u16 capability;
Johannes Berg2c1aabf2013-02-14 23:33:40 +01001386 const u8 *ext_capab;
Jouni Malinen9d62a982013-02-14 21:10:13 +02001387 u8 ext_capab_len;
Sunil Duttc01fc9a2013-10-09 20:45:21 +05301388 const u8 *supported_channels;
1389 u8 supported_channels_len;
1390 const u8 *supported_oper_classes;
1391 u8 supported_oper_classes_len;
Marek Kwaczynski60f4a7b2013-12-03 10:04:59 +01001392 u8 opmode_notif;
1393 bool opmode_notif_used;
Ayala Beker17b94242016-03-17 15:41:38 +02001394 int support_p2p_ps;
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001395 const struct ieee80211_he_cap_elem *he_capa;
1396 u8 he_capa_len;
Toke Høiland-Jørgensen36647052018-12-18 17:02:07 -08001397 u16 airtime_weight;
Ashok Raj Nagarajane96d1cd2019-03-29 16:18:21 +05301398 struct sta_txpwr txpwr;
Rajkumar Manoharan43e64bf2020-05-28 21:34:29 +02001399 const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
Johannes Berg5727ef12007-12-19 02:03:34 +01001400};
1401
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001402/**
Jouni Malinen89c771e2014-10-10 20:52:40 +03001403 * struct station_del_parameters - station deletion parameters
1404 *
1405 * Used to delete a station entry (or all stations).
1406 *
1407 * @mac: MAC address of the station to remove or NULL to remove all stations
Jouni Malinen98856862014-10-20 13:20:45 +03001408 * @subtype: Management frame subtype to use for indicating removal
1409 * (10 = Disassociation, 12 = Deauthentication)
1410 * @reason_code: Reason code for the Disassociation/Deauthentication frame
Jouni Malinen89c771e2014-10-10 20:52:40 +03001411 */
1412struct station_del_parameters {
1413 const u8 *mac;
Jouni Malinen98856862014-10-20 13:20:45 +03001414 u8 subtype;
1415 u16 reason_code;
Jouni Malinen89c771e2014-10-10 20:52:40 +03001416};
1417
1418/**
Johannes Berg77ee7c82013-02-15 00:48:33 +01001419 * enum cfg80211_station_type - the type of station being modified
1420 * @CFG80211_STA_AP_CLIENT: client of an AP interface
Ayala Beker47edb112015-09-21 15:49:53 +03001421 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
1422 * unassociated (update properties for this type of client is permitted)
Johannes Berg77ee7c82013-02-15 00:48:33 +01001423 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
1424 * the AP MLME in the device
1425 * @CFG80211_STA_AP_STA: AP station on managed interface
1426 * @CFG80211_STA_IBSS: IBSS station
1427 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
1428 * while TDLS setup is in progress, it moves out of this state when
1429 * being marked authorized; use this only if TDLS with external setup is
1430 * supported/used)
1431 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
1432 * entry that is operating, has been marked authorized by userspace)
Thomas Pederseneef941e2013-03-04 13:06:11 -08001433 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1434 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
Johannes Berg77ee7c82013-02-15 00:48:33 +01001435 */
1436enum cfg80211_station_type {
1437 CFG80211_STA_AP_CLIENT,
Ayala Beker47edb112015-09-21 15:49:53 +03001438 CFG80211_STA_AP_CLIENT_UNASSOC,
Johannes Berg77ee7c82013-02-15 00:48:33 +01001439 CFG80211_STA_AP_MLME_CLIENT,
1440 CFG80211_STA_AP_STA,
1441 CFG80211_STA_IBSS,
1442 CFG80211_STA_TDLS_PEER_SETUP,
1443 CFG80211_STA_TDLS_PEER_ACTIVE,
Thomas Pederseneef941e2013-03-04 13:06:11 -08001444 CFG80211_STA_MESH_PEER_KERNEL,
1445 CFG80211_STA_MESH_PEER_USER,
Johannes Berg77ee7c82013-02-15 00:48:33 +01001446};
1447
1448/**
1449 * cfg80211_check_station_change - validate parameter changes
1450 * @wiphy: the wiphy this operates on
1451 * @params: the new parameters for a station
1452 * @statype: the type of station being modified
1453 *
1454 * Utility function for the @change_station driver method. Call this function
1455 * with the appropriate station type looking up the station (and checking that
1456 * it exists). It will verify whether the station change is acceptable, and if
1457 * not will return an error code. Note that it may modify the parameters for
1458 * backward compatibility reasons, so don't use them before calling this.
1459 */
1460int cfg80211_check_station_change(struct wiphy *wiphy,
1461 struct station_parameters *params,
1462 enum cfg80211_station_type statype);
1463
1464/**
Mauro Carvalho Chehabb1e8eb12020-10-23 18:33:08 +02001465 * enum rate_info_flags - bitrate info flags
Henning Rogge420e7fa2008-12-11 22:04:19 +01001466 *
1467 * Used by the driver to indicate the specific rate transmission
1468 * type for 802.11n transmissions.
1469 *
Johannes Bergdb9c64c2012-11-09 14:56:41 +01001470 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1471 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
Henning Rogge420e7fa2008-12-11 22:04:19 +01001472 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +03001473 * @RATE_INFO_FLAGS_DMG: 60GHz MCS
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001474 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +03001475 * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
Henning Rogge420e7fa2008-12-11 22:04:19 +01001476 */
1477enum rate_info_flags {
Johannes Bergdb9c64c2012-11-09 14:56:41 +01001478 RATE_INFO_FLAGS_MCS = BIT(0),
1479 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
Johannes Bergb51f3be2015-01-15 16:14:02 +01001480 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +03001481 RATE_INFO_FLAGS_DMG = BIT(3),
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001482 RATE_INFO_FLAGS_HE_MCS = BIT(4),
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +03001483 RATE_INFO_FLAGS_EDMG = BIT(5),
Johannes Bergb51f3be2015-01-15 16:14:02 +01001484};
1485
1486/**
1487 * enum rate_info_bw - rate bandwidth information
1488 *
1489 * Used by the driver to indicate the rate bandwidth.
1490 *
1491 * @RATE_INFO_BW_5: 5 MHz bandwidth
1492 * @RATE_INFO_BW_10: 10 MHz bandwidth
1493 * @RATE_INFO_BW_20: 20 MHz bandwidth
1494 * @RATE_INFO_BW_40: 40 MHz bandwidth
1495 * @RATE_INFO_BW_80: 80 MHz bandwidth
1496 * @RATE_INFO_BW_160: 160 MHz bandwidth
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001497 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
Johannes Bergb51f3be2015-01-15 16:14:02 +01001498 */
1499enum rate_info_bw {
Johannes Berg842be752017-05-04 08:42:30 +02001500 RATE_INFO_BW_20 = 0,
Johannes Bergb51f3be2015-01-15 16:14:02 +01001501 RATE_INFO_BW_5,
1502 RATE_INFO_BW_10,
Johannes Bergb51f3be2015-01-15 16:14:02 +01001503 RATE_INFO_BW_40,
1504 RATE_INFO_BW_80,
1505 RATE_INFO_BW_160,
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001506 RATE_INFO_BW_HE_RU,
Henning Rogge420e7fa2008-12-11 22:04:19 +01001507};
1508
1509/**
1510 * struct rate_info - bitrate information
1511 *
1512 * Information about a receiving or transmitting bitrate
1513 *
1514 * @flags: bitflag of flags from &enum rate_info_flags
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001515 * @mcs: mcs index if struct describes an HT/VHT/HE rate
Henning Rogge420e7fa2008-12-11 22:04:19 +01001516 * @legacy: bitrate in 100kbit/s for 802.11abg
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001517 * @nss: number of streams (VHT & HE only)
Johannes Bergb51f3be2015-01-15 16:14:02 +01001518 * @bw: bandwidth (from &enum rate_info_bw)
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001519 * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1520 * @he_dcm: HE DCM value
1521 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1522 * only valid if bw is %RATE_INFO_BW_HE_RU)
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +03001523 * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
Henning Rogge420e7fa2008-12-11 22:04:19 +01001524 */
1525struct rate_info {
1526 u8 flags;
1527 u8 mcs;
1528 u16 legacy;
Johannes Bergdb9c64c2012-11-09 14:56:41 +01001529 u8 nss;
Johannes Bergb51f3be2015-01-15 16:14:02 +01001530 u8 bw;
Luca Coelhoc4cbaf72018-06-09 09:14:42 +03001531 u8 he_gi;
1532 u8 he_dcm;
1533 u8 he_ru_alloc;
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +03001534 u8 n_bonded_ch;
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001535};
1536
1537/**
Mauro Carvalho Chehabb1e8eb12020-10-23 18:33:08 +02001538 * enum bss_param_flags - bitrate info flags
Paul Stewartf4263c92011-03-31 09:25:41 -07001539 *
1540 * Used by the driver to indicate the specific rate transmission
1541 * type for 802.11n transmissions.
1542 *
1543 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1544 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1545 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1546 */
1547enum bss_param_flags {
1548 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1549 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1550 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1551};
1552
1553/**
1554 * struct sta_bss_parameters - BSS parameters for the attached station
1555 *
1556 * Information about the currently associated BSS
1557 *
1558 * @flags: bitflag of flags from &enum bss_param_flags
1559 * @dtim_period: DTIM period for the BSS
1560 * @beacon_interval: beacon interval
1561 */
1562struct sta_bss_parameters {
1563 u8 flags;
1564 u8 dtim_period;
1565 u16 beacon_interval;
1566};
1567
Johannes Berg6de39802014-12-19 12:34:00 +01001568/**
Toke Høiland-Jørgensen52539ca2018-05-08 13:03:50 +02001569 * struct cfg80211_txq_stats - TXQ statistics for this TID
1570 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1571 * indicate the relevant values in this struct are filled
1572 * @backlog_bytes: total number of bytes currently backlogged
1573 * @backlog_packets: total number of packets currently backlogged
1574 * @flows: number of new flows seen
1575 * @drops: total number of packets dropped
1576 * @ecn_marks: total number of packets marked with ECN CE
1577 * @overlimit: number of drops due to queue space overflow
1578 * @overmemory: number of drops due to memory limit overflow
1579 * @collisions: number of hash collisions
1580 * @tx_bytes: total number of bytes dequeued
1581 * @tx_packets: total number of packets dequeued
1582 * @max_flows: maximum number of flows supported
1583 */
1584struct cfg80211_txq_stats {
1585 u32 filled;
1586 u32 backlog_bytes;
1587 u32 backlog_packets;
1588 u32 flows;
1589 u32 drops;
1590 u32 ecn_marks;
1591 u32 overlimit;
1592 u32 overmemory;
1593 u32 collisions;
1594 u32 tx_bytes;
1595 u32 tx_packets;
1596 u32 max_flows;
1597};
1598
1599/**
Johannes Berg6de39802014-12-19 12:34:00 +01001600 * struct cfg80211_tid_stats - per-TID statistics
1601 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1602 * indicate the relevant values in this struct are filled
1603 * @rx_msdu: number of received MSDUs
1604 * @tx_msdu: number of (attempted) transmitted MSDUs
1605 * @tx_msdu_retries: number of retries (not counting the first) for
1606 * transmitted MSDUs
1607 * @tx_msdu_failed: number of failed transmitted MSDUs
Toke Høiland-Jørgensen52539ca2018-05-08 13:03:50 +02001608 * @txq_stats: TXQ statistics
Johannes Berg6de39802014-12-19 12:34:00 +01001609 */
1610struct cfg80211_tid_stats {
1611 u32 filled;
1612 u64 rx_msdu;
1613 u64 tx_msdu;
1614 u64 tx_msdu_retries;
1615 u64 tx_msdu_failed;
Toke Høiland-Jørgensen52539ca2018-05-08 13:03:50 +02001616 struct cfg80211_txq_stats txq_stats;
Johannes Berg6de39802014-12-19 12:34:00 +01001617};
1618
Felix Fietkau119363c2013-04-22 16:29:30 +02001619#define IEEE80211_MAX_CHAINS 4
1620
Paul Stewartf4263c92011-03-31 09:25:41 -07001621/**
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001622 * struct station_info - station information
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001623 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001624 * Station information filled by driver for get_station() and dump_station.
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001625 *
Johannes Berg319090b2014-11-17 14:08:11 +01001626 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1627 * indicate the relevant values in this struct for them
Mohammed Shafi Shajakhanebe27c92011-04-08 21:24:24 +05301628 * @connected_time: time(in secs) since a station is last connected
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001629 * @inactive_time: time since last station activity (tx/rx) in milliseconds
Ben Greear6c7a0032019-08-09 11:00:00 -07001630 * @assoc_at: bootime (ns) of the last association
Johannes Berg8d791362014-11-21 12:40:05 +01001631 * @rx_bytes: bytes (size of MPDUs) received from this station
1632 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001633 * @llid: mesh local link id
1634 * @plid: mesh peer link id
1635 * @plink_state: mesh peer link state
Johannes Berg73c3df32012-06-13 11:17:14 +02001636 * @signal: The signal strength, type depends on the wiphy's signal_type.
1637 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1638 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1639 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
Felix Fietkau119363c2013-04-22 16:29:30 +02001640 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1641 * @chain_signal: per-chain signal strength of last received packet in dBm
1642 * @chain_signal_avg: per-chain signal strength average in dBm
Randy Dunlap858022a2011-03-18 09:33:02 -07001643 * @txrate: current unicast bitrate from this station
1644 * @rxrate: current unicast bitrate to this station
Johannes Berg8d791362014-11-21 12:40:05 +01001645 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1646 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1647 * @tx_retries: cumulative retry counts (MPDUs)
1648 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
Ben Greear5a5c7312010-10-07 16:39:20 -07001649 * @rx_dropped_misc: Dropped for un-specified reason.
Randy Dunlap1ba01452011-05-22 17:16:20 -07001650 * @bss_param: current BSS parameters
Johannes Bergf5ea9122009-08-07 16:17:38 +02001651 * @generation: generation number for nl80211 dumps.
1652 * This number should increase every time the list of stations
1653 * changes, i.e. when a station is added or removed, so that
1654 * userspace can tell whether it got a consistent snapshot.
Jouni Malinen50d3dfb2011-08-08 12:11:52 +03001655 * @assoc_req_ies: IEs from (Re)Association Request.
1656 * This is used only when in AP mode with drivers that do not use
1657 * user space MLME/SME implementation. The information is provided for
1658 * the cfg80211_new_sta() calls to notify user space of the IEs.
1659 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
Johannes Bergc26887d2011-11-08 09:20:07 +01001660 * @sta_flags: station flags mask & values
Paul Stewarta85e1d52011-12-09 11:01:49 -08001661 * @beacon_loss_count: Number of times beacon loss event has triggered.
Javier Cardonad299a1f2012-03-31 11:31:33 -07001662 * @t_offset: Time offset of the station relative to this host.
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001663 * @local_pm: local mesh STA power save mode
1664 * @peer_pm: peer mesh STA power save mode
1665 * @nonpeer_pm: non-peer mesh STA power save mode
Antonio Quartulli867d849f2014-05-19 21:53:19 +02001666 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1667 * towards this station.
Johannes Berga76b1942014-11-17 14:12:22 +01001668 * @rx_beacon: number of beacons received from this peer
1669 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1670 * from this peer
Bob Copelanddbdaee72018-10-25 15:48:53 -04001671 * @connected_to_gate: true if mesh STA has a path to mesh gate
Mohammed Shafi Shajakhan739960f2016-04-07 19:59:34 +05301672 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
Toke Høiland-Jørgensen36647052018-12-18 17:02:07 -08001673 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
1674 * @airtime_weight: current airtime scheduling weight
Johannes Berg6de39802014-12-19 12:34:00 +01001675 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1676 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
Arend van Spriel8689c052018-05-10 13:50:12 +02001677 * Note that this doesn't use the @filled bit, but is used if non-NULL.
Venkateswara Naralasettyc4b50cd2018-02-13 11:03:06 +05301678 * @ack_signal: signal strength (in dBm) of the last ACK frame.
Balaji Pothunoori81d54392018-04-16 20:18:40 +05301679 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1680 * been sent.
Ankita Bajaj0d4e14a2018-09-27 18:01:57 +03001681 * @rx_mpdu_count: number of MPDUs received from this station
1682 * @fcs_err_count: number of packets (MPDUs) received from this station with
1683 * an FCS error. This counter should be incremented only when TA of the
1684 * received packet with an FCS error matches the peer MAC address.
Narayanraddi Mastiab606332019-02-07 12:16:05 -08001685 * @airtime_link_metric: mesh airtime link metric.
Markus Theil1303a512020-06-11 16:02:38 +02001686 * @connected_to_as: true if mesh STA has a path to authentication server
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001687 */
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001688struct station_info {
Mohammed Shafi Shajakhan739960f2016-04-07 19:59:34 +05301689 u64 filled;
Mohammed Shafi Shajakhanebe27c92011-04-08 21:24:24 +05301690 u32 connected_time;
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001691 u32 inactive_time;
Ben Greear6c7a0032019-08-09 11:00:00 -07001692 u64 assoc_at;
Vladimir Kondratiev42745e02013-02-04 13:53:11 +02001693 u64 rx_bytes;
1694 u64 tx_bytes;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001695 u16 llid;
1696 u16 plid;
1697 u8 plink_state;
Henning Rogge420e7fa2008-12-11 22:04:19 +01001698 s8 signal;
Bruno Randolf541a45a2010-12-02 19:12:43 +09001699 s8 signal_avg;
Felix Fietkau119363c2013-04-22 16:29:30 +02001700
1701 u8 chains;
1702 s8 chain_signal[IEEE80211_MAX_CHAINS];
1703 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1704
Henning Rogge420e7fa2008-12-11 22:04:19 +01001705 struct rate_info txrate;
Felix Fietkauc8dcfd82011-02-27 22:08:00 +01001706 struct rate_info rxrate;
Jouni Malinen98c8a60a2009-02-17 13:24:57 +02001707 u32 rx_packets;
1708 u32 tx_packets;
Bruno Randolfb206b4ef2010-10-06 18:34:12 +09001709 u32 tx_retries;
1710 u32 tx_failed;
Ben Greear5a5c7312010-10-07 16:39:20 -07001711 u32 rx_dropped_misc;
Paul Stewartf4263c92011-03-31 09:25:41 -07001712 struct sta_bss_parameters bss_param;
Helmut Schaabb6e7532011-10-13 16:30:39 +02001713 struct nl80211_sta_flag_update sta_flags;
Johannes Bergf5ea9122009-08-07 16:17:38 +02001714
1715 int generation;
Jouni Malinen50d3dfb2011-08-08 12:11:52 +03001716
1717 const u8 *assoc_req_ies;
1718 size_t assoc_req_ies_len;
Jouni Malinenf612ced2011-08-11 11:46:22 +03001719
Paul Stewarta85e1d52011-12-09 11:01:49 -08001720 u32 beacon_loss_count;
Javier Cardonad299a1f2012-03-31 11:31:33 -07001721 s64 t_offset;
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001722 enum nl80211_mesh_power_mode local_pm;
1723 enum nl80211_mesh_power_mode peer_pm;
1724 enum nl80211_mesh_power_mode nonpeer_pm;
Paul Stewarta85e1d52011-12-09 11:01:49 -08001725
Antonio Quartulli867d849f2014-05-19 21:53:19 +02001726 u32 expected_throughput;
Johannes Berga76b1942014-11-17 14:12:22 +01001727
Toke Høiland-Jørgensen36647052018-12-18 17:02:07 -08001728 u64 tx_duration;
Mohammed Shafi Shajakhan739960f2016-04-07 19:59:34 +05301729 u64 rx_duration;
Toke Høiland-Jørgensen36647052018-12-18 17:02:07 -08001730 u64 rx_beacon;
Johannes Berga76b1942014-11-17 14:12:22 +01001731 u8 rx_beacon_signal_avg;
Bob Copelanddbdaee72018-10-25 15:48:53 -04001732 u8 connected_to_gate;
1733
Arend van Spriel8689c052018-05-10 13:50:12 +02001734 struct cfg80211_tid_stats *pertid;
Venkateswara Naralasettyc4b50cd2018-02-13 11:03:06 +05301735 s8 ack_signal;
Balaji Pothunoori81d54392018-04-16 20:18:40 +05301736 s8 avg_ack_signal;
Ankita Bajaj0d4e14a2018-09-27 18:01:57 +03001737
Toke Høiland-Jørgensen36647052018-12-18 17:02:07 -08001738 u16 airtime_weight;
1739
Ankita Bajaj0d4e14a2018-09-27 18:01:57 +03001740 u32 rx_mpdu_count;
1741 u32 fcs_err_count;
Narayanraddi Mastiab606332019-02-07 12:16:05 -08001742
1743 u32 airtime_link_metric;
Markus Theil1303a512020-06-11 16:02:38 +02001744
1745 u8 connected_to_as;
Johannes Bergfd5b74d2007-12-19 02:03:36 +01001746};
1747
Linus Lüssing61aaa0e2016-08-19 22:02:48 +02001748#if IS_ENABLED(CONFIG_CFG80211)
Michael Wu66f7ac52008-01-31 19:48:22 +01001749/**
Antonio Quartulli74063532014-05-19 21:53:21 +02001750 * cfg80211_get_station - retrieve information about a given station
1751 * @dev: the device where the station is supposed to be connected to
1752 * @mac_addr: the mac address of the station of interest
1753 * @sinfo: pointer to the structure to fill with the information
1754 *
1755 * Returns 0 on success and sinfo is filled with the available information
1756 * otherwise returns a negative error code and the content of sinfo has to be
1757 * considered undefined.
1758 */
1759int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1760 struct station_info *sinfo);
Linus Lüssing61aaa0e2016-08-19 22:02:48 +02001761#else
1762static inline int cfg80211_get_station(struct net_device *dev,
1763 const u8 *mac_addr,
1764 struct station_info *sinfo)
1765{
1766 return -ENOENT;
1767}
1768#endif
Antonio Quartulli74063532014-05-19 21:53:21 +02001769
1770/**
Michael Wu66f7ac52008-01-31 19:48:22 +01001771 * enum monitor_flags - monitor flags
1772 *
1773 * Monitor interface configuration flags. Note that these must be the bits
1774 * according to the nl80211 flags.
1775 *
Johannes Berg818a9862017-04-12 11:23:28 +02001776 * @MONITOR_FLAG_CHANGED: set if the flags were changed
Michael Wu66f7ac52008-01-31 19:48:22 +01001777 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1778 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1779 * @MONITOR_FLAG_CONTROL: pass control frames
1780 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1781 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
Felix Fietkaue057d3c2013-05-28 13:01:52 +02001782 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
Michael Wu66f7ac52008-01-31 19:48:22 +01001783 */
1784enum monitor_flags {
Johannes Berg818a9862017-04-12 11:23:28 +02001785 MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
Michael Wu66f7ac52008-01-31 19:48:22 +01001786 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1787 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1788 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1789 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1790 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
Felix Fietkaue057d3c2013-05-28 13:01:52 +02001791 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
Michael Wu66f7ac52008-01-31 19:48:22 +01001792};
1793
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001794/**
1795 * enum mpath_info_flags - mesh path information flags
1796 *
1797 * Used by the driver to indicate which info in &struct mpath_info it has filled
1798 * in during get_station() or dump_station().
1799 *
Johannes Bergabe37c42010-06-07 11:12:27 +02001800 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1801 * @MPATH_INFO_SN: @sn filled
1802 * @MPATH_INFO_METRIC: @metric filled
1803 * @MPATH_INFO_EXPTIME: @exptime filled
1804 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1805 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1806 * @MPATH_INFO_FLAGS: @flags filled
Julan Hsucc241632019-01-15 15:28:42 -08001807 * @MPATH_INFO_HOP_COUNT: @hop_count filled
Johannes Berg9874b712019-02-01 11:52:44 +01001808 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001809 */
1810enum mpath_info_flags {
1811 MPATH_INFO_FRAME_QLEN = BIT(0),
Rui Paulod19b3bf2009-11-09 23:46:55 +00001812 MPATH_INFO_SN = BIT(1),
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001813 MPATH_INFO_METRIC = BIT(2),
1814 MPATH_INFO_EXPTIME = BIT(3),
1815 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1816 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1817 MPATH_INFO_FLAGS = BIT(6),
Julan Hsu540bbcb2019-01-15 15:28:43 -08001818 MPATH_INFO_HOP_COUNT = BIT(7),
1819 MPATH_INFO_PATH_CHANGE = BIT(8),
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001820};
1821
1822/**
1823 * struct mpath_info - mesh path information
1824 *
1825 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1826 *
1827 * @filled: bitfield of flags from &enum mpath_info_flags
1828 * @frame_qlen: number of queued frames for this destination
Rui Paulod19b3bf2009-11-09 23:46:55 +00001829 * @sn: target sequence number
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001830 * @metric: metric (cost) of this mesh path
1831 * @exptime: expiration time for the mesh path from now, in msecs
1832 * @flags: mesh path flags
1833 * @discovery_timeout: total mesh path discovery timeout, in msecs
1834 * @discovery_retries: mesh path discovery retries
Johannes Bergf5ea9122009-08-07 16:17:38 +02001835 * @generation: generation number for nl80211 dumps.
1836 * This number should increase every time the list of mesh paths
1837 * changes, i.e. when a station is added or removed, so that
1838 * userspace can tell whether it got a consistent snapshot.
Julan Hsucc241632019-01-15 15:28:42 -08001839 * @hop_count: hops to destination
Julan Hsu540bbcb2019-01-15 15:28:43 -08001840 * @path_change_count: total number of path changes to destination
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001841 */
1842struct mpath_info {
1843 u32 filled;
1844 u32 frame_qlen;
Rui Paulod19b3bf2009-11-09 23:46:55 +00001845 u32 sn;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001846 u32 metric;
1847 u32 exptime;
1848 u32 discovery_timeout;
1849 u8 discovery_retries;
1850 u8 flags;
Julan Hsucc241632019-01-15 15:28:42 -08001851 u8 hop_count;
Julan Hsu540bbcb2019-01-15 15:28:43 -08001852 u32 path_change_count;
Johannes Bergf5ea9122009-08-07 16:17:38 +02001853
1854 int generation;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001855};
1856
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001857/**
1858 * struct bss_parameters - BSS parameters
1859 *
1860 * Used to change BSS parameters (mainly for AP mode).
1861 *
1862 * @use_cts_prot: Whether to use CTS protection
1863 * (0 = no, 1 = yes, -1 = do not change)
1864 * @use_short_preamble: Whether the use of short preambles is allowed
1865 * (0 = no, 1 = yes, -1 = do not change)
1866 * @use_short_slot_time: Whether the use of short slot time is allowed
1867 * (0 = no, 1 = yes, -1 = do not change)
Jouni Malinen90c97a02008-10-30 16:59:22 +02001868 * @basic_rates: basic rates in IEEE 802.11 format
1869 * (or NULL for no change)
1870 * @basic_rates_len: number of basic rates
Felix Fietkaufd8aaaf2010-04-27 01:23:35 +02001871 * @ap_isolate: do not forward packets between connected stations
Wright Feng9d6e3712020-09-08 01:01:57 -05001872 * (0 = no, 1 = yes, -1 = do not change)
Helmut Schaa50b12f52010-11-19 12:40:25 +01001873 * @ht_opmode: HT Operation mode
Jérôme Pouillercd9b52b2020-02-21 12:56:04 +01001874 * (u16 = opmode, -1 = do not change)
Johannes Berg53cabad2012-11-14 15:17:28 +01001875 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1876 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001877 */
1878struct bss_parameters {
1879 int use_cts_prot;
1880 int use_short_preamble;
1881 int use_short_slot_time;
Johannes Bergc1e5f472014-05-19 17:53:16 +02001882 const u8 *basic_rates;
Jouni Malinen90c97a02008-10-30 16:59:22 +02001883 u8 basic_rates_len;
Felix Fietkaufd8aaaf2010-04-27 01:23:35 +02001884 int ap_isolate;
Helmut Schaa50b12f52010-11-19 12:40:25 +01001885 int ht_opmode;
Johannes Berg53cabad2012-11-14 15:17:28 +01001886 s8 p2p_ctwindow, p2p_opp_ps;
Jouni Malinen9f1ba902008-08-07 20:07:01 +03001887};
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01001888
Chun-Yeow Yeoh3ddd53f2012-06-11 11:59:10 +08001889/**
Johannes Berg29cbe682010-12-03 09:20:44 +01001890 * struct mesh_config - 802.11s mesh configuration
1891 *
1892 * These parameters can be changed while the mesh is active.
Chun-Yeow Yeoh3ddd53f2012-06-11 11:59:10 +08001893 *
1894 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1895 * by the Mesh Peering Open message
1896 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1897 * used by the Mesh Peering Open message
1898 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1899 * the mesh peering management to close a mesh peering
1900 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1901 * mesh interface
1902 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1903 * be sent to establish a new peer link instance in a mesh
1904 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1905 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1906 * elements
1907 * @auto_open_plinks: whether we should automatically open peer links when we
1908 * detect compatible mesh peers
1909 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1910 * synchronize to for 11s default synchronization method
1911 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1912 * that an originator mesh STA can send to a particular path target
1913 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1914 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1915 * a path discovery in milliseconds
1916 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1917 * receiving a PREQ shall consider the forwarding information from the
1918 * root to be valid. (TU = time unit)
1919 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1920 * which a mesh STA can send only one action frame containing a PREQ
1921 * element
1922 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1923 * which a mesh STA can send only one Action frame containing a PERR
1924 * element
1925 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1926 * it takes for an HWMP information element to propagate across the mesh
1927 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1928 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1929 * announcements are transmitted
1930 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1931 * station has access to a broader network beyond the MBSS. (This is
1932 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1933 * only means that the station will announce others it's a mesh gate, but
1934 * not necessarily using the gate announcement protocol. Still keeping the
1935 * same nomenclature to be in sync with the spec)
1936 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1937 * entity (default is TRUE - forwarding entity)
1938 * @rssi_threshold: the threshold for average signal strength of candidate
1939 * station to establish a peer link
1940 * @ht_opmode: mesh HT protection mode
Chun-Yeow Yeohac1073a2012-06-14 02:06:06 +08001941 *
1942 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1943 * receiving a proactive PREQ shall consider the forwarding information to
1944 * the root mesh STA to be valid.
1945 *
1946 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1947 * PREQs are transmitted.
Chun-Yeow Yeoh728b19e2012-06-14 02:06:10 +08001948 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1949 * during which a mesh STA can send only one Action frame containing
1950 * a PREQ element for root path confirmation.
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001951 * @power_mode: The default mesh power save mode which will be the initial
1952 * setting for new peer links.
1953 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1954 * after transmitting its beacon.
Colleen Twitty8e7c0532013-06-03 09:53:39 -07001955 * @plink_timeout: If no tx activity is seen from a STA we've established
1956 * peering with for longer than this time (in seconds), then remove it
1957 * from the STA's list of peers. Default is 30 minutes.
Bob Copeland01d66fb2018-10-25 17:36:34 -04001958 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
1959 * connected to a mesh gate in mesh formation info. If false, the
1960 * value in mesh formation is determined by the presence of root paths
1961 * in the mesh path table
Linus Lüssinge3718a62020-06-17 09:30:33 +02001962 * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
1963 * for HWMP) if the destination is a direct neighbor. Note that this might
1964 * not be the optimal decision as a multi-hop route might be better. So
1965 * if using this setting you will likely also want to disable
1966 * dot11MeshForwarding and use another mesh routing protocol on top.
Johannes Berg29cbe682010-12-03 09:20:44 +01001967 */
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001968struct mesh_config {
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001969 u16 dot11MeshRetryTimeout;
1970 u16 dot11MeshConfirmTimeout;
1971 u16 dot11MeshHoldingTimeout;
1972 u16 dot11MeshMaxPeerLinks;
Chun-Yeow Yeoha4f606e2012-06-11 11:59:36 +08001973 u8 dot11MeshMaxRetries;
1974 u8 dot11MeshTTL;
1975 u8 element_ttl;
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001976 bool auto_open_plinks;
Javier Cardonad299a1f2012-03-31 11:31:33 -07001977 u32 dot11MeshNbrOffsetMaxNeighbor;
Chun-Yeow Yeoha4f606e2012-06-11 11:59:36 +08001978 u8 dot11MeshHWMPmaxPREQretries;
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001979 u32 path_refresh_time;
1980 u16 min_discovery_timeout;
1981 u32 dot11MeshHWMPactivePathTimeout;
1982 u16 dot11MeshHWMPpreqMinInterval;
Thomas Pedersendca7e942011-11-24 17:15:24 -08001983 u16 dot11MeshHWMPperrMinInterval;
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07001984 u16 dot11MeshHWMPnetDiameterTraversalTime;
Chun-Yeow Yeoha4f606e2012-06-11 11:59:36 +08001985 u8 dot11MeshHWMPRootMode;
Bob Copeland01d66fb2018-10-25 17:36:34 -04001986 bool dot11MeshConnectedToMeshGate;
Markus Theil184eebe2020-06-11 16:02:37 +02001987 bool dot11MeshConnectedToAuthServer;
Javier Cardona0507e152011-08-09 16:45:10 -07001988 u16 dot11MeshHWMPRannInterval;
Chun-Yeow Yeoha4f606e2012-06-11 11:59:36 +08001989 bool dot11MeshGateAnnouncementProtocol;
Chun-Yeow Yeoh94f90652012-01-21 01:02:16 +08001990 bool dot11MeshForwarding;
Ashok Nagarajan55335132012-02-28 17:04:08 -08001991 s32 rssi_threshold;
Ashok Nagarajan70c33ea2012-04-30 14:20:32 -07001992 u16 ht_opmode;
Chun-Yeow Yeohac1073a2012-06-14 02:06:06 +08001993 u32 dot11MeshHWMPactivePathToRootTimeout;
1994 u16 dot11MeshHWMProotInterval;
Chun-Yeow Yeoh728b19e2012-06-14 02:06:10 +08001995 u16 dot11MeshHWMPconfirmationInterval;
Marco Porsch3b1c5a52013-01-07 16:04:52 +01001996 enum nl80211_mesh_power_mode power_mode;
1997 u16 dot11MeshAwakeWindowDuration;
Colleen Twitty8e7c0532013-06-03 09:53:39 -07001998 u32 plink_timeout;
Linus Lüssinge3718a62020-06-17 09:30:33 +02001999 bool dot11MeshNolearn;
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07002000};
2001
Jouni Malinen31888482008-10-30 16:59:24 +02002002/**
Johannes Berg29cbe682010-12-03 09:20:44 +01002003 * struct mesh_setup - 802.11s mesh setup configuration
Johannes Berg683b6d32012-11-08 21:25:48 +01002004 * @chandef: defines the channel to use
Johannes Berg29cbe682010-12-03 09:20:44 +01002005 * @mesh_id: the mesh ID
2006 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
Javier Cardonad299a1f2012-03-31 11:31:33 -07002007 * @sync_method: which synchronization method to use
Javier Cardonac80d5452010-12-16 17:37:49 -08002008 * @path_sel_proto: which path selection protocol to use
2009 * @path_metric: which metric to use
Colleen Twitty6e16d902013-05-08 11:45:59 -07002010 * @auth_id: which authentication method this mesh is using
Javier Cardona581a8b02011-04-07 15:08:27 -07002011 * @ie: vendor information elements (optional)
2012 * @ie_len: length of vendor information elements
Javier Cardonab130e5c2011-05-03 16:57:07 -07002013 * @is_authenticated: this mesh requires authentication
2014 * @is_secure: this mesh uses security
Thomas Pedersenbb2798d2013-03-04 13:06:10 -08002015 * @user_mpm: userspace handles all MPM functions
Marco Porsch9bdbf042013-01-07 16:04:51 +01002016 * @dtim_period: DTIM period to use
2017 * @beacon_interval: beacon interval to use
Chun-Yeow Yeoh4bb62342011-11-24 17:15:20 -08002018 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
Ashok Nagarajanffb3cf32013-06-03 10:33:36 -07002019 * @basic_rates: basic rates to use when creating the mesh
Johannes Berg8564e382016-09-19 09:44:44 +02002020 * @beacon_rate: bitrate to be used for beacons
Benjamin Bergd37d49c2017-05-16 11:23:11 +02002021 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2022 * changes the channel when a radar is detected. This is required
2023 * to operate on DFS channels.
Denis Kenzior1224f582018-03-26 12:52:49 -05002024 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2025 * port frames over NL80211 instead of the network interface.
Johannes Berg29cbe682010-12-03 09:20:44 +01002026 *
2027 * These parameters are fixed when the mesh is created.
2028 */
2029struct mesh_setup {
Johannes Berg683b6d32012-11-08 21:25:48 +01002030 struct cfg80211_chan_def chandef;
Johannes Berg29cbe682010-12-03 09:20:44 +01002031 const u8 *mesh_id;
2032 u8 mesh_id_len;
Javier Cardonad299a1f2012-03-31 11:31:33 -07002033 u8 sync_method;
2034 u8 path_sel_proto;
2035 u8 path_metric;
Colleen Twitty6e16d902013-05-08 11:45:59 -07002036 u8 auth_id;
Javier Cardona581a8b02011-04-07 15:08:27 -07002037 const u8 *ie;
2038 u8 ie_len;
Javier Cardonab130e5c2011-05-03 16:57:07 -07002039 bool is_authenticated;
Javier Cardona15d5dda2011-04-07 15:08:28 -07002040 bool is_secure;
Thomas Pedersenbb2798d2013-03-04 13:06:10 -08002041 bool user_mpm;
Marco Porsch9bdbf042013-01-07 16:04:51 +01002042 u8 dtim_period;
2043 u16 beacon_interval;
Johannes Berg57fbcce2016-04-12 15:56:15 +02002044 int mcast_rate[NUM_NL80211_BANDS];
Ashok Nagarajanffb3cf32013-06-03 10:33:36 -07002045 u32 basic_rates;
Johannes Berg8564e382016-09-19 09:44:44 +02002046 struct cfg80211_bitrate_mask beacon_rate;
Benjamin Bergd37d49c2017-05-16 11:23:11 +02002047 bool userspace_handles_dfs;
Denis Kenzior1224f582018-03-26 12:52:49 -05002048 bool control_port_over_nl80211;
Johannes Berg29cbe682010-12-03 09:20:44 +01002049};
2050
2051/**
Rostislav Lisovy6e0bd6c2014-11-03 10:33:18 +01002052 * struct ocb_setup - 802.11p OCB mode setup configuration
2053 * @chandef: defines the channel to use
2054 *
2055 * These parameters are fixed when connecting to the network
2056 */
2057struct ocb_setup {
2058 struct cfg80211_chan_def chandef;
2059};
2060
2061/**
Jouni Malinen31888482008-10-30 16:59:24 +02002062 * struct ieee80211_txq_params - TX queue parameters
Johannes Berga3304b02012-03-28 11:04:24 +02002063 * @ac: AC identifier
Jouni Malinen31888482008-10-30 16:59:24 +02002064 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
2065 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
2066 * 1..32767]
2067 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
2068 * 1..32767]
2069 * @aifs: Arbitration interframe space [0..255]
2070 */
2071struct ieee80211_txq_params {
Johannes Berga3304b02012-03-28 11:04:24 +02002072 enum nl80211_ac ac;
Jouni Malinen31888482008-10-30 16:59:24 +02002073 u16 txop;
2074 u16 cwmin;
2075 u16 cwmax;
2076 u8 aifs;
2077};
2078
Johannes Bergd70e9692010-08-19 16:11:27 +02002079/**
2080 * DOC: Scanning and BSS list handling
2081 *
2082 * The scanning process itself is fairly simple, but cfg80211 offers quite
2083 * a bit of helper functionality. To start a scan, the scan operation will
2084 * be invoked with a scan definition. This scan definition contains the
2085 * channels to scan, and the SSIDs to send probe requests for (including the
2086 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2087 * probe. Additionally, a scan request may contain extra information elements
2088 * that should be added to the probe request. The IEs are guaranteed to be
2089 * well-formed, and will not exceed the maximum length the driver advertised
2090 * in the wiphy structure.
2091 *
2092 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2093 * it is responsible for maintaining the BSS list; the driver should not
2094 * maintain a list itself. For this notification, various functions exist.
2095 *
2096 * Since drivers do not maintain a BSS list, there are also a number of
2097 * functions to search for a BSS and obtain information about it from the
2098 * BSS structure cfg80211 maintains. The BSS list is also made available
2099 * to userspace.
2100 */
Jouni Malinen72bdcf32008-11-26 16:15:24 +02002101
Johannes Berg704232c2007-04-23 12:20:05 -07002102/**
Johannes Berg2a519312009-02-10 21:25:55 +01002103 * struct cfg80211_ssid - SSID description
2104 * @ssid: the SSID
2105 * @ssid_len: length of the ssid
2106 */
2107struct cfg80211_ssid {
2108 u8 ssid[IEEE80211_MAX_SSID_LEN];
2109 u8 ssid_len;
2110};
2111
2112/**
Avraham Stern1d762502016-07-05 17:10:13 +03002113 * struct cfg80211_scan_info - information about completed scan
2114 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
2115 * wireless device that requested the scan is connected to. If this
2116 * information is not available, this field is left zero.
2117 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
2118 * @aborted: set to true if the scan was aborted for any reason,
2119 * userspace will be notified of that
2120 */
2121struct cfg80211_scan_info {
2122 u64 scan_start_tsf;
2123 u8 tsf_bssid[ETH_ALEN] __aligned(2);
2124 bool aborted;
2125};
2126
2127/**
Tova Mussaic8cb5b82020-09-18 11:33:13 +02002128 * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2129 *
2130 * @short_bssid: short ssid to scan for
2131 * @bssid: bssid to scan for
2132 * @channel_idx: idx of the channel in the channel array in the scan request
2133 * which the above info relvant to
2134 * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2135 * @short_ssid_valid: short_ssid is valid and can be used
2136 * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2137 * 20 TUs before starting to send probe requests.
2138 */
2139struct cfg80211_scan_6ghz_params {
2140 u32 short_ssid;
2141 u32 channel_idx;
2142 u8 bssid[ETH_ALEN];
2143 bool unsolicited_probe;
2144 bool short_ssid_valid;
2145 bool psc_no_listen;
2146};
2147
2148/**
Johannes Berg2a519312009-02-10 21:25:55 +01002149 * struct cfg80211_scan_request - scan request description
2150 *
2151 * @ssids: SSIDs to scan for (active scan only)
2152 * @n_ssids: number of SSIDs
2153 * @channels: channels to scan on.
Helmut Schaaca3dbc22009-07-10 14:54:58 +02002154 * @n_channels: total number of channels to scan
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02002155 * @scan_width: channel width for scanning
Jouni Malinen70692ad2009-02-16 19:39:13 +02002156 * @ie: optional information element(s) to add into Probe Request or %NULL
2157 * @ie_len: length of ie in octets
Avraham Stern1d762502016-07-05 17:10:13 +03002158 * @duration: how long to listen on each channel, in TUs. If
2159 * %duration_mandatory is not set, this is the maximum dwell time and
2160 * the actual dwell time may be shorter.
2161 * @duration_mandatory: if set, the scan duration must be as specified by the
2162 * %duration field.
Sam Lefflered4737712012-10-11 21:03:31 -07002163 * @flags: bit field of flags controlling operation
Johannes Berg34850ab2011-07-18 18:08:35 +02002164 * @rates: bitmap of rates to advertise for each band
Johannes Berg2a519312009-02-10 21:25:55 +01002165 * @wiphy: the wiphy this was for
Sam Leffler15d60302012-10-11 21:03:34 -07002166 * @scan_start: time (in jiffies) when the scan started
Johannes Bergfd014282012-06-18 19:17:03 +02002167 * @wdev: the wireless device to scan for
Avraham Stern1d762502016-07-05 17:10:13 +03002168 * @info: (internal) information about completed scan
Johannes Berg5fe231e2013-05-08 21:45:15 +02002169 * @notified: (internal) scan request was notified as done or aborted
Rajkumar Manoharane9f935e2011-09-25 14:53:30 +05302170 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
Johannes Bergad2b26a2014-06-12 21:39:05 +02002171 * @mac_addr: MAC address used with randomisation
2172 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2173 * are 0 in the mask should be randomised, bits that are 1 should
2174 * be taken from the @mac_addr
Tova Mussaic8cb5b82020-09-18 11:33:13 +02002175 * @scan_6ghz: relevant for split scan request only,
2176 * true if this is the second scan request
2177 * @n_6ghz_params: number of 6 GHz params
2178 * @scan_6ghz_params: 6 GHz params
Jouni Malinen818965d2016-02-26 22:12:47 +02002179 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
Johannes Berg2a519312009-02-10 21:25:55 +01002180 */
2181struct cfg80211_scan_request {
2182 struct cfg80211_ssid *ssids;
2183 int n_ssids;
Johannes Berg2a519312009-02-10 21:25:55 +01002184 u32 n_channels;
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02002185 enum nl80211_bss_scan_width scan_width;
Johannes Bergde95a54b2009-04-01 11:58:36 +02002186 const u8 *ie;
Jouni Malinen70692ad2009-02-16 19:39:13 +02002187 size_t ie_len;
Avraham Stern1d762502016-07-05 17:10:13 +03002188 u16 duration;
2189 bool duration_mandatory;
Sam Lefflered4737712012-10-11 21:03:31 -07002190 u32 flags;
Johannes Berg2a519312009-02-10 21:25:55 +01002191
Johannes Berg57fbcce2016-04-12 15:56:15 +02002192 u32 rates[NUM_NL80211_BANDS];
Johannes Berg34850ab2011-07-18 18:08:35 +02002193
Johannes Bergfd014282012-06-18 19:17:03 +02002194 struct wireless_dev *wdev;
2195
Johannes Bergad2b26a2014-06-12 21:39:05 +02002196 u8 mac_addr[ETH_ALEN] __aligned(2);
2197 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
Jouni Malinen818965d2016-02-26 22:12:47 +02002198 u8 bssid[ETH_ALEN] __aligned(2);
Johannes Bergad2b26a2014-06-12 21:39:05 +02002199
Johannes Berg2a519312009-02-10 21:25:55 +01002200 /* internal */
2201 struct wiphy *wiphy;
Sam Leffler15d60302012-10-11 21:03:34 -07002202 unsigned long scan_start;
Avraham Stern1d762502016-07-05 17:10:13 +03002203 struct cfg80211_scan_info info;
2204 bool notified;
Rajkumar Manoharane9f935e2011-09-25 14:53:30 +05302205 bool no_cck;
Tova Mussaic8cb5b82020-09-18 11:33:13 +02002206 bool scan_6ghz;
2207 u32 n_6ghz_params;
2208 struct cfg80211_scan_6ghz_params *scan_6ghz_params;
Johannes Berg5ba63532009-08-07 17:54:07 +02002209
2210 /* keep last */
Gustavo A. R. Silva396fba02020-05-07 13:39:09 -05002211 struct ieee80211_channel *channels[];
Johannes Berg2a519312009-02-10 21:25:55 +01002212};
2213
Johannes Bergad2b26a2014-06-12 21:39:05 +02002214static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2215{
2216 int i;
2217
2218 get_random_bytes(buf, ETH_ALEN);
2219 for (i = 0; i < ETH_ALEN; i++) {
2220 buf[i] &= ~mask[i];
2221 buf[i] |= addr[i] & mask[i];
2222 }
2223}
2224
Johannes Berg2a519312009-02-10 21:25:55 +01002225/**
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03002226 * struct cfg80211_match_set - sets of attributes to match
2227 *
Arend Van Spriel3007e352017-04-21 13:05:01 +01002228 * @ssid: SSID to be matched; may be zero-length in case of BSSID match
2229 * or no match (RSSI only)
2230 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
2231 * or no match (RSSI only)
Johannes Bergea73cbc2014-01-24 10:53:53 +01002232 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
vamsi krishna1e1b11b2019-02-01 18:34:51 +05302233 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
2234 * for filtering out scan results received. Drivers advertize this support
2235 * of band specific rssi based filtering through the feature capability
2236 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
2237 * specific rssi thresholds take precedence over rssi_thold, if specified.
2238 * If not specified for any band, it will be assigned with rssi_thold of
2239 * corresponding matchset.
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03002240 */
2241struct cfg80211_match_set {
2242 struct cfg80211_ssid ssid;
Arend Van Spriel3007e352017-04-21 13:05:01 +01002243 u8 bssid[ETH_ALEN];
Johannes Bergea73cbc2014-01-24 10:53:53 +01002244 s32 rssi_thold;
vamsi krishna1e1b11b2019-02-01 18:34:51 +05302245 s32 per_band_rssi_thold[NUM_NL80211_BANDS];
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03002246};
2247
2248/**
Avraham Stern3b06d272015-10-12 09:51:34 +03002249 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
2250 *
2251 * @interval: interval between scheduled scan iterations. In seconds.
2252 * @iterations: number of scan iterations in this scan plan. Zero means
2253 * infinite loop.
2254 * The last scan plan will always have this parameter set to zero,
2255 * all other scan plans will have a finite number of iterations.
2256 */
2257struct cfg80211_sched_scan_plan {
2258 u32 interval;
2259 u32 iterations;
2260};
2261
2262/**
vamsi krishnabf95ecd2017-01-13 01:12:20 +02002263 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2264 *
2265 * @band: band of BSS which should match for RSSI level adjustment.
2266 * @delta: value of RSSI level adjustment.
2267 */
2268struct cfg80211_bss_select_adjust {
2269 enum nl80211_band band;
2270 s8 delta;
2271};
2272
2273/**
Luciano Coelho807f8a82011-05-11 17:09:35 +03002274 * struct cfg80211_sched_scan_request - scheduled scan request description
2275 *
Arend Van Spriel96b08fd2017-04-13 13:06:27 +01002276 * @reqid: identifies this request.
Luciano Coelho807f8a82011-05-11 17:09:35 +03002277 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2278 * @n_ssids: number of SSIDs
2279 * @n_channels: total number of channels to scan
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02002280 * @scan_width: channel width for scanning
Luciano Coelho807f8a82011-05-11 17:09:35 +03002281 * @ie: optional information element(s) to add into Probe Request or %NULL
2282 * @ie_len: length of ie in octets
Sam Lefflered4737712012-10-11 21:03:31 -07002283 * @flags: bit field of flags controlling operation
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03002284 * @match_sets: sets of parameters to be matched for a scan result
Jérôme Pouillercd9b52b2020-02-21 12:56:04 +01002285 * entry to be considered valid and to be passed to the host
2286 * (others are filtered out).
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03002287 * If ommited, all results are passed.
2288 * @n_match_sets: number of match sets
Johannes Berg6406c912017-05-02 09:33:40 +02002289 * @report_results: indicates that results were reported for this request
Luciano Coelho807f8a82011-05-11 17:09:35 +03002290 * @wiphy: the wiphy this was for
2291 * @dev: the interface
Johannes Berg077f8972013-02-08 09:06:36 +01002292 * @scan_start: start time of the scheduled scan
Luciano Coelho807f8a82011-05-11 17:09:35 +03002293 * @channels: channels to scan
Johannes Bergea73cbc2014-01-24 10:53:53 +01002294 * @min_rssi_thold: for drivers only supporting a single threshold, this
2295 * contains the minimum over all matchsets
Johannes Bergad2b26a2014-06-12 21:39:05 +02002296 * @mac_addr: MAC address used with randomisation
2297 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2298 * are 0 in the mask should be randomised, bits that are 1 should
2299 * be taken from the @mac_addr
Avraham Stern3b06d272015-10-12 09:51:34 +03002300 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
2301 * index must be executed first.
2302 * @n_scan_plans: number of scan plans, at least 1.
Jukka Rissanen31a60ed2014-12-15 13:25:38 +02002303 * @rcu_head: RCU callback used to free the struct
Jukka Rissanen93a1e862014-12-15 13:25:39 +02002304 * @owner_nlportid: netlink portid of owner (if this should is a request
2305 * owned by a particular socket)
Arend Van Sprielca986ad2017-04-21 13:05:00 +01002306 * @nl_owner_dead: netlink owner socket was closed - this request be freed
2307 * @list: for keeping list of requests.
Luciano Coelho9c748932015-01-16 16:04:09 +02002308 * @delay: delay in seconds to use before starting the first scan
2309 * cycle. The driver may ignore this parameter and start
2310 * immediately (or at any other time), if this feature is not
2311 * supported.
vamsi krishnabf95ecd2017-01-13 01:12:20 +02002312 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2313 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2314 * reporting in connected state to cases where a matching BSS is determined
2315 * to have better or slightly worse RSSI than the current connected BSS.
2316 * The relative RSSI threshold values are ignored in disconnected state.
2317 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2318 * to the specified band while deciding whether a better BSS is reported
2319 * using @relative_rssi. If delta is a negative number, the BSSs that
2320 * belong to the specified band will be penalized by delta dB in relative
2321 * comparisions.
Luciano Coelho807f8a82011-05-11 17:09:35 +03002322 */
2323struct cfg80211_sched_scan_request {
Arend Van Spriel96b08fd2017-04-13 13:06:27 +01002324 u64 reqid;
Luciano Coelho807f8a82011-05-11 17:09:35 +03002325 struct cfg80211_ssid *ssids;
2326 int n_ssids;
2327 u32 n_channels;
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02002328 enum nl80211_bss_scan_width scan_width;
Luciano Coelho807f8a82011-05-11 17:09:35 +03002329 const u8 *ie;
2330 size_t ie_len;
Sam Lefflered4737712012-10-11 21:03:31 -07002331 u32 flags;
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03002332 struct cfg80211_match_set *match_sets;
2333 int n_match_sets;
Johannes Bergea73cbc2014-01-24 10:53:53 +01002334 s32 min_rssi_thold;
Luciano Coelho9c748932015-01-16 16:04:09 +02002335 u32 delay;
Avraham Stern3b06d272015-10-12 09:51:34 +03002336 struct cfg80211_sched_scan_plan *scan_plans;
2337 int n_scan_plans;
Luciano Coelho807f8a82011-05-11 17:09:35 +03002338
Johannes Bergad2b26a2014-06-12 21:39:05 +02002339 u8 mac_addr[ETH_ALEN] __aligned(2);
2340 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2341
vamsi krishnabf95ecd2017-01-13 01:12:20 +02002342 bool relative_rssi_set;
2343 s8 relative_rssi;
2344 struct cfg80211_bss_select_adjust rssi_adjust;
2345
Luciano Coelho807f8a82011-05-11 17:09:35 +03002346 /* internal */
2347 struct wiphy *wiphy;
2348 struct net_device *dev;
Sam Leffler15d60302012-10-11 21:03:34 -07002349 unsigned long scan_start;
Arend Van Sprielb34939b2017-04-28 13:40:28 +01002350 bool report_results;
Jukka Rissanen31a60ed2014-12-15 13:25:38 +02002351 struct rcu_head rcu_head;
Jukka Rissanen93a1e862014-12-15 13:25:39 +02002352 u32 owner_nlportid;
Arend Van Sprielca986ad2017-04-21 13:05:00 +01002353 bool nl_owner_dead;
2354 struct list_head list;
Luciano Coelho807f8a82011-05-11 17:09:35 +03002355
2356 /* keep last */
Gustavo A. R. Silva396fba02020-05-07 13:39:09 -05002357 struct ieee80211_channel *channels[];
Luciano Coelho807f8a82011-05-11 17:09:35 +03002358};
2359
2360/**
Johannes Berg2a519312009-02-10 21:25:55 +01002361 * enum cfg80211_signal_type - signal type
2362 *
2363 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
2364 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
2365 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
2366 */
2367enum cfg80211_signal_type {
2368 CFG80211_SIGNAL_TYPE_NONE,
2369 CFG80211_SIGNAL_TYPE_MBM,
2370 CFG80211_SIGNAL_TYPE_UNSPEC,
2371};
2372
2373/**
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02002374 * struct cfg80211_inform_bss - BSS inform data
2375 * @chan: channel the frame was received on
2376 * @scan_width: scan width that was used
2377 * @signal: signal strength value, according to the wiphy's
2378 * signal type
2379 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
2380 * received; should match the time when the frame was actually
2381 * received by the device (not just by the host, in case it was
2382 * buffered on the device) and be accurate to about 10ms.
2383 * If the frame isn't buffered, just passing the return value of
Jason A. Donenfeld9285ec42019-06-21 22:32:48 +02002384 * ktime_get_boottime_ns() is likely appropriate.
Avraham Stern1d762502016-07-05 17:10:13 +03002385 * @parent_tsf: the time at the start of reception of the first octet of the
2386 * timestamp field of the frame. The time is the TSF of the BSS specified
2387 * by %parent_bssid.
2388 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
2389 * the BSS that requested the scan in which the beacon/probe was received.
Sunil Dutt983dafa2017-12-13 19:51:36 +02002390 * @chains: bitmask for filled values in @chain_signal.
2391 * @chain_signal: per-chain signal strength of last received BSS in dBm.
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02002392 */
2393struct cfg80211_inform_bss {
2394 struct ieee80211_channel *chan;
2395 enum nl80211_bss_scan_width scan_width;
2396 s32 signal;
2397 u64 boottime_ns;
Avraham Stern1d762502016-07-05 17:10:13 +03002398 u64 parent_tsf;
2399 u8 parent_bssid[ETH_ALEN] __aligned(2);
Sunil Dutt983dafa2017-12-13 19:51:36 +02002400 u8 chains;
2401 s8 chain_signal[IEEE80211_MAX_CHAINS];
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02002402};
2403
2404/**
Akira Moroo2aa4d452016-03-08 23:17:42 +09002405 * struct cfg80211_bss_ies - BSS entry IE data
Johannes Berg8cef2c92013-02-05 16:54:31 +01002406 * @tsf: TSF contained in the frame that carried these IEs
Johannes Berg9caf0362012-11-29 01:25:20 +01002407 * @rcu_head: internal use, for freeing
2408 * @len: length of the IEs
Johannes Berg0e227082014-08-12 20:34:30 +02002409 * @from_beacon: these IEs are known to come from a beacon
Johannes Berg9caf0362012-11-29 01:25:20 +01002410 * @data: IE data
2411 */
2412struct cfg80211_bss_ies {
Johannes Berg8cef2c92013-02-05 16:54:31 +01002413 u64 tsf;
Johannes Berg9caf0362012-11-29 01:25:20 +01002414 struct rcu_head rcu_head;
2415 int len;
Johannes Berg0e227082014-08-12 20:34:30 +02002416 bool from_beacon;
Johannes Berg9caf0362012-11-29 01:25:20 +01002417 u8 data[];
2418};
2419
2420/**
Johannes Berg2a519312009-02-10 21:25:55 +01002421 * struct cfg80211_bss - BSS description
2422 *
2423 * This structure describes a BSS (which may also be a mesh network)
2424 * for use in scan results and similar.
2425 *
Johannes Bergabe37c42010-06-07 11:12:27 +02002426 * @channel: channel this BSS is on
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02002427 * @scan_width: width of the control channel
Johannes Berg2a519312009-02-10 21:25:55 +01002428 * @bssid: BSSID of the BSS
Johannes Berg2a519312009-02-10 21:25:55 +01002429 * @beacon_interval: the beacon interval as from the frame
2430 * @capability: the capability field in host byte order
Johannes Berg83c7aa12013-02-05 16:51:29 +01002431 * @ies: the information elements (Note that there is no guarantee that these
2432 * are well-formed!); this is a pointer to either the beacon_ies or
2433 * proberesp_ies depending on whether Probe Response frame has been
2434 * received. It is always non-%NULL.
Jouni Malinen34a6edd2010-01-06 16:19:24 +02002435 * @beacon_ies: the information elements from the last Beacon frame
Johannes Berg776b3582013-02-01 02:06:18 +01002436 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
2437 * own the beacon_ies, but they're just pointers to the ones from the
2438 * @hidden_beacon_bss struct)
Jouni Malinen34a6edd2010-01-06 16:19:24 +02002439 * @proberesp_ies: the information elements from the last Probe Response frame
Johannes Berg776b3582013-02-01 02:06:18 +01002440 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2441 * a BSS that hides the SSID in its beacon, this points to the BSS struct
2442 * that holds the beacon data. @beacon_ies is still valid, of course, and
2443 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
Johannes Berg851ae312019-02-08 14:12:25 +01002444 * @transmitted_bss: pointer to the transmitted BSS, if this is a
2445 * non-transmitted one (multi-BSSID support)
2446 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2447 * (multi-BSSID support)
Johannes Berg77965c972009-02-18 18:45:06 +01002448 * @signal: signal strength value (type depends on the wiphy's signal_type)
Sunil Dutt983dafa2017-12-13 19:51:36 +02002449 * @chains: bitmask for filled values in @chain_signal.
2450 * @chain_signal: per-chain signal strength of last received BSS in dBm.
Sara Sharon0cd01ef2019-01-22 09:50:50 +02002451 * @bssid_index: index in the multiple BSS set
2452 * @max_bssid_indicator: max number of members in the BSS set
Johannes Berg2a519312009-02-10 21:25:55 +01002453 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
2454 */
2455struct cfg80211_bss {
2456 struct ieee80211_channel *channel;
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02002457 enum nl80211_bss_scan_width scan_width;
Johannes Berg2a519312009-02-10 21:25:55 +01002458
Johannes Berg9caf0362012-11-29 01:25:20 +01002459 const struct cfg80211_bss_ies __rcu *ies;
2460 const struct cfg80211_bss_ies __rcu *beacon_ies;
2461 const struct cfg80211_bss_ies __rcu *proberesp_ies;
2462
Johannes Berg776b3582013-02-01 02:06:18 +01002463 struct cfg80211_bss *hidden_beacon_bss;
Sara Sharon7011ba52019-01-21 12:25:59 +02002464 struct cfg80211_bss *transmitted_bss;
2465 struct list_head nontrans_list;
Johannes Berg2a519312009-02-10 21:25:55 +01002466
2467 s32 signal;
Johannes Berg2a519312009-02-10 21:25:55 +01002468
Johannes Berg9caf0362012-11-29 01:25:20 +01002469 u16 beacon_interval;
2470 u16 capability;
2471
2472 u8 bssid[ETH_ALEN];
Sunil Dutt983dafa2017-12-13 19:51:36 +02002473 u8 chains;
2474 s8 chain_signal[IEEE80211_MAX_CHAINS];
Johannes Berg9caf0362012-11-29 01:25:20 +01002475
Sara Sharon0cd01ef2019-01-22 09:50:50 +02002476 u8 bssid_index;
2477 u8 max_bssid_indicator;
2478
Gustavo A. R. Silva396fba02020-05-07 13:39:09 -05002479 u8 priv[] __aligned(sizeof(void *));
Johannes Berg2a519312009-02-10 21:25:55 +01002480};
2481
2482/**
Johannes Berg49a68e02019-02-07 23:26:38 +01002483 * ieee80211_bss_get_elem - find element with given ID
Johannes Berg517357c2009-07-02 17:18:40 +02002484 * @bss: the bss to search
Johannes Berg49a68e02019-02-07 23:26:38 +01002485 * @id: the element ID
Johannes Berg9caf0362012-11-29 01:25:20 +01002486 *
2487 * Note that the return value is an RCU-protected pointer, so
2488 * rcu_read_lock() must be held when calling this function.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01002489 * Return: %NULL if not found.
Johannes Berg517357c2009-07-02 17:18:40 +02002490 */
Johannes Berg49a68e02019-02-07 23:26:38 +01002491const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
2492
2493/**
2494 * ieee80211_bss_get_ie - find IE with given ID
2495 * @bss: the bss to search
2496 * @id: the element ID
2497 *
2498 * Note that the return value is an RCU-protected pointer, so
2499 * rcu_read_lock() must be held when calling this function.
2500 * Return: %NULL if not found.
2501 */
2502static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
2503{
2504 return (void *)ieee80211_bss_get_elem(bss, id);
2505}
Johannes Berg517357c2009-07-02 17:18:40 +02002506
2507
2508/**
Jouni Malinen636a5d32009-03-19 13:39:22 +02002509 * struct cfg80211_auth_request - Authentication request data
2510 *
2511 * This structure provides information needed to complete IEEE 802.11
2512 * authentication.
Jouni Malinen636a5d32009-03-19 13:39:22 +02002513 *
Johannes Berg959867f2013-06-19 13:05:42 +02002514 * @bss: The BSS to authenticate with, the callee must obtain a reference
2515 * to it if it needs to keep it.
Jouni Malinen636a5d32009-03-19 13:39:22 +02002516 * @auth_type: Authentication type (algorithm)
2517 * @ie: Extra IEs to add to Authentication frame or %NULL
2518 * @ie_len: Length of ie buffer in octets
Johannes Bergfffd0932009-07-08 14:22:54 +02002519 * @key_len: length of WEP key for shared key authentication
2520 * @key_idx: index of WEP key for shared key authentication
2521 * @key: WEP key for shared key authentication
Jouni Malinen11b6b5a2016-10-27 00:41:58 +03002522 * @auth_data: Fields and elements in Authentication frames. This contains
2523 * the authentication frame body (non-IE and IE data), excluding the
2524 * Authentication algorithm number, i.e., starting at the Authentication
2525 * transaction sequence number field.
2526 * @auth_data_len: Length of auth_data buffer in octets
Jouni Malinen636a5d32009-03-19 13:39:22 +02002527 */
2528struct cfg80211_auth_request {
Johannes Berg19957bb2009-07-02 17:20:43 +02002529 struct cfg80211_bss *bss;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002530 const u8 *ie;
2531 size_t ie_len;
Johannes Berg19957bb2009-07-02 17:20:43 +02002532 enum nl80211_auth_type auth_type;
Johannes Bergfffd0932009-07-08 14:22:54 +02002533 const u8 *key;
2534 u8 key_len, key_idx;
Jouni Malinen11b6b5a2016-10-27 00:41:58 +03002535 const u8 *auth_data;
2536 size_t auth_data_len;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002537};
2538
2539/**
Ben Greear7e7c8922011-11-18 11:31:59 -08002540 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
2541 *
2542 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
Johannes Bergee2aca32013-02-21 17:36:01 +01002543 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
Assaf Kraussbab5ab72014-09-03 15:25:01 +03002544 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
Srinivas Dasari40cbfa92018-01-25 17:13:38 +02002545 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
2546 * authentication capability. Drivers can offload authentication to
2547 * userspace if this flag is set. Only applicable for cfg80211_connect()
2548 * request (connect callback).
Ben Greear7e7c8922011-11-18 11:31:59 -08002549 */
2550enum cfg80211_assoc_req_flags {
Srinivas Dasari40cbfa92018-01-25 17:13:38 +02002551 ASSOC_REQ_DISABLE_HT = BIT(0),
2552 ASSOC_REQ_DISABLE_VHT = BIT(1),
2553 ASSOC_REQ_USE_RRM = BIT(2),
2554 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
Ben Greear7e7c8922011-11-18 11:31:59 -08002555};
2556
2557/**
Jouni Malinen636a5d32009-03-19 13:39:22 +02002558 * struct cfg80211_assoc_request - (Re)Association request data
2559 *
2560 * This structure provides information needed to complete IEEE 802.11
2561 * (re)association.
Johannes Berg959867f2013-06-19 13:05:42 +02002562 * @bss: The BSS to associate with. If the call is successful the driver is
2563 * given a reference that it must give back to cfg80211_send_rx_assoc()
2564 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2565 * association requests while already associating must be rejected.
Jouni Malinen636a5d32009-03-19 13:39:22 +02002566 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2567 * @ie_len: Length of ie buffer in octets
Jouni Malinendc6382ce2009-05-06 22:09:37 +03002568 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
Samuel Ortizb23aa672009-07-01 21:26:54 +02002569 * @crypto: crypto settings
Jouni Malinen35eb8f72016-04-06 17:38:44 +03002570 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2571 * to indicate a request to reassociate within the ESS instead of a request
2572 * do the initial association with the ESS. When included, this is set to
2573 * the BSSID of the current association, i.e., to the value that is
2574 * included in the Current AP address field of the Reassociation Request
2575 * frame.
Ben Greear7e7c8922011-11-18 11:31:59 -08002576 * @flags: See &enum cfg80211_assoc_req_flags
2577 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
Johannes Bergad24b0d2013-07-05 11:53:28 +02002578 * will be used in ht_capa. Un-supported values will be ignored.
Ben Greear7e7c8922011-11-18 11:31:59 -08002579 * @ht_capa_mask: The bits of ht_capa which are to be used.
Johannes Bergee2aca32013-02-21 17:36:01 +01002580 * @vht_capa: VHT capability override
2581 * @vht_capa_mask: VHT capability mask indicating which fields to use
Jouni Malinen348bd452016-10-27 00:42:03 +03002582 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2583 * %NULL if FILS is not used.
2584 * @fils_kek_len: Length of fils_kek in octets
2585 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2586 * Request/Response frame or %NULL if FILS is not used. This field starts
2587 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
Thomas Pedersend2b75882020-09-21 19:28:04 -07002588 * @s1g_capa: S1G capability override
2589 * @s1g_capa_mask: S1G capability override mask
Jouni Malinen636a5d32009-03-19 13:39:22 +02002590 */
2591struct cfg80211_assoc_request {
Johannes Berg19957bb2009-07-02 17:20:43 +02002592 struct cfg80211_bss *bss;
Johannes Berg3e5d7642009-07-07 14:37:26 +02002593 const u8 *ie, *prev_bssid;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002594 size_t ie_len;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002595 struct cfg80211_crypto_settings crypto;
Johannes Berg19957bb2009-07-02 17:20:43 +02002596 bool use_mfp;
Ben Greear7e7c8922011-11-18 11:31:59 -08002597 u32 flags;
2598 struct ieee80211_ht_cap ht_capa;
2599 struct ieee80211_ht_cap ht_capa_mask;
Johannes Bergee2aca32013-02-21 17:36:01 +01002600 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
Jouni Malinen348bd452016-10-27 00:42:03 +03002601 const u8 *fils_kek;
2602 size_t fils_kek_len;
2603 const u8 *fils_nonces;
Thomas Pedersend2b75882020-09-21 19:28:04 -07002604 struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002605};
2606
2607/**
2608 * struct cfg80211_deauth_request - Deauthentication request data
2609 *
2610 * This structure provides information needed to complete IEEE 802.11
2611 * deauthentication.
2612 *
Johannes Berg95de8172012-01-20 13:55:25 +01002613 * @bssid: the BSSID of the BSS to deauthenticate from
Jouni Malinen636a5d32009-03-19 13:39:22 +02002614 * @ie: Extra IEs to add to Deauthentication frame or %NULL
2615 * @ie_len: Length of ie buffer in octets
Johannes Berg19957bb2009-07-02 17:20:43 +02002616 * @reason_code: The reason code for the deauthentication
Johannes Berg077f8972013-02-08 09:06:36 +01002617 * @local_state_change: if set, change local state only and
2618 * do not set a deauth frame
Jouni Malinen636a5d32009-03-19 13:39:22 +02002619 */
2620struct cfg80211_deauth_request {
Johannes Berg95de8172012-01-20 13:55:25 +01002621 const u8 *bssid;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002622 const u8 *ie;
2623 size_t ie_len;
Johannes Berg19957bb2009-07-02 17:20:43 +02002624 u16 reason_code;
Stanislaw Gruszka68632552012-10-15 14:52:41 +02002625 bool local_state_change;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002626};
2627
2628/**
2629 * struct cfg80211_disassoc_request - Disassociation request data
2630 *
2631 * This structure provides information needed to complete IEEE 802.11
Masahiro Yamada66f00442017-02-27 14:29:42 -08002632 * disassociation.
Jouni Malinen636a5d32009-03-19 13:39:22 +02002633 *
Johannes Berg19957bb2009-07-02 17:20:43 +02002634 * @bss: the BSS to disassociate from
Jouni Malinen636a5d32009-03-19 13:39:22 +02002635 * @ie: Extra IEs to add to Disassociation frame or %NULL
2636 * @ie_len: Length of ie buffer in octets
Johannes Berg19957bb2009-07-02 17:20:43 +02002637 * @reason_code: The reason code for the disassociation
Jouni Malinend5cdfac2010-04-04 09:37:19 +03002638 * @local_state_change: This is a request for a local state only, i.e., no
2639 * Disassociation frame is to be transmitted.
Jouni Malinen636a5d32009-03-19 13:39:22 +02002640 */
2641struct cfg80211_disassoc_request {
Johannes Berg19957bb2009-07-02 17:20:43 +02002642 struct cfg80211_bss *bss;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002643 const u8 *ie;
2644 size_t ie_len;
Johannes Berg19957bb2009-07-02 17:20:43 +02002645 u16 reason_code;
Jouni Malinend5cdfac2010-04-04 09:37:19 +03002646 bool local_state_change;
Jouni Malinen636a5d32009-03-19 13:39:22 +02002647};
2648
2649/**
Johannes Berg04a773a2009-04-19 21:24:32 +02002650 * struct cfg80211_ibss_params - IBSS parameters
2651 *
2652 * This structure defines the IBSS parameters for the join_ibss()
2653 * method.
2654 *
2655 * @ssid: The SSID, will always be non-null.
2656 * @ssid_len: The length of the SSID, will always be non-zero.
2657 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2658 * search for IBSSs with a different BSSID.
Johannes Berg683b6d32012-11-08 21:25:48 +01002659 * @chandef: defines the channel to use if no other IBSS to join can be found
Johannes Berg04a773a2009-04-19 21:24:32 +02002660 * @channel_fixed: The channel should be fixed -- do not search for
2661 * IBSSs to join on other channels.
2662 * @ie: information element(s) to include in the beacon
2663 * @ie_len: length of that
Johannes Berg8e30bc52009-04-22 17:45:38 +02002664 * @beacon_interval: beacon interval to use
Johannes Bergfffd0932009-07-08 14:22:54 +02002665 * @privacy: this is a protected network, keys will be configured
2666 * after joining
Antonio Quartulli267335d2012-01-31 20:25:47 +01002667 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2668 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2669 * required to assume that the port is unauthorized until authorized by
2670 * user space. Otherwise, port is marked authorized by default.
Denis Kenziorc3bfe1f2018-03-26 12:52:48 -05002671 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2672 * port frames over NL80211 instead of the network interface.
Simon Wunderlich5336fa82013-10-07 18:41:05 +02002673 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2674 * changes the channel when a radar is detected. This is required
2675 * to operate on DFS channels.
Teemu Paasikivifbd2c8d2010-06-14 12:55:31 +03002676 * @basic_rates: bitmap of basic rates to use when creating the IBSS
Felix Fietkaudd5b4cc2010-11-22 20:58:24 +01002677 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
Simon Wunderlich803768f2013-06-28 10:39:58 +02002678 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
Johannes Bergad24b0d2013-07-05 11:53:28 +02002679 * will be used in ht_capa. Un-supported values will be ignored.
Simon Wunderlich803768f2013-06-28 10:39:58 +02002680 * @ht_capa_mask: The bits of ht_capa which are to be used.
Tova Mussai9ae3b172017-10-29 11:51:11 +02002681 * @wep_keys: static WEP keys, if not NULL points to an array of
Jérôme Pouillercd9b52b2020-02-21 12:56:04 +01002682 * CFG80211_MAX_WEP_KEYS WEP keys
Tova Mussai9ae3b172017-10-29 11:51:11 +02002683 * @wep_tx_key: key index (0..3) of the default TX static WEP key
Johannes Berg04a773a2009-04-19 21:24:32 +02002684 */
2685struct cfg80211_ibss_params {
Johannes Bergc1e5f472014-05-19 17:53:16 +02002686 const u8 *ssid;
2687 const u8 *bssid;
Johannes Berg683b6d32012-11-08 21:25:48 +01002688 struct cfg80211_chan_def chandef;
Johannes Bergc1e5f472014-05-19 17:53:16 +02002689 const u8 *ie;
Johannes Berg04a773a2009-04-19 21:24:32 +02002690 u8 ssid_len, ie_len;
Johannes Berg8e30bc52009-04-22 17:45:38 +02002691 u16 beacon_interval;
Teemu Paasikivifbd2c8d2010-06-14 12:55:31 +03002692 u32 basic_rates;
Johannes Berg04a773a2009-04-19 21:24:32 +02002693 bool channel_fixed;
Johannes Bergfffd0932009-07-08 14:22:54 +02002694 bool privacy;
Antonio Quartulli267335d2012-01-31 20:25:47 +01002695 bool control_port;
Denis Kenziorc3bfe1f2018-03-26 12:52:48 -05002696 bool control_port_over_nl80211;
Simon Wunderlich5336fa82013-10-07 18:41:05 +02002697 bool userspace_handles_dfs;
Johannes Berg57fbcce2016-04-12 15:56:15 +02002698 int mcast_rate[NUM_NL80211_BANDS];
Simon Wunderlich803768f2013-06-28 10:39:58 +02002699 struct ieee80211_ht_cap ht_capa;
2700 struct ieee80211_ht_cap ht_capa_mask;
Tova Mussai9ae3b172017-10-29 11:51:11 +02002701 struct key_params *wep_keys;
2702 int wep_tx_key;
Johannes Berg04a773a2009-04-19 21:24:32 +02002703};
2704
2705/**
Arend van Spriel38de03d2016-03-02 20:37:18 +01002706 * struct cfg80211_bss_selection - connection parameters for BSS selection.
2707 *
2708 * @behaviour: requested BSS selection behaviour.
2709 * @param: parameters for requestion behaviour.
2710 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2711 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2712 */
2713struct cfg80211_bss_selection {
2714 enum nl80211_bss_select_attr behaviour;
2715 union {
Johannes Berg57fbcce2016-04-12 15:56:15 +02002716 enum nl80211_band band_pref;
Arend van Spriel38de03d2016-03-02 20:37:18 +01002717 struct cfg80211_bss_select_adjust adjust;
2718 } param;
2719};
2720
2721/**
Samuel Ortizb23aa672009-07-01 21:26:54 +02002722 * struct cfg80211_connect_params - Connection parameters
2723 *
2724 * This structure provides information needed to complete IEEE 802.11
2725 * authentication and association.
2726 *
2727 * @channel: The channel to use or %NULL if not specified (auto-select based
2728 * on scan results)
Jouni Malinen1df4a512014-01-15 00:00:47 +02002729 * @channel_hint: The channel of the recommended BSS for initial connection or
2730 * %NULL if not specified
Samuel Ortizb23aa672009-07-01 21:26:54 +02002731 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2732 * results)
Jouni Malinen1df4a512014-01-15 00:00:47 +02002733 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2734 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2735 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2736 * to use.
Samuel Ortizb23aa672009-07-01 21:26:54 +02002737 * @ssid: SSID
2738 * @ssid_len: Length of ssid in octets
2739 * @auth_type: Authentication type (algorithm)
Johannes Bergabe37c42010-06-07 11:12:27 +02002740 * @ie: IEs for association request
2741 * @ie_len: Length of assoc_ie in octets
Samuel Ortizb23aa672009-07-01 21:26:54 +02002742 * @privacy: indicates whether privacy-enabled APs should be used
Jouni Malinencee00a92013-01-15 17:15:57 +02002743 * @mfp: indicate whether management frame protection is used
Samuel Ortizb23aa672009-07-01 21:26:54 +02002744 * @crypto: crypto settings
Johannes Bergfffd0932009-07-08 14:22:54 +02002745 * @key_len: length of WEP key for shared key authentication
2746 * @key_idx: index of WEP key for shared key authentication
2747 * @key: WEP key for shared key authentication
Ben Greear7e7c8922011-11-18 11:31:59 -08002748 * @flags: See &enum cfg80211_assoc_req_flags
Bala Shanmugam4486ea92012-03-07 17:27:12 +05302749 * @bg_scan_period: Background scan period in seconds
Johannes Bergad24b0d2013-07-05 11:53:28 +02002750 * or -1 to indicate that default value is to be used.
Ben Greear7e7c8922011-11-18 11:31:59 -08002751 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
Johannes Bergad24b0d2013-07-05 11:53:28 +02002752 * will be used in ht_capa. Un-supported values will be ignored.
Ben Greear7e7c8922011-11-18 11:31:59 -08002753 * @ht_capa_mask: The bits of ht_capa which are to be used.
Johannes Bergee2aca32013-02-21 17:36:01 +01002754 * @vht_capa: VHT Capability overrides
2755 * @vht_capa_mask: The bits of vht_capa which are to be used.
Lior David34d50512016-01-28 10:58:25 +02002756 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2757 * networks.
Arend van Spriel38de03d2016-03-02 20:37:18 +01002758 * @bss_select: criteria to be used for BSS selection.
Jouni Malinen35eb8f72016-04-06 17:38:44 +03002759 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2760 * to indicate a request to reassociate within the ESS instead of a request
2761 * do the initial association with the ESS. When included, this is set to
2762 * the BSSID of the current association, i.e., to the value that is
2763 * included in the Current AP address field of the Reassociation Request
2764 * frame.
Vidyullatha Kanchanapallya3caf742017-03-31 00:22:34 +03002765 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2766 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2767 * data IE.
2768 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2769 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2770 * %NULL if not specified. This specifies the domain name of ER server and
2771 * is used to construct FILS wrapped data IE.
2772 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2773 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2774 * messages. This is also used to construct FILS wrapped data IE.
2775 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2776 * keys in FILS or %NULL if not specified.
2777 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
Avraham Stern3a00df52017-06-09 13:08:43 +01002778 * @want_1x: indicates user-space supports and wants to use 802.1X driver
2779 * offload of 4-way handshake.
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +03002780 * @edmg: define the EDMG channels.
2781 * This may specify multiple channels and bonding options for the driver
2782 * to choose from, based on BSS configuration.
Samuel Ortizb23aa672009-07-01 21:26:54 +02002783 */
2784struct cfg80211_connect_params {
2785 struct ieee80211_channel *channel;
Jouni Malinen1df4a512014-01-15 00:00:47 +02002786 struct ieee80211_channel *channel_hint;
Jouni Malinen664834d2014-01-15 00:01:44 +02002787 const u8 *bssid;
Jouni Malinen1df4a512014-01-15 00:00:47 +02002788 const u8 *bssid_hint;
Jouni Malinen664834d2014-01-15 00:01:44 +02002789 const u8 *ssid;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002790 size_t ssid_len;
2791 enum nl80211_auth_type auth_type;
Johannes Berg4b5800f2014-01-15 14:55:59 +01002792 const u8 *ie;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002793 size_t ie_len;
2794 bool privacy;
Jouni Malinencee00a92013-01-15 17:15:57 +02002795 enum nl80211_mfp mfp;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002796 struct cfg80211_crypto_settings crypto;
Johannes Bergfffd0932009-07-08 14:22:54 +02002797 const u8 *key;
2798 u8 key_len, key_idx;
Ben Greear7e7c8922011-11-18 11:31:59 -08002799 u32 flags;
Bala Shanmugam4486ea92012-03-07 17:27:12 +05302800 int bg_scan_period;
Ben Greear7e7c8922011-11-18 11:31:59 -08002801 struct ieee80211_ht_cap ht_capa;
2802 struct ieee80211_ht_cap ht_capa_mask;
Johannes Bergee2aca32013-02-21 17:36:01 +01002803 struct ieee80211_vht_cap vht_capa;
2804 struct ieee80211_vht_cap vht_capa_mask;
Lior David34d50512016-01-28 10:58:25 +02002805 bool pbss;
Arend van Spriel38de03d2016-03-02 20:37:18 +01002806 struct cfg80211_bss_selection bss_select;
Jouni Malinenba6fbac2016-03-29 13:53:27 +03002807 const u8 *prev_bssid;
Vidyullatha Kanchanapallya3caf742017-03-31 00:22:34 +03002808 const u8 *fils_erp_username;
2809 size_t fils_erp_username_len;
2810 const u8 *fils_erp_realm;
2811 size_t fils_erp_realm_len;
2812 u16 fils_erp_next_seq_num;
2813 const u8 *fils_erp_rrk;
2814 size_t fils_erp_rrk_len;
Avraham Stern3a00df52017-06-09 13:08:43 +01002815 bool want_1x;
Alexei Avshalom Lazar2a380752019-08-18 17:35:17 +03002816 struct ieee80211_edmg edmg;
Samuel Ortizb23aa672009-07-01 21:26:54 +02002817};
2818
2819/**
vamsi krishna088e8df2016-10-27 16:51:11 +03002820 * enum cfg80211_connect_params_changed - Connection parameters being updated
2821 *
2822 * This enum provides information of all connect parameters that
2823 * have to be updated as part of update_connect_params() call.
2824 *
2825 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
Vidyullatha Kanchanapally7f9a3e12018-05-22 10:19:08 +02002826 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2827 * username, erp sequence number and rrk) are updated
2828 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
vamsi krishna088e8df2016-10-27 16:51:11 +03002829 */
2830enum cfg80211_connect_params_changed {
2831 UPDATE_ASSOC_IES = BIT(0),
Vidyullatha Kanchanapally7f9a3e12018-05-22 10:19:08 +02002832 UPDATE_FILS_ERP_INFO = BIT(1),
2833 UPDATE_AUTH_TYPE = BIT(2),
vamsi krishna088e8df2016-10-27 16:51:11 +03002834};
2835
2836/**
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02002837 * enum wiphy_params_flags - set_wiphy_params bitfield values
Johannes Bergabe37c42010-06-07 11:12:27 +02002838 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2839 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2840 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2841 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2842 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
Lorenzo Bianconi3057dbf2014-09-04 23:57:40 +02002843 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
Toke Høiland-Jørgensen52539ca2018-05-08 13:03:50 +02002844 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2845 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2846 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02002847 */
2848enum wiphy_params_flags {
2849 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2850 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2851 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2852 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
Lukáš Turek81077e82009-12-21 22:50:47 +01002853 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
Lorenzo Bianconi3057dbf2014-09-04 23:57:40 +02002854 WIPHY_PARAM_DYN_ACK = 1 << 5,
Toke Høiland-Jørgensen52539ca2018-05-08 13:03:50 +02002855 WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2856 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2857 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02002858};
2859
Toke Høiland-Jørgensen36647052018-12-18 17:02:07 -08002860#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
2861
Kan Yan3ace10f2019-11-18 22:06:09 -08002862/* The per TXQ device queue limit in airtime */
2863#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
2864#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
2865
2866/* The per interface airtime threshold to switch to lower queue limit */
2867#define IEEE80211_AQL_THRESHOLD 24000
2868
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002869/**
2870 * struct cfg80211_pmksa - PMK Security Association
2871 *
2872 * This structure is passed to the set/del_pmksa() method for PMKSA
2873 * caching.
2874 *
Vidyullatha Kanchanapallya3caf742017-03-31 00:22:34 +03002875 * @bssid: The AP's BSSID (may be %NULL).
2876 * @pmkid: The identifier to refer a PMKSA.
2877 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2878 * derivation by a FILS STA. Otherwise, %NULL.
2879 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2880 * the hash algorithm used to generate this.
2881 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2882 * cache identifier (may be %NULL).
2883 * @ssid_len: Length of the @ssid in octets.
2884 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2885 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2886 * %NULL).
Veerendranath Jakkam7fc82af2020-03-13 01:59:03 +02002887 * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
2888 * (dot11RSNAConfigPMKLifetime) or 0 if not specified.
2889 * The configured PMKSA must not be used for PMKSA caching after
2890 * expiration and any keys derived from this PMK become invalid on
2891 * expiration, i.e., the current association must be dropped if the PMK
2892 * used for it expires.
2893 * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
2894 * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
2895 * Drivers are expected to trigger a full authentication instead of using
2896 * this PMKSA for caching when reassociating to a new BSS after this
2897 * threshold to generate a new PMK before the current one expires.
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002898 */
2899struct cfg80211_pmksa {
Johannes Bergc1e5f472014-05-19 17:53:16 +02002900 const u8 *bssid;
2901 const u8 *pmkid;
Vidyullatha Kanchanapallya3caf742017-03-31 00:22:34 +03002902 const u8 *pmk;
2903 size_t pmk_len;
2904 const u8 *ssid;
2905 size_t ssid_len;
2906 const u8 *cache_id;
Veerendranath Jakkam7fc82af2020-03-13 01:59:03 +02002907 u32 pmk_lifetime;
2908 u8 pmk_reauth_threshold;
Samuel Ortiz67fbb162009-11-24 23:59:15 +01002909};
Johannes Berg99303802009-07-01 21:26:59 +02002910
Johannes Berg7643a2c2009-06-02 13:01:39 +02002911/**
Amitkumar Karwar50ac6602013-06-25 19:03:56 -07002912 * struct cfg80211_pkt_pattern - packet pattern
Johannes Bergff1b6e62011-05-04 15:37:28 +02002913 * @mask: bitmask where to match pattern and where to ignore bytes,
2914 * one bit per byte, in same format as nl80211
2915 * @pattern: bytes to match where bitmask is 1
2916 * @pattern_len: length of pattern (in bytes)
Amitkumar Karwarbb92d192013-02-12 12:16:26 -08002917 * @pkt_offset: packet offset (in bytes)
Johannes Bergff1b6e62011-05-04 15:37:28 +02002918 *
2919 * Internal note: @mask and @pattern are allocated in one chunk of
2920 * memory, free @mask only!
2921 */
Amitkumar Karwar50ac6602013-06-25 19:03:56 -07002922struct cfg80211_pkt_pattern {
Johannes Berg922bd802014-05-19 17:59:50 +02002923 const u8 *mask, *pattern;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002924 int pattern_len;
Amitkumar Karwarbb92d192013-02-12 12:16:26 -08002925 int pkt_offset;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002926};
2927
2928/**
Johannes Berg2a0e0472013-01-23 22:57:40 +01002929 * struct cfg80211_wowlan_tcp - TCP connection parameters
2930 *
2931 * @sock: (internal) socket for source port allocation
2932 * @src: source IP address
2933 * @dst: destination IP address
2934 * @dst_mac: destination MAC address
2935 * @src_port: source port
2936 * @dst_port: destination port
2937 * @payload_len: data payload length
2938 * @payload: data payload buffer
2939 * @payload_seq: payload sequence stamping configuration
2940 * @data_interval: interval at which to send data packets
2941 * @wake_len: wakeup payload match length
2942 * @wake_data: wakeup payload match data
2943 * @wake_mask: wakeup payload match mask
2944 * @tokens_size: length of the tokens buffer
2945 * @payload_tok: payload token usage configuration
2946 */
2947struct cfg80211_wowlan_tcp {
2948 struct socket *sock;
2949 __be32 src, dst;
2950 u16 src_port, dst_port;
2951 u8 dst_mac[ETH_ALEN];
2952 int payload_len;
2953 const u8 *payload;
2954 struct nl80211_wowlan_tcp_data_seq payload_seq;
2955 u32 data_interval;
2956 u32 wake_len;
2957 const u8 *wake_data, *wake_mask;
2958 u32 tokens_size;
2959 /* must be last, variable member */
2960 struct nl80211_wowlan_tcp_data_token payload_tok;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002961};
2962
2963/**
2964 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2965 *
2966 * This structure defines the enabled WoWLAN triggers for the device.
2967 * @any: wake up on any activity -- special trigger if device continues
2968 * operating as normal during suspend
2969 * @disconnect: wake up if getting disconnected
2970 * @magic_pkt: wake up on receiving magic packet
2971 * @patterns: wake up on receiving packet matching a pattern
2972 * @n_patterns: number of patterns
Johannes Berg77dbbb12011-07-13 10:48:55 +02002973 * @gtk_rekey_failure: wake up on GTK rekey failure
2974 * @eap_identity_req: wake up on EAP identity request packet
2975 * @four_way_handshake: wake up on 4-way handshake
2976 * @rfkill_release: wake up when rfkill is released
Johannes Berg2a0e0472013-01-23 22:57:40 +01002977 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
2978 * NULL if not configured.
Luciano Coelho8cd4d452014-09-17 11:55:28 +03002979 * @nd_config: configuration for the scan to be used for net detect wake.
Johannes Bergff1b6e62011-05-04 15:37:28 +02002980 */
2981struct cfg80211_wowlan {
Johannes Berg77dbbb12011-07-13 10:48:55 +02002982 bool any, disconnect, magic_pkt, gtk_rekey_failure,
2983 eap_identity_req, four_way_handshake,
2984 rfkill_release;
Amitkumar Karwar50ac6602013-06-25 19:03:56 -07002985 struct cfg80211_pkt_pattern *patterns;
Johannes Berg2a0e0472013-01-23 22:57:40 +01002986 struct cfg80211_wowlan_tcp *tcp;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002987 int n_patterns;
Luciano Coelho8cd4d452014-09-17 11:55:28 +03002988 struct cfg80211_sched_scan_request *nd_config;
Johannes Bergff1b6e62011-05-04 15:37:28 +02002989};
2990
2991/**
Amitkumar Karwarbe29b99a2013-06-28 11:51:26 -07002992 * struct cfg80211_coalesce_rules - Coalesce rule parameters
2993 *
2994 * This structure defines coalesce rule for the device.
2995 * @delay: maximum coalescing delay in msecs.
2996 * @condition: condition for packet coalescence.
2997 * see &enum nl80211_coalesce_condition.
2998 * @patterns: array of packet patterns
2999 * @n_patterns: number of patterns
3000 */
3001struct cfg80211_coalesce_rules {
3002 int delay;
3003 enum nl80211_coalesce_condition condition;
3004 struct cfg80211_pkt_pattern *patterns;
3005 int n_patterns;
3006};
3007
3008/**
3009 * struct cfg80211_coalesce - Packet coalescing settings
3010 *
3011 * This structure defines coalescing settings.
3012 * @rules: array of coalesce rules
3013 * @n_rules: number of rules
3014 */
3015struct cfg80211_coalesce {
3016 struct cfg80211_coalesce_rules *rules;
3017 int n_rules;
3018};
3019
3020/**
Luciano Coelho8cd4d452014-09-17 11:55:28 +03003021 * struct cfg80211_wowlan_nd_match - information about the match
3022 *
3023 * @ssid: SSID of the match that triggered the wake up
3024 * @n_channels: Number of channels where the match occurred. This
3025 * value may be zero if the driver can't report the channels.
3026 * @channels: center frequencies of the channels where a match
3027 * occurred (in MHz)
3028 */
3029struct cfg80211_wowlan_nd_match {
3030 struct cfg80211_ssid ssid;
3031 int n_channels;
3032 u32 channels[];
3033};
3034
3035/**
3036 * struct cfg80211_wowlan_nd_info - net detect wake up information
3037 *
3038 * @n_matches: Number of match information instances provided in
3039 * @matches. This value may be zero if the driver can't provide
3040 * match information.
3041 * @matches: Array of pointers to matches containing information about
3042 * the matches that triggered the wake up.
3043 */
3044struct cfg80211_wowlan_nd_info {
3045 int n_matches;
3046 struct cfg80211_wowlan_nd_match *matches[];
3047};
3048
3049/**
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01003050 * struct cfg80211_wowlan_wakeup - wakeup report
3051 * @disconnect: woke up by getting disconnected
3052 * @magic_pkt: woke up by receiving magic packet
3053 * @gtk_rekey_failure: woke up by GTK rekey failure
3054 * @eap_identity_req: woke up by EAP identity request packet
3055 * @four_way_handshake: woke up by 4-way handshake
3056 * @rfkill_release: woke up by rfkill being released
3057 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3058 * @packet_present_len: copied wakeup packet data
3059 * @packet_len: original wakeup packet length
3060 * @packet: The packet causing the wakeup, if any.
3061 * @packet_80211: For pattern match, magic packet and other data
3062 * frame triggers an 802.3 frame should be reported, for
3063 * disconnect due to deauth 802.11 frame. This indicates which
3064 * it is.
Johannes Berg2a0e0472013-01-23 22:57:40 +01003065 * @tcp_match: TCP wakeup packet received
3066 * @tcp_connlost: TCP connection lost or failed to establish
3067 * @tcp_nomoretokens: TCP data ran out of tokens
Luciano Coelho8cd4d452014-09-17 11:55:28 +03003068 * @net_detect: if not %NULL, woke up because of net detect
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01003069 */
3070struct cfg80211_wowlan_wakeup {
3071 bool disconnect, magic_pkt, gtk_rekey_failure,
3072 eap_identity_req, four_way_handshake,
Johannes Berg2a0e0472013-01-23 22:57:40 +01003073 rfkill_release, packet_80211,
3074 tcp_match, tcp_connlost, tcp_nomoretokens;
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01003075 s32 pattern_idx;
3076 u32 packet_present_len, packet_len;
3077 const void *packet;
Luciano Coelho8cd4d452014-09-17 11:55:28 +03003078 struct cfg80211_wowlan_nd_info *net_detect;
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01003079};
3080
3081/**
Johannes Berge5497d72011-07-05 16:35:40 +02003082 * struct cfg80211_gtk_rekey_data - rekey data
Nathan Errera093a48d2020-05-28 21:22:38 +02003083 * @kek: key encryption key (@kek_len bytes)
3084 * @kck: key confirmation key (@kck_len bytes)
Johannes Berg78f686c2014-09-10 22:28:06 +03003085 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
Nathan Errera093a48d2020-05-28 21:22:38 +02003086 * @kek_len: length of kek
3087 * @kck_len length of kck
3088 * @akm: akm (oui, id)
Johannes Berge5497d72011-07-05 16:35:40 +02003089 */
3090struct cfg80211_gtk_rekey_data {
Johannes Berg78f686c2014-09-10 22:28:06 +03003091 const u8 *kek, *kck, *replay_ctr;
Nathan Errera093a48d2020-05-28 21:22:38 +02003092 u32 akm;
3093 u8 kek_len, kck_len;
Johannes Berge5497d72011-07-05 16:35:40 +02003094};
3095
3096/**
Jouni Malinen355199e2013-02-27 17:14:27 +02003097 * struct cfg80211_update_ft_ies_params - FT IE Information
3098 *
3099 * This structure provides information needed to update the fast transition IE
3100 *
3101 * @md: The Mobility Domain ID, 2 Octet value
3102 * @ie: Fast Transition IEs
3103 * @ie_len: Length of ft_ie in octets
3104 */
3105struct cfg80211_update_ft_ies_params {
3106 u16 md;
3107 const u8 *ie;
3108 size_t ie_len;
3109};
3110
3111/**
Andrei Otcheretianskib176e622013-11-18 19:06:49 +02003112 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3113 *
3114 * This structure provides information needed to transmit a mgmt frame
3115 *
3116 * @chan: channel to use
3117 * @offchan: indicates wether off channel operation is required
3118 * @wait: duration for ROC
3119 * @buf: buffer to transmit
3120 * @len: buffer length
3121 * @no_cck: don't use cck rates for this frame
3122 * @dont_wait_for_ack: tells the low level not to wait for an ack
Andrei Otcheretianski34d22ce2014-05-09 14:11:44 +03003123 * @n_csa_offsets: length of csa_offsets array
3124 * @csa_offsets: array of all the csa offsets in the frame
Andrei Otcheretianskib176e622013-11-18 19:06:49 +02003125 */
3126struct cfg80211_mgmt_tx_params {
3127 struct ieee80211_channel *chan;
3128 bool offchan;
3129 unsigned int wait;
3130 const u8 *buf;
3131 size_t len;
3132 bool no_cck;
3133 bool dont_wait_for_ack;
Andrei Otcheretianski34d22ce2014-05-09 14:11:44 +03003134 int n_csa_offsets;
3135 const u16 *csa_offsets;
Andrei Otcheretianskib176e622013-11-18 19:06:49 +02003136};
3137
3138/**
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08003139 * struct cfg80211_dscp_exception - DSCP exception
3140 *
3141 * @dscp: DSCP value that does not adhere to the user priority range definition
3142 * @up: user priority value to which the corresponding DSCP value belongs
3143 */
3144struct cfg80211_dscp_exception {
3145 u8 dscp;
3146 u8 up;
3147};
3148
3149/**
3150 * struct cfg80211_dscp_range - DSCP range definition for user priority
3151 *
3152 * @low: lowest DSCP value of this user priority range, inclusive
3153 * @high: highest DSCP value of this user priority range, inclusive
3154 */
3155struct cfg80211_dscp_range {
3156 u8 low;
3157 u8 high;
3158};
3159
3160/* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3161#define IEEE80211_QOS_MAP_MAX_EX 21
3162#define IEEE80211_QOS_MAP_LEN_MIN 16
3163#define IEEE80211_QOS_MAP_LEN_MAX \
3164 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3165
3166/**
3167 * struct cfg80211_qos_map - QoS Map Information
3168 *
3169 * This struct defines the Interworking QoS map setting for DSCP values
3170 *
3171 * @num_des: number of DSCP exceptions (0..21)
3172 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3173 * the user priority DSCP range definition
3174 * @up: DSCP range definition for a particular user priority
3175 */
3176struct cfg80211_qos_map {
3177 u8 num_des;
3178 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3179 struct cfg80211_dscp_range up[8];
3180};
3181
3182/**
Ayala Bekercb3b7d82016-09-20 17:31:13 +03003183 * struct cfg80211_nan_conf - NAN configuration
3184 *
3185 * This struct defines NAN configuration parameters
3186 *
3187 * @master_pref: master preference (1 - 255)
Luca Coelho85859892017-02-08 15:00:34 +02003188 * @bands: operating bands, a bitmap of &enum nl80211_band values.
3189 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
3190 * (i.e. BIT(NL80211_BAND_2GHZ)).
Ayala Bekercb3b7d82016-09-20 17:31:13 +03003191 */
3192struct cfg80211_nan_conf {
3193 u8 master_pref;
Luca Coelho85859892017-02-08 15:00:34 +02003194 u8 bands;
Ayala Bekercb3b7d82016-09-20 17:31:13 +03003195};
3196
3197/**
Ayala Bekera5a9dcf2016-09-20 17:31:16 +03003198 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3199 * configuration
3200 *
3201 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
Luca Coelho85859892017-02-08 15:00:34 +02003202 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
Ayala Bekera5a9dcf2016-09-20 17:31:16 +03003203 */
3204enum cfg80211_nan_conf_changes {
3205 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
Luca Coelho85859892017-02-08 15:00:34 +02003206 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
Ayala Bekera5a9dcf2016-09-20 17:31:16 +03003207};
3208
3209/**
Ayala Bekera442b762016-09-20 17:31:15 +03003210 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3211 *
3212 * @filter: the content of the filter
3213 * @len: the length of the filter
3214 */
3215struct cfg80211_nan_func_filter {
3216 const u8 *filter;
3217 u8 len;
3218};
3219
3220/**
3221 * struct cfg80211_nan_func - a NAN function
3222 *
3223 * @type: &enum nl80211_nan_function_type
3224 * @service_id: the service ID of the function
3225 * @publish_type: &nl80211_nan_publish_type
3226 * @close_range: if true, the range should be limited. Threshold is
3227 * implementation specific.
3228 * @publish_bcast: if true, the solicited publish should be broadcasted
3229 * @subscribe_active: if true, the subscribe is active
3230 * @followup_id: the instance ID for follow up
3231 * @followup_reqid: the requestor instance ID for follow up
3232 * @followup_dest: MAC address of the recipient of the follow up
3233 * @ttl: time to live counter in DW.
3234 * @serv_spec_info: Service Specific Info
3235 * @serv_spec_info_len: Service Specific Info length
3236 * @srf_include: if true, SRF is inclusive
3237 * @srf_bf: Bloom Filter
3238 * @srf_bf_len: Bloom Filter length
3239 * @srf_bf_idx: Bloom Filter index
3240 * @srf_macs: SRF MAC addresses
3241 * @srf_num_macs: number of MAC addresses in SRF
3242 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3243 * @tx_filters: filters that should be transmitted in the SDF.
3244 * @num_rx_filters: length of &rx_filters.
3245 * @num_tx_filters: length of &tx_filters.
3246 * @instance_id: driver allocated id of the function.
3247 * @cookie: unique NAN function identifier.
3248 */
3249struct cfg80211_nan_func {
3250 enum nl80211_nan_function_type type;
3251 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3252 u8 publish_type;
3253 bool close_range;
3254 bool publish_bcast;
3255 bool subscribe_active;
3256 u8 followup_id;
3257 u8 followup_reqid;
3258 struct mac_address followup_dest;
3259 u32 ttl;
3260 const u8 *serv_spec_info;
3261 u8 serv_spec_info_len;
3262 bool srf_include;
3263 const u8 *srf_bf;
3264 u8 srf_bf_len;
3265 u8 srf_bf_idx;
3266 struct mac_address *srf_macs;
3267 int srf_num_macs;
3268 struct cfg80211_nan_func_filter *rx_filters;
3269 struct cfg80211_nan_func_filter *tx_filters;
3270 u8 num_tx_filters;
3271 u8 num_rx_filters;
3272 u8 instance_id;
3273 u64 cookie;
3274};
3275
3276/**
Avraham Stern3a00df52017-06-09 13:08:43 +01003277 * struct cfg80211_pmk_conf - PMK configuration
3278 *
3279 * @aa: authenticator address
3280 * @pmk_len: PMK length in bytes.
3281 * @pmk: the PMK material
3282 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
3283 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
3284 * holds PMK-R0.
3285 */
3286struct cfg80211_pmk_conf {
3287 const u8 *aa;
3288 u8 pmk_len;
3289 const u8 *pmk;
3290 const u8 *pmk_r0_name;
3291};
3292
3293/**
Srinivas Dasari40cbfa92018-01-25 17:13:38 +02003294 * struct cfg80211_external_auth_params - Trigger External authentication.
3295 *
3296 * Commonly used across the external auth request and event interfaces.
3297 *
3298 * @action: action type / trigger for external authentication. Only significant
3299 * for the authentication request event interface (driver to user space).
3300 * @bssid: BSSID of the peer with which the authentication has
3301 * to happen. Used by both the authentication request event and
3302 * authentication response command interface.
3303 * @ssid: SSID of the AP. Used by both the authentication request event and
3304 * authentication response command interface.
3305 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
3306 * authentication request event interface.
3307 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
3308 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
3309 * the real status code for failures. Used only for the authentication
3310 * response command interface (user space to driver).
Srinivas Dasarife494372019-01-23 18:06:56 +05303311 * @pmkid: The identifier to refer a PMKSA.
Srinivas Dasari40cbfa92018-01-25 17:13:38 +02003312 */
3313struct cfg80211_external_auth_params {
3314 enum nl80211_external_auth_action action;
3315 u8 bssid[ETH_ALEN] __aligned(2);
3316 struct cfg80211_ssid ssid;
3317 unsigned int key_mgmt_suite;
3318 u16 status;
Srinivas Dasarife494372019-01-23 18:06:56 +05303319 const u8 *pmkid;
Srinivas Dasari40cbfa92018-01-25 17:13:38 +02003320};
3321
3322/**
Randy Dunlap3453de92018-12-06 12:58:30 -08003323 * struct cfg80211_ftm_responder_stats - FTM responder statistics
Pradeep Kumar Chitrapu81e54d02018-09-20 17:30:09 -07003324 *
3325 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
3326 * indicate the relevant values in this struct for them
3327 * @success_num: number of FTM sessions in which all frames were successfully
3328 * answered
3329 * @partial_num: number of FTM sessions in which part of frames were
3330 * successfully answered
3331 * @failed_num: number of failed FTM sessions
3332 * @asap_num: number of ASAP FTM sessions
3333 * @non_asap_num: number of non-ASAP FTM sessions
3334 * @total_duration_ms: total sessions durations - gives an indication
3335 * of how much time the responder was busy
3336 * @unknown_triggers_num: number of unknown FTM triggers - triggers from
3337 * initiators that didn't finish successfully the negotiation phase with
3338 * the responder
3339 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
3340 * for a new scheduling although it already has scheduled FTM slot
3341 * @out_of_window_triggers_num: total FTM triggers out of scheduled window
3342 */
3343struct cfg80211_ftm_responder_stats {
3344 u32 filled;
3345 u32 success_num;
3346 u32 partial_num;
3347 u32 failed_num;
3348 u32 asap_num;
3349 u32 non_asap_num;
3350 u64 total_duration_ms;
3351 u32 unknown_triggers_num;
3352 u32 reschedule_requests_num;
3353 u32 out_of_window_triggers_num;
3354};
3355
3356/**
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02003357 * struct cfg80211_pmsr_ftm_result - FTM result
3358 * @failure_reason: if this measurement failed (PMSR status is
3359 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
3360 * reason than just "failure"
3361 * @burst_index: if reporting partial results, this is the index
3362 * in [0 .. num_bursts-1] of the burst that's being reported
3363 * @num_ftmr_attempts: number of FTM request frames transmitted
3364 * @num_ftmr_successes: number of FTM request frames acked
3365 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
3366 * fill this to indicate in how many seconds a retry is deemed possible
3367 * by the responder
3368 * @num_bursts_exp: actual number of bursts exponent negotiated
3369 * @burst_duration: actual burst duration negotiated
3370 * @ftms_per_burst: actual FTMs per burst negotiated
3371 * @lci_len: length of LCI information (if present)
3372 * @civicloc_len: length of civic location information (if present)
3373 * @lci: LCI data (may be %NULL)
3374 * @civicloc: civic location data (may be %NULL)
3375 * @rssi_avg: average RSSI over FTM action frames reported
3376 * @rssi_spread: spread of the RSSI over FTM action frames reported
3377 * @tx_rate: bitrate for transmitted FTM action frame response
3378 * @rx_rate: bitrate of received FTM action frame
3379 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
3380 * @rtt_variance: variance of RTTs measured (note that standard deviation is
3381 * the square root of the variance)
3382 * @rtt_spread: spread of the RTTs measured
3383 * @dist_avg: average of distances (mm) measured
3384 * (must have either this or @rtt_avg)
3385 * @dist_variance: variance of distances measured (see also @rtt_variance)
3386 * @dist_spread: spread of distances measured (see also @rtt_spread)
3387 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
3388 * @num_ftmr_successes_valid: @num_ftmr_successes is valid
3389 * @rssi_avg_valid: @rssi_avg is valid
3390 * @rssi_spread_valid: @rssi_spread is valid
3391 * @tx_rate_valid: @tx_rate is valid
3392 * @rx_rate_valid: @rx_rate is valid
3393 * @rtt_avg_valid: @rtt_avg is valid
3394 * @rtt_variance_valid: @rtt_variance is valid
3395 * @rtt_spread_valid: @rtt_spread is valid
3396 * @dist_avg_valid: @dist_avg is valid
3397 * @dist_variance_valid: @dist_variance is valid
3398 * @dist_spread_valid: @dist_spread is valid
3399 */
3400struct cfg80211_pmsr_ftm_result {
3401 const u8 *lci;
3402 const u8 *civicloc;
3403 unsigned int lci_len;
3404 unsigned int civicloc_len;
3405 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
3406 u32 num_ftmr_attempts, num_ftmr_successes;
3407 s16 burst_index;
3408 u8 busy_retry_time;
3409 u8 num_bursts_exp;
3410 u8 burst_duration;
3411 u8 ftms_per_burst;
3412 s32 rssi_avg;
3413 s32 rssi_spread;
3414 struct rate_info tx_rate, rx_rate;
3415 s64 rtt_avg;
3416 s64 rtt_variance;
3417 s64 rtt_spread;
3418 s64 dist_avg;
3419 s64 dist_variance;
3420 s64 dist_spread;
3421
3422 u16 num_ftmr_attempts_valid:1,
3423 num_ftmr_successes_valid:1,
3424 rssi_avg_valid:1,
3425 rssi_spread_valid:1,
3426 tx_rate_valid:1,
3427 rx_rate_valid:1,
3428 rtt_avg_valid:1,
3429 rtt_variance_valid:1,
3430 rtt_spread_valid:1,
3431 dist_avg_valid:1,
3432 dist_variance_valid:1,
3433 dist_spread_valid:1;
3434};
3435
3436/**
3437 * struct cfg80211_pmsr_result - peer measurement result
3438 * @addr: address of the peer
3439 * @host_time: host time (use ktime_get_boottime() adjust to the time when the
3440 * measurement was made)
3441 * @ap_tsf: AP's TSF at measurement time
3442 * @status: status of the measurement
3443 * @final: if reporting partial results, mark this as the last one; if not
3444 * reporting partial results always set this flag
3445 * @ap_tsf_valid: indicates the @ap_tsf value is valid
3446 * @type: type of the measurement reported, note that we only support reporting
3447 * one type at a time, but you can report multiple results separately and
3448 * they're all aggregated for userspace.
3449 */
3450struct cfg80211_pmsr_result {
3451 u64 host_time, ap_tsf;
3452 enum nl80211_peer_measurement_status status;
3453
3454 u8 addr[ETH_ALEN];
3455
3456 u8 final:1,
3457 ap_tsf_valid:1;
3458
3459 enum nl80211_peer_measurement_type type;
3460
3461 union {
3462 struct cfg80211_pmsr_ftm_result ftm;
3463 };
3464};
3465
3466/**
3467 * struct cfg80211_pmsr_ftm_request_peer - FTM request data
3468 * @requested: indicates FTM is requested
3469 * @preamble: frame preamble to use
3470 * @burst_period: burst period to use
3471 * @asap: indicates to use ASAP mode
3472 * @num_bursts_exp: number of bursts exponent
3473 * @burst_duration: burst duration
3474 * @ftms_per_burst: number of FTMs per burst
3475 * @ftmr_retries: number of retries for FTM request
3476 * @request_lci: request LCI information
3477 * @request_civicloc: request civic location information
Avraham Sternefb55202020-01-31 13:12:38 +02003478 * @trigger_based: use trigger based ranging for the measurement
3479 * If neither @trigger_based nor @non_trigger_based is set,
3480 * EDCA based ranging will be used.
3481 * @non_trigger_based: use non trigger based ranging for the measurement
3482 * If neither @trigger_based nor @non_trigger_based is set,
3483 * EDCA based ranging will be used.
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02003484 *
3485 * See also nl80211 for the respective attribute documentation.
3486 */
3487struct cfg80211_pmsr_ftm_request_peer {
3488 enum nl80211_preamble preamble;
3489 u16 burst_period;
3490 u8 requested:1,
3491 asap:1,
3492 request_lci:1,
Avraham Sternefb55202020-01-31 13:12:38 +02003493 request_civicloc:1,
3494 trigger_based:1,
3495 non_trigger_based:1;
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02003496 u8 num_bursts_exp;
3497 u8 burst_duration;
3498 u8 ftms_per_burst;
3499 u8 ftmr_retries;
3500};
3501
3502/**
3503 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
3504 * @addr: MAC address
3505 * @chandef: channel to use
3506 * @report_ap_tsf: report the associated AP's TSF
3507 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
3508 */
3509struct cfg80211_pmsr_request_peer {
3510 u8 addr[ETH_ALEN];
3511 struct cfg80211_chan_def chandef;
3512 u8 report_ap_tsf:1;
3513 struct cfg80211_pmsr_ftm_request_peer ftm;
3514};
3515
3516/**
3517 * struct cfg80211_pmsr_request - peer measurement request
3518 * @cookie: cookie, set by cfg80211
3519 * @nl_portid: netlink portid - used by cfg80211
3520 * @drv_data: driver data for this request, if required for aborting,
3521 * not otherwise freed or anything by cfg80211
3522 * @mac_addr: MAC address used for (randomised) request
3523 * @mac_addr_mask: MAC address mask used for randomisation, bits that
3524 * are 0 in the mask should be randomised, bits that are 1 should
3525 * be taken from the @mac_addr
3526 * @list: used by cfg80211 to hold on to the request
3527 * @timeout: timeout (in milliseconds) for the whole operation, if
3528 * zero it means there's no timeout
3529 * @n_peers: number of peers to do measurements with
3530 * @peers: per-peer measurement request data
3531 */
3532struct cfg80211_pmsr_request {
3533 u64 cookie;
3534 void *drv_data;
3535 u32 n_peers;
3536 u32 nl_portid;
3537
3538 u32 timeout;
3539
3540 u8 mac_addr[ETH_ALEN] __aligned(2);
3541 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3542
3543 struct list_head list;
3544
3545 struct cfg80211_pmsr_request_peer peers[];
3546};
3547
3548/**
Sunil Duttcb74e972019-02-20 16:18:07 +05303549 * struct cfg80211_update_owe_info - OWE Information
3550 *
3551 * This structure provides information needed for the drivers to offload OWE
3552 * (Opportunistic Wireless Encryption) processing to the user space.
3553 *
3554 * Commonly used across update_owe_info request and event interfaces.
3555 *
3556 * @peer: MAC address of the peer device for which the OWE processing
3557 * has to be done.
3558 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3559 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3560 * cannot give you the real status code for failures. Used only for
3561 * OWE update request command interface (user space to driver).
3562 * @ie: IEs obtained from the peer or constructed by the user space. These are
3563 * the IEs of the remote peer in the event from the host driver and
3564 * the constructed IEs by the user space in the request interface.
3565 * @ie_len: Length of IEs in octets.
3566 */
3567struct cfg80211_update_owe_info {
3568 u8 peer[ETH_ALEN] __aligned(2);
3569 u16 status;
3570 const u8 *ie;
3571 size_t ie_len;
3572};
3573
3574/**
Johannes Berg6cd536f2020-04-17 12:43:01 +02003575 * struct mgmt_frame_regs - management frame registrations data
3576 * @global_stypes: bitmap of management frame subtypes registered
3577 * for the entire device
3578 * @interface_stypes: bitmap of management frame subtypes registered
3579 * for the given interface
Johannes Berg9dba48a2020-04-17 12:40:15 +02003580 * @global_mcast_rx: mcast RX is needed globally for these subtypes
3581 * @interface_mcast_stypes: mcast RX is needed on this interface
3582 * for these subtypes
Johannes Berg6cd536f2020-04-17 12:43:01 +02003583 */
3584struct mgmt_frame_regs {
3585 u32 global_stypes, interface_stypes;
Johannes Berg9dba48a2020-04-17 12:40:15 +02003586 u32 global_mcast_stypes, interface_mcast_stypes;
Johannes Berg6cd536f2020-04-17 12:43:01 +02003587};
3588
3589/**
Johannes Berg704232c2007-04-23 12:20:05 -07003590 * struct cfg80211_ops - backend description for wireless configuration
3591 *
3592 * This struct is registered by fullmac card drivers and/or wireless stacks
3593 * in order to handle configuration requests on their interfaces.
3594 *
3595 * All callbacks except where otherwise noted should return 0
3596 * on success or a negative error code.
3597 *
Johannes Berg43fb45cb2007-04-24 14:07:27 -07003598 * All operations are currently invoked under rtnl for consistency with the
3599 * wireless extensions but this is subject to reevaluation as soon as this
3600 * code is used more widely and we have a first user without wext.
3601 *
Johannes Bergff1b6e62011-05-04 15:37:28 +02003602 * @suspend: wiphy device needs to be suspended. The variable @wow will
3603 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
3604 * configured for the device.
Johannes Berg0378b3f2009-01-19 11:20:52 -05003605 * @resume: wiphy device needs to be resumed
Johannes Berg6d525632012-04-04 15:05:25 +02003606 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
3607 * to call device_set_wakeup_enable() to enable/disable wakeup from
3608 * the device.
Johannes Berg0378b3f2009-01-19 11:20:52 -05003609 *
Johannes Berg60719ff2008-09-16 14:55:09 +02003610 * @add_virtual_intf: create a new virtual interface with the given name,
Johannes Berg463d0182009-07-14 00:33:35 +02003611 * must set the struct wireless_dev's iftype. Beware: You must create
Johannes Berg84efbb82012-06-16 00:00:26 +02003612 * the new netdev in the wiphy's network namespace! Returns the struct
Johannes Berg98104fde2012-06-16 00:19:54 +02003613 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
3614 * also set the address member in the wdev.
Johannes Berg704232c2007-04-23 12:20:05 -07003615 *
Johannes Berg84efbb82012-06-16 00:00:26 +02003616 * @del_virtual_intf: remove the virtual interface
Johannes Berg55682962007-09-20 13:09:35 -04003617 *
Johannes Berg60719ff2008-09-16 14:55:09 +02003618 * @change_virtual_intf: change type/configuration of virtual interface,
3619 * keep the struct wireless_dev's iftype updated.
Johannes Berg55682962007-09-20 13:09:35 -04003620 *
Johannes Berg41ade002007-12-19 02:03:29 +01003621 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
3622 * when adding a group key.
3623 *
3624 * @get_key: get information about the key with the given parameters.
3625 * @mac_addr will be %NULL when requesting information for a group
3626 * key. All pointers given to the @callback function need not be valid
Johannes Berge3da5742009-05-18 19:56:36 +02003627 * after it returns. This function should return an error if it is
3628 * not possible to retrieve the key, -ENOENT if it doesn't exist.
Johannes Berg41ade002007-12-19 02:03:29 +01003629 *
3630 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
Johannes Berge3da5742009-05-18 19:56:36 +02003631 * and @key_index, return -ENOENT if the key doesn't exist.
Johannes Berg41ade002007-12-19 02:03:29 +01003632 *
3633 * @set_default_key: set the default key on an interface
Johannes Berged1b6cc2007-12-19 02:03:32 +01003634 *
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +02003635 * @set_default_mgmt_key: set the default management frame key on an interface
Johannes Berg1f7e9f42020-03-20 14:41:11 +01003636 *
Jouni Malinen56be3932020-02-22 15:25:43 +02003637 * @set_default_beacon_key: set the default Beacon frame key on an interface
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +02003638 *
Johannes Berge5497d72011-07-05 16:35:40 +02003639 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3640 *
Johannes Bergc04a4ff2012-03-01 15:28:19 +01003641 * @start_ap: Start acting in AP mode defined by the parameters.
3642 * @change_beacon: Change the beacon parameters for an access point mode
3643 * interface. This should reject the call when AP mode wasn't started.
3644 * @stop_ap: Stop being an AP, including stopping beaconing.
Johannes Berg5727ef12007-12-19 02:03:34 +01003645 *
3646 * @add_station: Add a new station.
Jouni Malinen89c771e2014-10-10 20:52:40 +03003647 * @del_station: Remove a station
Johannes Bergbdd90d52011-12-14 12:20:27 +01003648 * @change_station: Modify a given station. Note that flags changes are not much
3649 * validated in cfg80211, in particular the auth/assoc/authorized flags
3650 * might come to the driver in invalid combinations -- make sure to check
Johannes Berg77ee7c82013-02-15 00:48:33 +01003651 * them, also against the existing state! Drivers must call
3652 * cfg80211_check_station_change() to validate the information.
Johannes Bergabe37c42010-06-07 11:12:27 +02003653 * @get_station: get station information for the station identified by @mac
3654 * @dump_station: dump station callback -- resume dump at index @idx
3655 *
3656 * @add_mpath: add a fixed mesh path
3657 * @del_mpath: delete a given mesh path
3658 * @change_mpath: change a given mesh path
3659 * @get_mpath: get a mesh path for the given parameters
3660 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
Henning Rogge66be7d22014-09-12 08:58:49 +02003661 * @get_mpp: get a mesh proxy path for the given parameters
3662 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
Johannes Bergf52555a2011-01-06 22:36:45 +01003663 * @join_mesh: join the mesh network with the specified parameters
Johannes Berg8d61ffa2013-05-10 12:32:47 +02003664 * (invoked with the wireless_dev mutex held)
Johannes Bergf52555a2011-01-06 22:36:45 +01003665 * @leave_mesh: leave the current mesh network
Johannes Berg8d61ffa2013-05-10 12:32:47 +02003666 * (invoked with the wireless_dev mutex held)
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003667 *
Javier Cardona24bdd9f2010-12-16 17:37:48 -08003668 * @get_mesh_config: Get the current mesh configuration
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07003669 *
Javier Cardona24bdd9f2010-12-16 17:37:48 -08003670 * @update_mesh_config: Update mesh parameters on a running mesh.
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07003671 * The mask is a bitfield which tells us which parameters to
3672 * set, and which to leave alone.
3673 *
Jouni Malinen9f1ba902008-08-07 20:07:01 +03003674 * @change_bss: Modify parameters for a given BSS.
Jouni Malinen31888482008-10-30 16:59:24 +02003675 *
3676 * @set_txq_params: Set TX queue parameters
Jouni Malinen72bdcf32008-11-26 16:15:24 +02003677 *
Johannes Berge8c9bd52012-06-06 08:18:22 +02003678 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3679 * as it doesn't implement join_mesh and needs to set the channel to
3680 * join the mesh instead.
3681 *
3682 * @set_monitor_channel: Set the monitor mode channel for the device. If other
3683 * interfaces are active this callback should reject the configuration.
3684 * If no interfaces are active or the device is down, the channel should
3685 * be stored for when a monitor interface becomes active.
Jouni Malinen9aed3cc2009-01-13 16:03:29 +02003686 *
Johannes Berg2a519312009-02-10 21:25:55 +01003687 * @scan: Request to do a scan. If returning zero, the scan request is given
3688 * the driver, and will be valid until passed to cfg80211_scan_done().
3689 * For scan results, call cfg80211_inform_bss(); you can call this outside
3690 * the scan/scan_done bracket too.
Vidyullatha Kanchanapally91d3ab42015-10-30 19:14:49 +05303691 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
3692 * indicate the status of the scan through cfg80211_scan_done().
Jouni Malinen636a5d32009-03-19 13:39:22 +02003693 *
3694 * @auth: Request to authenticate with the specified peer
Johannes Berg8d61ffa2013-05-10 12:32:47 +02003695 * (invoked with the wireless_dev mutex held)
Jouni Malinen636a5d32009-03-19 13:39:22 +02003696 * @assoc: Request to (re)associate with the specified peer
Johannes Berg8d61ffa2013-05-10 12:32:47 +02003697 * (invoked with the wireless_dev mutex held)
Jouni Malinen636a5d32009-03-19 13:39:22 +02003698 * @deauth: Request to deauthenticate from the specified peer
Johannes Berg8d61ffa2013-05-10 12:32:47 +02003699 * (invoked with the wireless_dev mutex held)
Jouni Malinen636a5d32009-03-19 13:39:22 +02003700 * @disassoc: Request to disassociate from the specified peer
Johannes Berg8d61ffa2013-05-10 12:32:47 +02003701 * (invoked with the wireless_dev mutex held)
Johannes Berg04a773a2009-04-19 21:24:32 +02003702 *
Samuel Ortizb23aa672009-07-01 21:26:54 +02003703 * @connect: Connect to the ESS with the specified parameters. When connected,
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03003704 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3705 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3706 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3707 * from the AP or cfg80211_connect_timeout() if no frame with status code
3708 * was received.
3709 * The driver is allowed to roam to other BSSes within the ESS when the
3710 * other BSS matches the connect parameters. When such roaming is initiated
3711 * by the driver, the driver is expected to verify that the target matches
3712 * the configured security parameters and to use Reassociation Request
3713 * frame instead of Association Request frame.
3714 * The connect function can also be used to request the driver to perform a
3715 * specific roam when connected to an ESS. In that case, the prev_bssid
Jouni Malinen35eb8f72016-04-06 17:38:44 +03003716 * parameter is set to the BSSID of the currently associated BSS as an
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03003717 * indication of requesting reassociation.
3718 * In both the driver-initiated and new connect() call initiated roaming
3719 * cases, the result of roaming is indicated with a call to
Avraham Stern29ce6ec2017-04-26 10:58:49 +03003720 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
vamsi krishna088e8df2016-10-27 16:51:11 +03003721 * @update_connect_params: Update the connect parameters while connected to a
3722 * BSS. The updated parameters can be used by driver/firmware for
3723 * subsequent BSS selection (roaming) decisions and to form the
3724 * Authentication/(Re)Association Request frames. This call does not
3725 * request an immediate disassociation or reassociation with the current
3726 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
3727 * changed are defined in &enum cfg80211_connect_params_changed.
3728 * (invoked with the wireless_dev mutex held)
Ilan Peer0711d632016-10-18 23:12:13 +03003729 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
3730 * connection is in progress. Once done, call cfg80211_disconnected() in
3731 * case connection was already established (invoked with the
3732 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
Samuel Ortizb23aa672009-07-01 21:26:54 +02003733 *
Johannes Berg04a773a2009-04-19 21:24:32 +02003734 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
3735 * cfg80211_ibss_joined(), also call that function when changing BSSID due
3736 * to a merge.
Johannes Berg8d61ffa2013-05-10 12:32:47 +02003737 * (invoked with the wireless_dev mutex held)
Johannes Berg04a773a2009-04-19 21:24:32 +02003738 * @leave_ibss: Leave the IBSS.
Johannes Berg8d61ffa2013-05-10 12:32:47 +02003739 * (invoked with the wireless_dev mutex held)
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02003740 *
Antonio Quartullif4e583c2012-11-02 13:27:48 +01003741 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3742 * MESH mode)
3743 *
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02003744 * @set_wiphy_params: Notify that wiphy parameters have changed;
3745 * @changed bitfield (see &enum wiphy_params_flags) describes which values
3746 * have changed. The actual parameter values are available in
3747 * struct wiphy. If returning an error, no value should be changed.
Johannes Berg7643a2c2009-06-02 13:01:39 +02003748 *
Luis R. Rodriguez1432de02011-11-28 16:38:46 -05003749 * @set_tx_power: set the transmit power according to the parameters,
Johannes Bergc8442112012-10-24 10:17:18 +02003750 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3751 * wdev may be %NULL if power was set for the wiphy, and will
3752 * always be %NULL unless the driver supports per-vif TX power
3753 * (as advertised by the nl80211 feature flag.)
Johannes Berg7643a2c2009-06-02 13:01:39 +02003754 * @get_tx_power: store the current TX power into the dbm variable;
Johannes Berg1f87f7d2009-06-02 13:01:41 +02003755 * return 0 if successful
3756 *
3757 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
3758 * functions to adjust rfkill hw state
Johannes Bergaff89a92009-07-01 21:26:51 +02003759 *
Holger Schurig61fa7132009-11-11 12:25:40 +01003760 * @dump_survey: get site survey information.
3761 *
Jouni Malinen9588bbd2009-12-23 13:15:41 +01003762 * @remain_on_channel: Request the driver to remain awake on the specified
3763 * channel for the specified duration to complete an off-channel
3764 * operation (e.g., public action frame exchange). When the driver is
3765 * ready on the requested channel, it must indicate this with an event
3766 * notification by calling cfg80211_ready_on_channel().
3767 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
3768 * This allows the operation to be terminated prior to timeout based on
3769 * the duration value.
Johannes Bergf7ca38d2010-11-25 10:02:29 +01003770 * @mgmt_tx: Transmit a management frame.
3771 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3772 * frame on another channel
Jouni Malinen9588bbd2009-12-23 13:15:41 +01003773 *
David Spinadelfc73f112013-07-31 18:04:15 +03003774 * @testmode_cmd: run a test mode command; @wdev may be %NULL
Wey-Yi Guy71063f02011-05-20 09:05:54 -07003775 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
3776 * used by the function, but 0 and 1 must not be touched. Additionally,
3777 * return error codes other than -ENOBUFS and -ENOENT will terminate the
3778 * dump and return to userspace with an error, so be careful. If any data
3779 * was passed in from userspace then the data/len arguments will be present
3780 * and point to the data contained in %NL80211_ATTR_TESTDATA.
Samuel Ortiz67fbb162009-11-24 23:59:15 +01003781 *
Johannes Bergabe37c42010-06-07 11:12:27 +02003782 * @set_bitrate_mask: set the bitrate mask configuration
3783 *
Samuel Ortiz67fbb162009-11-24 23:59:15 +01003784 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
3785 * devices running firmwares capable of generating the (re) association
3786 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
3787 * @del_pmksa: Delete a cached PMKID.
3788 * @flush_pmksa: Flush all cached PMKIDs.
Juuso Oikarinen9043f3b2010-04-27 12:47:41 +03003789 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
3790 * allows the driver to adjust the dynamic ps timeout value.
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02003791 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
Johannes Berge86abc62015-10-22 17:35:14 +02003792 * After configuration, the driver should (soon) send an event indicating
3793 * the current level is above/below the configured threshold; this may
3794 * need some care when the configuration is changed (without first being
3795 * disabled.)
Andrew Zaborowski4a4b8162017-02-10 10:02:31 +01003796 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
3797 * connection quality monitor. An event is to be sent only when the
3798 * signal level is found to be outside the two values. The driver should
3799 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
3800 * If it is provided then there's no point providing @set_cqm_rssi_config.
Thomas Pedersen84f10702012-07-12 16:17:33 -07003801 * @set_cqm_txe_config: Configure connection quality monitor TX error
3802 * thresholds.
Luciano Coelho807f8a82011-05-11 17:09:35 +03003803 * @sched_scan_start: Tell the driver to start a scheduled scan.
Arend Van Spriel3a3ecf12017-04-21 13:05:02 +01003804 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
3805 * given request id. This call must stop the scheduled scan and be ready
3806 * for starting a new one before it returns, i.e. @sched_scan_start may be
3807 * called immediately after that again and should not fail in that case.
3808 * The driver should not call cfg80211_sched_scan_stopped() for a requested
3809 * stop (when this method returns 0).
Samuel Ortiz67fbb162009-11-24 23:59:15 +01003810 *
Johannes Berg6cd536f2020-04-17 12:43:01 +02003811 * @update_mgmt_frame_registrations: Notify the driver that management frame
3812 * registrations were updated. The callback is allowed to sleep.
Bruno Randolf547025d2010-12-02 16:23:12 +09003813 *
3814 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3815 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3816 * reject TX/RX mask combinations they cannot support by returning -EINVAL
3817 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3818 *
3819 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
John W. Linville36777132011-03-07 16:17:59 -05003820 *
Arik Nemtsov109086c2011-09-28 14:12:50 +03003821 * @tdls_mgmt: Transmit a TDLS management frame.
3822 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
Johannes Berg7f6cf312011-11-04 11:18:15 +01003823 *
3824 * @probe_client: probe an associated client, must return a cookie that it
3825 * later passes to cfg80211_probe_status().
Simon Wunderlich1d9d9212011-11-18 14:20:43 +01003826 *
3827 * @set_noack_map: Set the NoAck Map for the TIDs.
Ben Greeard6199212012-04-23 12:50:29 -07003828 *
Johannes Berg5b7ccaf2012-07-12 19:45:08 +02003829 * @get_channel: Get the current operating channel for the virtual interface.
3830 * For monitor interfaces, it should return %NULL unless there's a single
3831 * current monitoring channel.
Johannes Berg98104fde2012-06-16 00:19:54 +02003832 *
3833 * @start_p2p_device: Start the given P2P device.
3834 * @stop_p2p_device: Stop the given P2P device.
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05303835 *
3836 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
3837 * Parameters include ACL policy, an array of MAC address of stations
3838 * and the number of MAC addresses. If there is already a list in driver
3839 * this new list replaces the existing one. Driver has to clear its ACL
3840 * when number of MAC addresses entries is passed as 0. Drivers which
3841 * advertise the support for MAC based ACL have to implement this callback.
Simon Wunderlich04f39042013-02-08 18:16:19 +01003842 *
3843 * @start_radar_detection: Start radar detection in the driver.
Jouni Malinen8bf24292013-03-25 11:15:59 +02003844 *
Orr Mazor26ec17a2019-12-22 14:55:31 +00003845 * @end_cac: End running CAC, probably because a related CAC
3846 * was finished on another phy.
3847 *
Jouni Malinen8bf24292013-03-25 11:15:59 +02003848 * @update_ft_ies: Provide updated Fast BSS Transition information to the
3849 * driver. If the SME is in the driver/firmware, this information can be
3850 * used in building Authentication and Reassociation Request frames.
Arend van Spriel5de17982013-04-18 15:49:00 +02003851 *
3852 * @crit_proto_start: Indicates a critical protocol needs more link reliability
3853 * for a given duration (milliseconds). The protocol is provided so the
3854 * driver can take the most appropriate actions.
3855 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
3856 * reliability. This operation can not fail.
Amitkumar Karwarbe29b99a2013-06-28 11:51:26 -07003857 * @set_coalesce: Set coalesce parameters.
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02003858 *
Michal Kazior97dc94f2014-06-25 12:35:10 +02003859 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
3860 * responsible for veryfing if the switch is possible. Since this is
3861 * inherently tricky driver may decide to disconnect an interface later
3862 * with cfg80211_stop_iface(). This doesn't mean driver can accept
3863 * everything. It should do it's best to verify requests and reject them
3864 * as soon as possible.
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08003865 *
3866 * @set_qos_map: Set QoS mapping information to the driver
Jouni Malinene16821b2014-04-28 11:22:08 +03003867 *
3868 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3869 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3870 * changes during the lifetime of the BSS.
Johannes Berg960d01a2014-09-09 22:55:35 +03003871 *
3872 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3873 * with the given parameters; action frame exchange has been handled by
3874 * userspace so this just has to modify the TX path to take the TS into
3875 * account.
3876 * If the admitted time is 0 just validate the parameters to make sure
3877 * the session can be created at all; it is valid to just always return
3878 * success for that but that may result in inefficient behaviour (handshake
3879 * with the peer followed by immediate teardown when the addition is later
3880 * rejected)
3881 * @del_tx_ts: remove an existing TX TS
Rostislav Lisovy6e0bd6c2014-11-03 10:33:18 +01003882 *
3883 * @join_ocb: join the OCB network with the specified parameters
3884 * (invoked with the wireless_dev mutex held)
3885 * @leave_ocb: leave the current OCB network
3886 * (invoked with the wireless_dev mutex held)
Arik Nemtsov1057d352014-11-19 12:54:26 +02003887 *
3888 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
3889 * is responsible for continually initiating channel-switching operations
3890 * and returning to the base channel for communication with the AP.
3891 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
3892 * peers must be on the base channel when the call completes.
Ayala Bekercb3b7d82016-09-20 17:31:13 +03003893 * @start_nan: Start the NAN interface.
3894 * @stop_nan: Stop the NAN interface.
Ayala Bekera442b762016-09-20 17:31:15 +03003895 * @add_nan_func: Add a NAN function. Returns negative value on failure.
3896 * On success @nan_func ownership is transferred to the driver and
3897 * it may access it outside of the scope of this function. The driver
3898 * should free the @nan_func when no longer needed by calling
3899 * cfg80211_free_nan_func().
3900 * On success the driver should assign an instance_id in the
3901 * provided @nan_func.
3902 * @del_nan_func: Delete a NAN function.
Ayala Bekera5a9dcf2016-09-20 17:31:16 +03003903 * @nan_change_conf: changes NAN configuration. The changed parameters must
3904 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
3905 * All other parameters must be ignored.
Michael Braunce0ce132016-10-10 19:12:22 +02003906 *
3907 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
Avraham Stern3a00df52017-06-09 13:08:43 +01003908 *
Toke Høiland-Jørgensen52539ca2018-05-08 13:03:50 +02003909 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3910 * function should return phy stats, and interface stats otherwise.
3911 *
Avraham Stern3a00df52017-06-09 13:08:43 +01003912 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
3913 * If not deleted through @del_pmk the PMK remains valid until disconnect
3914 * upon which the driver should clear it.
3915 * (invoked with the wireless_dev mutex held)
3916 * @del_pmk: delete the previously configured PMK for the given authenticator.
3917 * (invoked with the wireless_dev mutex held)
Srinivas Dasari40cbfa92018-01-25 17:13:38 +02003918 *
3919 * @external_auth: indicates result of offloaded authentication processing from
3920 * user space
Denis Kenzior2576a9a2018-03-26 12:52:42 -05003921 *
3922 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
3923 * tells the driver that the frame should not be encrypted.
Pradeep Kumar Chitrapu81e54d02018-09-20 17:30:09 -07003924 *
3925 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
3926 * Statistics should be cumulative, currently no way to reset is provided.
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02003927 * @start_pmsr: start peer measurement (e.g. FTM)
3928 * @abort_pmsr: abort peer measurement
Sunil Duttcb74e972019-02-20 16:18:07 +05303929 *
3930 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3931 * but offloading OWE processing to the user space will get the updated
3932 * DH IE through this interface.
Rajkumar Manoharan5ab92e72019-04-11 13:47:24 -07003933 *
3934 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
3935 * and overrule HWMP path selection algorithm.
Tamizh chelvam77f576d2020-01-20 13:21:22 +05303936 * @set_tid_config: TID specific configuration, this can be peer or BSS specific
3937 * This callback may sleep.
Johannes Berg3710a8a2020-02-24 11:34:25 +01003938 * @reset_tid_config: Reset TID specific configuration for the peer, for the
3939 * given TIDs. This callback may sleep.
Johannes Berg704232c2007-04-23 12:20:05 -07003940 */
3941struct cfg80211_ops {
Johannes Bergff1b6e62011-05-04 15:37:28 +02003942 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
Johannes Berg0378b3f2009-01-19 11:20:52 -05003943 int (*resume)(struct wiphy *wiphy);
Johannes Berg6d525632012-04-04 15:05:25 +02003944 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
Johannes Berg0378b3f2009-01-19 11:20:52 -05003945
Johannes Berg84efbb82012-06-16 00:00:26 +02003946 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
Johannes Berg552bff02012-09-19 09:26:06 +02003947 const char *name,
Tom Gundersen6bab2e192015-03-18 11:13:39 +01003948 unsigned char name_assign_type,
Johannes Berg84efbb82012-06-16 00:00:26 +02003949 enum nl80211_iftype type,
Johannes Berg84efbb82012-06-16 00:00:26 +02003950 struct vif_params *params);
3951 int (*del_virtual_intf)(struct wiphy *wiphy,
3952 struct wireless_dev *wdev);
Johannes Berge36d56b2009-06-09 21:04:43 +02003953 int (*change_virtual_intf)(struct wiphy *wiphy,
3954 struct net_device *dev,
Johannes Berg818a9862017-04-12 11:23:28 +02003955 enum nl80211_iftype type,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003956 struct vif_params *params);
Johannes Berg41ade002007-12-19 02:03:29 +01003957
3958 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
Johannes Berge31b8212010-10-05 19:39:30 +02003959 u8 key_index, bool pairwise, const u8 *mac_addr,
Johannes Berg41ade002007-12-19 02:03:29 +01003960 struct key_params *params);
3961 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
Johannes Berge31b8212010-10-05 19:39:30 +02003962 u8 key_index, bool pairwise, const u8 *mac_addr,
3963 void *cookie,
Johannes Berg41ade002007-12-19 02:03:29 +01003964 void (*callback)(void *cookie, struct key_params*));
3965 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
Johannes Berge31b8212010-10-05 19:39:30 +02003966 u8 key_index, bool pairwise, const u8 *mac_addr);
Johannes Berg41ade002007-12-19 02:03:29 +01003967 int (*set_default_key)(struct wiphy *wiphy,
3968 struct net_device *netdev,
Johannes Bergdbd2fd62010-12-09 19:58:59 +01003969 u8 key_index, bool unicast, bool multicast);
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +02003970 int (*set_default_mgmt_key)(struct wiphy *wiphy,
3971 struct net_device *netdev,
3972 u8 key_index);
Jouni Malinen56be3932020-02-22 15:25:43 +02003973 int (*set_default_beacon_key)(struct wiphy *wiphy,
3974 struct net_device *netdev,
3975 u8 key_index);
Johannes Berged1b6cc2007-12-19 02:03:32 +01003976
Johannes Berg88600202012-02-13 15:17:18 +01003977 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
3978 struct cfg80211_ap_settings *settings);
3979 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
3980 struct cfg80211_beacon_data *info);
3981 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
Johannes Berg5727ef12007-12-19 02:03:34 +01003982
3983
3984 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003985 const u8 *mac,
3986 struct station_parameters *params);
Johannes Berg5727ef12007-12-19 02:03:34 +01003987 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
Jouni Malinen89c771e2014-10-10 20:52:40 +03003988 struct station_del_parameters *params);
Johannes Berg5727ef12007-12-19 02:03:34 +01003989 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003990 const u8 *mac,
3991 struct station_parameters *params);
Johannes Bergfd5b74d2007-12-19 02:03:36 +01003992 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003993 const u8 *mac, struct station_info *sinfo);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003994 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003995 int idx, u8 *mac, struct station_info *sinfo);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003996
3997 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02003998 const u8 *dst, const u8 *next_hop);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01003999 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02004000 const u8 *dst);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01004001 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02004002 const u8 *dst, const u8 *next_hop);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01004003 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02004004 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +01004005 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02004006 int idx, u8 *dst, u8 *next_hop,
4007 struct mpath_info *pinfo);
Henning Rogge66be7d22014-09-12 08:58:49 +02004008 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
4009 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
4010 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
4011 int idx, u8 *dst, u8 *mpp,
4012 struct mpath_info *pinfo);
Javier Cardona24bdd9f2010-12-16 17:37:48 -08004013 int (*get_mesh_config)(struct wiphy *wiphy,
colin@cozybit.com93da9cc2008-10-21 12:03:48 -07004014 struct net_device *dev,
4015 struct mesh_config *conf);
Javier Cardona24bdd9f2010-12-16 17:37:48 -08004016 int (*update_mesh_config)(struct wiphy *wiphy,
Johannes Berg29cbe682010-12-03 09:20:44 +01004017 struct net_device *dev, u32 mask,
4018 const struct mesh_config *nconf);
4019 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
4020 const struct mesh_config *conf,
4021 const struct mesh_setup *setup);
4022 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
4023
Rostislav Lisovy6e0bd6c2014-11-03 10:33:18 +01004024 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
4025 struct ocb_setup *setup);
4026 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
4027
Jouni Malinen9f1ba902008-08-07 20:07:01 +03004028 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
4029 struct bss_parameters *params);
Jouni Malinen31888482008-10-30 16:59:24 +02004030
Eliad Pellerf70f01c2011-09-25 20:06:53 +03004031 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
Jouni Malinen31888482008-10-30 16:59:24 +02004032 struct ieee80211_txq_params *params);
Jouni Malinen72bdcf32008-11-26 16:15:24 +02004033
Johannes Berge8c9bd52012-06-06 08:18:22 +02004034 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
4035 struct net_device *dev,
4036 struct ieee80211_channel *chan);
4037
4038 int (*set_monitor_channel)(struct wiphy *wiphy,
Johannes Berg683b6d32012-11-08 21:25:48 +01004039 struct cfg80211_chan_def *chandef);
Jouni Malinen9aed3cc2009-01-13 16:03:29 +02004040
Johannes Bergfd014282012-06-18 19:17:03 +02004041 int (*scan)(struct wiphy *wiphy,
Johannes Berg2a519312009-02-10 21:25:55 +01004042 struct cfg80211_scan_request *request);
Vidyullatha Kanchanapally91d3ab42015-10-30 19:14:49 +05304043 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
Jouni Malinen636a5d32009-03-19 13:39:22 +02004044
4045 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
4046 struct cfg80211_auth_request *req);
4047 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
4048 struct cfg80211_assoc_request *req);
4049 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg63c9c5e2012-02-24 13:50:51 +01004050 struct cfg80211_deauth_request *req);
Jouni Malinen636a5d32009-03-19 13:39:22 +02004051 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg63c9c5e2012-02-24 13:50:51 +01004052 struct cfg80211_disassoc_request *req);
Johannes Berg04a773a2009-04-19 21:24:32 +02004053
Samuel Ortizb23aa672009-07-01 21:26:54 +02004054 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
4055 struct cfg80211_connect_params *sme);
vamsi krishna088e8df2016-10-27 16:51:11 +03004056 int (*update_connect_params)(struct wiphy *wiphy,
4057 struct net_device *dev,
4058 struct cfg80211_connect_params *sme,
4059 u32 changed);
Samuel Ortizb23aa672009-07-01 21:26:54 +02004060 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4061 u16 reason_code);
4062
Johannes Berg04a773a2009-04-19 21:24:32 +02004063 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
4064 struct cfg80211_ibss_params *params);
4065 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02004066
Antonio Quartullif4e583c2012-11-02 13:27:48 +01004067 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg57fbcce2016-04-12 15:56:15 +02004068 int rate[NUM_NL80211_BANDS]);
Antonio Quartullif4e583c2012-11-02 13:27:48 +01004069
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02004070 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
Johannes Berg7643a2c2009-06-02 13:01:39 +02004071
Johannes Bergc8442112012-10-24 10:17:18 +02004072 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
Juuso Oikarinenfa61cf72010-06-23 12:12:37 +03004073 enum nl80211_tx_power_setting type, int mbm);
Johannes Bergc8442112012-10-24 10:17:18 +02004074 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4075 int *dbm);
Johannes Berg1f87f7d2009-06-02 13:01:41 +02004076
4077 void (*rfkill_poll)(struct wiphy *wiphy);
Johannes Bergaff89a92009-07-01 21:26:51 +02004078
4079#ifdef CONFIG_NL80211_TESTMODE
David Spinadelfc73f112013-07-31 18:04:15 +03004080 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4081 void *data, int len);
Wey-Yi Guy71063f02011-05-20 09:05:54 -07004082 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
4083 struct netlink_callback *cb,
4084 void *data, int len);
Johannes Bergaff89a92009-07-01 21:26:51 +02004085#endif
Johannes Bergbc92afd2009-07-01 21:26:57 +02004086
Johannes Berg99303802009-07-01 21:26:59 +02004087 int (*set_bitrate_mask)(struct wiphy *wiphy,
4088 struct net_device *dev,
4089 const u8 *peer,
4090 const struct cfg80211_bitrate_mask *mask);
4091
Holger Schurig61fa7132009-11-11 12:25:40 +01004092 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
4093 int idx, struct survey_info *info);
4094
Samuel Ortiz67fbb162009-11-24 23:59:15 +01004095 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4096 struct cfg80211_pmksa *pmksa);
4097 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4098 struct cfg80211_pmksa *pmksa);
4099 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
4100
Jouni Malinen9588bbd2009-12-23 13:15:41 +01004101 int (*remain_on_channel)(struct wiphy *wiphy,
Johannes Berg71bbc992012-06-15 15:30:18 +02004102 struct wireless_dev *wdev,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01004103 struct ieee80211_channel *chan,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01004104 unsigned int duration,
4105 u64 *cookie);
4106 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
Johannes Berg71bbc992012-06-15 15:30:18 +02004107 struct wireless_dev *wdev,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01004108 u64 cookie);
4109
Johannes Berg71bbc992012-06-15 15:30:18 +02004110 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
Andrei Otcheretianskib176e622013-11-18 19:06:49 +02004111 struct cfg80211_mgmt_tx_params *params,
4112 u64 *cookie);
Johannes Bergf7ca38d2010-11-25 10:02:29 +01004113 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
Johannes Berg71bbc992012-06-15 15:30:18 +02004114 struct wireless_dev *wdev,
Johannes Bergf7ca38d2010-11-25 10:02:29 +01004115 u64 cookie);
Jouni Malinen026331c2010-02-15 12:53:10 +02004116
Johannes Bergbc92afd2009-07-01 21:26:57 +02004117 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4118 bool enabled, int timeout);
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02004119
4120 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
4121 struct net_device *dev,
4122 s32 rssi_thold, u32 rssi_hyst);
Johannes Berg271733c2010-10-13 12:06:23 +02004123
Andrew Zaborowski4a4b8162017-02-10 10:02:31 +01004124 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
4125 struct net_device *dev,
4126 s32 rssi_low, s32 rssi_high);
4127
Thomas Pedersen84f10702012-07-12 16:17:33 -07004128 int (*set_cqm_txe_config)(struct wiphy *wiphy,
4129 struct net_device *dev,
4130 u32 rate, u32 pkts, u32 intvl);
4131
Johannes Berg6cd536f2020-04-17 12:43:01 +02004132 void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,
4133 struct wireless_dev *wdev,
4134 struct mgmt_frame_regs *upd);
Bruno Randolfafe0cbf2010-11-10 12:50:50 +09004135
4136 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4137 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
John W. Linville36777132011-03-07 16:17:59 -05004138
Luciano Coelho807f8a82011-05-11 17:09:35 +03004139 int (*sched_scan_start)(struct wiphy *wiphy,
4140 struct net_device *dev,
4141 struct cfg80211_sched_scan_request *request);
Arend Van Spriel3a3ecf12017-04-21 13:05:02 +01004142 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
4143 u64 reqid);
Johannes Berge5497d72011-07-05 16:35:40 +02004144
4145 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4146 struct cfg80211_gtk_rekey_data *data);
Arik Nemtsov109086c2011-09-28 14:12:50 +03004147
4148 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02004149 const u8 *peer, u8 action_code, u8 dialog_token,
Sunil Dutt Undekaridf942e72014-02-20 16:22:09 +05304150 u16 status_code, u32 peer_capability,
Arik Nemtsov31fa97c2014-06-11 17:18:21 +03004151 bool initiator, const u8 *buf, size_t len);
Arik Nemtsov109086c2011-09-28 14:12:50 +03004152 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3b3a0162014-05-19 17:19:31 +02004153 const u8 *peer, enum nl80211_tdls_operation oper);
Johannes Berg7f6cf312011-11-04 11:18:15 +01004154
4155 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
4156 const u8 *peer, u64 *cookie);
Johannes Berge9998822011-11-09 10:30:21 +01004157
Simon Wunderlich1d9d9212011-11-18 14:20:43 +01004158 int (*set_noack_map)(struct wiphy *wiphy,
4159 struct net_device *dev,
4160 u16 noack_map);
4161
Johannes Berg683b6d32012-11-08 21:25:48 +01004162 int (*get_channel)(struct wiphy *wiphy,
Johannes Berg5b7ccaf2012-07-12 19:45:08 +02004163 struct wireless_dev *wdev,
Johannes Berg683b6d32012-11-08 21:25:48 +01004164 struct cfg80211_chan_def *chandef);
Johannes Berg98104fde2012-06-16 00:19:54 +02004165
4166 int (*start_p2p_device)(struct wiphy *wiphy,
4167 struct wireless_dev *wdev);
4168 void (*stop_p2p_device)(struct wiphy *wiphy,
4169 struct wireless_dev *wdev);
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05304170
4171 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
4172 const struct cfg80211_acl_data *params);
Simon Wunderlich04f39042013-02-08 18:16:19 +01004173
4174 int (*start_radar_detection)(struct wiphy *wiphy,
4175 struct net_device *dev,
Janusz Dziedzic31559f32014-02-21 19:46:13 +01004176 struct cfg80211_chan_def *chandef,
4177 u32 cac_time_ms);
Orr Mazor26ec17a2019-12-22 14:55:31 +00004178 void (*end_cac)(struct wiphy *wiphy,
4179 struct net_device *dev);
Jouni Malinen355199e2013-02-27 17:14:27 +02004180 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4181 struct cfg80211_update_ft_ies_params *ftie);
Arend van Spriel5de17982013-04-18 15:49:00 +02004182 int (*crit_proto_start)(struct wiphy *wiphy,
4183 struct wireless_dev *wdev,
4184 enum nl80211_crit_proto_id protocol,
4185 u16 duration);
4186 void (*crit_proto_stop)(struct wiphy *wiphy,
4187 struct wireless_dev *wdev);
Amitkumar Karwarbe29b99a2013-06-28 11:51:26 -07004188 int (*set_coalesce)(struct wiphy *wiphy,
4189 struct cfg80211_coalesce *coalesce);
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02004190
4191 int (*channel_switch)(struct wiphy *wiphy,
4192 struct net_device *dev,
4193 struct cfg80211_csa_settings *params);
Jouni Malinene16821b2014-04-28 11:22:08 +03004194
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08004195 int (*set_qos_map)(struct wiphy *wiphy,
4196 struct net_device *dev,
4197 struct cfg80211_qos_map *qos_map);
Jouni Malinene16821b2014-04-28 11:22:08 +03004198
4199 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4200 struct cfg80211_chan_def *chandef);
Johannes Berg960d01a2014-09-09 22:55:35 +03004201
4202 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4203 u8 tsid, const u8 *peer, u8 user_prio,
4204 u16 admitted_time);
4205 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4206 u8 tsid, const u8 *peer);
Arik Nemtsov1057d352014-11-19 12:54:26 +02004207
4208 int (*tdls_channel_switch)(struct wiphy *wiphy,
4209 struct net_device *dev,
4210 const u8 *addr, u8 oper_class,
4211 struct cfg80211_chan_def *chandef);
4212 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
4213 struct net_device *dev,
4214 const u8 *addr);
Ayala Bekercb3b7d82016-09-20 17:31:13 +03004215 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4216 struct cfg80211_nan_conf *conf);
4217 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
Ayala Bekera442b762016-09-20 17:31:15 +03004218 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4219 struct cfg80211_nan_func *nan_func);
4220 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4221 u64 cookie);
Ayala Bekera5a9dcf2016-09-20 17:31:16 +03004222 int (*nan_change_conf)(struct wiphy *wiphy,
4223 struct wireless_dev *wdev,
4224 struct cfg80211_nan_conf *conf,
4225 u32 changes);
Michael Braunce0ce132016-10-10 19:12:22 +02004226
4227 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
4228 struct net_device *dev,
4229 const bool enabled);
Avraham Stern3a00df52017-06-09 13:08:43 +01004230
Toke Høiland-Jørgensen52539ca2018-05-08 13:03:50 +02004231 int (*get_txq_stats)(struct wiphy *wiphy,
4232 struct wireless_dev *wdev,
4233 struct cfg80211_txq_stats *txqstats);
4234
Avraham Stern3a00df52017-06-09 13:08:43 +01004235 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
4236 const struct cfg80211_pmk_conf *conf);
4237 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
4238 const u8 *aa);
Srinivas Dasari40cbfa92018-01-25 17:13:38 +02004239 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
4240 struct cfg80211_external_auth_params *params);
Denis Kenzior2576a9a2018-03-26 12:52:42 -05004241
4242 int (*tx_control_port)(struct wiphy *wiphy,
4243 struct net_device *dev,
4244 const u8 *buf, size_t len,
Johannes Berg8d74a622020-02-24 10:19:12 +01004245 const u8 *dest, const __be16 proto,
Markus Theildca9ca22020-05-08 16:42:00 +02004246 const bool noencrypt,
4247 u64 *cookie);
Pradeep Kumar Chitrapu81e54d02018-09-20 17:30:09 -07004248
4249 int (*get_ftm_responder_stats)(struct wiphy *wiphy,
4250 struct net_device *dev,
4251 struct cfg80211_ftm_responder_stats *ftm_stats);
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02004252
4253 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4254 struct cfg80211_pmsr_request *request);
4255 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4256 struct cfg80211_pmsr_request *request);
Sunil Duttcb74e972019-02-20 16:18:07 +05304257 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4258 struct cfg80211_update_owe_info *owe_info);
Rajkumar Manoharan5ab92e72019-04-11 13:47:24 -07004259 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
4260 const u8 *buf, size_t len);
Tamizh chelvam77f576d2020-01-20 13:21:22 +05304261 int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3710a8a2020-02-24 11:34:25 +01004262 struct cfg80211_tid_config *tid_conf);
Tamizh chelvam77f576d2020-01-20 13:21:22 +05304263 int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
Johannes Berg3710a8a2020-02-24 11:34:25 +01004264 const u8 *peer, u8 tids);
Johannes Berg704232c2007-04-23 12:20:05 -07004265};
4266
Johannes Bergd3236552009-04-20 14:31:42 +02004267/*
4268 * wireless hardware and networking interfaces structures
4269 * and registration/helper functions
4270 */
4271
4272/**
Johannes Berg5be83de2009-11-19 00:56:28 +01004273 * enum wiphy_flags - wiphy capability flags
4274 *
Tova Mussaic8cb5b82020-09-18 11:33:13 +02004275 * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4276 * into two, first for legacy bands and second for UHB.
Johannes Berg5be83de2009-11-19 00:56:28 +01004277 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
4278 * wiphy at all
4279 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
4280 * by default -- this flag will be set depending on the kernel's default
4281 * on wiphy_new(), but can be changed by the driver if it has a good
4282 * reason to override the default
Johannes Berg9bc383d2009-11-19 11:55:19 +01004283 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
Manikanta Pubbisetty33d915d2019-05-08 14:55:33 +05304284 * on a VLAN interface). This flag also serves an extra purpose of
4285 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
Johannes Berg9bc383d2009-11-19 11:55:19 +01004286 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
Johannes Bergc0692b82010-08-27 14:26:53 +03004287 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4288 * control port protocol ethertype. The device also honours the
4289 * control_port_no_encrypt flag.
Johannes Berge31b8212010-10-05 19:39:30 +02004290 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
Javier Cardona15d5dda2011-04-07 15:08:28 -07004291 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
4292 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
Vivek Natarajanf4b34b52011-08-29 14:23:03 +05304293 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4294 * firmware.
Eliad Pellercedb5412011-08-31 11:29:43 +03004295 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
Arik Nemtsov109086c2011-09-28 14:12:50 +03004296 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4297 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4298 * link setup/discovery operations internally. Setup, discovery and
4299 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4300 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4301 * used for asking the driver/firmware to perform a TDLS operation.
Johannes Berg562a7482011-11-07 12:39:33 +01004302 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
Johannes Berg5e760232011-11-04 11:18:17 +01004303 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
4304 * when there are virtual interfaces in AP mode by calling
4305 * cfg80211_report_obss_beacon().
Arik Nemtsov87bbbe22011-11-10 11:28:55 +02004306 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
4307 * responds to probe-requests in hardware.
Johannes Berg7c4ef712011-11-18 15:33:48 +01004308 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
4309 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
Simon Wunderlich2f301ab2013-05-16 13:00:28 +02004310 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02004311 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
4312 * beaconing mode (AP, IBSS, Mesh, ...).
David Spinadelb8676222016-09-22 23:16:50 +03004313 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4314 * before connection.
Nathan Errera093a48d2020-05-28 21:22:38 +02004315 * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
Johannes Berg5be83de2009-11-19 00:56:28 +01004316 */
4317enum wiphy_flags {
Nathan Errera093a48d2020-05-28 21:22:38 +02004318 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
Luis R. Rodrigueza2f73b62013-11-11 22:15:29 +01004319 /* use hole at 1 */
Tova Mussaic8cb5b82020-09-18 11:33:13 +02004320 WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),
Johannes Bergc0692b82010-08-27 14:26:53 +03004321 WIPHY_FLAG_NETNS_OK = BIT(3),
4322 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
4323 WIPHY_FLAG_4ADDR_AP = BIT(5),
4324 WIPHY_FLAG_4ADDR_STATION = BIT(6),
4325 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
Jussi Kivilinna309075c2010-11-12 08:53:56 +02004326 WIPHY_FLAG_IBSS_RSN = BIT(8),
Javier Cardona15d5dda2011-04-07 15:08:28 -07004327 WIPHY_FLAG_MESH_AUTH = BIT(10),
Arend Van Sprielca986ad2017-04-21 13:05:00 +01004328 /* use hole at 11 */
Johannes Berg8e8b41f2012-03-15 10:16:16 +01004329 /* use hole at 12 */
Vivek Natarajanf4b34b52011-08-29 14:23:03 +05304330 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
Eliad Pellercedb5412011-08-31 11:29:43 +03004331 WIPHY_FLAG_AP_UAPSD = BIT(14),
Arik Nemtsov109086c2011-09-28 14:12:50 +03004332 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
4333 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
Johannes Berg562a7482011-11-07 12:39:33 +01004334 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
Johannes Berg5e760232011-11-04 11:18:17 +01004335 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
Arik Nemtsov87bbbe22011-11-10 11:28:55 +02004336 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
Johannes Berg7c4ef712011-11-18 15:33:48 +01004337 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
4338 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
Simon Wunderlich2f301ab2013-05-16 13:00:28 +02004339 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
Simon Wunderlich16ef1fe2013-07-11 16:09:05 +02004340 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
David Spinadelb8676222016-09-22 23:16:50 +03004341 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
Johannes Berg7527a782011-05-13 10:58:57 +02004342};
4343
4344/**
4345 * struct ieee80211_iface_limit - limit on certain interface types
4346 * @max: maximum number of interfaces of these types
4347 * @types: interface types (bits)
4348 */
4349struct ieee80211_iface_limit {
4350 u16 max;
4351 u16 types;
4352};
4353
4354/**
4355 * struct ieee80211_iface_combination - possible interface combination
Johannes Berg7527a782011-05-13 10:58:57 +02004356 *
Luciano Coelhob80edbc2014-02-20 16:45:34 +02004357 * With this structure the driver can describe which interface
4358 * combinations it supports concurrently.
Johannes Berg7527a782011-05-13 10:58:57 +02004359 *
Luciano Coelhob80edbc2014-02-20 16:45:34 +02004360 * Examples:
4361 *
4362 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
Johannes Berg7527a782011-05-13 10:58:57 +02004363 *
Johannes Berg819bf592016-10-11 14:56:53 +02004364 * .. code-block:: c
4365 *
4366 * struct ieee80211_iface_limit limits1[] = {
4367 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4368 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
4369 * };
4370 * struct ieee80211_iface_combination combination1 = {
4371 * .limits = limits1,
4372 * .n_limits = ARRAY_SIZE(limits1),
4373 * .max_interfaces = 2,
4374 * .beacon_int_infra_match = true,
4375 * };
Johannes Berg7527a782011-05-13 10:58:57 +02004376 *
4377 *
Luciano Coelhob80edbc2014-02-20 16:45:34 +02004378 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
Johannes Berg7527a782011-05-13 10:58:57 +02004379 *
Johannes Berg819bf592016-10-11 14:56:53 +02004380 * .. code-block:: c
4381 *
4382 * struct ieee80211_iface_limit limits2[] = {
4383 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
4384 * BIT(NL80211_IFTYPE_P2P_GO), },
4385 * };
4386 * struct ieee80211_iface_combination combination2 = {
4387 * .limits = limits2,
4388 * .n_limits = ARRAY_SIZE(limits2),
4389 * .max_interfaces = 8,
4390 * .num_different_channels = 1,
4391 * };
Johannes Berg7527a782011-05-13 10:58:57 +02004392 *
4393 *
Luciano Coelhob80edbc2014-02-20 16:45:34 +02004394 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4395 *
Johannes Berg819bf592016-10-11 14:56:53 +02004396 * This allows for an infrastructure connection and three P2P connections.
Johannes Berg7527a782011-05-13 10:58:57 +02004397 *
Johannes Berg819bf592016-10-11 14:56:53 +02004398 * .. code-block:: c
4399 *
4400 * struct ieee80211_iface_limit limits3[] = {
4401 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4402 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
4403 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
4404 * };
4405 * struct ieee80211_iface_combination combination3 = {
4406 * .limits = limits3,
4407 * .n_limits = ARRAY_SIZE(limits3),
4408 * .max_interfaces = 4,
4409 * .num_different_channels = 2,
4410 * };
4411 *
Johannes Berg7527a782011-05-13 10:58:57 +02004412 */
4413struct ieee80211_iface_combination {
Johannes Bergc6c94ae2017-01-13 10:02:13 +01004414 /**
4415 * @limits:
4416 * limits for the given interface types
4417 */
Johannes Berg7527a782011-05-13 10:58:57 +02004418 const struct ieee80211_iface_limit *limits;
Johannes Bergc6c94ae2017-01-13 10:02:13 +01004419
4420 /**
4421 * @num_different_channels:
4422 * can use up to this many different channels
4423 */
Johannes Berg7527a782011-05-13 10:58:57 +02004424 u32 num_different_channels;
Johannes Bergc6c94ae2017-01-13 10:02:13 +01004425
4426 /**
4427 * @max_interfaces:
4428 * maximum number of interfaces in total allowed in this group
4429 */
Johannes Berg7527a782011-05-13 10:58:57 +02004430 u16 max_interfaces;
Johannes Bergc6c94ae2017-01-13 10:02:13 +01004431
4432 /**
4433 * @n_limits:
4434 * number of limitations
4435 */
Johannes Berg7527a782011-05-13 10:58:57 +02004436 u8 n_limits;
Johannes Bergc6c94ae2017-01-13 10:02:13 +01004437
4438 /**
4439 * @beacon_int_infra_match:
4440 * In this combination, the beacon intervals between infrastructure
4441 * and AP types must match. This is required only in special cases.
4442 */
Johannes Berg7527a782011-05-13 10:58:57 +02004443 bool beacon_int_infra_match;
Johannes Bergc6c94ae2017-01-13 10:02:13 +01004444
4445 /**
4446 * @radar_detect_widths:
4447 * bitmap of channel widths supported for radar detection
4448 */
Simon Wunderlich11c4a072013-01-08 14:04:07 +01004449 u8 radar_detect_widths;
Johannes Bergc6c94ae2017-01-13 10:02:13 +01004450
4451 /**
4452 * @radar_detect_regions:
4453 * bitmap of regions supported for radar detection
4454 */
Felix Fietkau8c48b502014-05-05 11:48:40 +02004455 u8 radar_detect_regions;
Johannes Bergc6c94ae2017-01-13 10:02:13 +01004456
4457 /**
4458 * @beacon_int_min_gcd:
4459 * This interface combination supports different beacon intervals.
4460 *
4461 * = 0
4462 * all beacon intervals for different interface must be same.
4463 * > 0
4464 * any beacon interval for the interface part of this combination AND
4465 * GCD of all beacon intervals from beaconing interfaces of this
4466 * combination must be greater or equal to this value.
4467 */
Purushottam Kushwaha0c317a02016-10-12 18:26:51 +05304468 u32 beacon_int_min_gcd;
Johannes Berg5be83de2009-11-19 00:56:28 +01004469};
4470
Johannes Berg2e161f782010-08-12 15:38:38 +02004471struct ieee80211_txrx_stypes {
4472 u16 tx, rx;
4473};
4474
Johannes Berg5be83de2009-11-19 00:56:28 +01004475/**
Johannes Bergff1b6e62011-05-04 15:37:28 +02004476 * enum wiphy_wowlan_support_flags - WoWLAN support flags
4477 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4478 * trigger that keeps the device operating as-is and
4479 * wakes up the host on any activity, for example a
4480 * received packet that passed filtering; note that the
4481 * packet should be preserved in that case
4482 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4483 * (see nl80211.h)
4484 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
Johannes Berg77dbbb12011-07-13 10:48:55 +02004485 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
4486 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
4487 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
4488 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
4489 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
Luciano Coelho8cd4d452014-09-17 11:55:28 +03004490 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
Johannes Bergff1b6e62011-05-04 15:37:28 +02004491 */
4492enum wiphy_wowlan_support_flags {
Johannes Berg77dbbb12011-07-13 10:48:55 +02004493 WIPHY_WOWLAN_ANY = BIT(0),
4494 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
4495 WIPHY_WOWLAN_DISCONNECT = BIT(2),
4496 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
4497 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
4498 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
4499 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
4500 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
Luciano Coelho8cd4d452014-09-17 11:55:28 +03004501 WIPHY_WOWLAN_NET_DETECT = BIT(8),
Johannes Bergff1b6e62011-05-04 15:37:28 +02004502};
4503
Johannes Berg2a0e0472013-01-23 22:57:40 +01004504struct wiphy_wowlan_tcp_support {
4505 const struct nl80211_wowlan_tcp_data_token_feature *tok;
4506 u32 data_payload_max;
4507 u32 data_interval_max;
4508 u32 wake_payload_max;
4509 bool seq;
4510};
4511
Johannes Bergff1b6e62011-05-04 15:37:28 +02004512/**
4513 * struct wiphy_wowlan_support - WoWLAN support data
4514 * @flags: see &enum wiphy_wowlan_support_flags
4515 * @n_patterns: number of supported wakeup patterns
4516 * (see nl80211.h for the pattern definition)
4517 * @pattern_max_len: maximum length of each pattern
4518 * @pattern_min_len: minimum length of each pattern
Amitkumar Karwarbb92d192013-02-12 12:16:26 -08004519 * @max_pkt_offset: maximum Rx packet offset
Luciano Coelho8cd4d452014-09-17 11:55:28 +03004520 * @max_nd_match_sets: maximum number of matchsets for net-detect,
4521 * similar, but not necessarily identical, to max_match_sets for
4522 * scheduled scans.
4523 * See &struct cfg80211_sched_scan_request.@match_sets for more
4524 * details.
Johannes Berg2a0e0472013-01-23 22:57:40 +01004525 * @tcp: TCP wakeup support information
Johannes Bergff1b6e62011-05-04 15:37:28 +02004526 */
4527struct wiphy_wowlan_support {
4528 u32 flags;
4529 int n_patterns;
4530 int pattern_max_len;
4531 int pattern_min_len;
Amitkumar Karwarbb92d192013-02-12 12:16:26 -08004532 int max_pkt_offset;
Luciano Coelho8cd4d452014-09-17 11:55:28 +03004533 int max_nd_match_sets;
Johannes Berg2a0e0472013-01-23 22:57:40 +01004534 const struct wiphy_wowlan_tcp_support *tcp;
Johannes Bergff1b6e62011-05-04 15:37:28 +02004535};
4536
4537/**
Amitkumar Karwarbe29b99a2013-06-28 11:51:26 -07004538 * struct wiphy_coalesce_support - coalesce support data
4539 * @n_rules: maximum number of coalesce rules
4540 * @max_delay: maximum supported coalescing delay in msecs
4541 * @n_patterns: number of supported patterns in a rule
4542 * (see nl80211.h for the pattern definition)
4543 * @pattern_max_len: maximum length of each pattern
4544 * @pattern_min_len: minimum length of each pattern
4545 * @max_pkt_offset: maximum Rx packet offset
4546 */
4547struct wiphy_coalesce_support {
4548 int n_rules;
4549 int max_delay;
4550 int n_patterns;
4551 int pattern_max_len;
4552 int pattern_min_len;
4553 int max_pkt_offset;
4554};
4555
4556/**
Johannes Bergad7e7182013-11-13 13:37:47 +01004557 * enum wiphy_vendor_command_flags - validation flags for vendor commands
4558 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4559 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4560 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4561 * (must be combined with %_WDEV or %_NETDEV)
4562 */
4563enum wiphy_vendor_command_flags {
4564 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4565 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4566 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4567};
4568
4569/**
tamizhr@codeaurora.org466b9932018-01-31 16:24:49 +05304570 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4571 *
4572 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4573 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4574 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4575 *
4576 */
4577enum wiphy_opmode_flag {
4578 STA_OPMODE_MAX_BW_CHANGED = BIT(0),
4579 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
4580 STA_OPMODE_N_SS_CHANGED = BIT(2),
4581};
4582
4583/**
4584 * struct sta_opmode_info - Station's ht/vht operation mode information
4585 * @changed: contains value from &enum wiphy_opmode_flag
tamizhr@codeaurora.org5e78abd2018-03-27 19:16:15 +05304586 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
4587 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
tamizhr@codeaurora.org466b9932018-01-31 16:24:49 +05304588 * @rx_nss: new rx_nss value of a station
4589 */
4590
4591struct sta_opmode_info {
4592 u32 changed;
tamizhr@codeaurora.org5e78abd2018-03-27 19:16:15 +05304593 enum nl80211_smps_mode smps_mode;
4594 enum nl80211_chan_width bw;
tamizhr@codeaurora.org466b9932018-01-31 16:24:49 +05304595 u8 rx_nss;
4596};
4597
Johannes Berg91046d62019-06-25 10:04:51 +02004598#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
Johannes Berg901bb982019-05-28 10:56:03 +02004599
tamizhr@codeaurora.org466b9932018-01-31 16:24:49 +05304600/**
Johannes Bergad7e7182013-11-13 13:37:47 +01004601 * struct wiphy_vendor_command - vendor command definition
4602 * @info: vendor command identifying information, as used in nl80211
4603 * @flags: flags, see &enum wiphy_vendor_command_flags
4604 * @doit: callback for the operation, note that wdev is %NULL if the
4605 * flags didn't ask for a wdev and non-%NULL otherwise; the data
4606 * pointer may be %NULL if userspace provided no data at all
Johannes Berg7bdbe402015-08-15 22:39:49 +03004607 * @dumpit: dump callback, for transferring bigger/multiple items. The
4608 * @storage points to cb->args[5], ie. is preserved over the multiple
4609 * dumpit calls.
Johannes Berg901bb982019-05-28 10:56:03 +02004610 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4611 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4612 * attribute is just raw data (e.g. a firmware command).
4613 * @maxattr: highest attribute number in policy
Johannes Berg7bdbe402015-08-15 22:39:49 +03004614 * It's recommended to not have the same sub command with both @doit and
4615 * @dumpit, so that userspace can assume certain ones are get and others
4616 * are used with dump requests.
Johannes Bergad7e7182013-11-13 13:37:47 +01004617 */
4618struct wiphy_vendor_command {
4619 struct nl80211_vendor_cmd_info info;
4620 u32 flags;
4621 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4622 const void *data, int data_len);
Johannes Berg7bdbe402015-08-15 22:39:49 +03004623 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4624 struct sk_buff *skb, const void *data, int data_len,
4625 unsigned long *storage);
Johannes Berg901bb982019-05-28 10:56:03 +02004626 const struct nla_policy *policy;
4627 unsigned int maxattr;
Johannes Bergad7e7182013-11-13 13:37:47 +01004628};
4629
4630/**
Kanchanapally, Vidyullatha019ae3a2016-05-16 10:41:04 +05304631 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4632 * @iftype: interface type
4633 * @extended_capabilities: extended capabilities supported by the driver,
4634 * additional capabilities might be supported by userspace; these are the
4635 * 802.11 extended capabilities ("Extended Capabilities element") and are
4636 * in the same format as in the information element. See IEEE Std
4637 * 802.11-2012 8.4.2.29 for the defined fields.
4638 * @extended_capabilities_mask: mask of the valid values
4639 * @extended_capabilities_len: length of the extended capabilities
4640 */
4641struct wiphy_iftype_ext_capab {
4642 enum nl80211_iftype iftype;
4643 const u8 *extended_capabilities;
4644 const u8 *extended_capabilities_mask;
4645 u8 extended_capabilities_len;
4646};
4647
4648/**
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02004649 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4650 * @max_peers: maximum number of peers in a single measurement
4651 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4652 * @randomize_mac_addr: can randomize MAC address for measurement
4653 * @ftm.supported: FTM measurement is supported
4654 * @ftm.asap: ASAP-mode is supported
4655 * @ftm.non_asap: non-ASAP-mode is supported
4656 * @ftm.request_lci: can request LCI data
4657 * @ftm.request_civicloc: can request civic location data
4658 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4659 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4660 * @ftm.max_bursts_exponent: maximum burst exponent supported
4661 * (set to -1 if not limited; note that setting this will necessarily
4662 * forbid using the value 15 to let the responder pick)
4663 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4664 * not limited)
Avraham Sternefb55202020-01-31 13:12:38 +02004665 * @ftm.trigger_based: trigger based ranging measurement is supported
4666 * @ftm.non_trigger_based: non trigger based ranging measurement is supported
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02004667 */
4668struct cfg80211_pmsr_capabilities {
4669 unsigned int max_peers;
4670 u8 report_ap_tsf:1,
4671 randomize_mac_addr:1;
4672
4673 struct {
4674 u32 preambles;
4675 u32 bandwidths;
4676 s8 max_bursts_exponent;
4677 u8 max_ftms_per_burst;
4678 u8 supported:1,
4679 asap:1,
4680 non_asap:1,
4681 request_lci:1,
Avraham Sternefb55202020-01-31 13:12:38 +02004682 request_civicloc:1,
4683 trigger_based:1,
4684 non_trigger_based:1;
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02004685 } ftm;
4686};
4687
4688/**
Veerendranath Jakkamd6039a32020-01-27 02:00:32 +05304689 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4690 * suites for interface types defined in @iftypes_mask. Each type in the
4691 * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4692 *
4693 * @iftypes_mask: bitmask of interfaces types
4694 * @akm_suites: points to an array of supported akm suites
4695 * @n_akm_suites: number of supported AKM suites
4696 */
4697struct wiphy_iftype_akm_suites {
4698 u16 iftypes_mask;
4699 const u32 *akm_suites;
4700 int n_akm_suites;
4701};
4702
4703/**
Johannes Berg5be83de2009-11-19 00:56:28 +01004704 * struct wiphy - wireless hardware description
Luis R. Rodriguez2784fe92010-12-15 19:24:11 -08004705 * @reg_notifier: the driver's regulatory notification callback,
4706 * note that if your driver uses wiphy_apply_custom_regulatory()
4707 * the reg_notifier's request can be passed as NULL
Johannes Bergd3236552009-04-20 14:31:42 +02004708 * @regd: the driver's regulatory domain, if one was requested via
Jérôme Pouillercd9b52b2020-02-21 12:56:04 +01004709 * the regulatory_hint() API. This can be used by the driver
Johannes Bergd3236552009-04-20 14:31:42 +02004710 * on the reg_notifier() if it chooses to ignore future
4711 * regulatory domain changes caused by other drivers.
4712 * @signal_type: signal type reported in &struct cfg80211_bss.
4713 * @cipher_suites: supported cipher suites
4714 * @n_cipher_suites: number of supported cipher suites
Veerendranath Jakkamd6039a32020-01-27 02:00:32 +05304715 * @akm_suites: supported AKM suites. These are the default AKMs supported if
4716 * the supported AKMs not advertized for a specific interface type in
4717 * iftype_akm_suites.
Veerendranath Jakkamab4dfa22018-12-19 22:52:25 +05304718 * @n_akm_suites: number of supported AKM suites
Veerendranath Jakkamd6039a32020-01-27 02:00:32 +05304719 * @iftype_akm_suites: array of supported akm suites info per interface type.
4720 * Note that the bits in @iftypes_mask inside this structure cannot
4721 * overlap (i.e. only one occurrence of each type is allowed across all
4722 * instances of iftype_akm_suites).
4723 * @num_iftype_akm_suites: number of interface types for which supported akm
4724 * suites are specified separately.
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02004725 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4726 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4727 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4728 * -1 = fragmentation disabled, only odd values >= 256 used
4729 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
Johannes Bergabe37c42010-06-07 11:12:27 +02004730 * @_net: the network namespace this wiphy currently lives in
Johannes Bergef15aac2010-01-20 12:02:33 +01004731 * @perm_addr: permanent MAC address of this device
4732 * @addr_mask: If the device supports multiple MAC addresses by masking,
4733 * set this to a mask with variable bits set to 1, e.g. if the last
Luciano Coelho0fcf8ac2014-02-20 16:45:33 +02004734 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
Johannes Bergef15aac2010-01-20 12:02:33 +01004735 * variable bits shall be determined by the interfaces added, with
4736 * interfaces not matching the mask being rejected to be brought up.
4737 * @n_addresses: number of addresses in @addresses.
4738 * @addresses: If the device has more than one address, set this pointer
4739 * to a list of addresses (6 bytes each). The first one will be used
4740 * by default for perm_addr. In this case, the mask should be set to
4741 * all-zeroes. In this case it is assumed that the device can handle
4742 * the same number of arbitrary MAC addresses.
Randy Dunlapfd235912011-09-08 10:16:50 -07004743 * @registered: protects ->resume and ->suspend sysfs callbacks against
4744 * unregister hardware
Jérôme Pouilleredf77192020-02-21 12:56:01 +01004745 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4746 * It will be renamed automatically on wiphy renames
Jérôme Pouiller15bc6df2020-02-21 12:56:02 +01004747 * @dev: (virtual) struct device for this wiphy. The item in
4748 * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
4749 * (see below).
Johannes Bergabe37c42010-06-07 11:12:27 +02004750 * @wext: wireless extension handlers
4751 * @priv: driver private data (sized according to wiphy_new() parameter)
4752 * @interface_modes: bitmask of interfaces types valid for this wiphy,
4753 * must be set by driver
Johannes Berg7527a782011-05-13 10:58:57 +02004754 * @iface_combinations: Valid interface combinations array, should not
4755 * list single interface types.
4756 * @n_iface_combinations: number of entries in @iface_combinations array.
4757 * @software_iftypes: bitmask of software interface types, these are not
4758 * subject to any restrictions since they are purely managed in SW.
Johannes Bergabe37c42010-06-07 11:12:27 +02004759 * @flags: wiphy flags, see &enum wiphy_flags
Luis R. Rodrigueza2f73b62013-11-11 22:15:29 +01004760 * @regulatory_flags: wiphy regulatory flags, see
4761 * &enum ieee80211_regulatory_flags
Johannes Berg1f074bd2011-11-06 14:13:33 +01004762 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
Gautam Kumar Shuklad75bb062014-12-23 16:55:19 +01004763 * @ext_features: extended features advertised to nl80211, see
4764 * &enum nl80211_ext_feature_index.
Johannes Bergabe37c42010-06-07 11:12:27 +02004765 * @bss_priv_size: each BSS struct has private data allocated with it,
4766 * this variable determines its size
4767 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4768 * any given scan
Arend Van Sprielca986ad2017-04-21 13:05:00 +01004769 * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4770 * the device can run concurrently.
Luciano Coelho93b6aa62011-07-13 14:57:28 +03004771 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
4772 * for in any given scheduled scan
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03004773 * @max_match_sets: maximum number of match sets the device can handle
4774 * when performing a scheduled scan, 0 if filtering is not
4775 * supported.
Johannes Bergabe37c42010-06-07 11:12:27 +02004776 * @max_scan_ie_len: maximum length of user-controlled IEs device can
4777 * add to probe request frames transmitted during a scan, must not
4778 * include fixed IEs like supported rates
Luciano Coelho5a865ba2011-07-13 14:57:29 +03004779 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
4780 * scans
Avraham Stern3b06d272015-10-12 09:51:34 +03004781 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
4782 * of iterations) for scheduled scan supported by the device.
4783 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
4784 * single scan plan supported by the device.
4785 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
4786 * scan plan supported by the device.
Johannes Bergabe37c42010-06-07 11:12:27 +02004787 * @coverage_class: current coverage class
4788 * @fw_version: firmware version for ethtool reporting
4789 * @hw_version: hardware version for ethtool reporting
4790 * @max_num_pmkids: maximum number of PMKIDs supported by device
4791 * @privid: a pointer that drivers can use to identify if an arbitrary
4792 * wiphy is theirs, e.g. in global notifiers
4793 * @bands: information about bands/channels supported by this device
Johannes Berg2e161f782010-08-12 15:38:38 +02004794 *
4795 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
4796 * transmitted through nl80211, points to an array indexed by interface
4797 * type
Bruno Randolfa7ffac92010-12-08 13:59:24 +09004798 *
Bruno Randolf7f531e02010-12-16 11:30:22 +09004799 * @available_antennas_tx: bitmap of antennas which are available to be
4800 * configured as TX antennas. Antenna configuration commands will be
4801 * rejected unless this or @available_antennas_rx is set.
4802 *
4803 * @available_antennas_rx: bitmap of antennas which are available to be
4804 * configured as RX antennas. Antenna configuration commands will be
4805 * rejected unless this or @available_antennas_tx is set.
Johannes Berga2939112010-12-14 17:54:28 +01004806 *
Randy Dunlap15f0ebc2012-01-21 11:03:00 -08004807 * @probe_resp_offload:
4808 * Bitmap of supported protocols for probe response offloading.
4809 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
4810 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4811 *
Johannes Berga2939112010-12-14 17:54:28 +01004812 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4813 * may request, if implemented.
Johannes Bergff1b6e62011-05-04 15:37:28 +02004814 *
4815 * @wowlan: WoWLAN support information
Johannes Berg6abb9cb2013-05-15 09:30:07 +02004816 * @wowlan_config: current WoWLAN configuration; this should usually not be
4817 * used since access to it is necessarily racy, use the parameter passed
4818 * to the suspend() operation instead.
Johannes Berg562a7482011-11-07 12:39:33 +01004819 *
4820 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
Ben Greear7e7c8922011-11-18 11:31:59 -08004821 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
4822 * If null, then none can be over-ridden.
Johannes Bergee2aca32013-02-21 17:36:01 +01004823 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
4824 * If null, then none can be over-ridden.
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05304825 *
Johannes Berg53873f12016-05-03 16:52:04 +03004826 * @wdev_list: the list of associated (virtual) interfaces; this list must
4827 * not be modified by the driver, but can be read with RTNL/RCU protection.
4828 *
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05304829 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
4830 * supports for ACL.
Johannes Berga50df0c2013-02-11 14:20:05 +01004831 *
4832 * @extended_capabilities: extended capabilities supported by the driver,
4833 * additional capabilities might be supported by userspace; these are
4834 * the 802.11 extended capabilities ("Extended Capabilities element")
4835 * and are in the same format as in the information element. See
Kanchanapally, Vidyullatha019ae3a2016-05-16 10:41:04 +05304836 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
4837 * extended capabilities to be used if the capabilities are not specified
4838 * for a specific interface type in iftype_ext_capab.
Johannes Berga50df0c2013-02-11 14:20:05 +01004839 * @extended_capabilities_mask: mask of the valid values
4840 * @extended_capabilities_len: length of the extended capabilities
Kanchanapally, Vidyullatha019ae3a2016-05-16 10:41:04 +05304841 * @iftype_ext_capab: array of extended capabilities per interface type
4842 * @num_iftype_ext_capab: number of interface types for which extended
4843 * capabilities are specified separately.
Amitkumar Karwarbe29b99a2013-06-28 11:51:26 -07004844 * @coalesce: packet coalescing support information
Johannes Bergad7e7182013-11-13 13:37:47 +01004845 *
4846 * @vendor_commands: array of vendor commands supported by the hardware
4847 * @n_vendor_commands: number of vendor commands
Johannes Berg567ffc32013-12-18 14:43:31 +01004848 * @vendor_events: array of vendor events supported by the hardware
4849 * @n_vendor_events: number of vendor events
Jouni Malinenb43504c2014-01-15 00:01:08 +02004850 *
4851 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4852 * (including P2P GO) or 0 to indicate no such limit is advertised. The
4853 * driver is allowed to advertise a theoretical limit that it can reach in
4854 * some cases, but may not always reach.
Luciano Coelhoc2e43232014-05-15 20:18:09 +03004855 *
4856 * @max_num_csa_counters: Number of supported csa_counters in beacons
4857 * and probe responses. This value should be set if the driver
4858 * wishes to limit the number of csa counters. Default (0) means
4859 * infinite.
Arend van Spriel38de03d2016-03-02 20:37:18 +01004860 * @bss_select_support: bitmask indicating the BSS selection criteria supported
4861 * by the driver in the .connect() callback. The bit position maps to the
4862 * attribute indices defined in &enum nl80211_bss_select_attr.
Ayala Bekera442b762016-09-20 17:31:15 +03004863 *
Luca Coelho85859892017-02-08 15:00:34 +02004864 * @nan_supported_bands: bands supported by the device in NAN mode, a
4865 * bitmap of &enum nl80211_band values. For instance, for
4866 * NL80211_BAND_2GHZ, bit 0 would be set
4867 * (i.e. BIT(NL80211_BAND_2GHZ)).
Johannes Bergf3a7ca62018-05-22 11:31:59 +02004868 *
4869 * @txq_limit: configuration of internal TX queue frame limit
4870 * @txq_memory_limit: configuration internal TX queue memory limit
4871 * @txq_quantum: configuration of internal TX queue scheduler quantum
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02004872 *
Lothar Rubuscha710d212020-04-08 23:10:13 +00004873 * @tx_queue_len: allow setting transmit queue len for drivers not using
4874 * wake_tx_queue
4875 *
Sara Sharon213ed572019-01-16 23:02:03 +02004876 * @support_mbssid: can HW support association with nontransmitted AP
4877 * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4878 * HE AP, in order to avoid compatibility issues.
4879 * @support_mbssid must be set for this to have any effect.
4880 *
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02004881 * @pmsr_capa: peer measurement capabilities
Johannes Berg3710a8a2020-02-24 11:34:25 +01004882 *
4883 * @tid_config_support: describes the per-TID config support that the
4884 * device has
4885 * @tid_config_support.vif: bitmap of attributes (configurations)
4886 * supported by the driver for each vif
4887 * @tid_config_support.peer: bitmap of attributes (configurations)
4888 * supported by the driver for each peer
Tamizh chelvam6a21d162020-01-20 13:21:23 +05304889 * @tid_config_support.max_retry: maximum supported retry count for
4890 * long/short retry configuration
Lothar Rubuscha710d212020-04-08 23:10:13 +00004891 *
4892 * @max_data_retry_count: maximum supported per TID retry count for
4893 * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
4894 * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
Johannes Bergd3236552009-04-20 14:31:42 +02004895 */
4896struct wiphy {
4897 /* assign these fields before you register the wiphy */
4898
Johannes Bergd3236552009-04-20 14:31:42 +02004899 u8 perm_addr[ETH_ALEN];
Johannes Bergef15aac2010-01-20 12:02:33 +01004900 u8 addr_mask[ETH_ALEN];
4901
Johannes Bergef15aac2010-01-20 12:02:33 +01004902 struct mac_address *addresses;
Johannes Bergd3236552009-04-20 14:31:42 +02004903
Johannes Berg2e161f782010-08-12 15:38:38 +02004904 const struct ieee80211_txrx_stypes *mgmt_stypes;
4905
Johannes Berg7527a782011-05-13 10:58:57 +02004906 const struct ieee80211_iface_combination *iface_combinations;
4907 int n_iface_combinations;
4908 u16 software_iftypes;
4909
Johannes Berg2e161f782010-08-12 15:38:38 +02004910 u16 n_addresses;
4911
Johannes Bergd3236552009-04-20 14:31:42 +02004912 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4913 u16 interface_modes;
4914
Vasanthakumar Thiagarajan77765ea2013-01-18 11:18:45 +05304915 u16 max_acl_mac_addrs;
4916
Luis R. Rodrigueza2f73b62013-11-11 22:15:29 +01004917 u32 flags, regulatory_flags, features;
Gautam Kumar Shuklad75bb062014-12-23 16:55:19 +01004918 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
Johannes Berg463d0182009-07-14 00:33:35 +02004919
Johannes Berg562a7482011-11-07 12:39:33 +01004920 u32 ap_sme_capa;
4921
Johannes Bergd3236552009-04-20 14:31:42 +02004922 enum cfg80211_signal_type signal_type;
4923
4924 int bss_priv_size;
4925 u8 max_scan_ssids;
Arend Van Sprielca986ad2017-04-21 13:05:00 +01004926 u8 max_sched_scan_reqs;
Luciano Coelho93b6aa62011-07-13 14:57:28 +03004927 u8 max_sched_scan_ssids;
Luciano Coelhoa1f1c212011-08-31 16:01:48 +03004928 u8 max_match_sets;
Johannes Bergd3236552009-04-20 14:31:42 +02004929 u16 max_scan_ie_len;
Luciano Coelho5a865ba2011-07-13 14:57:29 +03004930 u16 max_sched_scan_ie_len;
Avraham Stern3b06d272015-10-12 09:51:34 +03004931 u32 max_sched_scan_plans;
4932 u32 max_sched_scan_plan_interval;
4933 u32 max_sched_scan_plan_iterations;
Johannes Bergd3236552009-04-20 14:31:42 +02004934
4935 int n_cipher_suites;
4936 const u32 *cipher_suites;
4937
Veerendranath Jakkamab4dfa22018-12-19 22:52:25 +05304938 int n_akm_suites;
4939 const u32 *akm_suites;
4940
Veerendranath Jakkamd6039a32020-01-27 02:00:32 +05304941 const struct wiphy_iftype_akm_suites *iftype_akm_suites;
4942 unsigned int num_iftype_akm_suites;
4943
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02004944 u8 retry_short;
4945 u8 retry_long;
4946 u32 frag_threshold;
4947 u32 rts_threshold;
Lukáš Turek81077e82009-12-21 22:50:47 +01004948 u8 coverage_class;
Jouni Malinenb9a5f8ca2009-04-20 18:39:05 +02004949
Jiri Pirko81135542013-01-06 02:12:51 +00004950 char fw_version[ETHTOOL_FWVERS_LEN];
Kalle Valodfce95f2009-09-24 11:02:42 -07004951 u32 hw_version;
4952
Johannes Bergdfb89c52012-06-27 09:23:48 +02004953#ifdef CONFIG_PM
Johannes Berg964dc9e2013-06-03 17:25:34 +02004954 const struct wiphy_wowlan_support *wowlan;
Johannes Berg6abb9cb2013-05-15 09:30:07 +02004955 struct cfg80211_wowlan *wowlan_config;
Johannes Bergdfb89c52012-06-27 09:23:48 +02004956#endif
Johannes Bergff1b6e62011-05-04 15:37:28 +02004957
Johannes Berga2939112010-12-14 17:54:28 +01004958 u16 max_remain_on_channel_duration;
4959
Samuel Ortiz67fbb162009-11-24 23:59:15 +01004960 u8 max_num_pmkids;
4961
Bruno Randolf7f531e02010-12-16 11:30:22 +09004962 u32 available_antennas_tx;
4963 u32 available_antennas_rx;
Bruno Randolfa7ffac92010-12-08 13:59:24 +09004964
Arik Nemtsov87bbbe22011-11-10 11:28:55 +02004965 u32 probe_resp_offload;
4966
Johannes Berga50df0c2013-02-11 14:20:05 +01004967 const u8 *extended_capabilities, *extended_capabilities_mask;
4968 u8 extended_capabilities_len;
4969
Kanchanapally, Vidyullatha019ae3a2016-05-16 10:41:04 +05304970 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4971 unsigned int num_iftype_ext_capab;
4972
David Kilroycf5aa2f2009-05-16 23:13:47 +01004973 const void *privid;
Johannes Bergd3236552009-04-20 14:31:42 +02004974
Johannes Berg57fbcce2016-04-12 15:56:15 +02004975 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
Johannes Bergd3236552009-04-20 14:31:42 +02004976
Luis R. Rodriguez0c0280b2013-01-11 18:39:36 +00004977 void (*reg_notifier)(struct wiphy *wiphy,
4978 struct regulatory_request *request);
Johannes Bergd3236552009-04-20 14:31:42 +02004979
4980 /* fields below are read-only, assigned by cfg80211 */
4981
Johannes Berg458f4f92012-12-06 15:47:38 +01004982 const struct ieee80211_regdomain __rcu *regd;
Johannes Bergd3236552009-04-20 14:31:42 +02004983
Johannes Bergd3236552009-04-20 14:31:42 +02004984 struct device dev;
4985
Stanislaw Gruszkaecb44332011-08-12 14:00:59 +02004986 bool registered;
4987
Johannes Bergd3236552009-04-20 14:31:42 +02004988 struct dentry *debugfsdir;
4989
Ben Greear7e7c8922011-11-18 11:31:59 -08004990 const struct ieee80211_ht_cap *ht_capa_mod_mask;
Johannes Bergee2aca32013-02-21 17:36:01 +01004991 const struct ieee80211_vht_cap *vht_capa_mod_mask;
Ben Greear7e7c8922011-11-18 11:31:59 -08004992
Johannes Berg53873f12016-05-03 16:52:04 +03004993 struct list_head wdev_list;
4994
Eric W. Biederman0c5c9fb2015-03-11 23:06:44 -05004995 possible_net_t _net;
Johannes Berg463d0182009-07-14 00:33:35 +02004996
Johannes Berg3d23e342009-09-29 23:27:28 +02004997#ifdef CONFIG_CFG80211_WEXT
4998 const struct iw_handler_def *wext;
4999#endif
5000
Amitkumar Karwarbe29b99a2013-06-28 11:51:26 -07005001 const struct wiphy_coalesce_support *coalesce;
5002
Johannes Bergad7e7182013-11-13 13:37:47 +01005003 const struct wiphy_vendor_command *vendor_commands;
Johannes Berg567ffc32013-12-18 14:43:31 +01005004 const struct nl80211_vendor_cmd_info *vendor_events;
5005 int n_vendor_commands, n_vendor_events;
Johannes Bergad7e7182013-11-13 13:37:47 +01005006
Jouni Malinenb43504c2014-01-15 00:01:08 +02005007 u16 max_ap_assoc_sta;
5008
Andrei Otcheretianski9a774c72014-05-09 14:11:46 +03005009 u8 max_num_csa_counters;
5010
Arend van Spriel38de03d2016-03-02 20:37:18 +01005011 u32 bss_select_support;
5012
Luca Coelho85859892017-02-08 15:00:34 +02005013 u8 nan_supported_bands;
5014
Toke Høiland-Jørgensen52539ca2018-05-08 13:03:50 +02005015 u32 txq_limit;
5016 u32 txq_memory_limit;
5017 u32 txq_quantum;
5018
John Crispin1f6e0ba2020-02-11 13:26:04 +01005019 unsigned long tx_queue_len;
5020
Sara Sharon213ed572019-01-16 23:02:03 +02005021 u8 support_mbssid:1,
5022 support_only_he_mbssid:1;
5023
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02005024 const struct cfg80211_pmsr_capabilities *pmsr_capa;
5025
Johannes Berg3710a8a2020-02-24 11:34:25 +01005026 struct {
5027 u64 peer, vif;
Tamizh chelvam6a21d162020-01-20 13:21:23 +05305028 u8 max_retry;
Johannes Berg3710a8a2020-02-24 11:34:25 +01005029 } tid_config_support;
5030
Tamizh chelvam6a21d162020-01-20 13:21:23 +05305031 u8 max_data_retry_count;
5032
Gustavo A. R. Silva396fba02020-05-07 13:39:09 -05005033 char priv[] __aligned(NETDEV_ALIGN);
Johannes Bergd3236552009-04-20 14:31:42 +02005034};
5035
Johannes Berg463d0182009-07-14 00:33:35 +02005036static inline struct net *wiphy_net(struct wiphy *wiphy)
5037{
Eric Dumazetc2d9ba92010-06-01 06:51:19 +00005038 return read_pnet(&wiphy->_net);
Johannes Berg463d0182009-07-14 00:33:35 +02005039}
5040
5041static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5042{
Eric Dumazetc2d9ba92010-06-01 06:51:19 +00005043 write_pnet(&wiphy->_net, net);
Johannes Berg463d0182009-07-14 00:33:35 +02005044}
Johannes Berg463d0182009-07-14 00:33:35 +02005045
Johannes Bergd3236552009-04-20 14:31:42 +02005046/**
5047 * wiphy_priv - return priv from wiphy
5048 *
5049 * @wiphy: the wiphy whose priv pointer to return
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005050 * Return: The priv of @wiphy.
Johannes Bergd3236552009-04-20 14:31:42 +02005051 */
5052static inline void *wiphy_priv(struct wiphy *wiphy)
5053{
5054 BUG_ON(!wiphy);
5055 return &wiphy->priv;
5056}
5057
5058/**
David Kilroyf1f74822009-06-18 23:21:13 +01005059 * priv_to_wiphy - return the wiphy containing the priv
5060 *
5061 * @priv: a pointer previously returned by wiphy_priv
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005062 * Return: The wiphy of @priv.
David Kilroyf1f74822009-06-18 23:21:13 +01005063 */
5064static inline struct wiphy *priv_to_wiphy(void *priv)
5065{
5066 BUG_ON(!priv);
5067 return container_of(priv, struct wiphy, priv);
5068}
5069
5070/**
Johannes Bergd3236552009-04-20 14:31:42 +02005071 * set_wiphy_dev - set device pointer for wiphy
5072 *
5073 * @wiphy: The wiphy whose device to bind
5074 * @dev: The device to parent it to
5075 */
5076static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5077{
5078 wiphy->dev.parent = dev;
5079}
5080
5081/**
5082 * wiphy_dev - get wiphy dev pointer
5083 *
5084 * @wiphy: The wiphy whose device struct to look up
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005085 * Return: The dev of @wiphy.
Johannes Bergd3236552009-04-20 14:31:42 +02005086 */
5087static inline struct device *wiphy_dev(struct wiphy *wiphy)
5088{
5089 return wiphy->dev.parent;
5090}
5091
5092/**
5093 * wiphy_name - get wiphy name
5094 *
5095 * @wiphy: The wiphy whose name to return
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005096 * Return: The name of @wiphy.
Johannes Bergd3236552009-04-20 14:31:42 +02005097 */
Joe Perchese1db74f2010-07-26 14:39:57 -07005098static inline const char *wiphy_name(const struct wiphy *wiphy)
Johannes Bergd3236552009-04-20 14:31:42 +02005099{
5100 return dev_name(&wiphy->dev);
5101}
5102
5103/**
Ben Greear1998d902014-10-22 12:23:00 -07005104 * wiphy_new_nm - create a new wiphy for use with cfg80211
5105 *
5106 * @ops: The configuration operations for this device
5107 * @sizeof_priv: The size of the private area to allocate
5108 * @requested_name: Request a particular name.
5109 * NULL is valid value, and means use the default phy%d naming.
5110 *
5111 * Create a new wiphy and associate the given operations with it.
5112 * @sizeof_priv bytes are allocated for private use.
5113 *
5114 * Return: A pointer to the new wiphy. This pointer must be
5115 * assigned to each netdev's ieee80211_ptr for proper operation.
5116 */
5117struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
5118 const char *requested_name);
5119
5120/**
Johannes Bergd3236552009-04-20 14:31:42 +02005121 * wiphy_new - create a new wiphy for use with cfg80211
5122 *
5123 * @ops: The configuration operations for this device
5124 * @sizeof_priv: The size of the private area to allocate
5125 *
5126 * Create a new wiphy and associate the given operations with it.
5127 * @sizeof_priv bytes are allocated for private use.
5128 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005129 * Return: A pointer to the new wiphy. This pointer must be
5130 * assigned to each netdev's ieee80211_ptr for proper operation.
Johannes Bergd3236552009-04-20 14:31:42 +02005131 */
Ben Greear1998d902014-10-22 12:23:00 -07005132static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
5133 int sizeof_priv)
5134{
5135 return wiphy_new_nm(ops, sizeof_priv, NULL);
5136}
Johannes Bergd3236552009-04-20 14:31:42 +02005137
5138/**
5139 * wiphy_register - register a wiphy with cfg80211
5140 *
5141 * @wiphy: The wiphy to register.
5142 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005143 * Return: A non-negative wiphy index or a negative error code.
Johannes Bergd3236552009-04-20 14:31:42 +02005144 */
Joe Perches10dd9b72013-07-31 17:31:37 -07005145int wiphy_register(struct wiphy *wiphy);
Johannes Bergd3236552009-04-20 14:31:42 +02005146
5147/**
5148 * wiphy_unregister - deregister a wiphy from cfg80211
5149 *
5150 * @wiphy: The wiphy to unregister.
5151 *
5152 * After this call, no more requests can be made with this priv
5153 * pointer, but the call may sleep to wait for an outstanding
5154 * request that is being handled.
5155 */
Joe Perches10dd9b72013-07-31 17:31:37 -07005156void wiphy_unregister(struct wiphy *wiphy);
Johannes Bergd3236552009-04-20 14:31:42 +02005157
5158/**
5159 * wiphy_free - free wiphy
5160 *
5161 * @wiphy: The wiphy to free
5162 */
Joe Perches10dd9b72013-07-31 17:31:37 -07005163void wiphy_free(struct wiphy *wiphy);
Johannes Bergd3236552009-04-20 14:31:42 +02005164
Johannes Bergfffd0932009-07-08 14:22:54 +02005165/* internal structs */
Johannes Berg6829c872009-07-02 09:13:27 +02005166struct cfg80211_conn;
Johannes Berg19957bb2009-07-02 17:20:43 +02005167struct cfg80211_internal_bss;
Johannes Bergfffd0932009-07-08 14:22:54 +02005168struct cfg80211_cached_keys;
Andrew Zaborowski4a4b8162017-02-10 10:02:31 +01005169struct cfg80211_cqm_config;
Johannes Berg19957bb2009-07-02 17:20:43 +02005170
Johannes Bergd3236552009-04-20 14:31:42 +02005171/**
Johannes Berg89a54e42012-06-15 14:33:17 +02005172 * struct wireless_dev - wireless device state
Johannes Bergd3236552009-04-20 14:31:42 +02005173 *
Johannes Berg89a54e42012-06-15 14:33:17 +02005174 * For netdevs, this structure must be allocated by the driver
5175 * that uses the ieee80211_ptr field in struct net_device (this
5176 * is intentional so it can be allocated along with the netdev.)
5177 * It need not be registered then as netdev registration will
5178 * be intercepted by cfg80211 to see the new wireless device.
5179 *
5180 * For non-netdev uses, it must also be allocated by the driver
5181 * in response to the cfg80211 callbacks that require it, as
5182 * there's no netdev registration in that case it may not be
5183 * allocated outside of callback operations that return it.
Johannes Bergd3236552009-04-20 14:31:42 +02005184 *
5185 * @wiphy: pointer to hardware description
5186 * @iftype: interface type
5187 * @list: (private) Used to collect the interfaces
Johannes Berg89a54e42012-06-15 14:33:17 +02005188 * @netdev: (private) Used to reference back to the netdev, may be %NULL
5189 * @identifier: (private) Identifier used in nl80211 to identify this
5190 * wireless device if it has no netdev
Johannes Bergd3236552009-04-20 14:31:42 +02005191 * @current_bss: (private) Used by the internal configuration code
Michal Kazior9e0e2962014-01-29 14:22:27 +01005192 * @chandef: (private) Used by the internal configuration code to track
5193 * the user-set channel definition.
Johannes Berg780b40d2013-06-05 09:32:50 +02005194 * @preset_chandef: (private) Used by the internal configuration code to
Johannes Bergaa430da2012-05-16 23:50:18 +02005195 * track the channel to be used for AP later
Johannes Bergd3236552009-04-20 14:31:42 +02005196 * @bssid: (private) Used by the internal configuration code
5197 * @ssid: (private) Used by the internal configuration code
5198 * @ssid_len: (private) Used by the internal configuration code
Johannes Berg29cbe682010-12-03 09:20:44 +01005199 * @mesh_id_len: (private) Used by the internal configuration code
5200 * @mesh_id_up_len: (private) Used by the internal configuration code
Johannes Bergd3236552009-04-20 14:31:42 +02005201 * @wext: (private) Used by the internal wireless extensions compat code
Johannes Berg9874b712019-02-01 11:52:44 +01005202 * @wext.ibss: (private) IBSS data part of wext handling
5203 * @wext.connect: (private) connection handling data
5204 * @wext.keys: (private) (WEP) key data
5205 * @wext.ie: (private) extra elements for association
5206 * @wext.ie_len: (private) length of extra elements
5207 * @wext.bssid: (private) selected network BSSID
5208 * @wext.ssid: (private) selected network SSID
5209 * @wext.default_key: (private) selected default key index
5210 * @wext.default_mgmt_key: (private) selected default management key index
5211 * @wext.prev_bssid: (private) previous BSSID for reassociation
5212 * @wext.prev_bssid_valid: (private) previous BSSID validity
Johannes Berg9bc383d2009-11-19 11:55:19 +01005213 * @use_4addr: indicates 4addr mode is used on this interface, must be
5214 * set by driver (if supported) on add_interface BEFORE registering the
5215 * netdev and may otherwise be used by driver read-only, will be update
5216 * by cfg80211 on change_interface
Johannes Berg2e161f782010-08-12 15:38:38 +02005217 * @mgmt_registrations: list of registrations for management frames
5218 * @mgmt_registrations_lock: lock for the list
Johannes Berg79ea1e122020-06-04 12:04:20 +02005219 * @mgmt_registrations_need_update: mgmt registrations were updated,
5220 * need to propagate the update to the driver
Johannes Berg8d61ffa2013-05-10 12:32:47 +02005221 * @mtx: mutex used to lock data in this struct, may be used by drivers
5222 * and some API functions require it held
Johannes Berg56d18932011-05-09 18:41:15 +02005223 * @beacon_interval: beacon interval used on this device for transmitting
5224 * beacons, 0 when not valid
Johannes Berg98104fde2012-06-16 00:19:54 +02005225 * @address: The address for this device, valid only if @netdev is %NULL
Arend Van Spriel73c7da32016-10-20 20:08:22 +01005226 * @is_running: true if this is a non-netdev device that has been started, e.g.
5227 * the P2P Device.
Simon Wunderlich04f39042013-02-08 18:16:19 +01005228 * @cac_started: true if DFS channel availability check has been started
5229 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
Janusz Dziedzic31559f32014-02-21 19:46:13 +01005230 * @cac_time_ms: CAC time in ms
Johannes Berg780b40d2013-06-05 09:32:50 +02005231 * @ps: powersave mode is enabled
5232 * @ps_timeout: dynamic powersave timeout
5233 * @ap_unexpected_nlportid: (private) netlink port ID of application
5234 * registered for unexpected class 3 frames (AP mode)
5235 * @conn: (private) cfg80211 software SME connection state machine data
5236 * @connect_keys: (private) keys to set after connection is established
Lior David34d50512016-01-28 10:58:25 +02005237 * @conn_bss_type: connecting/connected BSS type
Andrzej Zaborowskibd2522b2017-01-06 16:33:43 -05005238 * @conn_owner_nlportid: (private) connection owner socket port ID
5239 * @disconnect_wk: (private) auto-disconnect work
5240 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
Johannes Berg780b40d2013-06-05 09:32:50 +02005241 * @ibss_fixed: (private) IBSS is using fixed BSSID
Simon Wunderlich5336fa82013-10-07 18:41:05 +02005242 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
Johannes Berg780b40d2013-06-05 09:32:50 +02005243 * @event_list: (private) list for internal event processing
5244 * @event_lock: (private) lock for event list
Johannes Berg78f22b62014-03-24 17:57:27 +01005245 * @owner_nlportid: (private) owner socket port ID
Johannes Bergab810072017-04-26 07:43:41 +02005246 * @nl_owner_dead: (private) owner socket went away
Andrew Zaborowski4a4b8162017-02-10 10:02:31 +01005247 * @cqm_config: (private) nl80211 RSSI monitor state
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02005248 * @pmsr_list: (private) peer measurement requests
5249 * @pmsr_lock: (private) peer measurements requests/results lock
5250 * @pmsr_free_wk: (private) peer measurements cleanup work
Jouni Malinen4d797fc2020-04-01 17:25:47 +03005251 * @unprot_beacon_reported: (private) timestamp of last
5252 * unprotected beacon report
Johannes Bergd3236552009-04-20 14:31:42 +02005253 */
5254struct wireless_dev {
5255 struct wiphy *wiphy;
5256 enum nl80211_iftype iftype;
5257
Johannes Berg667503d2009-07-07 03:56:11 +02005258 /* the remainder of this struct should be private to cfg80211 */
Johannes Bergd3236552009-04-20 14:31:42 +02005259 struct list_head list;
5260 struct net_device *netdev;
5261
Johannes Berg89a54e42012-06-15 14:33:17 +02005262 u32 identifier;
5263
Johannes Berg2e161f782010-08-12 15:38:38 +02005264 struct list_head mgmt_registrations;
5265 spinlock_t mgmt_registrations_lock;
Johannes Berg79ea1e122020-06-04 12:04:20 +02005266 u8 mgmt_registrations_need_update:1;
Jouni Malinen026331c2010-02-15 12:53:10 +02005267
Johannes Berg667503d2009-07-07 03:56:11 +02005268 struct mutex mtx;
5269
Arend Van Spriel73c7da32016-10-20 20:08:22 +01005270 bool use_4addr, is_running;
Johannes Berg98104fde2012-06-16 00:19:54 +02005271
5272 u8 address[ETH_ALEN] __aligned(sizeof(u16));
Johannes Berg9bc383d2009-11-19 11:55:19 +01005273
Samuel Ortizb23aa672009-07-01 21:26:54 +02005274 /* currently used for IBSS and SME - might be rearranged later */
Johannes Bergd3236552009-04-20 14:31:42 +02005275 u8 ssid[IEEE80211_MAX_SSID_LEN];
Johannes Berg29cbe682010-12-03 09:20:44 +01005276 u8 ssid_len, mesh_id_len, mesh_id_up_len;
Johannes Berg6829c872009-07-02 09:13:27 +02005277 struct cfg80211_conn *conn;
Johannes Bergfffd0932009-07-08 14:22:54 +02005278 struct cfg80211_cached_keys *connect_keys;
Lior David34d50512016-01-28 10:58:25 +02005279 enum ieee80211_bss_type conn_bss_type;
Andrzej Zaborowskibd2522b2017-01-06 16:33:43 -05005280 u32 conn_owner_nlportid;
5281
5282 struct work_struct disconnect_wk;
5283 u8 disconnect_bssid[ETH_ALEN];
Johannes Bergd3236552009-04-20 14:31:42 +02005284
Johannes Berg667503d2009-07-07 03:56:11 +02005285 struct list_head event_list;
5286 spinlock_t event_lock;
5287
Johannes Berg19957bb2009-07-02 17:20:43 +02005288 struct cfg80211_internal_bss *current_bss; /* associated / joined */
Johannes Berg683b6d32012-11-08 21:25:48 +01005289 struct cfg80211_chan_def preset_chandef;
Michal Kazior9e0e2962014-01-29 14:22:27 +01005290 struct cfg80211_chan_def chandef;
Michal Kaziorf4489eb2012-06-29 12:46:58 +02005291
Michal Kaziorc30a3d32012-06-29 12:46:59 +02005292 bool ibss_fixed;
Simon Wunderlich5336fa82013-10-07 18:41:05 +02005293 bool ibss_dfs_possible;
Michal Kaziorc30a3d32012-06-29 12:46:59 +02005294
Kalle Valoffb9eb32010-02-17 17:58:10 +02005295 bool ps;
5296 int ps_timeout;
5297
Johannes Berg56d18932011-05-09 18:41:15 +02005298 int beacon_interval;
5299
Eric W. Biederman15e47302012-09-07 20:12:54 +00005300 u32 ap_unexpected_nlportid;
Johannes Berg28946da2011-11-04 11:18:12 +01005301
Johannes Bergab810072017-04-26 07:43:41 +02005302 u32 owner_nlportid;
5303 bool nl_owner_dead;
5304
Simon Wunderlich04f39042013-02-08 18:16:19 +01005305 bool cac_started;
5306 unsigned long cac_start_time;
Janusz Dziedzic31559f32014-02-21 19:46:13 +01005307 unsigned int cac_time_ms;
Simon Wunderlich04f39042013-02-08 18:16:19 +01005308
Johannes Berg3d23e342009-09-29 23:27:28 +02005309#ifdef CONFIG_CFG80211_WEXT
Johannes Bergd3236552009-04-20 14:31:42 +02005310 /* wext data */
Johannes Bergcbe8fa92009-05-09 20:09:03 +02005311 struct {
Johannes Bergc238c8a2009-07-07 03:56:06 +02005312 struct cfg80211_ibss_params ibss;
5313 struct cfg80211_connect_params connect;
Johannes Bergfffd0932009-07-08 14:22:54 +02005314 struct cfg80211_cached_keys *keys;
Johannes Bergc1e5f472014-05-19 17:53:16 +02005315 const u8 *ie;
Johannes Bergf2129352009-07-01 21:26:56 +02005316 size_t ie_len;
Johannes Berg9874b712019-02-01 11:52:44 +01005317 u8 bssid[ETH_ALEN];
5318 u8 prev_bssid[ETH_ALEN];
Johannes Bergf2129352009-07-01 21:26:56 +02005319 u8 ssid[IEEE80211_MAX_SSID_LEN];
Johannes Berg08645122009-05-11 13:54:58 +02005320 s8 default_key, default_mgmt_key;
Kalle Valoffb9eb32010-02-17 17:58:10 +02005321 bool prev_bssid_valid;
Johannes Bergcbe8fa92009-05-09 20:09:03 +02005322 } wext;
Johannes Bergd3236552009-04-20 14:31:42 +02005323#endif
Andrew Zaborowski4a4b8162017-02-10 10:02:31 +01005324
5325 struct cfg80211_cqm_config *cqm_config;
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02005326
5327 struct list_head pmsr_list;
5328 spinlock_t pmsr_lock;
5329 struct work_struct pmsr_free_wk;
Jouni Malinen4d797fc2020-04-01 17:25:47 +03005330
5331 unsigned long unprot_beacon_reported;
Johannes Bergd3236552009-04-20 14:31:42 +02005332};
5333
Johannes Berg98104fde2012-06-16 00:19:54 +02005334static inline u8 *wdev_address(struct wireless_dev *wdev)
5335{
5336 if (wdev->netdev)
5337 return wdev->netdev->dev_addr;
5338 return wdev->address;
5339}
5340
Arend Van Spriel73c7da32016-10-20 20:08:22 +01005341static inline bool wdev_running(struct wireless_dev *wdev)
5342{
5343 if (wdev->netdev)
5344 return netif_running(wdev->netdev);
5345 return wdev->is_running;
5346}
5347
Johannes Bergd3236552009-04-20 14:31:42 +02005348/**
5349 * wdev_priv - return wiphy priv from wireless_dev
5350 *
5351 * @wdev: The wireless device whose wiphy's priv pointer to return
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005352 * Return: The wiphy priv of @wdev.
Johannes Bergd3236552009-04-20 14:31:42 +02005353 */
5354static inline void *wdev_priv(struct wireless_dev *wdev)
5355{
5356 BUG_ON(!wdev);
5357 return wiphy_priv(wdev->wiphy);
5358}
5359
Johannes Bergd70e9692010-08-19 16:11:27 +02005360/**
5361 * DOC: Utility functions
5362 *
5363 * cfg80211 offers a number of utility functions that can be useful.
Johannes Bergd3236552009-04-20 14:31:42 +02005364 */
5365
5366/**
Thomas Pedersen934f4c72020-04-01 18:18:03 -07005367 * ieee80211_channel_equal - compare two struct ieee80211_channel
5368 *
5369 * @a: 1st struct ieee80211_channel
5370 * @b: 2nd struct ieee80211_channel
5371 * Return: true if center frequency of @a == @b
5372 */
5373static inline bool
5374ieee80211_channel_equal(struct ieee80211_channel *a,
5375 struct ieee80211_channel *b)
5376{
5377 return (a->center_freq == b->center_freq &&
5378 a->freq_offset == b->freq_offset);
5379}
5380
5381/**
5382 * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5383 * @chan: struct ieee80211_channel to convert
5384 * Return: The corresponding frequency (in KHz)
5385 */
5386static inline u32
5387ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5388{
5389 return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5390}
5391
5392/**
Thomas Pedersen11b34732020-09-08 12:03:06 -07005393 * ieee80211_s1g_channel_width - get allowed channel width from @chan
5394 *
5395 * Only allowed for band NL80211_BAND_S1GHZ
5396 * @chan: channel
5397 * Return: The allowed channel width for this center_freq
5398 */
5399enum nl80211_chan_width
5400ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
5401
5402/**
Thomas Pedersen934f4c72020-04-01 18:18:03 -07005403 * ieee80211_channel_to_freq_khz - convert channel number to frequency
5404 * @chan: channel number
5405 * @band: band, necessary due to channel number overlap
5406 * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5407 */
5408u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5409
5410/**
Johannes Bergd3236552009-04-20 14:31:42 +02005411 * ieee80211_channel_to_frequency - convert channel number to frequency
Johannes Bergabe37c42010-06-07 11:12:27 +02005412 * @chan: channel number
Bruno Randolf59eb21a2011-01-17 13:37:28 +09005413 * @band: band, necessary due to channel number overlap
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005414 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
Johannes Bergd3236552009-04-20 14:31:42 +02005415 */
Thomas Pedersen934f4c72020-04-01 18:18:03 -07005416static inline int
5417ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5418{
5419 return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5420}
5421
5422/**
5423 * ieee80211_freq_khz_to_channel - convert frequency to channel number
5424 * @freq: center frequency in KHz
5425 * Return: The corresponding channel, or 0 if the conversion failed.
5426 */
5427int ieee80211_freq_khz_to_channel(u32 freq);
Johannes Bergd3236552009-04-20 14:31:42 +02005428
5429/**
5430 * ieee80211_frequency_to_channel - convert frequency to channel number
Thomas Pedersen934f4c72020-04-01 18:18:03 -07005431 * @freq: center frequency in MHz
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005432 * Return: The corresponding channel, or 0 if the conversion failed.
Johannes Bergd3236552009-04-20 14:31:42 +02005433 */
Thomas Pedersen934f4c72020-04-01 18:18:03 -07005434static inline int
5435ieee80211_frequency_to_channel(int freq)
5436{
5437 return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5438}
5439
5440/**
5441 * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5442 * frequency
5443 * @wiphy: the struct wiphy to get the channel for
5444 * @freq: the center frequency (in KHz) of the channel
5445 * Return: The channel struct from @wiphy at @freq.
5446 */
5447struct ieee80211_channel *
5448ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
Johannes Bergd3236552009-04-20 14:31:42 +02005449
Johannes Bergd3236552009-04-20 14:31:42 +02005450/**
5451 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
Arend Van Spriel543b9212016-11-17 12:48:53 +00005452 *
Johannes Bergabe37c42010-06-07 11:12:27 +02005453 * @wiphy: the struct wiphy to get the channel for
Thomas Pedersen934f4c72020-04-01 18:18:03 -07005454 * @freq: the center frequency (in MHz) of the channel
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005455 * Return: The channel struct from @wiphy at @freq.
Johannes Bergd3236552009-04-20 14:31:42 +02005456 */
Thomas Pedersen934f4c72020-04-01 18:18:03 -07005457static inline struct ieee80211_channel *
5458ieee80211_get_channel(struct wiphy *wiphy, int freq)
5459{
5460 return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5461}
Johannes Bergd3236552009-04-20 14:31:42 +02005462
5463/**
Johannes Bergafbc9c92020-05-28 21:34:25 +02005464 * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5465 * @chan: control channel to check
5466 *
5467 * The Preferred Scanning Channels (PSC) are defined in
5468 * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5469 */
5470static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5471{
5472 if (chan->band != NL80211_BAND_6GHZ)
5473 return false;
5474
5475 return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5476}
5477
5478/**
Johannes Bergd3236552009-04-20 14:31:42 +02005479 * ieee80211_get_response_rate - get basic rate for a given rate
5480 *
5481 * @sband: the band to look for rates in
5482 * @basic_rates: bitmap of basic rates
5483 * @bitrate: the bitrate for which to find the basic rate
5484 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005485 * Return: The basic rate corresponding to a given bitrate, that
5486 * is the next lower bitrate contained in the basic rate map,
5487 * which is, for this function, given as a bitmap of indices of
5488 * rates in the band's bitrate table.
Johannes Bergd3236552009-04-20 14:31:42 +02005489 */
5490struct ieee80211_rate *
5491ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5492 u32 basic_rates, int bitrate);
5493
Ashok Nagarajanb422c6c2013-05-10 17:50:51 -07005494/**
5495 * ieee80211_mandatory_rates - get mandatory rates for a given band
5496 * @sband: the band to look for rates in
Simon Wunderlich74608ac2013-07-08 16:55:54 +02005497 * @scan_width: width of the control channel
Ashok Nagarajanb422c6c2013-05-10 17:50:51 -07005498 *
5499 * This function returns a bitmap of the mandatory rates for the given
5500 * band, bits are set according to the rate position in the bitrates array.
5501 */
Simon Wunderlich74608ac2013-07-08 16:55:54 +02005502u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
5503 enum nl80211_bss_scan_width scan_width);
Ashok Nagarajanb422c6c2013-05-10 17:50:51 -07005504
Johannes Bergd3236552009-04-20 14:31:42 +02005505/*
5506 * Radiotap parsing functions -- for controlled injection support
5507 *
5508 * Implemented in net/wireless/radiotap.c
Mauro Carvalho Chehab66d495d2020-04-30 18:04:17 +02005509 * Documentation in Documentation/networking/radiotap-headers.rst
Johannes Bergd3236552009-04-20 14:31:42 +02005510 */
5511
Johannes Berg33e5a2f2010-02-03 10:24:30 +01005512struct radiotap_align_size {
5513 uint8_t align:4, size:4;
5514};
5515
5516struct ieee80211_radiotap_namespace {
5517 const struct radiotap_align_size *align_size;
5518 int n_bits;
5519 uint32_t oui;
5520 uint8_t subns;
5521};
5522
5523struct ieee80211_radiotap_vendor_namespaces {
5524 const struct ieee80211_radiotap_namespace *ns;
5525 int n_ns;
5526};
5527
Johannes Bergd3236552009-04-20 14:31:42 +02005528/**
5529 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
Johannes Berg33e5a2f2010-02-03 10:24:30 +01005530 * @this_arg_index: index of current arg, valid after each successful call
5531 * to ieee80211_radiotap_iterator_next()
5532 * @this_arg: pointer to current radiotap arg; it is valid after each
5533 * call to ieee80211_radiotap_iterator_next() but also after
5534 * ieee80211_radiotap_iterator_init() where it will point to
5535 * the beginning of the actual data portion
5536 * @this_arg_size: length of the current arg, for convenience
5537 * @current_namespace: pointer to the current namespace definition
5538 * (or internally %NULL if the current namespace is unknown)
5539 * @is_radiotap_ns: indicates whether the current namespace is the default
5540 * radiotap namespace or not
5541 *
Johannes Berg33e5a2f2010-02-03 10:24:30 +01005542 * @_rtheader: pointer to the radiotap header we are walking through
5543 * @_max_length: length of radiotap header in cpu byte ordering
5544 * @_arg_index: next argument index
5545 * @_arg: next argument pointer
5546 * @_next_bitmap: internal pointer to next present u32
5547 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
5548 * @_vns: vendor namespace definitions
5549 * @_next_ns_data: beginning of the next namespace's data
5550 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
5551 * next bitmap word
5552 *
5553 * Describes the radiotap parser state. Fields prefixed with an underscore
5554 * must not be used by users of the parser, only by the parser internally.
Johannes Bergd3236552009-04-20 14:31:42 +02005555 */
5556
5557struct ieee80211_radiotap_iterator {
Johannes Berg33e5a2f2010-02-03 10:24:30 +01005558 struct ieee80211_radiotap_header *_rtheader;
5559 const struct ieee80211_radiotap_vendor_namespaces *_vns;
5560 const struct ieee80211_radiotap_namespace *current_namespace;
Johannes Bergd3236552009-04-20 14:31:42 +02005561
Johannes Berg33e5a2f2010-02-03 10:24:30 +01005562 unsigned char *_arg, *_next_ns_data;
Johannes Berg67272442010-04-21 10:25:36 +02005563 __le32 *_next_bitmap;
Johannes Berg33e5a2f2010-02-03 10:24:30 +01005564
5565 unsigned char *this_arg;
5566 int this_arg_index;
5567 int this_arg_size;
5568
5569 int is_radiotap_ns;
5570
5571 int _max_length;
5572 int _arg_index;
5573 uint32_t _bitmap_shifter;
5574 int _reset_on_ext;
Johannes Bergd3236552009-04-20 14:31:42 +02005575};
5576
Joe Perches10dd9b72013-07-31 17:31:37 -07005577int
5578ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5579 struct ieee80211_radiotap_header *radiotap_header,
5580 int max_length,
5581 const struct ieee80211_radiotap_vendor_namespaces *vns);
Johannes Bergd3236552009-04-20 14:31:42 +02005582
Joe Perches10dd9b72013-07-31 17:31:37 -07005583int
5584ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
Johannes Berg33e5a2f2010-02-03 10:24:30 +01005585
Johannes Bergd3236552009-04-20 14:31:42 +02005586
Zhu Yie31a16d2009-05-21 21:47:03 +08005587extern const unsigned char rfc1042_header[6];
5588extern const unsigned char bridge_tunnel_header[6];
5589
5590/**
5591 * ieee80211_get_hdrlen_from_skb - get header length from data
5592 *
Zhu Yie31a16d2009-05-21 21:47:03 +08005593 * @skb: the frame
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005594 *
5595 * Given an skb with a raw 802.11 header at the data pointer this function
5596 * returns the 802.11 header length.
5597 *
5598 * Return: The 802.11 header length in bytes (not including encryption
5599 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
5600 * 802.11 header.
Zhu Yie31a16d2009-05-21 21:47:03 +08005601 */
5602unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5603
5604/**
5605 * ieee80211_hdrlen - get header length in bytes from frame control
5606 * @fc: frame control field in little-endian format
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005607 * Return: The header length in bytes.
Zhu Yie31a16d2009-05-21 21:47:03 +08005608 */
Johannes Berg633adf12010-08-12 14:49:58 +02005609unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
Zhu Yie31a16d2009-05-21 21:47:03 +08005610
5611/**
Johannes Berg9b395bc2012-10-26 00:36:40 +02005612 * ieee80211_get_mesh_hdrlen - get mesh extension header length
5613 * @meshhdr: the mesh extension header, only the flags field
5614 * (first byte) will be accessed
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005615 * Return: The length of the extension header, which is always at
Johannes Berg9b395bc2012-10-26 00:36:40 +02005616 * least 6 bytes and at most 18 if address 5 and 6 are present.
5617 */
5618unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
5619
5620/**
Johannes Bergd70e9692010-08-19 16:11:27 +02005621 * DOC: Data path helpers
5622 *
5623 * In addition to generic utilities, cfg80211 also offers
5624 * functions that help implement the data path for devices
5625 * that do not do the 802.11/802.3 conversion on the device.
5626 */
5627
5628/**
Johannes Berg7f6990c2016-10-05 15:29:49 +02005629 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
5630 * @skb: the 802.11 data frame
5631 * @ehdr: pointer to a &struct ethhdr that will get the header, instead
5632 * of it being pushed into the SKB
5633 * @addr: the device MAC address
5634 * @iftype: the virtual interface type
Felix Fietkau24bba072018-02-27 13:03:07 +01005635 * @data_offset: offset of payload after the 802.11 header
Johannes Berg7f6990c2016-10-05 15:29:49 +02005636 * Return: 0 on success. Non-zero on error.
5637 */
5638int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
Felix Fietkau24bba072018-02-27 13:03:07 +01005639 const u8 *addr, enum nl80211_iftype iftype,
5640 u8 data_offset);
Johannes Berg7f6990c2016-10-05 15:29:49 +02005641
5642/**
Zhu Yie31a16d2009-05-21 21:47:03 +08005643 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5644 * @skb: the 802.11 data frame
5645 * @addr: the device MAC address
5646 * @iftype: the virtual interface type
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005647 * Return: 0 on success. Non-zero on error.
Zhu Yie31a16d2009-05-21 21:47:03 +08005648 */
Johannes Berg7f6990c2016-10-05 15:29:49 +02005649static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
5650 enum nl80211_iftype iftype)
5651{
Felix Fietkau24bba072018-02-27 13:03:07 +01005652 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
Johannes Berg7f6990c2016-10-05 15:29:49 +02005653}
Zhu Yie31a16d2009-05-21 21:47:03 +08005654
5655/**
Zhu Yieaf85ca2009-12-01 10:18:37 +08005656 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5657 *
Johannes Berg7f6990c2016-10-05 15:29:49 +02005658 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
5659 * The @list will be empty if the decode fails. The @skb must be fully
5660 * header-less before being passed in here; it is freed in this function.
Zhu Yieaf85ca2009-12-01 10:18:37 +08005661 *
Johannes Berg7f6990c2016-10-05 15:29:49 +02005662 * @skb: The input A-MSDU frame without any headers.
Zhu Yieaf85ca2009-12-01 10:18:37 +08005663 * @list: The output list of 802.3 frames. It must be allocated and
Randy Dunlap085a6c12020-07-15 09:43:23 -07005664 * initialized by the caller.
Zhu Yieaf85ca2009-12-01 10:18:37 +08005665 * @addr: The device MAC address.
5666 * @iftype: The device interface type.
5667 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
Johannes Berg8b935ee2016-10-05 16:17:01 +02005668 * @check_da: DA to check in the inner ethernet header, or NULL
5669 * @check_sa: SA to check in the inner ethernet header, or NULL
Zhu Yieaf85ca2009-12-01 10:18:37 +08005670 */
5671void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5672 const u8 *addr, enum nl80211_iftype iftype,
Yogesh Ashok Powar8b3beca2011-05-13 11:22:31 -07005673 const unsigned int extra_headroom,
Johannes Berg8b935ee2016-10-05 16:17:01 +02005674 const u8 *check_da, const u8 *check_sa);
Zhu Yieaf85ca2009-12-01 10:18:37 +08005675
5676/**
Zhu Yie31a16d2009-05-21 21:47:03 +08005677 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5678 * @skb: the data frame
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08005679 * @qos_map: Interworking QoS mapping or %NULL if not in use
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005680 * Return: The 802.1p/1d tag.
Zhu Yie31a16d2009-05-21 21:47:03 +08005681 */
Kyeyoon Parkfa9ffc72013-12-16 23:01:30 -08005682unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5683 struct cfg80211_qos_map *qos_map);
Zhu Yie31a16d2009-05-21 21:47:03 +08005684
Johannes Bergc21dbf92010-01-26 14:15:46 +01005685/**
Johannes Berg49a68e02019-02-07 23:26:38 +01005686 * cfg80211_find_elem_match - match information element and byte array in data
5687 *
5688 * @eid: element ID
5689 * @ies: data consisting of IEs
5690 * @len: length of data
5691 * @match: byte array to match
5692 * @match_len: number of bytes in the match array
5693 * @match_offset: offset in the IE data where the byte array should match.
5694 * Note the difference to cfg80211_find_ie_match() which considers
5695 * the offset to start from the element ID byte, but here we take
5696 * the data portion instead.
5697 *
5698 * Return: %NULL if the element ID could not be found or if
5699 * the element is invalid (claims to be longer than the given
5700 * data) or if the byte array doesn't match; otherwise return the
5701 * requested element struct.
5702 *
5703 * Note: There are no checks on the element length other than
5704 * having to fit into the given data and being large enough for the
5705 * byte array to match.
5706 */
5707const struct element *
5708cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
5709 const u8 *match, unsigned int match_len,
5710 unsigned int match_offset);
5711
5712/**
Luca Coelhofbd05e42016-09-15 18:15:09 +03005713 * cfg80211_find_ie_match - match information element and byte array in data
5714 *
5715 * @eid: element ID
5716 * @ies: data consisting of IEs
5717 * @len: length of data
5718 * @match: byte array to match
5719 * @match_len: number of bytes in the match array
5720 * @match_offset: offset in the IE where the byte array should match.
5721 * If match_len is zero, this must also be set to zero.
5722 * Otherwise this must be set to 2 or more, because the first
5723 * byte is the element id, which is already compared to eid, and
5724 * the second byte is the IE length.
5725 *
5726 * Return: %NULL if the element ID could not be found or if
5727 * the element is invalid (claims to be longer than the given
5728 * data) or if the byte array doesn't match, or a pointer to the first
5729 * byte of the requested element, that is the byte containing the
5730 * element ID.
5731 *
5732 * Note: There are no checks on the element length other than
5733 * having to fit into the given data and being large enough for the
5734 * byte array to match.
5735 */
Johannes Berg49a68e02019-02-07 23:26:38 +01005736static inline const u8 *
5737cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
5738 const u8 *match, unsigned int match_len,
5739 unsigned int match_offset)
5740{
5741 /* match_offset can't be smaller than 2, unless match_len is
5742 * zero, in which case match_offset must be zero as well.
5743 */
5744 if (WARN_ON((match_len && match_offset < 2) ||
5745 (!match_len && match_offset)))
5746 return NULL;
5747
5748 return (void *)cfg80211_find_elem_match(eid, ies, len,
5749 match, match_len,
5750 match_offset ?
5751 match_offset - 2 : 0);
5752}
5753
5754/**
5755 * cfg80211_find_elem - find information element in data
5756 *
5757 * @eid: element ID
5758 * @ies: data consisting of IEs
5759 * @len: length of data
5760 *
5761 * Return: %NULL if the element ID could not be found or if
5762 * the element is invalid (claims to be longer than the given
5763 * data) or if the byte array doesn't match; otherwise return the
5764 * requested element struct.
5765 *
5766 * Note: There are no checks on the element length other than
5767 * having to fit into the given data.
5768 */
5769static inline const struct element *
5770cfg80211_find_elem(u8 eid, const u8 *ies, int len)
5771{
5772 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
5773}
Luca Coelhofbd05e42016-09-15 18:15:09 +03005774
5775/**
Johannes Bergc21dbf92010-01-26 14:15:46 +01005776 * cfg80211_find_ie - find information element in data
5777 *
5778 * @eid: element ID
5779 * @ies: data consisting of IEs
5780 * @len: length of data
5781 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005782 * Return: %NULL if the element ID could not be found or if
5783 * the element is invalid (claims to be longer than the given
5784 * data), or a pointer to the first byte of the requested
5785 * element, that is the byte containing the element ID.
5786 *
5787 * Note: There are no checks on the element length other than
5788 * having to fit into the given data.
Johannes Bergc21dbf92010-01-26 14:15:46 +01005789 */
Luca Coelhofbd05e42016-09-15 18:15:09 +03005790static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5791{
5792 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5793}
Johannes Bergc21dbf92010-01-26 14:15:46 +01005794
Johannes Bergd70e9692010-08-19 16:11:27 +02005795/**
Johannes Berg49a68e02019-02-07 23:26:38 +01005796 * cfg80211_find_ext_elem - find information element with EID Extension in data
5797 *
5798 * @ext_eid: element ID Extension
5799 * @ies: data consisting of IEs
5800 * @len: length of data
5801 *
5802 * Return: %NULL if the etended element could not be found or if
5803 * the element is invalid (claims to be longer than the given
5804 * data) or if the byte array doesn't match; otherwise return the
5805 * requested element struct.
5806 *
5807 * Note: There are no checks on the element length other than
5808 * having to fit into the given data.
5809 */
5810static inline const struct element *
5811cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
5812{
5813 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
5814 &ext_eid, 1, 0);
5815}
5816
5817/**
Jouni Malinen3f817fe2016-10-27 00:42:01 +03005818 * cfg80211_find_ext_ie - find information element with EID Extension in data
5819 *
5820 * @ext_eid: element ID Extension
5821 * @ies: data consisting of IEs
5822 * @len: length of data
5823 *
5824 * Return: %NULL if the extended element ID could not be found or if
5825 * the element is invalid (claims to be longer than the given
5826 * data), or a pointer to the first byte of the requested
5827 * element, that is the byte containing the element ID.
5828 *
5829 * Note: There are no checks on the element length other than
5830 * having to fit into the given data.
5831 */
5832static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
5833{
5834 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
5835 &ext_eid, 1, 2);
5836}
5837
5838/**
Johannes Berg49a68e02019-02-07 23:26:38 +01005839 * cfg80211_find_vendor_elem - find vendor specific information element in data
5840 *
5841 * @oui: vendor OUI
5842 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5843 * @ies: data consisting of IEs
5844 * @len: length of data
5845 *
5846 * Return: %NULL if the vendor specific element ID could not be found or if the
5847 * element is invalid (claims to be longer than the given data); otherwise
5848 * return the element structure for the requested element.
5849 *
5850 * Note: There are no checks on the element length other than having to fit into
5851 * the given data.
5852 */
5853const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
5854 const u8 *ies,
5855 unsigned int len);
5856
5857/**
Eliad Peller0c28ec52011-09-15 11:53:01 +03005858 * cfg80211_find_vendor_ie - find vendor specific information element in data
5859 *
5860 * @oui: vendor OUI
Emmanuel Grumbach9e9ea432016-05-03 16:08:07 +03005861 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
Eliad Peller0c28ec52011-09-15 11:53:01 +03005862 * @ies: data consisting of IEs
5863 * @len: length of data
5864 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005865 * Return: %NULL if the vendor specific element ID could not be found or if the
5866 * element is invalid (claims to be longer than the given data), or a pointer to
5867 * the first byte of the requested element, that is the byte containing the
5868 * element ID.
5869 *
5870 * Note: There are no checks on the element length other than having to fit into
5871 * the given data.
Eliad Peller0c28ec52011-09-15 11:53:01 +03005872 */
Johannes Berg49a68e02019-02-07 23:26:38 +01005873static inline const u8 *
5874cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
5875 const u8 *ies, unsigned int len)
5876{
5877 return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
5878}
Eliad Peller0c28ec52011-09-15 11:53:01 +03005879
5880/**
Dedy Lansky30ca1aa2018-07-29 14:59:16 +03005881 * cfg80211_send_layer2_update - send layer 2 update frame
5882 *
5883 * @dev: network device
5884 * @addr: STA MAC address
5885 *
5886 * Wireless drivers can use this function to update forwarding tables in bridge
5887 * devices upon STA association.
5888 */
5889void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
5890
5891/**
Johannes Bergd70e9692010-08-19 16:11:27 +02005892 * DOC: Regulatory enforcement infrastructure
5893 *
5894 * TODO
Johannes Bergd3236552009-04-20 14:31:42 +02005895 */
5896
5897/**
5898 * regulatory_hint - driver hint to the wireless core a regulatory domain
5899 * @wiphy: the wireless device giving the hint (used only for reporting
5900 * conflicts)
5901 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
Jérôme Pouillercd9b52b2020-02-21 12:56:04 +01005902 * should be in. If @rd is set this should be NULL. Note that if you
5903 * set this to NULL you should still set rd->alpha2 to some accepted
5904 * alpha2.
Johannes Bergd3236552009-04-20 14:31:42 +02005905 *
5906 * Wireless drivers can use this function to hint to the wireless core
5907 * what it believes should be the current regulatory domain by
5908 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5909 * domain should be in or by providing a completely build regulatory domain.
5910 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5911 * for a regulatory domain structure for the respective country.
5912 *
5913 * The wiphy must have been registered to cfg80211 prior to this call.
5914 * For cfg80211 drivers this means you must first use wiphy_register(),
5915 * for mac80211 drivers you must first use ieee80211_register_hw().
5916 *
5917 * Drivers should check the return value, its possible you can get
5918 * an -ENOMEM.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005919 *
5920 * Return: 0 on success. -ENOMEM.
Johannes Bergd3236552009-04-20 14:31:42 +02005921 */
Joe Perches10dd9b72013-07-31 17:31:37 -07005922int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
Johannes Bergd3236552009-04-20 14:31:42 +02005923
5924/**
Jonathan Doronb0d7aa52014-12-15 19:26:00 +02005925 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5926 * @wiphy: the wireless device we want to process the regulatory domain on
5927 * @rd: the regulatory domain informatoin to use for this wiphy
5928 *
5929 * Set the regulatory domain information for self-managed wiphys, only they
5930 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5931 * information.
5932 *
5933 * Return: 0 on success. -EINVAL, -EPERM
5934 */
5935int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5936 struct ieee80211_regdomain *rd);
5937
5938/**
Arik Nemtsov2c3e8612015-01-07 16:47:19 +02005939 * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
5940 * @wiphy: the wireless device we want to process the regulatory domain on
5941 * @rd: the regulatory domain information to use for this wiphy
5942 *
5943 * This functions requires the RTNL to be held and applies the new regdomain
5944 * synchronously to this wiphy. For more details see
5945 * regulatory_set_wiphy_regd().
5946 *
5947 * Return: 0 on success. -EINVAL, -EPERM
5948 */
5949int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
5950 struct ieee80211_regdomain *rd);
5951
5952/**
Johannes Bergd3236552009-04-20 14:31:42 +02005953 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5954 * @wiphy: the wireless device we want to process the regulatory domain on
5955 * @regd: the custom regulatory domain to use for this wiphy
5956 *
5957 * Drivers can sometimes have custom regulatory domains which do not apply
5958 * to a specific country. Drivers can use this to apply such custom regulatory
5959 * domains. This routine must be called prior to wiphy registration. The
5960 * custom regulatory domain will be trusted completely and as such previous
5961 * default channel settings will be disregarded. If no rule is found for a
5962 * channel on the regulatory domain the channel will be disabled.
Luis R. Rodriguez222ea582013-11-05 09:18:00 -08005963 * Drivers using this for a wiphy should also set the wiphy flag
Kalle Valoce261512014-04-03 10:03:45 +03005964 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
Luis R. Rodriguez222ea582013-11-05 09:18:00 -08005965 * that called this helper.
Johannes Bergd3236552009-04-20 14:31:42 +02005966 */
Joe Perches10dd9b72013-07-31 17:31:37 -07005967void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5968 const struct ieee80211_regdomain *regd);
Johannes Bergd3236552009-04-20 14:31:42 +02005969
5970/**
5971 * freq_reg_info - get regulatory information for the given frequency
5972 * @wiphy: the wiphy for which we want to process this rule for
5973 * @center_freq: Frequency in KHz for which we want regulatory information for
Johannes Bergd3236552009-04-20 14:31:42 +02005974 *
5975 * Use this function to get the regulatory rule for a specific frequency on
5976 * a given wireless device. If the device has a specific regulatory domain
5977 * it wants to follow we respect that unless a country IE has been received
5978 * and processed already.
5979 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01005980 * Return: A valid pointer, or, when an error occurs, for example if no rule
5981 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
5982 * check and PTR_ERR() to obtain the numeric return value. The numeric return
5983 * value will be -ERANGE if we determine the given center_freq does not even
5984 * have a regulatory rule for a frequency range in the center_freq's band.
5985 * See freq_in_rule_band() for our current definition of a band -- this is
5986 * purely subjective and right now it's 802.11 specific.
Johannes Bergd3236552009-04-20 14:31:42 +02005987 */
Johannes Berg361c9c82012-12-06 15:57:14 +01005988const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5989 u32 center_freq);
Johannes Bergd3236552009-04-20 14:31:42 +02005990
Luis R. Rodriguez034c6d62013-10-14 17:42:06 -07005991/**
5992 * reg_initiator_name - map regulatory request initiator enum to name
5993 * @initiator: the regulatory request initiator
5994 *
5995 * You can use this to map the regulatory request initiator enum to a
5996 * proper string representation.
5997 */
5998const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5999
Haim Dreyfuss19d35772018-03-28 13:24:11 +03006000/**
Aaron Komisardc0c18e2019-10-02 13:59:07 +00006001 * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6002 * @wiphy: wiphy for which pre-CAC capability is checked.
6003 *
6004 * Pre-CAC is allowed only in some regdomains (notable ETSI).
6005 */
6006bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6007
6008/**
Haim Dreyfuss19d35772018-03-28 13:24:11 +03006009 * DOC: Internal regulatory db functions
6010 *
6011 */
6012
6013/**
6014 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
6015 * Regulatory self-managed driver can use it to proactively
6016 *
6017 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
6018 * @freq: the freqency(in MHz) to be queried.
Haim Dreyfuss19d35772018-03-28 13:24:11 +03006019 * @rule: pointer to store the wmm rule from the regulatory db.
6020 *
6021 * Self-managed wireless drivers can use this function to query
6022 * the internal regulatory database to check whether the given
6023 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
6024 *
6025 * Drivers should check the return value, its possible you can get
6026 * an -ENODATA.
6027 *
6028 * Return: 0 on success. -ENODATA.
6029 */
Stanislaw Gruszka38cb87e2018-08-22 13:52:21 +02006030int reg_query_regdb_wmm(char *alpha2, int freq,
6031 struct ieee80211_reg_rule *rule);
Haim Dreyfuss19d35772018-03-28 13:24:11 +03006032
Johannes Bergd3236552009-04-20 14:31:42 +02006033/*
Johannes Bergd3236552009-04-20 14:31:42 +02006034 * callbacks for asynchronous cfg80211 methods, notification
6035 * functions and BSS handling helpers
6036 */
6037
Johannes Berg2a519312009-02-10 21:25:55 +01006038/**
6039 * cfg80211_scan_done - notify that scan finished
6040 *
6041 * @request: the corresponding scan request
Avraham Stern1d762502016-07-05 17:10:13 +03006042 * @info: information about the completed scan
Johannes Berg2a519312009-02-10 21:25:55 +01006043 */
Avraham Stern1d762502016-07-05 17:10:13 +03006044void cfg80211_scan_done(struct cfg80211_scan_request *request,
6045 struct cfg80211_scan_info *info);
Johannes Berg2a519312009-02-10 21:25:55 +01006046
6047/**
Luciano Coelho807f8a82011-05-11 17:09:35 +03006048 * cfg80211_sched_scan_results - notify that new scan results are available
6049 *
6050 * @wiphy: the wiphy which got scheduled scan results
Arend Van Sprielb34939b2017-04-28 13:40:28 +01006051 * @reqid: identifier for the related scheduled scan request
Luciano Coelho807f8a82011-05-11 17:09:35 +03006052 */
Arend Van Sprielb34939b2017-04-28 13:40:28 +01006053void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
Luciano Coelho807f8a82011-05-11 17:09:35 +03006054
6055/**
6056 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6057 *
6058 * @wiphy: the wiphy on which the scheduled scan stopped
Arend Van Sprielb34939b2017-04-28 13:40:28 +01006059 * @reqid: identifier for the related scheduled scan request
Luciano Coelho807f8a82011-05-11 17:09:35 +03006060 *
6061 * The driver can call this function to inform cfg80211 that the
6062 * scheduled scan had to be stopped, for whatever reason. The driver
6063 * is then called back via the sched_scan_stop operation when done.
6064 */
Arend Van Sprielb34939b2017-04-28 13:40:28 +01006065void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
Luciano Coelho807f8a82011-05-11 17:09:35 +03006066
6067/**
Eliad Peller792e6aa2014-04-30 16:14:23 +03006068 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
6069 *
6070 * @wiphy: the wiphy on which the scheduled scan stopped
Arend Van Sprielb34939b2017-04-28 13:40:28 +01006071 * @reqid: identifier for the related scheduled scan request
Eliad Peller792e6aa2014-04-30 16:14:23 +03006072 *
6073 * The driver can call this function to inform cfg80211 that the
6074 * scheduled scan had to be stopped, for whatever reason. The driver
6075 * is then called back via the sched_scan_stop operation when done.
6076 * This function should be called with rtnl locked.
6077 */
Arend Van Sprielb34939b2017-04-28 13:40:28 +01006078void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
Eliad Peller792e6aa2014-04-30 16:14:23 +03006079
6080/**
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006081 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
Johannes Berg2a519312009-02-10 21:25:55 +01006082 * @wiphy: the wiphy reporting the BSS
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006083 * @data: the BSS metadata
Johannes Bergabe37c42010-06-07 11:12:27 +02006084 * @mgmt: the management frame (probe response or beacon)
6085 * @len: length of the management frame
Johannes Berg2a519312009-02-10 21:25:55 +01006086 * @gfp: context flags
6087 *
6088 * This informs cfg80211 that BSS information was found and
6089 * the BSS should be updated/added.
Johannes Bergef100682011-10-27 14:45:02 +02006090 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01006091 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6092 * Or %NULL on error.
Johannes Berg2a519312009-02-10 21:25:55 +01006093 */
Johannes Bergef100682011-10-27 14:45:02 +02006094struct cfg80211_bss * __must_check
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006095cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
6096 struct cfg80211_inform_bss *data,
6097 struct ieee80211_mgmt *mgmt, size_t len,
6098 gfp_t gfp);
6099
6100static inline struct cfg80211_bss * __must_check
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006101cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
Emmanuel Grumbach3afc2162014-03-04 16:50:13 +02006102 struct ieee80211_channel *rx_channel,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006103 enum nl80211_bss_scan_width scan_width,
6104 struct ieee80211_mgmt *mgmt, size_t len,
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006105 s32 signal, gfp_t gfp)
6106{
6107 struct cfg80211_inform_bss data = {
6108 .chan = rx_channel,
6109 .scan_width = scan_width,
6110 .signal = signal,
6111 };
6112
6113 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6114}
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006115
6116static inline struct cfg80211_bss * __must_check
Johannes Berg2a519312009-02-10 21:25:55 +01006117cfg80211_inform_bss_frame(struct wiphy *wiphy,
Emmanuel Grumbach3afc2162014-03-04 16:50:13 +02006118 struct ieee80211_channel *rx_channel,
Johannes Berg2a519312009-02-10 21:25:55 +01006119 struct ieee80211_mgmt *mgmt, size_t len,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006120 s32 signal, gfp_t gfp)
6121{
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006122 struct cfg80211_inform_bss data = {
6123 .chan = rx_channel,
6124 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6125 .signal = signal,
6126 };
6127
6128 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006129}
Johannes Berg2a519312009-02-10 21:25:55 +01006130
Johannes Bergabe37c42010-06-07 11:12:27 +02006131/**
Sara Sharon7ece9c32019-01-16 21:26:25 +02006132 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
6133 * @bssid: transmitter BSSID
6134 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
6135 * @mbssid_index: BSSID index, taken from Multiple BSSID index element
Johannes Berg5d4071abd2019-02-11 16:03:12 +01006136 * @new_bssid: calculated nontransmitted BSSID
Sara Sharon7ece9c32019-01-16 21:26:25 +02006137 */
6138static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
Johannes Berg5d4071abd2019-02-11 16:03:12 +01006139 u8 mbssid_index, u8 *new_bssid)
Sara Sharon7ece9c32019-01-16 21:26:25 +02006140{
Johannes Berg5d4071abd2019-02-11 16:03:12 +01006141 u64 bssid_u64 = ether_addr_to_u64(bssid);
6142 u64 mask = GENMASK_ULL(max_bssid - 1, 0);
6143 u64 new_bssid_u64;
Sara Sharon7ece9c32019-01-16 21:26:25 +02006144
Johannes Berg5d4071abd2019-02-11 16:03:12 +01006145 new_bssid_u64 = bssid_u64 & ~mask;
Sara Sharon7ece9c32019-01-16 21:26:25 +02006146
Johannes Berg5d4071abd2019-02-11 16:03:12 +01006147 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
Sara Sharon7ece9c32019-01-16 21:26:25 +02006148
Johannes Berg5d4071abd2019-02-11 16:03:12 +01006149 u64_to_ether_addr(new_bssid_u64, new_bssid);
Sara Sharon7ece9c32019-01-16 21:26:25 +02006150}
6151
6152/**
Sara Sharonf7dacfb2019-03-15 17:39:03 +02006153 * cfg80211_is_element_inherited - returns if element ID should be inherited
6154 * @element: element to check
6155 * @non_inherit_element: non inheritance element
6156 */
6157bool cfg80211_is_element_inherited(const struct element *element,
6158 const struct element *non_inherit_element);
6159
6160/**
Sara Sharonfe806e42019-03-15 17:39:05 +02006161 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6162 * @ie: ies
6163 * @ielen: length of IEs
6164 * @mbssid_elem: current MBSSID element
6165 * @sub_elem: current MBSSID subelement (profile)
6166 * @merged_ie: location of the merged profile
6167 * @max_copy_len: max merged profile length
6168 */
6169size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6170 const struct element *mbssid_elem,
6171 const struct element *sub_elem,
Dan Carpenter5809a5d2019-04-11 11:59:50 +03006172 u8 *merged_ie, size_t max_copy_len);
Sara Sharonfe806e42019-03-15 17:39:05 +02006173
6174/**
Johannes Berg5bc8c1f2014-08-12 21:01:28 +02006175 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
6176 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
6177 * from a beacon or probe response
6178 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
6179 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
6180 */
6181enum cfg80211_bss_frame_type {
6182 CFG80211_BSS_FTYPE_UNKNOWN,
6183 CFG80211_BSS_FTYPE_BEACON,
6184 CFG80211_BSS_FTYPE_PRESP,
6185};
6186
6187/**
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006188 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
Johannes Bergabe37c42010-06-07 11:12:27 +02006189 *
6190 * @wiphy: the wiphy reporting the BSS
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006191 * @data: the BSS metadata
Johannes Berg5bc8c1f2014-08-12 21:01:28 +02006192 * @ftype: frame type (if known)
Johannes Bergabe37c42010-06-07 11:12:27 +02006193 * @bssid: the BSSID of the BSS
Johannes Berg7b8bcff2012-03-13 13:57:04 +01006194 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
Johannes Bergabe37c42010-06-07 11:12:27 +02006195 * @capability: the capability field sent by the peer
6196 * @beacon_interval: the beacon interval announced by the peer
6197 * @ie: additional IEs sent by the peer
6198 * @ielen: length of the additional IEs
Johannes Bergabe37c42010-06-07 11:12:27 +02006199 * @gfp: context flags
6200 *
6201 * This informs cfg80211 that BSS information was found and
6202 * the BSS should be updated/added.
Johannes Bergef100682011-10-27 14:45:02 +02006203 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01006204 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6205 * Or %NULL on error.
Johannes Bergabe37c42010-06-07 11:12:27 +02006206 */
Johannes Bergef100682011-10-27 14:45:02 +02006207struct cfg80211_bss * __must_check
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006208cfg80211_inform_bss_data(struct wiphy *wiphy,
6209 struct cfg80211_inform_bss *data,
6210 enum cfg80211_bss_frame_type ftype,
6211 const u8 *bssid, u64 tsf, u16 capability,
6212 u16 beacon_interval, const u8 *ie, size_t ielen,
6213 gfp_t gfp);
6214
6215static inline struct cfg80211_bss * __must_check
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006216cfg80211_inform_bss_width(struct wiphy *wiphy,
Emmanuel Grumbach3afc2162014-03-04 16:50:13 +02006217 struct ieee80211_channel *rx_channel,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006218 enum nl80211_bss_scan_width scan_width,
Johannes Berg5bc8c1f2014-08-12 21:01:28 +02006219 enum cfg80211_bss_frame_type ftype,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006220 const u8 *bssid, u64 tsf, u16 capability,
6221 u16 beacon_interval, const u8 *ie, size_t ielen,
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006222 s32 signal, gfp_t gfp)
6223{
6224 struct cfg80211_inform_bss data = {
6225 .chan = rx_channel,
6226 .scan_width = scan_width,
6227 .signal = signal,
6228 };
6229
6230 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6231 capability, beacon_interval, ie, ielen,
6232 gfp);
6233}
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006234
6235static inline struct cfg80211_bss * __must_check
Jussi Kivilinna06aa7af2009-03-26 23:40:09 +02006236cfg80211_inform_bss(struct wiphy *wiphy,
Emmanuel Grumbach3afc2162014-03-04 16:50:13 +02006237 struct ieee80211_channel *rx_channel,
Johannes Berg5bc8c1f2014-08-12 21:01:28 +02006238 enum cfg80211_bss_frame_type ftype,
Johannes Berg7b8bcff2012-03-13 13:57:04 +01006239 const u8 *bssid, u64 tsf, u16 capability,
6240 u16 beacon_interval, const u8 *ie, size_t ielen,
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006241 s32 signal, gfp_t gfp)
6242{
Dmitry Shmidt6e19bc42015-10-07 11:32:53 +02006243 struct cfg80211_inform_bss data = {
6244 .chan = rx_channel,
6245 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6246 .signal = signal,
6247 };
6248
6249 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6250 capability, beacon_interval, ie, ielen,
6251 gfp);
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006252}
Jussi Kivilinna06aa7af2009-03-26 23:40:09 +02006253
Johannes Berg27548672017-03-31 09:12:39 +02006254/**
6255 * cfg80211_get_bss - get a BSS reference
6256 * @wiphy: the wiphy this BSS struct belongs to
6257 * @channel: the channel to search on (or %NULL)
6258 * @bssid: the desired BSSID (or %NULL)
6259 * @ssid: the desired SSID (or %NULL)
6260 * @ssid_len: length of the SSID (or 0)
6261 * @bss_type: type of BSS, see &enum ieee80211_bss_type
6262 * @privacy: privacy filter, see &enum ieee80211_privacy
6263 */
Johannes Berg2a519312009-02-10 21:25:55 +01006264struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
6265 struct ieee80211_channel *channel,
6266 const u8 *bssid,
Johannes Berg79420f02009-02-10 21:25:59 +01006267 const u8 *ssid, size_t ssid_len,
Dedy Lansky6eb18132015-02-08 15:52:03 +02006268 enum ieee80211_bss_type bss_type,
Johannes Berg27548672017-03-31 09:12:39 +02006269 enum ieee80211_privacy privacy);
Johannes Berg79420f02009-02-10 21:25:59 +01006270static inline struct cfg80211_bss *
6271cfg80211_get_ibss(struct wiphy *wiphy,
6272 struct ieee80211_channel *channel,
6273 const u8 *ssid, size_t ssid_len)
6274{
6275 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
Dedy Lansky6eb18132015-02-08 15:52:03 +02006276 IEEE80211_BSS_TYPE_IBSS,
6277 IEEE80211_PRIVACY_ANY);
Johannes Berg79420f02009-02-10 21:25:59 +01006278}
6279
Johannes Berg4c0c0b72012-01-20 13:55:26 +01006280/**
6281 * cfg80211_ref_bss - reference BSS struct
Johannes Berg5b112d32013-02-01 01:49:58 +01006282 * @wiphy: the wiphy this BSS struct belongs to
Johannes Berg4c0c0b72012-01-20 13:55:26 +01006283 * @bss: the BSS struct to reference
6284 *
6285 * Increments the refcount of the given BSS struct.
6286 */
Johannes Berg5b112d32013-02-01 01:49:58 +01006287void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
Johannes Berg4c0c0b72012-01-20 13:55:26 +01006288
6289/**
6290 * cfg80211_put_bss - unref BSS struct
Johannes Berg5b112d32013-02-01 01:49:58 +01006291 * @wiphy: the wiphy this BSS struct belongs to
Johannes Berg4c0c0b72012-01-20 13:55:26 +01006292 * @bss: the BSS struct
6293 *
6294 * Decrements the refcount of the given BSS struct.
6295 */
Johannes Berg5b112d32013-02-01 01:49:58 +01006296void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
Johannes Bergd3236552009-04-20 14:31:42 +02006297
Johannes Bergd491af12009-02-10 21:25:58 +01006298/**
6299 * cfg80211_unlink_bss - unlink BSS from internal data structures
6300 * @wiphy: the wiphy
6301 * @bss: the bss to remove
6302 *
6303 * This function removes the given BSS from the internal data structures
6304 * thereby making it no longer show up in scan results etc. Use this
6305 * function when you detect a BSS is gone. Normally BSSes will also time
6306 * out, so it is not necessary to use this function at all.
6307 */
6308void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
Johannes Bergfee52672008-11-26 22:36:31 +01006309
Ilan Peer4770c8f2019-05-29 15:25:32 +03006310/**
6311 * cfg80211_bss_iter - iterate all BSS entries
6312 *
6313 * This function iterates over the BSS entries associated with the given wiphy
6314 * and calls the callback for the iterated BSS. The iterator function is not
6315 * allowed to call functions that might modify the internal state of the BSS DB.
6316 *
6317 * @wiphy: the wiphy
6318 * @chandef: if given, the iterator function will be called only if the channel
6319 * of the currently iterated BSS is a subset of the given channel.
6320 * @iter: the iterator function to call
6321 * @iter_data: an argument to the iterator function
6322 */
6323void cfg80211_bss_iter(struct wiphy *wiphy,
6324 struct cfg80211_chan_def *chandef,
6325 void (*iter)(struct wiphy *wiphy,
6326 struct cfg80211_bss *bss,
6327 void *data),
6328 void *iter_data);
6329
Simon Wunderlichdcd6eac2013-07-08 16:55:49 +02006330static inline enum nl80211_bss_scan_width
6331cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6332{
6333 switch (chandef->width) {
6334 case NL80211_CHAN_WIDTH_5:
6335 return NL80211_BSS_CHAN_WIDTH_5;
6336 case NL80211_CHAN_WIDTH_10:
6337 return NL80211_BSS_CHAN_WIDTH_10;
6338 default:
6339 return NL80211_BSS_CHAN_WIDTH_20;
6340 }
6341}
6342
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006343/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006344 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006345 * @dev: network device
6346 * @buf: authentication frame (header + body)
6347 * @len: length of the frame data
6348 *
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006349 * This function is called whenever an authentication, disassociation or
6350 * deauthentication frame has been received and processed in station mode.
6351 * After being asked to authenticate via cfg80211_ops::auth() the driver must
6352 * call either this function or cfg80211_auth_timeout().
6353 * After being asked to associate via cfg80211_ops::assoc() the driver must
6354 * call either this function or cfg80211_auth_timeout().
6355 * While connected, the driver must calls this for received and processed
6356 * disassociation and deauthentication frames. If the frame couldn't be used
6357 * because it was unprotected, the driver must call the function
6358 * cfg80211_rx_unprot_mlme_mgmt() instead.
6359 *
6360 * This function may sleep. The caller must hold the corresponding wdev's mutex.
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006361 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006362void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006363
6364/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006365 * cfg80211_auth_timeout - notification of timed out authentication
Jouni Malinen1965c852009-04-22 21:38:25 +03006366 * @dev: network device
6367 * @addr: The MAC address of the device with which the authentication timed out
Johannes Bergcb0b4be2009-07-07 03:56:07 +02006368 *
Johannes Berg8d61ffa2013-05-10 12:32:47 +02006369 * This function may sleep. The caller must hold the corresponding wdev's
6370 * mutex.
Jouni Malinen1965c852009-04-22 21:38:25 +03006371 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006372void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
Jouni Malinen1965c852009-04-22 21:38:25 +03006373
6374/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006375 * cfg80211_rx_assoc_resp - notification of processed association response
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006376 * @dev: network device
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006377 * @bss: the BSS that association was requested with, ownership of the pointer
6378 * moves to cfg80211 in this call
Jouni Malinen4d9ec732019-02-15 02:14:33 +02006379 * @buf: (Re)Association Response frame (header + body)
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006380 * @len: length of the frame data
Emmanuel Grumbachf438ceb2016-10-18 23:12:12 +03006381 * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6382 * as the AC bitmap in the QoS info field
Jouni Malinen4d9ec732019-02-15 02:14:33 +02006383 * @req_ies: information elements from the (Re)Association Request frame
6384 * @req_ies_len: length of req_ies data
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006385 *
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006386 * After being asked to associate via cfg80211_ops::assoc() the driver must
6387 * call either this function or cfg80211_auth_timeout().
6388 *
6389 * This function may sleep. The caller must hold the corresponding wdev's mutex.
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006390 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006391void cfg80211_rx_assoc_resp(struct net_device *dev,
6392 struct cfg80211_bss *bss,
Eliad Pellerb0b6aa22014-09-09 17:09:45 +03006393 const u8 *buf, size_t len,
Jouni Malinen4d9ec732019-02-15 02:14:33 +02006394 int uapsd_queues,
6395 const u8 *req_ies, size_t req_ies_len);
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006396
6397/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006398 * cfg80211_assoc_timeout - notification of timed out association
Jouni Malinen1965c852009-04-22 21:38:25 +03006399 * @dev: network device
Johannes Berg959867f2013-06-19 13:05:42 +02006400 * @bss: The BSS entry with which association timed out.
Johannes Bergcb0b4be2009-07-07 03:56:07 +02006401 *
Johannes Berg8d61ffa2013-05-10 12:32:47 +02006402 * This function may sleep. The caller must hold the corresponding wdev's mutex.
Jouni Malinen1965c852009-04-22 21:38:25 +03006403 */
Johannes Berg959867f2013-06-19 13:05:42 +02006404void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
Jouni Malinen1965c852009-04-22 21:38:25 +03006405
6406/**
Johannes Berge6f462d2016-12-08 17:22:09 +01006407 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6408 * @dev: network device
6409 * @bss: The BSS entry with which association was abandoned.
6410 *
6411 * Call this whenever - for reasons reported through other API, like deauth RX,
6412 * an association attempt was abandoned.
6413 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6414 */
6415void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6416
6417/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006418 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006419 * @dev: network device
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006420 * @buf: 802.11 frame (header + body)
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006421 * @len: length of the frame data
6422 *
6423 * This function is called whenever deauthentication has been processed in
Jouni Malinen53b46b82009-03-27 20:53:56 +02006424 * station mode. This includes both received deauthentication frames and
Johannes Berg8d61ffa2013-05-10 12:32:47 +02006425 * locally generated ones. This function may sleep. The caller must hold the
6426 * corresponding wdev's mutex.
Jouni Malinen6039f6d2009-03-19 13:39:21 +02006427 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006428void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
Holger Schurigce470612009-10-13 13:28:13 +02006429
6430/**
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006431 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
Jouni Malinencf4e5942010-12-16 00:52:40 +02006432 * @dev: network device
Jouni Malinen4d797fc2020-04-01 17:25:47 +03006433 * @buf: received management frame (header + body)
Jouni Malinencf4e5942010-12-16 00:52:40 +02006434 * @len: length of the frame data
6435 *
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006436 * This function is called whenever a received deauthentication or dissassoc
6437 * frame has been dropped in station mode because of MFP being used but the
Jouni Malinen4d797fc2020-04-01 17:25:47 +03006438 * frame was not protected. This is also used to notify reception of a Beacon
6439 * frame that was dropped because it did not include a valid MME MIC while
6440 * beacon protection was enabled (BIGTK configured in station mode).
6441 *
6442 * This function may sleep.
Jouni Malinencf4e5942010-12-16 00:52:40 +02006443 */
Johannes Berg6ff57cf2013-05-16 00:55:00 +02006444void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
6445 const u8 *buf, size_t len);
Jouni Malinencf4e5942010-12-16 00:52:40 +02006446
6447/**
Jouni Malinena3b8b052009-03-27 21:59:49 +02006448 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6449 * @dev: network device
6450 * @addr: The source MAC address of the frame
6451 * @key_type: The key type that the received frame used
Arik Nemtsova66b98d2011-06-23 00:00:24 +03006452 * @key_id: Key identifier (0..3). Can be -1 if missing.
Jouni Malinena3b8b052009-03-27 21:59:49 +02006453 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
Johannes Berge6d6e342009-07-01 21:26:47 +02006454 * @gfp: allocation flags
Jouni Malinena3b8b052009-03-27 21:59:49 +02006455 *
6456 * This function is called whenever the local MAC detects a MIC failure in a
6457 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6458 * primitive.
6459 */
6460void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6461 enum nl80211_key_type key_type, int key_id,
Johannes Berge6d6e342009-07-01 21:26:47 +02006462 const u8 *tsc, gfp_t gfp);
Jouni Malinena3b8b052009-03-27 21:59:49 +02006463
Johannes Berg04a773a2009-04-19 21:24:32 +02006464/**
6465 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
6466 *
6467 * @dev: network device
6468 * @bssid: the BSSID of the IBSS joined
Antonio Quartullife94f3a2014-01-29 17:53:43 +01006469 * @channel: the channel of the IBSS joined
Johannes Berg04a773a2009-04-19 21:24:32 +02006470 * @gfp: allocation flags
6471 *
6472 * This function notifies cfg80211 that the device joined an IBSS or
6473 * switched to a different BSSID. Before this function can be called,
6474 * either a beacon has to have been received from the IBSS, or one of
6475 * the cfg80211_inform_bss{,_frame} functions must have been called
6476 * with the locally generated beacon -- this guarantees that there is
6477 * always a scan result for this IBSS. cfg80211 will handle the rest.
6478 */
Antonio Quartullife94f3a2014-01-29 17:53:43 +01006479void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6480 struct ieee80211_channel *channel, gfp_t gfp);
Johannes Berg04a773a2009-04-19 21:24:32 +02006481
Johannes Berg1f87f7d2009-06-02 13:01:41 +02006482/**
Mauro Carvalho Chehabb1e8eb12020-10-23 18:33:08 +02006483 * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6484 * candidate
Javier Cardonac93b5e72011-04-07 15:08:34 -07006485 *
6486 * @dev: network device
6487 * @macaddr: the MAC address of the new candidate
6488 * @ie: information elements advertised by the peer candidate
Matteo Croce5ac4a122019-01-29 19:25:53 +01006489 * @ie_len: length of the information elements buffer
Javier Cardonac93b5e72011-04-07 15:08:34 -07006490 * @gfp: allocation flags
6491 *
6492 * This function notifies cfg80211 that the mesh peer candidate has been
6493 * detected, most likely via a beacon or, less likely, via a probe response.
6494 * cfg80211 then sends a notification to userspace.
6495 */
6496void cfg80211_notify_new_peer_candidate(struct net_device *dev,
Bob Copelandecbc12a2018-10-26 10:03:50 -04006497 const u8 *macaddr, const u8 *ie, u8 ie_len,
6498 int sig_dbm, gfp_t gfp);
Javier Cardonac93b5e72011-04-07 15:08:34 -07006499
6500/**
Johannes Bergd70e9692010-08-19 16:11:27 +02006501 * DOC: RFkill integration
6502 *
6503 * RFkill integration in cfg80211 is almost invisible to drivers,
6504 * as cfg80211 automatically registers an rfkill instance for each
6505 * wireless device it knows about. Soft kill is also translated
6506 * into disconnecting and turning all interfaces off, drivers are
6507 * expected to turn off the device when all interfaces are down.
6508 *
6509 * However, devices may have a hard RFkill line, in which case they
6510 * also need to interact with the rfkill subsystem, via cfg80211.
6511 * They can do this with a few helper functions documented here.
6512 */
6513
6514/**
Johannes Berg1f87f7d2009-06-02 13:01:41 +02006515 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
6516 * @wiphy: the wiphy
6517 * @blocked: block status
6518 */
6519void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
6520
6521/**
6522 * wiphy_rfkill_start_polling - start polling rfkill
6523 * @wiphy: the wiphy
6524 */
6525void wiphy_rfkill_start_polling(struct wiphy *wiphy);
6526
6527/**
6528 * wiphy_rfkill_stop_polling - stop polling rfkill
6529 * @wiphy: the wiphy
6530 */
6531void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
6532
Johannes Bergad7e7182013-11-13 13:37:47 +01006533/**
6534 * DOC: Vendor commands
6535 *
6536 * Occasionally, there are special protocol or firmware features that
6537 * can't be implemented very openly. For this and similar cases, the
6538 * vendor command functionality allows implementing the features with
6539 * (typically closed-source) userspace and firmware, using nl80211 as
6540 * the configuration mechanism.
6541 *
6542 * A driver supporting vendor commands must register them as an array
6543 * in struct wiphy, with handlers for each one, each command has an
6544 * OUI and sub command ID to identify it.
6545 *
6546 * Note that this feature should not be (ab)used to implement protocol
6547 * features that could openly be shared across drivers. In particular,
6548 * it must never be required to use vendor commands to implement any
6549 * "normal" functionality that higher-level userspace like connection
6550 * managers etc. need.
6551 */
6552
6553struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6554 enum nl80211_commands cmd,
6555 enum nl80211_attrs attr,
6556 int approxlen);
6557
Johannes Berg567ffc32013-12-18 14:43:31 +01006558struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02006559 struct wireless_dev *wdev,
Johannes Berg567ffc32013-12-18 14:43:31 +01006560 enum nl80211_commands cmd,
6561 enum nl80211_attrs attr,
Johannes Berg55c1fdf2019-02-06 13:17:19 +02006562 unsigned int portid,
Johannes Berg567ffc32013-12-18 14:43:31 +01006563 int vendor_event_idx,
6564 int approxlen, gfp_t gfp);
6565
6566void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6567
Johannes Bergad7e7182013-11-13 13:37:47 +01006568/**
6569 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6570 * @wiphy: the wiphy
6571 * @approxlen: an upper bound of the length of the data that will
6572 * be put into the skb
6573 *
6574 * This function allocates and pre-fills an skb for a reply to
6575 * a vendor command. Since it is intended for a reply, calling
6576 * it outside of a vendor command's doit() operation is invalid.
6577 *
6578 * The returned skb is pre-filled with some identifying data in
6579 * a way that any data that is put into the skb (with skb_put(),
6580 * nla_put() or similar) will end up being within the
6581 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6582 * with the skb is adding data for the corresponding userspace tool
6583 * which can then read that data out of the vendor data attribute.
6584 * You must not modify the skb in any other way.
6585 *
6586 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6587 * its error code as the result of the doit() operation.
6588 *
6589 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6590 */
6591static inline struct sk_buff *
6592cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6593{
6594 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6595 NL80211_ATTR_VENDOR_DATA, approxlen);
6596}
6597
6598/**
6599 * cfg80211_vendor_cmd_reply - send the reply skb
6600 * @skb: The skb, must have been allocated with
6601 * cfg80211_vendor_cmd_alloc_reply_skb()
6602 *
6603 * Since calling this function will usually be the last thing
6604 * before returning from the vendor command doit() you should
6605 * return the error code. Note that this function consumes the
6606 * skb regardless of the return value.
6607 *
6608 * Return: An error code or 0 on success.
6609 */
6610int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6611
Johannes Berg567ffc32013-12-18 14:43:31 +01006612/**
Johannes Berg55c1fdf2019-02-06 13:17:19 +02006613 * cfg80211_vendor_cmd_get_sender
6614 * @wiphy: the wiphy
6615 *
6616 * Return the current netlink port ID in a vendor command handler.
6617 * Valid to call only there.
6618 */
6619unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
6620
6621/**
Johannes Berg567ffc32013-12-18 14:43:31 +01006622 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6623 * @wiphy: the wiphy
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02006624 * @wdev: the wireless device
Johannes Berg567ffc32013-12-18 14:43:31 +01006625 * @event_idx: index of the vendor event in the wiphy's vendor_events
6626 * @approxlen: an upper bound of the length of the data that will
6627 * be put into the skb
6628 * @gfp: allocation flags
6629 *
6630 * This function allocates and pre-fills an skb for an event on the
6631 * vendor-specific multicast group.
6632 *
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02006633 * If wdev != NULL, both the ifindex and identifier of the specified
6634 * wireless device are added to the event message before the vendor data
6635 * attribute.
6636 *
Johannes Berg567ffc32013-12-18 14:43:31 +01006637 * When done filling the skb, call cfg80211_vendor_event() with the
6638 * skb to send the event.
6639 *
6640 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6641 */
6642static inline struct sk_buff *
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02006643cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
6644 int approxlen, int event_idx, gfp_t gfp)
Johannes Berg567ffc32013-12-18 14:43:31 +01006645{
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02006646 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
Johannes Berg567ffc32013-12-18 14:43:31 +01006647 NL80211_ATTR_VENDOR_DATA,
Johannes Berg55c1fdf2019-02-06 13:17:19 +02006648 0, event_idx, approxlen, gfp);
6649}
6650
6651/**
6652 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
6653 * @wiphy: the wiphy
6654 * @wdev: the wireless device
6655 * @event_idx: index of the vendor event in the wiphy's vendor_events
6656 * @portid: port ID of the receiver
6657 * @approxlen: an upper bound of the length of the data that will
6658 * be put into the skb
6659 * @gfp: allocation flags
6660 *
6661 * This function allocates and pre-fills an skb for an event to send to
6662 * a specific (userland) socket. This socket would previously have been
6663 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
6664 * care to register a netlink notifier to see when the socket closes.
6665 *
6666 * If wdev != NULL, both the ifindex and identifier of the specified
6667 * wireless device are added to the event message before the vendor data
6668 * attribute.
6669 *
6670 * When done filling the skb, call cfg80211_vendor_event() with the
6671 * skb to send the event.
6672 *
6673 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6674 */
6675static inline struct sk_buff *
6676cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
6677 struct wireless_dev *wdev,
6678 unsigned int portid, int approxlen,
6679 int event_idx, gfp_t gfp)
6680{
6681 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6682 NL80211_ATTR_VENDOR_DATA,
6683 portid, event_idx, approxlen, gfp);
Johannes Berg567ffc32013-12-18 14:43:31 +01006684}
6685
6686/**
6687 * cfg80211_vendor_event - send the event
6688 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6689 * @gfp: allocation flags
6690 *
6691 * This function sends the given @skb, which must have been allocated
6692 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6693 */
6694static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6695{
6696 __cfg80211_send_event_skb(skb, gfp);
6697}
6698
Johannes Bergaff89a92009-07-01 21:26:51 +02006699#ifdef CONFIG_NL80211_TESTMODE
6700/**
Johannes Bergd70e9692010-08-19 16:11:27 +02006701 * DOC: Test mode
6702 *
6703 * Test mode is a set of utility functions to allow drivers to
6704 * interact with driver-specific tools to aid, for instance,
6705 * factory programming.
6706 *
6707 * This chapter describes how drivers interact with it, for more
6708 * information see the nl80211 book's chapter on it.
6709 */
6710
6711/**
Johannes Bergaff89a92009-07-01 21:26:51 +02006712 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6713 * @wiphy: the wiphy
6714 * @approxlen: an upper bound of the length of the data that will
6715 * be put into the skb
6716 *
6717 * This function allocates and pre-fills an skb for a reply to
6718 * the testmode command. Since it is intended for a reply, calling
6719 * it outside of the @testmode_cmd operation is invalid.
6720 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01006721 * The returned skb is pre-filled with the wiphy index and set up in
6722 * a way that any data that is put into the skb (with skb_put(),
6723 * nla_put() or similar) will end up being within the
6724 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
6725 * with the skb is adding data for the corresponding userspace tool
6726 * which can then read that data out of the testdata attribute. You
6727 * must not modify the skb in any other way.
Johannes Bergaff89a92009-07-01 21:26:51 +02006728 *
6729 * When done, call cfg80211_testmode_reply() with the skb and return
6730 * its error code as the result of the @testmode_cmd operation.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01006731 *
6732 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
Johannes Bergaff89a92009-07-01 21:26:51 +02006733 */
Johannes Bergad7e7182013-11-13 13:37:47 +01006734static inline struct sk_buff *
6735cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6736{
6737 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6738 NL80211_ATTR_TESTDATA, approxlen);
6739}
Johannes Bergaff89a92009-07-01 21:26:51 +02006740
6741/**
6742 * cfg80211_testmode_reply - send the reply skb
6743 * @skb: The skb, must have been allocated with
6744 * cfg80211_testmode_alloc_reply_skb()
6745 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01006746 * Since calling this function will usually be the last thing
6747 * before returning from the @testmode_cmd you should return
6748 * the error code. Note that this function consumes the skb
6749 * regardless of the return value.
6750 *
6751 * Return: An error code or 0 on success.
Johannes Bergaff89a92009-07-01 21:26:51 +02006752 */
Johannes Bergad7e7182013-11-13 13:37:47 +01006753static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6754{
6755 return cfg80211_vendor_cmd_reply(skb);
6756}
Johannes Bergaff89a92009-07-01 21:26:51 +02006757
6758/**
6759 * cfg80211_testmode_alloc_event_skb - allocate testmode event
6760 * @wiphy: the wiphy
6761 * @approxlen: an upper bound of the length of the data that will
6762 * be put into the skb
6763 * @gfp: allocation flags
6764 *
6765 * This function allocates and pre-fills an skb for an event on the
6766 * testmode multicast group.
6767 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01006768 * The returned skb is set up in the same way as with
6769 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
6770 * there, you should simply add data to it that will then end up in the
6771 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
6772 * in any other way.
Johannes Bergaff89a92009-07-01 21:26:51 +02006773 *
6774 * When done filling the skb, call cfg80211_testmode_event() with the
6775 * skb to send the event.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01006776 *
6777 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
Johannes Bergaff89a92009-07-01 21:26:51 +02006778 */
Johannes Berg567ffc32013-12-18 14:43:31 +01006779static inline struct sk_buff *
6780cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6781{
Ahmad Kholaif6c09e792015-02-26 15:26:53 +02006782 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
Johannes Berg55c1fdf2019-02-06 13:17:19 +02006783 NL80211_ATTR_TESTDATA, 0, -1,
Johannes Berg567ffc32013-12-18 14:43:31 +01006784 approxlen, gfp);
6785}
Johannes Bergaff89a92009-07-01 21:26:51 +02006786
6787/**
6788 * cfg80211_testmode_event - send the event
6789 * @skb: The skb, must have been allocated with
6790 * cfg80211_testmode_alloc_event_skb()
6791 * @gfp: allocation flags
6792 *
6793 * This function sends the given @skb, which must have been allocated
6794 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6795 * consumes it.
6796 */
Johannes Berg567ffc32013-12-18 14:43:31 +01006797static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6798{
6799 __cfg80211_send_event_skb(skb, gfp);
6800}
Johannes Bergaff89a92009-07-01 21:26:51 +02006801
6802#define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
Wey-Yi Guy71063f02011-05-20 09:05:54 -07006803#define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
Johannes Bergaff89a92009-07-01 21:26:51 +02006804#else
6805#define CFG80211_TESTMODE_CMD(cmd)
Wey-Yi Guy71063f02011-05-20 09:05:54 -07006806#define CFG80211_TESTMODE_DUMP(cmd)
Johannes Bergaff89a92009-07-01 21:26:51 +02006807#endif
6808
Samuel Ortizb23aa672009-07-01 21:26:54 +02006809/**
Arend Van Spriel76804d22018-05-22 10:19:06 +02006810 * struct cfg80211_fils_resp_params - FILS connection response params
6811 * @kek: KEK derived from a successful FILS connection (may be %NULL)
6812 * @kek_len: Length of @fils_kek in octets
6813 * @update_erp_next_seq_num: Boolean value to specify whether the value in
6814 * @erp_next_seq_num is valid.
6815 * @erp_next_seq_num: The next sequence number to use in ERP message in
6816 * FILS Authentication. This value should be specified irrespective of the
6817 * status for a FILS connection.
6818 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
6819 * @pmk_len: Length of @pmk in octets
6820 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
6821 * used for this FILS connection (may be %NULL).
6822 */
6823struct cfg80211_fils_resp_params {
6824 const u8 *kek;
6825 size_t kek_len;
6826 bool update_erp_next_seq_num;
6827 u16 erp_next_seq_num;
6828 const u8 *pmk;
6829 size_t pmk_len;
6830 const u8 *pmkid;
6831};
6832
6833/**
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +03006834 * struct cfg80211_connect_resp_params - Connection response params
6835 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
6836 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6837 * the real status code for failures. If this call is used to report a
6838 * failure due to a timeout (e.g., not receiving an Authentication frame
6839 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6840 * indicate that this is a failure, but without a status code.
6841 * @timeout_reason is used to report the reason for the timeout in that
6842 * case.
6843 * @bssid: The BSSID of the AP (may be %NULL)
6844 * @bss: Entry of bss to which STA got connected to, can be obtained through
Chaitanya Tataa3ce17d2019-05-01 18:25:24 +05306845 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6846 * bss from the connect_request and hold a reference to it and return
6847 * through this param to avoid a warning if the bss is expired during the
6848 * connection, esp. for those drivers implementing connect op.
6849 * Only one parameter among @bssid and @bss needs to be specified.
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +03006850 * @req_ie: Association request IEs (may be %NULL)
6851 * @req_ie_len: Association request IEs length
6852 * @resp_ie: Association response IEs (may be %NULL)
6853 * @resp_ie_len: Association response IEs length
Arend Van Spriel76804d22018-05-22 10:19:06 +02006854 * @fils: FILS connection response parameters.
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +03006855 * @timeout_reason: Reason for connection timeout. This is used when the
6856 * connection fails due to a timeout instead of an explicit rejection from
6857 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6858 * not known. This value is used only if @status < 0 to indicate that the
6859 * failure is due to a timeout and not due to explicit rejection by the AP.
6860 * This value is ignored in other cases (@status >= 0).
6861 */
6862struct cfg80211_connect_resp_params {
6863 int status;
6864 const u8 *bssid;
6865 struct cfg80211_bss *bss;
6866 const u8 *req_ie;
6867 size_t req_ie_len;
6868 const u8 *resp_ie;
6869 size_t resp_ie_len;
Arend Van Spriel76804d22018-05-22 10:19:06 +02006870 struct cfg80211_fils_resp_params fils;
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +03006871 enum nl80211_timeout_reason timeout_reason;
6872};
6873
6874/**
6875 * cfg80211_connect_done - notify cfg80211 of connection result
6876 *
6877 * @dev: network device
6878 * @params: connection response parameters
6879 * @gfp: allocation flags
6880 *
6881 * It should be called by the underlying driver once execution of the connection
6882 * request from connect() has been completed. This is similar to
6883 * cfg80211_connect_bss(), but takes a structure pointer for connection response
6884 * parameters. Only one of the functions among cfg80211_connect_bss(),
6885 * cfg80211_connect_result(), cfg80211_connect_timeout(),
6886 * and cfg80211_connect_done() should be called.
6887 */
6888void cfg80211_connect_done(struct net_device *dev,
6889 struct cfg80211_connect_resp_params *params,
6890 gfp_t gfp);
6891
6892/**
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05306893 * cfg80211_connect_bss - notify cfg80211 of connection result
6894 *
6895 * @dev: network device
6896 * @bssid: the BSSID of the AP
Chaitanya Tataa3ce17d2019-05-01 18:25:24 +05306897 * @bss: Entry of bss to which STA got connected to, can be obtained through
6898 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6899 * bss from the connect_request and hold a reference to it and return
6900 * through this param to avoid a warning if the bss is expired during the
6901 * connection, esp. for those drivers implementing connect op.
6902 * Only one parameter among @bssid and @bss needs to be specified.
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05306903 * @req_ie: association request IEs (maybe be %NULL)
6904 * @req_ie_len: association request IEs length
6905 * @resp_ie: association response IEs (may be %NULL)
6906 * @resp_ie_len: assoc response IEs length
Jouni Malinenc88215d2017-01-13 01:12:22 +02006907 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6908 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6909 * the real status code for failures. If this call is used to report a
6910 * failure due to a timeout (e.g., not receiving an Authentication frame
6911 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6912 * indicate that this is a failure, but without a status code.
6913 * @timeout_reason is used to report the reason for the timeout in that
6914 * case.
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05306915 * @gfp: allocation flags
Purushottam Kushwaha3093ebbeab2017-01-13 01:12:21 +02006916 * @timeout_reason: reason for connection timeout. This is used when the
6917 * connection fails due to a timeout instead of an explicit rejection from
6918 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6919 * not known. This value is used only if @status < 0 to indicate that the
6920 * failure is due to a timeout and not due to explicit rejection by the AP.
6921 * This value is ignored in other cases (@status >= 0).
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05306922 *
Jouni Malinenc88215d2017-01-13 01:12:22 +02006923 * It should be called by the underlying driver once execution of the connection
6924 * request from connect() has been completed. This is similar to
6925 * cfg80211_connect_result(), but with the option of identifying the exact bss
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +03006926 * entry for the connection. Only one of the functions among
6927 * cfg80211_connect_bss(), cfg80211_connect_result(),
6928 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05306929 */
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +03006930static inline void
6931cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6932 struct cfg80211_bss *bss, const u8 *req_ie,
6933 size_t req_ie_len, const u8 *resp_ie,
6934 size_t resp_ie_len, int status, gfp_t gfp,
6935 enum nl80211_timeout_reason timeout_reason)
6936{
6937 struct cfg80211_connect_resp_params params;
6938
6939 memset(&params, 0, sizeof(params));
6940 params.status = status;
6941 params.bssid = bssid;
6942 params.bss = bss;
6943 params.req_ie = req_ie;
6944 params.req_ie_len = req_ie_len;
6945 params.resp_ie = resp_ie;
6946 params.resp_ie_len = resp_ie_len;
6947 params.timeout_reason = timeout_reason;
6948
6949 cfg80211_connect_done(dev, &params, gfp);
6950}
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05306951
6952/**
Samuel Ortizb23aa672009-07-01 21:26:54 +02006953 * cfg80211_connect_result - notify cfg80211 of connection result
6954 *
6955 * @dev: network device
6956 * @bssid: the BSSID of the AP
6957 * @req_ie: association request IEs (maybe be %NULL)
6958 * @req_ie_len: association request IEs length
6959 * @resp_ie: association response IEs (may be %NULL)
6960 * @resp_ie_len: assoc response IEs length
Jouni Malinenc88215d2017-01-13 01:12:22 +02006961 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
Samuel Ortizb23aa672009-07-01 21:26:54 +02006962 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6963 * the real status code for failures.
6964 * @gfp: allocation flags
6965 *
Jouni Malinenc88215d2017-01-13 01:12:22 +02006966 * It should be called by the underlying driver once execution of the connection
6967 * request from connect() has been completed. This is similar to
6968 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +03006969 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
6970 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
Samuel Ortizb23aa672009-07-01 21:26:54 +02006971 */
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05306972static inline void
6973cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
6974 const u8 *req_ie, size_t req_ie_len,
6975 const u8 *resp_ie, size_t resp_ie_len,
6976 u16 status, gfp_t gfp)
6977{
6978 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
Purushottam Kushwaha3093ebbeab2017-01-13 01:12:21 +02006979 resp_ie_len, status, gfp,
6980 NL80211_TIMEOUT_UNSPECIFIED);
Kanchanapally, Vidyullathae7054982016-04-11 15:16:01 +05306981}
Samuel Ortizb23aa672009-07-01 21:26:54 +02006982
6983/**
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03006984 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6985 *
6986 * @dev: network device
6987 * @bssid: the BSSID of the AP
6988 * @req_ie: association request IEs (maybe be %NULL)
6989 * @req_ie_len: association request IEs length
6990 * @gfp: allocation flags
Purushottam Kushwaha3093ebbeab2017-01-13 01:12:21 +02006991 * @timeout_reason: reason for connection timeout.
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03006992 *
6993 * It should be called by the underlying driver whenever connect() has failed
6994 * in a sequence where no explicit authentication/association rejection was
6995 * received from the AP. This could happen, e.g., due to not being able to send
6996 * out the Authentication or Association Request frame or timing out while
Vidyullatha Kanchanapally5349a0f2017-03-31 00:22:33 +03006997 * waiting for the response. Only one of the functions among
6998 * cfg80211_connect_bss(), cfg80211_connect_result(),
6999 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03007000 */
7001static inline void
7002cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
Purushottam Kushwaha3093ebbeab2017-01-13 01:12:21 +02007003 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
7004 enum nl80211_timeout_reason timeout_reason)
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03007005{
7006 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
Purushottam Kushwaha3093ebbeab2017-01-13 01:12:21 +02007007 gfp, timeout_reason);
Jouni Malinenbf1ecd22016-05-31 00:16:50 +03007008}
7009
7010/**
Avraham Stern29ce6ec2017-04-26 10:58:49 +03007011 * struct cfg80211_roam_info - driver initiated roaming information
7012 *
7013 * @channel: the channel of the new AP
7014 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
7015 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
7016 * @req_ie: association request IEs (maybe be %NULL)
7017 * @req_ie_len: association request IEs length
7018 * @resp_ie: association response IEs (may be %NULL)
7019 * @resp_ie_len: assoc response IEs length
Arend Van Spriele841b7b2018-05-22 10:19:07 +02007020 * @fils: FILS related roaming information.
Avraham Stern29ce6ec2017-04-26 10:58:49 +03007021 */
7022struct cfg80211_roam_info {
7023 struct ieee80211_channel *channel;
7024 struct cfg80211_bss *bss;
7025 const u8 *bssid;
7026 const u8 *req_ie;
7027 size_t req_ie_len;
7028 const u8 *resp_ie;
7029 size_t resp_ie_len;
Arend Van Spriele841b7b2018-05-22 10:19:07 +02007030 struct cfg80211_fils_resp_params fils;
Avraham Stern29ce6ec2017-04-26 10:58:49 +03007031};
7032
7033/**
Samuel Ortizb23aa672009-07-01 21:26:54 +02007034 * cfg80211_roamed - notify cfg80211 of roaming
7035 *
7036 * @dev: network device
Avraham Stern29ce6ec2017-04-26 10:58:49 +03007037 * @info: information about the new BSS. struct &cfg80211_roam_info.
Samuel Ortizb23aa672009-07-01 21:26:54 +02007038 * @gfp: allocation flags
7039 *
Avraham Stern29ce6ec2017-04-26 10:58:49 +03007040 * This function may be called with the driver passing either the BSSID of the
7041 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
7042 * It should be called by the underlying driver whenever it roamed from one AP
7043 * to another while connected. Drivers which have roaming implemented in
7044 * firmware should pass the bss entry to avoid a race in bss entry timeout where
7045 * the bss entry of the new AP is seen in the driver, but gets timed out by the
7046 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
Vasanthakumar Thiagarajanadbde342011-12-08 14:28:47 +05307047 * rdev->event_work. In case of any failures, the reference is released
Avraham Stern29ce6ec2017-04-26 10:58:49 +03007048 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
Geert Uytterhoevene1b18542019-10-24 17:23:23 +02007049 * released while disconnecting from the current bss.
Vasanthakumar Thiagarajanadbde342011-12-08 14:28:47 +05307050 */
Avraham Stern29ce6ec2017-04-26 10:58:49 +03007051void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
7052 gfp_t gfp);
Vasanthakumar Thiagarajanadbde342011-12-08 14:28:47 +05307053
7054/**
Avraham Stern503c1fb2017-09-29 14:21:49 +02007055 * cfg80211_port_authorized - notify cfg80211 of successful security association
7056 *
7057 * @dev: network device
7058 * @bssid: the BSSID of the AP
7059 * @gfp: allocation flags
7060 *
7061 * This function should be called by a driver that supports 4 way handshake
7062 * offload after a security association was successfully established (i.e.,
7063 * the 4 way handshake was completed successfully). The call to this function
7064 * should be preceded with a call to cfg80211_connect_result(),
7065 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7066 * indicate the 802.11 association.
7067 */
7068void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7069 gfp_t gfp);
7070
7071/**
Samuel Ortizb23aa672009-07-01 21:26:54 +02007072 * cfg80211_disconnected - notify cfg80211 that connection was dropped
7073 *
7074 * @dev: network device
7075 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7076 * @ie_len: length of IEs
7077 * @reason: reason code for the disconnection, set it to 0 if unknown
Johannes Berg80279fb2015-05-22 16:22:20 +02007078 * @locally_generated: disconnection was requested locally
Samuel Ortizb23aa672009-07-01 21:26:54 +02007079 * @gfp: allocation flags
7080 *
7081 * After it calls this function, the driver should enter an idle state
7082 * and not try to connect to any AP any more.
7083 */
7084void cfg80211_disconnected(struct net_device *dev, u16 reason,
Johannes Berg80279fb2015-05-22 16:22:20 +02007085 const u8 *ie, size_t ie_len,
7086 bool locally_generated, gfp_t gfp);
Samuel Ortizb23aa672009-07-01 21:26:54 +02007087
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007088/**
7089 * cfg80211_ready_on_channel - notification of remain_on_channel start
Johannes Berg71bbc992012-06-15 15:30:18 +02007090 * @wdev: wireless device
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007091 * @cookie: the request cookie
7092 * @chan: The current channel (from remain_on_channel request)
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007093 * @duration: Duration in milliseconds that the driver intents to remain on the
7094 * channel
7095 * @gfp: allocation flags
7096 */
Johannes Berg71bbc992012-06-15 15:30:18 +02007097void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007098 struct ieee80211_channel *chan,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007099 unsigned int duration, gfp_t gfp);
7100
7101/**
7102 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
Johannes Berg71bbc992012-06-15 15:30:18 +02007103 * @wdev: wireless device
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007104 * @cookie: the request cookie
7105 * @chan: The current channel (from remain_on_channel request)
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007106 * @gfp: allocation flags
7107 */
Johannes Berg71bbc992012-06-15 15:30:18 +02007108void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007109 struct ieee80211_channel *chan,
Jouni Malinen9588bbd2009-12-23 13:15:41 +01007110 gfp_t gfp);
Samuel Ortizb23aa672009-07-01 21:26:54 +02007111
Arend van Spriel8689c052018-05-10 13:50:12 +02007112/**
James Prestwood1c38c7f2019-06-12 12:35:09 -07007113 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
7114 * @wdev: wireless device
7115 * @cookie: the requested cookie
7116 * @chan: The current channel (from tx_mgmt request)
7117 * @gfp: allocation flags
7118 */
7119void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
7120 struct ieee80211_channel *chan, gfp_t gfp);
7121
7122/**
Arend van Spriel8689c052018-05-10 13:50:12 +02007123 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
7124 *
7125 * @sinfo: the station information
7126 * @gfp: allocation flags
7127 */
7128int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
Johannes Berg98b62182009-12-23 13:15:44 +01007129
7130/**
Johannes Berg7ea3e112018-05-18 11:40:44 +02007131 * cfg80211_sinfo_release_content - release contents of station info
7132 * @sinfo: the station information
7133 *
7134 * Releases any potentially allocated sub-information of the station
7135 * information, but not the struct itself (since it's typically on
7136 * the stack.)
7137 */
7138static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
7139{
7140 kfree(sinfo->pertid);
7141}
7142
7143/**
Johannes Berg98b62182009-12-23 13:15:44 +01007144 * cfg80211_new_sta - notify userspace about station
7145 *
7146 * @dev: the netdev
7147 * @mac_addr: the station's address
7148 * @sinfo: the station information
7149 * @gfp: allocation flags
7150 */
7151void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
7152 struct station_info *sinfo, gfp_t gfp);
7153
Jouni Malinen026331c2010-02-15 12:53:10 +02007154/**
Johannes Bergcf5ead82014-11-14 17:14:00 +01007155 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7156 * @dev: the netdev
7157 * @mac_addr: the station's address
7158 * @sinfo: the station information/statistics
7159 * @gfp: allocation flags
7160 */
7161void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7162 struct station_info *sinfo, gfp_t gfp);
7163
7164/**
Jouni Malinenec15e682011-03-23 15:29:52 +02007165 * cfg80211_del_sta - notify userspace about deletion of a station
7166 *
7167 * @dev: the netdev
7168 * @mac_addr: the station's address
7169 * @gfp: allocation flags
7170 */
Johannes Bergcf5ead82014-11-14 17:14:00 +01007171static inline void cfg80211_del_sta(struct net_device *dev,
7172 const u8 *mac_addr, gfp_t gfp)
7173{
7174 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7175}
Jouni Malinenec15e682011-03-23 15:29:52 +02007176
7177/**
Pandiyarajan Pitchaimuthued44a952012-09-18 16:50:49 +05307178 * cfg80211_conn_failed - connection request failed notification
7179 *
7180 * @dev: the netdev
7181 * @mac_addr: the station's address
7182 * @reason: the reason for connection failure
7183 * @gfp: allocation flags
7184 *
7185 * Whenever a station tries to connect to an AP and if the station
7186 * could not connect to the AP as the AP has rejected the connection
7187 * for some reasons, this function is called.
7188 *
7189 * The reason for connection failure can be any of the value from
7190 * nl80211_connect_failed_reason enum
7191 */
7192void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7193 enum nl80211_connect_failed_reason reason,
7194 gfp_t gfp);
7195
7196/**
Thomas Pedersene76fede2020-04-30 10:25:50 -07007197 * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7198 * @wdev: wireless device receiving the frame
7199 * @freq: Frequency on which the frame was received in KHz
7200 * @sig_dbm: signal strength in dBm, or 0 if unknown
7201 * @buf: Management frame (header + body)
7202 * @len: length of the frame data
7203 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7204 *
7205 * This function is called whenever an Action frame is received for a station
7206 * mode interface, but is not processed in kernel.
7207 *
7208 * Return: %true if a user space application has registered for this frame.
7209 * For action frames, that makes it responsible for rejecting unrecognized
7210 * action frames; %false otherwise, in which case for action frames the
7211 * driver is responsible for rejecting the frame.
7212 */
7213bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7214 const u8 *buf, size_t len, u32 flags);
7215
7216/**
Johannes Berg2e161f782010-08-12 15:38:38 +02007217 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
Johannes Berg71bbc992012-06-15 15:30:18 +02007218 * @wdev: wireless device receiving the frame
Jouni Malinen026331c2010-02-15 12:53:10 +02007219 * @freq: Frequency on which the frame was received in MHz
Sergey Matyukevich6c2fb1e2017-11-09 14:46:30 +03007220 * @sig_dbm: signal strength in dBm, or 0 if unknown
Johannes Berg2e161f782010-08-12 15:38:38 +02007221 * @buf: Management frame (header + body)
Jouni Malinen026331c2010-02-15 12:53:10 +02007222 * @len: length of the frame data
Vladimir Kondratiev19504cf2013-08-15 14:51:28 +03007223 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
Johannes Berg2e161f782010-08-12 15:38:38 +02007224 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01007225 * This function is called whenever an Action frame is received for a station
7226 * mode interface, but is not processed in kernel.
7227 *
7228 * Return: %true if a user space application has registered for this frame.
Johannes Berg2e161f782010-08-12 15:38:38 +02007229 * For action frames, that makes it responsible for rejecting unrecognized
7230 * action frames; %false otherwise, in which case for action frames the
7231 * driver is responsible for rejecting the frame.
Jouni Malinen026331c2010-02-15 12:53:10 +02007232 */
Thomas Pedersene76fede2020-04-30 10:25:50 -07007233static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7234 int sig_dbm, const u8 *buf, size_t len,
7235 u32 flags)
7236{
7237 return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7238 flags);
7239}
Jouni Malinen026331c2010-02-15 12:53:10 +02007240
7241/**
Johannes Berg2e161f782010-08-12 15:38:38 +02007242 * cfg80211_mgmt_tx_status - notification of TX status for management frame
Johannes Berg71bbc992012-06-15 15:30:18 +02007243 * @wdev: wireless device receiving the frame
Johannes Berg2e161f782010-08-12 15:38:38 +02007244 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
7245 * @buf: Management frame (header + body)
Jouni Malinen026331c2010-02-15 12:53:10 +02007246 * @len: length of the frame data
7247 * @ack: Whether frame was acknowledged
7248 * @gfp: context flags
7249 *
Johannes Berg2e161f782010-08-12 15:38:38 +02007250 * This function is called whenever a management frame was requested to be
7251 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
Jouni Malinen026331c2010-02-15 12:53:10 +02007252 * transmission attempt.
7253 */
Johannes Berg71bbc992012-06-15 15:30:18 +02007254void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
Johannes Berg2e161f782010-08-12 15:38:38 +02007255 const u8 *buf, size_t len, bool ack, gfp_t gfp);
Jouni Malinen026331c2010-02-15 12:53:10 +02007256
Markus Theildca9ca22020-05-08 16:42:00 +02007257/**
7258 * cfg80211_control_port_tx_status - notification of TX status for control
7259 * port frames
7260 * @wdev: wireless device receiving the frame
7261 * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7262 * @buf: Data frame (header + body)
7263 * @len: length of the frame data
7264 * @ack: Whether frame was acknowledged
7265 * @gfp: context flags
7266 *
7267 * This function is called whenever a control port frame was requested to be
7268 * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7269 * the transmission attempt.
7270 */
7271void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7272 const u8 *buf, size_t len, bool ack,
7273 gfp_t gfp);
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02007274
7275/**
Denis Kenzior6a671a52018-03-26 12:52:41 -05007276 * cfg80211_rx_control_port - notification about a received control port frame
7277 * @dev: The device the frame matched to
Denis Kenziora948f712018-07-03 15:05:48 -05007278 * @skb: The skbuf with the control port frame. It is assumed that the skbuf
7279 * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
7280 * This function does not take ownership of the skb, so the caller is
7281 * responsible for any cleanup. The caller must also ensure that
7282 * skb->protocol is set appropriately.
Denis Kenzior6a671a52018-03-26 12:52:41 -05007283 * @unencrypted: Whether the frame was received unencrypted
7284 *
7285 * This function is used to inform userspace about a received control port
7286 * frame. It should only be used if userspace indicated it wants to receive
7287 * control port frames over nl80211.
7288 *
7289 * The frame is the data portion of the 802.3 or 802.11 data frame with all
7290 * network layer headers removed (e.g. the raw EAPoL frame).
7291 *
7292 * Return: %true if the frame was passed to userspace
7293 */
7294bool cfg80211_rx_control_port(struct net_device *dev,
Denis Kenziora948f712018-07-03 15:05:48 -05007295 struct sk_buff *skb, bool unencrypted);
Denis Kenzior6a671a52018-03-26 12:52:41 -05007296
7297/**
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02007298 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7299 * @dev: network device
7300 * @rssi_event: the triggered RSSI event
Andrzej Zaborowskibee427b2017-01-25 12:43:41 +01007301 * @rssi_level: new RSSI level value or 0 if not available
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02007302 * @gfp: context flags
7303 *
7304 * This function is called when a configured connection quality monitoring
7305 * rssi threshold reached event occurs.
7306 */
7307void cfg80211_cqm_rssi_notify(struct net_device *dev,
7308 enum nl80211_cqm_rssi_threshold_event rssi_event,
Andrzej Zaborowskibee427b2017-01-25 12:43:41 +01007309 s32 rssi_level, gfp_t gfp);
Juuso Oikarinend6dc1a32010-03-23 09:02:33 +02007310
Johannes Bergc063dbf2010-11-24 08:10:05 +01007311/**
7312 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7313 * @dev: network device
7314 * @peer: peer's MAC address
7315 * @num_packets: how many packets were lost -- should be a fixed threshold
7316 * but probably no less than maybe 50, or maybe a throughput dependent
7317 * threshold (to account for temporary interference)
7318 * @gfp: context flags
7319 */
7320void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7321 const u8 *peer, u32 num_packets, gfp_t gfp);
7322
Johannes Berge5497d72011-07-05 16:35:40 +02007323/**
Thomas Pedersen84f10702012-07-12 16:17:33 -07007324 * cfg80211_cqm_txe_notify - TX error rate event
7325 * @dev: network device
7326 * @peer: peer's MAC address
7327 * @num_packets: how many packets were lost
7328 * @rate: % of packets which failed transmission
7329 * @intvl: interval (in s) over which the TX failure threshold was breached.
7330 * @gfp: context flags
7331 *
7332 * Notify userspace when configured % TX failures over number of packets in a
7333 * given interval is exceeded.
7334 */
7335void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
7336 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
7337
7338/**
Johannes Berg98f03342014-11-26 12:42:02 +01007339 * cfg80211_cqm_beacon_loss_notify - beacon loss event
7340 * @dev: network device
7341 * @gfp: context flags
7342 *
7343 * Notify userspace about beacon loss from the connected AP.
7344 */
7345void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
7346
7347/**
Johannes Berg5b97f492014-11-26 12:37:43 +01007348 * cfg80211_radar_event - radar detection event
7349 * @wiphy: the wiphy
7350 * @chandef: chandef for the current channel
7351 * @gfp: context flags
7352 *
7353 * This function is called when a radar is detected on the current chanenl.
7354 */
7355void cfg80211_radar_event(struct wiphy *wiphy,
7356 struct cfg80211_chan_def *chandef, gfp_t gfp);
7357
7358/**
tamizhr@codeaurora.org466b9932018-01-31 16:24:49 +05307359 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7360 * @dev: network device
7361 * @mac: MAC address of a station which opmode got modified
7362 * @sta_opmode: station's current opmode value
7363 * @gfp: context flags
7364 *
7365 * Driver should call this function when station's opmode modified via action
7366 * frame.
7367 */
7368void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7369 struct sta_opmode_info *sta_opmode,
7370 gfp_t gfp);
7371
7372/**
Johannes Berg5b97f492014-11-26 12:37:43 +01007373 * cfg80211_cac_event - Channel availability check (CAC) event
7374 * @netdev: network device
7375 * @chandef: chandef for the current channel
7376 * @event: type of event
7377 * @gfp: context flags
7378 *
7379 * This function is called when a Channel availability check (CAC) is finished
7380 * or aborted. This must be called to notify the completion of a CAC process,
7381 * also by full-MAC drivers.
7382 */
7383void cfg80211_cac_event(struct net_device *netdev,
7384 const struct cfg80211_chan_def *chandef,
7385 enum nl80211_radar_event event, gfp_t gfp);
7386
7387
7388/**
Johannes Berge5497d72011-07-05 16:35:40 +02007389 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7390 * @dev: network device
7391 * @bssid: BSSID of AP (to avoid races)
7392 * @replay_ctr: new replay counter
Johannes Bergaf71ff82011-07-09 14:48:30 +02007393 * @gfp: allocation flags
Johannes Berge5497d72011-07-05 16:35:40 +02007394 */
7395void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7396 const u8 *replay_ctr, gfp_t gfp);
7397
Jouni Malinenc9df56b2011-09-16 18:56:23 +03007398/**
7399 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7400 * @dev: network device
7401 * @index: candidate index (the smaller the index, the higher the priority)
7402 * @bssid: BSSID of AP
7403 * @preauth: Whether AP advertises support for RSN pre-authentication
7404 * @gfp: allocation flags
7405 */
7406void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7407 const u8 *bssid, bool preauth, gfp_t gfp);
7408
Johannes Berg28946da2011-11-04 11:18:12 +01007409/**
7410 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
7411 * @dev: The device the frame matched to
7412 * @addr: the transmitter address
7413 * @gfp: context flags
7414 *
7415 * This function is used in AP mode (only!) to inform userspace that
7416 * a spurious class 3 frame was received, to be able to deauth the
7417 * sender.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01007418 * Return: %true if the frame was passed to userspace (or this failed
Johannes Berg28946da2011-11-04 11:18:12 +01007419 * for a reason other than not having a subscription.)
7420 */
7421bool cfg80211_rx_spurious_frame(struct net_device *dev,
7422 const u8 *addr, gfp_t gfp);
7423
Johannes Berg7f6cf312011-11-04 11:18:15 +01007424/**
Johannes Bergb92ab5d2011-11-04 11:18:19 +01007425 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7426 * @dev: The device the frame matched to
7427 * @addr: the transmitter address
7428 * @gfp: context flags
7429 *
7430 * This function is used in AP mode (only!) to inform userspace that
7431 * an associated station sent a 4addr frame but that wasn't expected.
7432 * It is allowed and desirable to send this event only once for each
7433 * station to avoid event flooding.
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01007434 * Return: %true if the frame was passed to userspace (or this failed
Johannes Bergb92ab5d2011-11-04 11:18:19 +01007435 * for a reason other than not having a subscription.)
7436 */
7437bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7438 const u8 *addr, gfp_t gfp);
7439
7440/**
Johannes Berg7f6cf312011-11-04 11:18:15 +01007441 * cfg80211_probe_status - notify userspace about probe status
7442 * @dev: the device the probe was sent on
7443 * @addr: the address of the peer
7444 * @cookie: the cookie filled in @probe_client previously
7445 * @acked: indicates whether probe was acked or not
Venkateswara Naralasettyc4b50cd2018-02-13 11:03:06 +05307446 * @ack_signal: signal strength (in dBm) of the ACK frame.
7447 * @is_valid_ack_signal: indicates the ack_signal is valid or not.
Johannes Berg7f6cf312011-11-04 11:18:15 +01007448 * @gfp: allocation flags
7449 */
7450void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
Venkateswara Naralasettyc4b50cd2018-02-13 11:03:06 +05307451 u64 cookie, bool acked, s32 ack_signal,
7452 bool is_valid_ack_signal, gfp_t gfp);
Johannes Berg7f6cf312011-11-04 11:18:15 +01007453
Johannes Berg5e760232011-11-04 11:18:17 +01007454/**
Thomas Pedersene76fede2020-04-30 10:25:50 -07007455 * cfg80211_report_obss_beacon_khz - report beacon from other APs
7456 * @wiphy: The wiphy that received the beacon
7457 * @frame: the frame
7458 * @len: length of the frame
7459 * @freq: frequency the frame was received on in KHz
7460 * @sig_dbm: signal strength in dBm, or 0 if unknown
7461 *
7462 * Use this function to report to userspace when a beacon was
7463 * received. It is not useful to call this when there is no
7464 * netdev that is in AP/GO mode.
7465 */
7466void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7467 size_t len, int freq, int sig_dbm);
7468
7469/**
Johannes Berg5e760232011-11-04 11:18:17 +01007470 * cfg80211_report_obss_beacon - report beacon from other APs
7471 * @wiphy: The wiphy that received the beacon
7472 * @frame: the frame
7473 * @len: length of the frame
7474 * @freq: frequency the frame was received on
Sergey Matyukevich6c2fb1e2017-11-09 14:46:30 +03007475 * @sig_dbm: signal strength in dBm, or 0 if unknown
Johannes Berg5e760232011-11-04 11:18:17 +01007476 *
7477 * Use this function to report to userspace when a beacon was
7478 * received. It is not useful to call this when there is no
7479 * netdev that is in AP/GO mode.
7480 */
Thomas Pedersene76fede2020-04-30 10:25:50 -07007481static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
7482 const u8 *frame, size_t len,
7483 int freq, int sig_dbm)
7484{
7485 cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7486 sig_dbm);
7487}
Johannes Berg5e760232011-11-04 11:18:17 +01007488
Johannes Bergd58e7e32012-05-16 23:50:17 +02007489/**
Johannes Berg683b6d32012-11-08 21:25:48 +01007490 * cfg80211_reg_can_beacon - check if beaconing is allowed
Alexander Simon54858ee5b2011-11-30 16:56:32 +01007491 * @wiphy: the wiphy
Johannes Berg683b6d32012-11-08 21:25:48 +01007492 * @chandef: the channel definition
Ilan Peer174e0cd2014-02-23 09:13:01 +02007493 * @iftype: interface type
Johannes Bergd58e7e32012-05-16 23:50:17 +02007494 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01007495 * Return: %true if there is no secondary channel or the secondary channel(s)
7496 * can be used for beaconing (i.e. is not a radar channel etc.)
Alexander Simon54858ee5b2011-11-30 16:56:32 +01007497 */
Johannes Berg683b6d32012-11-08 21:25:48 +01007498bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
Ilan Peer174e0cd2014-02-23 09:13:01 +02007499 struct cfg80211_chan_def *chandef,
7500 enum nl80211_iftype iftype);
Alexander Simon54858ee5b2011-11-30 16:56:32 +01007501
Arik Nemtsov923b3522015-07-08 15:41:44 +03007502/**
7503 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7504 * @wiphy: the wiphy
7505 * @chandef: the channel definition
7506 * @iftype: interface type
7507 *
7508 * Return: %true if there is no secondary channel or the secondary channel(s)
7509 * can be used for beaconing (i.e. is not a radar channel etc.). This version
7510 * also checks if IR-relaxation conditions apply, to allow beaconing under
7511 * more permissive conditions.
7512 *
7513 * Requires the RTNL to be held.
7514 */
7515bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7516 struct cfg80211_chan_def *chandef,
7517 enum nl80211_iftype iftype);
7518
Thomas Pedersen8097e142012-03-05 15:31:47 -08007519/*
Thomas Pedersen53145262012-04-06 13:35:47 -07007520 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
7521 * @dev: the device which switched channels
Johannes Berg683b6d32012-11-08 21:25:48 +01007522 * @chandef: the new channel definition
Thomas Pedersen53145262012-04-06 13:35:47 -07007523 *
Simon Wunderliche487eae2013-11-21 18:19:51 +01007524 * Caller must acquire wdev_lock, therefore must only be called from sleepable
7525 * driver context!
Thomas Pedersen53145262012-04-06 13:35:47 -07007526 */
Johannes Berg683b6d32012-11-08 21:25:48 +01007527void cfg80211_ch_switch_notify(struct net_device *dev,
7528 struct cfg80211_chan_def *chandef);
Thomas Pedersen53145262012-04-06 13:35:47 -07007529
Luciano Coelhof8d75522014-11-07 14:31:35 +02007530/*
7531 * cfg80211_ch_switch_started_notify - notify channel switch start
7532 * @dev: the device on which the channel switch started
7533 * @chandef: the future channel definition
7534 * @count: the number of TBTTs until the channel switch happens
Johannes Berg669b8412020-11-29 17:30:55 +02007535 * @quiet: whether or not immediate quiet was requested by the AP
Luciano Coelhof8d75522014-11-07 14:31:35 +02007536 *
7537 * Inform the userspace about the channel switch that has just
7538 * started, so that it can take appropriate actions (eg. starting
7539 * channel switch on other vifs), if necessary.
7540 */
7541void cfg80211_ch_switch_started_notify(struct net_device *dev,
7542 struct cfg80211_chan_def *chandef,
Johannes Berg669b8412020-11-29 17:30:55 +02007543 u8 count, bool quiet);
Luciano Coelhof8d75522014-11-07 14:31:35 +02007544
Johannes Berg1ce3e822012-08-01 17:00:55 +02007545/**
7546 * ieee80211_operating_class_to_band - convert operating class to band
7547 *
7548 * @operating_class: the operating class to convert
7549 * @band: band pointer to fill
7550 *
7551 * Returns %true if the conversion was successful, %false otherwise.
7552 */
7553bool ieee80211_operating_class_to_band(u8 operating_class,
Johannes Berg57fbcce2016-04-12 15:56:15 +02007554 enum nl80211_band *band);
Johannes Berg1ce3e822012-08-01 17:00:55 +02007555
Arik Nemtsova38700d2015-03-18 08:46:08 +02007556/**
7557 * ieee80211_chandef_to_operating_class - convert chandef to operation class
7558 *
7559 * @chandef: the chandef to convert
7560 * @op_class: a pointer to the resulting operating class
7561 *
7562 * Returns %true if the conversion was successful, %false otherwise.
7563 */
7564bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7565 u8 *op_class);
7566
Thomas Pedersen934f4c72020-04-01 18:18:03 -07007567/**
7568 * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7569 *
7570 * @chandef: the chandef to convert
7571 *
7572 * Returns the center frequency of chandef (1st segment) in KHz.
7573 */
7574static inline u32
7575ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7576{
7577 return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7578}
7579
Thomas Pedersen53145262012-04-06 13:35:47 -07007580/*
Jouni Malinen3475b092012-11-16 22:49:57 +02007581 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
7582 * @dev: the device on which the operation is requested
7583 * @peer: the MAC address of the peer device
7584 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
7585 * NL80211_TDLS_TEARDOWN)
7586 * @reason_code: the reason code for teardown request
7587 * @gfp: allocation flags
7588 *
7589 * This function is used to request userspace to perform TDLS operation that
7590 * requires knowledge of keys, i.e., link setup or teardown when the AP
7591 * connection uses encryption. This is optional mechanism for the driver to use
7592 * if it can automatically determine when a TDLS link could be useful (e.g.,
7593 * based on traffic and signal strength for a peer).
7594 */
7595void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
7596 enum nl80211_tdls_operation oper,
7597 u16 reason_code, gfp_t gfp);
7598
7599/*
Thomas Pedersen8097e142012-03-05 15:31:47 -08007600 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
7601 * @rate: given rate_info to calculate bitrate from
7602 *
7603 * return 0 if MCS index >= 32
7604 */
Vladimir Kondratiev8eb41c82012-07-05 14:25:49 +03007605u32 cfg80211_calculate_bitrate(struct rate_info *rate);
Thomas Pedersen8097e142012-03-05 15:31:47 -08007606
Johannes Berg98104fde2012-06-16 00:19:54 +02007607/**
7608 * cfg80211_unregister_wdev - remove the given wdev
7609 * @wdev: struct wireless_dev to remove
7610 *
7611 * Call this function only for wdevs that have no netdev assigned,
7612 * e.g. P2P Devices. It removes the device from the list so that
7613 * it can no longer be used. It is necessary to call this function
7614 * even when cfg80211 requests the removal of the interface by
7615 * calling the del_virtual_intf() callback. The function must also
7616 * be called when the driver wishes to unregister the wdev, e.g.
7617 * when the device is unbound from the driver.
7618 *
7619 * Requires the RTNL to be held.
7620 */
7621void cfg80211_unregister_wdev(struct wireless_dev *wdev);
7622
Johannes Berg0ee45352012-10-29 19:48:40 +01007623/**
Mauro Carvalho Chehabb1e8eb12020-10-23 18:33:08 +02007624 * struct cfg80211_ft_event_params - FT Information Elements
Jouni Malinen355199e2013-02-27 17:14:27 +02007625 * @ies: FT IEs
7626 * @ies_len: length of the FT IE in bytes
7627 * @target_ap: target AP's MAC address
7628 * @ric_ies: RIC IE
7629 * @ric_ies_len: length of the RIC IE in bytes
7630 */
7631struct cfg80211_ft_event_params {
7632 const u8 *ies;
7633 size_t ies_len;
7634 const u8 *target_ap;
7635 const u8 *ric_ies;
7636 size_t ric_ies_len;
7637};
7638
7639/**
7640 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7641 * @netdev: network device
7642 * @ft_event: IE information
7643 */
7644void cfg80211_ft_event(struct net_device *netdev,
7645 struct cfg80211_ft_event_params *ft_event);
7646
7647/**
Johannes Berg0ee45352012-10-29 19:48:40 +01007648 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
7649 * @ies: the input IE buffer
7650 * @len: the input length
7651 * @attr: the attribute ID to find
7652 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
7653 * if the function is only called to get the needed buffer size
7654 * @bufsize: size of the output buffer
7655 *
7656 * The function finds a given P2P attribute in the (vendor) IEs and
7657 * copies its contents to the given buffer.
7658 *
Yacine Belkadi0ae997d2013-01-12 13:54:14 +01007659 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
7660 * malformed or the attribute can't be found (respectively), or the
7661 * length of the found attribute (which can be zero).
Johannes Berg0ee45352012-10-29 19:48:40 +01007662 */
Arend van Sprielc216e642012-11-25 19:13:28 +01007663int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7664 enum ieee80211_p2p_attr_id attr,
7665 u8 *buf, unsigned int bufsize);
Johannes Berg0ee45352012-10-29 19:48:40 +01007666
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01007667/**
Johannes Berg29464cc2015-03-31 15:36:22 +02007668 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
7669 * @ies: the IE buffer
7670 * @ielen: the length of the IE buffer
7671 * @ids: an array with element IDs that are allowed before
Liad Kaufman2512b1b2017-08-05 11:44:31 +03007672 * the split. A WLAN_EID_EXTENSION value means that the next
7673 * EID in the list is a sub-element of the EXTENSION IE.
Johannes Berg29464cc2015-03-31 15:36:22 +02007674 * @n_ids: the size of the element ID array
7675 * @after_ric: array IE types that come after the RIC element
7676 * @n_after_ric: size of the @after_ric array
7677 * @offset: offset where to start splitting in the buffer
7678 *
7679 * This function splits an IE buffer by updating the @offset
7680 * variable to point to the location where the buffer should be
7681 * split.
7682 *
7683 * It assumes that the given IE buffer is well-formed, this
7684 * has to be guaranteed by the caller!
7685 *
7686 * It also assumes that the IEs in the buffer are ordered
7687 * correctly, if not the result of using this function will not
7688 * be ordered correctly either, i.e. it does no reordering.
7689 *
7690 * The function returns the offset where the next part of the
7691 * buffer starts, which may be @ielen if the entire (remainder)
7692 * of the buffer should be used.
7693 */
7694size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
7695 const u8 *ids, int n_ids,
7696 const u8 *after_ric, int n_after_ric,
7697 size_t offset);
7698
7699/**
7700 * ieee80211_ie_split - split an IE buffer according to ordering
7701 * @ies: the IE buffer
7702 * @ielen: the length of the IE buffer
7703 * @ids: an array with element IDs that are allowed before
Liad Kaufman2512b1b2017-08-05 11:44:31 +03007704 * the split. A WLAN_EID_EXTENSION value means that the next
7705 * EID in the list is a sub-element of the EXTENSION IE.
Johannes Berg29464cc2015-03-31 15:36:22 +02007706 * @n_ids: the size of the element ID array
7707 * @offset: offset where to start splitting in the buffer
7708 *
7709 * This function splits an IE buffer by updating the @offset
7710 * variable to point to the location where the buffer should be
7711 * split.
7712 *
7713 * It assumes that the given IE buffer is well-formed, this
7714 * has to be guaranteed by the caller!
7715 *
7716 * It also assumes that the IEs in the buffer are ordered
7717 * correctly, if not the result of using this function will not
7718 * be ordered correctly either, i.e. it does no reordering.
7719 *
7720 * The function returns the offset where the next part of the
7721 * buffer starts, which may be @ielen if the entire (remainder)
7722 * of the buffer should be used.
7723 */
Johannes Berg0483eea2015-10-23 09:50:03 +02007724static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
7725 const u8 *ids, int n_ids, size_t offset)
7726{
7727 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
7728}
Johannes Berg29464cc2015-03-31 15:36:22 +02007729
7730/**
Johannes Bergcd8f7cb2013-01-22 12:34:29 +01007731 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7732 * @wdev: the wireless device reporting the wakeup
7733 * @wakeup: the wakeup report
7734 * @gfp: allocation flags
7735 *
7736 * This function reports that the given device woke up. If it
7737 * caused the wakeup, report the reason(s), otherwise you may
7738 * pass %NULL as the @wakeup parameter to advertise that something
7739 * else caused the wakeup.
7740 */
7741void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7742 struct cfg80211_wowlan_wakeup *wakeup,
7743 gfp_t gfp);
7744
Arend van Spriel5de17982013-04-18 15:49:00 +02007745/**
7746 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
7747 *
7748 * @wdev: the wireless device for which critical protocol is stopped.
Robert P. J. Day03f831a2013-05-02 07:15:09 -04007749 * @gfp: allocation flags
Arend van Spriel5de17982013-04-18 15:49:00 +02007750 *
7751 * This function can be called by the driver to indicate it has reverted
7752 * operation back to normal. One reason could be that the duration given
7753 * by .crit_proto_start() has expired.
7754 */
7755void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
7756
Ilan Peerbdfbec22014-01-09 11:37:23 +02007757/**
7758 * ieee80211_get_num_supported_channels - get number of channels device has
7759 * @wiphy: the wiphy
7760 *
7761 * Return: the number of channels supported by the device.
7762 */
7763unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7764
Luciano Coelhocb2d9562014-02-17 16:52:35 +02007765/**
7766 * cfg80211_check_combinations - check interface combinations
7767 *
7768 * @wiphy: the wiphy
Purushottam Kushwahae2273002016-10-12 18:25:35 +05307769 * @params: the interface combinations parameter
Luciano Coelhocb2d9562014-02-17 16:52:35 +02007770 *
7771 * This function can be called by the driver to check whether a
7772 * combination of interfaces and their types are allowed according to
7773 * the interface combinations.
7774 */
7775int cfg80211_check_combinations(struct wiphy *wiphy,
Purushottam Kushwahae2273002016-10-12 18:25:35 +05307776 struct iface_combination_params *params);
Luciano Coelhocb2d9562014-02-17 16:52:35 +02007777
Michal Kazior65a124d2014-04-09 15:29:22 +02007778/**
7779 * cfg80211_iter_combinations - iterate over matching combinations
7780 *
7781 * @wiphy: the wiphy
Purushottam Kushwahae2273002016-10-12 18:25:35 +05307782 * @params: the interface combinations parameter
Michal Kazior65a124d2014-04-09 15:29:22 +02007783 * @iter: function to call for each matching combination
7784 * @data: pointer to pass to iter function
7785 *
7786 * This function can be called by the driver to check what possible
7787 * combinations it fits in at a given moment, e.g. for channel switching
7788 * purposes.
7789 */
7790int cfg80211_iter_combinations(struct wiphy *wiphy,
Purushottam Kushwahae2273002016-10-12 18:25:35 +05307791 struct iface_combination_params *params,
Michal Kazior65a124d2014-04-09 15:29:22 +02007792 void (*iter)(const struct ieee80211_iface_combination *c,
7793 void *data),
7794 void *data);
7795
Michal Kaziorf04c2202014-04-09 15:11:01 +02007796/*
7797 * cfg80211_stop_iface - trigger interface disconnection
7798 *
7799 * @wiphy: the wiphy
7800 * @wdev: wireless device
7801 * @gfp: context flags
7802 *
7803 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7804 * disconnected.
7805 *
7806 * Note: This doesn't need any locks and is asynchronous.
7807 */
7808void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7809 gfp_t gfp);
7810
Johannes Bergf6837ba82014-04-30 14:19:04 +02007811/**
7812 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7813 * @wiphy: the wiphy to shut down
7814 *
7815 * This function shuts down all interfaces belonging to this wiphy by
7816 * calling dev_close() (and treating non-netdev interfaces as needed).
7817 * It shouldn't really be used unless there are some fatal device errors
7818 * that really can't be recovered in any other way.
7819 *
7820 * Callers must hold the RTNL and be able to deal with callbacks into
7821 * the driver while the function is running.
7822 */
7823void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7824
Gautam Kumar Shuklad75bb062014-12-23 16:55:19 +01007825/**
7826 * wiphy_ext_feature_set - set the extended feature flag
7827 *
7828 * @wiphy: the wiphy to modify.
7829 * @ftidx: extended feature bit index.
7830 *
7831 * The extended features are flagged in multiple bytes (see
7832 * &struct wiphy.@ext_features)
7833 */
7834static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7835 enum nl80211_ext_feature_index ftidx)
7836{
7837 u8 *ft_byte;
7838
7839 ft_byte = &wiphy->ext_features[ftidx / 8];
7840 *ft_byte |= BIT(ftidx % 8);
7841}
7842
7843/**
7844 * wiphy_ext_feature_isset - check the extended feature flag
7845 *
7846 * @wiphy: the wiphy to modify.
7847 * @ftidx: extended feature bit index.
7848 *
7849 * The extended features are flagged in multiple bytes (see
7850 * &struct wiphy.@ext_features)
7851 */
7852static inline bool
7853wiphy_ext_feature_isset(struct wiphy *wiphy,
7854 enum nl80211_ext_feature_index ftidx)
7855{
7856 u8 ft_byte;
7857
7858 ft_byte = wiphy->ext_features[ftidx / 8];
7859 return (ft_byte & BIT(ftidx % 8)) != 0;
7860}
Johannes Bergb7ffbd72014-06-04 17:31:56 +02007861
Ayala Bekera442b762016-09-20 17:31:15 +03007862/**
7863 * cfg80211_free_nan_func - free NAN function
7864 * @f: NAN function that should be freed
7865 *
7866 * Frees all the NAN function and all it's allocated members.
7867 */
7868void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7869
Ayala Beker50bcd312016-09-20 17:31:17 +03007870/**
7871 * struct cfg80211_nan_match_params - NAN match parameters
7872 * @type: the type of the function that triggered a match. If it is
7873 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
7874 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
7875 * result.
7876 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
7877 * @inst_id: the local instance id
7878 * @peer_inst_id: the instance id of the peer's function
7879 * @addr: the MAC address of the peer
7880 * @info_len: the length of the &info
7881 * @info: the Service Specific Info from the peer (if any)
7882 * @cookie: unique identifier of the corresponding function
7883 */
7884struct cfg80211_nan_match_params {
7885 enum nl80211_nan_function_type type;
7886 u8 inst_id;
7887 u8 peer_inst_id;
7888 const u8 *addr;
7889 u8 info_len;
7890 const u8 *info;
7891 u64 cookie;
7892};
7893
7894/**
7895 * cfg80211_nan_match - report a match for a NAN function.
7896 * @wdev: the wireless device reporting the match
7897 * @match: match notification parameters
7898 * @gfp: allocation flags
7899 *
7900 * This function reports that the a NAN function had a match. This
7901 * can be a subscribe that had a match or a solicited publish that
7902 * was sent. It can also be a follow up that was received.
7903 */
7904void cfg80211_nan_match(struct wireless_dev *wdev,
7905 struct cfg80211_nan_match_params *match, gfp_t gfp);
7906
Ayala Beker368e5a72016-09-20 17:31:18 +03007907/**
7908 * cfg80211_nan_func_terminated - notify about NAN function termination.
7909 *
7910 * @wdev: the wireless device reporting the match
7911 * @inst_id: the local instance id
7912 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7913 * @cookie: unique NAN function identifier
7914 * @gfp: allocation flags
7915 *
7916 * This function reports that the a NAN function is terminated.
7917 */
7918void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7919 u8 inst_id,
7920 enum nl80211_nan_func_term_reason reason,
7921 u64 cookie, gfp_t gfp);
7922
Johannes Bergb7ffbd72014-06-04 17:31:56 +02007923/* ethtool helper */
7924void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7925
Srinivas Dasari40cbfa92018-01-25 17:13:38 +02007926/**
7927 * cfg80211_external_auth_request - userspace request for authentication
7928 * @netdev: network device
7929 * @params: External authentication parameters
7930 * @gfp: allocation flags
7931 * Returns: 0 on success, < 0 on error
7932 */
7933int cfg80211_external_auth_request(struct net_device *netdev,
7934 struct cfg80211_external_auth_params *params,
7935 gfp_t gfp);
7936
Johannes Berg9bb7e0f2018-09-10 13:29:12 +02007937/**
7938 * cfg80211_pmsr_report - report peer measurement result data
7939 * @wdev: the wireless device reporting the measurement
7940 * @req: the original measurement request
7941 * @result: the result data
7942 * @gfp: allocation flags
7943 */
7944void cfg80211_pmsr_report(struct wireless_dev *wdev,
7945 struct cfg80211_pmsr_request *req,
7946 struct cfg80211_pmsr_result *result,
7947 gfp_t gfp);
7948
7949/**
7950 * cfg80211_pmsr_complete - report peer measurement completed
7951 * @wdev: the wireless device reporting the measurement
7952 * @req: the original measurement request
7953 * @gfp: allocation flags
7954 *
7955 * Report that the entire measurement completed, after this
7956 * the request pointer will no longer be valid.
7957 */
7958void cfg80211_pmsr_complete(struct wireless_dev *wdev,
7959 struct cfg80211_pmsr_request *req,
7960 gfp_t gfp);
7961
Manikanta Pubbisettye6f40512019-07-22 12:44:50 +05307962/**
7963 * cfg80211_iftype_allowed - check whether the interface can be allowed
7964 * @wiphy: the wiphy
7965 * @iftype: interface type
7966 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
7967 * @check_swif: check iftype against software interfaces
7968 *
7969 * Check whether the interface is allowed to operate; additionally, this API
7970 * can be used to check iftype against the software interfaces when
7971 * check_swif is '1'.
7972 */
7973bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
7974 bool is_4addr, u8 check_swif);
7975
7976
Joe Perchese1db74f2010-07-26 14:39:57 -07007977/* Logging, debugging and troubleshooting/diagnostic helpers. */
7978
7979/* wiphy_printk helpers, similar to dev_printk */
7980
7981#define wiphy_printk(level, wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07007982 dev_printk(level, &(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07007983#define wiphy_emerg(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07007984 dev_emerg(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07007985#define wiphy_alert(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07007986 dev_alert(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07007987#define wiphy_crit(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07007988 dev_crit(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07007989#define wiphy_err(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07007990 dev_err(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07007991#define wiphy_warn(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07007992 dev_warn(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07007993#define wiphy_notice(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07007994 dev_notice(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07007995#define wiphy_info(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07007996 dev_info(&(wiphy)->dev, format, ##args)
Joe Perches073730d2010-07-26 14:40:00 -07007997
Stanislaw Gruszkaa58d7522019-03-12 10:51:40 +01007998#define wiphy_err_ratelimited(wiphy, format, args...) \
7999 dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8000#define wiphy_warn_ratelimited(wiphy, format, args...) \
8001 dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8002
Joe Perches9c376632010-08-20 15:13:59 -07008003#define wiphy_debug(wiphy, format, args...) \
Joe Perchese1db74f2010-07-26 14:39:57 -07008004 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
Joe Perches9c376632010-08-20 15:13:59 -07008005
Joe Perchese1db74f2010-07-26 14:39:57 -07008006#define wiphy_dbg(wiphy, format, args...) \
Joe Perches9c376632010-08-20 15:13:59 -07008007 dev_dbg(&(wiphy)->dev, format, ##args)
Joe Perchese1db74f2010-07-26 14:39:57 -07008008
8009#if defined(VERBOSE_DEBUG)
8010#define wiphy_vdbg wiphy_dbg
8011#else
Joe Perchese1db74f2010-07-26 14:39:57 -07008012#define wiphy_vdbg(wiphy, format, args...) \
8013({ \
8014 if (0) \
8015 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
Joe Perches9c376632010-08-20 15:13:59 -07008016 0; \
Joe Perchese1db74f2010-07-26 14:39:57 -07008017})
8018#endif
8019
8020/*
8021 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8022 * of using a WARN/WARN_ON to get the message out, including the
8023 * file/line information and a backtrace.
8024 */
8025#define wiphy_WARN(wiphy, format, args...) \
8026 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8027
Sunil Duttcb74e972019-02-20 16:18:07 +05308028/**
8029 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8030 * @netdev: network device
8031 * @owe_info: peer's owe info
8032 * @gfp: allocation flags
8033 */
8034void cfg80211_update_owe_info_event(struct net_device *netdev,
8035 struct cfg80211_update_owe_info *owe_info,
8036 gfp_t gfp);
8037
Emmanuel Grumbach2f1805e2020-06-25 14:15:24 +03008038/**
8039 * cfg80211_bss_flush - resets all the scan entries
8040 * @wiphy: the wiphy
8041 */
8042void cfg80211_bss_flush(struct wiphy *wiphy);
8043
Johannes Berg704232c2007-04-23 12:20:05 -07008044#endif /* __NET_CFG80211_H */