1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __NET_CFG80211_H
3 #define __NET_CFG80211_H
5 * 802.11 device and configuration interface
7 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
8 * Copyright 2013-2014 Intel Mobile Communications GmbH
9 * Copyright 2015-2017 Intel Deutschland GmbH
10 * Copyright (C) 2018-2021 Intel Corporation
13 #include <linux/ethtool.h>
14 #include <uapi/linux/rfkill.h>
15 #include <linux/netdevice.h>
16 #include <linux/debugfs.h>
17 #include <linux/list.h>
18 #include <linux/bug.h>
19 #include <linux/netlink.h>
20 #include <linux/skbuff.h>
21 #include <linux/nl80211.h>
22 #include <linux/if_ether.h>
23 #include <linux/ieee80211.h>
24 #include <linux/net.h>
25 #include <linux/rfkill.h>
26 #include <net/regulatory.h>
31 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
32 * userspace and drivers, and offers some utility functionality associated
33 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
34 * by all modern wireless drivers in Linux, so that they offer a consistent
35 * API through nl80211. For backward compatibility, cfg80211 also offers
36 * wireless extensions to userspace, but hides them from drivers completely.
38 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
44 * DOC: Device registration
46 * In order for a driver to use cfg80211, it must register the hardware device
47 * with cfg80211. This happens through a number of hardware capability structs
50 * The fundamental structure for each device is the 'wiphy', of which each
51 * instance describes a physical wireless device connected to the system. Each
52 * such wiphy can have zero, one, or many virtual interfaces associated with
53 * it, which need to be identified as such by pointing the network interface's
54 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
55 * the wireless part of the interface, normally this struct is embedded in the
56 * network interface's private data area. Drivers can optionally allow creating
57 * or destroying virtual interfaces on the fly, but without at least one or the
58 * ability to create some the wireless device isn't useful.
60 * Each wiphy structure contains device capability information, and also has
61 * a pointer to the various operations the driver offers. The definitions and
62 * structures here describe these capabilities in detail.
68 * wireless hardware capability structures
72 * enum ieee80211_channel_flags - channel flags
74 * Channel flags set by the regulatory control code.
76 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
77 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
78 * sending probe requests or beaconing.
79 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
80 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
82 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
84 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
85 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
86 * this flag indicates that an 80 MHz channel cannot use this
87 * channel as the control or any of the secondary channels.
88 * This may be due to the driver or due to regulatory bandwidth
90 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
91 * this flag indicates that an 160 MHz channel cannot use this
92 * channel as the control or any of the secondary channels.
93 * This may be due to the driver or due to regulatory bandwidth
95 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
96 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
97 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
99 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
101 * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
102 * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
104 * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
106 * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
108 * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
110 * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
114 enum ieee80211_channel_flags {
115 IEEE80211_CHAN_DISABLED = 1<<0,
116 IEEE80211_CHAN_NO_IR = 1<<1,
118 IEEE80211_CHAN_RADAR = 1<<3,
119 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
120 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
121 IEEE80211_CHAN_NO_OFDM = 1<<6,
122 IEEE80211_CHAN_NO_80MHZ = 1<<7,
123 IEEE80211_CHAN_NO_160MHZ = 1<<8,
124 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
125 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
126 IEEE80211_CHAN_NO_20MHZ = 1<<11,
127 IEEE80211_CHAN_NO_10MHZ = 1<<12,
128 IEEE80211_CHAN_NO_HE = 1<<13,
129 IEEE80211_CHAN_1MHZ = 1<<14,
130 IEEE80211_CHAN_2MHZ = 1<<15,
131 IEEE80211_CHAN_4MHZ = 1<<16,
132 IEEE80211_CHAN_8MHZ = 1<<17,
133 IEEE80211_CHAN_16MHZ = 1<<18,
136 #define IEEE80211_CHAN_NO_HT40 \
137 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
139 #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
140 #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
143 * struct ieee80211_channel - channel definition
145 * This structure describes a single channel for use
148 * @center_freq: center frequency in MHz
149 * @freq_offset: offset from @center_freq, in KHz
150 * @hw_value: hardware-specific value for the channel
151 * @flags: channel flags from &enum ieee80211_channel_flags.
152 * @orig_flags: channel flags at registration time, used by regulatory
153 * code to support devices with additional restrictions
154 * @band: band this channel belongs to.
155 * @max_antenna_gain: maximum antenna gain in dBi
156 * @max_power: maximum transmission power (in dBm)
157 * @max_reg_power: maximum regulatory transmission power (in dBm)
158 * @beacon_found: helper to regulatory code to indicate when a beacon
159 * has been found on this channel. Use regulatory_hint_found_beacon()
160 * to enable this, this is useful only on 5 GHz band.
161 * @orig_mag: internal use
162 * @orig_mpwr: internal use
163 * @dfs_state: current state of this channel. Only relevant if radar is required
165 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
166 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
168 struct ieee80211_channel {
169 enum nl80211_band band;
174 int max_antenna_gain;
179 int orig_mag, orig_mpwr;
180 enum nl80211_dfs_state dfs_state;
181 unsigned long dfs_state_entered;
182 unsigned int dfs_cac_ms;
186 * enum ieee80211_rate_flags - rate flags
188 * Hardware/specification flags for rates. These are structured
189 * in a way that allows using the same bitrate structure for
190 * different bands/PHY modes.
192 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
193 * preamble on this bitrate; only relevant in 2.4GHz band and
195 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
196 * when used with 802.11a (on the 5 GHz band); filled by the
197 * core code when registering the wiphy.
198 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
199 * when used with 802.11b (on the 2.4 GHz band); filled by the
200 * core code when registering the wiphy.
201 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
202 * when used with 802.11g (on the 2.4 GHz band); filled by the
203 * core code when registering the wiphy.
204 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
205 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
206 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
208 enum ieee80211_rate_flags {
209 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
210 IEEE80211_RATE_MANDATORY_A = 1<<1,
211 IEEE80211_RATE_MANDATORY_B = 1<<2,
212 IEEE80211_RATE_MANDATORY_G = 1<<3,
213 IEEE80211_RATE_ERP_G = 1<<4,
214 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
215 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
219 * enum ieee80211_bss_type - BSS type filter
221 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
222 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
223 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
224 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
225 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
227 enum ieee80211_bss_type {
228 IEEE80211_BSS_TYPE_ESS,
229 IEEE80211_BSS_TYPE_PBSS,
230 IEEE80211_BSS_TYPE_IBSS,
231 IEEE80211_BSS_TYPE_MBSS,
232 IEEE80211_BSS_TYPE_ANY
236 * enum ieee80211_privacy - BSS privacy filter
238 * @IEEE80211_PRIVACY_ON: privacy bit set
239 * @IEEE80211_PRIVACY_OFF: privacy bit clear
240 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
242 enum ieee80211_privacy {
243 IEEE80211_PRIVACY_ON,
244 IEEE80211_PRIVACY_OFF,
245 IEEE80211_PRIVACY_ANY
248 #define IEEE80211_PRIVACY(x) \
249 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
252 * struct ieee80211_rate - bitrate definition
254 * This structure describes a bitrate that an 802.11 PHY can
255 * operate with. The two values @hw_value and @hw_value_short
256 * are only for driver use when pointers to this structure are
259 * @flags: rate-specific flags
260 * @bitrate: bitrate in units of 100 Kbps
261 * @hw_value: driver/hardware value for this rate
262 * @hw_value_short: driver/hardware value for this rate when
263 * short preamble is used
265 struct ieee80211_rate {
268 u16 hw_value, hw_value_short;
272 * struct ieee80211_he_obss_pd - AP settings for spatial reuse
274 * @enable: is the feature enabled.
275 * @sr_ctrl: The SR Control field of SRP element.
276 * @non_srg_max_offset: non-SRG maximum tx power offset
277 * @min_offset: minimal tx power offset an associated station shall use
278 * @max_offset: maximum tx power offset an associated station shall use
279 * @bss_color_bitmap: bitmap that indicates the BSS color values used by
281 * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
282 * used by members of the SRG
284 struct ieee80211_he_obss_pd {
287 u8 non_srg_max_offset;
290 u8 bss_color_bitmap[8];
291 u8 partial_bssid_bitmap[8];
295 * struct cfg80211_he_bss_color - AP settings for BSS coloring
297 * @color: the current color.
298 * @enabled: HE BSS color is used
299 * @partial: define the AID equation.
301 struct cfg80211_he_bss_color {
308 * struct ieee80211_sta_ht_cap - STA's HT capabilities
310 * This structure describes most essential parameters needed
311 * to describe 802.11n HT capabilities for an STA.
313 * @ht_supported: is HT supported by the STA
314 * @cap: HT capabilities map as described in 802.11n spec
315 * @ampdu_factor: Maximum A-MPDU length factor
316 * @ampdu_density: Minimum A-MPDU spacing
317 * @mcs: Supported MCS rates
319 struct ieee80211_sta_ht_cap {
320 u16 cap; /* use IEEE80211_HT_CAP_ */
324 struct ieee80211_mcs_info mcs;
328 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
330 * This structure describes most essential parameters needed
331 * to describe 802.11ac VHT capabilities for an STA.
333 * @vht_supported: is VHT supported by the STA
334 * @cap: VHT capabilities map as described in 802.11ac spec
335 * @vht_mcs: Supported VHT MCS rates
337 struct ieee80211_sta_vht_cap {
339 u32 cap; /* use IEEE80211_VHT_CAP_ */
340 struct ieee80211_vht_mcs_info vht_mcs;
343 #define IEEE80211_HE_PPE_THRES_MAX_LEN 25
346 * struct ieee80211_sta_he_cap - STA's HE capabilities
348 * This structure describes most essential parameters needed
349 * to describe 802.11ax HE capabilities for a STA.
351 * @has_he: true iff HE data is valid.
352 * @he_cap_elem: Fixed portion of the HE capabilities element.
353 * @he_mcs_nss_supp: The supported NSS/MCS combinations.
354 * @ppe_thres: Holds the PPE Thresholds data.
356 struct ieee80211_sta_he_cap {
358 struct ieee80211_he_cap_elem he_cap_elem;
359 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
360 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
364 * struct ieee80211_sband_iftype_data - sband data per interface type
366 * This structure encapsulates sband data that is relevant for the
367 * interface types defined in @types_mask. Each type in the
368 * @types_mask must be unique across all instances of iftype_data.
370 * @types_mask: interface types mask
371 * @he_cap: holds the HE capabilities
372 * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
373 * 6 GHz band channel (and 0 may be valid value).
374 * @vendor_elems: vendor element(s) to advertise
375 * @vendor_elems.data: vendor element(s) data
376 * @vendor_elems.len: vendor element(s) length
378 struct ieee80211_sband_iftype_data {
380 struct ieee80211_sta_he_cap he_cap;
381 struct ieee80211_he_6ghz_capa he_6ghz_capa;
389 * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
391 * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
392 * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
393 * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
394 * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
395 * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
396 * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
397 * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
398 * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
400 * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
402 * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
404 * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
405 * and 4.32GHz + 4.32GHz
406 * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
407 * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
409 enum ieee80211_edmg_bw_config {
410 IEEE80211_EDMG_BW_CONFIG_4 = 4,
411 IEEE80211_EDMG_BW_CONFIG_5 = 5,
412 IEEE80211_EDMG_BW_CONFIG_6 = 6,
413 IEEE80211_EDMG_BW_CONFIG_7 = 7,
414 IEEE80211_EDMG_BW_CONFIG_8 = 8,
415 IEEE80211_EDMG_BW_CONFIG_9 = 9,
416 IEEE80211_EDMG_BW_CONFIG_10 = 10,
417 IEEE80211_EDMG_BW_CONFIG_11 = 11,
418 IEEE80211_EDMG_BW_CONFIG_12 = 12,
419 IEEE80211_EDMG_BW_CONFIG_13 = 13,
420 IEEE80211_EDMG_BW_CONFIG_14 = 14,
421 IEEE80211_EDMG_BW_CONFIG_15 = 15,
425 * struct ieee80211_edmg - EDMG configuration
427 * This structure describes most essential parameters needed
428 * to describe 802.11ay EDMG configuration
430 * @channels: bitmap that indicates the 2.16 GHz channel(s)
431 * that are allowed to be used for transmissions.
432 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
433 * Set to 0 indicate EDMG not supported.
434 * @bw_config: Channel BW Configuration subfield encodes
435 * the allowed channel bandwidth configurations
437 struct ieee80211_edmg {
439 enum ieee80211_edmg_bw_config bw_config;
443 * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
445 * This structure describes most essential parameters needed
446 * to describe 802.11ah S1G capabilities for a STA.
448 * @s1g_supported: is STA an S1G STA
449 * @cap: S1G capabilities information
450 * @nss_mcs: Supported NSS MCS set
452 struct ieee80211_sta_s1g_cap {
454 u8 cap[10]; /* use S1G_CAPAB_ */
459 * struct ieee80211_supported_band - frequency band definition
461 * This structure describes a frequency band a wiphy
462 * is able to operate in.
464 * @channels: Array of channels the hardware can operate with
466 * @band: the band this structure represents
467 * @n_channels: Number of channels in @channels
468 * @bitrates: Array of bitrates the hardware can operate with
469 * in this band. Must be sorted to give a valid "supported
470 * rates" IE, i.e. CCK rates first, then OFDM.
471 * @n_bitrates: Number of bitrates in @bitrates
472 * @ht_cap: HT capabilities in this band
473 * @vht_cap: VHT capabilities in this band
474 * @s1g_cap: S1G capabilities in this band
475 * @edmg_cap: EDMG capabilities in this band
476 * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
477 * @n_iftype_data: number of iftype data entries
478 * @iftype_data: interface type data entries. Note that the bits in
479 * @types_mask inside this structure cannot overlap (i.e. only
480 * one occurrence of each type is allowed across all instances of
483 struct ieee80211_supported_band {
484 struct ieee80211_channel *channels;
485 struct ieee80211_rate *bitrates;
486 enum nl80211_band band;
489 struct ieee80211_sta_ht_cap ht_cap;
490 struct ieee80211_sta_vht_cap vht_cap;
491 struct ieee80211_sta_s1g_cap s1g_cap;
492 struct ieee80211_edmg edmg_cap;
494 const struct ieee80211_sband_iftype_data *iftype_data;
498 * ieee80211_get_sband_iftype_data - return sband data for a given iftype
499 * @sband: the sband to search for the STA on
500 * @iftype: enum nl80211_iftype
502 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
504 static inline const struct ieee80211_sband_iftype_data *
505 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
510 if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
513 if (iftype == NL80211_IFTYPE_AP_VLAN)
514 iftype = NL80211_IFTYPE_AP;
516 for (i = 0; i < sband->n_iftype_data; i++) {
517 const struct ieee80211_sband_iftype_data *data =
518 &sband->iftype_data[i];
520 if (data->types_mask & BIT(iftype))
528 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
529 * @sband: the sband to search for the iftype on
530 * @iftype: enum nl80211_iftype
532 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
534 static inline const struct ieee80211_sta_he_cap *
535 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
538 const struct ieee80211_sband_iftype_data *data =
539 ieee80211_get_sband_iftype_data(sband, iftype);
541 if (data && data->he_cap.has_he)
542 return &data->he_cap;
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
552 * Return: the 6GHz capabilities
555 ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
556 enum nl80211_iftype iftype)
558 const struct ieee80211_sband_iftype_data *data =
559 ieee80211_get_sband_iftype_data(sband, iftype);
561 if (WARN_ON(!data || !data->he_cap.has_he))
564 return data->he_6ghz_capa.capa;
568 * wiphy_read_of_freq_limits - read frequency limits from device tree
570 * @wiphy: the wireless device to get extra limits for
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).
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.
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().
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)
592 #endif /* !CONFIG_OF */
596 * Wireless hardware/device configuration structures and methods
600 * DOC: Actions and configuration
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.
607 * Additionally, some operations are asynchronous and expect to get status
608 * information via some functions that drivers need to call.
610 * Scanning and BSS list handling with its associated functionality is described
611 * in a separate chapter.
614 #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
615 WLAN_USER_POSITION_LEN)
618 * struct vif_params - describes virtual interface parameters
619 * @flags: monitor interface flags, unchanged if 0, otherwise
620 * %MONITOR_FLAG_CHANGED will be set
621 * @use_4addr: use 4-address frames
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.
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
636 u8 macaddr[ETH_ALEN];
637 const u8 *vht_mumimo_groups;
638 const u8 *vht_mumimo_follow_addr;
642 * struct key_params - key information
644 * Information about a key
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.
652 * @seq_len: length of @seq.
653 * @vlan_id: vlan_id for VLAN group key (if nonzero)
654 * @mode: key install mode (RX_TX, NO_TX or SET_TX)
663 enum nl80211_key_mode mode;
667 * struct cfg80211_chan_def - channel definition
668 * @chan: the (control) channel
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)
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.
677 * @freq1_offset: offset from @center_freq1, in KHz
679 struct cfg80211_chan_def {
680 struct ieee80211_channel *chan;
681 enum nl80211_chan_width width;
684 struct ieee80211_edmg edmg;
689 * cfg80211_bitrate_mask - masks for bitrate control
691 struct cfg80211_bitrate_mask {
694 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
695 u16 vht_mcs[NL80211_VHT_NSS_MAX];
696 u16 he_mcs[NL80211_HE_NSS_MAX];
697 enum nl80211_txrate_gi gi;
698 enum nl80211_he_gi he_gi;
699 enum nl80211_he_ltf he_ltf;
700 } control[NUM_NL80211_BANDS];
705 * struct cfg80211_tid_cfg - TID specific configuration
706 * @config_override: Flag to notify driver to reset TID configuration
708 * @tids: bitmap of TIDs to modify
709 * @mask: bitmap of attributes indicating which parameter changed,
710 * similar to &nl80211_tid_config_supp.
711 * @noack: noack configuration value for the TID
712 * @retry_long: retry count value
713 * @retry_short: retry count value
714 * @ampdu: Enable/Disable MPDU aggregation
715 * @rtscts: Enable/Disable RTS/CTS
716 * @amsdu: Enable/Disable MSDU aggregation
717 * @txrate_type: Tx bitrate mask type
718 * @txrate_mask: Tx bitrate to be applied for the TID
720 struct cfg80211_tid_cfg {
721 bool config_override;
724 enum nl80211_tid_config noack;
725 u8 retry_long, retry_short;
726 enum nl80211_tid_config ampdu;
727 enum nl80211_tid_config rtscts;
728 enum nl80211_tid_config amsdu;
729 enum nl80211_tx_rate_setting txrate_type;
730 struct cfg80211_bitrate_mask txrate_mask;
734 * struct cfg80211_tid_config - TID configuration
735 * @peer: Station's MAC address
736 * @n_tid_conf: Number of TID specific configurations to be applied
737 * @tid_conf: Configuration change info
739 struct cfg80211_tid_config {
742 struct cfg80211_tid_cfg tid_conf[];
746 * cfg80211_get_chandef_type - return old channel type from chandef
747 * @chandef: the channel definition
749 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
750 * chandef, which must have a bandwidth allowing this conversion.
752 static inline enum nl80211_channel_type
753 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
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;
766 return NL80211_CHAN_NO_HT;
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
776 * Given a channel type, create a channel definition.
778 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
779 struct ieee80211_channel *channel,
780 enum nl80211_channel_type chantype);
783 * cfg80211_chandef_identical - check if two channel definitions are identical
784 * @chandef1: first channel definition
785 * @chandef2: second channel definition
787 * Return: %true if the channels defined by the channel definitions are
788 * identical, %false otherwise.
791 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
792 const struct cfg80211_chan_def *chandef2)
794 return (chandef1->chan == chandef2->chan &&
795 chandef1->width == chandef2->width &&
796 chandef1->center_freq1 == chandef2->center_freq1 &&
797 chandef1->freq1_offset == chandef2->freq1_offset &&
798 chandef1->center_freq2 == chandef2->center_freq2);
802 * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
804 * @chandef: the channel definition
806 * Return: %true if EDMG defined, %false otherwise.
809 cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
811 return chandef->edmg.channels || chandef->edmg.bw_config;
815 * cfg80211_chandef_compatible - check if two channel definitions are compatible
816 * @chandef1: first channel definition
817 * @chandef2: second channel definition
819 * Return: %NULL if the given channel definitions are incompatible,
820 * chandef1 or chandef2 otherwise.
822 const struct cfg80211_chan_def *
823 cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
824 const struct cfg80211_chan_def *chandef2);
827 * cfg80211_chandef_valid - check if a channel definition is valid
828 * @chandef: the channel definition to check
829 * Return: %true if the channel definition is valid. %false otherwise.
831 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
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
837 * @prohibited_flags: the regulatory channel flags that must not be set
838 * Return: %true if secondary channels are usable. %false otherwise.
840 bool cfg80211_chandef_usable(struct wiphy *wiphy,
841 const struct cfg80211_chan_def *chandef,
842 u32 prohibited_flags);
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
848 * @iftype: the interface type as specified in &enum nl80211_iftype
850 * 1 if radar detection is required, 0 if it is not, < 0 on error
852 int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
853 const struct cfg80211_chan_def *chandef,
854 enum nl80211_iftype iftype);
857 * ieee80211_chandef_rate_flags - returns rate flags for a channel
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.
862 * @chandef: channel definition for the channel
864 * Returns: rate flags which apply for this channel
866 static inline enum ieee80211_rate_flags
867 ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
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;
881 * ieee80211_chandef_max_power - maximum transmission power for the chandef
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.
887 * @chandef: channel definition for the channel
889 * Returns: maximum allowed transmission power in dBm for the chandef
892 ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
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);
904 return chandef->chan->max_power;
908 * cfg80211_any_usable_channels - check for usable channels
909 * @wiphy: the wiphy to check for
910 * @band_mask: which bands to check on
911 * @prohibited_flags: which channels to not consider usable,
912 * %IEEE80211_CHAN_DISABLED is always taken into account
914 bool cfg80211_any_usable_channels(struct wiphy *wiphy,
915 unsigned long band_mask,
916 u32 prohibited_flags);
919 * enum survey_info_flags - survey information flags
921 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
922 * @SURVEY_INFO_IN_USE: channel is currently being used
923 * @SURVEY_INFO_TIME: active time (in ms) was filled in
924 * @SURVEY_INFO_TIME_BUSY: busy time was filled in
925 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
926 * @SURVEY_INFO_TIME_RX: receive time was filled in
927 * @SURVEY_INFO_TIME_TX: transmit time was filled in
928 * @SURVEY_INFO_TIME_SCAN: scan time was filled in
929 * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
931 * Used by the driver to indicate which info in &struct survey_info
932 * it has filled in during the get_survey().
934 enum survey_info_flags {
935 SURVEY_INFO_NOISE_DBM = BIT(0),
936 SURVEY_INFO_IN_USE = BIT(1),
937 SURVEY_INFO_TIME = BIT(2),
938 SURVEY_INFO_TIME_BUSY = BIT(3),
939 SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
940 SURVEY_INFO_TIME_RX = BIT(5),
941 SURVEY_INFO_TIME_TX = BIT(6),
942 SURVEY_INFO_TIME_SCAN = BIT(7),
943 SURVEY_INFO_TIME_BSS_RX = BIT(8),
947 * struct survey_info - channel survey response
949 * @channel: the channel this survey record reports, may be %NULL for a single
950 * record to report global statistics
951 * @filled: bitflag of flags from &enum survey_info_flags
952 * @noise: channel noise in dBm. This and all following fields are
954 * @time: amount of time in ms the radio was turn on (on the channel)
955 * @time_busy: amount of time the primary channel was sensed busy
956 * @time_ext_busy: amount of time the extension channel was sensed busy
957 * @time_rx: amount of time the radio spent receiving data
958 * @time_tx: amount of time the radio spent transmitting data
959 * @time_scan: amount of time the radio spent for scanning
960 * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
962 * Used by dump_survey() to report back per-channel survey information.
964 * This structure can later be expanded with things like
965 * channel duty cycle etc.
968 struct ieee80211_channel *channel;
980 #define CFG80211_MAX_WEP_KEYS 4
983 * struct cfg80211_crypto_settings - Crypto settings
984 * @wpa_versions: indicates which, if any, WPA versions are enabled
985 * (from enum nl80211_wpa_versions)
986 * @cipher_group: group key cipher suite (or 0 if unset)
987 * @n_ciphers_pairwise: number of AP supported unicast ciphers
988 * @ciphers_pairwise: unicast key cipher suites
989 * @n_akm_suites: number of AKM suites
990 * @akm_suites: AKM suites
991 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
992 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
993 * required to assume that the port is unauthorized until authorized by
994 * user space. Otherwise, port is marked authorized by default.
995 * @control_port_ethertype: the control port protocol that should be
996 * allowed through even on unauthorized ports
997 * @control_port_no_encrypt: TRUE to prevent encryption of control port
999 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
1000 * port frames over NL80211 instead of the network interface.
1001 * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
1003 * @wep_keys: static WEP keys, if not NULL points to an array of
1004 * CFG80211_MAX_WEP_KEYS WEP keys
1005 * @wep_tx_key: key index (0..3) of the default TX static WEP key
1006 * @psk: PSK (for devices supporting 4-way-handshake offload)
1007 * @sae_pwd: password for SAE authentication (for devices supporting SAE
1009 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
1010 * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1012 * NL80211_SAE_PWE_UNSPECIFIED
1013 * Not-specified, used to indicate userspace did not specify any
1014 * preference. The driver should follow its internal policy in
1017 * NL80211_SAE_PWE_HUNT_AND_PECK
1018 * Allow hunting-and-pecking loop only
1020 * NL80211_SAE_PWE_HASH_TO_ELEMENT
1021 * Allow hash-to-element only
1023 * NL80211_SAE_PWE_BOTH
1024 * Allow either hunting-and-pecking loop or hash-to-element
1026 struct cfg80211_crypto_settings {
1029 int n_ciphers_pairwise;
1030 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
1032 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
1034 __be16 control_port_ethertype;
1035 bool control_port_no_encrypt;
1036 bool control_port_over_nl80211;
1037 bool control_port_no_preauth;
1038 struct key_params *wep_keys;
1043 enum nl80211_sae_pwe_mechanism sae_pwe;
1047 * struct cfg80211_beacon_data - beacon data
1048 * @head: head portion of beacon (before TIM IE)
1049 * or %NULL if not changed
1050 * @tail: tail portion of beacon (after TIM IE)
1051 * or %NULL if not changed
1052 * @head_len: length of @head
1053 * @tail_len: length of @tail
1054 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
1055 * @beacon_ies_len: length of beacon_ies in octets
1056 * @proberesp_ies: extra information element(s) to add into Probe Response
1058 * @proberesp_ies_len: length of proberesp_ies in octets
1059 * @assocresp_ies: extra information element(s) to add into (Re)Association
1060 * Response frames or %NULL
1061 * @assocresp_ies_len: length of assocresp_ies in octets
1062 * @probe_resp_len: length of probe response template (@probe_resp)
1063 * @probe_resp: probe response template (AP mode only)
1064 * @ftm_responder: enable FTM responder functionality; -1 for no change
1065 * (which also implies no change in LCI/civic location data)
1066 * @lci: Measurement Report element content, starting with Measurement Token
1067 * (measurement type 8)
1068 * @civicloc: Measurement Report element content, starting with Measurement
1069 * Token (measurement type 11)
1070 * @lci_len: LCI data length
1071 * @civicloc_len: Civic location data length
1073 struct cfg80211_beacon_data {
1074 const u8 *head, *tail;
1075 const u8 *beacon_ies;
1076 const u8 *proberesp_ies;
1077 const u8 *assocresp_ies;
1078 const u8 *probe_resp;
1083 size_t head_len, tail_len;
1084 size_t beacon_ies_len;
1085 size_t proberesp_ies_len;
1086 size_t assocresp_ies_len;
1087 size_t probe_resp_len;
1089 size_t civicloc_len;
1092 struct mac_address {
1097 * struct cfg80211_acl_data - Access control list data
1099 * @acl_policy: ACL policy to be applied on the station's
1100 * entry specified by mac_addr
1101 * @n_acl_entries: Number of MAC address entries passed
1102 * @mac_addrs: List of MAC addresses of stations to be used for ACL
1104 struct cfg80211_acl_data {
1105 enum nl80211_acl_policy acl_policy;
1109 struct mac_address mac_addrs[];
1113 * struct cfg80211_fils_discovery - FILS discovery parameters from
1114 * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1116 * @min_interval: Minimum packet interval in TUs (0 - 10000)
1117 * @max_interval: Maximum packet interval in TUs (0 - 10000)
1118 * @tmpl_len: Template length
1119 * @tmpl: Template data for FILS discovery frame including the action
1122 struct cfg80211_fils_discovery {
1130 * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
1131 * response parameters in 6GHz.
1133 * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
1134 * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
1136 * @tmpl_len: Template length
1137 * @tmpl: Template data for probe response
1139 struct cfg80211_unsol_bcast_probe_resp {
1146 * enum cfg80211_ap_settings_flags - AP settings flags
1148 * Used by cfg80211_ap_settings
1150 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1152 enum cfg80211_ap_settings_flags {
1153 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1157 * struct cfg80211_ap_settings - AP configuration
1159 * Used to configure an AP interface.
1161 * @chandef: defines the channel to use
1162 * @beacon: beacon data
1163 * @beacon_interval: beacon interval
1164 * @dtim_period: DTIM period
1165 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
1167 * @ssid_len: length of @ssid
1168 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
1169 * @crypto: crypto settings
1170 * @privacy: the BSS uses privacy
1171 * @auth_type: Authentication type (algorithm)
1172 * @smps_mode: SMPS mode
1173 * @inactivity_timeout: time in seconds to determine station's inactivity.
1174 * @p2p_ctwindow: P2P CT Window
1175 * @p2p_opp_ps: P2P opportunistic PS
1176 * @acl: ACL configuration used by the drivers which has support for
1177 * MAC address based access control
1178 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
1180 * @beacon_rate: bitrate to be used for beacons
1181 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
1182 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1183 * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
1184 * @ht_required: stations must support HT
1185 * @vht_required: stations must support VHT
1186 * @twt_responder: Enable Target Wait Time
1187 * @he_required: stations must support HE
1188 * @sae_h2e_required: stations must support direct H2E technique in SAE
1189 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1190 * @he_obss_pd: OBSS Packet Detection settings
1191 * @he_bss_color: BSS Color settings
1192 * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1193 * @fils_discovery: FILS discovery transmission parameters
1194 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1196 struct cfg80211_ap_settings {
1197 struct cfg80211_chan_def chandef;
1199 struct cfg80211_beacon_data beacon;
1201 int beacon_interval, dtim_period;
1204 enum nl80211_hidden_ssid hidden_ssid;
1205 struct cfg80211_crypto_settings crypto;
1207 enum nl80211_auth_type auth_type;
1208 enum nl80211_smps_mode smps_mode;
1209 int inactivity_timeout;
1212 const struct cfg80211_acl_data *acl;
1214 struct cfg80211_bitrate_mask beacon_rate;
1216 const struct ieee80211_ht_cap *ht_cap;
1217 const struct ieee80211_vht_cap *vht_cap;
1218 const struct ieee80211_he_cap_elem *he_cap;
1219 const struct ieee80211_he_operation *he_oper;
1220 bool ht_required, vht_required, he_required, sae_h2e_required;
1223 struct ieee80211_he_obss_pd he_obss_pd;
1224 struct cfg80211_he_bss_color he_bss_color;
1225 struct cfg80211_fils_discovery fils_discovery;
1226 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1230 * struct cfg80211_csa_settings - channel switch settings
1232 * Used for channel switch
1234 * @chandef: defines the channel to use after the switch
1235 * @beacon_csa: beacon data while performing the switch
1236 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
1237 * @counter_offsets_presp: offsets of the counters within the probe response
1238 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
1239 * @n_counter_offsets_presp: number of csa counters in the probe response
1240 * @beacon_after: beacon data to be used on the new channel
1241 * @radar_required: whether radar detection is required on the new channel
1242 * @block_tx: whether transmissions should be blocked while changing
1243 * @count: number of beacons until switch
1245 struct cfg80211_csa_settings {
1246 struct cfg80211_chan_def chandef;
1247 struct cfg80211_beacon_data beacon_csa;
1248 const u16 *counter_offsets_beacon;
1249 const u16 *counter_offsets_presp;
1250 unsigned int n_counter_offsets_beacon;
1251 unsigned int n_counter_offsets_presp;
1252 struct cfg80211_beacon_data beacon_after;
1253 bool radar_required;
1259 * struct cfg80211_color_change_settings - color change settings
1261 * Used for bss color change
1263 * @beacon_color_change: beacon data while performing the color countdown
1264 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
1265 * @counter_offsets_presp: offsets of the counters within the probe response
1266 * @beacon_next: beacon data to be used after the color change
1267 * @count: number of beacons until the color change
1268 * @color: the color used after the change
1270 struct cfg80211_color_change_settings {
1271 struct cfg80211_beacon_data beacon_color_change;
1272 u16 counter_offset_beacon;
1273 u16 counter_offset_presp;
1274 struct cfg80211_beacon_data beacon_next;
1280 * struct iface_combination_params - input parameters for interface combinations
1282 * Used to pass interface combination parameters
1284 * @num_different_channels: the number of different channels we want
1285 * to use for verification
1286 * @radar_detect: a bitmap where each bit corresponds to a channel
1287 * width where radar detection is needed, as in the definition of
1288 * &struct ieee80211_iface_combination.@radar_detect_widths
1289 * @iftype_num: array with the number of interfaces of each interface
1290 * type. The index is the interface type as specified in &enum
1292 * @new_beacon_int: set this to the beacon interval of a new interface
1293 * that's not operating yet, if such is to be checked as part of
1296 struct iface_combination_params {
1297 int num_different_channels;
1299 int iftype_num[NUM_NL80211_IFTYPES];
1304 * enum station_parameters_apply_mask - station parameter values to apply
1305 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
1306 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1307 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
1309 * Not all station parameters have in-band "no change" signalling,
1310 * for those that don't these flags will are used.
1312 enum station_parameters_apply_mask {
1313 STATION_PARAM_APPLY_UAPSD = BIT(0),
1314 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1315 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1316 STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1320 * struct sta_txpwr - station txpower configuration
1322 * Used to configure txpower for station.
1324 * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1325 * is not provided, the default per-interface tx power setting will be
1326 * overriding. Driver should be picking up the lowest tx power, either tx
1327 * power per-interface or per-station.
1328 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1329 * will be less than or equal to specified from userspace, whereas if TPC
1330 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1331 * NL80211_TX_POWER_FIXED is not a valid configuration option for
1336 enum nl80211_tx_power_setting type;
1340 * struct station_parameters - station parameters
1342 * Used to change and create a new station.
1344 * @vlan: vlan interface station should belong to
1345 * @supported_rates: supported rates in IEEE 802.11 format
1346 * (or NULL for no change)
1347 * @supported_rates_len: number of supported rates
1348 * @sta_flags_mask: station flags that changed
1349 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1350 * @sta_flags_set: station flags values
1351 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1352 * @listen_interval: listen interval or -1 for no change
1353 * @aid: AID or zero for no change
1354 * @vlan_id: VLAN ID for station (if nonzero)
1355 * @peer_aid: mesh peer AID or zero for no change
1356 * @plink_action: plink action to take
1357 * @plink_state: set the peer link state for a station
1358 * @ht_capa: HT capabilities of station
1359 * @vht_capa: VHT capabilities of station
1360 * @uapsd_queues: bitmap of queues configured for uapsd. same format
1361 * as the AC bitmap in the QoS info field
1362 * @max_sp: max Service Period. same format as the MAX_SP in the
1363 * QoS info field (but already shifted down)
1364 * @sta_modify_mask: bitmap indicating which parameters changed
1365 * (for those that don't have a natural "no change" value),
1366 * see &enum station_parameters_apply_mask
1367 * @local_pm: local link-specific mesh power save mode (no change when set
1369 * @capability: station capability
1370 * @ext_capab: extended capabilities of the station
1371 * @ext_capab_len: number of extended capabilities
1372 * @supported_channels: supported channels in IEEE 802.11 format
1373 * @supported_channels_len: number of supported channels
1374 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1375 * @supported_oper_classes_len: number of supported operating classes
1376 * @opmode_notif: operating mode field from Operating Mode Notification
1377 * @opmode_notif_used: information if operating mode field is used
1378 * @support_p2p_ps: information if station supports P2P PS mechanism
1379 * @he_capa: HE capabilities of station
1380 * @he_capa_len: the length of the HE capabilities
1381 * @airtime_weight: airtime scheduler weight for this station
1382 * @txpwr: transmit power for an associated station
1383 * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1385 struct station_parameters {
1386 const u8 *supported_rates;
1387 struct net_device *vlan;
1388 u32 sta_flags_mask, sta_flags_set;
1389 u32 sta_modify_mask;
1390 int listen_interval;
1394 u8 supported_rates_len;
1397 const struct ieee80211_ht_cap *ht_capa;
1398 const struct ieee80211_vht_cap *vht_capa;
1401 enum nl80211_mesh_power_mode local_pm;
1403 const u8 *ext_capab;
1405 const u8 *supported_channels;
1406 u8 supported_channels_len;
1407 const u8 *supported_oper_classes;
1408 u8 supported_oper_classes_len;
1410 bool opmode_notif_used;
1412 const struct ieee80211_he_cap_elem *he_capa;
1415 struct sta_txpwr txpwr;
1416 const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1420 * struct station_del_parameters - station deletion parameters
1422 * Used to delete a station entry (or all stations).
1424 * @mac: MAC address of the station to remove or NULL to remove all stations
1425 * @subtype: Management frame subtype to use for indicating removal
1426 * (10 = Disassociation, 12 = Deauthentication)
1427 * @reason_code: Reason code for the Disassociation/Deauthentication frame
1429 struct station_del_parameters {
1436 * enum cfg80211_station_type - the type of station being modified
1437 * @CFG80211_STA_AP_CLIENT: client of an AP interface
1438 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
1439 * unassociated (update properties for this type of client is permitted)
1440 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
1441 * the AP MLME in the device
1442 * @CFG80211_STA_AP_STA: AP station on managed interface
1443 * @CFG80211_STA_IBSS: IBSS station
1444 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
1445 * while TDLS setup is in progress, it moves out of this state when
1446 * being marked authorized; use this only if TDLS with external setup is
1448 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
1449 * entry that is operating, has been marked authorized by userspace)
1450 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1451 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
1453 enum cfg80211_station_type {
1454 CFG80211_STA_AP_CLIENT,
1455 CFG80211_STA_AP_CLIENT_UNASSOC,
1456 CFG80211_STA_AP_MLME_CLIENT,
1457 CFG80211_STA_AP_STA,
1459 CFG80211_STA_TDLS_PEER_SETUP,
1460 CFG80211_STA_TDLS_PEER_ACTIVE,
1461 CFG80211_STA_MESH_PEER_KERNEL,
1462 CFG80211_STA_MESH_PEER_USER,
1466 * cfg80211_check_station_change - validate parameter changes
1467 * @wiphy: the wiphy this operates on
1468 * @params: the new parameters for a station
1469 * @statype: the type of station being modified
1471 * Utility function for the @change_station driver method. Call this function
1472 * with the appropriate station type looking up the station (and checking that
1473 * it exists). It will verify whether the station change is acceptable, and if
1474 * not will return an error code. Note that it may modify the parameters for
1475 * backward compatibility reasons, so don't use them before calling this.
1477 int cfg80211_check_station_change(struct wiphy *wiphy,
1478 struct station_parameters *params,
1479 enum cfg80211_station_type statype);
1482 * enum rate_info_flags - bitrate info flags
1484 * Used by the driver to indicate the specific rate transmission
1485 * type for 802.11n transmissions.
1487 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1488 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1489 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
1490 * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1491 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
1492 * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1493 * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1495 enum rate_info_flags {
1496 RATE_INFO_FLAGS_MCS = BIT(0),
1497 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
1498 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
1499 RATE_INFO_FLAGS_DMG = BIT(3),
1500 RATE_INFO_FLAGS_HE_MCS = BIT(4),
1501 RATE_INFO_FLAGS_EDMG = BIT(5),
1502 RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6),
1506 * enum rate_info_bw - rate bandwidth information
1508 * Used by the driver to indicate the rate bandwidth.
1510 * @RATE_INFO_BW_5: 5 MHz bandwidth
1511 * @RATE_INFO_BW_10: 10 MHz bandwidth
1512 * @RATE_INFO_BW_20: 20 MHz bandwidth
1513 * @RATE_INFO_BW_40: 40 MHz bandwidth
1514 * @RATE_INFO_BW_80: 80 MHz bandwidth
1515 * @RATE_INFO_BW_160: 160 MHz bandwidth
1516 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1519 RATE_INFO_BW_20 = 0,
1529 * struct rate_info - bitrate information
1531 * Information about a receiving or transmitting bitrate
1533 * @flags: bitflag of flags from &enum rate_info_flags
1534 * @mcs: mcs index if struct describes an HT/VHT/HE rate
1535 * @legacy: bitrate in 100kbit/s for 802.11abg
1536 * @nss: number of streams (VHT & HE only)
1537 * @bw: bandwidth (from &enum rate_info_bw)
1538 * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1539 * @he_dcm: HE DCM value
1540 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1541 * only valid if bw is %RATE_INFO_BW_HE_RU)
1542 * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1557 * enum bss_param_flags - bitrate info flags
1559 * Used by the driver to indicate the specific rate transmission
1560 * type for 802.11n transmissions.
1562 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1563 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1564 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1566 enum bss_param_flags {
1567 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1568 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1569 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1573 * struct sta_bss_parameters - BSS parameters for the attached station
1575 * Information about the currently associated BSS
1577 * @flags: bitflag of flags from &enum bss_param_flags
1578 * @dtim_period: DTIM period for the BSS
1579 * @beacon_interval: beacon interval
1581 struct sta_bss_parameters {
1584 u16 beacon_interval;
1588 * struct cfg80211_txq_stats - TXQ statistics for this TID
1589 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1590 * indicate the relevant values in this struct are filled
1591 * @backlog_bytes: total number of bytes currently backlogged
1592 * @backlog_packets: total number of packets currently backlogged
1593 * @flows: number of new flows seen
1594 * @drops: total number of packets dropped
1595 * @ecn_marks: total number of packets marked with ECN CE
1596 * @overlimit: number of drops due to queue space overflow
1597 * @overmemory: number of drops due to memory limit overflow
1598 * @collisions: number of hash collisions
1599 * @tx_bytes: total number of bytes dequeued
1600 * @tx_packets: total number of packets dequeued
1601 * @max_flows: maximum number of flows supported
1603 struct cfg80211_txq_stats {
1606 u32 backlog_packets;
1619 * struct cfg80211_tid_stats - per-TID statistics
1620 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1621 * indicate the relevant values in this struct are filled
1622 * @rx_msdu: number of received MSDUs
1623 * @tx_msdu: number of (attempted) transmitted MSDUs
1624 * @tx_msdu_retries: number of retries (not counting the first) for
1626 * @tx_msdu_failed: number of failed transmitted MSDUs
1627 * @txq_stats: TXQ statistics
1629 struct cfg80211_tid_stats {
1633 u64 tx_msdu_retries;
1635 struct cfg80211_txq_stats txq_stats;
1638 #define IEEE80211_MAX_CHAINS 4
1641 * struct station_info - station information
1643 * Station information filled by driver for get_station() and dump_station.
1645 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1646 * indicate the relevant values in this struct for them
1647 * @connected_time: time(in secs) since a station is last connected
1648 * @inactive_time: time since last station activity (tx/rx) in milliseconds
1649 * @assoc_at: bootime (ns) of the last association
1650 * @rx_bytes: bytes (size of MPDUs) received from this station
1651 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
1652 * @llid: mesh local link id
1653 * @plid: mesh peer link id
1654 * @plink_state: mesh peer link state
1655 * @signal: The signal strength, type depends on the wiphy's signal_type.
1656 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1657 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1658 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1659 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1660 * @chain_signal: per-chain signal strength of last received packet in dBm
1661 * @chain_signal_avg: per-chain signal strength average in dBm
1662 * @txrate: current unicast bitrate from this station
1663 * @rxrate: current unicast bitrate to this station
1664 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1665 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1666 * @tx_retries: cumulative retry counts (MPDUs)
1667 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
1668 * @rx_dropped_misc: Dropped for un-specified reason.
1669 * @bss_param: current BSS parameters
1670 * @generation: generation number for nl80211 dumps.
1671 * This number should increase every time the list of stations
1672 * changes, i.e. when a station is added or removed, so that
1673 * userspace can tell whether it got a consistent snapshot.
1674 * @assoc_req_ies: IEs from (Re)Association Request.
1675 * This is used only when in AP mode with drivers that do not use
1676 * user space MLME/SME implementation. The information is provided for
1677 * the cfg80211_new_sta() calls to notify user space of the IEs.
1678 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1679 * @sta_flags: station flags mask & values
1680 * @beacon_loss_count: Number of times beacon loss event has triggered.
1681 * @t_offset: Time offset of the station relative to this host.
1682 * @local_pm: local mesh STA power save mode
1683 * @peer_pm: peer mesh STA power save mode
1684 * @nonpeer_pm: non-peer mesh STA power save mode
1685 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1686 * towards this station.
1687 * @rx_beacon: number of beacons received from this peer
1688 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1690 * @connected_to_gate: true if mesh STA has a path to mesh gate
1691 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
1692 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
1693 * @airtime_weight: current airtime scheduling weight
1694 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1695 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1696 * Note that this doesn't use the @filled bit, but is used if non-NULL.
1697 * @ack_signal: signal strength (in dBm) of the last ACK frame.
1698 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1700 * @rx_mpdu_count: number of MPDUs received from this station
1701 * @fcs_err_count: number of packets (MPDUs) received from this station with
1702 * an FCS error. This counter should be incremented only when TA of the
1703 * received packet with an FCS error matches the peer MAC address.
1704 * @airtime_link_metric: mesh airtime link metric.
1705 * @connected_to_as: true if mesh STA has a path to authentication server
1707 struct station_info {
1721 s8 chain_signal[IEEE80211_MAX_CHAINS];
1722 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1724 struct rate_info txrate;
1725 struct rate_info rxrate;
1730 u32 rx_dropped_misc;
1731 struct sta_bss_parameters bss_param;
1732 struct nl80211_sta_flag_update sta_flags;
1736 const u8 *assoc_req_ies;
1737 size_t assoc_req_ies_len;
1739 u32 beacon_loss_count;
1741 enum nl80211_mesh_power_mode local_pm;
1742 enum nl80211_mesh_power_mode peer_pm;
1743 enum nl80211_mesh_power_mode nonpeer_pm;
1745 u32 expected_throughput;
1750 u8 rx_beacon_signal_avg;
1751 u8 connected_to_gate;
1753 struct cfg80211_tid_stats *pertid;
1762 u32 airtime_link_metric;
1768 * struct cfg80211_sar_sub_specs - sub specs limit
1769 * @power: power limitation in 0.25dbm
1770 * @freq_range_index: index the power limitation applies to
1772 struct cfg80211_sar_sub_specs {
1774 u32 freq_range_index;
1778 * struct cfg80211_sar_specs - sar limit specs
1779 * @type: it's set with power in 0.25dbm or other types
1780 * @num_sub_specs: number of sar sub specs
1781 * @sub_specs: memory to hold the sar sub specs
1783 struct cfg80211_sar_specs {
1784 enum nl80211_sar_type type;
1786 struct cfg80211_sar_sub_specs sub_specs[];
1791 * struct cfg80211_sar_freq_ranges - sar frequency ranges
1792 * @start_freq: start range edge frequency
1793 * @end_freq: end range edge frequency
1795 struct cfg80211_sar_freq_ranges {
1801 * struct cfg80211_sar_capa - sar limit capability
1802 * @type: it's set via power in 0.25dbm or other types
1803 * @num_freq_ranges: number of frequency ranges
1804 * @freq_ranges: memory to hold the freq ranges.
1806 * Note: WLAN driver may append new ranges or split an existing
1807 * range to small ones and then append them.
1809 struct cfg80211_sar_capa {
1810 enum nl80211_sar_type type;
1811 u32 num_freq_ranges;
1812 const struct cfg80211_sar_freq_ranges *freq_ranges;
1815 #if IS_ENABLED(CONFIG_CFG80211)
1817 * cfg80211_get_station - retrieve information about a given station
1818 * @dev: the device where the station is supposed to be connected to
1819 * @mac_addr: the mac address of the station of interest
1820 * @sinfo: pointer to the structure to fill with the information
1822 * Returns 0 on success and sinfo is filled with the available information
1823 * otherwise returns a negative error code and the content of sinfo has to be
1824 * considered undefined.
1826 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1827 struct station_info *sinfo);
1829 static inline int cfg80211_get_station(struct net_device *dev,
1831 struct station_info *sinfo)
1838 * enum monitor_flags - monitor flags
1840 * Monitor interface configuration flags. Note that these must be the bits
1841 * according to the nl80211 flags.
1843 * @MONITOR_FLAG_CHANGED: set if the flags were changed
1844 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1845 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1846 * @MONITOR_FLAG_CONTROL: pass control frames
1847 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1848 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1849 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
1851 enum monitor_flags {
1852 MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
1853 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1854 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1855 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1856 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1857 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1858 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
1862 * enum mpath_info_flags - mesh path information flags
1864 * Used by the driver to indicate which info in &struct mpath_info it has filled
1865 * in during get_station() or dump_station().
1867 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1868 * @MPATH_INFO_SN: @sn filled
1869 * @MPATH_INFO_METRIC: @metric filled
1870 * @MPATH_INFO_EXPTIME: @exptime filled
1871 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1872 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1873 * @MPATH_INFO_FLAGS: @flags filled
1874 * @MPATH_INFO_HOP_COUNT: @hop_count filled
1875 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
1877 enum mpath_info_flags {
1878 MPATH_INFO_FRAME_QLEN = BIT(0),
1879 MPATH_INFO_SN = BIT(1),
1880 MPATH_INFO_METRIC = BIT(2),
1881 MPATH_INFO_EXPTIME = BIT(3),
1882 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1883 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1884 MPATH_INFO_FLAGS = BIT(6),
1885 MPATH_INFO_HOP_COUNT = BIT(7),
1886 MPATH_INFO_PATH_CHANGE = BIT(8),
1890 * struct mpath_info - mesh path information
1892 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1894 * @filled: bitfield of flags from &enum mpath_info_flags
1895 * @frame_qlen: number of queued frames for this destination
1896 * @sn: target sequence number
1897 * @metric: metric (cost) of this mesh path
1898 * @exptime: expiration time for the mesh path from now, in msecs
1899 * @flags: mesh path flags
1900 * @discovery_timeout: total mesh path discovery timeout, in msecs
1901 * @discovery_retries: mesh path discovery retries
1902 * @generation: generation number for nl80211 dumps.
1903 * This number should increase every time the list of mesh paths
1904 * changes, i.e. when a station is added or removed, so that
1905 * userspace can tell whether it got a consistent snapshot.
1906 * @hop_count: hops to destination
1907 * @path_change_count: total number of path changes to destination
1915 u32 discovery_timeout;
1916 u8 discovery_retries;
1919 u32 path_change_count;
1925 * struct bss_parameters - BSS parameters
1927 * Used to change BSS parameters (mainly for AP mode).
1929 * @use_cts_prot: Whether to use CTS protection
1930 * (0 = no, 1 = yes, -1 = do not change)
1931 * @use_short_preamble: Whether the use of short preambles is allowed
1932 * (0 = no, 1 = yes, -1 = do not change)
1933 * @use_short_slot_time: Whether the use of short slot time is allowed
1934 * (0 = no, 1 = yes, -1 = do not change)
1935 * @basic_rates: basic rates in IEEE 802.11 format
1936 * (or NULL for no change)
1937 * @basic_rates_len: number of basic rates
1938 * @ap_isolate: do not forward packets between connected stations
1939 * (0 = no, 1 = yes, -1 = do not change)
1940 * @ht_opmode: HT Operation mode
1941 * (u16 = opmode, -1 = do not change)
1942 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1943 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
1945 struct bss_parameters {
1947 int use_short_preamble;
1948 int use_short_slot_time;
1949 const u8 *basic_rates;
1953 s8 p2p_ctwindow, p2p_opp_ps;
1957 * struct mesh_config - 802.11s mesh configuration
1959 * These parameters can be changed while the mesh is active.
1961 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1962 * by the Mesh Peering Open message
1963 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1964 * used by the Mesh Peering Open message
1965 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1966 * the mesh peering management to close a mesh peering
1967 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1969 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1970 * be sent to establish a new peer link instance in a mesh
1971 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1972 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1974 * @auto_open_plinks: whether we should automatically open peer links when we
1975 * detect compatible mesh peers
1976 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1977 * synchronize to for 11s default synchronization method
1978 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1979 * that an originator mesh STA can send to a particular path target
1980 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1981 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1982 * a path discovery in milliseconds
1983 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1984 * receiving a PREQ shall consider the forwarding information from the
1985 * root to be valid. (TU = time unit)
1986 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1987 * which a mesh STA can send only one action frame containing a PREQ
1989 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1990 * which a mesh STA can send only one Action frame containing a PERR
1992 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1993 * it takes for an HWMP information element to propagate across the mesh
1994 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1995 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1996 * announcements are transmitted
1997 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1998 * station has access to a broader network beyond the MBSS. (This is
1999 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
2000 * only means that the station will announce others it's a mesh gate, but
2001 * not necessarily using the gate announcement protocol. Still keeping the
2002 * same nomenclature to be in sync with the spec)
2003 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
2004 * entity (default is TRUE - forwarding entity)
2005 * @rssi_threshold: the threshold for average signal strength of candidate
2006 * station to establish a peer link
2007 * @ht_opmode: mesh HT protection mode
2009 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
2010 * receiving a proactive PREQ shall consider the forwarding information to
2011 * the root mesh STA to be valid.
2013 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
2014 * PREQs are transmitted.
2015 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
2016 * during which a mesh STA can send only one Action frame containing
2017 * a PREQ element for root path confirmation.
2018 * @power_mode: The default mesh power save mode which will be the initial
2019 * setting for new peer links.
2020 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
2021 * after transmitting its beacon.
2022 * @plink_timeout: If no tx activity is seen from a STA we've established
2023 * peering with for longer than this time (in seconds), then remove it
2024 * from the STA's list of peers. Default is 30 minutes.
2025 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
2026 * connected to a mesh gate in mesh formation info. If false, the
2027 * value in mesh formation is determined by the presence of root paths
2028 * in the mesh path table
2029 * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2030 * for HWMP) if the destination is a direct neighbor. Note that this might
2031 * not be the optimal decision as a multi-hop route might be better. So
2032 * if using this setting you will likely also want to disable
2033 * dot11MeshForwarding and use another mesh routing protocol on top.
2035 struct mesh_config {
2036 u16 dot11MeshRetryTimeout;
2037 u16 dot11MeshConfirmTimeout;
2038 u16 dot11MeshHoldingTimeout;
2039 u16 dot11MeshMaxPeerLinks;
2040 u8 dot11MeshMaxRetries;
2043 bool auto_open_plinks;
2044 u32 dot11MeshNbrOffsetMaxNeighbor;
2045 u8 dot11MeshHWMPmaxPREQretries;
2046 u32 path_refresh_time;
2047 u16 min_discovery_timeout;
2048 u32 dot11MeshHWMPactivePathTimeout;
2049 u16 dot11MeshHWMPpreqMinInterval;
2050 u16 dot11MeshHWMPperrMinInterval;
2051 u16 dot11MeshHWMPnetDiameterTraversalTime;
2052 u8 dot11MeshHWMPRootMode;
2053 bool dot11MeshConnectedToMeshGate;
2054 bool dot11MeshConnectedToAuthServer;
2055 u16 dot11MeshHWMPRannInterval;
2056 bool dot11MeshGateAnnouncementProtocol;
2057 bool dot11MeshForwarding;
2060 u32 dot11MeshHWMPactivePathToRootTimeout;
2061 u16 dot11MeshHWMProotInterval;
2062 u16 dot11MeshHWMPconfirmationInterval;
2063 enum nl80211_mesh_power_mode power_mode;
2064 u16 dot11MeshAwakeWindowDuration;
2066 bool dot11MeshNolearn;
2070 * struct mesh_setup - 802.11s mesh setup configuration
2071 * @chandef: defines the channel to use
2072 * @mesh_id: the mesh ID
2073 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2074 * @sync_method: which synchronization method to use
2075 * @path_sel_proto: which path selection protocol to use
2076 * @path_metric: which metric to use
2077 * @auth_id: which authentication method this mesh is using
2078 * @ie: vendor information elements (optional)
2079 * @ie_len: length of vendor information elements
2080 * @is_authenticated: this mesh requires authentication
2081 * @is_secure: this mesh uses security
2082 * @user_mpm: userspace handles all MPM functions
2083 * @dtim_period: DTIM period to use
2084 * @beacon_interval: beacon interval to use
2085 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2086 * @basic_rates: basic rates to use when creating the mesh
2087 * @beacon_rate: bitrate to be used for beacons
2088 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2089 * changes the channel when a radar is detected. This is required
2090 * to operate on DFS channels.
2091 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2092 * port frames over NL80211 instead of the network interface.
2094 * These parameters are fixed when the mesh is created.
2097 struct cfg80211_chan_def chandef;
2106 bool is_authenticated;
2110 u16 beacon_interval;
2111 int mcast_rate[NUM_NL80211_BANDS];
2113 struct cfg80211_bitrate_mask beacon_rate;
2114 bool userspace_handles_dfs;
2115 bool control_port_over_nl80211;
2119 * struct ocb_setup - 802.11p OCB mode setup configuration
2120 * @chandef: defines the channel to use
2122 * These parameters are fixed when connecting to the network
2125 struct cfg80211_chan_def chandef;
2129 * struct ieee80211_txq_params - TX queue parameters
2130 * @ac: AC identifier
2131 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
2132 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
2134 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
2136 * @aifs: Arbitration interframe space [0..255]
2138 struct ieee80211_txq_params {
2147 * DOC: Scanning and BSS list handling
2149 * The scanning process itself is fairly simple, but cfg80211 offers quite
2150 * a bit of helper functionality. To start a scan, the scan operation will
2151 * be invoked with a scan definition. This scan definition contains the
2152 * channels to scan, and the SSIDs to send probe requests for (including the
2153 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2154 * probe. Additionally, a scan request may contain extra information elements
2155 * that should be added to the probe request. The IEs are guaranteed to be
2156 * well-formed, and will not exceed the maximum length the driver advertised
2157 * in the wiphy structure.
2159 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2160 * it is responsible for maintaining the BSS list; the driver should not
2161 * maintain a list itself. For this notification, various functions exist.
2163 * Since drivers do not maintain a BSS list, there are also a number of
2164 * functions to search for a BSS and obtain information about it from the
2165 * BSS structure cfg80211 maintains. The BSS list is also made available
2170 * struct cfg80211_ssid - SSID description
2172 * @ssid_len: length of the ssid
2174 struct cfg80211_ssid {
2175 u8 ssid[IEEE80211_MAX_SSID_LEN];
2180 * struct cfg80211_scan_info - information about completed scan
2181 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
2182 * wireless device that requested the scan is connected to. If this
2183 * information is not available, this field is left zero.
2184 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
2185 * @aborted: set to true if the scan was aborted for any reason,
2186 * userspace will be notified of that
2188 struct cfg80211_scan_info {
2190 u8 tsf_bssid[ETH_ALEN] __aligned(2);
2195 * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2197 * @short_bssid: short ssid to scan for
2198 * @bssid: bssid to scan for
2199 * @channel_idx: idx of the channel in the channel array in the scan request
2200 * which the above info relvant to
2201 * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2202 * @short_ssid_valid: short_ssid is valid and can be used
2203 * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2204 * 20 TUs before starting to send probe requests.
2206 struct cfg80211_scan_6ghz_params {
2210 bool unsolicited_probe;
2211 bool short_ssid_valid;
2216 * struct cfg80211_scan_request - scan request description
2218 * @ssids: SSIDs to scan for (active scan only)
2219 * @n_ssids: number of SSIDs
2220 * @channels: channels to scan on.
2221 * @n_channels: total number of channels to scan
2222 * @scan_width: channel width for scanning
2223 * @ie: optional information element(s) to add into Probe Request or %NULL
2224 * @ie_len: length of ie in octets
2225 * @duration: how long to listen on each channel, in TUs. If
2226 * %duration_mandatory is not set, this is the maximum dwell time and
2227 * the actual dwell time may be shorter.
2228 * @duration_mandatory: if set, the scan duration must be as specified by the
2230 * @flags: bit field of flags controlling operation
2231 * @rates: bitmap of rates to advertise for each band
2232 * @wiphy: the wiphy this was for
2233 * @scan_start: time (in jiffies) when the scan started
2234 * @wdev: the wireless device to scan for
2235 * @info: (internal) information about completed scan
2236 * @notified: (internal) scan request was notified as done or aborted
2237 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2238 * @mac_addr: MAC address used with randomisation
2239 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2240 * are 0 in the mask should be randomised, bits that are 1 should
2241 * be taken from the @mac_addr
2242 * @scan_6ghz: relevant for split scan request only,
2243 * true if this is the second scan request
2244 * @n_6ghz_params: number of 6 GHz params
2245 * @scan_6ghz_params: 6 GHz params
2246 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
2248 struct cfg80211_scan_request {
2249 struct cfg80211_ssid *ssids;
2252 enum nl80211_bss_scan_width scan_width;
2256 bool duration_mandatory;
2259 u32 rates[NUM_NL80211_BANDS];
2261 struct wireless_dev *wdev;
2263 u8 mac_addr[ETH_ALEN] __aligned(2);
2264 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2265 u8 bssid[ETH_ALEN] __aligned(2);
2268 struct wiphy *wiphy;
2269 unsigned long scan_start;
2270 struct cfg80211_scan_info info;
2275 struct cfg80211_scan_6ghz_params *scan_6ghz_params;
2278 struct ieee80211_channel *channels[];
2281 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2285 get_random_bytes(buf, ETH_ALEN);
2286 for (i = 0; i < ETH_ALEN; i++) {
2288 buf[i] |= addr[i] & mask[i];
2293 * struct cfg80211_match_set - sets of attributes to match
2295 * @ssid: SSID to be matched; may be zero-length in case of BSSID match
2296 * or no match (RSSI only)
2297 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
2298 * or no match (RSSI only)
2299 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
2300 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
2301 * for filtering out scan results received. Drivers advertize this support
2302 * of band specific rssi based filtering through the feature capability
2303 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
2304 * specific rssi thresholds take precedence over rssi_thold, if specified.
2305 * If not specified for any band, it will be assigned with rssi_thold of
2306 * corresponding matchset.
2308 struct cfg80211_match_set {
2309 struct cfg80211_ssid ssid;
2312 s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2316 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
2318 * @interval: interval between scheduled scan iterations. In seconds.
2319 * @iterations: number of scan iterations in this scan plan. Zero means
2321 * The last scan plan will always have this parameter set to zero,
2322 * all other scan plans will have a finite number of iterations.
2324 struct cfg80211_sched_scan_plan {
2330 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2332 * @band: band of BSS which should match for RSSI level adjustment.
2333 * @delta: value of RSSI level adjustment.
2335 struct cfg80211_bss_select_adjust {
2336 enum nl80211_band band;
2341 * struct cfg80211_sched_scan_request - scheduled scan request description
2343 * @reqid: identifies this request.
2344 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2345 * @n_ssids: number of SSIDs
2346 * @n_channels: total number of channels to scan
2347 * @scan_width: channel width for scanning
2348 * @ie: optional information element(s) to add into Probe Request or %NULL
2349 * @ie_len: length of ie in octets
2350 * @flags: bit field of flags controlling operation
2351 * @match_sets: sets of parameters to be matched for a scan result
2352 * entry to be considered valid and to be passed to the host
2353 * (others are filtered out).
2354 * If ommited, all results are passed.
2355 * @n_match_sets: number of match sets
2356 * @report_results: indicates that results were reported for this request
2357 * @wiphy: the wiphy this was for
2358 * @dev: the interface
2359 * @scan_start: start time of the scheduled scan
2360 * @channels: channels to scan
2361 * @min_rssi_thold: for drivers only supporting a single threshold, this
2362 * contains the minimum over all matchsets
2363 * @mac_addr: MAC address used with randomisation
2364 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2365 * are 0 in the mask should be randomised, bits that are 1 should
2366 * be taken from the @mac_addr
2367 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
2368 * index must be executed first.
2369 * @n_scan_plans: number of scan plans, at least 1.
2370 * @rcu_head: RCU callback used to free the struct
2371 * @owner_nlportid: netlink portid of owner (if this should is a request
2372 * owned by a particular socket)
2373 * @nl_owner_dead: netlink owner socket was closed - this request be freed
2374 * @list: for keeping list of requests.
2375 * @delay: delay in seconds to use before starting the first scan
2376 * cycle. The driver may ignore this parameter and start
2377 * immediately (or at any other time), if this feature is not
2379 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2380 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2381 * reporting in connected state to cases where a matching BSS is determined
2382 * to have better or slightly worse RSSI than the current connected BSS.
2383 * The relative RSSI threshold values are ignored in disconnected state.
2384 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2385 * to the specified band while deciding whether a better BSS is reported
2386 * using @relative_rssi. If delta is a negative number, the BSSs that
2387 * belong to the specified band will be penalized by delta dB in relative
2390 struct cfg80211_sched_scan_request {
2392 struct cfg80211_ssid *ssids;
2395 enum nl80211_bss_scan_width scan_width;
2399 struct cfg80211_match_set *match_sets;
2403 struct cfg80211_sched_scan_plan *scan_plans;
2406 u8 mac_addr[ETH_ALEN] __aligned(2);
2407 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2409 bool relative_rssi_set;
2411 struct cfg80211_bss_select_adjust rssi_adjust;
2414 struct wiphy *wiphy;
2415 struct net_device *dev;
2416 unsigned long scan_start;
2417 bool report_results;
2418 struct rcu_head rcu_head;
2421 struct list_head list;
2424 struct ieee80211_channel *channels[];
2428 * enum cfg80211_signal_type - signal type
2430 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
2431 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
2432 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
2434 enum cfg80211_signal_type {
2435 CFG80211_SIGNAL_TYPE_NONE,
2436 CFG80211_SIGNAL_TYPE_MBM,
2437 CFG80211_SIGNAL_TYPE_UNSPEC,
2441 * struct cfg80211_inform_bss - BSS inform data
2442 * @chan: channel the frame was received on
2443 * @scan_width: scan width that was used
2444 * @signal: signal strength value, according to the wiphy's
2446 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
2447 * received; should match the time when the frame was actually
2448 * received by the device (not just by the host, in case it was
2449 * buffered on the device) and be accurate to about 10ms.
2450 * If the frame isn't buffered, just passing the return value of
2451 * ktime_get_boottime_ns() is likely appropriate.
2452 * @parent_tsf: the time at the start of reception of the first octet of the
2453 * timestamp field of the frame. The time is the TSF of the BSS specified
2455 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
2456 * the BSS that requested the scan in which the beacon/probe was received.
2457 * @chains: bitmask for filled values in @chain_signal.
2458 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2460 struct cfg80211_inform_bss {
2461 struct ieee80211_channel *chan;
2462 enum nl80211_bss_scan_width scan_width;
2466 u8 parent_bssid[ETH_ALEN] __aligned(2);
2468 s8 chain_signal[IEEE80211_MAX_CHAINS];
2472 * struct cfg80211_bss_ies - BSS entry IE data
2473 * @tsf: TSF contained in the frame that carried these IEs
2474 * @rcu_head: internal use, for freeing
2475 * @len: length of the IEs
2476 * @from_beacon: these IEs are known to come from a beacon
2479 struct cfg80211_bss_ies {
2481 struct rcu_head rcu_head;
2488 * struct cfg80211_bss - BSS description
2490 * This structure describes a BSS (which may also be a mesh network)
2491 * for use in scan results and similar.
2493 * @channel: channel this BSS is on
2494 * @scan_width: width of the control channel
2495 * @bssid: BSSID of the BSS
2496 * @beacon_interval: the beacon interval as from the frame
2497 * @capability: the capability field in host byte order
2498 * @ies: the information elements (Note that there is no guarantee that these
2499 * are well-formed!); this is a pointer to either the beacon_ies or
2500 * proberesp_ies depending on whether Probe Response frame has been
2501 * received. It is always non-%NULL.
2502 * @beacon_ies: the information elements from the last Beacon frame
2503 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
2504 * own the beacon_ies, but they're just pointers to the ones from the
2505 * @hidden_beacon_bss struct)
2506 * @proberesp_ies: the information elements from the last Probe Response frame
2507 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2508 * a BSS that hides the SSID in its beacon, this points to the BSS struct
2509 * that holds the beacon data. @beacon_ies is still valid, of course, and
2510 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
2511 * @transmitted_bss: pointer to the transmitted BSS, if this is a
2512 * non-transmitted one (multi-BSSID support)
2513 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2514 * (multi-BSSID support)
2515 * @signal: signal strength value (type depends on the wiphy's signal_type)
2516 * @chains: bitmask for filled values in @chain_signal.
2517 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2518 * @bssid_index: index in the multiple BSS set
2519 * @max_bssid_indicator: max number of members in the BSS set
2520 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
2522 struct cfg80211_bss {
2523 struct ieee80211_channel *channel;
2524 enum nl80211_bss_scan_width scan_width;
2526 const struct cfg80211_bss_ies __rcu *ies;
2527 const struct cfg80211_bss_ies __rcu *beacon_ies;
2528 const struct cfg80211_bss_ies __rcu *proberesp_ies;
2530 struct cfg80211_bss *hidden_beacon_bss;
2531 struct cfg80211_bss *transmitted_bss;
2532 struct list_head nontrans_list;
2536 u16 beacon_interval;
2541 s8 chain_signal[IEEE80211_MAX_CHAINS];
2544 u8 max_bssid_indicator;
2546 u8 priv[] __aligned(sizeof(void *));
2550 * ieee80211_bss_get_elem - find element with given ID
2551 * @bss: the bss to search
2552 * @id: the element ID
2554 * Note that the return value is an RCU-protected pointer, so
2555 * rcu_read_lock() must be held when calling this function.
2556 * Return: %NULL if not found.
2558 const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
2561 * ieee80211_bss_get_ie - find IE with given ID
2562 * @bss: the bss to search
2563 * @id: the element ID
2565 * Note that the return value is an RCU-protected pointer, so
2566 * rcu_read_lock() must be held when calling this function.
2567 * Return: %NULL if not found.
2569 static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
2571 return (void *)ieee80211_bss_get_elem(bss, id);
2576 * struct cfg80211_auth_request - Authentication request data
2578 * This structure provides information needed to complete IEEE 802.11
2581 * @bss: The BSS to authenticate with, the callee must obtain a reference
2582 * to it if it needs to keep it.
2583 * @auth_type: Authentication type (algorithm)
2584 * @ie: Extra IEs to add to Authentication frame or %NULL
2585 * @ie_len: Length of ie buffer in octets
2586 * @key_len: length of WEP key for shared key authentication
2587 * @key_idx: index of WEP key for shared key authentication
2588 * @key: WEP key for shared key authentication
2589 * @auth_data: Fields and elements in Authentication frames. This contains
2590 * the authentication frame body (non-IE and IE data), excluding the
2591 * Authentication algorithm number, i.e., starting at the Authentication
2592 * transaction sequence number field.
2593 * @auth_data_len: Length of auth_data buffer in octets
2595 struct cfg80211_auth_request {
2596 struct cfg80211_bss *bss;
2599 enum nl80211_auth_type auth_type;
2601 u8 key_len, key_idx;
2602 const u8 *auth_data;
2603 size_t auth_data_len;
2607 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
2609 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
2610 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
2611 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
2612 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
2613 * authentication capability. Drivers can offload authentication to
2614 * userspace if this flag is set. Only applicable for cfg80211_connect()
2615 * request (connect callback).
2616 * @ASSOC_REQ_DISABLE_HE: Disable HE
2618 enum cfg80211_assoc_req_flags {
2619 ASSOC_REQ_DISABLE_HT = BIT(0),
2620 ASSOC_REQ_DISABLE_VHT = BIT(1),
2621 ASSOC_REQ_USE_RRM = BIT(2),
2622 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
2623 ASSOC_REQ_DISABLE_HE = BIT(4),
2627 * struct cfg80211_assoc_request - (Re)Association request data
2629 * This structure provides information needed to complete IEEE 802.11
2631 * @bss: The BSS to associate with. If the call is successful the driver is
2632 * given a reference that it must give back to cfg80211_send_rx_assoc()
2633 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2634 * association requests while already associating must be rejected.
2635 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2636 * @ie_len: Length of ie buffer in octets
2637 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2638 * @crypto: crypto settings
2639 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2640 * to indicate a request to reassociate within the ESS instead of a request
2641 * do the initial association with the ESS. When included, this is set to
2642 * the BSSID of the current association, i.e., to the value that is
2643 * included in the Current AP address field of the Reassociation Request
2645 * @flags: See &enum cfg80211_assoc_req_flags
2646 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2647 * will be used in ht_capa. Un-supported values will be ignored.
2648 * @ht_capa_mask: The bits of ht_capa which are to be used.
2649 * @vht_capa: VHT capability override
2650 * @vht_capa_mask: VHT capability mask indicating which fields to use
2651 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2652 * %NULL if FILS is not used.
2653 * @fils_kek_len: Length of fils_kek in octets
2654 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2655 * Request/Response frame or %NULL if FILS is not used. This field starts
2656 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2657 * @s1g_capa: S1G capability override
2658 * @s1g_capa_mask: S1G capability override mask
2660 struct cfg80211_assoc_request {
2661 struct cfg80211_bss *bss;
2662 const u8 *ie, *prev_bssid;
2664 struct cfg80211_crypto_settings crypto;
2667 struct ieee80211_ht_cap ht_capa;
2668 struct ieee80211_ht_cap ht_capa_mask;
2669 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2671 size_t fils_kek_len;
2672 const u8 *fils_nonces;
2673 struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2677 * struct cfg80211_deauth_request - Deauthentication request data
2679 * This structure provides information needed to complete IEEE 802.11
2682 * @bssid: the BSSID of the BSS to deauthenticate from
2683 * @ie: Extra IEs to add to Deauthentication frame or %NULL
2684 * @ie_len: Length of ie buffer in octets
2685 * @reason_code: The reason code for the deauthentication
2686 * @local_state_change: if set, change local state only and
2687 * do not set a deauth frame
2689 struct cfg80211_deauth_request {
2694 bool local_state_change;
2698 * struct cfg80211_disassoc_request - Disassociation request data
2700 * This structure provides information needed to complete IEEE 802.11
2703 * @bss: the BSS to disassociate from
2704 * @ie: Extra IEs to add to Disassociation frame or %NULL
2705 * @ie_len: Length of ie buffer in octets
2706 * @reason_code: The reason code for the disassociation
2707 * @local_state_change: This is a request for a local state only, i.e., no
2708 * Disassociation frame is to be transmitted.
2710 struct cfg80211_disassoc_request {
2711 struct cfg80211_bss *bss;
2715 bool local_state_change;
2719 * struct cfg80211_ibss_params - IBSS parameters
2721 * This structure defines the IBSS parameters for the join_ibss()
2724 * @ssid: The SSID, will always be non-null.
2725 * @ssid_len: The length of the SSID, will always be non-zero.
2726 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2727 * search for IBSSs with a different BSSID.
2728 * @chandef: defines the channel to use if no other IBSS to join can be found
2729 * @channel_fixed: The channel should be fixed -- do not search for
2730 * IBSSs to join on other channels.
2731 * @ie: information element(s) to include in the beacon
2732 * @ie_len: length of that
2733 * @beacon_interval: beacon interval to use
2734 * @privacy: this is a protected network, keys will be configured
2736 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2737 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2738 * required to assume that the port is unauthorized until authorized by
2739 * user space. Otherwise, port is marked authorized by default.
2740 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2741 * port frames over NL80211 instead of the network interface.
2742 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2743 * changes the channel when a radar is detected. This is required
2744 * to operate on DFS channels.
2745 * @basic_rates: bitmap of basic rates to use when creating the IBSS
2746 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2747 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2748 * will be used in ht_capa. Un-supported values will be ignored.
2749 * @ht_capa_mask: The bits of ht_capa which are to be used.
2750 * @wep_keys: static WEP keys, if not NULL points to an array of
2751 * CFG80211_MAX_WEP_KEYS WEP keys
2752 * @wep_tx_key: key index (0..3) of the default TX static WEP key
2754 struct cfg80211_ibss_params {
2757 struct cfg80211_chan_def chandef;
2759 u8 ssid_len, ie_len;
2760 u16 beacon_interval;
2765 bool control_port_over_nl80211;
2766 bool userspace_handles_dfs;
2767 int mcast_rate[NUM_NL80211_BANDS];
2768 struct ieee80211_ht_cap ht_capa;
2769 struct ieee80211_ht_cap ht_capa_mask;
2770 struct key_params *wep_keys;
2775 * struct cfg80211_bss_selection - connection parameters for BSS selection.
2777 * @behaviour: requested BSS selection behaviour.
2778 * @param: parameters for requestion behaviour.
2779 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2780 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2782 struct cfg80211_bss_selection {
2783 enum nl80211_bss_select_attr behaviour;
2785 enum nl80211_band band_pref;
2786 struct cfg80211_bss_select_adjust adjust;
2791 * struct cfg80211_connect_params - Connection parameters
2793 * This structure provides information needed to complete IEEE 802.11
2794 * authentication and association.
2796 * @channel: The channel to use or %NULL if not specified (auto-select based
2798 * @channel_hint: The channel of the recommended BSS for initial connection or
2799 * %NULL if not specified
2800 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2802 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2803 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2804 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2807 * @ssid_len: Length of ssid in octets
2808 * @auth_type: Authentication type (algorithm)
2809 * @ie: IEs for association request
2810 * @ie_len: Length of assoc_ie in octets
2811 * @privacy: indicates whether privacy-enabled APs should be used
2812 * @mfp: indicate whether management frame protection is used
2813 * @crypto: crypto settings
2814 * @key_len: length of WEP key for shared key authentication
2815 * @key_idx: index of WEP key for shared key authentication
2816 * @key: WEP key for shared key authentication
2817 * @flags: See &enum cfg80211_assoc_req_flags
2818 * @bg_scan_period: Background scan period in seconds
2819 * or -1 to indicate that default value is to be used.
2820 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2821 * will be used in ht_capa. Un-supported values will be ignored.
2822 * @ht_capa_mask: The bits of ht_capa which are to be used.
2823 * @vht_capa: VHT Capability overrides
2824 * @vht_capa_mask: The bits of vht_capa which are to be used.
2825 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2827 * @bss_select: criteria to be used for BSS selection.
2828 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2829 * to indicate a request to reassociate within the ESS instead of a request
2830 * do the initial association with the ESS. When included, this is set to
2831 * the BSSID of the current association, i.e., to the value that is
2832 * included in the Current AP address field of the Reassociation Request
2834 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2835 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2837 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2838 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2839 * %NULL if not specified. This specifies the domain name of ER server and
2840 * is used to construct FILS wrapped data IE.
2841 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2842 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2843 * messages. This is also used to construct FILS wrapped data IE.
2844 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2845 * keys in FILS or %NULL if not specified.
2846 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
2847 * @want_1x: indicates user-space supports and wants to use 802.1X driver
2848 * offload of 4-way handshake.
2849 * @edmg: define the EDMG channels.
2850 * This may specify multiple channels and bonding options for the driver
2851 * to choose from, based on BSS configuration.
2853 struct cfg80211_connect_params {
2854 struct ieee80211_channel *channel;
2855 struct ieee80211_channel *channel_hint;
2857 const u8 *bssid_hint;
2860 enum nl80211_auth_type auth_type;
2864 enum nl80211_mfp mfp;
2865 struct cfg80211_crypto_settings crypto;
2867 u8 key_len, key_idx;
2870 struct ieee80211_ht_cap ht_capa;
2871 struct ieee80211_ht_cap ht_capa_mask;
2872 struct ieee80211_vht_cap vht_capa;
2873 struct ieee80211_vht_cap vht_capa_mask;
2875 struct cfg80211_bss_selection bss_select;
2876 const u8 *prev_bssid;
2877 const u8 *fils_erp_username;
2878 size_t fils_erp_username_len;
2879 const u8 *fils_erp_realm;
2880 size_t fils_erp_realm_len;
2881 u16 fils_erp_next_seq_num;
2882 const u8 *fils_erp_rrk;
2883 size_t fils_erp_rrk_len;
2885 struct ieee80211_edmg edmg;
2889 * enum cfg80211_connect_params_changed - Connection parameters being updated
2891 * This enum provides information of all connect parameters that
2892 * have to be updated as part of update_connect_params() call.
2894 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2895 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2896 * username, erp sequence number and rrk) are updated
2897 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2899 enum cfg80211_connect_params_changed {
2900 UPDATE_ASSOC_IES = BIT(0),
2901 UPDATE_FILS_ERP_INFO = BIT(1),
2902 UPDATE_AUTH_TYPE = BIT(2),
2906 * enum wiphy_params_flags - set_wiphy_params bitfield values
2907 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2908 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2909 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2910 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2911 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
2912 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
2913 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2914 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2915 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2917 enum wiphy_params_flags {
2918 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2919 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2920 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2921 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
2922 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
2923 WIPHY_PARAM_DYN_ACK = 1 << 5,
2924 WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2925 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2926 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
2929 #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
2931 /* The per TXQ device queue limit in airtime */
2932 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
2933 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
2935 /* The per interface airtime threshold to switch to lower queue limit */
2936 #define IEEE80211_AQL_THRESHOLD 24000
2939 * struct cfg80211_pmksa - PMK Security Association
2941 * This structure is passed to the set/del_pmksa() method for PMKSA
2944 * @bssid: The AP's BSSID (may be %NULL).
2945 * @pmkid: The identifier to refer a PMKSA.
2946 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2947 * derivation by a FILS STA. Otherwise, %NULL.
2948 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2949 * the hash algorithm used to generate this.
2950 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2951 * cache identifier (may be %NULL).
2952 * @ssid_len: Length of the @ssid in octets.
2953 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2954 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2956 * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
2957 * (dot11RSNAConfigPMKLifetime) or 0 if not specified.
2958 * The configured PMKSA must not be used for PMKSA caching after
2959 * expiration and any keys derived from this PMK become invalid on
2960 * expiration, i.e., the current association must be dropped if the PMK
2961 * used for it expires.
2962 * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
2963 * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
2964 * Drivers are expected to trigger a full authentication instead of using
2965 * this PMKSA for caching when reassociating to a new BSS after this
2966 * threshold to generate a new PMK before the current one expires.
2968 struct cfg80211_pmksa {
2977 u8 pmk_reauth_threshold;
2981 * struct cfg80211_pkt_pattern - packet pattern
2982 * @mask: bitmask where to match pattern and where to ignore bytes,
2983 * one bit per byte, in same format as nl80211
2984 * @pattern: bytes to match where bitmask is 1
2985 * @pattern_len: length of pattern (in bytes)
2986 * @pkt_offset: packet offset (in bytes)
2988 * Internal note: @mask and @pattern are allocated in one chunk of
2989 * memory, free @mask only!
2991 struct cfg80211_pkt_pattern {
2992 const u8 *mask, *pattern;
2998 * struct cfg80211_wowlan_tcp - TCP connection parameters
3000 * @sock: (internal) socket for source port allocation
3001 * @src: source IP address
3002 * @dst: destination IP address
3003 * @dst_mac: destination MAC address
3004 * @src_port: source port
3005 * @dst_port: destination port
3006 * @payload_len: data payload length
3007 * @payload: data payload buffer
3008 * @payload_seq: payload sequence stamping configuration
3009 * @data_interval: interval at which to send data packets
3010 * @wake_len: wakeup payload match length
3011 * @wake_data: wakeup payload match data
3012 * @wake_mask: wakeup payload match mask
3013 * @tokens_size: length of the tokens buffer
3014 * @payload_tok: payload token usage configuration
3016 struct cfg80211_wowlan_tcp {
3017 struct socket *sock;
3019 u16 src_port, dst_port;
3020 u8 dst_mac[ETH_ALEN];
3023 struct nl80211_wowlan_tcp_data_seq payload_seq;
3026 const u8 *wake_data, *wake_mask;
3028 /* must be last, variable member */
3029 struct nl80211_wowlan_tcp_data_token payload_tok;
3033 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3035 * This structure defines the enabled WoWLAN triggers for the device.
3036 * @any: wake up on any activity -- special trigger if device continues
3037 * operating as normal during suspend
3038 * @disconnect: wake up if getting disconnected
3039 * @magic_pkt: wake up on receiving magic packet
3040 * @patterns: wake up on receiving packet matching a pattern
3041 * @n_patterns: number of patterns
3042 * @gtk_rekey_failure: wake up on GTK rekey failure
3043 * @eap_identity_req: wake up on EAP identity request packet
3044 * @four_way_handshake: wake up on 4-way handshake
3045 * @rfkill_release: wake up when rfkill is released
3046 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
3047 * NULL if not configured.
3048 * @nd_config: configuration for the scan to be used for net detect wake.
3050 struct cfg80211_wowlan {
3051 bool any, disconnect, magic_pkt, gtk_rekey_failure,
3052 eap_identity_req, four_way_handshake,
3054 struct cfg80211_pkt_pattern *patterns;
3055 struct cfg80211_wowlan_tcp *tcp;
3057 struct cfg80211_sched_scan_request *nd_config;
3061 * struct cfg80211_coalesce_rules - Coalesce rule parameters
3063 * This structure defines coalesce rule for the device.
3064 * @delay: maximum coalescing delay in msecs.
3065 * @condition: condition for packet coalescence.
3066 * see &enum nl80211_coalesce_condition.
3067 * @patterns: array of packet patterns
3068 * @n_patterns: number of patterns
3070 struct cfg80211_coalesce_rules {
3072 enum nl80211_coalesce_condition condition;
3073 struct cfg80211_pkt_pattern *patterns;
3078 * struct cfg80211_coalesce - Packet coalescing settings
3080 * This structure defines coalescing settings.
3081 * @rules: array of coalesce rules
3082 * @n_rules: number of rules
3084 struct cfg80211_coalesce {
3085 struct cfg80211_coalesce_rules *rules;
3090 * struct cfg80211_wowlan_nd_match - information about the match
3092 * @ssid: SSID of the match that triggered the wake up
3093 * @n_channels: Number of channels where the match occurred. This
3094 * value may be zero if the driver can't report the channels.
3095 * @channels: center frequencies of the channels where a match
3098 struct cfg80211_wowlan_nd_match {
3099 struct cfg80211_ssid ssid;
3105 * struct cfg80211_wowlan_nd_info - net detect wake up information
3107 * @n_matches: Number of match information instances provided in
3108 * @matches. This value may be zero if the driver can't provide
3109 * match information.
3110 * @matches: Array of pointers to matches containing information about
3111 * the matches that triggered the wake up.
3113 struct cfg80211_wowlan_nd_info {
3115 struct cfg80211_wowlan_nd_match *matches[];
3119 * struct cfg80211_wowlan_wakeup - wakeup report
3120 * @disconnect: woke up by getting disconnected
3121 * @magic_pkt: woke up by receiving magic packet
3122 * @gtk_rekey_failure: woke up by GTK rekey failure
3123 * @eap_identity_req: woke up by EAP identity request packet
3124 * @four_way_handshake: woke up by 4-way handshake
3125 * @rfkill_release: woke up by rfkill being released
3126 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3127 * @packet_present_len: copied wakeup packet data
3128 * @packet_len: original wakeup packet length
3129 * @packet: The packet causing the wakeup, if any.
3130 * @packet_80211: For pattern match, magic packet and other data
3131 * frame triggers an 802.3 frame should be reported, for
3132 * disconnect due to deauth 802.11 frame. This indicates which
3134 * @tcp_match: TCP wakeup packet received
3135 * @tcp_connlost: TCP connection lost or failed to establish
3136 * @tcp_nomoretokens: TCP data ran out of tokens
3137 * @net_detect: if not %NULL, woke up because of net detect
3139 struct cfg80211_wowlan_wakeup {
3140 bool disconnect, magic_pkt, gtk_rekey_failure,
3141 eap_identity_req, four_way_handshake,
3142 rfkill_release, packet_80211,
3143 tcp_match, tcp_connlost, tcp_nomoretokens;
3145 u32 packet_present_len, packet_len;
3147 struct cfg80211_wowlan_nd_info *net_detect;
3151 * struct cfg80211_gtk_rekey_data - rekey data
3152 * @kek: key encryption key (@kek_len bytes)
3153 * @kck: key confirmation key (@kck_len bytes)
3154 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3155 * @kek_len: length of kek
3156 * @kck_len length of kck
3157 * @akm: akm (oui, id)
3159 struct cfg80211_gtk_rekey_data {
3160 const u8 *kek, *kck, *replay_ctr;
3162 u8 kek_len, kck_len;
3166 * struct cfg80211_update_ft_ies_params - FT IE Information
3168 * This structure provides information needed to update the fast transition IE
3170 * @md: The Mobility Domain ID, 2 Octet value
3171 * @ie: Fast Transition IEs
3172 * @ie_len: Length of ft_ie in octets
3174 struct cfg80211_update_ft_ies_params {
3181 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3183 * This structure provides information needed to transmit a mgmt frame
3185 * @chan: channel to use
3186 * @offchan: indicates wether off channel operation is required
3187 * @wait: duration for ROC
3188 * @buf: buffer to transmit
3189 * @len: buffer length
3190 * @no_cck: don't use cck rates for this frame
3191 * @dont_wait_for_ack: tells the low level not to wait for an ack
3192 * @n_csa_offsets: length of csa_offsets array
3193 * @csa_offsets: array of all the csa offsets in the frame
3195 struct cfg80211_mgmt_tx_params {
3196 struct ieee80211_channel *chan;
3202 bool dont_wait_for_ack;
3204 const u16 *csa_offsets;
3208 * struct cfg80211_dscp_exception - DSCP exception
3210 * @dscp: DSCP value that does not adhere to the user priority range definition
3211 * @up: user priority value to which the corresponding DSCP value belongs
3213 struct cfg80211_dscp_exception {
3219 * struct cfg80211_dscp_range - DSCP range definition for user priority
3221 * @low: lowest DSCP value of this user priority range, inclusive
3222 * @high: highest DSCP value of this user priority range, inclusive
3224 struct cfg80211_dscp_range {
3229 /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3230 #define IEEE80211_QOS_MAP_MAX_EX 21
3231 #define IEEE80211_QOS_MAP_LEN_MIN 16
3232 #define IEEE80211_QOS_MAP_LEN_MAX \
3233 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3236 * struct cfg80211_qos_map - QoS Map Information
3238 * This struct defines the Interworking QoS map setting for DSCP values
3240 * @num_des: number of DSCP exceptions (0..21)
3241 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3242 * the user priority DSCP range definition
3243 * @up: DSCP range definition for a particular user priority
3245 struct cfg80211_qos_map {
3247 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3248 struct cfg80211_dscp_range up[8];
3252 * struct cfg80211_nan_conf - NAN configuration
3254 * This struct defines NAN configuration parameters
3256 * @master_pref: master preference (1 - 255)
3257 * @bands: operating bands, a bitmap of &enum nl80211_band values.
3258 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
3259 * (i.e. BIT(NL80211_BAND_2GHZ)).
3261 struct cfg80211_nan_conf {
3267 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3270 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
3271 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3273 enum cfg80211_nan_conf_changes {
3274 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
3275 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3279 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3281 * @filter: the content of the filter
3282 * @len: the length of the filter
3284 struct cfg80211_nan_func_filter {
3290 * struct cfg80211_nan_func - a NAN function
3292 * @type: &enum nl80211_nan_function_type
3293 * @service_id: the service ID of the function
3294 * @publish_type: &nl80211_nan_publish_type
3295 * @close_range: if true, the range should be limited. Threshold is
3296 * implementation specific.
3297 * @publish_bcast: if true, the solicited publish should be broadcasted
3298 * @subscribe_active: if true, the subscribe is active
3299 * @followup_id: the instance ID for follow up
3300 * @followup_reqid: the requestor instance ID for follow up
3301 * @followup_dest: MAC address of the recipient of the follow up
3302 * @ttl: time to live counter in DW.
3303 * @serv_spec_info: Service Specific Info
3304 * @serv_spec_info_len: Service Specific Info length
3305 * @srf_include: if true, SRF is inclusive
3306 * @srf_bf: Bloom Filter
3307 * @srf_bf_len: Bloom Filter length
3308 * @srf_bf_idx: Bloom Filter index
3309 * @srf_macs: SRF MAC addresses
3310 * @srf_num_macs: number of MAC addresses in SRF
3311 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3312 * @tx_filters: filters that should be transmitted in the SDF.
3313 * @num_rx_filters: length of &rx_filters.
3314 * @num_tx_filters: length of &tx_filters.
3315 * @instance_id: driver allocated id of the function.
3316 * @cookie: unique NAN function identifier.
3318 struct cfg80211_nan_func {
3319 enum nl80211_nan_function_type type;
3320 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3324 bool subscribe_active;
3327 struct mac_address followup_dest;
3329 const u8 *serv_spec_info;
3330 u8 serv_spec_info_len;
3335 struct mac_address *srf_macs;
3337 struct cfg80211_nan_func_filter *rx_filters;
3338 struct cfg80211_nan_func_filter *tx_filters;
3346 * struct cfg80211_pmk_conf - PMK configuration
3348 * @aa: authenticator address
3349 * @pmk_len: PMK length in bytes.
3350 * @pmk: the PMK material
3351 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
3352 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
3355 struct cfg80211_pmk_conf {
3359 const u8 *pmk_r0_name;
3363 * struct cfg80211_external_auth_params - Trigger External authentication.
3365 * Commonly used across the external auth request and event interfaces.
3367 * @action: action type / trigger for external authentication. Only significant
3368 * for the authentication request event interface (driver to user space).
3369 * @bssid: BSSID of the peer with which the authentication has
3370 * to happen. Used by both the authentication request event and
3371 * authentication response command interface.
3372 * @ssid: SSID of the AP. Used by both the authentication request event and
3373 * authentication response command interface.
3374 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
3375 * authentication request event interface.
3376 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
3377 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
3378 * the real status code for failures. Used only for the authentication
3379 * response command interface (user space to driver).
3380 * @pmkid: The identifier to refer a PMKSA.
3382 struct cfg80211_external_auth_params {
3383 enum nl80211_external_auth_action action;
3384 u8 bssid[ETH_ALEN] __aligned(2);
3385 struct cfg80211_ssid ssid;
3386 unsigned int key_mgmt_suite;
3392 * struct cfg80211_ftm_responder_stats - FTM responder statistics
3394 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
3395 * indicate the relevant values in this struct for them
3396 * @success_num: number of FTM sessions in which all frames were successfully
3398 * @partial_num: number of FTM sessions in which part of frames were
3399 * successfully answered
3400 * @failed_num: number of failed FTM sessions
3401 * @asap_num: number of ASAP FTM sessions
3402 * @non_asap_num: number of non-ASAP FTM sessions
3403 * @total_duration_ms: total sessions durations - gives an indication
3404 * of how much time the responder was busy
3405 * @unknown_triggers_num: number of unknown FTM triggers - triggers from
3406 * initiators that didn't finish successfully the negotiation phase with
3408 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
3409 * for a new scheduling although it already has scheduled FTM slot
3410 * @out_of_window_triggers_num: total FTM triggers out of scheduled window
3412 struct cfg80211_ftm_responder_stats {
3419 u64 total_duration_ms;
3420 u32 unknown_triggers_num;
3421 u32 reschedule_requests_num;
3422 u32 out_of_window_triggers_num;
3426 * struct cfg80211_pmsr_ftm_result - FTM result
3427 * @failure_reason: if this measurement failed (PMSR status is
3428 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
3429 * reason than just "failure"
3430 * @burst_index: if reporting partial results, this is the index
3431 * in [0 .. num_bursts-1] of the burst that's being reported
3432 * @num_ftmr_attempts: number of FTM request frames transmitted
3433 * @num_ftmr_successes: number of FTM request frames acked
3434 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
3435 * fill this to indicate in how many seconds a retry is deemed possible
3437 * @num_bursts_exp: actual number of bursts exponent negotiated
3438 * @burst_duration: actual burst duration negotiated
3439 * @ftms_per_burst: actual FTMs per burst negotiated
3440 * @lci_len: length of LCI information (if present)
3441 * @civicloc_len: length of civic location information (if present)
3442 * @lci: LCI data (may be %NULL)
3443 * @civicloc: civic location data (may be %NULL)
3444 * @rssi_avg: average RSSI over FTM action frames reported
3445 * @rssi_spread: spread of the RSSI over FTM action frames reported
3446 * @tx_rate: bitrate for transmitted FTM action frame response
3447 * @rx_rate: bitrate of received FTM action frame
3448 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
3449 * @rtt_variance: variance of RTTs measured (note that standard deviation is
3450 * the square root of the variance)
3451 * @rtt_spread: spread of the RTTs measured
3452 * @dist_avg: average of distances (mm) measured
3453 * (must have either this or @rtt_avg)
3454 * @dist_variance: variance of distances measured (see also @rtt_variance)
3455 * @dist_spread: spread of distances measured (see also @rtt_spread)
3456 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
3457 * @num_ftmr_successes_valid: @num_ftmr_successes is valid
3458 * @rssi_avg_valid: @rssi_avg is valid
3459 * @rssi_spread_valid: @rssi_spread is valid
3460 * @tx_rate_valid: @tx_rate is valid
3461 * @rx_rate_valid: @rx_rate is valid
3462 * @rtt_avg_valid: @rtt_avg is valid
3463 * @rtt_variance_valid: @rtt_variance is valid
3464 * @rtt_spread_valid: @rtt_spread is valid
3465 * @dist_avg_valid: @dist_avg is valid
3466 * @dist_variance_valid: @dist_variance is valid
3467 * @dist_spread_valid: @dist_spread is valid
3469 struct cfg80211_pmsr_ftm_result {
3472 unsigned int lci_len;
3473 unsigned int civicloc_len;
3474 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
3475 u32 num_ftmr_attempts, num_ftmr_successes;
3483 struct rate_info tx_rate, rx_rate;
3491 u16 num_ftmr_attempts_valid:1,
3492 num_ftmr_successes_valid:1,
3494 rssi_spread_valid:1,
3498 rtt_variance_valid:1,
3501 dist_variance_valid:1,
3502 dist_spread_valid:1;
3506 * struct cfg80211_pmsr_result - peer measurement result
3507 * @addr: address of the peer
3508 * @host_time: host time (use ktime_get_boottime() adjust to the time when the
3509 * measurement was made)
3510 * @ap_tsf: AP's TSF at measurement time
3511 * @status: status of the measurement
3512 * @final: if reporting partial results, mark this as the last one; if not
3513 * reporting partial results always set this flag
3514 * @ap_tsf_valid: indicates the @ap_tsf value is valid
3515 * @type: type of the measurement reported, note that we only support reporting
3516 * one type at a time, but you can report multiple results separately and
3517 * they're all aggregated for userspace.
3519 struct cfg80211_pmsr_result {
3520 u64 host_time, ap_tsf;
3521 enum nl80211_peer_measurement_status status;
3528 enum nl80211_peer_measurement_type type;
3531 struct cfg80211_pmsr_ftm_result ftm;
3536 * struct cfg80211_pmsr_ftm_request_peer - FTM request data
3537 * @requested: indicates FTM is requested
3538 * @preamble: frame preamble to use
3539 * @burst_period: burst period to use
3540 * @asap: indicates to use ASAP mode
3541 * @num_bursts_exp: number of bursts exponent
3542 * @burst_duration: burst duration
3543 * @ftms_per_burst: number of FTMs per burst
3544 * @ftmr_retries: number of retries for FTM request
3545 * @request_lci: request LCI information
3546 * @request_civicloc: request civic location information
3547 * @trigger_based: use trigger based ranging for the measurement
3548 * If neither @trigger_based nor @non_trigger_based is set,
3549 * EDCA based ranging will be used.
3550 * @non_trigger_based: use non trigger based ranging for the measurement
3551 * If neither @trigger_based nor @non_trigger_based is set,
3552 * EDCA based ranging will be used.
3553 * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
3554 * @trigger_based or @non_trigger_based is set.
3555 * @bss_color: the bss color of the responder. Optional. Set to zero to
3556 * indicate the driver should set the BSS color. Only valid if
3557 * @non_trigger_based or @trigger_based is set.
3559 * See also nl80211 for the respective attribute documentation.
3561 struct cfg80211_pmsr_ftm_request_peer {
3562 enum nl80211_preamble preamble;
3569 non_trigger_based:1,
3579 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
3580 * @addr: MAC address
3581 * @chandef: channel to use
3582 * @report_ap_tsf: report the associated AP's TSF
3583 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
3585 struct cfg80211_pmsr_request_peer {
3587 struct cfg80211_chan_def chandef;
3589 struct cfg80211_pmsr_ftm_request_peer ftm;
3593 * struct cfg80211_pmsr_request - peer measurement request
3594 * @cookie: cookie, set by cfg80211
3595 * @nl_portid: netlink portid - used by cfg80211
3596 * @drv_data: driver data for this request, if required for aborting,
3597 * not otherwise freed or anything by cfg80211
3598 * @mac_addr: MAC address used for (randomised) request
3599 * @mac_addr_mask: MAC address mask used for randomisation, bits that
3600 * are 0 in the mask should be randomised, bits that are 1 should
3601 * be taken from the @mac_addr
3602 * @list: used by cfg80211 to hold on to the request
3603 * @timeout: timeout (in milliseconds) for the whole operation, if
3604 * zero it means there's no timeout
3605 * @n_peers: number of peers to do measurements with
3606 * @peers: per-peer measurement request data
3608 struct cfg80211_pmsr_request {
3616 u8 mac_addr[ETH_ALEN] __aligned(2);
3617 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3619 struct list_head list;
3621 struct cfg80211_pmsr_request_peer peers[];
3625 * struct cfg80211_update_owe_info - OWE Information
3627 * This structure provides information needed for the drivers to offload OWE
3628 * (Opportunistic Wireless Encryption) processing to the user space.
3630 * Commonly used across update_owe_info request and event interfaces.
3632 * @peer: MAC address of the peer device for which the OWE processing
3634 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3635 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3636 * cannot give you the real status code for failures. Used only for
3637 * OWE update request command interface (user space to driver).
3638 * @ie: IEs obtained from the peer or constructed by the user space. These are
3639 * the IEs of the remote peer in the event from the host driver and
3640 * the constructed IEs by the user space in the request interface.
3641 * @ie_len: Length of IEs in octets.
3643 struct cfg80211_update_owe_info {
3644 u8 peer[ETH_ALEN] __aligned(2);
3651 * struct mgmt_frame_regs - management frame registrations data
3652 * @global_stypes: bitmap of management frame subtypes registered
3653 * for the entire device
3654 * @interface_stypes: bitmap of management frame subtypes registered
3655 * for the given interface
3656 * @global_mcast_rx: mcast RX is needed globally for these subtypes
3657 * @interface_mcast_stypes: mcast RX is needed on this interface
3658 * for these subtypes
3660 struct mgmt_frame_regs {
3661 u32 global_stypes, interface_stypes;
3662 u32 global_mcast_stypes, interface_mcast_stypes;
3666 * struct cfg80211_ops - backend description for wireless configuration
3668 * This struct is registered by fullmac card drivers and/or wireless stacks
3669 * in order to handle configuration requests on their interfaces.
3671 * All callbacks except where otherwise noted should return 0
3672 * on success or a negative error code.
3674 * All operations are invoked with the wiphy mutex held. The RTNL may be
3675 * held in addition (due to wireless extensions) but this cannot be relied
3676 * upon except in cases where documented below. Note that due to ordering,
3677 * the RTNL also cannot be acquired in any handlers.
3679 * @suspend: wiphy device needs to be suspended. The variable @wow will
3680 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
3681 * configured for the device.
3682 * @resume: wiphy device needs to be resumed
3683 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
3684 * to call device_set_wakeup_enable() to enable/disable wakeup from
3687 * @add_virtual_intf: create a new virtual interface with the given name,
3688 * must set the struct wireless_dev's iftype. Beware: You must create
3689 * the new netdev in the wiphy's network namespace! Returns the struct
3690 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
3691 * also set the address member in the wdev.
3692 * This additionally holds the RTNL to be able to do netdev changes.
3694 * @del_virtual_intf: remove the virtual interface
3695 * This additionally holds the RTNL to be able to do netdev changes.
3697 * @change_virtual_intf: change type/configuration of virtual interface,
3698 * keep the struct wireless_dev's iftype updated.
3699 * This additionally holds the RTNL to be able to do netdev changes.
3701 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
3702 * when adding a group key.
3704 * @get_key: get information about the key with the given parameters.
3705 * @mac_addr will be %NULL when requesting information for a group
3706 * key. All pointers given to the @callback function need not be valid
3707 * after it returns. This function should return an error if it is
3708 * not possible to retrieve the key, -ENOENT if it doesn't exist.
3710 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3711 * and @key_index, return -ENOENT if the key doesn't exist.
3713 * @set_default_key: set the default key on an interface
3715 * @set_default_mgmt_key: set the default management frame key on an interface
3717 * @set_default_beacon_key: set the default Beacon frame key on an interface
3719 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3721 * @start_ap: Start acting in AP mode defined by the parameters.
3722 * @change_beacon: Change the beacon parameters for an access point mode
3723 * interface. This should reject the call when AP mode wasn't started.
3724 * @stop_ap: Stop being an AP, including stopping beaconing.
3726 * @add_station: Add a new station.
3727 * @del_station: Remove a station
3728 * @change_station: Modify a given station. Note that flags changes are not much
3729 * validated in cfg80211, in particular the auth/assoc/authorized flags
3730 * might come to the driver in invalid combinations -- make sure to check
3731 * them, also against the existing state! Drivers must call
3732 * cfg80211_check_station_change() to validate the information.
3733 * @get_station: get station information for the station identified by @mac
3734 * @dump_station: dump station callback -- resume dump at index @idx
3736 * @add_mpath: add a fixed mesh path
3737 * @del_mpath: delete a given mesh path
3738 * @change_mpath: change a given mesh path
3739 * @get_mpath: get a mesh path for the given parameters
3740 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
3741 * @get_mpp: get a mesh proxy path for the given parameters
3742 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3743 * @join_mesh: join the mesh network with the specified parameters
3744 * (invoked with the wireless_dev mutex held)
3745 * @leave_mesh: leave the current mesh network
3746 * (invoked with the wireless_dev mutex held)
3748 * @get_mesh_config: Get the current mesh configuration
3750 * @update_mesh_config: Update mesh parameters on a running mesh.
3751 * The mask is a bitfield which tells us which parameters to
3752 * set, and which to leave alone.
3754 * @change_bss: Modify parameters for a given BSS.
3756 * @set_txq_params: Set TX queue parameters
3758 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3759 * as it doesn't implement join_mesh and needs to set the channel to
3760 * join the mesh instead.
3762 * @set_monitor_channel: Set the monitor mode channel for the device. If other
3763 * interfaces are active this callback should reject the configuration.
3764 * If no interfaces are active or the device is down, the channel should
3765 * be stored for when a monitor interface becomes active.
3767 * @scan: Request to do a scan. If returning zero, the scan request is given
3768 * the driver, and will be valid until passed to cfg80211_scan_done().
3769 * For scan results, call cfg80211_inform_bss(); you can call this outside
3770 * the scan/scan_done bracket too.
3771 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
3772 * indicate the status of the scan through cfg80211_scan_done().
3774 * @auth: Request to authenticate with the specified peer
3775 * (invoked with the wireless_dev mutex held)
3776 * @assoc: Request to (re)associate with the specified peer
3777 * (invoked with the wireless_dev mutex held)
3778 * @deauth: Request to deauthenticate from the specified peer
3779 * (invoked with the wireless_dev mutex held)
3780 * @disassoc: Request to disassociate from the specified peer
3781 * (invoked with the wireless_dev mutex held)
3783 * @connect: Connect to the ESS with the specified parameters. When connected,
3784 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3785 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3786 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3787 * from the AP or cfg80211_connect_timeout() if no frame with status code
3789 * The driver is allowed to roam to other BSSes within the ESS when the
3790 * other BSS matches the connect parameters. When such roaming is initiated
3791 * by the driver, the driver is expected to verify that the target matches
3792 * the configured security parameters and to use Reassociation Request
3793 * frame instead of Association Request frame.
3794 * The connect function can also be used to request the driver to perform a
3795 * specific roam when connected to an ESS. In that case, the prev_bssid
3796 * parameter is set to the BSSID of the currently associated BSS as an
3797 * indication of requesting reassociation.
3798 * In both the driver-initiated and new connect() call initiated roaming
3799 * cases, the result of roaming is indicated with a call to
3800 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3801 * @update_connect_params: Update the connect parameters while connected to a
3802 * BSS. The updated parameters can be used by driver/firmware for
3803 * subsequent BSS selection (roaming) decisions and to form the
3804 * Authentication/(Re)Association Request frames. This call does not
3805 * request an immediate disassociation or reassociation with the current
3806 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
3807 * changed are defined in &enum cfg80211_connect_params_changed.
3808 * (invoked with the wireless_dev mutex held)
3809 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
3810 * connection is in progress. Once done, call cfg80211_disconnected() in
3811 * case connection was already established (invoked with the
3812 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3814 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
3815 * cfg80211_ibss_joined(), also call that function when changing BSSID due
3817 * (invoked with the wireless_dev mutex held)
3818 * @leave_ibss: Leave the IBSS.
3819 * (invoked with the wireless_dev mutex held)
3821 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3824 * @set_wiphy_params: Notify that wiphy parameters have changed;
3825 * @changed bitfield (see &enum wiphy_params_flags) describes which values
3826 * have changed. The actual parameter values are available in
3827 * struct wiphy. If returning an error, no value should be changed.
3829 * @set_tx_power: set the transmit power according to the parameters,
3830 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3831 * wdev may be %NULL if power was set for the wiphy, and will
3832 * always be %NULL unless the driver supports per-vif TX power
3833 * (as advertised by the nl80211 feature flag.)
3834 * @get_tx_power: store the current TX power into the dbm variable;
3835 * return 0 if successful
3837 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
3838 * functions to adjust rfkill hw state
3840 * @dump_survey: get site survey information.
3842 * @remain_on_channel: Request the driver to remain awake on the specified
3843 * channel for the specified duration to complete an off-channel
3844 * operation (e.g., public action frame exchange). When the driver is
3845 * ready on the requested channel, it must indicate this with an event
3846 * notification by calling cfg80211_ready_on_channel().
3847 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
3848 * This allows the operation to be terminated prior to timeout based on
3849 * the duration value.
3850 * @mgmt_tx: Transmit a management frame.
3851 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3852 * frame on another channel
3854 * @testmode_cmd: run a test mode command; @wdev may be %NULL
3855 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
3856 * used by the function, but 0 and 1 must not be touched. Additionally,
3857 * return error codes other than -ENOBUFS and -ENOENT will terminate the
3858 * dump and return to userspace with an error, so be careful. If any data
3859 * was passed in from userspace then the data/len arguments will be present
3860 * and point to the data contained in %NL80211_ATTR_TESTDATA.
3862 * @set_bitrate_mask: set the bitrate mask configuration
3864 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
3865 * devices running firmwares capable of generating the (re) association
3866 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
3867 * @del_pmksa: Delete a cached PMKID.
3868 * @flush_pmksa: Flush all cached PMKIDs.
3869 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
3870 * allows the driver to adjust the dynamic ps timeout value.
3871 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3872 * After configuration, the driver should (soon) send an event indicating
3873 * the current level is above/below the configured threshold; this may
3874 * need some care when the configuration is changed (without first being
3876 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
3877 * connection quality monitor. An event is to be sent only when the
3878 * signal level is found to be outside the two values. The driver should
3879 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
3880 * If it is provided then there's no point providing @set_cqm_rssi_config.
3881 * @set_cqm_txe_config: Configure connection quality monitor TX error
3883 * @sched_scan_start: Tell the driver to start a scheduled scan.
3884 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
3885 * given request id. This call must stop the scheduled scan and be ready
3886 * for starting a new one before it returns, i.e. @sched_scan_start may be
3887 * called immediately after that again and should not fail in that case.
3888 * The driver should not call cfg80211_sched_scan_stopped() for a requested
3889 * stop (when this method returns 0).
3891 * @update_mgmt_frame_registrations: Notify the driver that management frame
3892 * registrations were updated. The callback is allowed to sleep.
3894 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3895 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3896 * reject TX/RX mask combinations they cannot support by returning -EINVAL
3897 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3899 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
3901 * @tdls_mgmt: Transmit a TDLS management frame.
3902 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
3904 * @probe_client: probe an associated client, must return a cookie that it
3905 * later passes to cfg80211_probe_status().
3907 * @set_noack_map: Set the NoAck Map for the TIDs.
3909 * @get_channel: Get the current operating channel for the virtual interface.
3910 * For monitor interfaces, it should return %NULL unless there's a single
3911 * current monitoring channel.
3913 * @start_p2p_device: Start the given P2P device.
3914 * @stop_p2p_device: Stop the given P2P device.
3916 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
3917 * Parameters include ACL policy, an array of MAC address of stations
3918 * and the number of MAC addresses. If there is already a list in driver
3919 * this new list replaces the existing one. Driver has to clear its ACL
3920 * when number of MAC addresses entries is passed as 0. Drivers which
3921 * advertise the support for MAC based ACL have to implement this callback.
3923 * @start_radar_detection: Start radar detection in the driver.
3925 * @end_cac: End running CAC, probably because a related CAC
3926 * was finished on another phy.
3928 * @update_ft_ies: Provide updated Fast BSS Transition information to the
3929 * driver. If the SME is in the driver/firmware, this information can be
3930 * used in building Authentication and Reassociation Request frames.
3932 * @crit_proto_start: Indicates a critical protocol needs more link reliability
3933 * for a given duration (milliseconds). The protocol is provided so the
3934 * driver can take the most appropriate actions.
3935 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
3936 * reliability. This operation can not fail.
3937 * @set_coalesce: Set coalesce parameters.
3939 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
3940 * responsible for veryfing if the switch is possible. Since this is
3941 * inherently tricky driver may decide to disconnect an interface later
3942 * with cfg80211_stop_iface(). This doesn't mean driver can accept
3943 * everything. It should do it's best to verify requests and reject them
3944 * as soon as possible.
3946 * @set_qos_map: Set QoS mapping information to the driver
3948 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3949 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3950 * changes during the lifetime of the BSS.
3952 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3953 * with the given parameters; action frame exchange has been handled by
3954 * userspace so this just has to modify the TX path to take the TS into
3956 * If the admitted time is 0 just validate the parameters to make sure
3957 * the session can be created at all; it is valid to just always return
3958 * success for that but that may result in inefficient behaviour (handshake
3959 * with the peer followed by immediate teardown when the addition is later
3961 * @del_tx_ts: remove an existing TX TS
3963 * @join_ocb: join the OCB network with the specified parameters
3964 * (invoked with the wireless_dev mutex held)
3965 * @leave_ocb: leave the current OCB network
3966 * (invoked with the wireless_dev mutex held)
3968 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
3969 * is responsible for continually initiating channel-switching operations
3970 * and returning to the base channel for communication with the AP.
3971 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
3972 * peers must be on the base channel when the call completes.
3973 * @start_nan: Start the NAN interface.
3974 * @stop_nan: Stop the NAN interface.
3975 * @add_nan_func: Add a NAN function. Returns negative value on failure.
3976 * On success @nan_func ownership is transferred to the driver and
3977 * it may access it outside of the scope of this function. The driver
3978 * should free the @nan_func when no longer needed by calling
3979 * cfg80211_free_nan_func().
3980 * On success the driver should assign an instance_id in the
3981 * provided @nan_func.
3982 * @del_nan_func: Delete a NAN function.
3983 * @nan_change_conf: changes NAN configuration. The changed parameters must
3984 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
3985 * All other parameters must be ignored.
3987 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
3989 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3990 * function should return phy stats, and interface stats otherwise.
3992 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
3993 * If not deleted through @del_pmk the PMK remains valid until disconnect
3994 * upon which the driver should clear it.
3995 * (invoked with the wireless_dev mutex held)
3996 * @del_pmk: delete the previously configured PMK for the given authenticator.
3997 * (invoked with the wireless_dev mutex held)
3999 * @external_auth: indicates result of offloaded authentication processing from
4002 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
4003 * tells the driver that the frame should not be encrypted.
4005 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
4006 * Statistics should be cumulative, currently no way to reset is provided.
4007 * @start_pmsr: start peer measurement (e.g. FTM)
4008 * @abort_pmsr: abort peer measurement
4010 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
4011 * but offloading OWE processing to the user space will get the updated
4012 * DH IE through this interface.
4014 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
4015 * and overrule HWMP path selection algorithm.
4016 * @set_tid_config: TID specific configuration, this can be peer or BSS specific
4017 * This callback may sleep.
4018 * @reset_tid_config: Reset TID specific configuration for the peer, for the
4019 * given TIDs. This callback may sleep.
4021 * @set_sar_specs: Update the SAR (TX power) settings.
4023 * @color_change: Initiate a color change.
4025 struct cfg80211_ops {
4026 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
4027 int (*resume)(struct wiphy *wiphy);
4028 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
4030 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
4032 unsigned char name_assign_type,
4033 enum nl80211_iftype type,
4034 struct vif_params *params);
4035 int (*del_virtual_intf)(struct wiphy *wiphy,
4036 struct wireless_dev *wdev);
4037 int (*change_virtual_intf)(struct wiphy *wiphy,
4038 struct net_device *dev,
4039 enum nl80211_iftype type,
4040 struct vif_params *params);
4042 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4043 u8 key_index, bool pairwise, const u8 *mac_addr,
4044 struct key_params *params);
4045 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4046 u8 key_index, bool pairwise, const u8 *mac_addr,
4048 void (*callback)(void *cookie, struct key_params*));
4049 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4050 u8 key_index, bool pairwise, const u8 *mac_addr);
4051 int (*set_default_key)(struct wiphy *wiphy,
4052 struct net_device *netdev,
4053 u8 key_index, bool unicast, bool multicast);
4054 int (*set_default_mgmt_key)(struct wiphy *wiphy,
4055 struct net_device *netdev,
4057 int (*set_default_beacon_key)(struct wiphy *wiphy,
4058 struct net_device *netdev,
4061 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
4062 struct cfg80211_ap_settings *settings);
4063 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
4064 struct cfg80211_beacon_data *info);
4065 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
4068 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
4070 struct station_parameters *params);
4071 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
4072 struct station_del_parameters *params);
4073 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
4075 struct station_parameters *params);
4076 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
4077 const u8 *mac, struct station_info *sinfo);
4078 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
4079 int idx, u8 *mac, struct station_info *sinfo);
4081 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
4082 const u8 *dst, const u8 *next_hop);
4083 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
4085 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
4086 const u8 *dst, const u8 *next_hop);
4087 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
4088 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
4089 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
4090 int idx, u8 *dst, u8 *next_hop,
4091 struct mpath_info *pinfo);
4092 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
4093 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
4094 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
4095 int idx, u8 *dst, u8 *mpp,
4096 struct mpath_info *pinfo);
4097 int (*get_mesh_config)(struct wiphy *wiphy,
4098 struct net_device *dev,
4099 struct mesh_config *conf);
4100 int (*update_mesh_config)(struct wiphy *wiphy,
4101 struct net_device *dev, u32 mask,
4102 const struct mesh_config *nconf);
4103 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
4104 const struct mesh_config *conf,
4105 const struct mesh_setup *setup);
4106 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
4108 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
4109 struct ocb_setup *setup);
4110 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
4112 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
4113 struct bss_parameters *params);
4115 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
4116 struct ieee80211_txq_params *params);
4118 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
4119 struct net_device *dev,
4120 struct ieee80211_channel *chan);
4122 int (*set_monitor_channel)(struct wiphy *wiphy,
4123 struct cfg80211_chan_def *chandef);
4125 int (*scan)(struct wiphy *wiphy,
4126 struct cfg80211_scan_request *request);
4127 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4129 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
4130 struct cfg80211_auth_request *req);
4131 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
4132 struct cfg80211_assoc_request *req);
4133 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
4134 struct cfg80211_deauth_request *req);
4135 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
4136 struct cfg80211_disassoc_request *req);
4138 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
4139 struct cfg80211_connect_params *sme);
4140 int (*update_connect_params)(struct wiphy *wiphy,
4141 struct net_device *dev,
4142 struct cfg80211_connect_params *sme,
4144 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4147 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
4148 struct cfg80211_ibss_params *params);
4149 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4151 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
4152 int rate[NUM_NL80211_BANDS]);
4154 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
4156 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4157 enum nl80211_tx_power_setting type, int mbm);
4158 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4161 void (*rfkill_poll)(struct wiphy *wiphy);
4163 #ifdef CONFIG_NL80211_TESTMODE
4164 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4165 void *data, int len);
4166 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
4167 struct netlink_callback *cb,
4168 void *data, int len);
4171 int (*set_bitrate_mask)(struct wiphy *wiphy,
4172 struct net_device *dev,
4174 const struct cfg80211_bitrate_mask *mask);
4176 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
4177 int idx, struct survey_info *info);
4179 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4180 struct cfg80211_pmksa *pmksa);
4181 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4182 struct cfg80211_pmksa *pmksa);
4183 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
4185 int (*remain_on_channel)(struct wiphy *wiphy,
4186 struct wireless_dev *wdev,
4187 struct ieee80211_channel *chan,
4188 unsigned int duration,
4190 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
4191 struct wireless_dev *wdev,
4194 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4195 struct cfg80211_mgmt_tx_params *params,
4197 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
4198 struct wireless_dev *wdev,
4201 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4202 bool enabled, int timeout);
4204 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
4205 struct net_device *dev,
4206 s32 rssi_thold, u32 rssi_hyst);
4208 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
4209 struct net_device *dev,
4210 s32 rssi_low, s32 rssi_high);
4212 int (*set_cqm_txe_config)(struct wiphy *wiphy,
4213 struct net_device *dev,
4214 u32 rate, u32 pkts, u32 intvl);
4216 void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,
4217 struct wireless_dev *wdev,
4218 struct mgmt_frame_regs *upd);
4220 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4221 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
4223 int (*sched_scan_start)(struct wiphy *wiphy,
4224 struct net_device *dev,
4225 struct cfg80211_sched_scan_request *request);
4226 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
4229 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4230 struct cfg80211_gtk_rekey_data *data);
4232 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4233 const u8 *peer, u8 action_code, u8 dialog_token,
4234 u16 status_code, u32 peer_capability,
4235 bool initiator, const u8 *buf, size_t len);
4236 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
4237 const u8 *peer, enum nl80211_tdls_operation oper);
4239 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
4240 const u8 *peer, u64 *cookie);
4242 int (*set_noack_map)(struct wiphy *wiphy,
4243 struct net_device *dev,
4246 int (*get_channel)(struct wiphy *wiphy,
4247 struct wireless_dev *wdev,
4248 struct cfg80211_chan_def *chandef);
4250 int (*start_p2p_device)(struct wiphy *wiphy,
4251 struct wireless_dev *wdev);
4252 void (*stop_p2p_device)(struct wiphy *wiphy,
4253 struct wireless_dev *wdev);
4255 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
4256 const struct cfg80211_acl_data *params);
4258 int (*start_radar_detection)(struct wiphy *wiphy,
4259 struct net_device *dev,
4260 struct cfg80211_chan_def *chandef,
4262 void (*end_cac)(struct wiphy *wiphy,
4263 struct net_device *dev);
4264 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4265 struct cfg80211_update_ft_ies_params *ftie);
4266 int (*crit_proto_start)(struct wiphy *wiphy,
4267 struct wireless_dev *wdev,
4268 enum nl80211_crit_proto_id protocol,
4270 void (*crit_proto_stop)(struct wiphy *wiphy,
4271 struct wireless_dev *wdev);
4272 int (*set_coalesce)(struct wiphy *wiphy,
4273 struct cfg80211_coalesce *coalesce);
4275 int (*channel_switch)(struct wiphy *wiphy,
4276 struct net_device *dev,
4277 struct cfg80211_csa_settings *params);
4279 int (*set_qos_map)(struct wiphy *wiphy,
4280 struct net_device *dev,
4281 struct cfg80211_qos_map *qos_map);
4283 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4284 struct cfg80211_chan_def *chandef);
4286 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4287 u8 tsid, const u8 *peer, u8 user_prio,
4289 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4290 u8 tsid, const u8 *peer);
4292 int (*tdls_channel_switch)(struct wiphy *wiphy,
4293 struct net_device *dev,
4294 const u8 *addr, u8 oper_class,
4295 struct cfg80211_chan_def *chandef);
4296 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
4297 struct net_device *dev,
4299 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4300 struct cfg80211_nan_conf *conf);
4301 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4302 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4303 struct cfg80211_nan_func *nan_func);
4304 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4306 int (*nan_change_conf)(struct wiphy *wiphy,
4307 struct wireless_dev *wdev,
4308 struct cfg80211_nan_conf *conf,
4311 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
4312 struct net_device *dev,
4313 const bool enabled);
4315 int (*get_txq_stats)(struct wiphy *wiphy,
4316 struct wireless_dev *wdev,
4317 struct cfg80211_txq_stats *txqstats);
4319 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
4320 const struct cfg80211_pmk_conf *conf);
4321 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
4323 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
4324 struct cfg80211_external_auth_params *params);
4326 int (*tx_control_port)(struct wiphy *wiphy,
4327 struct net_device *dev,
4328 const u8 *buf, size_t len,
4329 const u8 *dest, const __be16 proto,
4330 const bool noencrypt,
4333 int (*get_ftm_responder_stats)(struct wiphy *wiphy,
4334 struct net_device *dev,
4335 struct cfg80211_ftm_responder_stats *ftm_stats);
4337 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4338 struct cfg80211_pmsr_request *request);
4339 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4340 struct cfg80211_pmsr_request *request);
4341 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4342 struct cfg80211_update_owe_info *owe_info);
4343 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
4344 const u8 *buf, size_t len);
4345 int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4346 struct cfg80211_tid_config *tid_conf);
4347 int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4348 const u8 *peer, u8 tids);
4349 int (*set_sar_specs)(struct wiphy *wiphy,
4350 struct cfg80211_sar_specs *sar);
4351 int (*color_change)(struct wiphy *wiphy,
4352 struct net_device *dev,
4353 struct cfg80211_color_change_settings *params);
4357 * wireless hardware and networking interfaces structures
4358 * and registration/helper functions
4362 * enum wiphy_flags - wiphy capability flags
4364 * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4365 * into two, first for legacy bands and second for UHB.
4366 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
4368 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
4369 * by default -- this flag will be set depending on the kernel's default
4370 * on wiphy_new(), but can be changed by the driver if it has a good
4371 * reason to override the default
4372 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
4373 * on a VLAN interface). This flag also serves an extra purpose of
4374 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
4375 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4376 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4377 * control port protocol ethertype. The device also honours the
4378 * control_port_no_encrypt flag.
4379 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
4380 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
4381 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4382 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4384 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4385 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4386 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4387 * link setup/discovery operations internally. Setup, discovery and
4388 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4389 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4390 * used for asking the driver/firmware to perform a TDLS operation.
4391 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
4392 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
4393 * when there are virtual interfaces in AP mode by calling
4394 * cfg80211_report_obss_beacon().
4395 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
4396 * responds to probe-requests in hardware.
4397 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
4398 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
4399 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
4400 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
4401 * beaconing mode (AP, IBSS, Mesh, ...).
4402 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4403 * before connection.
4404 * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
4407 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
4409 WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),
4410 WIPHY_FLAG_NETNS_OK = BIT(3),
4411 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
4412 WIPHY_FLAG_4ADDR_AP = BIT(5),
4413 WIPHY_FLAG_4ADDR_STATION = BIT(6),
4414 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
4415 WIPHY_FLAG_IBSS_RSN = BIT(8),
4416 WIPHY_FLAG_MESH_AUTH = BIT(10),
4417 /* use hole at 11 */
4418 /* use hole at 12 */
4419 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
4420 WIPHY_FLAG_AP_UAPSD = BIT(14),
4421 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
4422 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
4423 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
4424 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
4425 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
4426 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
4427 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
4428 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
4429 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
4430 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
4434 * struct ieee80211_iface_limit - limit on certain interface types
4435 * @max: maximum number of interfaces of these types
4436 * @types: interface types (bits)
4438 struct ieee80211_iface_limit {
4444 * struct ieee80211_iface_combination - possible interface combination
4446 * With this structure the driver can describe which interface
4447 * combinations it supports concurrently.
4451 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
4455 * struct ieee80211_iface_limit limits1[] = {
4456 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4457 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
4459 * struct ieee80211_iface_combination combination1 = {
4460 * .limits = limits1,
4461 * .n_limits = ARRAY_SIZE(limits1),
4462 * .max_interfaces = 2,
4463 * .beacon_int_infra_match = true,
4467 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
4471 * struct ieee80211_iface_limit limits2[] = {
4472 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
4473 * BIT(NL80211_IFTYPE_P2P_GO), },
4475 * struct ieee80211_iface_combination combination2 = {
4476 * .limits = limits2,
4477 * .n_limits = ARRAY_SIZE(limits2),
4478 * .max_interfaces = 8,
4479 * .num_different_channels = 1,
4483 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4485 * This allows for an infrastructure connection and three P2P connections.
4489 * struct ieee80211_iface_limit limits3[] = {
4490 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4491 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
4492 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
4494 * struct ieee80211_iface_combination combination3 = {
4495 * .limits = limits3,
4496 * .n_limits = ARRAY_SIZE(limits3),
4497 * .max_interfaces = 4,
4498 * .num_different_channels = 2,
4502 struct ieee80211_iface_combination {
4505 * limits for the given interface types
4507 const struct ieee80211_iface_limit *limits;
4510 * @num_different_channels:
4511 * can use up to this many different channels
4513 u32 num_different_channels;
4517 * maximum number of interfaces in total allowed in this group
4523 * number of limitations
4528 * @beacon_int_infra_match:
4529 * In this combination, the beacon intervals between infrastructure
4530 * and AP types must match. This is required only in special cases.
4532 bool beacon_int_infra_match;
4535 * @radar_detect_widths:
4536 * bitmap of channel widths supported for radar detection
4538 u8 radar_detect_widths;
4541 * @radar_detect_regions:
4542 * bitmap of regions supported for radar detection
4544 u8 radar_detect_regions;
4547 * @beacon_int_min_gcd:
4548 * This interface combination supports different beacon intervals.
4551 * all beacon intervals for different interface must be same.
4553 * any beacon interval for the interface part of this combination AND
4554 * GCD of all beacon intervals from beaconing interfaces of this
4555 * combination must be greater or equal to this value.
4557 u32 beacon_int_min_gcd;
4560 struct ieee80211_txrx_stypes {
4565 * enum wiphy_wowlan_support_flags - WoWLAN support flags
4566 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4567 * trigger that keeps the device operating as-is and
4568 * wakes up the host on any activity, for example a
4569 * received packet that passed filtering; note that the
4570 * packet should be preserved in that case
4571 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4573 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
4574 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
4575 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
4576 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
4577 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
4578 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
4579 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4581 enum wiphy_wowlan_support_flags {
4582 WIPHY_WOWLAN_ANY = BIT(0),
4583 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
4584 WIPHY_WOWLAN_DISCONNECT = BIT(2),
4585 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
4586 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
4587 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
4588 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
4589 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
4590 WIPHY_WOWLAN_NET_DETECT = BIT(8),
4593 struct wiphy_wowlan_tcp_support {
4594 const struct nl80211_wowlan_tcp_data_token_feature *tok;
4595 u32 data_payload_max;
4596 u32 data_interval_max;
4597 u32 wake_payload_max;
4602 * struct wiphy_wowlan_support - WoWLAN support data
4603 * @flags: see &enum wiphy_wowlan_support_flags
4604 * @n_patterns: number of supported wakeup patterns
4605 * (see nl80211.h for the pattern definition)
4606 * @pattern_max_len: maximum length of each pattern
4607 * @pattern_min_len: minimum length of each pattern
4608 * @max_pkt_offset: maximum Rx packet offset
4609 * @max_nd_match_sets: maximum number of matchsets for net-detect,
4610 * similar, but not necessarily identical, to max_match_sets for
4612 * See &struct cfg80211_sched_scan_request.@match_sets for more
4614 * @tcp: TCP wakeup support information
4616 struct wiphy_wowlan_support {
4619 int pattern_max_len;
4620 int pattern_min_len;
4622 int max_nd_match_sets;
4623 const struct wiphy_wowlan_tcp_support *tcp;
4627 * struct wiphy_coalesce_support - coalesce support data
4628 * @n_rules: maximum number of coalesce rules
4629 * @max_delay: maximum supported coalescing delay in msecs
4630 * @n_patterns: number of supported patterns in a rule
4631 * (see nl80211.h for the pattern definition)
4632 * @pattern_max_len: maximum length of each pattern
4633 * @pattern_min_len: minimum length of each pattern
4634 * @max_pkt_offset: maximum Rx packet offset
4636 struct wiphy_coalesce_support {
4640 int pattern_max_len;
4641 int pattern_min_len;
4646 * enum wiphy_vendor_command_flags - validation flags for vendor commands
4647 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4648 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4649 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4650 * (must be combined with %_WDEV or %_NETDEV)
4652 enum wiphy_vendor_command_flags {
4653 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4654 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4655 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4659 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4661 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4662 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4663 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4666 enum wiphy_opmode_flag {
4667 STA_OPMODE_MAX_BW_CHANGED = BIT(0),
4668 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
4669 STA_OPMODE_N_SS_CHANGED = BIT(2),
4673 * struct sta_opmode_info - Station's ht/vht operation mode information
4674 * @changed: contains value from &enum wiphy_opmode_flag
4675 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
4676 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4677 * @rx_nss: new rx_nss value of a station
4680 struct sta_opmode_info {
4682 enum nl80211_smps_mode smps_mode;
4683 enum nl80211_chan_width bw;
4687 #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4690 * struct wiphy_vendor_command - vendor command definition
4691 * @info: vendor command identifying information, as used in nl80211
4692 * @flags: flags, see &enum wiphy_vendor_command_flags
4693 * @doit: callback for the operation, note that wdev is %NULL if the
4694 * flags didn't ask for a wdev and non-%NULL otherwise; the data
4695 * pointer may be %NULL if userspace provided no data at all
4696 * @dumpit: dump callback, for transferring bigger/multiple items. The
4697 * @storage points to cb->args[5], ie. is preserved over the multiple
4699 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4700 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4701 * attribute is just raw data (e.g. a firmware command).
4702 * @maxattr: highest attribute number in policy
4703 * It's recommended to not have the same sub command with both @doit and
4704 * @dumpit, so that userspace can assume certain ones are get and others
4705 * are used with dump requests.
4707 struct wiphy_vendor_command {
4708 struct nl80211_vendor_cmd_info info;
4710 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4711 const void *data, int data_len);
4712 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4713 struct sk_buff *skb, const void *data, int data_len,
4714 unsigned long *storage);
4715 const struct nla_policy *policy;
4716 unsigned int maxattr;
4720 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4721 * @iftype: interface type
4722 * @extended_capabilities: extended capabilities supported by the driver,
4723 * additional capabilities might be supported by userspace; these are the
4724 * 802.11 extended capabilities ("Extended Capabilities element") and are
4725 * in the same format as in the information element. See IEEE Std
4726 * 802.11-2012 8.4.2.29 for the defined fields.
4727 * @extended_capabilities_mask: mask of the valid values
4728 * @extended_capabilities_len: length of the extended capabilities
4730 struct wiphy_iftype_ext_capab {
4731 enum nl80211_iftype iftype;
4732 const u8 *extended_capabilities;
4733 const u8 *extended_capabilities_mask;
4734 u8 extended_capabilities_len;
4738 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4739 * @max_peers: maximum number of peers in a single measurement
4740 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4741 * @randomize_mac_addr: can randomize MAC address for measurement
4742 * @ftm.supported: FTM measurement is supported
4743 * @ftm.asap: ASAP-mode is supported
4744 * @ftm.non_asap: non-ASAP-mode is supported
4745 * @ftm.request_lci: can request LCI data
4746 * @ftm.request_civicloc: can request civic location data
4747 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4748 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4749 * @ftm.max_bursts_exponent: maximum burst exponent supported
4750 * (set to -1 if not limited; note that setting this will necessarily
4751 * forbid using the value 15 to let the responder pick)
4752 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4754 * @ftm.trigger_based: trigger based ranging measurement is supported
4755 * @ftm.non_trigger_based: non trigger based ranging measurement is supported
4757 struct cfg80211_pmsr_capabilities {
4758 unsigned int max_peers;
4760 randomize_mac_addr:1;
4765 s8 max_bursts_exponent;
4766 u8 max_ftms_per_burst;
4773 non_trigger_based:1;
4778 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4779 * suites for interface types defined in @iftypes_mask. Each type in the
4780 * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4782 * @iftypes_mask: bitmask of interfaces types
4783 * @akm_suites: points to an array of supported akm suites
4784 * @n_akm_suites: number of supported AKM suites
4786 struct wiphy_iftype_akm_suites {
4788 const u32 *akm_suites;
4793 * struct wiphy - wireless hardware description
4794 * @mtx: mutex for the data (structures) of this device
4795 * @reg_notifier: the driver's regulatory notification callback,
4796 * note that if your driver uses wiphy_apply_custom_regulatory()
4797 * the reg_notifier's request can be passed as NULL
4798 * @regd: the driver's regulatory domain, if one was requested via
4799 * the regulatory_hint() API. This can be used by the driver
4800 * on the reg_notifier() if it chooses to ignore future
4801 * regulatory domain changes caused by other drivers.
4802 * @signal_type: signal type reported in &struct cfg80211_bss.
4803 * @cipher_suites: supported cipher suites
4804 * @n_cipher_suites: number of supported cipher suites
4805 * @akm_suites: supported AKM suites. These are the default AKMs supported if
4806 * the supported AKMs not advertized for a specific interface type in
4807 * iftype_akm_suites.
4808 * @n_akm_suites: number of supported AKM suites
4809 * @iftype_akm_suites: array of supported akm suites info per interface type.
4810 * Note that the bits in @iftypes_mask inside this structure cannot
4811 * overlap (i.e. only one occurrence of each type is allowed across all
4812 * instances of iftype_akm_suites).
4813 * @num_iftype_akm_suites: number of interface types for which supported akm
4814 * suites are specified separately.
4815 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4816 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4817 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4818 * -1 = fragmentation disabled, only odd values >= 256 used
4819 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4820 * @_net: the network namespace this wiphy currently lives in
4821 * @perm_addr: permanent MAC address of this device
4822 * @addr_mask: If the device supports multiple MAC addresses by masking,
4823 * set this to a mask with variable bits set to 1, e.g. if the last
4824 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
4825 * variable bits shall be determined by the interfaces added, with
4826 * interfaces not matching the mask being rejected to be brought up.
4827 * @n_addresses: number of addresses in @addresses.
4828 * @addresses: If the device has more than one address, set this pointer
4829 * to a list of addresses (6 bytes each). The first one will be used
4830 * by default for perm_addr. In this case, the mask should be set to
4831 * all-zeroes. In this case it is assumed that the device can handle
4832 * the same number of arbitrary MAC addresses.
4833 * @registered: protects ->resume and ->suspend sysfs callbacks against
4834 * unregister hardware
4835 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4836 * It will be renamed automatically on wiphy renames
4837 * @dev: (virtual) struct device for this wiphy. The item in
4838 * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
4840 * @wext: wireless extension handlers
4841 * @priv: driver private data (sized according to wiphy_new() parameter)
4842 * @interface_modes: bitmask of interfaces types valid for this wiphy,
4843 * must be set by driver
4844 * @iface_combinations: Valid interface combinations array, should not
4845 * list single interface types.
4846 * @n_iface_combinations: number of entries in @iface_combinations array.
4847 * @software_iftypes: bitmask of software interface types, these are not
4848 * subject to any restrictions since they are purely managed in SW.
4849 * @flags: wiphy flags, see &enum wiphy_flags
4850 * @regulatory_flags: wiphy regulatory flags, see
4851 * &enum ieee80211_regulatory_flags
4852 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4853 * @ext_features: extended features advertised to nl80211, see
4854 * &enum nl80211_ext_feature_index.
4855 * @bss_priv_size: each BSS struct has private data allocated with it,
4856 * this variable determines its size
4857 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4859 * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4860 * the device can run concurrently.
4861 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
4862 * for in any given scheduled scan
4863 * @max_match_sets: maximum number of match sets the device can handle
4864 * when performing a scheduled scan, 0 if filtering is not
4866 * @max_scan_ie_len: maximum length of user-controlled IEs device can
4867 * add to probe request frames transmitted during a scan, must not
4868 * include fixed IEs like supported rates
4869 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
4871 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
4872 * of iterations) for scheduled scan supported by the device.
4873 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
4874 * single scan plan supported by the device.
4875 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
4876 * scan plan supported by the device.
4877 * @coverage_class: current coverage class
4878 * @fw_version: firmware version for ethtool reporting
4879 * @hw_version: hardware version for ethtool reporting
4880 * @max_num_pmkids: maximum number of PMKIDs supported by device
4881 * @privid: a pointer that drivers can use to identify if an arbitrary
4882 * wiphy is theirs, e.g. in global notifiers
4883 * @bands: information about bands/channels supported by this device
4885 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
4886 * transmitted through nl80211, points to an array indexed by interface
4889 * @available_antennas_tx: bitmap of antennas which are available to be
4890 * configured as TX antennas. Antenna configuration commands will be
4891 * rejected unless this or @available_antennas_rx is set.
4893 * @available_antennas_rx: bitmap of antennas which are available to be
4894 * configured as RX antennas. Antenna configuration commands will be
4895 * rejected unless this or @available_antennas_tx is set.
4897 * @probe_resp_offload:
4898 * Bitmap of supported protocols for probe response offloading.
4899 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
4900 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4902 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4903 * may request, if implemented.
4905 * @wowlan: WoWLAN support information
4906 * @wowlan_config: current WoWLAN configuration; this should usually not be
4907 * used since access to it is necessarily racy, use the parameter passed
4908 * to the suspend() operation instead.
4910 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
4911 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
4912 * If null, then none can be over-ridden.
4913 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
4914 * If null, then none can be over-ridden.
4916 * @wdev_list: the list of associated (virtual) interfaces; this list must
4917 * not be modified by the driver, but can be read with RTNL/RCU protection.
4919 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
4922 * @extended_capabilities: extended capabilities supported by the driver,
4923 * additional capabilities might be supported by userspace; these are
4924 * the 802.11 extended capabilities ("Extended Capabilities element")
4925 * and are in the same format as in the information element. See
4926 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
4927 * extended capabilities to be used if the capabilities are not specified
4928 * for a specific interface type in iftype_ext_capab.
4929 * @extended_capabilities_mask: mask of the valid values
4930 * @extended_capabilities_len: length of the extended capabilities
4931 * @iftype_ext_capab: array of extended capabilities per interface type
4932 * @num_iftype_ext_capab: number of interface types for which extended
4933 * capabilities are specified separately.
4934 * @coalesce: packet coalescing support information
4936 * @vendor_commands: array of vendor commands supported by the hardware
4937 * @n_vendor_commands: number of vendor commands
4938 * @vendor_events: array of vendor events supported by the hardware
4939 * @n_vendor_events: number of vendor events
4941 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4942 * (including P2P GO) or 0 to indicate no such limit is advertised. The
4943 * driver is allowed to advertise a theoretical limit that it can reach in
4944 * some cases, but may not always reach.
4946 * @max_num_csa_counters: Number of supported csa_counters in beacons
4947 * and probe responses. This value should be set if the driver
4948 * wishes to limit the number of csa counters. Default (0) means
4950 * @bss_select_support: bitmask indicating the BSS selection criteria supported
4951 * by the driver in the .connect() callback. The bit position maps to the
4952 * attribute indices defined in &enum nl80211_bss_select_attr.
4954 * @nan_supported_bands: bands supported by the device in NAN mode, a
4955 * bitmap of &enum nl80211_band values. For instance, for
4956 * NL80211_BAND_2GHZ, bit 0 would be set
4957 * (i.e. BIT(NL80211_BAND_2GHZ)).
4959 * @txq_limit: configuration of internal TX queue frame limit
4960 * @txq_memory_limit: configuration internal TX queue memory limit
4961 * @txq_quantum: configuration of internal TX queue scheduler quantum
4963 * @tx_queue_len: allow setting transmit queue len for drivers not using
4966 * @support_mbssid: can HW support association with nontransmitted AP
4967 * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4968 * HE AP, in order to avoid compatibility issues.
4969 * @support_mbssid must be set for this to have any effect.
4971 * @pmsr_capa: peer measurement capabilities
4973 * @tid_config_support: describes the per-TID config support that the
4975 * @tid_config_support.vif: bitmap of attributes (configurations)
4976 * supported by the driver for each vif
4977 * @tid_config_support.peer: bitmap of attributes (configurations)
4978 * supported by the driver for each peer
4979 * @tid_config_support.max_retry: maximum supported retry count for
4980 * long/short retry configuration
4982 * @max_data_retry_count: maximum supported per TID retry count for
4983 * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
4984 * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
4985 * @sar_capa: SAR control capabilities
4986 * @rfkill: a pointer to the rfkill structure
4991 /* assign these fields before you register the wiphy */
4993 u8 perm_addr[ETH_ALEN];
4994 u8 addr_mask[ETH_ALEN];
4996 struct mac_address *addresses;
4998 const struct ieee80211_txrx_stypes *mgmt_stypes;
5000 const struct ieee80211_iface_combination *iface_combinations;
5001 int n_iface_combinations;
5002 u16 software_iftypes;
5006 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
5007 u16 interface_modes;
5009 u16 max_acl_mac_addrs;
5011 u32 flags, regulatory_flags, features;
5012 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
5016 enum cfg80211_signal_type signal_type;
5020 u8 max_sched_scan_reqs;
5021 u8 max_sched_scan_ssids;
5023 u16 max_scan_ie_len;
5024 u16 max_sched_scan_ie_len;
5025 u32 max_sched_scan_plans;
5026 u32 max_sched_scan_plan_interval;
5027 u32 max_sched_scan_plan_iterations;
5029 int n_cipher_suites;
5030 const u32 *cipher_suites;
5033 const u32 *akm_suites;
5035 const struct wiphy_iftype_akm_suites *iftype_akm_suites;
5036 unsigned int num_iftype_akm_suites;
5044 char fw_version[ETHTOOL_FWVERS_LEN];
5048 const struct wiphy_wowlan_support *wowlan;
5049 struct cfg80211_wowlan *wowlan_config;
5052 u16 max_remain_on_channel_duration;
5056 u32 available_antennas_tx;
5057 u32 available_antennas_rx;
5059 u32 probe_resp_offload;
5061 const u8 *extended_capabilities, *extended_capabilities_mask;
5062 u8 extended_capabilities_len;
5064 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5065 unsigned int num_iftype_ext_capab;
5069 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5071 void (*reg_notifier)(struct wiphy *wiphy,
5072 struct regulatory_request *request);
5074 /* fields below are read-only, assigned by cfg80211 */
5076 const struct ieee80211_regdomain __rcu *regd;
5082 struct dentry *debugfsdir;
5084 const struct ieee80211_ht_cap *ht_capa_mod_mask;
5085 const struct ieee80211_vht_cap *vht_capa_mod_mask;
5087 struct list_head wdev_list;
5089 possible_net_t _net;
5091 #ifdef CONFIG_CFG80211_WEXT
5092 const struct iw_handler_def *wext;
5095 const struct wiphy_coalesce_support *coalesce;
5097 const struct wiphy_vendor_command *vendor_commands;
5098 const struct nl80211_vendor_cmd_info *vendor_events;
5099 int n_vendor_commands, n_vendor_events;
5101 u16 max_ap_assoc_sta;
5103 u8 max_num_csa_counters;
5105 u32 bss_select_support;
5107 u8 nan_supported_bands;
5110 u32 txq_memory_limit;
5113 unsigned long tx_queue_len;
5115 u8 support_mbssid:1,
5116 support_only_he_mbssid:1;
5118 const struct cfg80211_pmsr_capabilities *pmsr_capa;
5123 } tid_config_support;
5125 u8 max_data_retry_count;
5127 const struct cfg80211_sar_capa *sar_capa;
5129 struct rfkill *rfkill;
5131 char priv[] __aligned(NETDEV_ALIGN);
5134 static inline struct net *wiphy_net(struct wiphy *wiphy)
5136 return read_pnet(&wiphy->_net);
5139 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5141 write_pnet(&wiphy->_net, net);
5145 * wiphy_priv - return priv from wiphy
5147 * @wiphy: the wiphy whose priv pointer to return
5148 * Return: The priv of @wiphy.
5150 static inline void *wiphy_priv(struct wiphy *wiphy)
5153 return &wiphy->priv;
5157 * priv_to_wiphy - return the wiphy containing the priv
5159 * @priv: a pointer previously returned by wiphy_priv
5160 * Return: The wiphy of @priv.
5162 static inline struct wiphy *priv_to_wiphy(void *priv)
5165 return container_of(priv, struct wiphy, priv);
5169 * set_wiphy_dev - set device pointer for wiphy
5171 * @wiphy: The wiphy whose device to bind
5172 * @dev: The device to parent it to
5174 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5176 wiphy->dev.parent = dev;
5180 * wiphy_dev - get wiphy dev pointer
5182 * @wiphy: The wiphy whose device struct to look up
5183 * Return: The dev of @wiphy.
5185 static inline struct device *wiphy_dev(struct wiphy *wiphy)
5187 return wiphy->dev.parent;
5191 * wiphy_name - get wiphy name
5193 * @wiphy: The wiphy whose name to return
5194 * Return: The name of @wiphy.
5196 static inline const char *wiphy_name(const struct wiphy *wiphy)
5198 return dev_name(&wiphy->dev);
5202 * wiphy_new_nm - create a new wiphy for use with cfg80211
5204 * @ops: The configuration operations for this device
5205 * @sizeof_priv: The size of the private area to allocate
5206 * @requested_name: Request a particular name.
5207 * NULL is valid value, and means use the default phy%d naming.
5209 * Create a new wiphy and associate the given operations with it.
5210 * @sizeof_priv bytes are allocated for private use.
5212 * Return: A pointer to the new wiphy. This pointer must be
5213 * assigned to each netdev's ieee80211_ptr for proper operation.
5215 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
5216 const char *requested_name);
5219 * wiphy_new - create a new wiphy for use with cfg80211
5221 * @ops: The configuration operations for this device
5222 * @sizeof_priv: The size of the private area to allocate
5224 * Create a new wiphy and associate the given operations with it.
5225 * @sizeof_priv bytes are allocated for private use.
5227 * Return: A pointer to the new wiphy. This pointer must be
5228 * assigned to each netdev's ieee80211_ptr for proper operation.
5230 static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
5233 return wiphy_new_nm(ops, sizeof_priv, NULL);
5237 * wiphy_register - register a wiphy with cfg80211
5239 * @wiphy: The wiphy to register.
5241 * Return: A non-negative wiphy index or a negative error code.
5243 int wiphy_register(struct wiphy *wiphy);
5245 /* this is a define for better error reporting (file/line) */
5246 #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5249 * rcu_dereference_wiphy - rcu_dereference with debug checking
5250 * @wiphy: the wiphy to check the locking on
5251 * @p: The pointer to read, prior to dereferencing
5253 * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5254 * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5256 #define rcu_dereference_wiphy(wiphy, p) \
5257 rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5260 * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5261 * @wiphy: the wiphy to check the locking on
5262 * @p: The pointer to read, prior to dereferencing
5264 * Return the value of the specified RCU-protected pointer, but omit the
5265 * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5267 #define wiphy_dereference(wiphy, p) \
5268 rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5271 * get_wiphy_regdom - get custom regdomain for the given wiphy
5272 * @wiphy: the wiphy to get the regdomain from
5274 const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5277 * wiphy_unregister - deregister a wiphy from cfg80211
5279 * @wiphy: The wiphy to unregister.
5281 * After this call, no more requests can be made with this priv
5282 * pointer, but the call may sleep to wait for an outstanding
5283 * request that is being handled.
5285 void wiphy_unregister(struct wiphy *wiphy);
5288 * wiphy_free - free wiphy
5290 * @wiphy: The wiphy to free
5292 void wiphy_free(struct wiphy *wiphy);
5294 /* internal structs */
5295 struct cfg80211_conn;
5296 struct cfg80211_internal_bss;
5297 struct cfg80211_cached_keys;
5298 struct cfg80211_cqm_config;
5301 * wiphy_lock - lock the wiphy
5302 * @wiphy: the wiphy to lock
5304 * This is mostly exposed so it can be done around registering and
5305 * unregistering netdevs that aren't created through cfg80211 calls,
5306 * since that requires locking in cfg80211 when the notifiers is
5307 * called, but that cannot differentiate which way it's called.
5309 * When cfg80211 ops are called, the wiphy is already locked.
5311 static inline void wiphy_lock(struct wiphy *wiphy)
5312 __acquires(&wiphy->mtx)
5314 mutex_lock(&wiphy->mtx);
5315 __acquire(&wiphy->mtx);
5319 * wiphy_unlock - unlock the wiphy again
5320 * @wiphy: the wiphy to unlock
5322 static inline void wiphy_unlock(struct wiphy *wiphy)
5323 __releases(&wiphy->mtx)
5325 __release(&wiphy->mtx);
5326 mutex_unlock(&wiphy->mtx);
5330 * struct wireless_dev - wireless device state
5332 * For netdevs, this structure must be allocated by the driver
5333 * that uses the ieee80211_ptr field in struct net_device (this
5334 * is intentional so it can be allocated along with the netdev.)
5335 * It need not be registered then as netdev registration will
5336 * be intercepted by cfg80211 to see the new wireless device,
5337 * however, drivers must lock the wiphy before registering or
5338 * unregistering netdevs if they pre-create any netdevs (in ops
5339 * called from cfg80211, the wiphy is already locked.)
5341 * For non-netdev uses, it must also be allocated by the driver
5342 * in response to the cfg80211 callbacks that require it, as
5343 * there's no netdev registration in that case it may not be
5344 * allocated outside of callback operations that return it.
5346 * @wiphy: pointer to hardware description
5347 * @iftype: interface type
5348 * @registered: is this wdev already registered with cfg80211
5349 * @registering: indicates we're doing registration under wiphy lock
5351 * @list: (private) Used to collect the interfaces
5352 * @netdev: (private) Used to reference back to the netdev, may be %NULL
5353 * @identifier: (private) Identifier used in nl80211 to identify this
5354 * wireless device if it has no netdev
5355 * @current_bss: (private) Used by the internal configuration code
5356 * @chandef: (private) Used by the internal configuration code to track
5357 * the user-set channel definition.
5358 * @preset_chandef: (private) Used by the internal configuration code to
5359 * track the channel to be used for AP later
5360 * @bssid: (private) Used by the internal configuration code
5361 * @ssid: (private) Used by the internal configuration code
5362 * @ssid_len: (private) Used by the internal configuration code
5363 * @mesh_id_len: (private) Used by the internal configuration code
5364 * @mesh_id_up_len: (private) Used by the internal configuration code
5365 * @wext: (private) Used by the internal wireless extensions compat code
5366 * @wext.ibss: (private) IBSS data part of wext handling
5367 * @wext.connect: (private) connection handling data
5368 * @wext.keys: (private) (WEP) key data
5369 * @wext.ie: (private) extra elements for association
5370 * @wext.ie_len: (private) length of extra elements
5371 * @wext.bssid: (private) selected network BSSID
5372 * @wext.ssid: (private) selected network SSID
5373 * @wext.default_key: (private) selected default key index
5374 * @wext.default_mgmt_key: (private) selected default management key index
5375 * @wext.prev_bssid: (private) previous BSSID for reassociation
5376 * @wext.prev_bssid_valid: (private) previous BSSID validity
5377 * @use_4addr: indicates 4addr mode is used on this interface, must be
5378 * set by driver (if supported) on add_interface BEFORE registering the
5379 * netdev and may otherwise be used by driver read-only, will be update
5380 * by cfg80211 on change_interface
5381 * @mgmt_registrations: list of registrations for management frames
5382 * @mgmt_registrations_need_update: mgmt registrations were updated,
5383 * need to propagate the update to the driver
5384 * @mtx: mutex used to lock data in this struct, may be used by drivers
5385 * and some API functions require it held
5386 * @beacon_interval: beacon interval used on this device for transmitting
5387 * beacons, 0 when not valid
5388 * @address: The address for this device, valid only if @netdev is %NULL
5389 * @is_running: true if this is a non-netdev device that has been started, e.g.
5391 * @cac_started: true if DFS channel availability check has been started
5392 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
5393 * @cac_time_ms: CAC time in ms
5394 * @ps: powersave mode is enabled
5395 * @ps_timeout: dynamic powersave timeout
5396 * @ap_unexpected_nlportid: (private) netlink port ID of application
5397 * registered for unexpected class 3 frames (AP mode)
5398 * @conn: (private) cfg80211 software SME connection state machine data
5399 * @connect_keys: (private) keys to set after connection is established
5400 * @conn_bss_type: connecting/connected BSS type
5401 * @conn_owner_nlportid: (private) connection owner socket port ID
5402 * @disconnect_wk: (private) auto-disconnect work
5403 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5404 * @ibss_fixed: (private) IBSS is using fixed BSSID
5405 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
5406 * @event_list: (private) list for internal event processing
5407 * @event_lock: (private) lock for event list
5408 * @owner_nlportid: (private) owner socket port ID
5409 * @nl_owner_dead: (private) owner socket went away
5410 * @cqm_config: (private) nl80211 RSSI monitor state
5411 * @pmsr_list: (private) peer measurement requests
5412 * @pmsr_lock: (private) peer measurements requests/results lock
5413 * @pmsr_free_wk: (private) peer measurements cleanup work
5414 * @unprot_beacon_reported: (private) timestamp of last
5415 * unprotected beacon report
5417 struct wireless_dev {
5418 struct wiphy *wiphy;
5419 enum nl80211_iftype iftype;
5421 /* the remainder of this struct should be private to cfg80211 */
5422 struct list_head list;
5423 struct net_device *netdev;
5427 struct list_head mgmt_registrations;
5428 u8 mgmt_registrations_need_update:1;
5432 bool use_4addr, is_running, registered, registering;
5434 u8 address[ETH_ALEN] __aligned(sizeof(u16));
5436 /* currently used for IBSS and SME - might be rearranged later */
5437 u8 ssid[IEEE80211_MAX_SSID_LEN];
5438 u8 ssid_len, mesh_id_len, mesh_id_up_len;
5439 struct cfg80211_conn *conn;
5440 struct cfg80211_cached_keys *connect_keys;
5441 enum ieee80211_bss_type conn_bss_type;
5442 u32 conn_owner_nlportid;
5444 struct work_struct disconnect_wk;
5445 u8 disconnect_bssid[ETH_ALEN];
5447 struct list_head event_list;
5448 spinlock_t event_lock;
5450 struct cfg80211_internal_bss *current_bss; /* associated / joined */
5451 struct cfg80211_chan_def preset_chandef;
5452 struct cfg80211_chan_def chandef;
5455 bool ibss_dfs_possible;
5460 int beacon_interval;
5462 u32 ap_unexpected_nlportid;
5468 unsigned long cac_start_time;
5469 unsigned int cac_time_ms;
5471 #ifdef CONFIG_CFG80211_WEXT
5474 struct cfg80211_ibss_params ibss;
5475 struct cfg80211_connect_params connect;
5476 struct cfg80211_cached_keys *keys;
5480 u8 prev_bssid[ETH_ALEN];
5481 u8 ssid[IEEE80211_MAX_SSID_LEN];
5482 s8 default_key, default_mgmt_key;
5483 bool prev_bssid_valid;
5487 struct cfg80211_cqm_config *cqm_config;
5489 struct list_head pmsr_list;
5490 spinlock_t pmsr_lock;
5491 struct work_struct pmsr_free_wk;
5493 unsigned long unprot_beacon_reported;
5496 static inline u8 *wdev_address(struct wireless_dev *wdev)
5499 return wdev->netdev->dev_addr;
5500 return wdev->address;
5503 static inline bool wdev_running(struct wireless_dev *wdev)
5506 return netif_running(wdev->netdev);
5507 return wdev->is_running;
5511 * wdev_priv - return wiphy priv from wireless_dev
5513 * @wdev: The wireless device whose wiphy's priv pointer to return
5514 * Return: The wiphy priv of @wdev.
5516 static inline void *wdev_priv(struct wireless_dev *wdev)
5519 return wiphy_priv(wdev->wiphy);
5523 * DOC: Utility functions
5525 * cfg80211 offers a number of utility functions that can be useful.
5529 * ieee80211_channel_equal - compare two struct ieee80211_channel
5531 * @a: 1st struct ieee80211_channel
5532 * @b: 2nd struct ieee80211_channel
5533 * Return: true if center frequency of @a == @b
5536 ieee80211_channel_equal(struct ieee80211_channel *a,
5537 struct ieee80211_channel *b)
5539 return (a->center_freq == b->center_freq &&
5540 a->freq_offset == b->freq_offset);
5544 * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5545 * @chan: struct ieee80211_channel to convert
5546 * Return: The corresponding frequency (in KHz)
5549 ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5551 return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5555 * ieee80211_s1g_channel_width - get allowed channel width from @chan
5557 * Only allowed for band NL80211_BAND_S1GHZ
5559 * Return: The allowed channel width for this center_freq
5561 enum nl80211_chan_width
5562 ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
5565 * ieee80211_channel_to_freq_khz - convert channel number to frequency
5566 * @chan: channel number
5567 * @band: band, necessary due to channel number overlap
5568 * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5570 u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5573 * ieee80211_channel_to_frequency - convert channel number to frequency
5574 * @chan: channel number
5575 * @band: band, necessary due to channel number overlap
5576 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5579 ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5581 return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5585 * ieee80211_freq_khz_to_channel - convert frequency to channel number
5586 * @freq: center frequency in KHz
5587 * Return: The corresponding channel, or 0 if the conversion failed.
5589 int ieee80211_freq_khz_to_channel(u32 freq);
5592 * ieee80211_frequency_to_channel - convert frequency to channel number
5593 * @freq: center frequency in MHz
5594 * Return: The corresponding channel, or 0 if the conversion failed.
5597 ieee80211_frequency_to_channel(int freq)
5599 return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5603 * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5605 * @wiphy: the struct wiphy to get the channel for
5606 * @freq: the center frequency (in KHz) of the channel
5607 * Return: The channel struct from @wiphy at @freq.
5609 struct ieee80211_channel *
5610 ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5613 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5615 * @wiphy: the struct wiphy to get the channel for
5616 * @freq: the center frequency (in MHz) of the channel
5617 * Return: The channel struct from @wiphy at @freq.
5619 static inline struct ieee80211_channel *
5620 ieee80211_get_channel(struct wiphy *wiphy, int freq)
5622 return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5626 * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5627 * @chan: control channel to check
5629 * The Preferred Scanning Channels (PSC) are defined in
5630 * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5632 static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5634 if (chan->band != NL80211_BAND_6GHZ)
5637 return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5641 * ieee80211_get_response_rate - get basic rate for a given rate
5643 * @sband: the band to look for rates in
5644 * @basic_rates: bitmap of basic rates
5645 * @bitrate: the bitrate for which to find the basic rate
5647 * Return: The basic rate corresponding to a given bitrate, that
5648 * is the next lower bitrate contained in the basic rate map,
5649 * which is, for this function, given as a bitmap of indices of
5650 * rates in the band's bitrate table.
5652 const struct ieee80211_rate *
5653 ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5654 u32 basic_rates, int bitrate);
5657 * ieee80211_mandatory_rates - get mandatory rates for a given band
5658 * @sband: the band to look for rates in
5659 * @scan_width: width of the control channel
5661 * This function returns a bitmap of the mandatory rates for the given
5662 * band, bits are set according to the rate position in the bitrates array.
5664 u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
5665 enum nl80211_bss_scan_width scan_width);
5668 * Radiotap parsing functions -- for controlled injection support
5670 * Implemented in net/wireless/radiotap.c
5671 * Documentation in Documentation/networking/radiotap-headers.rst
5674 struct radiotap_align_size {
5675 uint8_t align:4, size:4;
5678 struct ieee80211_radiotap_namespace {
5679 const struct radiotap_align_size *align_size;
5685 struct ieee80211_radiotap_vendor_namespaces {
5686 const struct ieee80211_radiotap_namespace *ns;
5691 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
5692 * @this_arg_index: index of current arg, valid after each successful call
5693 * to ieee80211_radiotap_iterator_next()
5694 * @this_arg: pointer to current radiotap arg; it is valid after each
5695 * call to ieee80211_radiotap_iterator_next() but also after
5696 * ieee80211_radiotap_iterator_init() where it will point to
5697 * the beginning of the actual data portion
5698 * @this_arg_size: length of the current arg, for convenience
5699 * @current_namespace: pointer to the current namespace definition
5700 * (or internally %NULL if the current namespace is unknown)
5701 * @is_radiotap_ns: indicates whether the current namespace is the default
5702 * radiotap namespace or not
5704 * @_rtheader: pointer to the radiotap header we are walking through
5705 * @_max_length: length of radiotap header in cpu byte ordering
5706 * @_arg_index: next argument index
5707 * @_arg: next argument pointer
5708 * @_next_bitmap: internal pointer to next present u32
5709 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
5710 * @_vns: vendor namespace definitions
5711 * @_next_ns_data: beginning of the next namespace's data
5712 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
5715 * Describes the radiotap parser state. Fields prefixed with an underscore
5716 * must not be used by users of the parser, only by the parser internally.
5719 struct ieee80211_radiotap_iterator {
5720 struct ieee80211_radiotap_header *_rtheader;
5721 const struct ieee80211_radiotap_vendor_namespaces *_vns;
5722 const struct ieee80211_radiotap_namespace *current_namespace;
5724 unsigned char *_arg, *_next_ns_data;
5725 __le32 *_next_bitmap;
5727 unsigned char *this_arg;
5735 uint32_t _bitmap_shifter;
5740 ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5741 struct ieee80211_radiotap_header *radiotap_header,
5743 const struct ieee80211_radiotap_vendor_namespaces *vns);
5746 ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5749 extern const unsigned char rfc1042_header[6];
5750 extern const unsigned char bridge_tunnel_header[6];
5753 * ieee80211_get_hdrlen_from_skb - get header length from data
5757 * Given an skb with a raw 802.11 header at the data pointer this function
5758 * returns the 802.11 header length.
5760 * Return: The 802.11 header length in bytes (not including encryption
5761 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
5764 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5767 * ieee80211_hdrlen - get header length in bytes from frame control
5768 * @fc: frame control field in little-endian format
5769 * Return: The header length in bytes.
5771 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5774 * ieee80211_get_mesh_hdrlen - get mesh extension header length
5775 * @meshhdr: the mesh extension header, only the flags field
5776 * (first byte) will be accessed
5777 * Return: The length of the extension header, which is always at
5778 * least 6 bytes and at most 18 if address 5 and 6 are present.
5780 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
5783 * DOC: Data path helpers
5785 * In addition to generic utilities, cfg80211 also offers
5786 * functions that help implement the data path for devices
5787 * that do not do the 802.11/802.3 conversion on the device.
5791 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
5792 * @skb: the 802.11 data frame
5793 * @ehdr: pointer to a &struct ethhdr that will get the header, instead
5794 * of it being pushed into the SKB
5795 * @addr: the device MAC address
5796 * @iftype: the virtual interface type
5797 * @data_offset: offset of payload after the 802.11 header
5798 * Return: 0 on success. Non-zero on error.
5800 int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
5801 const u8 *addr, enum nl80211_iftype iftype,
5802 u8 data_offset, bool is_amsdu);
5805 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5806 * @skb: the 802.11 data frame
5807 * @addr: the device MAC address
5808 * @iftype: the virtual interface type
5809 * Return: 0 on success. Non-zero on error.
5811 static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
5812 enum nl80211_iftype iftype)
5814 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
5818 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5820 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
5821 * The @list will be empty if the decode fails. The @skb must be fully
5822 * header-less before being passed in here; it is freed in this function.
5824 * @skb: The input A-MSDU frame without any headers.
5825 * @list: The output list of 802.3 frames. It must be allocated and
5826 * initialized by the caller.
5827 * @addr: The device MAC address.
5828 * @iftype: The device interface type.
5829 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
5830 * @check_da: DA to check in the inner ethernet header, or NULL
5831 * @check_sa: SA to check in the inner ethernet header, or NULL
5833 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5834 const u8 *addr, enum nl80211_iftype iftype,
5835 const unsigned int extra_headroom,
5836 const u8 *check_da, const u8 *check_sa);
5839 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5840 * @skb: the data frame
5841 * @qos_map: Interworking QoS mapping or %NULL if not in use
5842 * Return: The 802.1p/1d tag.
5844 unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5845 struct cfg80211_qos_map *qos_map);
5848 * cfg80211_find_elem_match - match information element and byte array in data
5851 * @ies: data consisting of IEs
5852 * @len: length of data
5853 * @match: byte array to match
5854 * @match_len: number of bytes in the match array
5855 * @match_offset: offset in the IE data where the byte array should match.
5856 * Note the difference to cfg80211_find_ie_match() which considers
5857 * the offset to start from the element ID byte, but here we take
5858 * the data portion instead.
5860 * Return: %NULL if the element ID could not be found or if
5861 * the element is invalid (claims to be longer than the given
5862 * data) or if the byte array doesn't match; otherwise return the
5863 * requested element struct.
5865 * Note: There are no checks on the element length other than
5866 * having to fit into the given data and being large enough for the
5867 * byte array to match.
5869 const struct element *
5870 cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
5871 const u8 *match, unsigned int match_len,
5872 unsigned int match_offset);
5875 * cfg80211_find_ie_match - match information element and byte array in data
5878 * @ies: data consisting of IEs
5879 * @len: length of data
5880 * @match: byte array to match
5881 * @match_len: number of bytes in the match array
5882 * @match_offset: offset in the IE where the byte array should match.
5883 * If match_len is zero, this must also be set to zero.
5884 * Otherwise this must be set to 2 or more, because the first
5885 * byte is the element id, which is already compared to eid, and
5886 * the second byte is the IE length.
5888 * Return: %NULL if the element ID could not be found or if
5889 * the element is invalid (claims to be longer than the given
5890 * data) or if the byte array doesn't match, or a pointer to the first
5891 * byte of the requested element, that is the byte containing the
5894 * Note: There are no checks on the element length other than
5895 * having to fit into the given data and being large enough for the
5896 * byte array to match.
5898 static inline const u8 *
5899 cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
5900 const u8 *match, unsigned int match_len,
5901 unsigned int match_offset)
5903 /* match_offset can't be smaller than 2, unless match_len is
5904 * zero, in which case match_offset must be zero as well.
5906 if (WARN_ON((match_len && match_offset < 2) ||
5907 (!match_len && match_offset)))
5910 return (void *)cfg80211_find_elem_match(eid, ies, len,
5913 match_offset - 2 : 0);
5917 * cfg80211_find_elem - find information element in data
5920 * @ies: data consisting of IEs
5921 * @len: length of data
5923 * Return: %NULL if the element ID could not be found or if
5924 * the element is invalid (claims to be longer than the given
5925 * data) or if the byte array doesn't match; otherwise return the
5926 * requested element struct.
5928 * Note: There are no checks on the element length other than
5929 * having to fit into the given data.
5931 static inline const struct element *
5932 cfg80211_find_elem(u8 eid, const u8 *ies, int len)
5934 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
5938 * cfg80211_find_ie - find information element in data
5941 * @ies: data consisting of IEs
5942 * @len: length of data
5944 * Return: %NULL if the element ID could not be found or if
5945 * the element is invalid (claims to be longer than the given
5946 * data), or a pointer to the first byte of the requested
5947 * element, that is the byte containing the element ID.
5949 * Note: There are no checks on the element length other than
5950 * having to fit into the given data.
5952 static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5954 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5958 * cfg80211_find_ext_elem - find information element with EID Extension in data
5960 * @ext_eid: element ID Extension
5961 * @ies: data consisting of IEs
5962 * @len: length of data
5964 * Return: %NULL if the etended element could not be found or if
5965 * the element is invalid (claims to be longer than the given
5966 * data) or if the byte array doesn't match; otherwise return the
5967 * requested element struct.
5969 * Note: There are no checks on the element length other than
5970 * having to fit into the given data.
5972 static inline const struct element *
5973 cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
5975 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
5980 * cfg80211_find_ext_ie - find information element with EID Extension in data
5982 * @ext_eid: element ID Extension
5983 * @ies: data consisting of IEs
5984 * @len: length of data
5986 * Return: %NULL if the extended element ID could not be found or if
5987 * the element is invalid (claims to be longer than the given
5988 * data), or a pointer to the first byte of the requested
5989 * element, that is the byte containing the element ID.
5991 * Note: There are no checks on the element length other than
5992 * having to fit into the given data.
5994 static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
5996 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
6001 * cfg80211_find_vendor_elem - find vendor specific information element in data
6004 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
6005 * @ies: data consisting of IEs
6006 * @len: length of data
6008 * Return: %NULL if the vendor specific element ID could not be found or if the
6009 * element is invalid (claims to be longer than the given data); otherwise
6010 * return the element structure for the requested element.
6012 * Note: There are no checks on the element length other than having to fit into
6015 const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
6020 * cfg80211_find_vendor_ie - find vendor specific information element in data
6023 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
6024 * @ies: data consisting of IEs
6025 * @len: length of data
6027 * Return: %NULL if the vendor specific element ID could not be found or if the
6028 * element is invalid (claims to be longer than the given data), or a pointer to
6029 * the first byte of the requested element, that is the byte containing the
6032 * Note: There are no checks on the element length other than having to fit into
6035 static inline const u8 *
6036 cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
6037 const u8 *ies, unsigned int len)
6039 return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
6043 * cfg80211_send_layer2_update - send layer 2 update frame
6045 * @dev: network device
6046 * @addr: STA MAC address
6048 * Wireless drivers can use this function to update forwarding tables in bridge
6049 * devices upon STA association.
6051 void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
6054 * DOC: Regulatory enforcement infrastructure
6060 * regulatory_hint - driver hint to the wireless core a regulatory domain
6061 * @wiphy: the wireless device giving the hint (used only for reporting
6063 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
6064 * should be in. If @rd is set this should be NULL. Note that if you
6065 * set this to NULL you should still set rd->alpha2 to some accepted
6068 * Wireless drivers can use this function to hint to the wireless core
6069 * what it believes should be the current regulatory domain by
6070 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
6071 * domain should be in or by providing a completely build regulatory domain.
6072 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
6073 * for a regulatory domain structure for the respective country.
6075 * The wiphy must have been registered to cfg80211 prior to this call.
6076 * For cfg80211 drivers this means you must first use wiphy_register(),
6077 * for mac80211 drivers you must first use ieee80211_register_hw().
6079 * Drivers should check the return value, its possible you can get
6082 * Return: 0 on success. -ENOMEM.
6084 int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
6087 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
6088 * @wiphy: the wireless device we want to process the regulatory domain on
6089 * @rd: the regulatory domain informatoin to use for this wiphy
6091 * Set the regulatory domain information for self-managed wiphys, only they
6092 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
6095 * Return: 0 on success. -EINVAL, -EPERM
6097 int regulatory_set_wiphy_regd(struct wiphy *wiphy,
6098 struct ieee80211_regdomain *rd);
6101 * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
6102 * @wiphy: the wireless device we want to process the regulatory domain on
6103 * @rd: the regulatory domain information to use for this wiphy
6105 * This functions requires the RTNL and the wiphy mutex to be held and
6106 * applies the new regdomain synchronously to this wiphy. For more details
6107 * see regulatory_set_wiphy_regd().
6109 * Return: 0 on success. -EINVAL, -EPERM
6111 int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
6112 struct ieee80211_regdomain *rd);
6115 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6116 * @wiphy: the wireless device we want to process the regulatory domain on
6117 * @regd: the custom regulatory domain to use for this wiphy
6119 * Drivers can sometimes have custom regulatory domains which do not apply
6120 * to a specific country. Drivers can use this to apply such custom regulatory
6121 * domains. This routine must be called prior to wiphy registration. The
6122 * custom regulatory domain will be trusted completely and as such previous
6123 * default channel settings will be disregarded. If no rule is found for a
6124 * channel on the regulatory domain the channel will be disabled.
6125 * Drivers using this for a wiphy should also set the wiphy flag
6126 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6127 * that called this helper.
6129 void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6130 const struct ieee80211_regdomain *regd);
6133 * freq_reg_info - get regulatory information for the given frequency
6134 * @wiphy: the wiphy for which we want to process this rule for
6135 * @center_freq: Frequency in KHz for which we want regulatory information for
6137 * Use this function to get the regulatory rule for a specific frequency on
6138 * a given wireless device. If the device has a specific regulatory domain
6139 * it wants to follow we respect that unless a country IE has been received
6140 * and processed already.
6142 * Return: A valid pointer, or, when an error occurs, for example if no rule
6143 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
6144 * check and PTR_ERR() to obtain the numeric return value. The numeric return
6145 * value will be -ERANGE if we determine the given center_freq does not even
6146 * have a regulatory rule for a frequency range in the center_freq's band.
6147 * See freq_in_rule_band() for our current definition of a band -- this is
6148 * purely subjective and right now it's 802.11 specific.
6150 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6154 * reg_initiator_name - map regulatory request initiator enum to name
6155 * @initiator: the regulatory request initiator
6157 * You can use this to map the regulatory request initiator enum to a
6158 * proper string representation.
6160 const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6163 * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6164 * @wiphy: wiphy for which pre-CAC capability is checked.
6166 * Pre-CAC is allowed only in some regdomains (notable ETSI).
6168 bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6171 * DOC: Internal regulatory db functions
6176 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
6177 * Regulatory self-managed driver can use it to proactively
6179 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
6180 * @freq: the freqency(in MHz) to be queried.
6181 * @rule: pointer to store the wmm rule from the regulatory db.
6183 * Self-managed wireless drivers can use this function to query
6184 * the internal regulatory database to check whether the given
6185 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
6187 * Drivers should check the return value, its possible you can get
6190 * Return: 0 on success. -ENODATA.
6192 int reg_query_regdb_wmm(char *alpha2, int freq,
6193 struct ieee80211_reg_rule *rule);
6196 * callbacks for asynchronous cfg80211 methods, notification
6197 * functions and BSS handling helpers
6201 * cfg80211_scan_done - notify that scan finished
6203 * @request: the corresponding scan request
6204 * @info: information about the completed scan
6206 void cfg80211_scan_done(struct cfg80211_scan_request *request,
6207 struct cfg80211_scan_info *info);
6210 * cfg80211_sched_scan_results - notify that new scan results are available
6212 * @wiphy: the wiphy which got scheduled scan results
6213 * @reqid: identifier for the related scheduled scan request
6215 void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6218 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6220 * @wiphy: the wiphy on which the scheduled scan stopped
6221 * @reqid: identifier for the related scheduled scan request
6223 * The driver can call this function to inform cfg80211 that the
6224 * scheduled scan had to be stopped, for whatever reason. The driver
6225 * is then called back via the sched_scan_stop operation when done.
6227 void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6230 * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
6232 * @wiphy: the wiphy on which the scheduled scan stopped
6233 * @reqid: identifier for the related scheduled scan request
6235 * The driver can call this function to inform cfg80211 that the
6236 * scheduled scan had to be stopped, for whatever reason. The driver
6237 * is then called back via the sched_scan_stop operation when done.
6238 * This function should be called with the wiphy mutex held.
6240 void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
6243 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
6244 * @wiphy: the wiphy reporting the BSS
6245 * @data: the BSS metadata
6246 * @mgmt: the management frame (probe response or beacon)
6247 * @len: length of the management frame
6248 * @gfp: context flags
6250 * This informs cfg80211 that BSS information was found and
6251 * the BSS should be updated/added.
6253 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6254 * Or %NULL on error.
6256 struct cfg80211_bss * __must_check
6257 cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
6258 struct cfg80211_inform_bss *data,
6259 struct ieee80211_mgmt *mgmt, size_t len,
6262 static inline struct cfg80211_bss * __must_check
6263 cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
6264 struct ieee80211_channel *rx_channel,
6265 enum nl80211_bss_scan_width scan_width,
6266 struct ieee80211_mgmt *mgmt, size_t len,
6267 s32 signal, gfp_t gfp)
6269 struct cfg80211_inform_bss data = {
6271 .scan_width = scan_width,
6275 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6278 static inline struct cfg80211_bss * __must_check
6279 cfg80211_inform_bss_frame(struct wiphy *wiphy,
6280 struct ieee80211_channel *rx_channel,
6281 struct ieee80211_mgmt *mgmt, size_t len,
6282 s32 signal, gfp_t gfp)
6284 struct cfg80211_inform_bss data = {
6286 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6290 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6294 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
6295 * @bssid: transmitter BSSID
6296 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
6297 * @mbssid_index: BSSID index, taken from Multiple BSSID index element
6298 * @new_bssid: calculated nontransmitted BSSID
6300 static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
6301 u8 mbssid_index, u8 *new_bssid)
6303 u64 bssid_u64 = ether_addr_to_u64(bssid);
6304 u64 mask = GENMASK_ULL(max_bssid - 1, 0);
6307 new_bssid_u64 = bssid_u64 & ~mask;
6309 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
6311 u64_to_ether_addr(new_bssid_u64, new_bssid);
6315 * cfg80211_is_element_inherited - returns if element ID should be inherited
6316 * @element: element to check
6317 * @non_inherit_element: non inheritance element
6319 bool cfg80211_is_element_inherited(const struct element *element,
6320 const struct element *non_inherit_element);
6323 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6325 * @ielen: length of IEs
6326 * @mbssid_elem: current MBSSID element
6327 * @sub_elem: current MBSSID subelement (profile)
6328 * @merged_ie: location of the merged profile
6329 * @max_copy_len: max merged profile length
6331 size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6332 const struct element *mbssid_elem,
6333 const struct element *sub_elem,
6334 u8 *merged_ie, size_t max_copy_len);
6337 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
6338 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
6339 * from a beacon or probe response
6340 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
6341 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
6343 enum cfg80211_bss_frame_type {
6344 CFG80211_BSS_FTYPE_UNKNOWN,
6345 CFG80211_BSS_FTYPE_BEACON,
6346 CFG80211_BSS_FTYPE_PRESP,
6350 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6352 * @wiphy: the wiphy reporting the BSS
6353 * @data: the BSS metadata
6354 * @ftype: frame type (if known)
6355 * @bssid: the BSSID of the BSS
6356 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6357 * @capability: the capability field sent by the peer
6358 * @beacon_interval: the beacon interval announced by the peer
6359 * @ie: additional IEs sent by the peer
6360 * @ielen: length of the additional IEs
6361 * @gfp: context flags
6363 * This informs cfg80211 that BSS information was found and
6364 * the BSS should be updated/added.
6366 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6367 * Or %NULL on error.
6369 struct cfg80211_bss * __must_check
6370 cfg80211_inform_bss_data(struct wiphy *wiphy,
6371 struct cfg80211_inform_bss *data,
6372 enum cfg80211_bss_frame_type ftype,
6373 const u8 *bssid, u64 tsf, u16 capability,
6374 u16 beacon_interval, const u8 *ie, size_t ielen,
6377 static inline struct cfg80211_bss * __must_check
6378 cfg80211_inform_bss_width(struct wiphy *wiphy,
6379 struct ieee80211_channel *rx_channel,
6380 enum nl80211_bss_scan_width scan_width,
6381 enum cfg80211_bss_frame_type ftype,
6382 const u8 *bssid, u64 tsf, u16 capability,
6383 u16 beacon_interval, const u8 *ie, size_t ielen,
6384 s32 signal, gfp_t gfp)
6386 struct cfg80211_inform_bss data = {
6388 .scan_width = scan_width,
6392 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6393 capability, beacon_interval, ie, ielen,
6397 static inline struct cfg80211_bss * __must_check
6398 cfg80211_inform_bss(struct wiphy *wiphy,
6399 struct ieee80211_channel *rx_channel,
6400 enum cfg80211_bss_frame_type ftype,
6401 const u8 *bssid, u64 tsf, u16 capability,
6402 u16 beacon_interval, const u8 *ie, size_t ielen,
6403 s32 signal, gfp_t gfp)
6405 struct cfg80211_inform_bss data = {
6407 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6411 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6412 capability, beacon_interval, ie, ielen,
6417 * cfg80211_get_bss - get a BSS reference
6418 * @wiphy: the wiphy this BSS struct belongs to
6419 * @channel: the channel to search on (or %NULL)
6420 * @bssid: the desired BSSID (or %NULL)
6421 * @ssid: the desired SSID (or %NULL)
6422 * @ssid_len: length of the SSID (or 0)
6423 * @bss_type: type of BSS, see &enum ieee80211_bss_type
6424 * @privacy: privacy filter, see &enum ieee80211_privacy
6426 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
6427 struct ieee80211_channel *channel,
6429 const u8 *ssid, size_t ssid_len,
6430 enum ieee80211_bss_type bss_type,
6431 enum ieee80211_privacy privacy);
6432 static inline struct cfg80211_bss *
6433 cfg80211_get_ibss(struct wiphy *wiphy,
6434 struct ieee80211_channel *channel,
6435 const u8 *ssid, size_t ssid_len)
6437 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
6438 IEEE80211_BSS_TYPE_IBSS,
6439 IEEE80211_PRIVACY_ANY);
6443 * cfg80211_ref_bss - reference BSS struct
6444 * @wiphy: the wiphy this BSS struct belongs to
6445 * @bss: the BSS struct to reference
6447 * Increments the refcount of the given BSS struct.
6449 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6452 * cfg80211_put_bss - unref BSS struct
6453 * @wiphy: the wiphy this BSS struct belongs to
6454 * @bss: the BSS struct
6456 * Decrements the refcount of the given BSS struct.
6458 void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6461 * cfg80211_unlink_bss - unlink BSS from internal data structures
6463 * @bss: the bss to remove
6465 * This function removes the given BSS from the internal data structures
6466 * thereby making it no longer show up in scan results etc. Use this
6467 * function when you detect a BSS is gone. Normally BSSes will also time
6468 * out, so it is not necessary to use this function at all.
6470 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6473 * cfg80211_bss_iter - iterate all BSS entries
6475 * This function iterates over the BSS entries associated with the given wiphy
6476 * and calls the callback for the iterated BSS. The iterator function is not
6477 * allowed to call functions that might modify the internal state of the BSS DB.
6480 * @chandef: if given, the iterator function will be called only if the channel
6481 * of the currently iterated BSS is a subset of the given channel.
6482 * @iter: the iterator function to call
6483 * @iter_data: an argument to the iterator function
6485 void cfg80211_bss_iter(struct wiphy *wiphy,
6486 struct cfg80211_chan_def *chandef,
6487 void (*iter)(struct wiphy *wiphy,
6488 struct cfg80211_bss *bss,
6492 static inline enum nl80211_bss_scan_width
6493 cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6495 switch (chandef->width) {
6496 case NL80211_CHAN_WIDTH_5:
6497 return NL80211_BSS_CHAN_WIDTH_5;
6498 case NL80211_CHAN_WIDTH_10:
6499 return NL80211_BSS_CHAN_WIDTH_10;
6501 return NL80211_BSS_CHAN_WIDTH_20;
6506 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
6507 * @dev: network device
6508 * @buf: authentication frame (header + body)
6509 * @len: length of the frame data
6511 * This function is called whenever an authentication, disassociation or
6512 * deauthentication frame has been received and processed in station mode.
6513 * After being asked to authenticate via cfg80211_ops::auth() the driver must
6514 * call either this function or cfg80211_auth_timeout().
6515 * After being asked to associate via cfg80211_ops::assoc() the driver must
6516 * call either this function or cfg80211_auth_timeout().
6517 * While connected, the driver must calls this for received and processed
6518 * disassociation and deauthentication frames. If the frame couldn't be used
6519 * because it was unprotected, the driver must call the function
6520 * cfg80211_rx_unprot_mlme_mgmt() instead.
6522 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6524 void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6527 * cfg80211_auth_timeout - notification of timed out authentication
6528 * @dev: network device
6529 * @addr: The MAC address of the device with which the authentication timed out
6531 * This function may sleep. The caller must hold the corresponding wdev's
6534 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
6537 * cfg80211_rx_assoc_resp - notification of processed association response
6538 * @dev: network device
6539 * @bss: the BSS that association was requested with, ownership of the pointer
6540 * moves to cfg80211 in this call
6541 * @buf: (Re)Association Response frame (header + body)
6542 * @len: length of the frame data
6543 * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6544 * as the AC bitmap in the QoS info field
6545 * @req_ies: information elements from the (Re)Association Request frame
6546 * @req_ies_len: length of req_ies data
6548 * After being asked to associate via cfg80211_ops::assoc() the driver must
6549 * call either this function or cfg80211_auth_timeout().
6551 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6553 void cfg80211_rx_assoc_resp(struct net_device *dev,
6554 struct cfg80211_bss *bss,
6555 const u8 *buf, size_t len,
6557 const u8 *req_ies, size_t req_ies_len);
6560 * cfg80211_assoc_timeout - notification of timed out association
6561 * @dev: network device
6562 * @bss: The BSS entry with which association timed out.
6564 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6566 void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
6569 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6570 * @dev: network device
6571 * @bss: The BSS entry with which association was abandoned.
6573 * Call this whenever - for reasons reported through other API, like deauth RX,
6574 * an association attempt was abandoned.
6575 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6577 void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6580 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
6581 * @dev: network device
6582 * @buf: 802.11 frame (header + body)
6583 * @len: length of the frame data
6584 * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
6586 * This function is called whenever deauthentication has been processed in
6587 * station mode. This includes both received deauthentication frames and
6588 * locally generated ones. This function may sleep. The caller must hold the
6589 * corresponding wdev's mutex.
6591 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
6595 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6596 * @dev: network device
6597 * @buf: received management frame (header + body)
6598 * @len: length of the frame data
6600 * This function is called whenever a received deauthentication or dissassoc
6601 * frame has been dropped in station mode because of MFP being used but the
6602 * frame was not protected. This is also used to notify reception of a Beacon
6603 * frame that was dropped because it did not include a valid MME MIC while
6604 * beacon protection was enabled (BIGTK configured in station mode).
6606 * This function may sleep.
6608 void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
6609 const u8 *buf, size_t len);
6612 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6613 * @dev: network device
6614 * @addr: The source MAC address of the frame
6615 * @key_type: The key type that the received frame used
6616 * @key_id: Key identifier (0..3). Can be -1 if missing.
6617 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6618 * @gfp: allocation flags
6620 * This function is called whenever the local MAC detects a MIC failure in a
6621 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6624 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6625 enum nl80211_key_type key_type, int key_id,
6626 const u8 *tsc, gfp_t gfp);
6629 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
6631 * @dev: network device
6632 * @bssid: the BSSID of the IBSS joined
6633 * @channel: the channel of the IBSS joined
6634 * @gfp: allocation flags
6636 * This function notifies cfg80211 that the device joined an IBSS or
6637 * switched to a different BSSID. Before this function can be called,
6638 * either a beacon has to have been received from the IBSS, or one of
6639 * the cfg80211_inform_bss{,_frame} functions must have been called
6640 * with the locally generated beacon -- this guarantees that there is
6641 * always a scan result for this IBSS. cfg80211 will handle the rest.
6643 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6644 struct ieee80211_channel *channel, gfp_t gfp);
6647 * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6650 * @dev: network device
6651 * @macaddr: the MAC address of the new candidate
6652 * @ie: information elements advertised by the peer candidate
6653 * @ie_len: length of the information elements buffer
6654 * @gfp: allocation flags
6656 * This function notifies cfg80211 that the mesh peer candidate has been
6657 * detected, most likely via a beacon or, less likely, via a probe response.
6658 * cfg80211 then sends a notification to userspace.
6660 void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6661 const u8 *macaddr, const u8 *ie, u8 ie_len,
6662 int sig_dbm, gfp_t gfp);
6665 * DOC: RFkill integration
6667 * RFkill integration in cfg80211 is almost invisible to drivers,
6668 * as cfg80211 automatically registers an rfkill instance for each
6669 * wireless device it knows about. Soft kill is also translated
6670 * into disconnecting and turning all interfaces off, drivers are
6671 * expected to turn off the device when all interfaces are down.
6673 * However, devices may have a hard RFkill line, in which case they
6674 * also need to interact with the rfkill subsystem, via cfg80211.
6675 * They can do this with a few helper functions documented here.
6679 * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
6681 * @blocked: block status
6682 * @reason: one of reasons in &enum rfkill_hard_block_reasons
6684 void wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
6685 enum rfkill_hard_block_reasons reason);
6687 static inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
6689 wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
6690 RFKILL_HARD_BLOCK_SIGNAL);
6694 * wiphy_rfkill_start_polling - start polling rfkill
6697 void wiphy_rfkill_start_polling(struct wiphy *wiphy);
6700 * wiphy_rfkill_stop_polling - stop polling rfkill
6703 static inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
6705 rfkill_pause_polling(wiphy->rfkill);
6709 * DOC: Vendor commands
6711 * Occasionally, there are special protocol or firmware features that
6712 * can't be implemented very openly. For this and similar cases, the
6713 * vendor command functionality allows implementing the features with
6714 * (typically closed-source) userspace and firmware, using nl80211 as
6715 * the configuration mechanism.
6717 * A driver supporting vendor commands must register them as an array
6718 * in struct wiphy, with handlers for each one, each command has an
6719 * OUI and sub command ID to identify it.
6721 * Note that this feature should not be (ab)used to implement protocol
6722 * features that could openly be shared across drivers. In particular,
6723 * it must never be required to use vendor commands to implement any
6724 * "normal" functionality that higher-level userspace like connection
6725 * managers etc. need.
6728 struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6729 enum nl80211_commands cmd,
6730 enum nl80211_attrs attr,
6733 struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
6734 struct wireless_dev *wdev,
6735 enum nl80211_commands cmd,
6736 enum nl80211_attrs attr,
6737 unsigned int portid,
6738 int vendor_event_idx,
6739 int approxlen, gfp_t gfp);
6741 void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6744 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6746 * @approxlen: an upper bound of the length of the data that will
6747 * be put into the skb
6749 * This function allocates and pre-fills an skb for a reply to
6750 * a vendor command. Since it is intended for a reply, calling
6751 * it outside of a vendor command's doit() operation is invalid.
6753 * The returned skb is pre-filled with some identifying data in
6754 * a way that any data that is put into the skb (with skb_put(),
6755 * nla_put() or similar) will end up being within the
6756 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6757 * with the skb is adding data for the corresponding userspace tool
6758 * which can then read that data out of the vendor data attribute.
6759 * You must not modify the skb in any other way.
6761 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6762 * its error code as the result of the doit() operation.
6764 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6766 static inline struct sk_buff *
6767 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6769 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6770 NL80211_ATTR_VENDOR_DATA, approxlen);
6774 * cfg80211_vendor_cmd_reply - send the reply skb
6775 * @skb: The skb, must have been allocated with
6776 * cfg80211_vendor_cmd_alloc_reply_skb()
6778 * Since calling this function will usually be the last thing
6779 * before returning from the vendor command doit() you should
6780 * return the error code. Note that this function consumes the
6781 * skb regardless of the return value.
6783 * Return: An error code or 0 on success.
6785 int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6788 * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
6791 * Return the current netlink port ID in a vendor command handler.
6792 * Valid to call only there.
6794 unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
6797 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6799 * @wdev: the wireless device
6800 * @event_idx: index of the vendor event in the wiphy's vendor_events
6801 * @approxlen: an upper bound of the length of the data that will
6802 * be put into the skb
6803 * @gfp: allocation flags
6805 * This function allocates and pre-fills an skb for an event on the
6806 * vendor-specific multicast group.
6808 * If wdev != NULL, both the ifindex and identifier of the specified
6809 * wireless device are added to the event message before the vendor data
6812 * When done filling the skb, call cfg80211_vendor_event() with the
6813 * skb to send the event.
6815 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6817 static inline struct sk_buff *
6818 cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
6819 int approxlen, int event_idx, gfp_t gfp)
6821 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6822 NL80211_ATTR_VENDOR_DATA,
6823 0, event_idx, approxlen, gfp);
6827 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
6829 * @wdev: the wireless device
6830 * @event_idx: index of the vendor event in the wiphy's vendor_events
6831 * @portid: port ID of the receiver
6832 * @approxlen: an upper bound of the length of the data that will
6833 * be put into the skb
6834 * @gfp: allocation flags
6836 * This function allocates and pre-fills an skb for an event to send to
6837 * a specific (userland) socket. This socket would previously have been
6838 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
6839 * care to register a netlink notifier to see when the socket closes.
6841 * If wdev != NULL, both the ifindex and identifier of the specified
6842 * wireless device are added to the event message before the vendor data
6845 * When done filling the skb, call cfg80211_vendor_event() with the
6846 * skb to send the event.
6848 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6850 static inline struct sk_buff *
6851 cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
6852 struct wireless_dev *wdev,
6853 unsigned int portid, int approxlen,
6854 int event_idx, gfp_t gfp)
6856 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6857 NL80211_ATTR_VENDOR_DATA,
6858 portid, event_idx, approxlen, gfp);
6862 * cfg80211_vendor_event - send the event
6863 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6864 * @gfp: allocation flags
6866 * This function sends the given @skb, which must have been allocated
6867 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6869 static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6871 __cfg80211_send_event_skb(skb, gfp);
6874 #ifdef CONFIG_NL80211_TESTMODE
6878 * Test mode is a set of utility functions to allow drivers to
6879 * interact with driver-specific tools to aid, for instance,
6880 * factory programming.
6882 * This chapter describes how drivers interact with it, for more
6883 * information see the nl80211 book's chapter on it.
6887 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6889 * @approxlen: an upper bound of the length of the data that will
6890 * be put into the skb
6892 * This function allocates and pre-fills an skb for a reply to
6893 * the testmode command. Since it is intended for a reply, calling
6894 * it outside of the @testmode_cmd operation is invalid.
6896 * The returned skb is pre-filled with the wiphy index and set up in
6897 * a way that any data that is put into the skb (with skb_put(),
6898 * nla_put() or similar) will end up being within the
6899 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
6900 * with the skb is adding data for the corresponding userspace tool
6901 * which can then read that data out of the testdata attribute. You
6902 * must not modify the skb in any other way.
6904 * When done, call cfg80211_testmode_reply() with the skb and return
6905 * its error code as the result of the @testmode_cmd operation.
6907 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6909 static inline struct sk_buff *
6910 cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6912 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6913 NL80211_ATTR_TESTDATA, approxlen);
6917 * cfg80211_testmode_reply - send the reply skb
6918 * @skb: The skb, must have been allocated with
6919 * cfg80211_testmode_alloc_reply_skb()
6921 * Since calling this function will usually be the last thing
6922 * before returning from the @testmode_cmd you should return
6923 * the error code. Note that this function consumes the skb
6924 * regardless of the return value.
6926 * Return: An error code or 0 on success.
6928 static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6930 return cfg80211_vendor_cmd_reply(skb);
6934 * cfg80211_testmode_alloc_event_skb - allocate testmode event
6936 * @approxlen: an upper bound of the length of the data that will
6937 * be put into the skb
6938 * @gfp: allocation flags
6940 * This function allocates and pre-fills an skb for an event on the
6941 * testmode multicast group.
6943 * The returned skb is set up in the same way as with
6944 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
6945 * there, you should simply add data to it that will then end up in the
6946 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
6949 * When done filling the skb, call cfg80211_testmode_event() with the
6950 * skb to send the event.
6952 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6954 static inline struct sk_buff *
6955 cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6957 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
6958 NL80211_ATTR_TESTDATA, 0, -1,
6963 * cfg80211_testmode_event - send the event
6964 * @skb: The skb, must have been allocated with
6965 * cfg80211_testmode_alloc_event_skb()
6966 * @gfp: allocation flags
6968 * This function sends the given @skb, which must have been allocated
6969 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6972 static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6974 __cfg80211_send_event_skb(skb, gfp);
6977 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
6978 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
6980 #define CFG80211_TESTMODE_CMD(cmd)
6981 #define CFG80211_TESTMODE_DUMP(cmd)
6985 * struct cfg80211_fils_resp_params - FILS connection response params
6986 * @kek: KEK derived from a successful FILS connection (may be %NULL)
6987 * @kek_len: Length of @fils_kek in octets
6988 * @update_erp_next_seq_num: Boolean value to specify whether the value in
6989 * @erp_next_seq_num is valid.
6990 * @erp_next_seq_num: The next sequence number to use in ERP message in
6991 * FILS Authentication. This value should be specified irrespective of the
6992 * status for a FILS connection.
6993 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
6994 * @pmk_len: Length of @pmk in octets
6995 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
6996 * used for this FILS connection (may be %NULL).
6998 struct cfg80211_fils_resp_params {
7001 bool update_erp_next_seq_num;
7002 u16 erp_next_seq_num;
7009 * struct cfg80211_connect_resp_params - Connection response params
7010 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
7011 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7012 * the real status code for failures. If this call is used to report a
7013 * failure due to a timeout (e.g., not receiving an Authentication frame
7014 * from the AP) instead of an explicit rejection by the AP, -1 is used to
7015 * indicate that this is a failure, but without a status code.
7016 * @timeout_reason is used to report the reason for the timeout in that
7018 * @bssid: The BSSID of the AP (may be %NULL)
7019 * @bss: Entry of bss to which STA got connected to, can be obtained through
7020 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7021 * bss from the connect_request and hold a reference to it and return
7022 * through this param to avoid a warning if the bss is expired during the
7023 * connection, esp. for those drivers implementing connect op.
7024 * Only one parameter among @bssid and @bss needs to be specified.
7025 * @req_ie: Association request IEs (may be %NULL)
7026 * @req_ie_len: Association request IEs length
7027 * @resp_ie: Association response IEs (may be %NULL)
7028 * @resp_ie_len: Association response IEs length
7029 * @fils: FILS connection response parameters.
7030 * @timeout_reason: Reason for connection timeout. This is used when the
7031 * connection fails due to a timeout instead of an explicit rejection from
7032 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
7033 * not known. This value is used only if @status < 0 to indicate that the
7034 * failure is due to a timeout and not due to explicit rejection by the AP.
7035 * This value is ignored in other cases (@status >= 0).
7037 struct cfg80211_connect_resp_params {
7040 struct cfg80211_bss *bss;
7045 struct cfg80211_fils_resp_params fils;
7046 enum nl80211_timeout_reason timeout_reason;
7050 * cfg80211_connect_done - notify cfg80211 of connection result
7052 * @dev: network device
7053 * @params: connection response parameters
7054 * @gfp: allocation flags
7056 * It should be called by the underlying driver once execution of the connection
7057 * request from connect() has been completed. This is similar to
7058 * cfg80211_connect_bss(), but takes a structure pointer for connection response
7059 * parameters. Only one of the functions among cfg80211_connect_bss(),
7060 * cfg80211_connect_result(), cfg80211_connect_timeout(),
7061 * and cfg80211_connect_done() should be called.
7063 void cfg80211_connect_done(struct net_device *dev,
7064 struct cfg80211_connect_resp_params *params,
7068 * cfg80211_connect_bss - notify cfg80211 of connection result
7070 * @dev: network device
7071 * @bssid: the BSSID of the AP
7072 * @bss: Entry of bss to which STA got connected to, can be obtained through
7073 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7074 * bss from the connect_request and hold a reference to it and return
7075 * through this param to avoid a warning if the bss is expired during the
7076 * connection, esp. for those drivers implementing connect op.
7077 * Only one parameter among @bssid and @bss needs to be specified.
7078 * @req_ie: association request IEs (maybe be %NULL)
7079 * @req_ie_len: association request IEs length
7080 * @resp_ie: association response IEs (may be %NULL)
7081 * @resp_ie_len: assoc response IEs length
7082 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7083 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7084 * the real status code for failures. If this call is used to report a
7085 * failure due to a timeout (e.g., not receiving an Authentication frame
7086 * from the AP) instead of an explicit rejection by the AP, -1 is used to
7087 * indicate that this is a failure, but without a status code.
7088 * @timeout_reason is used to report the reason for the timeout in that
7090 * @gfp: allocation flags
7091 * @timeout_reason: reason for connection timeout. This is used when the
7092 * connection fails due to a timeout instead of an explicit rejection from
7093 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
7094 * not known. This value is used only if @status < 0 to indicate that the
7095 * failure is due to a timeout and not due to explicit rejection by the AP.
7096 * This value is ignored in other cases (@status >= 0).
7098 * It should be called by the underlying driver once execution of the connection
7099 * request from connect() has been completed. This is similar to
7100 * cfg80211_connect_result(), but with the option of identifying the exact bss
7101 * entry for the connection. Only one of the functions among
7102 * cfg80211_connect_bss(), cfg80211_connect_result(),
7103 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7106 cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
7107 struct cfg80211_bss *bss, const u8 *req_ie,
7108 size_t req_ie_len, const u8 *resp_ie,
7109 size_t resp_ie_len, int status, gfp_t gfp,
7110 enum nl80211_timeout_reason timeout_reason)
7112 struct cfg80211_connect_resp_params params;
7114 memset(¶ms, 0, sizeof(params));
7115 params.status = status;
7116 params.bssid = bssid;
7118 params.req_ie = req_ie;
7119 params.req_ie_len = req_ie_len;
7120 params.resp_ie = resp_ie;
7121 params.resp_ie_len = resp_ie_len;
7122 params.timeout_reason = timeout_reason;
7124 cfg80211_connect_done(dev, ¶ms, gfp);
7128 * cfg80211_connect_result - notify cfg80211 of connection result
7130 * @dev: network device
7131 * @bssid: the BSSID of the AP
7132 * @req_ie: association request IEs (maybe be %NULL)
7133 * @req_ie_len: association request IEs length
7134 * @resp_ie: association response IEs (may be %NULL)
7135 * @resp_ie_len: assoc response IEs length
7136 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7137 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7138 * the real status code for failures.
7139 * @gfp: allocation flags
7141 * It should be called by the underlying driver once execution of the connection
7142 * request from connect() has been completed. This is similar to
7143 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
7144 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
7145 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7148 cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7149 const u8 *req_ie, size_t req_ie_len,
7150 const u8 *resp_ie, size_t resp_ie_len,
7151 u16 status, gfp_t gfp)
7153 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
7154 resp_ie_len, status, gfp,
7155 NL80211_TIMEOUT_UNSPECIFIED);
7159 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7161 * @dev: network device
7162 * @bssid: the BSSID of the AP
7163 * @req_ie: association request IEs (maybe be %NULL)
7164 * @req_ie_len: association request IEs length
7165 * @gfp: allocation flags
7166 * @timeout_reason: reason for connection timeout.
7168 * It should be called by the underlying driver whenever connect() has failed
7169 * in a sequence where no explicit authentication/association rejection was
7170 * received from the AP. This could happen, e.g., due to not being able to send
7171 * out the Authentication or Association Request frame or timing out while
7172 * waiting for the response. Only one of the functions among
7173 * cfg80211_connect_bss(), cfg80211_connect_result(),
7174 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7177 cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
7178 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
7179 enum nl80211_timeout_reason timeout_reason)
7181 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
7182 gfp, timeout_reason);
7186 * struct cfg80211_roam_info - driver initiated roaming information
7188 * @channel: the channel of the new AP
7189 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
7190 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
7191 * @req_ie: association request IEs (maybe be %NULL)
7192 * @req_ie_len: association request IEs length
7193 * @resp_ie: association response IEs (may be %NULL)
7194 * @resp_ie_len: assoc response IEs length
7195 * @fils: FILS related roaming information.
7197 struct cfg80211_roam_info {
7198 struct ieee80211_channel *channel;
7199 struct cfg80211_bss *bss;
7205 struct cfg80211_fils_resp_params fils;
7209 * cfg80211_roamed - notify cfg80211 of roaming
7211 * @dev: network device
7212 * @info: information about the new BSS. struct &cfg80211_roam_info.
7213 * @gfp: allocation flags
7215 * This function may be called with the driver passing either the BSSID of the
7216 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
7217 * It should be called by the underlying driver whenever it roamed from one AP
7218 * to another while connected. Drivers which have roaming implemented in
7219 * firmware should pass the bss entry to avoid a race in bss entry timeout where
7220 * the bss entry of the new AP is seen in the driver, but gets timed out by the
7221 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7222 * rdev->event_work. In case of any failures, the reference is released
7223 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7224 * released while disconnecting from the current bss.
7226 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
7230 * cfg80211_port_authorized - notify cfg80211 of successful security association
7232 * @dev: network device
7233 * @bssid: the BSSID of the AP
7234 * @gfp: allocation flags
7236 * This function should be called by a driver that supports 4 way handshake
7237 * offload after a security association was successfully established (i.e.,
7238 * the 4 way handshake was completed successfully). The call to this function
7239 * should be preceded with a call to cfg80211_connect_result(),
7240 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7241 * indicate the 802.11 association.
7243 void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7247 * cfg80211_disconnected - notify cfg80211 that connection was dropped
7249 * @dev: network device
7250 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7251 * @ie_len: length of IEs
7252 * @reason: reason code for the disconnection, set it to 0 if unknown
7253 * @locally_generated: disconnection was requested locally
7254 * @gfp: allocation flags
7256 * After it calls this function, the driver should enter an idle state
7257 * and not try to connect to any AP any more.
7259 void cfg80211_disconnected(struct net_device *dev, u16 reason,
7260 const u8 *ie, size_t ie_len,
7261 bool locally_generated, gfp_t gfp);
7264 * cfg80211_ready_on_channel - notification of remain_on_channel start
7265 * @wdev: wireless device
7266 * @cookie: the request cookie
7267 * @chan: The current channel (from remain_on_channel request)
7268 * @duration: Duration in milliseconds that the driver intents to remain on the
7270 * @gfp: allocation flags
7272 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
7273 struct ieee80211_channel *chan,
7274 unsigned int duration, gfp_t gfp);
7277 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
7278 * @wdev: wireless device
7279 * @cookie: the request cookie
7280 * @chan: The current channel (from remain_on_channel request)
7281 * @gfp: allocation flags
7283 void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
7284 struct ieee80211_channel *chan,
7288 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
7289 * @wdev: wireless device
7290 * @cookie: the requested cookie
7291 * @chan: The current channel (from tx_mgmt request)
7292 * @gfp: allocation flags
7294 void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
7295 struct ieee80211_channel *chan, gfp_t gfp);
7298 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
7300 * @sinfo: the station information
7301 * @gfp: allocation flags
7303 int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
7306 * cfg80211_sinfo_release_content - release contents of station info
7307 * @sinfo: the station information
7309 * Releases any potentially allocated sub-information of the station
7310 * information, but not the struct itself (since it's typically on
7313 static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
7315 kfree(sinfo->pertid);
7319 * cfg80211_new_sta - notify userspace about station
7322 * @mac_addr: the station's address
7323 * @sinfo: the station information
7324 * @gfp: allocation flags
7326 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
7327 struct station_info *sinfo, gfp_t gfp);
7330 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7332 * @mac_addr: the station's address
7333 * @sinfo: the station information/statistics
7334 * @gfp: allocation flags
7336 void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7337 struct station_info *sinfo, gfp_t gfp);
7340 * cfg80211_del_sta - notify userspace about deletion of a station
7343 * @mac_addr: the station's address
7344 * @gfp: allocation flags
7346 static inline void cfg80211_del_sta(struct net_device *dev,
7347 const u8 *mac_addr, gfp_t gfp)
7349 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7353 * cfg80211_conn_failed - connection request failed notification
7356 * @mac_addr: the station's address
7357 * @reason: the reason for connection failure
7358 * @gfp: allocation flags
7360 * Whenever a station tries to connect to an AP and if the station
7361 * could not connect to the AP as the AP has rejected the connection
7362 * for some reasons, this function is called.
7364 * The reason for connection failure can be any of the value from
7365 * nl80211_connect_failed_reason enum
7367 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7368 enum nl80211_connect_failed_reason reason,
7372 * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7373 * @wdev: wireless device receiving the frame
7374 * @freq: Frequency on which the frame was received in KHz
7375 * @sig_dbm: signal strength in dBm, or 0 if unknown
7376 * @buf: Management frame (header + body)
7377 * @len: length of the frame data
7378 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7380 * This function is called whenever an Action frame is received for a station
7381 * mode interface, but is not processed in kernel.
7383 * Return: %true if a user space application has registered for this frame.
7384 * For action frames, that makes it responsible for rejecting unrecognized
7385 * action frames; %false otherwise, in which case for action frames the
7386 * driver is responsible for rejecting the frame.
7388 bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7389 const u8 *buf, size_t len, u32 flags);
7392 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
7393 * @wdev: wireless device receiving the frame
7394 * @freq: Frequency on which the frame was received in MHz
7395 * @sig_dbm: signal strength in dBm, or 0 if unknown
7396 * @buf: Management frame (header + body)
7397 * @len: length of the frame data
7398 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7400 * This function is called whenever an Action frame is received for a station
7401 * mode interface, but is not processed in kernel.
7403 * Return: %true if a user space application has registered for this frame.
7404 * For action frames, that makes it responsible for rejecting unrecognized
7405 * action frames; %false otherwise, in which case for action frames the
7406 * driver is responsible for rejecting the frame.
7408 static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7409 int sig_dbm, const u8 *buf, size_t len,
7412 return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7417 * cfg80211_mgmt_tx_status - notification of TX status for management frame
7418 * @wdev: wireless device receiving the frame
7419 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
7420 * @buf: Management frame (header + body)
7421 * @len: length of the frame data
7422 * @ack: Whether frame was acknowledged
7423 * @gfp: context flags
7425 * This function is called whenever a management frame was requested to be
7426 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7427 * transmission attempt.
7429 void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7430 const u8 *buf, size_t len, bool ack, gfp_t gfp);
7433 * cfg80211_control_port_tx_status - notification of TX status for control
7435 * @wdev: wireless device receiving the frame
7436 * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7437 * @buf: Data frame (header + body)
7438 * @len: length of the frame data
7439 * @ack: Whether frame was acknowledged
7440 * @gfp: context flags
7442 * This function is called whenever a control port frame was requested to be
7443 * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7444 * the transmission attempt.
7446 void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7447 const u8 *buf, size_t len, bool ack,
7451 * cfg80211_rx_control_port - notification about a received control port frame
7452 * @dev: The device the frame matched to
7453 * @skb: The skbuf with the control port frame. It is assumed that the skbuf
7454 * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
7455 * This function does not take ownership of the skb, so the caller is
7456 * responsible for any cleanup. The caller must also ensure that
7457 * skb->protocol is set appropriately.
7458 * @unencrypted: Whether the frame was received unencrypted
7460 * This function is used to inform userspace about a received control port
7461 * frame. It should only be used if userspace indicated it wants to receive
7462 * control port frames over nl80211.
7464 * The frame is the data portion of the 802.3 or 802.11 data frame with all
7465 * network layer headers removed (e.g. the raw EAPoL frame).
7467 * Return: %true if the frame was passed to userspace
7469 bool cfg80211_rx_control_port(struct net_device *dev,
7470 struct sk_buff *skb, bool unencrypted);
7473 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7474 * @dev: network device
7475 * @rssi_event: the triggered RSSI event
7476 * @rssi_level: new RSSI level value or 0 if not available
7477 * @gfp: context flags
7479 * This function is called when a configured connection quality monitoring
7480 * rssi threshold reached event occurs.
7482 void cfg80211_cqm_rssi_notify(struct net_device *dev,
7483 enum nl80211_cqm_rssi_threshold_event rssi_event,
7484 s32 rssi_level, gfp_t gfp);
7487 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7488 * @dev: network device
7489 * @peer: peer's MAC address
7490 * @num_packets: how many packets were lost -- should be a fixed threshold
7491 * but probably no less than maybe 50, or maybe a throughput dependent
7492 * threshold (to account for temporary interference)
7493 * @gfp: context flags
7495 void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7496 const u8 *peer, u32 num_packets, gfp_t gfp);
7499 * cfg80211_cqm_txe_notify - TX error rate event
7500 * @dev: network device
7501 * @peer: peer's MAC address
7502 * @num_packets: how many packets were lost
7503 * @rate: % of packets which failed transmission
7504 * @intvl: interval (in s) over which the TX failure threshold was breached.
7505 * @gfp: context flags
7507 * Notify userspace when configured % TX failures over number of packets in a
7508 * given interval is exceeded.
7510 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
7511 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
7514 * cfg80211_cqm_beacon_loss_notify - beacon loss event
7515 * @dev: network device
7516 * @gfp: context flags
7518 * Notify userspace about beacon loss from the connected AP.
7520 void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
7523 * cfg80211_radar_event - radar detection event
7525 * @chandef: chandef for the current channel
7526 * @gfp: context flags
7528 * This function is called when a radar is detected on the current chanenl.
7530 void cfg80211_radar_event(struct wiphy *wiphy,
7531 struct cfg80211_chan_def *chandef, gfp_t gfp);
7534 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7535 * @dev: network device
7536 * @mac: MAC address of a station which opmode got modified
7537 * @sta_opmode: station's current opmode value
7538 * @gfp: context flags
7540 * Driver should call this function when station's opmode modified via action
7543 void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7544 struct sta_opmode_info *sta_opmode,
7548 * cfg80211_cac_event - Channel availability check (CAC) event
7549 * @netdev: network device
7550 * @chandef: chandef for the current channel
7551 * @event: type of event
7552 * @gfp: context flags
7554 * This function is called when a Channel availability check (CAC) is finished
7555 * or aborted. This must be called to notify the completion of a CAC process,
7556 * also by full-MAC drivers.
7558 void cfg80211_cac_event(struct net_device *netdev,
7559 const struct cfg80211_chan_def *chandef,
7560 enum nl80211_radar_event event, gfp_t gfp);
7564 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7565 * @dev: network device
7566 * @bssid: BSSID of AP (to avoid races)
7567 * @replay_ctr: new replay counter
7568 * @gfp: allocation flags
7570 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7571 const u8 *replay_ctr, gfp_t gfp);
7574 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7575 * @dev: network device
7576 * @index: candidate index (the smaller the index, the higher the priority)
7577 * @bssid: BSSID of AP
7578 * @preauth: Whether AP advertises support for RSN pre-authentication
7579 * @gfp: allocation flags
7581 void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7582 const u8 *bssid, bool preauth, gfp_t gfp);
7585 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
7586 * @dev: The device the frame matched to
7587 * @addr: the transmitter address
7588 * @gfp: context flags
7590 * This function is used in AP mode (only!) to inform userspace that
7591 * a spurious class 3 frame was received, to be able to deauth the
7593 * Return: %true if the frame was passed to userspace (or this failed
7594 * for a reason other than not having a subscription.)
7596 bool cfg80211_rx_spurious_frame(struct net_device *dev,
7597 const u8 *addr, gfp_t gfp);
7600 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7601 * @dev: The device the frame matched to
7602 * @addr: the transmitter address
7603 * @gfp: context flags
7605 * This function is used in AP mode (only!) to inform userspace that
7606 * an associated station sent a 4addr frame but that wasn't expected.
7607 * It is allowed and desirable to send this event only once for each
7608 * station to avoid event flooding.
7609 * Return: %true if the frame was passed to userspace (or this failed
7610 * for a reason other than not having a subscription.)
7612 bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7613 const u8 *addr, gfp_t gfp);
7616 * cfg80211_probe_status - notify userspace about probe status
7617 * @dev: the device the probe was sent on
7618 * @addr: the address of the peer
7619 * @cookie: the cookie filled in @probe_client previously
7620 * @acked: indicates whether probe was acked or not
7621 * @ack_signal: signal strength (in dBm) of the ACK frame.
7622 * @is_valid_ack_signal: indicates the ack_signal is valid or not.
7623 * @gfp: allocation flags
7625 void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7626 u64 cookie, bool acked, s32 ack_signal,
7627 bool is_valid_ack_signal, gfp_t gfp);
7630 * cfg80211_report_obss_beacon_khz - report beacon from other APs
7631 * @wiphy: The wiphy that received the beacon
7633 * @len: length of the frame
7634 * @freq: frequency the frame was received on in KHz
7635 * @sig_dbm: signal strength in dBm, or 0 if unknown
7637 * Use this function to report to userspace when a beacon was
7638 * received. It is not useful to call this when there is no
7639 * netdev that is in AP/GO mode.
7641 void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7642 size_t len, int freq, int sig_dbm);
7645 * cfg80211_report_obss_beacon - report beacon from other APs
7646 * @wiphy: The wiphy that received the beacon
7648 * @len: length of the frame
7649 * @freq: frequency the frame was received on
7650 * @sig_dbm: signal strength in dBm, or 0 if unknown
7652 * Use this function to report to userspace when a beacon was
7653 * received. It is not useful to call this when there is no
7654 * netdev that is in AP/GO mode.
7656 static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
7657 const u8 *frame, size_t len,
7658 int freq, int sig_dbm)
7660 cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7665 * cfg80211_reg_can_beacon - check if beaconing is allowed
7667 * @chandef: the channel definition
7668 * @iftype: interface type
7670 * Return: %true if there is no secondary channel or the secondary channel(s)
7671 * can be used for beaconing (i.e. is not a radar channel etc.)
7673 bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7674 struct cfg80211_chan_def *chandef,
7675 enum nl80211_iftype iftype);
7678 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7680 * @chandef: the channel definition
7681 * @iftype: interface type
7683 * Return: %true if there is no secondary channel or the secondary channel(s)
7684 * can be used for beaconing (i.e. is not a radar channel etc.). This version
7685 * also checks if IR-relaxation conditions apply, to allow beaconing under
7686 * more permissive conditions.
7688 * Requires the wiphy mutex to be held.
7690 bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7691 struct cfg80211_chan_def *chandef,
7692 enum nl80211_iftype iftype);
7695 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
7696 * @dev: the device which switched channels
7697 * @chandef: the new channel definition
7699 * Caller must acquire wdev_lock, therefore must only be called from sleepable
7702 void cfg80211_ch_switch_notify(struct net_device *dev,
7703 struct cfg80211_chan_def *chandef);
7706 * cfg80211_ch_switch_started_notify - notify channel switch start
7707 * @dev: the device on which the channel switch started
7708 * @chandef: the future channel definition
7709 * @count: the number of TBTTs until the channel switch happens
7710 * @quiet: whether or not immediate quiet was requested by the AP
7712 * Inform the userspace about the channel switch that has just
7713 * started, so that it can take appropriate actions (eg. starting
7714 * channel switch on other vifs), if necessary.
7716 void cfg80211_ch_switch_started_notify(struct net_device *dev,
7717 struct cfg80211_chan_def *chandef,
7718 u8 count, bool quiet);
7721 * ieee80211_operating_class_to_band - convert operating class to band
7723 * @operating_class: the operating class to convert
7724 * @band: band pointer to fill
7726 * Returns %true if the conversion was successful, %false otherwise.
7728 bool ieee80211_operating_class_to_band(u8 operating_class,
7729 enum nl80211_band *band);
7732 * ieee80211_chandef_to_operating_class - convert chandef to operation class
7734 * @chandef: the chandef to convert
7735 * @op_class: a pointer to the resulting operating class
7737 * Returns %true if the conversion was successful, %false otherwise.
7739 bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7743 * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7745 * @chandef: the chandef to convert
7747 * Returns the center frequency of chandef (1st segment) in KHz.
7750 ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7752 return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7756 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
7757 * @dev: the device on which the operation is requested
7758 * @peer: the MAC address of the peer device
7759 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
7760 * NL80211_TDLS_TEARDOWN)
7761 * @reason_code: the reason code for teardown request
7762 * @gfp: allocation flags
7764 * This function is used to request userspace to perform TDLS operation that
7765 * requires knowledge of keys, i.e., link setup or teardown when the AP
7766 * connection uses encryption. This is optional mechanism for the driver to use
7767 * if it can automatically determine when a TDLS link could be useful (e.g.,
7768 * based on traffic and signal strength for a peer).
7770 void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
7771 enum nl80211_tdls_operation oper,
7772 u16 reason_code, gfp_t gfp);
7775 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
7776 * @rate: given rate_info to calculate bitrate from
7778 * return 0 if MCS index >= 32
7780 u32 cfg80211_calculate_bitrate(struct rate_info *rate);
7783 * cfg80211_unregister_wdev - remove the given wdev
7784 * @wdev: struct wireless_dev to remove
7786 * This function removes the device so it can no longer be used. It is necessary
7787 * to call this function even when cfg80211 requests the removal of the device
7788 * by calling the del_virtual_intf() callback. The function must also be called
7789 * when the driver wishes to unregister the wdev, e.g. when the hardware device
7790 * is unbound from the driver.
7792 * Requires the RTNL and wiphy mutex to be held.
7794 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
7797 * cfg80211_register_netdevice - register the given netdev
7798 * @dev: the netdev to register
7800 * Note: In contexts coming from cfg80211 callbacks, you must call this rather
7801 * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
7802 * held. Otherwise, both register_netdevice() and register_netdev() are usable
7805 * Requires the RTNL and wiphy mutex to be held.
7807 int cfg80211_register_netdevice(struct net_device *dev);
7810 * cfg80211_unregister_netdevice - unregister the given netdev
7811 * @dev: the netdev to register
7813 * Note: In contexts coming from cfg80211 callbacks, you must call this rather
7814 * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
7815 * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
7816 * usable instead as well.
7818 * Requires the RTNL and wiphy mutex to be held.
7820 static inline void cfg80211_unregister_netdevice(struct net_device *dev)
7822 cfg80211_unregister_wdev(dev->ieee80211_ptr);
7826 * struct cfg80211_ft_event_params - FT Information Elements
7828 * @ies_len: length of the FT IE in bytes
7829 * @target_ap: target AP's MAC address
7831 * @ric_ies_len: length of the RIC IE in bytes
7833 struct cfg80211_ft_event_params {
7836 const u8 *target_ap;
7842 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7843 * @netdev: network device
7844 * @ft_event: IE information
7846 void cfg80211_ft_event(struct net_device *netdev,
7847 struct cfg80211_ft_event_params *ft_event);
7850 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
7851 * @ies: the input IE buffer
7852 * @len: the input length
7853 * @attr: the attribute ID to find
7854 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
7855 * if the function is only called to get the needed buffer size
7856 * @bufsize: size of the output buffer
7858 * The function finds a given P2P attribute in the (vendor) IEs and
7859 * copies its contents to the given buffer.
7861 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
7862 * malformed or the attribute can't be found (respectively), or the
7863 * length of the found attribute (which can be zero).
7865 int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7866 enum ieee80211_p2p_attr_id attr,
7867 u8 *buf, unsigned int bufsize);
7870 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
7871 * @ies: the IE buffer
7872 * @ielen: the length of the IE buffer
7873 * @ids: an array with element IDs that are allowed before
7874 * the split. A WLAN_EID_EXTENSION value means that the next
7875 * EID in the list is a sub-element of the EXTENSION IE.
7876 * @n_ids: the size of the element ID array
7877 * @after_ric: array IE types that come after the RIC element
7878 * @n_after_ric: size of the @after_ric array
7879 * @offset: offset where to start splitting in the buffer
7881 * This function splits an IE buffer by updating the @offset
7882 * variable to point to the location where the buffer should be
7885 * It assumes that the given IE buffer is well-formed, this
7886 * has to be guaranteed by the caller!
7888 * It also assumes that the IEs in the buffer are ordered
7889 * correctly, if not the result of using this function will not
7890 * be ordered correctly either, i.e. it does no reordering.
7892 * The function returns the offset where the next part of the
7893 * buffer starts, which may be @ielen if the entire (remainder)
7894 * of the buffer should be used.
7896 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
7897 const u8 *ids, int n_ids,
7898 const u8 *after_ric, int n_after_ric,
7902 * ieee80211_ie_split - split an IE buffer according to ordering
7903 * @ies: the IE buffer
7904 * @ielen: the length of the IE buffer
7905 * @ids: an array with element IDs that are allowed before
7906 * the split. A WLAN_EID_EXTENSION value means that the next
7907 * EID in the list is a sub-element of the EXTENSION IE.
7908 * @n_ids: the size of the element ID array
7909 * @offset: offset where to start splitting in the buffer
7911 * This function splits an IE buffer by updating the @offset
7912 * variable to point to the location where the buffer should be
7915 * It assumes that the given IE buffer is well-formed, this
7916 * has to be guaranteed by the caller!
7918 * It also assumes that the IEs in the buffer are ordered
7919 * correctly, if not the result of using this function will not
7920 * be ordered correctly either, i.e. it does no reordering.
7922 * The function returns the offset where the next part of the
7923 * buffer starts, which may be @ielen if the entire (remainder)
7924 * of the buffer should be used.
7926 static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
7927 const u8 *ids, int n_ids, size_t offset)
7929 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
7933 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7934 * @wdev: the wireless device reporting the wakeup
7935 * @wakeup: the wakeup report
7936 * @gfp: allocation flags
7938 * This function reports that the given device woke up. If it
7939 * caused the wakeup, report the reason(s), otherwise you may
7940 * pass %NULL as the @wakeup parameter to advertise that something
7941 * else caused the wakeup.
7943 void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7944 struct cfg80211_wowlan_wakeup *wakeup,
7948 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
7950 * @wdev: the wireless device for which critical protocol is stopped.
7951 * @gfp: allocation flags
7953 * This function can be called by the driver to indicate it has reverted
7954 * operation back to normal. One reason could be that the duration given
7955 * by .crit_proto_start() has expired.
7957 void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
7960 * ieee80211_get_num_supported_channels - get number of channels device has
7963 * Return: the number of channels supported by the device.
7965 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7968 * cfg80211_check_combinations - check interface combinations
7971 * @params: the interface combinations parameter
7973 * This function can be called by the driver to check whether a
7974 * combination of interfaces and their types are allowed according to
7975 * the interface combinations.
7977 int cfg80211_check_combinations(struct wiphy *wiphy,
7978 struct iface_combination_params *params);
7981 * cfg80211_iter_combinations - iterate over matching combinations
7984 * @params: the interface combinations parameter
7985 * @iter: function to call for each matching combination
7986 * @data: pointer to pass to iter function
7988 * This function can be called by the driver to check what possible
7989 * combinations it fits in at a given moment, e.g. for channel switching
7992 int cfg80211_iter_combinations(struct wiphy *wiphy,
7993 struct iface_combination_params *params,
7994 void (*iter)(const struct ieee80211_iface_combination *c,
7999 * cfg80211_stop_iface - trigger interface disconnection
8002 * @wdev: wireless device
8003 * @gfp: context flags
8005 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
8008 * Note: This doesn't need any locks and is asynchronous.
8010 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
8014 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
8015 * @wiphy: the wiphy to shut down
8017 * This function shuts down all interfaces belonging to this wiphy by
8018 * calling dev_close() (and treating non-netdev interfaces as needed).
8019 * It shouldn't really be used unless there are some fatal device errors
8020 * that really can't be recovered in any other way.
8022 * Callers must hold the RTNL and be able to deal with callbacks into
8023 * the driver while the function is running.
8025 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
8028 * wiphy_ext_feature_set - set the extended feature flag
8030 * @wiphy: the wiphy to modify.
8031 * @ftidx: extended feature bit index.
8033 * The extended features are flagged in multiple bytes (see
8034 * &struct wiphy.@ext_features)
8036 static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
8037 enum nl80211_ext_feature_index ftidx)
8041 ft_byte = &wiphy->ext_features[ftidx / 8];
8042 *ft_byte |= BIT(ftidx % 8);
8046 * wiphy_ext_feature_isset - check the extended feature flag
8048 * @wiphy: the wiphy to modify.
8049 * @ftidx: extended feature bit index.
8051 * The extended features are flagged in multiple bytes (see
8052 * &struct wiphy.@ext_features)
8055 wiphy_ext_feature_isset(struct wiphy *wiphy,
8056 enum nl80211_ext_feature_index ftidx)
8060 ft_byte = wiphy->ext_features[ftidx / 8];
8061 return (ft_byte & BIT(ftidx % 8)) != 0;
8065 * cfg80211_free_nan_func - free NAN function
8066 * @f: NAN function that should be freed
8068 * Frees all the NAN function and all it's allocated members.
8070 void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
8073 * struct cfg80211_nan_match_params - NAN match parameters
8074 * @type: the type of the function that triggered a match. If it is
8075 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
8076 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
8078 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
8079 * @inst_id: the local instance id
8080 * @peer_inst_id: the instance id of the peer's function
8081 * @addr: the MAC address of the peer
8082 * @info_len: the length of the &info
8083 * @info: the Service Specific Info from the peer (if any)
8084 * @cookie: unique identifier of the corresponding function
8086 struct cfg80211_nan_match_params {
8087 enum nl80211_nan_function_type type;
8097 * cfg80211_nan_match - report a match for a NAN function.
8098 * @wdev: the wireless device reporting the match
8099 * @match: match notification parameters
8100 * @gfp: allocation flags
8102 * This function reports that the a NAN function had a match. This
8103 * can be a subscribe that had a match or a solicited publish that
8104 * was sent. It can also be a follow up that was received.
8106 void cfg80211_nan_match(struct wireless_dev *wdev,
8107 struct cfg80211_nan_match_params *match, gfp_t gfp);
8110 * cfg80211_nan_func_terminated - notify about NAN function termination.
8112 * @wdev: the wireless device reporting the match
8113 * @inst_id: the local instance id
8114 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
8115 * @cookie: unique NAN function identifier
8116 * @gfp: allocation flags
8118 * This function reports that the a NAN function is terminated.
8120 void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
8122 enum nl80211_nan_func_term_reason reason,
8123 u64 cookie, gfp_t gfp);
8125 /* ethtool helper */
8126 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
8129 * cfg80211_external_auth_request - userspace request for authentication
8130 * @netdev: network device
8131 * @params: External authentication parameters
8132 * @gfp: allocation flags
8133 * Returns: 0 on success, < 0 on error
8135 int cfg80211_external_auth_request(struct net_device *netdev,
8136 struct cfg80211_external_auth_params *params,
8140 * cfg80211_pmsr_report - report peer measurement result data
8141 * @wdev: the wireless device reporting the measurement
8142 * @req: the original measurement request
8143 * @result: the result data
8144 * @gfp: allocation flags
8146 void cfg80211_pmsr_report(struct wireless_dev *wdev,
8147 struct cfg80211_pmsr_request *req,
8148 struct cfg80211_pmsr_result *result,
8152 * cfg80211_pmsr_complete - report peer measurement completed
8153 * @wdev: the wireless device reporting the measurement
8154 * @req: the original measurement request
8155 * @gfp: allocation flags
8157 * Report that the entire measurement completed, after this
8158 * the request pointer will no longer be valid.
8160 void cfg80211_pmsr_complete(struct wireless_dev *wdev,
8161 struct cfg80211_pmsr_request *req,
8165 * cfg80211_iftype_allowed - check whether the interface can be allowed
8167 * @iftype: interface type
8168 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
8169 * @check_swif: check iftype against software interfaces
8171 * Check whether the interface is allowed to operate; additionally, this API
8172 * can be used to check iftype against the software interfaces when
8173 * check_swif is '1'.
8175 bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
8176 bool is_4addr, u8 check_swif);
8179 /* Logging, debugging and troubleshooting/diagnostic helpers. */
8181 /* wiphy_printk helpers, similar to dev_printk */
8183 #define wiphy_printk(level, wiphy, format, args...) \
8184 dev_printk(level, &(wiphy)->dev, format, ##args)
8185 #define wiphy_emerg(wiphy, format, args...) \
8186 dev_emerg(&(wiphy)->dev, format, ##args)
8187 #define wiphy_alert(wiphy, format, args...) \
8188 dev_alert(&(wiphy)->dev, format, ##args)
8189 #define wiphy_crit(wiphy, format, args...) \
8190 dev_crit(&(wiphy)->dev, format, ##args)
8191 #define wiphy_err(wiphy, format, args...) \
8192 dev_err(&(wiphy)->dev, format, ##args)
8193 #define wiphy_warn(wiphy, format, args...) \
8194 dev_warn(&(wiphy)->dev, format, ##args)
8195 #define wiphy_notice(wiphy, format, args...) \
8196 dev_notice(&(wiphy)->dev, format, ##args)
8197 #define wiphy_info(wiphy, format, args...) \
8198 dev_info(&(wiphy)->dev, format, ##args)
8199 #define wiphy_info_once(wiphy, format, args...) \
8200 dev_info_once(&(wiphy)->dev, format, ##args)
8202 #define wiphy_err_ratelimited(wiphy, format, args...) \
8203 dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8204 #define wiphy_warn_ratelimited(wiphy, format, args...) \
8205 dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8207 #define wiphy_debug(wiphy, format, args...) \
8208 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
8210 #define wiphy_dbg(wiphy, format, args...) \
8211 dev_dbg(&(wiphy)->dev, format, ##args)
8213 #if defined(VERBOSE_DEBUG)
8214 #define wiphy_vdbg wiphy_dbg
8216 #define wiphy_vdbg(wiphy, format, args...) \
8219 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
8225 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8226 * of using a WARN/WARN_ON to get the message out, including the
8227 * file/line information and a backtrace.
8229 #define wiphy_WARN(wiphy, format, args...) \
8230 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8233 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8234 * @netdev: network device
8235 * @owe_info: peer's owe info
8236 * @gfp: allocation flags
8238 void cfg80211_update_owe_info_event(struct net_device *netdev,
8239 struct cfg80211_update_owe_info *owe_info,
8243 * cfg80211_bss_flush - resets all the scan entries
8246 void cfg80211_bss_flush(struct wiphy *wiphy);
8249 * cfg80211_bss_color_notify - notify about bss color event
8250 * @dev: network device
8251 * @gfp: allocation flags
8252 * @cmd: the actual event we want to notify
8253 * @count: the number of TBTTs until the color change happens
8254 * @color_bitmap: representations of the colors that the local BSS is aware of
8256 int cfg80211_bss_color_notify(struct net_device *dev, gfp_t gfp,
8257 enum nl80211_commands cmd, u8 count,
8261 * cfg80211_obss_color_collision_notify - notify about bss color collision
8262 * @dev: network device
8263 * @color_bitmap: representations of the colors that the local BSS is aware of
8265 static inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
8268 return cfg80211_bss_color_notify(dev, GFP_KERNEL,
8269 NL80211_CMD_OBSS_COLOR_COLLISION,
8274 * cfg80211_color_change_started_notify - notify color change start
8275 * @dev: the device on which the color is switched
8276 * @count: the number of TBTTs until the color change happens
8278 * Inform the userspace about the color change that has started.
8280 static inline int cfg80211_color_change_started_notify(struct net_device *dev,
8283 return cfg80211_bss_color_notify(dev, GFP_KERNEL,
8284 NL80211_CMD_COLOR_CHANGE_STARTED,
8289 * cfg80211_color_change_aborted_notify - notify color change abort
8290 * @dev: the device on which the color is switched
8292 * Inform the userspace about the color change that has aborted.
8294 static inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
8296 return cfg80211_bss_color_notify(dev, GFP_KERNEL,
8297 NL80211_CMD_COLOR_CHANGE_ABORTED,
8302 * cfg80211_color_change_notify - notify color change completion
8303 * @dev: the device on which the color was switched
8305 * Inform the userspace about the color change that has completed.
8307 static inline int cfg80211_color_change_notify(struct net_device *dev)
8309 return cfg80211_bss_color_notify(dev, GFP_KERNEL,
8310 NL80211_CMD_COLOR_CHANGE_COMPLETED,
8314 #endif /* __NET_CFG80211_H */