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-2019 Intel Corporation
13 #include <linux/netdevice.h>
14 #include <linux/debugfs.h>
15 #include <linux/list.h>
16 #include <linux/bug.h>
17 #include <linux/netlink.h>
18 #include <linux/skbuff.h>
19 #include <linux/nl80211.h>
20 #include <linux/if_ether.h>
21 #include <linux/ieee80211.h>
22 #include <linux/net.h>
23 #include <net/regulatory.h>
28 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
29 * userspace and drivers, and offers some utility functionality associated
30 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
31 * by all modern wireless drivers in Linux, so that they offer a consistent
32 * API through nl80211. For backward compatibility, cfg80211 also offers
33 * wireless extensions to userspace, but hides them from drivers completely.
35 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
41 * DOC: Device registration
43 * In order for a driver to use cfg80211, it must register the hardware device
44 * with cfg80211. This happens through a number of hardware capability structs
47 * The fundamental structure for each device is the 'wiphy', of which each
48 * instance describes a physical wireless device connected to the system. Each
49 * such wiphy can have zero, one, or many virtual interfaces associated with
50 * it, which need to be identified as such by pointing the network interface's
51 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
52 * the wireless part of the interface, normally this struct is embedded in the
53 * network interface's private data area. Drivers can optionally allow creating
54 * or destroying virtual interfaces on the fly, but without at least one or the
55 * ability to create some the wireless device isn't useful.
57 * Each wiphy structure contains device capability information, and also has
58 * a pointer to the various operations the driver offers. The definitions and
59 * structures here describe these capabilities in detail.
65 * wireless hardware capability structures
69 * enum ieee80211_channel_flags - channel flags
71 * Channel flags set by the regulatory control code.
73 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
74 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
75 * sending probe requests or beaconing.
76 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
77 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
79 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
81 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
82 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
83 * this flag indicates that an 80 MHz channel cannot use this
84 * channel as the control or any of the secondary channels.
85 * This may be due to the driver or due to regulatory bandwidth
87 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
88 * this flag indicates that an 160 MHz channel cannot use this
89 * channel as the control or any of the secondary channels.
90 * This may be due to the driver or due to regulatory bandwidth
92 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
93 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
94 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
96 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
100 enum ieee80211_channel_flags {
101 IEEE80211_CHAN_DISABLED = 1<<0,
102 IEEE80211_CHAN_NO_IR = 1<<1,
104 IEEE80211_CHAN_RADAR = 1<<3,
105 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
106 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
107 IEEE80211_CHAN_NO_OFDM = 1<<6,
108 IEEE80211_CHAN_NO_80MHZ = 1<<7,
109 IEEE80211_CHAN_NO_160MHZ = 1<<8,
110 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
111 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
112 IEEE80211_CHAN_NO_20MHZ = 1<<11,
113 IEEE80211_CHAN_NO_10MHZ = 1<<12,
116 #define IEEE80211_CHAN_NO_HT40 \
117 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
119 #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
120 #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
123 * struct ieee80211_channel - channel definition
125 * This structure describes a single channel for use
128 * @center_freq: center frequency in MHz
129 * @hw_value: hardware-specific value for the channel
130 * @flags: channel flags from &enum ieee80211_channel_flags.
131 * @orig_flags: channel flags at registration time, used by regulatory
132 * code to support devices with additional restrictions
133 * @band: band this channel belongs to.
134 * @max_antenna_gain: maximum antenna gain in dBi
135 * @max_power: maximum transmission power (in dBm)
136 * @max_reg_power: maximum regulatory transmission power (in dBm)
137 * @beacon_found: helper to regulatory code to indicate when a beacon
138 * has been found on this channel. Use regulatory_hint_found_beacon()
139 * to enable this, this is useful only on 5 GHz band.
140 * @orig_mag: internal use
141 * @orig_mpwr: internal use
142 * @dfs_state: current state of this channel. Only relevant if radar is required
144 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
145 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
147 struct ieee80211_channel {
148 enum nl80211_band band;
152 int max_antenna_gain;
157 int orig_mag, orig_mpwr;
158 enum nl80211_dfs_state dfs_state;
159 unsigned long dfs_state_entered;
160 unsigned int dfs_cac_ms;
164 * enum ieee80211_rate_flags - rate flags
166 * Hardware/specification flags for rates. These are structured
167 * in a way that allows using the same bitrate structure for
168 * different bands/PHY modes.
170 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
171 * preamble on this bitrate; only relevant in 2.4GHz band and
173 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
174 * when used with 802.11a (on the 5 GHz band); filled by the
175 * core code when registering the wiphy.
176 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
177 * when used with 802.11b (on the 2.4 GHz band); filled by the
178 * core code when registering the wiphy.
179 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
180 * when used with 802.11g (on the 2.4 GHz band); filled by the
181 * core code when registering the wiphy.
182 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
183 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
184 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
186 enum ieee80211_rate_flags {
187 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
188 IEEE80211_RATE_MANDATORY_A = 1<<1,
189 IEEE80211_RATE_MANDATORY_B = 1<<2,
190 IEEE80211_RATE_MANDATORY_G = 1<<3,
191 IEEE80211_RATE_ERP_G = 1<<4,
192 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
193 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
197 * enum ieee80211_bss_type - BSS type filter
199 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
200 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
201 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
202 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
203 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
205 enum ieee80211_bss_type {
206 IEEE80211_BSS_TYPE_ESS,
207 IEEE80211_BSS_TYPE_PBSS,
208 IEEE80211_BSS_TYPE_IBSS,
209 IEEE80211_BSS_TYPE_MBSS,
210 IEEE80211_BSS_TYPE_ANY
214 * enum ieee80211_privacy - BSS privacy filter
216 * @IEEE80211_PRIVACY_ON: privacy bit set
217 * @IEEE80211_PRIVACY_OFF: privacy bit clear
218 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
220 enum ieee80211_privacy {
221 IEEE80211_PRIVACY_ON,
222 IEEE80211_PRIVACY_OFF,
223 IEEE80211_PRIVACY_ANY
226 #define IEEE80211_PRIVACY(x) \
227 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
230 * struct ieee80211_rate - bitrate definition
232 * This structure describes a bitrate that an 802.11 PHY can
233 * operate with. The two values @hw_value and @hw_value_short
234 * are only for driver use when pointers to this structure are
237 * @flags: rate-specific flags
238 * @bitrate: bitrate in units of 100 Kbps
239 * @hw_value: driver/hardware value for this rate
240 * @hw_value_short: driver/hardware value for this rate when
241 * short preamble is used
243 struct ieee80211_rate {
246 u16 hw_value, hw_value_short;
250 * struct ieee80211_he_obss_pd - AP settings for spatial reuse
252 * @enable: is the feature enabled.
253 * @min_offset: minimal tx power offset an associated station shall use
254 * @max_offset: maximum tx power offset an associated station shall use
256 struct ieee80211_he_obss_pd {
263 * struct ieee80211_sta_ht_cap - STA's HT capabilities
265 * This structure describes most essential parameters needed
266 * to describe 802.11n HT capabilities for an STA.
268 * @ht_supported: is HT supported by the STA
269 * @cap: HT capabilities map as described in 802.11n spec
270 * @ampdu_factor: Maximum A-MPDU length factor
271 * @ampdu_density: Minimum A-MPDU spacing
272 * @mcs: Supported MCS rates
274 struct ieee80211_sta_ht_cap {
275 u16 cap; /* use IEEE80211_HT_CAP_ */
279 struct ieee80211_mcs_info mcs;
283 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
285 * This structure describes most essential parameters needed
286 * to describe 802.11ac VHT capabilities for an STA.
288 * @vht_supported: is VHT supported by the STA
289 * @cap: VHT capabilities map as described in 802.11ac spec
290 * @vht_mcs: Supported VHT MCS rates
292 struct ieee80211_sta_vht_cap {
294 u32 cap; /* use IEEE80211_VHT_CAP_ */
295 struct ieee80211_vht_mcs_info vht_mcs;
298 #define IEEE80211_HE_PPE_THRES_MAX_LEN 25
301 * struct ieee80211_sta_he_cap - STA's HE capabilities
303 * This structure describes most essential parameters needed
304 * to describe 802.11ax HE capabilities for a STA.
306 * @has_he: true iff HE data is valid.
307 * @he_cap_elem: Fixed portion of the HE capabilities element.
308 * @he_mcs_nss_supp: The supported NSS/MCS combinations.
309 * @ppe_thres: Holds the PPE Thresholds data.
311 struct ieee80211_sta_he_cap {
313 struct ieee80211_he_cap_elem he_cap_elem;
314 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
315 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
319 * struct ieee80211_sband_iftype_data
321 * This structure encapsulates sband data that is relevant for the
322 * interface types defined in @types_mask. Each type in the
323 * @types_mask must be unique across all instances of iftype_data.
325 * @types_mask: interface types mask
326 * @he_cap: holds the HE capabilities
328 struct ieee80211_sband_iftype_data {
330 struct ieee80211_sta_he_cap he_cap;
334 * struct ieee80211_supported_band - frequency band definition
336 * This structure describes a frequency band a wiphy
337 * is able to operate in.
339 * @channels: Array of channels the hardware can operate in
341 * @band: the band this structure represents
342 * @n_channels: Number of channels in @channels
343 * @bitrates: Array of bitrates the hardware can operate with
344 * in this band. Must be sorted to give a valid "supported
345 * rates" IE, i.e. CCK rates first, then OFDM.
346 * @n_bitrates: Number of bitrates in @bitrates
347 * @ht_cap: HT capabilities in this band
348 * @vht_cap: VHT capabilities in this band
349 * @n_iftype_data: number of iftype data entries
350 * @iftype_data: interface type data entries. Note that the bits in
351 * @types_mask inside this structure cannot overlap (i.e. only
352 * one occurrence of each type is allowed across all instances of
355 struct ieee80211_supported_band {
356 struct ieee80211_channel *channels;
357 struct ieee80211_rate *bitrates;
358 enum nl80211_band band;
361 struct ieee80211_sta_ht_cap ht_cap;
362 struct ieee80211_sta_vht_cap vht_cap;
364 const struct ieee80211_sband_iftype_data *iftype_data;
368 * ieee80211_get_sband_iftype_data - return sband data for a given iftype
369 * @sband: the sband to search for the STA on
370 * @iftype: enum nl80211_iftype
372 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
374 static inline const struct ieee80211_sband_iftype_data *
375 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
380 if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
383 for (i = 0; i < sband->n_iftype_data; i++) {
384 const struct ieee80211_sband_iftype_data *data =
385 &sband->iftype_data[i];
387 if (data->types_mask & BIT(iftype))
395 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
396 * @sband: the sband to search for the iftype on
397 * @iftype: enum nl80211_iftype
399 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
401 static inline const struct ieee80211_sta_he_cap *
402 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
405 const struct ieee80211_sband_iftype_data *data =
406 ieee80211_get_sband_iftype_data(sband, iftype);
408 if (data && data->he_cap.has_he)
409 return &data->he_cap;
415 * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
416 * @sband: the sband to search for the STA on
418 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
420 static inline const struct ieee80211_sta_he_cap *
421 ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
423 return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
427 * wiphy_read_of_freq_limits - read frequency limits from device tree
429 * @wiphy: the wireless device to get extra limits for
431 * Some devices may have extra limitations specified in DT. This may be useful
432 * for chipsets that normally support more bands but are limited due to board
433 * design (e.g. by antennas or external power amplifier).
435 * This function reads info from DT and uses it to *modify* channels (disable
436 * unavailable ones). It's usually a *bad* idea to use it in drivers with
437 * shared channel data as DT limitations are device specific. You should make
438 * sure to call it only if channels in wiphy are copied and can be modified
439 * without affecting other devices.
441 * As this function access device node it has to be called after set_wiphy_dev.
442 * It also modifies channels so they have to be set first.
443 * If using this helper, call it before wiphy_register().
446 void wiphy_read_of_freq_limits(struct wiphy *wiphy);
447 #else /* CONFIG_OF */
448 static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
451 #endif /* !CONFIG_OF */
455 * Wireless hardware/device configuration structures and methods
459 * DOC: Actions and configuration
461 * Each wireless device and each virtual interface offer a set of configuration
462 * operations and other actions that are invoked by userspace. Each of these
463 * actions is described in the operations structure, and the parameters these
464 * operations use are described separately.
466 * Additionally, some operations are asynchronous and expect to get status
467 * information via some functions that drivers need to call.
469 * Scanning and BSS list handling with its associated functionality is described
470 * in a separate chapter.
473 #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
474 WLAN_USER_POSITION_LEN)
477 * struct vif_params - describes virtual interface parameters
478 * @flags: monitor interface flags, unchanged if 0, otherwise
479 * %MONITOR_FLAG_CHANGED will be set
480 * @use_4addr: use 4-address frames
481 * @macaddr: address to use for this virtual interface.
482 * If this parameter is set to zero address the driver may
483 * determine the address as needed.
484 * This feature is only fully supported by drivers that enable the
485 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
486 ** only p2p devices with specified MAC.
487 * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
488 * belonging to that MU-MIMO groupID; %NULL if not changed
489 * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
490 * MU-MIMO packets going to the specified station; %NULL if not changed
495 u8 macaddr[ETH_ALEN];
496 const u8 *vht_mumimo_groups;
497 const u8 *vht_mumimo_follow_addr;
501 * struct key_params - key information
503 * Information about a key
506 * @key_len: length of key material
507 * @cipher: cipher suite selector
508 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
509 * with the get_key() callback, must be in little endian,
510 * length given by @seq_len.
511 * @seq_len: length of @seq.
512 * @mode: key install mode (RX_TX, NO_TX or SET_TX)
520 enum nl80211_key_mode mode;
524 * struct cfg80211_chan_def - channel definition
525 * @chan: the (control) channel
526 * @width: channel width
527 * @center_freq1: center frequency of first segment
528 * @center_freq2: center frequency of second segment
529 * (only with 80+80 MHz)
531 struct cfg80211_chan_def {
532 struct ieee80211_channel *chan;
533 enum nl80211_chan_width width;
539 * cfg80211_get_chandef_type - return old channel type from chandef
540 * @chandef: the channel definition
542 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
543 * chandef, which must have a bandwidth allowing this conversion.
545 static inline enum nl80211_channel_type
546 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
548 switch (chandef->width) {
549 case NL80211_CHAN_WIDTH_20_NOHT:
550 return NL80211_CHAN_NO_HT;
551 case NL80211_CHAN_WIDTH_20:
552 return NL80211_CHAN_HT20;
553 case NL80211_CHAN_WIDTH_40:
554 if (chandef->center_freq1 > chandef->chan->center_freq)
555 return NL80211_CHAN_HT40PLUS;
556 return NL80211_CHAN_HT40MINUS;
559 return NL80211_CHAN_NO_HT;
564 * cfg80211_chandef_create - create channel definition using channel type
565 * @chandef: the channel definition struct to fill
566 * @channel: the control channel
567 * @chantype: the channel type
569 * Given a channel type, create a channel definition.
571 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
572 struct ieee80211_channel *channel,
573 enum nl80211_channel_type chantype);
576 * cfg80211_chandef_identical - check if two channel definitions are identical
577 * @chandef1: first channel definition
578 * @chandef2: second channel definition
580 * Return: %true if the channels defined by the channel definitions are
581 * identical, %false otherwise.
584 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
585 const struct cfg80211_chan_def *chandef2)
587 return (chandef1->chan == chandef2->chan &&
588 chandef1->width == chandef2->width &&
589 chandef1->center_freq1 == chandef2->center_freq1 &&
590 chandef1->center_freq2 == chandef2->center_freq2);
594 * cfg80211_chandef_compatible - check if two channel definitions are compatible
595 * @chandef1: first channel definition
596 * @chandef2: second channel definition
598 * Return: %NULL if the given channel definitions are incompatible,
599 * chandef1 or chandef2 otherwise.
601 const struct cfg80211_chan_def *
602 cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
603 const struct cfg80211_chan_def *chandef2);
606 * cfg80211_chandef_valid - check if a channel definition is valid
607 * @chandef: the channel definition to check
608 * Return: %true if the channel definition is valid. %false otherwise.
610 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
613 * cfg80211_chandef_usable - check if secondary channels can be used
614 * @wiphy: the wiphy to validate against
615 * @chandef: the channel definition to check
616 * @prohibited_flags: the regulatory channel flags that must not be set
617 * Return: %true if secondary channels are usable. %false otherwise.
619 bool cfg80211_chandef_usable(struct wiphy *wiphy,
620 const struct cfg80211_chan_def *chandef,
621 u32 prohibited_flags);
624 * cfg80211_chandef_dfs_required - checks if radar detection is required
625 * @wiphy: the wiphy to validate against
626 * @chandef: the channel definition to check
627 * @iftype: the interface type as specified in &enum nl80211_iftype
629 * 1 if radar detection is required, 0 if it is not, < 0 on error
631 int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
632 const struct cfg80211_chan_def *chandef,
633 enum nl80211_iftype iftype);
636 * ieee80211_chandef_rate_flags - returns rate flags for a channel
638 * In some channel types, not all rates may be used - for example CCK
639 * rates may not be used in 5/10 MHz channels.
641 * @chandef: channel definition for the channel
643 * Returns: rate flags which apply for this channel
645 static inline enum ieee80211_rate_flags
646 ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
648 switch (chandef->width) {
649 case NL80211_CHAN_WIDTH_5:
650 return IEEE80211_RATE_SUPPORTS_5MHZ;
651 case NL80211_CHAN_WIDTH_10:
652 return IEEE80211_RATE_SUPPORTS_10MHZ;
660 * ieee80211_chandef_max_power - maximum transmission power for the chandef
662 * In some regulations, the transmit power may depend on the configured channel
663 * bandwidth which may be defined as dBm/MHz. This function returns the actual
664 * max_power for non-standard (20 MHz) channels.
666 * @chandef: channel definition for the channel
668 * Returns: maximum allowed transmission power in dBm for the chandef
671 ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
673 switch (chandef->width) {
674 case NL80211_CHAN_WIDTH_5:
675 return min(chandef->chan->max_reg_power - 6,
676 chandef->chan->max_power);
677 case NL80211_CHAN_WIDTH_10:
678 return min(chandef->chan->max_reg_power - 3,
679 chandef->chan->max_power);
683 return chandef->chan->max_power;
687 * enum survey_info_flags - survey information flags
689 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
690 * @SURVEY_INFO_IN_USE: channel is currently being used
691 * @SURVEY_INFO_TIME: active time (in ms) was filled in
692 * @SURVEY_INFO_TIME_BUSY: busy time was filled in
693 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
694 * @SURVEY_INFO_TIME_RX: receive time was filled in
695 * @SURVEY_INFO_TIME_TX: transmit time was filled in
696 * @SURVEY_INFO_TIME_SCAN: scan time was filled in
698 * Used by the driver to indicate which info in &struct survey_info
699 * it has filled in during the get_survey().
701 enum survey_info_flags {
702 SURVEY_INFO_NOISE_DBM = BIT(0),
703 SURVEY_INFO_IN_USE = BIT(1),
704 SURVEY_INFO_TIME = BIT(2),
705 SURVEY_INFO_TIME_BUSY = BIT(3),
706 SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
707 SURVEY_INFO_TIME_RX = BIT(5),
708 SURVEY_INFO_TIME_TX = BIT(6),
709 SURVEY_INFO_TIME_SCAN = BIT(7),
713 * struct survey_info - channel survey response
715 * @channel: the channel this survey record reports, may be %NULL for a single
716 * record to report global statistics
717 * @filled: bitflag of flags from &enum survey_info_flags
718 * @noise: channel noise in dBm. This and all following fields are
720 * @time: amount of time in ms the radio was turn on (on the channel)
721 * @time_busy: amount of time the primary channel was sensed busy
722 * @time_ext_busy: amount of time the extension channel was sensed busy
723 * @time_rx: amount of time the radio spent receiving data
724 * @time_tx: amount of time the radio spent transmitting data
725 * @time_scan: amount of time the radio spent for scanning
727 * Used by dump_survey() to report back per-channel survey information.
729 * This structure can later be expanded with things like
730 * channel duty cycle etc.
733 struct ieee80211_channel *channel;
744 #define CFG80211_MAX_WEP_KEYS 4
747 * struct cfg80211_crypto_settings - Crypto settings
748 * @wpa_versions: indicates which, if any, WPA versions are enabled
749 * (from enum nl80211_wpa_versions)
750 * @cipher_group: group key cipher suite (or 0 if unset)
751 * @n_ciphers_pairwise: number of AP supported unicast ciphers
752 * @ciphers_pairwise: unicast key cipher suites
753 * @n_akm_suites: number of AKM suites
754 * @akm_suites: AKM suites
755 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
756 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
757 * required to assume that the port is unauthorized until authorized by
758 * user space. Otherwise, port is marked authorized by default.
759 * @control_port_ethertype: the control port protocol that should be
760 * allowed through even on unauthorized ports
761 * @control_port_no_encrypt: TRUE to prevent encryption of control port
763 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
764 * port frames over NL80211 instead of the network interface.
765 * @wep_keys: static WEP keys, if not NULL points to an array of
766 * CFG80211_MAX_WEP_KEYS WEP keys
767 * @wep_tx_key: key index (0..3) of the default TX static WEP key
768 * @psk: PSK (for devices supporting 4-way-handshake offload)
769 * @sae_pwd: password for SAE authentication (for devices supporting SAE
771 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
773 struct cfg80211_crypto_settings {
776 int n_ciphers_pairwise;
777 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
779 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
781 __be16 control_port_ethertype;
782 bool control_port_no_encrypt;
783 bool control_port_over_nl80211;
784 struct key_params *wep_keys;
792 * struct cfg80211_beacon_data - beacon data
793 * @head: head portion of beacon (before TIM IE)
794 * or %NULL if not changed
795 * @tail: tail portion of beacon (after TIM IE)
796 * or %NULL if not changed
797 * @head_len: length of @head
798 * @tail_len: length of @tail
799 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
800 * @beacon_ies_len: length of beacon_ies in octets
801 * @proberesp_ies: extra information element(s) to add into Probe Response
803 * @proberesp_ies_len: length of proberesp_ies in octets
804 * @assocresp_ies: extra information element(s) to add into (Re)Association
805 * Response frames or %NULL
806 * @assocresp_ies_len: length of assocresp_ies in octets
807 * @probe_resp_len: length of probe response template (@probe_resp)
808 * @probe_resp: probe response template (AP mode only)
809 * @ftm_responder: enable FTM responder functionality; -1 for no change
810 * (which also implies no change in LCI/civic location data)
811 * @lci: Measurement Report element content, starting with Measurement Token
812 * (measurement type 8)
813 * @civicloc: Measurement Report element content, starting with Measurement
814 * Token (measurement type 11)
815 * @lci_len: LCI data length
816 * @civicloc_len: Civic location data length
818 struct cfg80211_beacon_data {
819 const u8 *head, *tail;
820 const u8 *beacon_ies;
821 const u8 *proberesp_ies;
822 const u8 *assocresp_ies;
823 const u8 *probe_resp;
828 size_t head_len, tail_len;
829 size_t beacon_ies_len;
830 size_t proberesp_ies_len;
831 size_t assocresp_ies_len;
832 size_t probe_resp_len;
842 * struct cfg80211_acl_data - Access control list data
844 * @acl_policy: ACL policy to be applied on the station's
845 * entry specified by mac_addr
846 * @n_acl_entries: Number of MAC address entries passed
847 * @mac_addrs: List of MAC addresses of stations to be used for ACL
849 struct cfg80211_acl_data {
850 enum nl80211_acl_policy acl_policy;
854 struct mac_address mac_addrs[];
858 * cfg80211_bitrate_mask - masks for bitrate control
860 struct cfg80211_bitrate_mask {
863 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
864 u16 vht_mcs[NL80211_VHT_NSS_MAX];
865 enum nl80211_txrate_gi gi;
866 } control[NUM_NL80211_BANDS];
870 * enum cfg80211_ap_settings_flags - AP settings flags
872 * Used by cfg80211_ap_settings
874 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
876 enum cfg80211_ap_settings_flags {
877 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
881 * struct cfg80211_ap_settings - AP configuration
883 * Used to configure an AP interface.
885 * @chandef: defines the channel to use
886 * @beacon: beacon data
887 * @beacon_interval: beacon interval
888 * @dtim_period: DTIM period
889 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
891 * @ssid_len: length of @ssid
892 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
893 * @crypto: crypto settings
894 * @privacy: the BSS uses privacy
895 * @auth_type: Authentication type (algorithm)
896 * @smps_mode: SMPS mode
897 * @inactivity_timeout: time in seconds to determine station's inactivity.
898 * @p2p_ctwindow: P2P CT Window
899 * @p2p_opp_ps: P2P opportunistic PS
900 * @acl: ACL configuration used by the drivers which has support for
901 * MAC address based access control
902 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
904 * @beacon_rate: bitrate to be used for beacons
905 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
906 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
907 * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
908 * @ht_required: stations must support HT
909 * @vht_required: stations must support VHT
910 * @twt_responder: Enable Target Wait Time
911 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
912 * @he_obss_pd: OBSS Packet Detection settings
914 struct cfg80211_ap_settings {
915 struct cfg80211_chan_def chandef;
917 struct cfg80211_beacon_data beacon;
919 int beacon_interval, dtim_period;
922 enum nl80211_hidden_ssid hidden_ssid;
923 struct cfg80211_crypto_settings crypto;
925 enum nl80211_auth_type auth_type;
926 enum nl80211_smps_mode smps_mode;
927 int inactivity_timeout;
930 const struct cfg80211_acl_data *acl;
932 struct cfg80211_bitrate_mask beacon_rate;
934 const struct ieee80211_ht_cap *ht_cap;
935 const struct ieee80211_vht_cap *vht_cap;
936 const struct ieee80211_he_cap_elem *he_cap;
937 bool ht_required, vht_required;
940 struct ieee80211_he_obss_pd he_obss_pd;
944 * struct cfg80211_csa_settings - channel switch settings
946 * Used for channel switch
948 * @chandef: defines the channel to use after the switch
949 * @beacon_csa: beacon data while performing the switch
950 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
951 * @counter_offsets_presp: offsets of the counters within the probe response
952 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
953 * @n_counter_offsets_presp: number of csa counters in the probe response
954 * @beacon_after: beacon data to be used on the new channel
955 * @radar_required: whether radar detection is required on the new channel
956 * @block_tx: whether transmissions should be blocked while changing
957 * @count: number of beacons until switch
959 struct cfg80211_csa_settings {
960 struct cfg80211_chan_def chandef;
961 struct cfg80211_beacon_data beacon_csa;
962 const u16 *counter_offsets_beacon;
963 const u16 *counter_offsets_presp;
964 unsigned int n_counter_offsets_beacon;
965 unsigned int n_counter_offsets_presp;
966 struct cfg80211_beacon_data beacon_after;
972 #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
975 * struct iface_combination_params - input parameters for interface combinations
977 * Used to pass interface combination parameters
979 * @num_different_channels: the number of different channels we want
980 * to use for verification
981 * @radar_detect: a bitmap where each bit corresponds to a channel
982 * width where radar detection is needed, as in the definition of
983 * &struct ieee80211_iface_combination.@radar_detect_widths
984 * @iftype_num: array with the number of interfaces of each interface
985 * type. The index is the interface type as specified in &enum
987 * @new_beacon_int: set this to the beacon interval of a new interface
988 * that's not operating yet, if such is to be checked as part of
991 struct iface_combination_params {
992 int num_different_channels;
994 int iftype_num[NUM_NL80211_IFTYPES];
999 * enum station_parameters_apply_mask - station parameter values to apply
1000 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
1001 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1002 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
1004 * Not all station parameters have in-band "no change" signalling,
1005 * for those that don't these flags will are used.
1007 enum station_parameters_apply_mask {
1008 STATION_PARAM_APPLY_UAPSD = BIT(0),
1009 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1010 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1011 STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1015 * struct sta_txpwr - station txpower configuration
1017 * Used to configure txpower for station.
1019 * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1020 * is not provided, the default per-interface tx power setting will be
1021 * overriding. Driver should be picking up the lowest tx power, either tx
1022 * power per-interface or per-station.
1023 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1024 * will be less than or equal to specified from userspace, whereas if TPC
1025 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1026 * NL80211_TX_POWER_FIXED is not a valid configuration option for
1031 enum nl80211_tx_power_setting type;
1035 * struct station_parameters - station parameters
1037 * Used to change and create a new station.
1039 * @vlan: vlan interface station should belong to
1040 * @supported_rates: supported rates in IEEE 802.11 format
1041 * (or NULL for no change)
1042 * @supported_rates_len: number of supported rates
1043 * @sta_flags_mask: station flags that changed
1044 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1045 * @sta_flags_set: station flags values
1046 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1047 * @listen_interval: listen interval or -1 for no change
1048 * @aid: AID or zero for no change
1049 * @peer_aid: mesh peer AID or zero for no change
1050 * @plink_action: plink action to take
1051 * @plink_state: set the peer link state for a station
1052 * @ht_capa: HT capabilities of station
1053 * @vht_capa: VHT capabilities of station
1054 * @uapsd_queues: bitmap of queues configured for uapsd. same format
1055 * as the AC bitmap in the QoS info field
1056 * @max_sp: max Service Period. same format as the MAX_SP in the
1057 * QoS info field (but already shifted down)
1058 * @sta_modify_mask: bitmap indicating which parameters changed
1059 * (for those that don't have a natural "no change" value),
1060 * see &enum station_parameters_apply_mask
1061 * @local_pm: local link-specific mesh power save mode (no change when set
1063 * @capability: station capability
1064 * @ext_capab: extended capabilities of the station
1065 * @ext_capab_len: number of extended capabilities
1066 * @supported_channels: supported channels in IEEE 802.11 format
1067 * @supported_channels_len: number of supported channels
1068 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1069 * @supported_oper_classes_len: number of supported operating classes
1070 * @opmode_notif: operating mode field from Operating Mode Notification
1071 * @opmode_notif_used: information if operating mode field is used
1072 * @support_p2p_ps: information if station supports P2P PS mechanism
1073 * @he_capa: HE capabilities of station
1074 * @he_capa_len: the length of the HE capabilities
1075 * @airtime_weight: airtime scheduler weight for this station
1077 struct station_parameters {
1078 const u8 *supported_rates;
1079 struct net_device *vlan;
1080 u32 sta_flags_mask, sta_flags_set;
1081 u32 sta_modify_mask;
1082 int listen_interval;
1085 u8 supported_rates_len;
1088 const struct ieee80211_ht_cap *ht_capa;
1089 const struct ieee80211_vht_cap *vht_capa;
1092 enum nl80211_mesh_power_mode local_pm;
1094 const u8 *ext_capab;
1096 const u8 *supported_channels;
1097 u8 supported_channels_len;
1098 const u8 *supported_oper_classes;
1099 u8 supported_oper_classes_len;
1101 bool opmode_notif_used;
1103 const struct ieee80211_he_cap_elem *he_capa;
1106 struct sta_txpwr txpwr;
1110 * struct station_del_parameters - station deletion parameters
1112 * Used to delete a station entry (or all stations).
1114 * @mac: MAC address of the station to remove or NULL to remove all stations
1115 * @subtype: Management frame subtype to use for indicating removal
1116 * (10 = Disassociation, 12 = Deauthentication)
1117 * @reason_code: Reason code for the Disassociation/Deauthentication frame
1119 struct station_del_parameters {
1126 * enum cfg80211_station_type - the type of station being modified
1127 * @CFG80211_STA_AP_CLIENT: client of an AP interface
1128 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
1129 * unassociated (update properties for this type of client is permitted)
1130 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
1131 * the AP MLME in the device
1132 * @CFG80211_STA_AP_STA: AP station on managed interface
1133 * @CFG80211_STA_IBSS: IBSS station
1134 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
1135 * while TDLS setup is in progress, it moves out of this state when
1136 * being marked authorized; use this only if TDLS with external setup is
1138 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
1139 * entry that is operating, has been marked authorized by userspace)
1140 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1141 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
1143 enum cfg80211_station_type {
1144 CFG80211_STA_AP_CLIENT,
1145 CFG80211_STA_AP_CLIENT_UNASSOC,
1146 CFG80211_STA_AP_MLME_CLIENT,
1147 CFG80211_STA_AP_STA,
1149 CFG80211_STA_TDLS_PEER_SETUP,
1150 CFG80211_STA_TDLS_PEER_ACTIVE,
1151 CFG80211_STA_MESH_PEER_KERNEL,
1152 CFG80211_STA_MESH_PEER_USER,
1156 * cfg80211_check_station_change - validate parameter changes
1157 * @wiphy: the wiphy this operates on
1158 * @params: the new parameters for a station
1159 * @statype: the type of station being modified
1161 * Utility function for the @change_station driver method. Call this function
1162 * with the appropriate station type looking up the station (and checking that
1163 * it exists). It will verify whether the station change is acceptable, and if
1164 * not will return an error code. Note that it may modify the parameters for
1165 * backward compatibility reasons, so don't use them before calling this.
1167 int cfg80211_check_station_change(struct wiphy *wiphy,
1168 struct station_parameters *params,
1169 enum cfg80211_station_type statype);
1172 * enum station_info_rate_flags - bitrate info flags
1174 * Used by the driver to indicate the specific rate transmission
1175 * type for 802.11n transmissions.
1177 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1178 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1179 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
1180 * @RATE_INFO_FLAGS_60G: 60GHz MCS
1181 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
1183 enum rate_info_flags {
1184 RATE_INFO_FLAGS_MCS = BIT(0),
1185 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
1186 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
1187 RATE_INFO_FLAGS_60G = BIT(3),
1188 RATE_INFO_FLAGS_HE_MCS = BIT(4),
1192 * enum rate_info_bw - rate bandwidth information
1194 * Used by the driver to indicate the rate bandwidth.
1196 * @RATE_INFO_BW_5: 5 MHz bandwidth
1197 * @RATE_INFO_BW_10: 10 MHz bandwidth
1198 * @RATE_INFO_BW_20: 20 MHz bandwidth
1199 * @RATE_INFO_BW_40: 40 MHz bandwidth
1200 * @RATE_INFO_BW_80: 80 MHz bandwidth
1201 * @RATE_INFO_BW_160: 160 MHz bandwidth
1202 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1205 RATE_INFO_BW_20 = 0,
1215 * struct rate_info - bitrate information
1217 * Information about a receiving or transmitting bitrate
1219 * @flags: bitflag of flags from &enum rate_info_flags
1220 * @mcs: mcs index if struct describes an HT/VHT/HE rate
1221 * @legacy: bitrate in 100kbit/s for 802.11abg
1222 * @nss: number of streams (VHT & HE only)
1223 * @bw: bandwidth (from &enum rate_info_bw)
1224 * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1225 * @he_dcm: HE DCM value
1226 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1227 * only valid if bw is %RATE_INFO_BW_HE_RU)
1241 * enum station_info_rate_flags - bitrate info flags
1243 * Used by the driver to indicate the specific rate transmission
1244 * type for 802.11n transmissions.
1246 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1247 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1248 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1250 enum bss_param_flags {
1251 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1252 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1253 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1257 * struct sta_bss_parameters - BSS parameters for the attached station
1259 * Information about the currently associated BSS
1261 * @flags: bitflag of flags from &enum bss_param_flags
1262 * @dtim_period: DTIM period for the BSS
1263 * @beacon_interval: beacon interval
1265 struct sta_bss_parameters {
1268 u16 beacon_interval;
1272 * struct cfg80211_txq_stats - TXQ statistics for this TID
1273 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1274 * indicate the relevant values in this struct are filled
1275 * @backlog_bytes: total number of bytes currently backlogged
1276 * @backlog_packets: total number of packets currently backlogged
1277 * @flows: number of new flows seen
1278 * @drops: total number of packets dropped
1279 * @ecn_marks: total number of packets marked with ECN CE
1280 * @overlimit: number of drops due to queue space overflow
1281 * @overmemory: number of drops due to memory limit overflow
1282 * @collisions: number of hash collisions
1283 * @tx_bytes: total number of bytes dequeued
1284 * @tx_packets: total number of packets dequeued
1285 * @max_flows: maximum number of flows supported
1287 struct cfg80211_txq_stats {
1290 u32 backlog_packets;
1303 * struct cfg80211_tid_stats - per-TID statistics
1304 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1305 * indicate the relevant values in this struct are filled
1306 * @rx_msdu: number of received MSDUs
1307 * @tx_msdu: number of (attempted) transmitted MSDUs
1308 * @tx_msdu_retries: number of retries (not counting the first) for
1310 * @tx_msdu_failed: number of failed transmitted MSDUs
1311 * @txq_stats: TXQ statistics
1313 struct cfg80211_tid_stats {
1317 u64 tx_msdu_retries;
1319 struct cfg80211_txq_stats txq_stats;
1322 #define IEEE80211_MAX_CHAINS 4
1325 * struct station_info - station information
1327 * Station information filled by driver for get_station() and dump_station.
1329 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1330 * indicate the relevant values in this struct for them
1331 * @connected_time: time(in secs) since a station is last connected
1332 * @inactive_time: time since last station activity (tx/rx) in milliseconds
1333 * @rx_bytes: bytes (size of MPDUs) received from this station
1334 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
1335 * @llid: mesh local link id
1336 * @plid: mesh peer link id
1337 * @plink_state: mesh peer link state
1338 * @signal: The signal strength, type depends on the wiphy's signal_type.
1339 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1340 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1341 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1342 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1343 * @chain_signal: per-chain signal strength of last received packet in dBm
1344 * @chain_signal_avg: per-chain signal strength average in dBm
1345 * @txrate: current unicast bitrate from this station
1346 * @rxrate: current unicast bitrate to this station
1347 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1348 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1349 * @tx_retries: cumulative retry counts (MPDUs)
1350 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
1351 * @rx_dropped_misc: Dropped for un-specified reason.
1352 * @bss_param: current BSS parameters
1353 * @generation: generation number for nl80211 dumps.
1354 * This number should increase every time the list of stations
1355 * changes, i.e. when a station is added or removed, so that
1356 * userspace can tell whether it got a consistent snapshot.
1357 * @assoc_req_ies: IEs from (Re)Association Request.
1358 * This is used only when in AP mode with drivers that do not use
1359 * user space MLME/SME implementation. The information is provided for
1360 * the cfg80211_new_sta() calls to notify user space of the IEs.
1361 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1362 * @sta_flags: station flags mask & values
1363 * @beacon_loss_count: Number of times beacon loss event has triggered.
1364 * @t_offset: Time offset of the station relative to this host.
1365 * @local_pm: local mesh STA power save mode
1366 * @peer_pm: peer mesh STA power save mode
1367 * @nonpeer_pm: non-peer mesh STA power save mode
1368 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1369 * towards this station.
1370 * @rx_beacon: number of beacons received from this peer
1371 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1373 * @connected_to_gate: true if mesh STA has a path to mesh gate
1374 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
1375 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
1376 * @airtime_weight: current airtime scheduling weight
1377 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1378 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1379 * Note that this doesn't use the @filled bit, but is used if non-NULL.
1380 * @ack_signal: signal strength (in dBm) of the last ACK frame.
1381 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1383 * @rx_mpdu_count: number of MPDUs received from this station
1384 * @fcs_err_count: number of packets (MPDUs) received from this station with
1385 * an FCS error. This counter should be incremented only when TA of the
1386 * received packet with an FCS error matches the peer MAC address.
1387 * @airtime_link_metric: mesh airtime link metric.
1389 struct station_info {
1402 s8 chain_signal[IEEE80211_MAX_CHAINS];
1403 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1405 struct rate_info txrate;
1406 struct rate_info rxrate;
1411 u32 rx_dropped_misc;
1412 struct sta_bss_parameters bss_param;
1413 struct nl80211_sta_flag_update sta_flags;
1417 const u8 *assoc_req_ies;
1418 size_t assoc_req_ies_len;
1420 u32 beacon_loss_count;
1422 enum nl80211_mesh_power_mode local_pm;
1423 enum nl80211_mesh_power_mode peer_pm;
1424 enum nl80211_mesh_power_mode nonpeer_pm;
1426 u32 expected_throughput;
1431 u8 rx_beacon_signal_avg;
1432 u8 connected_to_gate;
1434 struct cfg80211_tid_stats *pertid;
1443 u32 airtime_link_metric;
1446 #if IS_ENABLED(CONFIG_CFG80211)
1448 * cfg80211_get_station - retrieve information about a given station
1449 * @dev: the device where the station is supposed to be connected to
1450 * @mac_addr: the mac address of the station of interest
1451 * @sinfo: pointer to the structure to fill with the information
1453 * Returns 0 on success and sinfo is filled with the available information
1454 * otherwise returns a negative error code and the content of sinfo has to be
1455 * considered undefined.
1457 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1458 struct station_info *sinfo);
1460 static inline int cfg80211_get_station(struct net_device *dev,
1462 struct station_info *sinfo)
1469 * enum monitor_flags - monitor flags
1471 * Monitor interface configuration flags. Note that these must be the bits
1472 * according to the nl80211 flags.
1474 * @MONITOR_FLAG_CHANGED: set if the flags were changed
1475 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1476 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1477 * @MONITOR_FLAG_CONTROL: pass control frames
1478 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1479 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1480 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
1482 enum monitor_flags {
1483 MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
1484 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1485 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1486 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1487 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1488 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1489 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
1493 * enum mpath_info_flags - mesh path information flags
1495 * Used by the driver to indicate which info in &struct mpath_info it has filled
1496 * in during get_station() or dump_station().
1498 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1499 * @MPATH_INFO_SN: @sn filled
1500 * @MPATH_INFO_METRIC: @metric filled
1501 * @MPATH_INFO_EXPTIME: @exptime filled
1502 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1503 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1504 * @MPATH_INFO_FLAGS: @flags filled
1505 * @MPATH_INFO_HOP_COUNT: @hop_count filled
1506 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
1508 enum mpath_info_flags {
1509 MPATH_INFO_FRAME_QLEN = BIT(0),
1510 MPATH_INFO_SN = BIT(1),
1511 MPATH_INFO_METRIC = BIT(2),
1512 MPATH_INFO_EXPTIME = BIT(3),
1513 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1514 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1515 MPATH_INFO_FLAGS = BIT(6),
1516 MPATH_INFO_HOP_COUNT = BIT(7),
1517 MPATH_INFO_PATH_CHANGE = BIT(8),
1521 * struct mpath_info - mesh path information
1523 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1525 * @filled: bitfield of flags from &enum mpath_info_flags
1526 * @frame_qlen: number of queued frames for this destination
1527 * @sn: target sequence number
1528 * @metric: metric (cost) of this mesh path
1529 * @exptime: expiration time for the mesh path from now, in msecs
1530 * @flags: mesh path flags
1531 * @discovery_timeout: total mesh path discovery timeout, in msecs
1532 * @discovery_retries: mesh path discovery retries
1533 * @generation: generation number for nl80211 dumps.
1534 * This number should increase every time the list of mesh paths
1535 * changes, i.e. when a station is added or removed, so that
1536 * userspace can tell whether it got a consistent snapshot.
1537 * @hop_count: hops to destination
1538 * @path_change_count: total number of path changes to destination
1546 u32 discovery_timeout;
1547 u8 discovery_retries;
1550 u32 path_change_count;
1556 * struct bss_parameters - BSS parameters
1558 * Used to change BSS parameters (mainly for AP mode).
1560 * @use_cts_prot: Whether to use CTS protection
1561 * (0 = no, 1 = yes, -1 = do not change)
1562 * @use_short_preamble: Whether the use of short preambles is allowed
1563 * (0 = no, 1 = yes, -1 = do not change)
1564 * @use_short_slot_time: Whether the use of short slot time is allowed
1565 * (0 = no, 1 = yes, -1 = do not change)
1566 * @basic_rates: basic rates in IEEE 802.11 format
1567 * (or NULL for no change)
1568 * @basic_rates_len: number of basic rates
1569 * @ap_isolate: do not forward packets between connected stations
1570 * @ht_opmode: HT Operation mode
1571 * (u16 = opmode, -1 = do not change)
1572 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1573 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
1575 struct bss_parameters {
1577 int use_short_preamble;
1578 int use_short_slot_time;
1579 const u8 *basic_rates;
1583 s8 p2p_ctwindow, p2p_opp_ps;
1587 * struct mesh_config - 802.11s mesh configuration
1589 * These parameters can be changed while the mesh is active.
1591 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1592 * by the Mesh Peering Open message
1593 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1594 * used by the Mesh Peering Open message
1595 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1596 * the mesh peering management to close a mesh peering
1597 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1599 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1600 * be sent to establish a new peer link instance in a mesh
1601 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1602 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1604 * @auto_open_plinks: whether we should automatically open peer links when we
1605 * detect compatible mesh peers
1606 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1607 * synchronize to for 11s default synchronization method
1608 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1609 * that an originator mesh STA can send to a particular path target
1610 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1611 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1612 * a path discovery in milliseconds
1613 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1614 * receiving a PREQ shall consider the forwarding information from the
1615 * root to be valid. (TU = time unit)
1616 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1617 * which a mesh STA can send only one action frame containing a PREQ
1619 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1620 * which a mesh STA can send only one Action frame containing a PERR
1622 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1623 * it takes for an HWMP information element to propagate across the mesh
1624 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1625 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1626 * announcements are transmitted
1627 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1628 * station has access to a broader network beyond the MBSS. (This is
1629 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1630 * only means that the station will announce others it's a mesh gate, but
1631 * not necessarily using the gate announcement protocol. Still keeping the
1632 * same nomenclature to be in sync with the spec)
1633 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1634 * entity (default is TRUE - forwarding entity)
1635 * @rssi_threshold: the threshold for average signal strength of candidate
1636 * station to establish a peer link
1637 * @ht_opmode: mesh HT protection mode
1639 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1640 * receiving a proactive PREQ shall consider the forwarding information to
1641 * the root mesh STA to be valid.
1643 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1644 * PREQs are transmitted.
1645 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1646 * during which a mesh STA can send only one Action frame containing
1647 * a PREQ element for root path confirmation.
1648 * @power_mode: The default mesh power save mode which will be the initial
1649 * setting for new peer links.
1650 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1651 * after transmitting its beacon.
1652 * @plink_timeout: If no tx activity is seen from a STA we've established
1653 * peering with for longer than this time (in seconds), then remove it
1654 * from the STA's list of peers. Default is 30 minutes.
1655 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
1656 * connected to a mesh gate in mesh formation info. If false, the
1657 * value in mesh formation is determined by the presence of root paths
1658 * in the mesh path table
1660 struct mesh_config {
1661 u16 dot11MeshRetryTimeout;
1662 u16 dot11MeshConfirmTimeout;
1663 u16 dot11MeshHoldingTimeout;
1664 u16 dot11MeshMaxPeerLinks;
1665 u8 dot11MeshMaxRetries;
1668 bool auto_open_plinks;
1669 u32 dot11MeshNbrOffsetMaxNeighbor;
1670 u8 dot11MeshHWMPmaxPREQretries;
1671 u32 path_refresh_time;
1672 u16 min_discovery_timeout;
1673 u32 dot11MeshHWMPactivePathTimeout;
1674 u16 dot11MeshHWMPpreqMinInterval;
1675 u16 dot11MeshHWMPperrMinInterval;
1676 u16 dot11MeshHWMPnetDiameterTraversalTime;
1677 u8 dot11MeshHWMPRootMode;
1678 bool dot11MeshConnectedToMeshGate;
1679 u16 dot11MeshHWMPRannInterval;
1680 bool dot11MeshGateAnnouncementProtocol;
1681 bool dot11MeshForwarding;
1684 u32 dot11MeshHWMPactivePathToRootTimeout;
1685 u16 dot11MeshHWMProotInterval;
1686 u16 dot11MeshHWMPconfirmationInterval;
1687 enum nl80211_mesh_power_mode power_mode;
1688 u16 dot11MeshAwakeWindowDuration;
1693 * struct mesh_setup - 802.11s mesh setup configuration
1694 * @chandef: defines the channel to use
1695 * @mesh_id: the mesh ID
1696 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1697 * @sync_method: which synchronization method to use
1698 * @path_sel_proto: which path selection protocol to use
1699 * @path_metric: which metric to use
1700 * @auth_id: which authentication method this mesh is using
1701 * @ie: vendor information elements (optional)
1702 * @ie_len: length of vendor information elements
1703 * @is_authenticated: this mesh requires authentication
1704 * @is_secure: this mesh uses security
1705 * @user_mpm: userspace handles all MPM functions
1706 * @dtim_period: DTIM period to use
1707 * @beacon_interval: beacon interval to use
1708 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1709 * @basic_rates: basic rates to use when creating the mesh
1710 * @beacon_rate: bitrate to be used for beacons
1711 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1712 * changes the channel when a radar is detected. This is required
1713 * to operate on DFS channels.
1714 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
1715 * port frames over NL80211 instead of the network interface.
1717 * These parameters are fixed when the mesh is created.
1720 struct cfg80211_chan_def chandef;
1729 bool is_authenticated;
1733 u16 beacon_interval;
1734 int mcast_rate[NUM_NL80211_BANDS];
1736 struct cfg80211_bitrate_mask beacon_rate;
1737 bool userspace_handles_dfs;
1738 bool control_port_over_nl80211;
1742 * struct ocb_setup - 802.11p OCB mode setup configuration
1743 * @chandef: defines the channel to use
1745 * These parameters are fixed when connecting to the network
1748 struct cfg80211_chan_def chandef;
1752 * struct ieee80211_txq_params - TX queue parameters
1753 * @ac: AC identifier
1754 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
1755 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
1757 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
1759 * @aifs: Arbitration interframe space [0..255]
1761 struct ieee80211_txq_params {
1770 * DOC: Scanning and BSS list handling
1772 * The scanning process itself is fairly simple, but cfg80211 offers quite
1773 * a bit of helper functionality. To start a scan, the scan operation will
1774 * be invoked with a scan definition. This scan definition contains the
1775 * channels to scan, and the SSIDs to send probe requests for (including the
1776 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1777 * probe. Additionally, a scan request may contain extra information elements
1778 * that should be added to the probe request. The IEs are guaranteed to be
1779 * well-formed, and will not exceed the maximum length the driver advertised
1780 * in the wiphy structure.
1782 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1783 * it is responsible for maintaining the BSS list; the driver should not
1784 * maintain a list itself. For this notification, various functions exist.
1786 * Since drivers do not maintain a BSS list, there are also a number of
1787 * functions to search for a BSS and obtain information about it from the
1788 * BSS structure cfg80211 maintains. The BSS list is also made available
1793 * struct cfg80211_ssid - SSID description
1795 * @ssid_len: length of the ssid
1797 struct cfg80211_ssid {
1798 u8 ssid[IEEE80211_MAX_SSID_LEN];
1803 * struct cfg80211_scan_info - information about completed scan
1804 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
1805 * wireless device that requested the scan is connected to. If this
1806 * information is not available, this field is left zero.
1807 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
1808 * @aborted: set to true if the scan was aborted for any reason,
1809 * userspace will be notified of that
1811 struct cfg80211_scan_info {
1813 u8 tsf_bssid[ETH_ALEN] __aligned(2);
1818 * struct cfg80211_scan_request - scan request description
1820 * @ssids: SSIDs to scan for (active scan only)
1821 * @n_ssids: number of SSIDs
1822 * @channels: channels to scan on.
1823 * @n_channels: total number of channels to scan
1824 * @scan_width: channel width for scanning
1825 * @ie: optional information element(s) to add into Probe Request or %NULL
1826 * @ie_len: length of ie in octets
1827 * @duration: how long to listen on each channel, in TUs. If
1828 * %duration_mandatory is not set, this is the maximum dwell time and
1829 * the actual dwell time may be shorter.
1830 * @duration_mandatory: if set, the scan duration must be as specified by the
1832 * @flags: bit field of flags controlling operation
1833 * @rates: bitmap of rates to advertise for each band
1834 * @wiphy: the wiphy this was for
1835 * @scan_start: time (in jiffies) when the scan started
1836 * @wdev: the wireless device to scan for
1837 * @info: (internal) information about completed scan
1838 * @notified: (internal) scan request was notified as done or aborted
1839 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1840 * @mac_addr: MAC address used with randomisation
1841 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1842 * are 0 in the mask should be randomised, bits that are 1 should
1843 * be taken from the @mac_addr
1844 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
1846 struct cfg80211_scan_request {
1847 struct cfg80211_ssid *ssids;
1850 enum nl80211_bss_scan_width scan_width;
1854 bool duration_mandatory;
1857 u32 rates[NUM_NL80211_BANDS];
1859 struct wireless_dev *wdev;
1861 u8 mac_addr[ETH_ALEN] __aligned(2);
1862 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1863 u8 bssid[ETH_ALEN] __aligned(2);
1866 struct wiphy *wiphy;
1867 unsigned long scan_start;
1868 struct cfg80211_scan_info info;
1873 struct ieee80211_channel *channels[0];
1876 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
1880 get_random_bytes(buf, ETH_ALEN);
1881 for (i = 0; i < ETH_ALEN; i++) {
1883 buf[i] |= addr[i] & mask[i];
1888 * struct cfg80211_match_set - sets of attributes to match
1890 * @ssid: SSID to be matched; may be zero-length in case of BSSID match
1891 * or no match (RSSI only)
1892 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
1893 * or no match (RSSI only)
1894 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1895 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
1896 * for filtering out scan results received. Drivers advertize this support
1897 * of band specific rssi based filtering through the feature capability
1898 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
1899 * specific rssi thresholds take precedence over rssi_thold, if specified.
1900 * If not specified for any band, it will be assigned with rssi_thold of
1901 * corresponding matchset.
1903 struct cfg80211_match_set {
1904 struct cfg80211_ssid ssid;
1907 s32 per_band_rssi_thold[NUM_NL80211_BANDS];
1911 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
1913 * @interval: interval between scheduled scan iterations. In seconds.
1914 * @iterations: number of scan iterations in this scan plan. Zero means
1916 * The last scan plan will always have this parameter set to zero,
1917 * all other scan plans will have a finite number of iterations.
1919 struct cfg80211_sched_scan_plan {
1925 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
1927 * @band: band of BSS which should match for RSSI level adjustment.
1928 * @delta: value of RSSI level adjustment.
1930 struct cfg80211_bss_select_adjust {
1931 enum nl80211_band band;
1936 * struct cfg80211_sched_scan_request - scheduled scan request description
1938 * @reqid: identifies this request.
1939 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1940 * @n_ssids: number of SSIDs
1941 * @n_channels: total number of channels to scan
1942 * @scan_width: channel width for scanning
1943 * @ie: optional information element(s) to add into Probe Request or %NULL
1944 * @ie_len: length of ie in octets
1945 * @flags: bit field of flags controlling operation
1946 * @match_sets: sets of parameters to be matched for a scan result
1947 * entry to be considered valid and to be passed to the host
1948 * (others are filtered out).
1949 * If ommited, all results are passed.
1950 * @n_match_sets: number of match sets
1951 * @report_results: indicates that results were reported for this request
1952 * @wiphy: the wiphy this was for
1953 * @dev: the interface
1954 * @scan_start: start time of the scheduled scan
1955 * @channels: channels to scan
1956 * @min_rssi_thold: for drivers only supporting a single threshold, this
1957 * contains the minimum over all matchsets
1958 * @mac_addr: MAC address used with randomisation
1959 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1960 * are 0 in the mask should be randomised, bits that are 1 should
1961 * be taken from the @mac_addr
1962 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
1963 * index must be executed first.
1964 * @n_scan_plans: number of scan plans, at least 1.
1965 * @rcu_head: RCU callback used to free the struct
1966 * @owner_nlportid: netlink portid of owner (if this should is a request
1967 * owned by a particular socket)
1968 * @nl_owner_dead: netlink owner socket was closed - this request be freed
1969 * @list: for keeping list of requests.
1970 * @delay: delay in seconds to use before starting the first scan
1971 * cycle. The driver may ignore this parameter and start
1972 * immediately (or at any other time), if this feature is not
1974 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
1975 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
1976 * reporting in connected state to cases where a matching BSS is determined
1977 * to have better or slightly worse RSSI than the current connected BSS.
1978 * The relative RSSI threshold values are ignored in disconnected state.
1979 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
1980 * to the specified band while deciding whether a better BSS is reported
1981 * using @relative_rssi. If delta is a negative number, the BSSs that
1982 * belong to the specified band will be penalized by delta dB in relative
1985 struct cfg80211_sched_scan_request {
1987 struct cfg80211_ssid *ssids;
1990 enum nl80211_bss_scan_width scan_width;
1994 struct cfg80211_match_set *match_sets;
1998 struct cfg80211_sched_scan_plan *scan_plans;
2001 u8 mac_addr[ETH_ALEN] __aligned(2);
2002 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2004 bool relative_rssi_set;
2006 struct cfg80211_bss_select_adjust rssi_adjust;
2009 struct wiphy *wiphy;
2010 struct net_device *dev;
2011 unsigned long scan_start;
2012 bool report_results;
2013 struct rcu_head rcu_head;
2016 struct list_head list;
2019 struct ieee80211_channel *channels[0];
2023 * enum cfg80211_signal_type - signal type
2025 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
2026 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
2027 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
2029 enum cfg80211_signal_type {
2030 CFG80211_SIGNAL_TYPE_NONE,
2031 CFG80211_SIGNAL_TYPE_MBM,
2032 CFG80211_SIGNAL_TYPE_UNSPEC,
2036 * struct cfg80211_inform_bss - BSS inform data
2037 * @chan: channel the frame was received on
2038 * @scan_width: scan width that was used
2039 * @signal: signal strength value, according to the wiphy's
2041 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
2042 * received; should match the time when the frame was actually
2043 * received by the device (not just by the host, in case it was
2044 * buffered on the device) and be accurate to about 10ms.
2045 * If the frame isn't buffered, just passing the return value of
2046 * ktime_get_boottime_ns() is likely appropriate.
2047 * @parent_tsf: the time at the start of reception of the first octet of the
2048 * timestamp field of the frame. The time is the TSF of the BSS specified
2050 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
2051 * the BSS that requested the scan in which the beacon/probe was received.
2052 * @chains: bitmask for filled values in @chain_signal.
2053 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2055 struct cfg80211_inform_bss {
2056 struct ieee80211_channel *chan;
2057 enum nl80211_bss_scan_width scan_width;
2061 u8 parent_bssid[ETH_ALEN] __aligned(2);
2063 s8 chain_signal[IEEE80211_MAX_CHAINS];
2067 * struct cfg80211_bss_ies - BSS entry IE data
2068 * @tsf: TSF contained in the frame that carried these IEs
2069 * @rcu_head: internal use, for freeing
2070 * @len: length of the IEs
2071 * @from_beacon: these IEs are known to come from a beacon
2074 struct cfg80211_bss_ies {
2076 struct rcu_head rcu_head;
2083 * struct cfg80211_bss - BSS description
2085 * This structure describes a BSS (which may also be a mesh network)
2086 * for use in scan results and similar.
2088 * @channel: channel this BSS is on
2089 * @scan_width: width of the control channel
2090 * @bssid: BSSID of the BSS
2091 * @beacon_interval: the beacon interval as from the frame
2092 * @capability: the capability field in host byte order
2093 * @ies: the information elements (Note that there is no guarantee that these
2094 * are well-formed!); this is a pointer to either the beacon_ies or
2095 * proberesp_ies depending on whether Probe Response frame has been
2096 * received. It is always non-%NULL.
2097 * @beacon_ies: the information elements from the last Beacon frame
2098 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
2099 * own the beacon_ies, but they're just pointers to the ones from the
2100 * @hidden_beacon_bss struct)
2101 * @proberesp_ies: the information elements from the last Probe Response frame
2102 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2103 * a BSS that hides the SSID in its beacon, this points to the BSS struct
2104 * that holds the beacon data. @beacon_ies is still valid, of course, and
2105 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
2106 * @transmitted_bss: pointer to the transmitted BSS, if this is a
2107 * non-transmitted one (multi-BSSID support)
2108 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2109 * (multi-BSSID support)
2110 * @signal: signal strength value (type depends on the wiphy's signal_type)
2111 * @chains: bitmask for filled values in @chain_signal.
2112 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2113 * @bssid_index: index in the multiple BSS set
2114 * @max_bssid_indicator: max number of members in the BSS set
2115 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
2117 struct cfg80211_bss {
2118 struct ieee80211_channel *channel;
2119 enum nl80211_bss_scan_width scan_width;
2121 const struct cfg80211_bss_ies __rcu *ies;
2122 const struct cfg80211_bss_ies __rcu *beacon_ies;
2123 const struct cfg80211_bss_ies __rcu *proberesp_ies;
2125 struct cfg80211_bss *hidden_beacon_bss;
2126 struct cfg80211_bss *transmitted_bss;
2127 struct list_head nontrans_list;
2131 u16 beacon_interval;
2136 s8 chain_signal[IEEE80211_MAX_CHAINS];
2139 u8 max_bssid_indicator;
2141 u8 priv[0] __aligned(sizeof(void *));
2145 * ieee80211_bss_get_elem - find element with given ID
2146 * @bss: the bss to search
2147 * @id: the element ID
2149 * Note that the return value is an RCU-protected pointer, so
2150 * rcu_read_lock() must be held when calling this function.
2151 * Return: %NULL if not found.
2153 const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
2156 * ieee80211_bss_get_ie - find IE with given ID
2157 * @bss: the bss to search
2158 * @id: the element ID
2160 * Note that the return value is an RCU-protected pointer, so
2161 * rcu_read_lock() must be held when calling this function.
2162 * Return: %NULL if not found.
2164 static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
2166 return (void *)ieee80211_bss_get_elem(bss, id);
2171 * struct cfg80211_auth_request - Authentication request data
2173 * This structure provides information needed to complete IEEE 802.11
2176 * @bss: The BSS to authenticate with, the callee must obtain a reference
2177 * to it if it needs to keep it.
2178 * @auth_type: Authentication type (algorithm)
2179 * @ie: Extra IEs to add to Authentication frame or %NULL
2180 * @ie_len: Length of ie buffer in octets
2181 * @key_len: length of WEP key for shared key authentication
2182 * @key_idx: index of WEP key for shared key authentication
2183 * @key: WEP key for shared key authentication
2184 * @auth_data: Fields and elements in Authentication frames. This contains
2185 * the authentication frame body (non-IE and IE data), excluding the
2186 * Authentication algorithm number, i.e., starting at the Authentication
2187 * transaction sequence number field.
2188 * @auth_data_len: Length of auth_data buffer in octets
2190 struct cfg80211_auth_request {
2191 struct cfg80211_bss *bss;
2194 enum nl80211_auth_type auth_type;
2196 u8 key_len, key_idx;
2197 const u8 *auth_data;
2198 size_t auth_data_len;
2202 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
2204 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
2205 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
2206 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
2207 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
2208 * authentication capability. Drivers can offload authentication to
2209 * userspace if this flag is set. Only applicable for cfg80211_connect()
2210 * request (connect callback).
2212 enum cfg80211_assoc_req_flags {
2213 ASSOC_REQ_DISABLE_HT = BIT(0),
2214 ASSOC_REQ_DISABLE_VHT = BIT(1),
2215 ASSOC_REQ_USE_RRM = BIT(2),
2216 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
2220 * struct cfg80211_assoc_request - (Re)Association request data
2222 * This structure provides information needed to complete IEEE 802.11
2224 * @bss: The BSS to associate with. If the call is successful the driver is
2225 * given a reference that it must give back to cfg80211_send_rx_assoc()
2226 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2227 * association requests while already associating must be rejected.
2228 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2229 * @ie_len: Length of ie buffer in octets
2230 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2231 * @crypto: crypto settings
2232 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2233 * to indicate a request to reassociate within the ESS instead of a request
2234 * do the initial association with the ESS. When included, this is set to
2235 * the BSSID of the current association, i.e., to the value that is
2236 * included in the Current AP address field of the Reassociation Request
2238 * @flags: See &enum cfg80211_assoc_req_flags
2239 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2240 * will be used in ht_capa. Un-supported values will be ignored.
2241 * @ht_capa_mask: The bits of ht_capa which are to be used.
2242 * @vht_capa: VHT capability override
2243 * @vht_capa_mask: VHT capability mask indicating which fields to use
2244 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2245 * %NULL if FILS is not used.
2246 * @fils_kek_len: Length of fils_kek in octets
2247 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2248 * Request/Response frame or %NULL if FILS is not used. This field starts
2249 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2251 struct cfg80211_assoc_request {
2252 struct cfg80211_bss *bss;
2253 const u8 *ie, *prev_bssid;
2255 struct cfg80211_crypto_settings crypto;
2258 struct ieee80211_ht_cap ht_capa;
2259 struct ieee80211_ht_cap ht_capa_mask;
2260 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2262 size_t fils_kek_len;
2263 const u8 *fils_nonces;
2267 * struct cfg80211_deauth_request - Deauthentication request data
2269 * This structure provides information needed to complete IEEE 802.11
2272 * @bssid: the BSSID of the BSS to deauthenticate from
2273 * @ie: Extra IEs to add to Deauthentication frame or %NULL
2274 * @ie_len: Length of ie buffer in octets
2275 * @reason_code: The reason code for the deauthentication
2276 * @local_state_change: if set, change local state only and
2277 * do not set a deauth frame
2279 struct cfg80211_deauth_request {
2284 bool local_state_change;
2288 * struct cfg80211_disassoc_request - Disassociation request data
2290 * This structure provides information needed to complete IEEE 802.11
2293 * @bss: the BSS to disassociate from
2294 * @ie: Extra IEs to add to Disassociation frame or %NULL
2295 * @ie_len: Length of ie buffer in octets
2296 * @reason_code: The reason code for the disassociation
2297 * @local_state_change: This is a request for a local state only, i.e., no
2298 * Disassociation frame is to be transmitted.
2300 struct cfg80211_disassoc_request {
2301 struct cfg80211_bss *bss;
2305 bool local_state_change;
2309 * struct cfg80211_ibss_params - IBSS parameters
2311 * This structure defines the IBSS parameters for the join_ibss()
2314 * @ssid: The SSID, will always be non-null.
2315 * @ssid_len: The length of the SSID, will always be non-zero.
2316 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2317 * search for IBSSs with a different BSSID.
2318 * @chandef: defines the channel to use if no other IBSS to join can be found
2319 * @channel_fixed: The channel should be fixed -- do not search for
2320 * IBSSs to join on other channels.
2321 * @ie: information element(s) to include in the beacon
2322 * @ie_len: length of that
2323 * @beacon_interval: beacon interval to use
2324 * @privacy: this is a protected network, keys will be configured
2326 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2327 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2328 * required to assume that the port is unauthorized until authorized by
2329 * user space. Otherwise, port is marked authorized by default.
2330 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2331 * port frames over NL80211 instead of the network interface.
2332 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2333 * changes the channel when a radar is detected. This is required
2334 * to operate on DFS channels.
2335 * @basic_rates: bitmap of basic rates to use when creating the IBSS
2336 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2337 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2338 * will be used in ht_capa. Un-supported values will be ignored.
2339 * @ht_capa_mask: The bits of ht_capa which are to be used.
2340 * @wep_keys: static WEP keys, if not NULL points to an array of
2341 * CFG80211_MAX_WEP_KEYS WEP keys
2342 * @wep_tx_key: key index (0..3) of the default TX static WEP key
2344 struct cfg80211_ibss_params {
2347 struct cfg80211_chan_def chandef;
2349 u8 ssid_len, ie_len;
2350 u16 beacon_interval;
2355 bool control_port_over_nl80211;
2356 bool userspace_handles_dfs;
2357 int mcast_rate[NUM_NL80211_BANDS];
2358 struct ieee80211_ht_cap ht_capa;
2359 struct ieee80211_ht_cap ht_capa_mask;
2360 struct key_params *wep_keys;
2365 * struct cfg80211_bss_selection - connection parameters for BSS selection.
2367 * @behaviour: requested BSS selection behaviour.
2368 * @param: parameters for requestion behaviour.
2369 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2370 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2372 struct cfg80211_bss_selection {
2373 enum nl80211_bss_select_attr behaviour;
2375 enum nl80211_band band_pref;
2376 struct cfg80211_bss_select_adjust adjust;
2381 * struct cfg80211_connect_params - Connection parameters
2383 * This structure provides information needed to complete IEEE 802.11
2384 * authentication and association.
2386 * @channel: The channel to use or %NULL if not specified (auto-select based
2388 * @channel_hint: The channel of the recommended BSS for initial connection or
2389 * %NULL if not specified
2390 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2392 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2393 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2394 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2397 * @ssid_len: Length of ssid in octets
2398 * @auth_type: Authentication type (algorithm)
2399 * @ie: IEs for association request
2400 * @ie_len: Length of assoc_ie in octets
2401 * @privacy: indicates whether privacy-enabled APs should be used
2402 * @mfp: indicate whether management frame protection is used
2403 * @crypto: crypto settings
2404 * @key_len: length of WEP key for shared key authentication
2405 * @key_idx: index of WEP key for shared key authentication
2406 * @key: WEP key for shared key authentication
2407 * @flags: See &enum cfg80211_assoc_req_flags
2408 * @bg_scan_period: Background scan period in seconds
2409 * or -1 to indicate that default value is to be used.
2410 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2411 * will be used in ht_capa. Un-supported values will be ignored.
2412 * @ht_capa_mask: The bits of ht_capa which are to be used.
2413 * @vht_capa: VHT Capability overrides
2414 * @vht_capa_mask: The bits of vht_capa which are to be used.
2415 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2417 * @bss_select: criteria to be used for BSS selection.
2418 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2419 * to indicate a request to reassociate within the ESS instead of a request
2420 * do the initial association with the ESS. When included, this is set to
2421 * the BSSID of the current association, i.e., to the value that is
2422 * included in the Current AP address field of the Reassociation Request
2424 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2425 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2427 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2428 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2429 * %NULL if not specified. This specifies the domain name of ER server and
2430 * is used to construct FILS wrapped data IE.
2431 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2432 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2433 * messages. This is also used to construct FILS wrapped data IE.
2434 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2435 * keys in FILS or %NULL if not specified.
2436 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
2437 * @want_1x: indicates user-space supports and wants to use 802.1X driver
2438 * offload of 4-way handshake.
2440 struct cfg80211_connect_params {
2441 struct ieee80211_channel *channel;
2442 struct ieee80211_channel *channel_hint;
2444 const u8 *bssid_hint;
2447 enum nl80211_auth_type auth_type;
2451 enum nl80211_mfp mfp;
2452 struct cfg80211_crypto_settings crypto;
2454 u8 key_len, key_idx;
2457 struct ieee80211_ht_cap ht_capa;
2458 struct ieee80211_ht_cap ht_capa_mask;
2459 struct ieee80211_vht_cap vht_capa;
2460 struct ieee80211_vht_cap vht_capa_mask;
2462 struct cfg80211_bss_selection bss_select;
2463 const u8 *prev_bssid;
2464 const u8 *fils_erp_username;
2465 size_t fils_erp_username_len;
2466 const u8 *fils_erp_realm;
2467 size_t fils_erp_realm_len;
2468 u16 fils_erp_next_seq_num;
2469 const u8 *fils_erp_rrk;
2470 size_t fils_erp_rrk_len;
2475 * enum cfg80211_connect_params_changed - Connection parameters being updated
2477 * This enum provides information of all connect parameters that
2478 * have to be updated as part of update_connect_params() call.
2480 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2481 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2482 * username, erp sequence number and rrk) are updated
2483 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2485 enum cfg80211_connect_params_changed {
2486 UPDATE_ASSOC_IES = BIT(0),
2487 UPDATE_FILS_ERP_INFO = BIT(1),
2488 UPDATE_AUTH_TYPE = BIT(2),
2492 * enum wiphy_params_flags - set_wiphy_params bitfield values
2493 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2494 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2495 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2496 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2497 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
2498 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
2499 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2500 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2501 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2503 enum wiphy_params_flags {
2504 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2505 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2506 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2507 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
2508 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
2509 WIPHY_PARAM_DYN_ACK = 1 << 5,
2510 WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2511 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2512 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
2515 #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
2518 * struct cfg80211_pmksa - PMK Security Association
2520 * This structure is passed to the set/del_pmksa() method for PMKSA
2523 * @bssid: The AP's BSSID (may be %NULL).
2524 * @pmkid: The identifier to refer a PMKSA.
2525 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2526 * derivation by a FILS STA. Otherwise, %NULL.
2527 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2528 * the hash algorithm used to generate this.
2529 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2530 * cache identifier (may be %NULL).
2531 * @ssid_len: Length of the @ssid in octets.
2532 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2533 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2536 struct cfg80211_pmksa {
2547 * struct cfg80211_pkt_pattern - packet pattern
2548 * @mask: bitmask where to match pattern and where to ignore bytes,
2549 * one bit per byte, in same format as nl80211
2550 * @pattern: bytes to match where bitmask is 1
2551 * @pattern_len: length of pattern (in bytes)
2552 * @pkt_offset: packet offset (in bytes)
2554 * Internal note: @mask and @pattern are allocated in one chunk of
2555 * memory, free @mask only!
2557 struct cfg80211_pkt_pattern {
2558 const u8 *mask, *pattern;
2564 * struct cfg80211_wowlan_tcp - TCP connection parameters
2566 * @sock: (internal) socket for source port allocation
2567 * @src: source IP address
2568 * @dst: destination IP address
2569 * @dst_mac: destination MAC address
2570 * @src_port: source port
2571 * @dst_port: destination port
2572 * @payload_len: data payload length
2573 * @payload: data payload buffer
2574 * @payload_seq: payload sequence stamping configuration
2575 * @data_interval: interval at which to send data packets
2576 * @wake_len: wakeup payload match length
2577 * @wake_data: wakeup payload match data
2578 * @wake_mask: wakeup payload match mask
2579 * @tokens_size: length of the tokens buffer
2580 * @payload_tok: payload token usage configuration
2582 struct cfg80211_wowlan_tcp {
2583 struct socket *sock;
2585 u16 src_port, dst_port;
2586 u8 dst_mac[ETH_ALEN];
2589 struct nl80211_wowlan_tcp_data_seq payload_seq;
2592 const u8 *wake_data, *wake_mask;
2594 /* must be last, variable member */
2595 struct nl80211_wowlan_tcp_data_token payload_tok;
2599 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2601 * This structure defines the enabled WoWLAN triggers for the device.
2602 * @any: wake up on any activity -- special trigger if device continues
2603 * operating as normal during suspend
2604 * @disconnect: wake up if getting disconnected
2605 * @magic_pkt: wake up on receiving magic packet
2606 * @patterns: wake up on receiving packet matching a pattern
2607 * @n_patterns: number of patterns
2608 * @gtk_rekey_failure: wake up on GTK rekey failure
2609 * @eap_identity_req: wake up on EAP identity request packet
2610 * @four_way_handshake: wake up on 4-way handshake
2611 * @rfkill_release: wake up when rfkill is released
2612 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
2613 * NULL if not configured.
2614 * @nd_config: configuration for the scan to be used for net detect wake.
2616 struct cfg80211_wowlan {
2617 bool any, disconnect, magic_pkt, gtk_rekey_failure,
2618 eap_identity_req, four_way_handshake,
2620 struct cfg80211_pkt_pattern *patterns;
2621 struct cfg80211_wowlan_tcp *tcp;
2623 struct cfg80211_sched_scan_request *nd_config;
2627 * struct cfg80211_coalesce_rules - Coalesce rule parameters
2629 * This structure defines coalesce rule for the device.
2630 * @delay: maximum coalescing delay in msecs.
2631 * @condition: condition for packet coalescence.
2632 * see &enum nl80211_coalesce_condition.
2633 * @patterns: array of packet patterns
2634 * @n_patterns: number of patterns
2636 struct cfg80211_coalesce_rules {
2638 enum nl80211_coalesce_condition condition;
2639 struct cfg80211_pkt_pattern *patterns;
2644 * struct cfg80211_coalesce - Packet coalescing settings
2646 * This structure defines coalescing settings.
2647 * @rules: array of coalesce rules
2648 * @n_rules: number of rules
2650 struct cfg80211_coalesce {
2651 struct cfg80211_coalesce_rules *rules;
2656 * struct cfg80211_wowlan_nd_match - information about the match
2658 * @ssid: SSID of the match that triggered the wake up
2659 * @n_channels: Number of channels where the match occurred. This
2660 * value may be zero if the driver can't report the channels.
2661 * @channels: center frequencies of the channels where a match
2664 struct cfg80211_wowlan_nd_match {
2665 struct cfg80211_ssid ssid;
2671 * struct cfg80211_wowlan_nd_info - net detect wake up information
2673 * @n_matches: Number of match information instances provided in
2674 * @matches. This value may be zero if the driver can't provide
2675 * match information.
2676 * @matches: Array of pointers to matches containing information about
2677 * the matches that triggered the wake up.
2679 struct cfg80211_wowlan_nd_info {
2681 struct cfg80211_wowlan_nd_match *matches[];
2685 * struct cfg80211_wowlan_wakeup - wakeup report
2686 * @disconnect: woke up by getting disconnected
2687 * @magic_pkt: woke up by receiving magic packet
2688 * @gtk_rekey_failure: woke up by GTK rekey failure
2689 * @eap_identity_req: woke up by EAP identity request packet
2690 * @four_way_handshake: woke up by 4-way handshake
2691 * @rfkill_release: woke up by rfkill being released
2692 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2693 * @packet_present_len: copied wakeup packet data
2694 * @packet_len: original wakeup packet length
2695 * @packet: The packet causing the wakeup, if any.
2696 * @packet_80211: For pattern match, magic packet and other data
2697 * frame triggers an 802.3 frame should be reported, for
2698 * disconnect due to deauth 802.11 frame. This indicates which
2700 * @tcp_match: TCP wakeup packet received
2701 * @tcp_connlost: TCP connection lost or failed to establish
2702 * @tcp_nomoretokens: TCP data ran out of tokens
2703 * @net_detect: if not %NULL, woke up because of net detect
2705 struct cfg80211_wowlan_wakeup {
2706 bool disconnect, magic_pkt, gtk_rekey_failure,
2707 eap_identity_req, four_way_handshake,
2708 rfkill_release, packet_80211,
2709 tcp_match, tcp_connlost, tcp_nomoretokens;
2711 u32 packet_present_len, packet_len;
2713 struct cfg80211_wowlan_nd_info *net_detect;
2717 * struct cfg80211_gtk_rekey_data - rekey data
2718 * @kek: key encryption key (NL80211_KEK_LEN bytes)
2719 * @kck: key confirmation key (NL80211_KCK_LEN bytes)
2720 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2722 struct cfg80211_gtk_rekey_data {
2723 const u8 *kek, *kck, *replay_ctr;
2727 * struct cfg80211_update_ft_ies_params - FT IE Information
2729 * This structure provides information needed to update the fast transition IE
2731 * @md: The Mobility Domain ID, 2 Octet value
2732 * @ie: Fast Transition IEs
2733 * @ie_len: Length of ft_ie in octets
2735 struct cfg80211_update_ft_ies_params {
2742 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2744 * This structure provides information needed to transmit a mgmt frame
2746 * @chan: channel to use
2747 * @offchan: indicates wether off channel operation is required
2748 * @wait: duration for ROC
2749 * @buf: buffer to transmit
2750 * @len: buffer length
2751 * @no_cck: don't use cck rates for this frame
2752 * @dont_wait_for_ack: tells the low level not to wait for an ack
2753 * @n_csa_offsets: length of csa_offsets array
2754 * @csa_offsets: array of all the csa offsets in the frame
2756 struct cfg80211_mgmt_tx_params {
2757 struct ieee80211_channel *chan;
2763 bool dont_wait_for_ack;
2765 const u16 *csa_offsets;
2769 * struct cfg80211_dscp_exception - DSCP exception
2771 * @dscp: DSCP value that does not adhere to the user priority range definition
2772 * @up: user priority value to which the corresponding DSCP value belongs
2774 struct cfg80211_dscp_exception {
2780 * struct cfg80211_dscp_range - DSCP range definition for user priority
2782 * @low: lowest DSCP value of this user priority range, inclusive
2783 * @high: highest DSCP value of this user priority range, inclusive
2785 struct cfg80211_dscp_range {
2790 /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2791 #define IEEE80211_QOS_MAP_MAX_EX 21
2792 #define IEEE80211_QOS_MAP_LEN_MIN 16
2793 #define IEEE80211_QOS_MAP_LEN_MAX \
2794 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2797 * struct cfg80211_qos_map - QoS Map Information
2799 * This struct defines the Interworking QoS map setting for DSCP values
2801 * @num_des: number of DSCP exceptions (0..21)
2802 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2803 * the user priority DSCP range definition
2804 * @up: DSCP range definition for a particular user priority
2806 struct cfg80211_qos_map {
2808 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2809 struct cfg80211_dscp_range up[8];
2813 * struct cfg80211_nan_conf - NAN configuration
2815 * This struct defines NAN configuration parameters
2817 * @master_pref: master preference (1 - 255)
2818 * @bands: operating bands, a bitmap of &enum nl80211_band values.
2819 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
2820 * (i.e. BIT(NL80211_BAND_2GHZ)).
2822 struct cfg80211_nan_conf {
2828 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
2831 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
2832 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
2834 enum cfg80211_nan_conf_changes {
2835 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
2836 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
2840 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
2842 * @filter: the content of the filter
2843 * @len: the length of the filter
2845 struct cfg80211_nan_func_filter {
2851 * struct cfg80211_nan_func - a NAN function
2853 * @type: &enum nl80211_nan_function_type
2854 * @service_id: the service ID of the function
2855 * @publish_type: &nl80211_nan_publish_type
2856 * @close_range: if true, the range should be limited. Threshold is
2857 * implementation specific.
2858 * @publish_bcast: if true, the solicited publish should be broadcasted
2859 * @subscribe_active: if true, the subscribe is active
2860 * @followup_id: the instance ID for follow up
2861 * @followup_reqid: the requestor instance ID for follow up
2862 * @followup_dest: MAC address of the recipient of the follow up
2863 * @ttl: time to live counter in DW.
2864 * @serv_spec_info: Service Specific Info
2865 * @serv_spec_info_len: Service Specific Info length
2866 * @srf_include: if true, SRF is inclusive
2867 * @srf_bf: Bloom Filter
2868 * @srf_bf_len: Bloom Filter length
2869 * @srf_bf_idx: Bloom Filter index
2870 * @srf_macs: SRF MAC addresses
2871 * @srf_num_macs: number of MAC addresses in SRF
2872 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
2873 * @tx_filters: filters that should be transmitted in the SDF.
2874 * @num_rx_filters: length of &rx_filters.
2875 * @num_tx_filters: length of &tx_filters.
2876 * @instance_id: driver allocated id of the function.
2877 * @cookie: unique NAN function identifier.
2879 struct cfg80211_nan_func {
2880 enum nl80211_nan_function_type type;
2881 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
2885 bool subscribe_active;
2888 struct mac_address followup_dest;
2890 const u8 *serv_spec_info;
2891 u8 serv_spec_info_len;
2896 struct mac_address *srf_macs;
2898 struct cfg80211_nan_func_filter *rx_filters;
2899 struct cfg80211_nan_func_filter *tx_filters;
2907 * struct cfg80211_pmk_conf - PMK configuration
2909 * @aa: authenticator address
2910 * @pmk_len: PMK length in bytes.
2911 * @pmk: the PMK material
2912 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
2913 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
2916 struct cfg80211_pmk_conf {
2920 const u8 *pmk_r0_name;
2924 * struct cfg80211_external_auth_params - Trigger External authentication.
2926 * Commonly used across the external auth request and event interfaces.
2928 * @action: action type / trigger for external authentication. Only significant
2929 * for the authentication request event interface (driver to user space).
2930 * @bssid: BSSID of the peer with which the authentication has
2931 * to happen. Used by both the authentication request event and
2932 * authentication response command interface.
2933 * @ssid: SSID of the AP. Used by both the authentication request event and
2934 * authentication response command interface.
2935 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
2936 * authentication request event interface.
2937 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
2938 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
2939 * the real status code for failures. Used only for the authentication
2940 * response command interface (user space to driver).
2941 * @pmkid: The identifier to refer a PMKSA.
2943 struct cfg80211_external_auth_params {
2944 enum nl80211_external_auth_action action;
2945 u8 bssid[ETH_ALEN] __aligned(2);
2946 struct cfg80211_ssid ssid;
2947 unsigned int key_mgmt_suite;
2953 * struct cfg80211_ftm_responder_stats - FTM responder statistics
2955 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
2956 * indicate the relevant values in this struct for them
2957 * @success_num: number of FTM sessions in which all frames were successfully
2959 * @partial_num: number of FTM sessions in which part of frames were
2960 * successfully answered
2961 * @failed_num: number of failed FTM sessions
2962 * @asap_num: number of ASAP FTM sessions
2963 * @non_asap_num: number of non-ASAP FTM sessions
2964 * @total_duration_ms: total sessions durations - gives an indication
2965 * of how much time the responder was busy
2966 * @unknown_triggers_num: number of unknown FTM triggers - triggers from
2967 * initiators that didn't finish successfully the negotiation phase with
2969 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
2970 * for a new scheduling although it already has scheduled FTM slot
2971 * @out_of_window_triggers_num: total FTM triggers out of scheduled window
2973 struct cfg80211_ftm_responder_stats {
2980 u64 total_duration_ms;
2981 u32 unknown_triggers_num;
2982 u32 reschedule_requests_num;
2983 u32 out_of_window_triggers_num;
2987 * struct cfg80211_pmsr_ftm_result - FTM result
2988 * @failure_reason: if this measurement failed (PMSR status is
2989 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
2990 * reason than just "failure"
2991 * @burst_index: if reporting partial results, this is the index
2992 * in [0 .. num_bursts-1] of the burst that's being reported
2993 * @num_ftmr_attempts: number of FTM request frames transmitted
2994 * @num_ftmr_successes: number of FTM request frames acked
2995 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
2996 * fill this to indicate in how many seconds a retry is deemed possible
2998 * @num_bursts_exp: actual number of bursts exponent negotiated
2999 * @burst_duration: actual burst duration negotiated
3000 * @ftms_per_burst: actual FTMs per burst negotiated
3001 * @lci_len: length of LCI information (if present)
3002 * @civicloc_len: length of civic location information (if present)
3003 * @lci: LCI data (may be %NULL)
3004 * @civicloc: civic location data (may be %NULL)
3005 * @rssi_avg: average RSSI over FTM action frames reported
3006 * @rssi_spread: spread of the RSSI over FTM action frames reported
3007 * @tx_rate: bitrate for transmitted FTM action frame response
3008 * @rx_rate: bitrate of received FTM action frame
3009 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
3010 * @rtt_variance: variance of RTTs measured (note that standard deviation is
3011 * the square root of the variance)
3012 * @rtt_spread: spread of the RTTs measured
3013 * @dist_avg: average of distances (mm) measured
3014 * (must have either this or @rtt_avg)
3015 * @dist_variance: variance of distances measured (see also @rtt_variance)
3016 * @dist_spread: spread of distances measured (see also @rtt_spread)
3017 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
3018 * @num_ftmr_successes_valid: @num_ftmr_successes is valid
3019 * @rssi_avg_valid: @rssi_avg is valid
3020 * @rssi_spread_valid: @rssi_spread is valid
3021 * @tx_rate_valid: @tx_rate is valid
3022 * @rx_rate_valid: @rx_rate is valid
3023 * @rtt_avg_valid: @rtt_avg is valid
3024 * @rtt_variance_valid: @rtt_variance is valid
3025 * @rtt_spread_valid: @rtt_spread is valid
3026 * @dist_avg_valid: @dist_avg is valid
3027 * @dist_variance_valid: @dist_variance is valid
3028 * @dist_spread_valid: @dist_spread is valid
3030 struct cfg80211_pmsr_ftm_result {
3033 unsigned int lci_len;
3034 unsigned int civicloc_len;
3035 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
3036 u32 num_ftmr_attempts, num_ftmr_successes;
3044 struct rate_info tx_rate, rx_rate;
3052 u16 num_ftmr_attempts_valid:1,
3053 num_ftmr_successes_valid:1,
3055 rssi_spread_valid:1,
3059 rtt_variance_valid:1,
3062 dist_variance_valid:1,
3063 dist_spread_valid:1;
3067 * struct cfg80211_pmsr_result - peer measurement result
3068 * @addr: address of the peer
3069 * @host_time: host time (use ktime_get_boottime() adjust to the time when the
3070 * measurement was made)
3071 * @ap_tsf: AP's TSF at measurement time
3072 * @status: status of the measurement
3073 * @final: if reporting partial results, mark this as the last one; if not
3074 * reporting partial results always set this flag
3075 * @ap_tsf_valid: indicates the @ap_tsf value is valid
3076 * @type: type of the measurement reported, note that we only support reporting
3077 * one type at a time, but you can report multiple results separately and
3078 * they're all aggregated for userspace.
3080 struct cfg80211_pmsr_result {
3081 u64 host_time, ap_tsf;
3082 enum nl80211_peer_measurement_status status;
3089 enum nl80211_peer_measurement_type type;
3092 struct cfg80211_pmsr_ftm_result ftm;
3097 * struct cfg80211_pmsr_ftm_request_peer - FTM request data
3098 * @requested: indicates FTM is requested
3099 * @preamble: frame preamble to use
3100 * @burst_period: burst period to use
3101 * @asap: indicates to use ASAP mode
3102 * @num_bursts_exp: number of bursts exponent
3103 * @burst_duration: burst duration
3104 * @ftms_per_burst: number of FTMs per burst
3105 * @ftmr_retries: number of retries for FTM request
3106 * @request_lci: request LCI information
3107 * @request_civicloc: request civic location information
3109 * See also nl80211 for the respective attribute documentation.
3111 struct cfg80211_pmsr_ftm_request_peer {
3112 enum nl80211_preamble preamble;
3125 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
3126 * @addr: MAC address
3127 * @chandef: channel to use
3128 * @report_ap_tsf: report the associated AP's TSF
3129 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
3131 struct cfg80211_pmsr_request_peer {
3133 struct cfg80211_chan_def chandef;
3135 struct cfg80211_pmsr_ftm_request_peer ftm;
3139 * struct cfg80211_pmsr_request - peer measurement request
3140 * @cookie: cookie, set by cfg80211
3141 * @nl_portid: netlink portid - used by cfg80211
3142 * @drv_data: driver data for this request, if required for aborting,
3143 * not otherwise freed or anything by cfg80211
3144 * @mac_addr: MAC address used for (randomised) request
3145 * @mac_addr_mask: MAC address mask used for randomisation, bits that
3146 * are 0 in the mask should be randomised, bits that are 1 should
3147 * be taken from the @mac_addr
3148 * @list: used by cfg80211 to hold on to the request
3149 * @timeout: timeout (in milliseconds) for the whole operation, if
3150 * zero it means there's no timeout
3151 * @n_peers: number of peers to do measurements with
3152 * @peers: per-peer measurement request data
3154 struct cfg80211_pmsr_request {
3162 u8 mac_addr[ETH_ALEN] __aligned(2);
3163 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3165 struct list_head list;
3167 struct cfg80211_pmsr_request_peer peers[];
3171 * struct cfg80211_update_owe_info - OWE Information
3173 * This structure provides information needed for the drivers to offload OWE
3174 * (Opportunistic Wireless Encryption) processing to the user space.
3176 * Commonly used across update_owe_info request and event interfaces.
3178 * @peer: MAC address of the peer device for which the OWE processing
3180 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3181 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3182 * cannot give you the real status code for failures. Used only for
3183 * OWE update request command interface (user space to driver).
3184 * @ie: IEs obtained from the peer or constructed by the user space. These are
3185 * the IEs of the remote peer in the event from the host driver and
3186 * the constructed IEs by the user space in the request interface.
3187 * @ie_len: Length of IEs in octets.
3189 struct cfg80211_update_owe_info {
3190 u8 peer[ETH_ALEN] __aligned(2);
3197 * struct cfg80211_ops - backend description for wireless configuration
3199 * This struct is registered by fullmac card drivers and/or wireless stacks
3200 * in order to handle configuration requests on their interfaces.
3202 * All callbacks except where otherwise noted should return 0
3203 * on success or a negative error code.
3205 * All operations are currently invoked under rtnl for consistency with the
3206 * wireless extensions but this is subject to reevaluation as soon as this
3207 * code is used more widely and we have a first user without wext.
3209 * @suspend: wiphy device needs to be suspended. The variable @wow will
3210 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
3211 * configured for the device.
3212 * @resume: wiphy device needs to be resumed
3213 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
3214 * to call device_set_wakeup_enable() to enable/disable wakeup from
3217 * @add_virtual_intf: create a new virtual interface with the given name,
3218 * must set the struct wireless_dev's iftype. Beware: You must create
3219 * the new netdev in the wiphy's network namespace! Returns the struct
3220 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
3221 * also set the address member in the wdev.
3223 * @del_virtual_intf: remove the virtual interface
3225 * @change_virtual_intf: change type/configuration of virtual interface,
3226 * keep the struct wireless_dev's iftype updated.
3228 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
3229 * when adding a group key.
3231 * @get_key: get information about the key with the given parameters.
3232 * @mac_addr will be %NULL when requesting information for a group
3233 * key. All pointers given to the @callback function need not be valid
3234 * after it returns. This function should return an error if it is
3235 * not possible to retrieve the key, -ENOENT if it doesn't exist.
3237 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3238 * and @key_index, return -ENOENT if the key doesn't exist.
3240 * @set_default_key: set the default key on an interface
3242 * @set_default_mgmt_key: set the default management frame key on an interface
3244 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3246 * @start_ap: Start acting in AP mode defined by the parameters.
3247 * @change_beacon: Change the beacon parameters for an access point mode
3248 * interface. This should reject the call when AP mode wasn't started.
3249 * @stop_ap: Stop being an AP, including stopping beaconing.
3251 * @add_station: Add a new station.
3252 * @del_station: Remove a station
3253 * @change_station: Modify a given station. Note that flags changes are not much
3254 * validated in cfg80211, in particular the auth/assoc/authorized flags
3255 * might come to the driver in invalid combinations -- make sure to check
3256 * them, also against the existing state! Drivers must call
3257 * cfg80211_check_station_change() to validate the information.
3258 * @get_station: get station information for the station identified by @mac
3259 * @dump_station: dump station callback -- resume dump at index @idx
3261 * @add_mpath: add a fixed mesh path
3262 * @del_mpath: delete a given mesh path
3263 * @change_mpath: change a given mesh path
3264 * @get_mpath: get a mesh path for the given parameters
3265 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
3266 * @get_mpp: get a mesh proxy path for the given parameters
3267 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3268 * @join_mesh: join the mesh network with the specified parameters
3269 * (invoked with the wireless_dev mutex held)
3270 * @leave_mesh: leave the current mesh network
3271 * (invoked with the wireless_dev mutex held)
3273 * @get_mesh_config: Get the current mesh configuration
3275 * @update_mesh_config: Update mesh parameters on a running mesh.
3276 * The mask is a bitfield which tells us which parameters to
3277 * set, and which to leave alone.
3279 * @change_bss: Modify parameters for a given BSS.
3281 * @set_txq_params: Set TX queue parameters
3283 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3284 * as it doesn't implement join_mesh and needs to set the channel to
3285 * join the mesh instead.
3287 * @set_monitor_channel: Set the monitor mode channel for the device. If other
3288 * interfaces are active this callback should reject the configuration.
3289 * If no interfaces are active or the device is down, the channel should
3290 * be stored for when a monitor interface becomes active.
3292 * @scan: Request to do a scan. If returning zero, the scan request is given
3293 * the driver, and will be valid until passed to cfg80211_scan_done().
3294 * For scan results, call cfg80211_inform_bss(); you can call this outside
3295 * the scan/scan_done bracket too.
3296 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
3297 * indicate the status of the scan through cfg80211_scan_done().
3299 * @auth: Request to authenticate with the specified peer
3300 * (invoked with the wireless_dev mutex held)
3301 * @assoc: Request to (re)associate with the specified peer
3302 * (invoked with the wireless_dev mutex held)
3303 * @deauth: Request to deauthenticate from the specified peer
3304 * (invoked with the wireless_dev mutex held)
3305 * @disassoc: Request to disassociate from the specified peer
3306 * (invoked with the wireless_dev mutex held)
3308 * @connect: Connect to the ESS with the specified parameters. When connected,
3309 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3310 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3311 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3312 * from the AP or cfg80211_connect_timeout() if no frame with status code
3314 * The driver is allowed to roam to other BSSes within the ESS when the
3315 * other BSS matches the connect parameters. When such roaming is initiated
3316 * by the driver, the driver is expected to verify that the target matches
3317 * the configured security parameters and to use Reassociation Request
3318 * frame instead of Association Request frame.
3319 * The connect function can also be used to request the driver to perform a
3320 * specific roam when connected to an ESS. In that case, the prev_bssid
3321 * parameter is set to the BSSID of the currently associated BSS as an
3322 * indication of requesting reassociation.
3323 * In both the driver-initiated and new connect() call initiated roaming
3324 * cases, the result of roaming is indicated with a call to
3325 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3326 * @update_connect_params: Update the connect parameters while connected to a
3327 * BSS. The updated parameters can be used by driver/firmware for
3328 * subsequent BSS selection (roaming) decisions and to form the
3329 * Authentication/(Re)Association Request frames. This call does not
3330 * request an immediate disassociation or reassociation with the current
3331 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
3332 * changed are defined in &enum cfg80211_connect_params_changed.
3333 * (invoked with the wireless_dev mutex held)
3334 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
3335 * connection is in progress. Once done, call cfg80211_disconnected() in
3336 * case connection was already established (invoked with the
3337 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3339 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
3340 * cfg80211_ibss_joined(), also call that function when changing BSSID due
3342 * (invoked with the wireless_dev mutex held)
3343 * @leave_ibss: Leave the IBSS.
3344 * (invoked with the wireless_dev mutex held)
3346 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3349 * @set_wiphy_params: Notify that wiphy parameters have changed;
3350 * @changed bitfield (see &enum wiphy_params_flags) describes which values
3351 * have changed. The actual parameter values are available in
3352 * struct wiphy. If returning an error, no value should be changed.
3354 * @set_tx_power: set the transmit power according to the parameters,
3355 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3356 * wdev may be %NULL if power was set for the wiphy, and will
3357 * always be %NULL unless the driver supports per-vif TX power
3358 * (as advertised by the nl80211 feature flag.)
3359 * @get_tx_power: store the current TX power into the dbm variable;
3360 * return 0 if successful
3362 * @set_wds_peer: set the WDS peer for a WDS interface
3364 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
3365 * functions to adjust rfkill hw state
3367 * @dump_survey: get site survey information.
3369 * @remain_on_channel: Request the driver to remain awake on the specified
3370 * channel for the specified duration to complete an off-channel
3371 * operation (e.g., public action frame exchange). When the driver is
3372 * ready on the requested channel, it must indicate this with an event
3373 * notification by calling cfg80211_ready_on_channel().
3374 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
3375 * This allows the operation to be terminated prior to timeout based on
3376 * the duration value.
3377 * @mgmt_tx: Transmit a management frame.
3378 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3379 * frame on another channel
3381 * @testmode_cmd: run a test mode command; @wdev may be %NULL
3382 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
3383 * used by the function, but 0 and 1 must not be touched. Additionally,
3384 * return error codes other than -ENOBUFS and -ENOENT will terminate the
3385 * dump and return to userspace with an error, so be careful. If any data
3386 * was passed in from userspace then the data/len arguments will be present
3387 * and point to the data contained in %NL80211_ATTR_TESTDATA.
3389 * @set_bitrate_mask: set the bitrate mask configuration
3391 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
3392 * devices running firmwares capable of generating the (re) association
3393 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
3394 * @del_pmksa: Delete a cached PMKID.
3395 * @flush_pmksa: Flush all cached PMKIDs.
3396 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
3397 * allows the driver to adjust the dynamic ps timeout value.
3398 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3399 * After configuration, the driver should (soon) send an event indicating
3400 * the current level is above/below the configured threshold; this may
3401 * need some care when the configuration is changed (without first being
3403 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
3404 * connection quality monitor. An event is to be sent only when the
3405 * signal level is found to be outside the two values. The driver should
3406 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
3407 * If it is provided then there's no point providing @set_cqm_rssi_config.
3408 * @set_cqm_txe_config: Configure connection quality monitor TX error
3410 * @sched_scan_start: Tell the driver to start a scheduled scan.
3411 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
3412 * given request id. This call must stop the scheduled scan and be ready
3413 * for starting a new one before it returns, i.e. @sched_scan_start may be
3414 * called immediately after that again and should not fail in that case.
3415 * The driver should not call cfg80211_sched_scan_stopped() for a requested
3416 * stop (when this method returns 0).
3418 * @mgmt_frame_register: Notify driver that a management frame type was
3419 * registered. The callback is allowed to sleep.
3421 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3422 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3423 * reject TX/RX mask combinations they cannot support by returning -EINVAL
3424 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3426 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
3428 * @tdls_mgmt: Transmit a TDLS management frame.
3429 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
3431 * @probe_client: probe an associated client, must return a cookie that it
3432 * later passes to cfg80211_probe_status().
3434 * @set_noack_map: Set the NoAck Map for the TIDs.
3436 * @get_channel: Get the current operating channel for the virtual interface.
3437 * For monitor interfaces, it should return %NULL unless there's a single
3438 * current monitoring channel.
3440 * @start_p2p_device: Start the given P2P device.
3441 * @stop_p2p_device: Stop the given P2P device.
3443 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
3444 * Parameters include ACL policy, an array of MAC address of stations
3445 * and the number of MAC addresses. If there is already a list in driver
3446 * this new list replaces the existing one. Driver has to clear its ACL
3447 * when number of MAC addresses entries is passed as 0. Drivers which
3448 * advertise the support for MAC based ACL have to implement this callback.
3450 * @start_radar_detection: Start radar detection in the driver.
3452 * @update_ft_ies: Provide updated Fast BSS Transition information to the
3453 * driver. If the SME is in the driver/firmware, this information can be
3454 * used in building Authentication and Reassociation Request frames.
3456 * @crit_proto_start: Indicates a critical protocol needs more link reliability
3457 * for a given duration (milliseconds). The protocol is provided so the
3458 * driver can take the most appropriate actions.
3459 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
3460 * reliability. This operation can not fail.
3461 * @set_coalesce: Set coalesce parameters.
3463 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
3464 * responsible for veryfing if the switch is possible. Since this is
3465 * inherently tricky driver may decide to disconnect an interface later
3466 * with cfg80211_stop_iface(). This doesn't mean driver can accept
3467 * everything. It should do it's best to verify requests and reject them
3468 * as soon as possible.
3470 * @set_qos_map: Set QoS mapping information to the driver
3472 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3473 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3474 * changes during the lifetime of the BSS.
3476 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3477 * with the given parameters; action frame exchange has been handled by
3478 * userspace so this just has to modify the TX path to take the TS into
3480 * If the admitted time is 0 just validate the parameters to make sure
3481 * the session can be created at all; it is valid to just always return
3482 * success for that but that may result in inefficient behaviour (handshake
3483 * with the peer followed by immediate teardown when the addition is later
3485 * @del_tx_ts: remove an existing TX TS
3487 * @join_ocb: join the OCB network with the specified parameters
3488 * (invoked with the wireless_dev mutex held)
3489 * @leave_ocb: leave the current OCB network
3490 * (invoked with the wireless_dev mutex held)
3492 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
3493 * is responsible for continually initiating channel-switching operations
3494 * and returning to the base channel for communication with the AP.
3495 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
3496 * peers must be on the base channel when the call completes.
3497 * @start_nan: Start the NAN interface.
3498 * @stop_nan: Stop the NAN interface.
3499 * @add_nan_func: Add a NAN function. Returns negative value on failure.
3500 * On success @nan_func ownership is transferred to the driver and
3501 * it may access it outside of the scope of this function. The driver
3502 * should free the @nan_func when no longer needed by calling
3503 * cfg80211_free_nan_func().
3504 * On success the driver should assign an instance_id in the
3505 * provided @nan_func.
3506 * @del_nan_func: Delete a NAN function.
3507 * @nan_change_conf: changes NAN configuration. The changed parameters must
3508 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
3509 * All other parameters must be ignored.
3511 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
3513 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3514 * function should return phy stats, and interface stats otherwise.
3516 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
3517 * If not deleted through @del_pmk the PMK remains valid until disconnect
3518 * upon which the driver should clear it.
3519 * (invoked with the wireless_dev mutex held)
3520 * @del_pmk: delete the previously configured PMK for the given authenticator.
3521 * (invoked with the wireless_dev mutex held)
3523 * @external_auth: indicates result of offloaded authentication processing from
3526 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
3527 * tells the driver that the frame should not be encrypted.
3529 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
3530 * Statistics should be cumulative, currently no way to reset is provided.
3531 * @start_pmsr: start peer measurement (e.g. FTM)
3532 * @abort_pmsr: abort peer measurement
3534 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3535 * but offloading OWE processing to the user space will get the updated
3536 * DH IE through this interface.
3538 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
3539 * and overrule HWMP path selection algorithm.
3541 struct cfg80211_ops {
3542 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
3543 int (*resume)(struct wiphy *wiphy);
3544 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
3546 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3548 unsigned char name_assign_type,
3549 enum nl80211_iftype type,
3550 struct vif_params *params);
3551 int (*del_virtual_intf)(struct wiphy *wiphy,
3552 struct wireless_dev *wdev);
3553 int (*change_virtual_intf)(struct wiphy *wiphy,
3554 struct net_device *dev,
3555 enum nl80211_iftype type,
3556 struct vif_params *params);
3558 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3559 u8 key_index, bool pairwise, const u8 *mac_addr,
3560 struct key_params *params);
3561 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3562 u8 key_index, bool pairwise, const u8 *mac_addr,
3564 void (*callback)(void *cookie, struct key_params*));
3565 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3566 u8 key_index, bool pairwise, const u8 *mac_addr);
3567 int (*set_default_key)(struct wiphy *wiphy,
3568 struct net_device *netdev,
3569 u8 key_index, bool unicast, bool multicast);
3570 int (*set_default_mgmt_key)(struct wiphy *wiphy,
3571 struct net_device *netdev,
3574 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
3575 struct cfg80211_ap_settings *settings);
3576 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
3577 struct cfg80211_beacon_data *info);
3578 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
3581 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
3583 struct station_parameters *params);
3584 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
3585 struct station_del_parameters *params);
3586 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
3588 struct station_parameters *params);
3589 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
3590 const u8 *mac, struct station_info *sinfo);
3591 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
3592 int idx, u8 *mac, struct station_info *sinfo);
3594 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
3595 const u8 *dst, const u8 *next_hop);
3596 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
3598 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
3599 const u8 *dst, const u8 *next_hop);
3600 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
3601 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
3602 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
3603 int idx, u8 *dst, u8 *next_hop,
3604 struct mpath_info *pinfo);
3605 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
3606 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
3607 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
3608 int idx, u8 *dst, u8 *mpp,
3609 struct mpath_info *pinfo);
3610 int (*get_mesh_config)(struct wiphy *wiphy,
3611 struct net_device *dev,
3612 struct mesh_config *conf);
3613 int (*update_mesh_config)(struct wiphy *wiphy,
3614 struct net_device *dev, u32 mask,
3615 const struct mesh_config *nconf);
3616 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
3617 const struct mesh_config *conf,
3618 const struct mesh_setup *setup);
3619 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
3621 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
3622 struct ocb_setup *setup);
3623 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
3625 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
3626 struct bss_parameters *params);
3628 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
3629 struct ieee80211_txq_params *params);
3631 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
3632 struct net_device *dev,
3633 struct ieee80211_channel *chan);
3635 int (*set_monitor_channel)(struct wiphy *wiphy,
3636 struct cfg80211_chan_def *chandef);
3638 int (*scan)(struct wiphy *wiphy,
3639 struct cfg80211_scan_request *request);
3640 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3642 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
3643 struct cfg80211_auth_request *req);
3644 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
3645 struct cfg80211_assoc_request *req);
3646 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
3647 struct cfg80211_deauth_request *req);
3648 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
3649 struct cfg80211_disassoc_request *req);
3651 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
3652 struct cfg80211_connect_params *sme);
3653 int (*update_connect_params)(struct wiphy *wiphy,
3654 struct net_device *dev,
3655 struct cfg80211_connect_params *sme,
3657 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
3660 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
3661 struct cfg80211_ibss_params *params);
3662 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
3664 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
3665 int rate[NUM_NL80211_BANDS]);
3667 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
3669 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3670 enum nl80211_tx_power_setting type, int mbm);
3671 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3674 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
3677 void (*rfkill_poll)(struct wiphy *wiphy);
3679 #ifdef CONFIG_NL80211_TESTMODE
3680 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
3681 void *data, int len);
3682 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
3683 struct netlink_callback *cb,
3684 void *data, int len);
3687 int (*set_bitrate_mask)(struct wiphy *wiphy,
3688 struct net_device *dev,
3690 const struct cfg80211_bitrate_mask *mask);
3692 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
3693 int idx, struct survey_info *info);
3695 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
3696 struct cfg80211_pmksa *pmksa);
3697 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
3698 struct cfg80211_pmksa *pmksa);
3699 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
3701 int (*remain_on_channel)(struct wiphy *wiphy,
3702 struct wireless_dev *wdev,
3703 struct ieee80211_channel *chan,
3704 unsigned int duration,
3706 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
3707 struct wireless_dev *wdev,
3710 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
3711 struct cfg80211_mgmt_tx_params *params,
3713 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
3714 struct wireless_dev *wdev,
3717 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3718 bool enabled, int timeout);
3720 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
3721 struct net_device *dev,
3722 s32 rssi_thold, u32 rssi_hyst);
3724 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
3725 struct net_device *dev,
3726 s32 rssi_low, s32 rssi_high);
3728 int (*set_cqm_txe_config)(struct wiphy *wiphy,
3729 struct net_device *dev,
3730 u32 rate, u32 pkts, u32 intvl);
3732 void (*mgmt_frame_register)(struct wiphy *wiphy,
3733 struct wireless_dev *wdev,
3734 u16 frame_type, bool reg);
3736 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
3737 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
3739 int (*sched_scan_start)(struct wiphy *wiphy,
3740 struct net_device *dev,
3741 struct cfg80211_sched_scan_request *request);
3742 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
3745 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
3746 struct cfg80211_gtk_rekey_data *data);
3748 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3749 const u8 *peer, u8 action_code, u8 dialog_token,
3750 u16 status_code, u32 peer_capability,
3751 bool initiator, const u8 *buf, size_t len);
3752 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
3753 const u8 *peer, enum nl80211_tdls_operation oper);
3755 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
3756 const u8 *peer, u64 *cookie);
3758 int (*set_noack_map)(struct wiphy *wiphy,
3759 struct net_device *dev,
3762 int (*get_channel)(struct wiphy *wiphy,
3763 struct wireless_dev *wdev,
3764 struct cfg80211_chan_def *chandef);
3766 int (*start_p2p_device)(struct wiphy *wiphy,
3767 struct wireless_dev *wdev);
3768 void (*stop_p2p_device)(struct wiphy *wiphy,
3769 struct wireless_dev *wdev);
3771 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
3772 const struct cfg80211_acl_data *params);
3774 int (*start_radar_detection)(struct wiphy *wiphy,
3775 struct net_device *dev,
3776 struct cfg80211_chan_def *chandef,
3778 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
3779 struct cfg80211_update_ft_ies_params *ftie);
3780 int (*crit_proto_start)(struct wiphy *wiphy,
3781 struct wireless_dev *wdev,
3782 enum nl80211_crit_proto_id protocol,
3784 void (*crit_proto_stop)(struct wiphy *wiphy,
3785 struct wireless_dev *wdev);
3786 int (*set_coalesce)(struct wiphy *wiphy,
3787 struct cfg80211_coalesce *coalesce);
3789 int (*channel_switch)(struct wiphy *wiphy,
3790 struct net_device *dev,
3791 struct cfg80211_csa_settings *params);
3793 int (*set_qos_map)(struct wiphy *wiphy,
3794 struct net_device *dev,
3795 struct cfg80211_qos_map *qos_map);
3797 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
3798 struct cfg80211_chan_def *chandef);
3800 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3801 u8 tsid, const u8 *peer, u8 user_prio,
3803 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3804 u8 tsid, const u8 *peer);
3806 int (*tdls_channel_switch)(struct wiphy *wiphy,
3807 struct net_device *dev,
3808 const u8 *addr, u8 oper_class,
3809 struct cfg80211_chan_def *chandef);
3810 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
3811 struct net_device *dev,
3813 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
3814 struct cfg80211_nan_conf *conf);
3815 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3816 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3817 struct cfg80211_nan_func *nan_func);
3818 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
3820 int (*nan_change_conf)(struct wiphy *wiphy,
3821 struct wireless_dev *wdev,
3822 struct cfg80211_nan_conf *conf,
3825 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
3826 struct net_device *dev,
3827 const bool enabled);
3829 int (*get_txq_stats)(struct wiphy *wiphy,
3830 struct wireless_dev *wdev,
3831 struct cfg80211_txq_stats *txqstats);
3833 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
3834 const struct cfg80211_pmk_conf *conf);
3835 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
3837 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
3838 struct cfg80211_external_auth_params *params);
3840 int (*tx_control_port)(struct wiphy *wiphy,
3841 struct net_device *dev,
3842 const u8 *buf, size_t len,
3843 const u8 *dest, const __be16 proto,
3844 const bool noencrypt);
3846 int (*get_ftm_responder_stats)(struct wiphy *wiphy,
3847 struct net_device *dev,
3848 struct cfg80211_ftm_responder_stats *ftm_stats);
3850 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
3851 struct cfg80211_pmsr_request *request);
3852 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
3853 struct cfg80211_pmsr_request *request);
3854 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
3855 struct cfg80211_update_owe_info *owe_info);
3856 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
3857 const u8 *buf, size_t len);
3861 * wireless hardware and networking interfaces structures
3862 * and registration/helper functions
3866 * enum wiphy_flags - wiphy capability flags
3868 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
3870 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
3871 * by default -- this flag will be set depending on the kernel's default
3872 * on wiphy_new(), but can be changed by the driver if it has a good
3873 * reason to override the default
3874 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
3875 * on a VLAN interface). This flag also serves an extra purpose of
3876 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
3877 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
3878 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
3879 * control port protocol ethertype. The device also honours the
3880 * control_port_no_encrypt flag.
3881 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
3882 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
3883 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
3884 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
3886 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
3887 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
3888 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
3889 * link setup/discovery operations internally. Setup, discovery and
3890 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
3891 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
3892 * used for asking the driver/firmware to perform a TDLS operation.
3893 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
3894 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
3895 * when there are virtual interfaces in AP mode by calling
3896 * cfg80211_report_obss_beacon().
3897 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
3898 * responds to probe-requests in hardware.
3899 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
3900 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
3901 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
3902 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
3903 * beaconing mode (AP, IBSS, Mesh, ...).
3904 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
3905 * before connection.
3911 WIPHY_FLAG_NETNS_OK = BIT(3),
3912 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
3913 WIPHY_FLAG_4ADDR_AP = BIT(5),
3914 WIPHY_FLAG_4ADDR_STATION = BIT(6),
3915 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
3916 WIPHY_FLAG_IBSS_RSN = BIT(8),
3917 WIPHY_FLAG_MESH_AUTH = BIT(10),
3918 /* use hole at 11 */
3919 /* use hole at 12 */
3920 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
3921 WIPHY_FLAG_AP_UAPSD = BIT(14),
3922 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
3923 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
3924 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
3925 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
3926 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
3927 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
3928 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
3929 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
3930 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
3931 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
3935 * struct ieee80211_iface_limit - limit on certain interface types
3936 * @max: maximum number of interfaces of these types
3937 * @types: interface types (bits)
3939 struct ieee80211_iface_limit {
3945 * struct ieee80211_iface_combination - possible interface combination
3947 * With this structure the driver can describe which interface
3948 * combinations it supports concurrently.
3952 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
3956 * struct ieee80211_iface_limit limits1[] = {
3957 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
3958 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
3960 * struct ieee80211_iface_combination combination1 = {
3961 * .limits = limits1,
3962 * .n_limits = ARRAY_SIZE(limits1),
3963 * .max_interfaces = 2,
3964 * .beacon_int_infra_match = true,
3968 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
3972 * struct ieee80211_iface_limit limits2[] = {
3973 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
3974 * BIT(NL80211_IFTYPE_P2P_GO), },
3976 * struct ieee80211_iface_combination combination2 = {
3977 * .limits = limits2,
3978 * .n_limits = ARRAY_SIZE(limits2),
3979 * .max_interfaces = 8,
3980 * .num_different_channels = 1,
3984 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
3986 * This allows for an infrastructure connection and three P2P connections.
3990 * struct ieee80211_iface_limit limits3[] = {
3991 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
3992 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
3993 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
3995 * struct ieee80211_iface_combination combination3 = {
3996 * .limits = limits3,
3997 * .n_limits = ARRAY_SIZE(limits3),
3998 * .max_interfaces = 4,
3999 * .num_different_channels = 2,
4003 struct ieee80211_iface_combination {
4006 * limits for the given interface types
4008 const struct ieee80211_iface_limit *limits;
4011 * @num_different_channels:
4012 * can use up to this many different channels
4014 u32 num_different_channels;
4018 * maximum number of interfaces in total allowed in this group
4024 * number of limitations
4029 * @beacon_int_infra_match:
4030 * In this combination, the beacon intervals between infrastructure
4031 * and AP types must match. This is required only in special cases.
4033 bool beacon_int_infra_match;
4036 * @radar_detect_widths:
4037 * bitmap of channel widths supported for radar detection
4039 u8 radar_detect_widths;
4042 * @radar_detect_regions:
4043 * bitmap of regions supported for radar detection
4045 u8 radar_detect_regions;
4048 * @beacon_int_min_gcd:
4049 * This interface combination supports different beacon intervals.
4052 * all beacon intervals for different interface must be same.
4054 * any beacon interval for the interface part of this combination AND
4055 * GCD of all beacon intervals from beaconing interfaces of this
4056 * combination must be greater or equal to this value.
4058 u32 beacon_int_min_gcd;
4061 struct ieee80211_txrx_stypes {
4066 * enum wiphy_wowlan_support_flags - WoWLAN support flags
4067 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4068 * trigger that keeps the device operating as-is and
4069 * wakes up the host on any activity, for example a
4070 * received packet that passed filtering; note that the
4071 * packet should be preserved in that case
4072 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4074 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
4075 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
4076 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
4077 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
4078 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
4079 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
4080 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4082 enum wiphy_wowlan_support_flags {
4083 WIPHY_WOWLAN_ANY = BIT(0),
4084 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
4085 WIPHY_WOWLAN_DISCONNECT = BIT(2),
4086 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
4087 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
4088 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
4089 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
4090 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
4091 WIPHY_WOWLAN_NET_DETECT = BIT(8),
4094 struct wiphy_wowlan_tcp_support {
4095 const struct nl80211_wowlan_tcp_data_token_feature *tok;
4096 u32 data_payload_max;
4097 u32 data_interval_max;
4098 u32 wake_payload_max;
4103 * struct wiphy_wowlan_support - WoWLAN support data
4104 * @flags: see &enum wiphy_wowlan_support_flags
4105 * @n_patterns: number of supported wakeup patterns
4106 * (see nl80211.h for the pattern definition)
4107 * @pattern_max_len: maximum length of each pattern
4108 * @pattern_min_len: minimum length of each pattern
4109 * @max_pkt_offset: maximum Rx packet offset
4110 * @max_nd_match_sets: maximum number of matchsets for net-detect,
4111 * similar, but not necessarily identical, to max_match_sets for
4113 * See &struct cfg80211_sched_scan_request.@match_sets for more
4115 * @tcp: TCP wakeup support information
4117 struct wiphy_wowlan_support {
4120 int pattern_max_len;
4121 int pattern_min_len;
4123 int max_nd_match_sets;
4124 const struct wiphy_wowlan_tcp_support *tcp;
4128 * struct wiphy_coalesce_support - coalesce support data
4129 * @n_rules: maximum number of coalesce rules
4130 * @max_delay: maximum supported coalescing delay in msecs
4131 * @n_patterns: number of supported patterns in a rule
4132 * (see nl80211.h for the pattern definition)
4133 * @pattern_max_len: maximum length of each pattern
4134 * @pattern_min_len: minimum length of each pattern
4135 * @max_pkt_offset: maximum Rx packet offset
4137 struct wiphy_coalesce_support {
4141 int pattern_max_len;
4142 int pattern_min_len;
4147 * enum wiphy_vendor_command_flags - validation flags for vendor commands
4148 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4149 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4150 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4151 * (must be combined with %_WDEV or %_NETDEV)
4153 enum wiphy_vendor_command_flags {
4154 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4155 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4156 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4160 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4162 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4163 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4164 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4167 enum wiphy_opmode_flag {
4168 STA_OPMODE_MAX_BW_CHANGED = BIT(0),
4169 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
4170 STA_OPMODE_N_SS_CHANGED = BIT(2),
4174 * struct sta_opmode_info - Station's ht/vht operation mode information
4175 * @changed: contains value from &enum wiphy_opmode_flag
4176 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
4177 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4178 * @rx_nss: new rx_nss value of a station
4181 struct sta_opmode_info {
4183 enum nl80211_smps_mode smps_mode;
4184 enum nl80211_chan_width bw;
4188 #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4191 * struct wiphy_vendor_command - vendor command definition
4192 * @info: vendor command identifying information, as used in nl80211
4193 * @flags: flags, see &enum wiphy_vendor_command_flags
4194 * @doit: callback for the operation, note that wdev is %NULL if the
4195 * flags didn't ask for a wdev and non-%NULL otherwise; the data
4196 * pointer may be %NULL if userspace provided no data at all
4197 * @dumpit: dump callback, for transferring bigger/multiple items. The
4198 * @storage points to cb->args[5], ie. is preserved over the multiple
4200 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4201 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4202 * attribute is just raw data (e.g. a firmware command).
4203 * @maxattr: highest attribute number in policy
4204 * It's recommended to not have the same sub command with both @doit and
4205 * @dumpit, so that userspace can assume certain ones are get and others
4206 * are used with dump requests.
4208 struct wiphy_vendor_command {
4209 struct nl80211_vendor_cmd_info info;
4211 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4212 const void *data, int data_len);
4213 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4214 struct sk_buff *skb, const void *data, int data_len,
4215 unsigned long *storage);
4216 const struct nla_policy *policy;
4217 unsigned int maxattr;
4221 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4222 * @iftype: interface type
4223 * @extended_capabilities: extended capabilities supported by the driver,
4224 * additional capabilities might be supported by userspace; these are the
4225 * 802.11 extended capabilities ("Extended Capabilities element") and are
4226 * in the same format as in the information element. See IEEE Std
4227 * 802.11-2012 8.4.2.29 for the defined fields.
4228 * @extended_capabilities_mask: mask of the valid values
4229 * @extended_capabilities_len: length of the extended capabilities
4231 struct wiphy_iftype_ext_capab {
4232 enum nl80211_iftype iftype;
4233 const u8 *extended_capabilities;
4234 const u8 *extended_capabilities_mask;
4235 u8 extended_capabilities_len;
4239 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4240 * @max_peers: maximum number of peers in a single measurement
4241 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4242 * @randomize_mac_addr: can randomize MAC address for measurement
4243 * @ftm.supported: FTM measurement is supported
4244 * @ftm.asap: ASAP-mode is supported
4245 * @ftm.non_asap: non-ASAP-mode is supported
4246 * @ftm.request_lci: can request LCI data
4247 * @ftm.request_civicloc: can request civic location data
4248 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4249 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4250 * @ftm.max_bursts_exponent: maximum burst exponent supported
4251 * (set to -1 if not limited; note that setting this will necessarily
4252 * forbid using the value 15 to let the responder pick)
4253 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4256 struct cfg80211_pmsr_capabilities {
4257 unsigned int max_peers;
4259 randomize_mac_addr:1;
4264 s8 max_bursts_exponent;
4265 u8 max_ftms_per_burst;
4275 * struct wiphy - wireless hardware description
4276 * @reg_notifier: the driver's regulatory notification callback,
4277 * note that if your driver uses wiphy_apply_custom_regulatory()
4278 * the reg_notifier's request can be passed as NULL
4279 * @regd: the driver's regulatory domain, if one was requested via
4280 * the regulatory_hint() API. This can be used by the driver
4281 * on the reg_notifier() if it chooses to ignore future
4282 * regulatory domain changes caused by other drivers.
4283 * @signal_type: signal type reported in &struct cfg80211_bss.
4284 * @cipher_suites: supported cipher suites
4285 * @n_cipher_suites: number of supported cipher suites
4286 * @akm_suites: supported AKM suites
4287 * @n_akm_suites: number of supported AKM suites
4288 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4289 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4290 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4291 * -1 = fragmentation disabled, only odd values >= 256 used
4292 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4293 * @_net: the network namespace this wiphy currently lives in
4294 * @perm_addr: permanent MAC address of this device
4295 * @addr_mask: If the device supports multiple MAC addresses by masking,
4296 * set this to a mask with variable bits set to 1, e.g. if the last
4297 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
4298 * variable bits shall be determined by the interfaces added, with
4299 * interfaces not matching the mask being rejected to be brought up.
4300 * @n_addresses: number of addresses in @addresses.
4301 * @addresses: If the device has more than one address, set this pointer
4302 * to a list of addresses (6 bytes each). The first one will be used
4303 * by default for perm_addr. In this case, the mask should be set to
4304 * all-zeroes. In this case it is assumed that the device can handle
4305 * the same number of arbitrary MAC addresses.
4306 * @registered: protects ->resume and ->suspend sysfs callbacks against
4307 * unregister hardware
4308 * @debugfsdir: debugfs directory used for this wiphy, will be renamed
4309 * automatically on wiphy renames
4310 * @dev: (virtual) struct device for this wiphy
4311 * @registered: helps synchronize suspend/resume with wiphy unregister
4312 * @wext: wireless extension handlers
4313 * @priv: driver private data (sized according to wiphy_new() parameter)
4314 * @interface_modes: bitmask of interfaces types valid for this wiphy,
4315 * must be set by driver
4316 * @iface_combinations: Valid interface combinations array, should not
4317 * list single interface types.
4318 * @n_iface_combinations: number of entries in @iface_combinations array.
4319 * @software_iftypes: bitmask of software interface types, these are not
4320 * subject to any restrictions since they are purely managed in SW.
4321 * @flags: wiphy flags, see &enum wiphy_flags
4322 * @regulatory_flags: wiphy regulatory flags, see
4323 * &enum ieee80211_regulatory_flags
4324 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4325 * @ext_features: extended features advertised to nl80211, see
4326 * &enum nl80211_ext_feature_index.
4327 * @bss_priv_size: each BSS struct has private data allocated with it,
4328 * this variable determines its size
4329 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4331 * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4332 * the device can run concurrently.
4333 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
4334 * for in any given scheduled scan
4335 * @max_match_sets: maximum number of match sets the device can handle
4336 * when performing a scheduled scan, 0 if filtering is not
4338 * @max_scan_ie_len: maximum length of user-controlled IEs device can
4339 * add to probe request frames transmitted during a scan, must not
4340 * include fixed IEs like supported rates
4341 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
4343 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
4344 * of iterations) for scheduled scan supported by the device.
4345 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
4346 * single scan plan supported by the device.
4347 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
4348 * scan plan supported by the device.
4349 * @coverage_class: current coverage class
4350 * @fw_version: firmware version for ethtool reporting
4351 * @hw_version: hardware version for ethtool reporting
4352 * @max_num_pmkids: maximum number of PMKIDs supported by device
4353 * @privid: a pointer that drivers can use to identify if an arbitrary
4354 * wiphy is theirs, e.g. in global notifiers
4355 * @bands: information about bands/channels supported by this device
4357 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
4358 * transmitted through nl80211, points to an array indexed by interface
4361 * @available_antennas_tx: bitmap of antennas which are available to be
4362 * configured as TX antennas. Antenna configuration commands will be
4363 * rejected unless this or @available_antennas_rx is set.
4365 * @available_antennas_rx: bitmap of antennas which are available to be
4366 * configured as RX antennas. Antenna configuration commands will be
4367 * rejected unless this or @available_antennas_tx is set.
4369 * @probe_resp_offload:
4370 * Bitmap of supported protocols for probe response offloading.
4371 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
4372 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4374 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4375 * may request, if implemented.
4377 * @wowlan: WoWLAN support information
4378 * @wowlan_config: current WoWLAN configuration; this should usually not be
4379 * used since access to it is necessarily racy, use the parameter passed
4380 * to the suspend() operation instead.
4382 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
4383 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
4384 * If null, then none can be over-ridden.
4385 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
4386 * If null, then none can be over-ridden.
4388 * @wdev_list: the list of associated (virtual) interfaces; this list must
4389 * not be modified by the driver, but can be read with RTNL/RCU protection.
4391 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
4394 * @extended_capabilities: extended capabilities supported by the driver,
4395 * additional capabilities might be supported by userspace; these are
4396 * the 802.11 extended capabilities ("Extended Capabilities element")
4397 * and are in the same format as in the information element. See
4398 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
4399 * extended capabilities to be used if the capabilities are not specified
4400 * for a specific interface type in iftype_ext_capab.
4401 * @extended_capabilities_mask: mask of the valid values
4402 * @extended_capabilities_len: length of the extended capabilities
4403 * @iftype_ext_capab: array of extended capabilities per interface type
4404 * @num_iftype_ext_capab: number of interface types for which extended
4405 * capabilities are specified separately.
4406 * @coalesce: packet coalescing support information
4408 * @vendor_commands: array of vendor commands supported by the hardware
4409 * @n_vendor_commands: number of vendor commands
4410 * @vendor_events: array of vendor events supported by the hardware
4411 * @n_vendor_events: number of vendor events
4413 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4414 * (including P2P GO) or 0 to indicate no such limit is advertised. The
4415 * driver is allowed to advertise a theoretical limit that it can reach in
4416 * some cases, but may not always reach.
4418 * @max_num_csa_counters: Number of supported csa_counters in beacons
4419 * and probe responses. This value should be set if the driver
4420 * wishes to limit the number of csa counters. Default (0) means
4422 * @max_adj_channel_rssi_comp: max offset of between the channel on which the
4423 * frame was sent and the channel on which the frame was heard for which
4424 * the reported rssi is still valid. If a driver is able to compensate the
4425 * low rssi when a frame is heard on different channel, then it should set
4426 * this variable to the maximal offset for which it can compensate.
4427 * This value should be set in MHz.
4428 * @bss_select_support: bitmask indicating the BSS selection criteria supported
4429 * by the driver in the .connect() callback. The bit position maps to the
4430 * attribute indices defined in &enum nl80211_bss_select_attr.
4432 * @nan_supported_bands: bands supported by the device in NAN mode, a
4433 * bitmap of &enum nl80211_band values. For instance, for
4434 * NL80211_BAND_2GHZ, bit 0 would be set
4435 * (i.e. BIT(NL80211_BAND_2GHZ)).
4437 * @txq_limit: configuration of internal TX queue frame limit
4438 * @txq_memory_limit: configuration internal TX queue memory limit
4439 * @txq_quantum: configuration of internal TX queue scheduler quantum
4441 * @support_mbssid: can HW support association with nontransmitted AP
4442 * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4443 * HE AP, in order to avoid compatibility issues.
4444 * @support_mbssid must be set for this to have any effect.
4446 * @pmsr_capa: peer measurement capabilities
4449 /* assign these fields before you register the wiphy */
4451 /* permanent MAC address(es) */
4452 u8 perm_addr[ETH_ALEN];
4453 u8 addr_mask[ETH_ALEN];
4455 struct mac_address *addresses;
4457 const struct ieee80211_txrx_stypes *mgmt_stypes;
4459 const struct ieee80211_iface_combination *iface_combinations;
4460 int n_iface_combinations;
4461 u16 software_iftypes;
4465 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4466 u16 interface_modes;
4468 u16 max_acl_mac_addrs;
4470 u32 flags, regulatory_flags, features;
4471 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4475 enum cfg80211_signal_type signal_type;
4479 u8 max_sched_scan_reqs;
4480 u8 max_sched_scan_ssids;
4482 u16 max_scan_ie_len;
4483 u16 max_sched_scan_ie_len;
4484 u32 max_sched_scan_plans;
4485 u32 max_sched_scan_plan_interval;
4486 u32 max_sched_scan_plan_iterations;
4488 int n_cipher_suites;
4489 const u32 *cipher_suites;
4492 const u32 *akm_suites;
4500 char fw_version[ETHTOOL_FWVERS_LEN];
4504 const struct wiphy_wowlan_support *wowlan;
4505 struct cfg80211_wowlan *wowlan_config;
4508 u16 max_remain_on_channel_duration;
4512 u32 available_antennas_tx;
4513 u32 available_antennas_rx;
4516 * Bitmap of supported protocols for probe response offloading
4517 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
4518 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4520 u32 probe_resp_offload;
4522 const u8 *extended_capabilities, *extended_capabilities_mask;
4523 u8 extended_capabilities_len;
4525 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4526 unsigned int num_iftype_ext_capab;
4528 /* If multiple wiphys are registered and you're handed e.g.
4529 * a regular netdev with assigned ieee80211_ptr, you won't
4530 * know whether it points to a wiphy your driver has registered
4531 * or not. Assign this to something global to your driver to
4532 * help determine whether you own this wiphy or not. */
4535 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
4537 /* Lets us get back the wiphy on the callback */
4538 void (*reg_notifier)(struct wiphy *wiphy,
4539 struct regulatory_request *request);
4541 /* fields below are read-only, assigned by cfg80211 */
4543 const struct ieee80211_regdomain __rcu *regd;
4545 /* the item in /sys/class/ieee80211/ points to this,
4546 * you need use set_wiphy_dev() (see below) */
4549 /* protects ->resume, ->suspend sysfs callbacks against unregister hw */
4552 /* dir in debugfs: ieee80211/<wiphyname> */
4553 struct dentry *debugfsdir;
4555 const struct ieee80211_ht_cap *ht_capa_mod_mask;
4556 const struct ieee80211_vht_cap *vht_capa_mod_mask;
4558 struct list_head wdev_list;
4560 /* the network namespace this phy lives in currently */
4561 possible_net_t _net;
4563 #ifdef CONFIG_CFG80211_WEXT
4564 const struct iw_handler_def *wext;
4567 const struct wiphy_coalesce_support *coalesce;
4569 const struct wiphy_vendor_command *vendor_commands;
4570 const struct nl80211_vendor_cmd_info *vendor_events;
4571 int n_vendor_commands, n_vendor_events;
4573 u16 max_ap_assoc_sta;
4575 u8 max_num_csa_counters;
4576 u8 max_adj_channel_rssi_comp;
4578 u32 bss_select_support;
4580 u8 nan_supported_bands;
4583 u32 txq_memory_limit;
4586 u8 support_mbssid:1,
4587 support_only_he_mbssid:1;
4589 const struct cfg80211_pmsr_capabilities *pmsr_capa;
4591 char priv[0] __aligned(NETDEV_ALIGN);
4594 static inline struct net *wiphy_net(struct wiphy *wiphy)
4596 return read_pnet(&wiphy->_net);
4599 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
4601 write_pnet(&wiphy->_net, net);
4605 * wiphy_priv - return priv from wiphy
4607 * @wiphy: the wiphy whose priv pointer to return
4608 * Return: The priv of @wiphy.
4610 static inline void *wiphy_priv(struct wiphy *wiphy)
4613 return &wiphy->priv;
4617 * priv_to_wiphy - return the wiphy containing the priv
4619 * @priv: a pointer previously returned by wiphy_priv
4620 * Return: The wiphy of @priv.
4622 static inline struct wiphy *priv_to_wiphy(void *priv)
4625 return container_of(priv, struct wiphy, priv);
4629 * set_wiphy_dev - set device pointer for wiphy
4631 * @wiphy: The wiphy whose device to bind
4632 * @dev: The device to parent it to
4634 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
4636 wiphy->dev.parent = dev;
4640 * wiphy_dev - get wiphy dev pointer
4642 * @wiphy: The wiphy whose device struct to look up
4643 * Return: The dev of @wiphy.
4645 static inline struct device *wiphy_dev(struct wiphy *wiphy)
4647 return wiphy->dev.parent;
4651 * wiphy_name - get wiphy name
4653 * @wiphy: The wiphy whose name to return
4654 * Return: The name of @wiphy.
4656 static inline const char *wiphy_name(const struct wiphy *wiphy)
4658 return dev_name(&wiphy->dev);
4662 * wiphy_new_nm - create a new wiphy for use with cfg80211
4664 * @ops: The configuration operations for this device
4665 * @sizeof_priv: The size of the private area to allocate
4666 * @requested_name: Request a particular name.
4667 * NULL is valid value, and means use the default phy%d naming.
4669 * Create a new wiphy and associate the given operations with it.
4670 * @sizeof_priv bytes are allocated for private use.
4672 * Return: A pointer to the new wiphy. This pointer must be
4673 * assigned to each netdev's ieee80211_ptr for proper operation.
4675 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
4676 const char *requested_name);
4679 * wiphy_new - create a new wiphy for use with cfg80211
4681 * @ops: The configuration operations for this device
4682 * @sizeof_priv: The size of the private area to allocate
4684 * Create a new wiphy and associate the given operations with it.
4685 * @sizeof_priv bytes are allocated for private use.
4687 * Return: A pointer to the new wiphy. This pointer must be
4688 * assigned to each netdev's ieee80211_ptr for proper operation.
4690 static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
4693 return wiphy_new_nm(ops, sizeof_priv, NULL);
4697 * wiphy_register - register a wiphy with cfg80211
4699 * @wiphy: The wiphy to register.
4701 * Return: A non-negative wiphy index or a negative error code.
4703 int wiphy_register(struct wiphy *wiphy);
4706 * wiphy_unregister - deregister a wiphy from cfg80211
4708 * @wiphy: The wiphy to unregister.
4710 * After this call, no more requests can be made with this priv
4711 * pointer, but the call may sleep to wait for an outstanding
4712 * request that is being handled.
4714 void wiphy_unregister(struct wiphy *wiphy);
4717 * wiphy_free - free wiphy
4719 * @wiphy: The wiphy to free
4721 void wiphy_free(struct wiphy *wiphy);
4723 /* internal structs */
4724 struct cfg80211_conn;
4725 struct cfg80211_internal_bss;
4726 struct cfg80211_cached_keys;
4727 struct cfg80211_cqm_config;
4730 * struct wireless_dev - wireless device state
4732 * For netdevs, this structure must be allocated by the driver
4733 * that uses the ieee80211_ptr field in struct net_device (this
4734 * is intentional so it can be allocated along with the netdev.)
4735 * It need not be registered then as netdev registration will
4736 * be intercepted by cfg80211 to see the new wireless device.
4738 * For non-netdev uses, it must also be allocated by the driver
4739 * in response to the cfg80211 callbacks that require it, as
4740 * there's no netdev registration in that case it may not be
4741 * allocated outside of callback operations that return it.
4743 * @wiphy: pointer to hardware description
4744 * @iftype: interface type
4745 * @list: (private) Used to collect the interfaces
4746 * @netdev: (private) Used to reference back to the netdev, may be %NULL
4747 * @identifier: (private) Identifier used in nl80211 to identify this
4748 * wireless device if it has no netdev
4749 * @current_bss: (private) Used by the internal configuration code
4750 * @chandef: (private) Used by the internal configuration code to track
4751 * the user-set channel definition.
4752 * @preset_chandef: (private) Used by the internal configuration code to
4753 * track the channel to be used for AP later
4754 * @bssid: (private) Used by the internal configuration code
4755 * @ssid: (private) Used by the internal configuration code
4756 * @ssid_len: (private) Used by the internal configuration code
4757 * @mesh_id_len: (private) Used by the internal configuration code
4758 * @mesh_id_up_len: (private) Used by the internal configuration code
4759 * @wext: (private) Used by the internal wireless extensions compat code
4760 * @wext.ibss: (private) IBSS data part of wext handling
4761 * @wext.connect: (private) connection handling data
4762 * @wext.keys: (private) (WEP) key data
4763 * @wext.ie: (private) extra elements for association
4764 * @wext.ie_len: (private) length of extra elements
4765 * @wext.bssid: (private) selected network BSSID
4766 * @wext.ssid: (private) selected network SSID
4767 * @wext.default_key: (private) selected default key index
4768 * @wext.default_mgmt_key: (private) selected default management key index
4769 * @wext.prev_bssid: (private) previous BSSID for reassociation
4770 * @wext.prev_bssid_valid: (private) previous BSSID validity
4771 * @use_4addr: indicates 4addr mode is used on this interface, must be
4772 * set by driver (if supported) on add_interface BEFORE registering the
4773 * netdev and may otherwise be used by driver read-only, will be update
4774 * by cfg80211 on change_interface
4775 * @mgmt_registrations: list of registrations for management frames
4776 * @mgmt_registrations_lock: lock for the list
4777 * @mtx: mutex used to lock data in this struct, may be used by drivers
4778 * and some API functions require it held
4779 * @beacon_interval: beacon interval used on this device for transmitting
4780 * beacons, 0 when not valid
4781 * @address: The address for this device, valid only if @netdev is %NULL
4782 * @is_running: true if this is a non-netdev device that has been started, e.g.
4784 * @cac_started: true if DFS channel availability check has been started
4785 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
4786 * @cac_time_ms: CAC time in ms
4787 * @ps: powersave mode is enabled
4788 * @ps_timeout: dynamic powersave timeout
4789 * @ap_unexpected_nlportid: (private) netlink port ID of application
4790 * registered for unexpected class 3 frames (AP mode)
4791 * @conn: (private) cfg80211 software SME connection state machine data
4792 * @connect_keys: (private) keys to set after connection is established
4793 * @conn_bss_type: connecting/connected BSS type
4794 * @conn_owner_nlportid: (private) connection owner socket port ID
4795 * @disconnect_wk: (private) auto-disconnect work
4796 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
4797 * @ibss_fixed: (private) IBSS is using fixed BSSID
4798 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
4799 * @event_list: (private) list for internal event processing
4800 * @event_lock: (private) lock for event list
4801 * @owner_nlportid: (private) owner socket port ID
4802 * @nl_owner_dead: (private) owner socket went away
4803 * @cqm_config: (private) nl80211 RSSI monitor state
4804 * @pmsr_list: (private) peer measurement requests
4805 * @pmsr_lock: (private) peer measurements requests/results lock
4806 * @pmsr_free_wk: (private) peer measurements cleanup work
4808 struct wireless_dev {
4809 struct wiphy *wiphy;
4810 enum nl80211_iftype iftype;
4812 /* the remainder of this struct should be private to cfg80211 */
4813 struct list_head list;
4814 struct net_device *netdev;
4818 struct list_head mgmt_registrations;
4819 spinlock_t mgmt_registrations_lock;
4823 bool use_4addr, is_running;
4825 u8 address[ETH_ALEN] __aligned(sizeof(u16));
4827 /* currently used for IBSS and SME - might be rearranged later */
4828 u8 ssid[IEEE80211_MAX_SSID_LEN];
4829 u8 ssid_len, mesh_id_len, mesh_id_up_len;
4830 struct cfg80211_conn *conn;
4831 struct cfg80211_cached_keys *connect_keys;
4832 enum ieee80211_bss_type conn_bss_type;
4833 u32 conn_owner_nlportid;
4835 struct work_struct disconnect_wk;
4836 u8 disconnect_bssid[ETH_ALEN];
4838 struct list_head event_list;
4839 spinlock_t event_lock;
4841 struct cfg80211_internal_bss *current_bss; /* associated / joined */
4842 struct cfg80211_chan_def preset_chandef;
4843 struct cfg80211_chan_def chandef;
4846 bool ibss_dfs_possible;
4851 int beacon_interval;
4853 u32 ap_unexpected_nlportid;
4859 unsigned long cac_start_time;
4860 unsigned int cac_time_ms;
4862 #ifdef CONFIG_CFG80211_WEXT
4865 struct cfg80211_ibss_params ibss;
4866 struct cfg80211_connect_params connect;
4867 struct cfg80211_cached_keys *keys;
4871 u8 prev_bssid[ETH_ALEN];
4872 u8 ssid[IEEE80211_MAX_SSID_LEN];
4873 s8 default_key, default_mgmt_key;
4874 bool prev_bssid_valid;
4878 struct cfg80211_cqm_config *cqm_config;
4880 struct list_head pmsr_list;
4881 spinlock_t pmsr_lock;
4882 struct work_struct pmsr_free_wk;
4885 static inline u8 *wdev_address(struct wireless_dev *wdev)
4888 return wdev->netdev->dev_addr;
4889 return wdev->address;
4892 static inline bool wdev_running(struct wireless_dev *wdev)
4895 return netif_running(wdev->netdev);
4896 return wdev->is_running;
4900 * wdev_priv - return wiphy priv from wireless_dev
4902 * @wdev: The wireless device whose wiphy's priv pointer to return
4903 * Return: The wiphy priv of @wdev.
4905 static inline void *wdev_priv(struct wireless_dev *wdev)
4908 return wiphy_priv(wdev->wiphy);
4912 * DOC: Utility functions
4914 * cfg80211 offers a number of utility functions that can be useful.
4918 * ieee80211_channel_to_frequency - convert channel number to frequency
4919 * @chan: channel number
4920 * @band: band, necessary due to channel number overlap
4921 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
4923 int ieee80211_channel_to_frequency(int chan, enum nl80211_band band);
4926 * ieee80211_frequency_to_channel - convert frequency to channel number
4927 * @freq: center frequency
4928 * Return: The corresponding channel, or 0 if the conversion failed.
4930 int ieee80211_frequency_to_channel(int freq);
4933 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
4935 * @wiphy: the struct wiphy to get the channel for
4936 * @freq: the center frequency of the channel
4938 * Return: The channel struct from @wiphy at @freq.
4940 struct ieee80211_channel *ieee80211_get_channel(struct wiphy *wiphy, int freq);
4943 * ieee80211_get_response_rate - get basic rate for a given rate
4945 * @sband: the band to look for rates in
4946 * @basic_rates: bitmap of basic rates
4947 * @bitrate: the bitrate for which to find the basic rate
4949 * Return: The basic rate corresponding to a given bitrate, that
4950 * is the next lower bitrate contained in the basic rate map,
4951 * which is, for this function, given as a bitmap of indices of
4952 * rates in the band's bitrate table.
4954 struct ieee80211_rate *
4955 ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
4956 u32 basic_rates, int bitrate);
4959 * ieee80211_mandatory_rates - get mandatory rates for a given band
4960 * @sband: the band to look for rates in
4961 * @scan_width: width of the control channel
4963 * This function returns a bitmap of the mandatory rates for the given
4964 * band, bits are set according to the rate position in the bitrates array.
4966 u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
4967 enum nl80211_bss_scan_width scan_width);
4970 * Radiotap parsing functions -- for controlled injection support
4972 * Implemented in net/wireless/radiotap.c
4973 * Documentation in Documentation/networking/radiotap-headers.txt
4976 struct radiotap_align_size {
4977 uint8_t align:4, size:4;
4980 struct ieee80211_radiotap_namespace {
4981 const struct radiotap_align_size *align_size;
4987 struct ieee80211_radiotap_vendor_namespaces {
4988 const struct ieee80211_radiotap_namespace *ns;
4993 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
4994 * @this_arg_index: index of current arg, valid after each successful call
4995 * to ieee80211_radiotap_iterator_next()
4996 * @this_arg: pointer to current radiotap arg; it is valid after each
4997 * call to ieee80211_radiotap_iterator_next() but also after
4998 * ieee80211_radiotap_iterator_init() where it will point to
4999 * the beginning of the actual data portion
5000 * @this_arg_size: length of the current arg, for convenience
5001 * @current_namespace: pointer to the current namespace definition
5002 * (or internally %NULL if the current namespace is unknown)
5003 * @is_radiotap_ns: indicates whether the current namespace is the default
5004 * radiotap namespace or not
5006 * @_rtheader: pointer to the radiotap header we are walking through
5007 * @_max_length: length of radiotap header in cpu byte ordering
5008 * @_arg_index: next argument index
5009 * @_arg: next argument pointer
5010 * @_next_bitmap: internal pointer to next present u32
5011 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
5012 * @_vns: vendor namespace definitions
5013 * @_next_ns_data: beginning of the next namespace's data
5014 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
5017 * Describes the radiotap parser state. Fields prefixed with an underscore
5018 * must not be used by users of the parser, only by the parser internally.
5021 struct ieee80211_radiotap_iterator {
5022 struct ieee80211_radiotap_header *_rtheader;
5023 const struct ieee80211_radiotap_vendor_namespaces *_vns;
5024 const struct ieee80211_radiotap_namespace *current_namespace;
5026 unsigned char *_arg, *_next_ns_data;
5027 __le32 *_next_bitmap;
5029 unsigned char *this_arg;
5037 uint32_t _bitmap_shifter;
5042 ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5043 struct ieee80211_radiotap_header *radiotap_header,
5045 const struct ieee80211_radiotap_vendor_namespaces *vns);
5048 ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5051 extern const unsigned char rfc1042_header[6];
5052 extern const unsigned char bridge_tunnel_header[6];
5055 * ieee80211_get_hdrlen_from_skb - get header length from data
5059 * Given an skb with a raw 802.11 header at the data pointer this function
5060 * returns the 802.11 header length.
5062 * Return: The 802.11 header length in bytes (not including encryption
5063 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
5066 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5069 * ieee80211_hdrlen - get header length in bytes from frame control
5070 * @fc: frame control field in little-endian format
5071 * Return: The header length in bytes.
5073 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5076 * ieee80211_get_mesh_hdrlen - get mesh extension header length
5077 * @meshhdr: the mesh extension header, only the flags field
5078 * (first byte) will be accessed
5079 * Return: The length of the extension header, which is always at
5080 * least 6 bytes and at most 18 if address 5 and 6 are present.
5082 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
5085 * DOC: Data path helpers
5087 * In addition to generic utilities, cfg80211 also offers
5088 * functions that help implement the data path for devices
5089 * that do not do the 802.11/802.3 conversion on the device.
5093 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
5094 * @skb: the 802.11 data frame
5095 * @ehdr: pointer to a &struct ethhdr that will get the header, instead
5096 * of it being pushed into the SKB
5097 * @addr: the device MAC address
5098 * @iftype: the virtual interface type
5099 * @data_offset: offset of payload after the 802.11 header
5100 * Return: 0 on success. Non-zero on error.
5102 int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
5103 const u8 *addr, enum nl80211_iftype iftype,
5107 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5108 * @skb: the 802.11 data frame
5109 * @addr: the device MAC address
5110 * @iftype: the virtual interface type
5111 * Return: 0 on success. Non-zero on error.
5113 static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
5114 enum nl80211_iftype iftype)
5116 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
5120 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5122 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
5123 * The @list will be empty if the decode fails. The @skb must be fully
5124 * header-less before being passed in here; it is freed in this function.
5126 * @skb: The input A-MSDU frame without any headers.
5127 * @list: The output list of 802.3 frames. It must be allocated and
5128 * initialized by by the caller.
5129 * @addr: The device MAC address.
5130 * @iftype: The device interface type.
5131 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
5132 * @check_da: DA to check in the inner ethernet header, or NULL
5133 * @check_sa: SA to check in the inner ethernet header, or NULL
5135 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5136 const u8 *addr, enum nl80211_iftype iftype,
5137 const unsigned int extra_headroom,
5138 const u8 *check_da, const u8 *check_sa);
5141 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5142 * @skb: the data frame
5143 * @qos_map: Interworking QoS mapping or %NULL if not in use
5144 * Return: The 802.1p/1d tag.
5146 unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5147 struct cfg80211_qos_map *qos_map);
5150 * cfg80211_find_elem_match - match information element and byte array in data
5153 * @ies: data consisting of IEs
5154 * @len: length of data
5155 * @match: byte array to match
5156 * @match_len: number of bytes in the match array
5157 * @match_offset: offset in the IE data where the byte array should match.
5158 * Note the difference to cfg80211_find_ie_match() which considers
5159 * the offset to start from the element ID byte, but here we take
5160 * the data portion instead.
5162 * Return: %NULL if the element ID could not be found or if
5163 * the element is invalid (claims to be longer than the given
5164 * data) or if the byte array doesn't match; otherwise return the
5165 * requested element struct.
5167 * Note: There are no checks on the element length other than
5168 * having to fit into the given data and being large enough for the
5169 * byte array to match.
5171 const struct element *
5172 cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
5173 const u8 *match, unsigned int match_len,
5174 unsigned int match_offset);
5177 * cfg80211_find_ie_match - match information element and byte array in data
5180 * @ies: data consisting of IEs
5181 * @len: length of data
5182 * @match: byte array to match
5183 * @match_len: number of bytes in the match array
5184 * @match_offset: offset in the IE where the byte array should match.
5185 * If match_len is zero, this must also be set to zero.
5186 * Otherwise this must be set to 2 or more, because the first
5187 * byte is the element id, which is already compared to eid, and
5188 * the second byte is the IE length.
5190 * Return: %NULL if the element ID could not be found or if
5191 * the element is invalid (claims to be longer than the given
5192 * data) or if the byte array doesn't match, or a pointer to the first
5193 * byte of the requested element, that is the byte containing the
5196 * Note: There are no checks on the element length other than
5197 * having to fit into the given data and being large enough for the
5198 * byte array to match.
5200 static inline const u8 *
5201 cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
5202 const u8 *match, unsigned int match_len,
5203 unsigned int match_offset)
5205 /* match_offset can't be smaller than 2, unless match_len is
5206 * zero, in which case match_offset must be zero as well.
5208 if (WARN_ON((match_len && match_offset < 2) ||
5209 (!match_len && match_offset)))
5212 return (void *)cfg80211_find_elem_match(eid, ies, len,
5215 match_offset - 2 : 0);
5219 * cfg80211_find_elem - find information element in data
5222 * @ies: data consisting of IEs
5223 * @len: length of data
5225 * Return: %NULL if the element ID could not be found or if
5226 * the element is invalid (claims to be longer than the given
5227 * data) or if the byte array doesn't match; otherwise return the
5228 * requested element struct.
5230 * Note: There are no checks on the element length other than
5231 * having to fit into the given data.
5233 static inline const struct element *
5234 cfg80211_find_elem(u8 eid, const u8 *ies, int len)
5236 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
5240 * cfg80211_find_ie - find information element in data
5243 * @ies: data consisting of IEs
5244 * @len: length of data
5246 * Return: %NULL if the element ID could not be found or if
5247 * the element is invalid (claims to be longer than the given
5248 * data), or a pointer to the first byte of the requested
5249 * element, that is the byte containing the element ID.
5251 * Note: There are no checks on the element length other than
5252 * having to fit into the given data.
5254 static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5256 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5260 * cfg80211_find_ext_elem - find information element with EID Extension in data
5262 * @ext_eid: element ID Extension
5263 * @ies: data consisting of IEs
5264 * @len: length of data
5266 * Return: %NULL if the etended element could not be found or if
5267 * the element is invalid (claims to be longer than the given
5268 * data) or if the byte array doesn't match; otherwise return the
5269 * requested element struct.
5271 * Note: There are no checks on the element length other than
5272 * having to fit into the given data.
5274 static inline const struct element *
5275 cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
5277 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
5282 * cfg80211_find_ext_ie - find information element with EID Extension in data
5284 * @ext_eid: element ID Extension
5285 * @ies: data consisting of IEs
5286 * @len: length of data
5288 * Return: %NULL if the extended element ID could not be found or if
5289 * the element is invalid (claims to be longer than the given
5290 * data), or a pointer to the first byte of the requested
5291 * element, that is the byte containing the element ID.
5293 * Note: There are no checks on the element length other than
5294 * having to fit into the given data.
5296 static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
5298 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
5303 * cfg80211_find_vendor_elem - find vendor specific information element in data
5306 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5307 * @ies: data consisting of IEs
5308 * @len: length of data
5310 * Return: %NULL if the vendor specific element ID could not be found or if the
5311 * element is invalid (claims to be longer than the given data); otherwise
5312 * return the element structure for the requested element.
5314 * Note: There are no checks on the element length other than having to fit into
5317 const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
5322 * cfg80211_find_vendor_ie - find vendor specific information element in data
5325 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5326 * @ies: data consisting of IEs
5327 * @len: length of data
5329 * Return: %NULL if the vendor specific element ID could not be found or if the
5330 * element is invalid (claims to be longer than the given data), or a pointer to
5331 * the first byte of the requested element, that is the byte containing the
5334 * Note: There are no checks on the element length other than having to fit into
5337 static inline const u8 *
5338 cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
5339 const u8 *ies, unsigned int len)
5341 return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
5345 * cfg80211_send_layer2_update - send layer 2 update frame
5347 * @dev: network device
5348 * @addr: STA MAC address
5350 * Wireless drivers can use this function to update forwarding tables in bridge
5351 * devices upon STA association.
5353 void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
5356 * DOC: Regulatory enforcement infrastructure
5362 * regulatory_hint - driver hint to the wireless core a regulatory domain
5363 * @wiphy: the wireless device giving the hint (used only for reporting
5365 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5366 * should be in. If @rd is set this should be NULL. Note that if you
5367 * set this to NULL you should still set rd->alpha2 to some accepted
5370 * Wireless drivers can use this function to hint to the wireless core
5371 * what it believes should be the current regulatory domain by
5372 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5373 * domain should be in or by providing a completely build regulatory domain.
5374 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5375 * for a regulatory domain structure for the respective country.
5377 * The wiphy must have been registered to cfg80211 prior to this call.
5378 * For cfg80211 drivers this means you must first use wiphy_register(),
5379 * for mac80211 drivers you must first use ieee80211_register_hw().
5381 * Drivers should check the return value, its possible you can get
5384 * Return: 0 on success. -ENOMEM.
5386 int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5389 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5390 * @wiphy: the wireless device we want to process the regulatory domain on
5391 * @rd: the regulatory domain informatoin to use for this wiphy
5393 * Set the regulatory domain information for self-managed wiphys, only they
5394 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5397 * Return: 0 on success. -EINVAL, -EPERM
5399 int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5400 struct ieee80211_regdomain *rd);
5403 * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
5404 * @wiphy: the wireless device we want to process the regulatory domain on
5405 * @rd: the regulatory domain information to use for this wiphy
5407 * This functions requires the RTNL to be held and applies the new regdomain
5408 * synchronously to this wiphy. For more details see
5409 * regulatory_set_wiphy_regd().
5411 * Return: 0 on success. -EINVAL, -EPERM
5413 int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
5414 struct ieee80211_regdomain *rd);
5417 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5418 * @wiphy: the wireless device we want to process the regulatory domain on
5419 * @regd: the custom regulatory domain to use for this wiphy
5421 * Drivers can sometimes have custom regulatory domains which do not apply
5422 * to a specific country. Drivers can use this to apply such custom regulatory
5423 * domains. This routine must be called prior to wiphy registration. The
5424 * custom regulatory domain will be trusted completely and as such previous
5425 * default channel settings will be disregarded. If no rule is found for a
5426 * channel on the regulatory domain the channel will be disabled.
5427 * Drivers using this for a wiphy should also set the wiphy flag
5428 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
5429 * that called this helper.
5431 void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5432 const struct ieee80211_regdomain *regd);
5435 * freq_reg_info - get regulatory information for the given frequency
5436 * @wiphy: the wiphy for which we want to process this rule for
5437 * @center_freq: Frequency in KHz for which we want regulatory information for
5439 * Use this function to get the regulatory rule for a specific frequency on
5440 * a given wireless device. If the device has a specific regulatory domain
5441 * it wants to follow we respect that unless a country IE has been received
5442 * and processed already.
5444 * Return: A valid pointer, or, when an error occurs, for example if no rule
5445 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
5446 * check and PTR_ERR() to obtain the numeric return value. The numeric return
5447 * value will be -ERANGE if we determine the given center_freq does not even
5448 * have a regulatory rule for a frequency range in the center_freq's band.
5449 * See freq_in_rule_band() for our current definition of a band -- this is
5450 * purely subjective and right now it's 802.11 specific.
5452 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5456 * reg_initiator_name - map regulatory request initiator enum to name
5457 * @initiator: the regulatory request initiator
5459 * You can use this to map the regulatory request initiator enum to a
5460 * proper string representation.
5462 const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5465 * DOC: Internal regulatory db functions
5470 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
5471 * Regulatory self-managed driver can use it to proactively
5473 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
5474 * @freq: the freqency(in MHz) to be queried.
5475 * @rule: pointer to store the wmm rule from the regulatory db.
5477 * Self-managed wireless drivers can use this function to query
5478 * the internal regulatory database to check whether the given
5479 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
5481 * Drivers should check the return value, its possible you can get
5484 * Return: 0 on success. -ENODATA.
5486 int reg_query_regdb_wmm(char *alpha2, int freq,
5487 struct ieee80211_reg_rule *rule);
5490 * callbacks for asynchronous cfg80211 methods, notification
5491 * functions and BSS handling helpers
5495 * cfg80211_scan_done - notify that scan finished
5497 * @request: the corresponding scan request
5498 * @info: information about the completed scan
5500 void cfg80211_scan_done(struct cfg80211_scan_request *request,
5501 struct cfg80211_scan_info *info);
5504 * cfg80211_sched_scan_results - notify that new scan results are available
5506 * @wiphy: the wiphy which got scheduled scan results
5507 * @reqid: identifier for the related scheduled scan request
5509 void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
5512 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
5514 * @wiphy: the wiphy on which the scheduled scan stopped
5515 * @reqid: identifier for the related scheduled scan request
5517 * The driver can call this function to inform cfg80211 that the
5518 * scheduled scan had to be stopped, for whatever reason. The driver
5519 * is then called back via the sched_scan_stop operation when done.
5521 void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
5524 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
5526 * @wiphy: the wiphy on which the scheduled scan stopped
5527 * @reqid: identifier for the related scheduled scan request
5529 * The driver can call this function to inform cfg80211 that the
5530 * scheduled scan had to be stopped, for whatever reason. The driver
5531 * is then called back via the sched_scan_stop operation when done.
5532 * This function should be called with rtnl locked.
5534 void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
5537 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
5538 * @wiphy: the wiphy reporting the BSS
5539 * @data: the BSS metadata
5540 * @mgmt: the management frame (probe response or beacon)
5541 * @len: length of the management frame
5542 * @gfp: context flags
5544 * This informs cfg80211 that BSS information was found and
5545 * the BSS should be updated/added.
5547 * Return: A referenced struct, must be released with cfg80211_put_bss()!
5548 * Or %NULL on error.
5550 struct cfg80211_bss * __must_check
5551 cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
5552 struct cfg80211_inform_bss *data,
5553 struct ieee80211_mgmt *mgmt, size_t len,
5556 static inline struct cfg80211_bss * __must_check
5557 cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
5558 struct ieee80211_channel *rx_channel,
5559 enum nl80211_bss_scan_width scan_width,
5560 struct ieee80211_mgmt *mgmt, size_t len,
5561 s32 signal, gfp_t gfp)
5563 struct cfg80211_inform_bss data = {
5565 .scan_width = scan_width,
5569 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5572 static inline struct cfg80211_bss * __must_check
5573 cfg80211_inform_bss_frame(struct wiphy *wiphy,
5574 struct ieee80211_channel *rx_channel,
5575 struct ieee80211_mgmt *mgmt, size_t len,
5576 s32 signal, gfp_t gfp)
5578 struct cfg80211_inform_bss data = {
5580 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
5584 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5588 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
5589 * @bssid: transmitter BSSID
5590 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
5591 * @mbssid_index: BSSID index, taken from Multiple BSSID index element
5592 * @new_bssid: calculated nontransmitted BSSID
5594 static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
5595 u8 mbssid_index, u8 *new_bssid)
5597 u64 bssid_u64 = ether_addr_to_u64(bssid);
5598 u64 mask = GENMASK_ULL(max_bssid - 1, 0);
5601 new_bssid_u64 = bssid_u64 & ~mask;
5603 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
5605 u64_to_ether_addr(new_bssid_u64, new_bssid);
5609 * cfg80211_is_element_inherited - returns if element ID should be inherited
5610 * @element: element to check
5611 * @non_inherit_element: non inheritance element
5613 bool cfg80211_is_element_inherited(const struct element *element,
5614 const struct element *non_inherit_element);
5617 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
5619 * @ielen: length of IEs
5620 * @mbssid_elem: current MBSSID element
5621 * @sub_elem: current MBSSID subelement (profile)
5622 * @merged_ie: location of the merged profile
5623 * @max_copy_len: max merged profile length
5625 size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
5626 const struct element *mbssid_elem,
5627 const struct element *sub_elem,
5628 u8 *merged_ie, size_t max_copy_len);
5631 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
5632 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
5633 * from a beacon or probe response
5634 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
5635 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
5637 enum cfg80211_bss_frame_type {
5638 CFG80211_BSS_FTYPE_UNKNOWN,
5639 CFG80211_BSS_FTYPE_BEACON,
5640 CFG80211_BSS_FTYPE_PRESP,
5644 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
5646 * @wiphy: the wiphy reporting the BSS
5647 * @data: the BSS metadata
5648 * @ftype: frame type (if known)
5649 * @bssid: the BSSID of the BSS
5650 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
5651 * @capability: the capability field sent by the peer
5652 * @beacon_interval: the beacon interval announced by the peer
5653 * @ie: additional IEs sent by the peer
5654 * @ielen: length of the additional IEs
5655 * @gfp: context flags
5657 * This informs cfg80211 that BSS information was found and
5658 * the BSS should be updated/added.
5660 * Return: A referenced struct, must be released with cfg80211_put_bss()!
5661 * Or %NULL on error.
5663 struct cfg80211_bss * __must_check
5664 cfg80211_inform_bss_data(struct wiphy *wiphy,
5665 struct cfg80211_inform_bss *data,
5666 enum cfg80211_bss_frame_type ftype,
5667 const u8 *bssid, u64 tsf, u16 capability,
5668 u16 beacon_interval, const u8 *ie, size_t ielen,
5671 static inline struct cfg80211_bss * __must_check
5672 cfg80211_inform_bss_width(struct wiphy *wiphy,
5673 struct ieee80211_channel *rx_channel,
5674 enum nl80211_bss_scan_width scan_width,
5675 enum cfg80211_bss_frame_type ftype,
5676 const u8 *bssid, u64 tsf, u16 capability,
5677 u16 beacon_interval, const u8 *ie, size_t ielen,
5678 s32 signal, gfp_t gfp)
5680 struct cfg80211_inform_bss data = {
5682 .scan_width = scan_width,
5686 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
5687 capability, beacon_interval, ie, ielen,
5691 static inline struct cfg80211_bss * __must_check
5692 cfg80211_inform_bss(struct wiphy *wiphy,
5693 struct ieee80211_channel *rx_channel,
5694 enum cfg80211_bss_frame_type ftype,
5695 const u8 *bssid, u64 tsf, u16 capability,
5696 u16 beacon_interval, const u8 *ie, size_t ielen,
5697 s32 signal, gfp_t gfp)
5699 struct cfg80211_inform_bss data = {
5701 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
5705 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
5706 capability, beacon_interval, ie, ielen,
5711 * cfg80211_get_bss - get a BSS reference
5712 * @wiphy: the wiphy this BSS struct belongs to
5713 * @channel: the channel to search on (or %NULL)
5714 * @bssid: the desired BSSID (or %NULL)
5715 * @ssid: the desired SSID (or %NULL)
5716 * @ssid_len: length of the SSID (or 0)
5717 * @bss_type: type of BSS, see &enum ieee80211_bss_type
5718 * @privacy: privacy filter, see &enum ieee80211_privacy
5720 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
5721 struct ieee80211_channel *channel,
5723 const u8 *ssid, size_t ssid_len,
5724 enum ieee80211_bss_type bss_type,
5725 enum ieee80211_privacy privacy);
5726 static inline struct cfg80211_bss *
5727 cfg80211_get_ibss(struct wiphy *wiphy,
5728 struct ieee80211_channel *channel,
5729 const u8 *ssid, size_t ssid_len)
5731 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
5732 IEEE80211_BSS_TYPE_IBSS,
5733 IEEE80211_PRIVACY_ANY);
5737 * cfg80211_ref_bss - reference BSS struct
5738 * @wiphy: the wiphy this BSS struct belongs to
5739 * @bss: the BSS struct to reference
5741 * Increments the refcount of the given BSS struct.
5743 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5746 * cfg80211_put_bss - unref BSS struct
5747 * @wiphy: the wiphy this BSS struct belongs to
5748 * @bss: the BSS struct
5750 * Decrements the refcount of the given BSS struct.
5752 void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5755 * cfg80211_unlink_bss - unlink BSS from internal data structures
5757 * @bss: the bss to remove
5759 * This function removes the given BSS from the internal data structures
5760 * thereby making it no longer show up in scan results etc. Use this
5761 * function when you detect a BSS is gone. Normally BSSes will also time
5762 * out, so it is not necessary to use this function at all.
5764 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
5767 * cfg80211_bss_iter - iterate all BSS entries
5769 * This function iterates over the BSS entries associated with the given wiphy
5770 * and calls the callback for the iterated BSS. The iterator function is not
5771 * allowed to call functions that might modify the internal state of the BSS DB.
5774 * @chandef: if given, the iterator function will be called only if the channel
5775 * of the currently iterated BSS is a subset of the given channel.
5776 * @iter: the iterator function to call
5777 * @iter_data: an argument to the iterator function
5779 void cfg80211_bss_iter(struct wiphy *wiphy,
5780 struct cfg80211_chan_def *chandef,
5781 void (*iter)(struct wiphy *wiphy,
5782 struct cfg80211_bss *bss,
5786 static inline enum nl80211_bss_scan_width
5787 cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
5789 switch (chandef->width) {
5790 case NL80211_CHAN_WIDTH_5:
5791 return NL80211_BSS_CHAN_WIDTH_5;
5792 case NL80211_CHAN_WIDTH_10:
5793 return NL80211_BSS_CHAN_WIDTH_10;
5795 return NL80211_BSS_CHAN_WIDTH_20;
5800 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
5801 * @dev: network device
5802 * @buf: authentication frame (header + body)
5803 * @len: length of the frame data
5805 * This function is called whenever an authentication, disassociation or
5806 * deauthentication frame has been received and processed in station mode.
5807 * After being asked to authenticate via cfg80211_ops::auth() the driver must
5808 * call either this function or cfg80211_auth_timeout().
5809 * After being asked to associate via cfg80211_ops::assoc() the driver must
5810 * call either this function or cfg80211_auth_timeout().
5811 * While connected, the driver must calls this for received and processed
5812 * disassociation and deauthentication frames. If the frame couldn't be used
5813 * because it was unprotected, the driver must call the function
5814 * cfg80211_rx_unprot_mlme_mgmt() instead.
5816 * This function may sleep. The caller must hold the corresponding wdev's mutex.
5818 void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
5821 * cfg80211_auth_timeout - notification of timed out authentication
5822 * @dev: network device
5823 * @addr: The MAC address of the device with which the authentication timed out
5825 * This function may sleep. The caller must hold the corresponding wdev's
5828 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
5831 * cfg80211_rx_assoc_resp - notification of processed association response
5832 * @dev: network device
5833 * @bss: the BSS that association was requested with, ownership of the pointer
5834 * moves to cfg80211 in this call
5835 * @buf: (Re)Association Response frame (header + body)
5836 * @len: length of the frame data
5837 * @uapsd_queues: bitmap of queues configured for uapsd. Same format
5838 * as the AC bitmap in the QoS info field
5839 * @req_ies: information elements from the (Re)Association Request frame
5840 * @req_ies_len: length of req_ies data
5842 * After being asked to associate via cfg80211_ops::assoc() the driver must
5843 * call either this function or cfg80211_auth_timeout().
5845 * This function may sleep. The caller must hold the corresponding wdev's mutex.
5847 void cfg80211_rx_assoc_resp(struct net_device *dev,
5848 struct cfg80211_bss *bss,
5849 const u8 *buf, size_t len,
5851 const u8 *req_ies, size_t req_ies_len);
5854 * cfg80211_assoc_timeout - notification of timed out association
5855 * @dev: network device
5856 * @bss: The BSS entry with which association timed out.
5858 * This function may sleep. The caller must hold the corresponding wdev's mutex.
5860 void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
5863 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
5864 * @dev: network device
5865 * @bss: The BSS entry with which association was abandoned.
5867 * Call this whenever - for reasons reported through other API, like deauth RX,
5868 * an association attempt was abandoned.
5869 * This function may sleep. The caller must hold the corresponding wdev's mutex.
5871 void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
5874 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
5875 * @dev: network device
5876 * @buf: 802.11 frame (header + body)
5877 * @len: length of the frame data
5879 * This function is called whenever deauthentication has been processed in
5880 * station mode. This includes both received deauthentication frames and
5881 * locally generated ones. This function may sleep. The caller must hold the
5882 * corresponding wdev's mutex.
5884 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
5887 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
5888 * @dev: network device
5889 * @buf: deauthentication frame (header + body)
5890 * @len: length of the frame data
5892 * This function is called whenever a received deauthentication or dissassoc
5893 * frame has been dropped in station mode because of MFP being used but the
5894 * frame was not protected. This function may sleep.
5896 void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
5897 const u8 *buf, size_t len);
5900 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
5901 * @dev: network device
5902 * @addr: The source MAC address of the frame
5903 * @key_type: The key type that the received frame used
5904 * @key_id: Key identifier (0..3). Can be -1 if missing.
5905 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
5906 * @gfp: allocation flags
5908 * This function is called whenever the local MAC detects a MIC failure in a
5909 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
5912 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
5913 enum nl80211_key_type key_type, int key_id,
5914 const u8 *tsc, gfp_t gfp);
5917 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
5919 * @dev: network device
5920 * @bssid: the BSSID of the IBSS joined
5921 * @channel: the channel of the IBSS joined
5922 * @gfp: allocation flags
5924 * This function notifies cfg80211 that the device joined an IBSS or
5925 * switched to a different BSSID. Before this function can be called,
5926 * either a beacon has to have been received from the IBSS, or one of
5927 * the cfg80211_inform_bss{,_frame} functions must have been called
5928 * with the locally generated beacon -- this guarantees that there is
5929 * always a scan result for this IBSS. cfg80211 will handle the rest.
5931 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
5932 struct ieee80211_channel *channel, gfp_t gfp);
5935 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
5937 * @dev: network device
5938 * @macaddr: the MAC address of the new candidate
5939 * @ie: information elements advertised by the peer candidate
5940 * @ie_len: length of the information elements buffer
5941 * @gfp: allocation flags
5943 * This function notifies cfg80211 that the mesh peer candidate has been
5944 * detected, most likely via a beacon or, less likely, via a probe response.
5945 * cfg80211 then sends a notification to userspace.
5947 void cfg80211_notify_new_peer_candidate(struct net_device *dev,
5948 const u8 *macaddr, const u8 *ie, u8 ie_len,
5949 int sig_dbm, gfp_t gfp);
5952 * DOC: RFkill integration
5954 * RFkill integration in cfg80211 is almost invisible to drivers,
5955 * as cfg80211 automatically registers an rfkill instance for each
5956 * wireless device it knows about. Soft kill is also translated
5957 * into disconnecting and turning all interfaces off, drivers are
5958 * expected to turn off the device when all interfaces are down.
5960 * However, devices may have a hard RFkill line, in which case they
5961 * also need to interact with the rfkill subsystem, via cfg80211.
5962 * They can do this with a few helper functions documented here.
5966 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
5968 * @blocked: block status
5970 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
5973 * wiphy_rfkill_start_polling - start polling rfkill
5976 void wiphy_rfkill_start_polling(struct wiphy *wiphy);
5979 * wiphy_rfkill_stop_polling - stop polling rfkill
5982 void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
5985 * DOC: Vendor commands
5987 * Occasionally, there are special protocol or firmware features that
5988 * can't be implemented very openly. For this and similar cases, the
5989 * vendor command functionality allows implementing the features with
5990 * (typically closed-source) userspace and firmware, using nl80211 as
5991 * the configuration mechanism.
5993 * A driver supporting vendor commands must register them as an array
5994 * in struct wiphy, with handlers for each one, each command has an
5995 * OUI and sub command ID to identify it.
5997 * Note that this feature should not be (ab)used to implement protocol
5998 * features that could openly be shared across drivers. In particular,
5999 * it must never be required to use vendor commands to implement any
6000 * "normal" functionality that higher-level userspace like connection
6001 * managers etc. need.
6004 struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6005 enum nl80211_commands cmd,
6006 enum nl80211_attrs attr,
6009 struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
6010 struct wireless_dev *wdev,
6011 enum nl80211_commands cmd,
6012 enum nl80211_attrs attr,
6013 unsigned int portid,
6014 int vendor_event_idx,
6015 int approxlen, gfp_t gfp);
6017 void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6020 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6022 * @approxlen: an upper bound of the length of the data that will
6023 * be put into the skb
6025 * This function allocates and pre-fills an skb for a reply to
6026 * a vendor command. Since it is intended for a reply, calling
6027 * it outside of a vendor command's doit() operation is invalid.
6029 * The returned skb is pre-filled with some identifying data in
6030 * a way that any data that is put into the skb (with skb_put(),
6031 * nla_put() or similar) will end up being within the
6032 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6033 * with the skb is adding data for the corresponding userspace tool
6034 * which can then read that data out of the vendor data attribute.
6035 * You must not modify the skb in any other way.
6037 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6038 * its error code as the result of the doit() operation.
6040 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6042 static inline struct sk_buff *
6043 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6045 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6046 NL80211_ATTR_VENDOR_DATA, approxlen);
6050 * cfg80211_vendor_cmd_reply - send the reply skb
6051 * @skb: The skb, must have been allocated with
6052 * cfg80211_vendor_cmd_alloc_reply_skb()
6054 * Since calling this function will usually be the last thing
6055 * before returning from the vendor command doit() you should
6056 * return the error code. Note that this function consumes the
6057 * skb regardless of the return value.
6059 * Return: An error code or 0 on success.
6061 int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6064 * cfg80211_vendor_cmd_get_sender
6067 * Return the current netlink port ID in a vendor command handler.
6068 * Valid to call only there.
6070 unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
6073 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6075 * @wdev: the wireless device
6076 * @event_idx: index of the vendor event in the wiphy's vendor_events
6077 * @approxlen: an upper bound of the length of the data that will
6078 * be put into the skb
6079 * @gfp: allocation flags
6081 * This function allocates and pre-fills an skb for an event on the
6082 * vendor-specific multicast group.
6084 * If wdev != NULL, both the ifindex and identifier of the specified
6085 * wireless device are added to the event message before the vendor data
6088 * When done filling the skb, call cfg80211_vendor_event() with the
6089 * skb to send the event.
6091 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6093 static inline struct sk_buff *
6094 cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
6095 int approxlen, int event_idx, gfp_t gfp)
6097 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6098 NL80211_ATTR_VENDOR_DATA,
6099 0, event_idx, approxlen, gfp);
6103 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
6105 * @wdev: the wireless device
6106 * @event_idx: index of the vendor event in the wiphy's vendor_events
6107 * @portid: port ID of the receiver
6108 * @approxlen: an upper bound of the length of the data that will
6109 * be put into the skb
6110 * @gfp: allocation flags
6112 * This function allocates and pre-fills an skb for an event to send to
6113 * a specific (userland) socket. This socket would previously have been
6114 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
6115 * care to register a netlink notifier to see when the socket closes.
6117 * If wdev != NULL, both the ifindex and identifier of the specified
6118 * wireless device are added to the event message before the vendor data
6121 * When done filling the skb, call cfg80211_vendor_event() with the
6122 * skb to send the event.
6124 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6126 static inline struct sk_buff *
6127 cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
6128 struct wireless_dev *wdev,
6129 unsigned int portid, int approxlen,
6130 int event_idx, gfp_t gfp)
6132 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6133 NL80211_ATTR_VENDOR_DATA,
6134 portid, event_idx, approxlen, gfp);
6138 * cfg80211_vendor_event - send the event
6139 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6140 * @gfp: allocation flags
6142 * This function sends the given @skb, which must have been allocated
6143 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6145 static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6147 __cfg80211_send_event_skb(skb, gfp);
6150 #ifdef CONFIG_NL80211_TESTMODE
6154 * Test mode is a set of utility functions to allow drivers to
6155 * interact with driver-specific tools to aid, for instance,
6156 * factory programming.
6158 * This chapter describes how drivers interact with it, for more
6159 * information see the nl80211 book's chapter on it.
6163 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6165 * @approxlen: an upper bound of the length of the data that will
6166 * be put into the skb
6168 * This function allocates and pre-fills an skb for a reply to
6169 * the testmode command. Since it is intended for a reply, calling
6170 * it outside of the @testmode_cmd operation is invalid.
6172 * The returned skb is pre-filled with the wiphy index and set up in
6173 * a way that any data that is put into the skb (with skb_put(),
6174 * nla_put() or similar) will end up being within the
6175 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
6176 * with the skb is adding data for the corresponding userspace tool
6177 * which can then read that data out of the testdata attribute. You
6178 * must not modify the skb in any other way.
6180 * When done, call cfg80211_testmode_reply() with the skb and return
6181 * its error code as the result of the @testmode_cmd operation.
6183 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6185 static inline struct sk_buff *
6186 cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6188 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6189 NL80211_ATTR_TESTDATA, approxlen);
6193 * cfg80211_testmode_reply - send the reply skb
6194 * @skb: The skb, must have been allocated with
6195 * cfg80211_testmode_alloc_reply_skb()
6197 * Since calling this function will usually be the last thing
6198 * before returning from the @testmode_cmd you should return
6199 * the error code. Note that this function consumes the skb
6200 * regardless of the return value.
6202 * Return: An error code or 0 on success.
6204 static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6206 return cfg80211_vendor_cmd_reply(skb);
6210 * cfg80211_testmode_alloc_event_skb - allocate testmode event
6212 * @approxlen: an upper bound of the length of the data that will
6213 * be put into the skb
6214 * @gfp: allocation flags
6216 * This function allocates and pre-fills an skb for an event on the
6217 * testmode multicast group.
6219 * The returned skb is set up in the same way as with
6220 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
6221 * there, you should simply add data to it that will then end up in the
6222 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
6225 * When done filling the skb, call cfg80211_testmode_event() with the
6226 * skb to send the event.
6228 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6230 static inline struct sk_buff *
6231 cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6233 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
6234 NL80211_ATTR_TESTDATA, 0, -1,
6239 * cfg80211_testmode_event - send the event
6240 * @skb: The skb, must have been allocated with
6241 * cfg80211_testmode_alloc_event_skb()
6242 * @gfp: allocation flags
6244 * This function sends the given @skb, which must have been allocated
6245 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6248 static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6250 __cfg80211_send_event_skb(skb, gfp);
6253 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
6254 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
6256 #define CFG80211_TESTMODE_CMD(cmd)
6257 #define CFG80211_TESTMODE_DUMP(cmd)
6261 * struct cfg80211_fils_resp_params - FILS connection response params
6262 * @kek: KEK derived from a successful FILS connection (may be %NULL)
6263 * @kek_len: Length of @fils_kek in octets
6264 * @update_erp_next_seq_num: Boolean value to specify whether the value in
6265 * @erp_next_seq_num is valid.
6266 * @erp_next_seq_num: The next sequence number to use in ERP message in
6267 * FILS Authentication. This value should be specified irrespective of the
6268 * status for a FILS connection.
6269 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
6270 * @pmk_len: Length of @pmk in octets
6271 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
6272 * used for this FILS connection (may be %NULL).
6274 struct cfg80211_fils_resp_params {
6277 bool update_erp_next_seq_num;
6278 u16 erp_next_seq_num;
6285 * struct cfg80211_connect_resp_params - Connection response params
6286 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
6287 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6288 * the real status code for failures. If this call is used to report a
6289 * failure due to a timeout (e.g., not receiving an Authentication frame
6290 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6291 * indicate that this is a failure, but without a status code.
6292 * @timeout_reason is used to report the reason for the timeout in that
6294 * @bssid: The BSSID of the AP (may be %NULL)
6295 * @bss: Entry of bss to which STA got connected to, can be obtained through
6296 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6297 * bss from the connect_request and hold a reference to it and return
6298 * through this param to avoid a warning if the bss is expired during the
6299 * connection, esp. for those drivers implementing connect op.
6300 * Only one parameter among @bssid and @bss needs to be specified.
6301 * @req_ie: Association request IEs (may be %NULL)
6302 * @req_ie_len: Association request IEs length
6303 * @resp_ie: Association response IEs (may be %NULL)
6304 * @resp_ie_len: Association response IEs length
6305 * @fils: FILS connection response parameters.
6306 * @timeout_reason: Reason for connection timeout. This is used when the
6307 * connection fails due to a timeout instead of an explicit rejection from
6308 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6309 * not known. This value is used only if @status < 0 to indicate that the
6310 * failure is due to a timeout and not due to explicit rejection by the AP.
6311 * This value is ignored in other cases (@status >= 0).
6313 struct cfg80211_connect_resp_params {
6316 struct cfg80211_bss *bss;
6321 struct cfg80211_fils_resp_params fils;
6322 enum nl80211_timeout_reason timeout_reason;
6326 * cfg80211_connect_done - notify cfg80211 of connection result
6328 * @dev: network device
6329 * @params: connection response parameters
6330 * @gfp: allocation flags
6332 * It should be called by the underlying driver once execution of the connection
6333 * request from connect() has been completed. This is similar to
6334 * cfg80211_connect_bss(), but takes a structure pointer for connection response
6335 * parameters. Only one of the functions among cfg80211_connect_bss(),
6336 * cfg80211_connect_result(), cfg80211_connect_timeout(),
6337 * and cfg80211_connect_done() should be called.
6339 void cfg80211_connect_done(struct net_device *dev,
6340 struct cfg80211_connect_resp_params *params,
6344 * cfg80211_connect_bss - notify cfg80211 of connection result
6346 * @dev: network device
6347 * @bssid: the BSSID of the AP
6348 * @bss: Entry of bss to which STA got connected to, can be obtained through
6349 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6350 * bss from the connect_request and hold a reference to it and return
6351 * through this param to avoid a warning if the bss is expired during the
6352 * connection, esp. for those drivers implementing connect op.
6353 * Only one parameter among @bssid and @bss needs to be specified.
6354 * @req_ie: association request IEs (maybe be %NULL)
6355 * @req_ie_len: association request IEs length
6356 * @resp_ie: association response IEs (may be %NULL)
6357 * @resp_ie_len: assoc response IEs length
6358 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6359 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6360 * the real status code for failures. If this call is used to report a
6361 * failure due to a timeout (e.g., not receiving an Authentication frame
6362 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6363 * indicate that this is a failure, but without a status code.
6364 * @timeout_reason is used to report the reason for the timeout in that
6366 * @gfp: allocation flags
6367 * @timeout_reason: reason for connection timeout. This is used when the
6368 * connection fails due to a timeout instead of an explicit rejection from
6369 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6370 * not known. This value is used only if @status < 0 to indicate that the
6371 * failure is due to a timeout and not due to explicit rejection by the AP.
6372 * This value is ignored in other cases (@status >= 0).
6374 * It should be called by the underlying driver once execution of the connection
6375 * request from connect() has been completed. This is similar to
6376 * cfg80211_connect_result(), but with the option of identifying the exact bss
6377 * entry for the connection. Only one of the functions among
6378 * cfg80211_connect_bss(), cfg80211_connect_result(),
6379 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6382 cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6383 struct cfg80211_bss *bss, const u8 *req_ie,
6384 size_t req_ie_len, const u8 *resp_ie,
6385 size_t resp_ie_len, int status, gfp_t gfp,
6386 enum nl80211_timeout_reason timeout_reason)
6388 struct cfg80211_connect_resp_params params;
6390 memset(¶ms, 0, sizeof(params));
6391 params.status = status;
6392 params.bssid = bssid;
6394 params.req_ie = req_ie;
6395 params.req_ie_len = req_ie_len;
6396 params.resp_ie = resp_ie;
6397 params.resp_ie_len = resp_ie_len;
6398 params.timeout_reason = timeout_reason;
6400 cfg80211_connect_done(dev, ¶ms, gfp);
6404 * cfg80211_connect_result - notify cfg80211 of connection result
6406 * @dev: network device
6407 * @bssid: the BSSID of the AP
6408 * @req_ie: association request IEs (maybe be %NULL)
6409 * @req_ie_len: association request IEs length
6410 * @resp_ie: association response IEs (may be %NULL)
6411 * @resp_ie_len: assoc response IEs length
6412 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6413 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6414 * the real status code for failures.
6415 * @gfp: allocation flags
6417 * It should be called by the underlying driver once execution of the connection
6418 * request from connect() has been completed. This is similar to
6419 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
6420 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
6421 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6424 cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
6425 const u8 *req_ie, size_t req_ie_len,
6426 const u8 *resp_ie, size_t resp_ie_len,
6427 u16 status, gfp_t gfp)
6429 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
6430 resp_ie_len, status, gfp,
6431 NL80211_TIMEOUT_UNSPECIFIED);
6435 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6437 * @dev: network device
6438 * @bssid: the BSSID of the AP
6439 * @req_ie: association request IEs (maybe be %NULL)
6440 * @req_ie_len: association request IEs length
6441 * @gfp: allocation flags
6442 * @timeout_reason: reason for connection timeout.
6444 * It should be called by the underlying driver whenever connect() has failed
6445 * in a sequence where no explicit authentication/association rejection was
6446 * received from the AP. This could happen, e.g., due to not being able to send
6447 * out the Authentication or Association Request frame or timing out while
6448 * waiting for the response. Only one of the functions among
6449 * cfg80211_connect_bss(), cfg80211_connect_result(),
6450 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6453 cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
6454 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
6455 enum nl80211_timeout_reason timeout_reason)
6457 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
6458 gfp, timeout_reason);
6462 * struct cfg80211_roam_info - driver initiated roaming information
6464 * @channel: the channel of the new AP
6465 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
6466 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
6467 * @req_ie: association request IEs (maybe be %NULL)
6468 * @req_ie_len: association request IEs length
6469 * @resp_ie: association response IEs (may be %NULL)
6470 * @resp_ie_len: assoc response IEs length
6471 * @fils: FILS related roaming information.
6473 struct cfg80211_roam_info {
6474 struct ieee80211_channel *channel;
6475 struct cfg80211_bss *bss;
6481 struct cfg80211_fils_resp_params fils;
6485 * cfg80211_roamed - notify cfg80211 of roaming
6487 * @dev: network device
6488 * @info: information about the new BSS. struct &cfg80211_roam_info.
6489 * @gfp: allocation flags
6491 * This function may be called with the driver passing either the BSSID of the
6492 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
6493 * It should be called by the underlying driver whenever it roamed from one AP
6494 * to another while connected. Drivers which have roaming implemented in
6495 * firmware should pass the bss entry to avoid a race in bss entry timeout where
6496 * the bss entry of the new AP is seen in the driver, but gets timed out by the
6497 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
6498 * rdev->event_work. In case of any failures, the reference is released
6499 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
6500 * released while diconneting from the current bss.
6502 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
6506 * cfg80211_port_authorized - notify cfg80211 of successful security association
6508 * @dev: network device
6509 * @bssid: the BSSID of the AP
6510 * @gfp: allocation flags
6512 * This function should be called by a driver that supports 4 way handshake
6513 * offload after a security association was successfully established (i.e.,
6514 * the 4 way handshake was completed successfully). The call to this function
6515 * should be preceded with a call to cfg80211_connect_result(),
6516 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
6517 * indicate the 802.11 association.
6519 void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
6523 * cfg80211_disconnected - notify cfg80211 that connection was dropped
6525 * @dev: network device
6526 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
6527 * @ie_len: length of IEs
6528 * @reason: reason code for the disconnection, set it to 0 if unknown
6529 * @locally_generated: disconnection was requested locally
6530 * @gfp: allocation flags
6532 * After it calls this function, the driver should enter an idle state
6533 * and not try to connect to any AP any more.
6535 void cfg80211_disconnected(struct net_device *dev, u16 reason,
6536 const u8 *ie, size_t ie_len,
6537 bool locally_generated, gfp_t gfp);
6540 * cfg80211_ready_on_channel - notification of remain_on_channel start
6541 * @wdev: wireless device
6542 * @cookie: the request cookie
6543 * @chan: The current channel (from remain_on_channel request)
6544 * @duration: Duration in milliseconds that the driver intents to remain on the
6546 * @gfp: allocation flags
6548 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
6549 struct ieee80211_channel *chan,
6550 unsigned int duration, gfp_t gfp);
6553 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
6554 * @wdev: wireless device
6555 * @cookie: the request cookie
6556 * @chan: The current channel (from remain_on_channel request)
6557 * @gfp: allocation flags
6559 void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
6560 struct ieee80211_channel *chan,
6564 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
6565 * @wdev: wireless device
6566 * @cookie: the requested cookie
6567 * @chan: The current channel (from tx_mgmt request)
6568 * @gfp: allocation flags
6570 void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
6571 struct ieee80211_channel *chan, gfp_t gfp);
6574 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
6576 * @sinfo: the station information
6577 * @gfp: allocation flags
6579 int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
6582 * cfg80211_sinfo_release_content - release contents of station info
6583 * @sinfo: the station information
6585 * Releases any potentially allocated sub-information of the station
6586 * information, but not the struct itself (since it's typically on
6589 static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
6591 kfree(sinfo->pertid);
6595 * cfg80211_new_sta - notify userspace about station
6598 * @mac_addr: the station's address
6599 * @sinfo: the station information
6600 * @gfp: allocation flags
6602 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
6603 struct station_info *sinfo, gfp_t gfp);
6606 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
6608 * @mac_addr: the station's address
6609 * @sinfo: the station information/statistics
6610 * @gfp: allocation flags
6612 void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
6613 struct station_info *sinfo, gfp_t gfp);
6616 * cfg80211_del_sta - notify userspace about deletion of a station
6619 * @mac_addr: the station's address
6620 * @gfp: allocation flags
6622 static inline void cfg80211_del_sta(struct net_device *dev,
6623 const u8 *mac_addr, gfp_t gfp)
6625 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
6629 * cfg80211_conn_failed - connection request failed notification
6632 * @mac_addr: the station's address
6633 * @reason: the reason for connection failure
6634 * @gfp: allocation flags
6636 * Whenever a station tries to connect to an AP and if the station
6637 * could not connect to the AP as the AP has rejected the connection
6638 * for some reasons, this function is called.
6640 * The reason for connection failure can be any of the value from
6641 * nl80211_connect_failed_reason enum
6643 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
6644 enum nl80211_connect_failed_reason reason,
6648 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
6649 * @wdev: wireless device receiving the frame
6650 * @freq: Frequency on which the frame was received in MHz
6651 * @sig_dbm: signal strength in dBm, or 0 if unknown
6652 * @buf: Management frame (header + body)
6653 * @len: length of the frame data
6654 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
6656 * This function is called whenever an Action frame is received for a station
6657 * mode interface, but is not processed in kernel.
6659 * Return: %true if a user space application has registered for this frame.
6660 * For action frames, that makes it responsible for rejecting unrecognized
6661 * action frames; %false otherwise, in which case for action frames the
6662 * driver is responsible for rejecting the frame.
6664 bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
6665 const u8 *buf, size_t len, u32 flags);
6668 * cfg80211_mgmt_tx_status - notification of TX status for management frame
6669 * @wdev: wireless device receiving the frame
6670 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
6671 * @buf: Management frame (header + body)
6672 * @len: length of the frame data
6673 * @ack: Whether frame was acknowledged
6674 * @gfp: context flags
6676 * This function is called whenever a management frame was requested to be
6677 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
6678 * transmission attempt.
6680 void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
6681 const u8 *buf, size_t len, bool ack, gfp_t gfp);
6685 * cfg80211_rx_control_port - notification about a received control port frame
6686 * @dev: The device the frame matched to
6687 * @skb: The skbuf with the control port frame. It is assumed that the skbuf
6688 * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
6689 * This function does not take ownership of the skb, so the caller is
6690 * responsible for any cleanup. The caller must also ensure that
6691 * skb->protocol is set appropriately.
6692 * @unencrypted: Whether the frame was received unencrypted
6694 * This function is used to inform userspace about a received control port
6695 * frame. It should only be used if userspace indicated it wants to receive
6696 * control port frames over nl80211.
6698 * The frame is the data portion of the 802.3 or 802.11 data frame with all
6699 * network layer headers removed (e.g. the raw EAPoL frame).
6701 * Return: %true if the frame was passed to userspace
6703 bool cfg80211_rx_control_port(struct net_device *dev,
6704 struct sk_buff *skb, bool unencrypted);
6707 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
6708 * @dev: network device
6709 * @rssi_event: the triggered RSSI event
6710 * @rssi_level: new RSSI level value or 0 if not available
6711 * @gfp: context flags
6713 * This function is called when a configured connection quality monitoring
6714 * rssi threshold reached event occurs.
6716 void cfg80211_cqm_rssi_notify(struct net_device *dev,
6717 enum nl80211_cqm_rssi_threshold_event rssi_event,
6718 s32 rssi_level, gfp_t gfp);
6721 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
6722 * @dev: network device
6723 * @peer: peer's MAC address
6724 * @num_packets: how many packets were lost -- should be a fixed threshold
6725 * but probably no less than maybe 50, or maybe a throughput dependent
6726 * threshold (to account for temporary interference)
6727 * @gfp: context flags
6729 void cfg80211_cqm_pktloss_notify(struct net_device *dev,
6730 const u8 *peer, u32 num_packets, gfp_t gfp);
6733 * cfg80211_cqm_txe_notify - TX error rate event
6734 * @dev: network device
6735 * @peer: peer's MAC address
6736 * @num_packets: how many packets were lost
6737 * @rate: % of packets which failed transmission
6738 * @intvl: interval (in s) over which the TX failure threshold was breached.
6739 * @gfp: context flags
6741 * Notify userspace when configured % TX failures over number of packets in a
6742 * given interval is exceeded.
6744 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
6745 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
6748 * cfg80211_cqm_beacon_loss_notify - beacon loss event
6749 * @dev: network device
6750 * @gfp: context flags
6752 * Notify userspace about beacon loss from the connected AP.
6754 void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
6757 * cfg80211_radar_event - radar detection event
6759 * @chandef: chandef for the current channel
6760 * @gfp: context flags
6762 * This function is called when a radar is detected on the current chanenl.
6764 void cfg80211_radar_event(struct wiphy *wiphy,
6765 struct cfg80211_chan_def *chandef, gfp_t gfp);
6768 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
6769 * @dev: network device
6770 * @mac: MAC address of a station which opmode got modified
6771 * @sta_opmode: station's current opmode value
6772 * @gfp: context flags
6774 * Driver should call this function when station's opmode modified via action
6777 void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
6778 struct sta_opmode_info *sta_opmode,
6782 * cfg80211_cac_event - Channel availability check (CAC) event
6783 * @netdev: network device
6784 * @chandef: chandef for the current channel
6785 * @event: type of event
6786 * @gfp: context flags
6788 * This function is called when a Channel availability check (CAC) is finished
6789 * or aborted. This must be called to notify the completion of a CAC process,
6790 * also by full-MAC drivers.
6792 void cfg80211_cac_event(struct net_device *netdev,
6793 const struct cfg80211_chan_def *chandef,
6794 enum nl80211_radar_event event, gfp_t gfp);
6798 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
6799 * @dev: network device
6800 * @bssid: BSSID of AP (to avoid races)
6801 * @replay_ctr: new replay counter
6802 * @gfp: allocation flags
6804 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
6805 const u8 *replay_ctr, gfp_t gfp);
6808 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
6809 * @dev: network device
6810 * @index: candidate index (the smaller the index, the higher the priority)
6811 * @bssid: BSSID of AP
6812 * @preauth: Whether AP advertises support for RSN pre-authentication
6813 * @gfp: allocation flags
6815 void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
6816 const u8 *bssid, bool preauth, gfp_t gfp);
6819 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
6820 * @dev: The device the frame matched to
6821 * @addr: the transmitter address
6822 * @gfp: context flags
6824 * This function is used in AP mode (only!) to inform userspace that
6825 * a spurious class 3 frame was received, to be able to deauth the
6827 * Return: %true if the frame was passed to userspace (or this failed
6828 * for a reason other than not having a subscription.)
6830 bool cfg80211_rx_spurious_frame(struct net_device *dev,
6831 const u8 *addr, gfp_t gfp);
6834 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
6835 * @dev: The device the frame matched to
6836 * @addr: the transmitter address
6837 * @gfp: context flags
6839 * This function is used in AP mode (only!) to inform userspace that
6840 * an associated station sent a 4addr frame but that wasn't expected.
6841 * It is allowed and desirable to send this event only once for each
6842 * station to avoid event flooding.
6843 * Return: %true if the frame was passed to userspace (or this failed
6844 * for a reason other than not having a subscription.)
6846 bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
6847 const u8 *addr, gfp_t gfp);
6850 * cfg80211_probe_status - notify userspace about probe status
6851 * @dev: the device the probe was sent on
6852 * @addr: the address of the peer
6853 * @cookie: the cookie filled in @probe_client previously
6854 * @acked: indicates whether probe was acked or not
6855 * @ack_signal: signal strength (in dBm) of the ACK frame.
6856 * @is_valid_ack_signal: indicates the ack_signal is valid or not.
6857 * @gfp: allocation flags
6859 void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
6860 u64 cookie, bool acked, s32 ack_signal,
6861 bool is_valid_ack_signal, gfp_t gfp);
6864 * cfg80211_report_obss_beacon - report beacon from other APs
6865 * @wiphy: The wiphy that received the beacon
6867 * @len: length of the frame
6868 * @freq: frequency the frame was received on
6869 * @sig_dbm: signal strength in dBm, or 0 if unknown
6871 * Use this function to report to userspace when a beacon was
6872 * received. It is not useful to call this when there is no
6873 * netdev that is in AP/GO mode.
6875 void cfg80211_report_obss_beacon(struct wiphy *wiphy,
6876 const u8 *frame, size_t len,
6877 int freq, int sig_dbm);
6880 * cfg80211_reg_can_beacon - check if beaconing is allowed
6882 * @chandef: the channel definition
6883 * @iftype: interface type
6885 * Return: %true if there is no secondary channel or the secondary channel(s)
6886 * can be used for beaconing (i.e. is not a radar channel etc.)
6888 bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
6889 struct cfg80211_chan_def *chandef,
6890 enum nl80211_iftype iftype);
6893 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
6895 * @chandef: the channel definition
6896 * @iftype: interface type
6898 * Return: %true if there is no secondary channel or the secondary channel(s)
6899 * can be used for beaconing (i.e. is not a radar channel etc.). This version
6900 * also checks if IR-relaxation conditions apply, to allow beaconing under
6901 * more permissive conditions.
6903 * Requires the RTNL to be held.
6905 bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
6906 struct cfg80211_chan_def *chandef,
6907 enum nl80211_iftype iftype);
6910 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
6911 * @dev: the device which switched channels
6912 * @chandef: the new channel definition
6914 * Caller must acquire wdev_lock, therefore must only be called from sleepable
6917 void cfg80211_ch_switch_notify(struct net_device *dev,
6918 struct cfg80211_chan_def *chandef);
6921 * cfg80211_ch_switch_started_notify - notify channel switch start
6922 * @dev: the device on which the channel switch started
6923 * @chandef: the future channel definition
6924 * @count: the number of TBTTs until the channel switch happens
6926 * Inform the userspace about the channel switch that has just
6927 * started, so that it can take appropriate actions (eg. starting
6928 * channel switch on other vifs), if necessary.
6930 void cfg80211_ch_switch_started_notify(struct net_device *dev,
6931 struct cfg80211_chan_def *chandef,
6935 * ieee80211_operating_class_to_band - convert operating class to band
6937 * @operating_class: the operating class to convert
6938 * @band: band pointer to fill
6940 * Returns %true if the conversion was successful, %false otherwise.
6942 bool ieee80211_operating_class_to_band(u8 operating_class,
6943 enum nl80211_band *band);
6946 * ieee80211_chandef_to_operating_class - convert chandef to operation class
6948 * @chandef: the chandef to convert
6949 * @op_class: a pointer to the resulting operating class
6951 * Returns %true if the conversion was successful, %false otherwise.
6953 bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
6957 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
6958 * @dev: the device on which the operation is requested
6959 * @peer: the MAC address of the peer device
6960 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
6961 * NL80211_TDLS_TEARDOWN)
6962 * @reason_code: the reason code for teardown request
6963 * @gfp: allocation flags
6965 * This function is used to request userspace to perform TDLS operation that
6966 * requires knowledge of keys, i.e., link setup or teardown when the AP
6967 * connection uses encryption. This is optional mechanism for the driver to use
6968 * if it can automatically determine when a TDLS link could be useful (e.g.,
6969 * based on traffic and signal strength for a peer).
6971 void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
6972 enum nl80211_tdls_operation oper,
6973 u16 reason_code, gfp_t gfp);
6976 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
6977 * @rate: given rate_info to calculate bitrate from
6979 * return 0 if MCS index >= 32
6981 u32 cfg80211_calculate_bitrate(struct rate_info *rate);
6984 * cfg80211_unregister_wdev - remove the given wdev
6985 * @wdev: struct wireless_dev to remove
6987 * Call this function only for wdevs that have no netdev assigned,
6988 * e.g. P2P Devices. It removes the device from the list so that
6989 * it can no longer be used. It is necessary to call this function
6990 * even when cfg80211 requests the removal of the interface by
6991 * calling the del_virtual_intf() callback. The function must also
6992 * be called when the driver wishes to unregister the wdev, e.g.
6993 * when the device is unbound from the driver.
6995 * Requires the RTNL to be held.
6997 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
7000 * struct cfg80211_ft_event - FT Information Elements
7002 * @ies_len: length of the FT IE in bytes
7003 * @target_ap: target AP's MAC address
7005 * @ric_ies_len: length of the RIC IE in bytes
7007 struct cfg80211_ft_event_params {
7010 const u8 *target_ap;
7016 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7017 * @netdev: network device
7018 * @ft_event: IE information
7020 void cfg80211_ft_event(struct net_device *netdev,
7021 struct cfg80211_ft_event_params *ft_event);
7024 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
7025 * @ies: the input IE buffer
7026 * @len: the input length
7027 * @attr: the attribute ID to find
7028 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
7029 * if the function is only called to get the needed buffer size
7030 * @bufsize: size of the output buffer
7032 * The function finds a given P2P attribute in the (vendor) IEs and
7033 * copies its contents to the given buffer.
7035 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
7036 * malformed or the attribute can't be found (respectively), or the
7037 * length of the found attribute (which can be zero).
7039 int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7040 enum ieee80211_p2p_attr_id attr,
7041 u8 *buf, unsigned int bufsize);
7044 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
7045 * @ies: the IE buffer
7046 * @ielen: the length of the IE buffer
7047 * @ids: an array with element IDs that are allowed before
7048 * the split. A WLAN_EID_EXTENSION value means that the next
7049 * EID in the list is a sub-element of the EXTENSION IE.
7050 * @n_ids: the size of the element ID array
7051 * @after_ric: array IE types that come after the RIC element
7052 * @n_after_ric: size of the @after_ric array
7053 * @offset: offset where to start splitting in the buffer
7055 * This function splits an IE buffer by updating the @offset
7056 * variable to point to the location where the buffer should be
7059 * It assumes that the given IE buffer is well-formed, this
7060 * has to be guaranteed by the caller!
7062 * It also assumes that the IEs in the buffer are ordered
7063 * correctly, if not the result of using this function will not
7064 * be ordered correctly either, i.e. it does no reordering.
7066 * The function returns the offset where the next part of the
7067 * buffer starts, which may be @ielen if the entire (remainder)
7068 * of the buffer should be used.
7070 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
7071 const u8 *ids, int n_ids,
7072 const u8 *after_ric, int n_after_ric,
7076 * ieee80211_ie_split - split an IE buffer according to ordering
7077 * @ies: the IE buffer
7078 * @ielen: the length of the IE buffer
7079 * @ids: an array with element IDs that are allowed before
7080 * the split. A WLAN_EID_EXTENSION value means that the next
7081 * EID in the list is a sub-element of the EXTENSION IE.
7082 * @n_ids: the size of the element ID array
7083 * @offset: offset where to start splitting in the buffer
7085 * This function splits an IE buffer by updating the @offset
7086 * variable to point to the location where the buffer should be
7089 * It assumes that the given IE buffer is well-formed, this
7090 * has to be guaranteed by the caller!
7092 * It also assumes that the IEs in the buffer are ordered
7093 * correctly, if not the result of using this function will not
7094 * be ordered correctly either, i.e. it does no reordering.
7096 * The function returns the offset where the next part of the
7097 * buffer starts, which may be @ielen if the entire (remainder)
7098 * of the buffer should be used.
7100 static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
7101 const u8 *ids, int n_ids, size_t offset)
7103 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
7107 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7108 * @wdev: the wireless device reporting the wakeup
7109 * @wakeup: the wakeup report
7110 * @gfp: allocation flags
7112 * This function reports that the given device woke up. If it
7113 * caused the wakeup, report the reason(s), otherwise you may
7114 * pass %NULL as the @wakeup parameter to advertise that something
7115 * else caused the wakeup.
7117 void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7118 struct cfg80211_wowlan_wakeup *wakeup,
7122 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
7124 * @wdev: the wireless device for which critical protocol is stopped.
7125 * @gfp: allocation flags
7127 * This function can be called by the driver to indicate it has reverted
7128 * operation back to normal. One reason could be that the duration given
7129 * by .crit_proto_start() has expired.
7131 void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
7134 * ieee80211_get_num_supported_channels - get number of channels device has
7137 * Return: the number of channels supported by the device.
7139 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7142 * cfg80211_check_combinations - check interface combinations
7145 * @params: the interface combinations parameter
7147 * This function can be called by the driver to check whether a
7148 * combination of interfaces and their types are allowed according to
7149 * the interface combinations.
7151 int cfg80211_check_combinations(struct wiphy *wiphy,
7152 struct iface_combination_params *params);
7155 * cfg80211_iter_combinations - iterate over matching combinations
7158 * @params: the interface combinations parameter
7159 * @iter: function to call for each matching combination
7160 * @data: pointer to pass to iter function
7162 * This function can be called by the driver to check what possible
7163 * combinations it fits in at a given moment, e.g. for channel switching
7166 int cfg80211_iter_combinations(struct wiphy *wiphy,
7167 struct iface_combination_params *params,
7168 void (*iter)(const struct ieee80211_iface_combination *c,
7173 * cfg80211_stop_iface - trigger interface disconnection
7176 * @wdev: wireless device
7177 * @gfp: context flags
7179 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7182 * Note: This doesn't need any locks and is asynchronous.
7184 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7188 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7189 * @wiphy: the wiphy to shut down
7191 * This function shuts down all interfaces belonging to this wiphy by
7192 * calling dev_close() (and treating non-netdev interfaces as needed).
7193 * It shouldn't really be used unless there are some fatal device errors
7194 * that really can't be recovered in any other way.
7196 * Callers must hold the RTNL and be able to deal with callbacks into
7197 * the driver while the function is running.
7199 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7202 * wiphy_ext_feature_set - set the extended feature flag
7204 * @wiphy: the wiphy to modify.
7205 * @ftidx: extended feature bit index.
7207 * The extended features are flagged in multiple bytes (see
7208 * &struct wiphy.@ext_features)
7210 static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7211 enum nl80211_ext_feature_index ftidx)
7215 ft_byte = &wiphy->ext_features[ftidx / 8];
7216 *ft_byte |= BIT(ftidx % 8);
7220 * wiphy_ext_feature_isset - check the extended feature flag
7222 * @wiphy: the wiphy to modify.
7223 * @ftidx: extended feature bit index.
7225 * The extended features are flagged in multiple bytes (see
7226 * &struct wiphy.@ext_features)
7229 wiphy_ext_feature_isset(struct wiphy *wiphy,
7230 enum nl80211_ext_feature_index ftidx)
7234 ft_byte = wiphy->ext_features[ftidx / 8];
7235 return (ft_byte & BIT(ftidx % 8)) != 0;
7239 * cfg80211_free_nan_func - free NAN function
7240 * @f: NAN function that should be freed
7242 * Frees all the NAN function and all it's allocated members.
7244 void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7247 * struct cfg80211_nan_match_params - NAN match parameters
7248 * @type: the type of the function that triggered a match. If it is
7249 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
7250 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
7252 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
7253 * @inst_id: the local instance id
7254 * @peer_inst_id: the instance id of the peer's function
7255 * @addr: the MAC address of the peer
7256 * @info_len: the length of the &info
7257 * @info: the Service Specific Info from the peer (if any)
7258 * @cookie: unique identifier of the corresponding function
7260 struct cfg80211_nan_match_params {
7261 enum nl80211_nan_function_type type;
7271 * cfg80211_nan_match - report a match for a NAN function.
7272 * @wdev: the wireless device reporting the match
7273 * @match: match notification parameters
7274 * @gfp: allocation flags
7276 * This function reports that the a NAN function had a match. This
7277 * can be a subscribe that had a match or a solicited publish that
7278 * was sent. It can also be a follow up that was received.
7280 void cfg80211_nan_match(struct wireless_dev *wdev,
7281 struct cfg80211_nan_match_params *match, gfp_t gfp);
7284 * cfg80211_nan_func_terminated - notify about NAN function termination.
7286 * @wdev: the wireless device reporting the match
7287 * @inst_id: the local instance id
7288 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7289 * @cookie: unique NAN function identifier
7290 * @gfp: allocation flags
7292 * This function reports that the a NAN function is terminated.
7294 void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7296 enum nl80211_nan_func_term_reason reason,
7297 u64 cookie, gfp_t gfp);
7299 /* ethtool helper */
7300 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7303 * cfg80211_external_auth_request - userspace request for authentication
7304 * @netdev: network device
7305 * @params: External authentication parameters
7306 * @gfp: allocation flags
7307 * Returns: 0 on success, < 0 on error
7309 int cfg80211_external_auth_request(struct net_device *netdev,
7310 struct cfg80211_external_auth_params *params,
7314 * cfg80211_pmsr_report - report peer measurement result data
7315 * @wdev: the wireless device reporting the measurement
7316 * @req: the original measurement request
7317 * @result: the result data
7318 * @gfp: allocation flags
7320 void cfg80211_pmsr_report(struct wireless_dev *wdev,
7321 struct cfg80211_pmsr_request *req,
7322 struct cfg80211_pmsr_result *result,
7326 * cfg80211_pmsr_complete - report peer measurement completed
7327 * @wdev: the wireless device reporting the measurement
7328 * @req: the original measurement request
7329 * @gfp: allocation flags
7331 * Report that the entire measurement completed, after this
7332 * the request pointer will no longer be valid.
7334 void cfg80211_pmsr_complete(struct wireless_dev *wdev,
7335 struct cfg80211_pmsr_request *req,
7339 * cfg80211_iftype_allowed - check whether the interface can be allowed
7341 * @iftype: interface type
7342 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
7343 * @check_swif: check iftype against software interfaces
7345 * Check whether the interface is allowed to operate; additionally, this API
7346 * can be used to check iftype against the software interfaces when
7347 * check_swif is '1'.
7349 bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
7350 bool is_4addr, u8 check_swif);
7353 /* Logging, debugging and troubleshooting/diagnostic helpers. */
7355 /* wiphy_printk helpers, similar to dev_printk */
7357 #define wiphy_printk(level, wiphy, format, args...) \
7358 dev_printk(level, &(wiphy)->dev, format, ##args)
7359 #define wiphy_emerg(wiphy, format, args...) \
7360 dev_emerg(&(wiphy)->dev, format, ##args)
7361 #define wiphy_alert(wiphy, format, args...) \
7362 dev_alert(&(wiphy)->dev, format, ##args)
7363 #define wiphy_crit(wiphy, format, args...) \
7364 dev_crit(&(wiphy)->dev, format, ##args)
7365 #define wiphy_err(wiphy, format, args...) \
7366 dev_err(&(wiphy)->dev, format, ##args)
7367 #define wiphy_warn(wiphy, format, args...) \
7368 dev_warn(&(wiphy)->dev, format, ##args)
7369 #define wiphy_notice(wiphy, format, args...) \
7370 dev_notice(&(wiphy)->dev, format, ##args)
7371 #define wiphy_info(wiphy, format, args...) \
7372 dev_info(&(wiphy)->dev, format, ##args)
7374 #define wiphy_err_ratelimited(wiphy, format, args...) \
7375 dev_err_ratelimited(&(wiphy)->dev, format, ##args)
7376 #define wiphy_warn_ratelimited(wiphy, format, args...) \
7377 dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
7379 #define wiphy_debug(wiphy, format, args...) \
7380 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
7382 #define wiphy_dbg(wiphy, format, args...) \
7383 dev_dbg(&(wiphy)->dev, format, ##args)
7385 #if defined(VERBOSE_DEBUG)
7386 #define wiphy_vdbg wiphy_dbg
7388 #define wiphy_vdbg(wiphy, format, args...) \
7391 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
7397 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
7398 * of using a WARN/WARN_ON to get the message out, including the
7399 * file/line information and a backtrace.
7401 #define wiphy_WARN(wiphy, format, args...) \
7402 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
7405 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
7406 * @netdev: network device
7407 * @owe_info: peer's owe info
7408 * @gfp: allocation flags
7410 void cfg80211_update_owe_info_event(struct net_device *netdev,
7411 struct cfg80211_update_owe_info *owe_info,
7414 #endif /* __NET_CFG80211_H */