xref: /openbmc/linux/include/net/mac80211.h (revision 9144f784f852f9a125cabe9927b986d909bfa439)
1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2f0706e82SJiri Benc /*
33017b80bSJohannes Berg  * mac80211 <-> driver interface
43017b80bSJohannes Berg  *
5f0706e82SJiri Benc  * Copyright 2002-2005, Devicescape Software, Inc.
6f0706e82SJiri Benc  * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
7026331c4SJouni Malinen  * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
8d98ad83eSJohannes Berg  * Copyright 2013-2014  Intel Mobile Communications GmbH
9e38a017bSAvraham Stern  * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
101ec7291eSJohannes Berg  * Copyright (C) 2018 - 2023 Intel Corporation
11f0706e82SJiri Benc  */
12f0706e82SJiri Benc 
13f0706e82SJiri Benc #ifndef MAC80211_H
14f0706e82SJiri Benc #define MAC80211_H
15f0706e82SJiri Benc 
16187f1882SPaul Gortmaker #include <linux/bug.h>
17f0706e82SJiri Benc #include <linux/kernel.h>
18f0706e82SJiri Benc #include <linux/if_ether.h>
19f0706e82SJiri Benc #include <linux/skbuff.h>
20f0706e82SJiri Benc #include <linux/ieee80211.h>
2165fd846cSJohannes Berg #include <linux/lockdep.h>
22f0706e82SJiri Benc #include <net/cfg80211.h>
235caa328eSMichal Kazior #include <net/codel.h>
2441cbb0f5SLuca Coelho #include <net/ieee80211_radiotap.h>
2542d98795SJohannes Berg #include <asm/unaligned.h>
26f0706e82SJiri Benc 
2775a5f0ccSJohannes Berg /**
2875a5f0ccSJohannes Berg  * DOC: Introduction
2975a5f0ccSJohannes Berg  *
3075a5f0ccSJohannes Berg  * mac80211 is the Linux stack for 802.11 hardware that implements
3175a5f0ccSJohannes Berg  * only partial functionality in hard- or firmware. This document
3275a5f0ccSJohannes Berg  * defines the interface between mac80211 and low-level hardware
3375a5f0ccSJohannes Berg  * drivers.
3475a5f0ccSJohannes Berg  */
3575a5f0ccSJohannes Berg 
3675a5f0ccSJohannes Berg /**
3775a5f0ccSJohannes Berg  * DOC: Calling mac80211 from interrupts
3875a5f0ccSJohannes Berg  *
3975a5f0ccSJohannes Berg  * Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be
40f0706e82SJiri Benc  * called in hardware interrupt context. The low-level driver must not call any
41f0706e82SJiri Benc  * other functions in hardware interrupt context. If there is a need for such
42f0706e82SJiri Benc  * call, the low-level driver should first ACK the interrupt and perform the
432485f710SJohannes Berg  * IEEE 802.11 code call after this, e.g. from a scheduled workqueue or even
442485f710SJohannes Berg  * tasklet function.
452485f710SJohannes Berg  *
462485f710SJohannes Berg  * NOTE: If the driver opts to use the _irqsafe() functions, it may not also
476ef307bcSRandy Dunlap  *	 use the non-IRQ-safe functions!
48f0706e82SJiri Benc  */
49f0706e82SJiri Benc 
5075a5f0ccSJohannes Berg /**
5175a5f0ccSJohannes Berg  * DOC: Warning
52f0706e82SJiri Benc  *
5375a5f0ccSJohannes Berg  * If you're reading this document and not the header file itself, it will
5475a5f0ccSJohannes Berg  * be incomplete because not all documentation has been converted yet.
5575a5f0ccSJohannes Berg  */
5675a5f0ccSJohannes Berg 
5775a5f0ccSJohannes Berg /**
5875a5f0ccSJohannes Berg  * DOC: Frame format
59f0706e82SJiri Benc  *
6075a5f0ccSJohannes Berg  * As a general rule, when frames are passed between mac80211 and the driver,
6175a5f0ccSJohannes Berg  * they start with the IEEE 802.11 header and include the same octets that are
6275a5f0ccSJohannes Berg  * sent over the air except for the FCS which should be calculated by the
6375a5f0ccSJohannes Berg  * hardware.
6475a5f0ccSJohannes Berg  *
6575a5f0ccSJohannes Berg  * There are, however, various exceptions to this rule for advanced features:
6675a5f0ccSJohannes Berg  *
6775a5f0ccSJohannes Berg  * The first exception is for hardware encryption and decryption offload
6875a5f0ccSJohannes Berg  * where the IV/ICV may or may not be generated in hardware.
6975a5f0ccSJohannes Berg  *
7075a5f0ccSJohannes Berg  * Secondly, when the hardware handles fragmentation, the frame handed to
7175a5f0ccSJohannes Berg  * the driver from mac80211 is the MSDU, not the MPDU.
72f0706e82SJiri Benc  */
73f0706e82SJiri Benc 
7410816d40SRon Rindjunsky /**
7542935ecaSLuis R. Rodriguez  * DOC: mac80211 workqueue
7642935ecaSLuis R. Rodriguez  *
7742935ecaSLuis R. Rodriguez  * mac80211 provides its own workqueue for drivers and internal mac80211 use.
7842935ecaSLuis R. Rodriguez  * The workqueue is a single threaded workqueue and can only be accessed by
7942935ecaSLuis R. Rodriguez  * helpers for sanity checking. Drivers must ensure all work added onto the
8042935ecaSLuis R. Rodriguez  * mac80211 workqueue should be cancelled on the driver stop() callback.
8142935ecaSLuis R. Rodriguez  *
8242935ecaSLuis R. Rodriguez  * mac80211 will flushed the workqueue upon interface removal and during
8342935ecaSLuis R. Rodriguez  * suspend.
8442935ecaSLuis R. Rodriguez  *
8542935ecaSLuis R. Rodriguez  * All work performed on the mac80211 workqueue must not acquire the RTNL lock.
8642935ecaSLuis R. Rodriguez  *
8742935ecaSLuis R. Rodriguez  */
8842935ecaSLuis R. Rodriguez 
89ba8c3d6fSFelix Fietkau /**
90ba8c3d6fSFelix Fietkau  * DOC: mac80211 software tx queueing
91ba8c3d6fSFelix Fietkau  *
92c850e31fSAlexander Wetzel  * mac80211 uses an intermediate queueing implementation, designed to allow the
93c850e31fSAlexander Wetzel  * driver to keep hardware queues short and to provide some fairness between
94c850e31fSAlexander Wetzel  * different stations/interfaces.
95ba8c3d6fSFelix Fietkau  *
96c850e31fSAlexander Wetzel  * Drivers must provide the .wake_tx_queue driver operation by either
97c850e31fSAlexander Wetzel  * linking it to ieee80211_handle_wake_tx_queue() or implementing a custom
98c850e31fSAlexander Wetzel  * handler.
99ba8c3d6fSFelix Fietkau  *
100adf8ed01SJohannes Berg  * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with
101adf8ed01SJohannes Berg  * another per-sta for non-data/non-mgmt and bufferable management frames, and
102adf8ed01SJohannes Berg  * a single per-vif queue for multicast data frames.
103ba8c3d6fSFelix Fietkau  *
104ba8c3d6fSFelix Fietkau  * The driver is expected to initialize its private per-queue data for stations
105ba8c3d6fSFelix Fietkau  * and interfaces in the .add_interface and .sta_add ops.
106ba8c3d6fSFelix Fietkau  *
107c850e31fSAlexander Wetzel  * The driver can't access the internal TX queues (iTXQs) directly.
108c850e31fSAlexander Wetzel  * Whenever mac80211 adds a new frame to a queue, it calls the .wake_tx_queue
109c850e31fSAlexander Wetzel  * driver op.
110c850e31fSAlexander Wetzel  * Drivers implementing a custom .wake_tx_queue op can get them by calling
111c850e31fSAlexander Wetzel  * ieee80211_tx_dequeue(). Drivers using ieee80211_handle_wake_tx_queue() will
112c850e31fSAlexander Wetzel  * simply get the individual frames pushed via the .tx driver operation.
11318667600SToke Høiland-Jørgensen  *
11418667600SToke Høiland-Jørgensen  * Drivers can optionally delegate responsibility for scheduling queues to
11518667600SToke Høiland-Jørgensen  * mac80211, to take advantage of airtime fairness accounting. In this case, to
11618667600SToke Høiland-Jørgensen  * obtain the next queue to pull frames from, the driver calls
11718667600SToke Høiland-Jørgensen  * ieee80211_next_txq(). The driver is then expected to return the txq using
11818667600SToke Høiland-Jørgensen  * ieee80211_return_txq().
119ba8c3d6fSFelix Fietkau  *
120ba8c3d6fSFelix Fietkau  * For AP powersave TIM handling, the driver only needs to indicate if it has
121ba8c3d6fSFelix Fietkau  * buffered packets in the driver specific data structures by calling
122ba8c3d6fSFelix Fietkau  * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
123ba8c3d6fSFelix Fietkau  * struct, mac80211 sets the appropriate TIM PVB bits and calls
124ba8c3d6fSFelix Fietkau  * .release_buffered_frames().
125ba8c3d6fSFelix Fietkau  * In that callback the driver is therefore expected to release its own
126ba8c3d6fSFelix Fietkau  * buffered frames and afterwards also frames from the ieee80211_txq (obtained
127ba8c3d6fSFelix Fietkau  * via the usual ieee80211_tx_dequeue).
128ba8c3d6fSFelix Fietkau  */
129ba8c3d6fSFelix Fietkau 
130f9202638SAvraham Stern /**
131f9202638SAvraham Stern  * DOC: HW timestamping
132f9202638SAvraham Stern  *
133f9202638SAvraham Stern  * Timing Measurement and Fine Timing Measurement require accurate timestamps
134f9202638SAvraham Stern  * of the action frames TX/RX and their respective acks.
135f9202638SAvraham Stern  *
136f9202638SAvraham Stern  * To report hardware timestamps for Timing Measurement or Fine Timing
137f9202638SAvraham Stern  * Measurement frame RX, the low level driver should set the SKB's hwtstamp
138f9202638SAvraham Stern  * field to the frame RX timestamp and report the ack TX timestamp in the
139f9202638SAvraham Stern  * ieee80211_rx_status struct.
140f9202638SAvraham Stern  *
141f9202638SAvraham Stern  * Similarly, To report hardware timestamps for Timing Measurement or Fine
142f9202638SAvraham Stern  * Timing Measurement frame TX, the driver should set the SKB's hwtstamp field
143f9202638SAvraham Stern  * to the frame TX timestamp and report the ack RX timestamp in the
144f9202638SAvraham Stern  * ieee80211_tx_status struct.
145f9202638SAvraham Stern  */
146313162d0SPaul Gortmaker struct device;
147313162d0SPaul Gortmaker 
14842935ecaSLuis R. Rodriguez /**
149e100bb64SJohannes Berg  * enum ieee80211_max_queues - maximum number of queues
150e100bb64SJohannes Berg  *
151e100bb64SJohannes Berg  * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
152445ea4e8SJohannes Berg  * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set
153e100bb64SJohannes Berg  */
154e100bb64SJohannes Berg enum ieee80211_max_queues {
1553a25a8c8SJohannes Berg 	IEEE80211_MAX_QUEUES =		16,
156445ea4e8SJohannes Berg 	IEEE80211_MAX_QUEUE_MAP =	BIT(IEEE80211_MAX_QUEUES) - 1,
157e100bb64SJohannes Berg };
158e100bb64SJohannes Berg 
1593a25a8c8SJohannes Berg #define IEEE80211_INVAL_HW_QUEUE	0xff
1603a25a8c8SJohannes Berg 
161e100bb64SJohannes Berg /**
1624bce22b9SJohannes Berg  * enum ieee80211_ac_numbers - AC numbers as used in mac80211
1634bce22b9SJohannes Berg  * @IEEE80211_AC_VO: voice
1644bce22b9SJohannes Berg  * @IEEE80211_AC_VI: video
1654bce22b9SJohannes Berg  * @IEEE80211_AC_BE: best effort
1664bce22b9SJohannes Berg  * @IEEE80211_AC_BK: background
1674bce22b9SJohannes Berg  */
1684bce22b9SJohannes Berg enum ieee80211_ac_numbers {
1694bce22b9SJohannes Berg 	IEEE80211_AC_VO		= 0,
1704bce22b9SJohannes Berg 	IEEE80211_AC_VI		= 1,
1714bce22b9SJohannes Berg 	IEEE80211_AC_BE		= 2,
1724bce22b9SJohannes Berg 	IEEE80211_AC_BK		= 3,
1734bce22b9SJohannes Berg };
1744bce22b9SJohannes Berg 
1754bce22b9SJohannes Berg /**
1766b301cdfSJohannes Berg  * struct ieee80211_tx_queue_params - transmit queue configuration
1776b301cdfSJohannes Berg  *
1786b301cdfSJohannes Berg  * The information provided in this structure is required for QoS
1793330d7beSJohannes Berg  * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
1806b301cdfSJohannes Berg  *
181e37d4dffSBob Copeland  * @aifs: arbitration interframe space [0..255]
182f434b2d1SJohannes Berg  * @cw_min: minimum contention window [a value of the form
183f434b2d1SJohannes Berg  *	2^n-1 in the range 1..32767]
1846b301cdfSJohannes Berg  * @cw_max: maximum contention window [like @cw_min]
1853330d7beSJohannes Berg  * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
186908f8d07SAlexander Bondar  * @acm: is mandatory admission control required for the access category
1879d173fc5SKalle Valo  * @uapsd: is U-APSD mode enabled for the queue
18841cbb0f5SLuca Coelho  * @mu_edca: is the MU EDCA configured
18941cbb0f5SLuca Coelho  * @mu_edca_param_rec: MU EDCA Parameter Record for HE
1906b301cdfSJohannes Berg  */
191f0706e82SJiri Benc struct ieee80211_tx_queue_params {
192f434b2d1SJohannes Berg 	u16 txop;
1933330d7beSJohannes Berg 	u16 cw_min;
1943330d7beSJohannes Berg 	u16 cw_max;
195f434b2d1SJohannes Berg 	u8 aifs;
196908f8d07SAlexander Bondar 	bool acm;
197ab13315aSKalle Valo 	bool uapsd;
19841cbb0f5SLuca Coelho 	bool mu_edca;
19941cbb0f5SLuca Coelho 	struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec;
200f0706e82SJiri Benc };
201f0706e82SJiri Benc 
202f0706e82SJiri Benc struct ieee80211_low_level_stats {
203f0706e82SJiri Benc 	unsigned int dot11ACKFailureCount;
204f0706e82SJiri Benc 	unsigned int dot11RTSFailureCount;
205f0706e82SJiri Benc 	unsigned int dot11FCSErrorCount;
206f0706e82SJiri Benc 	unsigned int dot11RTSSuccessCount;
207f0706e82SJiri Benc };
208f0706e82SJiri Benc 
209471b3efdSJohannes Berg /**
210d01a1e65SMichal Kazior  * enum ieee80211_chanctx_change - change flag for channel context
2114bf88530SJohannes Berg  * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed
21204ecd257SJohannes Berg  * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed
213164eb02dSSimon Wunderlich  * @IEEE80211_CHANCTX_CHANGE_RADAR: radar detection flag changed
21473da7d5bSSimon Wunderlich  * @IEEE80211_CHANCTX_CHANGE_CHANNEL: switched to another operating channel,
21573da7d5bSSimon Wunderlich  *	this is used only with channel switching with CSA
21621f659bfSEliad Peller  * @IEEE80211_CHANCTX_CHANGE_MIN_WIDTH: The min required channel width changed
217d01a1e65SMichal Kazior  */
218d01a1e65SMichal Kazior enum ieee80211_chanctx_change {
2194bf88530SJohannes Berg 	IEEE80211_CHANCTX_CHANGE_WIDTH		= BIT(0),
22004ecd257SJohannes Berg 	IEEE80211_CHANCTX_CHANGE_RX_CHAINS	= BIT(1),
221164eb02dSSimon Wunderlich 	IEEE80211_CHANCTX_CHANGE_RADAR		= BIT(2),
22273da7d5bSSimon Wunderlich 	IEEE80211_CHANCTX_CHANGE_CHANNEL	= BIT(3),
22321f659bfSEliad Peller 	IEEE80211_CHANCTX_CHANGE_MIN_WIDTH	= BIT(4),
224d01a1e65SMichal Kazior };
225d01a1e65SMichal Kazior 
226d01a1e65SMichal Kazior /**
227d01a1e65SMichal Kazior  * struct ieee80211_chanctx_conf - channel context that vifs may be tuned to
228d01a1e65SMichal Kazior  *
229d01a1e65SMichal Kazior  * This is the driver-visible part. The ieee80211_chanctx
230d01a1e65SMichal Kazior  * that contains it is visible in mac80211 only.
231d01a1e65SMichal Kazior  *
2324bf88530SJohannes Berg  * @def: the channel definition
23321f659bfSEliad Peller  * @min_def: the minimum channel definition currently required.
23404ecd257SJohannes Berg  * @rx_chains_static: The number of RX chains that must always be
23504ecd257SJohannes Berg  *	active on the channel to receive MIMO transmissions
23604ecd257SJohannes Berg  * @rx_chains_dynamic: The number of RX chains that must be enabled
23704ecd257SJohannes Berg  *	after RTS/CTS handshake to receive SMPS MIMO transmissions;
2385d7fad48SSimon Wunderlich  *	this will always be >= @rx_chains_static.
239164eb02dSSimon Wunderlich  * @radar_enabled: whether radar detection is enabled on this channel.
240d01a1e65SMichal Kazior  * @drv_priv: data area for driver use, will always be aligned to
241d01a1e65SMichal Kazior  *	sizeof(void *), size is determined in hw information.
242d01a1e65SMichal Kazior  */
243d01a1e65SMichal Kazior struct ieee80211_chanctx_conf {
2444bf88530SJohannes Berg 	struct cfg80211_chan_def def;
24521f659bfSEliad Peller 	struct cfg80211_chan_def min_def;
246d01a1e65SMichal Kazior 
24704ecd257SJohannes Berg 	u8 rx_chains_static, rx_chains_dynamic;
24804ecd257SJohannes Berg 
249164eb02dSSimon Wunderlich 	bool radar_enabled;
250164eb02dSSimon Wunderlich 
2513c23215bSGustavo A. R. Silva 	u8 drv_priv[] __aligned(sizeof(void *));
252d01a1e65SMichal Kazior };
253d01a1e65SMichal Kazior 
254d01a1e65SMichal Kazior /**
2551a5f0c13SLuciano Coelho  * enum ieee80211_chanctx_switch_mode - channel context switch mode
2561a5f0c13SLuciano Coelho  * @CHANCTX_SWMODE_REASSIGN_VIF: Both old and new contexts already
2571a5f0c13SLuciano Coelho  *	exist (and will continue to exist), but the virtual interface
2581a5f0c13SLuciano Coelho  *	needs to be switched from one to the other.
2591a5f0c13SLuciano Coelho  * @CHANCTX_SWMODE_SWAP_CONTEXTS: The old context exists but will stop
2601a5f0c13SLuciano Coelho  *      to exist with this call, the new context doesn't exist but
2611a5f0c13SLuciano Coelho  *      will be active after this call, the virtual interface switches
2621a5f0c13SLuciano Coelho  *      from the old to the new (note that the driver may of course
2631a5f0c13SLuciano Coelho  *      implement this as an on-the-fly chandef switch of the existing
2641a5f0c13SLuciano Coelho  *      hardware context, but the mac80211 pointer for the old context
2651a5f0c13SLuciano Coelho  *      will cease to exist and only the new one will later be used
2661a5f0c13SLuciano Coelho  *      for changes/removal.)
2671a5f0c13SLuciano Coelho  */
2681a5f0c13SLuciano Coelho enum ieee80211_chanctx_switch_mode {
2691a5f0c13SLuciano Coelho 	CHANCTX_SWMODE_REASSIGN_VIF,
2701a5f0c13SLuciano Coelho 	CHANCTX_SWMODE_SWAP_CONTEXTS,
2711a5f0c13SLuciano Coelho };
2721a5f0c13SLuciano Coelho 
2731a5f0c13SLuciano Coelho /**
2741a5f0c13SLuciano Coelho  * struct ieee80211_vif_chanctx_switch - vif chanctx switch information
2751a5f0c13SLuciano Coelho  *
2761a5f0c13SLuciano Coelho  * This is structure is used to pass information about a vif that
2771a5f0c13SLuciano Coelho  * needs to switch from one chanctx to another.  The
2781a5f0c13SLuciano Coelho  * &ieee80211_chanctx_switch_mode defines how the switch should be
2791a5f0c13SLuciano Coelho  * done.
2801a5f0c13SLuciano Coelho  *
2811a5f0c13SLuciano Coelho  * @vif: the vif that should be switched from old_ctx to new_ctx
282727eff4dSGregory Greenman  * @link_conf: the link conf that's switching
2831a5f0c13SLuciano Coelho  * @old_ctx: the old context to which the vif was assigned
2841a5f0c13SLuciano Coelho  * @new_ctx: the new context to which the vif must be assigned
2851a5f0c13SLuciano Coelho  */
2861a5f0c13SLuciano Coelho struct ieee80211_vif_chanctx_switch {
2871a5f0c13SLuciano Coelho 	struct ieee80211_vif *vif;
288727eff4dSGregory Greenman 	struct ieee80211_bss_conf *link_conf;
2891a5f0c13SLuciano Coelho 	struct ieee80211_chanctx_conf *old_ctx;
2901a5f0c13SLuciano Coelho 	struct ieee80211_chanctx_conf *new_ctx;
2911a5f0c13SLuciano Coelho };
2921a5f0c13SLuciano Coelho 
2931a5f0c13SLuciano Coelho /**
294471b3efdSJohannes Berg  * enum ieee80211_bss_change - BSS change notification flags
295471b3efdSJohannes Berg  *
2967b7090b4SJohannes Berg  * These flags are used with the bss_info_changed(), link_info_changed()
2977b7090b4SJohannes Berg  * and vif_cfg_changed() callbacks to indicate which parameter(s) changed.
298471b3efdSJohannes Berg  *
299471b3efdSJohannes Berg  * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated),
300471b3efdSJohannes Berg  *	also implies a change in the AID.
301471b3efdSJohannes Berg  * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed
302471b3efdSJohannes Berg  * @BSS_CHANGED_ERP_PREAMBLE: preamble changed
3039f1ba906SJouni Malinen  * @BSS_CHANGED_ERP_SLOT: slot timing changed
30438668c05STomas Winkler  * @BSS_CHANGED_HT: 802.11n parameters changed
30596dd22acSJohannes Berg  * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
30657c4d7b4SJohannes Berg  * @BSS_CHANGED_BEACON_INT: Beacon interval changed
3072d0ddec5SJohannes Berg  * @BSS_CHANGED_BSSID: BSSID changed, for whatever
3082d0ddec5SJohannes Berg  *	reason (IBSS and managed mode)
3092d0ddec5SJohannes Berg  * @BSS_CHANGED_BEACON: Beacon data changed, retrieve
3102d0ddec5SJohannes Berg  *	new beacon (beaconing modes)
3112d0ddec5SJohannes Berg  * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
3122d0ddec5SJohannes Berg  *	enabled/disabled (beaconing modes)
313a97c13c3SJuuso Oikarinen  * @BSS_CHANGED_CQM: Connection quality monitor config changed
3148fc214baSJohannes Berg  * @BSS_CHANGED_IBSS: IBSS join status changed
31568542962SJuuso Oikarinen  * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed.
3164ced3f74SJohannes Berg  * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note
3174ced3f74SJohannes Berg  *	that it is only ever disabled for station mode.
3187da7cc1dSJohannes Berg  * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
3190ca54f6cSMarek Puzyniak  * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode)
32002945821SArik Nemtsov  * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
321ab095877SEliad Peller  * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
3221ea6f9c0SJohannes Berg  * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
323488dd7b5SJohannes Berg  * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
32452cfa1d6SAyala Beker  *	changed
325989c6505SAlexander Bondar  * @BSS_CHANGED_BEACON_INFO: Data from the AP's beacon became available:
326989c6505SAlexander Bondar  *	currently dtim_period only is under consideration.
3272c9b7359SJohannes Berg  * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed,
3282c9b7359SJohannes Berg  *	note that this is only called when it changes after the channel
3292c9b7359SJohannes Berg  *	context had been assigned.
330239281f8SRostislav Lisovy  * @BSS_CHANGED_OCB: OCB join status changed
33123a1f8d4SSara Sharon  * @BSS_CHANGED_MU_GROUPS: VHT MU-MIMO group id or user position changed
332e38a017bSAvraham Stern  * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected
333e38a017bSAvraham Stern  *	keep alive) changed.
334dcbe73caSPradeep Kumar Chitrapu  * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface
335ae4a50eeSChris Packham  * @BSS_CHANGED_FTM_RESPONDER: fine timing measurement request responder
336bc847970SPradeep Kumar Chitrapu  *	functionality changed for this BSS (AP mode).
337c9d3245eSJohn Crispin  * @BSS_CHANGED_TWT: TWT status changed
3381ced169cSJohn Crispin  * @BSS_CHANGED_HE_OBSS_PD: OBSS Packet Detection status changed.
339dd56e902SJohn Crispin  * @BSS_CHANGED_HE_BSS_COLOR: BSS Color has changed
340295b02c4SAloka Dixit  * @BSS_CHANGED_FILS_DISCOVERY: FILS discovery status changed.
341632189a0SAloka Dixit  * @BSS_CHANGED_UNSOL_BCAST_PROBE_RESP: Unsolicited broadcast probe response
342632189a0SAloka Dixit  *	status changed.
343aa87cd8bSJohannes Berg  * @BSS_CHANGED_EHT_PUNCTURING: The channel puncturing bitmap changed.
344471b3efdSJohannes Berg  */
345471b3efdSJohannes Berg enum ieee80211_bss_change {
346471b3efdSJohannes Berg 	BSS_CHANGED_ASSOC		= 1<<0,
347471b3efdSJohannes Berg 	BSS_CHANGED_ERP_CTS_PROT	= 1<<1,
348471b3efdSJohannes Berg 	BSS_CHANGED_ERP_PREAMBLE	= 1<<2,
3499f1ba906SJouni Malinen 	BSS_CHANGED_ERP_SLOT		= 1<<3,
35038668c05STomas Winkler 	BSS_CHANGED_HT			= 1<<4,
35196dd22acSJohannes Berg 	BSS_CHANGED_BASIC_RATES		= 1<<5,
35257c4d7b4SJohannes Berg 	BSS_CHANGED_BEACON_INT		= 1<<6,
3532d0ddec5SJohannes Berg 	BSS_CHANGED_BSSID		= 1<<7,
3542d0ddec5SJohannes Berg 	BSS_CHANGED_BEACON		= 1<<8,
3552d0ddec5SJohannes Berg 	BSS_CHANGED_BEACON_ENABLED	= 1<<9,
356a97c13c3SJuuso Oikarinen 	BSS_CHANGED_CQM			= 1<<10,
3578fc214baSJohannes Berg 	BSS_CHANGED_IBSS		= 1<<11,
35868542962SJuuso Oikarinen 	BSS_CHANGED_ARP_FILTER		= 1<<12,
3594ced3f74SJohannes Berg 	BSS_CHANGED_QOS			= 1<<13,
3607da7cc1dSJohannes Berg 	BSS_CHANGED_IDLE		= 1<<14,
3617827493bSArik Nemtsov 	BSS_CHANGED_SSID		= 1<<15,
36202945821SArik Nemtsov 	BSS_CHANGED_AP_PROBE_RESP	= 1<<16,
363ab095877SEliad Peller 	BSS_CHANGED_PS			= 1<<17,
3641ea6f9c0SJohannes Berg 	BSS_CHANGED_TXPOWER		= 1<<18,
365488dd7b5SJohannes Berg 	BSS_CHANGED_P2P_PS		= 1<<19,
366989c6505SAlexander Bondar 	BSS_CHANGED_BEACON_INFO		= 1<<20,
3672c9b7359SJohannes Berg 	BSS_CHANGED_BANDWIDTH		= 1<<21,
368239281f8SRostislav Lisovy 	BSS_CHANGED_OCB                 = 1<<22,
36923a1f8d4SSara Sharon 	BSS_CHANGED_MU_GROUPS		= 1<<23,
370e38a017bSAvraham Stern 	BSS_CHANGED_KEEP_ALIVE		= 1<<24,
371dcbe73caSPradeep Kumar Chitrapu 	BSS_CHANGED_MCAST_RATE		= 1<<25,
372bc847970SPradeep Kumar Chitrapu 	BSS_CHANGED_FTM_RESPONDER	= 1<<26,
373c9d3245eSJohn Crispin 	BSS_CHANGED_TWT			= 1<<27,
3741ced169cSJohn Crispin 	BSS_CHANGED_HE_OBSS_PD		= 1<<28,
375dd56e902SJohn Crispin 	BSS_CHANGED_HE_BSS_COLOR	= 1<<29,
376295b02c4SAloka Dixit 	BSS_CHANGED_FILS_DISCOVERY      = 1<<30,
377632189a0SAloka Dixit 	BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = 1<<31,
378aa87cd8bSJohannes Berg 	BSS_CHANGED_EHT_PUNCTURING	= BIT_ULL(32),
379ac8dd506SJohannes Berg 
380ac8dd506SJohannes Berg 	/* when adding here, make sure to change ieee80211_reconfig */
381471b3efdSJohannes Berg };
382471b3efdSJohannes Berg 
38368542962SJuuso Oikarinen /*
38468542962SJuuso Oikarinen  * The maximum number of IPv4 addresses listed for ARP filtering. If the number
38568542962SJuuso Oikarinen  * of addresses for an interface increase beyond this value, hardware ARP
38668542962SJuuso Oikarinen  * filtering will be disabled.
38768542962SJuuso Oikarinen  */
38868542962SJuuso Oikarinen #define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
38968542962SJuuso Oikarinen 
390471b3efdSJohannes Berg /**
391a8182929SEmmanuel Grumbach  * enum ieee80211_event_type - event to be notified to the low level driver
392a8182929SEmmanuel Grumbach  * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver.
393a9409093SEmmanuel Grumbach  * @MLME_EVENT: event related to MLME
3946382246eSEmmanuel Grumbach  * @BAR_RX_EVENT: a BAR was received
395b497de63SEmmanuel Grumbach  * @BA_FRAME_TIMEOUT: Frames were released from the reordering buffer because
396b497de63SEmmanuel Grumbach  *	they timed out. This won't be called for each frame released, but only
397b497de63SEmmanuel Grumbach  *	once each time the timeout triggers.
398615f7b9bSMeenakshi Venkataraman  */
399a8182929SEmmanuel Grumbach enum ieee80211_event_type {
400a8182929SEmmanuel Grumbach 	RSSI_EVENT,
401a9409093SEmmanuel Grumbach 	MLME_EVENT,
4026382246eSEmmanuel Grumbach 	BAR_RX_EVENT,
403b497de63SEmmanuel Grumbach 	BA_FRAME_TIMEOUT,
404a8182929SEmmanuel Grumbach };
405a8182929SEmmanuel Grumbach 
406a8182929SEmmanuel Grumbach /**
407a8182929SEmmanuel Grumbach  * enum ieee80211_rssi_event_data - relevant when event type is %RSSI_EVENT
408a8182929SEmmanuel Grumbach  * @RSSI_EVENT_HIGH: AP's rssi went below the threshold set by the driver.
409a8182929SEmmanuel Grumbach  * @RSSI_EVENT_LOW: AP's rssi went above the threshold set by the driver.
410a8182929SEmmanuel Grumbach  */
411a8182929SEmmanuel Grumbach enum ieee80211_rssi_event_data {
412615f7b9bSMeenakshi Venkataraman 	RSSI_EVENT_HIGH,
413615f7b9bSMeenakshi Venkataraman 	RSSI_EVENT_LOW,
414615f7b9bSMeenakshi Venkataraman };
415615f7b9bSMeenakshi Venkataraman 
416615f7b9bSMeenakshi Venkataraman /**
417a839e463SJonathan Corbet  * struct ieee80211_rssi_event - data attached to an %RSSI_EVENT
418a8182929SEmmanuel Grumbach  * @data: See &enum ieee80211_rssi_event_data
419a8182929SEmmanuel Grumbach  */
420a8182929SEmmanuel Grumbach struct ieee80211_rssi_event {
421a8182929SEmmanuel Grumbach 	enum ieee80211_rssi_event_data data;
422a8182929SEmmanuel Grumbach };
423a8182929SEmmanuel Grumbach 
424a8182929SEmmanuel Grumbach /**
425a9409093SEmmanuel Grumbach  * enum ieee80211_mlme_event_data - relevant when event type is %MLME_EVENT
426a9409093SEmmanuel Grumbach  * @AUTH_EVENT: the MLME operation is authentication
427d0d1a12fSEmmanuel Grumbach  * @ASSOC_EVENT: the MLME operation is association
428a90faa9dSEmmanuel Grumbach  * @DEAUTH_RX_EVENT: deauth received..
429a90faa9dSEmmanuel Grumbach  * @DEAUTH_TX_EVENT: deauth sent.
430a9409093SEmmanuel Grumbach  */
431a9409093SEmmanuel Grumbach enum ieee80211_mlme_event_data {
432a9409093SEmmanuel Grumbach 	AUTH_EVENT,
433d0d1a12fSEmmanuel Grumbach 	ASSOC_EVENT,
434a90faa9dSEmmanuel Grumbach 	DEAUTH_RX_EVENT,
435a90faa9dSEmmanuel Grumbach 	DEAUTH_TX_EVENT,
436a9409093SEmmanuel Grumbach };
437a9409093SEmmanuel Grumbach 
438a9409093SEmmanuel Grumbach /**
439a9409093SEmmanuel Grumbach  * enum ieee80211_mlme_event_status - relevant when event type is %MLME_EVENT
440a9409093SEmmanuel Grumbach  * @MLME_SUCCESS: the MLME operation completed successfully.
441a9409093SEmmanuel Grumbach  * @MLME_DENIED: the MLME operation was denied by the peer.
442a9409093SEmmanuel Grumbach  * @MLME_TIMEOUT: the MLME operation timed out.
443a9409093SEmmanuel Grumbach  */
444a9409093SEmmanuel Grumbach enum ieee80211_mlme_event_status {
445a9409093SEmmanuel Grumbach 	MLME_SUCCESS,
446a9409093SEmmanuel Grumbach 	MLME_DENIED,
447a9409093SEmmanuel Grumbach 	MLME_TIMEOUT,
448a9409093SEmmanuel Grumbach };
449a9409093SEmmanuel Grumbach 
450a9409093SEmmanuel Grumbach /**
451a839e463SJonathan Corbet  * struct ieee80211_mlme_event - data attached to an %MLME_EVENT
452a9409093SEmmanuel Grumbach  * @data: See &enum ieee80211_mlme_event_data
453a9409093SEmmanuel Grumbach  * @status: See &enum ieee80211_mlme_event_status
454a9409093SEmmanuel Grumbach  * @reason: the reason code if applicable
455a9409093SEmmanuel Grumbach  */
456a9409093SEmmanuel Grumbach struct ieee80211_mlme_event {
457a9409093SEmmanuel Grumbach 	enum ieee80211_mlme_event_data data;
458a9409093SEmmanuel Grumbach 	enum ieee80211_mlme_event_status status;
459a9409093SEmmanuel Grumbach 	u16 reason;
460a9409093SEmmanuel Grumbach };
461a9409093SEmmanuel Grumbach 
462a9409093SEmmanuel Grumbach /**
4636382246eSEmmanuel Grumbach  * struct ieee80211_ba_event - data attached for BlockAck related events
4646382246eSEmmanuel Grumbach  * @sta: pointer to the &ieee80211_sta to which this event relates
4656382246eSEmmanuel Grumbach  * @tid: the tid
466b497de63SEmmanuel Grumbach  * @ssn: the starting sequence number (for %BAR_RX_EVENT)
4676382246eSEmmanuel Grumbach  */
4686382246eSEmmanuel Grumbach struct ieee80211_ba_event {
4696382246eSEmmanuel Grumbach 	struct ieee80211_sta *sta;
4706382246eSEmmanuel Grumbach 	u16 tid;
4716382246eSEmmanuel Grumbach 	u16 ssn;
4726382246eSEmmanuel Grumbach };
4736382246eSEmmanuel Grumbach 
4746382246eSEmmanuel Grumbach /**
475a8182929SEmmanuel Grumbach  * struct ieee80211_event - event to be sent to the driver
476a839e463SJonathan Corbet  * @type: The event itself. See &enum ieee80211_event_type.
477a8182929SEmmanuel Grumbach  * @rssi: relevant if &type is %RSSI_EVENT
478a9409093SEmmanuel Grumbach  * @mlme: relevant if &type is %AUTH_EVENT
479b497de63SEmmanuel Grumbach  * @ba: relevant if &type is %BAR_RX_EVENT or %BA_FRAME_TIMEOUT
4806382246eSEmmanuel Grumbach  * @u:union holding the fields above
481a8182929SEmmanuel Grumbach  */
482a8182929SEmmanuel Grumbach struct ieee80211_event {
483a8182929SEmmanuel Grumbach 	enum ieee80211_event_type type;
484a8182929SEmmanuel Grumbach 	union {
485a8182929SEmmanuel Grumbach 		struct ieee80211_rssi_event rssi;
486a9409093SEmmanuel Grumbach 		struct ieee80211_mlme_event mlme;
4876382246eSEmmanuel Grumbach 		struct ieee80211_ba_event ba;
488a8182929SEmmanuel Grumbach 	} u;
489a8182929SEmmanuel Grumbach };
490a8182929SEmmanuel Grumbach 
491a8182929SEmmanuel Grumbach /**
49223a1f8d4SSara Sharon  * struct ieee80211_mu_group_data - STA's VHT MU-MIMO group data
49323a1f8d4SSara Sharon  *
49423a1f8d4SSara Sharon  * This structure describes the group id data of VHT MU-MIMO
49523a1f8d4SSara Sharon  *
49623a1f8d4SSara Sharon  * @membership: 64 bits array - a bit is set if station is member of the group
49723a1f8d4SSara Sharon  * @position: 2 bits per group id indicating the position in the group
49823a1f8d4SSara Sharon  */
49923a1f8d4SSara Sharon struct ieee80211_mu_group_data {
50023a1f8d4SSara Sharon 	u8 membership[WLAN_MEMBERSHIP_LEN];
50123a1f8d4SSara Sharon 	u8 position[WLAN_USER_POSITION_LEN];
50223a1f8d4SSara Sharon };
50323a1f8d4SSara Sharon 
50423a1f8d4SSara Sharon /**
5053453de98SRandy Dunlap  * struct ieee80211_ftm_responder_params - FTM responder parameters
506bc847970SPradeep Kumar Chitrapu  *
507bc847970SPradeep Kumar Chitrapu  * @lci: LCI subelement content
508bc847970SPradeep Kumar Chitrapu  * @civicloc: CIVIC location subelement content
509bc847970SPradeep Kumar Chitrapu  * @lci_len: LCI data length
510bc847970SPradeep Kumar Chitrapu  * @civicloc_len: Civic data length
511bc847970SPradeep Kumar Chitrapu  */
512bc847970SPradeep Kumar Chitrapu struct ieee80211_ftm_responder_params {
513bc847970SPradeep Kumar Chitrapu 	const u8 *lci;
514bc847970SPradeep Kumar Chitrapu 	const u8 *civicloc;
515bc847970SPradeep Kumar Chitrapu 	size_t lci_len;
516bc847970SPradeep Kumar Chitrapu 	size_t civicloc_len;
517bc847970SPradeep Kumar Chitrapu };
518bc847970SPradeep Kumar Chitrapu 
519bc847970SPradeep Kumar Chitrapu /**
520295b02c4SAloka Dixit  * struct ieee80211_fils_discovery - FILS discovery parameters from
521295b02c4SAloka Dixit  * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
522295b02c4SAloka Dixit  *
523295b02c4SAloka Dixit  * @min_interval: Minimum packet interval in TUs (0 - 10000)
524295b02c4SAloka Dixit  * @max_interval: Maximum packet interval in TUs (0 - 10000)
525295b02c4SAloka Dixit  */
526295b02c4SAloka Dixit struct ieee80211_fils_discovery {
527295b02c4SAloka Dixit 	u32 min_interval;
528295b02c4SAloka Dixit 	u32 max_interval;
529295b02c4SAloka Dixit };
530295b02c4SAloka Dixit 
531295b02c4SAloka Dixit /**
532471b3efdSJohannes Berg  * struct ieee80211_bss_conf - holds the BSS's changing parameters
533471b3efdSJohannes Berg  *
534471b3efdSJohannes Berg  * This structure keeps information about a BSS (and an association
535471b3efdSJohannes Berg  * to that BSS) that can change during the lifetime of the BSS.
536471b3efdSJohannes Berg  *
537e1f113ccSBenjamin Berg  * @vif: reference to owning VIF
538d8787ec6SJohannes Berg  * @addr: (link) address used locally
5393fbddae4SJohannes Berg  * @link_id: link ID, or 0 for non-MLO
54041cbb0f5SLuca Coelho  * @htc_trig_based_pkt_ext: default PE in 4us units, if BSS supports HE
54141cbb0f5SLuca Coelho  * @uora_exists: is the UORA element advertised by AP
54241cbb0f5SLuca Coelho  * @ack_enabled: indicates support to receive a multi-TID that solicits either
54341cbb0f5SLuca Coelho  *	ACK, BACK or both
54441cbb0f5SLuca Coelho  * @uora_ocw_range: UORA element's OCW Range field
54541cbb0f5SLuca Coelho  * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
54641cbb0f5SLuca Coelho  * @he_support: does this BSS support HE
54755ebd6e6SEmmanuel Grumbach  * @twt_requester: does this BSS support TWT requester (relevant for managed
54855ebd6e6SEmmanuel Grumbach  *	mode only, set if the AP advertises TWT responder role)
549a0de1ca3SJohn Crispin  * @twt_responder: does this BSS support TWT requester (relevant for managed
550a0de1ca3SJohn Crispin  *	mode only, set if the AP advertises TWT responder role)
551d46b4ab8SShaul Triebitz  * @twt_protected: does this BSS support protected TWT frames
552d8b26154SShaul Triebitz  * @twt_broadcast: does this BSS support broadcast TWT
553471b3efdSJohannes Berg  * @use_cts_prot: use CTS protection
554ea1b2b45SJohannes Berg  * @use_short_preamble: use 802.11b short preamble
555ea1b2b45SJohannes Berg  * @use_short_slot: use short slot time (only relevant for ERP)
55656007a02SJohannes Berg  * @dtim_period: num of beacons before the next DTIM, for beaconing,
557c65dd147SEmmanuel Grumbach  *	valid in station mode only if after the driver was notified
558989c6505SAlexander Bondar  *	with the %BSS_CHANGED_BEACON_INFO flag, will be non-zero then.
5598c358bcdSJohannes Berg  * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old
560ef429dadSJohannes Berg  *	as it may have been received during scanning long ago). If the
561ef429dadSJohannes Berg  *	HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can
562ef429dadSJohannes Berg  *	only come from a beacon, but might not become valid until after
563ef429dadSJohannes Berg  *	association when a beacon is received (which is notified with the
5642ecc3905SAlexander Bondar  *	%BSS_CHANGED_DTIM flag.). See also sync_dtim_count important notice.
5658c358bcdSJohannes Berg  * @sync_device_ts: the device timestamp corresponding to the sync_tsf,
5668c358bcdSJohannes Berg  *	the driver/device can use this to calculate synchronisation
5672ecc3905SAlexander Bondar  *	(see @sync_tsf). See also sync_dtim_count important notice.
568ef429dadSJohannes Berg  * @sync_dtim_count: Only valid when %IEEE80211_HW_TIMING_BEACON_ONLY
569ef429dadSJohannes Berg  *	is requested, see @sync_tsf/@sync_device_ts.
5702ecc3905SAlexander Bondar  *	IMPORTANT: These three sync_* parameters would possibly be out of sync
5712ecc3905SAlexander Bondar  *	by the time the driver will use them. The synchronized view is currently
5722ecc3905SAlexander Bondar  *	guaranteed only in certain callbacks.
573f276e20bSJohannes Berg  *	Note also that this is not used with MLD associations, mac80211 doesn't
574f276e20bSJohannes Berg  *	know how to track beacons for all of the links for this.
57521c0cbe7STomas Winkler  * @beacon_int: beacon interval
57698f7dfd8SEmmanuel Grumbach  * @assoc_capability: capabilities taken from assoc resp
57796dd22acSJohannes Berg  * @basic_rates: bitmap of basic rates, each bit stands for an
57896dd22acSJohannes Berg  *	index into the rate table configured by the driver in
57996dd22acSJohannes Berg  *	the current band.
580817cee76SAlexander Bondar  * @beacon_rate: associated AP's beacon TX rate
581dd5b4cc7SFelix Fietkau  * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
5822d0ddec5SJohannes Berg  * @bssid: The BSSID for this BSS
5832d0ddec5SJohannes Berg  * @enable_beacon: whether beaconing should be enabled or not
5844bf88530SJohannes Berg  * @chandef: Channel definition for this BSS -- the hardware might be
5854bf88530SJohannes Berg  *	configured a higher bandwidth than this BSS uses, for example.
58623a1f8d4SSara Sharon  * @mu_group: VHT MU-MIMO group membership data
587074d46d1SJohannes Berg  * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
58822f66895SAvri Altman  *	This field is only valid when the channel is a wide HT/VHT channel.
58922f66895SAvri Altman  *	Note that with TDLS this can be the case (channel is HT, protection must
59022f66895SAvri Altman  *	be used from this field) even when the BSS association isn't using HT.
591a97c13c3SJuuso Oikarinen  * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
592e86abc68SJohannes Berg  *	implies disabled. As with the cfg80211 callback, a change here should
593e86abc68SJohannes Berg  *	cause an event to be sent indicating where the current value is in
594e86abc68SJohannes Berg  *	relation to the newly configured threshold.
5952c3c5f8cSAndrew Zaborowski  * @cqm_rssi_low: Connection quality monitor RSSI lower threshold, a zero value
5962c3c5f8cSAndrew Zaborowski  *	implies disabled.  This is an alternative mechanism to the single
5972c3c5f8cSAndrew Zaborowski  *	threshold event and can't be enabled simultaneously with it.
5982c3c5f8cSAndrew Zaborowski  * @cqm_rssi_high: Connection quality monitor RSSI upper threshold.
599a97c13c3SJuuso Oikarinen  * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
6004ced3f74SJohannes Berg  * @qos: This is a QoS-enabled BSS.
6017827493bSArik Nemtsov  * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
602db6d9e9eSBen Greear  * @txpower: TX power in dBm.  INT_MIN means not configured.
603db82d8a9SLorenzo Bianconi  * @txpower_type: TX power adjustment used to control per packet Transmit
604db82d8a9SLorenzo Bianconi  *	Power Control (TPC) in lower driver for the current vif. In particular
605db82d8a9SLorenzo Bianconi  *	TPC is enabled if value passed in %txpower_type is
606db82d8a9SLorenzo Bianconi  *	NL80211_TX_POWER_LIMITED (allow using less than specified from
607db82d8a9SLorenzo Bianconi  *	userspace), whereas TPC is disabled if %txpower_type is set to
608db82d8a9SLorenzo Bianconi  *	NL80211_TX_POWER_FIXED (use value configured from userspace)
60967baf663SJanusz Dziedzic  * @p2p_noa_attr: P2P NoA attribute for P2P powersave
61052cfa1d6SAyala Beker  * @allow_p2p_go_ps: indication for AP or P2P GO interface, whether it's allowed
61152cfa1d6SAyala Beker  *	to use P2P PS mechanism or not. AP/P2P GO is not allowed to use P2P PS
61252cfa1d6SAyala Beker  *	if it has associated clients without P2P PS support.
613e38a017bSAvraham Stern  * @max_idle_period: the time period during which the station can refrain from
614e38a017bSAvraham Stern  *	transmitting frames to its associated AP without being disassociated.
615e38a017bSAvraham Stern  *	In units of 1000 TUs. Zero value indicates that the AP did not include
616e38a017bSAvraham Stern  *	a (valid) BSS Max Idle Period Element.
617e38a017bSAvraham Stern  * @protected_keep_alive: if set, indicates that the station should send an RSN
618e38a017bSAvraham Stern  *	protected frame to the AP to reset the idle timer at the AP for the
619e38a017bSAvraham Stern  *	station.
620bc847970SPradeep Kumar Chitrapu  * @ftm_responder: whether to enable or disable fine timing measurement FTM
621bc847970SPradeep Kumar Chitrapu  *	responder functionality.
622bc847970SPradeep Kumar Chitrapu  * @ftmr_params: configurable lci/civic parameter when enabling FTM responder.
62378ac51f8SSara Sharon  * @nontransmitted: this BSS is a nontransmitted BSS profile
62478ac51f8SSara Sharon  * @transmitter_bssid: the address of transmitter AP
62578ac51f8SSara Sharon  * @bssid_index: index inside the multiple BSSID set
62678ac51f8SSara Sharon  * @bssid_indicator: 2^bssid_indicator is the maximum number of APs in set
62778ac51f8SSara Sharon  * @ema_ap: AP supports enhancements of discovery and advertisement of
62878ac51f8SSara Sharon  *	nontransmitted BSSIDs
62978ac51f8SSara Sharon  * @profile_periodicity: the least number of beacon frames need to be received
63078ac51f8SSara Sharon  *	in order to discover all the nontransmitted BSSIDs in the set.
63170debba3SPradeep Kumar Chitrapu  * @he_oper: HE operation information of the BSS (AP/Mesh) or of the AP we are
63270debba3SPradeep Kumar Chitrapu  *	connected to (STA)
6331ced169cSJohn Crispin  * @he_obss_pd: OBSS Packet Detection parameters.
634dd56e902SJohn Crispin  * @he_bss_color: BSS coloring settings, if BSS supports HE
635295b02c4SAloka Dixit  * @fils_discovery: FILS discovery configuration
636632189a0SAloka Dixit  * @unsol_bcast_probe_resp_interval: Unsolicited broadcast probe response
637632189a0SAloka Dixit  *	interval.
638ba6ff70aSRajkumar Manoharan  * @beacon_tx_rate: The configured beacon transmit rate that needs to be passed
639ba6ff70aSRajkumar Manoharan  *	to driver when rate control is offloaded to firmware.
640405fca8aSWen Gong  * @power_type: power type of BSS for 6 GHz
64163214f02SWen Gong  * @tx_pwr_env: transmit power envelope array of BSS.
64263214f02SWen Gong  * @tx_pwr_env_num: number of @tx_pwr_env.
64363214f02SWen Gong  * @pwr_reduction: power constraint of BSS.
644a1de6407SIlan Peer  * @eht_support: does this BSS support EHT
645aa87cd8bSJohannes Berg  * @eht_puncturing: bitmap to indicate which channels are punctured in this BSS
646d0a9123eSJohannes Berg  * @csa_active: marks whether a channel switch is going on. Internally it is
647d0a9123eSJohannes Berg  *	write-protected by sdata_lock and local->mtx so holding either is fine
648d0a9123eSJohannes Berg  *	for read access.
6492cc25e4bSAloka Dixit  * @csa_punct_bitmap: new puncturing bitmap for channel switch
650d0a9123eSJohannes Berg  * @mu_mimo_owner: indicates interface owns MU-MIMO capability
651d0a9123eSJohannes Berg  * @chanctx_conf: The channel context this interface is assigned to, or %NULL
652d0a9123eSJohannes Berg  *	when it is not assigned. This pointer is RCU-protected due to the TX
653d0a9123eSJohannes Berg  *	path needing to access it; even though the netdev carrier will always
654d0a9123eSJohannes Berg  *	be off when it is %NULL there can still be races and packets could be
655d0a9123eSJohannes Berg  *	processed after it switches back to %NULL.
656d0a9123eSJohannes Berg  * @color_change_active: marks whether a color change is ongoing. Internally it is
657d0a9123eSJohannes Berg  *	write-protected by sdata_lock and local->mtx so holding either is fine
658d0a9123eSJohannes Berg  *	for read access.
659d0a9123eSJohannes Berg  * @color_change_color: the bss color that will be used after the change.
6602ad7dd94SRyder Lee  * @ht_ldpc: in AP mode, indicates interface has HT LDPC capability.
6612ad7dd94SRyder Lee  * @vht_ldpc: in AP mode, indicates interface has VHT LDPC capability.
6622ad7dd94SRyder Lee  * @he_ldpc: in AP mode, indicates interface has HE LDPC capability.
66342470fa0SMuna Sinada  * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU
66442470fa0SMuna Sinada  *	beamformer
66542470fa0SMuna Sinada  * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU
66642470fa0SMuna Sinada  *	beamformee
66742470fa0SMuna Sinada  * @vht_mu_beamformer: in AP mode, does this BSS support operation as an VHT MU
66842470fa0SMuna Sinada  *	beamformer
66942470fa0SMuna Sinada  * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU
67042470fa0SMuna Sinada  *	beamformee
671b1b3297dSMuna Sinada  * @he_su_beamformer: in AP-mode, does this BSS support operation as an HE SU
672b1b3297dSMuna Sinada  *	beamformer
673b1b3297dSMuna Sinada  * @he_su_beamformee: in AP-mode, does this BSS support operation as an HE SU
674b1b3297dSMuna Sinada  *	beamformee
675b1b3297dSMuna Sinada  * @he_mu_beamformer: in AP-mode, does this BSS support operation as an HE MU
676b1b3297dSMuna Sinada  *	beamformer
677b1b3297dSMuna Sinada  * @he_full_ul_mumimo: does this BSS support the reception (AP) or transmission
678b1b3297dSMuna Sinada  *	(non-AP STA) of an HE TB PPDU on an RU that spans the entire PPDU
679b1b3297dSMuna Sinada  *	bandwidth
680f4d1181eSRyder Lee  * @eht_su_beamformer: in AP-mode, does this BSS enable operation as an EHT SU
681f4d1181eSRyder Lee  *	beamformer
682f4d1181eSRyder Lee  * @eht_su_beamformee: in AP-mode, does this BSS enable operation as an EHT SU
683f4d1181eSRyder Lee  *	beamformee
684f4d1181eSRyder Lee  * @eht_mu_beamformer: in AP-mode, does this BSS enable operation as an EHT MU
685f4d1181eSRyder Lee  *	beamformer
686471b3efdSJohannes Berg  */
687471b3efdSJohannes Berg struct ieee80211_bss_conf {
688e1f113ccSBenjamin Berg 	struct ieee80211_vif *vif;
689e1f113ccSBenjamin Berg 
6902d0ddec5SJohannes Berg 	const u8 *bssid;
6913fbddae4SJohannes Berg 	unsigned int link_id;
692d8787ec6SJohannes Berg 	u8 addr[ETH_ALEN] __aligned(2);
69341cbb0f5SLuca Coelho 	u8 htc_trig_based_pkt_ext;
69441cbb0f5SLuca Coelho 	bool uora_exists;
69541cbb0f5SLuca Coelho 	u8 uora_ocw_range;
69641cbb0f5SLuca Coelho 	u16 frame_time_rts_th;
69741cbb0f5SLuca Coelho 	bool he_support;
69855ebd6e6SEmmanuel Grumbach 	bool twt_requester;
699a0de1ca3SJohn Crispin 	bool twt_responder;
700d46b4ab8SShaul Triebitz 	bool twt_protected;
701d8b26154SShaul Triebitz 	bool twt_broadcast;
702471b3efdSJohannes Berg 	/* erp related data */
703471b3efdSJohannes Berg 	bool use_cts_prot;
704471b3efdSJohannes Berg 	bool use_short_preamble;
7059f1ba906SJouni Malinen 	bool use_short_slot;
7062d0ddec5SJohannes Berg 	bool enable_beacon;
70798f7dfd8SEmmanuel Grumbach 	u8 dtim_period;
70821c0cbe7STomas Winkler 	u16 beacon_int;
70921c0cbe7STomas Winkler 	u16 assoc_capability;
7108c358bcdSJohannes Berg 	u64 sync_tsf;
7118c358bcdSJohannes Berg 	u32 sync_device_ts;
712ef429dadSJohannes Berg 	u8 sync_dtim_count;
713881d948cSJohannes Berg 	u32 basic_rates;
714817cee76SAlexander Bondar 	struct ieee80211_rate *beacon_rate;
71557fbcce3SJohannes Berg 	int mcast_rate[NUM_NL80211_BANDS];
7169ed6bcceSJohannes Berg 	u16 ht_operation_mode;
717a97c13c3SJuuso Oikarinen 	s32 cqm_rssi_thold;
718a97c13c3SJuuso Oikarinen 	u32 cqm_rssi_hyst;
7192c3c5f8cSAndrew Zaborowski 	s32 cqm_rssi_low;
7202c3c5f8cSAndrew Zaborowski 	s32 cqm_rssi_high;
7214bf88530SJohannes Berg 	struct cfg80211_chan_def chandef;
72223a1f8d4SSara Sharon 	struct ieee80211_mu_group_data mu_group;
7234ced3f74SJohannes Berg 	bool qos;
7247827493bSArik Nemtsov 	bool hidden_ssid;
7251ea6f9c0SJohannes Berg 	int txpower;
726db82d8a9SLorenzo Bianconi 	enum nl80211_tx_power_setting txpower_type;
72767baf663SJanusz Dziedzic 	struct ieee80211_p2p_noa_attr p2p_noa_attr;
72852cfa1d6SAyala Beker 	bool allow_p2p_go_ps;
729e38a017bSAvraham Stern 	u16 max_idle_period;
730e38a017bSAvraham Stern 	bool protected_keep_alive;
731bc847970SPradeep Kumar Chitrapu 	bool ftm_responder;
732bc847970SPradeep Kumar Chitrapu 	struct ieee80211_ftm_responder_params *ftmr_params;
73378ac51f8SSara Sharon 	/* Multiple BSSID data */
73478ac51f8SSara Sharon 	bool nontransmitted;
73578ac51f8SSara Sharon 	u8 transmitter_bssid[ETH_ALEN];
73678ac51f8SSara Sharon 	u8 bssid_index;
73778ac51f8SSara Sharon 	u8 bssid_indicator;
73878ac51f8SSara Sharon 	bool ema_ap;
73978ac51f8SSara Sharon 	u8 profile_periodicity;
74060689de4SRajkumar Manoharan 	struct {
74160689de4SRajkumar Manoharan 		u32 params;
74260689de4SRajkumar Manoharan 		u16 nss_set;
74360689de4SRajkumar Manoharan 	} he_oper;
7441ced169cSJohn Crispin 	struct ieee80211_he_obss_pd he_obss_pd;
745dd56e902SJohn Crispin 	struct cfg80211_he_bss_color he_bss_color;
746295b02c4SAloka Dixit 	struct ieee80211_fils_discovery fils_discovery;
747632189a0SAloka Dixit 	u32 unsol_bcast_probe_resp_interval;
748ba6ff70aSRajkumar Manoharan 	struct cfg80211_bitrate_mask beacon_tx_rate;
749405fca8aSWen Gong 	enum ieee80211_ap_reg_power power_type;
75063214f02SWen Gong 	struct ieee80211_tx_pwr_env tx_pwr_env[IEEE80211_TPE_MAX_IE_COUNT];
75163214f02SWen Gong 	u8 tx_pwr_env_num;
75263214f02SWen Gong 	u8 pwr_reduction;
753a1de6407SIlan Peer 	bool eht_support;
754aa87cd8bSJohannes Berg 	u16 eht_puncturing;
755d0a9123eSJohannes Berg 
756d0a9123eSJohannes Berg 	bool csa_active;
7572cc25e4bSAloka Dixit 	u16 csa_punct_bitmap;
7582cc25e4bSAloka Dixit 
759d0a9123eSJohannes Berg 	bool mu_mimo_owner;
760d0a9123eSJohannes Berg 	struct ieee80211_chanctx_conf __rcu *chanctx_conf;
761d0a9123eSJohannes Berg 
762d0a9123eSJohannes Berg 	bool color_change_active;
763d0a9123eSJohannes Berg 	u8 color_change_color;
76442470fa0SMuna Sinada 
7652ad7dd94SRyder Lee 	bool ht_ldpc;
7662ad7dd94SRyder Lee 	bool vht_ldpc;
7672ad7dd94SRyder Lee 	bool he_ldpc;
76842470fa0SMuna Sinada 	bool vht_su_beamformer;
76942470fa0SMuna Sinada 	bool vht_su_beamformee;
77042470fa0SMuna Sinada 	bool vht_mu_beamformer;
77142470fa0SMuna Sinada 	bool vht_mu_beamformee;
772b1b3297dSMuna Sinada 	bool he_su_beamformer;
773b1b3297dSMuna Sinada 	bool he_su_beamformee;
774b1b3297dSMuna Sinada 	bool he_mu_beamformer;
775b1b3297dSMuna Sinada 	bool he_full_ul_mumimo;
776f4d1181eSRyder Lee 	bool eht_su_beamformer;
777f4d1181eSRyder Lee 	bool eht_su_beamformee;
778f4d1181eSRyder Lee 	bool eht_mu_beamformer;
779471b3efdSJohannes Berg };
780471b3efdSJohannes Berg 
78111f4b1ceSRon Rindjunsky /**
782af61a165SJohannes Berg  * enum mac80211_tx_info_flags - flags to describe transmission information/status
78311f4b1ceSRon Rindjunsky  *
7846ef307bcSRandy Dunlap  * These flags are used with the @flags member of &ieee80211_tx_info.
78511f4b1ceSRon Rindjunsky  *
7867351c6bdSJohannes Berg  * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
787e6a9854bSJohannes Berg  * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
788e6a9854bSJohannes Berg  *	number to this frame, taking care of not overwriting the fragment
789e6a9854bSJohannes Berg  *	number and increasing the sequence number only when the
790e6a9854bSJohannes Berg  *	IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly
791e6a9854bSJohannes Berg  *	assign sequence numbers to QoS-data frames but cannot do so correctly
792e6a9854bSJohannes Berg  *	for non-QoS-data and management frames because beacons need them from
793e6a9854bSJohannes Berg  *	that counter as well and mac80211 cannot guarantee proper sequencing.
794e6a9854bSJohannes Berg  *	If this flag is set, the driver should instruct the hardware to
795e6a9854bSJohannes Berg  *	assign a sequence number to the frame or assign one itself. Cf. IEEE
796e6a9854bSJohannes Berg  *	802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
797e6a9854bSJohannes Berg  *	beacons and always be clear for frames without a sequence number field.
798e039fa4aSJohannes Berg  * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
799e039fa4aSJohannes Berg  * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
800e039fa4aSJohannes Berg  *	station
801e039fa4aSJohannes Berg  * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
802e039fa4aSJohannes Berg  * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
803e039fa4aSJohannes Berg  * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
804e6a9854bSJohannes Berg  * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
805e039fa4aSJohannes Berg  * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
806ab5b5342SJohannes Berg  *	because the destination STA was in powersave mode. Note that to
807ab5b5342SJohannes Berg  *	avoid race conditions, the filter must be set by the hardware or
808ab5b5342SJohannes Berg  *	firmware upon receiving a frame that indicates that the station
809ab5b5342SJohannes Berg  *	went to sleep (must be done on device to filter frames already on
810ab5b5342SJohannes Berg  *	the queue) and may only be unset after mac80211 gives the OK for
811ab5b5342SJohannes Berg  *	that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above),
812ab5b5342SJohannes Berg  *	since only then is it guaranteed that no more frames are in the
813ab5b5342SJohannes Berg  *	hardware queue.
814e039fa4aSJohannes Berg  * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
815e039fa4aSJohannes Berg  * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
816e039fa4aSJohannes Berg  * 	is for the whole aggregation.
817429a3805SRon Rindjunsky  * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned,
818429a3805SRon Rindjunsky  * 	so consider using block ack request (BAR).
819e6a9854bSJohannes Berg  * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
820e6a9854bSJohannes Berg  *	set by rate control algorithms to indicate probe rate, will
821e6a9854bSJohannes Berg  *	be cleared for fragmented frames (except on the last fragment)
8226c17b77bSSeth Forshee  * @IEEE80211_TX_INTFL_OFFCHAN_TX_OK: Internal to mac80211. Used to indicate
8236c17b77bSSeth Forshee  *	that a frame can be transmitted while the queues are stopped for
8246c17b77bSSeth Forshee  *	off-channel operation.
825cc20ff2cSFelix Fietkau  * @IEEE80211_TX_CTL_HW_80211_ENCAP: This frame uses hardware encapsulation
826cc20ff2cSFelix Fietkau  *	(header conversion)
8278f77f384SJohannes Berg  * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
8288f77f384SJohannes Berg  *	used to indicate that a frame was already retried due to PS
8293b8d81e0SJohannes Berg  * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
8303b8d81e0SJohannes Berg  *	used to indicate frame should not be encrypted
83102f2f1a9SJohannes Berg  * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
83202f2f1a9SJohannes Berg  *	frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
83302f2f1a9SJohannes Berg  *	be sent although the station is in powersave mode.
834ad5351dbSJohannes Berg  * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
835ad5351dbSJohannes Berg  *	transmit function after the current frame, this can be used
836ad5351dbSJohannes Berg  *	by drivers to kick the DMA queue only if unset or when the
837ad5351dbSJohannes Berg  *	queue gets full.
838c6fcf6bcSJohannes Berg  * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted
839c6fcf6bcSJohannes Berg  *	after TX status because the destination was asleep, it must not
840c6fcf6bcSJohannes Berg  *	be modified again (no seqno assignment, crypto, etc.)
8411672c0e3SJohannes Berg  * @IEEE80211_TX_INTFL_MLME_CONN_TX: This frame was transmitted by the MLME
8421672c0e3SJohannes Berg  *	code for connection establishment, this indicates that its status
8431672c0e3SJohannes Berg  *	should kick the MLME state machine.
844026331c4SJouni Malinen  * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
845026331c4SJouni Malinen  *	MLME command (internal to mac80211 to figure out whether to send TX
846026331c4SJouni Malinen  *	status to user space)
8470a56bd0aSLuis R. Rodriguez  * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame
848f79d9badSFelix Fietkau  * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this
849f79d9badSFelix Fietkau  *	frame and selects the maximum number of streams that it can use.
850610dbc98SJohannes Berg  * @IEEE80211_TX_CTL_TX_OFFCHAN: Marks this packet to be transmitted on
851610dbc98SJohannes Berg  *	the off-channel channel when a remain-on-channel offload is done
852610dbc98SJohannes Berg  *	in hardware -- normal packets still flow and are expected to be
853610dbc98SJohannes Berg  *	handled properly by the device.
854681d1190SJouni Malinen  * @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP
855681d1190SJouni Malinen  *	testing. It will be sent out with incorrect Michael MIC key to allow
856681d1190SJouni Malinen  *	TKIP countermeasures to be tested.
857aad14cebSRajkumar Manoharan  * @IEEE80211_TX_CTL_NO_CCK_RATE: This frame will be sent at non CCK rate.
858aad14cebSRajkumar Manoharan  *	This flag is actually used for management frame especially for P2P
859aad14cebSRajkumar Manoharan  *	frames not being sent at CCK rate in 2GHz band.
86047086fc5SJohannes Berg  * @IEEE80211_TX_STATUS_EOSP: This packet marks the end of service period,
86147086fc5SJohannes Berg  *	when its status is reported the service period ends. For frames in
86247086fc5SJohannes Berg  *	an SP that mac80211 transmits, it is already set; for driver frames
863deeaee19SJohannes Berg  *	the driver may set this flag. It is also used to do the same for
864deeaee19SJohannes Berg  *	PS-Poll responses.
865b6f35301SRajkumar Manoharan  * @IEEE80211_TX_CTL_USE_MINRATE: This frame will be sent at lowest rate.
866b6f35301SRajkumar Manoharan  *	This flag is used to send nullfunc frame at minimum rate when
867b6f35301SRajkumar Manoharan  *	the nullfunc is used for connection monitoring purpose.
868a26eb27aSJohannes Berg  * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it
869a26eb27aSJohannes Berg  *	would be fragmented by size (this is optional, only used for
870a26eb27aSJohannes Berg  *	monitor injection).
8715cf16616SSujith Manoharan  * @IEEE80211_TX_STAT_NOACK_TRANSMITTED: A frame that was marked with
8725cf16616SSujith Manoharan  *	IEEE80211_TX_CTL_NO_ACK has been successfully transmitted without
8735cf16616SSujith Manoharan  *	any errors (like issues specific to the driver/HW).
8745cf16616SSujith Manoharan  *	This flag must not be set for frames that don't request no-ack
8755cf16616SSujith Manoharan  *	behaviour with IEEE80211_TX_CTL_NO_ACK.
876eb7d3066SChristian Lamparter  *
877eb7d3066SChristian Lamparter  * Note: If you have to add new flags to the enumeration, then don't
878eb7d3066SChristian Lamparter  *	 forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
87911f4b1ceSRon Rindjunsky  */
880af61a165SJohannes Berg enum mac80211_tx_info_flags {
881e039fa4aSJohannes Berg 	IEEE80211_TX_CTL_REQ_TX_STATUS		= BIT(0),
882e6a9854bSJohannes Berg 	IEEE80211_TX_CTL_ASSIGN_SEQ		= BIT(1),
883e6a9854bSJohannes Berg 	IEEE80211_TX_CTL_NO_ACK			= BIT(2),
884e6a9854bSJohannes Berg 	IEEE80211_TX_CTL_CLEAR_PS_FILT		= BIT(3),
885e6a9854bSJohannes Berg 	IEEE80211_TX_CTL_FIRST_FRAGMENT		= BIT(4),
886e6a9854bSJohannes Berg 	IEEE80211_TX_CTL_SEND_AFTER_DTIM	= BIT(5),
887e6a9854bSJohannes Berg 	IEEE80211_TX_CTL_AMPDU			= BIT(6),
888e6a9854bSJohannes Berg 	IEEE80211_TX_CTL_INJECTED		= BIT(7),
889e6a9854bSJohannes Berg 	IEEE80211_TX_STAT_TX_FILTERED		= BIT(8),
890e6a9854bSJohannes Berg 	IEEE80211_TX_STAT_ACK			= BIT(9),
891e6a9854bSJohannes Berg 	IEEE80211_TX_STAT_AMPDU			= BIT(10),
892e6a9854bSJohannes Berg 	IEEE80211_TX_STAT_AMPDU_NO_BACK		= BIT(11),
893e6a9854bSJohannes Berg 	IEEE80211_TX_CTL_RATE_CTRL_PROBE	= BIT(12),
8946c17b77bSSeth Forshee 	IEEE80211_TX_INTFL_OFFCHAN_TX_OK	= BIT(13),
895cc20ff2cSFelix Fietkau 	IEEE80211_TX_CTL_HW_80211_ENCAP		= BIT(14),
8968f77f384SJohannes Berg 	IEEE80211_TX_INTFL_RETRIED		= BIT(15),
8973b8d81e0SJohannes Berg 	IEEE80211_TX_INTFL_DONT_ENCRYPT		= BIT(16),
89802f2f1a9SJohannes Berg 	IEEE80211_TX_CTL_NO_PS_BUFFER		= BIT(17),
899ad5351dbSJohannes Berg 	IEEE80211_TX_CTL_MORE_FRAMES		= BIT(18),
900c6fcf6bcSJohannes Berg 	IEEE80211_TX_INTFL_RETRANSMISSION	= BIT(19),
9011672c0e3SJohannes Berg 	IEEE80211_TX_INTFL_MLME_CONN_TX		= BIT(20),
902026331c4SJouni Malinen 	IEEE80211_TX_INTFL_NL80211_FRAME_TX	= BIT(21),
9030a56bd0aSLuis R. Rodriguez 	IEEE80211_TX_CTL_LDPC			= BIT(22),
904f79d9badSFelix Fietkau 	IEEE80211_TX_CTL_STBC			= BIT(23) | BIT(24),
90521f83589SJohannes Berg 	IEEE80211_TX_CTL_TX_OFFCHAN		= BIT(25),
906681d1190SJouni Malinen 	IEEE80211_TX_INTFL_TKIP_MIC_FAILURE	= BIT(26),
907aad14cebSRajkumar Manoharan 	IEEE80211_TX_CTL_NO_CCK_RATE		= BIT(27),
90847086fc5SJohannes Berg 	IEEE80211_TX_STATUS_EOSP		= BIT(28),
909b6f35301SRajkumar Manoharan 	IEEE80211_TX_CTL_USE_MINRATE		= BIT(29),
910a26eb27aSJohannes Berg 	IEEE80211_TX_CTL_DONTFRAG		= BIT(30),
9115cf16616SSujith Manoharan 	IEEE80211_TX_STAT_NOACK_TRANSMITTED	= BIT(31),
912e6a9854bSJohannes Berg };
913e6a9854bSJohannes Berg 
914abe37c4bSJohannes Berg #define IEEE80211_TX_CTL_STBC_SHIFT		23
915abe37c4bSJohannes Berg 
9161821f8b3SThomas Pedersen #define IEEE80211_TX_RC_S1G_MCS IEEE80211_TX_RC_VHT_MCS
9171821f8b3SThomas Pedersen 
918af61a165SJohannes Berg /**
919af61a165SJohannes Berg  * enum mac80211_tx_control_flags - flags to describe transmit control
920af61a165SJohannes Berg  *
921af61a165SJohannes Berg  * @IEEE80211_TX_CTRL_PORT_CTRL_PROTO: this frame is a port control
922af61a165SJohannes Berg  *	protocol frame (e.g. EAP)
9236b127c71SSujith Manoharan  * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
9246b127c71SSujith Manoharan  *	frame (PS-Poll or uAPSD).
925dfdfc2beSSven Eckelmann  * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
9266e0456b5SFelix Fietkau  * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
927bb42f2d1SToke Høiland-Jørgensen  * @IEEE80211_TX_CTRL_FAST_XMIT: This frame is going through the fast_xmit path
9288828f81aSRajkumar Manoharan  * @IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP: This frame skips mesh path lookup
929cc20ff2cSFelix Fietkau  * @IEEE80211_TX_INTCFL_NEED_TXPROCESSING: completely internal to mac80211,
930cc20ff2cSFelix Fietkau  *	used to indicate that a pending frame requires TX processing before
931cc20ff2cSFelix Fietkau  *	it can be sent out.
932e02281e7SMathy Vanhoef  * @IEEE80211_TX_CTRL_NO_SEQNO: Do not overwrite the sequence number that
933e02281e7SMathy Vanhoef  *	has already been assigned to this frame.
93430df8130SMathy Vanhoef  * @IEEE80211_TX_CTRL_DONT_REORDER: This frame should not be reordered
93530df8130SMathy Vanhoef  *	relative to other frames that have this flag set, independent
93630df8130SMathy Vanhoef  *	of their QoS TID or other priority field values.
937963d0e8dSJohannes Berg  * @IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX: first MLO TX, used mostly internally
938963d0e8dSJohannes Berg  *	for sequence number assignment
939d54455a3SPing-Ke Shih  * @IEEE80211_TX_CTRL_DONT_USE_RATE_MASK: Don't use rate mask for this frame
940d54455a3SPing-Ke Shih  *	which is transmitted due to scanning or offchannel TX, not in normal
941d54455a3SPing-Ke Shih  *	operation on the interface.
94269d41b5aSJohannes Berg  * @IEEE80211_TX_CTRL_MLO_LINK: If not @IEEE80211_LINK_UNSPECIFIED, this
94369d41b5aSJohannes Berg  *	frame should be transmitted on the specific link. This really is
94469d41b5aSJohannes Berg  *	only relevant for frames that do not have data present, and is
945e1e68b14SJohannes Berg  *	also not used for 802.3 format frames. Note that even if the frame
946e1e68b14SJohannes Berg  *	is on a specific link, address translation might still apply if
947e1e68b14SJohannes Berg  *	it's intended for an MLD.
948af61a165SJohannes Berg  *
949af61a165SJohannes Berg  * These flags are used in tx_info->control.flags.
950af61a165SJohannes Berg  */
951af61a165SJohannes Berg enum mac80211_tx_control_flags {
952af61a165SJohannes Berg 	IEEE80211_TX_CTRL_PORT_CTRL_PROTO	= BIT(0),
9536b127c71SSujith Manoharan 	IEEE80211_TX_CTRL_PS_RESPONSE		= BIT(1),
954dfdfc2beSSven Eckelmann 	IEEE80211_TX_CTRL_RATE_INJECT		= BIT(2),
9556e0456b5SFelix Fietkau 	IEEE80211_TX_CTRL_AMSDU			= BIT(3),
956bb42f2d1SToke Høiland-Jørgensen 	IEEE80211_TX_CTRL_FAST_XMIT		= BIT(4),
9578828f81aSRajkumar Manoharan 	IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP	= BIT(5),
958cc20ff2cSFelix Fietkau 	IEEE80211_TX_INTCFL_NEED_TXPROCESSING	= BIT(6),
959e02281e7SMathy Vanhoef 	IEEE80211_TX_CTRL_NO_SEQNO		= BIT(7),
96030df8130SMathy Vanhoef 	IEEE80211_TX_CTRL_DONT_REORDER		= BIT(8),
961963d0e8dSJohannes Berg 	IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX	= BIT(9),
962d54455a3SPing-Ke Shih 	IEEE80211_TX_CTRL_DONT_USE_RATE_MASK	= BIT(10),
96369d41b5aSJohannes Berg 	IEEE80211_TX_CTRL_MLO_LINK		= 0xf0000000,
964af61a165SJohannes Berg };
965af61a165SJohannes Berg 
96669d41b5aSJohannes Berg #define IEEE80211_LINK_UNSPECIFIED	0xf
967963d0e8dSJohannes Berg #define IEEE80211_TX_CTRL_MLO_LINK_UNSPEC	\
968963d0e8dSJohannes Berg 	u32_encode_bits(IEEE80211_LINK_UNSPECIFIED, \
969963d0e8dSJohannes Berg 			IEEE80211_TX_CTRL_MLO_LINK)
97069d41b5aSJohannes Berg 
971ea5907dbSAvraham Stern /**
972ea5907dbSAvraham Stern  * enum mac80211_tx_status_flags - flags to describe transmit status
973ea5907dbSAvraham Stern  *
974ea5907dbSAvraham Stern  * @IEEE80211_TX_STATUS_ACK_SIGNAL_VALID: ACK signal is valid
975ea5907dbSAvraham Stern  *
976ea5907dbSAvraham Stern  * These flags are used in tx_info->status.flags.
977ea5907dbSAvraham Stern  */
978ea5907dbSAvraham Stern enum mac80211_tx_status_flags {
979ea5907dbSAvraham Stern 	IEEE80211_TX_STATUS_ACK_SIGNAL_VALID = BIT(0),
980ea5907dbSAvraham Stern };
981ea5907dbSAvraham Stern 
982eb7d3066SChristian Lamparter /*
983eb7d3066SChristian Lamparter  * This definition is used as a mask to clear all temporary flags, which are
984eb7d3066SChristian Lamparter  * set by the tx handlers for each transmission attempt by the mac80211 stack.
985eb7d3066SChristian Lamparter  */
986eb7d3066SChristian Lamparter #define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK |		      \
987eb7d3066SChristian Lamparter 	IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT |    \
988eb7d3066SChristian Lamparter 	IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU |	      \
989eb7d3066SChristian Lamparter 	IEEE80211_TX_STAT_TX_FILTERED |	IEEE80211_TX_STAT_ACK |		      \
990eb7d3066SChristian Lamparter 	IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK |	      \
99102f2f1a9SJohannes Berg 	IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER |    \
992eb7d3066SChristian Lamparter 	IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC |		      \
99347086fc5SJohannes Berg 	IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
994eb7d3066SChristian Lamparter 
9952134e7e7SSujith /**
9962134e7e7SSujith  * enum mac80211_rate_control_flags - per-rate flags set by the
9972134e7e7SSujith  *	Rate Control algorithm.
9982134e7e7SSujith  *
9992134e7e7SSujith  * These flags are set by the Rate control algorithm for each rate during tx,
10002134e7e7SSujith  * in the @flags member of struct ieee80211_tx_rate.
10012134e7e7SSujith  *
10022134e7e7SSujith  * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
10032134e7e7SSujith  * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
10042134e7e7SSujith  *	This is set if the current BSS requires ERP protection.
10052134e7e7SSujith  * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
10062134e7e7SSujith  * @IEEE80211_TX_RC_MCS: HT rate.
10078bc83c24SJohannes Berg  * @IEEE80211_TX_RC_VHT_MCS: VHT MCS rate, in this case the idx field is split
10088bc83c24SJohannes Berg  *	into a higher 4 bits (Nss) and lower 4 bits (MCS number)
10092134e7e7SSujith  * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
10102134e7e7SSujith  *	Greenfield mode.
10112134e7e7SSujith  * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
10128bc83c24SJohannes Berg  * @IEEE80211_TX_RC_80_MHZ_WIDTH: Indicates 80 MHz transmission
10138bc83c24SJohannes Berg  * @IEEE80211_TX_RC_160_MHZ_WIDTH: Indicates 160 MHz transmission
10148bc83c24SJohannes Berg  *	(80+80 isn't supported yet)
10152134e7e7SSujith  * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
10162134e7e7SSujith  *	adjacent 20 MHz channels, if the current channel type is
10172134e7e7SSujith  *	NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
10182134e7e7SSujith  * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
10192134e7e7SSujith  */
1020e6a9854bSJohannes Berg enum mac80211_rate_control_flags {
1021e6a9854bSJohannes Berg 	IEEE80211_TX_RC_USE_RTS_CTS		= BIT(0),
1022e6a9854bSJohannes Berg 	IEEE80211_TX_RC_USE_CTS_PROTECT		= BIT(1),
1023e6a9854bSJohannes Berg 	IEEE80211_TX_RC_USE_SHORT_PREAMBLE	= BIT(2),
1024e6a9854bSJohannes Berg 
10258bc83c24SJohannes Berg 	/* rate index is an HT/VHT MCS instead of an index */
1026e6a9854bSJohannes Berg 	IEEE80211_TX_RC_MCS			= BIT(3),
1027e6a9854bSJohannes Berg 	IEEE80211_TX_RC_GREEN_FIELD		= BIT(4),
1028e6a9854bSJohannes Berg 	IEEE80211_TX_RC_40_MHZ_WIDTH		= BIT(5),
1029e6a9854bSJohannes Berg 	IEEE80211_TX_RC_DUP_DATA		= BIT(6),
1030e6a9854bSJohannes Berg 	IEEE80211_TX_RC_SHORT_GI		= BIT(7),
10318bc83c24SJohannes Berg 	IEEE80211_TX_RC_VHT_MCS			= BIT(8),
10328bc83c24SJohannes Berg 	IEEE80211_TX_RC_80_MHZ_WIDTH		= BIT(9),
10338bc83c24SJohannes Berg 	IEEE80211_TX_RC_160_MHZ_WIDTH		= BIT(10),
103411f4b1ceSRon Rindjunsky };
103511f4b1ceSRon Rindjunsky 
1036e039fa4aSJohannes Berg 
1037e6a9854bSJohannes Berg /* there are 40 bytes if you don't need the rateset to be kept */
1038e6a9854bSJohannes Berg #define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
1039e039fa4aSJohannes Berg 
1040e6a9854bSJohannes Berg /* if you do need the rateset, then you have less space */
1041e6a9854bSJohannes Berg #define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
1042e6a9854bSJohannes Berg 
1043e6a9854bSJohannes Berg /* maximum number of rate stages */
1044e3e1a0bcSThomas Huehn #define IEEE80211_TX_MAX_RATES	4
1045870abdf6SFelix Fietkau 
10460d528d85SFelix Fietkau /* maximum number of rate table entries */
10470d528d85SFelix Fietkau #define IEEE80211_TX_RATE_TABLE_SIZE	4
10480d528d85SFelix Fietkau 
1049870abdf6SFelix Fietkau /**
1050e6a9854bSJohannes Berg  * struct ieee80211_tx_rate - rate selection/status
1051870abdf6SFelix Fietkau  *
1052e6a9854bSJohannes Berg  * @idx: rate index to attempt to send with
1053e6a9854bSJohannes Berg  * @flags: rate control flags (&enum mac80211_rate_control_flags)
1054e25cf4a6SJohannes Berg  * @count: number of tries in this rate before going to the next rate
1055e6a9854bSJohannes Berg  *
1056e6a9854bSJohannes Berg  * A value of -1 for @idx indicates an invalid rate and, if used
1057e6a9854bSJohannes Berg  * in an array of retry rates, that no more rates should be tried.
1058e6a9854bSJohannes Berg  *
1059e6a9854bSJohannes Berg  * When used for transmit status reporting, the driver should
1060e6a9854bSJohannes Berg  * always report the rate along with the flags it used.
1061c555b9b3SJohannes Berg  *
1062c555b9b3SJohannes Berg  * &struct ieee80211_tx_info contains an array of these structs
1063c555b9b3SJohannes Berg  * in the control information, and it will be filled by the rate
1064c555b9b3SJohannes Berg  * control algorithm according to what should be sent. For example,
1065c555b9b3SJohannes Berg  * if this array contains, in the format { <idx>, <count> } the
1066b4f7f4adSJani Nikula  * information::
1067b4f7f4adSJani Nikula  *
1068c555b9b3SJohannes Berg  *    { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
1069b4f7f4adSJani Nikula  *
1070c555b9b3SJohannes Berg  * then this means that the frame should be transmitted
1071c555b9b3SJohannes Berg  * up to twice at rate 3, up to twice at rate 2, and up to four
1072c555b9b3SJohannes Berg  * times at rate 1 if it doesn't get acknowledged. Say it gets
1073c555b9b3SJohannes Berg  * acknowledged by the peer after the fifth attempt, the status
1074b4f7f4adSJani Nikula  * information should then contain::
1075b4f7f4adSJani Nikula  *
1076c555b9b3SJohannes Berg  *   { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
1077b4f7f4adSJani Nikula  *
1078c555b9b3SJohannes Berg  * since it was transmitted twice at rate 3, twice at rate 2
1079c555b9b3SJohannes Berg  * and once at rate 1 after which we received an acknowledgement.
1080870abdf6SFelix Fietkau  */
1081e6a9854bSJohannes Berg struct ieee80211_tx_rate {
1082e6a9854bSJohannes Berg 	s8 idx;
10838bc83c24SJohannes Berg 	u16 count:5,
10848bc83c24SJohannes Berg 	    flags:11;
10853f30fc15SGustavo F. Padovan } __packed;
1086870abdf6SFelix Fietkau 
10878bc83c24SJohannes Berg #define IEEE80211_MAX_TX_RETRY		31
10888bc83c24SJohannes Berg 
ieee80211_rate_set_vht(struct ieee80211_tx_rate * rate,u8 mcs,u8 nss)10898bc83c24SJohannes Berg static inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
10908bc83c24SJohannes Berg 					  u8 mcs, u8 nss)
10918bc83c24SJohannes Berg {
10928bc83c24SJohannes Berg 	WARN_ON(mcs & ~0xF);
10936bc8312fSKarl Beldan 	WARN_ON((nss - 1) & ~0x7);
10946bc8312fSKarl Beldan 	rate->idx = ((nss - 1) << 4) | mcs;
10958bc83c24SJohannes Berg }
10968bc83c24SJohannes Berg 
10978bc83c24SJohannes Berg static inline u8
ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate * rate)10988bc83c24SJohannes Berg ieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate)
10998bc83c24SJohannes Berg {
11008bc83c24SJohannes Berg 	return rate->idx & 0xF;
11018bc83c24SJohannes Berg }
11028bc83c24SJohannes Berg 
11038bc83c24SJohannes Berg static inline u8
ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate * rate)11048bc83c24SJohannes Berg ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)
11058bc83c24SJohannes Berg {
11066bc8312fSKarl Beldan 	return (rate->idx >> 4) + 1;
11078bc83c24SJohannes Berg }
11088bc83c24SJohannes Berg 
1109e039fa4aSJohannes Berg /**
1110e039fa4aSJohannes Berg  * struct ieee80211_tx_info - skb transmit information
11111c014420SIvo van Doorn  *
1112e039fa4aSJohannes Berg  * This structure is placed in skb->cb for three uses:
1113e039fa4aSJohannes Berg  *  (1) mac80211 TX control - mac80211 tells the driver what to do
1114e039fa4aSJohannes Berg  *  (2) driver internal use (if applicable)
1115e039fa4aSJohannes Berg  *  (3) TX status information - driver tells mac80211 what happened
1116e039fa4aSJohannes Berg  *
1117e039fa4aSJohannes Berg  * @flags: transmit info flags, defined above
1118eef25a66SJohannes Berg  * @band: the band to transmit on (use e.g. for checking for races),
1119eef25a66SJohannes Berg  *	not valid if the interface is an MLD since we won't know which
1120eef25a66SJohannes Berg  *	link the frame will be transmitted on
11213a25a8c8SJohannes Berg  * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
1122a729cff8SJohannes Berg  * @ack_frame_id: internal frame ID for TX status, used internally
11236912daedSToke Høiland-Jørgensen  * @tx_time_est: TX time estimate in units of 4us, used internally
11247d419463SJohannes Berg  * @control: union part for control data
11257d419463SJohannes Berg  * @control.rates: TX rates array to try
11267d419463SJohannes Berg  * @control.rts_cts_rate_idx: rate for RTS or CTS
11277d419463SJohannes Berg  * @control.use_rts: use RTS
11287d419463SJohannes Berg  * @control.use_cts_prot: use RTS/CTS
11297d419463SJohannes Berg  * @control.short_preamble: use short preamble (CCK only)
11307d419463SJohannes Berg  * @control.skip_table: skip externally configured rate table
11317d419463SJohannes Berg  * @control.jiffies: timestamp for expiry on powersave clients
11327d419463SJohannes Berg  * @control.vif: virtual interface (may be NULL)
11337d419463SJohannes Berg  * @control.hw_key: key to encrypt with (may be NULL)
11347d419463SJohannes Berg  * @control.flags: control flags, see &enum mac80211_tx_control_flags
11357d419463SJohannes Berg  * @control.enqueue_time: enqueue time (for iTXQs)
11367d419463SJohannes Berg  * @driver_rates: alias to @control.rates to reserve space
11377d419463SJohannes Berg  * @pad: padding
11387d419463SJohannes Berg  * @rate_driver_data: driver use area if driver needs @control.rates
11397d419463SJohannes Berg  * @status: union part for status data
11407d419463SJohannes Berg  * @status.rates: attempted rates
11417d419463SJohannes Berg  * @status.ack_signal: ACK signal
11427d419463SJohannes Berg  * @status.ampdu_ack_len: AMPDU ack length
11437d419463SJohannes Berg  * @status.ampdu_len: AMPDU length
11447d419463SJohannes Berg  * @status.antenna: (legacy, kept only for iwlegacy)
1145c74114d7SFelix Fietkau  * @status.tx_time: airtime consumed for transmission; note this is only
1146c74114d7SFelix Fietkau  *	used for WMM AC, not for airtime fairness
1147ea5907dbSAvraham Stern  * @status.flags: status flags, see &enum mac80211_tx_status_flags
11487d419463SJohannes Berg  * @status.status_driver_data: driver use area
11497d419463SJohannes Berg  * @ack: union part for pure ACK data
11507d419463SJohannes Berg  * @ack.cookie: cookie for the ACK
11516ef307bcSRandy Dunlap  * @driver_data: array of driver_data pointers
1152599bf6a4SFelix Fietkau  * @ampdu_ack_len: number of acked aggregated frames.
115393d95b12SDaniel Halperin  * 	relevant only if IEEE80211_TX_STAT_AMPDU was set.
1154599bf6a4SFelix Fietkau  * @ampdu_len: number of aggregated frames.
115593d95b12SDaniel Halperin  * 	relevant only if IEEE80211_TX_STAT_AMPDU was set.
1156e039fa4aSJohannes Berg  * @ack_signal: signal strength of the ACK frame
11571c014420SIvo van Doorn  */
1158e039fa4aSJohannes Berg struct ieee80211_tx_info {
1159e039fa4aSJohannes Berg 	/* common information */
1160e039fa4aSJohannes Berg 	u32 flags;
1161f2b18bacSJohannes Berg 	u32 band:3,
1162f2b18bacSJohannes Berg 	    ack_frame_id:13,
1163f2b18bacSJohannes Berg 	    hw_queue:4,
1164f2b18bacSJohannes Berg 	    tx_time_est:10;
1165f2b18bacSJohannes Berg 	/* 2 free bits */
11662e92e6f2SJohannes Berg 
1167e039fa4aSJohannes Berg 	union {
1168e039fa4aSJohannes Berg 		struct {
1169e6a9854bSJohannes Berg 			union {
1170e6a9854bSJohannes Berg 				/* rate control */
1171e6a9854bSJohannes Berg 				struct {
1172e6a9854bSJohannes Berg 					struct ieee80211_tx_rate rates[
1173e6a9854bSJohannes Berg 						IEEE80211_TX_MAX_RATES];
1174e6a9854bSJohannes Berg 					s8 rts_cts_rate_idx;
1175991fec09SFelix Fietkau 					u8 use_rts:1;
1176991fec09SFelix Fietkau 					u8 use_cts_prot:1;
11770d528d85SFelix Fietkau 					u8 short_preamble:1;
11780d528d85SFelix Fietkau 					u8 skip_table:1;
1179991fec09SFelix Fietkau 					/* 2 bytes free */
1180e6a9854bSJohannes Berg 				};
1181e6a9854bSJohannes Berg 				/* only needed before rate control */
1182e6a9854bSJohannes Berg 				unsigned long jiffies;
1183e6a9854bSJohannes Berg 			};
118425d834e1SJohannes Berg 			/* NB: vif can be NULL for injected frames */
118532bfd35dSJohannes Berg 			struct ieee80211_vif *vif;
11861c014420SIvo van Doorn 			struct ieee80211_key_conf *hw_key;
1187af61a165SJohannes Berg 			u32 flags;
118853168215SJohannes Berg 			codel_time_t enqueue_time;
1189e039fa4aSJohannes Berg 		} control;
1190e039fa4aSJohannes Berg 		struct {
11913b79af97SJohannes Berg 			u64 cookie;
11923b79af97SJohannes Berg 		} ack;
11933b79af97SJohannes Berg 		struct {
1194e6a9854bSJohannes Berg 			struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
1195a0f995a5SEliad Peller 			s32 ack_signal;
1196e3e1a0bcSThomas Huehn 			u8 ampdu_ack_len;
1197599bf6a4SFelix Fietkau 			u8 ampdu_len;
1198d748b464SJohannes Berg 			u8 antenna;
1199a7a2ef0cSArnd Bergmann 			u8 pad;
120002219b3aSJohannes Berg 			u16 tx_time;
1201ea5907dbSAvraham Stern 			u8 flags;
1202a7a2ef0cSArnd Bergmann 			u8 pad2;
1203a7a2ef0cSArnd Bergmann 			void *status_driver_data[16 / sizeof(void *)];
1204e039fa4aSJohannes Berg 		} status;
1205e6a9854bSJohannes Berg 		struct {
1206e6a9854bSJohannes Berg 			struct ieee80211_tx_rate driver_rates[
1207e6a9854bSJohannes Berg 				IEEE80211_TX_MAX_RATES];
12080d528d85SFelix Fietkau 			u8 pad[4];
12090d528d85SFelix Fietkau 
1210e6a9854bSJohannes Berg 			void *rate_driver_data[
1211e6a9854bSJohannes Berg 				IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
1212e6a9854bSJohannes Berg 		};
1213e6a9854bSJohannes Berg 		void *driver_data[
1214e6a9854bSJohannes Berg 			IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
1215f0706e82SJiri Benc 	};
1216f0706e82SJiri Benc };
1217f0706e82SJiri Benc 
12187a89233aSToke Høiland-Jørgensen static inline u16
ieee80211_info_set_tx_time_est(struct ieee80211_tx_info * info,u16 tx_time_est)12197a89233aSToke Høiland-Jørgensen ieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u16 tx_time_est)
12207a89233aSToke Høiland-Jørgensen {
12217a89233aSToke Høiland-Jørgensen 	/* We only have 10 bits in tx_time_est, so store airtime
12227a89233aSToke Høiland-Jørgensen 	 * in increments of 4us and clamp the maximum to 2**12-1
12237a89233aSToke Høiland-Jørgensen 	 */
12247a89233aSToke Høiland-Jørgensen 	info->tx_time_est = min_t(u16, tx_time_est, 4095) >> 2;
12257a89233aSToke Høiland-Jørgensen 	return info->tx_time_est << 2;
12267a89233aSToke Høiland-Jørgensen }
12277a89233aSToke Høiland-Jørgensen 
12287a89233aSToke Høiland-Jørgensen static inline u16
ieee80211_info_get_tx_time_est(struct ieee80211_tx_info * info)12297a89233aSToke Høiland-Jørgensen ieee80211_info_get_tx_time_est(struct ieee80211_tx_info *info)
12307a89233aSToke Høiland-Jørgensen {
12317a89233aSToke Høiland-Jørgensen 	return info->tx_time_est << 2;
12327a89233aSToke Høiland-Jørgensen }
12337a89233aSToke Høiland-Jørgensen 
123444fa75f2SJonas Jelonek /***
123544fa75f2SJonas Jelonek  * struct ieee80211_rate_status - mrr stage for status path
123644fa75f2SJonas Jelonek  *
123744fa75f2SJonas Jelonek  * This struct is used in struct ieee80211_tx_status to provide drivers a
123844fa75f2SJonas Jelonek  * dynamic way to report about used rates and power levels per packet.
123944fa75f2SJonas Jelonek  *
124044fa75f2SJonas Jelonek  * @rate_idx The actual used rate.
124144fa75f2SJonas Jelonek  * @try_count How often the rate was tried.
124244fa75f2SJonas Jelonek  * @tx_power_idx An idx into the ieee80211_hw->tx_power_levels list of the
124344fa75f2SJonas Jelonek  * 	corresponding wifi hardware. The idx shall point to the power level
124444fa75f2SJonas Jelonek  * 	that was used when sending the packet.
124544fa75f2SJonas Jelonek  */
124644fa75f2SJonas Jelonek struct ieee80211_rate_status {
124744fa75f2SJonas Jelonek 	struct rate_info rate_idx;
124844fa75f2SJonas Jelonek 	u8 try_count;
124944fa75f2SJonas Jelonek 	u8 tx_power_idx;
125044fa75f2SJonas Jelonek };
125144fa75f2SJonas Jelonek 
125279f460caSLuciano Coelho /**
1253ae4a50eeSChris Packham  * struct ieee80211_tx_status - extended tx status info for rate control
125418fb84d9SFelix Fietkau  *
125518fb84d9SFelix Fietkau  * @sta: Station that the packet was transmitted for
125618fb84d9SFelix Fietkau  * @info: Basic tx status information
125718fb84d9SFelix Fietkau  * @skb: Packet skb (can be NULL if not provided by the driver)
125844fa75f2SJonas Jelonek  * @rates: Mrr stages that were used when sending the packet
125944fa75f2SJonas Jelonek  * @n_rates: Number of mrr stages (count of instances for @rates)
1260f02dff93SFelix Fietkau  * @free_list: list where processed skbs are stored to be free'd by the driver
1261f9202638SAvraham Stern  * @ack_hwtstamp: Hardware timestamp of the received ack in nanoseconds
1262f9202638SAvraham Stern  *	Only needed for Timing measurement and Fine timing measurement action
1263f9202638SAvraham Stern  *	frames. Only reported by devices that have timestamping enabled.
126418fb84d9SFelix Fietkau  */
126518fb84d9SFelix Fietkau struct ieee80211_tx_status {
126618fb84d9SFelix Fietkau 	struct ieee80211_sta *sta;
126718fb84d9SFelix Fietkau 	struct ieee80211_tx_info *info;
126818fb84d9SFelix Fietkau 	struct sk_buff *skb;
126944fa75f2SJonas Jelonek 	struct ieee80211_rate_status *rates;
1270f9202638SAvraham Stern 	ktime_t ack_hwtstamp;
127144fa75f2SJonas Jelonek 	u8 n_rates;
127244fa75f2SJonas Jelonek 
1273f02dff93SFelix Fietkau 	struct list_head *free_list;
127418fb84d9SFelix Fietkau };
127518fb84d9SFelix Fietkau 
127618fb84d9SFelix Fietkau /**
1277c56ef672SDavid Spinadel  * struct ieee80211_scan_ies - descriptors for different blocks of IEs
1278c56ef672SDavid Spinadel  *
1279633e2713SDavid Spinadel  * This structure is used to point to different blocks of IEs in HW scan
1280633e2713SDavid Spinadel  * and scheduled scan. These blocks contain the IEs passed by userspace
1281633e2713SDavid Spinadel  * and the ones generated by mac80211.
1282c56ef672SDavid Spinadel  *
1283c56ef672SDavid Spinadel  * @ies: pointers to band specific IEs.
1284c56ef672SDavid Spinadel  * @len: lengths of band_specific IEs.
1285c56ef672SDavid Spinadel  * @common_ies: IEs for all bands (especially vendor specific ones)
1286c56ef672SDavid Spinadel  * @common_ie_len: length of the common_ies
1287c56ef672SDavid Spinadel  */
1288c56ef672SDavid Spinadel struct ieee80211_scan_ies {
128957fbcce3SJohannes Berg 	const u8 *ies[NUM_NL80211_BANDS];
129057fbcce3SJohannes Berg 	size_t len[NUM_NL80211_BANDS];
1291c56ef672SDavid Spinadel 	const u8 *common_ies;
1292c56ef672SDavid Spinadel 	size_t common_ie_len;
1293c56ef672SDavid Spinadel };
1294c56ef672SDavid Spinadel 
1295c56ef672SDavid Spinadel 
IEEE80211_SKB_CB(struct sk_buff * skb)1296e039fa4aSJohannes Berg static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
1297e039fa4aSJohannes Berg {
1298e039fa4aSJohannes Berg 	return (struct ieee80211_tx_info *)skb->cb;
1299e039fa4aSJohannes Berg }
1300f0706e82SJiri Benc 
IEEE80211_SKB_RXCB(struct sk_buff * skb)1301f1d58c25SJohannes Berg static inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb)
1302f1d58c25SJohannes Berg {
1303f1d58c25SJohannes Berg 	return (struct ieee80211_rx_status *)skb->cb;
1304f1d58c25SJohannes Berg }
1305f1d58c25SJohannes Berg 
1306e6a9854bSJohannes Berg /**
1307e6a9854bSJohannes Berg  * ieee80211_tx_info_clear_status - clear TX status
1308e6a9854bSJohannes Berg  *
1309e6a9854bSJohannes Berg  * @info: The &struct ieee80211_tx_info to be cleared.
1310e6a9854bSJohannes Berg  *
1311e6a9854bSJohannes Berg  * When the driver passes an skb back to mac80211, it must report
1312e6a9854bSJohannes Berg  * a number of things in TX status. This function clears everything
1313e6a9854bSJohannes Berg  * in the TX status but the rate control information (it does clear
1314e6a9854bSJohannes Berg  * the count since you need to fill that in anyway).
1315e6a9854bSJohannes Berg  *
1316e5c95ca0SToke Høiland-Jørgensen  * NOTE: While the rates array is kept intact, this will wipe all of the
1317e5c95ca0SToke Høiland-Jørgensen  *	 driver_data fields in info, so it's up to the driver to restore
1318e5c95ca0SToke Høiland-Jørgensen  *	 any fields it needs after calling this helper.
1319e6a9854bSJohannes Berg  */
1320e6a9854bSJohannes Berg static inline void
ieee80211_tx_info_clear_status(struct ieee80211_tx_info * info)1321e6a9854bSJohannes Berg ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
1322e6a9854bSJohannes Berg {
1323e6a9854bSJohannes Berg 	int i;
1324e6a9854bSJohannes Berg 
1325e6a9854bSJohannes Berg 	BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
1326e6a9854bSJohannes Berg 		     offsetof(struct ieee80211_tx_info, control.rates));
1327e6a9854bSJohannes Berg 	BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
1328e6a9854bSJohannes Berg 		     offsetof(struct ieee80211_tx_info, driver_rates));
1329e6a9854bSJohannes Berg 	BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8);
1330e6a9854bSJohannes Berg 	/* clear the rate counts */
1331e6a9854bSJohannes Berg 	for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
1332e6a9854bSJohannes Berg 		info->status.rates[i].count = 0;
1333fb5f6a0eSKees Cook 	memset_after(&info->status, 0, rates);
1334e6a9854bSJohannes Berg }
1335e6a9854bSJohannes Berg 
13367ac1bd6aSJohannes Berg 
13377ac1bd6aSJohannes Berg /**
13387ac1bd6aSJohannes Berg  * enum mac80211_rx_flags - receive flags
13397ac1bd6aSJohannes Berg  *
13407ac1bd6aSJohannes Berg  * These flags are used with the @flag member of &struct ieee80211_rx_status.
13417ac1bd6aSJohannes Berg  * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame.
13427ac1bd6aSJohannes Berg  *	Use together with %RX_FLAG_MMIC_STRIPPED.
13437ac1bd6aSJohannes Berg  * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware.
13447ac1bd6aSJohannes Berg  * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame,
13457ac1bd6aSJohannes Berg  *	verification has been done by the hardware.
1346cef0acd4SDavid Spinadel  * @RX_FLAG_IV_STRIPPED: The IV and ICV are stripped from this frame.
13477ac1bd6aSJohannes Berg  *	If this flag is set, the stack cannot do any replay detection
13487ac1bd6aSJohannes Berg  *	hence the driver or hardware will have to do that.
1349981d94a8SJohannes Berg  * @RX_FLAG_PN_VALIDATED: Currently only valid for CCMP/GCMP frames, this
1350981d94a8SJohannes Berg  *	flag indicates that the PN was verified for replay protection.
1351981d94a8SJohannes Berg  *	Note that this flag is also currently only supported when a frame
1352981d94a8SJohannes Berg  *	is also decrypted (ie. @RX_FLAG_DECRYPTED must be set)
135384ea3a18SLuis de Bethencourt  * @RX_FLAG_DUP_VALIDATED: The driver should set this flag if it did
135484ea3a18SLuis de Bethencourt  *	de-duplication by itself.
135572abd81bSJohannes Berg  * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on
135672abd81bSJohannes Berg  *	the frame.
135772abd81bSJohannes Berg  * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
135872abd81bSJohannes Berg  *	the frame.
1359f4bda337SThomas Pedersen  * @RX_FLAG_MACTIME_START: The timestamp passed in the RX status (@mactime
13606ebacbb7SJohannes Berg  *	field) is valid and contains the time the first symbol of the MPDU
13616ebacbb7SJohannes Berg  *	was received. This is useful in monitor mode and for proper IBSS
13626ebacbb7SJohannes Berg  *	merging.
1363f4bda337SThomas Pedersen  * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime
1364f4bda337SThomas Pedersen  *	field) is valid and contains the time the last symbol of the MPDU
1365f4bda337SThomas Pedersen  *	(including FCS) was received.
1366f4a0f0c5SJohannes Berg  * @RX_FLAG_MACTIME_PLCP_START: The timestamp passed in the RX status (@mactime
1367f4a0f0c5SJohannes Berg  *	field) is valid and contains the time the SYNC preamble was received.
1368fe8431f8SFelix Fietkau  * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
1369fe8431f8SFelix Fietkau  *	Valid only for data frames (mainly A-MPDU)
13704c298677SJohannes Berg  * @RX_FLAG_AMPDU_DETAILS: A-MPDU details are known, in particular the reference
13714c298677SJohannes Berg  *	number (@ampdu_reference) must be populated and be a distinct number for
13724c298677SJohannes Berg  *	each A-MPDU
13734c298677SJohannes Berg  * @RX_FLAG_AMPDU_LAST_KNOWN: last subframe is known, should be set on all
13744c298677SJohannes Berg  *	subframes of a single A-MPDU
13754c298677SJohannes Berg  * @RX_FLAG_AMPDU_IS_LAST: this subframe is the last subframe of the A-MPDU
13764c298677SJohannes Berg  * @RX_FLAG_AMPDU_DELIM_CRC_ERROR: A delimiter CRC error has been detected
13774c298677SJohannes Berg  *	on this subframe
13784c298677SJohannes Berg  * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
13794c298677SJohannes Berg  *	is stored in the @ampdu_delimiter_crc field)
1380f980ebc0SSara Sharon  * @RX_FLAG_MIC_STRIPPED: The mic was stripped of this packet. Decryption was
1381f980ebc0SSara Sharon  *	done by the hardware
138217883048SGrzegorz Bajorski  * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without
138317883048SGrzegorz Bajorski  *	processing it in any regular way.
138417883048SGrzegorz Bajorski  *	This is useful if drivers offload some frames but still want to report
138517883048SGrzegorz Bajorski  *	them for sniffing purposes.
138617883048SGrzegorz Bajorski  * @RX_FLAG_SKIP_MONITOR: Process and report frame to all interfaces except
138717883048SGrzegorz Bajorski  *	monitor interfaces.
138817883048SGrzegorz Bajorski  *	This is useful if drivers offload some frames but still want to report
138917883048SGrzegorz Bajorski  *	them for sniffing purposes.
13900cfcefefSMichal Kazior  * @RX_FLAG_AMSDU_MORE: Some drivers may prefer to report separate A-MSDU
13910cfcefefSMichal Kazior  *	subframes instead of a one huge frame for performance reasons.
13920cfcefefSMichal Kazior  *	All, but the last MSDU from an A-MSDU should have this flag set. E.g.
13930cfcefefSMichal Kazior  *	if an A-MSDU has 3 frames, the first 2 must have the flag set, while
13940cfcefefSMichal Kazior  *	the 3rd (last) one must not have this flag set. The flag is used to
13950cfcefefSMichal Kazior  *	deal with retransmission/duplication recovery properly since A-MSDU
13960cfcefefSMichal Kazior  *	subframes share the same sequence number. Reported subframes can be
13970cfcefefSMichal Kazior  *	either regular MSDU or singly A-MSDUs. Subframes must not be
13980cfcefefSMichal Kazior  *	interleaved with other frames.
13999179dff8SMordechay Goodstein  * @RX_FLAG_RADIOTAP_TLV_AT_END: This frame contains radiotap TLVs in the
14009179dff8SMordechay Goodstein  *	skb->data (before the 802.11 header).
14019179dff8SMordechay Goodstein  *	If used, the SKB's mac_header pointer must be set to point
14029179dff8SMordechay Goodstein  *	to the 802.11 header after the TLVs, and any padding added after TLV
14039179dff8SMordechay Goodstein  *	data to align to 4 must be cleared by the driver putting the TLVs
14049179dff8SMordechay Goodstein  *	in the skb.
1405f631a77bSSara Sharon  * @RX_FLAG_ALLOW_SAME_PN: Allow the same PN as same packet before.
1406f631a77bSSara Sharon  *	This is used for AMSDU subframes which can have the same PN as
1407f631a77bSSara Sharon  *	the first subframe.
1408cef0acd4SDavid Spinadel  * @RX_FLAG_ICV_STRIPPED: The ICV is stripped from this frame. CRC checking must
1409cef0acd4SDavid Spinadel  *	be done in the hardware.
14107299d6f7SJohannes Berg  * @RX_FLAG_AMPDU_EOF_BIT: Value of the EOF bit in the A-MPDU delimiter for this
14117299d6f7SJohannes Berg  *	frame
14127299d6f7SJohannes Berg  * @RX_FLAG_AMPDU_EOF_BIT_KNOWN: The EOF value is known
141341cbb0f5SLuca Coelho  * @RX_FLAG_RADIOTAP_HE: HE radiotap data is present
141441cbb0f5SLuca Coelho  *	(&struct ieee80211_radiotap_he, mac80211 will fill in
14157d419463SJohannes Berg  *
141641cbb0f5SLuca Coelho  *	 - DATA3_DATA_MCS
141741cbb0f5SLuca Coelho  *	 - DATA3_DATA_DCM
141841cbb0f5SLuca Coelho  *	 - DATA3_CODING
141941cbb0f5SLuca Coelho  *	 - DATA5_GI
142041cbb0f5SLuca Coelho  *	 - DATA5_DATA_BW_RU_ALLOC
142141cbb0f5SLuca Coelho  *	 - DATA6_NSTS
142241cbb0f5SLuca Coelho  *	 - DATA3_STBC
14237d419463SJohannes Berg  *
142441cbb0f5SLuca Coelho  *	from the RX info data, so leave those zeroed when building this data)
142541cbb0f5SLuca Coelho  * @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present
142641cbb0f5SLuca Coelho  *	(&struct ieee80211_radiotap_he_mu)
1427d1332e7bSShaul Triebitz  * @RX_FLAG_RADIOTAP_LSIG: L-SIG radiotap data is present
1428c3d1f875SShaul Triebitz  * @RX_FLAG_NO_PSDU: use the frame only for radiotap reporting, with
1429c3d1f875SShaul Triebitz  *	the "0-length PSDU" field included there.  The value for it is
1430c3d1f875SShaul Triebitz  *	in &struct ieee80211_rx_status.  Note that if this value isn't
1431c3d1f875SShaul Triebitz  *	known the frame shouldn't be reported.
143280a915ecSFelix Fietkau  * @RX_FLAG_8023: the frame has an 802.3 header (decap offload performed by
143380a915ecSFelix Fietkau  *	hardware or driver)
14347ac1bd6aSJohannes Berg  */
14357ac1bd6aSJohannes Berg enum mac80211_rx_flags {
14364c298677SJohannes Berg 	RX_FLAG_MMIC_ERROR		= BIT(0),
14374c298677SJohannes Berg 	RX_FLAG_DECRYPTED		= BIT(1),
1438f4a0f0c5SJohannes Berg 	RX_FLAG_MACTIME_PLCP_START	= BIT(2),
14394c298677SJohannes Berg 	RX_FLAG_MMIC_STRIPPED		= BIT(3),
14404c298677SJohannes Berg 	RX_FLAG_IV_STRIPPED		= BIT(4),
14414c298677SJohannes Berg 	RX_FLAG_FAILED_FCS_CRC		= BIT(5),
14424c298677SJohannes Berg 	RX_FLAG_FAILED_PLCP_CRC 	= BIT(6),
1443f4bda337SThomas Pedersen 	RX_FLAG_MACTIME_START		= BIT(7),
14447fdd69c5SJohannes Berg 	RX_FLAG_NO_SIGNAL_VAL		= BIT(8),
14457fdd69c5SJohannes Berg 	RX_FLAG_AMPDU_DETAILS		= BIT(9),
14467fdd69c5SJohannes Berg 	RX_FLAG_PN_VALIDATED		= BIT(10),
14477fdd69c5SJohannes Berg 	RX_FLAG_DUP_VALIDATED		= BIT(11),
14487fdd69c5SJohannes Berg 	RX_FLAG_AMPDU_LAST_KNOWN	= BIT(12),
14497fdd69c5SJohannes Berg 	RX_FLAG_AMPDU_IS_LAST		= BIT(13),
14507fdd69c5SJohannes Berg 	RX_FLAG_AMPDU_DELIM_CRC_ERROR	= BIT(14),
14517fdd69c5SJohannes Berg 	RX_FLAG_AMPDU_DELIM_CRC_KNOWN	= BIT(15),
14527fdd69c5SJohannes Berg 	RX_FLAG_MACTIME_END		= BIT(16),
14537fdd69c5SJohannes Berg 	RX_FLAG_ONLY_MONITOR		= BIT(17),
14547fdd69c5SJohannes Berg 	RX_FLAG_SKIP_MONITOR		= BIT(18),
14557fdd69c5SJohannes Berg 	RX_FLAG_AMSDU_MORE		= BIT(19),
14569179dff8SMordechay Goodstein 	RX_FLAG_RADIOTAP_TLV_AT_END	= BIT(20),
14577fdd69c5SJohannes Berg 	RX_FLAG_MIC_STRIPPED		= BIT(21),
14587fdd69c5SJohannes Berg 	RX_FLAG_ALLOW_SAME_PN		= BIT(22),
14597fdd69c5SJohannes Berg 	RX_FLAG_ICV_STRIPPED		= BIT(23),
14607299d6f7SJohannes Berg 	RX_FLAG_AMPDU_EOF_BIT		= BIT(24),
14617299d6f7SJohannes Berg 	RX_FLAG_AMPDU_EOF_BIT_KNOWN	= BIT(25),
146241cbb0f5SLuca Coelho 	RX_FLAG_RADIOTAP_HE		= BIT(26),
146341cbb0f5SLuca Coelho 	RX_FLAG_RADIOTAP_HE_MU		= BIT(27),
1464d1332e7bSShaul Triebitz 	RX_FLAG_RADIOTAP_LSIG		= BIT(28),
1465c3d1f875SShaul Triebitz 	RX_FLAG_NO_PSDU			= BIT(29),
146680a915ecSFelix Fietkau 	RX_FLAG_8023			= BIT(30),
14677ac1bd6aSJohannes Berg };
14687ac1bd6aSJohannes Berg 
14697ac1bd6aSJohannes Berg /**
14707fdd69c5SJohannes Berg  * enum mac80211_rx_encoding_flags - MCS & bandwidth flags
14711b8d242aSEmmanuel Grumbach  *
14727fdd69c5SJohannes Berg  * @RX_ENC_FLAG_SHORTPRE: Short preamble was used for this frame
14737fdd69c5SJohannes Berg  * @RX_ENC_FLAG_SHORT_GI: Short guard interval was used
14747fdd69c5SJohannes Berg  * @RX_ENC_FLAG_HT_GF: This frame was received in a HT-greenfield transmission,
14757fdd69c5SJohannes Berg  *	if the driver fills this value it should add
14767fdd69c5SJohannes Berg  *	%IEEE80211_RADIOTAP_MCS_HAVE_FMT
14777d419463SJohannes Berg  *	to @hw.radiotap_mcs_details to advertise that fact.
14787fdd69c5SJohannes Berg  * @RX_ENC_FLAG_LDPC: LDPC was used
14797fdd69c5SJohannes Berg  * @RX_ENC_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
14807fdd69c5SJohannes Berg  * @RX_ENC_FLAG_BF: packet was beamformed
14811b8d242aSEmmanuel Grumbach  */
14827fdd69c5SJohannes Berg enum mac80211_rx_encoding_flags {
14837fdd69c5SJohannes Berg 	RX_ENC_FLAG_SHORTPRE		= BIT(0),
1484da6a4352SJohannes Berg 	RX_ENC_FLAG_SHORT_GI		= BIT(2),
1485da6a4352SJohannes Berg 	RX_ENC_FLAG_HT_GF		= BIT(3),
1486da6a4352SJohannes Berg 	RX_ENC_FLAG_STBC_MASK		= BIT(4) | BIT(5),
1487da6a4352SJohannes Berg 	RX_ENC_FLAG_LDPC		= BIT(6),
1488da6a4352SJohannes Berg 	RX_ENC_FLAG_BF			= BIT(7),
14891b8d242aSEmmanuel Grumbach };
14901b8d242aSEmmanuel Grumbach 
1491da6a4352SJohannes Berg #define RX_ENC_FLAG_STBC_SHIFT		4
1492da6a4352SJohannes Berg 
1493da6a4352SJohannes Berg enum mac80211_rx_encoding {
1494da6a4352SJohannes Berg 	RX_ENC_LEGACY = 0,
1495da6a4352SJohannes Berg 	RX_ENC_HT,
1496da6a4352SJohannes Berg 	RX_ENC_VHT,
149741cbb0f5SLuca Coelho 	RX_ENC_HE,
1498f66c48afSJohannes Berg 	RX_ENC_EHT,
1499da6a4352SJohannes Berg };
15007fdd69c5SJohannes Berg 
15011b8d242aSEmmanuel Grumbach /**
15027ac1bd6aSJohannes Berg  * struct ieee80211_rx_status - receive status
15037ac1bd6aSJohannes Berg  *
15047ac1bd6aSJohannes Berg  * The low-level driver should provide this information (the subset
15057ac1bd6aSJohannes Berg  * supported by hardware) to the 802.11 code with each received
1506f1d58c25SJohannes Berg  * frame, in the skb's control buffer (cb).
1507566bfe5aSBruno Randolf  *
1508c132bec3SBruno Randolf  * @mactime: value in microseconds of the 64-bit Time Synchronization Function
1509c132bec3SBruno Randolf  * 	(TSF) timer when the first data symbol (MPDU) arrived at the hardware.
1510162dd6a7SJohannes Berg  * @boottime_ns: CLOCK_BOOTTIME timestamp the frame was received at, this is
1511162dd6a7SJohannes Berg  *	needed only for beacons and probe responses that update the scan cache.
1512f9202638SAvraham Stern  * @ack_tx_hwtstamp: Hardware timestamp for the ack TX in nanoseconds. Only
1513f9202638SAvraham Stern  *	needed for Timing measurement and Fine timing measurement action frames.
1514f9202638SAvraham Stern  *	Only reported by devices that have timestamping enabled.
15158c358bcdSJohannes Berg  * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use
15168c358bcdSJohannes Berg  *	it but can store it and pass it back to the driver for synchronisation
15178318d78aSJohannes Berg  * @band: the active band when this frame was received
15187ac1bd6aSJohannes Berg  * @freq: frequency the radio was tuned to when receiving this frame, in MHz
15194352a4d7SJohannes Berg  *	This field must be set for management frames, but isn't strictly needed
15204352a4d7SJohannes Berg  *	for data (other) frames - for those it only affects radiotap reporting.
15213b23c184SThomas Pedersen  * @freq_offset: @freq has a positive offset of 500Khz.
1522566bfe5aSBruno Randolf  * @signal: signal strength when receiving this frame, either in dBm, in dB or
1523566bfe5aSBruno Randolf  *	unspecified depending on the hardware capabilities flags
1524566bfe5aSBruno Randolf  *	@IEEE80211_HW_SIGNAL_*
1525ef0621e8SFelix Fietkau  * @chains: bitmask of receive chains for which separate signal strength
1526ef0621e8SFelix Fietkau  *	values were filled.
1527ef0621e8SFelix Fietkau  * @chain_signal: per-chain signal strength, in dBm (unlike @signal, doesn't
1528ef0621e8SFelix Fietkau  *	support dB or unspecified units)
15297ac1bd6aSJohannes Berg  * @antenna: antenna used
15300fb8ca45SJouni Malinen  * @rate_idx: index of data rate into band's supported rates or MCS index if
15315614618eSJohannes Berg  *	HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
1532f66c48afSJohannes Berg  * @nss: number of streams (VHT, HE and EHT only)
1533b4f7f4adSJani Nikula  * @flag: %RX_FLAG_\*
1534da6a4352SJohannes Berg  * @encoding: &enum mac80211_rx_encoding
1535da6a4352SJohannes Berg  * @bw: &enum rate_info_bw
15367fdd69c5SJohannes Berg  * @enc_flags: uses bits from &enum mac80211_rx_encoding_flags
153741cbb0f5SLuca Coelho  * @he_ru: HE RU, from &enum nl80211_he_ru_alloc
153841cbb0f5SLuca Coelho  * @he_gi: HE GI, from &enum nl80211_he_gi
153941cbb0f5SLuca Coelho  * @he_dcm: HE DCM value
154041ade47cSJohannes Berg  * @eht: EHT specific rate information
1541f66c48afSJohannes Berg  * @eht.ru: EHT RU, from &enum nl80211_eht_ru_alloc
1542f66c48afSJohannes Berg  * @eht.gi: EHT GI, from &enum nl80211_eht_gi
1543554891e6SJohannes Berg  * @rx_flags: internal RX flags for mac80211
15444c298677SJohannes Berg  * @ampdu_reference: A-MPDU reference number, must be a different value for
15454c298677SJohannes Berg  *	each A-MPDU but the same for each subframe within one A-MPDU
15464c298677SJohannes Berg  * @ampdu_delimiter_crc: A-MPDU delimiter CRC
1547c3d1f875SShaul Triebitz  * @zero_length_psdu_type: radiotap type of the 0-length PSDU
1548ea9d807bSVasanthakumar Thiagarajan  * @link_valid: if the link which is identified by @link_id is valid. This flag
1549ea9d807bSVasanthakumar Thiagarajan  *	is set only when connection is MLO.
1550ea9d807bSVasanthakumar Thiagarajan  * @link_id: id of the link used to receive the packet. This is used along with
1551ea9d807bSVasanthakumar Thiagarajan  *	@link_valid.
15527ac1bd6aSJohannes Berg  */
1553f0706e82SJiri Benc struct ieee80211_rx_status {
1554f0706e82SJiri Benc 	u64 mactime;
1555f9202638SAvraham Stern 	union {
1556162dd6a7SJohannes Berg 		u64 boottime_ns;
1557f9202638SAvraham Stern 		ktime_t ack_tx_hwtstamp;
1558f9202638SAvraham Stern 	};
15598c358bcdSJohannes Berg 	u32 device_timestamp;
15604c298677SJohannes Berg 	u32 ampdu_reference;
15617fdd69c5SJohannes Berg 	u32 flag;
15623b23c184SThomas Pedersen 	u16 freq: 13, freq_offset: 1;
1563da6a4352SJohannes Berg 	u8 enc_flags;
1564f66c48afSJohannes Berg 	u8 encoding:3, bw:4;
1565f66c48afSJohannes Berg 	union {
1566f66c48afSJohannes Berg 		struct {
1567f66c48afSJohannes Berg 			u8 he_ru:3;
1568f66c48afSJohannes Berg 			u8 he_gi:2;
1569f66c48afSJohannes Berg 			u8 he_dcm:1;
1570f66c48afSJohannes Berg 		};
1571f66c48afSJohannes Berg 		struct {
1572f66c48afSJohannes Berg 			u8 ru:4;
1573f66c48afSJohannes Berg 			u8 gi:2;
1574f66c48afSJohannes Berg 		} eht;
1575f66c48afSJohannes Berg 	};
157630f42292SJohannes Berg 	u8 rate_idx;
15778613c948SJohannes Berg 	u8 nss;
157830f42292SJohannes Berg 	u8 rx_flags;
157930f42292SJohannes Berg 	u8 band;
158030f42292SJohannes Berg 	u8 antenna;
158130f42292SJohannes Berg 	s8 signal;
1582ef0621e8SFelix Fietkau 	u8 chains;
1583ef0621e8SFelix Fietkau 	s8 chain_signal[IEEE80211_MAX_CHAINS];
15844c298677SJohannes Berg 	u8 ampdu_delimiter_crc;
1585c3d1f875SShaul Triebitz 	u8 zero_length_psdu_type;
1586ea9d807bSVasanthakumar Thiagarajan 	u8 link_valid:1, link_id:4;
1587f0706e82SJiri Benc };
1588f0706e82SJiri Benc 
15893b23c184SThomas Pedersen static inline u32
ieee80211_rx_status_to_khz(struct ieee80211_rx_status * rx_status)15903b23c184SThomas Pedersen ieee80211_rx_status_to_khz(struct ieee80211_rx_status *rx_status)
15913b23c184SThomas Pedersen {
15923b23c184SThomas Pedersen 	return MHZ_TO_KHZ(rx_status->freq) +
15933b23c184SThomas Pedersen 	       (rx_status->freq_offset ? 500 : 0);
15943b23c184SThomas Pedersen }
15953b23c184SThomas Pedersen 
15966b301cdfSJohannes Berg /**
15976b301cdfSJohannes Berg  * enum ieee80211_conf_flags - configuration flags
15986b301cdfSJohannes Berg  *
15996b301cdfSJohannes Berg  * Flags to define PHY configuration options
16006b301cdfSJohannes Berg  *
16010869aea0SJohannes Berg  * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this
16020869aea0SJohannes Berg  *	to determine for example whether to calculate timestamps for packets
16030869aea0SJohannes Berg  *	or not, do not use instead of filter flags!
1604c99445b1SKalle Valo  * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only).
1605c99445b1SKalle Valo  *	This is the power save mode defined by IEEE 802.11-2007 section 11.2,
1606c99445b1SKalle Valo  *	meaning that the hardware still wakes up for beacons, is able to
1607c99445b1SKalle Valo  *	transmit frames and receive the possible acknowledgment frames.
1608c99445b1SKalle Valo  *	Not to be confused with hardware specific wakeup/sleep states,
1609c99445b1SKalle Valo  *	driver is responsible for that. See the section "Powersave support"
1610c99445b1SKalle Valo  *	for more.
16115cff20e6SJohannes Berg  * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
16125cff20e6SJohannes Berg  *	the driver should be prepared to handle configuration requests but
16135cff20e6SJohannes Berg  *	may turn the device off as much as possible. Typically, this flag will
16145cff20e6SJohannes Berg  *	be set when an interface is set UP but not associated or scanning, but
16155cff20e6SJohannes Berg  *	it can also be unset in that case when monitor interfaces are active.
161645521245SFelix Fietkau  * @IEEE80211_CONF_OFFCHANNEL: The device is currently not on its main
161745521245SFelix Fietkau  *	operating channel.
16186b301cdfSJohannes Berg  */
16196b301cdfSJohannes Berg enum ieee80211_conf_flags {
16200869aea0SJohannes Berg 	IEEE80211_CONF_MONITOR		= (1<<0),
1621ae5eb026SJohannes Berg 	IEEE80211_CONF_PS		= (1<<1),
16225cff20e6SJohannes Berg 	IEEE80211_CONF_IDLE		= (1<<2),
162345521245SFelix Fietkau 	IEEE80211_CONF_OFFCHANNEL	= (1<<3),
16246b301cdfSJohannes Berg };
1625f0706e82SJiri Benc 
16267a5158efSJohannes Berg 
1627f0706e82SJiri Benc /**
1628e8975581SJohannes Berg  * enum ieee80211_conf_changed - denotes which configuration changed
1629e8975581SJohannes Berg  *
1630e8975581SJohannes Berg  * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
16310869aea0SJohannes Berg  * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed
1632e255d5ebSJohannes Berg  * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
1633e8975581SJohannes Berg  * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
16344797938cSJohannes Berg  * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
16359124b077SJohannes Berg  * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
16365cff20e6SJohannes Berg  * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
16370f78231bSJohannes Berg  * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
163804ecd257SJohannes Berg  *	Note that this is only valid if channel contexts are not used,
163904ecd257SJohannes Berg  *	otherwise each channel context has the number of chains listed.
1640e8975581SJohannes Berg  */
1641e8975581SJohannes Berg enum ieee80211_conf_changed {
16420f78231bSJohannes Berg 	IEEE80211_CONF_CHANGE_SMPS		= BIT(1),
1643e8975581SJohannes Berg 	IEEE80211_CONF_CHANGE_LISTEN_INTERVAL	= BIT(2),
16440869aea0SJohannes Berg 	IEEE80211_CONF_CHANGE_MONITOR		= BIT(3),
1645e8975581SJohannes Berg 	IEEE80211_CONF_CHANGE_PS		= BIT(4),
1646e255d5ebSJohannes Berg 	IEEE80211_CONF_CHANGE_POWER		= BIT(5),
1647e255d5ebSJohannes Berg 	IEEE80211_CONF_CHANGE_CHANNEL		= BIT(6),
1648e255d5ebSJohannes Berg 	IEEE80211_CONF_CHANGE_RETRY_LIMITS	= BIT(7),
16495cff20e6SJohannes Berg 	IEEE80211_CONF_CHANGE_IDLE		= BIT(8),
1650e8975581SJohannes Berg };
1651e8975581SJohannes Berg 
1652e8975581SJohannes Berg /**
16530f78231bSJohannes Berg  * enum ieee80211_smps_mode - spatial multiplexing power save mode
16540f78231bSJohannes Berg  *
16559d173fc5SKalle Valo  * @IEEE80211_SMPS_AUTOMATIC: automatic
16569d173fc5SKalle Valo  * @IEEE80211_SMPS_OFF: off
16579d173fc5SKalle Valo  * @IEEE80211_SMPS_STATIC: static
16589d173fc5SKalle Valo  * @IEEE80211_SMPS_DYNAMIC: dynamic
16599d173fc5SKalle Valo  * @IEEE80211_SMPS_NUM_MODES: internal, don't use
16600f78231bSJohannes Berg  */
16610f78231bSJohannes Berg enum ieee80211_smps_mode {
16620f78231bSJohannes Berg 	IEEE80211_SMPS_AUTOMATIC,
16630f78231bSJohannes Berg 	IEEE80211_SMPS_OFF,
16640f78231bSJohannes Berg 	IEEE80211_SMPS_STATIC,
16650f78231bSJohannes Berg 	IEEE80211_SMPS_DYNAMIC,
16660f78231bSJohannes Berg 
16670f78231bSJohannes Berg 	/* keep last */
16680f78231bSJohannes Berg 	IEEE80211_SMPS_NUM_MODES,
16690f78231bSJohannes Berg };
16700f78231bSJohannes Berg 
16710f78231bSJohannes Berg /**
1672f0706e82SJiri Benc  * struct ieee80211_conf - configuration of the device
1673f0706e82SJiri Benc  *
1674f0706e82SJiri Benc  * This struct indicates how the driver shall configure the hardware.
1675f0706e82SJiri Benc  *
167604fe2037SJohannes Berg  * @flags: configuration flags defined above
167704fe2037SJohannes Berg  *
1678ea95bba4STomas Winkler  * @listen_interval: listen interval in units of beacon interval
167956007a02SJohannes Berg  * @ps_dtim_period: The DTIM period of the AP we're connected to, for use
168056007a02SJohannes Berg  *	in power saving. Power saving will not be enabled until a beacon
168156007a02SJohannes Berg  *	has been received and the DTIM period is known.
168204fe2037SJohannes Berg  * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
168304fe2037SJohannes Berg  *	powersave documentation below. This variable is valid only when
168404fe2037SJohannes Berg  *	the CONF_PS flag is set.
168504fe2037SJohannes Berg  *
16861ea6f9c0SJohannes Berg  * @power_level: requested transmit power (in dBm), backward compatibility
16871ea6f9c0SJohannes Berg  *	value only that is set to the minimum of all interfaces
168804fe2037SJohannes Berg  *
1689675a0b04SKarl Beldan  * @chandef: the channel definition to tune to
1690164eb02dSSimon Wunderlich  * @radar_enabled: whether radar detection is enabled
169104fe2037SJohannes Berg  *
16929124b077SJohannes Berg  * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
16939124b077SJohannes Berg  *	(a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
16949124b077SJohannes Berg  *	but actually means the number of transmissions not the number of retries
16959124b077SJohannes Berg  * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
16969124b077SJohannes Berg  *	frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
16979124b077SJohannes Berg  *	number of transmissions not the number of retries
16980f78231bSJohannes Berg  *
16990f78231bSJohannes Berg  * @smps_mode: spatial multiplexing powersave mode; note that
17000f78231bSJohannes Berg  *	%IEEE80211_SMPS_STATIC is used when the device is not
170104ecd257SJohannes Berg  *	configured for an HT channel.
170204ecd257SJohannes Berg  *	Note that this is only valid if channel contexts are not used,
170304ecd257SJohannes Berg  *	otherwise each channel context has the number of chains listed.
1704f0706e82SJiri Benc  */
1705f0706e82SJiri Benc struct ieee80211_conf {
17066b301cdfSJohannes Berg 	u32 flags;
1707ff616381SJuuso Oikarinen 	int power_level, dynamic_ps_timeout;
170810816d40SRon Rindjunsky 
1709e8975581SJohannes Berg 	u16 listen_interval;
171056007a02SJohannes Berg 	u8 ps_dtim_period;
1711e8975581SJohannes Berg 
17129124b077SJohannes Berg 	u8 long_frame_max_tx_count, short_frame_max_tx_count;
17139124b077SJohannes Berg 
1714675a0b04SKarl Beldan 	struct cfg80211_chan_def chandef;
1715164eb02dSSimon Wunderlich 	bool radar_enabled;
17160f78231bSJohannes Berg 	enum ieee80211_smps_mode smps_mode;
1717f0706e82SJiri Benc };
1718f0706e82SJiri Benc 
1719f0706e82SJiri Benc /**
17205ce6e438SJohannes Berg  * struct ieee80211_channel_switch - holds the channel switch data
17215ce6e438SJohannes Berg  *
17225ce6e438SJohannes Berg  * The information provided in this structure is required for channel switch
17235ce6e438SJohannes Berg  * operation.
17245ce6e438SJohannes Berg  *
17255ce6e438SJohannes Berg  * @timestamp: value in microseconds of the 64-bit Time Synchronization
17265ce6e438SJohannes Berg  *	Function (TSF) timer when the frame containing the channel switch
17275ce6e438SJohannes Berg  *	announcement was received. This is simply the rx.mactime parameter
17285ce6e438SJohannes Berg  *	the driver passed into mac80211.
17292ba45384SLuciano Coelho  * @device_timestamp: arbitrary timestamp for the device, this is the
17302ba45384SLuciano Coelho  *	rx.device_timestamp parameter the driver passed to mac80211.
17315ce6e438SJohannes Berg  * @block_tx: Indicates whether transmission must be blocked before the
17325ce6e438SJohannes Berg  *	scheduled channel switch, as indicated by the AP.
173385220d71SJohannes Berg  * @chandef: the new channel to switch to
17345ce6e438SJohannes Berg  * @count: the number of TBTT's until the channel switch event
1735ee145775SSara Sharon  * @delay: maximum delay between the time the AP transmitted the last beacon in
1736ee145775SSara Sharon   *	current channel and the expected time of the first beacon in the new
1737ee145775SSara Sharon   *	channel, expressed in TU.
17385ce6e438SJohannes Berg  */
17395ce6e438SJohannes Berg struct ieee80211_channel_switch {
17405ce6e438SJohannes Berg 	u64 timestamp;
17412ba45384SLuciano Coelho 	u32 device_timestamp;
17425ce6e438SJohannes Berg 	bool block_tx;
174385220d71SJohannes Berg 	struct cfg80211_chan_def chandef;
17445ce6e438SJohannes Berg 	u8 count;
1745ee145775SSara Sharon 	u32 delay;
17465ce6e438SJohannes Berg };
17475ce6e438SJohannes Berg 
17485ce6e438SJohannes Berg /**
1749c1288b12SJohannes Berg  * enum ieee80211_vif_flags - virtual interface flags
1750c1288b12SJohannes Berg  *
1751c1288b12SJohannes Berg  * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering
1752c1288b12SJohannes Berg  *	on this virtual interface to avoid unnecessary CPU wakeups
1753ea086359SJohannes Berg  * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality
1754ea086359SJohannes Berg  *	monitoring on this virtual interface -- i.e. it can monitor
1755ea086359SJohannes Berg  *	connection quality related parameters, such as the RSSI level and
1756ea086359SJohannes Berg  *	provide notifications if configured trigger levels are reached.
1757848955ccSJohannes Berg  * @IEEE80211_VIF_SUPPORTS_UAPSD: The device can do U-APSD for this
1758848955ccSJohannes Berg  *	interface. This flag should be set during interface addition,
1759848955ccSJohannes Berg  *	but may be set/cleared as late as authentication to an AP. It is
1760848955ccSJohannes Berg  *	only valid for managed/station mode interfaces.
1761b115b972SJanusz.Dziedzic@tieto.com  * @IEEE80211_VIF_GET_NOA_UPDATE: request to handle NOA attributes
1762b115b972SJanusz.Dziedzic@tieto.com  *	and send P2P_PS notification to the driver if NOA changed, even
1763b115b972SJanusz.Dziedzic@tieto.com  *	this is not pure P2P vif.
1764bc1be54dSMiri Korenblit  * @IEEE80211_VIF_DISABLE_SMPS_OVERRIDE: disable user configuration of
1765bc1be54dSMiri Korenblit  *	SMPS mode via debugfs.
1766c1288b12SJohannes Berg  */
1767c1288b12SJohannes Berg enum ieee80211_vif_flags {
1768c1288b12SJohannes Berg 	IEEE80211_VIF_BEACON_FILTER		= BIT(0),
1769ea086359SJohannes Berg 	IEEE80211_VIF_SUPPORTS_CQM_RSSI		= BIT(1),
1770848955ccSJohannes Berg 	IEEE80211_VIF_SUPPORTS_UAPSD		= BIT(2),
1771b115b972SJanusz.Dziedzic@tieto.com 	IEEE80211_VIF_GET_NOA_UPDATE		= BIT(3),
1772bc1be54dSMiri Korenblit 	IEEE80211_VIF_DISABLE_SMPS_OVERRIDE	= BIT(4),
1773c1288b12SJohannes Berg };
1774c1288b12SJohannes Berg 
17756aea26ceSFelix Fietkau 
17766aea26ceSFelix Fietkau /**
17776aea26ceSFelix Fietkau  * enum ieee80211_offload_flags - virtual interface offload flags
17786aea26ceSFelix Fietkau  *
17796aea26ceSFelix Fietkau  * @IEEE80211_OFFLOAD_ENCAP_ENABLED: tx encapsulation offload is enabled
17806aea26ceSFelix Fietkau  *	The driver supports sending frames passed as 802.3 frames by mac80211.
17816aea26ceSFelix Fietkau  *	It must also support sending 802.11 packets for the same interface.
17826aea26ceSFelix Fietkau  * @IEEE80211_OFFLOAD_ENCAP_4ADDR: support 4-address mode encapsulation offload
178380a915ecSFelix Fietkau  * @IEEE80211_OFFLOAD_DECAP_ENABLED: rx encapsulation offload is enabled
178480a915ecSFelix Fietkau  *	The driver supports passing received 802.11 frames as 802.3 frames to
178580a915ecSFelix Fietkau  *	mac80211.
17866aea26ceSFelix Fietkau  */
17876aea26ceSFelix Fietkau 
17886aea26ceSFelix Fietkau enum ieee80211_offload_flags {
17896aea26ceSFelix Fietkau 	IEEE80211_OFFLOAD_ENCAP_ENABLED		= BIT(0),
17906aea26ceSFelix Fietkau 	IEEE80211_OFFLOAD_ENCAP_4ADDR		= BIT(1),
179180a915ecSFelix Fietkau 	IEEE80211_OFFLOAD_DECAP_ENABLED		= BIT(2),
17926aea26ceSFelix Fietkau };
17936aea26ceSFelix Fietkau 
1794c1288b12SJohannes Berg /**
1795f276e20bSJohannes Berg  * struct ieee80211_vif_cfg - interface configuration
1796f276e20bSJohannes Berg  * @assoc: association status
1797f276e20bSJohannes Berg  * @ibss_joined: indicates whether this station is part of an IBSS or not
1798f276e20bSJohannes Berg  * @ibss_creator: indicates if a new IBSS network is being created
1799a3b8008dSJohannes Berg  * @ps: power-save mode (STA only). This flag is NOT affected by
1800a3b8008dSJohannes Berg  *	offchannel/dynamic_ps operations.
1801f276e20bSJohannes Berg  * @aid: association ID number, valid only when @assoc is true
1802ce2bb3b6SEmmanuel Grumbach  * @eml_cap: EML capabilities as described in P802.11be_D2.2 Figure 9-1002k.
180329c6e2dcSEmmanuel Grumbach  * @eml_med_sync_delay: Medium Synchronization delay as described in
180429c6e2dcSEmmanuel Grumbach  *	P802.11be_D2.2 Figure 9-1002j.
1805f276e20bSJohannes Berg  * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The
1806f276e20bSJohannes Berg  *	may filter ARP queries targeted for other addresses than listed here.
1807f276e20bSJohannes Berg  *	The driver must allow ARP queries targeted for all address listed here
1808f276e20bSJohannes Berg  *	to pass through. An empty list implies no ARP queries need to pass.
1809f276e20bSJohannes Berg  * @arp_addr_cnt: Number of addresses currently on the list. Note that this
1810f276e20bSJohannes Berg  *	may be larger than %IEEE80211_BSS_ARP_ADDR_LIST_LEN (the arp_addr_list
1811f276e20bSJohannes Berg  *	array size), it's up to the driver what to do in that case.
1812f276e20bSJohannes Berg  * @ssid: The SSID of the current vif. Valid in AP and IBSS mode.
1813f276e20bSJohannes Berg  * @ssid_len: Length of SSID given in @ssid.
1814f276e20bSJohannes Berg  * @s1g: BSS is S1G BSS (affects Association Request format).
1815f276e20bSJohannes Berg  * @idle: This interface is idle. There's also a global idle flag in the
1816f276e20bSJohannes Berg  *	hardware config which may be more appropriate depending on what
1817f276e20bSJohannes Berg  *	your driver/device needs to do.
1818b65567b0SJohannes Berg  * @ap_addr: AP MLD address, or BSSID for non-MLO connections
1819b65567b0SJohannes Berg  *	(station mode only)
1820f276e20bSJohannes Berg  */
1821f276e20bSJohannes Berg struct ieee80211_vif_cfg {
1822f276e20bSJohannes Berg 	/* association related data */
1823f276e20bSJohannes Berg 	bool assoc, ibss_joined;
1824f276e20bSJohannes Berg 	bool ibss_creator;
1825a3b8008dSJohannes Berg 	bool ps;
1826f276e20bSJohannes Berg 	u16 aid;
1827ce2bb3b6SEmmanuel Grumbach 	u16 eml_cap;
182829c6e2dcSEmmanuel Grumbach 	u16 eml_med_sync_delay;
1829f276e20bSJohannes Berg 
1830f276e20bSJohannes Berg 	__be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
1831f276e20bSJohannes Berg 	int arp_addr_cnt;
1832f276e20bSJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
1833f276e20bSJohannes Berg 	size_t ssid_len;
1834f276e20bSJohannes Berg 	bool s1g;
1835f276e20bSJohannes Berg 	bool idle;
1836b65567b0SJohannes Berg 	u8 ap_addr[ETH_ALEN] __aligned(2);
1837f276e20bSJohannes Berg };
1838f276e20bSJohannes Berg 
1839f276e20bSJohannes Berg /**
184032bfd35dSJohannes Berg  * struct ieee80211_vif - per-interface data
184132bfd35dSJohannes Berg  *
184232bfd35dSJohannes Berg  * Data in this structure is continually present for driver
184332bfd35dSJohannes Berg  * use during the life of a virtual interface.
184432bfd35dSJohannes Berg  *
184551fb61e7SJohannes Berg  * @type: type of this virtual interface
1846f276e20bSJohannes Berg  * @cfg: vif configuration, see &struct ieee80211_vif_cfg
1847bda3933aSJohannes Berg  * @bss_conf: BSS configuration for this interface, either our own
1848bda3933aSJohannes Berg  *	or the BSS we're associated to
18498e14130dSJohannes Berg  * @link_conf: in case of MLD, the per-link BSS configuration,
18508e14130dSJohannes Berg  *	indexed by link ID
1851d8787ec6SJohannes Berg  * @valid_links: bitmap of valid links, or 0 for non-MLO.
1852efe9c2bfSJohannes Berg  * @active_links: The bitmap of active links, or 0 for non-MLO.
1853efe9c2bfSJohannes Berg  *	The driver shouldn't change this directly, but use the
1854efe9c2bfSJohannes Berg  *	API calls meant for that purpose.
18556d543b34SIlan Peer  * @dormant_links: bitmap of valid but disabled links, or 0 for non-MLO.
18566d543b34SIlan Peer  *	Must be a subset of valid_links.
185747846c9bSJohannes Berg  * @addr: address of this interface
18582ca27bcfSJohannes Berg  * @p2p: indicates whether this AP or STA interface is a p2p
18592ca27bcfSJohannes Berg  *	interface, i.e. a GO or p2p-sta respectively
18607d360f60SFelix Fietkau  * @netdev_features: tx netdev features supported by the hardware for this
18617d360f60SFelix Fietkau  *	vif. mac80211 initializes this to hw->netdev_features, and the driver
18627d360f60SFelix Fietkau  *	can mask out specific tx features. mac80211 will handle software fixup
18637d360f60SFelix Fietkau  *	for masked offloads (GSO, CSUM)
1864c1288b12SJohannes Berg  * @driver_flags: flags/capabilities the driver has for this interface,
1865c1288b12SJohannes Berg  *	these need to be set (or cleared) when the interface is added
1866c1288b12SJohannes Berg  *	or, if supported by the driver, the interface type is changed
1867c1288b12SJohannes Berg  *	at runtime, mac80211 will never touch this field
18684273d3faSJohannes Berg  * @offload_flags: hardware offload capabilities/flags for this interface.
18696aea26ceSFelix Fietkau  *	These are initialized by mac80211 before calling .add_interface,
18706aea26ceSFelix Fietkau  *	.change_interface or .update_vif_offload and updated by the driver
18716aea26ceSFelix Fietkau  *	within these ops, based on supported features or runtime change
18726aea26ceSFelix Fietkau  *	restrictions.
18733a25a8c8SJohannes Berg  * @hw_queue: hardware queue for each AC
18743a25a8c8SJohannes Berg  * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
1875ddbfe860SStanislaw Gruszka  * @debugfs_dir: debugfs dentry, can be used by drivers to create own per
1876ddbfe860SStanislaw Gruszka  *	interface debug files. Note that it will be NULL for the virtual
1877ddbfe860SStanislaw Gruszka  *	monitor interface (if that is requested.)
18781b09b556SAndrei Otcheretianski  * @probe_req_reg: probe requests should be reported to mac80211 for this
18791b09b556SAndrei Otcheretianski  *	interface.
1880873b1cf6SJouni Malinen  * @rx_mcast_action_reg: multicast Action frames should be reported to mac80211
1881873b1cf6SJouni Malinen  *	for this interface.
188232bfd35dSJohannes Berg  * @drv_priv: data area for driver use, will always be aligned to
1883b4f7f4adSJani Nikula  *	sizeof(void \*).
1884c850e31fSAlexander Wetzel  * @txq: the multicast data TX queue
18857fba53ebSJohannes Berg  * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see
18867fba53ebSJohannes Berg  *	&enum ieee80211_offload_flags.
188717196425SJohn Crispin  * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled.
188832bfd35dSJohannes Berg  */
188932bfd35dSJohannes Berg struct ieee80211_vif {
189005c914feSJohannes Berg 	enum nl80211_iftype type;
1891f276e20bSJohannes Berg 	struct ieee80211_vif_cfg cfg;
1892bda3933aSJohannes Berg 	struct ieee80211_bss_conf bss_conf;
1893d8675a63SJohannes Berg 	struct ieee80211_bss_conf __rcu *link_conf[IEEE80211_MLD_MAX_NUM_LINKS];
18946d543b34SIlan Peer 	u16 valid_links, active_links, dormant_links;
1895a3e2f4b6SMichael Braun 	u8 addr[ETH_ALEN] __aligned(2);
18962ca27bcfSJohannes Berg 	bool p2p;
18973a25a8c8SJohannes Berg 
18983a25a8c8SJohannes Berg 	u8 cab_queue;
18993a25a8c8SJohannes Berg 	u8 hw_queue[IEEE80211_NUM_ACS];
19003a25a8c8SJohannes Berg 
1901ba8c3d6fSFelix Fietkau 	struct ieee80211_txq *txq;
1902ba8c3d6fSFelix Fietkau 
19037d360f60SFelix Fietkau 	netdev_features_t netdev_features;
1904c1288b12SJohannes Berg 	u32 driver_flags;
19056aea26ceSFelix Fietkau 	u32 offload_flags;
19063a25a8c8SJohannes Berg 
1907ddbfe860SStanislaw Gruszka #ifdef CONFIG_MAC80211_DEBUGFS
1908ddbfe860SStanislaw Gruszka 	struct dentry *debugfs_dir;
1909ddbfe860SStanislaw Gruszka #endif
1910ddbfe860SStanislaw Gruszka 
19116cd536feSJohannes Berg 	bool probe_req_reg;
1912873b1cf6SJouni Malinen 	bool rx_mcast_action_reg;
19131b09b556SAndrei Otcheretianski 
191417196425SJohn Crispin 	struct ieee80211_vif *mbssid_tx_vif;
191517196425SJohn Crispin 
191632bfd35dSJohannes Berg 	/* must be last */
19173c23215bSGustavo A. R. Silva 	u8 drv_priv[] __aligned(sizeof(void *));
191832bfd35dSJohannes Berg };
191932bfd35dSJohannes Berg 
1920f1871abdSIlan Peer /**
1921f1871abdSIlan Peer  * ieee80211_vif_usable_links - Return the usable links for the vif
1922f1871abdSIlan Peer  * @vif: the vif for which the usable links are requested
1923f1871abdSIlan Peer  * Return: the usable link bitmap
1924f1871abdSIlan Peer  */
ieee80211_vif_usable_links(const struct ieee80211_vif * vif)1925f1871abdSIlan Peer static inline u16 ieee80211_vif_usable_links(const struct ieee80211_vif *vif)
1926f1871abdSIlan Peer {
19276d543b34SIlan Peer 	return vif->valid_links & ~vif->dormant_links;
1928f1871abdSIlan Peer }
1929f1871abdSIlan Peer 
1930f1871abdSIlan Peer /**
1931f1871abdSIlan Peer  * ieee80211_vif_is_mld - Returns true iff the vif is an MLD one
1932f1871abdSIlan Peer  * @vif: the vif
1933f1871abdSIlan Peer  * Return: %true if the vif is an MLD, %false otherwise.
1934f1871abdSIlan Peer  */
ieee80211_vif_is_mld(const struct ieee80211_vif * vif)1935f1871abdSIlan Peer static inline bool ieee80211_vif_is_mld(const struct ieee80211_vif *vif)
1936f1871abdSIlan Peer {
1937f1871abdSIlan Peer 	/* valid_links != 0 indicates this vif is an MLD */
1938f1871abdSIlan Peer 	return vif->valid_links != 0;
1939f1871abdSIlan Peer }
1940f1871abdSIlan Peer 
19419f781533SGregory Greenman #define for_each_vif_active_link(vif, link, link_id)				\
19429f781533SGregory Greenman 	for (link_id = 0; link_id < ARRAY_SIZE((vif)->link_conf); link_id++)	\
1943efe9c2bfSJohannes Berg 		if ((!(vif)->active_links ||					\
1944efe9c2bfSJohannes Berg 		     (vif)->active_links & BIT(link_id)) &&			\
1945efe9c2bfSJohannes Berg 		    (link = rcu_dereference((vif)->link_conf[link_id])))
19469f781533SGregory Greenman 
ieee80211_vif_is_mesh(struct ieee80211_vif * vif)1947902acc78SJohannes Berg static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
1948902acc78SJohannes Berg {
1949902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
195005c914feSJohannes Berg 	return vif->type == NL80211_IFTYPE_MESH_POINT;
1951902acc78SJohannes Berg #endif
1952902acc78SJohannes Berg 	return false;
1953902acc78SJohannes Berg }
1954902acc78SJohannes Berg 
195532bfd35dSJohannes Berg /**
1956ad7e718cSJohannes Berg  * wdev_to_ieee80211_vif - return a vif struct from a wdev
1957ad7e718cSJohannes Berg  * @wdev: the wdev to get the vif for
1958ad7e718cSJohannes Berg  *
1959ad7e718cSJohannes Berg  * This can be used by mac80211 drivers with direct cfg80211 APIs
1960ad7e718cSJohannes Berg  * (like the vendor commands) that get a wdev.
1961ad7e718cSJohannes Berg  *
1962ad7e718cSJohannes Berg  * Note that this function may return %NULL if the given wdev isn't
1963ad7e718cSJohannes Berg  * associated with a vif that the driver knows about (e.g. monitor
1964ad7e718cSJohannes Berg  * or AP_VLAN interfaces.)
1965ad7e718cSJohannes Berg  */
1966ad7e718cSJohannes Berg struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
1967ad7e718cSJohannes Berg 
1968ad7e718cSJohannes Berg /**
1969dc5a1ad7SEmmanuel Grumbach  * ieee80211_vif_to_wdev - return a wdev struct from a vif
1970dc5a1ad7SEmmanuel Grumbach  * @vif: the vif to get the wdev for
1971dc5a1ad7SEmmanuel Grumbach  *
1972dc5a1ad7SEmmanuel Grumbach  * This can be used by mac80211 drivers with direct cfg80211 APIs
1973dc5a1ad7SEmmanuel Grumbach  * (like the vendor commands) that needs to get the wdev for a vif.
1974f30386a8SEmmanuel Grumbach  * This can also be useful to get the netdev associated to a vif.
1975dc5a1ad7SEmmanuel Grumbach  */
1976dc5a1ad7SEmmanuel Grumbach struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
1977dc5a1ad7SEmmanuel Grumbach 
1978dc5a1ad7SEmmanuel Grumbach /**
197965fd846cSJohannes Berg  * lockdep_vif_mutex_held - for lockdep checks on link poiners
198065fd846cSJohannes Berg  * @vif: the interface to check
198165fd846cSJohannes Berg  */
lockdep_vif_mutex_held(struct ieee80211_vif * vif)198265fd846cSJohannes Berg static inline bool lockdep_vif_mutex_held(struct ieee80211_vif *vif)
198365fd846cSJohannes Berg {
198465fd846cSJohannes Berg 	return lockdep_is_held(&ieee80211_vif_to_wdev(vif)->mtx);
198565fd846cSJohannes Berg }
198665fd846cSJohannes Berg 
198765fd846cSJohannes Berg #define link_conf_dereference_protected(vif, link_id)		\
198865fd846cSJohannes Berg 	rcu_dereference_protected((vif)->link_conf[link_id],	\
198965fd846cSJohannes Berg 				  lockdep_vif_mutex_held(vif))
199065fd846cSJohannes Berg 
1991f3630c4fSJohannes Berg #define link_conf_dereference_check(vif, link_id)		\
1992f3630c4fSJohannes Berg 	rcu_dereference_check((vif)->link_conf[link_id],	\
1993f3630c4fSJohannes Berg 			      lockdep_vif_mutex_held(vif))
1994f3630c4fSJohannes Berg 
199565fd846cSJohannes Berg /**
19967ac1bd6aSJohannes Berg  * enum ieee80211_key_flags - key flags
19977ac1bd6aSJohannes Berg  *
19987ac1bd6aSJohannes Berg  * These flags are used for communication about keys between the driver
19997ac1bd6aSJohannes Berg  * and mac80211, with the @flags parameter of &struct ieee80211_key_conf.
20007ac1bd6aSJohannes Berg  *
20017ac1bd6aSJohannes Berg  * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the
20027ac1bd6aSJohannes Berg  *	driver to indicate that it requires IV generation for this
2003db12847cSIdo Yariv  *	particular key. Setting this flag does not necessarily mean that SKBs
2004db12847cSIdo Yariv  *	will have sufficient tailroom for ICV or MIC.
20057ac1bd6aSJohannes Berg  * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by
20067ac1bd6aSJohannes Berg  *	the driver for a TKIP key if it requires Michael MIC
20077ac1bd6aSJohannes Berg  *	generation in software.
2008c6adbd21SIvo van Doorn  * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
2009c6adbd21SIvo van Doorn  *	that the key is pairwise rather then a shared key.
2010e548c49eSJohannes Berg  * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
201100b9cfa3SJouni Malinen  *	CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
201200b9cfa3SJouni Malinen  *	(MFP) to be done in software.
2013077a9154SArik Nemtsov  * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
2014ee70108fSJanusz.Dziedzic@tieto.com  *	if space should be prepared for the IV, but the IV
2015077a9154SArik Nemtsov  *	itself should not be generated. Do not set together with
2016db12847cSIdo Yariv  *	@IEEE80211_KEY_FLAG_GENERATE_IV on the same key. Setting this flag does
2017db12847cSIdo Yariv  *	not necessarily mean that SKBs will have sufficient tailroom for ICV or
2018db12847cSIdo Yariv  *	MIC.
2019e548c49eSJohannes Berg  * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received
2020e548c49eSJohannes Berg  *	management frames. The flag can help drivers that have a hardware
2021e548c49eSJohannes Berg  *	crypto implementation that doesn't deal with management frames
2022e548c49eSJohannes Berg  *	properly by allowing them to not upload the keys to hardware and
2023e548c49eSJohannes Berg  *	fall back to software crypto. Note that this flag deals only with
2024e548c49eSJohannes Berg  *	RX, if your crypto engine can't deal with TX you can also set the
2025e548c49eSJohannes Berg  *	%IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
202617d38fa8SMarek Kwaczynski  * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
202700b9cfa3SJouni Malinen  *	driver for a CCMP/GCMP key to indicate that is requires IV generation
2028ae4a50eeSChris Packham  *	only for management frames (MFP).
2029db12847cSIdo Yariv  * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
2030db12847cSIdo Yariv  *	driver for a key to indicate that sufficient tailroom must always
2031db12847cSIdo Yariv  *	be reserved for ICV or MIC, even when HW encryption is enabled.
20329de18d81SDavid Spinadel  * @IEEE80211_KEY_FLAG_PUT_MIC_SPACE: This flag should be set by the driver for
20339de18d81SDavid Spinadel  *	a TKIP key if it only requires MIC space. Do not set together with
20349de18d81SDavid Spinadel  *	@IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key.
203596fc6efbSAlexander Wetzel  * @IEEE80211_KEY_FLAG_NO_AUTO_TX: Key needs explicit Tx activation.
2036a0b4496aSLorenzo Bianconi  * @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver
2037a0b4496aSLorenzo Bianconi  *	for a AES_CMAC key to indicate that it requires sequence number
2038a0b4496aSLorenzo Bianconi  *	generation only
20397ac1bd6aSJohannes Berg  */
20407ac1bd6aSJohannes Berg enum ieee80211_key_flags {
204117d38fa8SMarek Kwaczynski 	IEEE80211_KEY_FLAG_GENERATE_IV_MGMT	= BIT(0),
204217d38fa8SMarek Kwaczynski 	IEEE80211_KEY_FLAG_GENERATE_IV		= BIT(1),
204317d38fa8SMarek Kwaczynski 	IEEE80211_KEY_FLAG_GENERATE_MMIC	= BIT(2),
204417d38fa8SMarek Kwaczynski 	IEEE80211_KEY_FLAG_PAIRWISE		= BIT(3),
204517d38fa8SMarek Kwaczynski 	IEEE80211_KEY_FLAG_SW_MGMT_TX		= BIT(4),
204617d38fa8SMarek Kwaczynski 	IEEE80211_KEY_FLAG_PUT_IV_SPACE		= BIT(5),
204717d38fa8SMarek Kwaczynski 	IEEE80211_KEY_FLAG_RX_MGMT		= BIT(6),
2048db12847cSIdo Yariv 	IEEE80211_KEY_FLAG_RESERVE_TAILROOM	= BIT(7),
20499de18d81SDavid Spinadel 	IEEE80211_KEY_FLAG_PUT_MIC_SPACE	= BIT(8),
205096fc6efbSAlexander Wetzel 	IEEE80211_KEY_FLAG_NO_AUTO_TX		= BIT(9),
2051a0b4496aSLorenzo Bianconi 	IEEE80211_KEY_FLAG_GENERATE_MMIE	= BIT(10),
20527ac1bd6aSJohannes Berg };
20537ac1bd6aSJohannes Berg 
20547ac1bd6aSJohannes Berg /**
20557ac1bd6aSJohannes Berg  * struct ieee80211_key_conf - key information
20567ac1bd6aSJohannes Berg  *
20577ac1bd6aSJohannes Berg  * This key information is given by mac80211 to the driver by
20587ac1bd6aSJohannes Berg  * the set_key() callback in &struct ieee80211_ops.
20597ac1bd6aSJohannes Berg  *
20607ac1bd6aSJohannes Berg  * @hw_key_idx: To be set by the driver, this is the key index the driver
20617ac1bd6aSJohannes Berg  *	wants to be given when a frame is transmitted and needs to be
20626a7664d4SJohannes Berg  *	encrypted in hardware.
206397359d12SJohannes Berg  * @cipher: The key's cipher suite selector.
2064f8079d43SEliad Peller  * @tx_pn: PN used for TX keys, may be used by the driver as well if it
2065f8079d43SEliad Peller  *	needs to do software PN assignment by itself (e.g. due to TSO)
20667ac1bd6aSJohannes Berg  * @flags: key flags, see &enum ieee80211_key_flags.
20677ac1bd6aSJohannes Berg  * @keyidx: the key index (0-3)
20687ac1bd6aSJohannes Berg  * @keylen: key material length
2069ffd7891dSLuis R. Rodriguez  * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte)
2070ffd7891dSLuis R. Rodriguez  * 	data block:
2071ffd7891dSLuis R. Rodriguez  * 	- Temporal Encryption Key (128 bits)
2072ffd7891dSLuis R. Rodriguez  * 	- Temporal Authenticator Tx MIC Key (64 bits)
2073ffd7891dSLuis R. Rodriguez  * 	- Temporal Authenticator Rx MIC Key (64 bits)
2074dc822b5dSJohannes Berg  * @icv_len: The ICV length for this key type
2075dc822b5dSJohannes Berg  * @iv_len: The IV length for this key type
2076ccdde7c7SJohannes Berg  * @link_id: the link ID for MLO, or -1 for non-MLO or pairwise keys
20777ac1bd6aSJohannes Berg  */
2078f0706e82SJiri Benc struct ieee80211_key_conf {
2079db388a56SJohannes Berg 	atomic64_t tx_pn;
208097359d12SJohannes Berg 	u32 cipher;
208176708deeSFelix Fietkau 	u8 icv_len;
208276708deeSFelix Fietkau 	u8 iv_len;
20836a7664d4SJohannes Berg 	u8 hw_key_idx;
208411a843b7SJohannes Berg 	s8 keyidx;
20859de18d81SDavid Spinadel 	u16 flags;
2086ccdde7c7SJohannes Berg 	s8 link_id;
208711a843b7SJohannes Berg 	u8 keylen;
20883c23215bSGustavo A. R. Silva 	u8 key[];
2089f0706e82SJiri Benc };
2090f0706e82SJiri Benc 
2091a31cf1c6SJohannes Berg #define IEEE80211_MAX_PN_LEN	16
2092a31cf1c6SJohannes Berg 
2093f8079d43SEliad Peller #define TKIP_PN_TO_IV16(pn) ((u16)(pn & 0xffff))
2094f8079d43SEliad Peller #define TKIP_PN_TO_IV32(pn) ((u32)((pn >> 16) & 0xffffffff))
2095f8079d43SEliad Peller 
20967ac1bd6aSJohannes Berg /**
20979352c19fSJohannes Berg  * struct ieee80211_key_seq - key sequence counter
20989352c19fSJohannes Berg  *
20999352c19fSJohannes Berg  * @tkip: TKIP data, containing IV32 and IV16 in host byte order
21009352c19fSJohannes Berg  * @ccmp: PN data, most significant byte first (big endian,
21019352c19fSJohannes Berg  *	reverse order than in packet)
21029352c19fSJohannes Berg  * @aes_cmac: PN data, most significant byte first (big endian,
21039352c19fSJohannes Berg  *	reverse order than in packet)
21049352c19fSJohannes Berg  * @aes_gmac: PN data, most significant byte first (big endian,
21059352c19fSJohannes Berg  *	reverse order than in packet)
21069352c19fSJohannes Berg  * @gcmp: PN data, most significant byte first (big endian,
21079352c19fSJohannes Berg  *	reverse order than in packet)
2108a31cf1c6SJohannes Berg  * @hw: data for HW-only (e.g. cipher scheme) keys
21099352c19fSJohannes Berg  */
21109352c19fSJohannes Berg struct ieee80211_key_seq {
21119352c19fSJohannes Berg 	union {
21129352c19fSJohannes Berg 		struct {
21139352c19fSJohannes Berg 			u32 iv32;
21149352c19fSJohannes Berg 			u16 iv16;
21159352c19fSJohannes Berg 		} tkip;
21169352c19fSJohannes Berg 		struct {
21179352c19fSJohannes Berg 			u8 pn[6];
21189352c19fSJohannes Berg 		} ccmp;
21199352c19fSJohannes Berg 		struct {
21209352c19fSJohannes Berg 			u8 pn[6];
21219352c19fSJohannes Berg 		} aes_cmac;
21229352c19fSJohannes Berg 		struct {
21239352c19fSJohannes Berg 			u8 pn[6];
21249352c19fSJohannes Berg 		} aes_gmac;
21259352c19fSJohannes Berg 		struct {
21269352c19fSJohannes Berg 			u8 pn[6];
21279352c19fSJohannes Berg 		} gcmp;
2128a31cf1c6SJohannes Berg 		struct {
2129a31cf1c6SJohannes Berg 			u8 seq[IEEE80211_MAX_PN_LEN];
2130a31cf1c6SJohannes Berg 			u8 seq_len;
2131a31cf1c6SJohannes Berg 		} hw;
21329352c19fSJohannes Berg 	};
21339352c19fSJohannes Berg };
21349352c19fSJohannes Berg 
21359352c19fSJohannes Berg /**
21367ac1bd6aSJohannes Berg  * enum set_key_cmd - key command
21377ac1bd6aSJohannes Berg  *
21387ac1bd6aSJohannes Berg  * Used with the set_key() callback in &struct ieee80211_ops, this
21397ac1bd6aSJohannes Berg  * indicates whether a key is being removed or added.
21407ac1bd6aSJohannes Berg  *
21417ac1bd6aSJohannes Berg  * @SET_KEY: a key is set
21427ac1bd6aSJohannes Berg  * @DISABLE_KEY: a key must be disabled
21437ac1bd6aSJohannes Berg  */
2144ea49c359SJohannes Berg enum set_key_cmd {
214511a843b7SJohannes Berg 	SET_KEY, DISABLE_KEY,
2146ea49c359SJohannes Berg };
2147f0706e82SJiri Benc 
2148478f8d2bSTomas Winkler /**
2149f09603a2SJohannes Berg  * enum ieee80211_sta_state - station state
2150f09603a2SJohannes Berg  *
2151f09603a2SJohannes Berg  * @IEEE80211_STA_NOTEXIST: station doesn't exist at all,
2152f09603a2SJohannes Berg  *	this is a special state for add/remove transitions
2153f09603a2SJohannes Berg  * @IEEE80211_STA_NONE: station exists without special state
2154f09603a2SJohannes Berg  * @IEEE80211_STA_AUTH: station is authenticated
2155f09603a2SJohannes Berg  * @IEEE80211_STA_ASSOC: station is associated
2156f09603a2SJohannes Berg  * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X)
2157f09603a2SJohannes Berg  */
2158f09603a2SJohannes Berg enum ieee80211_sta_state {
2159f09603a2SJohannes Berg 	/* NOTE: These need to be ordered correctly! */
2160f09603a2SJohannes Berg 	IEEE80211_STA_NOTEXIST,
2161f09603a2SJohannes Berg 	IEEE80211_STA_NONE,
2162f09603a2SJohannes Berg 	IEEE80211_STA_AUTH,
2163f09603a2SJohannes Berg 	IEEE80211_STA_ASSOC,
2164f09603a2SJohannes Berg 	IEEE80211_STA_AUTHORIZED,
2165f09603a2SJohannes Berg };
2166f09603a2SJohannes Berg 
2167f09603a2SJohannes Berg /**
2168e1a0c6b3SJohannes Berg  * enum ieee80211_sta_rx_bandwidth - station RX bandwidth
2169e1a0c6b3SJohannes Berg  * @IEEE80211_STA_RX_BW_20: station can only receive 20 MHz
2170e1a0c6b3SJohannes Berg  * @IEEE80211_STA_RX_BW_40: station can receive up to 40 MHz
2171e1a0c6b3SJohannes Berg  * @IEEE80211_STA_RX_BW_80: station can receive up to 80 MHz
2172e1a0c6b3SJohannes Berg  * @IEEE80211_STA_RX_BW_160: station can receive up to 160 MHz
2173e1a0c6b3SJohannes Berg  *	(including 80+80 MHz)
21745dca295dSIlan Peer  * @IEEE80211_STA_RX_BW_320: station can receive up to 320 MHz
2175e1a0c6b3SJohannes Berg  *
2176e1a0c6b3SJohannes Berg  * Implementation note: 20 must be zero to be initialized
2177e1a0c6b3SJohannes Berg  *	correctly, the values must be sorted.
2178e1a0c6b3SJohannes Berg  */
2179e1a0c6b3SJohannes Berg enum ieee80211_sta_rx_bandwidth {
2180e1a0c6b3SJohannes Berg 	IEEE80211_STA_RX_BW_20 = 0,
2181e1a0c6b3SJohannes Berg 	IEEE80211_STA_RX_BW_40,
2182e1a0c6b3SJohannes Berg 	IEEE80211_STA_RX_BW_80,
2183e1a0c6b3SJohannes Berg 	IEEE80211_STA_RX_BW_160,
21845dca295dSIlan Peer 	IEEE80211_STA_RX_BW_320,
2185e1a0c6b3SJohannes Berg };
2186e1a0c6b3SJohannes Berg 
2187e1a0c6b3SJohannes Berg /**
21880d528d85SFelix Fietkau  * struct ieee80211_sta_rates - station rate selection table
21890d528d85SFelix Fietkau  *
21900d528d85SFelix Fietkau  * @rcu_head: RCU head used for freeing the table on update
219103f831a6SRobert P. J. Day  * @rate: transmit rates/flags to be used by default.
21920d528d85SFelix Fietkau  *	Overriding entries per-packet is possible by using cb tx control.
21930d528d85SFelix Fietkau  */
21940d528d85SFelix Fietkau struct ieee80211_sta_rates {
21950d528d85SFelix Fietkau 	struct rcu_head rcu_head;
21960d528d85SFelix Fietkau 	struct {
21970d528d85SFelix Fietkau 		s8 idx;
21980d528d85SFelix Fietkau 		u8 count;
21990d528d85SFelix Fietkau 		u8 count_cts;
22000d528d85SFelix Fietkau 		u8 count_rts;
22010d528d85SFelix Fietkau 		u16 flags;
22020d528d85SFelix Fietkau 	} rate[IEEE80211_TX_RATE_TABLE_SIZE];
22030d528d85SFelix Fietkau };
22040d528d85SFelix Fietkau 
22050d528d85SFelix Fietkau /**
2206ba905bf4SAshok Raj Nagarajan  * struct ieee80211_sta_txpwr - station txpower configuration
2207ba905bf4SAshok Raj Nagarajan  *
2208ba905bf4SAshok Raj Nagarajan  * Used to configure txpower for station.
2209ba905bf4SAshok Raj Nagarajan  *
2210ba905bf4SAshok Raj Nagarajan  * @power: indicates the tx power, in dBm, to be used when sending data frames
2211ba905bf4SAshok Raj Nagarajan  *	to the STA.
2212ba905bf4SAshok Raj Nagarajan  * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
2213ba905bf4SAshok Raj Nagarajan  *	will be less than or equal to specified from userspace, whereas if TPC
2214ba905bf4SAshok Raj Nagarajan  *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
2215ba905bf4SAshok Raj Nagarajan  *	NL80211_TX_POWER_FIXED is not a valid configuration option for
2216ba905bf4SAshok Raj Nagarajan  *	per peer TPC.
2217ba905bf4SAshok Raj Nagarajan  */
2218ba905bf4SAshok Raj Nagarajan struct ieee80211_sta_txpwr {
2219ba905bf4SAshok Raj Nagarajan 	s16 power;
2220ba905bf4SAshok Raj Nagarajan 	enum nl80211_tx_power_setting type;
2221ba905bf4SAshok Raj Nagarajan };
2222ba905bf4SAshok Raj Nagarajan 
2223046d2e7cSSriram R /**
22244c51541dSBenjamin Berg  * struct ieee80211_sta_aggregates - info that is aggregated from active links
22254c51541dSBenjamin Berg  *
22264c51541dSBenjamin Berg  * Used for any per-link data that needs to be aggregated and updated in the
22274c51541dSBenjamin Berg  * main &struct ieee80211_sta when updated or the active links change.
22284c51541dSBenjamin Berg  *
22294c51541dSBenjamin Berg  * @max_amsdu_len: indicates the maximal length of an A-MSDU in bytes.
22304c51541dSBenjamin Berg  *	This field is always valid for packets with a VHT preamble.
22314c51541dSBenjamin Berg  *	For packets with a HT preamble, additional limits apply:
22324c51541dSBenjamin Berg  *
22334c51541dSBenjamin Berg  *	* If the skb is transmitted as part of a BA agreement, the
22344c51541dSBenjamin Berg  *	  A-MSDU maximal size is min(max_amsdu_len, 4065) bytes.
22354c51541dSBenjamin Berg  *	* If the skb is not part of a BA agreement, the A-MSDU maximal
22364c51541dSBenjamin Berg  *	  size is min(max_amsdu_len, 7935) bytes.
22374c51541dSBenjamin Berg  *
22384c51541dSBenjamin Berg  * Both additional HT limits must be enforced by the low level
22394c51541dSBenjamin Berg  * driver. This is defined by the spec (IEEE 802.11-2012 section
22404c51541dSBenjamin Berg  * 8.3.2.2 NOTE 2).
22414c51541dSBenjamin Berg  * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
22424c51541dSBenjamin Berg  * @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID
22434c51541dSBenjamin Berg  */
22444c51541dSBenjamin Berg struct ieee80211_sta_aggregates {
22454c51541dSBenjamin Berg 	u16 max_amsdu_len;
22464c51541dSBenjamin Berg 
22474c51541dSBenjamin Berg 	u16 max_rc_amsdu_len;
22484c51541dSBenjamin Berg 	u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS];
22494c51541dSBenjamin Berg };
22504c51541dSBenjamin Berg 
22514c51541dSBenjamin Berg /**
2252046d2e7cSSriram R  * struct ieee80211_link_sta - station Link specific info
2253046d2e7cSSriram R  * All link specific info for a STA link for a non MLD STA(single)
2254046d2e7cSSriram R  * or a MLD STA(multiple entries) are stored here.
2255046d2e7cSSriram R  *
22561d9e4c91SBenjamin Berg  * @sta: reference to owning STA
2257046d2e7cSSriram R  * @addr: MAC address of the Link STA. For non-MLO STA this is same as the addr
2258046d2e7cSSriram R  *	in ieee80211_sta. For MLO Link STA this addr can be same or different
2259046d2e7cSSriram R  *	from addr in ieee80211_sta (representing MLD STA addr)
2260c73993b8SJohannes Berg  * @link_id: the link ID for this link STA (0 for deflink)
2261261ce887SBenjamin Berg  * @smps_mode: current SMPS mode (off, static or dynamic)
2262046d2e7cSSriram R  * @supp_rates: Bitmap of supported rates
2263046d2e7cSSriram R  * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
2264046d2e7cSSriram R  * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
2265046d2e7cSSriram R  * @he_cap: HE capabilities of this STA
2266046d2e7cSSriram R  * @he_6ghz_capa: on 6 GHz, holds the HE 6 GHz band capabilities
2267046d2e7cSSriram R  * @eht_cap: EHT capabilities of this STA
2268c6662a4bSRandy Dunlap  * @agg: per-link data for multi-link aggregation
2269046d2e7cSSriram R  * @bandwidth: current bandwidth the station can receive with
2270046d2e7cSSriram R  * @rx_nss: in HT/VHT, the maximum number of spatial streams the
2271046d2e7cSSriram R  *	station can receive at the moment, changed by operating mode
2272046d2e7cSSriram R  *	notifications and capabilities. The value is only valid after
2273046d2e7cSSriram R  *	the station moves to associated state.
2274046d2e7cSSriram R  * @txpwr: the station tx power configuration
2275046d2e7cSSriram R  *
2276046d2e7cSSriram R  */
2277046d2e7cSSriram R struct ieee80211_link_sta {
22781d9e4c91SBenjamin Berg 	struct ieee80211_sta *sta;
22791d9e4c91SBenjamin Berg 
2280046d2e7cSSriram R 	u8 addr[ETH_ALEN];
2281c73993b8SJohannes Berg 	u8 link_id;
2282261ce887SBenjamin Berg 	enum ieee80211_smps_mode smps_mode;
2283046d2e7cSSriram R 
2284046d2e7cSSriram R 	u32 supp_rates[NUM_NL80211_BANDS];
2285046d2e7cSSriram R 	struct ieee80211_sta_ht_cap ht_cap;
2286046d2e7cSSriram R 	struct ieee80211_sta_vht_cap vht_cap;
2287046d2e7cSSriram R 	struct ieee80211_sta_he_cap he_cap;
2288046d2e7cSSriram R 	struct ieee80211_he_6ghz_capa he_6ghz_capa;
2289046d2e7cSSriram R 	struct ieee80211_sta_eht_cap eht_cap;
2290046d2e7cSSriram R 
22914c51541dSBenjamin Berg 	struct ieee80211_sta_aggregates agg;
22924c51541dSBenjamin Berg 
2293046d2e7cSSriram R 	u8 rx_nss;
2294046d2e7cSSriram R 	enum ieee80211_sta_rx_bandwidth bandwidth;
2295046d2e7cSSriram R 	struct ieee80211_sta_txpwr txpwr;
2296046d2e7cSSriram R };
2297046d2e7cSSriram R 
2298ba905bf4SAshok Raj Nagarajan /**
229917741cdcSJohannes Berg  * struct ieee80211_sta - station table entry
230017741cdcSJohannes Berg  *
230117741cdcSJohannes Berg  * A station table entry represents a station we are possibly
230217741cdcSJohannes Berg  * communicating with. Since stations are RCU-managed in
230317741cdcSJohannes Berg  * mac80211, any ieee80211_sta pointer you get access to must
230417741cdcSJohannes Berg  * either be protected by rcu_read_lock() explicitly or implicitly,
230517741cdcSJohannes Berg  * or you must take good care to not use such a pointer after a
230634e89507SJohannes Berg  * call to your sta_remove callback that removed it.
2307046d2e7cSSriram R  * This also represents the MLD STA in case of MLO association
2308046d2e7cSSriram R  * and holds pointers to various link STA's
230917741cdcSJohannes Berg  *
231017741cdcSJohannes Berg  * @addr: MAC address
231117741cdcSJohannes Berg  * @aid: AID we assigned to the station if we're an AP
2312480dd46bSMaxim Altshul  * @max_rx_aggregation_subframes: maximal amount of frames in a single AMPDU
2313480dd46bSMaxim Altshul  *	that this station is allowed to transmit to us.
2314480dd46bSMaxim Altshul  *	Can be modified by driver.
2315527871d7SJohannes Berg  * @wme: indicates whether the STA supports QoS/WME (if local devices does,
2316527871d7SJohannes Berg  *	otherwise always false)
231717741cdcSJohannes Berg  * @drv_priv: data area for driver use, will always be aligned to
2318b4f7f4adSJani Nikula  *	sizeof(void \*), size is determined in hw information.
2319910868dbSEliad Peller  * @uapsd_queues: bitmap of queues configured for uapsd. Only valid
2320f438ceb8SEmmanuel Grumbach  *	if wme is supported. The bits order is like in
2321f438ceb8SEmmanuel Grumbach  *	IEEE80211_WMM_IE_STA_QOSINFO_AC_*.
2322910868dbSEliad Peller  * @max_sp: max Service Period. Only valid if wme is supported.
232303f831a6SRobert P. J. Day  * @rates: rate control selection table
23240c4972ccSArik Nemtsov  * @tdls: indicates whether the STA is a TDLS peer
23258b94148cSArik Nemtsov  * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
23268b94148cSArik Nemtsov  *	valid if the STA is a TDLS peer in the first place.
232793f0490eSTamizh chelvam  * @mfp: indicates whether the STA uses management frame protection or not.
23283e0278b7SAndrei Otcheretianski  * @mlo: indicates whether the STA is MLO station.
2329506bcfa8SEmmanuel Grumbach  * @max_amsdu_subframes: indicates the maximal number of MSDUs in a single
2330506bcfa8SEmmanuel Grumbach  *	A-MSDU. Taken from the Extended Capabilities element. 0 means
2331506bcfa8SEmmanuel Grumbach  *	unlimited.
23324c51541dSBenjamin Berg  * @cur: currently valid data as aggregated from the active links
23334c51541dSBenjamin Berg  *	For non MLO STA it will point to the deflink data. For MLO STA
23344c51541dSBenjamin Berg  *	ieee80211_sta_recalc_aggregates() must be called to update it.
233552cfa1d6SAyala Beker  * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not.
2336c850e31fSAlexander Wetzel  * @txq: per-TID data TX queues; note that the last entry (%IEEE80211_NUM_TIDS)
2337c850e31fSAlexander Wetzel  *	is used for non-data frames
2338046d2e7cSSriram R  * @deflink: This holds the default link STA information, for non MLO STA all link
2339046d2e7cSSriram R  *	specific STA information is accessed through @deflink or through
2340046d2e7cSSriram R  *	link[0] which points to address of @deflink. For MLO Link STA
2341046d2e7cSSriram R  *	the first added link STA will point to deflink.
2342046d2e7cSSriram R  * @link: reference to Link Sta entries. For Non MLO STA, except 1st link,
2343046d2e7cSSriram R  *	i.e link[0] all links would be assigned to NULL by default and
2344046d2e7cSSriram R  *	would access link information via @deflink or link[0]. For MLO
2345046d2e7cSSriram R  *	STA, first link STA being added will point its link pointer to
2346046d2e7cSSriram R  *	@deflink address and remaining would be allocated and the address
2347046d2e7cSSriram R  *	would be assigned to link[link_id] where link_id is the id assigned
2348046d2e7cSSriram R  *	by the AP.
2349cb71f1d1SJohannes Berg  * @valid_links: bitmap of valid links, or 0 for non-MLO
235017741cdcSJohannes Berg  */
235117741cdcSJohannes Berg struct ieee80211_sta {
235217741cdcSJohannes Berg 	u8 addr[ETH_ALEN];
235317741cdcSJohannes Berg 	u16 aid;
235441cbb0f5SLuca Coelho 	u16 max_rx_aggregation_subframes;
235539df600aSArik Nemtsov 	bool wme;
23569533b4acSEliad Peller 	u8 uapsd_queues;
23579533b4acSEliad Peller 	u8 max_sp;
23580d528d85SFelix Fietkau 	struct ieee80211_sta_rates __rcu *rates;
23590c4972ccSArik Nemtsov 	bool tdls;
23608b94148cSArik Nemtsov 	bool tdls_initiator;
236193f0490eSTamizh chelvam 	bool mfp;
23623e0278b7SAndrei Otcheretianski 	bool mlo;
2363506bcfa8SEmmanuel Grumbach 	u8 max_amsdu_subframes;
236457eeb208SJohannes Berg 
23654c51541dSBenjamin Berg 	struct ieee80211_sta_aggregates *cur;
23664c51541dSBenjamin Berg 
236752cfa1d6SAyala Beker 	bool support_p2p_ps;
236817741cdcSJohannes Berg 
2369adf8ed01SJohannes Berg 	struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
2370ba8c3d6fSFelix Fietkau 
2371cb71f1d1SJohannes Berg 	u16 valid_links;
2372046d2e7cSSriram R 	struct ieee80211_link_sta deflink;
2373c71420dbSJohannes Berg 	struct ieee80211_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
2374046d2e7cSSriram R 
237517741cdcSJohannes Berg 	/* must be last */
23763c23215bSGustavo A. R. Silva 	u8 drv_priv[] __aligned(sizeof(void *));
237717741cdcSJohannes Berg };
237817741cdcSJohannes Berg 
237965fd846cSJohannes Berg #ifdef CONFIG_LOCKDEP
238065fd846cSJohannes Berg bool lockdep_sta_mutex_held(struct ieee80211_sta *pubsta);
238165fd846cSJohannes Berg #else
lockdep_sta_mutex_held(struct ieee80211_sta * pubsta)238265fd846cSJohannes Berg static inline bool lockdep_sta_mutex_held(struct ieee80211_sta *pubsta)
238365fd846cSJohannes Berg {
238465fd846cSJohannes Berg 	return true;
238565fd846cSJohannes Berg }
238665fd846cSJohannes Berg #endif
238765fd846cSJohannes Berg 
238865fd846cSJohannes Berg #define link_sta_dereference_protected(sta, link_id)		\
238965fd846cSJohannes Berg 	rcu_dereference_protected((sta)->link[link_id],		\
239065fd846cSJohannes Berg 				  lockdep_sta_mutex_held(sta))
239165fd846cSJohannes Berg 
2392f3630c4fSJohannes Berg #define link_sta_dereference_check(sta, link_id)		\
2393f3630c4fSJohannes Berg 	rcu_dereference_check((sta)->link[link_id],		\
2394f3630c4fSJohannes Berg 			      lockdep_sta_mutex_held(sta))
2395f3630c4fSJohannes Berg 
2396efe9c2bfSJohannes Berg #define for_each_sta_active_link(vif, sta, link_sta, link_id)			\
23979f781533SGregory Greenman 	for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++)		\
2398efe9c2bfSJohannes Berg 		if ((!(vif)->active_links ||					\
2399efe9c2bfSJohannes Berg 		     (vif)->active_links & BIT(link_id)) &&			\
240065fd846cSJohannes Berg 		    ((link_sta) = link_sta_dereference_protected(sta, link_id)))
24019f781533SGregory Greenman 
240217741cdcSJohannes Berg /**
2403478f8d2bSTomas Winkler  * enum sta_notify_cmd - sta notify command
2404478f8d2bSTomas Winkler  *
2405478f8d2bSTomas Winkler  * Used with the sta_notify() callback in &struct ieee80211_ops, this
240638a6cc75SSujith  * indicates if an associated station made a power state transition.
2407478f8d2bSTomas Winkler  *
24084571d3bfSChristian Lamparter  * @STA_NOTIFY_SLEEP: a station is now sleeping
24094571d3bfSChristian Lamparter  * @STA_NOTIFY_AWAKE: a sleeping station woke up
24104571d3bfSChristian Lamparter  */
241189fad578SChristian Lamparter enum sta_notify_cmd {
24124571d3bfSChristian Lamparter 	STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE,
24134571d3bfSChristian Lamparter };
24144571d3bfSChristian Lamparter 
24154571d3bfSChristian Lamparter /**
241636323f81SThomas Huehn  * struct ieee80211_tx_control - TX control data
241736323f81SThomas Huehn  *
241836323f81SThomas Huehn  * @sta: station table entry, this sta pointer may be NULL and
241936323f81SThomas Huehn  * 	it is not allowed to copy the pointer, due to RCU.
242036323f81SThomas Huehn  */
242136323f81SThomas Huehn struct ieee80211_tx_control {
242236323f81SThomas Huehn 	struct ieee80211_sta *sta;
242336323f81SThomas Huehn };
242436323f81SThomas Huehn 
242536323f81SThomas Huehn /**
2426ba8c3d6fSFelix Fietkau  * struct ieee80211_txq - Software intermediate tx queue
2427ba8c3d6fSFelix Fietkau  *
2428ba8c3d6fSFelix Fietkau  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
2429ba8c3d6fSFelix Fietkau  * @sta: station table entry, %NULL for per-vif queue
2430adf8ed01SJohannes Berg  * @tid: the TID for this queue (unused for per-vif queue),
2431adf8ed01SJohannes Berg  *	%IEEE80211_NUM_TIDS for non-data (if enabled)
2432ba8c3d6fSFelix Fietkau  * @ac: the AC for this queue
2433f8bdbb58SJohannes Berg  * @drv_priv: driver private area, sized by hw->txq_data_size
2434ba8c3d6fSFelix Fietkau  *
2435ba8c3d6fSFelix Fietkau  * The driver can obtain packets from this queue by calling
2436ba8c3d6fSFelix Fietkau  * ieee80211_tx_dequeue().
2437ba8c3d6fSFelix Fietkau  */
2438ba8c3d6fSFelix Fietkau struct ieee80211_txq {
2439ba8c3d6fSFelix Fietkau 	struct ieee80211_vif *vif;
2440ba8c3d6fSFelix Fietkau 	struct ieee80211_sta *sta;
2441ba8c3d6fSFelix Fietkau 	u8 tid;
2442ba8c3d6fSFelix Fietkau 	u8 ac;
2443ba8c3d6fSFelix Fietkau 
2444ba8c3d6fSFelix Fietkau 	/* must be last */
24453c23215bSGustavo A. R. Silva 	u8 drv_priv[] __aligned(sizeof(void *));
2446ba8c3d6fSFelix Fietkau };
2447ba8c3d6fSFelix Fietkau 
2448ba8c3d6fSFelix Fietkau /**
24491bc0826cSJohannes Berg  * enum ieee80211_hw_flags - hardware flags
24501bc0826cSJohannes Berg  *
24511bc0826cSJohannes Berg  * These flags are used to indicate hardware capabilities to
24521bc0826cSJohannes Berg  * the stack. Generally, flags here should have their meaning
24531bc0826cSJohannes Berg  * done in a way that the simplest hardware doesn't need setting
24541bc0826cSJohannes Berg  * any particular flags. There are some exceptions to this rule,
24551bc0826cSJohannes Berg  * however, so you are advised to review these flags carefully.
24561bc0826cSJohannes Berg  *
2457af65cd96SJohannes Berg  * @IEEE80211_HW_HAS_RATE_CONTROL:
2458af65cd96SJohannes Berg  *	The hardware or firmware includes rate control, and cannot be
2459af65cd96SJohannes Berg  *	controlled by the stack. As such, no rate control algorithm
2460af65cd96SJohannes Berg  *	should be instantiated, and the TX rate reported to userspace
2461af65cd96SJohannes Berg  *	will be taken from the TX status instead of the rate control
2462af65cd96SJohannes Berg  *	algorithm.
2463af65cd96SJohannes Berg  *	Note that this requires that the driver implement a number of
2464af65cd96SJohannes Berg  *	callbacks so it has the correct information, it needs to have
2465af65cd96SJohannes Berg  *	the @set_rts_threshold callback and must look at the BSS config
2466af65cd96SJohannes Berg  *	@use_cts_prot for G/N protection, @use_short_slot for slot
2467af65cd96SJohannes Berg  *	timing in 2.4 GHz and @use_short_preamble for preambles for
2468af65cd96SJohannes Berg  *	CCK frames.
2469af65cd96SJohannes Berg  *
24701bc0826cSJohannes Berg  * @IEEE80211_HW_RX_INCLUDES_FCS:
24711bc0826cSJohannes Berg  *	Indicates that received frames passed to the stack include
24721bc0826cSJohannes Berg  *	the FCS at the end.
24731bc0826cSJohannes Berg  *
24741bc0826cSJohannes Berg  * @IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING:
24751bc0826cSJohannes Berg  *	Some wireless LAN chipsets buffer broadcast/multicast frames
24761bc0826cSJohannes Berg  *	for power saving stations in the hardware/firmware and others
24771bc0826cSJohannes Berg  *	rely on the host system for such buffering. This option is used
24781bc0826cSJohannes Berg  *	to configure the IEEE 802.11 upper layer to buffer broadcast and
24791bc0826cSJohannes Berg  *	multicast frames when there are power saving stations so that
2480546c80c9SLuis R. Rodriguez  *	the driver can fetch them with ieee80211_get_buffered_bc().
24811bc0826cSJohannes Berg  *
2482566bfe5aSBruno Randolf  * @IEEE80211_HW_SIGNAL_UNSPEC:
2483566bfe5aSBruno Randolf  *	Hardware can provide signal values but we don't know its units. We
2484566bfe5aSBruno Randolf  *	expect values between 0 and @max_signal.
2485566bfe5aSBruno Randolf  *	If possible please provide dB or dBm instead.
2486566bfe5aSBruno Randolf  *
2487566bfe5aSBruno Randolf  * @IEEE80211_HW_SIGNAL_DBM:
2488566bfe5aSBruno Randolf  *	Hardware gives signal values in dBm, decibel difference from
2489566bfe5aSBruno Randolf  *	one milliwatt. This is the preferred method since it is standardized
2490566bfe5aSBruno Randolf  *	between different devices. @max_signal does not need to be set.
2491566bfe5aSBruno Randolf  *
249206ff47bcSTomas Winkler  * @IEEE80211_HW_SPECTRUM_MGMT:
249306ff47bcSTomas Winkler  * 	Hardware supports spectrum management defined in 802.11h
249406ff47bcSTomas Winkler  * 	Measurement, Channel Switch, Quieting, TPC
24958b30b1feSSujith  *
24968b30b1feSSujith  * @IEEE80211_HW_AMPDU_AGGREGATION:
24978b30b1feSSujith  *	Hardware supports 11n A-MPDU aggregation.
2498520eb820SKalle Valo  *
24994be8c387SJohannes Berg  * @IEEE80211_HW_SUPPORTS_PS:
25004be8c387SJohannes Berg  *	Hardware has power save support (i.e. can go to sleep).
25014be8c387SJohannes Berg  *
25024be8c387SJohannes Berg  * @IEEE80211_HW_PS_NULLFUNC_STACK:
25034be8c387SJohannes Berg  *	Hardware requires nullfunc frame handling in stack, implies
25044be8c387SJohannes Berg  *	stack support for dynamic PS.
25054be8c387SJohannes Berg  *
25064be8c387SJohannes Berg  * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
25074be8c387SJohannes Berg  *	Hardware has support for dynamic PS.
25084375d083SJouni Malinen  *
25094375d083SJouni Malinen  * @IEEE80211_HW_MFP_CAPABLE:
25104375d083SJouni Malinen  *	Hardware supports management frame protection (MFP, IEEE 802.11w).
251104de8381SKalle Valo  *
2512375177bfSVivek Natarajan  * @IEEE80211_HW_REPORTS_TX_ACK_STATUS:
2513375177bfSVivek Natarajan  *	Hardware can provide ack status reports of Tx frames to
2514375177bfSVivek Natarajan  *	the stack.
2515375177bfSVivek Natarajan  *
25161e4dcd01SJuuso Oikarinen  * @IEEE80211_HW_CONNECTION_MONITOR:
25171e4dcd01SJuuso Oikarinen  *	The hardware performs its own connection monitoring, including
25181e4dcd01SJuuso Oikarinen  *	periodic keep-alives to the AP and probing the AP on beacon loss.
2519a97c13c3SJuuso Oikarinen  *
2520c65dd147SEmmanuel Grumbach  * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC:
2521c65dd147SEmmanuel Grumbach  *	This device needs to get data from beacon before association (i.e.
2522c65dd147SEmmanuel Grumbach  *	dtim_period).
2523e31b8213SJohannes Berg  *
2524e31b8213SJohannes Berg  * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports
2525e31b8213SJohannes Berg  *	per-station GTKs as used by IBSS RSN or during fast transition. If
2526e31b8213SJohannes Berg  *	the device doesn't support per-station GTKs, but can be asked not
2527e31b8213SJohannes Berg  *	to decrypt group addressed frames, then IBSS RSN support is still
2528e31b8213SJohannes Berg  *	possible but software crypto will be used. Advertise the wiphy flag
2529e31b8213SJohannes Berg  *	only in that case.
2530d057e5a3SArik Nemtsov  *
2531d057e5a3SArik Nemtsov  * @IEEE80211_HW_AP_LINK_PS: When operating in AP mode the device
2532d057e5a3SArik Nemtsov  *	autonomously manages the PS status of connected stations. When
2533d057e5a3SArik Nemtsov  *	this flag is set mac80211 will not trigger PS mode for connected
2534d057e5a3SArik Nemtsov  *	stations based on the PM bit of incoming frames.
2535d057e5a3SArik Nemtsov  *	Use ieee80211_start_ps()/ieee8021_end_ps() to manually configure
2536d057e5a3SArik Nemtsov  *	the PS mode of connected stations.
2537edf6b784SArik Nemtsov  *
2538edf6b784SArik Nemtsov  * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session
2539edf6b784SArik Nemtsov  *	setup strictly in HW. mac80211 should not attempt to do this in
2540edf6b784SArik Nemtsov  *	software.
2541885bd8ecSEliad Peller  *
25424b6f1dd6SJohannes Berg  * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of
25434b6f1dd6SJohannes Berg  *	a virtual monitor interface when monitor interfaces are the only
25444b6f1dd6SJohannes Berg  *	active interfaces.
25453a25a8c8SJohannes Berg  *
2546e27513fbSBen Greear  * @IEEE80211_HW_NO_AUTO_VIF: The driver would like for no wlanX to
2547e27513fbSBen Greear  *	be created.  It is expected user-space will create vifs as
2548e27513fbSBen Greear  *	desired (and thus have them named as desired).
2549e27513fbSBen Greear  *
2550fa7e1fbcSJohannes Berg  * @IEEE80211_HW_SW_CRYPTO_CONTROL: The driver wants to control which of the
2551fa7e1fbcSJohannes Berg  *	crypto algorithms can be done in software - so don't automatically
2552fa7e1fbcSJohannes Berg  *	try to fall back to it if hardware crypto fails, but do so only if
2553fa7e1fbcSJohannes Berg  *	the driver returns 1. This also forces the driver to advertise its
2554fa7e1fbcSJohannes Berg  *	supported cipher suites.
2555fa7e1fbcSJohannes Berg  *
255617c18bf8SJohannes Berg  * @IEEE80211_HW_SUPPORT_FAST_XMIT: The driver/hardware supports fast-xmit,
255717c18bf8SJohannes Berg  *	this currently requires only the ability to calculate the duration
255817c18bf8SJohannes Berg  *	for frames.
255917c18bf8SJohannes Berg  *
25603a25a8c8SJohannes Berg  * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface
25613a25a8c8SJohannes Berg  *	queue mapping in order to use different queues (not just one per AC)
25623a25a8c8SJohannes Berg  *	for different virtual interfaces. See the doc section on HW queue
25633a25a8c8SJohannes Berg  *	control for more details.
25646d71117aSJohannes Berg  *
25650d528d85SFelix Fietkau  * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate
25660d528d85SFelix Fietkau  *	selection table provided by the rate control algorithm.
25670d528d85SFelix Fietkau  *
25686d71117aSJohannes Berg  * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
25696d71117aSJohannes Berg  *	P2P Interface. This will be honoured even if more than one interface
25706d71117aSJohannes Berg  *	is supported.
2571ef429dadSJohannes Berg  *
2572ef429dadSJohannes Berg  * @IEEE80211_HW_TIMING_BEACON_ONLY: Use sync timing from beacon frames
2573ef429dadSJohannes Berg  *	only, to allow getting TBTT of a DTIM beacon.
25747578d575SArik Nemtsov  *
2575919be62bSJohannes Berg  * @IEEE80211_HW_SUPPORTS_HT_CCK_RATES: Hardware supports mixing HT/CCK rates
2576919be62bSJohannes Berg  *	and can cope with CCK rates in an aggregation session (e.g. by not
2577919be62bSJohannes Berg  *	using aggregation for such frames.)
2578919be62bSJohannes Berg  *
25797578d575SArik Nemtsov  * @IEEE80211_HW_CHANCTX_STA_CSA: Support 802.11h based channel-switch (CSA)
25807578d575SArik Nemtsov  *	for a single active channel while using channel contexts. When support
25817578d575SArik Nemtsov  *	is not enabled the default action is to disconnect when getting the
25827578d575SArik Nemtsov  *	CSA frame.
25835d52ee81SLuciano Coelho  *
2584c70f59a2SIdo Yariv  * @IEEE80211_HW_SUPPORTS_CLONED_SKBS: The driver will never modify the payload
2585c70f59a2SIdo Yariv  *	or tailroom of TX skbs without copying them first.
2586c70f59a2SIdo Yariv  *
2587c526a467SJohannes Berg  * @IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands
2588c56ef672SDavid Spinadel  *	in one command, mac80211 doesn't have to run separate scans per band.
258930686bf7SJohannes Berg  *
2590b98fb44fSArik Nemtsov  * @IEEE80211_HW_TDLS_WIDER_BW: The device/driver supports wider bandwidth
2591b98fb44fSArik Nemtsov  *	than then BSS bandwidth for a TDLS link on the base channel.
2592b98fb44fSArik Nemtsov  *
259399e7ca44SEmmanuel Grumbach  * @IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU: The driver supports receiving A-MSDUs
259499e7ca44SEmmanuel Grumbach  *	within A-MPDU.
259599e7ca44SEmmanuel Grumbach  *
259635afa588SHelmut Schaa  * @IEEE80211_HW_BEACON_TX_STATUS: The device/driver provides TX status
259735afa588SHelmut Schaa  *	for sent beacons.
259835afa588SHelmut Schaa  *
259931104891SJohannes Berg  * @IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR: Hardware (or driver) requires that each
260031104891SJohannes Berg  *	station has a unique address, i.e. each station entry can be identified
260131104891SJohannes Berg  *	by just its MAC address; this prevents, for example, the same station
260231104891SJohannes Berg  *	from connecting to two virtual AP interfaces at the same time.
260331104891SJohannes Berg  *
2604412a6d80SSara Sharon  * @IEEE80211_HW_SUPPORTS_REORDERING_BUFFER: Hardware (or driver) manages the
2605412a6d80SSara Sharon  *	reordering buffer internally, guaranteeing mac80211 receives frames in
2606412a6d80SSara Sharon  *	order and does not need to manage its own reorder buffer or BA session
2607412a6d80SSara Sharon  *	timeout.
2608412a6d80SSara Sharon  *
2609c9c5962bSJohannes Berg  * @IEEE80211_HW_USES_RSS: The device uses RSS and thus requires parallel RX,
2610c9c5962bSJohannes Berg  *	which implies using per-CPU station statistics.
2611c9c5962bSJohannes Berg  *
26126e0456b5SFelix Fietkau  * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
26136e0456b5SFelix Fietkau  *	A-MSDU frames. Requires software tx queueing and fast-xmit support.
26146e0456b5SFelix Fietkau  *	When not using minstrel/minstrel_ht rate control, the driver must
26156e0456b5SFelix Fietkau  *	limit the maximum A-MSDU size based on the current tx rate by setting
26166e0456b5SFelix Fietkau  *	max_rc_amsdu_len in struct ieee80211_sta.
26176e0456b5SFelix Fietkau  *
26186e0456b5SFelix Fietkau  * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
26196e0456b5SFelix Fietkau  *	skbs, needed for zero-copy software A-MSDU.
26206e0456b5SFelix Fietkau  *
2621e8a24cd4SRajkumar Manoharan  * @IEEE80211_HW_REPORTS_LOW_ACK: The driver (or firmware) reports low ack event
2622e8a24cd4SRajkumar Manoharan  *	by ieee80211_report_low_ack() based on its own algorithm. For such
2623e8a24cd4SRajkumar Manoharan  *	drivers, mac80211 packet loss mechanism will not be triggered and driver
2624e8a24cd4SRajkumar Manoharan  *	is completely depending on firmware event for station kickout.
2625e8a24cd4SRajkumar Manoharan  *
2626f3fe4e93SSara Sharon  * @IEEE80211_HW_SUPPORTS_TX_FRAG: Hardware does fragmentation by itself.
2627f3fe4e93SSara Sharon  *	The stack will not do fragmentation.
2628f3fe4e93SSara Sharon  *	The callback for @set_frag_threshold should be set as well.
2629f3fe4e93SSara Sharon  *
2630e2fb1b83SYingying Tang  * @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on
2631e2fb1b83SYingying Tang  *	TDLS links.
2632e2fb1b83SYingying Tang  *
263394ba9271SIlan Peer  * @IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP: The driver requires the
263494ba9271SIlan Peer  *	mgd_prepare_tx() callback to be called before transmission of a
263594ba9271SIlan Peer  *	deauthentication frame in case the association was completed but no
263694ba9271SIlan Peer  *	beacon was heard. This is required in multi-channel scenarios, where the
263794ba9271SIlan Peer  *	virtual interface might not be given air time for the transmission of
263894ba9271SIlan Peer  *	the frame, as it is not synced with the AP/P2P GO yet, and thus the
263994ba9271SIlan Peer  *	deauthentication frame might not be transmitted.
2640d1361b32SRandy Dunlap  *
26417c181f4fSBen Caradoc-Davies  * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't
26427c181f4fSBen Caradoc-Davies  *	support QoS NDP for AP probing - that's most likely a driver bug.
264394ba9271SIlan Peer  *
2644adf8ed01SJohannes Berg  * @IEEE80211_HW_BUFF_MMPDU_TXQ: use the TXQ for bufferable MMPDUs, this of
2645adf8ed01SJohannes Berg  *	course requires the driver to use TXQs to start with.
2646adf8ed01SJohannes Berg  *
264709b4a4faSJohannes Berg  * @IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW: (Hardware) rate control supports VHT
264809b4a4faSJohannes Berg  *	extended NSS BW (dot11VHTExtendedNSSBWCapable). This flag will be set if
264909b4a4faSJohannes Berg  *	the selected rate control algorithm sets %RATE_CTRL_CAPA_VHT_EXT_NSS_BW
265009b4a4faSJohannes Berg  *	but if the rate control is built-in then it must be set by the driver.
265109b4a4faSJohannes Berg  *	See also the documentation for that flag.
265209b4a4faSJohannes Berg  *
26530eeb2b67SSara Sharon  * @IEEE80211_HW_STA_MMPDU_TXQ: use the extra non-TID per-station TXQ for all
26540eeb2b67SSara Sharon  *	MMPDUs on station interfaces. This of course requires the driver to use
26550eeb2b67SSara Sharon  *	TXQs to start with.
26560eeb2b67SSara Sharon  *
265777f7ffdcSFelix Fietkau  * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU
265877f7ffdcSFelix Fietkau  *	length in tx status information
265977f7ffdcSFelix Fietkau  *
2660caf56338SSara Sharon  * @IEEE80211_HW_SUPPORTS_MULTI_BSSID: Hardware supports multi BSSID
2661caf56338SSara Sharon  *
2662caf56338SSara Sharon  * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
2663caf56338SSara Sharon  *	only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
2664caf56338SSara Sharon  *
2665dc3998ecSAlexander Wetzel  * @IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT: The card and driver is only
2666dc3998ecSAlexander Wetzel  *	aggregating MPDUs with the same keyid, allowing mac80211 to keep Tx
2667dc3998ecSAlexander Wetzel  *	A-MPDU sessions active while rekeying with Extended Key ID.
2668dc3998ecSAlexander Wetzel  *
26696aea26ceSFelix Fietkau  * @IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD: Hardware supports tx encapsulation
26706aea26ceSFelix Fietkau  *	offload
26716aea26ceSFelix Fietkau  *
267280a915ecSFelix Fietkau  * @IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD: Hardware supports rx decapsulation
267380a915ecSFelix Fietkau  *	offload
267480a915ecSFelix Fietkau  *
267555f8205eSSriram R  * @IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP: Hardware supports concurrent rx
267655f8205eSSriram R  *	decapsulation offload and passing raw 802.11 frames for monitor iface.
267755f8205eSSriram R  *	If this is supported, the driver must pass both 802.3 frames for real
267855f8205eSSriram R  *	usage and 802.11 frames with %RX_FLAG_ONLY_MONITOR set for monitor to
267955f8205eSSriram R  *	the stack.
268055f8205eSSriram R  *
26816d945a33SLorenzo Bianconi  * @IEEE80211_HW_DETECTS_COLOR_COLLISION: HW/driver has support for BSS color
26826d945a33SLorenzo Bianconi  *	collision detection and doesn't need it in software.
26836d945a33SLorenzo Bianconi  *
2684963d0e8dSJohannes Berg  * @IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX: Hardware/driver handles transmitting
2685963d0e8dSJohannes Berg  *	multicast frames on all links, mac80211 should not do that.
2686963d0e8dSJohannes Berg  *
268730686bf7SJohannes Berg  * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
26881bc0826cSJohannes Berg  */
26891bc0826cSJohannes Berg enum ieee80211_hw_flags {
269030686bf7SJohannes Berg 	IEEE80211_HW_HAS_RATE_CONTROL,
269130686bf7SJohannes Berg 	IEEE80211_HW_RX_INCLUDES_FCS,
269230686bf7SJohannes Berg 	IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING,
269330686bf7SJohannes Berg 	IEEE80211_HW_SIGNAL_UNSPEC,
269430686bf7SJohannes Berg 	IEEE80211_HW_SIGNAL_DBM,
269530686bf7SJohannes Berg 	IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC,
269630686bf7SJohannes Berg 	IEEE80211_HW_SPECTRUM_MGMT,
269730686bf7SJohannes Berg 	IEEE80211_HW_AMPDU_AGGREGATION,
269830686bf7SJohannes Berg 	IEEE80211_HW_SUPPORTS_PS,
269930686bf7SJohannes Berg 	IEEE80211_HW_PS_NULLFUNC_STACK,
270030686bf7SJohannes Berg 	IEEE80211_HW_SUPPORTS_DYNAMIC_PS,
270130686bf7SJohannes Berg 	IEEE80211_HW_MFP_CAPABLE,
270230686bf7SJohannes Berg 	IEEE80211_HW_WANT_MONITOR_VIF,
270330686bf7SJohannes Berg 	IEEE80211_HW_NO_AUTO_VIF,
270430686bf7SJohannes Berg 	IEEE80211_HW_SW_CRYPTO_CONTROL,
270530686bf7SJohannes Berg 	IEEE80211_HW_SUPPORT_FAST_XMIT,
270630686bf7SJohannes Berg 	IEEE80211_HW_REPORTS_TX_ACK_STATUS,
270730686bf7SJohannes Berg 	IEEE80211_HW_CONNECTION_MONITOR,
270830686bf7SJohannes Berg 	IEEE80211_HW_QUEUE_CONTROL,
270930686bf7SJohannes Berg 	IEEE80211_HW_SUPPORTS_PER_STA_GTK,
271030686bf7SJohannes Berg 	IEEE80211_HW_AP_LINK_PS,
271130686bf7SJohannes Berg 	IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
271230686bf7SJohannes Berg 	IEEE80211_HW_SUPPORTS_RC_TABLE,
271330686bf7SJohannes Berg 	IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF,
271430686bf7SJohannes Berg 	IEEE80211_HW_TIMING_BEACON_ONLY,
271530686bf7SJohannes Berg 	IEEE80211_HW_SUPPORTS_HT_CCK_RATES,
271630686bf7SJohannes Berg 	IEEE80211_HW_CHANCTX_STA_CSA,
271730686bf7SJohannes Berg 	IEEE80211_HW_SUPPORTS_CLONED_SKBS,
271830686bf7SJohannes Berg 	IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,
2719b98fb44fSArik Nemtsov 	IEEE80211_HW_TDLS_WIDER_BW,
272099e7ca44SEmmanuel Grumbach 	IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
272135afa588SHelmut Schaa 	IEEE80211_HW_BEACON_TX_STATUS,
272231104891SJohannes Berg 	IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
2723412a6d80SSara Sharon 	IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
2724c9c5962bSJohannes Berg 	IEEE80211_HW_USES_RSS,
27256e0456b5SFelix Fietkau 	IEEE80211_HW_TX_AMSDU,
27266e0456b5SFelix Fietkau 	IEEE80211_HW_TX_FRAG_LIST,
2727e8a24cd4SRajkumar Manoharan 	IEEE80211_HW_REPORTS_LOW_ACK,
2728f3fe4e93SSara Sharon 	IEEE80211_HW_SUPPORTS_TX_FRAG,
2729e2fb1b83SYingying Tang 	IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA,
273094ba9271SIlan Peer 	IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP,
27317c181f4fSBen Caradoc-Davies 	IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP,
2732adf8ed01SJohannes Berg 	IEEE80211_HW_BUFF_MMPDU_TXQ,
273309b4a4faSJohannes Berg 	IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
27340eeb2b67SSara Sharon 	IEEE80211_HW_STA_MMPDU_TXQ,
273577f7ffdcSFelix Fietkau 	IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
2736caf56338SSara Sharon 	IEEE80211_HW_SUPPORTS_MULTI_BSSID,
2737caf56338SSara Sharon 	IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
2738dc3998ecSAlexander Wetzel 	IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT,
27396aea26ceSFelix Fietkau 	IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD,
274080a915ecSFelix Fietkau 	IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD,
274155f8205eSSriram R 	IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP,
27426d945a33SLorenzo Bianconi 	IEEE80211_HW_DETECTS_COLOR_COLLISION,
2743963d0e8dSJohannes Berg 	IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX,
274430686bf7SJohannes Berg 
274530686bf7SJohannes Berg 	/* keep last, obviously */
274630686bf7SJohannes Berg 	NUM_IEEE80211_HW_FLAGS
27471bc0826cSJohannes Berg };
27481bc0826cSJohannes Berg 
27497ac1bd6aSJohannes Berg /**
27507ac1bd6aSJohannes Berg  * struct ieee80211_hw - hardware information and state
275175a5f0ccSJohannes Berg  *
275275a5f0ccSJohannes Berg  * This structure contains the configuration and hardware
275375a5f0ccSJohannes Berg  * information for an 802.11 PHY.
275475a5f0ccSJohannes Berg  *
275575a5f0ccSJohannes Berg  * @wiphy: This points to the &struct wiphy allocated for this
275675a5f0ccSJohannes Berg  *	802.11 PHY. You must fill in the @perm_addr and @dev
275775a5f0ccSJohannes Berg  *	members of this structure using SET_IEEE80211_DEV()
27588318d78aSJohannes Berg  *	and SET_IEEE80211_PERM_ADDR(). Additionally, all supported
27598318d78aSJohannes Berg  *	bands (with channels, bitrates) are registered here.
276075a5f0ccSJohannes Berg  *
276175a5f0ccSJohannes Berg  * @conf: &struct ieee80211_conf, device configuration, don't use.
276275a5f0ccSJohannes Berg  *
276375a5f0ccSJohannes Berg  * @priv: pointer to private area that was allocated for driver use
276475a5f0ccSJohannes Berg  *	along with this structure.
276575a5f0ccSJohannes Berg  *
276675a5f0ccSJohannes Berg  * @flags: hardware flags, see &enum ieee80211_hw_flags.
276775a5f0ccSJohannes Berg  *
276875a5f0ccSJohannes Berg  * @extra_tx_headroom: headroom to reserve in each transmit skb
276975a5f0ccSJohannes Berg  *	for use by the driver (e.g. for transmit headers.)
277075a5f0ccSJohannes Berg  *
277170dabeb7SFelix Fietkau  * @extra_beacon_tailroom: tailroom to reserve in each beacon tx skb.
277270dabeb7SFelix Fietkau  *	Can be used by drivers to add extra IEs.
277375a5f0ccSJohannes Berg  *
2774566bfe5aSBruno Randolf  * @max_signal: Maximum value for signal (rssi) in RX information, used
2775566bfe5aSBruno Randolf  *	only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB
277675a5f0ccSJohannes Berg  *
2777ea95bba4STomas Winkler  * @max_listen_interval: max listen interval in units of beacon interval
2778ea95bba4STomas Winkler  *	that HW supports
2779ea95bba4STomas Winkler  *
278075a5f0ccSJohannes Berg  * @queues: number of available hardware transmit queues for
2781e100bb64SJohannes Berg  *	data packets. WMM/QoS requires at least four, these
2782e100bb64SJohannes Berg  *	queues need to have configurable access parameters.
2783e100bb64SJohannes Berg  *
2784830f9038SJohannes Berg  * @rate_control_algorithm: rate control algorithm for this hardware.
2785830f9038SJohannes Berg  *	If unset (NULL), the default algorithm will be used. Must be
2786830f9038SJohannes Berg  *	set before calling ieee80211_register_hw().
278732bfd35dSJohannes Berg  *
278832bfd35dSJohannes Berg  * @vif_data_size: size (in bytes) of the drv_priv data area
278932bfd35dSJohannes Berg  *	within &struct ieee80211_vif.
279017741cdcSJohannes Berg  * @sta_data_size: size (in bytes) of the drv_priv data area
279117741cdcSJohannes Berg  *	within &struct ieee80211_sta.
2792d01a1e65SMichal Kazior  * @chanctx_data_size: size (in bytes) of the drv_priv data area
2793d01a1e65SMichal Kazior  *	within &struct ieee80211_chanctx_conf.
2794ba8c3d6fSFelix Fietkau  * @txq_data_size: size (in bytes) of the drv_priv data area
2795ba8c3d6fSFelix Fietkau  *	within @struct ieee80211_txq.
2796870abdf6SFelix Fietkau  *
279778be49ecSHelmut Schaa  * @max_rates: maximum number of alternate rate retry stages the hw
279878be49ecSHelmut Schaa  *	can handle.
279978be49ecSHelmut Schaa  * @max_report_rates: maximum number of alternate rate retry stages
280078be49ecSHelmut Schaa  *	the hw can report back.
2801e6a9854bSJohannes Berg  * @max_rate_tries: maximum number of tries for each stage
28024e6cbfd0SJohn W. Linville  *
2803df6ba5d8SLuciano Coelho  * @max_rx_aggregation_subframes: maximum buffer size (number of
2804df6ba5d8SLuciano Coelho  *	sub-frames) to be used for A-MPDU block ack receiver
2805df6ba5d8SLuciano Coelho  *	aggregation.
2806df6ba5d8SLuciano Coelho  *	This is only relevant if the device has restrictions on the
2807df6ba5d8SLuciano Coelho  *	number of subframes, if it relies on mac80211 to do reordering
2808df6ba5d8SLuciano Coelho  *	it shouldn't be set.
28095dd36bc9SJohannes Berg  *
28105dd36bc9SJohannes Berg  * @max_tx_aggregation_subframes: maximum number of subframes in an
281141cbb0f5SLuca Coelho  *	aggregate an HT/HE device will transmit. In HT AddBA we'll
281241cbb0f5SLuca Coelho  *	advertise a constant value of 64 as some older APs crash if
281341cbb0f5SLuca Coelho  *	the window size is smaller (an example is LinkSys WRT120N
281441cbb0f5SLuca Coelho  *	with FW v1.0.07 build 002 Jun 18 2012).
281541cbb0f5SLuca Coelho  *	For AddBA to HE capable peers this value will be used.
28163a25a8c8SJohannes Berg  *
28176e0456b5SFelix Fietkau  * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
28186e0456b5SFelix Fietkau  *	of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
28196e0456b5SFelix Fietkau  *
28203a25a8c8SJohannes Berg  * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
28213a25a8c8SJohannes Berg  *	(if %IEEE80211_HW_QUEUE_CONTROL is set)
2822ac55d2feSJohannes Berg  *
2823ac55d2feSJohannes Berg  * @radiotap_mcs_details: lists which MCS information can the HW
2824ac55d2feSJohannes Berg  *	reports, by default it is set to _MCS, _GI and _BW but doesn't
2825b4f7f4adSJani Nikula  *	include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_\* values, only
2826ac55d2feSJohannes Berg  *	adding _BW is supported today.
282772d78728SArik Nemtsov  *
282851648921SJohannes Berg  * @radiotap_vht_details: lists which VHT MCS information the HW reports,
282951648921SJohannes Berg  *	the default is _GI | _BANDWIDTH.
2830b4f7f4adSJani Nikula  *	Use the %IEEE80211_RADIOTAP_VHT_KNOWN_\* values.
283151648921SJohannes Berg  *
283241cbb0f5SLuca Coelho  * @radiotap_he: HE radiotap validity flags
283341cbb0f5SLuca Coelho  *
283499ee7caeSJohannes Berg  * @radiotap_timestamp: Information for the radiotap timestamp field; if the
28357d419463SJohannes Berg  *	@units_pos member is set to a non-negative value then the timestamp
283699ee7caeSJohannes Berg  *	field will be added and populated from the &struct ieee80211_rx_status
28377d419463SJohannes Berg  *	device_timestamp.
28387d419463SJohannes Berg  * @radiotap_timestamp.units_pos: Must be set to a combination of a
28397d419463SJohannes Berg  *	IEEE80211_RADIOTAP_TIMESTAMP_UNIT_* and a
28407d419463SJohannes Berg  *	IEEE80211_RADIOTAP_TIMESTAMP_SPOS_* value.
28417d419463SJohannes Berg  * @radiotap_timestamp.accuracy: If non-negative, fills the accuracy in the
28427d419463SJohannes Berg  *	radiotap field and the accuracy known flag will be set.
284399ee7caeSJohannes Berg  *
284472d78728SArik Nemtsov  * @netdev_features: netdev features to be set in each netdev created
2845680a0dabSJohannes Berg  *	from this HW. Note that not all features are usable with mac80211,
2846680a0dabSJohannes Berg  *	other features will be rejected during HW registration.
2847219c3867SAlexander Bondar  *
2848219c3867SAlexander Bondar  * @uapsd_queues: This bitmap is included in (re)association frame to indicate
2849219c3867SAlexander Bondar  *	for each access category if it is uAPSD trigger-enabled and delivery-
2850219c3867SAlexander Bondar  *	enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap.
2851219c3867SAlexander Bondar  *	Each bit corresponds to different AC. Value '1' in specific bit means
2852219c3867SAlexander Bondar  *	that corresponding AC is both trigger- and delivery-enabled. '0' means
2853219c3867SAlexander Bondar  *	neither enabled.
2854219c3867SAlexander Bondar  *
2855219c3867SAlexander Bondar  * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may
2856219c3867SAlexander Bondar  *	deliver to a WMM STA during any Service Period triggered by the WMM STA.
2857219c3867SAlexander Bondar  *	Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values.
28582475b1ccSMax Stepanov  *
2859167e33f4SAyala Beker  * @max_nan_de_entries: maximum number of NAN DE functions supported by the
2860167e33f4SAyala Beker  *	device.
286170e53669SWen Gong  *
286270e53669SWen Gong  * @tx_sk_pacing_shift: Pacing shift to set on TCP sockets when frames from
286370e53669SWen Gong  *	them are encountered. The default should typically not be changed,
286470e53669SWen Gong  *	unless the driver has good reasons for needing more buffers.
2865b4809e94SToke Høiland-Jørgensen  *
2866cb86880eSToke Høiland-Jørgensen  * @weight_multiplier: Driver specific airtime weight multiplier used while
2867b4809e94SToke Høiland-Jørgensen  *	refilling deficit of each TXQ.
286806354665SWen Gong  *
286906354665SWen Gong  * @max_mtu: the max mtu could be set.
287044fa75f2SJonas Jelonek  *
287144fa75f2SJonas Jelonek  * @tx_power_levels: a list of power levels supported by the wifi hardware.
287244fa75f2SJonas Jelonek  * 	The power levels can be specified either as integer or fractions.
287344fa75f2SJonas Jelonek  * 	The power level at idx 0 shall be the maximum positive power level.
287444fa75f2SJonas Jelonek  *
287544fa75f2SJonas Jelonek  * @max_txpwr_levels_idx: the maximum valid idx of 'tx_power_levels' list.
28767ac1bd6aSJohannes Berg  */
2877f0706e82SJiri Benc struct ieee80211_hw {
2878f0706e82SJiri Benc 	struct ieee80211_conf conf;
287975a5f0ccSJohannes Berg 	struct wiphy *wiphy;
2880830f9038SJohannes Berg 	const char *rate_control_algorithm;
2881f0706e82SJiri Benc 	void *priv;
288230686bf7SJohannes Berg 	unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];
2883f0706e82SJiri Benc 	unsigned int extra_tx_headroom;
288470dabeb7SFelix Fietkau 	unsigned int extra_beacon_tailroom;
288532bfd35dSJohannes Berg 	int vif_data_size;
288617741cdcSJohannes Berg 	int sta_data_size;
2887d01a1e65SMichal Kazior 	int chanctx_data_size;
2888ba8c3d6fSFelix Fietkau 	int txq_data_size;
2889ea95bba4STomas Winkler 	u16 queues;
2890ea95bba4STomas Winkler 	u16 max_listen_interval;
2891f0706e82SJiri Benc 	s8 max_signal;
2892e6a9854bSJohannes Berg 	u8 max_rates;
289378be49ecSHelmut Schaa 	u8 max_report_rates;
2894e6a9854bSJohannes Berg 	u8 max_rate_tries;
289541cbb0f5SLuca Coelho 	u16 max_rx_aggregation_subframes;
289641cbb0f5SLuca Coelho 	u16 max_tx_aggregation_subframes;
28976e0456b5SFelix Fietkau 	u8 max_tx_fragments;
28983a25a8c8SJohannes Berg 	u8 offchannel_tx_hw_queue;
2899ac55d2feSJohannes Berg 	u8 radiotap_mcs_details;
290051648921SJohannes Berg 	u16 radiotap_vht_details;
290199ee7caeSJohannes Berg 	struct {
290299ee7caeSJohannes Berg 		int units_pos;
290399ee7caeSJohannes Berg 		s16 accuracy;
290499ee7caeSJohannes Berg 	} radiotap_timestamp;
290572d78728SArik Nemtsov 	netdev_features_t netdev_features;
2906219c3867SAlexander Bondar 	u8 uapsd_queues;
2907219c3867SAlexander Bondar 	u8 uapsd_max_sp_len;
2908167e33f4SAyala Beker 	u8 max_nan_de_entries;
290970e53669SWen Gong 	u8 tx_sk_pacing_shift;
2910b4809e94SToke Høiland-Jørgensen 	u8 weight_multiplier;
291106354665SWen Gong 	u32 max_mtu;
291244fa75f2SJonas Jelonek 	const s8 *tx_power_levels;
291344fa75f2SJonas Jelonek 	u8 max_txpwr_levels_idx;
2914f0706e82SJiri Benc };
2915f0706e82SJiri Benc 
_ieee80211_hw_check(struct ieee80211_hw * hw,enum ieee80211_hw_flags flg)291630686bf7SJohannes Berg static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
291730686bf7SJohannes Berg 				       enum ieee80211_hw_flags flg)
291830686bf7SJohannes Berg {
291930686bf7SJohannes Berg 	return test_bit(flg, hw->flags);
292030686bf7SJohannes Berg }
292130686bf7SJohannes Berg #define ieee80211_hw_check(hw, flg)	_ieee80211_hw_check(hw, IEEE80211_HW_##flg)
292230686bf7SJohannes Berg 
_ieee80211_hw_set(struct ieee80211_hw * hw,enum ieee80211_hw_flags flg)292330686bf7SJohannes Berg static inline void _ieee80211_hw_set(struct ieee80211_hw *hw,
292430686bf7SJohannes Berg 				     enum ieee80211_hw_flags flg)
292530686bf7SJohannes Berg {
292630686bf7SJohannes Berg 	return __set_bit(flg, hw->flags);
292730686bf7SJohannes Berg }
292830686bf7SJohannes Berg #define ieee80211_hw_set(hw, flg)	_ieee80211_hw_set(hw, IEEE80211_HW_##flg)
292930686bf7SJohannes Berg 
293075a5f0ccSJohannes Berg /**
2931c56ef672SDavid Spinadel  * struct ieee80211_scan_request - hw scan request
2932c56ef672SDavid Spinadel  *
2933c56ef672SDavid Spinadel  * @ies: pointers different parts of IEs (in req.ie)
2934c56ef672SDavid Spinadel  * @req: cfg80211 request.
2935c56ef672SDavid Spinadel  */
2936c56ef672SDavid Spinadel struct ieee80211_scan_request {
2937c56ef672SDavid Spinadel 	struct ieee80211_scan_ies ies;
2938c56ef672SDavid Spinadel 
2939c56ef672SDavid Spinadel 	/* Keep last */
2940c56ef672SDavid Spinadel 	struct cfg80211_scan_request req;
2941c56ef672SDavid Spinadel };
2942c56ef672SDavid Spinadel 
2943c56ef672SDavid Spinadel /**
29448a4d32f3SArik Nemtsov  * struct ieee80211_tdls_ch_sw_params - TDLS channel switch parameters
29458a4d32f3SArik Nemtsov  *
29468a4d32f3SArik Nemtsov  * @sta: peer this TDLS channel-switch request/response came from
29478a4d32f3SArik Nemtsov  * @chandef: channel referenced in a TDLS channel-switch request
29488a4d32f3SArik Nemtsov  * @action_code: see &enum ieee80211_tdls_actioncode
29498a4d32f3SArik Nemtsov  * @status: channel-switch response status
29508a4d32f3SArik Nemtsov  * @timestamp: time at which the frame was received
29518a4d32f3SArik Nemtsov  * @switch_time: switch-timing parameter received in the frame
29528a4d32f3SArik Nemtsov  * @switch_timeout: switch-timing parameter received in the frame
29538a4d32f3SArik Nemtsov  * @tmpl_skb: TDLS switch-channel response template
29548a4d32f3SArik Nemtsov  * @ch_sw_tm_ie: offset of the channel-switch timing IE inside @tmpl_skb
29558a4d32f3SArik Nemtsov  */
29568a4d32f3SArik Nemtsov struct ieee80211_tdls_ch_sw_params {
29578a4d32f3SArik Nemtsov 	struct ieee80211_sta *sta;
29588a4d32f3SArik Nemtsov 	struct cfg80211_chan_def *chandef;
29598a4d32f3SArik Nemtsov 	u8 action_code;
29608a4d32f3SArik Nemtsov 	u32 status;
29618a4d32f3SArik Nemtsov 	u32 timestamp;
29628a4d32f3SArik Nemtsov 	u16 switch_time;
29638a4d32f3SArik Nemtsov 	u16 switch_timeout;
29648a4d32f3SArik Nemtsov 	struct sk_buff *tmpl_skb;
29658a4d32f3SArik Nemtsov 	u32 ch_sw_tm_ie;
29668a4d32f3SArik Nemtsov };
29678a4d32f3SArik Nemtsov 
29688a4d32f3SArik Nemtsov /**
29699a95371aSLuis R. Rodriguez  * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
29709a95371aSLuis R. Rodriguez  *
29719a95371aSLuis R. Rodriguez  * @wiphy: the &struct wiphy which we want to query
29729a95371aSLuis R. Rodriguez  *
29739a95371aSLuis R. Rodriguez  * mac80211 drivers can use this to get to their respective
29749a95371aSLuis R. Rodriguez  * &struct ieee80211_hw. Drivers wishing to get to their own private
29759a95371aSLuis R. Rodriguez  * structure can then access it via hw->priv. Note that mac802111 drivers should
29769a95371aSLuis R. Rodriguez  * not use wiphy_priv() to try to get their private driver structure as this
29779a95371aSLuis R. Rodriguez  * is already used internally by mac80211.
29780ae997dcSYacine Belkadi  *
29790ae997dcSYacine Belkadi  * Return: The mac80211 driver hw struct of @wiphy.
29809a95371aSLuis R. Rodriguez  */
29819a95371aSLuis R. Rodriguez struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
29829a95371aSLuis R. Rodriguez 
29839a95371aSLuis R. Rodriguez /**
298475a5f0ccSJohannes Berg  * SET_IEEE80211_DEV - set device for 802.11 hardware
298575a5f0ccSJohannes Berg  *
298675a5f0ccSJohannes Berg  * @hw: the &struct ieee80211_hw to set the device for
298775a5f0ccSJohannes Berg  * @dev: the &struct device of this 802.11 device
298875a5f0ccSJohannes Berg  */
SET_IEEE80211_DEV(struct ieee80211_hw * hw,struct device * dev)2989f0706e82SJiri Benc static inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
2990f0706e82SJiri Benc {
2991f0706e82SJiri Benc 	set_wiphy_dev(hw->wiphy, dev);
2992f0706e82SJiri Benc }
2993f0706e82SJiri Benc 
299475a5f0ccSJohannes Berg /**
2995e37d4dffSBob Copeland  * SET_IEEE80211_PERM_ADDR - set the permanent MAC address for 802.11 hardware
299675a5f0ccSJohannes Berg  *
299775a5f0ccSJohannes Berg  * @hw: the &struct ieee80211_hw to set the MAC address for
299875a5f0ccSJohannes Berg  * @addr: the address to set
299975a5f0ccSJohannes Berg  */
SET_IEEE80211_PERM_ADDR(struct ieee80211_hw * hw,const u8 * addr)3000538dc904SBjorn Andersson static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, const u8 *addr)
3001f0706e82SJiri Benc {
3002f0706e82SJiri Benc 	memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
3003f0706e82SJiri Benc }
3004f0706e82SJiri Benc 
30052e92e6f2SJohannes Berg static inline struct ieee80211_rate *
ieee80211_get_tx_rate(const struct ieee80211_hw * hw,const struct ieee80211_tx_info * c)30062e92e6f2SJohannes Berg ieee80211_get_tx_rate(const struct ieee80211_hw *hw,
3007e039fa4aSJohannes Berg 		      const struct ieee80211_tx_info *c)
30082e92e6f2SJohannes Berg {
3009aa331df0SLarry Finger 	if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
30102e92e6f2SJohannes Berg 		return NULL;
3011e6a9854bSJohannes Berg 	return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
30122e92e6f2SJohannes Berg }
30132e92e6f2SJohannes Berg 
30142e92e6f2SJohannes Berg static inline struct ieee80211_rate *
ieee80211_get_rts_cts_rate(const struct ieee80211_hw * hw,const struct ieee80211_tx_info * c)30152e92e6f2SJohannes Berg ieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
3016e039fa4aSJohannes Berg 			   const struct ieee80211_tx_info *c)
30172e92e6f2SJohannes Berg {
3018e039fa4aSJohannes Berg 	if (c->control.rts_cts_rate_idx < 0)
30192e92e6f2SJohannes Berg 		return NULL;
3020e039fa4aSJohannes Berg 	return &hw->wiphy->bands[c->band]->bitrates[c->control.rts_cts_rate_idx];
30212e92e6f2SJohannes Berg }
30222e92e6f2SJohannes Berg 
30232e92e6f2SJohannes Berg static inline struct ieee80211_rate *
ieee80211_get_alt_retry_rate(const struct ieee80211_hw * hw,const struct ieee80211_tx_info * c,int idx)30242e92e6f2SJohannes Berg ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
3025870abdf6SFelix Fietkau 			     const struct ieee80211_tx_info *c, int idx)
30262e92e6f2SJohannes Berg {
3027e6a9854bSJohannes Berg 	if (c->control.rates[idx + 1].idx < 0)
30282e92e6f2SJohannes Berg 		return NULL;
3029e6a9854bSJohannes Berg 	return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];
30302e92e6f2SJohannes Berg }
30312e92e6f2SJohannes Berg 
303275a5f0ccSJohannes Berg /**
30336096de7fSJohannes Berg  * ieee80211_free_txskb - free TX skb
30346096de7fSJohannes Berg  * @hw: the hardware
30356096de7fSJohannes Berg  * @skb: the skb
30366096de7fSJohannes Berg  *
30373f2aef10SJoe Perches  * Free a transmit skb. Use this function when some failure
30386096de7fSJohannes Berg  * to transmit happened and thus status cannot be reported.
30396096de7fSJohannes Berg  */
30406096de7fSJohannes Berg void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
30416096de7fSJohannes Berg 
30426096de7fSJohannes Berg /**
304324b5898aSPing-Ke Shih  * ieee80211_purge_tx_queue - purge TX skb queue
304424b5898aSPing-Ke Shih  * @hw: the hardware
304524b5898aSPing-Ke Shih  * @skbs: the skbs
304624b5898aSPing-Ke Shih  *
304724b5898aSPing-Ke Shih  * Free a set of transmit skbs. Use this function when device is going to stop
304824b5898aSPing-Ke Shih  * but some transmit skbs without TX status are still queued.
304924b5898aSPing-Ke Shih  * This function does not take the list lock and the caller must hold the
305024b5898aSPing-Ke Shih  * relevant locks to use it.
305124b5898aSPing-Ke Shih  */
305224b5898aSPing-Ke Shih void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
305324b5898aSPing-Ke Shih 			      struct sk_buff_head *skbs);
305424b5898aSPing-Ke Shih 
305524b5898aSPing-Ke Shih /**
305675a5f0ccSJohannes Berg  * DOC: Hardware crypto acceleration
30574150c572SJohannes Berg  *
305875a5f0ccSJohannes Berg  * mac80211 is capable of taking advantage of many hardware
305975a5f0ccSJohannes Berg  * acceleration designs for encryption and decryption operations.
306075a5f0ccSJohannes Berg  *
306175a5f0ccSJohannes Berg  * The set_key() callback in the &struct ieee80211_ops for a given
306275a5f0ccSJohannes Berg  * device is called to enable hardware acceleration of encryption and
3063dc822b5dSJohannes Berg  * decryption. The callback takes a @sta parameter that will be NULL
3064dc822b5dSJohannes Berg  * for default keys or keys used for transmission only, or point to
3065dc822b5dSJohannes Berg  * the station information for the peer for individual keys.
306675a5f0ccSJohannes Berg  * Multiple transmission keys with the same key index may be used when
306775a5f0ccSJohannes Berg  * VLANs are configured for an access point.
306875a5f0ccSJohannes Berg  *
306975a5f0ccSJohannes Berg  * When transmitting, the TX control data will use the @hw_key_idx
307075a5f0ccSJohannes Berg  * selected by the driver by modifying the &struct ieee80211_key_conf
307175a5f0ccSJohannes Berg  * pointed to by the @key parameter to the set_key() function.
307275a5f0ccSJohannes Berg  *
307375a5f0ccSJohannes Berg  * The set_key() call for the %SET_KEY command should return 0 if
307475a5f0ccSJohannes Berg  * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be
307575a5f0ccSJohannes Berg  * added; if you return 0 then hw_key_idx must be assigned to the
307675a5f0ccSJohannes Berg  * hardware key index, you are free to use the full u8 range.
307775a5f0ccSJohannes Berg  *
3078fa7e1fbcSJohannes Berg  * Note that in the case that the @IEEE80211_HW_SW_CRYPTO_CONTROL flag is
3079fa7e1fbcSJohannes Berg  * set, mac80211 will not automatically fall back to software crypto if
3080fa7e1fbcSJohannes Berg  * enabling hardware crypto failed. The set_key() call may also return the
3081fa7e1fbcSJohannes Berg  * value 1 to permit this specific key/algorithm to be done in software.
3082fa7e1fbcSJohannes Berg  *
308375a5f0ccSJohannes Berg  * When the cmd is %DISABLE_KEY then it must succeed.
308475a5f0ccSJohannes Berg  *
308575a5f0ccSJohannes Berg  * Note that it is permissible to not decrypt a frame even if a key
308675a5f0ccSJohannes Berg  * for it has been uploaded to hardware, the stack will not make any
308775a5f0ccSJohannes Berg  * decision based on whether a key has been uploaded or not but rather
308875a5f0ccSJohannes Berg  * based on the receive flags.
308975a5f0ccSJohannes Berg  *
309075a5f0ccSJohannes Berg  * The &struct ieee80211_key_conf structure pointed to by the @key
309175a5f0ccSJohannes Berg  * parameter is guaranteed to be valid until another call to set_key()
309275a5f0ccSJohannes Berg  * removes it, but it can only be used as a cookie to differentiate
309375a5f0ccSJohannes Berg  * keys.
30949ae4fda3SEmmanuel Grumbach  *
30959ae4fda3SEmmanuel Grumbach  * In TKIP some HW need to be provided a phase 1 key, for RX decryption
30969ae4fda3SEmmanuel Grumbach  * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key
30979ae4fda3SEmmanuel Grumbach  * handler.
30989ae4fda3SEmmanuel Grumbach  * The update_tkip_key() call updates the driver with the new phase 1 key.
30999ae4fda3SEmmanuel Grumbach  * This happens every time the iv16 wraps around (every 65536 packets). The
31009ae4fda3SEmmanuel Grumbach  * set_key() call will happen only once for each key (unless the AP did
31019ae4fda3SEmmanuel Grumbach  * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
3102e37d4dffSBob Copeland  * provided by update_tkip_key only. The trigger that makes mac80211 call this
31039ae4fda3SEmmanuel Grumbach  * handler is software decryption with wrap around of iv16.
3104de5fad81SYoni Divinsky  *
3105de5fad81SYoni Divinsky  * The set_default_unicast_key() call updates the default WEP key index
3106de5fad81SYoni Divinsky  * configured to the hardware for WEP encryption type. This is required
3107de5fad81SYoni Divinsky  * for devices that support offload of data packets (e.g. ARP responses).
310862872a9bSAlexander Wetzel  *
310962872a9bSAlexander Wetzel  * Mac80211 drivers should set the @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 flag
311066b239d2SRandy Dunlap  * when they are able to replace in-use PTK keys according to the following
311162872a9bSAlexander Wetzel  * requirements:
311233092acaSAlexander Wetzel  * 1) They do not hand over frames decrypted with the old key to mac80211
311333092acaSAlexander Wetzel       once the call to set_key() with command %DISABLE_KEY has been completed,
311462872a9bSAlexander Wetzel    2) either drop or continue to use the old key for any outgoing frames queued
311562872a9bSAlexander Wetzel       at the time of the key deletion (including re-transmits),
311662872a9bSAlexander Wetzel    3) never send out a frame queued prior to the set_key() %SET_KEY command
311733092acaSAlexander Wetzel       encrypted with the new key when also needing
311833092acaSAlexander Wetzel       @IEEE80211_KEY_FLAG_GENERATE_IV and
311962872a9bSAlexander Wetzel    4) never send out a frame unencrypted when it should be encrypted.
312062872a9bSAlexander Wetzel    Mac80211 will not queue any new frames for a deleted key to the driver.
31214150c572SJohannes Berg  */
31224150c572SJohannes Berg 
312375a5f0ccSJohannes Berg /**
31244be8c387SJohannes Berg  * DOC: Powersave support
31254be8c387SJohannes Berg  *
31264be8c387SJohannes Berg  * mac80211 has support for various powersave implementations.
31274be8c387SJohannes Berg  *
3128c99445b1SKalle Valo  * First, it can support hardware that handles all powersaving by itself,
3129c99445b1SKalle Valo  * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware
3130c99445b1SKalle Valo  * flag. In that case, it will be told about the desired powersave mode
3131c99445b1SKalle Valo  * with the %IEEE80211_CONF_PS flag depending on the association status.
3132c99445b1SKalle Valo  * The hardware must take care of sending nullfunc frames when necessary,
3133c99445b1SKalle Valo  * i.e. when entering and leaving powersave mode. The hardware is required
3134c99445b1SKalle Valo  * to look at the AID in beacons and signal to the AP that it woke up when
3135c99445b1SKalle Valo  * it finds traffic directed to it.
31364be8c387SJohannes Berg  *
3137c99445b1SKalle Valo  * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in
3138c99445b1SKalle Valo  * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused
3139c99445b1SKalle Valo  * with hardware wakeup and sleep states. Driver is responsible for waking
31402738bd68SBob Copeland  * up the hardware before issuing commands to the hardware and putting it
31412738bd68SBob Copeland  * back to sleep at appropriate times.
3142c99445b1SKalle Valo  *
3143c99445b1SKalle Valo  * When PS is enabled, hardware needs to wakeup for beacons and receive the
3144c99445b1SKalle Valo  * buffered multicast/broadcast frames after the beacon. Also it must be
3145c99445b1SKalle Valo  * possible to send frames and receive the acknowledment frame.
31464be8c387SJohannes Berg  *
31474be8c387SJohannes Berg  * Other hardware designs cannot send nullfunc frames by themselves and also
31484be8c387SJohannes Berg  * need software support for parsing the TIM bitmap. This is also supported
31494be8c387SJohannes Berg  * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
31504be8c387SJohannes Berg  * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
3151955394c9SJohannes Berg  * required to pass up beacons. The hardware is still required to handle
3152955394c9SJohannes Berg  * waking up for multicast traffic; if it cannot the driver must handle that
3153c99445b1SKalle Valo  * as best as it can, mac80211 is too slow to do that.
31544be8c387SJohannes Berg  *
3155c99445b1SKalle Valo  * Dynamic powersave is an extension to normal powersave in which the
3156c99445b1SKalle Valo  * hardware stays awake for a user-specified period of time after sending a
3157c99445b1SKalle Valo  * frame so that reply frames need not be buffered and therefore delayed to
3158c99445b1SKalle Valo  * the next wakeup. It's compromise of getting good enough latency when
3159c99445b1SKalle Valo  * there's data traffic and still saving significantly power in idle
3160c99445b1SKalle Valo  * periods.
3161c99445b1SKalle Valo  *
31622738bd68SBob Copeland  * Dynamic powersave is simply supported by mac80211 enabling and disabling
3163c99445b1SKalle Valo  * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS
3164c99445b1SKalle Valo  * flag and mac80211 will handle everything automatically. Additionally,
3165c99445b1SKalle Valo  * hardware having support for the dynamic PS feature may set the
3166c99445b1SKalle Valo  * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support
3167c99445b1SKalle Valo  * dynamic PS mode itself. The driver needs to look at the
3168c99445b1SKalle Valo  * @dynamic_ps_timeout hardware configuration value and use it that value
3169c99445b1SKalle Valo  * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable
3170c99445b1SKalle Valo  * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
3171c99445b1SKalle Valo  * enabled whenever user has enabled powersave.
3172c99445b1SKalle Valo  *
3173c99445b1SKalle Valo  * Driver informs U-APSD client support by enabling
3174848955ccSJohannes Berg  * %IEEE80211_VIF_SUPPORTS_UAPSD flag. The mode is configured through the
3175e227867fSMasanari Iida  * uapsd parameter in conf_tx() operation. Hardware needs to send the QoS
3176c99445b1SKalle Valo  * Nullfunc frames and stay awake until the service period has ended. To
3177c99445b1SKalle Valo  * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames
3178c99445b1SKalle Valo  * from that AC are transmitted with powersave enabled.
3179c99445b1SKalle Valo  *
3180c99445b1SKalle Valo  * Note: U-APSD client mode is not yet supported with
3181c99445b1SKalle Valo  * %IEEE80211_HW_PS_NULLFUNC_STACK.
31824be8c387SJohannes Berg  */
31834be8c387SJohannes Berg 
31844be8c387SJohannes Berg /**
318504de8381SKalle Valo  * DOC: Beacon filter support
318604de8381SKalle Valo  *
318704de8381SKalle Valo  * Some hardware have beacon filter support to reduce host cpu wakeups
318842b2aa86SJustin P. Mattock  * which will reduce system power consumption. It usually works so that
318904de8381SKalle Valo  * the firmware creates a checksum of the beacon but omits all constantly
319004de8381SKalle Valo  * changing elements (TSF, TIM etc). Whenever the checksum changes the
319104de8381SKalle Valo  * beacon is forwarded to the host, otherwise it will be just dropped. That
319204de8381SKalle Valo  * way the host will only receive beacons where some relevant information
319304de8381SKalle Valo  * (for example ERP protection or WMM settings) have changed.
319404de8381SKalle Valo  *
3195c1288b12SJohannes Berg  * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER
3196c1288b12SJohannes Berg  * interface capability. The driver needs to enable beacon filter support
3197955394c9SJohannes Berg  * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
3198955394c9SJohannes Berg  * power save is enabled, the stack will not check for beacon loss and the
3199955394c9SJohannes Berg  * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
3200955394c9SJohannes Berg  *
3201955394c9SJohannes Berg  * The time (or number of beacons missed) until the firmware notifies the
3202955394c9SJohannes Berg  * driver of a beacon loss event (which in turn causes the driver to call
3203955394c9SJohannes Berg  * ieee80211_beacon_loss()) should be configurable and will be controlled
3204955394c9SJohannes Berg  * by mac80211 and the roaming algorithm in the future.
3205955394c9SJohannes Berg  *
3206955394c9SJohannes Berg  * Since there may be constantly changing information elements that nothing
3207955394c9SJohannes Berg  * in the software stack cares about, we will, in the future, have mac80211
3208955394c9SJohannes Berg  * tell the driver which information elements are interesting in the sense
3209955394c9SJohannes Berg  * that we want to see changes in them. This will include
3210b4f7f4adSJani Nikula  *
3211955394c9SJohannes Berg  *  - a list of information element IDs
3212955394c9SJohannes Berg  *  - a list of OUIs for the vendor information element
3213955394c9SJohannes Berg  *
3214955394c9SJohannes Berg  * Ideally, the hardware would filter out any beacons without changes in the
3215955394c9SJohannes Berg  * requested elements, but if it cannot support that it may, at the expense
3216955394c9SJohannes Berg  * of some efficiency, filter out only a subset. For example, if the device
3217955394c9SJohannes Berg  * doesn't support checking for OUIs it should pass up all changes in all
3218955394c9SJohannes Berg  * vendor information elements.
3219955394c9SJohannes Berg  *
3220955394c9SJohannes Berg  * Note that change, for the sake of simplification, also includes information
3221955394c9SJohannes Berg  * elements appearing or disappearing from the beacon.
3222955394c9SJohannes Berg  *
3223955394c9SJohannes Berg  * Some hardware supports an "ignore list" instead, just make sure nothing
3224955394c9SJohannes Berg  * that was requested is on the ignore list, and include commonly changing
3225955394c9SJohannes Berg  * information element IDs in the ignore list, for example 11 (BSS load) and
3226955394c9SJohannes Berg  * the various vendor-assigned IEs with unknown contents (128, 129, 133-136,
3227955394c9SJohannes Berg  * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility
3228955394c9SJohannes Berg  * it could also include some currently unused IDs.
3229955394c9SJohannes Berg  *
3230955394c9SJohannes Berg  *
3231955394c9SJohannes Berg  * In addition to these capabilities, hardware should support notifying the
3232955394c9SJohannes Berg  * host of changes in the beacon RSSI. This is relevant to implement roaming
3233955394c9SJohannes Berg  * when no traffic is flowing (when traffic is flowing we see the RSSI of
3234955394c9SJohannes Berg  * the received data packets). This can consist in notifying the host when
3235955394c9SJohannes Berg  * the RSSI changes significantly or when it drops below or rises above
3236955394c9SJohannes Berg  * configurable thresholds. In the future these thresholds will also be
3237955394c9SJohannes Berg  * configured by mac80211 (which gets them from userspace) to implement
3238955394c9SJohannes Berg  * them as the roaming algorithm requires.
3239955394c9SJohannes Berg  *
3240955394c9SJohannes Berg  * If the hardware cannot implement this, the driver should ask it to
3241955394c9SJohannes Berg  * periodically pass beacon frames to the host so that software can do the
3242955394c9SJohannes Berg  * signal strength threshold checking.
324304de8381SKalle Valo  */
324404de8381SKalle Valo 
324504de8381SKalle Valo /**
32460f78231bSJohannes Berg  * DOC: Spatial multiplexing power save
32470f78231bSJohannes Berg  *
32480f78231bSJohannes Berg  * SMPS (Spatial multiplexing power save) is a mechanism to conserve
32490f78231bSJohannes Berg  * power in an 802.11n implementation. For details on the mechanism
32500f78231bSJohannes Berg  * and rationale, please refer to 802.11 (as amended by 802.11n-2009)
32510f78231bSJohannes Berg  * "11.2.3 SM power save".
32520f78231bSJohannes Berg  *
32530f78231bSJohannes Berg  * The mac80211 implementation is capable of sending action frames
32540f78231bSJohannes Berg  * to update the AP about the station's SMPS mode, and will instruct
32550f78231bSJohannes Berg  * the driver to enter the specific mode. It will also announce the
32560f78231bSJohannes Berg  * requested SMPS mode during the association handshake. Hardware
32570f78231bSJohannes Berg  * support for this feature is required, and can be indicated by
32580f78231bSJohannes Berg  * hardware flags.
32590f78231bSJohannes Berg  *
32600f78231bSJohannes Berg  * The default mode will be "automatic", which nl80211/cfg80211
32610f78231bSJohannes Berg  * defines to be dynamic SMPS in (regular) powersave, and SMPS
32620f78231bSJohannes Berg  * turned off otherwise.
32630f78231bSJohannes Berg  *
32640f78231bSJohannes Berg  * To support this feature, the driver must set the appropriate
32650f78231bSJohannes Berg  * hardware support flags, and handle the SMPS flag to the config()
32660f78231bSJohannes Berg  * operation. It will then with this mechanism be instructed to
32670f78231bSJohannes Berg  * enter the requested SMPS mode while associated to an HT AP.
32680f78231bSJohannes Berg  */
32690f78231bSJohannes Berg 
32700f78231bSJohannes Berg /**
327175a5f0ccSJohannes Berg  * DOC: Frame filtering
327275a5f0ccSJohannes Berg  *
327375a5f0ccSJohannes Berg  * mac80211 requires to see many management frames for proper
327475a5f0ccSJohannes Berg  * operation, and users may want to see many more frames when
327575a5f0ccSJohannes Berg  * in monitor mode. However, for best CPU usage and power consumption,
327675a5f0ccSJohannes Berg  * having as few frames as possible percolate through the stack is
327775a5f0ccSJohannes Berg  * desirable. Hence, the hardware should filter as much as possible.
327875a5f0ccSJohannes Berg  *
327975a5f0ccSJohannes Berg  * To achieve this, mac80211 uses filter flags (see below) to tell
328075a5f0ccSJohannes Berg  * the driver's configure_filter() function which frames should be
328175a5f0ccSJohannes Berg  * passed to mac80211 and which should be filtered out.
328275a5f0ccSJohannes Berg  *
32833ac64beeSJohannes Berg  * Before configure_filter() is invoked, the prepare_multicast()
32843ac64beeSJohannes Berg  * callback is invoked with the parameters @mc_count and @mc_list
32853ac64beeSJohannes Berg  * for the combined multicast address list of all virtual interfaces.
32863ac64beeSJohannes Berg  * It's use is optional, and it returns a u64 that is passed to
32873ac64beeSJohannes Berg  * configure_filter(). Additionally, configure_filter() has the
32883ac64beeSJohannes Berg  * arguments @changed_flags telling which flags were changed and
32893ac64beeSJohannes Berg  * @total_flags with the new flag states.
329075a5f0ccSJohannes Berg  *
329175a5f0ccSJohannes Berg  * If your device has no multicast address filters your driver will
329275a5f0ccSJohannes Berg  * need to check both the %FIF_ALLMULTI flag and the @mc_count
329375a5f0ccSJohannes Berg  * parameter to see whether multicast frames should be accepted
329475a5f0ccSJohannes Berg  * or dropped.
329575a5f0ccSJohannes Berg  *
3296d0f5afbeSMichael Buesch  * All unsupported flags in @total_flags must be cleared.
3297d0f5afbeSMichael Buesch  * Hardware does not support a flag if it is incapable of _passing_
3298d0f5afbeSMichael Buesch  * the frame to the stack. Otherwise the driver must ignore
3299d0f5afbeSMichael Buesch  * the flag, but not clear it.
3300d0f5afbeSMichael Buesch  * You must _only_ clear the flag (announce no support for the
3301d0f5afbeSMichael Buesch  * flag to mac80211) if you are not able to pass the packet type
3302d0f5afbeSMichael Buesch  * to the stack (so the hardware always filters it).
3303d0f5afbeSMichael Buesch  * So for example, you should clear @FIF_CONTROL, if your hardware
3304d0f5afbeSMichael Buesch  * always filters control frames. If your hardware always passes
3305d0f5afbeSMichael Buesch  * control frames to the kernel and is incapable of filtering them,
3306d0f5afbeSMichael Buesch  * you do _not_ clear the @FIF_CONTROL flag.
3307d0f5afbeSMichael Buesch  * This rule applies to all other FIF flags as well.
330875a5f0ccSJohannes Berg  */
330975a5f0ccSJohannes Berg 
331075a5f0ccSJohannes Berg /**
33114b801bc9SJohannes Berg  * DOC: AP support for powersaving clients
33124b801bc9SJohannes Berg  *
33134b801bc9SJohannes Berg  * In order to implement AP and P2P GO modes, mac80211 has support for
33144b801bc9SJohannes Berg  * client powersaving, both "legacy" PS (PS-Poll/null data) and uAPSD.
33154b801bc9SJohannes Berg  * There currently is no support for sAPSD.
33164b801bc9SJohannes Berg  *
33174b801bc9SJohannes Berg  * There is one assumption that mac80211 makes, namely that a client
33184b801bc9SJohannes Berg  * will not poll with PS-Poll and trigger with uAPSD at the same time.
33194b801bc9SJohannes Berg  * Both are supported, and both can be used by the same client, but
33204b801bc9SJohannes Berg  * they can't be used concurrently by the same client. This simplifies
33214b801bc9SJohannes Berg  * the driver code.
33224b801bc9SJohannes Berg  *
33234b801bc9SJohannes Berg  * The first thing to keep in mind is that there is a flag for complete
33244b801bc9SJohannes Berg  * driver implementation: %IEEE80211_HW_AP_LINK_PS. If this flag is set,
33254b801bc9SJohannes Berg  * mac80211 expects the driver to handle most of the state machine for
33264b801bc9SJohannes Berg  * powersaving clients and will ignore the PM bit in incoming frames.
33274b801bc9SJohannes Berg  * Drivers then use ieee80211_sta_ps_transition() to inform mac80211 of
33284b801bc9SJohannes Berg  * stations' powersave transitions. In this mode, mac80211 also doesn't
33294b801bc9SJohannes Berg  * handle PS-Poll/uAPSD.
33304b801bc9SJohannes Berg  *
33314b801bc9SJohannes Berg  * In the mode without %IEEE80211_HW_AP_LINK_PS, mac80211 will check the
33324b801bc9SJohannes Berg  * PM bit in incoming frames for client powersave transitions. When a
33334b801bc9SJohannes Berg  * station goes to sleep, we will stop transmitting to it. There is,
33344b801bc9SJohannes Berg  * however, a race condition: a station might go to sleep while there is
33354b801bc9SJohannes Berg  * data buffered on hardware queues. If the device has support for this
33364b801bc9SJohannes Berg  * it will reject frames, and the driver should give the frames back to
33374b801bc9SJohannes Berg  * mac80211 with the %IEEE80211_TX_STAT_TX_FILTERED flag set which will
33384b801bc9SJohannes Berg  * cause mac80211 to retry the frame when the station wakes up. The
33394b801bc9SJohannes Berg  * driver is also notified of powersave transitions by calling its
33404b801bc9SJohannes Berg  * @sta_notify callback.
33414b801bc9SJohannes Berg  *
33424b801bc9SJohannes Berg  * When the station is asleep, it has three choices: it can wake up,
33434b801bc9SJohannes Berg  * it can PS-Poll, or it can possibly start a uAPSD service period.
33444b801bc9SJohannes Berg  * Waking up is implemented by simply transmitting all buffered (and
33454b801bc9SJohannes Berg  * filtered) frames to the station. This is the easiest case. When
33464b801bc9SJohannes Berg  * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
33474b801bc9SJohannes Berg  * will inform the driver of this with the @allow_buffered_frames
33484b801bc9SJohannes Berg  * callback; this callback is optional. mac80211 will then transmit
334902f2f1a9SJohannes Berg  * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
33504b801bc9SJohannes Berg  * on each frame. The last frame in the service period (or the only
33514b801bc9SJohannes Berg  * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
33524b801bc9SJohannes Berg  * indicate that it ends the service period; as this frame must have
33534b801bc9SJohannes Berg  * TX status report it also sets %IEEE80211_TX_CTL_REQ_TX_STATUS.
33544b801bc9SJohannes Berg  * When TX status is reported for this frame, the service period is
33554b801bc9SJohannes Berg  * marked has having ended and a new one can be started by the peer.
33564b801bc9SJohannes Berg  *
335702f2f1a9SJohannes Berg  * Additionally, non-bufferable MMPDUs can also be transmitted by
335802f2f1a9SJohannes Berg  * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
335902f2f1a9SJohannes Berg  *
33604b801bc9SJohannes Berg  * Another race condition can happen on some devices like iwlwifi
33614b801bc9SJohannes Berg  * when there are frames queued for the station and it wakes up
33624b801bc9SJohannes Berg  * or polls; the frames that are already queued could end up being
33634b801bc9SJohannes Berg  * transmitted first instead, causing reordering and/or wrong
33644b801bc9SJohannes Berg  * processing of the EOSP. The cause is that allowing frames to be
33654b801bc9SJohannes Berg  * transmitted to a certain station is out-of-band communication to
33664b801bc9SJohannes Berg  * the device. To allow this problem to be solved, the driver can
33674b801bc9SJohannes Berg  * call ieee80211_sta_block_awake() if frames are buffered when it
33684b801bc9SJohannes Berg  * is notified that the station went to sleep. When all these frames
33694b801bc9SJohannes Berg  * have been filtered (see above), it must call the function again
33704b801bc9SJohannes Berg  * to indicate that the station is no longer blocked.
33714b801bc9SJohannes Berg  *
33724b801bc9SJohannes Berg  * If the driver buffers frames in the driver for aggregation in any
33734b801bc9SJohannes Berg  * way, it must use the ieee80211_sta_set_buffered() call when it is
33744b801bc9SJohannes Berg  * notified of the station going to sleep to inform mac80211 of any
33754b801bc9SJohannes Berg  * TIDs that have frames buffered. Note that when a station wakes up
33764b801bc9SJohannes Berg  * this information is reset (hence the requirement to call it when
33774b801bc9SJohannes Berg  * informed of the station going to sleep). Then, when a service
33784b801bc9SJohannes Berg  * period starts for any reason, @release_buffered_frames is called
33794b801bc9SJohannes Berg  * with the number of frames to be released and which TIDs they are
33804b801bc9SJohannes Berg  * to come from. In this case, the driver is responsible for setting
33814b801bc9SJohannes Berg  * the EOSP (for uAPSD) and MORE_DATA bits in the released frames,
3382e227867fSMasanari Iida  * to help the @more_data parameter is passed to tell the driver if
33834b801bc9SJohannes Berg  * there is more data on other TIDs -- the TIDs to release frames
33844b801bc9SJohannes Berg  * from are ignored since mac80211 doesn't know how many frames the
33854b801bc9SJohannes Berg  * buffers for those TIDs contain.
33864b801bc9SJohannes Berg  *
33874b801bc9SJohannes Berg  * If the driver also implement GO mode, where absence periods may
33884b801bc9SJohannes Berg  * shorten service periods (or abort PS-Poll responses), it must
33894b801bc9SJohannes Berg  * filter those response frames except in the case of frames that
33904b801bc9SJohannes Berg  * are buffered in the driver -- those must remain buffered to avoid
33914b801bc9SJohannes Berg  * reordering. Because it is possible that no frames are released
3392e943789eSJohannes Berg  * in this case, the driver must call ieee80211_sta_eosp()
33934b801bc9SJohannes Berg  * to indicate to mac80211 that the service period ended anyway.
33944b801bc9SJohannes Berg  *
33954b801bc9SJohannes Berg  * Finally, if frames from multiple TIDs are released from mac80211
33964b801bc9SJohannes Berg  * but the driver might reorder them, it must clear & set the flags
33974b801bc9SJohannes Berg  * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP)
33984b801bc9SJohannes Berg  * and also take care of the EOSP and MORE_DATA bits in the frame.
3399e943789eSJohannes Berg  * The driver may also use ieee80211_sta_eosp() in this case.
3400b77cf4f8SJohannes Berg  *
3401b77cf4f8SJohannes Berg  * Note that if the driver ever buffers frames other than QoS-data
3402b77cf4f8SJohannes Berg  * frames, it must take care to never send a non-QoS-data frame as
3403b77cf4f8SJohannes Berg  * the last frame in a service period, adding a QoS-nulldata frame
3404b77cf4f8SJohannes Berg  * after a non-QoS-data frame if needed.
34054b801bc9SJohannes Berg  */
34064b801bc9SJohannes Berg 
34074b801bc9SJohannes Berg /**
34083a25a8c8SJohannes Berg  * DOC: HW queue control
34093a25a8c8SJohannes Berg  *
34103a25a8c8SJohannes Berg  * Before HW queue control was introduced, mac80211 only had a single static
34113a25a8c8SJohannes Berg  * assignment of per-interface AC software queues to hardware queues. This
34123a25a8c8SJohannes Berg  * was problematic for a few reasons:
34133a25a8c8SJohannes Berg  * 1) off-channel transmissions might get stuck behind other frames
34143a25a8c8SJohannes Berg  * 2) multiple virtual interfaces couldn't be handled correctly
34153a25a8c8SJohannes Berg  * 3) after-DTIM frames could get stuck behind other frames
34163a25a8c8SJohannes Berg  *
34173a25a8c8SJohannes Berg  * To solve this, hardware typically uses multiple different queues for all
34183a25a8c8SJohannes Berg  * the different usages, and this needs to be propagated into mac80211 so it
34193a25a8c8SJohannes Berg  * won't have the same problem with the software queues.
34203a25a8c8SJohannes Berg  *
34213a25a8c8SJohannes Berg  * Therefore, mac80211 now offers the %IEEE80211_HW_QUEUE_CONTROL capability
34223a25a8c8SJohannes Berg  * flag that tells it that the driver implements its own queue control. To do
34233a25a8c8SJohannes Berg  * so, the driver will set up the various queues in each &struct ieee80211_vif
34243a25a8c8SJohannes Berg  * and the offchannel queue in &struct ieee80211_hw. In response, mac80211 will
34253a25a8c8SJohannes Berg  * use those queue IDs in the hw_queue field of &struct ieee80211_tx_info and
34263a25a8c8SJohannes Berg  * if necessary will queue the frame on the right software queue that mirrors
34273a25a8c8SJohannes Berg  * the hardware queue.
34283a25a8c8SJohannes Berg  * Additionally, the driver has to then use these HW queue IDs for the queue
34293a25a8c8SJohannes Berg  * management functions (ieee80211_stop_queue() et al.)
34303a25a8c8SJohannes Berg  *
34313a25a8c8SJohannes Berg  * The driver is free to set up the queue mappings as needed, multiple virtual
34323a25a8c8SJohannes Berg  * interfaces may map to the same hardware queues if needed. The setup has to
34333a25a8c8SJohannes Berg  * happen during add_interface or change_interface callbacks. For example, a
34343a25a8c8SJohannes Berg  * driver supporting station+station and station+AP modes might decide to have
34353a25a8c8SJohannes Berg  * 10 hardware queues to handle different scenarios:
34363a25a8c8SJohannes Berg  *
34373a25a8c8SJohannes Berg  * 4 AC HW queues for 1st vif: 0, 1, 2, 3
34383a25a8c8SJohannes Berg  * 4 AC HW queues for 2nd vif: 4, 5, 6, 7
34393a25a8c8SJohannes Berg  * after-DTIM queue for AP:   8
34403a25a8c8SJohannes Berg  * off-channel queue:         9
34413a25a8c8SJohannes Berg  *
34423a25a8c8SJohannes Berg  * It would then set up the hardware like this:
34433a25a8c8SJohannes Berg  *   hw.offchannel_tx_hw_queue = 9
34443a25a8c8SJohannes Berg  *
34453a25a8c8SJohannes Berg  * and the first virtual interface that is added as follows:
34463a25a8c8SJohannes Berg  *   vif.hw_queue[IEEE80211_AC_VO] = 0
34473a25a8c8SJohannes Berg  *   vif.hw_queue[IEEE80211_AC_VI] = 1
34483a25a8c8SJohannes Berg  *   vif.hw_queue[IEEE80211_AC_BE] = 2
34493a25a8c8SJohannes Berg  *   vif.hw_queue[IEEE80211_AC_BK] = 3
34503a25a8c8SJohannes Berg  *   vif.cab_queue = 8 // if AP mode, otherwise %IEEE80211_INVAL_HW_QUEUE
34513a25a8c8SJohannes Berg  * and the second virtual interface with 4-7.
34523a25a8c8SJohannes Berg  *
34533a25a8c8SJohannes Berg  * If queue 6 gets full, for example, mac80211 would only stop the second
34543a25a8c8SJohannes Berg  * virtual interface's BE queue since virtual interface queues are per AC.
34553a25a8c8SJohannes Berg  *
34563a25a8c8SJohannes Berg  * Note that the vif.cab_queue value should be set to %IEEE80211_INVAL_HW_QUEUE
34573a25a8c8SJohannes Berg  * whenever the queue is not used (i.e. the interface is not in AP mode) if the
34583a25a8c8SJohannes Berg  * queue could potentially be shared since mac80211 will look at cab_queue when
34593a25a8c8SJohannes Berg  * a queue is stopped/woken even if the interface is not in AP mode.
34603a25a8c8SJohannes Berg  */
34613a25a8c8SJohannes Berg 
34623a25a8c8SJohannes Berg /**
346375a5f0ccSJohannes Berg  * enum ieee80211_filter_flags - hardware filter flags
346475a5f0ccSJohannes Berg  *
346575a5f0ccSJohannes Berg  * These flags determine what the filter in hardware should be
346675a5f0ccSJohannes Berg  * programmed to let through and what should not be passed to the
346775a5f0ccSJohannes Berg  * stack. It is always safe to pass more frames than requested,
346875a5f0ccSJohannes Berg  * but this has negative impact on power consumption.
346975a5f0ccSJohannes Berg  *
347075a5f0ccSJohannes Berg  * @FIF_ALLMULTI: pass all multicast frames, this is used if requested
347175a5f0ccSJohannes Berg  *	by the user or if the hardware is not capable of filtering by
347275a5f0ccSJohannes Berg  *	multicast address.
347375a5f0ccSJohannes Berg  *
347475a5f0ccSJohannes Berg  * @FIF_FCSFAIL: pass frames with failed FCS (but you need to set the
347575a5f0ccSJohannes Berg  *	%RX_FLAG_FAILED_FCS_CRC for them)
347675a5f0ccSJohannes Berg  *
347775a5f0ccSJohannes Berg  * @FIF_PLCPFAIL: pass frames with failed PLCP CRC (but you need to set
347875a5f0ccSJohannes Berg  *	the %RX_FLAG_FAILED_PLCP_CRC for them
347975a5f0ccSJohannes Berg  *
348075a5f0ccSJohannes Berg  * @FIF_BCN_PRBRESP_PROMISC: This flag is set during scanning to indicate
348175a5f0ccSJohannes Berg  *	to the hardware that it should not filter beacons or probe responses
348275a5f0ccSJohannes Berg  *	by BSSID. Filtering them can greatly reduce the amount of processing
348375a5f0ccSJohannes Berg  *	mac80211 needs to do and the amount of CPU wakeups, so you should
348475a5f0ccSJohannes Berg  *	honour this flag if possible.
348575a5f0ccSJohannes Berg  *
3486df140465SJohannes Berg  * @FIF_CONTROL: pass control frames (except for PS Poll) addressed to this
3487df140465SJohannes Berg  *	station
348875a5f0ccSJohannes Berg  *
348975a5f0ccSJohannes Berg  * @FIF_OTHER_BSS: pass frames destined to other BSSes
3490e3b90ca2SIgor Perminov  *
3491c2d3955bSJakub Kicinski  * @FIF_PSPOLL: pass PS Poll frames
34927be5086dSJohannes Berg  *
34937be5086dSJohannes Berg  * @FIF_PROBE_REQ: pass probe request frames
3494873b1cf6SJouni Malinen  *
3495873b1cf6SJouni Malinen  * @FIF_MCAST_ACTION: pass multicast Action frames
349675a5f0ccSJohannes Berg  */
349775a5f0ccSJohannes Berg enum ieee80211_filter_flags {
349875a5f0ccSJohannes Berg 	FIF_ALLMULTI		= 1<<1,
349975a5f0ccSJohannes Berg 	FIF_FCSFAIL		= 1<<2,
350075a5f0ccSJohannes Berg 	FIF_PLCPFAIL		= 1<<3,
350175a5f0ccSJohannes Berg 	FIF_BCN_PRBRESP_PROMISC	= 1<<4,
350275a5f0ccSJohannes Berg 	FIF_CONTROL		= 1<<5,
350375a5f0ccSJohannes Berg 	FIF_OTHER_BSS		= 1<<6,
3504e3b90ca2SIgor Perminov 	FIF_PSPOLL		= 1<<7,
35057be5086dSJohannes Berg 	FIF_PROBE_REQ		= 1<<8,
3506873b1cf6SJouni Malinen 	FIF_MCAST_ACTION	= 1<<9,
350775a5f0ccSJohannes Berg };
350875a5f0ccSJohannes Berg 
350975a5f0ccSJohannes Berg /**
35101b7d03acSRon Rindjunsky  * enum ieee80211_ampdu_mlme_action - A-MPDU actions
35111b7d03acSRon Rindjunsky  *
35121b7d03acSRon Rindjunsky  * These flags are used with the ampdu_action() callback in
35131b7d03acSRon Rindjunsky  * &struct ieee80211_ops to indicate which action is needed.
3514827d42c9SJohannes Berg  *
3515827d42c9SJohannes Berg  * Note that drivers MUST be able to deal with a TX aggregation
3516827d42c9SJohannes Berg  * session being stopped even before they OK'ed starting it by
35175d22c89bSJohannes Berg  * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer
3518827d42c9SJohannes Berg  * might receive the addBA frame and send a delBA right away!
3519827d42c9SJohannes Berg  *
352018b559d5SJohannes Berg  * @IEEE80211_AMPDU_RX_START: start RX aggregation
352118b559d5SJohannes Berg  * @IEEE80211_AMPDU_RX_STOP: stop RX aggregation
35222ce113deSJohannes Berg  * @IEEE80211_AMPDU_TX_START: start TX aggregation, the driver must either
35230c197f16SMordechay Goodstein  *	call ieee80211_start_tx_ba_cb_irqsafe() or
35240c197f16SMordechay Goodstein  *	call ieee80211_start_tx_ba_cb_irqsafe() with status
35250c197f16SMordechay Goodstein  *	%IEEE80211_AMPDU_TX_START_DELAY_ADDBA to delay addba after
35260c197f16SMordechay Goodstein  *	ieee80211_start_tx_ba_cb_irqsafe is called, or just return the special
35272ce113deSJohannes Berg  *	status %IEEE80211_AMPDU_TX_START_IMMEDIATE.
3528b1720231SJohannes Berg  * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
352918b559d5SJohannes Berg  * @IEEE80211_AMPDU_TX_STOP_CONT: stop TX aggregation but continue transmitting
353018b559d5SJohannes Berg  *	queued packets, now unaggregated. After all packets are transmitted the
353118b559d5SJohannes Berg  *	driver has to call ieee80211_stop_tx_ba_cb_irqsafe().
353218b559d5SJohannes Berg  * @IEEE80211_AMPDU_TX_STOP_FLUSH: stop TX aggregation and flush all packets,
353318b559d5SJohannes Berg  *	called when the station is removed. There's no need or reason to call
353418b559d5SJohannes Berg  *	ieee80211_stop_tx_ba_cb_irqsafe() in this case as mac80211 assumes the
353518b559d5SJohannes Berg  *	session is gone and removes the station.
353618b559d5SJohannes Berg  * @IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: called when TX aggregation is stopped
353718b559d5SJohannes Berg  *	but the driver hasn't called ieee80211_stop_tx_ba_cb_irqsafe() yet and
353818b559d5SJohannes Berg  *	now the connection is dropped and the station will be removed. Drivers
353918b559d5SJohannes Berg  *	should clean up and drop remaining packets when this is called.
35401b7d03acSRon Rindjunsky  */
35411b7d03acSRon Rindjunsky enum ieee80211_ampdu_mlme_action {
35421b7d03acSRon Rindjunsky 	IEEE80211_AMPDU_RX_START,
35431b7d03acSRon Rindjunsky 	IEEE80211_AMPDU_RX_STOP,
35440df3ef45SRon Rindjunsky 	IEEE80211_AMPDU_TX_START,
354518b559d5SJohannes Berg 	IEEE80211_AMPDU_TX_STOP_CONT,
354618b559d5SJohannes Berg 	IEEE80211_AMPDU_TX_STOP_FLUSH,
354718b559d5SJohannes Berg 	IEEE80211_AMPDU_TX_STOP_FLUSH_CONT,
3548b1720231SJohannes Berg 	IEEE80211_AMPDU_TX_OPERATIONAL,
35491b7d03acSRon Rindjunsky };
355075a5f0ccSJohannes Berg 
35512ce113deSJohannes Berg #define IEEE80211_AMPDU_TX_START_IMMEDIATE 1
35520c197f16SMordechay Goodstein #define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2
35532ce113deSJohannes Berg 
355475a5f0ccSJohannes Berg /**
355550ea05efSSara Sharon  * struct ieee80211_ampdu_params - AMPDU action parameters
355650ea05efSSara Sharon  *
355750ea05efSSara Sharon  * @action: the ampdu action, value from %ieee80211_ampdu_mlme_action.
355850ea05efSSara Sharon  * @sta: peer of this AMPDU session
355950ea05efSSara Sharon  * @tid: tid of the BA session
356050ea05efSSara Sharon  * @ssn: start sequence number of the session. TX/RX_STOP can pass 0. When
356150ea05efSSara Sharon  *	action is set to %IEEE80211_AMPDU_RX_START the driver passes back the
356250ea05efSSara Sharon  *	actual ssn value used to start the session and writes the value here.
356350ea05efSSara Sharon  * @buf_size: reorder buffer size  (number of subframes). Valid only when the
356450ea05efSSara Sharon  *	action is set to %IEEE80211_AMPDU_RX_START or
356550ea05efSSara Sharon  *	%IEEE80211_AMPDU_TX_OPERATIONAL
356650ea05efSSara Sharon  * @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU.
356750ea05efSSara Sharon  *	valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL
356850ea05efSSara Sharon  * @timeout: BA session timeout. Valid only when the action is set to
356950ea05efSSara Sharon  *	%IEEE80211_AMPDU_RX_START
357050ea05efSSara Sharon  */
357150ea05efSSara Sharon struct ieee80211_ampdu_params {
357250ea05efSSara Sharon 	enum ieee80211_ampdu_mlme_action action;
357350ea05efSSara Sharon 	struct ieee80211_sta *sta;
357450ea05efSSara Sharon 	u16 tid;
357550ea05efSSara Sharon 	u16 ssn;
357641cbb0f5SLuca Coelho 	u16 buf_size;
357750ea05efSSara Sharon 	bool amsdu;
357850ea05efSSara Sharon 	u16 timeout;
357950ea05efSSara Sharon };
358050ea05efSSara Sharon 
358150ea05efSSara Sharon /**
35824049e09aSJohannes Berg  * enum ieee80211_frame_release_type - frame release reason
35834049e09aSJohannes Berg  * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
358447086fc5SJohannes Berg  * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to
358547086fc5SJohannes Berg  *	frame received on trigger-enabled AC
35864049e09aSJohannes Berg  */
35874049e09aSJohannes Berg enum ieee80211_frame_release_type {
35884049e09aSJohannes Berg 	IEEE80211_FRAME_RELEASE_PSPOLL,
358947086fc5SJohannes Berg 	IEEE80211_FRAME_RELEASE_UAPSD,
35904049e09aSJohannes Berg };
35914049e09aSJohannes Berg 
35924049e09aSJohannes Berg /**
35938f727ef3SJohannes Berg  * enum ieee80211_rate_control_changed - flags to indicate what changed
35948f727ef3SJohannes Berg  *
35958f727ef3SJohannes Berg  * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
3596e1a0c6b3SJohannes Berg  *	to this station changed. The actual bandwidth is in the station
3597e1a0c6b3SJohannes Berg  *	information -- for HT20/40 the IEEE80211_HT_CAP_SUP_WIDTH_20_40
3598e1a0c6b3SJohannes Berg  *	flag changes, for HT and VHT the bandwidth field changes.
35998f727ef3SJohannes Berg  * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
3600e687f61eSAntonio Quartulli  * @IEEE80211_RC_SUPP_RATES_CHANGED: The supported rate set of this peer
3601e687f61eSAntonio Quartulli  *	changed (in IBSS mode) due to discovering more information about
3602e687f61eSAntonio Quartulli  *	the peer.
36030af83d3dSJohannes Berg  * @IEEE80211_RC_NSS_CHANGED: N_SS (number of spatial streams) was changed
36040af83d3dSJohannes Berg  *	by the peer
36058f727ef3SJohannes Berg  */
36068f727ef3SJohannes Berg enum ieee80211_rate_control_changed {
36078f727ef3SJohannes Berg 	IEEE80211_RC_BW_CHANGED		= BIT(0),
36088f727ef3SJohannes Berg 	IEEE80211_RC_SMPS_CHANGED	= BIT(1),
3609e687f61eSAntonio Quartulli 	IEEE80211_RC_SUPP_RATES_CHANGED	= BIT(2),
36100af83d3dSJohannes Berg 	IEEE80211_RC_NSS_CHANGED	= BIT(3),
36118f727ef3SJohannes Berg };
36128f727ef3SJohannes Berg 
36138f727ef3SJohannes Berg /**
3614d339d5caSIlan Peer  * enum ieee80211_roc_type - remain on channel type
3615d339d5caSIlan Peer  *
3616d339d5caSIlan Peer  * With the support for multi channel contexts and multi channel operations,
3617d339d5caSIlan Peer  * remain on channel operations might be limited/deferred/aborted by other
3618ae4a50eeSChris Packham  * flows/operations which have higher priority (and vice versa).
3619d339d5caSIlan Peer  * Specifying the ROC type can be used by devices to prioritize the ROC
3620d339d5caSIlan Peer  * operations compared to other operations/flows.
3621d339d5caSIlan Peer  *
3622d339d5caSIlan Peer  * @IEEE80211_ROC_TYPE_NORMAL: There are no special requirements for this ROC.
3623d339d5caSIlan Peer  * @IEEE80211_ROC_TYPE_MGMT_TX: The remain on channel request is required
3624ae4a50eeSChris Packham  *	for sending management frames offchannel.
3625d339d5caSIlan Peer  */
3626d339d5caSIlan Peer enum ieee80211_roc_type {
3627d339d5caSIlan Peer 	IEEE80211_ROC_TYPE_NORMAL = 0,
3628d339d5caSIlan Peer 	IEEE80211_ROC_TYPE_MGMT_TX,
3629d339d5caSIlan Peer };
3630d339d5caSIlan Peer 
3631d339d5caSIlan Peer /**
3632b1e8eb11SMauro Carvalho Chehab  * enum ieee80211_reconfig_type - reconfig type
3633cf2c92d8SEliad Peller  *
3634cf2c92d8SEliad Peller  * This enum is used by the reconfig_complete() callback to indicate what
3635cf2c92d8SEliad Peller  * reconfiguration type was completed.
3636cf2c92d8SEliad Peller  *
3637cf2c92d8SEliad Peller  * @IEEE80211_RECONFIG_TYPE_RESTART: hw restart type
3638cf2c92d8SEliad Peller  *	(also due to resume() callback returning 1)
3639cf2c92d8SEliad Peller  * @IEEE80211_RECONFIG_TYPE_SUSPEND: suspend type (regardless
3640cf2c92d8SEliad Peller  *	of wowlan configuration)
3641cf2c92d8SEliad Peller  */
3642cf2c92d8SEliad Peller enum ieee80211_reconfig_type {
3643cf2c92d8SEliad Peller 	IEEE80211_RECONFIG_TYPE_RESTART,
3644cf2c92d8SEliad Peller 	IEEE80211_RECONFIG_TYPE_SUSPEND,
3645cf2c92d8SEliad Peller };
3646cf2c92d8SEliad Peller 
3647cf2c92d8SEliad Peller /**
364815fae341SJohannes Berg  * struct ieee80211_prep_tx_info - prepare TX information
364915fae341SJohannes Berg  * @duration: if non-zero, hint about the required duration,
365015fae341SJohannes Berg  *	only used with the mgd_prepare_tx() method.
365115fae341SJohannes Berg  * @subtype: frame subtype (auth, (re)assoc, deauth, disassoc)
365215fae341SJohannes Berg  * @success: whether the frame exchange was successful, only
365315fae341SJohannes Berg  *	used with the mgd_complete_tx() method, and then only
365415fae341SJohannes Berg  *	valid for auth and (re)assoc.
365515fae341SJohannes Berg  */
365615fae341SJohannes Berg struct ieee80211_prep_tx_info {
365715fae341SJohannes Berg 	u16 duration;
365815fae341SJohannes Berg 	u16 subtype;
365915fae341SJohannes Berg 	u8 success:1;
366015fae341SJohannes Berg };
366115fae341SJohannes Berg 
366215fae341SJohannes Berg /**
366375a5f0ccSJohannes Berg  * struct ieee80211_ops - callbacks from mac80211 to the driver
366475a5f0ccSJohannes Berg  *
366575a5f0ccSJohannes Berg  * This structure contains various callbacks that the driver may
366675a5f0ccSJohannes Berg  * handle or, in some cases, must handle, for example to configure
366775a5f0ccSJohannes Berg  * the hardware to a new channel or to transmit a frame.
366875a5f0ccSJohannes Berg  *
366975a5f0ccSJohannes Berg  * @tx: Handler that 802.11 module calls for each transmitted frame.
3670f0706e82SJiri Benc  *	skb contains the buffer starting from the IEEE 802.11 header.
3671f0706e82SJiri Benc  *	The low-level driver should send the frame out based on
3672eefce91aSJohannes Berg  *	configuration in the TX control data. This handler should,
367311127e91SJohannes Berg  *	preferably, never fail and stop queues appropriately.
367411127e91SJohannes Berg  *	Must be atomic.
367575a5f0ccSJohannes Berg  *
367675a5f0ccSJohannes Berg  * @start: Called before the first netdevice attached to the hardware
36774150c572SJohannes Berg  *	is enabled. This should turn on the hardware and must turn on
36784150c572SJohannes Berg  *	frame reception (for possibly enabled monitor interfaces.)
36794150c572SJohannes Berg  *	Returns negative error codes, these may be seen in userspace,
36804150c572SJohannes Berg  *	or zero.
36814150c572SJohannes Berg  *	When the device is started it should not have a MAC address
36824150c572SJohannes Berg  *	to avoid acknowledging frames before a non-monitor device
36834150c572SJohannes Berg  *	is added.
3684e1781ed3SKalle Valo  *	Must be implemented and can sleep.
368575a5f0ccSJohannes Berg  *
368675a5f0ccSJohannes Berg  * @stop: Called after last netdevice attached to the hardware
36874150c572SJohannes Berg  *	is disabled. This should turn off the hardware (at least
36884150c572SJohannes Berg  *	it must turn off frame reception.)
36894150c572SJohannes Berg  *	May be called right after add_interface if that rejects
369042935ecaSLuis R. Rodriguez  *	an interface. If you added any work onto the mac80211 workqueue
369142935ecaSLuis R. Rodriguez  *	you should ensure to cancel it on this callback.
3692e1781ed3SKalle Valo  *	Must be implemented and can sleep.
369375a5f0ccSJohannes Berg  *
3694eecc4800SJohannes Berg  * @suspend: Suspend the device; mac80211 itself will quiesce before and
3695eecc4800SJohannes Berg  *	stop transmitting and doing any other configuration, and then
3696eecc4800SJohannes Berg  *	ask the device to suspend. This is only invoked when WoWLAN is
3697eecc4800SJohannes Berg  *	configured, otherwise the device is deconfigured completely and
3698eecc4800SJohannes Berg  *	reconfigured at resume time.
36992b4562dfSJohannes Berg  *	The driver may also impose special conditions under which it
37002b4562dfSJohannes Berg  *	wants to use the "normal" suspend (deconfigure), say if it only
37012b4562dfSJohannes Berg  *	supports WoWLAN when the device is associated. In this case, it
37022b4562dfSJohannes Berg  *	must return 1 from this function.
3703eecc4800SJohannes Berg  *
3704eecc4800SJohannes Berg  * @resume: If WoWLAN was configured, this indicates that mac80211 is
3705eecc4800SJohannes Berg  *	now resuming its operation, after this the device must be fully
3706eecc4800SJohannes Berg  *	functional again. If this returns an error, the only way out is
3707eecc4800SJohannes Berg  *	to also unregister the device. If it returns 1, then mac80211
3708eecc4800SJohannes Berg  *	will also go through the regular complete restart on resume.
3709eecc4800SJohannes Berg  *
3710d13e1414SJohannes Berg  * @set_wakeup: Enable or disable wakeup when WoWLAN configuration is
3711d13e1414SJohannes Berg  *	modified. The reason is that device_set_wakeup_enable() is
3712d13e1414SJohannes Berg  *	supposed to be called when the configuration changes, not only
3713d13e1414SJohannes Berg  *	in suspend().
3714d13e1414SJohannes Berg  *
371575a5f0ccSJohannes Berg  * @add_interface: Called when a netdevice attached to the hardware is
3716e37d4dffSBob Copeland  *	enabled. Because it is not called for monitor mode devices, @start
371775a5f0ccSJohannes Berg  *	and @stop must be implemented.
37184150c572SJohannes Berg  *	The driver should perform any initialization it needs before
37194150c572SJohannes Berg  *	the device can be enabled. The initial configuration for the
37204150c572SJohannes Berg  *	interface is given in the conf parameter.
372175a5f0ccSJohannes Berg  *	The callback may refuse to add an interface by returning a
372275a5f0ccSJohannes Berg  *	negative error code (which will be seen in userspace.)
3723e1781ed3SKalle Valo  *	Must be implemented and can sleep.
372475a5f0ccSJohannes Berg  *
372534d4bc4dSJohannes Berg  * @change_interface: Called when a netdevice changes type. This callback
372634d4bc4dSJohannes Berg  *	is optional, but only if it is supported can interface types be
372734d4bc4dSJohannes Berg  *	switched while the interface is UP. The callback may sleep.
372834d4bc4dSJohannes Berg  *	Note that while an interface is being switched, it will not be
372934d4bc4dSJohannes Berg  *	found by the interface iteration callbacks.
373034d4bc4dSJohannes Berg  *
373175a5f0ccSJohannes Berg  * @remove_interface: Notifies a driver that an interface is going down.
373275a5f0ccSJohannes Berg  *	The @stop callback is called after this if it is the last interface
373375a5f0ccSJohannes Berg  *	and no monitor interfaces are present.
37344150c572SJohannes Berg  *	When all interfaces are removed, the MAC address in the hardware
37354150c572SJohannes Berg  *	must be cleared so the device no longer acknowledges packets,
37364150c572SJohannes Berg  *	the mac_addr member of the conf structure is, however, set to the
37374150c572SJohannes Berg  *	MAC address of the device going away.
3738e1781ed3SKalle Valo  *	Hence, this callback must be implemented. It can sleep.
37394150c572SJohannes Berg  *
374075a5f0ccSJohannes Berg  * @config: Handler for configuration requests. IEEE 802.11 code calls this
374175a5f0ccSJohannes Berg  *	function to change hardware configuration, e.g., channel.
37426dd1bf31SBob Copeland  *	This function should never fail but returns a negative error code
3743e1781ed3SKalle Valo  *	if it does. The callback can sleep.
37444150c572SJohannes Berg  *
3745471b3efdSJohannes Berg  * @bss_info_changed: Handler for configuration requests related to BSS
3746471b3efdSJohannes Berg  *	parameters that may vary during BSS's lifespan, and may affect low
3747471b3efdSJohannes Berg  *	level driver (e.g. assoc/disassoc status, erp parameters).
3748471b3efdSJohannes Berg  *	This function should not be used if no BSS has been set, unless
3749471b3efdSJohannes Berg  *	for association indication. The @changed parameter indicates which
3750e1781ed3SKalle Valo  *	of the bss parameters has changed when a call is made. The callback
3751e1781ed3SKalle Valo  *	can sleep.
37527b7090b4SJohannes Berg  *	Note: this callback is called if @vif_cfg_changed or @link_info_changed
37537b7090b4SJohannes Berg  *	are not implemented.
37547b7090b4SJohannes Berg  *
37557b7090b4SJohannes Berg  * @vif_cfg_changed: Handler for configuration requests related to interface
37567b7090b4SJohannes Berg  *	(MLD) parameters from &struct ieee80211_vif_cfg that vary during the
37577b7090b4SJohannes Berg  *	lifetime of the interface (e.g. assoc status, IP addresses, etc.)
37587b7090b4SJohannes Berg  *	The @changed parameter indicates which value changed.
37597b7090b4SJohannes Berg  *	The callback can sleep.
37607b7090b4SJohannes Berg  *
37617b7090b4SJohannes Berg  * @link_info_changed: Handler for configuration requests related to link
37627b7090b4SJohannes Berg  *	parameters from &struct ieee80211_bss_conf that are related to an
37637b7090b4SJohannes Berg  *	individual link. e.g. legacy/HT/VHT/... rate information.
37647b7090b4SJohannes Berg  *	The @changed parameter indicates which value changed, and the @link_id
37657b7090b4SJohannes Berg  *	parameter indicates the link ID. Note that the @link_id will be 0 for
37667b7090b4SJohannes Berg  *	non-MLO connections.
37677b7090b4SJohannes Berg  *	The callback can sleep.
3768471b3efdSJohannes Berg  *
37693ac64beeSJohannes Berg  * @prepare_multicast: Prepare for multicast filter configuration.
37703ac64beeSJohannes Berg  *	This callback is optional, and its return value is passed
37713ac64beeSJohannes Berg  *	to configure_filter(). This callback must be atomic.
37723ac64beeSJohannes Berg  *
377375a5f0ccSJohannes Berg  * @configure_filter: Configure the device's RX filter.
377475a5f0ccSJohannes Berg  *	See the section "Frame filtering" for more information.
3775e1781ed3SKalle Valo  *	This callback must be implemented and can sleep.
37768f20fc24SJohannes Berg  *
37771b09b556SAndrei Otcheretianski  * @config_iface_filter: Configure the interface's RX filter.
37781b09b556SAndrei Otcheretianski  *	This callback is optional and is used to configure which frames
37791b09b556SAndrei Otcheretianski  *	should be passed to mac80211. The filter_flags is the combination
37801b09b556SAndrei Otcheretianski  *	of FIF_* flags. The changed_flags is a bit mask that indicates
37811b09b556SAndrei Otcheretianski  *	which flags are changed.
37821b09b556SAndrei Otcheretianski  *	This callback can sleep.
37831b09b556SAndrei Otcheretianski  *
3784546c80c9SLuis R. Rodriguez  * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
378517741cdcSJohannes Berg  * 	must be set or cleared for a given STA. Must be atomic.
378611a843b7SJohannes Berg  *
378775a5f0ccSJohannes Berg  * @set_key: See the section "Hardware crypto acceleration"
3788e1781ed3SKalle Valo  *	This callback is only called between add_interface and
3789e1781ed3SKalle Valo  *	remove_interface calls, i.e. while the given virtual interface
3790dc822b5dSJohannes Berg  *	is enabled.
37916dd1bf31SBob Copeland  *	Returns a negative error code if the key can't be added.
3792e1781ed3SKalle Valo  *	The callback can sleep.
379311a843b7SJohannes Berg  *
37949ae4fda3SEmmanuel Grumbach  * @update_tkip_key: See the section "Hardware crypto acceleration"
37959ae4fda3SEmmanuel Grumbach  * 	This callback will be called in the context of Rx. Called for drivers
37969ae4fda3SEmmanuel Grumbach  * 	which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
3797eb807fb2SKalle Valo  *	The callback must be atomic.
37989ae4fda3SEmmanuel Grumbach  *
3799c68f4b89SJohannes Berg  * @set_rekey_data: If the device supports GTK rekeying, for example while the
3800c68f4b89SJohannes Berg  *	host is suspended, it can assign this callback to retrieve the data
3801c68f4b89SJohannes Berg  *	necessary to do GTK rekeying, this is the KEK, KCK and replay counter.
3802c68f4b89SJohannes Berg  *	After rekeying was done it should (for example during resume) notify
3803c68f4b89SJohannes Berg  *	userspace of the new replay counter using ieee80211_gtk_rekey_notify().
3804c68f4b89SJohannes Berg  *
3805de5fad81SYoni Divinsky  * @set_default_unicast_key: Set the default (unicast) key index, useful for
3806de5fad81SYoni Divinsky  *	WEP when the device sends data packets autonomously, e.g. for ARP
3807de5fad81SYoni Divinsky  *	offloading. The index can be 0-3, or -1 for unsetting it.
3808de5fad81SYoni Divinsky  *
380975a5f0ccSJohannes Berg  * @hw_scan: Ask the hardware to service the scan request, no need to start
38108318d78aSJohannes Berg  *	the scan state machine in stack. The scan must honour the channel
38119050bdd8SKalle Valo  *	configuration done by the regulatory agent in the wiphy's
38129050bdd8SKalle Valo  *	registered bands. The hardware (or the driver) needs to make sure
3813de95a54bSJohannes Berg  *	that power save is disabled.
3814de95a54bSJohannes Berg  *	The @req ie/ie_len members are rewritten by mac80211 to contain the
3815de95a54bSJohannes Berg  *	entire IEs after the SSID, so that drivers need not look at these
3816de95a54bSJohannes Berg  *	at all but just send them after the SSID -- mac80211 includes the
3817de95a54bSJohannes Berg  *	(extended) supported rates and HT information (where applicable).
3818de95a54bSJohannes Berg  *	When the scan finishes, ieee80211_scan_completed() must be called;
3819de95a54bSJohannes Berg  *	note that it also must be called when the scan cannot finish due to
3820de95a54bSJohannes Berg  *	any error unless this callback returned a negative error code.
3821e9da68ddSJohannes Berg  *	This callback is also allowed to return the special return value 1,
3822e9da68ddSJohannes Berg  *	this indicates that hardware scan isn't desirable right now and a
3823e9da68ddSJohannes Berg  *	software scan should be done instead. A driver wishing to use this
3824e9da68ddSJohannes Berg  *	capability must ensure its (hardware) scan capabilities aren't
3825e9da68ddSJohannes Berg  *	advertised as more capable than mac80211's software scan is.
3826e1781ed3SKalle Valo  *	The callback can sleep.
382775a5f0ccSJohannes Berg  *
3828b856439bSEliad Peller  * @cancel_hw_scan: Ask the low-level tp cancel the active hw scan.
3829b856439bSEliad Peller  *	The driver should ask the hardware to cancel the scan (if possible),
3830b856439bSEliad Peller  *	but the scan will be completed only after the driver will call
3831b856439bSEliad Peller  *	ieee80211_scan_completed().
3832b856439bSEliad Peller  *	This callback is needed for wowlan, to prevent enqueueing a new
3833b856439bSEliad Peller  *	scan_work after the low-level driver was already suspended.
3834b856439bSEliad Peller  *	The callback can sleep.
3835b856439bSEliad Peller  *
383679f460caSLuciano Coelho  * @sched_scan_start: Ask the hardware to start scanning repeatedly at
383779f460caSLuciano Coelho  *	specific intervals.  The driver must call the
383879f460caSLuciano Coelho  *	ieee80211_sched_scan_results() function whenever it finds results.
383979f460caSLuciano Coelho  *	This process will continue until sched_scan_stop is called.
384079f460caSLuciano Coelho  *
384179f460caSLuciano Coelho  * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan.
384237e3308cSJohannes Berg  *	In this case, ieee80211_sched_scan_stopped() must not be called.
384379f460caSLuciano Coelho  *
384480e775bfSMichael Buesch  * @sw_scan_start: Notifier function that is called just before a software scan
384580e775bfSMichael Buesch  *	is started. Can be NULL, if the driver doesn't need this notification.
3846a344d677SJohannes Berg  *	The mac_addr parameter allows supporting NL80211_SCAN_FLAG_RANDOM_ADDR,
3847a344d677SJohannes Berg  *	the driver may set the NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR flag if it
3848a344d677SJohannes Berg  *	can use this parameter. The callback can sleep.
384980e775bfSMichael Buesch  *
3850e1781ed3SKalle Valo  * @sw_scan_complete: Notifier function that is called just after a
3851e1781ed3SKalle Valo  *	software scan finished. Can be NULL, if the driver doesn't need
3852e1781ed3SKalle Valo  *	this notification.
3853e1781ed3SKalle Valo  *	The callback can sleep.
385480e775bfSMichael Buesch  *
38556dd1bf31SBob Copeland  * @get_stats: Return low-level statistics.
38566dd1bf31SBob Copeland  * 	Returns zero if statistics are available.
3857e1781ed3SKalle Valo  *	The callback can sleep.
385875a5f0ccSJohannes Berg  *
38599352c19fSJohannes Berg  * @get_key_seq: If your device implements encryption in hardware and does
38609352c19fSJohannes Berg  *	IV/PN assignment then this callback should be provided to read the
38619352c19fSJohannes Berg  *	IV/PN for the given key from hardware.
3862e1781ed3SKalle Valo  *	The callback must be atomic.
386375a5f0ccSJohannes Berg  *
3864f23a4780SArik Nemtsov  * @set_frag_threshold: Configuration of fragmentation threshold. Assign this
3865f3fe4e93SSara Sharon  *	if the device does fragmentation by itself. Note that to prevent the
3866f3fe4e93SSara Sharon  *	stack from doing fragmentation IEEE80211_HW_SUPPORTS_TX_FRAG
3867f3fe4e93SSara Sharon  *	should be set as well.
3868f23a4780SArik Nemtsov  *	The callback can sleep.
3869f23a4780SArik Nemtsov  *
387075a5f0ccSJohannes Berg  * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
3871e1781ed3SKalle Valo  *	The callback can sleep.
387275a5f0ccSJohannes Berg  *
387334e89507SJohannes Berg  * @sta_add: Notifies low level driver about addition of an associated station,
387434e89507SJohannes Berg  *	AP, IBSS/WDS/mesh peer etc. This callback can sleep.
387534e89507SJohannes Berg  *
387634e89507SJohannes Berg  * @sta_remove: Notifies low level driver about removal of an associated
38776a9d1b91SJohannes Berg  *	station, AP, IBSS/WDS/mesh peer etc. Note that after the callback
38786a9d1b91SJohannes Berg  *	returns it isn't safe to use the pointer, not even RCU protected;
38796a9d1b91SJohannes Berg  *	no RCU grace period is guaranteed between returning here and freeing
38806a9d1b91SJohannes Berg  *	the station. See @sta_pre_rcu_remove if needed.
38816a9d1b91SJohannes Berg  *	This callback can sleep.
388234e89507SJohannes Berg  *
3883170cd6a6SBenjamin Berg  * @link_add_debugfs: Drivers can use this callback to add debugfs files
3884170cd6a6SBenjamin Berg  *	when a link is added to a mac80211 vif. This callback should be within
3885170cd6a6SBenjamin Berg  *	a CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep.
3886170cd6a6SBenjamin Berg  *	For non-MLO the callback will be called once for the default bss_conf
3887170cd6a6SBenjamin Berg  *	with the vif's directory rather than a separate subdirectory.
3888170cd6a6SBenjamin Berg  *
388977d2ece6SSujith Manoharan  * @sta_add_debugfs: Drivers can use this callback to add debugfs files
389077d2ece6SSujith Manoharan  *	when a station is added to mac80211's station list. This callback
3891c7e9dbcfSJohannes Berg  *	should be within a CONFIG_MAC80211_DEBUGFS conditional. This
3892c7e9dbcfSJohannes Berg  *	callback can sleep.
389377d2ece6SSujith Manoharan  *
3894d2caad52SBenjamin Berg  * @link_sta_add_debugfs: Drivers can use this callback to add debugfs files
3895d2caad52SBenjamin Berg  *	when a link is added to a mac80211 station. This callback
3896d33ed97dSJohannes Berg  *	should be within a CONFIG_MAC80211_DEBUGFS conditional. This
3897d2caad52SBenjamin Berg  *	callback can sleep.
3898d2caad52SBenjamin Berg  *	For non-MLO the callback will be called once for the deflink with the
3899d2caad52SBenjamin Berg  *	station's directory rather than a separate subdirectory.
3900d2caad52SBenjamin Berg  *
390134e89507SJohannes Berg  * @sta_notify: Notifies low level driver about power state transition of an
3902d057e5a3SArik Nemtsov  *	associated station, AP,  IBSS/WDS/mesh peer etc. For a VIF operating
3903d057e5a3SArik Nemtsov  *	in AP mode, this callback will not be called when the flag
3904d057e5a3SArik Nemtsov  *	%IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
39054571d3bfSChristian Lamparter  *
390607e97338SQiujun Huang  * @sta_set_txpwr: Configure the station tx power. This callback set the tx
390707e97338SQiujun Huang  *	power for the station.
390807e97338SQiujun Huang  *	This callback can sleep.
390907e97338SQiujun Huang  *
3910f09603a2SJohannes Berg  * @sta_state: Notifies low level driver about state transition of a
3911f09603a2SJohannes Berg  *	station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
3912f09603a2SJohannes Berg  *	This callback is mutually exclusive with @sta_add/@sta_remove.
3913f09603a2SJohannes Berg  *	It must not fail for down transitions but may fail for transitions
39146a9d1b91SJohannes Berg  *	up the list of states. Also note that after the callback returns it
39156a9d1b91SJohannes Berg  *	isn't safe to use the pointer, not even RCU protected - no RCU grace
39166a9d1b91SJohannes Berg  *	period is guaranteed between returning here and freeing the station.
39176a9d1b91SJohannes Berg  *	See @sta_pre_rcu_remove if needed.
39186a9d1b91SJohannes Berg  *	The callback can sleep.
39196a9d1b91SJohannes Berg  *
39206a9d1b91SJohannes Berg  * @sta_pre_rcu_remove: Notify driver about station removal before RCU
39216a9d1b91SJohannes Berg  *	synchronisation. This is useful if a driver needs to have station
39226a9d1b91SJohannes Berg  *	pointers protected using RCU, it can then use this call to clear
39236a9d1b91SJohannes Berg  *	the pointers instead of waiting for an RCU grace period to elapse
39246a9d1b91SJohannes Berg  *	in @sta_state.
3925f09603a2SJohannes Berg  *	The callback can sleep.
3926f09603a2SJohannes Berg  *
39278f727ef3SJohannes Berg  * @sta_rc_update: Notifies the driver of changes to the bitrates that can be
39288f727ef3SJohannes Berg  *	used to transmit to the station. The changes are advertised with bits
39298f727ef3SJohannes Berg  *	from &enum ieee80211_rate_control_changed and the values are reflected
39308f727ef3SJohannes Berg  *	in the station data. This callback should only be used when the driver
39318f727ef3SJohannes Berg  *	uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
39328f727ef3SJohannes Berg  *	otherwise the rate control algorithm is notified directly.
39338f727ef3SJohannes Berg  *	Must be atomic.
3934f815e2b3SJohannes Berg  * @sta_rate_tbl_update: Notifies the driver that the rate table changed. This
3935f815e2b3SJohannes Berg  *	is only used if the configured rate control algorithm actually uses
3936f815e2b3SJohannes Berg  *	the new rate table API, and is therefore optional. Must be atomic.
39378f727ef3SJohannes Berg  *
39382b9a7e1bSJohannes Berg  * @sta_statistics: Get statistics for this station. For example with beacon
39392b9a7e1bSJohannes Berg  *	filtering, the statistics kept by mac80211 might not be accurate, so
39402b9a7e1bSJohannes Berg  *	let the driver pre-fill the statistics. The driver can fill most of
39412b9a7e1bSJohannes Berg  *	the values (indicating which by setting the filled bitmap), but not
39422b9a7e1bSJohannes Berg  *	all of them make sense - see the source for which ones are possible.
39432b9a7e1bSJohannes Berg  *	Statistics that the driver doesn't fill will be filled by mac80211.
39442b9a7e1bSJohannes Berg  *	The callback can sleep.
39452b9a7e1bSJohannes Berg  *
394675a5f0ccSJohannes Berg  * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
3947fe3fa827SJohannes Berg  *	bursting) for a hardware TX queue.
39486dd1bf31SBob Copeland  *	Returns a negative error code on failure.
3949e1781ed3SKalle Valo  *	The callback can sleep.
395075a5f0ccSJohannes Berg  *
395175a5f0ccSJohannes Berg  * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
39523b5d665bSAlina Friedrichsen  *	this is only used for IBSS mode BSSID merging and debugging. Is not a
39537b08b3b4SAlina Friedrichsen  *	required function.
3954e1781ed3SKalle Valo  *	The callback can sleep.
39553b5d665bSAlina Friedrichsen  *
39563b5d665bSAlina Friedrichsen  * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
39573b5d665bSAlina Friedrichsen  *	Currently, this is only used for IBSS mode debugging. Is not a
39587b08b3b4SAlina Friedrichsen  *	required function.
3959e1781ed3SKalle Valo  *	The callback can sleep.
396075a5f0ccSJohannes Berg  *
3961354d381bSPedersen, Thomas  * @offset_tsf: Offset the TSF timer by the specified value in the
3962354d381bSPedersen, Thomas  *	firmware/hardware.  Preferred to set_tsf as it avoids delay between
3963354d381bSPedersen, Thomas  *	calling set_tsf() and hardware getting programmed, which will show up
3964354d381bSPedersen, Thomas  *	as TSF delay. Is not a required function.
3965354d381bSPedersen, Thomas  *	The callback can sleep.
3966354d381bSPedersen, Thomas  *
396775a5f0ccSJohannes Berg  * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
396875a5f0ccSJohannes Berg  *	with other STAs in the IBSS. This is only used in IBSS mode. This
396975a5f0ccSJohannes Berg  *	function is optional if the firmware/hardware takes full care of
397075a5f0ccSJohannes Berg  *	TSF synchronization.
3971e1781ed3SKalle Valo  *	The callback can sleep.
397275a5f0ccSJohannes Berg  *
397375a5f0ccSJohannes Berg  * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
397475a5f0ccSJohannes Berg  *	This is needed only for IBSS mode and the result of this function is
397575a5f0ccSJohannes Berg  *	used to determine whether to reply to Probe Requests.
39766dd1bf31SBob Copeland  *	Returns non-zero if this device sent the last beacon.
3977e1781ed3SKalle Valo  *	The callback can sleep.
3978d3c990fbSRon Rindjunsky  *
39794e8998f0SRandy Dunlap  * @get_survey: Return per-channel survey information
39804e8998f0SRandy Dunlap  *
39811f87f7d3SJohannes Berg  * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
39821f87f7d3SJohannes Berg  *	need to set wiphy->rfkill_poll to %true before registration,
39831f87f7d3SJohannes Berg  *	and need to call wiphy_rfkill_set_hw_state() in the callback.
3984e1781ed3SKalle Valo  *	The callback can sleep.
3985aff89a9bSJohannes Berg  *
3986310bc676SLukáš Turek  * @set_coverage_class: Set slot time for given coverage class as specified
3987310bc676SLukáš Turek  *	in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
3988a4bcaf55SLorenzo Bianconi  *	accordingly; coverage class equals to -1 to enable ACK timeout
3989a4bcaf55SLorenzo Bianconi  *	estimation algorithm (dynack). To disable dynack set valid value for
3990a4bcaf55SLorenzo Bianconi  *	coverage class. This callback is not required and may sleep.
3991310bc676SLukáš Turek  *
399252981cd7SDavid Spinadel  * @testmode_cmd: Implement a cfg80211 test mode command. The passed @vif may
399352981cd7SDavid Spinadel  *	be %NULL. The callback can sleep.
399471063f0eSWey-Yi Guy  * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep.
3995a80f7c0bSJohannes Berg  *
3996a80f7c0bSJohannes Berg  * @flush: Flush all pending frames from the hardware queue, making sure
399739ecc01dSJohannes Berg  *	that the hardware queues are empty. The @queues parameter is a bitmap
399839ecc01dSJohannes Berg  *	of queues to flush, which is useful if different virtual interfaces
399939ecc01dSJohannes Berg  *	use different hardware queues; it may also indicate all queues.
400039ecc01dSJohannes Berg  *	If the parameter @drop is set to %true, pending frames may be dropped.
400177be2c54SEmmanuel Grumbach  *	Note that vif can be NULL.
400239ecc01dSJohannes Berg  *	The callback can sleep.
40035ce6e438SJohannes Berg  *
4004d00800a2SJohannes Berg  * @flush_sta: Flush or drop all pending frames from the hardware queue(s) for
4005d00800a2SJohannes Berg  *	the given station, as it's about to be removed.
4006d00800a2SJohannes Berg  *	The callback can sleep.
4007d00800a2SJohannes Berg  *
40085ce6e438SJohannes Berg  * @channel_switch: Drivers that need (or want) to offload the channel
40095ce6e438SJohannes Berg  *	switch operation for CSAs received from the AP may implement this
40105ce6e438SJohannes Berg  *	callback. They must then call ieee80211_chswitch_done() to indicate
40115ce6e438SJohannes Berg  *	completion of the channel switch.
40124e6cbfd0SJohn W. Linville  *
401379b1c460SBruno Randolf  * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
401479b1c460SBruno Randolf  *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
401579b1c460SBruno Randolf  *	reject TX/RX mask combinations they cannot support by returning -EINVAL
401679b1c460SBruno Randolf  *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
401779b1c460SBruno Randolf  *
401879b1c460SBruno Randolf  * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
40194976b4ebSJohannes Berg  *
40204976b4ebSJohannes Berg  * @remain_on_channel: Starts an off-channel period on the given channel, must
40214976b4ebSJohannes Berg  *	call back to ieee80211_ready_on_channel() when on that channel. Note
40224976b4ebSJohannes Berg  *	that normal channel traffic is not stopped as this is intended for hw
40234976b4ebSJohannes Berg  *	offload. Frames to transmit on the off-channel channel are transmitted
40244976b4ebSJohannes Berg  *	normally except for the %IEEE80211_TX_CTL_TX_OFFCHAN flag. When the
40254976b4ebSJohannes Berg  *	duration (which will always be non-zero) expires, the driver must call
4026196ac1c1SJohannes Berg  *	ieee80211_remain_on_channel_expired().
4027196ac1c1SJohannes Berg  *	Note that this callback may be called while the device is in IDLE and
4028196ac1c1SJohannes Berg  *	must be accepted in this case.
4029196ac1c1SJohannes Berg  *	This callback may sleep.
40304976b4ebSJohannes Berg  * @cancel_remain_on_channel: Requests that an ongoing off-channel period is
40314976b4ebSJohannes Berg  *	aborted before it expires. This callback may sleep.
403238c09159SJohn W. Linville  *
403338c09159SJohn W. Linville  * @set_ringparam: Set tx and rx ring sizes.
403438c09159SJohn W. Linville  *
403538c09159SJohn W. Linville  * @get_ringparam: Get tx and rx ring current and maximum sizes.
4036e8306f98SVivek Natarajan  *
4037e8306f98SVivek Natarajan  * @tx_frames_pending: Check if there is any pending frame in the hardware
4038e8306f98SVivek Natarajan  *	queues before entering power save.
4039bdbfd6b5SSujith Manoharan  *
4040bdbfd6b5SSujith Manoharan  * @set_bitrate_mask: Set a mask of rates to be used for rate control selection
4041bdbfd6b5SSujith Manoharan  *	when transmitting a frame. Currently only legacy rates are handled.
4042bdbfd6b5SSujith Manoharan  *	The callback can sleep.
4043a8182929SEmmanuel Grumbach  * @event_callback: Notify driver about any event in mac80211. See
4044a8182929SEmmanuel Grumbach  *	&enum ieee80211_event_type for the different types.
40456382246eSEmmanuel Grumbach  *	The callback must be atomic.
40464049e09aSJohannes Berg  *
40474049e09aSJohannes Berg  * @release_buffered_frames: Release buffered frames according to the given
40484049e09aSJohannes Berg  *	parameters. In the case where the driver buffers some frames for
40494049e09aSJohannes Berg  *	sleeping stations mac80211 will use this callback to tell the driver
40504049e09aSJohannes Berg  *	to release some frames, either for PS-poll or uAPSD.
4051e227867fSMasanari Iida  *	Note that if the @more_data parameter is %false the driver must check
40524049e09aSJohannes Berg  *	if there are more frames on the given TIDs, and if there are more than
40534049e09aSJohannes Berg  *	the frames being released then it must still set the more-data bit in
40544049e09aSJohannes Berg  *	the frame. If the @more_data parameter is %true, then of course the
40554049e09aSJohannes Berg  *	more-data bit must always be set.
40564049e09aSJohannes Berg  *	The @tids parameter tells the driver which TIDs to release frames
40574049e09aSJohannes Berg  *	from, for PS-poll it will always have only a single bit set.
4058deeaee19SJohannes Berg  *	In the case this is used for a PS-poll initiated release, the
4059deeaee19SJohannes Berg  *	@num_frames parameter will always be 1 so code can be shared. In
4060deeaee19SJohannes Berg  *	this case the driver must also set %IEEE80211_TX_STATUS_EOSP flag
4061deeaee19SJohannes Berg  *	on the TX status (and must report TX status) so that the PS-poll
4062deeaee19SJohannes Berg  *	period is properly ended. This is used to avoid sending multiple
4063deeaee19SJohannes Berg  *	responses for a retried PS-poll frame.
40644049e09aSJohannes Berg  *	In the case this is used for uAPSD, the @num_frames parameter may be
40654049e09aSJohannes Berg  *	bigger than one, but the driver may send fewer frames (it must send
40664049e09aSJohannes Berg  *	at least one, however). In this case it is also responsible for
406747086fc5SJohannes Berg  *	setting the EOSP flag in the QoS header of the frames. Also, when the
406847086fc5SJohannes Berg  *	service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP
406937fbd908SJohannes Berg  *	on the last frame in the SP. Alternatively, it may call the function
4070e943789eSJohannes Berg  *	ieee80211_sta_eosp() to inform mac80211 of the end of the SP.
40714049e09aSJohannes Berg  *	This callback must be atomic.
407240b96408SJohannes Berg  * @allow_buffered_frames: Prepare device to allow the given number of frames
407340b96408SJohannes Berg  *	to go out to the given station. The frames will be sent by mac80211
407440b96408SJohannes Berg  *	via the usual TX path after this call. The TX information for frames
407502f2f1a9SJohannes Berg  *	released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
407640b96408SJohannes Berg  *	and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
407740b96408SJohannes Berg  *	frames from multiple TIDs are released and the driver might reorder
407840b96408SJohannes Berg  *	them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
407940b96408SJohannes Berg  *	on the last frame and clear it on all others and also handle the EOSP
408037fbd908SJohannes Berg  *	bit in the QoS header correctly. Alternatively, it can also call the
4081e943789eSJohannes Berg  *	ieee80211_sta_eosp() function.
408240b96408SJohannes Berg  *	The @tids parameter is a bitmap and tells the driver which TIDs the
408340b96408SJohannes Berg  *	frames will be on; it will at most have two bits set.
408440b96408SJohannes Berg  *	This callback must be atomic.
4085e352114fSBen Greear  *
4086e352114fSBen Greear  * @get_et_sset_count:  Ethtool API to get string-set count.
4087e352114fSBen Greear  *
4088e352114fSBen Greear  * @get_et_stats:  Ethtool API to get a set of u64 stats.
4089e352114fSBen Greear  *
4090e352114fSBen Greear  * @get_et_strings:  Ethtool API to get a set of strings to describe stats
4091e352114fSBen Greear  *	and perhaps other supported types of ethtool data-sets.
4092e352114fSBen Greear  *
4093a1845fc7SJohannes Berg  * @mgd_prepare_tx: Prepare for transmitting a management frame for association
4094a1845fc7SJohannes Berg  *	before associated. In multi-channel scenarios, a virtual interface is
4095a1845fc7SJohannes Berg  *	bound to a channel before it is associated, but as it isn't associated
4096a1845fc7SJohannes Berg  *	yet it need not necessarily be given airtime, in particular since any
4097a1845fc7SJohannes Berg  *	transmission to a P2P GO needs to be synchronized against the GO's
4098a1845fc7SJohannes Berg  *	powersave state. mac80211 will call this function before transmitting a
4099a1845fc7SJohannes Berg  *	management frame prior to having successfully associated to allow the
4100a1845fc7SJohannes Berg  *	driver to give it channel time for the transmission, to get a response
4101a1845fc7SJohannes Berg  *	and to be able to synchronize with the GO.
410294ba9271SIlan Peer  *	For drivers that set %IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, mac80211
410394ba9271SIlan Peer  *	would also call this function before transmitting a deauthentication
410494ba9271SIlan Peer  *	frame in case that no beacon was heard from the AP/P2P GO.
4105a1845fc7SJohannes Berg  *	The callback will be called before each transmission and upon return
4106a1845fc7SJohannes Berg  *	mac80211 will transmit the frame right away.
410715fae341SJohannes Berg  *	Additional information is passed in the &struct ieee80211_prep_tx_info
410815fae341SJohannes Berg  *	data. If duration there is greater than zero, mac80211 hints to the
410915fae341SJohannes Berg  *	driver the duration for which the operation is requested.
4110a1845fc7SJohannes Berg  *	The callback is optional and can (should!) sleep.
411115fae341SJohannes Berg  * @mgd_complete_tx: Notify the driver that the response frame for a previously
411215fae341SJohannes Berg  *	transmitted frame announced with @mgd_prepare_tx was received, the data
411315fae341SJohannes Berg  *	is filled similarly to @mgd_prepare_tx though the duration is not used.
4114c3645eacSMichal Kazior  *
4115ee10f2c7SArik Nemtsov  * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
4116ee10f2c7SArik Nemtsov  *	a TDLS discovery-request, we expect a reply to arrive on the AP's
4117ee10f2c7SArik Nemtsov  *	channel. We must stay on the channel (no PSM, scan, etc.), since a TDLS
4118ee10f2c7SArik Nemtsov  *	setup-response is a direct packet not buffered by the AP.
4119ee10f2c7SArik Nemtsov  *	mac80211 will call this function just before the transmission of a TDLS
4120ee10f2c7SArik Nemtsov  *	discovery-request. The recommended period of protection is at least
4121ee10f2c7SArik Nemtsov  *	2 * (DTIM period).
4122ee10f2c7SArik Nemtsov  *	The callback is optional and can sleep.
4123ee10f2c7SArik Nemtsov  *
4124c3645eacSMichal Kazior  * @add_chanctx: Notifies device driver about new channel context creation.
4125dcae9e02SChaitanya T K  *	This callback may sleep.
4126c3645eacSMichal Kazior  * @remove_chanctx: Notifies device driver about channel context destruction.
4127dcae9e02SChaitanya T K  *	This callback may sleep.
4128c3645eacSMichal Kazior  * @change_chanctx: Notifies device driver about channel context changes that
4129c3645eacSMichal Kazior  *	may happen when combining different virtual interfaces on the same
4130c3645eacSMichal Kazior  *	channel context with different settings
4131dcae9e02SChaitanya T K  *	This callback may sleep.
4132c3645eacSMichal Kazior  * @assign_vif_chanctx: Notifies device driver about channel context being bound
4133c3645eacSMichal Kazior  *	to vif. Possible use is for hw queue remapping.
4134dcae9e02SChaitanya T K  *	This callback may sleep.
4135c3645eacSMichal Kazior  * @unassign_vif_chanctx: Notifies device driver about channel context being
4136c3645eacSMichal Kazior  *	unbound from vif.
4137dcae9e02SChaitanya T K  *	This callback may sleep.
41381a5f0c13SLuciano Coelho  * @switch_vif_chanctx: switch a number of vifs from one chanctx to
41391a5f0c13SLuciano Coelho  *	another, as specified in the list of
41401a5f0c13SLuciano Coelho  *	@ieee80211_vif_chanctx_switch passed to the driver, according
41411a5f0c13SLuciano Coelho  *	to the mode defined in &ieee80211_chanctx_switch_mode.
4142dcae9e02SChaitanya T K  *	This callback may sleep.
41431a5f0c13SLuciano Coelho  *
41441041638fSJohannes Berg  * @start_ap: Start operation on the AP interface, this is called after all the
41451041638fSJohannes Berg  *	information in bss_conf is set and beacon can be retrieved. A channel
41461041638fSJohannes Berg  *	context is bound before this is called. Note that if the driver uses
41471041638fSJohannes Berg  *	software scan or ROC, this (and @stop_ap) isn't called when the AP is
41481041638fSJohannes Berg  *	just "paused" for scanning/ROC, which is indicated by the beacon being
41491041638fSJohannes Berg  *	disabled/enabled via @bss_info_changed.
41501041638fSJohannes Berg  * @stop_ap: Stop operation on the AP interface.
41519214ad7fSJohannes Berg  *
4152cf2c92d8SEliad Peller  * @reconfig_complete: Called after a call to ieee80211_restart_hw() and
4153cf2c92d8SEliad Peller  *	during resume, when the reconfiguration has completed.
4154cf2c92d8SEliad Peller  *	This can help the driver implement the reconfiguration step (and
4155cf2c92d8SEliad Peller  *	indicate mac80211 is ready to receive frames).
4156cf2c92d8SEliad Peller  *	This callback may sleep.
41578f21b0adSJohannes Berg  *
4158a65240c1SJohannes Berg  * @ipv6_addr_change: IPv6 address assignment on the given interface changed.
4159a65240c1SJohannes Berg  *	Currently, this is only called for managed or P2P client interfaces.
4160a65240c1SJohannes Berg  *	This callback is optional; it must not sleep.
416173da7d5bSSimon Wunderlich  *
416273da7d5bSSimon Wunderlich  * @channel_switch_beacon: Starts a channel switch to a new channel.
416373da7d5bSSimon Wunderlich  *	Beacons are modified to include CSA or ECSA IEs before calling this
416473da7d5bSSimon Wunderlich  *	function. The corresponding count fields in these IEs must be
416566e01cf9SLuciano Coelho  *	decremented, and when they reach 1 the driver must call
416673da7d5bSSimon Wunderlich  *	ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get()
416773da7d5bSSimon Wunderlich  *	get the csa counter decremented by mac80211, but must check if it is
41688552a434SJohn Crispin  *	1 using ieee80211_beacon_counter_is_complete() after the beacon has been
416973da7d5bSSimon Wunderlich  *	transmitted and then call ieee80211_csa_finish().
417066e01cf9SLuciano Coelho  *	If the CSA count starts as zero or 1, this function will not be called,
417166e01cf9SLuciano Coelho  *	since there won't be any time to beacon before the switch anyway.
41726d027bccSLuciano Coelho  * @pre_channel_switch: This is an optional callback that is called
41736d027bccSLuciano Coelho  *	before a channel switch procedure is started (ie. when a STA
41749332ef9dSMasahiro Yamada  *	gets a CSA or a userspace initiated channel-switch), allowing
41756d027bccSLuciano Coelho  *	the driver to prepare for the channel switch.
4176f1d65583SLuciano Coelho  * @post_channel_switch: This is an optional callback that is called
4177f1d65583SLuciano Coelho  *	after a channel switch procedure is completed, allowing the
4178f1d65583SLuciano Coelho  *	driver to go back to a normal configuration.
4179b9cc81d8SSara Sharon  * @abort_channel_switch: This is an optional callback that is called
4180b9cc81d8SSara Sharon  *	when channel switch procedure was completed, allowing the
4181b9cc81d8SSara Sharon  *	driver to go back to a normal configuration.
4182fafd2bceSSara Sharon  * @channel_switch_rx_beacon: This is an optional callback that is called
4183fafd2bceSSara Sharon  *	when channel switch procedure is in progress and additional beacon with
4184fafd2bceSSara Sharon  *	CSA IE was received, allowing driver to track changes in count.
418555fff501SJohannes Berg  * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
418655fff501SJohannes Berg  *	information in bss_conf is set up and the beacon can be retrieved. A
418755fff501SJohannes Berg  *	channel context is bound before this is called.
418855fff501SJohannes Berg  * @leave_ibss: Leave the IBSS again.
4189cca674d4SAntonio Quartulli  *
4190cca674d4SAntonio Quartulli  * @get_expected_throughput: extract the expected throughput towards the
4191cca674d4SAntonio Quartulli  *	specified station. The returned value is expressed in Kbps. It returns 0
4192cca674d4SAntonio Quartulli  *	if the RC algorithm does not have proper data to provide.
41935b3dc42bSFelix Fietkau  *
41945b3dc42bSFelix Fietkau  * @get_txpower: get current maximum tx power (in dBm) based on configuration
41955b3dc42bSFelix Fietkau  *	and hardware limits.
4196a7a6bdd0SArik Nemtsov  *
4197a7a6bdd0SArik Nemtsov  * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
4198a7a6bdd0SArik Nemtsov  *	is responsible for continually initiating channel-switching operations
4199a7a6bdd0SArik Nemtsov  *	and returning to the base channel for communication with the AP. The
4200a7a6bdd0SArik Nemtsov  *	driver receives a channel-switch request template and the location of
4201a7a6bdd0SArik Nemtsov  *	the switch-timing IE within the template as part of the invocation.
4202a7a6bdd0SArik Nemtsov  *	The template is valid only within the call, and the driver can
4203a7a6bdd0SArik Nemtsov  *	optionally copy the skb for further re-use.
4204a7a6bdd0SArik Nemtsov  * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
4205a7a6bdd0SArik Nemtsov  *	peers must be on the base channel when the call completes.
42068a4d32f3SArik Nemtsov  * @tdls_recv_channel_switch: a TDLS channel-switch related frame (request or
42078a4d32f3SArik Nemtsov  *	response) has been received from a remote peer. The driver gets
42088a4d32f3SArik Nemtsov  *	parameters parsed from the incoming frame and may use them to continue
42098a4d32f3SArik Nemtsov  *	an ongoing channel-switch operation. In addition, a channel-switch
42108a4d32f3SArik Nemtsov  *	response template is provided, together with the location of the
42118a4d32f3SArik Nemtsov  *	switch-timing IE within the template. The skb can only be used within
42128a4d32f3SArik Nemtsov  *	the function call.
4213ba8c3d6fSFelix Fietkau  *
4214ba8c3d6fSFelix Fietkau  * @wake_tx_queue: Called when new packets have been added to the queue.
4215f59374ebSSara Sharon  * @sync_rx_queues: Process all pending frames in RSS queues. This is a
4216f59374ebSSara Sharon  *	synchronization which is needed in case driver has in its RSS queues
4217f59374ebSSara Sharon  *	pending frames that were received prior to the control path action
4218f59374ebSSara Sharon  *	currently taken (e.g. disassociation) but are not processed yet.
4219708d50edSAyala Beker  *
4220708d50edSAyala Beker  * @start_nan: join an existing NAN cluster, or create a new one.
4221708d50edSAyala Beker  * @stop_nan: leave the NAN cluster.
42225953ff6dSAyala Beker  * @nan_change_conf: change NAN configuration. The data in cfg80211_nan_conf
42235953ff6dSAyala Beker  *	contains full new configuration and changes specify which parameters
42245953ff6dSAyala Beker  *	are changed with respect to the last NAN config.
42255953ff6dSAyala Beker  *	The driver gets both full configuration and the changed parameters since
42265953ff6dSAyala Beker  *	some devices may need the full configuration while others need only the
42275953ff6dSAyala Beker  *	changed parameters.
4228167e33f4SAyala Beker  * @add_nan_func: Add a NAN function. Returns 0 on success. The data in
4229167e33f4SAyala Beker  *	cfg80211_nan_func must not be referenced outside the scope of
4230167e33f4SAyala Beker  *	this call.
4231167e33f4SAyala Beker  * @del_nan_func: Remove a NAN function. The driver must call
4232167e33f4SAyala Beker  *	ieee80211_nan_func_terminated() with
4233167e33f4SAyala Beker  *	NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
42349739fe29SSara Sharon  * @can_aggregate_in_amsdu: Called in order to determine if HW supports
42359739fe29SSara Sharon  *	aggregating two specific frames in the same A-MSDU. The relation
42369739fe29SSara Sharon  *	between the skbs should be symmetric and transitive. Note that while
42379739fe29SSara Sharon  *	skb is always a real frame, head may or may not be an A-MSDU.
4238bc847970SPradeep Kumar Chitrapu  * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
4239bc847970SPradeep Kumar Chitrapu  *	Statistics should be cumulative, currently no way to reset is provided.
4240cee7013bSJohannes Berg  *
4241cee7013bSJohannes Berg  * @start_pmsr: start peer measurement (e.g. FTM) (this call can sleep)
4242cee7013bSJohannes Berg  * @abort_pmsr: abort peer measurement (this call can sleep)
4243370f51d5STamizh chelvam  * @set_tid_config: Apply TID specific configurations. This callback may sleep.
4244370f51d5STamizh chelvam  * @reset_tid_config: Reset TID specific configuration for the peer.
4245370f51d5STamizh chelvam  *	This callback may sleep.
42467fba53ebSJohannes Berg  * @update_vif_offload: Update virtual interface offload flags
42476aea26ceSFelix Fietkau  *	This callback may sleep.
42481ff4e8f2SFelix Fietkau  * @sta_set_4addr: Called to notify the driver when a station starts/stops using
42491ff4e8f2SFelix Fietkau  *	4-address mode
425070b6ff35SJohannes Berg  * @set_sar_specs: Update the SAR (TX power) settings.
425180a915ecSFelix Fietkau  * @sta_set_decap_offload: Called to notify the driver when a station is allowed
425280a915ecSFelix Fietkau  *	to use rx decapsulation offload
4253f5a4c24eSLorenzo Bianconi  * @add_twt_setup: Update hw with TWT agreement parameters received from the peer.
4254f5a4c24eSLorenzo Bianconi  *	This callback allows the hw to check if requested parameters
4255f5a4c24eSLorenzo Bianconi  *	are supported and if there is enough room for a new agreement.
4256f5a4c24eSLorenzo Bianconi  *	The hw is expected to set agreement result in the req_type field of
4257f5a4c24eSLorenzo Bianconi  *	twt structure.
4258f5a4c24eSLorenzo Bianconi  * @twt_teardown_request: Update the hw with TWT teardown request received
4259f5a4c24eSLorenzo Bianconi  *	from the peer.
4260a95bfb87SLorenzo Bianconi  * @set_radar_background: Configure dedicated offchannel chain available for
4261237337c2SLorenzo Bianconi  *	radar/CAC detection on some hw. This chain can't be used to transmit
4262237337c2SLorenzo Bianconi  *	or receive frames and it is bounded to a running wdev.
4263a95bfb87SLorenzo Bianconi  *	Background radar/CAC detection allows to avoid the CAC downtime
4264237337c2SLorenzo Bianconi  *	switching to a different channel during CAC detection on the selected
4265237337c2SLorenzo Bianconi  *	radar channel.
4266237337c2SLorenzo Bianconi  *	The caller is expected to set chandef pointer to NULL in order to
4267a95bfb87SLorenzo Bianconi  *	disable background CAC/radar detection.
4268d787a3e3SFelix Fietkau  * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to
4269d787a3e3SFelix Fietkau  *	resolve a path for hardware flow offloading
4270d8787ec6SJohannes Berg  * @change_vif_links: Change the valid links on an interface, note that while
4271d8787ec6SJohannes Berg  *	removing the old link information is still valid (link_conf pointer),
4272d8787ec6SJohannes Berg  *	but may immediately disappear after the function returns. The old or
4273d8787ec6SJohannes Berg  *	new links bitmaps may be 0 if going from/to a non-MLO situation.
42747f884baaSJohannes Berg  *	The @old array contains pointers to the old bss_conf structures
4275d8787ec6SJohannes Berg  *	that were already removed, in case they're needed.
4276d8787ec6SJohannes Berg  *	This callback can sleep.
4277cb71f1d1SJohannes Berg  * @change_sta_links: Change the valid links of a station, similar to
4278cb71f1d1SJohannes Berg  *	@change_vif_links. This callback can sleep.
4279cb71f1d1SJohannes Berg  *	Note that a sta can also be inserted or removed with valid links,
4280cb71f1d1SJohannes Berg  *	i.e. passed to @sta_add/@sta_state with sta->valid_links not zero.
4281cb71f1d1SJohannes Berg  *	In fact, cannot change from having valid_links and not having them.
428281202305SAvraham Stern  * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. This is
428381202305SAvraham Stern  *	not restored at HW reset by mac80211 so drivers need to take care of
428481202305SAvraham Stern  *	that.
428561587f15SFelix Fietkau  * @net_setup_tc: Called from .ndo_setup_tc in order to prepare hardware
428661587f15SFelix Fietkau  *	flow offloading for flows originating from the vif.
428761587f15SFelix Fietkau  *	Note that the driver must not assume that the vif driver_data is valid
428861587f15SFelix Fietkau  *	at this point, since the callback can be called during netdev teardown.
42898f20fc24SJohannes Berg  */
429075a5f0ccSJohannes Berg struct ieee80211_ops {
429136323f81SThomas Huehn 	void (*tx)(struct ieee80211_hw *hw,
429236323f81SThomas Huehn 		   struct ieee80211_tx_control *control,
429336323f81SThomas Huehn 		   struct sk_buff *skb);
429475a5f0ccSJohannes Berg 	int (*start)(struct ieee80211_hw *hw);
429575a5f0ccSJohannes Berg 	void (*stop)(struct ieee80211_hw *hw);
4296eecc4800SJohannes Berg #ifdef CONFIG_PM
4297eecc4800SJohannes Berg 	int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
4298eecc4800SJohannes Berg 	int (*resume)(struct ieee80211_hw *hw);
42996d52563fSJohannes Berg 	void (*set_wakeup)(struct ieee80211_hw *hw, bool enabled);
4300eecc4800SJohannes Berg #endif
430175a5f0ccSJohannes Berg 	int (*add_interface)(struct ieee80211_hw *hw,
43021ed32e4fSJohannes Berg 			     struct ieee80211_vif *vif);
430334d4bc4dSJohannes Berg 	int (*change_interface)(struct ieee80211_hw *hw,
430434d4bc4dSJohannes Berg 				struct ieee80211_vif *vif,
43052ca27bcfSJohannes Berg 				enum nl80211_iftype new_type, bool p2p);
430675a5f0ccSJohannes Berg 	void (*remove_interface)(struct ieee80211_hw *hw,
43071ed32e4fSJohannes Berg 				 struct ieee80211_vif *vif);
4308e8975581SJohannes Berg 	int (*config)(struct ieee80211_hw *hw, u32 changed);
4309471b3efdSJohannes Berg 	void (*bss_info_changed)(struct ieee80211_hw *hw,
4310471b3efdSJohannes Berg 				 struct ieee80211_vif *vif,
4311471b3efdSJohannes Berg 				 struct ieee80211_bss_conf *info,
43127b7090b4SJohannes Berg 				 u64 changed);
43137b7090b4SJohannes Berg 	void (*vif_cfg_changed)(struct ieee80211_hw *hw,
43147b7090b4SJohannes Berg 				struct ieee80211_vif *vif,
43157b7090b4SJohannes Berg 				u64 changed);
43167b7090b4SJohannes Berg 	void (*link_info_changed)(struct ieee80211_hw *hw,
43177b7090b4SJohannes Berg 				  struct ieee80211_vif *vif,
4318d8675a63SJohannes Berg 				  struct ieee80211_bss_conf *info,
4319d8675a63SJohannes Berg 				  u64 changed);
4320b2abb6e2SJohannes Berg 
4321ae7ba17bSShaul Triebitz 	int (*start_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4322b327c84cSGregory Greenman 			struct ieee80211_bss_conf *link_conf);
4323ae7ba17bSShaul Triebitz 	void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4324b327c84cSGregory Greenman 			struct ieee80211_bss_conf *link_conf);
43251041638fSJohannes Berg 
43263ac64beeSJohannes Berg 	u64 (*prepare_multicast)(struct ieee80211_hw *hw,
432722bedad3SJiri Pirko 				 struct netdev_hw_addr_list *mc_list);
432875a5f0ccSJohannes Berg 	void (*configure_filter)(struct ieee80211_hw *hw,
432975a5f0ccSJohannes Berg 				 unsigned int changed_flags,
433075a5f0ccSJohannes Berg 				 unsigned int *total_flags,
43313ac64beeSJohannes Berg 				 u64 multicast);
43321b09b556SAndrei Otcheretianski 	void (*config_iface_filter)(struct ieee80211_hw *hw,
43331b09b556SAndrei Otcheretianski 				    struct ieee80211_vif *vif,
43341b09b556SAndrei Otcheretianski 				    unsigned int filter_flags,
43351b09b556SAndrei Otcheretianski 				    unsigned int changed_flags);
433617741cdcSJohannes Berg 	int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
433717741cdcSJohannes Berg 		       bool set);
4338ea49c359SJohannes Berg 	int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
4339dc822b5dSJohannes Berg 		       struct ieee80211_vif *vif, struct ieee80211_sta *sta,
434011a843b7SJohannes Berg 		       struct ieee80211_key_conf *key);
43419ae4fda3SEmmanuel Grumbach 	void (*update_tkip_key)(struct ieee80211_hw *hw,
4342b3fbdcf4SJohannes Berg 				struct ieee80211_vif *vif,
4343b3fbdcf4SJohannes Berg 				struct ieee80211_key_conf *conf,
4344b3fbdcf4SJohannes Berg 				struct ieee80211_sta *sta,
43459ae4fda3SEmmanuel Grumbach 				u32 iv32, u16 *phase1key);
4346c68f4b89SJohannes Berg 	void (*set_rekey_data)(struct ieee80211_hw *hw,
4347c68f4b89SJohannes Berg 			       struct ieee80211_vif *vif,
4348c68f4b89SJohannes Berg 			       struct cfg80211_gtk_rekey_data *data);
4349de5fad81SYoni Divinsky 	void (*set_default_unicast_key)(struct ieee80211_hw *hw,
4350de5fad81SYoni Divinsky 					struct ieee80211_vif *vif, int idx);
4351a060bbfeSJohannes Berg 	int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4352c56ef672SDavid Spinadel 		       struct ieee80211_scan_request *req);
4353b856439bSEliad Peller 	void (*cancel_hw_scan)(struct ieee80211_hw *hw,
4354b856439bSEliad Peller 			       struct ieee80211_vif *vif);
435579f460caSLuciano Coelho 	int (*sched_scan_start)(struct ieee80211_hw *hw,
435679f460caSLuciano Coelho 				struct ieee80211_vif *vif,
435779f460caSLuciano Coelho 				struct cfg80211_sched_scan_request *req,
4358633e2713SDavid Spinadel 				struct ieee80211_scan_ies *ies);
435937e3308cSJohannes Berg 	int (*sched_scan_stop)(struct ieee80211_hw *hw,
436079f460caSLuciano Coelho 			       struct ieee80211_vif *vif);
4361a344d677SJohannes Berg 	void (*sw_scan_start)(struct ieee80211_hw *hw,
4362a344d677SJohannes Berg 			      struct ieee80211_vif *vif,
4363a344d677SJohannes Berg 			      const u8 *mac_addr);
4364a344d677SJohannes Berg 	void (*sw_scan_complete)(struct ieee80211_hw *hw,
4365a344d677SJohannes Berg 				 struct ieee80211_vif *vif);
4366f0706e82SJiri Benc 	int (*get_stats)(struct ieee80211_hw *hw,
4367f0706e82SJiri Benc 			 struct ieee80211_low_level_stats *stats);
43689352c19fSJohannes Berg 	void (*get_key_seq)(struct ieee80211_hw *hw,
43699352c19fSJohannes Berg 			    struct ieee80211_key_conf *key,
43709352c19fSJohannes Berg 			    struct ieee80211_key_seq *seq);
4371f23a4780SArik Nemtsov 	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
4372f0706e82SJiri Benc 	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
437334e89507SJohannes Berg 	int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
437434e89507SJohannes Berg 		       struct ieee80211_sta *sta);
437534e89507SJohannes Berg 	int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
437634e89507SJohannes Berg 			  struct ieee80211_sta *sta);
437777d2ece6SSujith Manoharan #ifdef CONFIG_MAC80211_DEBUGFS
4378170cd6a6SBenjamin Berg 	void (*link_add_debugfs)(struct ieee80211_hw *hw,
4379170cd6a6SBenjamin Berg 				 struct ieee80211_vif *vif,
4380170cd6a6SBenjamin Berg 				 struct ieee80211_bss_conf *link_conf,
4381170cd6a6SBenjamin Berg 				 struct dentry *dir);
438277d2ece6SSujith Manoharan 	void (*sta_add_debugfs)(struct ieee80211_hw *hw,
438377d2ece6SSujith Manoharan 				struct ieee80211_vif *vif,
438477d2ece6SSujith Manoharan 				struct ieee80211_sta *sta,
438577d2ece6SSujith Manoharan 				struct dentry *dir);
4386d2caad52SBenjamin Berg 	void (*link_sta_add_debugfs)(struct ieee80211_hw *hw,
4387d2caad52SBenjamin Berg 				     struct ieee80211_vif *vif,
4388d2caad52SBenjamin Berg 				     struct ieee80211_link_sta *link_sta,
4389d2caad52SBenjamin Berg 				     struct dentry *dir);
439077d2ece6SSujith Manoharan #endif
439132bfd35dSJohannes Berg 	void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
439217741cdcSJohannes Berg 			enum sta_notify_cmd, struct ieee80211_sta *sta);
4393ba905bf4SAshok Raj Nagarajan 	int (*sta_set_txpwr)(struct ieee80211_hw *hw,
4394ba905bf4SAshok Raj Nagarajan 			     struct ieee80211_vif *vif,
4395ba905bf4SAshok Raj Nagarajan 			     struct ieee80211_sta *sta);
4396f09603a2SJohannes Berg 	int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4397f09603a2SJohannes Berg 			 struct ieee80211_sta *sta,
4398f09603a2SJohannes Berg 			 enum ieee80211_sta_state old_state,
4399f09603a2SJohannes Berg 			 enum ieee80211_sta_state new_state);
44006a9d1b91SJohannes Berg 	void (*sta_pre_rcu_remove)(struct ieee80211_hw *hw,
44016a9d1b91SJohannes Berg 				   struct ieee80211_vif *vif,
44026a9d1b91SJohannes Berg 				   struct ieee80211_sta *sta);
44038f727ef3SJohannes Berg 	void (*sta_rc_update)(struct ieee80211_hw *hw,
44048f727ef3SJohannes Berg 			      struct ieee80211_vif *vif,
44058f727ef3SJohannes Berg 			      struct ieee80211_sta *sta,
44068f727ef3SJohannes Berg 			      u32 changed);
4407f815e2b3SJohannes Berg 	void (*sta_rate_tbl_update)(struct ieee80211_hw *hw,
4408f815e2b3SJohannes Berg 				    struct ieee80211_vif *vif,
4409f815e2b3SJohannes Berg 				    struct ieee80211_sta *sta);
44102b9a7e1bSJohannes Berg 	void (*sta_statistics)(struct ieee80211_hw *hw,
44112b9a7e1bSJohannes Berg 			       struct ieee80211_vif *vif,
44122b9a7e1bSJohannes Berg 			       struct ieee80211_sta *sta,
44132b9a7e1bSJohannes Berg 			       struct station_info *sinfo);
44148a3a3c85SEliad Peller 	int (*conf_tx)(struct ieee80211_hw *hw,
4415b3e2130bSJohannes Berg 		       struct ieee80211_vif *vif,
4416b3e2130bSJohannes Berg 		       unsigned int link_id, u16 ac,
4417f0706e82SJiri Benc 		       const struct ieee80211_tx_queue_params *params);
441837a41b4aSEliad Peller 	u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
441937a41b4aSEliad Peller 	void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
442037a41b4aSEliad Peller 			u64 tsf);
4421354d381bSPedersen, Thomas 	void (*offset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4422354d381bSPedersen, Thomas 			   s64 offset);
442337a41b4aSEliad Peller 	void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
4424f0706e82SJiri Benc 	int (*tx_last_beacon)(struct ieee80211_hw *hw);
442557eeb208SJohannes Berg 
442657eeb208SJohannes Berg 	/**
442757eeb208SJohannes Berg 	 * @ampdu_action:
442857eeb208SJohannes Berg 	 * Perform a certain A-MPDU action.
442957eeb208SJohannes Berg 	 * The RA/TID combination determines the destination and TID we want
443057eeb208SJohannes Berg 	 * the ampdu action to be performed for. The action is defined through
443157eeb208SJohannes Berg 	 * ieee80211_ampdu_mlme_action.
443257eeb208SJohannes Berg 	 * When the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL the driver
443357eeb208SJohannes Berg 	 * may neither send aggregates containing more subframes than @buf_size
443457eeb208SJohannes Berg 	 * nor send aggregates in a way that lost frames would exceed the
443557eeb208SJohannes Berg 	 * buffer size. If just limiting the aggregate size, this would be
443657eeb208SJohannes Berg 	 * possible with a buf_size of 8:
443757eeb208SJohannes Berg 	 *
443857eeb208SJohannes Berg 	 * - ``TX: 1.....7``
443957eeb208SJohannes Berg 	 * - ``RX:  2....7`` (lost frame #1)
444057eeb208SJohannes Berg 	 * - ``TX:        8..1...``
444157eeb208SJohannes Berg 	 *
444257eeb208SJohannes Berg 	 * which is invalid since #1 was now re-transmitted well past the
444357eeb208SJohannes Berg 	 * buffer size of 8. Correct ways to retransmit #1 would be:
444457eeb208SJohannes Berg 	 *
444557eeb208SJohannes Berg 	 * - ``TX:        1   or``
444657eeb208SJohannes Berg 	 * - ``TX:        18  or``
444757eeb208SJohannes Berg 	 * - ``TX:        81``
444857eeb208SJohannes Berg 	 *
444957eeb208SJohannes Berg 	 * Even ``189`` would be wrong since 1 could be lost again.
445057eeb208SJohannes Berg 	 *
44512ce113deSJohannes Berg 	 * Returns a negative error code on failure. The driver may return
44522ce113deSJohannes Berg 	 * %IEEE80211_AMPDU_TX_START_IMMEDIATE for %IEEE80211_AMPDU_TX_START
44532ce113deSJohannes Berg 	 * if the session can start immediately.
44542ce113deSJohannes Berg 	 *
445557eeb208SJohannes Berg 	 * The callback can sleep.
445657eeb208SJohannes Berg 	 */
44571b7d03acSRon Rindjunsky 	int (*ampdu_action)(struct ieee80211_hw *hw,
4458c951ad35SJohannes Berg 			    struct ieee80211_vif *vif,
445950ea05efSSara Sharon 			    struct ieee80211_ampdu_params *params);
44601289723eSHolger Schurig 	int (*get_survey)(struct ieee80211_hw *hw, int idx,
44611289723eSHolger Schurig 		struct survey_info *survey);
44621f87f7d3SJohannes Berg 	void (*rfkill_poll)(struct ieee80211_hw *hw);
4463a4bcaf55SLorenzo Bianconi 	void (*set_coverage_class)(struct ieee80211_hw *hw, s16 coverage_class);
4464aff89a9bSJohannes Berg #ifdef CONFIG_NL80211_TESTMODE
446552981cd7SDavid Spinadel 	int (*testmode_cmd)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
446652981cd7SDavid Spinadel 			    void *data, int len);
446771063f0eSWey-Yi Guy 	int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb,
446871063f0eSWey-Yi Guy 			     struct netlink_callback *cb,
446971063f0eSWey-Yi Guy 			     void *data, int len);
4470aff89a9bSJohannes Berg #endif
447177be2c54SEmmanuel Grumbach 	void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
447277be2c54SEmmanuel Grumbach 		      u32 queues, bool drop);
4473d00800a2SJohannes Berg 	void (*flush_sta)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4474d00800a2SJohannes Berg 			  struct ieee80211_sta *sta);
44755ce6e438SJohannes Berg 	void (*channel_switch)(struct ieee80211_hw *hw,
44760f791eb4SLuciano Coelho 			       struct ieee80211_vif *vif,
44775ce6e438SJohannes Berg 			       struct ieee80211_channel_switch *ch_switch);
447815d96753SBruno Randolf 	int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
447915d96753SBruno Randolf 	int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
448021f83589SJohannes Berg 
448121f83589SJohannes Berg 	int (*remain_on_channel)(struct ieee80211_hw *hw,
448249884568SEliad Peller 				 struct ieee80211_vif *vif,
448321f83589SJohannes Berg 				 struct ieee80211_channel *chan,
4484d339d5caSIlan Peer 				 int duration,
4485d339d5caSIlan Peer 				 enum ieee80211_roc_type type);
44865db4c4b9SEmmanuel Grumbach 	int (*cancel_remain_on_channel)(struct ieee80211_hw *hw,
44875db4c4b9SEmmanuel Grumbach 					struct ieee80211_vif *vif);
448838c09159SJohn W. Linville 	int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
448938c09159SJohn W. Linville 	void (*get_ringparam)(struct ieee80211_hw *hw,
449038c09159SJohn W. Linville 			      u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
4491e8306f98SVivek Natarajan 	bool (*tx_frames_pending)(struct ieee80211_hw *hw);
4492bdbfd6b5SSujith Manoharan 	int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4493bdbfd6b5SSujith Manoharan 				const struct cfg80211_bitrate_mask *mask);
4494a8182929SEmmanuel Grumbach 	void (*event_callback)(struct ieee80211_hw *hw,
4495887da917SEmmanuel Grumbach 			       struct ieee80211_vif *vif,
4496a8182929SEmmanuel Grumbach 			       const struct ieee80211_event *event);
44974049e09aSJohannes Berg 
449840b96408SJohannes Berg 	void (*allow_buffered_frames)(struct ieee80211_hw *hw,
449940b96408SJohannes Berg 				      struct ieee80211_sta *sta,
450040b96408SJohannes Berg 				      u16 tids, int num_frames,
450140b96408SJohannes Berg 				      enum ieee80211_frame_release_type reason,
450240b96408SJohannes Berg 				      bool more_data);
45034049e09aSJohannes Berg 	void (*release_buffered_frames)(struct ieee80211_hw *hw,
45044049e09aSJohannes Berg 					struct ieee80211_sta *sta,
45054049e09aSJohannes Berg 					u16 tids, int num_frames,
45064049e09aSJohannes Berg 					enum ieee80211_frame_release_type reason,
45074049e09aSJohannes Berg 					bool more_data);
4508e352114fSBen Greear 
4509e352114fSBen Greear 	int	(*get_et_sset_count)(struct ieee80211_hw *hw,
4510e352114fSBen Greear 				     struct ieee80211_vif *vif, int sset);
4511e352114fSBen Greear 	void	(*get_et_stats)(struct ieee80211_hw *hw,
4512e352114fSBen Greear 				struct ieee80211_vif *vif,
4513e352114fSBen Greear 				struct ethtool_stats *stats, u64 *data);
4514e352114fSBen Greear 	void	(*get_et_strings)(struct ieee80211_hw *hw,
4515e352114fSBen Greear 				  struct ieee80211_vif *vif,
4516e352114fSBen Greear 				  u32 sset, u8 *data);
4517a1845fc7SJohannes Berg 
4518a1845fc7SJohannes Berg 	void	(*mgd_prepare_tx)(struct ieee80211_hw *hw,
4519d4e36e55SIlan Peer 				  struct ieee80211_vif *vif,
452015fae341SJohannes Berg 				  struct ieee80211_prep_tx_info *info);
452115fae341SJohannes Berg 	void	(*mgd_complete_tx)(struct ieee80211_hw *hw,
452215fae341SJohannes Berg 				   struct ieee80211_vif *vif,
452315fae341SJohannes Berg 				   struct ieee80211_prep_tx_info *info);
4524c3645eacSMichal Kazior 
4525ee10f2c7SArik Nemtsov 	void	(*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
4526ee10f2c7SArik Nemtsov 					     struct ieee80211_vif *vif);
4527ee10f2c7SArik Nemtsov 
4528c3645eacSMichal Kazior 	int (*add_chanctx)(struct ieee80211_hw *hw,
4529c3645eacSMichal Kazior 			   struct ieee80211_chanctx_conf *ctx);
4530c3645eacSMichal Kazior 	void (*remove_chanctx)(struct ieee80211_hw *hw,
4531c3645eacSMichal Kazior 			       struct ieee80211_chanctx_conf *ctx);
4532c3645eacSMichal Kazior 	void (*change_chanctx)(struct ieee80211_hw *hw,
4533c3645eacSMichal Kazior 			       struct ieee80211_chanctx_conf *ctx,
4534c3645eacSMichal Kazior 			       u32 changed);
4535c3645eacSMichal Kazior 	int (*assign_vif_chanctx)(struct ieee80211_hw *hw,
4536c3645eacSMichal Kazior 				  struct ieee80211_vif *vif,
4537727eff4dSGregory Greenman 				  struct ieee80211_bss_conf *link_conf,
4538c3645eacSMichal Kazior 				  struct ieee80211_chanctx_conf *ctx);
4539c3645eacSMichal Kazior 	void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
4540c3645eacSMichal Kazior 				     struct ieee80211_vif *vif,
4541727eff4dSGregory Greenman 				     struct ieee80211_bss_conf *link_conf,
4542c3645eacSMichal Kazior 				     struct ieee80211_chanctx_conf *ctx);
45431a5f0c13SLuciano Coelho 	int (*switch_vif_chanctx)(struct ieee80211_hw *hw,
45441a5f0c13SLuciano Coelho 				  struct ieee80211_vif_chanctx_switch *vifs,
45451a5f0c13SLuciano Coelho 				  int n_vifs,
45461a5f0c13SLuciano Coelho 				  enum ieee80211_chanctx_switch_mode mode);
45479214ad7fSJohannes Berg 
4548cf2c92d8SEliad Peller 	void (*reconfig_complete)(struct ieee80211_hw *hw,
4549cf2c92d8SEliad Peller 				  enum ieee80211_reconfig_type reconfig_type);
4550a65240c1SJohannes Berg 
4551a65240c1SJohannes Berg #if IS_ENABLED(CONFIG_IPV6)
4552a65240c1SJohannes Berg 	void (*ipv6_addr_change)(struct ieee80211_hw *hw,
4553a65240c1SJohannes Berg 				 struct ieee80211_vif *vif,
4554a65240c1SJohannes Berg 				 struct inet6_dev *idev);
4555a65240c1SJohannes Berg #endif
455673da7d5bSSimon Wunderlich 	void (*channel_switch_beacon)(struct ieee80211_hw *hw,
455773da7d5bSSimon Wunderlich 				      struct ieee80211_vif *vif,
455873da7d5bSSimon Wunderlich 				      struct cfg80211_chan_def *chandef);
45596d027bccSLuciano Coelho 	int (*pre_channel_switch)(struct ieee80211_hw *hw,
45606d027bccSLuciano Coelho 				  struct ieee80211_vif *vif,
45616d027bccSLuciano Coelho 				  struct ieee80211_channel_switch *ch_switch);
456255fff501SJohannes Berg 
4563f1d65583SLuciano Coelho 	int (*post_channel_switch)(struct ieee80211_hw *hw,
4564f1d65583SLuciano Coelho 				   struct ieee80211_vif *vif);
4565b9cc81d8SSara Sharon 	void (*abort_channel_switch)(struct ieee80211_hw *hw,
4566b9cc81d8SSara Sharon 				     struct ieee80211_vif *vif);
4567fafd2bceSSara Sharon 	void (*channel_switch_rx_beacon)(struct ieee80211_hw *hw,
4568fafd2bceSSara Sharon 					 struct ieee80211_vif *vif,
4569fafd2bceSSara Sharon 					 struct ieee80211_channel_switch *ch_switch);
4570f1d65583SLuciano Coelho 
457155fff501SJohannes Berg 	int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
457255fff501SJohannes Berg 	void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
45732439ca04SMaxim Altshul 	u32 (*get_expected_throughput)(struct ieee80211_hw *hw,
45742439ca04SMaxim Altshul 				       struct ieee80211_sta *sta);
45755b3dc42bSFelix Fietkau 	int (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
45765b3dc42bSFelix Fietkau 			   int *dbm);
4577a7a6bdd0SArik Nemtsov 
4578a7a6bdd0SArik Nemtsov 	int (*tdls_channel_switch)(struct ieee80211_hw *hw,
4579a7a6bdd0SArik Nemtsov 				   struct ieee80211_vif *vif,
4580a7a6bdd0SArik Nemtsov 				   struct ieee80211_sta *sta, u8 oper_class,
4581a7a6bdd0SArik Nemtsov 				   struct cfg80211_chan_def *chandef,
45828a4d32f3SArik Nemtsov 				   struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie);
4583a7a6bdd0SArik Nemtsov 	void (*tdls_cancel_channel_switch)(struct ieee80211_hw *hw,
4584a7a6bdd0SArik Nemtsov 					   struct ieee80211_vif *vif,
4585a7a6bdd0SArik Nemtsov 					   struct ieee80211_sta *sta);
45868a4d32f3SArik Nemtsov 	void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
45878a4d32f3SArik Nemtsov 					 struct ieee80211_vif *vif,
45888a4d32f3SArik Nemtsov 					 struct ieee80211_tdls_ch_sw_params *params);
4589ba8c3d6fSFelix Fietkau 
4590e7881bd5SJohannes Berg 	void (*wake_tx_queue)(struct ieee80211_hw *hw,
4591e7881bd5SJohannes Berg 			      struct ieee80211_txq *txq);
4592f59374ebSSara Sharon 	void (*sync_rx_queues)(struct ieee80211_hw *hw);
4593708d50edSAyala Beker 
4594708d50edSAyala Beker 	int (*start_nan)(struct ieee80211_hw *hw,
4595708d50edSAyala Beker 			 struct ieee80211_vif *vif,
4596708d50edSAyala Beker 			 struct cfg80211_nan_conf *conf);
4597708d50edSAyala Beker 	int (*stop_nan)(struct ieee80211_hw *hw,
4598708d50edSAyala Beker 			struct ieee80211_vif *vif);
45995953ff6dSAyala Beker 	int (*nan_change_conf)(struct ieee80211_hw *hw,
46005953ff6dSAyala Beker 			       struct ieee80211_vif *vif,
46015953ff6dSAyala Beker 			       struct cfg80211_nan_conf *conf, u32 changes);
4602167e33f4SAyala Beker 	int (*add_nan_func)(struct ieee80211_hw *hw,
4603167e33f4SAyala Beker 			    struct ieee80211_vif *vif,
4604167e33f4SAyala Beker 			    const struct cfg80211_nan_func *nan_func);
4605167e33f4SAyala Beker 	void (*del_nan_func)(struct ieee80211_hw *hw,
4606167e33f4SAyala Beker 			    struct ieee80211_vif *vif,
4607167e33f4SAyala Beker 			    u8 instance_id);
46089739fe29SSara Sharon 	bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw,
46099739fe29SSara Sharon 				       struct sk_buff *head,
46109739fe29SSara Sharon 				       struct sk_buff *skb);
4611bc847970SPradeep Kumar Chitrapu 	int (*get_ftm_responder_stats)(struct ieee80211_hw *hw,
4612bc847970SPradeep Kumar Chitrapu 				       struct ieee80211_vif *vif,
4613bc847970SPradeep Kumar Chitrapu 				       struct cfg80211_ftm_responder_stats *ftm_stats);
4614cee7013bSJohannes Berg 	int (*start_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4615cee7013bSJohannes Berg 			  struct cfg80211_pmsr_request *request);
4616cee7013bSJohannes Berg 	void (*abort_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
4617cee7013bSJohannes Berg 			   struct cfg80211_pmsr_request *request);
4618370f51d5STamizh chelvam 	int (*set_tid_config)(struct ieee80211_hw *hw,
4619370f51d5STamizh chelvam 			      struct ieee80211_vif *vif,
4620370f51d5STamizh chelvam 			      struct ieee80211_sta *sta,
4621370f51d5STamizh chelvam 			      struct cfg80211_tid_config *tid_conf);
4622370f51d5STamizh chelvam 	int (*reset_tid_config)(struct ieee80211_hw *hw,
4623370f51d5STamizh chelvam 				struct ieee80211_vif *vif,
4624370f51d5STamizh chelvam 				struct ieee80211_sta *sta, u8 tids);
46256aea26ceSFelix Fietkau 	void (*update_vif_offload)(struct ieee80211_hw *hw,
46266aea26ceSFelix Fietkau 				   struct ieee80211_vif *vif);
46271ff4e8f2SFelix Fietkau 	void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
46281ff4e8f2SFelix Fietkau 			      struct ieee80211_sta *sta, bool enabled);
4629c534e093SCarl Huang 	int (*set_sar_specs)(struct ieee80211_hw *hw,
4630c534e093SCarl Huang 			     const struct cfg80211_sar_specs *sar);
463180a915ecSFelix Fietkau 	void (*sta_set_decap_offload)(struct ieee80211_hw *hw,
463280a915ecSFelix Fietkau 				      struct ieee80211_vif *vif,
463380a915ecSFelix Fietkau 				      struct ieee80211_sta *sta, bool enabled);
4634f5a4c24eSLorenzo Bianconi 	void (*add_twt_setup)(struct ieee80211_hw *hw,
4635f5a4c24eSLorenzo Bianconi 			      struct ieee80211_sta *sta,
4636f5a4c24eSLorenzo Bianconi 			      struct ieee80211_twt_setup *twt);
4637f5a4c24eSLorenzo Bianconi 	void (*twt_teardown_request)(struct ieee80211_hw *hw,
4638f5a4c24eSLorenzo Bianconi 				     struct ieee80211_sta *sta, u8 flowid);
4639a95bfb87SLorenzo Bianconi 	int (*set_radar_background)(struct ieee80211_hw *hw,
4640237337c2SLorenzo Bianconi 				    struct cfg80211_chan_def *chandef);
4641d787a3e3SFelix Fietkau 	int (*net_fill_forward_path)(struct ieee80211_hw *hw,
4642d787a3e3SFelix Fietkau 				     struct ieee80211_vif *vif,
4643d787a3e3SFelix Fietkau 				     struct ieee80211_sta *sta,
4644d787a3e3SFelix Fietkau 				     struct net_device_path_ctx *ctx,
4645d787a3e3SFelix Fietkau 				     struct net_device_path *path);
4646d8787ec6SJohannes Berg 	int (*change_vif_links)(struct ieee80211_hw *hw,
4647d8787ec6SJohannes Berg 				struct ieee80211_vif *vif,
4648d8787ec6SJohannes Berg 				u16 old_links, u16 new_links,
4649d8787ec6SJohannes Berg 				struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]);
4650cb71f1d1SJohannes Berg 	int (*change_sta_links)(struct ieee80211_hw *hw,
4651cb71f1d1SJohannes Berg 				struct ieee80211_vif *vif,
4652cb71f1d1SJohannes Berg 				struct ieee80211_sta *sta,
4653cb71f1d1SJohannes Berg 				u16 old_links, u16 new_links);
465481202305SAvraham Stern 	int (*set_hw_timestamp)(struct ieee80211_hw *hw,
465581202305SAvraham Stern 				struct ieee80211_vif *vif,
465681202305SAvraham Stern 				struct cfg80211_set_hw_timestamp *hwts);
465761587f15SFelix Fietkau 	int (*net_setup_tc)(struct ieee80211_hw *hw,
465861587f15SFelix Fietkau 			    struct ieee80211_vif *vif,
465961587f15SFelix Fietkau 			    struct net_device *dev,
466061587f15SFelix Fietkau 			    enum tc_setup_type type,
466161587f15SFelix Fietkau 			    void *type_data);
4662f0706e82SJiri Benc };
4663f0706e82SJiri Benc 
466475a5f0ccSJohannes Berg /**
4665ad28757eSBen Greear  * ieee80211_alloc_hw_nm - Allocate a new hardware device
4666ad28757eSBen Greear  *
4667ad28757eSBen Greear  * This must be called once for each hardware device. The returned pointer
4668ad28757eSBen Greear  * must be used to refer to this device when calling other functions.
4669ad28757eSBen Greear  * mac80211 allocates a private data area for the driver pointed to by
4670ad28757eSBen Greear  * @priv in &struct ieee80211_hw, the size of this area is given as
4671ad28757eSBen Greear  * @priv_data_len.
4672ad28757eSBen Greear  *
4673ad28757eSBen Greear  * @priv_data_len: length of private data
4674ad28757eSBen Greear  * @ops: callbacks for this device
4675ad28757eSBen Greear  * @requested_name: Requested name for this device.
4676ad28757eSBen Greear  *	NULL is valid value, and means use the default naming (phy%d)
4677ad28757eSBen Greear  *
4678ad28757eSBen Greear  * Return: A pointer to the new hardware device, or %NULL on error.
4679ad28757eSBen Greear  */
4680ad28757eSBen Greear struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
4681ad28757eSBen Greear 					   const struct ieee80211_ops *ops,
4682ad28757eSBen Greear 					   const char *requested_name);
4683ad28757eSBen Greear 
4684ad28757eSBen Greear /**
468575a5f0ccSJohannes Berg  * ieee80211_alloc_hw - Allocate a new hardware device
468675a5f0ccSJohannes Berg  *
468775a5f0ccSJohannes Berg  * This must be called once for each hardware device. The returned pointer
468875a5f0ccSJohannes Berg  * must be used to refer to this device when calling other functions.
468975a5f0ccSJohannes Berg  * mac80211 allocates a private data area for the driver pointed to by
469075a5f0ccSJohannes Berg  * @priv in &struct ieee80211_hw, the size of this area is given as
469175a5f0ccSJohannes Berg  * @priv_data_len.
469275a5f0ccSJohannes Berg  *
469375a5f0ccSJohannes Berg  * @priv_data_len: length of private data
469475a5f0ccSJohannes Berg  * @ops: callbacks for this device
46950ae997dcSYacine Belkadi  *
46960ae997dcSYacine Belkadi  * Return: A pointer to the new hardware device, or %NULL on error.
4697f0706e82SJiri Benc  */
4698ad28757eSBen Greear static inline
ieee80211_alloc_hw(size_t priv_data_len,const struct ieee80211_ops * ops)4699f0706e82SJiri Benc struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
4700ad28757eSBen Greear 					const struct ieee80211_ops *ops)
4701ad28757eSBen Greear {
4702ad28757eSBen Greear 	return ieee80211_alloc_hw_nm(priv_data_len, ops, NULL);
4703ad28757eSBen Greear }
4704f0706e82SJiri Benc 
470575a5f0ccSJohannes Berg /**
470675a5f0ccSJohannes Berg  * ieee80211_register_hw - Register hardware device
470775a5f0ccSJohannes Berg  *
4708dbbea671SJohannes Berg  * You must call this function before any other functions in
4709dbbea671SJohannes Berg  * mac80211. Note that before a hardware can be registered, you
4710dbbea671SJohannes Berg  * need to fill the contained wiphy's information.
471175a5f0ccSJohannes Berg  *
471275a5f0ccSJohannes Berg  * @hw: the device to register as returned by ieee80211_alloc_hw()
47130ae997dcSYacine Belkadi  *
47140ae997dcSYacine Belkadi  * Return: 0 on success. An error code otherwise.
471575a5f0ccSJohannes Berg  */
4716f0706e82SJiri Benc int ieee80211_register_hw(struct ieee80211_hw *hw);
4717f0706e82SJiri Benc 
4718e1e54068SJohannes Berg /**
4719e1e54068SJohannes Berg  * struct ieee80211_tpt_blink - throughput blink description
4720e1e54068SJohannes Berg  * @throughput: throughput in Kbit/sec
4721e1e54068SJohannes Berg  * @blink_time: blink time in milliseconds
4722e1e54068SJohannes Berg  *	(full cycle, ie. one off + one on period)
4723e1e54068SJohannes Berg  */
4724e1e54068SJohannes Berg struct ieee80211_tpt_blink {
4725e1e54068SJohannes Berg 	int throughput;
4726e1e54068SJohannes Berg 	int blink_time;
4727e1e54068SJohannes Berg };
4728e1e54068SJohannes Berg 
472967408c8cSJohannes Berg /**
473067408c8cSJohannes Berg  * enum ieee80211_tpt_led_trigger_flags - throughput trigger flags
473167408c8cSJohannes Berg  * @IEEE80211_TPT_LEDTRIG_FL_RADIO: enable blinking with radio
473267408c8cSJohannes Berg  * @IEEE80211_TPT_LEDTRIG_FL_WORK: enable blinking when working
473367408c8cSJohannes Berg  * @IEEE80211_TPT_LEDTRIG_FL_CONNECTED: enable blinking when at least one
473467408c8cSJohannes Berg  *	interface is connected in some way, including being an AP
473567408c8cSJohannes Berg  */
473667408c8cSJohannes Berg enum ieee80211_tpt_led_trigger_flags {
473767408c8cSJohannes Berg 	IEEE80211_TPT_LEDTRIG_FL_RADIO		= BIT(0),
473867408c8cSJohannes Berg 	IEEE80211_TPT_LEDTRIG_FL_WORK		= BIT(1),
473967408c8cSJohannes Berg 	IEEE80211_TPT_LEDTRIG_FL_CONNECTED	= BIT(2),
474067408c8cSJohannes Berg };
474167408c8cSJohannes Berg 
4742f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS
4743f5c4ae07SJohannes Berg const char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
4744f5c4ae07SJohannes Berg const char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
4745f5c4ae07SJohannes Berg const char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
4746f5c4ae07SJohannes Berg const char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
4747f5c4ae07SJohannes Berg const char *
4748f5c4ae07SJohannes Berg __ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
474910dd9b7cSJoe Perches 				   unsigned int flags,
4750e1e54068SJohannes Berg 				   const struct ieee80211_tpt_blink *blink_table,
4751e1e54068SJohannes Berg 				   unsigned int blink_table_len);
4752f0706e82SJiri Benc #endif
475375a5f0ccSJohannes Berg /**
475475a5f0ccSJohannes Berg  * ieee80211_get_tx_led_name - get name of TX LED
475575a5f0ccSJohannes Berg  *
475675a5f0ccSJohannes Berg  * mac80211 creates a transmit LED trigger for each wireless hardware
475775a5f0ccSJohannes Berg  * that can be used to drive LEDs if your driver registers a LED device.
475875a5f0ccSJohannes Berg  * This function returns the name (or %NULL if not configured for LEDs)
475975a5f0ccSJohannes Berg  * of the trigger so you can automatically link the LED device.
476075a5f0ccSJohannes Berg  *
476175a5f0ccSJohannes Berg  * @hw: the hardware to get the LED trigger name for
47620ae997dcSYacine Belkadi  *
47630ae997dcSYacine Belkadi  * Return: The name of the LED trigger. %NULL if not configured for LEDs.
476475a5f0ccSJohannes Berg  */
ieee80211_get_tx_led_name(struct ieee80211_hw * hw)4765f5c4ae07SJohannes Berg static inline const char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
4766f0706e82SJiri Benc {
4767f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS
4768f0706e82SJiri Benc 	return __ieee80211_get_tx_led_name(hw);
4769f0706e82SJiri Benc #else
4770f0706e82SJiri Benc 	return NULL;
4771f0706e82SJiri Benc #endif
4772f0706e82SJiri Benc }
4773f0706e82SJiri Benc 
477475a5f0ccSJohannes Berg /**
477575a5f0ccSJohannes Berg  * ieee80211_get_rx_led_name - get name of RX LED
477675a5f0ccSJohannes Berg  *
477775a5f0ccSJohannes Berg  * mac80211 creates a receive LED trigger for each wireless hardware
477875a5f0ccSJohannes Berg  * that can be used to drive LEDs if your driver registers a LED device.
477975a5f0ccSJohannes Berg  * This function returns the name (or %NULL if not configured for LEDs)
478075a5f0ccSJohannes Berg  * of the trigger so you can automatically link the LED device.
478175a5f0ccSJohannes Berg  *
478275a5f0ccSJohannes Berg  * @hw: the hardware to get the LED trigger name for
47830ae997dcSYacine Belkadi  *
47840ae997dcSYacine Belkadi  * Return: The name of the LED trigger. %NULL if not configured for LEDs.
478575a5f0ccSJohannes Berg  */
ieee80211_get_rx_led_name(struct ieee80211_hw * hw)4786f5c4ae07SJohannes Berg static inline const char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
4787f0706e82SJiri Benc {
4788f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS
4789f0706e82SJiri Benc 	return __ieee80211_get_rx_led_name(hw);
4790f0706e82SJiri Benc #else
4791f0706e82SJiri Benc 	return NULL;
4792f0706e82SJiri Benc #endif
4793f0706e82SJiri Benc }
4794f0706e82SJiri Benc 
4795cdcb006fSIvo van Doorn /**
4796cdcb006fSIvo van Doorn  * ieee80211_get_assoc_led_name - get name of association LED
4797cdcb006fSIvo van Doorn  *
4798cdcb006fSIvo van Doorn  * mac80211 creates a association LED trigger for each wireless hardware
4799cdcb006fSIvo van Doorn  * that can be used to drive LEDs if your driver registers a LED device.
4800cdcb006fSIvo van Doorn  * This function returns the name (or %NULL if not configured for LEDs)
4801cdcb006fSIvo van Doorn  * of the trigger so you can automatically link the LED device.
4802cdcb006fSIvo van Doorn  *
4803cdcb006fSIvo van Doorn  * @hw: the hardware to get the LED trigger name for
48040ae997dcSYacine Belkadi  *
48050ae997dcSYacine Belkadi  * Return: The name of the LED trigger. %NULL if not configured for LEDs.
4806cdcb006fSIvo van Doorn  */
ieee80211_get_assoc_led_name(struct ieee80211_hw * hw)4807f5c4ae07SJohannes Berg static inline const char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
480847f0c502SMichael Buesch {
480947f0c502SMichael Buesch #ifdef CONFIG_MAC80211_LEDS
481047f0c502SMichael Buesch 	return __ieee80211_get_assoc_led_name(hw);
481147f0c502SMichael Buesch #else
481247f0c502SMichael Buesch 	return NULL;
481347f0c502SMichael Buesch #endif
481447f0c502SMichael Buesch }
481547f0c502SMichael Buesch 
4816cdcb006fSIvo van Doorn /**
4817cdcb006fSIvo van Doorn  * ieee80211_get_radio_led_name - get name of radio LED
4818cdcb006fSIvo van Doorn  *
4819cdcb006fSIvo van Doorn  * mac80211 creates a radio change LED trigger for each wireless hardware
4820cdcb006fSIvo van Doorn  * that can be used to drive LEDs if your driver registers a LED device.
4821cdcb006fSIvo van Doorn  * This function returns the name (or %NULL if not configured for LEDs)
4822cdcb006fSIvo van Doorn  * of the trigger so you can automatically link the LED device.
4823cdcb006fSIvo van Doorn  *
4824cdcb006fSIvo van Doorn  * @hw: the hardware to get the LED trigger name for
48250ae997dcSYacine Belkadi  *
48260ae997dcSYacine Belkadi  * Return: The name of the LED trigger. %NULL if not configured for LEDs.
4827cdcb006fSIvo van Doorn  */
ieee80211_get_radio_led_name(struct ieee80211_hw * hw)4828f5c4ae07SJohannes Berg static inline const char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
4829cdcb006fSIvo van Doorn {
4830cdcb006fSIvo van Doorn #ifdef CONFIG_MAC80211_LEDS
4831cdcb006fSIvo van Doorn 	return __ieee80211_get_radio_led_name(hw);
4832cdcb006fSIvo van Doorn #else
4833cdcb006fSIvo van Doorn 	return NULL;
4834cdcb006fSIvo van Doorn #endif
4835cdcb006fSIvo van Doorn }
483647f0c502SMichael Buesch 
483775a5f0ccSJohannes Berg /**
4838e1e54068SJohannes Berg  * ieee80211_create_tpt_led_trigger - create throughput LED trigger
4839e1e54068SJohannes Berg  * @hw: the hardware to create the trigger for
484067408c8cSJohannes Berg  * @flags: trigger flags, see &enum ieee80211_tpt_led_trigger_flags
4841e1e54068SJohannes Berg  * @blink_table: the blink table -- needs to be ordered by throughput
4842e1e54068SJohannes Berg  * @blink_table_len: size of the blink table
4843e1e54068SJohannes Berg  *
48440ae997dcSYacine Belkadi  * Return: %NULL (in case of error, or if no LED triggers are
48450ae997dcSYacine Belkadi  * configured) or the name of the new trigger.
48460ae997dcSYacine Belkadi  *
48470ae997dcSYacine Belkadi  * Note: This function must be called before ieee80211_register_hw().
4848e1e54068SJohannes Berg  */
4849f5c4ae07SJohannes Berg static inline const char *
ieee80211_create_tpt_led_trigger(struct ieee80211_hw * hw,unsigned int flags,const struct ieee80211_tpt_blink * blink_table,unsigned int blink_table_len)485067408c8cSJohannes Berg ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags,
4851e1e54068SJohannes Berg 				 const struct ieee80211_tpt_blink *blink_table,
4852e1e54068SJohannes Berg 				 unsigned int blink_table_len)
4853e1e54068SJohannes Berg {
4854e1e54068SJohannes Berg #ifdef CONFIG_MAC80211_LEDS
485567408c8cSJohannes Berg 	return __ieee80211_create_tpt_led_trigger(hw, flags, blink_table,
4856e1e54068SJohannes Berg 						  blink_table_len);
4857e1e54068SJohannes Berg #else
4858e1e54068SJohannes Berg 	return NULL;
4859e1e54068SJohannes Berg #endif
4860e1e54068SJohannes Berg }
4861e1e54068SJohannes Berg 
4862e1e54068SJohannes Berg /**
486375a5f0ccSJohannes Berg  * ieee80211_unregister_hw - Unregister a hardware device
486475a5f0ccSJohannes Berg  *
486575a5f0ccSJohannes Berg  * This function instructs mac80211 to free allocated resources
486675a5f0ccSJohannes Berg  * and unregister netdevices from the networking subsystem.
486775a5f0ccSJohannes Berg  *
486875a5f0ccSJohannes Berg  * @hw: the hardware to unregister
486975a5f0ccSJohannes Berg  */
4870f0706e82SJiri Benc void ieee80211_unregister_hw(struct ieee80211_hw *hw);
4871f0706e82SJiri Benc 
487275a5f0ccSJohannes Berg /**
487375a5f0ccSJohannes Berg  * ieee80211_free_hw - free hardware descriptor
487475a5f0ccSJohannes Berg  *
487575a5f0ccSJohannes Berg  * This function frees everything that was allocated, including the
487675a5f0ccSJohannes Berg  * private data for the driver. You must call ieee80211_unregister_hw()
48776ef307bcSRandy Dunlap  * before calling this function.
487875a5f0ccSJohannes Berg  *
487975a5f0ccSJohannes Berg  * @hw: the hardware to free
488075a5f0ccSJohannes Berg  */
4881f0706e82SJiri Benc void ieee80211_free_hw(struct ieee80211_hw *hw);
4882f0706e82SJiri Benc 
4883f2753ddbSJohannes Berg /**
4884f2753ddbSJohannes Berg  * ieee80211_restart_hw - restart hardware completely
4885f2753ddbSJohannes Berg  *
4886f2753ddbSJohannes Berg  * Call this function when the hardware was restarted for some reason
4887f2753ddbSJohannes Berg  * (hardware error, ...) and the driver is unable to restore its state
4888f2753ddbSJohannes Berg  * by itself. mac80211 assumes that at this point the driver/hardware
4889f2753ddbSJohannes Berg  * is completely uninitialised and stopped, it starts the process by
4890f2753ddbSJohannes Berg  * calling the ->start() operation. The driver will need to reset all
4891f2753ddbSJohannes Berg  * internal state that it has prior to calling this function.
4892f2753ddbSJohannes Berg  *
4893f2753ddbSJohannes Berg  * @hw: the hardware to restart
4894f2753ddbSJohannes Berg  */
4895f2753ddbSJohannes Berg void ieee80211_restart_hw(struct ieee80211_hw *hw);
4896f2753ddbSJohannes Berg 
489706d181a8SJohannes Berg /**
4898c5d1686bSFelix Fietkau  * ieee80211_rx_list - receive frame and store processed skbs in a list
4899c5d1686bSFelix Fietkau  *
4900c5d1686bSFelix Fietkau  * Use this function to hand received frames to mac80211. The receive
4901c5d1686bSFelix Fietkau  * buffer in @skb must start with an IEEE 802.11 header. In case of a
4902c5d1686bSFelix Fietkau  * paged @skb is used, the driver is recommended to put the ieee80211
4903c5d1686bSFelix Fietkau  * header of the frame on the linear part of the @skb to avoid memory
4904c5d1686bSFelix Fietkau  * allocation and/or memcpy by the stack.
4905c5d1686bSFelix Fietkau  *
4906c5d1686bSFelix Fietkau  * This function may not be called in IRQ context. Calls to this function
4907c5d1686bSFelix Fietkau  * for a single hardware must be synchronized against each other. Calls to
4908c5d1686bSFelix Fietkau  * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
4909c5d1686bSFelix Fietkau  * mixed for a single hardware. Must not run concurrently with
4910c5d1686bSFelix Fietkau  * ieee80211_tx_status() or ieee80211_tx_status_ni().
4911c5d1686bSFelix Fietkau  *
4912c5d1686bSFelix Fietkau  * This function must be called with BHs disabled and RCU read lock
4913c5d1686bSFelix Fietkau  *
4914c5d1686bSFelix Fietkau  * @hw: the hardware this frame came in on
4915c5d1686bSFelix Fietkau  * @sta: the station the frame was received from, or %NULL
4916c5d1686bSFelix Fietkau  * @skb: the buffer to receive, owned by mac80211 after this call
4917c5d1686bSFelix Fietkau  * @list: the destination list
4918c5d1686bSFelix Fietkau  */
4919c5d1686bSFelix Fietkau void ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
4920c5d1686bSFelix Fietkau 		       struct sk_buff *skb, struct list_head *list);
4921c5d1686bSFelix Fietkau 
4922c5d1686bSFelix Fietkau /**
4923af9f9b22SJohannes Berg  * ieee80211_rx_napi - receive frame from NAPI context
49244e6cbfd0SJohn W. Linville  *
4925af9f9b22SJohannes Berg  * Use this function to hand received frames to mac80211. The receive
4926af9f9b22SJohannes Berg  * buffer in @skb must start with an IEEE 802.11 header. In case of a
4927af9f9b22SJohannes Berg  * paged @skb is used, the driver is recommended to put the ieee80211
4928af9f9b22SJohannes Berg  * header of the frame on the linear part of the @skb to avoid memory
4929af9f9b22SJohannes Berg  * allocation and/or memcpy by the stack.
4930af9f9b22SJohannes Berg  *
4931af9f9b22SJohannes Berg  * This function may not be called in IRQ context. Calls to this function
4932af9f9b22SJohannes Berg  * for a single hardware must be synchronized against each other. Calls to
4933af9f9b22SJohannes Berg  * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
4934af9f9b22SJohannes Berg  * mixed for a single hardware. Must not run concurrently with
4935af9f9b22SJohannes Berg  * ieee80211_tx_status() or ieee80211_tx_status_ni().
4936af9f9b22SJohannes Berg  *
4937af9f9b22SJohannes Berg  * This function must be called with BHs disabled.
4938af9f9b22SJohannes Berg  *
4939af9f9b22SJohannes Berg  * @hw: the hardware this frame came in on
4940d63b548fSJohannes Berg  * @sta: the station the frame was received from, or %NULL
4941af9f9b22SJohannes Berg  * @skb: the buffer to receive, owned by mac80211 after this call
4942af9f9b22SJohannes Berg  * @napi: the NAPI context
49434e6cbfd0SJohn W. Linville  */
4944d63b548fSJohannes Berg void ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
4945d63b548fSJohannes Berg 		       struct sk_buff *skb, struct napi_struct *napi);
49464e6cbfd0SJohn W. Linville 
494775a5f0ccSJohannes Berg /**
494875a5f0ccSJohannes Berg  * ieee80211_rx - receive frame
494975a5f0ccSJohannes Berg  *
495075a5f0ccSJohannes Berg  * Use this function to hand received frames to mac80211. The receive
4951e3cf8b3fSZhu Yi  * buffer in @skb must start with an IEEE 802.11 header. In case of a
4952e3cf8b3fSZhu Yi  * paged @skb is used, the driver is recommended to put the ieee80211
4953e3cf8b3fSZhu Yi  * header of the frame on the linear part of the @skb to avoid memory
4954e3cf8b3fSZhu Yi  * allocation and/or memcpy by the stack.
495575a5f0ccSJohannes Berg  *
49562485f710SJohannes Berg  * This function may not be called in IRQ context. Calls to this function
4957e36e49f7SKalle Valo  * for a single hardware must be synchronized against each other. Calls to
4958e36e49f7SKalle Valo  * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
4959f6b3d85fSFelix Fietkau  * mixed for a single hardware. Must not run concurrently with
4960f6b3d85fSFelix Fietkau  * ieee80211_tx_status() or ieee80211_tx_status_ni().
496175a5f0ccSJohannes Berg  *
4962e36e49f7SKalle Valo  * In process context use instead ieee80211_rx_ni().
4963d20ef63dSJohannes Berg  *
496475a5f0ccSJohannes Berg  * @hw: the hardware this frame came in on
496575a5f0ccSJohannes Berg  * @skb: the buffer to receive, owned by mac80211 after this call
496675a5f0ccSJohannes Berg  */
ieee80211_rx(struct ieee80211_hw * hw,struct sk_buff * skb)4967af9f9b22SJohannes Berg static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
4968af9f9b22SJohannes Berg {
4969d63b548fSJohannes Berg 	ieee80211_rx_napi(hw, NULL, skb, NULL);
4970af9f9b22SJohannes Berg }
497175a5f0ccSJohannes Berg 
497275a5f0ccSJohannes Berg /**
497375a5f0ccSJohannes Berg  * ieee80211_rx_irqsafe - receive frame
497475a5f0ccSJohannes Berg  *
497575a5f0ccSJohannes Berg  * Like ieee80211_rx() but can be called in IRQ context
49762485f710SJohannes Berg  * (internally defers to a tasklet.)
49772485f710SJohannes Berg  *
4978e36e49f7SKalle Valo  * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not
4979f6b3d85fSFelix Fietkau  * be mixed for a single hardware.Must not run concurrently with
4980f6b3d85fSFelix Fietkau  * ieee80211_tx_status() or ieee80211_tx_status_ni().
498175a5f0ccSJohannes Berg  *
498275a5f0ccSJohannes Berg  * @hw: the hardware this frame came in on
498375a5f0ccSJohannes Berg  * @skb: the buffer to receive, owned by mac80211 after this call
498475a5f0ccSJohannes Berg  */
4985f1d58c25SJohannes Berg void ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
4986f0706e82SJiri Benc 
498775a5f0ccSJohannes Berg /**
4988e36e49f7SKalle Valo  * ieee80211_rx_ni - receive frame (in process context)
4989e36e49f7SKalle Valo  *
4990e36e49f7SKalle Valo  * Like ieee80211_rx() but can be called in process context
4991e36e49f7SKalle Valo  * (internally disables bottom halves).
4992e36e49f7SKalle Valo  *
4993e36e49f7SKalle Valo  * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may
4994f6b3d85fSFelix Fietkau  * not be mixed for a single hardware. Must not run concurrently with
4995f6b3d85fSFelix Fietkau  * ieee80211_tx_status() or ieee80211_tx_status_ni().
4996e36e49f7SKalle Valo  *
4997e36e49f7SKalle Valo  * @hw: the hardware this frame came in on
4998e36e49f7SKalle Valo  * @skb: the buffer to receive, owned by mac80211 after this call
4999e36e49f7SKalle Valo  */
ieee80211_rx_ni(struct ieee80211_hw * hw,struct sk_buff * skb)5000e36e49f7SKalle Valo static inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
5001e36e49f7SKalle Valo 				   struct sk_buff *skb)
5002e36e49f7SKalle Valo {
5003e36e49f7SKalle Valo 	local_bh_disable();
5004e36e49f7SKalle Valo 	ieee80211_rx(hw, skb);
5005e36e49f7SKalle Valo 	local_bh_enable();
5006e36e49f7SKalle Valo }
5007e36e49f7SKalle Valo 
5008d057e5a3SArik Nemtsov /**
5009d057e5a3SArik Nemtsov  * ieee80211_sta_ps_transition - PS transition for connected sta
5010d057e5a3SArik Nemtsov  *
5011d057e5a3SArik Nemtsov  * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS
5012d057e5a3SArik Nemtsov  * flag set, use this function to inform mac80211 about a connected station
5013d057e5a3SArik Nemtsov  * entering/leaving PS mode.
5014d057e5a3SArik Nemtsov  *
5015d057e5a3SArik Nemtsov  * This function may not be called in IRQ context or with softirqs enabled.
5016d057e5a3SArik Nemtsov  *
5017d057e5a3SArik Nemtsov  * Calls to this function for a single hardware must be synchronized against
5018d057e5a3SArik Nemtsov  * each other.
5019d057e5a3SArik Nemtsov  *
5020d057e5a3SArik Nemtsov  * @sta: currently connected sta
5021d057e5a3SArik Nemtsov  * @start: start or stop PS
50220ae997dcSYacine Belkadi  *
50230ae997dcSYacine Belkadi  * Return: 0 on success. -EINVAL when the requested PS mode is already set.
5024d057e5a3SArik Nemtsov  */
5025d057e5a3SArik Nemtsov int ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start);
5026d057e5a3SArik Nemtsov 
5027d057e5a3SArik Nemtsov /**
5028d057e5a3SArik Nemtsov  * ieee80211_sta_ps_transition_ni - PS transition for connected sta
5029d057e5a3SArik Nemtsov  *                                  (in process context)
5030d057e5a3SArik Nemtsov  *
5031d057e5a3SArik Nemtsov  * Like ieee80211_sta_ps_transition() but can be called in process context
5032d057e5a3SArik Nemtsov  * (internally disables bottom halves). Concurrent call restriction still
5033d057e5a3SArik Nemtsov  * applies.
5034d057e5a3SArik Nemtsov  *
5035d057e5a3SArik Nemtsov  * @sta: currently connected sta
5036d057e5a3SArik Nemtsov  * @start: start or stop PS
50370ae997dcSYacine Belkadi  *
50380ae997dcSYacine Belkadi  * Return: Like ieee80211_sta_ps_transition().
5039d057e5a3SArik Nemtsov  */
ieee80211_sta_ps_transition_ni(struct ieee80211_sta * sta,bool start)5040d057e5a3SArik Nemtsov static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta,
5041d057e5a3SArik Nemtsov 						  bool start)
5042d057e5a3SArik Nemtsov {
5043d057e5a3SArik Nemtsov 	int ret;
5044d057e5a3SArik Nemtsov 
5045d057e5a3SArik Nemtsov 	local_bh_disable();
5046d057e5a3SArik Nemtsov 	ret = ieee80211_sta_ps_transition(sta, start);
5047d057e5a3SArik Nemtsov 	local_bh_enable();
5048d057e5a3SArik Nemtsov 
5049d057e5a3SArik Nemtsov 	return ret;
5050d057e5a3SArik Nemtsov }
5051d057e5a3SArik Nemtsov 
505246fa38e8SJohannes Berg /**
505346fa38e8SJohannes Berg  * ieee80211_sta_pspoll - PS-Poll frame received
505446fa38e8SJohannes Berg  * @sta: currently connected station
505546fa38e8SJohannes Berg  *
505646fa38e8SJohannes Berg  * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS flag set,
505746fa38e8SJohannes Berg  * use this function to inform mac80211 that a PS-Poll frame from a
505846fa38e8SJohannes Berg  * connected station was received.
505946fa38e8SJohannes Berg  * This must be used in conjunction with ieee80211_sta_ps_transition()
506046fa38e8SJohannes Berg  * and possibly ieee80211_sta_uapsd_trigger(); calls to all three must
506146fa38e8SJohannes Berg  * be serialized.
506246fa38e8SJohannes Berg  */
506346fa38e8SJohannes Berg void ieee80211_sta_pspoll(struct ieee80211_sta *sta);
506446fa38e8SJohannes Berg 
506546fa38e8SJohannes Berg /**
506646fa38e8SJohannes Berg  * ieee80211_sta_uapsd_trigger - (potential) U-APSD trigger frame received
506746fa38e8SJohannes Berg  * @sta: currently connected station
506846fa38e8SJohannes Berg  * @tid: TID of the received (potential) trigger frame
506946fa38e8SJohannes Berg  *
507046fa38e8SJohannes Berg  * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS flag set,
507146fa38e8SJohannes Berg  * use this function to inform mac80211 that a (potential) trigger frame
507246fa38e8SJohannes Berg  * from a connected station was received.
507346fa38e8SJohannes Berg  * This must be used in conjunction with ieee80211_sta_ps_transition()
507446fa38e8SJohannes Berg  * and possibly ieee80211_sta_pspoll(); calls to all three must be
507546fa38e8SJohannes Berg  * serialized.
50760aa419ecSEmmanuel Grumbach  * %IEEE80211_NUM_TIDS can be passed as the tid if the tid is unknown.
50770aa419ecSEmmanuel Grumbach  * In this case, mac80211 will not check that this tid maps to an AC
50780aa419ecSEmmanuel Grumbach  * that is trigger enabled and assume that the caller did the proper
50790aa419ecSEmmanuel Grumbach  * checks.
508046fa38e8SJohannes Berg  */
508146fa38e8SJohannes Berg void ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, u8 tid);
508246fa38e8SJohannes Berg 
5083d24deb25SGertjan van Wingerde /*
5084d24deb25SGertjan van Wingerde  * The TX headroom reserved by mac80211 for its own tx_status functions.
5085d24deb25SGertjan van Wingerde  * This is enough for the radiotap header.
5086d24deb25SGertjan van Wingerde  */
5087651b9920SFelix Fietkau #define IEEE80211_TX_STATUS_HEADROOM	ALIGN(14, 4)
5088d24deb25SGertjan van Wingerde 
5089e36e49f7SKalle Valo /**
5090042ec453SJohannes Berg  * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames
5091bdfbe804SRandy Dunlap  * @sta: &struct ieee80211_sta pointer for the sleeping station
5092042ec453SJohannes Berg  * @tid: the TID that has buffered frames
5093042ec453SJohannes Berg  * @buffered: indicates whether or not frames are buffered for this TID
5094dcf55fb5SFelix Fietkau  *
5095dcf55fb5SFelix Fietkau  * If a driver buffers frames for a powersave station instead of passing
5096042ec453SJohannes Berg  * them back to mac80211 for retransmission, the station may still need
5097042ec453SJohannes Berg  * to be told that there are buffered frames via the TIM bit.
5098dcf55fb5SFelix Fietkau  *
5099042ec453SJohannes Berg  * This function informs mac80211 whether or not there are frames that are
5100042ec453SJohannes Berg  * buffered in the driver for a given TID; mac80211 can then use this data
5101042ec453SJohannes Berg  * to set the TIM bit (NOTE: This may call back into the driver's set_tim
5102042ec453SJohannes Berg  * call! Beware of the locking!)
5103042ec453SJohannes Berg  *
5104042ec453SJohannes Berg  * If all frames are released to the station (due to PS-poll or uAPSD)
5105042ec453SJohannes Berg  * then the driver needs to inform mac80211 that there no longer are
5106042ec453SJohannes Berg  * frames buffered. However, when the station wakes up mac80211 assumes
5107042ec453SJohannes Berg  * that all buffered frames will be transmitted and clears this data,
5108042ec453SJohannes Berg  * drivers need to make sure they inform mac80211 about all buffered
5109042ec453SJohannes Berg  * frames on the sleep transition (sta_notify() with %STA_NOTIFY_SLEEP).
5110042ec453SJohannes Berg  *
5111042ec453SJohannes Berg  * Note that technically mac80211 only needs to know this per AC, not per
5112042ec453SJohannes Berg  * TID, but since driver buffering will inevitably happen per TID (since
5113042ec453SJohannes Berg  * it is related to aggregation) it is easier to make mac80211 map the
5114042ec453SJohannes Berg  * TID to the AC as required instead of keeping track in all drivers that
5115042ec453SJohannes Berg  * use this API.
5116dcf55fb5SFelix Fietkau  */
5117042ec453SJohannes Berg void ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
5118042ec453SJohannes Berg 				u8 tid, bool buffered);
5119dcf55fb5SFelix Fietkau 
5120dcf55fb5SFelix Fietkau /**
51210d528d85SFelix Fietkau  * ieee80211_get_tx_rates - get the selected transmit rates for a packet
51220d528d85SFelix Fietkau  *
51230d528d85SFelix Fietkau  * Call this function in a driver with per-packet rate selection support
51240d528d85SFelix Fietkau  * to combine the rate info in the packet tx info with the most recent
51250d528d85SFelix Fietkau  * rate selection table for the station entry.
51260d528d85SFelix Fietkau  *
51270d528d85SFelix Fietkau  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
51280d528d85SFelix Fietkau  * @sta: the receiver station to which this packet is sent.
51290d528d85SFelix Fietkau  * @skb: the frame to be transmitted.
51300d528d85SFelix Fietkau  * @dest: buffer for extracted rate/retry information
51310d528d85SFelix Fietkau  * @max_rates: maximum number of rates to fetch
51320d528d85SFelix Fietkau  */
51330d528d85SFelix Fietkau void ieee80211_get_tx_rates(struct ieee80211_vif *vif,
51340d528d85SFelix Fietkau 			    struct ieee80211_sta *sta,
51350d528d85SFelix Fietkau 			    struct sk_buff *skb,
51360d528d85SFelix Fietkau 			    struct ieee80211_tx_rate *dest,
51370d528d85SFelix Fietkau 			    int max_rates);
51380d528d85SFelix Fietkau 
51390d528d85SFelix Fietkau /**
5140484a54c2SToke Høiland-Jørgensen  * ieee80211_sta_set_expected_throughput - set the expected tpt for a station
5141484a54c2SToke Høiland-Jørgensen  *
5142484a54c2SToke Høiland-Jørgensen  * Call this function to notify mac80211 about a change in expected throughput
5143484a54c2SToke Høiland-Jørgensen  * to a station. A driver for a device that does rate control in firmware can
5144484a54c2SToke Høiland-Jørgensen  * call this function when the expected throughput estimate towards a station
5145484a54c2SToke Høiland-Jørgensen  * changes. The information is used to tune the CoDel AQM applied to traffic
5146484a54c2SToke Høiland-Jørgensen  * going towards that station (which can otherwise be too aggressive and cause
5147484a54c2SToke Høiland-Jørgensen  * slow stations to starve).
5148484a54c2SToke Høiland-Jørgensen  *
5149484a54c2SToke Høiland-Jørgensen  * @pubsta: the station to set throughput for.
5150484a54c2SToke Høiland-Jørgensen  * @thr: the current expected throughput in kbps.
5151484a54c2SToke Høiland-Jørgensen  */
5152484a54c2SToke Høiland-Jørgensen void ieee80211_sta_set_expected_throughput(struct ieee80211_sta *pubsta,
5153484a54c2SToke Høiland-Jørgensen 					   u32 thr);
5154484a54c2SToke Høiland-Jørgensen 
5155484a54c2SToke Høiland-Jørgensen /**
5156f8252e7bSAnilkumar Kolli  * ieee80211_tx_rate_update - transmit rate update callback
5157f8252e7bSAnilkumar Kolli  *
5158f8252e7bSAnilkumar Kolli  * Drivers should call this functions with a non-NULL pub sta
5159f8252e7bSAnilkumar Kolli  * This function can be used in drivers that does not have provision
5160f8252e7bSAnilkumar Kolli  * in updating the tx rate in data path.
5161f8252e7bSAnilkumar Kolli  *
5162f8252e7bSAnilkumar Kolli  * @hw: the hardware the frame was transmitted by
5163f8252e7bSAnilkumar Kolli  * @pubsta: the station to update the tx rate for.
5164f8252e7bSAnilkumar Kolli  * @info: tx status information
5165f8252e7bSAnilkumar Kolli  */
5166f8252e7bSAnilkumar Kolli void ieee80211_tx_rate_update(struct ieee80211_hw *hw,
5167f8252e7bSAnilkumar Kolli 			      struct ieee80211_sta *pubsta,
5168f8252e7bSAnilkumar Kolli 			      struct ieee80211_tx_info *info);
5169f8252e7bSAnilkumar Kolli 
5170f8252e7bSAnilkumar Kolli /**
517175a5f0ccSJohannes Berg  * ieee80211_tx_status - transmit status callback
517275a5f0ccSJohannes Berg  *
517375a5f0ccSJohannes Berg  * Call this function for all transmitted frames after they have been
517475a5f0ccSJohannes Berg  * transmitted. It is permissible to not call this function for
517575a5f0ccSJohannes Berg  * multicast frames but this can affect statistics.
517675a5f0ccSJohannes Berg  *
51772485f710SJohannes Berg  * This function may not be called in IRQ context. Calls to this function
51782485f710SJohannes Berg  * for a single hardware must be synchronized against each other. Calls
517920ed3166SJohannes Stezenbach  * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe()
5180f6b3d85fSFelix Fietkau  * may not be mixed for a single hardware. Must not run concurrently with
5181f6b3d85fSFelix Fietkau  * ieee80211_rx() or ieee80211_rx_ni().
51822485f710SJohannes Berg  *
518375a5f0ccSJohannes Berg  * @hw: the hardware the frame was transmitted by
518475a5f0ccSJohannes Berg  * @skb: the frame that was transmitted, owned by mac80211 after this call
518575a5f0ccSJohannes Berg  */
5186f0706e82SJiri Benc void ieee80211_tx_status(struct ieee80211_hw *hw,
5187e039fa4aSJohannes Berg 			 struct sk_buff *skb);
51882485f710SJohannes Berg 
51892485f710SJohannes Berg /**
51905fe49a9dSFelix Fietkau  * ieee80211_tx_status_ext - extended transmit status callback
51915fe49a9dSFelix Fietkau  *
51925fe49a9dSFelix Fietkau  * This function can be used as a replacement for ieee80211_tx_status
51935fe49a9dSFelix Fietkau  * in drivers that may want to provide extra information that does not
51945fe49a9dSFelix Fietkau  * fit into &struct ieee80211_tx_info.
51955fe49a9dSFelix Fietkau  *
51965fe49a9dSFelix Fietkau  * Calls to this function for a single hardware must be synchronized
51975fe49a9dSFelix Fietkau  * against each other. Calls to this function, ieee80211_tx_status_ni()
51985fe49a9dSFelix Fietkau  * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware.
51995fe49a9dSFelix Fietkau  *
52005fe49a9dSFelix Fietkau  * @hw: the hardware the frame was transmitted by
52015fe49a9dSFelix Fietkau  * @status: tx status information
52025fe49a9dSFelix Fietkau  */
52035fe49a9dSFelix Fietkau void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
52045fe49a9dSFelix Fietkau 			     struct ieee80211_tx_status *status);
52055fe49a9dSFelix Fietkau 
52065fe49a9dSFelix Fietkau /**
5207f027c2acSFelix Fietkau  * ieee80211_tx_status_noskb - transmit status callback without skb
5208f027c2acSFelix Fietkau  *
5209f027c2acSFelix Fietkau  * This function can be used as a replacement for ieee80211_tx_status
5210f027c2acSFelix Fietkau  * in drivers that cannot reliably map tx status information back to
5211f027c2acSFelix Fietkau  * specific skbs.
5212f027c2acSFelix Fietkau  *
5213f027c2acSFelix Fietkau  * Calls to this function for a single hardware must be synchronized
5214f027c2acSFelix Fietkau  * against each other. Calls to this function, ieee80211_tx_status_ni()
5215f027c2acSFelix Fietkau  * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware.
5216f027c2acSFelix Fietkau  *
5217f027c2acSFelix Fietkau  * @hw: the hardware the frame was transmitted by
5218f027c2acSFelix Fietkau  * @sta: the receiver station to which this packet is sent
5219f027c2acSFelix Fietkau  *	(NULL for multicast packets)
5220f027c2acSFelix Fietkau  * @info: tx status information
5221f027c2acSFelix Fietkau  */
ieee80211_tx_status_noskb(struct ieee80211_hw * hw,struct ieee80211_sta * sta,struct ieee80211_tx_info * info)52225fe49a9dSFelix Fietkau static inline void ieee80211_tx_status_noskb(struct ieee80211_hw *hw,
5223f027c2acSFelix Fietkau 					     struct ieee80211_sta *sta,
52245fe49a9dSFelix Fietkau 					     struct ieee80211_tx_info *info)
52255fe49a9dSFelix Fietkau {
52265fe49a9dSFelix Fietkau 	struct ieee80211_tx_status status = {
52275fe49a9dSFelix Fietkau 		.sta = sta,
52285fe49a9dSFelix Fietkau 		.info = info,
52295fe49a9dSFelix Fietkau 	};
52305fe49a9dSFelix Fietkau 
52315fe49a9dSFelix Fietkau 	ieee80211_tx_status_ext(hw, &status);
52325fe49a9dSFelix Fietkau }
5233f027c2acSFelix Fietkau 
5234f027c2acSFelix Fietkau /**
523520ed3166SJohannes Stezenbach  * ieee80211_tx_status_ni - transmit status callback (in process context)
523620ed3166SJohannes Stezenbach  *
523720ed3166SJohannes Stezenbach  * Like ieee80211_tx_status() but can be called in process context.
523820ed3166SJohannes Stezenbach  *
523920ed3166SJohannes Stezenbach  * Calls to this function, ieee80211_tx_status() and
524020ed3166SJohannes Stezenbach  * ieee80211_tx_status_irqsafe() may not be mixed
524120ed3166SJohannes Stezenbach  * for a single hardware.
524220ed3166SJohannes Stezenbach  *
524320ed3166SJohannes Stezenbach  * @hw: the hardware the frame was transmitted by
524420ed3166SJohannes Stezenbach  * @skb: the frame that was transmitted, owned by mac80211 after this call
524520ed3166SJohannes Stezenbach  */
ieee80211_tx_status_ni(struct ieee80211_hw * hw,struct sk_buff * skb)524620ed3166SJohannes Stezenbach static inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw,
524720ed3166SJohannes Stezenbach 					  struct sk_buff *skb)
524820ed3166SJohannes Stezenbach {
524920ed3166SJohannes Stezenbach 	local_bh_disable();
525020ed3166SJohannes Stezenbach 	ieee80211_tx_status(hw, skb);
525120ed3166SJohannes Stezenbach 	local_bh_enable();
525220ed3166SJohannes Stezenbach }
525320ed3166SJohannes Stezenbach 
525420ed3166SJohannes Stezenbach /**
52556ef307bcSRandy Dunlap  * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback
52562485f710SJohannes Berg  *
52572485f710SJohannes Berg  * Like ieee80211_tx_status() but can be called in IRQ context
52582485f710SJohannes Berg  * (internally defers to a tasklet.)
52592485f710SJohannes Berg  *
526020ed3166SJohannes Stezenbach  * Calls to this function, ieee80211_tx_status() and
526120ed3166SJohannes Stezenbach  * ieee80211_tx_status_ni() may not be mixed for a single hardware.
52622485f710SJohannes Berg  *
52632485f710SJohannes Berg  * @hw: the hardware the frame was transmitted by
52642485f710SJohannes Berg  * @skb: the frame that was transmitted, owned by mac80211 after this call
52652485f710SJohannes Berg  */
5266f0706e82SJiri Benc void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
5267e039fa4aSJohannes Berg 				 struct sk_buff *skb);
5268f0706e82SJiri Benc 
5269f0706e82SJiri Benc /**
52708178d38bSArik Nemtsov  * ieee80211_report_low_ack - report non-responding station
52718178d38bSArik Nemtsov  *
52728178d38bSArik Nemtsov  * When operating in AP-mode, call this function to report a non-responding
52738178d38bSArik Nemtsov  * connected STA.
52748178d38bSArik Nemtsov  *
52758178d38bSArik Nemtsov  * @sta: the non-responding connected sta
52768178d38bSArik Nemtsov  * @num_packets: number of packets sent to @sta without a response
52778178d38bSArik Nemtsov  */
52788178d38bSArik Nemtsov void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
52798178d38bSArik Nemtsov 
52808552a434SJohn Crispin #define IEEE80211_MAX_CNTDWN_COUNTERS_NUM 2
52811af586c9SAndrei Otcheretianski 
52828178d38bSArik Nemtsov /**
52836ec8c332SAndrei Otcheretianski  * struct ieee80211_mutable_offsets - mutable beacon offsets
52846ec8c332SAndrei Otcheretianski  * @tim_offset: position of TIM element
52856ec8c332SAndrei Otcheretianski  * @tim_length: size of TIM element
52868552a434SJohn Crispin  * @cntdwn_counter_offs: array of IEEE80211_MAX_CNTDWN_COUNTERS_NUM offsets
52878552a434SJohn Crispin  *	to countdown counters.  This array can contain zero values which
52888d77ec85SLuciano Coelho  *	should be ignored.
52892b3171c6SLorenzo Bianconi  * @mbssid_off: position of the multiple bssid element
52906ec8c332SAndrei Otcheretianski  */
52916ec8c332SAndrei Otcheretianski struct ieee80211_mutable_offsets {
52926ec8c332SAndrei Otcheretianski 	u16 tim_offset;
52936ec8c332SAndrei Otcheretianski 	u16 tim_length;
52941af586c9SAndrei Otcheretianski 
52958552a434SJohn Crispin 	u16 cntdwn_counter_offs[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
52962b3171c6SLorenzo Bianconi 	u16 mbssid_off;
52976ec8c332SAndrei Otcheretianski };
52986ec8c332SAndrei Otcheretianski 
52996ec8c332SAndrei Otcheretianski /**
53006ec8c332SAndrei Otcheretianski  * ieee80211_beacon_get_template - beacon template generation function
53016ec8c332SAndrei Otcheretianski  * @hw: pointer obtained from ieee80211_alloc_hw().
53026ec8c332SAndrei Otcheretianski  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
53036ec8c332SAndrei Otcheretianski  * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
53046ec8c332SAndrei Otcheretianski  *	receive the offsets that may be updated by the driver.
530543ea0928SIlan Peer  * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
530643ea0928SIlan Peer  *	that is not associated with AP MLD).
53076ec8c332SAndrei Otcheretianski  *
53086ec8c332SAndrei Otcheretianski  * If the driver implements beaconing modes, it must use this function to
53096ec8c332SAndrei Otcheretianski  * obtain the beacon template.
53106ec8c332SAndrei Otcheretianski  *
53116ec8c332SAndrei Otcheretianski  * This function should be used if the beacon frames are generated by the
53126ec8c332SAndrei Otcheretianski  * device, and then the driver must use the returned beacon as the template
53131af586c9SAndrei Otcheretianski  * The driver or the device are responsible to update the DTIM and, when
53141af586c9SAndrei Otcheretianski  * applicable, the CSA count.
53156ec8c332SAndrei Otcheretianski  *
53166ec8c332SAndrei Otcheretianski  * The driver is responsible for freeing the returned skb.
53176ec8c332SAndrei Otcheretianski  *
53186ec8c332SAndrei Otcheretianski  * Return: The beacon template. %NULL on error.
53196ec8c332SAndrei Otcheretianski  */
53206ec8c332SAndrei Otcheretianski struct sk_buff *
53216ec8c332SAndrei Otcheretianski ieee80211_beacon_get_template(struct ieee80211_hw *hw,
53226ec8c332SAndrei Otcheretianski 			      struct ieee80211_vif *vif,
53236e8912a5SShaul Triebitz 			      struct ieee80211_mutable_offsets *offs,
53246e8912a5SShaul Triebitz 			      unsigned int link_id);
53256ec8c332SAndrei Otcheretianski 
53266ec8c332SAndrei Otcheretianski /**
5327bd54f3c2SAloka Dixit  * ieee80211_beacon_get_template_ema_index - EMA beacon template generation
5328bd54f3c2SAloka Dixit  * @hw: pointer obtained from ieee80211_alloc_hw().
5329bd54f3c2SAloka Dixit  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5330bd54f3c2SAloka Dixit  * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
5331bd54f3c2SAloka Dixit  *	receive the offsets that may be updated by the driver.
5332bd54f3c2SAloka Dixit  * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP).
5333bd54f3c2SAloka Dixit  * @ema_index: index of the beacon in the EMA set.
5334bd54f3c2SAloka Dixit  *
5335bd54f3c2SAloka Dixit  * This function follows the same rules as ieee80211_beacon_get_template()
5336bd54f3c2SAloka Dixit  * but returns a beacon template which includes multiple BSSID element at the
5337bd54f3c2SAloka Dixit  * requested index.
5338bd54f3c2SAloka Dixit  *
5339bd54f3c2SAloka Dixit  * Return: The beacon template. %NULL indicates the end of EMA templates.
5340bd54f3c2SAloka Dixit  */
5341bd54f3c2SAloka Dixit struct sk_buff *
5342bd54f3c2SAloka Dixit ieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw,
5343bd54f3c2SAloka Dixit 					struct ieee80211_vif *vif,
5344bd54f3c2SAloka Dixit 					struct ieee80211_mutable_offsets *offs,
5345bd54f3c2SAloka Dixit 					unsigned int link_id, u8 ema_index);
5346bd54f3c2SAloka Dixit 
5347bd54f3c2SAloka Dixit /**
5348bd54f3c2SAloka Dixit  * struct ieee80211_ema_beacons - List of EMA beacons
5349bd54f3c2SAloka Dixit  * @cnt: count of EMA beacons.
5350bd54f3c2SAloka Dixit  *
5351bd54f3c2SAloka Dixit  * @bcn: array of EMA beacons.
5352bd54f3c2SAloka Dixit  * @bcn.skb: the skb containing this specific beacon
5353bd54f3c2SAloka Dixit  * @bcn.offs: &struct ieee80211_mutable_offsets pointer to struct that will
5354bd54f3c2SAloka Dixit  *	receive the offsets that may be updated by the driver.
5355bd54f3c2SAloka Dixit  */
5356bd54f3c2SAloka Dixit struct ieee80211_ema_beacons {
5357bd54f3c2SAloka Dixit 	u8 cnt;
5358bd54f3c2SAloka Dixit 	struct {
5359bd54f3c2SAloka Dixit 		struct sk_buff *skb;
5360bd54f3c2SAloka Dixit 		struct ieee80211_mutable_offsets offs;
5361bd54f3c2SAloka Dixit 	} bcn[];
5362bd54f3c2SAloka Dixit };
5363bd54f3c2SAloka Dixit 
5364bd54f3c2SAloka Dixit /**
5365bd54f3c2SAloka Dixit  * ieee80211_beacon_get_template_ema_list - EMA beacon template generation
5366bd54f3c2SAloka Dixit  * @hw: pointer obtained from ieee80211_alloc_hw().
5367bd54f3c2SAloka Dixit  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5368bd54f3c2SAloka Dixit  * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP)
5369bd54f3c2SAloka Dixit  *
5370bd54f3c2SAloka Dixit  * This function follows the same rules as ieee80211_beacon_get_template()
5371bd54f3c2SAloka Dixit  * but allocates and returns a pointer to list of all beacon templates required
5372bd54f3c2SAloka Dixit  * to cover all profiles in the multiple BSSID set. Each template includes only
5373bd54f3c2SAloka Dixit  * one multiple BSSID element.
5374bd54f3c2SAloka Dixit  *
5375bd54f3c2SAloka Dixit  * Driver must call ieee80211_beacon_free_ema_list() to free the memory.
5376bd54f3c2SAloka Dixit  *
5377bd54f3c2SAloka Dixit  * Return: EMA beacon templates of type struct ieee80211_ema_beacons *.
5378bd54f3c2SAloka Dixit  *	%NULL on error.
5379bd54f3c2SAloka Dixit  */
5380bd54f3c2SAloka Dixit struct ieee80211_ema_beacons *
5381bd54f3c2SAloka Dixit ieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,
5382bd54f3c2SAloka Dixit 				       struct ieee80211_vif *vif,
5383bd54f3c2SAloka Dixit 				       unsigned int link_id);
5384bd54f3c2SAloka Dixit 
5385bd54f3c2SAloka Dixit /**
5386bd54f3c2SAloka Dixit  * ieee80211_beacon_free_ema_list - free an EMA beacon template list
5387bd54f3c2SAloka Dixit  * @ema_beacons: list of EMA beacons of type &struct ieee80211_ema_beacons pointers.
5388bd54f3c2SAloka Dixit  *
5389bd54f3c2SAloka Dixit  * This function will free a list previously acquired by calling
5390bd54f3c2SAloka Dixit  * ieee80211_beacon_get_template_ema_list()
5391bd54f3c2SAloka Dixit  */
5392bd54f3c2SAloka Dixit void ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons);
5393bd54f3c2SAloka Dixit 
5394bd54f3c2SAloka Dixit /**
5395eddcbb94SJohannes Berg  * ieee80211_beacon_get_tim - beacon generation function
5396eddcbb94SJohannes Berg  * @hw: pointer obtained from ieee80211_alloc_hw().
53971ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5398eddcbb94SJohannes Berg  * @tim_offset: pointer to variable that will receive the TIM IE offset.
5399eddcbb94SJohannes Berg  *	Set to 0 if invalid (in non-AP modes).
5400eddcbb94SJohannes Berg  * @tim_length: pointer to variable that will receive the TIM IE length,
5401eddcbb94SJohannes Berg  *	(including the ID and length bytes!).
5402eddcbb94SJohannes Berg  *	Set to 0 if invalid (in non-AP modes).
540343ea0928SIlan Peer  * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
540443ea0928SIlan Peer  *	that is not associated with AP MLD).
5405eddcbb94SJohannes Berg  *
5406eddcbb94SJohannes Berg  * If the driver implements beaconing modes, it must use this function to
54076ec8c332SAndrei Otcheretianski  * obtain the beacon frame.
5408eddcbb94SJohannes Berg  *
5409eddcbb94SJohannes Berg  * If the beacon frames are generated by the host system (i.e., not in
5410eddcbb94SJohannes Berg  * hardware/firmware), the driver uses this function to get each beacon
54116ec8c332SAndrei Otcheretianski  * frame from mac80211 -- it is responsible for calling this function exactly
54126ec8c332SAndrei Otcheretianski  * once before the beacon is needed (e.g. based on hardware interrupt).
5413eddcbb94SJohannes Berg  *
5414eddcbb94SJohannes Berg  * The driver is responsible for freeing the returned skb.
54150ae997dcSYacine Belkadi  *
54160ae997dcSYacine Belkadi  * Return: The beacon template. %NULL on error.
5417eddcbb94SJohannes Berg  */
5418eddcbb94SJohannes Berg struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
5419eddcbb94SJohannes Berg 					 struct ieee80211_vif *vif,
54206e8912a5SShaul Triebitz 					 u16 *tim_offset, u16 *tim_length,
54216e8912a5SShaul Triebitz 					 unsigned int link_id);
5422eddcbb94SJohannes Berg 
5423eddcbb94SJohannes Berg /**
5424f0706e82SJiri Benc  * ieee80211_beacon_get - beacon generation function
5425f0706e82SJiri Benc  * @hw: pointer obtained from ieee80211_alloc_hw().
54261ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
542743ea0928SIlan Peer  * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
542843ea0928SIlan Peer  *	that is not associated with AP MLD).
5429f0706e82SJiri Benc  *
5430eddcbb94SJohannes Berg  * See ieee80211_beacon_get_tim().
54310ae997dcSYacine Belkadi  *
54320ae997dcSYacine Belkadi  * Return: See ieee80211_beacon_get_tim().
5433f0706e82SJiri Benc  */
ieee80211_beacon_get(struct ieee80211_hw * hw,struct ieee80211_vif * vif,unsigned int link_id)5434eddcbb94SJohannes Berg static inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
54356e8912a5SShaul Triebitz 						   struct ieee80211_vif *vif,
54366e8912a5SShaul Triebitz 						   unsigned int link_id)
5437eddcbb94SJohannes Berg {
54386e8912a5SShaul Triebitz 	return ieee80211_beacon_get_tim(hw, vif, NULL, NULL, link_id);
5439eddcbb94SJohannes Berg }
5440f0706e82SJiri Benc 
5441f0706e82SJiri Benc /**
54428552a434SJohn Crispin  * ieee80211_beacon_update_cntdwn - request mac80211 to decrement the beacon countdown
54431af586c9SAndrei Otcheretianski  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
54441af586c9SAndrei Otcheretianski  *
54458552a434SJohn Crispin  * The beacon counter should be updated after each beacon transmission.
54461af586c9SAndrei Otcheretianski  * This function is called implicitly when
54471af586c9SAndrei Otcheretianski  * ieee80211_beacon_get/ieee80211_beacon_get_tim are called, however if the
54481af586c9SAndrei Otcheretianski  * beacon frames are generated by the device, the driver should call this
54498552a434SJohn Crispin  * function after each beacon transmission to sync mac80211's beacon countdown.
54501af586c9SAndrei Otcheretianski  *
54518552a434SJohn Crispin  * Return: new countdown value
54521af586c9SAndrei Otcheretianski  */
54538552a434SJohn Crispin u8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif);
54541af586c9SAndrei Otcheretianski 
54551af586c9SAndrei Otcheretianski /**
54568552a434SJohn Crispin  * ieee80211_beacon_set_cntdwn - request mac80211 to set beacon countdown
545703737001SGregory Greenman  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
545803737001SGregory Greenman  * @counter: the new value for the counter
545903737001SGregory Greenman  *
54608552a434SJohn Crispin  * The beacon countdown can be changed by the device, this API should be
546103737001SGregory Greenman  * used by the device driver to update csa counter in mac80211.
546203737001SGregory Greenman  *
54638552a434SJohn Crispin  * It should never be used together with ieee80211_beacon_update_cntdwn(),
546403737001SGregory Greenman  * as it will cause a race condition around the counter value.
546503737001SGregory Greenman  */
54668552a434SJohn Crispin void ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter);
546703737001SGregory Greenman 
546803737001SGregory Greenman /**
546973da7d5bSSimon Wunderlich  * ieee80211_csa_finish - notify mac80211 about channel switch
547073da7d5bSSimon Wunderlich  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
547173da7d5bSSimon Wunderlich  *
547273da7d5bSSimon Wunderlich  * After a channel switch announcement was scheduled and the counter in this
547366e01cf9SLuciano Coelho  * announcement hits 1, this function must be called by the driver to
547473da7d5bSSimon Wunderlich  * notify mac80211 that the channel can be changed.
547573da7d5bSSimon Wunderlich  */
547673da7d5bSSimon Wunderlich void ieee80211_csa_finish(struct ieee80211_vif *vif);
547773da7d5bSSimon Wunderlich 
547873da7d5bSSimon Wunderlich /**
54798552a434SJohn Crispin  * ieee80211_beacon_cntdwn_is_complete - find out if countdown reached 1
548073da7d5bSSimon Wunderlich  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
548173da7d5bSSimon Wunderlich  *
54828552a434SJohn Crispin  * This function returns whether the countdown reached zero.
548373da7d5bSSimon Wunderlich  */
54848552a434SJohn Crispin bool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif);
548573da7d5bSSimon Wunderlich 
548673da7d5bSSimon Wunderlich /**
54875f9404abSJohn Crispin  * ieee80211_color_change_finish - notify mac80211 about color change
54885f9404abSJohn Crispin  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
54895f9404abSJohn Crispin  *
54905f9404abSJohn Crispin  * After a color change announcement was scheduled and the counter in this
54915f9404abSJohn Crispin  * announcement hits 1, this function must be called by the driver to
54925f9404abSJohn Crispin  * notify mac80211 that the color can be changed
54935f9404abSJohn Crispin  */
54945f9404abSJohn Crispin void ieee80211_color_change_finish(struct ieee80211_vif *vif);
54955f9404abSJohn Crispin 
54965f9404abSJohn Crispin /**
549702945821SArik Nemtsov  * ieee80211_proberesp_get - retrieve a Probe Response template
549802945821SArik Nemtsov  * @hw: pointer obtained from ieee80211_alloc_hw().
549902945821SArik Nemtsov  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
550002945821SArik Nemtsov  *
550102945821SArik Nemtsov  * Creates a Probe Response template which can, for example, be uploaded to
550202945821SArik Nemtsov  * hardware. The destination address should be set by the caller.
550302945821SArik Nemtsov  *
550402945821SArik Nemtsov  * Can only be called in AP mode.
55050ae997dcSYacine Belkadi  *
55060ae997dcSYacine Belkadi  * Return: The Probe Response template. %NULL on error.
550702945821SArik Nemtsov  */
550802945821SArik Nemtsov struct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
550902945821SArik Nemtsov 					struct ieee80211_vif *vif);
551002945821SArik Nemtsov 
551102945821SArik Nemtsov /**
55127044cc56SKalle Valo  * ieee80211_pspoll_get - retrieve a PS Poll template
55137044cc56SKalle Valo  * @hw: pointer obtained from ieee80211_alloc_hw().
55147044cc56SKalle Valo  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
55157044cc56SKalle Valo  *
55167044cc56SKalle Valo  * Creates a PS Poll a template which can, for example, uploaded to
55177044cc56SKalle Valo  * hardware. The template must be updated after association so that correct
55187044cc56SKalle Valo  * AID, BSSID and MAC address is used.
55197044cc56SKalle Valo  *
55207044cc56SKalle Valo  * Note: Caller (or hardware) is responsible for setting the
55217044cc56SKalle Valo  * &IEEE80211_FCTL_PM bit.
55220ae997dcSYacine Belkadi  *
55230ae997dcSYacine Belkadi  * Return: The PS Poll template. %NULL on error.
55247044cc56SKalle Valo  */
55257044cc56SKalle Valo struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
55267044cc56SKalle Valo 				     struct ieee80211_vif *vif);
55277044cc56SKalle Valo 
55287044cc56SKalle Valo /**
55297044cc56SKalle Valo  * ieee80211_nullfunc_get - retrieve a nullfunc template
55307044cc56SKalle Valo  * @hw: pointer obtained from ieee80211_alloc_hw().
55317044cc56SKalle Valo  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
55320ab26380SJohannes Berg  * @link_id: If the vif is an MLD, get a frame with the link addresses
55330ab26380SJohannes Berg  *	for the given link ID. For a link_id < 0 you get a frame with
55340ab26380SJohannes Berg  *	MLD addresses, however useful that might be.
55357b6ddeafSJohannes Berg  * @qos_ok: QoS NDP is acceptable to the caller, this should be set
55367b6ddeafSJohannes Berg  *	if at all possible
55377044cc56SKalle Valo  *
55387044cc56SKalle Valo  * Creates a Nullfunc template which can, for example, uploaded to
55397044cc56SKalle Valo  * hardware. The template must be updated after association so that correct
55407044cc56SKalle Valo  * BSSID and address is used.
55417044cc56SKalle Valo  *
55427b6ddeafSJohannes Berg  * If @qos_ndp is set and the association is to an AP with QoS/WMM, the
55437b6ddeafSJohannes Berg  * returned packet will be QoS NDP.
55447b6ddeafSJohannes Berg  *
55457044cc56SKalle Valo  * Note: Caller (or hardware) is responsible for setting the
55467044cc56SKalle Valo  * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields.
55470ae997dcSYacine Belkadi  *
55480ae997dcSYacine Belkadi  * Return: The nullfunc template. %NULL on error.
55497044cc56SKalle Valo  */
55507044cc56SKalle Valo struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
55517b6ddeafSJohannes Berg 				       struct ieee80211_vif *vif,
55520ab26380SJohannes Berg 				       int link_id, bool qos_ok);
55537044cc56SKalle Valo 
55547044cc56SKalle Valo /**
555505e54ea6SKalle Valo  * ieee80211_probereq_get - retrieve a Probe Request template
555605e54ea6SKalle Valo  * @hw: pointer obtained from ieee80211_alloc_hw().
5557a344d677SJohannes Berg  * @src_addr: source MAC address
555805e54ea6SKalle Valo  * @ssid: SSID buffer
555905e54ea6SKalle Valo  * @ssid_len: length of SSID
5560b9a9ada1SJohannes Berg  * @tailroom: tailroom to reserve at end of SKB for IEs
556105e54ea6SKalle Valo  *
556205e54ea6SKalle Valo  * Creates a Probe Request template which can, for example, be uploaded to
556305e54ea6SKalle Valo  * hardware.
55640ae997dcSYacine Belkadi  *
55650ae997dcSYacine Belkadi  * Return: The Probe Request template. %NULL on error.
556605e54ea6SKalle Valo  */
556705e54ea6SKalle Valo struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
5568a344d677SJohannes Berg 				       const u8 *src_addr,
556905e54ea6SKalle Valo 				       const u8 *ssid, size_t ssid_len,
5570b9a9ada1SJohannes Berg 				       size_t tailroom);
557105e54ea6SKalle Valo 
557205e54ea6SKalle Valo /**
5573f0706e82SJiri Benc  * ieee80211_rts_get - RTS frame generation function
5574f0706e82SJiri Benc  * @hw: pointer obtained from ieee80211_alloc_hw().
55751ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5576f0706e82SJiri Benc  * @frame: pointer to the frame that is going to be protected by the RTS.
5577f0706e82SJiri Benc  * @frame_len: the frame length (in octets).
5578e039fa4aSJohannes Berg  * @frame_txctl: &struct ieee80211_tx_info of the frame.
5579f0706e82SJiri Benc  * @rts: The buffer where to store the RTS frame.
5580f0706e82SJiri Benc  *
5581f0706e82SJiri Benc  * If the RTS frames are generated by the host system (i.e., not in
5582f0706e82SJiri Benc  * hardware/firmware), the low-level driver uses this function to receive
5583f0706e82SJiri Benc  * the next RTS frame from the 802.11 code. The low-level is responsible
5584f0706e82SJiri Benc  * for calling this function before and RTS frame is needed.
5585f0706e82SJiri Benc  */
558632bfd35dSJohannes Berg void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
5587f0706e82SJiri Benc 		       const void *frame, size_t frame_len,
5588e039fa4aSJohannes Berg 		       const struct ieee80211_tx_info *frame_txctl,
5589f0706e82SJiri Benc 		       struct ieee80211_rts *rts);
5590f0706e82SJiri Benc 
5591f0706e82SJiri Benc /**
5592f0706e82SJiri Benc  * ieee80211_rts_duration - Get the duration field for an RTS frame
5593f0706e82SJiri Benc  * @hw: pointer obtained from ieee80211_alloc_hw().
55941ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5595f0706e82SJiri Benc  * @frame_len: the length of the frame that is going to be protected by the RTS.
5596e039fa4aSJohannes Berg  * @frame_txctl: &struct ieee80211_tx_info of the frame.
5597f0706e82SJiri Benc  *
5598f0706e82SJiri Benc  * If the RTS is generated in firmware, but the host system must provide
5599f0706e82SJiri Benc  * the duration field, the low-level driver uses this function to receive
5600f0706e82SJiri Benc  * the duration field value in little-endian byteorder.
56010ae997dcSYacine Belkadi  *
56020ae997dcSYacine Belkadi  * Return: The duration.
5603f0706e82SJiri Benc  */
560432bfd35dSJohannes Berg __le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
560532bfd35dSJohannes Berg 			      struct ieee80211_vif *vif, size_t frame_len,
5606e039fa4aSJohannes Berg 			      const struct ieee80211_tx_info *frame_txctl);
5607f0706e82SJiri Benc 
5608f0706e82SJiri Benc /**
5609f0706e82SJiri Benc  * ieee80211_ctstoself_get - CTS-to-self frame generation function
5610f0706e82SJiri Benc  * @hw: pointer obtained from ieee80211_alloc_hw().
56111ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5612f0706e82SJiri Benc  * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
5613f0706e82SJiri Benc  * @frame_len: the frame length (in octets).
5614e039fa4aSJohannes Berg  * @frame_txctl: &struct ieee80211_tx_info of the frame.
5615f0706e82SJiri Benc  * @cts: The buffer where to store the CTS-to-self frame.
5616f0706e82SJiri Benc  *
5617f0706e82SJiri Benc  * If the CTS-to-self frames are generated by the host system (i.e., not in
5618f0706e82SJiri Benc  * hardware/firmware), the low-level driver uses this function to receive
5619f0706e82SJiri Benc  * the next CTS-to-self frame from the 802.11 code. The low-level is responsible
5620f0706e82SJiri Benc  * for calling this function before and CTS-to-self frame is needed.
5621f0706e82SJiri Benc  */
562232bfd35dSJohannes Berg void ieee80211_ctstoself_get(struct ieee80211_hw *hw,
562332bfd35dSJohannes Berg 			     struct ieee80211_vif *vif,
5624f0706e82SJiri Benc 			     const void *frame, size_t frame_len,
5625e039fa4aSJohannes Berg 			     const struct ieee80211_tx_info *frame_txctl,
5626f0706e82SJiri Benc 			     struct ieee80211_cts *cts);
5627f0706e82SJiri Benc 
5628f0706e82SJiri Benc /**
5629f0706e82SJiri Benc  * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame
5630f0706e82SJiri Benc  * @hw: pointer obtained from ieee80211_alloc_hw().
56311ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5632f0706e82SJiri Benc  * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
5633e039fa4aSJohannes Berg  * @frame_txctl: &struct ieee80211_tx_info of the frame.
5634f0706e82SJiri Benc  *
5635f0706e82SJiri Benc  * If the CTS-to-self is generated in firmware, but the host system must provide
5636f0706e82SJiri Benc  * the duration field, the low-level driver uses this function to receive
5637f0706e82SJiri Benc  * the duration field value in little-endian byteorder.
56380ae997dcSYacine Belkadi  *
56390ae997dcSYacine Belkadi  * Return: The duration.
5640f0706e82SJiri Benc  */
564132bfd35dSJohannes Berg __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
564232bfd35dSJohannes Berg 				    struct ieee80211_vif *vif,
5643f0706e82SJiri Benc 				    size_t frame_len,
5644e039fa4aSJohannes Berg 				    const struct ieee80211_tx_info *frame_txctl);
5645f0706e82SJiri Benc 
5646f0706e82SJiri Benc /**
5647f0706e82SJiri Benc  * ieee80211_generic_frame_duration - Calculate the duration field for a frame
5648f0706e82SJiri Benc  * @hw: pointer obtained from ieee80211_alloc_hw().
56491ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5650d13e1414SJohannes Berg  * @band: the band to calculate the frame duration on
5651f0706e82SJiri Benc  * @frame_len: the length of the frame.
56528318d78aSJohannes Berg  * @rate: the rate at which the frame is going to be transmitted.
5653f0706e82SJiri Benc  *
5654f0706e82SJiri Benc  * Calculate the duration field of some generic frame, given its
5655f0706e82SJiri Benc  * length and transmission rate (in 100kbps).
56560ae997dcSYacine Belkadi  *
56570ae997dcSYacine Belkadi  * Return: The duration.
5658f0706e82SJiri Benc  */
565932bfd35dSJohannes Berg __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
566032bfd35dSJohannes Berg 					struct ieee80211_vif *vif,
566157fbcce3SJohannes Berg 					enum nl80211_band band,
5662f0706e82SJiri Benc 					size_t frame_len,
56638318d78aSJohannes Berg 					struct ieee80211_rate *rate);
5664f0706e82SJiri Benc 
5665f0706e82SJiri Benc /**
5666f0706e82SJiri Benc  * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
5667f0706e82SJiri Benc  * @hw: pointer as obtained from ieee80211_alloc_hw().
56681ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
5669f0706e82SJiri Benc  *
5670f0706e82SJiri Benc  * Function for accessing buffered broadcast and multicast frames. If
5671f0706e82SJiri Benc  * hardware/firmware does not implement buffering of broadcast/multicast
5672f0706e82SJiri Benc  * frames when power saving is used, 802.11 code buffers them in the host
5673f0706e82SJiri Benc  * memory. The low-level driver uses this function to fetch next buffered
56740ae997dcSYacine Belkadi  * frame. In most cases, this is used when generating beacon frame.
56750ae997dcSYacine Belkadi  *
56760ae997dcSYacine Belkadi  * Return: A pointer to the next buffered skb or NULL if no more buffered
56770ae997dcSYacine Belkadi  * frames are available.
5678f0706e82SJiri Benc  *
5679f0706e82SJiri Benc  * Note: buffered frames are returned only after DTIM beacon frame was
5680f0706e82SJiri Benc  * generated with ieee80211_beacon_get() and the low-level driver must thus
5681f0706e82SJiri Benc  * call ieee80211_beacon_get() first. ieee80211_get_buffered_bc() returns
5682f0706e82SJiri Benc  * NULL if the previous generated beacon was not DTIM, so the low-level driver
5683f0706e82SJiri Benc  * does not need to check for DTIM beacons separately and should be able to
5684f0706e82SJiri Benc  * use common code for all beacons.
5685f0706e82SJiri Benc  */
5686f0706e82SJiri Benc struct sk_buff *
5687e039fa4aSJohannes Berg ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
5688f0706e82SJiri Benc 
568975a5f0ccSJohannes Berg /**
569042d98795SJohannes Berg  * ieee80211_get_tkip_p1k_iv - get a TKIP phase 1 key for IV32
569142d98795SJohannes Berg  *
569242d98795SJohannes Berg  * This function returns the TKIP phase 1 key for the given IV32.
569342d98795SJohannes Berg  *
569442d98795SJohannes Berg  * @keyconf: the parameter passed with the set key
569542d98795SJohannes Berg  * @iv32: IV32 to get the P1K for
569642d98795SJohannes Berg  * @p1k: a buffer to which the key will be written, as 5 u16 values
569742d98795SJohannes Berg  */
569842d98795SJohannes Berg void ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf,
569942d98795SJohannes Berg 			       u32 iv32, u16 *p1k);
570042d98795SJohannes Berg 
570142d98795SJohannes Berg /**
5702523b02eaSJohannes Berg  * ieee80211_get_tkip_p1k - get a TKIP phase 1 key
57035d2cdcd4SEmmanuel Grumbach  *
5704523b02eaSJohannes Berg  * This function returns the TKIP phase 1 key for the IV32 taken
5705523b02eaSJohannes Berg  * from the given packet.
57065d2cdcd4SEmmanuel Grumbach  *
57075d2cdcd4SEmmanuel Grumbach  * @keyconf: the parameter passed with the set key
5708523b02eaSJohannes Berg  * @skb: the packet to take the IV32 value from that will be encrypted
5709523b02eaSJohannes Berg  *	with this P1K
5710523b02eaSJohannes Berg  * @p1k: a buffer to which the key will be written, as 5 u16 values
57115d2cdcd4SEmmanuel Grumbach  */
ieee80211_get_tkip_p1k(struct ieee80211_key_conf * keyconf,struct sk_buff * skb,u16 * p1k)571242d98795SJohannes Berg static inline void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf,
571342d98795SJohannes Berg 					  struct sk_buff *skb, u16 *p1k)
571442d98795SJohannes Berg {
571542d98795SJohannes Berg 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
571642d98795SJohannes Berg 	const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
571742d98795SJohannes Berg 	u32 iv32 = get_unaligned_le32(&data[4]);
571842d98795SJohannes Berg 
571942d98795SJohannes Berg 	ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k);
572042d98795SJohannes Berg }
5721523b02eaSJohannes Berg 
5722523b02eaSJohannes Berg /**
57238bca5d81SJohannes Berg  * ieee80211_get_tkip_rx_p1k - get a TKIP phase 1 key for RX
57248bca5d81SJohannes Berg  *
57258bca5d81SJohannes Berg  * This function returns the TKIP phase 1 key for the given IV32
57268bca5d81SJohannes Berg  * and transmitter address.
57278bca5d81SJohannes Berg  *
57288bca5d81SJohannes Berg  * @keyconf: the parameter passed with the set key
57298bca5d81SJohannes Berg  * @ta: TA that will be used with the key
57308bca5d81SJohannes Berg  * @iv32: IV32 to get the P1K for
57318bca5d81SJohannes Berg  * @p1k: a buffer to which the key will be written, as 5 u16 values
57328bca5d81SJohannes Berg  */
57338bca5d81SJohannes Berg void ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
57348bca5d81SJohannes Berg 			       const u8 *ta, u32 iv32, u16 *p1k);
57358bca5d81SJohannes Berg 
57368bca5d81SJohannes Berg /**
5737523b02eaSJohannes Berg  * ieee80211_get_tkip_p2k - get a TKIP phase 2 key
5738523b02eaSJohannes Berg  *
5739523b02eaSJohannes Berg  * This function computes the TKIP RC4 key for the IV values
5740523b02eaSJohannes Berg  * in the packet.
5741523b02eaSJohannes Berg  *
5742523b02eaSJohannes Berg  * @keyconf: the parameter passed with the set key
5743523b02eaSJohannes Berg  * @skb: the packet to take the IV32/IV16 values from that will be
5744523b02eaSJohannes Berg  *	encrypted with this key
5745523b02eaSJohannes Berg  * @p2k: a buffer to which the key will be written, 16 bytes
5746523b02eaSJohannes Berg  */
5747523b02eaSJohannes Berg void ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
5748523b02eaSJohannes Berg 			    struct sk_buff *skb, u8 *p2k);
5749c68f4b89SJohannes Berg 
5750c68f4b89SJohannes Berg /**
5751f8079d43SEliad Peller  * ieee80211_tkip_add_iv - write TKIP IV and Ext. IV to pos
5752f8079d43SEliad Peller  *
5753f8079d43SEliad Peller  * @pos: start of crypto header
5754f8079d43SEliad Peller  * @keyconf: the parameter passed with the set key
5755f8079d43SEliad Peller  * @pn: PN to add
5756f8079d43SEliad Peller  *
5757f8079d43SEliad Peller  * Returns: pointer to the octet following IVs (i.e. beginning of
5758f8079d43SEliad Peller  * the packet payload)
5759f8079d43SEliad Peller  *
5760f8079d43SEliad Peller  * This function writes the tkip IV value to pos (which should
5761f8079d43SEliad Peller  * point to the crypto header)
5762f8079d43SEliad Peller  */
5763f8079d43SEliad Peller u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key_conf *keyconf, u64 pn);
5764f8079d43SEliad Peller 
5765f8079d43SEliad Peller /**
57663ea542d3SJohannes Berg  * ieee80211_get_key_rx_seq - get key RX sequence counter
57673ea542d3SJohannes Berg  *
57683ea542d3SJohannes Berg  * @keyconf: the parameter passed with the set key
576900b9cfa3SJouni Malinen  * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
57703ea542d3SJohannes Berg  *	the value on TID 0 is also used for non-QoS frames. For
57713ea542d3SJohannes Berg  *	CMAC, only TID 0 is valid.
57723ea542d3SJohannes Berg  * @seq: buffer to receive the sequence data
57733ea542d3SJohannes Berg  *
57743ea542d3SJohannes Berg  * This function allows a driver to retrieve the current RX IV/PNs
57753ea542d3SJohannes Berg  * for the given key. It must not be called if IV checking is done
57763ea542d3SJohannes Berg  * by the device and not by mac80211.
57773ea542d3SJohannes Berg  *
57783ea542d3SJohannes Berg  * Note that this function may only be called when no RX processing
57793ea542d3SJohannes Berg  * can be done concurrently.
57803ea542d3SJohannes Berg  */
57813ea542d3SJohannes Berg void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
57823ea542d3SJohannes Berg 			      int tid, struct ieee80211_key_seq *seq);
57833ea542d3SJohannes Berg 
57843ea542d3SJohannes Berg /**
578527b3eb9cSJohannes Berg  * ieee80211_set_key_rx_seq - set key RX sequence counter
578627b3eb9cSJohannes Berg  *
578727b3eb9cSJohannes Berg  * @keyconf: the parameter passed with the set key
578800b9cfa3SJouni Malinen  * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
578927b3eb9cSJohannes Berg  *	the value on TID 0 is also used for non-QoS frames. For
579027b3eb9cSJohannes Berg  *	CMAC, only TID 0 is valid.
579127b3eb9cSJohannes Berg  * @seq: new sequence data
579227b3eb9cSJohannes Berg  *
579327b3eb9cSJohannes Berg  * This function allows a driver to set the current RX IV/PNs for the
579427b3eb9cSJohannes Berg  * given key. This is useful when resuming from WoWLAN sleep and GTK
579527b3eb9cSJohannes Berg  * rekey may have been done while suspended. It should not be called
579627b3eb9cSJohannes Berg  * if IV checking is done by the device and not by mac80211.
579727b3eb9cSJohannes Berg  *
579827b3eb9cSJohannes Berg  * Note that this function may only be called when no RX processing
579927b3eb9cSJohannes Berg  * can be done concurrently.
580027b3eb9cSJohannes Berg  */
580127b3eb9cSJohannes Berg void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf,
580227b3eb9cSJohannes Berg 			      int tid, struct ieee80211_key_seq *seq);
580327b3eb9cSJohannes Berg 
580427b3eb9cSJohannes Berg /**
580527b3eb9cSJohannes Berg  * ieee80211_remove_key - remove the given key
580627b3eb9cSJohannes Berg  * @keyconf: the parameter passed with the set key
580727b3eb9cSJohannes Berg  *
580827b3eb9cSJohannes Berg  * Remove the given key. If the key was uploaded to the hardware at the
580927b3eb9cSJohannes Berg  * time this function is called, it is not deleted in the hardware but
581027b3eb9cSJohannes Berg  * instead assumed to have been removed already.
581127b3eb9cSJohannes Berg  *
581227b3eb9cSJohannes Berg  * Note that due to locking considerations this function can (currently)
581327b3eb9cSJohannes Berg  * only be called during key iteration (ieee80211_iter_keys().)
581427b3eb9cSJohannes Berg  */
581527b3eb9cSJohannes Berg void ieee80211_remove_key(struct ieee80211_key_conf *keyconf);
581627b3eb9cSJohannes Berg 
581727b3eb9cSJohannes Berg /**
581827b3eb9cSJohannes Berg  * ieee80211_gtk_rekey_add - add a GTK key from rekeying during WoWLAN
581927b3eb9cSJohannes Berg  * @vif: the virtual interface to add the key on
582027b3eb9cSJohannes Berg  * @keyconf: new key data
582127b3eb9cSJohannes Berg  *
582227b3eb9cSJohannes Berg  * When GTK rekeying was done while the system was suspended, (a) new
582327b3eb9cSJohannes Berg  * key(s) will be available. These will be needed by mac80211 for proper
582427b3eb9cSJohannes Berg  * RX processing, so this function allows setting them.
582527b3eb9cSJohannes Berg  *
582627b3eb9cSJohannes Berg  * The function returns the newly allocated key structure, which will
582727b3eb9cSJohannes Berg  * have similar contents to the passed key configuration but point to
582827b3eb9cSJohannes Berg  * mac80211-owned memory. In case of errors, the function returns an
582927b3eb9cSJohannes Berg  * ERR_PTR(), use IS_ERR() etc.
583027b3eb9cSJohannes Berg  *
583127b3eb9cSJohannes Berg  * Note that this function assumes the key isn't added to hardware
583227b3eb9cSJohannes Berg  * acceleration, so no TX will be done with the key. Since it's a GTK
583327b3eb9cSJohannes Berg  * on managed (station) networks, this is true anyway. If the driver
583427b3eb9cSJohannes Berg  * calls this function from the resume callback and subsequently uses
583527b3eb9cSJohannes Berg  * the return code 1 to reconfigure the device, this key will be part
583627b3eb9cSJohannes Berg  * of the reconfiguration.
583727b3eb9cSJohannes Berg  *
583827b3eb9cSJohannes Berg  * Note that the driver should also call ieee80211_set_key_rx_seq()
583927b3eb9cSJohannes Berg  * for the new key for each TID to set up sequence counters properly.
584027b3eb9cSJohannes Berg  *
584127b3eb9cSJohannes Berg  * IMPORTANT: If this replaces a key that is present in the hardware,
584227b3eb9cSJohannes Berg  * then it will attempt to remove it during this call. In many cases
584327b3eb9cSJohannes Berg  * this isn't what you want, so call ieee80211_remove_key() first for
584427b3eb9cSJohannes Berg  * the key that's being replaced.
584527b3eb9cSJohannes Berg  */
584627b3eb9cSJohannes Berg struct ieee80211_key_conf *
584727b3eb9cSJohannes Berg ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
584827b3eb9cSJohannes Berg 			struct ieee80211_key_conf *keyconf);
584927b3eb9cSJohannes Berg 
585027b3eb9cSJohannes Berg /**
5851c68f4b89SJohannes Berg  * ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying
5852c68f4b89SJohannes Berg  * @vif: virtual interface the rekeying was done on
5853c68f4b89SJohannes Berg  * @bssid: The BSSID of the AP, for checking association
5854c68f4b89SJohannes Berg  * @replay_ctr: the new replay counter after GTK rekeying
5855c68f4b89SJohannes Berg  * @gfp: allocation flags
5856c68f4b89SJohannes Berg  */
5857c68f4b89SJohannes Berg void ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid,
5858c68f4b89SJohannes Berg 				const u8 *replay_ctr, gfp_t gfp);
5859c68f4b89SJohannes Berg 
58605d2cdcd4SEmmanuel Grumbach /**
58614271d4bdSJohannes Berg  * ieee80211_key_mic_failure - increment MIC failure counter for the key
58624271d4bdSJohannes Berg  *
58634271d4bdSJohannes Berg  * Note: this is really only safe if no other RX function is called
58644271d4bdSJohannes Berg  * at the same time.
58654271d4bdSJohannes Berg  *
58664271d4bdSJohannes Berg  * @keyconf: the key in question
58674271d4bdSJohannes Berg  */
58684271d4bdSJohannes Berg void ieee80211_key_mic_failure(struct ieee80211_key_conf *keyconf);
58694271d4bdSJohannes Berg 
58704271d4bdSJohannes Berg /**
58714271d4bdSJohannes Berg  * ieee80211_key_replay - increment replay counter for the key
58724271d4bdSJohannes Berg  *
58734271d4bdSJohannes Berg  * Note: this is really only safe if no other RX function is called
58744271d4bdSJohannes Berg  * at the same time.
58754271d4bdSJohannes Berg  *
58764271d4bdSJohannes Berg  * @keyconf: the key in question
58774271d4bdSJohannes Berg  */
58784271d4bdSJohannes Berg void ieee80211_key_replay(struct ieee80211_key_conf *keyconf);
58794271d4bdSJohannes Berg 
58804271d4bdSJohannes Berg /**
5881f0706e82SJiri Benc  * ieee80211_wake_queue - wake specific queue
5882f0706e82SJiri Benc  * @hw: pointer as obtained from ieee80211_alloc_hw().
5883f0706e82SJiri Benc  * @queue: queue number (counted from zero).
5884f0706e82SJiri Benc  *
5885c850e31fSAlexander Wetzel  * Drivers must use this function instead of netif_wake_queue.
5886f0706e82SJiri Benc  */
5887f0706e82SJiri Benc void ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
5888f0706e82SJiri Benc 
5889f0706e82SJiri Benc /**
5890f0706e82SJiri Benc  * ieee80211_stop_queue - stop specific queue
5891f0706e82SJiri Benc  * @hw: pointer as obtained from ieee80211_alloc_hw().
5892f0706e82SJiri Benc  * @queue: queue number (counted from zero).
5893f0706e82SJiri Benc  *
5894c850e31fSAlexander Wetzel  * Drivers must use this function instead of netif_stop_queue.
5895f0706e82SJiri Benc  */
5896f0706e82SJiri Benc void ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
5897f0706e82SJiri Benc 
5898f0706e82SJiri Benc /**
589992ab8535STomas Winkler  * ieee80211_queue_stopped - test status of the queue
590092ab8535STomas Winkler  * @hw: pointer as obtained from ieee80211_alloc_hw().
590192ab8535STomas Winkler  * @queue: queue number (counted from zero).
590292ab8535STomas Winkler  *
5903c850e31fSAlexander Wetzel  * Drivers must use this function instead of netif_queue_stopped.
59040ae997dcSYacine Belkadi  *
59050ae997dcSYacine Belkadi  * Return: %true if the queue is stopped. %false otherwise.
590692ab8535STomas Winkler  */
590792ab8535STomas Winkler 
590892ab8535STomas Winkler int ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue);
590992ab8535STomas Winkler 
591092ab8535STomas Winkler /**
5911f0706e82SJiri Benc  * ieee80211_stop_queues - stop all queues
5912f0706e82SJiri Benc  * @hw: pointer as obtained from ieee80211_alloc_hw().
5913f0706e82SJiri Benc  *
5914c850e31fSAlexander Wetzel  * Drivers must use this function instead of netif_tx_stop_all_queues.
5915f0706e82SJiri Benc  */
5916f0706e82SJiri Benc void ieee80211_stop_queues(struct ieee80211_hw *hw);
5917f0706e82SJiri Benc 
5918f0706e82SJiri Benc /**
5919f0706e82SJiri Benc  * ieee80211_wake_queues - wake all queues
5920f0706e82SJiri Benc  * @hw: pointer as obtained from ieee80211_alloc_hw().
5921f0706e82SJiri Benc  *
5922c850e31fSAlexander Wetzel  * Drivers must use this function instead of netif_tx_wake_all_queues.
5923f0706e82SJiri Benc  */
5924f0706e82SJiri Benc void ieee80211_wake_queues(struct ieee80211_hw *hw);
5925f0706e82SJiri Benc 
592675a5f0ccSJohannes Berg /**
592775a5f0ccSJohannes Berg  * ieee80211_scan_completed - completed hardware scan
592875a5f0ccSJohannes Berg  *
592975a5f0ccSJohannes Berg  * When hardware scan offload is used (i.e. the hw_scan() callback is
593075a5f0ccSJohannes Berg  * assigned) this function needs to be called by the driver to notify
59318789d459SJohannes Berg  * mac80211 that the scan finished. This function can be called from
59328789d459SJohannes Berg  * any context, including hardirq context.
593375a5f0ccSJohannes Berg  *
593475a5f0ccSJohannes Berg  * @hw: the hardware that finished the scan
59357947d3e0SAvraham Stern  * @info: information about the completed scan
593675a5f0ccSJohannes Berg  */
59377947d3e0SAvraham Stern void ieee80211_scan_completed(struct ieee80211_hw *hw,
59387947d3e0SAvraham Stern 			      struct cfg80211_scan_info *info);
5939f0706e82SJiri Benc 
5940dabeb344SJohannes Berg /**
594179f460caSLuciano Coelho  * ieee80211_sched_scan_results - got results from scheduled scan
594279f460caSLuciano Coelho  *
594379f460caSLuciano Coelho  * When a scheduled scan is running, this function needs to be called by the
594479f460caSLuciano Coelho  * driver whenever there are new scan results available.
594579f460caSLuciano Coelho  *
594679f460caSLuciano Coelho  * @hw: the hardware that is performing scheduled scans
594779f460caSLuciano Coelho  */
594879f460caSLuciano Coelho void ieee80211_sched_scan_results(struct ieee80211_hw *hw);
594979f460caSLuciano Coelho 
595079f460caSLuciano Coelho /**
595179f460caSLuciano Coelho  * ieee80211_sched_scan_stopped - inform that the scheduled scan has stopped
595279f460caSLuciano Coelho  *
595379f460caSLuciano Coelho  * When a scheduled scan is running, this function can be called by
595479f460caSLuciano Coelho  * the driver if it needs to stop the scan to perform another task.
595579f460caSLuciano Coelho  * Usual scenarios are drivers that cannot continue the scheduled scan
595679f460caSLuciano Coelho  * while associating, for instance.
595779f460caSLuciano Coelho  *
595879f460caSLuciano Coelho  * @hw: the hardware that is performing scheduled scans
595979f460caSLuciano Coelho  */
596079f460caSLuciano Coelho void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
596179f460caSLuciano Coelho 
596279f460caSLuciano Coelho /**
59638b2c9824SJohannes Berg  * enum ieee80211_interface_iteration_flags - interface iteration flags
59648b2c9824SJohannes Berg  * @IEEE80211_IFACE_ITER_NORMAL: Iterate over all interfaces that have
59658b2c9824SJohannes Berg  *	been added to the driver; However, note that during hardware
59668b2c9824SJohannes Berg  *	reconfiguration (after restart_hw) it will iterate over a new
59678b2c9824SJohannes Berg  *	interface and over all the existing interfaces even if they
59688b2c9824SJohannes Berg  *	haven't been re-added to the driver yet.
59698b2c9824SJohannes Berg  * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all
59708b2c9824SJohannes Berg  *	interfaces, even if they haven't been re-added to the driver yet.
59713384d757SArik Nemtsov  * @IEEE80211_IFACE_ITER_ACTIVE: Iterate only active interfaces (netdev is up).
5972265a0708SBen Greear  * @IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER: Skip any interfaces where SDATA
5973265a0708SBen Greear  *	is not in the driver.  This may fix crashes during firmware recovery
5974265a0708SBen Greear  *	for instance.
59758b2c9824SJohannes Berg  */
59768b2c9824SJohannes Berg enum ieee80211_interface_iteration_flags {
59778b2c9824SJohannes Berg 	IEEE80211_IFACE_ITER_NORMAL	= 0,
59788b2c9824SJohannes Berg 	IEEE80211_IFACE_ITER_RESUME_ALL	= BIT(0),
59793384d757SArik Nemtsov 	IEEE80211_IFACE_ITER_ACTIVE	= BIT(1),
5980265a0708SBen Greear 	IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER	= BIT(2),
59818b2c9824SJohannes Berg };
59828b2c9824SJohannes Berg 
59838b2c9824SJohannes Berg /**
59843384d757SArik Nemtsov  * ieee80211_iterate_interfaces - iterate interfaces
59853384d757SArik Nemtsov  *
59863384d757SArik Nemtsov  * This function iterates over the interfaces associated with a given
59873384d757SArik Nemtsov  * hardware and calls the callback for them. This includes active as well as
59883384d757SArik Nemtsov  * inactive interfaces. This function allows the iterator function to sleep.
59893384d757SArik Nemtsov  * Will iterate over a new interface during add_interface().
59903384d757SArik Nemtsov  *
59913384d757SArik Nemtsov  * @hw: the hardware struct of which the interfaces should be iterated over
59923384d757SArik Nemtsov  * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
59933384d757SArik Nemtsov  * @iterator: the iterator function to call
59943384d757SArik Nemtsov  * @data: first argument of the iterator function
59953384d757SArik Nemtsov  */
59963384d757SArik Nemtsov void ieee80211_iterate_interfaces(struct ieee80211_hw *hw, u32 iter_flags,
59973384d757SArik Nemtsov 				  void (*iterator)(void *data, u8 *mac,
59983384d757SArik Nemtsov 						   struct ieee80211_vif *vif),
59993384d757SArik Nemtsov 				  void *data);
60003384d757SArik Nemtsov 
60013384d757SArik Nemtsov /**
6002dabeb344SJohannes Berg  * ieee80211_iterate_active_interfaces - iterate active interfaces
6003dabeb344SJohannes Berg  *
6004dabeb344SJohannes Berg  * This function iterates over the interfaces associated with a given
6005dabeb344SJohannes Berg  * hardware that are currently active and calls the callback for them.
60062f561febSIvo van Doorn  * This function allows the iterator function to sleep, when the iterator
60072f561febSIvo van Doorn  * function is atomic @ieee80211_iterate_active_interfaces_atomic can
60082f561febSIvo van Doorn  * be used.
60098b2c9824SJohannes Berg  * Does not iterate over a new interface during add_interface().
60102f561febSIvo van Doorn  *
60112f561febSIvo van Doorn  * @hw: the hardware struct of which the interfaces should be iterated over
60128b2c9824SJohannes Berg  * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
60132f561febSIvo van Doorn  * @iterator: the iterator function to call
60142f561febSIvo van Doorn  * @data: first argument of the iterator function
60152f561febSIvo van Doorn  */
60163384d757SArik Nemtsov static inline void
ieee80211_iterate_active_interfaces(struct ieee80211_hw * hw,u32 iter_flags,void (* iterator)(void * data,u8 * mac,struct ieee80211_vif * vif),void * data)60173384d757SArik Nemtsov ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, u32 iter_flags,
60182f561febSIvo van Doorn 				    void (*iterator)(void *data, u8 *mac,
60192f561febSIvo van Doorn 						     struct ieee80211_vif *vif),
60203384d757SArik Nemtsov 				    void *data)
60213384d757SArik Nemtsov {
60223384d757SArik Nemtsov 	ieee80211_iterate_interfaces(hw,
60233384d757SArik Nemtsov 				     iter_flags | IEEE80211_IFACE_ITER_ACTIVE,
60243384d757SArik Nemtsov 				     iterator, data);
60253384d757SArik Nemtsov }
60262f561febSIvo van Doorn 
60272f561febSIvo van Doorn /**
60282f561febSIvo van Doorn  * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces
60292f561febSIvo van Doorn  *
60302f561febSIvo van Doorn  * This function iterates over the interfaces associated with a given
60312f561febSIvo van Doorn  * hardware that are currently active and calls the callback for them.
60322f561febSIvo van Doorn  * This function requires the iterator callback function to be atomic,
60332f561febSIvo van Doorn  * if that is not desired, use @ieee80211_iterate_active_interfaces instead.
60348b2c9824SJohannes Berg  * Does not iterate over a new interface during add_interface().
6035dabeb344SJohannes Berg  *
6036dabeb344SJohannes Berg  * @hw: the hardware struct of which the interfaces should be iterated over
60378b2c9824SJohannes Berg  * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
6038e38bad47SJohannes Berg  * @iterator: the iterator function to call, cannot sleep
6039dabeb344SJohannes Berg  * @data: first argument of the iterator function
6040dabeb344SJohannes Berg  */
60412f561febSIvo van Doorn void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
60428b2c9824SJohannes Berg 						u32 iter_flags,
60432f561febSIvo van Doorn 						void (*iterator)(void *data,
60442f561febSIvo van Doorn 						    u8 *mac,
604532bfd35dSJohannes Berg 						    struct ieee80211_vif *vif),
6046dabeb344SJohannes Berg 						void *data);
6047dabeb344SJohannes Berg 
60480df3ef45SRon Rindjunsky /**
6049a05829a7SJohannes Berg  * ieee80211_iterate_active_interfaces_mtx - iterate active interfaces
6050c7c71066SJohannes Berg  *
6051c7c71066SJohannes Berg  * This function iterates over the interfaces associated with a given
6052c7c71066SJohannes Berg  * hardware that are currently active and calls the callback for them.
605334fb4db5SBrian Norris  * This version can only be used while holding the wiphy mutex.
6054c7c71066SJohannes Berg  *
6055c7c71066SJohannes Berg  * @hw: the hardware struct of which the interfaces should be iterated over
6056c7c71066SJohannes Berg  * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
6057c7c71066SJohannes Berg  * @iterator: the iterator function to call, cannot sleep
6058c7c71066SJohannes Berg  * @data: first argument of the iterator function
6059c7c71066SJohannes Berg  */
6060a05829a7SJohannes Berg void ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,
6061c7c71066SJohannes Berg 					     u32 iter_flags,
6062c7c71066SJohannes Berg 					     void (*iterator)(void *data,
6063c7c71066SJohannes Berg 						u8 *mac,
6064c7c71066SJohannes Berg 						struct ieee80211_vif *vif),
6065c7c71066SJohannes Berg 					     void *data);
6066c7c71066SJohannes Berg 
6067c7c71066SJohannes Berg /**
60680fc1e049SArik Nemtsov  * ieee80211_iterate_stations_atomic - iterate stations
60690fc1e049SArik Nemtsov  *
60700fc1e049SArik Nemtsov  * This function iterates over all stations associated with a given
60710fc1e049SArik Nemtsov  * hardware that are currently uploaded to the driver and calls the callback
60720fc1e049SArik Nemtsov  * function for them.
60730fc1e049SArik Nemtsov  * This function requires the iterator callback function to be atomic,
60740fc1e049SArik Nemtsov  *
60750fc1e049SArik Nemtsov  * @hw: the hardware struct of which the interfaces should be iterated over
60760fc1e049SArik Nemtsov  * @iterator: the iterator function to call, cannot sleep
60770fc1e049SArik Nemtsov  * @data: first argument of the iterator function
60780fc1e049SArik Nemtsov  */
60790fc1e049SArik Nemtsov void ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
60800fc1e049SArik Nemtsov 				       void (*iterator)(void *data,
60810fc1e049SArik Nemtsov 						struct ieee80211_sta *sta),
60820fc1e049SArik Nemtsov 				       void *data);
6083*dc609410SRory Little 
6084*dc609410SRory Little /**
6085*dc609410SRory Little  * ieee80211_iterate_stations_mtx - iterate stations
6086*dc609410SRory Little  *
6087*dc609410SRory Little  * This function iterates over all stations associated with a given
6088*dc609410SRory Little  * hardware that are currently uploaded to the driver and calls the callback
6089*dc609410SRory Little  * function for them. This version can only be used while holding the wiphy
6090*dc609410SRory Little  * mutex.
6091*dc609410SRory Little  *
6092*dc609410SRory Little  * @hw: the hardware struct of which the interfaces should be iterated over
6093*dc609410SRory Little  * @iterator: the iterator function to call
6094*dc609410SRory Little  * @data: first argument of the iterator function
6095*dc609410SRory Little  */
6096*dc609410SRory Little void ieee80211_iterate_stations_mtx(struct ieee80211_hw *hw,
6097*dc609410SRory Little 				    void (*iterator)(void *data,
6098*dc609410SRory Little 						     struct ieee80211_sta *sta),
6099*dc609410SRory Little 				    void *data);
6100*dc609410SRory Little 
61010fc1e049SArik Nemtsov /**
610242935ecaSLuis R. Rodriguez  * ieee80211_queue_work - add work onto the mac80211 workqueue
610342935ecaSLuis R. Rodriguez  *
610442935ecaSLuis R. Rodriguez  * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
610542935ecaSLuis R. Rodriguez  * This helper ensures drivers are not queueing work when they should not be.
610642935ecaSLuis R. Rodriguez  *
610742935ecaSLuis R. Rodriguez  * @hw: the hardware struct for the interface we are adding work for
610842935ecaSLuis R. Rodriguez  * @work: the work we want to add onto the mac80211 workqueue
610942935ecaSLuis R. Rodriguez  */
611042935ecaSLuis R. Rodriguez void ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
611142935ecaSLuis R. Rodriguez 
611242935ecaSLuis R. Rodriguez /**
611342935ecaSLuis R. Rodriguez  * ieee80211_queue_delayed_work - add work onto the mac80211 workqueue
611442935ecaSLuis R. Rodriguez  *
611542935ecaSLuis R. Rodriguez  * Drivers and mac80211 use this to queue delayed work onto the mac80211
611642935ecaSLuis R. Rodriguez  * workqueue.
611742935ecaSLuis R. Rodriguez  *
611842935ecaSLuis R. Rodriguez  * @hw: the hardware struct for the interface we are adding work for
611942935ecaSLuis R. Rodriguez  * @dwork: delayable work to queue onto the mac80211 workqueue
612042935ecaSLuis R. Rodriguez  * @delay: number of jiffies to wait before queueing
612142935ecaSLuis R. Rodriguez  */
612242935ecaSLuis R. Rodriguez void ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
612342935ecaSLuis R. Rodriguez 				  struct delayed_work *dwork,
612442935ecaSLuis R. Rodriguez 				  unsigned long delay);
612542935ecaSLuis R. Rodriguez 
612642935ecaSLuis R. Rodriguez /**
61275383bfffSRyder Lee  * ieee80211_refresh_tx_agg_session_timer - Refresh a tx agg session timer.
61285383bfffSRyder Lee  * @sta: the station for which to start a BA session
61295383bfffSRyder Lee  * @tid: the TID to BA on.
61305383bfffSRyder Lee  *
61315383bfffSRyder Lee  * This function allows low level driver to refresh tx agg session timer
61325383bfffSRyder Lee  * to maintain BA session, the session level will still be managed by the
61335383bfffSRyder Lee  * mac80211.
61345383bfffSRyder Lee  *
61355383bfffSRyder Lee  * Note: must be called in an RCU critical section.
61365383bfffSRyder Lee  */
61375383bfffSRyder Lee void ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,
61385383bfffSRyder Lee 					    u16 tid);
61395383bfffSRyder Lee 
61405383bfffSRyder Lee /**
61410df3ef45SRon Rindjunsky  * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
6142c951ad35SJohannes Berg  * @sta: the station for which to start a BA session
61430df3ef45SRon Rindjunsky  * @tid: the TID to BA on.
6144bd2ce6e4SSujith Manoharan  * @timeout: session timeout value (in TUs)
6145ea2d8b59SRandy Dunlap  *
6146ea2d8b59SRandy Dunlap  * Return: success if addBA request was sent, failure otherwise
61470df3ef45SRon Rindjunsky  *
61480df3ef45SRon Rindjunsky  * Although mac80211/low level driver/user space application can estimate
61490df3ef45SRon Rindjunsky  * the need to start aggregation on a certain RA/TID, the session level
61500df3ef45SRon Rindjunsky  * will be managed by the mac80211.
61510df3ef45SRon Rindjunsky  */
6152bd2ce6e4SSujith Manoharan int ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
6153bd2ce6e4SSujith Manoharan 				  u16 timeout);
61540df3ef45SRon Rindjunsky 
61550df3ef45SRon Rindjunsky /**
61560df3ef45SRon Rindjunsky  * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
61571ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback
61580df3ef45SRon Rindjunsky  * @ra: receiver address of the BA session recipient.
61590df3ef45SRon Rindjunsky  * @tid: the TID to BA on.
61600df3ef45SRon Rindjunsky  *
61610df3ef45SRon Rindjunsky  * This function must be called by low level driver once it has
61625d22c89bSJohannes Berg  * finished with preparations for the BA session. It can be called
61635d22c89bSJohannes Berg  * from any context.
61640df3ef45SRon Rindjunsky  */
6165c951ad35SJohannes Berg void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
61660df3ef45SRon Rindjunsky 				      u16 tid);
61670df3ef45SRon Rindjunsky 
61680df3ef45SRon Rindjunsky /**
61690df3ef45SRon Rindjunsky  * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
6170c951ad35SJohannes Berg  * @sta: the station whose BA session to stop
61710df3ef45SRon Rindjunsky  * @tid: the TID to stop BA.
6172ea2d8b59SRandy Dunlap  *
61736a8579d0SJohannes Berg  * Return: negative error if the TID is invalid, or no aggregation active
61740df3ef45SRon Rindjunsky  *
61750df3ef45SRon Rindjunsky  * Although mac80211/low level driver/user space application can estimate
61760df3ef45SRon Rindjunsky  * the need to stop aggregation on a certain RA/TID, the session level
61770df3ef45SRon Rindjunsky  * will be managed by the mac80211.
61780df3ef45SRon Rindjunsky  */
61796a8579d0SJohannes Berg int ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
61800df3ef45SRon Rindjunsky 
61810df3ef45SRon Rindjunsky /**
61820df3ef45SRon Rindjunsky  * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
61831ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback
61840df3ef45SRon Rindjunsky  * @ra: receiver address of the BA session recipient.
61850df3ef45SRon Rindjunsky  * @tid: the desired TID to BA on.
61860df3ef45SRon Rindjunsky  *
61870df3ef45SRon Rindjunsky  * This function must be called by low level driver once it has
61885d22c89bSJohannes Berg  * finished with preparations for the BA session tear down. It
61895d22c89bSJohannes Berg  * can be called from any context.
61900df3ef45SRon Rindjunsky  */
6191c951ad35SJohannes Berg void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
61920df3ef45SRon Rindjunsky 				     u16 tid);
61930df3ef45SRon Rindjunsky 
619484363e6eSMohamed Abbas /**
619517741cdcSJohannes Berg  * ieee80211_find_sta - find a station
619617741cdcSJohannes Berg  *
61975ed176e1SJohannes Berg  * @vif: virtual interface to look for station on
619817741cdcSJohannes Berg  * @addr: station's address
619917741cdcSJohannes Berg  *
62000ae997dcSYacine Belkadi  * Return: The station, if found. %NULL otherwise.
62010ae997dcSYacine Belkadi  *
62020ae997dcSYacine Belkadi  * Note: This function must be called under RCU lock and the
620317741cdcSJohannes Berg  * resulting pointer is only valid under RCU lock as well.
620417741cdcSJohannes Berg  */
62055ed176e1SJohannes Berg struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
62065ed176e1SJohannes Berg 					 const u8 *addr);
62075ed176e1SJohannes Berg 
62085ed176e1SJohannes Berg /**
6209686b9cb9SBen Greear  * ieee80211_find_sta_by_ifaddr - find a station on hardware
62105ed176e1SJohannes Berg  *
62115ed176e1SJohannes Berg  * @hw: pointer as obtained from ieee80211_alloc_hw()
6212686b9cb9SBen Greear  * @addr: remote station's address
6213686b9cb9SBen Greear  * @localaddr: local address (vif->sdata->vif.addr). Use NULL for 'any'.
62145ed176e1SJohannes Berg  *
62150ae997dcSYacine Belkadi  * Return: The station, if found. %NULL otherwise.
62160ae997dcSYacine Belkadi  *
62170ae997dcSYacine Belkadi  * Note: This function must be called under RCU lock and the
62185ed176e1SJohannes Berg  * resulting pointer is only valid under RCU lock as well.
62195ed176e1SJohannes Berg  *
6220686b9cb9SBen Greear  * NOTE: You may pass NULL for localaddr, but then you will just get
6221686b9cb9SBen Greear  *      the first STA that matches the remote address 'addr'.
6222686b9cb9SBen Greear  *      We can have multiple STA associated with multiple
62235ed176e1SJohannes Berg  *      logical stations (e.g. consider a station connecting to another
62245ed176e1SJohannes Berg  *      BSSID on the same AP hardware without disconnecting first).
6225686b9cb9SBen Greear  *      In this case, the result of this method with localaddr NULL
6226686b9cb9SBen Greear  *      is not reliable.
62275ed176e1SJohannes Berg  *
6228686b9cb9SBen Greear  * DO NOT USE THIS FUNCTION with localaddr NULL if at all possible.
62295ed176e1SJohannes Berg  */
6230686b9cb9SBen Greear struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw,
6231686b9cb9SBen Greear 					       const u8 *addr,
6232686b9cb9SBen Greear 					       const u8 *localaddr);
623317741cdcSJohannes Berg 
623404de8381SKalle Valo /**
6235ffa9598eSJohannes Berg  * ieee80211_find_sta_by_link_addrs - find STA by link addresses
6236ffa9598eSJohannes Berg  * @hw: pointer as obtained from ieee80211_alloc_hw()
6237ffa9598eSJohannes Berg  * @addr: remote station's link address
6238ffa9598eSJohannes Berg  * @localaddr: local link address, use %NULL for any (but avoid that)
6239ffa9598eSJohannes Berg  * @link_id: pointer to obtain the link ID if the STA is found,
6240ffa9598eSJohannes Berg  *	may be %NULL if the link ID is not needed
6241ffa9598eSJohannes Berg  *
6242ffa9598eSJohannes Berg  * Obtain the STA by link address, must use RCU protection.
6243ffa9598eSJohannes Berg  */
6244ffa9598eSJohannes Berg struct ieee80211_sta *
6245ffa9598eSJohannes Berg ieee80211_find_sta_by_link_addrs(struct ieee80211_hw *hw,
6246ffa9598eSJohannes Berg 				 const u8 *addr,
6247ffa9598eSJohannes Berg 				 const u8 *localaddr,
6248ffa9598eSJohannes Berg 				 unsigned int *link_id);
6249ffa9598eSJohannes Berg 
6250ffa9598eSJohannes Berg /**
6251af818581SJohannes Berg  * ieee80211_sta_block_awake - block station from waking up
6252af818581SJohannes Berg  * @hw: the hardware
6253af818581SJohannes Berg  * @pubsta: the station
6254af818581SJohannes Berg  * @block: whether to block or unblock
6255af818581SJohannes Berg  *
6256af818581SJohannes Berg  * Some devices require that all frames that are on the queues
6257af818581SJohannes Berg  * for a specific station that went to sleep are flushed before
6258af818581SJohannes Berg  * a poll response or frames after the station woke up can be
6259af818581SJohannes Berg  * delivered to that it. Note that such frames must be rejected
6260af818581SJohannes Berg  * by the driver as filtered, with the appropriate status flag.
6261af818581SJohannes Berg  *
6262af818581SJohannes Berg  * This function allows implementing this mode in a race-free
6263af818581SJohannes Berg  * manner.
6264af818581SJohannes Berg  *
6265af818581SJohannes Berg  * To do this, a driver must keep track of the number of frames
6266af818581SJohannes Berg  * still enqueued for a specific station. If this number is not
6267af818581SJohannes Berg  * zero when the station goes to sleep, the driver must call
6268af818581SJohannes Berg  * this function to force mac80211 to consider the station to
6269af818581SJohannes Berg  * be asleep regardless of the station's actual state. Once the
6270af818581SJohannes Berg  * number of outstanding frames reaches zero, the driver must
6271af818581SJohannes Berg  * call this function again to unblock the station. That will
6272af818581SJohannes Berg  * cause mac80211 to be able to send ps-poll responses, and if
6273af818581SJohannes Berg  * the station queried in the meantime then frames will also
6274af818581SJohannes Berg  * be sent out as a result of this. Additionally, the driver
6275af818581SJohannes Berg  * will be notified that the station woke up some time after
6276af818581SJohannes Berg  * it is unblocked, regardless of whether the station actually
6277af818581SJohannes Berg  * woke up while blocked or not.
6278af818581SJohannes Berg  */
6279af818581SJohannes Berg void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
6280af818581SJohannes Berg 			       struct ieee80211_sta *pubsta, bool block);
6281af818581SJohannes Berg 
6282af818581SJohannes Berg /**
628337fbd908SJohannes Berg  * ieee80211_sta_eosp - notify mac80211 about end of SP
628437fbd908SJohannes Berg  * @pubsta: the station
628537fbd908SJohannes Berg  *
628637fbd908SJohannes Berg  * When a device transmits frames in a way that it can't tell
628737fbd908SJohannes Berg  * mac80211 in the TX status about the EOSP, it must clear the
628837fbd908SJohannes Berg  * %IEEE80211_TX_STATUS_EOSP bit and call this function instead.
628937fbd908SJohannes Berg  * This applies for PS-Poll as well as uAPSD.
629037fbd908SJohannes Berg  *
6291e943789eSJohannes Berg  * Note that just like with _tx_status() and _rx() drivers must
6292e943789eSJohannes Berg  * not mix calls to irqsafe/non-irqsafe versions, this function
6293e943789eSJohannes Berg  * must not be mixed with those either. Use the all irqsafe, or
6294e943789eSJohannes Berg  * all non-irqsafe, don't mix!
6295e943789eSJohannes Berg  *
6296e943789eSJohannes Berg  * NB: the _irqsafe version of this function doesn't exist, no
6297e943789eSJohannes Berg  *     driver needs it right now. Don't call this function if
6298e943789eSJohannes Berg  *     you'd need the _irqsafe version, look at the git history
6299e943789eSJohannes Berg  *     and restore the _irqsafe version!
630037fbd908SJohannes Berg  */
6301e943789eSJohannes Berg void ieee80211_sta_eosp(struct ieee80211_sta *pubsta);
630237fbd908SJohannes Berg 
630337fbd908SJohannes Berg /**
63040ead2510SEmmanuel Grumbach  * ieee80211_send_eosp_nullfunc - ask mac80211 to send NDP with EOSP
63050ead2510SEmmanuel Grumbach  * @pubsta: the station
63060ead2510SEmmanuel Grumbach  * @tid: the tid of the NDP
63070ead2510SEmmanuel Grumbach  *
63080ead2510SEmmanuel Grumbach  * Sometimes the device understands that it needs to close
63090ead2510SEmmanuel Grumbach  * the Service Period unexpectedly. This can happen when
63100ead2510SEmmanuel Grumbach  * sending frames that are filling holes in the BA window.
63110ead2510SEmmanuel Grumbach  * In this case, the device can ask mac80211 to send a
63120ead2510SEmmanuel Grumbach  * Nullfunc frame with EOSP set. When that happens, the
63130ead2510SEmmanuel Grumbach  * driver must have called ieee80211_sta_set_buffered() to
63140ead2510SEmmanuel Grumbach  * let mac80211 know that there are no buffered frames any
63150ead2510SEmmanuel Grumbach  * more, otherwise mac80211 will get the more_data bit wrong.
63160ead2510SEmmanuel Grumbach  * The low level driver must have made sure that the frame
63170ead2510SEmmanuel Grumbach  * will be sent despite the station being in power-save.
63180ead2510SEmmanuel Grumbach  * Mac80211 won't call allow_buffered_frames().
63190ead2510SEmmanuel Grumbach  * Note that calling this function, doesn't exempt the driver
63200ead2510SEmmanuel Grumbach  * from closing the EOSP properly, it will still have to call
63210ead2510SEmmanuel Grumbach  * ieee80211_sta_eosp when the NDP is sent.
63220ead2510SEmmanuel Grumbach  */
63230ead2510SEmmanuel Grumbach void ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);
63240ead2510SEmmanuel Grumbach 
63250ead2510SEmmanuel Grumbach /**
63264c51541dSBenjamin Berg  * ieee80211_sta_recalc_aggregates - recalculate aggregate data after a change
63274c51541dSBenjamin Berg  * @pubsta: the station
63284c51541dSBenjamin Berg  *
63294c51541dSBenjamin Berg  * Call this function after changing a per-link aggregate data as referenced in
63304c51541dSBenjamin Berg  * &struct ieee80211_sta_aggregates by accessing the agg field of
63314c51541dSBenjamin Berg  * &struct ieee80211_link_sta.
63324c51541dSBenjamin Berg  *
63334c51541dSBenjamin Berg  * With non MLO the data in deflink will be referenced directly. In that case
63344c51541dSBenjamin Berg  * there is no need to call this function.
63354c51541dSBenjamin Berg  */
63364c51541dSBenjamin Berg void ieee80211_sta_recalc_aggregates(struct ieee80211_sta *pubsta);
63374c51541dSBenjamin Berg 
63384c51541dSBenjamin Berg /**
6339b4809e94SToke Høiland-Jørgensen  * ieee80211_sta_register_airtime - register airtime usage for a sta/tid
6340b4809e94SToke Høiland-Jørgensen  *
6341c74114d7SFelix Fietkau  * Register airtime usage for a given sta on a given tid. The driver must call
6342b4809e94SToke Høiland-Jørgensen  * this function to notify mac80211 that a station used a certain amount of
6343b4809e94SToke Høiland-Jørgensen  * airtime. This information will be used by the TXQ scheduler to schedule
6344b4809e94SToke Høiland-Jørgensen  * stations in a way that ensures airtime fairness.
6345b4809e94SToke Høiland-Jørgensen  *
6346b4809e94SToke Høiland-Jørgensen  * The reported airtime should as a minimum include all time that is spent
6347b4809e94SToke Høiland-Jørgensen  * transmitting to the remote station, including overhead and padding, but not
6348b4809e94SToke Høiland-Jørgensen  * including time spent waiting for a TXOP. If the time is not reported by the
6349b4809e94SToke Høiland-Jørgensen  * hardware it can in some cases be calculated from the rate and known frame
6350b4809e94SToke Høiland-Jørgensen  * composition. When possible, the time should include any failed transmission
6351b4809e94SToke Høiland-Jørgensen  * attempts.
6352b4809e94SToke Høiland-Jørgensen  *
6353b4809e94SToke Høiland-Jørgensen  * The driver can either call this function synchronously for every packet or
6354b4809e94SToke Høiland-Jørgensen  * aggregate, or asynchronously as airtime usage information becomes available.
6355b4809e94SToke Høiland-Jørgensen  * TX and RX airtime can be reported together, or separately by setting one of
6356b4809e94SToke Høiland-Jørgensen  * them to 0.
6357b4809e94SToke Høiland-Jørgensen  *
6358b4809e94SToke Høiland-Jørgensen  * @pubsta: the station
6359b4809e94SToke Høiland-Jørgensen  * @tid: the TID to register airtime for
6360b4809e94SToke Høiland-Jørgensen  * @tx_airtime: airtime used during TX (in usec)
6361b4809e94SToke Høiland-Jørgensen  * @rx_airtime: airtime used during RX (in usec)
6362b4809e94SToke Høiland-Jørgensen  */
6363b4809e94SToke Høiland-Jørgensen void ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
6364b4809e94SToke Høiland-Jørgensen 				    u32 tx_airtime, u32 rx_airtime);
6365b4809e94SToke Høiland-Jørgensen 
6366b4809e94SToke Høiland-Jørgensen /**
63673ace10f5SKan Yan  * ieee80211_txq_airtime_check - check if a txq can send frame to device
63683ace10f5SKan Yan  *
63693ace10f5SKan Yan  * @hw: pointer obtained from ieee80211_alloc_hw()
63703ace10f5SKan Yan  * @txq: pointer obtained from station or virtual interface
63713ace10f5SKan Yan  *
63723ace10f5SKan Yan  * Return true if the AQL's airtime limit has not been reached and the txq can
63733ace10f5SKan Yan  * continue to send more packets to the device. Otherwise return false.
63743ace10f5SKan Yan  */
63753ace10f5SKan Yan bool
63763ace10f5SKan Yan ieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
63773ace10f5SKan Yan 
63783ace10f5SKan Yan /**
6379830af02fSJohannes Berg  * ieee80211_iter_keys - iterate keys programmed into the device
6380830af02fSJohannes Berg  * @hw: pointer obtained from ieee80211_alloc_hw()
6381830af02fSJohannes Berg  * @vif: virtual interface to iterate, may be %NULL for all
6382830af02fSJohannes Berg  * @iter: iterator function that will be called for each key
6383830af02fSJohannes Berg  * @iter_data: custom data to pass to the iterator function
6384830af02fSJohannes Berg  *
6385830af02fSJohannes Berg  * This function can be used to iterate all the keys known to
6386830af02fSJohannes Berg  * mac80211, even those that weren't previously programmed into
6387830af02fSJohannes Berg  * the device. This is intended for use in WoWLAN if the device
6388830af02fSJohannes Berg  * needs reprogramming of the keys during suspend. Note that due
6389830af02fSJohannes Berg  * to locking reasons, it is also only safe to call this at few
6390830af02fSJohannes Berg  * spots since it must hold the RTNL and be able to sleep.
6391f850e00fSJohannes Berg  *
6392f850e00fSJohannes Berg  * The order in which the keys are iterated matches the order
6393f850e00fSJohannes Berg  * in which they were originally installed and handed to the
6394f850e00fSJohannes Berg  * set_key callback.
6395830af02fSJohannes Berg  */
6396830af02fSJohannes Berg void ieee80211_iter_keys(struct ieee80211_hw *hw,
6397830af02fSJohannes Berg 			 struct ieee80211_vif *vif,
6398830af02fSJohannes Berg 			 void (*iter)(struct ieee80211_hw *hw,
6399830af02fSJohannes Berg 				      struct ieee80211_vif *vif,
6400830af02fSJohannes Berg 				      struct ieee80211_sta *sta,
6401830af02fSJohannes Berg 				      struct ieee80211_key_conf *key,
6402830af02fSJohannes Berg 				      void *data),
6403830af02fSJohannes Berg 			 void *iter_data);
6404830af02fSJohannes Berg 
6405830af02fSJohannes Berg /**
6406ef044763SEliad Peller  * ieee80211_iter_keys_rcu - iterate keys programmed into the device
6407ef044763SEliad Peller  * @hw: pointer obtained from ieee80211_alloc_hw()
6408ef044763SEliad Peller  * @vif: virtual interface to iterate, may be %NULL for all
6409ef044763SEliad Peller  * @iter: iterator function that will be called for each key
6410ef044763SEliad Peller  * @iter_data: custom data to pass to the iterator function
6411ef044763SEliad Peller  *
6412ef044763SEliad Peller  * This function can be used to iterate all the keys known to
6413ef044763SEliad Peller  * mac80211, even those that weren't previously programmed into
6414ef044763SEliad Peller  * the device. Note that due to locking reasons, keys of station
6415ef044763SEliad Peller  * in removal process will be skipped.
6416ef044763SEliad Peller  *
6417ef044763SEliad Peller  * This function requires being called in an RCU critical section,
6418ef044763SEliad Peller  * and thus iter must be atomic.
6419ef044763SEliad Peller  */
6420ef044763SEliad Peller void ieee80211_iter_keys_rcu(struct ieee80211_hw *hw,
6421ef044763SEliad Peller 			     struct ieee80211_vif *vif,
6422ef044763SEliad Peller 			     void (*iter)(struct ieee80211_hw *hw,
6423ef044763SEliad Peller 					  struct ieee80211_vif *vif,
6424ef044763SEliad Peller 					  struct ieee80211_sta *sta,
6425ef044763SEliad Peller 					  struct ieee80211_key_conf *key,
6426ef044763SEliad Peller 					  void *data),
6427ef044763SEliad Peller 			     void *iter_data);
6428ef044763SEliad Peller 
6429ef044763SEliad Peller /**
64303448c005SJohannes Berg  * ieee80211_iter_chan_contexts_atomic - iterate channel contexts
6431ae4a50eeSChris Packham  * @hw: pointer obtained from ieee80211_alloc_hw().
64323448c005SJohannes Berg  * @iter: iterator function
64333448c005SJohannes Berg  * @iter_data: data passed to iterator function
64343448c005SJohannes Berg  *
64353448c005SJohannes Berg  * Iterate all active channel contexts. This function is atomic and
64363448c005SJohannes Berg  * doesn't acquire any locks internally that might be held in other
64373448c005SJohannes Berg  * places while calling into the driver.
64383448c005SJohannes Berg  *
64393448c005SJohannes Berg  * The iterator will not find a context that's being added (during
64403448c005SJohannes Berg  * the driver callback to add it) but will find it while it's being
64413448c005SJohannes Berg  * removed.
64428a61af65SJohannes Berg  *
64438a61af65SJohannes Berg  * Note that during hardware restart, all contexts that existed
64448a61af65SJohannes Berg  * before the restart are considered already present so will be
64458a61af65SJohannes Berg  * found while iterating, whether they've been re-added already
64468a61af65SJohannes Berg  * or not.
64473448c005SJohannes Berg  */
64483448c005SJohannes Berg void ieee80211_iter_chan_contexts_atomic(
64493448c005SJohannes Berg 	struct ieee80211_hw *hw,
64503448c005SJohannes Berg 	void (*iter)(struct ieee80211_hw *hw,
64513448c005SJohannes Berg 		     struct ieee80211_chanctx_conf *chanctx_conf,
64523448c005SJohannes Berg 		     void *data),
64533448c005SJohannes Berg 	void *iter_data);
64543448c005SJohannes Berg 
64553448c005SJohannes Berg /**
6456a619a4c0SJuuso Oikarinen  * ieee80211_ap_probereq_get - retrieve a Probe Request template
6457a619a4c0SJuuso Oikarinen  * @hw: pointer obtained from ieee80211_alloc_hw().
6458a619a4c0SJuuso Oikarinen  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
6459a619a4c0SJuuso Oikarinen  *
6460a619a4c0SJuuso Oikarinen  * Creates a Probe Request template which can, for example, be uploaded to
6461a619a4c0SJuuso Oikarinen  * hardware. The template is filled with bssid, ssid and supported rate
6462a619a4c0SJuuso Oikarinen  * information. This function must only be called from within the
6463a619a4c0SJuuso Oikarinen  * .bss_info_changed callback function and only in managed mode. The function
6464a619a4c0SJuuso Oikarinen  * is only useful when the interface is associated, otherwise it will return
64650ae997dcSYacine Belkadi  * %NULL.
64660ae997dcSYacine Belkadi  *
64670ae997dcSYacine Belkadi  * Return: The Probe Request template. %NULL on error.
6468a619a4c0SJuuso Oikarinen  */
6469a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
6470a619a4c0SJuuso Oikarinen 					  struct ieee80211_vif *vif);
6471a619a4c0SJuuso Oikarinen 
6472a619a4c0SJuuso Oikarinen /**
647304de8381SKalle Valo  * ieee80211_beacon_loss - inform hardware does not receive beacons
647404de8381SKalle Valo  *
64751ed32e4fSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
647604de8381SKalle Valo  *
6477c1288b12SJohannes Berg  * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and
64781e4dcd01SJuuso Oikarinen  * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
647904de8381SKalle Valo  * hardware is not receiving beacons with this function.
648004de8381SKalle Valo  */
648104de8381SKalle Valo void ieee80211_beacon_loss(struct ieee80211_vif *vif);
64824b7679a5SJohannes Berg 
64831e4dcd01SJuuso Oikarinen /**
64841e4dcd01SJuuso Oikarinen  * ieee80211_connection_loss - inform hardware has lost connection to the AP
64851e4dcd01SJuuso Oikarinen  *
64861e4dcd01SJuuso Oikarinen  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
64871e4dcd01SJuuso Oikarinen  *
6488c1288b12SJohannes Berg  * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and
64891e4dcd01SJuuso Oikarinen  * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
64901e4dcd01SJuuso Oikarinen  * needs to inform if the connection to the AP has been lost.
6491682bd38bSJohannes Berg  * The function may also be called if the connection needs to be terminated
6492682bd38bSJohannes Berg  * for some other reason, even if %IEEE80211_HW_CONNECTION_MONITOR isn't set.
64931e4dcd01SJuuso Oikarinen  *
64941e4dcd01SJuuso Oikarinen  * This function will cause immediate change to disassociated state,
64951e4dcd01SJuuso Oikarinen  * without connection recovery attempts.
64961e4dcd01SJuuso Oikarinen  */
64971e4dcd01SJuuso Oikarinen void ieee80211_connection_loss(struct ieee80211_vif *vif);
64981e4dcd01SJuuso Oikarinen 
6499a97c13c3SJuuso Oikarinen /**
65003f8a39ffSJohannes Berg  * ieee80211_disconnect - request disconnection
65013f8a39ffSJohannes Berg  *
65023f8a39ffSJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
65033f8a39ffSJohannes Berg  * @reconnect: immediate reconnect is desired
65043f8a39ffSJohannes Berg  *
65053f8a39ffSJohannes Berg  * Request disconnection from the current network and, if enabled, send a
65063f8a39ffSJohannes Berg  * hint to the higher layers that immediate reconnect is desired.
65073f8a39ffSJohannes Berg  */
65083f8a39ffSJohannes Berg void ieee80211_disconnect(struct ieee80211_vif *vif, bool reconnect);
65093f8a39ffSJohannes Berg 
65103f8a39ffSJohannes Berg /**
651195acac61SJohannes Berg  * ieee80211_resume_disconnect - disconnect from AP after resume
651295acac61SJohannes Berg  *
651395acac61SJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
651495acac61SJohannes Berg  *
651595acac61SJohannes Berg  * Instructs mac80211 to disconnect from the AP after resume.
651695acac61SJohannes Berg  * Drivers can use this after WoWLAN if they know that the
651795acac61SJohannes Berg  * connection cannot be kept up, for example because keys were
651895acac61SJohannes Berg  * used while the device was asleep but the replay counters or
651995acac61SJohannes Berg  * similar cannot be retrieved from the device during resume.
652095acac61SJohannes Berg  *
652195acac61SJohannes Berg  * Note that due to implementation issues, if the driver uses
652295acac61SJohannes Berg  * the reconfiguration functionality during resume the interface
652395acac61SJohannes Berg  * will still be added as associated first during resume and then
652495acac61SJohannes Berg  * disconnect normally later.
652595acac61SJohannes Berg  *
652695acac61SJohannes Berg  * This function can only be called from the resume callback and
652795acac61SJohannes Berg  * the driver must not be holding any of its own locks while it
652895acac61SJohannes Berg  * calls this function, or at least not any locks it needs in the
652995acac61SJohannes Berg  * key configuration paths (if it supports HW crypto).
653095acac61SJohannes Berg  */
653195acac61SJohannes Berg void ieee80211_resume_disconnect(struct ieee80211_vif *vif);
653295acac61SJohannes Berg 
653395acac61SJohannes Berg /**
65347d352ccfSYoughandhar Chintala  * ieee80211_hw_restart_disconnect - disconnect from AP after
65357d352ccfSYoughandhar Chintala  * hardware restart
65367d352ccfSYoughandhar Chintala  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
65377d352ccfSYoughandhar Chintala  *
65387d352ccfSYoughandhar Chintala  * Instructs mac80211 to disconnect from the AP after
65397d352ccfSYoughandhar Chintala  * hardware restart.
65407d352ccfSYoughandhar Chintala  */
65417d352ccfSYoughandhar Chintala void ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif);
65427d352ccfSYoughandhar Chintala 
65437d352ccfSYoughandhar Chintala /**
6544a97c13c3SJuuso Oikarinen  * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
6545a97c13c3SJuuso Oikarinen  *	rssi threshold triggered
6546a97c13c3SJuuso Oikarinen  *
6547a97c13c3SJuuso Oikarinen  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
6548a97c13c3SJuuso Oikarinen  * @rssi_event: the RSSI trigger event type
6549769f07d8SAndrzej Zaborowski  * @rssi_level: new RSSI level value or 0 if not available
6550a97c13c3SJuuso Oikarinen  * @gfp: context flags
6551a97c13c3SJuuso Oikarinen  *
6552ea086359SJohannes Berg  * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality
6553a97c13c3SJuuso Oikarinen  * monitoring is configured with an rssi threshold, the driver will inform
6554a97c13c3SJuuso Oikarinen  * whenever the rssi level reaches the threshold.
6555a97c13c3SJuuso Oikarinen  */
6556a97c13c3SJuuso Oikarinen void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
6557a97c13c3SJuuso Oikarinen 			       enum nl80211_cqm_rssi_threshold_event rssi_event,
6558769f07d8SAndrzej Zaborowski 			       s32 rssi_level,
6559a97c13c3SJuuso Oikarinen 			       gfp_t gfp);
6560a97c13c3SJuuso Oikarinen 
65615ce6e438SJohannes Berg /**
656298f03342SJohannes Berg  * ieee80211_cqm_beacon_loss_notify - inform CQM of beacon loss
656398f03342SJohannes Berg  *
656498f03342SJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
656598f03342SJohannes Berg  * @gfp: context flags
656698f03342SJohannes Berg  */
656798f03342SJohannes Berg void ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp);
656898f03342SJohannes Berg 
656998f03342SJohannes Berg /**
6570164eb02dSSimon Wunderlich  * ieee80211_radar_detected - inform that a radar was detected
6571164eb02dSSimon Wunderlich  *
6572164eb02dSSimon Wunderlich  * @hw: pointer as obtained from ieee80211_alloc_hw()
6573164eb02dSSimon Wunderlich  */
6574164eb02dSSimon Wunderlich void ieee80211_radar_detected(struct ieee80211_hw *hw);
6575164eb02dSSimon Wunderlich 
6576164eb02dSSimon Wunderlich /**
65775ce6e438SJohannes Berg  * ieee80211_chswitch_done - Complete channel switch process
65785ce6e438SJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
65795ce6e438SJohannes Berg  * @success: make the channel switch successful or not
65805ce6e438SJohannes Berg  *
65815ce6e438SJohannes Berg  * Complete the channel switch post-process: set the new operational channel
65825ce6e438SJohannes Berg  * and wake up the suspended queues.
65835ce6e438SJohannes Berg  */
65845ce6e438SJohannes Berg void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success);
65855ce6e438SJohannes Berg 
6586d1f5b7a3SJohannes Berg /**
65876d501764SNathan Errera  * ieee80211_channel_switch_disconnect - disconnect due to channel switch error
658882757b79SMauro Carvalho Chehab  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
65896d501764SNathan Errera  * @block_tx: if %true, do not send deauth frame.
65906d501764SNathan Errera  *
65916d501764SNathan Errera  * Instruct mac80211 to disconnect due to a channel switch error. The channel
65926d501764SNathan Errera  * switch can request to block the tx and so, we need to make sure we do not send
65936d501764SNathan Errera  * a deauth frame in this case.
65946d501764SNathan Errera  */
65956d501764SNathan Errera void ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif,
65966d501764SNathan Errera 					 bool block_tx);
65976d501764SNathan Errera 
65986d501764SNathan Errera /**
6599d1f5b7a3SJohannes Berg  * ieee80211_request_smps - request SM PS transition
6600d1f5b7a3SJohannes Berg  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
6601e9aac179SJohannes Berg  * @link_id: link ID for MLO, or 0
6602633dd1eaSJohannes Berg  * @smps_mode: new SM PS mode
6603d1f5b7a3SJohannes Berg  *
6604d1f5b7a3SJohannes Berg  * This allows the driver to request an SM PS transition in managed
6605d1f5b7a3SJohannes Berg  * mode. This is useful when the driver has more information than
6606d1f5b7a3SJohannes Berg  * the stack about possible interference, for example by bluetooth.
6607d1f5b7a3SJohannes Berg  */
6608e9aac179SJohannes Berg void ieee80211_request_smps(struct ieee80211_vif *vif, unsigned int link_id,
6609d1f5b7a3SJohannes Berg 			    enum ieee80211_smps_mode smps_mode);
6610d1f5b7a3SJohannes Berg 
6611e31b8213SJohannes Berg /**
661221f83589SJohannes Berg  * ieee80211_ready_on_channel - notification of remain-on-channel start
661321f83589SJohannes Berg  * @hw: pointer as obtained from ieee80211_alloc_hw()
661421f83589SJohannes Berg  */
661521f83589SJohannes Berg void ieee80211_ready_on_channel(struct ieee80211_hw *hw);
661621f83589SJohannes Berg 
661721f83589SJohannes Berg /**
661821f83589SJohannes Berg  * ieee80211_remain_on_channel_expired - remain_on_channel duration expired
661921f83589SJohannes Berg  * @hw: pointer as obtained from ieee80211_alloc_hw()
662021f83589SJohannes Berg  */
662121f83589SJohannes Berg void ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw);
662221f83589SJohannes Berg 
6623f41ccd71SShahar Levi /**
6624f41ccd71SShahar Levi  * ieee80211_stop_rx_ba_session - callback to stop existing BA sessions
6625f41ccd71SShahar Levi  *
6626f41ccd71SShahar Levi  * in order not to harm the system performance and user experience, the device
6627f41ccd71SShahar Levi  * may request not to allow any rx ba session and tear down existing rx ba
6628f41ccd71SShahar Levi  * sessions based on system constraints such as periodic BT activity that needs
6629f41ccd71SShahar Levi  * to limit wlan activity (eg.sco or a2dp)."
6630f41ccd71SShahar Levi  * in such cases, the intention is to limit the duration of the rx ppdu and
6631f41ccd71SShahar Levi  * therefore prevent the peer device to use a-mpdu aggregation.
6632f41ccd71SShahar Levi  *
6633f41ccd71SShahar Levi  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
6634f41ccd71SShahar Levi  * @ba_rx_bitmap: Bit map of open rx ba per tid
6635f41ccd71SShahar Levi  * @addr: & to bssid mac address
6636f41ccd71SShahar Levi  */
6637f41ccd71SShahar Levi void ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
6638f41ccd71SShahar Levi 				  const u8 *addr);
6639f41ccd71SShahar Levi 
66408c771244SFelix Fietkau /**
664106470f74SSara Sharon  * ieee80211_mark_rx_ba_filtered_frames - move RX BA window and mark filtered
664206470f74SSara Sharon  * @pubsta: station struct
664306470f74SSara Sharon  * @tid: the session's TID
664406470f74SSara Sharon  * @ssn: starting sequence number of the bitmap, all frames before this are
664506470f74SSara Sharon  *	assumed to be out of the window after the call
664606470f74SSara Sharon  * @filtered: bitmap of filtered frames, BIT(0) is the @ssn entry etc.
664706470f74SSara Sharon  * @received_mpdus: number of received mpdus in firmware
664806470f74SSara Sharon  *
664906470f74SSara Sharon  * This function moves the BA window and releases all frames before @ssn, and
665006470f74SSara Sharon  * marks frames marked in the bitmap as having been filtered. Afterwards, it
665106470f74SSara Sharon  * checks if any frames in the window starting from @ssn can now be released
665206470f74SSara Sharon  * (in case they were only waiting for frames that were filtered.)
6653b98c1610SPing-Ke Shih  * (Only work correctly if @max_rx_aggregation_subframes <= 64 frames)
665406470f74SSara Sharon  */
665506470f74SSara Sharon void ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,
665606470f74SSara Sharon 					  u16 ssn, u64 filtered,
665706470f74SSara Sharon 					  u16 received_mpdus);
665806470f74SSara Sharon 
665906470f74SSara Sharon /**
66608c771244SFelix Fietkau  * ieee80211_send_bar - send a BlockAckReq frame
66618c771244SFelix Fietkau  *
66628c771244SFelix Fietkau  * can be used to flush pending frames from the peer's aggregation reorder
66638c771244SFelix Fietkau  * buffer.
66648c771244SFelix Fietkau  *
66658c771244SFelix Fietkau  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
66668c771244SFelix Fietkau  * @ra: the peer's destination address
66678c771244SFelix Fietkau  * @tid: the TID of the aggregation session
66688c771244SFelix Fietkau  * @ssn: the new starting sequence number for the receiver
66698c771244SFelix Fietkau  */
66708c771244SFelix Fietkau void ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
66718c771244SFelix Fietkau 
66721272c5d8SLuca Coelho /**
66731272c5d8SLuca Coelho  * ieee80211_manage_rx_ba_offl - helper to queue an RX BA work
66741272c5d8SLuca Coelho  * @vif: &struct ieee80211_vif pointer from the add_interface callback
66751272c5d8SLuca Coelho  * @addr: station mac address
66761272c5d8SLuca Coelho  * @tid: the rx tid
66771272c5d8SLuca Coelho  */
6678699cb58cSJohannes Berg void ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif, const u8 *addr,
66791272c5d8SLuca Coelho 				 unsigned int tid);
6680699cb58cSJohannes Berg 
668108cf42e8SMichal Kazior /**
668208cf42e8SMichal Kazior  * ieee80211_start_rx_ba_session_offl - start a Rx BA session
668308cf42e8SMichal Kazior  *
668408cf42e8SMichal Kazior  * Some device drivers may offload part of the Rx aggregation flow including
668508cf42e8SMichal Kazior  * AddBa/DelBa negotiation but may otherwise be incapable of full Rx
668608cf42e8SMichal Kazior  * reordering.
668708cf42e8SMichal Kazior  *
668808cf42e8SMichal Kazior  * Create structures responsible for reordering so device drivers may call here
668908cf42e8SMichal Kazior  * when they complete AddBa negotiation.
669008cf42e8SMichal Kazior  *
669108cf42e8SMichal Kazior  * @vif: &struct ieee80211_vif pointer from the add_interface callback
669208cf42e8SMichal Kazior  * @addr: station mac address
669308cf42e8SMichal Kazior  * @tid: the rx tid
669408cf42e8SMichal Kazior  */
ieee80211_start_rx_ba_session_offl(struct ieee80211_vif * vif,const u8 * addr,u16 tid)6695699cb58cSJohannes Berg static inline void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif,
6696699cb58cSJohannes Berg 						      const u8 *addr, u16 tid)
6697699cb58cSJohannes Berg {
6698699cb58cSJohannes Berg 	if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
6699699cb58cSJohannes Berg 		return;
6700699cb58cSJohannes Berg 	ieee80211_manage_rx_ba_offl(vif, addr, tid);
6701699cb58cSJohannes Berg }
670208cf42e8SMichal Kazior 
670308cf42e8SMichal Kazior /**
670408cf42e8SMichal Kazior  * ieee80211_stop_rx_ba_session_offl - stop a Rx BA session
670508cf42e8SMichal Kazior  *
670608cf42e8SMichal Kazior  * Some device drivers may offload part of the Rx aggregation flow including
670708cf42e8SMichal Kazior  * AddBa/DelBa negotiation but may otherwise be incapable of full Rx
670808cf42e8SMichal Kazior  * reordering.
670908cf42e8SMichal Kazior  *
671008cf42e8SMichal Kazior  * Destroy structures responsible for reordering so device drivers may call here
671108cf42e8SMichal Kazior  * when they complete DelBa negotiation.
671208cf42e8SMichal Kazior  *
671308cf42e8SMichal Kazior  * @vif: &struct ieee80211_vif pointer from the add_interface callback
671408cf42e8SMichal Kazior  * @addr: station mac address
671508cf42e8SMichal Kazior  * @tid: the rx tid
671608cf42e8SMichal Kazior  */
ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif * vif,const u8 * addr,u16 tid)6717699cb58cSJohannes Berg static inline void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif,
6718699cb58cSJohannes Berg 						     const u8 *addr, u16 tid)
6719699cb58cSJohannes Berg {
6720699cb58cSJohannes Berg 	if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
6721699cb58cSJohannes Berg 		return;
6722699cb58cSJohannes Berg 	ieee80211_manage_rx_ba_offl(vif, addr, tid + IEEE80211_NUM_TIDS);
6723699cb58cSJohannes Berg }
672408cf42e8SMichal Kazior 
672504c2cf34SNaftali Goldstein /**
672604c2cf34SNaftali Goldstein  * ieee80211_rx_ba_timer_expired - stop a Rx BA session due to timeout
672704c2cf34SNaftali Goldstein  *
672804c2cf34SNaftali Goldstein  * Some device drivers do not offload AddBa/DelBa negotiation, but handle rx
672904c2cf34SNaftali Goldstein  * buffer reording internally, and therefore also handle the session timer.
673004c2cf34SNaftali Goldstein  *
673104c2cf34SNaftali Goldstein  * Trigger the timeout flow, which sends a DelBa.
673204c2cf34SNaftali Goldstein  *
673304c2cf34SNaftali Goldstein  * @vif: &struct ieee80211_vif pointer from the add_interface callback
673404c2cf34SNaftali Goldstein  * @addr: station mac address
673504c2cf34SNaftali Goldstein  * @tid: the rx tid
673604c2cf34SNaftali Goldstein  */
673704c2cf34SNaftali Goldstein void ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif,
673804c2cf34SNaftali Goldstein 				   const u8 *addr, unsigned int tid);
673904c2cf34SNaftali Goldstein 
67404b7679a5SJohannes Berg /* Rate control API */
6741e6a9854bSJohannes Berg 
67424b7679a5SJohannes Berg /**
6743e6a9854bSJohannes Berg  * struct ieee80211_tx_rate_control - rate control information for/from RC algo
67444b7679a5SJohannes Berg  *
6745e6a9854bSJohannes Berg  * @hw: The hardware the algorithm is invoked for.
6746e6a9854bSJohannes Berg  * @sband: The band this frame is being transmitted on.
6747e6a9854bSJohannes Berg  * @bss_conf: the current BSS configuration
6748f44d4eb5SSimon Wunderlich  * @skb: the skb that will be transmitted, the control information in it needs
6749f44d4eb5SSimon Wunderlich  *	to be filled in
6750e6a9854bSJohannes Berg  * @reported_rate: The rate control algorithm can fill this in to indicate
6751e6a9854bSJohannes Berg  *	which rate should be reported to userspace as the current rate and
6752e6a9854bSJohannes Berg  *	used for rate calculations in the mesh network.
6753e6a9854bSJohannes Berg  * @rts: whether RTS will be used for this frame because it is longer than the
6754e6a9854bSJohannes Berg  *	RTS threshold
6755e6a9854bSJohannes Berg  * @short_preamble: whether mac80211 will request short-preamble transmission
6756e6a9854bSJohannes Berg  *	if the selected rate supports it
6757f44d4eb5SSimon Wunderlich  * @rate_idx_mask: user-requested (legacy) rate mask
67582ffbe6d3SFelix Fietkau  * @rate_idx_mcs_mask: user-requested MCS rate mask (NULL if not in use)
67598f0729b1SFelix Fietkau  * @bss: whether this frame is sent out in AP or IBSS mode
67604b7679a5SJohannes Berg  */
6761e6a9854bSJohannes Berg struct ieee80211_tx_rate_control {
6762e6a9854bSJohannes Berg 	struct ieee80211_hw *hw;
6763e6a9854bSJohannes Berg 	struct ieee80211_supported_band *sband;
6764e6a9854bSJohannes Berg 	struct ieee80211_bss_conf *bss_conf;
6765e6a9854bSJohannes Berg 	struct sk_buff *skb;
6766e6a9854bSJohannes Berg 	struct ieee80211_tx_rate reported_rate;
6767e6a9854bSJohannes Berg 	bool rts, short_preamble;
676837eb0b16SJouni Malinen 	u32 rate_idx_mask;
67692ffbe6d3SFelix Fietkau 	u8 *rate_idx_mcs_mask;
67708f0729b1SFelix Fietkau 	bool bss;
67714b7679a5SJohannes Berg };
67724b7679a5SJohannes Berg 
677309b4a4faSJohannes Berg /**
677409b4a4faSJohannes Berg  * enum rate_control_capabilities - rate control capabilities
677509b4a4faSJohannes Berg  */
677609b4a4faSJohannes Berg enum rate_control_capabilities {
677709b4a4faSJohannes Berg 	/**
677809b4a4faSJohannes Berg 	 * @RATE_CTRL_CAPA_VHT_EXT_NSS_BW:
677909b4a4faSJohannes Berg 	 * Support for extended NSS BW support (dot11VHTExtendedNSSCapable)
678009b4a4faSJohannes Berg 	 * Note that this is only looked at if the minimum number of chains
678109b4a4faSJohannes Berg 	 * that the AP uses is < the number of TX chains the hardware has,
678209b4a4faSJohannes Berg 	 * otherwise the NSS difference doesn't bother us.
678309b4a4faSJohannes Berg 	 */
678409b4a4faSJohannes Berg 	RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0),
678508a46c64SFelix Fietkau 	/**
678608a46c64SFelix Fietkau 	 * @RATE_CTRL_CAPA_AMPDU_TRIGGER:
678708a46c64SFelix Fietkau 	 * mac80211 should start A-MPDU sessions on tx
678808a46c64SFelix Fietkau 	 */
678908a46c64SFelix Fietkau 	RATE_CTRL_CAPA_AMPDU_TRIGGER = BIT(1),
679009b4a4faSJohannes Berg };
679109b4a4faSJohannes Berg 
67924b7679a5SJohannes Berg struct rate_control_ops {
679309b4a4faSJohannes Berg 	unsigned long capa;
67944b7679a5SJohannes Berg 	const char *name;
67956cb5f3eaSJohannes Berg 	void *(*alloc)(struct ieee80211_hw *hw);
67966cb5f3eaSJohannes Berg 	void (*add_debugfs)(struct ieee80211_hw *hw, void *priv,
67976cb5f3eaSJohannes Berg 			    struct dentry *debugfsdir);
67984b7679a5SJohannes Berg 	void (*free)(void *priv);
67994b7679a5SJohannes Berg 
68004b7679a5SJohannes Berg 	void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
68014b7679a5SJohannes Berg 	void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
68023de805cfSSimon Wunderlich 			  struct cfg80211_chan_def *chandef,
68034b7679a5SJohannes Berg 			  struct ieee80211_sta *sta, void *priv_sta);
680481cb7623SSujith 	void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
68053de805cfSSimon Wunderlich 			    struct cfg80211_chan_def *chandef,
680664f68e5dSJohannes Berg 			    struct ieee80211_sta *sta, void *priv_sta,
680764f68e5dSJohannes Berg 			    u32 changed);
68084b7679a5SJohannes Berg 	void (*free_sta)(void *priv, struct ieee80211_sta *sta,
68094b7679a5SJohannes Berg 			 void *priv_sta);
68104b7679a5SJohannes Berg 
681118fb84d9SFelix Fietkau 	void (*tx_status_ext)(void *priv,
6812f684565eSFelix Fietkau 			      struct ieee80211_supported_band *sband,
681318fb84d9SFelix Fietkau 			      void *priv_sta, struct ieee80211_tx_status *st);
68144b7679a5SJohannes Berg 	void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
68154b7679a5SJohannes Berg 			  struct ieee80211_sta *sta, void *priv_sta,
68164b7679a5SJohannes Berg 			  struct sk_buff *skb);
6817e6a9854bSJohannes Berg 	void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta,
6818e6a9854bSJohannes Berg 			 struct ieee80211_tx_rate_control *txrc);
68194b7679a5SJohannes Berg 
68204b7679a5SJohannes Berg 	void (*add_sta_debugfs)(void *priv, void *priv_sta,
68214b7679a5SJohannes Berg 				struct dentry *dir);
6822cca674d4SAntonio Quartulli 
6823cca674d4SAntonio Quartulli 	u32 (*get_expected_throughput)(void *priv_sta);
68244b7679a5SJohannes Berg };
68254b7679a5SJohannes Berg 
rate_supported(struct ieee80211_sta * sta,enum nl80211_band band,int index)68264b7679a5SJohannes Berg static inline int rate_supported(struct ieee80211_sta *sta,
682757fbcce3SJohannes Berg 				 enum nl80211_band band,
68284b7679a5SJohannes Berg 				 int index)
68294b7679a5SJohannes Berg {
6830046d2e7cSSriram R 	return (sta == NULL || sta->deflink.supp_rates[band] & BIT(index));
68314b7679a5SJohannes Berg }
68324b7679a5SJohannes Berg 
68334b7679a5SJohannes Berg static inline s8
rate_lowest_index(struct ieee80211_supported_band * sband,struct ieee80211_sta * sta)68344b7679a5SJohannes Berg rate_lowest_index(struct ieee80211_supported_band *sband,
68354b7679a5SJohannes Berg 		  struct ieee80211_sta *sta)
68364b7679a5SJohannes Berg {
68374b7679a5SJohannes Berg 	int i;
68384b7679a5SJohannes Berg 
68394b7679a5SJohannes Berg 	for (i = 0; i < sband->n_bitrates; i++)
68404b7679a5SJohannes Berg 		if (rate_supported(sta, sband->band, i))
68414b7679a5SJohannes Berg 			return i;
68424b7679a5SJohannes Berg 
68434b7679a5SJohannes Berg 	/* warn when we cannot find a rate. */
684454d5026eSJohannes Berg 	WARN_ON_ONCE(1);
68454b7679a5SJohannes Berg 
684654d5026eSJohannes Berg 	/* and return 0 (the lowest index) */
68474b7679a5SJohannes Berg 	return 0;
68484b7679a5SJohannes Berg }
68494b7679a5SJohannes Berg 
6850b770b43eSLuis R. Rodriguez static inline
rate_usable_index_exists(struct ieee80211_supported_band * sband,struct ieee80211_sta * sta)6851b770b43eSLuis R. Rodriguez bool rate_usable_index_exists(struct ieee80211_supported_band *sband,
6852b770b43eSLuis R. Rodriguez 			      struct ieee80211_sta *sta)
6853b770b43eSLuis R. Rodriguez {
6854b770b43eSLuis R. Rodriguez 	unsigned int i;
6855b770b43eSLuis R. Rodriguez 
6856b770b43eSLuis R. Rodriguez 	for (i = 0; i < sband->n_bitrates; i++)
6857b770b43eSLuis R. Rodriguez 		if (rate_supported(sta, sband->band, i))
6858b770b43eSLuis R. Rodriguez 			return true;
6859b770b43eSLuis R. Rodriguez 	return false;
6860b770b43eSLuis R. Rodriguez }
68614b7679a5SJohannes Berg 
68620d528d85SFelix Fietkau /**
68630d528d85SFelix Fietkau  * rate_control_set_rates - pass the sta rate selection to mac80211/driver
68640d528d85SFelix Fietkau  *
68650d528d85SFelix Fietkau  * When not doing a rate control probe to test rates, rate control should pass
68660d528d85SFelix Fietkau  * its rate selection to mac80211. If the driver supports receiving a station
68670d528d85SFelix Fietkau  * rate table, it will use it to ensure that frames are always sent based on
68680d528d85SFelix Fietkau  * the most recent rate control module decision.
68690d528d85SFelix Fietkau  *
68700d528d85SFelix Fietkau  * @hw: pointer as obtained from ieee80211_alloc_hw()
68710d528d85SFelix Fietkau  * @pubsta: &struct ieee80211_sta pointer to the target destination.
68720d528d85SFelix Fietkau  * @rates: new tx rate set to be used for this station.
68730d528d85SFelix Fietkau  */
68740d528d85SFelix Fietkau int rate_control_set_rates(struct ieee80211_hw *hw,
68750d528d85SFelix Fietkau 			   struct ieee80211_sta *pubsta,
68760d528d85SFelix Fietkau 			   struct ieee80211_sta_rates *rates);
68770d528d85SFelix Fietkau 
6878631ad703SJohannes Berg int ieee80211_rate_control_register(const struct rate_control_ops *ops);
6879631ad703SJohannes Berg void ieee80211_rate_control_unregister(const struct rate_control_ops *ops);
68804b7679a5SJohannes Berg 
688110c806b3SLuis R. Rodriguez static inline bool
conf_is_ht20(struct ieee80211_conf * conf)688210c806b3SLuis R. Rodriguez conf_is_ht20(struct ieee80211_conf *conf)
688310c806b3SLuis R. Rodriguez {
6884675a0b04SKarl Beldan 	return conf->chandef.width == NL80211_CHAN_WIDTH_20;
688510c806b3SLuis R. Rodriguez }
688610c806b3SLuis R. Rodriguez 
688710c806b3SLuis R. Rodriguez static inline bool
conf_is_ht40_minus(struct ieee80211_conf * conf)688810c806b3SLuis R. Rodriguez conf_is_ht40_minus(struct ieee80211_conf *conf)
688910c806b3SLuis R. Rodriguez {
6890675a0b04SKarl Beldan 	return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
6891675a0b04SKarl Beldan 	       conf->chandef.center_freq1 < conf->chandef.chan->center_freq;
689210c806b3SLuis R. Rodriguez }
689310c806b3SLuis R. Rodriguez 
689410c806b3SLuis R. Rodriguez static inline bool
conf_is_ht40_plus(struct ieee80211_conf * conf)689510c806b3SLuis R. Rodriguez conf_is_ht40_plus(struct ieee80211_conf *conf)
689610c806b3SLuis R. Rodriguez {
6897675a0b04SKarl Beldan 	return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
6898675a0b04SKarl Beldan 	       conf->chandef.center_freq1 > conf->chandef.chan->center_freq;
689910c806b3SLuis R. Rodriguez }
690010c806b3SLuis R. Rodriguez 
690110c806b3SLuis R. Rodriguez static inline bool
conf_is_ht40(struct ieee80211_conf * conf)690210c806b3SLuis R. Rodriguez conf_is_ht40(struct ieee80211_conf *conf)
690310c806b3SLuis R. Rodriguez {
6904675a0b04SKarl Beldan 	return conf->chandef.width == NL80211_CHAN_WIDTH_40;
690510c806b3SLuis R. Rodriguez }
690610c806b3SLuis R. Rodriguez 
690710c806b3SLuis R. Rodriguez static inline bool
conf_is_ht(struct ieee80211_conf * conf)690810c806b3SLuis R. Rodriguez conf_is_ht(struct ieee80211_conf *conf)
690910c806b3SLuis R. Rodriguez {
6910041f607dSRostislav Lisovy 	return (conf->chandef.width != NL80211_CHAN_WIDTH_5) &&
6911041f607dSRostislav Lisovy 		(conf->chandef.width != NL80211_CHAN_WIDTH_10) &&
6912041f607dSRostislav Lisovy 		(conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT);
691310c806b3SLuis R. Rodriguez }
691410c806b3SLuis R. Rodriguez 
69152ca27bcfSJohannes Berg static inline enum nl80211_iftype
ieee80211_iftype_p2p(enum nl80211_iftype type,bool p2p)69162ca27bcfSJohannes Berg ieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p)
69172ca27bcfSJohannes Berg {
69182ca27bcfSJohannes Berg 	if (p2p) {
69192ca27bcfSJohannes Berg 		switch (type) {
69202ca27bcfSJohannes Berg 		case NL80211_IFTYPE_STATION:
69212ca27bcfSJohannes Berg 			return NL80211_IFTYPE_P2P_CLIENT;
69222ca27bcfSJohannes Berg 		case NL80211_IFTYPE_AP:
69232ca27bcfSJohannes Berg 			return NL80211_IFTYPE_P2P_GO;
69242ca27bcfSJohannes Berg 		default:
69252ca27bcfSJohannes Berg 			break;
69262ca27bcfSJohannes Berg 		}
69272ca27bcfSJohannes Berg 	}
69282ca27bcfSJohannes Berg 	return type;
69292ca27bcfSJohannes Berg }
69302ca27bcfSJohannes Berg 
69312ca27bcfSJohannes Berg static inline enum nl80211_iftype
ieee80211_vif_type_p2p(struct ieee80211_vif * vif)69322ca27bcfSJohannes Berg ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
69332ca27bcfSJohannes Berg {
69342ca27bcfSJohannes Berg 	return ieee80211_iftype_p2p(vif->type, vif->p2p);
69352ca27bcfSJohannes Berg }
69362ca27bcfSJohannes Berg 
693765554d07SSara Sharon /**
69381ec7291eSJohannes Berg  * ieee80211_get_he_iftype_cap_vif - return HE capabilities for sband/vif
69391ec7291eSJohannes Berg  * @sband: the sband to search for the iftype on
69401ec7291eSJohannes Berg  * @vif: the vif to get the iftype from
69411ec7291eSJohannes Berg  *
69421ec7291eSJohannes Berg  * Return: pointer to the struct ieee80211_sta_he_cap, or %NULL is none found
69431ec7291eSJohannes Berg  */
69441ec7291eSJohannes Berg static inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band * sband,struct ieee80211_vif * vif)69451ec7291eSJohannes Berg ieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *sband,
69461ec7291eSJohannes Berg 				struct ieee80211_vif *vif)
69471ec7291eSJohannes Berg {
69481ec7291eSJohannes Berg 	return ieee80211_get_he_iftype_cap(sband, ieee80211_vif_type_p2p(vif));
69491ec7291eSJohannes Berg }
69501ec7291eSJohannes Berg 
69511ec7291eSJohannes Berg /**
69521ec7291eSJohannes Berg  * ieee80211_get_he_6ghz_capa_vif - return HE 6 GHz capabilities
69531ec7291eSJohannes Berg  * @sband: the sband to search for the STA on
69541ec7291eSJohannes Berg  * @vif: the vif to get the iftype from
69551ec7291eSJohannes Berg  *
69561ec7291eSJohannes Berg  * Return: the 6GHz capabilities
69571ec7291eSJohannes Berg  */
69581ec7291eSJohannes Berg static inline __le16
ieee80211_get_he_6ghz_capa_vif(const struct ieee80211_supported_band * sband,struct ieee80211_vif * vif)69591ec7291eSJohannes Berg ieee80211_get_he_6ghz_capa_vif(const struct ieee80211_supported_band *sband,
69601ec7291eSJohannes Berg 			       struct ieee80211_vif *vif)
69611ec7291eSJohannes Berg {
69621ec7291eSJohannes Berg 	return ieee80211_get_he_6ghz_capa(sband, ieee80211_vif_type_p2p(vif));
69631ec7291eSJohannes Berg }
69641ec7291eSJohannes Berg 
69651ec7291eSJohannes Berg /**
69661ec7291eSJohannes Berg  * ieee80211_get_eht_iftype_cap_vif - return ETH capabilities for sband/vif
69671ec7291eSJohannes Berg  * @sband: the sband to search for the iftype on
69681ec7291eSJohannes Berg  * @vif: the vif to get the iftype from
69691ec7291eSJohannes Berg  *
69701ec7291eSJohannes Berg  * Return: pointer to the struct ieee80211_sta_eht_cap, or %NULL is none found
69711ec7291eSJohannes Berg  */
69721ec7291eSJohannes Berg static inline const struct ieee80211_sta_eht_cap *
ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band * sband,struct ieee80211_vif * vif)69731ec7291eSJohannes Berg ieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *sband,
69741ec7291eSJohannes Berg 				 struct ieee80211_vif *vif)
69751ec7291eSJohannes Berg {
69761ec7291eSJohannes Berg 	return ieee80211_get_eht_iftype_cap(sband, ieee80211_vif_type_p2p(vif));
69771ec7291eSJohannes Berg }
69781ec7291eSJohannes Berg 
69791ec7291eSJohannes Berg /**
698065554d07SSara Sharon  * ieee80211_update_mu_groups - set the VHT MU-MIMO groud data
698165554d07SSara Sharon  *
698265554d07SSara Sharon  * @vif: the specified virtual interface
6983afe0d181SJohannes Berg  * @link_id: the link ID for MLO, otherwise 0
698465554d07SSara Sharon  * @membership: 64 bits array - a bit is set if station is member of the group
698565554d07SSara Sharon  * @position: 2 bits per group id indicating the position in the group
698665554d07SSara Sharon  *
698765554d07SSara Sharon  * Note: This function assumes that the given vif is valid and the position and
698865554d07SSara Sharon  * membership data is of the correct size and are in the same byte order as the
698965554d07SSara Sharon  * matching GroupId management frame.
699065554d07SSara Sharon  * Calls to this function need to be serialized with RX path.
699165554d07SSara Sharon  */
6992afe0d181SJohannes Berg void ieee80211_update_mu_groups(struct ieee80211_vif *vif, unsigned int link_id,
699365554d07SSara Sharon 				const u8 *membership, const u8 *position);
699465554d07SSara Sharon 
6995615f7b9bSMeenakshi Venkataraman void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
6996615f7b9bSMeenakshi Venkataraman 				   int rssi_min_thold,
6997615f7b9bSMeenakshi Venkataraman 				   int rssi_max_thold);
6998615f7b9bSMeenakshi Venkataraman 
6999615f7b9bSMeenakshi Venkataraman void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
7000768db343SArik Nemtsov 
70010d8a0a17SWey-Yi Guy /**
70020ae997dcSYacine Belkadi  * ieee80211_ave_rssi - report the average RSSI for the specified interface
70030d8a0a17SWey-Yi Guy  *
70040d8a0a17SWey-Yi Guy  * @vif: the specified virtual interface
70050d8a0a17SWey-Yi Guy  *
70060ae997dcSYacine Belkadi  * Note: This function assumes that the given vif is valid.
70070ae997dcSYacine Belkadi  *
70080ae997dcSYacine Belkadi  * Return: The average RSSI value for the requested interface, or 0 if not
70090ae997dcSYacine Belkadi  * applicable.
70100d8a0a17SWey-Yi Guy  */
70111dae27f8SWey-Yi Guy int ieee80211_ave_rssi(struct ieee80211_vif *vif);
70121dae27f8SWey-Yi Guy 
7013cd8f7cb4SJohannes Berg /**
7014cd8f7cb4SJohannes Berg  * ieee80211_report_wowlan_wakeup - report WoWLAN wakeup
7015cd8f7cb4SJohannes Berg  * @vif: virtual interface
7016cd8f7cb4SJohannes Berg  * @wakeup: wakeup reason(s)
7017cd8f7cb4SJohannes Berg  * @gfp: allocation flags
7018cd8f7cb4SJohannes Berg  *
7019cd8f7cb4SJohannes Berg  * See cfg80211_report_wowlan_wakeup().
7020cd8f7cb4SJohannes Berg  */
7021cd8f7cb4SJohannes Berg void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
7022cd8f7cb4SJohannes Berg 				    struct cfg80211_wowlan_wakeup *wakeup,
7023cd8f7cb4SJohannes Berg 				    gfp_t gfp);
7024cd8f7cb4SJohannes Berg 
702506be6b14SFelix Fietkau /**
702606be6b14SFelix Fietkau  * ieee80211_tx_prepare_skb - prepare an 802.11 skb for transmission
702706be6b14SFelix Fietkau  * @hw: pointer as obtained from ieee80211_alloc_hw()
702806be6b14SFelix Fietkau  * @vif: virtual interface
702906be6b14SFelix Fietkau  * @skb: frame to be sent from within the driver
703006be6b14SFelix Fietkau  * @band: the band to transmit on
703106be6b14SFelix Fietkau  * @sta: optional pointer to get the station to send the frame to
703206be6b14SFelix Fietkau  *
703306be6b14SFelix Fietkau  * Note: must be called under RCU lock
703406be6b14SFelix Fietkau  */
703506be6b14SFelix Fietkau bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
703606be6b14SFelix Fietkau 			      struct ieee80211_vif *vif, struct sk_buff *skb,
703706be6b14SFelix Fietkau 			      int band, struct ieee80211_sta **sta);
703806be6b14SFelix Fietkau 
7039a7022e65SFelix Fietkau /**
7040b1e8eb11SMauro Carvalho Chehab  * ieee80211_parse_tx_radiotap - Sanity-check and parse the radiotap header
7041bddc0c41SMathy Vanhoef  *				 of injected frames.
7042bddc0c41SMathy Vanhoef  *
7043bddc0c41SMathy Vanhoef  * To accurately parse and take into account rate and retransmission fields,
7044bddc0c41SMathy Vanhoef  * you must initialize the chandef field in the ieee80211_tx_info structure
7045bddc0c41SMathy Vanhoef  * of the skb before calling this function.
7046bddc0c41SMathy Vanhoef  *
7047cb17ed29SMathy Vanhoef  * @skb: packet injected by userspace
7048cb17ed29SMathy Vanhoef  * @dev: the &struct device of this 802.11 device
7049cb17ed29SMathy Vanhoef  */
7050cb17ed29SMathy Vanhoef bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
7051cb17ed29SMathy Vanhoef 				 struct net_device *dev);
7052cb17ed29SMathy Vanhoef 
7053cb17ed29SMathy Vanhoef /**
7054a7022e65SFelix Fietkau  * struct ieee80211_noa_data - holds temporary data for tracking P2P NoA state
7055a7022e65SFelix Fietkau  *
7056a7022e65SFelix Fietkau  * @next_tsf: TSF timestamp of the next absent state change
7057a7022e65SFelix Fietkau  * @has_next_tsf: next absent state change event pending
7058a7022e65SFelix Fietkau  *
7059a7022e65SFelix Fietkau  * @absent: descriptor bitmask, set if GO is currently absent
7060a7022e65SFelix Fietkau  *
7061a7022e65SFelix Fietkau  * private:
7062a7022e65SFelix Fietkau  *
7063a7022e65SFelix Fietkau  * @count: count fields from the NoA descriptors
7064a7022e65SFelix Fietkau  * @desc: adjusted data from the NoA
7065a7022e65SFelix Fietkau  */
7066a7022e65SFelix Fietkau struct ieee80211_noa_data {
7067a7022e65SFelix Fietkau 	u32 next_tsf;
7068a7022e65SFelix Fietkau 	bool has_next_tsf;
7069a7022e65SFelix Fietkau 
7070a7022e65SFelix Fietkau 	u8 absent;
7071a7022e65SFelix Fietkau 
7072a7022e65SFelix Fietkau 	u8 count[IEEE80211_P2P_NOA_DESC_MAX];
7073a7022e65SFelix Fietkau 	struct {
7074a7022e65SFelix Fietkau 		u32 start;
7075a7022e65SFelix Fietkau 		u32 duration;
7076a7022e65SFelix Fietkau 		u32 interval;
7077a7022e65SFelix Fietkau 	} desc[IEEE80211_P2P_NOA_DESC_MAX];
7078a7022e65SFelix Fietkau };
7079a7022e65SFelix Fietkau 
7080a7022e65SFelix Fietkau /**
7081a7022e65SFelix Fietkau  * ieee80211_parse_p2p_noa - initialize NoA tracking data from P2P IE
7082a7022e65SFelix Fietkau  *
7083a7022e65SFelix Fietkau  * @attr: P2P NoA IE
7084a7022e65SFelix Fietkau  * @data: NoA tracking data
7085a7022e65SFelix Fietkau  * @tsf: current TSF timestamp
7086a7022e65SFelix Fietkau  *
7087a7022e65SFelix Fietkau  * Return: number of successfully parsed descriptors
7088a7022e65SFelix Fietkau  */
7089a7022e65SFelix Fietkau int ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr,
7090a7022e65SFelix Fietkau 			    struct ieee80211_noa_data *data, u32 tsf);
7091a7022e65SFelix Fietkau 
7092a7022e65SFelix Fietkau /**
7093a7022e65SFelix Fietkau  * ieee80211_update_p2p_noa - get next pending P2P GO absent state change
7094a7022e65SFelix Fietkau  *
7095a7022e65SFelix Fietkau  * @data: NoA tracking data
7096a7022e65SFelix Fietkau  * @tsf: current TSF timestamp
7097a7022e65SFelix Fietkau  */
7098a7022e65SFelix Fietkau void ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
7099a7022e65SFelix Fietkau 
7100c887f0d3SArik Nemtsov /**
7101b1e8eb11SMauro Carvalho Chehab  * ieee80211_tdls_oper_request - request userspace to perform a TDLS operation
7102c887f0d3SArik Nemtsov  * @vif: virtual interface
7103c887f0d3SArik Nemtsov  * @peer: the peer's destination address
7104c887f0d3SArik Nemtsov  * @oper: the requested TDLS operation
7105c887f0d3SArik Nemtsov  * @reason_code: reason code for the operation, valid for TDLS teardown
7106c887f0d3SArik Nemtsov  * @gfp: allocation flags
7107c887f0d3SArik Nemtsov  *
7108c887f0d3SArik Nemtsov  * See cfg80211_tdls_oper_request().
7109c887f0d3SArik Nemtsov  */
7110c887f0d3SArik Nemtsov void ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,
7111c887f0d3SArik Nemtsov 				 enum nl80211_tdls_operation oper,
7112c887f0d3SArik Nemtsov 				 u16 reason_code, gfp_t gfp);
7113a7f3a768SAndrei Otcheretianski 
7114a7f3a768SAndrei Otcheretianski /**
7115b6da911bSLiad Kaufman  * ieee80211_reserve_tid - request to reserve a specific TID
7116b6da911bSLiad Kaufman  *
7117b6da911bSLiad Kaufman  * There is sometimes a need (such as in TDLS) for blocking the driver from
7118b6da911bSLiad Kaufman  * using a specific TID so that the FW can use it for certain operations such
7119b6da911bSLiad Kaufman  * as sending PTI requests. To make sure that the driver doesn't use that TID,
7120b6da911bSLiad Kaufman  * this function must be called as it flushes out packets on this TID and marks
7121b6da911bSLiad Kaufman  * it as blocked, so that any transmit for the station on this TID will be
7122b6da911bSLiad Kaufman  * redirected to the alternative TID in the same AC.
7123b6da911bSLiad Kaufman  *
7124b6da911bSLiad Kaufman  * Note that this function blocks and may call back into the driver, so it
7125b6da911bSLiad Kaufman  * should be called without driver locks held. Also note this function should
7126b6da911bSLiad Kaufman  * only be called from the driver's @sta_state callback.
7127b6da911bSLiad Kaufman  *
7128b6da911bSLiad Kaufman  * @sta: the station to reserve the TID for
7129b6da911bSLiad Kaufman  * @tid: the TID to reserve
7130b6da911bSLiad Kaufman  *
7131b6da911bSLiad Kaufman  * Returns: 0 on success, else on failure
7132b6da911bSLiad Kaufman  */
7133b6da911bSLiad Kaufman int ieee80211_reserve_tid(struct ieee80211_sta *sta, u8 tid);
7134b6da911bSLiad Kaufman 
7135b6da911bSLiad Kaufman /**
7136b6da911bSLiad Kaufman  * ieee80211_unreserve_tid - request to unreserve a specific TID
7137b6da911bSLiad Kaufman  *
7138b6da911bSLiad Kaufman  * Once there is no longer any need for reserving a certain TID, this function
7139b6da911bSLiad Kaufman  * should be called, and no longer will packets have their TID modified for
7140b6da911bSLiad Kaufman  * preventing use of this TID in the driver.
7141b6da911bSLiad Kaufman  *
7142b6da911bSLiad Kaufman  * Note that this function blocks and acquires a lock, so it should be called
7143b6da911bSLiad Kaufman  * without driver locks held. Also note this function should only be called
7144b6da911bSLiad Kaufman  * from the driver's @sta_state callback.
7145b6da911bSLiad Kaufman  *
7146b6da911bSLiad Kaufman  * @sta: the station
7147b6da911bSLiad Kaufman  * @tid: the TID to unreserve
7148b6da911bSLiad Kaufman  */
7149b6da911bSLiad Kaufman void ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
7150b6da911bSLiad Kaufman 
7151b6da911bSLiad Kaufman /**
7152ba8c3d6fSFelix Fietkau  * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
7153ba8c3d6fSFelix Fietkau  *
7154ba8c3d6fSFelix Fietkau  * @hw: pointer as obtained from ieee80211_alloc_hw()
715518667600SToke Høiland-Jørgensen  * @txq: pointer obtained from station or virtual interface, or from
715618667600SToke Høiland-Jørgensen  *	ieee80211_next_txq()
7157ba8c3d6fSFelix Fietkau  *
7158ba8c3d6fSFelix Fietkau  * Returns the skb if successful, %NULL if no frame was available.
7159fca1279fSJohannes Berg  *
7160fca1279fSJohannes Berg  * Note that this must be called in an rcu_read_lock() critical section,
7161fca1279fSJohannes Berg  * which can only be released after the SKB was handled. Some pointers in
716266b239d2SRandy Dunlap  * skb->cb, e.g. the key pointer, are protected by RCU and thus the
7163fca1279fSJohannes Berg  * critical section must persist not just for the duration of this call
7164fca1279fSJohannes Berg  * but for the duration of the frame handling.
7165fca1279fSJohannes Berg  * However, also note that while in the wake_tx_queue() method,
7166fca1279fSJohannes Berg  * rcu_read_lock() is already held.
7167fb0e76abSErik Stromdahl  *
7168fb0e76abSErik Stromdahl  * softirqs must also be disabled when this function is called.
7169fb0e76abSErik Stromdahl  * In process context, use ieee80211_tx_dequeue_ni() instead.
7170ba8c3d6fSFelix Fietkau  */
7171ba8c3d6fSFelix Fietkau struct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
7172ba8c3d6fSFelix Fietkau 				     struct ieee80211_txq *txq);
7173f2ac7e30SMichal Kazior 
7174f2ac7e30SMichal Kazior /**
7175fb0e76abSErik Stromdahl  * ieee80211_tx_dequeue_ni - dequeue a packet from a software tx queue
7176fb0e76abSErik Stromdahl  * (in process context)
7177fb0e76abSErik Stromdahl  *
7178fb0e76abSErik Stromdahl  * Like ieee80211_tx_dequeue() but can be called in process context
7179fb0e76abSErik Stromdahl  * (internally disables bottom halves).
7180fb0e76abSErik Stromdahl  *
7181fb0e76abSErik Stromdahl  * @hw: pointer as obtained from ieee80211_alloc_hw()
7182fb0e76abSErik Stromdahl  * @txq: pointer obtained from station or virtual interface, or from
7183fb0e76abSErik Stromdahl  *	ieee80211_next_txq()
7184fb0e76abSErik Stromdahl  */
ieee80211_tx_dequeue_ni(struct ieee80211_hw * hw,struct ieee80211_txq * txq)7185fb0e76abSErik Stromdahl static inline struct sk_buff *ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw,
7186fb0e76abSErik Stromdahl 						      struct ieee80211_txq *txq)
7187fb0e76abSErik Stromdahl {
7188fb0e76abSErik Stromdahl 	struct sk_buff *skb;
7189fb0e76abSErik Stromdahl 
7190fb0e76abSErik Stromdahl 	local_bh_disable();
7191fb0e76abSErik Stromdahl 	skb = ieee80211_tx_dequeue(hw, txq);
7192fb0e76abSErik Stromdahl 	local_bh_enable();
7193fb0e76abSErik Stromdahl 
7194fb0e76abSErik Stromdahl 	return skb;
7195fb0e76abSErik Stromdahl }
7196fb0e76abSErik Stromdahl 
7197fb0e76abSErik Stromdahl /**
7198c850e31fSAlexander Wetzel  * ieee80211_handle_wake_tx_queue - mac80211 handler for wake_tx_queue callback
7199c850e31fSAlexander Wetzel  *
7200c850e31fSAlexander Wetzel  * @hw: pointer as obtained from wake_tx_queue() callback().
7201c850e31fSAlexander Wetzel  * @txq: pointer as obtained from wake_tx_queue() callback().
7202c850e31fSAlexander Wetzel  *
7203c850e31fSAlexander Wetzel  * Drivers can use this function for the mandatory mac80211 wake_tx_queue
7204c850e31fSAlexander Wetzel  * callback in struct ieee80211_ops. They should not call this function.
7205c850e31fSAlexander Wetzel  */
7206c850e31fSAlexander Wetzel void ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,
7207c850e31fSAlexander Wetzel 				    struct ieee80211_txq *txq);
7208c850e31fSAlexander Wetzel 
7209c850e31fSAlexander Wetzel /**
721018667600SToke Høiland-Jørgensen  * ieee80211_next_txq - get next tx queue to pull packets from
721118667600SToke Høiland-Jørgensen  *
721218667600SToke Høiland-Jørgensen  * @hw: pointer as obtained from ieee80211_alloc_hw()
721318667600SToke Høiland-Jørgensen  * @ac: AC number to return packets from.
721418667600SToke Høiland-Jørgensen  *
721518667600SToke Høiland-Jørgensen  * Returns the next txq if successful, %NULL if no queue is eligible. If a txq
721618667600SToke Høiland-Jørgensen  * is returned, it should be returned with ieee80211_return_txq() after the
721718667600SToke Høiland-Jørgensen  * driver has finished scheduling it.
721818667600SToke Høiland-Jørgensen  */
721918667600SToke Høiland-Jørgensen struct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac);
722018667600SToke Høiland-Jørgensen 
722118667600SToke Høiland-Jørgensen /**
72225b989c18SFelix Fietkau  * ieee80211_txq_schedule_start - start new scheduling round for TXQs
722318667600SToke Høiland-Jørgensen  *
722418667600SToke Høiland-Jørgensen  * @hw: pointer as obtained from ieee80211_alloc_hw()
722518667600SToke Høiland-Jørgensen  * @ac: AC number to acquire locks for
722618667600SToke Høiland-Jørgensen  *
72275b989c18SFelix Fietkau  * Should be called before ieee80211_next_txq() or ieee80211_return_txq().
72285b989c18SFelix Fietkau  * The driver must not call multiple TXQ scheduling rounds concurrently.
722918667600SToke Høiland-Jørgensen  */
72305b989c18SFelix Fietkau void ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac);
723118667600SToke Høiland-Jørgensen 
72325b989c18SFelix Fietkau /* (deprecated) */
ieee80211_txq_schedule_end(struct ieee80211_hw * hw,u8 ac)72335b989c18SFelix Fietkau static inline void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
72345b989c18SFelix Fietkau {
72355b989c18SFelix Fietkau }
723618667600SToke Høiland-Jørgensen 
7237942741daSFelix Fietkau void __ieee80211_schedule_txq(struct ieee80211_hw *hw,
7238942741daSFelix Fietkau 			      struct ieee80211_txq *txq, bool force);
7239942741daSFelix Fietkau 
724018667600SToke Høiland-Jørgensen /**
7241390298e8SToke Høiland-Jørgensen  * ieee80211_schedule_txq - schedule a TXQ for transmission
7242390298e8SToke Høiland-Jørgensen  *
7243390298e8SToke Høiland-Jørgensen  * @hw: pointer as obtained from ieee80211_alloc_hw()
7244390298e8SToke Høiland-Jørgensen  * @txq: pointer obtained from station or virtual interface
7245390298e8SToke Høiland-Jørgensen  *
72462b4a6698SFelix Fietkau  * Schedules a TXQ for transmission if it is not already scheduled,
72472b4a6698SFelix Fietkau  * even if mac80211 does not have any packets buffered.
72482b4a6698SFelix Fietkau  *
72492b4a6698SFelix Fietkau  * The driver may call this function if it has buffered packets for
72502b4a6698SFelix Fietkau  * this TXQ internally.
7251390298e8SToke Høiland-Jørgensen  */
7252942741daSFelix Fietkau static inline void
ieee80211_schedule_txq(struct ieee80211_hw * hw,struct ieee80211_txq * txq)7253942741daSFelix Fietkau ieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
7254942741daSFelix Fietkau {
7255942741daSFelix Fietkau 	__ieee80211_schedule_txq(hw, txq, true);
7256942741daSFelix Fietkau }
72575b989c18SFelix Fietkau 
72585b989c18SFelix Fietkau /**
72595b989c18SFelix Fietkau  * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq()
72605b989c18SFelix Fietkau  *
72615b989c18SFelix Fietkau  * @hw: pointer as obtained from ieee80211_alloc_hw()
72625b989c18SFelix Fietkau  * @txq: pointer obtained from station or virtual interface
72632b4a6698SFelix Fietkau  * @force: schedule txq even if mac80211 does not have any buffered packets.
72642b4a6698SFelix Fietkau  *
72652b4a6698SFelix Fietkau  * The driver may set force=true if it has buffered packets for this TXQ
72662b4a6698SFelix Fietkau  * internally.
72675b989c18SFelix Fietkau  */
7268942741daSFelix Fietkau static inline void
ieee80211_return_txq(struct ieee80211_hw * hw,struct ieee80211_txq * txq,bool force)7269942741daSFelix Fietkau ieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
7270942741daSFelix Fietkau 		     bool force)
7271942741daSFelix Fietkau {
7272942741daSFelix Fietkau 	__ieee80211_schedule_txq(hw, txq, force);
7273942741daSFelix Fietkau }
7274390298e8SToke Høiland-Jørgensen 
7275390298e8SToke Høiland-Jørgensen /**
7276b4809e94SToke Høiland-Jørgensen  * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
7277b4809e94SToke Høiland-Jørgensen  *
7278b4809e94SToke Høiland-Jørgensen  * This function is used to check whether given txq is allowed to transmit by
7279b4809e94SToke Høiland-Jørgensen  * the airtime scheduler, and can be used by drivers to access the airtime
7280b4809e94SToke Høiland-Jørgensen  * fairness accounting without going using the scheduling order enfored by
7281b4809e94SToke Høiland-Jørgensen  * next_txq().
7282b4809e94SToke Høiland-Jørgensen  *
7283b4809e94SToke Høiland-Jørgensen  * Returns %true if the airtime scheduler thinks the TXQ should be allowed to
7284b4809e94SToke Høiland-Jørgensen  * transmit, and %false if it should be throttled. This function can also have
7285b4809e94SToke Høiland-Jørgensen  * the side effect of rotating the TXQ in the scheduler rotation, which will
7286b4809e94SToke Høiland-Jørgensen  * eventually bring the deficit to positive and allow the station to transmit
7287b4809e94SToke Høiland-Jørgensen  * again.
7288b4809e94SToke Høiland-Jørgensen  *
7289b4809e94SToke Høiland-Jørgensen  * The API ieee80211_txq_may_transmit() also ensures that TXQ list will be
7290ae4a50eeSChris Packham  * aligned against driver's own round-robin scheduler list. i.e it rotates
7291b4809e94SToke Høiland-Jørgensen  * the TXQ list till it makes the requested node becomes the first entry
7292b4809e94SToke Høiland-Jørgensen  * in TXQ list. Thus both the TXQ list and driver's list are in sync. If this
7293b4809e94SToke Høiland-Jørgensen  * function returns %true, the driver is expected to schedule packets
7294b4809e94SToke Høiland-Jørgensen  * for transmission, and then return the TXQ through ieee80211_return_txq().
7295b4809e94SToke Høiland-Jørgensen  *
7296b4809e94SToke Høiland-Jørgensen  * @hw: pointer as obtained from ieee80211_alloc_hw()
7297b4809e94SToke Høiland-Jørgensen  * @txq: pointer obtained from station or virtual interface
7298b4809e94SToke Høiland-Jørgensen  */
7299b4809e94SToke Høiland-Jørgensen bool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
7300b4809e94SToke Høiland-Jørgensen 				struct ieee80211_txq *txq);
7301b4809e94SToke Høiland-Jørgensen 
7302b4809e94SToke Høiland-Jørgensen /**
7303f2ac7e30SMichal Kazior  * ieee80211_txq_get_depth - get pending frame/byte count of given txq
7304f2ac7e30SMichal Kazior  *
7305f2ac7e30SMichal Kazior  * The values are not guaranteed to be coherent with regard to each other, i.e.
7306f2ac7e30SMichal Kazior  * txq state can change half-way of this function and the caller may end up
7307f2ac7e30SMichal Kazior  * with "new" frame_cnt and "old" byte_cnt or vice-versa.
7308f2ac7e30SMichal Kazior  *
7309f2ac7e30SMichal Kazior  * @txq: pointer obtained from station or virtual interface
7310f2ac7e30SMichal Kazior  * @frame_cnt: pointer to store frame count
7311f2ac7e30SMichal Kazior  * @byte_cnt: pointer to store byte count
7312f2ac7e30SMichal Kazior  */
7313f2ac7e30SMichal Kazior void ieee80211_txq_get_depth(struct ieee80211_txq *txq,
7314f2ac7e30SMichal Kazior 			     unsigned long *frame_cnt,
7315f2ac7e30SMichal Kazior 			     unsigned long *byte_cnt);
7316167e33f4SAyala Beker 
7317167e33f4SAyala Beker /**
7318167e33f4SAyala Beker  * ieee80211_nan_func_terminated - notify about NAN function termination.
7319167e33f4SAyala Beker  *
7320167e33f4SAyala Beker  * This function is used to notify mac80211 about NAN function termination.
7321167e33f4SAyala Beker  * Note that this function can't be called from hard irq.
7322167e33f4SAyala Beker  *
7323167e33f4SAyala Beker  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
7324167e33f4SAyala Beker  * @inst_id: the local instance id
7325167e33f4SAyala Beker  * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
7326167e33f4SAyala Beker  * @gfp: allocation flags
7327167e33f4SAyala Beker  */
7328167e33f4SAyala Beker void ieee80211_nan_func_terminated(struct ieee80211_vif *vif,
7329167e33f4SAyala Beker 				   u8 inst_id,
7330167e33f4SAyala Beker 				   enum nl80211_nan_func_term_reason reason,
7331167e33f4SAyala Beker 				   gfp_t gfp);
733292bc43bcSAyala Beker 
733392bc43bcSAyala Beker /**
733492bc43bcSAyala Beker  * ieee80211_nan_func_match - notify about NAN function match event.
733592bc43bcSAyala Beker  *
733692bc43bcSAyala Beker  * This function is used to notify mac80211 about NAN function match. The
733792bc43bcSAyala Beker  * cookie inside the match struct will be assigned by mac80211.
733892bc43bcSAyala Beker  * Note that this function can't be called from hard irq.
733992bc43bcSAyala Beker  *
734092bc43bcSAyala Beker  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
734192bc43bcSAyala Beker  * @match: match event information
734292bc43bcSAyala Beker  * @gfp: allocation flags
734392bc43bcSAyala Beker  */
734492bc43bcSAyala Beker void ieee80211_nan_func_match(struct ieee80211_vif *vif,
734592bc43bcSAyala Beker 			      struct cfg80211_nan_match_params *match,
734692bc43bcSAyala Beker 			      gfp_t gfp);
734792bc43bcSAyala Beker 
7348db3e1c40SToke Høiland-Jørgensen /**
7349db3e1c40SToke Høiland-Jørgensen  * ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
7350db3e1c40SToke Høiland-Jørgensen  *
7351db3e1c40SToke Høiland-Jørgensen  * This function calculates the estimated airtime usage of a frame based on the
7352db3e1c40SToke Høiland-Jørgensen  * rate information in the RX status struct and the frame length.
7353db3e1c40SToke Høiland-Jørgensen  *
7354db3e1c40SToke Høiland-Jørgensen  * @hw: pointer as obtained from ieee80211_alloc_hw()
7355db3e1c40SToke Høiland-Jørgensen  * @status: &struct ieee80211_rx_status containing the transmission rate
7356db3e1c40SToke Høiland-Jørgensen  *          information.
7357db3e1c40SToke Høiland-Jørgensen  * @len: frame length in bytes
7358db3e1c40SToke Høiland-Jørgensen  */
7359db3e1c40SToke Høiland-Jørgensen u32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
7360db3e1c40SToke Høiland-Jørgensen 			      struct ieee80211_rx_status *status,
7361db3e1c40SToke Høiland-Jørgensen 			      int len);
7362db3e1c40SToke Høiland-Jørgensen 
7363db3e1c40SToke Høiland-Jørgensen /**
7364db3e1c40SToke Høiland-Jørgensen  * ieee80211_calc_tx_airtime - calculate estimated transmission airtime for TX.
7365db3e1c40SToke Høiland-Jørgensen  *
7366db3e1c40SToke Høiland-Jørgensen  * This function calculates the estimated airtime usage of a frame based on the
7367db3e1c40SToke Høiland-Jørgensen  * rate information in the TX info struct and the frame length.
7368db3e1c40SToke Høiland-Jørgensen  *
7369db3e1c40SToke Høiland-Jørgensen  * @hw: pointer as obtained from ieee80211_alloc_hw()
7370db3e1c40SToke Høiland-Jørgensen  * @info: &struct ieee80211_tx_info of the frame.
7371db3e1c40SToke Høiland-Jørgensen  * @len: frame length in bytes
7372db3e1c40SToke Høiland-Jørgensen  */
7373db3e1c40SToke Høiland-Jørgensen u32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
7374db3e1c40SToke Høiland-Jørgensen 			      struct ieee80211_tx_info *info,
7375db3e1c40SToke Høiland-Jørgensen 			      int len);
737650ff477aSJohn Crispin /**
737750ff477aSJohn Crispin  * ieee80211_set_hw_80211_encap - enable hardware encapsulation offloading.
737850ff477aSJohn Crispin  *
737950ff477aSJohn Crispin  * This function is used to notify mac80211 that a vif can be passed raw 802.3
738050ff477aSJohn Crispin  * frames. The driver needs to then handle the 802.11 encapsulation inside the
738150ff477aSJohn Crispin  * hardware or firmware.
738250ff477aSJohn Crispin  *
738350ff477aSJohn Crispin  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
738450ff477aSJohn Crispin  * @enable: indicate if the feature should be turned on or off
738550ff477aSJohn Crispin  */
738650ff477aSJohn Crispin bool ieee80211_set_hw_80211_encap(struct ieee80211_vif *vif, bool enable);
7387db3e1c40SToke Høiland-Jørgensen 
7388295b02c4SAloka Dixit /**
7389295b02c4SAloka Dixit  * ieee80211_get_fils_discovery_tmpl - Get FILS discovery template.
7390295b02c4SAloka Dixit  * @hw: pointer obtained from ieee80211_alloc_hw().
7391295b02c4SAloka Dixit  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
7392295b02c4SAloka Dixit  *
7393295b02c4SAloka Dixit  * The driver is responsible for freeing the returned skb.
7394295b02c4SAloka Dixit  *
7395295b02c4SAloka Dixit  * Return: FILS discovery template. %NULL on error.
7396295b02c4SAloka Dixit  */
7397295b02c4SAloka Dixit struct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
7398295b02c4SAloka Dixit 						  struct ieee80211_vif *vif);
7399632189a0SAloka Dixit 
7400632189a0SAloka Dixit /**
7401632189a0SAloka Dixit  * ieee80211_get_unsol_bcast_probe_resp_tmpl - Get unsolicited broadcast
7402632189a0SAloka Dixit  *	probe response template.
7403632189a0SAloka Dixit  * @hw: pointer obtained from ieee80211_alloc_hw().
7404632189a0SAloka Dixit  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
7405632189a0SAloka Dixit  *
7406632189a0SAloka Dixit  * The driver is responsible for freeing the returned skb.
7407632189a0SAloka Dixit  *
7408632189a0SAloka Dixit  * Return: Unsolicited broadcast probe response template. %NULL on error.
7409632189a0SAloka Dixit  */
7410632189a0SAloka Dixit struct sk_buff *
7411632189a0SAloka Dixit ieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
7412632189a0SAloka Dixit 					  struct ieee80211_vif *vif);
7413cff7b5caSPhilipp Borgers 
7414cff7b5caSPhilipp Borgers /**
741582253ddaSJohannes Berg  * ieee80211_obss_color_collision_notify - notify userland about a BSS color
74165f9404abSJohn Crispin  * collision.
74175f9404abSJohn Crispin  *
74185f9404abSJohn Crispin  * @vif: &struct ieee80211_vif pointer from the add_interface callback.
74195f9404abSJohn Crispin  * @color_bitmap: a 64 bit bitmap representing the colors that the local BSS is
74205f9404abSJohn Crispin  *	aware of.
742103895c84SLorenzo Bianconi  * @gfp: allocation flags
74225f9404abSJohn Crispin  */
74235f9404abSJohn Crispin void
742482253ddaSJohannes Berg ieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
742503895c84SLorenzo Bianconi 				      u64 color_bitmap, gfp_t gfp);
74265f9404abSJohn Crispin 
74275f9404abSJohn Crispin /**
7428cff7b5caSPhilipp Borgers  * ieee80211_is_tx_data - check if frame is a data frame
7429cff7b5caSPhilipp Borgers  *
7430cff7b5caSPhilipp Borgers  * The function is used to check if a frame is a data frame. Frames with
7431cff7b5caSPhilipp Borgers  * hardware encapsulation enabled are data frames.
7432cff7b5caSPhilipp Borgers  *
7433cff7b5caSPhilipp Borgers  * @skb: the frame to be transmitted.
7434cff7b5caSPhilipp Borgers  */
ieee80211_is_tx_data(struct sk_buff * skb)7435cff7b5caSPhilipp Borgers static inline bool ieee80211_is_tx_data(struct sk_buff *skb)
7436cff7b5caSPhilipp Borgers {
7437cff7b5caSPhilipp Borgers 	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
7438cff7b5caSPhilipp Borgers 	struct ieee80211_hdr *hdr = (void *) skb->data;
7439cff7b5caSPhilipp Borgers 
7440cff7b5caSPhilipp Borgers 	return info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP ||
7441cff7b5caSPhilipp Borgers 	       ieee80211_is_data(hdr->frame_control);
7442cff7b5caSPhilipp Borgers }
7443cff7b5caSPhilipp Borgers 
74443d901102SJohannes Berg /**
74453d901102SJohannes Berg  * ieee80211_set_active_links - set active links in client mode
74463d901102SJohannes Berg  * @vif: interface to set active links on
74473d901102SJohannes Berg  * @active_links: the new active links bitmap
74483d901102SJohannes Berg  *
74493d901102SJohannes Berg  * This changes the active links on an interface. The interface
74503d901102SJohannes Berg  * must be in client mode (in AP mode, all links are always active),
74513d901102SJohannes Berg  * and @active_links must be a subset of the vif's valid_links.
74523d901102SJohannes Berg  *
74533d901102SJohannes Berg  * If a link is switched off and another is switched on at the same
74543d901102SJohannes Berg  * time (e.g. active_links going from 0x1 to 0x10) then you will get
74553d901102SJohannes Berg  * a sequence of calls like
74563d901102SJohannes Berg  *  - change_vif_links(0x11)
74573d901102SJohannes Berg  *  - unassign_vif_chanctx(link_id=0)
74583d901102SJohannes Berg  *  - change_sta_links(0x11) for each affected STA (the AP)
74593d901102SJohannes Berg  *    (TDLS connections on now inactive links should be torn down)
74603d901102SJohannes Berg  *  - remove group keys on the old link (link_id 0)
74613d901102SJohannes Berg  *  - add new group keys (GTK/IGTK/BIGTK) on the new link (link_id 4)
74623d901102SJohannes Berg  *  - change_sta_links(0x10) for each affected STA (the AP)
74633d901102SJohannes Berg  *  - assign_vif_chanctx(link_id=4)
74643d901102SJohannes Berg  *  - change_vif_links(0x10)
74653d901102SJohannes Berg  *
74663d901102SJohannes Berg  * Note: This function acquires some mac80211 locks and must not
74673d901102SJohannes Berg  *	 be called with any driver locks held that could cause a
74683d901102SJohannes Berg  *	 lock dependency inversion. Best call it without locks.
74693d901102SJohannes Berg  */
74703d901102SJohannes Berg int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links);
74713d901102SJohannes Berg 
74723d901102SJohannes Berg /**
74733d901102SJohannes Berg  * ieee80211_set_active_links_async - asynchronously set active links
74743d901102SJohannes Berg  * @vif: interface to set active links on
74753d901102SJohannes Berg  * @active_links: the new active links bitmap
74763d901102SJohannes Berg  *
74773d901102SJohannes Berg  * See ieee80211_set_active_links() for more information, the only
74783d901102SJohannes Berg  * difference here is that the link change is triggered async and
74793d901102SJohannes Berg  * can be called in any context, but the link switch will only be
74803d901102SJohannes Berg  * completed after it returns.
74813d901102SJohannes Berg  */
74823d901102SJohannes Berg void ieee80211_set_active_links_async(struct ieee80211_vif *vif,
74833d901102SJohannes Berg 				      u16 active_links);
74843d901102SJohannes Berg 
7485f0706e82SJiri Benc #endif /* MAC80211_H */
7486