162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci#ifndef __NET_CFG80211_H
362306a36Sopenharmony_ci#define __NET_CFG80211_H
462306a36Sopenharmony_ci/*
562306a36Sopenharmony_ci * 802.11 device and configuration interface
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright 2006-2010	Johannes Berg <johannes@sipsolutions.net>
862306a36Sopenharmony_ci * Copyright 2013-2014 Intel Mobile Communications GmbH
962306a36Sopenharmony_ci * Copyright 2015-2017	Intel Deutschland GmbH
1062306a36Sopenharmony_ci * Copyright (C) 2018-2021, 2023 Intel Corporation
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/ethtool.h>
1462306a36Sopenharmony_ci#include <uapi/linux/rfkill.h>
1562306a36Sopenharmony_ci#include <linux/netdevice.h>
1662306a36Sopenharmony_ci#include <linux/debugfs.h>
1762306a36Sopenharmony_ci#include <linux/list.h>
1862306a36Sopenharmony_ci#include <linux/bug.h>
1962306a36Sopenharmony_ci#include <linux/netlink.h>
2062306a36Sopenharmony_ci#include <linux/skbuff.h>
2162306a36Sopenharmony_ci#include <linux/nl80211.h>
2262306a36Sopenharmony_ci#include <linux/if_ether.h>
2362306a36Sopenharmony_ci#include <linux/ieee80211.h>
2462306a36Sopenharmony_ci#include <linux/net.h>
2562306a36Sopenharmony_ci#include <linux/rfkill.h>
2662306a36Sopenharmony_ci#include <net/regulatory.h>
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/**
2962306a36Sopenharmony_ci * DOC: Introduction
3062306a36Sopenharmony_ci *
3162306a36Sopenharmony_ci * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges
3262306a36Sopenharmony_ci * userspace and drivers, and offers some utility functionality associated
3362306a36Sopenharmony_ci * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used
3462306a36Sopenharmony_ci * by all modern wireless drivers in Linux, so that they offer a consistent
3562306a36Sopenharmony_ci * API through nl80211. For backward compatibility, cfg80211 also offers
3662306a36Sopenharmony_ci * wireless extensions to userspace, but hides them from drivers completely.
3762306a36Sopenharmony_ci *
3862306a36Sopenharmony_ci * Additionally, cfg80211 contains code to help enforce regulatory spectrum
3962306a36Sopenharmony_ci * use restrictions.
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/**
4462306a36Sopenharmony_ci * DOC: Device registration
4562306a36Sopenharmony_ci *
4662306a36Sopenharmony_ci * In order for a driver to use cfg80211, it must register the hardware device
4762306a36Sopenharmony_ci * with cfg80211. This happens through a number of hardware capability structs
4862306a36Sopenharmony_ci * described below.
4962306a36Sopenharmony_ci *
5062306a36Sopenharmony_ci * The fundamental structure for each device is the 'wiphy', of which each
5162306a36Sopenharmony_ci * instance describes a physical wireless device connected to the system. Each
5262306a36Sopenharmony_ci * such wiphy can have zero, one, or many virtual interfaces associated with
5362306a36Sopenharmony_ci * it, which need to be identified as such by pointing the network interface's
5462306a36Sopenharmony_ci * @ieee80211_ptr pointer to a &struct wireless_dev which further describes
5562306a36Sopenharmony_ci * the wireless part of the interface, normally this struct is embedded in the
5662306a36Sopenharmony_ci * network interface's private data area. Drivers can optionally allow creating
5762306a36Sopenharmony_ci * or destroying virtual interfaces on the fly, but without at least one or the
5862306a36Sopenharmony_ci * ability to create some the wireless device isn't useful.
5962306a36Sopenharmony_ci *
6062306a36Sopenharmony_ci * Each wiphy structure contains device capability information, and also has
6162306a36Sopenharmony_ci * a pointer to the various operations the driver offers. The definitions and
6262306a36Sopenharmony_ci * structures here describe these capabilities in detail.
6362306a36Sopenharmony_ci */
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_cistruct wiphy;
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/*
6862306a36Sopenharmony_ci * wireless hardware capability structures
6962306a36Sopenharmony_ci */
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci/**
7262306a36Sopenharmony_ci * enum ieee80211_channel_flags - channel flags
7362306a36Sopenharmony_ci *
7462306a36Sopenharmony_ci * Channel flags set by the regulatory control code.
7562306a36Sopenharmony_ci *
7662306a36Sopenharmony_ci * @IEEE80211_CHAN_DISABLED: This channel is disabled.
7762306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_IR: do not initiate radiation, this includes
7862306a36Sopenharmony_ci *	sending probe requests or beaconing.
7962306a36Sopenharmony_ci * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
8062306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_HT40PLUS: extension channel above this channel
8162306a36Sopenharmony_ci *	is not permitted.
8262306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
8362306a36Sopenharmony_ci *	is not permitted.
8462306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_OFDM: OFDM is not allowed on this channel.
8562306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_80MHZ: If the driver supports 80 MHz on the band,
8662306a36Sopenharmony_ci *	this flag indicates that an 80 MHz channel cannot use this
8762306a36Sopenharmony_ci *	channel as the control or any of the secondary channels.
8862306a36Sopenharmony_ci *	This may be due to the driver or due to regulatory bandwidth
8962306a36Sopenharmony_ci *	restrictions.
9062306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_160MHZ: If the driver supports 160 MHz on the band,
9162306a36Sopenharmony_ci *	this flag indicates that an 160 MHz channel cannot use this
9262306a36Sopenharmony_ci *	channel as the control or any of the secondary channels.
9362306a36Sopenharmony_ci *	This may be due to the driver or due to regulatory bandwidth
9462306a36Sopenharmony_ci *	restrictions.
9562306a36Sopenharmony_ci * @IEEE80211_CHAN_INDOOR_ONLY: see %NL80211_FREQUENCY_ATTR_INDOOR_ONLY
9662306a36Sopenharmony_ci * @IEEE80211_CHAN_IR_CONCURRENT: see %NL80211_FREQUENCY_ATTR_IR_CONCURRENT
9762306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_20MHZ: 20 MHz bandwidth is not permitted
9862306a36Sopenharmony_ci *	on this channel.
9962306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted
10062306a36Sopenharmony_ci *	on this channel.
10162306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_HE: HE operation is not permitted on this channel.
10262306a36Sopenharmony_ci * @IEEE80211_CHAN_1MHZ: 1 MHz bandwidth is permitted
10362306a36Sopenharmony_ci *	on this channel.
10462306a36Sopenharmony_ci * @IEEE80211_CHAN_2MHZ: 2 MHz bandwidth is permitted
10562306a36Sopenharmony_ci *	on this channel.
10662306a36Sopenharmony_ci * @IEEE80211_CHAN_4MHZ: 4 MHz bandwidth is permitted
10762306a36Sopenharmony_ci *	on this channel.
10862306a36Sopenharmony_ci * @IEEE80211_CHAN_8MHZ: 8 MHz bandwidth is permitted
10962306a36Sopenharmony_ci *	on this channel.
11062306a36Sopenharmony_ci * @IEEE80211_CHAN_16MHZ: 16 MHz bandwidth is permitted
11162306a36Sopenharmony_ci *	on this channel.
11262306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_320MHZ: If the driver supports 320 MHz on the band,
11362306a36Sopenharmony_ci *	this flag indicates that a 320 MHz channel cannot use this
11462306a36Sopenharmony_ci *	channel as the control or any of the secondary channels.
11562306a36Sopenharmony_ci *	This may be due to the driver or due to regulatory bandwidth
11662306a36Sopenharmony_ci *	restrictions.
11762306a36Sopenharmony_ci * @IEEE80211_CHAN_NO_EHT: EHT operation is not permitted on this channel.
11862306a36Sopenharmony_ci */
11962306a36Sopenharmony_cienum ieee80211_channel_flags {
12062306a36Sopenharmony_ci	IEEE80211_CHAN_DISABLED		= 1<<0,
12162306a36Sopenharmony_ci	IEEE80211_CHAN_NO_IR		= 1<<1,
12262306a36Sopenharmony_ci	/* hole at 1<<2 */
12362306a36Sopenharmony_ci	IEEE80211_CHAN_RADAR		= 1<<3,
12462306a36Sopenharmony_ci	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
12562306a36Sopenharmony_ci	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
12662306a36Sopenharmony_ci	IEEE80211_CHAN_NO_OFDM		= 1<<6,
12762306a36Sopenharmony_ci	IEEE80211_CHAN_NO_80MHZ		= 1<<7,
12862306a36Sopenharmony_ci	IEEE80211_CHAN_NO_160MHZ	= 1<<8,
12962306a36Sopenharmony_ci	IEEE80211_CHAN_INDOOR_ONLY	= 1<<9,
13062306a36Sopenharmony_ci	IEEE80211_CHAN_IR_CONCURRENT	= 1<<10,
13162306a36Sopenharmony_ci	IEEE80211_CHAN_NO_20MHZ		= 1<<11,
13262306a36Sopenharmony_ci	IEEE80211_CHAN_NO_10MHZ		= 1<<12,
13362306a36Sopenharmony_ci	IEEE80211_CHAN_NO_HE		= 1<<13,
13462306a36Sopenharmony_ci	IEEE80211_CHAN_1MHZ		= 1<<14,
13562306a36Sopenharmony_ci	IEEE80211_CHAN_2MHZ		= 1<<15,
13662306a36Sopenharmony_ci	IEEE80211_CHAN_4MHZ		= 1<<16,
13762306a36Sopenharmony_ci	IEEE80211_CHAN_8MHZ		= 1<<17,
13862306a36Sopenharmony_ci	IEEE80211_CHAN_16MHZ		= 1<<18,
13962306a36Sopenharmony_ci	IEEE80211_CHAN_NO_320MHZ	= 1<<19,
14062306a36Sopenharmony_ci	IEEE80211_CHAN_NO_EHT		= 1<<20,
14162306a36Sopenharmony_ci};
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ci#define IEEE80211_CHAN_NO_HT40 \
14462306a36Sopenharmony_ci	(IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS)
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ci#define IEEE80211_DFS_MIN_CAC_TIME_MS		60000
14762306a36Sopenharmony_ci#define IEEE80211_DFS_MIN_NOP_TIME_MS		(30 * 60 * 1000)
14862306a36Sopenharmony_ci
14962306a36Sopenharmony_ci/**
15062306a36Sopenharmony_ci * struct ieee80211_channel - channel definition
15162306a36Sopenharmony_ci *
15262306a36Sopenharmony_ci * This structure describes a single channel for use
15362306a36Sopenharmony_ci * with cfg80211.
15462306a36Sopenharmony_ci *
15562306a36Sopenharmony_ci * @center_freq: center frequency in MHz
15662306a36Sopenharmony_ci * @freq_offset: offset from @center_freq, in KHz
15762306a36Sopenharmony_ci * @hw_value: hardware-specific value for the channel
15862306a36Sopenharmony_ci * @flags: channel flags from &enum ieee80211_channel_flags.
15962306a36Sopenharmony_ci * @orig_flags: channel flags at registration time, used by regulatory
16062306a36Sopenharmony_ci *	code to support devices with additional restrictions
16162306a36Sopenharmony_ci * @band: band this channel belongs to.
16262306a36Sopenharmony_ci * @max_antenna_gain: maximum antenna gain in dBi
16362306a36Sopenharmony_ci * @max_power: maximum transmission power (in dBm)
16462306a36Sopenharmony_ci * @max_reg_power: maximum regulatory transmission power (in dBm)
16562306a36Sopenharmony_ci * @beacon_found: helper to regulatory code to indicate when a beacon
16662306a36Sopenharmony_ci *	has been found on this channel. Use regulatory_hint_found_beacon()
16762306a36Sopenharmony_ci *	to enable this, this is useful only on 5 GHz band.
16862306a36Sopenharmony_ci * @orig_mag: internal use
16962306a36Sopenharmony_ci * @orig_mpwr: internal use
17062306a36Sopenharmony_ci * @dfs_state: current state of this channel. Only relevant if radar is required
17162306a36Sopenharmony_ci *	on this channel.
17262306a36Sopenharmony_ci * @dfs_state_entered: timestamp (jiffies) when the dfs state was entered.
17362306a36Sopenharmony_ci * @dfs_cac_ms: DFS CAC time in milliseconds, this is valid for DFS channels.
17462306a36Sopenharmony_ci */
17562306a36Sopenharmony_cistruct ieee80211_channel {
17662306a36Sopenharmony_ci	enum nl80211_band band;
17762306a36Sopenharmony_ci	u32 center_freq;
17862306a36Sopenharmony_ci	u16 freq_offset;
17962306a36Sopenharmony_ci	u16 hw_value;
18062306a36Sopenharmony_ci	u32 flags;
18162306a36Sopenharmony_ci	int max_antenna_gain;
18262306a36Sopenharmony_ci	int max_power;
18362306a36Sopenharmony_ci	int max_reg_power;
18462306a36Sopenharmony_ci	bool beacon_found;
18562306a36Sopenharmony_ci	u32 orig_flags;
18662306a36Sopenharmony_ci	int orig_mag, orig_mpwr;
18762306a36Sopenharmony_ci	enum nl80211_dfs_state dfs_state;
18862306a36Sopenharmony_ci	unsigned long dfs_state_entered;
18962306a36Sopenharmony_ci	unsigned int dfs_cac_ms;
19062306a36Sopenharmony_ci};
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/**
19362306a36Sopenharmony_ci * enum ieee80211_rate_flags - rate flags
19462306a36Sopenharmony_ci *
19562306a36Sopenharmony_ci * Hardware/specification flags for rates. These are structured
19662306a36Sopenharmony_ci * in a way that allows using the same bitrate structure for
19762306a36Sopenharmony_ci * different bands/PHY modes.
19862306a36Sopenharmony_ci *
19962306a36Sopenharmony_ci * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
20062306a36Sopenharmony_ci *	preamble on this bitrate; only relevant in 2.4GHz band and
20162306a36Sopenharmony_ci *	with CCK rates.
20262306a36Sopenharmony_ci * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
20362306a36Sopenharmony_ci *	when used with 802.11a (on the 5 GHz band); filled by the
20462306a36Sopenharmony_ci *	core code when registering the wiphy.
20562306a36Sopenharmony_ci * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
20662306a36Sopenharmony_ci *	when used with 802.11b (on the 2.4 GHz band); filled by the
20762306a36Sopenharmony_ci *	core code when registering the wiphy.
20862306a36Sopenharmony_ci * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
20962306a36Sopenharmony_ci *	when used with 802.11g (on the 2.4 GHz band); filled by the
21062306a36Sopenharmony_ci *	core code when registering the wiphy.
21162306a36Sopenharmony_ci * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
21262306a36Sopenharmony_ci * @IEEE80211_RATE_SUPPORTS_5MHZ: Rate can be used in 5 MHz mode
21362306a36Sopenharmony_ci * @IEEE80211_RATE_SUPPORTS_10MHZ: Rate can be used in 10 MHz mode
21462306a36Sopenharmony_ci */
21562306a36Sopenharmony_cienum ieee80211_rate_flags {
21662306a36Sopenharmony_ci	IEEE80211_RATE_SHORT_PREAMBLE	= 1<<0,
21762306a36Sopenharmony_ci	IEEE80211_RATE_MANDATORY_A	= 1<<1,
21862306a36Sopenharmony_ci	IEEE80211_RATE_MANDATORY_B	= 1<<2,
21962306a36Sopenharmony_ci	IEEE80211_RATE_MANDATORY_G	= 1<<3,
22062306a36Sopenharmony_ci	IEEE80211_RATE_ERP_G		= 1<<4,
22162306a36Sopenharmony_ci	IEEE80211_RATE_SUPPORTS_5MHZ	= 1<<5,
22262306a36Sopenharmony_ci	IEEE80211_RATE_SUPPORTS_10MHZ	= 1<<6,
22362306a36Sopenharmony_ci};
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci/**
22662306a36Sopenharmony_ci * enum ieee80211_bss_type - BSS type filter
22762306a36Sopenharmony_ci *
22862306a36Sopenharmony_ci * @IEEE80211_BSS_TYPE_ESS: Infrastructure BSS
22962306a36Sopenharmony_ci * @IEEE80211_BSS_TYPE_PBSS: Personal BSS
23062306a36Sopenharmony_ci * @IEEE80211_BSS_TYPE_IBSS: Independent BSS
23162306a36Sopenharmony_ci * @IEEE80211_BSS_TYPE_MBSS: Mesh BSS
23262306a36Sopenharmony_ci * @IEEE80211_BSS_TYPE_ANY: Wildcard value for matching any BSS type
23362306a36Sopenharmony_ci */
23462306a36Sopenharmony_cienum ieee80211_bss_type {
23562306a36Sopenharmony_ci	IEEE80211_BSS_TYPE_ESS,
23662306a36Sopenharmony_ci	IEEE80211_BSS_TYPE_PBSS,
23762306a36Sopenharmony_ci	IEEE80211_BSS_TYPE_IBSS,
23862306a36Sopenharmony_ci	IEEE80211_BSS_TYPE_MBSS,
23962306a36Sopenharmony_ci	IEEE80211_BSS_TYPE_ANY
24062306a36Sopenharmony_ci};
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci/**
24362306a36Sopenharmony_ci * enum ieee80211_privacy - BSS privacy filter
24462306a36Sopenharmony_ci *
24562306a36Sopenharmony_ci * @IEEE80211_PRIVACY_ON: privacy bit set
24662306a36Sopenharmony_ci * @IEEE80211_PRIVACY_OFF: privacy bit clear
24762306a36Sopenharmony_ci * @IEEE80211_PRIVACY_ANY: Wildcard value for matching any privacy setting
24862306a36Sopenharmony_ci */
24962306a36Sopenharmony_cienum ieee80211_privacy {
25062306a36Sopenharmony_ci	IEEE80211_PRIVACY_ON,
25162306a36Sopenharmony_ci	IEEE80211_PRIVACY_OFF,
25262306a36Sopenharmony_ci	IEEE80211_PRIVACY_ANY
25362306a36Sopenharmony_ci};
25462306a36Sopenharmony_ci
25562306a36Sopenharmony_ci#define IEEE80211_PRIVACY(x)	\
25662306a36Sopenharmony_ci	((x) ? IEEE80211_PRIVACY_ON : IEEE80211_PRIVACY_OFF)
25762306a36Sopenharmony_ci
25862306a36Sopenharmony_ci/**
25962306a36Sopenharmony_ci * struct ieee80211_rate - bitrate definition
26062306a36Sopenharmony_ci *
26162306a36Sopenharmony_ci * This structure describes a bitrate that an 802.11 PHY can
26262306a36Sopenharmony_ci * operate with. The two values @hw_value and @hw_value_short
26362306a36Sopenharmony_ci * are only for driver use when pointers to this structure are
26462306a36Sopenharmony_ci * passed around.
26562306a36Sopenharmony_ci *
26662306a36Sopenharmony_ci * @flags: rate-specific flags from &enum ieee80211_rate_flags
26762306a36Sopenharmony_ci * @bitrate: bitrate in units of 100 Kbps
26862306a36Sopenharmony_ci * @hw_value: driver/hardware value for this rate
26962306a36Sopenharmony_ci * @hw_value_short: driver/hardware value for this rate when
27062306a36Sopenharmony_ci *	short preamble is used
27162306a36Sopenharmony_ci */
27262306a36Sopenharmony_cistruct ieee80211_rate {
27362306a36Sopenharmony_ci	u32 flags;
27462306a36Sopenharmony_ci	u16 bitrate;
27562306a36Sopenharmony_ci	u16 hw_value, hw_value_short;
27662306a36Sopenharmony_ci};
27762306a36Sopenharmony_ci
27862306a36Sopenharmony_ci/**
27962306a36Sopenharmony_ci * struct ieee80211_he_obss_pd - AP settings for spatial reuse
28062306a36Sopenharmony_ci *
28162306a36Sopenharmony_ci * @enable: is the feature enabled.
28262306a36Sopenharmony_ci * @sr_ctrl: The SR Control field of SRP element.
28362306a36Sopenharmony_ci * @non_srg_max_offset: non-SRG maximum tx power offset
28462306a36Sopenharmony_ci * @min_offset: minimal tx power offset an associated station shall use
28562306a36Sopenharmony_ci * @max_offset: maximum tx power offset an associated station shall use
28662306a36Sopenharmony_ci * @bss_color_bitmap: bitmap that indicates the BSS color values used by
28762306a36Sopenharmony_ci *	members of the SRG
28862306a36Sopenharmony_ci * @partial_bssid_bitmap: bitmap that indicates the partial BSSID values
28962306a36Sopenharmony_ci *	used by members of the SRG
29062306a36Sopenharmony_ci */
29162306a36Sopenharmony_cistruct ieee80211_he_obss_pd {
29262306a36Sopenharmony_ci	bool enable;
29362306a36Sopenharmony_ci	u8 sr_ctrl;
29462306a36Sopenharmony_ci	u8 non_srg_max_offset;
29562306a36Sopenharmony_ci	u8 min_offset;
29662306a36Sopenharmony_ci	u8 max_offset;
29762306a36Sopenharmony_ci	u8 bss_color_bitmap[8];
29862306a36Sopenharmony_ci	u8 partial_bssid_bitmap[8];
29962306a36Sopenharmony_ci};
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_ci/**
30262306a36Sopenharmony_ci * struct cfg80211_he_bss_color - AP settings for BSS coloring
30362306a36Sopenharmony_ci *
30462306a36Sopenharmony_ci * @color: the current color.
30562306a36Sopenharmony_ci * @enabled: HE BSS color is used
30662306a36Sopenharmony_ci * @partial: define the AID equation.
30762306a36Sopenharmony_ci */
30862306a36Sopenharmony_cistruct cfg80211_he_bss_color {
30962306a36Sopenharmony_ci	u8 color;
31062306a36Sopenharmony_ci	bool enabled;
31162306a36Sopenharmony_ci	bool partial;
31262306a36Sopenharmony_ci};
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci/**
31562306a36Sopenharmony_ci * struct ieee80211_sta_ht_cap - STA's HT capabilities
31662306a36Sopenharmony_ci *
31762306a36Sopenharmony_ci * This structure describes most essential parameters needed
31862306a36Sopenharmony_ci * to describe 802.11n HT capabilities for an STA.
31962306a36Sopenharmony_ci *
32062306a36Sopenharmony_ci * @ht_supported: is HT supported by the STA
32162306a36Sopenharmony_ci * @cap: HT capabilities map as described in 802.11n spec
32262306a36Sopenharmony_ci * @ampdu_factor: Maximum A-MPDU length factor
32362306a36Sopenharmony_ci * @ampdu_density: Minimum A-MPDU spacing
32462306a36Sopenharmony_ci * @mcs: Supported MCS rates
32562306a36Sopenharmony_ci */
32662306a36Sopenharmony_cistruct ieee80211_sta_ht_cap {
32762306a36Sopenharmony_ci	u16 cap; /* use IEEE80211_HT_CAP_ */
32862306a36Sopenharmony_ci	bool ht_supported;
32962306a36Sopenharmony_ci	u8 ampdu_factor;
33062306a36Sopenharmony_ci	u8 ampdu_density;
33162306a36Sopenharmony_ci	struct ieee80211_mcs_info mcs;
33262306a36Sopenharmony_ci};
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci/**
33562306a36Sopenharmony_ci * struct ieee80211_sta_vht_cap - STA's VHT capabilities
33662306a36Sopenharmony_ci *
33762306a36Sopenharmony_ci * This structure describes most essential parameters needed
33862306a36Sopenharmony_ci * to describe 802.11ac VHT capabilities for an STA.
33962306a36Sopenharmony_ci *
34062306a36Sopenharmony_ci * @vht_supported: is VHT supported by the STA
34162306a36Sopenharmony_ci * @cap: VHT capabilities map as described in 802.11ac spec
34262306a36Sopenharmony_ci * @vht_mcs: Supported VHT MCS rates
34362306a36Sopenharmony_ci */
34462306a36Sopenharmony_cistruct ieee80211_sta_vht_cap {
34562306a36Sopenharmony_ci	bool vht_supported;
34662306a36Sopenharmony_ci	u32 cap; /* use IEEE80211_VHT_CAP_ */
34762306a36Sopenharmony_ci	struct ieee80211_vht_mcs_info vht_mcs;
34862306a36Sopenharmony_ci};
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ci#define IEEE80211_HE_PPE_THRES_MAX_LEN		25
35162306a36Sopenharmony_ci
35262306a36Sopenharmony_ci/**
35362306a36Sopenharmony_ci * struct ieee80211_sta_he_cap - STA's HE capabilities
35462306a36Sopenharmony_ci *
35562306a36Sopenharmony_ci * This structure describes most essential parameters needed
35662306a36Sopenharmony_ci * to describe 802.11ax HE capabilities for a STA.
35762306a36Sopenharmony_ci *
35862306a36Sopenharmony_ci * @has_he: true iff HE data is valid.
35962306a36Sopenharmony_ci * @he_cap_elem: Fixed portion of the HE capabilities element.
36062306a36Sopenharmony_ci * @he_mcs_nss_supp: The supported NSS/MCS combinations.
36162306a36Sopenharmony_ci * @ppe_thres: Holds the PPE Thresholds data.
36262306a36Sopenharmony_ci */
36362306a36Sopenharmony_cistruct ieee80211_sta_he_cap {
36462306a36Sopenharmony_ci	bool has_he;
36562306a36Sopenharmony_ci	struct ieee80211_he_cap_elem he_cap_elem;
36662306a36Sopenharmony_ci	struct ieee80211_he_mcs_nss_supp he_mcs_nss_supp;
36762306a36Sopenharmony_ci	u8 ppe_thres[IEEE80211_HE_PPE_THRES_MAX_LEN];
36862306a36Sopenharmony_ci};
36962306a36Sopenharmony_ci
37062306a36Sopenharmony_ci/**
37162306a36Sopenharmony_ci * struct ieee80211_eht_mcs_nss_supp - EHT max supported NSS per MCS
37262306a36Sopenharmony_ci *
37362306a36Sopenharmony_ci * See P802.11be_D1.3 Table 9-401k - "Subfields of the Supported EHT-MCS
37462306a36Sopenharmony_ci * and NSS Set field"
37562306a36Sopenharmony_ci *
37662306a36Sopenharmony_ci * @only_20mhz: MCS/NSS support for 20 MHz-only STA.
37762306a36Sopenharmony_ci * @bw: MCS/NSS support for 80, 160 and 320 MHz
37862306a36Sopenharmony_ci * @bw._80: MCS/NSS support for BW <= 80 MHz
37962306a36Sopenharmony_ci * @bw._160: MCS/NSS support for BW = 160 MHz
38062306a36Sopenharmony_ci * @bw._320: MCS/NSS support for BW = 320 MHz
38162306a36Sopenharmony_ci */
38262306a36Sopenharmony_cistruct ieee80211_eht_mcs_nss_supp {
38362306a36Sopenharmony_ci	union {
38462306a36Sopenharmony_ci		struct ieee80211_eht_mcs_nss_supp_20mhz_only only_20mhz;
38562306a36Sopenharmony_ci		struct {
38662306a36Sopenharmony_ci			struct ieee80211_eht_mcs_nss_supp_bw _80;
38762306a36Sopenharmony_ci			struct ieee80211_eht_mcs_nss_supp_bw _160;
38862306a36Sopenharmony_ci			struct ieee80211_eht_mcs_nss_supp_bw _320;
38962306a36Sopenharmony_ci		} __packed bw;
39062306a36Sopenharmony_ci	} __packed;
39162306a36Sopenharmony_ci} __packed;
39262306a36Sopenharmony_ci
39362306a36Sopenharmony_ci#define IEEE80211_EHT_PPE_THRES_MAX_LEN		32
39462306a36Sopenharmony_ci
39562306a36Sopenharmony_ci/**
39662306a36Sopenharmony_ci * struct ieee80211_sta_eht_cap - STA's EHT capabilities
39762306a36Sopenharmony_ci *
39862306a36Sopenharmony_ci * This structure describes most essential parameters needed
39962306a36Sopenharmony_ci * to describe 802.11be EHT capabilities for a STA.
40062306a36Sopenharmony_ci *
40162306a36Sopenharmony_ci * @has_eht: true iff EHT data is valid.
40262306a36Sopenharmony_ci * @eht_cap_elem: Fixed portion of the eht capabilities element.
40362306a36Sopenharmony_ci * @eht_mcs_nss_supp: The supported NSS/MCS combinations.
40462306a36Sopenharmony_ci * @eht_ppe_thres: Holds the PPE Thresholds data.
40562306a36Sopenharmony_ci */
40662306a36Sopenharmony_cistruct ieee80211_sta_eht_cap {
40762306a36Sopenharmony_ci	bool has_eht;
40862306a36Sopenharmony_ci	struct ieee80211_eht_cap_elem_fixed eht_cap_elem;
40962306a36Sopenharmony_ci	struct ieee80211_eht_mcs_nss_supp eht_mcs_nss_supp;
41062306a36Sopenharmony_ci	u8 eht_ppe_thres[IEEE80211_EHT_PPE_THRES_MAX_LEN];
41162306a36Sopenharmony_ci};
41262306a36Sopenharmony_ci
41362306a36Sopenharmony_ci/**
41462306a36Sopenharmony_ci * struct ieee80211_sband_iftype_data - sband data per interface type
41562306a36Sopenharmony_ci *
41662306a36Sopenharmony_ci * This structure encapsulates sband data that is relevant for the
41762306a36Sopenharmony_ci * interface types defined in @types_mask.  Each type in the
41862306a36Sopenharmony_ci * @types_mask must be unique across all instances of iftype_data.
41962306a36Sopenharmony_ci *
42062306a36Sopenharmony_ci * @types_mask: interface types mask
42162306a36Sopenharmony_ci * @he_cap: holds the HE capabilities
42262306a36Sopenharmony_ci * @he_6ghz_capa: HE 6 GHz capabilities, must be filled in for a
42362306a36Sopenharmony_ci *	6 GHz band channel (and 0 may be valid value).
42462306a36Sopenharmony_ci * @eht_cap: STA's EHT capabilities
42562306a36Sopenharmony_ci * @vendor_elems: vendor element(s) to advertise
42662306a36Sopenharmony_ci * @vendor_elems.data: vendor element(s) data
42762306a36Sopenharmony_ci * @vendor_elems.len: vendor element(s) length
42862306a36Sopenharmony_ci */
42962306a36Sopenharmony_cistruct ieee80211_sband_iftype_data {
43062306a36Sopenharmony_ci	u16 types_mask;
43162306a36Sopenharmony_ci	struct ieee80211_sta_he_cap he_cap;
43262306a36Sopenharmony_ci	struct ieee80211_he_6ghz_capa he_6ghz_capa;
43362306a36Sopenharmony_ci	struct ieee80211_sta_eht_cap eht_cap;
43462306a36Sopenharmony_ci	struct {
43562306a36Sopenharmony_ci		const u8 *data;
43662306a36Sopenharmony_ci		unsigned int len;
43762306a36Sopenharmony_ci	} vendor_elems;
43862306a36Sopenharmony_ci};
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci/**
44162306a36Sopenharmony_ci * enum ieee80211_edmg_bw_config - allowed channel bandwidth configurations
44262306a36Sopenharmony_ci *
44362306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_4: 2.16GHz
44462306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_5: 2.16GHz and 4.32GHz
44562306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_6: 2.16GHz, 4.32GHz and 6.48GHz
44662306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_7: 2.16GHz, 4.32GHz, 6.48GHz and 8.64GHz
44762306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_8: 2.16GHz and 2.16GHz + 2.16GHz
44862306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_9: 2.16GHz, 4.32GHz and 2.16GHz + 2.16GHz
44962306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_10: 2.16GHz, 4.32GHz, 6.48GHz and 2.16GHz+2.16GHz
45062306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_11: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz and
45162306a36Sopenharmony_ci *	2.16GHz+2.16GHz
45262306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_12: 2.16GHz, 2.16GHz + 2.16GHz and
45362306a36Sopenharmony_ci *	4.32GHz + 4.32GHz
45462306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_13: 2.16GHz, 4.32GHz, 2.16GHz + 2.16GHz and
45562306a36Sopenharmony_ci *	4.32GHz + 4.32GHz
45662306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_14: 2.16GHz, 4.32GHz, 6.48GHz, 2.16GHz + 2.16GHz
45762306a36Sopenharmony_ci *	and 4.32GHz + 4.32GHz
45862306a36Sopenharmony_ci * @IEEE80211_EDMG_BW_CONFIG_15: 2.16GHz, 4.32GHz, 6.48GHz, 8.64GHz,
45962306a36Sopenharmony_ci *	2.16GHz + 2.16GHz and 4.32GHz + 4.32GHz
46062306a36Sopenharmony_ci */
46162306a36Sopenharmony_cienum ieee80211_edmg_bw_config {
46262306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_4	= 4,
46362306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_5	= 5,
46462306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_6	= 6,
46562306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_7	= 7,
46662306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_8	= 8,
46762306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_9	= 9,
46862306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_10	= 10,
46962306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_11	= 11,
47062306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_12	= 12,
47162306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_13	= 13,
47262306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_14	= 14,
47362306a36Sopenharmony_ci	IEEE80211_EDMG_BW_CONFIG_15	= 15,
47462306a36Sopenharmony_ci};
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci/**
47762306a36Sopenharmony_ci * struct ieee80211_edmg - EDMG configuration
47862306a36Sopenharmony_ci *
47962306a36Sopenharmony_ci * This structure describes most essential parameters needed
48062306a36Sopenharmony_ci * to describe 802.11ay EDMG configuration
48162306a36Sopenharmony_ci *
48262306a36Sopenharmony_ci * @channels: bitmap that indicates the 2.16 GHz channel(s)
48362306a36Sopenharmony_ci *	that are allowed to be used for transmissions.
48462306a36Sopenharmony_ci *	Bit 0 indicates channel 1, bit 1 indicates channel 2, etc.
48562306a36Sopenharmony_ci *	Set to 0 indicate EDMG not supported.
48662306a36Sopenharmony_ci * @bw_config: Channel BW Configuration subfield encodes
48762306a36Sopenharmony_ci *	the allowed channel bandwidth configurations
48862306a36Sopenharmony_ci */
48962306a36Sopenharmony_cistruct ieee80211_edmg {
49062306a36Sopenharmony_ci	u8 channels;
49162306a36Sopenharmony_ci	enum ieee80211_edmg_bw_config bw_config;
49262306a36Sopenharmony_ci};
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci/**
49562306a36Sopenharmony_ci * struct ieee80211_sta_s1g_cap - STA's S1G capabilities
49662306a36Sopenharmony_ci *
49762306a36Sopenharmony_ci * This structure describes most essential parameters needed
49862306a36Sopenharmony_ci * to describe 802.11ah S1G capabilities for a STA.
49962306a36Sopenharmony_ci *
50062306a36Sopenharmony_ci * @s1g: is STA an S1G STA
50162306a36Sopenharmony_ci * @cap: S1G capabilities information
50262306a36Sopenharmony_ci * @nss_mcs: Supported NSS MCS set
50362306a36Sopenharmony_ci */
50462306a36Sopenharmony_cistruct ieee80211_sta_s1g_cap {
50562306a36Sopenharmony_ci	bool s1g;
50662306a36Sopenharmony_ci	u8 cap[10]; /* use S1G_CAPAB_ */
50762306a36Sopenharmony_ci	u8 nss_mcs[5];
50862306a36Sopenharmony_ci};
50962306a36Sopenharmony_ci
51062306a36Sopenharmony_ci/**
51162306a36Sopenharmony_ci * struct ieee80211_supported_band - frequency band definition
51262306a36Sopenharmony_ci *
51362306a36Sopenharmony_ci * This structure describes a frequency band a wiphy
51462306a36Sopenharmony_ci * is able to operate in.
51562306a36Sopenharmony_ci *
51662306a36Sopenharmony_ci * @channels: Array of channels the hardware can operate with
51762306a36Sopenharmony_ci *	in this band.
51862306a36Sopenharmony_ci * @band: the band this structure represents
51962306a36Sopenharmony_ci * @n_channels: Number of channels in @channels
52062306a36Sopenharmony_ci * @bitrates: Array of bitrates the hardware can operate with
52162306a36Sopenharmony_ci *	in this band. Must be sorted to give a valid "supported
52262306a36Sopenharmony_ci *	rates" IE, i.e. CCK rates first, then OFDM.
52362306a36Sopenharmony_ci * @n_bitrates: Number of bitrates in @bitrates
52462306a36Sopenharmony_ci * @ht_cap: HT capabilities in this band
52562306a36Sopenharmony_ci * @vht_cap: VHT capabilities in this band
52662306a36Sopenharmony_ci * @s1g_cap: S1G capabilities in this band
52762306a36Sopenharmony_ci * @edmg_cap: EDMG capabilities in this band
52862306a36Sopenharmony_ci * @s1g_cap: S1G capabilities in this band (S1B band only, of course)
52962306a36Sopenharmony_ci * @n_iftype_data: number of iftype data entries
53062306a36Sopenharmony_ci * @iftype_data: interface type data entries.  Note that the bits in
53162306a36Sopenharmony_ci *	@types_mask inside this structure cannot overlap (i.e. only
53262306a36Sopenharmony_ci *	one occurrence of each type is allowed across all instances of
53362306a36Sopenharmony_ci *	iftype_data).
53462306a36Sopenharmony_ci */
53562306a36Sopenharmony_cistruct ieee80211_supported_band {
53662306a36Sopenharmony_ci	struct ieee80211_channel *channels;
53762306a36Sopenharmony_ci	struct ieee80211_rate *bitrates;
53862306a36Sopenharmony_ci	enum nl80211_band band;
53962306a36Sopenharmony_ci	int n_channels;
54062306a36Sopenharmony_ci	int n_bitrates;
54162306a36Sopenharmony_ci	struct ieee80211_sta_ht_cap ht_cap;
54262306a36Sopenharmony_ci	struct ieee80211_sta_vht_cap vht_cap;
54362306a36Sopenharmony_ci	struct ieee80211_sta_s1g_cap s1g_cap;
54462306a36Sopenharmony_ci	struct ieee80211_edmg edmg_cap;
54562306a36Sopenharmony_ci	u16 n_iftype_data;
54662306a36Sopenharmony_ci	const struct ieee80211_sband_iftype_data *iftype_data;
54762306a36Sopenharmony_ci};
54862306a36Sopenharmony_ci
54962306a36Sopenharmony_ci/**
55062306a36Sopenharmony_ci * ieee80211_get_sband_iftype_data - return sband data for a given iftype
55162306a36Sopenharmony_ci * @sband: the sband to search for the STA on
55262306a36Sopenharmony_ci * @iftype: enum nl80211_iftype
55362306a36Sopenharmony_ci *
55462306a36Sopenharmony_ci * Return: pointer to struct ieee80211_sband_iftype_data, or NULL is none found
55562306a36Sopenharmony_ci */
55662306a36Sopenharmony_cistatic inline const struct ieee80211_sband_iftype_data *
55762306a36Sopenharmony_ciieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
55862306a36Sopenharmony_ci				u8 iftype)
55962306a36Sopenharmony_ci{
56062306a36Sopenharmony_ci	int i;
56162306a36Sopenharmony_ci
56262306a36Sopenharmony_ci	if (WARN_ON(iftype >= NL80211_IFTYPE_MAX))
56362306a36Sopenharmony_ci		return NULL;
56462306a36Sopenharmony_ci
56562306a36Sopenharmony_ci	if (iftype == NL80211_IFTYPE_AP_VLAN)
56662306a36Sopenharmony_ci		iftype = NL80211_IFTYPE_AP;
56762306a36Sopenharmony_ci
56862306a36Sopenharmony_ci	for (i = 0; i < sband->n_iftype_data; i++)  {
56962306a36Sopenharmony_ci		const struct ieee80211_sband_iftype_data *data =
57062306a36Sopenharmony_ci			&sband->iftype_data[i];
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_ci		if (data->types_mask & BIT(iftype))
57362306a36Sopenharmony_ci			return data;
57462306a36Sopenharmony_ci	}
57562306a36Sopenharmony_ci
57662306a36Sopenharmony_ci	return NULL;
57762306a36Sopenharmony_ci}
57862306a36Sopenharmony_ci
57962306a36Sopenharmony_ci/**
58062306a36Sopenharmony_ci * ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
58162306a36Sopenharmony_ci * @sband: the sband to search for the iftype on
58262306a36Sopenharmony_ci * @iftype: enum nl80211_iftype
58362306a36Sopenharmony_ci *
58462306a36Sopenharmony_ci * Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
58562306a36Sopenharmony_ci */
58662306a36Sopenharmony_cistatic inline const struct ieee80211_sta_he_cap *
58762306a36Sopenharmony_ciieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
58862306a36Sopenharmony_ci			    u8 iftype)
58962306a36Sopenharmony_ci{
59062306a36Sopenharmony_ci	const struct ieee80211_sband_iftype_data *data =
59162306a36Sopenharmony_ci		ieee80211_get_sband_iftype_data(sband, iftype);
59262306a36Sopenharmony_ci
59362306a36Sopenharmony_ci	if (data && data->he_cap.has_he)
59462306a36Sopenharmony_ci		return &data->he_cap;
59562306a36Sopenharmony_ci
59662306a36Sopenharmony_ci	return NULL;
59762306a36Sopenharmony_ci}
59862306a36Sopenharmony_ci
59962306a36Sopenharmony_ci/**
60062306a36Sopenharmony_ci * ieee80211_get_he_6ghz_capa - return HE 6 GHz capabilities
60162306a36Sopenharmony_ci * @sband: the sband to search for the STA on
60262306a36Sopenharmony_ci * @iftype: the iftype to search for
60362306a36Sopenharmony_ci *
60462306a36Sopenharmony_ci * Return: the 6GHz capabilities
60562306a36Sopenharmony_ci */
60662306a36Sopenharmony_cistatic inline __le16
60762306a36Sopenharmony_ciieee80211_get_he_6ghz_capa(const struct ieee80211_supported_band *sband,
60862306a36Sopenharmony_ci			   enum nl80211_iftype iftype)
60962306a36Sopenharmony_ci{
61062306a36Sopenharmony_ci	const struct ieee80211_sband_iftype_data *data =
61162306a36Sopenharmony_ci		ieee80211_get_sband_iftype_data(sband, iftype);
61262306a36Sopenharmony_ci
61362306a36Sopenharmony_ci	if (WARN_ON(!data || !data->he_cap.has_he))
61462306a36Sopenharmony_ci		return 0;
61562306a36Sopenharmony_ci
61662306a36Sopenharmony_ci	return data->he_6ghz_capa.capa;
61762306a36Sopenharmony_ci}
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci/**
62062306a36Sopenharmony_ci * ieee80211_get_eht_iftype_cap - return ETH capabilities for an sband's iftype
62162306a36Sopenharmony_ci * @sband: the sband to search for the iftype on
62262306a36Sopenharmony_ci * @iftype: enum nl80211_iftype
62362306a36Sopenharmony_ci *
62462306a36Sopenharmony_ci * Return: pointer to the struct ieee80211_sta_eht_cap, or NULL is none found
62562306a36Sopenharmony_ci */
62662306a36Sopenharmony_cistatic inline const struct ieee80211_sta_eht_cap *
62762306a36Sopenharmony_ciieee80211_get_eht_iftype_cap(const struct ieee80211_supported_band *sband,
62862306a36Sopenharmony_ci			     enum nl80211_iftype iftype)
62962306a36Sopenharmony_ci{
63062306a36Sopenharmony_ci	const struct ieee80211_sband_iftype_data *data =
63162306a36Sopenharmony_ci		ieee80211_get_sband_iftype_data(sband, iftype);
63262306a36Sopenharmony_ci
63362306a36Sopenharmony_ci	if (data && data->eht_cap.has_eht)
63462306a36Sopenharmony_ci		return &data->eht_cap;
63562306a36Sopenharmony_ci
63662306a36Sopenharmony_ci	return NULL;
63762306a36Sopenharmony_ci}
63862306a36Sopenharmony_ci
63962306a36Sopenharmony_ci/**
64062306a36Sopenharmony_ci * wiphy_read_of_freq_limits - read frequency limits from device tree
64162306a36Sopenharmony_ci *
64262306a36Sopenharmony_ci * @wiphy: the wireless device to get extra limits for
64362306a36Sopenharmony_ci *
64462306a36Sopenharmony_ci * Some devices may have extra limitations specified in DT. This may be useful
64562306a36Sopenharmony_ci * for chipsets that normally support more bands but are limited due to board
64662306a36Sopenharmony_ci * design (e.g. by antennas or external power amplifier).
64762306a36Sopenharmony_ci *
64862306a36Sopenharmony_ci * This function reads info from DT and uses it to *modify* channels (disable
64962306a36Sopenharmony_ci * unavailable ones). It's usually a *bad* idea to use it in drivers with
65062306a36Sopenharmony_ci * shared channel data as DT limitations are device specific. You should make
65162306a36Sopenharmony_ci * sure to call it only if channels in wiphy are copied and can be modified
65262306a36Sopenharmony_ci * without affecting other devices.
65362306a36Sopenharmony_ci *
65462306a36Sopenharmony_ci * As this function access device node it has to be called after set_wiphy_dev.
65562306a36Sopenharmony_ci * It also modifies channels so they have to be set first.
65662306a36Sopenharmony_ci * If using this helper, call it before wiphy_register().
65762306a36Sopenharmony_ci */
65862306a36Sopenharmony_ci#ifdef CONFIG_OF
65962306a36Sopenharmony_civoid wiphy_read_of_freq_limits(struct wiphy *wiphy);
66062306a36Sopenharmony_ci#else /* CONFIG_OF */
66162306a36Sopenharmony_cistatic inline void wiphy_read_of_freq_limits(struct wiphy *wiphy)
66262306a36Sopenharmony_ci{
66362306a36Sopenharmony_ci}
66462306a36Sopenharmony_ci#endif /* !CONFIG_OF */
66562306a36Sopenharmony_ci
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ci/*
66862306a36Sopenharmony_ci * Wireless hardware/device configuration structures and methods
66962306a36Sopenharmony_ci */
67062306a36Sopenharmony_ci
67162306a36Sopenharmony_ci/**
67262306a36Sopenharmony_ci * DOC: Actions and configuration
67362306a36Sopenharmony_ci *
67462306a36Sopenharmony_ci * Each wireless device and each virtual interface offer a set of configuration
67562306a36Sopenharmony_ci * operations and other actions that are invoked by userspace. Each of these
67662306a36Sopenharmony_ci * actions is described in the operations structure, and the parameters these
67762306a36Sopenharmony_ci * operations use are described separately.
67862306a36Sopenharmony_ci *
67962306a36Sopenharmony_ci * Additionally, some operations are asynchronous and expect to get status
68062306a36Sopenharmony_ci * information via some functions that drivers need to call.
68162306a36Sopenharmony_ci *
68262306a36Sopenharmony_ci * Scanning and BSS list handling with its associated functionality is described
68362306a36Sopenharmony_ci * in a separate chapter.
68462306a36Sopenharmony_ci */
68562306a36Sopenharmony_ci
68662306a36Sopenharmony_ci#define VHT_MUMIMO_GROUPS_DATA_LEN (WLAN_MEMBERSHIP_LEN +\
68762306a36Sopenharmony_ci				    WLAN_USER_POSITION_LEN)
68862306a36Sopenharmony_ci
68962306a36Sopenharmony_ci/**
69062306a36Sopenharmony_ci * struct vif_params - describes virtual interface parameters
69162306a36Sopenharmony_ci * @flags: monitor interface flags, unchanged if 0, otherwise
69262306a36Sopenharmony_ci *	%MONITOR_FLAG_CHANGED will be set
69362306a36Sopenharmony_ci * @use_4addr: use 4-address frames
69462306a36Sopenharmony_ci * @macaddr: address to use for this virtual interface.
69562306a36Sopenharmony_ci *	If this parameter is set to zero address the driver may
69662306a36Sopenharmony_ci *	determine the address as needed.
69762306a36Sopenharmony_ci *	This feature is only fully supported by drivers that enable the
69862306a36Sopenharmony_ci *	%NL80211_FEATURE_MAC_ON_CREATE flag.  Others may support creating
69962306a36Sopenharmony_ci **	only p2p devices with specified MAC.
70062306a36Sopenharmony_ci * @vht_mumimo_groups: MU-MIMO groupID, used for monitoring MU-MIMO packets
70162306a36Sopenharmony_ci *	belonging to that MU-MIMO groupID; %NULL if not changed
70262306a36Sopenharmony_ci * @vht_mumimo_follow_addr: MU-MIMO follow address, used for monitoring
70362306a36Sopenharmony_ci *	MU-MIMO packets going to the specified station; %NULL if not changed
70462306a36Sopenharmony_ci */
70562306a36Sopenharmony_cistruct vif_params {
70662306a36Sopenharmony_ci	u32 flags;
70762306a36Sopenharmony_ci	int use_4addr;
70862306a36Sopenharmony_ci	u8 macaddr[ETH_ALEN];
70962306a36Sopenharmony_ci	const u8 *vht_mumimo_groups;
71062306a36Sopenharmony_ci	const u8 *vht_mumimo_follow_addr;
71162306a36Sopenharmony_ci};
71262306a36Sopenharmony_ci
71362306a36Sopenharmony_ci/**
71462306a36Sopenharmony_ci * struct key_params - key information
71562306a36Sopenharmony_ci *
71662306a36Sopenharmony_ci * Information about a key
71762306a36Sopenharmony_ci *
71862306a36Sopenharmony_ci * @key: key material
71962306a36Sopenharmony_ci * @key_len: length of key material
72062306a36Sopenharmony_ci * @cipher: cipher suite selector
72162306a36Sopenharmony_ci * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
72262306a36Sopenharmony_ci *	with the get_key() callback, must be in little endian,
72362306a36Sopenharmony_ci *	length given by @seq_len.
72462306a36Sopenharmony_ci * @seq_len: length of @seq.
72562306a36Sopenharmony_ci * @vlan_id: vlan_id for VLAN group key (if nonzero)
72662306a36Sopenharmony_ci * @mode: key install mode (RX_TX, NO_TX or SET_TX)
72762306a36Sopenharmony_ci */
72862306a36Sopenharmony_cistruct key_params {
72962306a36Sopenharmony_ci	const u8 *key;
73062306a36Sopenharmony_ci	const u8 *seq;
73162306a36Sopenharmony_ci	int key_len;
73262306a36Sopenharmony_ci	int seq_len;
73362306a36Sopenharmony_ci	u16 vlan_id;
73462306a36Sopenharmony_ci	u32 cipher;
73562306a36Sopenharmony_ci	enum nl80211_key_mode mode;
73662306a36Sopenharmony_ci};
73762306a36Sopenharmony_ci
73862306a36Sopenharmony_ci/**
73962306a36Sopenharmony_ci * struct cfg80211_chan_def - channel definition
74062306a36Sopenharmony_ci * @chan: the (control) channel
74162306a36Sopenharmony_ci * @width: channel width
74262306a36Sopenharmony_ci * @center_freq1: center frequency of first segment
74362306a36Sopenharmony_ci * @center_freq2: center frequency of second segment
74462306a36Sopenharmony_ci *	(only with 80+80 MHz)
74562306a36Sopenharmony_ci * @edmg: define the EDMG channels configuration.
74662306a36Sopenharmony_ci *	If edmg is requested (i.e. the .channels member is non-zero),
74762306a36Sopenharmony_ci *	chan will define the primary channel and all other
74862306a36Sopenharmony_ci *	parameters are ignored.
74962306a36Sopenharmony_ci * @freq1_offset: offset from @center_freq1, in KHz
75062306a36Sopenharmony_ci */
75162306a36Sopenharmony_cistruct cfg80211_chan_def {
75262306a36Sopenharmony_ci	struct ieee80211_channel *chan;
75362306a36Sopenharmony_ci	enum nl80211_chan_width width;
75462306a36Sopenharmony_ci	u32 center_freq1;
75562306a36Sopenharmony_ci	u32 center_freq2;
75662306a36Sopenharmony_ci	struct ieee80211_edmg edmg;
75762306a36Sopenharmony_ci	u16 freq1_offset;
75862306a36Sopenharmony_ci};
75962306a36Sopenharmony_ci
76062306a36Sopenharmony_ci/*
76162306a36Sopenharmony_ci * cfg80211_bitrate_mask - masks for bitrate control
76262306a36Sopenharmony_ci */
76362306a36Sopenharmony_cistruct cfg80211_bitrate_mask {
76462306a36Sopenharmony_ci	struct {
76562306a36Sopenharmony_ci		u32 legacy;
76662306a36Sopenharmony_ci		u8 ht_mcs[IEEE80211_HT_MCS_MASK_LEN];
76762306a36Sopenharmony_ci		u16 vht_mcs[NL80211_VHT_NSS_MAX];
76862306a36Sopenharmony_ci		u16 he_mcs[NL80211_HE_NSS_MAX];
76962306a36Sopenharmony_ci		enum nl80211_txrate_gi gi;
77062306a36Sopenharmony_ci		enum nl80211_he_gi he_gi;
77162306a36Sopenharmony_ci		enum nl80211_he_ltf he_ltf;
77262306a36Sopenharmony_ci	} control[NUM_NL80211_BANDS];
77362306a36Sopenharmony_ci};
77462306a36Sopenharmony_ci
77562306a36Sopenharmony_ci
77662306a36Sopenharmony_ci/**
77762306a36Sopenharmony_ci * struct cfg80211_tid_cfg - TID specific configuration
77862306a36Sopenharmony_ci * @config_override: Flag to notify driver to reset TID configuration
77962306a36Sopenharmony_ci *	of the peer.
78062306a36Sopenharmony_ci * @tids: bitmap of TIDs to modify
78162306a36Sopenharmony_ci * @mask: bitmap of attributes indicating which parameter changed,
78262306a36Sopenharmony_ci *	similar to &nl80211_tid_config_supp.
78362306a36Sopenharmony_ci * @noack: noack configuration value for the TID
78462306a36Sopenharmony_ci * @retry_long: retry count value
78562306a36Sopenharmony_ci * @retry_short: retry count value
78662306a36Sopenharmony_ci * @ampdu: Enable/Disable MPDU aggregation
78762306a36Sopenharmony_ci * @rtscts: Enable/Disable RTS/CTS
78862306a36Sopenharmony_ci * @amsdu: Enable/Disable MSDU aggregation
78962306a36Sopenharmony_ci * @txrate_type: Tx bitrate mask type
79062306a36Sopenharmony_ci * @txrate_mask: Tx bitrate to be applied for the TID
79162306a36Sopenharmony_ci */
79262306a36Sopenharmony_cistruct cfg80211_tid_cfg {
79362306a36Sopenharmony_ci	bool config_override;
79462306a36Sopenharmony_ci	u8 tids;
79562306a36Sopenharmony_ci	u64 mask;
79662306a36Sopenharmony_ci	enum nl80211_tid_config noack;
79762306a36Sopenharmony_ci	u8 retry_long, retry_short;
79862306a36Sopenharmony_ci	enum nl80211_tid_config ampdu;
79962306a36Sopenharmony_ci	enum nl80211_tid_config rtscts;
80062306a36Sopenharmony_ci	enum nl80211_tid_config amsdu;
80162306a36Sopenharmony_ci	enum nl80211_tx_rate_setting txrate_type;
80262306a36Sopenharmony_ci	struct cfg80211_bitrate_mask txrate_mask;
80362306a36Sopenharmony_ci};
80462306a36Sopenharmony_ci
80562306a36Sopenharmony_ci/**
80662306a36Sopenharmony_ci * struct cfg80211_tid_config - TID configuration
80762306a36Sopenharmony_ci * @peer: Station's MAC address
80862306a36Sopenharmony_ci * @n_tid_conf: Number of TID specific configurations to be applied
80962306a36Sopenharmony_ci * @tid_conf: Configuration change info
81062306a36Sopenharmony_ci */
81162306a36Sopenharmony_cistruct cfg80211_tid_config {
81262306a36Sopenharmony_ci	const u8 *peer;
81362306a36Sopenharmony_ci	u32 n_tid_conf;
81462306a36Sopenharmony_ci	struct cfg80211_tid_cfg tid_conf[] __counted_by(n_tid_conf);
81562306a36Sopenharmony_ci};
81662306a36Sopenharmony_ci
81762306a36Sopenharmony_ci/**
81862306a36Sopenharmony_ci * struct cfg80211_fils_aad - FILS AAD data
81962306a36Sopenharmony_ci * @macaddr: STA MAC address
82062306a36Sopenharmony_ci * @kek: FILS KEK
82162306a36Sopenharmony_ci * @kek_len: FILS KEK length
82262306a36Sopenharmony_ci * @snonce: STA Nonce
82362306a36Sopenharmony_ci * @anonce: AP Nonce
82462306a36Sopenharmony_ci */
82562306a36Sopenharmony_cistruct cfg80211_fils_aad {
82662306a36Sopenharmony_ci	const u8 *macaddr;
82762306a36Sopenharmony_ci	const u8 *kek;
82862306a36Sopenharmony_ci	u8 kek_len;
82962306a36Sopenharmony_ci	const u8 *snonce;
83062306a36Sopenharmony_ci	const u8 *anonce;
83162306a36Sopenharmony_ci};
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci/**
83462306a36Sopenharmony_ci * struct cfg80211_set_hw_timestamp - enable/disable HW timestamping
83562306a36Sopenharmony_ci * @macaddr: peer MAC address. NULL to enable/disable HW timestamping for all
83662306a36Sopenharmony_ci *	addresses.
83762306a36Sopenharmony_ci * @enable: if set, enable HW timestamping for the specified MAC address.
83862306a36Sopenharmony_ci *	Otherwise disable HW timestamping for the specified MAC address.
83962306a36Sopenharmony_ci */
84062306a36Sopenharmony_cistruct cfg80211_set_hw_timestamp {
84162306a36Sopenharmony_ci	const u8 *macaddr;
84262306a36Sopenharmony_ci	bool enable;
84362306a36Sopenharmony_ci};
84462306a36Sopenharmony_ci
84562306a36Sopenharmony_ci/**
84662306a36Sopenharmony_ci * cfg80211_get_chandef_type - return old channel type from chandef
84762306a36Sopenharmony_ci * @chandef: the channel definition
84862306a36Sopenharmony_ci *
84962306a36Sopenharmony_ci * Return: The old channel type (NOHT, HT20, HT40+/-) from a given
85062306a36Sopenharmony_ci * chandef, which must have a bandwidth allowing this conversion.
85162306a36Sopenharmony_ci */
85262306a36Sopenharmony_cistatic inline enum nl80211_channel_type
85362306a36Sopenharmony_cicfg80211_get_chandef_type(const struct cfg80211_chan_def *chandef)
85462306a36Sopenharmony_ci{
85562306a36Sopenharmony_ci	switch (chandef->width) {
85662306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_20_NOHT:
85762306a36Sopenharmony_ci		return NL80211_CHAN_NO_HT;
85862306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_20:
85962306a36Sopenharmony_ci		return NL80211_CHAN_HT20;
86062306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_40:
86162306a36Sopenharmony_ci		if (chandef->center_freq1 > chandef->chan->center_freq)
86262306a36Sopenharmony_ci			return NL80211_CHAN_HT40PLUS;
86362306a36Sopenharmony_ci		return NL80211_CHAN_HT40MINUS;
86462306a36Sopenharmony_ci	default:
86562306a36Sopenharmony_ci		WARN_ON(1);
86662306a36Sopenharmony_ci		return NL80211_CHAN_NO_HT;
86762306a36Sopenharmony_ci	}
86862306a36Sopenharmony_ci}
86962306a36Sopenharmony_ci
87062306a36Sopenharmony_ci/**
87162306a36Sopenharmony_ci * cfg80211_chandef_create - create channel definition using channel type
87262306a36Sopenharmony_ci * @chandef: the channel definition struct to fill
87362306a36Sopenharmony_ci * @channel: the control channel
87462306a36Sopenharmony_ci * @chantype: the channel type
87562306a36Sopenharmony_ci *
87662306a36Sopenharmony_ci * Given a channel type, create a channel definition.
87762306a36Sopenharmony_ci */
87862306a36Sopenharmony_civoid cfg80211_chandef_create(struct cfg80211_chan_def *chandef,
87962306a36Sopenharmony_ci			     struct ieee80211_channel *channel,
88062306a36Sopenharmony_ci			     enum nl80211_channel_type chantype);
88162306a36Sopenharmony_ci
88262306a36Sopenharmony_ci/**
88362306a36Sopenharmony_ci * cfg80211_chandef_identical - check if two channel definitions are identical
88462306a36Sopenharmony_ci * @chandef1: first channel definition
88562306a36Sopenharmony_ci * @chandef2: second channel definition
88662306a36Sopenharmony_ci *
88762306a36Sopenharmony_ci * Return: %true if the channels defined by the channel definitions are
88862306a36Sopenharmony_ci * identical, %false otherwise.
88962306a36Sopenharmony_ci */
89062306a36Sopenharmony_cistatic inline bool
89162306a36Sopenharmony_cicfg80211_chandef_identical(const struct cfg80211_chan_def *chandef1,
89262306a36Sopenharmony_ci			   const struct cfg80211_chan_def *chandef2)
89362306a36Sopenharmony_ci{
89462306a36Sopenharmony_ci	return (chandef1->chan == chandef2->chan &&
89562306a36Sopenharmony_ci		chandef1->width == chandef2->width &&
89662306a36Sopenharmony_ci		chandef1->center_freq1 == chandef2->center_freq1 &&
89762306a36Sopenharmony_ci		chandef1->freq1_offset == chandef2->freq1_offset &&
89862306a36Sopenharmony_ci		chandef1->center_freq2 == chandef2->center_freq2);
89962306a36Sopenharmony_ci}
90062306a36Sopenharmony_ci
90162306a36Sopenharmony_ci/**
90262306a36Sopenharmony_ci * cfg80211_chandef_is_edmg - check if chandef represents an EDMG channel
90362306a36Sopenharmony_ci *
90462306a36Sopenharmony_ci * @chandef: the channel definition
90562306a36Sopenharmony_ci *
90662306a36Sopenharmony_ci * Return: %true if EDMG defined, %false otherwise.
90762306a36Sopenharmony_ci */
90862306a36Sopenharmony_cistatic inline bool
90962306a36Sopenharmony_cicfg80211_chandef_is_edmg(const struct cfg80211_chan_def *chandef)
91062306a36Sopenharmony_ci{
91162306a36Sopenharmony_ci	return chandef->edmg.channels || chandef->edmg.bw_config;
91262306a36Sopenharmony_ci}
91362306a36Sopenharmony_ci
91462306a36Sopenharmony_ci/**
91562306a36Sopenharmony_ci * cfg80211_chandef_compatible - check if two channel definitions are compatible
91662306a36Sopenharmony_ci * @chandef1: first channel definition
91762306a36Sopenharmony_ci * @chandef2: second channel definition
91862306a36Sopenharmony_ci *
91962306a36Sopenharmony_ci * Return: %NULL if the given channel definitions are incompatible,
92062306a36Sopenharmony_ci * chandef1 or chandef2 otherwise.
92162306a36Sopenharmony_ci */
92262306a36Sopenharmony_ciconst struct cfg80211_chan_def *
92362306a36Sopenharmony_cicfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1,
92462306a36Sopenharmony_ci			    const struct cfg80211_chan_def *chandef2);
92562306a36Sopenharmony_ci
92662306a36Sopenharmony_ci/**
92762306a36Sopenharmony_ci * cfg80211_chandef_valid - check if a channel definition is valid
92862306a36Sopenharmony_ci * @chandef: the channel definition to check
92962306a36Sopenharmony_ci * Return: %true if the channel definition is valid. %false otherwise.
93062306a36Sopenharmony_ci */
93162306a36Sopenharmony_cibool cfg80211_chandef_valid(const struct cfg80211_chan_def *chandef);
93262306a36Sopenharmony_ci
93362306a36Sopenharmony_ci/**
93462306a36Sopenharmony_ci * cfg80211_chandef_usable - check if secondary channels can be used
93562306a36Sopenharmony_ci * @wiphy: the wiphy to validate against
93662306a36Sopenharmony_ci * @chandef: the channel definition to check
93762306a36Sopenharmony_ci * @prohibited_flags: the regulatory channel flags that must not be set
93862306a36Sopenharmony_ci * Return: %true if secondary channels are usable. %false otherwise.
93962306a36Sopenharmony_ci */
94062306a36Sopenharmony_cibool cfg80211_chandef_usable(struct wiphy *wiphy,
94162306a36Sopenharmony_ci			     const struct cfg80211_chan_def *chandef,
94262306a36Sopenharmony_ci			     u32 prohibited_flags);
94362306a36Sopenharmony_ci
94462306a36Sopenharmony_ci/**
94562306a36Sopenharmony_ci * cfg80211_chandef_dfs_required - checks if radar detection is required
94662306a36Sopenharmony_ci * @wiphy: the wiphy to validate against
94762306a36Sopenharmony_ci * @chandef: the channel definition to check
94862306a36Sopenharmony_ci * @iftype: the interface type as specified in &enum nl80211_iftype
94962306a36Sopenharmony_ci * Returns:
95062306a36Sopenharmony_ci *	1 if radar detection is required, 0 if it is not, < 0 on error
95162306a36Sopenharmony_ci */
95262306a36Sopenharmony_ciint cfg80211_chandef_dfs_required(struct wiphy *wiphy,
95362306a36Sopenharmony_ci				  const struct cfg80211_chan_def *chandef,
95462306a36Sopenharmony_ci				  enum nl80211_iftype iftype);
95562306a36Sopenharmony_ci
95662306a36Sopenharmony_ci/**
95762306a36Sopenharmony_ci * nl80211_send_chandef - sends the channel definition.
95862306a36Sopenharmony_ci * @msg: the msg to send channel definition
95962306a36Sopenharmony_ci * @chandef: the channel definition to check
96062306a36Sopenharmony_ci *
96162306a36Sopenharmony_ci * Returns: 0 if sent the channel definition to msg, < 0 on error
96262306a36Sopenharmony_ci **/
96362306a36Sopenharmony_ciint nl80211_send_chandef(struct sk_buff *msg, const struct cfg80211_chan_def *chandef);
96462306a36Sopenharmony_ci
96562306a36Sopenharmony_ci/**
96662306a36Sopenharmony_ci * ieee80211_chanwidth_rate_flags - return rate flags for channel width
96762306a36Sopenharmony_ci * @width: the channel width of the channel
96862306a36Sopenharmony_ci *
96962306a36Sopenharmony_ci * In some channel types, not all rates may be used - for example CCK
97062306a36Sopenharmony_ci * rates may not be used in 5/10 MHz channels.
97162306a36Sopenharmony_ci *
97262306a36Sopenharmony_ci * Returns: rate flags which apply for this channel width
97362306a36Sopenharmony_ci */
97462306a36Sopenharmony_cistatic inline enum ieee80211_rate_flags
97562306a36Sopenharmony_ciieee80211_chanwidth_rate_flags(enum nl80211_chan_width width)
97662306a36Sopenharmony_ci{
97762306a36Sopenharmony_ci	switch (width) {
97862306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_5:
97962306a36Sopenharmony_ci		return IEEE80211_RATE_SUPPORTS_5MHZ;
98062306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_10:
98162306a36Sopenharmony_ci		return IEEE80211_RATE_SUPPORTS_10MHZ;
98262306a36Sopenharmony_ci	default:
98362306a36Sopenharmony_ci		break;
98462306a36Sopenharmony_ci	}
98562306a36Sopenharmony_ci	return 0;
98662306a36Sopenharmony_ci}
98762306a36Sopenharmony_ci
98862306a36Sopenharmony_ci/**
98962306a36Sopenharmony_ci * ieee80211_chandef_rate_flags - returns rate flags for a channel
99062306a36Sopenharmony_ci * @chandef: channel definition for the channel
99162306a36Sopenharmony_ci *
99262306a36Sopenharmony_ci * See ieee80211_chanwidth_rate_flags().
99362306a36Sopenharmony_ci *
99462306a36Sopenharmony_ci * Returns: rate flags which apply for this channel
99562306a36Sopenharmony_ci */
99662306a36Sopenharmony_cistatic inline enum ieee80211_rate_flags
99762306a36Sopenharmony_ciieee80211_chandef_rate_flags(struct cfg80211_chan_def *chandef)
99862306a36Sopenharmony_ci{
99962306a36Sopenharmony_ci	return ieee80211_chanwidth_rate_flags(chandef->width);
100062306a36Sopenharmony_ci}
100162306a36Sopenharmony_ci
100262306a36Sopenharmony_ci/**
100362306a36Sopenharmony_ci * ieee80211_chandef_max_power - maximum transmission power for the chandef
100462306a36Sopenharmony_ci *
100562306a36Sopenharmony_ci * In some regulations, the transmit power may depend on the configured channel
100662306a36Sopenharmony_ci * bandwidth which may be defined as dBm/MHz. This function returns the actual
100762306a36Sopenharmony_ci * max_power for non-standard (20 MHz) channels.
100862306a36Sopenharmony_ci *
100962306a36Sopenharmony_ci * @chandef: channel definition for the channel
101062306a36Sopenharmony_ci *
101162306a36Sopenharmony_ci * Returns: maximum allowed transmission power in dBm for the chandef
101262306a36Sopenharmony_ci */
101362306a36Sopenharmony_cistatic inline int
101462306a36Sopenharmony_ciieee80211_chandef_max_power(struct cfg80211_chan_def *chandef)
101562306a36Sopenharmony_ci{
101662306a36Sopenharmony_ci	switch (chandef->width) {
101762306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_5:
101862306a36Sopenharmony_ci		return min(chandef->chan->max_reg_power - 6,
101962306a36Sopenharmony_ci			   chandef->chan->max_power);
102062306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_10:
102162306a36Sopenharmony_ci		return min(chandef->chan->max_reg_power - 3,
102262306a36Sopenharmony_ci			   chandef->chan->max_power);
102362306a36Sopenharmony_ci	default:
102462306a36Sopenharmony_ci		break;
102562306a36Sopenharmony_ci	}
102662306a36Sopenharmony_ci	return chandef->chan->max_power;
102762306a36Sopenharmony_ci}
102862306a36Sopenharmony_ci
102962306a36Sopenharmony_ci/**
103062306a36Sopenharmony_ci * cfg80211_any_usable_channels - check for usable channels
103162306a36Sopenharmony_ci * @wiphy: the wiphy to check for
103262306a36Sopenharmony_ci * @band_mask: which bands to check on
103362306a36Sopenharmony_ci * @prohibited_flags: which channels to not consider usable,
103462306a36Sopenharmony_ci *	%IEEE80211_CHAN_DISABLED is always taken into account
103562306a36Sopenharmony_ci */
103662306a36Sopenharmony_cibool cfg80211_any_usable_channels(struct wiphy *wiphy,
103762306a36Sopenharmony_ci				  unsigned long band_mask,
103862306a36Sopenharmony_ci				  u32 prohibited_flags);
103962306a36Sopenharmony_ci
104062306a36Sopenharmony_ci/**
104162306a36Sopenharmony_ci * enum survey_info_flags - survey information flags
104262306a36Sopenharmony_ci *
104362306a36Sopenharmony_ci * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in
104462306a36Sopenharmony_ci * @SURVEY_INFO_IN_USE: channel is currently being used
104562306a36Sopenharmony_ci * @SURVEY_INFO_TIME: active time (in ms) was filled in
104662306a36Sopenharmony_ci * @SURVEY_INFO_TIME_BUSY: busy time was filled in
104762306a36Sopenharmony_ci * @SURVEY_INFO_TIME_EXT_BUSY: extension channel busy time was filled in
104862306a36Sopenharmony_ci * @SURVEY_INFO_TIME_RX: receive time was filled in
104962306a36Sopenharmony_ci * @SURVEY_INFO_TIME_TX: transmit time was filled in
105062306a36Sopenharmony_ci * @SURVEY_INFO_TIME_SCAN: scan time was filled in
105162306a36Sopenharmony_ci * @SURVEY_INFO_TIME_BSS_RX: local BSS receive time was filled in
105262306a36Sopenharmony_ci *
105362306a36Sopenharmony_ci * Used by the driver to indicate which info in &struct survey_info
105462306a36Sopenharmony_ci * it has filled in during the get_survey().
105562306a36Sopenharmony_ci */
105662306a36Sopenharmony_cienum survey_info_flags {
105762306a36Sopenharmony_ci	SURVEY_INFO_NOISE_DBM		= BIT(0),
105862306a36Sopenharmony_ci	SURVEY_INFO_IN_USE		= BIT(1),
105962306a36Sopenharmony_ci	SURVEY_INFO_TIME		= BIT(2),
106062306a36Sopenharmony_ci	SURVEY_INFO_TIME_BUSY		= BIT(3),
106162306a36Sopenharmony_ci	SURVEY_INFO_TIME_EXT_BUSY	= BIT(4),
106262306a36Sopenharmony_ci	SURVEY_INFO_TIME_RX		= BIT(5),
106362306a36Sopenharmony_ci	SURVEY_INFO_TIME_TX		= BIT(6),
106462306a36Sopenharmony_ci	SURVEY_INFO_TIME_SCAN		= BIT(7),
106562306a36Sopenharmony_ci	SURVEY_INFO_TIME_BSS_RX		= BIT(8),
106662306a36Sopenharmony_ci};
106762306a36Sopenharmony_ci
106862306a36Sopenharmony_ci/**
106962306a36Sopenharmony_ci * struct survey_info - channel survey response
107062306a36Sopenharmony_ci *
107162306a36Sopenharmony_ci * @channel: the channel this survey record reports, may be %NULL for a single
107262306a36Sopenharmony_ci *	record to report global statistics
107362306a36Sopenharmony_ci * @filled: bitflag of flags from &enum survey_info_flags
107462306a36Sopenharmony_ci * @noise: channel noise in dBm. This and all following fields are
107562306a36Sopenharmony_ci *	optional
107662306a36Sopenharmony_ci * @time: amount of time in ms the radio was turn on (on the channel)
107762306a36Sopenharmony_ci * @time_busy: amount of time the primary channel was sensed busy
107862306a36Sopenharmony_ci * @time_ext_busy: amount of time the extension channel was sensed busy
107962306a36Sopenharmony_ci * @time_rx: amount of time the radio spent receiving data
108062306a36Sopenharmony_ci * @time_tx: amount of time the radio spent transmitting data
108162306a36Sopenharmony_ci * @time_scan: amount of time the radio spent for scanning
108262306a36Sopenharmony_ci * @time_bss_rx: amount of time the radio spent receiving data on a local BSS
108362306a36Sopenharmony_ci *
108462306a36Sopenharmony_ci * Used by dump_survey() to report back per-channel survey information.
108562306a36Sopenharmony_ci *
108662306a36Sopenharmony_ci * This structure can later be expanded with things like
108762306a36Sopenharmony_ci * channel duty cycle etc.
108862306a36Sopenharmony_ci */
108962306a36Sopenharmony_cistruct survey_info {
109062306a36Sopenharmony_ci	struct ieee80211_channel *channel;
109162306a36Sopenharmony_ci	u64 time;
109262306a36Sopenharmony_ci	u64 time_busy;
109362306a36Sopenharmony_ci	u64 time_ext_busy;
109462306a36Sopenharmony_ci	u64 time_rx;
109562306a36Sopenharmony_ci	u64 time_tx;
109662306a36Sopenharmony_ci	u64 time_scan;
109762306a36Sopenharmony_ci	u64 time_bss_rx;
109862306a36Sopenharmony_ci	u32 filled;
109962306a36Sopenharmony_ci	s8 noise;
110062306a36Sopenharmony_ci};
110162306a36Sopenharmony_ci
110262306a36Sopenharmony_ci#define CFG80211_MAX_NUM_AKM_SUITES	10
110362306a36Sopenharmony_ci
110462306a36Sopenharmony_ci/**
110562306a36Sopenharmony_ci * struct cfg80211_crypto_settings - Crypto settings
110662306a36Sopenharmony_ci * @wpa_versions: indicates which, if any, WPA versions are enabled
110762306a36Sopenharmony_ci *	(from enum nl80211_wpa_versions)
110862306a36Sopenharmony_ci * @cipher_group: group key cipher suite (or 0 if unset)
110962306a36Sopenharmony_ci * @n_ciphers_pairwise: number of AP supported unicast ciphers
111062306a36Sopenharmony_ci * @ciphers_pairwise: unicast key cipher suites
111162306a36Sopenharmony_ci * @n_akm_suites: number of AKM suites
111262306a36Sopenharmony_ci * @akm_suites: AKM suites
111362306a36Sopenharmony_ci * @control_port: Whether user space controls IEEE 802.1X port, i.e.,
111462306a36Sopenharmony_ci *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
111562306a36Sopenharmony_ci *	required to assume that the port is unauthorized until authorized by
111662306a36Sopenharmony_ci *	user space. Otherwise, port is marked authorized by default.
111762306a36Sopenharmony_ci * @control_port_ethertype: the control port protocol that should be
111862306a36Sopenharmony_ci *	allowed through even on unauthorized ports
111962306a36Sopenharmony_ci * @control_port_no_encrypt: TRUE to prevent encryption of control port
112062306a36Sopenharmony_ci *	protocol frames.
112162306a36Sopenharmony_ci * @control_port_over_nl80211: TRUE if userspace expects to exchange control
112262306a36Sopenharmony_ci *	port frames over NL80211 instead of the network interface.
112362306a36Sopenharmony_ci * @control_port_no_preauth: disables pre-auth rx over the nl80211 control
112462306a36Sopenharmony_ci *	port for mac80211
112562306a36Sopenharmony_ci * @psk: PSK (for devices supporting 4-way-handshake offload)
112662306a36Sopenharmony_ci * @sae_pwd: password for SAE authentication (for devices supporting SAE
112762306a36Sopenharmony_ci *	offload)
112862306a36Sopenharmony_ci * @sae_pwd_len: length of SAE password (for devices supporting SAE offload)
112962306a36Sopenharmony_ci * @sae_pwe: The mechanisms allowed for SAE PWE derivation:
113062306a36Sopenharmony_ci *
113162306a36Sopenharmony_ci *	NL80211_SAE_PWE_UNSPECIFIED
113262306a36Sopenharmony_ci *	  Not-specified, used to indicate userspace did not specify any
113362306a36Sopenharmony_ci *	  preference. The driver should follow its internal policy in
113462306a36Sopenharmony_ci *	  such a scenario.
113562306a36Sopenharmony_ci *
113662306a36Sopenharmony_ci *	NL80211_SAE_PWE_HUNT_AND_PECK
113762306a36Sopenharmony_ci *	  Allow hunting-and-pecking loop only
113862306a36Sopenharmony_ci *
113962306a36Sopenharmony_ci *	NL80211_SAE_PWE_HASH_TO_ELEMENT
114062306a36Sopenharmony_ci *	  Allow hash-to-element only
114162306a36Sopenharmony_ci *
114262306a36Sopenharmony_ci *	NL80211_SAE_PWE_BOTH
114362306a36Sopenharmony_ci *	  Allow either hunting-and-pecking loop or hash-to-element
114462306a36Sopenharmony_ci */
114562306a36Sopenharmony_cistruct cfg80211_crypto_settings {
114662306a36Sopenharmony_ci	u32 wpa_versions;
114762306a36Sopenharmony_ci	u32 cipher_group;
114862306a36Sopenharmony_ci	int n_ciphers_pairwise;
114962306a36Sopenharmony_ci	u32 ciphers_pairwise[NL80211_MAX_NR_CIPHER_SUITES];
115062306a36Sopenharmony_ci	int n_akm_suites;
115162306a36Sopenharmony_ci	u32 akm_suites[CFG80211_MAX_NUM_AKM_SUITES];
115262306a36Sopenharmony_ci	bool control_port;
115362306a36Sopenharmony_ci	__be16 control_port_ethertype;
115462306a36Sopenharmony_ci	bool control_port_no_encrypt;
115562306a36Sopenharmony_ci	bool control_port_over_nl80211;
115662306a36Sopenharmony_ci	bool control_port_no_preauth;
115762306a36Sopenharmony_ci	const u8 *psk;
115862306a36Sopenharmony_ci	const u8 *sae_pwd;
115962306a36Sopenharmony_ci	u8 sae_pwd_len;
116062306a36Sopenharmony_ci	enum nl80211_sae_pwe_mechanism sae_pwe;
116162306a36Sopenharmony_ci};
116262306a36Sopenharmony_ci
116362306a36Sopenharmony_ci/**
116462306a36Sopenharmony_ci * struct cfg80211_mbssid_config - AP settings for multi bssid
116562306a36Sopenharmony_ci *
116662306a36Sopenharmony_ci * @tx_wdev: pointer to the transmitted interface in the MBSSID set
116762306a36Sopenharmony_ci * @index: index of this AP in the multi bssid group.
116862306a36Sopenharmony_ci * @ema: set to true if the beacons should be sent out in EMA mode.
116962306a36Sopenharmony_ci */
117062306a36Sopenharmony_cistruct cfg80211_mbssid_config {
117162306a36Sopenharmony_ci	struct wireless_dev *tx_wdev;
117262306a36Sopenharmony_ci	u8 index;
117362306a36Sopenharmony_ci	bool ema;
117462306a36Sopenharmony_ci};
117562306a36Sopenharmony_ci
117662306a36Sopenharmony_ci/**
117762306a36Sopenharmony_ci * struct cfg80211_mbssid_elems - Multiple BSSID elements
117862306a36Sopenharmony_ci *
117962306a36Sopenharmony_ci * @cnt: Number of elements in array %elems.
118062306a36Sopenharmony_ci *
118162306a36Sopenharmony_ci * @elem: Array of multiple BSSID element(s) to be added into Beacon frames.
118262306a36Sopenharmony_ci * @elem.data: Data for multiple BSSID elements.
118362306a36Sopenharmony_ci * @elem.len: Length of data.
118462306a36Sopenharmony_ci */
118562306a36Sopenharmony_cistruct cfg80211_mbssid_elems {
118662306a36Sopenharmony_ci	u8 cnt;
118762306a36Sopenharmony_ci	struct {
118862306a36Sopenharmony_ci		const u8 *data;
118962306a36Sopenharmony_ci		size_t len;
119062306a36Sopenharmony_ci	} elem[] __counted_by(cnt);
119162306a36Sopenharmony_ci};
119262306a36Sopenharmony_ci
119362306a36Sopenharmony_ci/**
119462306a36Sopenharmony_ci * struct cfg80211_rnr_elems - Reduced neighbor report (RNR) elements
119562306a36Sopenharmony_ci *
119662306a36Sopenharmony_ci * @cnt: Number of elements in array %elems.
119762306a36Sopenharmony_ci *
119862306a36Sopenharmony_ci * @elem: Array of RNR element(s) to be added into Beacon frames.
119962306a36Sopenharmony_ci * @elem.data: Data for RNR elements.
120062306a36Sopenharmony_ci * @elem.len: Length of data.
120162306a36Sopenharmony_ci */
120262306a36Sopenharmony_cistruct cfg80211_rnr_elems {
120362306a36Sopenharmony_ci	u8 cnt;
120462306a36Sopenharmony_ci	struct {
120562306a36Sopenharmony_ci		const u8 *data;
120662306a36Sopenharmony_ci		size_t len;
120762306a36Sopenharmony_ci	} elem[] __counted_by(cnt);
120862306a36Sopenharmony_ci};
120962306a36Sopenharmony_ci
121062306a36Sopenharmony_ci/**
121162306a36Sopenharmony_ci * struct cfg80211_beacon_data - beacon data
121262306a36Sopenharmony_ci * @link_id: the link ID for the AP MLD link sending this beacon
121362306a36Sopenharmony_ci * @head: head portion of beacon (before TIM IE)
121462306a36Sopenharmony_ci *	or %NULL if not changed
121562306a36Sopenharmony_ci * @tail: tail portion of beacon (after TIM IE)
121662306a36Sopenharmony_ci *	or %NULL if not changed
121762306a36Sopenharmony_ci * @head_len: length of @head
121862306a36Sopenharmony_ci * @tail_len: length of @tail
121962306a36Sopenharmony_ci * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL
122062306a36Sopenharmony_ci * @beacon_ies_len: length of beacon_ies in octets
122162306a36Sopenharmony_ci * @proberesp_ies: extra information element(s) to add into Probe Response
122262306a36Sopenharmony_ci *	frames or %NULL
122362306a36Sopenharmony_ci * @proberesp_ies_len: length of proberesp_ies in octets
122462306a36Sopenharmony_ci * @assocresp_ies: extra information element(s) to add into (Re)Association
122562306a36Sopenharmony_ci *	Response frames or %NULL
122662306a36Sopenharmony_ci * @assocresp_ies_len: length of assocresp_ies in octets
122762306a36Sopenharmony_ci * @probe_resp_len: length of probe response template (@probe_resp)
122862306a36Sopenharmony_ci * @probe_resp: probe response template (AP mode only)
122962306a36Sopenharmony_ci * @mbssid_ies: multiple BSSID elements
123062306a36Sopenharmony_ci * @rnr_ies: reduced neighbor report elements
123162306a36Sopenharmony_ci * @ftm_responder: enable FTM responder functionality; -1 for no change
123262306a36Sopenharmony_ci *	(which also implies no change in LCI/civic location data)
123362306a36Sopenharmony_ci * @lci: Measurement Report element content, starting with Measurement Token
123462306a36Sopenharmony_ci *	(measurement type 8)
123562306a36Sopenharmony_ci * @civicloc: Measurement Report element content, starting with Measurement
123662306a36Sopenharmony_ci *	Token (measurement type 11)
123762306a36Sopenharmony_ci * @lci_len: LCI data length
123862306a36Sopenharmony_ci * @civicloc_len: Civic location data length
123962306a36Sopenharmony_ci * @he_bss_color: BSS Color settings
124062306a36Sopenharmony_ci * @he_bss_color_valid: indicates whether bss color
124162306a36Sopenharmony_ci *	attribute is present in beacon data or not.
124262306a36Sopenharmony_ci */
124362306a36Sopenharmony_cistruct cfg80211_beacon_data {
124462306a36Sopenharmony_ci	unsigned int link_id;
124562306a36Sopenharmony_ci
124662306a36Sopenharmony_ci	const u8 *head, *tail;
124762306a36Sopenharmony_ci	const u8 *beacon_ies;
124862306a36Sopenharmony_ci	const u8 *proberesp_ies;
124962306a36Sopenharmony_ci	const u8 *assocresp_ies;
125062306a36Sopenharmony_ci	const u8 *probe_resp;
125162306a36Sopenharmony_ci	const u8 *lci;
125262306a36Sopenharmony_ci	const u8 *civicloc;
125362306a36Sopenharmony_ci	struct cfg80211_mbssid_elems *mbssid_ies;
125462306a36Sopenharmony_ci	struct cfg80211_rnr_elems *rnr_ies;
125562306a36Sopenharmony_ci	s8 ftm_responder;
125662306a36Sopenharmony_ci
125762306a36Sopenharmony_ci	size_t head_len, tail_len;
125862306a36Sopenharmony_ci	size_t beacon_ies_len;
125962306a36Sopenharmony_ci	size_t proberesp_ies_len;
126062306a36Sopenharmony_ci	size_t assocresp_ies_len;
126162306a36Sopenharmony_ci	size_t probe_resp_len;
126262306a36Sopenharmony_ci	size_t lci_len;
126362306a36Sopenharmony_ci	size_t civicloc_len;
126462306a36Sopenharmony_ci	struct cfg80211_he_bss_color he_bss_color;
126562306a36Sopenharmony_ci	bool he_bss_color_valid;
126662306a36Sopenharmony_ci};
126762306a36Sopenharmony_ci
126862306a36Sopenharmony_cistruct mac_address {
126962306a36Sopenharmony_ci	u8 addr[ETH_ALEN];
127062306a36Sopenharmony_ci};
127162306a36Sopenharmony_ci
127262306a36Sopenharmony_ci/**
127362306a36Sopenharmony_ci * struct cfg80211_acl_data - Access control list data
127462306a36Sopenharmony_ci *
127562306a36Sopenharmony_ci * @acl_policy: ACL policy to be applied on the station's
127662306a36Sopenharmony_ci *	entry specified by mac_addr
127762306a36Sopenharmony_ci * @n_acl_entries: Number of MAC address entries passed
127862306a36Sopenharmony_ci * @mac_addrs: List of MAC addresses of stations to be used for ACL
127962306a36Sopenharmony_ci */
128062306a36Sopenharmony_cistruct cfg80211_acl_data {
128162306a36Sopenharmony_ci	enum nl80211_acl_policy acl_policy;
128262306a36Sopenharmony_ci	int n_acl_entries;
128362306a36Sopenharmony_ci
128462306a36Sopenharmony_ci	/* Keep it last */
128562306a36Sopenharmony_ci	struct mac_address mac_addrs[] __counted_by(n_acl_entries);
128662306a36Sopenharmony_ci};
128762306a36Sopenharmony_ci
128862306a36Sopenharmony_ci/**
128962306a36Sopenharmony_ci * struct cfg80211_fils_discovery - FILS discovery parameters from
129062306a36Sopenharmony_ci * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
129162306a36Sopenharmony_ci *
129262306a36Sopenharmony_ci * @min_interval: Minimum packet interval in TUs (0 - 10000)
129362306a36Sopenharmony_ci * @max_interval: Maximum packet interval in TUs (0 - 10000)
129462306a36Sopenharmony_ci * @tmpl_len: Template length
129562306a36Sopenharmony_ci * @tmpl: Template data for FILS discovery frame including the action
129662306a36Sopenharmony_ci *	frame headers.
129762306a36Sopenharmony_ci */
129862306a36Sopenharmony_cistruct cfg80211_fils_discovery {
129962306a36Sopenharmony_ci	u32 min_interval;
130062306a36Sopenharmony_ci	u32 max_interval;
130162306a36Sopenharmony_ci	size_t tmpl_len;
130262306a36Sopenharmony_ci	const u8 *tmpl;
130362306a36Sopenharmony_ci};
130462306a36Sopenharmony_ci
130562306a36Sopenharmony_ci/**
130662306a36Sopenharmony_ci * struct cfg80211_unsol_bcast_probe_resp - Unsolicited broadcast probe
130762306a36Sopenharmony_ci *	response parameters in 6GHz.
130862306a36Sopenharmony_ci *
130962306a36Sopenharmony_ci * @interval: Packet interval in TUs. Maximum allowed is 20 TU, as mentioned
131062306a36Sopenharmony_ci *	in IEEE P802.11ax/D6.0 26.17.2.3.2 - AP behavior for fast passive
131162306a36Sopenharmony_ci *	scanning
131262306a36Sopenharmony_ci * @tmpl_len: Template length
131362306a36Sopenharmony_ci * @tmpl: Template data for probe response
131462306a36Sopenharmony_ci */
131562306a36Sopenharmony_cistruct cfg80211_unsol_bcast_probe_resp {
131662306a36Sopenharmony_ci	u32 interval;
131762306a36Sopenharmony_ci	size_t tmpl_len;
131862306a36Sopenharmony_ci	const u8 *tmpl;
131962306a36Sopenharmony_ci};
132062306a36Sopenharmony_ci
132162306a36Sopenharmony_ci/**
132262306a36Sopenharmony_ci * struct cfg80211_ap_settings - AP configuration
132362306a36Sopenharmony_ci *
132462306a36Sopenharmony_ci * Used to configure an AP interface.
132562306a36Sopenharmony_ci *
132662306a36Sopenharmony_ci * @chandef: defines the channel to use
132762306a36Sopenharmony_ci * @beacon: beacon data
132862306a36Sopenharmony_ci * @beacon_interval: beacon interval
132962306a36Sopenharmony_ci * @dtim_period: DTIM period
133062306a36Sopenharmony_ci * @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from
133162306a36Sopenharmony_ci *	user space)
133262306a36Sopenharmony_ci * @ssid_len: length of @ssid
133362306a36Sopenharmony_ci * @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames
133462306a36Sopenharmony_ci * @crypto: crypto settings
133562306a36Sopenharmony_ci * @privacy: the BSS uses privacy
133662306a36Sopenharmony_ci * @auth_type: Authentication type (algorithm)
133762306a36Sopenharmony_ci * @smps_mode: SMPS mode
133862306a36Sopenharmony_ci * @inactivity_timeout: time in seconds to determine station's inactivity.
133962306a36Sopenharmony_ci * @p2p_ctwindow: P2P CT Window
134062306a36Sopenharmony_ci * @p2p_opp_ps: P2P opportunistic PS
134162306a36Sopenharmony_ci * @acl: ACL configuration used by the drivers which has support for
134262306a36Sopenharmony_ci *	MAC address based access control
134362306a36Sopenharmony_ci * @pbss: If set, start as a PCP instead of AP. Relevant for DMG
134462306a36Sopenharmony_ci *	networks.
134562306a36Sopenharmony_ci * @beacon_rate: bitrate to be used for beacons
134662306a36Sopenharmony_ci * @ht_cap: HT capabilities (or %NULL if HT isn't enabled)
134762306a36Sopenharmony_ci * @vht_cap: VHT capabilities (or %NULL if VHT isn't enabled)
134862306a36Sopenharmony_ci * @he_cap: HE capabilities (or %NULL if HE isn't enabled)
134962306a36Sopenharmony_ci * @eht_cap: EHT capabilities (or %NULL if EHT isn't enabled)
135062306a36Sopenharmony_ci * @eht_oper: EHT operation IE (or %NULL if EHT isn't enabled)
135162306a36Sopenharmony_ci * @ht_required: stations must support HT
135262306a36Sopenharmony_ci * @vht_required: stations must support VHT
135362306a36Sopenharmony_ci * @twt_responder: Enable Target Wait Time
135462306a36Sopenharmony_ci * @he_required: stations must support HE
135562306a36Sopenharmony_ci * @sae_h2e_required: stations must support direct H2E technique in SAE
135662306a36Sopenharmony_ci * @flags: flags, as defined in &enum nl80211_ap_settings_flags
135762306a36Sopenharmony_ci * @he_obss_pd: OBSS Packet Detection settings
135862306a36Sopenharmony_ci * @he_oper: HE operation IE (or %NULL if HE isn't enabled)
135962306a36Sopenharmony_ci * @fils_discovery: FILS discovery transmission parameters
136062306a36Sopenharmony_ci * @unsol_bcast_probe_resp: Unsolicited broadcast probe response parameters
136162306a36Sopenharmony_ci * @mbssid_config: AP settings for multiple bssid
136262306a36Sopenharmony_ci * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
136362306a36Sopenharmony_ci *	a 20 MHz channel, lowest bit corresponding to the lowest channel.
136462306a36Sopenharmony_ci *	Bit set to 1 indicates that the channel is punctured.
136562306a36Sopenharmony_ci */
136662306a36Sopenharmony_cistruct cfg80211_ap_settings {
136762306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
136862306a36Sopenharmony_ci
136962306a36Sopenharmony_ci	struct cfg80211_beacon_data beacon;
137062306a36Sopenharmony_ci
137162306a36Sopenharmony_ci	int beacon_interval, dtim_period;
137262306a36Sopenharmony_ci	const u8 *ssid;
137362306a36Sopenharmony_ci	size_t ssid_len;
137462306a36Sopenharmony_ci	enum nl80211_hidden_ssid hidden_ssid;
137562306a36Sopenharmony_ci	struct cfg80211_crypto_settings crypto;
137662306a36Sopenharmony_ci	bool privacy;
137762306a36Sopenharmony_ci	enum nl80211_auth_type auth_type;
137862306a36Sopenharmony_ci	enum nl80211_smps_mode smps_mode;
137962306a36Sopenharmony_ci	int inactivity_timeout;
138062306a36Sopenharmony_ci	u8 p2p_ctwindow;
138162306a36Sopenharmony_ci	bool p2p_opp_ps;
138262306a36Sopenharmony_ci	const struct cfg80211_acl_data *acl;
138362306a36Sopenharmony_ci	bool pbss;
138462306a36Sopenharmony_ci	struct cfg80211_bitrate_mask beacon_rate;
138562306a36Sopenharmony_ci
138662306a36Sopenharmony_ci	const struct ieee80211_ht_cap *ht_cap;
138762306a36Sopenharmony_ci	const struct ieee80211_vht_cap *vht_cap;
138862306a36Sopenharmony_ci	const struct ieee80211_he_cap_elem *he_cap;
138962306a36Sopenharmony_ci	const struct ieee80211_he_operation *he_oper;
139062306a36Sopenharmony_ci	const struct ieee80211_eht_cap_elem *eht_cap;
139162306a36Sopenharmony_ci	const struct ieee80211_eht_operation *eht_oper;
139262306a36Sopenharmony_ci	bool ht_required, vht_required, he_required, sae_h2e_required;
139362306a36Sopenharmony_ci	bool twt_responder;
139462306a36Sopenharmony_ci	u32 flags;
139562306a36Sopenharmony_ci	struct ieee80211_he_obss_pd he_obss_pd;
139662306a36Sopenharmony_ci	struct cfg80211_fils_discovery fils_discovery;
139762306a36Sopenharmony_ci	struct cfg80211_unsol_bcast_probe_resp unsol_bcast_probe_resp;
139862306a36Sopenharmony_ci	struct cfg80211_mbssid_config mbssid_config;
139962306a36Sopenharmony_ci	u16 punct_bitmap;
140062306a36Sopenharmony_ci};
140162306a36Sopenharmony_ci
140262306a36Sopenharmony_ci/**
140362306a36Sopenharmony_ci * struct cfg80211_csa_settings - channel switch settings
140462306a36Sopenharmony_ci *
140562306a36Sopenharmony_ci * Used for channel switch
140662306a36Sopenharmony_ci *
140762306a36Sopenharmony_ci * @chandef: defines the channel to use after the switch
140862306a36Sopenharmony_ci * @beacon_csa: beacon data while performing the switch
140962306a36Sopenharmony_ci * @counter_offsets_beacon: offsets of the counters within the beacon (tail)
141062306a36Sopenharmony_ci * @counter_offsets_presp: offsets of the counters within the probe response
141162306a36Sopenharmony_ci * @n_counter_offsets_beacon: number of csa counters the beacon (tail)
141262306a36Sopenharmony_ci * @n_counter_offsets_presp: number of csa counters in the probe response
141362306a36Sopenharmony_ci * @beacon_after: beacon data to be used on the new channel
141462306a36Sopenharmony_ci * @radar_required: whether radar detection is required on the new channel
141562306a36Sopenharmony_ci * @block_tx: whether transmissions should be blocked while changing
141662306a36Sopenharmony_ci * @count: number of beacons until switch
141762306a36Sopenharmony_ci * @punct_bitmap: Preamble puncturing bitmap. Each bit represents
141862306a36Sopenharmony_ci *	a 20 MHz channel, lowest bit corresponding to the lowest channel.
141962306a36Sopenharmony_ci *	Bit set to 1 indicates that the channel is punctured.
142062306a36Sopenharmony_ci */
142162306a36Sopenharmony_cistruct cfg80211_csa_settings {
142262306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
142362306a36Sopenharmony_ci	struct cfg80211_beacon_data beacon_csa;
142462306a36Sopenharmony_ci	const u16 *counter_offsets_beacon;
142562306a36Sopenharmony_ci	const u16 *counter_offsets_presp;
142662306a36Sopenharmony_ci	unsigned int n_counter_offsets_beacon;
142762306a36Sopenharmony_ci	unsigned int n_counter_offsets_presp;
142862306a36Sopenharmony_ci	struct cfg80211_beacon_data beacon_after;
142962306a36Sopenharmony_ci	bool radar_required;
143062306a36Sopenharmony_ci	bool block_tx;
143162306a36Sopenharmony_ci	u8 count;
143262306a36Sopenharmony_ci	u16 punct_bitmap;
143362306a36Sopenharmony_ci};
143462306a36Sopenharmony_ci
143562306a36Sopenharmony_ci/**
143662306a36Sopenharmony_ci * struct cfg80211_color_change_settings - color change settings
143762306a36Sopenharmony_ci *
143862306a36Sopenharmony_ci * Used for bss color change
143962306a36Sopenharmony_ci *
144062306a36Sopenharmony_ci * @beacon_color_change: beacon data while performing the color countdown
144162306a36Sopenharmony_ci * @counter_offset_beacon: offsets of the counters within the beacon (tail)
144262306a36Sopenharmony_ci * @counter_offset_presp: offsets of the counters within the probe response
144362306a36Sopenharmony_ci * @beacon_next: beacon data to be used after the color change
144462306a36Sopenharmony_ci * @count: number of beacons until the color change
144562306a36Sopenharmony_ci * @color: the color used after the change
144662306a36Sopenharmony_ci */
144762306a36Sopenharmony_cistruct cfg80211_color_change_settings {
144862306a36Sopenharmony_ci	struct cfg80211_beacon_data beacon_color_change;
144962306a36Sopenharmony_ci	u16 counter_offset_beacon;
145062306a36Sopenharmony_ci	u16 counter_offset_presp;
145162306a36Sopenharmony_ci	struct cfg80211_beacon_data beacon_next;
145262306a36Sopenharmony_ci	u8 count;
145362306a36Sopenharmony_ci	u8 color;
145462306a36Sopenharmony_ci};
145562306a36Sopenharmony_ci
145662306a36Sopenharmony_ci/**
145762306a36Sopenharmony_ci * struct iface_combination_params - input parameters for interface combinations
145862306a36Sopenharmony_ci *
145962306a36Sopenharmony_ci * Used to pass interface combination parameters
146062306a36Sopenharmony_ci *
146162306a36Sopenharmony_ci * @num_different_channels: the number of different channels we want
146262306a36Sopenharmony_ci *	to use for verification
146362306a36Sopenharmony_ci * @radar_detect: a bitmap where each bit corresponds to a channel
146462306a36Sopenharmony_ci *	width where radar detection is needed, as in the definition of
146562306a36Sopenharmony_ci *	&struct ieee80211_iface_combination.@radar_detect_widths
146662306a36Sopenharmony_ci * @iftype_num: array with the number of interfaces of each interface
146762306a36Sopenharmony_ci *	type.  The index is the interface type as specified in &enum
146862306a36Sopenharmony_ci *	nl80211_iftype.
146962306a36Sopenharmony_ci * @new_beacon_int: set this to the beacon interval of a new interface
147062306a36Sopenharmony_ci *	that's not operating yet, if such is to be checked as part of
147162306a36Sopenharmony_ci *	the verification
147262306a36Sopenharmony_ci */
147362306a36Sopenharmony_cistruct iface_combination_params {
147462306a36Sopenharmony_ci	int num_different_channels;
147562306a36Sopenharmony_ci	u8 radar_detect;
147662306a36Sopenharmony_ci	int iftype_num[NUM_NL80211_IFTYPES];
147762306a36Sopenharmony_ci	u32 new_beacon_int;
147862306a36Sopenharmony_ci};
147962306a36Sopenharmony_ci
148062306a36Sopenharmony_ci/**
148162306a36Sopenharmony_ci * enum station_parameters_apply_mask - station parameter values to apply
148262306a36Sopenharmony_ci * @STATION_PARAM_APPLY_UAPSD: apply new uAPSD parameters (uapsd_queues, max_sp)
148362306a36Sopenharmony_ci * @STATION_PARAM_APPLY_CAPABILITY: apply new capability
148462306a36Sopenharmony_ci * @STATION_PARAM_APPLY_PLINK_STATE: apply new plink state
148562306a36Sopenharmony_ci *
148662306a36Sopenharmony_ci * Not all station parameters have in-band "no change" signalling,
148762306a36Sopenharmony_ci * for those that don't these flags will are used.
148862306a36Sopenharmony_ci */
148962306a36Sopenharmony_cienum station_parameters_apply_mask {
149062306a36Sopenharmony_ci	STATION_PARAM_APPLY_UAPSD = BIT(0),
149162306a36Sopenharmony_ci	STATION_PARAM_APPLY_CAPABILITY = BIT(1),
149262306a36Sopenharmony_ci	STATION_PARAM_APPLY_PLINK_STATE = BIT(2),
149362306a36Sopenharmony_ci};
149462306a36Sopenharmony_ci
149562306a36Sopenharmony_ci/**
149662306a36Sopenharmony_ci * struct sta_txpwr - station txpower configuration
149762306a36Sopenharmony_ci *
149862306a36Sopenharmony_ci * Used to configure txpower for station.
149962306a36Sopenharmony_ci *
150062306a36Sopenharmony_ci * @power: tx power (in dBm) to be used for sending data traffic. If tx power
150162306a36Sopenharmony_ci *	is not provided, the default per-interface tx power setting will be
150262306a36Sopenharmony_ci *	overriding. Driver should be picking up the lowest tx power, either tx
150362306a36Sopenharmony_ci *	power per-interface or per-station.
150462306a36Sopenharmony_ci * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
150562306a36Sopenharmony_ci *	will be less than or equal to specified from userspace, whereas if TPC
150662306a36Sopenharmony_ci *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
150762306a36Sopenharmony_ci *	NL80211_TX_POWER_FIXED is not a valid configuration option for
150862306a36Sopenharmony_ci *	per peer TPC.
150962306a36Sopenharmony_ci */
151062306a36Sopenharmony_cistruct sta_txpwr {
151162306a36Sopenharmony_ci	s16 power;
151262306a36Sopenharmony_ci	enum nl80211_tx_power_setting type;
151362306a36Sopenharmony_ci};
151462306a36Sopenharmony_ci
151562306a36Sopenharmony_ci/**
151662306a36Sopenharmony_ci * struct link_station_parameters - link station parameters
151762306a36Sopenharmony_ci *
151862306a36Sopenharmony_ci * Used to change and create a new link station.
151962306a36Sopenharmony_ci *
152062306a36Sopenharmony_ci * @mld_mac: MAC address of the station
152162306a36Sopenharmony_ci * @link_id: the link id (-1 for non-MLD station)
152262306a36Sopenharmony_ci * @link_mac: MAC address of the link
152362306a36Sopenharmony_ci * @supported_rates: supported rates in IEEE 802.11 format
152462306a36Sopenharmony_ci *	(or NULL for no change)
152562306a36Sopenharmony_ci * @supported_rates_len: number of supported rates
152662306a36Sopenharmony_ci * @ht_capa: HT capabilities of station
152762306a36Sopenharmony_ci * @vht_capa: VHT capabilities of station
152862306a36Sopenharmony_ci * @opmode_notif: operating mode field from Operating Mode Notification
152962306a36Sopenharmony_ci * @opmode_notif_used: information if operating mode field is used
153062306a36Sopenharmony_ci * @he_capa: HE capabilities of station
153162306a36Sopenharmony_ci * @he_capa_len: the length of the HE capabilities
153262306a36Sopenharmony_ci * @txpwr: transmit power for an associated station
153362306a36Sopenharmony_ci * @txpwr_set: txpwr field is set
153462306a36Sopenharmony_ci * @he_6ghz_capa: HE 6 GHz Band capabilities of station
153562306a36Sopenharmony_ci * @eht_capa: EHT capabilities of station
153662306a36Sopenharmony_ci * @eht_capa_len: the length of the EHT capabilities
153762306a36Sopenharmony_ci */
153862306a36Sopenharmony_cistruct link_station_parameters {
153962306a36Sopenharmony_ci	const u8 *mld_mac;
154062306a36Sopenharmony_ci	int link_id;
154162306a36Sopenharmony_ci	const u8 *link_mac;
154262306a36Sopenharmony_ci	const u8 *supported_rates;
154362306a36Sopenharmony_ci	u8 supported_rates_len;
154462306a36Sopenharmony_ci	const struct ieee80211_ht_cap *ht_capa;
154562306a36Sopenharmony_ci	const struct ieee80211_vht_cap *vht_capa;
154662306a36Sopenharmony_ci	u8 opmode_notif;
154762306a36Sopenharmony_ci	bool opmode_notif_used;
154862306a36Sopenharmony_ci	const struct ieee80211_he_cap_elem *he_capa;
154962306a36Sopenharmony_ci	u8 he_capa_len;
155062306a36Sopenharmony_ci	struct sta_txpwr txpwr;
155162306a36Sopenharmony_ci	bool txpwr_set;
155262306a36Sopenharmony_ci	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
155362306a36Sopenharmony_ci	const struct ieee80211_eht_cap_elem *eht_capa;
155462306a36Sopenharmony_ci	u8 eht_capa_len;
155562306a36Sopenharmony_ci};
155662306a36Sopenharmony_ci
155762306a36Sopenharmony_ci/**
155862306a36Sopenharmony_ci * struct link_station_del_parameters - link station deletion parameters
155962306a36Sopenharmony_ci *
156062306a36Sopenharmony_ci * Used to delete a link station entry (or all stations).
156162306a36Sopenharmony_ci *
156262306a36Sopenharmony_ci * @mld_mac: MAC address of the station
156362306a36Sopenharmony_ci * @link_id: the link id
156462306a36Sopenharmony_ci */
156562306a36Sopenharmony_cistruct link_station_del_parameters {
156662306a36Sopenharmony_ci	const u8 *mld_mac;
156762306a36Sopenharmony_ci	u32 link_id;
156862306a36Sopenharmony_ci};
156962306a36Sopenharmony_ci
157062306a36Sopenharmony_ci/**
157162306a36Sopenharmony_ci * struct station_parameters - station parameters
157262306a36Sopenharmony_ci *
157362306a36Sopenharmony_ci * Used to change and create a new station.
157462306a36Sopenharmony_ci *
157562306a36Sopenharmony_ci * @vlan: vlan interface station should belong to
157662306a36Sopenharmony_ci * @sta_flags_mask: station flags that changed
157762306a36Sopenharmony_ci *	(bitmask of BIT(%NL80211_STA_FLAG_...))
157862306a36Sopenharmony_ci * @sta_flags_set: station flags values
157962306a36Sopenharmony_ci *	(bitmask of BIT(%NL80211_STA_FLAG_...))
158062306a36Sopenharmony_ci * @listen_interval: listen interval or -1 for no change
158162306a36Sopenharmony_ci * @aid: AID or zero for no change
158262306a36Sopenharmony_ci * @vlan_id: VLAN ID for station (if nonzero)
158362306a36Sopenharmony_ci * @peer_aid: mesh peer AID or zero for no change
158462306a36Sopenharmony_ci * @plink_action: plink action to take
158562306a36Sopenharmony_ci * @plink_state: set the peer link state for a station
158662306a36Sopenharmony_ci * @uapsd_queues: bitmap of queues configured for uapsd. same format
158762306a36Sopenharmony_ci *	as the AC bitmap in the QoS info field
158862306a36Sopenharmony_ci * @max_sp: max Service Period. same format as the MAX_SP in the
158962306a36Sopenharmony_ci *	QoS info field (but already shifted down)
159062306a36Sopenharmony_ci * @sta_modify_mask: bitmap indicating which parameters changed
159162306a36Sopenharmony_ci *	(for those that don't have a natural "no change" value),
159262306a36Sopenharmony_ci *	see &enum station_parameters_apply_mask
159362306a36Sopenharmony_ci * @local_pm: local link-specific mesh power save mode (no change when set
159462306a36Sopenharmony_ci *	to unknown)
159562306a36Sopenharmony_ci * @capability: station capability
159662306a36Sopenharmony_ci * @ext_capab: extended capabilities of the station
159762306a36Sopenharmony_ci * @ext_capab_len: number of extended capabilities
159862306a36Sopenharmony_ci * @supported_channels: supported channels in IEEE 802.11 format
159962306a36Sopenharmony_ci * @supported_channels_len: number of supported channels
160062306a36Sopenharmony_ci * @supported_oper_classes: supported oper classes in IEEE 802.11 format
160162306a36Sopenharmony_ci * @supported_oper_classes_len: number of supported operating classes
160262306a36Sopenharmony_ci * @support_p2p_ps: information if station supports P2P PS mechanism
160362306a36Sopenharmony_ci * @airtime_weight: airtime scheduler weight for this station
160462306a36Sopenharmony_ci * @link_sta_params: link related params.
160562306a36Sopenharmony_ci */
160662306a36Sopenharmony_cistruct station_parameters {
160762306a36Sopenharmony_ci	struct net_device *vlan;
160862306a36Sopenharmony_ci	u32 sta_flags_mask, sta_flags_set;
160962306a36Sopenharmony_ci	u32 sta_modify_mask;
161062306a36Sopenharmony_ci	int listen_interval;
161162306a36Sopenharmony_ci	u16 aid;
161262306a36Sopenharmony_ci	u16 vlan_id;
161362306a36Sopenharmony_ci	u16 peer_aid;
161462306a36Sopenharmony_ci	u8 plink_action;
161562306a36Sopenharmony_ci	u8 plink_state;
161662306a36Sopenharmony_ci	u8 uapsd_queues;
161762306a36Sopenharmony_ci	u8 max_sp;
161862306a36Sopenharmony_ci	enum nl80211_mesh_power_mode local_pm;
161962306a36Sopenharmony_ci	u16 capability;
162062306a36Sopenharmony_ci	const u8 *ext_capab;
162162306a36Sopenharmony_ci	u8 ext_capab_len;
162262306a36Sopenharmony_ci	const u8 *supported_channels;
162362306a36Sopenharmony_ci	u8 supported_channels_len;
162462306a36Sopenharmony_ci	const u8 *supported_oper_classes;
162562306a36Sopenharmony_ci	u8 supported_oper_classes_len;
162662306a36Sopenharmony_ci	int support_p2p_ps;
162762306a36Sopenharmony_ci	u16 airtime_weight;
162862306a36Sopenharmony_ci	struct link_station_parameters link_sta_params;
162962306a36Sopenharmony_ci};
163062306a36Sopenharmony_ci
163162306a36Sopenharmony_ci/**
163262306a36Sopenharmony_ci * struct station_del_parameters - station deletion parameters
163362306a36Sopenharmony_ci *
163462306a36Sopenharmony_ci * Used to delete a station entry (or all stations).
163562306a36Sopenharmony_ci *
163662306a36Sopenharmony_ci * @mac: MAC address of the station to remove or NULL to remove all stations
163762306a36Sopenharmony_ci * @subtype: Management frame subtype to use for indicating removal
163862306a36Sopenharmony_ci *	(10 = Disassociation, 12 = Deauthentication)
163962306a36Sopenharmony_ci * @reason_code: Reason code for the Disassociation/Deauthentication frame
164062306a36Sopenharmony_ci */
164162306a36Sopenharmony_cistruct station_del_parameters {
164262306a36Sopenharmony_ci	const u8 *mac;
164362306a36Sopenharmony_ci	u8 subtype;
164462306a36Sopenharmony_ci	u16 reason_code;
164562306a36Sopenharmony_ci};
164662306a36Sopenharmony_ci
164762306a36Sopenharmony_ci/**
164862306a36Sopenharmony_ci * enum cfg80211_station_type - the type of station being modified
164962306a36Sopenharmony_ci * @CFG80211_STA_AP_CLIENT: client of an AP interface
165062306a36Sopenharmony_ci * @CFG80211_STA_AP_CLIENT_UNASSOC: client of an AP interface that is still
165162306a36Sopenharmony_ci *	unassociated (update properties for this type of client is permitted)
165262306a36Sopenharmony_ci * @CFG80211_STA_AP_MLME_CLIENT: client of an AP interface that has
165362306a36Sopenharmony_ci *	the AP MLME in the device
165462306a36Sopenharmony_ci * @CFG80211_STA_AP_STA: AP station on managed interface
165562306a36Sopenharmony_ci * @CFG80211_STA_IBSS: IBSS station
165662306a36Sopenharmony_ci * @CFG80211_STA_TDLS_PEER_SETUP: TDLS peer on managed interface (dummy entry
165762306a36Sopenharmony_ci *	while TDLS setup is in progress, it moves out of this state when
165862306a36Sopenharmony_ci *	being marked authorized; use this only if TDLS with external setup is
165962306a36Sopenharmony_ci *	supported/used)
166062306a36Sopenharmony_ci * @CFG80211_STA_TDLS_PEER_ACTIVE: TDLS peer on managed interface (active
166162306a36Sopenharmony_ci *	entry that is operating, has been marked authorized by userspace)
166262306a36Sopenharmony_ci * @CFG80211_STA_MESH_PEER_KERNEL: peer on mesh interface (kernel managed)
166362306a36Sopenharmony_ci * @CFG80211_STA_MESH_PEER_USER: peer on mesh interface (user managed)
166462306a36Sopenharmony_ci */
166562306a36Sopenharmony_cienum cfg80211_station_type {
166662306a36Sopenharmony_ci	CFG80211_STA_AP_CLIENT,
166762306a36Sopenharmony_ci	CFG80211_STA_AP_CLIENT_UNASSOC,
166862306a36Sopenharmony_ci	CFG80211_STA_AP_MLME_CLIENT,
166962306a36Sopenharmony_ci	CFG80211_STA_AP_STA,
167062306a36Sopenharmony_ci	CFG80211_STA_IBSS,
167162306a36Sopenharmony_ci	CFG80211_STA_TDLS_PEER_SETUP,
167262306a36Sopenharmony_ci	CFG80211_STA_TDLS_PEER_ACTIVE,
167362306a36Sopenharmony_ci	CFG80211_STA_MESH_PEER_KERNEL,
167462306a36Sopenharmony_ci	CFG80211_STA_MESH_PEER_USER,
167562306a36Sopenharmony_ci};
167662306a36Sopenharmony_ci
167762306a36Sopenharmony_ci/**
167862306a36Sopenharmony_ci * cfg80211_check_station_change - validate parameter changes
167962306a36Sopenharmony_ci * @wiphy: the wiphy this operates on
168062306a36Sopenharmony_ci * @params: the new parameters for a station
168162306a36Sopenharmony_ci * @statype: the type of station being modified
168262306a36Sopenharmony_ci *
168362306a36Sopenharmony_ci * Utility function for the @change_station driver method. Call this function
168462306a36Sopenharmony_ci * with the appropriate station type looking up the station (and checking that
168562306a36Sopenharmony_ci * it exists). It will verify whether the station change is acceptable, and if
168662306a36Sopenharmony_ci * not will return an error code. Note that it may modify the parameters for
168762306a36Sopenharmony_ci * backward compatibility reasons, so don't use them before calling this.
168862306a36Sopenharmony_ci */
168962306a36Sopenharmony_ciint cfg80211_check_station_change(struct wiphy *wiphy,
169062306a36Sopenharmony_ci				  struct station_parameters *params,
169162306a36Sopenharmony_ci				  enum cfg80211_station_type statype);
169262306a36Sopenharmony_ci
169362306a36Sopenharmony_ci/**
169462306a36Sopenharmony_ci * enum rate_info_flags - bitrate info flags
169562306a36Sopenharmony_ci *
169662306a36Sopenharmony_ci * Used by the driver to indicate the specific rate transmission
169762306a36Sopenharmony_ci * type for 802.11n transmissions.
169862306a36Sopenharmony_ci *
169962306a36Sopenharmony_ci * @RATE_INFO_FLAGS_MCS: mcs field filled with HT MCS
170062306a36Sopenharmony_ci * @RATE_INFO_FLAGS_VHT_MCS: mcs field filled with VHT MCS
170162306a36Sopenharmony_ci * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
170262306a36Sopenharmony_ci * @RATE_INFO_FLAGS_DMG: 60GHz MCS
170362306a36Sopenharmony_ci * @RATE_INFO_FLAGS_HE_MCS: HE MCS information
170462306a36Sopenharmony_ci * @RATE_INFO_FLAGS_EDMG: 60GHz MCS in EDMG mode
170562306a36Sopenharmony_ci * @RATE_INFO_FLAGS_EXTENDED_SC_DMG: 60GHz extended SC MCS
170662306a36Sopenharmony_ci * @RATE_INFO_FLAGS_EHT_MCS: EHT MCS information
170762306a36Sopenharmony_ci * @RATE_INFO_FLAGS_S1G_MCS: MCS field filled with S1G MCS
170862306a36Sopenharmony_ci */
170962306a36Sopenharmony_cienum rate_info_flags {
171062306a36Sopenharmony_ci	RATE_INFO_FLAGS_MCS			= BIT(0),
171162306a36Sopenharmony_ci	RATE_INFO_FLAGS_VHT_MCS			= BIT(1),
171262306a36Sopenharmony_ci	RATE_INFO_FLAGS_SHORT_GI		= BIT(2),
171362306a36Sopenharmony_ci	RATE_INFO_FLAGS_DMG			= BIT(3),
171462306a36Sopenharmony_ci	RATE_INFO_FLAGS_HE_MCS			= BIT(4),
171562306a36Sopenharmony_ci	RATE_INFO_FLAGS_EDMG			= BIT(5),
171662306a36Sopenharmony_ci	RATE_INFO_FLAGS_EXTENDED_SC_DMG		= BIT(6),
171762306a36Sopenharmony_ci	RATE_INFO_FLAGS_EHT_MCS			= BIT(7),
171862306a36Sopenharmony_ci	RATE_INFO_FLAGS_S1G_MCS			= BIT(8),
171962306a36Sopenharmony_ci};
172062306a36Sopenharmony_ci
172162306a36Sopenharmony_ci/**
172262306a36Sopenharmony_ci * enum rate_info_bw - rate bandwidth information
172362306a36Sopenharmony_ci *
172462306a36Sopenharmony_ci * Used by the driver to indicate the rate bandwidth.
172562306a36Sopenharmony_ci *
172662306a36Sopenharmony_ci * @RATE_INFO_BW_5: 5 MHz bandwidth
172762306a36Sopenharmony_ci * @RATE_INFO_BW_10: 10 MHz bandwidth
172862306a36Sopenharmony_ci * @RATE_INFO_BW_20: 20 MHz bandwidth
172962306a36Sopenharmony_ci * @RATE_INFO_BW_40: 40 MHz bandwidth
173062306a36Sopenharmony_ci * @RATE_INFO_BW_80: 80 MHz bandwidth
173162306a36Sopenharmony_ci * @RATE_INFO_BW_160: 160 MHz bandwidth
173262306a36Sopenharmony_ci * @RATE_INFO_BW_HE_RU: bandwidth determined by HE RU allocation
173362306a36Sopenharmony_ci * @RATE_INFO_BW_320: 320 MHz bandwidth
173462306a36Sopenharmony_ci * @RATE_INFO_BW_EHT_RU: bandwidth determined by EHT RU allocation
173562306a36Sopenharmony_ci * @RATE_INFO_BW_1: 1 MHz bandwidth
173662306a36Sopenharmony_ci * @RATE_INFO_BW_2: 2 MHz bandwidth
173762306a36Sopenharmony_ci * @RATE_INFO_BW_4: 4 MHz bandwidth
173862306a36Sopenharmony_ci * @RATE_INFO_BW_8: 8 MHz bandwidth
173962306a36Sopenharmony_ci * @RATE_INFO_BW_16: 16 MHz bandwidth
174062306a36Sopenharmony_ci */
174162306a36Sopenharmony_cienum rate_info_bw {
174262306a36Sopenharmony_ci	RATE_INFO_BW_20 = 0,
174362306a36Sopenharmony_ci	RATE_INFO_BW_5,
174462306a36Sopenharmony_ci	RATE_INFO_BW_10,
174562306a36Sopenharmony_ci	RATE_INFO_BW_40,
174662306a36Sopenharmony_ci	RATE_INFO_BW_80,
174762306a36Sopenharmony_ci	RATE_INFO_BW_160,
174862306a36Sopenharmony_ci	RATE_INFO_BW_HE_RU,
174962306a36Sopenharmony_ci	RATE_INFO_BW_320,
175062306a36Sopenharmony_ci	RATE_INFO_BW_EHT_RU,
175162306a36Sopenharmony_ci	RATE_INFO_BW_1,
175262306a36Sopenharmony_ci	RATE_INFO_BW_2,
175362306a36Sopenharmony_ci	RATE_INFO_BW_4,
175462306a36Sopenharmony_ci	RATE_INFO_BW_8,
175562306a36Sopenharmony_ci	RATE_INFO_BW_16,
175662306a36Sopenharmony_ci};
175762306a36Sopenharmony_ci
175862306a36Sopenharmony_ci/**
175962306a36Sopenharmony_ci * struct rate_info - bitrate information
176062306a36Sopenharmony_ci *
176162306a36Sopenharmony_ci * Information about a receiving or transmitting bitrate
176262306a36Sopenharmony_ci *
176362306a36Sopenharmony_ci * @flags: bitflag of flags from &enum rate_info_flags
176462306a36Sopenharmony_ci * @legacy: bitrate in 100kbit/s for 802.11abg
176562306a36Sopenharmony_ci * @mcs: mcs index if struct describes an HT/VHT/HE/EHT/S1G rate
176662306a36Sopenharmony_ci * @nss: number of streams (VHT & HE only)
176762306a36Sopenharmony_ci * @bw: bandwidth (from &enum rate_info_bw)
176862306a36Sopenharmony_ci * @he_gi: HE guard interval (from &enum nl80211_he_gi)
176962306a36Sopenharmony_ci * @he_dcm: HE DCM value
177062306a36Sopenharmony_ci * @he_ru_alloc: HE RU allocation (from &enum nl80211_he_ru_alloc,
177162306a36Sopenharmony_ci *	only valid if bw is %RATE_INFO_BW_HE_RU)
177262306a36Sopenharmony_ci * @n_bonded_ch: In case of EDMG the number of bonded channels (1-4)
177362306a36Sopenharmony_ci * @eht_gi: EHT guard interval (from &enum nl80211_eht_gi)
177462306a36Sopenharmony_ci * @eht_ru_alloc: EHT RU allocation (from &enum nl80211_eht_ru_alloc,
177562306a36Sopenharmony_ci *	only valid if bw is %RATE_INFO_BW_EHT_RU)
177662306a36Sopenharmony_ci */
177762306a36Sopenharmony_cistruct rate_info {
177862306a36Sopenharmony_ci	u16 flags;
177962306a36Sopenharmony_ci	u16 legacy;
178062306a36Sopenharmony_ci	u8 mcs;
178162306a36Sopenharmony_ci	u8 nss;
178262306a36Sopenharmony_ci	u8 bw;
178362306a36Sopenharmony_ci	u8 he_gi;
178462306a36Sopenharmony_ci	u8 he_dcm;
178562306a36Sopenharmony_ci	u8 he_ru_alloc;
178662306a36Sopenharmony_ci	u8 n_bonded_ch;
178762306a36Sopenharmony_ci	u8 eht_gi;
178862306a36Sopenharmony_ci	u8 eht_ru_alloc;
178962306a36Sopenharmony_ci};
179062306a36Sopenharmony_ci
179162306a36Sopenharmony_ci/**
179262306a36Sopenharmony_ci * enum bss_param_flags - bitrate info flags
179362306a36Sopenharmony_ci *
179462306a36Sopenharmony_ci * Used by the driver to indicate the specific rate transmission
179562306a36Sopenharmony_ci * type for 802.11n transmissions.
179662306a36Sopenharmony_ci *
179762306a36Sopenharmony_ci * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled
179862306a36Sopenharmony_ci * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled
179962306a36Sopenharmony_ci * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled
180062306a36Sopenharmony_ci */
180162306a36Sopenharmony_cienum bss_param_flags {
180262306a36Sopenharmony_ci	BSS_PARAM_FLAGS_CTS_PROT	= 1<<0,
180362306a36Sopenharmony_ci	BSS_PARAM_FLAGS_SHORT_PREAMBLE	= 1<<1,
180462306a36Sopenharmony_ci	BSS_PARAM_FLAGS_SHORT_SLOT_TIME	= 1<<2,
180562306a36Sopenharmony_ci};
180662306a36Sopenharmony_ci
180762306a36Sopenharmony_ci/**
180862306a36Sopenharmony_ci * struct sta_bss_parameters - BSS parameters for the attached station
180962306a36Sopenharmony_ci *
181062306a36Sopenharmony_ci * Information about the currently associated BSS
181162306a36Sopenharmony_ci *
181262306a36Sopenharmony_ci * @flags: bitflag of flags from &enum bss_param_flags
181362306a36Sopenharmony_ci * @dtim_period: DTIM period for the BSS
181462306a36Sopenharmony_ci * @beacon_interval: beacon interval
181562306a36Sopenharmony_ci */
181662306a36Sopenharmony_cistruct sta_bss_parameters {
181762306a36Sopenharmony_ci	u8 flags;
181862306a36Sopenharmony_ci	u8 dtim_period;
181962306a36Sopenharmony_ci	u16 beacon_interval;
182062306a36Sopenharmony_ci};
182162306a36Sopenharmony_ci
182262306a36Sopenharmony_ci/**
182362306a36Sopenharmony_ci * struct cfg80211_txq_stats - TXQ statistics for this TID
182462306a36Sopenharmony_ci * @filled: bitmap of flags using the bits of &enum nl80211_txq_stats to
182562306a36Sopenharmony_ci *	indicate the relevant values in this struct are filled
182662306a36Sopenharmony_ci * @backlog_bytes: total number of bytes currently backlogged
182762306a36Sopenharmony_ci * @backlog_packets: total number of packets currently backlogged
182862306a36Sopenharmony_ci * @flows: number of new flows seen
182962306a36Sopenharmony_ci * @drops: total number of packets dropped
183062306a36Sopenharmony_ci * @ecn_marks: total number of packets marked with ECN CE
183162306a36Sopenharmony_ci * @overlimit: number of drops due to queue space overflow
183262306a36Sopenharmony_ci * @overmemory: number of drops due to memory limit overflow
183362306a36Sopenharmony_ci * @collisions: number of hash collisions
183462306a36Sopenharmony_ci * @tx_bytes: total number of bytes dequeued
183562306a36Sopenharmony_ci * @tx_packets: total number of packets dequeued
183662306a36Sopenharmony_ci * @max_flows: maximum number of flows supported
183762306a36Sopenharmony_ci */
183862306a36Sopenharmony_cistruct cfg80211_txq_stats {
183962306a36Sopenharmony_ci	u32 filled;
184062306a36Sopenharmony_ci	u32 backlog_bytes;
184162306a36Sopenharmony_ci	u32 backlog_packets;
184262306a36Sopenharmony_ci	u32 flows;
184362306a36Sopenharmony_ci	u32 drops;
184462306a36Sopenharmony_ci	u32 ecn_marks;
184562306a36Sopenharmony_ci	u32 overlimit;
184662306a36Sopenharmony_ci	u32 overmemory;
184762306a36Sopenharmony_ci	u32 collisions;
184862306a36Sopenharmony_ci	u32 tx_bytes;
184962306a36Sopenharmony_ci	u32 tx_packets;
185062306a36Sopenharmony_ci	u32 max_flows;
185162306a36Sopenharmony_ci};
185262306a36Sopenharmony_ci
185362306a36Sopenharmony_ci/**
185462306a36Sopenharmony_ci * struct cfg80211_tid_stats - per-TID statistics
185562306a36Sopenharmony_ci * @filled: bitmap of flags using the bits of &enum nl80211_tid_stats to
185662306a36Sopenharmony_ci *	indicate the relevant values in this struct are filled
185762306a36Sopenharmony_ci * @rx_msdu: number of received MSDUs
185862306a36Sopenharmony_ci * @tx_msdu: number of (attempted) transmitted MSDUs
185962306a36Sopenharmony_ci * @tx_msdu_retries: number of retries (not counting the first) for
186062306a36Sopenharmony_ci *	transmitted MSDUs
186162306a36Sopenharmony_ci * @tx_msdu_failed: number of failed transmitted MSDUs
186262306a36Sopenharmony_ci * @txq_stats: TXQ statistics
186362306a36Sopenharmony_ci */
186462306a36Sopenharmony_cistruct cfg80211_tid_stats {
186562306a36Sopenharmony_ci	u32 filled;
186662306a36Sopenharmony_ci	u64 rx_msdu;
186762306a36Sopenharmony_ci	u64 tx_msdu;
186862306a36Sopenharmony_ci	u64 tx_msdu_retries;
186962306a36Sopenharmony_ci	u64 tx_msdu_failed;
187062306a36Sopenharmony_ci	struct cfg80211_txq_stats txq_stats;
187162306a36Sopenharmony_ci};
187262306a36Sopenharmony_ci
187362306a36Sopenharmony_ci#define IEEE80211_MAX_CHAINS	4
187462306a36Sopenharmony_ci
187562306a36Sopenharmony_ci/**
187662306a36Sopenharmony_ci * struct station_info - station information
187762306a36Sopenharmony_ci *
187862306a36Sopenharmony_ci * Station information filled by driver for get_station() and dump_station.
187962306a36Sopenharmony_ci *
188062306a36Sopenharmony_ci * @filled: bitflag of flags using the bits of &enum nl80211_sta_info to
188162306a36Sopenharmony_ci *	indicate the relevant values in this struct for them
188262306a36Sopenharmony_ci * @connected_time: time(in secs) since a station is last connected
188362306a36Sopenharmony_ci * @inactive_time: time since last station activity (tx/rx) in milliseconds
188462306a36Sopenharmony_ci * @assoc_at: bootime (ns) of the last association
188562306a36Sopenharmony_ci * @rx_bytes: bytes (size of MPDUs) received from this station
188662306a36Sopenharmony_ci * @tx_bytes: bytes (size of MPDUs) transmitted to this station
188762306a36Sopenharmony_ci * @llid: mesh local link id
188862306a36Sopenharmony_ci * @plid: mesh peer link id
188962306a36Sopenharmony_ci * @plink_state: mesh peer link state
189062306a36Sopenharmony_ci * @signal: The signal strength, type depends on the wiphy's signal_type.
189162306a36Sopenharmony_ci *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
189262306a36Sopenharmony_ci * @signal_avg: Average signal strength, type depends on the wiphy's signal_type.
189362306a36Sopenharmony_ci *	For CFG80211_SIGNAL_TYPE_MBM, value is expressed in _dBm_.
189462306a36Sopenharmony_ci * @chains: bitmask for filled values in @chain_signal, @chain_signal_avg
189562306a36Sopenharmony_ci * @chain_signal: per-chain signal strength of last received packet in dBm
189662306a36Sopenharmony_ci * @chain_signal_avg: per-chain signal strength average in dBm
189762306a36Sopenharmony_ci * @txrate: current unicast bitrate from this station
189862306a36Sopenharmony_ci * @rxrate: current unicast bitrate to this station
189962306a36Sopenharmony_ci * @rx_packets: packets (MSDUs & MMPDUs) received from this station
190062306a36Sopenharmony_ci * @tx_packets: packets (MSDUs & MMPDUs) transmitted to this station
190162306a36Sopenharmony_ci * @tx_retries: cumulative retry counts (MPDUs)
190262306a36Sopenharmony_ci * @tx_failed: number of failed transmissions (MPDUs) (retries exceeded, no ACK)
190362306a36Sopenharmony_ci * @rx_dropped_misc:  Dropped for un-specified reason.
190462306a36Sopenharmony_ci * @bss_param: current BSS parameters
190562306a36Sopenharmony_ci * @generation: generation number for nl80211 dumps.
190662306a36Sopenharmony_ci *	This number should increase every time the list of stations
190762306a36Sopenharmony_ci *	changes, i.e. when a station is added or removed, so that
190862306a36Sopenharmony_ci *	userspace can tell whether it got a consistent snapshot.
190962306a36Sopenharmony_ci * @assoc_req_ies: IEs from (Re)Association Request.
191062306a36Sopenharmony_ci *	This is used only when in AP mode with drivers that do not use
191162306a36Sopenharmony_ci *	user space MLME/SME implementation. The information is provided for
191262306a36Sopenharmony_ci *	the cfg80211_new_sta() calls to notify user space of the IEs.
191362306a36Sopenharmony_ci * @assoc_req_ies_len: Length of assoc_req_ies buffer in octets.
191462306a36Sopenharmony_ci * @sta_flags: station flags mask & values
191562306a36Sopenharmony_ci * @beacon_loss_count: Number of times beacon loss event has triggered.
191662306a36Sopenharmony_ci * @t_offset: Time offset of the station relative to this host.
191762306a36Sopenharmony_ci * @local_pm: local mesh STA power save mode
191862306a36Sopenharmony_ci * @peer_pm: peer mesh STA power save mode
191962306a36Sopenharmony_ci * @nonpeer_pm: non-peer mesh STA power save mode
192062306a36Sopenharmony_ci * @expected_throughput: expected throughput in kbps (including 802.11 headers)
192162306a36Sopenharmony_ci *	towards this station.
192262306a36Sopenharmony_ci * @rx_beacon: number of beacons received from this peer
192362306a36Sopenharmony_ci * @rx_beacon_signal_avg: signal strength average (in dBm) for beacons received
192462306a36Sopenharmony_ci *	from this peer
192562306a36Sopenharmony_ci * @connected_to_gate: true if mesh STA has a path to mesh gate
192662306a36Sopenharmony_ci * @rx_duration: aggregate PPDU duration(usecs) for all the frames from a peer
192762306a36Sopenharmony_ci * @tx_duration: aggregate PPDU duration(usecs) for all the frames to a peer
192862306a36Sopenharmony_ci * @airtime_weight: current airtime scheduling weight
192962306a36Sopenharmony_ci * @pertid: per-TID statistics, see &struct cfg80211_tid_stats, using the last
193062306a36Sopenharmony_ci *	(IEEE80211_NUM_TIDS) index for MSDUs not encapsulated in QoS-MPDUs.
193162306a36Sopenharmony_ci *	Note that this doesn't use the @filled bit, but is used if non-NULL.
193262306a36Sopenharmony_ci * @ack_signal: signal strength (in dBm) of the last ACK frame.
193362306a36Sopenharmony_ci * @avg_ack_signal: average rssi value of ack packet for the no of msdu's has
193462306a36Sopenharmony_ci *	been sent.
193562306a36Sopenharmony_ci * @rx_mpdu_count: number of MPDUs received from this station
193662306a36Sopenharmony_ci * @fcs_err_count: number of packets (MPDUs) received from this station with
193762306a36Sopenharmony_ci *	an FCS error. This counter should be incremented only when TA of the
193862306a36Sopenharmony_ci *	received packet with an FCS error matches the peer MAC address.
193962306a36Sopenharmony_ci * @airtime_link_metric: mesh airtime link metric.
194062306a36Sopenharmony_ci * @connected_to_as: true if mesh STA has a path to authentication server
194162306a36Sopenharmony_ci * @mlo_params_valid: Indicates @assoc_link_id and @mld_addr fields are filled
194262306a36Sopenharmony_ci *	by driver. Drivers use this only in cfg80211_new_sta() calls when AP
194362306a36Sopenharmony_ci *	MLD's MLME/SME is offload to driver. Drivers won't fill this
194462306a36Sopenharmony_ci *	information in cfg80211_del_sta_sinfo(), get_station() and
194562306a36Sopenharmony_ci *	dump_station() callbacks.
194662306a36Sopenharmony_ci * @assoc_link_id: Indicates MLO link ID of the AP, with which the station
194762306a36Sopenharmony_ci *	completed (re)association. This information filled for both MLO
194862306a36Sopenharmony_ci *	and non-MLO STA connections when the AP affiliated with an MLD.
194962306a36Sopenharmony_ci * @mld_addr: For MLO STA connection, filled with MLD address of the station.
195062306a36Sopenharmony_ci *	For non-MLO STA connection, filled with all zeros.
195162306a36Sopenharmony_ci * @assoc_resp_ies: IEs from (Re)Association Response.
195262306a36Sopenharmony_ci *	This is used only when in AP mode with drivers that do not use user
195362306a36Sopenharmony_ci *	space MLME/SME implementation. The information is provided only for the
195462306a36Sopenharmony_ci *	cfg80211_new_sta() calls to notify user space of the IEs. Drivers won't
195562306a36Sopenharmony_ci *	fill this information in cfg80211_del_sta_sinfo(), get_station() and
195662306a36Sopenharmony_ci *	dump_station() callbacks. User space needs this information to determine
195762306a36Sopenharmony_ci *	the accepted and rejected affiliated links of the connected station.
195862306a36Sopenharmony_ci * @assoc_resp_ies_len: Length of @assoc_resp_ies buffer in octets.
195962306a36Sopenharmony_ci */
196062306a36Sopenharmony_cistruct station_info {
196162306a36Sopenharmony_ci	u64 filled;
196262306a36Sopenharmony_ci	u32 connected_time;
196362306a36Sopenharmony_ci	u32 inactive_time;
196462306a36Sopenharmony_ci	u64 assoc_at;
196562306a36Sopenharmony_ci	u64 rx_bytes;
196662306a36Sopenharmony_ci	u64 tx_bytes;
196762306a36Sopenharmony_ci	u16 llid;
196862306a36Sopenharmony_ci	u16 plid;
196962306a36Sopenharmony_ci	u8 plink_state;
197062306a36Sopenharmony_ci	s8 signal;
197162306a36Sopenharmony_ci	s8 signal_avg;
197262306a36Sopenharmony_ci
197362306a36Sopenharmony_ci	u8 chains;
197462306a36Sopenharmony_ci	s8 chain_signal[IEEE80211_MAX_CHAINS];
197562306a36Sopenharmony_ci	s8 chain_signal_avg[IEEE80211_MAX_CHAINS];
197662306a36Sopenharmony_ci
197762306a36Sopenharmony_ci	struct rate_info txrate;
197862306a36Sopenharmony_ci	struct rate_info rxrate;
197962306a36Sopenharmony_ci	u32 rx_packets;
198062306a36Sopenharmony_ci	u32 tx_packets;
198162306a36Sopenharmony_ci	u32 tx_retries;
198262306a36Sopenharmony_ci	u32 tx_failed;
198362306a36Sopenharmony_ci	u32 rx_dropped_misc;
198462306a36Sopenharmony_ci	struct sta_bss_parameters bss_param;
198562306a36Sopenharmony_ci	struct nl80211_sta_flag_update sta_flags;
198662306a36Sopenharmony_ci
198762306a36Sopenharmony_ci	int generation;
198862306a36Sopenharmony_ci
198962306a36Sopenharmony_ci	const u8 *assoc_req_ies;
199062306a36Sopenharmony_ci	size_t assoc_req_ies_len;
199162306a36Sopenharmony_ci
199262306a36Sopenharmony_ci	u32 beacon_loss_count;
199362306a36Sopenharmony_ci	s64 t_offset;
199462306a36Sopenharmony_ci	enum nl80211_mesh_power_mode local_pm;
199562306a36Sopenharmony_ci	enum nl80211_mesh_power_mode peer_pm;
199662306a36Sopenharmony_ci	enum nl80211_mesh_power_mode nonpeer_pm;
199762306a36Sopenharmony_ci
199862306a36Sopenharmony_ci	u32 expected_throughput;
199962306a36Sopenharmony_ci
200062306a36Sopenharmony_ci	u64 tx_duration;
200162306a36Sopenharmony_ci	u64 rx_duration;
200262306a36Sopenharmony_ci	u64 rx_beacon;
200362306a36Sopenharmony_ci	u8 rx_beacon_signal_avg;
200462306a36Sopenharmony_ci	u8 connected_to_gate;
200562306a36Sopenharmony_ci
200662306a36Sopenharmony_ci	struct cfg80211_tid_stats *pertid;
200762306a36Sopenharmony_ci	s8 ack_signal;
200862306a36Sopenharmony_ci	s8 avg_ack_signal;
200962306a36Sopenharmony_ci
201062306a36Sopenharmony_ci	u16 airtime_weight;
201162306a36Sopenharmony_ci
201262306a36Sopenharmony_ci	u32 rx_mpdu_count;
201362306a36Sopenharmony_ci	u32 fcs_err_count;
201462306a36Sopenharmony_ci
201562306a36Sopenharmony_ci	u32 airtime_link_metric;
201662306a36Sopenharmony_ci
201762306a36Sopenharmony_ci	u8 connected_to_as;
201862306a36Sopenharmony_ci
201962306a36Sopenharmony_ci	bool mlo_params_valid;
202062306a36Sopenharmony_ci	u8 assoc_link_id;
202162306a36Sopenharmony_ci	u8 mld_addr[ETH_ALEN] __aligned(2);
202262306a36Sopenharmony_ci	const u8 *assoc_resp_ies;
202362306a36Sopenharmony_ci	size_t assoc_resp_ies_len;
202462306a36Sopenharmony_ci};
202562306a36Sopenharmony_ci
202662306a36Sopenharmony_ci/**
202762306a36Sopenharmony_ci * struct cfg80211_sar_sub_specs - sub specs limit
202862306a36Sopenharmony_ci * @power: power limitation in 0.25dbm
202962306a36Sopenharmony_ci * @freq_range_index: index the power limitation applies to
203062306a36Sopenharmony_ci */
203162306a36Sopenharmony_cistruct cfg80211_sar_sub_specs {
203262306a36Sopenharmony_ci	s32 power;
203362306a36Sopenharmony_ci	u32 freq_range_index;
203462306a36Sopenharmony_ci};
203562306a36Sopenharmony_ci
203662306a36Sopenharmony_ci/**
203762306a36Sopenharmony_ci * struct cfg80211_sar_specs - sar limit specs
203862306a36Sopenharmony_ci * @type: it's set with power in 0.25dbm or other types
203962306a36Sopenharmony_ci * @num_sub_specs: number of sar sub specs
204062306a36Sopenharmony_ci * @sub_specs: memory to hold the sar sub specs
204162306a36Sopenharmony_ci */
204262306a36Sopenharmony_cistruct cfg80211_sar_specs {
204362306a36Sopenharmony_ci	enum nl80211_sar_type type;
204462306a36Sopenharmony_ci	u32 num_sub_specs;
204562306a36Sopenharmony_ci	struct cfg80211_sar_sub_specs sub_specs[];
204662306a36Sopenharmony_ci};
204762306a36Sopenharmony_ci
204862306a36Sopenharmony_ci
204962306a36Sopenharmony_ci/**
205062306a36Sopenharmony_ci * struct cfg80211_sar_freq_ranges - sar frequency ranges
205162306a36Sopenharmony_ci * @start_freq:  start range edge frequency
205262306a36Sopenharmony_ci * @end_freq:    end range edge frequency
205362306a36Sopenharmony_ci */
205462306a36Sopenharmony_cistruct cfg80211_sar_freq_ranges {
205562306a36Sopenharmony_ci	u32 start_freq;
205662306a36Sopenharmony_ci	u32 end_freq;
205762306a36Sopenharmony_ci};
205862306a36Sopenharmony_ci
205962306a36Sopenharmony_ci/**
206062306a36Sopenharmony_ci * struct cfg80211_sar_capa - sar limit capability
206162306a36Sopenharmony_ci * @type: it's set via power in 0.25dbm or other types
206262306a36Sopenharmony_ci * @num_freq_ranges: number of frequency ranges
206362306a36Sopenharmony_ci * @freq_ranges: memory to hold the freq ranges.
206462306a36Sopenharmony_ci *
206562306a36Sopenharmony_ci * Note: WLAN driver may append new ranges or split an existing
206662306a36Sopenharmony_ci * range to small ones and then append them.
206762306a36Sopenharmony_ci */
206862306a36Sopenharmony_cistruct cfg80211_sar_capa {
206962306a36Sopenharmony_ci	enum nl80211_sar_type type;
207062306a36Sopenharmony_ci	u32 num_freq_ranges;
207162306a36Sopenharmony_ci	const struct cfg80211_sar_freq_ranges *freq_ranges;
207262306a36Sopenharmony_ci};
207362306a36Sopenharmony_ci
207462306a36Sopenharmony_ci#if IS_ENABLED(CONFIG_CFG80211)
207562306a36Sopenharmony_ci/**
207662306a36Sopenharmony_ci * cfg80211_get_station - retrieve information about a given station
207762306a36Sopenharmony_ci * @dev: the device where the station is supposed to be connected to
207862306a36Sopenharmony_ci * @mac_addr: the mac address of the station of interest
207962306a36Sopenharmony_ci * @sinfo: pointer to the structure to fill with the information
208062306a36Sopenharmony_ci *
208162306a36Sopenharmony_ci * Returns 0 on success and sinfo is filled with the available information
208262306a36Sopenharmony_ci * otherwise returns a negative error code and the content of sinfo has to be
208362306a36Sopenharmony_ci * considered undefined.
208462306a36Sopenharmony_ci */
208562306a36Sopenharmony_ciint cfg80211_get_station(struct net_device *dev, const u8 *mac_addr,
208662306a36Sopenharmony_ci			 struct station_info *sinfo);
208762306a36Sopenharmony_ci#else
208862306a36Sopenharmony_cistatic inline int cfg80211_get_station(struct net_device *dev,
208962306a36Sopenharmony_ci				       const u8 *mac_addr,
209062306a36Sopenharmony_ci				       struct station_info *sinfo)
209162306a36Sopenharmony_ci{
209262306a36Sopenharmony_ci	return -ENOENT;
209362306a36Sopenharmony_ci}
209462306a36Sopenharmony_ci#endif
209562306a36Sopenharmony_ci
209662306a36Sopenharmony_ci/**
209762306a36Sopenharmony_ci * enum monitor_flags - monitor flags
209862306a36Sopenharmony_ci *
209962306a36Sopenharmony_ci * Monitor interface configuration flags. Note that these must be the bits
210062306a36Sopenharmony_ci * according to the nl80211 flags.
210162306a36Sopenharmony_ci *
210262306a36Sopenharmony_ci * @MONITOR_FLAG_CHANGED: set if the flags were changed
210362306a36Sopenharmony_ci * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
210462306a36Sopenharmony_ci * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
210562306a36Sopenharmony_ci * @MONITOR_FLAG_CONTROL: pass control frames
210662306a36Sopenharmony_ci * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
210762306a36Sopenharmony_ci * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
210862306a36Sopenharmony_ci * @MONITOR_FLAG_ACTIVE: active monitor, ACKs frames on its MAC address
210962306a36Sopenharmony_ci */
211062306a36Sopenharmony_cienum monitor_flags {
211162306a36Sopenharmony_ci	MONITOR_FLAG_CHANGED		= 1<<__NL80211_MNTR_FLAG_INVALID,
211262306a36Sopenharmony_ci	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
211362306a36Sopenharmony_ci	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
211462306a36Sopenharmony_ci	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
211562306a36Sopenharmony_ci	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
211662306a36Sopenharmony_ci	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
211762306a36Sopenharmony_ci	MONITOR_FLAG_ACTIVE		= 1<<NL80211_MNTR_FLAG_ACTIVE,
211862306a36Sopenharmony_ci};
211962306a36Sopenharmony_ci
212062306a36Sopenharmony_ci/**
212162306a36Sopenharmony_ci * enum mpath_info_flags -  mesh path information flags
212262306a36Sopenharmony_ci *
212362306a36Sopenharmony_ci * Used by the driver to indicate which info in &struct mpath_info it has filled
212462306a36Sopenharmony_ci * in during get_station() or dump_station().
212562306a36Sopenharmony_ci *
212662306a36Sopenharmony_ci * @MPATH_INFO_FRAME_QLEN: @frame_qlen filled
212762306a36Sopenharmony_ci * @MPATH_INFO_SN: @sn filled
212862306a36Sopenharmony_ci * @MPATH_INFO_METRIC: @metric filled
212962306a36Sopenharmony_ci * @MPATH_INFO_EXPTIME: @exptime filled
213062306a36Sopenharmony_ci * @MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
213162306a36Sopenharmony_ci * @MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
213262306a36Sopenharmony_ci * @MPATH_INFO_FLAGS: @flags filled
213362306a36Sopenharmony_ci * @MPATH_INFO_HOP_COUNT: @hop_count filled
213462306a36Sopenharmony_ci * @MPATH_INFO_PATH_CHANGE: @path_change_count filled
213562306a36Sopenharmony_ci */
213662306a36Sopenharmony_cienum mpath_info_flags {
213762306a36Sopenharmony_ci	MPATH_INFO_FRAME_QLEN		= BIT(0),
213862306a36Sopenharmony_ci	MPATH_INFO_SN			= BIT(1),
213962306a36Sopenharmony_ci	MPATH_INFO_METRIC		= BIT(2),
214062306a36Sopenharmony_ci	MPATH_INFO_EXPTIME		= BIT(3),
214162306a36Sopenharmony_ci	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
214262306a36Sopenharmony_ci	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
214362306a36Sopenharmony_ci	MPATH_INFO_FLAGS		= BIT(6),
214462306a36Sopenharmony_ci	MPATH_INFO_HOP_COUNT		= BIT(7),
214562306a36Sopenharmony_ci	MPATH_INFO_PATH_CHANGE		= BIT(8),
214662306a36Sopenharmony_ci};
214762306a36Sopenharmony_ci
214862306a36Sopenharmony_ci/**
214962306a36Sopenharmony_ci * struct mpath_info - mesh path information
215062306a36Sopenharmony_ci *
215162306a36Sopenharmony_ci * Mesh path information filled by driver for get_mpath() and dump_mpath().
215262306a36Sopenharmony_ci *
215362306a36Sopenharmony_ci * @filled: bitfield of flags from &enum mpath_info_flags
215462306a36Sopenharmony_ci * @frame_qlen: number of queued frames for this destination
215562306a36Sopenharmony_ci * @sn: target sequence number
215662306a36Sopenharmony_ci * @metric: metric (cost) of this mesh path
215762306a36Sopenharmony_ci * @exptime: expiration time for the mesh path from now, in msecs
215862306a36Sopenharmony_ci * @flags: mesh path flags from &enum mesh_path_flags
215962306a36Sopenharmony_ci * @discovery_timeout: total mesh path discovery timeout, in msecs
216062306a36Sopenharmony_ci * @discovery_retries: mesh path discovery retries
216162306a36Sopenharmony_ci * @generation: generation number for nl80211 dumps.
216262306a36Sopenharmony_ci *	This number should increase every time the list of mesh paths
216362306a36Sopenharmony_ci *	changes, i.e. when a station is added or removed, so that
216462306a36Sopenharmony_ci *	userspace can tell whether it got a consistent snapshot.
216562306a36Sopenharmony_ci * @hop_count: hops to destination
216662306a36Sopenharmony_ci * @path_change_count: total number of path changes to destination
216762306a36Sopenharmony_ci */
216862306a36Sopenharmony_cistruct mpath_info {
216962306a36Sopenharmony_ci	u32 filled;
217062306a36Sopenharmony_ci	u32 frame_qlen;
217162306a36Sopenharmony_ci	u32 sn;
217262306a36Sopenharmony_ci	u32 metric;
217362306a36Sopenharmony_ci	u32 exptime;
217462306a36Sopenharmony_ci	u32 discovery_timeout;
217562306a36Sopenharmony_ci	u8 discovery_retries;
217662306a36Sopenharmony_ci	u8 flags;
217762306a36Sopenharmony_ci	u8 hop_count;
217862306a36Sopenharmony_ci	u32 path_change_count;
217962306a36Sopenharmony_ci
218062306a36Sopenharmony_ci	int generation;
218162306a36Sopenharmony_ci};
218262306a36Sopenharmony_ci
218362306a36Sopenharmony_ci/**
218462306a36Sopenharmony_ci * struct bss_parameters - BSS parameters
218562306a36Sopenharmony_ci *
218662306a36Sopenharmony_ci * Used to change BSS parameters (mainly for AP mode).
218762306a36Sopenharmony_ci *
218862306a36Sopenharmony_ci * @link_id: link_id or -1 for non-MLD
218962306a36Sopenharmony_ci * @use_cts_prot: Whether to use CTS protection
219062306a36Sopenharmony_ci *	(0 = no, 1 = yes, -1 = do not change)
219162306a36Sopenharmony_ci * @use_short_preamble: Whether the use of short preambles is allowed
219262306a36Sopenharmony_ci *	(0 = no, 1 = yes, -1 = do not change)
219362306a36Sopenharmony_ci * @use_short_slot_time: Whether the use of short slot time is allowed
219462306a36Sopenharmony_ci *	(0 = no, 1 = yes, -1 = do not change)
219562306a36Sopenharmony_ci * @basic_rates: basic rates in IEEE 802.11 format
219662306a36Sopenharmony_ci *	(or NULL for no change)
219762306a36Sopenharmony_ci * @basic_rates_len: number of basic rates
219862306a36Sopenharmony_ci * @ap_isolate: do not forward packets between connected stations
219962306a36Sopenharmony_ci *	(0 = no, 1 = yes, -1 = do not change)
220062306a36Sopenharmony_ci * @ht_opmode: HT Operation mode
220162306a36Sopenharmony_ci *	(u16 = opmode, -1 = do not change)
220262306a36Sopenharmony_ci * @p2p_ctwindow: P2P CT Window (-1 = no change)
220362306a36Sopenharmony_ci * @p2p_opp_ps: P2P opportunistic PS (-1 = no change)
220462306a36Sopenharmony_ci */
220562306a36Sopenharmony_cistruct bss_parameters {
220662306a36Sopenharmony_ci	int link_id;
220762306a36Sopenharmony_ci	int use_cts_prot;
220862306a36Sopenharmony_ci	int use_short_preamble;
220962306a36Sopenharmony_ci	int use_short_slot_time;
221062306a36Sopenharmony_ci	const u8 *basic_rates;
221162306a36Sopenharmony_ci	u8 basic_rates_len;
221262306a36Sopenharmony_ci	int ap_isolate;
221362306a36Sopenharmony_ci	int ht_opmode;
221462306a36Sopenharmony_ci	s8 p2p_ctwindow, p2p_opp_ps;
221562306a36Sopenharmony_ci};
221662306a36Sopenharmony_ci
221762306a36Sopenharmony_ci/**
221862306a36Sopenharmony_ci * struct mesh_config - 802.11s mesh configuration
221962306a36Sopenharmony_ci *
222062306a36Sopenharmony_ci * These parameters can be changed while the mesh is active.
222162306a36Sopenharmony_ci *
222262306a36Sopenharmony_ci * @dot11MeshRetryTimeout: the initial retry timeout in millisecond units used
222362306a36Sopenharmony_ci *	by the Mesh Peering Open message
222462306a36Sopenharmony_ci * @dot11MeshConfirmTimeout: the initial retry timeout in millisecond units
222562306a36Sopenharmony_ci *	used by the Mesh Peering Open message
222662306a36Sopenharmony_ci * @dot11MeshHoldingTimeout: the confirm timeout in millisecond units used by
222762306a36Sopenharmony_ci *	the mesh peering management to close a mesh peering
222862306a36Sopenharmony_ci * @dot11MeshMaxPeerLinks: the maximum number of peer links allowed on this
222962306a36Sopenharmony_ci *	mesh interface
223062306a36Sopenharmony_ci * @dot11MeshMaxRetries: the maximum number of peer link open retries that can
223162306a36Sopenharmony_ci *	be sent to establish a new peer link instance in a mesh
223262306a36Sopenharmony_ci * @dot11MeshTTL: the value of TTL field set at a source mesh STA
223362306a36Sopenharmony_ci * @element_ttl: the value of TTL field set at a mesh STA for path selection
223462306a36Sopenharmony_ci *	elements
223562306a36Sopenharmony_ci * @auto_open_plinks: whether we should automatically open peer links when we
223662306a36Sopenharmony_ci *	detect compatible mesh peers
223762306a36Sopenharmony_ci * @dot11MeshNbrOffsetMaxNeighbor: the maximum number of neighbors to
223862306a36Sopenharmony_ci *	synchronize to for 11s default synchronization method
223962306a36Sopenharmony_ci * @dot11MeshHWMPmaxPREQretries: the number of action frames containing a PREQ
224062306a36Sopenharmony_ci *	that an originator mesh STA can send to a particular path target
224162306a36Sopenharmony_ci * @path_refresh_time: how frequently to refresh mesh paths in milliseconds
224262306a36Sopenharmony_ci * @min_discovery_timeout: the minimum length of time to wait until giving up on
224362306a36Sopenharmony_ci *	a path discovery in milliseconds
224462306a36Sopenharmony_ci * @dot11MeshHWMPactivePathTimeout: the time (in TUs) for which mesh STAs
224562306a36Sopenharmony_ci *	receiving a PREQ shall consider the forwarding information from the
224662306a36Sopenharmony_ci *	root to be valid. (TU = time unit)
224762306a36Sopenharmony_ci * @dot11MeshHWMPpreqMinInterval: the minimum interval of time (in TUs) during
224862306a36Sopenharmony_ci *	which a mesh STA can send only one action frame containing a PREQ
224962306a36Sopenharmony_ci *	element
225062306a36Sopenharmony_ci * @dot11MeshHWMPperrMinInterval: the minimum interval of time (in TUs) during
225162306a36Sopenharmony_ci *	which a mesh STA can send only one Action frame containing a PERR
225262306a36Sopenharmony_ci *	element
225362306a36Sopenharmony_ci * @dot11MeshHWMPnetDiameterTraversalTime: the interval of time (in TUs) that
225462306a36Sopenharmony_ci *	it takes for an HWMP information element to propagate across the mesh
225562306a36Sopenharmony_ci * @dot11MeshHWMPRootMode: the configuration of a mesh STA as root mesh STA
225662306a36Sopenharmony_ci * @dot11MeshHWMPRannInterval: the interval of time (in TUs) between root
225762306a36Sopenharmony_ci *	announcements are transmitted
225862306a36Sopenharmony_ci * @dot11MeshGateAnnouncementProtocol: whether to advertise that this mesh
225962306a36Sopenharmony_ci *	station has access to a broader network beyond the MBSS. (This is
226062306a36Sopenharmony_ci *	missnamed in draft 12.0: dot11MeshGateAnnouncementProtocol set to true
226162306a36Sopenharmony_ci *	only means that the station will announce others it's a mesh gate, but
226262306a36Sopenharmony_ci *	not necessarily using the gate announcement protocol. Still keeping the
226362306a36Sopenharmony_ci *	same nomenclature to be in sync with the spec)
226462306a36Sopenharmony_ci * @dot11MeshForwarding: whether the Mesh STA is forwarding or non-forwarding
226562306a36Sopenharmony_ci *	entity (default is TRUE - forwarding entity)
226662306a36Sopenharmony_ci * @rssi_threshold: the threshold for average signal strength of candidate
226762306a36Sopenharmony_ci *	station to establish a peer link
226862306a36Sopenharmony_ci * @ht_opmode: mesh HT protection mode
226962306a36Sopenharmony_ci *
227062306a36Sopenharmony_ci * @dot11MeshHWMPactivePathToRootTimeout: The time (in TUs) for which mesh STAs
227162306a36Sopenharmony_ci *	receiving a proactive PREQ shall consider the forwarding information to
227262306a36Sopenharmony_ci *	the root mesh STA to be valid.
227362306a36Sopenharmony_ci *
227462306a36Sopenharmony_ci * @dot11MeshHWMProotInterval: The interval of time (in TUs) between proactive
227562306a36Sopenharmony_ci *	PREQs are transmitted.
227662306a36Sopenharmony_ci * @dot11MeshHWMPconfirmationInterval: The minimum interval of time (in TUs)
227762306a36Sopenharmony_ci *	during which a mesh STA can send only one Action frame containing
227862306a36Sopenharmony_ci *	a PREQ element for root path confirmation.
227962306a36Sopenharmony_ci * @power_mode: The default mesh power save mode which will be the initial
228062306a36Sopenharmony_ci *	setting for new peer links.
228162306a36Sopenharmony_ci * @dot11MeshAwakeWindowDuration: The duration in TUs the STA will remain awake
228262306a36Sopenharmony_ci *	after transmitting its beacon.
228362306a36Sopenharmony_ci * @plink_timeout: If no tx activity is seen from a STA we've established
228462306a36Sopenharmony_ci *	peering with for longer than this time (in seconds), then remove it
228562306a36Sopenharmony_ci *	from the STA's list of peers.  Default is 30 minutes.
228662306a36Sopenharmony_ci * @dot11MeshConnectedToAuthServer: if set to true then this mesh STA
228762306a36Sopenharmony_ci *	will advertise that it is connected to a authentication server
228862306a36Sopenharmony_ci *	in the mesh formation field.
228962306a36Sopenharmony_ci * @dot11MeshConnectedToMeshGate: if set to true, advertise that this STA is
229062306a36Sopenharmony_ci *      connected to a mesh gate in mesh formation info.  If false, the
229162306a36Sopenharmony_ci *      value in mesh formation is determined by the presence of root paths
229262306a36Sopenharmony_ci *      in the mesh path table
229362306a36Sopenharmony_ci * @dot11MeshNolearn: Try to avoid multi-hop path discovery (e.g. PREQ/PREP
229462306a36Sopenharmony_ci *      for HWMP) if the destination is a direct neighbor. Note that this might
229562306a36Sopenharmony_ci *      not be the optimal decision as a multi-hop route might be better. So
229662306a36Sopenharmony_ci *      if using this setting you will likely also want to disable
229762306a36Sopenharmony_ci *      dot11MeshForwarding and use another mesh routing protocol on top.
229862306a36Sopenharmony_ci */
229962306a36Sopenharmony_cistruct mesh_config {
230062306a36Sopenharmony_ci	u16 dot11MeshRetryTimeout;
230162306a36Sopenharmony_ci	u16 dot11MeshConfirmTimeout;
230262306a36Sopenharmony_ci	u16 dot11MeshHoldingTimeout;
230362306a36Sopenharmony_ci	u16 dot11MeshMaxPeerLinks;
230462306a36Sopenharmony_ci	u8 dot11MeshMaxRetries;
230562306a36Sopenharmony_ci	u8 dot11MeshTTL;
230662306a36Sopenharmony_ci	u8 element_ttl;
230762306a36Sopenharmony_ci	bool auto_open_plinks;
230862306a36Sopenharmony_ci	u32 dot11MeshNbrOffsetMaxNeighbor;
230962306a36Sopenharmony_ci	u8 dot11MeshHWMPmaxPREQretries;
231062306a36Sopenharmony_ci	u32 path_refresh_time;
231162306a36Sopenharmony_ci	u16 min_discovery_timeout;
231262306a36Sopenharmony_ci	u32 dot11MeshHWMPactivePathTimeout;
231362306a36Sopenharmony_ci	u16 dot11MeshHWMPpreqMinInterval;
231462306a36Sopenharmony_ci	u16 dot11MeshHWMPperrMinInterval;
231562306a36Sopenharmony_ci	u16 dot11MeshHWMPnetDiameterTraversalTime;
231662306a36Sopenharmony_ci	u8 dot11MeshHWMPRootMode;
231762306a36Sopenharmony_ci	bool dot11MeshConnectedToMeshGate;
231862306a36Sopenharmony_ci	bool dot11MeshConnectedToAuthServer;
231962306a36Sopenharmony_ci	u16 dot11MeshHWMPRannInterval;
232062306a36Sopenharmony_ci	bool dot11MeshGateAnnouncementProtocol;
232162306a36Sopenharmony_ci	bool dot11MeshForwarding;
232262306a36Sopenharmony_ci	s32 rssi_threshold;
232362306a36Sopenharmony_ci	u16 ht_opmode;
232462306a36Sopenharmony_ci	u32 dot11MeshHWMPactivePathToRootTimeout;
232562306a36Sopenharmony_ci	u16 dot11MeshHWMProotInterval;
232662306a36Sopenharmony_ci	u16 dot11MeshHWMPconfirmationInterval;
232762306a36Sopenharmony_ci	enum nl80211_mesh_power_mode power_mode;
232862306a36Sopenharmony_ci	u16 dot11MeshAwakeWindowDuration;
232962306a36Sopenharmony_ci	u32 plink_timeout;
233062306a36Sopenharmony_ci	bool dot11MeshNolearn;
233162306a36Sopenharmony_ci};
233262306a36Sopenharmony_ci
233362306a36Sopenharmony_ci/**
233462306a36Sopenharmony_ci * struct mesh_setup - 802.11s mesh setup configuration
233562306a36Sopenharmony_ci * @chandef: defines the channel to use
233662306a36Sopenharmony_ci * @mesh_id: the mesh ID
233762306a36Sopenharmony_ci * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes
233862306a36Sopenharmony_ci * @sync_method: which synchronization method to use
233962306a36Sopenharmony_ci * @path_sel_proto: which path selection protocol to use
234062306a36Sopenharmony_ci * @path_metric: which metric to use
234162306a36Sopenharmony_ci * @auth_id: which authentication method this mesh is using
234262306a36Sopenharmony_ci * @ie: vendor information elements (optional)
234362306a36Sopenharmony_ci * @ie_len: length of vendor information elements
234462306a36Sopenharmony_ci * @is_authenticated: this mesh requires authentication
234562306a36Sopenharmony_ci * @is_secure: this mesh uses security
234662306a36Sopenharmony_ci * @user_mpm: userspace handles all MPM functions
234762306a36Sopenharmony_ci * @dtim_period: DTIM period to use
234862306a36Sopenharmony_ci * @beacon_interval: beacon interval to use
234962306a36Sopenharmony_ci * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
235062306a36Sopenharmony_ci * @basic_rates: basic rates to use when creating the mesh
235162306a36Sopenharmony_ci * @beacon_rate: bitrate to be used for beacons
235262306a36Sopenharmony_ci * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
235362306a36Sopenharmony_ci *	changes the channel when a radar is detected. This is required
235462306a36Sopenharmony_ci *	to operate on DFS channels.
235562306a36Sopenharmony_ci * @control_port_over_nl80211: TRUE if userspace expects to exchange control
235662306a36Sopenharmony_ci *	port frames over NL80211 instead of the network interface.
235762306a36Sopenharmony_ci *
235862306a36Sopenharmony_ci * These parameters are fixed when the mesh is created.
235962306a36Sopenharmony_ci */
236062306a36Sopenharmony_cistruct mesh_setup {
236162306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
236262306a36Sopenharmony_ci	const u8 *mesh_id;
236362306a36Sopenharmony_ci	u8 mesh_id_len;
236462306a36Sopenharmony_ci	u8 sync_method;
236562306a36Sopenharmony_ci	u8 path_sel_proto;
236662306a36Sopenharmony_ci	u8 path_metric;
236762306a36Sopenharmony_ci	u8 auth_id;
236862306a36Sopenharmony_ci	const u8 *ie;
236962306a36Sopenharmony_ci	u8 ie_len;
237062306a36Sopenharmony_ci	bool is_authenticated;
237162306a36Sopenharmony_ci	bool is_secure;
237262306a36Sopenharmony_ci	bool user_mpm;
237362306a36Sopenharmony_ci	u8 dtim_period;
237462306a36Sopenharmony_ci	u16 beacon_interval;
237562306a36Sopenharmony_ci	int mcast_rate[NUM_NL80211_BANDS];
237662306a36Sopenharmony_ci	u32 basic_rates;
237762306a36Sopenharmony_ci	struct cfg80211_bitrate_mask beacon_rate;
237862306a36Sopenharmony_ci	bool userspace_handles_dfs;
237962306a36Sopenharmony_ci	bool control_port_over_nl80211;
238062306a36Sopenharmony_ci};
238162306a36Sopenharmony_ci
238262306a36Sopenharmony_ci/**
238362306a36Sopenharmony_ci * struct ocb_setup - 802.11p OCB mode setup configuration
238462306a36Sopenharmony_ci * @chandef: defines the channel to use
238562306a36Sopenharmony_ci *
238662306a36Sopenharmony_ci * These parameters are fixed when connecting to the network
238762306a36Sopenharmony_ci */
238862306a36Sopenharmony_cistruct ocb_setup {
238962306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
239062306a36Sopenharmony_ci};
239162306a36Sopenharmony_ci
239262306a36Sopenharmony_ci/**
239362306a36Sopenharmony_ci * struct ieee80211_txq_params - TX queue parameters
239462306a36Sopenharmony_ci * @ac: AC identifier
239562306a36Sopenharmony_ci * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
239662306a36Sopenharmony_ci * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
239762306a36Sopenharmony_ci *	1..32767]
239862306a36Sopenharmony_ci * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
239962306a36Sopenharmony_ci *	1..32767]
240062306a36Sopenharmony_ci * @aifs: Arbitration interframe space [0..255]
240162306a36Sopenharmony_ci * @link_id: link_id or -1 for non-MLD
240262306a36Sopenharmony_ci */
240362306a36Sopenharmony_cistruct ieee80211_txq_params {
240462306a36Sopenharmony_ci	enum nl80211_ac ac;
240562306a36Sopenharmony_ci	u16 txop;
240662306a36Sopenharmony_ci	u16 cwmin;
240762306a36Sopenharmony_ci	u16 cwmax;
240862306a36Sopenharmony_ci	u8 aifs;
240962306a36Sopenharmony_ci	int link_id;
241062306a36Sopenharmony_ci};
241162306a36Sopenharmony_ci
241262306a36Sopenharmony_ci/**
241362306a36Sopenharmony_ci * DOC: Scanning and BSS list handling
241462306a36Sopenharmony_ci *
241562306a36Sopenharmony_ci * The scanning process itself is fairly simple, but cfg80211 offers quite
241662306a36Sopenharmony_ci * a bit of helper functionality. To start a scan, the scan operation will
241762306a36Sopenharmony_ci * be invoked with a scan definition. This scan definition contains the
241862306a36Sopenharmony_ci * channels to scan, and the SSIDs to send probe requests for (including the
241962306a36Sopenharmony_ci * wildcard, if desired). A passive scan is indicated by having no SSIDs to
242062306a36Sopenharmony_ci * probe. Additionally, a scan request may contain extra information elements
242162306a36Sopenharmony_ci * that should be added to the probe request. The IEs are guaranteed to be
242262306a36Sopenharmony_ci * well-formed, and will not exceed the maximum length the driver advertised
242362306a36Sopenharmony_ci * in the wiphy structure.
242462306a36Sopenharmony_ci *
242562306a36Sopenharmony_ci * When scanning finds a BSS, cfg80211 needs to be notified of that, because
242662306a36Sopenharmony_ci * it is responsible for maintaining the BSS list; the driver should not
242762306a36Sopenharmony_ci * maintain a list itself. For this notification, various functions exist.
242862306a36Sopenharmony_ci *
242962306a36Sopenharmony_ci * Since drivers do not maintain a BSS list, there are also a number of
243062306a36Sopenharmony_ci * functions to search for a BSS and obtain information about it from the
243162306a36Sopenharmony_ci * BSS structure cfg80211 maintains. The BSS list is also made available
243262306a36Sopenharmony_ci * to userspace.
243362306a36Sopenharmony_ci */
243462306a36Sopenharmony_ci
243562306a36Sopenharmony_ci/**
243662306a36Sopenharmony_ci * struct cfg80211_ssid - SSID description
243762306a36Sopenharmony_ci * @ssid: the SSID
243862306a36Sopenharmony_ci * @ssid_len: length of the ssid
243962306a36Sopenharmony_ci */
244062306a36Sopenharmony_cistruct cfg80211_ssid {
244162306a36Sopenharmony_ci	u8 ssid[IEEE80211_MAX_SSID_LEN];
244262306a36Sopenharmony_ci	u8 ssid_len;
244362306a36Sopenharmony_ci};
244462306a36Sopenharmony_ci
244562306a36Sopenharmony_ci/**
244662306a36Sopenharmony_ci * struct cfg80211_scan_info - information about completed scan
244762306a36Sopenharmony_ci * @scan_start_tsf: scan start time in terms of the TSF of the BSS that the
244862306a36Sopenharmony_ci *	wireless device that requested the scan is connected to. If this
244962306a36Sopenharmony_ci *	information is not available, this field is left zero.
245062306a36Sopenharmony_ci * @tsf_bssid: the BSSID according to which %scan_start_tsf is set.
245162306a36Sopenharmony_ci * @aborted: set to true if the scan was aborted for any reason,
245262306a36Sopenharmony_ci *	userspace will be notified of that
245362306a36Sopenharmony_ci */
245462306a36Sopenharmony_cistruct cfg80211_scan_info {
245562306a36Sopenharmony_ci	u64 scan_start_tsf;
245662306a36Sopenharmony_ci	u8 tsf_bssid[ETH_ALEN] __aligned(2);
245762306a36Sopenharmony_ci	bool aborted;
245862306a36Sopenharmony_ci};
245962306a36Sopenharmony_ci
246062306a36Sopenharmony_ci/**
246162306a36Sopenharmony_ci * struct cfg80211_scan_6ghz_params - relevant for 6 GHz only
246262306a36Sopenharmony_ci *
246362306a36Sopenharmony_ci * @short_ssid: short ssid to scan for
246462306a36Sopenharmony_ci * @bssid: bssid to scan for
246562306a36Sopenharmony_ci * @channel_idx: idx of the channel in the channel array in the scan request
246662306a36Sopenharmony_ci *	 which the above info relvant to
246762306a36Sopenharmony_ci * @unsolicited_probe: the AP transmits unsolicited probe response every 20 TU
246862306a36Sopenharmony_ci * @short_ssid_valid: @short_ssid is valid and can be used
246962306a36Sopenharmony_ci * @psc_no_listen: when set, and the channel is a PSC channel, no need to wait
247062306a36Sopenharmony_ci *       20 TUs before starting to send probe requests.
247162306a36Sopenharmony_ci * @psd_20: The AP's 20 MHz PSD value.
247262306a36Sopenharmony_ci */
247362306a36Sopenharmony_cistruct cfg80211_scan_6ghz_params {
247462306a36Sopenharmony_ci	u32 short_ssid;
247562306a36Sopenharmony_ci	u32 channel_idx;
247662306a36Sopenharmony_ci	u8 bssid[ETH_ALEN];
247762306a36Sopenharmony_ci	bool unsolicited_probe;
247862306a36Sopenharmony_ci	bool short_ssid_valid;
247962306a36Sopenharmony_ci	bool psc_no_listen;
248062306a36Sopenharmony_ci	s8 psd_20;
248162306a36Sopenharmony_ci};
248262306a36Sopenharmony_ci
248362306a36Sopenharmony_ci/**
248462306a36Sopenharmony_ci * struct cfg80211_scan_request - scan request description
248562306a36Sopenharmony_ci *
248662306a36Sopenharmony_ci * @ssids: SSIDs to scan for (active scan only)
248762306a36Sopenharmony_ci * @n_ssids: number of SSIDs
248862306a36Sopenharmony_ci * @channels: channels to scan on.
248962306a36Sopenharmony_ci * @n_channels: total number of channels to scan
249062306a36Sopenharmony_ci * @scan_width: channel width for scanning
249162306a36Sopenharmony_ci * @ie: optional information element(s) to add into Probe Request or %NULL
249262306a36Sopenharmony_ci * @ie_len: length of ie in octets
249362306a36Sopenharmony_ci * @duration: how long to listen on each channel, in TUs. If
249462306a36Sopenharmony_ci *	%duration_mandatory is not set, this is the maximum dwell time and
249562306a36Sopenharmony_ci *	the actual dwell time may be shorter.
249662306a36Sopenharmony_ci * @duration_mandatory: if set, the scan duration must be as specified by the
249762306a36Sopenharmony_ci *	%duration field.
249862306a36Sopenharmony_ci * @flags: control flags from &enum nl80211_scan_flags
249962306a36Sopenharmony_ci * @rates: bitmap of rates to advertise for each band
250062306a36Sopenharmony_ci * @wiphy: the wiphy this was for
250162306a36Sopenharmony_ci * @scan_start: time (in jiffies) when the scan started
250262306a36Sopenharmony_ci * @wdev: the wireless device to scan for
250362306a36Sopenharmony_ci * @info: (internal) information about completed scan
250462306a36Sopenharmony_ci * @notified: (internal) scan request was notified as done or aborted
250562306a36Sopenharmony_ci * @no_cck: used to send probe requests at non CCK rate in 2GHz band
250662306a36Sopenharmony_ci * @mac_addr: MAC address used with randomisation
250762306a36Sopenharmony_ci * @mac_addr_mask: MAC address mask used with randomisation, bits that
250862306a36Sopenharmony_ci *	are 0 in the mask should be randomised, bits that are 1 should
250962306a36Sopenharmony_ci *	be taken from the @mac_addr
251062306a36Sopenharmony_ci * @scan_6ghz: relevant for split scan request only,
251162306a36Sopenharmony_ci *	true if this is the second scan request
251262306a36Sopenharmony_ci * @n_6ghz_params: number of 6 GHz params
251362306a36Sopenharmony_ci * @scan_6ghz_params: 6 GHz params
251462306a36Sopenharmony_ci * @bssid: BSSID to scan for (most commonly, the wildcard BSSID)
251562306a36Sopenharmony_ci */
251662306a36Sopenharmony_cistruct cfg80211_scan_request {
251762306a36Sopenharmony_ci	struct cfg80211_ssid *ssids;
251862306a36Sopenharmony_ci	int n_ssids;
251962306a36Sopenharmony_ci	u32 n_channels;
252062306a36Sopenharmony_ci	enum nl80211_bss_scan_width scan_width;
252162306a36Sopenharmony_ci	const u8 *ie;
252262306a36Sopenharmony_ci	size_t ie_len;
252362306a36Sopenharmony_ci	u16 duration;
252462306a36Sopenharmony_ci	bool duration_mandatory;
252562306a36Sopenharmony_ci	u32 flags;
252662306a36Sopenharmony_ci
252762306a36Sopenharmony_ci	u32 rates[NUM_NL80211_BANDS];
252862306a36Sopenharmony_ci
252962306a36Sopenharmony_ci	struct wireless_dev *wdev;
253062306a36Sopenharmony_ci
253162306a36Sopenharmony_ci	u8 mac_addr[ETH_ALEN] __aligned(2);
253262306a36Sopenharmony_ci	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
253362306a36Sopenharmony_ci	u8 bssid[ETH_ALEN] __aligned(2);
253462306a36Sopenharmony_ci
253562306a36Sopenharmony_ci	/* internal */
253662306a36Sopenharmony_ci	struct wiphy *wiphy;
253762306a36Sopenharmony_ci	unsigned long scan_start;
253862306a36Sopenharmony_ci	struct cfg80211_scan_info info;
253962306a36Sopenharmony_ci	bool notified;
254062306a36Sopenharmony_ci	bool no_cck;
254162306a36Sopenharmony_ci	bool scan_6ghz;
254262306a36Sopenharmony_ci	u32 n_6ghz_params;
254362306a36Sopenharmony_ci	struct cfg80211_scan_6ghz_params *scan_6ghz_params;
254462306a36Sopenharmony_ci
254562306a36Sopenharmony_ci	/* keep last */
254662306a36Sopenharmony_ci	struct ieee80211_channel *channels[] __counted_by(n_channels);
254762306a36Sopenharmony_ci};
254862306a36Sopenharmony_ci
254962306a36Sopenharmony_cistatic inline void get_random_mask_addr(u8 *buf, const u8 *addr, const u8 *mask)
255062306a36Sopenharmony_ci{
255162306a36Sopenharmony_ci	int i;
255262306a36Sopenharmony_ci
255362306a36Sopenharmony_ci	get_random_bytes(buf, ETH_ALEN);
255462306a36Sopenharmony_ci	for (i = 0; i < ETH_ALEN; i++) {
255562306a36Sopenharmony_ci		buf[i] &= ~mask[i];
255662306a36Sopenharmony_ci		buf[i] |= addr[i] & mask[i];
255762306a36Sopenharmony_ci	}
255862306a36Sopenharmony_ci}
255962306a36Sopenharmony_ci
256062306a36Sopenharmony_ci/**
256162306a36Sopenharmony_ci * struct cfg80211_match_set - sets of attributes to match
256262306a36Sopenharmony_ci *
256362306a36Sopenharmony_ci * @ssid: SSID to be matched; may be zero-length in case of BSSID match
256462306a36Sopenharmony_ci *	or no match (RSSI only)
256562306a36Sopenharmony_ci * @bssid: BSSID to be matched; may be all-zero BSSID in case of SSID match
256662306a36Sopenharmony_ci *	or no match (RSSI only)
256762306a36Sopenharmony_ci * @rssi_thold: don't report scan results below this threshold (in s32 dBm)
256862306a36Sopenharmony_ci * @per_band_rssi_thold: Minimum rssi threshold for each band to be applied
256962306a36Sopenharmony_ci *	for filtering out scan results received. Drivers advertize this support
257062306a36Sopenharmony_ci *	of band specific rssi based filtering through the feature capability
257162306a36Sopenharmony_ci *	%NL80211_EXT_FEATURE_SCHED_SCAN_BAND_SPECIFIC_RSSI_THOLD. These band
257262306a36Sopenharmony_ci *	specific rssi thresholds take precedence over rssi_thold, if specified.
257362306a36Sopenharmony_ci *	If not specified for any band, it will be assigned with rssi_thold of
257462306a36Sopenharmony_ci *	corresponding matchset.
257562306a36Sopenharmony_ci */
257662306a36Sopenharmony_cistruct cfg80211_match_set {
257762306a36Sopenharmony_ci	struct cfg80211_ssid ssid;
257862306a36Sopenharmony_ci	u8 bssid[ETH_ALEN];
257962306a36Sopenharmony_ci	s32 rssi_thold;
258062306a36Sopenharmony_ci	s32 per_band_rssi_thold[NUM_NL80211_BANDS];
258162306a36Sopenharmony_ci};
258262306a36Sopenharmony_ci
258362306a36Sopenharmony_ci/**
258462306a36Sopenharmony_ci * struct cfg80211_sched_scan_plan - scan plan for scheduled scan
258562306a36Sopenharmony_ci *
258662306a36Sopenharmony_ci * @interval: interval between scheduled scan iterations. In seconds.
258762306a36Sopenharmony_ci * @iterations: number of scan iterations in this scan plan. Zero means
258862306a36Sopenharmony_ci *	infinite loop.
258962306a36Sopenharmony_ci *	The last scan plan will always have this parameter set to zero,
259062306a36Sopenharmony_ci *	all other scan plans will have a finite number of iterations.
259162306a36Sopenharmony_ci */
259262306a36Sopenharmony_cistruct cfg80211_sched_scan_plan {
259362306a36Sopenharmony_ci	u32 interval;
259462306a36Sopenharmony_ci	u32 iterations;
259562306a36Sopenharmony_ci};
259662306a36Sopenharmony_ci
259762306a36Sopenharmony_ci/**
259862306a36Sopenharmony_ci * struct cfg80211_bss_select_adjust - BSS selection with RSSI adjustment.
259962306a36Sopenharmony_ci *
260062306a36Sopenharmony_ci * @band: band of BSS which should match for RSSI level adjustment.
260162306a36Sopenharmony_ci * @delta: value of RSSI level adjustment.
260262306a36Sopenharmony_ci */
260362306a36Sopenharmony_cistruct cfg80211_bss_select_adjust {
260462306a36Sopenharmony_ci	enum nl80211_band band;
260562306a36Sopenharmony_ci	s8 delta;
260662306a36Sopenharmony_ci};
260762306a36Sopenharmony_ci
260862306a36Sopenharmony_ci/**
260962306a36Sopenharmony_ci * struct cfg80211_sched_scan_request - scheduled scan request description
261062306a36Sopenharmony_ci *
261162306a36Sopenharmony_ci * @reqid: identifies this request.
261262306a36Sopenharmony_ci * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans)
261362306a36Sopenharmony_ci * @n_ssids: number of SSIDs
261462306a36Sopenharmony_ci * @n_channels: total number of channels to scan
261562306a36Sopenharmony_ci * @scan_width: channel width for scanning
261662306a36Sopenharmony_ci * @ie: optional information element(s) to add into Probe Request or %NULL
261762306a36Sopenharmony_ci * @ie_len: length of ie in octets
261862306a36Sopenharmony_ci * @flags: control flags from &enum nl80211_scan_flags
261962306a36Sopenharmony_ci * @match_sets: sets of parameters to be matched for a scan result
262062306a36Sopenharmony_ci *	entry to be considered valid and to be passed to the host
262162306a36Sopenharmony_ci *	(others are filtered out).
262262306a36Sopenharmony_ci *	If ommited, all results are passed.
262362306a36Sopenharmony_ci * @n_match_sets: number of match sets
262462306a36Sopenharmony_ci * @report_results: indicates that results were reported for this request
262562306a36Sopenharmony_ci * @wiphy: the wiphy this was for
262662306a36Sopenharmony_ci * @dev: the interface
262762306a36Sopenharmony_ci * @scan_start: start time of the scheduled scan
262862306a36Sopenharmony_ci * @channels: channels to scan
262962306a36Sopenharmony_ci * @min_rssi_thold: for drivers only supporting a single threshold, this
263062306a36Sopenharmony_ci *	contains the minimum over all matchsets
263162306a36Sopenharmony_ci * @mac_addr: MAC address used with randomisation
263262306a36Sopenharmony_ci * @mac_addr_mask: MAC address mask used with randomisation, bits that
263362306a36Sopenharmony_ci *	are 0 in the mask should be randomised, bits that are 1 should
263462306a36Sopenharmony_ci *	be taken from the @mac_addr
263562306a36Sopenharmony_ci * @scan_plans: scan plans to be executed in this scheduled scan. Lowest
263662306a36Sopenharmony_ci *	index must be executed first.
263762306a36Sopenharmony_ci * @n_scan_plans: number of scan plans, at least 1.
263862306a36Sopenharmony_ci * @rcu_head: RCU callback used to free the struct
263962306a36Sopenharmony_ci * @owner_nlportid: netlink portid of owner (if this should is a request
264062306a36Sopenharmony_ci *	owned by a particular socket)
264162306a36Sopenharmony_ci * @nl_owner_dead: netlink owner socket was closed - this request be freed
264262306a36Sopenharmony_ci * @list: for keeping list of requests.
264362306a36Sopenharmony_ci * @delay: delay in seconds to use before starting the first scan
264462306a36Sopenharmony_ci *	cycle.  The driver may ignore this parameter and start
264562306a36Sopenharmony_ci *	immediately (or at any other time), if this feature is not
264662306a36Sopenharmony_ci *	supported.
264762306a36Sopenharmony_ci * @relative_rssi_set: Indicates whether @relative_rssi is set or not.
264862306a36Sopenharmony_ci * @relative_rssi: Relative RSSI threshold in dB to restrict scan result
264962306a36Sopenharmony_ci *	reporting in connected state to cases where a matching BSS is determined
265062306a36Sopenharmony_ci *	to have better or slightly worse RSSI than the current connected BSS.
265162306a36Sopenharmony_ci *	The relative RSSI threshold values are ignored in disconnected state.
265262306a36Sopenharmony_ci * @rssi_adjust: delta dB of RSSI preference to be given to the BSSs that belong
265362306a36Sopenharmony_ci *	to the specified band while deciding whether a better BSS is reported
265462306a36Sopenharmony_ci *	using @relative_rssi. If delta is a negative number, the BSSs that
265562306a36Sopenharmony_ci *	belong to the specified band will be penalized by delta dB in relative
265662306a36Sopenharmony_ci *	comparisions.
265762306a36Sopenharmony_ci */
265862306a36Sopenharmony_cistruct cfg80211_sched_scan_request {
265962306a36Sopenharmony_ci	u64 reqid;
266062306a36Sopenharmony_ci	struct cfg80211_ssid *ssids;
266162306a36Sopenharmony_ci	int n_ssids;
266262306a36Sopenharmony_ci	u32 n_channels;
266362306a36Sopenharmony_ci	enum nl80211_bss_scan_width scan_width;
266462306a36Sopenharmony_ci	const u8 *ie;
266562306a36Sopenharmony_ci	size_t ie_len;
266662306a36Sopenharmony_ci	u32 flags;
266762306a36Sopenharmony_ci	struct cfg80211_match_set *match_sets;
266862306a36Sopenharmony_ci	int n_match_sets;
266962306a36Sopenharmony_ci	s32 min_rssi_thold;
267062306a36Sopenharmony_ci	u32 delay;
267162306a36Sopenharmony_ci	struct cfg80211_sched_scan_plan *scan_plans;
267262306a36Sopenharmony_ci	int n_scan_plans;
267362306a36Sopenharmony_ci
267462306a36Sopenharmony_ci	u8 mac_addr[ETH_ALEN] __aligned(2);
267562306a36Sopenharmony_ci	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
267662306a36Sopenharmony_ci
267762306a36Sopenharmony_ci	bool relative_rssi_set;
267862306a36Sopenharmony_ci	s8 relative_rssi;
267962306a36Sopenharmony_ci	struct cfg80211_bss_select_adjust rssi_adjust;
268062306a36Sopenharmony_ci
268162306a36Sopenharmony_ci	/* internal */
268262306a36Sopenharmony_ci	struct wiphy *wiphy;
268362306a36Sopenharmony_ci	struct net_device *dev;
268462306a36Sopenharmony_ci	unsigned long scan_start;
268562306a36Sopenharmony_ci	bool report_results;
268662306a36Sopenharmony_ci	struct rcu_head rcu_head;
268762306a36Sopenharmony_ci	u32 owner_nlportid;
268862306a36Sopenharmony_ci	bool nl_owner_dead;
268962306a36Sopenharmony_ci	struct list_head list;
269062306a36Sopenharmony_ci
269162306a36Sopenharmony_ci	/* keep last */
269262306a36Sopenharmony_ci	struct ieee80211_channel *channels[];
269362306a36Sopenharmony_ci};
269462306a36Sopenharmony_ci
269562306a36Sopenharmony_ci/**
269662306a36Sopenharmony_ci * enum cfg80211_signal_type - signal type
269762306a36Sopenharmony_ci *
269862306a36Sopenharmony_ci * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
269962306a36Sopenharmony_ci * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
270062306a36Sopenharmony_ci * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
270162306a36Sopenharmony_ci */
270262306a36Sopenharmony_cienum cfg80211_signal_type {
270362306a36Sopenharmony_ci	CFG80211_SIGNAL_TYPE_NONE,
270462306a36Sopenharmony_ci	CFG80211_SIGNAL_TYPE_MBM,
270562306a36Sopenharmony_ci	CFG80211_SIGNAL_TYPE_UNSPEC,
270662306a36Sopenharmony_ci};
270762306a36Sopenharmony_ci
270862306a36Sopenharmony_ci/**
270962306a36Sopenharmony_ci * struct cfg80211_inform_bss - BSS inform data
271062306a36Sopenharmony_ci * @chan: channel the frame was received on
271162306a36Sopenharmony_ci * @scan_width: scan width that was used
271262306a36Sopenharmony_ci * @signal: signal strength value, according to the wiphy's
271362306a36Sopenharmony_ci *	signal type
271462306a36Sopenharmony_ci * @boottime_ns: timestamp (CLOCK_BOOTTIME) when the information was
271562306a36Sopenharmony_ci *	received; should match the time when the frame was actually
271662306a36Sopenharmony_ci *	received by the device (not just by the host, in case it was
271762306a36Sopenharmony_ci *	buffered on the device) and be accurate to about 10ms.
271862306a36Sopenharmony_ci *	If the frame isn't buffered, just passing the return value of
271962306a36Sopenharmony_ci *	ktime_get_boottime_ns() is likely appropriate.
272062306a36Sopenharmony_ci * @parent_tsf: the time at the start of reception of the first octet of the
272162306a36Sopenharmony_ci *	timestamp field of the frame. The time is the TSF of the BSS specified
272262306a36Sopenharmony_ci *	by %parent_bssid.
272362306a36Sopenharmony_ci * @parent_bssid: the BSS according to which %parent_tsf is set. This is set to
272462306a36Sopenharmony_ci *	the BSS that requested the scan in which the beacon/probe was received.
272562306a36Sopenharmony_ci * @chains: bitmask for filled values in @chain_signal.
272662306a36Sopenharmony_ci * @chain_signal: per-chain signal strength of last received BSS in dBm.
272762306a36Sopenharmony_ci * @drv_data: Data to be passed through to @inform_bss
272862306a36Sopenharmony_ci */
272962306a36Sopenharmony_cistruct cfg80211_inform_bss {
273062306a36Sopenharmony_ci	struct ieee80211_channel *chan;
273162306a36Sopenharmony_ci	enum nl80211_bss_scan_width scan_width;
273262306a36Sopenharmony_ci	s32 signal;
273362306a36Sopenharmony_ci	u64 boottime_ns;
273462306a36Sopenharmony_ci	u64 parent_tsf;
273562306a36Sopenharmony_ci	u8 parent_bssid[ETH_ALEN] __aligned(2);
273662306a36Sopenharmony_ci	u8 chains;
273762306a36Sopenharmony_ci	s8 chain_signal[IEEE80211_MAX_CHAINS];
273862306a36Sopenharmony_ci
273962306a36Sopenharmony_ci	void *drv_data;
274062306a36Sopenharmony_ci};
274162306a36Sopenharmony_ci
274262306a36Sopenharmony_ci/**
274362306a36Sopenharmony_ci * struct cfg80211_bss_ies - BSS entry IE data
274462306a36Sopenharmony_ci * @tsf: TSF contained in the frame that carried these IEs
274562306a36Sopenharmony_ci * @rcu_head: internal use, for freeing
274662306a36Sopenharmony_ci * @len: length of the IEs
274762306a36Sopenharmony_ci * @from_beacon: these IEs are known to come from a beacon
274862306a36Sopenharmony_ci * @data: IE data
274962306a36Sopenharmony_ci */
275062306a36Sopenharmony_cistruct cfg80211_bss_ies {
275162306a36Sopenharmony_ci	u64 tsf;
275262306a36Sopenharmony_ci	struct rcu_head rcu_head;
275362306a36Sopenharmony_ci	int len;
275462306a36Sopenharmony_ci	bool from_beacon;
275562306a36Sopenharmony_ci	u8 data[];
275662306a36Sopenharmony_ci};
275762306a36Sopenharmony_ci
275862306a36Sopenharmony_ci/**
275962306a36Sopenharmony_ci * struct cfg80211_bss - BSS description
276062306a36Sopenharmony_ci *
276162306a36Sopenharmony_ci * This structure describes a BSS (which may also be a mesh network)
276262306a36Sopenharmony_ci * for use in scan results and similar.
276362306a36Sopenharmony_ci *
276462306a36Sopenharmony_ci * @channel: channel this BSS is on
276562306a36Sopenharmony_ci * @scan_width: width of the control channel
276662306a36Sopenharmony_ci * @bssid: BSSID of the BSS
276762306a36Sopenharmony_ci * @beacon_interval: the beacon interval as from the frame
276862306a36Sopenharmony_ci * @capability: the capability field in host byte order
276962306a36Sopenharmony_ci * @ies: the information elements (Note that there is no guarantee that these
277062306a36Sopenharmony_ci *	are well-formed!); this is a pointer to either the beacon_ies or
277162306a36Sopenharmony_ci *	proberesp_ies depending on whether Probe Response frame has been
277262306a36Sopenharmony_ci *	received. It is always non-%NULL.
277362306a36Sopenharmony_ci * @beacon_ies: the information elements from the last Beacon frame
277462306a36Sopenharmony_ci *	(implementation note: if @hidden_beacon_bss is set this struct doesn't
277562306a36Sopenharmony_ci *	own the beacon_ies, but they're just pointers to the ones from the
277662306a36Sopenharmony_ci *	@hidden_beacon_bss struct)
277762306a36Sopenharmony_ci * @proberesp_ies: the information elements from the last Probe Response frame
277862306a36Sopenharmony_ci * @hidden_beacon_bss: in case this BSS struct represents a probe response from
277962306a36Sopenharmony_ci *	a BSS that hides the SSID in its beacon, this points to the BSS struct
278062306a36Sopenharmony_ci *	that holds the beacon data. @beacon_ies is still valid, of course, and
278162306a36Sopenharmony_ci *	points to the same data as hidden_beacon_bss->beacon_ies in that case.
278262306a36Sopenharmony_ci * @transmitted_bss: pointer to the transmitted BSS, if this is a
278362306a36Sopenharmony_ci *	non-transmitted one (multi-BSSID support)
278462306a36Sopenharmony_ci * @nontrans_list: list of non-transmitted BSS, if this is a transmitted one
278562306a36Sopenharmony_ci *	(multi-BSSID support)
278662306a36Sopenharmony_ci * @signal: signal strength value (type depends on the wiphy's signal_type)
278762306a36Sopenharmony_ci * @chains: bitmask for filled values in @chain_signal.
278862306a36Sopenharmony_ci * @chain_signal: per-chain signal strength of last received BSS in dBm.
278962306a36Sopenharmony_ci * @bssid_index: index in the multiple BSS set
279062306a36Sopenharmony_ci * @max_bssid_indicator: max number of members in the BSS set
279162306a36Sopenharmony_ci * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
279262306a36Sopenharmony_ci */
279362306a36Sopenharmony_cistruct cfg80211_bss {
279462306a36Sopenharmony_ci	struct ieee80211_channel *channel;
279562306a36Sopenharmony_ci	enum nl80211_bss_scan_width scan_width;
279662306a36Sopenharmony_ci
279762306a36Sopenharmony_ci	const struct cfg80211_bss_ies __rcu *ies;
279862306a36Sopenharmony_ci	const struct cfg80211_bss_ies __rcu *beacon_ies;
279962306a36Sopenharmony_ci	const struct cfg80211_bss_ies __rcu *proberesp_ies;
280062306a36Sopenharmony_ci
280162306a36Sopenharmony_ci	struct cfg80211_bss *hidden_beacon_bss;
280262306a36Sopenharmony_ci	struct cfg80211_bss *transmitted_bss;
280362306a36Sopenharmony_ci	struct list_head nontrans_list;
280462306a36Sopenharmony_ci
280562306a36Sopenharmony_ci	s32 signal;
280662306a36Sopenharmony_ci
280762306a36Sopenharmony_ci	u16 beacon_interval;
280862306a36Sopenharmony_ci	u16 capability;
280962306a36Sopenharmony_ci
281062306a36Sopenharmony_ci	u8 bssid[ETH_ALEN];
281162306a36Sopenharmony_ci	u8 chains;
281262306a36Sopenharmony_ci	s8 chain_signal[IEEE80211_MAX_CHAINS];
281362306a36Sopenharmony_ci
281462306a36Sopenharmony_ci	u8 bssid_index;
281562306a36Sopenharmony_ci	u8 max_bssid_indicator;
281662306a36Sopenharmony_ci
281762306a36Sopenharmony_ci	u8 priv[] __aligned(sizeof(void *));
281862306a36Sopenharmony_ci};
281962306a36Sopenharmony_ci
282062306a36Sopenharmony_ci/**
282162306a36Sopenharmony_ci * ieee80211_bss_get_elem - find element with given ID
282262306a36Sopenharmony_ci * @bss: the bss to search
282362306a36Sopenharmony_ci * @id: the element ID
282462306a36Sopenharmony_ci *
282562306a36Sopenharmony_ci * Note that the return value is an RCU-protected pointer, so
282662306a36Sopenharmony_ci * rcu_read_lock() must be held when calling this function.
282762306a36Sopenharmony_ci * Return: %NULL if not found.
282862306a36Sopenharmony_ci */
282962306a36Sopenharmony_ciconst struct element *ieee80211_bss_get_elem(struct cfg80211_bss *bss, u8 id);
283062306a36Sopenharmony_ci
283162306a36Sopenharmony_ci/**
283262306a36Sopenharmony_ci * ieee80211_bss_get_ie - find IE with given ID
283362306a36Sopenharmony_ci * @bss: the bss to search
283462306a36Sopenharmony_ci * @id: the element ID
283562306a36Sopenharmony_ci *
283662306a36Sopenharmony_ci * Note that the return value is an RCU-protected pointer, so
283762306a36Sopenharmony_ci * rcu_read_lock() must be held when calling this function.
283862306a36Sopenharmony_ci * Return: %NULL if not found.
283962306a36Sopenharmony_ci */
284062306a36Sopenharmony_cistatic inline const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 id)
284162306a36Sopenharmony_ci{
284262306a36Sopenharmony_ci	return (const void *)ieee80211_bss_get_elem(bss, id);
284362306a36Sopenharmony_ci}
284462306a36Sopenharmony_ci
284562306a36Sopenharmony_ci
284662306a36Sopenharmony_ci/**
284762306a36Sopenharmony_ci * struct cfg80211_auth_request - Authentication request data
284862306a36Sopenharmony_ci *
284962306a36Sopenharmony_ci * This structure provides information needed to complete IEEE 802.11
285062306a36Sopenharmony_ci * authentication.
285162306a36Sopenharmony_ci *
285262306a36Sopenharmony_ci * @bss: The BSS to authenticate with, the callee must obtain a reference
285362306a36Sopenharmony_ci *	to it if it needs to keep it.
285462306a36Sopenharmony_ci * @auth_type: Authentication type (algorithm)
285562306a36Sopenharmony_ci * @ie: Extra IEs to add to Authentication frame or %NULL
285662306a36Sopenharmony_ci * @ie_len: Length of ie buffer in octets
285762306a36Sopenharmony_ci * @key_len: length of WEP key for shared key authentication
285862306a36Sopenharmony_ci * @key_idx: index of WEP key for shared key authentication
285962306a36Sopenharmony_ci * @key: WEP key for shared key authentication
286062306a36Sopenharmony_ci * @auth_data: Fields and elements in Authentication frames. This contains
286162306a36Sopenharmony_ci *	the authentication frame body (non-IE and IE data), excluding the
286262306a36Sopenharmony_ci *	Authentication algorithm number, i.e., starting at the Authentication
286362306a36Sopenharmony_ci *	transaction sequence number field.
286462306a36Sopenharmony_ci * @auth_data_len: Length of auth_data buffer in octets
286562306a36Sopenharmony_ci * @link_id: if >= 0, indicates authentication should be done as an MLD,
286662306a36Sopenharmony_ci *	the interface address is included as the MLD address and the
286762306a36Sopenharmony_ci *	necessary link (with the given link_id) will be created (and
286862306a36Sopenharmony_ci *	given an MLD address) by the driver
286962306a36Sopenharmony_ci * @ap_mld_addr: AP MLD address in case of authentication request with
287062306a36Sopenharmony_ci *	an AP MLD, valid iff @link_id >= 0
287162306a36Sopenharmony_ci */
287262306a36Sopenharmony_cistruct cfg80211_auth_request {
287362306a36Sopenharmony_ci	struct cfg80211_bss *bss;
287462306a36Sopenharmony_ci	const u8 *ie;
287562306a36Sopenharmony_ci	size_t ie_len;
287662306a36Sopenharmony_ci	enum nl80211_auth_type auth_type;
287762306a36Sopenharmony_ci	const u8 *key;
287862306a36Sopenharmony_ci	u8 key_len;
287962306a36Sopenharmony_ci	s8 key_idx;
288062306a36Sopenharmony_ci	const u8 *auth_data;
288162306a36Sopenharmony_ci	size_t auth_data_len;
288262306a36Sopenharmony_ci	s8 link_id;
288362306a36Sopenharmony_ci	const u8 *ap_mld_addr;
288462306a36Sopenharmony_ci};
288562306a36Sopenharmony_ci
288662306a36Sopenharmony_ci/**
288762306a36Sopenharmony_ci * struct cfg80211_assoc_link - per-link information for MLO association
288862306a36Sopenharmony_ci * @bss: the BSS pointer, see also &struct cfg80211_assoc_request::bss;
288962306a36Sopenharmony_ci *	if this is %NULL for a link, that link is not requested
289062306a36Sopenharmony_ci * @elems: extra elements for the per-STA profile for this link
289162306a36Sopenharmony_ci * @elems_len: length of the elements
289262306a36Sopenharmony_ci * @disabled: If set this link should be included during association etc. but it
289362306a36Sopenharmony_ci *	should not be used until enabled by the AP MLD.
289462306a36Sopenharmony_ci */
289562306a36Sopenharmony_cistruct cfg80211_assoc_link {
289662306a36Sopenharmony_ci	struct cfg80211_bss *bss;
289762306a36Sopenharmony_ci	const u8 *elems;
289862306a36Sopenharmony_ci	size_t elems_len;
289962306a36Sopenharmony_ci	bool disabled;
290062306a36Sopenharmony_ci};
290162306a36Sopenharmony_ci
290262306a36Sopenharmony_ci/**
290362306a36Sopenharmony_ci * enum cfg80211_assoc_req_flags - Over-ride default behaviour in association.
290462306a36Sopenharmony_ci *
290562306a36Sopenharmony_ci * @ASSOC_REQ_DISABLE_HT:  Disable HT (802.11n)
290662306a36Sopenharmony_ci * @ASSOC_REQ_DISABLE_VHT:  Disable VHT
290762306a36Sopenharmony_ci * @ASSOC_REQ_USE_RRM: Declare RRM capability in this association
290862306a36Sopenharmony_ci * @CONNECT_REQ_EXTERNAL_AUTH_SUPPORT: User space indicates external
290962306a36Sopenharmony_ci *	authentication capability. Drivers can offload authentication to
291062306a36Sopenharmony_ci *	userspace if this flag is set. Only applicable for cfg80211_connect()
291162306a36Sopenharmony_ci *	request (connect callback).
291262306a36Sopenharmony_ci * @ASSOC_REQ_DISABLE_HE:  Disable HE
291362306a36Sopenharmony_ci * @ASSOC_REQ_DISABLE_EHT:  Disable EHT
291462306a36Sopenharmony_ci * @CONNECT_REQ_MLO_SUPPORT: Userspace indicates support for handling MLD links.
291562306a36Sopenharmony_ci *	Drivers shall disable MLO features for the current association if this
291662306a36Sopenharmony_ci *	flag is not set.
291762306a36Sopenharmony_ci */
291862306a36Sopenharmony_cienum cfg80211_assoc_req_flags {
291962306a36Sopenharmony_ci	ASSOC_REQ_DISABLE_HT			= BIT(0),
292062306a36Sopenharmony_ci	ASSOC_REQ_DISABLE_VHT			= BIT(1),
292162306a36Sopenharmony_ci	ASSOC_REQ_USE_RRM			= BIT(2),
292262306a36Sopenharmony_ci	CONNECT_REQ_EXTERNAL_AUTH_SUPPORT	= BIT(3),
292362306a36Sopenharmony_ci	ASSOC_REQ_DISABLE_HE			= BIT(4),
292462306a36Sopenharmony_ci	ASSOC_REQ_DISABLE_EHT			= BIT(5),
292562306a36Sopenharmony_ci	CONNECT_REQ_MLO_SUPPORT			= BIT(6),
292662306a36Sopenharmony_ci};
292762306a36Sopenharmony_ci
292862306a36Sopenharmony_ci/**
292962306a36Sopenharmony_ci * struct cfg80211_assoc_request - (Re)Association request data
293062306a36Sopenharmony_ci *
293162306a36Sopenharmony_ci * This structure provides information needed to complete IEEE 802.11
293262306a36Sopenharmony_ci * (re)association.
293362306a36Sopenharmony_ci * @bss: The BSS to associate with. If the call is successful the driver is
293462306a36Sopenharmony_ci *	given a reference that it must give back to cfg80211_send_rx_assoc()
293562306a36Sopenharmony_ci *	or to cfg80211_assoc_timeout(). To ensure proper refcounting, new
293662306a36Sopenharmony_ci *	association requests while already associating must be rejected.
293762306a36Sopenharmony_ci *	This also applies to the @links.bss parameter, which is used instead
293862306a36Sopenharmony_ci *	of this one (it is %NULL) for MLO associations.
293962306a36Sopenharmony_ci * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
294062306a36Sopenharmony_ci * @ie_len: Length of ie buffer in octets
294162306a36Sopenharmony_ci * @use_mfp: Use management frame protection (IEEE 802.11w) in this association
294262306a36Sopenharmony_ci * @crypto: crypto settings
294362306a36Sopenharmony_ci * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
294462306a36Sopenharmony_ci *	to indicate a request to reassociate within the ESS instead of a request
294562306a36Sopenharmony_ci *	do the initial association with the ESS. When included, this is set to
294662306a36Sopenharmony_ci *	the BSSID of the current association, i.e., to the value that is
294762306a36Sopenharmony_ci *	included in the Current AP address field of the Reassociation Request
294862306a36Sopenharmony_ci *	frame.
294962306a36Sopenharmony_ci * @flags:  See &enum cfg80211_assoc_req_flags
295062306a36Sopenharmony_ci * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
295162306a36Sopenharmony_ci *	will be used in ht_capa.  Un-supported values will be ignored.
295262306a36Sopenharmony_ci * @ht_capa_mask:  The bits of ht_capa which are to be used.
295362306a36Sopenharmony_ci * @vht_capa: VHT capability override
295462306a36Sopenharmony_ci * @vht_capa_mask: VHT capability mask indicating which fields to use
295562306a36Sopenharmony_ci * @fils_kek: FILS KEK for protecting (Re)Association Request/Response frame or
295662306a36Sopenharmony_ci *	%NULL if FILS is not used.
295762306a36Sopenharmony_ci * @fils_kek_len: Length of fils_kek in octets
295862306a36Sopenharmony_ci * @fils_nonces: FILS nonces (part of AAD) for protecting (Re)Association
295962306a36Sopenharmony_ci *	Request/Response frame or %NULL if FILS is not used. This field starts
296062306a36Sopenharmony_ci *	with 16 octets of STA Nonce followed by 16 octets of AP Nonce.
296162306a36Sopenharmony_ci * @s1g_capa: S1G capability override
296262306a36Sopenharmony_ci * @s1g_capa_mask: S1G capability override mask
296362306a36Sopenharmony_ci * @links: per-link information for MLO connections
296462306a36Sopenharmony_ci * @link_id: >= 0 for MLO connections, where links are given, and indicates
296562306a36Sopenharmony_ci *	the link on which the association request should be sent
296662306a36Sopenharmony_ci * @ap_mld_addr: AP MLD address in case of MLO association request,
296762306a36Sopenharmony_ci *	valid iff @link_id >= 0
296862306a36Sopenharmony_ci */
296962306a36Sopenharmony_cistruct cfg80211_assoc_request {
297062306a36Sopenharmony_ci	struct cfg80211_bss *bss;
297162306a36Sopenharmony_ci	const u8 *ie, *prev_bssid;
297262306a36Sopenharmony_ci	size_t ie_len;
297362306a36Sopenharmony_ci	struct cfg80211_crypto_settings crypto;
297462306a36Sopenharmony_ci	bool use_mfp;
297562306a36Sopenharmony_ci	u32 flags;
297662306a36Sopenharmony_ci	struct ieee80211_ht_cap ht_capa;
297762306a36Sopenharmony_ci	struct ieee80211_ht_cap ht_capa_mask;
297862306a36Sopenharmony_ci	struct ieee80211_vht_cap vht_capa, vht_capa_mask;
297962306a36Sopenharmony_ci	const u8 *fils_kek;
298062306a36Sopenharmony_ci	size_t fils_kek_len;
298162306a36Sopenharmony_ci	const u8 *fils_nonces;
298262306a36Sopenharmony_ci	struct ieee80211_s1g_cap s1g_capa, s1g_capa_mask;
298362306a36Sopenharmony_ci	struct cfg80211_assoc_link links[IEEE80211_MLD_MAX_NUM_LINKS];
298462306a36Sopenharmony_ci	const u8 *ap_mld_addr;
298562306a36Sopenharmony_ci	s8 link_id;
298662306a36Sopenharmony_ci};
298762306a36Sopenharmony_ci
298862306a36Sopenharmony_ci/**
298962306a36Sopenharmony_ci * struct cfg80211_deauth_request - Deauthentication request data
299062306a36Sopenharmony_ci *
299162306a36Sopenharmony_ci * This structure provides information needed to complete IEEE 802.11
299262306a36Sopenharmony_ci * deauthentication.
299362306a36Sopenharmony_ci *
299462306a36Sopenharmony_ci * @bssid: the BSSID or AP MLD address to deauthenticate from
299562306a36Sopenharmony_ci * @ie: Extra IEs to add to Deauthentication frame or %NULL
299662306a36Sopenharmony_ci * @ie_len: Length of ie buffer in octets
299762306a36Sopenharmony_ci * @reason_code: The reason code for the deauthentication
299862306a36Sopenharmony_ci * @local_state_change: if set, change local state only and
299962306a36Sopenharmony_ci *	do not set a deauth frame
300062306a36Sopenharmony_ci */
300162306a36Sopenharmony_cistruct cfg80211_deauth_request {
300262306a36Sopenharmony_ci	const u8 *bssid;
300362306a36Sopenharmony_ci	const u8 *ie;
300462306a36Sopenharmony_ci	size_t ie_len;
300562306a36Sopenharmony_ci	u16 reason_code;
300662306a36Sopenharmony_ci	bool local_state_change;
300762306a36Sopenharmony_ci};
300862306a36Sopenharmony_ci
300962306a36Sopenharmony_ci/**
301062306a36Sopenharmony_ci * struct cfg80211_disassoc_request - Disassociation request data
301162306a36Sopenharmony_ci *
301262306a36Sopenharmony_ci * This structure provides information needed to complete IEEE 802.11
301362306a36Sopenharmony_ci * disassociation.
301462306a36Sopenharmony_ci *
301562306a36Sopenharmony_ci * @ap_addr: the BSSID or AP MLD address to disassociate from
301662306a36Sopenharmony_ci * @ie: Extra IEs to add to Disassociation frame or %NULL
301762306a36Sopenharmony_ci * @ie_len: Length of ie buffer in octets
301862306a36Sopenharmony_ci * @reason_code: The reason code for the disassociation
301962306a36Sopenharmony_ci * @local_state_change: This is a request for a local state only, i.e., no
302062306a36Sopenharmony_ci *	Disassociation frame is to be transmitted.
302162306a36Sopenharmony_ci */
302262306a36Sopenharmony_cistruct cfg80211_disassoc_request {
302362306a36Sopenharmony_ci	const u8 *ap_addr;
302462306a36Sopenharmony_ci	const u8 *ie;
302562306a36Sopenharmony_ci	size_t ie_len;
302662306a36Sopenharmony_ci	u16 reason_code;
302762306a36Sopenharmony_ci	bool local_state_change;
302862306a36Sopenharmony_ci};
302962306a36Sopenharmony_ci
303062306a36Sopenharmony_ci/**
303162306a36Sopenharmony_ci * struct cfg80211_ibss_params - IBSS parameters
303262306a36Sopenharmony_ci *
303362306a36Sopenharmony_ci * This structure defines the IBSS parameters for the join_ibss()
303462306a36Sopenharmony_ci * method.
303562306a36Sopenharmony_ci *
303662306a36Sopenharmony_ci * @ssid: The SSID, will always be non-null.
303762306a36Sopenharmony_ci * @ssid_len: The length of the SSID, will always be non-zero.
303862306a36Sopenharmony_ci * @bssid: Fixed BSSID requested, maybe be %NULL, if set do not
303962306a36Sopenharmony_ci *	search for IBSSs with a different BSSID.
304062306a36Sopenharmony_ci * @chandef: defines the channel to use if no other IBSS to join can be found
304162306a36Sopenharmony_ci * @channel_fixed: The channel should be fixed -- do not search for
304262306a36Sopenharmony_ci *	IBSSs to join on other channels.
304362306a36Sopenharmony_ci * @ie: information element(s) to include in the beacon
304462306a36Sopenharmony_ci * @ie_len: length of that
304562306a36Sopenharmony_ci * @beacon_interval: beacon interval to use
304662306a36Sopenharmony_ci * @privacy: this is a protected network, keys will be configured
304762306a36Sopenharmony_ci *	after joining
304862306a36Sopenharmony_ci * @control_port: whether user space controls IEEE 802.1X port, i.e.,
304962306a36Sopenharmony_ci *	sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
305062306a36Sopenharmony_ci *	required to assume that the port is unauthorized until authorized by
305162306a36Sopenharmony_ci *	user space. Otherwise, port is marked authorized by default.
305262306a36Sopenharmony_ci * @control_port_over_nl80211: TRUE if userspace expects to exchange control
305362306a36Sopenharmony_ci *	port frames over NL80211 instead of the network interface.
305462306a36Sopenharmony_ci * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
305562306a36Sopenharmony_ci *	changes the channel when a radar is detected. This is required
305662306a36Sopenharmony_ci *	to operate on DFS channels.
305762306a36Sopenharmony_ci * @basic_rates: bitmap of basic rates to use when creating the IBSS
305862306a36Sopenharmony_ci * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
305962306a36Sopenharmony_ci * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
306062306a36Sopenharmony_ci *	will be used in ht_capa.  Un-supported values will be ignored.
306162306a36Sopenharmony_ci * @ht_capa_mask:  The bits of ht_capa which are to be used.
306262306a36Sopenharmony_ci * @wep_keys: static WEP keys, if not NULL points to an array of
306362306a36Sopenharmony_ci *	CFG80211_MAX_WEP_KEYS WEP keys
306462306a36Sopenharmony_ci * @wep_tx_key: key index (0..3) of the default TX static WEP key
306562306a36Sopenharmony_ci */
306662306a36Sopenharmony_cistruct cfg80211_ibss_params {
306762306a36Sopenharmony_ci	const u8 *ssid;
306862306a36Sopenharmony_ci	const u8 *bssid;
306962306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
307062306a36Sopenharmony_ci	const u8 *ie;
307162306a36Sopenharmony_ci	u8 ssid_len, ie_len;
307262306a36Sopenharmony_ci	u16 beacon_interval;
307362306a36Sopenharmony_ci	u32 basic_rates;
307462306a36Sopenharmony_ci	bool channel_fixed;
307562306a36Sopenharmony_ci	bool privacy;
307662306a36Sopenharmony_ci	bool control_port;
307762306a36Sopenharmony_ci	bool control_port_over_nl80211;
307862306a36Sopenharmony_ci	bool userspace_handles_dfs;
307962306a36Sopenharmony_ci	int mcast_rate[NUM_NL80211_BANDS];
308062306a36Sopenharmony_ci	struct ieee80211_ht_cap ht_capa;
308162306a36Sopenharmony_ci	struct ieee80211_ht_cap ht_capa_mask;
308262306a36Sopenharmony_ci	struct key_params *wep_keys;
308362306a36Sopenharmony_ci	int wep_tx_key;
308462306a36Sopenharmony_ci};
308562306a36Sopenharmony_ci
308662306a36Sopenharmony_ci/**
308762306a36Sopenharmony_ci * struct cfg80211_bss_selection - connection parameters for BSS selection.
308862306a36Sopenharmony_ci *
308962306a36Sopenharmony_ci * @behaviour: requested BSS selection behaviour.
309062306a36Sopenharmony_ci * @param: parameters for requestion behaviour.
309162306a36Sopenharmony_ci * @band_pref: preferred band for %NL80211_BSS_SELECT_ATTR_BAND_PREF.
309262306a36Sopenharmony_ci * @adjust: parameters for %NL80211_BSS_SELECT_ATTR_RSSI_ADJUST.
309362306a36Sopenharmony_ci */
309462306a36Sopenharmony_cistruct cfg80211_bss_selection {
309562306a36Sopenharmony_ci	enum nl80211_bss_select_attr behaviour;
309662306a36Sopenharmony_ci	union {
309762306a36Sopenharmony_ci		enum nl80211_band band_pref;
309862306a36Sopenharmony_ci		struct cfg80211_bss_select_adjust adjust;
309962306a36Sopenharmony_ci	} param;
310062306a36Sopenharmony_ci};
310162306a36Sopenharmony_ci
310262306a36Sopenharmony_ci/**
310362306a36Sopenharmony_ci * struct cfg80211_connect_params - Connection parameters
310462306a36Sopenharmony_ci *
310562306a36Sopenharmony_ci * This structure provides information needed to complete IEEE 802.11
310662306a36Sopenharmony_ci * authentication and association.
310762306a36Sopenharmony_ci *
310862306a36Sopenharmony_ci * @channel: The channel to use or %NULL if not specified (auto-select based
310962306a36Sopenharmony_ci *	on scan results)
311062306a36Sopenharmony_ci * @channel_hint: The channel of the recommended BSS for initial connection or
311162306a36Sopenharmony_ci *	%NULL if not specified
311262306a36Sopenharmony_ci * @bssid: The AP BSSID or %NULL if not specified (auto-select based on scan
311362306a36Sopenharmony_ci *	results)
311462306a36Sopenharmony_ci * @bssid_hint: The recommended AP BSSID for initial connection to the BSS or
311562306a36Sopenharmony_ci *	%NULL if not specified. Unlike the @bssid parameter, the driver is
311662306a36Sopenharmony_ci *	allowed to ignore this @bssid_hint if it has knowledge of a better BSS
311762306a36Sopenharmony_ci *	to use.
311862306a36Sopenharmony_ci * @ssid: SSID
311962306a36Sopenharmony_ci * @ssid_len: Length of ssid in octets
312062306a36Sopenharmony_ci * @auth_type: Authentication type (algorithm)
312162306a36Sopenharmony_ci * @ie: IEs for association request
312262306a36Sopenharmony_ci * @ie_len: Length of assoc_ie in octets
312362306a36Sopenharmony_ci * @privacy: indicates whether privacy-enabled APs should be used
312462306a36Sopenharmony_ci * @mfp: indicate whether management frame protection is used
312562306a36Sopenharmony_ci * @crypto: crypto settings
312662306a36Sopenharmony_ci * @key_len: length of WEP key for shared key authentication
312762306a36Sopenharmony_ci * @key_idx: index of WEP key for shared key authentication
312862306a36Sopenharmony_ci * @key: WEP key for shared key authentication
312962306a36Sopenharmony_ci * @flags:  See &enum cfg80211_assoc_req_flags
313062306a36Sopenharmony_ci * @bg_scan_period:  Background scan period in seconds
313162306a36Sopenharmony_ci *	or -1 to indicate that default value is to be used.
313262306a36Sopenharmony_ci * @ht_capa:  HT Capabilities over-rides.  Values set in ht_capa_mask
313362306a36Sopenharmony_ci *	will be used in ht_capa.  Un-supported values will be ignored.
313462306a36Sopenharmony_ci * @ht_capa_mask:  The bits of ht_capa which are to be used.
313562306a36Sopenharmony_ci * @vht_capa:  VHT Capability overrides
313662306a36Sopenharmony_ci * @vht_capa_mask: The bits of vht_capa which are to be used.
313762306a36Sopenharmony_ci * @pbss: if set, connect to a PCP instead of AP. Valid for DMG
313862306a36Sopenharmony_ci *	networks.
313962306a36Sopenharmony_ci * @bss_select: criteria to be used for BSS selection.
314062306a36Sopenharmony_ci * @prev_bssid: previous BSSID, if not %NULL use reassociate frame. This is used
314162306a36Sopenharmony_ci *	to indicate a request to reassociate within the ESS instead of a request
314262306a36Sopenharmony_ci *	do the initial association with the ESS. When included, this is set to
314362306a36Sopenharmony_ci *	the BSSID of the current association, i.e., to the value that is
314462306a36Sopenharmony_ci *	included in the Current AP address field of the Reassociation Request
314562306a36Sopenharmony_ci *	frame.
314662306a36Sopenharmony_ci * @fils_erp_username: EAP re-authentication protocol (ERP) username part of the
314762306a36Sopenharmony_ci *	NAI or %NULL if not specified. This is used to construct FILS wrapped
314862306a36Sopenharmony_ci *	data IE.
314962306a36Sopenharmony_ci * @fils_erp_username_len: Length of @fils_erp_username in octets.
315062306a36Sopenharmony_ci * @fils_erp_realm: EAP re-authentication protocol (ERP) realm part of NAI or
315162306a36Sopenharmony_ci *	%NULL if not specified. This specifies the domain name of ER server and
315262306a36Sopenharmony_ci *	is used to construct FILS wrapped data IE.
315362306a36Sopenharmony_ci * @fils_erp_realm_len: Length of @fils_erp_realm in octets.
315462306a36Sopenharmony_ci * @fils_erp_next_seq_num: The next sequence number to use in the FILS ERP
315562306a36Sopenharmony_ci *	messages. This is also used to construct FILS wrapped data IE.
315662306a36Sopenharmony_ci * @fils_erp_rrk: ERP re-authentication Root Key (rRK) used to derive additional
315762306a36Sopenharmony_ci *	keys in FILS or %NULL if not specified.
315862306a36Sopenharmony_ci * @fils_erp_rrk_len: Length of @fils_erp_rrk in octets.
315962306a36Sopenharmony_ci * @want_1x: indicates user-space supports and wants to use 802.1X driver
316062306a36Sopenharmony_ci *	offload of 4-way handshake.
316162306a36Sopenharmony_ci * @edmg: define the EDMG channels.
316262306a36Sopenharmony_ci *	This may specify multiple channels and bonding options for the driver
316362306a36Sopenharmony_ci *	to choose from, based on BSS configuration.
316462306a36Sopenharmony_ci */
316562306a36Sopenharmony_cistruct cfg80211_connect_params {
316662306a36Sopenharmony_ci	struct ieee80211_channel *channel;
316762306a36Sopenharmony_ci	struct ieee80211_channel *channel_hint;
316862306a36Sopenharmony_ci	const u8 *bssid;
316962306a36Sopenharmony_ci	const u8 *bssid_hint;
317062306a36Sopenharmony_ci	const u8 *ssid;
317162306a36Sopenharmony_ci	size_t ssid_len;
317262306a36Sopenharmony_ci	enum nl80211_auth_type auth_type;
317362306a36Sopenharmony_ci	const u8 *ie;
317462306a36Sopenharmony_ci	size_t ie_len;
317562306a36Sopenharmony_ci	bool privacy;
317662306a36Sopenharmony_ci	enum nl80211_mfp mfp;
317762306a36Sopenharmony_ci	struct cfg80211_crypto_settings crypto;
317862306a36Sopenharmony_ci	const u8 *key;
317962306a36Sopenharmony_ci	u8 key_len, key_idx;
318062306a36Sopenharmony_ci	u32 flags;
318162306a36Sopenharmony_ci	int bg_scan_period;
318262306a36Sopenharmony_ci	struct ieee80211_ht_cap ht_capa;
318362306a36Sopenharmony_ci	struct ieee80211_ht_cap ht_capa_mask;
318462306a36Sopenharmony_ci	struct ieee80211_vht_cap vht_capa;
318562306a36Sopenharmony_ci	struct ieee80211_vht_cap vht_capa_mask;
318662306a36Sopenharmony_ci	bool pbss;
318762306a36Sopenharmony_ci	struct cfg80211_bss_selection bss_select;
318862306a36Sopenharmony_ci	const u8 *prev_bssid;
318962306a36Sopenharmony_ci	const u8 *fils_erp_username;
319062306a36Sopenharmony_ci	size_t fils_erp_username_len;
319162306a36Sopenharmony_ci	const u8 *fils_erp_realm;
319262306a36Sopenharmony_ci	size_t fils_erp_realm_len;
319362306a36Sopenharmony_ci	u16 fils_erp_next_seq_num;
319462306a36Sopenharmony_ci	const u8 *fils_erp_rrk;
319562306a36Sopenharmony_ci	size_t fils_erp_rrk_len;
319662306a36Sopenharmony_ci	bool want_1x;
319762306a36Sopenharmony_ci	struct ieee80211_edmg edmg;
319862306a36Sopenharmony_ci};
319962306a36Sopenharmony_ci
320062306a36Sopenharmony_ci/**
320162306a36Sopenharmony_ci * enum cfg80211_connect_params_changed - Connection parameters being updated
320262306a36Sopenharmony_ci *
320362306a36Sopenharmony_ci * This enum provides information of all connect parameters that
320462306a36Sopenharmony_ci * have to be updated as part of update_connect_params() call.
320562306a36Sopenharmony_ci *
320662306a36Sopenharmony_ci * @UPDATE_ASSOC_IES: Indicates whether association request IEs are updated
320762306a36Sopenharmony_ci * @UPDATE_FILS_ERP_INFO: Indicates that FILS connection parameters (realm,
320862306a36Sopenharmony_ci *	username, erp sequence number and rrk) are updated
320962306a36Sopenharmony_ci * @UPDATE_AUTH_TYPE: Indicates that authentication type is updated
321062306a36Sopenharmony_ci */
321162306a36Sopenharmony_cienum cfg80211_connect_params_changed {
321262306a36Sopenharmony_ci	UPDATE_ASSOC_IES		= BIT(0),
321362306a36Sopenharmony_ci	UPDATE_FILS_ERP_INFO		= BIT(1),
321462306a36Sopenharmony_ci	UPDATE_AUTH_TYPE		= BIT(2),
321562306a36Sopenharmony_ci};
321662306a36Sopenharmony_ci
321762306a36Sopenharmony_ci/**
321862306a36Sopenharmony_ci * enum wiphy_params_flags - set_wiphy_params bitfield values
321962306a36Sopenharmony_ci * @WIPHY_PARAM_RETRY_SHORT: wiphy->retry_short has changed
322062306a36Sopenharmony_ci * @WIPHY_PARAM_RETRY_LONG: wiphy->retry_long has changed
322162306a36Sopenharmony_ci * @WIPHY_PARAM_FRAG_THRESHOLD: wiphy->frag_threshold has changed
322262306a36Sopenharmony_ci * @WIPHY_PARAM_RTS_THRESHOLD: wiphy->rts_threshold has changed
322362306a36Sopenharmony_ci * @WIPHY_PARAM_COVERAGE_CLASS: coverage class changed
322462306a36Sopenharmony_ci * @WIPHY_PARAM_DYN_ACK: dynack has been enabled
322562306a36Sopenharmony_ci * @WIPHY_PARAM_TXQ_LIMIT: TXQ packet limit has been changed
322662306a36Sopenharmony_ci * @WIPHY_PARAM_TXQ_MEMORY_LIMIT: TXQ memory limit has been changed
322762306a36Sopenharmony_ci * @WIPHY_PARAM_TXQ_QUANTUM: TXQ scheduler quantum
322862306a36Sopenharmony_ci */
322962306a36Sopenharmony_cienum wiphy_params_flags {
323062306a36Sopenharmony_ci	WIPHY_PARAM_RETRY_SHORT		= 1 << 0,
323162306a36Sopenharmony_ci	WIPHY_PARAM_RETRY_LONG		= 1 << 1,
323262306a36Sopenharmony_ci	WIPHY_PARAM_FRAG_THRESHOLD	= 1 << 2,
323362306a36Sopenharmony_ci	WIPHY_PARAM_RTS_THRESHOLD	= 1 << 3,
323462306a36Sopenharmony_ci	WIPHY_PARAM_COVERAGE_CLASS	= 1 << 4,
323562306a36Sopenharmony_ci	WIPHY_PARAM_DYN_ACK		= 1 << 5,
323662306a36Sopenharmony_ci	WIPHY_PARAM_TXQ_LIMIT		= 1 << 6,
323762306a36Sopenharmony_ci	WIPHY_PARAM_TXQ_MEMORY_LIMIT	= 1 << 7,
323862306a36Sopenharmony_ci	WIPHY_PARAM_TXQ_QUANTUM		= 1 << 8,
323962306a36Sopenharmony_ci};
324062306a36Sopenharmony_ci
324162306a36Sopenharmony_ci#define IEEE80211_DEFAULT_AIRTIME_WEIGHT	256
324262306a36Sopenharmony_ci
324362306a36Sopenharmony_ci/* The per TXQ device queue limit in airtime */
324462306a36Sopenharmony_ci#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_L	5000
324562306a36Sopenharmony_ci#define IEEE80211_DEFAULT_AQL_TXQ_LIMIT_H	12000
324662306a36Sopenharmony_ci
324762306a36Sopenharmony_ci/* The per interface airtime threshold to switch to lower queue limit */
324862306a36Sopenharmony_ci#define IEEE80211_AQL_THRESHOLD			24000
324962306a36Sopenharmony_ci
325062306a36Sopenharmony_ci/**
325162306a36Sopenharmony_ci * struct cfg80211_pmksa - PMK Security Association
325262306a36Sopenharmony_ci *
325362306a36Sopenharmony_ci * This structure is passed to the set/del_pmksa() method for PMKSA
325462306a36Sopenharmony_ci * caching.
325562306a36Sopenharmony_ci *
325662306a36Sopenharmony_ci * @bssid: The AP's BSSID (may be %NULL).
325762306a36Sopenharmony_ci * @pmkid: The identifier to refer a PMKSA.
325862306a36Sopenharmony_ci * @pmk: The PMK for the PMKSA identified by @pmkid. This is used for key
325962306a36Sopenharmony_ci *	derivation by a FILS STA. Otherwise, %NULL.
326062306a36Sopenharmony_ci * @pmk_len: Length of the @pmk. The length of @pmk can differ depending on
326162306a36Sopenharmony_ci *	the hash algorithm used to generate this.
326262306a36Sopenharmony_ci * @ssid: SSID to specify the ESS within which a PMKSA is valid when using FILS
326362306a36Sopenharmony_ci *	cache identifier (may be %NULL).
326462306a36Sopenharmony_ci * @ssid_len: Length of the @ssid in octets.
326562306a36Sopenharmony_ci * @cache_id: 2-octet cache identifier advertized by a FILS AP identifying the
326662306a36Sopenharmony_ci *	scope of PMKSA. This is valid only if @ssid_len is non-zero (may be
326762306a36Sopenharmony_ci *	%NULL).
326862306a36Sopenharmony_ci * @pmk_lifetime: Maximum lifetime for PMKSA in seconds
326962306a36Sopenharmony_ci *	(dot11RSNAConfigPMKLifetime) or 0 if not specified.
327062306a36Sopenharmony_ci *	The configured PMKSA must not be used for PMKSA caching after
327162306a36Sopenharmony_ci *	expiration and any keys derived from this PMK become invalid on
327262306a36Sopenharmony_ci *	expiration, i.e., the current association must be dropped if the PMK
327362306a36Sopenharmony_ci *	used for it expires.
327462306a36Sopenharmony_ci * @pmk_reauth_threshold: Threshold time for reauthentication (percentage of
327562306a36Sopenharmony_ci *	PMK lifetime, dot11RSNAConfigPMKReauthThreshold) or 0 if not specified.
327662306a36Sopenharmony_ci *	Drivers are expected to trigger a full authentication instead of using
327762306a36Sopenharmony_ci *	this PMKSA for caching when reassociating to a new BSS after this
327862306a36Sopenharmony_ci *	threshold to generate a new PMK before the current one expires.
327962306a36Sopenharmony_ci */
328062306a36Sopenharmony_cistruct cfg80211_pmksa {
328162306a36Sopenharmony_ci	const u8 *bssid;
328262306a36Sopenharmony_ci	const u8 *pmkid;
328362306a36Sopenharmony_ci	const u8 *pmk;
328462306a36Sopenharmony_ci	size_t pmk_len;
328562306a36Sopenharmony_ci	const u8 *ssid;
328662306a36Sopenharmony_ci	size_t ssid_len;
328762306a36Sopenharmony_ci	const u8 *cache_id;
328862306a36Sopenharmony_ci	u32 pmk_lifetime;
328962306a36Sopenharmony_ci	u8 pmk_reauth_threshold;
329062306a36Sopenharmony_ci};
329162306a36Sopenharmony_ci
329262306a36Sopenharmony_ci/**
329362306a36Sopenharmony_ci * struct cfg80211_pkt_pattern - packet pattern
329462306a36Sopenharmony_ci * @mask: bitmask where to match pattern and where to ignore bytes,
329562306a36Sopenharmony_ci *	one bit per byte, in same format as nl80211
329662306a36Sopenharmony_ci * @pattern: bytes to match where bitmask is 1
329762306a36Sopenharmony_ci * @pattern_len: length of pattern (in bytes)
329862306a36Sopenharmony_ci * @pkt_offset: packet offset (in bytes)
329962306a36Sopenharmony_ci *
330062306a36Sopenharmony_ci * Internal note: @mask and @pattern are allocated in one chunk of
330162306a36Sopenharmony_ci * memory, free @mask only!
330262306a36Sopenharmony_ci */
330362306a36Sopenharmony_cistruct cfg80211_pkt_pattern {
330462306a36Sopenharmony_ci	const u8 *mask, *pattern;
330562306a36Sopenharmony_ci	int pattern_len;
330662306a36Sopenharmony_ci	int pkt_offset;
330762306a36Sopenharmony_ci};
330862306a36Sopenharmony_ci
330962306a36Sopenharmony_ci/**
331062306a36Sopenharmony_ci * struct cfg80211_wowlan_tcp - TCP connection parameters
331162306a36Sopenharmony_ci *
331262306a36Sopenharmony_ci * @sock: (internal) socket for source port allocation
331362306a36Sopenharmony_ci * @src: source IP address
331462306a36Sopenharmony_ci * @dst: destination IP address
331562306a36Sopenharmony_ci * @dst_mac: destination MAC address
331662306a36Sopenharmony_ci * @src_port: source port
331762306a36Sopenharmony_ci * @dst_port: destination port
331862306a36Sopenharmony_ci * @payload_len: data payload length
331962306a36Sopenharmony_ci * @payload: data payload buffer
332062306a36Sopenharmony_ci * @payload_seq: payload sequence stamping configuration
332162306a36Sopenharmony_ci * @data_interval: interval at which to send data packets
332262306a36Sopenharmony_ci * @wake_len: wakeup payload match length
332362306a36Sopenharmony_ci * @wake_data: wakeup payload match data
332462306a36Sopenharmony_ci * @wake_mask: wakeup payload match mask
332562306a36Sopenharmony_ci * @tokens_size: length of the tokens buffer
332662306a36Sopenharmony_ci * @payload_tok: payload token usage configuration
332762306a36Sopenharmony_ci */
332862306a36Sopenharmony_cistruct cfg80211_wowlan_tcp {
332962306a36Sopenharmony_ci	struct socket *sock;
333062306a36Sopenharmony_ci	__be32 src, dst;
333162306a36Sopenharmony_ci	u16 src_port, dst_port;
333262306a36Sopenharmony_ci	u8 dst_mac[ETH_ALEN];
333362306a36Sopenharmony_ci	int payload_len;
333462306a36Sopenharmony_ci	const u8 *payload;
333562306a36Sopenharmony_ci	struct nl80211_wowlan_tcp_data_seq payload_seq;
333662306a36Sopenharmony_ci	u32 data_interval;
333762306a36Sopenharmony_ci	u32 wake_len;
333862306a36Sopenharmony_ci	const u8 *wake_data, *wake_mask;
333962306a36Sopenharmony_ci	u32 tokens_size;
334062306a36Sopenharmony_ci	/* must be last, variable member */
334162306a36Sopenharmony_ci	struct nl80211_wowlan_tcp_data_token payload_tok;
334262306a36Sopenharmony_ci};
334362306a36Sopenharmony_ci
334462306a36Sopenharmony_ci/**
334562306a36Sopenharmony_ci * struct cfg80211_wowlan - Wake on Wireless-LAN support info
334662306a36Sopenharmony_ci *
334762306a36Sopenharmony_ci * This structure defines the enabled WoWLAN triggers for the device.
334862306a36Sopenharmony_ci * @any: wake up on any activity -- special trigger if device continues
334962306a36Sopenharmony_ci *	operating as normal during suspend
335062306a36Sopenharmony_ci * @disconnect: wake up if getting disconnected
335162306a36Sopenharmony_ci * @magic_pkt: wake up on receiving magic packet
335262306a36Sopenharmony_ci * @patterns: wake up on receiving packet matching a pattern
335362306a36Sopenharmony_ci * @n_patterns: number of patterns
335462306a36Sopenharmony_ci * @gtk_rekey_failure: wake up on GTK rekey failure
335562306a36Sopenharmony_ci * @eap_identity_req: wake up on EAP identity request packet
335662306a36Sopenharmony_ci * @four_way_handshake: wake up on 4-way handshake
335762306a36Sopenharmony_ci * @rfkill_release: wake up when rfkill is released
335862306a36Sopenharmony_ci * @tcp: TCP connection establishment/wakeup parameters, see nl80211.h.
335962306a36Sopenharmony_ci *	NULL if not configured.
336062306a36Sopenharmony_ci * @nd_config: configuration for the scan to be used for net detect wake.
336162306a36Sopenharmony_ci */
336262306a36Sopenharmony_cistruct cfg80211_wowlan {
336362306a36Sopenharmony_ci	bool any, disconnect, magic_pkt, gtk_rekey_failure,
336462306a36Sopenharmony_ci	     eap_identity_req, four_way_handshake,
336562306a36Sopenharmony_ci	     rfkill_release;
336662306a36Sopenharmony_ci	struct cfg80211_pkt_pattern *patterns;
336762306a36Sopenharmony_ci	struct cfg80211_wowlan_tcp *tcp;
336862306a36Sopenharmony_ci	int n_patterns;
336962306a36Sopenharmony_ci	struct cfg80211_sched_scan_request *nd_config;
337062306a36Sopenharmony_ci};
337162306a36Sopenharmony_ci
337262306a36Sopenharmony_ci/**
337362306a36Sopenharmony_ci * struct cfg80211_coalesce_rules - Coalesce rule parameters
337462306a36Sopenharmony_ci *
337562306a36Sopenharmony_ci * This structure defines coalesce rule for the device.
337662306a36Sopenharmony_ci * @delay: maximum coalescing delay in msecs.
337762306a36Sopenharmony_ci * @condition: condition for packet coalescence.
337862306a36Sopenharmony_ci *	see &enum nl80211_coalesce_condition.
337962306a36Sopenharmony_ci * @patterns: array of packet patterns
338062306a36Sopenharmony_ci * @n_patterns: number of patterns
338162306a36Sopenharmony_ci */
338262306a36Sopenharmony_cistruct cfg80211_coalesce_rules {
338362306a36Sopenharmony_ci	int delay;
338462306a36Sopenharmony_ci	enum nl80211_coalesce_condition condition;
338562306a36Sopenharmony_ci	struct cfg80211_pkt_pattern *patterns;
338662306a36Sopenharmony_ci	int n_patterns;
338762306a36Sopenharmony_ci};
338862306a36Sopenharmony_ci
338962306a36Sopenharmony_ci/**
339062306a36Sopenharmony_ci * struct cfg80211_coalesce - Packet coalescing settings
339162306a36Sopenharmony_ci *
339262306a36Sopenharmony_ci * This structure defines coalescing settings.
339362306a36Sopenharmony_ci * @rules: array of coalesce rules
339462306a36Sopenharmony_ci * @n_rules: number of rules
339562306a36Sopenharmony_ci */
339662306a36Sopenharmony_cistruct cfg80211_coalesce {
339762306a36Sopenharmony_ci	struct cfg80211_coalesce_rules *rules;
339862306a36Sopenharmony_ci	int n_rules;
339962306a36Sopenharmony_ci};
340062306a36Sopenharmony_ci
340162306a36Sopenharmony_ci/**
340262306a36Sopenharmony_ci * struct cfg80211_wowlan_nd_match - information about the match
340362306a36Sopenharmony_ci *
340462306a36Sopenharmony_ci * @ssid: SSID of the match that triggered the wake up
340562306a36Sopenharmony_ci * @n_channels: Number of channels where the match occurred.  This
340662306a36Sopenharmony_ci *	value may be zero if the driver can't report the channels.
340762306a36Sopenharmony_ci * @channels: center frequencies of the channels where a match
340862306a36Sopenharmony_ci *	occurred (in MHz)
340962306a36Sopenharmony_ci */
341062306a36Sopenharmony_cistruct cfg80211_wowlan_nd_match {
341162306a36Sopenharmony_ci	struct cfg80211_ssid ssid;
341262306a36Sopenharmony_ci	int n_channels;
341362306a36Sopenharmony_ci	u32 channels[];
341462306a36Sopenharmony_ci};
341562306a36Sopenharmony_ci
341662306a36Sopenharmony_ci/**
341762306a36Sopenharmony_ci * struct cfg80211_wowlan_nd_info - net detect wake up information
341862306a36Sopenharmony_ci *
341962306a36Sopenharmony_ci * @n_matches: Number of match information instances provided in
342062306a36Sopenharmony_ci *	@matches.  This value may be zero if the driver can't provide
342162306a36Sopenharmony_ci *	match information.
342262306a36Sopenharmony_ci * @matches: Array of pointers to matches containing information about
342362306a36Sopenharmony_ci *	the matches that triggered the wake up.
342462306a36Sopenharmony_ci */
342562306a36Sopenharmony_cistruct cfg80211_wowlan_nd_info {
342662306a36Sopenharmony_ci	int n_matches;
342762306a36Sopenharmony_ci	struct cfg80211_wowlan_nd_match *matches[];
342862306a36Sopenharmony_ci};
342962306a36Sopenharmony_ci
343062306a36Sopenharmony_ci/**
343162306a36Sopenharmony_ci * struct cfg80211_wowlan_wakeup - wakeup report
343262306a36Sopenharmony_ci * @disconnect: woke up by getting disconnected
343362306a36Sopenharmony_ci * @magic_pkt: woke up by receiving magic packet
343462306a36Sopenharmony_ci * @gtk_rekey_failure: woke up by GTK rekey failure
343562306a36Sopenharmony_ci * @eap_identity_req: woke up by EAP identity request packet
343662306a36Sopenharmony_ci * @four_way_handshake: woke up by 4-way handshake
343762306a36Sopenharmony_ci * @rfkill_release: woke up by rfkill being released
343862306a36Sopenharmony_ci * @pattern_idx: pattern that caused wakeup, -1 if not due to pattern
343962306a36Sopenharmony_ci * @packet_present_len: copied wakeup packet data
344062306a36Sopenharmony_ci * @packet_len: original wakeup packet length
344162306a36Sopenharmony_ci * @packet: The packet causing the wakeup, if any.
344262306a36Sopenharmony_ci * @packet_80211:  For pattern match, magic packet and other data
344362306a36Sopenharmony_ci *	frame triggers an 802.3 frame should be reported, for
344462306a36Sopenharmony_ci *	disconnect due to deauth 802.11 frame. This indicates which
344562306a36Sopenharmony_ci *	it is.
344662306a36Sopenharmony_ci * @tcp_match: TCP wakeup packet received
344762306a36Sopenharmony_ci * @tcp_connlost: TCP connection lost or failed to establish
344862306a36Sopenharmony_ci * @tcp_nomoretokens: TCP data ran out of tokens
344962306a36Sopenharmony_ci * @net_detect: if not %NULL, woke up because of net detect
345062306a36Sopenharmony_ci */
345162306a36Sopenharmony_cistruct cfg80211_wowlan_wakeup {
345262306a36Sopenharmony_ci	bool disconnect, magic_pkt, gtk_rekey_failure,
345362306a36Sopenharmony_ci	     eap_identity_req, four_way_handshake,
345462306a36Sopenharmony_ci	     rfkill_release, packet_80211,
345562306a36Sopenharmony_ci	     tcp_match, tcp_connlost, tcp_nomoretokens;
345662306a36Sopenharmony_ci	s32 pattern_idx;
345762306a36Sopenharmony_ci	u32 packet_present_len, packet_len;
345862306a36Sopenharmony_ci	const void *packet;
345962306a36Sopenharmony_ci	struct cfg80211_wowlan_nd_info *net_detect;
346062306a36Sopenharmony_ci};
346162306a36Sopenharmony_ci
346262306a36Sopenharmony_ci/**
346362306a36Sopenharmony_ci * struct cfg80211_gtk_rekey_data - rekey data
346462306a36Sopenharmony_ci * @kek: key encryption key (@kek_len bytes)
346562306a36Sopenharmony_ci * @kck: key confirmation key (@kck_len bytes)
346662306a36Sopenharmony_ci * @replay_ctr: replay counter (NL80211_REPLAY_CTR_LEN bytes)
346762306a36Sopenharmony_ci * @kek_len: length of kek
346862306a36Sopenharmony_ci * @kck_len: length of kck
346962306a36Sopenharmony_ci * @akm: akm (oui, id)
347062306a36Sopenharmony_ci */
347162306a36Sopenharmony_cistruct cfg80211_gtk_rekey_data {
347262306a36Sopenharmony_ci	const u8 *kek, *kck, *replay_ctr;
347362306a36Sopenharmony_ci	u32 akm;
347462306a36Sopenharmony_ci	u8 kek_len, kck_len;
347562306a36Sopenharmony_ci};
347662306a36Sopenharmony_ci
347762306a36Sopenharmony_ci/**
347862306a36Sopenharmony_ci * struct cfg80211_update_ft_ies_params - FT IE Information
347962306a36Sopenharmony_ci *
348062306a36Sopenharmony_ci * This structure provides information needed to update the fast transition IE
348162306a36Sopenharmony_ci *
348262306a36Sopenharmony_ci * @md: The Mobility Domain ID, 2 Octet value
348362306a36Sopenharmony_ci * @ie: Fast Transition IEs
348462306a36Sopenharmony_ci * @ie_len: Length of ft_ie in octets
348562306a36Sopenharmony_ci */
348662306a36Sopenharmony_cistruct cfg80211_update_ft_ies_params {
348762306a36Sopenharmony_ci	u16 md;
348862306a36Sopenharmony_ci	const u8 *ie;
348962306a36Sopenharmony_ci	size_t ie_len;
349062306a36Sopenharmony_ci};
349162306a36Sopenharmony_ci
349262306a36Sopenharmony_ci/**
349362306a36Sopenharmony_ci * struct cfg80211_mgmt_tx_params - mgmt tx parameters
349462306a36Sopenharmony_ci *
349562306a36Sopenharmony_ci * This structure provides information needed to transmit a mgmt frame
349662306a36Sopenharmony_ci *
349762306a36Sopenharmony_ci * @chan: channel to use
349862306a36Sopenharmony_ci * @offchan: indicates wether off channel operation is required
349962306a36Sopenharmony_ci * @wait: duration for ROC
350062306a36Sopenharmony_ci * @buf: buffer to transmit
350162306a36Sopenharmony_ci * @len: buffer length
350262306a36Sopenharmony_ci * @no_cck: don't use cck rates for this frame
350362306a36Sopenharmony_ci * @dont_wait_for_ack: tells the low level not to wait for an ack
350462306a36Sopenharmony_ci * @n_csa_offsets: length of csa_offsets array
350562306a36Sopenharmony_ci * @csa_offsets: array of all the csa offsets in the frame
350662306a36Sopenharmony_ci * @link_id: for MLO, the link ID to transmit on, -1 if not given; note
350762306a36Sopenharmony_ci *	that the link ID isn't validated (much), it's in range but the
350862306a36Sopenharmony_ci *	link might not exist (or be used by the receiver STA)
350962306a36Sopenharmony_ci */
351062306a36Sopenharmony_cistruct cfg80211_mgmt_tx_params {
351162306a36Sopenharmony_ci	struct ieee80211_channel *chan;
351262306a36Sopenharmony_ci	bool offchan;
351362306a36Sopenharmony_ci	unsigned int wait;
351462306a36Sopenharmony_ci	const u8 *buf;
351562306a36Sopenharmony_ci	size_t len;
351662306a36Sopenharmony_ci	bool no_cck;
351762306a36Sopenharmony_ci	bool dont_wait_for_ack;
351862306a36Sopenharmony_ci	int n_csa_offsets;
351962306a36Sopenharmony_ci	const u16 *csa_offsets;
352062306a36Sopenharmony_ci	int link_id;
352162306a36Sopenharmony_ci};
352262306a36Sopenharmony_ci
352362306a36Sopenharmony_ci/**
352462306a36Sopenharmony_ci * struct cfg80211_dscp_exception - DSCP exception
352562306a36Sopenharmony_ci *
352662306a36Sopenharmony_ci * @dscp: DSCP value that does not adhere to the user priority range definition
352762306a36Sopenharmony_ci * @up: user priority value to which the corresponding DSCP value belongs
352862306a36Sopenharmony_ci */
352962306a36Sopenharmony_cistruct cfg80211_dscp_exception {
353062306a36Sopenharmony_ci	u8 dscp;
353162306a36Sopenharmony_ci	u8 up;
353262306a36Sopenharmony_ci};
353362306a36Sopenharmony_ci
353462306a36Sopenharmony_ci/**
353562306a36Sopenharmony_ci * struct cfg80211_dscp_range - DSCP range definition for user priority
353662306a36Sopenharmony_ci *
353762306a36Sopenharmony_ci * @low: lowest DSCP value of this user priority range, inclusive
353862306a36Sopenharmony_ci * @high: highest DSCP value of this user priority range, inclusive
353962306a36Sopenharmony_ci */
354062306a36Sopenharmony_cistruct cfg80211_dscp_range {
354162306a36Sopenharmony_ci	u8 low;
354262306a36Sopenharmony_ci	u8 high;
354362306a36Sopenharmony_ci};
354462306a36Sopenharmony_ci
354562306a36Sopenharmony_ci/* QoS Map Set element length defined in IEEE Std 802.11-2012, 8.4.2.97 */
354662306a36Sopenharmony_ci#define IEEE80211_QOS_MAP_MAX_EX	21
354762306a36Sopenharmony_ci#define IEEE80211_QOS_MAP_LEN_MIN	16
354862306a36Sopenharmony_ci#define IEEE80211_QOS_MAP_LEN_MAX \
354962306a36Sopenharmony_ci	(IEEE80211_QOS_MAP_LEN_MIN + 2 * IEEE80211_QOS_MAP_MAX_EX)
355062306a36Sopenharmony_ci
355162306a36Sopenharmony_ci/**
355262306a36Sopenharmony_ci * struct cfg80211_qos_map - QoS Map Information
355362306a36Sopenharmony_ci *
355462306a36Sopenharmony_ci * This struct defines the Interworking QoS map setting for DSCP values
355562306a36Sopenharmony_ci *
355662306a36Sopenharmony_ci * @num_des: number of DSCP exceptions (0..21)
355762306a36Sopenharmony_ci * @dscp_exception: optionally up to maximum of 21 DSCP exceptions from
355862306a36Sopenharmony_ci *	the user priority DSCP range definition
355962306a36Sopenharmony_ci * @up: DSCP range definition for a particular user priority
356062306a36Sopenharmony_ci */
356162306a36Sopenharmony_cistruct cfg80211_qos_map {
356262306a36Sopenharmony_ci	u8 num_des;
356362306a36Sopenharmony_ci	struct cfg80211_dscp_exception dscp_exception[IEEE80211_QOS_MAP_MAX_EX];
356462306a36Sopenharmony_ci	struct cfg80211_dscp_range up[8];
356562306a36Sopenharmony_ci};
356662306a36Sopenharmony_ci
356762306a36Sopenharmony_ci/**
356862306a36Sopenharmony_ci * struct cfg80211_nan_conf - NAN configuration
356962306a36Sopenharmony_ci *
357062306a36Sopenharmony_ci * This struct defines NAN configuration parameters
357162306a36Sopenharmony_ci *
357262306a36Sopenharmony_ci * @master_pref: master preference (1 - 255)
357362306a36Sopenharmony_ci * @bands: operating bands, a bitmap of &enum nl80211_band values.
357462306a36Sopenharmony_ci *	For instance, for NL80211_BAND_2GHZ, bit 0 would be set
357562306a36Sopenharmony_ci *	(i.e. BIT(NL80211_BAND_2GHZ)).
357662306a36Sopenharmony_ci */
357762306a36Sopenharmony_cistruct cfg80211_nan_conf {
357862306a36Sopenharmony_ci	u8 master_pref;
357962306a36Sopenharmony_ci	u8 bands;
358062306a36Sopenharmony_ci};
358162306a36Sopenharmony_ci
358262306a36Sopenharmony_ci/**
358362306a36Sopenharmony_ci * enum cfg80211_nan_conf_changes - indicates changed fields in NAN
358462306a36Sopenharmony_ci * configuration
358562306a36Sopenharmony_ci *
358662306a36Sopenharmony_ci * @CFG80211_NAN_CONF_CHANGED_PREF: master preference
358762306a36Sopenharmony_ci * @CFG80211_NAN_CONF_CHANGED_BANDS: operating bands
358862306a36Sopenharmony_ci */
358962306a36Sopenharmony_cienum cfg80211_nan_conf_changes {
359062306a36Sopenharmony_ci	CFG80211_NAN_CONF_CHANGED_PREF = BIT(0),
359162306a36Sopenharmony_ci	CFG80211_NAN_CONF_CHANGED_BANDS = BIT(1),
359262306a36Sopenharmony_ci};
359362306a36Sopenharmony_ci
359462306a36Sopenharmony_ci/**
359562306a36Sopenharmony_ci * struct cfg80211_nan_func_filter - a NAN function Rx / Tx filter
359662306a36Sopenharmony_ci *
359762306a36Sopenharmony_ci * @filter: the content of the filter
359862306a36Sopenharmony_ci * @len: the length of the filter
359962306a36Sopenharmony_ci */
360062306a36Sopenharmony_cistruct cfg80211_nan_func_filter {
360162306a36Sopenharmony_ci	const u8 *filter;
360262306a36Sopenharmony_ci	u8 len;
360362306a36Sopenharmony_ci};
360462306a36Sopenharmony_ci
360562306a36Sopenharmony_ci/**
360662306a36Sopenharmony_ci * struct cfg80211_nan_func - a NAN function
360762306a36Sopenharmony_ci *
360862306a36Sopenharmony_ci * @type: &enum nl80211_nan_function_type
360962306a36Sopenharmony_ci * @service_id: the service ID of the function
361062306a36Sopenharmony_ci * @publish_type: &nl80211_nan_publish_type
361162306a36Sopenharmony_ci * @close_range: if true, the range should be limited. Threshold is
361262306a36Sopenharmony_ci *	implementation specific.
361362306a36Sopenharmony_ci * @publish_bcast: if true, the solicited publish should be broadcasted
361462306a36Sopenharmony_ci * @subscribe_active: if true, the subscribe is active
361562306a36Sopenharmony_ci * @followup_id: the instance ID for follow up
361662306a36Sopenharmony_ci * @followup_reqid: the requestor instance ID for follow up
361762306a36Sopenharmony_ci * @followup_dest: MAC address of the recipient of the follow up
361862306a36Sopenharmony_ci * @ttl: time to live counter in DW.
361962306a36Sopenharmony_ci * @serv_spec_info: Service Specific Info
362062306a36Sopenharmony_ci * @serv_spec_info_len: Service Specific Info length
362162306a36Sopenharmony_ci * @srf_include: if true, SRF is inclusive
362262306a36Sopenharmony_ci * @srf_bf: Bloom Filter
362362306a36Sopenharmony_ci * @srf_bf_len: Bloom Filter length
362462306a36Sopenharmony_ci * @srf_bf_idx: Bloom Filter index
362562306a36Sopenharmony_ci * @srf_macs: SRF MAC addresses
362662306a36Sopenharmony_ci * @srf_num_macs: number of MAC addresses in SRF
362762306a36Sopenharmony_ci * @rx_filters: rx filters that are matched with corresponding peer's tx_filter
362862306a36Sopenharmony_ci * @tx_filters: filters that should be transmitted in the SDF.
362962306a36Sopenharmony_ci * @num_rx_filters: length of &rx_filters.
363062306a36Sopenharmony_ci * @num_tx_filters: length of &tx_filters.
363162306a36Sopenharmony_ci * @instance_id: driver allocated id of the function.
363262306a36Sopenharmony_ci * @cookie: unique NAN function identifier.
363362306a36Sopenharmony_ci */
363462306a36Sopenharmony_cistruct cfg80211_nan_func {
363562306a36Sopenharmony_ci	enum nl80211_nan_function_type type;
363662306a36Sopenharmony_ci	u8 service_id[NL80211_NAN_FUNC_SERVICE_ID_LEN];
363762306a36Sopenharmony_ci	u8 publish_type;
363862306a36Sopenharmony_ci	bool close_range;
363962306a36Sopenharmony_ci	bool publish_bcast;
364062306a36Sopenharmony_ci	bool subscribe_active;
364162306a36Sopenharmony_ci	u8 followup_id;
364262306a36Sopenharmony_ci	u8 followup_reqid;
364362306a36Sopenharmony_ci	struct mac_address followup_dest;
364462306a36Sopenharmony_ci	u32 ttl;
364562306a36Sopenharmony_ci	const u8 *serv_spec_info;
364662306a36Sopenharmony_ci	u8 serv_spec_info_len;
364762306a36Sopenharmony_ci	bool srf_include;
364862306a36Sopenharmony_ci	const u8 *srf_bf;
364962306a36Sopenharmony_ci	u8 srf_bf_len;
365062306a36Sopenharmony_ci	u8 srf_bf_idx;
365162306a36Sopenharmony_ci	struct mac_address *srf_macs;
365262306a36Sopenharmony_ci	int srf_num_macs;
365362306a36Sopenharmony_ci	struct cfg80211_nan_func_filter *rx_filters;
365462306a36Sopenharmony_ci	struct cfg80211_nan_func_filter *tx_filters;
365562306a36Sopenharmony_ci	u8 num_tx_filters;
365662306a36Sopenharmony_ci	u8 num_rx_filters;
365762306a36Sopenharmony_ci	u8 instance_id;
365862306a36Sopenharmony_ci	u64 cookie;
365962306a36Sopenharmony_ci};
366062306a36Sopenharmony_ci
366162306a36Sopenharmony_ci/**
366262306a36Sopenharmony_ci * struct cfg80211_pmk_conf - PMK configuration
366362306a36Sopenharmony_ci *
366462306a36Sopenharmony_ci * @aa: authenticator address
366562306a36Sopenharmony_ci * @pmk_len: PMK length in bytes.
366662306a36Sopenharmony_ci * @pmk: the PMK material
366762306a36Sopenharmony_ci * @pmk_r0_name: PMK-R0 Name. NULL if not applicable (i.e., the PMK
366862306a36Sopenharmony_ci *	is not PMK-R0). When pmk_r0_name is not NULL, the pmk field
366962306a36Sopenharmony_ci *	holds PMK-R0.
367062306a36Sopenharmony_ci */
367162306a36Sopenharmony_cistruct cfg80211_pmk_conf {
367262306a36Sopenharmony_ci	const u8 *aa;
367362306a36Sopenharmony_ci	u8 pmk_len;
367462306a36Sopenharmony_ci	const u8 *pmk;
367562306a36Sopenharmony_ci	const u8 *pmk_r0_name;
367662306a36Sopenharmony_ci};
367762306a36Sopenharmony_ci
367862306a36Sopenharmony_ci/**
367962306a36Sopenharmony_ci * struct cfg80211_external_auth_params - Trigger External authentication.
368062306a36Sopenharmony_ci *
368162306a36Sopenharmony_ci * Commonly used across the external auth request and event interfaces.
368262306a36Sopenharmony_ci *
368362306a36Sopenharmony_ci * @action: action type / trigger for external authentication. Only significant
368462306a36Sopenharmony_ci *	for the authentication request event interface (driver to user space).
368562306a36Sopenharmony_ci * @bssid: BSSID of the peer with which the authentication has
368662306a36Sopenharmony_ci *	to happen. Used by both the authentication request event and
368762306a36Sopenharmony_ci *	authentication response command interface.
368862306a36Sopenharmony_ci * @ssid: SSID of the AP.  Used by both the authentication request event and
368962306a36Sopenharmony_ci *	authentication response command interface.
369062306a36Sopenharmony_ci * @key_mgmt_suite: AKM suite of the respective authentication. Used by the
369162306a36Sopenharmony_ci *	authentication request event interface.
369262306a36Sopenharmony_ci * @status: status code, %WLAN_STATUS_SUCCESS for successful authentication,
369362306a36Sopenharmony_ci *	use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space cannot give you
369462306a36Sopenharmony_ci *	the real status code for failures. Used only for the authentication
369562306a36Sopenharmony_ci *	response command interface (user space to driver).
369662306a36Sopenharmony_ci * @pmkid: The identifier to refer a PMKSA.
369762306a36Sopenharmony_ci * @mld_addr: MLD address of the peer. Used by the authentication request event
369862306a36Sopenharmony_ci *	interface. Driver indicates this to enable MLO during the authentication
369962306a36Sopenharmony_ci *	offload to user space. Driver shall look at %NL80211_ATTR_MLO_SUPPORT
370062306a36Sopenharmony_ci *	flag capability in NL80211_CMD_CONNECT to know whether the user space
370162306a36Sopenharmony_ci *	supports enabling MLO during the authentication offload.
370262306a36Sopenharmony_ci *	User space should use the address of the interface (on which the
370362306a36Sopenharmony_ci *	authentication request event reported) as self MLD address. User space
370462306a36Sopenharmony_ci *	and driver should use MLD addresses in RA, TA and BSSID fields of
370562306a36Sopenharmony_ci *	authentication frames sent or received via cfg80211. The driver
370662306a36Sopenharmony_ci *	translates the MLD addresses to/from link addresses based on the link
370762306a36Sopenharmony_ci *	chosen for the authentication.
370862306a36Sopenharmony_ci */
370962306a36Sopenharmony_cistruct cfg80211_external_auth_params {
371062306a36Sopenharmony_ci	enum nl80211_external_auth_action action;
371162306a36Sopenharmony_ci	u8 bssid[ETH_ALEN] __aligned(2);
371262306a36Sopenharmony_ci	struct cfg80211_ssid ssid;
371362306a36Sopenharmony_ci	unsigned int key_mgmt_suite;
371462306a36Sopenharmony_ci	u16 status;
371562306a36Sopenharmony_ci	const u8 *pmkid;
371662306a36Sopenharmony_ci	u8 mld_addr[ETH_ALEN] __aligned(2);
371762306a36Sopenharmony_ci};
371862306a36Sopenharmony_ci
371962306a36Sopenharmony_ci/**
372062306a36Sopenharmony_ci * struct cfg80211_ftm_responder_stats - FTM responder statistics
372162306a36Sopenharmony_ci *
372262306a36Sopenharmony_ci * @filled: bitflag of flags using the bits of &enum nl80211_ftm_stats to
372362306a36Sopenharmony_ci *	indicate the relevant values in this struct for them
372462306a36Sopenharmony_ci * @success_num: number of FTM sessions in which all frames were successfully
372562306a36Sopenharmony_ci *	answered
372662306a36Sopenharmony_ci * @partial_num: number of FTM sessions in which part of frames were
372762306a36Sopenharmony_ci *	successfully answered
372862306a36Sopenharmony_ci * @failed_num: number of failed FTM sessions
372962306a36Sopenharmony_ci * @asap_num: number of ASAP FTM sessions
373062306a36Sopenharmony_ci * @non_asap_num: number of  non-ASAP FTM sessions
373162306a36Sopenharmony_ci * @total_duration_ms: total sessions durations - gives an indication
373262306a36Sopenharmony_ci *	of how much time the responder was busy
373362306a36Sopenharmony_ci * @unknown_triggers_num: number of unknown FTM triggers - triggers from
373462306a36Sopenharmony_ci *	initiators that didn't finish successfully the negotiation phase with
373562306a36Sopenharmony_ci *	the responder
373662306a36Sopenharmony_ci * @reschedule_requests_num: number of FTM reschedule requests - initiator asks
373762306a36Sopenharmony_ci *	for a new scheduling although it already has scheduled FTM slot
373862306a36Sopenharmony_ci * @out_of_window_triggers_num: total FTM triggers out of scheduled window
373962306a36Sopenharmony_ci */
374062306a36Sopenharmony_cistruct cfg80211_ftm_responder_stats {
374162306a36Sopenharmony_ci	u32 filled;
374262306a36Sopenharmony_ci	u32 success_num;
374362306a36Sopenharmony_ci	u32 partial_num;
374462306a36Sopenharmony_ci	u32 failed_num;
374562306a36Sopenharmony_ci	u32 asap_num;
374662306a36Sopenharmony_ci	u32 non_asap_num;
374762306a36Sopenharmony_ci	u64 total_duration_ms;
374862306a36Sopenharmony_ci	u32 unknown_triggers_num;
374962306a36Sopenharmony_ci	u32 reschedule_requests_num;
375062306a36Sopenharmony_ci	u32 out_of_window_triggers_num;
375162306a36Sopenharmony_ci};
375262306a36Sopenharmony_ci
375362306a36Sopenharmony_ci/**
375462306a36Sopenharmony_ci * struct cfg80211_pmsr_ftm_result - FTM result
375562306a36Sopenharmony_ci * @failure_reason: if this measurement failed (PMSR status is
375662306a36Sopenharmony_ci *	%NL80211_PMSR_STATUS_FAILURE), this gives a more precise
375762306a36Sopenharmony_ci *	reason than just "failure"
375862306a36Sopenharmony_ci * @burst_index: if reporting partial results, this is the index
375962306a36Sopenharmony_ci *	in [0 .. num_bursts-1] of the burst that's being reported
376062306a36Sopenharmony_ci * @num_ftmr_attempts: number of FTM request frames transmitted
376162306a36Sopenharmony_ci * @num_ftmr_successes: number of FTM request frames acked
376262306a36Sopenharmony_ci * @busy_retry_time: if failure_reason is %NL80211_PMSR_FTM_FAILURE_PEER_BUSY,
376362306a36Sopenharmony_ci *	fill this to indicate in how many seconds a retry is deemed possible
376462306a36Sopenharmony_ci *	by the responder
376562306a36Sopenharmony_ci * @num_bursts_exp: actual number of bursts exponent negotiated
376662306a36Sopenharmony_ci * @burst_duration: actual burst duration negotiated
376762306a36Sopenharmony_ci * @ftms_per_burst: actual FTMs per burst negotiated
376862306a36Sopenharmony_ci * @lci_len: length of LCI information (if present)
376962306a36Sopenharmony_ci * @civicloc_len: length of civic location information (if present)
377062306a36Sopenharmony_ci * @lci: LCI data (may be %NULL)
377162306a36Sopenharmony_ci * @civicloc: civic location data (may be %NULL)
377262306a36Sopenharmony_ci * @rssi_avg: average RSSI over FTM action frames reported
377362306a36Sopenharmony_ci * @rssi_spread: spread of the RSSI over FTM action frames reported
377462306a36Sopenharmony_ci * @tx_rate: bitrate for transmitted FTM action frame response
377562306a36Sopenharmony_ci * @rx_rate: bitrate of received FTM action frame
377662306a36Sopenharmony_ci * @rtt_avg: average of RTTs measured (must have either this or @dist_avg)
377762306a36Sopenharmony_ci * @rtt_variance: variance of RTTs measured (note that standard deviation is
377862306a36Sopenharmony_ci *	the square root of the variance)
377962306a36Sopenharmony_ci * @rtt_spread: spread of the RTTs measured
378062306a36Sopenharmony_ci * @dist_avg: average of distances (mm) measured
378162306a36Sopenharmony_ci *	(must have either this or @rtt_avg)
378262306a36Sopenharmony_ci * @dist_variance: variance of distances measured (see also @rtt_variance)
378362306a36Sopenharmony_ci * @dist_spread: spread of distances measured (see also @rtt_spread)
378462306a36Sopenharmony_ci * @num_ftmr_attempts_valid: @num_ftmr_attempts is valid
378562306a36Sopenharmony_ci * @num_ftmr_successes_valid: @num_ftmr_successes is valid
378662306a36Sopenharmony_ci * @rssi_avg_valid: @rssi_avg is valid
378762306a36Sopenharmony_ci * @rssi_spread_valid: @rssi_spread is valid
378862306a36Sopenharmony_ci * @tx_rate_valid: @tx_rate is valid
378962306a36Sopenharmony_ci * @rx_rate_valid: @rx_rate is valid
379062306a36Sopenharmony_ci * @rtt_avg_valid: @rtt_avg is valid
379162306a36Sopenharmony_ci * @rtt_variance_valid: @rtt_variance is valid
379262306a36Sopenharmony_ci * @rtt_spread_valid: @rtt_spread is valid
379362306a36Sopenharmony_ci * @dist_avg_valid: @dist_avg is valid
379462306a36Sopenharmony_ci * @dist_variance_valid: @dist_variance is valid
379562306a36Sopenharmony_ci * @dist_spread_valid: @dist_spread is valid
379662306a36Sopenharmony_ci */
379762306a36Sopenharmony_cistruct cfg80211_pmsr_ftm_result {
379862306a36Sopenharmony_ci	const u8 *lci;
379962306a36Sopenharmony_ci	const u8 *civicloc;
380062306a36Sopenharmony_ci	unsigned int lci_len;
380162306a36Sopenharmony_ci	unsigned int civicloc_len;
380262306a36Sopenharmony_ci	enum nl80211_peer_measurement_ftm_failure_reasons failure_reason;
380362306a36Sopenharmony_ci	u32 num_ftmr_attempts, num_ftmr_successes;
380462306a36Sopenharmony_ci	s16 burst_index;
380562306a36Sopenharmony_ci	u8 busy_retry_time;
380662306a36Sopenharmony_ci	u8 num_bursts_exp;
380762306a36Sopenharmony_ci	u8 burst_duration;
380862306a36Sopenharmony_ci	u8 ftms_per_burst;
380962306a36Sopenharmony_ci	s32 rssi_avg;
381062306a36Sopenharmony_ci	s32 rssi_spread;
381162306a36Sopenharmony_ci	struct rate_info tx_rate, rx_rate;
381262306a36Sopenharmony_ci	s64 rtt_avg;
381362306a36Sopenharmony_ci	s64 rtt_variance;
381462306a36Sopenharmony_ci	s64 rtt_spread;
381562306a36Sopenharmony_ci	s64 dist_avg;
381662306a36Sopenharmony_ci	s64 dist_variance;
381762306a36Sopenharmony_ci	s64 dist_spread;
381862306a36Sopenharmony_ci
381962306a36Sopenharmony_ci	u16 num_ftmr_attempts_valid:1,
382062306a36Sopenharmony_ci	    num_ftmr_successes_valid:1,
382162306a36Sopenharmony_ci	    rssi_avg_valid:1,
382262306a36Sopenharmony_ci	    rssi_spread_valid:1,
382362306a36Sopenharmony_ci	    tx_rate_valid:1,
382462306a36Sopenharmony_ci	    rx_rate_valid:1,
382562306a36Sopenharmony_ci	    rtt_avg_valid:1,
382662306a36Sopenharmony_ci	    rtt_variance_valid:1,
382762306a36Sopenharmony_ci	    rtt_spread_valid:1,
382862306a36Sopenharmony_ci	    dist_avg_valid:1,
382962306a36Sopenharmony_ci	    dist_variance_valid:1,
383062306a36Sopenharmony_ci	    dist_spread_valid:1;
383162306a36Sopenharmony_ci};
383262306a36Sopenharmony_ci
383362306a36Sopenharmony_ci/**
383462306a36Sopenharmony_ci * struct cfg80211_pmsr_result - peer measurement result
383562306a36Sopenharmony_ci * @addr: address of the peer
383662306a36Sopenharmony_ci * @host_time: host time (use ktime_get_boottime() adjust to the time when the
383762306a36Sopenharmony_ci *	measurement was made)
383862306a36Sopenharmony_ci * @ap_tsf: AP's TSF at measurement time
383962306a36Sopenharmony_ci * @status: status of the measurement
384062306a36Sopenharmony_ci * @final: if reporting partial results, mark this as the last one; if not
384162306a36Sopenharmony_ci *	reporting partial results always set this flag
384262306a36Sopenharmony_ci * @ap_tsf_valid: indicates the @ap_tsf value is valid
384362306a36Sopenharmony_ci * @type: type of the measurement reported, note that we only support reporting
384462306a36Sopenharmony_ci *	one type at a time, but you can report multiple results separately and
384562306a36Sopenharmony_ci *	they're all aggregated for userspace.
384662306a36Sopenharmony_ci * @ftm: FTM result
384762306a36Sopenharmony_ci */
384862306a36Sopenharmony_cistruct cfg80211_pmsr_result {
384962306a36Sopenharmony_ci	u64 host_time, ap_tsf;
385062306a36Sopenharmony_ci	enum nl80211_peer_measurement_status status;
385162306a36Sopenharmony_ci
385262306a36Sopenharmony_ci	u8 addr[ETH_ALEN];
385362306a36Sopenharmony_ci
385462306a36Sopenharmony_ci	u8 final:1,
385562306a36Sopenharmony_ci	   ap_tsf_valid:1;
385662306a36Sopenharmony_ci
385762306a36Sopenharmony_ci	enum nl80211_peer_measurement_type type;
385862306a36Sopenharmony_ci
385962306a36Sopenharmony_ci	union {
386062306a36Sopenharmony_ci		struct cfg80211_pmsr_ftm_result ftm;
386162306a36Sopenharmony_ci	};
386262306a36Sopenharmony_ci};
386362306a36Sopenharmony_ci
386462306a36Sopenharmony_ci/**
386562306a36Sopenharmony_ci * struct cfg80211_pmsr_ftm_request_peer - FTM request data
386662306a36Sopenharmony_ci * @requested: indicates FTM is requested
386762306a36Sopenharmony_ci * @preamble: frame preamble to use
386862306a36Sopenharmony_ci * @burst_period: burst period to use
386962306a36Sopenharmony_ci * @asap: indicates to use ASAP mode
387062306a36Sopenharmony_ci * @num_bursts_exp: number of bursts exponent
387162306a36Sopenharmony_ci * @burst_duration: burst duration
387262306a36Sopenharmony_ci * @ftms_per_burst: number of FTMs per burst
387362306a36Sopenharmony_ci * @ftmr_retries: number of retries for FTM request
387462306a36Sopenharmony_ci * @request_lci: request LCI information
387562306a36Sopenharmony_ci * @request_civicloc: request civic location information
387662306a36Sopenharmony_ci * @trigger_based: use trigger based ranging for the measurement
387762306a36Sopenharmony_ci *		 If neither @trigger_based nor @non_trigger_based is set,
387862306a36Sopenharmony_ci *		 EDCA based ranging will be used.
387962306a36Sopenharmony_ci * @non_trigger_based: use non trigger based ranging for the measurement
388062306a36Sopenharmony_ci *		 If neither @trigger_based nor @non_trigger_based is set,
388162306a36Sopenharmony_ci *		 EDCA based ranging will be used.
388262306a36Sopenharmony_ci * @lmr_feedback: negotiate for I2R LMR feedback. Only valid if either
388362306a36Sopenharmony_ci *		 @trigger_based or @non_trigger_based is set.
388462306a36Sopenharmony_ci * @bss_color: the bss color of the responder. Optional. Set to zero to
388562306a36Sopenharmony_ci *	indicate the driver should set the BSS color. Only valid if
388662306a36Sopenharmony_ci *	@non_trigger_based or @trigger_based is set.
388762306a36Sopenharmony_ci *
388862306a36Sopenharmony_ci * See also nl80211 for the respective attribute documentation.
388962306a36Sopenharmony_ci */
389062306a36Sopenharmony_cistruct cfg80211_pmsr_ftm_request_peer {
389162306a36Sopenharmony_ci	enum nl80211_preamble preamble;
389262306a36Sopenharmony_ci	u16 burst_period;
389362306a36Sopenharmony_ci	u8 requested:1,
389462306a36Sopenharmony_ci	   asap:1,
389562306a36Sopenharmony_ci	   request_lci:1,
389662306a36Sopenharmony_ci	   request_civicloc:1,
389762306a36Sopenharmony_ci	   trigger_based:1,
389862306a36Sopenharmony_ci	   non_trigger_based:1,
389962306a36Sopenharmony_ci	   lmr_feedback:1;
390062306a36Sopenharmony_ci	u8 num_bursts_exp;
390162306a36Sopenharmony_ci	u8 burst_duration;
390262306a36Sopenharmony_ci	u8 ftms_per_burst;
390362306a36Sopenharmony_ci	u8 ftmr_retries;
390462306a36Sopenharmony_ci	u8 bss_color;
390562306a36Sopenharmony_ci};
390662306a36Sopenharmony_ci
390762306a36Sopenharmony_ci/**
390862306a36Sopenharmony_ci * struct cfg80211_pmsr_request_peer - peer data for a peer measurement request
390962306a36Sopenharmony_ci * @addr: MAC address
391062306a36Sopenharmony_ci * @chandef: channel to use
391162306a36Sopenharmony_ci * @report_ap_tsf: report the associated AP's TSF
391262306a36Sopenharmony_ci * @ftm: FTM data, see &struct cfg80211_pmsr_ftm_request_peer
391362306a36Sopenharmony_ci */
391462306a36Sopenharmony_cistruct cfg80211_pmsr_request_peer {
391562306a36Sopenharmony_ci	u8 addr[ETH_ALEN];
391662306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
391762306a36Sopenharmony_ci	u8 report_ap_tsf:1;
391862306a36Sopenharmony_ci	struct cfg80211_pmsr_ftm_request_peer ftm;
391962306a36Sopenharmony_ci};
392062306a36Sopenharmony_ci
392162306a36Sopenharmony_ci/**
392262306a36Sopenharmony_ci * struct cfg80211_pmsr_request - peer measurement request
392362306a36Sopenharmony_ci * @cookie: cookie, set by cfg80211
392462306a36Sopenharmony_ci * @nl_portid: netlink portid - used by cfg80211
392562306a36Sopenharmony_ci * @drv_data: driver data for this request, if required for aborting,
392662306a36Sopenharmony_ci *	not otherwise freed or anything by cfg80211
392762306a36Sopenharmony_ci * @mac_addr: MAC address used for (randomised) request
392862306a36Sopenharmony_ci * @mac_addr_mask: MAC address mask used for randomisation, bits that
392962306a36Sopenharmony_ci *	are 0 in the mask should be randomised, bits that are 1 should
393062306a36Sopenharmony_ci *	be taken from the @mac_addr
393162306a36Sopenharmony_ci * @list: used by cfg80211 to hold on to the request
393262306a36Sopenharmony_ci * @timeout: timeout (in milliseconds) for the whole operation, if
393362306a36Sopenharmony_ci *	zero it means there's no timeout
393462306a36Sopenharmony_ci * @n_peers: number of peers to do measurements with
393562306a36Sopenharmony_ci * @peers: per-peer measurement request data
393662306a36Sopenharmony_ci */
393762306a36Sopenharmony_cistruct cfg80211_pmsr_request {
393862306a36Sopenharmony_ci	u64 cookie;
393962306a36Sopenharmony_ci	void *drv_data;
394062306a36Sopenharmony_ci	u32 n_peers;
394162306a36Sopenharmony_ci	u32 nl_portid;
394262306a36Sopenharmony_ci
394362306a36Sopenharmony_ci	u32 timeout;
394462306a36Sopenharmony_ci
394562306a36Sopenharmony_ci	u8 mac_addr[ETH_ALEN] __aligned(2);
394662306a36Sopenharmony_ci	u8 mac_addr_mask[ETH_ALEN] __aligned(2);
394762306a36Sopenharmony_ci
394862306a36Sopenharmony_ci	struct list_head list;
394962306a36Sopenharmony_ci
395062306a36Sopenharmony_ci	struct cfg80211_pmsr_request_peer peers[] __counted_by(n_peers);
395162306a36Sopenharmony_ci};
395262306a36Sopenharmony_ci
395362306a36Sopenharmony_ci/**
395462306a36Sopenharmony_ci * struct cfg80211_update_owe_info - OWE Information
395562306a36Sopenharmony_ci *
395662306a36Sopenharmony_ci * This structure provides information needed for the drivers to offload OWE
395762306a36Sopenharmony_ci * (Opportunistic Wireless Encryption) processing to the user space.
395862306a36Sopenharmony_ci *
395962306a36Sopenharmony_ci * Commonly used across update_owe_info request and event interfaces.
396062306a36Sopenharmony_ci *
396162306a36Sopenharmony_ci * @peer: MAC address of the peer device for which the OWE processing
396262306a36Sopenharmony_ci *	has to be done.
396362306a36Sopenharmony_ci * @status: status code, %WLAN_STATUS_SUCCESS for successful OWE info
396462306a36Sopenharmony_ci *	processing, use %WLAN_STATUS_UNSPECIFIED_FAILURE if user space
396562306a36Sopenharmony_ci *	cannot give you the real status code for failures. Used only for
396662306a36Sopenharmony_ci *	OWE update request command interface (user space to driver).
396762306a36Sopenharmony_ci * @ie: IEs obtained from the peer or constructed by the user space. These are
396862306a36Sopenharmony_ci *	the IEs of the remote peer in the event from the host driver and
396962306a36Sopenharmony_ci *	the constructed IEs by the user space in the request interface.
397062306a36Sopenharmony_ci * @ie_len: Length of IEs in octets.
397162306a36Sopenharmony_ci * @assoc_link_id: MLO link ID of the AP, with which (re)association requested
397262306a36Sopenharmony_ci *	by peer. This will be filled by driver for both MLO and non-MLO station
397362306a36Sopenharmony_ci *	connections when the AP affiliated with an MLD. For non-MLD AP mode, it
397462306a36Sopenharmony_ci *	will be -1. Used only with OWE update event (driver to user space).
397562306a36Sopenharmony_ci * @peer_mld_addr: For MLO connection, MLD address of the peer. For non-MLO
397662306a36Sopenharmony_ci *	connection, it will be all zeros. This is applicable only when
397762306a36Sopenharmony_ci *	@assoc_link_id is not -1, i.e., the AP affiliated with an MLD. Used only
397862306a36Sopenharmony_ci *	with OWE update event (driver to user space).
397962306a36Sopenharmony_ci */
398062306a36Sopenharmony_cistruct cfg80211_update_owe_info {
398162306a36Sopenharmony_ci	u8 peer[ETH_ALEN] __aligned(2);
398262306a36Sopenharmony_ci	u16 status;
398362306a36Sopenharmony_ci	const u8 *ie;
398462306a36Sopenharmony_ci	size_t ie_len;
398562306a36Sopenharmony_ci	int assoc_link_id;
398662306a36Sopenharmony_ci	u8 peer_mld_addr[ETH_ALEN] __aligned(2);
398762306a36Sopenharmony_ci};
398862306a36Sopenharmony_ci
398962306a36Sopenharmony_ci/**
399062306a36Sopenharmony_ci * struct mgmt_frame_regs - management frame registrations data
399162306a36Sopenharmony_ci * @global_stypes: bitmap of management frame subtypes registered
399262306a36Sopenharmony_ci *	for the entire device
399362306a36Sopenharmony_ci * @interface_stypes: bitmap of management frame subtypes registered
399462306a36Sopenharmony_ci *	for the given interface
399562306a36Sopenharmony_ci * @global_mcast_stypes: mcast RX is needed globally for these subtypes
399662306a36Sopenharmony_ci * @interface_mcast_stypes: mcast RX is needed on this interface
399762306a36Sopenharmony_ci *	for these subtypes
399862306a36Sopenharmony_ci */
399962306a36Sopenharmony_cistruct mgmt_frame_regs {
400062306a36Sopenharmony_ci	u32 global_stypes, interface_stypes;
400162306a36Sopenharmony_ci	u32 global_mcast_stypes, interface_mcast_stypes;
400262306a36Sopenharmony_ci};
400362306a36Sopenharmony_ci
400462306a36Sopenharmony_ci/**
400562306a36Sopenharmony_ci * struct cfg80211_ops - backend description for wireless configuration
400662306a36Sopenharmony_ci *
400762306a36Sopenharmony_ci * This struct is registered by fullmac card drivers and/or wireless stacks
400862306a36Sopenharmony_ci * in order to handle configuration requests on their interfaces.
400962306a36Sopenharmony_ci *
401062306a36Sopenharmony_ci * All callbacks except where otherwise noted should return 0
401162306a36Sopenharmony_ci * on success or a negative error code.
401262306a36Sopenharmony_ci *
401362306a36Sopenharmony_ci * All operations are invoked with the wiphy mutex held. The RTNL may be
401462306a36Sopenharmony_ci * held in addition (due to wireless extensions) but this cannot be relied
401562306a36Sopenharmony_ci * upon except in cases where documented below. Note that due to ordering,
401662306a36Sopenharmony_ci * the RTNL also cannot be acquired in any handlers.
401762306a36Sopenharmony_ci *
401862306a36Sopenharmony_ci * @suspend: wiphy device needs to be suspended. The variable @wow will
401962306a36Sopenharmony_ci *	be %NULL or contain the enabled Wake-on-Wireless triggers that are
402062306a36Sopenharmony_ci *	configured for the device.
402162306a36Sopenharmony_ci * @resume: wiphy device needs to be resumed
402262306a36Sopenharmony_ci * @set_wakeup: Called when WoWLAN is enabled/disabled, use this callback
402362306a36Sopenharmony_ci *	to call device_set_wakeup_enable() to enable/disable wakeup from
402462306a36Sopenharmony_ci *	the device.
402562306a36Sopenharmony_ci *
402662306a36Sopenharmony_ci * @add_virtual_intf: create a new virtual interface with the given name,
402762306a36Sopenharmony_ci *	must set the struct wireless_dev's iftype. Beware: You must create
402862306a36Sopenharmony_ci *	the new netdev in the wiphy's network namespace! Returns the struct
402962306a36Sopenharmony_ci *	wireless_dev, or an ERR_PTR. For P2P device wdevs, the driver must
403062306a36Sopenharmony_ci *	also set the address member in the wdev.
403162306a36Sopenharmony_ci *	This additionally holds the RTNL to be able to do netdev changes.
403262306a36Sopenharmony_ci *
403362306a36Sopenharmony_ci * @del_virtual_intf: remove the virtual interface
403462306a36Sopenharmony_ci *	This additionally holds the RTNL to be able to do netdev changes.
403562306a36Sopenharmony_ci *
403662306a36Sopenharmony_ci * @change_virtual_intf: change type/configuration of virtual interface,
403762306a36Sopenharmony_ci *	keep the struct wireless_dev's iftype updated.
403862306a36Sopenharmony_ci *	This additionally holds the RTNL to be able to do netdev changes.
403962306a36Sopenharmony_ci *
404062306a36Sopenharmony_ci * @add_intf_link: Add a new MLO link to the given interface. Note that
404162306a36Sopenharmony_ci *	the wdev->link[] data structure has been updated, so the new link
404262306a36Sopenharmony_ci *	address is available.
404362306a36Sopenharmony_ci * @del_intf_link: Remove an MLO link from the given interface.
404462306a36Sopenharmony_ci *
404562306a36Sopenharmony_ci * @add_key: add a key with the given parameters. @mac_addr will be %NULL
404662306a36Sopenharmony_ci *	when adding a group key. @link_id will be -1 for non-MLO connection.
404762306a36Sopenharmony_ci *	For MLO connection, @link_id will be >= 0 for group key and -1 for
404862306a36Sopenharmony_ci *	pairwise key, @mac_addr will be peer's MLD address for MLO pairwise key.
404962306a36Sopenharmony_ci *
405062306a36Sopenharmony_ci * @get_key: get information about the key with the given parameters.
405162306a36Sopenharmony_ci *	@mac_addr will be %NULL when requesting information for a group
405262306a36Sopenharmony_ci *	key. All pointers given to the @callback function need not be valid
405362306a36Sopenharmony_ci *	after it returns. This function should return an error if it is
405462306a36Sopenharmony_ci *	not possible to retrieve the key, -ENOENT if it doesn't exist.
405562306a36Sopenharmony_ci *	@link_id will be -1 for non-MLO connection. For MLO connection,
405662306a36Sopenharmony_ci *	@link_id will be >= 0 for group key and -1 for pairwise key, @mac_addr
405762306a36Sopenharmony_ci *	will be peer's MLD address for MLO pairwise key.
405862306a36Sopenharmony_ci *
405962306a36Sopenharmony_ci * @del_key: remove a key given the @mac_addr (%NULL for a group key)
406062306a36Sopenharmony_ci *	and @key_index, return -ENOENT if the key doesn't exist. @link_id will
406162306a36Sopenharmony_ci *	be -1 for non-MLO connection. For MLO connection, @link_id will be >= 0
406262306a36Sopenharmony_ci *	for group key and -1 for pairwise key, @mac_addr will be peer's MLD
406362306a36Sopenharmony_ci *	address for MLO pairwise key.
406462306a36Sopenharmony_ci *
406562306a36Sopenharmony_ci * @set_default_key: set the default key on an interface. @link_id will be >= 0
406662306a36Sopenharmony_ci *	for MLO connection and -1 for non-MLO connection.
406762306a36Sopenharmony_ci *
406862306a36Sopenharmony_ci * @set_default_mgmt_key: set the default management frame key on an interface.
406962306a36Sopenharmony_ci *	@link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
407062306a36Sopenharmony_ci *
407162306a36Sopenharmony_ci * @set_default_beacon_key: set the default Beacon frame key on an interface.
407262306a36Sopenharmony_ci *	@link_id will be >= 0 for MLO connection and -1 for non-MLO connection.
407362306a36Sopenharmony_ci *
407462306a36Sopenharmony_ci * @set_rekey_data: give the data necessary for GTK rekeying to the driver
407562306a36Sopenharmony_ci *
407662306a36Sopenharmony_ci * @start_ap: Start acting in AP mode defined by the parameters.
407762306a36Sopenharmony_ci * @change_beacon: Change the beacon parameters for an access point mode
407862306a36Sopenharmony_ci *	interface. This should reject the call when AP mode wasn't started.
407962306a36Sopenharmony_ci * @stop_ap: Stop being an AP, including stopping beaconing.
408062306a36Sopenharmony_ci *
408162306a36Sopenharmony_ci * @add_station: Add a new station.
408262306a36Sopenharmony_ci * @del_station: Remove a station
408362306a36Sopenharmony_ci * @change_station: Modify a given station. Note that flags changes are not much
408462306a36Sopenharmony_ci *	validated in cfg80211, in particular the auth/assoc/authorized flags
408562306a36Sopenharmony_ci *	might come to the driver in invalid combinations -- make sure to check
408662306a36Sopenharmony_ci *	them, also against the existing state! Drivers must call
408762306a36Sopenharmony_ci *	cfg80211_check_station_change() to validate the information.
408862306a36Sopenharmony_ci * @get_station: get station information for the station identified by @mac
408962306a36Sopenharmony_ci * @dump_station: dump station callback -- resume dump at index @idx
409062306a36Sopenharmony_ci *
409162306a36Sopenharmony_ci * @add_mpath: add a fixed mesh path
409262306a36Sopenharmony_ci * @del_mpath: delete a given mesh path
409362306a36Sopenharmony_ci * @change_mpath: change a given mesh path
409462306a36Sopenharmony_ci * @get_mpath: get a mesh path for the given parameters
409562306a36Sopenharmony_ci * @dump_mpath: dump mesh path callback -- resume dump at index @idx
409662306a36Sopenharmony_ci * @get_mpp: get a mesh proxy path for the given parameters
409762306a36Sopenharmony_ci * @dump_mpp: dump mesh proxy path callback -- resume dump at index @idx
409862306a36Sopenharmony_ci * @join_mesh: join the mesh network with the specified parameters
409962306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
410062306a36Sopenharmony_ci * @leave_mesh: leave the current mesh network
410162306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
410262306a36Sopenharmony_ci *
410362306a36Sopenharmony_ci * @get_mesh_config: Get the current mesh configuration
410462306a36Sopenharmony_ci *
410562306a36Sopenharmony_ci * @update_mesh_config: Update mesh parameters on a running mesh.
410662306a36Sopenharmony_ci *	The mask is a bitfield which tells us which parameters to
410762306a36Sopenharmony_ci *	set, and which to leave alone.
410862306a36Sopenharmony_ci *
410962306a36Sopenharmony_ci * @change_bss: Modify parameters for a given BSS.
411062306a36Sopenharmony_ci *
411162306a36Sopenharmony_ci * @inform_bss: Called by cfg80211 while being informed about new BSS data
411262306a36Sopenharmony_ci *	for every BSS found within the reported data or frame. This is called
411362306a36Sopenharmony_ci *	from within the cfg8011 inform_bss handlers while holding the bss_lock.
411462306a36Sopenharmony_ci *	The data parameter is passed through from drv_data inside
411562306a36Sopenharmony_ci *	struct cfg80211_inform_bss.
411662306a36Sopenharmony_ci *	The new IE data for the BSS is explicitly passed.
411762306a36Sopenharmony_ci *
411862306a36Sopenharmony_ci * @set_txq_params: Set TX queue parameters
411962306a36Sopenharmony_ci *
412062306a36Sopenharmony_ci * @libertas_set_mesh_channel: Only for backward compatibility for libertas,
412162306a36Sopenharmony_ci *	as it doesn't implement join_mesh and needs to set the channel to
412262306a36Sopenharmony_ci *	join the mesh instead.
412362306a36Sopenharmony_ci *
412462306a36Sopenharmony_ci * @set_monitor_channel: Set the monitor mode channel for the device. If other
412562306a36Sopenharmony_ci *	interfaces are active this callback should reject the configuration.
412662306a36Sopenharmony_ci *	If no interfaces are active or the device is down, the channel should
412762306a36Sopenharmony_ci *	be stored for when a monitor interface becomes active.
412862306a36Sopenharmony_ci *
412962306a36Sopenharmony_ci * @scan: Request to do a scan. If returning zero, the scan request is given
413062306a36Sopenharmony_ci *	the driver, and will be valid until passed to cfg80211_scan_done().
413162306a36Sopenharmony_ci *	For scan results, call cfg80211_inform_bss(); you can call this outside
413262306a36Sopenharmony_ci *	the scan/scan_done bracket too.
413362306a36Sopenharmony_ci * @abort_scan: Tell the driver to abort an ongoing scan. The driver shall
413462306a36Sopenharmony_ci *	indicate the status of the scan through cfg80211_scan_done().
413562306a36Sopenharmony_ci *
413662306a36Sopenharmony_ci * @auth: Request to authenticate with the specified peer
413762306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
413862306a36Sopenharmony_ci * @assoc: Request to (re)associate with the specified peer
413962306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
414062306a36Sopenharmony_ci * @deauth: Request to deauthenticate from the specified peer
414162306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
414262306a36Sopenharmony_ci * @disassoc: Request to disassociate from the specified peer
414362306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
414462306a36Sopenharmony_ci *
414562306a36Sopenharmony_ci * @connect: Connect to the ESS with the specified parameters. When connected,
414662306a36Sopenharmony_ci *	call cfg80211_connect_result()/cfg80211_connect_bss() with status code
414762306a36Sopenharmony_ci *	%WLAN_STATUS_SUCCESS. If the connection fails for some reason, call
414862306a36Sopenharmony_ci *	cfg80211_connect_result()/cfg80211_connect_bss() with the status code
414962306a36Sopenharmony_ci *	from the AP or cfg80211_connect_timeout() if no frame with status code
415062306a36Sopenharmony_ci *	was received.
415162306a36Sopenharmony_ci *	The driver is allowed to roam to other BSSes within the ESS when the
415262306a36Sopenharmony_ci *	other BSS matches the connect parameters. When such roaming is initiated
415362306a36Sopenharmony_ci *	by the driver, the driver is expected to verify that the target matches
415462306a36Sopenharmony_ci *	the configured security parameters and to use Reassociation Request
415562306a36Sopenharmony_ci *	frame instead of Association Request frame.
415662306a36Sopenharmony_ci *	The connect function can also be used to request the driver to perform a
415762306a36Sopenharmony_ci *	specific roam when connected to an ESS. In that case, the prev_bssid
415862306a36Sopenharmony_ci *	parameter is set to the BSSID of the currently associated BSS as an
415962306a36Sopenharmony_ci *	indication of requesting reassociation.
416062306a36Sopenharmony_ci *	In both the driver-initiated and new connect() call initiated roaming
416162306a36Sopenharmony_ci *	cases, the result of roaming is indicated with a call to
416262306a36Sopenharmony_ci *	cfg80211_roamed(). (invoked with the wireless_dev mutex held)
416362306a36Sopenharmony_ci * @update_connect_params: Update the connect parameters while connected to a
416462306a36Sopenharmony_ci *	BSS. The updated parameters can be used by driver/firmware for
416562306a36Sopenharmony_ci *	subsequent BSS selection (roaming) decisions and to form the
416662306a36Sopenharmony_ci *	Authentication/(Re)Association Request frames. This call does not
416762306a36Sopenharmony_ci *	request an immediate disassociation or reassociation with the current
416862306a36Sopenharmony_ci *	BSS, i.e., this impacts only subsequent (re)associations. The bits in
416962306a36Sopenharmony_ci *	changed are defined in &enum cfg80211_connect_params_changed.
417062306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
417162306a36Sopenharmony_ci * @disconnect: Disconnect from the BSS/ESS or stop connection attempts if
417262306a36Sopenharmony_ci *      connection is in progress. Once done, call cfg80211_disconnected() in
417362306a36Sopenharmony_ci *      case connection was already established (invoked with the
417462306a36Sopenharmony_ci *      wireless_dev mutex held), otherwise call cfg80211_connect_timeout().
417562306a36Sopenharmony_ci *
417662306a36Sopenharmony_ci * @join_ibss: Join the specified IBSS (or create if necessary). Once done, call
417762306a36Sopenharmony_ci *	cfg80211_ibss_joined(), also call that function when changing BSSID due
417862306a36Sopenharmony_ci *	to a merge.
417962306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
418062306a36Sopenharmony_ci * @leave_ibss: Leave the IBSS.
418162306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
418262306a36Sopenharmony_ci *
418362306a36Sopenharmony_ci * @set_mcast_rate: Set the specified multicast rate (only if vif is in ADHOC or
418462306a36Sopenharmony_ci *	MESH mode)
418562306a36Sopenharmony_ci *
418662306a36Sopenharmony_ci * @set_wiphy_params: Notify that wiphy parameters have changed;
418762306a36Sopenharmony_ci *	@changed bitfield (see &enum wiphy_params_flags) describes which values
418862306a36Sopenharmony_ci *	have changed. The actual parameter values are available in
418962306a36Sopenharmony_ci *	struct wiphy. If returning an error, no value should be changed.
419062306a36Sopenharmony_ci *
419162306a36Sopenharmony_ci * @set_tx_power: set the transmit power according to the parameters,
419262306a36Sopenharmony_ci *	the power passed is in mBm, to get dBm use MBM_TO_DBM(). The
419362306a36Sopenharmony_ci *	wdev may be %NULL if power was set for the wiphy, and will
419462306a36Sopenharmony_ci *	always be %NULL unless the driver supports per-vif TX power
419562306a36Sopenharmony_ci *	(as advertised by the nl80211 feature flag.)
419662306a36Sopenharmony_ci * @get_tx_power: store the current TX power into the dbm variable;
419762306a36Sopenharmony_ci *	return 0 if successful
419862306a36Sopenharmony_ci *
419962306a36Sopenharmony_ci * @rfkill_poll: polls the hw rfkill line, use cfg80211 reporting
420062306a36Sopenharmony_ci *	functions to adjust rfkill hw state
420162306a36Sopenharmony_ci *
420262306a36Sopenharmony_ci * @dump_survey: get site survey information.
420362306a36Sopenharmony_ci *
420462306a36Sopenharmony_ci * @remain_on_channel: Request the driver to remain awake on the specified
420562306a36Sopenharmony_ci *	channel for the specified duration to complete an off-channel
420662306a36Sopenharmony_ci *	operation (e.g., public action frame exchange). When the driver is
420762306a36Sopenharmony_ci *	ready on the requested channel, it must indicate this with an event
420862306a36Sopenharmony_ci *	notification by calling cfg80211_ready_on_channel().
420962306a36Sopenharmony_ci * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation.
421062306a36Sopenharmony_ci *	This allows the operation to be terminated prior to timeout based on
421162306a36Sopenharmony_ci *	the duration value.
421262306a36Sopenharmony_ci * @mgmt_tx: Transmit a management frame.
421362306a36Sopenharmony_ci * @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
421462306a36Sopenharmony_ci *	frame on another channel
421562306a36Sopenharmony_ci *
421662306a36Sopenharmony_ci * @testmode_cmd: run a test mode command; @wdev may be %NULL
421762306a36Sopenharmony_ci * @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
421862306a36Sopenharmony_ci *	used by the function, but 0 and 1 must not be touched. Additionally,
421962306a36Sopenharmony_ci *	return error codes other than -ENOBUFS and -ENOENT will terminate the
422062306a36Sopenharmony_ci *	dump and return to userspace with an error, so be careful. If any data
422162306a36Sopenharmony_ci *	was passed in from userspace then the data/len arguments will be present
422262306a36Sopenharmony_ci *	and point to the data contained in %NL80211_ATTR_TESTDATA.
422362306a36Sopenharmony_ci *
422462306a36Sopenharmony_ci * @set_bitrate_mask: set the bitrate mask configuration
422562306a36Sopenharmony_ci *
422662306a36Sopenharmony_ci * @set_pmksa: Cache a PMKID for a BSSID. This is mostly useful for fullmac
422762306a36Sopenharmony_ci *	devices running firmwares capable of generating the (re) association
422862306a36Sopenharmony_ci *	RSN IE. It allows for faster roaming between WPA2 BSSIDs.
422962306a36Sopenharmony_ci * @del_pmksa: Delete a cached PMKID.
423062306a36Sopenharmony_ci * @flush_pmksa: Flush all cached PMKIDs.
423162306a36Sopenharmony_ci * @set_power_mgmt: Configure WLAN power management. A timeout value of -1
423262306a36Sopenharmony_ci *	allows the driver to adjust the dynamic ps timeout value.
423362306a36Sopenharmony_ci * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold.
423462306a36Sopenharmony_ci *	After configuration, the driver should (soon) send an event indicating
423562306a36Sopenharmony_ci *	the current level is above/below the configured threshold; this may
423662306a36Sopenharmony_ci *	need some care when the configuration is changed (without first being
423762306a36Sopenharmony_ci *	disabled.)
423862306a36Sopenharmony_ci * @set_cqm_rssi_range_config: Configure two RSSI thresholds in the
423962306a36Sopenharmony_ci *	connection quality monitor.  An event is to be sent only when the
424062306a36Sopenharmony_ci *	signal level is found to be outside the two values.  The driver should
424162306a36Sopenharmony_ci *	set %NL80211_EXT_FEATURE_CQM_RSSI_LIST if this method is implemented.
424262306a36Sopenharmony_ci *	If it is provided then there's no point providing @set_cqm_rssi_config.
424362306a36Sopenharmony_ci * @set_cqm_txe_config: Configure connection quality monitor TX error
424462306a36Sopenharmony_ci *	thresholds.
424562306a36Sopenharmony_ci * @sched_scan_start: Tell the driver to start a scheduled scan.
424662306a36Sopenharmony_ci * @sched_scan_stop: Tell the driver to stop an ongoing scheduled scan with
424762306a36Sopenharmony_ci *	given request id. This call must stop the scheduled scan and be ready
424862306a36Sopenharmony_ci *	for starting a new one before it returns, i.e. @sched_scan_start may be
424962306a36Sopenharmony_ci *	called immediately after that again and should not fail in that case.
425062306a36Sopenharmony_ci *	The driver should not call cfg80211_sched_scan_stopped() for a requested
425162306a36Sopenharmony_ci *	stop (when this method returns 0).
425262306a36Sopenharmony_ci *
425362306a36Sopenharmony_ci * @update_mgmt_frame_registrations: Notify the driver that management frame
425462306a36Sopenharmony_ci *	registrations were updated. The callback is allowed to sleep.
425562306a36Sopenharmony_ci *
425662306a36Sopenharmony_ci * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
425762306a36Sopenharmony_ci *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
425862306a36Sopenharmony_ci *	reject TX/RX mask combinations they cannot support by returning -EINVAL
425962306a36Sopenharmony_ci *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
426062306a36Sopenharmony_ci *
426162306a36Sopenharmony_ci * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
426262306a36Sopenharmony_ci *
426362306a36Sopenharmony_ci * @tdls_mgmt: Transmit a TDLS management frame.
426462306a36Sopenharmony_ci * @tdls_oper: Perform a high-level TDLS operation (e.g. TDLS link setup).
426562306a36Sopenharmony_ci *
426662306a36Sopenharmony_ci * @probe_client: probe an associated client, must return a cookie that it
426762306a36Sopenharmony_ci *	later passes to cfg80211_probe_status().
426862306a36Sopenharmony_ci *
426962306a36Sopenharmony_ci * @set_noack_map: Set the NoAck Map for the TIDs.
427062306a36Sopenharmony_ci *
427162306a36Sopenharmony_ci * @get_channel: Get the current operating channel for the virtual interface.
427262306a36Sopenharmony_ci *	For monitor interfaces, it should return %NULL unless there's a single
427362306a36Sopenharmony_ci *	current monitoring channel.
427462306a36Sopenharmony_ci *
427562306a36Sopenharmony_ci * @start_p2p_device: Start the given P2P device.
427662306a36Sopenharmony_ci * @stop_p2p_device: Stop the given P2P device.
427762306a36Sopenharmony_ci *
427862306a36Sopenharmony_ci * @set_mac_acl: Sets MAC address control list in AP and P2P GO mode.
427962306a36Sopenharmony_ci *	Parameters include ACL policy, an array of MAC address of stations
428062306a36Sopenharmony_ci *	and the number of MAC addresses. If there is already a list in driver
428162306a36Sopenharmony_ci *	this new list replaces the existing one. Driver has to clear its ACL
428262306a36Sopenharmony_ci *	when number of MAC addresses entries is passed as 0. Drivers which
428362306a36Sopenharmony_ci *	advertise the support for MAC based ACL have to implement this callback.
428462306a36Sopenharmony_ci *
428562306a36Sopenharmony_ci * @start_radar_detection: Start radar detection in the driver.
428662306a36Sopenharmony_ci *
428762306a36Sopenharmony_ci * @end_cac: End running CAC, probably because a related CAC
428862306a36Sopenharmony_ci *	was finished on another phy.
428962306a36Sopenharmony_ci *
429062306a36Sopenharmony_ci * @update_ft_ies: Provide updated Fast BSS Transition information to the
429162306a36Sopenharmony_ci *	driver. If the SME is in the driver/firmware, this information can be
429262306a36Sopenharmony_ci *	used in building Authentication and Reassociation Request frames.
429362306a36Sopenharmony_ci *
429462306a36Sopenharmony_ci * @crit_proto_start: Indicates a critical protocol needs more link reliability
429562306a36Sopenharmony_ci *	for a given duration (milliseconds). The protocol is provided so the
429662306a36Sopenharmony_ci *	driver can take the most appropriate actions.
429762306a36Sopenharmony_ci * @crit_proto_stop: Indicates critical protocol no longer needs increased link
429862306a36Sopenharmony_ci *	reliability. This operation can not fail.
429962306a36Sopenharmony_ci * @set_coalesce: Set coalesce parameters.
430062306a36Sopenharmony_ci *
430162306a36Sopenharmony_ci * @channel_switch: initiate channel-switch procedure (with CSA). Driver is
430262306a36Sopenharmony_ci *	responsible for veryfing if the switch is possible. Since this is
430362306a36Sopenharmony_ci *	inherently tricky driver may decide to disconnect an interface later
430462306a36Sopenharmony_ci *	with cfg80211_stop_iface(). This doesn't mean driver can accept
430562306a36Sopenharmony_ci *	everything. It should do it's best to verify requests and reject them
430662306a36Sopenharmony_ci *	as soon as possible.
430762306a36Sopenharmony_ci *
430862306a36Sopenharmony_ci * @set_qos_map: Set QoS mapping information to the driver
430962306a36Sopenharmony_ci *
431062306a36Sopenharmony_ci * @set_ap_chanwidth: Set the AP (including P2P GO) mode channel width for the
431162306a36Sopenharmony_ci *	given interface This is used e.g. for dynamic HT 20/40 MHz channel width
431262306a36Sopenharmony_ci *	changes during the lifetime of the BSS.
431362306a36Sopenharmony_ci *
431462306a36Sopenharmony_ci * @add_tx_ts: validate (if admitted_time is 0) or add a TX TS to the device
431562306a36Sopenharmony_ci *	with the given parameters; action frame exchange has been handled by
431662306a36Sopenharmony_ci *	userspace so this just has to modify the TX path to take the TS into
431762306a36Sopenharmony_ci *	account.
431862306a36Sopenharmony_ci *	If the admitted time is 0 just validate the parameters to make sure
431962306a36Sopenharmony_ci *	the session can be created at all; it is valid to just always return
432062306a36Sopenharmony_ci *	success for that but that may result in inefficient behaviour (handshake
432162306a36Sopenharmony_ci *	with the peer followed by immediate teardown when the addition is later
432262306a36Sopenharmony_ci *	rejected)
432362306a36Sopenharmony_ci * @del_tx_ts: remove an existing TX TS
432462306a36Sopenharmony_ci *
432562306a36Sopenharmony_ci * @join_ocb: join the OCB network with the specified parameters
432662306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
432762306a36Sopenharmony_ci * @leave_ocb: leave the current OCB network
432862306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
432962306a36Sopenharmony_ci *
433062306a36Sopenharmony_ci * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
433162306a36Sopenharmony_ci *	is responsible for continually initiating channel-switching operations
433262306a36Sopenharmony_ci *	and returning to the base channel for communication with the AP.
433362306a36Sopenharmony_ci * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
433462306a36Sopenharmony_ci *	peers must be on the base channel when the call completes.
433562306a36Sopenharmony_ci * @start_nan: Start the NAN interface.
433662306a36Sopenharmony_ci * @stop_nan: Stop the NAN interface.
433762306a36Sopenharmony_ci * @add_nan_func: Add a NAN function. Returns negative value on failure.
433862306a36Sopenharmony_ci *	On success @nan_func ownership is transferred to the driver and
433962306a36Sopenharmony_ci *	it may access it outside of the scope of this function. The driver
434062306a36Sopenharmony_ci *	should free the @nan_func when no longer needed by calling
434162306a36Sopenharmony_ci *	cfg80211_free_nan_func().
434262306a36Sopenharmony_ci *	On success the driver should assign an instance_id in the
434362306a36Sopenharmony_ci *	provided @nan_func.
434462306a36Sopenharmony_ci * @del_nan_func: Delete a NAN function.
434562306a36Sopenharmony_ci * @nan_change_conf: changes NAN configuration. The changed parameters must
434662306a36Sopenharmony_ci *	be specified in @changes (using &enum cfg80211_nan_conf_changes);
434762306a36Sopenharmony_ci *	All other parameters must be ignored.
434862306a36Sopenharmony_ci *
434962306a36Sopenharmony_ci * @set_multicast_to_unicast: configure multicast to unicast conversion for BSS
435062306a36Sopenharmony_ci *
435162306a36Sopenharmony_ci * @get_txq_stats: Get TXQ stats for interface or phy. If wdev is %NULL, this
435262306a36Sopenharmony_ci *      function should return phy stats, and interface stats otherwise.
435362306a36Sopenharmony_ci *
435462306a36Sopenharmony_ci * @set_pmk: configure the PMK to be used for offloaded 802.1X 4-Way handshake.
435562306a36Sopenharmony_ci *	If not deleted through @del_pmk the PMK remains valid until disconnect
435662306a36Sopenharmony_ci *	upon which the driver should clear it.
435762306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
435862306a36Sopenharmony_ci * @del_pmk: delete the previously configured PMK for the given authenticator.
435962306a36Sopenharmony_ci *	(invoked with the wireless_dev mutex held)
436062306a36Sopenharmony_ci *
436162306a36Sopenharmony_ci * @external_auth: indicates result of offloaded authentication processing from
436262306a36Sopenharmony_ci *     user space
436362306a36Sopenharmony_ci *
436462306a36Sopenharmony_ci * @tx_control_port: TX a control port frame (EAPoL).  The noencrypt parameter
436562306a36Sopenharmony_ci *	tells the driver that the frame should not be encrypted.
436662306a36Sopenharmony_ci *
436762306a36Sopenharmony_ci * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
436862306a36Sopenharmony_ci *	Statistics should be cumulative, currently no way to reset is provided.
436962306a36Sopenharmony_ci * @start_pmsr: start peer measurement (e.g. FTM)
437062306a36Sopenharmony_ci * @abort_pmsr: abort peer measurement
437162306a36Sopenharmony_ci *
437262306a36Sopenharmony_ci * @update_owe_info: Provide updated OWE info to driver. Driver implementing SME
437362306a36Sopenharmony_ci *	but offloading OWE processing to the user space will get the updated
437462306a36Sopenharmony_ci *	DH IE through this interface.
437562306a36Sopenharmony_ci *
437662306a36Sopenharmony_ci * @probe_mesh_link: Probe direct Mesh peer's link quality by sending data frame
437762306a36Sopenharmony_ci *	and overrule HWMP path selection algorithm.
437862306a36Sopenharmony_ci * @set_tid_config: TID specific configuration, this can be peer or BSS specific
437962306a36Sopenharmony_ci *	This callback may sleep.
438062306a36Sopenharmony_ci * @reset_tid_config: Reset TID specific configuration for the peer, for the
438162306a36Sopenharmony_ci *	given TIDs. This callback may sleep.
438262306a36Sopenharmony_ci *
438362306a36Sopenharmony_ci * @set_sar_specs: Update the SAR (TX power) settings.
438462306a36Sopenharmony_ci *
438562306a36Sopenharmony_ci * @color_change: Initiate a color change.
438662306a36Sopenharmony_ci *
438762306a36Sopenharmony_ci * @set_fils_aad: Set FILS AAD data to the AP driver so that the driver can use
438862306a36Sopenharmony_ci *	those to decrypt (Re)Association Request and encrypt (Re)Association
438962306a36Sopenharmony_ci *	Response frame.
439062306a36Sopenharmony_ci *
439162306a36Sopenharmony_ci * @set_radar_background: Configure dedicated offchannel chain available for
439262306a36Sopenharmony_ci *	radar/CAC detection on some hw. This chain can't be used to transmit
439362306a36Sopenharmony_ci *	or receive frames and it is bounded to a running wdev.
439462306a36Sopenharmony_ci *	Background radar/CAC detection allows to avoid the CAC downtime
439562306a36Sopenharmony_ci *	switching to a different channel during CAC detection on the selected
439662306a36Sopenharmony_ci *	radar channel.
439762306a36Sopenharmony_ci *	The caller is expected to set chandef pointer to NULL in order to
439862306a36Sopenharmony_ci *	disable background CAC/radar detection.
439962306a36Sopenharmony_ci * @add_link_station: Add a link to a station.
440062306a36Sopenharmony_ci * @mod_link_station: Modify a link of a station.
440162306a36Sopenharmony_ci * @del_link_station: Remove a link of a station.
440262306a36Sopenharmony_ci *
440362306a36Sopenharmony_ci * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
440462306a36Sopenharmony_ci */
440562306a36Sopenharmony_cistruct cfg80211_ops {
440662306a36Sopenharmony_ci	int	(*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
440762306a36Sopenharmony_ci	int	(*resume)(struct wiphy *wiphy);
440862306a36Sopenharmony_ci	void	(*set_wakeup)(struct wiphy *wiphy, bool enabled);
440962306a36Sopenharmony_ci
441062306a36Sopenharmony_ci	struct wireless_dev * (*add_virtual_intf)(struct wiphy *wiphy,
441162306a36Sopenharmony_ci						  const char *name,
441262306a36Sopenharmony_ci						  unsigned char name_assign_type,
441362306a36Sopenharmony_ci						  enum nl80211_iftype type,
441462306a36Sopenharmony_ci						  struct vif_params *params);
441562306a36Sopenharmony_ci	int	(*del_virtual_intf)(struct wiphy *wiphy,
441662306a36Sopenharmony_ci				    struct wireless_dev *wdev);
441762306a36Sopenharmony_ci	int	(*change_virtual_intf)(struct wiphy *wiphy,
441862306a36Sopenharmony_ci				       struct net_device *dev,
441962306a36Sopenharmony_ci				       enum nl80211_iftype type,
442062306a36Sopenharmony_ci				       struct vif_params *params);
442162306a36Sopenharmony_ci
442262306a36Sopenharmony_ci	int	(*add_intf_link)(struct wiphy *wiphy,
442362306a36Sopenharmony_ci				 struct wireless_dev *wdev,
442462306a36Sopenharmony_ci				 unsigned int link_id);
442562306a36Sopenharmony_ci	void	(*del_intf_link)(struct wiphy *wiphy,
442662306a36Sopenharmony_ci				 struct wireless_dev *wdev,
442762306a36Sopenharmony_ci				 unsigned int link_id);
442862306a36Sopenharmony_ci
442962306a36Sopenharmony_ci	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
443062306a36Sopenharmony_ci			   int link_id, u8 key_index, bool pairwise,
443162306a36Sopenharmony_ci			   const u8 *mac_addr, struct key_params *params);
443262306a36Sopenharmony_ci	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
443362306a36Sopenharmony_ci			   int link_id, u8 key_index, bool pairwise,
443462306a36Sopenharmony_ci			   const u8 *mac_addr, void *cookie,
443562306a36Sopenharmony_ci			   void (*callback)(void *cookie, struct key_params*));
443662306a36Sopenharmony_ci	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
443762306a36Sopenharmony_ci			   int link_id, u8 key_index, bool pairwise,
443862306a36Sopenharmony_ci			   const u8 *mac_addr);
443962306a36Sopenharmony_ci	int	(*set_default_key)(struct wiphy *wiphy,
444062306a36Sopenharmony_ci				   struct net_device *netdev, int link_id,
444162306a36Sopenharmony_ci				   u8 key_index, bool unicast, bool multicast);
444262306a36Sopenharmony_ci	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
444362306a36Sopenharmony_ci					struct net_device *netdev, int link_id,
444462306a36Sopenharmony_ci					u8 key_index);
444562306a36Sopenharmony_ci	int	(*set_default_beacon_key)(struct wiphy *wiphy,
444662306a36Sopenharmony_ci					  struct net_device *netdev,
444762306a36Sopenharmony_ci					  int link_id,
444862306a36Sopenharmony_ci					  u8 key_index);
444962306a36Sopenharmony_ci
445062306a36Sopenharmony_ci	int	(*start_ap)(struct wiphy *wiphy, struct net_device *dev,
445162306a36Sopenharmony_ci			    struct cfg80211_ap_settings *settings);
445262306a36Sopenharmony_ci	int	(*change_beacon)(struct wiphy *wiphy, struct net_device *dev,
445362306a36Sopenharmony_ci				 struct cfg80211_beacon_data *info);
445462306a36Sopenharmony_ci	int	(*stop_ap)(struct wiphy *wiphy, struct net_device *dev,
445562306a36Sopenharmony_ci			   unsigned int link_id);
445662306a36Sopenharmony_ci
445762306a36Sopenharmony_ci
445862306a36Sopenharmony_ci	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
445962306a36Sopenharmony_ci			       const u8 *mac,
446062306a36Sopenharmony_ci			       struct station_parameters *params);
446162306a36Sopenharmony_ci	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
446262306a36Sopenharmony_ci			       struct station_del_parameters *params);
446362306a36Sopenharmony_ci	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
446462306a36Sopenharmony_ci				  const u8 *mac,
446562306a36Sopenharmony_ci				  struct station_parameters *params);
446662306a36Sopenharmony_ci	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
446762306a36Sopenharmony_ci			       const u8 *mac, struct station_info *sinfo);
446862306a36Sopenharmony_ci	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
446962306a36Sopenharmony_ci				int idx, u8 *mac, struct station_info *sinfo);
447062306a36Sopenharmony_ci
447162306a36Sopenharmony_ci	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
447262306a36Sopenharmony_ci			       const u8 *dst, const u8 *next_hop);
447362306a36Sopenharmony_ci	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
447462306a36Sopenharmony_ci			       const u8 *dst);
447562306a36Sopenharmony_ci	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
447662306a36Sopenharmony_ci				  const u8 *dst, const u8 *next_hop);
447762306a36Sopenharmony_ci	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
447862306a36Sopenharmony_ci			     u8 *dst, u8 *next_hop, struct mpath_info *pinfo);
447962306a36Sopenharmony_ci	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
448062306a36Sopenharmony_ci			      int idx, u8 *dst, u8 *next_hop,
448162306a36Sopenharmony_ci			      struct mpath_info *pinfo);
448262306a36Sopenharmony_ci	int	(*get_mpp)(struct wiphy *wiphy, struct net_device *dev,
448362306a36Sopenharmony_ci			   u8 *dst, u8 *mpp, struct mpath_info *pinfo);
448462306a36Sopenharmony_ci	int	(*dump_mpp)(struct wiphy *wiphy, struct net_device *dev,
448562306a36Sopenharmony_ci			    int idx, u8 *dst, u8 *mpp,
448662306a36Sopenharmony_ci			    struct mpath_info *pinfo);
448762306a36Sopenharmony_ci	int	(*get_mesh_config)(struct wiphy *wiphy,
448862306a36Sopenharmony_ci				struct net_device *dev,
448962306a36Sopenharmony_ci				struct mesh_config *conf);
449062306a36Sopenharmony_ci	int	(*update_mesh_config)(struct wiphy *wiphy,
449162306a36Sopenharmony_ci				      struct net_device *dev, u32 mask,
449262306a36Sopenharmony_ci				      const struct mesh_config *nconf);
449362306a36Sopenharmony_ci	int	(*join_mesh)(struct wiphy *wiphy, struct net_device *dev,
449462306a36Sopenharmony_ci			     const struct mesh_config *conf,
449562306a36Sopenharmony_ci			     const struct mesh_setup *setup);
449662306a36Sopenharmony_ci	int	(*leave_mesh)(struct wiphy *wiphy, struct net_device *dev);
449762306a36Sopenharmony_ci
449862306a36Sopenharmony_ci	int	(*join_ocb)(struct wiphy *wiphy, struct net_device *dev,
449962306a36Sopenharmony_ci			    struct ocb_setup *setup);
450062306a36Sopenharmony_ci	int	(*leave_ocb)(struct wiphy *wiphy, struct net_device *dev);
450162306a36Sopenharmony_ci
450262306a36Sopenharmony_ci	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
450362306a36Sopenharmony_ci			      struct bss_parameters *params);
450462306a36Sopenharmony_ci
450562306a36Sopenharmony_ci	void	(*inform_bss)(struct wiphy *wiphy, struct cfg80211_bss *bss,
450662306a36Sopenharmony_ci			      const struct cfg80211_bss_ies *ies, void *data);
450762306a36Sopenharmony_ci
450862306a36Sopenharmony_ci	int	(*set_txq_params)(struct wiphy *wiphy, struct net_device *dev,
450962306a36Sopenharmony_ci				  struct ieee80211_txq_params *params);
451062306a36Sopenharmony_ci
451162306a36Sopenharmony_ci	int	(*libertas_set_mesh_channel)(struct wiphy *wiphy,
451262306a36Sopenharmony_ci					     struct net_device *dev,
451362306a36Sopenharmony_ci					     struct ieee80211_channel *chan);
451462306a36Sopenharmony_ci
451562306a36Sopenharmony_ci	int	(*set_monitor_channel)(struct wiphy *wiphy,
451662306a36Sopenharmony_ci				       struct cfg80211_chan_def *chandef);
451762306a36Sopenharmony_ci
451862306a36Sopenharmony_ci	int	(*scan)(struct wiphy *wiphy,
451962306a36Sopenharmony_ci			struct cfg80211_scan_request *request);
452062306a36Sopenharmony_ci	void	(*abort_scan)(struct wiphy *wiphy, struct wireless_dev *wdev);
452162306a36Sopenharmony_ci
452262306a36Sopenharmony_ci	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
452362306a36Sopenharmony_ci			struct cfg80211_auth_request *req);
452462306a36Sopenharmony_ci	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
452562306a36Sopenharmony_ci			 struct cfg80211_assoc_request *req);
452662306a36Sopenharmony_ci	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
452762306a36Sopenharmony_ci			  struct cfg80211_deauth_request *req);
452862306a36Sopenharmony_ci	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
452962306a36Sopenharmony_ci			    struct cfg80211_disassoc_request *req);
453062306a36Sopenharmony_ci
453162306a36Sopenharmony_ci	int	(*connect)(struct wiphy *wiphy, struct net_device *dev,
453262306a36Sopenharmony_ci			   struct cfg80211_connect_params *sme);
453362306a36Sopenharmony_ci	int	(*update_connect_params)(struct wiphy *wiphy,
453462306a36Sopenharmony_ci					 struct net_device *dev,
453562306a36Sopenharmony_ci					 struct cfg80211_connect_params *sme,
453662306a36Sopenharmony_ci					 u32 changed);
453762306a36Sopenharmony_ci	int	(*disconnect)(struct wiphy *wiphy, struct net_device *dev,
453862306a36Sopenharmony_ci			      u16 reason_code);
453962306a36Sopenharmony_ci
454062306a36Sopenharmony_ci	int	(*join_ibss)(struct wiphy *wiphy, struct net_device *dev,
454162306a36Sopenharmony_ci			     struct cfg80211_ibss_params *params);
454262306a36Sopenharmony_ci	int	(*leave_ibss)(struct wiphy *wiphy, struct net_device *dev);
454362306a36Sopenharmony_ci
454462306a36Sopenharmony_ci	int	(*set_mcast_rate)(struct wiphy *wiphy, struct net_device *dev,
454562306a36Sopenharmony_ci				  int rate[NUM_NL80211_BANDS]);
454662306a36Sopenharmony_ci
454762306a36Sopenharmony_ci	int	(*set_wiphy_params)(struct wiphy *wiphy, u32 changed);
454862306a36Sopenharmony_ci
454962306a36Sopenharmony_ci	int	(*set_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
455062306a36Sopenharmony_ci				enum nl80211_tx_power_setting type, int mbm);
455162306a36Sopenharmony_ci	int	(*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
455262306a36Sopenharmony_ci				int *dbm);
455362306a36Sopenharmony_ci
455462306a36Sopenharmony_ci	void	(*rfkill_poll)(struct wiphy *wiphy);
455562306a36Sopenharmony_ci
455662306a36Sopenharmony_ci#ifdef CONFIG_NL80211_TESTMODE
455762306a36Sopenharmony_ci	int	(*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
455862306a36Sopenharmony_ci				void *data, int len);
455962306a36Sopenharmony_ci	int	(*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
456062306a36Sopenharmony_ci				 struct netlink_callback *cb,
456162306a36Sopenharmony_ci				 void *data, int len);
456262306a36Sopenharmony_ci#endif
456362306a36Sopenharmony_ci
456462306a36Sopenharmony_ci	int	(*set_bitrate_mask)(struct wiphy *wiphy,
456562306a36Sopenharmony_ci				    struct net_device *dev,
456662306a36Sopenharmony_ci				    unsigned int link_id,
456762306a36Sopenharmony_ci				    const u8 *peer,
456862306a36Sopenharmony_ci				    const struct cfg80211_bitrate_mask *mask);
456962306a36Sopenharmony_ci
457062306a36Sopenharmony_ci	int	(*dump_survey)(struct wiphy *wiphy, struct net_device *netdev,
457162306a36Sopenharmony_ci			int idx, struct survey_info *info);
457262306a36Sopenharmony_ci
457362306a36Sopenharmony_ci	int	(*set_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
457462306a36Sopenharmony_ci			     struct cfg80211_pmksa *pmksa);
457562306a36Sopenharmony_ci	int	(*del_pmksa)(struct wiphy *wiphy, struct net_device *netdev,
457662306a36Sopenharmony_ci			     struct cfg80211_pmksa *pmksa);
457762306a36Sopenharmony_ci	int	(*flush_pmksa)(struct wiphy *wiphy, struct net_device *netdev);
457862306a36Sopenharmony_ci
457962306a36Sopenharmony_ci	int	(*remain_on_channel)(struct wiphy *wiphy,
458062306a36Sopenharmony_ci				     struct wireless_dev *wdev,
458162306a36Sopenharmony_ci				     struct ieee80211_channel *chan,
458262306a36Sopenharmony_ci				     unsigned int duration,
458362306a36Sopenharmony_ci				     u64 *cookie);
458462306a36Sopenharmony_ci	int	(*cancel_remain_on_channel)(struct wiphy *wiphy,
458562306a36Sopenharmony_ci					    struct wireless_dev *wdev,
458662306a36Sopenharmony_ci					    u64 cookie);
458762306a36Sopenharmony_ci
458862306a36Sopenharmony_ci	int	(*mgmt_tx)(struct wiphy *wiphy, struct wireless_dev *wdev,
458962306a36Sopenharmony_ci			   struct cfg80211_mgmt_tx_params *params,
459062306a36Sopenharmony_ci			   u64 *cookie);
459162306a36Sopenharmony_ci	int	(*mgmt_tx_cancel_wait)(struct wiphy *wiphy,
459262306a36Sopenharmony_ci				       struct wireless_dev *wdev,
459362306a36Sopenharmony_ci				       u64 cookie);
459462306a36Sopenharmony_ci
459562306a36Sopenharmony_ci	int	(*set_power_mgmt)(struct wiphy *wiphy, struct net_device *dev,
459662306a36Sopenharmony_ci				  bool enabled, int timeout);
459762306a36Sopenharmony_ci
459862306a36Sopenharmony_ci	int	(*set_cqm_rssi_config)(struct wiphy *wiphy,
459962306a36Sopenharmony_ci				       struct net_device *dev,
460062306a36Sopenharmony_ci				       s32 rssi_thold, u32 rssi_hyst);
460162306a36Sopenharmony_ci
460262306a36Sopenharmony_ci	int	(*set_cqm_rssi_range_config)(struct wiphy *wiphy,
460362306a36Sopenharmony_ci					     struct net_device *dev,
460462306a36Sopenharmony_ci					     s32 rssi_low, s32 rssi_high);
460562306a36Sopenharmony_ci
460662306a36Sopenharmony_ci	int	(*set_cqm_txe_config)(struct wiphy *wiphy,
460762306a36Sopenharmony_ci				      struct net_device *dev,
460862306a36Sopenharmony_ci				      u32 rate, u32 pkts, u32 intvl);
460962306a36Sopenharmony_ci
461062306a36Sopenharmony_ci	void	(*update_mgmt_frame_registrations)(struct wiphy *wiphy,
461162306a36Sopenharmony_ci						   struct wireless_dev *wdev,
461262306a36Sopenharmony_ci						   struct mgmt_frame_regs *upd);
461362306a36Sopenharmony_ci
461462306a36Sopenharmony_ci	int	(*set_antenna)(struct wiphy *wiphy, u32 tx_ant, u32 rx_ant);
461562306a36Sopenharmony_ci	int	(*get_antenna)(struct wiphy *wiphy, u32 *tx_ant, u32 *rx_ant);
461662306a36Sopenharmony_ci
461762306a36Sopenharmony_ci	int	(*sched_scan_start)(struct wiphy *wiphy,
461862306a36Sopenharmony_ci				struct net_device *dev,
461962306a36Sopenharmony_ci				struct cfg80211_sched_scan_request *request);
462062306a36Sopenharmony_ci	int	(*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev,
462162306a36Sopenharmony_ci				   u64 reqid);
462262306a36Sopenharmony_ci
462362306a36Sopenharmony_ci	int	(*set_rekey_data)(struct wiphy *wiphy, struct net_device *dev,
462462306a36Sopenharmony_ci				  struct cfg80211_gtk_rekey_data *data);
462562306a36Sopenharmony_ci
462662306a36Sopenharmony_ci	int	(*tdls_mgmt)(struct wiphy *wiphy, struct net_device *dev,
462762306a36Sopenharmony_ci			     const u8 *peer, int link_id,
462862306a36Sopenharmony_ci			     u8 action_code, u8 dialog_token, u16 status_code,
462962306a36Sopenharmony_ci			     u32 peer_capability, bool initiator,
463062306a36Sopenharmony_ci			     const u8 *buf, size_t len);
463162306a36Sopenharmony_ci	int	(*tdls_oper)(struct wiphy *wiphy, struct net_device *dev,
463262306a36Sopenharmony_ci			     const u8 *peer, enum nl80211_tdls_operation oper);
463362306a36Sopenharmony_ci
463462306a36Sopenharmony_ci	int	(*probe_client)(struct wiphy *wiphy, struct net_device *dev,
463562306a36Sopenharmony_ci				const u8 *peer, u64 *cookie);
463662306a36Sopenharmony_ci
463762306a36Sopenharmony_ci	int	(*set_noack_map)(struct wiphy *wiphy,
463862306a36Sopenharmony_ci				  struct net_device *dev,
463962306a36Sopenharmony_ci				  u16 noack_map);
464062306a36Sopenharmony_ci
464162306a36Sopenharmony_ci	int	(*get_channel)(struct wiphy *wiphy,
464262306a36Sopenharmony_ci			       struct wireless_dev *wdev,
464362306a36Sopenharmony_ci			       unsigned int link_id,
464462306a36Sopenharmony_ci			       struct cfg80211_chan_def *chandef);
464562306a36Sopenharmony_ci
464662306a36Sopenharmony_ci	int	(*start_p2p_device)(struct wiphy *wiphy,
464762306a36Sopenharmony_ci				    struct wireless_dev *wdev);
464862306a36Sopenharmony_ci	void	(*stop_p2p_device)(struct wiphy *wiphy,
464962306a36Sopenharmony_ci				   struct wireless_dev *wdev);
465062306a36Sopenharmony_ci
465162306a36Sopenharmony_ci	int	(*set_mac_acl)(struct wiphy *wiphy, struct net_device *dev,
465262306a36Sopenharmony_ci			       const struct cfg80211_acl_data *params);
465362306a36Sopenharmony_ci
465462306a36Sopenharmony_ci	int	(*start_radar_detection)(struct wiphy *wiphy,
465562306a36Sopenharmony_ci					 struct net_device *dev,
465662306a36Sopenharmony_ci					 struct cfg80211_chan_def *chandef,
465762306a36Sopenharmony_ci					 u32 cac_time_ms);
465862306a36Sopenharmony_ci	void	(*end_cac)(struct wiphy *wiphy,
465962306a36Sopenharmony_ci				struct net_device *dev);
466062306a36Sopenharmony_ci	int	(*update_ft_ies)(struct wiphy *wiphy, struct net_device *dev,
466162306a36Sopenharmony_ci				 struct cfg80211_update_ft_ies_params *ftie);
466262306a36Sopenharmony_ci	int	(*crit_proto_start)(struct wiphy *wiphy,
466362306a36Sopenharmony_ci				    struct wireless_dev *wdev,
466462306a36Sopenharmony_ci				    enum nl80211_crit_proto_id protocol,
466562306a36Sopenharmony_ci				    u16 duration);
466662306a36Sopenharmony_ci	void	(*crit_proto_stop)(struct wiphy *wiphy,
466762306a36Sopenharmony_ci				   struct wireless_dev *wdev);
466862306a36Sopenharmony_ci	int	(*set_coalesce)(struct wiphy *wiphy,
466962306a36Sopenharmony_ci				struct cfg80211_coalesce *coalesce);
467062306a36Sopenharmony_ci
467162306a36Sopenharmony_ci	int	(*channel_switch)(struct wiphy *wiphy,
467262306a36Sopenharmony_ci				  struct net_device *dev,
467362306a36Sopenharmony_ci				  struct cfg80211_csa_settings *params);
467462306a36Sopenharmony_ci
467562306a36Sopenharmony_ci	int     (*set_qos_map)(struct wiphy *wiphy,
467662306a36Sopenharmony_ci			       struct net_device *dev,
467762306a36Sopenharmony_ci			       struct cfg80211_qos_map *qos_map);
467862306a36Sopenharmony_ci
467962306a36Sopenharmony_ci	int	(*set_ap_chanwidth)(struct wiphy *wiphy, struct net_device *dev,
468062306a36Sopenharmony_ci				    unsigned int link_id,
468162306a36Sopenharmony_ci				    struct cfg80211_chan_def *chandef);
468262306a36Sopenharmony_ci
468362306a36Sopenharmony_ci	int	(*add_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
468462306a36Sopenharmony_ci			     u8 tsid, const u8 *peer, u8 user_prio,
468562306a36Sopenharmony_ci			     u16 admitted_time);
468662306a36Sopenharmony_ci	int	(*del_tx_ts)(struct wiphy *wiphy, struct net_device *dev,
468762306a36Sopenharmony_ci			     u8 tsid, const u8 *peer);
468862306a36Sopenharmony_ci
468962306a36Sopenharmony_ci	int	(*tdls_channel_switch)(struct wiphy *wiphy,
469062306a36Sopenharmony_ci				       struct net_device *dev,
469162306a36Sopenharmony_ci				       const u8 *addr, u8 oper_class,
469262306a36Sopenharmony_ci				       struct cfg80211_chan_def *chandef);
469362306a36Sopenharmony_ci	void	(*tdls_cancel_channel_switch)(struct wiphy *wiphy,
469462306a36Sopenharmony_ci					      struct net_device *dev,
469562306a36Sopenharmony_ci					      const u8 *addr);
469662306a36Sopenharmony_ci	int	(*start_nan)(struct wiphy *wiphy, struct wireless_dev *wdev,
469762306a36Sopenharmony_ci			     struct cfg80211_nan_conf *conf);
469862306a36Sopenharmony_ci	void	(*stop_nan)(struct wiphy *wiphy, struct wireless_dev *wdev);
469962306a36Sopenharmony_ci	int	(*add_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
470062306a36Sopenharmony_ci				struct cfg80211_nan_func *nan_func);
470162306a36Sopenharmony_ci	void	(*del_nan_func)(struct wiphy *wiphy, struct wireless_dev *wdev,
470262306a36Sopenharmony_ci			       u64 cookie);
470362306a36Sopenharmony_ci	int	(*nan_change_conf)(struct wiphy *wiphy,
470462306a36Sopenharmony_ci				   struct wireless_dev *wdev,
470562306a36Sopenharmony_ci				   struct cfg80211_nan_conf *conf,
470662306a36Sopenharmony_ci				   u32 changes);
470762306a36Sopenharmony_ci
470862306a36Sopenharmony_ci	int	(*set_multicast_to_unicast)(struct wiphy *wiphy,
470962306a36Sopenharmony_ci					    struct net_device *dev,
471062306a36Sopenharmony_ci					    const bool enabled);
471162306a36Sopenharmony_ci
471262306a36Sopenharmony_ci	int	(*get_txq_stats)(struct wiphy *wiphy,
471362306a36Sopenharmony_ci				 struct wireless_dev *wdev,
471462306a36Sopenharmony_ci				 struct cfg80211_txq_stats *txqstats);
471562306a36Sopenharmony_ci
471662306a36Sopenharmony_ci	int	(*set_pmk)(struct wiphy *wiphy, struct net_device *dev,
471762306a36Sopenharmony_ci			   const struct cfg80211_pmk_conf *conf);
471862306a36Sopenharmony_ci	int	(*del_pmk)(struct wiphy *wiphy, struct net_device *dev,
471962306a36Sopenharmony_ci			   const u8 *aa);
472062306a36Sopenharmony_ci	int     (*external_auth)(struct wiphy *wiphy, struct net_device *dev,
472162306a36Sopenharmony_ci				 struct cfg80211_external_auth_params *params);
472262306a36Sopenharmony_ci
472362306a36Sopenharmony_ci	int	(*tx_control_port)(struct wiphy *wiphy,
472462306a36Sopenharmony_ci				   struct net_device *dev,
472562306a36Sopenharmony_ci				   const u8 *buf, size_t len,
472662306a36Sopenharmony_ci				   const u8 *dest, const __be16 proto,
472762306a36Sopenharmony_ci				   const bool noencrypt, int link_id,
472862306a36Sopenharmony_ci				   u64 *cookie);
472962306a36Sopenharmony_ci
473062306a36Sopenharmony_ci	int	(*get_ftm_responder_stats)(struct wiphy *wiphy,
473162306a36Sopenharmony_ci				struct net_device *dev,
473262306a36Sopenharmony_ci				struct cfg80211_ftm_responder_stats *ftm_stats);
473362306a36Sopenharmony_ci
473462306a36Sopenharmony_ci	int	(*start_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
473562306a36Sopenharmony_ci			      struct cfg80211_pmsr_request *request);
473662306a36Sopenharmony_ci	void	(*abort_pmsr)(struct wiphy *wiphy, struct wireless_dev *wdev,
473762306a36Sopenharmony_ci			      struct cfg80211_pmsr_request *request);
473862306a36Sopenharmony_ci	int	(*update_owe_info)(struct wiphy *wiphy, struct net_device *dev,
473962306a36Sopenharmony_ci				   struct cfg80211_update_owe_info *owe_info);
474062306a36Sopenharmony_ci	int	(*probe_mesh_link)(struct wiphy *wiphy, struct net_device *dev,
474162306a36Sopenharmony_ci				   const u8 *buf, size_t len);
474262306a36Sopenharmony_ci	int     (*set_tid_config)(struct wiphy *wiphy, struct net_device *dev,
474362306a36Sopenharmony_ci				  struct cfg80211_tid_config *tid_conf);
474462306a36Sopenharmony_ci	int	(*reset_tid_config)(struct wiphy *wiphy, struct net_device *dev,
474562306a36Sopenharmony_ci				    const u8 *peer, u8 tids);
474662306a36Sopenharmony_ci	int	(*set_sar_specs)(struct wiphy *wiphy,
474762306a36Sopenharmony_ci				 struct cfg80211_sar_specs *sar);
474862306a36Sopenharmony_ci	int	(*color_change)(struct wiphy *wiphy,
474962306a36Sopenharmony_ci				struct net_device *dev,
475062306a36Sopenharmony_ci				struct cfg80211_color_change_settings *params);
475162306a36Sopenharmony_ci	int     (*set_fils_aad)(struct wiphy *wiphy, struct net_device *dev,
475262306a36Sopenharmony_ci				struct cfg80211_fils_aad *fils_aad);
475362306a36Sopenharmony_ci	int	(*set_radar_background)(struct wiphy *wiphy,
475462306a36Sopenharmony_ci					struct cfg80211_chan_def *chandef);
475562306a36Sopenharmony_ci	int	(*add_link_station)(struct wiphy *wiphy, struct net_device *dev,
475662306a36Sopenharmony_ci				    struct link_station_parameters *params);
475762306a36Sopenharmony_ci	int	(*mod_link_station)(struct wiphy *wiphy, struct net_device *dev,
475862306a36Sopenharmony_ci				    struct link_station_parameters *params);
475962306a36Sopenharmony_ci	int	(*del_link_station)(struct wiphy *wiphy, struct net_device *dev,
476062306a36Sopenharmony_ci				    struct link_station_del_parameters *params);
476162306a36Sopenharmony_ci	int	(*set_hw_timestamp)(struct wiphy *wiphy, struct net_device *dev,
476262306a36Sopenharmony_ci				    struct cfg80211_set_hw_timestamp *hwts);
476362306a36Sopenharmony_ci};
476462306a36Sopenharmony_ci
476562306a36Sopenharmony_ci/*
476662306a36Sopenharmony_ci * wireless hardware and networking interfaces structures
476762306a36Sopenharmony_ci * and registration/helper functions
476862306a36Sopenharmony_ci */
476962306a36Sopenharmony_ci
477062306a36Sopenharmony_ci/**
477162306a36Sopenharmony_ci * enum wiphy_flags - wiphy capability flags
477262306a36Sopenharmony_ci *
477362306a36Sopenharmony_ci * @WIPHY_FLAG_SPLIT_SCAN_6GHZ: if set to true, the scan request will be split
477462306a36Sopenharmony_ci *	 into two, first for legacy bands and second for UHB.
477562306a36Sopenharmony_ci * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
477662306a36Sopenharmony_ci *	wiphy at all
477762306a36Sopenharmony_ci * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
477862306a36Sopenharmony_ci *	by default -- this flag will be set depending on the kernel's default
477962306a36Sopenharmony_ci *	on wiphy_new(), but can be changed by the driver if it has a good
478062306a36Sopenharmony_ci *	reason to override the default
478162306a36Sopenharmony_ci * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station
478262306a36Sopenharmony_ci *	on a VLAN interface). This flag also serves an extra purpose of
478362306a36Sopenharmony_ci *	supporting 4ADDR AP mode on devices which do not support AP/VLAN iftype.
478462306a36Sopenharmony_ci * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station
478562306a36Sopenharmony_ci * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the
478662306a36Sopenharmony_ci *	control port protocol ethertype. The device also honours the
478762306a36Sopenharmony_ci *	control_port_no_encrypt flag.
478862306a36Sopenharmony_ci * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN.
478962306a36Sopenharmony_ci * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing
479062306a36Sopenharmony_ci *	auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH.
479162306a36Sopenharmony_ci * @WIPHY_FLAG_SUPPORTS_FW_ROAM: The device supports roaming feature in the
479262306a36Sopenharmony_ci *	firmware.
479362306a36Sopenharmony_ci * @WIPHY_FLAG_AP_UAPSD: The device supports uapsd on AP.
479462306a36Sopenharmony_ci * @WIPHY_FLAG_SUPPORTS_TDLS: The device supports TDLS (802.11z) operation.
479562306a36Sopenharmony_ci * @WIPHY_FLAG_TDLS_EXTERNAL_SETUP: The device does not handle TDLS (802.11z)
479662306a36Sopenharmony_ci *	link setup/discovery operations internally. Setup, discovery and
479762306a36Sopenharmony_ci *	teardown packets should be sent through the @NL80211_CMD_TDLS_MGMT
479862306a36Sopenharmony_ci *	command. When this flag is not set, @NL80211_CMD_TDLS_OPER should be
479962306a36Sopenharmony_ci *	used for asking the driver/firmware to perform a TDLS operation.
480062306a36Sopenharmony_ci * @WIPHY_FLAG_HAVE_AP_SME: device integrates AP SME
480162306a36Sopenharmony_ci * @WIPHY_FLAG_REPORTS_OBSS: the device will report beacons from other BSSes
480262306a36Sopenharmony_ci *	when there are virtual interfaces in AP mode by calling
480362306a36Sopenharmony_ci *	cfg80211_report_obss_beacon().
480462306a36Sopenharmony_ci * @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD: When operating as an AP, the device
480562306a36Sopenharmony_ci *	responds to probe-requests in hardware.
480662306a36Sopenharmony_ci * @WIPHY_FLAG_OFFCHAN_TX: Device supports direct off-channel TX.
480762306a36Sopenharmony_ci * @WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL: Device supports remain-on-channel call.
480862306a36Sopenharmony_ci * @WIPHY_FLAG_SUPPORTS_5_10_MHZ: Device supports 5 MHz and 10 MHz channels.
480962306a36Sopenharmony_ci * @WIPHY_FLAG_HAS_CHANNEL_SWITCH: Device supports channel switch in
481062306a36Sopenharmony_ci *	beaconing mode (AP, IBSS, Mesh, ...).
481162306a36Sopenharmony_ci * @WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK: The device supports bigger kek and kck keys
481262306a36Sopenharmony_ci * @WIPHY_FLAG_SUPPORTS_MLO: This is a temporary flag gating the MLO APIs,
481362306a36Sopenharmony_ci *	in order to not have them reachable in normal drivers, until we have
481462306a36Sopenharmony_ci *	complete feature/interface combinations/etc. advertisement. No driver
481562306a36Sopenharmony_ci *	should set this flag for now.
481662306a36Sopenharmony_ci * @WIPHY_FLAG_SUPPORTS_EXT_KCK_32: The device supports 32-byte KCK keys.
481762306a36Sopenharmony_ci * @WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER: The device could handle reg notify for
481862306a36Sopenharmony_ci *	NL80211_REGDOM_SET_BY_DRIVER.
481962306a36Sopenharmony_ci */
482062306a36Sopenharmony_cienum wiphy_flags {
482162306a36Sopenharmony_ci	WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK		= BIT(0),
482262306a36Sopenharmony_ci	WIPHY_FLAG_SUPPORTS_MLO			= BIT(1),
482362306a36Sopenharmony_ci	WIPHY_FLAG_SPLIT_SCAN_6GHZ		= BIT(2),
482462306a36Sopenharmony_ci	WIPHY_FLAG_NETNS_OK			= BIT(3),
482562306a36Sopenharmony_ci	WIPHY_FLAG_PS_ON_BY_DEFAULT		= BIT(4),
482662306a36Sopenharmony_ci	WIPHY_FLAG_4ADDR_AP			= BIT(5),
482762306a36Sopenharmony_ci	WIPHY_FLAG_4ADDR_STATION		= BIT(6),
482862306a36Sopenharmony_ci	WIPHY_FLAG_CONTROL_PORT_PROTOCOL	= BIT(7),
482962306a36Sopenharmony_ci	WIPHY_FLAG_IBSS_RSN			= BIT(8),
483062306a36Sopenharmony_ci	WIPHY_FLAG_MESH_AUTH			= BIT(10),
483162306a36Sopenharmony_ci	WIPHY_FLAG_SUPPORTS_EXT_KCK_32          = BIT(11),
483262306a36Sopenharmony_ci	/* use hole at 12 */
483362306a36Sopenharmony_ci	WIPHY_FLAG_SUPPORTS_FW_ROAM		= BIT(13),
483462306a36Sopenharmony_ci	WIPHY_FLAG_AP_UAPSD			= BIT(14),
483562306a36Sopenharmony_ci	WIPHY_FLAG_SUPPORTS_TDLS		= BIT(15),
483662306a36Sopenharmony_ci	WIPHY_FLAG_TDLS_EXTERNAL_SETUP		= BIT(16),
483762306a36Sopenharmony_ci	WIPHY_FLAG_HAVE_AP_SME			= BIT(17),
483862306a36Sopenharmony_ci	WIPHY_FLAG_REPORTS_OBSS			= BIT(18),
483962306a36Sopenharmony_ci	WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD	= BIT(19),
484062306a36Sopenharmony_ci	WIPHY_FLAG_OFFCHAN_TX			= BIT(20),
484162306a36Sopenharmony_ci	WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL	= BIT(21),
484262306a36Sopenharmony_ci	WIPHY_FLAG_SUPPORTS_5_10_MHZ		= BIT(22),
484362306a36Sopenharmony_ci	WIPHY_FLAG_HAS_CHANNEL_SWITCH		= BIT(23),
484462306a36Sopenharmony_ci	WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER	= BIT(24),
484562306a36Sopenharmony_ci};
484662306a36Sopenharmony_ci
484762306a36Sopenharmony_ci/**
484862306a36Sopenharmony_ci * struct ieee80211_iface_limit - limit on certain interface types
484962306a36Sopenharmony_ci * @max: maximum number of interfaces of these types
485062306a36Sopenharmony_ci * @types: interface types (bits)
485162306a36Sopenharmony_ci */
485262306a36Sopenharmony_cistruct ieee80211_iface_limit {
485362306a36Sopenharmony_ci	u16 max;
485462306a36Sopenharmony_ci	u16 types;
485562306a36Sopenharmony_ci};
485662306a36Sopenharmony_ci
485762306a36Sopenharmony_ci/**
485862306a36Sopenharmony_ci * struct ieee80211_iface_combination - possible interface combination
485962306a36Sopenharmony_ci *
486062306a36Sopenharmony_ci * With this structure the driver can describe which interface
486162306a36Sopenharmony_ci * combinations it supports concurrently.
486262306a36Sopenharmony_ci *
486362306a36Sopenharmony_ci * Examples:
486462306a36Sopenharmony_ci *
486562306a36Sopenharmony_ci * 1. Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
486662306a36Sopenharmony_ci *
486762306a36Sopenharmony_ci *    .. code-block:: c
486862306a36Sopenharmony_ci *
486962306a36Sopenharmony_ci *	struct ieee80211_iface_limit limits1[] = {
487062306a36Sopenharmony_ci *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
487162306a36Sopenharmony_ci *		{ .max = 1, .types = BIT(NL80211_IFTYPE_AP), },
487262306a36Sopenharmony_ci *	};
487362306a36Sopenharmony_ci *	struct ieee80211_iface_combination combination1 = {
487462306a36Sopenharmony_ci *		.limits = limits1,
487562306a36Sopenharmony_ci *		.n_limits = ARRAY_SIZE(limits1),
487662306a36Sopenharmony_ci *		.max_interfaces = 2,
487762306a36Sopenharmony_ci *		.beacon_int_infra_match = true,
487862306a36Sopenharmony_ci *	};
487962306a36Sopenharmony_ci *
488062306a36Sopenharmony_ci *
488162306a36Sopenharmony_ci * 2. Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
488262306a36Sopenharmony_ci *
488362306a36Sopenharmony_ci *    .. code-block:: c
488462306a36Sopenharmony_ci *
488562306a36Sopenharmony_ci *	struct ieee80211_iface_limit limits2[] = {
488662306a36Sopenharmony_ci *		{ .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
488762306a36Sopenharmony_ci *				     BIT(NL80211_IFTYPE_P2P_GO), },
488862306a36Sopenharmony_ci *	};
488962306a36Sopenharmony_ci *	struct ieee80211_iface_combination combination2 = {
489062306a36Sopenharmony_ci *		.limits = limits2,
489162306a36Sopenharmony_ci *		.n_limits = ARRAY_SIZE(limits2),
489262306a36Sopenharmony_ci *		.max_interfaces = 8,
489362306a36Sopenharmony_ci *		.num_different_channels = 1,
489462306a36Sopenharmony_ci *	};
489562306a36Sopenharmony_ci *
489662306a36Sopenharmony_ci *
489762306a36Sopenharmony_ci * 3. Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
489862306a36Sopenharmony_ci *
489962306a36Sopenharmony_ci *    This allows for an infrastructure connection and three P2P connections.
490062306a36Sopenharmony_ci *
490162306a36Sopenharmony_ci *    .. code-block:: c
490262306a36Sopenharmony_ci *
490362306a36Sopenharmony_ci *	struct ieee80211_iface_limit limits3[] = {
490462306a36Sopenharmony_ci *		{ .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
490562306a36Sopenharmony_ci *		{ .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
490662306a36Sopenharmony_ci *				     BIT(NL80211_IFTYPE_P2P_CLIENT), },
490762306a36Sopenharmony_ci *	};
490862306a36Sopenharmony_ci *	struct ieee80211_iface_combination combination3 = {
490962306a36Sopenharmony_ci *		.limits = limits3,
491062306a36Sopenharmony_ci *		.n_limits = ARRAY_SIZE(limits3),
491162306a36Sopenharmony_ci *		.max_interfaces = 4,
491262306a36Sopenharmony_ci *		.num_different_channels = 2,
491362306a36Sopenharmony_ci *	};
491462306a36Sopenharmony_ci *
491562306a36Sopenharmony_ci */
491662306a36Sopenharmony_cistruct ieee80211_iface_combination {
491762306a36Sopenharmony_ci	/**
491862306a36Sopenharmony_ci	 * @limits:
491962306a36Sopenharmony_ci	 * limits for the given interface types
492062306a36Sopenharmony_ci	 */
492162306a36Sopenharmony_ci	const struct ieee80211_iface_limit *limits;
492262306a36Sopenharmony_ci
492362306a36Sopenharmony_ci	/**
492462306a36Sopenharmony_ci	 * @num_different_channels:
492562306a36Sopenharmony_ci	 * can use up to this many different channels
492662306a36Sopenharmony_ci	 */
492762306a36Sopenharmony_ci	u32 num_different_channels;
492862306a36Sopenharmony_ci
492962306a36Sopenharmony_ci	/**
493062306a36Sopenharmony_ci	 * @max_interfaces:
493162306a36Sopenharmony_ci	 * maximum number of interfaces in total allowed in this group
493262306a36Sopenharmony_ci	 */
493362306a36Sopenharmony_ci	u16 max_interfaces;
493462306a36Sopenharmony_ci
493562306a36Sopenharmony_ci	/**
493662306a36Sopenharmony_ci	 * @n_limits:
493762306a36Sopenharmony_ci	 * number of limitations
493862306a36Sopenharmony_ci	 */
493962306a36Sopenharmony_ci	u8 n_limits;
494062306a36Sopenharmony_ci
494162306a36Sopenharmony_ci	/**
494262306a36Sopenharmony_ci	 * @beacon_int_infra_match:
494362306a36Sopenharmony_ci	 * In this combination, the beacon intervals between infrastructure
494462306a36Sopenharmony_ci	 * and AP types must match. This is required only in special cases.
494562306a36Sopenharmony_ci	 */
494662306a36Sopenharmony_ci	bool beacon_int_infra_match;
494762306a36Sopenharmony_ci
494862306a36Sopenharmony_ci	/**
494962306a36Sopenharmony_ci	 * @radar_detect_widths:
495062306a36Sopenharmony_ci	 * bitmap of channel widths supported for radar detection
495162306a36Sopenharmony_ci	 */
495262306a36Sopenharmony_ci	u8 radar_detect_widths;
495362306a36Sopenharmony_ci
495462306a36Sopenharmony_ci	/**
495562306a36Sopenharmony_ci	 * @radar_detect_regions:
495662306a36Sopenharmony_ci	 * bitmap of regions supported for radar detection
495762306a36Sopenharmony_ci	 */
495862306a36Sopenharmony_ci	u8 radar_detect_regions;
495962306a36Sopenharmony_ci
496062306a36Sopenharmony_ci	/**
496162306a36Sopenharmony_ci	 * @beacon_int_min_gcd:
496262306a36Sopenharmony_ci	 * This interface combination supports different beacon intervals.
496362306a36Sopenharmony_ci	 *
496462306a36Sopenharmony_ci	 * = 0
496562306a36Sopenharmony_ci	 *   all beacon intervals for different interface must be same.
496662306a36Sopenharmony_ci	 * > 0
496762306a36Sopenharmony_ci	 *   any beacon interval for the interface part of this combination AND
496862306a36Sopenharmony_ci	 *   GCD of all beacon intervals from beaconing interfaces of this
496962306a36Sopenharmony_ci	 *   combination must be greater or equal to this value.
497062306a36Sopenharmony_ci	 */
497162306a36Sopenharmony_ci	u32 beacon_int_min_gcd;
497262306a36Sopenharmony_ci};
497362306a36Sopenharmony_ci
497462306a36Sopenharmony_cistruct ieee80211_txrx_stypes {
497562306a36Sopenharmony_ci	u16 tx, rx;
497662306a36Sopenharmony_ci};
497762306a36Sopenharmony_ci
497862306a36Sopenharmony_ci/**
497962306a36Sopenharmony_ci * enum wiphy_wowlan_support_flags - WoWLAN support flags
498062306a36Sopenharmony_ci * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any"
498162306a36Sopenharmony_ci *	trigger that keeps the device operating as-is and
498262306a36Sopenharmony_ci *	wakes up the host on any activity, for example a
498362306a36Sopenharmony_ci *	received packet that passed filtering; note that the
498462306a36Sopenharmony_ci *	packet should be preserved in that case
498562306a36Sopenharmony_ci * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet
498662306a36Sopenharmony_ci *	(see nl80211.h)
498762306a36Sopenharmony_ci * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect
498862306a36Sopenharmony_ci * @WIPHY_WOWLAN_SUPPORTS_GTK_REKEY: supports GTK rekeying while asleep
498962306a36Sopenharmony_ci * @WIPHY_WOWLAN_GTK_REKEY_FAILURE: supports wakeup on GTK rekey failure
499062306a36Sopenharmony_ci * @WIPHY_WOWLAN_EAP_IDENTITY_REQ: supports wakeup on EAP identity request
499162306a36Sopenharmony_ci * @WIPHY_WOWLAN_4WAY_HANDSHAKE: supports wakeup on 4-way handshake failure
499262306a36Sopenharmony_ci * @WIPHY_WOWLAN_RFKILL_RELEASE: supports wakeup on RF-kill release
499362306a36Sopenharmony_ci * @WIPHY_WOWLAN_NET_DETECT: supports wakeup on network detection
499462306a36Sopenharmony_ci */
499562306a36Sopenharmony_cienum wiphy_wowlan_support_flags {
499662306a36Sopenharmony_ci	WIPHY_WOWLAN_ANY		= BIT(0),
499762306a36Sopenharmony_ci	WIPHY_WOWLAN_MAGIC_PKT		= BIT(1),
499862306a36Sopenharmony_ci	WIPHY_WOWLAN_DISCONNECT		= BIT(2),
499962306a36Sopenharmony_ci	WIPHY_WOWLAN_SUPPORTS_GTK_REKEY	= BIT(3),
500062306a36Sopenharmony_ci	WIPHY_WOWLAN_GTK_REKEY_FAILURE	= BIT(4),
500162306a36Sopenharmony_ci	WIPHY_WOWLAN_EAP_IDENTITY_REQ	= BIT(5),
500262306a36Sopenharmony_ci	WIPHY_WOWLAN_4WAY_HANDSHAKE	= BIT(6),
500362306a36Sopenharmony_ci	WIPHY_WOWLAN_RFKILL_RELEASE	= BIT(7),
500462306a36Sopenharmony_ci	WIPHY_WOWLAN_NET_DETECT		= BIT(8),
500562306a36Sopenharmony_ci};
500662306a36Sopenharmony_ci
500762306a36Sopenharmony_cistruct wiphy_wowlan_tcp_support {
500862306a36Sopenharmony_ci	const struct nl80211_wowlan_tcp_data_token_feature *tok;
500962306a36Sopenharmony_ci	u32 data_payload_max;
501062306a36Sopenharmony_ci	u32 data_interval_max;
501162306a36Sopenharmony_ci	u32 wake_payload_max;
501262306a36Sopenharmony_ci	bool seq;
501362306a36Sopenharmony_ci};
501462306a36Sopenharmony_ci
501562306a36Sopenharmony_ci/**
501662306a36Sopenharmony_ci * struct wiphy_wowlan_support - WoWLAN support data
501762306a36Sopenharmony_ci * @flags: see &enum wiphy_wowlan_support_flags
501862306a36Sopenharmony_ci * @n_patterns: number of supported wakeup patterns
501962306a36Sopenharmony_ci *	(see nl80211.h for the pattern definition)
502062306a36Sopenharmony_ci * @pattern_max_len: maximum length of each pattern
502162306a36Sopenharmony_ci * @pattern_min_len: minimum length of each pattern
502262306a36Sopenharmony_ci * @max_pkt_offset: maximum Rx packet offset
502362306a36Sopenharmony_ci * @max_nd_match_sets: maximum number of matchsets for net-detect,
502462306a36Sopenharmony_ci *	similar, but not necessarily identical, to max_match_sets for
502562306a36Sopenharmony_ci *	scheduled scans.
502662306a36Sopenharmony_ci *	See &struct cfg80211_sched_scan_request.@match_sets for more
502762306a36Sopenharmony_ci *	details.
502862306a36Sopenharmony_ci * @tcp: TCP wakeup support information
502962306a36Sopenharmony_ci */
503062306a36Sopenharmony_cistruct wiphy_wowlan_support {
503162306a36Sopenharmony_ci	u32 flags;
503262306a36Sopenharmony_ci	int n_patterns;
503362306a36Sopenharmony_ci	int pattern_max_len;
503462306a36Sopenharmony_ci	int pattern_min_len;
503562306a36Sopenharmony_ci	int max_pkt_offset;
503662306a36Sopenharmony_ci	int max_nd_match_sets;
503762306a36Sopenharmony_ci	const struct wiphy_wowlan_tcp_support *tcp;
503862306a36Sopenharmony_ci};
503962306a36Sopenharmony_ci
504062306a36Sopenharmony_ci/**
504162306a36Sopenharmony_ci * struct wiphy_coalesce_support - coalesce support data
504262306a36Sopenharmony_ci * @n_rules: maximum number of coalesce rules
504362306a36Sopenharmony_ci * @max_delay: maximum supported coalescing delay in msecs
504462306a36Sopenharmony_ci * @n_patterns: number of supported patterns in a rule
504562306a36Sopenharmony_ci *	(see nl80211.h for the pattern definition)
504662306a36Sopenharmony_ci * @pattern_max_len: maximum length of each pattern
504762306a36Sopenharmony_ci * @pattern_min_len: minimum length of each pattern
504862306a36Sopenharmony_ci * @max_pkt_offset: maximum Rx packet offset
504962306a36Sopenharmony_ci */
505062306a36Sopenharmony_cistruct wiphy_coalesce_support {
505162306a36Sopenharmony_ci	int n_rules;
505262306a36Sopenharmony_ci	int max_delay;
505362306a36Sopenharmony_ci	int n_patterns;
505462306a36Sopenharmony_ci	int pattern_max_len;
505562306a36Sopenharmony_ci	int pattern_min_len;
505662306a36Sopenharmony_ci	int max_pkt_offset;
505762306a36Sopenharmony_ci};
505862306a36Sopenharmony_ci
505962306a36Sopenharmony_ci/**
506062306a36Sopenharmony_ci * enum wiphy_vendor_command_flags - validation flags for vendor commands
506162306a36Sopenharmony_ci * @WIPHY_VENDOR_CMD_NEED_WDEV: vendor command requires wdev
506262306a36Sopenharmony_ci * @WIPHY_VENDOR_CMD_NEED_NETDEV: vendor command requires netdev
506362306a36Sopenharmony_ci * @WIPHY_VENDOR_CMD_NEED_RUNNING: interface/wdev must be up & running
506462306a36Sopenharmony_ci *	(must be combined with %_WDEV or %_NETDEV)
506562306a36Sopenharmony_ci */
506662306a36Sopenharmony_cienum wiphy_vendor_command_flags {
506762306a36Sopenharmony_ci	WIPHY_VENDOR_CMD_NEED_WDEV = BIT(0),
506862306a36Sopenharmony_ci	WIPHY_VENDOR_CMD_NEED_NETDEV = BIT(1),
506962306a36Sopenharmony_ci	WIPHY_VENDOR_CMD_NEED_RUNNING = BIT(2),
507062306a36Sopenharmony_ci};
507162306a36Sopenharmony_ci
507262306a36Sopenharmony_ci/**
507362306a36Sopenharmony_ci * enum wiphy_opmode_flag - Station's ht/vht operation mode information flags
507462306a36Sopenharmony_ci *
507562306a36Sopenharmony_ci * @STA_OPMODE_MAX_BW_CHANGED: Max Bandwidth changed
507662306a36Sopenharmony_ci * @STA_OPMODE_SMPS_MODE_CHANGED: SMPS mode changed
507762306a36Sopenharmony_ci * @STA_OPMODE_N_SS_CHANGED: max N_SS (number of spatial streams) changed
507862306a36Sopenharmony_ci *
507962306a36Sopenharmony_ci */
508062306a36Sopenharmony_cienum wiphy_opmode_flag {
508162306a36Sopenharmony_ci	STA_OPMODE_MAX_BW_CHANGED	= BIT(0),
508262306a36Sopenharmony_ci	STA_OPMODE_SMPS_MODE_CHANGED	= BIT(1),
508362306a36Sopenharmony_ci	STA_OPMODE_N_SS_CHANGED		= BIT(2),
508462306a36Sopenharmony_ci};
508562306a36Sopenharmony_ci
508662306a36Sopenharmony_ci/**
508762306a36Sopenharmony_ci * struct sta_opmode_info - Station's ht/vht operation mode information
508862306a36Sopenharmony_ci * @changed: contains value from &enum wiphy_opmode_flag
508962306a36Sopenharmony_ci * @smps_mode: New SMPS mode value from &enum nl80211_smps_mode of a station
509062306a36Sopenharmony_ci * @bw: new max bandwidth value from &enum nl80211_chan_width of a station
509162306a36Sopenharmony_ci * @rx_nss: new rx_nss value of a station
509262306a36Sopenharmony_ci */
509362306a36Sopenharmony_ci
509462306a36Sopenharmony_cistruct sta_opmode_info {
509562306a36Sopenharmony_ci	u32 changed;
509662306a36Sopenharmony_ci	enum nl80211_smps_mode smps_mode;
509762306a36Sopenharmony_ci	enum nl80211_chan_width bw;
509862306a36Sopenharmony_ci	u8 rx_nss;
509962306a36Sopenharmony_ci};
510062306a36Sopenharmony_ci
510162306a36Sopenharmony_ci#define VENDOR_CMD_RAW_DATA ((const struct nla_policy *)(long)(-ENODATA))
510262306a36Sopenharmony_ci
510362306a36Sopenharmony_ci/**
510462306a36Sopenharmony_ci * struct wiphy_vendor_command - vendor command definition
510562306a36Sopenharmony_ci * @info: vendor command identifying information, as used in nl80211
510662306a36Sopenharmony_ci * @flags: flags, see &enum wiphy_vendor_command_flags
510762306a36Sopenharmony_ci * @doit: callback for the operation, note that wdev is %NULL if the
510862306a36Sopenharmony_ci *	flags didn't ask for a wdev and non-%NULL otherwise; the data
510962306a36Sopenharmony_ci *	pointer may be %NULL if userspace provided no data at all
511062306a36Sopenharmony_ci * @dumpit: dump callback, for transferring bigger/multiple items. The
511162306a36Sopenharmony_ci *	@storage points to cb->args[5], ie. is preserved over the multiple
511262306a36Sopenharmony_ci *	dumpit calls.
511362306a36Sopenharmony_ci * @policy: policy pointer for attributes within %NL80211_ATTR_VENDOR_DATA.
511462306a36Sopenharmony_ci *	Set this to %VENDOR_CMD_RAW_DATA if no policy can be given and the
511562306a36Sopenharmony_ci *	attribute is just raw data (e.g. a firmware command).
511662306a36Sopenharmony_ci * @maxattr: highest attribute number in policy
511762306a36Sopenharmony_ci * It's recommended to not have the same sub command with both @doit and
511862306a36Sopenharmony_ci * @dumpit, so that userspace can assume certain ones are get and others
511962306a36Sopenharmony_ci * are used with dump requests.
512062306a36Sopenharmony_ci */
512162306a36Sopenharmony_cistruct wiphy_vendor_command {
512262306a36Sopenharmony_ci	struct nl80211_vendor_cmd_info info;
512362306a36Sopenharmony_ci	u32 flags;
512462306a36Sopenharmony_ci	int (*doit)(struct wiphy *wiphy, struct wireless_dev *wdev,
512562306a36Sopenharmony_ci		    const void *data, int data_len);
512662306a36Sopenharmony_ci	int (*dumpit)(struct wiphy *wiphy, struct wireless_dev *wdev,
512762306a36Sopenharmony_ci		      struct sk_buff *skb, const void *data, int data_len,
512862306a36Sopenharmony_ci		      unsigned long *storage);
512962306a36Sopenharmony_ci	const struct nla_policy *policy;
513062306a36Sopenharmony_ci	unsigned int maxattr;
513162306a36Sopenharmony_ci};
513262306a36Sopenharmony_ci
513362306a36Sopenharmony_ci/**
513462306a36Sopenharmony_ci * struct wiphy_iftype_ext_capab - extended capabilities per interface type
513562306a36Sopenharmony_ci * @iftype: interface type
513662306a36Sopenharmony_ci * @extended_capabilities: extended capabilities supported by the driver,
513762306a36Sopenharmony_ci *	additional capabilities might be supported by userspace; these are the
513862306a36Sopenharmony_ci *	802.11 extended capabilities ("Extended Capabilities element") and are
513962306a36Sopenharmony_ci *	in the same format as in the information element. See IEEE Std
514062306a36Sopenharmony_ci *	802.11-2012 8.4.2.29 for the defined fields.
514162306a36Sopenharmony_ci * @extended_capabilities_mask: mask of the valid values
514262306a36Sopenharmony_ci * @extended_capabilities_len: length of the extended capabilities
514362306a36Sopenharmony_ci * @eml_capabilities: EML capabilities (for MLO)
514462306a36Sopenharmony_ci * @mld_capa_and_ops: MLD capabilities and operations (for MLO)
514562306a36Sopenharmony_ci */
514662306a36Sopenharmony_cistruct wiphy_iftype_ext_capab {
514762306a36Sopenharmony_ci	enum nl80211_iftype iftype;
514862306a36Sopenharmony_ci	const u8 *extended_capabilities;
514962306a36Sopenharmony_ci	const u8 *extended_capabilities_mask;
515062306a36Sopenharmony_ci	u8 extended_capabilities_len;
515162306a36Sopenharmony_ci	u16 eml_capabilities;
515262306a36Sopenharmony_ci	u16 mld_capa_and_ops;
515362306a36Sopenharmony_ci};
515462306a36Sopenharmony_ci
515562306a36Sopenharmony_ci/**
515662306a36Sopenharmony_ci * cfg80211_get_iftype_ext_capa - lookup interface type extended capability
515762306a36Sopenharmony_ci * @wiphy: the wiphy to look up from
515862306a36Sopenharmony_ci * @type: the interface type to look up
515962306a36Sopenharmony_ci */
516062306a36Sopenharmony_ciconst struct wiphy_iftype_ext_capab *
516162306a36Sopenharmony_cicfg80211_get_iftype_ext_capa(struct wiphy *wiphy, enum nl80211_iftype type);
516262306a36Sopenharmony_ci
516362306a36Sopenharmony_ci/**
516462306a36Sopenharmony_ci * struct cfg80211_pmsr_capabilities - cfg80211 peer measurement capabilities
516562306a36Sopenharmony_ci * @max_peers: maximum number of peers in a single measurement
516662306a36Sopenharmony_ci * @report_ap_tsf: can report assoc AP's TSF for radio resource measurement
516762306a36Sopenharmony_ci * @randomize_mac_addr: can randomize MAC address for measurement
516862306a36Sopenharmony_ci * @ftm: FTM measurement data
516962306a36Sopenharmony_ci * @ftm.supported: FTM measurement is supported
517062306a36Sopenharmony_ci * @ftm.asap: ASAP-mode is supported
517162306a36Sopenharmony_ci * @ftm.non_asap: non-ASAP-mode is supported
517262306a36Sopenharmony_ci * @ftm.request_lci: can request LCI data
517362306a36Sopenharmony_ci * @ftm.request_civicloc: can request civic location data
517462306a36Sopenharmony_ci * @ftm.preambles: bitmap of preambles supported (&enum nl80211_preamble)
517562306a36Sopenharmony_ci * @ftm.bandwidths: bitmap of bandwidths supported (&enum nl80211_chan_width)
517662306a36Sopenharmony_ci * @ftm.max_bursts_exponent: maximum burst exponent supported
517762306a36Sopenharmony_ci *	(set to -1 if not limited; note that setting this will necessarily
517862306a36Sopenharmony_ci *	forbid using the value 15 to let the responder pick)
517962306a36Sopenharmony_ci * @ftm.max_ftms_per_burst: maximum FTMs per burst supported (set to 0 if
518062306a36Sopenharmony_ci *	not limited)
518162306a36Sopenharmony_ci * @ftm.trigger_based: trigger based ranging measurement is supported
518262306a36Sopenharmony_ci * @ftm.non_trigger_based: non trigger based ranging measurement is supported
518362306a36Sopenharmony_ci */
518462306a36Sopenharmony_cistruct cfg80211_pmsr_capabilities {
518562306a36Sopenharmony_ci	unsigned int max_peers;
518662306a36Sopenharmony_ci	u8 report_ap_tsf:1,
518762306a36Sopenharmony_ci	   randomize_mac_addr:1;
518862306a36Sopenharmony_ci
518962306a36Sopenharmony_ci	struct {
519062306a36Sopenharmony_ci		u32 preambles;
519162306a36Sopenharmony_ci		u32 bandwidths;
519262306a36Sopenharmony_ci		s8 max_bursts_exponent;
519362306a36Sopenharmony_ci		u8 max_ftms_per_burst;
519462306a36Sopenharmony_ci		u8 supported:1,
519562306a36Sopenharmony_ci		   asap:1,
519662306a36Sopenharmony_ci		   non_asap:1,
519762306a36Sopenharmony_ci		   request_lci:1,
519862306a36Sopenharmony_ci		   request_civicloc:1,
519962306a36Sopenharmony_ci		   trigger_based:1,
520062306a36Sopenharmony_ci		   non_trigger_based:1;
520162306a36Sopenharmony_ci	} ftm;
520262306a36Sopenharmony_ci};
520362306a36Sopenharmony_ci
520462306a36Sopenharmony_ci/**
520562306a36Sopenharmony_ci * struct wiphy_iftype_akm_suites - This structure encapsulates supported akm
520662306a36Sopenharmony_ci * suites for interface types defined in @iftypes_mask. Each type in the
520762306a36Sopenharmony_ci * @iftypes_mask must be unique across all instances of iftype_akm_suites.
520862306a36Sopenharmony_ci *
520962306a36Sopenharmony_ci * @iftypes_mask: bitmask of interfaces types
521062306a36Sopenharmony_ci * @akm_suites: points to an array of supported akm suites
521162306a36Sopenharmony_ci * @n_akm_suites: number of supported AKM suites
521262306a36Sopenharmony_ci */
521362306a36Sopenharmony_cistruct wiphy_iftype_akm_suites {
521462306a36Sopenharmony_ci	u16 iftypes_mask;
521562306a36Sopenharmony_ci	const u32 *akm_suites;
521662306a36Sopenharmony_ci	int n_akm_suites;
521762306a36Sopenharmony_ci};
521862306a36Sopenharmony_ci
521962306a36Sopenharmony_ci#define CFG80211_HW_TIMESTAMP_ALL_PEERS	0xffff
522062306a36Sopenharmony_ci
522162306a36Sopenharmony_ci/**
522262306a36Sopenharmony_ci * struct wiphy - wireless hardware description
522362306a36Sopenharmony_ci * @mtx: mutex for the data (structures) of this device
522462306a36Sopenharmony_ci * @reg_notifier: the driver's regulatory notification callback,
522562306a36Sopenharmony_ci *	note that if your driver uses wiphy_apply_custom_regulatory()
522662306a36Sopenharmony_ci *	the reg_notifier's request can be passed as NULL
522762306a36Sopenharmony_ci * @regd: the driver's regulatory domain, if one was requested via
522862306a36Sopenharmony_ci *	the regulatory_hint() API. This can be used by the driver
522962306a36Sopenharmony_ci *	on the reg_notifier() if it chooses to ignore future
523062306a36Sopenharmony_ci *	regulatory domain changes caused by other drivers.
523162306a36Sopenharmony_ci * @signal_type: signal type reported in &struct cfg80211_bss.
523262306a36Sopenharmony_ci * @cipher_suites: supported cipher suites
523362306a36Sopenharmony_ci * @n_cipher_suites: number of supported cipher suites
523462306a36Sopenharmony_ci * @akm_suites: supported AKM suites. These are the default AKMs supported if
523562306a36Sopenharmony_ci *	the supported AKMs not advertized for a specific interface type in
523662306a36Sopenharmony_ci *	iftype_akm_suites.
523762306a36Sopenharmony_ci * @n_akm_suites: number of supported AKM suites
523862306a36Sopenharmony_ci * @iftype_akm_suites: array of supported akm suites info per interface type.
523962306a36Sopenharmony_ci *	Note that the bits in @iftypes_mask inside this structure cannot
524062306a36Sopenharmony_ci *	overlap (i.e. only one occurrence of each type is allowed across all
524162306a36Sopenharmony_ci *	instances of iftype_akm_suites).
524262306a36Sopenharmony_ci * @num_iftype_akm_suites: number of interface types for which supported akm
524362306a36Sopenharmony_ci *	suites are specified separately.
524462306a36Sopenharmony_ci * @retry_short: Retry limit for short frames (dot11ShortRetryLimit)
524562306a36Sopenharmony_ci * @retry_long: Retry limit for long frames (dot11LongRetryLimit)
524662306a36Sopenharmony_ci * @frag_threshold: Fragmentation threshold (dot11FragmentationThreshold);
524762306a36Sopenharmony_ci *	-1 = fragmentation disabled, only odd values >= 256 used
524862306a36Sopenharmony_ci * @rts_threshold: RTS threshold (dot11RTSThreshold); -1 = RTS/CTS disabled
524962306a36Sopenharmony_ci * @_net: the network namespace this wiphy currently lives in
525062306a36Sopenharmony_ci * @perm_addr: permanent MAC address of this device
525162306a36Sopenharmony_ci * @addr_mask: If the device supports multiple MAC addresses by masking,
525262306a36Sopenharmony_ci *	set this to a mask with variable bits set to 1, e.g. if the last
525362306a36Sopenharmony_ci *	four bits are variable then set it to 00-00-00-00-00-0f. The actual
525462306a36Sopenharmony_ci *	variable bits shall be determined by the interfaces added, with
525562306a36Sopenharmony_ci *	interfaces not matching the mask being rejected to be brought up.
525662306a36Sopenharmony_ci * @n_addresses: number of addresses in @addresses.
525762306a36Sopenharmony_ci * @addresses: If the device has more than one address, set this pointer
525862306a36Sopenharmony_ci *	to a list of addresses (6 bytes each). The first one will be used
525962306a36Sopenharmony_ci *	by default for perm_addr. In this case, the mask should be set to
526062306a36Sopenharmony_ci *	all-zeroes. In this case it is assumed that the device can handle
526162306a36Sopenharmony_ci *	the same number of arbitrary MAC addresses.
526262306a36Sopenharmony_ci * @registered: protects ->resume and ->suspend sysfs callbacks against
526362306a36Sopenharmony_ci *	unregister hardware
526462306a36Sopenharmony_ci * @debugfsdir: debugfs directory used for this wiphy (ieee80211/<wiphyname>).
526562306a36Sopenharmony_ci *	It will be renamed automatically on wiphy renames
526662306a36Sopenharmony_ci * @dev: (virtual) struct device for this wiphy. The item in
526762306a36Sopenharmony_ci *	/sys/class/ieee80211/ points to this. You need use set_wiphy_dev()
526862306a36Sopenharmony_ci *	(see below).
526962306a36Sopenharmony_ci * @wext: wireless extension handlers
527062306a36Sopenharmony_ci * @priv: driver private data (sized according to wiphy_new() parameter)
527162306a36Sopenharmony_ci * @interface_modes: bitmask of interfaces types valid for this wiphy,
527262306a36Sopenharmony_ci *	must be set by driver
527362306a36Sopenharmony_ci * @iface_combinations: Valid interface combinations array, should not
527462306a36Sopenharmony_ci *	list single interface types.
527562306a36Sopenharmony_ci * @n_iface_combinations: number of entries in @iface_combinations array.
527662306a36Sopenharmony_ci * @software_iftypes: bitmask of software interface types, these are not
527762306a36Sopenharmony_ci *	subject to any restrictions since they are purely managed in SW.
527862306a36Sopenharmony_ci * @flags: wiphy flags, see &enum wiphy_flags
527962306a36Sopenharmony_ci * @regulatory_flags: wiphy regulatory flags, see
528062306a36Sopenharmony_ci *	&enum ieee80211_regulatory_flags
528162306a36Sopenharmony_ci * @features: features advertised to nl80211, see &enum nl80211_feature_flags.
528262306a36Sopenharmony_ci * @ext_features: extended features advertised to nl80211, see
528362306a36Sopenharmony_ci *	&enum nl80211_ext_feature_index.
528462306a36Sopenharmony_ci * @bss_priv_size: each BSS struct has private data allocated with it,
528562306a36Sopenharmony_ci *	this variable determines its size
528662306a36Sopenharmony_ci * @max_scan_ssids: maximum number of SSIDs the device can scan for in
528762306a36Sopenharmony_ci *	any given scan
528862306a36Sopenharmony_ci * @max_sched_scan_reqs: maximum number of scheduled scan requests that
528962306a36Sopenharmony_ci *	the device can run concurrently.
529062306a36Sopenharmony_ci * @max_sched_scan_ssids: maximum number of SSIDs the device can scan
529162306a36Sopenharmony_ci *	for in any given scheduled scan
529262306a36Sopenharmony_ci * @max_match_sets: maximum number of match sets the device can handle
529362306a36Sopenharmony_ci *	when performing a scheduled scan, 0 if filtering is not
529462306a36Sopenharmony_ci *	supported.
529562306a36Sopenharmony_ci * @max_scan_ie_len: maximum length of user-controlled IEs device can
529662306a36Sopenharmony_ci *	add to probe request frames transmitted during a scan, must not
529762306a36Sopenharmony_ci *	include fixed IEs like supported rates
529862306a36Sopenharmony_ci * @max_sched_scan_ie_len: same as max_scan_ie_len, but for scheduled
529962306a36Sopenharmony_ci *	scans
530062306a36Sopenharmony_ci * @max_sched_scan_plans: maximum number of scan plans (scan interval and number
530162306a36Sopenharmony_ci *	of iterations) for scheduled scan supported by the device.
530262306a36Sopenharmony_ci * @max_sched_scan_plan_interval: maximum interval (in seconds) for a
530362306a36Sopenharmony_ci *	single scan plan supported by the device.
530462306a36Sopenharmony_ci * @max_sched_scan_plan_iterations: maximum number of iterations for a single
530562306a36Sopenharmony_ci *	scan plan supported by the device.
530662306a36Sopenharmony_ci * @coverage_class: current coverage class
530762306a36Sopenharmony_ci * @fw_version: firmware version for ethtool reporting
530862306a36Sopenharmony_ci * @hw_version: hardware version for ethtool reporting
530962306a36Sopenharmony_ci * @max_num_pmkids: maximum number of PMKIDs supported by device
531062306a36Sopenharmony_ci * @privid: a pointer that drivers can use to identify if an arbitrary
531162306a36Sopenharmony_ci *	wiphy is theirs, e.g. in global notifiers
531262306a36Sopenharmony_ci * @bands: information about bands/channels supported by this device
531362306a36Sopenharmony_ci *
531462306a36Sopenharmony_ci * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or
531562306a36Sopenharmony_ci *	transmitted through nl80211, points to an array indexed by interface
531662306a36Sopenharmony_ci *	type
531762306a36Sopenharmony_ci *
531862306a36Sopenharmony_ci * @available_antennas_tx: bitmap of antennas which are available to be
531962306a36Sopenharmony_ci *	configured as TX antennas. Antenna configuration commands will be
532062306a36Sopenharmony_ci *	rejected unless this or @available_antennas_rx is set.
532162306a36Sopenharmony_ci *
532262306a36Sopenharmony_ci * @available_antennas_rx: bitmap of antennas which are available to be
532362306a36Sopenharmony_ci *	configured as RX antennas. Antenna configuration commands will be
532462306a36Sopenharmony_ci *	rejected unless this or @available_antennas_tx is set.
532562306a36Sopenharmony_ci *
532662306a36Sopenharmony_ci * @probe_resp_offload:
532762306a36Sopenharmony_ci *	 Bitmap of supported protocols for probe response offloading.
532862306a36Sopenharmony_ci *	 See &enum nl80211_probe_resp_offload_support_attr. Only valid
532962306a36Sopenharmony_ci *	 when the wiphy flag @WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD is set.
533062306a36Sopenharmony_ci *
533162306a36Sopenharmony_ci * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation
533262306a36Sopenharmony_ci *	may request, if implemented.
533362306a36Sopenharmony_ci *
533462306a36Sopenharmony_ci * @wowlan: WoWLAN support information
533562306a36Sopenharmony_ci * @wowlan_config: current WoWLAN configuration; this should usually not be
533662306a36Sopenharmony_ci *	used since access to it is necessarily racy, use the parameter passed
533762306a36Sopenharmony_ci *	to the suspend() operation instead.
533862306a36Sopenharmony_ci *
533962306a36Sopenharmony_ci * @ap_sme_capa: AP SME capabilities, flags from &enum nl80211_ap_sme_features.
534062306a36Sopenharmony_ci * @ht_capa_mod_mask:  Specify what ht_cap values can be over-ridden.
534162306a36Sopenharmony_ci *	If null, then none can be over-ridden.
534262306a36Sopenharmony_ci * @vht_capa_mod_mask:  Specify what VHT capabilities can be over-ridden.
534362306a36Sopenharmony_ci *	If null, then none can be over-ridden.
534462306a36Sopenharmony_ci *
534562306a36Sopenharmony_ci * @wdev_list: the list of associated (virtual) interfaces; this list must
534662306a36Sopenharmony_ci *	not be modified by the driver, but can be read with RTNL/RCU protection.
534762306a36Sopenharmony_ci *
534862306a36Sopenharmony_ci * @max_acl_mac_addrs: Maximum number of MAC addresses that the device
534962306a36Sopenharmony_ci *	supports for ACL.
535062306a36Sopenharmony_ci *
535162306a36Sopenharmony_ci * @extended_capabilities: extended capabilities supported by the driver,
535262306a36Sopenharmony_ci *	additional capabilities might be supported by userspace; these are
535362306a36Sopenharmony_ci *	the 802.11 extended capabilities ("Extended Capabilities element")
535462306a36Sopenharmony_ci *	and are in the same format as in the information element. See
535562306a36Sopenharmony_ci *	802.11-2012 8.4.2.29 for the defined fields. These are the default
535662306a36Sopenharmony_ci *	extended capabilities to be used if the capabilities are not specified
535762306a36Sopenharmony_ci *	for a specific interface type in iftype_ext_capab.
535862306a36Sopenharmony_ci * @extended_capabilities_mask: mask of the valid values
535962306a36Sopenharmony_ci * @extended_capabilities_len: length of the extended capabilities
536062306a36Sopenharmony_ci * @iftype_ext_capab: array of extended capabilities per interface type
536162306a36Sopenharmony_ci * @num_iftype_ext_capab: number of interface types for which extended
536262306a36Sopenharmony_ci *	capabilities are specified separately.
536362306a36Sopenharmony_ci * @coalesce: packet coalescing support information
536462306a36Sopenharmony_ci *
536562306a36Sopenharmony_ci * @vendor_commands: array of vendor commands supported by the hardware
536662306a36Sopenharmony_ci * @n_vendor_commands: number of vendor commands
536762306a36Sopenharmony_ci * @vendor_events: array of vendor events supported by the hardware
536862306a36Sopenharmony_ci * @n_vendor_events: number of vendor events
536962306a36Sopenharmony_ci *
537062306a36Sopenharmony_ci * @max_ap_assoc_sta: maximum number of associated stations supported in AP mode
537162306a36Sopenharmony_ci *	(including P2P GO) or 0 to indicate no such limit is advertised. The
537262306a36Sopenharmony_ci *	driver is allowed to advertise a theoretical limit that it can reach in
537362306a36Sopenharmony_ci *	some cases, but may not always reach.
537462306a36Sopenharmony_ci *
537562306a36Sopenharmony_ci * @max_num_csa_counters: Number of supported csa_counters in beacons
537662306a36Sopenharmony_ci *	and probe responses.  This value should be set if the driver
537762306a36Sopenharmony_ci *	wishes to limit the number of csa counters. Default (0) means
537862306a36Sopenharmony_ci *	infinite.
537962306a36Sopenharmony_ci * @bss_select_support: bitmask indicating the BSS selection criteria supported
538062306a36Sopenharmony_ci *	by the driver in the .connect() callback. The bit position maps to the
538162306a36Sopenharmony_ci *	attribute indices defined in &enum nl80211_bss_select_attr.
538262306a36Sopenharmony_ci *
538362306a36Sopenharmony_ci * @nan_supported_bands: bands supported by the device in NAN mode, a
538462306a36Sopenharmony_ci *	bitmap of &enum nl80211_band values.  For instance, for
538562306a36Sopenharmony_ci *	NL80211_BAND_2GHZ, bit 0 would be set
538662306a36Sopenharmony_ci *	(i.e. BIT(NL80211_BAND_2GHZ)).
538762306a36Sopenharmony_ci *
538862306a36Sopenharmony_ci * @txq_limit: configuration of internal TX queue frame limit
538962306a36Sopenharmony_ci * @txq_memory_limit: configuration internal TX queue memory limit
539062306a36Sopenharmony_ci * @txq_quantum: configuration of internal TX queue scheduler quantum
539162306a36Sopenharmony_ci *
539262306a36Sopenharmony_ci * @tx_queue_len: allow setting transmit queue len for drivers not using
539362306a36Sopenharmony_ci *	wake_tx_queue
539462306a36Sopenharmony_ci *
539562306a36Sopenharmony_ci * @support_mbssid: can HW support association with nontransmitted AP
539662306a36Sopenharmony_ci * @support_only_he_mbssid: don't parse MBSSID elements if it is not
539762306a36Sopenharmony_ci *	HE AP, in order to avoid compatibility issues.
539862306a36Sopenharmony_ci *	@support_mbssid must be set for this to have any effect.
539962306a36Sopenharmony_ci *
540062306a36Sopenharmony_ci * @pmsr_capa: peer measurement capabilities
540162306a36Sopenharmony_ci *
540262306a36Sopenharmony_ci * @tid_config_support: describes the per-TID config support that the
540362306a36Sopenharmony_ci *	device has
540462306a36Sopenharmony_ci * @tid_config_support.vif: bitmap of attributes (configurations)
540562306a36Sopenharmony_ci *	supported by the driver for each vif
540662306a36Sopenharmony_ci * @tid_config_support.peer: bitmap of attributes (configurations)
540762306a36Sopenharmony_ci *	supported by the driver for each peer
540862306a36Sopenharmony_ci * @tid_config_support.max_retry: maximum supported retry count for
540962306a36Sopenharmony_ci *	long/short retry configuration
541062306a36Sopenharmony_ci *
541162306a36Sopenharmony_ci * @max_data_retry_count: maximum supported per TID retry count for
541262306a36Sopenharmony_ci *	configuration through the %NL80211_TID_CONFIG_ATTR_RETRY_SHORT and
541362306a36Sopenharmony_ci *	%NL80211_TID_CONFIG_ATTR_RETRY_LONG attributes
541462306a36Sopenharmony_ci * @sar_capa: SAR control capabilities
541562306a36Sopenharmony_ci * @rfkill: a pointer to the rfkill structure
541662306a36Sopenharmony_ci *
541762306a36Sopenharmony_ci * @mbssid_max_interfaces: maximum number of interfaces supported by the driver
541862306a36Sopenharmony_ci *	in a multiple BSSID set. This field must be set to a non-zero value
541962306a36Sopenharmony_ci *	by the driver to advertise MBSSID support.
542062306a36Sopenharmony_ci * @ema_max_profile_periodicity: maximum profile periodicity supported by
542162306a36Sopenharmony_ci *	the driver. Setting this field to a non-zero value indicates that the
542262306a36Sopenharmony_ci *	driver supports enhanced multi-BSSID advertisements (EMA AP).
542362306a36Sopenharmony_ci * @max_num_akm_suites: maximum number of AKM suites allowed for
542462306a36Sopenharmony_ci *	configuration through %NL80211_CMD_CONNECT, %NL80211_CMD_ASSOCIATE and
542562306a36Sopenharmony_ci *	%NL80211_CMD_START_AP. Set to NL80211_MAX_NR_AKM_SUITES if not set by
542662306a36Sopenharmony_ci *	driver. If set by driver minimum allowed value is
542762306a36Sopenharmony_ci *	NL80211_MAX_NR_AKM_SUITES in order to avoid compatibility issues with
542862306a36Sopenharmony_ci *	legacy userspace and maximum allowed value is
542962306a36Sopenharmony_ci *	CFG80211_MAX_NUM_AKM_SUITES.
543062306a36Sopenharmony_ci *
543162306a36Sopenharmony_ci * @hw_timestamp_max_peers: maximum number of peers that the driver supports
543262306a36Sopenharmony_ci *	enabling HW timestamping for concurrently. Setting this field to a
543362306a36Sopenharmony_ci *	non-zero value indicates that the driver supports HW timestamping.
543462306a36Sopenharmony_ci *	A value of %CFG80211_HW_TIMESTAMP_ALL_PEERS indicates the driver
543562306a36Sopenharmony_ci *	supports enabling HW timestamping for all peers (i.e. no need to
543662306a36Sopenharmony_ci *	specify a mac address).
543762306a36Sopenharmony_ci */
543862306a36Sopenharmony_cistruct wiphy {
543962306a36Sopenharmony_ci	struct mutex mtx;
544062306a36Sopenharmony_ci
544162306a36Sopenharmony_ci	/* assign these fields before you register the wiphy */
544262306a36Sopenharmony_ci
544362306a36Sopenharmony_ci	u8 perm_addr[ETH_ALEN];
544462306a36Sopenharmony_ci	u8 addr_mask[ETH_ALEN];
544562306a36Sopenharmony_ci
544662306a36Sopenharmony_ci	struct mac_address *addresses;
544762306a36Sopenharmony_ci
544862306a36Sopenharmony_ci	const struct ieee80211_txrx_stypes *mgmt_stypes;
544962306a36Sopenharmony_ci
545062306a36Sopenharmony_ci	const struct ieee80211_iface_combination *iface_combinations;
545162306a36Sopenharmony_ci	int n_iface_combinations;
545262306a36Sopenharmony_ci	u16 software_iftypes;
545362306a36Sopenharmony_ci
545462306a36Sopenharmony_ci	u16 n_addresses;
545562306a36Sopenharmony_ci
545662306a36Sopenharmony_ci	/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
545762306a36Sopenharmony_ci	u16 interface_modes;
545862306a36Sopenharmony_ci
545962306a36Sopenharmony_ci	u16 max_acl_mac_addrs;
546062306a36Sopenharmony_ci
546162306a36Sopenharmony_ci	u32 flags, regulatory_flags, features;
546262306a36Sopenharmony_ci	u8 ext_features[DIV_ROUND_UP(NUM_NL80211_EXT_FEATURES, 8)];
546362306a36Sopenharmony_ci
546462306a36Sopenharmony_ci	u32 ap_sme_capa;
546562306a36Sopenharmony_ci
546662306a36Sopenharmony_ci	enum cfg80211_signal_type signal_type;
546762306a36Sopenharmony_ci
546862306a36Sopenharmony_ci	int bss_priv_size;
546962306a36Sopenharmony_ci	u8 max_scan_ssids;
547062306a36Sopenharmony_ci	u8 max_sched_scan_reqs;
547162306a36Sopenharmony_ci	u8 max_sched_scan_ssids;
547262306a36Sopenharmony_ci	u8 max_match_sets;
547362306a36Sopenharmony_ci	u16 max_scan_ie_len;
547462306a36Sopenharmony_ci	u16 max_sched_scan_ie_len;
547562306a36Sopenharmony_ci	u32 max_sched_scan_plans;
547662306a36Sopenharmony_ci	u32 max_sched_scan_plan_interval;
547762306a36Sopenharmony_ci	u32 max_sched_scan_plan_iterations;
547862306a36Sopenharmony_ci
547962306a36Sopenharmony_ci	int n_cipher_suites;
548062306a36Sopenharmony_ci	const u32 *cipher_suites;
548162306a36Sopenharmony_ci
548262306a36Sopenharmony_ci	int n_akm_suites;
548362306a36Sopenharmony_ci	const u32 *akm_suites;
548462306a36Sopenharmony_ci
548562306a36Sopenharmony_ci	const struct wiphy_iftype_akm_suites *iftype_akm_suites;
548662306a36Sopenharmony_ci	unsigned int num_iftype_akm_suites;
548762306a36Sopenharmony_ci
548862306a36Sopenharmony_ci	u8 retry_short;
548962306a36Sopenharmony_ci	u8 retry_long;
549062306a36Sopenharmony_ci	u32 frag_threshold;
549162306a36Sopenharmony_ci	u32 rts_threshold;
549262306a36Sopenharmony_ci	u8 coverage_class;
549362306a36Sopenharmony_ci
549462306a36Sopenharmony_ci	char fw_version[ETHTOOL_FWVERS_LEN];
549562306a36Sopenharmony_ci	u32 hw_version;
549662306a36Sopenharmony_ci
549762306a36Sopenharmony_ci#ifdef CONFIG_PM
549862306a36Sopenharmony_ci	const struct wiphy_wowlan_support *wowlan;
549962306a36Sopenharmony_ci	struct cfg80211_wowlan *wowlan_config;
550062306a36Sopenharmony_ci#endif
550162306a36Sopenharmony_ci
550262306a36Sopenharmony_ci	u16 max_remain_on_channel_duration;
550362306a36Sopenharmony_ci
550462306a36Sopenharmony_ci	u8 max_num_pmkids;
550562306a36Sopenharmony_ci
550662306a36Sopenharmony_ci	u32 available_antennas_tx;
550762306a36Sopenharmony_ci	u32 available_antennas_rx;
550862306a36Sopenharmony_ci
550962306a36Sopenharmony_ci	u32 probe_resp_offload;
551062306a36Sopenharmony_ci
551162306a36Sopenharmony_ci	const u8 *extended_capabilities, *extended_capabilities_mask;
551262306a36Sopenharmony_ci	u8 extended_capabilities_len;
551362306a36Sopenharmony_ci
551462306a36Sopenharmony_ci	const struct wiphy_iftype_ext_capab *iftype_ext_capab;
551562306a36Sopenharmony_ci	unsigned int num_iftype_ext_capab;
551662306a36Sopenharmony_ci
551762306a36Sopenharmony_ci	const void *privid;
551862306a36Sopenharmony_ci
551962306a36Sopenharmony_ci	struct ieee80211_supported_band *bands[NUM_NL80211_BANDS];
552062306a36Sopenharmony_ci
552162306a36Sopenharmony_ci	void (*reg_notifier)(struct wiphy *wiphy,
552262306a36Sopenharmony_ci			     struct regulatory_request *request);
552362306a36Sopenharmony_ci
552462306a36Sopenharmony_ci	/* fields below are read-only, assigned by cfg80211 */
552562306a36Sopenharmony_ci
552662306a36Sopenharmony_ci	const struct ieee80211_regdomain __rcu *regd;
552762306a36Sopenharmony_ci
552862306a36Sopenharmony_ci	struct device dev;
552962306a36Sopenharmony_ci
553062306a36Sopenharmony_ci	bool registered;
553162306a36Sopenharmony_ci
553262306a36Sopenharmony_ci	struct dentry *debugfsdir;
553362306a36Sopenharmony_ci
553462306a36Sopenharmony_ci	const struct ieee80211_ht_cap *ht_capa_mod_mask;
553562306a36Sopenharmony_ci	const struct ieee80211_vht_cap *vht_capa_mod_mask;
553662306a36Sopenharmony_ci
553762306a36Sopenharmony_ci	struct list_head wdev_list;
553862306a36Sopenharmony_ci
553962306a36Sopenharmony_ci	possible_net_t _net;
554062306a36Sopenharmony_ci
554162306a36Sopenharmony_ci#ifdef CONFIG_CFG80211_WEXT
554262306a36Sopenharmony_ci	const struct iw_handler_def *wext;
554362306a36Sopenharmony_ci#endif
554462306a36Sopenharmony_ci
554562306a36Sopenharmony_ci	const struct wiphy_coalesce_support *coalesce;
554662306a36Sopenharmony_ci
554762306a36Sopenharmony_ci	const struct wiphy_vendor_command *vendor_commands;
554862306a36Sopenharmony_ci	const struct nl80211_vendor_cmd_info *vendor_events;
554962306a36Sopenharmony_ci	int n_vendor_commands, n_vendor_events;
555062306a36Sopenharmony_ci
555162306a36Sopenharmony_ci	u16 max_ap_assoc_sta;
555262306a36Sopenharmony_ci
555362306a36Sopenharmony_ci	u8 max_num_csa_counters;
555462306a36Sopenharmony_ci
555562306a36Sopenharmony_ci	u32 bss_select_support;
555662306a36Sopenharmony_ci
555762306a36Sopenharmony_ci	u8 nan_supported_bands;
555862306a36Sopenharmony_ci
555962306a36Sopenharmony_ci	u32 txq_limit;
556062306a36Sopenharmony_ci	u32 txq_memory_limit;
556162306a36Sopenharmony_ci	u32 txq_quantum;
556262306a36Sopenharmony_ci
556362306a36Sopenharmony_ci	unsigned long tx_queue_len;
556462306a36Sopenharmony_ci
556562306a36Sopenharmony_ci	u8 support_mbssid:1,
556662306a36Sopenharmony_ci	   support_only_he_mbssid:1;
556762306a36Sopenharmony_ci
556862306a36Sopenharmony_ci	const struct cfg80211_pmsr_capabilities *pmsr_capa;
556962306a36Sopenharmony_ci
557062306a36Sopenharmony_ci	struct {
557162306a36Sopenharmony_ci		u64 peer, vif;
557262306a36Sopenharmony_ci		u8 max_retry;
557362306a36Sopenharmony_ci	} tid_config_support;
557462306a36Sopenharmony_ci
557562306a36Sopenharmony_ci	u8 max_data_retry_count;
557662306a36Sopenharmony_ci
557762306a36Sopenharmony_ci	const struct cfg80211_sar_capa *sar_capa;
557862306a36Sopenharmony_ci
557962306a36Sopenharmony_ci	struct rfkill *rfkill;
558062306a36Sopenharmony_ci
558162306a36Sopenharmony_ci	u8 mbssid_max_interfaces;
558262306a36Sopenharmony_ci	u8 ema_max_profile_periodicity;
558362306a36Sopenharmony_ci	u16 max_num_akm_suites;
558462306a36Sopenharmony_ci
558562306a36Sopenharmony_ci	u16 hw_timestamp_max_peers;
558662306a36Sopenharmony_ci
558762306a36Sopenharmony_ci	char priv[] __aligned(NETDEV_ALIGN);
558862306a36Sopenharmony_ci};
558962306a36Sopenharmony_ci
559062306a36Sopenharmony_cistatic inline struct net *wiphy_net(struct wiphy *wiphy)
559162306a36Sopenharmony_ci{
559262306a36Sopenharmony_ci	return read_pnet(&wiphy->_net);
559362306a36Sopenharmony_ci}
559462306a36Sopenharmony_ci
559562306a36Sopenharmony_cistatic inline void wiphy_net_set(struct wiphy *wiphy, struct net *net)
559662306a36Sopenharmony_ci{
559762306a36Sopenharmony_ci	write_pnet(&wiphy->_net, net);
559862306a36Sopenharmony_ci}
559962306a36Sopenharmony_ci
560062306a36Sopenharmony_ci/**
560162306a36Sopenharmony_ci * wiphy_priv - return priv from wiphy
560262306a36Sopenharmony_ci *
560362306a36Sopenharmony_ci * @wiphy: the wiphy whose priv pointer to return
560462306a36Sopenharmony_ci * Return: The priv of @wiphy.
560562306a36Sopenharmony_ci */
560662306a36Sopenharmony_cistatic inline void *wiphy_priv(struct wiphy *wiphy)
560762306a36Sopenharmony_ci{
560862306a36Sopenharmony_ci	BUG_ON(!wiphy);
560962306a36Sopenharmony_ci	return &wiphy->priv;
561062306a36Sopenharmony_ci}
561162306a36Sopenharmony_ci
561262306a36Sopenharmony_ci/**
561362306a36Sopenharmony_ci * priv_to_wiphy - return the wiphy containing the priv
561462306a36Sopenharmony_ci *
561562306a36Sopenharmony_ci * @priv: a pointer previously returned by wiphy_priv
561662306a36Sopenharmony_ci * Return: The wiphy of @priv.
561762306a36Sopenharmony_ci */
561862306a36Sopenharmony_cistatic inline struct wiphy *priv_to_wiphy(void *priv)
561962306a36Sopenharmony_ci{
562062306a36Sopenharmony_ci	BUG_ON(!priv);
562162306a36Sopenharmony_ci	return container_of(priv, struct wiphy, priv);
562262306a36Sopenharmony_ci}
562362306a36Sopenharmony_ci
562462306a36Sopenharmony_ci/**
562562306a36Sopenharmony_ci * set_wiphy_dev - set device pointer for wiphy
562662306a36Sopenharmony_ci *
562762306a36Sopenharmony_ci * @wiphy: The wiphy whose device to bind
562862306a36Sopenharmony_ci * @dev: The device to parent it to
562962306a36Sopenharmony_ci */
563062306a36Sopenharmony_cistatic inline void set_wiphy_dev(struct wiphy *wiphy, struct device *dev)
563162306a36Sopenharmony_ci{
563262306a36Sopenharmony_ci	wiphy->dev.parent = dev;
563362306a36Sopenharmony_ci}
563462306a36Sopenharmony_ci
563562306a36Sopenharmony_ci/**
563662306a36Sopenharmony_ci * wiphy_dev - get wiphy dev pointer
563762306a36Sopenharmony_ci *
563862306a36Sopenharmony_ci * @wiphy: The wiphy whose device struct to look up
563962306a36Sopenharmony_ci * Return: The dev of @wiphy.
564062306a36Sopenharmony_ci */
564162306a36Sopenharmony_cistatic inline struct device *wiphy_dev(struct wiphy *wiphy)
564262306a36Sopenharmony_ci{
564362306a36Sopenharmony_ci	return wiphy->dev.parent;
564462306a36Sopenharmony_ci}
564562306a36Sopenharmony_ci
564662306a36Sopenharmony_ci/**
564762306a36Sopenharmony_ci * wiphy_name - get wiphy name
564862306a36Sopenharmony_ci *
564962306a36Sopenharmony_ci * @wiphy: The wiphy whose name to return
565062306a36Sopenharmony_ci * Return: The name of @wiphy.
565162306a36Sopenharmony_ci */
565262306a36Sopenharmony_cistatic inline const char *wiphy_name(const struct wiphy *wiphy)
565362306a36Sopenharmony_ci{
565462306a36Sopenharmony_ci	return dev_name(&wiphy->dev);
565562306a36Sopenharmony_ci}
565662306a36Sopenharmony_ci
565762306a36Sopenharmony_ci/**
565862306a36Sopenharmony_ci * wiphy_new_nm - create a new wiphy for use with cfg80211
565962306a36Sopenharmony_ci *
566062306a36Sopenharmony_ci * @ops: The configuration operations for this device
566162306a36Sopenharmony_ci * @sizeof_priv: The size of the private area to allocate
566262306a36Sopenharmony_ci * @requested_name: Request a particular name.
566362306a36Sopenharmony_ci *	NULL is valid value, and means use the default phy%d naming.
566462306a36Sopenharmony_ci *
566562306a36Sopenharmony_ci * Create a new wiphy and associate the given operations with it.
566662306a36Sopenharmony_ci * @sizeof_priv bytes are allocated for private use.
566762306a36Sopenharmony_ci *
566862306a36Sopenharmony_ci * Return: A pointer to the new wiphy. This pointer must be
566962306a36Sopenharmony_ci * assigned to each netdev's ieee80211_ptr for proper operation.
567062306a36Sopenharmony_ci */
567162306a36Sopenharmony_cistruct wiphy *wiphy_new_nm(const struct cfg80211_ops *ops, int sizeof_priv,
567262306a36Sopenharmony_ci			   const char *requested_name);
567362306a36Sopenharmony_ci
567462306a36Sopenharmony_ci/**
567562306a36Sopenharmony_ci * wiphy_new - create a new wiphy for use with cfg80211
567662306a36Sopenharmony_ci *
567762306a36Sopenharmony_ci * @ops: The configuration operations for this device
567862306a36Sopenharmony_ci * @sizeof_priv: The size of the private area to allocate
567962306a36Sopenharmony_ci *
568062306a36Sopenharmony_ci * Create a new wiphy and associate the given operations with it.
568162306a36Sopenharmony_ci * @sizeof_priv bytes are allocated for private use.
568262306a36Sopenharmony_ci *
568362306a36Sopenharmony_ci * Return: A pointer to the new wiphy. This pointer must be
568462306a36Sopenharmony_ci * assigned to each netdev's ieee80211_ptr for proper operation.
568562306a36Sopenharmony_ci */
568662306a36Sopenharmony_cistatic inline struct wiphy *wiphy_new(const struct cfg80211_ops *ops,
568762306a36Sopenharmony_ci				      int sizeof_priv)
568862306a36Sopenharmony_ci{
568962306a36Sopenharmony_ci	return wiphy_new_nm(ops, sizeof_priv, NULL);
569062306a36Sopenharmony_ci}
569162306a36Sopenharmony_ci
569262306a36Sopenharmony_ci/**
569362306a36Sopenharmony_ci * wiphy_register - register a wiphy with cfg80211
569462306a36Sopenharmony_ci *
569562306a36Sopenharmony_ci * @wiphy: The wiphy to register.
569662306a36Sopenharmony_ci *
569762306a36Sopenharmony_ci * Return: A non-negative wiphy index or a negative error code.
569862306a36Sopenharmony_ci */
569962306a36Sopenharmony_ciint wiphy_register(struct wiphy *wiphy);
570062306a36Sopenharmony_ci
570162306a36Sopenharmony_ci/* this is a define for better error reporting (file/line) */
570262306a36Sopenharmony_ci#define lockdep_assert_wiphy(wiphy) lockdep_assert_held(&(wiphy)->mtx)
570362306a36Sopenharmony_ci
570462306a36Sopenharmony_ci/**
570562306a36Sopenharmony_ci * rcu_dereference_wiphy - rcu_dereference with debug checking
570662306a36Sopenharmony_ci * @wiphy: the wiphy to check the locking on
570762306a36Sopenharmony_ci * @p: The pointer to read, prior to dereferencing
570862306a36Sopenharmony_ci *
570962306a36Sopenharmony_ci * Do an rcu_dereference(p), but check caller either holds rcu_read_lock()
571062306a36Sopenharmony_ci * or RTNL. Note: Please prefer wiphy_dereference() or rcu_dereference().
571162306a36Sopenharmony_ci */
571262306a36Sopenharmony_ci#define rcu_dereference_wiphy(wiphy, p)				\
571362306a36Sopenharmony_ci        rcu_dereference_check(p, lockdep_is_held(&wiphy->mtx))
571462306a36Sopenharmony_ci
571562306a36Sopenharmony_ci/**
571662306a36Sopenharmony_ci * wiphy_dereference - fetch RCU pointer when updates are prevented by wiphy mtx
571762306a36Sopenharmony_ci * @wiphy: the wiphy to check the locking on
571862306a36Sopenharmony_ci * @p: The pointer to read, prior to dereferencing
571962306a36Sopenharmony_ci *
572062306a36Sopenharmony_ci * Return the value of the specified RCU-protected pointer, but omit the
572162306a36Sopenharmony_ci * READ_ONCE(), because caller holds the wiphy mutex used for updates.
572262306a36Sopenharmony_ci */
572362306a36Sopenharmony_ci#define wiphy_dereference(wiphy, p)				\
572462306a36Sopenharmony_ci        rcu_dereference_protected(p, lockdep_is_held(&wiphy->mtx))
572562306a36Sopenharmony_ci
572662306a36Sopenharmony_ci/**
572762306a36Sopenharmony_ci * get_wiphy_regdom - get custom regdomain for the given wiphy
572862306a36Sopenharmony_ci * @wiphy: the wiphy to get the regdomain from
572962306a36Sopenharmony_ci */
573062306a36Sopenharmony_ciconst struct ieee80211_regdomain *get_wiphy_regdom(struct wiphy *wiphy);
573162306a36Sopenharmony_ci
573262306a36Sopenharmony_ci/**
573362306a36Sopenharmony_ci * wiphy_unregister - deregister a wiphy from cfg80211
573462306a36Sopenharmony_ci *
573562306a36Sopenharmony_ci * @wiphy: The wiphy to unregister.
573662306a36Sopenharmony_ci *
573762306a36Sopenharmony_ci * After this call, no more requests can be made with this priv
573862306a36Sopenharmony_ci * pointer, but the call may sleep to wait for an outstanding
573962306a36Sopenharmony_ci * request that is being handled.
574062306a36Sopenharmony_ci */
574162306a36Sopenharmony_civoid wiphy_unregister(struct wiphy *wiphy);
574262306a36Sopenharmony_ci
574362306a36Sopenharmony_ci/**
574462306a36Sopenharmony_ci * wiphy_free - free wiphy
574562306a36Sopenharmony_ci *
574662306a36Sopenharmony_ci * @wiphy: The wiphy to free
574762306a36Sopenharmony_ci */
574862306a36Sopenharmony_civoid wiphy_free(struct wiphy *wiphy);
574962306a36Sopenharmony_ci
575062306a36Sopenharmony_ci/* internal structs */
575162306a36Sopenharmony_cistruct cfg80211_conn;
575262306a36Sopenharmony_cistruct cfg80211_internal_bss;
575362306a36Sopenharmony_cistruct cfg80211_cached_keys;
575462306a36Sopenharmony_cistruct cfg80211_cqm_config;
575562306a36Sopenharmony_ci
575662306a36Sopenharmony_ci/**
575762306a36Sopenharmony_ci * wiphy_lock - lock the wiphy
575862306a36Sopenharmony_ci * @wiphy: the wiphy to lock
575962306a36Sopenharmony_ci *
576062306a36Sopenharmony_ci * This is needed around registering and unregistering netdevs that
576162306a36Sopenharmony_ci * aren't created through cfg80211 calls, since that requires locking
576262306a36Sopenharmony_ci * in cfg80211 when the notifiers is called, but that cannot
576362306a36Sopenharmony_ci * differentiate which way it's called.
576462306a36Sopenharmony_ci *
576562306a36Sopenharmony_ci * It can also be used by drivers for their own purposes.
576662306a36Sopenharmony_ci *
576762306a36Sopenharmony_ci * When cfg80211 ops are called, the wiphy is already locked.
576862306a36Sopenharmony_ci *
576962306a36Sopenharmony_ci * Note that this makes sure that no workers that have been queued
577062306a36Sopenharmony_ci * with wiphy_queue_work() are running.
577162306a36Sopenharmony_ci */
577262306a36Sopenharmony_cistatic inline void wiphy_lock(struct wiphy *wiphy)
577362306a36Sopenharmony_ci	__acquires(&wiphy->mtx)
577462306a36Sopenharmony_ci{
577562306a36Sopenharmony_ci	mutex_lock(&wiphy->mtx);
577662306a36Sopenharmony_ci	__acquire(&wiphy->mtx);
577762306a36Sopenharmony_ci}
577862306a36Sopenharmony_ci
577962306a36Sopenharmony_ci/**
578062306a36Sopenharmony_ci * wiphy_unlock - unlock the wiphy again
578162306a36Sopenharmony_ci * @wiphy: the wiphy to unlock
578262306a36Sopenharmony_ci */
578362306a36Sopenharmony_cistatic inline void wiphy_unlock(struct wiphy *wiphy)
578462306a36Sopenharmony_ci	__releases(&wiphy->mtx)
578562306a36Sopenharmony_ci{
578662306a36Sopenharmony_ci	__release(&wiphy->mtx);
578762306a36Sopenharmony_ci	mutex_unlock(&wiphy->mtx);
578862306a36Sopenharmony_ci}
578962306a36Sopenharmony_ci
579062306a36Sopenharmony_cistruct wiphy_work;
579162306a36Sopenharmony_citypedef void (*wiphy_work_func_t)(struct wiphy *, struct wiphy_work *);
579262306a36Sopenharmony_ci
579362306a36Sopenharmony_cistruct wiphy_work {
579462306a36Sopenharmony_ci	struct list_head entry;
579562306a36Sopenharmony_ci	wiphy_work_func_t func;
579662306a36Sopenharmony_ci};
579762306a36Sopenharmony_ci
579862306a36Sopenharmony_cistatic inline void wiphy_work_init(struct wiphy_work *work,
579962306a36Sopenharmony_ci				   wiphy_work_func_t func)
580062306a36Sopenharmony_ci{
580162306a36Sopenharmony_ci	INIT_LIST_HEAD(&work->entry);
580262306a36Sopenharmony_ci	work->func = func;
580362306a36Sopenharmony_ci}
580462306a36Sopenharmony_ci
580562306a36Sopenharmony_ci/**
580662306a36Sopenharmony_ci * wiphy_work_queue - queue work for the wiphy
580762306a36Sopenharmony_ci * @wiphy: the wiphy to queue for
580862306a36Sopenharmony_ci * @work: the work item
580962306a36Sopenharmony_ci *
581062306a36Sopenharmony_ci * This is useful for work that must be done asynchronously, and work
581162306a36Sopenharmony_ci * queued here has the special property that the wiphy mutex will be
581262306a36Sopenharmony_ci * held as if wiphy_lock() was called, and that it cannot be running
581362306a36Sopenharmony_ci * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
581462306a36Sopenharmony_ci * use just cancel_work() instead of cancel_work_sync(), it requires
581562306a36Sopenharmony_ci * being in a section protected by wiphy_lock().
581662306a36Sopenharmony_ci */
581762306a36Sopenharmony_civoid wiphy_work_queue(struct wiphy *wiphy, struct wiphy_work *work);
581862306a36Sopenharmony_ci
581962306a36Sopenharmony_ci/**
582062306a36Sopenharmony_ci * wiphy_work_cancel - cancel previously queued work
582162306a36Sopenharmony_ci * @wiphy: the wiphy, for debug purposes
582262306a36Sopenharmony_ci * @work: the work to cancel
582362306a36Sopenharmony_ci *
582462306a36Sopenharmony_ci * Cancel the work *without* waiting for it, this assumes being
582562306a36Sopenharmony_ci * called under the wiphy mutex acquired by wiphy_lock().
582662306a36Sopenharmony_ci */
582762306a36Sopenharmony_civoid wiphy_work_cancel(struct wiphy *wiphy, struct wiphy_work *work);
582862306a36Sopenharmony_ci
582962306a36Sopenharmony_ci/**
583062306a36Sopenharmony_ci * wiphy_work_flush - flush previously queued work
583162306a36Sopenharmony_ci * @wiphy: the wiphy, for debug purposes
583262306a36Sopenharmony_ci * @work: the work to flush, this can be %NULL to flush all work
583362306a36Sopenharmony_ci *
583462306a36Sopenharmony_ci * Flush the work (i.e. run it if pending). This must be called
583562306a36Sopenharmony_ci * under the wiphy mutex acquired by wiphy_lock().
583662306a36Sopenharmony_ci */
583762306a36Sopenharmony_civoid wiphy_work_flush(struct wiphy *wiphy, struct wiphy_work *work);
583862306a36Sopenharmony_ci
583962306a36Sopenharmony_cistruct wiphy_delayed_work {
584062306a36Sopenharmony_ci	struct wiphy_work work;
584162306a36Sopenharmony_ci	struct wiphy *wiphy;
584262306a36Sopenharmony_ci	struct timer_list timer;
584362306a36Sopenharmony_ci};
584462306a36Sopenharmony_ci
584562306a36Sopenharmony_civoid wiphy_delayed_work_timer(struct timer_list *t);
584662306a36Sopenharmony_ci
584762306a36Sopenharmony_cistatic inline void wiphy_delayed_work_init(struct wiphy_delayed_work *dwork,
584862306a36Sopenharmony_ci					   wiphy_work_func_t func)
584962306a36Sopenharmony_ci{
585062306a36Sopenharmony_ci	timer_setup(&dwork->timer, wiphy_delayed_work_timer, 0);
585162306a36Sopenharmony_ci	wiphy_work_init(&dwork->work, func);
585262306a36Sopenharmony_ci}
585362306a36Sopenharmony_ci
585462306a36Sopenharmony_ci/**
585562306a36Sopenharmony_ci * wiphy_delayed_work_queue - queue delayed work for the wiphy
585662306a36Sopenharmony_ci * @wiphy: the wiphy to queue for
585762306a36Sopenharmony_ci * @dwork: the delayable worker
585862306a36Sopenharmony_ci * @delay: number of jiffies to wait before queueing
585962306a36Sopenharmony_ci *
586062306a36Sopenharmony_ci * This is useful for work that must be done asynchronously, and work
586162306a36Sopenharmony_ci * queued here has the special property that the wiphy mutex will be
586262306a36Sopenharmony_ci * held as if wiphy_lock() was called, and that it cannot be running
586362306a36Sopenharmony_ci * after wiphy_lock() was called. Therefore, wiphy_cancel_work() can
586462306a36Sopenharmony_ci * use just cancel_work() instead of cancel_work_sync(), it requires
586562306a36Sopenharmony_ci * being in a section protected by wiphy_lock().
586662306a36Sopenharmony_ci */
586762306a36Sopenharmony_civoid wiphy_delayed_work_queue(struct wiphy *wiphy,
586862306a36Sopenharmony_ci			      struct wiphy_delayed_work *dwork,
586962306a36Sopenharmony_ci			      unsigned long delay);
587062306a36Sopenharmony_ci
587162306a36Sopenharmony_ci/**
587262306a36Sopenharmony_ci * wiphy_delayed_work_cancel - cancel previously queued delayed work
587362306a36Sopenharmony_ci * @wiphy: the wiphy, for debug purposes
587462306a36Sopenharmony_ci * @dwork: the delayed work to cancel
587562306a36Sopenharmony_ci *
587662306a36Sopenharmony_ci * Cancel the work *without* waiting for it, this assumes being
587762306a36Sopenharmony_ci * called under the wiphy mutex acquired by wiphy_lock().
587862306a36Sopenharmony_ci */
587962306a36Sopenharmony_civoid wiphy_delayed_work_cancel(struct wiphy *wiphy,
588062306a36Sopenharmony_ci			       struct wiphy_delayed_work *dwork);
588162306a36Sopenharmony_ci
588262306a36Sopenharmony_ci/**
588362306a36Sopenharmony_ci * wiphy_delayed_work_flush - flush previously queued delayed work
588462306a36Sopenharmony_ci * @wiphy: the wiphy, for debug purposes
588562306a36Sopenharmony_ci * @work: the work to flush
588662306a36Sopenharmony_ci *
588762306a36Sopenharmony_ci * Flush the work (i.e. run it if pending). This must be called
588862306a36Sopenharmony_ci * under the wiphy mutex acquired by wiphy_lock().
588962306a36Sopenharmony_ci */
589062306a36Sopenharmony_civoid wiphy_delayed_work_flush(struct wiphy *wiphy,
589162306a36Sopenharmony_ci			      struct wiphy_delayed_work *dwork);
589262306a36Sopenharmony_ci
589362306a36Sopenharmony_ci/**
589462306a36Sopenharmony_ci * struct wireless_dev - wireless device state
589562306a36Sopenharmony_ci *
589662306a36Sopenharmony_ci * For netdevs, this structure must be allocated by the driver
589762306a36Sopenharmony_ci * that uses the ieee80211_ptr field in struct net_device (this
589862306a36Sopenharmony_ci * is intentional so it can be allocated along with the netdev.)
589962306a36Sopenharmony_ci * It need not be registered then as netdev registration will
590062306a36Sopenharmony_ci * be intercepted by cfg80211 to see the new wireless device,
590162306a36Sopenharmony_ci * however, drivers must lock the wiphy before registering or
590262306a36Sopenharmony_ci * unregistering netdevs if they pre-create any netdevs (in ops
590362306a36Sopenharmony_ci * called from cfg80211, the wiphy is already locked.)
590462306a36Sopenharmony_ci *
590562306a36Sopenharmony_ci * For non-netdev uses, it must also be allocated by the driver
590662306a36Sopenharmony_ci * in response to the cfg80211 callbacks that require it, as
590762306a36Sopenharmony_ci * there's no netdev registration in that case it may not be
590862306a36Sopenharmony_ci * allocated outside of callback operations that return it.
590962306a36Sopenharmony_ci *
591062306a36Sopenharmony_ci * @wiphy: pointer to hardware description
591162306a36Sopenharmony_ci * @iftype: interface type
591262306a36Sopenharmony_ci * @registered: is this wdev already registered with cfg80211
591362306a36Sopenharmony_ci * @registering: indicates we're doing registration under wiphy lock
591462306a36Sopenharmony_ci *	for the notifier
591562306a36Sopenharmony_ci * @list: (private) Used to collect the interfaces
591662306a36Sopenharmony_ci * @netdev: (private) Used to reference back to the netdev, may be %NULL
591762306a36Sopenharmony_ci * @identifier: (private) Identifier used in nl80211 to identify this
591862306a36Sopenharmony_ci *	wireless device if it has no netdev
591962306a36Sopenharmony_ci * @u: union containing data specific to @iftype
592062306a36Sopenharmony_ci * @connected: indicates if connected or not (STA mode)
592162306a36Sopenharmony_ci * @bssid: (private) Used by the internal configuration code
592262306a36Sopenharmony_ci * @wext: (private) Used by the internal wireless extensions compat code
592362306a36Sopenharmony_ci * @wext.ibss: (private) IBSS data part of wext handling
592462306a36Sopenharmony_ci * @wext.connect: (private) connection handling data
592562306a36Sopenharmony_ci * @wext.keys: (private) (WEP) key data
592662306a36Sopenharmony_ci * @wext.ie: (private) extra elements for association
592762306a36Sopenharmony_ci * @wext.ie_len: (private) length of extra elements
592862306a36Sopenharmony_ci * @wext.bssid: (private) selected network BSSID
592962306a36Sopenharmony_ci * @wext.ssid: (private) selected network SSID
593062306a36Sopenharmony_ci * @wext.default_key: (private) selected default key index
593162306a36Sopenharmony_ci * @wext.default_mgmt_key: (private) selected default management key index
593262306a36Sopenharmony_ci * @wext.prev_bssid: (private) previous BSSID for reassociation
593362306a36Sopenharmony_ci * @wext.prev_bssid_valid: (private) previous BSSID validity
593462306a36Sopenharmony_ci * @use_4addr: indicates 4addr mode is used on this interface, must be
593562306a36Sopenharmony_ci *	set by driver (if supported) on add_interface BEFORE registering the
593662306a36Sopenharmony_ci *	netdev and may otherwise be used by driver read-only, will be update
593762306a36Sopenharmony_ci *	by cfg80211 on change_interface
593862306a36Sopenharmony_ci * @mgmt_registrations: list of registrations for management frames
593962306a36Sopenharmony_ci * @mgmt_registrations_need_update: mgmt registrations were updated,
594062306a36Sopenharmony_ci *	need to propagate the update to the driver
594162306a36Sopenharmony_ci * @mtx: mutex used to lock data in this struct, may be used by drivers
594262306a36Sopenharmony_ci *	and some API functions require it held
594362306a36Sopenharmony_ci * @beacon_interval: beacon interval used on this device for transmitting
594462306a36Sopenharmony_ci *	beacons, 0 when not valid
594562306a36Sopenharmony_ci * @address: The address for this device, valid only if @netdev is %NULL
594662306a36Sopenharmony_ci * @is_running: true if this is a non-netdev device that has been started, e.g.
594762306a36Sopenharmony_ci *	the P2P Device.
594862306a36Sopenharmony_ci * @cac_started: true if DFS channel availability check has been started
594962306a36Sopenharmony_ci * @cac_start_time: timestamp (jiffies) when the dfs state was entered.
595062306a36Sopenharmony_ci * @cac_time_ms: CAC time in ms
595162306a36Sopenharmony_ci * @ps: powersave mode is enabled
595262306a36Sopenharmony_ci * @ps_timeout: dynamic powersave timeout
595362306a36Sopenharmony_ci * @ap_unexpected_nlportid: (private) netlink port ID of application
595462306a36Sopenharmony_ci *	registered for unexpected class 3 frames (AP mode)
595562306a36Sopenharmony_ci * @conn: (private) cfg80211 software SME connection state machine data
595662306a36Sopenharmony_ci * @connect_keys: (private) keys to set after connection is established
595762306a36Sopenharmony_ci * @conn_bss_type: connecting/connected BSS type
595862306a36Sopenharmony_ci * @conn_owner_nlportid: (private) connection owner socket port ID
595962306a36Sopenharmony_ci * @disconnect_wk: (private) auto-disconnect work
596062306a36Sopenharmony_ci * @disconnect_bssid: (private) the BSSID to use for auto-disconnect
596162306a36Sopenharmony_ci * @event_list: (private) list for internal event processing
596262306a36Sopenharmony_ci * @event_lock: (private) lock for event list
596362306a36Sopenharmony_ci * @owner_nlportid: (private) owner socket port ID
596462306a36Sopenharmony_ci * @nl_owner_dead: (private) owner socket went away
596562306a36Sopenharmony_ci * @cqm_rssi_work: (private) CQM RSSI reporting work
596662306a36Sopenharmony_ci * @cqm_config: (private) nl80211 RSSI monitor state
596762306a36Sopenharmony_ci * @pmsr_list: (private) peer measurement requests
596862306a36Sopenharmony_ci * @pmsr_lock: (private) peer measurements requests/results lock
596962306a36Sopenharmony_ci * @pmsr_free_wk: (private) peer measurements cleanup work
597062306a36Sopenharmony_ci * @unprot_beacon_reported: (private) timestamp of last
597162306a36Sopenharmony_ci *	unprotected beacon report
597262306a36Sopenharmony_ci * @links: array of %IEEE80211_MLD_MAX_NUM_LINKS elements containing @addr
597362306a36Sopenharmony_ci *	@ap and @client for each link
597462306a36Sopenharmony_ci * @valid_links: bitmap describing what elements of @links are valid
597562306a36Sopenharmony_ci */
597662306a36Sopenharmony_cistruct wireless_dev {
597762306a36Sopenharmony_ci	struct wiphy *wiphy;
597862306a36Sopenharmony_ci	enum nl80211_iftype iftype;
597962306a36Sopenharmony_ci
598062306a36Sopenharmony_ci	/* the remainder of this struct should be private to cfg80211 */
598162306a36Sopenharmony_ci	struct list_head list;
598262306a36Sopenharmony_ci	struct net_device *netdev;
598362306a36Sopenharmony_ci
598462306a36Sopenharmony_ci	u32 identifier;
598562306a36Sopenharmony_ci
598662306a36Sopenharmony_ci	struct list_head mgmt_registrations;
598762306a36Sopenharmony_ci	u8 mgmt_registrations_need_update:1;
598862306a36Sopenharmony_ci
598962306a36Sopenharmony_ci	struct mutex mtx;
599062306a36Sopenharmony_ci
599162306a36Sopenharmony_ci	bool use_4addr, is_running, registered, registering;
599262306a36Sopenharmony_ci
599362306a36Sopenharmony_ci	u8 address[ETH_ALEN] __aligned(sizeof(u16));
599462306a36Sopenharmony_ci
599562306a36Sopenharmony_ci	/* currently used for IBSS and SME - might be rearranged later */
599662306a36Sopenharmony_ci	struct cfg80211_conn *conn;
599762306a36Sopenharmony_ci	struct cfg80211_cached_keys *connect_keys;
599862306a36Sopenharmony_ci	enum ieee80211_bss_type conn_bss_type;
599962306a36Sopenharmony_ci	u32 conn_owner_nlportid;
600062306a36Sopenharmony_ci
600162306a36Sopenharmony_ci	struct work_struct disconnect_wk;
600262306a36Sopenharmony_ci	u8 disconnect_bssid[ETH_ALEN];
600362306a36Sopenharmony_ci
600462306a36Sopenharmony_ci	struct list_head event_list;
600562306a36Sopenharmony_ci	spinlock_t event_lock;
600662306a36Sopenharmony_ci
600762306a36Sopenharmony_ci	u8 connected:1;
600862306a36Sopenharmony_ci
600962306a36Sopenharmony_ci	bool ps;
601062306a36Sopenharmony_ci	int ps_timeout;
601162306a36Sopenharmony_ci
601262306a36Sopenharmony_ci	u32 ap_unexpected_nlportid;
601362306a36Sopenharmony_ci
601462306a36Sopenharmony_ci	u32 owner_nlportid;
601562306a36Sopenharmony_ci	bool nl_owner_dead;
601662306a36Sopenharmony_ci
601762306a36Sopenharmony_ci	/* FIXME: need to rework radar detection for MLO */
601862306a36Sopenharmony_ci	bool cac_started;
601962306a36Sopenharmony_ci	unsigned long cac_start_time;
602062306a36Sopenharmony_ci	unsigned int cac_time_ms;
602162306a36Sopenharmony_ci
602262306a36Sopenharmony_ci#ifdef CONFIG_CFG80211_WEXT
602362306a36Sopenharmony_ci	/* wext data */
602462306a36Sopenharmony_ci	struct {
602562306a36Sopenharmony_ci		struct cfg80211_ibss_params ibss;
602662306a36Sopenharmony_ci		struct cfg80211_connect_params connect;
602762306a36Sopenharmony_ci		struct cfg80211_cached_keys *keys;
602862306a36Sopenharmony_ci		const u8 *ie;
602962306a36Sopenharmony_ci		size_t ie_len;
603062306a36Sopenharmony_ci		u8 bssid[ETH_ALEN];
603162306a36Sopenharmony_ci		u8 prev_bssid[ETH_ALEN];
603262306a36Sopenharmony_ci		u8 ssid[IEEE80211_MAX_SSID_LEN];
603362306a36Sopenharmony_ci		s8 default_key, default_mgmt_key;
603462306a36Sopenharmony_ci		bool prev_bssid_valid;
603562306a36Sopenharmony_ci	} wext;
603662306a36Sopenharmony_ci#endif
603762306a36Sopenharmony_ci
603862306a36Sopenharmony_ci	struct wiphy_work cqm_rssi_work;
603962306a36Sopenharmony_ci	struct cfg80211_cqm_config __rcu *cqm_config;
604062306a36Sopenharmony_ci
604162306a36Sopenharmony_ci	struct list_head pmsr_list;
604262306a36Sopenharmony_ci	spinlock_t pmsr_lock;
604362306a36Sopenharmony_ci	struct work_struct pmsr_free_wk;
604462306a36Sopenharmony_ci
604562306a36Sopenharmony_ci	unsigned long unprot_beacon_reported;
604662306a36Sopenharmony_ci
604762306a36Sopenharmony_ci	union {
604862306a36Sopenharmony_ci		struct {
604962306a36Sopenharmony_ci			u8 connected_addr[ETH_ALEN] __aligned(2);
605062306a36Sopenharmony_ci			u8 ssid[IEEE80211_MAX_SSID_LEN];
605162306a36Sopenharmony_ci			u8 ssid_len;
605262306a36Sopenharmony_ci		} client;
605362306a36Sopenharmony_ci		struct {
605462306a36Sopenharmony_ci			int beacon_interval;
605562306a36Sopenharmony_ci			struct cfg80211_chan_def preset_chandef;
605662306a36Sopenharmony_ci			struct cfg80211_chan_def chandef;
605762306a36Sopenharmony_ci			u8 id[IEEE80211_MAX_SSID_LEN];
605862306a36Sopenharmony_ci			u8 id_len, id_up_len;
605962306a36Sopenharmony_ci		} mesh;
606062306a36Sopenharmony_ci		struct {
606162306a36Sopenharmony_ci			struct cfg80211_chan_def preset_chandef;
606262306a36Sopenharmony_ci			u8 ssid[IEEE80211_MAX_SSID_LEN];
606362306a36Sopenharmony_ci			u8 ssid_len;
606462306a36Sopenharmony_ci		} ap;
606562306a36Sopenharmony_ci		struct {
606662306a36Sopenharmony_ci			struct cfg80211_internal_bss *current_bss;
606762306a36Sopenharmony_ci			struct cfg80211_chan_def chandef;
606862306a36Sopenharmony_ci			int beacon_interval;
606962306a36Sopenharmony_ci			u8 ssid[IEEE80211_MAX_SSID_LEN];
607062306a36Sopenharmony_ci			u8 ssid_len;
607162306a36Sopenharmony_ci		} ibss;
607262306a36Sopenharmony_ci		struct {
607362306a36Sopenharmony_ci			struct cfg80211_chan_def chandef;
607462306a36Sopenharmony_ci		} ocb;
607562306a36Sopenharmony_ci	} u;
607662306a36Sopenharmony_ci
607762306a36Sopenharmony_ci	struct {
607862306a36Sopenharmony_ci		u8 addr[ETH_ALEN] __aligned(2);
607962306a36Sopenharmony_ci		union {
608062306a36Sopenharmony_ci			struct {
608162306a36Sopenharmony_ci				unsigned int beacon_interval;
608262306a36Sopenharmony_ci				struct cfg80211_chan_def chandef;
608362306a36Sopenharmony_ci			} ap;
608462306a36Sopenharmony_ci			struct {
608562306a36Sopenharmony_ci				struct cfg80211_internal_bss *current_bss;
608662306a36Sopenharmony_ci			} client;
608762306a36Sopenharmony_ci		};
608862306a36Sopenharmony_ci	} links[IEEE80211_MLD_MAX_NUM_LINKS];
608962306a36Sopenharmony_ci	u16 valid_links;
609062306a36Sopenharmony_ci};
609162306a36Sopenharmony_ci
609262306a36Sopenharmony_cistatic inline const u8 *wdev_address(struct wireless_dev *wdev)
609362306a36Sopenharmony_ci{
609462306a36Sopenharmony_ci	if (wdev->netdev)
609562306a36Sopenharmony_ci		return wdev->netdev->dev_addr;
609662306a36Sopenharmony_ci	return wdev->address;
609762306a36Sopenharmony_ci}
609862306a36Sopenharmony_ci
609962306a36Sopenharmony_cistatic inline bool wdev_running(struct wireless_dev *wdev)
610062306a36Sopenharmony_ci{
610162306a36Sopenharmony_ci	if (wdev->netdev)
610262306a36Sopenharmony_ci		return netif_running(wdev->netdev);
610362306a36Sopenharmony_ci	return wdev->is_running;
610462306a36Sopenharmony_ci}
610562306a36Sopenharmony_ci
610662306a36Sopenharmony_ci/**
610762306a36Sopenharmony_ci * wdev_priv - return wiphy priv from wireless_dev
610862306a36Sopenharmony_ci *
610962306a36Sopenharmony_ci * @wdev: The wireless device whose wiphy's priv pointer to return
611062306a36Sopenharmony_ci * Return: The wiphy priv of @wdev.
611162306a36Sopenharmony_ci */
611262306a36Sopenharmony_cistatic inline void *wdev_priv(struct wireless_dev *wdev)
611362306a36Sopenharmony_ci{
611462306a36Sopenharmony_ci	BUG_ON(!wdev);
611562306a36Sopenharmony_ci	return wiphy_priv(wdev->wiphy);
611662306a36Sopenharmony_ci}
611762306a36Sopenharmony_ci
611862306a36Sopenharmony_ci/**
611962306a36Sopenharmony_ci * wdev_chandef - return chandef pointer from wireless_dev
612062306a36Sopenharmony_ci * @wdev: the wdev
612162306a36Sopenharmony_ci * @link_id: the link ID for MLO
612262306a36Sopenharmony_ci *
612362306a36Sopenharmony_ci * Return: The chandef depending on the mode, or %NULL.
612462306a36Sopenharmony_ci */
612562306a36Sopenharmony_cistruct cfg80211_chan_def *wdev_chandef(struct wireless_dev *wdev,
612662306a36Sopenharmony_ci				       unsigned int link_id);
612762306a36Sopenharmony_ci
612862306a36Sopenharmony_cistatic inline void WARN_INVALID_LINK_ID(struct wireless_dev *wdev,
612962306a36Sopenharmony_ci					unsigned int link_id)
613062306a36Sopenharmony_ci{
613162306a36Sopenharmony_ci	WARN_ON(link_id && !wdev->valid_links);
613262306a36Sopenharmony_ci	WARN_ON(wdev->valid_links &&
613362306a36Sopenharmony_ci		!(wdev->valid_links & BIT(link_id)));
613462306a36Sopenharmony_ci}
613562306a36Sopenharmony_ci
613662306a36Sopenharmony_ci#define for_each_valid_link(link_info, link_id)			\
613762306a36Sopenharmony_ci	for (link_id = 0;					\
613862306a36Sopenharmony_ci	     link_id < ((link_info)->valid_links ?		\
613962306a36Sopenharmony_ci			ARRAY_SIZE((link_info)->links) : 1);	\
614062306a36Sopenharmony_ci	     link_id++)						\
614162306a36Sopenharmony_ci		if (!(link_info)->valid_links ||		\
614262306a36Sopenharmony_ci		    ((link_info)->valid_links & BIT(link_id)))
614362306a36Sopenharmony_ci
614462306a36Sopenharmony_ci/**
614562306a36Sopenharmony_ci * DOC: Utility functions
614662306a36Sopenharmony_ci *
614762306a36Sopenharmony_ci * cfg80211 offers a number of utility functions that can be useful.
614862306a36Sopenharmony_ci */
614962306a36Sopenharmony_ci
615062306a36Sopenharmony_ci/**
615162306a36Sopenharmony_ci * ieee80211_channel_equal - compare two struct ieee80211_channel
615262306a36Sopenharmony_ci *
615362306a36Sopenharmony_ci * @a: 1st struct ieee80211_channel
615462306a36Sopenharmony_ci * @b: 2nd struct ieee80211_channel
615562306a36Sopenharmony_ci * Return: true if center frequency of @a == @b
615662306a36Sopenharmony_ci */
615762306a36Sopenharmony_cistatic inline bool
615862306a36Sopenharmony_ciieee80211_channel_equal(struct ieee80211_channel *a,
615962306a36Sopenharmony_ci			struct ieee80211_channel *b)
616062306a36Sopenharmony_ci{
616162306a36Sopenharmony_ci	return (a->center_freq == b->center_freq &&
616262306a36Sopenharmony_ci		a->freq_offset == b->freq_offset);
616362306a36Sopenharmony_ci}
616462306a36Sopenharmony_ci
616562306a36Sopenharmony_ci/**
616662306a36Sopenharmony_ci * ieee80211_channel_to_khz - convert ieee80211_channel to frequency in KHz
616762306a36Sopenharmony_ci * @chan: struct ieee80211_channel to convert
616862306a36Sopenharmony_ci * Return: The corresponding frequency (in KHz)
616962306a36Sopenharmony_ci */
617062306a36Sopenharmony_cistatic inline u32
617162306a36Sopenharmony_ciieee80211_channel_to_khz(const struct ieee80211_channel *chan)
617262306a36Sopenharmony_ci{
617362306a36Sopenharmony_ci	return MHZ_TO_KHZ(chan->center_freq) + chan->freq_offset;
617462306a36Sopenharmony_ci}
617562306a36Sopenharmony_ci
617662306a36Sopenharmony_ci/**
617762306a36Sopenharmony_ci * ieee80211_s1g_channel_width - get allowed channel width from @chan
617862306a36Sopenharmony_ci *
617962306a36Sopenharmony_ci * Only allowed for band NL80211_BAND_S1GHZ
618062306a36Sopenharmony_ci * @chan: channel
618162306a36Sopenharmony_ci * Return: The allowed channel width for this center_freq
618262306a36Sopenharmony_ci */
618362306a36Sopenharmony_cienum nl80211_chan_width
618462306a36Sopenharmony_ciieee80211_s1g_channel_width(const struct ieee80211_channel *chan);
618562306a36Sopenharmony_ci
618662306a36Sopenharmony_ci/**
618762306a36Sopenharmony_ci * ieee80211_channel_to_freq_khz - convert channel number to frequency
618862306a36Sopenharmony_ci * @chan: channel number
618962306a36Sopenharmony_ci * @band: band, necessary due to channel number overlap
619062306a36Sopenharmony_ci * Return: The corresponding frequency (in KHz), or 0 if the conversion failed.
619162306a36Sopenharmony_ci */
619262306a36Sopenharmony_ciu32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band);
619362306a36Sopenharmony_ci
619462306a36Sopenharmony_ci/**
619562306a36Sopenharmony_ci * ieee80211_channel_to_frequency - convert channel number to frequency
619662306a36Sopenharmony_ci * @chan: channel number
619762306a36Sopenharmony_ci * @band: band, necessary due to channel number overlap
619862306a36Sopenharmony_ci * Return: The corresponding frequency (in MHz), or 0 if the conversion failed.
619962306a36Sopenharmony_ci */
620062306a36Sopenharmony_cistatic inline int
620162306a36Sopenharmony_ciieee80211_channel_to_frequency(int chan, enum nl80211_band band)
620262306a36Sopenharmony_ci{
620362306a36Sopenharmony_ci	return KHZ_TO_MHZ(ieee80211_channel_to_freq_khz(chan, band));
620462306a36Sopenharmony_ci}
620562306a36Sopenharmony_ci
620662306a36Sopenharmony_ci/**
620762306a36Sopenharmony_ci * ieee80211_freq_khz_to_channel - convert frequency to channel number
620862306a36Sopenharmony_ci * @freq: center frequency in KHz
620962306a36Sopenharmony_ci * Return: The corresponding channel, or 0 if the conversion failed.
621062306a36Sopenharmony_ci */
621162306a36Sopenharmony_ciint ieee80211_freq_khz_to_channel(u32 freq);
621262306a36Sopenharmony_ci
621362306a36Sopenharmony_ci/**
621462306a36Sopenharmony_ci * ieee80211_frequency_to_channel - convert frequency to channel number
621562306a36Sopenharmony_ci * @freq: center frequency in MHz
621662306a36Sopenharmony_ci * Return: The corresponding channel, or 0 if the conversion failed.
621762306a36Sopenharmony_ci */
621862306a36Sopenharmony_cistatic inline int
621962306a36Sopenharmony_ciieee80211_frequency_to_channel(int freq)
622062306a36Sopenharmony_ci{
622162306a36Sopenharmony_ci	return ieee80211_freq_khz_to_channel(MHZ_TO_KHZ(freq));
622262306a36Sopenharmony_ci}
622362306a36Sopenharmony_ci
622462306a36Sopenharmony_ci/**
622562306a36Sopenharmony_ci * ieee80211_get_channel_khz - get channel struct from wiphy for specified
622662306a36Sopenharmony_ci * frequency
622762306a36Sopenharmony_ci * @wiphy: the struct wiphy to get the channel for
622862306a36Sopenharmony_ci * @freq: the center frequency (in KHz) of the channel
622962306a36Sopenharmony_ci * Return: The channel struct from @wiphy at @freq.
623062306a36Sopenharmony_ci */
623162306a36Sopenharmony_cistruct ieee80211_channel *
623262306a36Sopenharmony_ciieee80211_get_channel_khz(struct wiphy *wiphy, u32 freq);
623362306a36Sopenharmony_ci
623462306a36Sopenharmony_ci/**
623562306a36Sopenharmony_ci * ieee80211_get_channel - get channel struct from wiphy for specified frequency
623662306a36Sopenharmony_ci *
623762306a36Sopenharmony_ci * @wiphy: the struct wiphy to get the channel for
623862306a36Sopenharmony_ci * @freq: the center frequency (in MHz) of the channel
623962306a36Sopenharmony_ci * Return: The channel struct from @wiphy at @freq.
624062306a36Sopenharmony_ci */
624162306a36Sopenharmony_cistatic inline struct ieee80211_channel *
624262306a36Sopenharmony_ciieee80211_get_channel(struct wiphy *wiphy, int freq)
624362306a36Sopenharmony_ci{
624462306a36Sopenharmony_ci	return ieee80211_get_channel_khz(wiphy, MHZ_TO_KHZ(freq));
624562306a36Sopenharmony_ci}
624662306a36Sopenharmony_ci
624762306a36Sopenharmony_ci/**
624862306a36Sopenharmony_ci * cfg80211_channel_is_psc - Check if the channel is a 6 GHz PSC
624962306a36Sopenharmony_ci * @chan: control channel to check
625062306a36Sopenharmony_ci *
625162306a36Sopenharmony_ci * The Preferred Scanning Channels (PSC) are defined in
625262306a36Sopenharmony_ci * Draft IEEE P802.11ax/D5.0, 26.17.2.3.3
625362306a36Sopenharmony_ci */
625462306a36Sopenharmony_cistatic inline bool cfg80211_channel_is_psc(struct ieee80211_channel *chan)
625562306a36Sopenharmony_ci{
625662306a36Sopenharmony_ci	if (chan->band != NL80211_BAND_6GHZ)
625762306a36Sopenharmony_ci		return false;
625862306a36Sopenharmony_ci
625962306a36Sopenharmony_ci	return ieee80211_frequency_to_channel(chan->center_freq) % 16 == 5;
626062306a36Sopenharmony_ci}
626162306a36Sopenharmony_ci
626262306a36Sopenharmony_ci/**
626362306a36Sopenharmony_ci * ieee80211_get_response_rate - get basic rate for a given rate
626462306a36Sopenharmony_ci *
626562306a36Sopenharmony_ci * @sband: the band to look for rates in
626662306a36Sopenharmony_ci * @basic_rates: bitmap of basic rates
626762306a36Sopenharmony_ci * @bitrate: the bitrate for which to find the basic rate
626862306a36Sopenharmony_ci *
626962306a36Sopenharmony_ci * Return: The basic rate corresponding to a given bitrate, that
627062306a36Sopenharmony_ci * is the next lower bitrate contained in the basic rate map,
627162306a36Sopenharmony_ci * which is, for this function, given as a bitmap of indices of
627262306a36Sopenharmony_ci * rates in the band's bitrate table.
627362306a36Sopenharmony_ci */
627462306a36Sopenharmony_ciconst struct ieee80211_rate *
627562306a36Sopenharmony_ciieee80211_get_response_rate(struct ieee80211_supported_band *sband,
627662306a36Sopenharmony_ci			    u32 basic_rates, int bitrate);
627762306a36Sopenharmony_ci
627862306a36Sopenharmony_ci/**
627962306a36Sopenharmony_ci * ieee80211_mandatory_rates - get mandatory rates for a given band
628062306a36Sopenharmony_ci * @sband: the band to look for rates in
628162306a36Sopenharmony_ci * @scan_width: width of the control channel
628262306a36Sopenharmony_ci *
628362306a36Sopenharmony_ci * This function returns a bitmap of the mandatory rates for the given
628462306a36Sopenharmony_ci * band, bits are set according to the rate position in the bitrates array.
628562306a36Sopenharmony_ci */
628662306a36Sopenharmony_ciu32 ieee80211_mandatory_rates(struct ieee80211_supported_band *sband,
628762306a36Sopenharmony_ci			      enum nl80211_bss_scan_width scan_width);
628862306a36Sopenharmony_ci
628962306a36Sopenharmony_ci/*
629062306a36Sopenharmony_ci * Radiotap parsing functions -- for controlled injection support
629162306a36Sopenharmony_ci *
629262306a36Sopenharmony_ci * Implemented in net/wireless/radiotap.c
629362306a36Sopenharmony_ci * Documentation in Documentation/networking/radiotap-headers.rst
629462306a36Sopenharmony_ci */
629562306a36Sopenharmony_ci
629662306a36Sopenharmony_cistruct radiotap_align_size {
629762306a36Sopenharmony_ci	uint8_t align:4, size:4;
629862306a36Sopenharmony_ci};
629962306a36Sopenharmony_ci
630062306a36Sopenharmony_cistruct ieee80211_radiotap_namespace {
630162306a36Sopenharmony_ci	const struct radiotap_align_size *align_size;
630262306a36Sopenharmony_ci	int n_bits;
630362306a36Sopenharmony_ci	uint32_t oui;
630462306a36Sopenharmony_ci	uint8_t subns;
630562306a36Sopenharmony_ci};
630662306a36Sopenharmony_ci
630762306a36Sopenharmony_cistruct ieee80211_radiotap_vendor_namespaces {
630862306a36Sopenharmony_ci	const struct ieee80211_radiotap_namespace *ns;
630962306a36Sopenharmony_ci	int n_ns;
631062306a36Sopenharmony_ci};
631162306a36Sopenharmony_ci
631262306a36Sopenharmony_ci/**
631362306a36Sopenharmony_ci * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
631462306a36Sopenharmony_ci * @this_arg_index: index of current arg, valid after each successful call
631562306a36Sopenharmony_ci *	to ieee80211_radiotap_iterator_next()
631662306a36Sopenharmony_ci * @this_arg: pointer to current radiotap arg; it is valid after each
631762306a36Sopenharmony_ci *	call to ieee80211_radiotap_iterator_next() but also after
631862306a36Sopenharmony_ci *	ieee80211_radiotap_iterator_init() where it will point to
631962306a36Sopenharmony_ci *	the beginning of the actual data portion
632062306a36Sopenharmony_ci * @this_arg_size: length of the current arg, for convenience
632162306a36Sopenharmony_ci * @current_namespace: pointer to the current namespace definition
632262306a36Sopenharmony_ci *	(or internally %NULL if the current namespace is unknown)
632362306a36Sopenharmony_ci * @is_radiotap_ns: indicates whether the current namespace is the default
632462306a36Sopenharmony_ci *	radiotap namespace or not
632562306a36Sopenharmony_ci *
632662306a36Sopenharmony_ci * @_rtheader: pointer to the radiotap header we are walking through
632762306a36Sopenharmony_ci * @_max_length: length of radiotap header in cpu byte ordering
632862306a36Sopenharmony_ci * @_arg_index: next argument index
632962306a36Sopenharmony_ci * @_arg: next argument pointer
633062306a36Sopenharmony_ci * @_next_bitmap: internal pointer to next present u32
633162306a36Sopenharmony_ci * @_bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
633262306a36Sopenharmony_ci * @_vns: vendor namespace definitions
633362306a36Sopenharmony_ci * @_next_ns_data: beginning of the next namespace's data
633462306a36Sopenharmony_ci * @_reset_on_ext: internal; reset the arg index to 0 when going to the
633562306a36Sopenharmony_ci *	next bitmap word
633662306a36Sopenharmony_ci *
633762306a36Sopenharmony_ci * Describes the radiotap parser state. Fields prefixed with an underscore
633862306a36Sopenharmony_ci * must not be used by users of the parser, only by the parser internally.
633962306a36Sopenharmony_ci */
634062306a36Sopenharmony_ci
634162306a36Sopenharmony_cistruct ieee80211_radiotap_iterator {
634262306a36Sopenharmony_ci	struct ieee80211_radiotap_header *_rtheader;
634362306a36Sopenharmony_ci	const struct ieee80211_radiotap_vendor_namespaces *_vns;
634462306a36Sopenharmony_ci	const struct ieee80211_radiotap_namespace *current_namespace;
634562306a36Sopenharmony_ci
634662306a36Sopenharmony_ci	unsigned char *_arg, *_next_ns_data;
634762306a36Sopenharmony_ci	__le32 *_next_bitmap;
634862306a36Sopenharmony_ci
634962306a36Sopenharmony_ci	unsigned char *this_arg;
635062306a36Sopenharmony_ci	int this_arg_index;
635162306a36Sopenharmony_ci	int this_arg_size;
635262306a36Sopenharmony_ci
635362306a36Sopenharmony_ci	int is_radiotap_ns;
635462306a36Sopenharmony_ci
635562306a36Sopenharmony_ci	int _max_length;
635662306a36Sopenharmony_ci	int _arg_index;
635762306a36Sopenharmony_ci	uint32_t _bitmap_shifter;
635862306a36Sopenharmony_ci	int _reset_on_ext;
635962306a36Sopenharmony_ci};
636062306a36Sopenharmony_ci
636162306a36Sopenharmony_ciint
636262306a36Sopenharmony_ciieee80211_radiotap_iterator_init(struct ieee80211_radiotap_iterator *iterator,
636362306a36Sopenharmony_ci				 struct ieee80211_radiotap_header *radiotap_header,
636462306a36Sopenharmony_ci				 int max_length,
636562306a36Sopenharmony_ci				 const struct ieee80211_radiotap_vendor_namespaces *vns);
636662306a36Sopenharmony_ci
636762306a36Sopenharmony_ciint
636862306a36Sopenharmony_ciieee80211_radiotap_iterator_next(struct ieee80211_radiotap_iterator *iterator);
636962306a36Sopenharmony_ci
637062306a36Sopenharmony_ci
637162306a36Sopenharmony_ciextern const unsigned char rfc1042_header[6];
637262306a36Sopenharmony_ciextern const unsigned char bridge_tunnel_header[6];
637362306a36Sopenharmony_ci
637462306a36Sopenharmony_ci/**
637562306a36Sopenharmony_ci * ieee80211_get_hdrlen_from_skb - get header length from data
637662306a36Sopenharmony_ci *
637762306a36Sopenharmony_ci * @skb: the frame
637862306a36Sopenharmony_ci *
637962306a36Sopenharmony_ci * Given an skb with a raw 802.11 header at the data pointer this function
638062306a36Sopenharmony_ci * returns the 802.11 header length.
638162306a36Sopenharmony_ci *
638262306a36Sopenharmony_ci * Return: The 802.11 header length in bytes (not including encryption
638362306a36Sopenharmony_ci * headers). Or 0 if the data in the sk_buff is too short to contain a valid
638462306a36Sopenharmony_ci * 802.11 header.
638562306a36Sopenharmony_ci */
638662306a36Sopenharmony_ciunsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
638762306a36Sopenharmony_ci
638862306a36Sopenharmony_ci/**
638962306a36Sopenharmony_ci * ieee80211_hdrlen - get header length in bytes from frame control
639062306a36Sopenharmony_ci * @fc: frame control field in little-endian format
639162306a36Sopenharmony_ci * Return: The header length in bytes.
639262306a36Sopenharmony_ci */
639362306a36Sopenharmony_ciunsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
639462306a36Sopenharmony_ci
639562306a36Sopenharmony_ci/**
639662306a36Sopenharmony_ci * ieee80211_get_mesh_hdrlen - get mesh extension header length
639762306a36Sopenharmony_ci * @meshhdr: the mesh extension header, only the flags field
639862306a36Sopenharmony_ci *	(first byte) will be accessed
639962306a36Sopenharmony_ci * Return: The length of the extension header, which is always at
640062306a36Sopenharmony_ci * least 6 bytes and at most 18 if address 5 and 6 are present.
640162306a36Sopenharmony_ci */
640262306a36Sopenharmony_ciunsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
640362306a36Sopenharmony_ci
640462306a36Sopenharmony_ci/**
640562306a36Sopenharmony_ci * DOC: Data path helpers
640662306a36Sopenharmony_ci *
640762306a36Sopenharmony_ci * In addition to generic utilities, cfg80211 also offers
640862306a36Sopenharmony_ci * functions that help implement the data path for devices
640962306a36Sopenharmony_ci * that do not do the 802.11/802.3 conversion on the device.
641062306a36Sopenharmony_ci */
641162306a36Sopenharmony_ci
641262306a36Sopenharmony_ci/**
641362306a36Sopenharmony_ci * ieee80211_data_to_8023_exthdr - convert an 802.11 data frame to 802.3
641462306a36Sopenharmony_ci * @skb: the 802.11 data frame
641562306a36Sopenharmony_ci * @ehdr: pointer to a &struct ethhdr that will get the header, instead
641662306a36Sopenharmony_ci *	of it being pushed into the SKB
641762306a36Sopenharmony_ci * @addr: the device MAC address
641862306a36Sopenharmony_ci * @iftype: the virtual interface type
641962306a36Sopenharmony_ci * @data_offset: offset of payload after the 802.11 header
642062306a36Sopenharmony_ci * @is_amsdu: true if the 802.11 header is A-MSDU
642162306a36Sopenharmony_ci * Return: 0 on success. Non-zero on error.
642262306a36Sopenharmony_ci */
642362306a36Sopenharmony_ciint ieee80211_data_to_8023_exthdr(struct sk_buff *skb, struct ethhdr *ehdr,
642462306a36Sopenharmony_ci				  const u8 *addr, enum nl80211_iftype iftype,
642562306a36Sopenharmony_ci				  u8 data_offset, bool is_amsdu);
642662306a36Sopenharmony_ci
642762306a36Sopenharmony_ci/**
642862306a36Sopenharmony_ci * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3
642962306a36Sopenharmony_ci * @skb: the 802.11 data frame
643062306a36Sopenharmony_ci * @addr: the device MAC address
643162306a36Sopenharmony_ci * @iftype: the virtual interface type
643262306a36Sopenharmony_ci * Return: 0 on success. Non-zero on error.
643362306a36Sopenharmony_ci */
643462306a36Sopenharmony_cistatic inline int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
643562306a36Sopenharmony_ci					 enum nl80211_iftype iftype)
643662306a36Sopenharmony_ci{
643762306a36Sopenharmony_ci	return ieee80211_data_to_8023_exthdr(skb, NULL, addr, iftype, 0, false);
643862306a36Sopenharmony_ci}
643962306a36Sopenharmony_ci
644062306a36Sopenharmony_ci/**
644162306a36Sopenharmony_ci * ieee80211_is_valid_amsdu - check if subframe lengths of an A-MSDU are valid
644262306a36Sopenharmony_ci *
644362306a36Sopenharmony_ci * This is used to detect non-standard A-MSDU frames, e.g. the ones generated
644462306a36Sopenharmony_ci * by ath10k and ath11k, where the subframe length includes the length of the
644562306a36Sopenharmony_ci * mesh control field.
644662306a36Sopenharmony_ci *
644762306a36Sopenharmony_ci * @skb: The input A-MSDU frame without any headers.
644862306a36Sopenharmony_ci * @mesh_hdr: the type of mesh header to test
644962306a36Sopenharmony_ci *	0: non-mesh A-MSDU length field
645062306a36Sopenharmony_ci *	1: big-endian mesh A-MSDU length field
645162306a36Sopenharmony_ci *	2: little-endian mesh A-MSDU length field
645262306a36Sopenharmony_ci * Returns: true if subframe header lengths are valid for the @mesh_hdr mode
645362306a36Sopenharmony_ci */
645462306a36Sopenharmony_cibool ieee80211_is_valid_amsdu(struct sk_buff *skb, u8 mesh_hdr);
645562306a36Sopenharmony_ci
645662306a36Sopenharmony_ci/**
645762306a36Sopenharmony_ci * ieee80211_amsdu_to_8023s - decode an IEEE 802.11n A-MSDU frame
645862306a36Sopenharmony_ci *
645962306a36Sopenharmony_ci * Decode an IEEE 802.11 A-MSDU and convert it to a list of 802.3 frames.
646062306a36Sopenharmony_ci * The @list will be empty if the decode fails. The @skb must be fully
646162306a36Sopenharmony_ci * header-less before being passed in here; it is freed in this function.
646262306a36Sopenharmony_ci *
646362306a36Sopenharmony_ci * @skb: The input A-MSDU frame without any headers.
646462306a36Sopenharmony_ci * @list: The output list of 802.3 frames. It must be allocated and
646562306a36Sopenharmony_ci *	initialized by the caller.
646662306a36Sopenharmony_ci * @addr: The device MAC address.
646762306a36Sopenharmony_ci * @iftype: The device interface type.
646862306a36Sopenharmony_ci * @extra_headroom: The hardware extra headroom for SKBs in the @list.
646962306a36Sopenharmony_ci * @check_da: DA to check in the inner ethernet header, or NULL
647062306a36Sopenharmony_ci * @check_sa: SA to check in the inner ethernet header, or NULL
647162306a36Sopenharmony_ci * @mesh_control: see mesh_hdr in ieee80211_is_valid_amsdu
647262306a36Sopenharmony_ci */
647362306a36Sopenharmony_civoid ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list,
647462306a36Sopenharmony_ci			      const u8 *addr, enum nl80211_iftype iftype,
647562306a36Sopenharmony_ci			      const unsigned int extra_headroom,
647662306a36Sopenharmony_ci			      const u8 *check_da, const u8 *check_sa,
647762306a36Sopenharmony_ci			      u8 mesh_control);
647862306a36Sopenharmony_ci
647962306a36Sopenharmony_ci/**
648062306a36Sopenharmony_ci * ieee80211_get_8023_tunnel_proto - get RFC1042 or bridge tunnel encap protocol
648162306a36Sopenharmony_ci *
648262306a36Sopenharmony_ci * Check for RFC1042 or bridge tunnel header and fetch the encapsulated
648362306a36Sopenharmony_ci * protocol.
648462306a36Sopenharmony_ci *
648562306a36Sopenharmony_ci * @hdr: pointer to the MSDU payload
648662306a36Sopenharmony_ci * @proto: destination pointer to store the protocol
648762306a36Sopenharmony_ci * Return: true if encapsulation was found
648862306a36Sopenharmony_ci */
648962306a36Sopenharmony_cibool ieee80211_get_8023_tunnel_proto(const void *hdr, __be16 *proto);
649062306a36Sopenharmony_ci
649162306a36Sopenharmony_ci/**
649262306a36Sopenharmony_ci * ieee80211_strip_8023_mesh_hdr - strip mesh header from converted 802.3 frames
649362306a36Sopenharmony_ci *
649462306a36Sopenharmony_ci * Strip the mesh header, which was left in by ieee80211_data_to_8023 as part
649562306a36Sopenharmony_ci * of the MSDU data. Also move any source/destination addresses from the mesh
649662306a36Sopenharmony_ci * header to the ethernet header (if present).
649762306a36Sopenharmony_ci *
649862306a36Sopenharmony_ci * @skb: The 802.3 frame with embedded mesh header
649962306a36Sopenharmony_ci */
650062306a36Sopenharmony_ciint ieee80211_strip_8023_mesh_hdr(struct sk_buff *skb);
650162306a36Sopenharmony_ci
650262306a36Sopenharmony_ci/**
650362306a36Sopenharmony_ci * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame
650462306a36Sopenharmony_ci * @skb: the data frame
650562306a36Sopenharmony_ci * @qos_map: Interworking QoS mapping or %NULL if not in use
650662306a36Sopenharmony_ci * Return: The 802.1p/1d tag.
650762306a36Sopenharmony_ci */
650862306a36Sopenharmony_ciunsigned int cfg80211_classify8021d(struct sk_buff *skb,
650962306a36Sopenharmony_ci				    struct cfg80211_qos_map *qos_map);
651062306a36Sopenharmony_ci
651162306a36Sopenharmony_ci/**
651262306a36Sopenharmony_ci * cfg80211_find_elem_match - match information element and byte array in data
651362306a36Sopenharmony_ci *
651462306a36Sopenharmony_ci * @eid: element ID
651562306a36Sopenharmony_ci * @ies: data consisting of IEs
651662306a36Sopenharmony_ci * @len: length of data
651762306a36Sopenharmony_ci * @match: byte array to match
651862306a36Sopenharmony_ci * @match_len: number of bytes in the match array
651962306a36Sopenharmony_ci * @match_offset: offset in the IE data where the byte array should match.
652062306a36Sopenharmony_ci *	Note the difference to cfg80211_find_ie_match() which considers
652162306a36Sopenharmony_ci *	the offset to start from the element ID byte, but here we take
652262306a36Sopenharmony_ci *	the data portion instead.
652362306a36Sopenharmony_ci *
652462306a36Sopenharmony_ci * Return: %NULL if the element ID could not be found or if
652562306a36Sopenharmony_ci * the element is invalid (claims to be longer than the given
652662306a36Sopenharmony_ci * data) or if the byte array doesn't match; otherwise return the
652762306a36Sopenharmony_ci * requested element struct.
652862306a36Sopenharmony_ci *
652962306a36Sopenharmony_ci * Note: There are no checks on the element length other than
653062306a36Sopenharmony_ci * having to fit into the given data and being large enough for the
653162306a36Sopenharmony_ci * byte array to match.
653262306a36Sopenharmony_ci */
653362306a36Sopenharmony_ciconst struct element *
653462306a36Sopenharmony_cicfg80211_find_elem_match(u8 eid, const u8 *ies, unsigned int len,
653562306a36Sopenharmony_ci			 const u8 *match, unsigned int match_len,
653662306a36Sopenharmony_ci			 unsigned int match_offset);
653762306a36Sopenharmony_ci
653862306a36Sopenharmony_ci/**
653962306a36Sopenharmony_ci * cfg80211_find_ie_match - match information element and byte array in data
654062306a36Sopenharmony_ci *
654162306a36Sopenharmony_ci * @eid: element ID
654262306a36Sopenharmony_ci * @ies: data consisting of IEs
654362306a36Sopenharmony_ci * @len: length of data
654462306a36Sopenharmony_ci * @match: byte array to match
654562306a36Sopenharmony_ci * @match_len: number of bytes in the match array
654662306a36Sopenharmony_ci * @match_offset: offset in the IE where the byte array should match.
654762306a36Sopenharmony_ci *	If match_len is zero, this must also be set to zero.
654862306a36Sopenharmony_ci *	Otherwise this must be set to 2 or more, because the first
654962306a36Sopenharmony_ci *	byte is the element id, which is already compared to eid, and
655062306a36Sopenharmony_ci *	the second byte is the IE length.
655162306a36Sopenharmony_ci *
655262306a36Sopenharmony_ci * Return: %NULL if the element ID could not be found or if
655362306a36Sopenharmony_ci * the element is invalid (claims to be longer than the given
655462306a36Sopenharmony_ci * data) or if the byte array doesn't match, or a pointer to the first
655562306a36Sopenharmony_ci * byte of the requested element, that is the byte containing the
655662306a36Sopenharmony_ci * element ID.
655762306a36Sopenharmony_ci *
655862306a36Sopenharmony_ci * Note: There are no checks on the element length other than
655962306a36Sopenharmony_ci * having to fit into the given data and being large enough for the
656062306a36Sopenharmony_ci * byte array to match.
656162306a36Sopenharmony_ci */
656262306a36Sopenharmony_cistatic inline const u8 *
656362306a36Sopenharmony_cicfg80211_find_ie_match(u8 eid, const u8 *ies, unsigned int len,
656462306a36Sopenharmony_ci		       const u8 *match, unsigned int match_len,
656562306a36Sopenharmony_ci		       unsigned int match_offset)
656662306a36Sopenharmony_ci{
656762306a36Sopenharmony_ci	/* match_offset can't be smaller than 2, unless match_len is
656862306a36Sopenharmony_ci	 * zero, in which case match_offset must be zero as well.
656962306a36Sopenharmony_ci	 */
657062306a36Sopenharmony_ci	if (WARN_ON((match_len && match_offset < 2) ||
657162306a36Sopenharmony_ci		    (!match_len && match_offset)))
657262306a36Sopenharmony_ci		return NULL;
657362306a36Sopenharmony_ci
657462306a36Sopenharmony_ci	return (const void *)cfg80211_find_elem_match(eid, ies, len,
657562306a36Sopenharmony_ci						      match, match_len,
657662306a36Sopenharmony_ci						      match_offset ?
657762306a36Sopenharmony_ci							match_offset - 2 : 0);
657862306a36Sopenharmony_ci}
657962306a36Sopenharmony_ci
658062306a36Sopenharmony_ci/**
658162306a36Sopenharmony_ci * cfg80211_find_elem - find information element in data
658262306a36Sopenharmony_ci *
658362306a36Sopenharmony_ci * @eid: element ID
658462306a36Sopenharmony_ci * @ies: data consisting of IEs
658562306a36Sopenharmony_ci * @len: length of data
658662306a36Sopenharmony_ci *
658762306a36Sopenharmony_ci * Return: %NULL if the element ID could not be found or if
658862306a36Sopenharmony_ci * the element is invalid (claims to be longer than the given
658962306a36Sopenharmony_ci * data) or if the byte array doesn't match; otherwise return the
659062306a36Sopenharmony_ci * requested element struct.
659162306a36Sopenharmony_ci *
659262306a36Sopenharmony_ci * Note: There are no checks on the element length other than
659362306a36Sopenharmony_ci * having to fit into the given data.
659462306a36Sopenharmony_ci */
659562306a36Sopenharmony_cistatic inline const struct element *
659662306a36Sopenharmony_cicfg80211_find_elem(u8 eid, const u8 *ies, int len)
659762306a36Sopenharmony_ci{
659862306a36Sopenharmony_ci	return cfg80211_find_elem_match(eid, ies, len, NULL, 0, 0);
659962306a36Sopenharmony_ci}
660062306a36Sopenharmony_ci
660162306a36Sopenharmony_ci/**
660262306a36Sopenharmony_ci * cfg80211_find_ie - find information element in data
660362306a36Sopenharmony_ci *
660462306a36Sopenharmony_ci * @eid: element ID
660562306a36Sopenharmony_ci * @ies: data consisting of IEs
660662306a36Sopenharmony_ci * @len: length of data
660762306a36Sopenharmony_ci *
660862306a36Sopenharmony_ci * Return: %NULL if the element ID could not be found or if
660962306a36Sopenharmony_ci * the element is invalid (claims to be longer than the given
661062306a36Sopenharmony_ci * data), or a pointer to the first byte of the requested
661162306a36Sopenharmony_ci * element, that is the byte containing the element ID.
661262306a36Sopenharmony_ci *
661362306a36Sopenharmony_ci * Note: There are no checks on the element length other than
661462306a36Sopenharmony_ci * having to fit into the given data.
661562306a36Sopenharmony_ci */
661662306a36Sopenharmony_cistatic inline const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
661762306a36Sopenharmony_ci{
661862306a36Sopenharmony_ci	return cfg80211_find_ie_match(eid, ies, len, NULL, 0, 0);
661962306a36Sopenharmony_ci}
662062306a36Sopenharmony_ci
662162306a36Sopenharmony_ci/**
662262306a36Sopenharmony_ci * cfg80211_find_ext_elem - find information element with EID Extension in data
662362306a36Sopenharmony_ci *
662462306a36Sopenharmony_ci * @ext_eid: element ID Extension
662562306a36Sopenharmony_ci * @ies: data consisting of IEs
662662306a36Sopenharmony_ci * @len: length of data
662762306a36Sopenharmony_ci *
662862306a36Sopenharmony_ci * Return: %NULL if the etended element could not be found or if
662962306a36Sopenharmony_ci * the element is invalid (claims to be longer than the given
663062306a36Sopenharmony_ci * data) or if the byte array doesn't match; otherwise return the
663162306a36Sopenharmony_ci * requested element struct.
663262306a36Sopenharmony_ci *
663362306a36Sopenharmony_ci * Note: There are no checks on the element length other than
663462306a36Sopenharmony_ci * having to fit into the given data.
663562306a36Sopenharmony_ci */
663662306a36Sopenharmony_cistatic inline const struct element *
663762306a36Sopenharmony_cicfg80211_find_ext_elem(u8 ext_eid, const u8 *ies, int len)
663862306a36Sopenharmony_ci{
663962306a36Sopenharmony_ci	return cfg80211_find_elem_match(WLAN_EID_EXTENSION, ies, len,
664062306a36Sopenharmony_ci					&ext_eid, 1, 0);
664162306a36Sopenharmony_ci}
664262306a36Sopenharmony_ci
664362306a36Sopenharmony_ci/**
664462306a36Sopenharmony_ci * cfg80211_find_ext_ie - find information element with EID Extension in data
664562306a36Sopenharmony_ci *
664662306a36Sopenharmony_ci * @ext_eid: element ID Extension
664762306a36Sopenharmony_ci * @ies: data consisting of IEs
664862306a36Sopenharmony_ci * @len: length of data
664962306a36Sopenharmony_ci *
665062306a36Sopenharmony_ci * Return: %NULL if the extended element ID could not be found or if
665162306a36Sopenharmony_ci * the element is invalid (claims to be longer than the given
665262306a36Sopenharmony_ci * data), or a pointer to the first byte of the requested
665362306a36Sopenharmony_ci * element, that is the byte containing the element ID.
665462306a36Sopenharmony_ci *
665562306a36Sopenharmony_ci * Note: There are no checks on the element length other than
665662306a36Sopenharmony_ci * having to fit into the given data.
665762306a36Sopenharmony_ci */
665862306a36Sopenharmony_cistatic inline const u8 *cfg80211_find_ext_ie(u8 ext_eid, const u8 *ies, int len)
665962306a36Sopenharmony_ci{
666062306a36Sopenharmony_ci	return cfg80211_find_ie_match(WLAN_EID_EXTENSION, ies, len,
666162306a36Sopenharmony_ci				      &ext_eid, 1, 2);
666262306a36Sopenharmony_ci}
666362306a36Sopenharmony_ci
666462306a36Sopenharmony_ci/**
666562306a36Sopenharmony_ci * cfg80211_find_vendor_elem - find vendor specific information element in data
666662306a36Sopenharmony_ci *
666762306a36Sopenharmony_ci * @oui: vendor OUI
666862306a36Sopenharmony_ci * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
666962306a36Sopenharmony_ci * @ies: data consisting of IEs
667062306a36Sopenharmony_ci * @len: length of data
667162306a36Sopenharmony_ci *
667262306a36Sopenharmony_ci * Return: %NULL if the vendor specific element ID could not be found or if the
667362306a36Sopenharmony_ci * element is invalid (claims to be longer than the given data); otherwise
667462306a36Sopenharmony_ci * return the element structure for the requested element.
667562306a36Sopenharmony_ci *
667662306a36Sopenharmony_ci * Note: There are no checks on the element length other than having to fit into
667762306a36Sopenharmony_ci * the given data.
667862306a36Sopenharmony_ci */
667962306a36Sopenharmony_ciconst struct element *cfg80211_find_vendor_elem(unsigned int oui, int oui_type,
668062306a36Sopenharmony_ci						const u8 *ies,
668162306a36Sopenharmony_ci						unsigned int len);
668262306a36Sopenharmony_ci
668362306a36Sopenharmony_ci/**
668462306a36Sopenharmony_ci * cfg80211_find_vendor_ie - find vendor specific information element in data
668562306a36Sopenharmony_ci *
668662306a36Sopenharmony_ci * @oui: vendor OUI
668762306a36Sopenharmony_ci * @oui_type: vendor-specific OUI type (must be < 0xff), negative means any
668862306a36Sopenharmony_ci * @ies: data consisting of IEs
668962306a36Sopenharmony_ci * @len: length of data
669062306a36Sopenharmony_ci *
669162306a36Sopenharmony_ci * Return: %NULL if the vendor specific element ID could not be found or if the
669262306a36Sopenharmony_ci * element is invalid (claims to be longer than the given data), or a pointer to
669362306a36Sopenharmony_ci * the first byte of the requested element, that is the byte containing the
669462306a36Sopenharmony_ci * element ID.
669562306a36Sopenharmony_ci *
669662306a36Sopenharmony_ci * Note: There are no checks on the element length other than having to fit into
669762306a36Sopenharmony_ci * the given data.
669862306a36Sopenharmony_ci */
669962306a36Sopenharmony_cistatic inline const u8 *
670062306a36Sopenharmony_cicfg80211_find_vendor_ie(unsigned int oui, int oui_type,
670162306a36Sopenharmony_ci			const u8 *ies, unsigned int len)
670262306a36Sopenharmony_ci{
670362306a36Sopenharmony_ci	return (const void *)cfg80211_find_vendor_elem(oui, oui_type, ies, len);
670462306a36Sopenharmony_ci}
670562306a36Sopenharmony_ci
670662306a36Sopenharmony_ci/**
670762306a36Sopenharmony_ci * cfg80211_defragment_element - Defrag the given element data into a buffer
670862306a36Sopenharmony_ci *
670962306a36Sopenharmony_ci * @elem: the element to defragment
671062306a36Sopenharmony_ci * @ies: elements where @elem is contained
671162306a36Sopenharmony_ci * @ieslen: length of @ies
671262306a36Sopenharmony_ci * @data: buffer to store element data
671362306a36Sopenharmony_ci * @data_len: length of @data
671462306a36Sopenharmony_ci * @frag_id: the element ID of fragments
671562306a36Sopenharmony_ci *
671662306a36Sopenharmony_ci * Return: length of @data, or -EINVAL on error
671762306a36Sopenharmony_ci *
671862306a36Sopenharmony_ci * Copy out all data from an element that may be fragmented into @data, while
671962306a36Sopenharmony_ci * skipping all headers.
672062306a36Sopenharmony_ci *
672162306a36Sopenharmony_ci * The function uses memmove() internally. It is acceptable to defragment an
672262306a36Sopenharmony_ci * element in-place.
672362306a36Sopenharmony_ci */
672462306a36Sopenharmony_cissize_t cfg80211_defragment_element(const struct element *elem, const u8 *ies,
672562306a36Sopenharmony_ci				    size_t ieslen, u8 *data, size_t data_len,
672662306a36Sopenharmony_ci				    u8 frag_id);
672762306a36Sopenharmony_ci
672862306a36Sopenharmony_ci/**
672962306a36Sopenharmony_ci * cfg80211_send_layer2_update - send layer 2 update frame
673062306a36Sopenharmony_ci *
673162306a36Sopenharmony_ci * @dev: network device
673262306a36Sopenharmony_ci * @addr: STA MAC address
673362306a36Sopenharmony_ci *
673462306a36Sopenharmony_ci * Wireless drivers can use this function to update forwarding tables in bridge
673562306a36Sopenharmony_ci * devices upon STA association.
673662306a36Sopenharmony_ci */
673762306a36Sopenharmony_civoid cfg80211_send_layer2_update(struct net_device *dev, const u8 *addr);
673862306a36Sopenharmony_ci
673962306a36Sopenharmony_ci/**
674062306a36Sopenharmony_ci * DOC: Regulatory enforcement infrastructure
674162306a36Sopenharmony_ci *
674262306a36Sopenharmony_ci * TODO
674362306a36Sopenharmony_ci */
674462306a36Sopenharmony_ci
674562306a36Sopenharmony_ci/**
674662306a36Sopenharmony_ci * regulatory_hint - driver hint to the wireless core a regulatory domain
674762306a36Sopenharmony_ci * @wiphy: the wireless device giving the hint (used only for reporting
674862306a36Sopenharmony_ci *	conflicts)
674962306a36Sopenharmony_ci * @alpha2: the ISO/IEC 3166 alpha2 the driver claims its regulatory domain
675062306a36Sopenharmony_ci *	should be in. If @rd is set this should be NULL. Note that if you
675162306a36Sopenharmony_ci *	set this to NULL you should still set rd->alpha2 to some accepted
675262306a36Sopenharmony_ci *	alpha2.
675362306a36Sopenharmony_ci *
675462306a36Sopenharmony_ci * Wireless drivers can use this function to hint to the wireless core
675562306a36Sopenharmony_ci * what it believes should be the current regulatory domain by
675662306a36Sopenharmony_ci * giving it an ISO/IEC 3166 alpha2 country code it knows its regulatory
675762306a36Sopenharmony_ci * domain should be in or by providing a completely build regulatory domain.
675862306a36Sopenharmony_ci * If the driver provides an ISO/IEC 3166 alpha2 userspace will be queried
675962306a36Sopenharmony_ci * for a regulatory domain structure for the respective country.
676062306a36Sopenharmony_ci *
676162306a36Sopenharmony_ci * The wiphy must have been registered to cfg80211 prior to this call.
676262306a36Sopenharmony_ci * For cfg80211 drivers this means you must first use wiphy_register(),
676362306a36Sopenharmony_ci * for mac80211 drivers you must first use ieee80211_register_hw().
676462306a36Sopenharmony_ci *
676562306a36Sopenharmony_ci * Drivers should check the return value, its possible you can get
676662306a36Sopenharmony_ci * an -ENOMEM.
676762306a36Sopenharmony_ci *
676862306a36Sopenharmony_ci * Return: 0 on success. -ENOMEM.
676962306a36Sopenharmony_ci */
677062306a36Sopenharmony_ciint regulatory_hint(struct wiphy *wiphy, const char *alpha2);
677162306a36Sopenharmony_ci
677262306a36Sopenharmony_ci/**
677362306a36Sopenharmony_ci * regulatory_set_wiphy_regd - set regdom info for self managed drivers
677462306a36Sopenharmony_ci * @wiphy: the wireless device we want to process the regulatory domain on
677562306a36Sopenharmony_ci * @rd: the regulatory domain informatoin to use for this wiphy
677662306a36Sopenharmony_ci *
677762306a36Sopenharmony_ci * Set the regulatory domain information for self-managed wiphys, only they
677862306a36Sopenharmony_ci * may use this function. See %REGULATORY_WIPHY_SELF_MANAGED for more
677962306a36Sopenharmony_ci * information.
678062306a36Sopenharmony_ci *
678162306a36Sopenharmony_ci * Return: 0 on success. -EINVAL, -EPERM
678262306a36Sopenharmony_ci */
678362306a36Sopenharmony_ciint regulatory_set_wiphy_regd(struct wiphy *wiphy,
678462306a36Sopenharmony_ci			      struct ieee80211_regdomain *rd);
678562306a36Sopenharmony_ci
678662306a36Sopenharmony_ci/**
678762306a36Sopenharmony_ci * regulatory_set_wiphy_regd_sync - set regdom for self-managed drivers
678862306a36Sopenharmony_ci * @wiphy: the wireless device we want to process the regulatory domain on
678962306a36Sopenharmony_ci * @rd: the regulatory domain information to use for this wiphy
679062306a36Sopenharmony_ci *
679162306a36Sopenharmony_ci * This functions requires the RTNL and the wiphy mutex to be held and
679262306a36Sopenharmony_ci * applies the new regdomain synchronously to this wiphy. For more details
679362306a36Sopenharmony_ci * see regulatory_set_wiphy_regd().
679462306a36Sopenharmony_ci *
679562306a36Sopenharmony_ci * Return: 0 on success. -EINVAL, -EPERM
679662306a36Sopenharmony_ci */
679762306a36Sopenharmony_ciint regulatory_set_wiphy_regd_sync(struct wiphy *wiphy,
679862306a36Sopenharmony_ci				   struct ieee80211_regdomain *rd);
679962306a36Sopenharmony_ci
680062306a36Sopenharmony_ci/**
680162306a36Sopenharmony_ci * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
680262306a36Sopenharmony_ci * @wiphy: the wireless device we want to process the regulatory domain on
680362306a36Sopenharmony_ci * @regd: the custom regulatory domain to use for this wiphy
680462306a36Sopenharmony_ci *
680562306a36Sopenharmony_ci * Drivers can sometimes have custom regulatory domains which do not apply
680662306a36Sopenharmony_ci * to a specific country. Drivers can use this to apply such custom regulatory
680762306a36Sopenharmony_ci * domains. This routine must be called prior to wiphy registration. The
680862306a36Sopenharmony_ci * custom regulatory domain will be trusted completely and as such previous
680962306a36Sopenharmony_ci * default channel settings will be disregarded. If no rule is found for a
681062306a36Sopenharmony_ci * channel on the regulatory domain the channel will be disabled.
681162306a36Sopenharmony_ci * Drivers using this for a wiphy should also set the wiphy flag
681262306a36Sopenharmony_ci * REGULATORY_CUSTOM_REG or cfg80211 will set it for the wiphy
681362306a36Sopenharmony_ci * that called this helper.
681462306a36Sopenharmony_ci */
681562306a36Sopenharmony_civoid wiphy_apply_custom_regulatory(struct wiphy *wiphy,
681662306a36Sopenharmony_ci				   const struct ieee80211_regdomain *regd);
681762306a36Sopenharmony_ci
681862306a36Sopenharmony_ci/**
681962306a36Sopenharmony_ci * freq_reg_info - get regulatory information for the given frequency
682062306a36Sopenharmony_ci * @wiphy: the wiphy for which we want to process this rule for
682162306a36Sopenharmony_ci * @center_freq: Frequency in KHz for which we want regulatory information for
682262306a36Sopenharmony_ci *
682362306a36Sopenharmony_ci * Use this function to get the regulatory rule for a specific frequency on
682462306a36Sopenharmony_ci * a given wireless device. If the device has a specific regulatory domain
682562306a36Sopenharmony_ci * it wants to follow we respect that unless a country IE has been received
682662306a36Sopenharmony_ci * and processed already.
682762306a36Sopenharmony_ci *
682862306a36Sopenharmony_ci * Return: A valid pointer, or, when an error occurs, for example if no rule
682962306a36Sopenharmony_ci * can be found, the return value is encoded using ERR_PTR(). Use IS_ERR() to
683062306a36Sopenharmony_ci * check and PTR_ERR() to obtain the numeric return value. The numeric return
683162306a36Sopenharmony_ci * value will be -ERANGE if we determine the given center_freq does not even
683262306a36Sopenharmony_ci * have a regulatory rule for a frequency range in the center_freq's band.
683362306a36Sopenharmony_ci * See freq_in_rule_band() for our current definition of a band -- this is
683462306a36Sopenharmony_ci * purely subjective and right now it's 802.11 specific.
683562306a36Sopenharmony_ci */
683662306a36Sopenharmony_ciconst struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
683762306a36Sopenharmony_ci					       u32 center_freq);
683862306a36Sopenharmony_ci
683962306a36Sopenharmony_ci/**
684062306a36Sopenharmony_ci * reg_initiator_name - map regulatory request initiator enum to name
684162306a36Sopenharmony_ci * @initiator: the regulatory request initiator
684262306a36Sopenharmony_ci *
684362306a36Sopenharmony_ci * You can use this to map the regulatory request initiator enum to a
684462306a36Sopenharmony_ci * proper string representation.
684562306a36Sopenharmony_ci */
684662306a36Sopenharmony_ciconst char *reg_initiator_name(enum nl80211_reg_initiator initiator);
684762306a36Sopenharmony_ci
684862306a36Sopenharmony_ci/**
684962306a36Sopenharmony_ci * regulatory_pre_cac_allowed - check if pre-CAC allowed in the current regdom
685062306a36Sopenharmony_ci * @wiphy: wiphy for which pre-CAC capability is checked.
685162306a36Sopenharmony_ci *
685262306a36Sopenharmony_ci * Pre-CAC is allowed only in some regdomains (notable ETSI).
685362306a36Sopenharmony_ci */
685462306a36Sopenharmony_cibool regulatory_pre_cac_allowed(struct wiphy *wiphy);
685562306a36Sopenharmony_ci
685662306a36Sopenharmony_ci/**
685762306a36Sopenharmony_ci * DOC: Internal regulatory db functions
685862306a36Sopenharmony_ci *
685962306a36Sopenharmony_ci */
686062306a36Sopenharmony_ci
686162306a36Sopenharmony_ci/**
686262306a36Sopenharmony_ci * reg_query_regdb_wmm -  Query internal regulatory db for wmm rule
686362306a36Sopenharmony_ci * Regulatory self-managed driver can use it to proactively
686462306a36Sopenharmony_ci *
686562306a36Sopenharmony_ci * @alpha2: the ISO/IEC 3166 alpha2 wmm rule to be queried.
686662306a36Sopenharmony_ci * @freq: the freqency(in MHz) to be queried.
686762306a36Sopenharmony_ci * @rule: pointer to store the wmm rule from the regulatory db.
686862306a36Sopenharmony_ci *
686962306a36Sopenharmony_ci * Self-managed wireless drivers can use this function to  query
687062306a36Sopenharmony_ci * the internal regulatory database to check whether the given
687162306a36Sopenharmony_ci * ISO/IEC 3166 alpha2 country and freq have wmm rule limitations.
687262306a36Sopenharmony_ci *
687362306a36Sopenharmony_ci * Drivers should check the return value, its possible you can get
687462306a36Sopenharmony_ci * an -ENODATA.
687562306a36Sopenharmony_ci *
687662306a36Sopenharmony_ci * Return: 0 on success. -ENODATA.
687762306a36Sopenharmony_ci */
687862306a36Sopenharmony_ciint reg_query_regdb_wmm(char *alpha2, int freq,
687962306a36Sopenharmony_ci			struct ieee80211_reg_rule *rule);
688062306a36Sopenharmony_ci
688162306a36Sopenharmony_ci/*
688262306a36Sopenharmony_ci * callbacks for asynchronous cfg80211 methods, notification
688362306a36Sopenharmony_ci * functions and BSS handling helpers
688462306a36Sopenharmony_ci */
688562306a36Sopenharmony_ci
688662306a36Sopenharmony_ci/**
688762306a36Sopenharmony_ci * cfg80211_scan_done - notify that scan finished
688862306a36Sopenharmony_ci *
688962306a36Sopenharmony_ci * @request: the corresponding scan request
689062306a36Sopenharmony_ci * @info: information about the completed scan
689162306a36Sopenharmony_ci */
689262306a36Sopenharmony_civoid cfg80211_scan_done(struct cfg80211_scan_request *request,
689362306a36Sopenharmony_ci			struct cfg80211_scan_info *info);
689462306a36Sopenharmony_ci
689562306a36Sopenharmony_ci/**
689662306a36Sopenharmony_ci * cfg80211_sched_scan_results - notify that new scan results are available
689762306a36Sopenharmony_ci *
689862306a36Sopenharmony_ci * @wiphy: the wiphy which got scheduled scan results
689962306a36Sopenharmony_ci * @reqid: identifier for the related scheduled scan request
690062306a36Sopenharmony_ci */
690162306a36Sopenharmony_civoid cfg80211_sched_scan_results(struct wiphy *wiphy, u64 reqid);
690262306a36Sopenharmony_ci
690362306a36Sopenharmony_ci/**
690462306a36Sopenharmony_ci * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped
690562306a36Sopenharmony_ci *
690662306a36Sopenharmony_ci * @wiphy: the wiphy on which the scheduled scan stopped
690762306a36Sopenharmony_ci * @reqid: identifier for the related scheduled scan request
690862306a36Sopenharmony_ci *
690962306a36Sopenharmony_ci * The driver can call this function to inform cfg80211 that the
691062306a36Sopenharmony_ci * scheduled scan had to be stopped, for whatever reason.  The driver
691162306a36Sopenharmony_ci * is then called back via the sched_scan_stop operation when done.
691262306a36Sopenharmony_ci */
691362306a36Sopenharmony_civoid cfg80211_sched_scan_stopped(struct wiphy *wiphy, u64 reqid);
691462306a36Sopenharmony_ci
691562306a36Sopenharmony_ci/**
691662306a36Sopenharmony_ci * cfg80211_sched_scan_stopped_locked - notify that the scheduled scan has stopped
691762306a36Sopenharmony_ci *
691862306a36Sopenharmony_ci * @wiphy: the wiphy on which the scheduled scan stopped
691962306a36Sopenharmony_ci * @reqid: identifier for the related scheduled scan request
692062306a36Sopenharmony_ci *
692162306a36Sopenharmony_ci * The driver can call this function to inform cfg80211 that the
692262306a36Sopenharmony_ci * scheduled scan had to be stopped, for whatever reason.  The driver
692362306a36Sopenharmony_ci * is then called back via the sched_scan_stop operation when done.
692462306a36Sopenharmony_ci * This function should be called with the wiphy mutex held.
692562306a36Sopenharmony_ci */
692662306a36Sopenharmony_civoid cfg80211_sched_scan_stopped_locked(struct wiphy *wiphy, u64 reqid);
692762306a36Sopenharmony_ci
692862306a36Sopenharmony_ci/**
692962306a36Sopenharmony_ci * cfg80211_inform_bss_frame_data - inform cfg80211 of a received BSS frame
693062306a36Sopenharmony_ci * @wiphy: the wiphy reporting the BSS
693162306a36Sopenharmony_ci * @data: the BSS metadata
693262306a36Sopenharmony_ci * @mgmt: the management frame (probe response or beacon)
693362306a36Sopenharmony_ci * @len: length of the management frame
693462306a36Sopenharmony_ci * @gfp: context flags
693562306a36Sopenharmony_ci *
693662306a36Sopenharmony_ci * This informs cfg80211 that BSS information was found and
693762306a36Sopenharmony_ci * the BSS should be updated/added.
693862306a36Sopenharmony_ci *
693962306a36Sopenharmony_ci * Return: A referenced struct, must be released with cfg80211_put_bss()!
694062306a36Sopenharmony_ci * Or %NULL on error.
694162306a36Sopenharmony_ci */
694262306a36Sopenharmony_cistruct cfg80211_bss * __must_check
694362306a36Sopenharmony_cicfg80211_inform_bss_frame_data(struct wiphy *wiphy,
694462306a36Sopenharmony_ci			       struct cfg80211_inform_bss *data,
694562306a36Sopenharmony_ci			       struct ieee80211_mgmt *mgmt, size_t len,
694662306a36Sopenharmony_ci			       gfp_t gfp);
694762306a36Sopenharmony_ci
694862306a36Sopenharmony_cistatic inline struct cfg80211_bss * __must_check
694962306a36Sopenharmony_cicfg80211_inform_bss_width_frame(struct wiphy *wiphy,
695062306a36Sopenharmony_ci				struct ieee80211_channel *rx_channel,
695162306a36Sopenharmony_ci				enum nl80211_bss_scan_width scan_width,
695262306a36Sopenharmony_ci				struct ieee80211_mgmt *mgmt, size_t len,
695362306a36Sopenharmony_ci				s32 signal, gfp_t gfp)
695462306a36Sopenharmony_ci{
695562306a36Sopenharmony_ci	struct cfg80211_inform_bss data = {
695662306a36Sopenharmony_ci		.chan = rx_channel,
695762306a36Sopenharmony_ci		.scan_width = scan_width,
695862306a36Sopenharmony_ci		.signal = signal,
695962306a36Sopenharmony_ci	};
696062306a36Sopenharmony_ci
696162306a36Sopenharmony_ci	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
696262306a36Sopenharmony_ci}
696362306a36Sopenharmony_ci
696462306a36Sopenharmony_cistatic inline struct cfg80211_bss * __must_check
696562306a36Sopenharmony_cicfg80211_inform_bss_frame(struct wiphy *wiphy,
696662306a36Sopenharmony_ci			  struct ieee80211_channel *rx_channel,
696762306a36Sopenharmony_ci			  struct ieee80211_mgmt *mgmt, size_t len,
696862306a36Sopenharmony_ci			  s32 signal, gfp_t gfp)
696962306a36Sopenharmony_ci{
697062306a36Sopenharmony_ci	struct cfg80211_inform_bss data = {
697162306a36Sopenharmony_ci		.chan = rx_channel,
697262306a36Sopenharmony_ci		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
697362306a36Sopenharmony_ci		.signal = signal,
697462306a36Sopenharmony_ci	};
697562306a36Sopenharmony_ci
697662306a36Sopenharmony_ci	return cfg80211_inform_bss_frame_data(wiphy, &data, mgmt, len, gfp);
697762306a36Sopenharmony_ci}
697862306a36Sopenharmony_ci
697962306a36Sopenharmony_ci/**
698062306a36Sopenharmony_ci * cfg80211_gen_new_bssid - generate a nontransmitted BSSID for multi-BSSID
698162306a36Sopenharmony_ci * @bssid: transmitter BSSID
698262306a36Sopenharmony_ci * @max_bssid: max BSSID indicator, taken from Multiple BSSID element
698362306a36Sopenharmony_ci * @mbssid_index: BSSID index, taken from Multiple BSSID index element
698462306a36Sopenharmony_ci * @new_bssid: calculated nontransmitted BSSID
698562306a36Sopenharmony_ci */
698662306a36Sopenharmony_cistatic inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
698762306a36Sopenharmony_ci					  u8 mbssid_index, u8 *new_bssid)
698862306a36Sopenharmony_ci{
698962306a36Sopenharmony_ci	u64 bssid_u64 = ether_addr_to_u64(bssid);
699062306a36Sopenharmony_ci	u64 mask = GENMASK_ULL(max_bssid - 1, 0);
699162306a36Sopenharmony_ci	u64 new_bssid_u64;
699262306a36Sopenharmony_ci
699362306a36Sopenharmony_ci	new_bssid_u64 = bssid_u64 & ~mask;
699462306a36Sopenharmony_ci
699562306a36Sopenharmony_ci	new_bssid_u64 |= ((bssid_u64 & mask) + mbssid_index) & mask;
699662306a36Sopenharmony_ci
699762306a36Sopenharmony_ci	u64_to_ether_addr(new_bssid_u64, new_bssid);
699862306a36Sopenharmony_ci}
699962306a36Sopenharmony_ci
700062306a36Sopenharmony_ci/**
700162306a36Sopenharmony_ci * cfg80211_is_element_inherited - returns if element ID should be inherited
700262306a36Sopenharmony_ci * @element: element to check
700362306a36Sopenharmony_ci * @non_inherit_element: non inheritance element
700462306a36Sopenharmony_ci */
700562306a36Sopenharmony_cibool cfg80211_is_element_inherited(const struct element *element,
700662306a36Sopenharmony_ci				   const struct element *non_inherit_element);
700762306a36Sopenharmony_ci
700862306a36Sopenharmony_ci/**
700962306a36Sopenharmony_ci * cfg80211_merge_profile - merges a MBSSID profile if it is split between IEs
701062306a36Sopenharmony_ci * @ie: ies
701162306a36Sopenharmony_ci * @ielen: length of IEs
701262306a36Sopenharmony_ci * @mbssid_elem: current MBSSID element
701362306a36Sopenharmony_ci * @sub_elem: current MBSSID subelement (profile)
701462306a36Sopenharmony_ci * @merged_ie: location of the merged profile
701562306a36Sopenharmony_ci * @max_copy_len: max merged profile length
701662306a36Sopenharmony_ci */
701762306a36Sopenharmony_cisize_t cfg80211_merge_profile(const u8 *ie, size_t ielen,
701862306a36Sopenharmony_ci			      const struct element *mbssid_elem,
701962306a36Sopenharmony_ci			      const struct element *sub_elem,
702062306a36Sopenharmony_ci			      u8 *merged_ie, size_t max_copy_len);
702162306a36Sopenharmony_ci
702262306a36Sopenharmony_ci/**
702362306a36Sopenharmony_ci * enum cfg80211_bss_frame_type - frame type that the BSS data came from
702462306a36Sopenharmony_ci * @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
702562306a36Sopenharmony_ci *	from a beacon or probe response
702662306a36Sopenharmony_ci * @CFG80211_BSS_FTYPE_BEACON: data comes from a beacon
702762306a36Sopenharmony_ci * @CFG80211_BSS_FTYPE_PRESP: data comes from a probe response
702862306a36Sopenharmony_ci */
702962306a36Sopenharmony_cienum cfg80211_bss_frame_type {
703062306a36Sopenharmony_ci	CFG80211_BSS_FTYPE_UNKNOWN,
703162306a36Sopenharmony_ci	CFG80211_BSS_FTYPE_BEACON,
703262306a36Sopenharmony_ci	CFG80211_BSS_FTYPE_PRESP,
703362306a36Sopenharmony_ci};
703462306a36Sopenharmony_ci
703562306a36Sopenharmony_ci/**
703662306a36Sopenharmony_ci * cfg80211_get_ies_channel_number - returns the channel number from ies
703762306a36Sopenharmony_ci * @ie: IEs
703862306a36Sopenharmony_ci * @ielen: length of IEs
703962306a36Sopenharmony_ci * @band: enum nl80211_band of the channel
704062306a36Sopenharmony_ci *
704162306a36Sopenharmony_ci * Returns the channel number, or -1 if none could be determined.
704262306a36Sopenharmony_ci */
704362306a36Sopenharmony_ciint cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
704462306a36Sopenharmony_ci				    enum nl80211_band band);
704562306a36Sopenharmony_ci
704662306a36Sopenharmony_ci/**
704762306a36Sopenharmony_ci * cfg80211_inform_bss_data - inform cfg80211 of a new BSS
704862306a36Sopenharmony_ci *
704962306a36Sopenharmony_ci * @wiphy: the wiphy reporting the BSS
705062306a36Sopenharmony_ci * @data: the BSS metadata
705162306a36Sopenharmony_ci * @ftype: frame type (if known)
705262306a36Sopenharmony_ci * @bssid: the BSSID of the BSS
705362306a36Sopenharmony_ci * @tsf: the TSF sent by the peer in the beacon/probe response (or 0)
705462306a36Sopenharmony_ci * @capability: the capability field sent by the peer
705562306a36Sopenharmony_ci * @beacon_interval: the beacon interval announced by the peer
705662306a36Sopenharmony_ci * @ie: additional IEs sent by the peer
705762306a36Sopenharmony_ci * @ielen: length of the additional IEs
705862306a36Sopenharmony_ci * @gfp: context flags
705962306a36Sopenharmony_ci *
706062306a36Sopenharmony_ci * This informs cfg80211 that BSS information was found and
706162306a36Sopenharmony_ci * the BSS should be updated/added.
706262306a36Sopenharmony_ci *
706362306a36Sopenharmony_ci * Return: A referenced struct, must be released with cfg80211_put_bss()!
706462306a36Sopenharmony_ci * Or %NULL on error.
706562306a36Sopenharmony_ci */
706662306a36Sopenharmony_cistruct cfg80211_bss * __must_check
706762306a36Sopenharmony_cicfg80211_inform_bss_data(struct wiphy *wiphy,
706862306a36Sopenharmony_ci			 struct cfg80211_inform_bss *data,
706962306a36Sopenharmony_ci			 enum cfg80211_bss_frame_type ftype,
707062306a36Sopenharmony_ci			 const u8 *bssid, u64 tsf, u16 capability,
707162306a36Sopenharmony_ci			 u16 beacon_interval, const u8 *ie, size_t ielen,
707262306a36Sopenharmony_ci			 gfp_t gfp);
707362306a36Sopenharmony_ci
707462306a36Sopenharmony_cistatic inline struct cfg80211_bss * __must_check
707562306a36Sopenharmony_cicfg80211_inform_bss_width(struct wiphy *wiphy,
707662306a36Sopenharmony_ci			  struct ieee80211_channel *rx_channel,
707762306a36Sopenharmony_ci			  enum nl80211_bss_scan_width scan_width,
707862306a36Sopenharmony_ci			  enum cfg80211_bss_frame_type ftype,
707962306a36Sopenharmony_ci			  const u8 *bssid, u64 tsf, u16 capability,
708062306a36Sopenharmony_ci			  u16 beacon_interval, const u8 *ie, size_t ielen,
708162306a36Sopenharmony_ci			  s32 signal, gfp_t gfp)
708262306a36Sopenharmony_ci{
708362306a36Sopenharmony_ci	struct cfg80211_inform_bss data = {
708462306a36Sopenharmony_ci		.chan = rx_channel,
708562306a36Sopenharmony_ci		.scan_width = scan_width,
708662306a36Sopenharmony_ci		.signal = signal,
708762306a36Sopenharmony_ci	};
708862306a36Sopenharmony_ci
708962306a36Sopenharmony_ci	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
709062306a36Sopenharmony_ci					capability, beacon_interval, ie, ielen,
709162306a36Sopenharmony_ci					gfp);
709262306a36Sopenharmony_ci}
709362306a36Sopenharmony_ci
709462306a36Sopenharmony_cistatic inline struct cfg80211_bss * __must_check
709562306a36Sopenharmony_cicfg80211_inform_bss(struct wiphy *wiphy,
709662306a36Sopenharmony_ci		    struct ieee80211_channel *rx_channel,
709762306a36Sopenharmony_ci		    enum cfg80211_bss_frame_type ftype,
709862306a36Sopenharmony_ci		    const u8 *bssid, u64 tsf, u16 capability,
709962306a36Sopenharmony_ci		    u16 beacon_interval, const u8 *ie, size_t ielen,
710062306a36Sopenharmony_ci		    s32 signal, gfp_t gfp)
710162306a36Sopenharmony_ci{
710262306a36Sopenharmony_ci	struct cfg80211_inform_bss data = {
710362306a36Sopenharmony_ci		.chan = rx_channel,
710462306a36Sopenharmony_ci		.scan_width = NL80211_BSS_CHAN_WIDTH_20,
710562306a36Sopenharmony_ci		.signal = signal,
710662306a36Sopenharmony_ci	};
710762306a36Sopenharmony_ci
710862306a36Sopenharmony_ci	return cfg80211_inform_bss_data(wiphy, &data, ftype, bssid, tsf,
710962306a36Sopenharmony_ci					capability, beacon_interval, ie, ielen,
711062306a36Sopenharmony_ci					gfp);
711162306a36Sopenharmony_ci}
711262306a36Sopenharmony_ci
711362306a36Sopenharmony_ci/**
711462306a36Sopenharmony_ci * cfg80211_get_bss - get a BSS reference
711562306a36Sopenharmony_ci * @wiphy: the wiphy this BSS struct belongs to
711662306a36Sopenharmony_ci * @channel: the channel to search on (or %NULL)
711762306a36Sopenharmony_ci * @bssid: the desired BSSID (or %NULL)
711862306a36Sopenharmony_ci * @ssid: the desired SSID (or %NULL)
711962306a36Sopenharmony_ci * @ssid_len: length of the SSID (or 0)
712062306a36Sopenharmony_ci * @bss_type: type of BSS, see &enum ieee80211_bss_type
712162306a36Sopenharmony_ci * @privacy: privacy filter, see &enum ieee80211_privacy
712262306a36Sopenharmony_ci */
712362306a36Sopenharmony_cistruct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
712462306a36Sopenharmony_ci				      struct ieee80211_channel *channel,
712562306a36Sopenharmony_ci				      const u8 *bssid,
712662306a36Sopenharmony_ci				      const u8 *ssid, size_t ssid_len,
712762306a36Sopenharmony_ci				      enum ieee80211_bss_type bss_type,
712862306a36Sopenharmony_ci				      enum ieee80211_privacy privacy);
712962306a36Sopenharmony_cistatic inline struct cfg80211_bss *
713062306a36Sopenharmony_cicfg80211_get_ibss(struct wiphy *wiphy,
713162306a36Sopenharmony_ci		  struct ieee80211_channel *channel,
713262306a36Sopenharmony_ci		  const u8 *ssid, size_t ssid_len)
713362306a36Sopenharmony_ci{
713462306a36Sopenharmony_ci	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
713562306a36Sopenharmony_ci				IEEE80211_BSS_TYPE_IBSS,
713662306a36Sopenharmony_ci				IEEE80211_PRIVACY_ANY);
713762306a36Sopenharmony_ci}
713862306a36Sopenharmony_ci
713962306a36Sopenharmony_ci/**
714062306a36Sopenharmony_ci * cfg80211_ref_bss - reference BSS struct
714162306a36Sopenharmony_ci * @wiphy: the wiphy this BSS struct belongs to
714262306a36Sopenharmony_ci * @bss: the BSS struct to reference
714362306a36Sopenharmony_ci *
714462306a36Sopenharmony_ci * Increments the refcount of the given BSS struct.
714562306a36Sopenharmony_ci */
714662306a36Sopenharmony_civoid cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
714762306a36Sopenharmony_ci
714862306a36Sopenharmony_ci/**
714962306a36Sopenharmony_ci * cfg80211_put_bss - unref BSS struct
715062306a36Sopenharmony_ci * @wiphy: the wiphy this BSS struct belongs to
715162306a36Sopenharmony_ci * @bss: the BSS struct
715262306a36Sopenharmony_ci *
715362306a36Sopenharmony_ci * Decrements the refcount of the given BSS struct.
715462306a36Sopenharmony_ci */
715562306a36Sopenharmony_civoid cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
715662306a36Sopenharmony_ci
715762306a36Sopenharmony_ci/**
715862306a36Sopenharmony_ci * cfg80211_unlink_bss - unlink BSS from internal data structures
715962306a36Sopenharmony_ci * @wiphy: the wiphy
716062306a36Sopenharmony_ci * @bss: the bss to remove
716162306a36Sopenharmony_ci *
716262306a36Sopenharmony_ci * This function removes the given BSS from the internal data structures
716362306a36Sopenharmony_ci * thereby making it no longer show up in scan results etc. Use this
716462306a36Sopenharmony_ci * function when you detect a BSS is gone. Normally BSSes will also time
716562306a36Sopenharmony_ci * out, so it is not necessary to use this function at all.
716662306a36Sopenharmony_ci */
716762306a36Sopenharmony_civoid cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
716862306a36Sopenharmony_ci
716962306a36Sopenharmony_ci/**
717062306a36Sopenharmony_ci * cfg80211_bss_iter - iterate all BSS entries
717162306a36Sopenharmony_ci *
717262306a36Sopenharmony_ci * This function iterates over the BSS entries associated with the given wiphy
717362306a36Sopenharmony_ci * and calls the callback for the iterated BSS. The iterator function is not
717462306a36Sopenharmony_ci * allowed to call functions that might modify the internal state of the BSS DB.
717562306a36Sopenharmony_ci *
717662306a36Sopenharmony_ci * @wiphy: the wiphy
717762306a36Sopenharmony_ci * @chandef: if given, the iterator function will be called only if the channel
717862306a36Sopenharmony_ci *     of the currently iterated BSS is a subset of the given channel.
717962306a36Sopenharmony_ci * @iter: the iterator function to call
718062306a36Sopenharmony_ci * @iter_data: an argument to the iterator function
718162306a36Sopenharmony_ci */
718262306a36Sopenharmony_civoid cfg80211_bss_iter(struct wiphy *wiphy,
718362306a36Sopenharmony_ci		       struct cfg80211_chan_def *chandef,
718462306a36Sopenharmony_ci		       void (*iter)(struct wiphy *wiphy,
718562306a36Sopenharmony_ci				    struct cfg80211_bss *bss,
718662306a36Sopenharmony_ci				    void *data),
718762306a36Sopenharmony_ci		       void *iter_data);
718862306a36Sopenharmony_ci
718962306a36Sopenharmony_cistatic inline enum nl80211_bss_scan_width
719062306a36Sopenharmony_cicfg80211_chandef_to_scan_width(const struct cfg80211_chan_def *chandef)
719162306a36Sopenharmony_ci{
719262306a36Sopenharmony_ci	switch (chandef->width) {
719362306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_5:
719462306a36Sopenharmony_ci		return NL80211_BSS_CHAN_WIDTH_5;
719562306a36Sopenharmony_ci	case NL80211_CHAN_WIDTH_10:
719662306a36Sopenharmony_ci		return NL80211_BSS_CHAN_WIDTH_10;
719762306a36Sopenharmony_ci	default:
719862306a36Sopenharmony_ci		return NL80211_BSS_CHAN_WIDTH_20;
719962306a36Sopenharmony_ci	}
720062306a36Sopenharmony_ci}
720162306a36Sopenharmony_ci
720262306a36Sopenharmony_ci/**
720362306a36Sopenharmony_ci * cfg80211_rx_mlme_mgmt - notification of processed MLME management frame
720462306a36Sopenharmony_ci * @dev: network device
720562306a36Sopenharmony_ci * @buf: authentication frame (header + body)
720662306a36Sopenharmony_ci * @len: length of the frame data
720762306a36Sopenharmony_ci *
720862306a36Sopenharmony_ci * This function is called whenever an authentication, disassociation or
720962306a36Sopenharmony_ci * deauthentication frame has been received and processed in station mode.
721062306a36Sopenharmony_ci * After being asked to authenticate via cfg80211_ops::auth() the driver must
721162306a36Sopenharmony_ci * call either this function or cfg80211_auth_timeout().
721262306a36Sopenharmony_ci * After being asked to associate via cfg80211_ops::assoc() the driver must
721362306a36Sopenharmony_ci * call either this function or cfg80211_auth_timeout().
721462306a36Sopenharmony_ci * While connected, the driver must calls this for received and processed
721562306a36Sopenharmony_ci * disassociation and deauthentication frames. If the frame couldn't be used
721662306a36Sopenharmony_ci * because it was unprotected, the driver must call the function
721762306a36Sopenharmony_ci * cfg80211_rx_unprot_mlme_mgmt() instead.
721862306a36Sopenharmony_ci *
721962306a36Sopenharmony_ci * This function may sleep. The caller must hold the corresponding wdev's mutex.
722062306a36Sopenharmony_ci */
722162306a36Sopenharmony_civoid cfg80211_rx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len);
722262306a36Sopenharmony_ci
722362306a36Sopenharmony_ci/**
722462306a36Sopenharmony_ci * cfg80211_auth_timeout - notification of timed out authentication
722562306a36Sopenharmony_ci * @dev: network device
722662306a36Sopenharmony_ci * @addr: The MAC address of the device with which the authentication timed out
722762306a36Sopenharmony_ci *
722862306a36Sopenharmony_ci * This function may sleep. The caller must hold the corresponding wdev's
722962306a36Sopenharmony_ci * mutex.
723062306a36Sopenharmony_ci */
723162306a36Sopenharmony_civoid cfg80211_auth_timeout(struct net_device *dev, const u8 *addr);
723262306a36Sopenharmony_ci
723362306a36Sopenharmony_ci/**
723462306a36Sopenharmony_ci * struct cfg80211_rx_assoc_resp - association response data
723562306a36Sopenharmony_ci * @bss: the BSS that association was requested with, ownership of the pointer
723662306a36Sopenharmony_ci *	moves to cfg80211 in the call to cfg80211_rx_assoc_resp()
723762306a36Sopenharmony_ci * @buf: (Re)Association Response frame (header + body)
723862306a36Sopenharmony_ci * @len: length of the frame data
723962306a36Sopenharmony_ci * @uapsd_queues: bitmap of queues configured for uapsd. Same format
724062306a36Sopenharmony_ci *	as the AC bitmap in the QoS info field
724162306a36Sopenharmony_ci * @req_ies: information elements from the (Re)Association Request frame
724262306a36Sopenharmony_ci * @req_ies_len: length of req_ies data
724362306a36Sopenharmony_ci * @ap_mld_addr: AP MLD address (in case of MLO)
724462306a36Sopenharmony_ci * @links: per-link information indexed by link ID, use links[0] for
724562306a36Sopenharmony_ci *	non-MLO connections
724662306a36Sopenharmony_ci * @links.status: Set this (along with a BSS pointer) for links that
724762306a36Sopenharmony_ci *	were rejected by the AP.
724862306a36Sopenharmony_ci */
724962306a36Sopenharmony_cistruct cfg80211_rx_assoc_resp {
725062306a36Sopenharmony_ci	const u8 *buf;
725162306a36Sopenharmony_ci	size_t len;
725262306a36Sopenharmony_ci	const u8 *req_ies;
725362306a36Sopenharmony_ci	size_t req_ies_len;
725462306a36Sopenharmony_ci	int uapsd_queues;
725562306a36Sopenharmony_ci	const u8 *ap_mld_addr;
725662306a36Sopenharmony_ci	struct {
725762306a36Sopenharmony_ci		u8 addr[ETH_ALEN] __aligned(2);
725862306a36Sopenharmony_ci		struct cfg80211_bss *bss;
725962306a36Sopenharmony_ci		u16 status;
726062306a36Sopenharmony_ci	} links[IEEE80211_MLD_MAX_NUM_LINKS];
726162306a36Sopenharmony_ci};
726262306a36Sopenharmony_ci
726362306a36Sopenharmony_ci/**
726462306a36Sopenharmony_ci * cfg80211_rx_assoc_resp - notification of processed association response
726562306a36Sopenharmony_ci * @dev: network device
726662306a36Sopenharmony_ci * @data: association response data, &struct cfg80211_rx_assoc_resp
726762306a36Sopenharmony_ci *
726862306a36Sopenharmony_ci * After being asked to associate via cfg80211_ops::assoc() the driver must
726962306a36Sopenharmony_ci * call either this function or cfg80211_auth_timeout().
727062306a36Sopenharmony_ci *
727162306a36Sopenharmony_ci * This function may sleep. The caller must hold the corresponding wdev's mutex.
727262306a36Sopenharmony_ci */
727362306a36Sopenharmony_civoid cfg80211_rx_assoc_resp(struct net_device *dev,
727462306a36Sopenharmony_ci			    struct cfg80211_rx_assoc_resp *data);
727562306a36Sopenharmony_ci
727662306a36Sopenharmony_ci/**
727762306a36Sopenharmony_ci * struct cfg80211_assoc_failure - association failure data
727862306a36Sopenharmony_ci * @ap_mld_addr: AP MLD address, or %NULL
727962306a36Sopenharmony_ci * @bss: list of BSSes, must use entry 0 for non-MLO connections
728062306a36Sopenharmony_ci *	(@ap_mld_addr is %NULL)
728162306a36Sopenharmony_ci * @timeout: indicates the association failed due to timeout, otherwise
728262306a36Sopenharmony_ci *	the association was abandoned for a reason reported through some
728362306a36Sopenharmony_ci *	other API (e.g. deauth RX)
728462306a36Sopenharmony_ci */
728562306a36Sopenharmony_cistruct cfg80211_assoc_failure {
728662306a36Sopenharmony_ci	const u8 *ap_mld_addr;
728762306a36Sopenharmony_ci	struct cfg80211_bss *bss[IEEE80211_MLD_MAX_NUM_LINKS];
728862306a36Sopenharmony_ci	bool timeout;
728962306a36Sopenharmony_ci};
729062306a36Sopenharmony_ci
729162306a36Sopenharmony_ci/**
729262306a36Sopenharmony_ci * cfg80211_assoc_failure - notification of association failure
729362306a36Sopenharmony_ci * @dev: network device
729462306a36Sopenharmony_ci * @data: data describing the association failure
729562306a36Sopenharmony_ci *
729662306a36Sopenharmony_ci * This function may sleep. The caller must hold the corresponding wdev's mutex.
729762306a36Sopenharmony_ci */
729862306a36Sopenharmony_civoid cfg80211_assoc_failure(struct net_device *dev,
729962306a36Sopenharmony_ci			    struct cfg80211_assoc_failure *data);
730062306a36Sopenharmony_ci
730162306a36Sopenharmony_ci/**
730262306a36Sopenharmony_ci * cfg80211_tx_mlme_mgmt - notification of transmitted deauth/disassoc frame
730362306a36Sopenharmony_ci * @dev: network device
730462306a36Sopenharmony_ci * @buf: 802.11 frame (header + body)
730562306a36Sopenharmony_ci * @len: length of the frame data
730662306a36Sopenharmony_ci * @reconnect: immediate reconnect is desired (include the nl80211 attribute)
730762306a36Sopenharmony_ci *
730862306a36Sopenharmony_ci * This function is called whenever deauthentication has been processed in
730962306a36Sopenharmony_ci * station mode. This includes both received deauthentication frames and
731062306a36Sopenharmony_ci * locally generated ones. This function may sleep. The caller must hold the
731162306a36Sopenharmony_ci * corresponding wdev's mutex.
731262306a36Sopenharmony_ci */
731362306a36Sopenharmony_civoid cfg80211_tx_mlme_mgmt(struct net_device *dev, const u8 *buf, size_t len,
731462306a36Sopenharmony_ci			   bool reconnect);
731562306a36Sopenharmony_ci
731662306a36Sopenharmony_ci/**
731762306a36Sopenharmony_ci * cfg80211_rx_unprot_mlme_mgmt - notification of unprotected mlme mgmt frame
731862306a36Sopenharmony_ci * @dev: network device
731962306a36Sopenharmony_ci * @buf: received management frame (header + body)
732062306a36Sopenharmony_ci * @len: length of the frame data
732162306a36Sopenharmony_ci *
732262306a36Sopenharmony_ci * This function is called whenever a received deauthentication or dissassoc
732362306a36Sopenharmony_ci * frame has been dropped in station mode because of MFP being used but the
732462306a36Sopenharmony_ci * frame was not protected. This is also used to notify reception of a Beacon
732562306a36Sopenharmony_ci * frame that was dropped because it did not include a valid MME MIC while
732662306a36Sopenharmony_ci * beacon protection was enabled (BIGTK configured in station mode).
732762306a36Sopenharmony_ci *
732862306a36Sopenharmony_ci * This function may sleep.
732962306a36Sopenharmony_ci */
733062306a36Sopenharmony_civoid cfg80211_rx_unprot_mlme_mgmt(struct net_device *dev,
733162306a36Sopenharmony_ci				  const u8 *buf, size_t len);
733262306a36Sopenharmony_ci
733362306a36Sopenharmony_ci/**
733462306a36Sopenharmony_ci * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
733562306a36Sopenharmony_ci * @dev: network device
733662306a36Sopenharmony_ci * @addr: The source MAC address of the frame
733762306a36Sopenharmony_ci * @key_type: The key type that the received frame used
733862306a36Sopenharmony_ci * @key_id: Key identifier (0..3). Can be -1 if missing.
733962306a36Sopenharmony_ci * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
734062306a36Sopenharmony_ci * @gfp: allocation flags
734162306a36Sopenharmony_ci *
734262306a36Sopenharmony_ci * This function is called whenever the local MAC detects a MIC failure in a
734362306a36Sopenharmony_ci * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
734462306a36Sopenharmony_ci * primitive.
734562306a36Sopenharmony_ci */
734662306a36Sopenharmony_civoid cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
734762306a36Sopenharmony_ci				  enum nl80211_key_type key_type, int key_id,
734862306a36Sopenharmony_ci				  const u8 *tsc, gfp_t gfp);
734962306a36Sopenharmony_ci
735062306a36Sopenharmony_ci/**
735162306a36Sopenharmony_ci * cfg80211_ibss_joined - notify cfg80211 that device joined an IBSS
735262306a36Sopenharmony_ci *
735362306a36Sopenharmony_ci * @dev: network device
735462306a36Sopenharmony_ci * @bssid: the BSSID of the IBSS joined
735562306a36Sopenharmony_ci * @channel: the channel of the IBSS joined
735662306a36Sopenharmony_ci * @gfp: allocation flags
735762306a36Sopenharmony_ci *
735862306a36Sopenharmony_ci * This function notifies cfg80211 that the device joined an IBSS or
735962306a36Sopenharmony_ci * switched to a different BSSID. Before this function can be called,
736062306a36Sopenharmony_ci * either a beacon has to have been received from the IBSS, or one of
736162306a36Sopenharmony_ci * the cfg80211_inform_bss{,_frame} functions must have been called
736262306a36Sopenharmony_ci * with the locally generated beacon -- this guarantees that there is
736362306a36Sopenharmony_ci * always a scan result for this IBSS. cfg80211 will handle the rest.
736462306a36Sopenharmony_ci */
736562306a36Sopenharmony_civoid cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid,
736662306a36Sopenharmony_ci			  struct ieee80211_channel *channel, gfp_t gfp);
736762306a36Sopenharmony_ci
736862306a36Sopenharmony_ci/**
736962306a36Sopenharmony_ci * cfg80211_notify_new_peer_candidate - notify cfg80211 of a new mesh peer
737062306a36Sopenharmony_ci * 					candidate
737162306a36Sopenharmony_ci *
737262306a36Sopenharmony_ci * @dev: network device
737362306a36Sopenharmony_ci * @macaddr: the MAC address of the new candidate
737462306a36Sopenharmony_ci * @ie: information elements advertised by the peer candidate
737562306a36Sopenharmony_ci * @ie_len: length of the information elements buffer
737662306a36Sopenharmony_ci * @sig_dbm: signal level in dBm
737762306a36Sopenharmony_ci * @gfp: allocation flags
737862306a36Sopenharmony_ci *
737962306a36Sopenharmony_ci * This function notifies cfg80211 that the mesh peer candidate has been
738062306a36Sopenharmony_ci * detected, most likely via a beacon or, less likely, via a probe response.
738162306a36Sopenharmony_ci * cfg80211 then sends a notification to userspace.
738262306a36Sopenharmony_ci */
738362306a36Sopenharmony_civoid cfg80211_notify_new_peer_candidate(struct net_device *dev,
738462306a36Sopenharmony_ci		const u8 *macaddr, const u8 *ie, u8 ie_len,
738562306a36Sopenharmony_ci		int sig_dbm, gfp_t gfp);
738662306a36Sopenharmony_ci
738762306a36Sopenharmony_ci/**
738862306a36Sopenharmony_ci * DOC: RFkill integration
738962306a36Sopenharmony_ci *
739062306a36Sopenharmony_ci * RFkill integration in cfg80211 is almost invisible to drivers,
739162306a36Sopenharmony_ci * as cfg80211 automatically registers an rfkill instance for each
739262306a36Sopenharmony_ci * wireless device it knows about. Soft kill is also translated
739362306a36Sopenharmony_ci * into disconnecting and turning all interfaces off, drivers are
739462306a36Sopenharmony_ci * expected to turn off the device when all interfaces are down.
739562306a36Sopenharmony_ci *
739662306a36Sopenharmony_ci * However, devices may have a hard RFkill line, in which case they
739762306a36Sopenharmony_ci * also need to interact with the rfkill subsystem, via cfg80211.
739862306a36Sopenharmony_ci * They can do this with a few helper functions documented here.
739962306a36Sopenharmony_ci */
740062306a36Sopenharmony_ci
740162306a36Sopenharmony_ci/**
740262306a36Sopenharmony_ci * wiphy_rfkill_set_hw_state_reason - notify cfg80211 about hw block state
740362306a36Sopenharmony_ci * @wiphy: the wiphy
740462306a36Sopenharmony_ci * @blocked: block status
740562306a36Sopenharmony_ci * @reason: one of reasons in &enum rfkill_hard_block_reasons
740662306a36Sopenharmony_ci */
740762306a36Sopenharmony_civoid wiphy_rfkill_set_hw_state_reason(struct wiphy *wiphy, bool blocked,
740862306a36Sopenharmony_ci				      enum rfkill_hard_block_reasons reason);
740962306a36Sopenharmony_ci
741062306a36Sopenharmony_cistatic inline void wiphy_rfkill_set_hw_state(struct wiphy *wiphy, bool blocked)
741162306a36Sopenharmony_ci{
741262306a36Sopenharmony_ci	wiphy_rfkill_set_hw_state_reason(wiphy, blocked,
741362306a36Sopenharmony_ci					 RFKILL_HARD_BLOCK_SIGNAL);
741462306a36Sopenharmony_ci}
741562306a36Sopenharmony_ci
741662306a36Sopenharmony_ci/**
741762306a36Sopenharmony_ci * wiphy_rfkill_start_polling - start polling rfkill
741862306a36Sopenharmony_ci * @wiphy: the wiphy
741962306a36Sopenharmony_ci */
742062306a36Sopenharmony_civoid wiphy_rfkill_start_polling(struct wiphy *wiphy);
742162306a36Sopenharmony_ci
742262306a36Sopenharmony_ci/**
742362306a36Sopenharmony_ci * wiphy_rfkill_stop_polling - stop polling rfkill
742462306a36Sopenharmony_ci * @wiphy: the wiphy
742562306a36Sopenharmony_ci */
742662306a36Sopenharmony_cistatic inline void wiphy_rfkill_stop_polling(struct wiphy *wiphy)
742762306a36Sopenharmony_ci{
742862306a36Sopenharmony_ci	rfkill_pause_polling(wiphy->rfkill);
742962306a36Sopenharmony_ci}
743062306a36Sopenharmony_ci
743162306a36Sopenharmony_ci/**
743262306a36Sopenharmony_ci * DOC: Vendor commands
743362306a36Sopenharmony_ci *
743462306a36Sopenharmony_ci * Occasionally, there are special protocol or firmware features that
743562306a36Sopenharmony_ci * can't be implemented very openly. For this and similar cases, the
743662306a36Sopenharmony_ci * vendor command functionality allows implementing the features with
743762306a36Sopenharmony_ci * (typically closed-source) userspace and firmware, using nl80211 as
743862306a36Sopenharmony_ci * the configuration mechanism.
743962306a36Sopenharmony_ci *
744062306a36Sopenharmony_ci * A driver supporting vendor commands must register them as an array
744162306a36Sopenharmony_ci * in struct wiphy, with handlers for each one, each command has an
744262306a36Sopenharmony_ci * OUI and sub command ID to identify it.
744362306a36Sopenharmony_ci *
744462306a36Sopenharmony_ci * Note that this feature should not be (ab)used to implement protocol
744562306a36Sopenharmony_ci * features that could openly be shared across drivers. In particular,
744662306a36Sopenharmony_ci * it must never be required to use vendor commands to implement any
744762306a36Sopenharmony_ci * "normal" functionality that higher-level userspace like connection
744862306a36Sopenharmony_ci * managers etc. need.
744962306a36Sopenharmony_ci */
745062306a36Sopenharmony_ci
745162306a36Sopenharmony_cistruct sk_buff *__cfg80211_alloc_reply_skb(struct wiphy *wiphy,
745262306a36Sopenharmony_ci					   enum nl80211_commands cmd,
745362306a36Sopenharmony_ci					   enum nl80211_attrs attr,
745462306a36Sopenharmony_ci					   int approxlen);
745562306a36Sopenharmony_ci
745662306a36Sopenharmony_cistruct sk_buff *__cfg80211_alloc_event_skb(struct wiphy *wiphy,
745762306a36Sopenharmony_ci					   struct wireless_dev *wdev,
745862306a36Sopenharmony_ci					   enum nl80211_commands cmd,
745962306a36Sopenharmony_ci					   enum nl80211_attrs attr,
746062306a36Sopenharmony_ci					   unsigned int portid,
746162306a36Sopenharmony_ci					   int vendor_event_idx,
746262306a36Sopenharmony_ci					   int approxlen, gfp_t gfp);
746362306a36Sopenharmony_ci
746462306a36Sopenharmony_civoid __cfg80211_send_event_skb(struct sk_buff *skb, gfp_t gfp);
746562306a36Sopenharmony_ci
746662306a36Sopenharmony_ci/**
746762306a36Sopenharmony_ci * cfg80211_vendor_cmd_alloc_reply_skb - allocate vendor command reply
746862306a36Sopenharmony_ci * @wiphy: the wiphy
746962306a36Sopenharmony_ci * @approxlen: an upper bound of the length of the data that will
747062306a36Sopenharmony_ci *	be put into the skb
747162306a36Sopenharmony_ci *
747262306a36Sopenharmony_ci * This function allocates and pre-fills an skb for a reply to
747362306a36Sopenharmony_ci * a vendor command. Since it is intended for a reply, calling
747462306a36Sopenharmony_ci * it outside of a vendor command's doit() operation is invalid.
747562306a36Sopenharmony_ci *
747662306a36Sopenharmony_ci * The returned skb is pre-filled with some identifying data in
747762306a36Sopenharmony_ci * a way that any data that is put into the skb (with skb_put(),
747862306a36Sopenharmony_ci * nla_put() or similar) will end up being within the
747962306a36Sopenharmony_ci * %NL80211_ATTR_VENDOR_DATA attribute, so all that needs to be done
748062306a36Sopenharmony_ci * with the skb is adding data for the corresponding userspace tool
748162306a36Sopenharmony_ci * which can then read that data out of the vendor data attribute.
748262306a36Sopenharmony_ci * You must not modify the skb in any other way.
748362306a36Sopenharmony_ci *
748462306a36Sopenharmony_ci * When done, call cfg80211_vendor_cmd_reply() with the skb and return
748562306a36Sopenharmony_ci * its error code as the result of the doit() operation.
748662306a36Sopenharmony_ci *
748762306a36Sopenharmony_ci * Return: An allocated and pre-filled skb. %NULL if any errors happen.
748862306a36Sopenharmony_ci */
748962306a36Sopenharmony_cistatic inline struct sk_buff *
749062306a36Sopenharmony_cicfg80211_vendor_cmd_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
749162306a36Sopenharmony_ci{
749262306a36Sopenharmony_ci	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_VENDOR,
749362306a36Sopenharmony_ci					  NL80211_ATTR_VENDOR_DATA, approxlen);
749462306a36Sopenharmony_ci}
749562306a36Sopenharmony_ci
749662306a36Sopenharmony_ci/**
749762306a36Sopenharmony_ci * cfg80211_vendor_cmd_reply - send the reply skb
749862306a36Sopenharmony_ci * @skb: The skb, must have been allocated with
749962306a36Sopenharmony_ci *	cfg80211_vendor_cmd_alloc_reply_skb()
750062306a36Sopenharmony_ci *
750162306a36Sopenharmony_ci * Since calling this function will usually be the last thing
750262306a36Sopenharmony_ci * before returning from the vendor command doit() you should
750362306a36Sopenharmony_ci * return the error code.  Note that this function consumes the
750462306a36Sopenharmony_ci * skb regardless of the return value.
750562306a36Sopenharmony_ci *
750662306a36Sopenharmony_ci * Return: An error code or 0 on success.
750762306a36Sopenharmony_ci */
750862306a36Sopenharmony_ciint cfg80211_vendor_cmd_reply(struct sk_buff *skb);
750962306a36Sopenharmony_ci
751062306a36Sopenharmony_ci/**
751162306a36Sopenharmony_ci * cfg80211_vendor_cmd_get_sender - get the current sender netlink ID
751262306a36Sopenharmony_ci * @wiphy: the wiphy
751362306a36Sopenharmony_ci *
751462306a36Sopenharmony_ci * Return the current netlink port ID in a vendor command handler.
751562306a36Sopenharmony_ci * Valid to call only there.
751662306a36Sopenharmony_ci */
751762306a36Sopenharmony_ciunsigned int cfg80211_vendor_cmd_get_sender(struct wiphy *wiphy);
751862306a36Sopenharmony_ci
751962306a36Sopenharmony_ci/**
752062306a36Sopenharmony_ci * cfg80211_vendor_event_alloc - allocate vendor-specific event skb
752162306a36Sopenharmony_ci * @wiphy: the wiphy
752262306a36Sopenharmony_ci * @wdev: the wireless device
752362306a36Sopenharmony_ci * @event_idx: index of the vendor event in the wiphy's vendor_events
752462306a36Sopenharmony_ci * @approxlen: an upper bound of the length of the data that will
752562306a36Sopenharmony_ci *	be put into the skb
752662306a36Sopenharmony_ci * @gfp: allocation flags
752762306a36Sopenharmony_ci *
752862306a36Sopenharmony_ci * This function allocates and pre-fills an skb for an event on the
752962306a36Sopenharmony_ci * vendor-specific multicast group.
753062306a36Sopenharmony_ci *
753162306a36Sopenharmony_ci * If wdev != NULL, both the ifindex and identifier of the specified
753262306a36Sopenharmony_ci * wireless device are added to the event message before the vendor data
753362306a36Sopenharmony_ci * attribute.
753462306a36Sopenharmony_ci *
753562306a36Sopenharmony_ci * When done filling the skb, call cfg80211_vendor_event() with the
753662306a36Sopenharmony_ci * skb to send the event.
753762306a36Sopenharmony_ci *
753862306a36Sopenharmony_ci * Return: An allocated and pre-filled skb. %NULL if any errors happen.
753962306a36Sopenharmony_ci */
754062306a36Sopenharmony_cistatic inline struct sk_buff *
754162306a36Sopenharmony_cicfg80211_vendor_event_alloc(struct wiphy *wiphy, struct wireless_dev *wdev,
754262306a36Sopenharmony_ci			     int approxlen, int event_idx, gfp_t gfp)
754362306a36Sopenharmony_ci{
754462306a36Sopenharmony_ci	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
754562306a36Sopenharmony_ci					  NL80211_ATTR_VENDOR_DATA,
754662306a36Sopenharmony_ci					  0, event_idx, approxlen, gfp);
754762306a36Sopenharmony_ci}
754862306a36Sopenharmony_ci
754962306a36Sopenharmony_ci/**
755062306a36Sopenharmony_ci * cfg80211_vendor_event_alloc_ucast - alloc unicast vendor-specific event skb
755162306a36Sopenharmony_ci * @wiphy: the wiphy
755262306a36Sopenharmony_ci * @wdev: the wireless device
755362306a36Sopenharmony_ci * @event_idx: index of the vendor event in the wiphy's vendor_events
755462306a36Sopenharmony_ci * @portid: port ID of the receiver
755562306a36Sopenharmony_ci * @approxlen: an upper bound of the length of the data that will
755662306a36Sopenharmony_ci *	be put into the skb
755762306a36Sopenharmony_ci * @gfp: allocation flags
755862306a36Sopenharmony_ci *
755962306a36Sopenharmony_ci * This function allocates and pre-fills an skb for an event to send to
756062306a36Sopenharmony_ci * a specific (userland) socket. This socket would previously have been
756162306a36Sopenharmony_ci * obtained by cfg80211_vendor_cmd_get_sender(), and the caller MUST take
756262306a36Sopenharmony_ci * care to register a netlink notifier to see when the socket closes.
756362306a36Sopenharmony_ci *
756462306a36Sopenharmony_ci * If wdev != NULL, both the ifindex and identifier of the specified
756562306a36Sopenharmony_ci * wireless device are added to the event message before the vendor data
756662306a36Sopenharmony_ci * attribute.
756762306a36Sopenharmony_ci *
756862306a36Sopenharmony_ci * When done filling the skb, call cfg80211_vendor_event() with the
756962306a36Sopenharmony_ci * skb to send the event.
757062306a36Sopenharmony_ci *
757162306a36Sopenharmony_ci * Return: An allocated and pre-filled skb. %NULL if any errors happen.
757262306a36Sopenharmony_ci */
757362306a36Sopenharmony_cistatic inline struct sk_buff *
757462306a36Sopenharmony_cicfg80211_vendor_event_alloc_ucast(struct wiphy *wiphy,
757562306a36Sopenharmony_ci				  struct wireless_dev *wdev,
757662306a36Sopenharmony_ci				  unsigned int portid, int approxlen,
757762306a36Sopenharmony_ci				  int event_idx, gfp_t gfp)
757862306a36Sopenharmony_ci{
757962306a36Sopenharmony_ci	return __cfg80211_alloc_event_skb(wiphy, wdev, NL80211_CMD_VENDOR,
758062306a36Sopenharmony_ci					  NL80211_ATTR_VENDOR_DATA,
758162306a36Sopenharmony_ci					  portid, event_idx, approxlen, gfp);
758262306a36Sopenharmony_ci}
758362306a36Sopenharmony_ci
758462306a36Sopenharmony_ci/**
758562306a36Sopenharmony_ci * cfg80211_vendor_event - send the event
758662306a36Sopenharmony_ci * @skb: The skb, must have been allocated with cfg80211_vendor_event_alloc()
758762306a36Sopenharmony_ci * @gfp: allocation flags
758862306a36Sopenharmony_ci *
758962306a36Sopenharmony_ci * This function sends the given @skb, which must have been allocated
759062306a36Sopenharmony_ci * by cfg80211_vendor_event_alloc(), as an event. It always consumes it.
759162306a36Sopenharmony_ci */
759262306a36Sopenharmony_cistatic inline void cfg80211_vendor_event(struct sk_buff *skb, gfp_t gfp)
759362306a36Sopenharmony_ci{
759462306a36Sopenharmony_ci	__cfg80211_send_event_skb(skb, gfp);
759562306a36Sopenharmony_ci}
759662306a36Sopenharmony_ci
759762306a36Sopenharmony_ci#ifdef CONFIG_NL80211_TESTMODE
759862306a36Sopenharmony_ci/**
759962306a36Sopenharmony_ci * DOC: Test mode
760062306a36Sopenharmony_ci *
760162306a36Sopenharmony_ci * Test mode is a set of utility functions to allow drivers to
760262306a36Sopenharmony_ci * interact with driver-specific tools to aid, for instance,
760362306a36Sopenharmony_ci * factory programming.
760462306a36Sopenharmony_ci *
760562306a36Sopenharmony_ci * This chapter describes how drivers interact with it, for more
760662306a36Sopenharmony_ci * information see the nl80211 book's chapter on it.
760762306a36Sopenharmony_ci */
760862306a36Sopenharmony_ci
760962306a36Sopenharmony_ci/**
761062306a36Sopenharmony_ci * cfg80211_testmode_alloc_reply_skb - allocate testmode reply
761162306a36Sopenharmony_ci * @wiphy: the wiphy
761262306a36Sopenharmony_ci * @approxlen: an upper bound of the length of the data that will
761362306a36Sopenharmony_ci *	be put into the skb
761462306a36Sopenharmony_ci *
761562306a36Sopenharmony_ci * This function allocates and pre-fills an skb for a reply to
761662306a36Sopenharmony_ci * the testmode command. Since it is intended for a reply, calling
761762306a36Sopenharmony_ci * it outside of the @testmode_cmd operation is invalid.
761862306a36Sopenharmony_ci *
761962306a36Sopenharmony_ci * The returned skb is pre-filled with the wiphy index and set up in
762062306a36Sopenharmony_ci * a way that any data that is put into the skb (with skb_put(),
762162306a36Sopenharmony_ci * nla_put() or similar) will end up being within the
762262306a36Sopenharmony_ci * %NL80211_ATTR_TESTDATA attribute, so all that needs to be done
762362306a36Sopenharmony_ci * with the skb is adding data for the corresponding userspace tool
762462306a36Sopenharmony_ci * which can then read that data out of the testdata attribute. You
762562306a36Sopenharmony_ci * must not modify the skb in any other way.
762662306a36Sopenharmony_ci *
762762306a36Sopenharmony_ci * When done, call cfg80211_testmode_reply() with the skb and return
762862306a36Sopenharmony_ci * its error code as the result of the @testmode_cmd operation.
762962306a36Sopenharmony_ci *
763062306a36Sopenharmony_ci * Return: An allocated and pre-filled skb. %NULL if any errors happen.
763162306a36Sopenharmony_ci */
763262306a36Sopenharmony_cistatic inline struct sk_buff *
763362306a36Sopenharmony_cicfg80211_testmode_alloc_reply_skb(struct wiphy *wiphy, int approxlen)
763462306a36Sopenharmony_ci{
763562306a36Sopenharmony_ci	return __cfg80211_alloc_reply_skb(wiphy, NL80211_CMD_TESTMODE,
763662306a36Sopenharmony_ci					  NL80211_ATTR_TESTDATA, approxlen);
763762306a36Sopenharmony_ci}
763862306a36Sopenharmony_ci
763962306a36Sopenharmony_ci/**
764062306a36Sopenharmony_ci * cfg80211_testmode_reply - send the reply skb
764162306a36Sopenharmony_ci * @skb: The skb, must have been allocated with
764262306a36Sopenharmony_ci *	cfg80211_testmode_alloc_reply_skb()
764362306a36Sopenharmony_ci *
764462306a36Sopenharmony_ci * Since calling this function will usually be the last thing
764562306a36Sopenharmony_ci * before returning from the @testmode_cmd you should return
764662306a36Sopenharmony_ci * the error code.  Note that this function consumes the skb
764762306a36Sopenharmony_ci * regardless of the return value.
764862306a36Sopenharmony_ci *
764962306a36Sopenharmony_ci * Return: An error code or 0 on success.
765062306a36Sopenharmony_ci */
765162306a36Sopenharmony_cistatic inline int cfg80211_testmode_reply(struct sk_buff *skb)
765262306a36Sopenharmony_ci{
765362306a36Sopenharmony_ci	return cfg80211_vendor_cmd_reply(skb);
765462306a36Sopenharmony_ci}
765562306a36Sopenharmony_ci
765662306a36Sopenharmony_ci/**
765762306a36Sopenharmony_ci * cfg80211_testmode_alloc_event_skb - allocate testmode event
765862306a36Sopenharmony_ci * @wiphy: the wiphy
765962306a36Sopenharmony_ci * @approxlen: an upper bound of the length of the data that will
766062306a36Sopenharmony_ci *	be put into the skb
766162306a36Sopenharmony_ci * @gfp: allocation flags
766262306a36Sopenharmony_ci *
766362306a36Sopenharmony_ci * This function allocates and pre-fills an skb for an event on the
766462306a36Sopenharmony_ci * testmode multicast group.
766562306a36Sopenharmony_ci *
766662306a36Sopenharmony_ci * The returned skb is set up in the same way as with
766762306a36Sopenharmony_ci * cfg80211_testmode_alloc_reply_skb() but prepared for an event. As
766862306a36Sopenharmony_ci * there, you should simply add data to it that will then end up in the
766962306a36Sopenharmony_ci * %NL80211_ATTR_TESTDATA attribute. Again, you must not modify the skb
767062306a36Sopenharmony_ci * in any other way.
767162306a36Sopenharmony_ci *
767262306a36Sopenharmony_ci * When done filling the skb, call cfg80211_testmode_event() with the
767362306a36Sopenharmony_ci * skb to send the event.
767462306a36Sopenharmony_ci *
767562306a36Sopenharmony_ci * Return: An allocated and pre-filled skb. %NULL if any errors happen.
767662306a36Sopenharmony_ci */
767762306a36Sopenharmony_cistatic inline struct sk_buff *
767862306a36Sopenharmony_cicfg80211_testmode_alloc_event_skb(struct wiphy *wiphy, int approxlen, gfp_t gfp)
767962306a36Sopenharmony_ci{
768062306a36Sopenharmony_ci	return __cfg80211_alloc_event_skb(wiphy, NULL, NL80211_CMD_TESTMODE,
768162306a36Sopenharmony_ci					  NL80211_ATTR_TESTDATA, 0, -1,
768262306a36Sopenharmony_ci					  approxlen, gfp);
768362306a36Sopenharmony_ci}
768462306a36Sopenharmony_ci
768562306a36Sopenharmony_ci/**
768662306a36Sopenharmony_ci * cfg80211_testmode_event - send the event
768762306a36Sopenharmony_ci * @skb: The skb, must have been allocated with
768862306a36Sopenharmony_ci *	cfg80211_testmode_alloc_event_skb()
768962306a36Sopenharmony_ci * @gfp: allocation flags
769062306a36Sopenharmony_ci *
769162306a36Sopenharmony_ci * This function sends the given @skb, which must have been allocated
769262306a36Sopenharmony_ci * by cfg80211_testmode_alloc_event_skb(), as an event. It always
769362306a36Sopenharmony_ci * consumes it.
769462306a36Sopenharmony_ci */
769562306a36Sopenharmony_cistatic inline void cfg80211_testmode_event(struct sk_buff *skb, gfp_t gfp)
769662306a36Sopenharmony_ci{
769762306a36Sopenharmony_ci	__cfg80211_send_event_skb(skb, gfp);
769862306a36Sopenharmony_ci}
769962306a36Sopenharmony_ci
770062306a36Sopenharmony_ci#define CFG80211_TESTMODE_CMD(cmd)	.testmode_cmd = (cmd),
770162306a36Sopenharmony_ci#define CFG80211_TESTMODE_DUMP(cmd)	.testmode_dump = (cmd),
770262306a36Sopenharmony_ci#else
770362306a36Sopenharmony_ci#define CFG80211_TESTMODE_CMD(cmd)
770462306a36Sopenharmony_ci#define CFG80211_TESTMODE_DUMP(cmd)
770562306a36Sopenharmony_ci#endif
770662306a36Sopenharmony_ci
770762306a36Sopenharmony_ci/**
770862306a36Sopenharmony_ci * struct cfg80211_fils_resp_params - FILS connection response params
770962306a36Sopenharmony_ci * @kek: KEK derived from a successful FILS connection (may be %NULL)
771062306a36Sopenharmony_ci * @kek_len: Length of @fils_kek in octets
771162306a36Sopenharmony_ci * @update_erp_next_seq_num: Boolean value to specify whether the value in
771262306a36Sopenharmony_ci *	@erp_next_seq_num is valid.
771362306a36Sopenharmony_ci * @erp_next_seq_num: The next sequence number to use in ERP message in
771462306a36Sopenharmony_ci *	FILS Authentication. This value should be specified irrespective of the
771562306a36Sopenharmony_ci *	status for a FILS connection.
771662306a36Sopenharmony_ci * @pmk: A new PMK if derived from a successful FILS connection (may be %NULL).
771762306a36Sopenharmony_ci * @pmk_len: Length of @pmk in octets
771862306a36Sopenharmony_ci * @pmkid: A new PMKID if derived from a successful FILS connection or the PMKID
771962306a36Sopenharmony_ci *	used for this FILS connection (may be %NULL).
772062306a36Sopenharmony_ci */
772162306a36Sopenharmony_cistruct cfg80211_fils_resp_params {
772262306a36Sopenharmony_ci	const u8 *kek;
772362306a36Sopenharmony_ci	size_t kek_len;
772462306a36Sopenharmony_ci	bool update_erp_next_seq_num;
772562306a36Sopenharmony_ci	u16 erp_next_seq_num;
772662306a36Sopenharmony_ci	const u8 *pmk;
772762306a36Sopenharmony_ci	size_t pmk_len;
772862306a36Sopenharmony_ci	const u8 *pmkid;
772962306a36Sopenharmony_ci};
773062306a36Sopenharmony_ci
773162306a36Sopenharmony_ci/**
773262306a36Sopenharmony_ci * struct cfg80211_connect_resp_params - Connection response params
773362306a36Sopenharmony_ci * @status: Status code, %WLAN_STATUS_SUCCESS for successful connection, use
773462306a36Sopenharmony_ci *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
773562306a36Sopenharmony_ci *	the real status code for failures. If this call is used to report a
773662306a36Sopenharmony_ci *	failure due to a timeout (e.g., not receiving an Authentication frame
773762306a36Sopenharmony_ci *	from the AP) instead of an explicit rejection by the AP, -1 is used to
773862306a36Sopenharmony_ci *	indicate that this is a failure, but without a status code.
773962306a36Sopenharmony_ci *	@timeout_reason is used to report the reason for the timeout in that
774062306a36Sopenharmony_ci *	case.
774162306a36Sopenharmony_ci * @req_ie: Association request IEs (may be %NULL)
774262306a36Sopenharmony_ci * @req_ie_len: Association request IEs length
774362306a36Sopenharmony_ci * @resp_ie: Association response IEs (may be %NULL)
774462306a36Sopenharmony_ci * @resp_ie_len: Association response IEs length
774562306a36Sopenharmony_ci * @fils: FILS connection response parameters.
774662306a36Sopenharmony_ci * @timeout_reason: Reason for connection timeout. This is used when the
774762306a36Sopenharmony_ci *	connection fails due to a timeout instead of an explicit rejection from
774862306a36Sopenharmony_ci *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
774962306a36Sopenharmony_ci *	not known. This value is used only if @status < 0 to indicate that the
775062306a36Sopenharmony_ci *	failure is due to a timeout and not due to explicit rejection by the AP.
775162306a36Sopenharmony_ci *	This value is ignored in other cases (@status >= 0).
775262306a36Sopenharmony_ci * @valid_links: For MLO connection, BIT mask of the valid link ids. Otherwise
775362306a36Sopenharmony_ci *	zero.
775462306a36Sopenharmony_ci * @ap_mld_addr: For MLO connection, MLD address of the AP. Otherwise %NULL.
775562306a36Sopenharmony_ci * @links : For MLO connection, contains link info for the valid links indicated
775662306a36Sopenharmony_ci *	using @valid_links. For non-MLO connection, links[0] contains the
775762306a36Sopenharmony_ci *	connected AP info.
775862306a36Sopenharmony_ci * @links.addr: For MLO connection, MAC address of the STA link. Otherwise
775962306a36Sopenharmony_ci *	%NULL.
776062306a36Sopenharmony_ci * @links.bssid: For MLO connection, MAC address of the AP link. For non-MLO
776162306a36Sopenharmony_ci *	connection, links[0].bssid points to the BSSID of the AP (may be %NULL).
776262306a36Sopenharmony_ci * @links.bss: For MLO connection, entry of bss to which STA link is connected.
776362306a36Sopenharmony_ci *	For non-MLO connection, links[0].bss points to entry of bss to which STA
776462306a36Sopenharmony_ci *	is connected. It can be obtained through cfg80211_get_bss() (may be
776562306a36Sopenharmony_ci *	%NULL). It is recommended to store the bss from the connect_request and
776662306a36Sopenharmony_ci *	hold a reference to it and return through this param to avoid a warning
776762306a36Sopenharmony_ci *	if the bss is expired during the connection, esp. for those drivers
776862306a36Sopenharmony_ci *	implementing connect op. Only one parameter among @bssid and @bss needs
776962306a36Sopenharmony_ci *	to be specified.
777062306a36Sopenharmony_ci * @links.status: per-link status code, to report a status code that's not
777162306a36Sopenharmony_ci *	%WLAN_STATUS_SUCCESS for a given link, it must also be in the
777262306a36Sopenharmony_ci *	@valid_links bitmap and may have a BSS pointer (which is then released)
777362306a36Sopenharmony_ci */
777462306a36Sopenharmony_cistruct cfg80211_connect_resp_params {
777562306a36Sopenharmony_ci	int status;
777662306a36Sopenharmony_ci	const u8 *req_ie;
777762306a36Sopenharmony_ci	size_t req_ie_len;
777862306a36Sopenharmony_ci	const u8 *resp_ie;
777962306a36Sopenharmony_ci	size_t resp_ie_len;
778062306a36Sopenharmony_ci	struct cfg80211_fils_resp_params fils;
778162306a36Sopenharmony_ci	enum nl80211_timeout_reason timeout_reason;
778262306a36Sopenharmony_ci
778362306a36Sopenharmony_ci	const u8 *ap_mld_addr;
778462306a36Sopenharmony_ci	u16 valid_links;
778562306a36Sopenharmony_ci	struct {
778662306a36Sopenharmony_ci		const u8 *addr;
778762306a36Sopenharmony_ci		const u8 *bssid;
778862306a36Sopenharmony_ci		struct cfg80211_bss *bss;
778962306a36Sopenharmony_ci		u16 status;
779062306a36Sopenharmony_ci	} links[IEEE80211_MLD_MAX_NUM_LINKS];
779162306a36Sopenharmony_ci};
779262306a36Sopenharmony_ci
779362306a36Sopenharmony_ci/**
779462306a36Sopenharmony_ci * cfg80211_connect_done - notify cfg80211 of connection result
779562306a36Sopenharmony_ci *
779662306a36Sopenharmony_ci * @dev: network device
779762306a36Sopenharmony_ci * @params: connection response parameters
779862306a36Sopenharmony_ci * @gfp: allocation flags
779962306a36Sopenharmony_ci *
780062306a36Sopenharmony_ci * It should be called by the underlying driver once execution of the connection
780162306a36Sopenharmony_ci * request from connect() has been completed. This is similar to
780262306a36Sopenharmony_ci * cfg80211_connect_bss(), but takes a structure pointer for connection response
780362306a36Sopenharmony_ci * parameters. Only one of the functions among cfg80211_connect_bss(),
780462306a36Sopenharmony_ci * cfg80211_connect_result(), cfg80211_connect_timeout(),
780562306a36Sopenharmony_ci * and cfg80211_connect_done() should be called.
780662306a36Sopenharmony_ci */
780762306a36Sopenharmony_civoid cfg80211_connect_done(struct net_device *dev,
780862306a36Sopenharmony_ci			   struct cfg80211_connect_resp_params *params,
780962306a36Sopenharmony_ci			   gfp_t gfp);
781062306a36Sopenharmony_ci
781162306a36Sopenharmony_ci/**
781262306a36Sopenharmony_ci * cfg80211_connect_bss - notify cfg80211 of connection result
781362306a36Sopenharmony_ci *
781462306a36Sopenharmony_ci * @dev: network device
781562306a36Sopenharmony_ci * @bssid: the BSSID of the AP
781662306a36Sopenharmony_ci * @bss: Entry of bss to which STA got connected to, can be obtained through
781762306a36Sopenharmony_ci *	cfg80211_get_bss() (may be %NULL). But it is recommended to store the
781862306a36Sopenharmony_ci *	bss from the connect_request and hold a reference to it and return
781962306a36Sopenharmony_ci *	through this param to avoid a warning if the bss is expired during the
782062306a36Sopenharmony_ci *	connection, esp. for those drivers implementing connect op.
782162306a36Sopenharmony_ci *	Only one parameter among @bssid and @bss needs to be specified.
782262306a36Sopenharmony_ci * @req_ie: association request IEs (maybe be %NULL)
782362306a36Sopenharmony_ci * @req_ie_len: association request IEs length
782462306a36Sopenharmony_ci * @resp_ie: association response IEs (may be %NULL)
782562306a36Sopenharmony_ci * @resp_ie_len: assoc response IEs length
782662306a36Sopenharmony_ci * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
782762306a36Sopenharmony_ci *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
782862306a36Sopenharmony_ci *	the real status code for failures. If this call is used to report a
782962306a36Sopenharmony_ci *	failure due to a timeout (e.g., not receiving an Authentication frame
783062306a36Sopenharmony_ci *	from the AP) instead of an explicit rejection by the AP, -1 is used to
783162306a36Sopenharmony_ci *	indicate that this is a failure, but without a status code.
783262306a36Sopenharmony_ci *	@timeout_reason is used to report the reason for the timeout in that
783362306a36Sopenharmony_ci *	case.
783462306a36Sopenharmony_ci * @gfp: allocation flags
783562306a36Sopenharmony_ci * @timeout_reason: reason for connection timeout. This is used when the
783662306a36Sopenharmony_ci *	connection fails due to a timeout instead of an explicit rejection from
783762306a36Sopenharmony_ci *	the AP. %NL80211_TIMEOUT_UNSPECIFIED is used when the timeout reason is
783862306a36Sopenharmony_ci *	not known. This value is used only if @status < 0 to indicate that the
783962306a36Sopenharmony_ci *	failure is due to a timeout and not due to explicit rejection by the AP.
784062306a36Sopenharmony_ci *	This value is ignored in other cases (@status >= 0).
784162306a36Sopenharmony_ci *
784262306a36Sopenharmony_ci * It should be called by the underlying driver once execution of the connection
784362306a36Sopenharmony_ci * request from connect() has been completed. This is similar to
784462306a36Sopenharmony_ci * cfg80211_connect_result(), but with the option of identifying the exact bss
784562306a36Sopenharmony_ci * entry for the connection. Only one of the functions among
784662306a36Sopenharmony_ci * cfg80211_connect_bss(), cfg80211_connect_result(),
784762306a36Sopenharmony_ci * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
784862306a36Sopenharmony_ci */
784962306a36Sopenharmony_cistatic inline void
785062306a36Sopenharmony_cicfg80211_connect_bss(struct net_device *dev, const u8 *bssid,
785162306a36Sopenharmony_ci		     struct cfg80211_bss *bss, const u8 *req_ie,
785262306a36Sopenharmony_ci		     size_t req_ie_len, const u8 *resp_ie,
785362306a36Sopenharmony_ci		     size_t resp_ie_len, int status, gfp_t gfp,
785462306a36Sopenharmony_ci		     enum nl80211_timeout_reason timeout_reason)
785562306a36Sopenharmony_ci{
785662306a36Sopenharmony_ci	struct cfg80211_connect_resp_params params;
785762306a36Sopenharmony_ci
785862306a36Sopenharmony_ci	memset(&params, 0, sizeof(params));
785962306a36Sopenharmony_ci	params.status = status;
786062306a36Sopenharmony_ci	params.links[0].bssid = bssid;
786162306a36Sopenharmony_ci	params.links[0].bss = bss;
786262306a36Sopenharmony_ci	params.req_ie = req_ie;
786362306a36Sopenharmony_ci	params.req_ie_len = req_ie_len;
786462306a36Sopenharmony_ci	params.resp_ie = resp_ie;
786562306a36Sopenharmony_ci	params.resp_ie_len = resp_ie_len;
786662306a36Sopenharmony_ci	params.timeout_reason = timeout_reason;
786762306a36Sopenharmony_ci
786862306a36Sopenharmony_ci	cfg80211_connect_done(dev, &params, gfp);
786962306a36Sopenharmony_ci}
787062306a36Sopenharmony_ci
787162306a36Sopenharmony_ci/**
787262306a36Sopenharmony_ci * cfg80211_connect_result - notify cfg80211 of connection result
787362306a36Sopenharmony_ci *
787462306a36Sopenharmony_ci * @dev: network device
787562306a36Sopenharmony_ci * @bssid: the BSSID of the AP
787662306a36Sopenharmony_ci * @req_ie: association request IEs (maybe be %NULL)
787762306a36Sopenharmony_ci * @req_ie_len: association request IEs length
787862306a36Sopenharmony_ci * @resp_ie: association response IEs (may be %NULL)
787962306a36Sopenharmony_ci * @resp_ie_len: assoc response IEs length
788062306a36Sopenharmony_ci * @status: status code, %WLAN_STATUS_SUCCESS for successful connection, use
788162306a36Sopenharmony_ci *	%WLAN_STATUS_UNSPECIFIED_FAILURE if your device cannot give you
788262306a36Sopenharmony_ci *	the real status code for failures.
788362306a36Sopenharmony_ci * @gfp: allocation flags
788462306a36Sopenharmony_ci *
788562306a36Sopenharmony_ci * It should be called by the underlying driver once execution of the connection
788662306a36Sopenharmony_ci * request from connect() has been completed. This is similar to
788762306a36Sopenharmony_ci * cfg80211_connect_bss() which allows the exact bss entry to be specified. Only
788862306a36Sopenharmony_ci * one of the functions among cfg80211_connect_bss(), cfg80211_connect_result(),
788962306a36Sopenharmony_ci * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
789062306a36Sopenharmony_ci */
789162306a36Sopenharmony_cistatic inline void
789262306a36Sopenharmony_cicfg80211_connect_result(struct net_device *dev, const u8 *bssid,
789362306a36Sopenharmony_ci			const u8 *req_ie, size_t req_ie_len,
789462306a36Sopenharmony_ci			const u8 *resp_ie, size_t resp_ie_len,
789562306a36Sopenharmony_ci			u16 status, gfp_t gfp)
789662306a36Sopenharmony_ci{
789762306a36Sopenharmony_ci	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, resp_ie,
789862306a36Sopenharmony_ci			     resp_ie_len, status, gfp,
789962306a36Sopenharmony_ci			     NL80211_TIMEOUT_UNSPECIFIED);
790062306a36Sopenharmony_ci}
790162306a36Sopenharmony_ci
790262306a36Sopenharmony_ci/**
790362306a36Sopenharmony_ci * cfg80211_connect_timeout - notify cfg80211 of connection timeout
790462306a36Sopenharmony_ci *
790562306a36Sopenharmony_ci * @dev: network device
790662306a36Sopenharmony_ci * @bssid: the BSSID of the AP
790762306a36Sopenharmony_ci * @req_ie: association request IEs (maybe be %NULL)
790862306a36Sopenharmony_ci * @req_ie_len: association request IEs length
790962306a36Sopenharmony_ci * @gfp: allocation flags
791062306a36Sopenharmony_ci * @timeout_reason: reason for connection timeout.
791162306a36Sopenharmony_ci *
791262306a36Sopenharmony_ci * It should be called by the underlying driver whenever connect() has failed
791362306a36Sopenharmony_ci * in a sequence where no explicit authentication/association rejection was
791462306a36Sopenharmony_ci * received from the AP. This could happen, e.g., due to not being able to send
791562306a36Sopenharmony_ci * out the Authentication or Association Request frame or timing out while
791662306a36Sopenharmony_ci * waiting for the response. Only one of the functions among
791762306a36Sopenharmony_ci * cfg80211_connect_bss(), cfg80211_connect_result(),
791862306a36Sopenharmony_ci * cfg80211_connect_timeout(), and cfg80211_connect_done() should be called.
791962306a36Sopenharmony_ci */
792062306a36Sopenharmony_cistatic inline void
792162306a36Sopenharmony_cicfg80211_connect_timeout(struct net_device *dev, const u8 *bssid,
792262306a36Sopenharmony_ci			 const u8 *req_ie, size_t req_ie_len, gfp_t gfp,
792362306a36Sopenharmony_ci			 enum nl80211_timeout_reason timeout_reason)
792462306a36Sopenharmony_ci{
792562306a36Sopenharmony_ci	cfg80211_connect_bss(dev, bssid, NULL, req_ie, req_ie_len, NULL, 0, -1,
792662306a36Sopenharmony_ci			     gfp, timeout_reason);
792762306a36Sopenharmony_ci}
792862306a36Sopenharmony_ci
792962306a36Sopenharmony_ci/**
793062306a36Sopenharmony_ci * struct cfg80211_roam_info - driver initiated roaming information
793162306a36Sopenharmony_ci *
793262306a36Sopenharmony_ci * @req_ie: association request IEs (maybe be %NULL)
793362306a36Sopenharmony_ci * @req_ie_len: association request IEs length
793462306a36Sopenharmony_ci * @resp_ie: association response IEs (may be %NULL)
793562306a36Sopenharmony_ci * @resp_ie_len: assoc response IEs length
793662306a36Sopenharmony_ci * @fils: FILS related roaming information.
793762306a36Sopenharmony_ci * @valid_links: For MLO roaming, BIT mask of the new valid links is set.
793862306a36Sopenharmony_ci *	Otherwise zero.
793962306a36Sopenharmony_ci * @ap_mld_addr: For MLO roaming, MLD address of the new AP. Otherwise %NULL.
794062306a36Sopenharmony_ci * @links : For MLO roaming, contains new link info for the valid links set in
794162306a36Sopenharmony_ci *	@valid_links. For non-MLO roaming, links[0] contains the new AP info.
794262306a36Sopenharmony_ci * @links.addr: For MLO roaming, MAC address of the STA link. Otherwise %NULL.
794362306a36Sopenharmony_ci * @links.bssid: For MLO roaming, MAC address of the new AP link. For non-MLO
794462306a36Sopenharmony_ci *	roaming, links[0].bssid points to the BSSID of the new AP. May be
794562306a36Sopenharmony_ci *	%NULL if %links.bss is set.
794662306a36Sopenharmony_ci * @links.channel: the channel of the new AP.
794762306a36Sopenharmony_ci * @links.bss: For MLO roaming, entry of new bss to which STA link got
794862306a36Sopenharmony_ci *	roamed. For non-MLO roaming, links[0].bss points to entry of bss to
794962306a36Sopenharmony_ci *	which STA got roamed (may be %NULL if %links.bssid is set)
795062306a36Sopenharmony_ci */
795162306a36Sopenharmony_cistruct cfg80211_roam_info {
795262306a36Sopenharmony_ci	const u8 *req_ie;
795362306a36Sopenharmony_ci	size_t req_ie_len;
795462306a36Sopenharmony_ci	const u8 *resp_ie;
795562306a36Sopenharmony_ci	size_t resp_ie_len;
795662306a36Sopenharmony_ci	struct cfg80211_fils_resp_params fils;
795762306a36Sopenharmony_ci
795862306a36Sopenharmony_ci	const u8 *ap_mld_addr;
795962306a36Sopenharmony_ci	u16 valid_links;
796062306a36Sopenharmony_ci	struct {
796162306a36Sopenharmony_ci		const u8 *addr;
796262306a36Sopenharmony_ci		const u8 *bssid;
796362306a36Sopenharmony_ci		struct ieee80211_channel *channel;
796462306a36Sopenharmony_ci		struct cfg80211_bss *bss;
796562306a36Sopenharmony_ci	} links[IEEE80211_MLD_MAX_NUM_LINKS];
796662306a36Sopenharmony_ci};
796762306a36Sopenharmony_ci
796862306a36Sopenharmony_ci/**
796962306a36Sopenharmony_ci * cfg80211_roamed - notify cfg80211 of roaming
797062306a36Sopenharmony_ci *
797162306a36Sopenharmony_ci * @dev: network device
797262306a36Sopenharmony_ci * @info: information about the new BSS. struct &cfg80211_roam_info.
797362306a36Sopenharmony_ci * @gfp: allocation flags
797462306a36Sopenharmony_ci *
797562306a36Sopenharmony_ci * This function may be called with the driver passing either the BSSID of the
797662306a36Sopenharmony_ci * new AP or passing the bss entry to avoid a race in timeout of the bss entry.
797762306a36Sopenharmony_ci * It should be called by the underlying driver whenever it roamed from one AP
797862306a36Sopenharmony_ci * to another while connected. Drivers which have roaming implemented in
797962306a36Sopenharmony_ci * firmware should pass the bss entry to avoid a race in bss entry timeout where
798062306a36Sopenharmony_ci * the bss entry of the new AP is seen in the driver, but gets timed out by the
798162306a36Sopenharmony_ci * time it is accessed in __cfg80211_roamed() due to delay in scheduling
798262306a36Sopenharmony_ci * rdev->event_work. In case of any failures, the reference is released
798362306a36Sopenharmony_ci * either in cfg80211_roamed() or in __cfg80211_romed(), Otherwise, it will be
798462306a36Sopenharmony_ci * released while disconnecting from the current bss.
798562306a36Sopenharmony_ci */
798662306a36Sopenharmony_civoid cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
798762306a36Sopenharmony_ci		     gfp_t gfp);
798862306a36Sopenharmony_ci
798962306a36Sopenharmony_ci/**
799062306a36Sopenharmony_ci * cfg80211_port_authorized - notify cfg80211 of successful security association
799162306a36Sopenharmony_ci *
799262306a36Sopenharmony_ci * @dev: network device
799362306a36Sopenharmony_ci * @bssid: the BSSID of the AP
799462306a36Sopenharmony_ci * @td_bitmap: transition disable policy
799562306a36Sopenharmony_ci * @td_bitmap_len: Length of transition disable policy
799662306a36Sopenharmony_ci * @gfp: allocation flags
799762306a36Sopenharmony_ci *
799862306a36Sopenharmony_ci * This function should be called by a driver that supports 4 way handshake
799962306a36Sopenharmony_ci * offload after a security association was successfully established (i.e.,
800062306a36Sopenharmony_ci * the 4 way handshake was completed successfully). The call to this function
800162306a36Sopenharmony_ci * should be preceded with a call to cfg80211_connect_result(),
800262306a36Sopenharmony_ci * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
800362306a36Sopenharmony_ci * indicate the 802.11 association.
800462306a36Sopenharmony_ci */
800562306a36Sopenharmony_civoid cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
800662306a36Sopenharmony_ci			      const u8* td_bitmap, u8 td_bitmap_len, gfp_t gfp);
800762306a36Sopenharmony_ci
800862306a36Sopenharmony_ci/**
800962306a36Sopenharmony_ci * cfg80211_disconnected - notify cfg80211 that connection was dropped
801062306a36Sopenharmony_ci *
801162306a36Sopenharmony_ci * @dev: network device
801262306a36Sopenharmony_ci * @ie: information elements of the deauth/disassoc frame (may be %NULL)
801362306a36Sopenharmony_ci * @ie_len: length of IEs
801462306a36Sopenharmony_ci * @reason: reason code for the disconnection, set it to 0 if unknown
801562306a36Sopenharmony_ci * @locally_generated: disconnection was requested locally
801662306a36Sopenharmony_ci * @gfp: allocation flags
801762306a36Sopenharmony_ci *
801862306a36Sopenharmony_ci * After it calls this function, the driver should enter an idle state
801962306a36Sopenharmony_ci * and not try to connect to any AP any more.
802062306a36Sopenharmony_ci */
802162306a36Sopenharmony_civoid cfg80211_disconnected(struct net_device *dev, u16 reason,
802262306a36Sopenharmony_ci			   const u8 *ie, size_t ie_len,
802362306a36Sopenharmony_ci			   bool locally_generated, gfp_t gfp);
802462306a36Sopenharmony_ci
802562306a36Sopenharmony_ci/**
802662306a36Sopenharmony_ci * cfg80211_ready_on_channel - notification of remain_on_channel start
802762306a36Sopenharmony_ci * @wdev: wireless device
802862306a36Sopenharmony_ci * @cookie: the request cookie
802962306a36Sopenharmony_ci * @chan: The current channel (from remain_on_channel request)
803062306a36Sopenharmony_ci * @duration: Duration in milliseconds that the driver intents to remain on the
803162306a36Sopenharmony_ci *	channel
803262306a36Sopenharmony_ci * @gfp: allocation flags
803362306a36Sopenharmony_ci */
803462306a36Sopenharmony_civoid cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
803562306a36Sopenharmony_ci			       struct ieee80211_channel *chan,
803662306a36Sopenharmony_ci			       unsigned int duration, gfp_t gfp);
803762306a36Sopenharmony_ci
803862306a36Sopenharmony_ci/**
803962306a36Sopenharmony_ci * cfg80211_remain_on_channel_expired - remain_on_channel duration expired
804062306a36Sopenharmony_ci * @wdev: wireless device
804162306a36Sopenharmony_ci * @cookie: the request cookie
804262306a36Sopenharmony_ci * @chan: The current channel (from remain_on_channel request)
804362306a36Sopenharmony_ci * @gfp: allocation flags
804462306a36Sopenharmony_ci */
804562306a36Sopenharmony_civoid cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
804662306a36Sopenharmony_ci					struct ieee80211_channel *chan,
804762306a36Sopenharmony_ci					gfp_t gfp);
804862306a36Sopenharmony_ci
804962306a36Sopenharmony_ci/**
805062306a36Sopenharmony_ci * cfg80211_tx_mgmt_expired - tx_mgmt duration expired
805162306a36Sopenharmony_ci * @wdev: wireless device
805262306a36Sopenharmony_ci * @cookie: the requested cookie
805362306a36Sopenharmony_ci * @chan: The current channel (from tx_mgmt request)
805462306a36Sopenharmony_ci * @gfp: allocation flags
805562306a36Sopenharmony_ci */
805662306a36Sopenharmony_civoid cfg80211_tx_mgmt_expired(struct wireless_dev *wdev, u64 cookie,
805762306a36Sopenharmony_ci			      struct ieee80211_channel *chan, gfp_t gfp);
805862306a36Sopenharmony_ci
805962306a36Sopenharmony_ci/**
806062306a36Sopenharmony_ci * cfg80211_sinfo_alloc_tid_stats - allocate per-tid statistics.
806162306a36Sopenharmony_ci *
806262306a36Sopenharmony_ci * @sinfo: the station information
806362306a36Sopenharmony_ci * @gfp: allocation flags
806462306a36Sopenharmony_ci */
806562306a36Sopenharmony_ciint cfg80211_sinfo_alloc_tid_stats(struct station_info *sinfo, gfp_t gfp);
806662306a36Sopenharmony_ci
806762306a36Sopenharmony_ci/**
806862306a36Sopenharmony_ci * cfg80211_sinfo_release_content - release contents of station info
806962306a36Sopenharmony_ci * @sinfo: the station information
807062306a36Sopenharmony_ci *
807162306a36Sopenharmony_ci * Releases any potentially allocated sub-information of the station
807262306a36Sopenharmony_ci * information, but not the struct itself (since it's typically on
807362306a36Sopenharmony_ci * the stack.)
807462306a36Sopenharmony_ci */
807562306a36Sopenharmony_cistatic inline void cfg80211_sinfo_release_content(struct station_info *sinfo)
807662306a36Sopenharmony_ci{
807762306a36Sopenharmony_ci	kfree(sinfo->pertid);
807862306a36Sopenharmony_ci}
807962306a36Sopenharmony_ci
808062306a36Sopenharmony_ci/**
808162306a36Sopenharmony_ci * cfg80211_new_sta - notify userspace about station
808262306a36Sopenharmony_ci *
808362306a36Sopenharmony_ci * @dev: the netdev
808462306a36Sopenharmony_ci * @mac_addr: the station's address
808562306a36Sopenharmony_ci * @sinfo: the station information
808662306a36Sopenharmony_ci * @gfp: allocation flags
808762306a36Sopenharmony_ci */
808862306a36Sopenharmony_civoid cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
808962306a36Sopenharmony_ci		      struct station_info *sinfo, gfp_t gfp);
809062306a36Sopenharmony_ci
809162306a36Sopenharmony_ci/**
809262306a36Sopenharmony_ci * cfg80211_del_sta_sinfo - notify userspace about deletion of a station
809362306a36Sopenharmony_ci * @dev: the netdev
809462306a36Sopenharmony_ci * @mac_addr: the station's address. For MLD station, MLD address is used.
809562306a36Sopenharmony_ci * @sinfo: the station information/statistics
809662306a36Sopenharmony_ci * @gfp: allocation flags
809762306a36Sopenharmony_ci */
809862306a36Sopenharmony_civoid cfg80211_del_sta_sinfo(struct net_device *dev, const u8 *mac_addr,
809962306a36Sopenharmony_ci			    struct station_info *sinfo, gfp_t gfp);
810062306a36Sopenharmony_ci
810162306a36Sopenharmony_ci/**
810262306a36Sopenharmony_ci * cfg80211_del_sta - notify userspace about deletion of a station
810362306a36Sopenharmony_ci *
810462306a36Sopenharmony_ci * @dev: the netdev
810562306a36Sopenharmony_ci * @mac_addr: the station's address. For MLD station, MLD address is used.
810662306a36Sopenharmony_ci * @gfp: allocation flags
810762306a36Sopenharmony_ci */
810862306a36Sopenharmony_cistatic inline void cfg80211_del_sta(struct net_device *dev,
810962306a36Sopenharmony_ci				    const u8 *mac_addr, gfp_t gfp)
811062306a36Sopenharmony_ci{
811162306a36Sopenharmony_ci	cfg80211_del_sta_sinfo(dev, mac_addr, NULL, gfp);
811262306a36Sopenharmony_ci}
811362306a36Sopenharmony_ci
811462306a36Sopenharmony_ci/**
811562306a36Sopenharmony_ci * cfg80211_conn_failed - connection request failed notification
811662306a36Sopenharmony_ci *
811762306a36Sopenharmony_ci * @dev: the netdev
811862306a36Sopenharmony_ci * @mac_addr: the station's address
811962306a36Sopenharmony_ci * @reason: the reason for connection failure
812062306a36Sopenharmony_ci * @gfp: allocation flags
812162306a36Sopenharmony_ci *
812262306a36Sopenharmony_ci * Whenever a station tries to connect to an AP and if the station
812362306a36Sopenharmony_ci * could not connect to the AP as the AP has rejected the connection
812462306a36Sopenharmony_ci * for some reasons, this function is called.
812562306a36Sopenharmony_ci *
812662306a36Sopenharmony_ci * The reason for connection failure can be any of the value from
812762306a36Sopenharmony_ci * nl80211_connect_failed_reason enum
812862306a36Sopenharmony_ci */
812962306a36Sopenharmony_civoid cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
813062306a36Sopenharmony_ci			  enum nl80211_connect_failed_reason reason,
813162306a36Sopenharmony_ci			  gfp_t gfp);
813262306a36Sopenharmony_ci
813362306a36Sopenharmony_ci/**
813462306a36Sopenharmony_ci * struct cfg80211_rx_info - received management frame info
813562306a36Sopenharmony_ci *
813662306a36Sopenharmony_ci * @freq: Frequency on which the frame was received in kHz
813762306a36Sopenharmony_ci * @sig_dbm: signal strength in dBm, or 0 if unknown
813862306a36Sopenharmony_ci * @have_link_id: indicates the frame was received on a link of
813962306a36Sopenharmony_ci *	an MLD, i.e. the @link_id field is valid
814062306a36Sopenharmony_ci * @link_id: the ID of the link the frame was received	on
814162306a36Sopenharmony_ci * @buf: Management frame (header + body)
814262306a36Sopenharmony_ci * @len: length of the frame data
814362306a36Sopenharmony_ci * @flags: flags, as defined in &enum nl80211_rxmgmt_flags
814462306a36Sopenharmony_ci * @rx_tstamp: Hardware timestamp of frame RX in nanoseconds
814562306a36Sopenharmony_ci * @ack_tstamp: Hardware timestamp of ack TX in nanoseconds
814662306a36Sopenharmony_ci */
814762306a36Sopenharmony_cistruct cfg80211_rx_info {
814862306a36Sopenharmony_ci	int freq;
814962306a36Sopenharmony_ci	int sig_dbm;
815062306a36Sopenharmony_ci	bool have_link_id;
815162306a36Sopenharmony_ci	u8 link_id;
815262306a36Sopenharmony_ci	const u8 *buf;
815362306a36Sopenharmony_ci	size_t len;
815462306a36Sopenharmony_ci	u32 flags;
815562306a36Sopenharmony_ci	u64 rx_tstamp;
815662306a36Sopenharmony_ci	u64 ack_tstamp;
815762306a36Sopenharmony_ci};
815862306a36Sopenharmony_ci
815962306a36Sopenharmony_ci/**
816062306a36Sopenharmony_ci * cfg80211_rx_mgmt_ext - management frame notification with extended info
816162306a36Sopenharmony_ci * @wdev: wireless device receiving the frame
816262306a36Sopenharmony_ci * @info: RX info as defined in struct cfg80211_rx_info
816362306a36Sopenharmony_ci *
816462306a36Sopenharmony_ci * This function is called whenever an Action frame is received for a station
816562306a36Sopenharmony_ci * mode interface, but is not processed in kernel.
816662306a36Sopenharmony_ci *
816762306a36Sopenharmony_ci * Return: %true if a user space application has registered for this frame.
816862306a36Sopenharmony_ci * For action frames, that makes it responsible for rejecting unrecognized
816962306a36Sopenharmony_ci * action frames; %false otherwise, in which case for action frames the
817062306a36Sopenharmony_ci * driver is responsible for rejecting the frame.
817162306a36Sopenharmony_ci */
817262306a36Sopenharmony_cibool cfg80211_rx_mgmt_ext(struct wireless_dev *wdev,
817362306a36Sopenharmony_ci			  struct cfg80211_rx_info *info);
817462306a36Sopenharmony_ci
817562306a36Sopenharmony_ci/**
817662306a36Sopenharmony_ci * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
817762306a36Sopenharmony_ci * @wdev: wireless device receiving the frame
817862306a36Sopenharmony_ci * @freq: Frequency on which the frame was received in KHz
817962306a36Sopenharmony_ci * @sig_dbm: signal strength in dBm, or 0 if unknown
818062306a36Sopenharmony_ci * @buf: Management frame (header + body)
818162306a36Sopenharmony_ci * @len: length of the frame data
818262306a36Sopenharmony_ci * @flags: flags, as defined in enum nl80211_rxmgmt_flags
818362306a36Sopenharmony_ci *
818462306a36Sopenharmony_ci * This function is called whenever an Action frame is received for a station
818562306a36Sopenharmony_ci * mode interface, but is not processed in kernel.
818662306a36Sopenharmony_ci *
818762306a36Sopenharmony_ci * Return: %true if a user space application has registered for this frame.
818862306a36Sopenharmony_ci * For action frames, that makes it responsible for rejecting unrecognized
818962306a36Sopenharmony_ci * action frames; %false otherwise, in which case for action frames the
819062306a36Sopenharmony_ci * driver is responsible for rejecting the frame.
819162306a36Sopenharmony_ci */
819262306a36Sopenharmony_cistatic inline bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq,
819362306a36Sopenharmony_ci					int sig_dbm, const u8 *buf, size_t len,
819462306a36Sopenharmony_ci					u32 flags)
819562306a36Sopenharmony_ci{
819662306a36Sopenharmony_ci	struct cfg80211_rx_info info = {
819762306a36Sopenharmony_ci		.freq = freq,
819862306a36Sopenharmony_ci		.sig_dbm = sig_dbm,
819962306a36Sopenharmony_ci		.buf = buf,
820062306a36Sopenharmony_ci		.len = len,
820162306a36Sopenharmony_ci		.flags = flags
820262306a36Sopenharmony_ci	};
820362306a36Sopenharmony_ci
820462306a36Sopenharmony_ci	return cfg80211_rx_mgmt_ext(wdev, &info);
820562306a36Sopenharmony_ci}
820662306a36Sopenharmony_ci
820762306a36Sopenharmony_ci/**
820862306a36Sopenharmony_ci * cfg80211_rx_mgmt - notification of received, unprocessed management frame
820962306a36Sopenharmony_ci * @wdev: wireless device receiving the frame
821062306a36Sopenharmony_ci * @freq: Frequency on which the frame was received in MHz
821162306a36Sopenharmony_ci * @sig_dbm: signal strength in dBm, or 0 if unknown
821262306a36Sopenharmony_ci * @buf: Management frame (header + body)
821362306a36Sopenharmony_ci * @len: length of the frame data
821462306a36Sopenharmony_ci * @flags: flags, as defined in enum nl80211_rxmgmt_flags
821562306a36Sopenharmony_ci *
821662306a36Sopenharmony_ci * This function is called whenever an Action frame is received for a station
821762306a36Sopenharmony_ci * mode interface, but is not processed in kernel.
821862306a36Sopenharmony_ci *
821962306a36Sopenharmony_ci * Return: %true if a user space application has registered for this frame.
822062306a36Sopenharmony_ci * For action frames, that makes it responsible for rejecting unrecognized
822162306a36Sopenharmony_ci * action frames; %false otherwise, in which case for action frames the
822262306a36Sopenharmony_ci * driver is responsible for rejecting the frame.
822362306a36Sopenharmony_ci */
822462306a36Sopenharmony_cistatic inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
822562306a36Sopenharmony_ci				    int sig_dbm, const u8 *buf, size_t len,
822662306a36Sopenharmony_ci				    u32 flags)
822762306a36Sopenharmony_ci{
822862306a36Sopenharmony_ci	struct cfg80211_rx_info info = {
822962306a36Sopenharmony_ci		.freq = MHZ_TO_KHZ(freq),
823062306a36Sopenharmony_ci		.sig_dbm = sig_dbm,
823162306a36Sopenharmony_ci		.buf = buf,
823262306a36Sopenharmony_ci		.len = len,
823362306a36Sopenharmony_ci		.flags = flags
823462306a36Sopenharmony_ci	};
823562306a36Sopenharmony_ci
823662306a36Sopenharmony_ci	return cfg80211_rx_mgmt_ext(wdev, &info);
823762306a36Sopenharmony_ci}
823862306a36Sopenharmony_ci
823962306a36Sopenharmony_ci/**
824062306a36Sopenharmony_ci * struct cfg80211_tx_status - TX status for management frame information
824162306a36Sopenharmony_ci *
824262306a36Sopenharmony_ci * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
824362306a36Sopenharmony_ci * @tx_tstamp: hardware TX timestamp in nanoseconds
824462306a36Sopenharmony_ci * @ack_tstamp: hardware ack RX timestamp in nanoseconds
824562306a36Sopenharmony_ci * @buf: Management frame (header + body)
824662306a36Sopenharmony_ci * @len: length of the frame data
824762306a36Sopenharmony_ci * @ack: Whether frame was acknowledged
824862306a36Sopenharmony_ci */
824962306a36Sopenharmony_cistruct cfg80211_tx_status {
825062306a36Sopenharmony_ci	u64 cookie;
825162306a36Sopenharmony_ci	u64 tx_tstamp;
825262306a36Sopenharmony_ci	u64 ack_tstamp;
825362306a36Sopenharmony_ci	const u8 *buf;
825462306a36Sopenharmony_ci	size_t len;
825562306a36Sopenharmony_ci	bool ack;
825662306a36Sopenharmony_ci};
825762306a36Sopenharmony_ci
825862306a36Sopenharmony_ci/**
825962306a36Sopenharmony_ci * cfg80211_mgmt_tx_status_ext - TX status notification with extended info
826062306a36Sopenharmony_ci * @wdev: wireless device receiving the frame
826162306a36Sopenharmony_ci * @status: TX status data
826262306a36Sopenharmony_ci * @gfp: context flags
826362306a36Sopenharmony_ci *
826462306a36Sopenharmony_ci * This function is called whenever a management frame was requested to be
826562306a36Sopenharmony_ci * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
826662306a36Sopenharmony_ci * transmission attempt with extended info.
826762306a36Sopenharmony_ci */
826862306a36Sopenharmony_civoid cfg80211_mgmt_tx_status_ext(struct wireless_dev *wdev,
826962306a36Sopenharmony_ci				 struct cfg80211_tx_status *status, gfp_t gfp);
827062306a36Sopenharmony_ci
827162306a36Sopenharmony_ci/**
827262306a36Sopenharmony_ci * cfg80211_mgmt_tx_status - notification of TX status for management frame
827362306a36Sopenharmony_ci * @wdev: wireless device receiving the frame
827462306a36Sopenharmony_ci * @cookie: Cookie returned by cfg80211_ops::mgmt_tx()
827562306a36Sopenharmony_ci * @buf: Management frame (header + body)
827662306a36Sopenharmony_ci * @len: length of the frame data
827762306a36Sopenharmony_ci * @ack: Whether frame was acknowledged
827862306a36Sopenharmony_ci * @gfp: context flags
827962306a36Sopenharmony_ci *
828062306a36Sopenharmony_ci * This function is called whenever a management frame was requested to be
828162306a36Sopenharmony_ci * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the
828262306a36Sopenharmony_ci * transmission attempt.
828362306a36Sopenharmony_ci */
828462306a36Sopenharmony_cistatic inline void cfg80211_mgmt_tx_status(struct wireless_dev *wdev,
828562306a36Sopenharmony_ci					   u64 cookie, const u8 *buf,
828662306a36Sopenharmony_ci					   size_t len, bool ack, gfp_t gfp)
828762306a36Sopenharmony_ci{
828862306a36Sopenharmony_ci	struct cfg80211_tx_status status = {
828962306a36Sopenharmony_ci		.cookie = cookie,
829062306a36Sopenharmony_ci		.buf = buf,
829162306a36Sopenharmony_ci		.len = len,
829262306a36Sopenharmony_ci		.ack = ack
829362306a36Sopenharmony_ci	};
829462306a36Sopenharmony_ci
829562306a36Sopenharmony_ci	cfg80211_mgmt_tx_status_ext(wdev, &status, gfp);
829662306a36Sopenharmony_ci}
829762306a36Sopenharmony_ci
829862306a36Sopenharmony_ci/**
829962306a36Sopenharmony_ci * cfg80211_control_port_tx_status - notification of TX status for control
830062306a36Sopenharmony_ci *                                   port frames
830162306a36Sopenharmony_ci * @wdev: wireless device receiving the frame
830262306a36Sopenharmony_ci * @cookie: Cookie returned by cfg80211_ops::tx_control_port()
830362306a36Sopenharmony_ci * @buf: Data frame (header + body)
830462306a36Sopenharmony_ci * @len: length of the frame data
830562306a36Sopenharmony_ci * @ack: Whether frame was acknowledged
830662306a36Sopenharmony_ci * @gfp: context flags
830762306a36Sopenharmony_ci *
830862306a36Sopenharmony_ci * This function is called whenever a control port frame was requested to be
830962306a36Sopenharmony_ci * transmitted with cfg80211_ops::tx_control_port() to report the TX status of
831062306a36Sopenharmony_ci * the transmission attempt.
831162306a36Sopenharmony_ci */
831262306a36Sopenharmony_civoid cfg80211_control_port_tx_status(struct wireless_dev *wdev, u64 cookie,
831362306a36Sopenharmony_ci				     const u8 *buf, size_t len, bool ack,
831462306a36Sopenharmony_ci				     gfp_t gfp);
831562306a36Sopenharmony_ci
831662306a36Sopenharmony_ci/**
831762306a36Sopenharmony_ci * cfg80211_rx_control_port - notification about a received control port frame
831862306a36Sopenharmony_ci * @dev: The device the frame matched to
831962306a36Sopenharmony_ci * @skb: The skbuf with the control port frame.  It is assumed that the skbuf
832062306a36Sopenharmony_ci *	is 802.3 formatted (with 802.3 header).  The skb can be non-linear.
832162306a36Sopenharmony_ci *	This function does not take ownership of the skb, so the caller is
832262306a36Sopenharmony_ci *	responsible for any cleanup.  The caller must also ensure that
832362306a36Sopenharmony_ci *	skb->protocol is set appropriately.
832462306a36Sopenharmony_ci * @unencrypted: Whether the frame was received unencrypted
832562306a36Sopenharmony_ci * @link_id: the link the frame was received on, -1 if not applicable or unknown
832662306a36Sopenharmony_ci *
832762306a36Sopenharmony_ci * This function is used to inform userspace about a received control port
832862306a36Sopenharmony_ci * frame.  It should only be used if userspace indicated it wants to receive
832962306a36Sopenharmony_ci * control port frames over nl80211.
833062306a36Sopenharmony_ci *
833162306a36Sopenharmony_ci * The frame is the data portion of the 802.3 or 802.11 data frame with all
833262306a36Sopenharmony_ci * network layer headers removed (e.g. the raw EAPoL frame).
833362306a36Sopenharmony_ci *
833462306a36Sopenharmony_ci * Return: %true if the frame was passed to userspace
833562306a36Sopenharmony_ci */
833662306a36Sopenharmony_cibool cfg80211_rx_control_port(struct net_device *dev, struct sk_buff *skb,
833762306a36Sopenharmony_ci			      bool unencrypted, int link_id);
833862306a36Sopenharmony_ci
833962306a36Sopenharmony_ci/**
834062306a36Sopenharmony_ci * cfg80211_cqm_rssi_notify - connection quality monitoring rssi event
834162306a36Sopenharmony_ci * @dev: network device
834262306a36Sopenharmony_ci * @rssi_event: the triggered RSSI event
834362306a36Sopenharmony_ci * @rssi_level: new RSSI level value or 0 if not available
834462306a36Sopenharmony_ci * @gfp: context flags
834562306a36Sopenharmony_ci *
834662306a36Sopenharmony_ci * This function is called when a configured connection quality monitoring
834762306a36Sopenharmony_ci * rssi threshold reached event occurs.
834862306a36Sopenharmony_ci */
834962306a36Sopenharmony_civoid cfg80211_cqm_rssi_notify(struct net_device *dev,
835062306a36Sopenharmony_ci			      enum nl80211_cqm_rssi_threshold_event rssi_event,
835162306a36Sopenharmony_ci			      s32 rssi_level, gfp_t gfp);
835262306a36Sopenharmony_ci
835362306a36Sopenharmony_ci/**
835462306a36Sopenharmony_ci * cfg80211_cqm_pktloss_notify - notify userspace about packetloss to peer
835562306a36Sopenharmony_ci * @dev: network device
835662306a36Sopenharmony_ci * @peer: peer's MAC address
835762306a36Sopenharmony_ci * @num_packets: how many packets were lost -- should be a fixed threshold
835862306a36Sopenharmony_ci *	but probably no less than maybe 50, or maybe a throughput dependent
835962306a36Sopenharmony_ci *	threshold (to account for temporary interference)
836062306a36Sopenharmony_ci * @gfp: context flags
836162306a36Sopenharmony_ci */
836262306a36Sopenharmony_civoid cfg80211_cqm_pktloss_notify(struct net_device *dev,
836362306a36Sopenharmony_ci				 const u8 *peer, u32 num_packets, gfp_t gfp);
836462306a36Sopenharmony_ci
836562306a36Sopenharmony_ci/**
836662306a36Sopenharmony_ci * cfg80211_cqm_txe_notify - TX error rate event
836762306a36Sopenharmony_ci * @dev: network device
836862306a36Sopenharmony_ci * @peer: peer's MAC address
836962306a36Sopenharmony_ci * @num_packets: how many packets were lost
837062306a36Sopenharmony_ci * @rate: % of packets which failed transmission
837162306a36Sopenharmony_ci * @intvl: interval (in s) over which the TX failure threshold was breached.
837262306a36Sopenharmony_ci * @gfp: context flags
837362306a36Sopenharmony_ci *
837462306a36Sopenharmony_ci * Notify userspace when configured % TX failures over number of packets in a
837562306a36Sopenharmony_ci * given interval is exceeded.
837662306a36Sopenharmony_ci */
837762306a36Sopenharmony_civoid cfg80211_cqm_txe_notify(struct net_device *dev, const u8 *peer,
837862306a36Sopenharmony_ci			     u32 num_packets, u32 rate, u32 intvl, gfp_t gfp);
837962306a36Sopenharmony_ci
838062306a36Sopenharmony_ci/**
838162306a36Sopenharmony_ci * cfg80211_cqm_beacon_loss_notify - beacon loss event
838262306a36Sopenharmony_ci * @dev: network device
838362306a36Sopenharmony_ci * @gfp: context flags
838462306a36Sopenharmony_ci *
838562306a36Sopenharmony_ci * Notify userspace about beacon loss from the connected AP.
838662306a36Sopenharmony_ci */
838762306a36Sopenharmony_civoid cfg80211_cqm_beacon_loss_notify(struct net_device *dev, gfp_t gfp);
838862306a36Sopenharmony_ci
838962306a36Sopenharmony_ci/**
839062306a36Sopenharmony_ci * __cfg80211_radar_event - radar detection event
839162306a36Sopenharmony_ci * @wiphy: the wiphy
839262306a36Sopenharmony_ci * @chandef: chandef for the current channel
839362306a36Sopenharmony_ci * @offchan: the radar has been detected on the offchannel chain
839462306a36Sopenharmony_ci * @gfp: context flags
839562306a36Sopenharmony_ci *
839662306a36Sopenharmony_ci * This function is called when a radar is detected on the current chanenl.
839762306a36Sopenharmony_ci */
839862306a36Sopenharmony_civoid __cfg80211_radar_event(struct wiphy *wiphy,
839962306a36Sopenharmony_ci			    struct cfg80211_chan_def *chandef,
840062306a36Sopenharmony_ci			    bool offchan, gfp_t gfp);
840162306a36Sopenharmony_ci
840262306a36Sopenharmony_cistatic inline void
840362306a36Sopenharmony_cicfg80211_radar_event(struct wiphy *wiphy,
840462306a36Sopenharmony_ci		     struct cfg80211_chan_def *chandef,
840562306a36Sopenharmony_ci		     gfp_t gfp)
840662306a36Sopenharmony_ci{
840762306a36Sopenharmony_ci	__cfg80211_radar_event(wiphy, chandef, false, gfp);
840862306a36Sopenharmony_ci}
840962306a36Sopenharmony_ci
841062306a36Sopenharmony_cistatic inline void
841162306a36Sopenharmony_cicfg80211_background_radar_event(struct wiphy *wiphy,
841262306a36Sopenharmony_ci				struct cfg80211_chan_def *chandef,
841362306a36Sopenharmony_ci				gfp_t gfp)
841462306a36Sopenharmony_ci{
841562306a36Sopenharmony_ci	__cfg80211_radar_event(wiphy, chandef, true, gfp);
841662306a36Sopenharmony_ci}
841762306a36Sopenharmony_ci
841862306a36Sopenharmony_ci/**
841962306a36Sopenharmony_ci * cfg80211_sta_opmode_change_notify - STA's ht/vht operation mode change event
842062306a36Sopenharmony_ci * @dev: network device
842162306a36Sopenharmony_ci * @mac: MAC address of a station which opmode got modified
842262306a36Sopenharmony_ci * @sta_opmode: station's current opmode value
842362306a36Sopenharmony_ci * @gfp: context flags
842462306a36Sopenharmony_ci *
842562306a36Sopenharmony_ci * Driver should call this function when station's opmode modified via action
842662306a36Sopenharmony_ci * frame.
842762306a36Sopenharmony_ci */
842862306a36Sopenharmony_civoid cfg80211_sta_opmode_change_notify(struct net_device *dev, const u8 *mac,
842962306a36Sopenharmony_ci				       struct sta_opmode_info *sta_opmode,
843062306a36Sopenharmony_ci				       gfp_t gfp);
843162306a36Sopenharmony_ci
843262306a36Sopenharmony_ci/**
843362306a36Sopenharmony_ci * cfg80211_cac_event - Channel availability check (CAC) event
843462306a36Sopenharmony_ci * @netdev: network device
843562306a36Sopenharmony_ci * @chandef: chandef for the current channel
843662306a36Sopenharmony_ci * @event: type of event
843762306a36Sopenharmony_ci * @gfp: context flags
843862306a36Sopenharmony_ci *
843962306a36Sopenharmony_ci * This function is called when a Channel availability check (CAC) is finished
844062306a36Sopenharmony_ci * or aborted. This must be called to notify the completion of a CAC process,
844162306a36Sopenharmony_ci * also by full-MAC drivers.
844262306a36Sopenharmony_ci */
844362306a36Sopenharmony_civoid cfg80211_cac_event(struct net_device *netdev,
844462306a36Sopenharmony_ci			const struct cfg80211_chan_def *chandef,
844562306a36Sopenharmony_ci			enum nl80211_radar_event event, gfp_t gfp);
844662306a36Sopenharmony_ci
844762306a36Sopenharmony_ci/**
844862306a36Sopenharmony_ci * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
844962306a36Sopenharmony_ci * @wiphy: the wiphy
845062306a36Sopenharmony_ci *
845162306a36Sopenharmony_ci * This function is called by the driver when a Channel Availability Check
845262306a36Sopenharmony_ci * (CAC) is aborted by a offchannel dedicated chain.
845362306a36Sopenharmony_ci */
845462306a36Sopenharmony_civoid cfg80211_background_cac_abort(struct wiphy *wiphy);
845562306a36Sopenharmony_ci
845662306a36Sopenharmony_ci/**
845762306a36Sopenharmony_ci * cfg80211_gtk_rekey_notify - notify userspace about driver rekeying
845862306a36Sopenharmony_ci * @dev: network device
845962306a36Sopenharmony_ci * @bssid: BSSID of AP (to avoid races)
846062306a36Sopenharmony_ci * @replay_ctr: new replay counter
846162306a36Sopenharmony_ci * @gfp: allocation flags
846262306a36Sopenharmony_ci */
846362306a36Sopenharmony_civoid cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
846462306a36Sopenharmony_ci			       const u8 *replay_ctr, gfp_t gfp);
846562306a36Sopenharmony_ci
846662306a36Sopenharmony_ci/**
846762306a36Sopenharmony_ci * cfg80211_pmksa_candidate_notify - notify about PMKSA caching candidate
846862306a36Sopenharmony_ci * @dev: network device
846962306a36Sopenharmony_ci * @index: candidate index (the smaller the index, the higher the priority)
847062306a36Sopenharmony_ci * @bssid: BSSID of AP
847162306a36Sopenharmony_ci * @preauth: Whether AP advertises support for RSN pre-authentication
847262306a36Sopenharmony_ci * @gfp: allocation flags
847362306a36Sopenharmony_ci */
847462306a36Sopenharmony_civoid cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
847562306a36Sopenharmony_ci				     const u8 *bssid, bool preauth, gfp_t gfp);
847662306a36Sopenharmony_ci
847762306a36Sopenharmony_ci/**
847862306a36Sopenharmony_ci * cfg80211_rx_spurious_frame - inform userspace about a spurious frame
847962306a36Sopenharmony_ci * @dev: The device the frame matched to
848062306a36Sopenharmony_ci * @addr: the transmitter address
848162306a36Sopenharmony_ci * @gfp: context flags
848262306a36Sopenharmony_ci *
848362306a36Sopenharmony_ci * This function is used in AP mode (only!) to inform userspace that
848462306a36Sopenharmony_ci * a spurious class 3 frame was received, to be able to deauth the
848562306a36Sopenharmony_ci * sender.
848662306a36Sopenharmony_ci * Return: %true if the frame was passed to userspace (or this failed
848762306a36Sopenharmony_ci * for a reason other than not having a subscription.)
848862306a36Sopenharmony_ci */
848962306a36Sopenharmony_cibool cfg80211_rx_spurious_frame(struct net_device *dev,
849062306a36Sopenharmony_ci				const u8 *addr, gfp_t gfp);
849162306a36Sopenharmony_ci
849262306a36Sopenharmony_ci/**
849362306a36Sopenharmony_ci * cfg80211_rx_unexpected_4addr_frame - inform about unexpected WDS frame
849462306a36Sopenharmony_ci * @dev: The device the frame matched to
849562306a36Sopenharmony_ci * @addr: the transmitter address
849662306a36Sopenharmony_ci * @gfp: context flags
849762306a36Sopenharmony_ci *
849862306a36Sopenharmony_ci * This function is used in AP mode (only!) to inform userspace that
849962306a36Sopenharmony_ci * an associated station sent a 4addr frame but that wasn't expected.
850062306a36Sopenharmony_ci * It is allowed and desirable to send this event only once for each
850162306a36Sopenharmony_ci * station to avoid event flooding.
850262306a36Sopenharmony_ci * Return: %true if the frame was passed to userspace (or this failed
850362306a36Sopenharmony_ci * for a reason other than not having a subscription.)
850462306a36Sopenharmony_ci */
850562306a36Sopenharmony_cibool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
850662306a36Sopenharmony_ci					const u8 *addr, gfp_t gfp);
850762306a36Sopenharmony_ci
850862306a36Sopenharmony_ci/**
850962306a36Sopenharmony_ci * cfg80211_probe_status - notify userspace about probe status
851062306a36Sopenharmony_ci * @dev: the device the probe was sent on
851162306a36Sopenharmony_ci * @addr: the address of the peer
851262306a36Sopenharmony_ci * @cookie: the cookie filled in @probe_client previously
851362306a36Sopenharmony_ci * @acked: indicates whether probe was acked or not
851462306a36Sopenharmony_ci * @ack_signal: signal strength (in dBm) of the ACK frame.
851562306a36Sopenharmony_ci * @is_valid_ack_signal: indicates the ack_signal is valid or not.
851662306a36Sopenharmony_ci * @gfp: allocation flags
851762306a36Sopenharmony_ci */
851862306a36Sopenharmony_civoid cfg80211_probe_status(struct net_device *dev, const u8 *addr,
851962306a36Sopenharmony_ci			   u64 cookie, bool acked, s32 ack_signal,
852062306a36Sopenharmony_ci			   bool is_valid_ack_signal, gfp_t gfp);
852162306a36Sopenharmony_ci
852262306a36Sopenharmony_ci/**
852362306a36Sopenharmony_ci * cfg80211_report_obss_beacon_khz - report beacon from other APs
852462306a36Sopenharmony_ci * @wiphy: The wiphy that received the beacon
852562306a36Sopenharmony_ci * @frame: the frame
852662306a36Sopenharmony_ci * @len: length of the frame
852762306a36Sopenharmony_ci * @freq: frequency the frame was received on in KHz
852862306a36Sopenharmony_ci * @sig_dbm: signal strength in dBm, or 0 if unknown
852962306a36Sopenharmony_ci *
853062306a36Sopenharmony_ci * Use this function to report to userspace when a beacon was
853162306a36Sopenharmony_ci * received. It is not useful to call this when there is no
853262306a36Sopenharmony_ci * netdev that is in AP/GO mode.
853362306a36Sopenharmony_ci */
853462306a36Sopenharmony_civoid cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
853562306a36Sopenharmony_ci				     size_t len, int freq, int sig_dbm);
853662306a36Sopenharmony_ci
853762306a36Sopenharmony_ci/**
853862306a36Sopenharmony_ci * cfg80211_report_obss_beacon - report beacon from other APs
853962306a36Sopenharmony_ci * @wiphy: The wiphy that received the beacon
854062306a36Sopenharmony_ci * @frame: the frame
854162306a36Sopenharmony_ci * @len: length of the frame
854262306a36Sopenharmony_ci * @freq: frequency the frame was received on
854362306a36Sopenharmony_ci * @sig_dbm: signal strength in dBm, or 0 if unknown
854462306a36Sopenharmony_ci *
854562306a36Sopenharmony_ci * Use this function to report to userspace when a beacon was
854662306a36Sopenharmony_ci * received. It is not useful to call this when there is no
854762306a36Sopenharmony_ci * netdev that is in AP/GO mode.
854862306a36Sopenharmony_ci */
854962306a36Sopenharmony_cistatic inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
855062306a36Sopenharmony_ci					       const u8 *frame, size_t len,
855162306a36Sopenharmony_ci					       int freq, int sig_dbm)
855262306a36Sopenharmony_ci{
855362306a36Sopenharmony_ci	cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
855462306a36Sopenharmony_ci					sig_dbm);
855562306a36Sopenharmony_ci}
855662306a36Sopenharmony_ci
855762306a36Sopenharmony_ci/**
855862306a36Sopenharmony_ci * cfg80211_reg_can_beacon - check if beaconing is allowed
855962306a36Sopenharmony_ci * @wiphy: the wiphy
856062306a36Sopenharmony_ci * @chandef: the channel definition
856162306a36Sopenharmony_ci * @iftype: interface type
856262306a36Sopenharmony_ci *
856362306a36Sopenharmony_ci * Return: %true if there is no secondary channel or the secondary channel(s)
856462306a36Sopenharmony_ci * can be used for beaconing (i.e. is not a radar channel etc.)
856562306a36Sopenharmony_ci */
856662306a36Sopenharmony_cibool cfg80211_reg_can_beacon(struct wiphy *wiphy,
856762306a36Sopenharmony_ci			     struct cfg80211_chan_def *chandef,
856862306a36Sopenharmony_ci			     enum nl80211_iftype iftype);
856962306a36Sopenharmony_ci
857062306a36Sopenharmony_ci/**
857162306a36Sopenharmony_ci * cfg80211_reg_can_beacon_relax - check if beaconing is allowed with relaxation
857262306a36Sopenharmony_ci * @wiphy: the wiphy
857362306a36Sopenharmony_ci * @chandef: the channel definition
857462306a36Sopenharmony_ci * @iftype: interface type
857562306a36Sopenharmony_ci *
857662306a36Sopenharmony_ci * Return: %true if there is no secondary channel or the secondary channel(s)
857762306a36Sopenharmony_ci * can be used for beaconing (i.e. is not a radar channel etc.). This version
857862306a36Sopenharmony_ci * also checks if IR-relaxation conditions apply, to allow beaconing under
857962306a36Sopenharmony_ci * more permissive conditions.
858062306a36Sopenharmony_ci *
858162306a36Sopenharmony_ci * Requires the wiphy mutex to be held.
858262306a36Sopenharmony_ci */
858362306a36Sopenharmony_cibool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,
858462306a36Sopenharmony_ci				   struct cfg80211_chan_def *chandef,
858562306a36Sopenharmony_ci				   enum nl80211_iftype iftype);
858662306a36Sopenharmony_ci
858762306a36Sopenharmony_ci/*
858862306a36Sopenharmony_ci * cfg80211_ch_switch_notify - update wdev channel and notify userspace
858962306a36Sopenharmony_ci * @dev: the device which switched channels
859062306a36Sopenharmony_ci * @chandef: the new channel definition
859162306a36Sopenharmony_ci * @link_id: the link ID for MLO, must be 0 for non-MLO
859262306a36Sopenharmony_ci * @punct_bitmap: the new puncturing bitmap
859362306a36Sopenharmony_ci *
859462306a36Sopenharmony_ci * Caller must acquire wdev_lock, therefore must only be called from sleepable
859562306a36Sopenharmony_ci * driver context!
859662306a36Sopenharmony_ci */
859762306a36Sopenharmony_civoid cfg80211_ch_switch_notify(struct net_device *dev,
859862306a36Sopenharmony_ci			       struct cfg80211_chan_def *chandef,
859962306a36Sopenharmony_ci			       unsigned int link_id, u16 punct_bitmap);
860062306a36Sopenharmony_ci
860162306a36Sopenharmony_ci/*
860262306a36Sopenharmony_ci * cfg80211_ch_switch_started_notify - notify channel switch start
860362306a36Sopenharmony_ci * @dev: the device on which the channel switch started
860462306a36Sopenharmony_ci * @chandef: the future channel definition
860562306a36Sopenharmony_ci * @link_id: the link ID for MLO, must be 0 for non-MLO
860662306a36Sopenharmony_ci * @count: the number of TBTTs until the channel switch happens
860762306a36Sopenharmony_ci * @quiet: whether or not immediate quiet was requested by the AP
860862306a36Sopenharmony_ci * @punct_bitmap: the future puncturing bitmap
860962306a36Sopenharmony_ci *
861062306a36Sopenharmony_ci * Inform the userspace about the channel switch that has just
861162306a36Sopenharmony_ci * started, so that it can take appropriate actions (eg. starting
861262306a36Sopenharmony_ci * channel switch on other vifs), if necessary.
861362306a36Sopenharmony_ci */
861462306a36Sopenharmony_civoid cfg80211_ch_switch_started_notify(struct net_device *dev,
861562306a36Sopenharmony_ci				       struct cfg80211_chan_def *chandef,
861662306a36Sopenharmony_ci				       unsigned int link_id, u8 count,
861762306a36Sopenharmony_ci				       bool quiet, u16 punct_bitmap);
861862306a36Sopenharmony_ci
861962306a36Sopenharmony_ci/**
862062306a36Sopenharmony_ci * ieee80211_operating_class_to_band - convert operating class to band
862162306a36Sopenharmony_ci *
862262306a36Sopenharmony_ci * @operating_class: the operating class to convert
862362306a36Sopenharmony_ci * @band: band pointer to fill
862462306a36Sopenharmony_ci *
862562306a36Sopenharmony_ci * Returns %true if the conversion was successful, %false otherwise.
862662306a36Sopenharmony_ci */
862762306a36Sopenharmony_cibool ieee80211_operating_class_to_band(u8 operating_class,
862862306a36Sopenharmony_ci				       enum nl80211_band *band);
862962306a36Sopenharmony_ci
863062306a36Sopenharmony_ci/**
863162306a36Sopenharmony_ci * ieee80211_chandef_to_operating_class - convert chandef to operation class
863262306a36Sopenharmony_ci *
863362306a36Sopenharmony_ci * @chandef: the chandef to convert
863462306a36Sopenharmony_ci * @op_class: a pointer to the resulting operating class
863562306a36Sopenharmony_ci *
863662306a36Sopenharmony_ci * Returns %true if the conversion was successful, %false otherwise.
863762306a36Sopenharmony_ci */
863862306a36Sopenharmony_cibool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef,
863962306a36Sopenharmony_ci					  u8 *op_class);
864062306a36Sopenharmony_ci
864162306a36Sopenharmony_ci/**
864262306a36Sopenharmony_ci * ieee80211_chandef_to_khz - convert chandef to frequency in KHz
864362306a36Sopenharmony_ci *
864462306a36Sopenharmony_ci * @chandef: the chandef to convert
864562306a36Sopenharmony_ci *
864662306a36Sopenharmony_ci * Returns the center frequency of chandef (1st segment) in KHz.
864762306a36Sopenharmony_ci */
864862306a36Sopenharmony_cistatic inline u32
864962306a36Sopenharmony_ciieee80211_chandef_to_khz(const struct cfg80211_chan_def *chandef)
865062306a36Sopenharmony_ci{
865162306a36Sopenharmony_ci	return MHZ_TO_KHZ(chandef->center_freq1) + chandef->freq1_offset;
865262306a36Sopenharmony_ci}
865362306a36Sopenharmony_ci
865462306a36Sopenharmony_ci/*
865562306a36Sopenharmony_ci * cfg80211_tdls_oper_request - request userspace to perform TDLS operation
865662306a36Sopenharmony_ci * @dev: the device on which the operation is requested
865762306a36Sopenharmony_ci * @peer: the MAC address of the peer device
865862306a36Sopenharmony_ci * @oper: the requested TDLS operation (NL80211_TDLS_SETUP or
865962306a36Sopenharmony_ci *	NL80211_TDLS_TEARDOWN)
866062306a36Sopenharmony_ci * @reason_code: the reason code for teardown request
866162306a36Sopenharmony_ci * @gfp: allocation flags
866262306a36Sopenharmony_ci *
866362306a36Sopenharmony_ci * This function is used to request userspace to perform TDLS operation that
866462306a36Sopenharmony_ci * requires knowledge of keys, i.e., link setup or teardown when the AP
866562306a36Sopenharmony_ci * connection uses encryption. This is optional mechanism for the driver to use
866662306a36Sopenharmony_ci * if it can automatically determine when a TDLS link could be useful (e.g.,
866762306a36Sopenharmony_ci * based on traffic and signal strength for a peer).
866862306a36Sopenharmony_ci */
866962306a36Sopenharmony_civoid cfg80211_tdls_oper_request(struct net_device *dev, const u8 *peer,
867062306a36Sopenharmony_ci				enum nl80211_tdls_operation oper,
867162306a36Sopenharmony_ci				u16 reason_code, gfp_t gfp);
867262306a36Sopenharmony_ci
867362306a36Sopenharmony_ci/*
867462306a36Sopenharmony_ci * cfg80211_calculate_bitrate - calculate actual bitrate (in 100Kbps units)
867562306a36Sopenharmony_ci * @rate: given rate_info to calculate bitrate from
867662306a36Sopenharmony_ci *
867762306a36Sopenharmony_ci * return 0 if MCS index >= 32
867862306a36Sopenharmony_ci */
867962306a36Sopenharmony_ciu32 cfg80211_calculate_bitrate(struct rate_info *rate);
868062306a36Sopenharmony_ci
868162306a36Sopenharmony_ci/**
868262306a36Sopenharmony_ci * cfg80211_unregister_wdev - remove the given wdev
868362306a36Sopenharmony_ci * @wdev: struct wireless_dev to remove
868462306a36Sopenharmony_ci *
868562306a36Sopenharmony_ci * This function removes the device so it can no longer be used. It is necessary
868662306a36Sopenharmony_ci * to call this function even when cfg80211 requests the removal of the device
868762306a36Sopenharmony_ci * by calling the del_virtual_intf() callback. The function must also be called
868862306a36Sopenharmony_ci * when the driver wishes to unregister the wdev, e.g. when the hardware device
868962306a36Sopenharmony_ci * is unbound from the driver.
869062306a36Sopenharmony_ci *
869162306a36Sopenharmony_ci * Requires the RTNL and wiphy mutex to be held.
869262306a36Sopenharmony_ci */
869362306a36Sopenharmony_civoid cfg80211_unregister_wdev(struct wireless_dev *wdev);
869462306a36Sopenharmony_ci
869562306a36Sopenharmony_ci/**
869662306a36Sopenharmony_ci * cfg80211_register_netdevice - register the given netdev
869762306a36Sopenharmony_ci * @dev: the netdev to register
869862306a36Sopenharmony_ci *
869962306a36Sopenharmony_ci * Note: In contexts coming from cfg80211 callbacks, you must call this rather
870062306a36Sopenharmony_ci * than register_netdevice(), unregister_netdev() is impossible as the RTNL is
870162306a36Sopenharmony_ci * held. Otherwise, both register_netdevice() and register_netdev() are usable
870262306a36Sopenharmony_ci * instead as well.
870362306a36Sopenharmony_ci *
870462306a36Sopenharmony_ci * Requires the RTNL and wiphy mutex to be held.
870562306a36Sopenharmony_ci */
870662306a36Sopenharmony_ciint cfg80211_register_netdevice(struct net_device *dev);
870762306a36Sopenharmony_ci
870862306a36Sopenharmony_ci/**
870962306a36Sopenharmony_ci * cfg80211_unregister_netdevice - unregister the given netdev
871062306a36Sopenharmony_ci * @dev: the netdev to register
871162306a36Sopenharmony_ci *
871262306a36Sopenharmony_ci * Note: In contexts coming from cfg80211 callbacks, you must call this rather
871362306a36Sopenharmony_ci * than unregister_netdevice(), unregister_netdev() is impossible as the RTNL
871462306a36Sopenharmony_ci * is held. Otherwise, both unregister_netdevice() and unregister_netdev() are
871562306a36Sopenharmony_ci * usable instead as well.
871662306a36Sopenharmony_ci *
871762306a36Sopenharmony_ci * Requires the RTNL and wiphy mutex to be held.
871862306a36Sopenharmony_ci */
871962306a36Sopenharmony_cistatic inline void cfg80211_unregister_netdevice(struct net_device *dev)
872062306a36Sopenharmony_ci{
872162306a36Sopenharmony_ci#if IS_ENABLED(CONFIG_CFG80211)
872262306a36Sopenharmony_ci	cfg80211_unregister_wdev(dev->ieee80211_ptr);
872362306a36Sopenharmony_ci#endif
872462306a36Sopenharmony_ci}
872562306a36Sopenharmony_ci
872662306a36Sopenharmony_ci/**
872762306a36Sopenharmony_ci * struct cfg80211_ft_event_params - FT Information Elements
872862306a36Sopenharmony_ci * @ies: FT IEs
872962306a36Sopenharmony_ci * @ies_len: length of the FT IE in bytes
873062306a36Sopenharmony_ci * @target_ap: target AP's MAC address
873162306a36Sopenharmony_ci * @ric_ies: RIC IE
873262306a36Sopenharmony_ci * @ric_ies_len: length of the RIC IE in bytes
873362306a36Sopenharmony_ci */
873462306a36Sopenharmony_cistruct cfg80211_ft_event_params {
873562306a36Sopenharmony_ci	const u8 *ies;
873662306a36Sopenharmony_ci	size_t ies_len;
873762306a36Sopenharmony_ci	const u8 *target_ap;
873862306a36Sopenharmony_ci	const u8 *ric_ies;
873962306a36Sopenharmony_ci	size_t ric_ies_len;
874062306a36Sopenharmony_ci};
874162306a36Sopenharmony_ci
874262306a36Sopenharmony_ci/**
874362306a36Sopenharmony_ci * cfg80211_ft_event - notify userspace about FT IE and RIC IE
874462306a36Sopenharmony_ci * @netdev: network device
874562306a36Sopenharmony_ci * @ft_event: IE information
874662306a36Sopenharmony_ci */
874762306a36Sopenharmony_civoid cfg80211_ft_event(struct net_device *netdev,
874862306a36Sopenharmony_ci		       struct cfg80211_ft_event_params *ft_event);
874962306a36Sopenharmony_ci
875062306a36Sopenharmony_ci/**
875162306a36Sopenharmony_ci * cfg80211_get_p2p_attr - find and copy a P2P attribute from IE buffer
875262306a36Sopenharmony_ci * @ies: the input IE buffer
875362306a36Sopenharmony_ci * @len: the input length
875462306a36Sopenharmony_ci * @attr: the attribute ID to find
875562306a36Sopenharmony_ci * @buf: output buffer, can be %NULL if the data isn't needed, e.g.
875662306a36Sopenharmony_ci *	if the function is only called to get the needed buffer size
875762306a36Sopenharmony_ci * @bufsize: size of the output buffer
875862306a36Sopenharmony_ci *
875962306a36Sopenharmony_ci * The function finds a given P2P attribute in the (vendor) IEs and
876062306a36Sopenharmony_ci * copies its contents to the given buffer.
876162306a36Sopenharmony_ci *
876262306a36Sopenharmony_ci * Return: A negative error code (-%EILSEQ or -%ENOENT) if the data is
876362306a36Sopenharmony_ci * malformed or the attribute can't be found (respectively), or the
876462306a36Sopenharmony_ci * length of the found attribute (which can be zero).
876562306a36Sopenharmony_ci */
876662306a36Sopenharmony_ciint cfg80211_get_p2p_attr(const u8 *ies, unsigned int len,
876762306a36Sopenharmony_ci			  enum ieee80211_p2p_attr_id attr,
876862306a36Sopenharmony_ci			  u8 *buf, unsigned int bufsize);
876962306a36Sopenharmony_ci
877062306a36Sopenharmony_ci/**
877162306a36Sopenharmony_ci * ieee80211_ie_split_ric - split an IE buffer according to ordering (with RIC)
877262306a36Sopenharmony_ci * @ies: the IE buffer
877362306a36Sopenharmony_ci * @ielen: the length of the IE buffer
877462306a36Sopenharmony_ci * @ids: an array with element IDs that are allowed before
877562306a36Sopenharmony_ci *	the split. A WLAN_EID_EXTENSION value means that the next
877662306a36Sopenharmony_ci *	EID in the list is a sub-element of the EXTENSION IE.
877762306a36Sopenharmony_ci * @n_ids: the size of the element ID array
877862306a36Sopenharmony_ci * @after_ric: array IE types that come after the RIC element
877962306a36Sopenharmony_ci * @n_after_ric: size of the @after_ric array
878062306a36Sopenharmony_ci * @offset: offset where to start splitting in the buffer
878162306a36Sopenharmony_ci *
878262306a36Sopenharmony_ci * This function splits an IE buffer by updating the @offset
878362306a36Sopenharmony_ci * variable to point to the location where the buffer should be
878462306a36Sopenharmony_ci * split.
878562306a36Sopenharmony_ci *
878662306a36Sopenharmony_ci * It assumes that the given IE buffer is well-formed, this
878762306a36Sopenharmony_ci * has to be guaranteed by the caller!
878862306a36Sopenharmony_ci *
878962306a36Sopenharmony_ci * It also assumes that the IEs in the buffer are ordered
879062306a36Sopenharmony_ci * correctly, if not the result of using this function will not
879162306a36Sopenharmony_ci * be ordered correctly either, i.e. it does no reordering.
879262306a36Sopenharmony_ci *
879362306a36Sopenharmony_ci * The function returns the offset where the next part of the
879462306a36Sopenharmony_ci * buffer starts, which may be @ielen if the entire (remainder)
879562306a36Sopenharmony_ci * of the buffer should be used.
879662306a36Sopenharmony_ci */
879762306a36Sopenharmony_cisize_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
879862306a36Sopenharmony_ci			      const u8 *ids, int n_ids,
879962306a36Sopenharmony_ci			      const u8 *after_ric, int n_after_ric,
880062306a36Sopenharmony_ci			      size_t offset);
880162306a36Sopenharmony_ci
880262306a36Sopenharmony_ci/**
880362306a36Sopenharmony_ci * ieee80211_ie_split - split an IE buffer according to ordering
880462306a36Sopenharmony_ci * @ies: the IE buffer
880562306a36Sopenharmony_ci * @ielen: the length of the IE buffer
880662306a36Sopenharmony_ci * @ids: an array with element IDs that are allowed before
880762306a36Sopenharmony_ci *	the split. A WLAN_EID_EXTENSION value means that the next
880862306a36Sopenharmony_ci *	EID in the list is a sub-element of the EXTENSION IE.
880962306a36Sopenharmony_ci * @n_ids: the size of the element ID array
881062306a36Sopenharmony_ci * @offset: offset where to start splitting in the buffer
881162306a36Sopenharmony_ci *
881262306a36Sopenharmony_ci * This function splits an IE buffer by updating the @offset
881362306a36Sopenharmony_ci * variable to point to the location where the buffer should be
881462306a36Sopenharmony_ci * split.
881562306a36Sopenharmony_ci *
881662306a36Sopenharmony_ci * It assumes that the given IE buffer is well-formed, this
881762306a36Sopenharmony_ci * has to be guaranteed by the caller!
881862306a36Sopenharmony_ci *
881962306a36Sopenharmony_ci * It also assumes that the IEs in the buffer are ordered
882062306a36Sopenharmony_ci * correctly, if not the result of using this function will not
882162306a36Sopenharmony_ci * be ordered correctly either, i.e. it does no reordering.
882262306a36Sopenharmony_ci *
882362306a36Sopenharmony_ci * The function returns the offset where the next part of the
882462306a36Sopenharmony_ci * buffer starts, which may be @ielen if the entire (remainder)
882562306a36Sopenharmony_ci * of the buffer should be used.
882662306a36Sopenharmony_ci */
882762306a36Sopenharmony_cistatic inline size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
882862306a36Sopenharmony_ci					const u8 *ids, int n_ids, size_t offset)
882962306a36Sopenharmony_ci{
883062306a36Sopenharmony_ci	return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
883162306a36Sopenharmony_ci}
883262306a36Sopenharmony_ci
883362306a36Sopenharmony_ci/**
883462306a36Sopenharmony_ci * cfg80211_report_wowlan_wakeup - report wakeup from WoWLAN
883562306a36Sopenharmony_ci * @wdev: the wireless device reporting the wakeup
883662306a36Sopenharmony_ci * @wakeup: the wakeup report
883762306a36Sopenharmony_ci * @gfp: allocation flags
883862306a36Sopenharmony_ci *
883962306a36Sopenharmony_ci * This function reports that the given device woke up. If it
884062306a36Sopenharmony_ci * caused the wakeup, report the reason(s), otherwise you may
884162306a36Sopenharmony_ci * pass %NULL as the @wakeup parameter to advertise that something
884262306a36Sopenharmony_ci * else caused the wakeup.
884362306a36Sopenharmony_ci */
884462306a36Sopenharmony_civoid cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,
884562306a36Sopenharmony_ci				   struct cfg80211_wowlan_wakeup *wakeup,
884662306a36Sopenharmony_ci				   gfp_t gfp);
884762306a36Sopenharmony_ci
884862306a36Sopenharmony_ci/**
884962306a36Sopenharmony_ci * cfg80211_crit_proto_stopped() - indicate critical protocol stopped by driver.
885062306a36Sopenharmony_ci *
885162306a36Sopenharmony_ci * @wdev: the wireless device for which critical protocol is stopped.
885262306a36Sopenharmony_ci * @gfp: allocation flags
885362306a36Sopenharmony_ci *
885462306a36Sopenharmony_ci * This function can be called by the driver to indicate it has reverted
885562306a36Sopenharmony_ci * operation back to normal. One reason could be that the duration given
885662306a36Sopenharmony_ci * by .crit_proto_start() has expired.
885762306a36Sopenharmony_ci */
885862306a36Sopenharmony_civoid cfg80211_crit_proto_stopped(struct wireless_dev *wdev, gfp_t gfp);
885962306a36Sopenharmony_ci
886062306a36Sopenharmony_ci/**
886162306a36Sopenharmony_ci * ieee80211_get_num_supported_channels - get number of channels device has
886262306a36Sopenharmony_ci * @wiphy: the wiphy
886362306a36Sopenharmony_ci *
886462306a36Sopenharmony_ci * Return: the number of channels supported by the device.
886562306a36Sopenharmony_ci */
886662306a36Sopenharmony_ciunsigned int ieee80211_get_num_supported_channels(struct wiphy *wiphy);
886762306a36Sopenharmony_ci
886862306a36Sopenharmony_ci/**
886962306a36Sopenharmony_ci * cfg80211_check_combinations - check interface combinations
887062306a36Sopenharmony_ci *
887162306a36Sopenharmony_ci * @wiphy: the wiphy
887262306a36Sopenharmony_ci * @params: the interface combinations parameter
887362306a36Sopenharmony_ci *
887462306a36Sopenharmony_ci * This function can be called by the driver to check whether a
887562306a36Sopenharmony_ci * combination of interfaces and their types are allowed according to
887662306a36Sopenharmony_ci * the interface combinations.
887762306a36Sopenharmony_ci */
887862306a36Sopenharmony_ciint cfg80211_check_combinations(struct wiphy *wiphy,
887962306a36Sopenharmony_ci				struct iface_combination_params *params);
888062306a36Sopenharmony_ci
888162306a36Sopenharmony_ci/**
888262306a36Sopenharmony_ci * cfg80211_iter_combinations - iterate over matching combinations
888362306a36Sopenharmony_ci *
888462306a36Sopenharmony_ci * @wiphy: the wiphy
888562306a36Sopenharmony_ci * @params: the interface combinations parameter
888662306a36Sopenharmony_ci * @iter: function to call for each matching combination
888762306a36Sopenharmony_ci * @data: pointer to pass to iter function
888862306a36Sopenharmony_ci *
888962306a36Sopenharmony_ci * This function can be called by the driver to check what possible
889062306a36Sopenharmony_ci * combinations it fits in at a given moment, e.g. for channel switching
889162306a36Sopenharmony_ci * purposes.
889262306a36Sopenharmony_ci */
889362306a36Sopenharmony_ciint cfg80211_iter_combinations(struct wiphy *wiphy,
889462306a36Sopenharmony_ci			       struct iface_combination_params *params,
889562306a36Sopenharmony_ci			       void (*iter)(const struct ieee80211_iface_combination *c,
889662306a36Sopenharmony_ci					    void *data),
889762306a36Sopenharmony_ci			       void *data);
889862306a36Sopenharmony_ci
889962306a36Sopenharmony_ci/*
890062306a36Sopenharmony_ci * cfg80211_stop_iface - trigger interface disconnection
890162306a36Sopenharmony_ci *
890262306a36Sopenharmony_ci * @wiphy: the wiphy
890362306a36Sopenharmony_ci * @wdev: wireless device
890462306a36Sopenharmony_ci * @gfp: context flags
890562306a36Sopenharmony_ci *
890662306a36Sopenharmony_ci * Trigger interface to be stopped as if AP was stopped, IBSS/mesh left, STA
890762306a36Sopenharmony_ci * disconnected.
890862306a36Sopenharmony_ci *
890962306a36Sopenharmony_ci * Note: This doesn't need any locks and is asynchronous.
891062306a36Sopenharmony_ci */
891162306a36Sopenharmony_civoid cfg80211_stop_iface(struct wiphy *wiphy, struct wireless_dev *wdev,
891262306a36Sopenharmony_ci			 gfp_t gfp);
891362306a36Sopenharmony_ci
891462306a36Sopenharmony_ci/**
891562306a36Sopenharmony_ci * cfg80211_shutdown_all_interfaces - shut down all interfaces for a wiphy
891662306a36Sopenharmony_ci * @wiphy: the wiphy to shut down
891762306a36Sopenharmony_ci *
891862306a36Sopenharmony_ci * This function shuts down all interfaces belonging to this wiphy by
891962306a36Sopenharmony_ci * calling dev_close() (and treating non-netdev interfaces as needed).
892062306a36Sopenharmony_ci * It shouldn't really be used unless there are some fatal device errors
892162306a36Sopenharmony_ci * that really can't be recovered in any other way.
892262306a36Sopenharmony_ci *
892362306a36Sopenharmony_ci * Callers must hold the RTNL and be able to deal with callbacks into
892462306a36Sopenharmony_ci * the driver while the function is running.
892562306a36Sopenharmony_ci */
892662306a36Sopenharmony_civoid cfg80211_shutdown_all_interfaces(struct wiphy *wiphy);
892762306a36Sopenharmony_ci
892862306a36Sopenharmony_ci/**
892962306a36Sopenharmony_ci * wiphy_ext_feature_set - set the extended feature flag
893062306a36Sopenharmony_ci *
893162306a36Sopenharmony_ci * @wiphy: the wiphy to modify.
893262306a36Sopenharmony_ci * @ftidx: extended feature bit index.
893362306a36Sopenharmony_ci *
893462306a36Sopenharmony_ci * The extended features are flagged in multiple bytes (see
893562306a36Sopenharmony_ci * &struct wiphy.@ext_features)
893662306a36Sopenharmony_ci */
893762306a36Sopenharmony_cistatic inline void wiphy_ext_feature_set(struct wiphy *wiphy,
893862306a36Sopenharmony_ci					 enum nl80211_ext_feature_index ftidx)
893962306a36Sopenharmony_ci{
894062306a36Sopenharmony_ci	u8 *ft_byte;
894162306a36Sopenharmony_ci
894262306a36Sopenharmony_ci	ft_byte = &wiphy->ext_features[ftidx / 8];
894362306a36Sopenharmony_ci	*ft_byte |= BIT(ftidx % 8);
894462306a36Sopenharmony_ci}
894562306a36Sopenharmony_ci
894662306a36Sopenharmony_ci/**
894762306a36Sopenharmony_ci * wiphy_ext_feature_isset - check the extended feature flag
894862306a36Sopenharmony_ci *
894962306a36Sopenharmony_ci * @wiphy: the wiphy to modify.
895062306a36Sopenharmony_ci * @ftidx: extended feature bit index.
895162306a36Sopenharmony_ci *
895262306a36Sopenharmony_ci * The extended features are flagged in multiple bytes (see
895362306a36Sopenharmony_ci * &struct wiphy.@ext_features)
895462306a36Sopenharmony_ci */
895562306a36Sopenharmony_cistatic inline bool
895662306a36Sopenharmony_ciwiphy_ext_feature_isset(struct wiphy *wiphy,
895762306a36Sopenharmony_ci			enum nl80211_ext_feature_index ftidx)
895862306a36Sopenharmony_ci{
895962306a36Sopenharmony_ci	u8 ft_byte;
896062306a36Sopenharmony_ci
896162306a36Sopenharmony_ci	ft_byte = wiphy->ext_features[ftidx / 8];
896262306a36Sopenharmony_ci	return (ft_byte & BIT(ftidx % 8)) != 0;
896362306a36Sopenharmony_ci}
896462306a36Sopenharmony_ci
896562306a36Sopenharmony_ci/**
896662306a36Sopenharmony_ci * cfg80211_free_nan_func - free NAN function
896762306a36Sopenharmony_ci * @f: NAN function that should be freed
896862306a36Sopenharmony_ci *
896962306a36Sopenharmony_ci * Frees all the NAN function and all it's allocated members.
897062306a36Sopenharmony_ci */
897162306a36Sopenharmony_civoid cfg80211_free_nan_func(struct cfg80211_nan_func *f);
897262306a36Sopenharmony_ci
897362306a36Sopenharmony_ci/**
897462306a36Sopenharmony_ci * struct cfg80211_nan_match_params - NAN match parameters
897562306a36Sopenharmony_ci * @type: the type of the function that triggered a match. If it is
897662306a36Sopenharmony_ci *	 %NL80211_NAN_FUNC_SUBSCRIBE it means that we replied to a subscriber.
897762306a36Sopenharmony_ci *	 If it is %NL80211_NAN_FUNC_PUBLISH, it means that we got a discovery
897862306a36Sopenharmony_ci *	 result.
897962306a36Sopenharmony_ci *	 If it is %NL80211_NAN_FUNC_FOLLOW_UP, we received a follow up.
898062306a36Sopenharmony_ci * @inst_id: the local instance id
898162306a36Sopenharmony_ci * @peer_inst_id: the instance id of the peer's function
898262306a36Sopenharmony_ci * @addr: the MAC address of the peer
898362306a36Sopenharmony_ci * @info_len: the length of the &info
898462306a36Sopenharmony_ci * @info: the Service Specific Info from the peer (if any)
898562306a36Sopenharmony_ci * @cookie: unique identifier of the corresponding function
898662306a36Sopenharmony_ci */
898762306a36Sopenharmony_cistruct cfg80211_nan_match_params {
898862306a36Sopenharmony_ci	enum nl80211_nan_function_type type;
898962306a36Sopenharmony_ci	u8 inst_id;
899062306a36Sopenharmony_ci	u8 peer_inst_id;
899162306a36Sopenharmony_ci	const u8 *addr;
899262306a36Sopenharmony_ci	u8 info_len;
899362306a36Sopenharmony_ci	const u8 *info;
899462306a36Sopenharmony_ci	u64 cookie;
899562306a36Sopenharmony_ci};
899662306a36Sopenharmony_ci
899762306a36Sopenharmony_ci/**
899862306a36Sopenharmony_ci * cfg80211_nan_match - report a match for a NAN function.
899962306a36Sopenharmony_ci * @wdev: the wireless device reporting the match
900062306a36Sopenharmony_ci * @match: match notification parameters
900162306a36Sopenharmony_ci * @gfp: allocation flags
900262306a36Sopenharmony_ci *
900362306a36Sopenharmony_ci * This function reports that the a NAN function had a match. This
900462306a36Sopenharmony_ci * can be a subscribe that had a match or a solicited publish that
900562306a36Sopenharmony_ci * was sent. It can also be a follow up that was received.
900662306a36Sopenharmony_ci */
900762306a36Sopenharmony_civoid cfg80211_nan_match(struct wireless_dev *wdev,
900862306a36Sopenharmony_ci			struct cfg80211_nan_match_params *match, gfp_t gfp);
900962306a36Sopenharmony_ci
901062306a36Sopenharmony_ci/**
901162306a36Sopenharmony_ci * cfg80211_nan_func_terminated - notify about NAN function termination.
901262306a36Sopenharmony_ci *
901362306a36Sopenharmony_ci * @wdev: the wireless device reporting the match
901462306a36Sopenharmony_ci * @inst_id: the local instance id
901562306a36Sopenharmony_ci * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
901662306a36Sopenharmony_ci * @cookie: unique NAN function identifier
901762306a36Sopenharmony_ci * @gfp: allocation flags
901862306a36Sopenharmony_ci *
901962306a36Sopenharmony_ci * This function reports that the a NAN function is terminated.
902062306a36Sopenharmony_ci */
902162306a36Sopenharmony_civoid cfg80211_nan_func_terminated(struct wireless_dev *wdev,
902262306a36Sopenharmony_ci				  u8 inst_id,
902362306a36Sopenharmony_ci				  enum nl80211_nan_func_term_reason reason,
902462306a36Sopenharmony_ci				  u64 cookie, gfp_t gfp);
902562306a36Sopenharmony_ci
902662306a36Sopenharmony_ci/* ethtool helper */
902762306a36Sopenharmony_civoid cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info);
902862306a36Sopenharmony_ci
902962306a36Sopenharmony_ci/**
903062306a36Sopenharmony_ci * cfg80211_external_auth_request - userspace request for authentication
903162306a36Sopenharmony_ci * @netdev: network device
903262306a36Sopenharmony_ci * @params: External authentication parameters
903362306a36Sopenharmony_ci * @gfp: allocation flags
903462306a36Sopenharmony_ci * Returns: 0 on success, < 0 on error
903562306a36Sopenharmony_ci */
903662306a36Sopenharmony_ciint cfg80211_external_auth_request(struct net_device *netdev,
903762306a36Sopenharmony_ci				   struct cfg80211_external_auth_params *params,
903862306a36Sopenharmony_ci				   gfp_t gfp);
903962306a36Sopenharmony_ci
904062306a36Sopenharmony_ci/**
904162306a36Sopenharmony_ci * cfg80211_pmsr_report - report peer measurement result data
904262306a36Sopenharmony_ci * @wdev: the wireless device reporting the measurement
904362306a36Sopenharmony_ci * @req: the original measurement request
904462306a36Sopenharmony_ci * @result: the result data
904562306a36Sopenharmony_ci * @gfp: allocation flags
904662306a36Sopenharmony_ci */
904762306a36Sopenharmony_civoid cfg80211_pmsr_report(struct wireless_dev *wdev,
904862306a36Sopenharmony_ci			  struct cfg80211_pmsr_request *req,
904962306a36Sopenharmony_ci			  struct cfg80211_pmsr_result *result,
905062306a36Sopenharmony_ci			  gfp_t gfp);
905162306a36Sopenharmony_ci
905262306a36Sopenharmony_ci/**
905362306a36Sopenharmony_ci * cfg80211_pmsr_complete - report peer measurement completed
905462306a36Sopenharmony_ci * @wdev: the wireless device reporting the measurement
905562306a36Sopenharmony_ci * @req: the original measurement request
905662306a36Sopenharmony_ci * @gfp: allocation flags
905762306a36Sopenharmony_ci *
905862306a36Sopenharmony_ci * Report that the entire measurement completed, after this
905962306a36Sopenharmony_ci * the request pointer will no longer be valid.
906062306a36Sopenharmony_ci */
906162306a36Sopenharmony_civoid cfg80211_pmsr_complete(struct wireless_dev *wdev,
906262306a36Sopenharmony_ci			    struct cfg80211_pmsr_request *req,
906362306a36Sopenharmony_ci			    gfp_t gfp);
906462306a36Sopenharmony_ci
906562306a36Sopenharmony_ci/**
906662306a36Sopenharmony_ci * cfg80211_iftype_allowed - check whether the interface can be allowed
906762306a36Sopenharmony_ci * @wiphy: the wiphy
906862306a36Sopenharmony_ci * @iftype: interface type
906962306a36Sopenharmony_ci * @is_4addr: use_4addr flag, must be '0' when check_swif is '1'
907062306a36Sopenharmony_ci * @check_swif: check iftype against software interfaces
907162306a36Sopenharmony_ci *
907262306a36Sopenharmony_ci * Check whether the interface is allowed to operate; additionally, this API
907362306a36Sopenharmony_ci * can be used to check iftype against the software interfaces when
907462306a36Sopenharmony_ci * check_swif is '1'.
907562306a36Sopenharmony_ci */
907662306a36Sopenharmony_cibool cfg80211_iftype_allowed(struct wiphy *wiphy, enum nl80211_iftype iftype,
907762306a36Sopenharmony_ci			     bool is_4addr, u8 check_swif);
907862306a36Sopenharmony_ci
907962306a36Sopenharmony_ci
908062306a36Sopenharmony_ci/**
908162306a36Sopenharmony_ci * cfg80211_assoc_comeback - notification of association that was
908262306a36Sopenharmony_ci * temporarly rejected with a comeback
908362306a36Sopenharmony_ci * @netdev: network device
908462306a36Sopenharmony_ci * @ap_addr: AP (MLD) address that rejected the assocation
908562306a36Sopenharmony_ci * @timeout: timeout interval value TUs.
908662306a36Sopenharmony_ci *
908762306a36Sopenharmony_ci * this function may sleep. the caller must hold the corresponding wdev's mutex.
908862306a36Sopenharmony_ci */
908962306a36Sopenharmony_civoid cfg80211_assoc_comeback(struct net_device *netdev,
909062306a36Sopenharmony_ci			     const u8 *ap_addr, u32 timeout);
909162306a36Sopenharmony_ci
909262306a36Sopenharmony_ci/* Logging, debugging and troubleshooting/diagnostic helpers. */
909362306a36Sopenharmony_ci
909462306a36Sopenharmony_ci/* wiphy_printk helpers, similar to dev_printk */
909562306a36Sopenharmony_ci
909662306a36Sopenharmony_ci#define wiphy_printk(level, wiphy, format, args...)		\
909762306a36Sopenharmony_ci	dev_printk(level, &(wiphy)->dev, format, ##args)
909862306a36Sopenharmony_ci#define wiphy_emerg(wiphy, format, args...)			\
909962306a36Sopenharmony_ci	dev_emerg(&(wiphy)->dev, format, ##args)
910062306a36Sopenharmony_ci#define wiphy_alert(wiphy, format, args...)			\
910162306a36Sopenharmony_ci	dev_alert(&(wiphy)->dev, format, ##args)
910262306a36Sopenharmony_ci#define wiphy_crit(wiphy, format, args...)			\
910362306a36Sopenharmony_ci	dev_crit(&(wiphy)->dev, format, ##args)
910462306a36Sopenharmony_ci#define wiphy_err(wiphy, format, args...)			\
910562306a36Sopenharmony_ci	dev_err(&(wiphy)->dev, format, ##args)
910662306a36Sopenharmony_ci#define wiphy_warn(wiphy, format, args...)			\
910762306a36Sopenharmony_ci	dev_warn(&(wiphy)->dev, format, ##args)
910862306a36Sopenharmony_ci#define wiphy_notice(wiphy, format, args...)			\
910962306a36Sopenharmony_ci	dev_notice(&(wiphy)->dev, format, ##args)
911062306a36Sopenharmony_ci#define wiphy_info(wiphy, format, args...)			\
911162306a36Sopenharmony_ci	dev_info(&(wiphy)->dev, format, ##args)
911262306a36Sopenharmony_ci#define wiphy_info_once(wiphy, format, args...)			\
911362306a36Sopenharmony_ci	dev_info_once(&(wiphy)->dev, format, ##args)
911462306a36Sopenharmony_ci
911562306a36Sopenharmony_ci#define wiphy_err_ratelimited(wiphy, format, args...)		\
911662306a36Sopenharmony_ci	dev_err_ratelimited(&(wiphy)->dev, format, ##args)
911762306a36Sopenharmony_ci#define wiphy_warn_ratelimited(wiphy, format, args...)		\
911862306a36Sopenharmony_ci	dev_warn_ratelimited(&(wiphy)->dev, format, ##args)
911962306a36Sopenharmony_ci
912062306a36Sopenharmony_ci#define wiphy_debug(wiphy, format, args...)			\
912162306a36Sopenharmony_ci	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
912262306a36Sopenharmony_ci
912362306a36Sopenharmony_ci#define wiphy_dbg(wiphy, format, args...)			\
912462306a36Sopenharmony_ci	dev_dbg(&(wiphy)->dev, format, ##args)
912562306a36Sopenharmony_ci
912662306a36Sopenharmony_ci#if defined(VERBOSE_DEBUG)
912762306a36Sopenharmony_ci#define wiphy_vdbg	wiphy_dbg
912862306a36Sopenharmony_ci#else
912962306a36Sopenharmony_ci#define wiphy_vdbg(wiphy, format, args...)				\
913062306a36Sopenharmony_ci({									\
913162306a36Sopenharmony_ci	if (0)								\
913262306a36Sopenharmony_ci		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
913362306a36Sopenharmony_ci	0;								\
913462306a36Sopenharmony_ci})
913562306a36Sopenharmony_ci#endif
913662306a36Sopenharmony_ci
913762306a36Sopenharmony_ci/*
913862306a36Sopenharmony_ci * wiphy_WARN() acts like wiphy_printk(), but with the key difference
913962306a36Sopenharmony_ci * of using a WARN/WARN_ON to get the message out, including the
914062306a36Sopenharmony_ci * file/line information and a backtrace.
914162306a36Sopenharmony_ci */
914262306a36Sopenharmony_ci#define wiphy_WARN(wiphy, format, args...)			\
914362306a36Sopenharmony_ci	WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args);
914462306a36Sopenharmony_ci
914562306a36Sopenharmony_ci/**
914662306a36Sopenharmony_ci * cfg80211_update_owe_info_event - Notify the peer's OWE info to user space
914762306a36Sopenharmony_ci * @netdev: network device
914862306a36Sopenharmony_ci * @owe_info: peer's owe info
914962306a36Sopenharmony_ci * @gfp: allocation flags
915062306a36Sopenharmony_ci */
915162306a36Sopenharmony_civoid cfg80211_update_owe_info_event(struct net_device *netdev,
915262306a36Sopenharmony_ci				    struct cfg80211_update_owe_info *owe_info,
915362306a36Sopenharmony_ci				    gfp_t gfp);
915462306a36Sopenharmony_ci
915562306a36Sopenharmony_ci/**
915662306a36Sopenharmony_ci * cfg80211_bss_flush - resets all the scan entries
915762306a36Sopenharmony_ci * @wiphy: the wiphy
915862306a36Sopenharmony_ci */
915962306a36Sopenharmony_civoid cfg80211_bss_flush(struct wiphy *wiphy);
916062306a36Sopenharmony_ci
916162306a36Sopenharmony_ci/**
916262306a36Sopenharmony_ci * cfg80211_bss_color_notify - notify about bss color event
916362306a36Sopenharmony_ci * @dev: network device
916462306a36Sopenharmony_ci * @cmd: the actual event we want to notify
916562306a36Sopenharmony_ci * @count: the number of TBTTs until the color change happens
916662306a36Sopenharmony_ci * @color_bitmap: representations of the colors that the local BSS is aware of
916762306a36Sopenharmony_ci */
916862306a36Sopenharmony_ciint cfg80211_bss_color_notify(struct net_device *dev,
916962306a36Sopenharmony_ci			      enum nl80211_commands cmd, u8 count,
917062306a36Sopenharmony_ci			      u64 color_bitmap);
917162306a36Sopenharmony_ci
917262306a36Sopenharmony_ci/**
917362306a36Sopenharmony_ci * cfg80211_obss_color_collision_notify - notify about bss color collision
917462306a36Sopenharmony_ci * @dev: network device
917562306a36Sopenharmony_ci * @color_bitmap: representations of the colors that the local BSS is aware of
917662306a36Sopenharmony_ci */
917762306a36Sopenharmony_cistatic inline int cfg80211_obss_color_collision_notify(struct net_device *dev,
917862306a36Sopenharmony_ci						       u64 color_bitmap)
917962306a36Sopenharmony_ci{
918062306a36Sopenharmony_ci	return cfg80211_bss_color_notify(dev, NL80211_CMD_OBSS_COLOR_COLLISION,
918162306a36Sopenharmony_ci					 0, color_bitmap);
918262306a36Sopenharmony_ci}
918362306a36Sopenharmony_ci
918462306a36Sopenharmony_ci/**
918562306a36Sopenharmony_ci * cfg80211_color_change_started_notify - notify color change start
918662306a36Sopenharmony_ci * @dev: the device on which the color is switched
918762306a36Sopenharmony_ci * @count: the number of TBTTs until the color change happens
918862306a36Sopenharmony_ci *
918962306a36Sopenharmony_ci * Inform the userspace about the color change that has started.
919062306a36Sopenharmony_ci */
919162306a36Sopenharmony_cistatic inline int cfg80211_color_change_started_notify(struct net_device *dev,
919262306a36Sopenharmony_ci						       u8 count)
919362306a36Sopenharmony_ci{
919462306a36Sopenharmony_ci	return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_STARTED,
919562306a36Sopenharmony_ci					 count, 0);
919662306a36Sopenharmony_ci}
919762306a36Sopenharmony_ci
919862306a36Sopenharmony_ci/**
919962306a36Sopenharmony_ci * cfg80211_color_change_aborted_notify - notify color change abort
920062306a36Sopenharmony_ci * @dev: the device on which the color is switched
920162306a36Sopenharmony_ci *
920262306a36Sopenharmony_ci * Inform the userspace about the color change that has aborted.
920362306a36Sopenharmony_ci */
920462306a36Sopenharmony_cistatic inline int cfg80211_color_change_aborted_notify(struct net_device *dev)
920562306a36Sopenharmony_ci{
920662306a36Sopenharmony_ci	return cfg80211_bss_color_notify(dev, NL80211_CMD_COLOR_CHANGE_ABORTED,
920762306a36Sopenharmony_ci					 0, 0);
920862306a36Sopenharmony_ci}
920962306a36Sopenharmony_ci
921062306a36Sopenharmony_ci/**
921162306a36Sopenharmony_ci * cfg80211_color_change_notify - notify color change completion
921262306a36Sopenharmony_ci * @dev: the device on which the color was switched
921362306a36Sopenharmony_ci *
921462306a36Sopenharmony_ci * Inform the userspace about the color change that has completed.
921562306a36Sopenharmony_ci */
921662306a36Sopenharmony_cistatic inline int cfg80211_color_change_notify(struct net_device *dev)
921762306a36Sopenharmony_ci{
921862306a36Sopenharmony_ci	return cfg80211_bss_color_notify(dev,
921962306a36Sopenharmony_ci					 NL80211_CMD_COLOR_CHANGE_COMPLETED,
922062306a36Sopenharmony_ci					 0, 0);
922162306a36Sopenharmony_ci}
922262306a36Sopenharmony_ci
922362306a36Sopenharmony_ci/**
922462306a36Sopenharmony_ci * cfg80211_valid_disable_subchannel_bitmap - validate puncturing bitmap
922562306a36Sopenharmony_ci * @bitmap: bitmap to be validated
922662306a36Sopenharmony_ci * @chandef: channel definition
922762306a36Sopenharmony_ci *
922862306a36Sopenharmony_ci * Validate the puncturing bitmap.
922962306a36Sopenharmony_ci *
923062306a36Sopenharmony_ci * Return: %true if the bitmap is valid. %false otherwise.
923162306a36Sopenharmony_ci */
923262306a36Sopenharmony_cibool cfg80211_valid_disable_subchannel_bitmap(u16 *bitmap,
923362306a36Sopenharmony_ci					      const struct cfg80211_chan_def *chandef);
923462306a36Sopenharmony_ci
923562306a36Sopenharmony_ci/**
923662306a36Sopenharmony_ci * cfg80211_links_removed - Notify about removed STA MLD setup links.
923762306a36Sopenharmony_ci * @dev: network device.
923862306a36Sopenharmony_ci * @link_mask: BIT mask of removed STA MLD setup link IDs.
923962306a36Sopenharmony_ci *
924062306a36Sopenharmony_ci * Inform cfg80211 and the userspace about removed STA MLD setup links due to
924162306a36Sopenharmony_ci * AP MLD removing the corresponding affiliated APs with Multi-Link
924262306a36Sopenharmony_ci * reconfiguration. Note that it's not valid to remove all links, in this
924362306a36Sopenharmony_ci * case disconnect instead.
924462306a36Sopenharmony_ci * Also note that the wdev mutex must be held.
924562306a36Sopenharmony_ci */
924662306a36Sopenharmony_civoid cfg80211_links_removed(struct net_device *dev, u16 link_mask);
924762306a36Sopenharmony_ci
924862306a36Sopenharmony_ci#endif /* __NET_CFG80211_H */
9249