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-2020 Intel Corporation
13 #include <linux/netdevice.h>
14 #include <linux/debugfs.h>
15 #include <linux/list.h>
16 #include <linux/bug.h>
17 #include <linux/netlink.h>
18 #include <linux/skbuff.h>
19 #include <linux/nl80211.h>
20 #include <linux/if_ether.h>
21 #include <linux/ieee80211.h>
22 #include <linux/net.h>
23 #include <net/regulatory.h>
28 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
29 * userspace and drivers, and offers some utility functionality associated
30 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
31 * by all modern wireless drivers in Linux, so that they offer a consistent
32 * API through nl80211. For backward compatibility, cfg80211 also offers
33 * wireless extensions to userspace, but hides them from drivers completely.
35 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
41 * DOC: Device registration
43 * In order for a driver to use cfg80211, it must register the hardware device
44 * with cfg80211. This happens through a number of hardware capability structs
47 * The fundamental structure for each device is the 'wiphy', of which each
48 * instance describes a physical wireless device connected to the system. Each
49 * such wiphy can have zero, one, or many virtual interfaces associated with
50 * it, which need to be identified as such by pointing the network interface's
51 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
52 * the wireless part of the interface, normally this struct is embedded in the
53 * network interface's private data area. Drivers can optionally allow creating
54 * or destroying virtual interfaces on the fly, but without at least one or the
55 * ability to create some the wireless device isn't useful.
57 * Each wiphy structure contains device capability information, and also has
58 * a pointer to the various operations the driver offers. The definitions and
59 * structures here describe these capabilities in detail.
65 * wireless hardware capability structures
69 * enum ieee80211_channel_flags - channel flags
71 * Channel flags set by the regulatory control code.
73 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
74 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
75 * sending probe requests or beaconing.
76 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
77 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
79 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
81 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
82 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
83 * this flag indicates that an 80 MHz channel cannot use this
84 * channel as the control or any of the secondary channels.
85 * This may be due to the driver or due to regulatory bandwidth
87 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
88 * this flag indicates that an 160 MHz channel cannot use this
89 * channel as the control or any of the secondary channels.
90 * This may be due to the driver or due to regulatory bandwidth
92 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
93 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
94 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
96 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
98 * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
99 * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
101 * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
103 * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
105 * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
107 * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
111 enum ieee80211_channel_flags {
112 IEEE80211_CHAN_DISABLED = 1<<0,
113 IEEE80211_CHAN_NO_IR = 1<<1,
115 IEEE80211_CHAN_RADAR = 1<<3,
116 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
117 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
118 IEEE80211_CHAN_NO_OFDM = 1<<6,
119 IEEE80211_CHAN_NO_80MHZ = 1<<7,
120 IEEE80211_CHAN_NO_160MHZ = 1<<8,
121 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
122 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
123 IEEE80211_CHAN_NO_20MHZ = 1<<11,
124 IEEE80211_CHAN_NO_10MHZ = 1<<12,
125 IEEE80211_CHAN_NO_HE = 1<<13,
126 IEEE80211_CHAN_1MHZ = 1<<14,
127 IEEE80211_CHAN_2MHZ = 1<<15,
128 IEEE80211_CHAN_4MHZ = 1<<16,
129 IEEE80211_CHAN_8MHZ = 1<<17,
130 IEEE80211_CHAN_16MHZ = 1<<18,
133 #define IEEE80211_CHAN_NO_HT40 \
134 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
136 #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
137 #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
140 * struct ieee80211_channel - channel definition
142 * This structure describes a single channel for use
145 * @center_freq: center frequency in MHz
146 * @freq_offset: offset from @center_freq, in KHz
147 * @hw_value: hardware-specific value for the channel
148 * @flags: channel flags from &enum ieee80211_channel_flags.
149 * @orig_flags: channel flags at registration time, used by regulatory
150 * code to support devices with additional restrictions
151 * @band: band this channel belongs to.
152 * @max_antenna_gain: maximum antenna gain in dBi
153 * @max_power: maximum transmission power (in dBm)
154 * @max_reg_power: maximum regulatory transmission power (in dBm)
155 * @beacon_found: helper to regulatory code to indicate when a beacon
156 * has been found on this channel. Use regulatory_hint_found_beacon()
157 * to enable this, this is useful only on 5 GHz band.
158 * @orig_mag: internal use
159 * @orig_mpwr: internal use
160 * @dfs_state: current state of this channel. Only relevant if radar is required
162 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
163 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
165 struct ieee80211_channel {
166 enum nl80211_band band;
171 int max_antenna_gain;
176 int orig_mag, orig_mpwr;
177 enum nl80211_dfs_state dfs_state;
178 unsigned long dfs_state_entered;
179 unsigned int dfs_cac_ms;
183 * enum ieee80211_rate_flags - rate flags
185 * Hardware/specification flags for rates. These are structured
186 * in a way that allows using the same bitrate structure for
187 * different bands/PHY modes.
189 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
190 * preamble on this bitrate; only relevant in 2.4GHz band and
192 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
193 * when used with 802.11a (on the 5 GHz band); filled by the
194 * core code when registering the wiphy.
195 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
196 * when used with 802.11b (on the 2.4 GHz band); filled by the
197 * core code when registering the wiphy.
198 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
199 * when used with 802.11g (on the 2.4 GHz band); filled by the
200 * core code when registering the wiphy.
201 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
202 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
203 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
205 enum ieee80211_rate_flags {
206 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
207 IEEE80211_RATE_MANDATORY_A = 1<<1,
208 IEEE80211_RATE_MANDATORY_B = 1<<2,
209 IEEE80211_RATE_MANDATORY_G = 1<<3,
210 IEEE80211_RATE_ERP_G = 1<<4,
211 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
212 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
216 * enum ieee80211_bss_type - BSS type filter
218 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
219 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
220 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
221 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
222 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
224 enum ieee80211_bss_type {
225 IEEE80211_BSS_TYPE_ESS,
226 IEEE80211_BSS_TYPE_PBSS,
227 IEEE80211_BSS_TYPE_IBSS,
228 IEEE80211_BSS_TYPE_MBSS,
229 IEEE80211_BSS_TYPE_ANY
233 * enum ieee80211_privacy - BSS privacy filter
235 * @IEEE80211_PRIVACY_ON: privacy bit set
236 * @IEEE80211_PRIVACY_OFF: privacy bit clear
237 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
239 enum ieee80211_privacy {
240 IEEE80211_PRIVACY_ON,
241 IEEE80211_PRIVACY_OFF,
242 IEEE80211_PRIVACY_ANY
245 #define IEEE80211_PRIVACY(x) \
246 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
249 * struct ieee80211_rate - bitrate definition
251 * This structure describes a bitrate that an 802.11 PHY can
252 * operate with. The two values @hw_value and @hw_value_short
253 * are only for driver use when pointers to this structure are
256 * @flags: rate-specific flags
257 * @bitrate: bitrate in units of 100 Kbps
258 * @hw_value: driver/hardware value for this rate
259 * @hw_value_short: driver/hardware value for this rate when
260 * short preamble is used
262 struct ieee80211_rate {
265 u16 hw_value, hw_value_short;
269 * struct ieee80211_he_obss_pd - AP settings for spatial reuse
271 * @enable: is the feature enabled.
272 * @sr_ctrl: The SR Control field of SRP element.
273 * @non_srg_max_offset: non-SRG maximum tx power offset
274 * @min_offset: minimal tx power offset an associated station shall use
275 * @max_offset: maximum tx power offset an associated station shall use
276 * @bss_color_bitmap: bitmap that indicates the BSS color values used by
278 * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
279 * used by members of the SRG
281 struct ieee80211_he_obss_pd {
284 u8 non_srg_max_offset;
287 u8 bss_color_bitmap[8];
288 u8 partial_bssid_bitmap[8];
292 * struct cfg80211_he_bss_color - AP settings for BSS coloring
294 * @color: the current color.
295 * @enabled: HE BSS color is used
296 * @partial: define the AID equation.
298 struct cfg80211_he_bss_color {
305 * struct ieee80211_he_bss_color - AP settings for BSS coloring
307 * @color: the current color.
308 * @disabled: is the feature disabled.
309 * @partial: define the AID equation.
311 struct ieee80211_he_bss_color {
318 * struct ieee80211_sta_ht_cap - STA's HT capabilities
320 * This structure describes most essential parameters needed
321 * to describe 802.11n HT capabilities for an STA.
323 * @ht_supported: is HT supported by the STA
324 * @cap: HT capabilities map as described in 802.11n spec
325 * @ampdu_factor: Maximum A-MPDU length factor
326 * @ampdu_density: Minimum A-MPDU spacing
327 * @mcs: Supported MCS rates
329 struct ieee80211_sta_ht_cap {
330 u16 cap; /* use IEEE80211_HT_CAP_ */
334 struct ieee80211_mcs_info mcs;
338 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
340 * This structure describes most essential parameters needed
341 * to describe 802.11ac VHT capabilities for an STA.
343 * @vht_supported: is VHT supported by the STA
344 * @cap: VHT capabilities map as described in 802.11ac spec
345 * @vht_mcs: Supported VHT MCS rates
347 struct ieee80211_sta_vht_cap {
349 u32 cap; /* use IEEE80211_VHT_CAP_ */
350 struct ieee80211_vht_mcs_info vht_mcs;
353 #define IEEE80211_HE_PPE_THRES_MAX_LEN 25
356 * struct ieee80211_sta_he_cap - STA's HE capabilities
358 * This structure describes most essential parameters needed
359 * to describe 802.11ax HE capabilities for a STA.
361 * @has_he: true iff HE data is valid.
362 * @he_cap_elem: Fixed portion of the HE capabilities element.
363 * @he_mcs_nss_supp: The supported NSS/MCS combinations.
364 * @ppe_thres: Holds the PPE Thresholds data.
366 struct ieee80211_sta_he_cap {
368 struct ieee80211_he_cap_elem he_cap_elem;
369 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
370 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
374 * struct ieee80211_sband_iftype_data
376 * This structure encapsulates sband data that is relevant for the
377 * interface types defined in @types_mask. Each type in the
378 * @types_mask must be unique across all instances of iftype_data.
380 * @types_mask: interface types mask
381 * @he_cap: holds the HE capabilities
382 * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
383 * 6 GHz band channel (and 0 may be valid value).
385 struct ieee80211_sband_iftype_data {
387 struct ieee80211_sta_he_cap he_cap;
388 struct ieee80211_he_6ghz_capa he_6ghz_capa;
392 * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
394 * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
395 * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
396 * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
397 * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
398 * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
399 * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
400 * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
401 * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
403 * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
405 * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
407 * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
408 * and 4.32GHz + 4.32GHz
409 * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
410 * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
412 enum ieee80211_edmg_bw_config {
413 IEEE80211_EDMG_BW_CONFIG_4 = 4,
414 IEEE80211_EDMG_BW_CONFIG_5 = 5,
415 IEEE80211_EDMG_BW_CONFIG_6 = 6,
416 IEEE80211_EDMG_BW_CONFIG_7 = 7,
417 IEEE80211_EDMG_BW_CONFIG_8 = 8,
418 IEEE80211_EDMG_BW_CONFIG_9 = 9,
419 IEEE80211_EDMG_BW_CONFIG_10 = 10,
420 IEEE80211_EDMG_BW_CONFIG_11 = 11,
421 IEEE80211_EDMG_BW_CONFIG_12 = 12,
422 IEEE80211_EDMG_BW_CONFIG_13 = 13,
423 IEEE80211_EDMG_BW_CONFIG_14 = 14,
424 IEEE80211_EDMG_BW_CONFIG_15 = 15,
428 * struct ieee80211_edmg - EDMG configuration
430 * This structure describes most essential parameters needed
431 * to describe 802.11ay EDMG configuration
433 * @channels: bitmap that indicates the 2.16 GHz channel(s)
434 * that are allowed to be used for transmissions.
435 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
436 * Set to 0 indicate EDMG not supported.
437 * @bw_config: Channel BW Configuration subfield encodes
438 * the allowed channel bandwidth configurations
440 struct ieee80211_edmg {
442 enum ieee80211_edmg_bw_config bw_config;
446 * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
448 * This structure describes most essential parameters needed
449 * to describe 802.11ah S1G capabilities for a STA.
451 * @s1g_supported: is STA an S1G STA
452 * @cap: S1G capabilities information
453 * @nss_mcs: Supported NSS MCS set
455 struct ieee80211_sta_s1g_cap {
457 u8 cap[10]; /* use S1G_CAPAB_ */
462 * struct ieee80211_supported_band - frequency band definition
464 * This structure describes a frequency band a wiphy
465 * is able to operate in.
467 * @channels: Array of channels the hardware can operate with
469 * @band: the band this structure represents
470 * @n_channels: Number of channels in @channels
471 * @bitrates: Array of bitrates the hardware can operate with
472 * in this band. Must be sorted to give a valid "supported
473 * rates" IE, i.e. CCK rates first, then OFDM.
474 * @n_bitrates: Number of bitrates in @bitrates
475 * @ht_cap: HT capabilities in this band
476 * @vht_cap: VHT capabilities in this band
477 * @edmg_cap: EDMG capabilities in this band
478 * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
479 * @n_iftype_data: number of iftype data entries
480 * @iftype_data: interface type data entries. Note that the bits in
481 * @types_mask inside this structure cannot overlap (i.e. only
482 * one occurrence of each type is allowed across all instances of
485 struct ieee80211_supported_band {
486 struct ieee80211_channel *channels;
487 struct ieee80211_rate *bitrates;
488 enum nl80211_band band;
491 struct ieee80211_sta_ht_cap ht_cap;
492 struct ieee80211_sta_vht_cap vht_cap;
493 struct ieee80211_sta_s1g_cap s1g_cap;
494 struct ieee80211_edmg edmg_cap;
496 const struct ieee80211_sband_iftype_data *iftype_data;
500 * ieee80211_get_sband_iftype_data - return sband data for a given iftype
501 * @sband: the sband to search for the STA on
502 * @iftype: enum nl80211_iftype
504 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
506 static inline const struct ieee80211_sband_iftype_data *
507 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
512 if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
515 for (i = 0; i < sband->n_iftype_data; i++) {
516 const struct ieee80211_sband_iftype_data *data =
517 &sband->iftype_data[i];
519 if (data->types_mask & BIT(iftype))
527 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
528 * @sband: the sband to search for the iftype on
529 * @iftype: enum nl80211_iftype
531 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
533 static inline const struct ieee80211_sta_he_cap *
534 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
537 const struct ieee80211_sband_iftype_data *data =
538 ieee80211_get_sband_iftype_data(sband, iftype);
540 if (data && data->he_cap.has_he)
541 return &data->he_cap;
547 * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
548 * @sband: the sband to search for the STA on
550 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
552 static inline const struct ieee80211_sta_he_cap *
553 ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
555 return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
559 * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
560 * @sband: the sband to search for the STA on
561 * @iftype: the iftype to search for
563 * Return: the 6GHz capabilities
566 ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
567 enum nl80211_iftype iftype)
569 const struct ieee80211_sband_iftype_data *data =
570 ieee80211_get_sband_iftype_data(sband, iftype);
572 if (WARN_ON(!data || !data->he_cap.has_he))
575 return data->he_6ghz_capa.capa;
579 * wiphy_read_of_freq_limits - read frequency limits from device tree
581 * @wiphy: the wireless device to get extra limits for
583 * Some devices may have extra limitations specified in DT. This may be useful
584 * for chipsets that normally support more bands but are limited due to board
585 * design (e.g. by antennas or external power amplifier).
587 * This function reads info from DT and uses it to *modify* channels (disable
588 * unavailable ones). It's usually a *bad* idea to use it in drivers with
589 * shared channel data as DT limitations are device specific. You should make
590 * sure to call it only if channels in wiphy are copied and can be modified
591 * without affecting other devices.
593 * As this function access device node it has to be called after set_wiphy_dev.
594 * It also modifies channels so they have to be set first.
595 * If using this helper, call it before wiphy_register().
598 void wiphy_read_of_freq_limits(struct wiphy *wiphy);
599 #else /* CONFIG_OF */
600 static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
603 #endif /* !CONFIG_OF */
607 * Wireless hardware/device configuration structures and methods
611 * DOC: Actions and configuration
613 * Each wireless device and each virtual interface offer a set of configuration
614 * operations and other actions that are invoked by userspace. Each of these
615 * actions is described in the operations structure, and the parameters these
616 * operations use are described separately.
618 * Additionally, some operations are asynchronous and expect to get status
619 * information via some functions that drivers need to call.
621 * Scanning and BSS list handling with its associated functionality is described
622 * in a separate chapter.
625 #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
626 WLAN_USER_POSITION_LEN)
629 * struct vif_params - describes virtual interface parameters
630 * @flags: monitor interface flags, unchanged if 0, otherwise
631 * %MONITOR_FLAG_CHANGED will be set
632 * @use_4addr: use 4-address frames
633 * @macaddr: address to use for this virtual interface.
634 * If this parameter is set to zero address the driver may
635 * determine the address as needed.
636 * This feature is only fully supported by drivers that enable the
637 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
638 ** only p2p devices with specified MAC.
639 * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
640 * belonging to that MU-MIMO groupID; %NULL if not changed
641 * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
642 * MU-MIMO packets going to the specified station; %NULL if not changed
647 u8 macaddr[ETH_ALEN];
648 const u8 *vht_mumimo_groups;
649 const u8 *vht_mumimo_follow_addr;
653 * struct key_params - key information
655 * Information about a key
658 * @key_len: length of key material
659 * @cipher: cipher suite selector
660 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
661 * with the get_key() callback, must be in little endian,
662 * length given by @seq_len.
663 * @seq_len: length of @seq.
664 * @vlan_id: vlan_id for VLAN group key (if nonzero)
665 * @mode: key install mode (RX_TX, NO_TX or SET_TX)
674 enum nl80211_key_mode mode;
678 * struct cfg80211_chan_def - channel definition
679 * @chan: the (control) channel
680 * @width: channel width
681 * @center_freq1: center frequency of first segment
682 * @center_freq2: center frequency of second segment
683 * (only with 80+80 MHz)
684 * @edmg: define the EDMG channels configuration.
685 * If edmg is requested (i.e. the .channels member is non-zero),
686 * chan will define the primary channel and all other
687 * parameters are ignored.
688 * @freq1_offset: offset from @center_freq1, in KHz
690 struct cfg80211_chan_def {
691 struct ieee80211_channel *chan;
692 enum nl80211_chan_width width;
695 struct ieee80211_edmg edmg;
700 * cfg80211_bitrate_mask - masks for bitrate control
702 struct cfg80211_bitrate_mask {
705 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
706 u16 vht_mcs[NL80211_VHT_NSS_MAX];
707 u16 he_mcs[NL80211_HE_NSS_MAX];
708 enum nl80211_txrate_gi gi;
709 enum nl80211_he_gi he_gi;
710 enum nl80211_he_ltf he_ltf;
711 } control[NUM_NL80211_BANDS];
716 * struct cfg80211_tid_cfg - TID specific configuration
717 * @config_override: Flag to notify driver to reset TID configuration
719 * @tids: bitmap of TIDs to modify
720 * @mask: bitmap of attributes indicating which parameter changed,
721 * similar to &nl80211_tid_config_supp.
722 * @noack: noack configuration value for the TID
723 * @retry_long: retry count value
724 * @retry_short: retry count value
725 * @ampdu: Enable/Disable MPDU aggregation
726 * @rtscts: Enable/Disable RTS/CTS
727 * @amsdu: Enable/Disable MSDU aggregation
728 * @txrate_type: Tx bitrate mask type
729 * @txrate_mask: Tx bitrate to be applied for the TID
731 struct cfg80211_tid_cfg {
732 bool config_override;
735 enum nl80211_tid_config noack;
736 u8 retry_long, retry_short;
737 enum nl80211_tid_config ampdu;
738 enum nl80211_tid_config rtscts;
739 enum nl80211_tid_config amsdu;
740 enum nl80211_tx_rate_setting txrate_type;
741 struct cfg80211_bitrate_mask txrate_mask;
745 * struct cfg80211_tid_config - TID configuration
746 * @peer: Station's MAC address
747 * @n_tid_conf: Number of TID specific configurations to be applied
748 * @tid_conf: Configuration change info
750 struct cfg80211_tid_config {
753 struct cfg80211_tid_cfg tid_conf[];
757 * cfg80211_get_chandef_type - return old channel type from chandef
758 * @chandef: the channel definition
760 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
761 * chandef, which must have a bandwidth allowing this conversion.
763 static inline enum nl80211_channel_type
764 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
766 switch (chandef->width) {
767 case NL80211_CHAN_WIDTH_20_NOHT:
768 return NL80211_CHAN_NO_HT;
769 case NL80211_CHAN_WIDTH_20:
770 return NL80211_CHAN_HT20;
771 case NL80211_CHAN_WIDTH_40:
772 if (chandef->center_freq1 > chandef->chan->center_freq)
773 return NL80211_CHAN_HT40PLUS;
774 return NL80211_CHAN_HT40MINUS;
777 return NL80211_CHAN_NO_HT;
782 * cfg80211_chandef_create - create channel definition using channel type
783 * @chandef: the channel definition struct to fill
784 * @channel: the control channel
785 * @chantype: the channel type
787 * Given a channel type, create a channel definition.
789 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
790 struct ieee80211_channel *channel,
791 enum nl80211_channel_type chantype);
794 * cfg80211_chandef_identical - check if two channel definitions are identical
795 * @chandef1: first channel definition
796 * @chandef2: second channel definition
798 * Return: %true if the channels defined by the channel definitions are
799 * identical, %false otherwise.
802 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
803 const struct cfg80211_chan_def *chandef2)
805 return (chandef1->chan == chandef2->chan &&
806 chandef1->width == chandef2->width &&
807 chandef1->center_freq1 == chandef2->center_freq1 &&
808 chandef1->freq1_offset == chandef2->freq1_offset &&
809 chandef1->center_freq2 == chandef2->center_freq2);
813 * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
815 * @chandef: the channel definition
817 * Return: %true if EDMG defined, %false otherwise.
820 cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
822 return chandef->edmg.channels || chandef->edmg.bw_config;
826 * cfg80211_chandef_compatible - check if two channel definitions are compatible
827 * @chandef1: first channel definition
828 * @chandef2: second channel definition
830 * Return: %NULL if the given channel definitions are incompatible,
831 * chandef1 or chandef2 otherwise.
833 const struct cfg80211_chan_def *
834 cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
835 const struct cfg80211_chan_def *chandef2);
838 * cfg80211_chandef_valid - check if a channel definition is valid
839 * @chandef: the channel definition to check
840 * Return: %true if the channel definition is valid. %false otherwise.
842 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
845 * cfg80211_chandef_usable - check if secondary channels can be used
846 * @wiphy: the wiphy to validate against
847 * @chandef: the channel definition to check
848 * @prohibited_flags: the regulatory channel flags that must not be set
849 * Return: %true if secondary channels are usable. %false otherwise.
851 bool cfg80211_chandef_usable(struct wiphy *wiphy,
852 const struct cfg80211_chan_def *chandef,
853 u32 prohibited_flags);
856 * cfg80211_chandef_dfs_required - checks if radar detection is required
857 * @wiphy: the wiphy to validate against
858 * @chandef: the channel definition to check
859 * @iftype: the interface type as specified in &enum nl80211_iftype
861 * 1 if radar detection is required, 0 if it is not, < 0 on error
863 int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
864 const struct cfg80211_chan_def *chandef,
865 enum nl80211_iftype iftype);
868 * ieee80211_chandef_rate_flags - returns rate flags for a channel
870 * In some channel types, not all rates may be used - for example CCK
871 * rates may not be used in 5/10 MHz channels.
873 * @chandef: channel definition for the channel
875 * Returns: rate flags which apply for this channel
877 static inline enum ieee80211_rate_flags
878 ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
880 switch (chandef->width) {
881 case NL80211_CHAN_WIDTH_5:
882 return IEEE80211_RATE_SUPPORTS_5MHZ;
883 case NL80211_CHAN_WIDTH_10:
884 return IEEE80211_RATE_SUPPORTS_10MHZ;
892 * ieee80211_chandef_max_power - maximum transmission power for the chandef
894 * In some regulations, the transmit power may depend on the configured channel
895 * bandwidth which may be defined as dBm/MHz. This function returns the actual
896 * max_power for non-standard (20 MHz) channels.
898 * @chandef: channel definition for the channel
900 * Returns: maximum allowed transmission power in dBm for the chandef
903 ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
905 switch (chandef->width) {
906 case NL80211_CHAN_WIDTH_5:
907 return min(chandef->chan->max_reg_power - 6,
908 chandef->chan->max_power);
909 case NL80211_CHAN_WIDTH_10:
910 return min(chandef->chan->max_reg_power - 3,
911 chandef->chan->max_power);
915 return chandef->chan->max_power;
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)
1011 struct cfg80211_crypto_settings {
1014 int n_ciphers_pairwise;
1015 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
1017 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
1019 __be16 control_port_ethertype;
1020 bool control_port_no_encrypt;
1021 bool control_port_over_nl80211;
1022 bool control_port_no_preauth;
1023 struct key_params *wep_keys;
1031 * struct cfg80211_beacon_data - beacon data
1032 * @head: head portion of beacon (before TIM IE)
1033 * or %NULL if not changed
1034 * @tail: tail portion of beacon (after TIM IE)
1035 * or %NULL if not changed
1036 * @head_len: length of @head
1037 * @tail_len: length of @tail
1038 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
1039 * @beacon_ies_len: length of beacon_ies in octets
1040 * @proberesp_ies: extra information element(s) to add into Probe Response
1042 * @proberesp_ies_len: length of proberesp_ies in octets
1043 * @assocresp_ies: extra information element(s) to add into (Re)Association
1044 * Response frames or %NULL
1045 * @assocresp_ies_len: length of assocresp_ies in octets
1046 * @probe_resp_len: length of probe response template (@probe_resp)
1047 * @probe_resp: probe response template (AP mode only)
1048 * @ftm_responder: enable FTM responder functionality; -1 for no change
1049 * (which also implies no change in LCI/civic location data)
1050 * @lci: Measurement Report element content, starting with Measurement Token
1051 * (measurement type 8)
1052 * @civicloc: Measurement Report element content, starting with Measurement
1053 * Token (measurement type 11)
1054 * @lci_len: LCI data length
1055 * @civicloc_len: Civic location data length
1057 struct cfg80211_beacon_data {
1058 const u8 *head, *tail;
1059 const u8 *beacon_ies;
1060 const u8 *proberesp_ies;
1061 const u8 *assocresp_ies;
1062 const u8 *probe_resp;
1067 size_t head_len, tail_len;
1068 size_t beacon_ies_len;
1069 size_t proberesp_ies_len;
1070 size_t assocresp_ies_len;
1071 size_t probe_resp_len;
1073 size_t civicloc_len;
1076 struct mac_address {
1081 * struct cfg80211_acl_data - Access control list data
1083 * @acl_policy: ACL policy to be applied on the station's
1084 * entry specified by mac_addr
1085 * @n_acl_entries: Number of MAC address entries passed
1086 * @mac_addrs: List of MAC addresses of stations to be used for ACL
1088 struct cfg80211_acl_data {
1089 enum nl80211_acl_policy acl_policy;
1093 struct mac_address mac_addrs[];
1097 * struct cfg80211_fils_discovery - FILS discovery parameters from
1098 * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1100 * @min_interval: Minimum packet interval in TUs (0 - 10000)
1101 * @max_interval: Maximum packet interval in TUs (0 - 10000)
1102 * @tmpl_len: Template length
1103 * @tmpl: Template data for FILS discovery frame including the action
1106 struct cfg80211_fils_discovery {
1114 * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
1115 * response parameters in 6GHz.
1117 * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
1118 * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
1120 * @tmpl_len: Template length
1121 * @tmpl: Template data for probe response
1123 struct cfg80211_unsol_bcast_probe_resp {
1130 * enum cfg80211_ap_settings_flags - AP settings flags
1132 * Used by cfg80211_ap_settings
1134 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1136 enum cfg80211_ap_settings_flags {
1137 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1141 * struct cfg80211_ap_settings - AP configuration
1143 * Used to configure an AP interface.
1145 * @chandef: defines the channel to use
1146 * @beacon: beacon data
1147 * @beacon_interval: beacon interval
1148 * @dtim_period: DTIM period
1149 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
1151 * @ssid_len: length of @ssid
1152 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
1153 * @crypto: crypto settings
1154 * @privacy: the BSS uses privacy
1155 * @auth_type: Authentication type (algorithm)
1156 * @smps_mode: SMPS mode
1157 * @inactivity_timeout: time in seconds to determine station's inactivity.
1158 * @p2p_ctwindow: P2P CT Window
1159 * @p2p_opp_ps: P2P opportunistic PS
1160 * @acl: ACL configuration used by the drivers which has support for
1161 * MAC address based access control
1162 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
1164 * @beacon_rate: bitrate to be used for beacons
1165 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
1166 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1167 * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
1168 * @ht_required: stations must support HT
1169 * @vht_required: stations must support VHT
1170 * @twt_responder: Enable Target Wait Time
1171 * @he_required: stations must support HE
1172 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1173 * @he_obss_pd: OBSS Packet Detection settings
1174 * @he_bss_color: BSS Color settings
1175 * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1176 * @fils_discovery: FILS discovery transmission parameters
1177 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1179 struct cfg80211_ap_settings {
1180 struct cfg80211_chan_def chandef;
1182 struct cfg80211_beacon_data beacon;
1184 int beacon_interval, dtim_period;
1187 enum nl80211_hidden_ssid hidden_ssid;
1188 struct cfg80211_crypto_settings crypto;
1190 enum nl80211_auth_type auth_type;
1191 enum nl80211_smps_mode smps_mode;
1192 int inactivity_timeout;
1195 const struct cfg80211_acl_data *acl;
1197 struct cfg80211_bitrate_mask beacon_rate;
1199 const struct ieee80211_ht_cap *ht_cap;
1200 const struct ieee80211_vht_cap *vht_cap;
1201 const struct ieee80211_he_cap_elem *he_cap;
1202 const struct ieee80211_he_operation *he_oper;
1203 bool ht_required, vht_required, he_required;
1206 struct ieee80211_he_obss_pd he_obss_pd;
1207 struct cfg80211_he_bss_color he_bss_color;
1208 struct cfg80211_fils_discovery fils_discovery;
1209 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1213 * struct cfg80211_csa_settings - channel switch settings
1215 * Used for channel switch
1217 * @chandef: defines the channel to use after the switch
1218 * @beacon_csa: beacon data while performing the switch
1219 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
1220 * @counter_offsets_presp: offsets of the counters within the probe response
1221 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
1222 * @n_counter_offsets_presp: number of csa counters in the probe response
1223 * @beacon_after: beacon data to be used on the new channel
1224 * @radar_required: whether radar detection is required on the new channel
1225 * @block_tx: whether transmissions should be blocked while changing
1226 * @count: number of beacons until switch
1228 struct cfg80211_csa_settings {
1229 struct cfg80211_chan_def chandef;
1230 struct cfg80211_beacon_data beacon_csa;
1231 const u16 *counter_offsets_beacon;
1232 const u16 *counter_offsets_presp;
1233 unsigned int n_counter_offsets_beacon;
1234 unsigned int n_counter_offsets_presp;
1235 struct cfg80211_beacon_data beacon_after;
1236 bool radar_required;
1241 #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
1244 * struct iface_combination_params - input parameters for interface combinations
1246 * Used to pass interface combination parameters
1248 * @num_different_channels: the number of different channels we want
1249 * to use for verification
1250 * @radar_detect: a bitmap where each bit corresponds to a channel
1251 * width where radar detection is needed, as in the definition of
1252 * &struct ieee80211_iface_combination.@radar_detect_widths
1253 * @iftype_num: array with the number of interfaces of each interface
1254 * type. The index is the interface type as specified in &enum
1256 * @new_beacon_int: set this to the beacon interval of a new interface
1257 * that's not operating yet, if such is to be checked as part of
1260 struct iface_combination_params {
1261 int num_different_channels;
1263 int iftype_num[NUM_NL80211_IFTYPES];
1268 * enum station_parameters_apply_mask - station parameter values to apply
1269 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
1270 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1271 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
1273 * Not all station parameters have in-band "no change" signalling,
1274 * for those that don't these flags will are used.
1276 enum station_parameters_apply_mask {
1277 STATION_PARAM_APPLY_UAPSD = BIT(0),
1278 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1279 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1280 STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1284 * struct sta_txpwr - station txpower configuration
1286 * Used to configure txpower for station.
1288 * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1289 * is not provided, the default per-interface tx power setting will be
1290 * overriding. Driver should be picking up the lowest tx power, either tx
1291 * power per-interface or per-station.
1292 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1293 * will be less than or equal to specified from userspace, whereas if TPC
1294 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1295 * NL80211_TX_POWER_FIXED is not a valid configuration option for
1300 enum nl80211_tx_power_setting type;
1304 * struct station_parameters - station parameters
1306 * Used to change and create a new station.
1308 * @vlan: vlan interface station should belong to
1309 * @supported_rates: supported rates in IEEE 802.11 format
1310 * (or NULL for no change)
1311 * @supported_rates_len: number of supported rates
1312 * @sta_flags_mask: station flags that changed
1313 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1314 * @sta_flags_set: station flags values
1315 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1316 * @listen_interval: listen interval or -1 for no change
1317 * @aid: AID or zero for no change
1318 * @vlan_id: VLAN ID for station (if nonzero)
1319 * @peer_aid: mesh peer AID or zero for no change
1320 * @plink_action: plink action to take
1321 * @plink_state: set the peer link state for a station
1322 * @ht_capa: HT capabilities of station
1323 * @vht_capa: VHT capabilities of station
1324 * @uapsd_queues: bitmap of queues configured for uapsd. same format
1325 * as the AC bitmap in the QoS info field
1326 * @max_sp: max Service Period. same format as the MAX_SP in the
1327 * QoS info field (but already shifted down)
1328 * @sta_modify_mask: bitmap indicating which parameters changed
1329 * (for those that don't have a natural "no change" value),
1330 * see &enum station_parameters_apply_mask
1331 * @local_pm: local link-specific mesh power save mode (no change when set
1333 * @capability: station capability
1334 * @ext_capab: extended capabilities of the station
1335 * @ext_capab_len: number of extended capabilities
1336 * @supported_channels: supported channels in IEEE 802.11 format
1337 * @supported_channels_len: number of supported channels
1338 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1339 * @supported_oper_classes_len: number of supported operating classes
1340 * @opmode_notif: operating mode field from Operating Mode Notification
1341 * @opmode_notif_used: information if operating mode field is used
1342 * @support_p2p_ps: information if station supports P2P PS mechanism
1343 * @he_capa: HE capabilities of station
1344 * @he_capa_len: the length of the HE capabilities
1345 * @airtime_weight: airtime scheduler weight for this station
1346 * @txpwr: transmit power for an associated station
1347 * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1349 struct station_parameters {
1350 const u8 *supported_rates;
1351 struct net_device *vlan;
1352 u32 sta_flags_mask, sta_flags_set;
1353 u32 sta_modify_mask;
1354 int listen_interval;
1358 u8 supported_rates_len;
1361 const struct ieee80211_ht_cap *ht_capa;
1362 const struct ieee80211_vht_cap *vht_capa;
1365 enum nl80211_mesh_power_mode local_pm;
1367 const u8 *ext_capab;
1369 const u8 *supported_channels;
1370 u8 supported_channels_len;
1371 const u8 *supported_oper_classes;
1372 u8 supported_oper_classes_len;
1374 bool opmode_notif_used;
1376 const struct ieee80211_he_cap_elem *he_capa;
1379 struct sta_txpwr txpwr;
1380 const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1384 * struct station_del_parameters - station deletion parameters
1386 * Used to delete a station entry (or all stations).
1388 * @mac: MAC address of the station to remove or NULL to remove all stations
1389 * @subtype: Management frame subtype to use for indicating removal
1390 * (10 = Disassociation, 12 = Deauthentication)
1391 * @reason_code: Reason code for the Disassociation/Deauthentication frame
1393 struct station_del_parameters {
1400 * enum cfg80211_station_type - the type of station being modified
1401 * @CFG80211_STA_AP_CLIENT: client of an AP interface
1402 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
1403 * unassociated (update properties for this type of client is permitted)
1404 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
1405 * the AP MLME in the device
1406 * @CFG80211_STA_AP_STA: AP station on managed interface
1407 * @CFG80211_STA_IBSS: IBSS station
1408 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
1409 * while TDLS setup is in progress, it moves out of this state when
1410 * being marked authorized; use this only if TDLS with external setup is
1412 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
1413 * entry that is operating, has been marked authorized by userspace)
1414 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1415 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
1417 enum cfg80211_station_type {
1418 CFG80211_STA_AP_CLIENT,
1419 CFG80211_STA_AP_CLIENT_UNASSOC,
1420 CFG80211_STA_AP_MLME_CLIENT,
1421 CFG80211_STA_AP_STA,
1423 CFG80211_STA_TDLS_PEER_SETUP,
1424 CFG80211_STA_TDLS_PEER_ACTIVE,
1425 CFG80211_STA_MESH_PEER_KERNEL,
1426 CFG80211_STA_MESH_PEER_USER,
1430 * cfg80211_check_station_change - validate parameter changes
1431 * @wiphy: the wiphy this operates on
1432 * @params: the new parameters for a station
1433 * @statype: the type of station being modified
1435 * Utility function for the @change_station driver method. Call this function
1436 * with the appropriate station type looking up the station (and checking that
1437 * it exists). It will verify whether the station change is acceptable, and if
1438 * not will return an error code. Note that it may modify the parameters for
1439 * backward compatibility reasons, so don't use them before calling this.
1441 int cfg80211_check_station_change(struct wiphy *wiphy,
1442 struct station_parameters *params,
1443 enum cfg80211_station_type statype);
1446 * enum station_info_rate_flags - bitrate info flags
1448 * Used by the driver to indicate the specific rate transmission
1449 * type for 802.11n transmissions.
1451 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1452 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1453 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
1454 * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1455 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
1456 * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1458 enum rate_info_flags {
1459 RATE_INFO_FLAGS_MCS = BIT(0),
1460 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
1461 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
1462 RATE_INFO_FLAGS_DMG = BIT(3),
1463 RATE_INFO_FLAGS_HE_MCS = BIT(4),
1464 RATE_INFO_FLAGS_EDMG = BIT(5),
1468 * enum rate_info_bw - rate bandwidth information
1470 * Used by the driver to indicate the rate bandwidth.
1472 * @RATE_INFO_BW_5: 5 MHz bandwidth
1473 * @RATE_INFO_BW_10: 10 MHz bandwidth
1474 * @RATE_INFO_BW_20: 20 MHz bandwidth
1475 * @RATE_INFO_BW_40: 40 MHz bandwidth
1476 * @RATE_INFO_BW_80: 80 MHz bandwidth
1477 * @RATE_INFO_BW_160: 160 MHz bandwidth
1478 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1481 RATE_INFO_BW_20 = 0,
1491 * struct rate_info - bitrate information
1493 * Information about a receiving or transmitting bitrate
1495 * @flags: bitflag of flags from &enum rate_info_flags
1496 * @mcs: mcs index if struct describes an HT/VHT/HE rate
1497 * @legacy: bitrate in 100kbit/s for 802.11abg
1498 * @nss: number of streams (VHT & HE only)
1499 * @bw: bandwidth (from &enum rate_info_bw)
1500 * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1501 * @he_dcm: HE DCM value
1502 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1503 * only valid if bw is %RATE_INFO_BW_HE_RU)
1504 * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1519 * enum station_info_rate_flags - bitrate info flags
1521 * Used by the driver to indicate the specific rate transmission
1522 * type for 802.11n transmissions.
1524 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1525 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1526 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1528 enum bss_param_flags {
1529 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1530 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1531 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1535 * struct sta_bss_parameters - BSS parameters for the attached station
1537 * Information about the currently associated BSS
1539 * @flags: bitflag of flags from &enum bss_param_flags
1540 * @dtim_period: DTIM period for the BSS
1541 * @beacon_interval: beacon interval
1543 struct sta_bss_parameters {
1546 u16 beacon_interval;
1550 * struct cfg80211_txq_stats - TXQ statistics for this TID
1551 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1552 * indicate the relevant values in this struct are filled
1553 * @backlog_bytes: total number of bytes currently backlogged
1554 * @backlog_packets: total number of packets currently backlogged
1555 * @flows: number of new flows seen
1556 * @drops: total number of packets dropped
1557 * @ecn_marks: total number of packets marked with ECN CE
1558 * @overlimit: number of drops due to queue space overflow
1559 * @overmemory: number of drops due to memory limit overflow
1560 * @collisions: number of hash collisions
1561 * @tx_bytes: total number of bytes dequeued
1562 * @tx_packets: total number of packets dequeued
1563 * @max_flows: maximum number of flows supported
1565 struct cfg80211_txq_stats {
1568 u32 backlog_packets;
1581 * struct cfg80211_tid_stats - per-TID statistics
1582 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1583 * indicate the relevant values in this struct are filled
1584 * @rx_msdu: number of received MSDUs
1585 * @tx_msdu: number of (attempted) transmitted MSDUs
1586 * @tx_msdu_retries: number of retries (not counting the first) for
1588 * @tx_msdu_failed: number of failed transmitted MSDUs
1589 * @txq_stats: TXQ statistics
1591 struct cfg80211_tid_stats {
1595 u64 tx_msdu_retries;
1597 struct cfg80211_txq_stats txq_stats;
1600 #define IEEE80211_MAX_CHAINS 4
1603 * struct station_info - station information
1605 * Station information filled by driver for get_station() and dump_station.
1607 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1608 * indicate the relevant values in this struct for them
1609 * @connected_time: time(in secs) since a station is last connected
1610 * @inactive_time: time since last station activity (tx/rx) in milliseconds
1611 * @assoc_at: bootime (ns) of the last association
1612 * @rx_bytes: bytes (size of MPDUs) received from this station
1613 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
1614 * @llid: mesh local link id
1615 * @plid: mesh peer link id
1616 * @plink_state: mesh peer link state
1617 * @signal: The signal strength, type depends on the wiphy's signal_type.
1618 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1619 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1620 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1621 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1622 * @chain_signal: per-chain signal strength of last received packet in dBm
1623 * @chain_signal_avg: per-chain signal strength average in dBm
1624 * @txrate: current unicast bitrate from this station
1625 * @rxrate: current unicast bitrate to this station
1626 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1627 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1628 * @tx_retries: cumulative retry counts (MPDUs)
1629 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
1630 * @rx_dropped_misc: Dropped for un-specified reason.
1631 * @bss_param: current BSS parameters
1632 * @generation: generation number for nl80211 dumps.
1633 * This number should increase every time the list of stations
1634 * changes, i.e. when a station is added or removed, so that
1635 * userspace can tell whether it got a consistent snapshot.
1636 * @assoc_req_ies: IEs from (Re)Association Request.
1637 * This is used only when in AP mode with drivers that do not use
1638 * user space MLME/SME implementation. The information is provided for
1639 * the cfg80211_new_sta() calls to notify user space of the IEs.
1640 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1641 * @sta_flags: station flags mask & values
1642 * @beacon_loss_count: Number of times beacon loss event has triggered.
1643 * @t_offset: Time offset of the station relative to this host.
1644 * @local_pm: local mesh STA power save mode
1645 * @peer_pm: peer mesh STA power save mode
1646 * @nonpeer_pm: non-peer mesh STA power save mode
1647 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1648 * towards this station.
1649 * @rx_beacon: number of beacons received from this peer
1650 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1652 * @connected_to_gate: true if mesh STA has a path to mesh gate
1653 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
1654 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
1655 * @airtime_weight: current airtime scheduling weight
1656 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1657 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1658 * Note that this doesn't use the @filled bit, but is used if non-NULL.
1659 * @ack_signal: signal strength (in dBm) of the last ACK frame.
1660 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1662 * @rx_mpdu_count: number of MPDUs received from this station
1663 * @fcs_err_count: number of packets (MPDUs) received from this station with
1664 * an FCS error. This counter should be incremented only when TA of the
1665 * received packet with an FCS error matches the peer MAC address.
1666 * @airtime_link_metric: mesh airtime link metric.
1667 * @connected_to_as: true if mesh STA has a path to authentication server
1669 struct station_info {
1683 s8 chain_signal[IEEE80211_MAX_CHAINS];
1684 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1686 struct rate_info txrate;
1687 struct rate_info rxrate;
1692 u32 rx_dropped_misc;
1693 struct sta_bss_parameters bss_param;
1694 struct nl80211_sta_flag_update sta_flags;
1698 const u8 *assoc_req_ies;
1699 size_t assoc_req_ies_len;
1701 u32 beacon_loss_count;
1703 enum nl80211_mesh_power_mode local_pm;
1704 enum nl80211_mesh_power_mode peer_pm;
1705 enum nl80211_mesh_power_mode nonpeer_pm;
1707 u32 expected_throughput;
1712 u8 rx_beacon_signal_avg;
1713 u8 connected_to_gate;
1715 struct cfg80211_tid_stats *pertid;
1724 u32 airtime_link_metric;
1729 #if IS_ENABLED(CONFIG_CFG80211)
1731 * cfg80211_get_station - retrieve information about a given station
1732 * @dev: the device where the station is supposed to be connected to
1733 * @mac_addr: the mac address of the station of interest
1734 * @sinfo: pointer to the structure to fill with the information
1736 * Returns 0 on success and sinfo is filled with the available information
1737 * otherwise returns a negative error code and the content of sinfo has to be
1738 * considered undefined.
1740 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1741 struct station_info *sinfo);
1743 static inline int cfg80211_get_station(struct net_device *dev,
1745 struct station_info *sinfo)
1752 * enum monitor_flags - monitor flags
1754 * Monitor interface configuration flags. Note that these must be the bits
1755 * according to the nl80211 flags.
1757 * @MONITOR_FLAG_CHANGED: set if the flags were changed
1758 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1759 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1760 * @MONITOR_FLAG_CONTROL: pass control frames
1761 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1762 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1763 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
1765 enum monitor_flags {
1766 MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
1767 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1768 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1769 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1770 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1771 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1772 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
1776 * enum mpath_info_flags - mesh path information flags
1778 * Used by the driver to indicate which info in &struct mpath_info it has filled
1779 * in during get_station() or dump_station().
1781 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1782 * @MPATH_INFO_SN: @sn filled
1783 * @MPATH_INFO_METRIC: @metric filled
1784 * @MPATH_INFO_EXPTIME: @exptime filled
1785 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1786 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1787 * @MPATH_INFO_FLAGS: @flags filled
1788 * @MPATH_INFO_HOP_COUNT: @hop_count filled
1789 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
1791 enum mpath_info_flags {
1792 MPATH_INFO_FRAME_QLEN = BIT(0),
1793 MPATH_INFO_SN = BIT(1),
1794 MPATH_INFO_METRIC = BIT(2),
1795 MPATH_INFO_EXPTIME = BIT(3),
1796 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1797 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1798 MPATH_INFO_FLAGS = BIT(6),
1799 MPATH_INFO_HOP_COUNT = BIT(7),
1800 MPATH_INFO_PATH_CHANGE = BIT(8),
1804 * struct mpath_info - mesh path information
1806 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1808 * @filled: bitfield of flags from &enum mpath_info_flags
1809 * @frame_qlen: number of queued frames for this destination
1810 * @sn: target sequence number
1811 * @metric: metric (cost) of this mesh path
1812 * @exptime: expiration time for the mesh path from now, in msecs
1813 * @flags: mesh path flags
1814 * @discovery_timeout: total mesh path discovery timeout, in msecs
1815 * @discovery_retries: mesh path discovery retries
1816 * @generation: generation number for nl80211 dumps.
1817 * This number should increase every time the list of mesh paths
1818 * changes, i.e. when a station is added or removed, so that
1819 * userspace can tell whether it got a consistent snapshot.
1820 * @hop_count: hops to destination
1821 * @path_change_count: total number of path changes to destination
1829 u32 discovery_timeout;
1830 u8 discovery_retries;
1833 u32 path_change_count;
1839 * struct bss_parameters - BSS parameters
1841 * Used to change BSS parameters (mainly for AP mode).
1843 * @use_cts_prot: Whether to use CTS protection
1844 * (0 = no, 1 = yes, -1 = do not change)
1845 * @use_short_preamble: Whether the use of short preambles is allowed
1846 * (0 = no, 1 = yes, -1 = do not change)
1847 * @use_short_slot_time: Whether the use of short slot time is allowed
1848 * (0 = no, 1 = yes, -1 = do not change)
1849 * @basic_rates: basic rates in IEEE 802.11 format
1850 * (or NULL for no change)
1851 * @basic_rates_len: number of basic rates
1852 * @ap_isolate: do not forward packets between connected stations
1853 * (0 = no, 1 = yes, -1 = do not change)
1854 * @ht_opmode: HT Operation mode
1855 * (u16 = opmode, -1 = do not change)
1856 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1857 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
1859 struct bss_parameters {
1861 int use_short_preamble;
1862 int use_short_slot_time;
1863 const u8 *basic_rates;
1867 s8 p2p_ctwindow, p2p_opp_ps;
1871 * struct mesh_config - 802.11s mesh configuration
1873 * These parameters can be changed while the mesh is active.
1875 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1876 * by the Mesh Peering Open message
1877 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1878 * used by the Mesh Peering Open message
1879 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1880 * the mesh peering management to close a mesh peering
1881 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1883 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1884 * be sent to establish a new peer link instance in a mesh
1885 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1886 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1888 * @auto_open_plinks: whether we should automatically open peer links when we
1889 * detect compatible mesh peers
1890 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1891 * synchronize to for 11s default synchronization method
1892 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1893 * that an originator mesh STA can send to a particular path target
1894 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1895 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1896 * a path discovery in milliseconds
1897 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1898 * receiving a PREQ shall consider the forwarding information from the
1899 * root to be valid. (TU = time unit)
1900 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1901 * which a mesh STA can send only one action frame containing a PREQ
1903 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1904 * which a mesh STA can send only one Action frame containing a PERR
1906 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1907 * it takes for an HWMP information element to propagate across the mesh
1908 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1909 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1910 * announcements are transmitted
1911 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1912 * station has access to a broader network beyond the MBSS. (This is
1913 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1914 * only means that the station will announce others it's a mesh gate, but
1915 * not necessarily using the gate announcement protocol. Still keeping the
1916 * same nomenclature to be in sync with the spec)
1917 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1918 * entity (default is TRUE - forwarding entity)
1919 * @rssi_threshold: the threshold for average signal strength of candidate
1920 * station to establish a peer link
1921 * @ht_opmode: mesh HT protection mode
1923 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1924 * receiving a proactive PREQ shall consider the forwarding information to
1925 * the root mesh STA to be valid.
1927 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1928 * PREQs are transmitted.
1929 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1930 * during which a mesh STA can send only one Action frame containing
1931 * a PREQ element for root path confirmation.
1932 * @power_mode: The default mesh power save mode which will be the initial
1933 * setting for new peer links.
1934 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1935 * after transmitting its beacon.
1936 * @plink_timeout: If no tx activity is seen from a STA we've established
1937 * peering with for longer than this time (in seconds), then remove it
1938 * from the STA's list of peers. Default is 30 minutes.
1939 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
1940 * connected to a mesh gate in mesh formation info. If false, the
1941 * value in mesh formation is determined by the presence of root paths
1942 * in the mesh path table
1943 * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
1944 * for HWMP) if the destination is a direct neighbor. Note that this might
1945 * not be the optimal decision as a multi-hop route might be better. So
1946 * if using this setting you will likely also want to disable
1947 * dot11MeshForwarding and use another mesh routing protocol on top.
1949 struct mesh_config {
1950 u16 dot11MeshRetryTimeout;
1951 u16 dot11MeshConfirmTimeout;
1952 u16 dot11MeshHoldingTimeout;
1953 u16 dot11MeshMaxPeerLinks;
1954 u8 dot11MeshMaxRetries;
1957 bool auto_open_plinks;
1958 u32 dot11MeshNbrOffsetMaxNeighbor;
1959 u8 dot11MeshHWMPmaxPREQretries;
1960 u32 path_refresh_time;
1961 u16 min_discovery_timeout;
1962 u32 dot11MeshHWMPactivePathTimeout;
1963 u16 dot11MeshHWMPpreqMinInterval;
1964 u16 dot11MeshHWMPperrMinInterval;
1965 u16 dot11MeshHWMPnetDiameterTraversalTime;
1966 u8 dot11MeshHWMPRootMode;
1967 bool dot11MeshConnectedToMeshGate;
1968 bool dot11MeshConnectedToAuthServer;
1969 u16 dot11MeshHWMPRannInterval;
1970 bool dot11MeshGateAnnouncementProtocol;
1971 bool dot11MeshForwarding;
1974 u32 dot11MeshHWMPactivePathToRootTimeout;
1975 u16 dot11MeshHWMProotInterval;
1976 u16 dot11MeshHWMPconfirmationInterval;
1977 enum nl80211_mesh_power_mode power_mode;
1978 u16 dot11MeshAwakeWindowDuration;
1980 bool dot11MeshNolearn;
1984 * struct mesh_setup - 802.11s mesh setup configuration
1985 * @chandef: defines the channel to use
1986 * @mesh_id: the mesh ID
1987 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1988 * @sync_method: which synchronization method to use
1989 * @path_sel_proto: which path selection protocol to use
1990 * @path_metric: which metric to use
1991 * @auth_id: which authentication method this mesh is using
1992 * @ie: vendor information elements (optional)
1993 * @ie_len: length of vendor information elements
1994 * @is_authenticated: this mesh requires authentication
1995 * @is_secure: this mesh uses security
1996 * @user_mpm: userspace handles all MPM functions
1997 * @dtim_period: DTIM period to use
1998 * @beacon_interval: beacon interval to use
1999 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2000 * @basic_rates: basic rates to use when creating the mesh
2001 * @beacon_rate: bitrate to be used for beacons
2002 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2003 * changes the channel when a radar is detected. This is required
2004 * to operate on DFS channels.
2005 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2006 * port frames over NL80211 instead of the network interface.
2008 * These parameters are fixed when the mesh is created.
2011 struct cfg80211_chan_def chandef;
2020 bool is_authenticated;
2024 u16 beacon_interval;
2025 int mcast_rate[NUM_NL80211_BANDS];
2027 struct cfg80211_bitrate_mask beacon_rate;
2028 bool userspace_handles_dfs;
2029 bool control_port_over_nl80211;
2033 * struct ocb_setup - 802.11p OCB mode setup configuration
2034 * @chandef: defines the channel to use
2036 * These parameters are fixed when connecting to the network
2039 struct cfg80211_chan_def chandef;
2043 * struct ieee80211_txq_params - TX queue parameters
2044 * @ac: AC identifier
2045 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
2046 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
2048 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
2050 * @aifs: Arbitration interframe space [0..255]
2052 struct ieee80211_txq_params {
2061 * DOC: Scanning and BSS list handling
2063 * The scanning process itself is fairly simple, but cfg80211 offers quite
2064 * a bit of helper functionality. To start a scan, the scan operation will
2065 * be invoked with a scan definition. This scan definition contains the
2066 * channels to scan, and the SSIDs to send probe requests for (including the
2067 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2068 * probe. Additionally, a scan request may contain extra information elements
2069 * that should be added to the probe request. The IEs are guaranteed to be
2070 * well-formed, and will not exceed the maximum length the driver advertised
2071 * in the wiphy structure.
2073 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2074 * it is responsible for maintaining the BSS list; the driver should not
2075 * maintain a list itself. For this notification, various functions exist.
2077 * Since drivers do not maintain a BSS list, there are also a number of
2078 * functions to search for a BSS and obtain information about it from the
2079 * BSS structure cfg80211 maintains. The BSS list is also made available
2084 * struct cfg80211_ssid - SSID description
2086 * @ssid_len: length of the ssid
2088 struct cfg80211_ssid {
2089 u8 ssid[IEEE80211_MAX_SSID_LEN];
2094 * struct cfg80211_scan_info - information about completed scan
2095 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
2096 * wireless device that requested the scan is connected to. If this
2097 * information is not available, this field is left zero.
2098 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
2099 * @aborted: set to true if the scan was aborted for any reason,
2100 * userspace will be notified of that
2102 struct cfg80211_scan_info {
2104 u8 tsf_bssid[ETH_ALEN] __aligned(2);
2109 * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2111 * @short_bssid: short ssid to scan for
2112 * @bssid: bssid to scan for
2113 * @channel_idx: idx of the channel in the channel array in the scan request
2114 * which the above info relvant to
2115 * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2116 * @short_ssid_valid: short_ssid is valid and can be used
2117 * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2118 * 20 TUs before starting to send probe requests.
2120 struct cfg80211_scan_6ghz_params {
2124 bool unsolicited_probe;
2125 bool short_ssid_valid;
2130 * struct cfg80211_scan_request - scan request description
2132 * @ssids: SSIDs to scan for (active scan only)
2133 * @n_ssids: number of SSIDs
2134 * @channels: channels to scan on.
2135 * @n_channels: total number of channels to scan
2136 * @scan_width: channel width for scanning
2137 * @ie: optional information element(s) to add into Probe Request or %NULL
2138 * @ie_len: length of ie in octets
2139 * @duration: how long to listen on each channel, in TUs. If
2140 * %duration_mandatory is not set, this is the maximum dwell time and
2141 * the actual dwell time may be shorter.
2142 * @duration_mandatory: if set, the scan duration must be as specified by the
2144 * @flags: bit field of flags controlling operation
2145 * @rates: bitmap of rates to advertise for each band
2146 * @wiphy: the wiphy this was for
2147 * @scan_start: time (in jiffies) when the scan started
2148 * @wdev: the wireless device to scan for
2149 * @info: (internal) information about completed scan
2150 * @notified: (internal) scan request was notified as done or aborted
2151 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2152 * @mac_addr: MAC address used with randomisation
2153 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2154 * are 0 in the mask should be randomised, bits that are 1 should
2155 * be taken from the @mac_addr
2156 * @scan_6ghz: relevant for split scan request only,
2157 * true if this is the second scan request
2158 * @n_6ghz_params: number of 6 GHz params
2159 * @scan_6ghz_params: 6 GHz params
2160 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
2162 struct cfg80211_scan_request {
2163 struct cfg80211_ssid *ssids;
2166 enum nl80211_bss_scan_width scan_width;
2170 bool duration_mandatory;
2173 u32 rates[NUM_NL80211_BANDS];
2175 struct wireless_dev *wdev;
2177 u8 mac_addr[ETH_ALEN] __aligned(2);
2178 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2179 u8 bssid[ETH_ALEN] __aligned(2);
2182 struct wiphy *wiphy;
2183 unsigned long scan_start;
2184 struct cfg80211_scan_info info;
2189 struct cfg80211_scan_6ghz_params *scan_6ghz_params;
2192 struct ieee80211_channel *channels[];
2195 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2199 get_random_bytes(buf, ETH_ALEN);
2200 for (i = 0; i < ETH_ALEN; i++) {
2202 buf[i] |= addr[i] & mask[i];
2207 * struct cfg80211_match_set - sets of attributes to match
2209 * @ssid: SSID to be matched; may be zero-length in case of BSSID match
2210 * or no match (RSSI only)
2211 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
2212 * or no match (RSSI only)
2213 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
2214 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
2215 * for filtering out scan results received. Drivers advertize this support
2216 * of band specific rssi based filtering through the feature capability
2217 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
2218 * specific rssi thresholds take precedence over rssi_thold, if specified.
2219 * If not specified for any band, it will be assigned with rssi_thold of
2220 * corresponding matchset.
2222 struct cfg80211_match_set {
2223 struct cfg80211_ssid ssid;
2226 s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2230 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
2232 * @interval: interval between scheduled scan iterations. In seconds.
2233 * @iterations: number of scan iterations in this scan plan. Zero means
2235 * The last scan plan will always have this parameter set to zero,
2236 * all other scan plans will have a finite number of iterations.
2238 struct cfg80211_sched_scan_plan {
2244 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2246 * @band: band of BSS which should match for RSSI level adjustment.
2247 * @delta: value of RSSI level adjustment.
2249 struct cfg80211_bss_select_adjust {
2250 enum nl80211_band band;
2255 * struct cfg80211_sched_scan_request - scheduled scan request description
2257 * @reqid: identifies this request.
2258 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2259 * @n_ssids: number of SSIDs
2260 * @n_channels: total number of channels to scan
2261 * @scan_width: channel width for scanning
2262 * @ie: optional information element(s) to add into Probe Request or %NULL
2263 * @ie_len: length of ie in octets
2264 * @flags: bit field of flags controlling operation
2265 * @match_sets: sets of parameters to be matched for a scan result
2266 * entry to be considered valid and to be passed to the host
2267 * (others are filtered out).
2268 * If ommited, all results are passed.
2269 * @n_match_sets: number of match sets
2270 * @report_results: indicates that results were reported for this request
2271 * @wiphy: the wiphy this was for
2272 * @dev: the interface
2273 * @scan_start: start time of the scheduled scan
2274 * @channels: channels to scan
2275 * @min_rssi_thold: for drivers only supporting a single threshold, this
2276 * contains the minimum over all matchsets
2277 * @mac_addr: MAC address used with randomisation
2278 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2279 * are 0 in the mask should be randomised, bits that are 1 should
2280 * be taken from the @mac_addr
2281 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
2282 * index must be executed first.
2283 * @n_scan_plans: number of scan plans, at least 1.
2284 * @rcu_head: RCU callback used to free the struct
2285 * @owner_nlportid: netlink portid of owner (if this should is a request
2286 * owned by a particular socket)
2287 * @nl_owner_dead: netlink owner socket was closed - this request be freed
2288 * @list: for keeping list of requests.
2289 * @delay: delay in seconds to use before starting the first scan
2290 * cycle. The driver may ignore this parameter and start
2291 * immediately (or at any other time), if this feature is not
2293 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2294 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2295 * reporting in connected state to cases where a matching BSS is determined
2296 * to have better or slightly worse RSSI than the current connected BSS.
2297 * The relative RSSI threshold values are ignored in disconnected state.
2298 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2299 * to the specified band while deciding whether a better BSS is reported
2300 * using @relative_rssi. If delta is a negative number, the BSSs that
2301 * belong to the specified band will be penalized by delta dB in relative
2304 struct cfg80211_sched_scan_request {
2306 struct cfg80211_ssid *ssids;
2309 enum nl80211_bss_scan_width scan_width;
2313 struct cfg80211_match_set *match_sets;
2317 struct cfg80211_sched_scan_plan *scan_plans;
2320 u8 mac_addr[ETH_ALEN] __aligned(2);
2321 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2323 bool relative_rssi_set;
2325 struct cfg80211_bss_select_adjust rssi_adjust;
2328 struct wiphy *wiphy;
2329 struct net_device *dev;
2330 unsigned long scan_start;
2331 bool report_results;
2332 struct rcu_head rcu_head;
2335 struct list_head list;
2338 struct ieee80211_channel *channels[];
2342 * enum cfg80211_signal_type - signal type
2344 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
2345 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
2346 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
2348 enum cfg80211_signal_type {
2349 CFG80211_SIGNAL_TYPE_NONE,
2350 CFG80211_SIGNAL_TYPE_MBM,
2351 CFG80211_SIGNAL_TYPE_UNSPEC,
2355 * struct cfg80211_inform_bss - BSS inform data
2356 * @chan: channel the frame was received on
2357 * @scan_width: scan width that was used
2358 * @signal: signal strength value, according to the wiphy's
2360 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
2361 * received; should match the time when the frame was actually
2362 * received by the device (not just by the host, in case it was
2363 * buffered on the device) and be accurate to about 10ms.
2364 * If the frame isn't buffered, just passing the return value of
2365 * ktime_get_boottime_ns() is likely appropriate.
2366 * @parent_tsf: the time at the start of reception of the first octet of the
2367 * timestamp field of the frame. The time is the TSF of the BSS specified
2369 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
2370 * the BSS that requested the scan in which the beacon/probe was received.
2371 * @chains: bitmask for filled values in @chain_signal.
2372 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2374 struct cfg80211_inform_bss {
2375 struct ieee80211_channel *chan;
2376 enum nl80211_bss_scan_width scan_width;
2380 u8 parent_bssid[ETH_ALEN] __aligned(2);
2382 s8 chain_signal[IEEE80211_MAX_CHAINS];
2386 * struct cfg80211_bss_ies - BSS entry IE data
2387 * @tsf: TSF contained in the frame that carried these IEs
2388 * @rcu_head: internal use, for freeing
2389 * @len: length of the IEs
2390 * @from_beacon: these IEs are known to come from a beacon
2393 struct cfg80211_bss_ies {
2395 struct rcu_head rcu_head;
2402 * struct cfg80211_bss - BSS description
2404 * This structure describes a BSS (which may also be a mesh network)
2405 * for use in scan results and similar.
2407 * @channel: channel this BSS is on
2408 * @scan_width: width of the control channel
2409 * @bssid: BSSID of the BSS
2410 * @beacon_interval: the beacon interval as from the frame
2411 * @capability: the capability field in host byte order
2412 * @ies: the information elements (Note that there is no guarantee that these
2413 * are well-formed!); this is a pointer to either the beacon_ies or
2414 * proberesp_ies depending on whether Probe Response frame has been
2415 * received. It is always non-%NULL.
2416 * @beacon_ies: the information elements from the last Beacon frame
2417 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
2418 * own the beacon_ies, but they're just pointers to the ones from the
2419 * @hidden_beacon_bss struct)
2420 * @proberesp_ies: the information elements from the last Probe Response frame
2421 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2422 * a BSS that hides the SSID in its beacon, this points to the BSS struct
2423 * that holds the beacon data. @beacon_ies is still valid, of course, and
2424 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
2425 * @transmitted_bss: pointer to the transmitted BSS, if this is a
2426 * non-transmitted one (multi-BSSID support)
2427 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2428 * (multi-BSSID support)
2429 * @signal: signal strength value (type depends on the wiphy's signal_type)
2430 * @chains: bitmask for filled values in @chain_signal.
2431 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2432 * @bssid_index: index in the multiple BSS set
2433 * @max_bssid_indicator: max number of members in the BSS set
2434 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
2436 struct cfg80211_bss {
2437 struct ieee80211_channel *channel;
2438 enum nl80211_bss_scan_width scan_width;
2440 const struct cfg80211_bss_ies __rcu *ies;
2441 const struct cfg80211_bss_ies __rcu *beacon_ies;
2442 const struct cfg80211_bss_ies __rcu *proberesp_ies;
2444 struct cfg80211_bss *hidden_beacon_bss;
2445 struct cfg80211_bss *transmitted_bss;
2446 struct list_head nontrans_list;
2450 u16 beacon_interval;
2455 s8 chain_signal[IEEE80211_MAX_CHAINS];
2458 u8 max_bssid_indicator;
2460 u8 priv[] __aligned(sizeof(void *));
2464 * ieee80211_bss_get_elem - find element with given ID
2465 * @bss: the bss to search
2466 * @id: the element ID
2468 * Note that the return value is an RCU-protected pointer, so
2469 * rcu_read_lock() must be held when calling this function.
2470 * Return: %NULL if not found.
2472 const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
2475 * ieee80211_bss_get_ie - find IE with given ID
2476 * @bss: the bss to search
2477 * @id: the element ID
2479 * Note that the return value is an RCU-protected pointer, so
2480 * rcu_read_lock() must be held when calling this function.
2481 * Return: %NULL if not found.
2483 static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
2485 return (void *)ieee80211_bss_get_elem(bss, id);
2490 * struct cfg80211_auth_request - Authentication request data
2492 * This structure provides information needed to complete IEEE 802.11
2495 * @bss: The BSS to authenticate with, the callee must obtain a reference
2496 * to it if it needs to keep it.
2497 * @auth_type: Authentication type (algorithm)
2498 * @ie: Extra IEs to add to Authentication frame or %NULL
2499 * @ie_len: Length of ie buffer in octets
2500 * @key_len: length of WEP key for shared key authentication
2501 * @key_idx: index of WEP key for shared key authentication
2502 * @key: WEP key for shared key authentication
2503 * @auth_data: Fields and elements in Authentication frames. This contains
2504 * the authentication frame body (non-IE and IE data), excluding the
2505 * Authentication algorithm number, i.e., starting at the Authentication
2506 * transaction sequence number field.
2507 * @auth_data_len: Length of auth_data buffer in octets
2509 struct cfg80211_auth_request {
2510 struct cfg80211_bss *bss;
2513 enum nl80211_auth_type auth_type;
2515 u8 key_len, key_idx;
2516 const u8 *auth_data;
2517 size_t auth_data_len;
2521 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
2523 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
2524 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
2525 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
2526 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
2527 * authentication capability. Drivers can offload authentication to
2528 * userspace if this flag is set. Only applicable for cfg80211_connect()
2529 * request (connect callback).
2531 enum cfg80211_assoc_req_flags {
2532 ASSOC_REQ_DISABLE_HT = BIT(0),
2533 ASSOC_REQ_DISABLE_VHT = BIT(1),
2534 ASSOC_REQ_USE_RRM = BIT(2),
2535 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
2539 * struct cfg80211_assoc_request - (Re)Association request data
2541 * This structure provides information needed to complete IEEE 802.11
2543 * @bss: The BSS to associate with. If the call is successful the driver is
2544 * given a reference that it must give back to cfg80211_send_rx_assoc()
2545 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2546 * association requests while already associating must be rejected.
2547 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2548 * @ie_len: Length of ie buffer in octets
2549 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2550 * @crypto: crypto settings
2551 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2552 * to indicate a request to reassociate within the ESS instead of a request
2553 * do the initial association with the ESS. When included, this is set to
2554 * the BSSID of the current association, i.e., to the value that is
2555 * included in the Current AP address field of the Reassociation Request
2557 * @flags: See &enum cfg80211_assoc_req_flags
2558 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2559 * will be used in ht_capa. Un-supported values will be ignored.
2560 * @ht_capa_mask: The bits of ht_capa which are to be used.
2561 * @vht_capa: VHT capability override
2562 * @vht_capa_mask: VHT capability mask indicating which fields to use
2563 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2564 * %NULL if FILS is not used.
2565 * @fils_kek_len: Length of fils_kek in octets
2566 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2567 * Request/Response frame or %NULL if FILS is not used. This field starts
2568 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2569 * @s1g_capa: S1G capability override
2570 * @s1g_capa_mask: S1G capability override mask
2572 struct cfg80211_assoc_request {
2573 struct cfg80211_bss *bss;
2574 const u8 *ie, *prev_bssid;
2576 struct cfg80211_crypto_settings crypto;
2579 struct ieee80211_ht_cap ht_capa;
2580 struct ieee80211_ht_cap ht_capa_mask;
2581 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2583 size_t fils_kek_len;
2584 const u8 *fils_nonces;
2585 struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2589 * struct cfg80211_deauth_request - Deauthentication request data
2591 * This structure provides information needed to complete IEEE 802.11
2594 * @bssid: the BSSID of the BSS to deauthenticate from
2595 * @ie: Extra IEs to add to Deauthentication frame or %NULL
2596 * @ie_len: Length of ie buffer in octets
2597 * @reason_code: The reason code for the deauthentication
2598 * @local_state_change: if set, change local state only and
2599 * do not set a deauth frame
2601 struct cfg80211_deauth_request {
2606 bool local_state_change;
2610 * struct cfg80211_disassoc_request - Disassociation request data
2612 * This structure provides information needed to complete IEEE 802.11
2615 * @bss: the BSS to disassociate from
2616 * @ie: Extra IEs to add to Disassociation frame or %NULL
2617 * @ie_len: Length of ie buffer in octets
2618 * @reason_code: The reason code for the disassociation
2619 * @local_state_change: This is a request for a local state only, i.e., no
2620 * Disassociation frame is to be transmitted.
2622 struct cfg80211_disassoc_request {
2623 struct cfg80211_bss *bss;
2627 bool local_state_change;
2631 * struct cfg80211_ibss_params - IBSS parameters
2633 * This structure defines the IBSS parameters for the join_ibss()
2636 * @ssid: The SSID, will always be non-null.
2637 * @ssid_len: The length of the SSID, will always be non-zero.
2638 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2639 * search for IBSSs with a different BSSID.
2640 * @chandef: defines the channel to use if no other IBSS to join can be found
2641 * @channel_fixed: The channel should be fixed -- do not search for
2642 * IBSSs to join on other channels.
2643 * @ie: information element(s) to include in the beacon
2644 * @ie_len: length of that
2645 * @beacon_interval: beacon interval to use
2646 * @privacy: this is a protected network, keys will be configured
2648 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2649 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2650 * required to assume that the port is unauthorized until authorized by
2651 * user space. Otherwise, port is marked authorized by default.
2652 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2653 * port frames over NL80211 instead of the network interface.
2654 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2655 * changes the channel when a radar is detected. This is required
2656 * to operate on DFS channels.
2657 * @basic_rates: bitmap of basic rates to use when creating the IBSS
2658 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2659 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2660 * will be used in ht_capa. Un-supported values will be ignored.
2661 * @ht_capa_mask: The bits of ht_capa which are to be used.
2662 * @wep_keys: static WEP keys, if not NULL points to an array of
2663 * CFG80211_MAX_WEP_KEYS WEP keys
2664 * @wep_tx_key: key index (0..3) of the default TX static WEP key
2666 struct cfg80211_ibss_params {
2669 struct cfg80211_chan_def chandef;
2671 u8 ssid_len, ie_len;
2672 u16 beacon_interval;
2677 bool control_port_over_nl80211;
2678 bool userspace_handles_dfs;
2679 int mcast_rate[NUM_NL80211_BANDS];
2680 struct ieee80211_ht_cap ht_capa;
2681 struct ieee80211_ht_cap ht_capa_mask;
2682 struct key_params *wep_keys;
2687 * struct cfg80211_bss_selection - connection parameters for BSS selection.
2689 * @behaviour: requested BSS selection behaviour.
2690 * @param: parameters for requestion behaviour.
2691 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2692 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2694 struct cfg80211_bss_selection {
2695 enum nl80211_bss_select_attr behaviour;
2697 enum nl80211_band band_pref;
2698 struct cfg80211_bss_select_adjust adjust;
2703 * struct cfg80211_connect_params - Connection parameters
2705 * This structure provides information needed to complete IEEE 802.11
2706 * authentication and association.
2708 * @channel: The channel to use or %NULL if not specified (auto-select based
2710 * @channel_hint: The channel of the recommended BSS for initial connection or
2711 * %NULL if not specified
2712 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2714 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2715 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2716 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2719 * @ssid_len: Length of ssid in octets
2720 * @auth_type: Authentication type (algorithm)
2721 * @ie: IEs for association request
2722 * @ie_len: Length of assoc_ie in octets
2723 * @privacy: indicates whether privacy-enabled APs should be used
2724 * @mfp: indicate whether management frame protection is used
2725 * @crypto: crypto settings
2726 * @key_len: length of WEP key for shared key authentication
2727 * @key_idx: index of WEP key for shared key authentication
2728 * @key: WEP key for shared key authentication
2729 * @flags: See &enum cfg80211_assoc_req_flags
2730 * @bg_scan_period: Background scan period in seconds
2731 * or -1 to indicate that default value is to be used.
2732 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2733 * will be used in ht_capa. Un-supported values will be ignored.
2734 * @ht_capa_mask: The bits of ht_capa which are to be used.
2735 * @vht_capa: VHT Capability overrides
2736 * @vht_capa_mask: The bits of vht_capa which are to be used.
2737 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2739 * @bss_select: criteria to be used for BSS selection.
2740 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2741 * to indicate a request to reassociate within the ESS instead of a request
2742 * do the initial association with the ESS. When included, this is set to
2743 * the BSSID of the current association, i.e., to the value that is
2744 * included in the Current AP address field of the Reassociation Request
2746 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2747 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2749 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2750 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2751 * %NULL if not specified. This specifies the domain name of ER server and
2752 * is used to construct FILS wrapped data IE.
2753 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2754 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2755 * messages. This is also used to construct FILS wrapped data IE.
2756 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2757 * keys in FILS or %NULL if not specified.
2758 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
2759 * @want_1x: indicates user-space supports and wants to use 802.1X driver
2760 * offload of 4-way handshake.
2761 * @edmg: define the EDMG channels.
2762 * This may specify multiple channels and bonding options for the driver
2763 * to choose from, based on BSS configuration.
2765 struct cfg80211_connect_params {
2766 struct ieee80211_channel *channel;
2767 struct ieee80211_channel *channel_hint;
2769 const u8 *bssid_hint;
2772 enum nl80211_auth_type auth_type;
2776 enum nl80211_mfp mfp;
2777 struct cfg80211_crypto_settings crypto;
2779 u8 key_len, key_idx;
2782 struct ieee80211_ht_cap ht_capa;
2783 struct ieee80211_ht_cap ht_capa_mask;
2784 struct ieee80211_vht_cap vht_capa;
2785 struct ieee80211_vht_cap vht_capa_mask;
2787 struct cfg80211_bss_selection bss_select;
2788 const u8 *prev_bssid;
2789 const u8 *fils_erp_username;
2790 size_t fils_erp_username_len;
2791 const u8 *fils_erp_realm;
2792 size_t fils_erp_realm_len;
2793 u16 fils_erp_next_seq_num;
2794 const u8 *fils_erp_rrk;
2795 size_t fils_erp_rrk_len;
2797 struct ieee80211_edmg edmg;
2801 * enum cfg80211_connect_params_changed - Connection parameters being updated
2803 * This enum provides information of all connect parameters that
2804 * have to be updated as part of update_connect_params() call.
2806 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2807 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2808 * username, erp sequence number and rrk) are updated
2809 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2811 enum cfg80211_connect_params_changed {
2812 UPDATE_ASSOC_IES = BIT(0),
2813 UPDATE_FILS_ERP_INFO = BIT(1),
2814 UPDATE_AUTH_TYPE = BIT(2),
2818 * enum wiphy_params_flags - set_wiphy_params bitfield values
2819 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2820 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2821 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2822 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2823 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
2824 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
2825 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2826 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2827 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2829 enum wiphy_params_flags {
2830 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2831 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2832 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2833 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
2834 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
2835 WIPHY_PARAM_DYN_ACK = 1 << 5,
2836 WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2837 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2838 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
2841 #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
2843 /* The per TXQ device queue limit in airtime */
2844 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
2845 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
2847 /* The per interface airtime threshold to switch to lower queue limit */
2848 #define IEEE80211_AQL_THRESHOLD 24000
2851 * struct cfg80211_pmksa - PMK Security Association
2853 * This structure is passed to the set/del_pmksa() method for PMKSA
2856 * @bssid: The AP's BSSID (may be %NULL).
2857 * @pmkid: The identifier to refer a PMKSA.
2858 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2859 * derivation by a FILS STA. Otherwise, %NULL.
2860 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2861 * the hash algorithm used to generate this.
2862 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2863 * cache identifier (may be %NULL).
2864 * @ssid_len: Length of the @ssid in octets.
2865 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2866 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2868 * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
2869 * (dot11RSNAConfigPMKLifetime) or 0 if not specified.
2870 * The configured PMKSA must not be used for PMKSA caching after
2871 * expiration and any keys derived from this PMK become invalid on
2872 * expiration, i.e., the current association must be dropped if the PMK
2873 * used for it expires.
2874 * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
2875 * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
2876 * Drivers are expected to trigger a full authentication instead of using
2877 * this PMKSA for caching when reassociating to a new BSS after this
2878 * threshold to generate a new PMK before the current one expires.
2880 struct cfg80211_pmksa {
2889 u8 pmk_reauth_threshold;
2893 * struct cfg80211_pkt_pattern - packet pattern
2894 * @mask: bitmask where to match pattern and where to ignore bytes,
2895 * one bit per byte, in same format as nl80211
2896 * @pattern: bytes to match where bitmask is 1
2897 * @pattern_len: length of pattern (in bytes)
2898 * @pkt_offset: packet offset (in bytes)
2900 * Internal note: @mask and @pattern are allocated in one chunk of
2901 * memory, free @mask only!
2903 struct cfg80211_pkt_pattern {
2904 const u8 *mask, *pattern;
2910 * struct cfg80211_wowlan_tcp - TCP connection parameters
2912 * @sock: (internal) socket for source port allocation
2913 * @src: source IP address
2914 * @dst: destination IP address
2915 * @dst_mac: destination MAC address
2916 * @src_port: source port
2917 * @dst_port: destination port
2918 * @payload_len: data payload length
2919 * @payload: data payload buffer
2920 * @payload_seq: payload sequence stamping configuration
2921 * @data_interval: interval at which to send data packets
2922 * @wake_len: wakeup payload match length
2923 * @wake_data: wakeup payload match data
2924 * @wake_mask: wakeup payload match mask
2925 * @tokens_size: length of the tokens buffer
2926 * @payload_tok: payload token usage configuration
2928 struct cfg80211_wowlan_tcp {
2929 struct socket *sock;
2931 u16 src_port, dst_port;
2932 u8 dst_mac[ETH_ALEN];
2935 struct nl80211_wowlan_tcp_data_seq payload_seq;
2938 const u8 *wake_data, *wake_mask;
2940 /* must be last, variable member */
2941 struct nl80211_wowlan_tcp_data_token payload_tok;
2945 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2947 * This structure defines the enabled WoWLAN triggers for the device.
2948 * @any: wake up on any activity -- special trigger if device continues
2949 * operating as normal during suspend
2950 * @disconnect: wake up if getting disconnected
2951 * @magic_pkt: wake up on receiving magic packet
2952 * @patterns: wake up on receiving packet matching a pattern
2953 * @n_patterns: number of patterns
2954 * @gtk_rekey_failure: wake up on GTK rekey failure
2955 * @eap_identity_req: wake up on EAP identity request packet
2956 * @four_way_handshake: wake up on 4-way handshake
2957 * @rfkill_release: wake up when rfkill is released
2958 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
2959 * NULL if not configured.
2960 * @nd_config: configuration for the scan to be used for net detect wake.
2962 struct cfg80211_wowlan {
2963 bool any, disconnect, magic_pkt, gtk_rekey_failure,
2964 eap_identity_req, four_way_handshake,
2966 struct cfg80211_pkt_pattern *patterns;
2967 struct cfg80211_wowlan_tcp *tcp;
2969 struct cfg80211_sched_scan_request *nd_config;
2973 * struct cfg80211_coalesce_rules - Coalesce rule parameters
2975 * This structure defines coalesce rule for the device.
2976 * @delay: maximum coalescing delay in msecs.
2977 * @condition: condition for packet coalescence.
2978 * see &enum nl80211_coalesce_condition.
2979 * @patterns: array of packet patterns
2980 * @n_patterns: number of patterns
2982 struct cfg80211_coalesce_rules {
2984 enum nl80211_coalesce_condition condition;
2985 struct cfg80211_pkt_pattern *patterns;
2990 * struct cfg80211_coalesce - Packet coalescing settings
2992 * This structure defines coalescing settings.
2993 * @rules: array of coalesce rules
2994 * @n_rules: number of rules
2996 struct cfg80211_coalesce {
2997 struct cfg80211_coalesce_rules *rules;
3002 * struct cfg80211_wowlan_nd_match - information about the match
3004 * @ssid: SSID of the match that triggered the wake up
3005 * @n_channels: Number of channels where the match occurred. This
3006 * value may be zero if the driver can't report the channels.
3007 * @channels: center frequencies of the channels where a match
3010 struct cfg80211_wowlan_nd_match {
3011 struct cfg80211_ssid ssid;
3017 * struct cfg80211_wowlan_nd_info - net detect wake up information
3019 * @n_matches: Number of match information instances provided in
3020 * @matches. This value may be zero if the driver can't provide
3021 * match information.
3022 * @matches: Array of pointers to matches containing information about
3023 * the matches that triggered the wake up.
3025 struct cfg80211_wowlan_nd_info {
3027 struct cfg80211_wowlan_nd_match *matches[];
3031 * struct cfg80211_wowlan_wakeup - wakeup report
3032 * @disconnect: woke up by getting disconnected
3033 * @magic_pkt: woke up by receiving magic packet
3034 * @gtk_rekey_failure: woke up by GTK rekey failure
3035 * @eap_identity_req: woke up by EAP identity request packet
3036 * @four_way_handshake: woke up by 4-way handshake
3037 * @rfkill_release: woke up by rfkill being released
3038 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3039 * @packet_present_len: copied wakeup packet data
3040 * @packet_len: original wakeup packet length
3041 * @packet: The packet causing the wakeup, if any.
3042 * @packet_80211: For pattern match, magic packet and other data
3043 * frame triggers an 802.3 frame should be reported, for
3044 * disconnect due to deauth 802.11 frame. This indicates which
3046 * @tcp_match: TCP wakeup packet received
3047 * @tcp_connlost: TCP connection lost or failed to establish
3048 * @tcp_nomoretokens: TCP data ran out of tokens
3049 * @net_detect: if not %NULL, woke up because of net detect
3051 struct cfg80211_wowlan_wakeup {
3052 bool disconnect, magic_pkt, gtk_rekey_failure,
3053 eap_identity_req, four_way_handshake,
3054 rfkill_release, packet_80211,
3055 tcp_match, tcp_connlost, tcp_nomoretokens;
3057 u32 packet_present_len, packet_len;
3059 struct cfg80211_wowlan_nd_info *net_detect;
3063 * struct cfg80211_gtk_rekey_data - rekey data
3064 * @kek: key encryption key (@kek_len bytes)
3065 * @kck: key confirmation key (@kck_len bytes)
3066 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3067 * @kek_len: length of kek
3068 * @kck_len length of kck
3069 * @akm: akm (oui, id)
3071 struct cfg80211_gtk_rekey_data {
3072 const u8 *kek, *kck, *replay_ctr;
3074 u8 kek_len, kck_len;
3078 * struct cfg80211_update_ft_ies_params - FT IE Information
3080 * This structure provides information needed to update the fast transition IE
3082 * @md: The Mobility Domain ID, 2 Octet value
3083 * @ie: Fast Transition IEs
3084 * @ie_len: Length of ft_ie in octets
3086 struct cfg80211_update_ft_ies_params {
3093 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3095 * This structure provides information needed to transmit a mgmt frame
3097 * @chan: channel to use
3098 * @offchan: indicates wether off channel operation is required
3099 * @wait: duration for ROC
3100 * @buf: buffer to transmit
3101 * @len: buffer length
3102 * @no_cck: don't use cck rates for this frame
3103 * @dont_wait_for_ack: tells the low level not to wait for an ack
3104 * @n_csa_offsets: length of csa_offsets array
3105 * @csa_offsets: array of all the csa offsets in the frame
3107 struct cfg80211_mgmt_tx_params {
3108 struct ieee80211_channel *chan;
3114 bool dont_wait_for_ack;
3116 const u16 *csa_offsets;
3120 * struct cfg80211_dscp_exception - DSCP exception
3122 * @dscp: DSCP value that does not adhere to the user priority range definition
3123 * @up: user priority value to which the corresponding DSCP value belongs
3125 struct cfg80211_dscp_exception {
3131 * struct cfg80211_dscp_range - DSCP range definition for user priority
3133 * @low: lowest DSCP value of this user priority range, inclusive
3134 * @high: highest DSCP value of this user priority range, inclusive
3136 struct cfg80211_dscp_range {
3141 /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3142 #define IEEE80211_QOS_MAP_MAX_EX 21
3143 #define IEEE80211_QOS_MAP_LEN_MIN 16
3144 #define IEEE80211_QOS_MAP_LEN_MAX \
3145 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3148 * struct cfg80211_qos_map - QoS Map Information
3150 * This struct defines the Interworking QoS map setting for DSCP values
3152 * @num_des: number of DSCP exceptions (0..21)
3153 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3154 * the user priority DSCP range definition
3155 * @up: DSCP range definition for a particular user priority
3157 struct cfg80211_qos_map {
3159 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3160 struct cfg80211_dscp_range up[8];
3164 * struct cfg80211_nan_conf - NAN configuration
3166 * This struct defines NAN configuration parameters
3168 * @master_pref: master preference (1 - 255)
3169 * @bands: operating bands, a bitmap of &enum nl80211_band values.
3170 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
3171 * (i.e. BIT(NL80211_BAND_2GHZ)).
3173 struct cfg80211_nan_conf {
3179 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3182 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
3183 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3185 enum cfg80211_nan_conf_changes {
3186 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
3187 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3191 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3193 * @filter: the content of the filter
3194 * @len: the length of the filter
3196 struct cfg80211_nan_func_filter {
3202 * struct cfg80211_nan_func - a NAN function
3204 * @type: &enum nl80211_nan_function_type
3205 * @service_id: the service ID of the function
3206 * @publish_type: &nl80211_nan_publish_type
3207 * @close_range: if true, the range should be limited. Threshold is
3208 * implementation specific.
3209 * @publish_bcast: if true, the solicited publish should be broadcasted
3210 * @subscribe_active: if true, the subscribe is active
3211 * @followup_id: the instance ID for follow up
3212 * @followup_reqid: the requestor instance ID for follow up
3213 * @followup_dest: MAC address of the recipient of the follow up
3214 * @ttl: time to live counter in DW.
3215 * @serv_spec_info: Service Specific Info
3216 * @serv_spec_info_len: Service Specific Info length
3217 * @srf_include: if true, SRF is inclusive
3218 * @srf_bf: Bloom Filter
3219 * @srf_bf_len: Bloom Filter length
3220 * @srf_bf_idx: Bloom Filter index
3221 * @srf_macs: SRF MAC addresses
3222 * @srf_num_macs: number of MAC addresses in SRF
3223 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3224 * @tx_filters: filters that should be transmitted in the SDF.
3225 * @num_rx_filters: length of &rx_filters.
3226 * @num_tx_filters: length of &tx_filters.
3227 * @instance_id: driver allocated id of the function.
3228 * @cookie: unique NAN function identifier.
3230 struct cfg80211_nan_func {
3231 enum nl80211_nan_function_type type;
3232 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3236 bool subscribe_active;
3239 struct mac_address followup_dest;
3241 const u8 *serv_spec_info;
3242 u8 serv_spec_info_len;
3247 struct mac_address *srf_macs;
3249 struct cfg80211_nan_func_filter *rx_filters;
3250 struct cfg80211_nan_func_filter *tx_filters;
3258 * struct cfg80211_pmk_conf - PMK configuration
3260 * @aa: authenticator address
3261 * @pmk_len: PMK length in bytes.
3262 * @pmk: the PMK material
3263 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
3264 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
3267 struct cfg80211_pmk_conf {
3271 const u8 *pmk_r0_name;
3275 * struct cfg80211_external_auth_params - Trigger External authentication.
3277 * Commonly used across the external auth request and event interfaces.
3279 * @action: action type / trigger for external authentication. Only significant
3280 * for the authentication request event interface (driver to user space).
3281 * @bssid: BSSID of the peer with which the authentication has
3282 * to happen. Used by both the authentication request event and
3283 * authentication response command interface.
3284 * @ssid: SSID of the AP. Used by both the authentication request event and
3285 * authentication response command interface.
3286 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
3287 * authentication request event interface.
3288 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
3289 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
3290 * the real status code for failures. Used only for the authentication
3291 * response command interface (user space to driver).
3292 * @pmkid: The identifier to refer a PMKSA.
3294 struct cfg80211_external_auth_params {
3295 enum nl80211_external_auth_action action;
3296 u8 bssid[ETH_ALEN] __aligned(2);
3297 struct cfg80211_ssid ssid;
3298 unsigned int key_mgmt_suite;
3304 * struct cfg80211_ftm_responder_stats - FTM responder statistics
3306 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
3307 * indicate the relevant values in this struct for them
3308 * @success_num: number of FTM sessions in which all frames were successfully
3310 * @partial_num: number of FTM sessions in which part of frames were
3311 * successfully answered
3312 * @failed_num: number of failed FTM sessions
3313 * @asap_num: number of ASAP FTM sessions
3314 * @non_asap_num: number of non-ASAP FTM sessions
3315 * @total_duration_ms: total sessions durations - gives an indication
3316 * of how much time the responder was busy
3317 * @unknown_triggers_num: number of unknown FTM triggers - triggers from
3318 * initiators that didn't finish successfully the negotiation phase with
3320 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
3321 * for a new scheduling although it already has scheduled FTM slot
3322 * @out_of_window_triggers_num: total FTM triggers out of scheduled window
3324 struct cfg80211_ftm_responder_stats {
3331 u64 total_duration_ms;
3332 u32 unknown_triggers_num;
3333 u32 reschedule_requests_num;
3334 u32 out_of_window_triggers_num;
3338 * struct cfg80211_pmsr_ftm_result - FTM result
3339 * @failure_reason: if this measurement failed (PMSR status is
3340 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
3341 * reason than just "failure"
3342 * @burst_index: if reporting partial results, this is the index
3343 * in [0 .. num_bursts-1] of the burst that's being reported
3344 * @num_ftmr_attempts: number of FTM request frames transmitted
3345 * @num_ftmr_successes: number of FTM request frames acked
3346 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
3347 * fill this to indicate in how many seconds a retry is deemed possible
3349 * @num_bursts_exp: actual number of bursts exponent negotiated
3350 * @burst_duration: actual burst duration negotiated
3351 * @ftms_per_burst: actual FTMs per burst negotiated
3352 * @lci_len: length of LCI information (if present)
3353 * @civicloc_len: length of civic location information (if present)
3354 * @lci: LCI data (may be %NULL)
3355 * @civicloc: civic location data (may be %NULL)
3356 * @rssi_avg: average RSSI over FTM action frames reported
3357 * @rssi_spread: spread of the RSSI over FTM action frames reported
3358 * @tx_rate: bitrate for transmitted FTM action frame response
3359 * @rx_rate: bitrate of received FTM action frame
3360 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
3361 * @rtt_variance: variance of RTTs measured (note that standard deviation is
3362 * the square root of the variance)
3363 * @rtt_spread: spread of the RTTs measured
3364 * @dist_avg: average of distances (mm) measured
3365 * (must have either this or @rtt_avg)
3366 * @dist_variance: variance of distances measured (see also @rtt_variance)
3367 * @dist_spread: spread of distances measured (see also @rtt_spread)
3368 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
3369 * @num_ftmr_successes_valid: @num_ftmr_successes is valid
3370 * @rssi_avg_valid: @rssi_avg is valid
3371 * @rssi_spread_valid: @rssi_spread is valid
3372 * @tx_rate_valid: @tx_rate is valid
3373 * @rx_rate_valid: @rx_rate is valid
3374 * @rtt_avg_valid: @rtt_avg is valid
3375 * @rtt_variance_valid: @rtt_variance is valid
3376 * @rtt_spread_valid: @rtt_spread is valid
3377 * @dist_avg_valid: @dist_avg is valid
3378 * @dist_variance_valid: @dist_variance is valid
3379 * @dist_spread_valid: @dist_spread is valid
3381 struct cfg80211_pmsr_ftm_result {
3384 unsigned int lci_len;
3385 unsigned int civicloc_len;
3386 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
3387 u32 num_ftmr_attempts, num_ftmr_successes;
3395 struct rate_info tx_rate, rx_rate;
3403 u16 num_ftmr_attempts_valid:1,
3404 num_ftmr_successes_valid:1,
3406 rssi_spread_valid:1,
3410 rtt_variance_valid:1,
3413 dist_variance_valid:1,
3414 dist_spread_valid:1;
3418 * struct cfg80211_pmsr_result - peer measurement result
3419 * @addr: address of the peer
3420 * @host_time: host time (use ktime_get_boottime() adjust to the time when the
3421 * measurement was made)
3422 * @ap_tsf: AP's TSF at measurement time
3423 * @status: status of the measurement
3424 * @final: if reporting partial results, mark this as the last one; if not
3425 * reporting partial results always set this flag
3426 * @ap_tsf_valid: indicates the @ap_tsf value is valid
3427 * @type: type of the measurement reported, note that we only support reporting
3428 * one type at a time, but you can report multiple results separately and
3429 * they're all aggregated for userspace.
3431 struct cfg80211_pmsr_result {
3432 u64 host_time, ap_tsf;
3433 enum nl80211_peer_measurement_status status;
3440 enum nl80211_peer_measurement_type type;
3443 struct cfg80211_pmsr_ftm_result ftm;
3448 * struct cfg80211_pmsr_ftm_request_peer - FTM request data
3449 * @requested: indicates FTM is requested
3450 * @preamble: frame preamble to use
3451 * @burst_period: burst period to use
3452 * @asap: indicates to use ASAP mode
3453 * @num_bursts_exp: number of bursts exponent
3454 * @burst_duration: burst duration
3455 * @ftms_per_burst: number of FTMs per burst
3456 * @ftmr_retries: number of retries for FTM request
3457 * @request_lci: request LCI information
3458 * @request_civicloc: request civic location information
3459 * @trigger_based: use trigger based ranging for the measurement
3460 * If neither @trigger_based nor @non_trigger_based is set,
3461 * EDCA based ranging will be used.
3462 * @non_trigger_based: use non trigger based ranging for the measurement
3463 * If neither @trigger_based nor @non_trigger_based is set,
3464 * EDCA based ranging will be used.
3466 * See also nl80211 for the respective attribute documentation.
3468 struct cfg80211_pmsr_ftm_request_peer {
3469 enum nl80211_preamble preamble;
3476 non_trigger_based:1;
3484 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
3485 * @addr: MAC address
3486 * @chandef: channel to use
3487 * @report_ap_tsf: report the associated AP's TSF
3488 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
3490 struct cfg80211_pmsr_request_peer {
3492 struct cfg80211_chan_def chandef;
3494 struct cfg80211_pmsr_ftm_request_peer ftm;
3498 * struct cfg80211_pmsr_request - peer measurement request
3499 * @cookie: cookie, set by cfg80211
3500 * @nl_portid: netlink portid - used by cfg80211
3501 * @drv_data: driver data for this request, if required for aborting,
3502 * not otherwise freed or anything by cfg80211
3503 * @mac_addr: MAC address used for (randomised) request
3504 * @mac_addr_mask: MAC address mask used for randomisation, bits that
3505 * are 0 in the mask should be randomised, bits that are 1 should
3506 * be taken from the @mac_addr
3507 * @list: used by cfg80211 to hold on to the request
3508 * @timeout: timeout (in milliseconds) for the whole operation, if
3509 * zero it means there's no timeout
3510 * @n_peers: number of peers to do measurements with
3511 * @peers: per-peer measurement request data
3513 struct cfg80211_pmsr_request {
3521 u8 mac_addr[ETH_ALEN] __aligned(2);
3522 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3524 struct list_head list;
3526 struct cfg80211_pmsr_request_peer peers[];
3530 * struct cfg80211_update_owe_info - OWE Information
3532 * This structure provides information needed for the drivers to offload OWE
3533 * (Opportunistic Wireless Encryption) processing to the user space.
3535 * Commonly used across update_owe_info request and event interfaces.
3537 * @peer: MAC address of the peer device for which the OWE processing
3539 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3540 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3541 * cannot give you the real status code for failures. Used only for
3542 * OWE update request command interface (user space to driver).
3543 * @ie: IEs obtained from the peer or constructed by the user space. These are
3544 * the IEs of the remote peer in the event from the host driver and
3545 * the constructed IEs by the user space in the request interface.
3546 * @ie_len: Length of IEs in octets.
3548 struct cfg80211_update_owe_info {
3549 u8 peer[ETH_ALEN] __aligned(2);
3556 * struct mgmt_frame_regs - management frame registrations data
3557 * @global_stypes: bitmap of management frame subtypes registered
3558 * for the entire device
3559 * @interface_stypes: bitmap of management frame subtypes registered
3560 * for the given interface
3561 * @global_mcast_rx: mcast RX is needed globally for these subtypes
3562 * @interface_mcast_stypes: mcast RX is needed on this interface
3563 * for these subtypes
3565 struct mgmt_frame_regs {
3566 u32 global_stypes, interface_stypes;
3567 u32 global_mcast_stypes, interface_mcast_stypes;
3571 * struct cfg80211_ops - backend description for wireless configuration
3573 * This struct is registered by fullmac card drivers and/or wireless stacks
3574 * in order to handle configuration requests on their interfaces.
3576 * All callbacks except where otherwise noted should return 0
3577 * on success or a negative error code.
3579 * All operations are currently invoked under rtnl for consistency with the
3580 * wireless extensions but this is subject to reevaluation as soon as this
3581 * code is used more widely and we have a first user without wext.
3583 * @suspend: wiphy device needs to be suspended. The variable @wow will
3584 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
3585 * configured for the device.
3586 * @resume: wiphy device needs to be resumed
3587 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
3588 * to call device_set_wakeup_enable() to enable/disable wakeup from
3591 * @add_virtual_intf: create a new virtual interface with the given name,
3592 * must set the struct wireless_dev's iftype. Beware: You must create
3593 * the new netdev in the wiphy's network namespace! Returns the struct
3594 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
3595 * also set the address member in the wdev.
3597 * @del_virtual_intf: remove the virtual interface
3599 * @change_virtual_intf: change type/configuration of virtual interface,
3600 * keep the struct wireless_dev's iftype updated.
3602 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
3603 * when adding a group key.
3605 * @get_key: get information about the key with the given parameters.
3606 * @mac_addr will be %NULL when requesting information for a group
3607 * key. All pointers given to the @callback function need not be valid
3608 * after it returns. This function should return an error if it is
3609 * not possible to retrieve the key, -ENOENT if it doesn't exist.
3611 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3612 * and @key_index, return -ENOENT if the key doesn't exist.
3614 * @set_default_key: set the default key on an interface
3616 * @set_default_mgmt_key: set the default management frame key on an interface
3618 * @set_default_beacon_key: set the default Beacon frame key on an interface
3620 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3622 * @start_ap: Start acting in AP mode defined by the parameters.
3623 * @change_beacon: Change the beacon parameters for an access point mode
3624 * interface. This should reject the call when AP mode wasn't started.
3625 * @stop_ap: Stop being an AP, including stopping beaconing.
3627 * @add_station: Add a new station.
3628 * @del_station: Remove a station
3629 * @change_station: Modify a given station. Note that flags changes are not much
3630 * validated in cfg80211, in particular the auth/assoc/authorized flags
3631 * might come to the driver in invalid combinations -- make sure to check
3632 * them, also against the existing state! Drivers must call
3633 * cfg80211_check_station_change() to validate the information.
3634 * @get_station: get station information for the station identified by @mac
3635 * @dump_station: dump station callback -- resume dump at index @idx
3637 * @add_mpath: add a fixed mesh path
3638 * @del_mpath: delete a given mesh path
3639 * @change_mpath: change a given mesh path
3640 * @get_mpath: get a mesh path for the given parameters
3641 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
3642 * @get_mpp: get a mesh proxy path for the given parameters
3643 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3644 * @join_mesh: join the mesh network with the specified parameters
3645 * (invoked with the wireless_dev mutex held)
3646 * @leave_mesh: leave the current mesh network
3647 * (invoked with the wireless_dev mutex held)
3649 * @get_mesh_config: Get the current mesh configuration
3651 * @update_mesh_config: Update mesh parameters on a running mesh.
3652 * The mask is a bitfield which tells us which parameters to
3653 * set, and which to leave alone.
3655 * @change_bss: Modify parameters for a given BSS.
3657 * @set_txq_params: Set TX queue parameters
3659 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3660 * as it doesn't implement join_mesh and needs to set the channel to
3661 * join the mesh instead.
3663 * @set_monitor_channel: Set the monitor mode channel for the device. If other
3664 * interfaces are active this callback should reject the configuration.
3665 * If no interfaces are active or the device is down, the channel should
3666 * be stored for when a monitor interface becomes active.
3668 * @scan: Request to do a scan. If returning zero, the scan request is given
3669 * the driver, and will be valid until passed to cfg80211_scan_done().
3670 * For scan results, call cfg80211_inform_bss(); you can call this outside
3671 * the scan/scan_done bracket too.
3672 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
3673 * indicate the status of the scan through cfg80211_scan_done().
3675 * @auth: Request to authenticate with the specified peer
3676 * (invoked with the wireless_dev mutex held)
3677 * @assoc: Request to (re)associate with the specified peer
3678 * (invoked with the wireless_dev mutex held)
3679 * @deauth: Request to deauthenticate from the specified peer
3680 * (invoked with the wireless_dev mutex held)
3681 * @disassoc: Request to disassociate from the specified peer
3682 * (invoked with the wireless_dev mutex held)
3684 * @connect: Connect to the ESS with the specified parameters. When connected,
3685 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3686 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3687 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3688 * from the AP or cfg80211_connect_timeout() if no frame with status code
3690 * The driver is allowed to roam to other BSSes within the ESS when the
3691 * other BSS matches the connect parameters. When such roaming is initiated
3692 * by the driver, the driver is expected to verify that the target matches
3693 * the configured security parameters and to use Reassociation Request
3694 * frame instead of Association Request frame.
3695 * The connect function can also be used to request the driver to perform a
3696 * specific roam when connected to an ESS. In that case, the prev_bssid
3697 * parameter is set to the BSSID of the currently associated BSS as an
3698 * indication of requesting reassociation.
3699 * In both the driver-initiated and new connect() call initiated roaming
3700 * cases, the result of roaming is indicated with a call to
3701 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3702 * @update_connect_params: Update the connect parameters while connected to a
3703 * BSS. The updated parameters can be used by driver/firmware for
3704 * subsequent BSS selection (roaming) decisions and to form the
3705 * Authentication/(Re)Association Request frames. This call does not
3706 * request an immediate disassociation or reassociation with the current
3707 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
3708 * changed are defined in &enum cfg80211_connect_params_changed.
3709 * (invoked with the wireless_dev mutex held)
3710 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
3711 * connection is in progress. Once done, call cfg80211_disconnected() in
3712 * case connection was already established (invoked with the
3713 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3715 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
3716 * cfg80211_ibss_joined(), also call that function when changing BSSID due
3718 * (invoked with the wireless_dev mutex held)
3719 * @leave_ibss: Leave the IBSS.
3720 * (invoked with the wireless_dev mutex held)
3722 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3725 * @set_wiphy_params: Notify that wiphy parameters have changed;
3726 * @changed bitfield (see &enum wiphy_params_flags) describes which values
3727 * have changed. The actual parameter values are available in
3728 * struct wiphy. If returning an error, no value should be changed.
3730 * @set_tx_power: set the transmit power according to the parameters,
3731 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3732 * wdev may be %NULL if power was set for the wiphy, and will
3733 * always be %NULL unless the driver supports per-vif TX power
3734 * (as advertised by the nl80211 feature flag.)
3735 * @get_tx_power: store the current TX power into the dbm variable;
3736 * return 0 if successful
3738 * @set_wds_peer: set the WDS peer for a WDS interface
3740 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
3741 * functions to adjust rfkill hw state
3743 * @dump_survey: get site survey information.
3745 * @remain_on_channel: Request the driver to remain awake on the specified
3746 * channel for the specified duration to complete an off-channel
3747 * operation (e.g., public action frame exchange). When the driver is
3748 * ready on the requested channel, it must indicate this with an event
3749 * notification by calling cfg80211_ready_on_channel().
3750 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
3751 * This allows the operation to be terminated prior to timeout based on
3752 * the duration value.
3753 * @mgmt_tx: Transmit a management frame.
3754 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3755 * frame on another channel
3757 * @testmode_cmd: run a test mode command; @wdev may be %NULL
3758 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
3759 * used by the function, but 0 and 1 must not be touched. Additionally,
3760 * return error codes other than -ENOBUFS and -ENOENT will terminate the
3761 * dump and return to userspace with an error, so be careful. If any data
3762 * was passed in from userspace then the data/len arguments will be present
3763 * and point to the data contained in %NL80211_ATTR_TESTDATA.
3765 * @set_bitrate_mask: set the bitrate mask configuration
3767 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
3768 * devices running firmwares capable of generating the (re) association
3769 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
3770 * @del_pmksa: Delete a cached PMKID.
3771 * @flush_pmksa: Flush all cached PMKIDs.
3772 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
3773 * allows the driver to adjust the dynamic ps timeout value.
3774 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3775 * After configuration, the driver should (soon) send an event indicating
3776 * the current level is above/below the configured threshold; this may
3777 * need some care when the configuration is changed (without first being
3779 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
3780 * connection quality monitor. An event is to be sent only when the
3781 * signal level is found to be outside the two values. The driver should
3782 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
3783 * If it is provided then there's no point providing @set_cqm_rssi_config.
3784 * @set_cqm_txe_config: Configure connection quality monitor TX error
3786 * @sched_scan_start: Tell the driver to start a scheduled scan.
3787 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
3788 * given request id. This call must stop the scheduled scan and be ready
3789 * for starting a new one before it returns, i.e. @sched_scan_start may be
3790 * called immediately after that again and should not fail in that case.
3791 * The driver should not call cfg80211_sched_scan_stopped() for a requested
3792 * stop (when this method returns 0).
3794 * @update_mgmt_frame_registrations: Notify the driver that management frame
3795 * registrations were updated. The callback is allowed to sleep.
3797 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3798 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3799 * reject TX/RX mask combinations they cannot support by returning -EINVAL
3800 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3802 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
3804 * @tdls_mgmt: Transmit a TDLS management frame.
3805 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
3807 * @probe_client: probe an associated client, must return a cookie that it
3808 * later passes to cfg80211_probe_status().
3810 * @set_noack_map: Set the NoAck Map for the TIDs.
3812 * @get_channel: Get the current operating channel for the virtual interface.
3813 * For monitor interfaces, it should return %NULL unless there's a single
3814 * current monitoring channel.
3816 * @start_p2p_device: Start the given P2P device.
3817 * @stop_p2p_device: Stop the given P2P device.
3819 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
3820 * Parameters include ACL policy, an array of MAC address of stations
3821 * and the number of MAC addresses. If there is already a list in driver
3822 * this new list replaces the existing one. Driver has to clear its ACL
3823 * when number of MAC addresses entries is passed as 0. Drivers which
3824 * advertise the support for MAC based ACL have to implement this callback.
3826 * @start_radar_detection: Start radar detection in the driver.
3828 * @end_cac: End running CAC, probably because a related CAC
3829 * was finished on another phy.
3831 * @update_ft_ies: Provide updated Fast BSS Transition information to the
3832 * driver. If the SME is in the driver/firmware, this information can be
3833 * used in building Authentication and Reassociation Request frames.
3835 * @crit_proto_start: Indicates a critical protocol needs more link reliability
3836 * for a given duration (milliseconds). The protocol is provided so the
3837 * driver can take the most appropriate actions.
3838 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
3839 * reliability. This operation can not fail.
3840 * @set_coalesce: Set coalesce parameters.
3842 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
3843 * responsible for veryfing if the switch is possible. Since this is
3844 * inherently tricky driver may decide to disconnect an interface later
3845 * with cfg80211_stop_iface(). This doesn't mean driver can accept
3846 * everything. It should do it's best to verify requests and reject them
3847 * as soon as possible.
3849 * @set_qos_map: Set QoS mapping information to the driver
3851 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3852 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3853 * changes during the lifetime of the BSS.
3855 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3856 * with the given parameters; action frame exchange has been handled by
3857 * userspace so this just has to modify the TX path to take the TS into
3859 * If the admitted time is 0 just validate the parameters to make sure
3860 * the session can be created at all; it is valid to just always return
3861 * success for that but that may result in inefficient behaviour (handshake
3862 * with the peer followed by immediate teardown when the addition is later
3864 * @del_tx_ts: remove an existing TX TS
3866 * @join_ocb: join the OCB network with the specified parameters
3867 * (invoked with the wireless_dev mutex held)
3868 * @leave_ocb: leave the current OCB network
3869 * (invoked with the wireless_dev mutex held)
3871 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
3872 * is responsible for continually initiating channel-switching operations
3873 * and returning to the base channel for communication with the AP.
3874 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
3875 * peers must be on the base channel when the call completes.
3876 * @start_nan: Start the NAN interface.
3877 * @stop_nan: Stop the NAN interface.
3878 * @add_nan_func: Add a NAN function. Returns negative value on failure.
3879 * On success @nan_func ownership is transferred to the driver and
3880 * it may access it outside of the scope of this function. The driver
3881 * should free the @nan_func when no longer needed by calling
3882 * cfg80211_free_nan_func().
3883 * On success the driver should assign an instance_id in the
3884 * provided @nan_func.
3885 * @del_nan_func: Delete a NAN function.
3886 * @nan_change_conf: changes NAN configuration. The changed parameters must
3887 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
3888 * All other parameters must be ignored.
3890 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
3892 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3893 * function should return phy stats, and interface stats otherwise.
3895 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
3896 * If not deleted through @del_pmk the PMK remains valid until disconnect
3897 * upon which the driver should clear it.
3898 * (invoked with the wireless_dev mutex held)
3899 * @del_pmk: delete the previously configured PMK for the given authenticator.
3900 * (invoked with the wireless_dev mutex held)
3902 * @external_auth: indicates result of offloaded authentication processing from
3905 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
3906 * tells the driver that the frame should not be encrypted.
3908 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
3909 * Statistics should be cumulative, currently no way to reset is provided.
3910 * @start_pmsr: start peer measurement (e.g. FTM)
3911 * @abort_pmsr: abort peer measurement
3913 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3914 * but offloading OWE processing to the user space will get the updated
3915 * DH IE through this interface.
3917 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
3918 * and overrule HWMP path selection algorithm.
3919 * @set_tid_config: TID specific configuration, this can be peer or BSS specific
3920 * This callback may sleep.
3921 * @reset_tid_config: Reset TID specific configuration for the peer, for the
3922 * given TIDs. This callback may sleep.
3924 struct cfg80211_ops {
3925 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
3926 int (*resume)(struct wiphy *wiphy);
3927 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
3929 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3931 unsigned char name_assign_type,
3932 enum nl80211_iftype type,
3933 struct vif_params *params);
3934 int (*del_virtual_intf)(struct wiphy *wiphy,
3935 struct wireless_dev *wdev);
3936 int (*change_virtual_intf)(struct wiphy *wiphy,
3937 struct net_device *dev,
3938 enum nl80211_iftype type,
3939 struct vif_params *params);
3941 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3942 u8 key_index, bool pairwise, const u8 *mac_addr,
3943 struct key_params *params);
3944 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3945 u8 key_index, bool pairwise, const u8 *mac_addr,
3947 void (*callback)(void *cookie, struct key_params*));
3948 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3949 u8 key_index, bool pairwise, const u8 *mac_addr);
3950 int (*set_default_key)(struct wiphy *wiphy,
3951 struct net_device *netdev,
3952 u8 key_index, bool unicast, bool multicast);
3953 int (*set_default_mgmt_key)(struct wiphy *wiphy,
3954 struct net_device *netdev,
3956 int (*set_default_beacon_key)(struct wiphy *wiphy,
3957 struct net_device *netdev,
3960 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
3961 struct cfg80211_ap_settings *settings);
3962 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
3963 struct cfg80211_beacon_data *info);
3964 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
3967 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
3969 struct station_parameters *params);
3970 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
3971 struct station_del_parameters *params);
3972 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
3974 struct station_parameters *params);
3975 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
3976 const u8 *mac, struct station_info *sinfo);
3977 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
3978 int idx, u8 *mac, struct station_info *sinfo);
3980 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
3981 const u8 *dst, const u8 *next_hop);
3982 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
3984 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
3985 const u8 *dst, const u8 *next_hop);
3986 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
3987 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
3988 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
3989 int idx, u8 *dst, u8 *next_hop,
3990 struct mpath_info *pinfo);
3991 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
3992 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
3993 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
3994 int idx, u8 *dst, u8 *mpp,
3995 struct mpath_info *pinfo);
3996 int (*get_mesh_config)(struct wiphy *wiphy,
3997 struct net_device *dev,
3998 struct mesh_config *conf);
3999 int (*update_mesh_config)(struct wiphy *wiphy,
4000 struct net_device *dev, u32 mask,
4001 const struct mesh_config *nconf);
4002 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
4003 const struct mesh_config *conf,
4004 const struct mesh_setup *setup);
4005 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
4007 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
4008 struct ocb_setup *setup);
4009 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
4011 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
4012 struct bss_parameters *params);
4014 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
4015 struct ieee80211_txq_params *params);
4017 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
4018 struct net_device *dev,
4019 struct ieee80211_channel *chan);
4021 int (*set_monitor_channel)(struct wiphy *wiphy,
4022 struct cfg80211_chan_def *chandef);
4024 int (*scan)(struct wiphy *wiphy,
4025 struct cfg80211_scan_request *request);
4026 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4028 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
4029 struct cfg80211_auth_request *req);
4030 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
4031 struct cfg80211_assoc_request *req);
4032 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
4033 struct cfg80211_deauth_request *req);
4034 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
4035 struct cfg80211_disassoc_request *req);
4037 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
4038 struct cfg80211_connect_params *sme);
4039 int (*update_connect_params)(struct wiphy *wiphy,
4040 struct net_device *dev,
4041 struct cfg80211_connect_params *sme,
4043 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4046 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
4047 struct cfg80211_ibss_params *params);
4048 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4050 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
4051 int rate[NUM_NL80211_BANDS]);
4053 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
4055 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4056 enum nl80211_tx_power_setting type, int mbm);
4057 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4060 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
4063 void (*rfkill_poll)(struct wiphy *wiphy);
4065 #ifdef CONFIG_NL80211_TESTMODE
4066 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4067 void *data, int len);
4068 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
4069 struct netlink_callback *cb,
4070 void *data, int len);
4073 int (*set_bitrate_mask)(struct wiphy *wiphy,
4074 struct net_device *dev,
4076 const struct cfg80211_bitrate_mask *mask);
4078 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
4079 int idx, struct survey_info *info);
4081 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4082 struct cfg80211_pmksa *pmksa);
4083 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4084 struct cfg80211_pmksa *pmksa);
4085 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
4087 int (*remain_on_channel)(struct wiphy *wiphy,
4088 struct wireless_dev *wdev,
4089 struct ieee80211_channel *chan,
4090 unsigned int duration,
4092 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
4093 struct wireless_dev *wdev,
4096 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4097 struct cfg80211_mgmt_tx_params *params,
4099 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
4100 struct wireless_dev *wdev,
4103 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4104 bool enabled, int timeout);
4106 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
4107 struct net_device *dev,
4108 s32 rssi_thold, u32 rssi_hyst);
4110 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
4111 struct net_device *dev,
4112 s32 rssi_low, s32 rssi_high);
4114 int (*set_cqm_txe_config)(struct wiphy *wiphy,
4115 struct net_device *dev,
4116 u32 rate, u32 pkts, u32 intvl);
4118 void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,
4119 struct wireless_dev *wdev,
4120 struct mgmt_frame_regs *upd);
4122 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4123 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
4125 int (*sched_scan_start)(struct wiphy *wiphy,
4126 struct net_device *dev,
4127 struct cfg80211_sched_scan_request *request);
4128 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
4131 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4132 struct cfg80211_gtk_rekey_data *data);
4134 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4135 const u8 *peer, u8 action_code, u8 dialog_token,
4136 u16 status_code, u32 peer_capability,
4137 bool initiator, const u8 *buf, size_t len);
4138 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
4139 const u8 *peer, enum nl80211_tdls_operation oper);
4141 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
4142 const u8 *peer, u64 *cookie);
4144 int (*set_noack_map)(struct wiphy *wiphy,
4145 struct net_device *dev,
4148 int (*get_channel)(struct wiphy *wiphy,
4149 struct wireless_dev *wdev,
4150 struct cfg80211_chan_def *chandef);
4152 int (*start_p2p_device)(struct wiphy *wiphy,
4153 struct wireless_dev *wdev);
4154 void (*stop_p2p_device)(struct wiphy *wiphy,
4155 struct wireless_dev *wdev);
4157 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
4158 const struct cfg80211_acl_data *params);
4160 int (*start_radar_detection)(struct wiphy *wiphy,
4161 struct net_device *dev,
4162 struct cfg80211_chan_def *chandef,
4164 void (*end_cac)(struct wiphy *wiphy,
4165 struct net_device *dev);
4166 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4167 struct cfg80211_update_ft_ies_params *ftie);
4168 int (*crit_proto_start)(struct wiphy *wiphy,
4169 struct wireless_dev *wdev,
4170 enum nl80211_crit_proto_id protocol,
4172 void (*crit_proto_stop)(struct wiphy *wiphy,
4173 struct wireless_dev *wdev);
4174 int (*set_coalesce)(struct wiphy *wiphy,
4175 struct cfg80211_coalesce *coalesce);
4177 int (*channel_switch)(struct wiphy *wiphy,
4178 struct net_device *dev,
4179 struct cfg80211_csa_settings *params);
4181 int (*set_qos_map)(struct wiphy *wiphy,
4182 struct net_device *dev,
4183 struct cfg80211_qos_map *qos_map);
4185 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4186 struct cfg80211_chan_def *chandef);
4188 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4189 u8 tsid, const u8 *peer, u8 user_prio,
4191 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4192 u8 tsid, const u8 *peer);
4194 int (*tdls_channel_switch)(struct wiphy *wiphy,
4195 struct net_device *dev,
4196 const u8 *addr, u8 oper_class,
4197 struct cfg80211_chan_def *chandef);
4198 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
4199 struct net_device *dev,
4201 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4202 struct cfg80211_nan_conf *conf);
4203 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4204 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4205 struct cfg80211_nan_func *nan_func);
4206 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4208 int (*nan_change_conf)(struct wiphy *wiphy,
4209 struct wireless_dev *wdev,
4210 struct cfg80211_nan_conf *conf,
4213 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
4214 struct net_device *dev,
4215 const bool enabled);
4217 int (*get_txq_stats)(struct wiphy *wiphy,
4218 struct wireless_dev *wdev,
4219 struct cfg80211_txq_stats *txqstats);
4221 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
4222 const struct cfg80211_pmk_conf *conf);
4223 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
4225 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
4226 struct cfg80211_external_auth_params *params);
4228 int (*tx_control_port)(struct wiphy *wiphy,
4229 struct net_device *dev,
4230 const u8 *buf, size_t len,
4231 const u8 *dest, const __be16 proto,
4232 const bool noencrypt,
4235 int (*get_ftm_responder_stats)(struct wiphy *wiphy,
4236 struct net_device *dev,
4237 struct cfg80211_ftm_responder_stats *ftm_stats);
4239 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4240 struct cfg80211_pmsr_request *request);
4241 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4242 struct cfg80211_pmsr_request *request);
4243 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4244 struct cfg80211_update_owe_info *owe_info);
4245 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
4246 const u8 *buf, size_t len);
4247 int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4248 struct cfg80211_tid_config *tid_conf);
4249 int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4250 const u8 *peer, u8 tids);
4254 * wireless hardware and networking interfaces structures
4255 * and registration/helper functions
4259 * enum wiphy_flags - wiphy capability flags
4261 * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4262 * into two, first for legacy bands and second for UHB.
4263 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
4265 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
4266 * by default -- this flag will be set depending on the kernel's default
4267 * on wiphy_new(), but can be changed by the driver if it has a good
4268 * reason to override the default
4269 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
4270 * on a VLAN interface). This flag also serves an extra purpose of
4271 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
4272 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4273 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4274 * control port protocol ethertype. The device also honours the
4275 * control_port_no_encrypt flag.
4276 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
4277 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
4278 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4279 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4281 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4282 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4283 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4284 * link setup/discovery operations internally. Setup, discovery and
4285 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4286 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4287 * used for asking the driver/firmware to perform a TDLS operation.
4288 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
4289 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
4290 * when there are virtual interfaces in AP mode by calling
4291 * cfg80211_report_obss_beacon().
4292 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
4293 * responds to probe-requests in hardware.
4294 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
4295 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
4296 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
4297 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
4298 * beaconing mode (AP, IBSS, Mesh, ...).
4299 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4300 * before connection.
4301 * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
4304 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
4306 WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),
4307 WIPHY_FLAG_NETNS_OK = BIT(3),
4308 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
4309 WIPHY_FLAG_4ADDR_AP = BIT(5),
4310 WIPHY_FLAG_4ADDR_STATION = BIT(6),
4311 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
4312 WIPHY_FLAG_IBSS_RSN = BIT(8),
4313 WIPHY_FLAG_MESH_AUTH = BIT(10),
4314 /* use hole at 11 */
4315 /* use hole at 12 */
4316 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
4317 WIPHY_FLAG_AP_UAPSD = BIT(14),
4318 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
4319 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
4320 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
4321 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
4322 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
4323 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
4324 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
4325 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
4326 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
4327 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
4331 * struct ieee80211_iface_limit - limit on certain interface types
4332 * @max: maximum number of interfaces of these types
4333 * @types: interface types (bits)
4335 struct ieee80211_iface_limit {
4341 * struct ieee80211_iface_combination - possible interface combination
4343 * With this structure the driver can describe which interface
4344 * combinations it supports concurrently.
4348 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
4352 * struct ieee80211_iface_limit limits1[] = {
4353 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4354 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
4356 * struct ieee80211_iface_combination combination1 = {
4357 * .limits = limits1,
4358 * .n_limits = ARRAY_SIZE(limits1),
4359 * .max_interfaces = 2,
4360 * .beacon_int_infra_match = true,
4364 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
4368 * struct ieee80211_iface_limit limits2[] = {
4369 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
4370 * BIT(NL80211_IFTYPE_P2P_GO), },
4372 * struct ieee80211_iface_combination combination2 = {
4373 * .limits = limits2,
4374 * .n_limits = ARRAY_SIZE(limits2),
4375 * .max_interfaces = 8,
4376 * .num_different_channels = 1,
4380 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4382 * This allows for an infrastructure connection and three P2P connections.
4386 * struct ieee80211_iface_limit limits3[] = {
4387 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4388 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
4389 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
4391 * struct ieee80211_iface_combination combination3 = {
4392 * .limits = limits3,
4393 * .n_limits = ARRAY_SIZE(limits3),
4394 * .max_interfaces = 4,
4395 * .num_different_channels = 2,
4399 struct ieee80211_iface_combination {
4402 * limits for the given interface types
4404 const struct ieee80211_iface_limit *limits;
4407 * @num_different_channels:
4408 * can use up to this many different channels
4410 u32 num_different_channels;
4414 * maximum number of interfaces in total allowed in this group
4420 * number of limitations
4425 * @beacon_int_infra_match:
4426 * In this combination, the beacon intervals between infrastructure
4427 * and AP types must match. This is required only in special cases.
4429 bool beacon_int_infra_match;
4432 * @radar_detect_widths:
4433 * bitmap of channel widths supported for radar detection
4435 u8 radar_detect_widths;
4438 * @radar_detect_regions:
4439 * bitmap of regions supported for radar detection
4441 u8 radar_detect_regions;
4444 * @beacon_int_min_gcd:
4445 * This interface combination supports different beacon intervals.
4448 * all beacon intervals for different interface must be same.
4450 * any beacon interval for the interface part of this combination AND
4451 * GCD of all beacon intervals from beaconing interfaces of this
4452 * combination must be greater or equal to this value.
4454 u32 beacon_int_min_gcd;
4457 struct ieee80211_txrx_stypes {
4462 * enum wiphy_wowlan_support_flags - WoWLAN support flags
4463 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4464 * trigger that keeps the device operating as-is and
4465 * wakes up the host on any activity, for example a
4466 * received packet that passed filtering; note that the
4467 * packet should be preserved in that case
4468 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4470 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
4471 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
4472 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
4473 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
4474 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
4475 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
4476 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4478 enum wiphy_wowlan_support_flags {
4479 WIPHY_WOWLAN_ANY = BIT(0),
4480 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
4481 WIPHY_WOWLAN_DISCONNECT = BIT(2),
4482 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
4483 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
4484 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
4485 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
4486 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
4487 WIPHY_WOWLAN_NET_DETECT = BIT(8),
4490 struct wiphy_wowlan_tcp_support {
4491 const struct nl80211_wowlan_tcp_data_token_feature *tok;
4492 u32 data_payload_max;
4493 u32 data_interval_max;
4494 u32 wake_payload_max;
4499 * struct wiphy_wowlan_support - WoWLAN support data
4500 * @flags: see &enum wiphy_wowlan_support_flags
4501 * @n_patterns: number of supported wakeup patterns
4502 * (see nl80211.h for the pattern definition)
4503 * @pattern_max_len: maximum length of each pattern
4504 * @pattern_min_len: minimum length of each pattern
4505 * @max_pkt_offset: maximum Rx packet offset
4506 * @max_nd_match_sets: maximum number of matchsets for net-detect,
4507 * similar, but not necessarily identical, to max_match_sets for
4509 * See &struct cfg80211_sched_scan_request.@match_sets for more
4511 * @tcp: TCP wakeup support information
4513 struct wiphy_wowlan_support {
4516 int pattern_max_len;
4517 int pattern_min_len;
4519 int max_nd_match_sets;
4520 const struct wiphy_wowlan_tcp_support *tcp;
4524 * struct wiphy_coalesce_support - coalesce support data
4525 * @n_rules: maximum number of coalesce rules
4526 * @max_delay: maximum supported coalescing delay in msecs
4527 * @n_patterns: number of supported patterns in a rule
4528 * (see nl80211.h for the pattern definition)
4529 * @pattern_max_len: maximum length of each pattern
4530 * @pattern_min_len: minimum length of each pattern
4531 * @max_pkt_offset: maximum Rx packet offset
4533 struct wiphy_coalesce_support {
4537 int pattern_max_len;
4538 int pattern_min_len;
4543 * enum wiphy_vendor_command_flags - validation flags for vendor commands
4544 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4545 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4546 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4547 * (must be combined with %_WDEV or %_NETDEV)
4549 enum wiphy_vendor_command_flags {
4550 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4551 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4552 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4556 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4558 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4559 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4560 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4563 enum wiphy_opmode_flag {
4564 STA_OPMODE_MAX_BW_CHANGED = BIT(0),
4565 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
4566 STA_OPMODE_N_SS_CHANGED = BIT(2),
4570 * struct sta_opmode_info - Station's ht/vht operation mode information
4571 * @changed: contains value from &enum wiphy_opmode_flag
4572 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
4573 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4574 * @rx_nss: new rx_nss value of a station
4577 struct sta_opmode_info {
4579 enum nl80211_smps_mode smps_mode;
4580 enum nl80211_chan_width bw;
4584 #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4587 * struct wiphy_vendor_command - vendor command definition
4588 * @info: vendor command identifying information, as used in nl80211
4589 * @flags: flags, see &enum wiphy_vendor_command_flags
4590 * @doit: callback for the operation, note that wdev is %NULL if the
4591 * flags didn't ask for a wdev and non-%NULL otherwise; the data
4592 * pointer may be %NULL if userspace provided no data at all
4593 * @dumpit: dump callback, for transferring bigger/multiple items. The
4594 * @storage points to cb->args[5], ie. is preserved over the multiple
4596 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4597 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4598 * attribute is just raw data (e.g. a firmware command).
4599 * @maxattr: highest attribute number in policy
4600 * It's recommended to not have the same sub command with both @doit and
4601 * @dumpit, so that userspace can assume certain ones are get and others
4602 * are used with dump requests.
4604 struct wiphy_vendor_command {
4605 struct nl80211_vendor_cmd_info info;
4607 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4608 const void *data, int data_len);
4609 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4610 struct sk_buff *skb, const void *data, int data_len,
4611 unsigned long *storage);
4612 const struct nla_policy *policy;
4613 unsigned int maxattr;
4617 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4618 * @iftype: interface type
4619 * @extended_capabilities: extended capabilities supported by the driver,
4620 * additional capabilities might be supported by userspace; these are the
4621 * 802.11 extended capabilities ("Extended Capabilities element") and are
4622 * in the same format as in the information element. See IEEE Std
4623 * 802.11-2012 8.4.2.29 for the defined fields.
4624 * @extended_capabilities_mask: mask of the valid values
4625 * @extended_capabilities_len: length of the extended capabilities
4627 struct wiphy_iftype_ext_capab {
4628 enum nl80211_iftype iftype;
4629 const u8 *extended_capabilities;
4630 const u8 *extended_capabilities_mask;
4631 u8 extended_capabilities_len;
4635 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4636 * @max_peers: maximum number of peers in a single measurement
4637 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4638 * @randomize_mac_addr: can randomize MAC address for measurement
4639 * @ftm.supported: FTM measurement is supported
4640 * @ftm.asap: ASAP-mode is supported
4641 * @ftm.non_asap: non-ASAP-mode is supported
4642 * @ftm.request_lci: can request LCI data
4643 * @ftm.request_civicloc: can request civic location data
4644 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4645 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4646 * @ftm.max_bursts_exponent: maximum burst exponent supported
4647 * (set to -1 if not limited; note that setting this will necessarily
4648 * forbid using the value 15 to let the responder pick)
4649 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4651 * @ftm.trigger_based: trigger based ranging measurement is supported
4652 * @ftm.non_trigger_based: non trigger based ranging measurement is supported
4654 struct cfg80211_pmsr_capabilities {
4655 unsigned int max_peers;
4657 randomize_mac_addr:1;
4662 s8 max_bursts_exponent;
4663 u8 max_ftms_per_burst;
4670 non_trigger_based:1;
4675 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4676 * suites for interface types defined in @iftypes_mask. Each type in the
4677 * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4679 * @iftypes_mask: bitmask of interfaces types
4680 * @akm_suites: points to an array of supported akm suites
4681 * @n_akm_suites: number of supported AKM suites
4683 struct wiphy_iftype_akm_suites {
4685 const u32 *akm_suites;
4690 * struct wiphy - wireless hardware description
4691 * @reg_notifier: the driver's regulatory notification callback,
4692 * note that if your driver uses wiphy_apply_custom_regulatory()
4693 * the reg_notifier's request can be passed as NULL
4694 * @regd: the driver's regulatory domain, if one was requested via
4695 * the regulatory_hint() API. This can be used by the driver
4696 * on the reg_notifier() if it chooses to ignore future
4697 * regulatory domain changes caused by other drivers.
4698 * @signal_type: signal type reported in &struct cfg80211_bss.
4699 * @cipher_suites: supported cipher suites
4700 * @n_cipher_suites: number of supported cipher suites
4701 * @akm_suites: supported AKM suites. These are the default AKMs supported if
4702 * the supported AKMs not advertized for a specific interface type in
4703 * iftype_akm_suites.
4704 * @n_akm_suites: number of supported AKM suites
4705 * @iftype_akm_suites: array of supported akm suites info per interface type.
4706 * Note that the bits in @iftypes_mask inside this structure cannot
4707 * overlap (i.e. only one occurrence of each type is allowed across all
4708 * instances of iftype_akm_suites).
4709 * @num_iftype_akm_suites: number of interface types for which supported akm
4710 * suites are specified separately.
4711 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4712 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4713 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4714 * -1 = fragmentation disabled, only odd values >= 256 used
4715 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4716 * @_net: the network namespace this wiphy currently lives in
4717 * @perm_addr: permanent MAC address of this device
4718 * @addr_mask: If the device supports multiple MAC addresses by masking,
4719 * set this to a mask with variable bits set to 1, e.g. if the last
4720 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
4721 * variable bits shall be determined by the interfaces added, with
4722 * interfaces not matching the mask being rejected to be brought up.
4723 * @n_addresses: number of addresses in @addresses.
4724 * @addresses: If the device has more than one address, set this pointer
4725 * to a list of addresses (6 bytes each). The first one will be used
4726 * by default for perm_addr. In this case, the mask should be set to
4727 * all-zeroes. In this case it is assumed that the device can handle
4728 * the same number of arbitrary MAC addresses.
4729 * @registered: protects ->resume and ->suspend sysfs callbacks against
4730 * unregister hardware
4731 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4732 * It will be renamed automatically on wiphy renames
4733 * @dev: (virtual) struct device for this wiphy. The item in
4734 * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
4736 * @wext: wireless extension handlers
4737 * @priv: driver private data (sized according to wiphy_new() parameter)
4738 * @interface_modes: bitmask of interfaces types valid for this wiphy,
4739 * must be set by driver
4740 * @iface_combinations: Valid interface combinations array, should not
4741 * list single interface types.
4742 * @n_iface_combinations: number of entries in @iface_combinations array.
4743 * @software_iftypes: bitmask of software interface types, these are not
4744 * subject to any restrictions since they are purely managed in SW.
4745 * @flags: wiphy flags, see &enum wiphy_flags
4746 * @regulatory_flags: wiphy regulatory flags, see
4747 * &enum ieee80211_regulatory_flags
4748 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4749 * @ext_features: extended features advertised to nl80211, see
4750 * &enum nl80211_ext_feature_index.
4751 * @bss_priv_size: each BSS struct has private data allocated with it,
4752 * this variable determines its size
4753 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4755 * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4756 * the device can run concurrently.
4757 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
4758 * for in any given scheduled scan
4759 * @max_match_sets: maximum number of match sets the device can handle
4760 * when performing a scheduled scan, 0 if filtering is not
4762 * @max_scan_ie_len: maximum length of user-controlled IEs device can
4763 * add to probe request frames transmitted during a scan, must not
4764 * include fixed IEs like supported rates
4765 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
4767 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
4768 * of iterations) for scheduled scan supported by the device.
4769 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
4770 * single scan plan supported by the device.
4771 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
4772 * scan plan supported by the device.
4773 * @coverage_class: current coverage class
4774 * @fw_version: firmware version for ethtool reporting
4775 * @hw_version: hardware version for ethtool reporting
4776 * @max_num_pmkids: maximum number of PMKIDs supported by device
4777 * @privid: a pointer that drivers can use to identify if an arbitrary
4778 * wiphy is theirs, e.g. in global notifiers
4779 * @bands: information about bands/channels supported by this device
4781 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
4782 * transmitted through nl80211, points to an array indexed by interface
4785 * @available_antennas_tx: bitmap of antennas which are available to be
4786 * configured as TX antennas. Antenna configuration commands will be
4787 * rejected unless this or @available_antennas_rx is set.
4789 * @available_antennas_rx: bitmap of antennas which are available to be
4790 * configured as RX antennas. Antenna configuration commands will be
4791 * rejected unless this or @available_antennas_tx is set.
4793 * @probe_resp_offload:
4794 * Bitmap of supported protocols for probe response offloading.
4795 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
4796 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4798 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4799 * may request, if implemented.
4801 * @wowlan: WoWLAN support information
4802 * @wowlan_config: current WoWLAN configuration; this should usually not be
4803 * used since access to it is necessarily racy, use the parameter passed
4804 * to the suspend() operation instead.
4806 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
4807 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
4808 * If null, then none can be over-ridden.
4809 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
4810 * If null, then none can be over-ridden.
4812 * @wdev_list: the list of associated (virtual) interfaces; this list must
4813 * not be modified by the driver, but can be read with RTNL/RCU protection.
4815 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
4818 * @extended_capabilities: extended capabilities supported by the driver,
4819 * additional capabilities might be supported by userspace; these are
4820 * the 802.11 extended capabilities ("Extended Capabilities element")
4821 * and are in the same format as in the information element. See
4822 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
4823 * extended capabilities to be used if the capabilities are not specified
4824 * for a specific interface type in iftype_ext_capab.
4825 * @extended_capabilities_mask: mask of the valid values
4826 * @extended_capabilities_len: length of the extended capabilities
4827 * @iftype_ext_capab: array of extended capabilities per interface type
4828 * @num_iftype_ext_capab: number of interface types for which extended
4829 * capabilities are specified separately.
4830 * @coalesce: packet coalescing support information
4832 * @vendor_commands: array of vendor commands supported by the hardware
4833 * @n_vendor_commands: number of vendor commands
4834 * @vendor_events: array of vendor events supported by the hardware
4835 * @n_vendor_events: number of vendor events
4837 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4838 * (including P2P GO) or 0 to indicate no such limit is advertised. The
4839 * driver is allowed to advertise a theoretical limit that it can reach in
4840 * some cases, but may not always reach.
4842 * @max_num_csa_counters: Number of supported csa_counters in beacons
4843 * and probe responses. This value should be set if the driver
4844 * wishes to limit the number of csa counters. Default (0) means
4846 * @bss_select_support: bitmask indicating the BSS selection criteria supported
4847 * by the driver in the .connect() callback. The bit position maps to the
4848 * attribute indices defined in &enum nl80211_bss_select_attr.
4850 * @nan_supported_bands: bands supported by the device in NAN mode, a
4851 * bitmap of &enum nl80211_band values. For instance, for
4852 * NL80211_BAND_2GHZ, bit 0 would be set
4853 * (i.e. BIT(NL80211_BAND_2GHZ)).
4855 * @txq_limit: configuration of internal TX queue frame limit
4856 * @txq_memory_limit: configuration internal TX queue memory limit
4857 * @txq_quantum: configuration of internal TX queue scheduler quantum
4859 * @tx_queue_len: allow setting transmit queue len for drivers not using
4862 * @support_mbssid: can HW support association with nontransmitted AP
4863 * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4864 * HE AP, in order to avoid compatibility issues.
4865 * @support_mbssid must be set for this to have any effect.
4867 * @pmsr_capa: peer measurement capabilities
4869 * @tid_config_support: describes the per-TID config support that the
4871 * @tid_config_support.vif: bitmap of attributes (configurations)
4872 * supported by the driver for each vif
4873 * @tid_config_support.peer: bitmap of attributes (configurations)
4874 * supported by the driver for each peer
4875 * @tid_config_support.max_retry: maximum supported retry count for
4876 * long/short retry configuration
4878 * @max_data_retry_count: maximum supported per TID retry count for
4879 * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
4880 * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
4883 /* assign these fields before you register the wiphy */
4885 u8 perm_addr[ETH_ALEN];
4886 u8 addr_mask[ETH_ALEN];
4888 struct mac_address *addresses;
4890 const struct ieee80211_txrx_stypes *mgmt_stypes;
4892 const struct ieee80211_iface_combination *iface_combinations;
4893 int n_iface_combinations;
4894 u16 software_iftypes;
4898 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4899 u16 interface_modes;
4901 u16 max_acl_mac_addrs;
4903 u32 flags, regulatory_flags, features;
4904 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4908 enum cfg80211_signal_type signal_type;
4912 u8 max_sched_scan_reqs;
4913 u8 max_sched_scan_ssids;
4915 u16 max_scan_ie_len;
4916 u16 max_sched_scan_ie_len;
4917 u32 max_sched_scan_plans;
4918 u32 max_sched_scan_plan_interval;
4919 u32 max_sched_scan_plan_iterations;
4921 int n_cipher_suites;
4922 const u32 *cipher_suites;
4925 const u32 *akm_suites;
4927 const struct wiphy_iftype_akm_suites *iftype_akm_suites;
4928 unsigned int num_iftype_akm_suites;
4936 char fw_version[ETHTOOL_FWVERS_LEN];
4940 const struct wiphy_wowlan_support *wowlan;
4941 struct cfg80211_wowlan *wowlan_config;
4944 u16 max_remain_on_channel_duration;
4948 u32 available_antennas_tx;
4949 u32 available_antennas_rx;
4951 u32 probe_resp_offload;
4953 const u8 *extended_capabilities, *extended_capabilities_mask;
4954 u8 extended_capabilities_len;
4956 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4957 unsigned int num_iftype_ext_capab;
4961 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
4963 void (*reg_notifier)(struct wiphy *wiphy,
4964 struct regulatory_request *request);
4966 /* fields below are read-only, assigned by cfg80211 */
4968 const struct ieee80211_regdomain __rcu *regd;
4974 struct dentry *debugfsdir;
4976 const struct ieee80211_ht_cap *ht_capa_mod_mask;
4977 const struct ieee80211_vht_cap *vht_capa_mod_mask;
4979 struct list_head wdev_list;
4981 possible_net_t _net;
4983 #ifdef CONFIG_CFG80211_WEXT
4984 const struct iw_handler_def *wext;
4987 const struct wiphy_coalesce_support *coalesce;
4989 const struct wiphy_vendor_command *vendor_commands;
4990 const struct nl80211_vendor_cmd_info *vendor_events;
4991 int n_vendor_commands, n_vendor_events;
4993 u16 max_ap_assoc_sta;
4995 u8 max_num_csa_counters;
4997 u32 bss_select_support;
4999 u8 nan_supported_bands;
5002 u32 txq_memory_limit;
5005 unsigned long tx_queue_len;
5007 u8 support_mbssid:1,
5008 support_only_he_mbssid:1;
5010 const struct cfg80211_pmsr_capabilities *pmsr_capa;
5015 } tid_config_support;
5017 u8 max_data_retry_count;
5019 char priv[] __aligned(NETDEV_ALIGN);
5022 static inline struct net *wiphy_net(struct wiphy *wiphy)
5024 return read_pnet(&wiphy->_net);
5027 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5029 write_pnet(&wiphy->_net, net);
5033 * wiphy_priv - return priv from wiphy
5035 * @wiphy: the wiphy whose priv pointer to return
5036 * Return: The priv of @wiphy.
5038 static inline void *wiphy_priv(struct wiphy *wiphy)
5041 return &wiphy->priv;
5045 * priv_to_wiphy - return the wiphy containing the priv
5047 * @priv: a pointer previously returned by wiphy_priv
5048 * Return: The wiphy of @priv.
5050 static inline struct wiphy *priv_to_wiphy(void *priv)
5053 return container_of(priv, struct wiphy, priv);
5057 * set_wiphy_dev - set device pointer for wiphy
5059 * @wiphy: The wiphy whose device to bind
5060 * @dev: The device to parent it to
5062 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5064 wiphy->dev.parent = dev;
5068 * wiphy_dev - get wiphy dev pointer
5070 * @wiphy: The wiphy whose device struct to look up
5071 * Return: The dev of @wiphy.
5073 static inline struct device *wiphy_dev(struct wiphy *wiphy)
5075 return wiphy->dev.parent;
5079 * wiphy_name - get wiphy name
5081 * @wiphy: The wiphy whose name to return
5082 * Return: The name of @wiphy.
5084 static inline const char *wiphy_name(const struct wiphy *wiphy)
5086 return dev_name(&wiphy->dev);
5090 * wiphy_new_nm - create a new wiphy for use with cfg80211
5092 * @ops: The configuration operations for this device
5093 * @sizeof_priv: The size of the private area to allocate
5094 * @requested_name: Request a particular name.
5095 * NULL is valid value, and means use the default phy%d naming.
5097 * Create a new wiphy and associate the given operations with it.
5098 * @sizeof_priv bytes are allocated for private use.
5100 * Return: A pointer to the new wiphy. This pointer must be
5101 * assigned to each netdev's ieee80211_ptr for proper operation.
5103 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
5104 const char *requested_name);
5107 * wiphy_new - create a new wiphy for use with cfg80211
5109 * @ops: The configuration operations for this device
5110 * @sizeof_priv: The size of the private area to allocate
5112 * Create a new wiphy and associate the given operations with it.
5113 * @sizeof_priv bytes are allocated for private use.
5115 * Return: A pointer to the new wiphy. This pointer must be
5116 * assigned to each netdev's ieee80211_ptr for proper operation.
5118 static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
5121 return wiphy_new_nm(ops, sizeof_priv, NULL);
5125 * wiphy_register - register a wiphy with cfg80211
5127 * @wiphy: The wiphy to register.
5129 * Return: A non-negative wiphy index or a negative error code.
5131 int wiphy_register(struct wiphy *wiphy);
5134 * wiphy_unregister - deregister a wiphy from cfg80211
5136 * @wiphy: The wiphy to unregister.
5138 * After this call, no more requests can be made with this priv
5139 * pointer, but the call may sleep to wait for an outstanding
5140 * request that is being handled.
5142 void wiphy_unregister(struct wiphy *wiphy);
5145 * wiphy_free - free wiphy
5147 * @wiphy: The wiphy to free
5149 void wiphy_free(struct wiphy *wiphy);
5151 /* internal structs */
5152 struct cfg80211_conn;
5153 struct cfg80211_internal_bss;
5154 struct cfg80211_cached_keys;
5155 struct cfg80211_cqm_config;
5158 * struct wireless_dev - wireless device state
5160 * For netdevs, this structure must be allocated by the driver
5161 * that uses the ieee80211_ptr field in struct net_device (this
5162 * is intentional so it can be allocated along with the netdev.)
5163 * It need not be registered then as netdev registration will
5164 * be intercepted by cfg80211 to see the new wireless device.
5166 * For non-netdev uses, it must also be allocated by the driver
5167 * in response to the cfg80211 callbacks that require it, as
5168 * there's no netdev registration in that case it may not be
5169 * allocated outside of callback operations that return it.
5171 * @wiphy: pointer to hardware description
5172 * @iftype: interface type
5173 * @list: (private) Used to collect the interfaces
5174 * @netdev: (private) Used to reference back to the netdev, may be %NULL
5175 * @identifier: (private) Identifier used in nl80211 to identify this
5176 * wireless device if it has no netdev
5177 * @current_bss: (private) Used by the internal configuration code
5178 * @chandef: (private) Used by the internal configuration code to track
5179 * the user-set channel definition.
5180 * @preset_chandef: (private) Used by the internal configuration code to
5181 * track the channel to be used for AP later
5182 * @bssid: (private) Used by the internal configuration code
5183 * @ssid: (private) Used by the internal configuration code
5184 * @ssid_len: (private) Used by the internal configuration code
5185 * @mesh_id_len: (private) Used by the internal configuration code
5186 * @mesh_id_up_len: (private) Used by the internal configuration code
5187 * @wext: (private) Used by the internal wireless extensions compat code
5188 * @wext.ibss: (private) IBSS data part of wext handling
5189 * @wext.connect: (private) connection handling data
5190 * @wext.keys: (private) (WEP) key data
5191 * @wext.ie: (private) extra elements for association
5192 * @wext.ie_len: (private) length of extra elements
5193 * @wext.bssid: (private) selected network BSSID
5194 * @wext.ssid: (private) selected network SSID
5195 * @wext.default_key: (private) selected default key index
5196 * @wext.default_mgmt_key: (private) selected default management key index
5197 * @wext.prev_bssid: (private) previous BSSID for reassociation
5198 * @wext.prev_bssid_valid: (private) previous BSSID validity
5199 * @use_4addr: indicates 4addr mode is used on this interface, must be
5200 * set by driver (if supported) on add_interface BEFORE registering the
5201 * netdev and may otherwise be used by driver read-only, will be update
5202 * by cfg80211 on change_interface
5203 * @mgmt_registrations: list of registrations for management frames
5204 * @mgmt_registrations_lock: lock for the list
5205 * @mgmt_registrations_need_update: mgmt registrations were updated,
5206 * need to propagate the update to the driver
5207 * @mtx: mutex used to lock data in this struct, may be used by drivers
5208 * and some API functions require it held
5209 * @beacon_interval: beacon interval used on this device for transmitting
5210 * beacons, 0 when not valid
5211 * @address: The address for this device, valid only if @netdev is %NULL
5212 * @is_running: true if this is a non-netdev device that has been started, e.g.
5214 * @cac_started: true if DFS channel availability check has been started
5215 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
5216 * @cac_time_ms: CAC time in ms
5217 * @ps: powersave mode is enabled
5218 * @ps_timeout: dynamic powersave timeout
5219 * @ap_unexpected_nlportid: (private) netlink port ID of application
5220 * registered for unexpected class 3 frames (AP mode)
5221 * @conn: (private) cfg80211 software SME connection state machine data
5222 * @connect_keys: (private) keys to set after connection is established
5223 * @conn_bss_type: connecting/connected BSS type
5224 * @conn_owner_nlportid: (private) connection owner socket port ID
5225 * @disconnect_wk: (private) auto-disconnect work
5226 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5227 * @ibss_fixed: (private) IBSS is using fixed BSSID
5228 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
5229 * @event_list: (private) list for internal event processing
5230 * @event_lock: (private) lock for event list
5231 * @owner_nlportid: (private) owner socket port ID
5232 * @nl_owner_dead: (private) owner socket went away
5233 * @cqm_config: (private) nl80211 RSSI monitor state
5234 * @pmsr_list: (private) peer measurement requests
5235 * @pmsr_lock: (private) peer measurements requests/results lock
5236 * @pmsr_free_wk: (private) peer measurements cleanup work
5237 * @unprot_beacon_reported: (private) timestamp of last
5238 * unprotected beacon report
5240 struct wireless_dev {
5241 struct wiphy *wiphy;
5242 enum nl80211_iftype iftype;
5244 /* the remainder of this struct should be private to cfg80211 */
5245 struct list_head list;
5246 struct net_device *netdev;
5250 struct list_head mgmt_registrations;
5251 spinlock_t mgmt_registrations_lock;
5252 u8 mgmt_registrations_need_update:1;
5256 bool use_4addr, is_running;
5258 u8 address[ETH_ALEN] __aligned(sizeof(u16));
5260 /* currently used for IBSS and SME - might be rearranged later */
5261 u8 ssid[IEEE80211_MAX_SSID_LEN];
5262 u8 ssid_len, mesh_id_len, mesh_id_up_len;
5263 struct cfg80211_conn *conn;
5264 struct cfg80211_cached_keys *connect_keys;
5265 enum ieee80211_bss_type conn_bss_type;
5266 u32 conn_owner_nlportid;
5268 struct work_struct disconnect_wk;
5269 u8 disconnect_bssid[ETH_ALEN];
5271 struct list_head event_list;
5272 spinlock_t event_lock;
5274 struct cfg80211_internal_bss *current_bss; /* associated / joined */
5275 struct cfg80211_chan_def preset_chandef;
5276 struct cfg80211_chan_def chandef;
5279 bool ibss_dfs_possible;
5284 int beacon_interval;
5286 u32 ap_unexpected_nlportid;
5292 unsigned long cac_start_time;
5293 unsigned int cac_time_ms;
5295 #ifdef CONFIG_CFG80211_WEXT
5298 struct cfg80211_ibss_params ibss;
5299 struct cfg80211_connect_params connect;
5300 struct cfg80211_cached_keys *keys;
5304 u8 prev_bssid[ETH_ALEN];
5305 u8 ssid[IEEE80211_MAX_SSID_LEN];
5306 s8 default_key, default_mgmt_key;
5307 bool prev_bssid_valid;
5311 struct cfg80211_cqm_config *cqm_config;
5313 struct list_head pmsr_list;
5314 spinlock_t pmsr_lock;
5315 struct work_struct pmsr_free_wk;
5317 unsigned long unprot_beacon_reported;
5320 static inline u8 *wdev_address(struct wireless_dev *wdev)
5323 return wdev->netdev->dev_addr;
5324 return wdev->address;
5327 static inline bool wdev_running(struct wireless_dev *wdev)
5330 return netif_running(wdev->netdev);
5331 return wdev->is_running;
5335 * wdev_priv - return wiphy priv from wireless_dev
5337 * @wdev: The wireless device whose wiphy's priv pointer to return
5338 * Return: The wiphy priv of @wdev.
5340 static inline void *wdev_priv(struct wireless_dev *wdev)
5343 return wiphy_priv(wdev->wiphy);
5347 * DOC: Utility functions
5349 * cfg80211 offers a number of utility functions that can be useful.
5353 * ieee80211_channel_equal - compare two struct ieee80211_channel
5355 * @a: 1st struct ieee80211_channel
5356 * @b: 2nd struct ieee80211_channel
5357 * Return: true if center frequency of @a == @b
5360 ieee80211_channel_equal(struct ieee80211_channel *a,
5361 struct ieee80211_channel *b)
5363 return (a->center_freq == b->center_freq &&
5364 a->freq_offset == b->freq_offset);
5368 * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5369 * @chan: struct ieee80211_channel to convert
5370 * Return: The corresponding frequency (in KHz)
5373 ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5375 return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5379 * ieee80211_s1g_channel_width - get allowed channel width from @chan
5381 * Only allowed for band NL80211_BAND_S1GHZ
5383 * Return: The allowed channel width for this center_freq
5385 enum nl80211_chan_width
5386 ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
5389 * ieee80211_channel_to_freq_khz - convert channel number to frequency
5390 * @chan: channel number
5391 * @band: band, necessary due to channel number overlap
5392 * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5394 u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5397 * ieee80211_channel_to_frequency - convert channel number to frequency
5398 * @chan: channel number
5399 * @band: band, necessary due to channel number overlap
5400 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5403 ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5405 return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5409 * ieee80211_freq_khz_to_channel - convert frequency to channel number
5410 * @freq: center frequency in KHz
5411 * Return: The corresponding channel, or 0 if the conversion failed.
5413 int ieee80211_freq_khz_to_channel(u32 freq);
5416 * ieee80211_frequency_to_channel - convert frequency to channel number
5417 * @freq: center frequency in MHz
5418 * Return: The corresponding channel, or 0 if the conversion failed.
5421 ieee80211_frequency_to_channel(int freq)
5423 return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5427 * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5429 * @wiphy: the struct wiphy to get the channel for
5430 * @freq: the center frequency (in KHz) of the channel
5431 * Return: The channel struct from @wiphy at @freq.
5433 struct ieee80211_channel *
5434 ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5437 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5439 * @wiphy: the struct wiphy to get the channel for
5440 * @freq: the center frequency (in MHz) of the channel
5441 * Return: The channel struct from @wiphy at @freq.
5443 static inline struct ieee80211_channel *
5444 ieee80211_get_channel(struct wiphy *wiphy, int freq)
5446 return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5450 * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5451 * @chan: control channel to check
5453 * The Preferred Scanning Channels (PSC) are defined in
5454 * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5456 static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5458 if (chan->band != NL80211_BAND_6GHZ)
5461 return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5465 * ieee80211_get_response_rate - get basic rate for a given rate
5467 * @sband: the band to look for rates in
5468 * @basic_rates: bitmap of basic rates
5469 * @bitrate: the bitrate for which to find the basic rate
5471 * Return: The basic rate corresponding to a given bitrate, that
5472 * is the next lower bitrate contained in the basic rate map,
5473 * which is, for this function, given as a bitmap of indices of
5474 * rates in the band's bitrate table.
5476 struct ieee80211_rate *
5477 ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5478 u32 basic_rates, int bitrate);
5481 * ieee80211_mandatory_rates - get mandatory rates for a given band
5482 * @sband: the band to look for rates in
5483 * @scan_width: width of the control channel
5485 * This function returns a bitmap of the mandatory rates for the given
5486 * band, bits are set according to the rate position in the bitrates array.
5488 u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
5489 enum nl80211_bss_scan_width scan_width);
5492 * Radiotap parsing functions -- for controlled injection support
5494 * Implemented in net/wireless/radiotap.c
5495 * Documentation in Documentation/networking/radiotap-headers.rst
5498 struct radiotap_align_size {
5499 uint8_t align:4, size:4;
5502 struct ieee80211_radiotap_namespace {
5503 const struct radiotap_align_size *align_size;
5509 struct ieee80211_radiotap_vendor_namespaces {
5510 const struct ieee80211_radiotap_namespace *ns;
5515 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
5516 * @this_arg_index: index of current arg, valid after each successful call
5517 * to ieee80211_radiotap_iterator_next()
5518 * @this_arg: pointer to current radiotap arg; it is valid after each
5519 * call to ieee80211_radiotap_iterator_next() but also after
5520 * ieee80211_radiotap_iterator_init() where it will point to
5521 * the beginning of the actual data portion
5522 * @this_arg_size: length of the current arg, for convenience
5523 * @current_namespace: pointer to the current namespace definition
5524 * (or internally %NULL if the current namespace is unknown)
5525 * @is_radiotap_ns: indicates whether the current namespace is the default
5526 * radiotap namespace or not
5528 * @_rtheader: pointer to the radiotap header we are walking through
5529 * @_max_length: length of radiotap header in cpu byte ordering
5530 * @_arg_index: next argument index
5531 * @_arg: next argument pointer
5532 * @_next_bitmap: internal pointer to next present u32
5533 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
5534 * @_vns: vendor namespace definitions
5535 * @_next_ns_data: beginning of the next namespace's data
5536 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
5539 * Describes the radiotap parser state. Fields prefixed with an underscore
5540 * must not be used by users of the parser, only by the parser internally.
5543 struct ieee80211_radiotap_iterator {
5544 struct ieee80211_radiotap_header *_rtheader;
5545 const struct ieee80211_radiotap_vendor_namespaces *_vns;
5546 const struct ieee80211_radiotap_namespace *current_namespace;
5548 unsigned char *_arg, *_next_ns_data;
5549 __le32 *_next_bitmap;
5551 unsigned char *this_arg;
5559 uint32_t _bitmap_shifter;
5564 ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5565 struct ieee80211_radiotap_header *radiotap_header,
5567 const struct ieee80211_radiotap_vendor_namespaces *vns);
5570 ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5573 extern const unsigned char rfc1042_header[6];
5574 extern const unsigned char bridge_tunnel_header[6];
5577 * ieee80211_get_hdrlen_from_skb - get header length from data
5581 * Given an skb with a raw 802.11 header at the data pointer this function
5582 * returns the 802.11 header length.
5584 * Return: The 802.11 header length in bytes (not including encryption
5585 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
5588 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5591 * ieee80211_hdrlen - get header length in bytes from frame control
5592 * @fc: frame control field in little-endian format
5593 * Return: The header length in bytes.
5595 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5598 * ieee80211_get_mesh_hdrlen - get mesh extension header length
5599 * @meshhdr: the mesh extension header, only the flags field
5600 * (first byte) will be accessed
5601 * Return: The length of the extension header, which is always at
5602 * least 6 bytes and at most 18 if address 5 and 6 are present.
5604 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
5607 * DOC: Data path helpers
5609 * In addition to generic utilities, cfg80211 also offers
5610 * functions that help implement the data path for devices
5611 * that do not do the 802.11/802.3 conversion on the device.
5615 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
5616 * @skb: the 802.11 data frame
5617 * @ehdr: pointer to a &struct ethhdr that will get the header, instead
5618 * of it being pushed into the SKB
5619 * @addr: the device MAC address
5620 * @iftype: the virtual interface type
5621 * @data_offset: offset of payload after the 802.11 header
5622 * Return: 0 on success. Non-zero on error.
5624 int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
5625 const u8 *addr, enum nl80211_iftype iftype,
5629 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5630 * @skb: the 802.11 data frame
5631 * @addr: the device MAC address
5632 * @iftype: the virtual interface type
5633 * Return: 0 on success. Non-zero on error.
5635 static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
5636 enum nl80211_iftype iftype)
5638 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
5642 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5644 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
5645 * The @list will be empty if the decode fails. The @skb must be fully
5646 * header-less before being passed in here; it is freed in this function.
5648 * @skb: The input A-MSDU frame without any headers.
5649 * @list: The output list of 802.3 frames. It must be allocated and
5650 * initialized by the caller.
5651 * @addr: The device MAC address.
5652 * @iftype: The device interface type.
5653 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
5654 * @check_da: DA to check in the inner ethernet header, or NULL
5655 * @check_sa: SA to check in the inner ethernet header, or NULL
5657 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5658 const u8 *addr, enum nl80211_iftype iftype,
5659 const unsigned int extra_headroom,
5660 const u8 *check_da, const u8 *check_sa);
5663 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5664 * @skb: the data frame
5665 * @qos_map: Interworking QoS mapping or %NULL if not in use
5666 * Return: The 802.1p/1d tag.
5668 unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5669 struct cfg80211_qos_map *qos_map);
5672 * cfg80211_find_elem_match - match information element and byte array in data
5675 * @ies: data consisting of IEs
5676 * @len: length of data
5677 * @match: byte array to match
5678 * @match_len: number of bytes in the match array
5679 * @match_offset: offset in the IE data where the byte array should match.
5680 * Note the difference to cfg80211_find_ie_match() which considers
5681 * the offset to start from the element ID byte, but here we take
5682 * the data portion instead.
5684 * Return: %NULL if the element ID could not be found or if
5685 * the element is invalid (claims to be longer than the given
5686 * data) or if the byte array doesn't match; otherwise return the
5687 * requested element struct.
5689 * Note: There are no checks on the element length other than
5690 * having to fit into the given data and being large enough for the
5691 * byte array to match.
5693 const struct element *
5694 cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
5695 const u8 *match, unsigned int match_len,
5696 unsigned int match_offset);
5699 * cfg80211_find_ie_match - match information element and byte array in data
5702 * @ies: data consisting of IEs
5703 * @len: length of data
5704 * @match: byte array to match
5705 * @match_len: number of bytes in the match array
5706 * @match_offset: offset in the IE where the byte array should match.
5707 * If match_len is zero, this must also be set to zero.
5708 * Otherwise this must be set to 2 or more, because the first
5709 * byte is the element id, which is already compared to eid, and
5710 * the second byte is the IE length.
5712 * Return: %NULL if the element ID could not be found or if
5713 * the element is invalid (claims to be longer than the given
5714 * data) or if the byte array doesn't match, or a pointer to the first
5715 * byte of the requested element, that is the byte containing the
5718 * Note: There are no checks on the element length other than
5719 * having to fit into the given data and being large enough for the
5720 * byte array to match.
5722 static inline const u8 *
5723 cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
5724 const u8 *match, unsigned int match_len,
5725 unsigned int match_offset)
5727 /* match_offset can't be smaller than 2, unless match_len is
5728 * zero, in which case match_offset must be zero as well.
5730 if (WARN_ON((match_len && match_offset < 2) ||
5731 (!match_len && match_offset)))
5734 return (void *)cfg80211_find_elem_match(eid, ies, len,
5737 match_offset - 2 : 0);
5741 * cfg80211_find_elem - find information element in data
5744 * @ies: data consisting of IEs
5745 * @len: length of data
5747 * Return: %NULL if the element ID could not be found or if
5748 * the element is invalid (claims to be longer than the given
5749 * data) or if the byte array doesn't match; otherwise return the
5750 * requested element struct.
5752 * Note: There are no checks on the element length other than
5753 * having to fit into the given data.
5755 static inline const struct element *
5756 cfg80211_find_elem(u8 eid, const u8 *ies, int len)
5758 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
5762 * cfg80211_find_ie - find information element in data
5765 * @ies: data consisting of IEs
5766 * @len: length of data
5768 * Return: %NULL if the element ID could not be found or if
5769 * the element is invalid (claims to be longer than the given
5770 * data), or a pointer to the first byte of the requested
5771 * element, that is the byte containing the element ID.
5773 * Note: There are no checks on the element length other than
5774 * having to fit into the given data.
5776 static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5778 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5782 * cfg80211_find_ext_elem - find information element with EID Extension in data
5784 * @ext_eid: element ID Extension
5785 * @ies: data consisting of IEs
5786 * @len: length of data
5788 * Return: %NULL if the etended element could not be found or if
5789 * the element is invalid (claims to be longer than the given
5790 * data) or if the byte array doesn't match; otherwise return the
5791 * requested element struct.
5793 * Note: There are no checks on the element length other than
5794 * having to fit into the given data.
5796 static inline const struct element *
5797 cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
5799 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
5804 * cfg80211_find_ext_ie - find information element with EID Extension in data
5806 * @ext_eid: element ID Extension
5807 * @ies: data consisting of IEs
5808 * @len: length of data
5810 * Return: %NULL if the extended element ID could not be found or if
5811 * the element is invalid (claims to be longer than the given
5812 * data), or a pointer to the first byte of the requested
5813 * element, that is the byte containing the element ID.
5815 * Note: There are no checks on the element length other than
5816 * having to fit into the given data.
5818 static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
5820 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
5825 * cfg80211_find_vendor_elem - find vendor specific information element in data
5828 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5829 * @ies: data consisting of IEs
5830 * @len: length of data
5832 * Return: %NULL if the vendor specific element ID could not be found or if the
5833 * element is invalid (claims to be longer than the given data); otherwise
5834 * return the element structure for the requested element.
5836 * Note: There are no checks on the element length other than having to fit into
5839 const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
5844 * cfg80211_find_vendor_ie - find vendor specific information element in data
5847 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5848 * @ies: data consisting of IEs
5849 * @len: length of data
5851 * Return: %NULL if the vendor specific element ID could not be found or if the
5852 * element is invalid (claims to be longer than the given data), or a pointer to
5853 * the first byte of the requested element, that is the byte containing the
5856 * Note: There are no checks on the element length other than having to fit into
5859 static inline const u8 *
5860 cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
5861 const u8 *ies, unsigned int len)
5863 return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
5867 * cfg80211_send_layer2_update - send layer 2 update frame
5869 * @dev: network device
5870 * @addr: STA MAC address
5872 * Wireless drivers can use this function to update forwarding tables in bridge
5873 * devices upon STA association.
5875 void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
5878 * DOC: Regulatory enforcement infrastructure
5884 * regulatory_hint - driver hint to the wireless core a regulatory domain
5885 * @wiphy: the wireless device giving the hint (used only for reporting
5887 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5888 * should be in. If @rd is set this should be NULL. Note that if you
5889 * set this to NULL you should still set rd->alpha2 to some accepted
5892 * Wireless drivers can use this function to hint to the wireless core
5893 * what it believes should be the current regulatory domain by
5894 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5895 * domain should be in or by providing a completely build regulatory domain.
5896 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5897 * for a regulatory domain structure for the respective country.
5899 * The wiphy must have been registered to cfg80211 prior to this call.
5900 * For cfg80211 drivers this means you must first use wiphy_register(),
5901 * for mac80211 drivers you must first use ieee80211_register_hw().
5903 * Drivers should check the return value, its possible you can get
5906 * Return: 0 on success. -ENOMEM.
5908 int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5911 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5912 * @wiphy: the wireless device we want to process the regulatory domain on
5913 * @rd: the regulatory domain informatoin to use for this wiphy
5915 * Set the regulatory domain information for self-managed wiphys, only they
5916 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5919 * Return: 0 on success. -EINVAL, -EPERM
5921 int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5922 struct ieee80211_regdomain *rd);
5925 * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
5926 * @wiphy: the wireless device we want to process the regulatory domain on
5927 * @rd: the regulatory domain information to use for this wiphy
5929 * This functions requires the RTNL to be held and applies the new regdomain
5930 * synchronously to this wiphy. For more details see
5931 * regulatory_set_wiphy_regd().
5933 * Return: 0 on success. -EINVAL, -EPERM
5935 int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
5936 struct ieee80211_regdomain *rd);
5939 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5940 * @wiphy: the wireless device we want to process the regulatory domain on
5941 * @regd: the custom regulatory domain to use for this wiphy
5943 * Drivers can sometimes have custom regulatory domains which do not apply
5944 * to a specific country. Drivers can use this to apply such custom regulatory
5945 * domains. This routine must be called prior to wiphy registration. The
5946 * custom regulatory domain will be trusted completely and as such previous
5947 * default channel settings will be disregarded. If no rule is found for a
5948 * channel on the regulatory domain the channel will be disabled.
5949 * Drivers using this for a wiphy should also set the wiphy flag
5950 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
5951 * that called this helper.
5953 void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5954 const struct ieee80211_regdomain *regd);
5957 * freq_reg_info - get regulatory information for the given frequency
5958 * @wiphy: the wiphy for which we want to process this rule for
5959 * @center_freq: Frequency in KHz for which we want regulatory information for
5961 * Use this function to get the regulatory rule for a specific frequency on
5962 * a given wireless device. If the device has a specific regulatory domain
5963 * it wants to follow we respect that unless a country IE has been received
5964 * and processed already.
5966 * Return: A valid pointer, or, when an error occurs, for example if no rule
5967 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
5968 * check and PTR_ERR() to obtain the numeric return value. The numeric return
5969 * value will be -ERANGE if we determine the given center_freq does not even
5970 * have a regulatory rule for a frequency range in the center_freq's band.
5971 * See freq_in_rule_band() for our current definition of a band -- this is
5972 * purely subjective and right now it's 802.11 specific.
5974 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5978 * reg_initiator_name - map regulatory request initiator enum to name
5979 * @initiator: the regulatory request initiator
5981 * You can use this to map the regulatory request initiator enum to a
5982 * proper string representation.
5984 const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5987 * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
5988 * @wiphy: wiphy for which pre-CAC capability is checked.
5990 * Pre-CAC is allowed only in some regdomains (notable ETSI).
5992 bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
5995 * DOC: Internal regulatory db functions
6000 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
6001 * Regulatory self-managed driver can use it to proactively
6003 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
6004 * @freq: the freqency(in MHz) to be queried.
6005 * @rule: pointer to store the wmm rule from the regulatory db.
6007 * Self-managed wireless drivers can use this function to query
6008 * the internal regulatory database to check whether the given
6009 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
6011 * Drivers should check the return value, its possible you can get
6014 * Return: 0 on success. -ENODATA.
6016 int reg_query_regdb_wmm(char *alpha2, int freq,
6017 struct ieee80211_reg_rule *rule);
6020 * callbacks for asynchronous cfg80211 methods, notification
6021 * functions and BSS handling helpers
6025 * cfg80211_scan_done - notify that scan finished
6027 * @request: the corresponding scan request
6028 * @info: information about the completed scan
6030 void cfg80211_scan_done(struct cfg80211_scan_request *request,
6031 struct cfg80211_scan_info *info);
6034 * cfg80211_sched_scan_results - notify that new scan results are available
6036 * @wiphy: the wiphy which got scheduled scan results
6037 * @reqid: identifier for the related scheduled scan request
6039 void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6042 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6044 * @wiphy: the wiphy on which the scheduled scan stopped
6045 * @reqid: identifier for the related scheduled scan request
6047 * The driver can call this function to inform cfg80211 that the
6048 * scheduled scan had to be stopped, for whatever reason. The driver
6049 * is then called back via the sched_scan_stop operation when done.
6051 void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6054 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
6056 * @wiphy: the wiphy on which the scheduled scan stopped
6057 * @reqid: identifier for the related scheduled scan request
6059 * The driver can call this function to inform cfg80211 that the
6060 * scheduled scan had to be stopped, for whatever reason. The driver
6061 * is then called back via the sched_scan_stop operation when done.
6062 * This function should be called with rtnl locked.
6064 void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
6067 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
6068 * @wiphy: the wiphy reporting the BSS
6069 * @data: the BSS metadata
6070 * @mgmt: the management frame (probe response or beacon)
6071 * @len: length of the management frame
6072 * @gfp: context flags
6074 * This informs cfg80211 that BSS information was found and
6075 * the BSS should be updated/added.
6077 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6078 * Or %NULL on error.
6080 struct cfg80211_bss * __must_check
6081 cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
6082 struct cfg80211_inform_bss *data,
6083 struct ieee80211_mgmt *mgmt, size_t len,
6086 static inline struct cfg80211_bss * __must_check
6087 cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
6088 struct ieee80211_channel *rx_channel,
6089 enum nl80211_bss_scan_width scan_width,
6090 struct ieee80211_mgmt *mgmt, size_t len,
6091 s32 signal, gfp_t gfp)
6093 struct cfg80211_inform_bss data = {
6095 .scan_width = scan_width,
6099 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6102 static inline struct cfg80211_bss * __must_check
6103 cfg80211_inform_bss_frame(struct wiphy *wiphy,
6104 struct ieee80211_channel *rx_channel,
6105 struct ieee80211_mgmt *mgmt, size_t len,
6106 s32 signal, gfp_t gfp)
6108 struct cfg80211_inform_bss data = {
6110 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6114 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6118 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
6119 * @bssid: transmitter BSSID
6120 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
6121 * @mbssid_index: BSSID index, taken from Multiple BSSID index element
6122 * @new_bssid: calculated nontransmitted BSSID
6124 static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
6125 u8 mbssid_index, u8 *new_bssid)
6127 u64 bssid_u64 = ether_addr_to_u64(bssid);
6128 u64 mask = GENMASK_ULL(max_bssid - 1, 0);
6131 new_bssid_u64 = bssid_u64 & ~mask;
6133 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
6135 u64_to_ether_addr(new_bssid_u64, new_bssid);
6139 * cfg80211_is_element_inherited - returns if element ID should be inherited
6140 * @element: element to check
6141 * @non_inherit_element: non inheritance element
6143 bool cfg80211_is_element_inherited(const struct element *element,
6144 const struct element *non_inherit_element);
6147 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6149 * @ielen: length of IEs
6150 * @mbssid_elem: current MBSSID element
6151 * @sub_elem: current MBSSID subelement (profile)
6152 * @merged_ie: location of the merged profile
6153 * @max_copy_len: max merged profile length
6155 size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6156 const struct element *mbssid_elem,
6157 const struct element *sub_elem,
6158 u8 *merged_ie, size_t max_copy_len);
6161 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
6162 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
6163 * from a beacon or probe response
6164 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
6165 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
6167 enum cfg80211_bss_frame_type {
6168 CFG80211_BSS_FTYPE_UNKNOWN,
6169 CFG80211_BSS_FTYPE_BEACON,
6170 CFG80211_BSS_FTYPE_PRESP,
6174 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6176 * @wiphy: the wiphy reporting the BSS
6177 * @data: the BSS metadata
6178 * @ftype: frame type (if known)
6179 * @bssid: the BSSID of the BSS
6180 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6181 * @capability: the capability field sent by the peer
6182 * @beacon_interval: the beacon interval announced by the peer
6183 * @ie: additional IEs sent by the peer
6184 * @ielen: length of the additional IEs
6185 * @gfp: context flags
6187 * This informs cfg80211 that BSS information was found and
6188 * the BSS should be updated/added.
6190 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6191 * Or %NULL on error.
6193 struct cfg80211_bss * __must_check
6194 cfg80211_inform_bss_data(struct wiphy *wiphy,
6195 struct cfg80211_inform_bss *data,
6196 enum cfg80211_bss_frame_type ftype,
6197 const u8 *bssid, u64 tsf, u16 capability,
6198 u16 beacon_interval, const u8 *ie, size_t ielen,
6201 static inline struct cfg80211_bss * __must_check
6202 cfg80211_inform_bss_width(struct wiphy *wiphy,
6203 struct ieee80211_channel *rx_channel,
6204 enum nl80211_bss_scan_width scan_width,
6205 enum cfg80211_bss_frame_type ftype,
6206 const u8 *bssid, u64 tsf, u16 capability,
6207 u16 beacon_interval, const u8 *ie, size_t ielen,
6208 s32 signal, gfp_t gfp)
6210 struct cfg80211_inform_bss data = {
6212 .scan_width = scan_width,
6216 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6217 capability, beacon_interval, ie, ielen,
6221 static inline struct cfg80211_bss * __must_check
6222 cfg80211_inform_bss(struct wiphy *wiphy,
6223 struct ieee80211_channel *rx_channel,
6224 enum cfg80211_bss_frame_type ftype,
6225 const u8 *bssid, u64 tsf, u16 capability,
6226 u16 beacon_interval, const u8 *ie, size_t ielen,
6227 s32 signal, gfp_t gfp)
6229 struct cfg80211_inform_bss data = {
6231 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6235 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6236 capability, beacon_interval, ie, ielen,
6241 * cfg80211_get_bss - get a BSS reference
6242 * @wiphy: the wiphy this BSS struct belongs to
6243 * @channel: the channel to search on (or %NULL)
6244 * @bssid: the desired BSSID (or %NULL)
6245 * @ssid: the desired SSID (or %NULL)
6246 * @ssid_len: length of the SSID (or 0)
6247 * @bss_type: type of BSS, see &enum ieee80211_bss_type
6248 * @privacy: privacy filter, see &enum ieee80211_privacy
6250 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
6251 struct ieee80211_channel *channel,
6253 const u8 *ssid, size_t ssid_len,
6254 enum ieee80211_bss_type bss_type,
6255 enum ieee80211_privacy privacy);
6256 static inline struct cfg80211_bss *
6257 cfg80211_get_ibss(struct wiphy *wiphy,
6258 struct ieee80211_channel *channel,
6259 const u8 *ssid, size_t ssid_len)
6261 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
6262 IEEE80211_BSS_TYPE_IBSS,
6263 IEEE80211_PRIVACY_ANY);
6267 * cfg80211_ref_bss - reference BSS struct
6268 * @wiphy: the wiphy this BSS struct belongs to
6269 * @bss: the BSS struct to reference
6271 * Increments the refcount of the given BSS struct.
6273 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6276 * cfg80211_put_bss - unref BSS struct
6277 * @wiphy: the wiphy this BSS struct belongs to
6278 * @bss: the BSS struct
6280 * Decrements the refcount of the given BSS struct.
6282 void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6285 * cfg80211_unlink_bss - unlink BSS from internal data structures
6287 * @bss: the bss to remove
6289 * This function removes the given BSS from the internal data structures
6290 * thereby making it no longer show up in scan results etc. Use this
6291 * function when you detect a BSS is gone. Normally BSSes will also time
6292 * out, so it is not necessary to use this function at all.
6294 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6297 * cfg80211_bss_iter - iterate all BSS entries
6299 * This function iterates over the BSS entries associated with the given wiphy
6300 * and calls the callback for the iterated BSS. The iterator function is not
6301 * allowed to call functions that might modify the internal state of the BSS DB.
6304 * @chandef: if given, the iterator function will be called only if the channel
6305 * of the currently iterated BSS is a subset of the given channel.
6306 * @iter: the iterator function to call
6307 * @iter_data: an argument to the iterator function
6309 void cfg80211_bss_iter(struct wiphy *wiphy,
6310 struct cfg80211_chan_def *chandef,
6311 void (*iter)(struct wiphy *wiphy,
6312 struct cfg80211_bss *bss,
6316 static inline enum nl80211_bss_scan_width
6317 cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6319 switch (chandef->width) {
6320 case NL80211_CHAN_WIDTH_5:
6321 return NL80211_BSS_CHAN_WIDTH_5;
6322 case NL80211_CHAN_WIDTH_10:
6323 return NL80211_BSS_CHAN_WIDTH_10;
6325 return NL80211_BSS_CHAN_WIDTH_20;
6330 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
6331 * @dev: network device
6332 * @buf: authentication frame (header + body)
6333 * @len: length of the frame data
6335 * This function is called whenever an authentication, disassociation or
6336 * deauthentication frame has been received and processed in station mode.
6337 * After being asked to authenticate via cfg80211_ops::auth() the driver must
6338 * call either this function or cfg80211_auth_timeout().
6339 * After being asked to associate via cfg80211_ops::assoc() the driver must
6340 * call either this function or cfg80211_auth_timeout().
6341 * While connected, the driver must calls this for received and processed
6342 * disassociation and deauthentication frames. If the frame couldn't be used
6343 * because it was unprotected, the driver must call the function
6344 * cfg80211_rx_unprot_mlme_mgmt() instead.
6346 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6348 void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6351 * cfg80211_auth_timeout - notification of timed out authentication
6352 * @dev: network device
6353 * @addr: The MAC address of the device with which the authentication timed out
6355 * This function may sleep. The caller must hold the corresponding wdev's
6358 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
6361 * cfg80211_rx_assoc_resp - notification of processed association response
6362 * @dev: network device
6363 * @bss: the BSS that association was requested with, ownership of the pointer
6364 * moves to cfg80211 in this call
6365 * @buf: (Re)Association Response frame (header + body)
6366 * @len: length of the frame data
6367 * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6368 * as the AC bitmap in the QoS info field
6369 * @req_ies: information elements from the (Re)Association Request frame
6370 * @req_ies_len: length of req_ies data
6372 * After being asked to associate via cfg80211_ops::assoc() the driver must
6373 * call either this function or cfg80211_auth_timeout().
6375 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6377 void cfg80211_rx_assoc_resp(struct net_device *dev,
6378 struct cfg80211_bss *bss,
6379 const u8 *buf, size_t len,
6381 const u8 *req_ies, size_t req_ies_len);
6384 * cfg80211_assoc_timeout - notification of timed out association
6385 * @dev: network device
6386 * @bss: The BSS entry with which association timed out.
6388 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6390 void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
6393 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6394 * @dev: network device
6395 * @bss: The BSS entry with which association was abandoned.
6397 * Call this whenever - for reasons reported through other API, like deauth RX,
6398 * an association attempt was abandoned.
6399 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6401 void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6404 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
6405 * @dev: network device
6406 * @buf: 802.11 frame (header + body)
6407 * @len: length of the frame data
6409 * This function is called whenever deauthentication has been processed in
6410 * station mode. This includes both received deauthentication frames and
6411 * locally generated ones. This function may sleep. The caller must hold the
6412 * corresponding wdev's mutex.
6414 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6417 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6418 * @dev: network device
6419 * @buf: received management frame (header + body)
6420 * @len: length of the frame data
6422 * This function is called whenever a received deauthentication or dissassoc
6423 * frame has been dropped in station mode because of MFP being used but the
6424 * frame was not protected. This is also used to notify reception of a Beacon
6425 * frame that was dropped because it did not include a valid MME MIC while
6426 * beacon protection was enabled (BIGTK configured in station mode).
6428 * This function may sleep.
6430 void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
6431 const u8 *buf, size_t len);
6434 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6435 * @dev: network device
6436 * @addr: The source MAC address of the frame
6437 * @key_type: The key type that the received frame used
6438 * @key_id: Key identifier (0..3). Can be -1 if missing.
6439 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6440 * @gfp: allocation flags
6442 * This function is called whenever the local MAC detects a MIC failure in a
6443 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6446 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6447 enum nl80211_key_type key_type, int key_id,
6448 const u8 *tsc, gfp_t gfp);
6451 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
6453 * @dev: network device
6454 * @bssid: the BSSID of the IBSS joined
6455 * @channel: the channel of the IBSS joined
6456 * @gfp: allocation flags
6458 * This function notifies cfg80211 that the device joined an IBSS or
6459 * switched to a different BSSID. Before this function can be called,
6460 * either a beacon has to have been received from the IBSS, or one of
6461 * the cfg80211_inform_bss{,_frame} functions must have been called
6462 * with the locally generated beacon -- this guarantees that there is
6463 * always a scan result for this IBSS. cfg80211 will handle the rest.
6465 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6466 struct ieee80211_channel *channel, gfp_t gfp);
6469 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
6471 * @dev: network device
6472 * @macaddr: the MAC address of the new candidate
6473 * @ie: information elements advertised by the peer candidate
6474 * @ie_len: length of the information elements buffer
6475 * @gfp: allocation flags
6477 * This function notifies cfg80211 that the mesh peer candidate has been
6478 * detected, most likely via a beacon or, less likely, via a probe response.
6479 * cfg80211 then sends a notification to userspace.
6481 void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6482 const u8 *macaddr, const u8 *ie, u8 ie_len,
6483 int sig_dbm, gfp_t gfp);
6486 * DOC: RFkill integration
6488 * RFkill integration in cfg80211 is almost invisible to drivers,
6489 * as cfg80211 automatically registers an rfkill instance for each
6490 * wireless device it knows about. Soft kill is also translated
6491 * into disconnecting and turning all interfaces off, drivers are
6492 * expected to turn off the device when all interfaces are down.
6494 * However, devices may have a hard RFkill line, in which case they
6495 * also need to interact with the rfkill subsystem, via cfg80211.
6496 * They can do this with a few helper functions documented here.
6500 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
6502 * @blocked: block status
6504 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
6507 * wiphy_rfkill_start_polling - start polling rfkill
6510 void wiphy_rfkill_start_polling(struct wiphy *wiphy);
6513 * wiphy_rfkill_stop_polling - stop polling rfkill
6516 void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
6519 * DOC: Vendor commands
6521 * Occasionally, there are special protocol or firmware features that
6522 * can't be implemented very openly. For this and similar cases, the
6523 * vendor command functionality allows implementing the features with
6524 * (typically closed-source) userspace and firmware, using nl80211 as
6525 * the configuration mechanism.
6527 * A driver supporting vendor commands must register them as an array
6528 * in struct wiphy, with handlers for each one, each command has an
6529 * OUI and sub command ID to identify it.
6531 * Note that this feature should not be (ab)used to implement protocol
6532 * features that could openly be shared across drivers. In particular,
6533 * it must never be required to use vendor commands to implement any
6534 * "normal" functionality that higher-level userspace like connection
6535 * managers etc. need.
6538 struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6539 enum nl80211_commands cmd,
6540 enum nl80211_attrs attr,
6543 struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
6544 struct wireless_dev *wdev,
6545 enum nl80211_commands cmd,
6546 enum nl80211_attrs attr,
6547 unsigned int portid,
6548 int vendor_event_idx,
6549 int approxlen, gfp_t gfp);
6551 void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6554 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6556 * @approxlen: an upper bound of the length of the data that will
6557 * be put into the skb
6559 * This function allocates and pre-fills an skb for a reply to
6560 * a vendor command. Since it is intended for a reply, calling
6561 * it outside of a vendor command's doit() operation is invalid.
6563 * The returned skb is pre-filled with some identifying data in
6564 * a way that any data that is put into the skb (with skb_put(),
6565 * nla_put() or similar) will end up being within the
6566 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6567 * with the skb is adding data for the corresponding userspace tool
6568 * which can then read that data out of the vendor data attribute.
6569 * You must not modify the skb in any other way.
6571 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6572 * its error code as the result of the doit() operation.
6574 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6576 static inline struct sk_buff *
6577 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6579 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6580 NL80211_ATTR_VENDOR_DATA, approxlen);
6584 * cfg80211_vendor_cmd_reply - send the reply skb
6585 * @skb: The skb, must have been allocated with
6586 * cfg80211_vendor_cmd_alloc_reply_skb()
6588 * Since calling this function will usually be the last thing
6589 * before returning from the vendor command doit() you should
6590 * return the error code. Note that this function consumes the
6591 * skb regardless of the return value.
6593 * Return: An error code or 0 on success.
6595 int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6598 * cfg80211_vendor_cmd_get_sender
6601 * Return the current netlink port ID in a vendor command handler.
6602 * Valid to call only there.
6604 unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
6607 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6609 * @wdev: the wireless device
6610 * @event_idx: index of the vendor event in the wiphy's vendor_events
6611 * @approxlen: an upper bound of the length of the data that will
6612 * be put into the skb
6613 * @gfp: allocation flags
6615 * This function allocates and pre-fills an skb for an event on the
6616 * vendor-specific multicast group.
6618 * If wdev != NULL, both the ifindex and identifier of the specified
6619 * wireless device are added to the event message before the vendor data
6622 * When done filling the skb, call cfg80211_vendor_event() with the
6623 * skb to send the event.
6625 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6627 static inline struct sk_buff *
6628 cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
6629 int approxlen, int event_idx, gfp_t gfp)
6631 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6632 NL80211_ATTR_VENDOR_DATA,
6633 0, event_idx, approxlen, gfp);
6637 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
6639 * @wdev: the wireless device
6640 * @event_idx: index of the vendor event in the wiphy's vendor_events
6641 * @portid: port ID of the receiver
6642 * @approxlen: an upper bound of the length of the data that will
6643 * be put into the skb
6644 * @gfp: allocation flags
6646 * This function allocates and pre-fills an skb for an event to send to
6647 * a specific (userland) socket. This socket would previously have been
6648 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
6649 * care to register a netlink notifier to see when the socket closes.
6651 * If wdev != NULL, both the ifindex and identifier of the specified
6652 * wireless device are added to the event message before the vendor data
6655 * When done filling the skb, call cfg80211_vendor_event() with the
6656 * skb to send the event.
6658 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6660 static inline struct sk_buff *
6661 cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
6662 struct wireless_dev *wdev,
6663 unsigned int portid, int approxlen,
6664 int event_idx, gfp_t gfp)
6666 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6667 NL80211_ATTR_VENDOR_DATA,
6668 portid, event_idx, approxlen, gfp);
6672 * cfg80211_vendor_event - send the event
6673 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6674 * @gfp: allocation flags
6676 * This function sends the given @skb, which must have been allocated
6677 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6679 static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6681 __cfg80211_send_event_skb(skb, gfp);
6684 #ifdef CONFIG_NL80211_TESTMODE
6688 * Test mode is a set of utility functions to allow drivers to
6689 * interact with driver-specific tools to aid, for instance,
6690 * factory programming.
6692 * This chapter describes how drivers interact with it, for more
6693 * information see the nl80211 book's chapter on it.
6697 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6699 * @approxlen: an upper bound of the length of the data that will
6700 * be put into the skb
6702 * This function allocates and pre-fills an skb for a reply to
6703 * the testmode command. Since it is intended for a reply, calling
6704 * it outside of the @testmode_cmd operation is invalid.
6706 * The returned skb is pre-filled with the wiphy index and set up in
6707 * a way that any data that is put into the skb (with skb_put(),
6708 * nla_put() or similar) will end up being within the
6709 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
6710 * with the skb is adding data for the corresponding userspace tool
6711 * which can then read that data out of the testdata attribute. You
6712 * must not modify the skb in any other way.
6714 * When done, call cfg80211_testmode_reply() with the skb and return
6715 * its error code as the result of the @testmode_cmd operation.
6717 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6719 static inline struct sk_buff *
6720 cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6722 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6723 NL80211_ATTR_TESTDATA, approxlen);
6727 * cfg80211_testmode_reply - send the reply skb
6728 * @skb: The skb, must have been allocated with
6729 * cfg80211_testmode_alloc_reply_skb()
6731 * Since calling this function will usually be the last thing
6732 * before returning from the @testmode_cmd you should return
6733 * the error code. Note that this function consumes the skb
6734 * regardless of the return value.
6736 * Return: An error code or 0 on success.
6738 static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6740 return cfg80211_vendor_cmd_reply(skb);
6744 * cfg80211_testmode_alloc_event_skb - allocate testmode event
6746 * @approxlen: an upper bound of the length of the data that will
6747 * be put into the skb
6748 * @gfp: allocation flags
6750 * This function allocates and pre-fills an skb for an event on the
6751 * testmode multicast group.
6753 * The returned skb is set up in the same way as with
6754 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
6755 * there, you should simply add data to it that will then end up in the
6756 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
6759 * When done filling the skb, call cfg80211_testmode_event() with the
6760 * skb to send the event.
6762 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6764 static inline struct sk_buff *
6765 cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6767 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
6768 NL80211_ATTR_TESTDATA, 0, -1,
6773 * cfg80211_testmode_event - send the event
6774 * @skb: The skb, must have been allocated with
6775 * cfg80211_testmode_alloc_event_skb()
6776 * @gfp: allocation flags
6778 * This function sends the given @skb, which must have been allocated
6779 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6782 static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6784 __cfg80211_send_event_skb(skb, gfp);
6787 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
6788 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
6790 #define CFG80211_TESTMODE_CMD(cmd)
6791 #define CFG80211_TESTMODE_DUMP(cmd)
6795 * struct cfg80211_fils_resp_params - FILS connection response params
6796 * @kek: KEK derived from a successful FILS connection (may be %NULL)
6797 * @kek_len: Length of @fils_kek in octets
6798 * @update_erp_next_seq_num: Boolean value to specify whether the value in
6799 * @erp_next_seq_num is valid.
6800 * @erp_next_seq_num: The next sequence number to use in ERP message in
6801 * FILS Authentication. This value should be specified irrespective of the
6802 * status for a FILS connection.
6803 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
6804 * @pmk_len: Length of @pmk in octets
6805 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
6806 * used for this FILS connection (may be %NULL).
6808 struct cfg80211_fils_resp_params {
6811 bool update_erp_next_seq_num;
6812 u16 erp_next_seq_num;
6819 * struct cfg80211_connect_resp_params - Connection response params
6820 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
6821 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6822 * the real status code for failures. If this call is used to report a
6823 * failure due to a timeout (e.g., not receiving an Authentication frame
6824 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6825 * indicate that this is a failure, but without a status code.
6826 * @timeout_reason is used to report the reason for the timeout in that
6828 * @bssid: The BSSID of the AP (may be %NULL)
6829 * @bss: Entry of bss to which STA got connected to, can be obtained through
6830 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6831 * bss from the connect_request and hold a reference to it and return
6832 * through this param to avoid a warning if the bss is expired during the
6833 * connection, esp. for those drivers implementing connect op.
6834 * Only one parameter among @bssid and @bss needs to be specified.
6835 * @req_ie: Association request IEs (may be %NULL)
6836 * @req_ie_len: Association request IEs length
6837 * @resp_ie: Association response IEs (may be %NULL)
6838 * @resp_ie_len: Association response IEs length
6839 * @fils: FILS connection response parameters.
6840 * @timeout_reason: Reason for connection timeout. This is used when the
6841 * connection fails due to a timeout instead of an explicit rejection from
6842 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6843 * not known. This value is used only if @status < 0 to indicate that the
6844 * failure is due to a timeout and not due to explicit rejection by the AP.
6845 * This value is ignored in other cases (@status >= 0).
6847 struct cfg80211_connect_resp_params {
6850 struct cfg80211_bss *bss;
6855 struct cfg80211_fils_resp_params fils;
6856 enum nl80211_timeout_reason timeout_reason;
6860 * cfg80211_connect_done - notify cfg80211 of connection result
6862 * @dev: network device
6863 * @params: connection response parameters
6864 * @gfp: allocation flags
6866 * It should be called by the underlying driver once execution of the connection
6867 * request from connect() has been completed. This is similar to
6868 * cfg80211_connect_bss(), but takes a structure pointer for connection response
6869 * parameters. Only one of the functions among cfg80211_connect_bss(),
6870 * cfg80211_connect_result(), cfg80211_connect_timeout(),
6871 * and cfg80211_connect_done() should be called.
6873 void cfg80211_connect_done(struct net_device *dev,
6874 struct cfg80211_connect_resp_params *params,
6878 * cfg80211_connect_bss - notify cfg80211 of connection result
6880 * @dev: network device
6881 * @bssid: the BSSID of the AP
6882 * @bss: Entry of bss to which STA got connected to, can be obtained through
6883 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6884 * bss from the connect_request and hold a reference to it and return
6885 * through this param to avoid a warning if the bss is expired during the
6886 * connection, esp. for those drivers implementing connect op.
6887 * Only one parameter among @bssid and @bss needs to be specified.
6888 * @req_ie: association request IEs (maybe be %NULL)
6889 * @req_ie_len: association request IEs length
6890 * @resp_ie: association response IEs (may be %NULL)
6891 * @resp_ie_len: assoc response IEs length
6892 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6893 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6894 * the real status code for failures. If this call is used to report a
6895 * failure due to a timeout (e.g., not receiving an Authentication frame
6896 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6897 * indicate that this is a failure, but without a status code.
6898 * @timeout_reason is used to report the reason for the timeout in that
6900 * @gfp: allocation flags
6901 * @timeout_reason: reason for connection timeout. This is used when the
6902 * connection fails due to a timeout instead of an explicit rejection from
6903 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6904 * not known. This value is used only if @status < 0 to indicate that the
6905 * failure is due to a timeout and not due to explicit rejection by the AP.
6906 * This value is ignored in other cases (@status >= 0).
6908 * It should be called by the underlying driver once execution of the connection
6909 * request from connect() has been completed. This is similar to
6910 * cfg80211_connect_result(), but with the option of identifying the exact bss
6911 * entry for the connection. Only one of the functions among
6912 * cfg80211_connect_bss(), cfg80211_connect_result(),
6913 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6916 cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6917 struct cfg80211_bss *bss, const u8 *req_ie,
6918 size_t req_ie_len, const u8 *resp_ie,
6919 size_t resp_ie_len, int status, gfp_t gfp,
6920 enum nl80211_timeout_reason timeout_reason)
6922 struct cfg80211_connect_resp_params params;
6924 memset(¶ms, 0, sizeof(params));
6925 params.status = status;
6926 params.bssid = bssid;
6928 params.req_ie = req_ie;
6929 params.req_ie_len = req_ie_len;
6930 params.resp_ie = resp_ie;
6931 params.resp_ie_len = resp_ie_len;
6932 params.timeout_reason = timeout_reason;
6934 cfg80211_connect_done(dev, ¶ms, gfp);
6938 * cfg80211_connect_result - notify cfg80211 of connection result
6940 * @dev: network device
6941 * @bssid: the BSSID of the AP
6942 * @req_ie: association request IEs (maybe be %NULL)
6943 * @req_ie_len: association request IEs length
6944 * @resp_ie: association response IEs (may be %NULL)
6945 * @resp_ie_len: assoc response IEs length
6946 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6947 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6948 * the real status code for failures.
6949 * @gfp: allocation flags
6951 * It should be called by the underlying driver once execution of the connection
6952 * request from connect() has been completed. This is similar to
6953 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
6954 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
6955 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6958 cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
6959 const u8 *req_ie, size_t req_ie_len,
6960 const u8 *resp_ie, size_t resp_ie_len,
6961 u16 status, gfp_t gfp)
6963 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
6964 resp_ie_len, status, gfp,
6965 NL80211_TIMEOUT_UNSPECIFIED);
6969 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6971 * @dev: network device
6972 * @bssid: the BSSID of the AP
6973 * @req_ie: association request IEs (maybe be %NULL)
6974 * @req_ie_len: association request IEs length
6975 * @gfp: allocation flags
6976 * @timeout_reason: reason for connection timeout.
6978 * It should be called by the underlying driver whenever connect() has failed
6979 * in a sequence where no explicit authentication/association rejection was
6980 * received from the AP. This could happen, e.g., due to not being able to send
6981 * out the Authentication or Association Request frame or timing out while
6982 * waiting for the response. Only one of the functions among
6983 * cfg80211_connect_bss(), cfg80211_connect_result(),
6984 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6987 cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
6988 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
6989 enum nl80211_timeout_reason timeout_reason)
6991 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
6992 gfp, timeout_reason);
6996 * struct cfg80211_roam_info - driver initiated roaming information
6998 * @channel: the channel of the new AP
6999 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
7000 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
7001 * @req_ie: association request IEs (maybe be %NULL)
7002 * @req_ie_len: association request IEs length
7003 * @resp_ie: association response IEs (may be %NULL)
7004 * @resp_ie_len: assoc response IEs length
7005 * @fils: FILS related roaming information.
7007 struct cfg80211_roam_info {
7008 struct ieee80211_channel *channel;
7009 struct cfg80211_bss *bss;
7015 struct cfg80211_fils_resp_params fils;
7019 * cfg80211_roamed - notify cfg80211 of roaming
7021 * @dev: network device
7022 * @info: information about the new BSS. struct &cfg80211_roam_info.
7023 * @gfp: allocation flags
7025 * This function may be called with the driver passing either the BSSID of the
7026 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
7027 * It should be called by the underlying driver whenever it roamed from one AP
7028 * to another while connected. Drivers which have roaming implemented in
7029 * firmware should pass the bss entry to avoid a race in bss entry timeout where
7030 * the bss entry of the new AP is seen in the driver, but gets timed out by the
7031 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7032 * rdev->event_work. In case of any failures, the reference is released
7033 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7034 * released while disconnecting from the current bss.
7036 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
7040 * cfg80211_port_authorized - notify cfg80211 of successful security association
7042 * @dev: network device
7043 * @bssid: the BSSID of the AP
7044 * @gfp: allocation flags
7046 * This function should be called by a driver that supports 4 way handshake
7047 * offload after a security association was successfully established (i.e.,
7048 * the 4 way handshake was completed successfully). The call to this function
7049 * should be preceded with a call to cfg80211_connect_result(),
7050 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7051 * indicate the 802.11 association.
7053 void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7057 * cfg80211_disconnected - notify cfg80211 that connection was dropped
7059 * @dev: network device
7060 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7061 * @ie_len: length of IEs
7062 * @reason: reason code for the disconnection, set it to 0 if unknown
7063 * @locally_generated: disconnection was requested locally
7064 * @gfp: allocation flags
7066 * After it calls this function, the driver should enter an idle state
7067 * and not try to connect to any AP any more.
7069 void cfg80211_disconnected(struct net_device *dev, u16 reason,
7070 const u8 *ie, size_t ie_len,
7071 bool locally_generated, gfp_t gfp);
7074 * cfg80211_ready_on_channel - notification of remain_on_channel start
7075 * @wdev: wireless device
7076 * @cookie: the request cookie
7077 * @chan: The current channel (from remain_on_channel request)
7078 * @duration: Duration in milliseconds that the driver intents to remain on the
7080 * @gfp: allocation flags
7082 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
7083 struct ieee80211_channel *chan,
7084 unsigned int duration, gfp_t gfp);
7087 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
7088 * @wdev: wireless device
7089 * @cookie: the request cookie
7090 * @chan: The current channel (from remain_on_channel request)
7091 * @gfp: allocation flags
7093 void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
7094 struct ieee80211_channel *chan,
7098 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
7099 * @wdev: wireless device
7100 * @cookie: the requested cookie
7101 * @chan: The current channel (from tx_mgmt request)
7102 * @gfp: allocation flags
7104 void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
7105 struct ieee80211_channel *chan, gfp_t gfp);
7108 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
7110 * @sinfo: the station information
7111 * @gfp: allocation flags
7113 int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
7116 * cfg80211_sinfo_release_content - release contents of station info
7117 * @sinfo: the station information
7119 * Releases any potentially allocated sub-information of the station
7120 * information, but not the struct itself (since it's typically on
7123 static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
7125 kfree(sinfo->pertid);
7129 * cfg80211_new_sta - notify userspace about station
7132 * @mac_addr: the station's address
7133 * @sinfo: the station information
7134 * @gfp: allocation flags
7136 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
7137 struct station_info *sinfo, gfp_t gfp);
7140 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7142 * @mac_addr: the station's address
7143 * @sinfo: the station information/statistics
7144 * @gfp: allocation flags
7146 void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7147 struct station_info *sinfo, gfp_t gfp);
7150 * cfg80211_del_sta - notify userspace about deletion of a station
7153 * @mac_addr: the station's address
7154 * @gfp: allocation flags
7156 static inline void cfg80211_del_sta(struct net_device *dev,
7157 const u8 *mac_addr, gfp_t gfp)
7159 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7163 * cfg80211_conn_failed - connection request failed notification
7166 * @mac_addr: the station's address
7167 * @reason: the reason for connection failure
7168 * @gfp: allocation flags
7170 * Whenever a station tries to connect to an AP and if the station
7171 * could not connect to the AP as the AP has rejected the connection
7172 * for some reasons, this function is called.
7174 * The reason for connection failure can be any of the value from
7175 * nl80211_connect_failed_reason enum
7177 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7178 enum nl80211_connect_failed_reason reason,
7182 * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7183 * @wdev: wireless device receiving the frame
7184 * @freq: Frequency on which the frame was received in KHz
7185 * @sig_dbm: signal strength in dBm, or 0 if unknown
7186 * @buf: Management frame (header + body)
7187 * @len: length of the frame data
7188 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7190 * This function is called whenever an Action frame is received for a station
7191 * mode interface, but is not processed in kernel.
7193 * Return: %true if a user space application has registered for this frame.
7194 * For action frames, that makes it responsible for rejecting unrecognized
7195 * action frames; %false otherwise, in which case for action frames the
7196 * driver is responsible for rejecting the frame.
7198 bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7199 const u8 *buf, size_t len, u32 flags);
7202 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
7203 * @wdev: wireless device receiving the frame
7204 * @freq: Frequency on which the frame was received in MHz
7205 * @sig_dbm: signal strength in dBm, or 0 if unknown
7206 * @buf: Management frame (header + body)
7207 * @len: length of the frame data
7208 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7210 * This function is called whenever an Action frame is received for a station
7211 * mode interface, but is not processed in kernel.
7213 * Return: %true if a user space application has registered for this frame.
7214 * For action frames, that makes it responsible for rejecting unrecognized
7215 * action frames; %false otherwise, in which case for action frames the
7216 * driver is responsible for rejecting the frame.
7218 static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7219 int sig_dbm, const u8 *buf, size_t len,
7222 return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7227 * cfg80211_mgmt_tx_status - notification of TX status for management frame
7228 * @wdev: wireless device receiving the frame
7229 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
7230 * @buf: Management frame (header + body)
7231 * @len: length of the frame data
7232 * @ack: Whether frame was acknowledged
7233 * @gfp: context flags
7235 * This function is called whenever a management frame was requested to be
7236 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7237 * transmission attempt.
7239 void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7240 const u8 *buf, size_t len, bool ack, gfp_t gfp);
7243 * cfg80211_control_port_tx_status - notification of TX status for control
7245 * @wdev: wireless device receiving the frame
7246 * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7247 * @buf: Data frame (header + body)
7248 * @len: length of the frame data
7249 * @ack: Whether frame was acknowledged
7250 * @gfp: context flags
7252 * This function is called whenever a control port frame was requested to be
7253 * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7254 * the transmission attempt.
7256 void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7257 const u8 *buf, size_t len, bool ack,
7261 * cfg80211_rx_control_port - notification about a received control port frame
7262 * @dev: The device the frame matched to
7263 * @skb: The skbuf with the control port frame. It is assumed that the skbuf
7264 * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
7265 * This function does not take ownership of the skb, so the caller is
7266 * responsible for any cleanup. The caller must also ensure that
7267 * skb->protocol is set appropriately.
7268 * @unencrypted: Whether the frame was received unencrypted
7270 * This function is used to inform userspace about a received control port
7271 * frame. It should only be used if userspace indicated it wants to receive
7272 * control port frames over nl80211.
7274 * The frame is the data portion of the 802.3 or 802.11 data frame with all
7275 * network layer headers removed (e.g. the raw EAPoL frame).
7277 * Return: %true if the frame was passed to userspace
7279 bool cfg80211_rx_control_port(struct net_device *dev,
7280 struct sk_buff *skb, bool unencrypted);
7283 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7284 * @dev: network device
7285 * @rssi_event: the triggered RSSI event
7286 * @rssi_level: new RSSI level value or 0 if not available
7287 * @gfp: context flags
7289 * This function is called when a configured connection quality monitoring
7290 * rssi threshold reached event occurs.
7292 void cfg80211_cqm_rssi_notify(struct net_device *dev,
7293 enum nl80211_cqm_rssi_threshold_event rssi_event,
7294 s32 rssi_level, gfp_t gfp);
7297 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7298 * @dev: network device
7299 * @peer: peer's MAC address
7300 * @num_packets: how many packets were lost -- should be a fixed threshold
7301 * but probably no less than maybe 50, or maybe a throughput dependent
7302 * threshold (to account for temporary interference)
7303 * @gfp: context flags
7305 void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7306 const u8 *peer, u32 num_packets, gfp_t gfp);
7309 * cfg80211_cqm_txe_notify - TX error rate event
7310 * @dev: network device
7311 * @peer: peer's MAC address
7312 * @num_packets: how many packets were lost
7313 * @rate: % of packets which failed transmission
7314 * @intvl: interval (in s) over which the TX failure threshold was breached.
7315 * @gfp: context flags
7317 * Notify userspace when configured % TX failures over number of packets in a
7318 * given interval is exceeded.
7320 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
7321 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
7324 * cfg80211_cqm_beacon_loss_notify - beacon loss event
7325 * @dev: network device
7326 * @gfp: context flags
7328 * Notify userspace about beacon loss from the connected AP.
7330 void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
7333 * cfg80211_radar_event - radar detection event
7335 * @chandef: chandef for the current channel
7336 * @gfp: context flags
7338 * This function is called when a radar is detected on the current chanenl.
7340 void cfg80211_radar_event(struct wiphy *wiphy,
7341 struct cfg80211_chan_def *chandef, gfp_t gfp);
7344 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7345 * @dev: network device
7346 * @mac: MAC address of a station which opmode got modified
7347 * @sta_opmode: station's current opmode value
7348 * @gfp: context flags
7350 * Driver should call this function when station's opmode modified via action
7353 void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7354 struct sta_opmode_info *sta_opmode,
7358 * cfg80211_cac_event - Channel availability check (CAC) event
7359 * @netdev: network device
7360 * @chandef: chandef for the current channel
7361 * @event: type of event
7362 * @gfp: context flags
7364 * This function is called when a Channel availability check (CAC) is finished
7365 * or aborted. This must be called to notify the completion of a CAC process,
7366 * also by full-MAC drivers.
7368 void cfg80211_cac_event(struct net_device *netdev,
7369 const struct cfg80211_chan_def *chandef,
7370 enum nl80211_radar_event event, gfp_t gfp);
7374 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7375 * @dev: network device
7376 * @bssid: BSSID of AP (to avoid races)
7377 * @replay_ctr: new replay counter
7378 * @gfp: allocation flags
7380 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7381 const u8 *replay_ctr, gfp_t gfp);
7384 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7385 * @dev: network device
7386 * @index: candidate index (the smaller the index, the higher the priority)
7387 * @bssid: BSSID of AP
7388 * @preauth: Whether AP advertises support for RSN pre-authentication
7389 * @gfp: allocation flags
7391 void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7392 const u8 *bssid, bool preauth, gfp_t gfp);
7395 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
7396 * @dev: The device the frame matched to
7397 * @addr: the transmitter address
7398 * @gfp: context flags
7400 * This function is used in AP mode (only!) to inform userspace that
7401 * a spurious class 3 frame was received, to be able to deauth the
7403 * Return: %true if the frame was passed to userspace (or this failed
7404 * for a reason other than not having a subscription.)
7406 bool cfg80211_rx_spurious_frame(struct net_device *dev,
7407 const u8 *addr, gfp_t gfp);
7410 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7411 * @dev: The device the frame matched to
7412 * @addr: the transmitter address
7413 * @gfp: context flags
7415 * This function is used in AP mode (only!) to inform userspace that
7416 * an associated station sent a 4addr frame but that wasn't expected.
7417 * It is allowed and desirable to send this event only once for each
7418 * station to avoid event flooding.
7419 * Return: %true if the frame was passed to userspace (or this failed
7420 * for a reason other than not having a subscription.)
7422 bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7423 const u8 *addr, gfp_t gfp);
7426 * cfg80211_probe_status - notify userspace about probe status
7427 * @dev: the device the probe was sent on
7428 * @addr: the address of the peer
7429 * @cookie: the cookie filled in @probe_client previously
7430 * @acked: indicates whether probe was acked or not
7431 * @ack_signal: signal strength (in dBm) of the ACK frame.
7432 * @is_valid_ack_signal: indicates the ack_signal is valid or not.
7433 * @gfp: allocation flags
7435 void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7436 u64 cookie, bool acked, s32 ack_signal,
7437 bool is_valid_ack_signal, gfp_t gfp);
7440 * cfg80211_report_obss_beacon_khz - report beacon from other APs
7441 * @wiphy: The wiphy that received the beacon
7443 * @len: length of the frame
7444 * @freq: frequency the frame was received on in KHz
7445 * @sig_dbm: signal strength in dBm, or 0 if unknown
7447 * Use this function to report to userspace when a beacon was
7448 * received. It is not useful to call this when there is no
7449 * netdev that is in AP/GO mode.
7451 void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7452 size_t len, int freq, int sig_dbm);
7455 * cfg80211_report_obss_beacon - report beacon from other APs
7456 * @wiphy: The wiphy that received the beacon
7458 * @len: length of the frame
7459 * @freq: frequency the frame was received on
7460 * @sig_dbm: signal strength in dBm, or 0 if unknown
7462 * Use this function to report to userspace when a beacon was
7463 * received. It is not useful to call this when there is no
7464 * netdev that is in AP/GO mode.
7466 static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
7467 const u8 *frame, size_t len,
7468 int freq, int sig_dbm)
7470 cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7475 * cfg80211_reg_can_beacon - check if beaconing is allowed
7477 * @chandef: the channel definition
7478 * @iftype: interface type
7480 * Return: %true if there is no secondary channel or the secondary channel(s)
7481 * can be used for beaconing (i.e. is not a radar channel etc.)
7483 bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7484 struct cfg80211_chan_def *chandef,
7485 enum nl80211_iftype iftype);
7488 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7490 * @chandef: the channel definition
7491 * @iftype: interface type
7493 * Return: %true if there is no secondary channel or the secondary channel(s)
7494 * can be used for beaconing (i.e. is not a radar channel etc.). This version
7495 * also checks if IR-relaxation conditions apply, to allow beaconing under
7496 * more permissive conditions.
7498 * Requires the RTNL to be held.
7500 bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7501 struct cfg80211_chan_def *chandef,
7502 enum nl80211_iftype iftype);
7505 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
7506 * @dev: the device which switched channels
7507 * @chandef: the new channel definition
7509 * Caller must acquire wdev_lock, therefore must only be called from sleepable
7512 void cfg80211_ch_switch_notify(struct net_device *dev,
7513 struct cfg80211_chan_def *chandef);
7516 * cfg80211_ch_switch_started_notify - notify channel switch start
7517 * @dev: the device on which the channel switch started
7518 * @chandef: the future channel definition
7519 * @count: the number of TBTTs until the channel switch happens
7521 * Inform the userspace about the channel switch that has just
7522 * started, so that it can take appropriate actions (eg. starting
7523 * channel switch on other vifs), if necessary.
7525 void cfg80211_ch_switch_started_notify(struct net_device *dev,
7526 struct cfg80211_chan_def *chandef,
7530 * ieee80211_operating_class_to_band - convert operating class to band
7532 * @operating_class: the operating class to convert
7533 * @band: band pointer to fill
7535 * Returns %true if the conversion was successful, %false otherwise.
7537 bool ieee80211_operating_class_to_band(u8 operating_class,
7538 enum nl80211_band *band);
7541 * ieee80211_chandef_to_operating_class - convert chandef to operation class
7543 * @chandef: the chandef to convert
7544 * @op_class: a pointer to the resulting operating class
7546 * Returns %true if the conversion was successful, %false otherwise.
7548 bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7552 * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7554 * @chandef: the chandef to convert
7556 * Returns the center frequency of chandef (1st segment) in KHz.
7559 ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7561 return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7565 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
7566 * @dev: the device on which the operation is requested
7567 * @peer: the MAC address of the peer device
7568 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
7569 * NL80211_TDLS_TEARDOWN)
7570 * @reason_code: the reason code for teardown request
7571 * @gfp: allocation flags
7573 * This function is used to request userspace to perform TDLS operation that
7574 * requires knowledge of keys, i.e., link setup or teardown when the AP
7575 * connection uses encryption. This is optional mechanism for the driver to use
7576 * if it can automatically determine when a TDLS link could be useful (e.g.,
7577 * based on traffic and signal strength for a peer).
7579 void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
7580 enum nl80211_tdls_operation oper,
7581 u16 reason_code, gfp_t gfp);
7584 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
7585 * @rate: given rate_info to calculate bitrate from
7587 * return 0 if MCS index >= 32
7589 u32 cfg80211_calculate_bitrate(struct rate_info *rate);
7592 * cfg80211_unregister_wdev - remove the given wdev
7593 * @wdev: struct wireless_dev to remove
7595 * Call this function only for wdevs that have no netdev assigned,
7596 * e.g. P2P Devices. It removes the device from the list so that
7597 * it can no longer be used. It is necessary to call this function
7598 * even when cfg80211 requests the removal of the interface by
7599 * calling the del_virtual_intf() callback. The function must also
7600 * be called when the driver wishes to unregister the wdev, e.g.
7601 * when the device is unbound from the driver.
7603 * Requires the RTNL to be held.
7605 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
7608 * struct cfg80211_ft_event - FT Information Elements
7610 * @ies_len: length of the FT IE in bytes
7611 * @target_ap: target AP's MAC address
7613 * @ric_ies_len: length of the RIC IE in bytes
7615 struct cfg80211_ft_event_params {
7618 const u8 *target_ap;
7624 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7625 * @netdev: network device
7626 * @ft_event: IE information
7628 void cfg80211_ft_event(struct net_device *netdev,
7629 struct cfg80211_ft_event_params *ft_event);
7632 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
7633 * @ies: the input IE buffer
7634 * @len: the input length
7635 * @attr: the attribute ID to find
7636 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
7637 * if the function is only called to get the needed buffer size
7638 * @bufsize: size of the output buffer
7640 * The function finds a given P2P attribute in the (vendor) IEs and
7641 * copies its contents to the given buffer.
7643 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
7644 * malformed or the attribute can't be found (respectively), or the
7645 * length of the found attribute (which can be zero).
7647 int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7648 enum ieee80211_p2p_attr_id attr,
7649 u8 *buf, unsigned int bufsize);
7652 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
7653 * @ies: the IE buffer
7654 * @ielen: the length of the IE buffer
7655 * @ids: an array with element IDs that are allowed before
7656 * the split. A WLAN_EID_EXTENSION value means that the next
7657 * EID in the list is a sub-element of the EXTENSION IE.
7658 * @n_ids: the size of the element ID array
7659 * @after_ric: array IE types that come after the RIC element
7660 * @n_after_ric: size of the @after_ric array
7661 * @offset: offset where to start splitting in the buffer
7663 * This function splits an IE buffer by updating the @offset
7664 * variable to point to the location where the buffer should be
7667 * It assumes that the given IE buffer is well-formed, this
7668 * has to be guaranteed by the caller!
7670 * It also assumes that the IEs in the buffer are ordered
7671 * correctly, if not the result of using this function will not
7672 * be ordered correctly either, i.e. it does no reordering.
7674 * The function returns the offset where the next part of the
7675 * buffer starts, which may be @ielen if the entire (remainder)
7676 * of the buffer should be used.
7678 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
7679 const u8 *ids, int n_ids,
7680 const u8 *after_ric, int n_after_ric,
7684 * ieee80211_ie_split - split an IE buffer according to ordering
7685 * @ies: the IE buffer
7686 * @ielen: the length of the IE buffer
7687 * @ids: an array with element IDs that are allowed before
7688 * the split. A WLAN_EID_EXTENSION value means that the next
7689 * EID in the list is a sub-element of the EXTENSION IE.
7690 * @n_ids: the size of the element ID array
7691 * @offset: offset where to start splitting in the buffer
7693 * This function splits an IE buffer by updating the @offset
7694 * variable to point to the location where the buffer should be
7697 * It assumes that the given IE buffer is well-formed, this
7698 * has to be guaranteed by the caller!
7700 * It also assumes that the IEs in the buffer are ordered
7701 * correctly, if not the result of using this function will not
7702 * be ordered correctly either, i.e. it does no reordering.
7704 * The function returns the offset where the next part of the
7705 * buffer starts, which may be @ielen if the entire (remainder)
7706 * of the buffer should be used.
7708 static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
7709 const u8 *ids, int n_ids, size_t offset)
7711 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
7715 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7716 * @wdev: the wireless device reporting the wakeup
7717 * @wakeup: the wakeup report
7718 * @gfp: allocation flags
7720 * This function reports that the given device woke up. If it
7721 * caused the wakeup, report the reason(s), otherwise you may
7722 * pass %NULL as the @wakeup parameter to advertise that something
7723 * else caused the wakeup.
7725 void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7726 struct cfg80211_wowlan_wakeup *wakeup,
7730 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
7732 * @wdev: the wireless device for which critical protocol is stopped.
7733 * @gfp: allocation flags
7735 * This function can be called by the driver to indicate it has reverted
7736 * operation back to normal. One reason could be that the duration given
7737 * by .crit_proto_start() has expired.
7739 void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
7742 * ieee80211_get_num_supported_channels - get number of channels device has
7745 * Return: the number of channels supported by the device.
7747 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7750 * cfg80211_check_combinations - check interface combinations
7753 * @params: the interface combinations parameter
7755 * This function can be called by the driver to check whether a
7756 * combination of interfaces and their types are allowed according to
7757 * the interface combinations.
7759 int cfg80211_check_combinations(struct wiphy *wiphy,
7760 struct iface_combination_params *params);
7763 * cfg80211_iter_combinations - iterate over matching combinations
7766 * @params: the interface combinations parameter
7767 * @iter: function to call for each matching combination
7768 * @data: pointer to pass to iter function
7770 * This function can be called by the driver to check what possible
7771 * combinations it fits in at a given moment, e.g. for channel switching
7774 int cfg80211_iter_combinations(struct wiphy *wiphy,
7775 struct iface_combination_params *params,
7776 void (*iter)(const struct ieee80211_iface_combination *c,
7781 * cfg80211_stop_iface - trigger interface disconnection
7784 * @wdev: wireless device
7785 * @gfp: context flags
7787 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7790 * Note: This doesn't need any locks and is asynchronous.
7792 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7796 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7797 * @wiphy: the wiphy to shut down
7799 * This function shuts down all interfaces belonging to this wiphy by
7800 * calling dev_close() (and treating non-netdev interfaces as needed).
7801 * It shouldn't really be used unless there are some fatal device errors
7802 * that really can't be recovered in any other way.
7804 * Callers must hold the RTNL and be able to deal with callbacks into
7805 * the driver while the function is running.
7807 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7810 * wiphy_ext_feature_set - set the extended feature flag
7812 * @wiphy: the wiphy to modify.
7813 * @ftidx: extended feature bit index.
7815 * The extended features are flagged in multiple bytes (see
7816 * &struct wiphy.@ext_features)
7818 static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7819 enum nl80211_ext_feature_index ftidx)
7823 ft_byte = &wiphy->ext_features[ftidx / 8];
7824 *ft_byte |= BIT(ftidx % 8);
7828 * wiphy_ext_feature_isset - check the extended feature flag
7830 * @wiphy: the wiphy to modify.
7831 * @ftidx: extended feature bit index.
7833 * The extended features are flagged in multiple bytes (see
7834 * &struct wiphy.@ext_features)
7837 wiphy_ext_feature_isset(struct wiphy *wiphy,
7838 enum nl80211_ext_feature_index ftidx)
7842 ft_byte = wiphy->ext_features[ftidx / 8];
7843 return (ft_byte & BIT(ftidx % 8)) != 0;
7847 * cfg80211_free_nan_func - free NAN function
7848 * @f: NAN function that should be freed
7850 * Frees all the NAN function and all it's allocated members.
7852 void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7855 * struct cfg80211_nan_match_params - NAN match parameters
7856 * @type: the type of the function that triggered a match. If it is
7857 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
7858 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
7860 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
7861 * @inst_id: the local instance id
7862 * @peer_inst_id: the instance id of the peer's function
7863 * @addr: the MAC address of the peer
7864 * @info_len: the length of the &info
7865 * @info: the Service Specific Info from the peer (if any)
7866 * @cookie: unique identifier of the corresponding function
7868 struct cfg80211_nan_match_params {
7869 enum nl80211_nan_function_type type;
7879 * cfg80211_nan_match - report a match for a NAN function.
7880 * @wdev: the wireless device reporting the match
7881 * @match: match notification parameters
7882 * @gfp: allocation flags
7884 * This function reports that the a NAN function had a match. This
7885 * can be a subscribe that had a match or a solicited publish that
7886 * was sent. It can also be a follow up that was received.
7888 void cfg80211_nan_match(struct wireless_dev *wdev,
7889 struct cfg80211_nan_match_params *match, gfp_t gfp);
7892 * cfg80211_nan_func_terminated - notify about NAN function termination.
7894 * @wdev: the wireless device reporting the match
7895 * @inst_id: the local instance id
7896 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7897 * @cookie: unique NAN function identifier
7898 * @gfp: allocation flags
7900 * This function reports that the a NAN function is terminated.
7902 void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7904 enum nl80211_nan_func_term_reason reason,
7905 u64 cookie, gfp_t gfp);
7907 /* ethtool helper */
7908 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7911 * cfg80211_external_auth_request - userspace request for authentication
7912 * @netdev: network device
7913 * @params: External authentication parameters
7914 * @gfp: allocation flags
7915 * Returns: 0 on success, < 0 on error
7917 int cfg80211_external_auth_request(struct net_device *netdev,
7918 struct cfg80211_external_auth_params *params,
7922 * cfg80211_pmsr_report - report peer measurement result data
7923 * @wdev: the wireless device reporting the measurement
7924 * @req: the original measurement request
7925 * @result: the result data
7926 * @gfp: allocation flags
7928 void cfg80211_pmsr_report(struct wireless_dev *wdev,
7929 struct cfg80211_pmsr_request *req,
7930 struct cfg80211_pmsr_result *result,
7934 * cfg80211_pmsr_complete - report peer measurement completed
7935 * @wdev: the wireless device reporting the measurement
7936 * @req: the original measurement request
7937 * @gfp: allocation flags
7939 * Report that the entire measurement completed, after this
7940 * the request pointer will no longer be valid.
7942 void cfg80211_pmsr_complete(struct wireless_dev *wdev,
7943 struct cfg80211_pmsr_request *req,
7947 * cfg80211_iftype_allowed - check whether the interface can be allowed
7949 * @iftype: interface type
7950 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
7951 * @check_swif: check iftype against software interfaces
7953 * Check whether the interface is allowed to operate; additionally, this API
7954 * can be used to check iftype against the software interfaces when
7955 * check_swif is '1'.
7957 bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
7958 bool is_4addr, u8 check_swif);
7961 /* Logging, debugging and troubleshooting/diagnostic helpers. */
7963 /* wiphy_printk helpers, similar to dev_printk */
7965 #define wiphy_printk(level, wiphy, format, args...) \
7966 dev_printk(level, &(wiphy)->dev, format, ##args)
7967 #define wiphy_emerg(wiphy, format, args...) \
7968 dev_emerg(&(wiphy)->dev, format, ##args)
7969 #define wiphy_alert(wiphy, format, args...) \
7970 dev_alert(&(wiphy)->dev, format, ##args)
7971 #define wiphy_crit(wiphy, format, args...) \
7972 dev_crit(&(wiphy)->dev, format, ##args)
7973 #define wiphy_err(wiphy, format, args...) \
7974 dev_err(&(wiphy)->dev, format, ##args)
7975 #define wiphy_warn(wiphy, format, args...) \
7976 dev_warn(&(wiphy)->dev, format, ##args)
7977 #define wiphy_notice(wiphy, format, args...) \
7978 dev_notice(&(wiphy)->dev, format, ##args)
7979 #define wiphy_info(wiphy, format, args...) \
7980 dev_info(&(wiphy)->dev, format, ##args)
7982 #define wiphy_err_ratelimited(wiphy, format, args...) \
7983 dev_err_ratelimited(&(wiphy)->dev, format, ##args)
7984 #define wiphy_warn_ratelimited(wiphy, format, args...) \
7985 dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
7987 #define wiphy_debug(wiphy, format, args...) \
7988 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
7990 #define wiphy_dbg(wiphy, format, args...) \
7991 dev_dbg(&(wiphy)->dev, format, ##args)
7993 #if defined(VERBOSE_DEBUG)
7994 #define wiphy_vdbg wiphy_dbg
7996 #define wiphy_vdbg(wiphy, format, args...) \
7999 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
8005 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8006 * of using a WARN/WARN_ON to get the message out, including the
8007 * file/line information and a backtrace.
8009 #define wiphy_WARN(wiphy, format, args...) \
8010 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8013 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8014 * @netdev: network device
8015 * @owe_info: peer's owe info
8016 * @gfp: allocation flags
8018 void cfg80211_update_owe_info_event(struct net_device *netdev,
8019 struct cfg80211_update_owe_info *owe_info,
8023 * cfg80211_bss_flush - resets all the scan entries
8026 void cfg80211_bss_flush(struct wiphy *wiphy);
8028 #endif /* __NET_CFG80211_H */