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/ethtool.h>
14 #include <linux/netdevice.h>
15 #include <linux/debugfs.h>
16 #include <linux/list.h>
17 #include <linux/bug.h>
18 #include <linux/netlink.h>
19 #include <linux/skbuff.h>
20 #include <linux/nl80211.h>
21 #include <linux/if_ether.h>
22 #include <linux/ieee80211.h>
23 #include <linux/net.h>
24 #include <net/regulatory.h>
29 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
30 * userspace and drivers, and offers some utility functionality associated
31 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
32 * by all modern wireless drivers in Linux, so that they offer a consistent
33 * API through nl80211. For backward compatibility, cfg80211 also offers
34 * wireless extensions to userspace, but hides them from drivers completely.
36 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
42 * DOC: Device registration
44 * In order for a driver to use cfg80211, it must register the hardware device
45 * with cfg80211. This happens through a number of hardware capability structs
48 * The fundamental structure for each device is the 'wiphy', of which each
49 * instance describes a physical wireless device connected to the system. Each
50 * such wiphy can have zero, one, or many virtual interfaces associated with
51 * it, which need to be identified as such by pointing the network interface's
52 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
53 * the wireless part of the interface, normally this struct is embedded in the
54 * network interface's private data area. Drivers can optionally allow creating
55 * or destroying virtual interfaces on the fly, but without at least one or the
56 * ability to create some the wireless device isn't useful.
58 * Each wiphy structure contains device capability information, and also has
59 * a pointer to the various operations the driver offers. The definitions and
60 * structures here describe these capabilities in detail.
66 * wireless hardware capability structures
70 * enum ieee80211_channel_flags - channel flags
72 * Channel flags set by the regulatory control code.
74 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
75 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
76 * sending probe requests or beaconing.
77 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
78 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
80 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
82 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
83 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
84 * this flag indicates that an 80 MHz channel cannot use this
85 * channel as the control or any of the secondary channels.
86 * This may be due to the driver or due to regulatory bandwidth
88 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
89 * this flag indicates that an 160 MHz channel cannot use this
90 * channel as the control or any of the secondary channels.
91 * This may be due to the driver or due to regulatory bandwidth
93 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
94 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
95 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
97 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
99 * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
100 * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
102 * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
104 * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
106 * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
108 * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
112 enum ieee80211_channel_flags {
113 IEEE80211_CHAN_DISABLED = 1<<0,
114 IEEE80211_CHAN_NO_IR = 1<<1,
116 IEEE80211_CHAN_RADAR = 1<<3,
117 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
118 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
119 IEEE80211_CHAN_NO_OFDM = 1<<6,
120 IEEE80211_CHAN_NO_80MHZ = 1<<7,
121 IEEE80211_CHAN_NO_160MHZ = 1<<8,
122 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
123 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
124 IEEE80211_CHAN_NO_20MHZ = 1<<11,
125 IEEE80211_CHAN_NO_10MHZ = 1<<12,
126 IEEE80211_CHAN_NO_HE = 1<<13,
127 IEEE80211_CHAN_1MHZ = 1<<14,
128 IEEE80211_CHAN_2MHZ = 1<<15,
129 IEEE80211_CHAN_4MHZ = 1<<16,
130 IEEE80211_CHAN_8MHZ = 1<<17,
131 IEEE80211_CHAN_16MHZ = 1<<18,
134 #define IEEE80211_CHAN_NO_HT40 \
135 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
137 #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
138 #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
141 * struct ieee80211_channel - channel definition
143 * This structure describes a single channel for use
146 * @center_freq: center frequency in MHz
147 * @freq_offset: offset from @center_freq, in KHz
148 * @hw_value: hardware-specific value for the channel
149 * @flags: channel flags from &enum ieee80211_channel_flags.
150 * @orig_flags: channel flags at registration time, used by regulatory
151 * code to support devices with additional restrictions
152 * @band: band this channel belongs to.
153 * @max_antenna_gain: maximum antenna gain in dBi
154 * @max_power: maximum transmission power (in dBm)
155 * @max_reg_power: maximum regulatory transmission power (in dBm)
156 * @beacon_found: helper to regulatory code to indicate when a beacon
157 * has been found on this channel. Use regulatory_hint_found_beacon()
158 * to enable this, this is useful only on 5 GHz band.
159 * @orig_mag: internal use
160 * @orig_mpwr: internal use
161 * @dfs_state: current state of this channel. Only relevant if radar is required
163 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
164 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
166 struct ieee80211_channel {
167 enum nl80211_band band;
172 int max_antenna_gain;
177 int orig_mag, orig_mpwr;
178 enum nl80211_dfs_state dfs_state;
179 unsigned long dfs_state_entered;
180 unsigned int dfs_cac_ms;
184 * enum ieee80211_rate_flags - rate flags
186 * Hardware/specification flags for rates. These are structured
187 * in a way that allows using the same bitrate structure for
188 * different bands/PHY modes.
190 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
191 * preamble on this bitrate; only relevant in 2.4GHz band and
193 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
194 * when used with 802.11a (on the 5 GHz band); filled by the
195 * core code when registering the wiphy.
196 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
197 * when used with 802.11b (on the 2.4 GHz band); filled by the
198 * core code when registering the wiphy.
199 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
200 * when used with 802.11g (on the 2.4 GHz band); filled by the
201 * core code when registering the wiphy.
202 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
203 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
204 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
206 enum ieee80211_rate_flags {
207 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
208 IEEE80211_RATE_MANDATORY_A = 1<<1,
209 IEEE80211_RATE_MANDATORY_B = 1<<2,
210 IEEE80211_RATE_MANDATORY_G = 1<<3,
211 IEEE80211_RATE_ERP_G = 1<<4,
212 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
213 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
217 * enum ieee80211_bss_type - BSS type filter
219 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
220 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
221 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
222 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
223 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
225 enum ieee80211_bss_type {
226 IEEE80211_BSS_TYPE_ESS,
227 IEEE80211_BSS_TYPE_PBSS,
228 IEEE80211_BSS_TYPE_IBSS,
229 IEEE80211_BSS_TYPE_MBSS,
230 IEEE80211_BSS_TYPE_ANY
234 * enum ieee80211_privacy - BSS privacy filter
236 * @IEEE80211_PRIVACY_ON: privacy bit set
237 * @IEEE80211_PRIVACY_OFF: privacy bit clear
238 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
240 enum ieee80211_privacy {
241 IEEE80211_PRIVACY_ON,
242 IEEE80211_PRIVACY_OFF,
243 IEEE80211_PRIVACY_ANY
246 #define IEEE80211_PRIVACY(x) \
247 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
250 * struct ieee80211_rate - bitrate definition
252 * This structure describes a bitrate that an 802.11 PHY can
253 * operate with. The two values @hw_value and @hw_value_short
254 * are only for driver use when pointers to this structure are
257 * @flags: rate-specific flags
258 * @bitrate: bitrate in units of 100 Kbps
259 * @hw_value: driver/hardware value for this rate
260 * @hw_value_short: driver/hardware value for this rate when
261 * short preamble is used
263 struct ieee80211_rate {
266 u16 hw_value, hw_value_short;
270 * struct ieee80211_he_obss_pd - AP settings for spatial reuse
272 * @enable: is the feature enabled.
273 * @sr_ctrl: The SR Control field of SRP element.
274 * @non_srg_max_offset: non-SRG maximum tx power offset
275 * @min_offset: minimal tx power offset an associated station shall use
276 * @max_offset: maximum tx power offset an associated station shall use
277 * @bss_color_bitmap: bitmap that indicates the BSS color values used by
279 * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
280 * used by members of the SRG
282 struct ieee80211_he_obss_pd {
285 u8 non_srg_max_offset;
288 u8 bss_color_bitmap[8];
289 u8 partial_bssid_bitmap[8];
293 * struct cfg80211_he_bss_color - AP settings for BSS coloring
295 * @color: the current color.
296 * @enabled: HE BSS color is used
297 * @partial: define the AID equation.
299 struct cfg80211_he_bss_color {
306 * struct ieee80211_sta_ht_cap - STA's HT capabilities
308 * This structure describes most essential parameters needed
309 * to describe 802.11n HT capabilities for an STA.
311 * @ht_supported: is HT supported by the STA
312 * @cap: HT capabilities map as described in 802.11n spec
313 * @ampdu_factor: Maximum A-MPDU length factor
314 * @ampdu_density: Minimum A-MPDU spacing
315 * @mcs: Supported MCS rates
317 struct ieee80211_sta_ht_cap {
318 u16 cap; /* use IEEE80211_HT_CAP_ */
322 struct ieee80211_mcs_info mcs;
326 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
328 * This structure describes most essential parameters needed
329 * to describe 802.11ac VHT capabilities for an STA.
331 * @vht_supported: is VHT supported by the STA
332 * @cap: VHT capabilities map as described in 802.11ac spec
333 * @vht_mcs: Supported VHT MCS rates
335 struct ieee80211_sta_vht_cap {
337 u32 cap; /* use IEEE80211_VHT_CAP_ */
338 struct ieee80211_vht_mcs_info vht_mcs;
341 #define IEEE80211_HE_PPE_THRES_MAX_LEN 25
344 * struct ieee80211_sta_he_cap - STA's HE capabilities
346 * This structure describes most essential parameters needed
347 * to describe 802.11ax HE capabilities for a STA.
349 * @has_he: true iff HE data is valid.
350 * @he_cap_elem: Fixed portion of the HE capabilities element.
351 * @he_mcs_nss_supp: The supported NSS/MCS combinations.
352 * @ppe_thres: Holds the PPE Thresholds data.
354 struct ieee80211_sta_he_cap {
356 struct ieee80211_he_cap_elem he_cap_elem;
357 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
358 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
362 * struct ieee80211_sband_iftype_data
364 * This structure encapsulates sband data that is relevant for the
365 * interface types defined in @types_mask. Each type in the
366 * @types_mask must be unique across all instances of iftype_data.
368 * @types_mask: interface types mask
369 * @he_cap: holds the HE capabilities
370 * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
371 * 6 GHz band channel (and 0 may be valid value).
373 struct ieee80211_sband_iftype_data {
375 struct ieee80211_sta_he_cap he_cap;
376 struct ieee80211_he_6ghz_capa he_6ghz_capa;
380 * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
382 * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
383 * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
384 * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
385 * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
386 * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
387 * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
388 * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
389 * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
391 * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
393 * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
395 * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
396 * and 4.32GHz + 4.32GHz
397 * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
398 * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
400 enum ieee80211_edmg_bw_config {
401 IEEE80211_EDMG_BW_CONFIG_4 = 4,
402 IEEE80211_EDMG_BW_CONFIG_5 = 5,
403 IEEE80211_EDMG_BW_CONFIG_6 = 6,
404 IEEE80211_EDMG_BW_CONFIG_7 = 7,
405 IEEE80211_EDMG_BW_CONFIG_8 = 8,
406 IEEE80211_EDMG_BW_CONFIG_9 = 9,
407 IEEE80211_EDMG_BW_CONFIG_10 = 10,
408 IEEE80211_EDMG_BW_CONFIG_11 = 11,
409 IEEE80211_EDMG_BW_CONFIG_12 = 12,
410 IEEE80211_EDMG_BW_CONFIG_13 = 13,
411 IEEE80211_EDMG_BW_CONFIG_14 = 14,
412 IEEE80211_EDMG_BW_CONFIG_15 = 15,
416 * struct ieee80211_edmg - EDMG configuration
418 * This structure describes most essential parameters needed
419 * to describe 802.11ay EDMG configuration
421 * @channels: bitmap that indicates the 2.16 GHz channel(s)
422 * that are allowed to be used for transmissions.
423 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
424 * Set to 0 indicate EDMG not supported.
425 * @bw_config: Channel BW Configuration subfield encodes
426 * the allowed channel bandwidth configurations
428 struct ieee80211_edmg {
430 enum ieee80211_edmg_bw_config bw_config;
434 * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
436 * This structure describes most essential parameters needed
437 * to describe 802.11ah S1G capabilities for a STA.
439 * @s1g_supported: is STA an S1G STA
440 * @cap: S1G capabilities information
441 * @nss_mcs: Supported NSS MCS set
443 struct ieee80211_sta_s1g_cap {
445 u8 cap[10]; /* use S1G_CAPAB_ */
450 * struct ieee80211_supported_band - frequency band definition
452 * This structure describes a frequency band a wiphy
453 * is able to operate in.
455 * @channels: Array of channels the hardware can operate with
457 * @band: the band this structure represents
458 * @n_channels: Number of channels in @channels
459 * @bitrates: Array of bitrates the hardware can operate with
460 * in this band. Must be sorted to give a valid "supported
461 * rates" IE, i.e. CCK rates first, then OFDM.
462 * @n_bitrates: Number of bitrates in @bitrates
463 * @ht_cap: HT capabilities in this band
464 * @vht_cap: VHT capabilities in this band
465 * @s1g_cap: S1G capabilities in this band
466 * @edmg_cap: EDMG capabilities in this band
467 * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
468 * @n_iftype_data: number of iftype data entries
469 * @iftype_data: interface type data entries. Note that the bits in
470 * @types_mask inside this structure cannot overlap (i.e. only
471 * one occurrence of each type is allowed across all instances of
474 struct ieee80211_supported_band {
475 struct ieee80211_channel *channels;
476 struct ieee80211_rate *bitrates;
477 enum nl80211_band band;
480 struct ieee80211_sta_ht_cap ht_cap;
481 struct ieee80211_sta_vht_cap vht_cap;
482 struct ieee80211_sta_s1g_cap s1g_cap;
483 struct ieee80211_edmg edmg_cap;
485 const struct ieee80211_sband_iftype_data *iftype_data;
489 * ieee80211_get_sband_iftype_data - return sband data for a given iftype
490 * @sband: the sband to search for the STA on
491 * @iftype: enum nl80211_iftype
493 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
495 static inline const struct ieee80211_sband_iftype_data *
496 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
501 if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
504 for (i = 0; i < sband->n_iftype_data; i++) {
505 const struct ieee80211_sband_iftype_data *data =
506 &sband->iftype_data[i];
508 if (data->types_mask & BIT(iftype))
516 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
517 * @sband: the sband to search for the iftype on
518 * @iftype: enum nl80211_iftype
520 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
522 static inline const struct ieee80211_sta_he_cap *
523 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
526 const struct ieee80211_sband_iftype_data *data =
527 ieee80211_get_sband_iftype_data(sband, iftype);
529 if (data && data->he_cap.has_he)
530 return &data->he_cap;
536 * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
537 * @sband: the sband to search for the STA on
539 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
541 static inline const struct ieee80211_sta_he_cap *
542 ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
544 return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
548 * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
549 * @sband: the sband to search for the STA on
550 * @iftype: the iftype to search for
552 * Return: the 6GHz capabilities
555 ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
556 enum nl80211_iftype iftype)
558 const struct ieee80211_sband_iftype_data *data =
559 ieee80211_get_sband_iftype_data(sband, iftype);
561 if (WARN_ON(!data || !data->he_cap.has_he))
564 return data->he_6ghz_capa.capa;
568 * wiphy_read_of_freq_limits - read frequency limits from device tree
570 * @wiphy: the wireless device to get extra limits for
572 * Some devices may have extra limitations specified in DT. This may be useful
573 * for chipsets that normally support more bands but are limited due to board
574 * design (e.g. by antennas or external power amplifier).
576 * This function reads info from DT and uses it to *modify* channels (disable
577 * unavailable ones). It's usually a *bad* idea to use it in drivers with
578 * shared channel data as DT limitations are device specific. You should make
579 * sure to call it only if channels in wiphy are copied and can be modified
580 * without affecting other devices.
582 * As this function access device node it has to be called after set_wiphy_dev.
583 * It also modifies channels so they have to be set first.
584 * If using this helper, call it before wiphy_register().
587 void wiphy_read_of_freq_limits(struct wiphy *wiphy);
588 #else /* CONFIG_OF */
589 static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
592 #endif /* !CONFIG_OF */
596 * Wireless hardware/device configuration structures and methods
600 * DOC: Actions and configuration
602 * Each wireless device and each virtual interface offer a set of configuration
603 * operations and other actions that are invoked by userspace. Each of these
604 * actions is described in the operations structure, and the parameters these
605 * operations use are described separately.
607 * Additionally, some operations are asynchronous and expect to get status
608 * information via some functions that drivers need to call.
610 * Scanning and BSS list handling with its associated functionality is described
611 * in a separate chapter.
614 #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
615 WLAN_USER_POSITION_LEN)
618 * struct vif_params - describes virtual interface parameters
619 * @flags: monitor interface flags, unchanged if 0, otherwise
620 * %MONITOR_FLAG_CHANGED will be set
621 * @use_4addr: use 4-address frames
622 * @macaddr: address to use for this virtual interface.
623 * If this parameter is set to zero address the driver may
624 * determine the address as needed.
625 * This feature is only fully supported by drivers that enable the
626 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
627 ** only p2p devices with specified MAC.
628 * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
629 * belonging to that MU-MIMO groupID; %NULL if not changed
630 * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
631 * MU-MIMO packets going to the specified station; %NULL if not changed
636 u8 macaddr[ETH_ALEN];
637 const u8 *vht_mumimo_groups;
638 const u8 *vht_mumimo_follow_addr;
642 * struct key_params - key information
644 * Information about a key
647 * @key_len: length of key material
648 * @cipher: cipher suite selector
649 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
650 * with the get_key() callback, must be in little endian,
651 * length given by @seq_len.
652 * @seq_len: length of @seq.
653 * @vlan_id: vlan_id for VLAN group key (if nonzero)
654 * @mode: key install mode (RX_TX, NO_TX or SET_TX)
663 enum nl80211_key_mode mode;
667 * struct cfg80211_chan_def - channel definition
668 * @chan: the (control) channel
669 * @width: channel width
670 * @center_freq1: center frequency of first segment
671 * @center_freq2: center frequency of second segment
672 * (only with 80+80 MHz)
673 * @edmg: define the EDMG channels configuration.
674 * If edmg is requested (i.e. the .channels member is non-zero),
675 * chan will define the primary channel and all other
676 * parameters are ignored.
677 * @freq1_offset: offset from @center_freq1, in KHz
679 struct cfg80211_chan_def {
680 struct ieee80211_channel *chan;
681 enum nl80211_chan_width width;
684 struct ieee80211_edmg edmg;
689 * cfg80211_bitrate_mask - masks for bitrate control
691 struct cfg80211_bitrate_mask {
694 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
695 u16 vht_mcs[NL80211_VHT_NSS_MAX];
696 u16 he_mcs[NL80211_HE_NSS_MAX];
697 enum nl80211_txrate_gi gi;
698 enum nl80211_he_gi he_gi;
699 enum nl80211_he_ltf he_ltf;
700 } control[NUM_NL80211_BANDS];
705 * struct cfg80211_tid_cfg - TID specific configuration
706 * @config_override: Flag to notify driver to reset TID configuration
708 * @tids: bitmap of TIDs to modify
709 * @mask: bitmap of attributes indicating which parameter changed,
710 * similar to &nl80211_tid_config_supp.
711 * @noack: noack configuration value for the TID
712 * @retry_long: retry count value
713 * @retry_short: retry count value
714 * @ampdu: Enable/Disable MPDU aggregation
715 * @rtscts: Enable/Disable RTS/CTS
716 * @amsdu: Enable/Disable MSDU aggregation
717 * @txrate_type: Tx bitrate mask type
718 * @txrate_mask: Tx bitrate to be applied for the TID
720 struct cfg80211_tid_cfg {
721 bool config_override;
724 enum nl80211_tid_config noack;
725 u8 retry_long, retry_short;
726 enum nl80211_tid_config ampdu;
727 enum nl80211_tid_config rtscts;
728 enum nl80211_tid_config amsdu;
729 enum nl80211_tx_rate_setting txrate_type;
730 struct cfg80211_bitrate_mask txrate_mask;
734 * struct cfg80211_tid_config - TID configuration
735 * @peer: Station's MAC address
736 * @n_tid_conf: Number of TID specific configurations to be applied
737 * @tid_conf: Configuration change info
739 struct cfg80211_tid_config {
742 struct cfg80211_tid_cfg tid_conf[];
746 * cfg80211_get_chandef_type - return old channel type from chandef
747 * @chandef: the channel definition
749 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
750 * chandef, which must have a bandwidth allowing this conversion.
752 static inline enum nl80211_channel_type
753 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
755 switch (chandef->width) {
756 case NL80211_CHAN_WIDTH_20_NOHT:
757 return NL80211_CHAN_NO_HT;
758 case NL80211_CHAN_WIDTH_20:
759 return NL80211_CHAN_HT20;
760 case NL80211_CHAN_WIDTH_40:
761 if (chandef->center_freq1 > chandef->chan->center_freq)
762 return NL80211_CHAN_HT40PLUS;
763 return NL80211_CHAN_HT40MINUS;
766 return NL80211_CHAN_NO_HT;
771 * cfg80211_chandef_create - create channel definition using channel type
772 * @chandef: the channel definition struct to fill
773 * @channel: the control channel
774 * @chantype: the channel type
776 * Given a channel type, create a channel definition.
778 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
779 struct ieee80211_channel *channel,
780 enum nl80211_channel_type chantype);
783 * cfg80211_chandef_identical - check if two channel definitions are identical
784 * @chandef1: first channel definition
785 * @chandef2: second channel definition
787 * Return: %true if the channels defined by the channel definitions are
788 * identical, %false otherwise.
791 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
792 const struct cfg80211_chan_def *chandef2)
794 return (chandef1->chan == chandef2->chan &&
795 chandef1->width == chandef2->width &&
796 chandef1->center_freq1 == chandef2->center_freq1 &&
797 chandef1->freq1_offset == chandef2->freq1_offset &&
798 chandef1->center_freq2 == chandef2->center_freq2);
802 * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
804 * @chandef: the channel definition
806 * Return: %true if EDMG defined, %false otherwise.
809 cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
811 return chandef->edmg.channels || chandef->edmg.bw_config;
815 * cfg80211_chandef_compatible - check if two channel definitions are compatible
816 * @chandef1: first channel definition
817 * @chandef2: second channel definition
819 * Return: %NULL if the given channel definitions are incompatible,
820 * chandef1 or chandef2 otherwise.
822 const struct cfg80211_chan_def *
823 cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
824 const struct cfg80211_chan_def *chandef2);
827 * cfg80211_chandef_valid - check if a channel definition is valid
828 * @chandef: the channel definition to check
829 * Return: %true if the channel definition is valid. %false otherwise.
831 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
834 * cfg80211_chandef_usable - check if secondary channels can be used
835 * @wiphy: the wiphy to validate against
836 * @chandef: the channel definition to check
837 * @prohibited_flags: the regulatory channel flags that must not be set
838 * Return: %true if secondary channels are usable. %false otherwise.
840 bool cfg80211_chandef_usable(struct wiphy *wiphy,
841 const struct cfg80211_chan_def *chandef,
842 u32 prohibited_flags);
845 * cfg80211_chandef_dfs_required - checks if radar detection is required
846 * @wiphy: the wiphy to validate against
847 * @chandef: the channel definition to check
848 * @iftype: the interface type as specified in &enum nl80211_iftype
850 * 1 if radar detection is required, 0 if it is not, < 0 on error
852 int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
853 const struct cfg80211_chan_def *chandef,
854 enum nl80211_iftype iftype);
857 * ieee80211_chandef_rate_flags - returns rate flags for a channel
859 * In some channel types, not all rates may be used - for example CCK
860 * rates may not be used in 5/10 MHz channels.
862 * @chandef: channel definition for the channel
864 * Returns: rate flags which apply for this channel
866 static inline enum ieee80211_rate_flags
867 ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
869 switch (chandef->width) {
870 case NL80211_CHAN_WIDTH_5:
871 return IEEE80211_RATE_SUPPORTS_5MHZ;
872 case NL80211_CHAN_WIDTH_10:
873 return IEEE80211_RATE_SUPPORTS_10MHZ;
881 * ieee80211_chandef_max_power - maximum transmission power for the chandef
883 * In some regulations, the transmit power may depend on the configured channel
884 * bandwidth which may be defined as dBm/MHz. This function returns the actual
885 * max_power for non-standard (20 MHz) channels.
887 * @chandef: channel definition for the channel
889 * Returns: maximum allowed transmission power in dBm for the chandef
892 ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
894 switch (chandef->width) {
895 case NL80211_CHAN_WIDTH_5:
896 return min(chandef->chan->max_reg_power - 6,
897 chandef->chan->max_power);
898 case NL80211_CHAN_WIDTH_10:
899 return min(chandef->chan->max_reg_power - 3,
900 chandef->chan->max_power);
904 return chandef->chan->max_power;
908 * enum survey_info_flags - survey information flags
910 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
911 * @SURVEY_INFO_IN_USE: channel is currently being used
912 * @SURVEY_INFO_TIME: active time (in ms) was filled in
913 * @SURVEY_INFO_TIME_BUSY: busy time was filled in
914 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
915 * @SURVEY_INFO_TIME_RX: receive time was filled in
916 * @SURVEY_INFO_TIME_TX: transmit time was filled in
917 * @SURVEY_INFO_TIME_SCAN: scan time was filled in
918 * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
920 * Used by the driver to indicate which info in &struct survey_info
921 * it has filled in during the get_survey().
923 enum survey_info_flags {
924 SURVEY_INFO_NOISE_DBM = BIT(0),
925 SURVEY_INFO_IN_USE = BIT(1),
926 SURVEY_INFO_TIME = BIT(2),
927 SURVEY_INFO_TIME_BUSY = BIT(3),
928 SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
929 SURVEY_INFO_TIME_RX = BIT(5),
930 SURVEY_INFO_TIME_TX = BIT(6),
931 SURVEY_INFO_TIME_SCAN = BIT(7),
932 SURVEY_INFO_TIME_BSS_RX = BIT(8),
936 * struct survey_info - channel survey response
938 * @channel: the channel this survey record reports, may be %NULL for a single
939 * record to report global statistics
940 * @filled: bitflag of flags from &enum survey_info_flags
941 * @noise: channel noise in dBm. This and all following fields are
943 * @time: amount of time in ms the radio was turn on (on the channel)
944 * @time_busy: amount of time the primary channel was sensed busy
945 * @time_ext_busy: amount of time the extension channel was sensed busy
946 * @time_rx: amount of time the radio spent receiving data
947 * @time_tx: amount of time the radio spent transmitting data
948 * @time_scan: amount of time the radio spent for scanning
949 * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
951 * Used by dump_survey() to report back per-channel survey information.
953 * This structure can later be expanded with things like
954 * channel duty cycle etc.
957 struct ieee80211_channel *channel;
969 #define CFG80211_MAX_WEP_KEYS 4
972 * struct cfg80211_crypto_settings - Crypto settings
973 * @wpa_versions: indicates which, if any, WPA versions are enabled
974 * (from enum nl80211_wpa_versions)
975 * @cipher_group: group key cipher suite (or 0 if unset)
976 * @n_ciphers_pairwise: number of AP supported unicast ciphers
977 * @ciphers_pairwise: unicast key cipher suites
978 * @n_akm_suites: number of AKM suites
979 * @akm_suites: AKM suites
980 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
981 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
982 * required to assume that the port is unauthorized until authorized by
983 * user space. Otherwise, port is marked authorized by default.
984 * @control_port_ethertype: the control port protocol that should be
985 * allowed through even on unauthorized ports
986 * @control_port_no_encrypt: TRUE to prevent encryption of control port
988 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
989 * port frames over NL80211 instead of the network interface.
990 * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
992 * @wep_keys: static WEP keys, if not NULL points to an array of
993 * CFG80211_MAX_WEP_KEYS WEP keys
994 * @wep_tx_key: key index (0..3) of the default TX static WEP key
995 * @psk: PSK (for devices supporting 4-way-handshake offload)
996 * @sae_pwd: password for SAE authentication (for devices supporting SAE
998 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
999 * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
1001 * NL80211_SAE_PWE_UNSPECIFIED
1002 * Not-specified, used to indicate userspace did not specify any
1003 * preference. The driver should follow its internal policy in
1006 * NL80211_SAE_PWE_HUNT_AND_PECK
1007 * Allow hunting-and-pecking loop only
1009 * NL80211_SAE_PWE_HASH_TO_ELEMENT
1010 * Allow hash-to-element only
1012 * NL80211_SAE_PWE_BOTH
1013 * Allow either hunting-and-pecking loop or hash-to-element
1015 struct cfg80211_crypto_settings {
1018 int n_ciphers_pairwise;
1019 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
1021 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
1023 __be16 control_port_ethertype;
1024 bool control_port_no_encrypt;
1025 bool control_port_over_nl80211;
1026 bool control_port_no_preauth;
1027 struct key_params *wep_keys;
1032 enum nl80211_sae_pwe_mechanism sae_pwe;
1036 * struct cfg80211_beacon_data - beacon data
1037 * @head: head portion of beacon (before TIM IE)
1038 * or %NULL if not changed
1039 * @tail: tail portion of beacon (after TIM IE)
1040 * or %NULL if not changed
1041 * @head_len: length of @head
1042 * @tail_len: length of @tail
1043 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
1044 * @beacon_ies_len: length of beacon_ies in octets
1045 * @proberesp_ies: extra information element(s) to add into Probe Response
1047 * @proberesp_ies_len: length of proberesp_ies in octets
1048 * @assocresp_ies: extra information element(s) to add into (Re)Association
1049 * Response frames or %NULL
1050 * @assocresp_ies_len: length of assocresp_ies in octets
1051 * @probe_resp_len: length of probe response template (@probe_resp)
1052 * @probe_resp: probe response template (AP mode only)
1053 * @ftm_responder: enable FTM responder functionality; -1 for no change
1054 * (which also implies no change in LCI/civic location data)
1055 * @lci: Measurement Report element content, starting with Measurement Token
1056 * (measurement type 8)
1057 * @civicloc: Measurement Report element content, starting with Measurement
1058 * Token (measurement type 11)
1059 * @lci_len: LCI data length
1060 * @civicloc_len: Civic location data length
1062 struct cfg80211_beacon_data {
1063 const u8 *head, *tail;
1064 const u8 *beacon_ies;
1065 const u8 *proberesp_ies;
1066 const u8 *assocresp_ies;
1067 const u8 *probe_resp;
1072 size_t head_len, tail_len;
1073 size_t beacon_ies_len;
1074 size_t proberesp_ies_len;
1075 size_t assocresp_ies_len;
1076 size_t probe_resp_len;
1078 size_t civicloc_len;
1081 struct mac_address {
1086 * struct cfg80211_acl_data - Access control list data
1088 * @acl_policy: ACL policy to be applied on the station's
1089 * entry specified by mac_addr
1090 * @n_acl_entries: Number of MAC address entries passed
1091 * @mac_addrs: List of MAC addresses of stations to be used for ACL
1093 struct cfg80211_acl_data {
1094 enum nl80211_acl_policy acl_policy;
1098 struct mac_address mac_addrs[];
1102 * struct cfg80211_fils_discovery - FILS discovery parameters from
1103 * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
1105 * @min_interval: Minimum packet interval in TUs (0 - 10000)
1106 * @max_interval: Maximum packet interval in TUs (0 - 10000)
1107 * @tmpl_len: Template length
1108 * @tmpl: Template data for FILS discovery frame including the action
1111 struct cfg80211_fils_discovery {
1119 * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
1120 * response parameters in 6GHz.
1122 * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
1123 * in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
1125 * @tmpl_len: Template length
1126 * @tmpl: Template data for probe response
1128 struct cfg80211_unsol_bcast_probe_resp {
1135 * enum cfg80211_ap_settings_flags - AP settings flags
1137 * Used by cfg80211_ap_settings
1139 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1141 enum cfg80211_ap_settings_flags {
1142 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1146 * struct cfg80211_ap_settings - AP configuration
1148 * Used to configure an AP interface.
1150 * @chandef: defines the channel to use
1151 * @beacon: beacon data
1152 * @beacon_interval: beacon interval
1153 * @dtim_period: DTIM period
1154 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
1156 * @ssid_len: length of @ssid
1157 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
1158 * @crypto: crypto settings
1159 * @privacy: the BSS uses privacy
1160 * @auth_type: Authentication type (algorithm)
1161 * @smps_mode: SMPS mode
1162 * @inactivity_timeout: time in seconds to determine station's inactivity.
1163 * @p2p_ctwindow: P2P CT Window
1164 * @p2p_opp_ps: P2P opportunistic PS
1165 * @acl: ACL configuration used by the drivers which has support for
1166 * MAC address based access control
1167 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
1169 * @beacon_rate: bitrate to be used for beacons
1170 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
1171 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1172 * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
1173 * @ht_required: stations must support HT
1174 * @vht_required: stations must support VHT
1175 * @twt_responder: Enable Target Wait Time
1176 * @he_required: stations must support HE
1177 * @sae_h2e_required: stations must support direct H2E technique in SAE
1178 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1179 * @he_obss_pd: OBSS Packet Detection settings
1180 * @he_bss_color: BSS Color settings
1181 * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1182 * @fils_discovery: FILS discovery transmission parameters
1183 * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
1185 struct cfg80211_ap_settings {
1186 struct cfg80211_chan_def chandef;
1188 struct cfg80211_beacon_data beacon;
1190 int beacon_interval, dtim_period;
1193 enum nl80211_hidden_ssid hidden_ssid;
1194 struct cfg80211_crypto_settings crypto;
1196 enum nl80211_auth_type auth_type;
1197 enum nl80211_smps_mode smps_mode;
1198 int inactivity_timeout;
1201 const struct cfg80211_acl_data *acl;
1203 struct cfg80211_bitrate_mask beacon_rate;
1205 const struct ieee80211_ht_cap *ht_cap;
1206 const struct ieee80211_vht_cap *vht_cap;
1207 const struct ieee80211_he_cap_elem *he_cap;
1208 const struct ieee80211_he_operation *he_oper;
1209 bool ht_required, vht_required, he_required, sae_h2e_required;
1212 struct ieee80211_he_obss_pd he_obss_pd;
1213 struct cfg80211_he_bss_color he_bss_color;
1214 struct cfg80211_fils_discovery fils_discovery;
1215 struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
1219 * struct cfg80211_csa_settings - channel switch settings
1221 * Used for channel switch
1223 * @chandef: defines the channel to use after the switch
1224 * @beacon_csa: beacon data while performing the switch
1225 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
1226 * @counter_offsets_presp: offsets of the counters within the probe response
1227 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
1228 * @n_counter_offsets_presp: number of csa counters in the probe response
1229 * @beacon_after: beacon data to be used on the new channel
1230 * @radar_required: whether radar detection is required on the new channel
1231 * @block_tx: whether transmissions should be blocked while changing
1232 * @count: number of beacons until switch
1234 struct cfg80211_csa_settings {
1235 struct cfg80211_chan_def chandef;
1236 struct cfg80211_beacon_data beacon_csa;
1237 const u16 *counter_offsets_beacon;
1238 const u16 *counter_offsets_presp;
1239 unsigned int n_counter_offsets_beacon;
1240 unsigned int n_counter_offsets_presp;
1241 struct cfg80211_beacon_data beacon_after;
1242 bool radar_required;
1247 #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
1250 * struct iface_combination_params - input parameters for interface combinations
1252 * Used to pass interface combination parameters
1254 * @num_different_channels: the number of different channels we want
1255 * to use for verification
1256 * @radar_detect: a bitmap where each bit corresponds to a channel
1257 * width where radar detection is needed, as in the definition of
1258 * &struct ieee80211_iface_combination.@radar_detect_widths
1259 * @iftype_num: array with the number of interfaces of each interface
1260 * type. The index is the interface type as specified in &enum
1262 * @new_beacon_int: set this to the beacon interval of a new interface
1263 * that's not operating yet, if such is to be checked as part of
1266 struct iface_combination_params {
1267 int num_different_channels;
1269 int iftype_num[NUM_NL80211_IFTYPES];
1274 * enum station_parameters_apply_mask - station parameter values to apply
1275 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
1276 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1277 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
1279 * Not all station parameters have in-band "no change" signalling,
1280 * for those that don't these flags will are used.
1282 enum station_parameters_apply_mask {
1283 STATION_PARAM_APPLY_UAPSD = BIT(0),
1284 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1285 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1286 STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1290 * struct sta_txpwr - station txpower configuration
1292 * Used to configure txpower for station.
1294 * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1295 * is not provided, the default per-interface tx power setting will be
1296 * overriding. Driver should be picking up the lowest tx power, either tx
1297 * power per-interface or per-station.
1298 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1299 * will be less than or equal to specified from userspace, whereas if TPC
1300 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1301 * NL80211_TX_POWER_FIXED is not a valid configuration option for
1306 enum nl80211_tx_power_setting type;
1310 * struct station_parameters - station parameters
1312 * Used to change and create a new station.
1314 * @vlan: vlan interface station should belong to
1315 * @supported_rates: supported rates in IEEE 802.11 format
1316 * (or NULL for no change)
1317 * @supported_rates_len: number of supported rates
1318 * @sta_flags_mask: station flags that changed
1319 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1320 * @sta_flags_set: station flags values
1321 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1322 * @listen_interval: listen interval or -1 for no change
1323 * @aid: AID or zero for no change
1324 * @vlan_id: VLAN ID for station (if nonzero)
1325 * @peer_aid: mesh peer AID or zero for no change
1326 * @plink_action: plink action to take
1327 * @plink_state: set the peer link state for a station
1328 * @ht_capa: HT capabilities of station
1329 * @vht_capa: VHT capabilities of station
1330 * @uapsd_queues: bitmap of queues configured for uapsd. same format
1331 * as the AC bitmap in the QoS info field
1332 * @max_sp: max Service Period. same format as the MAX_SP in the
1333 * QoS info field (but already shifted down)
1334 * @sta_modify_mask: bitmap indicating which parameters changed
1335 * (for those that don't have a natural "no change" value),
1336 * see &enum station_parameters_apply_mask
1337 * @local_pm: local link-specific mesh power save mode (no change when set
1339 * @capability: station capability
1340 * @ext_capab: extended capabilities of the station
1341 * @ext_capab_len: number of extended capabilities
1342 * @supported_channels: supported channels in IEEE 802.11 format
1343 * @supported_channels_len: number of supported channels
1344 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1345 * @supported_oper_classes_len: number of supported operating classes
1346 * @opmode_notif: operating mode field from Operating Mode Notification
1347 * @opmode_notif_used: information if operating mode field is used
1348 * @support_p2p_ps: information if station supports P2P PS mechanism
1349 * @he_capa: HE capabilities of station
1350 * @he_capa_len: the length of the HE capabilities
1351 * @airtime_weight: airtime scheduler weight for this station
1352 * @txpwr: transmit power for an associated station
1353 * @he_6ghz_capa: HE 6 GHz Band capabilities of station
1355 struct station_parameters {
1356 const u8 *supported_rates;
1357 struct net_device *vlan;
1358 u32 sta_flags_mask, sta_flags_set;
1359 u32 sta_modify_mask;
1360 int listen_interval;
1364 u8 supported_rates_len;
1367 const struct ieee80211_ht_cap *ht_capa;
1368 const struct ieee80211_vht_cap *vht_capa;
1371 enum nl80211_mesh_power_mode local_pm;
1373 const u8 *ext_capab;
1375 const u8 *supported_channels;
1376 u8 supported_channels_len;
1377 const u8 *supported_oper_classes;
1378 u8 supported_oper_classes_len;
1380 bool opmode_notif_used;
1382 const struct ieee80211_he_cap_elem *he_capa;
1385 struct sta_txpwr txpwr;
1386 const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1390 * struct station_del_parameters - station deletion parameters
1392 * Used to delete a station entry (or all stations).
1394 * @mac: MAC address of the station to remove or NULL to remove all stations
1395 * @subtype: Management frame subtype to use for indicating removal
1396 * (10 = Disassociation, 12 = Deauthentication)
1397 * @reason_code: Reason code for the Disassociation/Deauthentication frame
1399 struct station_del_parameters {
1406 * enum cfg80211_station_type - the type of station being modified
1407 * @CFG80211_STA_AP_CLIENT: client of an AP interface
1408 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
1409 * unassociated (update properties for this type of client is permitted)
1410 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
1411 * the AP MLME in the device
1412 * @CFG80211_STA_AP_STA: AP station on managed interface
1413 * @CFG80211_STA_IBSS: IBSS station
1414 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
1415 * while TDLS setup is in progress, it moves out of this state when
1416 * being marked authorized; use this only if TDLS with external setup is
1418 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
1419 * entry that is operating, has been marked authorized by userspace)
1420 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1421 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
1423 enum cfg80211_station_type {
1424 CFG80211_STA_AP_CLIENT,
1425 CFG80211_STA_AP_CLIENT_UNASSOC,
1426 CFG80211_STA_AP_MLME_CLIENT,
1427 CFG80211_STA_AP_STA,
1429 CFG80211_STA_TDLS_PEER_SETUP,
1430 CFG80211_STA_TDLS_PEER_ACTIVE,
1431 CFG80211_STA_MESH_PEER_KERNEL,
1432 CFG80211_STA_MESH_PEER_USER,
1436 * cfg80211_check_station_change - validate parameter changes
1437 * @wiphy: the wiphy this operates on
1438 * @params: the new parameters for a station
1439 * @statype: the type of station being modified
1441 * Utility function for the @change_station driver method. Call this function
1442 * with the appropriate station type looking up the station (and checking that
1443 * it exists). It will verify whether the station change is acceptable, and if
1444 * not will return an error code. Note that it may modify the parameters for
1445 * backward compatibility reasons, so don't use them before calling this.
1447 int cfg80211_check_station_change(struct wiphy *wiphy,
1448 struct station_parameters *params,
1449 enum cfg80211_station_type statype);
1452 * enum rate_info_flags - bitrate info flags
1454 * Used by the driver to indicate the specific rate transmission
1455 * type for 802.11n transmissions.
1457 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1458 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1459 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
1460 * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1461 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
1462 * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1463 * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
1465 enum rate_info_flags {
1466 RATE_INFO_FLAGS_MCS = BIT(0),
1467 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
1468 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
1469 RATE_INFO_FLAGS_DMG = BIT(3),
1470 RATE_INFO_FLAGS_HE_MCS = BIT(4),
1471 RATE_INFO_FLAGS_EDMG = BIT(5),
1472 RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6),
1476 * enum rate_info_bw - rate bandwidth information
1478 * Used by the driver to indicate the rate bandwidth.
1480 * @RATE_INFO_BW_5: 5 MHz bandwidth
1481 * @RATE_INFO_BW_10: 10 MHz bandwidth
1482 * @RATE_INFO_BW_20: 20 MHz bandwidth
1483 * @RATE_INFO_BW_40: 40 MHz bandwidth
1484 * @RATE_INFO_BW_80: 80 MHz bandwidth
1485 * @RATE_INFO_BW_160: 160 MHz bandwidth
1486 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1489 RATE_INFO_BW_20 = 0,
1499 * struct rate_info - bitrate information
1501 * Information about a receiving or transmitting bitrate
1503 * @flags: bitflag of flags from &enum rate_info_flags
1504 * @mcs: mcs index if struct describes an HT/VHT/HE rate
1505 * @legacy: bitrate in 100kbit/s for 802.11abg
1506 * @nss: number of streams (VHT & HE only)
1507 * @bw: bandwidth (from &enum rate_info_bw)
1508 * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1509 * @he_dcm: HE DCM value
1510 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1511 * only valid if bw is %RATE_INFO_BW_HE_RU)
1512 * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1527 * enum bss_param_flags - bitrate info flags
1529 * Used by the driver to indicate the specific rate transmission
1530 * type for 802.11n transmissions.
1532 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1533 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1534 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1536 enum bss_param_flags {
1537 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1538 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1539 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1543 * struct sta_bss_parameters - BSS parameters for the attached station
1545 * Information about the currently associated BSS
1547 * @flags: bitflag of flags from &enum bss_param_flags
1548 * @dtim_period: DTIM period for the BSS
1549 * @beacon_interval: beacon interval
1551 struct sta_bss_parameters {
1554 u16 beacon_interval;
1558 * struct cfg80211_txq_stats - TXQ statistics for this TID
1559 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1560 * indicate the relevant values in this struct are filled
1561 * @backlog_bytes: total number of bytes currently backlogged
1562 * @backlog_packets: total number of packets currently backlogged
1563 * @flows: number of new flows seen
1564 * @drops: total number of packets dropped
1565 * @ecn_marks: total number of packets marked with ECN CE
1566 * @overlimit: number of drops due to queue space overflow
1567 * @overmemory: number of drops due to memory limit overflow
1568 * @collisions: number of hash collisions
1569 * @tx_bytes: total number of bytes dequeued
1570 * @tx_packets: total number of packets dequeued
1571 * @max_flows: maximum number of flows supported
1573 struct cfg80211_txq_stats {
1576 u32 backlog_packets;
1589 * struct cfg80211_tid_stats - per-TID statistics
1590 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1591 * indicate the relevant values in this struct are filled
1592 * @rx_msdu: number of received MSDUs
1593 * @tx_msdu: number of (attempted) transmitted MSDUs
1594 * @tx_msdu_retries: number of retries (not counting the first) for
1596 * @tx_msdu_failed: number of failed transmitted MSDUs
1597 * @txq_stats: TXQ statistics
1599 struct cfg80211_tid_stats {
1603 u64 tx_msdu_retries;
1605 struct cfg80211_txq_stats txq_stats;
1608 #define IEEE80211_MAX_CHAINS 4
1611 * struct station_info - station information
1613 * Station information filled by driver for get_station() and dump_station.
1615 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1616 * indicate the relevant values in this struct for them
1617 * @connected_time: time(in secs) since a station is last connected
1618 * @inactive_time: time since last station activity (tx/rx) in milliseconds
1619 * @assoc_at: bootime (ns) of the last association
1620 * @rx_bytes: bytes (size of MPDUs) received from this station
1621 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
1622 * @llid: mesh local link id
1623 * @plid: mesh peer link id
1624 * @plink_state: mesh peer link state
1625 * @signal: The signal strength, type depends on the wiphy's signal_type.
1626 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1627 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1628 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1629 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1630 * @chain_signal: per-chain signal strength of last received packet in dBm
1631 * @chain_signal_avg: per-chain signal strength average in dBm
1632 * @txrate: current unicast bitrate from this station
1633 * @rxrate: current unicast bitrate to this station
1634 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1635 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1636 * @tx_retries: cumulative retry counts (MPDUs)
1637 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
1638 * @rx_dropped_misc: Dropped for un-specified reason.
1639 * @bss_param: current BSS parameters
1640 * @generation: generation number for nl80211 dumps.
1641 * This number should increase every time the list of stations
1642 * changes, i.e. when a station is added or removed, so that
1643 * userspace can tell whether it got a consistent snapshot.
1644 * @assoc_req_ies: IEs from (Re)Association Request.
1645 * This is used only when in AP mode with drivers that do not use
1646 * user space MLME/SME implementation. The information is provided for
1647 * the cfg80211_new_sta() calls to notify user space of the IEs.
1648 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1649 * @sta_flags: station flags mask & values
1650 * @beacon_loss_count: Number of times beacon loss event has triggered.
1651 * @t_offset: Time offset of the station relative to this host.
1652 * @local_pm: local mesh STA power save mode
1653 * @peer_pm: peer mesh STA power save mode
1654 * @nonpeer_pm: non-peer mesh STA power save mode
1655 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1656 * towards this station.
1657 * @rx_beacon: number of beacons received from this peer
1658 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1660 * @connected_to_gate: true if mesh STA has a path to mesh gate
1661 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
1662 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
1663 * @airtime_weight: current airtime scheduling weight
1664 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1665 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1666 * Note that this doesn't use the @filled bit, but is used if non-NULL.
1667 * @ack_signal: signal strength (in dBm) of the last ACK frame.
1668 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1670 * @rx_mpdu_count: number of MPDUs received from this station
1671 * @fcs_err_count: number of packets (MPDUs) received from this station with
1672 * an FCS error. This counter should be incremented only when TA of the
1673 * received packet with an FCS error matches the peer MAC address.
1674 * @airtime_link_metric: mesh airtime link metric.
1675 * @connected_to_as: true if mesh STA has a path to authentication server
1677 struct station_info {
1691 s8 chain_signal[IEEE80211_MAX_CHAINS];
1692 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1694 struct rate_info txrate;
1695 struct rate_info rxrate;
1700 u32 rx_dropped_misc;
1701 struct sta_bss_parameters bss_param;
1702 struct nl80211_sta_flag_update sta_flags;
1706 const u8 *assoc_req_ies;
1707 size_t assoc_req_ies_len;
1709 u32 beacon_loss_count;
1711 enum nl80211_mesh_power_mode local_pm;
1712 enum nl80211_mesh_power_mode peer_pm;
1713 enum nl80211_mesh_power_mode nonpeer_pm;
1715 u32 expected_throughput;
1720 u8 rx_beacon_signal_avg;
1721 u8 connected_to_gate;
1723 struct cfg80211_tid_stats *pertid;
1732 u32 airtime_link_metric;
1738 * struct cfg80211_sar_sub_specs - sub specs limit
1739 * @power: power limitation in 0.25dbm
1740 * @freq_range_index: index the power limitation applies to
1742 struct cfg80211_sar_sub_specs {
1744 u32 freq_range_index;
1748 * struct cfg80211_sar_specs - sar limit specs
1749 * @type: it's set with power in 0.25dbm or other types
1750 * @num_sub_specs: number of sar sub specs
1751 * @sub_specs: memory to hold the sar sub specs
1753 struct cfg80211_sar_specs {
1754 enum nl80211_sar_type type;
1756 struct cfg80211_sar_sub_specs sub_specs[];
1761 * struct cfg80211_sar_freq_ranges - sar frequency ranges
1762 * @start_freq: start range edge frequency
1763 * @end_freq: end range edge frequency
1765 struct cfg80211_sar_freq_ranges {
1771 * struct cfg80211_sar_capa - sar limit capability
1772 * @type: it's set via power in 0.25dbm or other types
1773 * @num_freq_ranges: number of frequency ranges
1774 * @freq_ranges: memory to hold the freq ranges.
1776 * Note: WLAN driver may append new ranges or split an existing
1777 * range to small ones and then append them.
1779 struct cfg80211_sar_capa {
1780 enum nl80211_sar_type type;
1781 u32 num_freq_ranges;
1782 const struct cfg80211_sar_freq_ranges *freq_ranges;
1785 #if IS_ENABLED(CONFIG_CFG80211)
1787 * cfg80211_get_station - retrieve information about a given station
1788 * @dev: the device where the station is supposed to be connected to
1789 * @mac_addr: the mac address of the station of interest
1790 * @sinfo: pointer to the structure to fill with the information
1792 * Returns 0 on success and sinfo is filled with the available information
1793 * otherwise returns a negative error code and the content of sinfo has to be
1794 * considered undefined.
1796 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1797 struct station_info *sinfo);
1799 static inline int cfg80211_get_station(struct net_device *dev,
1801 struct station_info *sinfo)
1808 * enum monitor_flags - monitor flags
1810 * Monitor interface configuration flags. Note that these must be the bits
1811 * according to the nl80211 flags.
1813 * @MONITOR_FLAG_CHANGED: set if the flags were changed
1814 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1815 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1816 * @MONITOR_FLAG_CONTROL: pass control frames
1817 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1818 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1819 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
1821 enum monitor_flags {
1822 MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
1823 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1824 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1825 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1826 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1827 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1828 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
1832 * enum mpath_info_flags - mesh path information flags
1834 * Used by the driver to indicate which info in &struct mpath_info it has filled
1835 * in during get_station() or dump_station().
1837 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1838 * @MPATH_INFO_SN: @sn filled
1839 * @MPATH_INFO_METRIC: @metric filled
1840 * @MPATH_INFO_EXPTIME: @exptime filled
1841 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1842 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1843 * @MPATH_INFO_FLAGS: @flags filled
1844 * @MPATH_INFO_HOP_COUNT: @hop_count filled
1845 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
1847 enum mpath_info_flags {
1848 MPATH_INFO_FRAME_QLEN = BIT(0),
1849 MPATH_INFO_SN = BIT(1),
1850 MPATH_INFO_METRIC = BIT(2),
1851 MPATH_INFO_EXPTIME = BIT(3),
1852 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1853 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1854 MPATH_INFO_FLAGS = BIT(6),
1855 MPATH_INFO_HOP_COUNT = BIT(7),
1856 MPATH_INFO_PATH_CHANGE = BIT(8),
1860 * struct mpath_info - mesh path information
1862 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1864 * @filled: bitfield of flags from &enum mpath_info_flags
1865 * @frame_qlen: number of queued frames for this destination
1866 * @sn: target sequence number
1867 * @metric: metric (cost) of this mesh path
1868 * @exptime: expiration time for the mesh path from now, in msecs
1869 * @flags: mesh path flags
1870 * @discovery_timeout: total mesh path discovery timeout, in msecs
1871 * @discovery_retries: mesh path discovery retries
1872 * @generation: generation number for nl80211 dumps.
1873 * This number should increase every time the list of mesh paths
1874 * changes, i.e. when a station is added or removed, so that
1875 * userspace can tell whether it got a consistent snapshot.
1876 * @hop_count: hops to destination
1877 * @path_change_count: total number of path changes to destination
1885 u32 discovery_timeout;
1886 u8 discovery_retries;
1889 u32 path_change_count;
1895 * struct bss_parameters - BSS parameters
1897 * Used to change BSS parameters (mainly for AP mode).
1899 * @use_cts_prot: Whether to use CTS protection
1900 * (0 = no, 1 = yes, -1 = do not change)
1901 * @use_short_preamble: Whether the use of short preambles is allowed
1902 * (0 = no, 1 = yes, -1 = do not change)
1903 * @use_short_slot_time: Whether the use of short slot time is allowed
1904 * (0 = no, 1 = yes, -1 = do not change)
1905 * @basic_rates: basic rates in IEEE 802.11 format
1906 * (or NULL for no change)
1907 * @basic_rates_len: number of basic rates
1908 * @ap_isolate: do not forward packets between connected stations
1909 * (0 = no, 1 = yes, -1 = do not change)
1910 * @ht_opmode: HT Operation mode
1911 * (u16 = opmode, -1 = do not change)
1912 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1913 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
1915 struct bss_parameters {
1917 int use_short_preamble;
1918 int use_short_slot_time;
1919 const u8 *basic_rates;
1923 s8 p2p_ctwindow, p2p_opp_ps;
1927 * struct mesh_config - 802.11s mesh configuration
1929 * These parameters can be changed while the mesh is active.
1931 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1932 * by the Mesh Peering Open message
1933 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1934 * used by the Mesh Peering Open message
1935 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1936 * the mesh peering management to close a mesh peering
1937 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1939 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1940 * be sent to establish a new peer link instance in a mesh
1941 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1942 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1944 * @auto_open_plinks: whether we should automatically open peer links when we
1945 * detect compatible mesh peers
1946 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1947 * synchronize to for 11s default synchronization method
1948 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1949 * that an originator mesh STA can send to a particular path target
1950 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1951 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1952 * a path discovery in milliseconds
1953 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1954 * receiving a PREQ shall consider the forwarding information from the
1955 * root to be valid. (TU = time unit)
1956 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1957 * which a mesh STA can send only one action frame containing a PREQ
1959 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1960 * which a mesh STA can send only one Action frame containing a PERR
1962 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1963 * it takes for an HWMP information element to propagate across the mesh
1964 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1965 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1966 * announcements are transmitted
1967 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1968 * station has access to a broader network beyond the MBSS. (This is
1969 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1970 * only means that the station will announce others it's a mesh gate, but
1971 * not necessarily using the gate announcement protocol. Still keeping the
1972 * same nomenclature to be in sync with the spec)
1973 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1974 * entity (default is TRUE - forwarding entity)
1975 * @rssi_threshold: the threshold for average signal strength of candidate
1976 * station to establish a peer link
1977 * @ht_opmode: mesh HT protection mode
1979 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1980 * receiving a proactive PREQ shall consider the forwarding information to
1981 * the root mesh STA to be valid.
1983 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1984 * PREQs are transmitted.
1985 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1986 * during which a mesh STA can send only one Action frame containing
1987 * a PREQ element for root path confirmation.
1988 * @power_mode: The default mesh power save mode which will be the initial
1989 * setting for new peer links.
1990 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1991 * after transmitting its beacon.
1992 * @plink_timeout: If no tx activity is seen from a STA we've established
1993 * peering with for longer than this time (in seconds), then remove it
1994 * from the STA's list of peers. Default is 30 minutes.
1995 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
1996 * connected to a mesh gate in mesh formation info. If false, the
1997 * value in mesh formation is determined by the presence of root paths
1998 * in the mesh path table
1999 * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
2000 * for HWMP) if the destination is a direct neighbor. Note that this might
2001 * not be the optimal decision as a multi-hop route might be better. So
2002 * if using this setting you will likely also want to disable
2003 * dot11MeshForwarding and use another mesh routing protocol on top.
2005 struct mesh_config {
2006 u16 dot11MeshRetryTimeout;
2007 u16 dot11MeshConfirmTimeout;
2008 u16 dot11MeshHoldingTimeout;
2009 u16 dot11MeshMaxPeerLinks;
2010 u8 dot11MeshMaxRetries;
2013 bool auto_open_plinks;
2014 u32 dot11MeshNbrOffsetMaxNeighbor;
2015 u8 dot11MeshHWMPmaxPREQretries;
2016 u32 path_refresh_time;
2017 u16 min_discovery_timeout;
2018 u32 dot11MeshHWMPactivePathTimeout;
2019 u16 dot11MeshHWMPpreqMinInterval;
2020 u16 dot11MeshHWMPperrMinInterval;
2021 u16 dot11MeshHWMPnetDiameterTraversalTime;
2022 u8 dot11MeshHWMPRootMode;
2023 bool dot11MeshConnectedToMeshGate;
2024 bool dot11MeshConnectedToAuthServer;
2025 u16 dot11MeshHWMPRannInterval;
2026 bool dot11MeshGateAnnouncementProtocol;
2027 bool dot11MeshForwarding;
2030 u32 dot11MeshHWMPactivePathToRootTimeout;
2031 u16 dot11MeshHWMProotInterval;
2032 u16 dot11MeshHWMPconfirmationInterval;
2033 enum nl80211_mesh_power_mode power_mode;
2034 u16 dot11MeshAwakeWindowDuration;
2036 bool dot11MeshNolearn;
2040 * struct mesh_setup - 802.11s mesh setup configuration
2041 * @chandef: defines the channel to use
2042 * @mesh_id: the mesh ID
2043 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
2044 * @sync_method: which synchronization method to use
2045 * @path_sel_proto: which path selection protocol to use
2046 * @path_metric: which metric to use
2047 * @auth_id: which authentication method this mesh is using
2048 * @ie: vendor information elements (optional)
2049 * @ie_len: length of vendor information elements
2050 * @is_authenticated: this mesh requires authentication
2051 * @is_secure: this mesh uses security
2052 * @user_mpm: userspace handles all MPM functions
2053 * @dtim_period: DTIM period to use
2054 * @beacon_interval: beacon interval to use
2055 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
2056 * @basic_rates: basic rates to use when creating the mesh
2057 * @beacon_rate: bitrate to be used for beacons
2058 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2059 * changes the channel when a radar is detected. This is required
2060 * to operate on DFS channels.
2061 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2062 * port frames over NL80211 instead of the network interface.
2064 * These parameters are fixed when the mesh is created.
2067 struct cfg80211_chan_def chandef;
2076 bool is_authenticated;
2080 u16 beacon_interval;
2081 int mcast_rate[NUM_NL80211_BANDS];
2083 struct cfg80211_bitrate_mask beacon_rate;
2084 bool userspace_handles_dfs;
2085 bool control_port_over_nl80211;
2089 * struct ocb_setup - 802.11p OCB mode setup configuration
2090 * @chandef: defines the channel to use
2092 * These parameters are fixed when connecting to the network
2095 struct cfg80211_chan_def chandef;
2099 * struct ieee80211_txq_params - TX queue parameters
2100 * @ac: AC identifier
2101 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
2102 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
2104 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
2106 * @aifs: Arbitration interframe space [0..255]
2108 struct ieee80211_txq_params {
2117 * DOC: Scanning and BSS list handling
2119 * The scanning process itself is fairly simple, but cfg80211 offers quite
2120 * a bit of helper functionality. To start a scan, the scan operation will
2121 * be invoked with a scan definition. This scan definition contains the
2122 * channels to scan, and the SSIDs to send probe requests for (including the
2123 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
2124 * probe. Additionally, a scan request may contain extra information elements
2125 * that should be added to the probe request. The IEs are guaranteed to be
2126 * well-formed, and will not exceed the maximum length the driver advertised
2127 * in the wiphy structure.
2129 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
2130 * it is responsible for maintaining the BSS list; the driver should not
2131 * maintain a list itself. For this notification, various functions exist.
2133 * Since drivers do not maintain a BSS list, there are also a number of
2134 * functions to search for a BSS and obtain information about it from the
2135 * BSS structure cfg80211 maintains. The BSS list is also made available
2140 * struct cfg80211_ssid - SSID description
2142 * @ssid_len: length of the ssid
2144 struct cfg80211_ssid {
2145 u8 ssid[IEEE80211_MAX_SSID_LEN];
2150 * struct cfg80211_scan_info - information about completed scan
2151 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
2152 * wireless device that requested the scan is connected to. If this
2153 * information is not available, this field is left zero.
2154 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
2155 * @aborted: set to true if the scan was aborted for any reason,
2156 * userspace will be notified of that
2158 struct cfg80211_scan_info {
2160 u8 tsf_bssid[ETH_ALEN] __aligned(2);
2165 * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
2167 * @short_bssid: short ssid to scan for
2168 * @bssid: bssid to scan for
2169 * @channel_idx: idx of the channel in the channel array in the scan request
2170 * which the above info relvant to
2171 * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
2172 * @short_ssid_valid: short_ssid is valid and can be used
2173 * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
2174 * 20 TUs before starting to send probe requests.
2176 struct cfg80211_scan_6ghz_params {
2180 bool unsolicited_probe;
2181 bool short_ssid_valid;
2186 * struct cfg80211_scan_request - scan request description
2188 * @ssids: SSIDs to scan for (active scan only)
2189 * @n_ssids: number of SSIDs
2190 * @channels: channels to scan on.
2191 * @n_channels: total number of channels to scan
2192 * @scan_width: channel width for scanning
2193 * @ie: optional information element(s) to add into Probe Request or %NULL
2194 * @ie_len: length of ie in octets
2195 * @duration: how long to listen on each channel, in TUs. If
2196 * %duration_mandatory is not set, this is the maximum dwell time and
2197 * the actual dwell time may be shorter.
2198 * @duration_mandatory: if set, the scan duration must be as specified by the
2200 * @flags: bit field of flags controlling operation
2201 * @rates: bitmap of rates to advertise for each band
2202 * @wiphy: the wiphy this was for
2203 * @scan_start: time (in jiffies) when the scan started
2204 * @wdev: the wireless device to scan for
2205 * @info: (internal) information about completed scan
2206 * @notified: (internal) scan request was notified as done or aborted
2207 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2208 * @mac_addr: MAC address used with randomisation
2209 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2210 * are 0 in the mask should be randomised, bits that are 1 should
2211 * be taken from the @mac_addr
2212 * @scan_6ghz: relevant for split scan request only,
2213 * true if this is the second scan request
2214 * @n_6ghz_params: number of 6 GHz params
2215 * @scan_6ghz_params: 6 GHz params
2216 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
2218 struct cfg80211_scan_request {
2219 struct cfg80211_ssid *ssids;
2222 enum nl80211_bss_scan_width scan_width;
2226 bool duration_mandatory;
2229 u32 rates[NUM_NL80211_BANDS];
2231 struct wireless_dev *wdev;
2233 u8 mac_addr[ETH_ALEN] __aligned(2);
2234 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2235 u8 bssid[ETH_ALEN] __aligned(2);
2238 struct wiphy *wiphy;
2239 unsigned long scan_start;
2240 struct cfg80211_scan_info info;
2245 struct cfg80211_scan_6ghz_params *scan_6ghz_params;
2248 struct ieee80211_channel *channels[];
2251 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2255 get_random_bytes(buf, ETH_ALEN);
2256 for (i = 0; i < ETH_ALEN; i++) {
2258 buf[i] |= addr[i] & mask[i];
2263 * struct cfg80211_match_set - sets of attributes to match
2265 * @ssid: SSID to be matched; may be zero-length in case of BSSID match
2266 * or no match (RSSI only)
2267 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
2268 * or no match (RSSI only)
2269 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
2270 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
2271 * for filtering out scan results received. Drivers advertize this support
2272 * of band specific rssi based filtering through the feature capability
2273 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
2274 * specific rssi thresholds take precedence over rssi_thold, if specified.
2275 * If not specified for any band, it will be assigned with rssi_thold of
2276 * corresponding matchset.
2278 struct cfg80211_match_set {
2279 struct cfg80211_ssid ssid;
2282 s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2286 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
2288 * @interval: interval between scheduled scan iterations. In seconds.
2289 * @iterations: number of scan iterations in this scan plan. Zero means
2291 * The last scan plan will always have this parameter set to zero,
2292 * all other scan plans will have a finite number of iterations.
2294 struct cfg80211_sched_scan_plan {
2300 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2302 * @band: band of BSS which should match for RSSI level adjustment.
2303 * @delta: value of RSSI level adjustment.
2305 struct cfg80211_bss_select_adjust {
2306 enum nl80211_band band;
2311 * struct cfg80211_sched_scan_request - scheduled scan request description
2313 * @reqid: identifies this request.
2314 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2315 * @n_ssids: number of SSIDs
2316 * @n_channels: total number of channels to scan
2317 * @scan_width: channel width for scanning
2318 * @ie: optional information element(s) to add into Probe Request or %NULL
2319 * @ie_len: length of ie in octets
2320 * @flags: bit field of flags controlling operation
2321 * @match_sets: sets of parameters to be matched for a scan result
2322 * entry to be considered valid and to be passed to the host
2323 * (others are filtered out).
2324 * If ommited, all results are passed.
2325 * @n_match_sets: number of match sets
2326 * @report_results: indicates that results were reported for this request
2327 * @wiphy: the wiphy this was for
2328 * @dev: the interface
2329 * @scan_start: start time of the scheduled scan
2330 * @channels: channels to scan
2331 * @min_rssi_thold: for drivers only supporting a single threshold, this
2332 * contains the minimum over all matchsets
2333 * @mac_addr: MAC address used with randomisation
2334 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2335 * are 0 in the mask should be randomised, bits that are 1 should
2336 * be taken from the @mac_addr
2337 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
2338 * index must be executed first.
2339 * @n_scan_plans: number of scan plans, at least 1.
2340 * @rcu_head: RCU callback used to free the struct
2341 * @owner_nlportid: netlink portid of owner (if this should is a request
2342 * owned by a particular socket)
2343 * @nl_owner_dead: netlink owner socket was closed - this request be freed
2344 * @list: for keeping list of requests.
2345 * @delay: delay in seconds to use before starting the first scan
2346 * cycle. The driver may ignore this parameter and start
2347 * immediately (or at any other time), if this feature is not
2349 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2350 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2351 * reporting in connected state to cases where a matching BSS is determined
2352 * to have better or slightly worse RSSI than the current connected BSS.
2353 * The relative RSSI threshold values are ignored in disconnected state.
2354 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2355 * to the specified band while deciding whether a better BSS is reported
2356 * using @relative_rssi. If delta is a negative number, the BSSs that
2357 * belong to the specified band will be penalized by delta dB in relative
2360 struct cfg80211_sched_scan_request {
2362 struct cfg80211_ssid *ssids;
2365 enum nl80211_bss_scan_width scan_width;
2369 struct cfg80211_match_set *match_sets;
2373 struct cfg80211_sched_scan_plan *scan_plans;
2376 u8 mac_addr[ETH_ALEN] __aligned(2);
2377 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2379 bool relative_rssi_set;
2381 struct cfg80211_bss_select_adjust rssi_adjust;
2384 struct wiphy *wiphy;
2385 struct net_device *dev;
2386 unsigned long scan_start;
2387 bool report_results;
2388 struct rcu_head rcu_head;
2391 struct list_head list;
2394 struct ieee80211_channel *channels[];
2398 * enum cfg80211_signal_type - signal type
2400 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
2401 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
2402 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
2404 enum cfg80211_signal_type {
2405 CFG80211_SIGNAL_TYPE_NONE,
2406 CFG80211_SIGNAL_TYPE_MBM,
2407 CFG80211_SIGNAL_TYPE_UNSPEC,
2411 * struct cfg80211_inform_bss - BSS inform data
2412 * @chan: channel the frame was received on
2413 * @scan_width: scan width that was used
2414 * @signal: signal strength value, according to the wiphy's
2416 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
2417 * received; should match the time when the frame was actually
2418 * received by the device (not just by the host, in case it was
2419 * buffered on the device) and be accurate to about 10ms.
2420 * If the frame isn't buffered, just passing the return value of
2421 * ktime_get_boottime_ns() is likely appropriate.
2422 * @parent_tsf: the time at the start of reception of the first octet of the
2423 * timestamp field of the frame. The time is the TSF of the BSS specified
2425 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
2426 * the BSS that requested the scan in which the beacon/probe was received.
2427 * @chains: bitmask for filled values in @chain_signal.
2428 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2430 struct cfg80211_inform_bss {
2431 struct ieee80211_channel *chan;
2432 enum nl80211_bss_scan_width scan_width;
2436 u8 parent_bssid[ETH_ALEN] __aligned(2);
2438 s8 chain_signal[IEEE80211_MAX_CHAINS];
2442 * struct cfg80211_bss_ies - BSS entry IE data
2443 * @tsf: TSF contained in the frame that carried these IEs
2444 * @rcu_head: internal use, for freeing
2445 * @len: length of the IEs
2446 * @from_beacon: these IEs are known to come from a beacon
2449 struct cfg80211_bss_ies {
2451 struct rcu_head rcu_head;
2458 * struct cfg80211_bss - BSS description
2460 * This structure describes a BSS (which may also be a mesh network)
2461 * for use in scan results and similar.
2463 * @channel: channel this BSS is on
2464 * @scan_width: width of the control channel
2465 * @bssid: BSSID of the BSS
2466 * @beacon_interval: the beacon interval as from the frame
2467 * @capability: the capability field in host byte order
2468 * @ies: the information elements (Note that there is no guarantee that these
2469 * are well-formed!); this is a pointer to either the beacon_ies or
2470 * proberesp_ies depending on whether Probe Response frame has been
2471 * received. It is always non-%NULL.
2472 * @beacon_ies: the information elements from the last Beacon frame
2473 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
2474 * own the beacon_ies, but they're just pointers to the ones from the
2475 * @hidden_beacon_bss struct)
2476 * @proberesp_ies: the information elements from the last Probe Response frame
2477 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2478 * a BSS that hides the SSID in its beacon, this points to the BSS struct
2479 * that holds the beacon data. @beacon_ies is still valid, of course, and
2480 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
2481 * @transmitted_bss: pointer to the transmitted BSS, if this is a
2482 * non-transmitted one (multi-BSSID support)
2483 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2484 * (multi-BSSID support)
2485 * @signal: signal strength value (type depends on the wiphy's signal_type)
2486 * @chains: bitmask for filled values in @chain_signal.
2487 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2488 * @bssid_index: index in the multiple BSS set
2489 * @max_bssid_indicator: max number of members in the BSS set
2490 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
2492 struct cfg80211_bss {
2493 struct ieee80211_channel *channel;
2494 enum nl80211_bss_scan_width scan_width;
2496 const struct cfg80211_bss_ies __rcu *ies;
2497 const struct cfg80211_bss_ies __rcu *beacon_ies;
2498 const struct cfg80211_bss_ies __rcu *proberesp_ies;
2500 struct cfg80211_bss *hidden_beacon_bss;
2501 struct cfg80211_bss *transmitted_bss;
2502 struct list_head nontrans_list;
2506 u16 beacon_interval;
2511 s8 chain_signal[IEEE80211_MAX_CHAINS];
2514 u8 max_bssid_indicator;
2516 u8 priv[] __aligned(sizeof(void *));
2520 * ieee80211_bss_get_elem - find element with given ID
2521 * @bss: the bss to search
2522 * @id: the element ID
2524 * Note that the return value is an RCU-protected pointer, so
2525 * rcu_read_lock() must be held when calling this function.
2526 * Return: %NULL if not found.
2528 const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
2531 * ieee80211_bss_get_ie - find IE with given ID
2532 * @bss: the bss to search
2533 * @id: the element ID
2535 * Note that the return value is an RCU-protected pointer, so
2536 * rcu_read_lock() must be held when calling this function.
2537 * Return: %NULL if not found.
2539 static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
2541 return (void *)ieee80211_bss_get_elem(bss, id);
2546 * struct cfg80211_auth_request - Authentication request data
2548 * This structure provides information needed to complete IEEE 802.11
2551 * @bss: The BSS to authenticate with, the callee must obtain a reference
2552 * to it if it needs to keep it.
2553 * @auth_type: Authentication type (algorithm)
2554 * @ie: Extra IEs to add to Authentication frame or %NULL
2555 * @ie_len: Length of ie buffer in octets
2556 * @key_len: length of WEP key for shared key authentication
2557 * @key_idx: index of WEP key for shared key authentication
2558 * @key: WEP key for shared key authentication
2559 * @auth_data: Fields and elements in Authentication frames. This contains
2560 * the authentication frame body (non-IE and IE data), excluding the
2561 * Authentication algorithm number, i.e., starting at the Authentication
2562 * transaction sequence number field.
2563 * @auth_data_len: Length of auth_data buffer in octets
2565 struct cfg80211_auth_request {
2566 struct cfg80211_bss *bss;
2569 enum nl80211_auth_type auth_type;
2571 u8 key_len, key_idx;
2572 const u8 *auth_data;
2573 size_t auth_data_len;
2577 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
2579 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
2580 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
2581 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
2582 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
2583 * authentication capability. Drivers can offload authentication to
2584 * userspace if this flag is set. Only applicable for cfg80211_connect()
2585 * request (connect callback).
2586 * @ASSOC_REQ_DISABLE_HE: Disable HE
2588 enum cfg80211_assoc_req_flags {
2589 ASSOC_REQ_DISABLE_HT = BIT(0),
2590 ASSOC_REQ_DISABLE_VHT = BIT(1),
2591 ASSOC_REQ_USE_RRM = BIT(2),
2592 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
2593 ASSOC_REQ_DISABLE_HE = BIT(4),
2597 * struct cfg80211_assoc_request - (Re)Association request data
2599 * This structure provides information needed to complete IEEE 802.11
2601 * @bss: The BSS to associate with. If the call is successful the driver is
2602 * given a reference that it must give back to cfg80211_send_rx_assoc()
2603 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2604 * association requests while already associating must be rejected.
2605 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2606 * @ie_len: Length of ie buffer in octets
2607 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2608 * @crypto: crypto settings
2609 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2610 * to indicate a request to reassociate within the ESS instead of a request
2611 * do the initial association with the ESS. When included, this is set to
2612 * the BSSID of the current association, i.e., to the value that is
2613 * included in the Current AP address field of the Reassociation Request
2615 * @flags: See &enum cfg80211_assoc_req_flags
2616 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2617 * will be used in ht_capa. Un-supported values will be ignored.
2618 * @ht_capa_mask: The bits of ht_capa which are to be used.
2619 * @vht_capa: VHT capability override
2620 * @vht_capa_mask: VHT capability mask indicating which fields to use
2621 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2622 * %NULL if FILS is not used.
2623 * @fils_kek_len: Length of fils_kek in octets
2624 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2625 * Request/Response frame or %NULL if FILS is not used. This field starts
2626 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2627 * @s1g_capa: S1G capability override
2628 * @s1g_capa_mask: S1G capability override mask
2630 struct cfg80211_assoc_request {
2631 struct cfg80211_bss *bss;
2632 const u8 *ie, *prev_bssid;
2634 struct cfg80211_crypto_settings crypto;
2637 struct ieee80211_ht_cap ht_capa;
2638 struct ieee80211_ht_cap ht_capa_mask;
2639 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2641 size_t fils_kek_len;
2642 const u8 *fils_nonces;
2643 struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
2647 * struct cfg80211_deauth_request - Deauthentication request data
2649 * This structure provides information needed to complete IEEE 802.11
2652 * @bssid: the BSSID of the BSS to deauthenticate from
2653 * @ie: Extra IEs to add to Deauthentication frame or %NULL
2654 * @ie_len: Length of ie buffer in octets
2655 * @reason_code: The reason code for the deauthentication
2656 * @local_state_change: if set, change local state only and
2657 * do not set a deauth frame
2659 struct cfg80211_deauth_request {
2664 bool local_state_change;
2668 * struct cfg80211_disassoc_request - Disassociation request data
2670 * This structure provides information needed to complete IEEE 802.11
2673 * @bss: the BSS to disassociate from
2674 * @ie: Extra IEs to add to Disassociation frame or %NULL
2675 * @ie_len: Length of ie buffer in octets
2676 * @reason_code: The reason code for the disassociation
2677 * @local_state_change: This is a request for a local state only, i.e., no
2678 * Disassociation frame is to be transmitted.
2680 struct cfg80211_disassoc_request {
2681 struct cfg80211_bss *bss;
2685 bool local_state_change;
2689 * struct cfg80211_ibss_params - IBSS parameters
2691 * This structure defines the IBSS parameters for the join_ibss()
2694 * @ssid: The SSID, will always be non-null.
2695 * @ssid_len: The length of the SSID, will always be non-zero.
2696 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2697 * search for IBSSs with a different BSSID.
2698 * @chandef: defines the channel to use if no other IBSS to join can be found
2699 * @channel_fixed: The channel should be fixed -- do not search for
2700 * IBSSs to join on other channels.
2701 * @ie: information element(s) to include in the beacon
2702 * @ie_len: length of that
2703 * @beacon_interval: beacon interval to use
2704 * @privacy: this is a protected network, keys will be configured
2706 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2707 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2708 * required to assume that the port is unauthorized until authorized by
2709 * user space. Otherwise, port is marked authorized by default.
2710 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2711 * port frames over NL80211 instead of the network interface.
2712 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2713 * changes the channel when a radar is detected. This is required
2714 * to operate on DFS channels.
2715 * @basic_rates: bitmap of basic rates to use when creating the IBSS
2716 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2717 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2718 * will be used in ht_capa. Un-supported values will be ignored.
2719 * @ht_capa_mask: The bits of ht_capa which are to be used.
2720 * @wep_keys: static WEP keys, if not NULL points to an array of
2721 * CFG80211_MAX_WEP_KEYS WEP keys
2722 * @wep_tx_key: key index (0..3) of the default TX static WEP key
2724 struct cfg80211_ibss_params {
2727 struct cfg80211_chan_def chandef;
2729 u8 ssid_len, ie_len;
2730 u16 beacon_interval;
2735 bool control_port_over_nl80211;
2736 bool userspace_handles_dfs;
2737 int mcast_rate[NUM_NL80211_BANDS];
2738 struct ieee80211_ht_cap ht_capa;
2739 struct ieee80211_ht_cap ht_capa_mask;
2740 struct key_params *wep_keys;
2745 * struct cfg80211_bss_selection - connection parameters for BSS selection.
2747 * @behaviour: requested BSS selection behaviour.
2748 * @param: parameters for requestion behaviour.
2749 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2750 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2752 struct cfg80211_bss_selection {
2753 enum nl80211_bss_select_attr behaviour;
2755 enum nl80211_band band_pref;
2756 struct cfg80211_bss_select_adjust adjust;
2761 * struct cfg80211_connect_params - Connection parameters
2763 * This structure provides information needed to complete IEEE 802.11
2764 * authentication and association.
2766 * @channel: The channel to use or %NULL if not specified (auto-select based
2768 * @channel_hint: The channel of the recommended BSS for initial connection or
2769 * %NULL if not specified
2770 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2772 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2773 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2774 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2777 * @ssid_len: Length of ssid in octets
2778 * @auth_type: Authentication type (algorithm)
2779 * @ie: IEs for association request
2780 * @ie_len: Length of assoc_ie in octets
2781 * @privacy: indicates whether privacy-enabled APs should be used
2782 * @mfp: indicate whether management frame protection is used
2783 * @crypto: crypto settings
2784 * @key_len: length of WEP key for shared key authentication
2785 * @key_idx: index of WEP key for shared key authentication
2786 * @key: WEP key for shared key authentication
2787 * @flags: See &enum cfg80211_assoc_req_flags
2788 * @bg_scan_period: Background scan period in seconds
2789 * or -1 to indicate that default value is to be used.
2790 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2791 * will be used in ht_capa. Un-supported values will be ignored.
2792 * @ht_capa_mask: The bits of ht_capa which are to be used.
2793 * @vht_capa: VHT Capability overrides
2794 * @vht_capa_mask: The bits of vht_capa which are to be used.
2795 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2797 * @bss_select: criteria to be used for BSS selection.
2798 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2799 * to indicate a request to reassociate within the ESS instead of a request
2800 * do the initial association with the ESS. When included, this is set to
2801 * the BSSID of the current association, i.e., to the value that is
2802 * included in the Current AP address field of the Reassociation Request
2804 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2805 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2807 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2808 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2809 * %NULL if not specified. This specifies the domain name of ER server and
2810 * is used to construct FILS wrapped data IE.
2811 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2812 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2813 * messages. This is also used to construct FILS wrapped data IE.
2814 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2815 * keys in FILS or %NULL if not specified.
2816 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
2817 * @want_1x: indicates user-space supports and wants to use 802.1X driver
2818 * offload of 4-way handshake.
2819 * @edmg: define the EDMG channels.
2820 * This may specify multiple channels and bonding options for the driver
2821 * to choose from, based on BSS configuration.
2823 struct cfg80211_connect_params {
2824 struct ieee80211_channel *channel;
2825 struct ieee80211_channel *channel_hint;
2827 const u8 *bssid_hint;
2830 enum nl80211_auth_type auth_type;
2834 enum nl80211_mfp mfp;
2835 struct cfg80211_crypto_settings crypto;
2837 u8 key_len, key_idx;
2840 struct ieee80211_ht_cap ht_capa;
2841 struct ieee80211_ht_cap ht_capa_mask;
2842 struct ieee80211_vht_cap vht_capa;
2843 struct ieee80211_vht_cap vht_capa_mask;
2845 struct cfg80211_bss_selection bss_select;
2846 const u8 *prev_bssid;
2847 const u8 *fils_erp_username;
2848 size_t fils_erp_username_len;
2849 const u8 *fils_erp_realm;
2850 size_t fils_erp_realm_len;
2851 u16 fils_erp_next_seq_num;
2852 const u8 *fils_erp_rrk;
2853 size_t fils_erp_rrk_len;
2855 struct ieee80211_edmg edmg;
2859 * enum cfg80211_connect_params_changed - Connection parameters being updated
2861 * This enum provides information of all connect parameters that
2862 * have to be updated as part of update_connect_params() call.
2864 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2865 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2866 * username, erp sequence number and rrk) are updated
2867 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2869 enum cfg80211_connect_params_changed {
2870 UPDATE_ASSOC_IES = BIT(0),
2871 UPDATE_FILS_ERP_INFO = BIT(1),
2872 UPDATE_AUTH_TYPE = BIT(2),
2876 * enum wiphy_params_flags - set_wiphy_params bitfield values
2877 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2878 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2879 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2880 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2881 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
2882 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
2883 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2884 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2885 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2887 enum wiphy_params_flags {
2888 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2889 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2890 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2891 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
2892 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
2893 WIPHY_PARAM_DYN_ACK = 1 << 5,
2894 WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2895 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2896 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
2899 #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
2901 /* The per TXQ device queue limit in airtime */
2902 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
2903 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
2905 /* The per interface airtime threshold to switch to lower queue limit */
2906 #define IEEE80211_AQL_THRESHOLD 24000
2909 * struct cfg80211_pmksa - PMK Security Association
2911 * This structure is passed to the set/del_pmksa() method for PMKSA
2914 * @bssid: The AP's BSSID (may be %NULL).
2915 * @pmkid: The identifier to refer a PMKSA.
2916 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2917 * derivation by a FILS STA. Otherwise, %NULL.
2918 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2919 * the hash algorithm used to generate this.
2920 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2921 * cache identifier (may be %NULL).
2922 * @ssid_len: Length of the @ssid in octets.
2923 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2924 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2926 * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
2927 * (dot11RSNAConfigPMKLifetime) or 0 if not specified.
2928 * The configured PMKSA must not be used for PMKSA caching after
2929 * expiration and any keys derived from this PMK become invalid on
2930 * expiration, i.e., the current association must be dropped if the PMK
2931 * used for it expires.
2932 * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
2933 * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
2934 * Drivers are expected to trigger a full authentication instead of using
2935 * this PMKSA for caching when reassociating to a new BSS after this
2936 * threshold to generate a new PMK before the current one expires.
2938 struct cfg80211_pmksa {
2947 u8 pmk_reauth_threshold;
2951 * struct cfg80211_pkt_pattern - packet pattern
2952 * @mask: bitmask where to match pattern and where to ignore bytes,
2953 * one bit per byte, in same format as nl80211
2954 * @pattern: bytes to match where bitmask is 1
2955 * @pattern_len: length of pattern (in bytes)
2956 * @pkt_offset: packet offset (in bytes)
2958 * Internal note: @mask and @pattern are allocated in one chunk of
2959 * memory, free @mask only!
2961 struct cfg80211_pkt_pattern {
2962 const u8 *mask, *pattern;
2968 * struct cfg80211_wowlan_tcp - TCP connection parameters
2970 * @sock: (internal) socket for source port allocation
2971 * @src: source IP address
2972 * @dst: destination IP address
2973 * @dst_mac: destination MAC address
2974 * @src_port: source port
2975 * @dst_port: destination port
2976 * @payload_len: data payload length
2977 * @payload: data payload buffer
2978 * @payload_seq: payload sequence stamping configuration
2979 * @data_interval: interval at which to send data packets
2980 * @wake_len: wakeup payload match length
2981 * @wake_data: wakeup payload match data
2982 * @wake_mask: wakeup payload match mask
2983 * @tokens_size: length of the tokens buffer
2984 * @payload_tok: payload token usage configuration
2986 struct cfg80211_wowlan_tcp {
2987 struct socket *sock;
2989 u16 src_port, dst_port;
2990 u8 dst_mac[ETH_ALEN];
2993 struct nl80211_wowlan_tcp_data_seq payload_seq;
2996 const u8 *wake_data, *wake_mask;
2998 /* must be last, variable member */
2999 struct nl80211_wowlan_tcp_data_token payload_tok;
3003 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
3005 * This structure defines the enabled WoWLAN triggers for the device.
3006 * @any: wake up on any activity -- special trigger if device continues
3007 * operating as normal during suspend
3008 * @disconnect: wake up if getting disconnected
3009 * @magic_pkt: wake up on receiving magic packet
3010 * @patterns: wake up on receiving packet matching a pattern
3011 * @n_patterns: number of patterns
3012 * @gtk_rekey_failure: wake up on GTK rekey failure
3013 * @eap_identity_req: wake up on EAP identity request packet
3014 * @four_way_handshake: wake up on 4-way handshake
3015 * @rfkill_release: wake up when rfkill is released
3016 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
3017 * NULL if not configured.
3018 * @nd_config: configuration for the scan to be used for net detect wake.
3020 struct cfg80211_wowlan {
3021 bool any, disconnect, magic_pkt, gtk_rekey_failure,
3022 eap_identity_req, four_way_handshake,
3024 struct cfg80211_pkt_pattern *patterns;
3025 struct cfg80211_wowlan_tcp *tcp;
3027 struct cfg80211_sched_scan_request *nd_config;
3031 * struct cfg80211_coalesce_rules - Coalesce rule parameters
3033 * This structure defines coalesce rule for the device.
3034 * @delay: maximum coalescing delay in msecs.
3035 * @condition: condition for packet coalescence.
3036 * see &enum nl80211_coalesce_condition.
3037 * @patterns: array of packet patterns
3038 * @n_patterns: number of patterns
3040 struct cfg80211_coalesce_rules {
3042 enum nl80211_coalesce_condition condition;
3043 struct cfg80211_pkt_pattern *patterns;
3048 * struct cfg80211_coalesce - Packet coalescing settings
3050 * This structure defines coalescing settings.
3051 * @rules: array of coalesce rules
3052 * @n_rules: number of rules
3054 struct cfg80211_coalesce {
3055 struct cfg80211_coalesce_rules *rules;
3060 * struct cfg80211_wowlan_nd_match - information about the match
3062 * @ssid: SSID of the match that triggered the wake up
3063 * @n_channels: Number of channels where the match occurred. This
3064 * value may be zero if the driver can't report the channels.
3065 * @channels: center frequencies of the channels where a match
3068 struct cfg80211_wowlan_nd_match {
3069 struct cfg80211_ssid ssid;
3075 * struct cfg80211_wowlan_nd_info - net detect wake up information
3077 * @n_matches: Number of match information instances provided in
3078 * @matches. This value may be zero if the driver can't provide
3079 * match information.
3080 * @matches: Array of pointers to matches containing information about
3081 * the matches that triggered the wake up.
3083 struct cfg80211_wowlan_nd_info {
3085 struct cfg80211_wowlan_nd_match *matches[];
3089 * struct cfg80211_wowlan_wakeup - wakeup report
3090 * @disconnect: woke up by getting disconnected
3091 * @magic_pkt: woke up by receiving magic packet
3092 * @gtk_rekey_failure: woke up by GTK rekey failure
3093 * @eap_identity_req: woke up by EAP identity request packet
3094 * @four_way_handshake: woke up by 4-way handshake
3095 * @rfkill_release: woke up by rfkill being released
3096 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
3097 * @packet_present_len: copied wakeup packet data
3098 * @packet_len: original wakeup packet length
3099 * @packet: The packet causing the wakeup, if any.
3100 * @packet_80211: For pattern match, magic packet and other data
3101 * frame triggers an 802.3 frame should be reported, for
3102 * disconnect due to deauth 802.11 frame. This indicates which
3104 * @tcp_match: TCP wakeup packet received
3105 * @tcp_connlost: TCP connection lost or failed to establish
3106 * @tcp_nomoretokens: TCP data ran out of tokens
3107 * @net_detect: if not %NULL, woke up because of net detect
3109 struct cfg80211_wowlan_wakeup {
3110 bool disconnect, magic_pkt, gtk_rekey_failure,
3111 eap_identity_req, four_way_handshake,
3112 rfkill_release, packet_80211,
3113 tcp_match, tcp_connlost, tcp_nomoretokens;
3115 u32 packet_present_len, packet_len;
3117 struct cfg80211_wowlan_nd_info *net_detect;
3121 * struct cfg80211_gtk_rekey_data - rekey data
3122 * @kek: key encryption key (@kek_len bytes)
3123 * @kck: key confirmation key (@kck_len bytes)
3124 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
3125 * @kek_len: length of kek
3126 * @kck_len length of kck
3127 * @akm: akm (oui, id)
3129 struct cfg80211_gtk_rekey_data {
3130 const u8 *kek, *kck, *replay_ctr;
3132 u8 kek_len, kck_len;
3136 * struct cfg80211_update_ft_ies_params - FT IE Information
3138 * This structure provides information needed to update the fast transition IE
3140 * @md: The Mobility Domain ID, 2 Octet value
3141 * @ie: Fast Transition IEs
3142 * @ie_len: Length of ft_ie in octets
3144 struct cfg80211_update_ft_ies_params {
3151 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
3153 * This structure provides information needed to transmit a mgmt frame
3155 * @chan: channel to use
3156 * @offchan: indicates wether off channel operation is required
3157 * @wait: duration for ROC
3158 * @buf: buffer to transmit
3159 * @len: buffer length
3160 * @no_cck: don't use cck rates for this frame
3161 * @dont_wait_for_ack: tells the low level not to wait for an ack
3162 * @n_csa_offsets: length of csa_offsets array
3163 * @csa_offsets: array of all the csa offsets in the frame
3165 struct cfg80211_mgmt_tx_params {
3166 struct ieee80211_channel *chan;
3172 bool dont_wait_for_ack;
3174 const u16 *csa_offsets;
3178 * struct cfg80211_dscp_exception - DSCP exception
3180 * @dscp: DSCP value that does not adhere to the user priority range definition
3181 * @up: user priority value to which the corresponding DSCP value belongs
3183 struct cfg80211_dscp_exception {
3189 * struct cfg80211_dscp_range - DSCP range definition for user priority
3191 * @low: lowest DSCP value of this user priority range, inclusive
3192 * @high: highest DSCP value of this user priority range, inclusive
3194 struct cfg80211_dscp_range {
3199 /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
3200 #define IEEE80211_QOS_MAP_MAX_EX 21
3201 #define IEEE80211_QOS_MAP_LEN_MIN 16
3202 #define IEEE80211_QOS_MAP_LEN_MAX \
3203 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
3206 * struct cfg80211_qos_map - QoS Map Information
3208 * This struct defines the Interworking QoS map setting for DSCP values
3210 * @num_des: number of DSCP exceptions (0..21)
3211 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
3212 * the user priority DSCP range definition
3213 * @up: DSCP range definition for a particular user priority
3215 struct cfg80211_qos_map {
3217 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3218 struct cfg80211_dscp_range up[8];
3222 * struct cfg80211_nan_conf - NAN configuration
3224 * This struct defines NAN configuration parameters
3226 * @master_pref: master preference (1 - 255)
3227 * @bands: operating bands, a bitmap of &enum nl80211_band values.
3228 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
3229 * (i.e. BIT(NL80211_BAND_2GHZ)).
3231 struct cfg80211_nan_conf {
3237 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3240 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
3241 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3243 enum cfg80211_nan_conf_changes {
3244 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
3245 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3249 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3251 * @filter: the content of the filter
3252 * @len: the length of the filter
3254 struct cfg80211_nan_func_filter {
3260 * struct cfg80211_nan_func - a NAN function
3262 * @type: &enum nl80211_nan_function_type
3263 * @service_id: the service ID of the function
3264 * @publish_type: &nl80211_nan_publish_type
3265 * @close_range: if true, the range should be limited. Threshold is
3266 * implementation specific.
3267 * @publish_bcast: if true, the solicited publish should be broadcasted
3268 * @subscribe_active: if true, the subscribe is active
3269 * @followup_id: the instance ID for follow up
3270 * @followup_reqid: the requestor instance ID for follow up
3271 * @followup_dest: MAC address of the recipient of the follow up
3272 * @ttl: time to live counter in DW.
3273 * @serv_spec_info: Service Specific Info
3274 * @serv_spec_info_len: Service Specific Info length
3275 * @srf_include: if true, SRF is inclusive
3276 * @srf_bf: Bloom Filter
3277 * @srf_bf_len: Bloom Filter length
3278 * @srf_bf_idx: Bloom Filter index
3279 * @srf_macs: SRF MAC addresses
3280 * @srf_num_macs: number of MAC addresses in SRF
3281 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3282 * @tx_filters: filters that should be transmitted in the SDF.
3283 * @num_rx_filters: length of &rx_filters.
3284 * @num_tx_filters: length of &tx_filters.
3285 * @instance_id: driver allocated id of the function.
3286 * @cookie: unique NAN function identifier.
3288 struct cfg80211_nan_func {
3289 enum nl80211_nan_function_type type;
3290 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3294 bool subscribe_active;
3297 struct mac_address followup_dest;
3299 const u8 *serv_spec_info;
3300 u8 serv_spec_info_len;
3305 struct mac_address *srf_macs;
3307 struct cfg80211_nan_func_filter *rx_filters;
3308 struct cfg80211_nan_func_filter *tx_filters;
3316 * struct cfg80211_pmk_conf - PMK configuration
3318 * @aa: authenticator address
3319 * @pmk_len: PMK length in bytes.
3320 * @pmk: the PMK material
3321 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
3322 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
3325 struct cfg80211_pmk_conf {
3329 const u8 *pmk_r0_name;
3333 * struct cfg80211_external_auth_params - Trigger External authentication.
3335 * Commonly used across the external auth request and event interfaces.
3337 * @action: action type / trigger for external authentication. Only significant
3338 * for the authentication request event interface (driver to user space).
3339 * @bssid: BSSID of the peer with which the authentication has
3340 * to happen. Used by both the authentication request event and
3341 * authentication response command interface.
3342 * @ssid: SSID of the AP. Used by both the authentication request event and
3343 * authentication response command interface.
3344 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
3345 * authentication request event interface.
3346 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
3347 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
3348 * the real status code for failures. Used only for the authentication
3349 * response command interface (user space to driver).
3350 * @pmkid: The identifier to refer a PMKSA.
3352 struct cfg80211_external_auth_params {
3353 enum nl80211_external_auth_action action;
3354 u8 bssid[ETH_ALEN] __aligned(2);
3355 struct cfg80211_ssid ssid;
3356 unsigned int key_mgmt_suite;
3362 * struct cfg80211_ftm_responder_stats - FTM responder statistics
3364 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
3365 * indicate the relevant values in this struct for them
3366 * @success_num: number of FTM sessions in which all frames were successfully
3368 * @partial_num: number of FTM sessions in which part of frames were
3369 * successfully answered
3370 * @failed_num: number of failed FTM sessions
3371 * @asap_num: number of ASAP FTM sessions
3372 * @non_asap_num: number of non-ASAP FTM sessions
3373 * @total_duration_ms: total sessions durations - gives an indication
3374 * of how much time the responder was busy
3375 * @unknown_triggers_num: number of unknown FTM triggers - triggers from
3376 * initiators that didn't finish successfully the negotiation phase with
3378 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
3379 * for a new scheduling although it already has scheduled FTM slot
3380 * @out_of_window_triggers_num: total FTM triggers out of scheduled window
3382 struct cfg80211_ftm_responder_stats {
3389 u64 total_duration_ms;
3390 u32 unknown_triggers_num;
3391 u32 reschedule_requests_num;
3392 u32 out_of_window_triggers_num;
3396 * struct cfg80211_pmsr_ftm_result - FTM result
3397 * @failure_reason: if this measurement failed (PMSR status is
3398 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
3399 * reason than just "failure"
3400 * @burst_index: if reporting partial results, this is the index
3401 * in [0 .. num_bursts-1] of the burst that's being reported
3402 * @num_ftmr_attempts: number of FTM request frames transmitted
3403 * @num_ftmr_successes: number of FTM request frames acked
3404 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
3405 * fill this to indicate in how many seconds a retry is deemed possible
3407 * @num_bursts_exp: actual number of bursts exponent negotiated
3408 * @burst_duration: actual burst duration negotiated
3409 * @ftms_per_burst: actual FTMs per burst negotiated
3410 * @lci_len: length of LCI information (if present)
3411 * @civicloc_len: length of civic location information (if present)
3412 * @lci: LCI data (may be %NULL)
3413 * @civicloc: civic location data (may be %NULL)
3414 * @rssi_avg: average RSSI over FTM action frames reported
3415 * @rssi_spread: spread of the RSSI over FTM action frames reported
3416 * @tx_rate: bitrate for transmitted FTM action frame response
3417 * @rx_rate: bitrate of received FTM action frame
3418 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
3419 * @rtt_variance: variance of RTTs measured (note that standard deviation is
3420 * the square root of the variance)
3421 * @rtt_spread: spread of the RTTs measured
3422 * @dist_avg: average of distances (mm) measured
3423 * (must have either this or @rtt_avg)
3424 * @dist_variance: variance of distances measured (see also @rtt_variance)
3425 * @dist_spread: spread of distances measured (see also @rtt_spread)
3426 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
3427 * @num_ftmr_successes_valid: @num_ftmr_successes is valid
3428 * @rssi_avg_valid: @rssi_avg is valid
3429 * @rssi_spread_valid: @rssi_spread is valid
3430 * @tx_rate_valid: @tx_rate is valid
3431 * @rx_rate_valid: @rx_rate is valid
3432 * @rtt_avg_valid: @rtt_avg is valid
3433 * @rtt_variance_valid: @rtt_variance is valid
3434 * @rtt_spread_valid: @rtt_spread is valid
3435 * @dist_avg_valid: @dist_avg is valid
3436 * @dist_variance_valid: @dist_variance is valid
3437 * @dist_spread_valid: @dist_spread is valid
3439 struct cfg80211_pmsr_ftm_result {
3442 unsigned int lci_len;
3443 unsigned int civicloc_len;
3444 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
3445 u32 num_ftmr_attempts, num_ftmr_successes;
3453 struct rate_info tx_rate, rx_rate;
3461 u16 num_ftmr_attempts_valid:1,
3462 num_ftmr_successes_valid:1,
3464 rssi_spread_valid:1,
3468 rtt_variance_valid:1,
3471 dist_variance_valid:1,
3472 dist_spread_valid:1;
3476 * struct cfg80211_pmsr_result - peer measurement result
3477 * @addr: address of the peer
3478 * @host_time: host time (use ktime_get_boottime() adjust to the time when the
3479 * measurement was made)
3480 * @ap_tsf: AP's TSF at measurement time
3481 * @status: status of the measurement
3482 * @final: if reporting partial results, mark this as the last one; if not
3483 * reporting partial results always set this flag
3484 * @ap_tsf_valid: indicates the @ap_tsf value is valid
3485 * @type: type of the measurement reported, note that we only support reporting
3486 * one type at a time, but you can report multiple results separately and
3487 * they're all aggregated for userspace.
3489 struct cfg80211_pmsr_result {
3490 u64 host_time, ap_tsf;
3491 enum nl80211_peer_measurement_status status;
3498 enum nl80211_peer_measurement_type type;
3501 struct cfg80211_pmsr_ftm_result ftm;
3506 * struct cfg80211_pmsr_ftm_request_peer - FTM request data
3507 * @requested: indicates FTM is requested
3508 * @preamble: frame preamble to use
3509 * @burst_period: burst period to use
3510 * @asap: indicates to use ASAP mode
3511 * @num_bursts_exp: number of bursts exponent
3512 * @burst_duration: burst duration
3513 * @ftms_per_burst: number of FTMs per burst
3514 * @ftmr_retries: number of retries for FTM request
3515 * @request_lci: request LCI information
3516 * @request_civicloc: request civic location information
3517 * @trigger_based: use trigger based ranging for the measurement
3518 * If neither @trigger_based nor @non_trigger_based is set,
3519 * EDCA based ranging will be used.
3520 * @non_trigger_based: use non trigger based ranging for the measurement
3521 * If neither @trigger_based nor @non_trigger_based is set,
3522 * EDCA based ranging will be used.
3524 * See also nl80211 for the respective attribute documentation.
3526 struct cfg80211_pmsr_ftm_request_peer {
3527 enum nl80211_preamble preamble;
3534 non_trigger_based:1;
3542 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
3543 * @addr: MAC address
3544 * @chandef: channel to use
3545 * @report_ap_tsf: report the associated AP's TSF
3546 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
3548 struct cfg80211_pmsr_request_peer {
3550 struct cfg80211_chan_def chandef;
3552 struct cfg80211_pmsr_ftm_request_peer ftm;
3556 * struct cfg80211_pmsr_request - peer measurement request
3557 * @cookie: cookie, set by cfg80211
3558 * @nl_portid: netlink portid - used by cfg80211
3559 * @drv_data: driver data for this request, if required for aborting,
3560 * not otherwise freed or anything by cfg80211
3561 * @mac_addr: MAC address used for (randomised) request
3562 * @mac_addr_mask: MAC address mask used for randomisation, bits that
3563 * are 0 in the mask should be randomised, bits that are 1 should
3564 * be taken from the @mac_addr
3565 * @list: used by cfg80211 to hold on to the request
3566 * @timeout: timeout (in milliseconds) for the whole operation, if
3567 * zero it means there's no timeout
3568 * @n_peers: number of peers to do measurements with
3569 * @peers: per-peer measurement request data
3571 struct cfg80211_pmsr_request {
3579 u8 mac_addr[ETH_ALEN] __aligned(2);
3580 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3582 struct list_head list;
3584 struct cfg80211_pmsr_request_peer peers[];
3588 * struct cfg80211_update_owe_info - OWE Information
3590 * This structure provides information needed for the drivers to offload OWE
3591 * (Opportunistic Wireless Encryption) processing to the user space.
3593 * Commonly used across update_owe_info request and event interfaces.
3595 * @peer: MAC address of the peer device for which the OWE processing
3597 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3598 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3599 * cannot give you the real status code for failures. Used only for
3600 * OWE update request command interface (user space to driver).
3601 * @ie: IEs obtained from the peer or constructed by the user space. These are
3602 * the IEs of the remote peer in the event from the host driver and
3603 * the constructed IEs by the user space in the request interface.
3604 * @ie_len: Length of IEs in octets.
3606 struct cfg80211_update_owe_info {
3607 u8 peer[ETH_ALEN] __aligned(2);
3614 * struct mgmt_frame_regs - management frame registrations data
3615 * @global_stypes: bitmap of management frame subtypes registered
3616 * for the entire device
3617 * @interface_stypes: bitmap of management frame subtypes registered
3618 * for the given interface
3619 * @global_mcast_rx: mcast RX is needed globally for these subtypes
3620 * @interface_mcast_stypes: mcast RX is needed on this interface
3621 * for these subtypes
3623 struct mgmt_frame_regs {
3624 u32 global_stypes, interface_stypes;
3625 u32 global_mcast_stypes, interface_mcast_stypes;
3629 * struct cfg80211_ops - backend description for wireless configuration
3631 * This struct is registered by fullmac card drivers and/or wireless stacks
3632 * in order to handle configuration requests on their interfaces.
3634 * All callbacks except where otherwise noted should return 0
3635 * on success or a negative error code.
3637 * All operations are invoked with the wiphy mutex held. The RTNL may be
3638 * held in addition (due to wireless extensions) but this cannot be relied
3639 * upon except in cases where documented below. Note that due to ordering,
3640 * the RTNL also cannot be acquired in any handlers.
3642 * @suspend: wiphy device needs to be suspended. The variable @wow will
3643 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
3644 * configured for the device.
3645 * @resume: wiphy device needs to be resumed
3646 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
3647 * to call device_set_wakeup_enable() to enable/disable wakeup from
3650 * @add_virtual_intf: create a new virtual interface with the given name,
3651 * must set the struct wireless_dev's iftype. Beware: You must create
3652 * the new netdev in the wiphy's network namespace! Returns the struct
3653 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
3654 * also set the address member in the wdev.
3655 * This additionally holds the RTNL to be able to do netdev changes.
3657 * @del_virtual_intf: remove the virtual interface
3658 * This additionally holds the RTNL to be able to do netdev changes.
3660 * @change_virtual_intf: change type/configuration of virtual interface,
3661 * keep the struct wireless_dev's iftype updated.
3662 * This additionally holds the RTNL to be able to do netdev changes.
3664 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
3665 * when adding a group key.
3667 * @get_key: get information about the key with the given parameters.
3668 * @mac_addr will be %NULL when requesting information for a group
3669 * key. All pointers given to the @callback function need not be valid
3670 * after it returns. This function should return an error if it is
3671 * not possible to retrieve the key, -ENOENT if it doesn't exist.
3673 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3674 * and @key_index, return -ENOENT if the key doesn't exist.
3676 * @set_default_key: set the default key on an interface
3678 * @set_default_mgmt_key: set the default management frame key on an interface
3680 * @set_default_beacon_key: set the default Beacon frame key on an interface
3682 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3684 * @start_ap: Start acting in AP mode defined by the parameters.
3685 * @change_beacon: Change the beacon parameters for an access point mode
3686 * interface. This should reject the call when AP mode wasn't started.
3687 * @stop_ap: Stop being an AP, including stopping beaconing.
3689 * @add_station: Add a new station.
3690 * @del_station: Remove a station
3691 * @change_station: Modify a given station. Note that flags changes are not much
3692 * validated in cfg80211, in particular the auth/assoc/authorized flags
3693 * might come to the driver in invalid combinations -- make sure to check
3694 * them, also against the existing state! Drivers must call
3695 * cfg80211_check_station_change() to validate the information.
3696 * @get_station: get station information for the station identified by @mac
3697 * @dump_station: dump station callback -- resume dump at index @idx
3699 * @add_mpath: add a fixed mesh path
3700 * @del_mpath: delete a given mesh path
3701 * @change_mpath: change a given mesh path
3702 * @get_mpath: get a mesh path for the given parameters
3703 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
3704 * @get_mpp: get a mesh proxy path for the given parameters
3705 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3706 * @join_mesh: join the mesh network with the specified parameters
3707 * (invoked with the wireless_dev mutex held)
3708 * @leave_mesh: leave the current mesh network
3709 * (invoked with the wireless_dev mutex held)
3711 * @get_mesh_config: Get the current mesh configuration
3713 * @update_mesh_config: Update mesh parameters on a running mesh.
3714 * The mask is a bitfield which tells us which parameters to
3715 * set, and which to leave alone.
3717 * @change_bss: Modify parameters for a given BSS.
3719 * @set_txq_params: Set TX queue parameters
3721 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3722 * as it doesn't implement join_mesh and needs to set the channel to
3723 * join the mesh instead.
3725 * @set_monitor_channel: Set the monitor mode channel for the device. If other
3726 * interfaces are active this callback should reject the configuration.
3727 * If no interfaces are active or the device is down, the channel should
3728 * be stored for when a monitor interface becomes active.
3730 * @scan: Request to do a scan. If returning zero, the scan request is given
3731 * the driver, and will be valid until passed to cfg80211_scan_done().
3732 * For scan results, call cfg80211_inform_bss(); you can call this outside
3733 * the scan/scan_done bracket too.
3734 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
3735 * indicate the status of the scan through cfg80211_scan_done().
3737 * @auth: Request to authenticate with the specified peer
3738 * (invoked with the wireless_dev mutex held)
3739 * @assoc: Request to (re)associate with the specified peer
3740 * (invoked with the wireless_dev mutex held)
3741 * @deauth: Request to deauthenticate from the specified peer
3742 * (invoked with the wireless_dev mutex held)
3743 * @disassoc: Request to disassociate from the specified peer
3744 * (invoked with the wireless_dev mutex held)
3746 * @connect: Connect to the ESS with the specified parameters. When connected,
3747 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3748 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3749 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3750 * from the AP or cfg80211_connect_timeout() if no frame with status code
3752 * The driver is allowed to roam to other BSSes within the ESS when the
3753 * other BSS matches the connect parameters. When such roaming is initiated
3754 * by the driver, the driver is expected to verify that the target matches
3755 * the configured security parameters and to use Reassociation Request
3756 * frame instead of Association Request frame.
3757 * The connect function can also be used to request the driver to perform a
3758 * specific roam when connected to an ESS. In that case, the prev_bssid
3759 * parameter is set to the BSSID of the currently associated BSS as an
3760 * indication of requesting reassociation.
3761 * In both the driver-initiated and new connect() call initiated roaming
3762 * cases, the result of roaming is indicated with a call to
3763 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3764 * @update_connect_params: Update the connect parameters while connected to a
3765 * BSS. The updated parameters can be used by driver/firmware for
3766 * subsequent BSS selection (roaming) decisions and to form the
3767 * Authentication/(Re)Association Request frames. This call does not
3768 * request an immediate disassociation or reassociation with the current
3769 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
3770 * changed are defined in &enum cfg80211_connect_params_changed.
3771 * (invoked with the wireless_dev mutex held)
3772 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
3773 * connection is in progress. Once done, call cfg80211_disconnected() in
3774 * case connection was already established (invoked with the
3775 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3777 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
3778 * cfg80211_ibss_joined(), also call that function when changing BSSID due
3780 * (invoked with the wireless_dev mutex held)
3781 * @leave_ibss: Leave the IBSS.
3782 * (invoked with the wireless_dev mutex held)
3784 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3787 * @set_wiphy_params: Notify that wiphy parameters have changed;
3788 * @changed bitfield (see &enum wiphy_params_flags) describes which values
3789 * have changed. The actual parameter values are available in
3790 * struct wiphy. If returning an error, no value should be changed.
3792 * @set_tx_power: set the transmit power according to the parameters,
3793 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3794 * wdev may be %NULL if power was set for the wiphy, and will
3795 * always be %NULL unless the driver supports per-vif TX power
3796 * (as advertised by the nl80211 feature flag.)
3797 * @get_tx_power: store the current TX power into the dbm variable;
3798 * return 0 if successful
3800 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
3801 * functions to adjust rfkill hw state
3803 * @dump_survey: get site survey information.
3805 * @remain_on_channel: Request the driver to remain awake on the specified
3806 * channel for the specified duration to complete an off-channel
3807 * operation (e.g., public action frame exchange). When the driver is
3808 * ready on the requested channel, it must indicate this with an event
3809 * notification by calling cfg80211_ready_on_channel().
3810 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
3811 * This allows the operation to be terminated prior to timeout based on
3812 * the duration value.
3813 * @mgmt_tx: Transmit a management frame.
3814 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3815 * frame on another channel
3817 * @testmode_cmd: run a test mode command; @wdev may be %NULL
3818 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
3819 * used by the function, but 0 and 1 must not be touched. Additionally,
3820 * return error codes other than -ENOBUFS and -ENOENT will terminate the
3821 * dump and return to userspace with an error, so be careful. If any data
3822 * was passed in from userspace then the data/len arguments will be present
3823 * and point to the data contained in %NL80211_ATTR_TESTDATA.
3825 * @set_bitrate_mask: set the bitrate mask configuration
3827 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
3828 * devices running firmwares capable of generating the (re) association
3829 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
3830 * @del_pmksa: Delete a cached PMKID.
3831 * @flush_pmksa: Flush all cached PMKIDs.
3832 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
3833 * allows the driver to adjust the dynamic ps timeout value.
3834 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3835 * After configuration, the driver should (soon) send an event indicating
3836 * the current level is above/below the configured threshold; this may
3837 * need some care when the configuration is changed (without first being
3839 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
3840 * connection quality monitor. An event is to be sent only when the
3841 * signal level is found to be outside the two values. The driver should
3842 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
3843 * If it is provided then there's no point providing @set_cqm_rssi_config.
3844 * @set_cqm_txe_config: Configure connection quality monitor TX error
3846 * @sched_scan_start: Tell the driver to start a scheduled scan.
3847 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
3848 * given request id. This call must stop the scheduled scan and be ready
3849 * for starting a new one before it returns, i.e. @sched_scan_start may be
3850 * called immediately after that again and should not fail in that case.
3851 * The driver should not call cfg80211_sched_scan_stopped() for a requested
3852 * stop (when this method returns 0).
3854 * @update_mgmt_frame_registrations: Notify the driver that management frame
3855 * registrations were updated. The callback is allowed to sleep.
3857 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3858 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3859 * reject TX/RX mask combinations they cannot support by returning -EINVAL
3860 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3862 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
3864 * @tdls_mgmt: Transmit a TDLS management frame.
3865 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
3867 * @probe_client: probe an associated client, must return a cookie that it
3868 * later passes to cfg80211_probe_status().
3870 * @set_noack_map: Set the NoAck Map for the TIDs.
3872 * @get_channel: Get the current operating channel for the virtual interface.
3873 * For monitor interfaces, it should return %NULL unless there's a single
3874 * current monitoring channel.
3876 * @start_p2p_device: Start the given P2P device.
3877 * @stop_p2p_device: Stop the given P2P device.
3879 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
3880 * Parameters include ACL policy, an array of MAC address of stations
3881 * and the number of MAC addresses. If there is already a list in driver
3882 * this new list replaces the existing one. Driver has to clear its ACL
3883 * when number of MAC addresses entries is passed as 0. Drivers which
3884 * advertise the support for MAC based ACL have to implement this callback.
3886 * @start_radar_detection: Start radar detection in the driver.
3888 * @end_cac: End running CAC, probably because a related CAC
3889 * was finished on another phy.
3891 * @update_ft_ies: Provide updated Fast BSS Transition information to the
3892 * driver. If the SME is in the driver/firmware, this information can be
3893 * used in building Authentication and Reassociation Request frames.
3895 * @crit_proto_start: Indicates a critical protocol needs more link reliability
3896 * for a given duration (milliseconds). The protocol is provided so the
3897 * driver can take the most appropriate actions.
3898 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
3899 * reliability. This operation can not fail.
3900 * @set_coalesce: Set coalesce parameters.
3902 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
3903 * responsible for veryfing if the switch is possible. Since this is
3904 * inherently tricky driver may decide to disconnect an interface later
3905 * with cfg80211_stop_iface(). This doesn't mean driver can accept
3906 * everything. It should do it's best to verify requests and reject them
3907 * as soon as possible.
3909 * @set_qos_map: Set QoS mapping information to the driver
3911 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3912 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3913 * changes during the lifetime of the BSS.
3915 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3916 * with the given parameters; action frame exchange has been handled by
3917 * userspace so this just has to modify the TX path to take the TS into
3919 * If the admitted time is 0 just validate the parameters to make sure
3920 * the session can be created at all; it is valid to just always return
3921 * success for that but that may result in inefficient behaviour (handshake
3922 * with the peer followed by immediate teardown when the addition is later
3924 * @del_tx_ts: remove an existing TX TS
3926 * @join_ocb: join the OCB network with the specified parameters
3927 * (invoked with the wireless_dev mutex held)
3928 * @leave_ocb: leave the current OCB network
3929 * (invoked with the wireless_dev mutex held)
3931 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
3932 * is responsible for continually initiating channel-switching operations
3933 * and returning to the base channel for communication with the AP.
3934 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
3935 * peers must be on the base channel when the call completes.
3936 * @start_nan: Start the NAN interface.
3937 * @stop_nan: Stop the NAN interface.
3938 * @add_nan_func: Add a NAN function. Returns negative value on failure.
3939 * On success @nan_func ownership is transferred to the driver and
3940 * it may access it outside of the scope of this function. The driver
3941 * should free the @nan_func when no longer needed by calling
3942 * cfg80211_free_nan_func().
3943 * On success the driver should assign an instance_id in the
3944 * provided @nan_func.
3945 * @del_nan_func: Delete a NAN function.
3946 * @nan_change_conf: changes NAN configuration. The changed parameters must
3947 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
3948 * All other parameters must be ignored.
3950 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
3952 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3953 * function should return phy stats, and interface stats otherwise.
3955 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
3956 * If not deleted through @del_pmk the PMK remains valid until disconnect
3957 * upon which the driver should clear it.
3958 * (invoked with the wireless_dev mutex held)
3959 * @del_pmk: delete the previously configured PMK for the given authenticator.
3960 * (invoked with the wireless_dev mutex held)
3962 * @external_auth: indicates result of offloaded authentication processing from
3965 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
3966 * tells the driver that the frame should not be encrypted.
3968 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
3969 * Statistics should be cumulative, currently no way to reset is provided.
3970 * @start_pmsr: start peer measurement (e.g. FTM)
3971 * @abort_pmsr: abort peer measurement
3973 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3974 * but offloading OWE processing to the user space will get the updated
3975 * DH IE through this interface.
3977 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
3978 * and overrule HWMP path selection algorithm.
3979 * @set_tid_config: TID specific configuration, this can be peer or BSS specific
3980 * This callback may sleep.
3981 * @reset_tid_config: Reset TID specific configuration for the peer, for the
3982 * given TIDs. This callback may sleep.
3984 * @set_sar_specs: Update the SAR (TX power) settings.
3986 struct cfg80211_ops {
3987 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
3988 int (*resume)(struct wiphy *wiphy);
3989 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
3991 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3993 unsigned char name_assign_type,
3994 enum nl80211_iftype type,
3995 struct vif_params *params);
3996 int (*del_virtual_intf)(struct wiphy *wiphy,
3997 struct wireless_dev *wdev);
3998 int (*change_virtual_intf)(struct wiphy *wiphy,
3999 struct net_device *dev,
4000 enum nl80211_iftype type,
4001 struct vif_params *params);
4003 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
4004 u8 key_index, bool pairwise, const u8 *mac_addr,
4005 struct key_params *params);
4006 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
4007 u8 key_index, bool pairwise, const u8 *mac_addr,
4009 void (*callback)(void *cookie, struct key_params*));
4010 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
4011 u8 key_index, bool pairwise, const u8 *mac_addr);
4012 int (*set_default_key)(struct wiphy *wiphy,
4013 struct net_device *netdev,
4014 u8 key_index, bool unicast, bool multicast);
4015 int (*set_default_mgmt_key)(struct wiphy *wiphy,
4016 struct net_device *netdev,
4018 int (*set_default_beacon_key)(struct wiphy *wiphy,
4019 struct net_device *netdev,
4022 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
4023 struct cfg80211_ap_settings *settings);
4024 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
4025 struct cfg80211_beacon_data *info);
4026 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
4029 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
4031 struct station_parameters *params);
4032 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
4033 struct station_del_parameters *params);
4034 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
4036 struct station_parameters *params);
4037 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
4038 const u8 *mac, struct station_info *sinfo);
4039 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
4040 int idx, u8 *mac, struct station_info *sinfo);
4042 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
4043 const u8 *dst, const u8 *next_hop);
4044 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
4046 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
4047 const u8 *dst, const u8 *next_hop);
4048 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
4049 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
4050 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
4051 int idx, u8 *dst, u8 *next_hop,
4052 struct mpath_info *pinfo);
4053 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
4054 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
4055 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
4056 int idx, u8 *dst, u8 *mpp,
4057 struct mpath_info *pinfo);
4058 int (*get_mesh_config)(struct wiphy *wiphy,
4059 struct net_device *dev,
4060 struct mesh_config *conf);
4061 int (*update_mesh_config)(struct wiphy *wiphy,
4062 struct net_device *dev, u32 mask,
4063 const struct mesh_config *nconf);
4064 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
4065 const struct mesh_config *conf,
4066 const struct mesh_setup *setup);
4067 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
4069 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
4070 struct ocb_setup *setup);
4071 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
4073 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
4074 struct bss_parameters *params);
4076 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
4077 struct ieee80211_txq_params *params);
4079 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
4080 struct net_device *dev,
4081 struct ieee80211_channel *chan);
4083 int (*set_monitor_channel)(struct wiphy *wiphy,
4084 struct cfg80211_chan_def *chandef);
4086 int (*scan)(struct wiphy *wiphy,
4087 struct cfg80211_scan_request *request);
4088 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4090 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
4091 struct cfg80211_auth_request *req);
4092 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
4093 struct cfg80211_assoc_request *req);
4094 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
4095 struct cfg80211_deauth_request *req);
4096 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
4097 struct cfg80211_disassoc_request *req);
4099 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
4100 struct cfg80211_connect_params *sme);
4101 int (*update_connect_params)(struct wiphy *wiphy,
4102 struct net_device *dev,
4103 struct cfg80211_connect_params *sme,
4105 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
4108 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
4109 struct cfg80211_ibss_params *params);
4110 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
4112 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
4113 int rate[NUM_NL80211_BANDS]);
4115 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
4117 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4118 enum nl80211_tx_power_setting type, int mbm);
4119 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
4122 void (*rfkill_poll)(struct wiphy *wiphy);
4124 #ifdef CONFIG_NL80211_TESTMODE
4125 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
4126 void *data, int len);
4127 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
4128 struct netlink_callback *cb,
4129 void *data, int len);
4132 int (*set_bitrate_mask)(struct wiphy *wiphy,
4133 struct net_device *dev,
4135 const struct cfg80211_bitrate_mask *mask);
4137 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
4138 int idx, struct survey_info *info);
4140 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4141 struct cfg80211_pmksa *pmksa);
4142 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
4143 struct cfg80211_pmksa *pmksa);
4144 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
4146 int (*remain_on_channel)(struct wiphy *wiphy,
4147 struct wireless_dev *wdev,
4148 struct ieee80211_channel *chan,
4149 unsigned int duration,
4151 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
4152 struct wireless_dev *wdev,
4155 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
4156 struct cfg80211_mgmt_tx_params *params,
4158 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
4159 struct wireless_dev *wdev,
4162 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4163 bool enabled, int timeout);
4165 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
4166 struct net_device *dev,
4167 s32 rssi_thold, u32 rssi_hyst);
4169 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
4170 struct net_device *dev,
4171 s32 rssi_low, s32 rssi_high);
4173 int (*set_cqm_txe_config)(struct wiphy *wiphy,
4174 struct net_device *dev,
4175 u32 rate, u32 pkts, u32 intvl);
4177 void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,
4178 struct wireless_dev *wdev,
4179 struct mgmt_frame_regs *upd);
4181 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
4182 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
4184 int (*sched_scan_start)(struct wiphy *wiphy,
4185 struct net_device *dev,
4186 struct cfg80211_sched_scan_request *request);
4187 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
4190 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
4191 struct cfg80211_gtk_rekey_data *data);
4193 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
4194 const u8 *peer, u8 action_code, u8 dialog_token,
4195 u16 status_code, u32 peer_capability,
4196 bool initiator, const u8 *buf, size_t len);
4197 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
4198 const u8 *peer, enum nl80211_tdls_operation oper);
4200 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
4201 const u8 *peer, u64 *cookie);
4203 int (*set_noack_map)(struct wiphy *wiphy,
4204 struct net_device *dev,
4207 int (*get_channel)(struct wiphy *wiphy,
4208 struct wireless_dev *wdev,
4209 struct cfg80211_chan_def *chandef);
4211 int (*start_p2p_device)(struct wiphy *wiphy,
4212 struct wireless_dev *wdev);
4213 void (*stop_p2p_device)(struct wiphy *wiphy,
4214 struct wireless_dev *wdev);
4216 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
4217 const struct cfg80211_acl_data *params);
4219 int (*start_radar_detection)(struct wiphy *wiphy,
4220 struct net_device *dev,
4221 struct cfg80211_chan_def *chandef,
4223 void (*end_cac)(struct wiphy *wiphy,
4224 struct net_device *dev);
4225 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4226 struct cfg80211_update_ft_ies_params *ftie);
4227 int (*crit_proto_start)(struct wiphy *wiphy,
4228 struct wireless_dev *wdev,
4229 enum nl80211_crit_proto_id protocol,
4231 void (*crit_proto_stop)(struct wiphy *wiphy,
4232 struct wireless_dev *wdev);
4233 int (*set_coalesce)(struct wiphy *wiphy,
4234 struct cfg80211_coalesce *coalesce);
4236 int (*channel_switch)(struct wiphy *wiphy,
4237 struct net_device *dev,
4238 struct cfg80211_csa_settings *params);
4240 int (*set_qos_map)(struct wiphy *wiphy,
4241 struct net_device *dev,
4242 struct cfg80211_qos_map *qos_map);
4244 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4245 struct cfg80211_chan_def *chandef);
4247 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4248 u8 tsid, const u8 *peer, u8 user_prio,
4250 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4251 u8 tsid, const u8 *peer);
4253 int (*tdls_channel_switch)(struct wiphy *wiphy,
4254 struct net_device *dev,
4255 const u8 *addr, u8 oper_class,
4256 struct cfg80211_chan_def *chandef);
4257 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
4258 struct net_device *dev,
4260 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4261 struct cfg80211_nan_conf *conf);
4262 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4263 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4264 struct cfg80211_nan_func *nan_func);
4265 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4267 int (*nan_change_conf)(struct wiphy *wiphy,
4268 struct wireless_dev *wdev,
4269 struct cfg80211_nan_conf *conf,
4272 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
4273 struct net_device *dev,
4274 const bool enabled);
4276 int (*get_txq_stats)(struct wiphy *wiphy,
4277 struct wireless_dev *wdev,
4278 struct cfg80211_txq_stats *txqstats);
4280 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
4281 const struct cfg80211_pmk_conf *conf);
4282 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
4284 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
4285 struct cfg80211_external_auth_params *params);
4287 int (*tx_control_port)(struct wiphy *wiphy,
4288 struct net_device *dev,
4289 const u8 *buf, size_t len,
4290 const u8 *dest, const __be16 proto,
4291 const bool noencrypt,
4294 int (*get_ftm_responder_stats)(struct wiphy *wiphy,
4295 struct net_device *dev,
4296 struct cfg80211_ftm_responder_stats *ftm_stats);
4298 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4299 struct cfg80211_pmsr_request *request);
4300 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4301 struct cfg80211_pmsr_request *request);
4302 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4303 struct cfg80211_update_owe_info *owe_info);
4304 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
4305 const u8 *buf, size_t len);
4306 int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4307 struct cfg80211_tid_config *tid_conf);
4308 int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4309 const u8 *peer, u8 tids);
4310 int (*set_sar_specs)(struct wiphy *wiphy,
4311 struct cfg80211_sar_specs *sar);
4315 * wireless hardware and networking interfaces structures
4316 * and registration/helper functions
4320 * enum wiphy_flags - wiphy capability flags
4322 * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
4323 * into two, first for legacy bands and second for UHB.
4324 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
4326 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
4327 * by default -- this flag will be set depending on the kernel's default
4328 * on wiphy_new(), but can be changed by the driver if it has a good
4329 * reason to override the default
4330 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
4331 * on a VLAN interface). This flag also serves an extra purpose of
4332 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
4333 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4334 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4335 * control port protocol ethertype. The device also honours the
4336 * control_port_no_encrypt flag.
4337 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
4338 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
4339 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4340 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4342 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4343 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4344 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4345 * link setup/discovery operations internally. Setup, discovery and
4346 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4347 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4348 * used for asking the driver/firmware to perform a TDLS operation.
4349 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
4350 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
4351 * when there are virtual interfaces in AP mode by calling
4352 * cfg80211_report_obss_beacon().
4353 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
4354 * responds to probe-requests in hardware.
4355 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
4356 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
4357 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
4358 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
4359 * beaconing mode (AP, IBSS, Mesh, ...).
4360 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4361 * before connection.
4362 * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
4365 WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0),
4367 WIPHY_FLAG_SPLIT_SCAN_6GHZ = BIT(2),
4368 WIPHY_FLAG_NETNS_OK = BIT(3),
4369 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
4370 WIPHY_FLAG_4ADDR_AP = BIT(5),
4371 WIPHY_FLAG_4ADDR_STATION = BIT(6),
4372 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
4373 WIPHY_FLAG_IBSS_RSN = BIT(8),
4374 WIPHY_FLAG_MESH_AUTH = BIT(10),
4375 /* use hole at 11 */
4376 /* use hole at 12 */
4377 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
4378 WIPHY_FLAG_AP_UAPSD = BIT(14),
4379 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
4380 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
4381 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
4382 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
4383 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
4384 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
4385 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
4386 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
4387 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
4388 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
4392 * struct ieee80211_iface_limit - limit on certain interface types
4393 * @max: maximum number of interfaces of these types
4394 * @types: interface types (bits)
4396 struct ieee80211_iface_limit {
4402 * struct ieee80211_iface_combination - possible interface combination
4404 * With this structure the driver can describe which interface
4405 * combinations it supports concurrently.
4409 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
4413 * struct ieee80211_iface_limit limits1[] = {
4414 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4415 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
4417 * struct ieee80211_iface_combination combination1 = {
4418 * .limits = limits1,
4419 * .n_limits = ARRAY_SIZE(limits1),
4420 * .max_interfaces = 2,
4421 * .beacon_int_infra_match = true,
4425 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
4429 * struct ieee80211_iface_limit limits2[] = {
4430 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
4431 * BIT(NL80211_IFTYPE_P2P_GO), },
4433 * struct ieee80211_iface_combination combination2 = {
4434 * .limits = limits2,
4435 * .n_limits = ARRAY_SIZE(limits2),
4436 * .max_interfaces = 8,
4437 * .num_different_channels = 1,
4441 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4443 * This allows for an infrastructure connection and three P2P connections.
4447 * struct ieee80211_iface_limit limits3[] = {
4448 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4449 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
4450 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
4452 * struct ieee80211_iface_combination combination3 = {
4453 * .limits = limits3,
4454 * .n_limits = ARRAY_SIZE(limits3),
4455 * .max_interfaces = 4,
4456 * .num_different_channels = 2,
4460 struct ieee80211_iface_combination {
4463 * limits for the given interface types
4465 const struct ieee80211_iface_limit *limits;
4468 * @num_different_channels:
4469 * can use up to this many different channels
4471 u32 num_different_channels;
4475 * maximum number of interfaces in total allowed in this group
4481 * number of limitations
4486 * @beacon_int_infra_match:
4487 * In this combination, the beacon intervals between infrastructure
4488 * and AP types must match. This is required only in special cases.
4490 bool beacon_int_infra_match;
4493 * @radar_detect_widths:
4494 * bitmap of channel widths supported for radar detection
4496 u8 radar_detect_widths;
4499 * @radar_detect_regions:
4500 * bitmap of regions supported for radar detection
4502 u8 radar_detect_regions;
4505 * @beacon_int_min_gcd:
4506 * This interface combination supports different beacon intervals.
4509 * all beacon intervals for different interface must be same.
4511 * any beacon interval for the interface part of this combination AND
4512 * GCD of all beacon intervals from beaconing interfaces of this
4513 * combination must be greater or equal to this value.
4515 u32 beacon_int_min_gcd;
4518 struct ieee80211_txrx_stypes {
4523 * enum wiphy_wowlan_support_flags - WoWLAN support flags
4524 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4525 * trigger that keeps the device operating as-is and
4526 * wakes up the host on any activity, for example a
4527 * received packet that passed filtering; note that the
4528 * packet should be preserved in that case
4529 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4531 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
4532 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
4533 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
4534 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
4535 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
4536 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
4537 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4539 enum wiphy_wowlan_support_flags {
4540 WIPHY_WOWLAN_ANY = BIT(0),
4541 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
4542 WIPHY_WOWLAN_DISCONNECT = BIT(2),
4543 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
4544 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
4545 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
4546 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
4547 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
4548 WIPHY_WOWLAN_NET_DETECT = BIT(8),
4551 struct wiphy_wowlan_tcp_support {
4552 const struct nl80211_wowlan_tcp_data_token_feature *tok;
4553 u32 data_payload_max;
4554 u32 data_interval_max;
4555 u32 wake_payload_max;
4560 * struct wiphy_wowlan_support - WoWLAN support data
4561 * @flags: see &enum wiphy_wowlan_support_flags
4562 * @n_patterns: number of supported wakeup patterns
4563 * (see nl80211.h for the pattern definition)
4564 * @pattern_max_len: maximum length of each pattern
4565 * @pattern_min_len: minimum length of each pattern
4566 * @max_pkt_offset: maximum Rx packet offset
4567 * @max_nd_match_sets: maximum number of matchsets for net-detect,
4568 * similar, but not necessarily identical, to max_match_sets for
4570 * See &struct cfg80211_sched_scan_request.@match_sets for more
4572 * @tcp: TCP wakeup support information
4574 struct wiphy_wowlan_support {
4577 int pattern_max_len;
4578 int pattern_min_len;
4580 int max_nd_match_sets;
4581 const struct wiphy_wowlan_tcp_support *tcp;
4585 * struct wiphy_coalesce_support - coalesce support data
4586 * @n_rules: maximum number of coalesce rules
4587 * @max_delay: maximum supported coalescing delay in msecs
4588 * @n_patterns: number of supported patterns in a rule
4589 * (see nl80211.h for the pattern definition)
4590 * @pattern_max_len: maximum length of each pattern
4591 * @pattern_min_len: minimum length of each pattern
4592 * @max_pkt_offset: maximum Rx packet offset
4594 struct wiphy_coalesce_support {
4598 int pattern_max_len;
4599 int pattern_min_len;
4604 * enum wiphy_vendor_command_flags - validation flags for vendor commands
4605 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4606 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4607 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4608 * (must be combined with %_WDEV or %_NETDEV)
4610 enum wiphy_vendor_command_flags {
4611 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4612 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4613 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4617 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4619 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4620 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4621 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4624 enum wiphy_opmode_flag {
4625 STA_OPMODE_MAX_BW_CHANGED = BIT(0),
4626 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
4627 STA_OPMODE_N_SS_CHANGED = BIT(2),
4631 * struct sta_opmode_info - Station's ht/vht operation mode information
4632 * @changed: contains value from &enum wiphy_opmode_flag
4633 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
4634 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4635 * @rx_nss: new rx_nss value of a station
4638 struct sta_opmode_info {
4640 enum nl80211_smps_mode smps_mode;
4641 enum nl80211_chan_width bw;
4645 #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4648 * struct wiphy_vendor_command - vendor command definition
4649 * @info: vendor command identifying information, as used in nl80211
4650 * @flags: flags, see &enum wiphy_vendor_command_flags
4651 * @doit: callback for the operation, note that wdev is %NULL if the
4652 * flags didn't ask for a wdev and non-%NULL otherwise; the data
4653 * pointer may be %NULL if userspace provided no data at all
4654 * @dumpit: dump callback, for transferring bigger/multiple items. The
4655 * @storage points to cb->args[5], ie. is preserved over the multiple
4657 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4658 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4659 * attribute is just raw data (e.g. a firmware command).
4660 * @maxattr: highest attribute number in policy
4661 * It's recommended to not have the same sub command with both @doit and
4662 * @dumpit, so that userspace can assume certain ones are get and others
4663 * are used with dump requests.
4665 struct wiphy_vendor_command {
4666 struct nl80211_vendor_cmd_info info;
4668 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4669 const void *data, int data_len);
4670 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4671 struct sk_buff *skb, const void *data, int data_len,
4672 unsigned long *storage);
4673 const struct nla_policy *policy;
4674 unsigned int maxattr;
4678 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4679 * @iftype: interface type
4680 * @extended_capabilities: extended capabilities supported by the driver,
4681 * additional capabilities might be supported by userspace; these are the
4682 * 802.11 extended capabilities ("Extended Capabilities element") and are
4683 * in the same format as in the information element. See IEEE Std
4684 * 802.11-2012 8.4.2.29 for the defined fields.
4685 * @extended_capabilities_mask: mask of the valid values
4686 * @extended_capabilities_len: length of the extended capabilities
4688 struct wiphy_iftype_ext_capab {
4689 enum nl80211_iftype iftype;
4690 const u8 *extended_capabilities;
4691 const u8 *extended_capabilities_mask;
4692 u8 extended_capabilities_len;
4696 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4697 * @max_peers: maximum number of peers in a single measurement
4698 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4699 * @randomize_mac_addr: can randomize MAC address for measurement
4700 * @ftm.supported: FTM measurement is supported
4701 * @ftm.asap: ASAP-mode is supported
4702 * @ftm.non_asap: non-ASAP-mode is supported
4703 * @ftm.request_lci: can request LCI data
4704 * @ftm.request_civicloc: can request civic location data
4705 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4706 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4707 * @ftm.max_bursts_exponent: maximum burst exponent supported
4708 * (set to -1 if not limited; note that setting this will necessarily
4709 * forbid using the value 15 to let the responder pick)
4710 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4712 * @ftm.trigger_based: trigger based ranging measurement is supported
4713 * @ftm.non_trigger_based: non trigger based ranging measurement is supported
4715 struct cfg80211_pmsr_capabilities {
4716 unsigned int max_peers;
4718 randomize_mac_addr:1;
4723 s8 max_bursts_exponent;
4724 u8 max_ftms_per_burst;
4731 non_trigger_based:1;
4736 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4737 * suites for interface types defined in @iftypes_mask. Each type in the
4738 * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4740 * @iftypes_mask: bitmask of interfaces types
4741 * @akm_suites: points to an array of supported akm suites
4742 * @n_akm_suites: number of supported AKM suites
4744 struct wiphy_iftype_akm_suites {
4746 const u32 *akm_suites;
4751 * struct wiphy - wireless hardware description
4752 * @mtx: mutex for the data (structures) of this device
4753 * @reg_notifier: the driver's regulatory notification callback,
4754 * note that if your driver uses wiphy_apply_custom_regulatory()
4755 * the reg_notifier's request can be passed as NULL
4756 * @regd: the driver's regulatory domain, if one was requested via
4757 * the regulatory_hint() API. This can be used by the driver
4758 * on the reg_notifier() if it chooses to ignore future
4759 * regulatory domain changes caused by other drivers.
4760 * @signal_type: signal type reported in &struct cfg80211_bss.
4761 * @cipher_suites: supported cipher suites
4762 * @n_cipher_suites: number of supported cipher suites
4763 * @akm_suites: supported AKM suites. These are the default AKMs supported if
4764 * the supported AKMs not advertized for a specific interface type in
4765 * iftype_akm_suites.
4766 * @n_akm_suites: number of supported AKM suites
4767 * @iftype_akm_suites: array of supported akm suites info per interface type.
4768 * Note that the bits in @iftypes_mask inside this structure cannot
4769 * overlap (i.e. only one occurrence of each type is allowed across all
4770 * instances of iftype_akm_suites).
4771 * @num_iftype_akm_suites: number of interface types for which supported akm
4772 * suites are specified separately.
4773 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4774 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4775 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4776 * -1 = fragmentation disabled, only odd values >= 256 used
4777 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4778 * @_net: the network namespace this wiphy currently lives in
4779 * @perm_addr: permanent MAC address of this device
4780 * @addr_mask: If the device supports multiple MAC addresses by masking,
4781 * set this to a mask with variable bits set to 1, e.g. if the last
4782 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
4783 * variable bits shall be determined by the interfaces added, with
4784 * interfaces not matching the mask being rejected to be brought up.
4785 * @n_addresses: number of addresses in @addresses.
4786 * @addresses: If the device has more than one address, set this pointer
4787 * to a list of addresses (6 bytes each). The first one will be used
4788 * by default for perm_addr. In this case, the mask should be set to
4789 * all-zeroes. In this case it is assumed that the device can handle
4790 * the same number of arbitrary MAC addresses.
4791 * @registered: protects ->resume and ->suspend sysfs callbacks against
4792 * unregister hardware
4793 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4794 * It will be renamed automatically on wiphy renames
4795 * @dev: (virtual) struct device for this wiphy. The item in
4796 * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
4798 * @wext: wireless extension handlers
4799 * @priv: driver private data (sized according to wiphy_new() parameter)
4800 * @interface_modes: bitmask of interfaces types valid for this wiphy,
4801 * must be set by driver
4802 * @iface_combinations: Valid interface combinations array, should not
4803 * list single interface types.
4804 * @n_iface_combinations: number of entries in @iface_combinations array.
4805 * @software_iftypes: bitmask of software interface types, these are not
4806 * subject to any restrictions since they are purely managed in SW.
4807 * @flags: wiphy flags, see &enum wiphy_flags
4808 * @regulatory_flags: wiphy regulatory flags, see
4809 * &enum ieee80211_regulatory_flags
4810 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4811 * @ext_features: extended features advertised to nl80211, see
4812 * &enum nl80211_ext_feature_index.
4813 * @bss_priv_size: each BSS struct has private data allocated with it,
4814 * this variable determines its size
4815 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4817 * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4818 * the device can run concurrently.
4819 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
4820 * for in any given scheduled scan
4821 * @max_match_sets: maximum number of match sets the device can handle
4822 * when performing a scheduled scan, 0 if filtering is not
4824 * @max_scan_ie_len: maximum length of user-controlled IEs device can
4825 * add to probe request frames transmitted during a scan, must not
4826 * include fixed IEs like supported rates
4827 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
4829 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
4830 * of iterations) for scheduled scan supported by the device.
4831 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
4832 * single scan plan supported by the device.
4833 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
4834 * scan plan supported by the device.
4835 * @coverage_class: current coverage class
4836 * @fw_version: firmware version for ethtool reporting
4837 * @hw_version: hardware version for ethtool reporting
4838 * @max_num_pmkids: maximum number of PMKIDs supported by device
4839 * @privid: a pointer that drivers can use to identify if an arbitrary
4840 * wiphy is theirs, e.g. in global notifiers
4841 * @bands: information about bands/channels supported by this device
4843 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
4844 * transmitted through nl80211, points to an array indexed by interface
4847 * @available_antennas_tx: bitmap of antennas which are available to be
4848 * configured as TX antennas. Antenna configuration commands will be
4849 * rejected unless this or @available_antennas_rx is set.
4851 * @available_antennas_rx: bitmap of antennas which are available to be
4852 * configured as RX antennas. Antenna configuration commands will be
4853 * rejected unless this or @available_antennas_tx is set.
4855 * @probe_resp_offload:
4856 * Bitmap of supported protocols for probe response offloading.
4857 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
4858 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4860 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4861 * may request, if implemented.
4863 * @wowlan: WoWLAN support information
4864 * @wowlan_config: current WoWLAN configuration; this should usually not be
4865 * used since access to it is necessarily racy, use the parameter passed
4866 * to the suspend() operation instead.
4868 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
4869 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
4870 * If null, then none can be over-ridden.
4871 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
4872 * If null, then none can be over-ridden.
4874 * @wdev_list: the list of associated (virtual) interfaces; this list must
4875 * not be modified by the driver, but can be read with RTNL/RCU protection.
4877 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
4880 * @extended_capabilities: extended capabilities supported by the driver,
4881 * additional capabilities might be supported by userspace; these are
4882 * the 802.11 extended capabilities ("Extended Capabilities element")
4883 * and are in the same format as in the information element. See
4884 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
4885 * extended capabilities to be used if the capabilities are not specified
4886 * for a specific interface type in iftype_ext_capab.
4887 * @extended_capabilities_mask: mask of the valid values
4888 * @extended_capabilities_len: length of the extended capabilities
4889 * @iftype_ext_capab: array of extended capabilities per interface type
4890 * @num_iftype_ext_capab: number of interface types for which extended
4891 * capabilities are specified separately.
4892 * @coalesce: packet coalescing support information
4894 * @vendor_commands: array of vendor commands supported by the hardware
4895 * @n_vendor_commands: number of vendor commands
4896 * @vendor_events: array of vendor events supported by the hardware
4897 * @n_vendor_events: number of vendor events
4899 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4900 * (including P2P GO) or 0 to indicate no such limit is advertised. The
4901 * driver is allowed to advertise a theoretical limit that it can reach in
4902 * some cases, but may not always reach.
4904 * @max_num_csa_counters: Number of supported csa_counters in beacons
4905 * and probe responses. This value should be set if the driver
4906 * wishes to limit the number of csa counters. Default (0) means
4908 * @bss_select_support: bitmask indicating the BSS selection criteria supported
4909 * by the driver in the .connect() callback. The bit position maps to the
4910 * attribute indices defined in &enum nl80211_bss_select_attr.
4912 * @nan_supported_bands: bands supported by the device in NAN mode, a
4913 * bitmap of &enum nl80211_band values. For instance, for
4914 * NL80211_BAND_2GHZ, bit 0 would be set
4915 * (i.e. BIT(NL80211_BAND_2GHZ)).
4917 * @txq_limit: configuration of internal TX queue frame limit
4918 * @txq_memory_limit: configuration internal TX queue memory limit
4919 * @txq_quantum: configuration of internal TX queue scheduler quantum
4921 * @tx_queue_len: allow setting transmit queue len for drivers not using
4924 * @support_mbssid: can HW support association with nontransmitted AP
4925 * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4926 * HE AP, in order to avoid compatibility issues.
4927 * @support_mbssid must be set for this to have any effect.
4929 * @pmsr_capa: peer measurement capabilities
4931 * @tid_config_support: describes the per-TID config support that the
4933 * @tid_config_support.vif: bitmap of attributes (configurations)
4934 * supported by the driver for each vif
4935 * @tid_config_support.peer: bitmap of attributes (configurations)
4936 * supported by the driver for each peer
4937 * @tid_config_support.max_retry: maximum supported retry count for
4938 * long/short retry configuration
4940 * @max_data_retry_count: maximum supported per TID retry count for
4941 * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
4942 * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
4943 * @sar_capa: SAR control capabilities
4948 /* assign these fields before you register the wiphy */
4950 u8 perm_addr[ETH_ALEN];
4951 u8 addr_mask[ETH_ALEN];
4953 struct mac_address *addresses;
4955 const struct ieee80211_txrx_stypes *mgmt_stypes;
4957 const struct ieee80211_iface_combination *iface_combinations;
4958 int n_iface_combinations;
4959 u16 software_iftypes;
4963 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4964 u16 interface_modes;
4966 u16 max_acl_mac_addrs;
4968 u32 flags, regulatory_flags, features;
4969 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4973 enum cfg80211_signal_type signal_type;
4977 u8 max_sched_scan_reqs;
4978 u8 max_sched_scan_ssids;
4980 u16 max_scan_ie_len;
4981 u16 max_sched_scan_ie_len;
4982 u32 max_sched_scan_plans;
4983 u32 max_sched_scan_plan_interval;
4984 u32 max_sched_scan_plan_iterations;
4986 int n_cipher_suites;
4987 const u32 *cipher_suites;
4990 const u32 *akm_suites;
4992 const struct wiphy_iftype_akm_suites *iftype_akm_suites;
4993 unsigned int num_iftype_akm_suites;
5001 char fw_version[ETHTOOL_FWVERS_LEN];
5005 const struct wiphy_wowlan_support *wowlan;
5006 struct cfg80211_wowlan *wowlan_config;
5009 u16 max_remain_on_channel_duration;
5013 u32 available_antennas_tx;
5014 u32 available_antennas_rx;
5016 u32 probe_resp_offload;
5018 const u8 *extended_capabilities, *extended_capabilities_mask;
5019 u8 extended_capabilities_len;
5021 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
5022 unsigned int num_iftype_ext_capab;
5026 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
5028 void (*reg_notifier)(struct wiphy *wiphy,
5029 struct regulatory_request *request);
5031 /* fields below are read-only, assigned by cfg80211 */
5033 const struct ieee80211_regdomain __rcu *regd;
5039 struct dentry *debugfsdir;
5041 const struct ieee80211_ht_cap *ht_capa_mod_mask;
5042 const struct ieee80211_vht_cap *vht_capa_mod_mask;
5044 struct list_head wdev_list;
5046 possible_net_t _net;
5048 #ifdef CONFIG_CFG80211_WEXT
5049 const struct iw_handler_def *wext;
5052 const struct wiphy_coalesce_support *coalesce;
5054 const struct wiphy_vendor_command *vendor_commands;
5055 const struct nl80211_vendor_cmd_info *vendor_events;
5056 int n_vendor_commands, n_vendor_events;
5058 u16 max_ap_assoc_sta;
5060 u8 max_num_csa_counters;
5062 u32 bss_select_support;
5064 u8 nan_supported_bands;
5067 u32 txq_memory_limit;
5070 unsigned long tx_queue_len;
5072 u8 support_mbssid:1,
5073 support_only_he_mbssid:1;
5075 const struct cfg80211_pmsr_capabilities *pmsr_capa;
5080 } tid_config_support;
5082 u8 max_data_retry_count;
5084 const struct cfg80211_sar_capa *sar_capa;
5086 char priv[] __aligned(NETDEV_ALIGN);
5089 static inline struct net *wiphy_net(struct wiphy *wiphy)
5091 return read_pnet(&wiphy->_net);
5094 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
5096 write_pnet(&wiphy->_net, net);
5100 * wiphy_priv - return priv from wiphy
5102 * @wiphy: the wiphy whose priv pointer to return
5103 * Return: The priv of @wiphy.
5105 static inline void *wiphy_priv(struct wiphy *wiphy)
5108 return &wiphy->priv;
5112 * priv_to_wiphy - return the wiphy containing the priv
5114 * @priv: a pointer previously returned by wiphy_priv
5115 * Return: The wiphy of @priv.
5117 static inline struct wiphy *priv_to_wiphy(void *priv)
5120 return container_of(priv, struct wiphy, priv);
5124 * set_wiphy_dev - set device pointer for wiphy
5126 * @wiphy: The wiphy whose device to bind
5127 * @dev: The device to parent it to
5129 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
5131 wiphy->dev.parent = dev;
5135 * wiphy_dev - get wiphy dev pointer
5137 * @wiphy: The wiphy whose device struct to look up
5138 * Return: The dev of @wiphy.
5140 static inline struct device *wiphy_dev(struct wiphy *wiphy)
5142 return wiphy->dev.parent;
5146 * wiphy_name - get wiphy name
5148 * @wiphy: The wiphy whose name to return
5149 * Return: The name of @wiphy.
5151 static inline const char *wiphy_name(const struct wiphy *wiphy)
5153 return dev_name(&wiphy->dev);
5157 * wiphy_new_nm - create a new wiphy for use with cfg80211
5159 * @ops: The configuration operations for this device
5160 * @sizeof_priv: The size of the private area to allocate
5161 * @requested_name: Request a particular name.
5162 * NULL is valid value, and means use the default phy%d naming.
5164 * Create a new wiphy and associate the given operations with it.
5165 * @sizeof_priv bytes are allocated for private use.
5167 * Return: A pointer to the new wiphy. This pointer must be
5168 * assigned to each netdev's ieee80211_ptr for proper operation.
5170 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
5171 const char *requested_name);
5174 * wiphy_new - create a new wiphy for use with cfg80211
5176 * @ops: The configuration operations for this device
5177 * @sizeof_priv: The size of the private area to allocate
5179 * Create a new wiphy and associate the given operations with it.
5180 * @sizeof_priv bytes are allocated for private use.
5182 * Return: A pointer to the new wiphy. This pointer must be
5183 * assigned to each netdev's ieee80211_ptr for proper operation.
5185 static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
5188 return wiphy_new_nm(ops, sizeof_priv, NULL);
5192 * wiphy_register - register a wiphy with cfg80211
5194 * @wiphy: The wiphy to register.
5196 * Return: A non-negative wiphy index or a negative error code.
5198 int wiphy_register(struct wiphy *wiphy);
5200 /* this is a define for better error reporting (file/line) */
5201 #define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
5204 * rcu_dereference_wiphy - rcu_dereference with debug checking
5205 * @wiphy: the wiphy to check the locking on
5206 * @p: The pointer to read, prior to dereferencing
5208 * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
5209 * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
5211 #define rcu_dereference_wiphy(wiphy, p) \
5212 rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
5215 * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
5216 * @wiphy: the wiphy to check the locking on
5217 * @p: The pointer to read, prior to dereferencing
5219 * Return the value of the specified RCU-protected pointer, but omit the
5220 * READ_ONCE(), because caller holds the wiphy mutex used for updates.
5222 #define wiphy_dereference(wiphy, p) \
5223 rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
5226 * get_wiphy_regdom - get custom regdomain for the given wiphy
5227 * @wiphy: the wiphy to get the regdomain from
5229 const struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
5232 * wiphy_unregister - deregister a wiphy from cfg80211
5234 * @wiphy: The wiphy to unregister.
5236 * After this call, no more requests can be made with this priv
5237 * pointer, but the call may sleep to wait for an outstanding
5238 * request that is being handled.
5240 void wiphy_unregister(struct wiphy *wiphy);
5243 * wiphy_free - free wiphy
5245 * @wiphy: The wiphy to free
5247 void wiphy_free(struct wiphy *wiphy);
5249 /* internal structs */
5250 struct cfg80211_conn;
5251 struct cfg80211_internal_bss;
5252 struct cfg80211_cached_keys;
5253 struct cfg80211_cqm_config;
5256 * wiphy_lock - lock the wiphy
5257 * @wiphy: the wiphy to lock
5259 * This is mostly exposed so it can be done around registering and
5260 * unregistering netdevs that aren't created through cfg80211 calls,
5261 * since that requires locking in cfg80211 when the notifiers is
5262 * called, but that cannot differentiate which way it's called.
5264 * When cfg80211 ops are called, the wiphy is already locked.
5266 static inline void wiphy_lock(struct wiphy *wiphy)
5267 __acquires(&wiphy->mtx)
5269 mutex_lock(&wiphy->mtx);
5270 __acquire(&wiphy->mtx);
5274 * wiphy_unlock - unlock the wiphy again
5275 * @wiphy: the wiphy to unlock
5277 static inline void wiphy_unlock(struct wiphy *wiphy)
5278 __releases(&wiphy->mtx)
5280 __release(&wiphy->mtx);
5281 mutex_unlock(&wiphy->mtx);
5285 * struct wireless_dev - wireless device state
5287 * For netdevs, this structure must be allocated by the driver
5288 * that uses the ieee80211_ptr field in struct net_device (this
5289 * is intentional so it can be allocated along with the netdev.)
5290 * It need not be registered then as netdev registration will
5291 * be intercepted by cfg80211 to see the new wireless device,
5292 * however, drivers must lock the wiphy before registering or
5293 * unregistering netdevs if they pre-create any netdevs (in ops
5294 * called from cfg80211, the wiphy is already locked.)
5296 * For non-netdev uses, it must also be allocated by the driver
5297 * in response to the cfg80211 callbacks that require it, as
5298 * there's no netdev registration in that case it may not be
5299 * allocated outside of callback operations that return it.
5301 * @wiphy: pointer to hardware description
5302 * @iftype: interface type
5303 * @registered: is this wdev already registered with cfg80211
5304 * @registering: indicates we're doing registration under wiphy lock
5306 * @list: (private) Used to collect the interfaces
5307 * @netdev: (private) Used to reference back to the netdev, may be %NULL
5308 * @identifier: (private) Identifier used in nl80211 to identify this
5309 * wireless device if it has no netdev
5310 * @current_bss: (private) Used by the internal configuration code
5311 * @chandef: (private) Used by the internal configuration code to track
5312 * the user-set channel definition.
5313 * @preset_chandef: (private) Used by the internal configuration code to
5314 * track the channel to be used for AP later
5315 * @bssid: (private) Used by the internal configuration code
5316 * @ssid: (private) Used by the internal configuration code
5317 * @ssid_len: (private) Used by the internal configuration code
5318 * @mesh_id_len: (private) Used by the internal configuration code
5319 * @mesh_id_up_len: (private) Used by the internal configuration code
5320 * @wext: (private) Used by the internal wireless extensions compat code
5321 * @wext.ibss: (private) IBSS data part of wext handling
5322 * @wext.connect: (private) connection handling data
5323 * @wext.keys: (private) (WEP) key data
5324 * @wext.ie: (private) extra elements for association
5325 * @wext.ie_len: (private) length of extra elements
5326 * @wext.bssid: (private) selected network BSSID
5327 * @wext.ssid: (private) selected network SSID
5328 * @wext.default_key: (private) selected default key index
5329 * @wext.default_mgmt_key: (private) selected default management key index
5330 * @wext.prev_bssid: (private) previous BSSID for reassociation
5331 * @wext.prev_bssid_valid: (private) previous BSSID validity
5332 * @use_4addr: indicates 4addr mode is used on this interface, must be
5333 * set by driver (if supported) on add_interface BEFORE registering the
5334 * netdev and may otherwise be used by driver read-only, will be update
5335 * by cfg80211 on change_interface
5336 * @mgmt_registrations: list of registrations for management frames
5337 * @mgmt_registrations_lock: lock for the list
5338 * @mgmt_registrations_need_update: mgmt registrations were updated,
5339 * need to propagate the update to the driver
5340 * @mtx: mutex used to lock data in this struct, may be used by drivers
5341 * and some API functions require it held
5342 * @beacon_interval: beacon interval used on this device for transmitting
5343 * beacons, 0 when not valid
5344 * @address: The address for this device, valid only if @netdev is %NULL
5345 * @is_running: true if this is a non-netdev device that has been started, e.g.
5347 * @cac_started: true if DFS channel availability check has been started
5348 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
5349 * @cac_time_ms: CAC time in ms
5350 * @ps: powersave mode is enabled
5351 * @ps_timeout: dynamic powersave timeout
5352 * @ap_unexpected_nlportid: (private) netlink port ID of application
5353 * registered for unexpected class 3 frames (AP mode)
5354 * @conn: (private) cfg80211 software SME connection state machine data
5355 * @connect_keys: (private) keys to set after connection is established
5356 * @conn_bss_type: connecting/connected BSS type
5357 * @conn_owner_nlportid: (private) connection owner socket port ID
5358 * @disconnect_wk: (private) auto-disconnect work
5359 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5360 * @ibss_fixed: (private) IBSS is using fixed BSSID
5361 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
5362 * @event_list: (private) list for internal event processing
5363 * @event_lock: (private) lock for event list
5364 * @owner_nlportid: (private) owner socket port ID
5365 * @nl_owner_dead: (private) owner socket went away
5366 * @cqm_config: (private) nl80211 RSSI monitor state
5367 * @pmsr_list: (private) peer measurement requests
5368 * @pmsr_lock: (private) peer measurements requests/results lock
5369 * @pmsr_free_wk: (private) peer measurements cleanup work
5370 * @unprot_beacon_reported: (private) timestamp of last
5371 * unprotected beacon report
5373 struct wireless_dev {
5374 struct wiphy *wiphy;
5375 enum nl80211_iftype iftype;
5377 /* the remainder of this struct should be private to cfg80211 */
5378 struct list_head list;
5379 struct net_device *netdev;
5383 struct list_head mgmt_registrations;
5384 spinlock_t mgmt_registrations_lock;
5385 u8 mgmt_registrations_need_update:1;
5389 bool use_4addr, is_running, registered, registering;
5391 u8 address[ETH_ALEN] __aligned(sizeof(u16));
5393 /* currently used for IBSS and SME - might be rearranged later */
5394 u8 ssid[IEEE80211_MAX_SSID_LEN];
5395 u8 ssid_len, mesh_id_len, mesh_id_up_len;
5396 struct cfg80211_conn *conn;
5397 struct cfg80211_cached_keys *connect_keys;
5398 enum ieee80211_bss_type conn_bss_type;
5399 u32 conn_owner_nlportid;
5401 struct work_struct disconnect_wk;
5402 u8 disconnect_bssid[ETH_ALEN];
5404 struct list_head event_list;
5405 spinlock_t event_lock;
5407 struct cfg80211_internal_bss *current_bss; /* associated / joined */
5408 struct cfg80211_chan_def preset_chandef;
5409 struct cfg80211_chan_def chandef;
5412 bool ibss_dfs_possible;
5417 int beacon_interval;
5419 u32 ap_unexpected_nlportid;
5425 unsigned long cac_start_time;
5426 unsigned int cac_time_ms;
5428 #ifdef CONFIG_CFG80211_WEXT
5431 struct cfg80211_ibss_params ibss;
5432 struct cfg80211_connect_params connect;
5433 struct cfg80211_cached_keys *keys;
5437 u8 prev_bssid[ETH_ALEN];
5438 u8 ssid[IEEE80211_MAX_SSID_LEN];
5439 s8 default_key, default_mgmt_key;
5440 bool prev_bssid_valid;
5444 struct cfg80211_cqm_config *cqm_config;
5446 struct list_head pmsr_list;
5447 spinlock_t pmsr_lock;
5448 struct work_struct pmsr_free_wk;
5450 unsigned long unprot_beacon_reported;
5453 static inline u8 *wdev_address(struct wireless_dev *wdev)
5456 return wdev->netdev->dev_addr;
5457 return wdev->address;
5460 static inline bool wdev_running(struct wireless_dev *wdev)
5463 return netif_running(wdev->netdev);
5464 return wdev->is_running;
5468 * wdev_priv - return wiphy priv from wireless_dev
5470 * @wdev: The wireless device whose wiphy's priv pointer to return
5471 * Return: The wiphy priv of @wdev.
5473 static inline void *wdev_priv(struct wireless_dev *wdev)
5476 return wiphy_priv(wdev->wiphy);
5480 * DOC: Utility functions
5482 * cfg80211 offers a number of utility functions that can be useful.
5486 * ieee80211_channel_equal - compare two struct ieee80211_channel
5488 * @a: 1st struct ieee80211_channel
5489 * @b: 2nd struct ieee80211_channel
5490 * Return: true if center frequency of @a == @b
5493 ieee80211_channel_equal(struct ieee80211_channel *a,
5494 struct ieee80211_channel *b)
5496 return (a->center_freq == b->center_freq &&
5497 a->freq_offset == b->freq_offset);
5501 * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5502 * @chan: struct ieee80211_channel to convert
5503 * Return: The corresponding frequency (in KHz)
5506 ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5508 return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5512 * ieee80211_s1g_channel_width - get allowed channel width from @chan
5514 * Only allowed for band NL80211_BAND_S1GHZ
5516 * Return: The allowed channel width for this center_freq
5518 enum nl80211_chan_width
5519 ieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
5522 * ieee80211_channel_to_freq_khz - convert channel number to frequency
5523 * @chan: channel number
5524 * @band: band, necessary due to channel number overlap
5525 * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5527 u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5530 * ieee80211_channel_to_frequency - convert channel number to frequency
5531 * @chan: channel number
5532 * @band: band, necessary due to channel number overlap
5533 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5536 ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5538 return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5542 * ieee80211_freq_khz_to_channel - convert frequency to channel number
5543 * @freq: center frequency in KHz
5544 * Return: The corresponding channel, or 0 if the conversion failed.
5546 int ieee80211_freq_khz_to_channel(u32 freq);
5549 * ieee80211_frequency_to_channel - convert frequency to channel number
5550 * @freq: center frequency in MHz
5551 * Return: The corresponding channel, or 0 if the conversion failed.
5554 ieee80211_frequency_to_channel(int freq)
5556 return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5560 * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5562 * @wiphy: the struct wiphy to get the channel for
5563 * @freq: the center frequency (in KHz) of the channel
5564 * Return: The channel struct from @wiphy at @freq.
5566 struct ieee80211_channel *
5567 ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5570 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5572 * @wiphy: the struct wiphy to get the channel for
5573 * @freq: the center frequency (in MHz) of the channel
5574 * Return: The channel struct from @wiphy at @freq.
5576 static inline struct ieee80211_channel *
5577 ieee80211_get_channel(struct wiphy *wiphy, int freq)
5579 return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5583 * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5584 * @chan: control channel to check
5586 * The Preferred Scanning Channels (PSC) are defined in
5587 * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5589 static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5591 if (chan->band != NL80211_BAND_6GHZ)
5594 return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5598 * ieee80211_get_response_rate - get basic rate for a given rate
5600 * @sband: the band to look for rates in
5601 * @basic_rates: bitmap of basic rates
5602 * @bitrate: the bitrate for which to find the basic rate
5604 * Return: The basic rate corresponding to a given bitrate, that
5605 * is the next lower bitrate contained in the basic rate map,
5606 * which is, for this function, given as a bitmap of indices of
5607 * rates in the band's bitrate table.
5609 struct ieee80211_rate *
5610 ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5611 u32 basic_rates, int bitrate);
5614 * ieee80211_mandatory_rates - get mandatory rates for a given band
5615 * @sband: the band to look for rates in
5616 * @scan_width: width of the control channel
5618 * This function returns a bitmap of the mandatory rates for the given
5619 * band, bits are set according to the rate position in the bitrates array.
5621 u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
5622 enum nl80211_bss_scan_width scan_width);
5625 * Radiotap parsing functions -- for controlled injection support
5627 * Implemented in net/wireless/radiotap.c
5628 * Documentation in Documentation/networking/radiotap-headers.rst
5631 struct radiotap_align_size {
5632 uint8_t align:4, size:4;
5635 struct ieee80211_radiotap_namespace {
5636 const struct radiotap_align_size *align_size;
5642 struct ieee80211_radiotap_vendor_namespaces {
5643 const struct ieee80211_radiotap_namespace *ns;
5648 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
5649 * @this_arg_index: index of current arg, valid after each successful call
5650 * to ieee80211_radiotap_iterator_next()
5651 * @this_arg: pointer to current radiotap arg; it is valid after each
5652 * call to ieee80211_radiotap_iterator_next() but also after
5653 * ieee80211_radiotap_iterator_init() where it will point to
5654 * the beginning of the actual data portion
5655 * @this_arg_size: length of the current arg, for convenience
5656 * @current_namespace: pointer to the current namespace definition
5657 * (or internally %NULL if the current namespace is unknown)
5658 * @is_radiotap_ns: indicates whether the current namespace is the default
5659 * radiotap namespace or not
5661 * @_rtheader: pointer to the radiotap header we are walking through
5662 * @_max_length: length of radiotap header in cpu byte ordering
5663 * @_arg_index: next argument index
5664 * @_arg: next argument pointer
5665 * @_next_bitmap: internal pointer to next present u32
5666 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
5667 * @_vns: vendor namespace definitions
5668 * @_next_ns_data: beginning of the next namespace's data
5669 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
5672 * Describes the radiotap parser state. Fields prefixed with an underscore
5673 * must not be used by users of the parser, only by the parser internally.
5676 struct ieee80211_radiotap_iterator {
5677 struct ieee80211_radiotap_header *_rtheader;
5678 const struct ieee80211_radiotap_vendor_namespaces *_vns;
5679 const struct ieee80211_radiotap_namespace *current_namespace;
5681 unsigned char *_arg, *_next_ns_data;
5682 __le32 *_next_bitmap;
5684 unsigned char *this_arg;
5692 uint32_t _bitmap_shifter;
5697 ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5698 struct ieee80211_radiotap_header *radiotap_header,
5700 const struct ieee80211_radiotap_vendor_namespaces *vns);
5703 ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5706 extern const unsigned char rfc1042_header[6];
5707 extern const unsigned char bridge_tunnel_header[6];
5710 * ieee80211_get_hdrlen_from_skb - get header length from data
5714 * Given an skb with a raw 802.11 header at the data pointer this function
5715 * returns the 802.11 header length.
5717 * Return: The 802.11 header length in bytes (not including encryption
5718 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
5721 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5724 * ieee80211_hdrlen - get header length in bytes from frame control
5725 * @fc: frame control field in little-endian format
5726 * Return: The header length in bytes.
5728 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5731 * ieee80211_get_mesh_hdrlen - get mesh extension header length
5732 * @meshhdr: the mesh extension header, only the flags field
5733 * (first byte) will be accessed
5734 * Return: The length of the extension header, which is always at
5735 * least 6 bytes and at most 18 if address 5 and 6 are present.
5737 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
5740 * DOC: Data path helpers
5742 * In addition to generic utilities, cfg80211 also offers
5743 * functions that help implement the data path for devices
5744 * that do not do the 802.11/802.3 conversion on the device.
5748 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
5749 * @skb: the 802.11 data frame
5750 * @ehdr: pointer to a &struct ethhdr that will get the header, instead
5751 * of it being pushed into the SKB
5752 * @addr: the device MAC address
5753 * @iftype: the virtual interface type
5754 * @data_offset: offset of payload after the 802.11 header
5755 * Return: 0 on success. Non-zero on error.
5757 int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
5758 const u8 *addr, enum nl80211_iftype iftype,
5762 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5763 * @skb: the 802.11 data frame
5764 * @addr: the device MAC address
5765 * @iftype: the virtual interface type
5766 * Return: 0 on success. Non-zero on error.
5768 static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
5769 enum nl80211_iftype iftype)
5771 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
5775 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5777 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
5778 * The @list will be empty if the decode fails. The @skb must be fully
5779 * header-less before being passed in here; it is freed in this function.
5781 * @skb: The input A-MSDU frame without any headers.
5782 * @list: The output list of 802.3 frames. It must be allocated and
5783 * initialized by the caller.
5784 * @addr: The device MAC address.
5785 * @iftype: The device interface type.
5786 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
5787 * @check_da: DA to check in the inner ethernet header, or NULL
5788 * @check_sa: SA to check in the inner ethernet header, or NULL
5790 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5791 const u8 *addr, enum nl80211_iftype iftype,
5792 const unsigned int extra_headroom,
5793 const u8 *check_da, const u8 *check_sa);
5796 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5797 * @skb: the data frame
5798 * @qos_map: Interworking QoS mapping or %NULL if not in use
5799 * Return: The 802.1p/1d tag.
5801 unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5802 struct cfg80211_qos_map *qos_map);
5805 * cfg80211_find_elem_match - match information element and byte array in data
5808 * @ies: data consisting of IEs
5809 * @len: length of data
5810 * @match: byte array to match
5811 * @match_len: number of bytes in the match array
5812 * @match_offset: offset in the IE data where the byte array should match.
5813 * Note the difference to cfg80211_find_ie_match() which considers
5814 * the offset to start from the element ID byte, but here we take
5815 * the data portion instead.
5817 * Return: %NULL if the element ID could not be found or if
5818 * the element is invalid (claims to be longer than the given
5819 * data) or if the byte array doesn't match; otherwise return the
5820 * requested element struct.
5822 * Note: There are no checks on the element length other than
5823 * having to fit into the given data and being large enough for the
5824 * byte array to match.
5826 const struct element *
5827 cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
5828 const u8 *match, unsigned int match_len,
5829 unsigned int match_offset);
5832 * cfg80211_find_ie_match - match information element and byte array in data
5835 * @ies: data consisting of IEs
5836 * @len: length of data
5837 * @match: byte array to match
5838 * @match_len: number of bytes in the match array
5839 * @match_offset: offset in the IE where the byte array should match.
5840 * If match_len is zero, this must also be set to zero.
5841 * Otherwise this must be set to 2 or more, because the first
5842 * byte is the element id, which is already compared to eid, and
5843 * the second byte is the IE length.
5845 * Return: %NULL if the element ID could not be found or if
5846 * the element is invalid (claims to be longer than the given
5847 * data) or if the byte array doesn't match, or a pointer to the first
5848 * byte of the requested element, that is the byte containing the
5851 * Note: There are no checks on the element length other than
5852 * having to fit into the given data and being large enough for the
5853 * byte array to match.
5855 static inline const u8 *
5856 cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
5857 const u8 *match, unsigned int match_len,
5858 unsigned int match_offset)
5860 /* match_offset can't be smaller than 2, unless match_len is
5861 * zero, in which case match_offset must be zero as well.
5863 if (WARN_ON((match_len && match_offset < 2) ||
5864 (!match_len && match_offset)))
5867 return (void *)cfg80211_find_elem_match(eid, ies, len,
5870 match_offset - 2 : 0);
5874 * cfg80211_find_elem - find information element in data
5877 * @ies: data consisting of IEs
5878 * @len: length of data
5880 * Return: %NULL if the element ID could not be found or if
5881 * the element is invalid (claims to be longer than the given
5882 * data) or if the byte array doesn't match; otherwise return the
5883 * requested element struct.
5885 * Note: There are no checks on the element length other than
5886 * having to fit into the given data.
5888 static inline const struct element *
5889 cfg80211_find_elem(u8 eid, const u8 *ies, int len)
5891 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
5895 * cfg80211_find_ie - find information element in data
5898 * @ies: data consisting of IEs
5899 * @len: length of data
5901 * Return: %NULL if the element ID could not be found or if
5902 * the element is invalid (claims to be longer than the given
5903 * data), or a pointer to the first byte of the requested
5904 * element, that is the byte containing the element ID.
5906 * Note: There are no checks on the element length other than
5907 * having to fit into the given data.
5909 static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5911 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5915 * cfg80211_find_ext_elem - find information element with EID Extension in data
5917 * @ext_eid: element ID Extension
5918 * @ies: data consisting of IEs
5919 * @len: length of data
5921 * Return: %NULL if the etended element could not be found or if
5922 * the element is invalid (claims to be longer than the given
5923 * data) or if the byte array doesn't match; otherwise return the
5924 * requested element struct.
5926 * Note: There are no checks on the element length other than
5927 * having to fit into the given data.
5929 static inline const struct element *
5930 cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
5932 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
5937 * cfg80211_find_ext_ie - find information element with EID Extension in data
5939 * @ext_eid: element ID Extension
5940 * @ies: data consisting of IEs
5941 * @len: length of data
5943 * Return: %NULL if the extended element ID could not be found or if
5944 * the element is invalid (claims to be longer than the given
5945 * data), or a pointer to the first byte of the requested
5946 * element, that is the byte containing the element ID.
5948 * Note: There are no checks on the element length other than
5949 * having to fit into the given data.
5951 static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
5953 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
5958 * cfg80211_find_vendor_elem - find vendor specific information element in data
5961 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5962 * @ies: data consisting of IEs
5963 * @len: length of data
5965 * Return: %NULL if the vendor specific element ID could not be found or if the
5966 * element is invalid (claims to be longer than the given data); otherwise
5967 * return the element structure for the requested element.
5969 * Note: There are no checks on the element length other than having to fit into
5972 const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
5977 * cfg80211_find_vendor_ie - find vendor specific information element in data
5980 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5981 * @ies: data consisting of IEs
5982 * @len: length of data
5984 * Return: %NULL if the vendor specific element ID could not be found or if the
5985 * element is invalid (claims to be longer than the given data), or a pointer to
5986 * the first byte of the requested element, that is the byte containing the
5989 * Note: There are no checks on the element length other than having to fit into
5992 static inline const u8 *
5993 cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
5994 const u8 *ies, unsigned int len)
5996 return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
6000 * cfg80211_send_layer2_update - send layer 2 update frame
6002 * @dev: network device
6003 * @addr: STA MAC address
6005 * Wireless drivers can use this function to update forwarding tables in bridge
6006 * devices upon STA association.
6008 void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
6011 * DOC: Regulatory enforcement infrastructure
6017 * regulatory_hint - driver hint to the wireless core a regulatory domain
6018 * @wiphy: the wireless device giving the hint (used only for reporting
6020 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
6021 * should be in. If @rd is set this should be NULL. Note that if you
6022 * set this to NULL you should still set rd->alpha2 to some accepted
6025 * Wireless drivers can use this function to hint to the wireless core
6026 * what it believes should be the current regulatory domain by
6027 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
6028 * domain should be in or by providing a completely build regulatory domain.
6029 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
6030 * for a regulatory domain structure for the respective country.
6032 * The wiphy must have been registered to cfg80211 prior to this call.
6033 * For cfg80211 drivers this means you must first use wiphy_register(),
6034 * for mac80211 drivers you must first use ieee80211_register_hw().
6036 * Drivers should check the return value, its possible you can get
6039 * Return: 0 on success. -ENOMEM.
6041 int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
6044 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
6045 * @wiphy: the wireless device we want to process the regulatory domain on
6046 * @rd: the regulatory domain informatoin to use for this wiphy
6048 * Set the regulatory domain information for self-managed wiphys, only they
6049 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
6052 * Return: 0 on success. -EINVAL, -EPERM
6054 int regulatory_set_wiphy_regd(struct wiphy *wiphy,
6055 struct ieee80211_regdomain *rd);
6058 * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
6059 * @wiphy: the wireless device we want to process the regulatory domain on
6060 * @rd: the regulatory domain information to use for this wiphy
6062 * This functions requires the RTNL and the wiphy mutex to be held and
6063 * applies the new regdomain synchronously to this wiphy. For more details
6064 * see regulatory_set_wiphy_regd().
6066 * Return: 0 on success. -EINVAL, -EPERM
6068 int regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
6069 struct ieee80211_regdomain *rd);
6072 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
6073 * @wiphy: the wireless device we want to process the regulatory domain on
6074 * @regd: the custom regulatory domain to use for this wiphy
6076 * Drivers can sometimes have custom regulatory domains which do not apply
6077 * to a specific country. Drivers can use this to apply such custom regulatory
6078 * domains. This routine must be called prior to wiphy registration. The
6079 * custom regulatory domain will be trusted completely and as such previous
6080 * default channel settings will be disregarded. If no rule is found for a
6081 * channel on the regulatory domain the channel will be disabled.
6082 * Drivers using this for a wiphy should also set the wiphy flag
6083 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
6084 * that called this helper.
6086 void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
6087 const struct ieee80211_regdomain *regd);
6090 * freq_reg_info - get regulatory information for the given frequency
6091 * @wiphy: the wiphy for which we want to process this rule for
6092 * @center_freq: Frequency in KHz for which we want regulatory information for
6094 * Use this function to get the regulatory rule for a specific frequency on
6095 * a given wireless device. If the device has a specific regulatory domain
6096 * it wants to follow we respect that unless a country IE has been received
6097 * and processed already.
6099 * Return: A valid pointer, or, when an error occurs, for example if no rule
6100 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
6101 * check and PTR_ERR() to obtain the numeric return value. The numeric return
6102 * value will be -ERANGE if we determine the given center_freq does not even
6103 * have a regulatory rule for a frequency range in the center_freq's band.
6104 * See freq_in_rule_band() for our current definition of a band -- this is
6105 * purely subjective and right now it's 802.11 specific.
6107 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
6111 * reg_initiator_name - map regulatory request initiator enum to name
6112 * @initiator: the regulatory request initiator
6114 * You can use this to map the regulatory request initiator enum to a
6115 * proper string representation.
6117 const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
6120 * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
6121 * @wiphy: wiphy for which pre-CAC capability is checked.
6123 * Pre-CAC is allowed only in some regdomains (notable ETSI).
6125 bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
6128 * DOC: Internal regulatory db functions
6133 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
6134 * Regulatory self-managed driver can use it to proactively
6136 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
6137 * @freq: the freqency(in MHz) to be queried.
6138 * @rule: pointer to store the wmm rule from the regulatory db.
6140 * Self-managed wireless drivers can use this function to query
6141 * the internal regulatory database to check whether the given
6142 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
6144 * Drivers should check the return value, its possible you can get
6147 * Return: 0 on success. -ENODATA.
6149 int reg_query_regdb_wmm(char *alpha2, int freq,
6150 struct ieee80211_reg_rule *rule);
6153 * callbacks for asynchronous cfg80211 methods, notification
6154 * functions and BSS handling helpers
6158 * cfg80211_scan_done - notify that scan finished
6160 * @request: the corresponding scan request
6161 * @info: information about the completed scan
6163 void cfg80211_scan_done(struct cfg80211_scan_request *request,
6164 struct cfg80211_scan_info *info);
6167 * cfg80211_sched_scan_results - notify that new scan results are available
6169 * @wiphy: the wiphy which got scheduled scan results
6170 * @reqid: identifier for the related scheduled scan request
6172 void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
6175 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
6177 * @wiphy: the wiphy on which the scheduled scan stopped
6178 * @reqid: identifier for the related scheduled scan request
6180 * The driver can call this function to inform cfg80211 that the
6181 * scheduled scan had to be stopped, for whatever reason. The driver
6182 * is then called back via the sched_scan_stop operation when done.
6184 void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
6187 * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
6189 * @wiphy: the wiphy on which the scheduled scan stopped
6190 * @reqid: identifier for the related scheduled scan request
6192 * The driver can call this function to inform cfg80211 that the
6193 * scheduled scan had to be stopped, for whatever reason. The driver
6194 * is then called back via the sched_scan_stop operation when done.
6195 * This function should be called with the wiphy mutex held.
6197 void cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
6200 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
6201 * @wiphy: the wiphy reporting the BSS
6202 * @data: the BSS metadata
6203 * @mgmt: the management frame (probe response or beacon)
6204 * @len: length of the management frame
6205 * @gfp: context flags
6207 * This informs cfg80211 that BSS information was found and
6208 * the BSS should be updated/added.
6210 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6211 * Or %NULL on error.
6213 struct cfg80211_bss * __must_check
6214 cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
6215 struct cfg80211_inform_bss *data,
6216 struct ieee80211_mgmt *mgmt, size_t len,
6219 static inline struct cfg80211_bss * __must_check
6220 cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
6221 struct ieee80211_channel *rx_channel,
6222 enum nl80211_bss_scan_width scan_width,
6223 struct ieee80211_mgmt *mgmt, size_t len,
6224 s32 signal, gfp_t gfp)
6226 struct cfg80211_inform_bss data = {
6228 .scan_width = scan_width,
6232 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6235 static inline struct cfg80211_bss * __must_check
6236 cfg80211_inform_bss_frame(struct wiphy *wiphy,
6237 struct ieee80211_channel *rx_channel,
6238 struct ieee80211_mgmt *mgmt, size_t len,
6239 s32 signal, gfp_t gfp)
6241 struct cfg80211_inform_bss data = {
6243 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6247 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
6251 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
6252 * @bssid: transmitter BSSID
6253 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
6254 * @mbssid_index: BSSID index, taken from Multiple BSSID index element
6255 * @new_bssid: calculated nontransmitted BSSID
6257 static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
6258 u8 mbssid_index, u8 *new_bssid)
6260 u64 bssid_u64 = ether_addr_to_u64(bssid);
6261 u64 mask = GENMASK_ULL(max_bssid - 1, 0);
6264 new_bssid_u64 = bssid_u64 & ~mask;
6266 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
6268 u64_to_ether_addr(new_bssid_u64, new_bssid);
6272 * cfg80211_is_element_inherited - returns if element ID should be inherited
6273 * @element: element to check
6274 * @non_inherit_element: non inheritance element
6276 bool cfg80211_is_element_inherited(const struct element *element,
6277 const struct element *non_inherit_element);
6280 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
6282 * @ielen: length of IEs
6283 * @mbssid_elem: current MBSSID element
6284 * @sub_elem: current MBSSID subelement (profile)
6285 * @merged_ie: location of the merged profile
6286 * @max_copy_len: max merged profile length
6288 size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
6289 const struct element *mbssid_elem,
6290 const struct element *sub_elem,
6291 u8 *merged_ie, size_t max_copy_len);
6294 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
6295 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
6296 * from a beacon or probe response
6297 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
6298 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
6300 enum cfg80211_bss_frame_type {
6301 CFG80211_BSS_FTYPE_UNKNOWN,
6302 CFG80211_BSS_FTYPE_BEACON,
6303 CFG80211_BSS_FTYPE_PRESP,
6307 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6309 * @wiphy: the wiphy reporting the BSS
6310 * @data: the BSS metadata
6311 * @ftype: frame type (if known)
6312 * @bssid: the BSSID of the BSS
6313 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6314 * @capability: the capability field sent by the peer
6315 * @beacon_interval: the beacon interval announced by the peer
6316 * @ie: additional IEs sent by the peer
6317 * @ielen: length of the additional IEs
6318 * @gfp: context flags
6320 * This informs cfg80211 that BSS information was found and
6321 * the BSS should be updated/added.
6323 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6324 * Or %NULL on error.
6326 struct cfg80211_bss * __must_check
6327 cfg80211_inform_bss_data(struct wiphy *wiphy,
6328 struct cfg80211_inform_bss *data,
6329 enum cfg80211_bss_frame_type ftype,
6330 const u8 *bssid, u64 tsf, u16 capability,
6331 u16 beacon_interval, const u8 *ie, size_t ielen,
6334 static inline struct cfg80211_bss * __must_check
6335 cfg80211_inform_bss_width(struct wiphy *wiphy,
6336 struct ieee80211_channel *rx_channel,
6337 enum nl80211_bss_scan_width scan_width,
6338 enum cfg80211_bss_frame_type ftype,
6339 const u8 *bssid, u64 tsf, u16 capability,
6340 u16 beacon_interval, const u8 *ie, size_t ielen,
6341 s32 signal, gfp_t gfp)
6343 struct cfg80211_inform_bss data = {
6345 .scan_width = scan_width,
6349 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6350 capability, beacon_interval, ie, ielen,
6354 static inline struct cfg80211_bss * __must_check
6355 cfg80211_inform_bss(struct wiphy *wiphy,
6356 struct ieee80211_channel *rx_channel,
6357 enum cfg80211_bss_frame_type ftype,
6358 const u8 *bssid, u64 tsf, u16 capability,
6359 u16 beacon_interval, const u8 *ie, size_t ielen,
6360 s32 signal, gfp_t gfp)
6362 struct cfg80211_inform_bss data = {
6364 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6368 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6369 capability, beacon_interval, ie, ielen,
6374 * cfg80211_get_bss - get a BSS reference
6375 * @wiphy: the wiphy this BSS struct belongs to
6376 * @channel: the channel to search on (or %NULL)
6377 * @bssid: the desired BSSID (or %NULL)
6378 * @ssid: the desired SSID (or %NULL)
6379 * @ssid_len: length of the SSID (or 0)
6380 * @bss_type: type of BSS, see &enum ieee80211_bss_type
6381 * @privacy: privacy filter, see &enum ieee80211_privacy
6383 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
6384 struct ieee80211_channel *channel,
6386 const u8 *ssid, size_t ssid_len,
6387 enum ieee80211_bss_type bss_type,
6388 enum ieee80211_privacy privacy);
6389 static inline struct cfg80211_bss *
6390 cfg80211_get_ibss(struct wiphy *wiphy,
6391 struct ieee80211_channel *channel,
6392 const u8 *ssid, size_t ssid_len)
6394 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
6395 IEEE80211_BSS_TYPE_IBSS,
6396 IEEE80211_PRIVACY_ANY);
6400 * cfg80211_ref_bss - reference BSS struct
6401 * @wiphy: the wiphy this BSS struct belongs to
6402 * @bss: the BSS struct to reference
6404 * Increments the refcount of the given BSS struct.
6406 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6409 * cfg80211_put_bss - unref BSS struct
6410 * @wiphy: the wiphy this BSS struct belongs to
6411 * @bss: the BSS struct
6413 * Decrements the refcount of the given BSS struct.
6415 void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6418 * cfg80211_unlink_bss - unlink BSS from internal data structures
6420 * @bss: the bss to remove
6422 * This function removes the given BSS from the internal data structures
6423 * thereby making it no longer show up in scan results etc. Use this
6424 * function when you detect a BSS is gone. Normally BSSes will also time
6425 * out, so it is not necessary to use this function at all.
6427 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6430 * cfg80211_bss_iter - iterate all BSS entries
6432 * This function iterates over the BSS entries associated with the given wiphy
6433 * and calls the callback for the iterated BSS. The iterator function is not
6434 * allowed to call functions that might modify the internal state of the BSS DB.
6437 * @chandef: if given, the iterator function will be called only if the channel
6438 * of the currently iterated BSS is a subset of the given channel.
6439 * @iter: the iterator function to call
6440 * @iter_data: an argument to the iterator function
6442 void cfg80211_bss_iter(struct wiphy *wiphy,
6443 struct cfg80211_chan_def *chandef,
6444 void (*iter)(struct wiphy *wiphy,
6445 struct cfg80211_bss *bss,
6449 static inline enum nl80211_bss_scan_width
6450 cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6452 switch (chandef->width) {
6453 case NL80211_CHAN_WIDTH_5:
6454 return NL80211_BSS_CHAN_WIDTH_5;
6455 case NL80211_CHAN_WIDTH_10:
6456 return NL80211_BSS_CHAN_WIDTH_10;
6458 return NL80211_BSS_CHAN_WIDTH_20;
6463 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
6464 * @dev: network device
6465 * @buf: authentication frame (header + body)
6466 * @len: length of the frame data
6468 * This function is called whenever an authentication, disassociation or
6469 * deauthentication frame has been received and processed in station mode.
6470 * After being asked to authenticate via cfg80211_ops::auth() the driver must
6471 * call either this function or cfg80211_auth_timeout().
6472 * After being asked to associate via cfg80211_ops::assoc() the driver must
6473 * call either this function or cfg80211_auth_timeout().
6474 * While connected, the driver must calls this for received and processed
6475 * disassociation and deauthentication frames. If the frame couldn't be used
6476 * because it was unprotected, the driver must call the function
6477 * cfg80211_rx_unprot_mlme_mgmt() instead.
6479 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6481 void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6484 * cfg80211_auth_timeout - notification of timed out authentication
6485 * @dev: network device
6486 * @addr: The MAC address of the device with which the authentication timed out
6488 * This function may sleep. The caller must hold the corresponding wdev's
6491 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
6494 * cfg80211_rx_assoc_resp - notification of processed association response
6495 * @dev: network device
6496 * @bss: the BSS that association was requested with, ownership of the pointer
6497 * moves to cfg80211 in this call
6498 * @buf: (Re)Association Response frame (header + body)
6499 * @len: length of the frame data
6500 * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6501 * as the AC bitmap in the QoS info field
6502 * @req_ies: information elements from the (Re)Association Request frame
6503 * @req_ies_len: length of req_ies data
6505 * After being asked to associate via cfg80211_ops::assoc() the driver must
6506 * call either this function or cfg80211_auth_timeout().
6508 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6510 void cfg80211_rx_assoc_resp(struct net_device *dev,
6511 struct cfg80211_bss *bss,
6512 const u8 *buf, size_t len,
6514 const u8 *req_ies, size_t req_ies_len);
6517 * cfg80211_assoc_timeout - notification of timed out association
6518 * @dev: network device
6519 * @bss: The BSS entry with which association timed out.
6521 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6523 void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
6526 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6527 * @dev: network device
6528 * @bss: The BSS entry with which association was abandoned.
6530 * Call this whenever - for reasons reported through other API, like deauth RX,
6531 * an association attempt was abandoned.
6532 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6534 void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6537 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
6538 * @dev: network device
6539 * @buf: 802.11 frame (header + body)
6540 * @len: length of the frame data
6541 * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
6543 * This function is called whenever deauthentication has been processed in
6544 * station mode. This includes both received deauthentication frames and
6545 * locally generated ones. This function may sleep. The caller must hold the
6546 * corresponding wdev's mutex.
6548 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
6552 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6553 * @dev: network device
6554 * @buf: received management frame (header + body)
6555 * @len: length of the frame data
6557 * This function is called whenever a received deauthentication or dissassoc
6558 * frame has been dropped in station mode because of MFP being used but the
6559 * frame was not protected. This is also used to notify reception of a Beacon
6560 * frame that was dropped because it did not include a valid MME MIC while
6561 * beacon protection was enabled (BIGTK configured in station mode).
6563 * This function may sleep.
6565 void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
6566 const u8 *buf, size_t len);
6569 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6570 * @dev: network device
6571 * @addr: The source MAC address of the frame
6572 * @key_type: The key type that the received frame used
6573 * @key_id: Key identifier (0..3). Can be -1 if missing.
6574 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6575 * @gfp: allocation flags
6577 * This function is called whenever the local MAC detects a MIC failure in a
6578 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6581 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6582 enum nl80211_key_type key_type, int key_id,
6583 const u8 *tsc, gfp_t gfp);
6586 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
6588 * @dev: network device
6589 * @bssid: the BSSID of the IBSS joined
6590 * @channel: the channel of the IBSS joined
6591 * @gfp: allocation flags
6593 * This function notifies cfg80211 that the device joined an IBSS or
6594 * switched to a different BSSID. Before this function can be called,
6595 * either a beacon has to have been received from the IBSS, or one of
6596 * the cfg80211_inform_bss{,_frame} functions must have been called
6597 * with the locally generated beacon -- this guarantees that there is
6598 * always a scan result for this IBSS. cfg80211 will handle the rest.
6600 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6601 struct ieee80211_channel *channel, gfp_t gfp);
6604 * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
6607 * @dev: network device
6608 * @macaddr: the MAC address of the new candidate
6609 * @ie: information elements advertised by the peer candidate
6610 * @ie_len: length of the information elements buffer
6611 * @gfp: allocation flags
6613 * This function notifies cfg80211 that the mesh peer candidate has been
6614 * detected, most likely via a beacon or, less likely, via a probe response.
6615 * cfg80211 then sends a notification to userspace.
6617 void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6618 const u8 *macaddr, const u8 *ie, u8 ie_len,
6619 int sig_dbm, gfp_t gfp);
6622 * DOC: RFkill integration
6624 * RFkill integration in cfg80211 is almost invisible to drivers,
6625 * as cfg80211 automatically registers an rfkill instance for each
6626 * wireless device it knows about. Soft kill is also translated
6627 * into disconnecting and turning all interfaces off, drivers are
6628 * expected to turn off the device when all interfaces are down.
6630 * However, devices may have a hard RFkill line, in which case they
6631 * also need to interact with the rfkill subsystem, via cfg80211.
6632 * They can do this with a few helper functions documented here.
6636 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
6638 * @blocked: block status
6640 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
6643 * wiphy_rfkill_start_polling - start polling rfkill
6646 void wiphy_rfkill_start_polling(struct wiphy *wiphy);
6649 * wiphy_rfkill_stop_polling - stop polling rfkill
6652 void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
6655 * DOC: Vendor commands
6657 * Occasionally, there are special protocol or firmware features that
6658 * can't be implemented very openly. For this and similar cases, the
6659 * vendor command functionality allows implementing the features with
6660 * (typically closed-source) userspace and firmware, using nl80211 as
6661 * the configuration mechanism.
6663 * A driver supporting vendor commands must register them as an array
6664 * in struct wiphy, with handlers for each one, each command has an
6665 * OUI and sub command ID to identify it.
6667 * Note that this feature should not be (ab)used to implement protocol
6668 * features that could openly be shared across drivers. In particular,
6669 * it must never be required to use vendor commands to implement any
6670 * "normal" functionality that higher-level userspace like connection
6671 * managers etc. need.
6674 struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6675 enum nl80211_commands cmd,
6676 enum nl80211_attrs attr,
6679 struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
6680 struct wireless_dev *wdev,
6681 enum nl80211_commands cmd,
6682 enum nl80211_attrs attr,
6683 unsigned int portid,
6684 int vendor_event_idx,
6685 int approxlen, gfp_t gfp);
6687 void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6690 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6692 * @approxlen: an upper bound of the length of the data that will
6693 * be put into the skb
6695 * This function allocates and pre-fills an skb for a reply to
6696 * a vendor command. Since it is intended for a reply, calling
6697 * it outside of a vendor command's doit() operation is invalid.
6699 * The returned skb is pre-filled with some identifying data in
6700 * a way that any data that is put into the skb (with skb_put(),
6701 * nla_put() or similar) will end up being within the
6702 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6703 * with the skb is adding data for the corresponding userspace tool
6704 * which can then read that data out of the vendor data attribute.
6705 * You must not modify the skb in any other way.
6707 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6708 * its error code as the result of the doit() operation.
6710 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6712 static inline struct sk_buff *
6713 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6715 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6716 NL80211_ATTR_VENDOR_DATA, approxlen);
6720 * cfg80211_vendor_cmd_reply - send the reply skb
6721 * @skb: The skb, must have been allocated with
6722 * cfg80211_vendor_cmd_alloc_reply_skb()
6724 * Since calling this function will usually be the last thing
6725 * before returning from the vendor command doit() you should
6726 * return the error code. Note that this function consumes the
6727 * skb regardless of the return value.
6729 * Return: An error code or 0 on success.
6731 int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6734 * cfg80211_vendor_cmd_get_sender
6737 * Return the current netlink port ID in a vendor command handler.
6738 * Valid to call only there.
6740 unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
6743 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6745 * @wdev: the wireless device
6746 * @event_idx: index of the vendor event in the wiphy's vendor_events
6747 * @approxlen: an upper bound of the length of the data that will
6748 * be put into the skb
6749 * @gfp: allocation flags
6751 * This function allocates and pre-fills an skb for an event on the
6752 * vendor-specific multicast group.
6754 * If wdev != NULL, both the ifindex and identifier of the specified
6755 * wireless device are added to the event message before the vendor data
6758 * When done filling the skb, call cfg80211_vendor_event() with the
6759 * skb to send the event.
6761 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6763 static inline struct sk_buff *
6764 cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
6765 int approxlen, int event_idx, gfp_t gfp)
6767 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6768 NL80211_ATTR_VENDOR_DATA,
6769 0, event_idx, approxlen, gfp);
6773 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
6775 * @wdev: the wireless device
6776 * @event_idx: index of the vendor event in the wiphy's vendor_events
6777 * @portid: port ID of the receiver
6778 * @approxlen: an upper bound of the length of the data that will
6779 * be put into the skb
6780 * @gfp: allocation flags
6782 * This function allocates and pre-fills an skb for an event to send to
6783 * a specific (userland) socket. This socket would previously have been
6784 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
6785 * care to register a netlink notifier to see when the socket closes.
6787 * If wdev != NULL, both the ifindex and identifier of the specified
6788 * wireless device are added to the event message before the vendor data
6791 * When done filling the skb, call cfg80211_vendor_event() with the
6792 * skb to send the event.
6794 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6796 static inline struct sk_buff *
6797 cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
6798 struct wireless_dev *wdev,
6799 unsigned int portid, int approxlen,
6800 int event_idx, gfp_t gfp)
6802 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6803 NL80211_ATTR_VENDOR_DATA,
6804 portid, event_idx, approxlen, gfp);
6808 * cfg80211_vendor_event - send the event
6809 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6810 * @gfp: allocation flags
6812 * This function sends the given @skb, which must have been allocated
6813 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6815 static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6817 __cfg80211_send_event_skb(skb, gfp);
6820 #ifdef CONFIG_NL80211_TESTMODE
6824 * Test mode is a set of utility functions to allow drivers to
6825 * interact with driver-specific tools to aid, for instance,
6826 * factory programming.
6828 * This chapter describes how drivers interact with it, for more
6829 * information see the nl80211 book's chapter on it.
6833 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6835 * @approxlen: an upper bound of the length of the data that will
6836 * be put into the skb
6838 * This function allocates and pre-fills an skb for a reply to
6839 * the testmode command. Since it is intended for a reply, calling
6840 * it outside of the @testmode_cmd operation is invalid.
6842 * The returned skb is pre-filled with the wiphy index and set up in
6843 * a way that any data that is put into the skb (with skb_put(),
6844 * nla_put() or similar) will end up being within the
6845 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
6846 * with the skb is adding data for the corresponding userspace tool
6847 * which can then read that data out of the testdata attribute. You
6848 * must not modify the skb in any other way.
6850 * When done, call cfg80211_testmode_reply() with the skb and return
6851 * its error code as the result of the @testmode_cmd operation.
6853 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6855 static inline struct sk_buff *
6856 cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6858 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6859 NL80211_ATTR_TESTDATA, approxlen);
6863 * cfg80211_testmode_reply - send the reply skb
6864 * @skb: The skb, must have been allocated with
6865 * cfg80211_testmode_alloc_reply_skb()
6867 * Since calling this function will usually be the last thing
6868 * before returning from the @testmode_cmd you should return
6869 * the error code. Note that this function consumes the skb
6870 * regardless of the return value.
6872 * Return: An error code or 0 on success.
6874 static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6876 return cfg80211_vendor_cmd_reply(skb);
6880 * cfg80211_testmode_alloc_event_skb - allocate testmode event
6882 * @approxlen: an upper bound of the length of the data that will
6883 * be put into the skb
6884 * @gfp: allocation flags
6886 * This function allocates and pre-fills an skb for an event on the
6887 * testmode multicast group.
6889 * The returned skb is set up in the same way as with
6890 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
6891 * there, you should simply add data to it that will then end up in the
6892 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
6895 * When done filling the skb, call cfg80211_testmode_event() with the
6896 * skb to send the event.
6898 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6900 static inline struct sk_buff *
6901 cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6903 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
6904 NL80211_ATTR_TESTDATA, 0, -1,
6909 * cfg80211_testmode_event - send the event
6910 * @skb: The skb, must have been allocated with
6911 * cfg80211_testmode_alloc_event_skb()
6912 * @gfp: allocation flags
6914 * This function sends the given @skb, which must have been allocated
6915 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6918 static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6920 __cfg80211_send_event_skb(skb, gfp);
6923 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
6924 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
6926 #define CFG80211_TESTMODE_CMD(cmd)
6927 #define CFG80211_TESTMODE_DUMP(cmd)
6931 * struct cfg80211_fils_resp_params - FILS connection response params
6932 * @kek: KEK derived from a successful FILS connection (may be %NULL)
6933 * @kek_len: Length of @fils_kek in octets
6934 * @update_erp_next_seq_num: Boolean value to specify whether the value in
6935 * @erp_next_seq_num is valid.
6936 * @erp_next_seq_num: The next sequence number to use in ERP message in
6937 * FILS Authentication. This value should be specified irrespective of the
6938 * status for a FILS connection.
6939 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
6940 * @pmk_len: Length of @pmk in octets
6941 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
6942 * used for this FILS connection (may be %NULL).
6944 struct cfg80211_fils_resp_params {
6947 bool update_erp_next_seq_num;
6948 u16 erp_next_seq_num;
6955 * struct cfg80211_connect_resp_params - Connection response params
6956 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
6957 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6958 * the real status code for failures. If this call is used to report a
6959 * failure due to a timeout (e.g., not receiving an Authentication frame
6960 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6961 * indicate that this is a failure, but without a status code.
6962 * @timeout_reason is used to report the reason for the timeout in that
6964 * @bssid: The BSSID of the AP (may be %NULL)
6965 * @bss: Entry of bss to which STA got connected to, can be obtained through
6966 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6967 * bss from the connect_request and hold a reference to it and return
6968 * through this param to avoid a warning if the bss is expired during the
6969 * connection, esp. for those drivers implementing connect op.
6970 * Only one parameter among @bssid and @bss needs to be specified.
6971 * @req_ie: Association request IEs (may be %NULL)
6972 * @req_ie_len: Association request IEs length
6973 * @resp_ie: Association response IEs (may be %NULL)
6974 * @resp_ie_len: Association response IEs length
6975 * @fils: FILS connection response parameters.
6976 * @timeout_reason: Reason for connection timeout. This is used when the
6977 * connection fails due to a timeout instead of an explicit rejection from
6978 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6979 * not known. This value is used only if @status < 0 to indicate that the
6980 * failure is due to a timeout and not due to explicit rejection by the AP.
6981 * This value is ignored in other cases (@status >= 0).
6983 struct cfg80211_connect_resp_params {
6986 struct cfg80211_bss *bss;
6991 struct cfg80211_fils_resp_params fils;
6992 enum nl80211_timeout_reason timeout_reason;
6996 * cfg80211_connect_done - notify cfg80211 of connection result
6998 * @dev: network device
6999 * @params: connection response parameters
7000 * @gfp: allocation flags
7002 * It should be called by the underlying driver once execution of the connection
7003 * request from connect() has been completed. This is similar to
7004 * cfg80211_connect_bss(), but takes a structure pointer for connection response
7005 * parameters. Only one of the functions among cfg80211_connect_bss(),
7006 * cfg80211_connect_result(), cfg80211_connect_timeout(),
7007 * and cfg80211_connect_done() should be called.
7009 void cfg80211_connect_done(struct net_device *dev,
7010 struct cfg80211_connect_resp_params *params,
7014 * cfg80211_connect_bss - notify cfg80211 of connection result
7016 * @dev: network device
7017 * @bssid: the BSSID of the AP
7018 * @bss: Entry of bss to which STA got connected to, can be obtained through
7019 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
7020 * bss from the connect_request and hold a reference to it and return
7021 * through this param to avoid a warning if the bss is expired during the
7022 * connection, esp. for those drivers implementing connect op.
7023 * Only one parameter among @bssid and @bss needs to be specified.
7024 * @req_ie: association request IEs (maybe be %NULL)
7025 * @req_ie_len: association request IEs length
7026 * @resp_ie: association response IEs (may be %NULL)
7027 * @resp_ie_len: assoc response IEs length
7028 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7029 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7030 * the real status code for failures. If this call is used to report a
7031 * failure due to a timeout (e.g., not receiving an Authentication frame
7032 * from the AP) instead of an explicit rejection by the AP, -1 is used to
7033 * indicate that this is a failure, but without a status code.
7034 * @timeout_reason is used to report the reason for the timeout in that
7036 * @gfp: allocation flags
7037 * @timeout_reason: reason for connection timeout. This is used when the
7038 * connection fails due to a timeout instead of an explicit rejection from
7039 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
7040 * not known. This value is used only if @status < 0 to indicate that the
7041 * failure is due to a timeout and not due to explicit rejection by the AP.
7042 * This value is ignored in other cases (@status >= 0).
7044 * It should be called by the underlying driver once execution of the connection
7045 * request from connect() has been completed. This is similar to
7046 * cfg80211_connect_result(), but with the option of identifying the exact bss
7047 * entry for the connection. Only one of the functions among
7048 * cfg80211_connect_bss(), cfg80211_connect_result(),
7049 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7052 cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
7053 struct cfg80211_bss *bss, const u8 *req_ie,
7054 size_t req_ie_len, const u8 *resp_ie,
7055 size_t resp_ie_len, int status, gfp_t gfp,
7056 enum nl80211_timeout_reason timeout_reason)
7058 struct cfg80211_connect_resp_params params;
7060 memset(¶ms, 0, sizeof(params));
7061 params.status = status;
7062 params.bssid = bssid;
7064 params.req_ie = req_ie;
7065 params.req_ie_len = req_ie_len;
7066 params.resp_ie = resp_ie;
7067 params.resp_ie_len = resp_ie_len;
7068 params.timeout_reason = timeout_reason;
7070 cfg80211_connect_done(dev, ¶ms, gfp);
7074 * cfg80211_connect_result - notify cfg80211 of connection result
7076 * @dev: network device
7077 * @bssid: the BSSID of the AP
7078 * @req_ie: association request IEs (maybe be %NULL)
7079 * @req_ie_len: association request IEs length
7080 * @resp_ie: association response IEs (may be %NULL)
7081 * @resp_ie_len: assoc response IEs length
7082 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
7083 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
7084 * the real status code for failures.
7085 * @gfp: allocation flags
7087 * It should be called by the underlying driver once execution of the connection
7088 * request from connect() has been completed. This is similar to
7089 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
7090 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
7091 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7094 cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
7095 const u8 *req_ie, size_t req_ie_len,
7096 const u8 *resp_ie, size_t resp_ie_len,
7097 u16 status, gfp_t gfp)
7099 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
7100 resp_ie_len, status, gfp,
7101 NL80211_TIMEOUT_UNSPECIFIED);
7105 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
7107 * @dev: network device
7108 * @bssid: the BSSID of the AP
7109 * @req_ie: association request IEs (maybe be %NULL)
7110 * @req_ie_len: association request IEs length
7111 * @gfp: allocation flags
7112 * @timeout_reason: reason for connection timeout.
7114 * It should be called by the underlying driver whenever connect() has failed
7115 * in a sequence where no explicit authentication/association rejection was
7116 * received from the AP. This could happen, e.g., due to not being able to send
7117 * out the Authentication or Association Request frame or timing out while
7118 * waiting for the response. Only one of the functions among
7119 * cfg80211_connect_bss(), cfg80211_connect_result(),
7120 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
7123 cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
7124 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
7125 enum nl80211_timeout_reason timeout_reason)
7127 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
7128 gfp, timeout_reason);
7132 * struct cfg80211_roam_info - driver initiated roaming information
7134 * @channel: the channel of the new AP
7135 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
7136 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
7137 * @req_ie: association request IEs (maybe be %NULL)
7138 * @req_ie_len: association request IEs length
7139 * @resp_ie: association response IEs (may be %NULL)
7140 * @resp_ie_len: assoc response IEs length
7141 * @fils: FILS related roaming information.
7143 struct cfg80211_roam_info {
7144 struct ieee80211_channel *channel;
7145 struct cfg80211_bss *bss;
7151 struct cfg80211_fils_resp_params fils;
7155 * cfg80211_roamed - notify cfg80211 of roaming
7157 * @dev: network device
7158 * @info: information about the new BSS. struct &cfg80211_roam_info.
7159 * @gfp: allocation flags
7161 * This function may be called with the driver passing either the BSSID of the
7162 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
7163 * It should be called by the underlying driver whenever it roamed from one AP
7164 * to another while connected. Drivers which have roaming implemented in
7165 * firmware should pass the bss entry to avoid a race in bss entry timeout where
7166 * the bss entry of the new AP is seen in the driver, but gets timed out by the
7167 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
7168 * rdev->event_work. In case of any failures, the reference is released
7169 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
7170 * released while disconnecting from the current bss.
7172 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
7176 * cfg80211_port_authorized - notify cfg80211 of successful security association
7178 * @dev: network device
7179 * @bssid: the BSSID of the AP
7180 * @gfp: allocation flags
7182 * This function should be called by a driver that supports 4 way handshake
7183 * offload after a security association was successfully established (i.e.,
7184 * the 4 way handshake was completed successfully). The call to this function
7185 * should be preceded with a call to cfg80211_connect_result(),
7186 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
7187 * indicate the 802.11 association.
7189 void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
7193 * cfg80211_disconnected - notify cfg80211 that connection was dropped
7195 * @dev: network device
7196 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
7197 * @ie_len: length of IEs
7198 * @reason: reason code for the disconnection, set it to 0 if unknown
7199 * @locally_generated: disconnection was requested locally
7200 * @gfp: allocation flags
7202 * After it calls this function, the driver should enter an idle state
7203 * and not try to connect to any AP any more.
7205 void cfg80211_disconnected(struct net_device *dev, u16 reason,
7206 const u8 *ie, size_t ie_len,
7207 bool locally_generated, gfp_t gfp);
7210 * cfg80211_ready_on_channel - notification of remain_on_channel start
7211 * @wdev: wireless device
7212 * @cookie: the request cookie
7213 * @chan: The current channel (from remain_on_channel request)
7214 * @duration: Duration in milliseconds that the driver intents to remain on the
7216 * @gfp: allocation flags
7218 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
7219 struct ieee80211_channel *chan,
7220 unsigned int duration, gfp_t gfp);
7223 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
7224 * @wdev: wireless device
7225 * @cookie: the request cookie
7226 * @chan: The current channel (from remain_on_channel request)
7227 * @gfp: allocation flags
7229 void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
7230 struct ieee80211_channel *chan,
7234 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
7235 * @wdev: wireless device
7236 * @cookie: the requested cookie
7237 * @chan: The current channel (from tx_mgmt request)
7238 * @gfp: allocation flags
7240 void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
7241 struct ieee80211_channel *chan, gfp_t gfp);
7244 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
7246 * @sinfo: the station information
7247 * @gfp: allocation flags
7249 int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
7252 * cfg80211_sinfo_release_content - release contents of station info
7253 * @sinfo: the station information
7255 * Releases any potentially allocated sub-information of the station
7256 * information, but not the struct itself (since it's typically on
7259 static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
7261 kfree(sinfo->pertid);
7265 * cfg80211_new_sta - notify userspace about station
7268 * @mac_addr: the station's address
7269 * @sinfo: the station information
7270 * @gfp: allocation flags
7272 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
7273 struct station_info *sinfo, gfp_t gfp);
7276 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
7278 * @mac_addr: the station's address
7279 * @sinfo: the station information/statistics
7280 * @gfp: allocation flags
7282 void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
7283 struct station_info *sinfo, gfp_t gfp);
7286 * cfg80211_del_sta - notify userspace about deletion of a station
7289 * @mac_addr: the station's address
7290 * @gfp: allocation flags
7292 static inline void cfg80211_del_sta(struct net_device *dev,
7293 const u8 *mac_addr, gfp_t gfp)
7295 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
7299 * cfg80211_conn_failed - connection request failed notification
7302 * @mac_addr: the station's address
7303 * @reason: the reason for connection failure
7304 * @gfp: allocation flags
7306 * Whenever a station tries to connect to an AP and if the station
7307 * could not connect to the AP as the AP has rejected the connection
7308 * for some reasons, this function is called.
7310 * The reason for connection failure can be any of the value from
7311 * nl80211_connect_failed_reason enum
7313 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7314 enum nl80211_connect_failed_reason reason,
7318 * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7319 * @wdev: wireless device receiving the frame
7320 * @freq: Frequency on which the frame was received in KHz
7321 * @sig_dbm: signal strength in dBm, or 0 if unknown
7322 * @buf: Management frame (header + body)
7323 * @len: length of the frame data
7324 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7326 * This function is called whenever an Action frame is received for a station
7327 * mode interface, but is not processed in kernel.
7329 * Return: %true if a user space application has registered for this frame.
7330 * For action frames, that makes it responsible for rejecting unrecognized
7331 * action frames; %false otherwise, in which case for action frames the
7332 * driver is responsible for rejecting the frame.
7334 bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7335 const u8 *buf, size_t len, u32 flags);
7338 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
7339 * @wdev: wireless device receiving the frame
7340 * @freq: Frequency on which the frame was received in MHz
7341 * @sig_dbm: signal strength in dBm, or 0 if unknown
7342 * @buf: Management frame (header + body)
7343 * @len: length of the frame data
7344 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7346 * This function is called whenever an Action frame is received for a station
7347 * mode interface, but is not processed in kernel.
7349 * Return: %true if a user space application has registered for this frame.
7350 * For action frames, that makes it responsible for rejecting unrecognized
7351 * action frames; %false otherwise, in which case for action frames the
7352 * driver is responsible for rejecting the frame.
7354 static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7355 int sig_dbm, const u8 *buf, size_t len,
7358 return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7363 * cfg80211_mgmt_tx_status - notification of TX status for management frame
7364 * @wdev: wireless device receiving the frame
7365 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
7366 * @buf: Management frame (header + body)
7367 * @len: length of the frame data
7368 * @ack: Whether frame was acknowledged
7369 * @gfp: context flags
7371 * This function is called whenever a management frame was requested to be
7372 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7373 * transmission attempt.
7375 void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7376 const u8 *buf, size_t len, bool ack, gfp_t gfp);
7379 * cfg80211_control_port_tx_status - notification of TX status for control
7381 * @wdev: wireless device receiving the frame
7382 * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7383 * @buf: Data frame (header + body)
7384 * @len: length of the frame data
7385 * @ack: Whether frame was acknowledged
7386 * @gfp: context flags
7388 * This function is called whenever a control port frame was requested to be
7389 * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7390 * the transmission attempt.
7392 void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7393 const u8 *buf, size_t len, bool ack,
7397 * cfg80211_rx_control_port - notification about a received control port frame
7398 * @dev: The device the frame matched to
7399 * @skb: The skbuf with the control port frame. It is assumed that the skbuf
7400 * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
7401 * This function does not take ownership of the skb, so the caller is
7402 * responsible for any cleanup. The caller must also ensure that
7403 * skb->protocol is set appropriately.
7404 * @unencrypted: Whether the frame was received unencrypted
7406 * This function is used to inform userspace about a received control port
7407 * frame. It should only be used if userspace indicated it wants to receive
7408 * control port frames over nl80211.
7410 * The frame is the data portion of the 802.3 or 802.11 data frame with all
7411 * network layer headers removed (e.g. the raw EAPoL frame).
7413 * Return: %true if the frame was passed to userspace
7415 bool cfg80211_rx_control_port(struct net_device *dev,
7416 struct sk_buff *skb, bool unencrypted);
7419 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7420 * @dev: network device
7421 * @rssi_event: the triggered RSSI event
7422 * @rssi_level: new RSSI level value or 0 if not available
7423 * @gfp: context flags
7425 * This function is called when a configured connection quality monitoring
7426 * rssi threshold reached event occurs.
7428 void cfg80211_cqm_rssi_notify(struct net_device *dev,
7429 enum nl80211_cqm_rssi_threshold_event rssi_event,
7430 s32 rssi_level, gfp_t gfp);
7433 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7434 * @dev: network device
7435 * @peer: peer's MAC address
7436 * @num_packets: how many packets were lost -- should be a fixed threshold
7437 * but probably no less than maybe 50, or maybe a throughput dependent
7438 * threshold (to account for temporary interference)
7439 * @gfp: context flags
7441 void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7442 const u8 *peer, u32 num_packets, gfp_t gfp);
7445 * cfg80211_cqm_txe_notify - TX error rate event
7446 * @dev: network device
7447 * @peer: peer's MAC address
7448 * @num_packets: how many packets were lost
7449 * @rate: % of packets which failed transmission
7450 * @intvl: interval (in s) over which the TX failure threshold was breached.
7451 * @gfp: context flags
7453 * Notify userspace when configured % TX failures over number of packets in a
7454 * given interval is exceeded.
7456 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
7457 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
7460 * cfg80211_cqm_beacon_loss_notify - beacon loss event
7461 * @dev: network device
7462 * @gfp: context flags
7464 * Notify userspace about beacon loss from the connected AP.
7466 void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
7469 * cfg80211_radar_event - radar detection event
7471 * @chandef: chandef for the current channel
7472 * @gfp: context flags
7474 * This function is called when a radar is detected on the current chanenl.
7476 void cfg80211_radar_event(struct wiphy *wiphy,
7477 struct cfg80211_chan_def *chandef, gfp_t gfp);
7480 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7481 * @dev: network device
7482 * @mac: MAC address of a station which opmode got modified
7483 * @sta_opmode: station's current opmode value
7484 * @gfp: context flags
7486 * Driver should call this function when station's opmode modified via action
7489 void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7490 struct sta_opmode_info *sta_opmode,
7494 * cfg80211_cac_event - Channel availability check (CAC) event
7495 * @netdev: network device
7496 * @chandef: chandef for the current channel
7497 * @event: type of event
7498 * @gfp: context flags
7500 * This function is called when a Channel availability check (CAC) is finished
7501 * or aborted. This must be called to notify the completion of a CAC process,
7502 * also by full-MAC drivers.
7504 void cfg80211_cac_event(struct net_device *netdev,
7505 const struct cfg80211_chan_def *chandef,
7506 enum nl80211_radar_event event, gfp_t gfp);
7510 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7511 * @dev: network device
7512 * @bssid: BSSID of AP (to avoid races)
7513 * @replay_ctr: new replay counter
7514 * @gfp: allocation flags
7516 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7517 const u8 *replay_ctr, gfp_t gfp);
7520 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7521 * @dev: network device
7522 * @index: candidate index (the smaller the index, the higher the priority)
7523 * @bssid: BSSID of AP
7524 * @preauth: Whether AP advertises support for RSN pre-authentication
7525 * @gfp: allocation flags
7527 void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7528 const u8 *bssid, bool preauth, gfp_t gfp);
7531 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
7532 * @dev: The device the frame matched to
7533 * @addr: the transmitter address
7534 * @gfp: context flags
7536 * This function is used in AP mode (only!) to inform userspace that
7537 * a spurious class 3 frame was received, to be able to deauth the
7539 * Return: %true if the frame was passed to userspace (or this failed
7540 * for a reason other than not having a subscription.)
7542 bool cfg80211_rx_spurious_frame(struct net_device *dev,
7543 const u8 *addr, gfp_t gfp);
7546 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7547 * @dev: The device the frame matched to
7548 * @addr: the transmitter address
7549 * @gfp: context flags
7551 * This function is used in AP mode (only!) to inform userspace that
7552 * an associated station sent a 4addr frame but that wasn't expected.
7553 * It is allowed and desirable to send this event only once for each
7554 * station to avoid event flooding.
7555 * Return: %true if the frame was passed to userspace (or this failed
7556 * for a reason other than not having a subscription.)
7558 bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7559 const u8 *addr, gfp_t gfp);
7562 * cfg80211_probe_status - notify userspace about probe status
7563 * @dev: the device the probe was sent on
7564 * @addr: the address of the peer
7565 * @cookie: the cookie filled in @probe_client previously
7566 * @acked: indicates whether probe was acked or not
7567 * @ack_signal: signal strength (in dBm) of the ACK frame.
7568 * @is_valid_ack_signal: indicates the ack_signal is valid or not.
7569 * @gfp: allocation flags
7571 void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7572 u64 cookie, bool acked, s32 ack_signal,
7573 bool is_valid_ack_signal, gfp_t gfp);
7576 * cfg80211_report_obss_beacon_khz - report beacon from other APs
7577 * @wiphy: The wiphy that received the beacon
7579 * @len: length of the frame
7580 * @freq: frequency the frame was received on in KHz
7581 * @sig_dbm: signal strength in dBm, or 0 if unknown
7583 * Use this function to report to userspace when a beacon was
7584 * received. It is not useful to call this when there is no
7585 * netdev that is in AP/GO mode.
7587 void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7588 size_t len, int freq, int sig_dbm);
7591 * cfg80211_report_obss_beacon - report beacon from other APs
7592 * @wiphy: The wiphy that received the beacon
7594 * @len: length of the frame
7595 * @freq: frequency the frame was received on
7596 * @sig_dbm: signal strength in dBm, or 0 if unknown
7598 * Use this function to report to userspace when a beacon was
7599 * received. It is not useful to call this when there is no
7600 * netdev that is in AP/GO mode.
7602 static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
7603 const u8 *frame, size_t len,
7604 int freq, int sig_dbm)
7606 cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7611 * cfg80211_reg_can_beacon - check if beaconing is allowed
7613 * @chandef: the channel definition
7614 * @iftype: interface type
7616 * Return: %true if there is no secondary channel or the secondary channel(s)
7617 * can be used for beaconing (i.e. is not a radar channel etc.)
7619 bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7620 struct cfg80211_chan_def *chandef,
7621 enum nl80211_iftype iftype);
7624 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7626 * @chandef: the channel definition
7627 * @iftype: interface type
7629 * Return: %true if there is no secondary channel or the secondary channel(s)
7630 * can be used for beaconing (i.e. is not a radar channel etc.). This version
7631 * also checks if IR-relaxation conditions apply, to allow beaconing under
7632 * more permissive conditions.
7634 * Requires the wiphy mutex to be held.
7636 bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7637 struct cfg80211_chan_def *chandef,
7638 enum nl80211_iftype iftype);
7641 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
7642 * @dev: the device which switched channels
7643 * @chandef: the new channel definition
7645 * Caller must acquire wdev_lock, therefore must only be called from sleepable
7648 void cfg80211_ch_switch_notify(struct net_device *dev,
7649 struct cfg80211_chan_def *chandef);
7652 * cfg80211_ch_switch_started_notify - notify channel switch start
7653 * @dev: the device on which the channel switch started
7654 * @chandef: the future channel definition
7655 * @count: the number of TBTTs until the channel switch happens
7656 * @quiet: whether or not immediate quiet was requested by the AP
7658 * Inform the userspace about the channel switch that has just
7659 * started, so that it can take appropriate actions (eg. starting
7660 * channel switch on other vifs), if necessary.
7662 void cfg80211_ch_switch_started_notify(struct net_device *dev,
7663 struct cfg80211_chan_def *chandef,
7664 u8 count, bool quiet);
7667 * ieee80211_operating_class_to_band - convert operating class to band
7669 * @operating_class: the operating class to convert
7670 * @band: band pointer to fill
7672 * Returns %true if the conversion was successful, %false otherwise.
7674 bool ieee80211_operating_class_to_band(u8 operating_class,
7675 enum nl80211_band *band);
7678 * ieee80211_chandef_to_operating_class - convert chandef to operation class
7680 * @chandef: the chandef to convert
7681 * @op_class: a pointer to the resulting operating class
7683 * Returns %true if the conversion was successful, %false otherwise.
7685 bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7689 * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7691 * @chandef: the chandef to convert
7693 * Returns the center frequency of chandef (1st segment) in KHz.
7696 ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7698 return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7702 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
7703 * @dev: the device on which the operation is requested
7704 * @peer: the MAC address of the peer device
7705 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
7706 * NL80211_TDLS_TEARDOWN)
7707 * @reason_code: the reason code for teardown request
7708 * @gfp: allocation flags
7710 * This function is used to request userspace to perform TDLS operation that
7711 * requires knowledge of keys, i.e., link setup or teardown when the AP
7712 * connection uses encryption. This is optional mechanism for the driver to use
7713 * if it can automatically determine when a TDLS link could be useful (e.g.,
7714 * based on traffic and signal strength for a peer).
7716 void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
7717 enum nl80211_tdls_operation oper,
7718 u16 reason_code, gfp_t gfp);
7721 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
7722 * @rate: given rate_info to calculate bitrate from
7724 * return 0 if MCS index >= 32
7726 u32 cfg80211_calculate_bitrate(struct rate_info *rate);
7729 * cfg80211_unregister_wdev - remove the given wdev
7730 * @wdev: struct wireless_dev to remove
7732 * This function removes the device so it can no longer be used. It is necessary
7733 * to call this function even when cfg80211 requests the removal of the device
7734 * by calling the del_virtual_intf() callback. The function must also be called
7735 * when the driver wishes to unregister the wdev, e.g. when the hardware device
7736 * is unbound from the driver.
7738 * Requires the RTNL and wiphy mutex to be held.
7740 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
7743 * cfg80211_register_netdevice - register the given netdev
7744 * @dev: the netdev to register
7746 * Note: In contexts coming from cfg80211 callbacks, you must call this rather
7747 * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
7748 * held. Otherwise, both register_netdevice() and register_netdev() are usable
7751 * Requires the RTNL and wiphy mutex to be held.
7753 int cfg80211_register_netdevice(struct net_device *dev);
7756 * cfg80211_unregister_netdevice - unregister the given netdev
7757 * @dev: the netdev to register
7759 * Note: In contexts coming from cfg80211 callbacks, you must call this rather
7760 * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
7761 * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
7762 * usable instead as well.
7764 * Requires the RTNL and wiphy mutex to be held.
7766 static inline void cfg80211_unregister_netdevice(struct net_device *dev)
7768 cfg80211_unregister_wdev(dev->ieee80211_ptr);
7772 * struct cfg80211_ft_event_params - FT Information Elements
7774 * @ies_len: length of the FT IE in bytes
7775 * @target_ap: target AP's MAC address
7777 * @ric_ies_len: length of the RIC IE in bytes
7779 struct cfg80211_ft_event_params {
7782 const u8 *target_ap;
7788 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7789 * @netdev: network device
7790 * @ft_event: IE information
7792 void cfg80211_ft_event(struct net_device *netdev,
7793 struct cfg80211_ft_event_params *ft_event);
7796 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
7797 * @ies: the input IE buffer
7798 * @len: the input length
7799 * @attr: the attribute ID to find
7800 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
7801 * if the function is only called to get the needed buffer size
7802 * @bufsize: size of the output buffer
7804 * The function finds a given P2P attribute in the (vendor) IEs and
7805 * copies its contents to the given buffer.
7807 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
7808 * malformed or the attribute can't be found (respectively), or the
7809 * length of the found attribute (which can be zero).
7811 int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7812 enum ieee80211_p2p_attr_id attr,
7813 u8 *buf, unsigned int bufsize);
7816 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
7817 * @ies: the IE buffer
7818 * @ielen: the length of the IE buffer
7819 * @ids: an array with element IDs that are allowed before
7820 * the split. A WLAN_EID_EXTENSION value means that the next
7821 * EID in the list is a sub-element of the EXTENSION IE.
7822 * @n_ids: the size of the element ID array
7823 * @after_ric: array IE types that come after the RIC element
7824 * @n_after_ric: size of the @after_ric array
7825 * @offset: offset where to start splitting in the buffer
7827 * This function splits an IE buffer by updating the @offset
7828 * variable to point to the location where the buffer should be
7831 * It assumes that the given IE buffer is well-formed, this
7832 * has to be guaranteed by the caller!
7834 * It also assumes that the IEs in the buffer are ordered
7835 * correctly, if not the result of using this function will not
7836 * be ordered correctly either, i.e. it does no reordering.
7838 * The function returns the offset where the next part of the
7839 * buffer starts, which may be @ielen if the entire (remainder)
7840 * of the buffer should be used.
7842 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
7843 const u8 *ids, int n_ids,
7844 const u8 *after_ric, int n_after_ric,
7848 * ieee80211_ie_split - split an IE buffer according to ordering
7849 * @ies: the IE buffer
7850 * @ielen: the length of the IE buffer
7851 * @ids: an array with element IDs that are allowed before
7852 * the split. A WLAN_EID_EXTENSION value means that the next
7853 * EID in the list is a sub-element of the EXTENSION IE.
7854 * @n_ids: the size of the element ID array
7855 * @offset: offset where to start splitting in the buffer
7857 * This function splits an IE buffer by updating the @offset
7858 * variable to point to the location where the buffer should be
7861 * It assumes that the given IE buffer is well-formed, this
7862 * has to be guaranteed by the caller!
7864 * It also assumes that the IEs in the buffer are ordered
7865 * correctly, if not the result of using this function will not
7866 * be ordered correctly either, i.e. it does no reordering.
7868 * The function returns the offset where the next part of the
7869 * buffer starts, which may be @ielen if the entire (remainder)
7870 * of the buffer should be used.
7872 static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
7873 const u8 *ids, int n_ids, size_t offset)
7875 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
7879 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7880 * @wdev: the wireless device reporting the wakeup
7881 * @wakeup: the wakeup report
7882 * @gfp: allocation flags
7884 * This function reports that the given device woke up. If it
7885 * caused the wakeup, report the reason(s), otherwise you may
7886 * pass %NULL as the @wakeup parameter to advertise that something
7887 * else caused the wakeup.
7889 void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7890 struct cfg80211_wowlan_wakeup *wakeup,
7894 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
7896 * @wdev: the wireless device for which critical protocol is stopped.
7897 * @gfp: allocation flags
7899 * This function can be called by the driver to indicate it has reverted
7900 * operation back to normal. One reason could be that the duration given
7901 * by .crit_proto_start() has expired.
7903 void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
7906 * ieee80211_get_num_supported_channels - get number of channels device has
7909 * Return: the number of channels supported by the device.
7911 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7914 * cfg80211_check_combinations - check interface combinations
7917 * @params: the interface combinations parameter
7919 * This function can be called by the driver to check whether a
7920 * combination of interfaces and their types are allowed according to
7921 * the interface combinations.
7923 int cfg80211_check_combinations(struct wiphy *wiphy,
7924 struct iface_combination_params *params);
7927 * cfg80211_iter_combinations - iterate over matching combinations
7930 * @params: the interface combinations parameter
7931 * @iter: function to call for each matching combination
7932 * @data: pointer to pass to iter function
7934 * This function can be called by the driver to check what possible
7935 * combinations it fits in at a given moment, e.g. for channel switching
7938 int cfg80211_iter_combinations(struct wiphy *wiphy,
7939 struct iface_combination_params *params,
7940 void (*iter)(const struct ieee80211_iface_combination *c,
7945 * cfg80211_stop_iface - trigger interface disconnection
7948 * @wdev: wireless device
7949 * @gfp: context flags
7951 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7954 * Note: This doesn't need any locks and is asynchronous.
7956 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7960 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7961 * @wiphy: the wiphy to shut down
7963 * This function shuts down all interfaces belonging to this wiphy by
7964 * calling dev_close() (and treating non-netdev interfaces as needed).
7965 * It shouldn't really be used unless there are some fatal device errors
7966 * that really can't be recovered in any other way.
7968 * Callers must hold the RTNL and be able to deal with callbacks into
7969 * the driver while the function is running.
7971 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7974 * wiphy_ext_feature_set - set the extended feature flag
7976 * @wiphy: the wiphy to modify.
7977 * @ftidx: extended feature bit index.
7979 * The extended features are flagged in multiple bytes (see
7980 * &struct wiphy.@ext_features)
7982 static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7983 enum nl80211_ext_feature_index ftidx)
7987 ft_byte = &wiphy->ext_features[ftidx / 8];
7988 *ft_byte |= BIT(ftidx % 8);
7992 * wiphy_ext_feature_isset - check the extended feature flag
7994 * @wiphy: the wiphy to modify.
7995 * @ftidx: extended feature bit index.
7997 * The extended features are flagged in multiple bytes (see
7998 * &struct wiphy.@ext_features)
8001 wiphy_ext_feature_isset(struct wiphy *wiphy,
8002 enum nl80211_ext_feature_index ftidx)
8006 ft_byte = wiphy->ext_features[ftidx / 8];
8007 return (ft_byte & BIT(ftidx % 8)) != 0;
8011 * cfg80211_free_nan_func - free NAN function
8012 * @f: NAN function that should be freed
8014 * Frees all the NAN function and all it's allocated members.
8016 void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
8019 * struct cfg80211_nan_match_params - NAN match parameters
8020 * @type: the type of the function that triggered a match. If it is
8021 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
8022 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
8024 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
8025 * @inst_id: the local instance id
8026 * @peer_inst_id: the instance id of the peer's function
8027 * @addr: the MAC address of the peer
8028 * @info_len: the length of the &info
8029 * @info: the Service Specific Info from the peer (if any)
8030 * @cookie: unique identifier of the corresponding function
8032 struct cfg80211_nan_match_params {
8033 enum nl80211_nan_function_type type;
8043 * cfg80211_nan_match - report a match for a NAN function.
8044 * @wdev: the wireless device reporting the match
8045 * @match: match notification parameters
8046 * @gfp: allocation flags
8048 * This function reports that the a NAN function had a match. This
8049 * can be a subscribe that had a match or a solicited publish that
8050 * was sent. It can also be a follow up that was received.
8052 void cfg80211_nan_match(struct wireless_dev *wdev,
8053 struct cfg80211_nan_match_params *match, gfp_t gfp);
8056 * cfg80211_nan_func_terminated - notify about NAN function termination.
8058 * @wdev: the wireless device reporting the match
8059 * @inst_id: the local instance id
8060 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
8061 * @cookie: unique NAN function identifier
8062 * @gfp: allocation flags
8064 * This function reports that the a NAN function is terminated.
8066 void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
8068 enum nl80211_nan_func_term_reason reason,
8069 u64 cookie, gfp_t gfp);
8071 /* ethtool helper */
8072 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
8075 * cfg80211_external_auth_request - userspace request for authentication
8076 * @netdev: network device
8077 * @params: External authentication parameters
8078 * @gfp: allocation flags
8079 * Returns: 0 on success, < 0 on error
8081 int cfg80211_external_auth_request(struct net_device *netdev,
8082 struct cfg80211_external_auth_params *params,
8086 * cfg80211_pmsr_report - report peer measurement result data
8087 * @wdev: the wireless device reporting the measurement
8088 * @req: the original measurement request
8089 * @result: the result data
8090 * @gfp: allocation flags
8092 void cfg80211_pmsr_report(struct wireless_dev *wdev,
8093 struct cfg80211_pmsr_request *req,
8094 struct cfg80211_pmsr_result *result,
8098 * cfg80211_pmsr_complete - report peer measurement completed
8099 * @wdev: the wireless device reporting the measurement
8100 * @req: the original measurement request
8101 * @gfp: allocation flags
8103 * Report that the entire measurement completed, after this
8104 * the request pointer will no longer be valid.
8106 void cfg80211_pmsr_complete(struct wireless_dev *wdev,
8107 struct cfg80211_pmsr_request *req,
8111 * cfg80211_iftype_allowed - check whether the interface can be allowed
8113 * @iftype: interface type
8114 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
8115 * @check_swif: check iftype against software interfaces
8117 * Check whether the interface is allowed to operate; additionally, this API
8118 * can be used to check iftype against the software interfaces when
8119 * check_swif is '1'.
8121 bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
8122 bool is_4addr, u8 check_swif);
8125 /* Logging, debugging and troubleshooting/diagnostic helpers. */
8127 /* wiphy_printk helpers, similar to dev_printk */
8129 #define wiphy_printk(level, wiphy, format, args...) \
8130 dev_printk(level, &(wiphy)->dev, format, ##args)
8131 #define wiphy_emerg(wiphy, format, args...) \
8132 dev_emerg(&(wiphy)->dev, format, ##args)
8133 #define wiphy_alert(wiphy, format, args...) \
8134 dev_alert(&(wiphy)->dev, format, ##args)
8135 #define wiphy_crit(wiphy, format, args...) \
8136 dev_crit(&(wiphy)->dev, format, ##args)
8137 #define wiphy_err(wiphy, format, args...) \
8138 dev_err(&(wiphy)->dev, format, ##args)
8139 #define wiphy_warn(wiphy, format, args...) \
8140 dev_warn(&(wiphy)->dev, format, ##args)
8141 #define wiphy_notice(wiphy, format, args...) \
8142 dev_notice(&(wiphy)->dev, format, ##args)
8143 #define wiphy_info(wiphy, format, args...) \
8144 dev_info(&(wiphy)->dev, format, ##args)
8146 #define wiphy_err_ratelimited(wiphy, format, args...) \
8147 dev_err_ratelimited(&(wiphy)->dev, format, ##args)
8148 #define wiphy_warn_ratelimited(wiphy, format, args...) \
8149 dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
8151 #define wiphy_debug(wiphy, format, args...) \
8152 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
8154 #define wiphy_dbg(wiphy, format, args...) \
8155 dev_dbg(&(wiphy)->dev, format, ##args)
8157 #if defined(VERBOSE_DEBUG)
8158 #define wiphy_vdbg wiphy_dbg
8160 #define wiphy_vdbg(wiphy, format, args...) \
8163 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
8169 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
8170 * of using a WARN/WARN_ON to get the message out, including the
8171 * file/line information and a backtrace.
8173 #define wiphy_WARN(wiphy, format, args...) \
8174 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
8177 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
8178 * @netdev: network device
8179 * @owe_info: peer's owe info
8180 * @gfp: allocation flags
8182 void cfg80211_update_owe_info_event(struct net_device *netdev,
8183 struct cfg80211_update_owe_info *owe_info,
8187 * cfg80211_bss_flush - resets all the scan entries
8190 void cfg80211_bss_flush(struct wiphy *wiphy);
8192 #endif /* __NET_CFG80211_H */