1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef __NET_CFG80211_H
3 #define __NET_CFG80211_H
5 * 802.11 device and configuration interface
7 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
8 * Copyright 2013-2014 Intel Mobile Communications GmbH
9 * Copyright 2015-2017 Intel Deutschland GmbH
10 * Copyright (C) 2018-2020 Intel Corporation
13 #include <linux/netdevice.h>
14 #include <linux/debugfs.h>
15 #include <linux/list.h>
16 #include <linux/bug.h>
17 #include <linux/netlink.h>
18 #include <linux/skbuff.h>
19 #include <linux/nl80211.h>
20 #include <linux/if_ether.h>
21 #include <linux/ieee80211.h>
22 #include <linux/net.h>
23 #include <net/regulatory.h>
28 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
29 * userspace and drivers, and offers some utility functionality associated
30 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
31 * by all modern wireless drivers in Linux, so that they offer a consistent
32 * API through nl80211. For backward compatibility, cfg80211 also offers
33 * wireless extensions to userspace, but hides them from drivers completely.
35 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
41 * DOC: Device registration
43 * In order for a driver to use cfg80211, it must register the hardware device
44 * with cfg80211. This happens through a number of hardware capability structs
47 * The fundamental structure for each device is the 'wiphy', of which each
48 * instance describes a physical wireless device connected to the system. Each
49 * such wiphy can have zero, one, or many virtual interfaces associated with
50 * it, which need to be identified as such by pointing the network interface's
51 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
52 * the wireless part of the interface, normally this struct is embedded in the
53 * network interface's private data area. Drivers can optionally allow creating
54 * or destroying virtual interfaces on the fly, but without at least one or the
55 * ability to create some the wireless device isn't useful.
57 * Each wiphy structure contains device capability information, and also has
58 * a pointer to the various operations the driver offers. The definitions and
59 * structures here describe these capabilities in detail.
65 * wireless hardware capability structures
69 * enum ieee80211_channel_flags - channel flags
71 * Channel flags set by the regulatory control code.
73 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
74 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
75 * sending probe requests or beaconing.
76 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
77 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
79 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
81 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
82 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
83 * this flag indicates that an 80 MHz channel cannot use this
84 * channel as the control or any of the secondary channels.
85 * This may be due to the driver or due to regulatory bandwidth
87 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
88 * this flag indicates that an 160 MHz channel cannot use this
89 * channel as the control or any of the secondary channels.
90 * This may be due to the driver or due to regulatory bandwidth
92 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
93 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
94 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
96 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
98 * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
101 enum ieee80211_channel_flags {
102 IEEE80211_CHAN_DISABLED = 1<<0,
103 IEEE80211_CHAN_NO_IR = 1<<1,
105 IEEE80211_CHAN_RADAR = 1<<3,
106 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
107 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
108 IEEE80211_CHAN_NO_OFDM = 1<<6,
109 IEEE80211_CHAN_NO_80MHZ = 1<<7,
110 IEEE80211_CHAN_NO_160MHZ = 1<<8,
111 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
112 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
113 IEEE80211_CHAN_NO_20MHZ = 1<<11,
114 IEEE80211_CHAN_NO_10MHZ = 1<<12,
115 IEEE80211_CHAN_NO_HE = 1<<13,
118 #define IEEE80211_CHAN_NO_HT40 \
119 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
121 #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
122 #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
125 * struct ieee80211_channel - channel definition
127 * This structure describes a single channel for use
130 * @center_freq: center frequency in MHz
131 * @freq_offset: offset from @center_freq, in KHz
132 * @hw_value: hardware-specific value for the channel
133 * @flags: channel flags from &enum ieee80211_channel_flags.
134 * @orig_flags: channel flags at registration time, used by regulatory
135 * code to support devices with additional restrictions
136 * @band: band this channel belongs to.
137 * @max_antenna_gain: maximum antenna gain in dBi
138 * @max_power: maximum transmission power (in dBm)
139 * @max_reg_power: maximum regulatory transmission power (in dBm)
140 * @beacon_found: helper to regulatory code to indicate when a beacon
141 * has been found on this channel. Use regulatory_hint_found_beacon()
142 * to enable this, this is useful only on 5 GHz band.
143 * @orig_mag: internal use
144 * @orig_mpwr: internal use
145 * @dfs_state: current state of this channel. Only relevant if radar is required
147 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
148 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
150 struct ieee80211_channel {
151 enum nl80211_band band;
156 int max_antenna_gain;
161 int orig_mag, orig_mpwr;
162 enum nl80211_dfs_state dfs_state;
163 unsigned long dfs_state_entered;
164 unsigned int dfs_cac_ms;
168 * enum ieee80211_rate_flags - rate flags
170 * Hardware/specification flags for rates. These are structured
171 * in a way that allows using the same bitrate structure for
172 * different bands/PHY modes.
174 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
175 * preamble on this bitrate; only relevant in 2.4GHz band and
177 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
178 * when used with 802.11a (on the 5 GHz band); filled by the
179 * core code when registering the wiphy.
180 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
181 * when used with 802.11b (on the 2.4 GHz band); filled by the
182 * core code when registering the wiphy.
183 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
184 * when used with 802.11g (on the 2.4 GHz band); filled by the
185 * core code when registering the wiphy.
186 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
187 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
188 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
190 enum ieee80211_rate_flags {
191 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
192 IEEE80211_RATE_MANDATORY_A = 1<<1,
193 IEEE80211_RATE_MANDATORY_B = 1<<2,
194 IEEE80211_RATE_MANDATORY_G = 1<<3,
195 IEEE80211_RATE_ERP_G = 1<<4,
196 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
197 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
201 * enum ieee80211_bss_type - BSS type filter
203 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
204 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
205 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
206 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
207 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
209 enum ieee80211_bss_type {
210 IEEE80211_BSS_TYPE_ESS,
211 IEEE80211_BSS_TYPE_PBSS,
212 IEEE80211_BSS_TYPE_IBSS,
213 IEEE80211_BSS_TYPE_MBSS,
214 IEEE80211_BSS_TYPE_ANY
218 * enum ieee80211_privacy - BSS privacy filter
220 * @IEEE80211_PRIVACY_ON: privacy bit set
221 * @IEEE80211_PRIVACY_OFF: privacy bit clear
222 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
224 enum ieee80211_privacy {
225 IEEE80211_PRIVACY_ON,
226 IEEE80211_PRIVACY_OFF,
227 IEEE80211_PRIVACY_ANY
230 #define IEEE80211_PRIVACY(x) \
231 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
234 * struct ieee80211_rate - bitrate definition
236 * This structure describes a bitrate that an 802.11 PHY can
237 * operate with. The two values @hw_value and @hw_value_short
238 * are only for driver use when pointers to this structure are
241 * @flags: rate-specific flags
242 * @bitrate: bitrate in units of 100 Kbps
243 * @hw_value: driver/hardware value for this rate
244 * @hw_value_short: driver/hardware value for this rate when
245 * short preamble is used
247 struct ieee80211_rate {
250 u16 hw_value, hw_value_short;
254 * struct ieee80211_he_obss_pd - AP settings for spatial reuse
256 * @enable: is the feature enabled.
257 * @min_offset: minimal tx power offset an associated station shall use
258 * @max_offset: maximum tx power offset an associated station shall use
260 struct ieee80211_he_obss_pd {
267 * struct cfg80211_he_bss_color - AP settings for BSS coloring
269 * @color: the current color.
270 * @disabled: is the feature disabled.
271 * @partial: define the AID equation.
273 struct cfg80211_he_bss_color {
280 * struct ieee80211_he_bss_color - AP settings for BSS coloring
282 * @color: the current color.
283 * @disabled: is the feature disabled.
284 * @partial: define the AID equation.
286 struct ieee80211_he_bss_color {
293 * struct ieee80211_sta_ht_cap - STA's HT capabilities
295 * This structure describes most essential parameters needed
296 * to describe 802.11n HT capabilities for an STA.
298 * @ht_supported: is HT supported by the STA
299 * @cap: HT capabilities map as described in 802.11n spec
300 * @ampdu_factor: Maximum A-MPDU length factor
301 * @ampdu_density: Minimum A-MPDU spacing
302 * @mcs: Supported MCS rates
304 struct ieee80211_sta_ht_cap {
305 u16 cap; /* use IEEE80211_HT_CAP_ */
309 struct ieee80211_mcs_info mcs;
313 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
315 * This structure describes most essential parameters needed
316 * to describe 802.11ac VHT capabilities for an STA.
318 * @vht_supported: is VHT supported by the STA
319 * @cap: VHT capabilities map as described in 802.11ac spec
320 * @vht_mcs: Supported VHT MCS rates
322 struct ieee80211_sta_vht_cap {
324 u32 cap; /* use IEEE80211_VHT_CAP_ */
325 struct ieee80211_vht_mcs_info vht_mcs;
328 #define IEEE80211_HE_PPE_THRES_MAX_LEN 25
331 * struct ieee80211_sta_he_cap - STA's HE capabilities
333 * This structure describes most essential parameters needed
334 * to describe 802.11ax HE capabilities for a STA.
336 * @has_he: true iff HE data is valid.
337 * @he_cap_elem: Fixed portion of the HE capabilities element.
338 * @he_mcs_nss_supp: The supported NSS/MCS combinations.
339 * @ppe_thres: Holds the PPE Thresholds data.
341 struct ieee80211_sta_he_cap {
343 struct ieee80211_he_cap_elem he_cap_elem;
344 struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
345 u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
349 * struct ieee80211_sband_iftype_data
351 * This structure encapsulates sband data that is relevant for the
352 * interface types defined in @types_mask. Each type in the
353 * @types_mask must be unique across all instances of iftype_data.
355 * @types_mask: interface types mask
356 * @he_cap: holds the HE capabilities
358 struct ieee80211_sband_iftype_data {
360 struct ieee80211_sta_he_cap he_cap;
364 * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
366 * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
367 * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
368 * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
369 * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
370 * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
371 * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
372 * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
373 * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
375 * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
377 * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
379 * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
380 * and 4.32GHz + 4.32GHz
381 * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
382 * 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
384 enum ieee80211_edmg_bw_config {
385 IEEE80211_EDMG_BW_CONFIG_4 = 4,
386 IEEE80211_EDMG_BW_CONFIG_5 = 5,
387 IEEE80211_EDMG_BW_CONFIG_6 = 6,
388 IEEE80211_EDMG_BW_CONFIG_7 = 7,
389 IEEE80211_EDMG_BW_CONFIG_8 = 8,
390 IEEE80211_EDMG_BW_CONFIG_9 = 9,
391 IEEE80211_EDMG_BW_CONFIG_10 = 10,
392 IEEE80211_EDMG_BW_CONFIG_11 = 11,
393 IEEE80211_EDMG_BW_CONFIG_12 = 12,
394 IEEE80211_EDMG_BW_CONFIG_13 = 13,
395 IEEE80211_EDMG_BW_CONFIG_14 = 14,
396 IEEE80211_EDMG_BW_CONFIG_15 = 15,
400 * struct ieee80211_edmg - EDMG configuration
402 * This structure describes most essential parameters needed
403 * to describe 802.11ay EDMG configuration
405 * @channels: bitmap that indicates the 2.16 GHz channel(s)
406 * that are allowed to be used for transmissions.
407 * Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
408 * Set to 0 indicate EDMG not supported.
409 * @bw_config: Channel BW Configuration subfield encodes
410 * the allowed channel bandwidth configurations
412 struct ieee80211_edmg {
414 enum ieee80211_edmg_bw_config bw_config;
418 * struct ieee80211_supported_band - frequency band definition
420 * This structure describes a frequency band a wiphy
421 * is able to operate in.
423 * @channels: Array of channels the hardware can operate in
425 * @band: the band this structure represents
426 * @n_channels: Number of channels in @channels
427 * @bitrates: Array of bitrates the hardware can operate with
428 * in this band. Must be sorted to give a valid "supported
429 * rates" IE, i.e. CCK rates first, then OFDM.
430 * @n_bitrates: Number of bitrates in @bitrates
431 * @ht_cap: HT capabilities in this band
432 * @vht_cap: VHT capabilities in this band
433 * @edmg_cap: EDMG capabilities in this band
434 * @n_iftype_data: number of iftype data entries
435 * @iftype_data: interface type data entries. Note that the bits in
436 * @types_mask inside this structure cannot overlap (i.e. only
437 * one occurrence of each type is allowed across all instances of
440 struct ieee80211_supported_band {
441 struct ieee80211_channel *channels;
442 struct ieee80211_rate *bitrates;
443 enum nl80211_band band;
446 struct ieee80211_sta_ht_cap ht_cap;
447 struct ieee80211_sta_vht_cap vht_cap;
448 struct ieee80211_edmg edmg_cap;
450 const struct ieee80211_sband_iftype_data *iftype_data;
454 * ieee80211_get_sband_iftype_data - return sband data for a given iftype
455 * @sband: the sband to search for the STA on
456 * @iftype: enum nl80211_iftype
458 * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
460 static inline const struct ieee80211_sband_iftype_data *
461 ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
466 if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
469 for (i = 0; i < sband->n_iftype_data; i++) {
470 const struct ieee80211_sband_iftype_data *data =
471 &sband->iftype_data[i];
473 if (data->types_mask & BIT(iftype))
481 * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
482 * @sband: the sband to search for the iftype on
483 * @iftype: enum nl80211_iftype
485 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
487 static inline const struct ieee80211_sta_he_cap *
488 ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
491 const struct ieee80211_sband_iftype_data *data =
492 ieee80211_get_sband_iftype_data(sband, iftype);
494 if (data && data->he_cap.has_he)
495 return &data->he_cap;
501 * ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
502 * @sband: the sband to search for the STA on
504 * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
506 static inline const struct ieee80211_sta_he_cap *
507 ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
509 return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
513 * wiphy_read_of_freq_limits - read frequency limits from device tree
515 * @wiphy: the wireless device to get extra limits for
517 * Some devices may have extra limitations specified in DT. This may be useful
518 * for chipsets that normally support more bands but are limited due to board
519 * design (e.g. by antennas or external power amplifier).
521 * This function reads info from DT and uses it to *modify* channels (disable
522 * unavailable ones). It's usually a *bad* idea to use it in drivers with
523 * shared channel data as DT limitations are device specific. You should make
524 * sure to call it only if channels in wiphy are copied and can be modified
525 * without affecting other devices.
527 * As this function access device node it has to be called after set_wiphy_dev.
528 * It also modifies channels so they have to be set first.
529 * If using this helper, call it before wiphy_register().
532 void wiphy_read_of_freq_limits(struct wiphy *wiphy);
533 #else /* CONFIG_OF */
534 static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
537 #endif /* !CONFIG_OF */
541 * Wireless hardware/device configuration structures and methods
545 * DOC: Actions and configuration
547 * Each wireless device and each virtual interface offer a set of configuration
548 * operations and other actions that are invoked by userspace. Each of these
549 * actions is described in the operations structure, and the parameters these
550 * operations use are described separately.
552 * Additionally, some operations are asynchronous and expect to get status
553 * information via some functions that drivers need to call.
555 * Scanning and BSS list handling with its associated functionality is described
556 * in a separate chapter.
559 #define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
560 WLAN_USER_POSITION_LEN)
563 * struct vif_params - describes virtual interface parameters
564 * @flags: monitor interface flags, unchanged if 0, otherwise
565 * %MONITOR_FLAG_CHANGED will be set
566 * @use_4addr: use 4-address frames
567 * @macaddr: address to use for this virtual interface.
568 * If this parameter is set to zero address the driver may
569 * determine the address as needed.
570 * This feature is only fully supported by drivers that enable the
571 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
572 ** only p2p devices with specified MAC.
573 * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
574 * belonging to that MU-MIMO groupID; %NULL if not changed
575 * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
576 * MU-MIMO packets going to the specified station; %NULL if not changed
581 u8 macaddr[ETH_ALEN];
582 const u8 *vht_mumimo_groups;
583 const u8 *vht_mumimo_follow_addr;
587 * struct key_params - key information
589 * Information about a key
592 * @key_len: length of key material
593 * @cipher: cipher suite selector
594 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
595 * with the get_key() callback, must be in little endian,
596 * length given by @seq_len.
597 * @seq_len: length of @seq.
598 * @vlan_id: vlan_id for VLAN group key (if nonzero)
599 * @mode: key install mode (RX_TX, NO_TX or SET_TX)
608 enum nl80211_key_mode mode;
612 * struct cfg80211_chan_def - channel definition
613 * @chan: the (control) channel
614 * @width: channel width
615 * @center_freq1: center frequency of first segment
616 * @center_freq2: center frequency of second segment
617 * (only with 80+80 MHz)
618 * @edmg: define the EDMG channels configuration.
619 * If edmg is requested (i.e. the .channels member is non-zero),
620 * chan will define the primary channel and all other
621 * parameters are ignored.
622 * @freq1_offset: offset from @center_freq1, in KHz
624 struct cfg80211_chan_def {
625 struct ieee80211_channel *chan;
626 enum nl80211_chan_width width;
629 struct ieee80211_edmg edmg;
634 * cfg80211_bitrate_mask - masks for bitrate control
636 struct cfg80211_bitrate_mask {
639 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
640 u16 vht_mcs[NL80211_VHT_NSS_MAX];
641 enum nl80211_txrate_gi gi;
642 } control[NUM_NL80211_BANDS];
647 * struct cfg80211_tid_cfg - TID specific configuration
648 * @config_override: Flag to notify driver to reset TID configuration
650 * @tids: bitmap of TIDs to modify
651 * @mask: bitmap of attributes indicating which parameter changed,
652 * similar to &nl80211_tid_config_supp.
653 * @noack: noack configuration value for the TID
654 * @retry_long: retry count value
655 * @retry_short: retry count value
656 * @ampdu: Enable/Disable MPDU aggregation
657 * @rtscts: Enable/Disable RTS/CTS
658 * @amsdu: Enable/Disable MSDU aggregation
659 * @txrate_type: Tx bitrate mask type
660 * @txrate_mask: Tx bitrate to be applied for the TID
662 struct cfg80211_tid_cfg {
663 bool config_override;
666 enum nl80211_tid_config noack;
667 u8 retry_long, retry_short;
668 enum nl80211_tid_config ampdu;
669 enum nl80211_tid_config rtscts;
670 enum nl80211_tid_config amsdu;
671 enum nl80211_tx_rate_setting txrate_type;
672 struct cfg80211_bitrate_mask txrate_mask;
676 * struct cfg80211_tid_config - TID configuration
677 * @peer: Station's MAC address
678 * @n_tid_conf: Number of TID specific configurations to be applied
679 * @tid_conf: Configuration change info
681 struct cfg80211_tid_config {
684 struct cfg80211_tid_cfg tid_conf[];
688 * cfg80211_get_chandef_type - return old channel type from chandef
689 * @chandef: the channel definition
691 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
692 * chandef, which must have a bandwidth allowing this conversion.
694 static inline enum nl80211_channel_type
695 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
697 switch (chandef->width) {
698 case NL80211_CHAN_WIDTH_20_NOHT:
699 return NL80211_CHAN_NO_HT;
700 case NL80211_CHAN_WIDTH_20:
701 return NL80211_CHAN_HT20;
702 case NL80211_CHAN_WIDTH_40:
703 if (chandef->center_freq1 > chandef->chan->center_freq)
704 return NL80211_CHAN_HT40PLUS;
705 return NL80211_CHAN_HT40MINUS;
708 return NL80211_CHAN_NO_HT;
713 * cfg80211_chandef_create - create channel definition using channel type
714 * @chandef: the channel definition struct to fill
715 * @channel: the control channel
716 * @chantype: the channel type
718 * Given a channel type, create a channel definition.
720 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
721 struct ieee80211_channel *channel,
722 enum nl80211_channel_type chantype);
725 * cfg80211_chandef_identical - check if two channel definitions are identical
726 * @chandef1: first channel definition
727 * @chandef2: second channel definition
729 * Return: %true if the channels defined by the channel definitions are
730 * identical, %false otherwise.
733 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
734 const struct cfg80211_chan_def *chandef2)
736 return (chandef1->chan == chandef2->chan &&
737 chandef1->width == chandef2->width &&
738 chandef1->center_freq1 == chandef2->center_freq1 &&
739 chandef1->freq1_offset == chandef2->freq1_offset &&
740 chandef1->center_freq2 == chandef2->center_freq2);
744 * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
746 * @chandef: the channel definition
748 * Return: %true if EDMG defined, %false otherwise.
751 cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
753 return chandef->edmg.channels || chandef->edmg.bw_config;
757 * cfg80211_chandef_compatible - check if two channel definitions are compatible
758 * @chandef1: first channel definition
759 * @chandef2: second channel definition
761 * Return: %NULL if the given channel definitions are incompatible,
762 * chandef1 or chandef2 otherwise.
764 const struct cfg80211_chan_def *
765 cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
766 const struct cfg80211_chan_def *chandef2);
769 * cfg80211_chandef_valid - check if a channel definition is valid
770 * @chandef: the channel definition to check
771 * Return: %true if the channel definition is valid. %false otherwise.
773 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
776 * cfg80211_chandef_usable - check if secondary channels can be used
777 * @wiphy: the wiphy to validate against
778 * @chandef: the channel definition to check
779 * @prohibited_flags: the regulatory channel flags that must not be set
780 * Return: %true if secondary channels are usable. %false otherwise.
782 bool cfg80211_chandef_usable(struct wiphy *wiphy,
783 const struct cfg80211_chan_def *chandef,
784 u32 prohibited_flags);
787 * cfg80211_chandef_dfs_required - checks if radar detection is required
788 * @wiphy: the wiphy to validate against
789 * @chandef: the channel definition to check
790 * @iftype: the interface type as specified in &enum nl80211_iftype
792 * 1 if radar detection is required, 0 if it is not, < 0 on error
794 int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
795 const struct cfg80211_chan_def *chandef,
796 enum nl80211_iftype iftype);
799 * ieee80211_chandef_rate_flags - returns rate flags for a channel
801 * In some channel types, not all rates may be used - for example CCK
802 * rates may not be used in 5/10 MHz channels.
804 * @chandef: channel definition for the channel
806 * Returns: rate flags which apply for this channel
808 static inline enum ieee80211_rate_flags
809 ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
811 switch (chandef->width) {
812 case NL80211_CHAN_WIDTH_5:
813 return IEEE80211_RATE_SUPPORTS_5MHZ;
814 case NL80211_CHAN_WIDTH_10:
815 return IEEE80211_RATE_SUPPORTS_10MHZ;
823 * ieee80211_chandef_max_power - maximum transmission power for the chandef
825 * In some regulations, the transmit power may depend on the configured channel
826 * bandwidth which may be defined as dBm/MHz. This function returns the actual
827 * max_power for non-standard (20 MHz) channels.
829 * @chandef: channel definition for the channel
831 * Returns: maximum allowed transmission power in dBm for the chandef
834 ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
836 switch (chandef->width) {
837 case NL80211_CHAN_WIDTH_5:
838 return min(chandef->chan->max_reg_power - 6,
839 chandef->chan->max_power);
840 case NL80211_CHAN_WIDTH_10:
841 return min(chandef->chan->max_reg_power - 3,
842 chandef->chan->max_power);
846 return chandef->chan->max_power;
850 * enum survey_info_flags - survey information flags
852 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
853 * @SURVEY_INFO_IN_USE: channel is currently being used
854 * @SURVEY_INFO_TIME: active time (in ms) was filled in
855 * @SURVEY_INFO_TIME_BUSY: busy time was filled in
856 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
857 * @SURVEY_INFO_TIME_RX: receive time was filled in
858 * @SURVEY_INFO_TIME_TX: transmit time was filled in
859 * @SURVEY_INFO_TIME_SCAN: scan time was filled in
860 * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
862 * Used by the driver to indicate which info in &struct survey_info
863 * it has filled in during the get_survey().
865 enum survey_info_flags {
866 SURVEY_INFO_NOISE_DBM = BIT(0),
867 SURVEY_INFO_IN_USE = BIT(1),
868 SURVEY_INFO_TIME = BIT(2),
869 SURVEY_INFO_TIME_BUSY = BIT(3),
870 SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
871 SURVEY_INFO_TIME_RX = BIT(5),
872 SURVEY_INFO_TIME_TX = BIT(6),
873 SURVEY_INFO_TIME_SCAN = BIT(7),
874 SURVEY_INFO_TIME_BSS_RX = BIT(8),
878 * struct survey_info - channel survey response
880 * @channel: the channel this survey record reports, may be %NULL for a single
881 * record to report global statistics
882 * @filled: bitflag of flags from &enum survey_info_flags
883 * @noise: channel noise in dBm. This and all following fields are
885 * @time: amount of time in ms the radio was turn on (on the channel)
886 * @time_busy: amount of time the primary channel was sensed busy
887 * @time_ext_busy: amount of time the extension channel was sensed busy
888 * @time_rx: amount of time the radio spent receiving data
889 * @time_tx: amount of time the radio spent transmitting data
890 * @time_scan: amount of time the radio spent for scanning
891 * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
893 * Used by dump_survey() to report back per-channel survey information.
895 * This structure can later be expanded with things like
896 * channel duty cycle etc.
899 struct ieee80211_channel *channel;
911 #define CFG80211_MAX_WEP_KEYS 4
914 * struct cfg80211_crypto_settings - Crypto settings
915 * @wpa_versions: indicates which, if any, WPA versions are enabled
916 * (from enum nl80211_wpa_versions)
917 * @cipher_group: group key cipher suite (or 0 if unset)
918 * @n_ciphers_pairwise: number of AP supported unicast ciphers
919 * @ciphers_pairwise: unicast key cipher suites
920 * @n_akm_suites: number of AKM suites
921 * @akm_suites: AKM suites
922 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
923 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
924 * required to assume that the port is unauthorized until authorized by
925 * user space. Otherwise, port is marked authorized by default.
926 * @control_port_ethertype: the control port protocol that should be
927 * allowed through even on unauthorized ports
928 * @control_port_no_encrypt: TRUE to prevent encryption of control port
930 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
931 * port frames over NL80211 instead of the network interface.
932 * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
934 * @wep_keys: static WEP keys, if not NULL points to an array of
935 * CFG80211_MAX_WEP_KEYS WEP keys
936 * @wep_tx_key: key index (0..3) of the default TX static WEP key
937 * @psk: PSK (for devices supporting 4-way-handshake offload)
938 * @sae_pwd: password for SAE authentication (for devices supporting SAE
940 * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
942 struct cfg80211_crypto_settings {
945 int n_ciphers_pairwise;
946 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
948 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
950 __be16 control_port_ethertype;
951 bool control_port_no_encrypt;
952 bool control_port_over_nl80211;
953 bool control_port_no_preauth;
954 struct key_params *wep_keys;
962 * struct cfg80211_beacon_data - beacon data
963 * @head: head portion of beacon (before TIM IE)
964 * or %NULL if not changed
965 * @tail: tail portion of beacon (after TIM IE)
966 * or %NULL if not changed
967 * @head_len: length of @head
968 * @tail_len: length of @tail
969 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
970 * @beacon_ies_len: length of beacon_ies in octets
971 * @proberesp_ies: extra information element(s) to add into Probe Response
973 * @proberesp_ies_len: length of proberesp_ies in octets
974 * @assocresp_ies: extra information element(s) to add into (Re)Association
975 * Response frames or %NULL
976 * @assocresp_ies_len: length of assocresp_ies in octets
977 * @probe_resp_len: length of probe response template (@probe_resp)
978 * @probe_resp: probe response template (AP mode only)
979 * @ftm_responder: enable FTM responder functionality; -1 for no change
980 * (which also implies no change in LCI/civic location data)
981 * @lci: Measurement Report element content, starting with Measurement Token
982 * (measurement type 8)
983 * @civicloc: Measurement Report element content, starting with Measurement
984 * Token (measurement type 11)
985 * @lci_len: LCI data length
986 * @civicloc_len: Civic location data length
988 struct cfg80211_beacon_data {
989 const u8 *head, *tail;
990 const u8 *beacon_ies;
991 const u8 *proberesp_ies;
992 const u8 *assocresp_ies;
993 const u8 *probe_resp;
998 size_t head_len, tail_len;
999 size_t beacon_ies_len;
1000 size_t proberesp_ies_len;
1001 size_t assocresp_ies_len;
1002 size_t probe_resp_len;
1004 size_t civicloc_len;
1007 struct mac_address {
1012 * struct cfg80211_acl_data - Access control list data
1014 * @acl_policy: ACL policy to be applied on the station's
1015 * entry specified by mac_addr
1016 * @n_acl_entries: Number of MAC address entries passed
1017 * @mac_addrs: List of MAC addresses of stations to be used for ACL
1019 struct cfg80211_acl_data {
1020 enum nl80211_acl_policy acl_policy;
1024 struct mac_address mac_addrs[];
1028 * enum cfg80211_ap_settings_flags - AP settings flags
1030 * Used by cfg80211_ap_settings
1032 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
1034 enum cfg80211_ap_settings_flags {
1035 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
1039 * struct cfg80211_ap_settings - AP configuration
1041 * Used to configure an AP interface.
1043 * @chandef: defines the channel to use
1044 * @beacon: beacon data
1045 * @beacon_interval: beacon interval
1046 * @dtim_period: DTIM period
1047 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
1049 * @ssid_len: length of @ssid
1050 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
1051 * @crypto: crypto settings
1052 * @privacy: the BSS uses privacy
1053 * @auth_type: Authentication type (algorithm)
1054 * @smps_mode: SMPS mode
1055 * @inactivity_timeout: time in seconds to determine station's inactivity.
1056 * @p2p_ctwindow: P2P CT Window
1057 * @p2p_opp_ps: P2P opportunistic PS
1058 * @acl: ACL configuration used by the drivers which has support for
1059 * MAC address based access control
1060 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
1062 * @beacon_rate: bitrate to be used for beacons
1063 * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
1064 * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
1065 * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
1066 * @ht_required: stations must support HT
1067 * @vht_required: stations must support VHT
1068 * @twt_responder: Enable Target Wait Time
1069 * @he_required: stations must support HE
1070 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
1071 * @he_obss_pd: OBSS Packet Detection settings
1072 * @he_bss_color: BSS Color settings
1073 * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
1075 struct cfg80211_ap_settings {
1076 struct cfg80211_chan_def chandef;
1078 struct cfg80211_beacon_data beacon;
1080 int beacon_interval, dtim_period;
1083 enum nl80211_hidden_ssid hidden_ssid;
1084 struct cfg80211_crypto_settings crypto;
1086 enum nl80211_auth_type auth_type;
1087 enum nl80211_smps_mode smps_mode;
1088 int inactivity_timeout;
1091 const struct cfg80211_acl_data *acl;
1093 struct cfg80211_bitrate_mask beacon_rate;
1095 const struct ieee80211_ht_cap *ht_cap;
1096 const struct ieee80211_vht_cap *vht_cap;
1097 const struct ieee80211_he_cap_elem *he_cap;
1098 const struct ieee80211_he_operation *he_oper;
1099 bool ht_required, vht_required, he_required;
1102 struct ieee80211_he_obss_pd he_obss_pd;
1103 struct cfg80211_he_bss_color he_bss_color;
1107 * struct cfg80211_csa_settings - channel switch settings
1109 * Used for channel switch
1111 * @chandef: defines the channel to use after the switch
1112 * @beacon_csa: beacon data while performing the switch
1113 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
1114 * @counter_offsets_presp: offsets of the counters within the probe response
1115 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
1116 * @n_counter_offsets_presp: number of csa counters in the probe response
1117 * @beacon_after: beacon data to be used on the new channel
1118 * @radar_required: whether radar detection is required on the new channel
1119 * @block_tx: whether transmissions should be blocked while changing
1120 * @count: number of beacons until switch
1122 struct cfg80211_csa_settings {
1123 struct cfg80211_chan_def chandef;
1124 struct cfg80211_beacon_data beacon_csa;
1125 const u16 *counter_offsets_beacon;
1126 const u16 *counter_offsets_presp;
1127 unsigned int n_counter_offsets_beacon;
1128 unsigned int n_counter_offsets_presp;
1129 struct cfg80211_beacon_data beacon_after;
1130 bool radar_required;
1135 #define CFG80211_MAX_NUM_DIFFERENT_CHANNELS 10
1138 * struct iface_combination_params - input parameters for interface combinations
1140 * Used to pass interface combination parameters
1142 * @num_different_channels: the number of different channels we want
1143 * to use for verification
1144 * @radar_detect: a bitmap where each bit corresponds to a channel
1145 * width where radar detection is needed, as in the definition of
1146 * &struct ieee80211_iface_combination.@radar_detect_widths
1147 * @iftype_num: array with the number of interfaces of each interface
1148 * type. The index is the interface type as specified in &enum
1150 * @new_beacon_int: set this to the beacon interval of a new interface
1151 * that's not operating yet, if such is to be checked as part of
1154 struct iface_combination_params {
1155 int num_different_channels;
1157 int iftype_num[NUM_NL80211_IFTYPES];
1162 * enum station_parameters_apply_mask - station parameter values to apply
1163 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
1164 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
1165 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
1167 * Not all station parameters have in-band "no change" signalling,
1168 * for those that don't these flags will are used.
1170 enum station_parameters_apply_mask {
1171 STATION_PARAM_APPLY_UAPSD = BIT(0),
1172 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
1173 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
1174 STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
1178 * struct sta_txpwr - station txpower configuration
1180 * Used to configure txpower for station.
1182 * @power: tx power (in dBm) to be used for sending data traffic. If tx power
1183 * is not provided, the default per-interface tx power setting will be
1184 * overriding. Driver should be picking up the lowest tx power, either tx
1185 * power per-interface or per-station.
1186 * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
1187 * will be less than or equal to specified from userspace, whereas if TPC
1188 * %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
1189 * NL80211_TX_POWER_FIXED is not a valid configuration option for
1194 enum nl80211_tx_power_setting type;
1198 * struct station_parameters - station parameters
1200 * Used to change and create a new station.
1202 * @vlan: vlan interface station should belong to
1203 * @supported_rates: supported rates in IEEE 802.11 format
1204 * (or NULL for no change)
1205 * @supported_rates_len: number of supported rates
1206 * @sta_flags_mask: station flags that changed
1207 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1208 * @sta_flags_set: station flags values
1209 * (bitmask of BIT(%NL80211_STA_FLAG_...))
1210 * @listen_interval: listen interval or -1 for no change
1211 * @aid: AID or zero for no change
1212 * @vlan_id: VLAN ID for station (if nonzero)
1213 * @peer_aid: mesh peer AID or zero for no change
1214 * @plink_action: plink action to take
1215 * @plink_state: set the peer link state for a station
1216 * @ht_capa: HT capabilities of station
1217 * @vht_capa: VHT capabilities of station
1218 * @uapsd_queues: bitmap of queues configured for uapsd. same format
1219 * as the AC bitmap in the QoS info field
1220 * @max_sp: max Service Period. same format as the MAX_SP in the
1221 * QoS info field (but already shifted down)
1222 * @sta_modify_mask: bitmap indicating which parameters changed
1223 * (for those that don't have a natural "no change" value),
1224 * see &enum station_parameters_apply_mask
1225 * @local_pm: local link-specific mesh power save mode (no change when set
1227 * @capability: station capability
1228 * @ext_capab: extended capabilities of the station
1229 * @ext_capab_len: number of extended capabilities
1230 * @supported_channels: supported channels in IEEE 802.11 format
1231 * @supported_channels_len: number of supported channels
1232 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
1233 * @supported_oper_classes_len: number of supported operating classes
1234 * @opmode_notif: operating mode field from Operating Mode Notification
1235 * @opmode_notif_used: information if operating mode field is used
1236 * @support_p2p_ps: information if station supports P2P PS mechanism
1237 * @he_capa: HE capabilities of station
1238 * @he_capa_len: the length of the HE capabilities
1239 * @airtime_weight: airtime scheduler weight for this station
1240 * @txpwr: transmit power for an associated station
1242 struct station_parameters {
1243 const u8 *supported_rates;
1244 struct net_device *vlan;
1245 u32 sta_flags_mask, sta_flags_set;
1246 u32 sta_modify_mask;
1247 int listen_interval;
1251 u8 supported_rates_len;
1254 const struct ieee80211_ht_cap *ht_capa;
1255 const struct ieee80211_vht_cap *vht_capa;
1258 enum nl80211_mesh_power_mode local_pm;
1260 const u8 *ext_capab;
1262 const u8 *supported_channels;
1263 u8 supported_channels_len;
1264 const u8 *supported_oper_classes;
1265 u8 supported_oper_classes_len;
1267 bool opmode_notif_used;
1269 const struct ieee80211_he_cap_elem *he_capa;
1272 struct sta_txpwr txpwr;
1276 * struct station_del_parameters - station deletion parameters
1278 * Used to delete a station entry (or all stations).
1280 * @mac: MAC address of the station to remove or NULL to remove all stations
1281 * @subtype: Management frame subtype to use for indicating removal
1282 * (10 = Disassociation, 12 = Deauthentication)
1283 * @reason_code: Reason code for the Disassociation/Deauthentication frame
1285 struct station_del_parameters {
1292 * enum cfg80211_station_type - the type of station being modified
1293 * @CFG80211_STA_AP_CLIENT: client of an AP interface
1294 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
1295 * unassociated (update properties for this type of client is permitted)
1296 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
1297 * the AP MLME in the device
1298 * @CFG80211_STA_AP_STA: AP station on managed interface
1299 * @CFG80211_STA_IBSS: IBSS station
1300 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
1301 * while TDLS setup is in progress, it moves out of this state when
1302 * being marked authorized; use this only if TDLS with external setup is
1304 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
1305 * entry that is operating, has been marked authorized by userspace)
1306 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
1307 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
1309 enum cfg80211_station_type {
1310 CFG80211_STA_AP_CLIENT,
1311 CFG80211_STA_AP_CLIENT_UNASSOC,
1312 CFG80211_STA_AP_MLME_CLIENT,
1313 CFG80211_STA_AP_STA,
1315 CFG80211_STA_TDLS_PEER_SETUP,
1316 CFG80211_STA_TDLS_PEER_ACTIVE,
1317 CFG80211_STA_MESH_PEER_KERNEL,
1318 CFG80211_STA_MESH_PEER_USER,
1322 * cfg80211_check_station_change - validate parameter changes
1323 * @wiphy: the wiphy this operates on
1324 * @params: the new parameters for a station
1325 * @statype: the type of station being modified
1327 * Utility function for the @change_station driver method. Call this function
1328 * with the appropriate station type looking up the station (and checking that
1329 * it exists). It will verify whether the station change is acceptable, and if
1330 * not will return an error code. Note that it may modify the parameters for
1331 * backward compatibility reasons, so don't use them before calling this.
1333 int cfg80211_check_station_change(struct wiphy *wiphy,
1334 struct station_parameters *params,
1335 enum cfg80211_station_type statype);
1338 * enum station_info_rate_flags - bitrate info flags
1340 * Used by the driver to indicate the specific rate transmission
1341 * type for 802.11n transmissions.
1343 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
1344 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
1345 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
1346 * @RATE_INFO_FLAGS_DMG: 60GHz MCS
1347 * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
1348 * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
1350 enum rate_info_flags {
1351 RATE_INFO_FLAGS_MCS = BIT(0),
1352 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
1353 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
1354 RATE_INFO_FLAGS_DMG = BIT(3),
1355 RATE_INFO_FLAGS_HE_MCS = BIT(4),
1356 RATE_INFO_FLAGS_EDMG = BIT(5),
1360 * enum rate_info_bw - rate bandwidth information
1362 * Used by the driver to indicate the rate bandwidth.
1364 * @RATE_INFO_BW_5: 5 MHz bandwidth
1365 * @RATE_INFO_BW_10: 10 MHz bandwidth
1366 * @RATE_INFO_BW_20: 20 MHz bandwidth
1367 * @RATE_INFO_BW_40: 40 MHz bandwidth
1368 * @RATE_INFO_BW_80: 80 MHz bandwidth
1369 * @RATE_INFO_BW_160: 160 MHz bandwidth
1370 * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
1373 RATE_INFO_BW_20 = 0,
1383 * struct rate_info - bitrate information
1385 * Information about a receiving or transmitting bitrate
1387 * @flags: bitflag of flags from &enum rate_info_flags
1388 * @mcs: mcs index if struct describes an HT/VHT/HE rate
1389 * @legacy: bitrate in 100kbit/s for 802.11abg
1390 * @nss: number of streams (VHT & HE only)
1391 * @bw: bandwidth (from &enum rate_info_bw)
1392 * @he_gi: HE guard interval (from &enum nl80211_he_gi)
1393 * @he_dcm: HE DCM value
1394 * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
1395 * only valid if bw is %RATE_INFO_BW_HE_RU)
1396 * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
1411 * enum station_info_rate_flags - bitrate info flags
1413 * Used by the driver to indicate the specific rate transmission
1414 * type for 802.11n transmissions.
1416 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1417 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1418 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1420 enum bss_param_flags {
1421 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1422 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1423 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1427 * struct sta_bss_parameters - BSS parameters for the attached station
1429 * Information about the currently associated BSS
1431 * @flags: bitflag of flags from &enum bss_param_flags
1432 * @dtim_period: DTIM period for the BSS
1433 * @beacon_interval: beacon interval
1435 struct sta_bss_parameters {
1438 u16 beacon_interval;
1442 * struct cfg80211_txq_stats - TXQ statistics for this TID
1443 * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
1444 * indicate the relevant values in this struct are filled
1445 * @backlog_bytes: total number of bytes currently backlogged
1446 * @backlog_packets: total number of packets currently backlogged
1447 * @flows: number of new flows seen
1448 * @drops: total number of packets dropped
1449 * @ecn_marks: total number of packets marked with ECN CE
1450 * @overlimit: number of drops due to queue space overflow
1451 * @overmemory: number of drops due to memory limit overflow
1452 * @collisions: number of hash collisions
1453 * @tx_bytes: total number of bytes dequeued
1454 * @tx_packets: total number of packets dequeued
1455 * @max_flows: maximum number of flows supported
1457 struct cfg80211_txq_stats {
1460 u32 backlog_packets;
1473 * struct cfg80211_tid_stats - per-TID statistics
1474 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1475 * indicate the relevant values in this struct are filled
1476 * @rx_msdu: number of received MSDUs
1477 * @tx_msdu: number of (attempted) transmitted MSDUs
1478 * @tx_msdu_retries: number of retries (not counting the first) for
1480 * @tx_msdu_failed: number of failed transmitted MSDUs
1481 * @txq_stats: TXQ statistics
1483 struct cfg80211_tid_stats {
1487 u64 tx_msdu_retries;
1489 struct cfg80211_txq_stats txq_stats;
1492 #define IEEE80211_MAX_CHAINS 4
1495 * struct station_info - station information
1497 * Station information filled by driver for get_station() and dump_station.
1499 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1500 * indicate the relevant values in this struct for them
1501 * @connected_time: time(in secs) since a station is last connected
1502 * @inactive_time: time since last station activity (tx/rx) in milliseconds
1503 * @assoc_at: bootime (ns) of the last association
1504 * @rx_bytes: bytes (size of MPDUs) received from this station
1505 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
1506 * @llid: mesh local link id
1507 * @plid: mesh peer link id
1508 * @plink_state: mesh peer link state
1509 * @signal: The signal strength, type depends on the wiphy's signal_type.
1510 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1511 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1512 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1513 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1514 * @chain_signal: per-chain signal strength of last received packet in dBm
1515 * @chain_signal_avg: per-chain signal strength average in dBm
1516 * @txrate: current unicast bitrate from this station
1517 * @rxrate: current unicast bitrate to this station
1518 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1519 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1520 * @tx_retries: cumulative retry counts (MPDUs)
1521 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
1522 * @rx_dropped_misc: Dropped for un-specified reason.
1523 * @bss_param: current BSS parameters
1524 * @generation: generation number for nl80211 dumps.
1525 * This number should increase every time the list of stations
1526 * changes, i.e. when a station is added or removed, so that
1527 * userspace can tell whether it got a consistent snapshot.
1528 * @assoc_req_ies: IEs from (Re)Association Request.
1529 * This is used only when in AP mode with drivers that do not use
1530 * user space MLME/SME implementation. The information is provided for
1531 * the cfg80211_new_sta() calls to notify user space of the IEs.
1532 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1533 * @sta_flags: station flags mask & values
1534 * @beacon_loss_count: Number of times beacon loss event has triggered.
1535 * @t_offset: Time offset of the station relative to this host.
1536 * @local_pm: local mesh STA power save mode
1537 * @peer_pm: peer mesh STA power save mode
1538 * @nonpeer_pm: non-peer mesh STA power save mode
1539 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1540 * towards this station.
1541 * @rx_beacon: number of beacons received from this peer
1542 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1544 * @connected_to_gate: true if mesh STA has a path to mesh gate
1545 * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
1546 * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
1547 * @airtime_weight: current airtime scheduling weight
1548 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1549 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1550 * Note that this doesn't use the @filled bit, but is used if non-NULL.
1551 * @ack_signal: signal strength (in dBm) of the last ACK frame.
1552 * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
1554 * @rx_mpdu_count: number of MPDUs received from this station
1555 * @fcs_err_count: number of packets (MPDUs) received from this station with
1556 * an FCS error. This counter should be incremented only when TA of the
1557 * received packet with an FCS error matches the peer MAC address.
1558 * @airtime_link_metric: mesh airtime link metric.
1560 struct station_info {
1574 s8 chain_signal[IEEE80211_MAX_CHAINS];
1575 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1577 struct rate_info txrate;
1578 struct rate_info rxrate;
1583 u32 rx_dropped_misc;
1584 struct sta_bss_parameters bss_param;
1585 struct nl80211_sta_flag_update sta_flags;
1589 const u8 *assoc_req_ies;
1590 size_t assoc_req_ies_len;
1592 u32 beacon_loss_count;
1594 enum nl80211_mesh_power_mode local_pm;
1595 enum nl80211_mesh_power_mode peer_pm;
1596 enum nl80211_mesh_power_mode nonpeer_pm;
1598 u32 expected_throughput;
1603 u8 rx_beacon_signal_avg;
1604 u8 connected_to_gate;
1606 struct cfg80211_tid_stats *pertid;
1615 u32 airtime_link_metric;
1618 #if IS_ENABLED(CONFIG_CFG80211)
1620 * cfg80211_get_station - retrieve information about a given station
1621 * @dev: the device where the station is supposed to be connected to
1622 * @mac_addr: the mac address of the station of interest
1623 * @sinfo: pointer to the structure to fill with the information
1625 * Returns 0 on success and sinfo is filled with the available information
1626 * otherwise returns a negative error code and the content of sinfo has to be
1627 * considered undefined.
1629 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1630 struct station_info *sinfo);
1632 static inline int cfg80211_get_station(struct net_device *dev,
1634 struct station_info *sinfo)
1641 * enum monitor_flags - monitor flags
1643 * Monitor interface configuration flags. Note that these must be the bits
1644 * according to the nl80211 flags.
1646 * @MONITOR_FLAG_CHANGED: set if the flags were changed
1647 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1648 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1649 * @MONITOR_FLAG_CONTROL: pass control frames
1650 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1651 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1652 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
1654 enum monitor_flags {
1655 MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
1656 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1657 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1658 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1659 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1660 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1661 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
1665 * enum mpath_info_flags - mesh path information flags
1667 * Used by the driver to indicate which info in &struct mpath_info it has filled
1668 * in during get_station() or dump_station().
1670 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1671 * @MPATH_INFO_SN: @sn filled
1672 * @MPATH_INFO_METRIC: @metric filled
1673 * @MPATH_INFO_EXPTIME: @exptime filled
1674 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1675 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1676 * @MPATH_INFO_FLAGS: @flags filled
1677 * @MPATH_INFO_HOP_COUNT: @hop_count filled
1678 * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
1680 enum mpath_info_flags {
1681 MPATH_INFO_FRAME_QLEN = BIT(0),
1682 MPATH_INFO_SN = BIT(1),
1683 MPATH_INFO_METRIC = BIT(2),
1684 MPATH_INFO_EXPTIME = BIT(3),
1685 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1686 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1687 MPATH_INFO_FLAGS = BIT(6),
1688 MPATH_INFO_HOP_COUNT = BIT(7),
1689 MPATH_INFO_PATH_CHANGE = BIT(8),
1693 * struct mpath_info - mesh path information
1695 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1697 * @filled: bitfield of flags from &enum mpath_info_flags
1698 * @frame_qlen: number of queued frames for this destination
1699 * @sn: target sequence number
1700 * @metric: metric (cost) of this mesh path
1701 * @exptime: expiration time for the mesh path from now, in msecs
1702 * @flags: mesh path flags
1703 * @discovery_timeout: total mesh path discovery timeout, in msecs
1704 * @discovery_retries: mesh path discovery retries
1705 * @generation: generation number for nl80211 dumps.
1706 * This number should increase every time the list of mesh paths
1707 * changes, i.e. when a station is added or removed, so that
1708 * userspace can tell whether it got a consistent snapshot.
1709 * @hop_count: hops to destination
1710 * @path_change_count: total number of path changes to destination
1718 u32 discovery_timeout;
1719 u8 discovery_retries;
1722 u32 path_change_count;
1728 * struct bss_parameters - BSS parameters
1730 * Used to change BSS parameters (mainly for AP mode).
1732 * @use_cts_prot: Whether to use CTS protection
1733 * (0 = no, 1 = yes, -1 = do not change)
1734 * @use_short_preamble: Whether the use of short preambles is allowed
1735 * (0 = no, 1 = yes, -1 = do not change)
1736 * @use_short_slot_time: Whether the use of short slot time is allowed
1737 * (0 = no, 1 = yes, -1 = do not change)
1738 * @basic_rates: basic rates in IEEE 802.11 format
1739 * (or NULL for no change)
1740 * @basic_rates_len: number of basic rates
1741 * @ap_isolate: do not forward packets between connected stations
1742 * @ht_opmode: HT Operation mode
1743 * (u16 = opmode, -1 = do not change)
1744 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1745 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
1747 struct bss_parameters {
1749 int use_short_preamble;
1750 int use_short_slot_time;
1751 const u8 *basic_rates;
1755 s8 p2p_ctwindow, p2p_opp_ps;
1759 * struct mesh_config - 802.11s mesh configuration
1761 * These parameters can be changed while the mesh is active.
1763 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1764 * by the Mesh Peering Open message
1765 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1766 * used by the Mesh Peering Open message
1767 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1768 * the mesh peering management to close a mesh peering
1769 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1771 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1772 * be sent to establish a new peer link instance in a mesh
1773 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1774 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1776 * @auto_open_plinks: whether we should automatically open peer links when we
1777 * detect compatible mesh peers
1778 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1779 * synchronize to for 11s default synchronization method
1780 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1781 * that an originator mesh STA can send to a particular path target
1782 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1783 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1784 * a path discovery in milliseconds
1785 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1786 * receiving a PREQ shall consider the forwarding information from the
1787 * root to be valid. (TU = time unit)
1788 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1789 * which a mesh STA can send only one action frame containing a PREQ
1791 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1792 * which a mesh STA can send only one Action frame containing a PERR
1794 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1795 * it takes for an HWMP information element to propagate across the mesh
1796 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1797 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1798 * announcements are transmitted
1799 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1800 * station has access to a broader network beyond the MBSS. (This is
1801 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1802 * only means that the station will announce others it's a mesh gate, but
1803 * not necessarily using the gate announcement protocol. Still keeping the
1804 * same nomenclature to be in sync with the spec)
1805 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1806 * entity (default is TRUE - forwarding entity)
1807 * @rssi_threshold: the threshold for average signal strength of candidate
1808 * station to establish a peer link
1809 * @ht_opmode: mesh HT protection mode
1811 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1812 * receiving a proactive PREQ shall consider the forwarding information to
1813 * the root mesh STA to be valid.
1815 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1816 * PREQs are transmitted.
1817 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1818 * during which a mesh STA can send only one Action frame containing
1819 * a PREQ element for root path confirmation.
1820 * @power_mode: The default mesh power save mode which will be the initial
1821 * setting for new peer links.
1822 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1823 * after transmitting its beacon.
1824 * @plink_timeout: If no tx activity is seen from a STA we've established
1825 * peering with for longer than this time (in seconds), then remove it
1826 * from the STA's list of peers. Default is 30 minutes.
1827 * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
1828 * connected to a mesh gate in mesh formation info. If false, the
1829 * value in mesh formation is determined by the presence of root paths
1830 * in the mesh path table
1832 struct mesh_config {
1833 u16 dot11MeshRetryTimeout;
1834 u16 dot11MeshConfirmTimeout;
1835 u16 dot11MeshHoldingTimeout;
1836 u16 dot11MeshMaxPeerLinks;
1837 u8 dot11MeshMaxRetries;
1840 bool auto_open_plinks;
1841 u32 dot11MeshNbrOffsetMaxNeighbor;
1842 u8 dot11MeshHWMPmaxPREQretries;
1843 u32 path_refresh_time;
1844 u16 min_discovery_timeout;
1845 u32 dot11MeshHWMPactivePathTimeout;
1846 u16 dot11MeshHWMPpreqMinInterval;
1847 u16 dot11MeshHWMPperrMinInterval;
1848 u16 dot11MeshHWMPnetDiameterTraversalTime;
1849 u8 dot11MeshHWMPRootMode;
1850 bool dot11MeshConnectedToMeshGate;
1851 u16 dot11MeshHWMPRannInterval;
1852 bool dot11MeshGateAnnouncementProtocol;
1853 bool dot11MeshForwarding;
1856 u32 dot11MeshHWMPactivePathToRootTimeout;
1857 u16 dot11MeshHWMProotInterval;
1858 u16 dot11MeshHWMPconfirmationInterval;
1859 enum nl80211_mesh_power_mode power_mode;
1860 u16 dot11MeshAwakeWindowDuration;
1865 * struct mesh_setup - 802.11s mesh setup configuration
1866 * @chandef: defines the channel to use
1867 * @mesh_id: the mesh ID
1868 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1869 * @sync_method: which synchronization method to use
1870 * @path_sel_proto: which path selection protocol to use
1871 * @path_metric: which metric to use
1872 * @auth_id: which authentication method this mesh is using
1873 * @ie: vendor information elements (optional)
1874 * @ie_len: length of vendor information elements
1875 * @is_authenticated: this mesh requires authentication
1876 * @is_secure: this mesh uses security
1877 * @user_mpm: userspace handles all MPM functions
1878 * @dtim_period: DTIM period to use
1879 * @beacon_interval: beacon interval to use
1880 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1881 * @basic_rates: basic rates to use when creating the mesh
1882 * @beacon_rate: bitrate to be used for beacons
1883 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1884 * changes the channel when a radar is detected. This is required
1885 * to operate on DFS channels.
1886 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
1887 * port frames over NL80211 instead of the network interface.
1889 * These parameters are fixed when the mesh is created.
1892 struct cfg80211_chan_def chandef;
1901 bool is_authenticated;
1905 u16 beacon_interval;
1906 int mcast_rate[NUM_NL80211_BANDS];
1908 struct cfg80211_bitrate_mask beacon_rate;
1909 bool userspace_handles_dfs;
1910 bool control_port_over_nl80211;
1914 * struct ocb_setup - 802.11p OCB mode setup configuration
1915 * @chandef: defines the channel to use
1917 * These parameters are fixed when connecting to the network
1920 struct cfg80211_chan_def chandef;
1924 * struct ieee80211_txq_params - TX queue parameters
1925 * @ac: AC identifier
1926 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
1927 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
1929 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
1931 * @aifs: Arbitration interframe space [0..255]
1933 struct ieee80211_txq_params {
1942 * DOC: Scanning and BSS list handling
1944 * The scanning process itself is fairly simple, but cfg80211 offers quite
1945 * a bit of helper functionality. To start a scan, the scan operation will
1946 * be invoked with a scan definition. This scan definition contains the
1947 * channels to scan, and the SSIDs to send probe requests for (including the
1948 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1949 * probe. Additionally, a scan request may contain extra information elements
1950 * that should be added to the probe request. The IEs are guaranteed to be
1951 * well-formed, and will not exceed the maximum length the driver advertised
1952 * in the wiphy structure.
1954 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1955 * it is responsible for maintaining the BSS list; the driver should not
1956 * maintain a list itself. For this notification, various functions exist.
1958 * Since drivers do not maintain a BSS list, there are also a number of
1959 * functions to search for a BSS and obtain information about it from the
1960 * BSS structure cfg80211 maintains. The BSS list is also made available
1965 * struct cfg80211_ssid - SSID description
1967 * @ssid_len: length of the ssid
1969 struct cfg80211_ssid {
1970 u8 ssid[IEEE80211_MAX_SSID_LEN];
1975 * struct cfg80211_scan_info - information about completed scan
1976 * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
1977 * wireless device that requested the scan is connected to. If this
1978 * information is not available, this field is left zero.
1979 * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
1980 * @aborted: set to true if the scan was aborted for any reason,
1981 * userspace will be notified of that
1983 struct cfg80211_scan_info {
1985 u8 tsf_bssid[ETH_ALEN] __aligned(2);
1990 * struct cfg80211_scan_request - scan request description
1992 * @ssids: SSIDs to scan for (active scan only)
1993 * @n_ssids: number of SSIDs
1994 * @channels: channels to scan on.
1995 * @n_channels: total number of channels to scan
1996 * @scan_width: channel width for scanning
1997 * @ie: optional information element(s) to add into Probe Request or %NULL
1998 * @ie_len: length of ie in octets
1999 * @duration: how long to listen on each channel, in TUs. If
2000 * %duration_mandatory is not set, this is the maximum dwell time and
2001 * the actual dwell time may be shorter.
2002 * @duration_mandatory: if set, the scan duration must be as specified by the
2004 * @flags: bit field of flags controlling operation
2005 * @rates: bitmap of rates to advertise for each band
2006 * @wiphy: the wiphy this was for
2007 * @scan_start: time (in jiffies) when the scan started
2008 * @wdev: the wireless device to scan for
2009 * @info: (internal) information about completed scan
2010 * @notified: (internal) scan request was notified as done or aborted
2011 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
2012 * @mac_addr: MAC address used with randomisation
2013 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2014 * are 0 in the mask should be randomised, bits that are 1 should
2015 * be taken from the @mac_addr
2016 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
2018 struct cfg80211_scan_request {
2019 struct cfg80211_ssid *ssids;
2022 enum nl80211_bss_scan_width scan_width;
2026 bool duration_mandatory;
2029 u32 rates[NUM_NL80211_BANDS];
2031 struct wireless_dev *wdev;
2033 u8 mac_addr[ETH_ALEN] __aligned(2);
2034 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2035 u8 bssid[ETH_ALEN] __aligned(2);
2038 struct wiphy *wiphy;
2039 unsigned long scan_start;
2040 struct cfg80211_scan_info info;
2045 struct ieee80211_channel *channels[];
2048 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
2052 get_random_bytes(buf, ETH_ALEN);
2053 for (i = 0; i < ETH_ALEN; i++) {
2055 buf[i] |= addr[i] & mask[i];
2060 * struct cfg80211_match_set - sets of attributes to match
2062 * @ssid: SSID to be matched; may be zero-length in case of BSSID match
2063 * or no match (RSSI only)
2064 * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
2065 * or no match (RSSI only)
2066 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
2067 * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
2068 * for filtering out scan results received. Drivers advertize this support
2069 * of band specific rssi based filtering through the feature capability
2070 * %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
2071 * specific rssi thresholds take precedence over rssi_thold, if specified.
2072 * If not specified for any band, it will be assigned with rssi_thold of
2073 * corresponding matchset.
2075 struct cfg80211_match_set {
2076 struct cfg80211_ssid ssid;
2079 s32 per_band_rssi_thold[NUM_NL80211_BANDS];
2083 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
2085 * @interval: interval between scheduled scan iterations. In seconds.
2086 * @iterations: number of scan iterations in this scan plan. Zero means
2088 * The last scan plan will always have this parameter set to zero,
2089 * all other scan plans will have a finite number of iterations.
2091 struct cfg80211_sched_scan_plan {
2097 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
2099 * @band: band of BSS which should match for RSSI level adjustment.
2100 * @delta: value of RSSI level adjustment.
2102 struct cfg80211_bss_select_adjust {
2103 enum nl80211_band band;
2108 * struct cfg80211_sched_scan_request - scheduled scan request description
2110 * @reqid: identifies this request.
2111 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
2112 * @n_ssids: number of SSIDs
2113 * @n_channels: total number of channels to scan
2114 * @scan_width: channel width for scanning
2115 * @ie: optional information element(s) to add into Probe Request or %NULL
2116 * @ie_len: length of ie in octets
2117 * @flags: bit field of flags controlling operation
2118 * @match_sets: sets of parameters to be matched for a scan result
2119 * entry to be considered valid and to be passed to the host
2120 * (others are filtered out).
2121 * If ommited, all results are passed.
2122 * @n_match_sets: number of match sets
2123 * @report_results: indicates that results were reported for this request
2124 * @wiphy: the wiphy this was for
2125 * @dev: the interface
2126 * @scan_start: start time of the scheduled scan
2127 * @channels: channels to scan
2128 * @min_rssi_thold: for drivers only supporting a single threshold, this
2129 * contains the minimum over all matchsets
2130 * @mac_addr: MAC address used with randomisation
2131 * @mac_addr_mask: MAC address mask used with randomisation, bits that
2132 * are 0 in the mask should be randomised, bits that are 1 should
2133 * be taken from the @mac_addr
2134 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
2135 * index must be executed first.
2136 * @n_scan_plans: number of scan plans, at least 1.
2137 * @rcu_head: RCU callback used to free the struct
2138 * @owner_nlportid: netlink portid of owner (if this should is a request
2139 * owned by a particular socket)
2140 * @nl_owner_dead: netlink owner socket was closed - this request be freed
2141 * @list: for keeping list of requests.
2142 * @delay: delay in seconds to use before starting the first scan
2143 * cycle. The driver may ignore this parameter and start
2144 * immediately (or at any other time), if this feature is not
2146 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
2147 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
2148 * reporting in connected state to cases where a matching BSS is determined
2149 * to have better or slightly worse RSSI than the current connected BSS.
2150 * The relative RSSI threshold values are ignored in disconnected state.
2151 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
2152 * to the specified band while deciding whether a better BSS is reported
2153 * using @relative_rssi. If delta is a negative number, the BSSs that
2154 * belong to the specified band will be penalized by delta dB in relative
2157 struct cfg80211_sched_scan_request {
2159 struct cfg80211_ssid *ssids;
2162 enum nl80211_bss_scan_width scan_width;
2166 struct cfg80211_match_set *match_sets;
2170 struct cfg80211_sched_scan_plan *scan_plans;
2173 u8 mac_addr[ETH_ALEN] __aligned(2);
2174 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
2176 bool relative_rssi_set;
2178 struct cfg80211_bss_select_adjust rssi_adjust;
2181 struct wiphy *wiphy;
2182 struct net_device *dev;
2183 unsigned long scan_start;
2184 bool report_results;
2185 struct rcu_head rcu_head;
2188 struct list_head list;
2191 struct ieee80211_channel *channels[];
2195 * enum cfg80211_signal_type - signal type
2197 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
2198 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
2199 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
2201 enum cfg80211_signal_type {
2202 CFG80211_SIGNAL_TYPE_NONE,
2203 CFG80211_SIGNAL_TYPE_MBM,
2204 CFG80211_SIGNAL_TYPE_UNSPEC,
2208 * struct cfg80211_inform_bss - BSS inform data
2209 * @chan: channel the frame was received on
2210 * @scan_width: scan width that was used
2211 * @signal: signal strength value, according to the wiphy's
2213 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
2214 * received; should match the time when the frame was actually
2215 * received by the device (not just by the host, in case it was
2216 * buffered on the device) and be accurate to about 10ms.
2217 * If the frame isn't buffered, just passing the return value of
2218 * ktime_get_boottime_ns() is likely appropriate.
2219 * @parent_tsf: the time at the start of reception of the first octet of the
2220 * timestamp field of the frame. The time is the TSF of the BSS specified
2222 * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
2223 * the BSS that requested the scan in which the beacon/probe was received.
2224 * @chains: bitmask for filled values in @chain_signal.
2225 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2227 struct cfg80211_inform_bss {
2228 struct ieee80211_channel *chan;
2229 enum nl80211_bss_scan_width scan_width;
2233 u8 parent_bssid[ETH_ALEN] __aligned(2);
2235 s8 chain_signal[IEEE80211_MAX_CHAINS];
2239 * struct cfg80211_bss_ies - BSS entry IE data
2240 * @tsf: TSF contained in the frame that carried these IEs
2241 * @rcu_head: internal use, for freeing
2242 * @len: length of the IEs
2243 * @from_beacon: these IEs are known to come from a beacon
2246 struct cfg80211_bss_ies {
2248 struct rcu_head rcu_head;
2255 * struct cfg80211_bss - BSS description
2257 * This structure describes a BSS (which may also be a mesh network)
2258 * for use in scan results and similar.
2260 * @channel: channel this BSS is on
2261 * @scan_width: width of the control channel
2262 * @bssid: BSSID of the BSS
2263 * @beacon_interval: the beacon interval as from the frame
2264 * @capability: the capability field in host byte order
2265 * @ies: the information elements (Note that there is no guarantee that these
2266 * are well-formed!); this is a pointer to either the beacon_ies or
2267 * proberesp_ies depending on whether Probe Response frame has been
2268 * received. It is always non-%NULL.
2269 * @beacon_ies: the information elements from the last Beacon frame
2270 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
2271 * own the beacon_ies, but they're just pointers to the ones from the
2272 * @hidden_beacon_bss struct)
2273 * @proberesp_ies: the information elements from the last Probe Response frame
2274 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
2275 * a BSS that hides the SSID in its beacon, this points to the BSS struct
2276 * that holds the beacon data. @beacon_ies is still valid, of course, and
2277 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
2278 * @transmitted_bss: pointer to the transmitted BSS, if this is a
2279 * non-transmitted one (multi-BSSID support)
2280 * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
2281 * (multi-BSSID support)
2282 * @signal: signal strength value (type depends on the wiphy's signal_type)
2283 * @chains: bitmask for filled values in @chain_signal.
2284 * @chain_signal: per-chain signal strength of last received BSS in dBm.
2285 * @bssid_index: index in the multiple BSS set
2286 * @max_bssid_indicator: max number of members in the BSS set
2287 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
2289 struct cfg80211_bss {
2290 struct ieee80211_channel *channel;
2291 enum nl80211_bss_scan_width scan_width;
2293 const struct cfg80211_bss_ies __rcu *ies;
2294 const struct cfg80211_bss_ies __rcu *beacon_ies;
2295 const struct cfg80211_bss_ies __rcu *proberesp_ies;
2297 struct cfg80211_bss *hidden_beacon_bss;
2298 struct cfg80211_bss *transmitted_bss;
2299 struct list_head nontrans_list;
2303 u16 beacon_interval;
2308 s8 chain_signal[IEEE80211_MAX_CHAINS];
2311 u8 max_bssid_indicator;
2313 u8 priv[] __aligned(sizeof(void *));
2317 * ieee80211_bss_get_elem - find element with given ID
2318 * @bss: the bss to search
2319 * @id: the element ID
2321 * Note that the return value is an RCU-protected pointer, so
2322 * rcu_read_lock() must be held when calling this function.
2323 * Return: %NULL if not found.
2325 const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
2328 * ieee80211_bss_get_ie - find IE with given ID
2329 * @bss: the bss to search
2330 * @id: the element ID
2332 * Note that the return value is an RCU-protected pointer, so
2333 * rcu_read_lock() must be held when calling this function.
2334 * Return: %NULL if not found.
2336 static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
2338 return (void *)ieee80211_bss_get_elem(bss, id);
2343 * struct cfg80211_auth_request - Authentication request data
2345 * This structure provides information needed to complete IEEE 802.11
2348 * @bss: The BSS to authenticate with, the callee must obtain a reference
2349 * to it if it needs to keep it.
2350 * @auth_type: Authentication type (algorithm)
2351 * @ie: Extra IEs to add to Authentication frame or %NULL
2352 * @ie_len: Length of ie buffer in octets
2353 * @key_len: length of WEP key for shared key authentication
2354 * @key_idx: index of WEP key for shared key authentication
2355 * @key: WEP key for shared key authentication
2356 * @auth_data: Fields and elements in Authentication frames. This contains
2357 * the authentication frame body (non-IE and IE data), excluding the
2358 * Authentication algorithm number, i.e., starting at the Authentication
2359 * transaction sequence number field.
2360 * @auth_data_len: Length of auth_data buffer in octets
2362 struct cfg80211_auth_request {
2363 struct cfg80211_bss *bss;
2366 enum nl80211_auth_type auth_type;
2368 u8 key_len, key_idx;
2369 const u8 *auth_data;
2370 size_t auth_data_len;
2374 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
2376 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
2377 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
2378 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
2379 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
2380 * authentication capability. Drivers can offload authentication to
2381 * userspace if this flag is set. Only applicable for cfg80211_connect()
2382 * request (connect callback).
2384 enum cfg80211_assoc_req_flags {
2385 ASSOC_REQ_DISABLE_HT = BIT(0),
2386 ASSOC_REQ_DISABLE_VHT = BIT(1),
2387 ASSOC_REQ_USE_RRM = BIT(2),
2388 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
2392 * struct cfg80211_assoc_request - (Re)Association request data
2394 * This structure provides information needed to complete IEEE 802.11
2396 * @bss: The BSS to associate with. If the call is successful the driver is
2397 * given a reference that it must give back to cfg80211_send_rx_assoc()
2398 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
2399 * association requests while already associating must be rejected.
2400 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
2401 * @ie_len: Length of ie buffer in octets
2402 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
2403 * @crypto: crypto settings
2404 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2405 * to indicate a request to reassociate within the ESS instead of a request
2406 * do the initial association with the ESS. When included, this is set to
2407 * the BSSID of the current association, i.e., to the value that is
2408 * included in the Current AP address field of the Reassociation Request
2410 * @flags: See &enum cfg80211_assoc_req_flags
2411 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2412 * will be used in ht_capa. Un-supported values will be ignored.
2413 * @ht_capa_mask: The bits of ht_capa which are to be used.
2414 * @vht_capa: VHT capability override
2415 * @vht_capa_mask: VHT capability mask indicating which fields to use
2416 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
2417 * %NULL if FILS is not used.
2418 * @fils_kek_len: Length of fils_kek in octets
2419 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
2420 * Request/Response frame or %NULL if FILS is not used. This field starts
2421 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
2423 struct cfg80211_assoc_request {
2424 struct cfg80211_bss *bss;
2425 const u8 *ie, *prev_bssid;
2427 struct cfg80211_crypto_settings crypto;
2430 struct ieee80211_ht_cap ht_capa;
2431 struct ieee80211_ht_cap ht_capa_mask;
2432 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
2434 size_t fils_kek_len;
2435 const u8 *fils_nonces;
2439 * struct cfg80211_deauth_request - Deauthentication request data
2441 * This structure provides information needed to complete IEEE 802.11
2444 * @bssid: the BSSID of the BSS to deauthenticate from
2445 * @ie: Extra IEs to add to Deauthentication frame or %NULL
2446 * @ie_len: Length of ie buffer in octets
2447 * @reason_code: The reason code for the deauthentication
2448 * @local_state_change: if set, change local state only and
2449 * do not set a deauth frame
2451 struct cfg80211_deauth_request {
2456 bool local_state_change;
2460 * struct cfg80211_disassoc_request - Disassociation request data
2462 * This structure provides information needed to complete IEEE 802.11
2465 * @bss: the BSS to disassociate from
2466 * @ie: Extra IEs to add to Disassociation frame or %NULL
2467 * @ie_len: Length of ie buffer in octets
2468 * @reason_code: The reason code for the disassociation
2469 * @local_state_change: This is a request for a local state only, i.e., no
2470 * Disassociation frame is to be transmitted.
2472 struct cfg80211_disassoc_request {
2473 struct cfg80211_bss *bss;
2477 bool local_state_change;
2481 * struct cfg80211_ibss_params - IBSS parameters
2483 * This structure defines the IBSS parameters for the join_ibss()
2486 * @ssid: The SSID, will always be non-null.
2487 * @ssid_len: The length of the SSID, will always be non-zero.
2488 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
2489 * search for IBSSs with a different BSSID.
2490 * @chandef: defines the channel to use if no other IBSS to join can be found
2491 * @channel_fixed: The channel should be fixed -- do not search for
2492 * IBSSs to join on other channels.
2493 * @ie: information element(s) to include in the beacon
2494 * @ie_len: length of that
2495 * @beacon_interval: beacon interval to use
2496 * @privacy: this is a protected network, keys will be configured
2498 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
2499 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
2500 * required to assume that the port is unauthorized until authorized by
2501 * user space. Otherwise, port is marked authorized by default.
2502 * @control_port_over_nl80211: TRUE if userspace expects to exchange control
2503 * port frames over NL80211 instead of the network interface.
2504 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
2505 * changes the channel when a radar is detected. This is required
2506 * to operate on DFS channels.
2507 * @basic_rates: bitmap of basic rates to use when creating the IBSS
2508 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
2509 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2510 * will be used in ht_capa. Un-supported values will be ignored.
2511 * @ht_capa_mask: The bits of ht_capa which are to be used.
2512 * @wep_keys: static WEP keys, if not NULL points to an array of
2513 * CFG80211_MAX_WEP_KEYS WEP keys
2514 * @wep_tx_key: key index (0..3) of the default TX static WEP key
2516 struct cfg80211_ibss_params {
2519 struct cfg80211_chan_def chandef;
2521 u8 ssid_len, ie_len;
2522 u16 beacon_interval;
2527 bool control_port_over_nl80211;
2528 bool userspace_handles_dfs;
2529 int mcast_rate[NUM_NL80211_BANDS];
2530 struct ieee80211_ht_cap ht_capa;
2531 struct ieee80211_ht_cap ht_capa_mask;
2532 struct key_params *wep_keys;
2537 * struct cfg80211_bss_selection - connection parameters for BSS selection.
2539 * @behaviour: requested BSS selection behaviour.
2540 * @param: parameters for requestion behaviour.
2541 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
2542 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
2544 struct cfg80211_bss_selection {
2545 enum nl80211_bss_select_attr behaviour;
2547 enum nl80211_band band_pref;
2548 struct cfg80211_bss_select_adjust adjust;
2553 * struct cfg80211_connect_params - Connection parameters
2555 * This structure provides information needed to complete IEEE 802.11
2556 * authentication and association.
2558 * @channel: The channel to use or %NULL if not specified (auto-select based
2560 * @channel_hint: The channel of the recommended BSS for initial connection or
2561 * %NULL if not specified
2562 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2564 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2565 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2566 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2569 * @ssid_len: Length of ssid in octets
2570 * @auth_type: Authentication type (algorithm)
2571 * @ie: IEs for association request
2572 * @ie_len: Length of assoc_ie in octets
2573 * @privacy: indicates whether privacy-enabled APs should be used
2574 * @mfp: indicate whether management frame protection is used
2575 * @crypto: crypto settings
2576 * @key_len: length of WEP key for shared key authentication
2577 * @key_idx: index of WEP key for shared key authentication
2578 * @key: WEP key for shared key authentication
2579 * @flags: See &enum cfg80211_assoc_req_flags
2580 * @bg_scan_period: Background scan period in seconds
2581 * or -1 to indicate that default value is to be used.
2582 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2583 * will be used in ht_capa. Un-supported values will be ignored.
2584 * @ht_capa_mask: The bits of ht_capa which are to be used.
2585 * @vht_capa: VHT Capability overrides
2586 * @vht_capa_mask: The bits of vht_capa which are to be used.
2587 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2589 * @bss_select: criteria to be used for BSS selection.
2590 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
2591 * to indicate a request to reassociate within the ESS instead of a request
2592 * do the initial association with the ESS. When included, this is set to
2593 * the BSSID of the current association, i.e., to the value that is
2594 * included in the Current AP address field of the Reassociation Request
2596 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2597 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2599 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2600 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2601 * %NULL if not specified. This specifies the domain name of ER server and
2602 * is used to construct FILS wrapped data IE.
2603 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2604 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2605 * messages. This is also used to construct FILS wrapped data IE.
2606 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2607 * keys in FILS or %NULL if not specified.
2608 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
2609 * @want_1x: indicates user-space supports and wants to use 802.1X driver
2610 * offload of 4-way handshake.
2611 * @edmg: define the EDMG channels.
2612 * This may specify multiple channels and bonding options for the driver
2613 * to choose from, based on BSS configuration.
2615 struct cfg80211_connect_params {
2616 struct ieee80211_channel *channel;
2617 struct ieee80211_channel *channel_hint;
2619 const u8 *bssid_hint;
2622 enum nl80211_auth_type auth_type;
2626 enum nl80211_mfp mfp;
2627 struct cfg80211_crypto_settings crypto;
2629 u8 key_len, key_idx;
2632 struct ieee80211_ht_cap ht_capa;
2633 struct ieee80211_ht_cap ht_capa_mask;
2634 struct ieee80211_vht_cap vht_capa;
2635 struct ieee80211_vht_cap vht_capa_mask;
2637 struct cfg80211_bss_selection bss_select;
2638 const u8 *prev_bssid;
2639 const u8 *fils_erp_username;
2640 size_t fils_erp_username_len;
2641 const u8 *fils_erp_realm;
2642 size_t fils_erp_realm_len;
2643 u16 fils_erp_next_seq_num;
2644 const u8 *fils_erp_rrk;
2645 size_t fils_erp_rrk_len;
2647 struct ieee80211_edmg edmg;
2651 * enum cfg80211_connect_params_changed - Connection parameters being updated
2653 * This enum provides information of all connect parameters that
2654 * have to be updated as part of update_connect_params() call.
2656 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2657 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2658 * username, erp sequence number and rrk) are updated
2659 * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
2661 enum cfg80211_connect_params_changed {
2662 UPDATE_ASSOC_IES = BIT(0),
2663 UPDATE_FILS_ERP_INFO = BIT(1),
2664 UPDATE_AUTH_TYPE = BIT(2),
2668 * enum wiphy_params_flags - set_wiphy_params bitfield values
2669 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2670 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2671 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2672 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2673 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
2674 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
2675 * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
2676 * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
2677 * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
2679 enum wiphy_params_flags {
2680 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2681 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2682 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2683 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
2684 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
2685 WIPHY_PARAM_DYN_ACK = 1 << 5,
2686 WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
2687 WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
2688 WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
2691 #define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
2693 /* The per TXQ device queue limit in airtime */
2694 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
2695 #define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
2697 /* The per interface airtime threshold to switch to lower queue limit */
2698 #define IEEE80211_AQL_THRESHOLD 24000
2701 * struct cfg80211_pmksa - PMK Security Association
2703 * This structure is passed to the set/del_pmksa() method for PMKSA
2706 * @bssid: The AP's BSSID (may be %NULL).
2707 * @pmkid: The identifier to refer a PMKSA.
2708 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2709 * derivation by a FILS STA. Otherwise, %NULL.
2710 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2711 * the hash algorithm used to generate this.
2712 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2713 * cache identifier (may be %NULL).
2714 * @ssid_len: Length of the @ssid in octets.
2715 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2716 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2718 * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
2719 * (dot11RSNAConfigPMKLifetime) or 0 if not specified.
2720 * The configured PMKSA must not be used for PMKSA caching after
2721 * expiration and any keys derived from this PMK become invalid on
2722 * expiration, i.e., the current association must be dropped if the PMK
2723 * used for it expires.
2724 * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
2725 * PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
2726 * Drivers are expected to trigger a full authentication instead of using
2727 * this PMKSA for caching when reassociating to a new BSS after this
2728 * threshold to generate a new PMK before the current one expires.
2730 struct cfg80211_pmksa {
2739 u8 pmk_reauth_threshold;
2743 * struct cfg80211_pkt_pattern - packet pattern
2744 * @mask: bitmask where to match pattern and where to ignore bytes,
2745 * one bit per byte, in same format as nl80211
2746 * @pattern: bytes to match where bitmask is 1
2747 * @pattern_len: length of pattern (in bytes)
2748 * @pkt_offset: packet offset (in bytes)
2750 * Internal note: @mask and @pattern are allocated in one chunk of
2751 * memory, free @mask only!
2753 struct cfg80211_pkt_pattern {
2754 const u8 *mask, *pattern;
2760 * struct cfg80211_wowlan_tcp - TCP connection parameters
2762 * @sock: (internal) socket for source port allocation
2763 * @src: source IP address
2764 * @dst: destination IP address
2765 * @dst_mac: destination MAC address
2766 * @src_port: source port
2767 * @dst_port: destination port
2768 * @payload_len: data payload length
2769 * @payload: data payload buffer
2770 * @payload_seq: payload sequence stamping configuration
2771 * @data_interval: interval at which to send data packets
2772 * @wake_len: wakeup payload match length
2773 * @wake_data: wakeup payload match data
2774 * @wake_mask: wakeup payload match mask
2775 * @tokens_size: length of the tokens buffer
2776 * @payload_tok: payload token usage configuration
2778 struct cfg80211_wowlan_tcp {
2779 struct socket *sock;
2781 u16 src_port, dst_port;
2782 u8 dst_mac[ETH_ALEN];
2785 struct nl80211_wowlan_tcp_data_seq payload_seq;
2788 const u8 *wake_data, *wake_mask;
2790 /* must be last, variable member */
2791 struct nl80211_wowlan_tcp_data_token payload_tok;
2795 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2797 * This structure defines the enabled WoWLAN triggers for the device.
2798 * @any: wake up on any activity -- special trigger if device continues
2799 * operating as normal during suspend
2800 * @disconnect: wake up if getting disconnected
2801 * @magic_pkt: wake up on receiving magic packet
2802 * @patterns: wake up on receiving packet matching a pattern
2803 * @n_patterns: number of patterns
2804 * @gtk_rekey_failure: wake up on GTK rekey failure
2805 * @eap_identity_req: wake up on EAP identity request packet
2806 * @four_way_handshake: wake up on 4-way handshake
2807 * @rfkill_release: wake up when rfkill is released
2808 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
2809 * NULL if not configured.
2810 * @nd_config: configuration for the scan to be used for net detect wake.
2812 struct cfg80211_wowlan {
2813 bool any, disconnect, magic_pkt, gtk_rekey_failure,
2814 eap_identity_req, four_way_handshake,
2816 struct cfg80211_pkt_pattern *patterns;
2817 struct cfg80211_wowlan_tcp *tcp;
2819 struct cfg80211_sched_scan_request *nd_config;
2823 * struct cfg80211_coalesce_rules - Coalesce rule parameters
2825 * This structure defines coalesce rule for the device.
2826 * @delay: maximum coalescing delay in msecs.
2827 * @condition: condition for packet coalescence.
2828 * see &enum nl80211_coalesce_condition.
2829 * @patterns: array of packet patterns
2830 * @n_patterns: number of patterns
2832 struct cfg80211_coalesce_rules {
2834 enum nl80211_coalesce_condition condition;
2835 struct cfg80211_pkt_pattern *patterns;
2840 * struct cfg80211_coalesce - Packet coalescing settings
2842 * This structure defines coalescing settings.
2843 * @rules: array of coalesce rules
2844 * @n_rules: number of rules
2846 struct cfg80211_coalesce {
2847 struct cfg80211_coalesce_rules *rules;
2852 * struct cfg80211_wowlan_nd_match - information about the match
2854 * @ssid: SSID of the match that triggered the wake up
2855 * @n_channels: Number of channels where the match occurred. This
2856 * value may be zero if the driver can't report the channels.
2857 * @channels: center frequencies of the channels where a match
2860 struct cfg80211_wowlan_nd_match {
2861 struct cfg80211_ssid ssid;
2867 * struct cfg80211_wowlan_nd_info - net detect wake up information
2869 * @n_matches: Number of match information instances provided in
2870 * @matches. This value may be zero if the driver can't provide
2871 * match information.
2872 * @matches: Array of pointers to matches containing information about
2873 * the matches that triggered the wake up.
2875 struct cfg80211_wowlan_nd_info {
2877 struct cfg80211_wowlan_nd_match *matches[];
2881 * struct cfg80211_wowlan_wakeup - wakeup report
2882 * @disconnect: woke up by getting disconnected
2883 * @magic_pkt: woke up by receiving magic packet
2884 * @gtk_rekey_failure: woke up by GTK rekey failure
2885 * @eap_identity_req: woke up by EAP identity request packet
2886 * @four_way_handshake: woke up by 4-way handshake
2887 * @rfkill_release: woke up by rfkill being released
2888 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2889 * @packet_present_len: copied wakeup packet data
2890 * @packet_len: original wakeup packet length
2891 * @packet: The packet causing the wakeup, if any.
2892 * @packet_80211: For pattern match, magic packet and other data
2893 * frame triggers an 802.3 frame should be reported, for
2894 * disconnect due to deauth 802.11 frame. This indicates which
2896 * @tcp_match: TCP wakeup packet received
2897 * @tcp_connlost: TCP connection lost or failed to establish
2898 * @tcp_nomoretokens: TCP data ran out of tokens
2899 * @net_detect: if not %NULL, woke up because of net detect
2901 struct cfg80211_wowlan_wakeup {
2902 bool disconnect, magic_pkt, gtk_rekey_failure,
2903 eap_identity_req, four_way_handshake,
2904 rfkill_release, packet_80211,
2905 tcp_match, tcp_connlost, tcp_nomoretokens;
2907 u32 packet_present_len, packet_len;
2909 struct cfg80211_wowlan_nd_info *net_detect;
2913 * struct cfg80211_gtk_rekey_data - rekey data
2914 * @kek: key encryption key (NL80211_KEK_LEN bytes)
2915 * @kck: key confirmation key (NL80211_KCK_LEN bytes)
2916 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2918 struct cfg80211_gtk_rekey_data {
2919 const u8 *kek, *kck, *replay_ctr;
2923 * struct cfg80211_update_ft_ies_params - FT IE Information
2925 * This structure provides information needed to update the fast transition IE
2927 * @md: The Mobility Domain ID, 2 Octet value
2928 * @ie: Fast Transition IEs
2929 * @ie_len: Length of ft_ie in octets
2931 struct cfg80211_update_ft_ies_params {
2938 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2940 * This structure provides information needed to transmit a mgmt frame
2942 * @chan: channel to use
2943 * @offchan: indicates wether off channel operation is required
2944 * @wait: duration for ROC
2945 * @buf: buffer to transmit
2946 * @len: buffer length
2947 * @no_cck: don't use cck rates for this frame
2948 * @dont_wait_for_ack: tells the low level not to wait for an ack
2949 * @n_csa_offsets: length of csa_offsets array
2950 * @csa_offsets: array of all the csa offsets in the frame
2952 struct cfg80211_mgmt_tx_params {
2953 struct ieee80211_channel *chan;
2959 bool dont_wait_for_ack;
2961 const u16 *csa_offsets;
2965 * struct cfg80211_dscp_exception - DSCP exception
2967 * @dscp: DSCP value that does not adhere to the user priority range definition
2968 * @up: user priority value to which the corresponding DSCP value belongs
2970 struct cfg80211_dscp_exception {
2976 * struct cfg80211_dscp_range - DSCP range definition for user priority
2978 * @low: lowest DSCP value of this user priority range, inclusive
2979 * @high: highest DSCP value of this user priority range, inclusive
2981 struct cfg80211_dscp_range {
2986 /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2987 #define IEEE80211_QOS_MAP_MAX_EX 21
2988 #define IEEE80211_QOS_MAP_LEN_MIN 16
2989 #define IEEE80211_QOS_MAP_LEN_MAX \
2990 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2993 * struct cfg80211_qos_map - QoS Map Information
2995 * This struct defines the Interworking QoS map setting for DSCP values
2997 * @num_des: number of DSCP exceptions (0..21)
2998 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2999 * the user priority DSCP range definition
3000 * @up: DSCP range definition for a particular user priority
3002 struct cfg80211_qos_map {
3004 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
3005 struct cfg80211_dscp_range up[8];
3009 * struct cfg80211_nan_conf - NAN configuration
3011 * This struct defines NAN configuration parameters
3013 * @master_pref: master preference (1 - 255)
3014 * @bands: operating bands, a bitmap of &enum nl80211_band values.
3015 * For instance, for NL80211_BAND_2GHZ, bit 0 would be set
3016 * (i.e. BIT(NL80211_BAND_2GHZ)).
3018 struct cfg80211_nan_conf {
3024 * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
3027 * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
3028 * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
3030 enum cfg80211_nan_conf_changes {
3031 CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
3032 CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
3036 * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
3038 * @filter: the content of the filter
3039 * @len: the length of the filter
3041 struct cfg80211_nan_func_filter {
3047 * struct cfg80211_nan_func - a NAN function
3049 * @type: &enum nl80211_nan_function_type
3050 * @service_id: the service ID of the function
3051 * @publish_type: &nl80211_nan_publish_type
3052 * @close_range: if true, the range should be limited. Threshold is
3053 * implementation specific.
3054 * @publish_bcast: if true, the solicited publish should be broadcasted
3055 * @subscribe_active: if true, the subscribe is active
3056 * @followup_id: the instance ID for follow up
3057 * @followup_reqid: the requestor instance ID for follow up
3058 * @followup_dest: MAC address of the recipient of the follow up
3059 * @ttl: time to live counter in DW.
3060 * @serv_spec_info: Service Specific Info
3061 * @serv_spec_info_len: Service Specific Info length
3062 * @srf_include: if true, SRF is inclusive
3063 * @srf_bf: Bloom Filter
3064 * @srf_bf_len: Bloom Filter length
3065 * @srf_bf_idx: Bloom Filter index
3066 * @srf_macs: SRF MAC addresses
3067 * @srf_num_macs: number of MAC addresses in SRF
3068 * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
3069 * @tx_filters: filters that should be transmitted in the SDF.
3070 * @num_rx_filters: length of &rx_filters.
3071 * @num_tx_filters: length of &tx_filters.
3072 * @instance_id: driver allocated id of the function.
3073 * @cookie: unique NAN function identifier.
3075 struct cfg80211_nan_func {
3076 enum nl80211_nan_function_type type;
3077 u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
3081 bool subscribe_active;
3084 struct mac_address followup_dest;
3086 const u8 *serv_spec_info;
3087 u8 serv_spec_info_len;
3092 struct mac_address *srf_macs;
3094 struct cfg80211_nan_func_filter *rx_filters;
3095 struct cfg80211_nan_func_filter *tx_filters;
3103 * struct cfg80211_pmk_conf - PMK configuration
3105 * @aa: authenticator address
3106 * @pmk_len: PMK length in bytes.
3107 * @pmk: the PMK material
3108 * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
3109 * is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
3112 struct cfg80211_pmk_conf {
3116 const u8 *pmk_r0_name;
3120 * struct cfg80211_external_auth_params - Trigger External authentication.
3122 * Commonly used across the external auth request and event interfaces.
3124 * @action: action type / trigger for external authentication. Only significant
3125 * for the authentication request event interface (driver to user space).
3126 * @bssid: BSSID of the peer with which the authentication has
3127 * to happen. Used by both the authentication request event and
3128 * authentication response command interface.
3129 * @ssid: SSID of the AP. Used by both the authentication request event and
3130 * authentication response command interface.
3131 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
3132 * authentication request event interface.
3133 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
3134 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
3135 * the real status code for failures. Used only for the authentication
3136 * response command interface (user space to driver).
3137 * @pmkid: The identifier to refer a PMKSA.
3139 struct cfg80211_external_auth_params {
3140 enum nl80211_external_auth_action action;
3141 u8 bssid[ETH_ALEN] __aligned(2);
3142 struct cfg80211_ssid ssid;
3143 unsigned int key_mgmt_suite;
3149 * struct cfg80211_ftm_responder_stats - FTM responder statistics
3151 * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
3152 * indicate the relevant values in this struct for them
3153 * @success_num: number of FTM sessions in which all frames were successfully
3155 * @partial_num: number of FTM sessions in which part of frames were
3156 * successfully answered
3157 * @failed_num: number of failed FTM sessions
3158 * @asap_num: number of ASAP FTM sessions
3159 * @non_asap_num: number of non-ASAP FTM sessions
3160 * @total_duration_ms: total sessions durations - gives an indication
3161 * of how much time the responder was busy
3162 * @unknown_triggers_num: number of unknown FTM triggers - triggers from
3163 * initiators that didn't finish successfully the negotiation phase with
3165 * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
3166 * for a new scheduling although it already has scheduled FTM slot
3167 * @out_of_window_triggers_num: total FTM triggers out of scheduled window
3169 struct cfg80211_ftm_responder_stats {
3176 u64 total_duration_ms;
3177 u32 unknown_triggers_num;
3178 u32 reschedule_requests_num;
3179 u32 out_of_window_triggers_num;
3183 * struct cfg80211_pmsr_ftm_result - FTM result
3184 * @failure_reason: if this measurement failed (PMSR status is
3185 * %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
3186 * reason than just "failure"
3187 * @burst_index: if reporting partial results, this is the index
3188 * in [0 .. num_bursts-1] of the burst that's being reported
3189 * @num_ftmr_attempts: number of FTM request frames transmitted
3190 * @num_ftmr_successes: number of FTM request frames acked
3191 * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
3192 * fill this to indicate in how many seconds a retry is deemed possible
3194 * @num_bursts_exp: actual number of bursts exponent negotiated
3195 * @burst_duration: actual burst duration negotiated
3196 * @ftms_per_burst: actual FTMs per burst negotiated
3197 * @lci_len: length of LCI information (if present)
3198 * @civicloc_len: length of civic location information (if present)
3199 * @lci: LCI data (may be %NULL)
3200 * @civicloc: civic location data (may be %NULL)
3201 * @rssi_avg: average RSSI over FTM action frames reported
3202 * @rssi_spread: spread of the RSSI over FTM action frames reported
3203 * @tx_rate: bitrate for transmitted FTM action frame response
3204 * @rx_rate: bitrate of received FTM action frame
3205 * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
3206 * @rtt_variance: variance of RTTs measured (note that standard deviation is
3207 * the square root of the variance)
3208 * @rtt_spread: spread of the RTTs measured
3209 * @dist_avg: average of distances (mm) measured
3210 * (must have either this or @rtt_avg)
3211 * @dist_variance: variance of distances measured (see also @rtt_variance)
3212 * @dist_spread: spread of distances measured (see also @rtt_spread)
3213 * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
3214 * @num_ftmr_successes_valid: @num_ftmr_successes is valid
3215 * @rssi_avg_valid: @rssi_avg is valid
3216 * @rssi_spread_valid: @rssi_spread is valid
3217 * @tx_rate_valid: @tx_rate is valid
3218 * @rx_rate_valid: @rx_rate is valid
3219 * @rtt_avg_valid: @rtt_avg is valid
3220 * @rtt_variance_valid: @rtt_variance is valid
3221 * @rtt_spread_valid: @rtt_spread is valid
3222 * @dist_avg_valid: @dist_avg is valid
3223 * @dist_variance_valid: @dist_variance is valid
3224 * @dist_spread_valid: @dist_spread is valid
3226 struct cfg80211_pmsr_ftm_result {
3229 unsigned int lci_len;
3230 unsigned int civicloc_len;
3231 enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
3232 u32 num_ftmr_attempts, num_ftmr_successes;
3240 struct rate_info tx_rate, rx_rate;
3248 u16 num_ftmr_attempts_valid:1,
3249 num_ftmr_successes_valid:1,
3251 rssi_spread_valid:1,
3255 rtt_variance_valid:1,
3258 dist_variance_valid:1,
3259 dist_spread_valid:1;
3263 * struct cfg80211_pmsr_result - peer measurement result
3264 * @addr: address of the peer
3265 * @host_time: host time (use ktime_get_boottime() adjust to the time when the
3266 * measurement was made)
3267 * @ap_tsf: AP's TSF at measurement time
3268 * @status: status of the measurement
3269 * @final: if reporting partial results, mark this as the last one; if not
3270 * reporting partial results always set this flag
3271 * @ap_tsf_valid: indicates the @ap_tsf value is valid
3272 * @type: type of the measurement reported, note that we only support reporting
3273 * one type at a time, but you can report multiple results separately and
3274 * they're all aggregated for userspace.
3276 struct cfg80211_pmsr_result {
3277 u64 host_time, ap_tsf;
3278 enum nl80211_peer_measurement_status status;
3285 enum nl80211_peer_measurement_type type;
3288 struct cfg80211_pmsr_ftm_result ftm;
3293 * struct cfg80211_pmsr_ftm_request_peer - FTM request data
3294 * @requested: indicates FTM is requested
3295 * @preamble: frame preamble to use
3296 * @burst_period: burst period to use
3297 * @asap: indicates to use ASAP mode
3298 * @num_bursts_exp: number of bursts exponent
3299 * @burst_duration: burst duration
3300 * @ftms_per_burst: number of FTMs per burst
3301 * @ftmr_retries: number of retries for FTM request
3302 * @request_lci: request LCI information
3303 * @request_civicloc: request civic location information
3304 * @trigger_based: use trigger based ranging for the measurement
3305 * If neither @trigger_based nor @non_trigger_based is set,
3306 * EDCA based ranging will be used.
3307 * @non_trigger_based: use non trigger based ranging for the measurement
3308 * If neither @trigger_based nor @non_trigger_based is set,
3309 * EDCA based ranging will be used.
3311 * See also nl80211 for the respective attribute documentation.
3313 struct cfg80211_pmsr_ftm_request_peer {
3314 enum nl80211_preamble preamble;
3321 non_trigger_based:1;
3329 * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
3330 * @addr: MAC address
3331 * @chandef: channel to use
3332 * @report_ap_tsf: report the associated AP's TSF
3333 * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
3335 struct cfg80211_pmsr_request_peer {
3337 struct cfg80211_chan_def chandef;
3339 struct cfg80211_pmsr_ftm_request_peer ftm;
3343 * struct cfg80211_pmsr_request - peer measurement request
3344 * @cookie: cookie, set by cfg80211
3345 * @nl_portid: netlink portid - used by cfg80211
3346 * @drv_data: driver data for this request, if required for aborting,
3347 * not otherwise freed or anything by cfg80211
3348 * @mac_addr: MAC address used for (randomised) request
3349 * @mac_addr_mask: MAC address mask used for randomisation, bits that
3350 * are 0 in the mask should be randomised, bits that are 1 should
3351 * be taken from the @mac_addr
3352 * @list: used by cfg80211 to hold on to the request
3353 * @timeout: timeout (in milliseconds) for the whole operation, if
3354 * zero it means there's no timeout
3355 * @n_peers: number of peers to do measurements with
3356 * @peers: per-peer measurement request data
3358 struct cfg80211_pmsr_request {
3366 u8 mac_addr[ETH_ALEN] __aligned(2);
3367 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
3369 struct list_head list;
3371 struct cfg80211_pmsr_request_peer peers[];
3375 * struct cfg80211_update_owe_info - OWE Information
3377 * This structure provides information needed for the drivers to offload OWE
3378 * (Opportunistic Wireless Encryption) processing to the user space.
3380 * Commonly used across update_owe_info request and event interfaces.
3382 * @peer: MAC address of the peer device for which the OWE processing
3384 * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
3385 * processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
3386 * cannot give you the real status code for failures. Used only for
3387 * OWE update request command interface (user space to driver).
3388 * @ie: IEs obtained from the peer or constructed by the user space. These are
3389 * the IEs of the remote peer in the event from the host driver and
3390 * the constructed IEs by the user space in the request interface.
3391 * @ie_len: Length of IEs in octets.
3393 struct cfg80211_update_owe_info {
3394 u8 peer[ETH_ALEN] __aligned(2);
3401 * struct mgmt_frame_regs - management frame registrations data
3402 * @global_stypes: bitmap of management frame subtypes registered
3403 * for the entire device
3404 * @interface_stypes: bitmap of management frame subtypes registered
3405 * for the given interface
3406 * @global_mcast_rx: mcast RX is needed globally for these subtypes
3407 * @interface_mcast_stypes: mcast RX is needed on this interface
3408 * for these subtypes
3410 struct mgmt_frame_regs {
3411 u32 global_stypes, interface_stypes;
3412 u32 global_mcast_stypes, interface_mcast_stypes;
3416 * struct cfg80211_ops - backend description for wireless configuration
3418 * This struct is registered by fullmac card drivers and/or wireless stacks
3419 * in order to handle configuration requests on their interfaces.
3421 * All callbacks except where otherwise noted should return 0
3422 * on success or a negative error code.
3424 * All operations are currently invoked under rtnl for consistency with the
3425 * wireless extensions but this is subject to reevaluation as soon as this
3426 * code is used more widely and we have a first user without wext.
3428 * @suspend: wiphy device needs to be suspended. The variable @wow will
3429 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
3430 * configured for the device.
3431 * @resume: wiphy device needs to be resumed
3432 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
3433 * to call device_set_wakeup_enable() to enable/disable wakeup from
3436 * @add_virtual_intf: create a new virtual interface with the given name,
3437 * must set the struct wireless_dev's iftype. Beware: You must create
3438 * the new netdev in the wiphy's network namespace! Returns the struct
3439 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
3440 * also set the address member in the wdev.
3442 * @del_virtual_intf: remove the virtual interface
3444 * @change_virtual_intf: change type/configuration of virtual interface,
3445 * keep the struct wireless_dev's iftype updated.
3447 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
3448 * when adding a group key.
3450 * @get_key: get information about the key with the given parameters.
3451 * @mac_addr will be %NULL when requesting information for a group
3452 * key. All pointers given to the @callback function need not be valid
3453 * after it returns. This function should return an error if it is
3454 * not possible to retrieve the key, -ENOENT if it doesn't exist.
3456 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
3457 * and @key_index, return -ENOENT if the key doesn't exist.
3459 * @set_default_key: set the default key on an interface
3461 * @set_default_mgmt_key: set the default management frame key on an interface
3463 * @set_default_beacon_key: set the default Beacon frame key on an interface
3465 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
3467 * @start_ap: Start acting in AP mode defined by the parameters.
3468 * @change_beacon: Change the beacon parameters for an access point mode
3469 * interface. This should reject the call when AP mode wasn't started.
3470 * @stop_ap: Stop being an AP, including stopping beaconing.
3472 * @add_station: Add a new station.
3473 * @del_station: Remove a station
3474 * @change_station: Modify a given station. Note that flags changes are not much
3475 * validated in cfg80211, in particular the auth/assoc/authorized flags
3476 * might come to the driver in invalid combinations -- make sure to check
3477 * them, also against the existing state! Drivers must call
3478 * cfg80211_check_station_change() to validate the information.
3479 * @get_station: get station information for the station identified by @mac
3480 * @dump_station: dump station callback -- resume dump at index @idx
3482 * @add_mpath: add a fixed mesh path
3483 * @del_mpath: delete a given mesh path
3484 * @change_mpath: change a given mesh path
3485 * @get_mpath: get a mesh path for the given parameters
3486 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
3487 * @get_mpp: get a mesh proxy path for the given parameters
3488 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
3489 * @join_mesh: join the mesh network with the specified parameters
3490 * (invoked with the wireless_dev mutex held)
3491 * @leave_mesh: leave the current mesh network
3492 * (invoked with the wireless_dev mutex held)
3494 * @get_mesh_config: Get the current mesh configuration
3496 * @update_mesh_config: Update mesh parameters on a running mesh.
3497 * The mask is a bitfield which tells us which parameters to
3498 * set, and which to leave alone.
3500 * @change_bss: Modify parameters for a given BSS.
3502 * @set_txq_params: Set TX queue parameters
3504 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
3505 * as it doesn't implement join_mesh and needs to set the channel to
3506 * join the mesh instead.
3508 * @set_monitor_channel: Set the monitor mode channel for the device. If other
3509 * interfaces are active this callback should reject the configuration.
3510 * If no interfaces are active or the device is down, the channel should
3511 * be stored for when a monitor interface becomes active.
3513 * @scan: Request to do a scan. If returning zero, the scan request is given
3514 * the driver, and will be valid until passed to cfg80211_scan_done().
3515 * For scan results, call cfg80211_inform_bss(); you can call this outside
3516 * the scan/scan_done bracket too.
3517 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
3518 * indicate the status of the scan through cfg80211_scan_done().
3520 * @auth: Request to authenticate with the specified peer
3521 * (invoked with the wireless_dev mutex held)
3522 * @assoc: Request to (re)associate with the specified peer
3523 * (invoked with the wireless_dev mutex held)
3524 * @deauth: Request to deauthenticate from the specified peer
3525 * (invoked with the wireless_dev mutex held)
3526 * @disassoc: Request to disassociate from the specified peer
3527 * (invoked with the wireless_dev mutex held)
3529 * @connect: Connect to the ESS with the specified parameters. When connected,
3530 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
3531 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
3532 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
3533 * from the AP or cfg80211_connect_timeout() if no frame with status code
3535 * The driver is allowed to roam to other BSSes within the ESS when the
3536 * other BSS matches the connect parameters. When such roaming is initiated
3537 * by the driver, the driver is expected to verify that the target matches
3538 * the configured security parameters and to use Reassociation Request
3539 * frame instead of Association Request frame.
3540 * The connect function can also be used to request the driver to perform a
3541 * specific roam when connected to an ESS. In that case, the prev_bssid
3542 * parameter is set to the BSSID of the currently associated BSS as an
3543 * indication of requesting reassociation.
3544 * In both the driver-initiated and new connect() call initiated roaming
3545 * cases, the result of roaming is indicated with a call to
3546 * cfg80211_roamed(). (invoked with the wireless_dev mutex held)
3547 * @update_connect_params: Update the connect parameters while connected to a
3548 * BSS. The updated parameters can be used by driver/firmware for
3549 * subsequent BSS selection (roaming) decisions and to form the
3550 * Authentication/(Re)Association Request frames. This call does not
3551 * request an immediate disassociation or reassociation with the current
3552 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
3553 * changed are defined in &enum cfg80211_connect_params_changed.
3554 * (invoked with the wireless_dev mutex held)
3555 * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
3556 * connection is in progress. Once done, call cfg80211_disconnected() in
3557 * case connection was already established (invoked with the
3558 * wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
3560 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
3561 * cfg80211_ibss_joined(), also call that function when changing BSSID due
3563 * (invoked with the wireless_dev mutex held)
3564 * @leave_ibss: Leave the IBSS.
3565 * (invoked with the wireless_dev mutex held)
3567 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
3570 * @set_wiphy_params: Notify that wiphy parameters have changed;
3571 * @changed bitfield (see &enum wiphy_params_flags) describes which values
3572 * have changed. The actual parameter values are available in
3573 * struct wiphy. If returning an error, no value should be changed.
3575 * @set_tx_power: set the transmit power according to the parameters,
3576 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
3577 * wdev may be %NULL if power was set for the wiphy, and will
3578 * always be %NULL unless the driver supports per-vif TX power
3579 * (as advertised by the nl80211 feature flag.)
3580 * @get_tx_power: store the current TX power into the dbm variable;
3581 * return 0 if successful
3583 * @set_wds_peer: set the WDS peer for a WDS interface
3585 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
3586 * functions to adjust rfkill hw state
3588 * @dump_survey: get site survey information.
3590 * @remain_on_channel: Request the driver to remain awake on the specified
3591 * channel for the specified duration to complete an off-channel
3592 * operation (e.g., public action frame exchange). When the driver is
3593 * ready on the requested channel, it must indicate this with an event
3594 * notification by calling cfg80211_ready_on_channel().
3595 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
3596 * This allows the operation to be terminated prior to timeout based on
3597 * the duration value.
3598 * @mgmt_tx: Transmit a management frame.
3599 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
3600 * frame on another channel
3602 * @testmode_cmd: run a test mode command; @wdev may be %NULL
3603 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
3604 * used by the function, but 0 and 1 must not be touched. Additionally,
3605 * return error codes other than -ENOBUFS and -ENOENT will terminate the
3606 * dump and return to userspace with an error, so be careful. If any data
3607 * was passed in from userspace then the data/len arguments will be present
3608 * and point to the data contained in %NL80211_ATTR_TESTDATA.
3610 * @set_bitrate_mask: set the bitrate mask configuration
3612 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
3613 * devices running firmwares capable of generating the (re) association
3614 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
3615 * @del_pmksa: Delete a cached PMKID.
3616 * @flush_pmksa: Flush all cached PMKIDs.
3617 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
3618 * allows the driver to adjust the dynamic ps timeout value.
3619 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
3620 * After configuration, the driver should (soon) send an event indicating
3621 * the current level is above/below the configured threshold; this may
3622 * need some care when the configuration is changed (without first being
3624 * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
3625 * connection quality monitor. An event is to be sent only when the
3626 * signal level is found to be outside the two values. The driver should
3627 * set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
3628 * If it is provided then there's no point providing @set_cqm_rssi_config.
3629 * @set_cqm_txe_config: Configure connection quality monitor TX error
3631 * @sched_scan_start: Tell the driver to start a scheduled scan.
3632 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
3633 * given request id. This call must stop the scheduled scan and be ready
3634 * for starting a new one before it returns, i.e. @sched_scan_start may be
3635 * called immediately after that again and should not fail in that case.
3636 * The driver should not call cfg80211_sched_scan_stopped() for a requested
3637 * stop (when this method returns 0).
3639 * @update_mgmt_frame_registrations: Notify the driver that management frame
3640 * registrations were updated. The callback is allowed to sleep.
3642 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
3643 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
3644 * reject TX/RX mask combinations they cannot support by returning -EINVAL
3645 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
3647 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
3649 * @tdls_mgmt: Transmit a TDLS management frame.
3650 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
3652 * @probe_client: probe an associated client, must return a cookie that it
3653 * later passes to cfg80211_probe_status().
3655 * @set_noack_map: Set the NoAck Map for the TIDs.
3657 * @get_channel: Get the current operating channel for the virtual interface.
3658 * For monitor interfaces, it should return %NULL unless there's a single
3659 * current monitoring channel.
3661 * @start_p2p_device: Start the given P2P device.
3662 * @stop_p2p_device: Stop the given P2P device.
3664 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
3665 * Parameters include ACL policy, an array of MAC address of stations
3666 * and the number of MAC addresses. If there is already a list in driver
3667 * this new list replaces the existing one. Driver has to clear its ACL
3668 * when number of MAC addresses entries is passed as 0. Drivers which
3669 * advertise the support for MAC based ACL have to implement this callback.
3671 * @start_radar_detection: Start radar detection in the driver.
3673 * @end_cac: End running CAC, probably because a related CAC
3674 * was finished on another phy.
3676 * @update_ft_ies: Provide updated Fast BSS Transition information to the
3677 * driver. If the SME is in the driver/firmware, this information can be
3678 * used in building Authentication and Reassociation Request frames.
3680 * @crit_proto_start: Indicates a critical protocol needs more link reliability
3681 * for a given duration (milliseconds). The protocol is provided so the
3682 * driver can take the most appropriate actions.
3683 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
3684 * reliability. This operation can not fail.
3685 * @set_coalesce: Set coalesce parameters.
3687 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
3688 * responsible for veryfing if the switch is possible. Since this is
3689 * inherently tricky driver may decide to disconnect an interface later
3690 * with cfg80211_stop_iface(). This doesn't mean driver can accept
3691 * everything. It should do it's best to verify requests and reject them
3692 * as soon as possible.
3694 * @set_qos_map: Set QoS mapping information to the driver
3696 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
3697 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
3698 * changes during the lifetime of the BSS.
3700 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
3701 * with the given parameters; action frame exchange has been handled by
3702 * userspace so this just has to modify the TX path to take the TS into
3704 * If the admitted time is 0 just validate the parameters to make sure
3705 * the session can be created at all; it is valid to just always return
3706 * success for that but that may result in inefficient behaviour (handshake
3707 * with the peer followed by immediate teardown when the addition is later
3709 * @del_tx_ts: remove an existing TX TS
3711 * @join_ocb: join the OCB network with the specified parameters
3712 * (invoked with the wireless_dev mutex held)
3713 * @leave_ocb: leave the current OCB network
3714 * (invoked with the wireless_dev mutex held)
3716 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
3717 * is responsible for continually initiating channel-switching operations
3718 * and returning to the base channel for communication with the AP.
3719 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
3720 * peers must be on the base channel when the call completes.
3721 * @start_nan: Start the NAN interface.
3722 * @stop_nan: Stop the NAN interface.
3723 * @add_nan_func: Add a NAN function. Returns negative value on failure.
3724 * On success @nan_func ownership is transferred to the driver and
3725 * it may access it outside of the scope of this function. The driver
3726 * should free the @nan_func when no longer needed by calling
3727 * cfg80211_free_nan_func().
3728 * On success the driver should assign an instance_id in the
3729 * provided @nan_func.
3730 * @del_nan_func: Delete a NAN function.
3731 * @nan_change_conf: changes NAN configuration. The changed parameters must
3732 * be specified in @changes (using &enum cfg80211_nan_conf_changes);
3733 * All other parameters must be ignored.
3735 * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
3737 * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
3738 * function should return phy stats, and interface stats otherwise.
3740 * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
3741 * If not deleted through @del_pmk the PMK remains valid until disconnect
3742 * upon which the driver should clear it.
3743 * (invoked with the wireless_dev mutex held)
3744 * @del_pmk: delete the previously configured PMK for the given authenticator.
3745 * (invoked with the wireless_dev mutex held)
3747 * @external_auth: indicates result of offloaded authentication processing from
3750 * @tx_control_port: TX a control port frame (EAPoL). The noencrypt parameter
3751 * tells the driver that the frame should not be encrypted.
3753 * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
3754 * Statistics should be cumulative, currently no way to reset is provided.
3755 * @start_pmsr: start peer measurement (e.g. FTM)
3756 * @abort_pmsr: abort peer measurement
3758 * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
3759 * but offloading OWE processing to the user space will get the updated
3760 * DH IE through this interface.
3762 * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
3763 * and overrule HWMP path selection algorithm.
3764 * @set_tid_config: TID specific configuration, this can be peer or BSS specific
3765 * This callback may sleep.
3766 * @reset_tid_config: Reset TID specific configuration for the peer, for the
3767 * given TIDs. This callback may sleep.
3769 struct cfg80211_ops {
3770 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
3771 int (*resume)(struct wiphy *wiphy);
3772 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
3774 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
3776 unsigned char name_assign_type,
3777 enum nl80211_iftype type,
3778 struct vif_params *params);
3779 int (*del_virtual_intf)(struct wiphy *wiphy,
3780 struct wireless_dev *wdev);
3781 int (*change_virtual_intf)(struct wiphy *wiphy,
3782 struct net_device *dev,
3783 enum nl80211_iftype type,
3784 struct vif_params *params);
3786 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
3787 u8 key_index, bool pairwise, const u8 *mac_addr,
3788 struct key_params *params);
3789 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
3790 u8 key_index, bool pairwise, const u8 *mac_addr,
3792 void (*callback)(void *cookie, struct key_params*));
3793 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
3794 u8 key_index, bool pairwise, const u8 *mac_addr);
3795 int (*set_default_key)(struct wiphy *wiphy,
3796 struct net_device *netdev,
3797 u8 key_index, bool unicast, bool multicast);
3798 int (*set_default_mgmt_key)(struct wiphy *wiphy,
3799 struct net_device *netdev,
3801 int (*set_default_beacon_key)(struct wiphy *wiphy,
3802 struct net_device *netdev,
3805 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
3806 struct cfg80211_ap_settings *settings);
3807 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
3808 struct cfg80211_beacon_data *info);
3809 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
3812 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
3814 struct station_parameters *params);
3815 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
3816 struct station_del_parameters *params);
3817 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
3819 struct station_parameters *params);
3820 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
3821 const u8 *mac, struct station_info *sinfo);
3822 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
3823 int idx, u8 *mac, struct station_info *sinfo);
3825 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
3826 const u8 *dst, const u8 *next_hop);
3827 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
3829 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
3830 const u8 *dst, const u8 *next_hop);
3831 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
3832 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
3833 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
3834 int idx, u8 *dst, u8 *next_hop,
3835 struct mpath_info *pinfo);
3836 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
3837 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
3838 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
3839 int idx, u8 *dst, u8 *mpp,
3840 struct mpath_info *pinfo);
3841 int (*get_mesh_config)(struct wiphy *wiphy,
3842 struct net_device *dev,
3843 struct mesh_config *conf);
3844 int (*update_mesh_config)(struct wiphy *wiphy,
3845 struct net_device *dev, u32 mask,
3846 const struct mesh_config *nconf);
3847 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
3848 const struct mesh_config *conf,
3849 const struct mesh_setup *setup);
3850 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
3852 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
3853 struct ocb_setup *setup);
3854 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
3856 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
3857 struct bss_parameters *params);
3859 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
3860 struct ieee80211_txq_params *params);
3862 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
3863 struct net_device *dev,
3864 struct ieee80211_channel *chan);
3866 int (*set_monitor_channel)(struct wiphy *wiphy,
3867 struct cfg80211_chan_def *chandef);
3869 int (*scan)(struct wiphy *wiphy,
3870 struct cfg80211_scan_request *request);
3871 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
3873 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
3874 struct cfg80211_auth_request *req);
3875 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
3876 struct cfg80211_assoc_request *req);
3877 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
3878 struct cfg80211_deauth_request *req);
3879 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
3880 struct cfg80211_disassoc_request *req);
3882 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
3883 struct cfg80211_connect_params *sme);
3884 int (*update_connect_params)(struct wiphy *wiphy,
3885 struct net_device *dev,
3886 struct cfg80211_connect_params *sme,
3888 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
3891 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
3892 struct cfg80211_ibss_params *params);
3893 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
3895 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
3896 int rate[NUM_NL80211_BANDS]);
3898 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
3900 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3901 enum nl80211_tx_power_setting type, int mbm);
3902 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
3905 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
3908 void (*rfkill_poll)(struct wiphy *wiphy);
3910 #ifdef CONFIG_NL80211_TESTMODE
3911 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
3912 void *data, int len);
3913 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
3914 struct netlink_callback *cb,
3915 void *data, int len);
3918 int (*set_bitrate_mask)(struct wiphy *wiphy,
3919 struct net_device *dev,
3921 const struct cfg80211_bitrate_mask *mask);
3923 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
3924 int idx, struct survey_info *info);
3926 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
3927 struct cfg80211_pmksa *pmksa);
3928 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
3929 struct cfg80211_pmksa *pmksa);
3930 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
3932 int (*remain_on_channel)(struct wiphy *wiphy,
3933 struct wireless_dev *wdev,
3934 struct ieee80211_channel *chan,
3935 unsigned int duration,
3937 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
3938 struct wireless_dev *wdev,
3941 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
3942 struct cfg80211_mgmt_tx_params *params,
3944 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
3945 struct wireless_dev *wdev,
3948 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3949 bool enabled, int timeout);
3951 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
3952 struct net_device *dev,
3953 s32 rssi_thold, u32 rssi_hyst);
3955 int (*set_cqm_rssi_range_config)(struct wiphy *wiphy,
3956 struct net_device *dev,
3957 s32 rssi_low, s32 rssi_high);
3959 int (*set_cqm_txe_config)(struct wiphy *wiphy,
3960 struct net_device *dev,
3961 u32 rate, u32 pkts, u32 intvl);
3963 void (*update_mgmt_frame_registrations)(struct wiphy *wiphy,
3964 struct wireless_dev *wdev,
3965 struct mgmt_frame_regs *upd);
3967 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
3968 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
3970 int (*sched_scan_start)(struct wiphy *wiphy,
3971 struct net_device *dev,
3972 struct cfg80211_sched_scan_request *request);
3973 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
3976 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
3977 struct cfg80211_gtk_rekey_data *data);
3979 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
3980 const u8 *peer, u8 action_code, u8 dialog_token,
3981 u16 status_code, u32 peer_capability,
3982 bool initiator, const u8 *buf, size_t len);
3983 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
3984 const u8 *peer, enum nl80211_tdls_operation oper);
3986 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
3987 const u8 *peer, u64 *cookie);
3989 int (*set_noack_map)(struct wiphy *wiphy,
3990 struct net_device *dev,
3993 int (*get_channel)(struct wiphy *wiphy,
3994 struct wireless_dev *wdev,
3995 struct cfg80211_chan_def *chandef);
3997 int (*start_p2p_device)(struct wiphy *wiphy,
3998 struct wireless_dev *wdev);
3999 void (*stop_p2p_device)(struct wiphy *wiphy,
4000 struct wireless_dev *wdev);
4002 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
4003 const struct cfg80211_acl_data *params);
4005 int (*start_radar_detection)(struct wiphy *wiphy,
4006 struct net_device *dev,
4007 struct cfg80211_chan_def *chandef,
4009 void (*end_cac)(struct wiphy *wiphy,
4010 struct net_device *dev);
4011 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
4012 struct cfg80211_update_ft_ies_params *ftie);
4013 int (*crit_proto_start)(struct wiphy *wiphy,
4014 struct wireless_dev *wdev,
4015 enum nl80211_crit_proto_id protocol,
4017 void (*crit_proto_stop)(struct wiphy *wiphy,
4018 struct wireless_dev *wdev);
4019 int (*set_coalesce)(struct wiphy *wiphy,
4020 struct cfg80211_coalesce *coalesce);
4022 int (*channel_switch)(struct wiphy *wiphy,
4023 struct net_device *dev,
4024 struct cfg80211_csa_settings *params);
4026 int (*set_qos_map)(struct wiphy *wiphy,
4027 struct net_device *dev,
4028 struct cfg80211_qos_map *qos_map);
4030 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
4031 struct cfg80211_chan_def *chandef);
4033 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4034 u8 tsid, const u8 *peer, u8 user_prio,
4036 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
4037 u8 tsid, const u8 *peer);
4039 int (*tdls_channel_switch)(struct wiphy *wiphy,
4040 struct net_device *dev,
4041 const u8 *addr, u8 oper_class,
4042 struct cfg80211_chan_def *chandef);
4043 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
4044 struct net_device *dev,
4046 int (*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
4047 struct cfg80211_nan_conf *conf);
4048 void (*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
4049 int (*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4050 struct cfg80211_nan_func *nan_func);
4051 void (*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
4053 int (*nan_change_conf)(struct wiphy *wiphy,
4054 struct wireless_dev *wdev,
4055 struct cfg80211_nan_conf *conf,
4058 int (*set_multicast_to_unicast)(struct wiphy *wiphy,
4059 struct net_device *dev,
4060 const bool enabled);
4062 int (*get_txq_stats)(struct wiphy *wiphy,
4063 struct wireless_dev *wdev,
4064 struct cfg80211_txq_stats *txqstats);
4066 int (*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
4067 const struct cfg80211_pmk_conf *conf);
4068 int (*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
4070 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
4071 struct cfg80211_external_auth_params *params);
4073 int (*tx_control_port)(struct wiphy *wiphy,
4074 struct net_device *dev,
4075 const u8 *buf, size_t len,
4076 const u8 *dest, const __be16 proto,
4077 const bool noencrypt,
4080 int (*get_ftm_responder_stats)(struct wiphy *wiphy,
4081 struct net_device *dev,
4082 struct cfg80211_ftm_responder_stats *ftm_stats);
4084 int (*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4085 struct cfg80211_pmsr_request *request);
4086 void (*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
4087 struct cfg80211_pmsr_request *request);
4088 int (*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
4089 struct cfg80211_update_owe_info *owe_info);
4090 int (*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
4091 const u8 *buf, size_t len);
4092 int (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4093 struct cfg80211_tid_config *tid_conf);
4094 int (*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
4095 const u8 *peer, u8 tids);
4099 * wireless hardware and networking interfaces structures
4100 * and registration/helper functions
4104 * enum wiphy_flags - wiphy capability flags
4106 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
4108 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
4109 * by default -- this flag will be set depending on the kernel's default
4110 * on wiphy_new(), but can be changed by the driver if it has a good
4111 * reason to override the default
4112 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
4113 * on a VLAN interface). This flag also serves an extra purpose of
4114 * supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
4115 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
4116 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
4117 * control port protocol ethertype. The device also honours the
4118 * control_port_no_encrypt flag.
4119 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
4120 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
4121 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
4122 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
4124 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
4125 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
4126 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
4127 * link setup/discovery operations internally. Setup, discovery and
4128 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
4129 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
4130 * used for asking the driver/firmware to perform a TDLS operation.
4131 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
4132 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
4133 * when there are virtual interfaces in AP mode by calling
4134 * cfg80211_report_obss_beacon().
4135 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
4136 * responds to probe-requests in hardware.
4137 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
4138 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
4139 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
4140 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
4141 * beaconing mode (AP, IBSS, Mesh, ...).
4142 * @WIPHY_FLAG_HAS_STATIC_WEP: The device supports static WEP key installation
4143 * before connection.
4149 WIPHY_FLAG_NETNS_OK = BIT(3),
4150 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
4151 WIPHY_FLAG_4ADDR_AP = BIT(5),
4152 WIPHY_FLAG_4ADDR_STATION = BIT(6),
4153 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
4154 WIPHY_FLAG_IBSS_RSN = BIT(8),
4155 WIPHY_FLAG_MESH_AUTH = BIT(10),
4156 /* use hole at 11 */
4157 /* use hole at 12 */
4158 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
4159 WIPHY_FLAG_AP_UAPSD = BIT(14),
4160 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
4161 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
4162 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
4163 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
4164 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
4165 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
4166 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
4167 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
4168 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
4169 WIPHY_FLAG_HAS_STATIC_WEP = BIT(24),
4173 * struct ieee80211_iface_limit - limit on certain interface types
4174 * @max: maximum number of interfaces of these types
4175 * @types: interface types (bits)
4177 struct ieee80211_iface_limit {
4183 * struct ieee80211_iface_combination - possible interface combination
4185 * With this structure the driver can describe which interface
4186 * combinations it supports concurrently.
4190 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
4194 * struct ieee80211_iface_limit limits1[] = {
4195 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4196 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
4198 * struct ieee80211_iface_combination combination1 = {
4199 * .limits = limits1,
4200 * .n_limits = ARRAY_SIZE(limits1),
4201 * .max_interfaces = 2,
4202 * .beacon_int_infra_match = true,
4206 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
4210 * struct ieee80211_iface_limit limits2[] = {
4211 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
4212 * BIT(NL80211_IFTYPE_P2P_GO), },
4214 * struct ieee80211_iface_combination combination2 = {
4215 * .limits = limits2,
4216 * .n_limits = ARRAY_SIZE(limits2),
4217 * .max_interfaces = 8,
4218 * .num_different_channels = 1,
4222 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
4224 * This allows for an infrastructure connection and three P2P connections.
4228 * struct ieee80211_iface_limit limits3[] = {
4229 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
4230 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
4231 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
4233 * struct ieee80211_iface_combination combination3 = {
4234 * .limits = limits3,
4235 * .n_limits = ARRAY_SIZE(limits3),
4236 * .max_interfaces = 4,
4237 * .num_different_channels = 2,
4241 struct ieee80211_iface_combination {
4244 * limits for the given interface types
4246 const struct ieee80211_iface_limit *limits;
4249 * @num_different_channels:
4250 * can use up to this many different channels
4252 u32 num_different_channels;
4256 * maximum number of interfaces in total allowed in this group
4262 * number of limitations
4267 * @beacon_int_infra_match:
4268 * In this combination, the beacon intervals between infrastructure
4269 * and AP types must match. This is required only in special cases.
4271 bool beacon_int_infra_match;
4274 * @radar_detect_widths:
4275 * bitmap of channel widths supported for radar detection
4277 u8 radar_detect_widths;
4280 * @radar_detect_regions:
4281 * bitmap of regions supported for radar detection
4283 u8 radar_detect_regions;
4286 * @beacon_int_min_gcd:
4287 * This interface combination supports different beacon intervals.
4290 * all beacon intervals for different interface must be same.
4292 * any beacon interval for the interface part of this combination AND
4293 * GCD of all beacon intervals from beaconing interfaces of this
4294 * combination must be greater or equal to this value.
4296 u32 beacon_int_min_gcd;
4299 struct ieee80211_txrx_stypes {
4304 * enum wiphy_wowlan_support_flags - WoWLAN support flags
4305 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
4306 * trigger that keeps the device operating as-is and
4307 * wakes up the host on any activity, for example a
4308 * received packet that passed filtering; note that the
4309 * packet should be preserved in that case
4310 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
4312 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
4313 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
4314 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
4315 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
4316 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
4317 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
4318 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
4320 enum wiphy_wowlan_support_flags {
4321 WIPHY_WOWLAN_ANY = BIT(0),
4322 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
4323 WIPHY_WOWLAN_DISCONNECT = BIT(2),
4324 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
4325 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
4326 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
4327 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
4328 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
4329 WIPHY_WOWLAN_NET_DETECT = BIT(8),
4332 struct wiphy_wowlan_tcp_support {
4333 const struct nl80211_wowlan_tcp_data_token_feature *tok;
4334 u32 data_payload_max;
4335 u32 data_interval_max;
4336 u32 wake_payload_max;
4341 * struct wiphy_wowlan_support - WoWLAN support data
4342 * @flags: see &enum wiphy_wowlan_support_flags
4343 * @n_patterns: number of supported wakeup patterns
4344 * (see nl80211.h for the pattern definition)
4345 * @pattern_max_len: maximum length of each pattern
4346 * @pattern_min_len: minimum length of each pattern
4347 * @max_pkt_offset: maximum Rx packet offset
4348 * @max_nd_match_sets: maximum number of matchsets for net-detect,
4349 * similar, but not necessarily identical, to max_match_sets for
4351 * See &struct cfg80211_sched_scan_request.@match_sets for more
4353 * @tcp: TCP wakeup support information
4355 struct wiphy_wowlan_support {
4358 int pattern_max_len;
4359 int pattern_min_len;
4361 int max_nd_match_sets;
4362 const struct wiphy_wowlan_tcp_support *tcp;
4366 * struct wiphy_coalesce_support - coalesce support data
4367 * @n_rules: maximum number of coalesce rules
4368 * @max_delay: maximum supported coalescing delay in msecs
4369 * @n_patterns: number of supported patterns in a rule
4370 * (see nl80211.h for the pattern definition)
4371 * @pattern_max_len: maximum length of each pattern
4372 * @pattern_min_len: minimum length of each pattern
4373 * @max_pkt_offset: maximum Rx packet offset
4375 struct wiphy_coalesce_support {
4379 int pattern_max_len;
4380 int pattern_min_len;
4385 * enum wiphy_vendor_command_flags - validation flags for vendor commands
4386 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
4387 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
4388 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
4389 * (must be combined with %_WDEV or %_NETDEV)
4391 enum wiphy_vendor_command_flags {
4392 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
4393 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
4394 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
4398 * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
4400 * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
4401 * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
4402 * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
4405 enum wiphy_opmode_flag {
4406 STA_OPMODE_MAX_BW_CHANGED = BIT(0),
4407 STA_OPMODE_SMPS_MODE_CHANGED = BIT(1),
4408 STA_OPMODE_N_SS_CHANGED = BIT(2),
4412 * struct sta_opmode_info - Station's ht/vht operation mode information
4413 * @changed: contains value from &enum wiphy_opmode_flag
4414 * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
4415 * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
4416 * @rx_nss: new rx_nss value of a station
4419 struct sta_opmode_info {
4421 enum nl80211_smps_mode smps_mode;
4422 enum nl80211_chan_width bw;
4426 #define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
4429 * struct wiphy_vendor_command - vendor command definition
4430 * @info: vendor command identifying information, as used in nl80211
4431 * @flags: flags, see &enum wiphy_vendor_command_flags
4432 * @doit: callback for the operation, note that wdev is %NULL if the
4433 * flags didn't ask for a wdev and non-%NULL otherwise; the data
4434 * pointer may be %NULL if userspace provided no data at all
4435 * @dumpit: dump callback, for transferring bigger/multiple items. The
4436 * @storage points to cb->args[5], ie. is preserved over the multiple
4438 * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
4439 * Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
4440 * attribute is just raw data (e.g. a firmware command).
4441 * @maxattr: highest attribute number in policy
4442 * It's recommended to not have the same sub command with both @doit and
4443 * @dumpit, so that userspace can assume certain ones are get and others
4444 * are used with dump requests.
4446 struct wiphy_vendor_command {
4447 struct nl80211_vendor_cmd_info info;
4449 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4450 const void *data, int data_len);
4451 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
4452 struct sk_buff *skb, const void *data, int data_len,
4453 unsigned long *storage);
4454 const struct nla_policy *policy;
4455 unsigned int maxattr;
4459 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
4460 * @iftype: interface type
4461 * @extended_capabilities: extended capabilities supported by the driver,
4462 * additional capabilities might be supported by userspace; these are the
4463 * 802.11 extended capabilities ("Extended Capabilities element") and are
4464 * in the same format as in the information element. See IEEE Std
4465 * 802.11-2012 8.4.2.29 for the defined fields.
4466 * @extended_capabilities_mask: mask of the valid values
4467 * @extended_capabilities_len: length of the extended capabilities
4469 struct wiphy_iftype_ext_capab {
4470 enum nl80211_iftype iftype;
4471 const u8 *extended_capabilities;
4472 const u8 *extended_capabilities_mask;
4473 u8 extended_capabilities_len;
4477 * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
4478 * @max_peers: maximum number of peers in a single measurement
4479 * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
4480 * @randomize_mac_addr: can randomize MAC address for measurement
4481 * @ftm.supported: FTM measurement is supported
4482 * @ftm.asap: ASAP-mode is supported
4483 * @ftm.non_asap: non-ASAP-mode is supported
4484 * @ftm.request_lci: can request LCI data
4485 * @ftm.request_civicloc: can request civic location data
4486 * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
4487 * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
4488 * @ftm.max_bursts_exponent: maximum burst exponent supported
4489 * (set to -1 if not limited; note that setting this will necessarily
4490 * forbid using the value 15 to let the responder pick)
4491 * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
4493 * @ftm.trigger_based: trigger based ranging measurement is supported
4494 * @ftm.non_trigger_based: non trigger based ranging measurement is supported
4496 struct cfg80211_pmsr_capabilities {
4497 unsigned int max_peers;
4499 randomize_mac_addr:1;
4504 s8 max_bursts_exponent;
4505 u8 max_ftms_per_burst;
4512 non_trigger_based:1;
4517 * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
4518 * suites for interface types defined in @iftypes_mask. Each type in the
4519 * @iftypes_mask must be unique across all instances of iftype_akm_suites.
4521 * @iftypes_mask: bitmask of interfaces types
4522 * @akm_suites: points to an array of supported akm suites
4523 * @n_akm_suites: number of supported AKM suites
4525 struct wiphy_iftype_akm_suites {
4527 const u32 *akm_suites;
4532 * struct wiphy - wireless hardware description
4533 * @reg_notifier: the driver's regulatory notification callback,
4534 * note that if your driver uses wiphy_apply_custom_regulatory()
4535 * the reg_notifier's request can be passed as NULL
4536 * @regd: the driver's regulatory domain, if one was requested via
4537 * the regulatory_hint() API. This can be used by the driver
4538 * on the reg_notifier() if it chooses to ignore future
4539 * regulatory domain changes caused by other drivers.
4540 * @signal_type: signal type reported in &struct cfg80211_bss.
4541 * @cipher_suites: supported cipher suites
4542 * @n_cipher_suites: number of supported cipher suites
4543 * @akm_suites: supported AKM suites. These are the default AKMs supported if
4544 * the supported AKMs not advertized for a specific interface type in
4545 * iftype_akm_suites.
4546 * @n_akm_suites: number of supported AKM suites
4547 * @iftype_akm_suites: array of supported akm suites info per interface type.
4548 * Note that the bits in @iftypes_mask inside this structure cannot
4549 * overlap (i.e. only one occurrence of each type is allowed across all
4550 * instances of iftype_akm_suites).
4551 * @num_iftype_akm_suites: number of interface types for which supported akm
4552 * suites are specified separately.
4553 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
4554 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
4555 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
4556 * -1 = fragmentation disabled, only odd values >= 256 used
4557 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
4558 * @_net: the network namespace this wiphy currently lives in
4559 * @perm_addr: permanent MAC address of this device
4560 * @addr_mask: If the device supports multiple MAC addresses by masking,
4561 * set this to a mask with variable bits set to 1, e.g. if the last
4562 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
4563 * variable bits shall be determined by the interfaces added, with
4564 * interfaces not matching the mask being rejected to be brought up.
4565 * @n_addresses: number of addresses in @addresses.
4566 * @addresses: If the device has more than one address, set this pointer
4567 * to a list of addresses (6 bytes each). The first one will be used
4568 * by default for perm_addr. In this case, the mask should be set to
4569 * all-zeroes. In this case it is assumed that the device can handle
4570 * the same number of arbitrary MAC addresses.
4571 * @registered: protects ->resume and ->suspend sysfs callbacks against
4572 * unregister hardware
4573 * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
4574 * It will be renamed automatically on wiphy renames
4575 * @dev: (virtual) struct device for this wiphy. The item in
4576 * /sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
4578 * @wext: wireless extension handlers
4579 * @priv: driver private data (sized according to wiphy_new() parameter)
4580 * @interface_modes: bitmask of interfaces types valid for this wiphy,
4581 * must be set by driver
4582 * @iface_combinations: Valid interface combinations array, should not
4583 * list single interface types.
4584 * @n_iface_combinations: number of entries in @iface_combinations array.
4585 * @software_iftypes: bitmask of software interface types, these are not
4586 * subject to any restrictions since they are purely managed in SW.
4587 * @flags: wiphy flags, see &enum wiphy_flags
4588 * @regulatory_flags: wiphy regulatory flags, see
4589 * &enum ieee80211_regulatory_flags
4590 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
4591 * @ext_features: extended features advertised to nl80211, see
4592 * &enum nl80211_ext_feature_index.
4593 * @bss_priv_size: each BSS struct has private data allocated with it,
4594 * this variable determines its size
4595 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
4597 * @max_sched_scan_reqs: maximum number of scheduled scan requests that
4598 * the device can run concurrently.
4599 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
4600 * for in any given scheduled scan
4601 * @max_match_sets: maximum number of match sets the device can handle
4602 * when performing a scheduled scan, 0 if filtering is not
4604 * @max_scan_ie_len: maximum length of user-controlled IEs device can
4605 * add to probe request frames transmitted during a scan, must not
4606 * include fixed IEs like supported rates
4607 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
4609 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
4610 * of iterations) for scheduled scan supported by the device.
4611 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
4612 * single scan plan supported by the device.
4613 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
4614 * scan plan supported by the device.
4615 * @coverage_class: current coverage class
4616 * @fw_version: firmware version for ethtool reporting
4617 * @hw_version: hardware version for ethtool reporting
4618 * @max_num_pmkids: maximum number of PMKIDs supported by device
4619 * @privid: a pointer that drivers can use to identify if an arbitrary
4620 * wiphy is theirs, e.g. in global notifiers
4621 * @bands: information about bands/channels supported by this device
4623 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
4624 * transmitted through nl80211, points to an array indexed by interface
4627 * @available_antennas_tx: bitmap of antennas which are available to be
4628 * configured as TX antennas. Antenna configuration commands will be
4629 * rejected unless this or @available_antennas_rx is set.
4631 * @available_antennas_rx: bitmap of antennas which are available to be
4632 * configured as RX antennas. Antenna configuration commands will be
4633 * rejected unless this or @available_antennas_tx is set.
4635 * @probe_resp_offload:
4636 * Bitmap of supported protocols for probe response offloading.
4637 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
4638 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
4640 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
4641 * may request, if implemented.
4643 * @wowlan: WoWLAN support information
4644 * @wowlan_config: current WoWLAN configuration; this should usually not be
4645 * used since access to it is necessarily racy, use the parameter passed
4646 * to the suspend() operation instead.
4648 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
4649 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
4650 * If null, then none can be over-ridden.
4651 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
4652 * If null, then none can be over-ridden.
4654 * @wdev_list: the list of associated (virtual) interfaces; this list must
4655 * not be modified by the driver, but can be read with RTNL/RCU protection.
4657 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
4660 * @extended_capabilities: extended capabilities supported by the driver,
4661 * additional capabilities might be supported by userspace; these are
4662 * the 802.11 extended capabilities ("Extended Capabilities element")
4663 * and are in the same format as in the information element. See
4664 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
4665 * extended capabilities to be used if the capabilities are not specified
4666 * for a specific interface type in iftype_ext_capab.
4667 * @extended_capabilities_mask: mask of the valid values
4668 * @extended_capabilities_len: length of the extended capabilities
4669 * @iftype_ext_capab: array of extended capabilities per interface type
4670 * @num_iftype_ext_capab: number of interface types for which extended
4671 * capabilities are specified separately.
4672 * @coalesce: packet coalescing support information
4674 * @vendor_commands: array of vendor commands supported by the hardware
4675 * @n_vendor_commands: number of vendor commands
4676 * @vendor_events: array of vendor events supported by the hardware
4677 * @n_vendor_events: number of vendor events
4679 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
4680 * (including P2P GO) or 0 to indicate no such limit is advertised. The
4681 * driver is allowed to advertise a theoretical limit that it can reach in
4682 * some cases, but may not always reach.
4684 * @max_num_csa_counters: Number of supported csa_counters in beacons
4685 * and probe responses. This value should be set if the driver
4686 * wishes to limit the number of csa counters. Default (0) means
4688 * @bss_select_support: bitmask indicating the BSS selection criteria supported
4689 * by the driver in the .connect() callback. The bit position maps to the
4690 * attribute indices defined in &enum nl80211_bss_select_attr.
4692 * @nan_supported_bands: bands supported by the device in NAN mode, a
4693 * bitmap of &enum nl80211_band values. For instance, for
4694 * NL80211_BAND_2GHZ, bit 0 would be set
4695 * (i.e. BIT(NL80211_BAND_2GHZ)).
4697 * @txq_limit: configuration of internal TX queue frame limit
4698 * @txq_memory_limit: configuration internal TX queue memory limit
4699 * @txq_quantum: configuration of internal TX queue scheduler quantum
4701 * @tx_queue_len: allow setting transmit queue len for drivers not using
4704 * @support_mbssid: can HW support association with nontransmitted AP
4705 * @support_only_he_mbssid: don't parse MBSSID elements if it is not
4706 * HE AP, in order to avoid compatibility issues.
4707 * @support_mbssid must be set for this to have any effect.
4709 * @pmsr_capa: peer measurement capabilities
4711 * @tid_config_support: describes the per-TID config support that the
4713 * @tid_config_support.vif: bitmap of attributes (configurations)
4714 * supported by the driver for each vif
4715 * @tid_config_support.peer: bitmap of attributes (configurations)
4716 * supported by the driver for each peer
4717 * @tid_config_support.max_retry: maximum supported retry count for
4718 * long/short retry configuration
4720 * @max_data_retry_count: maximum supported per TID retry count for
4721 * configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
4722 * %NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
4725 /* assign these fields before you register the wiphy */
4727 u8 perm_addr[ETH_ALEN];
4728 u8 addr_mask[ETH_ALEN];
4730 struct mac_address *addresses;
4732 const struct ieee80211_txrx_stypes *mgmt_stypes;
4734 const struct ieee80211_iface_combination *iface_combinations;
4735 int n_iface_combinations;
4736 u16 software_iftypes;
4740 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
4741 u16 interface_modes;
4743 u16 max_acl_mac_addrs;
4745 u32 flags, regulatory_flags, features;
4746 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
4750 enum cfg80211_signal_type signal_type;
4754 u8 max_sched_scan_reqs;
4755 u8 max_sched_scan_ssids;
4757 u16 max_scan_ie_len;
4758 u16 max_sched_scan_ie_len;
4759 u32 max_sched_scan_plans;
4760 u32 max_sched_scan_plan_interval;
4761 u32 max_sched_scan_plan_iterations;
4763 int n_cipher_suites;
4764 const u32 *cipher_suites;
4767 const u32 *akm_suites;
4769 const struct wiphy_iftype_akm_suites *iftype_akm_suites;
4770 unsigned int num_iftype_akm_suites;
4778 char fw_version[ETHTOOL_FWVERS_LEN];
4782 const struct wiphy_wowlan_support *wowlan;
4783 struct cfg80211_wowlan *wowlan_config;
4786 u16 max_remain_on_channel_duration;
4790 u32 available_antennas_tx;
4791 u32 available_antennas_rx;
4793 u32 probe_resp_offload;
4795 const u8 *extended_capabilities, *extended_capabilities_mask;
4796 u8 extended_capabilities_len;
4798 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
4799 unsigned int num_iftype_ext_capab;
4803 struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
4805 void (*reg_notifier)(struct wiphy *wiphy,
4806 struct regulatory_request *request);
4808 /* fields below are read-only, assigned by cfg80211 */
4810 const struct ieee80211_regdomain __rcu *regd;
4816 struct dentry *debugfsdir;
4818 const struct ieee80211_ht_cap *ht_capa_mod_mask;
4819 const struct ieee80211_vht_cap *vht_capa_mod_mask;
4821 struct list_head wdev_list;
4823 possible_net_t _net;
4825 #ifdef CONFIG_CFG80211_WEXT
4826 const struct iw_handler_def *wext;
4829 const struct wiphy_coalesce_support *coalesce;
4831 const struct wiphy_vendor_command *vendor_commands;
4832 const struct nl80211_vendor_cmd_info *vendor_events;
4833 int n_vendor_commands, n_vendor_events;
4835 u16 max_ap_assoc_sta;
4837 u8 max_num_csa_counters;
4839 u32 bss_select_support;
4841 u8 nan_supported_bands;
4844 u32 txq_memory_limit;
4847 unsigned long tx_queue_len;
4849 u8 support_mbssid:1,
4850 support_only_he_mbssid:1;
4852 const struct cfg80211_pmsr_capabilities *pmsr_capa;
4857 } tid_config_support;
4859 u8 max_data_retry_count;
4861 char priv[] __aligned(NETDEV_ALIGN);
4864 static inline struct net *wiphy_net(struct wiphy *wiphy)
4866 return read_pnet(&wiphy->_net);
4869 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
4871 write_pnet(&wiphy->_net, net);
4875 * wiphy_priv - return priv from wiphy
4877 * @wiphy: the wiphy whose priv pointer to return
4878 * Return: The priv of @wiphy.
4880 static inline void *wiphy_priv(struct wiphy *wiphy)
4883 return &wiphy->priv;
4887 * priv_to_wiphy - return the wiphy containing the priv
4889 * @priv: a pointer previously returned by wiphy_priv
4890 * Return: The wiphy of @priv.
4892 static inline struct wiphy *priv_to_wiphy(void *priv)
4895 return container_of(priv, struct wiphy, priv);
4899 * set_wiphy_dev - set device pointer for wiphy
4901 * @wiphy: The wiphy whose device to bind
4902 * @dev: The device to parent it to
4904 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
4906 wiphy->dev.parent = dev;
4910 * wiphy_dev - get wiphy dev pointer
4912 * @wiphy: The wiphy whose device struct to look up
4913 * Return: The dev of @wiphy.
4915 static inline struct device *wiphy_dev(struct wiphy *wiphy)
4917 return wiphy->dev.parent;
4921 * wiphy_name - get wiphy name
4923 * @wiphy: The wiphy whose name to return
4924 * Return: The name of @wiphy.
4926 static inline const char *wiphy_name(const struct wiphy *wiphy)
4928 return dev_name(&wiphy->dev);
4932 * wiphy_new_nm - create a new wiphy for use with cfg80211
4934 * @ops: The configuration operations for this device
4935 * @sizeof_priv: The size of the private area to allocate
4936 * @requested_name: Request a particular name.
4937 * NULL is valid value, and means use the default phy%d naming.
4939 * Create a new wiphy and associate the given operations with it.
4940 * @sizeof_priv bytes are allocated for private use.
4942 * Return: A pointer to the new wiphy. This pointer must be
4943 * assigned to each netdev's ieee80211_ptr for proper operation.
4945 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
4946 const char *requested_name);
4949 * wiphy_new - create a new wiphy for use with cfg80211
4951 * @ops: The configuration operations for this device
4952 * @sizeof_priv: The size of the private area to allocate
4954 * Create a new wiphy and associate the given operations with it.
4955 * @sizeof_priv bytes are allocated for private use.
4957 * Return: A pointer to the new wiphy. This pointer must be
4958 * assigned to each netdev's ieee80211_ptr for proper operation.
4960 static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
4963 return wiphy_new_nm(ops, sizeof_priv, NULL);
4967 * wiphy_register - register a wiphy with cfg80211
4969 * @wiphy: The wiphy to register.
4971 * Return: A non-negative wiphy index or a negative error code.
4973 int wiphy_register(struct wiphy *wiphy);
4976 * wiphy_unregister - deregister a wiphy from cfg80211
4978 * @wiphy: The wiphy to unregister.
4980 * After this call, no more requests can be made with this priv
4981 * pointer, but the call may sleep to wait for an outstanding
4982 * request that is being handled.
4984 void wiphy_unregister(struct wiphy *wiphy);
4987 * wiphy_free - free wiphy
4989 * @wiphy: The wiphy to free
4991 void wiphy_free(struct wiphy *wiphy);
4993 /* internal structs */
4994 struct cfg80211_conn;
4995 struct cfg80211_internal_bss;
4996 struct cfg80211_cached_keys;
4997 struct cfg80211_cqm_config;
5000 * struct wireless_dev - wireless device state
5002 * For netdevs, this structure must be allocated by the driver
5003 * that uses the ieee80211_ptr field in struct net_device (this
5004 * is intentional so it can be allocated along with the netdev.)
5005 * It need not be registered then as netdev registration will
5006 * be intercepted by cfg80211 to see the new wireless device.
5008 * For non-netdev uses, it must also be allocated by the driver
5009 * in response to the cfg80211 callbacks that require it, as
5010 * there's no netdev registration in that case it may not be
5011 * allocated outside of callback operations that return it.
5013 * @wiphy: pointer to hardware description
5014 * @iftype: interface type
5015 * @list: (private) Used to collect the interfaces
5016 * @netdev: (private) Used to reference back to the netdev, may be %NULL
5017 * @identifier: (private) Identifier used in nl80211 to identify this
5018 * wireless device if it has no netdev
5019 * @current_bss: (private) Used by the internal configuration code
5020 * @chandef: (private) Used by the internal configuration code to track
5021 * the user-set channel definition.
5022 * @preset_chandef: (private) Used by the internal configuration code to
5023 * track the channel to be used for AP later
5024 * @bssid: (private) Used by the internal configuration code
5025 * @ssid: (private) Used by the internal configuration code
5026 * @ssid_len: (private) Used by the internal configuration code
5027 * @mesh_id_len: (private) Used by the internal configuration code
5028 * @mesh_id_up_len: (private) Used by the internal configuration code
5029 * @wext: (private) Used by the internal wireless extensions compat code
5030 * @wext.ibss: (private) IBSS data part of wext handling
5031 * @wext.connect: (private) connection handling data
5032 * @wext.keys: (private) (WEP) key data
5033 * @wext.ie: (private) extra elements for association
5034 * @wext.ie_len: (private) length of extra elements
5035 * @wext.bssid: (private) selected network BSSID
5036 * @wext.ssid: (private) selected network SSID
5037 * @wext.default_key: (private) selected default key index
5038 * @wext.default_mgmt_key: (private) selected default management key index
5039 * @wext.prev_bssid: (private) previous BSSID for reassociation
5040 * @wext.prev_bssid_valid: (private) previous BSSID validity
5041 * @use_4addr: indicates 4addr mode is used on this interface, must be
5042 * set by driver (if supported) on add_interface BEFORE registering the
5043 * netdev and may otherwise be used by driver read-only, will be update
5044 * by cfg80211 on change_interface
5045 * @mgmt_registrations: list of registrations for management frames
5046 * @mgmt_registrations_lock: lock for the list
5047 * @mgmt_registrations_update_wk: update work to defer from atomic context
5048 * @mtx: mutex used to lock data in this struct, may be used by drivers
5049 * and some API functions require it held
5050 * @beacon_interval: beacon interval used on this device for transmitting
5051 * beacons, 0 when not valid
5052 * @address: The address for this device, valid only if @netdev is %NULL
5053 * @is_running: true if this is a non-netdev device that has been started, e.g.
5055 * @cac_started: true if DFS channel availability check has been started
5056 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
5057 * @cac_time_ms: CAC time in ms
5058 * @ps: powersave mode is enabled
5059 * @ps_timeout: dynamic powersave timeout
5060 * @ap_unexpected_nlportid: (private) netlink port ID of application
5061 * registered for unexpected class 3 frames (AP mode)
5062 * @conn: (private) cfg80211 software SME connection state machine data
5063 * @connect_keys: (private) keys to set after connection is established
5064 * @conn_bss_type: connecting/connected BSS type
5065 * @conn_owner_nlportid: (private) connection owner socket port ID
5066 * @disconnect_wk: (private) auto-disconnect work
5067 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
5068 * @ibss_fixed: (private) IBSS is using fixed BSSID
5069 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
5070 * @event_list: (private) list for internal event processing
5071 * @event_lock: (private) lock for event list
5072 * @owner_nlportid: (private) owner socket port ID
5073 * @nl_owner_dead: (private) owner socket went away
5074 * @cqm_config: (private) nl80211 RSSI monitor state
5075 * @pmsr_list: (private) peer measurement requests
5076 * @pmsr_lock: (private) peer measurements requests/results lock
5077 * @pmsr_free_wk: (private) peer measurements cleanup work
5078 * @unprot_beacon_reported: (private) timestamp of last
5079 * unprotected beacon report
5081 struct wireless_dev {
5082 struct wiphy *wiphy;
5083 enum nl80211_iftype iftype;
5085 /* the remainder of this struct should be private to cfg80211 */
5086 struct list_head list;
5087 struct net_device *netdev;
5091 struct list_head mgmt_registrations;
5092 spinlock_t mgmt_registrations_lock;
5093 struct work_struct mgmt_registrations_update_wk;
5097 bool use_4addr, is_running;
5099 u8 address[ETH_ALEN] __aligned(sizeof(u16));
5101 /* currently used for IBSS and SME - might be rearranged later */
5102 u8 ssid[IEEE80211_MAX_SSID_LEN];
5103 u8 ssid_len, mesh_id_len, mesh_id_up_len;
5104 struct cfg80211_conn *conn;
5105 struct cfg80211_cached_keys *connect_keys;
5106 enum ieee80211_bss_type conn_bss_type;
5107 u32 conn_owner_nlportid;
5109 struct work_struct disconnect_wk;
5110 u8 disconnect_bssid[ETH_ALEN];
5112 struct list_head event_list;
5113 spinlock_t event_lock;
5115 struct cfg80211_internal_bss *current_bss; /* associated / joined */
5116 struct cfg80211_chan_def preset_chandef;
5117 struct cfg80211_chan_def chandef;
5120 bool ibss_dfs_possible;
5125 int beacon_interval;
5127 u32 ap_unexpected_nlportid;
5133 unsigned long cac_start_time;
5134 unsigned int cac_time_ms;
5136 #ifdef CONFIG_CFG80211_WEXT
5139 struct cfg80211_ibss_params ibss;
5140 struct cfg80211_connect_params connect;
5141 struct cfg80211_cached_keys *keys;
5145 u8 prev_bssid[ETH_ALEN];
5146 u8 ssid[IEEE80211_MAX_SSID_LEN];
5147 s8 default_key, default_mgmt_key;
5148 bool prev_bssid_valid;
5152 struct cfg80211_cqm_config *cqm_config;
5154 struct list_head pmsr_list;
5155 spinlock_t pmsr_lock;
5156 struct work_struct pmsr_free_wk;
5158 unsigned long unprot_beacon_reported;
5161 static inline u8 *wdev_address(struct wireless_dev *wdev)
5164 return wdev->netdev->dev_addr;
5165 return wdev->address;
5168 static inline bool wdev_running(struct wireless_dev *wdev)
5171 return netif_running(wdev->netdev);
5172 return wdev->is_running;
5176 * wdev_priv - return wiphy priv from wireless_dev
5178 * @wdev: The wireless device whose wiphy's priv pointer to return
5179 * Return: The wiphy priv of @wdev.
5181 static inline void *wdev_priv(struct wireless_dev *wdev)
5184 return wiphy_priv(wdev->wiphy);
5188 * DOC: Utility functions
5190 * cfg80211 offers a number of utility functions that can be useful.
5194 * ieee80211_channel_equal - compare two struct ieee80211_channel
5196 * @a: 1st struct ieee80211_channel
5197 * @b: 2nd struct ieee80211_channel
5198 * Return: true if center frequency of @a == @b
5201 ieee80211_channel_equal(struct ieee80211_channel *a,
5202 struct ieee80211_channel *b)
5204 return (a->center_freq == b->center_freq &&
5205 a->freq_offset == b->freq_offset);
5209 * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
5210 * @chan: struct ieee80211_channel to convert
5211 * Return: The corresponding frequency (in KHz)
5214 ieee80211_channel_to_khz(const struct ieee80211_channel *chan)
5216 return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
5220 * ieee80211_channel_to_freq_khz - convert channel number to frequency
5221 * @chan: channel number
5222 * @band: band, necessary due to channel number overlap
5223 * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
5225 u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
5228 * ieee80211_channel_to_frequency - convert channel number to frequency
5229 * @chan: channel number
5230 * @band: band, necessary due to channel number overlap
5231 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
5234 ieee80211_channel_to_frequency(int chan, enum nl80211_band band)
5236 return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
5240 * ieee80211_freq_khz_to_channel - convert frequency to channel number
5241 * @freq: center frequency in KHz
5242 * Return: The corresponding channel, or 0 if the conversion failed.
5244 int ieee80211_freq_khz_to_channel(u32 freq);
5247 * ieee80211_frequency_to_channel - convert frequency to channel number
5248 * @freq: center frequency in MHz
5249 * Return: The corresponding channel, or 0 if the conversion failed.
5252 ieee80211_frequency_to_channel(int freq)
5254 return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
5258 * ieee80211_get_channel_khz - get channel struct from wiphy for specified
5260 * @wiphy: the struct wiphy to get the channel for
5261 * @freq: the center frequency (in KHz) of the channel
5262 * Return: The channel struct from @wiphy at @freq.
5264 struct ieee80211_channel *
5265 ieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
5268 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
5270 * @wiphy: the struct wiphy to get the channel for
5271 * @freq: the center frequency (in MHz) of the channel
5272 * Return: The channel struct from @wiphy at @freq.
5274 static inline struct ieee80211_channel *
5275 ieee80211_get_channel(struct wiphy *wiphy, int freq)
5277 return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
5281 * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
5282 * @chan: control channel to check
5284 * The Preferred Scanning Channels (PSC) are defined in
5285 * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
5287 static inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
5289 if (chan->band != NL80211_BAND_6GHZ)
5292 return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
5296 * ieee80211_get_response_rate - get basic rate for a given rate
5298 * @sband: the band to look for rates in
5299 * @basic_rates: bitmap of basic rates
5300 * @bitrate: the bitrate for which to find the basic rate
5302 * Return: The basic rate corresponding to a given bitrate, that
5303 * is the next lower bitrate contained in the basic rate map,
5304 * which is, for this function, given as a bitmap of indices of
5305 * rates in the band's bitrate table.
5307 struct ieee80211_rate *
5308 ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
5309 u32 basic_rates, int bitrate);
5312 * ieee80211_mandatory_rates - get mandatory rates for a given band
5313 * @sband: the band to look for rates in
5314 * @scan_width: width of the control channel
5316 * This function returns a bitmap of the mandatory rates for the given
5317 * band, bits are set according to the rate position in the bitrates array.
5319 u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
5320 enum nl80211_bss_scan_width scan_width);
5323 * Radiotap parsing functions -- for controlled injection support
5325 * Implemented in net/wireless/radiotap.c
5326 * Documentation in Documentation/networking/radiotap-headers.rst
5329 struct radiotap_align_size {
5330 uint8_t align:4, size:4;
5333 struct ieee80211_radiotap_namespace {
5334 const struct radiotap_align_size *align_size;
5340 struct ieee80211_radiotap_vendor_namespaces {
5341 const struct ieee80211_radiotap_namespace *ns;
5346 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
5347 * @this_arg_index: index of current arg, valid after each successful call
5348 * to ieee80211_radiotap_iterator_next()
5349 * @this_arg: pointer to current radiotap arg; it is valid after each
5350 * call to ieee80211_radiotap_iterator_next() but also after
5351 * ieee80211_radiotap_iterator_init() where it will point to
5352 * the beginning of the actual data portion
5353 * @this_arg_size: length of the current arg, for convenience
5354 * @current_namespace: pointer to the current namespace definition
5355 * (or internally %NULL if the current namespace is unknown)
5356 * @is_radiotap_ns: indicates whether the current namespace is the default
5357 * radiotap namespace or not
5359 * @_rtheader: pointer to the radiotap header we are walking through
5360 * @_max_length: length of radiotap header in cpu byte ordering
5361 * @_arg_index: next argument index
5362 * @_arg: next argument pointer
5363 * @_next_bitmap: internal pointer to next present u32
5364 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
5365 * @_vns: vendor namespace definitions
5366 * @_next_ns_data: beginning of the next namespace's data
5367 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
5370 * Describes the radiotap parser state. Fields prefixed with an underscore
5371 * must not be used by users of the parser, only by the parser internally.
5374 struct ieee80211_radiotap_iterator {
5375 struct ieee80211_radiotap_header *_rtheader;
5376 const struct ieee80211_radiotap_vendor_namespaces *_vns;
5377 const struct ieee80211_radiotap_namespace *current_namespace;
5379 unsigned char *_arg, *_next_ns_data;
5380 __le32 *_next_bitmap;
5382 unsigned char *this_arg;
5390 uint32_t _bitmap_shifter;
5395 ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
5396 struct ieee80211_radiotap_header *radiotap_header,
5398 const struct ieee80211_radiotap_vendor_namespaces *vns);
5401 ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
5404 extern const unsigned char rfc1042_header[6];
5405 extern const unsigned char bridge_tunnel_header[6];
5408 * ieee80211_get_hdrlen_from_skb - get header length from data
5412 * Given an skb with a raw 802.11 header at the data pointer this function
5413 * returns the 802.11 header length.
5415 * Return: The 802.11 header length in bytes (not including encryption
5416 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
5419 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
5422 * ieee80211_hdrlen - get header length in bytes from frame control
5423 * @fc: frame control field in little-endian format
5424 * Return: The header length in bytes.
5426 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
5429 * ieee80211_get_mesh_hdrlen - get mesh extension header length
5430 * @meshhdr: the mesh extension header, only the flags field
5431 * (first byte) will be accessed
5432 * Return: The length of the extension header, which is always at
5433 * least 6 bytes and at most 18 if address 5 and 6 are present.
5435 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
5438 * DOC: Data path helpers
5440 * In addition to generic utilities, cfg80211 also offers
5441 * functions that help implement the data path for devices
5442 * that do not do the 802.11/802.3 conversion on the device.
5446 * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
5447 * @skb: the 802.11 data frame
5448 * @ehdr: pointer to a &struct ethhdr that will get the header, instead
5449 * of it being pushed into the SKB
5450 * @addr: the device MAC address
5451 * @iftype: the virtual interface type
5452 * @data_offset: offset of payload after the 802.11 header
5453 * Return: 0 on success. Non-zero on error.
5455 int ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
5456 const u8 *addr, enum nl80211_iftype iftype,
5460 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
5461 * @skb: the 802.11 data frame
5462 * @addr: the device MAC address
5463 * @iftype: the virtual interface type
5464 * Return: 0 on success. Non-zero on error.
5466 static inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
5467 enum nl80211_iftype iftype)
5469 return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0);
5473 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
5475 * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
5476 * The @list will be empty if the decode fails. The @skb must be fully
5477 * header-less before being passed in here; it is freed in this function.
5479 * @skb: The input A-MSDU frame without any headers.
5480 * @list: The output list of 802.3 frames. It must be allocated and
5481 * initialized by by the caller.
5482 * @addr: The device MAC address.
5483 * @iftype: The device interface type.
5484 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
5485 * @check_da: DA to check in the inner ethernet header, or NULL
5486 * @check_sa: SA to check in the inner ethernet header, or NULL
5488 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
5489 const u8 *addr, enum nl80211_iftype iftype,
5490 const unsigned int extra_headroom,
5491 const u8 *check_da, const u8 *check_sa);
5494 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
5495 * @skb: the data frame
5496 * @qos_map: Interworking QoS mapping or %NULL if not in use
5497 * Return: The 802.1p/1d tag.
5499 unsigned int cfg80211_classify8021d(struct sk_buff *skb,
5500 struct cfg80211_qos_map *qos_map);
5503 * cfg80211_find_elem_match - match information element and byte array in data
5506 * @ies: data consisting of IEs
5507 * @len: length of data
5508 * @match: byte array to match
5509 * @match_len: number of bytes in the match array
5510 * @match_offset: offset in the IE data where the byte array should match.
5511 * Note the difference to cfg80211_find_ie_match() which considers
5512 * the offset to start from the element ID byte, but here we take
5513 * the data portion instead.
5515 * Return: %NULL if the element ID could not be found or if
5516 * the element is invalid (claims to be longer than the given
5517 * data) or if the byte array doesn't match; otherwise return the
5518 * requested element struct.
5520 * Note: There are no checks on the element length other than
5521 * having to fit into the given data and being large enough for the
5522 * byte array to match.
5524 const struct element *
5525 cfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
5526 const u8 *match, unsigned int match_len,
5527 unsigned int match_offset);
5530 * cfg80211_find_ie_match - match information element and byte array in data
5533 * @ies: data consisting of IEs
5534 * @len: length of data
5535 * @match: byte array to match
5536 * @match_len: number of bytes in the match array
5537 * @match_offset: offset in the IE where the byte array should match.
5538 * If match_len is zero, this must also be set to zero.
5539 * Otherwise this must be set to 2 or more, because the first
5540 * byte is the element id, which is already compared to eid, and
5541 * the second byte is the IE length.
5543 * Return: %NULL if the element ID could not be found or if
5544 * the element is invalid (claims to be longer than the given
5545 * data) or if the byte array doesn't match, or a pointer to the first
5546 * byte of the requested element, that is the byte containing the
5549 * Note: There are no checks on the element length other than
5550 * having to fit into the given data and being large enough for the
5551 * byte array to match.
5553 static inline const u8 *
5554 cfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
5555 const u8 *match, unsigned int match_len,
5556 unsigned int match_offset)
5558 /* match_offset can't be smaller than 2, unless match_len is
5559 * zero, in which case match_offset must be zero as well.
5561 if (WARN_ON((match_len && match_offset < 2) ||
5562 (!match_len && match_offset)))
5565 return (void *)cfg80211_find_elem_match(eid, ies, len,
5568 match_offset - 2 : 0);
5572 * cfg80211_find_elem - find information element in data
5575 * @ies: data consisting of IEs
5576 * @len: length of data
5578 * Return: %NULL if the element ID could not be found or if
5579 * the element is invalid (claims to be longer than the given
5580 * data) or if the byte array doesn't match; otherwise return the
5581 * requested element struct.
5583 * Note: There are no checks on the element length other than
5584 * having to fit into the given data.
5586 static inline const struct element *
5587 cfg80211_find_elem(u8 eid, const u8 *ies, int len)
5589 return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
5593 * cfg80211_find_ie - find information element in data
5596 * @ies: data consisting of IEs
5597 * @len: length of data
5599 * Return: %NULL if the element ID could not be found or if
5600 * the element is invalid (claims to be longer than the given
5601 * data), or a pointer to the first byte of the requested
5602 * element, that is the byte containing the element ID.
5604 * Note: There are no checks on the element length other than
5605 * having to fit into the given data.
5607 static inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
5609 return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
5613 * cfg80211_find_ext_elem - find information element with EID Extension in data
5615 * @ext_eid: element ID Extension
5616 * @ies: data consisting of IEs
5617 * @len: length of data
5619 * Return: %NULL if the etended element could not be found or if
5620 * the element is invalid (claims to be longer than the given
5621 * data) or if the byte array doesn't match; otherwise return the
5622 * requested element struct.
5624 * Note: There are no checks on the element length other than
5625 * having to fit into the given data.
5627 static inline const struct element *
5628 cfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
5630 return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
5635 * cfg80211_find_ext_ie - find information element with EID Extension in data
5637 * @ext_eid: element ID Extension
5638 * @ies: data consisting of IEs
5639 * @len: length of data
5641 * Return: %NULL if the extended element ID could not be found or if
5642 * the element is invalid (claims to be longer than the given
5643 * data), or a pointer to the first byte of the requested
5644 * element, that is the byte containing the element ID.
5646 * Note: There are no checks on the element length other than
5647 * having to fit into the given data.
5649 static inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
5651 return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
5656 * cfg80211_find_vendor_elem - find vendor specific information element in data
5659 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5660 * @ies: data consisting of IEs
5661 * @len: length of data
5663 * Return: %NULL if the vendor specific element ID could not be found or if the
5664 * element is invalid (claims to be longer than the given data); otherwise
5665 * return the element structure for the requested element.
5667 * Note: There are no checks on the element length other than having to fit into
5670 const struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
5675 * cfg80211_find_vendor_ie - find vendor specific information element in data
5678 * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
5679 * @ies: data consisting of IEs
5680 * @len: length of data
5682 * Return: %NULL if the vendor specific element ID could not be found or if the
5683 * element is invalid (claims to be longer than the given data), or a pointer to
5684 * the first byte of the requested element, that is the byte containing the
5687 * Note: There are no checks on the element length other than having to fit into
5690 static inline const u8 *
5691 cfg80211_find_vendor_ie(unsigned int oui, int oui_type,
5692 const u8 *ies, unsigned int len)
5694 return (void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
5698 * cfg80211_send_layer2_update - send layer 2 update frame
5700 * @dev: network device
5701 * @addr: STA MAC address
5703 * Wireless drivers can use this function to update forwarding tables in bridge
5704 * devices upon STA association.
5706 void cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
5709 * DOC: Regulatory enforcement infrastructure
5715 * regulatory_hint - driver hint to the wireless core a regulatory domain
5716 * @wiphy: the wireless device giving the hint (used only for reporting
5718 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
5719 * should be in. If @rd is set this should be NULL. Note that if you
5720 * set this to NULL you should still set rd->alpha2 to some accepted
5723 * Wireless drivers can use this function to hint to the wireless core
5724 * what it believes should be the current regulatory domain by
5725 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
5726 * domain should be in or by providing a completely build regulatory domain.
5727 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
5728 * for a regulatory domain structure for the respective country.
5730 * The wiphy must have been registered to cfg80211 prior to this call.
5731 * For cfg80211 drivers this means you must first use wiphy_register(),
5732 * for mac80211 drivers you must first use ieee80211_register_hw().
5734 * Drivers should check the return value, its possible you can get
5737 * Return: 0 on success. -ENOMEM.
5739 int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
5742 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
5743 * @wiphy: the wireless device we want to process the regulatory domain on
5744 * @rd: the regulatory domain informatoin to use for this wiphy
5746 * Set the regulatory domain information for self-managed wiphys, only they
5747 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
5750 * Return: 0 on success. -EINVAL, -EPERM
5752 int regulatory_set_wiphy_regd(struct wiphy *wiphy,
5753 struct ieee80211_regdomain *rd);
5756 * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
5757 * @wiphy: the wireless device we want to process the regulatory domain on
5758 * @rd: the regulatory domain information to use for this wiphy
5760 * This functions requires the RTNL to be held and applies the new regdomain
5761 * synchronously to this wiphy. For more details see
5762 * regulatory_set_wiphy_regd().
5764 * Return: 0 on success. -EINVAL, -EPERM
5766 int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
5767 struct ieee80211_regdomain *rd);
5770 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
5771 * @wiphy: the wireless device we want to process the regulatory domain on
5772 * @regd: the custom regulatory domain to use for this wiphy
5774 * Drivers can sometimes have custom regulatory domains which do not apply
5775 * to a specific country. Drivers can use this to apply such custom regulatory
5776 * domains. This routine must be called prior to wiphy registration. The
5777 * custom regulatory domain will be trusted completely and as such previous
5778 * default channel settings will be disregarded. If no rule is found for a
5779 * channel on the regulatory domain the channel will be disabled.
5780 * Drivers using this for a wiphy should also set the wiphy flag
5781 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
5782 * that called this helper.
5784 void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
5785 const struct ieee80211_regdomain *regd);
5788 * freq_reg_info - get regulatory information for the given frequency
5789 * @wiphy: the wiphy for which we want to process this rule for
5790 * @center_freq: Frequency in KHz for which we want regulatory information for
5792 * Use this function to get the regulatory rule for a specific frequency on
5793 * a given wireless device. If the device has a specific regulatory domain
5794 * it wants to follow we respect that unless a country IE has been received
5795 * and processed already.
5797 * Return: A valid pointer, or, when an error occurs, for example if no rule
5798 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
5799 * check and PTR_ERR() to obtain the numeric return value. The numeric return
5800 * value will be -ERANGE if we determine the given center_freq does not even
5801 * have a regulatory rule for a frequency range in the center_freq's band.
5802 * See freq_in_rule_band() for our current definition of a band -- this is
5803 * purely subjective and right now it's 802.11 specific.
5805 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
5809 * reg_initiator_name - map regulatory request initiator enum to name
5810 * @initiator: the regulatory request initiator
5812 * You can use this to map the regulatory request initiator enum to a
5813 * proper string representation.
5815 const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
5818 * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
5819 * @wiphy: wiphy for which pre-CAC capability is checked.
5821 * Pre-CAC is allowed only in some regdomains (notable ETSI).
5823 bool regulatory_pre_cac_allowed(struct wiphy *wiphy);
5826 * DOC: Internal regulatory db functions
5831 * reg_query_regdb_wmm - Query internal regulatory db for wmm rule
5832 * Regulatory self-managed driver can use it to proactively
5834 * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
5835 * @freq: the freqency(in MHz) to be queried.
5836 * @rule: pointer to store the wmm rule from the regulatory db.
5838 * Self-managed wireless drivers can use this function to query
5839 * the internal regulatory database to check whether the given
5840 * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
5842 * Drivers should check the return value, its possible you can get
5845 * Return: 0 on success. -ENODATA.
5847 int reg_query_regdb_wmm(char *alpha2, int freq,
5848 struct ieee80211_reg_rule *rule);
5851 * callbacks for asynchronous cfg80211 methods, notification
5852 * functions and BSS handling helpers
5856 * cfg80211_scan_done - notify that scan finished
5858 * @request: the corresponding scan request
5859 * @info: information about the completed scan
5861 void cfg80211_scan_done(struct cfg80211_scan_request *request,
5862 struct cfg80211_scan_info *info);
5865 * cfg80211_sched_scan_results - notify that new scan results are available
5867 * @wiphy: the wiphy which got scheduled scan results
5868 * @reqid: identifier for the related scheduled scan request
5870 void cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
5873 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
5875 * @wiphy: the wiphy on which the scheduled scan stopped
5876 * @reqid: identifier for the related scheduled scan request
5878 * The driver can call this function to inform cfg80211 that the
5879 * scheduled scan had to be stopped, for whatever reason. The driver
5880 * is then called back via the sched_scan_stop operation when done.
5882 void cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
5885 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
5887 * @wiphy: the wiphy on which the scheduled scan stopped
5888 * @reqid: identifier for the related scheduled scan request
5890 * The driver can call this function to inform cfg80211 that the
5891 * scheduled scan had to be stopped, for whatever reason. The driver
5892 * is then called back via the sched_scan_stop operation when done.
5893 * This function should be called with rtnl locked.
5895 void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy, u64 reqid);
5898 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
5899 * @wiphy: the wiphy reporting the BSS
5900 * @data: the BSS metadata
5901 * @mgmt: the management frame (probe response or beacon)
5902 * @len: length of the management frame
5903 * @gfp: context flags
5905 * This informs cfg80211 that BSS information was found and
5906 * the BSS should be updated/added.
5908 * Return: A referenced struct, must be released with cfg80211_put_bss()!
5909 * Or %NULL on error.
5911 struct cfg80211_bss * __must_check
5912 cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
5913 struct cfg80211_inform_bss *data,
5914 struct ieee80211_mgmt *mgmt, size_t len,
5917 static inline struct cfg80211_bss * __must_check
5918 cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
5919 struct ieee80211_channel *rx_channel,
5920 enum nl80211_bss_scan_width scan_width,
5921 struct ieee80211_mgmt *mgmt, size_t len,
5922 s32 signal, gfp_t gfp)
5924 struct cfg80211_inform_bss data = {
5926 .scan_width = scan_width,
5930 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5933 static inline struct cfg80211_bss * __must_check
5934 cfg80211_inform_bss_frame(struct wiphy *wiphy,
5935 struct ieee80211_channel *rx_channel,
5936 struct ieee80211_mgmt *mgmt, size_t len,
5937 s32 signal, gfp_t gfp)
5939 struct cfg80211_inform_bss data = {
5941 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
5945 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
5949 * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
5950 * @bssid: transmitter BSSID
5951 * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
5952 * @mbssid_index: BSSID index, taken from Multiple BSSID index element
5953 * @new_bssid: calculated nontransmitted BSSID
5955 static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
5956 u8 mbssid_index, u8 *new_bssid)
5958 u64 bssid_u64 = ether_addr_to_u64(bssid);
5959 u64 mask = GENMASK_ULL(max_bssid - 1, 0);
5962 new_bssid_u64 = bssid_u64 & ~mask;
5964 new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
5966 u64_to_ether_addr(new_bssid_u64, new_bssid);
5970 * cfg80211_is_element_inherited - returns if element ID should be inherited
5971 * @element: element to check
5972 * @non_inherit_element: non inheritance element
5974 bool cfg80211_is_element_inherited(const struct element *element,
5975 const struct element *non_inherit_element);
5978 * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
5980 * @ielen: length of IEs
5981 * @mbssid_elem: current MBSSID element
5982 * @sub_elem: current MBSSID subelement (profile)
5983 * @merged_ie: location of the merged profile
5984 * @max_copy_len: max merged profile length
5986 size_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
5987 const struct element *mbssid_elem,
5988 const struct element *sub_elem,
5989 u8 *merged_ie, size_t max_copy_len);
5992 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
5993 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
5994 * from a beacon or probe response
5995 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
5996 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
5998 enum cfg80211_bss_frame_type {
5999 CFG80211_BSS_FTYPE_UNKNOWN,
6000 CFG80211_BSS_FTYPE_BEACON,
6001 CFG80211_BSS_FTYPE_PRESP,
6005 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
6007 * @wiphy: the wiphy reporting the BSS
6008 * @data: the BSS metadata
6009 * @ftype: frame type (if known)
6010 * @bssid: the BSSID of the BSS
6011 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
6012 * @capability: the capability field sent by the peer
6013 * @beacon_interval: the beacon interval announced by the peer
6014 * @ie: additional IEs sent by the peer
6015 * @ielen: length of the additional IEs
6016 * @gfp: context flags
6018 * This informs cfg80211 that BSS information was found and
6019 * the BSS should be updated/added.
6021 * Return: A referenced struct, must be released with cfg80211_put_bss()!
6022 * Or %NULL on error.
6024 struct cfg80211_bss * __must_check
6025 cfg80211_inform_bss_data(struct wiphy *wiphy,
6026 struct cfg80211_inform_bss *data,
6027 enum cfg80211_bss_frame_type ftype,
6028 const u8 *bssid, u64 tsf, u16 capability,
6029 u16 beacon_interval, const u8 *ie, size_t ielen,
6032 static inline struct cfg80211_bss * __must_check
6033 cfg80211_inform_bss_width(struct wiphy *wiphy,
6034 struct ieee80211_channel *rx_channel,
6035 enum nl80211_bss_scan_width scan_width,
6036 enum cfg80211_bss_frame_type ftype,
6037 const u8 *bssid, u64 tsf, u16 capability,
6038 u16 beacon_interval, const u8 *ie, size_t ielen,
6039 s32 signal, gfp_t gfp)
6041 struct cfg80211_inform_bss data = {
6043 .scan_width = scan_width,
6047 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6048 capability, beacon_interval, ie, ielen,
6052 static inline struct cfg80211_bss * __must_check
6053 cfg80211_inform_bss(struct wiphy *wiphy,
6054 struct ieee80211_channel *rx_channel,
6055 enum cfg80211_bss_frame_type ftype,
6056 const u8 *bssid, u64 tsf, u16 capability,
6057 u16 beacon_interval, const u8 *ie, size_t ielen,
6058 s32 signal, gfp_t gfp)
6060 struct cfg80211_inform_bss data = {
6062 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
6066 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
6067 capability, beacon_interval, ie, ielen,
6072 * cfg80211_get_bss - get a BSS reference
6073 * @wiphy: the wiphy this BSS struct belongs to
6074 * @channel: the channel to search on (or %NULL)
6075 * @bssid: the desired BSSID (or %NULL)
6076 * @ssid: the desired SSID (or %NULL)
6077 * @ssid_len: length of the SSID (or 0)
6078 * @bss_type: type of BSS, see &enum ieee80211_bss_type
6079 * @privacy: privacy filter, see &enum ieee80211_privacy
6081 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
6082 struct ieee80211_channel *channel,
6084 const u8 *ssid, size_t ssid_len,
6085 enum ieee80211_bss_type bss_type,
6086 enum ieee80211_privacy privacy);
6087 static inline struct cfg80211_bss *
6088 cfg80211_get_ibss(struct wiphy *wiphy,
6089 struct ieee80211_channel *channel,
6090 const u8 *ssid, size_t ssid_len)
6092 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
6093 IEEE80211_BSS_TYPE_IBSS,
6094 IEEE80211_PRIVACY_ANY);
6098 * cfg80211_ref_bss - reference BSS struct
6099 * @wiphy: the wiphy this BSS struct belongs to
6100 * @bss: the BSS struct to reference
6102 * Increments the refcount of the given BSS struct.
6104 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6107 * cfg80211_put_bss - unref BSS struct
6108 * @wiphy: the wiphy this BSS struct belongs to
6109 * @bss: the BSS struct
6111 * Decrements the refcount of the given BSS struct.
6113 void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6116 * cfg80211_unlink_bss - unlink BSS from internal data structures
6118 * @bss: the bss to remove
6120 * This function removes the given BSS from the internal data structures
6121 * thereby making it no longer show up in scan results etc. Use this
6122 * function when you detect a BSS is gone. Normally BSSes will also time
6123 * out, so it is not necessary to use this function at all.
6125 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
6128 * cfg80211_bss_iter - iterate all BSS entries
6130 * This function iterates over the BSS entries associated with the given wiphy
6131 * and calls the callback for the iterated BSS. The iterator function is not
6132 * allowed to call functions that might modify the internal state of the BSS DB.
6135 * @chandef: if given, the iterator function will be called only if the channel
6136 * of the currently iterated BSS is a subset of the given channel.
6137 * @iter: the iterator function to call
6138 * @iter_data: an argument to the iterator function
6140 void cfg80211_bss_iter(struct wiphy *wiphy,
6141 struct cfg80211_chan_def *chandef,
6142 void (*iter)(struct wiphy *wiphy,
6143 struct cfg80211_bss *bss,
6147 static inline enum nl80211_bss_scan_width
6148 cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
6150 switch (chandef->width) {
6151 case NL80211_CHAN_WIDTH_5:
6152 return NL80211_BSS_CHAN_WIDTH_5;
6153 case NL80211_CHAN_WIDTH_10:
6154 return NL80211_BSS_CHAN_WIDTH_10;
6156 return NL80211_BSS_CHAN_WIDTH_20;
6161 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
6162 * @dev: network device
6163 * @buf: authentication frame (header + body)
6164 * @len: length of the frame data
6166 * This function is called whenever an authentication, disassociation or
6167 * deauthentication frame has been received and processed in station mode.
6168 * After being asked to authenticate via cfg80211_ops::auth() the driver must
6169 * call either this function or cfg80211_auth_timeout().
6170 * After being asked to associate via cfg80211_ops::assoc() the driver must
6171 * call either this function or cfg80211_auth_timeout().
6172 * While connected, the driver must calls this for received and processed
6173 * disassociation and deauthentication frames. If the frame couldn't be used
6174 * because it was unprotected, the driver must call the function
6175 * cfg80211_rx_unprot_mlme_mgmt() instead.
6177 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6179 void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6182 * cfg80211_auth_timeout - notification of timed out authentication
6183 * @dev: network device
6184 * @addr: The MAC address of the device with which the authentication timed out
6186 * This function may sleep. The caller must hold the corresponding wdev's
6189 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
6192 * cfg80211_rx_assoc_resp - notification of processed association response
6193 * @dev: network device
6194 * @bss: the BSS that association was requested with, ownership of the pointer
6195 * moves to cfg80211 in this call
6196 * @buf: (Re)Association Response frame (header + body)
6197 * @len: length of the frame data
6198 * @uapsd_queues: bitmap of queues configured for uapsd. Same format
6199 * as the AC bitmap in the QoS info field
6200 * @req_ies: information elements from the (Re)Association Request frame
6201 * @req_ies_len: length of req_ies data
6203 * After being asked to associate via cfg80211_ops::assoc() the driver must
6204 * call either this function or cfg80211_auth_timeout().
6206 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6208 void cfg80211_rx_assoc_resp(struct net_device *dev,
6209 struct cfg80211_bss *bss,
6210 const u8 *buf, size_t len,
6212 const u8 *req_ies, size_t req_ies_len);
6215 * cfg80211_assoc_timeout - notification of timed out association
6216 * @dev: network device
6217 * @bss: The BSS entry with which association timed out.
6219 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6221 void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
6224 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
6225 * @dev: network device
6226 * @bss: The BSS entry with which association was abandoned.
6228 * Call this whenever - for reasons reported through other API, like deauth RX,
6229 * an association attempt was abandoned.
6230 * This function may sleep. The caller must hold the corresponding wdev's mutex.
6232 void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
6235 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
6236 * @dev: network device
6237 * @buf: 802.11 frame (header + body)
6238 * @len: length of the frame data
6240 * This function is called whenever deauthentication has been processed in
6241 * station mode. This includes both received deauthentication frames and
6242 * locally generated ones. This function may sleep. The caller must hold the
6243 * corresponding wdev's mutex.
6245 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
6248 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
6249 * @dev: network device
6250 * @buf: received management frame (header + body)
6251 * @len: length of the frame data
6253 * This function is called whenever a received deauthentication or dissassoc
6254 * frame has been dropped in station mode because of MFP being used but the
6255 * frame was not protected. This is also used to notify reception of a Beacon
6256 * frame that was dropped because it did not include a valid MME MIC while
6257 * beacon protection was enabled (BIGTK configured in station mode).
6259 * This function may sleep.
6261 void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
6262 const u8 *buf, size_t len);
6265 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
6266 * @dev: network device
6267 * @addr: The source MAC address of the frame
6268 * @key_type: The key type that the received frame used
6269 * @key_id: Key identifier (0..3). Can be -1 if missing.
6270 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
6271 * @gfp: allocation flags
6273 * This function is called whenever the local MAC detects a MIC failure in a
6274 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
6277 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
6278 enum nl80211_key_type key_type, int key_id,
6279 const u8 *tsc, gfp_t gfp);
6282 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
6284 * @dev: network device
6285 * @bssid: the BSSID of the IBSS joined
6286 * @channel: the channel of the IBSS joined
6287 * @gfp: allocation flags
6289 * This function notifies cfg80211 that the device joined an IBSS or
6290 * switched to a different BSSID. Before this function can be called,
6291 * either a beacon has to have been received from the IBSS, or one of
6292 * the cfg80211_inform_bss{,_frame} functions must have been called
6293 * with the locally generated beacon -- this guarantees that there is
6294 * always a scan result for this IBSS. cfg80211 will handle the rest.
6296 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
6297 struct ieee80211_channel *channel, gfp_t gfp);
6300 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
6302 * @dev: network device
6303 * @macaddr: the MAC address of the new candidate
6304 * @ie: information elements advertised by the peer candidate
6305 * @ie_len: length of the information elements buffer
6306 * @gfp: allocation flags
6308 * This function notifies cfg80211 that the mesh peer candidate has been
6309 * detected, most likely via a beacon or, less likely, via a probe response.
6310 * cfg80211 then sends a notification to userspace.
6312 void cfg80211_notify_new_peer_candidate(struct net_device *dev,
6313 const u8 *macaddr, const u8 *ie, u8 ie_len,
6314 int sig_dbm, gfp_t gfp);
6317 * DOC: RFkill integration
6319 * RFkill integration in cfg80211 is almost invisible to drivers,
6320 * as cfg80211 automatically registers an rfkill instance for each
6321 * wireless device it knows about. Soft kill is also translated
6322 * into disconnecting and turning all interfaces off, drivers are
6323 * expected to turn off the device when all interfaces are down.
6325 * However, devices may have a hard RFkill line, in which case they
6326 * also need to interact with the rfkill subsystem, via cfg80211.
6327 * They can do this with a few helper functions documented here.
6331 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
6333 * @blocked: block status
6335 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
6338 * wiphy_rfkill_start_polling - start polling rfkill
6341 void wiphy_rfkill_start_polling(struct wiphy *wiphy);
6344 * wiphy_rfkill_stop_polling - stop polling rfkill
6347 void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
6350 * DOC: Vendor commands
6352 * Occasionally, there are special protocol or firmware features that
6353 * can't be implemented very openly. For this and similar cases, the
6354 * vendor command functionality allows implementing the features with
6355 * (typically closed-source) userspace and firmware, using nl80211 as
6356 * the configuration mechanism.
6358 * A driver supporting vendor commands must register them as an array
6359 * in struct wiphy, with handlers for each one, each command has an
6360 * OUI and sub command ID to identify it.
6362 * Note that this feature should not be (ab)used to implement protocol
6363 * features that could openly be shared across drivers. In particular,
6364 * it must never be required to use vendor commands to implement any
6365 * "normal" functionality that higher-level userspace like connection
6366 * managers etc. need.
6369 struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
6370 enum nl80211_commands cmd,
6371 enum nl80211_attrs attr,
6374 struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
6375 struct wireless_dev *wdev,
6376 enum nl80211_commands cmd,
6377 enum nl80211_attrs attr,
6378 unsigned int portid,
6379 int vendor_event_idx,
6380 int approxlen, gfp_t gfp);
6382 void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
6385 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
6387 * @approxlen: an upper bound of the length of the data that will
6388 * be put into the skb
6390 * This function allocates and pre-fills an skb for a reply to
6391 * a vendor command. Since it is intended for a reply, calling
6392 * it outside of a vendor command's doit() operation is invalid.
6394 * The returned skb is pre-filled with some identifying data in
6395 * a way that any data that is put into the skb (with skb_put(),
6396 * nla_put() or similar) will end up being within the
6397 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
6398 * with the skb is adding data for the corresponding userspace tool
6399 * which can then read that data out of the vendor data attribute.
6400 * You must not modify the skb in any other way.
6402 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
6403 * its error code as the result of the doit() operation.
6405 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6407 static inline struct sk_buff *
6408 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6410 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
6411 NL80211_ATTR_VENDOR_DATA, approxlen);
6415 * cfg80211_vendor_cmd_reply - send the reply skb
6416 * @skb: The skb, must have been allocated with
6417 * cfg80211_vendor_cmd_alloc_reply_skb()
6419 * Since calling this function will usually be the last thing
6420 * before returning from the vendor command doit() you should
6421 * return the error code. Note that this function consumes the
6422 * skb regardless of the return value.
6424 * Return: An error code or 0 on success.
6426 int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
6429 * cfg80211_vendor_cmd_get_sender
6432 * Return the current netlink port ID in a vendor command handler.
6433 * Valid to call only there.
6435 unsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
6438 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
6440 * @wdev: the wireless device
6441 * @event_idx: index of the vendor event in the wiphy's vendor_events
6442 * @approxlen: an upper bound of the length of the data that will
6443 * be put into the skb
6444 * @gfp: allocation flags
6446 * This function allocates and pre-fills an skb for an event on the
6447 * vendor-specific multicast group.
6449 * If wdev != NULL, both the ifindex and identifier of the specified
6450 * wireless device are added to the event message before the vendor data
6453 * When done filling the skb, call cfg80211_vendor_event() with the
6454 * skb to send the event.
6456 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6458 static inline struct sk_buff *
6459 cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
6460 int approxlen, int event_idx, gfp_t gfp)
6462 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6463 NL80211_ATTR_VENDOR_DATA,
6464 0, event_idx, approxlen, gfp);
6468 * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
6470 * @wdev: the wireless device
6471 * @event_idx: index of the vendor event in the wiphy's vendor_events
6472 * @portid: port ID of the receiver
6473 * @approxlen: an upper bound of the length of the data that will
6474 * be put into the skb
6475 * @gfp: allocation flags
6477 * This function allocates and pre-fills an skb for an event to send to
6478 * a specific (userland) socket. This socket would previously have been
6479 * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
6480 * care to register a netlink notifier to see when the socket closes.
6482 * If wdev != NULL, both the ifindex and identifier of the specified
6483 * wireless device are added to the event message before the vendor data
6486 * When done filling the skb, call cfg80211_vendor_event() with the
6487 * skb to send the event.
6489 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6491 static inline struct sk_buff *
6492 cfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
6493 struct wireless_dev *wdev,
6494 unsigned int portid, int approxlen,
6495 int event_idx, gfp_t gfp)
6497 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
6498 NL80211_ATTR_VENDOR_DATA,
6499 portid, event_idx, approxlen, gfp);
6503 * cfg80211_vendor_event - send the event
6504 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
6505 * @gfp: allocation flags
6507 * This function sends the given @skb, which must have been allocated
6508 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
6510 static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
6512 __cfg80211_send_event_skb(skb, gfp);
6515 #ifdef CONFIG_NL80211_TESTMODE
6519 * Test mode is a set of utility functions to allow drivers to
6520 * interact with driver-specific tools to aid, for instance,
6521 * factory programming.
6523 * This chapter describes how drivers interact with it, for more
6524 * information see the nl80211 book's chapter on it.
6528 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
6530 * @approxlen: an upper bound of the length of the data that will
6531 * be put into the skb
6533 * This function allocates and pre-fills an skb for a reply to
6534 * the testmode command. Since it is intended for a reply, calling
6535 * it outside of the @testmode_cmd operation is invalid.
6537 * The returned skb is pre-filled with the wiphy index and set up in
6538 * a way that any data that is put into the skb (with skb_put(),
6539 * nla_put() or similar) will end up being within the
6540 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
6541 * with the skb is adding data for the corresponding userspace tool
6542 * which can then read that data out of the testdata attribute. You
6543 * must not modify the skb in any other way.
6545 * When done, call cfg80211_testmode_reply() with the skb and return
6546 * its error code as the result of the @testmode_cmd operation.
6548 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6550 static inline struct sk_buff *
6551 cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
6553 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
6554 NL80211_ATTR_TESTDATA, approxlen);
6558 * cfg80211_testmode_reply - send the reply skb
6559 * @skb: The skb, must have been allocated with
6560 * cfg80211_testmode_alloc_reply_skb()
6562 * Since calling this function will usually be the last thing
6563 * before returning from the @testmode_cmd you should return
6564 * the error code. Note that this function consumes the skb
6565 * regardless of the return value.
6567 * Return: An error code or 0 on success.
6569 static inline int cfg80211_testmode_reply(struct sk_buff *skb)
6571 return cfg80211_vendor_cmd_reply(skb);
6575 * cfg80211_testmode_alloc_event_skb - allocate testmode event
6577 * @approxlen: an upper bound of the length of the data that will
6578 * be put into the skb
6579 * @gfp: allocation flags
6581 * This function allocates and pre-fills an skb for an event on the
6582 * testmode multicast group.
6584 * The returned skb is set up in the same way as with
6585 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
6586 * there, you should simply add data to it that will then end up in the
6587 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
6590 * When done filling the skb, call cfg80211_testmode_event() with the
6591 * skb to send the event.
6593 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
6595 static inline struct sk_buff *
6596 cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
6598 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
6599 NL80211_ATTR_TESTDATA, 0, -1,
6604 * cfg80211_testmode_event - send the event
6605 * @skb: The skb, must have been allocated with
6606 * cfg80211_testmode_alloc_event_skb()
6607 * @gfp: allocation flags
6609 * This function sends the given @skb, which must have been allocated
6610 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
6613 static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
6615 __cfg80211_send_event_skb(skb, gfp);
6618 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
6619 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
6621 #define CFG80211_TESTMODE_CMD(cmd)
6622 #define CFG80211_TESTMODE_DUMP(cmd)
6626 * struct cfg80211_fils_resp_params - FILS connection response params
6627 * @kek: KEK derived from a successful FILS connection (may be %NULL)
6628 * @kek_len: Length of @fils_kek in octets
6629 * @update_erp_next_seq_num: Boolean value to specify whether the value in
6630 * @erp_next_seq_num is valid.
6631 * @erp_next_seq_num: The next sequence number to use in ERP message in
6632 * FILS Authentication. This value should be specified irrespective of the
6633 * status for a FILS connection.
6634 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
6635 * @pmk_len: Length of @pmk in octets
6636 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
6637 * used for this FILS connection (may be %NULL).
6639 struct cfg80211_fils_resp_params {
6642 bool update_erp_next_seq_num;
6643 u16 erp_next_seq_num;
6650 * struct cfg80211_connect_resp_params - Connection response params
6651 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
6652 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6653 * the real status code for failures. If this call is used to report a
6654 * failure due to a timeout (e.g., not receiving an Authentication frame
6655 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6656 * indicate that this is a failure, but without a status code.
6657 * @timeout_reason is used to report the reason for the timeout in that
6659 * @bssid: The BSSID of the AP (may be %NULL)
6660 * @bss: Entry of bss to which STA got connected to, can be obtained through
6661 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6662 * bss from the connect_request and hold a reference to it and return
6663 * through this param to avoid a warning if the bss is expired during the
6664 * connection, esp. for those drivers implementing connect op.
6665 * Only one parameter among @bssid and @bss needs to be specified.
6666 * @req_ie: Association request IEs (may be %NULL)
6667 * @req_ie_len: Association request IEs length
6668 * @resp_ie: Association response IEs (may be %NULL)
6669 * @resp_ie_len: Association response IEs length
6670 * @fils: FILS connection response parameters.
6671 * @timeout_reason: Reason for connection timeout. This is used when the
6672 * connection fails due to a timeout instead of an explicit rejection from
6673 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6674 * not known. This value is used only if @status < 0 to indicate that the
6675 * failure is due to a timeout and not due to explicit rejection by the AP.
6676 * This value is ignored in other cases (@status >= 0).
6678 struct cfg80211_connect_resp_params {
6681 struct cfg80211_bss *bss;
6686 struct cfg80211_fils_resp_params fils;
6687 enum nl80211_timeout_reason timeout_reason;
6691 * cfg80211_connect_done - notify cfg80211 of connection result
6693 * @dev: network device
6694 * @params: connection response parameters
6695 * @gfp: allocation flags
6697 * It should be called by the underlying driver once execution of the connection
6698 * request from connect() has been completed. This is similar to
6699 * cfg80211_connect_bss(), but takes a structure pointer for connection response
6700 * parameters. Only one of the functions among cfg80211_connect_bss(),
6701 * cfg80211_connect_result(), cfg80211_connect_timeout(),
6702 * and cfg80211_connect_done() should be called.
6704 void cfg80211_connect_done(struct net_device *dev,
6705 struct cfg80211_connect_resp_params *params,
6709 * cfg80211_connect_bss - notify cfg80211 of connection result
6711 * @dev: network device
6712 * @bssid: the BSSID of the AP
6713 * @bss: Entry of bss to which STA got connected to, can be obtained through
6714 * cfg80211_get_bss() (may be %NULL). But it is recommended to store the
6715 * bss from the connect_request and hold a reference to it and return
6716 * through this param to avoid a warning if the bss is expired during the
6717 * connection, esp. for those drivers implementing connect op.
6718 * Only one parameter among @bssid and @bss needs to be specified.
6719 * @req_ie: association request IEs (maybe be %NULL)
6720 * @req_ie_len: association request IEs length
6721 * @resp_ie: association response IEs (may be %NULL)
6722 * @resp_ie_len: assoc response IEs length
6723 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6724 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6725 * the real status code for failures. If this call is used to report a
6726 * failure due to a timeout (e.g., not receiving an Authentication frame
6727 * from the AP) instead of an explicit rejection by the AP, -1 is used to
6728 * indicate that this is a failure, but without a status code.
6729 * @timeout_reason is used to report the reason for the timeout in that
6731 * @gfp: allocation flags
6732 * @timeout_reason: reason for connection timeout. This is used when the
6733 * connection fails due to a timeout instead of an explicit rejection from
6734 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
6735 * not known. This value is used only if @status < 0 to indicate that the
6736 * failure is due to a timeout and not due to explicit rejection by the AP.
6737 * This value is ignored in other cases (@status >= 0).
6739 * It should be called by the underlying driver once execution of the connection
6740 * request from connect() has been completed. This is similar to
6741 * cfg80211_connect_result(), but with the option of identifying the exact bss
6742 * entry for the connection. Only one of the functions among
6743 * cfg80211_connect_bss(), cfg80211_connect_result(),
6744 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6747 cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
6748 struct cfg80211_bss *bss, const u8 *req_ie,
6749 size_t req_ie_len, const u8 *resp_ie,
6750 size_t resp_ie_len, int status, gfp_t gfp,
6751 enum nl80211_timeout_reason timeout_reason)
6753 struct cfg80211_connect_resp_params params;
6755 memset(¶ms, 0, sizeof(params));
6756 params.status = status;
6757 params.bssid = bssid;
6759 params.req_ie = req_ie;
6760 params.req_ie_len = req_ie_len;
6761 params.resp_ie = resp_ie;
6762 params.resp_ie_len = resp_ie_len;
6763 params.timeout_reason = timeout_reason;
6765 cfg80211_connect_done(dev, ¶ms, gfp);
6769 * cfg80211_connect_result - notify cfg80211 of connection result
6771 * @dev: network device
6772 * @bssid: the BSSID of the AP
6773 * @req_ie: association request IEs (maybe be %NULL)
6774 * @req_ie_len: association request IEs length
6775 * @resp_ie: association response IEs (may be %NULL)
6776 * @resp_ie_len: assoc response IEs length
6777 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
6778 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
6779 * the real status code for failures.
6780 * @gfp: allocation flags
6782 * It should be called by the underlying driver once execution of the connection
6783 * request from connect() has been completed. This is similar to
6784 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
6785 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
6786 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6789 cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
6790 const u8 *req_ie, size_t req_ie_len,
6791 const u8 *resp_ie, size_t resp_ie_len,
6792 u16 status, gfp_t gfp)
6794 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
6795 resp_ie_len, status, gfp,
6796 NL80211_TIMEOUT_UNSPECIFIED);
6800 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
6802 * @dev: network device
6803 * @bssid: the BSSID of the AP
6804 * @req_ie: association request IEs (maybe be %NULL)
6805 * @req_ie_len: association request IEs length
6806 * @gfp: allocation flags
6807 * @timeout_reason: reason for connection timeout.
6809 * It should be called by the underlying driver whenever connect() has failed
6810 * in a sequence where no explicit authentication/association rejection was
6811 * received from the AP. This could happen, e.g., due to not being able to send
6812 * out the Authentication or Association Request frame or timing out while
6813 * waiting for the response. Only one of the functions among
6814 * cfg80211_connect_bss(), cfg80211_connect_result(),
6815 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
6818 cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
6819 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
6820 enum nl80211_timeout_reason timeout_reason)
6822 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
6823 gfp, timeout_reason);
6827 * struct cfg80211_roam_info - driver initiated roaming information
6829 * @channel: the channel of the new AP
6830 * @bss: entry of bss to which STA got roamed (may be %NULL if %bssid is set)
6831 * @bssid: the BSSID of the new AP (may be %NULL if %bss is set)
6832 * @req_ie: association request IEs (maybe be %NULL)
6833 * @req_ie_len: association request IEs length
6834 * @resp_ie: association response IEs (may be %NULL)
6835 * @resp_ie_len: assoc response IEs length
6836 * @fils: FILS related roaming information.
6838 struct cfg80211_roam_info {
6839 struct ieee80211_channel *channel;
6840 struct cfg80211_bss *bss;
6846 struct cfg80211_fils_resp_params fils;
6850 * cfg80211_roamed - notify cfg80211 of roaming
6852 * @dev: network device
6853 * @info: information about the new BSS. struct &cfg80211_roam_info.
6854 * @gfp: allocation flags
6856 * This function may be called with the driver passing either the BSSID of the
6857 * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
6858 * It should be called by the underlying driver whenever it roamed from one AP
6859 * to another while connected. Drivers which have roaming implemented in
6860 * firmware should pass the bss entry to avoid a race in bss entry timeout where
6861 * the bss entry of the new AP is seen in the driver, but gets timed out by the
6862 * time it is accessed in __cfg80211_roamed() due to delay in scheduling
6863 * rdev->event_work. In case of any failures, the reference is released
6864 * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
6865 * released while disconnecting from the current bss.
6867 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
6871 * cfg80211_port_authorized - notify cfg80211 of successful security association
6873 * @dev: network device
6874 * @bssid: the BSSID of the AP
6875 * @gfp: allocation flags
6877 * This function should be called by a driver that supports 4 way handshake
6878 * offload after a security association was successfully established (i.e.,
6879 * the 4 way handshake was completed successfully). The call to this function
6880 * should be preceded with a call to cfg80211_connect_result(),
6881 * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
6882 * indicate the 802.11 association.
6884 void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
6888 * cfg80211_disconnected - notify cfg80211 that connection was dropped
6890 * @dev: network device
6891 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
6892 * @ie_len: length of IEs
6893 * @reason: reason code for the disconnection, set it to 0 if unknown
6894 * @locally_generated: disconnection was requested locally
6895 * @gfp: allocation flags
6897 * After it calls this function, the driver should enter an idle state
6898 * and not try to connect to any AP any more.
6900 void cfg80211_disconnected(struct net_device *dev, u16 reason,
6901 const u8 *ie, size_t ie_len,
6902 bool locally_generated, gfp_t gfp);
6905 * cfg80211_ready_on_channel - notification of remain_on_channel start
6906 * @wdev: wireless device
6907 * @cookie: the request cookie
6908 * @chan: The current channel (from remain_on_channel request)
6909 * @duration: Duration in milliseconds that the driver intents to remain on the
6911 * @gfp: allocation flags
6913 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
6914 struct ieee80211_channel *chan,
6915 unsigned int duration, gfp_t gfp);
6918 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
6919 * @wdev: wireless device
6920 * @cookie: the request cookie
6921 * @chan: The current channel (from remain_on_channel request)
6922 * @gfp: allocation flags
6924 void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
6925 struct ieee80211_channel *chan,
6929 * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
6930 * @wdev: wireless device
6931 * @cookie: the requested cookie
6932 * @chan: The current channel (from tx_mgmt request)
6933 * @gfp: allocation flags
6935 void cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
6936 struct ieee80211_channel *chan, gfp_t gfp);
6939 * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
6941 * @sinfo: the station information
6942 * @gfp: allocation flags
6944 int cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
6947 * cfg80211_sinfo_release_content - release contents of station info
6948 * @sinfo: the station information
6950 * Releases any potentially allocated sub-information of the station
6951 * information, but not the struct itself (since it's typically on
6954 static inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
6956 kfree(sinfo->pertid);
6960 * cfg80211_new_sta - notify userspace about station
6963 * @mac_addr: the station's address
6964 * @sinfo: the station information
6965 * @gfp: allocation flags
6967 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
6968 struct station_info *sinfo, gfp_t gfp);
6971 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
6973 * @mac_addr: the station's address
6974 * @sinfo: the station information/statistics
6975 * @gfp: allocation flags
6977 void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
6978 struct station_info *sinfo, gfp_t gfp);
6981 * cfg80211_del_sta - notify userspace about deletion of a station
6984 * @mac_addr: the station's address
6985 * @gfp: allocation flags
6987 static inline void cfg80211_del_sta(struct net_device *dev,
6988 const u8 *mac_addr, gfp_t gfp)
6990 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
6994 * cfg80211_conn_failed - connection request failed notification
6997 * @mac_addr: the station's address
6998 * @reason: the reason for connection failure
6999 * @gfp: allocation flags
7001 * Whenever a station tries to connect to an AP and if the station
7002 * could not connect to the AP as the AP has rejected the connection
7003 * for some reasons, this function is called.
7005 * The reason for connection failure can be any of the value from
7006 * nl80211_connect_failed_reason enum
7008 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
7009 enum nl80211_connect_failed_reason reason,
7013 * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
7014 * @wdev: wireless device receiving the frame
7015 * @freq: Frequency on which the frame was received in KHz
7016 * @sig_dbm: signal strength in dBm, or 0 if unknown
7017 * @buf: Management frame (header + body)
7018 * @len: length of the frame data
7019 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7021 * This function is called whenever an Action frame is received for a station
7022 * mode interface, but is not processed in kernel.
7024 * Return: %true if a user space application has registered for this frame.
7025 * For action frames, that makes it responsible for rejecting unrecognized
7026 * action frames; %false otherwise, in which case for action frames the
7027 * driver is responsible for rejecting the frame.
7029 bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
7030 const u8 *buf, size_t len, u32 flags);
7033 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
7034 * @wdev: wireless device receiving the frame
7035 * @freq: Frequency on which the frame was received in MHz
7036 * @sig_dbm: signal strength in dBm, or 0 if unknown
7037 * @buf: Management frame (header + body)
7038 * @len: length of the frame data
7039 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
7041 * This function is called whenever an Action frame is received for a station
7042 * mode interface, but is not processed in kernel.
7044 * Return: %true if a user space application has registered for this frame.
7045 * For action frames, that makes it responsible for rejecting unrecognized
7046 * action frames; %false otherwise, in which case for action frames the
7047 * driver is responsible for rejecting the frame.
7049 static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
7050 int sig_dbm, const u8 *buf, size_t len,
7053 return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
7058 * cfg80211_mgmt_tx_status - notification of TX status for management frame
7059 * @wdev: wireless device receiving the frame
7060 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
7061 * @buf: Management frame (header + body)
7062 * @len: length of the frame data
7063 * @ack: Whether frame was acknowledged
7064 * @gfp: context flags
7066 * This function is called whenever a management frame was requested to be
7067 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
7068 * transmission attempt.
7070 void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
7071 const u8 *buf, size_t len, bool ack, gfp_t gfp);
7074 * cfg80211_control_port_tx_status - notification of TX status for control
7076 * @wdev: wireless device receiving the frame
7077 * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
7078 * @buf: Data frame (header + body)
7079 * @len: length of the frame data
7080 * @ack: Whether frame was acknowledged
7081 * @gfp: context flags
7083 * This function is called whenever a control port frame was requested to be
7084 * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
7085 * the transmission attempt.
7087 void cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
7088 const u8 *buf, size_t len, bool ack,
7092 * cfg80211_rx_control_port - notification about a received control port frame
7093 * @dev: The device the frame matched to
7094 * @skb: The skbuf with the control port frame. It is assumed that the skbuf
7095 * is 802.3 formatted (with 802.3 header). The skb can be non-linear.
7096 * This function does not take ownership of the skb, so the caller is
7097 * responsible for any cleanup. The caller must also ensure that
7098 * skb->protocol is set appropriately.
7099 * @unencrypted: Whether the frame was received unencrypted
7101 * This function is used to inform userspace about a received control port
7102 * frame. It should only be used if userspace indicated it wants to receive
7103 * control port frames over nl80211.
7105 * The frame is the data portion of the 802.3 or 802.11 data frame with all
7106 * network layer headers removed (e.g. the raw EAPoL frame).
7108 * Return: %true if the frame was passed to userspace
7110 bool cfg80211_rx_control_port(struct net_device *dev,
7111 struct sk_buff *skb, bool unencrypted);
7114 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
7115 * @dev: network device
7116 * @rssi_event: the triggered RSSI event
7117 * @rssi_level: new RSSI level value or 0 if not available
7118 * @gfp: context flags
7120 * This function is called when a configured connection quality monitoring
7121 * rssi threshold reached event occurs.
7123 void cfg80211_cqm_rssi_notify(struct net_device *dev,
7124 enum nl80211_cqm_rssi_threshold_event rssi_event,
7125 s32 rssi_level, gfp_t gfp);
7128 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
7129 * @dev: network device
7130 * @peer: peer's MAC address
7131 * @num_packets: how many packets were lost -- should be a fixed threshold
7132 * but probably no less than maybe 50, or maybe a throughput dependent
7133 * threshold (to account for temporary interference)
7134 * @gfp: context flags
7136 void cfg80211_cqm_pktloss_notify(struct net_device *dev,
7137 const u8 *peer, u32 num_packets, gfp_t gfp);
7140 * cfg80211_cqm_txe_notify - TX error rate event
7141 * @dev: network device
7142 * @peer: peer's MAC address
7143 * @num_packets: how many packets were lost
7144 * @rate: % of packets which failed transmission
7145 * @intvl: interval (in s) over which the TX failure threshold was breached.
7146 * @gfp: context flags
7148 * Notify userspace when configured % TX failures over number of packets in a
7149 * given interval is exceeded.
7151 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
7152 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
7155 * cfg80211_cqm_beacon_loss_notify - beacon loss event
7156 * @dev: network device
7157 * @gfp: context flags
7159 * Notify userspace about beacon loss from the connected AP.
7161 void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
7164 * cfg80211_radar_event - radar detection event
7166 * @chandef: chandef for the current channel
7167 * @gfp: context flags
7169 * This function is called when a radar is detected on the current chanenl.
7171 void cfg80211_radar_event(struct wiphy *wiphy,
7172 struct cfg80211_chan_def *chandef, gfp_t gfp);
7175 * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
7176 * @dev: network device
7177 * @mac: MAC address of a station which opmode got modified
7178 * @sta_opmode: station's current opmode value
7179 * @gfp: context flags
7181 * Driver should call this function when station's opmode modified via action
7184 void cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
7185 struct sta_opmode_info *sta_opmode,
7189 * cfg80211_cac_event - Channel availability check (CAC) event
7190 * @netdev: network device
7191 * @chandef: chandef for the current channel
7192 * @event: type of event
7193 * @gfp: context flags
7195 * This function is called when a Channel availability check (CAC) is finished
7196 * or aborted. This must be called to notify the completion of a CAC process,
7197 * also by full-MAC drivers.
7199 void cfg80211_cac_event(struct net_device *netdev,
7200 const struct cfg80211_chan_def *chandef,
7201 enum nl80211_radar_event event, gfp_t gfp);
7205 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
7206 * @dev: network device
7207 * @bssid: BSSID of AP (to avoid races)
7208 * @replay_ctr: new replay counter
7209 * @gfp: allocation flags
7211 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
7212 const u8 *replay_ctr, gfp_t gfp);
7215 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
7216 * @dev: network device
7217 * @index: candidate index (the smaller the index, the higher the priority)
7218 * @bssid: BSSID of AP
7219 * @preauth: Whether AP advertises support for RSN pre-authentication
7220 * @gfp: allocation flags
7222 void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
7223 const u8 *bssid, bool preauth, gfp_t gfp);
7226 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
7227 * @dev: The device the frame matched to
7228 * @addr: the transmitter address
7229 * @gfp: context flags
7231 * This function is used in AP mode (only!) to inform userspace that
7232 * a spurious class 3 frame was received, to be able to deauth the
7234 * Return: %true if the frame was passed to userspace (or this failed
7235 * for a reason other than not having a subscription.)
7237 bool cfg80211_rx_spurious_frame(struct net_device *dev,
7238 const u8 *addr, gfp_t gfp);
7241 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
7242 * @dev: The device the frame matched to
7243 * @addr: the transmitter address
7244 * @gfp: context flags
7246 * This function is used in AP mode (only!) to inform userspace that
7247 * an associated station sent a 4addr frame but that wasn't expected.
7248 * It is allowed and desirable to send this event only once for each
7249 * station to avoid event flooding.
7250 * Return: %true if the frame was passed to userspace (or this failed
7251 * for a reason other than not having a subscription.)
7253 bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
7254 const u8 *addr, gfp_t gfp);
7257 * cfg80211_probe_status - notify userspace about probe status
7258 * @dev: the device the probe was sent on
7259 * @addr: the address of the peer
7260 * @cookie: the cookie filled in @probe_client previously
7261 * @acked: indicates whether probe was acked or not
7262 * @ack_signal: signal strength (in dBm) of the ACK frame.
7263 * @is_valid_ack_signal: indicates the ack_signal is valid or not.
7264 * @gfp: allocation flags
7266 void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
7267 u64 cookie, bool acked, s32 ack_signal,
7268 bool is_valid_ack_signal, gfp_t gfp);
7271 * cfg80211_report_obss_beacon_khz - report beacon from other APs
7272 * @wiphy: The wiphy that received the beacon
7274 * @len: length of the frame
7275 * @freq: frequency the frame was received on in KHz
7276 * @sig_dbm: signal strength in dBm, or 0 if unknown
7278 * Use this function to report to userspace when a beacon was
7279 * received. It is not useful to call this when there is no
7280 * netdev that is in AP/GO mode.
7282 void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
7283 size_t len, int freq, int sig_dbm);
7286 * cfg80211_report_obss_beacon - report beacon from other APs
7287 * @wiphy: The wiphy that received the beacon
7289 * @len: length of the frame
7290 * @freq: frequency the frame was received on
7291 * @sig_dbm: signal strength in dBm, or 0 if unknown
7293 * Use this function to report to userspace when a beacon was
7294 * received. It is not useful to call this when there is no
7295 * netdev that is in AP/GO mode.
7297 static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
7298 const u8 *frame, size_t len,
7299 int freq, int sig_dbm)
7301 cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
7306 * cfg80211_reg_can_beacon - check if beaconing is allowed
7308 * @chandef: the channel definition
7309 * @iftype: interface type
7311 * Return: %true if there is no secondary channel or the secondary channel(s)
7312 * can be used for beaconing (i.e. is not a radar channel etc.)
7314 bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
7315 struct cfg80211_chan_def *chandef,
7316 enum nl80211_iftype iftype);
7319 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
7321 * @chandef: the channel definition
7322 * @iftype: interface type
7324 * Return: %true if there is no secondary channel or the secondary channel(s)
7325 * can be used for beaconing (i.e. is not a radar channel etc.). This version
7326 * also checks if IR-relaxation conditions apply, to allow beaconing under
7327 * more permissive conditions.
7329 * Requires the RTNL to be held.
7331 bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
7332 struct cfg80211_chan_def *chandef,
7333 enum nl80211_iftype iftype);
7336 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
7337 * @dev: the device which switched channels
7338 * @chandef: the new channel definition
7340 * Caller must acquire wdev_lock, therefore must only be called from sleepable
7343 void cfg80211_ch_switch_notify(struct net_device *dev,
7344 struct cfg80211_chan_def *chandef);
7347 * cfg80211_ch_switch_started_notify - notify channel switch start
7348 * @dev: the device on which the channel switch started
7349 * @chandef: the future channel definition
7350 * @count: the number of TBTTs until the channel switch happens
7352 * Inform the userspace about the channel switch that has just
7353 * started, so that it can take appropriate actions (eg. starting
7354 * channel switch on other vifs), if necessary.
7356 void cfg80211_ch_switch_started_notify(struct net_device *dev,
7357 struct cfg80211_chan_def *chandef,
7361 * ieee80211_operating_class_to_band - convert operating class to band
7363 * @operating_class: the operating class to convert
7364 * @band: band pointer to fill
7366 * Returns %true if the conversion was successful, %false otherwise.
7368 bool ieee80211_operating_class_to_band(u8 operating_class,
7369 enum nl80211_band *band);
7372 * ieee80211_chandef_to_operating_class - convert chandef to operation class
7374 * @chandef: the chandef to convert
7375 * @op_class: a pointer to the resulting operating class
7377 * Returns %true if the conversion was successful, %false otherwise.
7379 bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
7383 * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
7385 * @chandef: the chandef to convert
7387 * Returns the center frequency of chandef (1st segment) in KHz.
7390 ieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
7392 return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
7396 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
7397 * @dev: the device on which the operation is requested
7398 * @peer: the MAC address of the peer device
7399 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
7400 * NL80211_TDLS_TEARDOWN)
7401 * @reason_code: the reason code for teardown request
7402 * @gfp: allocation flags
7404 * This function is used to request userspace to perform TDLS operation that
7405 * requires knowledge of keys, i.e., link setup or teardown when the AP
7406 * connection uses encryption. This is optional mechanism for the driver to use
7407 * if it can automatically determine when a TDLS link could be useful (e.g.,
7408 * based on traffic and signal strength for a peer).
7410 void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
7411 enum nl80211_tdls_operation oper,
7412 u16 reason_code, gfp_t gfp);
7415 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
7416 * @rate: given rate_info to calculate bitrate from
7418 * return 0 if MCS index >= 32
7420 u32 cfg80211_calculate_bitrate(struct rate_info *rate);
7423 * cfg80211_unregister_wdev - remove the given wdev
7424 * @wdev: struct wireless_dev to remove
7426 * Call this function only for wdevs that have no netdev assigned,
7427 * e.g. P2P Devices. It removes the device from the list so that
7428 * it can no longer be used. It is necessary to call this function
7429 * even when cfg80211 requests the removal of the interface by
7430 * calling the del_virtual_intf() callback. The function must also
7431 * be called when the driver wishes to unregister the wdev, e.g.
7432 * when the device is unbound from the driver.
7434 * Requires the RTNL to be held.
7436 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
7439 * struct cfg80211_ft_event - FT Information Elements
7441 * @ies_len: length of the FT IE in bytes
7442 * @target_ap: target AP's MAC address
7444 * @ric_ies_len: length of the RIC IE in bytes
7446 struct cfg80211_ft_event_params {
7449 const u8 *target_ap;
7455 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
7456 * @netdev: network device
7457 * @ft_event: IE information
7459 void cfg80211_ft_event(struct net_device *netdev,
7460 struct cfg80211_ft_event_params *ft_event);
7463 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
7464 * @ies: the input IE buffer
7465 * @len: the input length
7466 * @attr: the attribute ID to find
7467 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
7468 * if the function is only called to get the needed buffer size
7469 * @bufsize: size of the output buffer
7471 * The function finds a given P2P attribute in the (vendor) IEs and
7472 * copies its contents to the given buffer.
7474 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
7475 * malformed or the attribute can't be found (respectively), or the
7476 * length of the found attribute (which can be zero).
7478 int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
7479 enum ieee80211_p2p_attr_id attr,
7480 u8 *buf, unsigned int bufsize);
7483 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
7484 * @ies: the IE buffer
7485 * @ielen: the length of the IE buffer
7486 * @ids: an array with element IDs that are allowed before
7487 * the split. A WLAN_EID_EXTENSION value means that the next
7488 * EID in the list is a sub-element of the EXTENSION IE.
7489 * @n_ids: the size of the element ID array
7490 * @after_ric: array IE types that come after the RIC element
7491 * @n_after_ric: size of the @after_ric array
7492 * @offset: offset where to start splitting in the buffer
7494 * This function splits an IE buffer by updating the @offset
7495 * variable to point to the location where the buffer should be
7498 * It assumes that the given IE buffer is well-formed, this
7499 * has to be guaranteed by the caller!
7501 * It also assumes that the IEs in the buffer are ordered
7502 * correctly, if not the result of using this function will not
7503 * be ordered correctly either, i.e. it does no reordering.
7505 * The function returns the offset where the next part of the
7506 * buffer starts, which may be @ielen if the entire (remainder)
7507 * of the buffer should be used.
7509 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
7510 const u8 *ids, int n_ids,
7511 const u8 *after_ric, int n_after_ric,
7515 * ieee80211_ie_split - split an IE buffer according to ordering
7516 * @ies: the IE buffer
7517 * @ielen: the length of the IE buffer
7518 * @ids: an array with element IDs that are allowed before
7519 * the split. A WLAN_EID_EXTENSION value means that the next
7520 * EID in the list is a sub-element of the EXTENSION IE.
7521 * @n_ids: the size of the element ID array
7522 * @offset: offset where to start splitting in the buffer
7524 * This function splits an IE buffer by updating the @offset
7525 * variable to point to the location where the buffer should be
7528 * It assumes that the given IE buffer is well-formed, this
7529 * has to be guaranteed by the caller!
7531 * It also assumes that the IEs in the buffer are ordered
7532 * correctly, if not the result of using this function will not
7533 * be ordered correctly either, i.e. it does no reordering.
7535 * The function returns the offset where the next part of the
7536 * buffer starts, which may be @ielen if the entire (remainder)
7537 * of the buffer should be used.
7539 static inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
7540 const u8 *ids, int n_ids, size_t offset)
7542 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
7546 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
7547 * @wdev: the wireless device reporting the wakeup
7548 * @wakeup: the wakeup report
7549 * @gfp: allocation flags
7551 * This function reports that the given device woke up. If it
7552 * caused the wakeup, report the reason(s), otherwise you may
7553 * pass %NULL as the @wakeup parameter to advertise that something
7554 * else caused the wakeup.
7556 void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
7557 struct cfg80211_wowlan_wakeup *wakeup,
7561 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
7563 * @wdev: the wireless device for which critical protocol is stopped.
7564 * @gfp: allocation flags
7566 * This function can be called by the driver to indicate it has reverted
7567 * operation back to normal. One reason could be that the duration given
7568 * by .crit_proto_start() has expired.
7570 void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
7573 * ieee80211_get_num_supported_channels - get number of channels device has
7576 * Return: the number of channels supported by the device.
7578 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
7581 * cfg80211_check_combinations - check interface combinations
7584 * @params: the interface combinations parameter
7586 * This function can be called by the driver to check whether a
7587 * combination of interfaces and their types are allowed according to
7588 * the interface combinations.
7590 int cfg80211_check_combinations(struct wiphy *wiphy,
7591 struct iface_combination_params *params);
7594 * cfg80211_iter_combinations - iterate over matching combinations
7597 * @params: the interface combinations parameter
7598 * @iter: function to call for each matching combination
7599 * @data: pointer to pass to iter function
7601 * This function can be called by the driver to check what possible
7602 * combinations it fits in at a given moment, e.g. for channel switching
7605 int cfg80211_iter_combinations(struct wiphy *wiphy,
7606 struct iface_combination_params *params,
7607 void (*iter)(const struct ieee80211_iface_combination *c,
7612 * cfg80211_stop_iface - trigger interface disconnection
7615 * @wdev: wireless device
7616 * @gfp: context flags
7618 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
7621 * Note: This doesn't need any locks and is asynchronous.
7623 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
7627 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
7628 * @wiphy: the wiphy to shut down
7630 * This function shuts down all interfaces belonging to this wiphy by
7631 * calling dev_close() (and treating non-netdev interfaces as needed).
7632 * It shouldn't really be used unless there are some fatal device errors
7633 * that really can't be recovered in any other way.
7635 * Callers must hold the RTNL and be able to deal with callbacks into
7636 * the driver while the function is running.
7638 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
7641 * wiphy_ext_feature_set - set the extended feature flag
7643 * @wiphy: the wiphy to modify.
7644 * @ftidx: extended feature bit index.
7646 * The extended features are flagged in multiple bytes (see
7647 * &struct wiphy.@ext_features)
7649 static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
7650 enum nl80211_ext_feature_index ftidx)
7654 ft_byte = &wiphy->ext_features[ftidx / 8];
7655 *ft_byte |= BIT(ftidx % 8);
7659 * wiphy_ext_feature_isset - check the extended feature flag
7661 * @wiphy: the wiphy to modify.
7662 * @ftidx: extended feature bit index.
7664 * The extended features are flagged in multiple bytes (see
7665 * &struct wiphy.@ext_features)
7668 wiphy_ext_feature_isset(struct wiphy *wiphy,
7669 enum nl80211_ext_feature_index ftidx)
7673 ft_byte = wiphy->ext_features[ftidx / 8];
7674 return (ft_byte & BIT(ftidx % 8)) != 0;
7678 * cfg80211_free_nan_func - free NAN function
7679 * @f: NAN function that should be freed
7681 * Frees all the NAN function and all it's allocated members.
7683 void cfg80211_free_nan_func(struct cfg80211_nan_func *f);
7686 * struct cfg80211_nan_match_params - NAN match parameters
7687 * @type: the type of the function that triggered a match. If it is
7688 * %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
7689 * If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
7691 * If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
7692 * @inst_id: the local instance id
7693 * @peer_inst_id: the instance id of the peer's function
7694 * @addr: the MAC address of the peer
7695 * @info_len: the length of the &info
7696 * @info: the Service Specific Info from the peer (if any)
7697 * @cookie: unique identifier of the corresponding function
7699 struct cfg80211_nan_match_params {
7700 enum nl80211_nan_function_type type;
7710 * cfg80211_nan_match - report a match for a NAN function.
7711 * @wdev: the wireless device reporting the match
7712 * @match: match notification parameters
7713 * @gfp: allocation flags
7715 * This function reports that the a NAN function had a match. This
7716 * can be a subscribe that had a match or a solicited publish that
7717 * was sent. It can also be a follow up that was received.
7719 void cfg80211_nan_match(struct wireless_dev *wdev,
7720 struct cfg80211_nan_match_params *match, gfp_t gfp);
7723 * cfg80211_nan_func_terminated - notify about NAN function termination.
7725 * @wdev: the wireless device reporting the match
7726 * @inst_id: the local instance id
7727 * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7728 * @cookie: unique NAN function identifier
7729 * @gfp: allocation flags
7731 * This function reports that the a NAN function is terminated.
7733 void cfg80211_nan_func_terminated(struct wireless_dev *wdev,
7735 enum nl80211_nan_func_term_reason reason,
7736 u64 cookie, gfp_t gfp);
7738 /* ethtool helper */
7739 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
7742 * cfg80211_external_auth_request - userspace request for authentication
7743 * @netdev: network device
7744 * @params: External authentication parameters
7745 * @gfp: allocation flags
7746 * Returns: 0 on success, < 0 on error
7748 int cfg80211_external_auth_request(struct net_device *netdev,
7749 struct cfg80211_external_auth_params *params,
7753 * cfg80211_pmsr_report - report peer measurement result data
7754 * @wdev: the wireless device reporting the measurement
7755 * @req: the original measurement request
7756 * @result: the result data
7757 * @gfp: allocation flags
7759 void cfg80211_pmsr_report(struct wireless_dev *wdev,
7760 struct cfg80211_pmsr_request *req,
7761 struct cfg80211_pmsr_result *result,
7765 * cfg80211_pmsr_complete - report peer measurement completed
7766 * @wdev: the wireless device reporting the measurement
7767 * @req: the original measurement request
7768 * @gfp: allocation flags
7770 * Report that the entire measurement completed, after this
7771 * the request pointer will no longer be valid.
7773 void cfg80211_pmsr_complete(struct wireless_dev *wdev,
7774 struct cfg80211_pmsr_request *req,
7778 * cfg80211_iftype_allowed - check whether the interface can be allowed
7780 * @iftype: interface type
7781 * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
7782 * @check_swif: check iftype against software interfaces
7784 * Check whether the interface is allowed to operate; additionally, this API
7785 * can be used to check iftype against the software interfaces when
7786 * check_swif is '1'.
7788 bool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
7789 bool is_4addr, u8 check_swif);
7792 /* Logging, debugging and troubleshooting/diagnostic helpers. */
7794 /* wiphy_printk helpers, similar to dev_printk */
7796 #define wiphy_printk(level, wiphy, format, args...) \
7797 dev_printk(level, &(wiphy)->dev, format, ##args)
7798 #define wiphy_emerg(wiphy, format, args...) \
7799 dev_emerg(&(wiphy)->dev, format, ##args)
7800 #define wiphy_alert(wiphy, format, args...) \
7801 dev_alert(&(wiphy)->dev, format, ##args)
7802 #define wiphy_crit(wiphy, format, args...) \
7803 dev_crit(&(wiphy)->dev, format, ##args)
7804 #define wiphy_err(wiphy, format, args...) \
7805 dev_err(&(wiphy)->dev, format, ##args)
7806 #define wiphy_warn(wiphy, format, args...) \
7807 dev_warn(&(wiphy)->dev, format, ##args)
7808 #define wiphy_notice(wiphy, format, args...) \
7809 dev_notice(&(wiphy)->dev, format, ##args)
7810 #define wiphy_info(wiphy, format, args...) \
7811 dev_info(&(wiphy)->dev, format, ##args)
7813 #define wiphy_err_ratelimited(wiphy, format, args...) \
7814 dev_err_ratelimited(&(wiphy)->dev, format, ##args)
7815 #define wiphy_warn_ratelimited(wiphy, format, args...) \
7816 dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
7818 #define wiphy_debug(wiphy, format, args...) \
7819 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
7821 #define wiphy_dbg(wiphy, format, args...) \
7822 dev_dbg(&(wiphy)->dev, format, ##args)
7824 #if defined(VERBOSE_DEBUG)
7825 #define wiphy_vdbg wiphy_dbg
7827 #define wiphy_vdbg(wiphy, format, args...) \
7830 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
7836 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
7837 * of using a WARN/WARN_ON to get the message out, including the
7838 * file/line information and a backtrace.
7840 #define wiphy_WARN(wiphy, format, args...) \
7841 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
7844 * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
7845 * @netdev: network device
7846 * @owe_info: peer's owe info
7847 * @gfp: allocation flags
7849 void cfg80211_update_owe_info_event(struct net_device *netdev,
7850 struct cfg80211_update_owe_info *owe_info,
7853 #endif /* __NET_CFG80211_H */