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