1 #ifndef __NET_CFG80211_H
2 #define __NET_CFG80211_H
4 * 802.11 device and configuration interface
6 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
7 * Copyright 2013-2014 Intel Mobile Communications GmbH
8 * Copyright 2015 Intel Deutschland GmbH
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/netdevice.h>
16 #include <linux/debugfs.h>
17 #include <linux/list.h>
18 #include <linux/bug.h>
19 #include <linux/netlink.h>
20 #include <linux/skbuff.h>
21 #include <linux/nl80211.h>
22 #include <linux/if_ether.h>
23 #include <linux/ieee80211.h>
24 #include <linux/net.h>
25 #include <net/regulatory.h>
27 /* Indicate backport support for external authentication*/
28 #define CFG80211_EXTERNAL_AUTH_SUPPORT 1
30 /* Indicate backport support for external authentication in AP mode */
31 #define CFG80211_EXTERNAL_AUTH_AP_SUPPORT 1
36 * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
37 * userspace and drivers, and offers some utility functionality associated
38 * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
39 * by all modern wireless drivers in Linux, so that they offer a consistent
40 * API through nl80211. For backward compatibility, cfg80211 also offers
41 * wireless extensions to userspace, but hides them from drivers completely.
43 * Additionally, cfg80211 contains code to help enforce regulatory spectrum
49 * DOC: Device registration
51 * In order for a driver to use cfg80211, it must register the hardware device
52 * with cfg80211. This happens through a number of hardware capability structs
55 * The fundamental structure for each device is the 'wiphy', of which each
56 * instance describes a physical wireless device connected to the system. Each
57 * such wiphy can have zero, one, or many virtual interfaces associated with
58 * it, which need to be identified as such by pointing the network interface's
59 * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
60 * the wireless part of the interface, normally this struct is embedded in the
61 * network interface's private data area. Drivers can optionally allow creating
62 * or destroying virtual interfaces on the fly, but without at least one or the
63 * ability to create some the wireless device isn't useful.
65 * Each wiphy structure contains device capability information, and also has
66 * a pointer to the various operations the driver offers. The definitions and
67 * structures here describe these capabilities in detail.
72 #define CFG80211_SCAN_BSSID 1
73 #define CFG80211_CONNECT_PREV_BSSID 1
74 #define CFG80211_CONNECT_BSS 1
75 #define CFG80211_ABORT_SCAN 1
76 #define CFG80211_UPDATE_CONNECT_PARAMS 1
77 #define CFG80211_BEACON_TX_RATE_CUSTOM_BACKPORT 1
78 #define CFG80211_RAND_TA_FOR_PUBLIC_ACTION_FRAME 1
79 #define CFG80211_REPORT_BETTER_BSS_IN_SCHED_SCAN 1
80 #define CFG80211_CONNECT_TIMEOUT 1
81 #define CFG80211_CONNECT_TIMEOUT_REASON_CODE 1
83 /* Indicate backport support for the new connect done api */
84 #define CFG80211_CONNECT_DONE 1
85 /* Indicate backport support for FILS SK offload in cfg80211 */
86 #define CFG80211_FILS_SK_OFFLOAD_SUPPORT 1
88 /* Indicate support for including KEK length in rekey data */
89 #define CFG80211_REKEY_DATA_KEK_LEN 1
91 /* Indicate backport support for processing user cell base hint */
92 #define CFG80211_USER_HINT_CELL_BASE_SELF_MANAGED 1
95 * wireless hardware capability structures
99 * enum ieee80211_band - supported frequency bands
101 * The bands are assigned this way because the supported
102 * bitrates differ in these bands.
104 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
105 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
106 * @IEEE80211_BAND_60GHZ: around 60 GHz band (58.32 - 64.80 GHz)
107 * @IEEE80211_NUM_BANDS: number of defined bands
109 enum ieee80211_band {
110 IEEE80211_BAND_2GHZ = NL80211_BAND_2GHZ,
111 IEEE80211_BAND_5GHZ = NL80211_BAND_5GHZ,
112 IEEE80211_BAND_60GHZ = NL80211_BAND_60GHZ,
119 * enum ieee80211_channel_flags - channel flags
121 * Channel flags set by the regulatory control code.
123 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
124 * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
125 * sending probe requests or beaconing.
126 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
127 * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
129 * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
131 * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
132 * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
133 * this flag indicates that an 80 MHz channel cannot use this
134 * channel as the control or any of the secondary channels.
135 * This may be due to the driver or due to regulatory bandwidth
137 * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
138 * this flag indicates that an 160 MHz channel cannot use this
139 * channel as the control or any of the secondary channels.
140 * This may be due to the driver or due to regulatory bandwidth
142 * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
143 * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
144 * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
146 * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
150 enum ieee80211_channel_flags {
151 IEEE80211_CHAN_DISABLED = 1<<0,
152 IEEE80211_CHAN_NO_IR = 1<<1,
154 IEEE80211_CHAN_RADAR = 1<<3,
155 IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
156 IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
157 IEEE80211_CHAN_NO_OFDM = 1<<6,
158 IEEE80211_CHAN_NO_80MHZ = 1<<7,
159 IEEE80211_CHAN_NO_160MHZ = 1<<8,
160 IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
161 IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
162 IEEE80211_CHAN_NO_20MHZ = 1<<11,
163 IEEE80211_CHAN_NO_10MHZ = 1<<12,
166 #define IEEE80211_CHAN_NO_HT40 \
167 (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
169 #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
170 #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
173 * struct ieee80211_channel - channel definition
175 * This structure describes a single channel for use
178 * @center_freq: center frequency in MHz
179 * @hw_value: hardware-specific value for the channel
180 * @flags: channel flags from &enum ieee80211_channel_flags.
181 * @orig_flags: channel flags at registration time, used by regulatory
182 * code to support devices with additional restrictions
183 * @band: band this channel belongs to.
184 * @max_antenna_gain: maximum antenna gain in dBi
185 * @max_power: maximum transmission power (in dBm)
186 * @max_reg_power: maximum regulatory transmission power (in dBm)
187 * @beacon_found: helper to regulatory code to indicate when a beacon
188 * has been found on this channel. Use regulatory_hint_found_beacon()
189 * to enable this, this is useful only on 5 GHz band.
190 * @orig_mag: internal use
191 * @orig_mpwr: internal use
192 * @dfs_state: current state of this channel. Only relevant if radar is required
194 * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
195 * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
197 struct ieee80211_channel {
198 enum ieee80211_band band;
202 int max_antenna_gain;
207 int orig_mag, orig_mpwr;
208 enum nl80211_dfs_state dfs_state;
209 unsigned long dfs_state_entered;
210 unsigned int dfs_cac_ms;
214 * enum ieee80211_rate_flags - rate flags
216 * Hardware/specification flags for rates. These are structured
217 * in a way that allows using the same bitrate structure for
218 * different bands/PHY modes.
220 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
221 * preamble on this bitrate; only relevant in 2.4GHz band and
223 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
224 * when used with 802.11a (on the 5 GHz band); filled by the
225 * core code when registering the wiphy.
226 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
227 * when used with 802.11b (on the 2.4 GHz band); filled by the
228 * core code when registering the wiphy.
229 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
230 * when used with 802.11g (on the 2.4 GHz band); filled by the
231 * core code when registering the wiphy.
232 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
233 * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
234 * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
236 enum ieee80211_rate_flags {
237 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
238 IEEE80211_RATE_MANDATORY_A = 1<<1,
239 IEEE80211_RATE_MANDATORY_B = 1<<2,
240 IEEE80211_RATE_MANDATORY_G = 1<<3,
241 IEEE80211_RATE_ERP_G = 1<<4,
242 IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
243 IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
247 * enum ieee80211_bss_type - BSS type filter
249 * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
250 * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
251 * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
252 * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
253 * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
255 enum ieee80211_bss_type {
256 IEEE80211_BSS_TYPE_ESS,
257 IEEE80211_BSS_TYPE_PBSS,
258 IEEE80211_BSS_TYPE_IBSS,
259 IEEE80211_BSS_TYPE_MBSS,
260 IEEE80211_BSS_TYPE_ANY
264 * enum ieee80211_privacy - BSS privacy filter
266 * @IEEE80211_PRIVACY_ON: privacy bit set
267 * @IEEE80211_PRIVACY_OFF: privacy bit clear
268 * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
270 enum ieee80211_privacy {
271 IEEE80211_PRIVACY_ON,
272 IEEE80211_PRIVACY_OFF,
273 IEEE80211_PRIVACY_ANY
276 #define IEEE80211_PRIVACY(x) \
277 ((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
280 * struct ieee80211_rate - bitrate definition
282 * This structure describes a bitrate that an 802.11 PHY can
283 * operate with. The two values @hw_value and @hw_value_short
284 * are only for driver use when pointers to this structure are
287 * @flags: rate-specific flags
288 * @bitrate: bitrate in units of 100 Kbps
289 * @hw_value: driver/hardware value for this rate
290 * @hw_value_short: driver/hardware value for this rate when
291 * short preamble is used
293 struct ieee80211_rate {
296 u16 hw_value, hw_value_short;
300 * struct ieee80211_sta_ht_cap - STA's HT capabilities
302 * This structure describes most essential parameters needed
303 * to describe 802.11n HT capabilities for an STA.
305 * @ht_supported: is HT supported by the STA
306 * @cap: HT capabilities map as described in 802.11n spec
307 * @ampdu_factor: Maximum A-MPDU length factor
308 * @ampdu_density: Minimum A-MPDU spacing
309 * @mcs: Supported MCS rates
311 struct ieee80211_sta_ht_cap {
312 u16 cap; /* use IEEE80211_HT_CAP_ */
316 struct ieee80211_mcs_info mcs;
320 * struct ieee80211_sta_vht_cap - STA's VHT capabilities
322 * This structure describes most essential parameters needed
323 * to describe 802.11ac VHT capabilities for an STA.
325 * @vht_supported: is VHT supported by the STA
326 * @cap: VHT capabilities map as described in 802.11ac spec
327 * @vht_mcs: Supported VHT MCS rates
329 struct ieee80211_sta_vht_cap {
331 u32 cap; /* use IEEE80211_VHT_CAP_ */
332 struct ieee80211_vht_mcs_info vht_mcs;
336 * struct ieee80211_supported_band - frequency band definition
338 * This structure describes a frequency band a wiphy
339 * is able to operate in.
341 * @channels: Array of channels the hardware can operate in
343 * @band: the band this structure represents
344 * @n_channels: Number of channels in @channels
345 * @bitrates: Array of bitrates the hardware can operate with
346 * in this band. Must be sorted to give a valid "supported
347 * rates" IE, i.e. CCK rates first, then OFDM.
348 * @n_bitrates: Number of bitrates in @bitrates
349 * @ht_cap: HT capabilities in this band
350 * @vht_cap: VHT capabilities in this band
352 struct ieee80211_supported_band {
353 struct ieee80211_channel *channels;
354 struct ieee80211_rate *bitrates;
355 enum ieee80211_band band;
358 struct ieee80211_sta_ht_cap ht_cap;
359 struct ieee80211_sta_vht_cap vht_cap;
363 * Wireless hardware/device configuration structures and methods
367 * DOC: Actions and configuration
369 * Each wireless device and each virtual interface offer a set of configuration
370 * operations and other actions that are invoked by userspace. Each of these
371 * actions is described in the operations structure, and the parameters these
372 * operations use are described separately.
374 * Additionally, some operations are asynchronous and expect to get status
375 * information via some functions that drivers need to call.
377 * Scanning and BSS list handling with its associated functionality is described
378 * in a separate chapter.
382 * struct vif_params - describes virtual interface parameters
383 * @use_4addr: use 4-address frames
384 * @macaddr: address to use for this virtual interface.
385 * If this parameter is set to zero address the driver may
386 * determine the address as needed.
387 * This feature is only fully supported by drivers that enable the
388 * %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
389 ** only p2p devices with specified MAC.
393 u8 macaddr[ETH_ALEN];
397 * struct key_params - key information
399 * Information about a key
402 * @key_len: length of key material
403 * @cipher: cipher suite selector
404 * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
405 * with the get_key() callback, must be in little endian,
406 * length given by @seq_len.
407 * @seq_len: length of @seq.
418 * struct cfg80211_chan_def - channel definition
419 * @chan: the (control) channel
420 * @width: channel width
421 * @center_freq1: center frequency of first segment
422 * @center_freq2: center frequency of second segment
423 * (only with 80+80 MHz)
425 struct cfg80211_chan_def {
426 struct ieee80211_channel *chan;
427 enum nl80211_chan_width width;
433 * cfg80211_get_chandef_type - return old channel type from chandef
434 * @chandef: the channel definition
436 * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
437 * chandef, which must have a bandwidth allowing this conversion.
439 static inline enum nl80211_channel_type
440 cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
442 switch (chandef->width) {
443 case NL80211_CHAN_WIDTH_20_NOHT:
444 return NL80211_CHAN_NO_HT;
445 case NL80211_CHAN_WIDTH_20:
446 return NL80211_CHAN_HT20;
447 case NL80211_CHAN_WIDTH_40:
448 if (chandef->center_freq1 > chandef->chan->center_freq)
449 return NL80211_CHAN_HT40PLUS;
450 return NL80211_CHAN_HT40MINUS;
453 return NL80211_CHAN_NO_HT;
458 * cfg80211_chandef_create - create channel definition using channel type
459 * @chandef: the channel definition struct to fill
460 * @channel: the control channel
461 * @chantype: the channel type
463 * Given a channel type, create a channel definition.
465 void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
466 struct ieee80211_channel *channel,
467 enum nl80211_channel_type chantype);
470 * cfg80211_chandef_identical - check if two channel definitions are identical
471 * @chandef1: first channel definition
472 * @chandef2: second channel definition
474 * Return: %true if the channels defined by the channel definitions are
475 * identical, %false otherwise.
478 cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
479 const struct cfg80211_chan_def *chandef2)
481 return (chandef1->chan == chandef2->chan &&
482 chandef1->width == chandef2->width &&
483 chandef1->center_freq1 == chandef2->center_freq1 &&
484 chandef1->center_freq2 == chandef2->center_freq2);
488 * cfg80211_chandef_compatible - check if two channel definitions are compatible
489 * @chandef1: first channel definition
490 * @chandef2: second channel definition
492 * Return: %NULL if the given channel definitions are incompatible,
493 * chandef1 or chandef2 otherwise.
495 const struct cfg80211_chan_def *
496 cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
497 const struct cfg80211_chan_def *chandef2);
500 * cfg80211_chandef_valid - check if a channel definition is valid
501 * @chandef: the channel definition to check
502 * Return: %true if the channel definition is valid. %false otherwise.
504 bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
507 * cfg80211_chandef_usable - check if secondary channels can be used
508 * @wiphy: the wiphy to validate against
509 * @chandef: the channel definition to check
510 * @prohibited_flags: the regulatory channel flags that must not be set
511 * Return: %true if secondary channels are usable. %false otherwise.
513 bool cfg80211_chandef_usable(struct wiphy *wiphy,
514 const struct cfg80211_chan_def *chandef,
515 u32 prohibited_flags);
518 * cfg80211_chandef_dfs_required - checks if radar detection is required
519 * @wiphy: the wiphy to validate against
520 * @chandef: the channel definition to check
521 * @iftype: the interface type as specified in &enum nl80211_iftype
523 * 1 if radar detection is required, 0 if it is not, < 0 on error
525 int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
526 const struct cfg80211_chan_def *chandef,
527 enum nl80211_iftype iftype);
530 * ieee80211_chandef_rate_flags - returns rate flags for a channel
532 * In some channel types, not all rates may be used - for example CCK
533 * rates may not be used in 5/10 MHz channels.
535 * @chandef: channel definition for the channel
537 * Returns: rate flags which apply for this channel
539 static inline enum ieee80211_rate_flags
540 ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
542 switch (chandef->width) {
543 case NL80211_CHAN_WIDTH_5:
544 return IEEE80211_RATE_SUPPORTS_5MHZ;
545 case NL80211_CHAN_WIDTH_10:
546 return IEEE80211_RATE_SUPPORTS_10MHZ;
554 * ieee80211_chandef_max_power - maximum transmission power for the chandef
556 * In some regulations, the transmit power may depend on the configured channel
557 * bandwidth which may be defined as dBm/MHz. This function returns the actual
558 * max_power for non-standard (20 MHz) channels.
560 * @chandef: channel definition for the channel
562 * Returns: maximum allowed transmission power in dBm for the chandef
565 ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
567 switch (chandef->width) {
568 case NL80211_CHAN_WIDTH_5:
569 return min(chandef->chan->max_reg_power - 6,
570 chandef->chan->max_power);
571 case NL80211_CHAN_WIDTH_10:
572 return min(chandef->chan->max_reg_power - 3,
573 chandef->chan->max_power);
577 return chandef->chan->max_power;
581 * enum survey_info_flags - survey information flags
583 * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
584 * @SURVEY_INFO_IN_USE: channel is currently being used
585 * @SURVEY_INFO_TIME: active time (in ms) was filled in
586 * @SURVEY_INFO_TIME_BUSY: busy time was filled in
587 * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
588 * @SURVEY_INFO_TIME_RX: receive time was filled in
589 * @SURVEY_INFO_TIME_TX: transmit time was filled in
590 * @SURVEY_INFO_TIME_SCAN: scan time was filled in
592 * Used by the driver to indicate which info in &struct survey_info
593 * it has filled in during the get_survey().
595 enum survey_info_flags {
596 SURVEY_INFO_NOISE_DBM = BIT(0),
597 SURVEY_INFO_IN_USE = BIT(1),
598 SURVEY_INFO_TIME = BIT(2),
599 SURVEY_INFO_TIME_BUSY = BIT(3),
600 SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
601 SURVEY_INFO_TIME_RX = BIT(5),
602 SURVEY_INFO_TIME_TX = BIT(6),
603 SURVEY_INFO_TIME_SCAN = BIT(7),
607 * struct survey_info - channel survey response
609 * @channel: the channel this survey record reports, may be %NULL for a single
610 * record to report global statistics
611 * @filled: bitflag of flags from &enum survey_info_flags
612 * @noise: channel noise in dBm. This and all following fields are
614 * @time: amount of time in ms the radio was turn on (on the channel)
615 * @time_busy: amount of time the primary channel was sensed busy
616 * @time_ext_busy: amount of time the extension channel was sensed busy
617 * @time_rx: amount of time the radio spent receiving data
618 * @time_tx: amount of time the radio spent transmitting data
619 * @time_scan: amount of time the radio spent for scanning
621 * Used by dump_survey() to report back per-channel survey information.
623 * This structure can later be expanded with things like
624 * channel duty cycle etc.
627 struct ieee80211_channel *channel;
639 * struct cfg80211_crypto_settings - Crypto settings
640 * @wpa_versions: indicates which, if any, WPA versions are enabled
641 * (from enum nl80211_wpa_versions)
642 * @cipher_group: group key cipher suite (or 0 if unset)
643 * @n_ciphers_pairwise: number of AP supported unicast ciphers
644 * @ciphers_pairwise: unicast key cipher suites
645 * @n_akm_suites: number of AKM suites
646 * @akm_suites: AKM suites
647 * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
648 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
649 * required to assume that the port is unauthorized until authorized by
650 * user space. Otherwise, port is marked authorized by default.
651 * @control_port_ethertype: the control port protocol that should be
652 * allowed through even on unauthorized ports
653 * @control_port_no_encrypt: TRUE to prevent encryption of control port
656 struct cfg80211_crypto_settings {
659 int n_ciphers_pairwise;
660 u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
662 u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
664 __be16 control_port_ethertype;
665 bool control_port_no_encrypt;
669 * struct cfg80211_beacon_data - beacon data
670 * @head: head portion of beacon (before TIM IE)
671 * or %NULL if not changed
672 * @tail: tail portion of beacon (after TIM IE)
673 * or %NULL if not changed
674 * @head_len: length of @head
675 * @tail_len: length of @tail
676 * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
677 * @beacon_ies_len: length of beacon_ies in octets
678 * @proberesp_ies: extra information element(s) to add into Probe Response
680 * @proberesp_ies_len: length of proberesp_ies in octets
681 * @assocresp_ies: extra information element(s) to add into (Re)Association
682 * Response frames or %NULL
683 * @assocresp_ies_len: length of assocresp_ies in octets
684 * @probe_resp_len: length of probe response template (@probe_resp)
685 * @probe_resp: probe response template (AP mode only)
687 struct cfg80211_beacon_data {
688 const u8 *head, *tail;
689 const u8 *beacon_ies;
690 const u8 *proberesp_ies;
691 const u8 *assocresp_ies;
692 const u8 *probe_resp;
694 size_t head_len, tail_len;
695 size_t beacon_ies_len;
696 size_t proberesp_ies_len;
697 size_t assocresp_ies_len;
698 size_t probe_resp_len;
706 * struct cfg80211_acl_data - Access control list data
708 * @acl_policy: ACL policy to be applied on the station's
709 * entry specified by mac_addr
710 * @n_acl_entries: Number of MAC address entries passed
711 * @mac_addrs: List of MAC addresses of stations to be used for ACL
713 struct cfg80211_acl_data {
714 enum nl80211_acl_policy acl_policy;
718 struct mac_address mac_addrs[];
722 * cfg80211_bitrate_mask - masks for bitrate control
724 struct cfg80211_bitrate_mask {
727 u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
728 u16 vht_mcs[NL80211_VHT_NSS_MAX];
729 enum nl80211_txrate_gi gi;
730 } control[IEEE80211_NUM_BANDS];
734 * enum cfg80211_ap_settings_flags - AP settings flags
736 * Used by cfg80211_ap_settings
738 * @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
740 enum cfg80211_ap_settings_flags {
741 AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
745 * struct cfg80211_ap_settings - AP configuration
747 * Used to configure an AP interface.
749 * @chandef: defines the channel to use
750 * @beacon: beacon data
751 * @beacon_interval: beacon interval
752 * @dtim_period: DTIM period
753 * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
755 * @ssid_len: length of @ssid
756 * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
757 * @crypto: crypto settings
758 * @privacy: the BSS uses privacy
759 * @auth_type: Authentication type (algorithm)
760 * @smps_mode: SMPS mode
761 * @inactivity_timeout: time in seconds to determine station's inactivity.
762 * @p2p_ctwindow: P2P CT Window
763 * @p2p_opp_ps: P2P opportunistic PS
764 * @acl: ACL configuration used by the drivers which has support for
765 * MAC address based access control
766 * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
768 * @beacon_rate: bitrate to be used for beacons
769 * @flags: flags, as defined in enum cfg80211_ap_settings_flags
771 struct cfg80211_ap_settings {
772 struct cfg80211_chan_def chandef;
774 struct cfg80211_beacon_data beacon;
776 int beacon_interval, dtim_period;
779 enum nl80211_hidden_ssid hidden_ssid;
780 struct cfg80211_crypto_settings crypto;
782 enum nl80211_auth_type auth_type;
783 enum nl80211_smps_mode smps_mode;
784 int inactivity_timeout;
787 const struct cfg80211_acl_data *acl;
789 struct cfg80211_bitrate_mask beacon_rate;
794 * struct cfg80211_csa_settings - channel switch settings
796 * Used for channel switch
798 * @chandef: defines the channel to use after the switch
799 * @beacon_csa: beacon data while performing the switch
800 * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
801 * @counter_offsets_presp: offsets of the counters within the probe response
802 * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
803 * @n_counter_offsets_presp: number of csa counters in the probe response
804 * @beacon_after: beacon data to be used on the new channel
805 * @radar_required: whether radar detection is required on the new channel
806 * @block_tx: whether transmissions should be blocked while changing
807 * @count: number of beacons until switch
809 struct cfg80211_csa_settings {
810 struct cfg80211_chan_def chandef;
811 struct cfg80211_beacon_data beacon_csa;
812 const u16 *counter_offsets_beacon;
813 const u16 *counter_offsets_presp;
814 unsigned int n_counter_offsets_beacon;
815 unsigned int n_counter_offsets_presp;
816 struct cfg80211_beacon_data beacon_after;
823 * struct iface_combination_params - input parameters for interface combinations
825 * Used to pass interface combination parameters
827 * @num_different_channels: the number of different channels we want
828 * to use for verification
829 * @radar_detect: a bitmap where each bit corresponds to a channel
830 * width where radar detection is needed, as in the definition of
831 * &struct ieee80211_iface_combination.@radar_detect_widths
832 * @iftype_num: array with the number of interfaces of each interface
833 * type. The index is the interface type as specified in &enum
835 * @new_beacon_int: set this to the beacon interval of a new interface
836 * that's not operating yet, if such is to be checked as part of
839 struct iface_combination_params {
840 int num_different_channels;
842 int iftype_num[NUM_NL80211_IFTYPES];
847 * enum station_parameters_apply_mask - station parameter values to apply
848 * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
849 * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
850 * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
852 * Not all station parameters have in-band "no change" signalling,
853 * for those that don't these flags will are used.
855 enum station_parameters_apply_mask {
856 STATION_PARAM_APPLY_UAPSD = BIT(0),
857 STATION_PARAM_APPLY_CAPABILITY = BIT(1),
858 STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
862 * struct station_parameters - station parameters
864 * Used to change and create a new station.
866 * @vlan: vlan interface station should belong to
867 * @supported_rates: supported rates in IEEE 802.11 format
868 * (or NULL for no change)
869 * @supported_rates_len: number of supported rates
870 * @sta_flags_mask: station flags that changed
871 * (bitmask of BIT(NL80211_STA_FLAG_...))
872 * @sta_flags_set: station flags values
873 * (bitmask of BIT(NL80211_STA_FLAG_...))
874 * @listen_interval: listen interval or -1 for no change
875 * @aid: AID or zero for no change
876 * @plink_action: plink action to take
877 * @plink_state: set the peer link state for a station
878 * @ht_capa: HT capabilities of station
879 * @vht_capa: VHT capabilities of station
880 * @uapsd_queues: bitmap of queues configured for uapsd. same format
881 * as the AC bitmap in the QoS info field
882 * @max_sp: max Service Period. same format as the MAX_SP in the
883 * QoS info field (but already shifted down)
884 * @sta_modify_mask: bitmap indicating which parameters changed
885 * (for those that don't have a natural "no change" value),
886 * see &enum station_parameters_apply_mask
887 * @local_pm: local link-specific mesh power save mode (no change when set
889 * @capability: station capability
890 * @ext_capab: extended capabilities of the station
891 * @ext_capab_len: number of extended capabilities
892 * @supported_channels: supported channels in IEEE 802.11 format
893 * @supported_channels_len: number of supported channels
894 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
895 * @supported_oper_classes_len: number of supported operating classes
896 * @opmode_notif: operating mode field from Operating Mode Notification
897 * @opmode_notif_used: information if operating mode field is used
899 struct station_parameters {
900 const u8 *supported_rates;
901 struct net_device *vlan;
902 u32 sta_flags_mask, sta_flags_set;
906 u8 supported_rates_len;
909 const struct ieee80211_ht_cap *ht_capa;
910 const struct ieee80211_vht_cap *vht_capa;
913 enum nl80211_mesh_power_mode local_pm;
917 const u8 *supported_channels;
918 u8 supported_channels_len;
919 const u8 *supported_oper_classes;
920 u8 supported_oper_classes_len;
922 bool opmode_notif_used;
926 * struct station_del_parameters - station deletion parameters
928 * Used to delete a station entry (or all stations).
930 * @mac: MAC address of the station to remove or NULL to remove all stations
931 * @subtype: Management frame subtype to use for indicating removal
932 * (10 = Disassociation, 12 = Deauthentication)
933 * @reason_code: Reason code for the Disassociation/Deauthentication frame
935 struct station_del_parameters {
942 * enum cfg80211_station_type - the type of station being modified
943 * @CFG80211_STA_AP_CLIENT: client of an AP interface
944 * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
945 * unassociated (update properties for this type of client is permitted)
946 * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
947 * the AP MLME in the device
948 * @CFG80211_STA_AP_STA: AP station on managed interface
949 * @CFG80211_STA_IBSS: IBSS station
950 * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
951 * while TDLS setup is in progress, it moves out of this state when
952 * being marked authorized; use this only if TDLS with external setup is
954 * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
955 * entry that is operating, has been marked authorized by userspace)
956 * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
957 * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
959 enum cfg80211_station_type {
960 CFG80211_STA_AP_CLIENT,
961 CFG80211_STA_AP_CLIENT_UNASSOC,
962 CFG80211_STA_AP_MLME_CLIENT,
965 CFG80211_STA_TDLS_PEER_SETUP,
966 CFG80211_STA_TDLS_PEER_ACTIVE,
967 CFG80211_STA_MESH_PEER_KERNEL,
968 CFG80211_STA_MESH_PEER_USER,
972 * cfg80211_check_station_change - validate parameter changes
973 * @wiphy: the wiphy this operates on
974 * @params: the new parameters for a station
975 * @statype: the type of station being modified
977 * Utility function for the @change_station driver method. Call this function
978 * with the appropriate station type looking up the station (and checking that
979 * it exists). It will verify whether the station change is acceptable, and if
980 * not will return an error code. Note that it may modify the parameters for
981 * backward compatibility reasons, so don't use them before calling this.
983 int cfg80211_check_station_change(struct wiphy *wiphy,
984 struct station_parameters *params,
985 enum cfg80211_station_type statype);
988 * enum station_info_rate_flags - bitrate info flags
990 * Used by the driver to indicate the specific rate transmission
991 * type for 802.11n transmissions.
993 * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
994 * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
995 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
996 * @RATE_INFO_FLAGS_60G: 60GHz MCS
998 enum rate_info_flags {
999 RATE_INFO_FLAGS_MCS = BIT(0),
1000 RATE_INFO_FLAGS_VHT_MCS = BIT(1),
1001 RATE_INFO_FLAGS_SHORT_GI = BIT(2),
1002 RATE_INFO_FLAGS_60G = BIT(3),
1006 * enum rate_info_bw - rate bandwidth information
1008 * Used by the driver to indicate the rate bandwidth.
1010 * @RATE_INFO_BW_5: 5 MHz bandwidth
1011 * @RATE_INFO_BW_10: 10 MHz bandwidth
1012 * @RATE_INFO_BW_20: 20 MHz bandwidth
1013 * @RATE_INFO_BW_40: 40 MHz bandwidth
1014 * @RATE_INFO_BW_80: 80 MHz bandwidth
1015 * @RATE_INFO_BW_160: 160 MHz bandwidth
1018 RATE_INFO_BW_20 = 0,
1027 * struct rate_info - bitrate information
1029 * Information about a receiving or transmitting bitrate
1031 * @flags: bitflag of flags from &enum rate_info_flags
1032 * @mcs: mcs index if struct describes a 802.11n bitrate
1033 * @legacy: bitrate in 100kbit/s for 802.11abg
1034 * @nss: number of streams (VHT only)
1035 * @bw: bandwidth (from &enum rate_info_bw)
1046 * enum station_info_rate_flags - bitrate info flags
1048 * Used by the driver to indicate the specific rate transmission
1049 * type for 802.11n transmissions.
1051 * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
1052 * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
1053 * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
1055 enum bss_param_flags {
1056 BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
1057 BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
1058 BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
1062 * struct sta_bss_parameters - BSS parameters for the attached station
1064 * Information about the currently associated BSS
1066 * @flags: bitflag of flags from &enum bss_param_flags
1067 * @dtim_period: DTIM period for the BSS
1068 * @beacon_interval: beacon interval
1070 struct sta_bss_parameters {
1073 u16 beacon_interval;
1077 * struct cfg80211_tid_stats - per-TID statistics
1078 * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
1079 * indicate the relevant values in this struct are filled
1080 * @rx_msdu: number of received MSDUs
1081 * @tx_msdu: number of (attempted) transmitted MSDUs
1082 * @tx_msdu_retries: number of retries (not counting the first) for
1084 * @tx_msdu_failed: number of failed transmitted MSDUs
1086 struct cfg80211_tid_stats {
1090 u64 tx_msdu_retries;
1094 #define IEEE80211_MAX_CHAINS 4
1097 * struct station_info - station information
1099 * Station information filled by driver for get_station() and dump_station.
1101 * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
1102 * indicate the relevant values in this struct for them
1103 * @connected_time: time(in secs) since a station is last connected
1104 * @inactive_time: time since last station activity (tx/rx) in milliseconds
1105 * @rx_bytes: bytes (size of MPDUs) received from this station
1106 * @tx_bytes: bytes (size of MPDUs) transmitted to this station
1107 * @llid: mesh local link id
1108 * @plid: mesh peer link id
1109 * @plink_state: mesh peer link state
1110 * @signal: The signal strength, type depends on the wiphy's signal_type.
1111 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1112 * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
1113 * For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
1114 * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
1115 * @chain_signal: per-chain signal strength of last received packet in dBm
1116 * @chain_signal_avg: per-chain signal strength average in dBm
1117 * @txrate: current unicast bitrate from this station
1118 * @rxrate: current unicast bitrate to this station
1119 * @rx_packets: packets (MSDUs & MMPDUs) received from this station
1120 * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
1121 * @tx_retries: cumulative retry counts (MPDUs)
1122 * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
1123 * @rx_dropped_misc: Dropped for un-specified reason.
1124 * @bss_param: current BSS parameters
1125 * @generation: generation number for nl80211 dumps.
1126 * This number should increase every time the list of stations
1127 * changes, i.e. when a station is added or removed, so that
1128 * userspace can tell whether it got a consistent snapshot.
1129 * @assoc_req_ies: IEs from (Re)Association Request.
1130 * This is used only when in AP mode with drivers that do not use
1131 * user space MLME/SME implementation. The information is provided for
1132 * the cfg80211_new_sta() calls to notify user space of the IEs.
1133 * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
1134 * @sta_flags: station flags mask & values
1135 * @beacon_loss_count: Number of times beacon loss event has triggered.
1136 * @t_offset: Time offset of the station relative to this host.
1137 * @local_pm: local mesh STA power save mode
1138 * @peer_pm: peer mesh STA power save mode
1139 * @nonpeer_pm: non-peer mesh STA power save mode
1140 * @expected_throughput: expected throughput in kbps (including 802.11 headers)
1141 * towards this station.
1142 * @rx_beacon: number of beacons received from this peer
1143 * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
1145 * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
1146 * (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
1148 struct station_info {
1161 s8 chain_signal[IEEE80211_MAX_CHAINS];
1162 s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
1164 struct rate_info txrate;
1165 struct rate_info rxrate;
1170 u32 rx_dropped_misc;
1171 struct sta_bss_parameters bss_param;
1172 struct nl80211_sta_flag_update sta_flags;
1176 const u8 *assoc_req_ies;
1177 size_t assoc_req_ies_len;
1179 u32 beacon_loss_count;
1181 enum nl80211_mesh_power_mode local_pm;
1182 enum nl80211_mesh_power_mode peer_pm;
1183 enum nl80211_mesh_power_mode nonpeer_pm;
1185 u32 expected_throughput;
1188 u8 rx_beacon_signal_avg;
1189 struct cfg80211_tid_stats pertid[IEEE80211_NUM_TIDS + 1];
1193 * cfg80211_get_station - retrieve information about a given station
1194 * @dev: the device where the station is supposed to be connected to
1195 * @mac_addr: the mac address of the station of interest
1196 * @sinfo: pointer to the structure to fill with the information
1198 * Returns 0 on success and sinfo is filled with the available information
1199 * otherwise returns a negative error code and the content of sinfo has to be
1200 * considered undefined.
1202 int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
1203 struct station_info *sinfo);
1206 * enum monitor_flags - monitor flags
1208 * Monitor interface configuration flags. Note that these must be the bits
1209 * according to the nl80211 flags.
1211 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
1212 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
1213 * @MONITOR_FLAG_CONTROL: pass control frames
1214 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
1215 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
1216 * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
1218 enum monitor_flags {
1219 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
1220 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
1221 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
1222 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
1223 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
1224 MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
1228 * enum mpath_info_flags - mesh path information flags
1230 * Used by the driver to indicate which info in &struct mpath_info it has filled
1231 * in during get_station() or dump_station().
1233 * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
1234 * @MPATH_INFO_SN: @sn filled
1235 * @MPATH_INFO_METRIC: @metric filled
1236 * @MPATH_INFO_EXPTIME: @exptime filled
1237 * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
1238 * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
1239 * @MPATH_INFO_FLAGS: @flags filled
1241 enum mpath_info_flags {
1242 MPATH_INFO_FRAME_QLEN = BIT(0),
1243 MPATH_INFO_SN = BIT(1),
1244 MPATH_INFO_METRIC = BIT(2),
1245 MPATH_INFO_EXPTIME = BIT(3),
1246 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
1247 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
1248 MPATH_INFO_FLAGS = BIT(6),
1252 * struct mpath_info - mesh path information
1254 * Mesh path information filled by driver for get_mpath() and dump_mpath().
1256 * @filled: bitfield of flags from &enum mpath_info_flags
1257 * @frame_qlen: number of queued frames for this destination
1258 * @sn: target sequence number
1259 * @metric: metric (cost) of this mesh path
1260 * @exptime: expiration time for the mesh path from now, in msecs
1261 * @flags: mesh path flags
1262 * @discovery_timeout: total mesh path discovery timeout, in msecs
1263 * @discovery_retries: mesh path discovery retries
1264 * @generation: generation number for nl80211 dumps.
1265 * This number should increase every time the list of mesh paths
1266 * changes, i.e. when a station is added or removed, so that
1267 * userspace can tell whether it got a consistent snapshot.
1275 u32 discovery_timeout;
1276 u8 discovery_retries;
1283 * struct bss_parameters - BSS parameters
1285 * Used to change BSS parameters (mainly for AP mode).
1287 * @use_cts_prot: Whether to use CTS protection
1288 * (0 = no, 1 = yes, -1 = do not change)
1289 * @use_short_preamble: Whether the use of short preambles is allowed
1290 * (0 = no, 1 = yes, -1 = do not change)
1291 * @use_short_slot_time: Whether the use of short slot time is allowed
1292 * (0 = no, 1 = yes, -1 = do not change)
1293 * @basic_rates: basic rates in IEEE 802.11 format
1294 * (or NULL for no change)
1295 * @basic_rates_len: number of basic rates
1296 * @ap_isolate: do not forward packets between connected stations
1297 * @ht_opmode: HT Operation mode
1298 * (u16 = opmode, -1 = do not change)
1299 * @p2p_ctwindow: P2P CT Window (-1 = no change)
1300 * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
1302 struct bss_parameters {
1304 int use_short_preamble;
1305 int use_short_slot_time;
1306 const u8 *basic_rates;
1310 s8 p2p_ctwindow, p2p_opp_ps;
1314 * struct mesh_config - 802.11s mesh configuration
1316 * These parameters can be changed while the mesh is active.
1318 * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
1319 * by the Mesh Peering Open message
1320 * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
1321 * used by the Mesh Peering Open message
1322 * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
1323 * the mesh peering management to close a mesh peering
1324 * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
1326 * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
1327 * be sent to establish a new peer link instance in a mesh
1328 * @dot11MeshTTL: the value of TTL field set at a source mesh STA
1329 * @element_ttl: the value of TTL field set at a mesh STA for path selection
1331 * @auto_open_plinks: whether we should automatically open peer links when we
1332 * detect compatible mesh peers
1333 * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
1334 * synchronize to for 11s default synchronization method
1335 * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
1336 * that an originator mesh STA can send to a particular path target
1337 * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
1338 * @min_discovery_timeout: the minimum length of time to wait until giving up on
1339 * a path discovery in milliseconds
1340 * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
1341 * receiving a PREQ shall consider the forwarding information from the
1342 * root to be valid. (TU = time unit)
1343 * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
1344 * which a mesh STA can send only one action frame containing a PREQ
1346 * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
1347 * which a mesh STA can send only one Action frame containing a PERR
1349 * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
1350 * it takes for an HWMP information element to propagate across the mesh
1351 * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
1352 * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
1353 * announcements are transmitted
1354 * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
1355 * station has access to a broader network beyond the MBSS. (This is
1356 * missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
1357 * only means that the station will announce others it's a mesh gate, but
1358 * not necessarily using the gate announcement protocol. Still keeping the
1359 * same nomenclature to be in sync with the spec)
1360 * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
1361 * entity (default is TRUE - forwarding entity)
1362 * @rssi_threshold: the threshold for average signal strength of candidate
1363 * station to establish a peer link
1364 * @ht_opmode: mesh HT protection mode
1366 * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
1367 * receiving a proactive PREQ shall consider the forwarding information to
1368 * the root mesh STA to be valid.
1370 * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
1371 * PREQs are transmitted.
1372 * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
1373 * during which a mesh STA can send only one Action frame containing
1374 * a PREQ element for root path confirmation.
1375 * @power_mode: The default mesh power save mode which will be the initial
1376 * setting for new peer links.
1377 * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
1378 * after transmitting its beacon.
1379 * @plink_timeout: If no tx activity is seen from a STA we've established
1380 * peering with for longer than this time (in seconds), then remove it
1381 * from the STA's list of peers. Default is 30 minutes.
1383 struct mesh_config {
1384 u16 dot11MeshRetryTimeout;
1385 u16 dot11MeshConfirmTimeout;
1386 u16 dot11MeshHoldingTimeout;
1387 u16 dot11MeshMaxPeerLinks;
1388 u8 dot11MeshMaxRetries;
1391 bool auto_open_plinks;
1392 u32 dot11MeshNbrOffsetMaxNeighbor;
1393 u8 dot11MeshHWMPmaxPREQretries;
1394 u32 path_refresh_time;
1395 u16 min_discovery_timeout;
1396 u32 dot11MeshHWMPactivePathTimeout;
1397 u16 dot11MeshHWMPpreqMinInterval;
1398 u16 dot11MeshHWMPperrMinInterval;
1399 u16 dot11MeshHWMPnetDiameterTraversalTime;
1400 u8 dot11MeshHWMPRootMode;
1401 u16 dot11MeshHWMPRannInterval;
1402 bool dot11MeshGateAnnouncementProtocol;
1403 bool dot11MeshForwarding;
1406 u32 dot11MeshHWMPactivePathToRootTimeout;
1407 u16 dot11MeshHWMProotInterval;
1408 u16 dot11MeshHWMPconfirmationInterval;
1409 enum nl80211_mesh_power_mode power_mode;
1410 u16 dot11MeshAwakeWindowDuration;
1415 * struct mesh_setup - 802.11s mesh setup configuration
1416 * @chandef: defines the channel to use
1417 * @mesh_id: the mesh ID
1418 * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
1419 * @sync_method: which synchronization method to use
1420 * @path_sel_proto: which path selection protocol to use
1421 * @path_metric: which metric to use
1422 * @auth_id: which authentication method this mesh is using
1423 * @ie: vendor information elements (optional)
1424 * @ie_len: length of vendor information elements
1425 * @is_authenticated: this mesh requires authentication
1426 * @is_secure: this mesh uses security
1427 * @user_mpm: userspace handles all MPM functions
1428 * @dtim_period: DTIM period to use
1429 * @beacon_interval: beacon interval to use
1430 * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
1431 * @basic_rates: basic rates to use when creating the mesh
1432 * @beacon_rate: bitrate to be used for beacons
1434 * These parameters are fixed when the mesh is created.
1437 struct cfg80211_chan_def chandef;
1446 bool is_authenticated;
1450 u16 beacon_interval;
1451 int mcast_rate[IEEE80211_NUM_BANDS];
1453 struct cfg80211_bitrate_mask beacon_rate;
1457 * struct ocb_setup - 802.11p OCB mode setup configuration
1458 * @chandef: defines the channel to use
1460 * These parameters are fixed when connecting to the network
1463 struct cfg80211_chan_def chandef;
1467 * struct ieee80211_txq_params - TX queue parameters
1468 * @ac: AC identifier
1469 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
1470 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
1472 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
1474 * @aifs: Arbitration interframe space [0..255]
1476 struct ieee80211_txq_params {
1485 * DOC: Scanning and BSS list handling
1487 * The scanning process itself is fairly simple, but cfg80211 offers quite
1488 * a bit of helper functionality. To start a scan, the scan operation will
1489 * be invoked with a scan definition. This scan definition contains the
1490 * channels to scan, and the SSIDs to send probe requests for (including the
1491 * wildcard, if desired). A passive scan is indicated by having no SSIDs to
1492 * probe. Additionally, a scan request may contain extra information elements
1493 * that should be added to the probe request. The IEs are guaranteed to be
1494 * well-formed, and will not exceed the maximum length the driver advertised
1495 * in the wiphy structure.
1497 * When scanning finds a BSS, cfg80211 needs to be notified of that, because
1498 * it is responsible for maintaining the BSS list; the driver should not
1499 * maintain a list itself. For this notification, various functions exist.
1501 * Since drivers do not maintain a BSS list, there are also a number of
1502 * functions to search for a BSS and obtain information about it from the
1503 * BSS structure cfg80211 maintains. The BSS list is also made available
1508 * struct cfg80211_ssid - SSID description
1510 * @ssid_len: length of the ssid
1512 struct cfg80211_ssid {
1513 u8 ssid[IEEE80211_MAX_SSID_LEN];
1518 * struct cfg80211_scan_request - scan request description
1520 * @ssids: SSIDs to scan for (active scan only)
1521 * @n_ssids: number of SSIDs
1522 * @channels: channels to scan on.
1523 * @n_channels: total number of channels to scan
1524 * @scan_width: channel width for scanning
1525 * @ie: optional information element(s) to add into Probe Request or %NULL
1526 * @ie_len: length of ie in octets
1527 * @flags: bit field of flags controlling operation
1528 * @rates: bitmap of rates to advertise for each band
1529 * @wiphy: the wiphy this was for
1530 * @scan_start: time (in jiffies) when the scan started
1531 * @wdev: the wireless device to scan for
1532 * @aborted: (internal) scan request was notified as aborted
1533 * @notified: (internal) scan request was notified as done or aborted
1534 * @no_cck: used to send probe requests at non CCK rate in 2GHz band
1535 * @mac_addr: MAC address used with randomisation
1536 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1537 * are 0 in the mask should be randomised, bits that are 1 should
1538 * be taken from the @mac_addr
1539 * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
1541 struct cfg80211_scan_request {
1542 struct cfg80211_ssid *ssids;
1545 enum nl80211_bss_scan_width scan_width;
1550 u32 rates[IEEE80211_NUM_BANDS];
1552 struct wireless_dev *wdev;
1554 u8 mac_addr[ETH_ALEN] __aligned(2);
1555 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1556 u8 bssid[ETH_ALEN] __aligned(2);
1559 struct wiphy *wiphy;
1560 unsigned long scan_start;
1561 bool aborted, notified;
1565 struct ieee80211_channel *channels[0];
1568 static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
1572 get_random_bytes(buf, ETH_ALEN);
1573 for (i = 0; i < ETH_ALEN; i++) {
1575 buf[i] |= addr[i] & mask[i];
1580 * struct cfg80211_match_set - sets of attributes to match
1582 * @ssid: SSID to be matched; may be zero-length for no match (RSSI only)
1583 * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
1585 struct cfg80211_match_set {
1586 struct cfg80211_ssid ssid;
1591 * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
1593 * @interval: interval between scheduled scan iterations. In seconds.
1594 * @iterations: number of scan iterations in this scan plan. Zero means
1596 * The last scan plan will always have this parameter set to zero,
1597 * all other scan plans will have a finite number of iterations.
1599 struct cfg80211_sched_scan_plan {
1605 * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
1607 * @band: band of BSS which should match for RSSI level adjustment.
1608 * @delta: value of RSSI level adjustment.
1610 struct cfg80211_bss_select_adjust {
1611 enum nl80211_band band;
1616 * struct cfg80211_sched_scan_request - scheduled scan request description
1618 * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
1619 * @n_ssids: number of SSIDs
1620 * @n_channels: total number of channels to scan
1621 * @scan_width: channel width for scanning
1622 * @ie: optional information element(s) to add into Probe Request or %NULL
1623 * @ie_len: length of ie in octets
1624 * @flags: bit field of flags controlling operation
1625 * @match_sets: sets of parameters to be matched for a scan result
1626 * entry to be considered valid and to be passed to the host
1627 * (others are filtered out).
1628 * If ommited, all results are passed.
1629 * @n_match_sets: number of match sets
1630 * @wiphy: the wiphy this was for
1631 * @dev: the interface
1632 * @scan_start: start time of the scheduled scan
1633 * @channels: channels to scan
1634 * @min_rssi_thold: for drivers only supporting a single threshold, this
1635 * contains the minimum over all matchsets
1636 * @mac_addr: MAC address used with randomisation
1637 * @mac_addr_mask: MAC address mask used with randomisation, bits that
1638 * are 0 in the mask should be randomised, bits that are 1 should
1639 * be taken from the @mac_addr
1640 * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
1641 * index must be executed first.
1642 * @n_scan_plans: number of scan plans, at least 1.
1643 * @rcu_head: RCU callback used to free the struct
1644 * @owner_nlportid: netlink portid of owner (if this should is a request
1645 * owned by a particular socket)
1646 * @delay: delay in seconds to use before starting the first scan
1647 * cycle. The driver may ignore this parameter and start
1648 * immediately (or at any other time), if this feature is not
1650 * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
1651 * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
1652 * reporting in connected state to cases where a matching BSS is determined
1653 * to have better or slightly worse RSSI than the current connected BSS.
1654 * The relative RSSI threshold values are ignored in disconnected state.
1655 * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
1656 * to the specified band while deciding whether a better BSS is reported
1657 * using @relative_rssi. If delta is a negative number, the BSSs that
1658 * belong to the specified band will be penalized by delta dB in relative
1661 struct cfg80211_sched_scan_request {
1662 struct cfg80211_ssid *ssids;
1665 enum nl80211_bss_scan_width scan_width;
1669 struct cfg80211_match_set *match_sets;
1673 struct cfg80211_sched_scan_plan *scan_plans;
1676 u8 mac_addr[ETH_ALEN] __aligned(2);
1677 u8 mac_addr_mask[ETH_ALEN] __aligned(2);
1679 bool relative_rssi_set;
1681 struct cfg80211_bss_select_adjust rssi_adjust;
1684 struct wiphy *wiphy;
1685 struct net_device *dev;
1686 unsigned long scan_start;
1687 struct rcu_head rcu_head;
1691 struct ieee80211_channel *channels[0];
1695 * enum cfg80211_signal_type - signal type
1697 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
1698 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
1699 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
1701 enum cfg80211_signal_type {
1702 CFG80211_SIGNAL_TYPE_NONE,
1703 CFG80211_SIGNAL_TYPE_MBM,
1704 CFG80211_SIGNAL_TYPE_UNSPEC,
1708 * struct cfg80211_inform_bss - BSS inform data
1709 * @chan: channel the frame was received on
1710 * @scan_width: scan width that was used
1711 * @signal: signal strength value, according to the wiphy's
1713 * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
1714 * received; should match the time when the frame was actually
1715 * received by the device (not just by the host, in case it was
1716 * buffered on the device) and be accurate to about 10ms.
1717 * If the frame isn't buffered, just passing the return value of
1718 * ktime_get_boot_ns() is likely appropriate.
1720 struct cfg80211_inform_bss {
1721 struct ieee80211_channel *chan;
1722 enum nl80211_bss_scan_width scan_width;
1728 * struct cfg80211_bss_ie_data - BSS entry IE data
1729 * @tsf: TSF contained in the frame that carried these IEs
1730 * @rcu_head: internal use, for freeing
1731 * @len: length of the IEs
1732 * @from_beacon: these IEs are known to come from a beacon
1735 struct cfg80211_bss_ies {
1737 struct rcu_head rcu_head;
1744 * struct cfg80211_bss - BSS description
1746 * This structure describes a BSS (which may also be a mesh network)
1747 * for use in scan results and similar.
1749 * @channel: channel this BSS is on
1750 * @scan_width: width of the control channel
1751 * @bssid: BSSID of the BSS
1752 * @beacon_interval: the beacon interval as from the frame
1753 * @capability: the capability field in host byte order
1754 * @ies: the information elements (Note that there is no guarantee that these
1755 * are well-formed!); this is a pointer to either the beacon_ies or
1756 * proberesp_ies depending on whether Probe Response frame has been
1757 * received. It is always non-%NULL.
1758 * @beacon_ies: the information elements from the last Beacon frame
1759 * (implementation note: if @hidden_beacon_bss is set this struct doesn't
1760 * own the beacon_ies, but they're just pointers to the ones from the
1761 * @hidden_beacon_bss struct)
1762 * @proberesp_ies: the information elements from the last Probe Response frame
1763 * @hidden_beacon_bss: in case this BSS struct represents a probe response from
1764 * a BSS that hides the SSID in its beacon, this points to the BSS struct
1765 * that holds the beacon data. @beacon_ies is still valid, of course, and
1766 * points to the same data as hidden_beacon_bss->beacon_ies in that case.
1767 * @signal: signal strength value (type depends on the wiphy's signal_type)
1768 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
1770 struct cfg80211_bss {
1771 struct ieee80211_channel *channel;
1772 enum nl80211_bss_scan_width scan_width;
1774 const struct cfg80211_bss_ies __rcu *ies;
1775 const struct cfg80211_bss_ies __rcu *beacon_ies;
1776 const struct cfg80211_bss_ies __rcu *proberesp_ies;
1778 struct cfg80211_bss *hidden_beacon_bss;
1782 u16 beacon_interval;
1787 u8 priv[0] __aligned(sizeof(void *));
1791 * ieee80211_bss_get_ie - find IE with given ID
1792 * @bss: the bss to search
1795 * Note that the return value is an RCU-protected pointer, so
1796 * rcu_read_lock() must be held when calling this function.
1797 * Return: %NULL if not found.
1799 const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie);
1803 * struct cfg80211_auth_request - Authentication request data
1805 * This structure provides information needed to complete IEEE 802.11
1808 * @bss: The BSS to authenticate with, the callee must obtain a reference
1809 * to it if it needs to keep it.
1810 * @auth_type: Authentication type (algorithm)
1811 * @ie: Extra IEs to add to Authentication frame or %NULL
1812 * @ie_len: Length of ie buffer in octets
1813 * @key_len: length of WEP key for shared key authentication
1814 * @key_idx: index of WEP key for shared key authentication
1815 * @key: WEP key for shared key authentication
1816 * @auth_data: Fields and elements in Authentication frames. This contains
1817 * the authentication frame body (non-IE and IE data), excluding the
1818 * Authentication algorithm number, i.e., starting at the Authentication
1819 * transaction sequence number field.
1820 * @auth_data_len: Length of auth_data buffer in octets
1822 struct cfg80211_auth_request {
1823 struct cfg80211_bss *bss;
1826 enum nl80211_auth_type auth_type;
1828 u8 key_len, key_idx;
1829 const u8 *auth_data;
1830 size_t auth_data_len;
1834 * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
1836 * @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
1837 * @ASSOC_REQ_DISABLE_VHT: Disable VHT
1838 * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
1839 * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
1840 * authentication capability. Drivers can offload authentication to
1841 * userspace if this flag is set. Only applicable for cfg80211_connect()
1842 * request (connect callback).
1844 enum cfg80211_assoc_req_flags {
1845 ASSOC_REQ_DISABLE_HT = BIT(0),
1846 ASSOC_REQ_DISABLE_VHT = BIT(1),
1847 ASSOC_REQ_USE_RRM = BIT(2),
1848 CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
1852 * struct cfg80211_assoc_request - (Re)Association request data
1854 * This structure provides information needed to complete IEEE 802.11
1856 * @bss: The BSS to associate with. If the call is successful the driver is
1857 * given a reference that it must give back to cfg80211_send_rx_assoc()
1858 * or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
1859 * association requests while already associating must be rejected.
1860 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
1861 * @ie_len: Length of ie buffer in octets
1862 * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
1863 * @crypto: crypto settings
1864 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
1865 * @flags: See &enum cfg80211_assoc_req_flags
1866 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1867 * will be used in ht_capa. Un-supported values will be ignored.
1868 * @ht_capa_mask: The bits of ht_capa which are to be used.
1869 * @vht_capa: VHT capability override
1870 * @vht_capa_mask: VHT capability mask indicating which fields to use
1871 * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
1872 * %NULL if FILS is not used.
1873 * @fils_kek_len: Length of fils_kek in octets
1874 * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
1875 * Request/Response frame or %NULL if FILS is not used. This field starts
1876 * with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
1878 struct cfg80211_assoc_request {
1879 struct cfg80211_bss *bss;
1880 const u8 *ie, *prev_bssid;
1882 struct cfg80211_crypto_settings crypto;
1885 struct ieee80211_ht_cap ht_capa;
1886 struct ieee80211_ht_cap ht_capa_mask;
1887 struct ieee80211_vht_cap vht_capa, vht_capa_mask;
1889 size_t fils_kek_len;
1890 const u8 *fils_nonces;
1894 * struct cfg80211_deauth_request - Deauthentication request data
1896 * This structure provides information needed to complete IEEE 802.11
1899 * @bssid: the BSSID of the BSS to deauthenticate from
1900 * @ie: Extra IEs to add to Deauthentication frame or %NULL
1901 * @ie_len: Length of ie buffer in octets
1902 * @reason_code: The reason code for the deauthentication
1903 * @local_state_change: if set, change local state only and
1904 * do not set a deauth frame
1906 struct cfg80211_deauth_request {
1911 bool local_state_change;
1915 * struct cfg80211_disassoc_request - Disassociation request data
1917 * This structure provides information needed to complete IEEE 802.11
1920 * @bss: the BSS to disassociate from
1921 * @ie: Extra IEs to add to Disassociation frame or %NULL
1922 * @ie_len: Length of ie buffer in octets
1923 * @reason_code: The reason code for the disassociation
1924 * @local_state_change: This is a request for a local state only, i.e., no
1925 * Disassociation frame is to be transmitted.
1927 struct cfg80211_disassoc_request {
1928 struct cfg80211_bss *bss;
1932 bool local_state_change;
1936 * struct cfg80211_ibss_params - IBSS parameters
1938 * This structure defines the IBSS parameters for the join_ibss()
1941 * @ssid: The SSID, will always be non-null.
1942 * @ssid_len: The length of the SSID, will always be non-zero.
1943 * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
1944 * search for IBSSs with a different BSSID.
1945 * @chandef: defines the channel to use if no other IBSS to join can be found
1946 * @channel_fixed: The channel should be fixed -- do not search for
1947 * IBSSs to join on other channels.
1948 * @ie: information element(s) to include in the beacon
1949 * @ie_len: length of that
1950 * @beacon_interval: beacon interval to use
1951 * @privacy: this is a protected network, keys will be configured
1953 * @control_port: whether user space controls IEEE 802.1X port, i.e.,
1954 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1955 * required to assume that the port is unauthorized until authorized by
1956 * user space. Otherwise, port is marked authorized by default.
1957 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1958 * changes the channel when a radar is detected. This is required
1959 * to operate on DFS channels.
1960 * @basic_rates: bitmap of basic rates to use when creating the IBSS
1961 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1962 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
1963 * will be used in ht_capa. Un-supported values will be ignored.
1964 * @ht_capa_mask: The bits of ht_capa which are to be used.
1966 struct cfg80211_ibss_params {
1969 struct cfg80211_chan_def chandef;
1971 u8 ssid_len, ie_len;
1972 u16 beacon_interval;
1977 bool userspace_handles_dfs;
1978 int mcast_rate[IEEE80211_NUM_BANDS];
1979 struct ieee80211_ht_cap ht_capa;
1980 struct ieee80211_ht_cap ht_capa_mask;
1984 * struct cfg80211_bss_selection - connection parameters for BSS selection.
1986 * @behaviour: requested BSS selection behaviour.
1987 * @param: parameters for requestion behaviour.
1988 * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
1989 * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
1991 struct cfg80211_bss_selection {
1992 enum nl80211_bss_select_attr behaviour;
1994 enum ieee80211_band band_pref;
1995 struct cfg80211_bss_select_adjust adjust;
2000 * struct cfg80211_connect_params - Connection parameters
2002 * This structure provides information needed to complete IEEE 802.11
2003 * authentication and association.
2005 * @channel: The channel to use or %NULL if not specified (auto-select based
2007 * @channel_hint: The channel of the recommended BSS for initial connection or
2008 * %NULL if not specified
2009 * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
2011 * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
2012 * %NULL if not specified. Unlike the @bssid parameter, the driver is
2013 * allowed to ignore this @bssid_hint if it has knowledge of a better BSS
2016 * @ssid_len: Length of ssid in octets
2017 * @auth_type: Authentication type (algorithm)
2018 * @ie: IEs for association request
2019 * @ie_len: Length of assoc_ie in octets
2020 * @privacy: indicates whether privacy-enabled APs should be used
2021 * @mfp: indicate whether management frame protection is used
2022 * @crypto: crypto settings
2023 * @key_len: length of WEP key for shared key authentication
2024 * @key_idx: index of WEP key for shared key authentication
2025 * @key: WEP key for shared key authentication
2026 * @flags: See &enum cfg80211_assoc_req_flags
2027 * @bg_scan_period: Background scan period in seconds
2028 * or -1 to indicate that default value is to be used.
2029 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
2030 * will be used in ht_capa. Un-supported values will be ignored.
2031 * @ht_capa_mask: The bits of ht_capa which are to be used.
2032 * @vht_capa: VHT Capability overrides
2033 * @vht_capa_mask: The bits of vht_capa which are to be used.
2034 * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
2036 * @bss_select: criteria to be used for BSS selection.
2037 * @prev_bssid: previous BSSID, if not %NULL use reassociate frame
2038 * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
2039 * NAI or %NULL if not specified. This is used to construct FILS wrapped
2041 * @fils_erp_username_len: Length of @fils_erp_username in octets.
2042 * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
2043 * %NULL if not specified. This specifies the domain name of ER server and
2044 * is used to construct FILS wrapped data IE.
2045 * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
2046 * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
2047 * messages. This is also used to construct FILS wrapped data IE.
2048 * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
2049 * keys in FILS or %NULL if not specified.
2050 * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
2052 struct cfg80211_connect_params {
2053 struct ieee80211_channel *channel;
2054 struct ieee80211_channel *channel_hint;
2056 const u8 *bssid_hint;
2059 enum nl80211_auth_type auth_type;
2063 enum nl80211_mfp mfp;
2064 struct cfg80211_crypto_settings crypto;
2066 u8 key_len, key_idx;
2069 struct ieee80211_ht_cap ht_capa;
2070 struct ieee80211_ht_cap ht_capa_mask;
2071 struct ieee80211_vht_cap vht_capa;
2072 struct ieee80211_vht_cap vht_capa_mask;
2074 struct cfg80211_bss_selection bss_select;
2075 const u8 *prev_bssid;
2076 const u8 *fils_erp_username;
2077 size_t fils_erp_username_len;
2078 const u8 *fils_erp_realm;
2079 size_t fils_erp_realm_len;
2080 u16 fils_erp_next_seq_num;
2081 const u8 *fils_erp_rrk;
2082 size_t fils_erp_rrk_len;
2086 * enum cfg80211_connect_params_changed - Connection parameters being updated
2088 * This enum provides information of all connect parameters that
2089 * have to be updated as part of update_connect_params() call.
2091 * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
2092 * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
2093 * username, erp sequence number and rrk) are updated
2094 * @UPDATE_AUTH_TYPE: Indicates that Authentication type is updated
2096 enum cfg80211_connect_params_changed {
2097 UPDATE_ASSOC_IES = BIT(0),
2098 UPDATE_FILS_ERP_INFO = BIT(1),
2099 UPDATE_AUTH_TYPE = BIT(2),
2103 * enum wiphy_params_flags - set_wiphy_params bitfield values
2104 * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
2105 * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
2106 * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
2107 * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
2108 * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
2109 * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
2111 enum wiphy_params_flags {
2112 WIPHY_PARAM_RETRY_SHORT = 1 << 0,
2113 WIPHY_PARAM_RETRY_LONG = 1 << 1,
2114 WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
2115 WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
2116 WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
2117 WIPHY_PARAM_DYN_ACK = 1 << 5,
2121 * struct cfg80211_pmksa - PMK Security Association
2123 * This structure is passed to the set/del_pmksa() method for PMKSA
2126 * @bssid: The AP's BSSID (may be %NULL).
2127 * @pmkid: The identifier to refer a PMKSA.
2128 * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
2129 * derivation by a FILS STA. Otherwise, %NULL.
2130 * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
2131 * the hash algorithm used to generate this.
2132 * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
2133 * cache identifier (may be %NULL).
2134 * @ssid_len: Length of the @ssid in octets.
2135 * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
2136 * scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
2139 struct cfg80211_pmksa {
2150 * struct cfg80211_pkt_pattern - packet pattern
2151 * @mask: bitmask where to match pattern and where to ignore bytes,
2152 * one bit per byte, in same format as nl80211
2153 * @pattern: bytes to match where bitmask is 1
2154 * @pattern_len: length of pattern (in bytes)
2155 * @pkt_offset: packet offset (in bytes)
2157 * Internal note: @mask and @pattern are allocated in one chunk of
2158 * memory, free @mask only!
2160 struct cfg80211_pkt_pattern {
2161 const u8 *mask, *pattern;
2167 * struct cfg80211_wowlan_tcp - TCP connection parameters
2169 * @sock: (internal) socket for source port allocation
2170 * @src: source IP address
2171 * @dst: destination IP address
2172 * @dst_mac: destination MAC address
2173 * @src_port: source port
2174 * @dst_port: destination port
2175 * @payload_len: data payload length
2176 * @payload: data payload buffer
2177 * @payload_seq: payload sequence stamping configuration
2178 * @data_interval: interval at which to send data packets
2179 * @wake_len: wakeup payload match length
2180 * @wake_data: wakeup payload match data
2181 * @wake_mask: wakeup payload match mask
2182 * @tokens_size: length of the tokens buffer
2183 * @payload_tok: payload token usage configuration
2185 struct cfg80211_wowlan_tcp {
2186 struct socket *sock;
2188 u16 src_port, dst_port;
2189 u8 dst_mac[ETH_ALEN];
2192 struct nl80211_wowlan_tcp_data_seq payload_seq;
2195 const u8 *wake_data, *wake_mask;
2197 /* must be last, variable member */
2198 struct nl80211_wowlan_tcp_data_token payload_tok;
2202 * struct cfg80211_wowlan - Wake on Wireless-LAN support info
2204 * This structure defines the enabled WoWLAN triggers for the device.
2205 * @any: wake up on any activity -- special trigger if device continues
2206 * operating as normal during suspend
2207 * @disconnect: wake up if getting disconnected
2208 * @magic_pkt: wake up on receiving magic packet
2209 * @patterns: wake up on receiving packet matching a pattern
2210 * @n_patterns: number of patterns
2211 * @gtk_rekey_failure: wake up on GTK rekey failure
2212 * @eap_identity_req: wake up on EAP identity request packet
2213 * @four_way_handshake: wake up on 4-way handshake
2214 * @rfkill_release: wake up when rfkill is released
2215 * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
2216 * NULL if not configured.
2217 * @nd_config: configuration for the scan to be used for net detect wake.
2219 struct cfg80211_wowlan {
2220 bool any, disconnect, magic_pkt, gtk_rekey_failure,
2221 eap_identity_req, four_way_handshake,
2223 struct cfg80211_pkt_pattern *patterns;
2224 struct cfg80211_wowlan_tcp *tcp;
2226 struct cfg80211_sched_scan_request *nd_config;
2230 * struct cfg80211_coalesce_rules - Coalesce rule parameters
2232 * This structure defines coalesce rule for the device.
2233 * @delay: maximum coalescing delay in msecs.
2234 * @condition: condition for packet coalescence.
2235 * see &enum nl80211_coalesce_condition.
2236 * @patterns: array of packet patterns
2237 * @n_patterns: number of patterns
2239 struct cfg80211_coalesce_rules {
2241 enum nl80211_coalesce_condition condition;
2242 struct cfg80211_pkt_pattern *patterns;
2247 * struct cfg80211_coalesce - Packet coalescing settings
2249 * This structure defines coalescing settings.
2250 * @rules: array of coalesce rules
2251 * @n_rules: number of rules
2253 struct cfg80211_coalesce {
2254 struct cfg80211_coalesce_rules *rules;
2259 * struct cfg80211_wowlan_nd_match - information about the match
2261 * @ssid: SSID of the match that triggered the wake up
2262 * @n_channels: Number of channels where the match occurred. This
2263 * value may be zero if the driver can't report the channels.
2264 * @channels: center frequencies of the channels where a match
2267 struct cfg80211_wowlan_nd_match {
2268 struct cfg80211_ssid ssid;
2274 * struct cfg80211_wowlan_nd_info - net detect wake up information
2276 * @n_matches: Number of match information instances provided in
2277 * @matches. This value may be zero if the driver can't provide
2278 * match information.
2279 * @matches: Array of pointers to matches containing information about
2280 * the matches that triggered the wake up.
2282 struct cfg80211_wowlan_nd_info {
2284 struct cfg80211_wowlan_nd_match *matches[];
2288 * struct cfg80211_wowlan_wakeup - wakeup report
2289 * @disconnect: woke up by getting disconnected
2290 * @magic_pkt: woke up by receiving magic packet
2291 * @gtk_rekey_failure: woke up by GTK rekey failure
2292 * @eap_identity_req: woke up by EAP identity request packet
2293 * @four_way_handshake: woke up by 4-way handshake
2294 * @rfkill_release: woke up by rfkill being released
2295 * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
2296 * @packet_present_len: copied wakeup packet data
2297 * @packet_len: original wakeup packet length
2298 * @packet: The packet causing the wakeup, if any.
2299 * @packet_80211: For pattern match, magic packet and other data
2300 * frame triggers an 802.3 frame should be reported, for
2301 * disconnect due to deauth 802.11 frame. This indicates which
2303 * @tcp_match: TCP wakeup packet received
2304 * @tcp_connlost: TCP connection lost or failed to establish
2305 * @tcp_nomoretokens: TCP data ran out of tokens
2306 * @net_detect: if not %NULL, woke up because of net detect
2308 struct cfg80211_wowlan_wakeup {
2309 bool disconnect, magic_pkt, gtk_rekey_failure,
2310 eap_identity_req, four_way_handshake,
2311 rfkill_release, packet_80211,
2312 tcp_match, tcp_connlost, tcp_nomoretokens;
2314 u32 packet_present_len, packet_len;
2316 struct cfg80211_wowlan_nd_info *net_detect;
2320 * struct cfg80211_gtk_rekey_data - rekey data
2321 * @kek: key encryption key
2322 * @kck: key confirmation key (NL80211_KCK_LEN bytes)
2323 * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
2324 * @kek_len: Length of @kek in octets
2326 struct cfg80211_gtk_rekey_data {
2327 const u8 *kek, *kck, *replay_ctr;
2332 * struct cfg80211_update_ft_ies_params - FT IE Information
2334 * This structure provides information needed to update the fast transition IE
2336 * @md: The Mobility Domain ID, 2 Octet value
2337 * @ie: Fast Transition IEs
2338 * @ie_len: Length of ft_ie in octets
2340 struct cfg80211_update_ft_ies_params {
2347 * struct cfg80211_mgmt_tx_params - mgmt tx parameters
2349 * This structure provides information needed to transmit a mgmt frame
2351 * @chan: channel to use
2352 * @offchan: indicates wether off channel operation is required
2353 * @wait: duration for ROC
2354 * @buf: buffer to transmit
2355 * @len: buffer length
2356 * @no_cck: don't use cck rates for this frame
2357 * @dont_wait_for_ack: tells the low level not to wait for an ack
2358 * @n_csa_offsets: length of csa_offsets array
2359 * @csa_offsets: array of all the csa offsets in the frame
2361 struct cfg80211_mgmt_tx_params {
2362 struct ieee80211_channel *chan;
2368 bool dont_wait_for_ack;
2370 const u16 *csa_offsets;
2374 * struct cfg80211_dscp_exception - DSCP exception
2376 * @dscp: DSCP value that does not adhere to the user priority range definition
2377 * @up: user priority value to which the corresponding DSCP value belongs
2379 struct cfg80211_dscp_exception {
2385 * struct cfg80211_dscp_range - DSCP range definition for user priority
2387 * @low: lowest DSCP value of this user priority range, inclusive
2388 * @high: highest DSCP value of this user priority range, inclusive
2390 struct cfg80211_dscp_range {
2395 /* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
2396 #define IEEE80211_QOS_MAP_MAX_EX 21
2397 #define IEEE80211_QOS_MAP_LEN_MIN 16
2398 #define IEEE80211_QOS_MAP_LEN_MAX \
2399 (IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
2402 * struct cfg80211_qos_map - QoS Map Information
2404 * This struct defines the Interworking QoS map setting for DSCP values
2406 * @num_des: number of DSCP exceptions (0..21)
2407 * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
2408 * the user priority DSCP range definition
2409 * @up: DSCP range definition for a particular user priority
2411 struct cfg80211_qos_map {
2413 struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
2414 struct cfg80211_dscp_range up[8];
2418 * struct cfg80211_external_auth_params - Trigger External authentication.
2420 * Commonly used across the external auth request and event interfaces.
2422 * @action: action type / trigger for external authentication. Only significant
2423 * for the authentication request event interface (driver to user space).
2424 * @bssid: BSSID of the peer with which the authentication has
2425 * to happen. Used by both the authentication request event and
2426 * authentication response command interface.
2427 * @ssid: SSID of the AP. Used by both the authentication request event and
2428 * authentication response command interface.
2429 * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
2430 * authentication request event interface.
2431 * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
2432 * use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
2433 * the real status code for failures. Used only for the authentication
2434 * response command interface (user space to driver).
2435 * @pmkid: The identifier to refer a PMKSA.
2437 struct cfg80211_external_auth_params {
2438 enum nl80211_external_auth_action action;
2439 u8 bssid[ETH_ALEN] __aligned(2);
2440 struct cfg80211_ssid ssid;
2441 unsigned int key_mgmt_suite;
2447 * struct cfg80211_ops - backend description for wireless configuration
2449 * This struct is registered by fullmac card drivers and/or wireless stacks
2450 * in order to handle configuration requests on their interfaces.
2452 * All callbacks except where otherwise noted should return 0
2453 * on success or a negative error code.
2455 * All operations are currently invoked under rtnl for consistency with the
2456 * wireless extensions but this is subject to reevaluation as soon as this
2457 * code is used more widely and we have a first user without wext.
2459 * @suspend: wiphy device needs to be suspended. The variable @wow will
2460 * be %NULL or contain the enabled Wake-on-Wireless triggers that are
2461 * configured for the device.
2462 * @resume: wiphy device needs to be resumed
2463 * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
2464 * to call device_set_wakeup_enable() to enable/disable wakeup from
2467 * @add_virtual_intf: create a new virtual interface with the given name,
2468 * must set the struct wireless_dev's iftype. Beware: You must create
2469 * the new netdev in the wiphy's network namespace! Returns the struct
2470 * wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
2471 * also set the address member in the wdev.
2473 * @del_virtual_intf: remove the virtual interface
2475 * @change_virtual_intf: change type/configuration of virtual interface,
2476 * keep the struct wireless_dev's iftype updated.
2478 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
2479 * when adding a group key.
2481 * @get_key: get information about the key with the given parameters.
2482 * @mac_addr will be %NULL when requesting information for a group
2483 * key. All pointers given to the @callback function need not be valid
2484 * after it returns. This function should return an error if it is
2485 * not possible to retrieve the key, -ENOENT if it doesn't exist.
2487 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
2488 * and @key_index, return -ENOENT if the key doesn't exist.
2490 * @set_default_key: set the default key on an interface
2492 * @set_default_mgmt_key: set the default management frame key on an interface
2494 * @set_rekey_data: give the data necessary for GTK rekeying to the driver
2496 * @start_ap: Start acting in AP mode defined by the parameters.
2497 * @change_beacon: Change the beacon parameters for an access point mode
2498 * interface. This should reject the call when AP mode wasn't started.
2499 * @stop_ap: Stop being an AP, including stopping beaconing.
2501 * @add_station: Add a new station.
2502 * @del_station: Remove a station
2503 * @change_station: Modify a given station. Note that flags changes are not much
2504 * validated in cfg80211, in particular the auth/assoc/authorized flags
2505 * might come to the driver in invalid combinations -- make sure to check
2506 * them, also against the existing state! Drivers must call
2507 * cfg80211_check_station_change() to validate the information.
2508 * @get_station: get station information for the station identified by @mac
2509 * @dump_station: dump station callback -- resume dump at index @idx
2511 * @add_mpath: add a fixed mesh path
2512 * @del_mpath: delete a given mesh path
2513 * @change_mpath: change a given mesh path
2514 * @get_mpath: get a mesh path for the given parameters
2515 * @dump_mpath: dump mesh path callback -- resume dump at index @idx
2516 * @get_mpp: get a mesh proxy path for the given parameters
2517 * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
2518 * @join_mesh: join the mesh network with the specified parameters
2519 * (invoked with the wireless_dev mutex held)
2520 * @leave_mesh: leave the current mesh network
2521 * (invoked with the wireless_dev mutex held)
2523 * @get_mesh_config: Get the current mesh configuration
2525 * @update_mesh_config: Update mesh parameters on a running mesh.
2526 * The mask is a bitfield which tells us which parameters to
2527 * set, and which to leave alone.
2529 * @change_bss: Modify parameters for a given BSS.
2531 * @set_txq_params: Set TX queue parameters
2533 * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
2534 * as it doesn't implement join_mesh and needs to set the channel to
2535 * join the mesh instead.
2537 * @set_monitor_channel: Set the monitor mode channel for the device. If other
2538 * interfaces are active this callback should reject the configuration.
2539 * If no interfaces are active or the device is down, the channel should
2540 * be stored for when a monitor interface becomes active.
2542 * @scan: Request to do a scan. If returning zero, the scan request is given
2543 * the driver, and will be valid until passed to cfg80211_scan_done().
2544 * For scan results, call cfg80211_inform_bss(); you can call this outside
2545 * the scan/scan_done bracket too.
2546 * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
2547 * indicate the status of the scan through cfg80211_scan_done().
2549 * @auth: Request to authenticate with the specified peer
2550 * (invoked with the wireless_dev mutex held)
2551 * @assoc: Request to (re)associate with the specified peer
2552 * (invoked with the wireless_dev mutex held)
2553 * @deauth: Request to deauthenticate from the specified peer
2554 * (invoked with the wireless_dev mutex held)
2555 * @disassoc: Request to disassociate from the specified peer
2556 * (invoked with the wireless_dev mutex held)
2558 * @connect: Connect to the ESS with the specified parameters. When connected,
2559 * call cfg80211_connect_result()/cfg80211_connect_bss() with status code
2560 * %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
2561 * cfg80211_connect_result()/cfg80211_connect_bss() with the status code
2562 * from the AP or cfg80211_connect_timeout() if no frame with status code
2564 * The driver is allowed to roam to other BSSes within the ESS when the
2565 * other BSS matches the connect parameters. When such roaming is initiated
2566 * by the driver, the driver is expected to verify that the target matches
2567 * the configured security parameters and to use Reassociation Request
2568 * frame instead of Association Request frame.
2569 * The connect function can also be used to request the driver to perform a
2570 * specific roam when connected to an ESS. In that case, the prev_bssid
2571 * parameter is set to the BSSID of the currently associated BSS as an
2572 * indication of requesting reassociation.
2573 * In both the driver-initiated and new connect() call initiated roaming
2574 * cases, the result of roaming is indicated with a call to
2575 * cfg80211_roamed() or cfg80211_roamed_bss().
2576 * (invoked with the wireless_dev mutex held)
2577 * @update_connect_params: Update the connect parameters while connected to a
2578 * BSS. The updated parameters can be used by driver/firmware for
2579 * subsequent BSS selection (roaming) decisions and to form the
2580 * Authentication/(Re)Association Request frames. This call does not
2581 * request an immediate disassociation or reassociation with the current
2582 * BSS, i.e., this impacts only subsequent (re)associations. The bits in
2583 * changed are defined in &enum cfg80211_connect_params_changed.
2584 * (invoked with the wireless_dev mutex held)
2585 * @disconnect: Disconnect from the BSS/ESS.
2586 * (invoked with the wireless_dev mutex held)
2588 * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
2589 * cfg80211_ibss_joined(), also call that function when changing BSSID due
2591 * (invoked with the wireless_dev mutex held)
2592 * @leave_ibss: Leave the IBSS.
2593 * (invoked with the wireless_dev mutex held)
2595 * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
2598 * @set_wiphy_params: Notify that wiphy parameters have changed;
2599 * @changed bitfield (see &enum wiphy_params_flags) describes which values
2600 * have changed. The actual parameter values are available in
2601 * struct wiphy. If returning an error, no value should be changed.
2603 * @set_tx_power: set the transmit power according to the parameters,
2604 * the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
2605 * wdev may be %NULL if power was set for the wiphy, and will
2606 * always be %NULL unless the driver supports per-vif TX power
2607 * (as advertised by the nl80211 feature flag.)
2608 * @get_tx_power: store the current TX power into the dbm variable;
2609 * return 0 if successful
2611 * @set_wds_peer: set the WDS peer for a WDS interface
2613 * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
2614 * functions to adjust rfkill hw state
2616 * @dump_survey: get site survey information.
2618 * @remain_on_channel: Request the driver to remain awake on the specified
2619 * channel for the specified duration to complete an off-channel
2620 * operation (e.g., public action frame exchange). When the driver is
2621 * ready on the requested channel, it must indicate this with an event
2622 * notification by calling cfg80211_ready_on_channel().
2623 * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
2624 * This allows the operation to be terminated prior to timeout based on
2625 * the duration value.
2626 * @mgmt_tx: Transmit a management frame.
2627 * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
2628 * frame on another channel
2630 * @testmode_cmd: run a test mode command; @wdev may be %NULL
2631 * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
2632 * used by the function, but 0 and 1 must not be touched. Additionally,
2633 * return error codes other than -ENOBUFS and -ENOENT will terminate the
2634 * dump and return to userspace with an error, so be careful. If any data
2635 * was passed in from userspace then the data/len arguments will be present
2636 * and point to the data contained in %NL80211_ATTR_TESTDATA.
2638 * @set_bitrate_mask: set the bitrate mask configuration
2640 * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
2641 * devices running firmwares capable of generating the (re) association
2642 * RSN IE. It allows for faster roaming between WPA2 BSSIDs.
2643 * @del_pmksa: Delete a cached PMKID.
2644 * @flush_pmksa: Flush all cached PMKIDs.
2645 * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
2646 * allows the driver to adjust the dynamic ps timeout value.
2647 * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
2648 * After configuration, the driver should (soon) send an event indicating
2649 * the current level is above/below the configured threshold; this may
2650 * need some care when the configuration is changed (without first being
2652 * @set_cqm_txe_config: Configure connection quality monitor TX error
2654 * @sched_scan_start: Tell the driver to start a scheduled scan.
2655 * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan. This
2656 * call must stop the scheduled scan and be ready for starting a new one
2657 * before it returns, i.e. @sched_scan_start may be called immediately
2658 * after that again and should not fail in that case. The driver should
2659 * not call cfg80211_sched_scan_stopped() for a requested stop (when this
2660 * method returns 0.)
2662 * @mgmt_frame_register: Notify driver that a management frame type was
2663 * registered. The callback is allowed to sleep.
2665 * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
2666 * Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
2667 * reject TX/RX mask combinations they cannot support by returning -EINVAL
2668 * (also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
2670 * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
2672 * @tdls_mgmt: Transmit a TDLS management frame.
2673 * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
2675 * @probe_client: probe an associated client, must return a cookie that it
2676 * later passes to cfg80211_probe_status().
2678 * @set_noack_map: Set the NoAck Map for the TIDs.
2680 * @get_channel: Get the current operating channel for the virtual interface.
2681 * For monitor interfaces, it should return %NULL unless there's a single
2682 * current monitoring channel.
2684 * @start_p2p_device: Start the given P2P device.
2685 * @stop_p2p_device: Stop the given P2P device.
2687 * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
2688 * Parameters include ACL policy, an array of MAC address of stations
2689 * and the number of MAC addresses. If there is already a list in driver
2690 * this new list replaces the existing one. Driver has to clear its ACL
2691 * when number of MAC addresses entries is passed as 0. Drivers which
2692 * advertise the support for MAC based ACL have to implement this callback.
2694 * @start_radar_detection: Start radar detection in the driver.
2696 * @update_ft_ies: Provide updated Fast BSS Transition information to the
2697 * driver. If the SME is in the driver/firmware, this information can be
2698 * used in building Authentication and Reassociation Request frames.
2700 * @crit_proto_start: Indicates a critical protocol needs more link reliability
2701 * for a given duration (milliseconds). The protocol is provided so the
2702 * driver can take the most appropriate actions.
2703 * @crit_proto_stop: Indicates critical protocol no longer needs increased link
2704 * reliability. This operation can not fail.
2705 * @set_coalesce: Set coalesce parameters.
2707 * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
2708 * responsible for veryfing if the switch is possible. Since this is
2709 * inherently tricky driver may decide to disconnect an interface later
2710 * with cfg80211_stop_iface(). This doesn't mean driver can accept
2711 * everything. It should do it's best to verify requests and reject them
2712 * as soon as possible.
2714 * @set_qos_map: Set QoS mapping information to the driver
2716 * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
2717 * given interface This is used e.g. for dynamic HT 20/40 MHz channel width
2718 * changes during the lifetime of the BSS.
2720 * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
2721 * with the given parameters; action frame exchange has been handled by
2722 * userspace so this just has to modify the TX path to take the TS into
2724 * If the admitted time is 0 just validate the parameters to make sure
2725 * the session can be created at all; it is valid to just always return
2726 * success for that but that may result in inefficient behaviour (handshake
2727 * with the peer followed by immediate teardown when the addition is later
2729 * @del_tx_ts: remove an existing TX TS
2731 * @join_ocb: join the OCB network with the specified parameters
2732 * (invoked with the wireless_dev mutex held)
2733 * @leave_ocb: leave the current OCB network
2734 * (invoked with the wireless_dev mutex held)
2736 * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
2737 * is responsible for continually initiating channel-switching operations
2738 * and returning to the base channel for communication with the AP.
2739 * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
2740 * peers must be on the base channel when the call completes.
2742 * @external_auth: indicates result of offloaded authentication processing from
2745 struct cfg80211_ops {
2746 int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
2747 int (*resume)(struct wiphy *wiphy);
2748 void (*set_wakeup)(struct wiphy *wiphy, bool enabled);
2750 struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
2752 unsigned char name_assign_type,
2753 enum nl80211_iftype type,
2755 struct vif_params *params);
2756 int (*del_virtual_intf)(struct wiphy *wiphy,
2757 struct wireless_dev *wdev);
2758 int (*change_virtual_intf)(struct wiphy *wiphy,
2759 struct net_device *dev,
2760 enum nl80211_iftype type, u32 *flags,
2761 struct vif_params *params);
2763 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
2764 u8 key_index, bool pairwise, const u8 *mac_addr,
2765 struct key_params *params);
2766 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
2767 u8 key_index, bool pairwise, const u8 *mac_addr,
2769 void (*callback)(void *cookie, struct key_params*));
2770 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
2771 u8 key_index, bool pairwise, const u8 *mac_addr);
2772 int (*set_default_key)(struct wiphy *wiphy,
2773 struct net_device *netdev,
2774 u8 key_index, bool unicast, bool multicast);
2775 int (*set_default_mgmt_key)(struct wiphy *wiphy,
2776 struct net_device *netdev,
2779 int (*start_ap)(struct wiphy *wiphy, struct net_device *dev,
2780 struct cfg80211_ap_settings *settings);
2781 int (*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
2782 struct cfg80211_beacon_data *info);
2783 int (*stop_ap)(struct wiphy *wiphy, struct net_device *dev);
2786 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
2788 struct station_parameters *params);
2789 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
2790 struct station_del_parameters *params);
2791 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
2793 struct station_parameters *params);
2794 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
2795 const u8 *mac, struct station_info *sinfo);
2796 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
2797 int idx, u8 *mac, struct station_info *sinfo);
2799 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
2800 const u8 *dst, const u8 *next_hop);
2801 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
2803 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
2804 const u8 *dst, const u8 *next_hop);
2805 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
2806 u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
2807 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
2808 int idx, u8 *dst, u8 *next_hop,
2809 struct mpath_info *pinfo);
2810 int (*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
2811 u8 *dst, u8 *mpp, struct mpath_info *pinfo);
2812 int (*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
2813 int idx, u8 *dst, u8 *mpp,
2814 struct mpath_info *pinfo);
2815 int (*get_mesh_config)(struct wiphy *wiphy,
2816 struct net_device *dev,
2817 struct mesh_config *conf);
2818 int (*update_mesh_config)(struct wiphy *wiphy,
2819 struct net_device *dev, u32 mask,
2820 const struct mesh_config *nconf);
2821 int (*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
2822 const struct mesh_config *conf,
2823 const struct mesh_setup *setup);
2824 int (*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
2826 int (*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
2827 struct ocb_setup *setup);
2828 int (*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
2830 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
2831 struct bss_parameters *params);
2833 int (*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
2834 struct ieee80211_txq_params *params);
2836 int (*libertas_set_mesh_channel)(struct wiphy *wiphy,
2837 struct net_device *dev,
2838 struct ieee80211_channel *chan);
2840 int (*set_monitor_channel)(struct wiphy *wiphy,
2841 struct cfg80211_chan_def *chandef);
2843 int (*scan)(struct wiphy *wiphy,
2844 struct cfg80211_scan_request *request);
2845 void (*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
2847 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
2848 struct cfg80211_auth_request *req);
2849 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
2850 struct cfg80211_assoc_request *req);
2851 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
2852 struct cfg80211_deauth_request *req);
2853 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
2854 struct cfg80211_disassoc_request *req);
2856 int (*connect)(struct wiphy *wiphy, struct net_device *dev,
2857 struct cfg80211_connect_params *sme);
2858 int (*update_connect_params)(struct wiphy *wiphy,
2859 struct net_device *dev,
2860 struct cfg80211_connect_params *sme,
2862 int (*disconnect)(struct wiphy *wiphy, struct net_device *dev,
2865 int (*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
2866 struct cfg80211_ibss_params *params);
2867 int (*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
2869 int (*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
2870 int rate[IEEE80211_NUM_BANDS]);
2872 int (*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
2874 int (*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2875 enum nl80211_tx_power_setting type, int mbm);
2876 int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
2879 int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev,
2882 void (*rfkill_poll)(struct wiphy *wiphy);
2884 #ifdef CONFIG_NL80211_TESTMODE
2885 int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
2886 void *data, int len);
2887 int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
2888 struct netlink_callback *cb,
2889 void *data, int len);
2892 int (*set_bitrate_mask)(struct wiphy *wiphy,
2893 struct net_device *dev,
2895 const struct cfg80211_bitrate_mask *mask);
2897 int (*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
2898 int idx, struct survey_info *info);
2900 int (*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
2901 struct cfg80211_pmksa *pmksa);
2902 int (*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
2903 struct cfg80211_pmksa *pmksa);
2904 int (*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
2906 int (*remain_on_channel)(struct wiphy *wiphy,
2907 struct wireless_dev *wdev,
2908 struct ieee80211_channel *chan,
2909 unsigned int duration,
2911 int (*cancel_remain_on_channel)(struct wiphy *wiphy,
2912 struct wireless_dev *wdev,
2915 int (*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
2916 struct cfg80211_mgmt_tx_params *params,
2918 int (*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
2919 struct wireless_dev *wdev,
2922 int (*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2923 bool enabled, int timeout);
2925 int (*set_cqm_rssi_config)(struct wiphy *wiphy,
2926 struct net_device *dev,
2927 s32 rssi_thold, u32 rssi_hyst);
2929 int (*set_cqm_txe_config)(struct wiphy *wiphy,
2930 struct net_device *dev,
2931 u32 rate, u32 pkts, u32 intvl);
2933 void (*mgmt_frame_register)(struct wiphy *wiphy,
2934 struct wireless_dev *wdev,
2935 u16 frame_type, bool reg);
2937 int (*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
2938 int (*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
2940 int (*sched_scan_start)(struct wiphy *wiphy,
2941 struct net_device *dev,
2942 struct cfg80211_sched_scan_request *request);
2943 int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev);
2945 int (*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
2946 struct cfg80211_gtk_rekey_data *data);
2948 int (*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
2949 const u8 *peer, u8 action_code, u8 dialog_token,
2950 u16 status_code, u32 peer_capability,
2951 bool initiator, const u8 *buf, size_t len);
2952 int (*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
2953 const u8 *peer, enum nl80211_tdls_operation oper);
2955 int (*probe_client)(struct wiphy *wiphy, struct net_device *dev,
2956 const u8 *peer, u64 *cookie);
2958 int (*set_noack_map)(struct wiphy *wiphy,
2959 struct net_device *dev,
2962 int (*get_channel)(struct wiphy *wiphy,
2963 struct wireless_dev *wdev,
2964 struct cfg80211_chan_def *chandef);
2966 int (*start_p2p_device)(struct wiphy *wiphy,
2967 struct wireless_dev *wdev);
2968 void (*stop_p2p_device)(struct wiphy *wiphy,
2969 struct wireless_dev *wdev);
2971 int (*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
2972 const struct cfg80211_acl_data *params);
2974 int (*start_radar_detection)(struct wiphy *wiphy,
2975 struct net_device *dev,
2976 struct cfg80211_chan_def *chandef,
2978 int (*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
2979 struct cfg80211_update_ft_ies_params *ftie);
2980 int (*crit_proto_start)(struct wiphy *wiphy,
2981 struct wireless_dev *wdev,
2982 enum nl80211_crit_proto_id protocol,
2984 void (*crit_proto_stop)(struct wiphy *wiphy,
2985 struct wireless_dev *wdev);
2986 int (*set_coalesce)(struct wiphy *wiphy,
2987 struct cfg80211_coalesce *coalesce);
2989 int (*channel_switch)(struct wiphy *wiphy,
2990 struct net_device *dev,
2991 struct cfg80211_csa_settings *params);
2993 int (*set_qos_map)(struct wiphy *wiphy,
2994 struct net_device *dev,
2995 struct cfg80211_qos_map *qos_map);
2997 int (*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
2998 struct cfg80211_chan_def *chandef);
3000 int (*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3001 u8 tsid, const u8 *peer, u8 user_prio,
3003 int (*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
3004 u8 tsid, const u8 *peer);
3006 int (*tdls_channel_switch)(struct wiphy *wiphy,
3007 struct net_device *dev,
3008 const u8 *addr, u8 oper_class,
3009 struct cfg80211_chan_def *chandef);
3010 void (*tdls_cancel_channel_switch)(struct wiphy *wiphy,
3011 struct net_device *dev,
3013 int (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
3014 struct cfg80211_external_auth_params *params);
3018 * wireless hardware and networking interfaces structures
3019 * and registration/helper functions
3023 * enum wiphy_flags - wiphy capability flags
3025 * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
3027 * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
3028 * by default -- this flag will be set depending on the kernel's default
3029 * on wiphy_new(), but can be changed by the driver if it has a good
3030 * reason to override the default
3031 * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
3032 * on a VLAN interface)
3033 * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
3034 * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
3035 * control port protocol ethertype. The device also honours the
3036 * control_port_no_encrypt flag.
3037 * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
3038 * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
3039 * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
3040 * @WIPHY_FLAG_SUPPORTS_SCHED_SCAN: The device supports scheduled scans.
3041 * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
3043 * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
3044 * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
3045 * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
3046 * link setup/discovery operations internally. Setup, discovery and
3047 * teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
3048 * command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
3049 * used for asking the driver/firmware to perform a TDLS operation.
3050 * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
3051 * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
3052 * when there are virtual interfaces in AP mode by calling
3053 * cfg80211_report_obss_beacon().
3054 * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
3055 * responds to probe-requests in hardware.
3056 * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
3057 * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
3058 * @WIPHY_FLAG_DFS_OFFLOAD: The driver handles all the DFS related operations.
3059 * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
3060 * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
3061 * beaconing mode (AP, IBSS, Mesh, ...).
3067 WIPHY_FLAG_NETNS_OK = BIT(3),
3068 WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4),
3069 WIPHY_FLAG_4ADDR_AP = BIT(5),
3070 WIPHY_FLAG_4ADDR_STATION = BIT(6),
3071 WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7),
3072 WIPHY_FLAG_IBSS_RSN = BIT(8),
3073 WIPHY_FLAG_MESH_AUTH = BIT(10),
3074 WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11),
3075 /* use hole at 12 */
3076 WIPHY_FLAG_SUPPORTS_FW_ROAM = BIT(13),
3077 WIPHY_FLAG_AP_UAPSD = BIT(14),
3078 WIPHY_FLAG_SUPPORTS_TDLS = BIT(15),
3079 WIPHY_FLAG_TDLS_EXTERNAL_SETUP = BIT(16),
3080 WIPHY_FLAG_HAVE_AP_SME = BIT(17),
3081 WIPHY_FLAG_REPORTS_OBSS = BIT(18),
3082 WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD = BIT(19),
3083 WIPHY_FLAG_OFFCHAN_TX = BIT(20),
3084 WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL = BIT(21),
3085 WIPHY_FLAG_SUPPORTS_5_10_MHZ = BIT(22),
3086 WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23),
3087 WIPHY_FLAG_DFS_OFFLOAD = BIT(24),
3091 * struct ieee80211_iface_limit - limit on certain interface types
3092 * @max: maximum number of interfaces of these types
3093 * @types: interface types (bits)
3095 struct ieee80211_iface_limit {
3101 * struct ieee80211_iface_combination - possible interface combination
3102 * @limits: limits for the given interface types
3103 * @n_limits: number of limitations
3104 * @num_different_channels: can use up to this many different channels
3105 * @max_interfaces: maximum number of interfaces in total allowed in this
3107 * @beacon_int_infra_match: In this combination, the beacon intervals
3108 * between infrastructure and AP types must match. This is required
3109 * only in special cases.
3110 * @radar_detect_widths: bitmap of channel widths supported for radar detection
3111 * @radar_detect_regions: bitmap of regions supported for radar detection
3112 * @beacon_int_min_gcd: This interface combination supports different
3114 * = 0 - all beacon intervals for different interface must be same.
3115 * > 0 - any beacon interval for the interface part of this combination AND
3116 * *GCD* of all beacon intervals from beaconing interfaces of this
3117 * combination must be greater or equal to this value.
3119 * With this structure the driver can describe which interface
3120 * combinations it supports concurrently.
3124 * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
3126 * struct ieee80211_iface_limit limits1[] = {
3127 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
3128 * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
3130 * struct ieee80211_iface_combination combination1 = {
3131 * .limits = limits1,
3132 * .n_limits = ARRAY_SIZE(limits1),
3133 * .max_interfaces = 2,
3134 * .beacon_int_infra_match = true,
3138 * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
3140 * struct ieee80211_iface_limit limits2[] = {
3141 * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
3142 * BIT(NL80211_IFTYPE_P2P_GO), },
3144 * struct ieee80211_iface_combination combination2 = {
3145 * .limits = limits2,
3146 * .n_limits = ARRAY_SIZE(limits2),
3147 * .max_interfaces = 8,
3148 * .num_different_channels = 1,
3152 * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
3154 * This allows for an infrastructure connection and three P2P connections.
3156 * struct ieee80211_iface_limit limits3[] = {
3157 * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
3158 * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
3159 * BIT(NL80211_IFTYPE_P2P_CLIENT), },
3161 * struct ieee80211_iface_combination combination3 = {
3162 * .limits = limits3,
3163 * .n_limits = ARRAY_SIZE(limits3),
3164 * .max_interfaces = 4,
3165 * .num_different_channels = 2,
3168 struct ieee80211_iface_combination {
3169 const struct ieee80211_iface_limit *limits;
3170 u32 num_different_channels;
3173 bool beacon_int_infra_match;
3174 u8 radar_detect_widths;
3175 u8 radar_detect_regions;
3176 u32 beacon_int_min_gcd;
3179 struct ieee80211_txrx_stypes {
3184 * enum wiphy_wowlan_support_flags - WoWLAN support flags
3185 * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
3186 * trigger that keeps the device operating as-is and
3187 * wakes up the host on any activity, for example a
3188 * received packet that passed filtering; note that the
3189 * packet should be preserved in that case
3190 * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
3192 * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
3193 * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
3194 * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
3195 * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
3196 * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
3197 * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
3198 * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
3200 enum wiphy_wowlan_support_flags {
3201 WIPHY_WOWLAN_ANY = BIT(0),
3202 WIPHY_WOWLAN_MAGIC_PKT = BIT(1),
3203 WIPHY_WOWLAN_DISCONNECT = BIT(2),
3204 WIPHY_WOWLAN_SUPPORTS_GTK_REKEY = BIT(3),
3205 WIPHY_WOWLAN_GTK_REKEY_FAILURE = BIT(4),
3206 WIPHY_WOWLAN_EAP_IDENTITY_REQ = BIT(5),
3207 WIPHY_WOWLAN_4WAY_HANDSHAKE = BIT(6),
3208 WIPHY_WOWLAN_RFKILL_RELEASE = BIT(7),
3209 WIPHY_WOWLAN_NET_DETECT = BIT(8),
3212 struct wiphy_wowlan_tcp_support {
3213 const struct nl80211_wowlan_tcp_data_token_feature *tok;
3214 u32 data_payload_max;
3215 u32 data_interval_max;
3216 u32 wake_payload_max;
3221 * struct wiphy_wowlan_support - WoWLAN support data
3222 * @flags: see &enum wiphy_wowlan_support_flags
3223 * @n_patterns: number of supported wakeup patterns
3224 * (see nl80211.h for the pattern definition)
3225 * @pattern_max_len: maximum length of each pattern
3226 * @pattern_min_len: minimum length of each pattern
3227 * @max_pkt_offset: maximum Rx packet offset
3228 * @max_nd_match_sets: maximum number of matchsets for net-detect,
3229 * similar, but not necessarily identical, to max_match_sets for
3231 * See &struct cfg80211_sched_scan_request.@match_sets for more
3233 * @tcp: TCP wakeup support information
3235 struct wiphy_wowlan_support {
3238 int pattern_max_len;
3239 int pattern_min_len;
3241 int max_nd_match_sets;
3242 const struct wiphy_wowlan_tcp_support *tcp;
3246 * struct wiphy_coalesce_support - coalesce support data
3247 * @n_rules: maximum number of coalesce rules
3248 * @max_delay: maximum supported coalescing delay in msecs
3249 * @n_patterns: number of supported patterns in a rule
3250 * (see nl80211.h for the pattern definition)
3251 * @pattern_max_len: maximum length of each pattern
3252 * @pattern_min_len: minimum length of each pattern
3253 * @max_pkt_offset: maximum Rx packet offset
3255 struct wiphy_coalesce_support {
3259 int pattern_max_len;
3260 int pattern_min_len;
3265 * enum wiphy_vendor_command_flags - validation flags for vendor commands
3266 * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
3267 * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
3268 * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
3269 * (must be combined with %_WDEV or %_NETDEV)
3271 enum wiphy_vendor_command_flags {
3272 WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
3273 WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
3274 WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
3278 * struct wiphy_vendor_command - vendor command definition
3279 * @info: vendor command identifying information, as used in nl80211
3280 * @flags: flags, see &enum wiphy_vendor_command_flags
3281 * @doit: callback for the operation, note that wdev is %NULL if the
3282 * flags didn't ask for a wdev and non-%NULL otherwise; the data
3283 * pointer may be %NULL if userspace provided no data at all
3284 * @dumpit: dump callback, for transferring bigger/multiple items. The
3285 * @storage points to cb->args[5], ie. is preserved over the multiple
3287 * It's recommended to not have the same sub command with both @doit and
3288 * @dumpit, so that userspace can assume certain ones are get and others
3289 * are used with dump requests.
3291 struct wiphy_vendor_command {
3292 struct nl80211_vendor_cmd_info info;
3294 int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
3295 const void *data, int data_len);
3296 int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
3297 struct sk_buff *skb, const void *data, int data_len,
3298 unsigned long *storage);
3302 * struct wiphy_iftype_ext_capab - extended capabilities per interface type
3303 * @iftype: interface type
3304 * @extended_capabilities: extended capabilities supported by the driver,
3305 * additional capabilities might be supported by userspace; these are the
3306 * 802.11 extended capabilities ("Extended Capabilities element") and are
3307 * in the same format as in the information element. See IEEE Std
3308 * 802.11-2012 8.4.2.29 for the defined fields.
3309 * @extended_capabilities_mask: mask of the valid values
3310 * @extended_capabilities_len: length of the extended capabilities
3312 struct wiphy_iftype_ext_capab {
3313 enum nl80211_iftype iftype;
3314 const u8 *extended_capabilities;
3315 const u8 *extended_capabilities_mask;
3316 u8 extended_capabilities_len;
3320 * struct wiphy - wireless hardware description
3321 * @reg_notifier: the driver's regulatory notification callback,
3322 * note that if your driver uses wiphy_apply_custom_regulatory()
3323 * the reg_notifier's request can be passed as NULL
3324 * @regd: the driver's regulatory domain, if one was requested via
3325 * the regulatory_hint() API. This can be used by the driver
3326 * on the reg_notifier() if it chooses to ignore future
3327 * regulatory domain changes caused by other drivers.
3328 * @signal_type: signal type reported in &struct cfg80211_bss.
3329 * @cipher_suites: supported cipher suites
3330 * @n_cipher_suites: number of supported cipher suites
3331 * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
3332 * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
3333 * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
3334 * -1 = fragmentation disabled, only odd values >= 256 used
3335 * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
3336 * @_net: the network namespace this wiphy currently lives in
3337 * @perm_addr: permanent MAC address of this device
3338 * @addr_mask: If the device supports multiple MAC addresses by masking,
3339 * set this to a mask with variable bits set to 1, e.g. if the last
3340 * four bits are variable then set it to 00-00-00-00-00-0f. The actual
3341 * variable bits shall be determined by the interfaces added, with
3342 * interfaces not matching the mask being rejected to be brought up.
3343 * @n_addresses: number of addresses in @addresses.
3344 * @addresses: If the device has more than one address, set this pointer
3345 * to a list of addresses (6 bytes each). The first one will be used
3346 * by default for perm_addr. In this case, the mask should be set to
3347 * all-zeroes. In this case it is assumed that the device can handle
3348 * the same number of arbitrary MAC addresses.
3349 * @registered: protects ->resume and ->suspend sysfs callbacks against
3350 * unregister hardware
3351 * @debugfsdir: debugfs directory used for this wiphy, will be renamed
3352 * automatically on wiphy renames
3353 * @dev: (virtual) struct device for this wiphy
3354 * @registered: helps synchronize suspend/resume with wiphy unregister
3355 * @wext: wireless extension handlers
3356 * @priv: driver private data (sized according to wiphy_new() parameter)
3357 * @interface_modes: bitmask of interfaces types valid for this wiphy,
3358 * must be set by driver
3359 * @iface_combinations: Valid interface combinations array, should not
3360 * list single interface types.
3361 * @n_iface_combinations: number of entries in @iface_combinations array.
3362 * @software_iftypes: bitmask of software interface types, these are not
3363 * subject to any restrictions since they are purely managed in SW.
3364 * @flags: wiphy flags, see &enum wiphy_flags
3365 * @regulatory_flags: wiphy regulatory flags, see
3366 * &enum ieee80211_regulatory_flags
3367 * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
3368 * @ext_features: extended features advertised to nl80211, see
3369 * &enum nl80211_ext_feature_index.
3370 * @bss_priv_size: each BSS struct has private data allocated with it,
3371 * this variable determines its size
3372 * @max_scan_ssids: maximum number of SSIDs the device can scan for in
3374 * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
3375 * for in any given scheduled scan
3376 * @max_match_sets: maximum number of match sets the device can handle
3377 * when performing a scheduled scan, 0 if filtering is not
3379 * @max_scan_ie_len: maximum length of user-controlled IEs device can
3380 * add to probe request frames transmitted during a scan, must not
3381 * include fixed IEs like supported rates
3382 * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
3384 * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
3385 * of iterations) for scheduled scan supported by the device.
3386 * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
3387 * single scan plan supported by the device.
3388 * @max_sched_scan_plan_iterations: maximum number of iterations for a single
3389 * scan plan supported by the device.
3390 * @coverage_class: current coverage class
3391 * @fw_version: firmware version for ethtool reporting
3392 * @hw_version: hardware version for ethtool reporting
3393 * @max_num_pmkids: maximum number of PMKIDs supported by device
3394 * @privid: a pointer that drivers can use to identify if an arbitrary
3395 * wiphy is theirs, e.g. in global notifiers
3396 * @bands: information about bands/channels supported by this device
3398 * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
3399 * transmitted through nl80211, points to an array indexed by interface
3402 * @available_antennas_tx: bitmap of antennas which are available to be
3403 * configured as TX antennas. Antenna configuration commands will be
3404 * rejected unless this or @available_antennas_rx is set.
3406 * @available_antennas_rx: bitmap of antennas which are available to be
3407 * configured as RX antennas. Antenna configuration commands will be
3408 * rejected unless this or @available_antennas_tx is set.
3410 * @probe_resp_offload:
3411 * Bitmap of supported protocols for probe response offloading.
3412 * See &enum nl80211_probe_resp_offload_support_attr. Only valid
3413 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
3415 * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
3416 * may request, if implemented.
3418 * @wowlan: WoWLAN support information
3419 * @wowlan_config: current WoWLAN configuration; this should usually not be
3420 * used since access to it is necessarily racy, use the parameter passed
3421 * to the suspend() operation instead.
3423 * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
3424 * @ht_capa_mod_mask: Specify what ht_cap values can be over-ridden.
3425 * If null, then none can be over-ridden.
3426 * @vht_capa_mod_mask: Specify what VHT capabilities can be over-ridden.
3427 * If null, then none can be over-ridden.
3429 * @wdev_list: the list of associated (virtual) interfaces; this list must
3430 * not be modified by the driver, but can be read with RTNL/RCU protection.
3432 * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
3435 * @extended_capabilities: extended capabilities supported by the driver,
3436 * additional capabilities might be supported by userspace; these are
3437 * the 802.11 extended capabilities ("Extended Capabilities element")
3438 * and are in the same format as in the information element. See
3439 * 802.11-2012 8.4.2.29 for the defined fields. These are the default
3440 * extended capabilities to be used if the capabilities are not specified
3441 * for a specific interface type in iftype_ext_capab.
3442 * @extended_capabilities_mask: mask of the valid values
3443 * @extended_capabilities_len: length of the extended capabilities
3444 * @iftype_ext_capab: array of extended capabilities per interface type
3445 * @num_iftype_ext_capab: number of interface types for which extended
3446 * capabilities are specified separately.
3447 * @coalesce: packet coalescing support information
3449 * @vendor_commands: array of vendor commands supported by the hardware
3450 * @n_vendor_commands: number of vendor commands
3451 * @vendor_events: array of vendor events supported by the hardware
3452 * @n_vendor_events: number of vendor events
3454 * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
3455 * (including P2P GO) or 0 to indicate no such limit is advertised. The
3456 * driver is allowed to advertise a theoretical limit that it can reach in
3457 * some cases, but may not always reach.
3459 * @max_num_csa_counters: Number of supported csa_counters in beacons
3460 * and probe responses. This value should be set if the driver
3461 * wishes to limit the number of csa counters. Default (0) means
3463 * @max_adj_channel_rssi_comp: max offset of between the channel on which the
3464 * frame was sent and the channel on which the frame was heard for which
3465 * the reported rssi is still valid. If a driver is able to compensate the
3466 * low rssi when a frame is heard on different channel, then it should set
3467 * this variable to the maximal offset for which it can compensate.
3468 * This value should be set in MHz.
3469 * @bss_select_support: bitmask indicating the BSS selection criteria supported
3470 * by the driver in the .connect() callback. The bit position maps to the
3471 * attribute indices defined in &enum nl80211_bss_select_attr.
3474 /* assign these fields before you register the wiphy */
3476 /* permanent MAC address(es) */
3477 u8 perm_addr[ETH_ALEN];
3478 u8 addr_mask[ETH_ALEN];
3480 struct mac_address *addresses;
3482 const struct ieee80211_txrx_stypes *mgmt_stypes;
3484 const struct ieee80211_iface_combination *iface_combinations;
3485 int n_iface_combinations;
3486 u16 software_iftypes;
3490 /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
3491 u16 interface_modes;
3493 u16 max_acl_mac_addrs;
3495 u32 flags, regulatory_flags, features;
3496 u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
3500 enum cfg80211_signal_type signal_type;
3504 u8 max_sched_scan_ssids;
3506 u16 max_scan_ie_len;
3507 u16 max_sched_scan_ie_len;
3508 u32 max_sched_scan_plans;
3509 u32 max_sched_scan_plan_interval;
3510 u32 max_sched_scan_plan_iterations;
3512 int n_cipher_suites;
3513 const u32 *cipher_suites;
3521 char fw_version[ETHTOOL_FWVERS_LEN];
3525 const struct wiphy_wowlan_support *wowlan;
3526 struct cfg80211_wowlan *wowlan_config;
3529 u16 max_remain_on_channel_duration;
3533 u32 available_antennas_tx;
3534 u32 available_antennas_rx;
3537 * Bitmap of supported protocols for probe response offloading
3538 * see &enum nl80211_probe_resp_offload_support_attr. Only valid
3539 * when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
3541 u32 probe_resp_offload;
3543 const u8 *extended_capabilities, *extended_capabilities_mask;
3544 u8 extended_capabilities_len;
3546 const struct wiphy_iftype_ext_capab *iftype_ext_capab;
3547 unsigned int num_iftype_ext_capab;
3549 /* If multiple wiphys are registered and you're handed e.g.
3550 * a regular netdev with assigned ieee80211_ptr, you won't
3551 * know whether it points to a wiphy your driver has registered
3552 * or not. Assign this to something global to your driver to
3553 * help determine whether you own this wiphy or not. */
3556 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
3558 /* Lets us get back the wiphy on the callback */
3559 void (*reg_notifier)(struct wiphy *wiphy,
3560 struct regulatory_request *request);
3562 /* fields below are read-only, assigned by cfg80211 */
3564 const struct ieee80211_regdomain __rcu *regd;
3566 /* the item in /sys/class/ieee80211/ points to this,
3567 * you need use set_wiphy_dev() (see below) */
3570 /* protects ->resume, ->suspend sysfs callbacks against unregister hw */
3573 /* dir in debugfs: ieee80211/<wiphyname> */
3574 struct dentry *debugfsdir;
3576 const struct ieee80211_ht_cap *ht_capa_mod_mask;
3577 const struct ieee80211_vht_cap *vht_capa_mod_mask;
3579 struct list_head wdev_list;
3581 /* the network namespace this phy lives in currently */
3582 possible_net_t _net;
3584 #ifdef CONFIG_CFG80211_WEXT
3585 const struct iw_handler_def *wext;
3588 const struct wiphy_coalesce_support *coalesce;
3590 const struct wiphy_vendor_command *vendor_commands;
3591 const struct nl80211_vendor_cmd_info *vendor_events;
3592 int n_vendor_commands, n_vendor_events;
3594 u16 max_ap_assoc_sta;
3596 u8 max_num_csa_counters;
3597 u8 max_adj_channel_rssi_comp;
3599 u32 bss_select_support;
3601 char priv[0] __aligned(NETDEV_ALIGN);
3604 static inline struct net *wiphy_net(struct wiphy *wiphy)
3606 return read_pnet(&wiphy->_net);
3609 static inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
3611 write_pnet(&wiphy->_net, net);
3615 * wiphy_priv - return priv from wiphy
3617 * @wiphy: the wiphy whose priv pointer to return
3618 * Return: The priv of @wiphy.
3620 static inline void *wiphy_priv(struct wiphy *wiphy)
3623 return &wiphy->priv;
3627 * priv_to_wiphy - return the wiphy containing the priv
3629 * @priv: a pointer previously returned by wiphy_priv
3630 * Return: The wiphy of @priv.
3632 static inline struct wiphy *priv_to_wiphy(void *priv)
3635 return container_of(priv, struct wiphy, priv);
3639 * set_wiphy_dev - set device pointer for wiphy
3641 * @wiphy: The wiphy whose device to bind
3642 * @dev: The device to parent it to
3644 static inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
3646 wiphy->dev.parent = dev;
3650 * wiphy_dev - get wiphy dev pointer
3652 * @wiphy: The wiphy whose device struct to look up
3653 * Return: The dev of @wiphy.
3655 static inline struct device *wiphy_dev(struct wiphy *wiphy)
3657 return wiphy->dev.parent;
3661 * wiphy_name - get wiphy name
3663 * @wiphy: The wiphy whose name to return
3664 * Return: The name of @wiphy.
3666 static inline const char *wiphy_name(const struct wiphy *wiphy)
3668 return dev_name(&wiphy->dev);
3672 * wiphy_new_nm - create a new wiphy for use with cfg80211
3674 * @ops: The configuration operations for this device
3675 * @sizeof_priv: The size of the private area to allocate
3676 * @requested_name: Request a particular name.
3677 * NULL is valid value, and means use the default phy%d naming.
3679 * Create a new wiphy and associate the given operations with it.
3680 * @sizeof_priv bytes are allocated for private use.
3682 * Return: A pointer to the new wiphy. This pointer must be
3683 * assigned to each netdev's ieee80211_ptr for proper operation.
3685 struct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
3686 const char *requested_name);
3689 * wiphy_new - create a new wiphy for use with cfg80211
3691 * @ops: The configuration operations for this device
3692 * @sizeof_priv: The size of the private area to allocate
3694 * Create a new wiphy and associate the given operations with it.
3695 * @sizeof_priv bytes are allocated for private use.
3697 * Return: A pointer to the new wiphy. This pointer must be
3698 * assigned to each netdev's ieee80211_ptr for proper operation.
3700 static inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
3703 return wiphy_new_nm(ops, sizeof_priv, NULL);
3707 * wiphy_register - register a wiphy with cfg80211
3709 * @wiphy: The wiphy to register.
3711 * Return: A non-negative wiphy index or a negative error code.
3713 int wiphy_register(struct wiphy *wiphy);
3716 * wiphy_unregister - deregister a wiphy from cfg80211
3718 * @wiphy: The wiphy to unregister.
3720 * After this call, no more requests can be made with this priv
3721 * pointer, but the call may sleep to wait for an outstanding
3722 * request that is being handled.
3724 void wiphy_unregister(struct wiphy *wiphy);
3727 * wiphy_free - free wiphy
3729 * @wiphy: The wiphy to free
3731 void wiphy_free(struct wiphy *wiphy);
3733 /* internal structs */
3734 struct cfg80211_conn;
3735 struct cfg80211_internal_bss;
3736 struct cfg80211_cached_keys;
3739 * struct wireless_dev - wireless device state
3741 * For netdevs, this structure must be allocated by the driver
3742 * that uses the ieee80211_ptr field in struct net_device (this
3743 * is intentional so it can be allocated along with the netdev.)
3744 * It need not be registered then as netdev registration will
3745 * be intercepted by cfg80211 to see the new wireless device.
3747 * For non-netdev uses, it must also be allocated by the driver
3748 * in response to the cfg80211 callbacks that require it, as
3749 * there's no netdev registration in that case it may not be
3750 * allocated outside of callback operations that return it.
3752 * @wiphy: pointer to hardware description
3753 * @iftype: interface type
3754 * @list: (private) Used to collect the interfaces
3755 * @netdev: (private) Used to reference back to the netdev, may be %NULL
3756 * @identifier: (private) Identifier used in nl80211 to identify this
3757 * wireless device if it has no netdev
3758 * @current_bss: (private) Used by the internal configuration code
3759 * @chandef: (private) Used by the internal configuration code to track
3760 * the user-set channel definition.
3761 * @preset_chandef: (private) Used by the internal configuration code to
3762 * track the channel to be used for AP later
3763 * @bssid: (private) Used by the internal configuration code
3764 * @ssid: (private) Used by the internal configuration code
3765 * @ssid_len: (private) Used by the internal configuration code
3766 * @mesh_id_len: (private) Used by the internal configuration code
3767 * @mesh_id_up_len: (private) Used by the internal configuration code
3768 * @wext: (private) Used by the internal wireless extensions compat code
3769 * @use_4addr: indicates 4addr mode is used on this interface, must be
3770 * set by driver (if supported) on add_interface BEFORE registering the
3771 * netdev and may otherwise be used by driver read-only, will be update
3772 * by cfg80211 on change_interface
3773 * @mgmt_registrations: list of registrations for management frames
3774 * @mgmt_registrations_lock: lock for the list
3775 * @mtx: mutex used to lock data in this struct, may be used by drivers
3776 * and some API functions require it held
3777 * @beacon_interval: beacon interval used on this device for transmitting
3778 * beacons, 0 when not valid
3779 * @address: The address for this device, valid only if @netdev is %NULL
3780 * @p2p_started: true if this is a P2P Device that has been started
3781 * @cac_started: true if DFS channel availability check has been started
3782 * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
3783 * @cac_time_ms: CAC time in ms
3784 * @ps: powersave mode is enabled
3785 * @ps_timeout: dynamic powersave timeout
3786 * @ap_unexpected_nlportid: (private) netlink port ID of application
3787 * registered for unexpected class 3 frames (AP mode)
3788 * @conn: (private) cfg80211 software SME connection state machine data
3789 * @connect_keys: (private) keys to set after connection is established
3790 * @conn_bss_type: connecting/connected BSS type
3791 * @conn_owner_nlportid: (private) connection owner socket port ID
3792 * @disconnect_wk: (private) auto-disconnect work
3793 * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
3794 * @ibss_fixed: (private) IBSS is using fixed BSSID
3795 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3796 * @event_list: (private) list for internal event processing
3797 * @event_lock: (private) lock for event list
3798 * @owner_nlportid: (private) owner socket port ID
3800 struct wireless_dev {
3801 struct wiphy *wiphy;
3802 enum nl80211_iftype iftype;
3804 /* the remainder of this struct should be private to cfg80211 */
3805 struct list_head list;
3806 struct net_device *netdev;
3810 struct list_head mgmt_registrations;
3811 spinlock_t mgmt_registrations_lock;
3815 bool use_4addr, p2p_started;
3817 u8 address[ETH_ALEN] __aligned(sizeof(u16));
3819 /* currently used for IBSS and SME - might be rearranged later */
3820 u8 ssid[IEEE80211_MAX_SSID_LEN];
3821 u8 ssid_len, mesh_id_len, mesh_id_up_len;
3822 struct cfg80211_conn *conn;
3823 struct cfg80211_cached_keys *connect_keys;
3824 enum ieee80211_bss_type conn_bss_type;
3825 u32 conn_owner_nlportid;
3827 struct work_struct disconnect_wk;
3828 u8 disconnect_bssid[ETH_ALEN];
3830 struct list_head event_list;
3831 spinlock_t event_lock;
3833 struct cfg80211_internal_bss *current_bss; /* associated / joined */
3834 struct cfg80211_chan_def preset_chandef;
3835 struct cfg80211_chan_def chandef;
3838 bool ibss_dfs_possible;
3843 int beacon_interval;
3845 u32 ap_unexpected_nlportid;
3848 unsigned long cac_start_time;
3849 unsigned int cac_time_ms;
3853 #ifdef CONFIG_CFG80211_WEXT
3856 struct cfg80211_ibss_params ibss;
3857 struct cfg80211_connect_params connect;
3858 struct cfg80211_cached_keys *keys;
3861 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
3862 u8 ssid[IEEE80211_MAX_SSID_LEN];
3863 s8 default_key, default_mgmt_key;
3864 bool prev_bssid_valid;
3869 static inline u8 *wdev_address(struct wireless_dev *wdev)
3872 return wdev->netdev->dev_addr;
3873 return wdev->address;
3877 * wdev_priv - return wiphy priv from wireless_dev
3879 * @wdev: The wireless device whose wiphy's priv pointer to return
3880 * Return: The wiphy priv of @wdev.
3882 static inline void *wdev_priv(struct wireless_dev *wdev)
3885 return wiphy_priv(wdev->wiphy);
3889 * DOC: Utility functions
3891 * cfg80211 offers a number of utility functions that can be useful.
3895 * ieee80211_channel_to_frequency - convert channel number to frequency
3896 * @chan: channel number
3897 * @band: band, necessary due to channel number overlap
3898 * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
3900 int ieee80211_channel_to_frequency(int chan, enum ieee80211_band band);
3903 * ieee80211_frequency_to_channel - convert frequency to channel number
3904 * @freq: center frequency
3905 * Return: The corresponding channel, or 0 if the conversion failed.
3907 int ieee80211_frequency_to_channel(int freq);
3910 * Name indirection necessary because the ieee80211 code also has
3911 * a function named "ieee80211_get_channel", so if you include
3912 * cfg80211's header file you get cfg80211's version, if you try
3913 * to include both header files you'll (rightfully!) get a symbol
3916 struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
3919 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
3920 * @wiphy: the struct wiphy to get the channel for
3921 * @freq: the center frequency of the channel
3922 * Return: The channel struct from @wiphy at @freq.
3924 static inline struct ieee80211_channel *
3925 ieee80211_get_channel(struct wiphy *wiphy, int freq)
3927 return __ieee80211_get_channel(wiphy, freq);
3931 * ieee80211_get_response_rate - get basic rate for a given rate
3933 * @sband: the band to look for rates in
3934 * @basic_rates: bitmap of basic rates
3935 * @bitrate: the bitrate for which to find the basic rate
3937 * Return: The basic rate corresponding to a given bitrate, that
3938 * is the next lower bitrate contained in the basic rate map,
3939 * which is, for this function, given as a bitmap of indices of
3940 * rates in the band's bitrate table.
3942 struct ieee80211_rate *
3943 ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
3944 u32 basic_rates, int bitrate);
3947 * ieee80211_mandatory_rates - get mandatory rates for a given band
3948 * @sband: the band to look for rates in
3949 * @scan_width: width of the control channel
3951 * This function returns a bitmap of the mandatory rates for the given
3952 * band, bits are set according to the rate position in the bitrates array.
3954 u32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
3955 enum nl80211_bss_scan_width scan_width);
3958 * Radiotap parsing functions -- for controlled injection support
3960 * Implemented in net/wireless/radiotap.c
3961 * Documentation in Documentation/networking/radiotap-headers.txt
3964 struct radiotap_align_size {
3965 uint8_t align:4, size:4;
3968 struct ieee80211_radiotap_namespace {
3969 const struct radiotap_align_size *align_size;
3975 struct ieee80211_radiotap_vendor_namespaces {
3976 const struct ieee80211_radiotap_namespace *ns;
3981 * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
3982 * @this_arg_index: index of current arg, valid after each successful call
3983 * to ieee80211_radiotap_iterator_next()
3984 * @this_arg: pointer to current radiotap arg; it is valid after each
3985 * call to ieee80211_radiotap_iterator_next() but also after
3986 * ieee80211_radiotap_iterator_init() where it will point to
3987 * the beginning of the actual data portion
3988 * @this_arg_size: length of the current arg, for convenience
3989 * @current_namespace: pointer to the current namespace definition
3990 * (or internally %NULL if the current namespace is unknown)
3991 * @is_radiotap_ns: indicates whether the current namespace is the default
3992 * radiotap namespace or not
3994 * @_rtheader: pointer to the radiotap header we are walking through
3995 * @_max_length: length of radiotap header in cpu byte ordering
3996 * @_arg_index: next argument index
3997 * @_arg: next argument pointer
3998 * @_next_bitmap: internal pointer to next present u32
3999 * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
4000 * @_vns: vendor namespace definitions
4001 * @_next_ns_data: beginning of the next namespace's data
4002 * @_reset_on_ext: internal; reset the arg index to 0 when going to the
4005 * Describes the radiotap parser state. Fields prefixed with an underscore
4006 * must not be used by users of the parser, only by the parser internally.
4009 struct ieee80211_radiotap_iterator {
4010 struct ieee80211_radiotap_header *_rtheader;
4011 const struct ieee80211_radiotap_vendor_namespaces *_vns;
4012 const struct ieee80211_radiotap_namespace *current_namespace;
4014 unsigned char *_arg, *_next_ns_data;
4015 __le32 *_next_bitmap;
4017 unsigned char *this_arg;
4025 uint32_t _bitmap_shifter;
4030 ieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
4031 struct ieee80211_radiotap_header *radiotap_header,
4033 const struct ieee80211_radiotap_vendor_namespaces *vns);
4036 ieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
4039 extern const unsigned char rfc1042_header[6];
4040 extern const unsigned char bridge_tunnel_header[6];
4043 * ieee80211_get_hdrlen_from_skb - get header length from data
4047 * Given an skb with a raw 802.11 header at the data pointer this function
4048 * returns the 802.11 header length.
4050 * Return: The 802.11 header length in bytes (not including encryption
4051 * headers). Or 0 if the data in the sk_buff is too short to contain a valid
4054 unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
4057 * ieee80211_hdrlen - get header length in bytes from frame control
4058 * @fc: frame control field in little-endian format
4059 * Return: The header length in bytes.
4061 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
4064 * ieee80211_get_mesh_hdrlen - get mesh extension header length
4065 * @meshhdr: the mesh extension header, only the flags field
4066 * (first byte) will be accessed
4067 * Return: The length of the extension header, which is always at
4068 * least 6 bytes and at most 18 if address 5 and 6 are present.
4070 unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
4073 * DOC: Data path helpers
4075 * In addition to generic utilities, cfg80211 also offers
4076 * functions that help implement the data path for devices
4077 * that do not do the 802.11/802.3 conversion on the device.
4081 * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
4082 * @skb: the 802.11 data frame
4083 * @addr: the device MAC address
4084 * @iftype: the virtual interface type
4085 * Return: 0 on success. Non-zero on error.
4087 int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
4088 enum nl80211_iftype iftype);
4091 * ieee80211_data_from_8023 - convert an 802.3 frame to 802.11
4092 * @skb: the 802.3 frame
4093 * @addr: the device MAC address
4094 * @iftype: the virtual interface type
4095 * @bssid: the network bssid (used only for iftype STATION and ADHOC)
4096 * @qos: build 802.11 QoS data frame
4097 * Return: 0 on success, or a negative error code.
4099 int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr,
4100 enum nl80211_iftype iftype, const u8 *bssid,
4104 * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
4106 * Decode an IEEE 802.11n A-MSDU frame and convert it to a list of
4107 * 802.3 frames. The @list will be empty if the decode fails. The
4108 * @skb is consumed after the function returns.
4110 * @skb: The input IEEE 802.11n A-MSDU frame.
4111 * @list: The output list of 802.3 frames. It must be allocated and
4112 * initialized by by the caller.
4113 * @addr: The device MAC address.
4114 * @iftype: The device interface type.
4115 * @extra_headroom: The hardware extra headroom for SKBs in the @list.
4116 * @has_80211_header: Set it true if SKB is with IEEE 802.11 header.
4118 void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
4119 const u8 *addr, enum nl80211_iftype iftype,
4120 const unsigned int extra_headroom,
4121 bool has_80211_header);
4124 * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
4125 * @skb: the data frame
4126 * @qos_map: Interworking QoS mapping or %NULL if not in use
4127 * Return: The 802.1p/1d tag.
4129 unsigned int cfg80211_classify8021d(struct sk_buff *skb,
4130 struct cfg80211_qos_map *qos_map);
4133 * cfg80211_find_ie - find information element in data
4136 * @ies: data consisting of IEs
4137 * @len: length of data
4139 * Return: %NULL if the element ID could not be found or if
4140 * the element is invalid (claims to be longer than the given
4141 * data), or a pointer to the first byte of the requested
4142 * element, that is the byte containing the element ID.
4144 * Note: There are no checks on the element length other than
4145 * having to fit into the given data.
4147 const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len);
4150 * cfg80211_find_vendor_ie - find vendor specific information element in data
4153 * @oui_type: vendor-specific OUI type
4154 * @ies: data consisting of IEs
4155 * @len: length of data
4157 * Return: %NULL if the vendor specific element ID could not be found or if the
4158 * element is invalid (claims to be longer than the given data), or a pointer to
4159 * the first byte of the requested element, that is the byte containing the
4162 * Note: There are no checks on the element length other than having to fit into
4165 const u8 *cfg80211_find_vendor_ie(unsigned int oui, u8 oui_type,
4166 const u8 *ies, int len);
4169 * DOC: Regulatory enforcement infrastructure
4175 * regulatory_hint - driver hint to the wireless core a regulatory domain
4176 * @wiphy: the wireless device giving the hint (used only for reporting
4178 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
4179 * should be in. If @rd is set this should be NULL. Note that if you
4180 * set this to NULL you should still set rd->alpha2 to some accepted
4183 * Wireless drivers can use this function to hint to the wireless core
4184 * what it believes should be the current regulatory domain by
4185 * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
4186 * domain should be in or by providing a completely build regulatory domain.
4187 * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
4188 * for a regulatory domain structure for the respective country.
4190 * The wiphy must have been registered to cfg80211 prior to this call.
4191 * For cfg80211 drivers this means you must first use wiphy_register(),
4192 * for mac80211 drivers you must first use ieee80211_register_hw().
4194 * Drivers should check the return value, its possible you can get
4197 * Return: 0 on success. -ENOMEM.
4199 int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
4202 * regulatory_hint_user - hint to the wireless core a regulatory domain
4203 * which the driver has received from an application
4204 * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
4205 * should be in. If @rd is set this should be NULL. Note that if you
4206 * set this to NULL you should still set rd->alpha2 to some accepted
4208 * @user_reg_hint_type: the type of user regulatory hint.
4210 * Wireless drivers can use this function to hint to the wireless core
4211 * the current regulatory domain as specified by trusted applications,
4212 * it is the driver's responsibilty to estbalish which applications it
4215 * The wiphy should be registered to cfg80211 prior to this call.
4216 * For cfg80211 drivers this means you must first use wiphy_register(),
4217 * for mac80211 drivers you must first use ieee80211_register_hw().
4219 * Drivers should check the return value, its possible you can get
4220 * an -ENOMEM or an -EINVAL.
4222 * Return: 0 on success. -ENOMEM, -EINVAL.
4224 int regulatory_hint_user(const char *alpha2,
4225 enum nl80211_user_reg_hint_type user_reg_hint_type);
4228 * regulatory_set_wiphy_regd - set regdom info for self managed drivers
4229 * @wiphy: the wireless device we want to process the regulatory domain on
4230 * @rd: the regulatory domain informatoin to use for this wiphy
4232 * Set the regulatory domain information for self-managed wiphys, only they
4233 * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
4236 * Return: 0 on success. -EINVAL, -EPERM
4238 int regulatory_set_wiphy_regd(struct wiphy *wiphy,
4239 struct ieee80211_regdomain *rd);
4242 * regulatory_set_wiphy_regd_sync_rtnl - set regdom for self-managed drivers
4243 * @wiphy: the wireless device we want to process the regulatory domain on
4244 * @rd: the regulatory domain information to use for this wiphy
4246 * This functions requires the RTNL to be held and applies the new regdomain
4247 * synchronously to this wiphy. For more details see
4248 * regulatory_set_wiphy_regd().
4250 * Return: 0 on success. -EINVAL, -EPERM
4252 int regulatory_set_wiphy_regd_sync_rtnl(struct wiphy *wiphy,
4253 struct ieee80211_regdomain *rd);
4256 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
4257 * @wiphy: the wireless device we want to process the regulatory domain on
4258 * @regd: the custom regulatory domain to use for this wiphy
4260 * Drivers can sometimes have custom regulatory domains which do not apply
4261 * to a specific country. Drivers can use this to apply such custom regulatory
4262 * domains. This routine must be called prior to wiphy registration. The
4263 * custom regulatory domain will be trusted completely and as such previous
4264 * default channel settings will be disregarded. If no rule is found for a
4265 * channel on the regulatory domain the channel will be disabled.
4266 * Drivers using this for a wiphy should also set the wiphy flag
4267 * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
4268 * that called this helper.
4270 void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
4271 const struct ieee80211_regdomain *regd);
4274 * freq_reg_info - get regulatory information for the given frequency
4275 * @wiphy: the wiphy for which we want to process this rule for
4276 * @center_freq: Frequency in KHz for which we want regulatory information for
4278 * Use this function to get the regulatory rule for a specific frequency on
4279 * a given wireless device. If the device has a specific regulatory domain
4280 * it wants to follow we respect that unless a country IE has been received
4281 * and processed already.
4283 * Return: A valid pointer, or, when an error occurs, for example if no rule
4284 * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
4285 * check and PTR_ERR() to obtain the numeric return value. The numeric return
4286 * value will be -ERANGE if we determine the given center_freq does not even
4287 * have a regulatory rule for a frequency range in the center_freq's band.
4288 * See freq_in_rule_band() for our current definition of a band -- this is
4289 * purely subjective and right now it's 802.11 specific.
4291 const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
4295 * reg_initiator_name - map regulatory request initiator enum to name
4296 * @initiator: the regulatory request initiator
4298 * You can use this to map the regulatory request initiator enum to a
4299 * proper string representation.
4301 const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
4304 * callbacks for asynchronous cfg80211 methods, notification
4305 * functions and BSS handling helpers
4309 * cfg80211_scan_done - notify that scan finished
4311 * @request: the corresponding scan request
4312 * @aborted: set to true if the scan was aborted for any reason,
4313 * userspace will be notified of that
4315 void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
4318 * cfg80211_sched_scan_results - notify that new scan results are available
4320 * @wiphy: the wiphy which got scheduled scan results
4322 void cfg80211_sched_scan_results(struct wiphy *wiphy);
4325 * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
4327 * @wiphy: the wiphy on which the scheduled scan stopped
4329 * The driver can call this function to inform cfg80211 that the
4330 * scheduled scan had to be stopped, for whatever reason. The driver
4331 * is then called back via the sched_scan_stop operation when done.
4333 void cfg80211_sched_scan_stopped(struct wiphy *wiphy);
4336 * cfg80211_sched_scan_stopped_rtnl - notify that the scheduled scan has stopped
4338 * @wiphy: the wiphy on which the scheduled scan stopped
4340 * The driver can call this function to inform cfg80211 that the
4341 * scheduled scan had to be stopped, for whatever reason. The driver
4342 * is then called back via the sched_scan_stop operation when done.
4343 * This function should be called with rtnl locked.
4345 void cfg80211_sched_scan_stopped_rtnl(struct wiphy *wiphy);
4348 * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
4349 * @wiphy: the wiphy reporting the BSS
4350 * @data: the BSS metadata
4351 * @mgmt: the management frame (probe response or beacon)
4352 * @len: length of the management frame
4353 * @gfp: context flags
4355 * This informs cfg80211 that BSS information was found and
4356 * the BSS should be updated/added.
4358 * Return: A referenced struct, must be released with cfg80211_put_bss()!
4359 * Or %NULL on error.
4361 struct cfg80211_bss * __must_check
4362 cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
4363 struct cfg80211_inform_bss *data,
4364 struct ieee80211_mgmt *mgmt, size_t len,
4367 static inline struct cfg80211_bss * __must_check
4368 cfg80211_inform_bss_width_frame(struct wiphy *wiphy,
4369 struct ieee80211_channel *rx_channel,
4370 enum nl80211_bss_scan_width scan_width,
4371 struct ieee80211_mgmt *mgmt, size_t len,
4372 s32 signal, gfp_t gfp)
4374 struct cfg80211_inform_bss data = {
4376 .scan_width = scan_width,
4380 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
4383 static inline struct cfg80211_bss * __must_check
4384 cfg80211_inform_bss_frame(struct wiphy *wiphy,
4385 struct ieee80211_channel *rx_channel,
4386 struct ieee80211_mgmt *mgmt, size_t len,
4387 s32 signal, gfp_t gfp)
4389 struct cfg80211_inform_bss data = {
4391 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
4395 return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
4399 * enum cfg80211_bss_frame_type - frame type that the BSS data came from
4400 * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
4401 * from a beacon or probe response
4402 * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
4403 * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
4405 enum cfg80211_bss_frame_type {
4406 CFG80211_BSS_FTYPE_UNKNOWN,
4407 CFG80211_BSS_FTYPE_BEACON,
4408 CFG80211_BSS_FTYPE_PRESP,
4412 * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
4414 * @wiphy: the wiphy reporting the BSS
4415 * @data: the BSS metadata
4416 * @ftype: frame type (if known)
4417 * @bssid: the BSSID of the BSS
4418 * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
4419 * @capability: the capability field sent by the peer
4420 * @beacon_interval: the beacon interval announced by the peer
4421 * @ie: additional IEs sent by the peer
4422 * @ielen: length of the additional IEs
4423 * @gfp: context flags
4425 * This informs cfg80211 that BSS information was found and
4426 * the BSS should be updated/added.
4428 * Return: A referenced struct, must be released with cfg80211_put_bss()!
4429 * Or %NULL on error.
4431 struct cfg80211_bss * __must_check
4432 cfg80211_inform_bss_data(struct wiphy *wiphy,
4433 struct cfg80211_inform_bss *data,
4434 enum cfg80211_bss_frame_type ftype,
4435 const u8 *bssid, u64 tsf, u16 capability,
4436 u16 beacon_interval, const u8 *ie, size_t ielen,
4439 static inline struct cfg80211_bss * __must_check
4440 cfg80211_inform_bss_width(struct wiphy *wiphy,
4441 struct ieee80211_channel *rx_channel,
4442 enum nl80211_bss_scan_width scan_width,
4443 enum cfg80211_bss_frame_type ftype,
4444 const u8 *bssid, u64 tsf, u16 capability,
4445 u16 beacon_interval, const u8 *ie, size_t ielen,
4446 s32 signal, gfp_t gfp)
4448 struct cfg80211_inform_bss data = {
4450 .scan_width = scan_width,
4454 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
4455 capability, beacon_interval, ie, ielen,
4459 static inline struct cfg80211_bss * __must_check
4460 cfg80211_inform_bss(struct wiphy *wiphy,
4461 struct ieee80211_channel *rx_channel,
4462 enum cfg80211_bss_frame_type ftype,
4463 const u8 *bssid, u64 tsf, u16 capability,
4464 u16 beacon_interval, const u8 *ie, size_t ielen,
4465 s32 signal, gfp_t gfp)
4467 struct cfg80211_inform_bss data = {
4469 .scan_width = NL80211_BSS_CHAN_WIDTH_20,
4473 return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
4474 capability, beacon_interval, ie, ielen,
4478 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
4479 struct ieee80211_channel *channel,
4481 const u8 *ssid, size_t ssid_len,
4482 enum ieee80211_bss_type bss_type,
4483 enum ieee80211_privacy);
4484 static inline struct cfg80211_bss *
4485 cfg80211_get_ibss(struct wiphy *wiphy,
4486 struct ieee80211_channel *channel,
4487 const u8 *ssid, size_t ssid_len)
4489 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
4490 IEEE80211_BSS_TYPE_IBSS,
4491 IEEE80211_PRIVACY_ANY);
4495 * cfg80211_ref_bss - reference BSS struct
4496 * @wiphy: the wiphy this BSS struct belongs to
4497 * @bss: the BSS struct to reference
4499 * Increments the refcount of the given BSS struct.
4501 void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
4504 * cfg80211_put_bss - unref BSS struct
4505 * @wiphy: the wiphy this BSS struct belongs to
4506 * @bss: the BSS struct
4508 * Decrements the refcount of the given BSS struct.
4510 void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
4513 * cfg80211_unlink_bss - unlink BSS from internal data structures
4515 * @bss: the bss to remove
4517 * This function removes the given BSS from the internal data structures
4518 * thereby making it no longer show up in scan results etc. Use this
4519 * function when you detect a BSS is gone. Normally BSSes will also time
4520 * out, so it is not necessary to use this function at all.
4522 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
4524 static inline enum nl80211_bss_scan_width
4525 cfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
4527 switch (chandef->width) {
4528 case NL80211_CHAN_WIDTH_5:
4529 return NL80211_BSS_CHAN_WIDTH_5;
4530 case NL80211_CHAN_WIDTH_10:
4531 return NL80211_BSS_CHAN_WIDTH_10;
4533 return NL80211_BSS_CHAN_WIDTH_20;
4538 * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
4539 * @dev: network device
4540 * @buf: authentication frame (header + body)
4541 * @len: length of the frame data
4543 * This function is called whenever an authentication, disassociation or
4544 * deauthentication frame has been received and processed in station mode.
4545 * After being asked to authenticate via cfg80211_ops::auth() the driver must
4546 * call either this function or cfg80211_auth_timeout().
4547 * After being asked to associate via cfg80211_ops::assoc() the driver must
4548 * call either this function or cfg80211_auth_timeout().
4549 * While connected, the driver must calls this for received and processed
4550 * disassociation and deauthentication frames. If the frame couldn't be used
4551 * because it was unprotected, the driver must call the function
4552 * cfg80211_rx_unprot_mlme_mgmt() instead.
4554 * This function may sleep. The caller must hold the corresponding wdev's mutex.
4556 void cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
4559 * cfg80211_auth_timeout - notification of timed out authentication
4560 * @dev: network device
4561 * @addr: The MAC address of the device with which the authentication timed out
4563 * This function may sleep. The caller must hold the corresponding wdev's
4566 void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
4569 * cfg80211_rx_assoc_resp - notification of processed association response
4570 * @dev: network device
4571 * @bss: the BSS that association was requested with, ownership of the pointer
4572 * moves to cfg80211 in this call
4573 * @buf: authentication frame (header + body)
4574 * @len: length of the frame data
4575 * @uapsd_queues: bitmap of ACs configured to uapsd. -1 if n/a.
4577 * After being asked to associate via cfg80211_ops::assoc() the driver must
4578 * call either this function or cfg80211_auth_timeout().
4580 * This function may sleep. The caller must hold the corresponding wdev's mutex.
4582 void cfg80211_rx_assoc_resp(struct net_device *dev,
4583 struct cfg80211_bss *bss,
4584 const u8 *buf, size_t len,
4588 * cfg80211_assoc_timeout - notification of timed out association
4589 * @dev: network device
4590 * @bss: The BSS entry with which association timed out.
4592 * This function may sleep. The caller must hold the corresponding wdev's mutex.
4594 void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss);
4597 * cfg80211_abandon_assoc - notify cfg80211 of abandoned association attempt
4598 * @dev: network device
4599 * @bss: The BSS entry with which association was abandoned.
4601 * Call this whenever - for reasons reported through other API, like deauth RX,
4602 * an association attempt was abandoned.
4603 * This function may sleep. The caller must hold the corresponding wdev's mutex.
4605 void cfg80211_abandon_assoc(struct net_device *dev, struct cfg80211_bss *bss);
4608 * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
4609 * @dev: network device
4610 * @buf: 802.11 frame (header + body)
4611 * @len: length of the frame data
4613 * This function is called whenever deauthentication has been processed in
4614 * station mode. This includes both received deauthentication frames and
4615 * locally generated ones. This function may sleep. The caller must hold the
4616 * corresponding wdev's mutex.
4618 void cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
4621 * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
4622 * @dev: network device
4623 * @buf: deauthentication frame (header + body)
4624 * @len: length of the frame data
4626 * This function is called whenever a received deauthentication or dissassoc
4627 * frame has been dropped in station mode because of MFP being used but the
4628 * frame was not protected. This function may sleep.
4630 void cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
4631 const u8 *buf, size_t len);
4634 * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
4635 * @dev: network device
4636 * @addr: The source MAC address of the frame
4637 * @key_type: The key type that the received frame used
4638 * @key_id: Key identifier (0..3). Can be -1 if missing.
4639 * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
4640 * @gfp: allocation flags
4642 * This function is called whenever the local MAC detects a MIC failure in a
4643 * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
4646 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
4647 enum nl80211_key_type key_type, int key_id,
4648 const u8 *tsc, gfp_t gfp);
4651 * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
4653 * @dev: network device
4654 * @bssid: the BSSID of the IBSS joined
4655 * @channel: the channel of the IBSS joined
4656 * @gfp: allocation flags
4658 * This function notifies cfg80211 that the device joined an IBSS or
4659 * switched to a different BSSID. Before this function can be called,
4660 * either a beacon has to have been received from the IBSS, or one of
4661 * the cfg80211_inform_bss{,_frame} functions must have been called
4662 * with the locally generated beacon -- this guarantees that there is
4663 * always a scan result for this IBSS. cfg80211 will handle the rest.
4665 void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
4666 struct ieee80211_channel *channel, gfp_t gfp);
4669 * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate
4671 * @dev: network device
4672 * @macaddr: the MAC address of the new candidate
4673 * @ie: information elements advertised by the peer candidate
4674 * @ie_len: lenght of the information elements buffer
4675 * @gfp: allocation flags
4677 * This function notifies cfg80211 that the mesh peer candidate has been
4678 * detected, most likely via a beacon or, less likely, via a probe response.
4679 * cfg80211 then sends a notification to userspace.
4681 void cfg80211_notify_new_peer_candidate(struct net_device *dev,
4682 const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp);
4685 * DOC: RFkill integration
4687 * RFkill integration in cfg80211 is almost invisible to drivers,
4688 * as cfg80211 automatically registers an rfkill instance for each
4689 * wireless device it knows about. Soft kill is also translated
4690 * into disconnecting and turning all interfaces off, drivers are
4691 * expected to turn off the device when all interfaces are down.
4693 * However, devices may have a hard RFkill line, in which case they
4694 * also need to interact with the rfkill subsystem, via cfg80211.
4695 * They can do this with a few helper functions documented here.
4699 * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state
4701 * @blocked: block status
4703 void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked);
4706 * wiphy_rfkill_start_polling - start polling rfkill
4709 void wiphy_rfkill_start_polling(struct wiphy *wiphy);
4712 * wiphy_rfkill_stop_polling - stop polling rfkill
4715 void wiphy_rfkill_stop_polling(struct wiphy *wiphy);
4718 * DOC: Vendor commands
4720 * Occasionally, there are special protocol or firmware features that
4721 * can't be implemented very openly. For this and similar cases, the
4722 * vendor command functionality allows implementing the features with
4723 * (typically closed-source) userspace and firmware, using nl80211 as
4724 * the configuration mechanism.
4726 * A driver supporting vendor commands must register them as an array
4727 * in struct wiphy, with handlers for each one, each command has an
4728 * OUI and sub command ID to identify it.
4730 * Note that this feature should not be (ab)used to implement protocol
4731 * features that could openly be shared across drivers. In particular,
4732 * it must never be required to use vendor commands to implement any
4733 * "normal" functionality that higher-level userspace like connection
4734 * managers etc. need.
4737 struct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
4738 enum nl80211_commands cmd,
4739 enum nl80211_attrs attr,
4742 struct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
4743 struct wireless_dev *wdev,
4744 enum nl80211_commands cmd,
4745 enum nl80211_attrs attr,
4746 int vendor_event_idx,
4747 int approxlen, gfp_t gfp);
4749 void __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
4752 * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
4754 * @approxlen: an upper bound of the length of the data that will
4755 * be put into the skb
4757 * This function allocates and pre-fills an skb for a reply to
4758 * a vendor command. Since it is intended for a reply, calling
4759 * it outside of a vendor command's doit() operation is invalid.
4761 * The returned skb is pre-filled with some identifying data in
4762 * a way that any data that is put into the skb (with skb_put(),
4763 * nla_put() or similar) will end up being within the
4764 * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
4765 * with the skb is adding data for the corresponding userspace tool
4766 * which can then read that data out of the vendor data attribute.
4767 * You must not modify the skb in any other way.
4769 * When done, call cfg80211_vendor_cmd_reply() with the skb and return
4770 * its error code as the result of the doit() operation.
4772 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4774 static inline struct sk_buff *
4775 cfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
4777 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
4778 NL80211_ATTR_VENDOR_DATA, approxlen);
4782 * cfg80211_vendor_cmd_reply - send the reply skb
4783 * @skb: The skb, must have been allocated with
4784 * cfg80211_vendor_cmd_alloc_reply_skb()
4786 * Since calling this function will usually be the last thing
4787 * before returning from the vendor command doit() you should
4788 * return the error code. Note that this function consumes the
4789 * skb regardless of the return value.
4791 * Return: An error code or 0 on success.
4793 int cfg80211_vendor_cmd_reply(struct sk_buff *skb);
4796 * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
4798 * @wdev: the wireless device
4799 * @event_idx: index of the vendor event in the wiphy's vendor_events
4800 * @approxlen: an upper bound of the length of the data that will
4801 * be put into the skb
4802 * @gfp: allocation flags
4804 * This function allocates and pre-fills an skb for an event on the
4805 * vendor-specific multicast group.
4807 * If wdev != NULL, both the ifindex and identifier of the specified
4808 * wireless device are added to the event message before the vendor data
4811 * When done filling the skb, call cfg80211_vendor_event() with the
4812 * skb to send the event.
4814 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4816 static inline struct sk_buff *
4817 cfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
4818 int approxlen, int event_idx, gfp_t gfp)
4820 return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
4821 NL80211_ATTR_VENDOR_DATA,
4822 event_idx, approxlen, gfp);
4826 * cfg80211_vendor_event - send the event
4827 * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
4828 * @gfp: allocation flags
4830 * This function sends the given @skb, which must have been allocated
4831 * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
4833 static inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
4835 __cfg80211_send_event_skb(skb, gfp);
4838 #ifdef CONFIG_NL80211_TESTMODE
4842 * Test mode is a set of utility functions to allow drivers to
4843 * interact with driver-specific tools to aid, for instance,
4844 * factory programming.
4846 * This chapter describes how drivers interact with it, for more
4847 * information see the nl80211 book's chapter on it.
4851 * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
4853 * @approxlen: an upper bound of the length of the data that will
4854 * be put into the skb
4856 * This function allocates and pre-fills an skb for a reply to
4857 * the testmode command. Since it is intended for a reply, calling
4858 * it outside of the @testmode_cmd operation is invalid.
4860 * The returned skb is pre-filled with the wiphy index and set up in
4861 * a way that any data that is put into the skb (with skb_put(),
4862 * nla_put() or similar) will end up being within the
4863 * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
4864 * with the skb is adding data for the corresponding userspace tool
4865 * which can then read that data out of the testdata attribute. You
4866 * must not modify the skb in any other way.
4868 * When done, call cfg80211_testmode_reply() with the skb and return
4869 * its error code as the result of the @testmode_cmd operation.
4871 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4873 static inline struct sk_buff *
4874 cfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
4876 return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
4877 NL80211_ATTR_TESTDATA, approxlen);
4881 * cfg80211_testmode_reply - send the reply skb
4882 * @skb: The skb, must have been allocated with
4883 * cfg80211_testmode_alloc_reply_skb()
4885 * Since calling this function will usually be the last thing
4886 * before returning from the @testmode_cmd you should return
4887 * the error code. Note that this function consumes the skb
4888 * regardless of the return value.
4890 * Return: An error code or 0 on success.
4892 static inline int cfg80211_testmode_reply(struct sk_buff *skb)
4894 return cfg80211_vendor_cmd_reply(skb);
4898 * cfg80211_testmode_alloc_event_skb - allocate testmode event
4900 * @approxlen: an upper bound of the length of the data that will
4901 * be put into the skb
4902 * @gfp: allocation flags
4904 * This function allocates and pre-fills an skb for an event on the
4905 * testmode multicast group.
4907 * The returned skb is set up in the same way as with
4908 * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
4909 * there, you should simply add data to it that will then end up in the
4910 * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
4913 * When done filling the skb, call cfg80211_testmode_event() with the
4914 * skb to send the event.
4916 * Return: An allocated and pre-filled skb. %NULL if any errors happen.
4918 static inline struct sk_buff *
4919 cfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
4921 return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
4922 NL80211_ATTR_TESTDATA, -1,
4927 * cfg80211_testmode_event - send the event
4928 * @skb: The skb, must have been allocated with
4929 * cfg80211_testmode_alloc_event_skb()
4930 * @gfp: allocation flags
4932 * This function sends the given @skb, which must have been allocated
4933 * by cfg80211_testmode_alloc_event_skb(), as an event. It always
4936 static inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
4938 __cfg80211_send_event_skb(skb, gfp);
4941 #define CFG80211_TESTMODE_CMD(cmd) .testmode_cmd = (cmd),
4942 #define CFG80211_TESTMODE_DUMP(cmd) .testmode_dump = (cmd),
4944 #define CFG80211_TESTMODE_CMD(cmd)
4945 #define CFG80211_TESTMODE_DUMP(cmd)
4949 * struct cfg80211_connect_resp_params - Connection response params
4950 * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
4951 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
4952 * the real status code for failures. If this call is used to report a
4953 * failure due to a timeout (e.g., not receiving an Authentication frame
4954 * from the AP) instead of an explicit rejection by the AP, -1 is used to
4955 * indicate that this is a failure, but without a status code.
4956 * @timeout_reason is used to report the reason for the timeout in that
4958 * @bssid: The BSSID of the AP (may be %NULL)
4959 * @bss: Entry of bss to which STA got connected to, can be obtained through
4960 * cfg80211_get_bss() (may be %NULL). Only one parameter among @bssid and
4961 * @bss needs to be specified.
4962 * @req_ie: Association request IEs (may be %NULL)
4963 * @req_ie_len: Association request IEs length
4964 * @resp_ie: Association response IEs (may be %NULL)
4965 * @resp_ie_len: Association response IEs length
4966 * @fils_kek: KEK derived from a successful FILS connection (may be %NULL)
4967 * @fils_kek_len: Length of @fils_kek in octets
4968 * @update_erp_next_seq_num: Boolean value to specify whether the value in
4969 * @fils_erp_next_seq_num is valid.
4970 * @fils_erp_next_seq_num: The next sequence number to use in ERP message in
4971 * FILS Authentication. This value should be specified irrespective of the
4972 * status for a FILS connection.
4973 * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
4974 * @pmk_len: Length of @pmk in octets
4975 * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
4976 * used for this FILS connection (may be %NULL).
4977 * @timeout_reason: Reason for connection timeout. This is used when the
4978 * connection fails due to a timeout instead of an explicit rejection from
4979 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
4980 * not known. This value is used only if @status < 0 to indicate that the
4981 * failure is due to a timeout and not due to explicit rejection by the AP.
4982 * This value is ignored in other cases (@status >= 0).
4984 struct cfg80211_connect_resp_params {
4987 struct cfg80211_bss *bss;
4993 size_t fils_kek_len;
4994 bool update_erp_next_seq_num;
4995 u16 fils_erp_next_seq_num;
4999 enum nl80211_timeout_reason timeout_reason;
5003 * cfg80211_connect_done - notify cfg80211 of connection result
5005 * @dev: network device
5006 * @params: connection response parameters
5007 * @gfp: allocation flags
5009 * It should be called by the underlying driver once execution of the connection
5010 * request from connect() has been completed. This is similar to
5011 * cfg80211_connect_bss(), but takes a structure pointer for connection response
5012 * parameters. Only one of the functions among cfg80211_connect_bss(),
5013 * cfg80211_connect_result(), cfg80211_connect_timeout(),
5014 * and cfg80211_connect_done() should be called.
5016 void cfg80211_connect_done(struct net_device *dev,
5017 struct cfg80211_connect_resp_params *params,
5021 * cfg80211_connect_bss - notify cfg80211 of connection result
5023 * @dev: network device
5024 * @bssid: the BSSID of the AP
5025 * @bss: entry of bss to which STA got connected to, can be obtained
5026 * through cfg80211_get_bss (may be %NULL)
5027 * @req_ie: association request IEs (maybe be %NULL)
5028 * @req_ie_len: association request IEs length
5029 * @resp_ie: association response IEs (may be %NULL)
5030 * @resp_ie_len: assoc response IEs length
5031 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
5032 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
5033 * the real status code for failures. If this call is used to report a
5034 * failure due to a timeout (e.g., not receiving an Authentication frame
5035 * from the AP) instead of an explicit rejection by the AP, -1 is used to
5036 * indicate that this is a failure, but without a status code.
5037 * @timeout_reason is used to report the reason for the timeout in that
5039 * @gfp: allocation flags
5040 * @timeout_reason: reason for connection timeout. This is used when the
5041 * connection fails due to a timeout instead of an explicit rejection from
5042 * the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
5043 * not known. This value is used only if @status < 0 to indicate that the
5044 * failure is due to a timeout and not due to explicit rejection by the AP.
5045 * This value is ignored in other cases (@status >= 0).
5047 * It should be called by the underlying driver once execution of the connection
5048 * request from connect() has been completed. This is similar to
5049 * cfg80211_connect_result(), but with the option of identifying the exact bss
5050 * entry for the connection. Only one of the functions among
5051 * cfg80211_connect_bss(), cfg80211_connect_result(),
5052 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
5055 cfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
5056 struct cfg80211_bss *bss, const u8 *req_ie,
5057 size_t req_ie_len, const u8 *resp_ie,
5058 size_t resp_ie_len, int status, gfp_t gfp,
5059 enum nl80211_timeout_reason timeout_reason)
5061 struct cfg80211_connect_resp_params params;
5063 memset(¶ms, 0, sizeof(params));
5064 params.status = status;
5065 params.bssid = bssid;
5067 params.req_ie = req_ie;
5068 params.req_ie_len = req_ie_len;
5069 params.resp_ie = resp_ie;
5070 params.resp_ie_len = resp_ie_len;
5071 params.timeout_reason = timeout_reason;
5073 cfg80211_connect_done(dev, ¶ms, gfp);
5077 * cfg80211_connect_result - notify cfg80211 of connection result
5079 * @dev: network device
5080 * @bssid: the BSSID of the AP
5081 * @req_ie: association request IEs (maybe be %NULL)
5082 * @req_ie_len: association request IEs length
5083 * @resp_ie: association response IEs (may be %NULL)
5084 * @resp_ie_len: assoc response IEs length
5085 * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
5086 * %WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
5087 * the real status code for failures.
5088 * @gfp: allocation flags
5090 * It should be called by the underlying driver once execution of the connection
5091 * request from connect() has been completed. This is similar to
5092 * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
5093 * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
5094 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
5097 cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
5098 const u8 *req_ie, size_t req_ie_len,
5099 const u8 *resp_ie, size_t resp_ie_len,
5100 u16 status, gfp_t gfp)
5102 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
5103 resp_ie_len, status, gfp,
5104 NL80211_TIMEOUT_UNSPECIFIED);
5108 * cfg80211_connect_timeout - notify cfg80211 of connection timeout
5110 * @dev: network device
5111 * @bssid: the BSSID of the AP
5112 * @req_ie: association request IEs (maybe be %NULL)
5113 * @req_ie_len: association request IEs length
5114 * @gfp: allocation flags
5115 * @timeout_reason: reason for connection timeout.
5117 * It should be called by the underlying driver whenever connect() has failed
5118 * in a sequence where no explicit authentication/association rejection was
5119 * received from the AP. This could happen, e.g., due to not being able to send
5120 * out the Authentication or Association Request frame or timing out while
5121 * waiting for the response. Only one of the functions among
5122 * cfg80211_connect_bss(), cfg80211_connect_result(),
5123 * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
5126 cfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
5127 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
5128 enum nl80211_timeout_reason timeout_reason)
5130 cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
5131 gfp, timeout_reason);
5135 * cfg80211_roamed - notify cfg80211 of roaming
5137 * @dev: network device
5138 * @channel: the channel of the new AP
5139 * @bssid: the BSSID of the new AP
5140 * @req_ie: association request IEs (maybe be %NULL)
5141 * @req_ie_len: association request IEs length
5142 * @resp_ie: association response IEs (may be %NULL)
5143 * @resp_ie_len: assoc response IEs length
5144 * @gfp: allocation flags
5146 * It should be called by the underlying driver whenever it roamed
5147 * from one AP to another while connected.
5149 void cfg80211_roamed(struct net_device *dev,
5150 struct ieee80211_channel *channel,
5152 const u8 *req_ie, size_t req_ie_len,
5153 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
5156 * cfg80211_roamed_bss - notify cfg80211 of roaming
5158 * @dev: network device
5159 * @bss: entry of bss to which STA got roamed
5160 * @req_ie: association request IEs (maybe be %NULL)
5161 * @req_ie_len: association request IEs length
5162 * @resp_ie: association response IEs (may be %NULL)
5163 * @resp_ie_len: assoc response IEs length
5164 * @gfp: allocation flags
5166 * This is just a wrapper to notify cfg80211 of roaming event with driver
5167 * passing bss to avoid a race in timeout of the bss entry. It should be
5168 * called by the underlying driver whenever it roamed from one AP to another
5169 * while connected. Drivers which have roaming implemented in firmware
5170 * may use this function to avoid a race in bss entry timeout where the bss
5171 * entry of the new AP is seen in the driver, but gets timed out by the time
5172 * it is accessed in __cfg80211_roamed() due to delay in scheduling
5173 * rdev->event_work. In case of any failures, the reference is released
5174 * either in cfg80211_roamed_bss() or in __cfg80211_romed(), Otherwise,
5175 * it will be released while diconneting from the current bss.
5177 void cfg80211_roamed_bss(struct net_device *dev, struct cfg80211_bss *bss,
5178 const u8 *req_ie, size_t req_ie_len,
5179 const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp);
5182 * cfg80211_disconnected - notify cfg80211 that connection was dropped
5184 * @dev: network device
5185 * @ie: information elements of the deauth/disassoc frame (may be %NULL)
5186 * @ie_len: length of IEs
5187 * @reason: reason code for the disconnection, set it to 0 if unknown
5188 * @locally_generated: disconnection was requested locally
5189 * @gfp: allocation flags
5191 * After it calls this function, the driver should enter an idle state
5192 * and not try to connect to any AP any more.
5194 void cfg80211_disconnected(struct net_device *dev, u16 reason,
5195 const u8 *ie, size_t ie_len,
5196 bool locally_generated, gfp_t gfp);
5199 * cfg80211_ready_on_channel - notification of remain_on_channel start
5200 * @wdev: wireless device
5201 * @cookie: the request cookie
5202 * @chan: The current channel (from remain_on_channel request)
5203 * @duration: Duration in milliseconds that the driver intents to remain on the
5205 * @gfp: allocation flags
5207 void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
5208 struct ieee80211_channel *chan,
5209 unsigned int duration, gfp_t gfp);
5212 * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
5213 * @wdev: wireless device
5214 * @cookie: the request cookie
5215 * @chan: The current channel (from remain_on_channel request)
5216 * @gfp: allocation flags
5218 void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
5219 struct ieee80211_channel *chan,
5224 * cfg80211_new_sta - notify userspace about station
5227 * @mac_addr: the station's address
5228 * @sinfo: the station information
5229 * @gfp: allocation flags
5231 void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
5232 struct station_info *sinfo, gfp_t gfp);
5235 * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
5237 * @mac_addr: the station's address
5238 * @sinfo: the station information/statistics
5239 * @gfp: allocation flags
5241 void cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
5242 struct station_info *sinfo, gfp_t gfp);
5245 * cfg80211_del_sta - notify userspace about deletion of a station
5248 * @mac_addr: the station's address
5249 * @gfp: allocation flags
5251 static inline void cfg80211_del_sta(struct net_device *dev,
5252 const u8 *mac_addr, gfp_t gfp)
5254 cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
5258 * cfg80211_conn_failed - connection request failed notification
5261 * @mac_addr: the station's address
5262 * @reason: the reason for connection failure
5263 * @gfp: allocation flags
5265 * Whenever a station tries to connect to an AP and if the station
5266 * could not connect to the AP as the AP has rejected the connection
5267 * for some reasons, this function is called.
5269 * The reason for connection failure can be any of the value from
5270 * nl80211_connect_failed_reason enum
5272 void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
5273 enum nl80211_connect_failed_reason reason,
5277 * cfg80211_rx_mgmt - notification of received, unprocessed management frame
5278 * @wdev: wireless device receiving the frame
5279 * @freq: Frequency on which the frame was received in MHz
5280 * @sig_dbm: signal strength in mBm, or 0 if unknown
5281 * @buf: Management frame (header + body)
5282 * @len: length of the frame data
5283 * @flags: flags, as defined in enum nl80211_rxmgmt_flags
5285 * This function is called whenever an Action frame is received for a station
5286 * mode interface, but is not processed in kernel.
5288 * Return: %true if a user space application has registered for this frame.
5289 * For action frames, that makes it responsible for rejecting unrecognized
5290 * action frames; %false otherwise, in which case for action frames the
5291 * driver is responsible for rejecting the frame.
5293 bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
5294 const u8 *buf, size_t len, u32 flags);
5297 * cfg80211_mgmt_tx_status - notification of TX status for management frame
5298 * @wdev: wireless device receiving the frame
5299 * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
5300 * @buf: Management frame (header + body)
5301 * @len: length of the frame data
5302 * @ack: Whether frame was acknowledged
5303 * @gfp: context flags
5305 * This function is called whenever a management frame was requested to be
5306 * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
5307 * transmission attempt.
5309 void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
5310 const u8 *buf, size_t len, bool ack, gfp_t gfp);
5314 * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
5315 * @dev: network device
5316 * @rssi_event: the triggered RSSI event
5317 * @gfp: context flags
5319 * This function is called when a configured connection quality monitoring
5320 * rssi threshold reached event occurs.
5322 void cfg80211_cqm_rssi_notify(struct net_device *dev,
5323 enum nl80211_cqm_rssi_threshold_event rssi_event,
5327 * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
5328 * @dev: network device
5329 * @peer: peer's MAC address
5330 * @num_packets: how many packets were lost -- should be a fixed threshold
5331 * but probably no less than maybe 50, or maybe a throughput dependent
5332 * threshold (to account for temporary interference)
5333 * @gfp: context flags
5335 void cfg80211_cqm_pktloss_notify(struct net_device *dev,
5336 const u8 *peer, u32 num_packets, gfp_t gfp);
5339 * cfg80211_cqm_txe_notify - TX error rate event
5340 * @dev: network device
5341 * @peer: peer's MAC address
5342 * @num_packets: how many packets were lost
5343 * @rate: % of packets which failed transmission
5344 * @intvl: interval (in s) over which the TX failure threshold was breached.
5345 * @gfp: context flags
5347 * Notify userspace when configured % TX failures over number of packets in a
5348 * given interval is exceeded.
5350 void cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
5351 u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
5354 * cfg80211_cqm_beacon_loss_notify - beacon loss event
5355 * @dev: network device
5356 * @gfp: context flags
5358 * Notify userspace about beacon loss from the connected AP.
5360 void cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
5363 * cfg80211_radar_event - radar detection event
5365 * @chandef: chandef for the current channel
5366 * @gfp: context flags
5368 * This function is called when a radar is detected on the current chanenl.
5370 void cfg80211_radar_event(struct wiphy *wiphy,
5371 struct cfg80211_chan_def *chandef, gfp_t gfp);
5374 * cfg80211_cac_event - Channel availability check (CAC) event
5375 * @netdev: network device
5376 * @chandef: chandef for the current channel
5377 * @event: type of event
5378 * @gfp: context flags
5380 * This function is called when a Channel availability check (CAC) is finished
5381 * or aborted. This must be called to notify the completion of a CAC process,
5382 * also by full-MAC drivers.
5384 void cfg80211_cac_event(struct net_device *netdev,
5385 const struct cfg80211_chan_def *chandef,
5386 enum nl80211_radar_event event, gfp_t gfp);
5390 * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
5391 * @dev: network device
5392 * @bssid: BSSID of AP (to avoid races)
5393 * @replay_ctr: new replay counter
5394 * @gfp: allocation flags
5396 void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
5397 const u8 *replay_ctr, gfp_t gfp);
5400 * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
5401 * @dev: network device
5402 * @index: candidate index (the smaller the index, the higher the priority)
5403 * @bssid: BSSID of AP
5404 * @preauth: Whether AP advertises support for RSN pre-authentication
5405 * @gfp: allocation flags
5407 void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
5408 const u8 *bssid, bool preauth, gfp_t gfp);
5411 * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
5412 * @dev: The device the frame matched to
5413 * @addr: the transmitter address
5414 * @gfp: context flags
5416 * This function is used in AP mode (only!) to inform userspace that
5417 * a spurious class 3 frame was received, to be able to deauth the
5419 * Return: %true if the frame was passed to userspace (or this failed
5420 * for a reason other than not having a subscription.)
5422 bool cfg80211_rx_spurious_frame(struct net_device *dev,
5423 const u8 *addr, gfp_t gfp);
5426 * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
5427 * @dev: The device the frame matched to
5428 * @addr: the transmitter address
5429 * @gfp: context flags
5431 * This function is used in AP mode (only!) to inform userspace that
5432 * an associated station sent a 4addr frame but that wasn't expected.
5433 * It is allowed and desirable to send this event only once for each
5434 * station to avoid event flooding.
5435 * Return: %true if the frame was passed to userspace (or this failed
5436 * for a reason other than not having a subscription.)
5438 bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
5439 const u8 *addr, gfp_t gfp);
5442 * cfg80211_probe_status - notify userspace about probe status
5443 * @dev: the device the probe was sent on
5444 * @addr: the address of the peer
5445 * @cookie: the cookie filled in @probe_client previously
5446 * @acked: indicates whether probe was acked or not
5447 * @gfp: allocation flags
5449 void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
5450 u64 cookie, bool acked, gfp_t gfp);
5453 * cfg80211_report_obss_beacon - report beacon from other APs
5454 * @wiphy: The wiphy that received the beacon
5456 * @len: length of the frame
5457 * @freq: frequency the frame was received on
5458 * @sig_dbm: signal strength in mBm, or 0 if unknown
5460 * Use this function to report to userspace when a beacon was
5461 * received. It is not useful to call this when there is no
5462 * netdev that is in AP/GO mode.
5464 void cfg80211_report_obss_beacon(struct wiphy *wiphy,
5465 const u8 *frame, size_t len,
5466 int freq, int sig_dbm);
5469 * cfg80211_reg_can_beacon - check if beaconing is allowed
5471 * @chandef: the channel definition
5472 * @iftype: interface type
5474 * Return: %true if there is no secondary channel or the secondary channel(s)
5475 * can be used for beaconing (i.e. is not a radar channel etc.)
5477 bool cfg80211_reg_can_beacon(struct wiphy *wiphy,
5478 struct cfg80211_chan_def *chandef,
5479 enum nl80211_iftype iftype);
5482 * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
5484 * @chandef: the channel definition
5485 * @iftype: interface type
5487 * Return: %true if there is no secondary channel or the secondary channel(s)
5488 * can be used for beaconing (i.e. is not a radar channel etc.). This version
5489 * also checks if IR-relaxation conditions apply, to allow beaconing under
5490 * more permissive conditions.
5492 * Requires the RTNL to be held.
5494 bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
5495 struct cfg80211_chan_def *chandef,
5496 enum nl80211_iftype iftype);
5499 * cfg80211_ch_switch_notify - update wdev channel and notify userspace
5500 * @dev: the device which switched channels
5501 * @chandef: the new channel definition
5503 * Caller must acquire wdev_lock, therefore must only be called from sleepable
5506 void cfg80211_ch_switch_notify(struct net_device *dev,
5507 struct cfg80211_chan_def *chandef);
5510 * cfg80211_ch_switch_started_notify - notify channel switch start
5511 * @dev: the device on which the channel switch started
5512 * @chandef: the future channel definition
5513 * @count: the number of TBTTs until the channel switch happens
5515 * Inform the userspace about the channel switch that has just
5516 * started, so that it can take appropriate actions (eg. starting
5517 * channel switch on other vifs), if necessary.
5519 void cfg80211_ch_switch_started_notify(struct net_device *dev,
5520 struct cfg80211_chan_def *chandef,
5524 * ieee80211_operating_class_to_band - convert operating class to band
5526 * @operating_class: the operating class to convert
5527 * @band: band pointer to fill
5529 * Returns %true if the conversion was successful, %false otherwise.
5531 bool ieee80211_operating_class_to_band(u8 operating_class,
5532 enum ieee80211_band *band);
5535 * ieee80211_chandef_to_operating_class - convert chandef to operation class
5537 * @chandef: the chandef to convert
5538 * @op_class: a pointer to the resulting operating class
5540 * Returns %true if the conversion was successful, %false otherwise.
5542 bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
5546 * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
5547 * @dev: the device on which the operation is requested
5548 * @peer: the MAC address of the peer device
5549 * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
5550 * NL80211_TDLS_TEARDOWN)
5551 * @reason_code: the reason code for teardown request
5552 * @gfp: allocation flags
5554 * This function is used to request userspace to perform TDLS operation that
5555 * requires knowledge of keys, i.e., link setup or teardown when the AP
5556 * connection uses encryption. This is optional mechanism for the driver to use
5557 * if it can automatically determine when a TDLS link could be useful (e.g.,
5558 * based on traffic and signal strength for a peer).
5560 void cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
5561 enum nl80211_tdls_operation oper,
5562 u16 reason_code, gfp_t gfp);
5565 * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
5566 * @rate: given rate_info to calculate bitrate from
5568 * return 0 if MCS index >= 32
5570 u32 cfg80211_calculate_bitrate(struct rate_info *rate);
5573 * cfg80211_unregister_wdev - remove the given wdev
5574 * @wdev: struct wireless_dev to remove
5576 * Call this function only for wdevs that have no netdev assigned,
5577 * e.g. P2P Devices. It removes the device from the list so that
5578 * it can no longer be used. It is necessary to call this function
5579 * even when cfg80211 requests the removal of the interface by
5580 * calling the del_virtual_intf() callback. The function must also
5581 * be called when the driver wishes to unregister the wdev, e.g.
5582 * when the device is unbound from the driver.
5584 * Requires the RTNL to be held.
5586 void cfg80211_unregister_wdev(struct wireless_dev *wdev);
5589 * struct cfg80211_ft_event - FT Information Elements
5591 * @ies_len: length of the FT IE in bytes
5592 * @target_ap: target AP's MAC address
5594 * @ric_ies_len: length of the RIC IE in bytes
5596 struct cfg80211_ft_event_params {
5599 const u8 *target_ap;
5605 * cfg80211_ft_event - notify userspace about FT IE and RIC IE
5606 * @netdev: network device
5607 * @ft_event: IE information
5609 void cfg80211_ft_event(struct net_device *netdev,
5610 struct cfg80211_ft_event_params *ft_event);
5613 * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
5614 * @ies: the input IE buffer
5615 * @len: the input length
5616 * @attr: the attribute ID to find
5617 * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
5618 * if the function is only called to get the needed buffer size
5619 * @bufsize: size of the output buffer
5621 * The function finds a given P2P attribute in the (vendor) IEs and
5622 * copies its contents to the given buffer.
5624 * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
5625 * malformed or the attribute can't be found (respectively), or the
5626 * length of the found attribute (which can be zero).
5628 int cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
5629 enum ieee80211_p2p_attr_id attr,
5630 u8 *buf, unsigned int bufsize);
5633 * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
5634 * @ies: the IE buffer
5635 * @ielen: the length of the IE buffer
5636 * @ids: an array with element IDs that are allowed before
5638 * @n_ids: the size of the element ID array
5639 * @after_ric: array IE types that come after the RIC element
5640 * @n_after_ric: size of the @after_ric array
5641 * @offset: offset where to start splitting in the buffer
5643 * This function splits an IE buffer by updating the @offset
5644 * variable to point to the location where the buffer should be
5647 * It assumes that the given IE buffer is well-formed, this
5648 * has to be guaranteed by the caller!
5650 * It also assumes that the IEs in the buffer are ordered
5651 * correctly, if not the result of using this function will not
5652 * be ordered correctly either, i.e. it does no reordering.
5654 * The function returns the offset where the next part of the
5655 * buffer starts, which may be @ielen if the entire (remainder)
5656 * of the buffer should be used.
5658 size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
5659 const u8 *ids, int n_ids,
5660 const u8 *after_ric, int n_after_ric,
5664 * ieee80211_ie_split - split an IE buffer according to ordering
5665 * @ies: the IE buffer
5666 * @ielen: the length of the IE buffer
5667 * @ids: an array with element IDs that are allowed before
5669 * @n_ids: the size of the element ID array
5670 * @offset: offset where to start splitting in the buffer
5672 * This function splits an IE buffer by updating the @offset
5673 * variable to point to the location where the buffer should be
5676 * It assumes that the given IE buffer is well-formed, this
5677 * has to be guaranteed by the caller!
5679 * It also assumes that the IEs in the buffer are ordered
5680 * correctly, if not the result of using this function will not
5681 * be ordered correctly either, i.e. it does no reordering.
5683 * The function returns the offset where the next part of the
5684 * buffer starts, which may be @ielen if the entire (remainder)
5685 * of the buffer should be used.
5687 size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
5688 const u8 *ids, int n_ids, size_t offset);
5691 * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
5692 * @wdev: the wireless device reporting the wakeup
5693 * @wakeup: the wakeup report
5694 * @gfp: allocation flags
5696 * This function reports that the given device woke up. If it
5697 * caused the wakeup, report the reason(s), otherwise you may
5698 * pass %NULL as the @wakeup parameter to advertise that something
5699 * else caused the wakeup.
5701 void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
5702 struct cfg80211_wowlan_wakeup *wakeup,
5706 * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
5708 * @wdev: the wireless device for which critical protocol is stopped.
5709 * @gfp: allocation flags
5711 * This function can be called by the driver to indicate it has reverted
5712 * operation back to normal. One reason could be that the duration given
5713 * by .crit_proto_start() has expired.
5715 void cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
5718 * cfg80211_is_gratuitous_arp_unsolicited_na - packet is grat. ARP/unsol. NA
5719 * @skb: the input packet, must be an ethernet frame already
5721 * Return: %true if the packet is a gratuitous ARP or unsolicited NA packet.
5722 * This is used to drop packets that shouldn't occur because the AP implements
5725 bool cfg80211_is_gratuitous_arp_unsolicited_na(struct sk_buff *skb);
5728 * ieee80211_get_num_supported_channels - get number of channels device has
5731 * Return: the number of channels supported by the device.
5733 unsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
5736 * cfg80211_check_combinations - check interface combinations
5739 * @params: the interface combinations parameter
5741 * This function can be called by the driver to check whether a
5742 * combination of interfaces and their types are allowed according to
5743 * the interface combinations.
5745 int cfg80211_check_combinations(struct wiphy *wiphy,
5746 struct iface_combination_params *params);
5749 * cfg80211_iter_combinations - iterate over matching combinations
5752 * @params: the interface combinations parameter
5753 * @iter: function to call for each matching combination
5754 * @data: pointer to pass to iter function
5756 * This function can be called by the driver to check what possible
5757 * combinations it fits in at a given moment, e.g. for channel switching
5760 int cfg80211_iter_combinations(struct wiphy *wiphy,
5761 struct iface_combination_params *params,
5762 void (*iter)(const struct ieee80211_iface_combination *c,
5767 * cfg80211_stop_iface - trigger interface disconnection
5770 * @wdev: wireless device
5771 * @gfp: context flags
5773 * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
5776 * Note: This doesn't need any locks and is asynchronous.
5778 void cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
5782 * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
5783 * @wiphy: the wiphy to shut down
5785 * This function shuts down all interfaces belonging to this wiphy by
5786 * calling dev_close() (and treating non-netdev interfaces as needed).
5787 * It shouldn't really be used unless there are some fatal device errors
5788 * that really can't be recovered in any other way.
5790 * Callers must hold the RTNL and be able to deal with callbacks into
5791 * the driver while the function is running.
5793 void cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
5796 * wiphy_ext_feature_set - set the extended feature flag
5798 * @wiphy: the wiphy to modify.
5799 * @ftidx: extended feature bit index.
5801 * The extended features are flagged in multiple bytes (see
5802 * &struct wiphy.@ext_features)
5804 static inline void wiphy_ext_feature_set(struct wiphy *wiphy,
5805 enum nl80211_ext_feature_index ftidx)
5809 ft_byte = &wiphy->ext_features[ftidx / 8];
5810 *ft_byte |= BIT(ftidx % 8);
5814 * wiphy_ext_feature_isset - check the extended feature flag
5816 * @wiphy: the wiphy to modify.
5817 * @ftidx: extended feature bit index.
5819 * The extended features are flagged in multiple bytes (see
5820 * &struct wiphy.@ext_features)
5823 wiphy_ext_feature_isset(struct wiphy *wiphy,
5824 enum nl80211_ext_feature_index ftidx)
5828 ft_byte = wiphy->ext_features[ftidx / 8];
5829 return (ft_byte & BIT(ftidx % 8)) != 0;
5832 /* ethtool helper */
5833 void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
5836 * cfg80211_ap_stopped - notify userspace that AP mode stopped
5837 * @netdev: network device
5838 * @gfp: context flags
5840 void cfg80211_ap_stopped(struct net_device *netdev, gfp_t gfp);
5843 * cfg80211_external_auth_request - userspace request for authentication
5844 * @netdev: network device
5845 * @params: External authentication parameters
5846 * @gfp: allocation flags
5847 * Returns: 0 on success, < 0 on error
5849 int cfg80211_external_auth_request(struct net_device *netdev,
5850 struct cfg80211_external_auth_params *params,
5853 /* Logging, debugging and troubleshooting/diagnostic helpers. */
5855 /* wiphy_printk helpers, similar to dev_printk */
5857 #define wiphy_printk(level, wiphy, format, args...) \
5858 dev_printk(level, &(wiphy)->dev, format, ##args)
5859 #define wiphy_emerg(wiphy, format, args...) \
5860 dev_emerg(&(wiphy)->dev, format, ##args)
5861 #define wiphy_alert(wiphy, format, args...) \
5862 dev_alert(&(wiphy)->dev, format, ##args)
5863 #define wiphy_crit(wiphy, format, args...) \
5864 dev_crit(&(wiphy)->dev, format, ##args)
5865 #define wiphy_err(wiphy, format, args...) \
5866 dev_err(&(wiphy)->dev, format, ##args)
5867 #define wiphy_warn(wiphy, format, args...) \
5868 dev_warn(&(wiphy)->dev, format, ##args)
5869 #define wiphy_notice(wiphy, format, args...) \
5870 dev_notice(&(wiphy)->dev, format, ##args)
5871 #define wiphy_info(wiphy, format, args...) \
5872 dev_info(&(wiphy)->dev, format, ##args)
5874 #define wiphy_debug(wiphy, format, args...) \
5875 wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
5877 #define wiphy_dbg(wiphy, format, args...) \
5878 dev_dbg(&(wiphy)->dev, format, ##args)
5880 #if defined(VERBOSE_DEBUG)
5881 #define wiphy_vdbg wiphy_dbg
5883 #define wiphy_vdbg(wiphy, format, args...) \
5886 wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \
5892 * wiphy_WARN() acts like wiphy_printk(), but with the key difference
5893 * of using a WARN/WARN_ON to get the message out, including the
5894 * file/line information and a backtrace.
5896 #define wiphy_WARN(wiphy, format, args...) \
5897 WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
5899 #endif /* __NET_CFG80211_H */