blob: 7c9d5db4f0e65fc6c5d5768e0b6a7f419b98c8d5 [file] [log] [blame]
/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __NET_CFG80211_H
#define __NET_CFG80211_H
/*
* 802.11 device and configuration interface
*
* Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2013-2014 Intel Mobile Communications GmbH
* Copyright 2015-2017 Intel Deutschland GmbH
* Copyright (C) 2018-2021 Intel Corporation
*/
#include <linux/ethtool.h>
#include <uapi/linux/rfkill.h>
#include <linux/netdevice.h>
#include <linux/debugfs.h>
#include <linux/list.h>
#include <linux/bug.h>
#include <linux/netlink.h>
#include <linux/skbuff.h>
#include <linux/nl80211.h>
#include <linux/if_ether.h>
#include <linux/ieee80211.h>
#include <linux/net.h>
#include <linux/rfkill.h>
#include <net/regulatory.h>
/**
* DOC: Introduction
*
* cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
* userspace and drivers, and offers some utility functionality associated
* with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
* by all modern wireless drivers in Linux, so that they offer a consistent
* API through nl80211. For backward compatibility, cfg80211 also offers
* wireless extensions to userspace, but hides them from drivers completely.
*
* Additionally, cfg80211 contains code to help enforce regulatory spectrum
* use restrictions.
*/
/**
* DOC: Device registration
*
* In order for a driver to use cfg80211, it must register the hardware device
* with cfg80211. This happens through a number of hardware capability structs
* described below.
*
* The fundamental structure for each device is the 'wiphy', of which each
* instance describes a physical wireless device connected to the system. Each
* such wiphy can have zero, one, or many virtual interfaces associated with
* it, which need to be identified as such by pointing the network interface's
* @ieee80211_ptr pointer to a &struct wireless_dev which further describes
* the wireless part of the interface, normally this struct is embedded in the
* network interface's private data area. Drivers can optionally allow creating
* or destroying virtual interfaces on the fly, but without at least one or the
* ability to create some the wireless device isn't useful.
*
* Each wiphy structure contains device capability information, and also has
* a pointer to the various operations the driver offers. The definitions and
* structures here describe these capabilities in detail.
*/
struct wiphy;
/*
* wireless hardware capability structures
*/
/**
* enum ieee80211_channel_flags - channel flags
*
* Channel flags set by the regulatory control code.
*
* @IEEE80211_CHAN_DISABLED: This channel is disabled.
* @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
* sending probe requests or beaconing.
* @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
* @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
* is not permitted.
* @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
* is not permitted.
* @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
* @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
* this flag indicates that an 80 MHz channel cannot use this
* channel as the control or any of the secondary channels.
* This may be due to the driver or due to regulatory bandwidth
* restrictions.
* @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
* this flag indicates that an 160 MHz channel cannot use this
* channel as the control or any of the secondary channels.
* This may be due to the driver or due to regulatory bandwidth
* restrictions.
* @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
* @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
* @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
* on this channel.
* @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
* on this channel.
* @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
* @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
* on this channel.
* @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
* on this channel.
* @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
* on this channel.
* @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
* on this channel.
* @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
* on this channel.
*
*/
enum ieee80211_channel_flags {
IEEE80211_CHAN_DISABLED = 1<<0,
IEEE80211_CHAN_NO_IR = 1<<1,
/* hole at 1<<2 */
IEEE80211_CHAN_RADAR = 1<<3,
IEEE80211_CHAN_NO_HT40PLUS = 1<<4,
IEEE80211_CHAN_NO_HT40MINUS = 1<<5,
IEEE80211_CHAN_NO_OFDM = 1<<6,
IEEE80211_CHAN_NO_80MHZ = 1<<7,
IEEE80211_CHAN_NO_160MHZ = 1<<8,
IEEE80211_CHAN_INDOOR_ONLY = 1<<9,
IEEE80211_CHAN_IR_CONCURRENT = 1<<10,
IEEE80211_CHAN_NO_20MHZ = 1<<11,
IEEE80211_CHAN_NO_10MHZ = 1<<12,
IEEE80211_CHAN_NO_HE = 1<<13,
IEEE80211_CHAN_1MHZ = 1<<14,
IEEE80211_CHAN_2MHZ = 1<<15,
IEEE80211_CHAN_4MHZ = 1<<16,
IEEE80211_CHAN_8MHZ = 1<<17,
IEEE80211_CHAN_16MHZ = 1<<18,
};
#define IEEE80211_CHAN_NO_HT40 \
(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
#define IEEE80211_DFS_MIN_CAC_TIME_MS 60000
#define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000)
/**
* struct ieee80211_channel - channel definition
*
* This structure describes a single channel for use
* with cfg80211.
*
* @center_freq: center frequency in MHz
* @freq_offset: offset from @center_freq, in KHz
* @hw_value: hardware-specific value for the channel
* @flags: channel flags from &enum ieee80211_channel_flags.
* @orig_flags: channel flags at registration time, used by regulatory
* code to support devices with additional restrictions
* @band: band this channel belongs to.
* @max_antenna_gain: maximum antenna gain in dBi
* @max_power: maximum transmission power (in dBm)
* @max_reg_power: maximum regulatory transmission power (in dBm)
* @beacon_found: helper to regulatory code to indicate when a beacon
* has been found on this channel. Use regulatory_hint_found_beacon()
* to enable this, this is useful only on 5 GHz band.
* @orig_mag: internal use
* @orig_mpwr: internal use
* @dfs_state: current state of this channel. Only relevant if radar is required
* on this channel.
* @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
* @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
*/
struct ieee80211_channel {
enum nl80211_band band;
u32 center_freq;
u16 freq_offset;
u16 hw_value;
u32 flags;
int max_antenna_gain;
int max_power;
int max_reg_power;
bool beacon_found;
u32 orig_flags;
int orig_mag, orig_mpwr;
enum nl80211_dfs_state dfs_state;
unsigned long dfs_state_entered;
unsigned int dfs_cac_ms;
};
/**
* enum ieee80211_rate_flags - rate flags
*
* Hardware/specification flags for rates. These are structured
* in a way that allows using the same bitrate structure for
* different bands/PHY modes.
*
* @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
* preamble on this bitrate; only relevant in 2.4GHz band and
* with CCK rates.
* @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
* when used with 802.11a (on the 5 GHz band); filled by the
* core code when registering the wiphy.
* @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
* when used with 802.11b (on the 2.4 GHz band); filled by the
* core code when registering the wiphy.
* @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
* when used with 802.11g (on the 2.4 GHz band); filled by the
* core code when registering the wiphy.
* @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
* @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
* @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
*/
enum ieee80211_rate_flags {
IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
IEEE80211_RATE_MANDATORY_A = 1<<1,
IEEE80211_RATE_MANDATORY_B = 1<<2,
IEEE80211_RATE_MANDATORY_G = 1<<3,
IEEE80211_RATE_ERP_G = 1<<4,
IEEE80211_RATE_SUPPORTS_5MHZ = 1<<5,
IEEE80211_RATE_SUPPORTS_10MHZ = 1<<6,
};
/**
* enum ieee80211_bss_type - BSS type filter
*
* @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
* @IEEE80211_BSS_TYPE_PBSS: Personal BSS
* @IEEE80211_BSS_TYPE_IBSS: Independent BSS
* @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
* @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
*/
enum ieee80211_bss_type {
IEEE80211_BSS_TYPE_ESS,
IEEE80211_BSS_TYPE_PBSS,
IEEE80211_BSS_TYPE_IBSS,
IEEE80211_BSS_TYPE_MBSS,
IEEE80211_BSS_TYPE_ANY
};
/**
* enum ieee80211_privacy - BSS privacy filter
*
* @IEEE80211_PRIVACY_ON: privacy bit set
* @IEEE80211_PRIVACY_OFF: privacy bit clear
* @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
*/
enum ieee80211_privacy {
IEEE80211_PRIVACY_ON,
IEEE80211_PRIVACY_OFF,
IEEE80211_PRIVACY_ANY
};
#define IEEE80211_PRIVACY(x) \
((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
/**
* struct ieee80211_rate - bitrate definition
*
* This structure describes a bitrate that an 802.11 PHY can
* operate with. The two values @hw_value and @hw_value_short
* are only for driver use when pointers to this structure are
* passed around.
*
* @flags: rate-specific flags
* @bitrate: bitrate in units of 100 Kbps
* @hw_value: driver/hardware value for this rate
* @hw_value_short: driver/hardware value for this rate when
* short preamble is used
*/
struct ieee80211_rate {
u32 flags;
u16 bitrate;
u16 hw_value, hw_value_short;
};
/**
* struct ieee80211_he_obss_pd - AP settings for spatial reuse
*
* @enable: is the feature enabled.
* @sr_ctrl: The SR Control field of SRP element.
* @non_srg_max_offset: non-SRG maximum tx power offset
* @min_offset: minimal tx power offset an associated station shall use
* @max_offset: maximum tx power offset an associated station shall use
* @bss_color_bitmap: bitmap that indicates the BSS color values used by
* members of the SRG
* @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
* used by members of the SRG
*/
struct ieee80211_he_obss_pd {
bool enable;
u8 sr_ctrl;
u8 non_srg_max_offset;
u8 min_offset;
u8 max_offset;
u8 bss_color_bitmap[8];
u8 partial_bssid_bitmap[8];
};
/**
* struct cfg80211_he_bss_color - AP settings for BSS coloring
*
* @color: the current color.
* @enabled: HE BSS color is used
* @partial: define the AID equation.
*/
struct cfg80211_he_bss_color {
u8 color;
bool enabled;
bool partial;
};
/**
* struct ieee80211_sta_ht_cap - STA's HT capabilities
*
* This structure describes most essential parameters needed
* to describe 802.11n HT capabilities for an STA.
*
* @ht_supported: is HT supported by the STA
* @cap: HT capabilities map as described in 802.11n spec
* @ampdu_factor: Maximum A-MPDU length factor
* @ampdu_density: Minimum A-MPDU spacing
* @mcs: Supported MCS rates
*/
struct ieee80211_sta_ht_cap {
u16 cap; /* use IEEE80211_HT_CAP_ */
bool ht_supported;
u8 ampdu_factor;
u8 ampdu_density;
struct ieee80211_mcs_info mcs;
};
/**
* struct ieee80211_sta_vht_cap - STA's VHT capabilities
*
* This structure describes most essential parameters needed
* to describe 802.11ac VHT capabilities for an STA.
*
* @vht_supported: is VHT supported by the STA
* @cap: VHT capabilities map as described in 802.11ac spec
* @vht_mcs: Supported VHT MCS rates
*/
struct ieee80211_sta_vht_cap {
bool vht_supported;
u32 cap; /* use IEEE80211_VHT_CAP_ */
struct ieee80211_vht_mcs_info vht_mcs;
};
#define IEEE80211_HE_PPE_THRES_MAX_LEN 25
/**
* struct ieee80211_sta_he_cap - STA's HE capabilities
*
* This structure describes most essential parameters needed
* to describe 802.11ax HE capabilities for a STA.
*
* @has_he: true iff HE data is valid.
* @he_cap_elem: Fixed portion of the HE capabilities element.
* @he_mcs_nss_supp: The supported NSS/MCS combinations.
* @ppe_thres: Holds the PPE Thresholds data.
*/
struct ieee80211_sta_he_cap {
bool has_he;
struct ieee80211_he_cap_elem he_cap_elem;
struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
};
/**
* struct ieee80211_sband_iftype_data - sband data per interface type
*
* This structure encapsulates sband data that is relevant for the
* interface types defined in @types_mask. Each type in the
* @types_mask must be unique across all instances of iftype_data.
*
* @types_mask: interface types mask
* @he_cap: holds the HE capabilities
* @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
* 6 GHz band channel (and 0 may be valid value).
* @vendor_elems: vendor element(s) to advertise
* @vendor_elems.data: vendor element(s) data
* @vendor_elems.len: vendor element(s) length
*/
struct ieee80211_sband_iftype_data {
u16 types_mask;
struct ieee80211_sta_he_cap he_cap;
struct ieee80211_he_6ghz_capa he_6ghz_capa;
struct {
const u8 *data;
unsigned int len;
} vendor_elems;
};
/**
* enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
*
* @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
* @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
* @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
* @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
* @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
* @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
* @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
* @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
* 2.16GHz+2.16GHz
* @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
* 4.32GHz + 4.32GHz
* @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
* 4.32GHz + 4.32GHz
* @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
* and 4.32GHz + 4.32GHz
* @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
* 2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
*/
enum ieee80211_edmg_bw_config {
IEEE80211_EDMG_BW_CONFIG_4 = 4,
IEEE80211_EDMG_BW_CONFIG_5 = 5,
IEEE80211_EDMG_BW_CONFIG_6 = 6,
IEEE80211_EDMG_BW_CONFIG_7 = 7,
IEEE80211_EDMG_BW_CONFIG_8 = 8,
IEEE80211_EDMG_BW_CONFIG_9 = 9,
IEEE80211_EDMG_BW_CONFIG_10 = 10,
IEEE80211_EDMG_BW_CONFIG_11 = 11,
IEEE80211_EDMG_BW_CONFIG_12 = 12,
IEEE80211_EDMG_BW_CONFIG_13 = 13,
IEEE80211_EDMG_BW_CONFIG_14 = 14,
IEEE80211_EDMG_BW_CONFIG_15 = 15,
};
/**
* struct ieee80211_edmg - EDMG configuration
*
* This structure describes most essential parameters needed
* to describe 802.11ay EDMG configuration
*
* @channels: bitmap that indicates the 2.16 GHz channel(s)
* that are allowed to be used for transmissions.
* Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
* Set to 0 indicate EDMG not supported.
* @bw_config: Channel BW Configuration subfield encodes
* the allowed channel bandwidth configurations
*/
struct ieee80211_edmg {
u8 channels;
enum ieee80211_edmg_bw_config bw_config;
};
/**
* struct ieee80211_sta_s1g_cap - STA's S1G capabilities
*
* This structure describes most essential parameters needed
* to describe 802.11ah S1G capabilities for a STA.
*
* @s1g_supported: is STA an S1G STA
* @cap: S1G capabilities information
* @nss_mcs: Supported NSS MCS set
*/
struct ieee80211_sta_s1g_cap {
bool s1g;
u8 cap[10]; /* use S1G_CAPAB_ */
u8 nss_mcs[5];
};
/**
* struct ieee80211_supported_band - frequency band definition
*
* This structure describes a frequency band a wiphy
* is able to operate in.
*
* @channels: Array of channels the hardware can operate with
* in this band.
* @band: the band this structure represents
* @n_channels: Number of channels in @channels
* @bitrates: Array of bitrates the hardware can operate with
* in this band. Must be sorted to give a valid "supported
* rates" IE, i.e. CCK rates first, then OFDM.
* @n_bitrates: Number of bitrates in @bitrates
* @ht_cap: HT capabilities in this band
* @vht_cap: VHT capabilities in this band
* @s1g_cap: S1G capabilities in this band
* @edmg_cap: EDMG capabilities in this band
* @s1g_cap: S1G capabilities in this band (S1B band only, of course)
* @n_iftype_data: number of iftype data entries
* @iftype_data: interface type data entries. Note that the bits in
* @types_mask inside this structure cannot overlap (i.e. only
* one occurrence of each type is allowed across all instances of
* iftype_data).
*/
struct ieee80211_supported_band {
struct ieee80211_channel *channels;
struct ieee80211_rate *bitrates;
enum nl80211_band band;
int n_channels;
int n_bitrates;
struct ieee80211_sta_ht_cap ht_cap;
struct ieee80211_sta_vht_cap vht_cap;
struct ieee80211_sta_s1g_cap s1g_cap;
struct ieee80211_edmg edmg_cap;
u16 n_iftype_data;
const struct ieee80211_sband_iftype_data *iftype_data;
};
/**
* ieee80211_get_sband_iftype_data - return sband data for a given iftype
* @sband: the sband to search for the STA on
* @iftype: enum nl80211_iftype
*
* Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
*/
static inline const struct ieee80211_sband_iftype_data *
ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
u8 iftype)
{
int i;
if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
return NULL;
for (i = 0; i < sband->n_iftype_data; i++) {
const struct ieee80211_sband_iftype_data *data =
&sband->iftype_data[i];
if (data->types_mask & BIT(iftype))
return data;
}
return NULL;
}
/**
* ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
* @sband: the sband to search for the iftype on
* @iftype: enum nl80211_iftype
*
* Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
*/
static inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
u8 iftype)
{
const struct ieee80211_sband_iftype_data *data =
ieee80211_get_sband_iftype_data(sband, iftype);
if (data && data->he_cap.has_he)
return &data->he_cap;
return NULL;
}
/**
* ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
* @sband: the sband to search for the STA on
* @iftype: the iftype to search for
*
* Return: the 6GHz capabilities
*/
static inline __le16
ieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
enum nl80211_iftype iftype)
{
const struct ieee80211_sband_iftype_data *data =
ieee80211_get_sband_iftype_data(sband, iftype);
if (WARN_ON(!data || !data->he_cap.has_he))
return 0;
return data->he_6ghz_capa.capa;
}
/**
* wiphy_read_of_freq_limits - read frequency limits from device tree
*
* @wiphy: the wireless device to get extra limits for
*
* Some devices may have extra limitations specified in DT. This may be useful
* for chipsets that normally support more bands but are limited due to board
* design (e.g. by antennas or external power amplifier).
*
* This function reads info from DT and uses it to *modify* channels (disable
* unavailable ones). It's usually a *bad* idea to use it in drivers with
* shared channel data as DT limitations are device specific. You should make
* sure to call it only if channels in wiphy are copied and can be modified
* without affecting other devices.
*
* As this function access device node it has to be called after set_wiphy_dev.
* It also modifies channels so they have to be set first.
* If using this helper, call it before wiphy_register().
*/
#ifdef CONFIG_OF
void wiphy_read_of_freq_limits(struct wiphy *wiphy);
#else /* CONFIG_OF */
static inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
{
}
#endif /* !CONFIG_OF */
/*
* Wireless hardware/device configuration structures and methods
*/
/**
* DOC: Actions and configuration
*
* Each wireless device and each virtual interface offer a set of configuration
* operations and other actions that are invoked by userspace. Each of these
* actions is described in the operations structure, and the parameters these
* operations use are described separately.
*
* Additionally, some operations are asynchronous and expect to get status
* information via some functions that drivers need to call.
*
* Scanning and BSS list handling with its associated functionality is described
* in a separate chapter.
*/
#define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
WLAN_USER_POSITION_LEN)
/**
* struct vif_params - describes virtual interface parameters
* @flags: monitor interface flags, unchanged if 0, otherwise
* %MONITOR_FLAG_CHANGED will be set
* @use_4addr: use 4-address frames
* @macaddr: address to use for this virtual interface.
* If this parameter is set to zero address the driver may
* determine the address as needed.
* This feature is only fully supported by drivers that enable the
* %NL80211_FEATURE_MAC_ON_CREATE flag. Others may support creating
** only p2p devices with specified MAC.
* @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
* belonging to that MU-MIMO groupID; %NULL if not changed
* @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
* MU-MIMO packets going to the specified station; %NULL if not changed
*/
struct vif_params {
u32 flags;
int use_4addr;
u8 macaddr[ETH_ALEN];
const u8 *vht_mumimo_groups;
const u8 *vht_mumimo_follow_addr;
};
/**
* struct key_params - key information
*
* Information about a key
*
* @key: key material
* @key_len: length of key material
* @cipher: cipher suite selector
* @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
* with the get_key() callback, must be in little endian,
* length given by @seq_len.
* @seq_len: length of @seq.
* @vlan_id: vlan_id for VLAN group key (if nonzero)
* @mode: key install mode (RX_TX, NO_TX or SET_TX)
*/
struct key_params {
const u8 *key;
const u8 *seq;
int key_len;
int seq_len;
u16 vlan_id;
u32 cipher;
enum nl80211_key_mode mode;
};
/**
* struct cfg80211_chan_def - channel definition
* @chan: the (control) channel
* @width: channel width
* @center_freq1: center frequency of first segment
* @center_freq2: center frequency of second segment
* (only with 80+80 MHz)
* @edmg: define the EDMG channels configuration.
* If edmg is requested (i.e. the .channels member is non-zero),
* chan will define the primary channel and all other
* parameters are ignored.
* @freq1_offset: offset from @center_freq1, in KHz
*/
struct cfg80211_chan_def {
struct ieee80211_channel *chan;
enum nl80211_chan_width width;
u32 center_freq1;
u32 center_freq2;
struct ieee80211_edmg edmg;
u16 freq1_offset;
};
/*
* cfg80211_bitrate_mask - masks for bitrate control
*/
struct cfg80211_bitrate_mask {
struct {
u32 legacy;
u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
u16 vht_mcs[NL80211_VHT_NSS_MAX];
u16 he_mcs[NL80211_HE_NSS_MAX];
enum nl80211_txrate_gi gi;
enum nl80211_he_gi he_gi;
enum nl80211_he_ltf he_ltf;
} control[NUM_NL80211_BANDS];
};
/**
* struct cfg80211_tid_cfg - TID specific configuration
* @config_override: Flag to notify driver to reset TID configuration
* of the peer.
* @tids: bitmap of TIDs to modify
* @mask: bitmap of attributes indicating which parameter changed,
* similar to &nl80211_tid_config_supp.
* @noack: noack configuration value for the TID
* @retry_long: retry count value
* @retry_short: retry count value
* @ampdu: Enable/Disable MPDU aggregation
* @rtscts: Enable/Disable RTS/CTS
* @amsdu: Enable/Disable MSDU aggregation
* @txrate_type: Tx bitrate mask type
* @txrate_mask: Tx bitrate to be applied for the TID
*/
struct cfg80211_tid_cfg {
bool config_override;
u8 tids;
u64 mask;
enum nl80211_tid_config noack;
u8 retry_long, retry_short;
enum nl80211_tid_config ampdu;
enum nl80211_tid_config rtscts;
enum nl80211_tid_config amsdu;
enum nl80211_tx_rate_setting txrate_type;
struct cfg80211_bitrate_mask txrate_mask;
};
/**
* struct cfg80211_tid_config - TID configuration
* @peer: Station's MAC address
* @n_tid_conf: Number of TID specific configurations to be applied
* @tid_conf: Configuration change info
*/
struct cfg80211_tid_config {
const u8 *peer;
u32 n_tid_conf;
struct cfg80211_tid_cfg tid_conf[];
};
/**
* struct cfg80211_fils_aad - FILS AAD data
* @macaddr: STA MAC address
* @kek: FILS KEK
* @kek_len: FILS KEK length
* @snonce: STA Nonce
* @anonce: AP Nonce
*/
struct cfg80211_fils_aad {
const u8 *macaddr;
const u8 *kek;
u8 kek_len;
const u8 *snonce;
const u8 *anonce;
};
/**
* cfg80211_get_chandef_type - return old channel type from chandef
* @chandef: the channel definition
*
* Return: The old channel type (NOHT, HT20, HT40+/-) from a given
* chandef, which must have a bandwidth allowing this conversion.
*/
static inline enum nl80211_channel_type
cfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
{
switch (chandef->width) {
case NL80211_CHAN_WIDTH_20_NOHT:
return NL80211_CHAN_NO_HT;
case NL80211_CHAN_WIDTH_20:
return NL80211_CHAN_HT20;
case NL80211_CHAN_WIDTH_40:
if (chandef->center_freq1 > chandef->chan->center_freq)
return NL80211_CHAN_HT40PLUS;
return NL80211_CHAN_HT40MINUS;
default:
WARN_ON(1);
return NL80211_CHAN_NO_HT;
}
}
/**
* cfg80211_chandef_create - create channel definition using channel type
* @chandef: the channel definition struct to fill
* @channel: the control channel
* @chantype: the channel type
*
* Given a channel type, create a channel definition.
*/
void cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
struct ieee80211_channel *channel,
enum nl80211_channel_type chantype);
/**
* cfg80211_chandef_identical - check if two channel definitions are identical
* @chandef1: first channel definition
* @chandef2: second channel definition
*
* Return: %true if the channels defined by the channel definitions are
* identical, %false otherwise.
*/
static inline bool
cfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
const struct cfg80211_chan_def *chandef2)
{
return (chandef1->chan == chandef2->chan &&
chandef1->width == chandef2->width &&
chandef1->center_freq1 == chandef2->center_freq1 &&
chandef1->freq1_offset == chandef2->freq1_offset &&
chandef1->center_freq2 == chandef2->center_freq2);
}
/**
* cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
*
* @chandef: the channel definition
*
* Return: %true if EDMG defined, %false otherwise.
*/
static inline bool
cfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
{
return chandef->edmg.channels || chandef->edmg.bw_config;
}
/**
* cfg80211_chandef_compatible - check if two channel definitions are compatible
* @chandef1: first channel definition
* @chandef2: second channel definition
*
* Return: %NULL if the given channel definitions are incompatible,
* chandef1 or chandef2 otherwise.
*/
const struct cfg80211_chan_def *
cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
const struct cfg80211_chan_def *chandef2);
/**
* cfg80211_chandef_valid - check if a channel definition is valid
* @chandef: the channel definition to check
* Return: %true if the channel definition is valid. %false otherwise.
*/
bool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
/**
* cfg80211_chandef_usable - check if secondary channels can be used
* @wiphy: the wiphy to validate against
* @chandef: the channel definition to check
* @prohibited_flags: the regulatory channel flags that must not be set
* Return: %true if secondary channels are usable. %false otherwise.
*/
bool cfg80211_chandef_usable(struct wiphy *wiphy,
const struct cfg80211_chan_def *chandef,
u32 prohibited_flags);
/**
* cfg80211_chandef_dfs_required - checks if radar detection is required
* @wiphy: the wiphy to validate against
* @chandef: the channel definition to check
* @iftype: the interface type as specified in &enum nl80211_iftype
* Returns:
* 1 if radar detection is required, 0 if it is not, < 0 on error
*/
int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
const struct cfg80211_chan_def *chandef,
enum nl80211_iftype iftype);
/**
* ieee80211_chandef_rate_flags - returns rate flags for a channel
*
* In some channel types, not all rates may be used - for example CCK
* rates may not be used in 5/10 MHz channels.
*
* @chandef: channel definition for the channel
*
* Returns: rate flags which apply for this channel
*/
static inline enum ieee80211_rate_flags
ieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
{
switch (chandef->width) {
case NL80211_CHAN_WIDTH_5:
return IEEE80211_RATE_SUPPORTS_5MHZ;
case NL80211_CHAN_WIDTH_10:
return IEEE80211_RATE_SUPPORTS_10MHZ;
default:
break;
}
return 0;
}
/**
* ieee80211_chandef_max_power - maximum transmission power for the chandef
*
* In some regulations, the transmit power may depend on the configured channel
* bandwidth which may be defined as dBm/MHz. This function returns the actual
* max_power for non-standard (20 MHz) channels.
*
* @chandef: channel definition for the channel
*
* Returns: maximum allowed transmission power in dBm for the chandef
*/
static inline int
ieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
{
switch (chandef->width) {
case NL80211_CHAN_WIDTH_5:
return min(chandef->chan->max_reg_power - 6,
chandef->chan->max_power);
case NL80211_CHAN_WIDTH_10:
return min(chandef->chan->max_reg_power - 3,
chandef->chan->max_power);
default:
break;
}
return chandef->chan->max_power;
}
/**
* cfg80211_any_usable_channels - check for usable channels
* @wiphy: the wiphy to check for
* @band_mask: which bands to check on
* @prohibited_flags: which channels to not consider usable,
* %IEEE80211_CHAN_DISABLED is always taken into account
*/
bool cfg80211_any_usable_channels(struct wiphy *wiphy,
unsigned long band_mask,
u32 prohibited_flags);
/**
* enum survey_info_flags - survey information flags
*
* @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
* @SURVEY_INFO_IN_USE: channel is currently being used
* @SURVEY_INFO_TIME: active time (in ms) was filled in
* @SURVEY_INFO_TIME_BUSY: busy time was filled in
* @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
* @SURVEY_INFO_TIME_RX: receive time was filled in
* @SURVEY_INFO_TIME_TX: transmit time was filled in
* @SURVEY_INFO_TIME_SCAN: scan time was filled in
* @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
*
* Used by the driver to indicate which info in &struct survey_info
* it has filled in during the get_survey().
*/
enum survey_info_flags {
SURVEY_INFO_NOISE_DBM = BIT(0),
SURVEY_INFO_IN_USE = BIT(1),
SURVEY_INFO_TIME = BIT(2),
SURVEY_INFO_TIME_BUSY = BIT(3),
SURVEY_INFO_TIME_EXT_BUSY = BIT(4),
SURVEY_INFO_TIME_RX = BIT(5),
SURVEY_INFO_TIME_TX = BIT(6),
SURVEY_INFO_TIME_SCAN = BIT(7),
SURVEY_INFO_TIME_BSS_RX = BIT(8),
};
/**
* struct survey_info - channel survey response
*
* @channel: the channel this survey record reports, may be %NULL for a single
* record to report global statistics
* @filled: bitflag of flags from &enum survey_info_flags
* @noise: channel noise in dBm. This and all following fields are
* optional
* @time: amount of time in ms the radio was turn on (on the channel)
* @time_busy: amount of time the primary channel was sensed busy
* @time_ext_busy: amount of time the extension channel was sensed busy
* @time_rx: amount of time the radio spent receiving data
* @time_tx: amount of time the radio spent transmitting data
* @time_scan: amount of time the radio spent for scanning
* @time_bss_rx: amount of time the radio spent receiving data on a local BSS
*
* Used by dump_survey() to report back per-channel survey information.
*
* This structure can later be expanded with things like
* channel duty cycle etc.
*/
struct survey_info {
struct ieee80211_channel *channel;
u64 time;
u64 time_busy;
u64 time_ext_busy;
u64 time_rx;
u64 time_tx;
u64 time_scan;
u64 time_bss_rx;
u32 filled;
s8 noise;
};
#define CFG80211_MAX_WEP_KEYS 4
/**
* struct cfg80211_crypto_settings - Crypto settings
* @wpa_versions: indicates which, if any, WPA versions are enabled
* (from enum nl80211_wpa_versions)
* @cipher_group: group key cipher suite (or 0 if unset)
* @n_ciphers_pairwise: number of AP supported unicast ciphers
* @ciphers_pairwise: unicast key cipher suites
* @n_akm_suites: number of AKM suites
* @akm_suites: AKM suites
* @control_port: Whether user space controls IEEE 802.1X port, i.e.,
* sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
* required to assume that the port is unauthorized until authorized by
* user space. Otherwise, port is marked authorized by default.
* @control_port_ethertype: the control port protocol that should be
* allowed through even on unauthorized ports
* @control_port_no_encrypt: TRUE to prevent encryption of control port
* protocol frames.
* @control_port_over_nl80211: TRUE if userspace expects to exchange control
* port frames over NL80211 instead of the network interface.
* @control_port_no_preauth: disables pre-auth rx over the nl80211 control
* port for mac80211
* @wep_keys: static WEP keys, if not NULL points to an array of
* CFG80211_MAX_WEP_KEYS WEP keys
* @wep_tx_key: key index (0..3) of the default TX static WEP key
* @psk: PSK (for devices supporting 4-way-handshake offload)
* @sae_pwd: password for SAE authentication (for devices supporting SAE
* offload)
* @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
* @sae_pwe: The mechanisms allowed for SAE PWE derivation:
*
* NL80211_SAE_PWE_UNSPECIFIED
* Not-specified, used to indicate userspace did not specify any
* preference. The driver should follow its internal policy in
* such a scenario.
*
* NL80211_SAE_PWE_HUNT_AND_PECK
* Allow hunting-and-pecking loop only
*
* NL80211_SAE_PWE_HASH_TO_ELEMENT
* Allow hash-to-element only
*
* NL80211_SAE_PWE_BOTH
* Allow either hunting-and-pecking loop or hash-to-element
*/
struct cfg80211_crypto_settings {
u32 wpa_versions;
u32 cipher_group;
int n_ciphers_pairwise;
u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
int n_akm_suites;
u32 akm_suites[NL80211_MAX_NR_AKM_SUITES];
bool control_port;
__be16 control_port_ethertype;
bool control_port_no_encrypt;
bool control_port_over_nl80211;
bool control_port_no_preauth;
struct key_params *wep_keys;
int wep_tx_key;
const u8 *psk;
const u8 *sae_pwd;
u8 sae_pwd_len;
enum nl80211_sae_pwe_mechanism sae_pwe;
};
/**
* struct cfg80211_mbssid_config - AP settings for multi bssid
*
* @tx_wdev: pointer to the transmitted interface in the MBSSID set
* @index: index of this AP in the multi bssid group.
* @ema: set to true if the beacons should be sent out in EMA mode.
*/
struct cfg80211_mbssid_config {
struct wireless_dev *tx_wdev;
u8 index;
bool ema;
};
/**
* struct cfg80211_mbssid_elems - Multiple BSSID elements
*
* @cnt: Number of elements in array %elems.
*
* @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
* @elem.data: Data for multiple BSSID elements.
* @elem.len: Length of data.
*/
struct cfg80211_mbssid_elems {
u8 cnt;
struct {
const u8 *data;
size_t len;
} elem[];
};
/**
* struct cfg80211_beacon_data - beacon data
* @head: head portion of beacon (before TIM IE)
* or %NULL if not changed
* @tail: tail portion of beacon (after TIM IE)
* or %NULL if not changed
* @head_len: length of @head
* @tail_len: length of @tail
* @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
* @beacon_ies_len: length of beacon_ies in octets
* @proberesp_ies: extra information element(s) to add into Probe Response
* frames or %NULL
* @proberesp_ies_len: length of proberesp_ies in octets
* @assocresp_ies: extra information element(s) to add into (Re)Association
* Response frames or %NULL
* @assocresp_ies_len: length of assocresp_ies in octets
* @probe_resp_len: length of probe response template (@probe_resp)
* @probe_resp: probe response template (AP mode only)
* @mbssid_ies: multiple BSSID elements
* @ftm_responder: enable FTM responder functionality; -1 for no change
* (which also implies no change in LCI/civic location data)
* @lci: Measurement Report element content, starting with Measurement Token
* (measurement type 8)
* @civicloc: Measurement Report element content, starting with Measurement
* Token (measurement type 11)
* @lci_len: LCI data length
* @civicloc_len: Civic location data length
*/
struct cfg80211_beacon_data {
const u8 *head, *tail;
const u8 *beacon_ies;
const u8 *proberesp_ies;
const u8 *assocresp_ies;
const u8 *probe_resp;
const u8 *lci;
const u8 *civicloc;
struct cfg80211_mbssid_elems *mbssid_ies;
s8 ftm_responder;
size_t head_len, tail_len;
size_t beacon_ies_len;
size_t proberesp_ies_len;
size_t assocresp_ies_len;
size_t probe_resp_len;
size_t lci_len;
size_t civicloc_len;
};
struct mac_address {
u8 addr[ETH_ALEN];
};
/**
* struct cfg80211_acl_data - Access control list data
*
* @acl_policy: ACL policy to be applied on the station's
* entry specified by mac_addr
* @n_acl_entries: Number of MAC address entries passed
* @mac_addrs: List of MAC addresses of stations to be used for ACL
*/
struct cfg80211_acl_data {
enum nl80211_acl_policy acl_policy;
int n_acl_entries;
/* Keep it last */
struct mac_address mac_addrs[];
};
/**
* struct cfg80211_fils_discovery - FILS discovery parameters from
* IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
*
* @min_interval: Minimum packet interval in TUs (0 - 10000)
* @max_interval: Maximum packet interval in TUs (0 - 10000)
* @tmpl_len: Template length
* @tmpl: Template data for FILS discovery frame including the action
* frame headers.
*/
struct cfg80211_fils_discovery {
u32 min_interval;
u32 max_interval;
size_t tmpl_len;
const u8 *tmpl;
};
/**
* struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
* response parameters in 6GHz.
*
* @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
* in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
* scanning
* @tmpl_len: Template length
* @tmpl: Template data for probe response
*/
struct cfg80211_unsol_bcast_probe_resp {
u32 interval;
size_t tmpl_len;
const u8 *tmpl;
};
/**
* enum cfg80211_ap_settings_flags - AP settings flags
*
* Used by cfg80211_ap_settings
*
* @AP_SETTINGS_EXTERNAL_AUTH_SUPPORT: AP supports external authentication
*/
enum cfg80211_ap_settings_flags {
AP_SETTINGS_EXTERNAL_AUTH_SUPPORT = BIT(0),
};
/**
* struct cfg80211_ap_settings - AP configuration
*
* Used to configure an AP interface.
*
* @chandef: defines the channel to use
* @beacon: beacon data
* @beacon_interval: beacon interval
* @dtim_period: DTIM period
* @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
* user space)
* @ssid_len: length of @ssid
* @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
* @crypto: crypto settings
* @privacy: the BSS uses privacy
* @auth_type: Authentication type (algorithm)
* @smps_mode: SMPS mode
* @inactivity_timeout: time in seconds to determine station's inactivity.
* @p2p_ctwindow: P2P CT Window
* @p2p_opp_ps: P2P opportunistic PS
* @acl: ACL configuration used by the drivers which has support for
* MAC address based access control
* @pbss: If set, start as a PCP instead of AP. Relevant for DMG
* networks.
* @beacon_rate: bitrate to be used for beacons
* @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
* @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
* @he_cap: HE capabilities (or %NULL if HE isn't enabled)
* @ht_required: stations must support HT
* @vht_required: stations must support VHT
* @twt_responder: Enable Target Wait Time
* @he_required: stations must support HE
* @sae_h2e_required: stations must support direct H2E technique in SAE
* @flags: flags, as defined in enum cfg80211_ap_settings_flags
* @he_obss_pd: OBSS Packet Detection settings
* @he_bss_color: BSS Color settings
* @he_oper: HE operation IE (or %NULL if HE isn't enabled)
* @fils_discovery: FILS discovery transmission parameters
* @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
* @mbssid_config: AP settings for multiple bssid
*/
struct cfg80211_ap_settings {
struct cfg80211_chan_def chandef;
struct cfg80211_beacon_data beacon;
int beacon_interval, dtim_period;
const u8 *ssid;
size_t ssid_len;
enum nl80211_hidden_ssid hidden_ssid;
struct cfg80211_crypto_settings crypto;
bool privacy;
enum nl80211_auth_type auth_type;
enum nl80211_smps_mode smps_mode;
int inactivity_timeout;
u8 p2p_ctwindow;
bool p2p_opp_ps;
const struct cfg80211_acl_data *acl;
bool pbss;
struct cfg80211_bitrate_mask beacon_rate;
const struct ieee80211_ht_cap *ht_cap;
const struct ieee80211_vht_cap *vht_cap;
const struct ieee80211_he_cap_elem *he_cap;
const struct ieee80211_he_operation *he_oper;
bool ht_required, vht_required, he_required, sae_h2e_required;
bool twt_responder;
u32 flags;
struct ieee80211_he_obss_pd he_obss_pd;
struct cfg80211_he_bss_color he_bss_color;
struct cfg80211_fils_discovery fils_discovery;
struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
struct cfg80211_mbssid_config mbssid_config;
};
/**
* struct cfg80211_csa_settings - channel switch settings
*
* Used for channel switch
*
* @chandef: defines the channel to use after the switch
* @beacon_csa: beacon data while performing the switch
* @counter_offsets_beacon: offsets of the counters within the beacon (tail)
* @counter_offsets_presp: offsets of the counters within the probe response
* @n_counter_offsets_beacon: number of csa counters the beacon (tail)
* @n_counter_offsets_presp: number of csa counters in the probe response
* @beacon_after: beacon data to be used on the new channel
* @radar_required: whether radar detection is required on the new channel
* @block_tx: whether transmissions should be blocked while changing
* @count: number of beacons until switch
*/
struct cfg80211_csa_settings {
struct cfg80211_chan_def chandef;
struct cfg80211_beacon_data beacon_csa;
const u16 *counter_offsets_beacon;
const u16 *counter_offsets_presp;
unsigned int n_counter_offsets_beacon;
unsigned int n_counter_offsets_presp;
struct cfg80211_beacon_data beacon_after;
bool radar_required;
bool block_tx;
u8 count;
};
/**
* struct cfg80211_color_change_settings - color change settings
*
* Used for bss color change
*
* @beacon_color_change: beacon data while performing the color countdown
* @counter_offsets_beacon: offsets of the counters within the beacon (tail)
* @counter_offsets_presp: offsets of the counters within the probe response
* @beacon_next: beacon data to be used after the color change
* @count: number of beacons until the color change
* @color: the color used after the change
*/
struct cfg80211_color_change_settings {
struct cfg80211_beacon_data beacon_color_change;
u16 counter_offset_beacon;
u16 counter_offset_presp;
struct cfg80211_beacon_data beacon_next;
u8 count;
u8 color;
};
/**
* struct iface_combination_params - input parameters for interface combinations
*
* Used to pass interface combination parameters
*
* @num_different_channels: the number of different channels we want
* to use for verification
* @radar_detect: a bitmap where each bit corresponds to a channel
* width where radar detection is needed, as in the definition of
* &struct ieee80211_iface_combination.@radar_detect_widths
* @iftype_num: array with the number of interfaces of each interface
* type. The index is the interface type as specified in &enum
* nl80211_iftype.
* @new_beacon_int: set this to the beacon interval of a new interface
* that's not operating yet, if such is to be checked as part of
* the verification
*/
struct iface_combination_params {
int num_different_channels;
u8 radar_detect;
int iftype_num[NUM_NL80211_IFTYPES];
u32 new_beacon_int;
};
/**
* enum station_parameters_apply_mask - station parameter values to apply
* @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
* @STATION_PARAM_APPLY_CAPABILITY: apply new capability
* @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
*
* Not all station parameters have in-band "no change" signalling,
* for those that don't these flags will are used.
*/
enum station_parameters_apply_mask {
STATION_PARAM_APPLY_UAPSD = BIT(0),
STATION_PARAM_APPLY_CAPABILITY = BIT(1),
STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
STATION_PARAM_APPLY_STA_TXPOWER = BIT(3),
};
/**
* struct sta_txpwr - station txpower configuration
*
* Used to configure txpower for station.
*
* @power: tx power (in dBm) to be used for sending data traffic. If tx power
* is not provided, the default per-interface tx power setting will be
* overriding. Driver should be picking up the lowest tx power, either tx
* power per-interface or per-station.
* @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
* will be less than or equal to specified from userspace, whereas if TPC
* %type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
* NL80211_TX_POWER_FIXED is not a valid configuration option for
* per peer TPC.
*/
struct sta_txpwr {
s16 power;
enum nl80211_tx_power_setting type;
};
/**
* struct station_parameters - station parameters
*
* Used to change and create a new station.
*
* @vlan: vlan interface station should belong to
* @supported_rates: supported rates in IEEE 802.11 format
* (or NULL for no change)
* @supported_rates_len: number of supported rates
* @sta_flags_mask: station flags that changed
* (bitmask of BIT(%NL80211_STA_FLAG_...))
* @sta_flags_set: station flags values
* (bitmask of BIT(%NL80211_STA_FLAG_...))
* @listen_interval: listen interval or -1 for no change
* @aid: AID or zero for no change
* @vlan_id: VLAN ID for station (if nonzero)
* @peer_aid: mesh peer AID or zero for no change
* @plink_action: plink action to take
* @plink_state: set the peer link state for a station
* @ht_capa: HT capabilities of station
* @vht_capa: VHT capabilities of station
* @uapsd_queues: bitmap of queues configured for uapsd. same format
* as the AC bitmap in the QoS info field
* @max_sp: max Service Period. same format as the MAX_SP in the
* QoS info field (but already shifted down)
* @sta_modify_mask: bitmap indicating which parameters changed
* (for those that don't have a natural "no change" value),
* see &enum station_parameters_apply_mask
* @local_pm: local link-specific mesh power save mode (no change when set
* to unknown)
* @capability: station capability
* @ext_capab: extended capabilities of the station
* @ext_capab_len: number of extended capabilities
* @supported_channels: supported channels in IEEE 802.11 format
* @supported_channels_len: number of supported channels
* @supported_oper_classes: supported oper classes in IEEE 802.11 format
* @supported_oper_classes_len: number of supported operating classes
* @opmode_notif: operating mode field from Operating Mode Notification
* @opmode_notif_used: information if operating mode field is used
* @support_p2p_ps: information if station supports P2P PS mechanism
* @he_capa: HE capabilities of station
* @he_capa_len: the length of the HE capabilities
* @airtime_weight: airtime scheduler weight for this station
* @txpwr: transmit power for an associated station
* @he_6ghz_capa: HE 6 GHz Band capabilities of station
*/
struct station_parameters {
const u8 *supported_rates;
struct net_device *vlan;
u32 sta_flags_mask, sta_flags_set;
u32 sta_modify_mask;
int listen_interval;
u16 aid;
u16 vlan_id;
u16 peer_aid;
u8 supported_rates_len;
u8 plink_action;
u8 plink_state;
const struct ieee80211_ht_cap *ht_capa;
const struct ieee80211_vht_cap *vht_capa;
u8 uapsd_queues;
u8 max_sp;
enum nl80211_mesh_power_mode local_pm;
u16 capability;
const u8 *ext_capab;
u8 ext_capab_len;
const u8 *supported_channels;
u8 supported_channels_len;
const u8 *supported_oper_classes;
u8 supported_oper_classes_len;
u8 opmode_notif;
bool opmode_notif_used;
int support_p2p_ps;
const struct ieee80211_he_cap_elem *he_capa;
u8 he_capa_len;
u16 airtime_weight;
struct sta_txpwr txpwr;
const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
};
/**
* struct station_del_parameters - station deletion parameters
*
* Used to delete a station entry (or all stations).
*
* @mac: MAC address of the station to remove or NULL to remove all stations
* @subtype: Management frame subtype to use for indicating removal
* (10 = Disassociation, 12 = Deauthentication)
* @reason_code: Reason code for the Disassociation/Deauthentication frame
*/
struct station_del_parameters {
const u8 *mac;
u8 subtype;
u16 reason_code;
};
/**
* enum cfg80211_station_type - the type of station being modified
* @CFG80211_STA_AP_CLIENT: client of an AP interface
* @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
* unassociated (update properties for this type of client is permitted)
* @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
* the AP MLME in the device
* @CFG80211_STA_AP_STA: AP station on managed interface
* @CFG80211_STA_IBSS: IBSS station
* @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
* while TDLS setup is in progress, it moves out of this state when
* being marked authorized; use this only if TDLS with external setup is
* supported/used)
* @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
* entry that is operating, has been marked authorized by userspace)
* @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
* @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
*/
enum cfg80211_station_type {
CFG80211_STA_AP_CLIENT,
CFG80211_STA_AP_CLIENT_UNASSOC,
CFG80211_STA_AP_MLME_CLIENT,
CFG80211_STA_AP_STA,
CFG80211_STA_IBSS,
CFG80211_STA_TDLS_PEER_SETUP,
CFG80211_STA_TDLS_PEER_ACTIVE,
CFG80211_STA_MESH_PEER_KERNEL,
CFG80211_STA_MESH_PEER_USER,
};
/**
* cfg80211_check_station_change - validate parameter changes
* @wiphy: the wiphy this operates on
* @params: the new parameters for a station
* @statype: the type of station being modified
*
* Utility function for the @change_station driver method. Call this function
* with the appropriate station type looking up the station (and checking that
* it exists). It will verify whether the station change is acceptable, and if
* not will return an error code. Note that it may modify the parameters for
* backward compatibility reasons, so don't use them before calling this.
*/
int cfg80211_check_station_change(struct wiphy *wiphy,
struct station_parameters *params,
enum cfg80211_station_type statype);
/**
* enum rate_info_flags - bitrate info flags
*
* Used by the driver to indicate the specific rate transmission
* type for 802.11n transmissions.
*
* @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
* @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
* @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
* @RATE_INFO_FLAGS_DMG: 60GHz MCS
* @RATE_INFO_FLAGS_HE_MCS: HE MCS information
* @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
* @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
*/
enum rate_info_flags {
RATE_INFO_FLAGS_MCS = BIT(0),
RATE_INFO_FLAGS_VHT_MCS = BIT(1),
RATE_INFO_FLAGS_SHORT_GI = BIT(2),
RATE_INFO_FLAGS_DMG = BIT(3),
RATE_INFO_FLAGS_HE_MCS = BIT(4),
RATE_INFO_FLAGS_EDMG = BIT(5),
RATE_INFO_FLAGS_EXTENDED_SC_DMG = BIT(6),
};
/**
* enum rate_info_bw - rate bandwidth information
*
* Used by the driver to indicate the rate bandwidth.
*
* @RATE_INFO_BW_5: 5 MHz bandwidth
* @RATE_INFO_BW_10: 10 MHz bandwidth
* @RATE_INFO_BW_20: 20 MHz bandwidth
* @RATE_INFO_BW_40: 40 MHz bandwidth
* @RATE_INFO_BW_80: 80 MHz bandwidth
* @RATE_INFO_BW_160: 160 MHz bandwidth
* @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
*/
enum rate_info_bw {
RATE_INFO_BW_20 = 0,
RATE_INFO_BW_5,
RATE_INFO_BW_10,
RATE_INFO_BW_40,
RATE_INFO_BW_80,
RATE_INFO_BW_160,
RATE_INFO_BW_HE_RU,
};
/**
* struct rate_info - bitrate information
*
* Information about a receiving or transmitting bitrate
*
* @flags: bitflag of flags from &enum rate_info_flags
* @mcs: mcs index if struct describes an HT/VHT/HE rate
* @legacy: bitrate in 100kbit/s for 802.11abg
* @nss: number of streams (VHT & HE only)
* @bw: bandwidth (from &enum rate_info_bw)
* @he_gi: HE guard interval (from &enum nl80211_he_gi)
* @he_dcm: HE DCM value
* @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
* only valid if bw is %RATE_INFO_BW_HE_RU)
* @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
*/
struct rate_info {
u8 flags;
u8 mcs;
u16 legacy;
u8 nss;
u8 bw;
u8 he_gi;
u8 he_dcm;
u8 he_ru_alloc;
u8 n_bonded_ch;
};
/**
* enum bss_param_flags - bitrate info flags
*
* Used by the driver to indicate the specific rate transmission
* type for 802.11n transmissions.
*
* @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
* @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
* @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
*/
enum bss_param_flags {
BSS_PARAM_FLAGS_CTS_PROT = 1<<0,
BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1,
BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2,
};
/**
* struct sta_bss_parameters - BSS parameters for the attached station
*
* Information about the currently associated BSS
*
* @flags: bitflag of flags from &enum bss_param_flags
* @dtim_period: DTIM period for the BSS
* @beacon_interval: beacon interval
*/
struct sta_bss_parameters {
u8 flags;
u8 dtim_period;
u16 beacon_interval;
};
/**
* struct cfg80211_txq_stats - TXQ statistics for this TID
* @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
* indicate the relevant values in this struct are filled
* @backlog_bytes: total number of bytes currently backlogged
* @backlog_packets: total number of packets currently backlogged
* @flows: number of new flows seen
* @drops: total number of packets dropped
* @ecn_marks: total number of packets marked with ECN CE
* @overlimit: number of drops due to queue space overflow
* @overmemory: number of drops due to memory limit overflow
* @collisions: number of hash collisions
* @tx_bytes: total number of bytes dequeued
* @tx_packets: total number of packets dequeued
* @max_flows: maximum number of flows supported
*/
struct cfg80211_txq_stats {
u32 filled;
u32 backlog_bytes;
u32 backlog_packets;
u32 flows;
u32 drops;
u32 ecn_marks;
u32 overlimit;
u32 overmemory;
u32 collisions;
u32 tx_bytes;
u32 tx_packets;
u32 max_flows;
};
/**
* struct cfg80211_tid_stats - per-TID statistics
* @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
* indicate the relevant values in this struct are filled
* @rx_msdu: number of received MSDUs
* @tx_msdu: number of (attempted) transmitted MSDUs
* @tx_msdu_retries: number of retries (not counting the first) for
* transmitted MSDUs
* @tx_msdu_failed: number of failed transmitted MSDUs
* @txq_stats: TXQ statistics
*/
struct cfg80211_tid_stats {
u32 filled;
u64 rx_msdu;
u64 tx_msdu;
u64 tx_msdu_retries;
u64 tx_msdu_failed;
struct cfg80211_txq_stats txq_stats;
};
#define IEEE80211_MAX_CHAINS 4
/**
* struct station_info - station information
*
* Station information filled by driver for get_station() and dump_station.
*
* @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
* indicate the relevant values in this struct for them
* @connected_time: time(in secs) since a station is last connected
* @inactive_time: time since last station activity (tx/rx) in milliseconds
* @assoc_at: bootime (ns) of the last association
* @rx_bytes: bytes (size of MPDUs) received from this station
* @tx_bytes: bytes (size of MPDUs) transmitted to this station
* @llid: mesh local link id
* @plid: mesh peer link id
* @plink_state: mesh peer link state
* @signal: The signal strength, type depends on the wiphy's signal_type.
* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
* @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
* For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
* @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
* @chain_signal: per-chain signal strength of last received packet in dBm
* @chain_signal_avg: per-chain signal strength average in dBm
* @txrate: current unicast bitrate from this station
* @rxrate: current unicast bitrate to this station
* @rx_packets: packets (MSDUs & MMPDUs) received from this station
* @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
* @tx_retries: cumulative retry counts (MPDUs)
* @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
* @rx_dropped_misc: Dropped for un-specified reason.
* @bss_param: current BSS parameters
* @generation: generation number for nl80211 dumps.
* This number should increase every time the list of stations
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
* @assoc_req_ies: IEs from (Re)Association Request.
* This is used only when in AP mode with drivers that do not use
* user space MLME/SME implementation. The information is provided for
* the cfg80211_new_sta() calls to notify user space of the IEs.
* @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
* @sta_flags: station flags mask & values
* @beacon_loss_count: Number of times beacon loss event has triggered.
* @t_offset: Time offset of the station relative to this host.
* @local_pm: local mesh STA power save mode
* @peer_pm: peer mesh STA power save mode
* @nonpeer_pm: non-peer mesh STA power save mode
* @expected_throughput: expected throughput in kbps (including 802.11 headers)
* towards this station.
* @rx_beacon: number of beacons received from this peer
* @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
* from this peer
* @connected_to_gate: true if mesh STA has a path to mesh gate
* @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
* @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
* @airtime_weight: current airtime scheduling weight
* @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
* (IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
* Note that this doesn't use the @filled bit, but is used if non-NULL.
* @ack_signal: signal strength (in dBm) of the last ACK frame.
* @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
* been sent.
* @rx_mpdu_count: number of MPDUs received from this station
* @fcs_err_count: number of packets (MPDUs) received from this station with
* an FCS error. This counter should be incremented only when TA of the
* received packet with an FCS error matches the peer MAC address.
* @airtime_link_metric: mesh airtime link metric.
* @connected_to_as: true if mesh STA has a path to authentication server
*/
struct station_info {
u64 filled;
u32 connected_time;
u32 inactive_time;
u64 assoc_at;
u64 rx_bytes;
u64 tx_bytes;
u16 llid;
u16 plid;
u8 plink_state;
s8 signal;
s8 signal_avg;
u8 chains;
s8 chain_signal[IEEE80211_MAX_CHAINS];
s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
struct rate_info txrate;
struct rate_info rxrate;
u32 rx_packets;
u32 tx_packets;
u32 tx_retries;
u32 tx_failed;
u32 rx_dropped_misc;
struct sta_bss_parameters bss_param;
struct nl80211_sta_flag_update sta_flags;
int generation;
const u8 *assoc_req_ies;
size_t assoc_req_ies_len;
u32 beacon_loss_count;
s64 t_offset;
enum nl80211_mesh_power_mode local_pm;
enum nl80211_mesh_power_mode peer_pm;
enum nl80211_mesh_power_mode nonpeer_pm;
u32 expected_throughput;
u64 tx_duration;
u64 rx_duration;
u64 rx_beacon;
u8 rx_beacon_signal_avg;
u8 connected_to_gate;
struct cfg80211_tid_stats *pertid;
s8 ack_signal;
s8 avg_ack_signal;
u16 airtime_weight;
u32 rx_mpdu_count;
u32 fcs_err_count;
u32 airtime_link_metric;
u8 connected_to_as;
};
/**
* struct cfg80211_sar_sub_specs - sub specs limit
* @power: power limitation in 0.25dbm
* @freq_range_index: index the power limitation applies to
*/
struct cfg80211_sar_sub_specs {
s32 power;
u32 freq_range_index;
};
/**
* struct cfg80211_sar_specs - sar limit specs
* @type: it's set with power in 0.25dbm or other types
* @num_sub_specs: number of sar sub specs
* @sub_specs: memory to hold the sar sub specs
*/
struct cfg80211_sar_specs {
enum nl80211_sar_type type;
u32 num_sub_specs;
struct cfg80211_sar_sub_specs sub_specs[];
};
/**
* struct cfg80211_sar_freq_ranges - sar frequency ranges
* @start_freq: start range edge frequency
* @end_freq: end range edge frequency
*/
struct cfg80211_sar_freq_ranges {
u32 start_freq;
u32 end_freq;
};
/**
* struct cfg80211_sar_capa - sar limit capability
* @type: it's set via power in 0.25dbm or other types
* @num_freq_ranges: number of frequency ranges
* @freq_ranges: memory to hold the freq ranges.
*
* Note: WLAN driver may append new ranges or split an existing
* range to small ones and then append them.
*/
struct cfg80211_sar_capa {
enum nl80211_sar_type type;
u32 num_freq_ranges;
const struct cfg80211_sar_freq_ranges *freq_ranges;
};
#if IS_ENABLED(CONFIG_CFG80211)
/**
* cfg80211_get_station - retrieve information about a given station
* @dev: the device where the station is supposed to be connected to
* @mac_addr: the mac address of the station of interest
* @sinfo: pointer to the structure to fill with the information
*
* Returns 0 on success and sinfo is filled with the available information
* otherwise returns a negative error code and the content of sinfo has to be
* considered undefined.
*/
int cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
struct station_info *sinfo);
#else
static inline int cfg80211_get_station(struct net_device *dev,
const u8 *mac_addr,
struct station_info *sinfo)
{
return -ENOENT;
}
#endif
/**
* enum monitor_flags - monitor flags
*
* Monitor interface configuration flags. Note that these must be the bits
* according to the nl80211 flags.
*
* @MONITOR_FLAG_CHANGED: set if the flags were changed
* @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
* @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
* @MONITOR_FLAG_CONTROL: pass control frames
* @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
* @MONITOR_FLAG_COOK_FRAMES: report frames after processing
* @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
*/
enum monitor_flags {
MONITOR_FLAG_CHANGED = 1<<__NL80211_MNTR_FLAG_INVALID,
MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
MONITOR_FLAG_ACTIVE = 1<<NL80211_MNTR_FLAG_ACTIVE,
};
/**
* enum mpath_info_flags - mesh path information flags
*
* Used by the driver to indicate which info in &struct mpath_info it has filled
* in during get_station() or dump_station().
*
* @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
* @MPATH_INFO_SN: @sn filled
* @MPATH_INFO_METRIC: @metric filled
* @MPATH_INFO_EXPTIME: @exptime filled
* @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
* @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
* @MPATH_INFO_FLAGS: @flags filled
* @MPATH_INFO_HOP_COUNT: @hop_count filled
* @MPATH_INFO_PATH_CHANGE: @path_change_count filled
*/
enum mpath_info_flags {
MPATH_INFO_FRAME_QLEN = BIT(0),
MPATH_INFO_SN = BIT(1),
MPATH_INFO_METRIC = BIT(2),
MPATH_INFO_EXPTIME = BIT(3),
MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
MPATH_INFO_FLAGS = BIT(6),
MPATH_INFO_HOP_COUNT = BIT(7),
MPATH_INFO_PATH_CHANGE = BIT(8),
};
/**
* struct mpath_info - mesh path information
*
* Mesh path information filled by driver for get_mpath() and dump_mpath().
*
* @filled: bitfield of flags from &enum mpath_info_flags
* @frame_qlen: number of queued frames for this destination
* @sn: target sequence number
* @metric: metric (cost) of this mesh path
* @exptime: expiration time for the mesh path from now, in msecs
* @flags: mesh path flags
* @discovery_timeout: total mesh path discovery timeout, in msecs
* @discovery_retries: mesh path discovery retries
* @generation: generation number for nl80211 dumps.
* This number should increase every time the list of mesh paths
* changes, i.e. when a station is added or removed, so that
* userspace can tell whether it got a consistent snapshot.
* @hop_count: hops to destination
* @path_change_count: total number of path changes to destination
*/
struct mpath_info {
u32 filled;
u32 frame_qlen;
u32 sn;
u32 metric;
u32 exptime;
u32 discovery_timeout;
u8 discovery_retries;
u8 flags;
u8 hop_count;
u32 path_change_count;
int generation;
};
/**
* struct bss_parameters - BSS parameters
*
* Used to change BSS parameters (mainly for AP mode).
*
* @use_cts_prot: Whether to use CTS protection
* (0 = no, 1 = yes, -1 = do not change)
* @use_short_preamble: Whether the use of short preambles is allowed
* (0 = no, 1 = yes, -1 = do not change)
* @use_short_slot_time: Whether the use of short slot time is allowed
* (0 = no, 1 = yes, -1 = do not change)
* @basic_rates: basic rates in IEEE 802.11 format
* (or NULL for no change)
* @basic_rates_len: number of basic rates
* @ap_isolate: do not forward packets between connected stations
* (0 = no, 1 = yes, -1 = do not change)
* @ht_opmode: HT Operation mode
* (u16 = opmode, -1 = do not change)
* @p2p_ctwindow: P2P CT Window (-1 = no change)
* @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
*/
struct bss_parameters {
int use_cts_prot;
int use_short_preamble;
int use_short_slot_time;
const u8 *basic_rates;
u8 basic_rates_len;
int ap_isolate;
int ht_opmode;
s8 p2p_ctwindow, p2p_opp_ps;
};
/**
* struct mesh_config - 802.11s mesh configuration
*
* These parameters can be changed while the mesh is active.
*
* @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
* by the Mesh Peering Open message
* @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
* used by the Mesh Peering Open message
* @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
* the mesh peering management to close a mesh peering
* @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
* mesh interface
* @dot11MeshMaxRetries: the maximum number of peer link open retries that can
* be sent to establish a new peer link instance in a mesh
* @dot11MeshTTL: the value of TTL field set at a source mesh STA
* @element_ttl: the value of TTL field set at a mesh STA for path selection
* elements
* @auto_open_plinks: whether we should automatically open peer links when we
* detect compatible mesh peers
* @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
* synchronize to for 11s default synchronization method
* @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
* that an originator mesh STA can send to a particular path target
* @path_refresh_time: how frequently to refresh mesh paths in milliseconds
* @min_discovery_timeout: the minimum length of time to wait until giving up on
* a path discovery in milliseconds
* @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
* receiving a PREQ shall consider the forwarding information from the
* root to be valid. (TU = time unit)
* @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
* which a mesh STA can send only one action frame containing a PREQ
* element
* @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
* which a mesh STA can send only one Action frame containing a PERR
* element
* @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
* it takes for an HWMP information element to propagate across the mesh
* @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
* @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
* announcements are transmitted
* @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
* station has access to a broader network beyond the MBSS. (This is
* missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
* only means that the station will announce others it's a mesh gate, but
* not necessarily using the gate announcement protocol. Still keeping the
* same nomenclature to be in sync with the spec)
* @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
* entity (default is TRUE - forwarding entity)
* @rssi_threshold: the threshold for average signal strength of candidate
* station to establish a peer link
* @ht_opmode: mesh HT protection mode
*
* @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
* receiving a proactive PREQ shall consider the forwarding information to
* the root mesh STA to be valid.
*
* @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
* PREQs are transmitted.
* @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
* during which a mesh STA can send only one Action frame containing
* a PREQ element for root path confirmation.
* @power_mode: The default mesh power save mode which will be the initial
* setting for new peer links.
* @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
* after transmitting its beacon.
* @plink_timeout: If no tx activity is seen from a STA we've established
* peering with for longer than this time (in seconds), then remove it
* from the STA's list of peers. Default is 30 minutes.
* @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
* connected to a mesh gate in mesh formation info. If false, the
* value in mesh formation is determined by the presence of root paths
* in the mesh path table
* @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
* for HWMP) if the destination is a direct neighbor. Note that this might
* not be the optimal decision as a multi-hop route might be better. So
* if using this setting you will likely also want to disable
* dot11MeshForwarding and use another mesh routing protocol on top.
*/
struct mesh_config {
u16 dot11MeshRetryTimeout;
u16 dot11MeshConfirmTimeout;
u16 dot11MeshHoldingTimeout;
u16 dot11MeshMaxPeerLinks;
u8 dot11MeshMaxRetries;
u8 dot11MeshTTL;
u8 element_ttl;
bool auto_open_plinks;
u32 dot11MeshNbrOffsetMaxNeighbor;
u8 dot11MeshHWMPmaxPREQretries;
u32 path_refresh_time;
u16 min_discovery_timeout;
u32 dot11MeshHWMPactivePathTimeout;
u16 dot11MeshHWMPpreqMinInterval;
u16 dot11MeshHWMPperrMinInterval;
u16 dot11MeshHWMPnetDiameterTraversalTime;
u8 dot11MeshHWMPRootMode;
bool dot11MeshConnectedToMeshGate;
bool dot11MeshConnectedToAuthServer;
u16 dot11MeshHWMPRannInterval;
bool dot11MeshGateAnnouncementProtocol;
bool dot11MeshForwarding;
s32 rssi_threshold;
u16 ht_opmode;
u32 dot11MeshHWMPactivePathToRootTimeout;
u16 dot11MeshHWMProotInterval;
u16 dot11MeshHWMPconfirmationInterval;
enum nl80211_mesh_power_mode power_mode;
u16 dot11MeshAwakeWindowDuration;
u32 plink_timeout;
bool dot11MeshNolearn;
};
/**
* struct mesh_setup - 802.11s mesh setup configuration
* @chandef: defines the channel to use
* @mesh_id: the mesh ID
* @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
* @sync_method: which synchronization method to use
* @path_sel_proto: which path selection protocol to use
* @path_metric: which metric to use
* @auth_id: which authentication method this mesh is using
* @ie: vendor information elements (optional)
* @ie_len: length of vendor information elements
* @is_authenticated: this mesh requires authentication
* @is_secure: this mesh uses security
* @user_mpm: userspace handles all MPM functions
* @dtim_period: DTIM period to use
* @beacon_interval: beacon interval to use
* @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
* @basic_rates: basic rates to use when creating the mesh
* @beacon_rate: bitrate to be used for beacons
* @userspace_handles_dfs: whether user space controls DFS operation, i.e.
* changes the channel when a radar is detected. This is required
* to operate on DFS channels.
* @control_port_over_nl80211: TRUE if userspace expects to exchange control
* port frames over NL80211 instead of the network interface.
*
* These parameters are fixed when the mesh is created.
*/
struct mesh_setup {
struct cfg80211_chan_def chandef;
const u8 *mesh_id;
u8 mesh_id_len;
u8 sync_method;
u8 path_sel_proto;
u8 path_metric;
u8 auth_id;
const u8 *ie;
u8 ie_len;
bool is_authenticated;
bool is_secure;
bool user_mpm;
u8 dtim_period;
u16 beacon_interval;
int mcast_rate[NUM_NL80211_BANDS];
u32 basic_rates;
struct cfg80211_bitrate_mask beacon_rate;
bool userspace_handles_dfs;
bool control_port_over_nl80211;
};
/**
* struct ocb_setup - 802.11p OCB mode setup configuration
* @chandef: defines the channel to use
*
* These parameters are fixed when connecting to the network
*/
struct ocb_setup {
struct cfg80211_chan_def chandef;
};
/**
* struct ieee80211_txq_params - TX queue parameters
* @ac: AC identifier
* @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
* @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
* 1..32767]
* @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
* 1..32767]
* @aifs: Arbitration interframe space [0..255]
*/
struct ieee80211_txq_params {
enum nl80211_ac ac;
u16 txop;
u16 cwmin;
u16 cwmax;
u8 aifs;
};
/**
* DOC: Scanning and BSS list handling
*
* The scanning process itself is fairly simple, but cfg80211 offers quite
* a bit of helper functionality. To start a scan, the scan operation will
* be invoked with a scan definition. This scan definition contains the
* channels to scan, and the SSIDs to send probe requests for (including the
* wildcard, if desired). A passive scan is indicated by having no SSIDs to
* probe. Additionally, a scan request may contain extra information elements
* that should be added to the probe request. The IEs are guaranteed to be
* well-formed, and will not exceed the maximum length the driver advertised
* in the wiphy structure.
*
* When scanning finds a BSS, cfg80211 needs to be notified of that, because
* it is responsible for maintaining the BSS list; the driver should not
* maintain a list itself. For this notification, various functions exist.
*
* Since drivers do not maintain a BSS list, there are also a number of
* functions to search for a BSS and obtain information about it from the
* BSS structure cfg80211 maintains. The BSS list is also made available
* to userspace.
*/
/**
* struct cfg80211_ssid - SSID description
* @ssid: the SSID
* @ssid_len: length of the ssid
*/
struct cfg80211_ssid {
u8 ssid[IEEE80211_MAX_SSID_LEN];
u8 ssid_len;
};
/**
* struct cfg80211_scan_info - information about completed scan
* @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
* wireless device that requested the scan is connected to. If this
* information is not available, this field is left zero.
* @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
* @aborted: set to true if the scan was aborted for any reason,
* userspace will be notified of that
*/
struct cfg80211_scan_info {
u64 scan_start_tsf;
u8 tsf_bssid[ETH_ALEN] __aligned(2);
bool aborted;
};
/**
* struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
*
* @short_bssid: short ssid to scan for
* @bssid: bssid to scan for
* @channel_idx: idx of the channel in the channel array in the scan request
* which the above info relvant to
* @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
* @short_ssid_valid: short_ssid is valid and can be used
* @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
* 20 TUs before starting to send probe requests.
*/
struct cfg80211_scan_6ghz_params {
u32 short_ssid;
u32 channel_idx;
u8 bssid[ETH_ALEN];
bool unsolicited_probe;
bool short_ssid_valid;
bool psc_no_listen;
};
/**
* struct cfg80211_scan_request - scan request description
*
* @ssids: SSIDs to scan for (active scan only)
* @n_ssids: number of SSIDs
* @channels: channels to scan on.
* @n_channels: total number of channels to scan
* @scan_width: channel width for scanning
* @ie: optional information element(s) to add into Probe Request or %NULL
* @ie_len: length of ie in octets
* @duration: how long to listen on each channel, in TUs. If
* %duration_mandatory is not set, this is the maximum dwell time and
* the actual dwell time may be shorter.
* @duration_mandatory: if set, the scan duration must be as specified by the
* %duration field.
* @flags: bit field of flags controlling operation
* @rates: bitmap of rates to advertise for each band
* @wiphy: the wiphy this was for
* @scan_start: time (in jiffies) when the scan started
* @wdev: the wireless device to scan for
* @info: (internal) information about completed scan
* @notified: (internal) scan request was notified as done or aborted
* @no_cck: used to send probe requests at non CCK rate in 2GHz band
* @mac_addr: MAC address used with randomisation
* @mac_addr_mask: MAC address mask used with randomisation, bits that
* are 0 in the mask should be randomised, bits that are 1 should
* be taken from the @mac_addr
* @scan_6ghz: relevant for split scan request only,
* true if this is the second scan request
* @n_6ghz_params: number of 6 GHz params
* @scan_6ghz_params: 6 GHz params
* @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
*/
struct cfg80211_scan_request {
struct cfg80211_ssid *ssids;
int n_ssids;
u32 n_channels;
enum nl80211_bss_scan_width scan_width;
const u8 *ie;
size_t ie_len;
u16 duration;
bool duration_mandatory;
u32 flags;
u32 rates[NUM_NL80211_BANDS];
struct wireless_dev *wdev;
u8 mac_addr[ETH_ALEN] __aligned(2);
u8 mac_addr_mask[ETH_ALEN] __aligned(2);
u8 bssid[ETH_ALEN] __aligned(2);
/* internal */
struct wiphy *wiphy;
unsigned long scan_start;
struct cfg80211_scan_info info;
bool notified;
bool no_cck;
bool scan_6ghz;
u32 n_6ghz_params;
struct cfg80211_scan_6ghz_params *scan_6ghz_params;
/* keep last */
struct ieee80211_channel *channels[];
};
static inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
{
int i;
get_random_bytes(buf, ETH_ALEN);
for (i = 0; i < ETH_ALEN; i++) {
buf[i] &= ~mask[i];
buf[i] |= addr[i] & mask[i];
}
}
/**
* struct cfg80211_match_set - sets of attributes to match
*
* @ssid: SSID to be matched; may be zero-length in case of BSSID match
* or no match (RSSI only)
* @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
* or no match (RSSI only)
* @rssi_thold: don't report scan results below this threshold (in s32 dBm)
* @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
* for filtering out scan results received. Drivers advertize this support
* of band specific rssi based filtering through the feature capability
* %NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
* specific rssi thresholds take precedence over rssi_thold, if specified.
* If not specified for any band, it will be assigned with rssi_thold of
* corresponding matchset.
*/
struct cfg80211_match_set {
struct cfg80211_ssid ssid;
u8 bssid[ETH_ALEN];
s32 rssi_thold;
s32 per_band_rssi_thold[NUM_NL80211_BANDS];
};
/**
* struct cfg80211_sched_scan_plan - scan plan for scheduled scan
*
* @interval: interval between scheduled scan iterations. In seconds.
* @iterations: number of scan iterations in this scan plan. Zero means
* infinite loop.
* The last scan plan will always have this parameter set to zero,
* all other scan plans will have a finite number of iterations.
*/
struct cfg80211_sched_scan_plan {
u32 interval;
u32 iterations;
};
/**
* struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
*
* @band: band of BSS which should match for RSSI level adjustment.
* @delta: value of RSSI level adjustment.
*/
struct cfg80211_bss_select_adjust {
enum nl80211_band band;
s8 delta;
};
/**
* struct cfg80211_sched_scan_request - scheduled scan request description
*
* @reqid: identifies this request.
* @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
* @n_ssids: number of SSIDs
* @n_channels: total number of channels to scan
* @scan_width: channel width for scanning
* @ie: optional information element(s) to add into Probe Request or %NULL
* @ie_len: length of ie in octets
* @flags: bit field of flags controlling operation
* @match_sets: sets of parameters to be matched for a scan result
* entry to be considered valid and to be passed to the host
* (others are filtered out).
* If ommited, all results are passed.
* @n_match_sets: number of match sets
* @report_results: indicates that results were reported for this request
* @wiphy: the wiphy this was for
* @dev: the interface
* @scan_start: start time of the scheduled scan
* @channels: channels to scan
* @min_rssi_thold: for drivers only supporting a single threshold, this
* contains the minimum over all matchsets
* @mac_addr: MAC address used with randomisation
* @mac_addr_mask: MAC address mask used with randomisation, bits that
* are 0 in the mask should be randomised, bits that are 1 should
* be taken from the @mac_addr
* @scan_plans: scan plans to be executed in this scheduled scan. Lowest
* index must be executed first.
* @n_scan_plans: number of scan plans, at least 1.
* @rcu_head: RCU callback used to free the struct
* @owner_nlportid: netlink portid of owner (if this should is a request
* owned by a particular socket)
* @nl_owner_dead: netlink owner socket was closed - this request be freed
* @list: for keeping list of requests.
* @delay: delay in seconds to use before starting the first scan
* cycle. The driver may ignore this parameter and start
* immediately (or at any other time), if this feature is not
* supported.
* @relative_rssi_set: Indicates whether @relative_rssi is set or not.
* @relative_rssi: Relative RSSI threshold in dB to restrict scan result
* reporting in connected state to cases where a matching BSS is determined
* to have better or slightly worse RSSI than the current connected BSS.
* The relative RSSI threshold values are ignored in disconnected state.
* @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
* to the specified band while deciding whether a better BSS is reported
* using @relative_rssi. If delta is a negative number, the BSSs that
* belong to the specified band will be penalized by delta dB in relative
* comparisions.
*/
struct cfg80211_sched_scan_request {
u64 reqid;
struct cfg80211_ssid *ssids;
int n_ssids;
u32 n_channels;
enum nl80211_bss_scan_width scan_width;
const u8 *ie;
size_t ie_len;
u32 flags;
struct cfg80211_match_set *match_sets;
int n_match_sets;
s32 min_rssi_thold;
u32 delay;
struct cfg80211_sched_scan_plan *scan_plans;
int n_scan_plans;
u8 mac_addr[ETH_ALEN] __aligned(2);
u8 mac_addr_mask[ETH_ALEN] __aligned(2);
bool relative_rssi_set;
s8 relative_rssi;
struct cfg80211_bss_select_adjust rssi_adjust;
/* internal */
struct wiphy *wiphy;
struct net_device *dev;
unsigned long scan_start;
bool report_results;
struct rcu_head rcu_head;
u32 owner_nlportid;
bool nl_owner_dead;
struct list_head list;
/* keep last */
struct ieee80211_channel *channels[];
};
/**
* enum cfg80211_signal_type - signal type
*
* @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
* @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
* @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
*/
enum cfg80211_signal_type {
CFG80211_SIGNAL_TYPE_NONE,
CFG80211_SIGNAL_TYPE_MBM,
CFG80211_SIGNAL_TYPE_UNSPEC,
};
/**
* struct cfg80211_inform_bss - BSS inform data
* @chan: channel the frame was received on
* @scan_width: scan width that was used
* @signal: signal strength value, according to the wiphy's
* signal type
* @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
* received; should match the time when the frame was actually
* received by the device (not just by the host, in case it was
* buffered on the device) and be accurate to about 10ms.
* If the frame isn't buffered, just passing the return value of
* ktime_get_boottime_ns() is likely appropriate.
* @parent_tsf: the time at the start of reception of the first octet of the
* timestamp field of the frame. The time is the TSF of the BSS specified
* by %parent_bssid.
* @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
* the BSS that requested the scan in which the beacon/probe was received.
* @chains: bitmask for filled values in @chain_signal.
* @chain_signal: per-chain signal strength of last received BSS in dBm.
*/
struct cfg80211_inform_bss {
struct ieee80211_channel *chan;
enum nl80211_bss_scan_width scan_width;
s32 signal;
u64 boottime_ns;
u64 parent_tsf;
u8 parent_bssid[ETH_ALEN] __aligned(2);
u8 chains;
s8 chain_signal[IEEE80211_MAX_CHAINS];
};
/**
* struct cfg80211_bss_ies - BSS entry IE data
* @tsf: TSF contained in the frame that carried these IEs
* @rcu_head: internal use, for freeing
* @len: length of the IEs
* @from_beacon: these IEs are known to come from a beacon
* @data: IE data
*/
struct cfg80211_bss_ies {
u64 tsf;
struct rcu_head rcu_head;
int len;
bool from_beacon;
u8 data[];
};
/**
* struct cfg80211_bss - BSS description
*
* This structure describes a BSS (which may also be a mesh network)
* for use in scan results and similar.
*
* @channel: channel this BSS is on
* @scan_width: width of the control channel
* @bssid: BSSID of the BSS
* @beacon_interval: the beacon interval as from the frame
* @capability: the capability field in host byte order
* @ies: the information elements (Note that there is no guarantee that these
* are well-formed!); this is a pointer to either the beacon_ies or
* proberesp_ies depending on whether Probe Response frame has been
* received. It is always non-%NULL.
* @beacon_ies: the information elements from the last Beacon frame
* (implementation note: if @hidden_beacon_bss is set this struct doesn't
* own the beacon_ies, but they're just pointers to the ones from the
* @hidden_beacon_bss struct)
* @proberesp_ies: the information elements from the last Probe Response frame
* @hidden_beacon_bss: in case this BSS struct represents a probe response from
* a BSS that hides the SSID in its beacon, this points to the BSS struct
* that holds the beacon data. @beacon_ies is still valid, of course, and
* points to the same data as hidden_beacon_bss->beacon_ies in that case.
* @transmitted_bss: pointer to the transmitted BSS, if this is a
* non-transmitted one (multi-BSSID support)
* @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
* (multi-BSSID support)
* @signal: signal strength value (type depends on the wiphy's signal_type)
* @chains: bitmask for filled values in @chain_signal.
* @chain_signal: per-chain signal strength of last received BSS in dBm.
* @bssid_index: index in the multiple BSS set
* @max_bssid_indicator: max number of members in the BSS set
* @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
*/
struct cfg80211_bss {
struct ieee80211_channel *channel;
enum nl80211_bss_scan_width scan_width;
const struct cfg80211_bss_ies __rcu *ies;
const struct cfg80211_bss_ies __rcu *beacon_ies;
const struct cfg80211_bss_ies __rcu *proberesp_ies;
struct cfg80211_bss *hidden_beacon_bss;
struct cfg80211_bss *transmitted_bss;
struct list_head nontrans_list;
s32 signal;
u16 beacon_interval;
u16 capability;
u8 bssid[ETH_ALEN];
u8 chains;
s8 chain_signal[IEEE80211_MAX_CHAINS];
u8 bssid_index;
u8 max_bssid_indicator;
u8 priv[] __aligned(sizeof(void *));
};
/**
* ieee80211_bss_get_elem - find element with given ID
* @bss: the bss to search
* @id: the element ID
*
* Note that the return value is an RCU-protected pointer, so
* rcu_read_lock() must be held when calling this function.
* Return: %NULL if not found.
*/
const struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
/**
* ieee80211_bss_get_ie - find IE with given ID
* @bss: the bss to search
* @id: the element ID
*
* Note that the return value is an RCU-protected pointer, so
* rcu_read_lock() must be held when calling this function.
* Return: %NULL if not found.
*/
static inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
{
return (void *)ieee80211_bss_get_elem(bss, id);
}
/**
* struct cfg80211_auth_request - Authentication request data
*
* This structure provides information needed to complete IEEE 802.11
* authentication.
*
* @bss: The BSS to authenticate with, the callee must obtain a reference
* to it if it needs to keep it.
* @auth_type: Authentication type (algorithm)
* @ie: Extra IEs to add to Authentication frame or %NULL
* @ie_len: Length of ie buffer in octets
* @key_len: length of WEP key for shared key authentication
* @key_idx: index of WEP key for shared key authentication
* @key: WEP key for shared key authentication
* @auth_data: Fields and elements in Authentication frames. This contains
* the authentication frame body (non-IE and IE data), excluding the
* Authentication algorithm number, i.e., starting at the Authentication
* transaction sequence number field.
* @auth_data_len: Length of auth_data buffer in octets
*/
struct cfg80211_auth_request {
struct cfg80211_bss *bss;
const u8 *ie;
size_t ie_len;
enum nl80211_auth_type auth_type;
const u8 *key;
u8 key_len, key_idx;
const u8 *auth_data;
size_t auth_data_len;
};
/**
* enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
*
* @ASSOC_REQ_DISABLE_HT: Disable HT (802.11n)
* @ASSOC_REQ_DISABLE_VHT: Disable VHT
* @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
* @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
* authentication capability. Drivers can offload authentication to
* userspace if this flag is set. Only applicable for cfg80211_connect()
* request (connect callback).
* @ASSOC_REQ_DISABLE_HE: Disable HE
*/
enum cfg80211_assoc_req_flags {
ASSOC_REQ_DISABLE_HT = BIT(0),
ASSOC_REQ_DISABLE_VHT = BIT(1),
ASSOC_REQ_USE_RRM = BIT(2),
CONNECT_REQ_EXTERNAL_AUTH_SUPPORT = BIT(3),
ASSOC_REQ_DISABLE_HE = BIT(4),
};
/**
* struct cfg80211_assoc_request - (Re)Association request data
*
* This structure provides information needed to complete IEEE 802.11
* (re)association.
* @bss: The BSS to associate with. If the call is successful the driver is
* given a reference that it must give back to cfg80211_send_rx_assoc()
* or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
* association requests while already associating must be rejected.
* @ie: Extra IEs to add to (Re)Association Request frame or %NULL
* @ie_len: Length of ie buffer in octets
* @use_mfp: Use management frame protection (IEEE 802.11w) in this association
* @crypto: crypto settings
* @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
* to indicate a request to reassociate within the ESS instead of a request
* do the initial association with the ESS. When included, this is set to
* the BSSID of the current association, i.e., to the value that is
* included in the Current AP address field of the Reassociation Request
* frame.
* @flags: See &enum cfg80211_assoc_req_flags
* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
* will be used in ht_capa. Un-supported values will be ignored.
* @ht_capa_mask: The bits of ht_capa which are to be used.
* @vht_capa: VHT capability override
* @vht_capa_mask: VHT capability mask indicating which fields to use
* @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
* %NULL if FILS is not used.
* @fils_kek_len: Length of fils_kek in octets
* @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
* Request/Response frame or %NULL if FILS is not used. This field starts
* with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
* @s1g_capa: S1G capability override
* @s1g_capa_mask: S1G capability override mask
*/
struct cfg80211_assoc_request {
struct cfg80211_bss *bss;
const u8 *ie, *prev_bssid;
size_t ie_len;
struct cfg80211_crypto_settings crypto;
bool use_mfp;
u32 flags;
struct ieee80211_ht_cap ht_capa;
struct ieee80211_ht_cap ht_capa_mask;
struct ieee80211_vht_cap vht_capa, vht_capa_mask;
const u8 *fils_kek;
size_t fils_kek_len;
const u8 *fils_nonces;
struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
};
/**
* struct cfg80211_deauth_request - Deauthentication request data
*
* This structure provides information needed to complete IEEE 802.11
* deauthentication.
*
* @bssid: the BSSID of the BSS to deauthenticate from
* @ie: Extra IEs to add to Deauthentication frame or %NULL
* @ie_len: Length of ie buffer in octets
* @reason_code: The reason code for the deauthentication
* @local_state_change: if set, change local state only and
* do not set a deauth frame
*/
struct cfg80211_deauth_request {
const u8 *bssid;
const u8 *ie;
size_t ie_len;
u16 reason_code;
bool local_state_change;
};
/**
* struct cfg80211_disassoc_request - Disassociation request data
*
* This structure provides information needed to complete IEEE 802.11
* disassociation.
*
* @bss: the BSS to disassociate from
* @ie: Extra IEs to add to Disassociation frame or %NULL
* @ie_len: Length of ie buffer in octets
* @reason_code: The reason code for the disassociation
* @local_state_change: This is a request for a local state only, i.e., no
* Disassociation frame is to be transmitted.
*/
struct cfg80211_disassoc_request {
struct cfg80211_bss *bss;
const u8 *ie;
size_t ie_len;
u16 reason_code;
bool local_state_change;
};
/**
* struct cfg80211_ibss_params - IBSS parameters
*
* This structure defines the IBSS parameters for the join_ibss()
* method.
*
* @ssid: The SSID, will always be non-null.
* @ssid_len: The length of the SSID, will always be non-zero.
* @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
* search for IBSSs with a different BSSID.
* @chandef: defines the channel to use if no other IBSS to join can be found
* @channel_fixed: The channel should be fixed -- do not search for
* IBSSs to join on other channels.
* @ie: information element(s) to include in the beacon
* @ie_len: length of that
* @beacon_interval: beacon interval to use
* @privacy: this is a protected network, keys will be configured
* after joining
* @control_port: whether user space controls IEEE 802.1X port, i.e.,
* sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
* required to assume that the port is unauthorized until authorized by
* user space. Otherwise, port is marked authorized by default.
* @control_port_over_nl80211: TRUE if userspace expects to exchange control
* port frames over NL80211 instead of the network interface.
* @userspace_handles_dfs: whether user space controls DFS operation, i.e.
* changes the channel when a radar is detected. This is required
* to operate on DFS channels.
* @basic_rates: bitmap of basic rates to use when creating the IBSS
* @mcast_rate: per-band multicast rate index + 1 (0: disabled)
* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
* will be used in ht_capa. Un-supported values will be ignored.
* @ht_capa_mask: The bits of ht_capa which are to be used.
* @wep_keys: static WEP keys, if not NULL points to an array of
* CFG80211_MAX_WEP_KEYS WEP keys
* @wep_tx_key: key index (0..3) of the default TX static WEP key
*/
struct cfg80211_ibss_params {
const u8 *ssid;
const u8 *bssid;
struct cfg80211_chan_def chandef;
const u8 *ie;
u8 ssid_len, ie_len;
u16 beacon_interval;
u32 basic_rates;
bool channel_fixed;
bool privacy;
bool control_port;
bool control_port_over_nl80211;
bool userspace_handles_dfs;
int mcast_rate[NUM_NL80211_BANDS];
struct ieee80211_ht_cap ht_capa;
struct ieee80211_ht_cap ht_capa_mask;
struct key_params *wep_keys;
int wep_tx_key;
};
/**
* struct cfg80211_bss_selection - connection parameters for BSS selection.
*
* @behaviour: requested BSS selection behaviour.
* @param: parameters for requestion behaviour.
* @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
* @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
*/
struct cfg80211_bss_selection {
enum nl80211_bss_select_attr behaviour;
union {
enum nl80211_band band_pref;
struct cfg80211_bss_select_adjust adjust;
} param;
};
/**
* struct cfg80211_connect_params - Connection parameters
*
* This structure provides information needed to complete IEEE 802.11
* authentication and association.
*
* @channel: The channel to use or %NULL if not specified (auto-select based
* on scan results)
* @channel_hint: The channel of the recommended BSS for initial connection or
* %NULL if not specified
* @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
* results)
* @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
* %NULL if not specified. Unlike the @bssid parameter, the driver is
* allowed to ignore this @bssid_hint if it has knowledge of a better BSS
* to use.
* @ssid: SSID
* @ssid_len: Length of ssid in octets
* @auth_type: Authentication type (algorithm)
* @ie: IEs for association request
* @ie_len: Length of assoc_ie in octets
* @privacy: indicates whether privacy-enabled APs should be used
* @mfp: indicate whether management frame protection is used
* @crypto: crypto settings
* @key_len: length of WEP key for shared key authentication
* @key_idx: index of WEP key for shared key authentication
* @key: WEP key for shared key authentication
* @flags: See &enum cfg80211_assoc_req_flags
* @bg_scan_period: Background scan period in seconds
* or -1 to indicate that default value is to be used.
* @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
* will be used in ht_capa. Un-supported values will be ignored.
* @ht_capa_mask: The bits of ht_capa which are to be used.
* @vht_capa: VHT Capability overrides
* @vht_capa_mask: The bits of vht_capa which are to be used.
* @pbss: if set, connect to a PCP instead of AP. Valid for DMG
* networks.
* @bss_select: criteria to be used for BSS selection.
* @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
* to indicate a request to reassociate within the ESS instead of a request
* do the initial association with the ESS. When included, this is set to
* the BSSID of the current association, i.e., to the value that is
* included in the Current AP address field of the Reassociation Request
* frame.
* @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
* NAI or %NULL if not specified. This is used to construct FILS wrapped
* data IE.
* @fils_erp_username_len: Length of @fils_erp_username in octets.
* @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
* %NULL if not specified. This specifies the domain name of ER server and
* is used to construct FILS wrapped data IE.
* @fils_erp_realm_len: Length of @fils_erp_realm in octets.
* @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
* messages. This is also used to construct FILS wrapped data IE.
* @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
* keys in FILS or %NULL if not specified.
* @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
* @want_1x: indicates user-space supports and wants to use 802.1X driver
* offload of 4-way handshake.
* @edmg: define the EDMG channels.
* This may specify multiple channels and bonding options for the driver
* to choose from, based on BSS configuration.
*/
struct cfg80211_connect_params {
struct ieee80211_channel *channel;
struct ieee80211_channel *channel_hint;
const u8 *bssid;
const u8 *bssid_hint;
const u8 *ssid;
size_t ssid_len;
enum nl80211_auth_type auth_type;
const u8 *ie;
size_t ie_len;
bool privacy;
enum nl80211_mfp mfp;
struct cfg80211_crypto_settings crypto;
const u8 *key;
u8 key_len, key_idx;
u32 flags;
int bg_scan_period;
struct ieee80211_ht_cap ht_capa;
struct ieee80211_ht_cap ht_capa_mask;
struct ieee80211_vht_cap vht_capa;
struct ieee80211_vht_cap vht_capa_mask;
bool pbss;
struct cfg80211_bss_selection bss_select;
const u8 *prev_bssid;
const u8 *fils_erp_username;
size_t fils_erp_username_len;
const u8 *fils_erp_realm;
size_t fils_erp_realm_len;
u16 fils_erp_next_seq_num;
const u8 *fils_erp_rrk;
size_t fils_erp_rrk_len;
bool want_1x;
struct ieee80211_edmg edmg;
};
/**
* enum cfg80211_connect_params_changed - Connection parameters being updated
*
* This enum provides information of all connect parameters that
* have to be updated as part of update_connect_params() call.
*
* @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
* @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
* username, erp sequence number and rrk) are updated
* @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
*/
enum cfg80211_connect_params_changed {
UPDATE_ASSOC_IES = BIT(0),
UPDATE_FILS_ERP_INFO = BIT(1),
UPDATE_AUTH_TYPE = BIT(2),
};
/**
* enum wiphy_params_flags - set_wiphy_params bitfield values
* @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
* @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
* @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
* @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
* @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
* @WIPHY_PARAM_DYN_ACK: dynack has been enabled
* @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
* @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
* @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
*/
enum wiphy_params_flags {
WIPHY_PARAM_RETRY_SHORT = 1 << 0,
WIPHY_PARAM_RETRY_LONG = 1 << 1,
WIPHY_PARAM_FRAG_THRESHOLD = 1 << 2,
WIPHY_PARAM_RTS_THRESHOLD = 1 << 3,
WIPHY_PARAM_COVERAGE_CLASS = 1 << 4,
WIPHY_PARAM_DYN_ACK = 1 << 5,
WIPHY_PARAM_TXQ_LIMIT = 1 << 6,
WIPHY_PARAM_TXQ_MEMORY_LIMIT = 1 << 7,
WIPHY_PARAM_TXQ_QUANTUM = 1 << 8,
};
#define IEEE80211_DEFAULT_AIRTIME_WEIGHT 256
/* The per TXQ device queue limit in airtime */
#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L 5000
#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H 12000
/* The per interface airtime threshold to switch to lower queue limit */
#define IEEE80211_AQL_THRESHOLD 24000
/**
* struct cfg80211_pmksa - PMK Security Association
*
* This structure is passed to the set/del_pmksa() method for PMKSA
* caching.
*
* @bssid: The AP's BSSID (may be %NULL).
* @pmkid: The identifier to refer a PMKSA.
* @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
* derivation by a FILS STA. Otherwise, %NULL.
* @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
* the hash algorithm used to generate this.
* @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
* cache identifier (may be %NULL).
* @ssid_len: Length of the @ssid in octets.
* @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
* scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
* %NULL).
* @pmk_lifetime: Maximum lifetime for PMKSA in seconds
* (dot11RSNAConfigPMKLifetime) or 0 if not specified.
* The configured PMKSA must not be used for PMKSA caching after
* expiration and any keys derived from this PMK become invalid on
* expiration, i.e., the current association must be dropped if the PMK
* used for it expires.
* @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
* PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
* Drivers are expected to trigger a full authentication instead of using
* this PMKSA for caching when reassociating to a new BSS after this
* threshold to generate a new PMK before the current one expires.
*/
struct cfg80211_pmksa {
const u8 *bssid;
const u8 *pmkid;
const u8 *pmk;
size_t pmk_len;
const u8 *ssid;
size_t ssid_len;
const u8 *cache_id;
u32 pmk_lifetime;
u8 pmk_reauth_threshold;
};
/**
* struct cfg80211_pkt_pattern - packet pattern
* @mask: bitmask where to match pattern and where to ignore bytes,
* one bit per byte, in same format as nl80211
* @pattern: bytes to match where bitmask is 1
* @pattern_len: length of pattern (in bytes)
* @pkt_offset: packet offset (in bytes)
*
* Internal note: @mask and @pattern are allocated in one chunk of
* memory, free @mask only!
*/
struct cfg80211_pkt_pattern {
const u8 *mask, *pattern;
int pattern_len;
int pkt_offset;
};
/**
* struct cfg80211_wowlan_tcp - TCP connection parameters
*
* @sock: (internal) socket for source port allocation
* @src: source IP address
* @dst: destination IP address
* @dst_mac: destination MAC address
* @src_port: source port
* @dst_port: destination port
* @payload_len: data payload length
* @payload: data payload buffer
* @payload_seq: payload sequence stamping configuration
* @data_interval: interval at which to send data packets
* @wake_len: wakeup payload match length
* @wake_data: wakeup payload match data
* @wake_mask: wakeup payload match mask
* @tokens_size: length of the tokens buffer
* @payload_tok: payload token usage configuration
*/
struct cfg80211_wowlan_tcp {
struct socket *sock;
__be32 src, dst;
u16 src_port, dst_port;
u8 dst_mac[ETH_ALEN];
int payload_len;
const u8 *payload;
struct nl80211_wowlan_tcp_data_seq payload_seq;
u32 data_interval;
u32 wake_len;
const u8 *wake_data, *wake_mask;
u32 tokens_size;
/* must be last, variable member */
struct nl80211_wowlan_tcp_data_token payload_tok;
};
/**
* struct cfg80211_wowlan - Wake on Wireless-LAN support info
*
* This structure defines the enabled WoWLAN triggers for the device.
* @any: wake up on any activity -- special trigger if device continues
* operating as normal during suspend
* @disconnect: wake up if getting disconnected
* @magic_pkt: wake up on receiving magic packet
* @patterns: wake up on receiving packet matching a pattern
* @n_patterns: number of patterns
* @gtk_rekey_failure: wake up on GTK rekey failure
* @eap_identity_req: wake up on EAP identity request packet
* @four_way_handshake: wake up on 4-way handshake
* @rfkill_release: wake up when rfkill is released
* @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
* NULL if not configured.
* @nd_config: configuration for the scan to be used for net detect wake.
*/
struct cfg80211_wowlan {
bool any, disconnect, magic_pkt, gtk_rekey_failure,
eap_identity_req, four_way_handshake,
rfkill_release;
struct cfg80211_pkt_pattern *patterns;
struct cfg80211_wowlan_tcp *tcp;
int n_patterns;
struct cfg80211_sched_scan_request *nd_config;
};
/**
* struct cfg80211_coalesce_rules - Coalesce rule parameters
*
* This structure defines coalesce rule for the device.
* @delay: maximum coalescing delay in msecs.
* @condition: condition for packet coalescence.
* see &enum nl80211_coalesce_condition.
* @patterns: array of packet patterns
* @n_patterns: number of patterns
*/
struct cfg80211_coalesce_rules {
int delay;
enum nl80211_coalesce_condition condition;
struct cfg80211_pkt_pattern *patterns;
int n_patterns;
};
/**
* struct cfg80211_coalesce - Packet coalescing settings
*
* This structure defines coalescing settings.
* @rules: array of coalesce rules
* @n_rules: number of rules
*/
struct cfg80211_coalesce {
struct cfg80211_coalesce_rules *rules;
int n_rules;
};
/**
* struct cfg80211_wowlan_nd_match - information about the match
*
* @ssid: SSID of the match that triggered the wake up
* @n_channels: Number of channels where the match occurred. This
* value may be zero if the driver can't report the channels.
* @channels: center frequencies of the channels where a match
* occurred (in MHz)
*/
struct cfg80211_wowlan_nd_match {
struct cfg80211_ssid ssid;
int n_channels;
u32 channels[];
};
/**
* struct cfg80211_wowlan_nd_info - net detect wake up information
*
* @n_matches: Number of match information instances provided in
* @matches. This value may be zero if the driver can't provide
* match information.
* @matches: Array of pointers to matches containing information about
* the matches that triggered the wake up.
*/
struct cfg80211_wowlan_nd_info {
int n_matches;
struct cfg80211_wowlan_nd_match *matches[];
};
/**
* struct cfg80211_wowlan_wakeup - wakeup report
* @disconnect: woke up by getting disconnected
* @magic_pkt: woke up by receiving magic packet
* @gtk_rekey_failure: woke up by GTK rekey failure
* @eap_identity_req: woke up by EAP identity request packet
* @four_way_handshake: woke up by 4-way handshake
* @rfkill_release: woke up by rfkill being released
* @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
* @packet_present_len: copied wakeup packet data
* @packet_len: original wakeup packet length
* @packet: The packet causing the wakeup, if any.
* @packet_80211: For pattern match, magic packet and other data
* frame triggers an 802.3 frame should be reported, for
* disconnect due to deauth 802.11 frame. This indicates which
* it is.
* @tcp_match: TCP wakeup packet received
* @tcp_connlost: TCP connection lost or failed to establish
* @tcp_nomoretokens: TCP data ran out of tokens
* @net_detect: if not %NULL, woke up because of net detect
*/
struct cfg80211_wowlan_wakeup {
bool disconnect, magic_pkt, gtk_rekey_failure,
eap_identity_req, four_way_handshake,
rfkill_release, packet_80211,
tcp_match, tcp_connlost, tcp_nomoretokens;
s32 pattern_idx;
u32 packet_present_len, packet_len;
const void *packet;
struct cfg80211_wowlan_nd_info *net_detect;
};
/**
* struct cfg80211_gtk_rekey_data - rekey data
* @kek: key encryption key (@kek_len bytes)
* @kck: key confirmation key (@kck_len bytes)
* @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
* @kek_len: length of kek
* @kck_len length of kck
* @akm: akm (oui, id)
*/
struct cfg80211_gtk_rekey_data {
const u8 *kek, *kck, *replay_ctr;
u32 akm;
u8 kek_len, kck_len;
};
/**
* struct cfg80211_update_ft_ies_params - FT IE Information
*
* This structure provides information needed to update the fast transition IE
*
* @md: The Mobility Domain ID, 2 Octet value
* @ie: Fast Transition IEs
* @ie_len: Length of ft_ie in octets
*/
struct cfg80211_update_ft_ies_params {
u16 md;
const u8 *ie;
size_t ie_len;
};
/**
* struct cfg80211_mgmt_tx_params - mgmt tx parameters
*
* This structure provides information needed to transmit a mgmt frame
*
* @chan: channel to use
* @offchan: indicates wether off channel operation is required
* @wait: duration for ROC
* @buf: buffer to transmit
* @len: buffer length
* @no_cck: don't use cck rates for this frame
* @dont_wait_for_ack: tells the low level not to wait for an ack
* @n_csa_offsets: length of csa_offsets array
* @csa_offsets: array of all the csa offsets in the frame
*/
struct cfg80211_mgmt_tx_params {
struct ieee80211_channel *chan;
bool offchan;
unsigned int wait;
const u8 *buf;
size_t len;
bool no_cck;
bool dont_wait_for_ack;
int n_csa_offsets;
const u16 *csa_offsets;
};
/**
* struct cfg80211_dscp_exception - DSCP exception
*
* @dscp: DSCP value that does not adhere to the user priority range definition
* @up: user priority value to which the corresponding DSCP value belongs
*/
struct cfg80211_dscp_exception {
u8 dscp;
u8 up;
};
/**
* struct cfg80211_dscp_range - DSCP range definition for user priority
*
* @low: lowest DSCP value of this user priority range, inclusive
* @high: highest DSCP value of this user priority range, inclusive
*/
struct cfg80211_dscp_range {
u8 low;
u8 high;
};
/* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
#define IEEE80211_QOS_MAP_MAX_EX 21
#define IEEE80211_QOS_MAP_LEN_MIN 16
#define IEEE80211_QOS_MAP_LEN_MAX \
(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
/**
* struct cfg80211_qos_map - QoS Map Information
*
* This struct defines the Interworking QoS map setting for DSCP values
*
* @num_des: number of DSCP exceptions (0..21)
* @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
* the user priority DSCP range definition
* @up: DSCP range definition for a particular user priority
*/
struct cfg80211_qos_map {
u8 num_des;
struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
struct cfg80211_dscp_range up[8];
};
/**
* struct cfg80211_nan_conf - NAN configuration
*
* This struct defines NAN configuration parameters
*
* @master_pref: master preference (1 - 255)
* @bands: operating bands, a bitmap of &enum nl80211_band values.
* For instance, for NL80211_BAND_2GHZ, bit 0 would be set
* (i.e. BIT(NL80211_BAND_2GHZ)).
*/
struct cfg80211_nan_conf {
u8 master_pref;
u8 bands;
};
/**
* enum cfg80211_nan_conf_changes - indicates changed fields in NAN
* configuration
*
* @CFG80211_NAN_CONF_CHANGED_PREF: master preference
* @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
*/
enum cfg80211_nan_conf_changes {
CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
};
/**
* struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
*
* @filter: the content of the filter
* @len: the length of the filter
*/
struct cfg80211_nan_func_filter {
const u8 *filter;
u8 len;
};
/**
* struct cfg80211_nan_func - a NAN function
*
* @type: &enum nl80211_nan_function_type
* @service_id: the service ID of the function
* @publish_type: &nl80211_nan_publish_type
* @close_range: if true, the range should be limited. Threshold is
* implementation specific.
* @publish_bcast: if true, the solicited publish should be broadcasted
* @subscribe_active: if true, the subscribe is active
* @followup_id: the instance ID for follow up
* @followup_reqid: the requestor instance ID for follow up
* @followup_dest: MAC address of the recipient of the follow up
* @ttl: time to live counter in DW.
* @serv_spec_info: Service Specific Info
* @serv_spec_info_len: Service Specific Info length
* @srf_include: if true, SRF is inclusive
* @srf_bf: Bloom Filter
* @srf_bf_len: Bloom Filter length
* @srf_bf_idx: Bloom Filter index
* @srf_macs: SRF MAC addresses
* @srf_num_macs: number of MAC addresses in SRF
* @rx_filters: rx filters that are matched with corresponding peer's tx_filter
* @tx_filters: filters that should be transmitted in the SDF.
* @num_rx_filters: length of &rx_filters.
* @num_tx_filters: length of &tx_filters.
* @instance_id: driver allocated id of the function.
* @cookie: unique NAN function identifier.
*/
struct cfg80211_nan_func {
enum nl80211_nan_function_type type;
u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
u8 publish_type;
bool close_range;
bool publish_bcast;
bool subscribe_active;
u8 followup_id;
u8 followup_reqid;
struct mac_address followup_dest;
u32 ttl;
const u8 *serv_spec_info;
u8 serv_spec_info_len;
bool srf_include;
const u8 *srf_bf;
u8 srf_bf_len;
u8 srf_bf_idx;
struct mac_address *srf_macs;
int srf_num_macs;
struct cfg80211_nan_func_filter *rx_filters;
struct cfg80211_nan_func_filter *tx_filters;
u8 num_tx_filters;
u8 num_rx_filters;
u8 instance_id;
u64 cookie;
};
/**
* struct cfg80211_pmk_conf - PMK configuration
*
* @aa: authenticator address
* @pmk_len: PMK length in bytes.
* @pmk: the PMK material
* @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
* is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
* holds PMK-R0.
*/
struct cfg80211_pmk_conf {
const u8 *aa;
u8 pmk_len;
const u8 *pmk;
const u8 *pmk_r0_name;
};
/**
* struct cfg80211_external_auth_params - Trigger External authentication.
*
* Commonly used across the external auth request and event interfaces.
*
* @action: action type / trigger for external authentication. Only significant
* for the authentication request event interface (driver to user space).
* @bssid: BSSID of the peer with which the authentication has
* to happen. Used by both the authentication request event and
* authentication response command interface.
* @ssid: SSID of the AP. Used by both the authentication request event and
* authentication response command interface.
* @key_mgmt_suite: AKM suite of the respective authentication. Used by the
* authentication request event interface.
* @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
* use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
* the real status code for failures. Used only for the authentication
* response command interface (user space to driver).
* @pmkid: The identifier to refer a PMKSA.
*/
struct cfg80211_external_auth_params {
enum nl80211_external_auth_action action;
u8 bssid[ETH_ALEN] __aligned(2);
struct cfg80211_ssid ssid;
unsigned int key_mgmt_suite;
u16 status;
const u8 *pmkid;
};
/**
* struct cfg80211_ftm_responder_stats - FTM responder statistics
*
* @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
* indicate the relevant values in this struct for them
* @success_num: number of FTM sessions in which all frames were successfully
* answered
* @partial_num: number of FTM sessions in which part of frames were
* successfully answered
* @failed_num: number of failed FTM sessions
* @asap_num: number of ASAP FTM sessions
* @non_asap_num: number of non-ASAP FTM sessions
* @total_duration_ms: total sessions durations - gives an indication
* of how much time the responder was busy
* @unknown_triggers_num: number of unknown FTM triggers - triggers from
* initiators that didn't finish successfully the negotiation phase with
* the responder
* @reschedule_requests_num: number of FTM reschedule requests - initiator asks
* for a new scheduling although it already has scheduled FTM slot
* @out_of_window_triggers_num: total FTM triggers out of scheduled window
*/
struct cfg80211_ftm_responder_stats {
u32 filled;
u32 success_num;
u32 partial_num;
u32 failed_num;
u32 asap_num;
u32 non_asap_num;
u64 total_duration_ms;
u32 unknown_triggers_num;
u32 reschedule_requests_num;
u32 out_of_window_triggers_num;
};
/**
* struct cfg80211_pmsr_ftm_result - FTM result
* @failure_reason: if this measurement failed (PMSR status is
* %NL80211_PMSR_STATUS_FAILURE), this gives a more precise
* reason than just "failure"
* @burst_index: if reporting partial results, this is the index
* in [0 .. num_bursts-1] of the burst that's being reported
* @num_ftmr_attempts: number of FTM request frames transmitted
* @num_ftmr_successes: number of FTM request frames acked
* @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
* fill this to indicate in how many seconds a retry is deemed possible
* by the responder
* @num_bursts_exp: actual number of bursts exponent negotiated
* @burst_duration: actual burst duration negotiated
* @ftms_per_burst: actual FTMs per burst negotiated
* @lci_len: length of LCI information (if present)
* @civicloc_len: length of civic location information (if present)
* @lci: LCI data (may be %NULL)
* @civicloc: civic location data (may be %NULL)
* @rssi_avg: average RSSI over FTM action frames reported
* @rssi_spread: spread of the RSSI over FTM action frames reported
* @tx_rate: bitrate for transmitted FTM action frame response
* @rx_rate: bitrate of received FTM action frame
* @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
* @rtt_variance: variance of RTTs measured (note that standard deviation is
* the square root of the variance)
* @rtt_spread: spread of the RTTs measured
* @dist_avg: average of distances (mm) measured
* (must have either this or @rtt_avg)
* @dist_variance: variance of distances measured (see also @rtt_variance)
* @dist_spread: spread of distances measured (see also @rtt_spread)
* @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
* @num_ftmr_successes_valid: @num_ftmr_successes is valid
* @rssi_avg_valid: @rssi_avg is valid
* @rssi_spread_valid: @rssi_spread is valid
* @tx_rate_valid: @tx_rate is valid
* @rx_rate_valid: @rx_rate is valid
* @rtt_avg_valid: @rtt_avg is valid
* @rtt_variance_valid: @rtt_variance is valid
* @rtt_spread_valid: @rtt_spread is valid
* @dist_avg_valid: @dist_avg is valid
* @dist_variance_valid: @dist_variance is valid
* @dist_spread_valid: @dist_spread is valid
*/
struct cfg80211_pmsr_ftm_result {
const u8 *lci;
const u8 *civicloc;
unsigned int lci_len;
unsigned int civicloc_len;
enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
u32 num_ftmr_attempts, num_ftmr_successes;
s16 burst_index;
u8 busy_retry_time;
u8 num_bursts_exp;
u8 burst_duration;
u8 ftms_per_burst;
s32 rssi_avg;
s32 rssi_spread;
struct rate_info tx_rate, rx_rate;
s64 rtt_avg;
s64 rtt_variance;
s64 rtt_spread;
s64 dist_avg;
s64 dist_variance;
s64 dist_spread;
u16 num_ftmr_attempts_valid:1,
num_ftmr_successes_valid:1,
rssi_avg_valid:1,
rssi_spread_valid:1,
tx_rate_valid:1,
rx_rate_valid:1,
rtt_avg_valid:1,
rtt_variance_valid:1,
rtt_spread_valid:1,
dist_avg_valid:1,
dist_variance_valid:1,
dist_spread_valid:1;
};
/**
* struct cfg80211_pmsr_result - peer measurement result
* @addr: address of the peer
* @host_time: host time (use ktime_get_boottime() adjust to the time when the
* measurement was made)
* @ap_tsf: AP's TSF at measurement time
* @status: status of the measurement
* @final: if reporting partial results, mark this as the last one; if not
* reporting partial results always set this flag
* @ap_tsf_valid: indicates the @ap_tsf value is valid
* @type: type of the measurement reported, note that we only support reporting
* one type at a time, but you can report multiple results separately and
* they're all aggregated for userspace.
*/
struct cfg80211_pmsr_result {
u64 host_time, ap_tsf;
enum nl80211_peer_measurement_status status;
u8 addr[ETH_ALEN];
u8 final:1,
ap_tsf_valid:1;
enum nl80211_peer_measurement_type type;
union {
struct cfg80211_pmsr_ftm_result ftm;
};
};
/**
* struct cfg80211_pmsr_ftm_request_peer - FTM request data
* @requested: indicates FTM is requested
* @preamble: frame preamble to use
* @burst_period: burst period to use
* @asap: indicates to use ASAP mode
* @num_bursts_exp: number of bursts exponent
* @burst_duration: burst duration
* @ftms_per_burst: number of FTMs per burst
* @ftmr_retries: number of retries for FTM request
* @request_lci: request LCI information
* @request_civicloc: request civic location information
* @trigger_based: use trigger based ranging for the measurement
* If neither @trigger_based nor @non_trigger_based is set,
* EDCA based ranging will be used.
* @non_trigger_based: use non trigger based ranging for the measurement
* If neither @trigger_based nor @non_trigger_based is set,
* EDCA based ranging will be used.
* @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
* @trigger_based or @non_trigger_based is set.
* @bss_color: the bss color of the responder. Optional. Set to zero to
* indicate the driver should set the BSS color. Only valid if
* @non_trigger_based or @trigger_based is set.
*
* See also nl80211 for the respective attribute documentation.
*/
struct cfg80211_pmsr_ftm_request_peer {
enum nl80211_preamble preamble;
u16 burst_period;
u8 requested:1,
asap:1,
request_lci:1,
request_civicloc:1,
trigger_based:1,
non_trigger_based:1,
lmr_feedback:1;
u8 num_bursts_exp;
u8 burst_duration;
u8 ftms_per_burst;
u8 ftmr_retries;
u8 bss_color;
};
/**
* struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
* @addr: MAC address
* @chandef: channel to use
* @report_ap_tsf: report the associated AP's TSF
* @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
*/
struct cfg80211_pmsr_request_peer {
u8 addr[ETH_ALEN];
struct cfg80211_chan_def chandef;
u8 report_ap_tsf:1;
struct cfg80211_pmsr_ftm_request_peer ftm;
};
/**
* struct cfg80211_pmsr_request - peer measurement request
* @cookie: cookie, set by cfg80211
* @nl_portid: netlink portid - used by cfg80211
* @drv_data: driver data for this request, if required for aborting,
* not otherwise freed or anything by cfg80211
* @mac_addr: MAC address used for (randomised) request
* @mac_addr_mask: MAC address mask used for randomisation, bits that
* are 0 in the mask should be randomised, bits that are 1 should
* be taken from the @mac_addr
* @list: used by cfg80211 to hold on to the request
* @timeout: timeout (in milliseconds) for the whole operation, if
* zero it means there's no timeout
* @n_peers: number of peers to do measurements with
* @peers: per-peer measurement request data
*/
struct cfg80211_pmsr_request {
u64 cookie;
void *drv_data;
u32 n_peers;
u32 nl_portid;
u32 timeout;
u8 mac_addr[ETH_ALEN] __aligned(2);
u8 mac_addr_mask[ETH_ALEN] __aligned(2);
struct list_head list;
struct cfg80211_pmsr_request_peer peers[];
};
/**
* struct cfg80211_update_owe_info - OWE Information
*
* This structure provides information needed for the drivers to offload OWE
* (Opportunistic Wireless Encryption) processing to the user space.
*
* Commonly used across update_owe_info request and event interfaces.
*
* @peer: MAC address of the peer device for which the OWE processing
* has to be done.
* @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
* processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
* cannot give you the real status code for failures. Used only for
* OWE update request command interface (user space to driver).
* @ie: IEs obtained from the peer or constructed by the user space. These are
* the IEs of the remote peer in the event from the host driver and
* the constructed IEs by the user space in the request interface.
* @ie_len: Length of IEs in octets.
*/
struct cfg80211_update_owe_info {
u8 peer[ETH_ALEN] __aligned(2);
u16 status;
const u8 *ie;
size_t ie_len;
};
/**
* struct mgmt_frame_regs - management frame registrations data
* @global_stypes: bitmap of management frame subtypes registered
* for the entire device
* @interface_stypes: bitmap of management frame subtypes registered
* for the given interface
* @global_mcast_rx: mcast RX is needed globally for these subtypes
* @interface_mcast_stypes: mcast RX is needed on this interface
* for these subtypes
*/
struct mgmt_frame_regs {
u32 global_stypes, interface_stypes;
u32 global_mcast_stypes, interface_mcast_stypes;
};
/**
* struct cfg80211_ops - backend description for wireless configuration
*
* This struct is registered by fullmac card drivers and/or wireless stacks
* in order to handle configuration requests on their interfaces.
*
* All callbacks except where otherwise noted should return 0
* on success or a negative error code.
*
* All operations are invoked with the wiphy mutex held. The RTNL may be
* held in addition (due to wireless extensions) but this cannot be relied
* upon except in cases where documented below. Note that due to ordering,
* the RTNL also cannot be acquired in any handlers.
*
* @suspend: wiphy device needs to be suspended. The variable @wow will
* be %NULL or contain the enabled Wake-on-Wireless triggers that are
* configured for the device.
* @resume: wiphy device needs to be resumed
* @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
* to call device_set_wakeup_enable() to enable/disable wakeup from
* the device.
*
* @add_virtual_intf: create a new virtual interface with the given name,
* must set the struct wireless_dev's iftype. Beware: You must create
* the new netdev in the wiphy's network namespace! Returns the struct
* wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
* also set the address member in the wdev.
* This additionally holds the RTNL to be able to do netdev changes.
*
* @del_virtual_intf: remove the virtual interface
* This additionally holds the RTNL to be able to do netdev changes.
*
* @change_virtual_intf: change type/configuration of virtual interface,
* keep the struct wireless_dev's iftype updated.
* This additionally holds the RTNL to be able to do netdev changes.
*
* @add_key: add a key with the given parameters. @mac_addr will be %NULL
* when adding a group key.
*
* @get_key: get information about the key with the given parameters.
* @mac_addr will be %NULL when requesting information for a group
* key. All pointers given to the @callback function need not be valid
* after it returns. This function should return an error if it is
* not possible to retrieve the key, -ENOENT if it doesn't exist.
*
* @del_key: remove a key given the @mac_addr (%NULL for a group key)
* and @key_index, return -ENOENT if the key doesn't exist.
*
* @set_default_key: set the default key on an interface
*
* @set_default_mgmt_key: set the default management frame key on an interface
*
* @set_default_beacon_key: set the default Beacon frame key on an interface
*
* @set_rekey_data: give the data necessary for GTK rekeying to the driver
*
* @start_ap: Start acting in AP mode defined by the parameters.
* @change_beacon: Change the beacon parameters for an access point mode
* interface. This should reject the call when AP mode wasn't started.
* @stop_ap: Stop being an AP, including stopping beaconing.
*
* @add_station: Add a new station.
* @del_station: Remove a station
* @change_station: Modify a given station. Note that flags changes are not much
* validated in cfg80211, in particular the auth/assoc/authorized flags
* might come to the driver in invalid combinations -- make sure to check
* them, also against the existing state! Drivers must call
* cfg80211_check_station_change() to validate the information.
* @get_station: get station information for the station identified by @mac
* @dump_station: dump station callback -- resume dump at index @idx
*
* @add_mpath: add a fixed mesh path
* @del_mpath: delete a given mesh path
* @change_mpath: change a given mesh path
* @get_mpath: get a mesh path for the given parameters
* @dump_mpath: dump mesh path callback -- resume dump at index @idx
* @get_mpp: get a mesh proxy path for the given parameters
* @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
* @join_mesh: join the mesh network with the specified parameters
* (invoked with the wireless_dev mutex held)
* @leave_mesh: leave the current mesh network
* (invoked with the wireless_dev mutex held)
*
* @get_mesh_config: Get the current mesh configuration
*
* @update_mesh_config: Update mesh parameters on a running mesh.
* The mask is a bitfield which tells us which parameters to
* set, and which to leave alone.
*
* @change_bss: Modify parameters for a given BSS.
*
* @set_txq_params: Set TX queue parameters
*
* @libertas_set_mesh_channel: Only for backward compatibility for libertas,
* as it doesn't implement join_mesh and needs to set the channel to
* join the mesh instead.
*
* @set_monitor_channel: Set the monitor mode channel for the device. If other
* interfaces are active this callback should reject the configuration.
* If no interfaces are active or the device is down, the channel should
* be stored for when a monitor interface becomes active.
*
* @scan: Request to do a scan. If returning zero, the scan request is given
* the driver, and will be valid until passed to cfg80211_scan_done().
* For scan results, call cfg80211_inform_bss(); you can call this outside
* the scan/scan_done bracket too.
* @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
* indicate the status of the scan through cfg80211_scan_done().
*
* @auth: Request to authenticate with the specified peer
* (invoked with the wireless_dev mutex held)
* @assoc: Request to (re)associate with the specified peer
* (invoked with the wireless_dev mutex held)
* @deauth: Request to deauthenticate from the specified peer
* (invoked with the wireless_dev mutex held)
* @disassoc: Request to disassociate from the specified peer
* (invoked with the wireless_dev mutex held)
*
* @connect: Connect to the ESS with the specified parameters. When connected,
* call cfg80211_connect_result()/cfg80211_connect_bss() with status code
* %WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
* cfg80211_connect_result()/cfg80211_connect_bss() with the status code
* from the AP or cfg80211_connect_timeout() if no frame with status code
* was received.
* The driver is allowed to roam to other BSSes within the ESS when the
* other BSS matches the connect parameters. When such roaming is initiated
* by the driver, the driver is expected to verify that the target matches
* the configured security parameters and to use Reassociation Request
* frame instead of Association Request frame.
* The connect function can also be used to request the driver to perform a
* specific roam when connected to an ESS. In that case, the prev_bssid
* parameter is set to the BSSID of the currently associated BSS as an
* indication of requesting reassociation.
* In both the driver-initiated and new connect() call initiated roaming
* cases, the result of roaming is indicated with a call to
* cfg80211_roamed(). (invoked with the wireless_dev mutex held)
* @update_connect_params: Update the connect parameters while connected to a
* BSS. The updated parameters can be used by driver/firmware for
* subsequent BSS selection (roaming) decisions and to form the
* Authentication/(Re)Association Request frames. This call does not
* request an immediate disassociation or reassociation with the current