162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * mac80211 <-> driver interface
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright 2002-2005, Devicescape Software, Inc.
662306a36Sopenharmony_ci * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
762306a36Sopenharmony_ci * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
862306a36Sopenharmony_ci * Copyright 2013-2014  Intel Mobile Communications GmbH
962306a36Sopenharmony_ci * Copyright (C) 2015 - 2017 Intel Deutschland GmbH
1062306a36Sopenharmony_ci * Copyright (C) 2018 - 2023 Intel Corporation
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifndef MAC80211_H
1462306a36Sopenharmony_ci#define MAC80211_H
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#include <linux/bug.h>
1762306a36Sopenharmony_ci#include <linux/kernel.h>
1862306a36Sopenharmony_ci#include <linux/if_ether.h>
1962306a36Sopenharmony_ci#include <linux/skbuff.h>
2062306a36Sopenharmony_ci#include <linux/ieee80211.h>
2162306a36Sopenharmony_ci#include <linux/lockdep.h>
2262306a36Sopenharmony_ci#include <net/cfg80211.h>
2362306a36Sopenharmony_ci#include <net/codel.h>
2462306a36Sopenharmony_ci#include <net/ieee80211_radiotap.h>
2562306a36Sopenharmony_ci#include <asm/unaligned.h>
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci/**
2862306a36Sopenharmony_ci * DOC: Introduction
2962306a36Sopenharmony_ci *
3062306a36Sopenharmony_ci * mac80211 is the Linux stack for 802.11 hardware that implements
3162306a36Sopenharmony_ci * only partial functionality in hard- or firmware. This document
3262306a36Sopenharmony_ci * defines the interface between mac80211 and low-level hardware
3362306a36Sopenharmony_ci * drivers.
3462306a36Sopenharmony_ci */
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci/**
3762306a36Sopenharmony_ci * DOC: Calling mac80211 from interrupts
3862306a36Sopenharmony_ci *
3962306a36Sopenharmony_ci * Only ieee80211_tx_status_irqsafe() and ieee80211_rx_irqsafe() can be
4062306a36Sopenharmony_ci * called in hardware interrupt context. The low-level driver must not call any
4162306a36Sopenharmony_ci * other functions in hardware interrupt context. If there is a need for such
4262306a36Sopenharmony_ci * call, the low-level driver should first ACK the interrupt and perform the
4362306a36Sopenharmony_ci * IEEE 802.11 code call after this, e.g. from a scheduled workqueue or even
4462306a36Sopenharmony_ci * tasklet function.
4562306a36Sopenharmony_ci *
4662306a36Sopenharmony_ci * NOTE: If the driver opts to use the _irqsafe() functions, it may not also
4762306a36Sopenharmony_ci *	 use the non-IRQ-safe functions!
4862306a36Sopenharmony_ci */
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/**
5162306a36Sopenharmony_ci * DOC: Warning
5262306a36Sopenharmony_ci *
5362306a36Sopenharmony_ci * If you're reading this document and not the header file itself, it will
5462306a36Sopenharmony_ci * be incomplete because not all documentation has been converted yet.
5562306a36Sopenharmony_ci */
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/**
5862306a36Sopenharmony_ci * DOC: Frame format
5962306a36Sopenharmony_ci *
6062306a36Sopenharmony_ci * As a general rule, when frames are passed between mac80211 and the driver,
6162306a36Sopenharmony_ci * they start with the IEEE 802.11 header and include the same octets that are
6262306a36Sopenharmony_ci * sent over the air except for the FCS which should be calculated by the
6362306a36Sopenharmony_ci * hardware.
6462306a36Sopenharmony_ci *
6562306a36Sopenharmony_ci * There are, however, various exceptions to this rule for advanced features:
6662306a36Sopenharmony_ci *
6762306a36Sopenharmony_ci * The first exception is for hardware encryption and decryption offload
6862306a36Sopenharmony_ci * where the IV/ICV may or may not be generated in hardware.
6962306a36Sopenharmony_ci *
7062306a36Sopenharmony_ci * Secondly, when the hardware handles fragmentation, the frame handed to
7162306a36Sopenharmony_ci * the driver from mac80211 is the MSDU, not the MPDU.
7262306a36Sopenharmony_ci */
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/**
7562306a36Sopenharmony_ci * DOC: mac80211 workqueue
7662306a36Sopenharmony_ci *
7762306a36Sopenharmony_ci * mac80211 provides its own workqueue for drivers and internal mac80211 use.
7862306a36Sopenharmony_ci * The workqueue is a single threaded workqueue and can only be accessed by
7962306a36Sopenharmony_ci * helpers for sanity checking. Drivers must ensure all work added onto the
8062306a36Sopenharmony_ci * mac80211 workqueue should be cancelled on the driver stop() callback.
8162306a36Sopenharmony_ci *
8262306a36Sopenharmony_ci * mac80211 will flushed the workqueue upon interface removal and during
8362306a36Sopenharmony_ci * suspend.
8462306a36Sopenharmony_ci *
8562306a36Sopenharmony_ci * All work performed on the mac80211 workqueue must not acquire the RTNL lock.
8662306a36Sopenharmony_ci *
8762306a36Sopenharmony_ci */
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/**
9062306a36Sopenharmony_ci * DOC: mac80211 software tx queueing
9162306a36Sopenharmony_ci *
9262306a36Sopenharmony_ci * mac80211 uses an intermediate queueing implementation, designed to allow the
9362306a36Sopenharmony_ci * driver to keep hardware queues short and to provide some fairness between
9462306a36Sopenharmony_ci * different stations/interfaces.
9562306a36Sopenharmony_ci *
9662306a36Sopenharmony_ci * Drivers must provide the .wake_tx_queue driver operation by either
9762306a36Sopenharmony_ci * linking it to ieee80211_handle_wake_tx_queue() or implementing a custom
9862306a36Sopenharmony_ci * handler.
9962306a36Sopenharmony_ci *
10062306a36Sopenharmony_ci * Intermediate queues (struct ieee80211_txq) are kept per-sta per-tid, with
10162306a36Sopenharmony_ci * another per-sta for non-data/non-mgmt and bufferable management frames, and
10262306a36Sopenharmony_ci * a single per-vif queue for multicast data frames.
10362306a36Sopenharmony_ci *
10462306a36Sopenharmony_ci * The driver is expected to initialize its private per-queue data for stations
10562306a36Sopenharmony_ci * and interfaces in the .add_interface and .sta_add ops.
10662306a36Sopenharmony_ci *
10762306a36Sopenharmony_ci * The driver can't access the internal TX queues (iTXQs) directly.
10862306a36Sopenharmony_ci * Whenever mac80211 adds a new frame to a queue, it calls the .wake_tx_queue
10962306a36Sopenharmony_ci * driver op.
11062306a36Sopenharmony_ci * Drivers implementing a custom .wake_tx_queue op can get them by calling
11162306a36Sopenharmony_ci * ieee80211_tx_dequeue(). Drivers using ieee80211_handle_wake_tx_queue() will
11262306a36Sopenharmony_ci * simply get the individual frames pushed via the .tx driver operation.
11362306a36Sopenharmony_ci *
11462306a36Sopenharmony_ci * Drivers can optionally delegate responsibility for scheduling queues to
11562306a36Sopenharmony_ci * mac80211, to take advantage of airtime fairness accounting. In this case, to
11662306a36Sopenharmony_ci * obtain the next queue to pull frames from, the driver calls
11762306a36Sopenharmony_ci * ieee80211_next_txq(). The driver is then expected to return the txq using
11862306a36Sopenharmony_ci * ieee80211_return_txq().
11962306a36Sopenharmony_ci *
12062306a36Sopenharmony_ci * For AP powersave TIM handling, the driver only needs to indicate if it has
12162306a36Sopenharmony_ci * buffered packets in the driver specific data structures by calling
12262306a36Sopenharmony_ci * ieee80211_sta_set_buffered(). For frames buffered in the ieee80211_txq
12362306a36Sopenharmony_ci * struct, mac80211 sets the appropriate TIM PVB bits and calls
12462306a36Sopenharmony_ci * .release_buffered_frames().
12562306a36Sopenharmony_ci * In that callback the driver is therefore expected to release its own
12662306a36Sopenharmony_ci * buffered frames and afterwards also frames from the ieee80211_txq (obtained
12762306a36Sopenharmony_ci * via the usual ieee80211_tx_dequeue).
12862306a36Sopenharmony_ci */
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci/**
13162306a36Sopenharmony_ci * DOC: HW timestamping
13262306a36Sopenharmony_ci *
13362306a36Sopenharmony_ci * Timing Measurement and Fine Timing Measurement require accurate timestamps
13462306a36Sopenharmony_ci * of the action frames TX/RX and their respective acks.
13562306a36Sopenharmony_ci *
13662306a36Sopenharmony_ci * To report hardware timestamps for Timing Measurement or Fine Timing
13762306a36Sopenharmony_ci * Measurement frame RX, the low level driver should set the SKB's hwtstamp
13862306a36Sopenharmony_ci * field to the frame RX timestamp and report the ack TX timestamp in the
13962306a36Sopenharmony_ci * ieee80211_rx_status struct.
14062306a36Sopenharmony_ci *
14162306a36Sopenharmony_ci * Similarly, To report hardware timestamps for Timing Measurement or Fine
14262306a36Sopenharmony_ci * Timing Measurement frame TX, the driver should set the SKB's hwtstamp field
14362306a36Sopenharmony_ci * to the frame TX timestamp and report the ack RX timestamp in the
14462306a36Sopenharmony_ci * ieee80211_tx_status struct.
14562306a36Sopenharmony_ci */
14662306a36Sopenharmony_cistruct device;
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci/**
14962306a36Sopenharmony_ci * enum ieee80211_max_queues - maximum number of queues
15062306a36Sopenharmony_ci *
15162306a36Sopenharmony_ci * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues.
15262306a36Sopenharmony_ci * @IEEE80211_MAX_QUEUE_MAP: bitmap with maximum queues set
15362306a36Sopenharmony_ci */
15462306a36Sopenharmony_cienum ieee80211_max_queues {
15562306a36Sopenharmony_ci	IEEE80211_MAX_QUEUES =		16,
15662306a36Sopenharmony_ci	IEEE80211_MAX_QUEUE_MAP =	BIT(IEEE80211_MAX_QUEUES) - 1,
15762306a36Sopenharmony_ci};
15862306a36Sopenharmony_ci
15962306a36Sopenharmony_ci#define IEEE80211_INVAL_HW_QUEUE	0xff
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci/**
16262306a36Sopenharmony_ci * enum ieee80211_ac_numbers - AC numbers as used in mac80211
16362306a36Sopenharmony_ci * @IEEE80211_AC_VO: voice
16462306a36Sopenharmony_ci * @IEEE80211_AC_VI: video
16562306a36Sopenharmony_ci * @IEEE80211_AC_BE: best effort
16662306a36Sopenharmony_ci * @IEEE80211_AC_BK: background
16762306a36Sopenharmony_ci */
16862306a36Sopenharmony_cienum ieee80211_ac_numbers {
16962306a36Sopenharmony_ci	IEEE80211_AC_VO		= 0,
17062306a36Sopenharmony_ci	IEEE80211_AC_VI		= 1,
17162306a36Sopenharmony_ci	IEEE80211_AC_BE		= 2,
17262306a36Sopenharmony_ci	IEEE80211_AC_BK		= 3,
17362306a36Sopenharmony_ci};
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci/**
17662306a36Sopenharmony_ci * struct ieee80211_tx_queue_params - transmit queue configuration
17762306a36Sopenharmony_ci *
17862306a36Sopenharmony_ci * The information provided in this structure is required for QoS
17962306a36Sopenharmony_ci * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
18062306a36Sopenharmony_ci *
18162306a36Sopenharmony_ci * @aifs: arbitration interframe space [0..255]
18262306a36Sopenharmony_ci * @cw_min: minimum contention window [a value of the form
18362306a36Sopenharmony_ci *	2^n-1 in the range 1..32767]
18462306a36Sopenharmony_ci * @cw_max: maximum contention window [like @cw_min]
18562306a36Sopenharmony_ci * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
18662306a36Sopenharmony_ci * @acm: is mandatory admission control required for the access category
18762306a36Sopenharmony_ci * @uapsd: is U-APSD mode enabled for the queue
18862306a36Sopenharmony_ci * @mu_edca: is the MU EDCA configured
18962306a36Sopenharmony_ci * @mu_edca_param_rec: MU EDCA Parameter Record for HE
19062306a36Sopenharmony_ci */
19162306a36Sopenharmony_cistruct ieee80211_tx_queue_params {
19262306a36Sopenharmony_ci	u16 txop;
19362306a36Sopenharmony_ci	u16 cw_min;
19462306a36Sopenharmony_ci	u16 cw_max;
19562306a36Sopenharmony_ci	u8 aifs;
19662306a36Sopenharmony_ci	bool acm;
19762306a36Sopenharmony_ci	bool uapsd;
19862306a36Sopenharmony_ci	bool mu_edca;
19962306a36Sopenharmony_ci	struct ieee80211_he_mu_edca_param_ac_rec mu_edca_param_rec;
20062306a36Sopenharmony_ci};
20162306a36Sopenharmony_ci
20262306a36Sopenharmony_cistruct ieee80211_low_level_stats {
20362306a36Sopenharmony_ci	unsigned int dot11ACKFailureCount;
20462306a36Sopenharmony_ci	unsigned int dot11RTSFailureCount;
20562306a36Sopenharmony_ci	unsigned int dot11FCSErrorCount;
20662306a36Sopenharmony_ci	unsigned int dot11RTSSuccessCount;
20762306a36Sopenharmony_ci};
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci/**
21062306a36Sopenharmony_ci * enum ieee80211_chanctx_change - change flag for channel context
21162306a36Sopenharmony_ci * @IEEE80211_CHANCTX_CHANGE_WIDTH: The channel width changed
21262306a36Sopenharmony_ci * @IEEE80211_CHANCTX_CHANGE_RX_CHAINS: The number of RX chains changed
21362306a36Sopenharmony_ci * @IEEE80211_CHANCTX_CHANGE_RADAR: radar detection flag changed
21462306a36Sopenharmony_ci * @IEEE80211_CHANCTX_CHANGE_CHANNEL: switched to another operating channel,
21562306a36Sopenharmony_ci *	this is used only with channel switching with CSA
21662306a36Sopenharmony_ci * @IEEE80211_CHANCTX_CHANGE_MIN_WIDTH: The min required channel width changed
21762306a36Sopenharmony_ci */
21862306a36Sopenharmony_cienum ieee80211_chanctx_change {
21962306a36Sopenharmony_ci	IEEE80211_CHANCTX_CHANGE_WIDTH		= BIT(0),
22062306a36Sopenharmony_ci	IEEE80211_CHANCTX_CHANGE_RX_CHAINS	= BIT(1),
22162306a36Sopenharmony_ci	IEEE80211_CHANCTX_CHANGE_RADAR		= BIT(2),
22262306a36Sopenharmony_ci	IEEE80211_CHANCTX_CHANGE_CHANNEL	= BIT(3),
22362306a36Sopenharmony_ci	IEEE80211_CHANCTX_CHANGE_MIN_WIDTH	= BIT(4),
22462306a36Sopenharmony_ci};
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci/**
22762306a36Sopenharmony_ci * struct ieee80211_chanctx_conf - channel context that vifs may be tuned to
22862306a36Sopenharmony_ci *
22962306a36Sopenharmony_ci * This is the driver-visible part. The ieee80211_chanctx
23062306a36Sopenharmony_ci * that contains it is visible in mac80211 only.
23162306a36Sopenharmony_ci *
23262306a36Sopenharmony_ci * @def: the channel definition
23362306a36Sopenharmony_ci * @min_def: the minimum channel definition currently required.
23462306a36Sopenharmony_ci * @rx_chains_static: The number of RX chains that must always be
23562306a36Sopenharmony_ci *	active on the channel to receive MIMO transmissions
23662306a36Sopenharmony_ci * @rx_chains_dynamic: The number of RX chains that must be enabled
23762306a36Sopenharmony_ci *	after RTS/CTS handshake to receive SMPS MIMO transmissions;
23862306a36Sopenharmony_ci *	this will always be >= @rx_chains_static.
23962306a36Sopenharmony_ci * @radar_enabled: whether radar detection is enabled on this channel.
24062306a36Sopenharmony_ci * @drv_priv: data area for driver use, will always be aligned to
24162306a36Sopenharmony_ci *	sizeof(void *), size is determined in hw information.
24262306a36Sopenharmony_ci */
24362306a36Sopenharmony_cistruct ieee80211_chanctx_conf {
24462306a36Sopenharmony_ci	struct cfg80211_chan_def def;
24562306a36Sopenharmony_ci	struct cfg80211_chan_def min_def;
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ci	u8 rx_chains_static, rx_chains_dynamic;
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci	bool radar_enabled;
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci	u8 drv_priv[] __aligned(sizeof(void *));
25262306a36Sopenharmony_ci};
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_ci/**
25562306a36Sopenharmony_ci * enum ieee80211_chanctx_switch_mode - channel context switch mode
25662306a36Sopenharmony_ci * @CHANCTX_SWMODE_REASSIGN_VIF: Both old and new contexts already
25762306a36Sopenharmony_ci *	exist (and will continue to exist), but the virtual interface
25862306a36Sopenharmony_ci *	needs to be switched from one to the other.
25962306a36Sopenharmony_ci * @CHANCTX_SWMODE_SWAP_CONTEXTS: The old context exists but will stop
26062306a36Sopenharmony_ci *      to exist with this call, the new context doesn't exist but
26162306a36Sopenharmony_ci *      will be active after this call, the virtual interface switches
26262306a36Sopenharmony_ci *      from the old to the new (note that the driver may of course
26362306a36Sopenharmony_ci *      implement this as an on-the-fly chandef switch of the existing
26462306a36Sopenharmony_ci *      hardware context, but the mac80211 pointer for the old context
26562306a36Sopenharmony_ci *      will cease to exist and only the new one will later be used
26662306a36Sopenharmony_ci *      for changes/removal.)
26762306a36Sopenharmony_ci */
26862306a36Sopenharmony_cienum ieee80211_chanctx_switch_mode {
26962306a36Sopenharmony_ci	CHANCTX_SWMODE_REASSIGN_VIF,
27062306a36Sopenharmony_ci	CHANCTX_SWMODE_SWAP_CONTEXTS,
27162306a36Sopenharmony_ci};
27262306a36Sopenharmony_ci
27362306a36Sopenharmony_ci/**
27462306a36Sopenharmony_ci * struct ieee80211_vif_chanctx_switch - vif chanctx switch information
27562306a36Sopenharmony_ci *
27662306a36Sopenharmony_ci * This is structure is used to pass information about a vif that
27762306a36Sopenharmony_ci * needs to switch from one chanctx to another.  The
27862306a36Sopenharmony_ci * &ieee80211_chanctx_switch_mode defines how the switch should be
27962306a36Sopenharmony_ci * done.
28062306a36Sopenharmony_ci *
28162306a36Sopenharmony_ci * @vif: the vif that should be switched from old_ctx to new_ctx
28262306a36Sopenharmony_ci * @link_conf: the link conf that's switching
28362306a36Sopenharmony_ci * @old_ctx: the old context to which the vif was assigned
28462306a36Sopenharmony_ci * @new_ctx: the new context to which the vif must be assigned
28562306a36Sopenharmony_ci */
28662306a36Sopenharmony_cistruct ieee80211_vif_chanctx_switch {
28762306a36Sopenharmony_ci	struct ieee80211_vif *vif;
28862306a36Sopenharmony_ci	struct ieee80211_bss_conf *link_conf;
28962306a36Sopenharmony_ci	struct ieee80211_chanctx_conf *old_ctx;
29062306a36Sopenharmony_ci	struct ieee80211_chanctx_conf *new_ctx;
29162306a36Sopenharmony_ci};
29262306a36Sopenharmony_ci
29362306a36Sopenharmony_ci/**
29462306a36Sopenharmony_ci * enum ieee80211_bss_change - BSS change notification flags
29562306a36Sopenharmony_ci *
29662306a36Sopenharmony_ci * These flags are used with the bss_info_changed(), link_info_changed()
29762306a36Sopenharmony_ci * and vif_cfg_changed() callbacks to indicate which parameter(s) changed.
29862306a36Sopenharmony_ci *
29962306a36Sopenharmony_ci * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated),
30062306a36Sopenharmony_ci *	also implies a change in the AID.
30162306a36Sopenharmony_ci * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed
30262306a36Sopenharmony_ci * @BSS_CHANGED_ERP_PREAMBLE: preamble changed
30362306a36Sopenharmony_ci * @BSS_CHANGED_ERP_SLOT: slot timing changed
30462306a36Sopenharmony_ci * @BSS_CHANGED_HT: 802.11n parameters changed
30562306a36Sopenharmony_ci * @BSS_CHANGED_BASIC_RATES: Basic rateset changed
30662306a36Sopenharmony_ci * @BSS_CHANGED_BEACON_INT: Beacon interval changed
30762306a36Sopenharmony_ci * @BSS_CHANGED_BSSID: BSSID changed, for whatever
30862306a36Sopenharmony_ci *	reason (IBSS and managed mode)
30962306a36Sopenharmony_ci * @BSS_CHANGED_BEACON: Beacon data changed, retrieve
31062306a36Sopenharmony_ci *	new beacon (beaconing modes)
31162306a36Sopenharmony_ci * @BSS_CHANGED_BEACON_ENABLED: Beaconing should be
31262306a36Sopenharmony_ci *	enabled/disabled (beaconing modes)
31362306a36Sopenharmony_ci * @BSS_CHANGED_CQM: Connection quality monitor config changed
31462306a36Sopenharmony_ci * @BSS_CHANGED_IBSS: IBSS join status changed
31562306a36Sopenharmony_ci * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed.
31662306a36Sopenharmony_ci * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note
31762306a36Sopenharmony_ci *	that it is only ever disabled for station mode.
31862306a36Sopenharmony_ci * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface.
31962306a36Sopenharmony_ci * @BSS_CHANGED_SSID: SSID changed for this BSS (AP and IBSS mode)
32062306a36Sopenharmony_ci * @BSS_CHANGED_AP_PROBE_RESP: Probe Response changed for this BSS (AP mode)
32162306a36Sopenharmony_ci * @BSS_CHANGED_PS: PS changed for this BSS (STA mode)
32262306a36Sopenharmony_ci * @BSS_CHANGED_TXPOWER: TX power setting changed for this interface
32362306a36Sopenharmony_ci * @BSS_CHANGED_P2P_PS: P2P powersave settings (CTWindow, opportunistic PS)
32462306a36Sopenharmony_ci *	changed
32562306a36Sopenharmony_ci * @BSS_CHANGED_BEACON_INFO: Data from the AP's beacon became available:
32662306a36Sopenharmony_ci *	currently dtim_period only is under consideration.
32762306a36Sopenharmony_ci * @BSS_CHANGED_BANDWIDTH: The bandwidth used by this interface changed,
32862306a36Sopenharmony_ci *	note that this is only called when it changes after the channel
32962306a36Sopenharmony_ci *	context had been assigned.
33062306a36Sopenharmony_ci * @BSS_CHANGED_OCB: OCB join status changed
33162306a36Sopenharmony_ci * @BSS_CHANGED_MU_GROUPS: VHT MU-MIMO group id or user position changed
33262306a36Sopenharmony_ci * @BSS_CHANGED_KEEP_ALIVE: keep alive options (idle period or protected
33362306a36Sopenharmony_ci *	keep alive) changed.
33462306a36Sopenharmony_ci * @BSS_CHANGED_MCAST_RATE: Multicast Rate setting changed for this interface
33562306a36Sopenharmony_ci * @BSS_CHANGED_FTM_RESPONDER: fine timing measurement request responder
33662306a36Sopenharmony_ci *	functionality changed for this BSS (AP mode).
33762306a36Sopenharmony_ci * @BSS_CHANGED_TWT: TWT status changed
33862306a36Sopenharmony_ci * @BSS_CHANGED_HE_OBSS_PD: OBSS Packet Detection status changed.
33962306a36Sopenharmony_ci * @BSS_CHANGED_HE_BSS_COLOR: BSS Color has changed
34062306a36Sopenharmony_ci * @BSS_CHANGED_FILS_DISCOVERY: FILS discovery status changed.
34162306a36Sopenharmony_ci * @BSS_CHANGED_UNSOL_BCAST_PROBE_RESP: Unsolicited broadcast probe response
34262306a36Sopenharmony_ci *	status changed.
34362306a36Sopenharmony_ci * @BSS_CHANGED_EHT_PUNCTURING: The channel puncturing bitmap changed.
34462306a36Sopenharmony_ci */
34562306a36Sopenharmony_cienum ieee80211_bss_change {
34662306a36Sopenharmony_ci	BSS_CHANGED_ASSOC		= 1<<0,
34762306a36Sopenharmony_ci	BSS_CHANGED_ERP_CTS_PROT	= 1<<1,
34862306a36Sopenharmony_ci	BSS_CHANGED_ERP_PREAMBLE	= 1<<2,
34962306a36Sopenharmony_ci	BSS_CHANGED_ERP_SLOT		= 1<<3,
35062306a36Sopenharmony_ci	BSS_CHANGED_HT			= 1<<4,
35162306a36Sopenharmony_ci	BSS_CHANGED_BASIC_RATES		= 1<<5,
35262306a36Sopenharmony_ci	BSS_CHANGED_BEACON_INT		= 1<<6,
35362306a36Sopenharmony_ci	BSS_CHANGED_BSSID		= 1<<7,
35462306a36Sopenharmony_ci	BSS_CHANGED_BEACON		= 1<<8,
35562306a36Sopenharmony_ci	BSS_CHANGED_BEACON_ENABLED	= 1<<9,
35662306a36Sopenharmony_ci	BSS_CHANGED_CQM			= 1<<10,
35762306a36Sopenharmony_ci	BSS_CHANGED_IBSS		= 1<<11,
35862306a36Sopenharmony_ci	BSS_CHANGED_ARP_FILTER		= 1<<12,
35962306a36Sopenharmony_ci	BSS_CHANGED_QOS			= 1<<13,
36062306a36Sopenharmony_ci	BSS_CHANGED_IDLE		= 1<<14,
36162306a36Sopenharmony_ci	BSS_CHANGED_SSID		= 1<<15,
36262306a36Sopenharmony_ci	BSS_CHANGED_AP_PROBE_RESP	= 1<<16,
36362306a36Sopenharmony_ci	BSS_CHANGED_PS			= 1<<17,
36462306a36Sopenharmony_ci	BSS_CHANGED_TXPOWER		= 1<<18,
36562306a36Sopenharmony_ci	BSS_CHANGED_P2P_PS		= 1<<19,
36662306a36Sopenharmony_ci	BSS_CHANGED_BEACON_INFO		= 1<<20,
36762306a36Sopenharmony_ci	BSS_CHANGED_BANDWIDTH		= 1<<21,
36862306a36Sopenharmony_ci	BSS_CHANGED_OCB                 = 1<<22,
36962306a36Sopenharmony_ci	BSS_CHANGED_MU_GROUPS		= 1<<23,
37062306a36Sopenharmony_ci	BSS_CHANGED_KEEP_ALIVE		= 1<<24,
37162306a36Sopenharmony_ci	BSS_CHANGED_MCAST_RATE		= 1<<25,
37262306a36Sopenharmony_ci	BSS_CHANGED_FTM_RESPONDER	= 1<<26,
37362306a36Sopenharmony_ci	BSS_CHANGED_TWT			= 1<<27,
37462306a36Sopenharmony_ci	BSS_CHANGED_HE_OBSS_PD		= 1<<28,
37562306a36Sopenharmony_ci	BSS_CHANGED_HE_BSS_COLOR	= 1<<29,
37662306a36Sopenharmony_ci	BSS_CHANGED_FILS_DISCOVERY      = 1<<30,
37762306a36Sopenharmony_ci	BSS_CHANGED_UNSOL_BCAST_PROBE_RESP = 1<<31,
37862306a36Sopenharmony_ci	BSS_CHANGED_EHT_PUNCTURING	= BIT_ULL(32),
37962306a36Sopenharmony_ci
38062306a36Sopenharmony_ci	/* when adding here, make sure to change ieee80211_reconfig */
38162306a36Sopenharmony_ci};
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ci/*
38462306a36Sopenharmony_ci * The maximum number of IPv4 addresses listed for ARP filtering. If the number
38562306a36Sopenharmony_ci * of addresses for an interface increase beyond this value, hardware ARP
38662306a36Sopenharmony_ci * filtering will be disabled.
38762306a36Sopenharmony_ci */
38862306a36Sopenharmony_ci#define IEEE80211_BSS_ARP_ADDR_LIST_LEN 4
38962306a36Sopenharmony_ci
39062306a36Sopenharmony_ci/**
39162306a36Sopenharmony_ci * enum ieee80211_event_type - event to be notified to the low level driver
39262306a36Sopenharmony_ci * @RSSI_EVENT: AP's rssi crossed the a threshold set by the driver.
39362306a36Sopenharmony_ci * @MLME_EVENT: event related to MLME
39462306a36Sopenharmony_ci * @BAR_RX_EVENT: a BAR was received
39562306a36Sopenharmony_ci * @BA_FRAME_TIMEOUT: Frames were released from the reordering buffer because
39662306a36Sopenharmony_ci *	they timed out. This won't be called for each frame released, but only
39762306a36Sopenharmony_ci *	once each time the timeout triggers.
39862306a36Sopenharmony_ci */
39962306a36Sopenharmony_cienum ieee80211_event_type {
40062306a36Sopenharmony_ci	RSSI_EVENT,
40162306a36Sopenharmony_ci	MLME_EVENT,
40262306a36Sopenharmony_ci	BAR_RX_EVENT,
40362306a36Sopenharmony_ci	BA_FRAME_TIMEOUT,
40462306a36Sopenharmony_ci};
40562306a36Sopenharmony_ci
40662306a36Sopenharmony_ci/**
40762306a36Sopenharmony_ci * enum ieee80211_rssi_event_data - relevant when event type is %RSSI_EVENT
40862306a36Sopenharmony_ci * @RSSI_EVENT_HIGH: AP's rssi went below the threshold set by the driver.
40962306a36Sopenharmony_ci * @RSSI_EVENT_LOW: AP's rssi went above the threshold set by the driver.
41062306a36Sopenharmony_ci */
41162306a36Sopenharmony_cienum ieee80211_rssi_event_data {
41262306a36Sopenharmony_ci	RSSI_EVENT_HIGH,
41362306a36Sopenharmony_ci	RSSI_EVENT_LOW,
41462306a36Sopenharmony_ci};
41562306a36Sopenharmony_ci
41662306a36Sopenharmony_ci/**
41762306a36Sopenharmony_ci * struct ieee80211_rssi_event - data attached to an %RSSI_EVENT
41862306a36Sopenharmony_ci * @data: See &enum ieee80211_rssi_event_data
41962306a36Sopenharmony_ci */
42062306a36Sopenharmony_cistruct ieee80211_rssi_event {
42162306a36Sopenharmony_ci	enum ieee80211_rssi_event_data data;
42262306a36Sopenharmony_ci};
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci/**
42562306a36Sopenharmony_ci * enum ieee80211_mlme_event_data - relevant when event type is %MLME_EVENT
42662306a36Sopenharmony_ci * @AUTH_EVENT: the MLME operation is authentication
42762306a36Sopenharmony_ci * @ASSOC_EVENT: the MLME operation is association
42862306a36Sopenharmony_ci * @DEAUTH_RX_EVENT: deauth received..
42962306a36Sopenharmony_ci * @DEAUTH_TX_EVENT: deauth sent.
43062306a36Sopenharmony_ci */
43162306a36Sopenharmony_cienum ieee80211_mlme_event_data {
43262306a36Sopenharmony_ci	AUTH_EVENT,
43362306a36Sopenharmony_ci	ASSOC_EVENT,
43462306a36Sopenharmony_ci	DEAUTH_RX_EVENT,
43562306a36Sopenharmony_ci	DEAUTH_TX_EVENT,
43662306a36Sopenharmony_ci};
43762306a36Sopenharmony_ci
43862306a36Sopenharmony_ci/**
43962306a36Sopenharmony_ci * enum ieee80211_mlme_event_status - relevant when event type is %MLME_EVENT
44062306a36Sopenharmony_ci * @MLME_SUCCESS: the MLME operation completed successfully.
44162306a36Sopenharmony_ci * @MLME_DENIED: the MLME operation was denied by the peer.
44262306a36Sopenharmony_ci * @MLME_TIMEOUT: the MLME operation timed out.
44362306a36Sopenharmony_ci */
44462306a36Sopenharmony_cienum ieee80211_mlme_event_status {
44562306a36Sopenharmony_ci	MLME_SUCCESS,
44662306a36Sopenharmony_ci	MLME_DENIED,
44762306a36Sopenharmony_ci	MLME_TIMEOUT,
44862306a36Sopenharmony_ci};
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci/**
45162306a36Sopenharmony_ci * struct ieee80211_mlme_event - data attached to an %MLME_EVENT
45262306a36Sopenharmony_ci * @data: See &enum ieee80211_mlme_event_data
45362306a36Sopenharmony_ci * @status: See &enum ieee80211_mlme_event_status
45462306a36Sopenharmony_ci * @reason: the reason code if applicable
45562306a36Sopenharmony_ci */
45662306a36Sopenharmony_cistruct ieee80211_mlme_event {
45762306a36Sopenharmony_ci	enum ieee80211_mlme_event_data data;
45862306a36Sopenharmony_ci	enum ieee80211_mlme_event_status status;
45962306a36Sopenharmony_ci	u16 reason;
46062306a36Sopenharmony_ci};
46162306a36Sopenharmony_ci
46262306a36Sopenharmony_ci/**
46362306a36Sopenharmony_ci * struct ieee80211_ba_event - data attached for BlockAck related events
46462306a36Sopenharmony_ci * @sta: pointer to the &ieee80211_sta to which this event relates
46562306a36Sopenharmony_ci * @tid: the tid
46662306a36Sopenharmony_ci * @ssn: the starting sequence number (for %BAR_RX_EVENT)
46762306a36Sopenharmony_ci */
46862306a36Sopenharmony_cistruct ieee80211_ba_event {
46962306a36Sopenharmony_ci	struct ieee80211_sta *sta;
47062306a36Sopenharmony_ci	u16 tid;
47162306a36Sopenharmony_ci	u16 ssn;
47262306a36Sopenharmony_ci};
47362306a36Sopenharmony_ci
47462306a36Sopenharmony_ci/**
47562306a36Sopenharmony_ci * struct ieee80211_event - event to be sent to the driver
47662306a36Sopenharmony_ci * @type: The event itself. See &enum ieee80211_event_type.
47762306a36Sopenharmony_ci * @rssi: relevant if &type is %RSSI_EVENT
47862306a36Sopenharmony_ci * @mlme: relevant if &type is %AUTH_EVENT
47962306a36Sopenharmony_ci * @ba: relevant if &type is %BAR_RX_EVENT or %BA_FRAME_TIMEOUT
48062306a36Sopenharmony_ci * @u:union holding the fields above
48162306a36Sopenharmony_ci */
48262306a36Sopenharmony_cistruct ieee80211_event {
48362306a36Sopenharmony_ci	enum ieee80211_event_type type;
48462306a36Sopenharmony_ci	union {
48562306a36Sopenharmony_ci		struct ieee80211_rssi_event rssi;
48662306a36Sopenharmony_ci		struct ieee80211_mlme_event mlme;
48762306a36Sopenharmony_ci		struct ieee80211_ba_event ba;
48862306a36Sopenharmony_ci	} u;
48962306a36Sopenharmony_ci};
49062306a36Sopenharmony_ci
49162306a36Sopenharmony_ci/**
49262306a36Sopenharmony_ci * struct ieee80211_mu_group_data - STA's VHT MU-MIMO group data
49362306a36Sopenharmony_ci *
49462306a36Sopenharmony_ci * This structure describes the group id data of VHT MU-MIMO
49562306a36Sopenharmony_ci *
49662306a36Sopenharmony_ci * @membership: 64 bits array - a bit is set if station is member of the group
49762306a36Sopenharmony_ci * @position: 2 bits per group id indicating the position in the group
49862306a36Sopenharmony_ci */
49962306a36Sopenharmony_cistruct ieee80211_mu_group_data {
50062306a36Sopenharmony_ci	u8 membership[WLAN_MEMBERSHIP_LEN];
50162306a36Sopenharmony_ci	u8 position[WLAN_USER_POSITION_LEN];
50262306a36Sopenharmony_ci};
50362306a36Sopenharmony_ci
50462306a36Sopenharmony_ci/**
50562306a36Sopenharmony_ci * struct ieee80211_ftm_responder_params - FTM responder parameters
50662306a36Sopenharmony_ci *
50762306a36Sopenharmony_ci * @lci: LCI subelement content
50862306a36Sopenharmony_ci * @civicloc: CIVIC location subelement content
50962306a36Sopenharmony_ci * @lci_len: LCI data length
51062306a36Sopenharmony_ci * @civicloc_len: Civic data length
51162306a36Sopenharmony_ci */
51262306a36Sopenharmony_cistruct ieee80211_ftm_responder_params {
51362306a36Sopenharmony_ci	const u8 *lci;
51462306a36Sopenharmony_ci	const u8 *civicloc;
51562306a36Sopenharmony_ci	size_t lci_len;
51662306a36Sopenharmony_ci	size_t civicloc_len;
51762306a36Sopenharmony_ci};
51862306a36Sopenharmony_ci
51962306a36Sopenharmony_ci/**
52062306a36Sopenharmony_ci * struct ieee80211_fils_discovery - FILS discovery parameters from
52162306a36Sopenharmony_ci * IEEE Std 802.11ai-2016, Annex C.3 MIB detail.
52262306a36Sopenharmony_ci *
52362306a36Sopenharmony_ci * @min_interval: Minimum packet interval in TUs (0 - 10000)
52462306a36Sopenharmony_ci * @max_interval: Maximum packet interval in TUs (0 - 10000)
52562306a36Sopenharmony_ci */
52662306a36Sopenharmony_cistruct ieee80211_fils_discovery {
52762306a36Sopenharmony_ci	u32 min_interval;
52862306a36Sopenharmony_ci	u32 max_interval;
52962306a36Sopenharmony_ci};
53062306a36Sopenharmony_ci
53162306a36Sopenharmony_ci/**
53262306a36Sopenharmony_ci * struct ieee80211_bss_conf - holds the BSS's changing parameters
53362306a36Sopenharmony_ci *
53462306a36Sopenharmony_ci * This structure keeps information about a BSS (and an association
53562306a36Sopenharmony_ci * to that BSS) that can change during the lifetime of the BSS.
53662306a36Sopenharmony_ci *
53762306a36Sopenharmony_ci * @vif: reference to owning VIF
53862306a36Sopenharmony_ci * @addr: (link) address used locally
53962306a36Sopenharmony_ci * @link_id: link ID, or 0 for non-MLO
54062306a36Sopenharmony_ci * @htc_trig_based_pkt_ext: default PE in 4us units, if BSS supports HE
54162306a36Sopenharmony_ci * @uora_exists: is the UORA element advertised by AP
54262306a36Sopenharmony_ci * @ack_enabled: indicates support to receive a multi-TID that solicits either
54362306a36Sopenharmony_ci *	ACK, BACK or both
54462306a36Sopenharmony_ci * @uora_ocw_range: UORA element's OCW Range field
54562306a36Sopenharmony_ci * @frame_time_rts_th: HE duration RTS threshold, in units of 32us
54662306a36Sopenharmony_ci * @he_support: does this BSS support HE
54762306a36Sopenharmony_ci * @twt_requester: does this BSS support TWT requester (relevant for managed
54862306a36Sopenharmony_ci *	mode only, set if the AP advertises TWT responder role)
54962306a36Sopenharmony_ci * @twt_responder: does this BSS support TWT requester (relevant for managed
55062306a36Sopenharmony_ci *	mode only, set if the AP advertises TWT responder role)
55162306a36Sopenharmony_ci * @twt_protected: does this BSS support protected TWT frames
55262306a36Sopenharmony_ci * @twt_broadcast: does this BSS support broadcast TWT
55362306a36Sopenharmony_ci * @use_cts_prot: use CTS protection
55462306a36Sopenharmony_ci * @use_short_preamble: use 802.11b short preamble
55562306a36Sopenharmony_ci * @use_short_slot: use short slot time (only relevant for ERP)
55662306a36Sopenharmony_ci * @dtim_period: num of beacons before the next DTIM, for beaconing,
55762306a36Sopenharmony_ci *	valid in station mode only if after the driver was notified
55862306a36Sopenharmony_ci *	with the %BSS_CHANGED_BEACON_INFO flag, will be non-zero then.
55962306a36Sopenharmony_ci * @sync_tsf: last beacon's/probe response's TSF timestamp (could be old
56062306a36Sopenharmony_ci *	as it may have been received during scanning long ago). If the
56162306a36Sopenharmony_ci *	HW flag %IEEE80211_HW_TIMING_BEACON_ONLY is set, then this can
56262306a36Sopenharmony_ci *	only come from a beacon, but might not become valid until after
56362306a36Sopenharmony_ci *	association when a beacon is received (which is notified with the
56462306a36Sopenharmony_ci *	%BSS_CHANGED_DTIM flag.). See also sync_dtim_count important notice.
56562306a36Sopenharmony_ci * @sync_device_ts: the device timestamp corresponding to the sync_tsf,
56662306a36Sopenharmony_ci *	the driver/device can use this to calculate synchronisation
56762306a36Sopenharmony_ci *	(see @sync_tsf). See also sync_dtim_count important notice.
56862306a36Sopenharmony_ci * @sync_dtim_count: Only valid when %IEEE80211_HW_TIMING_BEACON_ONLY
56962306a36Sopenharmony_ci *	is requested, see @sync_tsf/@sync_device_ts.
57062306a36Sopenharmony_ci *	IMPORTANT: These three sync_* parameters would possibly be out of sync
57162306a36Sopenharmony_ci *	by the time the driver will use them. The synchronized view is currently
57262306a36Sopenharmony_ci *	guaranteed only in certain callbacks.
57362306a36Sopenharmony_ci *	Note also that this is not used with MLD associations, mac80211 doesn't
57462306a36Sopenharmony_ci *	know how to track beacons for all of the links for this.
57562306a36Sopenharmony_ci * @beacon_int: beacon interval
57662306a36Sopenharmony_ci * @assoc_capability: capabilities taken from assoc resp
57762306a36Sopenharmony_ci * @basic_rates: bitmap of basic rates, each bit stands for an
57862306a36Sopenharmony_ci *	index into the rate table configured by the driver in
57962306a36Sopenharmony_ci *	the current band.
58062306a36Sopenharmony_ci * @beacon_rate: associated AP's beacon TX rate
58162306a36Sopenharmony_ci * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
58262306a36Sopenharmony_ci * @bssid: The BSSID for this BSS
58362306a36Sopenharmony_ci * @enable_beacon: whether beaconing should be enabled or not
58462306a36Sopenharmony_ci * @chandef: Channel definition for this BSS -- the hardware might be
58562306a36Sopenharmony_ci *	configured a higher bandwidth than this BSS uses, for example.
58662306a36Sopenharmony_ci * @mu_group: VHT MU-MIMO group membership data
58762306a36Sopenharmony_ci * @ht_operation_mode: HT operation mode like in &struct ieee80211_ht_operation.
58862306a36Sopenharmony_ci *	This field is only valid when the channel is a wide HT/VHT channel.
58962306a36Sopenharmony_ci *	Note that with TDLS this can be the case (channel is HT, protection must
59062306a36Sopenharmony_ci *	be used from this field) even when the BSS association isn't using HT.
59162306a36Sopenharmony_ci * @cqm_rssi_thold: Connection quality monitor RSSI threshold, a zero value
59262306a36Sopenharmony_ci *	implies disabled. As with the cfg80211 callback, a change here should
59362306a36Sopenharmony_ci *	cause an event to be sent indicating where the current value is in
59462306a36Sopenharmony_ci *	relation to the newly configured threshold.
59562306a36Sopenharmony_ci * @cqm_rssi_low: Connection quality monitor RSSI lower threshold, a zero value
59662306a36Sopenharmony_ci *	implies disabled.  This is an alternative mechanism to the single
59762306a36Sopenharmony_ci *	threshold event and can't be enabled simultaneously with it.
59862306a36Sopenharmony_ci * @cqm_rssi_high: Connection quality monitor RSSI upper threshold.
59962306a36Sopenharmony_ci * @cqm_rssi_hyst: Connection quality monitor RSSI hysteresis
60062306a36Sopenharmony_ci * @qos: This is a QoS-enabled BSS.
60162306a36Sopenharmony_ci * @hidden_ssid: The SSID of the current vif is hidden. Only valid in AP-mode.
60262306a36Sopenharmony_ci * @txpower: TX power in dBm.  INT_MIN means not configured.
60362306a36Sopenharmony_ci * @txpower_type: TX power adjustment used to control per packet Transmit
60462306a36Sopenharmony_ci *	Power Control (TPC) in lower driver for the current vif. In particular
60562306a36Sopenharmony_ci *	TPC is enabled if value passed in %txpower_type is
60662306a36Sopenharmony_ci *	NL80211_TX_POWER_LIMITED (allow using less than specified from
60762306a36Sopenharmony_ci *	userspace), whereas TPC is disabled if %txpower_type is set to
60862306a36Sopenharmony_ci *	NL80211_TX_POWER_FIXED (use value configured from userspace)
60962306a36Sopenharmony_ci * @p2p_noa_attr: P2P NoA attribute for P2P powersave
61062306a36Sopenharmony_ci * @allow_p2p_go_ps: indication for AP or P2P GO interface, whether it's allowed
61162306a36Sopenharmony_ci *	to use P2P PS mechanism or not. AP/P2P GO is not allowed to use P2P PS
61262306a36Sopenharmony_ci *	if it has associated clients without P2P PS support.
61362306a36Sopenharmony_ci * @max_idle_period: the time period during which the station can refrain from
61462306a36Sopenharmony_ci *	transmitting frames to its associated AP without being disassociated.
61562306a36Sopenharmony_ci *	In units of 1000 TUs. Zero value indicates that the AP did not include
61662306a36Sopenharmony_ci *	a (valid) BSS Max Idle Period Element.
61762306a36Sopenharmony_ci * @protected_keep_alive: if set, indicates that the station should send an RSN
61862306a36Sopenharmony_ci *	protected frame to the AP to reset the idle timer at the AP for the
61962306a36Sopenharmony_ci *	station.
62062306a36Sopenharmony_ci * @ftm_responder: whether to enable or disable fine timing measurement FTM
62162306a36Sopenharmony_ci *	responder functionality.
62262306a36Sopenharmony_ci * @ftmr_params: configurable lci/civic parameter when enabling FTM responder.
62362306a36Sopenharmony_ci * @nontransmitted: this BSS is a nontransmitted BSS profile
62462306a36Sopenharmony_ci * @transmitter_bssid: the address of transmitter AP
62562306a36Sopenharmony_ci * @bssid_index: index inside the multiple BSSID set
62662306a36Sopenharmony_ci * @bssid_indicator: 2^bssid_indicator is the maximum number of APs in set
62762306a36Sopenharmony_ci * @ema_ap: AP supports enhancements of discovery and advertisement of
62862306a36Sopenharmony_ci *	nontransmitted BSSIDs
62962306a36Sopenharmony_ci * @profile_periodicity: the least number of beacon frames need to be received
63062306a36Sopenharmony_ci *	in order to discover all the nontransmitted BSSIDs in the set.
63162306a36Sopenharmony_ci * @he_oper: HE operation information of the BSS (AP/Mesh) or of the AP we are
63262306a36Sopenharmony_ci *	connected to (STA)
63362306a36Sopenharmony_ci * @he_obss_pd: OBSS Packet Detection parameters.
63462306a36Sopenharmony_ci * @he_bss_color: BSS coloring settings, if BSS supports HE
63562306a36Sopenharmony_ci * @fils_discovery: FILS discovery configuration
63662306a36Sopenharmony_ci * @unsol_bcast_probe_resp_interval: Unsolicited broadcast probe response
63762306a36Sopenharmony_ci *	interval.
63862306a36Sopenharmony_ci * @beacon_tx_rate: The configured beacon transmit rate that needs to be passed
63962306a36Sopenharmony_ci *	to driver when rate control is offloaded to firmware.
64062306a36Sopenharmony_ci * @power_type: power type of BSS for 6 GHz
64162306a36Sopenharmony_ci * @tx_pwr_env: transmit power envelope array of BSS.
64262306a36Sopenharmony_ci * @tx_pwr_env_num: number of @tx_pwr_env.
64362306a36Sopenharmony_ci * @pwr_reduction: power constraint of BSS.
64462306a36Sopenharmony_ci * @eht_support: does this BSS support EHT
64562306a36Sopenharmony_ci * @eht_puncturing: bitmap to indicate which channels are punctured in this BSS
64662306a36Sopenharmony_ci * @csa_active: marks whether a channel switch is going on. Internally it is
64762306a36Sopenharmony_ci *	write-protected by sdata_lock and local->mtx so holding either is fine
64862306a36Sopenharmony_ci *	for read access.
64962306a36Sopenharmony_ci * @csa_punct_bitmap: new puncturing bitmap for channel switch
65062306a36Sopenharmony_ci * @mu_mimo_owner: indicates interface owns MU-MIMO capability
65162306a36Sopenharmony_ci * @chanctx_conf: The channel context this interface is assigned to, or %NULL
65262306a36Sopenharmony_ci *	when it is not assigned. This pointer is RCU-protected due to the TX
65362306a36Sopenharmony_ci *	path needing to access it; even though the netdev carrier will always
65462306a36Sopenharmony_ci *	be off when it is %NULL there can still be races and packets could be
65562306a36Sopenharmony_ci *	processed after it switches back to %NULL.
65662306a36Sopenharmony_ci * @color_change_active: marks whether a color change is ongoing. Internally it is
65762306a36Sopenharmony_ci *	write-protected by sdata_lock and local->mtx so holding either is fine
65862306a36Sopenharmony_ci *	for read access.
65962306a36Sopenharmony_ci * @color_change_color: the bss color that will be used after the change.
66062306a36Sopenharmony_ci * @ht_ldpc: in AP mode, indicates interface has HT LDPC capability.
66162306a36Sopenharmony_ci * @vht_ldpc: in AP mode, indicates interface has VHT LDPC capability.
66262306a36Sopenharmony_ci * @he_ldpc: in AP mode, indicates interface has HE LDPC capability.
66362306a36Sopenharmony_ci * @vht_su_beamformer: in AP mode, does this BSS support operation as an VHT SU
66462306a36Sopenharmony_ci *	beamformer
66562306a36Sopenharmony_ci * @vht_su_beamformee: in AP mode, does this BSS support operation as an VHT SU
66662306a36Sopenharmony_ci *	beamformee
66762306a36Sopenharmony_ci * @vht_mu_beamformer: in AP mode, does this BSS support operation as an VHT MU
66862306a36Sopenharmony_ci *	beamformer
66962306a36Sopenharmony_ci * @vht_mu_beamformee: in AP mode, does this BSS support operation as an VHT MU
67062306a36Sopenharmony_ci *	beamformee
67162306a36Sopenharmony_ci * @he_su_beamformer: in AP-mode, does this BSS support operation as an HE SU
67262306a36Sopenharmony_ci *	beamformer
67362306a36Sopenharmony_ci * @he_su_beamformee: in AP-mode, does this BSS support operation as an HE SU
67462306a36Sopenharmony_ci *	beamformee
67562306a36Sopenharmony_ci * @he_mu_beamformer: in AP-mode, does this BSS support operation as an HE MU
67662306a36Sopenharmony_ci *	beamformer
67762306a36Sopenharmony_ci * @he_full_ul_mumimo: does this BSS support the reception (AP) or transmission
67862306a36Sopenharmony_ci *	(non-AP STA) of an HE TB PPDU on an RU that spans the entire PPDU
67962306a36Sopenharmony_ci *	bandwidth
68062306a36Sopenharmony_ci * @eht_su_beamformer: in AP-mode, does this BSS enable operation as an EHT SU
68162306a36Sopenharmony_ci *	beamformer
68262306a36Sopenharmony_ci * @eht_su_beamformee: in AP-mode, does this BSS enable operation as an EHT SU
68362306a36Sopenharmony_ci *	beamformee
68462306a36Sopenharmony_ci * @eht_mu_beamformer: in AP-mode, does this BSS enable operation as an EHT MU
68562306a36Sopenharmony_ci *	beamformer
68662306a36Sopenharmony_ci */
68762306a36Sopenharmony_cistruct ieee80211_bss_conf {
68862306a36Sopenharmony_ci	struct ieee80211_vif *vif;
68962306a36Sopenharmony_ci
69062306a36Sopenharmony_ci	const u8 *bssid;
69162306a36Sopenharmony_ci	unsigned int link_id;
69262306a36Sopenharmony_ci	u8 addr[ETH_ALEN] __aligned(2);
69362306a36Sopenharmony_ci	u8 htc_trig_based_pkt_ext;
69462306a36Sopenharmony_ci	bool uora_exists;
69562306a36Sopenharmony_ci	u8 uora_ocw_range;
69662306a36Sopenharmony_ci	u16 frame_time_rts_th;
69762306a36Sopenharmony_ci	bool he_support;
69862306a36Sopenharmony_ci	bool twt_requester;
69962306a36Sopenharmony_ci	bool twt_responder;
70062306a36Sopenharmony_ci	bool twt_protected;
70162306a36Sopenharmony_ci	bool twt_broadcast;
70262306a36Sopenharmony_ci	/* erp related data */
70362306a36Sopenharmony_ci	bool use_cts_prot;
70462306a36Sopenharmony_ci	bool use_short_preamble;
70562306a36Sopenharmony_ci	bool use_short_slot;
70662306a36Sopenharmony_ci	bool enable_beacon;
70762306a36Sopenharmony_ci	u8 dtim_period;
70862306a36Sopenharmony_ci	u16 beacon_int;
70962306a36Sopenharmony_ci	u16 assoc_capability;
71062306a36Sopenharmony_ci	u64 sync_tsf;
71162306a36Sopenharmony_ci	u32 sync_device_ts;
71262306a36Sopenharmony_ci	u8 sync_dtim_count;
71362306a36Sopenharmony_ci	u32 basic_rates;
71462306a36Sopenharmony_ci	struct ieee80211_rate *beacon_rate;
71562306a36Sopenharmony_ci	int mcast_rate[NUM_NL80211_BANDS];
71662306a36Sopenharmony_ci	u16 ht_operation_mode;
71762306a36Sopenharmony_ci	s32 cqm_rssi_thold;
71862306a36Sopenharmony_ci	u32 cqm_rssi_hyst;
71962306a36Sopenharmony_ci	s32 cqm_rssi_low;
72062306a36Sopenharmony_ci	s32 cqm_rssi_high;
72162306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
72262306a36Sopenharmony_ci	struct ieee80211_mu_group_data mu_group;
72362306a36Sopenharmony_ci	bool qos;
72462306a36Sopenharmony_ci	bool hidden_ssid;
72562306a36Sopenharmony_ci	int txpower;
72662306a36Sopenharmony_ci	enum nl80211_tx_power_setting txpower_type;
72762306a36Sopenharmony_ci	struct ieee80211_p2p_noa_attr p2p_noa_attr;
72862306a36Sopenharmony_ci	bool allow_p2p_go_ps;
72962306a36Sopenharmony_ci	u16 max_idle_period;
73062306a36Sopenharmony_ci	bool protected_keep_alive;
73162306a36Sopenharmony_ci	bool ftm_responder;
73262306a36Sopenharmony_ci	struct ieee80211_ftm_responder_params *ftmr_params;
73362306a36Sopenharmony_ci	/* Multiple BSSID data */
73462306a36Sopenharmony_ci	bool nontransmitted;
73562306a36Sopenharmony_ci	u8 transmitter_bssid[ETH_ALEN];
73662306a36Sopenharmony_ci	u8 bssid_index;
73762306a36Sopenharmony_ci	u8 bssid_indicator;
73862306a36Sopenharmony_ci	bool ema_ap;
73962306a36Sopenharmony_ci	u8 profile_periodicity;
74062306a36Sopenharmony_ci	struct {
74162306a36Sopenharmony_ci		u32 params;
74262306a36Sopenharmony_ci		u16 nss_set;
74362306a36Sopenharmony_ci	} he_oper;
74462306a36Sopenharmony_ci	struct ieee80211_he_obss_pd he_obss_pd;
74562306a36Sopenharmony_ci	struct cfg80211_he_bss_color he_bss_color;
74662306a36Sopenharmony_ci	struct ieee80211_fils_discovery fils_discovery;
74762306a36Sopenharmony_ci	u32 unsol_bcast_probe_resp_interval;
74862306a36Sopenharmony_ci	struct cfg80211_bitrate_mask beacon_tx_rate;
74962306a36Sopenharmony_ci	enum ieee80211_ap_reg_power power_type;
75062306a36Sopenharmony_ci	struct ieee80211_tx_pwr_env tx_pwr_env[IEEE80211_TPE_MAX_IE_COUNT];
75162306a36Sopenharmony_ci	u8 tx_pwr_env_num;
75262306a36Sopenharmony_ci	u8 pwr_reduction;
75362306a36Sopenharmony_ci	bool eht_support;
75462306a36Sopenharmony_ci	u16 eht_puncturing;
75562306a36Sopenharmony_ci
75662306a36Sopenharmony_ci	bool csa_active;
75762306a36Sopenharmony_ci	u16 csa_punct_bitmap;
75862306a36Sopenharmony_ci
75962306a36Sopenharmony_ci	bool mu_mimo_owner;
76062306a36Sopenharmony_ci	struct ieee80211_chanctx_conf __rcu *chanctx_conf;
76162306a36Sopenharmony_ci
76262306a36Sopenharmony_ci	bool color_change_active;
76362306a36Sopenharmony_ci	u8 color_change_color;
76462306a36Sopenharmony_ci
76562306a36Sopenharmony_ci	bool ht_ldpc;
76662306a36Sopenharmony_ci	bool vht_ldpc;
76762306a36Sopenharmony_ci	bool he_ldpc;
76862306a36Sopenharmony_ci	bool vht_su_beamformer;
76962306a36Sopenharmony_ci	bool vht_su_beamformee;
77062306a36Sopenharmony_ci	bool vht_mu_beamformer;
77162306a36Sopenharmony_ci	bool vht_mu_beamformee;
77262306a36Sopenharmony_ci	bool he_su_beamformer;
77362306a36Sopenharmony_ci	bool he_su_beamformee;
77462306a36Sopenharmony_ci	bool he_mu_beamformer;
77562306a36Sopenharmony_ci	bool he_full_ul_mumimo;
77662306a36Sopenharmony_ci	bool eht_su_beamformer;
77762306a36Sopenharmony_ci	bool eht_su_beamformee;
77862306a36Sopenharmony_ci	bool eht_mu_beamformer;
77962306a36Sopenharmony_ci};
78062306a36Sopenharmony_ci
78162306a36Sopenharmony_ci/**
78262306a36Sopenharmony_ci * enum mac80211_tx_info_flags - flags to describe transmission information/status
78362306a36Sopenharmony_ci *
78462306a36Sopenharmony_ci * These flags are used with the @flags member of &ieee80211_tx_info.
78562306a36Sopenharmony_ci *
78662306a36Sopenharmony_ci * @IEEE80211_TX_CTL_REQ_TX_STATUS: require TX status callback for this frame.
78762306a36Sopenharmony_ci * @IEEE80211_TX_CTL_ASSIGN_SEQ: The driver has to assign a sequence
78862306a36Sopenharmony_ci *	number to this frame, taking care of not overwriting the fragment
78962306a36Sopenharmony_ci *	number and increasing the sequence number only when the
79062306a36Sopenharmony_ci *	IEEE80211_TX_CTL_FIRST_FRAGMENT flag is set. mac80211 will properly
79162306a36Sopenharmony_ci *	assign sequence numbers to QoS-data frames but cannot do so correctly
79262306a36Sopenharmony_ci *	for non-QoS-data and management frames because beacons need them from
79362306a36Sopenharmony_ci *	that counter as well and mac80211 cannot guarantee proper sequencing.
79462306a36Sopenharmony_ci *	If this flag is set, the driver should instruct the hardware to
79562306a36Sopenharmony_ci *	assign a sequence number to the frame or assign one itself. Cf. IEEE
79662306a36Sopenharmony_ci *	802.11-2007 7.1.3.4.1 paragraph 3. This flag will always be set for
79762306a36Sopenharmony_ci *	beacons and always be clear for frames without a sequence number field.
79862306a36Sopenharmony_ci * @IEEE80211_TX_CTL_NO_ACK: tell the low level not to wait for an ack
79962306a36Sopenharmony_ci * @IEEE80211_TX_CTL_CLEAR_PS_FILT: clear powersave filter for destination
80062306a36Sopenharmony_ci *	station
80162306a36Sopenharmony_ci * @IEEE80211_TX_CTL_FIRST_FRAGMENT: this is a first fragment of the frame
80262306a36Sopenharmony_ci * @IEEE80211_TX_CTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
80362306a36Sopenharmony_ci * @IEEE80211_TX_CTL_AMPDU: this frame should be sent as part of an A-MPDU
80462306a36Sopenharmony_ci * @IEEE80211_TX_CTL_INJECTED: Frame was injected, internal to mac80211.
80562306a36Sopenharmony_ci * @IEEE80211_TX_STAT_TX_FILTERED: The frame was not transmitted
80662306a36Sopenharmony_ci *	because the destination STA was in powersave mode. Note that to
80762306a36Sopenharmony_ci *	avoid race conditions, the filter must be set by the hardware or
80862306a36Sopenharmony_ci *	firmware upon receiving a frame that indicates that the station
80962306a36Sopenharmony_ci *	went to sleep (must be done on device to filter frames already on
81062306a36Sopenharmony_ci *	the queue) and may only be unset after mac80211 gives the OK for
81162306a36Sopenharmony_ci *	that by setting the IEEE80211_TX_CTL_CLEAR_PS_FILT (see above),
81262306a36Sopenharmony_ci *	since only then is it guaranteed that no more frames are in the
81362306a36Sopenharmony_ci *	hardware queue.
81462306a36Sopenharmony_ci * @IEEE80211_TX_STAT_ACK: Frame was acknowledged
81562306a36Sopenharmony_ci * @IEEE80211_TX_STAT_AMPDU: The frame was aggregated, so status
81662306a36Sopenharmony_ci * 	is for the whole aggregation.
81762306a36Sopenharmony_ci * @IEEE80211_TX_STAT_AMPDU_NO_BACK: no block ack was returned,
81862306a36Sopenharmony_ci * 	so consider using block ack request (BAR).
81962306a36Sopenharmony_ci * @IEEE80211_TX_CTL_RATE_CTRL_PROBE: internal to mac80211, can be
82062306a36Sopenharmony_ci *	set by rate control algorithms to indicate probe rate, will
82162306a36Sopenharmony_ci *	be cleared for fragmented frames (except on the last fragment)
82262306a36Sopenharmony_ci * @IEEE80211_TX_INTFL_OFFCHAN_TX_OK: Internal to mac80211. Used to indicate
82362306a36Sopenharmony_ci *	that a frame can be transmitted while the queues are stopped for
82462306a36Sopenharmony_ci *	off-channel operation.
82562306a36Sopenharmony_ci * @IEEE80211_TX_CTL_HW_80211_ENCAP: This frame uses hardware encapsulation
82662306a36Sopenharmony_ci *	(header conversion)
82762306a36Sopenharmony_ci * @IEEE80211_TX_INTFL_RETRIED: completely internal to mac80211,
82862306a36Sopenharmony_ci *	used to indicate that a frame was already retried due to PS
82962306a36Sopenharmony_ci * @IEEE80211_TX_INTFL_DONT_ENCRYPT: completely internal to mac80211,
83062306a36Sopenharmony_ci *	used to indicate frame should not be encrypted
83162306a36Sopenharmony_ci * @IEEE80211_TX_CTL_NO_PS_BUFFER: This frame is a response to a poll
83262306a36Sopenharmony_ci *	frame (PS-Poll or uAPSD) or a non-bufferable MMPDU and must
83362306a36Sopenharmony_ci *	be sent although the station is in powersave mode.
83462306a36Sopenharmony_ci * @IEEE80211_TX_CTL_MORE_FRAMES: More frames will be passed to the
83562306a36Sopenharmony_ci *	transmit function after the current frame, this can be used
83662306a36Sopenharmony_ci *	by drivers to kick the DMA queue only if unset or when the
83762306a36Sopenharmony_ci *	queue gets full.
83862306a36Sopenharmony_ci * @IEEE80211_TX_INTFL_RETRANSMISSION: This frame is being retransmitted
83962306a36Sopenharmony_ci *	after TX status because the destination was asleep, it must not
84062306a36Sopenharmony_ci *	be modified again (no seqno assignment, crypto, etc.)
84162306a36Sopenharmony_ci * @IEEE80211_TX_INTFL_MLME_CONN_TX: This frame was transmitted by the MLME
84262306a36Sopenharmony_ci *	code for connection establishment, this indicates that its status
84362306a36Sopenharmony_ci *	should kick the MLME state machine.
84462306a36Sopenharmony_ci * @IEEE80211_TX_INTFL_NL80211_FRAME_TX: Frame was requested through nl80211
84562306a36Sopenharmony_ci *	MLME command (internal to mac80211 to figure out whether to send TX
84662306a36Sopenharmony_ci *	status to user space)
84762306a36Sopenharmony_ci * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame
84862306a36Sopenharmony_ci * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this
84962306a36Sopenharmony_ci *	frame and selects the maximum number of streams that it can use.
85062306a36Sopenharmony_ci * @IEEE80211_TX_CTL_TX_OFFCHAN: Marks this packet to be transmitted on
85162306a36Sopenharmony_ci *	the off-channel channel when a remain-on-channel offload is done
85262306a36Sopenharmony_ci *	in hardware -- normal packets still flow and are expected to be
85362306a36Sopenharmony_ci *	handled properly by the device.
85462306a36Sopenharmony_ci * @IEEE80211_TX_INTFL_TKIP_MIC_FAILURE: Marks this packet to be used for TKIP
85562306a36Sopenharmony_ci *	testing. It will be sent out with incorrect Michael MIC key to allow
85662306a36Sopenharmony_ci *	TKIP countermeasures to be tested.
85762306a36Sopenharmony_ci * @IEEE80211_TX_CTL_NO_CCK_RATE: This frame will be sent at non CCK rate.
85862306a36Sopenharmony_ci *	This flag is actually used for management frame especially for P2P
85962306a36Sopenharmony_ci *	frames not being sent at CCK rate in 2GHz band.
86062306a36Sopenharmony_ci * @IEEE80211_TX_STATUS_EOSP: This packet marks the end of service period,
86162306a36Sopenharmony_ci *	when its status is reported the service period ends. For frames in
86262306a36Sopenharmony_ci *	an SP that mac80211 transmits, it is already set; for driver frames
86362306a36Sopenharmony_ci *	the driver may set this flag. It is also used to do the same for
86462306a36Sopenharmony_ci *	PS-Poll responses.
86562306a36Sopenharmony_ci * @IEEE80211_TX_CTL_USE_MINRATE: This frame will be sent at lowest rate.
86662306a36Sopenharmony_ci *	This flag is used to send nullfunc frame at minimum rate when
86762306a36Sopenharmony_ci *	the nullfunc is used for connection monitoring purpose.
86862306a36Sopenharmony_ci * @IEEE80211_TX_CTL_DONTFRAG: Don't fragment this packet even if it
86962306a36Sopenharmony_ci *	would be fragmented by size (this is optional, only used for
87062306a36Sopenharmony_ci *	monitor injection).
87162306a36Sopenharmony_ci * @IEEE80211_TX_STAT_NOACK_TRANSMITTED: A frame that was marked with
87262306a36Sopenharmony_ci *	IEEE80211_TX_CTL_NO_ACK has been successfully transmitted without
87362306a36Sopenharmony_ci *	any errors (like issues specific to the driver/HW).
87462306a36Sopenharmony_ci *	This flag must not be set for frames that don't request no-ack
87562306a36Sopenharmony_ci *	behaviour with IEEE80211_TX_CTL_NO_ACK.
87662306a36Sopenharmony_ci *
87762306a36Sopenharmony_ci * Note: If you have to add new flags to the enumeration, then don't
87862306a36Sopenharmony_ci *	 forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
87962306a36Sopenharmony_ci */
88062306a36Sopenharmony_cienum mac80211_tx_info_flags {
88162306a36Sopenharmony_ci	IEEE80211_TX_CTL_REQ_TX_STATUS		= BIT(0),
88262306a36Sopenharmony_ci	IEEE80211_TX_CTL_ASSIGN_SEQ		= BIT(1),
88362306a36Sopenharmony_ci	IEEE80211_TX_CTL_NO_ACK			= BIT(2),
88462306a36Sopenharmony_ci	IEEE80211_TX_CTL_CLEAR_PS_FILT		= BIT(3),
88562306a36Sopenharmony_ci	IEEE80211_TX_CTL_FIRST_FRAGMENT		= BIT(4),
88662306a36Sopenharmony_ci	IEEE80211_TX_CTL_SEND_AFTER_DTIM	= BIT(5),
88762306a36Sopenharmony_ci	IEEE80211_TX_CTL_AMPDU			= BIT(6),
88862306a36Sopenharmony_ci	IEEE80211_TX_CTL_INJECTED		= BIT(7),
88962306a36Sopenharmony_ci	IEEE80211_TX_STAT_TX_FILTERED		= BIT(8),
89062306a36Sopenharmony_ci	IEEE80211_TX_STAT_ACK			= BIT(9),
89162306a36Sopenharmony_ci	IEEE80211_TX_STAT_AMPDU			= BIT(10),
89262306a36Sopenharmony_ci	IEEE80211_TX_STAT_AMPDU_NO_BACK		= BIT(11),
89362306a36Sopenharmony_ci	IEEE80211_TX_CTL_RATE_CTRL_PROBE	= BIT(12),
89462306a36Sopenharmony_ci	IEEE80211_TX_INTFL_OFFCHAN_TX_OK	= BIT(13),
89562306a36Sopenharmony_ci	IEEE80211_TX_CTL_HW_80211_ENCAP		= BIT(14),
89662306a36Sopenharmony_ci	IEEE80211_TX_INTFL_RETRIED		= BIT(15),
89762306a36Sopenharmony_ci	IEEE80211_TX_INTFL_DONT_ENCRYPT		= BIT(16),
89862306a36Sopenharmony_ci	IEEE80211_TX_CTL_NO_PS_BUFFER		= BIT(17),
89962306a36Sopenharmony_ci	IEEE80211_TX_CTL_MORE_FRAMES		= BIT(18),
90062306a36Sopenharmony_ci	IEEE80211_TX_INTFL_RETRANSMISSION	= BIT(19),
90162306a36Sopenharmony_ci	IEEE80211_TX_INTFL_MLME_CONN_TX		= BIT(20),
90262306a36Sopenharmony_ci	IEEE80211_TX_INTFL_NL80211_FRAME_TX	= BIT(21),
90362306a36Sopenharmony_ci	IEEE80211_TX_CTL_LDPC			= BIT(22),
90462306a36Sopenharmony_ci	IEEE80211_TX_CTL_STBC			= BIT(23) | BIT(24),
90562306a36Sopenharmony_ci	IEEE80211_TX_CTL_TX_OFFCHAN		= BIT(25),
90662306a36Sopenharmony_ci	IEEE80211_TX_INTFL_TKIP_MIC_FAILURE	= BIT(26),
90762306a36Sopenharmony_ci	IEEE80211_TX_CTL_NO_CCK_RATE		= BIT(27),
90862306a36Sopenharmony_ci	IEEE80211_TX_STATUS_EOSP		= BIT(28),
90962306a36Sopenharmony_ci	IEEE80211_TX_CTL_USE_MINRATE		= BIT(29),
91062306a36Sopenharmony_ci	IEEE80211_TX_CTL_DONTFRAG		= BIT(30),
91162306a36Sopenharmony_ci	IEEE80211_TX_STAT_NOACK_TRANSMITTED	= BIT(31),
91262306a36Sopenharmony_ci};
91362306a36Sopenharmony_ci
91462306a36Sopenharmony_ci#define IEEE80211_TX_CTL_STBC_SHIFT		23
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci#define IEEE80211_TX_RC_S1G_MCS IEEE80211_TX_RC_VHT_MCS
91762306a36Sopenharmony_ci
91862306a36Sopenharmony_ci/**
91962306a36Sopenharmony_ci * enum mac80211_tx_control_flags - flags to describe transmit control
92062306a36Sopenharmony_ci *
92162306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_PORT_CTRL_PROTO: this frame is a port control
92262306a36Sopenharmony_ci *	protocol frame (e.g. EAP)
92362306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_PS_RESPONSE: This frame is a response to a poll
92462306a36Sopenharmony_ci *	frame (PS-Poll or uAPSD).
92562306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_RATE_INJECT: This frame is injected with rate information
92662306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_AMSDU: This frame is an A-MSDU frame
92762306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_FAST_XMIT: This frame is going through the fast_xmit path
92862306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP: This frame skips mesh path lookup
92962306a36Sopenharmony_ci * @IEEE80211_TX_INTCFL_NEED_TXPROCESSING: completely internal to mac80211,
93062306a36Sopenharmony_ci *	used to indicate that a pending frame requires TX processing before
93162306a36Sopenharmony_ci *	it can be sent out.
93262306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_NO_SEQNO: Do not overwrite the sequence number that
93362306a36Sopenharmony_ci *	has already been assigned to this frame.
93462306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_DONT_REORDER: This frame should not be reordered
93562306a36Sopenharmony_ci *	relative to other frames that have this flag set, independent
93662306a36Sopenharmony_ci *	of their QoS TID or other priority field values.
93762306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX: first MLO TX, used mostly internally
93862306a36Sopenharmony_ci *	for sequence number assignment
93962306a36Sopenharmony_ci * @IEEE80211_TX_CTRL_MLO_LINK: If not @IEEE80211_LINK_UNSPECIFIED, this
94062306a36Sopenharmony_ci *	frame should be transmitted on the specific link. This really is
94162306a36Sopenharmony_ci *	only relevant for frames that do not have data present, and is
94262306a36Sopenharmony_ci *	also not used for 802.3 format frames. Note that even if the frame
94362306a36Sopenharmony_ci *	is on a specific link, address translation might still apply if
94462306a36Sopenharmony_ci *	it's intended for an MLD.
94562306a36Sopenharmony_ci *
94662306a36Sopenharmony_ci * These flags are used in tx_info->control.flags.
94762306a36Sopenharmony_ci */
94862306a36Sopenharmony_cienum mac80211_tx_control_flags {
94962306a36Sopenharmony_ci	IEEE80211_TX_CTRL_PORT_CTRL_PROTO	= BIT(0),
95062306a36Sopenharmony_ci	IEEE80211_TX_CTRL_PS_RESPONSE		= BIT(1),
95162306a36Sopenharmony_ci	IEEE80211_TX_CTRL_RATE_INJECT		= BIT(2),
95262306a36Sopenharmony_ci	IEEE80211_TX_CTRL_AMSDU			= BIT(3),
95362306a36Sopenharmony_ci	IEEE80211_TX_CTRL_FAST_XMIT		= BIT(4),
95462306a36Sopenharmony_ci	IEEE80211_TX_CTRL_SKIP_MPATH_LOOKUP	= BIT(5),
95562306a36Sopenharmony_ci	IEEE80211_TX_INTCFL_NEED_TXPROCESSING	= BIT(6),
95662306a36Sopenharmony_ci	IEEE80211_TX_CTRL_NO_SEQNO		= BIT(7),
95762306a36Sopenharmony_ci	IEEE80211_TX_CTRL_DONT_REORDER		= BIT(8),
95862306a36Sopenharmony_ci	IEEE80211_TX_CTRL_MCAST_MLO_FIRST_TX	= BIT(9),
95962306a36Sopenharmony_ci	IEEE80211_TX_CTRL_MLO_LINK		= 0xf0000000,
96062306a36Sopenharmony_ci};
96162306a36Sopenharmony_ci
96262306a36Sopenharmony_ci#define IEEE80211_LINK_UNSPECIFIED	0xf
96362306a36Sopenharmony_ci#define IEEE80211_TX_CTRL_MLO_LINK_UNSPEC	\
96462306a36Sopenharmony_ci	u32_encode_bits(IEEE80211_LINK_UNSPECIFIED, \
96562306a36Sopenharmony_ci			IEEE80211_TX_CTRL_MLO_LINK)
96662306a36Sopenharmony_ci
96762306a36Sopenharmony_ci/**
96862306a36Sopenharmony_ci * enum mac80211_tx_status_flags - flags to describe transmit status
96962306a36Sopenharmony_ci *
97062306a36Sopenharmony_ci * @IEEE80211_TX_STATUS_ACK_SIGNAL_VALID: ACK signal is valid
97162306a36Sopenharmony_ci *
97262306a36Sopenharmony_ci * These flags are used in tx_info->status.flags.
97362306a36Sopenharmony_ci */
97462306a36Sopenharmony_cienum mac80211_tx_status_flags {
97562306a36Sopenharmony_ci	IEEE80211_TX_STATUS_ACK_SIGNAL_VALID = BIT(0),
97662306a36Sopenharmony_ci};
97762306a36Sopenharmony_ci
97862306a36Sopenharmony_ci/*
97962306a36Sopenharmony_ci * This definition is used as a mask to clear all temporary flags, which are
98062306a36Sopenharmony_ci * set by the tx handlers for each transmission attempt by the mac80211 stack.
98162306a36Sopenharmony_ci */
98262306a36Sopenharmony_ci#define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK |		      \
98362306a36Sopenharmony_ci	IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT |    \
98462306a36Sopenharmony_ci	IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU |	      \
98562306a36Sopenharmony_ci	IEEE80211_TX_STAT_TX_FILTERED |	IEEE80211_TX_STAT_ACK |		      \
98662306a36Sopenharmony_ci	IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK |	      \
98762306a36Sopenharmony_ci	IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_NO_PS_BUFFER |    \
98862306a36Sopenharmony_ci	IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC |		      \
98962306a36Sopenharmony_ci	IEEE80211_TX_CTL_STBC | IEEE80211_TX_STATUS_EOSP)
99062306a36Sopenharmony_ci
99162306a36Sopenharmony_ci/**
99262306a36Sopenharmony_ci * enum mac80211_rate_control_flags - per-rate flags set by the
99362306a36Sopenharmony_ci *	Rate Control algorithm.
99462306a36Sopenharmony_ci *
99562306a36Sopenharmony_ci * These flags are set by the Rate control algorithm for each rate during tx,
99662306a36Sopenharmony_ci * in the @flags member of struct ieee80211_tx_rate.
99762306a36Sopenharmony_ci *
99862306a36Sopenharmony_ci * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
99962306a36Sopenharmony_ci * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
100062306a36Sopenharmony_ci *	This is set if the current BSS requires ERP protection.
100162306a36Sopenharmony_ci * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
100262306a36Sopenharmony_ci * @IEEE80211_TX_RC_MCS: HT rate.
100362306a36Sopenharmony_ci * @IEEE80211_TX_RC_VHT_MCS: VHT MCS rate, in this case the idx field is split
100462306a36Sopenharmony_ci *	into a higher 4 bits (Nss) and lower 4 bits (MCS number)
100562306a36Sopenharmony_ci * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
100662306a36Sopenharmony_ci *	Greenfield mode.
100762306a36Sopenharmony_ci * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
100862306a36Sopenharmony_ci * @IEEE80211_TX_RC_80_MHZ_WIDTH: Indicates 80 MHz transmission
100962306a36Sopenharmony_ci * @IEEE80211_TX_RC_160_MHZ_WIDTH: Indicates 160 MHz transmission
101062306a36Sopenharmony_ci *	(80+80 isn't supported yet)
101162306a36Sopenharmony_ci * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
101262306a36Sopenharmony_ci *	adjacent 20 MHz channels, if the current channel type is
101362306a36Sopenharmony_ci *	NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
101462306a36Sopenharmony_ci * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
101562306a36Sopenharmony_ci */
101662306a36Sopenharmony_cienum mac80211_rate_control_flags {
101762306a36Sopenharmony_ci	IEEE80211_TX_RC_USE_RTS_CTS		= BIT(0),
101862306a36Sopenharmony_ci	IEEE80211_TX_RC_USE_CTS_PROTECT		= BIT(1),
101962306a36Sopenharmony_ci	IEEE80211_TX_RC_USE_SHORT_PREAMBLE	= BIT(2),
102062306a36Sopenharmony_ci
102162306a36Sopenharmony_ci	/* rate index is an HT/VHT MCS instead of an index */
102262306a36Sopenharmony_ci	IEEE80211_TX_RC_MCS			= BIT(3),
102362306a36Sopenharmony_ci	IEEE80211_TX_RC_GREEN_FIELD		= BIT(4),
102462306a36Sopenharmony_ci	IEEE80211_TX_RC_40_MHZ_WIDTH		= BIT(5),
102562306a36Sopenharmony_ci	IEEE80211_TX_RC_DUP_DATA		= BIT(6),
102662306a36Sopenharmony_ci	IEEE80211_TX_RC_SHORT_GI		= BIT(7),
102762306a36Sopenharmony_ci	IEEE80211_TX_RC_VHT_MCS			= BIT(8),
102862306a36Sopenharmony_ci	IEEE80211_TX_RC_80_MHZ_WIDTH		= BIT(9),
102962306a36Sopenharmony_ci	IEEE80211_TX_RC_160_MHZ_WIDTH		= BIT(10),
103062306a36Sopenharmony_ci};
103162306a36Sopenharmony_ci
103262306a36Sopenharmony_ci
103362306a36Sopenharmony_ci/* there are 40 bytes if you don't need the rateset to be kept */
103462306a36Sopenharmony_ci#define IEEE80211_TX_INFO_DRIVER_DATA_SIZE 40
103562306a36Sopenharmony_ci
103662306a36Sopenharmony_ci/* if you do need the rateset, then you have less space */
103762306a36Sopenharmony_ci#define IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE 24
103862306a36Sopenharmony_ci
103962306a36Sopenharmony_ci/* maximum number of rate stages */
104062306a36Sopenharmony_ci#define IEEE80211_TX_MAX_RATES	4
104162306a36Sopenharmony_ci
104262306a36Sopenharmony_ci/* maximum number of rate table entries */
104362306a36Sopenharmony_ci#define IEEE80211_TX_RATE_TABLE_SIZE	4
104462306a36Sopenharmony_ci
104562306a36Sopenharmony_ci/**
104662306a36Sopenharmony_ci * struct ieee80211_tx_rate - rate selection/status
104762306a36Sopenharmony_ci *
104862306a36Sopenharmony_ci * @idx: rate index to attempt to send with
104962306a36Sopenharmony_ci * @flags: rate control flags (&enum mac80211_rate_control_flags)
105062306a36Sopenharmony_ci * @count: number of tries in this rate before going to the next rate
105162306a36Sopenharmony_ci *
105262306a36Sopenharmony_ci * A value of -1 for @idx indicates an invalid rate and, if used
105362306a36Sopenharmony_ci * in an array of retry rates, that no more rates should be tried.
105462306a36Sopenharmony_ci *
105562306a36Sopenharmony_ci * When used for transmit status reporting, the driver should
105662306a36Sopenharmony_ci * always report the rate along with the flags it used.
105762306a36Sopenharmony_ci *
105862306a36Sopenharmony_ci * &struct ieee80211_tx_info contains an array of these structs
105962306a36Sopenharmony_ci * in the control information, and it will be filled by the rate
106062306a36Sopenharmony_ci * control algorithm according to what should be sent. For example,
106162306a36Sopenharmony_ci * if this array contains, in the format { <idx>, <count> } the
106262306a36Sopenharmony_ci * information::
106362306a36Sopenharmony_ci *
106462306a36Sopenharmony_ci *    { 3, 2 }, { 2, 2 }, { 1, 4 }, { -1, 0 }, { -1, 0 }
106562306a36Sopenharmony_ci *
106662306a36Sopenharmony_ci * then this means that the frame should be transmitted
106762306a36Sopenharmony_ci * up to twice at rate 3, up to twice at rate 2, and up to four
106862306a36Sopenharmony_ci * times at rate 1 if it doesn't get acknowledged. Say it gets
106962306a36Sopenharmony_ci * acknowledged by the peer after the fifth attempt, the status
107062306a36Sopenharmony_ci * information should then contain::
107162306a36Sopenharmony_ci *
107262306a36Sopenharmony_ci *   { 3, 2 }, { 2, 2 }, { 1, 1 }, { -1, 0 } ...
107362306a36Sopenharmony_ci *
107462306a36Sopenharmony_ci * since it was transmitted twice at rate 3, twice at rate 2
107562306a36Sopenharmony_ci * and once at rate 1 after which we received an acknowledgement.
107662306a36Sopenharmony_ci */
107762306a36Sopenharmony_cistruct ieee80211_tx_rate {
107862306a36Sopenharmony_ci	s8 idx;
107962306a36Sopenharmony_ci	u16 count:5,
108062306a36Sopenharmony_ci	    flags:11;
108162306a36Sopenharmony_ci} __packed;
108262306a36Sopenharmony_ci
108362306a36Sopenharmony_ci#define IEEE80211_MAX_TX_RETRY		31
108462306a36Sopenharmony_ci
108562306a36Sopenharmony_cistatic inline void ieee80211_rate_set_vht(struct ieee80211_tx_rate *rate,
108662306a36Sopenharmony_ci					  u8 mcs, u8 nss)
108762306a36Sopenharmony_ci{
108862306a36Sopenharmony_ci	WARN_ON(mcs & ~0xF);
108962306a36Sopenharmony_ci	WARN_ON((nss - 1) & ~0x7);
109062306a36Sopenharmony_ci	rate->idx = ((nss - 1) << 4) | mcs;
109162306a36Sopenharmony_ci}
109262306a36Sopenharmony_ci
109362306a36Sopenharmony_cistatic inline u8
109462306a36Sopenharmony_ciieee80211_rate_get_vht_mcs(const struct ieee80211_tx_rate *rate)
109562306a36Sopenharmony_ci{
109662306a36Sopenharmony_ci	return rate->idx & 0xF;
109762306a36Sopenharmony_ci}
109862306a36Sopenharmony_ci
109962306a36Sopenharmony_cistatic inline u8
110062306a36Sopenharmony_ciieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)
110162306a36Sopenharmony_ci{
110262306a36Sopenharmony_ci	return (rate->idx >> 4) + 1;
110362306a36Sopenharmony_ci}
110462306a36Sopenharmony_ci
110562306a36Sopenharmony_ci/**
110662306a36Sopenharmony_ci * struct ieee80211_tx_info - skb transmit information
110762306a36Sopenharmony_ci *
110862306a36Sopenharmony_ci * This structure is placed in skb->cb for three uses:
110962306a36Sopenharmony_ci *  (1) mac80211 TX control - mac80211 tells the driver what to do
111062306a36Sopenharmony_ci *  (2) driver internal use (if applicable)
111162306a36Sopenharmony_ci *  (3) TX status information - driver tells mac80211 what happened
111262306a36Sopenharmony_ci *
111362306a36Sopenharmony_ci * @flags: transmit info flags, defined above
111462306a36Sopenharmony_ci * @band: the band to transmit on (use e.g. for checking for races),
111562306a36Sopenharmony_ci *	not valid if the interface is an MLD since we won't know which
111662306a36Sopenharmony_ci *	link the frame will be transmitted on
111762306a36Sopenharmony_ci * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
111862306a36Sopenharmony_ci * @ack_frame_id: internal frame ID for TX status, used internally
111962306a36Sopenharmony_ci * @tx_time_est: TX time estimate in units of 4us, used internally
112062306a36Sopenharmony_ci * @control: union part for control data
112162306a36Sopenharmony_ci * @control.rates: TX rates array to try
112262306a36Sopenharmony_ci * @control.rts_cts_rate_idx: rate for RTS or CTS
112362306a36Sopenharmony_ci * @control.use_rts: use RTS
112462306a36Sopenharmony_ci * @control.use_cts_prot: use RTS/CTS
112562306a36Sopenharmony_ci * @control.short_preamble: use short preamble (CCK only)
112662306a36Sopenharmony_ci * @control.skip_table: skip externally configured rate table
112762306a36Sopenharmony_ci * @control.jiffies: timestamp for expiry on powersave clients
112862306a36Sopenharmony_ci * @control.vif: virtual interface (may be NULL)
112962306a36Sopenharmony_ci * @control.hw_key: key to encrypt with (may be NULL)
113062306a36Sopenharmony_ci * @control.flags: control flags, see &enum mac80211_tx_control_flags
113162306a36Sopenharmony_ci * @control.enqueue_time: enqueue time (for iTXQs)
113262306a36Sopenharmony_ci * @driver_rates: alias to @control.rates to reserve space
113362306a36Sopenharmony_ci * @pad: padding
113462306a36Sopenharmony_ci * @rate_driver_data: driver use area if driver needs @control.rates
113562306a36Sopenharmony_ci * @status: union part for status data
113662306a36Sopenharmony_ci * @status.rates: attempted rates
113762306a36Sopenharmony_ci * @status.ack_signal: ACK signal
113862306a36Sopenharmony_ci * @status.ampdu_ack_len: AMPDU ack length
113962306a36Sopenharmony_ci * @status.ampdu_len: AMPDU length
114062306a36Sopenharmony_ci * @status.antenna: (legacy, kept only for iwlegacy)
114162306a36Sopenharmony_ci * @status.tx_time: airtime consumed for transmission; note this is only
114262306a36Sopenharmony_ci *	used for WMM AC, not for airtime fairness
114362306a36Sopenharmony_ci * @status.flags: status flags, see &enum mac80211_tx_status_flags
114462306a36Sopenharmony_ci * @status.status_driver_data: driver use area
114562306a36Sopenharmony_ci * @ack: union part for pure ACK data
114662306a36Sopenharmony_ci * @ack.cookie: cookie for the ACK
114762306a36Sopenharmony_ci * @driver_data: array of driver_data pointers
114862306a36Sopenharmony_ci * @ampdu_ack_len: number of acked aggregated frames.
114962306a36Sopenharmony_ci * 	relevant only if IEEE80211_TX_STAT_AMPDU was set.
115062306a36Sopenharmony_ci * @ampdu_len: number of aggregated frames.
115162306a36Sopenharmony_ci * 	relevant only if IEEE80211_TX_STAT_AMPDU was set.
115262306a36Sopenharmony_ci * @ack_signal: signal strength of the ACK frame
115362306a36Sopenharmony_ci */
115462306a36Sopenharmony_cistruct ieee80211_tx_info {
115562306a36Sopenharmony_ci	/* common information */
115662306a36Sopenharmony_ci	u32 flags;
115762306a36Sopenharmony_ci	u32 band:3,
115862306a36Sopenharmony_ci	    ack_frame_id:13,
115962306a36Sopenharmony_ci	    hw_queue:4,
116062306a36Sopenharmony_ci	    tx_time_est:10;
116162306a36Sopenharmony_ci	/* 2 free bits */
116262306a36Sopenharmony_ci
116362306a36Sopenharmony_ci	union {
116462306a36Sopenharmony_ci		struct {
116562306a36Sopenharmony_ci			union {
116662306a36Sopenharmony_ci				/* rate control */
116762306a36Sopenharmony_ci				struct {
116862306a36Sopenharmony_ci					struct ieee80211_tx_rate rates[
116962306a36Sopenharmony_ci						IEEE80211_TX_MAX_RATES];
117062306a36Sopenharmony_ci					s8 rts_cts_rate_idx;
117162306a36Sopenharmony_ci					u8 use_rts:1;
117262306a36Sopenharmony_ci					u8 use_cts_prot:1;
117362306a36Sopenharmony_ci					u8 short_preamble:1;
117462306a36Sopenharmony_ci					u8 skip_table:1;
117562306a36Sopenharmony_ci					/* 2 bytes free */
117662306a36Sopenharmony_ci				};
117762306a36Sopenharmony_ci				/* only needed before rate control */
117862306a36Sopenharmony_ci				unsigned long jiffies;
117962306a36Sopenharmony_ci			};
118062306a36Sopenharmony_ci			/* NB: vif can be NULL for injected frames */
118162306a36Sopenharmony_ci			struct ieee80211_vif *vif;
118262306a36Sopenharmony_ci			struct ieee80211_key_conf *hw_key;
118362306a36Sopenharmony_ci			u32 flags;
118462306a36Sopenharmony_ci			codel_time_t enqueue_time;
118562306a36Sopenharmony_ci		} control;
118662306a36Sopenharmony_ci		struct {
118762306a36Sopenharmony_ci			u64 cookie;
118862306a36Sopenharmony_ci		} ack;
118962306a36Sopenharmony_ci		struct {
119062306a36Sopenharmony_ci			struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
119162306a36Sopenharmony_ci			s32 ack_signal;
119262306a36Sopenharmony_ci			u8 ampdu_ack_len;
119362306a36Sopenharmony_ci			u8 ampdu_len;
119462306a36Sopenharmony_ci			u8 antenna;
119562306a36Sopenharmony_ci			u8 pad;
119662306a36Sopenharmony_ci			u16 tx_time;
119762306a36Sopenharmony_ci			u8 flags;
119862306a36Sopenharmony_ci			u8 pad2;
119962306a36Sopenharmony_ci			void *status_driver_data[16 / sizeof(void *)];
120062306a36Sopenharmony_ci		} status;
120162306a36Sopenharmony_ci		struct {
120262306a36Sopenharmony_ci			struct ieee80211_tx_rate driver_rates[
120362306a36Sopenharmony_ci				IEEE80211_TX_MAX_RATES];
120462306a36Sopenharmony_ci			u8 pad[4];
120562306a36Sopenharmony_ci
120662306a36Sopenharmony_ci			void *rate_driver_data[
120762306a36Sopenharmony_ci				IEEE80211_TX_INFO_RATE_DRIVER_DATA_SIZE / sizeof(void *)];
120862306a36Sopenharmony_ci		};
120962306a36Sopenharmony_ci		void *driver_data[
121062306a36Sopenharmony_ci			IEEE80211_TX_INFO_DRIVER_DATA_SIZE / sizeof(void *)];
121162306a36Sopenharmony_ci	};
121262306a36Sopenharmony_ci};
121362306a36Sopenharmony_ci
121462306a36Sopenharmony_cistatic inline u16
121562306a36Sopenharmony_ciieee80211_info_set_tx_time_est(struct ieee80211_tx_info *info, u16 tx_time_est)
121662306a36Sopenharmony_ci{
121762306a36Sopenharmony_ci	/* We only have 10 bits in tx_time_est, so store airtime
121862306a36Sopenharmony_ci	 * in increments of 4us and clamp the maximum to 2**12-1
121962306a36Sopenharmony_ci	 */
122062306a36Sopenharmony_ci	info->tx_time_est = min_t(u16, tx_time_est, 4095) >> 2;
122162306a36Sopenharmony_ci	return info->tx_time_est << 2;
122262306a36Sopenharmony_ci}
122362306a36Sopenharmony_ci
122462306a36Sopenharmony_cistatic inline u16
122562306a36Sopenharmony_ciieee80211_info_get_tx_time_est(struct ieee80211_tx_info *info)
122662306a36Sopenharmony_ci{
122762306a36Sopenharmony_ci	return info->tx_time_est << 2;
122862306a36Sopenharmony_ci}
122962306a36Sopenharmony_ci
123062306a36Sopenharmony_ci/***
123162306a36Sopenharmony_ci * struct ieee80211_rate_status - mrr stage for status path
123262306a36Sopenharmony_ci *
123362306a36Sopenharmony_ci * This struct is used in struct ieee80211_tx_status to provide drivers a
123462306a36Sopenharmony_ci * dynamic way to report about used rates and power levels per packet.
123562306a36Sopenharmony_ci *
123662306a36Sopenharmony_ci * @rate_idx The actual used rate.
123762306a36Sopenharmony_ci * @try_count How often the rate was tried.
123862306a36Sopenharmony_ci * @tx_power_idx An idx into the ieee80211_hw->tx_power_levels list of the
123962306a36Sopenharmony_ci * 	corresponding wifi hardware. The idx shall point to the power level
124062306a36Sopenharmony_ci * 	that was used when sending the packet.
124162306a36Sopenharmony_ci */
124262306a36Sopenharmony_cistruct ieee80211_rate_status {
124362306a36Sopenharmony_ci	struct rate_info rate_idx;
124462306a36Sopenharmony_ci	u8 try_count;
124562306a36Sopenharmony_ci	u8 tx_power_idx;
124662306a36Sopenharmony_ci};
124762306a36Sopenharmony_ci
124862306a36Sopenharmony_ci/**
124962306a36Sopenharmony_ci * struct ieee80211_tx_status - extended tx status info for rate control
125062306a36Sopenharmony_ci *
125162306a36Sopenharmony_ci * @sta: Station that the packet was transmitted for
125262306a36Sopenharmony_ci * @info: Basic tx status information
125362306a36Sopenharmony_ci * @skb: Packet skb (can be NULL if not provided by the driver)
125462306a36Sopenharmony_ci * @rates: Mrr stages that were used when sending the packet
125562306a36Sopenharmony_ci * @n_rates: Number of mrr stages (count of instances for @rates)
125662306a36Sopenharmony_ci * @free_list: list where processed skbs are stored to be free'd by the driver
125762306a36Sopenharmony_ci * @ack_hwtstamp: Hardware timestamp of the received ack in nanoseconds
125862306a36Sopenharmony_ci *	Only needed for Timing measurement and Fine timing measurement action
125962306a36Sopenharmony_ci *	frames. Only reported by devices that have timestamping enabled.
126062306a36Sopenharmony_ci */
126162306a36Sopenharmony_cistruct ieee80211_tx_status {
126262306a36Sopenharmony_ci	struct ieee80211_sta *sta;
126362306a36Sopenharmony_ci	struct ieee80211_tx_info *info;
126462306a36Sopenharmony_ci	struct sk_buff *skb;
126562306a36Sopenharmony_ci	struct ieee80211_rate_status *rates;
126662306a36Sopenharmony_ci	ktime_t ack_hwtstamp;
126762306a36Sopenharmony_ci	u8 n_rates;
126862306a36Sopenharmony_ci
126962306a36Sopenharmony_ci	struct list_head *free_list;
127062306a36Sopenharmony_ci};
127162306a36Sopenharmony_ci
127262306a36Sopenharmony_ci/**
127362306a36Sopenharmony_ci * struct ieee80211_scan_ies - descriptors for different blocks of IEs
127462306a36Sopenharmony_ci *
127562306a36Sopenharmony_ci * This structure is used to point to different blocks of IEs in HW scan
127662306a36Sopenharmony_ci * and scheduled scan. These blocks contain the IEs passed by userspace
127762306a36Sopenharmony_ci * and the ones generated by mac80211.
127862306a36Sopenharmony_ci *
127962306a36Sopenharmony_ci * @ies: pointers to band specific IEs.
128062306a36Sopenharmony_ci * @len: lengths of band_specific IEs.
128162306a36Sopenharmony_ci * @common_ies: IEs for all bands (especially vendor specific ones)
128262306a36Sopenharmony_ci * @common_ie_len: length of the common_ies
128362306a36Sopenharmony_ci */
128462306a36Sopenharmony_cistruct ieee80211_scan_ies {
128562306a36Sopenharmony_ci	const u8 *ies[NUM_NL80211_BANDS];
128662306a36Sopenharmony_ci	size_t len[NUM_NL80211_BANDS];
128762306a36Sopenharmony_ci	const u8 *common_ies;
128862306a36Sopenharmony_ci	size_t common_ie_len;
128962306a36Sopenharmony_ci};
129062306a36Sopenharmony_ci
129162306a36Sopenharmony_ci
129262306a36Sopenharmony_cistatic inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb)
129362306a36Sopenharmony_ci{
129462306a36Sopenharmony_ci	return (struct ieee80211_tx_info *)skb->cb;
129562306a36Sopenharmony_ci}
129662306a36Sopenharmony_ci
129762306a36Sopenharmony_cistatic inline struct ieee80211_rx_status *IEEE80211_SKB_RXCB(struct sk_buff *skb)
129862306a36Sopenharmony_ci{
129962306a36Sopenharmony_ci	return (struct ieee80211_rx_status *)skb->cb;
130062306a36Sopenharmony_ci}
130162306a36Sopenharmony_ci
130262306a36Sopenharmony_ci/**
130362306a36Sopenharmony_ci * ieee80211_tx_info_clear_status - clear TX status
130462306a36Sopenharmony_ci *
130562306a36Sopenharmony_ci * @info: The &struct ieee80211_tx_info to be cleared.
130662306a36Sopenharmony_ci *
130762306a36Sopenharmony_ci * When the driver passes an skb back to mac80211, it must report
130862306a36Sopenharmony_ci * a number of things in TX status. This function clears everything
130962306a36Sopenharmony_ci * in the TX status but the rate control information (it does clear
131062306a36Sopenharmony_ci * the count since you need to fill that in anyway).
131162306a36Sopenharmony_ci *
131262306a36Sopenharmony_ci * NOTE: While the rates array is kept intact, this will wipe all of the
131362306a36Sopenharmony_ci *	 driver_data fields in info, so it's up to the driver to restore
131462306a36Sopenharmony_ci *	 any fields it needs after calling this helper.
131562306a36Sopenharmony_ci */
131662306a36Sopenharmony_cistatic inline void
131762306a36Sopenharmony_ciieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
131862306a36Sopenharmony_ci{
131962306a36Sopenharmony_ci	int i;
132062306a36Sopenharmony_ci
132162306a36Sopenharmony_ci	BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
132262306a36Sopenharmony_ci		     offsetof(struct ieee80211_tx_info, control.rates));
132362306a36Sopenharmony_ci	BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) !=
132462306a36Sopenharmony_ci		     offsetof(struct ieee80211_tx_info, driver_rates));
132562306a36Sopenharmony_ci	BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, status.rates) != 8);
132662306a36Sopenharmony_ci	/* clear the rate counts */
132762306a36Sopenharmony_ci	for (i = 0; i < IEEE80211_TX_MAX_RATES; i++)
132862306a36Sopenharmony_ci		info->status.rates[i].count = 0;
132962306a36Sopenharmony_ci	memset_after(&info->status, 0, rates);
133062306a36Sopenharmony_ci}
133162306a36Sopenharmony_ci
133262306a36Sopenharmony_ci
133362306a36Sopenharmony_ci/**
133462306a36Sopenharmony_ci * enum mac80211_rx_flags - receive flags
133562306a36Sopenharmony_ci *
133662306a36Sopenharmony_ci * These flags are used with the @flag member of &struct ieee80211_rx_status.
133762306a36Sopenharmony_ci * @RX_FLAG_MMIC_ERROR: Michael MIC error was reported on this frame.
133862306a36Sopenharmony_ci *	Use together with %RX_FLAG_MMIC_STRIPPED.
133962306a36Sopenharmony_ci * @RX_FLAG_DECRYPTED: This frame was decrypted in hardware.
134062306a36Sopenharmony_ci * @RX_FLAG_MMIC_STRIPPED: the Michael MIC is stripped off this frame,
134162306a36Sopenharmony_ci *	verification has been done by the hardware.
134262306a36Sopenharmony_ci * @RX_FLAG_IV_STRIPPED: The IV and ICV are stripped from this frame.
134362306a36Sopenharmony_ci *	If this flag is set, the stack cannot do any replay detection
134462306a36Sopenharmony_ci *	hence the driver or hardware will have to do that.
134562306a36Sopenharmony_ci * @RX_FLAG_PN_VALIDATED: Currently only valid for CCMP/GCMP frames, this
134662306a36Sopenharmony_ci *	flag indicates that the PN was verified for replay protection.
134762306a36Sopenharmony_ci *	Note that this flag is also currently only supported when a frame
134862306a36Sopenharmony_ci *	is also decrypted (ie. @RX_FLAG_DECRYPTED must be set)
134962306a36Sopenharmony_ci * @RX_FLAG_DUP_VALIDATED: The driver should set this flag if it did
135062306a36Sopenharmony_ci *	de-duplication by itself.
135162306a36Sopenharmony_ci * @RX_FLAG_FAILED_FCS_CRC: Set this flag if the FCS check failed on
135262306a36Sopenharmony_ci *	the frame.
135362306a36Sopenharmony_ci * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
135462306a36Sopenharmony_ci *	the frame.
135562306a36Sopenharmony_ci * @RX_FLAG_MACTIME_START: The timestamp passed in the RX status (@mactime
135662306a36Sopenharmony_ci *	field) is valid and contains the time the first symbol of the MPDU
135762306a36Sopenharmony_ci *	was received. This is useful in monitor mode and for proper IBSS
135862306a36Sopenharmony_ci *	merging.
135962306a36Sopenharmony_ci * @RX_FLAG_MACTIME_END: The timestamp passed in the RX status (@mactime
136062306a36Sopenharmony_ci *	field) is valid and contains the time the last symbol of the MPDU
136162306a36Sopenharmony_ci *	(including FCS) was received.
136262306a36Sopenharmony_ci * @RX_FLAG_MACTIME_PLCP_START: The timestamp passed in the RX status (@mactime
136362306a36Sopenharmony_ci *	field) is valid and contains the time the SYNC preamble was received.
136462306a36Sopenharmony_ci * @RX_FLAG_NO_SIGNAL_VAL: The signal strength value is not present.
136562306a36Sopenharmony_ci *	Valid only for data frames (mainly A-MPDU)
136662306a36Sopenharmony_ci * @RX_FLAG_AMPDU_DETAILS: A-MPDU details are known, in particular the reference
136762306a36Sopenharmony_ci *	number (@ampdu_reference) must be populated and be a distinct number for
136862306a36Sopenharmony_ci *	each A-MPDU
136962306a36Sopenharmony_ci * @RX_FLAG_AMPDU_LAST_KNOWN: last subframe is known, should be set on all
137062306a36Sopenharmony_ci *	subframes of a single A-MPDU
137162306a36Sopenharmony_ci * @RX_FLAG_AMPDU_IS_LAST: this subframe is the last subframe of the A-MPDU
137262306a36Sopenharmony_ci * @RX_FLAG_AMPDU_DELIM_CRC_ERROR: A delimiter CRC error has been detected
137362306a36Sopenharmony_ci *	on this subframe
137462306a36Sopenharmony_ci * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
137562306a36Sopenharmony_ci *	is stored in the @ampdu_delimiter_crc field)
137662306a36Sopenharmony_ci * @RX_FLAG_MIC_STRIPPED: The mic was stripped of this packet. Decryption was
137762306a36Sopenharmony_ci *	done by the hardware
137862306a36Sopenharmony_ci * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without
137962306a36Sopenharmony_ci *	processing it in any regular way.
138062306a36Sopenharmony_ci *	This is useful if drivers offload some frames but still want to report
138162306a36Sopenharmony_ci *	them for sniffing purposes.
138262306a36Sopenharmony_ci * @RX_FLAG_SKIP_MONITOR: Process and report frame to all interfaces except
138362306a36Sopenharmony_ci *	monitor interfaces.
138462306a36Sopenharmony_ci *	This is useful if drivers offload some frames but still want to report
138562306a36Sopenharmony_ci *	them for sniffing purposes.
138662306a36Sopenharmony_ci * @RX_FLAG_AMSDU_MORE: Some drivers may prefer to report separate A-MSDU
138762306a36Sopenharmony_ci *	subframes instead of a one huge frame for performance reasons.
138862306a36Sopenharmony_ci *	All, but the last MSDU from an A-MSDU should have this flag set. E.g.
138962306a36Sopenharmony_ci *	if an A-MSDU has 3 frames, the first 2 must have the flag set, while
139062306a36Sopenharmony_ci *	the 3rd (last) one must not have this flag set. The flag is used to
139162306a36Sopenharmony_ci *	deal with retransmission/duplication recovery properly since A-MSDU
139262306a36Sopenharmony_ci *	subframes share the same sequence number. Reported subframes can be
139362306a36Sopenharmony_ci *	either regular MSDU or singly A-MSDUs. Subframes must not be
139462306a36Sopenharmony_ci *	interleaved with other frames.
139562306a36Sopenharmony_ci * @RX_FLAG_RADIOTAP_TLV_AT_END: This frame contains radiotap TLVs in the
139662306a36Sopenharmony_ci *	skb->data (before the 802.11 header).
139762306a36Sopenharmony_ci *	If used, the SKB's mac_header pointer must be set to point
139862306a36Sopenharmony_ci *	to the 802.11 header after the TLVs, and any padding added after TLV
139962306a36Sopenharmony_ci *	data to align to 4 must be cleared by the driver putting the TLVs
140062306a36Sopenharmony_ci *	in the skb.
140162306a36Sopenharmony_ci * @RX_FLAG_ALLOW_SAME_PN: Allow the same PN as same packet before.
140262306a36Sopenharmony_ci *	This is used for AMSDU subframes which can have the same PN as
140362306a36Sopenharmony_ci *	the first subframe.
140462306a36Sopenharmony_ci * @RX_FLAG_ICV_STRIPPED: The ICV is stripped from this frame. CRC checking must
140562306a36Sopenharmony_ci *	be done in the hardware.
140662306a36Sopenharmony_ci * @RX_FLAG_AMPDU_EOF_BIT: Value of the EOF bit in the A-MPDU delimiter for this
140762306a36Sopenharmony_ci *	frame
140862306a36Sopenharmony_ci * @RX_FLAG_AMPDU_EOF_BIT_KNOWN: The EOF value is known
140962306a36Sopenharmony_ci * @RX_FLAG_RADIOTAP_HE: HE radiotap data is present
141062306a36Sopenharmony_ci *	(&struct ieee80211_radiotap_he, mac80211 will fill in
141162306a36Sopenharmony_ci *
141262306a36Sopenharmony_ci *	 - DATA3_DATA_MCS
141362306a36Sopenharmony_ci *	 - DATA3_DATA_DCM
141462306a36Sopenharmony_ci *	 - DATA3_CODING
141562306a36Sopenharmony_ci *	 - DATA5_GI
141662306a36Sopenharmony_ci *	 - DATA5_DATA_BW_RU_ALLOC
141762306a36Sopenharmony_ci *	 - DATA6_NSTS
141862306a36Sopenharmony_ci *	 - DATA3_STBC
141962306a36Sopenharmony_ci *
142062306a36Sopenharmony_ci *	from the RX info data, so leave those zeroed when building this data)
142162306a36Sopenharmony_ci * @RX_FLAG_RADIOTAP_HE_MU: HE MU radiotap data is present
142262306a36Sopenharmony_ci *	(&struct ieee80211_radiotap_he_mu)
142362306a36Sopenharmony_ci * @RX_FLAG_RADIOTAP_LSIG: L-SIG radiotap data is present
142462306a36Sopenharmony_ci * @RX_FLAG_NO_PSDU: use the frame only for radiotap reporting, with
142562306a36Sopenharmony_ci *	the "0-length PSDU" field included there.  The value for it is
142662306a36Sopenharmony_ci *	in &struct ieee80211_rx_status.  Note that if this value isn't
142762306a36Sopenharmony_ci *	known the frame shouldn't be reported.
142862306a36Sopenharmony_ci * @RX_FLAG_8023: the frame has an 802.3 header (decap offload performed by
142962306a36Sopenharmony_ci *	hardware or driver)
143062306a36Sopenharmony_ci */
143162306a36Sopenharmony_cienum mac80211_rx_flags {
143262306a36Sopenharmony_ci	RX_FLAG_MMIC_ERROR		= BIT(0),
143362306a36Sopenharmony_ci	RX_FLAG_DECRYPTED		= BIT(1),
143462306a36Sopenharmony_ci	RX_FLAG_MACTIME_PLCP_START	= BIT(2),
143562306a36Sopenharmony_ci	RX_FLAG_MMIC_STRIPPED		= BIT(3),
143662306a36Sopenharmony_ci	RX_FLAG_IV_STRIPPED		= BIT(4),
143762306a36Sopenharmony_ci	RX_FLAG_FAILED_FCS_CRC		= BIT(5),
143862306a36Sopenharmony_ci	RX_FLAG_FAILED_PLCP_CRC 	= BIT(6),
143962306a36Sopenharmony_ci	RX_FLAG_MACTIME_START		= BIT(7),
144062306a36Sopenharmony_ci	RX_FLAG_NO_SIGNAL_VAL		= BIT(8),
144162306a36Sopenharmony_ci	RX_FLAG_AMPDU_DETAILS		= BIT(9),
144262306a36Sopenharmony_ci	RX_FLAG_PN_VALIDATED		= BIT(10),
144362306a36Sopenharmony_ci	RX_FLAG_DUP_VALIDATED		= BIT(11),
144462306a36Sopenharmony_ci	RX_FLAG_AMPDU_LAST_KNOWN	= BIT(12),
144562306a36Sopenharmony_ci	RX_FLAG_AMPDU_IS_LAST		= BIT(13),
144662306a36Sopenharmony_ci	RX_FLAG_AMPDU_DELIM_CRC_ERROR	= BIT(14),
144762306a36Sopenharmony_ci	RX_FLAG_AMPDU_DELIM_CRC_KNOWN	= BIT(15),
144862306a36Sopenharmony_ci	RX_FLAG_MACTIME_END		= BIT(16),
144962306a36Sopenharmony_ci	RX_FLAG_ONLY_MONITOR		= BIT(17),
145062306a36Sopenharmony_ci	RX_FLAG_SKIP_MONITOR		= BIT(18),
145162306a36Sopenharmony_ci	RX_FLAG_AMSDU_MORE		= BIT(19),
145262306a36Sopenharmony_ci	RX_FLAG_RADIOTAP_TLV_AT_END	= BIT(20),
145362306a36Sopenharmony_ci	RX_FLAG_MIC_STRIPPED		= BIT(21),
145462306a36Sopenharmony_ci	RX_FLAG_ALLOW_SAME_PN		= BIT(22),
145562306a36Sopenharmony_ci	RX_FLAG_ICV_STRIPPED		= BIT(23),
145662306a36Sopenharmony_ci	RX_FLAG_AMPDU_EOF_BIT		= BIT(24),
145762306a36Sopenharmony_ci	RX_FLAG_AMPDU_EOF_BIT_KNOWN	= BIT(25),
145862306a36Sopenharmony_ci	RX_FLAG_RADIOTAP_HE		= BIT(26),
145962306a36Sopenharmony_ci	RX_FLAG_RADIOTAP_HE_MU		= BIT(27),
146062306a36Sopenharmony_ci	RX_FLAG_RADIOTAP_LSIG		= BIT(28),
146162306a36Sopenharmony_ci	RX_FLAG_NO_PSDU			= BIT(29),
146262306a36Sopenharmony_ci	RX_FLAG_8023			= BIT(30),
146362306a36Sopenharmony_ci};
146462306a36Sopenharmony_ci
146562306a36Sopenharmony_ci/**
146662306a36Sopenharmony_ci * enum mac80211_rx_encoding_flags - MCS & bandwidth flags
146762306a36Sopenharmony_ci *
146862306a36Sopenharmony_ci * @RX_ENC_FLAG_SHORTPRE: Short preamble was used for this frame
146962306a36Sopenharmony_ci * @RX_ENC_FLAG_SHORT_GI: Short guard interval was used
147062306a36Sopenharmony_ci * @RX_ENC_FLAG_HT_GF: This frame was received in a HT-greenfield transmission,
147162306a36Sopenharmony_ci *	if the driver fills this value it should add
147262306a36Sopenharmony_ci *	%IEEE80211_RADIOTAP_MCS_HAVE_FMT
147362306a36Sopenharmony_ci *	to @hw.radiotap_mcs_details to advertise that fact.
147462306a36Sopenharmony_ci * @RX_ENC_FLAG_LDPC: LDPC was used
147562306a36Sopenharmony_ci * @RX_ENC_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
147662306a36Sopenharmony_ci * @RX_ENC_FLAG_BF: packet was beamformed
147762306a36Sopenharmony_ci */
147862306a36Sopenharmony_cienum mac80211_rx_encoding_flags {
147962306a36Sopenharmony_ci	RX_ENC_FLAG_SHORTPRE		= BIT(0),
148062306a36Sopenharmony_ci	RX_ENC_FLAG_SHORT_GI		= BIT(2),
148162306a36Sopenharmony_ci	RX_ENC_FLAG_HT_GF		= BIT(3),
148262306a36Sopenharmony_ci	RX_ENC_FLAG_STBC_MASK		= BIT(4) | BIT(5),
148362306a36Sopenharmony_ci	RX_ENC_FLAG_LDPC		= BIT(6),
148462306a36Sopenharmony_ci	RX_ENC_FLAG_BF			= BIT(7),
148562306a36Sopenharmony_ci};
148662306a36Sopenharmony_ci
148762306a36Sopenharmony_ci#define RX_ENC_FLAG_STBC_SHIFT		4
148862306a36Sopenharmony_ci
148962306a36Sopenharmony_cienum mac80211_rx_encoding {
149062306a36Sopenharmony_ci	RX_ENC_LEGACY = 0,
149162306a36Sopenharmony_ci	RX_ENC_HT,
149262306a36Sopenharmony_ci	RX_ENC_VHT,
149362306a36Sopenharmony_ci	RX_ENC_HE,
149462306a36Sopenharmony_ci	RX_ENC_EHT,
149562306a36Sopenharmony_ci};
149662306a36Sopenharmony_ci
149762306a36Sopenharmony_ci/**
149862306a36Sopenharmony_ci * struct ieee80211_rx_status - receive status
149962306a36Sopenharmony_ci *
150062306a36Sopenharmony_ci * The low-level driver should provide this information (the subset
150162306a36Sopenharmony_ci * supported by hardware) to the 802.11 code with each received
150262306a36Sopenharmony_ci * frame, in the skb's control buffer (cb).
150362306a36Sopenharmony_ci *
150462306a36Sopenharmony_ci * @mactime: value in microseconds of the 64-bit Time Synchronization Function
150562306a36Sopenharmony_ci * 	(TSF) timer when the first data symbol (MPDU) arrived at the hardware.
150662306a36Sopenharmony_ci * @boottime_ns: CLOCK_BOOTTIME timestamp the frame was received at, this is
150762306a36Sopenharmony_ci *	needed only for beacons and probe responses that update the scan cache.
150862306a36Sopenharmony_ci * @ack_tx_hwtstamp: Hardware timestamp for the ack TX in nanoseconds. Only
150962306a36Sopenharmony_ci *	needed for Timing measurement and Fine timing measurement action frames.
151062306a36Sopenharmony_ci *	Only reported by devices that have timestamping enabled.
151162306a36Sopenharmony_ci * @device_timestamp: arbitrary timestamp for the device, mac80211 doesn't use
151262306a36Sopenharmony_ci *	it but can store it and pass it back to the driver for synchronisation
151362306a36Sopenharmony_ci * @band: the active band when this frame was received
151462306a36Sopenharmony_ci * @freq: frequency the radio was tuned to when receiving this frame, in MHz
151562306a36Sopenharmony_ci *	This field must be set for management frames, but isn't strictly needed
151662306a36Sopenharmony_ci *	for data (other) frames - for those it only affects radiotap reporting.
151762306a36Sopenharmony_ci * @freq_offset: @freq has a positive offset of 500Khz.
151862306a36Sopenharmony_ci * @signal: signal strength when receiving this frame, either in dBm, in dB or
151962306a36Sopenharmony_ci *	unspecified depending on the hardware capabilities flags
152062306a36Sopenharmony_ci *	@IEEE80211_HW_SIGNAL_*
152162306a36Sopenharmony_ci * @chains: bitmask of receive chains for which separate signal strength
152262306a36Sopenharmony_ci *	values were filled.
152362306a36Sopenharmony_ci * @chain_signal: per-chain signal strength, in dBm (unlike @signal, doesn't
152462306a36Sopenharmony_ci *	support dB or unspecified units)
152562306a36Sopenharmony_ci * @antenna: antenna used
152662306a36Sopenharmony_ci * @rate_idx: index of data rate into band's supported rates or MCS index if
152762306a36Sopenharmony_ci *	HT or VHT is used (%RX_FLAG_HT/%RX_FLAG_VHT)
152862306a36Sopenharmony_ci * @nss: number of streams (VHT, HE and EHT only)
152962306a36Sopenharmony_ci * @flag: %RX_FLAG_\*
153062306a36Sopenharmony_ci * @encoding: &enum mac80211_rx_encoding
153162306a36Sopenharmony_ci * @bw: &enum rate_info_bw
153262306a36Sopenharmony_ci * @enc_flags: uses bits from &enum mac80211_rx_encoding_flags
153362306a36Sopenharmony_ci * @he_ru: HE RU, from &enum nl80211_he_ru_alloc
153462306a36Sopenharmony_ci * @he_gi: HE GI, from &enum nl80211_he_gi
153562306a36Sopenharmony_ci * @he_dcm: HE DCM value
153662306a36Sopenharmony_ci * @eht: EHT specific rate information
153762306a36Sopenharmony_ci * @eht.ru: EHT RU, from &enum nl80211_eht_ru_alloc
153862306a36Sopenharmony_ci * @eht.gi: EHT GI, from &enum nl80211_eht_gi
153962306a36Sopenharmony_ci * @rx_flags: internal RX flags for mac80211
154062306a36Sopenharmony_ci * @ampdu_reference: A-MPDU reference number, must be a different value for
154162306a36Sopenharmony_ci *	each A-MPDU but the same for each subframe within one A-MPDU
154262306a36Sopenharmony_ci * @ampdu_delimiter_crc: A-MPDU delimiter CRC
154362306a36Sopenharmony_ci * @zero_length_psdu_type: radiotap type of the 0-length PSDU
154462306a36Sopenharmony_ci * @link_valid: if the link which is identified by @link_id is valid. This flag
154562306a36Sopenharmony_ci *	is set only when connection is MLO.
154662306a36Sopenharmony_ci * @link_id: id of the link used to receive the packet. This is used along with
154762306a36Sopenharmony_ci *	@link_valid.
154862306a36Sopenharmony_ci */
154962306a36Sopenharmony_cistruct ieee80211_rx_status {
155062306a36Sopenharmony_ci	u64 mactime;
155162306a36Sopenharmony_ci	union {
155262306a36Sopenharmony_ci		u64 boottime_ns;
155362306a36Sopenharmony_ci		ktime_t ack_tx_hwtstamp;
155462306a36Sopenharmony_ci	};
155562306a36Sopenharmony_ci	u32 device_timestamp;
155662306a36Sopenharmony_ci	u32 ampdu_reference;
155762306a36Sopenharmony_ci	u32 flag;
155862306a36Sopenharmony_ci	u16 freq: 13, freq_offset: 1;
155962306a36Sopenharmony_ci	u8 enc_flags;
156062306a36Sopenharmony_ci	u8 encoding:3, bw:4;
156162306a36Sopenharmony_ci	union {
156262306a36Sopenharmony_ci		struct {
156362306a36Sopenharmony_ci			u8 he_ru:3;
156462306a36Sopenharmony_ci			u8 he_gi:2;
156562306a36Sopenharmony_ci			u8 he_dcm:1;
156662306a36Sopenharmony_ci		};
156762306a36Sopenharmony_ci		struct {
156862306a36Sopenharmony_ci			u8 ru:4;
156962306a36Sopenharmony_ci			u8 gi:2;
157062306a36Sopenharmony_ci		} eht;
157162306a36Sopenharmony_ci	};
157262306a36Sopenharmony_ci	u8 rate_idx;
157362306a36Sopenharmony_ci	u8 nss;
157462306a36Sopenharmony_ci	u8 rx_flags;
157562306a36Sopenharmony_ci	u8 band;
157662306a36Sopenharmony_ci	u8 antenna;
157762306a36Sopenharmony_ci	s8 signal;
157862306a36Sopenharmony_ci	u8 chains;
157962306a36Sopenharmony_ci	s8 chain_signal[IEEE80211_MAX_CHAINS];
158062306a36Sopenharmony_ci	u8 ampdu_delimiter_crc;
158162306a36Sopenharmony_ci	u8 zero_length_psdu_type;
158262306a36Sopenharmony_ci	u8 link_valid:1, link_id:4;
158362306a36Sopenharmony_ci};
158462306a36Sopenharmony_ci
158562306a36Sopenharmony_cistatic inline u32
158662306a36Sopenharmony_ciieee80211_rx_status_to_khz(struct ieee80211_rx_status *rx_status)
158762306a36Sopenharmony_ci{
158862306a36Sopenharmony_ci	return MHZ_TO_KHZ(rx_status->freq) +
158962306a36Sopenharmony_ci	       (rx_status->freq_offset ? 500 : 0);
159062306a36Sopenharmony_ci}
159162306a36Sopenharmony_ci
159262306a36Sopenharmony_ci/**
159362306a36Sopenharmony_ci * enum ieee80211_conf_flags - configuration flags
159462306a36Sopenharmony_ci *
159562306a36Sopenharmony_ci * Flags to define PHY configuration options
159662306a36Sopenharmony_ci *
159762306a36Sopenharmony_ci * @IEEE80211_CONF_MONITOR: there's a monitor interface present -- use this
159862306a36Sopenharmony_ci *	to determine for example whether to calculate timestamps for packets
159962306a36Sopenharmony_ci *	or not, do not use instead of filter flags!
160062306a36Sopenharmony_ci * @IEEE80211_CONF_PS: Enable 802.11 power save mode (managed mode only).
160162306a36Sopenharmony_ci *	This is the power save mode defined by IEEE 802.11-2007 section 11.2,
160262306a36Sopenharmony_ci *	meaning that the hardware still wakes up for beacons, is able to
160362306a36Sopenharmony_ci *	transmit frames and receive the possible acknowledgment frames.
160462306a36Sopenharmony_ci *	Not to be confused with hardware specific wakeup/sleep states,
160562306a36Sopenharmony_ci *	driver is responsible for that. See the section "Powersave support"
160662306a36Sopenharmony_ci *	for more.
160762306a36Sopenharmony_ci * @IEEE80211_CONF_IDLE: The device is running, but idle; if the flag is set
160862306a36Sopenharmony_ci *	the driver should be prepared to handle configuration requests but
160962306a36Sopenharmony_ci *	may turn the device off as much as possible. Typically, this flag will
161062306a36Sopenharmony_ci *	be set when an interface is set UP but not associated or scanning, but
161162306a36Sopenharmony_ci *	it can also be unset in that case when monitor interfaces are active.
161262306a36Sopenharmony_ci * @IEEE80211_CONF_OFFCHANNEL: The device is currently not on its main
161362306a36Sopenharmony_ci *	operating channel.
161462306a36Sopenharmony_ci */
161562306a36Sopenharmony_cienum ieee80211_conf_flags {
161662306a36Sopenharmony_ci	IEEE80211_CONF_MONITOR		= (1<<0),
161762306a36Sopenharmony_ci	IEEE80211_CONF_PS		= (1<<1),
161862306a36Sopenharmony_ci	IEEE80211_CONF_IDLE		= (1<<2),
161962306a36Sopenharmony_ci	IEEE80211_CONF_OFFCHANNEL	= (1<<3),
162062306a36Sopenharmony_ci};
162162306a36Sopenharmony_ci
162262306a36Sopenharmony_ci
162362306a36Sopenharmony_ci/**
162462306a36Sopenharmony_ci * enum ieee80211_conf_changed - denotes which configuration changed
162562306a36Sopenharmony_ci *
162662306a36Sopenharmony_ci * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
162762306a36Sopenharmony_ci * @IEEE80211_CONF_CHANGE_MONITOR: the monitor flag changed
162862306a36Sopenharmony_ci * @IEEE80211_CONF_CHANGE_PS: the PS flag or dynamic PS timeout changed
162962306a36Sopenharmony_ci * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
163062306a36Sopenharmony_ci * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
163162306a36Sopenharmony_ci * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
163262306a36Sopenharmony_ci * @IEEE80211_CONF_CHANGE_IDLE: Idle flag changed
163362306a36Sopenharmony_ci * @IEEE80211_CONF_CHANGE_SMPS: Spatial multiplexing powersave mode changed
163462306a36Sopenharmony_ci *	Note that this is only valid if channel contexts are not used,
163562306a36Sopenharmony_ci *	otherwise each channel context has the number of chains listed.
163662306a36Sopenharmony_ci */
163762306a36Sopenharmony_cienum ieee80211_conf_changed {
163862306a36Sopenharmony_ci	IEEE80211_CONF_CHANGE_SMPS		= BIT(1),
163962306a36Sopenharmony_ci	IEEE80211_CONF_CHANGE_LISTEN_INTERVAL	= BIT(2),
164062306a36Sopenharmony_ci	IEEE80211_CONF_CHANGE_MONITOR		= BIT(3),
164162306a36Sopenharmony_ci	IEEE80211_CONF_CHANGE_PS		= BIT(4),
164262306a36Sopenharmony_ci	IEEE80211_CONF_CHANGE_POWER		= BIT(5),
164362306a36Sopenharmony_ci	IEEE80211_CONF_CHANGE_CHANNEL		= BIT(6),
164462306a36Sopenharmony_ci	IEEE80211_CONF_CHANGE_RETRY_LIMITS	= BIT(7),
164562306a36Sopenharmony_ci	IEEE80211_CONF_CHANGE_IDLE		= BIT(8),
164662306a36Sopenharmony_ci};
164762306a36Sopenharmony_ci
164862306a36Sopenharmony_ci/**
164962306a36Sopenharmony_ci * enum ieee80211_smps_mode - spatial multiplexing power save mode
165062306a36Sopenharmony_ci *
165162306a36Sopenharmony_ci * @IEEE80211_SMPS_AUTOMATIC: automatic
165262306a36Sopenharmony_ci * @IEEE80211_SMPS_OFF: off
165362306a36Sopenharmony_ci * @IEEE80211_SMPS_STATIC: static
165462306a36Sopenharmony_ci * @IEEE80211_SMPS_DYNAMIC: dynamic
165562306a36Sopenharmony_ci * @IEEE80211_SMPS_NUM_MODES: internal, don't use
165662306a36Sopenharmony_ci */
165762306a36Sopenharmony_cienum ieee80211_smps_mode {
165862306a36Sopenharmony_ci	IEEE80211_SMPS_AUTOMATIC,
165962306a36Sopenharmony_ci	IEEE80211_SMPS_OFF,
166062306a36Sopenharmony_ci	IEEE80211_SMPS_STATIC,
166162306a36Sopenharmony_ci	IEEE80211_SMPS_DYNAMIC,
166262306a36Sopenharmony_ci
166362306a36Sopenharmony_ci	/* keep last */
166462306a36Sopenharmony_ci	IEEE80211_SMPS_NUM_MODES,
166562306a36Sopenharmony_ci};
166662306a36Sopenharmony_ci
166762306a36Sopenharmony_ci/**
166862306a36Sopenharmony_ci * struct ieee80211_conf - configuration of the device
166962306a36Sopenharmony_ci *
167062306a36Sopenharmony_ci * This struct indicates how the driver shall configure the hardware.
167162306a36Sopenharmony_ci *
167262306a36Sopenharmony_ci * @flags: configuration flags defined above
167362306a36Sopenharmony_ci *
167462306a36Sopenharmony_ci * @listen_interval: listen interval in units of beacon interval
167562306a36Sopenharmony_ci * @ps_dtim_period: The DTIM period of the AP we're connected to, for use
167662306a36Sopenharmony_ci *	in power saving. Power saving will not be enabled until a beacon
167762306a36Sopenharmony_ci *	has been received and the DTIM period is known.
167862306a36Sopenharmony_ci * @dynamic_ps_timeout: The dynamic powersave timeout (in ms), see the
167962306a36Sopenharmony_ci *	powersave documentation below. This variable is valid only when
168062306a36Sopenharmony_ci *	the CONF_PS flag is set.
168162306a36Sopenharmony_ci *
168262306a36Sopenharmony_ci * @power_level: requested transmit power (in dBm), backward compatibility
168362306a36Sopenharmony_ci *	value only that is set to the minimum of all interfaces
168462306a36Sopenharmony_ci *
168562306a36Sopenharmony_ci * @chandef: the channel definition to tune to
168662306a36Sopenharmony_ci * @radar_enabled: whether radar detection is enabled
168762306a36Sopenharmony_ci *
168862306a36Sopenharmony_ci * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
168962306a36Sopenharmony_ci *	(a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
169062306a36Sopenharmony_ci *	but actually means the number of transmissions not the number of retries
169162306a36Sopenharmony_ci * @short_frame_max_tx_count: Maximum number of transmissions for a "short"
169262306a36Sopenharmony_ci *	frame, called "dot11ShortRetryLimit" in 802.11, but actually means the
169362306a36Sopenharmony_ci *	number of transmissions not the number of retries
169462306a36Sopenharmony_ci *
169562306a36Sopenharmony_ci * @smps_mode: spatial multiplexing powersave mode; note that
169662306a36Sopenharmony_ci *	%IEEE80211_SMPS_STATIC is used when the device is not
169762306a36Sopenharmony_ci *	configured for an HT channel.
169862306a36Sopenharmony_ci *	Note that this is only valid if channel contexts are not used,
169962306a36Sopenharmony_ci *	otherwise each channel context has the number of chains listed.
170062306a36Sopenharmony_ci */
170162306a36Sopenharmony_cistruct ieee80211_conf {
170262306a36Sopenharmony_ci	u32 flags;
170362306a36Sopenharmony_ci	int power_level, dynamic_ps_timeout;
170462306a36Sopenharmony_ci
170562306a36Sopenharmony_ci	u16 listen_interval;
170662306a36Sopenharmony_ci	u8 ps_dtim_period;
170762306a36Sopenharmony_ci
170862306a36Sopenharmony_ci	u8 long_frame_max_tx_count, short_frame_max_tx_count;
170962306a36Sopenharmony_ci
171062306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
171162306a36Sopenharmony_ci	bool radar_enabled;
171262306a36Sopenharmony_ci	enum ieee80211_smps_mode smps_mode;
171362306a36Sopenharmony_ci};
171462306a36Sopenharmony_ci
171562306a36Sopenharmony_ci/**
171662306a36Sopenharmony_ci * struct ieee80211_channel_switch - holds the channel switch data
171762306a36Sopenharmony_ci *
171862306a36Sopenharmony_ci * The information provided in this structure is required for channel switch
171962306a36Sopenharmony_ci * operation.
172062306a36Sopenharmony_ci *
172162306a36Sopenharmony_ci * @timestamp: value in microseconds of the 64-bit Time Synchronization
172262306a36Sopenharmony_ci *	Function (TSF) timer when the frame containing the channel switch
172362306a36Sopenharmony_ci *	announcement was received. This is simply the rx.mactime parameter
172462306a36Sopenharmony_ci *	the driver passed into mac80211.
172562306a36Sopenharmony_ci * @device_timestamp: arbitrary timestamp for the device, this is the
172662306a36Sopenharmony_ci *	rx.device_timestamp parameter the driver passed to mac80211.
172762306a36Sopenharmony_ci * @block_tx: Indicates whether transmission must be blocked before the
172862306a36Sopenharmony_ci *	scheduled channel switch, as indicated by the AP.
172962306a36Sopenharmony_ci * @chandef: the new channel to switch to
173062306a36Sopenharmony_ci * @count: the number of TBTT's until the channel switch event
173162306a36Sopenharmony_ci * @delay: maximum delay between the time the AP transmitted the last beacon in
173262306a36Sopenharmony_ci  *	current channel and the expected time of the first beacon in the new
173362306a36Sopenharmony_ci  *	channel, expressed in TU.
173462306a36Sopenharmony_ci */
173562306a36Sopenharmony_cistruct ieee80211_channel_switch {
173662306a36Sopenharmony_ci	u64 timestamp;
173762306a36Sopenharmony_ci	u32 device_timestamp;
173862306a36Sopenharmony_ci	bool block_tx;
173962306a36Sopenharmony_ci	struct cfg80211_chan_def chandef;
174062306a36Sopenharmony_ci	u8 count;
174162306a36Sopenharmony_ci	u32 delay;
174262306a36Sopenharmony_ci};
174362306a36Sopenharmony_ci
174462306a36Sopenharmony_ci/**
174562306a36Sopenharmony_ci * enum ieee80211_vif_flags - virtual interface flags
174662306a36Sopenharmony_ci *
174762306a36Sopenharmony_ci * @IEEE80211_VIF_BEACON_FILTER: the device performs beacon filtering
174862306a36Sopenharmony_ci *	on this virtual interface to avoid unnecessary CPU wakeups
174962306a36Sopenharmony_ci * @IEEE80211_VIF_SUPPORTS_CQM_RSSI: the device can do connection quality
175062306a36Sopenharmony_ci *	monitoring on this virtual interface -- i.e. it can monitor
175162306a36Sopenharmony_ci *	connection quality related parameters, such as the RSSI level and
175262306a36Sopenharmony_ci *	provide notifications if configured trigger levels are reached.
175362306a36Sopenharmony_ci * @IEEE80211_VIF_SUPPORTS_UAPSD: The device can do U-APSD for this
175462306a36Sopenharmony_ci *	interface. This flag should be set during interface addition,
175562306a36Sopenharmony_ci *	but may be set/cleared as late as authentication to an AP. It is
175662306a36Sopenharmony_ci *	only valid for managed/station mode interfaces.
175762306a36Sopenharmony_ci * @IEEE80211_VIF_GET_NOA_UPDATE: request to handle NOA attributes
175862306a36Sopenharmony_ci *	and send P2P_PS notification to the driver if NOA changed, even
175962306a36Sopenharmony_ci *	this is not pure P2P vif.
176062306a36Sopenharmony_ci * @IEEE80211_VIF_DISABLE_SMPS_OVERRIDE: disable user configuration of
176162306a36Sopenharmony_ci *	SMPS mode via debugfs.
176262306a36Sopenharmony_ci */
176362306a36Sopenharmony_cienum ieee80211_vif_flags {
176462306a36Sopenharmony_ci	IEEE80211_VIF_BEACON_FILTER		= BIT(0),
176562306a36Sopenharmony_ci	IEEE80211_VIF_SUPPORTS_CQM_RSSI		= BIT(1),
176662306a36Sopenharmony_ci	IEEE80211_VIF_SUPPORTS_UAPSD		= BIT(2),
176762306a36Sopenharmony_ci	IEEE80211_VIF_GET_NOA_UPDATE		= BIT(3),
176862306a36Sopenharmony_ci	IEEE80211_VIF_DISABLE_SMPS_OVERRIDE	= BIT(4),
176962306a36Sopenharmony_ci};
177062306a36Sopenharmony_ci
177162306a36Sopenharmony_ci
177262306a36Sopenharmony_ci/**
177362306a36Sopenharmony_ci * enum ieee80211_offload_flags - virtual interface offload flags
177462306a36Sopenharmony_ci *
177562306a36Sopenharmony_ci * @IEEE80211_OFFLOAD_ENCAP_ENABLED: tx encapsulation offload is enabled
177662306a36Sopenharmony_ci *	The driver supports sending frames passed as 802.3 frames by mac80211.
177762306a36Sopenharmony_ci *	It must also support sending 802.11 packets for the same interface.
177862306a36Sopenharmony_ci * @IEEE80211_OFFLOAD_ENCAP_4ADDR: support 4-address mode encapsulation offload
177962306a36Sopenharmony_ci * @IEEE80211_OFFLOAD_DECAP_ENABLED: rx encapsulation offload is enabled
178062306a36Sopenharmony_ci *	The driver supports passing received 802.11 frames as 802.3 frames to
178162306a36Sopenharmony_ci *	mac80211.
178262306a36Sopenharmony_ci */
178362306a36Sopenharmony_ci
178462306a36Sopenharmony_cienum ieee80211_offload_flags {
178562306a36Sopenharmony_ci	IEEE80211_OFFLOAD_ENCAP_ENABLED		= BIT(0),
178662306a36Sopenharmony_ci	IEEE80211_OFFLOAD_ENCAP_4ADDR		= BIT(1),
178762306a36Sopenharmony_ci	IEEE80211_OFFLOAD_DECAP_ENABLED		= BIT(2),
178862306a36Sopenharmony_ci};
178962306a36Sopenharmony_ci
179062306a36Sopenharmony_ci/**
179162306a36Sopenharmony_ci * struct ieee80211_vif_cfg - interface configuration
179262306a36Sopenharmony_ci * @assoc: association status
179362306a36Sopenharmony_ci * @ibss_joined: indicates whether this station is part of an IBSS or not
179462306a36Sopenharmony_ci * @ibss_creator: indicates if a new IBSS network is being created
179562306a36Sopenharmony_ci * @ps: power-save mode (STA only). This flag is NOT affected by
179662306a36Sopenharmony_ci *	offchannel/dynamic_ps operations.
179762306a36Sopenharmony_ci * @aid: association ID number, valid only when @assoc is true
179862306a36Sopenharmony_ci * @eml_cap: EML capabilities as described in P802.11be_D2.2 Figure 9-1002k.
179962306a36Sopenharmony_ci * @eml_med_sync_delay: Medium Synchronization delay as described in
180062306a36Sopenharmony_ci *	P802.11be_D2.2 Figure 9-1002j.
180162306a36Sopenharmony_ci * @arp_addr_list: List of IPv4 addresses for hardware ARP filtering. The
180262306a36Sopenharmony_ci *	may filter ARP queries targeted for other addresses than listed here.
180362306a36Sopenharmony_ci *	The driver must allow ARP queries targeted for all address listed here
180462306a36Sopenharmony_ci *	to pass through. An empty list implies no ARP queries need to pass.
180562306a36Sopenharmony_ci * @arp_addr_cnt: Number of addresses currently on the list. Note that this
180662306a36Sopenharmony_ci *	may be larger than %IEEE80211_BSS_ARP_ADDR_LIST_LEN (the arp_addr_list
180762306a36Sopenharmony_ci *	array size), it's up to the driver what to do in that case.
180862306a36Sopenharmony_ci * @ssid: The SSID of the current vif. Valid in AP and IBSS mode.
180962306a36Sopenharmony_ci * @ssid_len: Length of SSID given in @ssid.
181062306a36Sopenharmony_ci * @s1g: BSS is S1G BSS (affects Association Request format).
181162306a36Sopenharmony_ci * @idle: This interface is idle. There's also a global idle flag in the
181262306a36Sopenharmony_ci *	hardware config which may be more appropriate depending on what
181362306a36Sopenharmony_ci *	your driver/device needs to do.
181462306a36Sopenharmony_ci * @ap_addr: AP MLD address, or BSSID for non-MLO connections
181562306a36Sopenharmony_ci *	(station mode only)
181662306a36Sopenharmony_ci */
181762306a36Sopenharmony_cistruct ieee80211_vif_cfg {
181862306a36Sopenharmony_ci	/* association related data */
181962306a36Sopenharmony_ci	bool assoc, ibss_joined;
182062306a36Sopenharmony_ci	bool ibss_creator;
182162306a36Sopenharmony_ci	bool ps;
182262306a36Sopenharmony_ci	u16 aid;
182362306a36Sopenharmony_ci	u16 eml_cap;
182462306a36Sopenharmony_ci	u16 eml_med_sync_delay;
182562306a36Sopenharmony_ci
182662306a36Sopenharmony_ci	__be32 arp_addr_list[IEEE80211_BSS_ARP_ADDR_LIST_LEN];
182762306a36Sopenharmony_ci	int arp_addr_cnt;
182862306a36Sopenharmony_ci	u8 ssid[IEEE80211_MAX_SSID_LEN];
182962306a36Sopenharmony_ci	size_t ssid_len;
183062306a36Sopenharmony_ci	bool s1g;
183162306a36Sopenharmony_ci	bool idle;
183262306a36Sopenharmony_ci	u8 ap_addr[ETH_ALEN] __aligned(2);
183362306a36Sopenharmony_ci};
183462306a36Sopenharmony_ci
183562306a36Sopenharmony_ci/**
183662306a36Sopenharmony_ci * struct ieee80211_vif - per-interface data
183762306a36Sopenharmony_ci *
183862306a36Sopenharmony_ci * Data in this structure is continually present for driver
183962306a36Sopenharmony_ci * use during the life of a virtual interface.
184062306a36Sopenharmony_ci *
184162306a36Sopenharmony_ci * @type: type of this virtual interface
184262306a36Sopenharmony_ci * @cfg: vif configuration, see &struct ieee80211_vif_cfg
184362306a36Sopenharmony_ci * @bss_conf: BSS configuration for this interface, either our own
184462306a36Sopenharmony_ci *	or the BSS we're associated to
184562306a36Sopenharmony_ci * @link_conf: in case of MLD, the per-link BSS configuration,
184662306a36Sopenharmony_ci *	indexed by link ID
184762306a36Sopenharmony_ci * @valid_links: bitmap of valid links, or 0 for non-MLO.
184862306a36Sopenharmony_ci * @active_links: The bitmap of active links, or 0 for non-MLO.
184962306a36Sopenharmony_ci *	The driver shouldn't change this directly, but use the
185062306a36Sopenharmony_ci *	API calls meant for that purpose.
185162306a36Sopenharmony_ci * @dormant_links: bitmap of valid but disabled links, or 0 for non-MLO.
185262306a36Sopenharmony_ci *	Must be a subset of valid_links.
185362306a36Sopenharmony_ci * @addr: address of this interface
185462306a36Sopenharmony_ci * @p2p: indicates whether this AP or STA interface is a p2p
185562306a36Sopenharmony_ci *	interface, i.e. a GO or p2p-sta respectively
185662306a36Sopenharmony_ci * @netdev_features: tx netdev features supported by the hardware for this
185762306a36Sopenharmony_ci *	vif. mac80211 initializes this to hw->netdev_features, and the driver
185862306a36Sopenharmony_ci *	can mask out specific tx features. mac80211 will handle software fixup
185962306a36Sopenharmony_ci *	for masked offloads (GSO, CSUM)
186062306a36Sopenharmony_ci * @driver_flags: flags/capabilities the driver has for this interface,
186162306a36Sopenharmony_ci *	these need to be set (or cleared) when the interface is added
186262306a36Sopenharmony_ci *	or, if supported by the driver, the interface type is changed
186362306a36Sopenharmony_ci *	at runtime, mac80211 will never touch this field
186462306a36Sopenharmony_ci * @offload_flags: hardware offload capabilities/flags for this interface.
186562306a36Sopenharmony_ci *	These are initialized by mac80211 before calling .add_interface,
186662306a36Sopenharmony_ci *	.change_interface or .update_vif_offload and updated by the driver
186762306a36Sopenharmony_ci *	within these ops, based on supported features or runtime change
186862306a36Sopenharmony_ci *	restrictions.
186962306a36Sopenharmony_ci * @hw_queue: hardware queue for each AC
187062306a36Sopenharmony_ci * @cab_queue: content-after-beacon (DTIM beacon really) queue, AP mode only
187162306a36Sopenharmony_ci * @debugfs_dir: debugfs dentry, can be used by drivers to create own per
187262306a36Sopenharmony_ci *	interface debug files. Note that it will be NULL for the virtual
187362306a36Sopenharmony_ci *	monitor interface (if that is requested.)
187462306a36Sopenharmony_ci * @probe_req_reg: probe requests should be reported to mac80211 for this
187562306a36Sopenharmony_ci *	interface.
187662306a36Sopenharmony_ci * @rx_mcast_action_reg: multicast Action frames should be reported to mac80211
187762306a36Sopenharmony_ci *	for this interface.
187862306a36Sopenharmony_ci * @drv_priv: data area for driver use, will always be aligned to
187962306a36Sopenharmony_ci *	sizeof(void \*).
188062306a36Sopenharmony_ci * @txq: the multicast data TX queue
188162306a36Sopenharmony_ci * @offload_flags: 802.3 -> 802.11 enapsulation offload flags, see
188262306a36Sopenharmony_ci *	&enum ieee80211_offload_flags.
188362306a36Sopenharmony_ci * @mbssid_tx_vif: Pointer to the transmitting interface if MBSSID is enabled.
188462306a36Sopenharmony_ci */
188562306a36Sopenharmony_cistruct ieee80211_vif {
188662306a36Sopenharmony_ci	enum nl80211_iftype type;
188762306a36Sopenharmony_ci	struct ieee80211_vif_cfg cfg;
188862306a36Sopenharmony_ci	struct ieee80211_bss_conf bss_conf;
188962306a36Sopenharmony_ci	struct ieee80211_bss_conf __rcu *link_conf[IEEE80211_MLD_MAX_NUM_LINKS];
189062306a36Sopenharmony_ci	u16 valid_links, active_links, dormant_links;
189162306a36Sopenharmony_ci	u8 addr[ETH_ALEN] __aligned(2);
189262306a36Sopenharmony_ci	bool p2p;
189362306a36Sopenharmony_ci
189462306a36Sopenharmony_ci	u8 cab_queue;
189562306a36Sopenharmony_ci	u8 hw_queue[IEEE80211_NUM_ACS];
189662306a36Sopenharmony_ci
189762306a36Sopenharmony_ci	struct ieee80211_txq *txq;
189862306a36Sopenharmony_ci
189962306a36Sopenharmony_ci	netdev_features_t netdev_features;
190062306a36Sopenharmony_ci	u32 driver_flags;
190162306a36Sopenharmony_ci	u32 offload_flags;
190262306a36Sopenharmony_ci
190362306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_DEBUGFS
190462306a36Sopenharmony_ci	struct dentry *debugfs_dir;
190562306a36Sopenharmony_ci#endif
190662306a36Sopenharmony_ci
190762306a36Sopenharmony_ci	bool probe_req_reg;
190862306a36Sopenharmony_ci	bool rx_mcast_action_reg;
190962306a36Sopenharmony_ci
191062306a36Sopenharmony_ci	struct ieee80211_vif *mbssid_tx_vif;
191162306a36Sopenharmony_ci
191262306a36Sopenharmony_ci	/* must be last */
191362306a36Sopenharmony_ci	u8 drv_priv[] __aligned(sizeof(void *));
191462306a36Sopenharmony_ci};
191562306a36Sopenharmony_ci
191662306a36Sopenharmony_ci/**
191762306a36Sopenharmony_ci * ieee80211_vif_usable_links - Return the usable links for the vif
191862306a36Sopenharmony_ci * @vif: the vif for which the usable links are requested
191962306a36Sopenharmony_ci * Return: the usable link bitmap
192062306a36Sopenharmony_ci */
192162306a36Sopenharmony_cistatic inline u16 ieee80211_vif_usable_links(const struct ieee80211_vif *vif)
192262306a36Sopenharmony_ci{
192362306a36Sopenharmony_ci	return vif->valid_links & ~vif->dormant_links;
192462306a36Sopenharmony_ci}
192562306a36Sopenharmony_ci
192662306a36Sopenharmony_ci/**
192762306a36Sopenharmony_ci * ieee80211_vif_is_mld - Returns true iff the vif is an MLD one
192862306a36Sopenharmony_ci * @vif: the vif
192962306a36Sopenharmony_ci * Return: %true if the vif is an MLD, %false otherwise.
193062306a36Sopenharmony_ci */
193162306a36Sopenharmony_cistatic inline bool ieee80211_vif_is_mld(const struct ieee80211_vif *vif)
193262306a36Sopenharmony_ci{
193362306a36Sopenharmony_ci	/* valid_links != 0 indicates this vif is an MLD */
193462306a36Sopenharmony_ci	return vif->valid_links != 0;
193562306a36Sopenharmony_ci}
193662306a36Sopenharmony_ci
193762306a36Sopenharmony_ci#define for_each_vif_active_link(vif, link, link_id)				\
193862306a36Sopenharmony_ci	for (link_id = 0; link_id < ARRAY_SIZE((vif)->link_conf); link_id++)	\
193962306a36Sopenharmony_ci		if ((!(vif)->active_links ||					\
194062306a36Sopenharmony_ci		     (vif)->active_links & BIT(link_id)) &&			\
194162306a36Sopenharmony_ci		    (link = rcu_dereference((vif)->link_conf[link_id])))
194262306a36Sopenharmony_ci
194362306a36Sopenharmony_cistatic inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
194462306a36Sopenharmony_ci{
194562306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_MESH
194662306a36Sopenharmony_ci	return vif->type == NL80211_IFTYPE_MESH_POINT;
194762306a36Sopenharmony_ci#endif
194862306a36Sopenharmony_ci	return false;
194962306a36Sopenharmony_ci}
195062306a36Sopenharmony_ci
195162306a36Sopenharmony_ci/**
195262306a36Sopenharmony_ci * wdev_to_ieee80211_vif - return a vif struct from a wdev
195362306a36Sopenharmony_ci * @wdev: the wdev to get the vif for
195462306a36Sopenharmony_ci *
195562306a36Sopenharmony_ci * This can be used by mac80211 drivers with direct cfg80211 APIs
195662306a36Sopenharmony_ci * (like the vendor commands) that get a wdev.
195762306a36Sopenharmony_ci *
195862306a36Sopenharmony_ci * Note that this function may return %NULL if the given wdev isn't
195962306a36Sopenharmony_ci * associated with a vif that the driver knows about (e.g. monitor
196062306a36Sopenharmony_ci * or AP_VLAN interfaces.)
196162306a36Sopenharmony_ci */
196262306a36Sopenharmony_cistruct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
196362306a36Sopenharmony_ci
196462306a36Sopenharmony_ci/**
196562306a36Sopenharmony_ci * ieee80211_vif_to_wdev - return a wdev struct from a vif
196662306a36Sopenharmony_ci * @vif: the vif to get the wdev for
196762306a36Sopenharmony_ci *
196862306a36Sopenharmony_ci * This can be used by mac80211 drivers with direct cfg80211 APIs
196962306a36Sopenharmony_ci * (like the vendor commands) that needs to get the wdev for a vif.
197062306a36Sopenharmony_ci * This can also be useful to get the netdev associated to a vif.
197162306a36Sopenharmony_ci */
197262306a36Sopenharmony_cistruct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif);
197362306a36Sopenharmony_ci
197462306a36Sopenharmony_ci/**
197562306a36Sopenharmony_ci * lockdep_vif_mutex_held - for lockdep checks on link poiners
197662306a36Sopenharmony_ci * @vif: the interface to check
197762306a36Sopenharmony_ci */
197862306a36Sopenharmony_cistatic inline bool lockdep_vif_mutex_held(struct ieee80211_vif *vif)
197962306a36Sopenharmony_ci{
198062306a36Sopenharmony_ci	return lockdep_is_held(&ieee80211_vif_to_wdev(vif)->mtx);
198162306a36Sopenharmony_ci}
198262306a36Sopenharmony_ci
198362306a36Sopenharmony_ci#define link_conf_dereference_protected(vif, link_id)		\
198462306a36Sopenharmony_ci	rcu_dereference_protected((vif)->link_conf[link_id],	\
198562306a36Sopenharmony_ci				  lockdep_vif_mutex_held(vif))
198662306a36Sopenharmony_ci
198762306a36Sopenharmony_ci#define link_conf_dereference_check(vif, link_id)		\
198862306a36Sopenharmony_ci	rcu_dereference_check((vif)->link_conf[link_id],	\
198962306a36Sopenharmony_ci			      lockdep_vif_mutex_held(vif))
199062306a36Sopenharmony_ci
199162306a36Sopenharmony_ci/**
199262306a36Sopenharmony_ci * enum ieee80211_key_flags - key flags
199362306a36Sopenharmony_ci *
199462306a36Sopenharmony_ci * These flags are used for communication about keys between the driver
199562306a36Sopenharmony_ci * and mac80211, with the @flags parameter of &struct ieee80211_key_conf.
199662306a36Sopenharmony_ci *
199762306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_GENERATE_IV: This flag should be set by the
199862306a36Sopenharmony_ci *	driver to indicate that it requires IV generation for this
199962306a36Sopenharmony_ci *	particular key. Setting this flag does not necessarily mean that SKBs
200062306a36Sopenharmony_ci *	will have sufficient tailroom for ICV or MIC.
200162306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_GENERATE_MMIC: This flag should be set by
200262306a36Sopenharmony_ci *	the driver for a TKIP key if it requires Michael MIC
200362306a36Sopenharmony_ci *	generation in software.
200462306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
200562306a36Sopenharmony_ci *	that the key is pairwise rather then a shared key.
200662306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_SW_MGMT_TX: This flag should be set by the driver for a
200762306a36Sopenharmony_ci *	CCMP/GCMP key if it requires CCMP/GCMP encryption of management frames
200862306a36Sopenharmony_ci *	(MFP) to be done in software.
200962306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_PUT_IV_SPACE: This flag should be set by the driver
201062306a36Sopenharmony_ci *	if space should be prepared for the IV, but the IV
201162306a36Sopenharmony_ci *	itself should not be generated. Do not set together with
201262306a36Sopenharmony_ci *	@IEEE80211_KEY_FLAG_GENERATE_IV on the same key. Setting this flag does
201362306a36Sopenharmony_ci *	not necessarily mean that SKBs will have sufficient tailroom for ICV or
201462306a36Sopenharmony_ci *	MIC.
201562306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_RX_MGMT: This key will be used to decrypt received
201662306a36Sopenharmony_ci *	management frames. The flag can help drivers that have a hardware
201762306a36Sopenharmony_ci *	crypto implementation that doesn't deal with management frames
201862306a36Sopenharmony_ci *	properly by allowing them to not upload the keys to hardware and
201962306a36Sopenharmony_ci *	fall back to software crypto. Note that this flag deals only with
202062306a36Sopenharmony_ci *	RX, if your crypto engine can't deal with TX you can also set the
202162306a36Sopenharmony_ci *	%IEEE80211_KEY_FLAG_SW_MGMT_TX flag to encrypt such frames in SW.
202262306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_GENERATE_IV_MGMT: This flag should be set by the
202362306a36Sopenharmony_ci *	driver for a CCMP/GCMP key to indicate that is requires IV generation
202462306a36Sopenharmony_ci *	only for management frames (MFP).
202562306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_RESERVE_TAILROOM: This flag should be set by the
202662306a36Sopenharmony_ci *	driver for a key to indicate that sufficient tailroom must always
202762306a36Sopenharmony_ci *	be reserved for ICV or MIC, even when HW encryption is enabled.
202862306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_PUT_MIC_SPACE: This flag should be set by the driver for
202962306a36Sopenharmony_ci *	a TKIP key if it only requires MIC space. Do not set together with
203062306a36Sopenharmony_ci *	@IEEE80211_KEY_FLAG_GENERATE_MMIC on the same key.
203162306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_NO_AUTO_TX: Key needs explicit Tx activation.
203262306a36Sopenharmony_ci * @IEEE80211_KEY_FLAG_GENERATE_MMIE: This flag should be set by the driver
203362306a36Sopenharmony_ci *	for a AES_CMAC key to indicate that it requires sequence number
203462306a36Sopenharmony_ci *	generation only
203562306a36Sopenharmony_ci */
203662306a36Sopenharmony_cienum ieee80211_key_flags {
203762306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_GENERATE_IV_MGMT	= BIT(0),
203862306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_GENERATE_IV		= BIT(1),
203962306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_GENERATE_MMIC	= BIT(2),
204062306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_PAIRWISE		= BIT(3),
204162306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_SW_MGMT_TX		= BIT(4),
204262306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_PUT_IV_SPACE		= BIT(5),
204362306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_RX_MGMT		= BIT(6),
204462306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_RESERVE_TAILROOM	= BIT(7),
204562306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_PUT_MIC_SPACE	= BIT(8),
204662306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_NO_AUTO_TX		= BIT(9),
204762306a36Sopenharmony_ci	IEEE80211_KEY_FLAG_GENERATE_MMIE	= BIT(10),
204862306a36Sopenharmony_ci};
204962306a36Sopenharmony_ci
205062306a36Sopenharmony_ci/**
205162306a36Sopenharmony_ci * struct ieee80211_key_conf - key information
205262306a36Sopenharmony_ci *
205362306a36Sopenharmony_ci * This key information is given by mac80211 to the driver by
205462306a36Sopenharmony_ci * the set_key() callback in &struct ieee80211_ops.
205562306a36Sopenharmony_ci *
205662306a36Sopenharmony_ci * @hw_key_idx: To be set by the driver, this is the key index the driver
205762306a36Sopenharmony_ci *	wants to be given when a frame is transmitted and needs to be
205862306a36Sopenharmony_ci *	encrypted in hardware.
205962306a36Sopenharmony_ci * @cipher: The key's cipher suite selector.
206062306a36Sopenharmony_ci * @tx_pn: PN used for TX keys, may be used by the driver as well if it
206162306a36Sopenharmony_ci *	needs to do software PN assignment by itself (e.g. due to TSO)
206262306a36Sopenharmony_ci * @flags: key flags, see &enum ieee80211_key_flags.
206362306a36Sopenharmony_ci * @keyidx: the key index (0-3)
206462306a36Sopenharmony_ci * @keylen: key material length
206562306a36Sopenharmony_ci * @key: key material. For ALG_TKIP the key is encoded as a 256-bit (32 byte)
206662306a36Sopenharmony_ci * 	data block:
206762306a36Sopenharmony_ci * 	- Temporal Encryption Key (128 bits)
206862306a36Sopenharmony_ci * 	- Temporal Authenticator Tx MIC Key (64 bits)
206962306a36Sopenharmony_ci * 	- Temporal Authenticator Rx MIC Key (64 bits)
207062306a36Sopenharmony_ci * @icv_len: The ICV length for this key type
207162306a36Sopenharmony_ci * @iv_len: The IV length for this key type
207262306a36Sopenharmony_ci * @link_id: the link ID for MLO, or -1 for non-MLO or pairwise keys
207362306a36Sopenharmony_ci */
207462306a36Sopenharmony_cistruct ieee80211_key_conf {
207562306a36Sopenharmony_ci	atomic64_t tx_pn;
207662306a36Sopenharmony_ci	u32 cipher;
207762306a36Sopenharmony_ci	u8 icv_len;
207862306a36Sopenharmony_ci	u8 iv_len;
207962306a36Sopenharmony_ci	u8 hw_key_idx;
208062306a36Sopenharmony_ci	s8 keyidx;
208162306a36Sopenharmony_ci	u16 flags;
208262306a36Sopenharmony_ci	s8 link_id;
208362306a36Sopenharmony_ci	u8 keylen;
208462306a36Sopenharmony_ci	u8 key[];
208562306a36Sopenharmony_ci};
208662306a36Sopenharmony_ci
208762306a36Sopenharmony_ci#define IEEE80211_MAX_PN_LEN	16
208862306a36Sopenharmony_ci
208962306a36Sopenharmony_ci#define TKIP_PN_TO_IV16(pn) ((u16)(pn & 0xffff))
209062306a36Sopenharmony_ci#define TKIP_PN_TO_IV32(pn) ((u32)((pn >> 16) & 0xffffffff))
209162306a36Sopenharmony_ci
209262306a36Sopenharmony_ci/**
209362306a36Sopenharmony_ci * struct ieee80211_key_seq - key sequence counter
209462306a36Sopenharmony_ci *
209562306a36Sopenharmony_ci * @tkip: TKIP data, containing IV32 and IV16 in host byte order
209662306a36Sopenharmony_ci * @ccmp: PN data, most significant byte first (big endian,
209762306a36Sopenharmony_ci *	reverse order than in packet)
209862306a36Sopenharmony_ci * @aes_cmac: PN data, most significant byte first (big endian,
209962306a36Sopenharmony_ci *	reverse order than in packet)
210062306a36Sopenharmony_ci * @aes_gmac: PN data, most significant byte first (big endian,
210162306a36Sopenharmony_ci *	reverse order than in packet)
210262306a36Sopenharmony_ci * @gcmp: PN data, most significant byte first (big endian,
210362306a36Sopenharmony_ci *	reverse order than in packet)
210462306a36Sopenharmony_ci * @hw: data for HW-only (e.g. cipher scheme) keys
210562306a36Sopenharmony_ci */
210662306a36Sopenharmony_cistruct ieee80211_key_seq {
210762306a36Sopenharmony_ci	union {
210862306a36Sopenharmony_ci		struct {
210962306a36Sopenharmony_ci			u32 iv32;
211062306a36Sopenharmony_ci			u16 iv16;
211162306a36Sopenharmony_ci		} tkip;
211262306a36Sopenharmony_ci		struct {
211362306a36Sopenharmony_ci			u8 pn[6];
211462306a36Sopenharmony_ci		} ccmp;
211562306a36Sopenharmony_ci		struct {
211662306a36Sopenharmony_ci			u8 pn[6];
211762306a36Sopenharmony_ci		} aes_cmac;
211862306a36Sopenharmony_ci		struct {
211962306a36Sopenharmony_ci			u8 pn[6];
212062306a36Sopenharmony_ci		} aes_gmac;
212162306a36Sopenharmony_ci		struct {
212262306a36Sopenharmony_ci			u8 pn[6];
212362306a36Sopenharmony_ci		} gcmp;
212462306a36Sopenharmony_ci		struct {
212562306a36Sopenharmony_ci			u8 seq[IEEE80211_MAX_PN_LEN];
212662306a36Sopenharmony_ci			u8 seq_len;
212762306a36Sopenharmony_ci		} hw;
212862306a36Sopenharmony_ci	};
212962306a36Sopenharmony_ci};
213062306a36Sopenharmony_ci
213162306a36Sopenharmony_ci/**
213262306a36Sopenharmony_ci * enum set_key_cmd - key command
213362306a36Sopenharmony_ci *
213462306a36Sopenharmony_ci * Used with the set_key() callback in &struct ieee80211_ops, this
213562306a36Sopenharmony_ci * indicates whether a key is being removed or added.
213662306a36Sopenharmony_ci *
213762306a36Sopenharmony_ci * @SET_KEY: a key is set
213862306a36Sopenharmony_ci * @DISABLE_KEY: a key must be disabled
213962306a36Sopenharmony_ci */
214062306a36Sopenharmony_cienum set_key_cmd {
214162306a36Sopenharmony_ci	SET_KEY, DISABLE_KEY,
214262306a36Sopenharmony_ci};
214362306a36Sopenharmony_ci
214462306a36Sopenharmony_ci/**
214562306a36Sopenharmony_ci * enum ieee80211_sta_state - station state
214662306a36Sopenharmony_ci *
214762306a36Sopenharmony_ci * @IEEE80211_STA_NOTEXIST: station doesn't exist at all,
214862306a36Sopenharmony_ci *	this is a special state for add/remove transitions
214962306a36Sopenharmony_ci * @IEEE80211_STA_NONE: station exists without special state
215062306a36Sopenharmony_ci * @IEEE80211_STA_AUTH: station is authenticated
215162306a36Sopenharmony_ci * @IEEE80211_STA_ASSOC: station is associated
215262306a36Sopenharmony_ci * @IEEE80211_STA_AUTHORIZED: station is authorized (802.1X)
215362306a36Sopenharmony_ci */
215462306a36Sopenharmony_cienum ieee80211_sta_state {
215562306a36Sopenharmony_ci	/* NOTE: These need to be ordered correctly! */
215662306a36Sopenharmony_ci	IEEE80211_STA_NOTEXIST,
215762306a36Sopenharmony_ci	IEEE80211_STA_NONE,
215862306a36Sopenharmony_ci	IEEE80211_STA_AUTH,
215962306a36Sopenharmony_ci	IEEE80211_STA_ASSOC,
216062306a36Sopenharmony_ci	IEEE80211_STA_AUTHORIZED,
216162306a36Sopenharmony_ci};
216262306a36Sopenharmony_ci
216362306a36Sopenharmony_ci/**
216462306a36Sopenharmony_ci * enum ieee80211_sta_rx_bandwidth - station RX bandwidth
216562306a36Sopenharmony_ci * @IEEE80211_STA_RX_BW_20: station can only receive 20 MHz
216662306a36Sopenharmony_ci * @IEEE80211_STA_RX_BW_40: station can receive up to 40 MHz
216762306a36Sopenharmony_ci * @IEEE80211_STA_RX_BW_80: station can receive up to 80 MHz
216862306a36Sopenharmony_ci * @IEEE80211_STA_RX_BW_160: station can receive up to 160 MHz
216962306a36Sopenharmony_ci *	(including 80+80 MHz)
217062306a36Sopenharmony_ci * @IEEE80211_STA_RX_BW_320: station can receive up to 320 MHz
217162306a36Sopenharmony_ci *
217262306a36Sopenharmony_ci * Implementation note: 20 must be zero to be initialized
217362306a36Sopenharmony_ci *	correctly, the values must be sorted.
217462306a36Sopenharmony_ci */
217562306a36Sopenharmony_cienum ieee80211_sta_rx_bandwidth {
217662306a36Sopenharmony_ci	IEEE80211_STA_RX_BW_20 = 0,
217762306a36Sopenharmony_ci	IEEE80211_STA_RX_BW_40,
217862306a36Sopenharmony_ci	IEEE80211_STA_RX_BW_80,
217962306a36Sopenharmony_ci	IEEE80211_STA_RX_BW_160,
218062306a36Sopenharmony_ci	IEEE80211_STA_RX_BW_320,
218162306a36Sopenharmony_ci};
218262306a36Sopenharmony_ci
218362306a36Sopenharmony_ci/**
218462306a36Sopenharmony_ci * struct ieee80211_sta_rates - station rate selection table
218562306a36Sopenharmony_ci *
218662306a36Sopenharmony_ci * @rcu_head: RCU head used for freeing the table on update
218762306a36Sopenharmony_ci * @rate: transmit rates/flags to be used by default.
218862306a36Sopenharmony_ci *	Overriding entries per-packet is possible by using cb tx control.
218962306a36Sopenharmony_ci */
219062306a36Sopenharmony_cistruct ieee80211_sta_rates {
219162306a36Sopenharmony_ci	struct rcu_head rcu_head;
219262306a36Sopenharmony_ci	struct {
219362306a36Sopenharmony_ci		s8 idx;
219462306a36Sopenharmony_ci		u8 count;
219562306a36Sopenharmony_ci		u8 count_cts;
219662306a36Sopenharmony_ci		u8 count_rts;
219762306a36Sopenharmony_ci		u16 flags;
219862306a36Sopenharmony_ci	} rate[IEEE80211_TX_RATE_TABLE_SIZE];
219962306a36Sopenharmony_ci};
220062306a36Sopenharmony_ci
220162306a36Sopenharmony_ci/**
220262306a36Sopenharmony_ci * struct ieee80211_sta_txpwr - station txpower configuration
220362306a36Sopenharmony_ci *
220462306a36Sopenharmony_ci * Used to configure txpower for station.
220562306a36Sopenharmony_ci *
220662306a36Sopenharmony_ci * @power: indicates the tx power, in dBm, to be used when sending data frames
220762306a36Sopenharmony_ci *	to the STA.
220862306a36Sopenharmony_ci * @type: In particular if TPC %type is NL80211_TX_POWER_LIMITED then tx power
220962306a36Sopenharmony_ci *	will be less than or equal to specified from userspace, whereas if TPC
221062306a36Sopenharmony_ci *	%type is NL80211_TX_POWER_AUTOMATIC then it indicates default tx power.
221162306a36Sopenharmony_ci *	NL80211_TX_POWER_FIXED is not a valid configuration option for
221262306a36Sopenharmony_ci *	per peer TPC.
221362306a36Sopenharmony_ci */
221462306a36Sopenharmony_cistruct ieee80211_sta_txpwr {
221562306a36Sopenharmony_ci	s16 power;
221662306a36Sopenharmony_ci	enum nl80211_tx_power_setting type;
221762306a36Sopenharmony_ci};
221862306a36Sopenharmony_ci
221962306a36Sopenharmony_ci/**
222062306a36Sopenharmony_ci * struct ieee80211_sta_aggregates - info that is aggregated from active links
222162306a36Sopenharmony_ci *
222262306a36Sopenharmony_ci * Used for any per-link data that needs to be aggregated and updated in the
222362306a36Sopenharmony_ci * main &struct ieee80211_sta when updated or the active links change.
222462306a36Sopenharmony_ci *
222562306a36Sopenharmony_ci * @max_amsdu_len: indicates the maximal length of an A-MSDU in bytes.
222662306a36Sopenharmony_ci *	This field is always valid for packets with a VHT preamble.
222762306a36Sopenharmony_ci *	For packets with a HT preamble, additional limits apply:
222862306a36Sopenharmony_ci *
222962306a36Sopenharmony_ci *	* If the skb is transmitted as part of a BA agreement, the
223062306a36Sopenharmony_ci *	  A-MSDU maximal size is min(max_amsdu_len, 4065) bytes.
223162306a36Sopenharmony_ci *	* If the skb is not part of a BA agreement, the A-MSDU maximal
223262306a36Sopenharmony_ci *	  size is min(max_amsdu_len, 7935) bytes.
223362306a36Sopenharmony_ci *
223462306a36Sopenharmony_ci * Both additional HT limits must be enforced by the low level
223562306a36Sopenharmony_ci * driver. This is defined by the spec (IEEE 802.11-2012 section
223662306a36Sopenharmony_ci * 8.3.2.2 NOTE 2).
223762306a36Sopenharmony_ci * @max_rc_amsdu_len: Maximum A-MSDU size in bytes recommended by rate control.
223862306a36Sopenharmony_ci * @max_tid_amsdu_len: Maximum A-MSDU size in bytes for this TID
223962306a36Sopenharmony_ci */
224062306a36Sopenharmony_cistruct ieee80211_sta_aggregates {
224162306a36Sopenharmony_ci	u16 max_amsdu_len;
224262306a36Sopenharmony_ci
224362306a36Sopenharmony_ci	u16 max_rc_amsdu_len;
224462306a36Sopenharmony_ci	u16 max_tid_amsdu_len[IEEE80211_NUM_TIDS];
224562306a36Sopenharmony_ci};
224662306a36Sopenharmony_ci
224762306a36Sopenharmony_ci/**
224862306a36Sopenharmony_ci * struct ieee80211_link_sta - station Link specific info
224962306a36Sopenharmony_ci * All link specific info for a STA link for a non MLD STA(single)
225062306a36Sopenharmony_ci * or a MLD STA(multiple entries) are stored here.
225162306a36Sopenharmony_ci *
225262306a36Sopenharmony_ci * @sta: reference to owning STA
225362306a36Sopenharmony_ci * @addr: MAC address of the Link STA. For non-MLO STA this is same as the addr
225462306a36Sopenharmony_ci *	in ieee80211_sta. For MLO Link STA this addr can be same or different
225562306a36Sopenharmony_ci *	from addr in ieee80211_sta (representing MLD STA addr)
225662306a36Sopenharmony_ci * @link_id: the link ID for this link STA (0 for deflink)
225762306a36Sopenharmony_ci * @smps_mode: current SMPS mode (off, static or dynamic)
225862306a36Sopenharmony_ci * @supp_rates: Bitmap of supported rates
225962306a36Sopenharmony_ci * @ht_cap: HT capabilities of this STA; restricted to our own capabilities
226062306a36Sopenharmony_ci * @vht_cap: VHT capabilities of this STA; restricted to our own capabilities
226162306a36Sopenharmony_ci * @he_cap: HE capabilities of this STA
226262306a36Sopenharmony_ci * @he_6ghz_capa: on 6 GHz, holds the HE 6 GHz band capabilities
226362306a36Sopenharmony_ci * @eht_cap: EHT capabilities of this STA
226462306a36Sopenharmony_ci * @agg: per-link data for multi-link aggregation
226562306a36Sopenharmony_ci * @bandwidth: current bandwidth the station can receive with
226662306a36Sopenharmony_ci * @rx_nss: in HT/VHT, the maximum number of spatial streams the
226762306a36Sopenharmony_ci *	station can receive at the moment, changed by operating mode
226862306a36Sopenharmony_ci *	notifications and capabilities. The value is only valid after
226962306a36Sopenharmony_ci *	the station moves to associated state.
227062306a36Sopenharmony_ci * @txpwr: the station tx power configuration
227162306a36Sopenharmony_ci *
227262306a36Sopenharmony_ci */
227362306a36Sopenharmony_cistruct ieee80211_link_sta {
227462306a36Sopenharmony_ci	struct ieee80211_sta *sta;
227562306a36Sopenharmony_ci
227662306a36Sopenharmony_ci	u8 addr[ETH_ALEN];
227762306a36Sopenharmony_ci	u8 link_id;
227862306a36Sopenharmony_ci	enum ieee80211_smps_mode smps_mode;
227962306a36Sopenharmony_ci
228062306a36Sopenharmony_ci	u32 supp_rates[NUM_NL80211_BANDS];
228162306a36Sopenharmony_ci	struct ieee80211_sta_ht_cap ht_cap;
228262306a36Sopenharmony_ci	struct ieee80211_sta_vht_cap vht_cap;
228362306a36Sopenharmony_ci	struct ieee80211_sta_he_cap he_cap;
228462306a36Sopenharmony_ci	struct ieee80211_he_6ghz_capa he_6ghz_capa;
228562306a36Sopenharmony_ci	struct ieee80211_sta_eht_cap eht_cap;
228662306a36Sopenharmony_ci
228762306a36Sopenharmony_ci	struct ieee80211_sta_aggregates agg;
228862306a36Sopenharmony_ci
228962306a36Sopenharmony_ci	u8 rx_nss;
229062306a36Sopenharmony_ci	enum ieee80211_sta_rx_bandwidth bandwidth;
229162306a36Sopenharmony_ci	struct ieee80211_sta_txpwr txpwr;
229262306a36Sopenharmony_ci};
229362306a36Sopenharmony_ci
229462306a36Sopenharmony_ci/**
229562306a36Sopenharmony_ci * struct ieee80211_sta - station table entry
229662306a36Sopenharmony_ci *
229762306a36Sopenharmony_ci * A station table entry represents a station we are possibly
229862306a36Sopenharmony_ci * communicating with. Since stations are RCU-managed in
229962306a36Sopenharmony_ci * mac80211, any ieee80211_sta pointer you get access to must
230062306a36Sopenharmony_ci * either be protected by rcu_read_lock() explicitly or implicitly,
230162306a36Sopenharmony_ci * or you must take good care to not use such a pointer after a
230262306a36Sopenharmony_ci * call to your sta_remove callback that removed it.
230362306a36Sopenharmony_ci * This also represents the MLD STA in case of MLO association
230462306a36Sopenharmony_ci * and holds pointers to various link STA's
230562306a36Sopenharmony_ci *
230662306a36Sopenharmony_ci * @addr: MAC address
230762306a36Sopenharmony_ci * @aid: AID we assigned to the station if we're an AP
230862306a36Sopenharmony_ci * @max_rx_aggregation_subframes: maximal amount of frames in a single AMPDU
230962306a36Sopenharmony_ci *	that this station is allowed to transmit to us.
231062306a36Sopenharmony_ci *	Can be modified by driver.
231162306a36Sopenharmony_ci * @wme: indicates whether the STA supports QoS/WME (if local devices does,
231262306a36Sopenharmony_ci *	otherwise always false)
231362306a36Sopenharmony_ci * @drv_priv: data area for driver use, will always be aligned to
231462306a36Sopenharmony_ci *	sizeof(void \*), size is determined in hw information.
231562306a36Sopenharmony_ci * @uapsd_queues: bitmap of queues configured for uapsd. Only valid
231662306a36Sopenharmony_ci *	if wme is supported. The bits order is like in
231762306a36Sopenharmony_ci *	IEEE80211_WMM_IE_STA_QOSINFO_AC_*.
231862306a36Sopenharmony_ci * @max_sp: max Service Period. Only valid if wme is supported.
231962306a36Sopenharmony_ci * @rates: rate control selection table
232062306a36Sopenharmony_ci * @tdls: indicates whether the STA is a TDLS peer
232162306a36Sopenharmony_ci * @tdls_initiator: indicates the STA is an initiator of the TDLS link. Only
232262306a36Sopenharmony_ci *	valid if the STA is a TDLS peer in the first place.
232362306a36Sopenharmony_ci * @mfp: indicates whether the STA uses management frame protection or not.
232462306a36Sopenharmony_ci * @mlo: indicates whether the STA is MLO station.
232562306a36Sopenharmony_ci * @max_amsdu_subframes: indicates the maximal number of MSDUs in a single
232662306a36Sopenharmony_ci *	A-MSDU. Taken from the Extended Capabilities element. 0 means
232762306a36Sopenharmony_ci *	unlimited.
232862306a36Sopenharmony_ci * @cur: currently valid data as aggregated from the active links
232962306a36Sopenharmony_ci *	For non MLO STA it will point to the deflink data. For MLO STA
233062306a36Sopenharmony_ci *	ieee80211_sta_recalc_aggregates() must be called to update it.
233162306a36Sopenharmony_ci * @support_p2p_ps: indicates whether the STA supports P2P PS mechanism or not.
233262306a36Sopenharmony_ci * @txq: per-TID data TX queues; note that the last entry (%IEEE80211_NUM_TIDS)
233362306a36Sopenharmony_ci *	is used for non-data frames
233462306a36Sopenharmony_ci * @deflink: This holds the default link STA information, for non MLO STA all link
233562306a36Sopenharmony_ci *	specific STA information is accessed through @deflink or through
233662306a36Sopenharmony_ci *	link[0] which points to address of @deflink. For MLO Link STA
233762306a36Sopenharmony_ci *	the first added link STA will point to deflink.
233862306a36Sopenharmony_ci * @link: reference to Link Sta entries. For Non MLO STA, except 1st link,
233962306a36Sopenharmony_ci *	i.e link[0] all links would be assigned to NULL by default and
234062306a36Sopenharmony_ci *	would access link information via @deflink or link[0]. For MLO
234162306a36Sopenharmony_ci *	STA, first link STA being added will point its link pointer to
234262306a36Sopenharmony_ci *	@deflink address and remaining would be allocated and the address
234362306a36Sopenharmony_ci *	would be assigned to link[link_id] where link_id is the id assigned
234462306a36Sopenharmony_ci *	by the AP.
234562306a36Sopenharmony_ci * @valid_links: bitmap of valid links, or 0 for non-MLO
234662306a36Sopenharmony_ci */
234762306a36Sopenharmony_cistruct ieee80211_sta {
234862306a36Sopenharmony_ci	u8 addr[ETH_ALEN];
234962306a36Sopenharmony_ci	u16 aid;
235062306a36Sopenharmony_ci	u16 max_rx_aggregation_subframes;
235162306a36Sopenharmony_ci	bool wme;
235262306a36Sopenharmony_ci	u8 uapsd_queues;
235362306a36Sopenharmony_ci	u8 max_sp;
235462306a36Sopenharmony_ci	struct ieee80211_sta_rates __rcu *rates;
235562306a36Sopenharmony_ci	bool tdls;
235662306a36Sopenharmony_ci	bool tdls_initiator;
235762306a36Sopenharmony_ci	bool mfp;
235862306a36Sopenharmony_ci	bool mlo;
235962306a36Sopenharmony_ci	u8 max_amsdu_subframes;
236062306a36Sopenharmony_ci
236162306a36Sopenharmony_ci	struct ieee80211_sta_aggregates *cur;
236262306a36Sopenharmony_ci
236362306a36Sopenharmony_ci	bool support_p2p_ps;
236462306a36Sopenharmony_ci
236562306a36Sopenharmony_ci	struct ieee80211_txq *txq[IEEE80211_NUM_TIDS + 1];
236662306a36Sopenharmony_ci
236762306a36Sopenharmony_ci	u16 valid_links;
236862306a36Sopenharmony_ci	struct ieee80211_link_sta deflink;
236962306a36Sopenharmony_ci	struct ieee80211_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
237062306a36Sopenharmony_ci
237162306a36Sopenharmony_ci	/* must be last */
237262306a36Sopenharmony_ci	u8 drv_priv[] __aligned(sizeof(void *));
237362306a36Sopenharmony_ci};
237462306a36Sopenharmony_ci
237562306a36Sopenharmony_ci#ifdef CONFIG_LOCKDEP
237662306a36Sopenharmony_cibool lockdep_sta_mutex_held(struct ieee80211_sta *pubsta);
237762306a36Sopenharmony_ci#else
237862306a36Sopenharmony_cistatic inline bool lockdep_sta_mutex_held(struct ieee80211_sta *pubsta)
237962306a36Sopenharmony_ci{
238062306a36Sopenharmony_ci	return true;
238162306a36Sopenharmony_ci}
238262306a36Sopenharmony_ci#endif
238362306a36Sopenharmony_ci
238462306a36Sopenharmony_ci#define link_sta_dereference_protected(sta, link_id)		\
238562306a36Sopenharmony_ci	rcu_dereference_protected((sta)->link[link_id],		\
238662306a36Sopenharmony_ci				  lockdep_sta_mutex_held(sta))
238762306a36Sopenharmony_ci
238862306a36Sopenharmony_ci#define link_sta_dereference_check(sta, link_id)		\
238962306a36Sopenharmony_ci	rcu_dereference_check((sta)->link[link_id],		\
239062306a36Sopenharmony_ci			      lockdep_sta_mutex_held(sta))
239162306a36Sopenharmony_ci
239262306a36Sopenharmony_ci#define for_each_sta_active_link(vif, sta, link_sta, link_id)			\
239362306a36Sopenharmony_ci	for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++)		\
239462306a36Sopenharmony_ci		if ((!(vif)->active_links ||					\
239562306a36Sopenharmony_ci		     (vif)->active_links & BIT(link_id)) &&			\
239662306a36Sopenharmony_ci		    ((link_sta) = link_sta_dereference_protected(sta, link_id)))
239762306a36Sopenharmony_ci
239862306a36Sopenharmony_ci/**
239962306a36Sopenharmony_ci * enum sta_notify_cmd - sta notify command
240062306a36Sopenharmony_ci *
240162306a36Sopenharmony_ci * Used with the sta_notify() callback in &struct ieee80211_ops, this
240262306a36Sopenharmony_ci * indicates if an associated station made a power state transition.
240362306a36Sopenharmony_ci *
240462306a36Sopenharmony_ci * @STA_NOTIFY_SLEEP: a station is now sleeping
240562306a36Sopenharmony_ci * @STA_NOTIFY_AWAKE: a sleeping station woke up
240662306a36Sopenharmony_ci */
240762306a36Sopenharmony_cienum sta_notify_cmd {
240862306a36Sopenharmony_ci	STA_NOTIFY_SLEEP, STA_NOTIFY_AWAKE,
240962306a36Sopenharmony_ci};
241062306a36Sopenharmony_ci
241162306a36Sopenharmony_ci/**
241262306a36Sopenharmony_ci * struct ieee80211_tx_control - TX control data
241362306a36Sopenharmony_ci *
241462306a36Sopenharmony_ci * @sta: station table entry, this sta pointer may be NULL and
241562306a36Sopenharmony_ci * 	it is not allowed to copy the pointer, due to RCU.
241662306a36Sopenharmony_ci */
241762306a36Sopenharmony_cistruct ieee80211_tx_control {
241862306a36Sopenharmony_ci	struct ieee80211_sta *sta;
241962306a36Sopenharmony_ci};
242062306a36Sopenharmony_ci
242162306a36Sopenharmony_ci/**
242262306a36Sopenharmony_ci * struct ieee80211_txq - Software intermediate tx queue
242362306a36Sopenharmony_ci *
242462306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
242562306a36Sopenharmony_ci * @sta: station table entry, %NULL for per-vif queue
242662306a36Sopenharmony_ci * @tid: the TID for this queue (unused for per-vif queue),
242762306a36Sopenharmony_ci *	%IEEE80211_NUM_TIDS for non-data (if enabled)
242862306a36Sopenharmony_ci * @ac: the AC for this queue
242962306a36Sopenharmony_ci * @drv_priv: driver private area, sized by hw->txq_data_size
243062306a36Sopenharmony_ci *
243162306a36Sopenharmony_ci * The driver can obtain packets from this queue by calling
243262306a36Sopenharmony_ci * ieee80211_tx_dequeue().
243362306a36Sopenharmony_ci */
243462306a36Sopenharmony_cistruct ieee80211_txq {
243562306a36Sopenharmony_ci	struct ieee80211_vif *vif;
243662306a36Sopenharmony_ci	struct ieee80211_sta *sta;
243762306a36Sopenharmony_ci	u8 tid;
243862306a36Sopenharmony_ci	u8 ac;
243962306a36Sopenharmony_ci
244062306a36Sopenharmony_ci	/* must be last */
244162306a36Sopenharmony_ci	u8 drv_priv[] __aligned(sizeof(void *));
244262306a36Sopenharmony_ci};
244362306a36Sopenharmony_ci
244462306a36Sopenharmony_ci/**
244562306a36Sopenharmony_ci * enum ieee80211_hw_flags - hardware flags
244662306a36Sopenharmony_ci *
244762306a36Sopenharmony_ci * These flags are used to indicate hardware capabilities to
244862306a36Sopenharmony_ci * the stack. Generally, flags here should have their meaning
244962306a36Sopenharmony_ci * done in a way that the simplest hardware doesn't need setting
245062306a36Sopenharmony_ci * any particular flags. There are some exceptions to this rule,
245162306a36Sopenharmony_ci * however, so you are advised to review these flags carefully.
245262306a36Sopenharmony_ci *
245362306a36Sopenharmony_ci * @IEEE80211_HW_HAS_RATE_CONTROL:
245462306a36Sopenharmony_ci *	The hardware or firmware includes rate control, and cannot be
245562306a36Sopenharmony_ci *	controlled by the stack. As such, no rate control algorithm
245662306a36Sopenharmony_ci *	should be instantiated, and the TX rate reported to userspace
245762306a36Sopenharmony_ci *	will be taken from the TX status instead of the rate control
245862306a36Sopenharmony_ci *	algorithm.
245962306a36Sopenharmony_ci *	Note that this requires that the driver implement a number of
246062306a36Sopenharmony_ci *	callbacks so it has the correct information, it needs to have
246162306a36Sopenharmony_ci *	the @set_rts_threshold callback and must look at the BSS config
246262306a36Sopenharmony_ci *	@use_cts_prot for G/N protection, @use_short_slot for slot
246362306a36Sopenharmony_ci *	timing in 2.4 GHz and @use_short_preamble for preambles for
246462306a36Sopenharmony_ci *	CCK frames.
246562306a36Sopenharmony_ci *
246662306a36Sopenharmony_ci * @IEEE80211_HW_RX_INCLUDES_FCS:
246762306a36Sopenharmony_ci *	Indicates that received frames passed to the stack include
246862306a36Sopenharmony_ci *	the FCS at the end.
246962306a36Sopenharmony_ci *
247062306a36Sopenharmony_ci * @IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING:
247162306a36Sopenharmony_ci *	Some wireless LAN chipsets buffer broadcast/multicast frames
247262306a36Sopenharmony_ci *	for power saving stations in the hardware/firmware and others
247362306a36Sopenharmony_ci *	rely on the host system for such buffering. This option is used
247462306a36Sopenharmony_ci *	to configure the IEEE 802.11 upper layer to buffer broadcast and
247562306a36Sopenharmony_ci *	multicast frames when there are power saving stations so that
247662306a36Sopenharmony_ci *	the driver can fetch them with ieee80211_get_buffered_bc().
247762306a36Sopenharmony_ci *
247862306a36Sopenharmony_ci * @IEEE80211_HW_SIGNAL_UNSPEC:
247962306a36Sopenharmony_ci *	Hardware can provide signal values but we don't know its units. We
248062306a36Sopenharmony_ci *	expect values between 0 and @max_signal.
248162306a36Sopenharmony_ci *	If possible please provide dB or dBm instead.
248262306a36Sopenharmony_ci *
248362306a36Sopenharmony_ci * @IEEE80211_HW_SIGNAL_DBM:
248462306a36Sopenharmony_ci *	Hardware gives signal values in dBm, decibel difference from
248562306a36Sopenharmony_ci *	one milliwatt. This is the preferred method since it is standardized
248662306a36Sopenharmony_ci *	between different devices. @max_signal does not need to be set.
248762306a36Sopenharmony_ci *
248862306a36Sopenharmony_ci * @IEEE80211_HW_SPECTRUM_MGMT:
248962306a36Sopenharmony_ci * 	Hardware supports spectrum management defined in 802.11h
249062306a36Sopenharmony_ci * 	Measurement, Channel Switch, Quieting, TPC
249162306a36Sopenharmony_ci *
249262306a36Sopenharmony_ci * @IEEE80211_HW_AMPDU_AGGREGATION:
249362306a36Sopenharmony_ci *	Hardware supports 11n A-MPDU aggregation.
249462306a36Sopenharmony_ci *
249562306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_PS:
249662306a36Sopenharmony_ci *	Hardware has power save support (i.e. can go to sleep).
249762306a36Sopenharmony_ci *
249862306a36Sopenharmony_ci * @IEEE80211_HW_PS_NULLFUNC_STACK:
249962306a36Sopenharmony_ci *	Hardware requires nullfunc frame handling in stack, implies
250062306a36Sopenharmony_ci *	stack support for dynamic PS.
250162306a36Sopenharmony_ci *
250262306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
250362306a36Sopenharmony_ci *	Hardware has support for dynamic PS.
250462306a36Sopenharmony_ci *
250562306a36Sopenharmony_ci * @IEEE80211_HW_MFP_CAPABLE:
250662306a36Sopenharmony_ci *	Hardware supports management frame protection (MFP, IEEE 802.11w).
250762306a36Sopenharmony_ci *
250862306a36Sopenharmony_ci * @IEEE80211_HW_REPORTS_TX_ACK_STATUS:
250962306a36Sopenharmony_ci *	Hardware can provide ack status reports of Tx frames to
251062306a36Sopenharmony_ci *	the stack.
251162306a36Sopenharmony_ci *
251262306a36Sopenharmony_ci * @IEEE80211_HW_CONNECTION_MONITOR:
251362306a36Sopenharmony_ci *	The hardware performs its own connection monitoring, including
251462306a36Sopenharmony_ci *	periodic keep-alives to the AP and probing the AP on beacon loss.
251562306a36Sopenharmony_ci *
251662306a36Sopenharmony_ci * @IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC:
251762306a36Sopenharmony_ci *	This device needs to get data from beacon before association (i.e.
251862306a36Sopenharmony_ci *	dtim_period).
251962306a36Sopenharmony_ci *
252062306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports
252162306a36Sopenharmony_ci *	per-station GTKs as used by IBSS RSN or during fast transition. If
252262306a36Sopenharmony_ci *	the device doesn't support per-station GTKs, but can be asked not
252362306a36Sopenharmony_ci *	to decrypt group addressed frames, then IBSS RSN support is still
252462306a36Sopenharmony_ci *	possible but software crypto will be used. Advertise the wiphy flag
252562306a36Sopenharmony_ci *	only in that case.
252662306a36Sopenharmony_ci *
252762306a36Sopenharmony_ci * @IEEE80211_HW_AP_LINK_PS: When operating in AP mode the device
252862306a36Sopenharmony_ci *	autonomously manages the PS status of connected stations. When
252962306a36Sopenharmony_ci *	this flag is set mac80211 will not trigger PS mode for connected
253062306a36Sopenharmony_ci *	stations based on the PM bit of incoming frames.
253162306a36Sopenharmony_ci *	Use ieee80211_start_ps()/ieee8021_end_ps() to manually configure
253262306a36Sopenharmony_ci *	the PS mode of connected stations.
253362306a36Sopenharmony_ci *
253462306a36Sopenharmony_ci * @IEEE80211_HW_TX_AMPDU_SETUP_IN_HW: The device handles TX A-MPDU session
253562306a36Sopenharmony_ci *	setup strictly in HW. mac80211 should not attempt to do this in
253662306a36Sopenharmony_ci *	software.
253762306a36Sopenharmony_ci *
253862306a36Sopenharmony_ci * @IEEE80211_HW_WANT_MONITOR_VIF: The driver would like to be informed of
253962306a36Sopenharmony_ci *	a virtual monitor interface when monitor interfaces are the only
254062306a36Sopenharmony_ci *	active interfaces.
254162306a36Sopenharmony_ci *
254262306a36Sopenharmony_ci * @IEEE80211_HW_NO_AUTO_VIF: The driver would like for no wlanX to
254362306a36Sopenharmony_ci *	be created.  It is expected user-space will create vifs as
254462306a36Sopenharmony_ci *	desired (and thus have them named as desired).
254562306a36Sopenharmony_ci *
254662306a36Sopenharmony_ci * @IEEE80211_HW_SW_CRYPTO_CONTROL: The driver wants to control which of the
254762306a36Sopenharmony_ci *	crypto algorithms can be done in software - so don't automatically
254862306a36Sopenharmony_ci *	try to fall back to it if hardware crypto fails, but do so only if
254962306a36Sopenharmony_ci *	the driver returns 1. This also forces the driver to advertise its
255062306a36Sopenharmony_ci *	supported cipher suites.
255162306a36Sopenharmony_ci *
255262306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORT_FAST_XMIT: The driver/hardware supports fast-xmit,
255362306a36Sopenharmony_ci *	this currently requires only the ability to calculate the duration
255462306a36Sopenharmony_ci *	for frames.
255562306a36Sopenharmony_ci *
255662306a36Sopenharmony_ci * @IEEE80211_HW_QUEUE_CONTROL: The driver wants to control per-interface
255762306a36Sopenharmony_ci *	queue mapping in order to use different queues (not just one per AC)
255862306a36Sopenharmony_ci *	for different virtual interfaces. See the doc section on HW queue
255962306a36Sopenharmony_ci *	control for more details.
256062306a36Sopenharmony_ci *
256162306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_RC_TABLE: The driver supports using a rate
256262306a36Sopenharmony_ci *	selection table provided by the rate control algorithm.
256362306a36Sopenharmony_ci *
256462306a36Sopenharmony_ci * @IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF: Use the P2P Device address for any
256562306a36Sopenharmony_ci *	P2P Interface. This will be honoured even if more than one interface
256662306a36Sopenharmony_ci *	is supported.
256762306a36Sopenharmony_ci *
256862306a36Sopenharmony_ci * @IEEE80211_HW_TIMING_BEACON_ONLY: Use sync timing from beacon frames
256962306a36Sopenharmony_ci *	only, to allow getting TBTT of a DTIM beacon.
257062306a36Sopenharmony_ci *
257162306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_HT_CCK_RATES: Hardware supports mixing HT/CCK rates
257262306a36Sopenharmony_ci *	and can cope with CCK rates in an aggregation session (e.g. by not
257362306a36Sopenharmony_ci *	using aggregation for such frames.)
257462306a36Sopenharmony_ci *
257562306a36Sopenharmony_ci * @IEEE80211_HW_CHANCTX_STA_CSA: Support 802.11h based channel-switch (CSA)
257662306a36Sopenharmony_ci *	for a single active channel while using channel contexts. When support
257762306a36Sopenharmony_ci *	is not enabled the default action is to disconnect when getting the
257862306a36Sopenharmony_ci *	CSA frame.
257962306a36Sopenharmony_ci *
258062306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_CLONED_SKBS: The driver will never modify the payload
258162306a36Sopenharmony_ci *	or tailroom of TX skbs without copying them first.
258262306a36Sopenharmony_ci *
258362306a36Sopenharmony_ci * @IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS: The HW supports scanning on all bands
258462306a36Sopenharmony_ci *	in one command, mac80211 doesn't have to run separate scans per band.
258562306a36Sopenharmony_ci *
258662306a36Sopenharmony_ci * @IEEE80211_HW_TDLS_WIDER_BW: The device/driver supports wider bandwidth
258762306a36Sopenharmony_ci *	than then BSS bandwidth for a TDLS link on the base channel.
258862306a36Sopenharmony_ci *
258962306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU: The driver supports receiving A-MSDUs
259062306a36Sopenharmony_ci *	within A-MPDU.
259162306a36Sopenharmony_ci *
259262306a36Sopenharmony_ci * @IEEE80211_HW_BEACON_TX_STATUS: The device/driver provides TX status
259362306a36Sopenharmony_ci *	for sent beacons.
259462306a36Sopenharmony_ci *
259562306a36Sopenharmony_ci * @IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR: Hardware (or driver) requires that each
259662306a36Sopenharmony_ci *	station has a unique address, i.e. each station entry can be identified
259762306a36Sopenharmony_ci *	by just its MAC address; this prevents, for example, the same station
259862306a36Sopenharmony_ci *	from connecting to two virtual AP interfaces at the same time.
259962306a36Sopenharmony_ci *
260062306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_REORDERING_BUFFER: Hardware (or driver) manages the
260162306a36Sopenharmony_ci *	reordering buffer internally, guaranteeing mac80211 receives frames in
260262306a36Sopenharmony_ci *	order and does not need to manage its own reorder buffer or BA session
260362306a36Sopenharmony_ci *	timeout.
260462306a36Sopenharmony_ci *
260562306a36Sopenharmony_ci * @IEEE80211_HW_USES_RSS: The device uses RSS and thus requires parallel RX,
260662306a36Sopenharmony_ci *	which implies using per-CPU station statistics.
260762306a36Sopenharmony_ci *
260862306a36Sopenharmony_ci * @IEEE80211_HW_TX_AMSDU: Hardware (or driver) supports software aggregated
260962306a36Sopenharmony_ci *	A-MSDU frames. Requires software tx queueing and fast-xmit support.
261062306a36Sopenharmony_ci *	When not using minstrel/minstrel_ht rate control, the driver must
261162306a36Sopenharmony_ci *	limit the maximum A-MSDU size based on the current tx rate by setting
261262306a36Sopenharmony_ci *	max_rc_amsdu_len in struct ieee80211_sta.
261362306a36Sopenharmony_ci *
261462306a36Sopenharmony_ci * @IEEE80211_HW_TX_FRAG_LIST: Hardware (or driver) supports sending frag_list
261562306a36Sopenharmony_ci *	skbs, needed for zero-copy software A-MSDU.
261662306a36Sopenharmony_ci *
261762306a36Sopenharmony_ci * @IEEE80211_HW_REPORTS_LOW_ACK: The driver (or firmware) reports low ack event
261862306a36Sopenharmony_ci *	by ieee80211_report_low_ack() based on its own algorithm. For such
261962306a36Sopenharmony_ci *	drivers, mac80211 packet loss mechanism will not be triggered and driver
262062306a36Sopenharmony_ci *	is completely depending on firmware event for station kickout.
262162306a36Sopenharmony_ci *
262262306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_TX_FRAG: Hardware does fragmentation by itself.
262362306a36Sopenharmony_ci *	The stack will not do fragmentation.
262462306a36Sopenharmony_ci *	The callback for @set_frag_threshold should be set as well.
262562306a36Sopenharmony_ci *
262662306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA: Hardware supports buffer STA on
262762306a36Sopenharmony_ci *	TDLS links.
262862306a36Sopenharmony_ci *
262962306a36Sopenharmony_ci * @IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP: The driver requires the
263062306a36Sopenharmony_ci *	mgd_prepare_tx() callback to be called before transmission of a
263162306a36Sopenharmony_ci *	deauthentication frame in case the association was completed but no
263262306a36Sopenharmony_ci *	beacon was heard. This is required in multi-channel scenarios, where the
263362306a36Sopenharmony_ci *	virtual interface might not be given air time for the transmission of
263462306a36Sopenharmony_ci *	the frame, as it is not synced with the AP/P2P GO yet, and thus the
263562306a36Sopenharmony_ci *	deauthentication frame might not be transmitted.
263662306a36Sopenharmony_ci *
263762306a36Sopenharmony_ci * @IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP: The driver (or firmware) doesn't
263862306a36Sopenharmony_ci *	support QoS NDP for AP probing - that's most likely a driver bug.
263962306a36Sopenharmony_ci *
264062306a36Sopenharmony_ci * @IEEE80211_HW_BUFF_MMPDU_TXQ: use the TXQ for bufferable MMPDUs, this of
264162306a36Sopenharmony_ci *	course requires the driver to use TXQs to start with.
264262306a36Sopenharmony_ci *
264362306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW: (Hardware) rate control supports VHT
264462306a36Sopenharmony_ci *	extended NSS BW (dot11VHTExtendedNSSBWCapable). This flag will be set if
264562306a36Sopenharmony_ci *	the selected rate control algorithm sets %RATE_CTRL_CAPA_VHT_EXT_NSS_BW
264662306a36Sopenharmony_ci *	but if the rate control is built-in then it must be set by the driver.
264762306a36Sopenharmony_ci *	See also the documentation for that flag.
264862306a36Sopenharmony_ci *
264962306a36Sopenharmony_ci * @IEEE80211_HW_STA_MMPDU_TXQ: use the extra non-TID per-station TXQ for all
265062306a36Sopenharmony_ci *	MMPDUs on station interfaces. This of course requires the driver to use
265162306a36Sopenharmony_ci *	TXQs to start with.
265262306a36Sopenharmony_ci *
265362306a36Sopenharmony_ci * @IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN: Driver does not report accurate A-MPDU
265462306a36Sopenharmony_ci *	length in tx status information
265562306a36Sopenharmony_ci *
265662306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_MULTI_BSSID: Hardware supports multi BSSID
265762306a36Sopenharmony_ci *
265862306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID: Hardware supports multi BSSID
265962306a36Sopenharmony_ci *	only for HE APs. Applies if @IEEE80211_HW_SUPPORTS_MULTI_BSSID is set.
266062306a36Sopenharmony_ci *
266162306a36Sopenharmony_ci * @IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT: The card and driver is only
266262306a36Sopenharmony_ci *	aggregating MPDUs with the same keyid, allowing mac80211 to keep Tx
266362306a36Sopenharmony_ci *	A-MPDU sessions active while rekeying with Extended Key ID.
266462306a36Sopenharmony_ci *
266562306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD: Hardware supports tx encapsulation
266662306a36Sopenharmony_ci *	offload
266762306a36Sopenharmony_ci *
266862306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD: Hardware supports rx decapsulation
266962306a36Sopenharmony_ci *	offload
267062306a36Sopenharmony_ci *
267162306a36Sopenharmony_ci * @IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP: Hardware supports concurrent rx
267262306a36Sopenharmony_ci *	decapsulation offload and passing raw 802.11 frames for monitor iface.
267362306a36Sopenharmony_ci *	If this is supported, the driver must pass both 802.3 frames for real
267462306a36Sopenharmony_ci *	usage and 802.11 frames with %RX_FLAG_ONLY_MONITOR set for monitor to
267562306a36Sopenharmony_ci *	the stack.
267662306a36Sopenharmony_ci *
267762306a36Sopenharmony_ci * @IEEE80211_HW_DETECTS_COLOR_COLLISION: HW/driver has support for BSS color
267862306a36Sopenharmony_ci *	collision detection and doesn't need it in software.
267962306a36Sopenharmony_ci *
268062306a36Sopenharmony_ci * @IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX: Hardware/driver handles transmitting
268162306a36Sopenharmony_ci *	multicast frames on all links, mac80211 should not do that.
268262306a36Sopenharmony_ci *
268362306a36Sopenharmony_ci * @NUM_IEEE80211_HW_FLAGS: number of hardware flags, used for sizing arrays
268462306a36Sopenharmony_ci */
268562306a36Sopenharmony_cienum ieee80211_hw_flags {
268662306a36Sopenharmony_ci	IEEE80211_HW_HAS_RATE_CONTROL,
268762306a36Sopenharmony_ci	IEEE80211_HW_RX_INCLUDES_FCS,
268862306a36Sopenharmony_ci	IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING,
268962306a36Sopenharmony_ci	IEEE80211_HW_SIGNAL_UNSPEC,
269062306a36Sopenharmony_ci	IEEE80211_HW_SIGNAL_DBM,
269162306a36Sopenharmony_ci	IEEE80211_HW_NEED_DTIM_BEFORE_ASSOC,
269262306a36Sopenharmony_ci	IEEE80211_HW_SPECTRUM_MGMT,
269362306a36Sopenharmony_ci	IEEE80211_HW_AMPDU_AGGREGATION,
269462306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_PS,
269562306a36Sopenharmony_ci	IEEE80211_HW_PS_NULLFUNC_STACK,
269662306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_DYNAMIC_PS,
269762306a36Sopenharmony_ci	IEEE80211_HW_MFP_CAPABLE,
269862306a36Sopenharmony_ci	IEEE80211_HW_WANT_MONITOR_VIF,
269962306a36Sopenharmony_ci	IEEE80211_HW_NO_AUTO_VIF,
270062306a36Sopenharmony_ci	IEEE80211_HW_SW_CRYPTO_CONTROL,
270162306a36Sopenharmony_ci	IEEE80211_HW_SUPPORT_FAST_XMIT,
270262306a36Sopenharmony_ci	IEEE80211_HW_REPORTS_TX_ACK_STATUS,
270362306a36Sopenharmony_ci	IEEE80211_HW_CONNECTION_MONITOR,
270462306a36Sopenharmony_ci	IEEE80211_HW_QUEUE_CONTROL,
270562306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_PER_STA_GTK,
270662306a36Sopenharmony_ci	IEEE80211_HW_AP_LINK_PS,
270762306a36Sopenharmony_ci	IEEE80211_HW_TX_AMPDU_SETUP_IN_HW,
270862306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_RC_TABLE,
270962306a36Sopenharmony_ci	IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF,
271062306a36Sopenharmony_ci	IEEE80211_HW_TIMING_BEACON_ONLY,
271162306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_HT_CCK_RATES,
271262306a36Sopenharmony_ci	IEEE80211_HW_CHANCTX_STA_CSA,
271362306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_CLONED_SKBS,
271462306a36Sopenharmony_ci	IEEE80211_HW_SINGLE_SCAN_ON_ALL_BANDS,
271562306a36Sopenharmony_ci	IEEE80211_HW_TDLS_WIDER_BW,
271662306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_AMSDU_IN_AMPDU,
271762306a36Sopenharmony_ci	IEEE80211_HW_BEACON_TX_STATUS,
271862306a36Sopenharmony_ci	IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR,
271962306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_REORDERING_BUFFER,
272062306a36Sopenharmony_ci	IEEE80211_HW_USES_RSS,
272162306a36Sopenharmony_ci	IEEE80211_HW_TX_AMSDU,
272262306a36Sopenharmony_ci	IEEE80211_HW_TX_FRAG_LIST,
272362306a36Sopenharmony_ci	IEEE80211_HW_REPORTS_LOW_ACK,
272462306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_TX_FRAG,
272562306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_TDLS_BUFFER_STA,
272662306a36Sopenharmony_ci	IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP,
272762306a36Sopenharmony_ci	IEEE80211_HW_DOESNT_SUPPORT_QOS_NDP,
272862306a36Sopenharmony_ci	IEEE80211_HW_BUFF_MMPDU_TXQ,
272962306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_VHT_EXT_NSS_BW,
273062306a36Sopenharmony_ci	IEEE80211_HW_STA_MMPDU_TXQ,
273162306a36Sopenharmony_ci	IEEE80211_HW_TX_STATUS_NO_AMPDU_LEN,
273262306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_MULTI_BSSID,
273362306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_ONLY_HE_MULTI_BSSID,
273462306a36Sopenharmony_ci	IEEE80211_HW_AMPDU_KEYBORDER_SUPPORT,
273562306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_TX_ENCAP_OFFLOAD,
273662306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_RX_DECAP_OFFLOAD,
273762306a36Sopenharmony_ci	IEEE80211_HW_SUPPORTS_CONC_MON_RX_DECAP,
273862306a36Sopenharmony_ci	IEEE80211_HW_DETECTS_COLOR_COLLISION,
273962306a36Sopenharmony_ci	IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX,
274062306a36Sopenharmony_ci
274162306a36Sopenharmony_ci	/* keep last, obviously */
274262306a36Sopenharmony_ci	NUM_IEEE80211_HW_FLAGS
274362306a36Sopenharmony_ci};
274462306a36Sopenharmony_ci
274562306a36Sopenharmony_ci/**
274662306a36Sopenharmony_ci * struct ieee80211_hw - hardware information and state
274762306a36Sopenharmony_ci *
274862306a36Sopenharmony_ci * This structure contains the configuration and hardware
274962306a36Sopenharmony_ci * information for an 802.11 PHY.
275062306a36Sopenharmony_ci *
275162306a36Sopenharmony_ci * @wiphy: This points to the &struct wiphy allocated for this
275262306a36Sopenharmony_ci *	802.11 PHY. You must fill in the @perm_addr and @dev
275362306a36Sopenharmony_ci *	members of this structure using SET_IEEE80211_DEV()
275462306a36Sopenharmony_ci *	and SET_IEEE80211_PERM_ADDR(). Additionally, all supported
275562306a36Sopenharmony_ci *	bands (with channels, bitrates) are registered here.
275662306a36Sopenharmony_ci *
275762306a36Sopenharmony_ci * @conf: &struct ieee80211_conf, device configuration, don't use.
275862306a36Sopenharmony_ci *
275962306a36Sopenharmony_ci * @priv: pointer to private area that was allocated for driver use
276062306a36Sopenharmony_ci *	along with this structure.
276162306a36Sopenharmony_ci *
276262306a36Sopenharmony_ci * @flags: hardware flags, see &enum ieee80211_hw_flags.
276362306a36Sopenharmony_ci *
276462306a36Sopenharmony_ci * @extra_tx_headroom: headroom to reserve in each transmit skb
276562306a36Sopenharmony_ci *	for use by the driver (e.g. for transmit headers.)
276662306a36Sopenharmony_ci *
276762306a36Sopenharmony_ci * @extra_beacon_tailroom: tailroom to reserve in each beacon tx skb.
276862306a36Sopenharmony_ci *	Can be used by drivers to add extra IEs.
276962306a36Sopenharmony_ci *
277062306a36Sopenharmony_ci * @max_signal: Maximum value for signal (rssi) in RX information, used
277162306a36Sopenharmony_ci *	only when @IEEE80211_HW_SIGNAL_UNSPEC or @IEEE80211_HW_SIGNAL_DB
277262306a36Sopenharmony_ci *
277362306a36Sopenharmony_ci * @max_listen_interval: max listen interval in units of beacon interval
277462306a36Sopenharmony_ci *	that HW supports
277562306a36Sopenharmony_ci *
277662306a36Sopenharmony_ci * @queues: number of available hardware transmit queues for
277762306a36Sopenharmony_ci *	data packets. WMM/QoS requires at least four, these
277862306a36Sopenharmony_ci *	queues need to have configurable access parameters.
277962306a36Sopenharmony_ci *
278062306a36Sopenharmony_ci * @rate_control_algorithm: rate control algorithm for this hardware.
278162306a36Sopenharmony_ci *	If unset (NULL), the default algorithm will be used. Must be
278262306a36Sopenharmony_ci *	set before calling ieee80211_register_hw().
278362306a36Sopenharmony_ci *
278462306a36Sopenharmony_ci * @vif_data_size: size (in bytes) of the drv_priv data area
278562306a36Sopenharmony_ci *	within &struct ieee80211_vif.
278662306a36Sopenharmony_ci * @sta_data_size: size (in bytes) of the drv_priv data area
278762306a36Sopenharmony_ci *	within &struct ieee80211_sta.
278862306a36Sopenharmony_ci * @chanctx_data_size: size (in bytes) of the drv_priv data area
278962306a36Sopenharmony_ci *	within &struct ieee80211_chanctx_conf.
279062306a36Sopenharmony_ci * @txq_data_size: size (in bytes) of the drv_priv data area
279162306a36Sopenharmony_ci *	within @struct ieee80211_txq.
279262306a36Sopenharmony_ci *
279362306a36Sopenharmony_ci * @max_rates: maximum number of alternate rate retry stages the hw
279462306a36Sopenharmony_ci *	can handle.
279562306a36Sopenharmony_ci * @max_report_rates: maximum number of alternate rate retry stages
279662306a36Sopenharmony_ci *	the hw can report back.
279762306a36Sopenharmony_ci * @max_rate_tries: maximum number of tries for each stage
279862306a36Sopenharmony_ci *
279962306a36Sopenharmony_ci * @max_rx_aggregation_subframes: maximum buffer size (number of
280062306a36Sopenharmony_ci *	sub-frames) to be used for A-MPDU block ack receiver
280162306a36Sopenharmony_ci *	aggregation.
280262306a36Sopenharmony_ci *	This is only relevant if the device has restrictions on the
280362306a36Sopenharmony_ci *	number of subframes, if it relies on mac80211 to do reordering
280462306a36Sopenharmony_ci *	it shouldn't be set.
280562306a36Sopenharmony_ci *
280662306a36Sopenharmony_ci * @max_tx_aggregation_subframes: maximum number of subframes in an
280762306a36Sopenharmony_ci *	aggregate an HT/HE device will transmit. In HT AddBA we'll
280862306a36Sopenharmony_ci *	advertise a constant value of 64 as some older APs crash if
280962306a36Sopenharmony_ci *	the window size is smaller (an example is LinkSys WRT120N
281062306a36Sopenharmony_ci *	with FW v1.0.07 build 002 Jun 18 2012).
281162306a36Sopenharmony_ci *	For AddBA to HE capable peers this value will be used.
281262306a36Sopenharmony_ci *
281362306a36Sopenharmony_ci * @max_tx_fragments: maximum number of tx buffers per (A)-MSDU, sum
281462306a36Sopenharmony_ci *	of 1 + skb_shinfo(skb)->nr_frags for each skb in the frag_list.
281562306a36Sopenharmony_ci *
281662306a36Sopenharmony_ci * @offchannel_tx_hw_queue: HW queue ID to use for offchannel TX
281762306a36Sopenharmony_ci *	(if %IEEE80211_HW_QUEUE_CONTROL is set)
281862306a36Sopenharmony_ci *
281962306a36Sopenharmony_ci * @radiotap_mcs_details: lists which MCS information can the HW
282062306a36Sopenharmony_ci *	reports, by default it is set to _MCS, _GI and _BW but doesn't
282162306a36Sopenharmony_ci *	include _FMT. Use %IEEE80211_RADIOTAP_MCS_HAVE_\* values, only
282262306a36Sopenharmony_ci *	adding _BW is supported today.
282362306a36Sopenharmony_ci *
282462306a36Sopenharmony_ci * @radiotap_vht_details: lists which VHT MCS information the HW reports,
282562306a36Sopenharmony_ci *	the default is _GI | _BANDWIDTH.
282662306a36Sopenharmony_ci *	Use the %IEEE80211_RADIOTAP_VHT_KNOWN_\* values.
282762306a36Sopenharmony_ci *
282862306a36Sopenharmony_ci * @radiotap_he: HE radiotap validity flags
282962306a36Sopenharmony_ci *
283062306a36Sopenharmony_ci * @radiotap_timestamp: Information for the radiotap timestamp field; if the
283162306a36Sopenharmony_ci *	@units_pos member is set to a non-negative value then the timestamp
283262306a36Sopenharmony_ci *	field will be added and populated from the &struct ieee80211_rx_status
283362306a36Sopenharmony_ci *	device_timestamp.
283462306a36Sopenharmony_ci * @radiotap_timestamp.units_pos: Must be set to a combination of a
283562306a36Sopenharmony_ci *	IEEE80211_RADIOTAP_TIMESTAMP_UNIT_* and a
283662306a36Sopenharmony_ci *	IEEE80211_RADIOTAP_TIMESTAMP_SPOS_* value.
283762306a36Sopenharmony_ci * @radiotap_timestamp.accuracy: If non-negative, fills the accuracy in the
283862306a36Sopenharmony_ci *	radiotap field and the accuracy known flag will be set.
283962306a36Sopenharmony_ci *
284062306a36Sopenharmony_ci * @netdev_features: netdev features to be set in each netdev created
284162306a36Sopenharmony_ci *	from this HW. Note that not all features are usable with mac80211,
284262306a36Sopenharmony_ci *	other features will be rejected during HW registration.
284362306a36Sopenharmony_ci *
284462306a36Sopenharmony_ci * @uapsd_queues: This bitmap is included in (re)association frame to indicate
284562306a36Sopenharmony_ci *	for each access category if it is uAPSD trigger-enabled and delivery-
284662306a36Sopenharmony_ci *	enabled. Use IEEE80211_WMM_IE_STA_QOSINFO_AC_* to set this bitmap.
284762306a36Sopenharmony_ci *	Each bit corresponds to different AC. Value '1' in specific bit means
284862306a36Sopenharmony_ci *	that corresponding AC is both trigger- and delivery-enabled. '0' means
284962306a36Sopenharmony_ci *	neither enabled.
285062306a36Sopenharmony_ci *
285162306a36Sopenharmony_ci * @uapsd_max_sp_len: maximum number of total buffered frames the WMM AP may
285262306a36Sopenharmony_ci *	deliver to a WMM STA during any Service Period triggered by the WMM STA.
285362306a36Sopenharmony_ci *	Use IEEE80211_WMM_IE_STA_QOSINFO_SP_* for correct values.
285462306a36Sopenharmony_ci *
285562306a36Sopenharmony_ci * @max_nan_de_entries: maximum number of NAN DE functions supported by the
285662306a36Sopenharmony_ci *	device.
285762306a36Sopenharmony_ci *
285862306a36Sopenharmony_ci * @tx_sk_pacing_shift: Pacing shift to set on TCP sockets when frames from
285962306a36Sopenharmony_ci *	them are encountered. The default should typically not be changed,
286062306a36Sopenharmony_ci *	unless the driver has good reasons for needing more buffers.
286162306a36Sopenharmony_ci *
286262306a36Sopenharmony_ci * @weight_multiplier: Driver specific airtime weight multiplier used while
286362306a36Sopenharmony_ci *	refilling deficit of each TXQ.
286462306a36Sopenharmony_ci *
286562306a36Sopenharmony_ci * @max_mtu: the max mtu could be set.
286662306a36Sopenharmony_ci *
286762306a36Sopenharmony_ci * @tx_power_levels: a list of power levels supported by the wifi hardware.
286862306a36Sopenharmony_ci * 	The power levels can be specified either as integer or fractions.
286962306a36Sopenharmony_ci * 	The power level at idx 0 shall be the maximum positive power level.
287062306a36Sopenharmony_ci *
287162306a36Sopenharmony_ci * @max_txpwr_levels_idx: the maximum valid idx of 'tx_power_levels' list.
287262306a36Sopenharmony_ci */
287362306a36Sopenharmony_cistruct ieee80211_hw {
287462306a36Sopenharmony_ci	struct ieee80211_conf conf;
287562306a36Sopenharmony_ci	struct wiphy *wiphy;
287662306a36Sopenharmony_ci	const char *rate_control_algorithm;
287762306a36Sopenharmony_ci	void *priv;
287862306a36Sopenharmony_ci	unsigned long flags[BITS_TO_LONGS(NUM_IEEE80211_HW_FLAGS)];
287962306a36Sopenharmony_ci	unsigned int extra_tx_headroom;
288062306a36Sopenharmony_ci	unsigned int extra_beacon_tailroom;
288162306a36Sopenharmony_ci	int vif_data_size;
288262306a36Sopenharmony_ci	int sta_data_size;
288362306a36Sopenharmony_ci	int chanctx_data_size;
288462306a36Sopenharmony_ci	int txq_data_size;
288562306a36Sopenharmony_ci	u16 queues;
288662306a36Sopenharmony_ci	u16 max_listen_interval;
288762306a36Sopenharmony_ci	s8 max_signal;
288862306a36Sopenharmony_ci	u8 max_rates;
288962306a36Sopenharmony_ci	u8 max_report_rates;
289062306a36Sopenharmony_ci	u8 max_rate_tries;
289162306a36Sopenharmony_ci	u16 max_rx_aggregation_subframes;
289262306a36Sopenharmony_ci	u16 max_tx_aggregation_subframes;
289362306a36Sopenharmony_ci	u8 max_tx_fragments;
289462306a36Sopenharmony_ci	u8 offchannel_tx_hw_queue;
289562306a36Sopenharmony_ci	u8 radiotap_mcs_details;
289662306a36Sopenharmony_ci	u16 radiotap_vht_details;
289762306a36Sopenharmony_ci	struct {
289862306a36Sopenharmony_ci		int units_pos;
289962306a36Sopenharmony_ci		s16 accuracy;
290062306a36Sopenharmony_ci	} radiotap_timestamp;
290162306a36Sopenharmony_ci	netdev_features_t netdev_features;
290262306a36Sopenharmony_ci	u8 uapsd_queues;
290362306a36Sopenharmony_ci	u8 uapsd_max_sp_len;
290462306a36Sopenharmony_ci	u8 max_nan_de_entries;
290562306a36Sopenharmony_ci	u8 tx_sk_pacing_shift;
290662306a36Sopenharmony_ci	u8 weight_multiplier;
290762306a36Sopenharmony_ci	u32 max_mtu;
290862306a36Sopenharmony_ci	const s8 *tx_power_levels;
290962306a36Sopenharmony_ci	u8 max_txpwr_levels_idx;
291062306a36Sopenharmony_ci};
291162306a36Sopenharmony_ci
291262306a36Sopenharmony_cistatic inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
291362306a36Sopenharmony_ci				       enum ieee80211_hw_flags flg)
291462306a36Sopenharmony_ci{
291562306a36Sopenharmony_ci	return test_bit(flg, hw->flags);
291662306a36Sopenharmony_ci}
291762306a36Sopenharmony_ci#define ieee80211_hw_check(hw, flg)	_ieee80211_hw_check(hw, IEEE80211_HW_##flg)
291862306a36Sopenharmony_ci
291962306a36Sopenharmony_cistatic inline void _ieee80211_hw_set(struct ieee80211_hw *hw,
292062306a36Sopenharmony_ci				     enum ieee80211_hw_flags flg)
292162306a36Sopenharmony_ci{
292262306a36Sopenharmony_ci	return __set_bit(flg, hw->flags);
292362306a36Sopenharmony_ci}
292462306a36Sopenharmony_ci#define ieee80211_hw_set(hw, flg)	_ieee80211_hw_set(hw, IEEE80211_HW_##flg)
292562306a36Sopenharmony_ci
292662306a36Sopenharmony_ci/**
292762306a36Sopenharmony_ci * struct ieee80211_scan_request - hw scan request
292862306a36Sopenharmony_ci *
292962306a36Sopenharmony_ci * @ies: pointers different parts of IEs (in req.ie)
293062306a36Sopenharmony_ci * @req: cfg80211 request.
293162306a36Sopenharmony_ci */
293262306a36Sopenharmony_cistruct ieee80211_scan_request {
293362306a36Sopenharmony_ci	struct ieee80211_scan_ies ies;
293462306a36Sopenharmony_ci
293562306a36Sopenharmony_ci	/* Keep last */
293662306a36Sopenharmony_ci	struct cfg80211_scan_request req;
293762306a36Sopenharmony_ci};
293862306a36Sopenharmony_ci
293962306a36Sopenharmony_ci/**
294062306a36Sopenharmony_ci * struct ieee80211_tdls_ch_sw_params - TDLS channel switch parameters
294162306a36Sopenharmony_ci *
294262306a36Sopenharmony_ci * @sta: peer this TDLS channel-switch request/response came from
294362306a36Sopenharmony_ci * @chandef: channel referenced in a TDLS channel-switch request
294462306a36Sopenharmony_ci * @action_code: see &enum ieee80211_tdls_actioncode
294562306a36Sopenharmony_ci * @status: channel-switch response status
294662306a36Sopenharmony_ci * @timestamp: time at which the frame was received
294762306a36Sopenharmony_ci * @switch_time: switch-timing parameter received in the frame
294862306a36Sopenharmony_ci * @switch_timeout: switch-timing parameter received in the frame
294962306a36Sopenharmony_ci * @tmpl_skb: TDLS switch-channel response template
295062306a36Sopenharmony_ci * @ch_sw_tm_ie: offset of the channel-switch timing IE inside @tmpl_skb
295162306a36Sopenharmony_ci */
295262306a36Sopenharmony_cistruct ieee80211_tdls_ch_sw_params {
295362306a36Sopenharmony_ci	struct ieee80211_sta *sta;
295462306a36Sopenharmony_ci	struct cfg80211_chan_def *chandef;
295562306a36Sopenharmony_ci	u8 action_code;
295662306a36Sopenharmony_ci	u32 status;
295762306a36Sopenharmony_ci	u32 timestamp;
295862306a36Sopenharmony_ci	u16 switch_time;
295962306a36Sopenharmony_ci	u16 switch_timeout;
296062306a36Sopenharmony_ci	struct sk_buff *tmpl_skb;
296162306a36Sopenharmony_ci	u32 ch_sw_tm_ie;
296262306a36Sopenharmony_ci};
296362306a36Sopenharmony_ci
296462306a36Sopenharmony_ci/**
296562306a36Sopenharmony_ci * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
296662306a36Sopenharmony_ci *
296762306a36Sopenharmony_ci * @wiphy: the &struct wiphy which we want to query
296862306a36Sopenharmony_ci *
296962306a36Sopenharmony_ci * mac80211 drivers can use this to get to their respective
297062306a36Sopenharmony_ci * &struct ieee80211_hw. Drivers wishing to get to their own private
297162306a36Sopenharmony_ci * structure can then access it via hw->priv. Note that mac802111 drivers should
297262306a36Sopenharmony_ci * not use wiphy_priv() to try to get their private driver structure as this
297362306a36Sopenharmony_ci * is already used internally by mac80211.
297462306a36Sopenharmony_ci *
297562306a36Sopenharmony_ci * Return: The mac80211 driver hw struct of @wiphy.
297662306a36Sopenharmony_ci */
297762306a36Sopenharmony_cistruct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
297862306a36Sopenharmony_ci
297962306a36Sopenharmony_ci/**
298062306a36Sopenharmony_ci * SET_IEEE80211_DEV - set device for 802.11 hardware
298162306a36Sopenharmony_ci *
298262306a36Sopenharmony_ci * @hw: the &struct ieee80211_hw to set the device for
298362306a36Sopenharmony_ci * @dev: the &struct device of this 802.11 device
298462306a36Sopenharmony_ci */
298562306a36Sopenharmony_cistatic inline void SET_IEEE80211_DEV(struct ieee80211_hw *hw, struct device *dev)
298662306a36Sopenharmony_ci{
298762306a36Sopenharmony_ci	set_wiphy_dev(hw->wiphy, dev);
298862306a36Sopenharmony_ci}
298962306a36Sopenharmony_ci
299062306a36Sopenharmony_ci/**
299162306a36Sopenharmony_ci * SET_IEEE80211_PERM_ADDR - set the permanent MAC address for 802.11 hardware
299262306a36Sopenharmony_ci *
299362306a36Sopenharmony_ci * @hw: the &struct ieee80211_hw to set the MAC address for
299462306a36Sopenharmony_ci * @addr: the address to set
299562306a36Sopenharmony_ci */
299662306a36Sopenharmony_cistatic inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, const u8 *addr)
299762306a36Sopenharmony_ci{
299862306a36Sopenharmony_ci	memcpy(hw->wiphy->perm_addr, addr, ETH_ALEN);
299962306a36Sopenharmony_ci}
300062306a36Sopenharmony_ci
300162306a36Sopenharmony_cistatic inline struct ieee80211_rate *
300262306a36Sopenharmony_ciieee80211_get_tx_rate(const struct ieee80211_hw *hw,
300362306a36Sopenharmony_ci		      const struct ieee80211_tx_info *c)
300462306a36Sopenharmony_ci{
300562306a36Sopenharmony_ci	if (WARN_ON_ONCE(c->control.rates[0].idx < 0))
300662306a36Sopenharmony_ci		return NULL;
300762306a36Sopenharmony_ci	return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[0].idx];
300862306a36Sopenharmony_ci}
300962306a36Sopenharmony_ci
301062306a36Sopenharmony_cistatic inline struct ieee80211_rate *
301162306a36Sopenharmony_ciieee80211_get_rts_cts_rate(const struct ieee80211_hw *hw,
301262306a36Sopenharmony_ci			   const struct ieee80211_tx_info *c)
301362306a36Sopenharmony_ci{
301462306a36Sopenharmony_ci	if (c->control.rts_cts_rate_idx < 0)
301562306a36Sopenharmony_ci		return NULL;
301662306a36Sopenharmony_ci	return &hw->wiphy->bands[c->band]->bitrates[c->control.rts_cts_rate_idx];
301762306a36Sopenharmony_ci}
301862306a36Sopenharmony_ci
301962306a36Sopenharmony_cistatic inline struct ieee80211_rate *
302062306a36Sopenharmony_ciieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
302162306a36Sopenharmony_ci			     const struct ieee80211_tx_info *c, int idx)
302262306a36Sopenharmony_ci{
302362306a36Sopenharmony_ci	if (c->control.rates[idx + 1].idx < 0)
302462306a36Sopenharmony_ci		return NULL;
302562306a36Sopenharmony_ci	return &hw->wiphy->bands[c->band]->bitrates[c->control.rates[idx + 1].idx];
302662306a36Sopenharmony_ci}
302762306a36Sopenharmony_ci
302862306a36Sopenharmony_ci/**
302962306a36Sopenharmony_ci * ieee80211_free_txskb - free TX skb
303062306a36Sopenharmony_ci * @hw: the hardware
303162306a36Sopenharmony_ci * @skb: the skb
303262306a36Sopenharmony_ci *
303362306a36Sopenharmony_ci * Free a transmit skb. Use this function when some failure
303462306a36Sopenharmony_ci * to transmit happened and thus status cannot be reported.
303562306a36Sopenharmony_ci */
303662306a36Sopenharmony_civoid ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb);
303762306a36Sopenharmony_ci
303862306a36Sopenharmony_ci/**
303962306a36Sopenharmony_ci * DOC: Hardware crypto acceleration
304062306a36Sopenharmony_ci *
304162306a36Sopenharmony_ci * mac80211 is capable of taking advantage of many hardware
304262306a36Sopenharmony_ci * acceleration designs for encryption and decryption operations.
304362306a36Sopenharmony_ci *
304462306a36Sopenharmony_ci * The set_key() callback in the &struct ieee80211_ops for a given
304562306a36Sopenharmony_ci * device is called to enable hardware acceleration of encryption and
304662306a36Sopenharmony_ci * decryption. The callback takes a @sta parameter that will be NULL
304762306a36Sopenharmony_ci * for default keys or keys used for transmission only, or point to
304862306a36Sopenharmony_ci * the station information for the peer for individual keys.
304962306a36Sopenharmony_ci * Multiple transmission keys with the same key index may be used when
305062306a36Sopenharmony_ci * VLANs are configured for an access point.
305162306a36Sopenharmony_ci *
305262306a36Sopenharmony_ci * When transmitting, the TX control data will use the @hw_key_idx
305362306a36Sopenharmony_ci * selected by the driver by modifying the &struct ieee80211_key_conf
305462306a36Sopenharmony_ci * pointed to by the @key parameter to the set_key() function.
305562306a36Sopenharmony_ci *
305662306a36Sopenharmony_ci * The set_key() call for the %SET_KEY command should return 0 if
305762306a36Sopenharmony_ci * the key is now in use, -%EOPNOTSUPP or -%ENOSPC if it couldn't be
305862306a36Sopenharmony_ci * added; if you return 0 then hw_key_idx must be assigned to the
305962306a36Sopenharmony_ci * hardware key index, you are free to use the full u8 range.
306062306a36Sopenharmony_ci *
306162306a36Sopenharmony_ci * Note that in the case that the @IEEE80211_HW_SW_CRYPTO_CONTROL flag is
306262306a36Sopenharmony_ci * set, mac80211 will not automatically fall back to software crypto if
306362306a36Sopenharmony_ci * enabling hardware crypto failed. The set_key() call may also return the
306462306a36Sopenharmony_ci * value 1 to permit this specific key/algorithm to be done in software.
306562306a36Sopenharmony_ci *
306662306a36Sopenharmony_ci * When the cmd is %DISABLE_KEY then it must succeed.
306762306a36Sopenharmony_ci *
306862306a36Sopenharmony_ci * Note that it is permissible to not decrypt a frame even if a key
306962306a36Sopenharmony_ci * for it has been uploaded to hardware, the stack will not make any
307062306a36Sopenharmony_ci * decision based on whether a key has been uploaded or not but rather
307162306a36Sopenharmony_ci * based on the receive flags.
307262306a36Sopenharmony_ci *
307362306a36Sopenharmony_ci * The &struct ieee80211_key_conf structure pointed to by the @key
307462306a36Sopenharmony_ci * parameter is guaranteed to be valid until another call to set_key()
307562306a36Sopenharmony_ci * removes it, but it can only be used as a cookie to differentiate
307662306a36Sopenharmony_ci * keys.
307762306a36Sopenharmony_ci *
307862306a36Sopenharmony_ci * In TKIP some HW need to be provided a phase 1 key, for RX decryption
307962306a36Sopenharmony_ci * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key
308062306a36Sopenharmony_ci * handler.
308162306a36Sopenharmony_ci * The update_tkip_key() call updates the driver with the new phase 1 key.
308262306a36Sopenharmony_ci * This happens every time the iv16 wraps around (every 65536 packets). The
308362306a36Sopenharmony_ci * set_key() call will happen only once for each key (unless the AP did
308462306a36Sopenharmony_ci * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
308562306a36Sopenharmony_ci * provided by update_tkip_key only. The trigger that makes mac80211 call this
308662306a36Sopenharmony_ci * handler is software decryption with wrap around of iv16.
308762306a36Sopenharmony_ci *
308862306a36Sopenharmony_ci * The set_default_unicast_key() call updates the default WEP key index
308962306a36Sopenharmony_ci * configured to the hardware for WEP encryption type. This is required
309062306a36Sopenharmony_ci * for devices that support offload of data packets (e.g. ARP responses).
309162306a36Sopenharmony_ci *
309262306a36Sopenharmony_ci * Mac80211 drivers should set the @NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 flag
309362306a36Sopenharmony_ci * when they are able to replace in-use PTK keys according to the following
309462306a36Sopenharmony_ci * requirements:
309562306a36Sopenharmony_ci * 1) They do not hand over frames decrypted with the old key to mac80211
309662306a36Sopenharmony_ci      once the call to set_key() with command %DISABLE_KEY has been completed,
309762306a36Sopenharmony_ci   2) either drop or continue to use the old key for any outgoing frames queued
309862306a36Sopenharmony_ci      at the time of the key deletion (including re-transmits),
309962306a36Sopenharmony_ci   3) never send out a frame queued prior to the set_key() %SET_KEY command
310062306a36Sopenharmony_ci      encrypted with the new key when also needing
310162306a36Sopenharmony_ci      @IEEE80211_KEY_FLAG_GENERATE_IV and
310262306a36Sopenharmony_ci   4) never send out a frame unencrypted when it should be encrypted.
310362306a36Sopenharmony_ci   Mac80211 will not queue any new frames for a deleted key to the driver.
310462306a36Sopenharmony_ci */
310562306a36Sopenharmony_ci
310662306a36Sopenharmony_ci/**
310762306a36Sopenharmony_ci * DOC: Powersave support
310862306a36Sopenharmony_ci *
310962306a36Sopenharmony_ci * mac80211 has support for various powersave implementations.
311062306a36Sopenharmony_ci *
311162306a36Sopenharmony_ci * First, it can support hardware that handles all powersaving by itself,
311262306a36Sopenharmony_ci * such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS hardware
311362306a36Sopenharmony_ci * flag. In that case, it will be told about the desired powersave mode
311462306a36Sopenharmony_ci * with the %IEEE80211_CONF_PS flag depending on the association status.
311562306a36Sopenharmony_ci * The hardware must take care of sending nullfunc frames when necessary,
311662306a36Sopenharmony_ci * i.e. when entering and leaving powersave mode. The hardware is required
311762306a36Sopenharmony_ci * to look at the AID in beacons and signal to the AP that it woke up when
311862306a36Sopenharmony_ci * it finds traffic directed to it.
311962306a36Sopenharmony_ci *
312062306a36Sopenharmony_ci * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in
312162306a36Sopenharmony_ci * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused
312262306a36Sopenharmony_ci * with hardware wakeup and sleep states. Driver is responsible for waking
312362306a36Sopenharmony_ci * up the hardware before issuing commands to the hardware and putting it
312462306a36Sopenharmony_ci * back to sleep at appropriate times.
312562306a36Sopenharmony_ci *
312662306a36Sopenharmony_ci * When PS is enabled, hardware needs to wakeup for beacons and receive the
312762306a36Sopenharmony_ci * buffered multicast/broadcast frames after the beacon. Also it must be
312862306a36Sopenharmony_ci * possible to send frames and receive the acknowledment frame.
312962306a36Sopenharmony_ci *
313062306a36Sopenharmony_ci * Other hardware designs cannot send nullfunc frames by themselves and also
313162306a36Sopenharmony_ci * need software support for parsing the TIM bitmap. This is also supported
313262306a36Sopenharmony_ci * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
313362306a36Sopenharmony_ci * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
313462306a36Sopenharmony_ci * required to pass up beacons. The hardware is still required to handle
313562306a36Sopenharmony_ci * waking up for multicast traffic; if it cannot the driver must handle that
313662306a36Sopenharmony_ci * as best as it can, mac80211 is too slow to do that.
313762306a36Sopenharmony_ci *
313862306a36Sopenharmony_ci * Dynamic powersave is an extension to normal powersave in which the
313962306a36Sopenharmony_ci * hardware stays awake for a user-specified period of time after sending a
314062306a36Sopenharmony_ci * frame so that reply frames need not be buffered and therefore delayed to
314162306a36Sopenharmony_ci * the next wakeup. It's compromise of getting good enough latency when
314262306a36Sopenharmony_ci * there's data traffic and still saving significantly power in idle
314362306a36Sopenharmony_ci * periods.
314462306a36Sopenharmony_ci *
314562306a36Sopenharmony_ci * Dynamic powersave is simply supported by mac80211 enabling and disabling
314662306a36Sopenharmony_ci * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS
314762306a36Sopenharmony_ci * flag and mac80211 will handle everything automatically. Additionally,
314862306a36Sopenharmony_ci * hardware having support for the dynamic PS feature may set the
314962306a36Sopenharmony_ci * %IEEE80211_HW_SUPPORTS_DYNAMIC_PS flag to indicate that it can support
315062306a36Sopenharmony_ci * dynamic PS mode itself. The driver needs to look at the
315162306a36Sopenharmony_ci * @dynamic_ps_timeout hardware configuration value and use it that value
315262306a36Sopenharmony_ci * whenever %IEEE80211_CONF_PS is set. In this case mac80211 will disable
315362306a36Sopenharmony_ci * dynamic PS feature in stack and will just keep %IEEE80211_CONF_PS
315462306a36Sopenharmony_ci * enabled whenever user has enabled powersave.
315562306a36Sopenharmony_ci *
315662306a36Sopenharmony_ci * Driver informs U-APSD client support by enabling
315762306a36Sopenharmony_ci * %IEEE80211_VIF_SUPPORTS_UAPSD flag. The mode is configured through the
315862306a36Sopenharmony_ci * uapsd parameter in conf_tx() operation. Hardware needs to send the QoS
315962306a36Sopenharmony_ci * Nullfunc frames and stay awake until the service period has ended. To
316062306a36Sopenharmony_ci * utilize U-APSD, dynamic powersave is disabled for voip AC and all frames
316162306a36Sopenharmony_ci * from that AC are transmitted with powersave enabled.
316262306a36Sopenharmony_ci *
316362306a36Sopenharmony_ci * Note: U-APSD client mode is not yet supported with
316462306a36Sopenharmony_ci * %IEEE80211_HW_PS_NULLFUNC_STACK.
316562306a36Sopenharmony_ci */
316662306a36Sopenharmony_ci
316762306a36Sopenharmony_ci/**
316862306a36Sopenharmony_ci * DOC: Beacon filter support
316962306a36Sopenharmony_ci *
317062306a36Sopenharmony_ci * Some hardware have beacon filter support to reduce host cpu wakeups
317162306a36Sopenharmony_ci * which will reduce system power consumption. It usually works so that
317262306a36Sopenharmony_ci * the firmware creates a checksum of the beacon but omits all constantly
317362306a36Sopenharmony_ci * changing elements (TSF, TIM etc). Whenever the checksum changes the
317462306a36Sopenharmony_ci * beacon is forwarded to the host, otherwise it will be just dropped. That
317562306a36Sopenharmony_ci * way the host will only receive beacons where some relevant information
317662306a36Sopenharmony_ci * (for example ERP protection or WMM settings) have changed.
317762306a36Sopenharmony_ci *
317862306a36Sopenharmony_ci * Beacon filter support is advertised with the %IEEE80211_VIF_BEACON_FILTER
317962306a36Sopenharmony_ci * interface capability. The driver needs to enable beacon filter support
318062306a36Sopenharmony_ci * whenever power save is enabled, that is %IEEE80211_CONF_PS is set. When
318162306a36Sopenharmony_ci * power save is enabled, the stack will not check for beacon loss and the
318262306a36Sopenharmony_ci * driver needs to notify about loss of beacons with ieee80211_beacon_loss().
318362306a36Sopenharmony_ci *
318462306a36Sopenharmony_ci * The time (or number of beacons missed) until the firmware notifies the
318562306a36Sopenharmony_ci * driver of a beacon loss event (which in turn causes the driver to call
318662306a36Sopenharmony_ci * ieee80211_beacon_loss()) should be configurable and will be controlled
318762306a36Sopenharmony_ci * by mac80211 and the roaming algorithm in the future.
318862306a36Sopenharmony_ci *
318962306a36Sopenharmony_ci * Since there may be constantly changing information elements that nothing
319062306a36Sopenharmony_ci * in the software stack cares about, we will, in the future, have mac80211
319162306a36Sopenharmony_ci * tell the driver which information elements are interesting in the sense
319262306a36Sopenharmony_ci * that we want to see changes in them. This will include
319362306a36Sopenharmony_ci *
319462306a36Sopenharmony_ci *  - a list of information element IDs
319562306a36Sopenharmony_ci *  - a list of OUIs for the vendor information element
319662306a36Sopenharmony_ci *
319762306a36Sopenharmony_ci * Ideally, the hardware would filter out any beacons without changes in the
319862306a36Sopenharmony_ci * requested elements, but if it cannot support that it may, at the expense
319962306a36Sopenharmony_ci * of some efficiency, filter out only a subset. For example, if the device
320062306a36Sopenharmony_ci * doesn't support checking for OUIs it should pass up all changes in all
320162306a36Sopenharmony_ci * vendor information elements.
320262306a36Sopenharmony_ci *
320362306a36Sopenharmony_ci * Note that change, for the sake of simplification, also includes information
320462306a36Sopenharmony_ci * elements appearing or disappearing from the beacon.
320562306a36Sopenharmony_ci *
320662306a36Sopenharmony_ci * Some hardware supports an "ignore list" instead, just make sure nothing
320762306a36Sopenharmony_ci * that was requested is on the ignore list, and include commonly changing
320862306a36Sopenharmony_ci * information element IDs in the ignore list, for example 11 (BSS load) and
320962306a36Sopenharmony_ci * the various vendor-assigned IEs with unknown contents (128, 129, 133-136,
321062306a36Sopenharmony_ci * 149, 150, 155, 156, 173, 176, 178, 179, 219); for forward compatibility
321162306a36Sopenharmony_ci * it could also include some currently unused IDs.
321262306a36Sopenharmony_ci *
321362306a36Sopenharmony_ci *
321462306a36Sopenharmony_ci * In addition to these capabilities, hardware should support notifying the
321562306a36Sopenharmony_ci * host of changes in the beacon RSSI. This is relevant to implement roaming
321662306a36Sopenharmony_ci * when no traffic is flowing (when traffic is flowing we see the RSSI of
321762306a36Sopenharmony_ci * the received data packets). This can consist in notifying the host when
321862306a36Sopenharmony_ci * the RSSI changes significantly or when it drops below or rises above
321962306a36Sopenharmony_ci * configurable thresholds. In the future these thresholds will also be
322062306a36Sopenharmony_ci * configured by mac80211 (which gets them from userspace) to implement
322162306a36Sopenharmony_ci * them as the roaming algorithm requires.
322262306a36Sopenharmony_ci *
322362306a36Sopenharmony_ci * If the hardware cannot implement this, the driver should ask it to
322462306a36Sopenharmony_ci * periodically pass beacon frames to the host so that software can do the
322562306a36Sopenharmony_ci * signal strength threshold checking.
322662306a36Sopenharmony_ci */
322762306a36Sopenharmony_ci
322862306a36Sopenharmony_ci/**
322962306a36Sopenharmony_ci * DOC: Spatial multiplexing power save
323062306a36Sopenharmony_ci *
323162306a36Sopenharmony_ci * SMPS (Spatial multiplexing power save) is a mechanism to conserve
323262306a36Sopenharmony_ci * power in an 802.11n implementation. For details on the mechanism
323362306a36Sopenharmony_ci * and rationale, please refer to 802.11 (as amended by 802.11n-2009)
323462306a36Sopenharmony_ci * "11.2.3 SM power save".
323562306a36Sopenharmony_ci *
323662306a36Sopenharmony_ci * The mac80211 implementation is capable of sending action frames
323762306a36Sopenharmony_ci * to update the AP about the station's SMPS mode, and will instruct
323862306a36Sopenharmony_ci * the driver to enter the specific mode. It will also announce the
323962306a36Sopenharmony_ci * requested SMPS mode during the association handshake. Hardware
324062306a36Sopenharmony_ci * support for this feature is required, and can be indicated by
324162306a36Sopenharmony_ci * hardware flags.
324262306a36Sopenharmony_ci *
324362306a36Sopenharmony_ci * The default mode will be "automatic", which nl80211/cfg80211
324462306a36Sopenharmony_ci * defines to be dynamic SMPS in (regular) powersave, and SMPS
324562306a36Sopenharmony_ci * turned off otherwise.
324662306a36Sopenharmony_ci *
324762306a36Sopenharmony_ci * To support this feature, the driver must set the appropriate
324862306a36Sopenharmony_ci * hardware support flags, and handle the SMPS flag to the config()
324962306a36Sopenharmony_ci * operation. It will then with this mechanism be instructed to
325062306a36Sopenharmony_ci * enter the requested SMPS mode while associated to an HT AP.
325162306a36Sopenharmony_ci */
325262306a36Sopenharmony_ci
325362306a36Sopenharmony_ci/**
325462306a36Sopenharmony_ci * DOC: Frame filtering
325562306a36Sopenharmony_ci *
325662306a36Sopenharmony_ci * mac80211 requires to see many management frames for proper
325762306a36Sopenharmony_ci * operation, and users may want to see many more frames when
325862306a36Sopenharmony_ci * in monitor mode. However, for best CPU usage and power consumption,
325962306a36Sopenharmony_ci * having as few frames as possible percolate through the stack is
326062306a36Sopenharmony_ci * desirable. Hence, the hardware should filter as much as possible.
326162306a36Sopenharmony_ci *
326262306a36Sopenharmony_ci * To achieve this, mac80211 uses filter flags (see below) to tell
326362306a36Sopenharmony_ci * the driver's configure_filter() function which frames should be
326462306a36Sopenharmony_ci * passed to mac80211 and which should be filtered out.
326562306a36Sopenharmony_ci *
326662306a36Sopenharmony_ci * Before configure_filter() is invoked, the prepare_multicast()
326762306a36Sopenharmony_ci * callback is invoked with the parameters @mc_count and @mc_list
326862306a36Sopenharmony_ci * for the combined multicast address list of all virtual interfaces.
326962306a36Sopenharmony_ci * It's use is optional, and it returns a u64 that is passed to
327062306a36Sopenharmony_ci * configure_filter(). Additionally, configure_filter() has the
327162306a36Sopenharmony_ci * arguments @changed_flags telling which flags were changed and
327262306a36Sopenharmony_ci * @total_flags with the new flag states.
327362306a36Sopenharmony_ci *
327462306a36Sopenharmony_ci * If your device has no multicast address filters your driver will
327562306a36Sopenharmony_ci * need to check both the %FIF_ALLMULTI flag and the @mc_count
327662306a36Sopenharmony_ci * parameter to see whether multicast frames should be accepted
327762306a36Sopenharmony_ci * or dropped.
327862306a36Sopenharmony_ci *
327962306a36Sopenharmony_ci * All unsupported flags in @total_flags must be cleared.
328062306a36Sopenharmony_ci * Hardware does not support a flag if it is incapable of _passing_
328162306a36Sopenharmony_ci * the frame to the stack. Otherwise the driver must ignore
328262306a36Sopenharmony_ci * the flag, but not clear it.
328362306a36Sopenharmony_ci * You must _only_ clear the flag (announce no support for the
328462306a36Sopenharmony_ci * flag to mac80211) if you are not able to pass the packet type
328562306a36Sopenharmony_ci * to the stack (so the hardware always filters it).
328662306a36Sopenharmony_ci * So for example, you should clear @FIF_CONTROL, if your hardware
328762306a36Sopenharmony_ci * always filters control frames. If your hardware always passes
328862306a36Sopenharmony_ci * control frames to the kernel and is incapable of filtering them,
328962306a36Sopenharmony_ci * you do _not_ clear the @FIF_CONTROL flag.
329062306a36Sopenharmony_ci * This rule applies to all other FIF flags as well.
329162306a36Sopenharmony_ci */
329262306a36Sopenharmony_ci
329362306a36Sopenharmony_ci/**
329462306a36Sopenharmony_ci * DOC: AP support for powersaving clients
329562306a36Sopenharmony_ci *
329662306a36Sopenharmony_ci * In order to implement AP and P2P GO modes, mac80211 has support for
329762306a36Sopenharmony_ci * client powersaving, both "legacy" PS (PS-Poll/null data) and uAPSD.
329862306a36Sopenharmony_ci * There currently is no support for sAPSD.
329962306a36Sopenharmony_ci *
330062306a36Sopenharmony_ci * There is one assumption that mac80211 makes, namely that a client
330162306a36Sopenharmony_ci * will not poll with PS-Poll and trigger with uAPSD at the same time.
330262306a36Sopenharmony_ci * Both are supported, and both can be used by the same client, but
330362306a36Sopenharmony_ci * they can't be used concurrently by the same client. This simplifies
330462306a36Sopenharmony_ci * the driver code.
330562306a36Sopenharmony_ci *
330662306a36Sopenharmony_ci * The first thing to keep in mind is that there is a flag for complete
330762306a36Sopenharmony_ci * driver implementation: %IEEE80211_HW_AP_LINK_PS. If this flag is set,
330862306a36Sopenharmony_ci * mac80211 expects the driver to handle most of the state machine for
330962306a36Sopenharmony_ci * powersaving clients and will ignore the PM bit in incoming frames.
331062306a36Sopenharmony_ci * Drivers then use ieee80211_sta_ps_transition() to inform mac80211 of
331162306a36Sopenharmony_ci * stations' powersave transitions. In this mode, mac80211 also doesn't
331262306a36Sopenharmony_ci * handle PS-Poll/uAPSD.
331362306a36Sopenharmony_ci *
331462306a36Sopenharmony_ci * In the mode without %IEEE80211_HW_AP_LINK_PS, mac80211 will check the
331562306a36Sopenharmony_ci * PM bit in incoming frames for client powersave transitions. When a
331662306a36Sopenharmony_ci * station goes to sleep, we will stop transmitting to it. There is,
331762306a36Sopenharmony_ci * however, a race condition: a station might go to sleep while there is
331862306a36Sopenharmony_ci * data buffered on hardware queues. If the device has support for this
331962306a36Sopenharmony_ci * it will reject frames, and the driver should give the frames back to
332062306a36Sopenharmony_ci * mac80211 with the %IEEE80211_TX_STAT_TX_FILTERED flag set which will
332162306a36Sopenharmony_ci * cause mac80211 to retry the frame when the station wakes up. The
332262306a36Sopenharmony_ci * driver is also notified of powersave transitions by calling its
332362306a36Sopenharmony_ci * @sta_notify callback.
332462306a36Sopenharmony_ci *
332562306a36Sopenharmony_ci * When the station is asleep, it has three choices: it can wake up,
332662306a36Sopenharmony_ci * it can PS-Poll, or it can possibly start a uAPSD service period.
332762306a36Sopenharmony_ci * Waking up is implemented by simply transmitting all buffered (and
332862306a36Sopenharmony_ci * filtered) frames to the station. This is the easiest case. When
332962306a36Sopenharmony_ci * the station sends a PS-Poll or a uAPSD trigger frame, mac80211
333062306a36Sopenharmony_ci * will inform the driver of this with the @allow_buffered_frames
333162306a36Sopenharmony_ci * callback; this callback is optional. mac80211 will then transmit
333262306a36Sopenharmony_ci * the frames as usual and set the %IEEE80211_TX_CTL_NO_PS_BUFFER
333362306a36Sopenharmony_ci * on each frame. The last frame in the service period (or the only
333462306a36Sopenharmony_ci * response to a PS-Poll) also has %IEEE80211_TX_STATUS_EOSP set to
333562306a36Sopenharmony_ci * indicate that it ends the service period; as this frame must have
333662306a36Sopenharmony_ci * TX status report it also sets %IEEE80211_TX_CTL_REQ_TX_STATUS.
333762306a36Sopenharmony_ci * When TX status is reported for this frame, the service period is
333862306a36Sopenharmony_ci * marked has having ended and a new one can be started by the peer.
333962306a36Sopenharmony_ci *
334062306a36Sopenharmony_ci * Additionally, non-bufferable MMPDUs can also be transmitted by
334162306a36Sopenharmony_ci * mac80211 with the %IEEE80211_TX_CTL_NO_PS_BUFFER set in them.
334262306a36Sopenharmony_ci *
334362306a36Sopenharmony_ci * Another race condition can happen on some devices like iwlwifi
334462306a36Sopenharmony_ci * when there are frames queued for the station and it wakes up
334562306a36Sopenharmony_ci * or polls; the frames that are already queued could end up being
334662306a36Sopenharmony_ci * transmitted first instead, causing reordering and/or wrong
334762306a36Sopenharmony_ci * processing of the EOSP. The cause is that allowing frames to be
334862306a36Sopenharmony_ci * transmitted to a certain station is out-of-band communication to
334962306a36Sopenharmony_ci * the device. To allow this problem to be solved, the driver can
335062306a36Sopenharmony_ci * call ieee80211_sta_block_awake() if frames are buffered when it
335162306a36Sopenharmony_ci * is notified that the station went to sleep. When all these frames
335262306a36Sopenharmony_ci * have been filtered (see above), it must call the function again
335362306a36Sopenharmony_ci * to indicate that the station is no longer blocked.
335462306a36Sopenharmony_ci *
335562306a36Sopenharmony_ci * If the driver buffers frames in the driver for aggregation in any
335662306a36Sopenharmony_ci * way, it must use the ieee80211_sta_set_buffered() call when it is
335762306a36Sopenharmony_ci * notified of the station going to sleep to inform mac80211 of any
335862306a36Sopenharmony_ci * TIDs that have frames buffered. Note that when a station wakes up
335962306a36Sopenharmony_ci * this information is reset (hence the requirement to call it when
336062306a36Sopenharmony_ci * informed of the station going to sleep). Then, when a service
336162306a36Sopenharmony_ci * period starts for any reason, @release_buffered_frames is called
336262306a36Sopenharmony_ci * with the number of frames to be released and which TIDs they are
336362306a36Sopenharmony_ci * to come from. In this case, the driver is responsible for setting
336462306a36Sopenharmony_ci * the EOSP (for uAPSD) and MORE_DATA bits in the released frames,
336562306a36Sopenharmony_ci * to help the @more_data parameter is passed to tell the driver if
336662306a36Sopenharmony_ci * there is more data on other TIDs -- the TIDs to release frames
336762306a36Sopenharmony_ci * from are ignored since mac80211 doesn't know how many frames the
336862306a36Sopenharmony_ci * buffers for those TIDs contain.
336962306a36Sopenharmony_ci *
337062306a36Sopenharmony_ci * If the driver also implement GO mode, where absence periods may
337162306a36Sopenharmony_ci * shorten service periods (or abort PS-Poll responses), it must
337262306a36Sopenharmony_ci * filter those response frames except in the case of frames that
337362306a36Sopenharmony_ci * are buffered in the driver -- those must remain buffered to avoid
337462306a36Sopenharmony_ci * reordering. Because it is possible that no frames are released
337562306a36Sopenharmony_ci * in this case, the driver must call ieee80211_sta_eosp()
337662306a36Sopenharmony_ci * to indicate to mac80211 that the service period ended anyway.
337762306a36Sopenharmony_ci *
337862306a36Sopenharmony_ci * Finally, if frames from multiple TIDs are released from mac80211
337962306a36Sopenharmony_ci * but the driver might reorder them, it must clear & set the flags
338062306a36Sopenharmony_ci * appropriately (only the last frame may have %IEEE80211_TX_STATUS_EOSP)
338162306a36Sopenharmony_ci * and also take care of the EOSP and MORE_DATA bits in the frame.
338262306a36Sopenharmony_ci * The driver may also use ieee80211_sta_eosp() in this case.
338362306a36Sopenharmony_ci *
338462306a36Sopenharmony_ci * Note that if the driver ever buffers frames other than QoS-data
338562306a36Sopenharmony_ci * frames, it must take care to never send a non-QoS-data frame as
338662306a36Sopenharmony_ci * the last frame in a service period, adding a QoS-nulldata frame
338762306a36Sopenharmony_ci * after a non-QoS-data frame if needed.
338862306a36Sopenharmony_ci */
338962306a36Sopenharmony_ci
339062306a36Sopenharmony_ci/**
339162306a36Sopenharmony_ci * DOC: HW queue control
339262306a36Sopenharmony_ci *
339362306a36Sopenharmony_ci * Before HW queue control was introduced, mac80211 only had a single static
339462306a36Sopenharmony_ci * assignment of per-interface AC software queues to hardware queues. This
339562306a36Sopenharmony_ci * was problematic for a few reasons:
339662306a36Sopenharmony_ci * 1) off-channel transmissions might get stuck behind other frames
339762306a36Sopenharmony_ci * 2) multiple virtual interfaces couldn't be handled correctly
339862306a36Sopenharmony_ci * 3) after-DTIM frames could get stuck behind other frames
339962306a36Sopenharmony_ci *
340062306a36Sopenharmony_ci * To solve this, hardware typically uses multiple different queues for all
340162306a36Sopenharmony_ci * the different usages, and this needs to be propagated into mac80211 so it
340262306a36Sopenharmony_ci * won't have the same problem with the software queues.
340362306a36Sopenharmony_ci *
340462306a36Sopenharmony_ci * Therefore, mac80211 now offers the %IEEE80211_HW_QUEUE_CONTROL capability
340562306a36Sopenharmony_ci * flag that tells it that the driver implements its own queue control. To do
340662306a36Sopenharmony_ci * so, the driver will set up the various queues in each &struct ieee80211_vif
340762306a36Sopenharmony_ci * and the offchannel queue in &struct ieee80211_hw. In response, mac80211 will
340862306a36Sopenharmony_ci * use those queue IDs in the hw_queue field of &struct ieee80211_tx_info and
340962306a36Sopenharmony_ci * if necessary will queue the frame on the right software queue that mirrors
341062306a36Sopenharmony_ci * the hardware queue.
341162306a36Sopenharmony_ci * Additionally, the driver has to then use these HW queue IDs for the queue
341262306a36Sopenharmony_ci * management functions (ieee80211_stop_queue() et al.)
341362306a36Sopenharmony_ci *
341462306a36Sopenharmony_ci * The driver is free to set up the queue mappings as needed, multiple virtual
341562306a36Sopenharmony_ci * interfaces may map to the same hardware queues if needed. The setup has to
341662306a36Sopenharmony_ci * happen during add_interface or change_interface callbacks. For example, a
341762306a36Sopenharmony_ci * driver supporting station+station and station+AP modes might decide to have
341862306a36Sopenharmony_ci * 10 hardware queues to handle different scenarios:
341962306a36Sopenharmony_ci *
342062306a36Sopenharmony_ci * 4 AC HW queues for 1st vif: 0, 1, 2, 3
342162306a36Sopenharmony_ci * 4 AC HW queues for 2nd vif: 4, 5, 6, 7
342262306a36Sopenharmony_ci * after-DTIM queue for AP:   8
342362306a36Sopenharmony_ci * off-channel queue:         9
342462306a36Sopenharmony_ci *
342562306a36Sopenharmony_ci * It would then set up the hardware like this:
342662306a36Sopenharmony_ci *   hw.offchannel_tx_hw_queue = 9
342762306a36Sopenharmony_ci *
342862306a36Sopenharmony_ci * and the first virtual interface that is added as follows:
342962306a36Sopenharmony_ci *   vif.hw_queue[IEEE80211_AC_VO] = 0
343062306a36Sopenharmony_ci *   vif.hw_queue[IEEE80211_AC_VI] = 1
343162306a36Sopenharmony_ci *   vif.hw_queue[IEEE80211_AC_BE] = 2
343262306a36Sopenharmony_ci *   vif.hw_queue[IEEE80211_AC_BK] = 3
343362306a36Sopenharmony_ci *   vif.cab_queue = 8 // if AP mode, otherwise %IEEE80211_INVAL_HW_QUEUE
343462306a36Sopenharmony_ci * and the second virtual interface with 4-7.
343562306a36Sopenharmony_ci *
343662306a36Sopenharmony_ci * If queue 6 gets full, for example, mac80211 would only stop the second
343762306a36Sopenharmony_ci * virtual interface's BE queue since virtual interface queues are per AC.
343862306a36Sopenharmony_ci *
343962306a36Sopenharmony_ci * Note that the vif.cab_queue value should be set to %IEEE80211_INVAL_HW_QUEUE
344062306a36Sopenharmony_ci * whenever the queue is not used (i.e. the interface is not in AP mode) if the
344162306a36Sopenharmony_ci * queue could potentially be shared since mac80211 will look at cab_queue when
344262306a36Sopenharmony_ci * a queue is stopped/woken even if the interface is not in AP mode.
344362306a36Sopenharmony_ci */
344462306a36Sopenharmony_ci
344562306a36Sopenharmony_ci/**
344662306a36Sopenharmony_ci * enum ieee80211_filter_flags - hardware filter flags
344762306a36Sopenharmony_ci *
344862306a36Sopenharmony_ci * These flags determine what the filter in hardware should be
344962306a36Sopenharmony_ci * programmed to let through and what should not be passed to the
345062306a36Sopenharmony_ci * stack. It is always safe to pass more frames than requested,
345162306a36Sopenharmony_ci * but this has negative impact on power consumption.
345262306a36Sopenharmony_ci *
345362306a36Sopenharmony_ci * @FIF_ALLMULTI: pass all multicast frames, this is used if requested
345462306a36Sopenharmony_ci *	by the user or if the hardware is not capable of filtering by
345562306a36Sopenharmony_ci *	multicast address.
345662306a36Sopenharmony_ci *
345762306a36Sopenharmony_ci * @FIF_FCSFAIL: pass frames with failed FCS (but you need to set the
345862306a36Sopenharmony_ci *	%RX_FLAG_FAILED_FCS_CRC for them)
345962306a36Sopenharmony_ci *
346062306a36Sopenharmony_ci * @FIF_PLCPFAIL: pass frames with failed PLCP CRC (but you need to set
346162306a36Sopenharmony_ci *	the %RX_FLAG_FAILED_PLCP_CRC for them
346262306a36Sopenharmony_ci *
346362306a36Sopenharmony_ci * @FIF_BCN_PRBRESP_PROMISC: This flag is set during scanning to indicate
346462306a36Sopenharmony_ci *	to the hardware that it should not filter beacons or probe responses
346562306a36Sopenharmony_ci *	by BSSID. Filtering them can greatly reduce the amount of processing
346662306a36Sopenharmony_ci *	mac80211 needs to do and the amount of CPU wakeups, so you should
346762306a36Sopenharmony_ci *	honour this flag if possible.
346862306a36Sopenharmony_ci *
346962306a36Sopenharmony_ci * @FIF_CONTROL: pass control frames (except for PS Poll) addressed to this
347062306a36Sopenharmony_ci *	station
347162306a36Sopenharmony_ci *
347262306a36Sopenharmony_ci * @FIF_OTHER_BSS: pass frames destined to other BSSes
347362306a36Sopenharmony_ci *
347462306a36Sopenharmony_ci * @FIF_PSPOLL: pass PS Poll frames
347562306a36Sopenharmony_ci *
347662306a36Sopenharmony_ci * @FIF_PROBE_REQ: pass probe request frames
347762306a36Sopenharmony_ci *
347862306a36Sopenharmony_ci * @FIF_MCAST_ACTION: pass multicast Action frames
347962306a36Sopenharmony_ci */
348062306a36Sopenharmony_cienum ieee80211_filter_flags {
348162306a36Sopenharmony_ci	FIF_ALLMULTI		= 1<<1,
348262306a36Sopenharmony_ci	FIF_FCSFAIL		= 1<<2,
348362306a36Sopenharmony_ci	FIF_PLCPFAIL		= 1<<3,
348462306a36Sopenharmony_ci	FIF_BCN_PRBRESP_PROMISC	= 1<<4,
348562306a36Sopenharmony_ci	FIF_CONTROL		= 1<<5,
348662306a36Sopenharmony_ci	FIF_OTHER_BSS		= 1<<6,
348762306a36Sopenharmony_ci	FIF_PSPOLL		= 1<<7,
348862306a36Sopenharmony_ci	FIF_PROBE_REQ		= 1<<8,
348962306a36Sopenharmony_ci	FIF_MCAST_ACTION	= 1<<9,
349062306a36Sopenharmony_ci};
349162306a36Sopenharmony_ci
349262306a36Sopenharmony_ci/**
349362306a36Sopenharmony_ci * enum ieee80211_ampdu_mlme_action - A-MPDU actions
349462306a36Sopenharmony_ci *
349562306a36Sopenharmony_ci * These flags are used with the ampdu_action() callback in
349662306a36Sopenharmony_ci * &struct ieee80211_ops to indicate which action is needed.
349762306a36Sopenharmony_ci *
349862306a36Sopenharmony_ci * Note that drivers MUST be able to deal with a TX aggregation
349962306a36Sopenharmony_ci * session being stopped even before they OK'ed starting it by
350062306a36Sopenharmony_ci * calling ieee80211_start_tx_ba_cb_irqsafe, because the peer
350162306a36Sopenharmony_ci * might receive the addBA frame and send a delBA right away!
350262306a36Sopenharmony_ci *
350362306a36Sopenharmony_ci * @IEEE80211_AMPDU_RX_START: start RX aggregation
350462306a36Sopenharmony_ci * @IEEE80211_AMPDU_RX_STOP: stop RX aggregation
350562306a36Sopenharmony_ci * @IEEE80211_AMPDU_TX_START: start TX aggregation, the driver must either
350662306a36Sopenharmony_ci *	call ieee80211_start_tx_ba_cb_irqsafe() or
350762306a36Sopenharmony_ci *	call ieee80211_start_tx_ba_cb_irqsafe() with status
350862306a36Sopenharmony_ci *	%IEEE80211_AMPDU_TX_START_DELAY_ADDBA to delay addba after
350962306a36Sopenharmony_ci *	ieee80211_start_tx_ba_cb_irqsafe is called, or just return the special
351062306a36Sopenharmony_ci *	status %IEEE80211_AMPDU_TX_START_IMMEDIATE.
351162306a36Sopenharmony_ci * @IEEE80211_AMPDU_TX_OPERATIONAL: TX aggregation has become operational
351262306a36Sopenharmony_ci * @IEEE80211_AMPDU_TX_STOP_CONT: stop TX aggregation but continue transmitting
351362306a36Sopenharmony_ci *	queued packets, now unaggregated. After all packets are transmitted the
351462306a36Sopenharmony_ci *	driver has to call ieee80211_stop_tx_ba_cb_irqsafe().
351562306a36Sopenharmony_ci * @IEEE80211_AMPDU_TX_STOP_FLUSH: stop TX aggregation and flush all packets,
351662306a36Sopenharmony_ci *	called when the station is removed. There's no need or reason to call
351762306a36Sopenharmony_ci *	ieee80211_stop_tx_ba_cb_irqsafe() in this case as mac80211 assumes the
351862306a36Sopenharmony_ci *	session is gone and removes the station.
351962306a36Sopenharmony_ci * @IEEE80211_AMPDU_TX_STOP_FLUSH_CONT: called when TX aggregation is stopped
352062306a36Sopenharmony_ci *	but the driver hasn't called ieee80211_stop_tx_ba_cb_irqsafe() yet and
352162306a36Sopenharmony_ci *	now the connection is dropped and the station will be removed. Drivers
352262306a36Sopenharmony_ci *	should clean up and drop remaining packets when this is called.
352362306a36Sopenharmony_ci */
352462306a36Sopenharmony_cienum ieee80211_ampdu_mlme_action {
352562306a36Sopenharmony_ci	IEEE80211_AMPDU_RX_START,
352662306a36Sopenharmony_ci	IEEE80211_AMPDU_RX_STOP,
352762306a36Sopenharmony_ci	IEEE80211_AMPDU_TX_START,
352862306a36Sopenharmony_ci	IEEE80211_AMPDU_TX_STOP_CONT,
352962306a36Sopenharmony_ci	IEEE80211_AMPDU_TX_STOP_FLUSH,
353062306a36Sopenharmony_ci	IEEE80211_AMPDU_TX_STOP_FLUSH_CONT,
353162306a36Sopenharmony_ci	IEEE80211_AMPDU_TX_OPERATIONAL,
353262306a36Sopenharmony_ci};
353362306a36Sopenharmony_ci
353462306a36Sopenharmony_ci#define IEEE80211_AMPDU_TX_START_IMMEDIATE 1
353562306a36Sopenharmony_ci#define IEEE80211_AMPDU_TX_START_DELAY_ADDBA 2
353662306a36Sopenharmony_ci
353762306a36Sopenharmony_ci/**
353862306a36Sopenharmony_ci * struct ieee80211_ampdu_params - AMPDU action parameters
353962306a36Sopenharmony_ci *
354062306a36Sopenharmony_ci * @action: the ampdu action, value from %ieee80211_ampdu_mlme_action.
354162306a36Sopenharmony_ci * @sta: peer of this AMPDU session
354262306a36Sopenharmony_ci * @tid: tid of the BA session
354362306a36Sopenharmony_ci * @ssn: start sequence number of the session. TX/RX_STOP can pass 0. When
354462306a36Sopenharmony_ci *	action is set to %IEEE80211_AMPDU_RX_START the driver passes back the
354562306a36Sopenharmony_ci *	actual ssn value used to start the session and writes the value here.
354662306a36Sopenharmony_ci * @buf_size: reorder buffer size  (number of subframes). Valid only when the
354762306a36Sopenharmony_ci *	action is set to %IEEE80211_AMPDU_RX_START or
354862306a36Sopenharmony_ci *	%IEEE80211_AMPDU_TX_OPERATIONAL
354962306a36Sopenharmony_ci * @amsdu: indicates the peer's ability to receive A-MSDU within A-MPDU.
355062306a36Sopenharmony_ci *	valid when the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL
355162306a36Sopenharmony_ci * @timeout: BA session timeout. Valid only when the action is set to
355262306a36Sopenharmony_ci *	%IEEE80211_AMPDU_RX_START
355362306a36Sopenharmony_ci */
355462306a36Sopenharmony_cistruct ieee80211_ampdu_params {
355562306a36Sopenharmony_ci	enum ieee80211_ampdu_mlme_action action;
355662306a36Sopenharmony_ci	struct ieee80211_sta *sta;
355762306a36Sopenharmony_ci	u16 tid;
355862306a36Sopenharmony_ci	u16 ssn;
355962306a36Sopenharmony_ci	u16 buf_size;
356062306a36Sopenharmony_ci	bool amsdu;
356162306a36Sopenharmony_ci	u16 timeout;
356262306a36Sopenharmony_ci};
356362306a36Sopenharmony_ci
356462306a36Sopenharmony_ci/**
356562306a36Sopenharmony_ci * enum ieee80211_frame_release_type - frame release reason
356662306a36Sopenharmony_ci * @IEEE80211_FRAME_RELEASE_PSPOLL: frame released for PS-Poll
356762306a36Sopenharmony_ci * @IEEE80211_FRAME_RELEASE_UAPSD: frame(s) released due to
356862306a36Sopenharmony_ci *	frame received on trigger-enabled AC
356962306a36Sopenharmony_ci */
357062306a36Sopenharmony_cienum ieee80211_frame_release_type {
357162306a36Sopenharmony_ci	IEEE80211_FRAME_RELEASE_PSPOLL,
357262306a36Sopenharmony_ci	IEEE80211_FRAME_RELEASE_UAPSD,
357362306a36Sopenharmony_ci};
357462306a36Sopenharmony_ci
357562306a36Sopenharmony_ci/**
357662306a36Sopenharmony_ci * enum ieee80211_rate_control_changed - flags to indicate what changed
357762306a36Sopenharmony_ci *
357862306a36Sopenharmony_ci * @IEEE80211_RC_BW_CHANGED: The bandwidth that can be used to transmit
357962306a36Sopenharmony_ci *	to this station changed. The actual bandwidth is in the station
358062306a36Sopenharmony_ci *	information -- for HT20/40 the IEEE80211_HT_CAP_SUP_WIDTH_20_40
358162306a36Sopenharmony_ci *	flag changes, for HT and VHT the bandwidth field changes.
358262306a36Sopenharmony_ci * @IEEE80211_RC_SMPS_CHANGED: The SMPS state of the station changed.
358362306a36Sopenharmony_ci * @IEEE80211_RC_SUPP_RATES_CHANGED: The supported rate set of this peer
358462306a36Sopenharmony_ci *	changed (in IBSS mode) due to discovering more information about
358562306a36Sopenharmony_ci *	the peer.
358662306a36Sopenharmony_ci * @IEEE80211_RC_NSS_CHANGED: N_SS (number of spatial streams) was changed
358762306a36Sopenharmony_ci *	by the peer
358862306a36Sopenharmony_ci */
358962306a36Sopenharmony_cienum ieee80211_rate_control_changed {
359062306a36Sopenharmony_ci	IEEE80211_RC_BW_CHANGED		= BIT(0),
359162306a36Sopenharmony_ci	IEEE80211_RC_SMPS_CHANGED	= BIT(1),
359262306a36Sopenharmony_ci	IEEE80211_RC_SUPP_RATES_CHANGED	= BIT(2),
359362306a36Sopenharmony_ci	IEEE80211_RC_NSS_CHANGED	= BIT(3),
359462306a36Sopenharmony_ci};
359562306a36Sopenharmony_ci
359662306a36Sopenharmony_ci/**
359762306a36Sopenharmony_ci * enum ieee80211_roc_type - remain on channel type
359862306a36Sopenharmony_ci *
359962306a36Sopenharmony_ci * With the support for multi channel contexts and multi channel operations,
360062306a36Sopenharmony_ci * remain on channel operations might be limited/deferred/aborted by other
360162306a36Sopenharmony_ci * flows/operations which have higher priority (and vice versa).
360262306a36Sopenharmony_ci * Specifying the ROC type can be used by devices to prioritize the ROC
360362306a36Sopenharmony_ci * operations compared to other operations/flows.
360462306a36Sopenharmony_ci *
360562306a36Sopenharmony_ci * @IEEE80211_ROC_TYPE_NORMAL: There are no special requirements for this ROC.
360662306a36Sopenharmony_ci * @IEEE80211_ROC_TYPE_MGMT_TX: The remain on channel request is required
360762306a36Sopenharmony_ci *	for sending management frames offchannel.
360862306a36Sopenharmony_ci */
360962306a36Sopenharmony_cienum ieee80211_roc_type {
361062306a36Sopenharmony_ci	IEEE80211_ROC_TYPE_NORMAL = 0,
361162306a36Sopenharmony_ci	IEEE80211_ROC_TYPE_MGMT_TX,
361262306a36Sopenharmony_ci};
361362306a36Sopenharmony_ci
361462306a36Sopenharmony_ci/**
361562306a36Sopenharmony_ci * enum ieee80211_reconfig_type - reconfig type
361662306a36Sopenharmony_ci *
361762306a36Sopenharmony_ci * This enum is used by the reconfig_complete() callback to indicate what
361862306a36Sopenharmony_ci * reconfiguration type was completed.
361962306a36Sopenharmony_ci *
362062306a36Sopenharmony_ci * @IEEE80211_RECONFIG_TYPE_RESTART: hw restart type
362162306a36Sopenharmony_ci *	(also due to resume() callback returning 1)
362262306a36Sopenharmony_ci * @IEEE80211_RECONFIG_TYPE_SUSPEND: suspend type (regardless
362362306a36Sopenharmony_ci *	of wowlan configuration)
362462306a36Sopenharmony_ci */
362562306a36Sopenharmony_cienum ieee80211_reconfig_type {
362662306a36Sopenharmony_ci	IEEE80211_RECONFIG_TYPE_RESTART,
362762306a36Sopenharmony_ci	IEEE80211_RECONFIG_TYPE_SUSPEND,
362862306a36Sopenharmony_ci};
362962306a36Sopenharmony_ci
363062306a36Sopenharmony_ci/**
363162306a36Sopenharmony_ci * struct ieee80211_prep_tx_info - prepare TX information
363262306a36Sopenharmony_ci * @duration: if non-zero, hint about the required duration,
363362306a36Sopenharmony_ci *	only used with the mgd_prepare_tx() method.
363462306a36Sopenharmony_ci * @subtype: frame subtype (auth, (re)assoc, deauth, disassoc)
363562306a36Sopenharmony_ci * @success: whether the frame exchange was successful, only
363662306a36Sopenharmony_ci *	used with the mgd_complete_tx() method, and then only
363762306a36Sopenharmony_ci *	valid for auth and (re)assoc.
363862306a36Sopenharmony_ci */
363962306a36Sopenharmony_cistruct ieee80211_prep_tx_info {
364062306a36Sopenharmony_ci	u16 duration;
364162306a36Sopenharmony_ci	u16 subtype;
364262306a36Sopenharmony_ci	u8 success:1;
364362306a36Sopenharmony_ci};
364462306a36Sopenharmony_ci
364562306a36Sopenharmony_ci/**
364662306a36Sopenharmony_ci * struct ieee80211_ops - callbacks from mac80211 to the driver
364762306a36Sopenharmony_ci *
364862306a36Sopenharmony_ci * This structure contains various callbacks that the driver may
364962306a36Sopenharmony_ci * handle or, in some cases, must handle, for example to configure
365062306a36Sopenharmony_ci * the hardware to a new channel or to transmit a frame.
365162306a36Sopenharmony_ci *
365262306a36Sopenharmony_ci * @tx: Handler that 802.11 module calls for each transmitted frame.
365362306a36Sopenharmony_ci *	skb contains the buffer starting from the IEEE 802.11 header.
365462306a36Sopenharmony_ci *	The low-level driver should send the frame out based on
365562306a36Sopenharmony_ci *	configuration in the TX control data. This handler should,
365662306a36Sopenharmony_ci *	preferably, never fail and stop queues appropriately.
365762306a36Sopenharmony_ci *	Must be atomic.
365862306a36Sopenharmony_ci *
365962306a36Sopenharmony_ci * @start: Called before the first netdevice attached to the hardware
366062306a36Sopenharmony_ci *	is enabled. This should turn on the hardware and must turn on
366162306a36Sopenharmony_ci *	frame reception (for possibly enabled monitor interfaces.)
366262306a36Sopenharmony_ci *	Returns negative error codes, these may be seen in userspace,
366362306a36Sopenharmony_ci *	or zero.
366462306a36Sopenharmony_ci *	When the device is started it should not have a MAC address
366562306a36Sopenharmony_ci *	to avoid acknowledging frames before a non-monitor device
366662306a36Sopenharmony_ci *	is added.
366762306a36Sopenharmony_ci *	Must be implemented and can sleep.
366862306a36Sopenharmony_ci *
366962306a36Sopenharmony_ci * @stop: Called after last netdevice attached to the hardware
367062306a36Sopenharmony_ci *	is disabled. This should turn off the hardware (at least
367162306a36Sopenharmony_ci *	it must turn off frame reception.)
367262306a36Sopenharmony_ci *	May be called right after add_interface if that rejects
367362306a36Sopenharmony_ci *	an interface. If you added any work onto the mac80211 workqueue
367462306a36Sopenharmony_ci *	you should ensure to cancel it on this callback.
367562306a36Sopenharmony_ci *	Must be implemented and can sleep.
367662306a36Sopenharmony_ci *
367762306a36Sopenharmony_ci * @suspend: Suspend the device; mac80211 itself will quiesce before and
367862306a36Sopenharmony_ci *	stop transmitting and doing any other configuration, and then
367962306a36Sopenharmony_ci *	ask the device to suspend. This is only invoked when WoWLAN is
368062306a36Sopenharmony_ci *	configured, otherwise the device is deconfigured completely and
368162306a36Sopenharmony_ci *	reconfigured at resume time.
368262306a36Sopenharmony_ci *	The driver may also impose special conditions under which it
368362306a36Sopenharmony_ci *	wants to use the "normal" suspend (deconfigure), say if it only
368462306a36Sopenharmony_ci *	supports WoWLAN when the device is associated. In this case, it
368562306a36Sopenharmony_ci *	must return 1 from this function.
368662306a36Sopenharmony_ci *
368762306a36Sopenharmony_ci * @resume: If WoWLAN was configured, this indicates that mac80211 is
368862306a36Sopenharmony_ci *	now resuming its operation, after this the device must be fully
368962306a36Sopenharmony_ci *	functional again. If this returns an error, the only way out is
369062306a36Sopenharmony_ci *	to also unregister the device. If it returns 1, then mac80211
369162306a36Sopenharmony_ci *	will also go through the regular complete restart on resume.
369262306a36Sopenharmony_ci *
369362306a36Sopenharmony_ci * @set_wakeup: Enable or disable wakeup when WoWLAN configuration is
369462306a36Sopenharmony_ci *	modified. The reason is that device_set_wakeup_enable() is
369562306a36Sopenharmony_ci *	supposed to be called when the configuration changes, not only
369662306a36Sopenharmony_ci *	in suspend().
369762306a36Sopenharmony_ci *
369862306a36Sopenharmony_ci * @add_interface: Called when a netdevice attached to the hardware is
369962306a36Sopenharmony_ci *	enabled. Because it is not called for monitor mode devices, @start
370062306a36Sopenharmony_ci *	and @stop must be implemented.
370162306a36Sopenharmony_ci *	The driver should perform any initialization it needs before
370262306a36Sopenharmony_ci *	the device can be enabled. The initial configuration for the
370362306a36Sopenharmony_ci *	interface is given in the conf parameter.
370462306a36Sopenharmony_ci *	The callback may refuse to add an interface by returning a
370562306a36Sopenharmony_ci *	negative error code (which will be seen in userspace.)
370662306a36Sopenharmony_ci *	Must be implemented and can sleep.
370762306a36Sopenharmony_ci *
370862306a36Sopenharmony_ci * @change_interface: Called when a netdevice changes type. This callback
370962306a36Sopenharmony_ci *	is optional, but only if it is supported can interface types be
371062306a36Sopenharmony_ci *	switched while the interface is UP. The callback may sleep.
371162306a36Sopenharmony_ci *	Note that while an interface is being switched, it will not be
371262306a36Sopenharmony_ci *	found by the interface iteration callbacks.
371362306a36Sopenharmony_ci *
371462306a36Sopenharmony_ci * @remove_interface: Notifies a driver that an interface is going down.
371562306a36Sopenharmony_ci *	The @stop callback is called after this if it is the last interface
371662306a36Sopenharmony_ci *	and no monitor interfaces are present.
371762306a36Sopenharmony_ci *	When all interfaces are removed, the MAC address in the hardware
371862306a36Sopenharmony_ci *	must be cleared so the device no longer acknowledges packets,
371962306a36Sopenharmony_ci *	the mac_addr member of the conf structure is, however, set to the
372062306a36Sopenharmony_ci *	MAC address of the device going away.
372162306a36Sopenharmony_ci *	Hence, this callback must be implemented. It can sleep.
372262306a36Sopenharmony_ci *
372362306a36Sopenharmony_ci * @config: Handler for configuration requests. IEEE 802.11 code calls this
372462306a36Sopenharmony_ci *	function to change hardware configuration, e.g., channel.
372562306a36Sopenharmony_ci *	This function should never fail but returns a negative error code
372662306a36Sopenharmony_ci *	if it does. The callback can sleep.
372762306a36Sopenharmony_ci *
372862306a36Sopenharmony_ci * @bss_info_changed: Handler for configuration requests related to BSS
372962306a36Sopenharmony_ci *	parameters that may vary during BSS's lifespan, and may affect low
373062306a36Sopenharmony_ci *	level driver (e.g. assoc/disassoc status, erp parameters).
373162306a36Sopenharmony_ci *	This function should not be used if no BSS has been set, unless
373262306a36Sopenharmony_ci *	for association indication. The @changed parameter indicates which
373362306a36Sopenharmony_ci *	of the bss parameters has changed when a call is made. The callback
373462306a36Sopenharmony_ci *	can sleep.
373562306a36Sopenharmony_ci *	Note: this callback is called if @vif_cfg_changed or @link_info_changed
373662306a36Sopenharmony_ci *	are not implemented.
373762306a36Sopenharmony_ci *
373862306a36Sopenharmony_ci * @vif_cfg_changed: Handler for configuration requests related to interface
373962306a36Sopenharmony_ci *	(MLD) parameters from &struct ieee80211_vif_cfg that vary during the
374062306a36Sopenharmony_ci *	lifetime of the interface (e.g. assoc status, IP addresses, etc.)
374162306a36Sopenharmony_ci *	The @changed parameter indicates which value changed.
374262306a36Sopenharmony_ci *	The callback can sleep.
374362306a36Sopenharmony_ci *
374462306a36Sopenharmony_ci * @link_info_changed: Handler for configuration requests related to link
374562306a36Sopenharmony_ci *	parameters from &struct ieee80211_bss_conf that are related to an
374662306a36Sopenharmony_ci *	individual link. e.g. legacy/HT/VHT/... rate information.
374762306a36Sopenharmony_ci *	The @changed parameter indicates which value changed, and the @link_id
374862306a36Sopenharmony_ci *	parameter indicates the link ID. Note that the @link_id will be 0 for
374962306a36Sopenharmony_ci *	non-MLO connections.
375062306a36Sopenharmony_ci *	The callback can sleep.
375162306a36Sopenharmony_ci *
375262306a36Sopenharmony_ci * @prepare_multicast: Prepare for multicast filter configuration.
375362306a36Sopenharmony_ci *	This callback is optional, and its return value is passed
375462306a36Sopenharmony_ci *	to configure_filter(). This callback must be atomic.
375562306a36Sopenharmony_ci *
375662306a36Sopenharmony_ci * @configure_filter: Configure the device's RX filter.
375762306a36Sopenharmony_ci *	See the section "Frame filtering" for more information.
375862306a36Sopenharmony_ci *	This callback must be implemented and can sleep.
375962306a36Sopenharmony_ci *
376062306a36Sopenharmony_ci * @config_iface_filter: Configure the interface's RX filter.
376162306a36Sopenharmony_ci *	This callback is optional and is used to configure which frames
376262306a36Sopenharmony_ci *	should be passed to mac80211. The filter_flags is the combination
376362306a36Sopenharmony_ci *	of FIF_* flags. The changed_flags is a bit mask that indicates
376462306a36Sopenharmony_ci *	which flags are changed.
376562306a36Sopenharmony_ci *	This callback can sleep.
376662306a36Sopenharmony_ci *
376762306a36Sopenharmony_ci * @set_tim: Set TIM bit. mac80211 calls this function when a TIM bit
376862306a36Sopenharmony_ci * 	must be set or cleared for a given STA. Must be atomic.
376962306a36Sopenharmony_ci *
377062306a36Sopenharmony_ci * @set_key: See the section "Hardware crypto acceleration"
377162306a36Sopenharmony_ci *	This callback is only called between add_interface and
377262306a36Sopenharmony_ci *	remove_interface calls, i.e. while the given virtual interface
377362306a36Sopenharmony_ci *	is enabled.
377462306a36Sopenharmony_ci *	Returns a negative error code if the key can't be added.
377562306a36Sopenharmony_ci *	The callback can sleep.
377662306a36Sopenharmony_ci *
377762306a36Sopenharmony_ci * @update_tkip_key: See the section "Hardware crypto acceleration"
377862306a36Sopenharmony_ci * 	This callback will be called in the context of Rx. Called for drivers
377962306a36Sopenharmony_ci * 	which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
378062306a36Sopenharmony_ci *	The callback must be atomic.
378162306a36Sopenharmony_ci *
378262306a36Sopenharmony_ci * @set_rekey_data: If the device supports GTK rekeying, for example while the
378362306a36Sopenharmony_ci *	host is suspended, it can assign this callback to retrieve the data
378462306a36Sopenharmony_ci *	necessary to do GTK rekeying, this is the KEK, KCK and replay counter.
378562306a36Sopenharmony_ci *	After rekeying was done it should (for example during resume) notify
378662306a36Sopenharmony_ci *	userspace of the new replay counter using ieee80211_gtk_rekey_notify().
378762306a36Sopenharmony_ci *
378862306a36Sopenharmony_ci * @set_default_unicast_key: Set the default (unicast) key index, useful for
378962306a36Sopenharmony_ci *	WEP when the device sends data packets autonomously, e.g. for ARP
379062306a36Sopenharmony_ci *	offloading. The index can be 0-3, or -1 for unsetting it.
379162306a36Sopenharmony_ci *
379262306a36Sopenharmony_ci * @hw_scan: Ask the hardware to service the scan request, no need to start
379362306a36Sopenharmony_ci *	the scan state machine in stack. The scan must honour the channel
379462306a36Sopenharmony_ci *	configuration done by the regulatory agent in the wiphy's
379562306a36Sopenharmony_ci *	registered bands. The hardware (or the driver) needs to make sure
379662306a36Sopenharmony_ci *	that power save is disabled.
379762306a36Sopenharmony_ci *	The @req ie/ie_len members are rewritten by mac80211 to contain the
379862306a36Sopenharmony_ci *	entire IEs after the SSID, so that drivers need not look at these
379962306a36Sopenharmony_ci *	at all but just send them after the SSID -- mac80211 includes the
380062306a36Sopenharmony_ci *	(extended) supported rates and HT information (where applicable).
380162306a36Sopenharmony_ci *	When the scan finishes, ieee80211_scan_completed() must be called;
380262306a36Sopenharmony_ci *	note that it also must be called when the scan cannot finish due to
380362306a36Sopenharmony_ci *	any error unless this callback returned a negative error code.
380462306a36Sopenharmony_ci *	This callback is also allowed to return the special return value 1,
380562306a36Sopenharmony_ci *	this indicates that hardware scan isn't desirable right now and a
380662306a36Sopenharmony_ci *	software scan should be done instead. A driver wishing to use this
380762306a36Sopenharmony_ci *	capability must ensure its (hardware) scan capabilities aren't
380862306a36Sopenharmony_ci *	advertised as more capable than mac80211's software scan is.
380962306a36Sopenharmony_ci *	The callback can sleep.
381062306a36Sopenharmony_ci *
381162306a36Sopenharmony_ci * @cancel_hw_scan: Ask the low-level tp cancel the active hw scan.
381262306a36Sopenharmony_ci *	The driver should ask the hardware to cancel the scan (if possible),
381362306a36Sopenharmony_ci *	but the scan will be completed only after the driver will call
381462306a36Sopenharmony_ci *	ieee80211_scan_completed().
381562306a36Sopenharmony_ci *	This callback is needed for wowlan, to prevent enqueueing a new
381662306a36Sopenharmony_ci *	scan_work after the low-level driver was already suspended.
381762306a36Sopenharmony_ci *	The callback can sleep.
381862306a36Sopenharmony_ci *
381962306a36Sopenharmony_ci * @sched_scan_start: Ask the hardware to start scanning repeatedly at
382062306a36Sopenharmony_ci *	specific intervals.  The driver must call the
382162306a36Sopenharmony_ci *	ieee80211_sched_scan_results() function whenever it finds results.
382262306a36Sopenharmony_ci *	This process will continue until sched_scan_stop is called.
382362306a36Sopenharmony_ci *
382462306a36Sopenharmony_ci * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan.
382562306a36Sopenharmony_ci *	In this case, ieee80211_sched_scan_stopped() must not be called.
382662306a36Sopenharmony_ci *
382762306a36Sopenharmony_ci * @sw_scan_start: Notifier function that is called just before a software scan
382862306a36Sopenharmony_ci *	is started. Can be NULL, if the driver doesn't need this notification.
382962306a36Sopenharmony_ci *	The mac_addr parameter allows supporting NL80211_SCAN_FLAG_RANDOM_ADDR,
383062306a36Sopenharmony_ci *	the driver may set the NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR flag if it
383162306a36Sopenharmony_ci *	can use this parameter. The callback can sleep.
383262306a36Sopenharmony_ci *
383362306a36Sopenharmony_ci * @sw_scan_complete: Notifier function that is called just after a
383462306a36Sopenharmony_ci *	software scan finished. Can be NULL, if the driver doesn't need
383562306a36Sopenharmony_ci *	this notification.
383662306a36Sopenharmony_ci *	The callback can sleep.
383762306a36Sopenharmony_ci *
383862306a36Sopenharmony_ci * @get_stats: Return low-level statistics.
383962306a36Sopenharmony_ci * 	Returns zero if statistics are available.
384062306a36Sopenharmony_ci *	The callback can sleep.
384162306a36Sopenharmony_ci *
384262306a36Sopenharmony_ci * @get_key_seq: If your device implements encryption in hardware and does
384362306a36Sopenharmony_ci *	IV/PN assignment then this callback should be provided to read the
384462306a36Sopenharmony_ci *	IV/PN for the given key from hardware.
384562306a36Sopenharmony_ci *	The callback must be atomic.
384662306a36Sopenharmony_ci *
384762306a36Sopenharmony_ci * @set_frag_threshold: Configuration of fragmentation threshold. Assign this
384862306a36Sopenharmony_ci *	if the device does fragmentation by itself. Note that to prevent the
384962306a36Sopenharmony_ci *	stack from doing fragmentation IEEE80211_HW_SUPPORTS_TX_FRAG
385062306a36Sopenharmony_ci *	should be set as well.
385162306a36Sopenharmony_ci *	The callback can sleep.
385262306a36Sopenharmony_ci *
385362306a36Sopenharmony_ci * @set_rts_threshold: Configuration of RTS threshold (if device needs it)
385462306a36Sopenharmony_ci *	The callback can sleep.
385562306a36Sopenharmony_ci *
385662306a36Sopenharmony_ci * @sta_add: Notifies low level driver about addition of an associated station,
385762306a36Sopenharmony_ci *	AP, IBSS/WDS/mesh peer etc. This callback can sleep.
385862306a36Sopenharmony_ci *
385962306a36Sopenharmony_ci * @sta_remove: Notifies low level driver about removal of an associated
386062306a36Sopenharmony_ci *	station, AP, IBSS/WDS/mesh peer etc. Note that after the callback
386162306a36Sopenharmony_ci *	returns it isn't safe to use the pointer, not even RCU protected;
386262306a36Sopenharmony_ci *	no RCU grace period is guaranteed between returning here and freeing
386362306a36Sopenharmony_ci *	the station. See @sta_pre_rcu_remove if needed.
386462306a36Sopenharmony_ci *	This callback can sleep.
386562306a36Sopenharmony_ci *
386662306a36Sopenharmony_ci * @link_add_debugfs: Drivers can use this callback to add debugfs files
386762306a36Sopenharmony_ci *	when a link is added to a mac80211 vif. This callback should be within
386862306a36Sopenharmony_ci *	a CONFIG_MAC80211_DEBUGFS conditional. This callback can sleep.
386962306a36Sopenharmony_ci *	For non-MLO the callback will be called once for the default bss_conf
387062306a36Sopenharmony_ci *	with the vif's directory rather than a separate subdirectory.
387162306a36Sopenharmony_ci *
387262306a36Sopenharmony_ci * @sta_add_debugfs: Drivers can use this callback to add debugfs files
387362306a36Sopenharmony_ci *	when a station is added to mac80211's station list. This callback
387462306a36Sopenharmony_ci *	should be within a CONFIG_MAC80211_DEBUGFS conditional. This
387562306a36Sopenharmony_ci *	callback can sleep.
387662306a36Sopenharmony_ci *
387762306a36Sopenharmony_ci * @link_sta_add_debugfs: Drivers can use this callback to add debugfs files
387862306a36Sopenharmony_ci *	when a link is added to a mac80211 station. This callback
387962306a36Sopenharmony_ci *	should be within a CONFIG_MAC80211_DEBUGFS conditional. This
388062306a36Sopenharmony_ci *	callback can sleep.
388162306a36Sopenharmony_ci *	For non-MLO the callback will be called once for the deflink with the
388262306a36Sopenharmony_ci *	station's directory rather than a separate subdirectory.
388362306a36Sopenharmony_ci *
388462306a36Sopenharmony_ci * @sta_notify: Notifies low level driver about power state transition of an
388562306a36Sopenharmony_ci *	associated station, AP,  IBSS/WDS/mesh peer etc. For a VIF operating
388662306a36Sopenharmony_ci *	in AP mode, this callback will not be called when the flag
388762306a36Sopenharmony_ci *	%IEEE80211_HW_AP_LINK_PS is set. Must be atomic.
388862306a36Sopenharmony_ci *
388962306a36Sopenharmony_ci * @sta_set_txpwr: Configure the station tx power. This callback set the tx
389062306a36Sopenharmony_ci *	power for the station.
389162306a36Sopenharmony_ci *	This callback can sleep.
389262306a36Sopenharmony_ci *
389362306a36Sopenharmony_ci * @sta_state: Notifies low level driver about state transition of a
389462306a36Sopenharmony_ci *	station (which can be the AP, a client, IBSS/WDS/mesh peer etc.)
389562306a36Sopenharmony_ci *	This callback is mutually exclusive with @sta_add/@sta_remove.
389662306a36Sopenharmony_ci *	It must not fail for down transitions but may fail for transitions
389762306a36Sopenharmony_ci *	up the list of states. Also note that after the callback returns it
389862306a36Sopenharmony_ci *	isn't safe to use the pointer, not even RCU protected - no RCU grace
389962306a36Sopenharmony_ci *	period is guaranteed between returning here and freeing the station.
390062306a36Sopenharmony_ci *	See @sta_pre_rcu_remove if needed.
390162306a36Sopenharmony_ci *	The callback can sleep.
390262306a36Sopenharmony_ci *
390362306a36Sopenharmony_ci * @sta_pre_rcu_remove: Notify driver about station removal before RCU
390462306a36Sopenharmony_ci *	synchronisation. This is useful if a driver needs to have station
390562306a36Sopenharmony_ci *	pointers protected using RCU, it can then use this call to clear
390662306a36Sopenharmony_ci *	the pointers instead of waiting for an RCU grace period to elapse
390762306a36Sopenharmony_ci *	in @sta_state.
390862306a36Sopenharmony_ci *	The callback can sleep.
390962306a36Sopenharmony_ci *
391062306a36Sopenharmony_ci * @sta_rc_update: Notifies the driver of changes to the bitrates that can be
391162306a36Sopenharmony_ci *	used to transmit to the station. The changes are advertised with bits
391262306a36Sopenharmony_ci *	from &enum ieee80211_rate_control_changed and the values are reflected
391362306a36Sopenharmony_ci *	in the station data. This callback should only be used when the driver
391462306a36Sopenharmony_ci *	uses hardware rate control (%IEEE80211_HW_HAS_RATE_CONTROL) since
391562306a36Sopenharmony_ci *	otherwise the rate control algorithm is notified directly.
391662306a36Sopenharmony_ci *	Must be atomic.
391762306a36Sopenharmony_ci * @sta_rate_tbl_update: Notifies the driver that the rate table changed. This
391862306a36Sopenharmony_ci *	is only used if the configured rate control algorithm actually uses
391962306a36Sopenharmony_ci *	the new rate table API, and is therefore optional. Must be atomic.
392062306a36Sopenharmony_ci *
392162306a36Sopenharmony_ci * @sta_statistics: Get statistics for this station. For example with beacon
392262306a36Sopenharmony_ci *	filtering, the statistics kept by mac80211 might not be accurate, so
392362306a36Sopenharmony_ci *	let the driver pre-fill the statistics. The driver can fill most of
392462306a36Sopenharmony_ci *	the values (indicating which by setting the filled bitmap), but not
392562306a36Sopenharmony_ci *	all of them make sense - see the source for which ones are possible.
392662306a36Sopenharmony_ci *	Statistics that the driver doesn't fill will be filled by mac80211.
392762306a36Sopenharmony_ci *	The callback can sleep.
392862306a36Sopenharmony_ci *
392962306a36Sopenharmony_ci * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
393062306a36Sopenharmony_ci *	bursting) for a hardware TX queue.
393162306a36Sopenharmony_ci *	Returns a negative error code on failure.
393262306a36Sopenharmony_ci *	The callback can sleep.
393362306a36Sopenharmony_ci *
393462306a36Sopenharmony_ci * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
393562306a36Sopenharmony_ci *	this is only used for IBSS mode BSSID merging and debugging. Is not a
393662306a36Sopenharmony_ci *	required function.
393762306a36Sopenharmony_ci *	The callback can sleep.
393862306a36Sopenharmony_ci *
393962306a36Sopenharmony_ci * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
394062306a36Sopenharmony_ci *	Currently, this is only used for IBSS mode debugging. Is not a
394162306a36Sopenharmony_ci *	required function.
394262306a36Sopenharmony_ci *	The callback can sleep.
394362306a36Sopenharmony_ci *
394462306a36Sopenharmony_ci * @offset_tsf: Offset the TSF timer by the specified value in the
394562306a36Sopenharmony_ci *	firmware/hardware.  Preferred to set_tsf as it avoids delay between
394662306a36Sopenharmony_ci *	calling set_tsf() and hardware getting programmed, which will show up
394762306a36Sopenharmony_ci *	as TSF delay. Is not a required function.
394862306a36Sopenharmony_ci *	The callback can sleep.
394962306a36Sopenharmony_ci *
395062306a36Sopenharmony_ci * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
395162306a36Sopenharmony_ci *	with other STAs in the IBSS. This is only used in IBSS mode. This
395262306a36Sopenharmony_ci *	function is optional if the firmware/hardware takes full care of
395362306a36Sopenharmony_ci *	TSF synchronization.
395462306a36Sopenharmony_ci *	The callback can sleep.
395562306a36Sopenharmony_ci *
395662306a36Sopenharmony_ci * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
395762306a36Sopenharmony_ci *	This is needed only for IBSS mode and the result of this function is
395862306a36Sopenharmony_ci *	used to determine whether to reply to Probe Requests.
395962306a36Sopenharmony_ci *	Returns non-zero if this device sent the last beacon.
396062306a36Sopenharmony_ci *	The callback can sleep.
396162306a36Sopenharmony_ci *
396262306a36Sopenharmony_ci * @get_survey: Return per-channel survey information
396362306a36Sopenharmony_ci *
396462306a36Sopenharmony_ci * @rfkill_poll: Poll rfkill hardware state. If you need this, you also
396562306a36Sopenharmony_ci *	need to set wiphy->rfkill_poll to %true before registration,
396662306a36Sopenharmony_ci *	and need to call wiphy_rfkill_set_hw_state() in the callback.
396762306a36Sopenharmony_ci *	The callback can sleep.
396862306a36Sopenharmony_ci *
396962306a36Sopenharmony_ci * @set_coverage_class: Set slot time for given coverage class as specified
397062306a36Sopenharmony_ci *	in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
397162306a36Sopenharmony_ci *	accordingly; coverage class equals to -1 to enable ACK timeout
397262306a36Sopenharmony_ci *	estimation algorithm (dynack). To disable dynack set valid value for
397362306a36Sopenharmony_ci *	coverage class. This callback is not required and may sleep.
397462306a36Sopenharmony_ci *
397562306a36Sopenharmony_ci * @testmode_cmd: Implement a cfg80211 test mode command. The passed @vif may
397662306a36Sopenharmony_ci *	be %NULL. The callback can sleep.
397762306a36Sopenharmony_ci * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep.
397862306a36Sopenharmony_ci *
397962306a36Sopenharmony_ci * @flush: Flush all pending frames from the hardware queue, making sure
398062306a36Sopenharmony_ci *	that the hardware queues are empty. The @queues parameter is a bitmap
398162306a36Sopenharmony_ci *	of queues to flush, which is useful if different virtual interfaces
398262306a36Sopenharmony_ci *	use different hardware queues; it may also indicate all queues.
398362306a36Sopenharmony_ci *	If the parameter @drop is set to %true, pending frames may be dropped.
398462306a36Sopenharmony_ci *	Note that vif can be NULL.
398562306a36Sopenharmony_ci *	The callback can sleep.
398662306a36Sopenharmony_ci *
398762306a36Sopenharmony_ci * @flush_sta: Flush or drop all pending frames from the hardware queue(s) for
398862306a36Sopenharmony_ci *	the given station, as it's about to be removed.
398962306a36Sopenharmony_ci *	The callback can sleep.
399062306a36Sopenharmony_ci *
399162306a36Sopenharmony_ci * @channel_switch: Drivers that need (or want) to offload the channel
399262306a36Sopenharmony_ci *	switch operation for CSAs received from the AP may implement this
399362306a36Sopenharmony_ci *	callback. They must then call ieee80211_chswitch_done() to indicate
399462306a36Sopenharmony_ci *	completion of the channel switch.
399562306a36Sopenharmony_ci *
399662306a36Sopenharmony_ci * @set_antenna: Set antenna configuration (tx_ant, rx_ant) on the device.
399762306a36Sopenharmony_ci *	Parameters are bitmaps of allowed antennas to use for TX/RX. Drivers may
399862306a36Sopenharmony_ci *	reject TX/RX mask combinations they cannot support by returning -EINVAL
399962306a36Sopenharmony_ci *	(also see nl80211.h @NL80211_ATTR_WIPHY_ANTENNA_TX).
400062306a36Sopenharmony_ci *
400162306a36Sopenharmony_ci * @get_antenna: Get current antenna configuration from device (tx_ant, rx_ant).
400262306a36Sopenharmony_ci *
400362306a36Sopenharmony_ci * @remain_on_channel: Starts an off-channel period on the given channel, must
400462306a36Sopenharmony_ci *	call back to ieee80211_ready_on_channel() when on that channel. Note
400562306a36Sopenharmony_ci *	that normal channel traffic is not stopped as this is intended for hw
400662306a36Sopenharmony_ci *	offload. Frames to transmit on the off-channel channel are transmitted
400762306a36Sopenharmony_ci *	normally except for the %IEEE80211_TX_CTL_TX_OFFCHAN flag. When the
400862306a36Sopenharmony_ci *	duration (which will always be non-zero) expires, the driver must call
400962306a36Sopenharmony_ci *	ieee80211_remain_on_channel_expired().
401062306a36Sopenharmony_ci *	Note that this callback may be called while the device is in IDLE and
401162306a36Sopenharmony_ci *	must be accepted in this case.
401262306a36Sopenharmony_ci *	This callback may sleep.
401362306a36Sopenharmony_ci * @cancel_remain_on_channel: Requests that an ongoing off-channel period is
401462306a36Sopenharmony_ci *	aborted before it expires. This callback may sleep.
401562306a36Sopenharmony_ci *
401662306a36Sopenharmony_ci * @set_ringparam: Set tx and rx ring sizes.
401762306a36Sopenharmony_ci *
401862306a36Sopenharmony_ci * @get_ringparam: Get tx and rx ring current and maximum sizes.
401962306a36Sopenharmony_ci *
402062306a36Sopenharmony_ci * @tx_frames_pending: Check if there is any pending frame in the hardware
402162306a36Sopenharmony_ci *	queues before entering power save.
402262306a36Sopenharmony_ci *
402362306a36Sopenharmony_ci * @set_bitrate_mask: Set a mask of rates to be used for rate control selection
402462306a36Sopenharmony_ci *	when transmitting a frame. Currently only legacy rates are handled.
402562306a36Sopenharmony_ci *	The callback can sleep.
402662306a36Sopenharmony_ci * @event_callback: Notify driver about any event in mac80211. See
402762306a36Sopenharmony_ci *	&enum ieee80211_event_type for the different types.
402862306a36Sopenharmony_ci *	The callback must be atomic.
402962306a36Sopenharmony_ci *
403062306a36Sopenharmony_ci * @release_buffered_frames: Release buffered frames according to the given
403162306a36Sopenharmony_ci *	parameters. In the case where the driver buffers some frames for
403262306a36Sopenharmony_ci *	sleeping stations mac80211 will use this callback to tell the driver
403362306a36Sopenharmony_ci *	to release some frames, either for PS-poll or uAPSD.
403462306a36Sopenharmony_ci *	Note that if the @more_data parameter is %false the driver must check
403562306a36Sopenharmony_ci *	if there are more frames on the given TIDs, and if there are more than
403662306a36Sopenharmony_ci *	the frames being released then it must still set the more-data bit in
403762306a36Sopenharmony_ci *	the frame. If the @more_data parameter is %true, then of course the
403862306a36Sopenharmony_ci *	more-data bit must always be set.
403962306a36Sopenharmony_ci *	The @tids parameter tells the driver which TIDs to release frames
404062306a36Sopenharmony_ci *	from, for PS-poll it will always have only a single bit set.
404162306a36Sopenharmony_ci *	In the case this is used for a PS-poll initiated release, the
404262306a36Sopenharmony_ci *	@num_frames parameter will always be 1 so code can be shared. In
404362306a36Sopenharmony_ci *	this case the driver must also set %IEEE80211_TX_STATUS_EOSP flag
404462306a36Sopenharmony_ci *	on the TX status (and must report TX status) so that the PS-poll
404562306a36Sopenharmony_ci *	period is properly ended. This is used to avoid sending multiple
404662306a36Sopenharmony_ci *	responses for a retried PS-poll frame.
404762306a36Sopenharmony_ci *	In the case this is used for uAPSD, the @num_frames parameter may be
404862306a36Sopenharmony_ci *	bigger than one, but the driver may send fewer frames (it must send
404962306a36Sopenharmony_ci *	at least one, however). In this case it is also responsible for
405062306a36Sopenharmony_ci *	setting the EOSP flag in the QoS header of the frames. Also, when the
405162306a36Sopenharmony_ci *	service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP
405262306a36Sopenharmony_ci *	on the last frame in the SP. Alternatively, it may call the function
405362306a36Sopenharmony_ci *	ieee80211_sta_eosp() to inform mac80211 of the end of the SP.
405462306a36Sopenharmony_ci *	This callback must be atomic.
405562306a36Sopenharmony_ci * @allow_buffered_frames: Prepare device to allow the given number of frames
405662306a36Sopenharmony_ci *	to go out to the given station. The frames will be sent by mac80211
405762306a36Sopenharmony_ci *	via the usual TX path after this call. The TX information for frames
405862306a36Sopenharmony_ci *	released will also have the %IEEE80211_TX_CTL_NO_PS_BUFFER flag set
405962306a36Sopenharmony_ci *	and the last one will also have %IEEE80211_TX_STATUS_EOSP set. In case
406062306a36Sopenharmony_ci *	frames from multiple TIDs are released and the driver might reorder
406162306a36Sopenharmony_ci *	them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
406262306a36Sopenharmony_ci *	on the last frame and clear it on all others and also handle the EOSP
406362306a36Sopenharmony_ci *	bit in the QoS header correctly. Alternatively, it can also call the
406462306a36Sopenharmony_ci *	ieee80211_sta_eosp() function.
406562306a36Sopenharmony_ci *	The @tids parameter is a bitmap and tells the driver which TIDs the
406662306a36Sopenharmony_ci *	frames will be on; it will at most have two bits set.
406762306a36Sopenharmony_ci *	This callback must be atomic.
406862306a36Sopenharmony_ci *
406962306a36Sopenharmony_ci * @get_et_sset_count:  Ethtool API to get string-set count.
407062306a36Sopenharmony_ci *
407162306a36Sopenharmony_ci * @get_et_stats:  Ethtool API to get a set of u64 stats.
407262306a36Sopenharmony_ci *
407362306a36Sopenharmony_ci * @get_et_strings:  Ethtool API to get a set of strings to describe stats
407462306a36Sopenharmony_ci *	and perhaps other supported types of ethtool data-sets.
407562306a36Sopenharmony_ci *
407662306a36Sopenharmony_ci * @mgd_prepare_tx: Prepare for transmitting a management frame for association
407762306a36Sopenharmony_ci *	before associated. In multi-channel scenarios, a virtual interface is
407862306a36Sopenharmony_ci *	bound to a channel before it is associated, but as it isn't associated
407962306a36Sopenharmony_ci *	yet it need not necessarily be given airtime, in particular since any
408062306a36Sopenharmony_ci *	transmission to a P2P GO needs to be synchronized against the GO's
408162306a36Sopenharmony_ci *	powersave state. mac80211 will call this function before transmitting a
408262306a36Sopenharmony_ci *	management frame prior to having successfully associated to allow the
408362306a36Sopenharmony_ci *	driver to give it channel time for the transmission, to get a response
408462306a36Sopenharmony_ci *	and to be able to synchronize with the GO.
408562306a36Sopenharmony_ci *	For drivers that set %IEEE80211_HW_DEAUTH_NEED_MGD_TX_PREP, mac80211
408662306a36Sopenharmony_ci *	would also call this function before transmitting a deauthentication
408762306a36Sopenharmony_ci *	frame in case that no beacon was heard from the AP/P2P GO.
408862306a36Sopenharmony_ci *	The callback will be called before each transmission and upon return
408962306a36Sopenharmony_ci *	mac80211 will transmit the frame right away.
409062306a36Sopenharmony_ci *	Additional information is passed in the &struct ieee80211_prep_tx_info
409162306a36Sopenharmony_ci *	data. If duration there is greater than zero, mac80211 hints to the
409262306a36Sopenharmony_ci *	driver the duration for which the operation is requested.
409362306a36Sopenharmony_ci *	The callback is optional and can (should!) sleep.
409462306a36Sopenharmony_ci * @mgd_complete_tx: Notify the driver that the response frame for a previously
409562306a36Sopenharmony_ci *	transmitted frame announced with @mgd_prepare_tx was received, the data
409662306a36Sopenharmony_ci *	is filled similarly to @mgd_prepare_tx though the duration is not used.
409762306a36Sopenharmony_ci *
409862306a36Sopenharmony_ci * @mgd_protect_tdls_discover: Protect a TDLS discovery session. After sending
409962306a36Sopenharmony_ci *	a TDLS discovery-request, we expect a reply to arrive on the AP's
410062306a36Sopenharmony_ci *	channel. We must stay on the channel (no PSM, scan, etc.), since a TDLS
410162306a36Sopenharmony_ci *	setup-response is a direct packet not buffered by the AP.
410262306a36Sopenharmony_ci *	mac80211 will call this function just before the transmission of a TDLS
410362306a36Sopenharmony_ci *	discovery-request. The recommended period of protection is at least
410462306a36Sopenharmony_ci *	2 * (DTIM period).
410562306a36Sopenharmony_ci *	The callback is optional and can sleep.
410662306a36Sopenharmony_ci *
410762306a36Sopenharmony_ci * @add_chanctx: Notifies device driver about new channel context creation.
410862306a36Sopenharmony_ci *	This callback may sleep.
410962306a36Sopenharmony_ci * @remove_chanctx: Notifies device driver about channel context destruction.
411062306a36Sopenharmony_ci *	This callback may sleep.
411162306a36Sopenharmony_ci * @change_chanctx: Notifies device driver about channel context changes that
411262306a36Sopenharmony_ci *	may happen when combining different virtual interfaces on the same
411362306a36Sopenharmony_ci *	channel context with different settings
411462306a36Sopenharmony_ci *	This callback may sleep.
411562306a36Sopenharmony_ci * @assign_vif_chanctx: Notifies device driver about channel context being bound
411662306a36Sopenharmony_ci *	to vif. Possible use is for hw queue remapping.
411762306a36Sopenharmony_ci *	This callback may sleep.
411862306a36Sopenharmony_ci * @unassign_vif_chanctx: Notifies device driver about channel context being
411962306a36Sopenharmony_ci *	unbound from vif.
412062306a36Sopenharmony_ci *	This callback may sleep.
412162306a36Sopenharmony_ci * @switch_vif_chanctx: switch a number of vifs from one chanctx to
412262306a36Sopenharmony_ci *	another, as specified in the list of
412362306a36Sopenharmony_ci *	@ieee80211_vif_chanctx_switch passed to the driver, according
412462306a36Sopenharmony_ci *	to the mode defined in &ieee80211_chanctx_switch_mode.
412562306a36Sopenharmony_ci *	This callback may sleep.
412662306a36Sopenharmony_ci *
412762306a36Sopenharmony_ci * @start_ap: Start operation on the AP interface, this is called after all the
412862306a36Sopenharmony_ci *	information in bss_conf is set and beacon can be retrieved. A channel
412962306a36Sopenharmony_ci *	context is bound before this is called. Note that if the driver uses
413062306a36Sopenharmony_ci *	software scan or ROC, this (and @stop_ap) isn't called when the AP is
413162306a36Sopenharmony_ci *	just "paused" for scanning/ROC, which is indicated by the beacon being
413262306a36Sopenharmony_ci *	disabled/enabled via @bss_info_changed.
413362306a36Sopenharmony_ci * @stop_ap: Stop operation on the AP interface.
413462306a36Sopenharmony_ci *
413562306a36Sopenharmony_ci * @reconfig_complete: Called after a call to ieee80211_restart_hw() and
413662306a36Sopenharmony_ci *	during resume, when the reconfiguration has completed.
413762306a36Sopenharmony_ci *	This can help the driver implement the reconfiguration step (and
413862306a36Sopenharmony_ci *	indicate mac80211 is ready to receive frames).
413962306a36Sopenharmony_ci *	This callback may sleep.
414062306a36Sopenharmony_ci *
414162306a36Sopenharmony_ci * @ipv6_addr_change: IPv6 address assignment on the given interface changed.
414262306a36Sopenharmony_ci *	Currently, this is only called for managed or P2P client interfaces.
414362306a36Sopenharmony_ci *	This callback is optional; it must not sleep.
414462306a36Sopenharmony_ci *
414562306a36Sopenharmony_ci * @channel_switch_beacon: Starts a channel switch to a new channel.
414662306a36Sopenharmony_ci *	Beacons are modified to include CSA or ECSA IEs before calling this
414762306a36Sopenharmony_ci *	function. The corresponding count fields in these IEs must be
414862306a36Sopenharmony_ci *	decremented, and when they reach 1 the driver must call
414962306a36Sopenharmony_ci *	ieee80211_csa_finish(). Drivers which use ieee80211_beacon_get()
415062306a36Sopenharmony_ci *	get the csa counter decremented by mac80211, but must check if it is
415162306a36Sopenharmony_ci *	1 using ieee80211_beacon_counter_is_complete() after the beacon has been
415262306a36Sopenharmony_ci *	transmitted and then call ieee80211_csa_finish().
415362306a36Sopenharmony_ci *	If the CSA count starts as zero or 1, this function will not be called,
415462306a36Sopenharmony_ci *	since there won't be any time to beacon before the switch anyway.
415562306a36Sopenharmony_ci * @pre_channel_switch: This is an optional callback that is called
415662306a36Sopenharmony_ci *	before a channel switch procedure is started (ie. when a STA
415762306a36Sopenharmony_ci *	gets a CSA or a userspace initiated channel-switch), allowing
415862306a36Sopenharmony_ci *	the driver to prepare for the channel switch.
415962306a36Sopenharmony_ci * @post_channel_switch: This is an optional callback that is called
416062306a36Sopenharmony_ci *	after a channel switch procedure is completed, allowing the
416162306a36Sopenharmony_ci *	driver to go back to a normal configuration.
416262306a36Sopenharmony_ci * @abort_channel_switch: This is an optional callback that is called
416362306a36Sopenharmony_ci *	when channel switch procedure was completed, allowing the
416462306a36Sopenharmony_ci *	driver to go back to a normal configuration.
416562306a36Sopenharmony_ci * @channel_switch_rx_beacon: This is an optional callback that is called
416662306a36Sopenharmony_ci *	when channel switch procedure is in progress and additional beacon with
416762306a36Sopenharmony_ci *	CSA IE was received, allowing driver to track changes in count.
416862306a36Sopenharmony_ci * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
416962306a36Sopenharmony_ci *	information in bss_conf is set up and the beacon can be retrieved. A
417062306a36Sopenharmony_ci *	channel context is bound before this is called.
417162306a36Sopenharmony_ci * @leave_ibss: Leave the IBSS again.
417262306a36Sopenharmony_ci *
417362306a36Sopenharmony_ci * @get_expected_throughput: extract the expected throughput towards the
417462306a36Sopenharmony_ci *	specified station. The returned value is expressed in Kbps. It returns 0
417562306a36Sopenharmony_ci *	if the RC algorithm does not have proper data to provide.
417662306a36Sopenharmony_ci *
417762306a36Sopenharmony_ci * @get_txpower: get current maximum tx power (in dBm) based on configuration
417862306a36Sopenharmony_ci *	and hardware limits.
417962306a36Sopenharmony_ci *
418062306a36Sopenharmony_ci * @tdls_channel_switch: Start channel-switching with a TDLS peer. The driver
418162306a36Sopenharmony_ci *	is responsible for continually initiating channel-switching operations
418262306a36Sopenharmony_ci *	and returning to the base channel for communication with the AP. The
418362306a36Sopenharmony_ci *	driver receives a channel-switch request template and the location of
418462306a36Sopenharmony_ci *	the switch-timing IE within the template as part of the invocation.
418562306a36Sopenharmony_ci *	The template is valid only within the call, and the driver can
418662306a36Sopenharmony_ci *	optionally copy the skb for further re-use.
418762306a36Sopenharmony_ci * @tdls_cancel_channel_switch: Stop channel-switching with a TDLS peer. Both
418862306a36Sopenharmony_ci *	peers must be on the base channel when the call completes.
418962306a36Sopenharmony_ci * @tdls_recv_channel_switch: a TDLS channel-switch related frame (request or
419062306a36Sopenharmony_ci *	response) has been received from a remote peer. The driver gets
419162306a36Sopenharmony_ci *	parameters parsed from the incoming frame and may use them to continue
419262306a36Sopenharmony_ci *	an ongoing channel-switch operation. In addition, a channel-switch
419362306a36Sopenharmony_ci *	response template is provided, together with the location of the
419462306a36Sopenharmony_ci *	switch-timing IE within the template. The skb can only be used within
419562306a36Sopenharmony_ci *	the function call.
419662306a36Sopenharmony_ci *
419762306a36Sopenharmony_ci * @wake_tx_queue: Called when new packets have been added to the queue.
419862306a36Sopenharmony_ci * @sync_rx_queues: Process all pending frames in RSS queues. This is a
419962306a36Sopenharmony_ci *	synchronization which is needed in case driver has in its RSS queues
420062306a36Sopenharmony_ci *	pending frames that were received prior to the control path action
420162306a36Sopenharmony_ci *	currently taken (e.g. disassociation) but are not processed yet.
420262306a36Sopenharmony_ci *
420362306a36Sopenharmony_ci * @start_nan: join an existing NAN cluster, or create a new one.
420462306a36Sopenharmony_ci * @stop_nan: leave the NAN cluster.
420562306a36Sopenharmony_ci * @nan_change_conf: change NAN configuration. The data in cfg80211_nan_conf
420662306a36Sopenharmony_ci *	contains full new configuration and changes specify which parameters
420762306a36Sopenharmony_ci *	are changed with respect to the last NAN config.
420862306a36Sopenharmony_ci *	The driver gets both full configuration and the changed parameters since
420962306a36Sopenharmony_ci *	some devices may need the full configuration while others need only the
421062306a36Sopenharmony_ci *	changed parameters.
421162306a36Sopenharmony_ci * @add_nan_func: Add a NAN function. Returns 0 on success. The data in
421262306a36Sopenharmony_ci *	cfg80211_nan_func must not be referenced outside the scope of
421362306a36Sopenharmony_ci *	this call.
421462306a36Sopenharmony_ci * @del_nan_func: Remove a NAN function. The driver must call
421562306a36Sopenharmony_ci *	ieee80211_nan_func_terminated() with
421662306a36Sopenharmony_ci *	NL80211_NAN_FUNC_TERM_REASON_USER_REQUEST reason code upon removal.
421762306a36Sopenharmony_ci * @can_aggregate_in_amsdu: Called in order to determine if HW supports
421862306a36Sopenharmony_ci *	aggregating two specific frames in the same A-MSDU. The relation
421962306a36Sopenharmony_ci *	between the skbs should be symmetric and transitive. Note that while
422062306a36Sopenharmony_ci *	skb is always a real frame, head may or may not be an A-MSDU.
422162306a36Sopenharmony_ci * @get_ftm_responder_stats: Retrieve FTM responder statistics, if available.
422262306a36Sopenharmony_ci *	Statistics should be cumulative, currently no way to reset is provided.
422362306a36Sopenharmony_ci *
422462306a36Sopenharmony_ci * @start_pmsr: start peer measurement (e.g. FTM) (this call can sleep)
422562306a36Sopenharmony_ci * @abort_pmsr: abort peer measurement (this call can sleep)
422662306a36Sopenharmony_ci * @set_tid_config: Apply TID specific configurations. This callback may sleep.
422762306a36Sopenharmony_ci * @reset_tid_config: Reset TID specific configuration for the peer.
422862306a36Sopenharmony_ci *	This callback may sleep.
422962306a36Sopenharmony_ci * @update_vif_offload: Update virtual interface offload flags
423062306a36Sopenharmony_ci *	This callback may sleep.
423162306a36Sopenharmony_ci * @sta_set_4addr: Called to notify the driver when a station starts/stops using
423262306a36Sopenharmony_ci *	4-address mode
423362306a36Sopenharmony_ci * @set_sar_specs: Update the SAR (TX power) settings.
423462306a36Sopenharmony_ci * @sta_set_decap_offload: Called to notify the driver when a station is allowed
423562306a36Sopenharmony_ci *	to use rx decapsulation offload
423662306a36Sopenharmony_ci * @add_twt_setup: Update hw with TWT agreement parameters received from the peer.
423762306a36Sopenharmony_ci *	This callback allows the hw to check if requested parameters
423862306a36Sopenharmony_ci *	are supported and if there is enough room for a new agreement.
423962306a36Sopenharmony_ci *	The hw is expected to set agreement result in the req_type field of
424062306a36Sopenharmony_ci *	twt structure.
424162306a36Sopenharmony_ci * @twt_teardown_request: Update the hw with TWT teardown request received
424262306a36Sopenharmony_ci *	from the peer.
424362306a36Sopenharmony_ci * @set_radar_background: Configure dedicated offchannel chain available for
424462306a36Sopenharmony_ci *	radar/CAC detection on some hw. This chain can't be used to transmit
424562306a36Sopenharmony_ci *	or receive frames and it is bounded to a running wdev.
424662306a36Sopenharmony_ci *	Background radar/CAC detection allows to avoid the CAC downtime
424762306a36Sopenharmony_ci *	switching to a different channel during CAC detection on the selected
424862306a36Sopenharmony_ci *	radar channel.
424962306a36Sopenharmony_ci *	The caller is expected to set chandef pointer to NULL in order to
425062306a36Sopenharmony_ci *	disable background CAC/radar detection.
425162306a36Sopenharmony_ci * @net_fill_forward_path: Called from .ndo_fill_forward_path in order to
425262306a36Sopenharmony_ci *	resolve a path for hardware flow offloading
425362306a36Sopenharmony_ci * @change_vif_links: Change the valid links on an interface, note that while
425462306a36Sopenharmony_ci *	removing the old link information is still valid (link_conf pointer),
425562306a36Sopenharmony_ci *	but may immediately disappear after the function returns. The old or
425662306a36Sopenharmony_ci *	new links bitmaps may be 0 if going from/to a non-MLO situation.
425762306a36Sopenharmony_ci *	The @old array contains pointers to the old bss_conf structures
425862306a36Sopenharmony_ci *	that were already removed, in case they're needed.
425962306a36Sopenharmony_ci *	This callback can sleep.
426062306a36Sopenharmony_ci * @change_sta_links: Change the valid links of a station, similar to
426162306a36Sopenharmony_ci *	@change_vif_links. This callback can sleep.
426262306a36Sopenharmony_ci *	Note that a sta can also be inserted or removed with valid links,
426362306a36Sopenharmony_ci *	i.e. passed to @sta_add/@sta_state with sta->valid_links not zero.
426462306a36Sopenharmony_ci *	In fact, cannot change from having valid_links and not having them.
426562306a36Sopenharmony_ci * @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames. This is
426662306a36Sopenharmony_ci *	not restored at HW reset by mac80211 so drivers need to take care of
426762306a36Sopenharmony_ci *	that.
426862306a36Sopenharmony_ci * @net_setup_tc: Called from .ndo_setup_tc in order to prepare hardware
426962306a36Sopenharmony_ci *	flow offloading for flows originating from the vif.
427062306a36Sopenharmony_ci *	Note that the driver must not assume that the vif driver_data is valid
427162306a36Sopenharmony_ci *	at this point, since the callback can be called during netdev teardown.
427262306a36Sopenharmony_ci */
427362306a36Sopenharmony_cistruct ieee80211_ops {
427462306a36Sopenharmony_ci	void (*tx)(struct ieee80211_hw *hw,
427562306a36Sopenharmony_ci		   struct ieee80211_tx_control *control,
427662306a36Sopenharmony_ci		   struct sk_buff *skb);
427762306a36Sopenharmony_ci	int (*start)(struct ieee80211_hw *hw);
427862306a36Sopenharmony_ci	void (*stop)(struct ieee80211_hw *hw);
427962306a36Sopenharmony_ci#ifdef CONFIG_PM
428062306a36Sopenharmony_ci	int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan);
428162306a36Sopenharmony_ci	int (*resume)(struct ieee80211_hw *hw);
428262306a36Sopenharmony_ci	void (*set_wakeup)(struct ieee80211_hw *hw, bool enabled);
428362306a36Sopenharmony_ci#endif
428462306a36Sopenharmony_ci	int (*add_interface)(struct ieee80211_hw *hw,
428562306a36Sopenharmony_ci			     struct ieee80211_vif *vif);
428662306a36Sopenharmony_ci	int (*change_interface)(struct ieee80211_hw *hw,
428762306a36Sopenharmony_ci				struct ieee80211_vif *vif,
428862306a36Sopenharmony_ci				enum nl80211_iftype new_type, bool p2p);
428962306a36Sopenharmony_ci	void (*remove_interface)(struct ieee80211_hw *hw,
429062306a36Sopenharmony_ci				 struct ieee80211_vif *vif);
429162306a36Sopenharmony_ci	int (*config)(struct ieee80211_hw *hw, u32 changed);
429262306a36Sopenharmony_ci	void (*bss_info_changed)(struct ieee80211_hw *hw,
429362306a36Sopenharmony_ci				 struct ieee80211_vif *vif,
429462306a36Sopenharmony_ci				 struct ieee80211_bss_conf *info,
429562306a36Sopenharmony_ci				 u64 changed);
429662306a36Sopenharmony_ci	void (*vif_cfg_changed)(struct ieee80211_hw *hw,
429762306a36Sopenharmony_ci				struct ieee80211_vif *vif,
429862306a36Sopenharmony_ci				u64 changed);
429962306a36Sopenharmony_ci	void (*link_info_changed)(struct ieee80211_hw *hw,
430062306a36Sopenharmony_ci				  struct ieee80211_vif *vif,
430162306a36Sopenharmony_ci				  struct ieee80211_bss_conf *info,
430262306a36Sopenharmony_ci				  u64 changed);
430362306a36Sopenharmony_ci
430462306a36Sopenharmony_ci	int (*start_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
430562306a36Sopenharmony_ci			struct ieee80211_bss_conf *link_conf);
430662306a36Sopenharmony_ci	void (*stop_ap)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
430762306a36Sopenharmony_ci			struct ieee80211_bss_conf *link_conf);
430862306a36Sopenharmony_ci
430962306a36Sopenharmony_ci	u64 (*prepare_multicast)(struct ieee80211_hw *hw,
431062306a36Sopenharmony_ci				 struct netdev_hw_addr_list *mc_list);
431162306a36Sopenharmony_ci	void (*configure_filter)(struct ieee80211_hw *hw,
431262306a36Sopenharmony_ci				 unsigned int changed_flags,
431362306a36Sopenharmony_ci				 unsigned int *total_flags,
431462306a36Sopenharmony_ci				 u64 multicast);
431562306a36Sopenharmony_ci	void (*config_iface_filter)(struct ieee80211_hw *hw,
431662306a36Sopenharmony_ci				    struct ieee80211_vif *vif,
431762306a36Sopenharmony_ci				    unsigned int filter_flags,
431862306a36Sopenharmony_ci				    unsigned int changed_flags);
431962306a36Sopenharmony_ci	int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
432062306a36Sopenharmony_ci		       bool set);
432162306a36Sopenharmony_ci	int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
432262306a36Sopenharmony_ci		       struct ieee80211_vif *vif, struct ieee80211_sta *sta,
432362306a36Sopenharmony_ci		       struct ieee80211_key_conf *key);
432462306a36Sopenharmony_ci	void (*update_tkip_key)(struct ieee80211_hw *hw,
432562306a36Sopenharmony_ci				struct ieee80211_vif *vif,
432662306a36Sopenharmony_ci				struct ieee80211_key_conf *conf,
432762306a36Sopenharmony_ci				struct ieee80211_sta *sta,
432862306a36Sopenharmony_ci				u32 iv32, u16 *phase1key);
432962306a36Sopenharmony_ci	void (*set_rekey_data)(struct ieee80211_hw *hw,
433062306a36Sopenharmony_ci			       struct ieee80211_vif *vif,
433162306a36Sopenharmony_ci			       struct cfg80211_gtk_rekey_data *data);
433262306a36Sopenharmony_ci	void (*set_default_unicast_key)(struct ieee80211_hw *hw,
433362306a36Sopenharmony_ci					struct ieee80211_vif *vif, int idx);
433462306a36Sopenharmony_ci	int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
433562306a36Sopenharmony_ci		       struct ieee80211_scan_request *req);
433662306a36Sopenharmony_ci	void (*cancel_hw_scan)(struct ieee80211_hw *hw,
433762306a36Sopenharmony_ci			       struct ieee80211_vif *vif);
433862306a36Sopenharmony_ci	int (*sched_scan_start)(struct ieee80211_hw *hw,
433962306a36Sopenharmony_ci				struct ieee80211_vif *vif,
434062306a36Sopenharmony_ci				struct cfg80211_sched_scan_request *req,
434162306a36Sopenharmony_ci				struct ieee80211_scan_ies *ies);
434262306a36Sopenharmony_ci	int (*sched_scan_stop)(struct ieee80211_hw *hw,
434362306a36Sopenharmony_ci			       struct ieee80211_vif *vif);
434462306a36Sopenharmony_ci	void (*sw_scan_start)(struct ieee80211_hw *hw,
434562306a36Sopenharmony_ci			      struct ieee80211_vif *vif,
434662306a36Sopenharmony_ci			      const u8 *mac_addr);
434762306a36Sopenharmony_ci	void (*sw_scan_complete)(struct ieee80211_hw *hw,
434862306a36Sopenharmony_ci				 struct ieee80211_vif *vif);
434962306a36Sopenharmony_ci	int (*get_stats)(struct ieee80211_hw *hw,
435062306a36Sopenharmony_ci			 struct ieee80211_low_level_stats *stats);
435162306a36Sopenharmony_ci	void (*get_key_seq)(struct ieee80211_hw *hw,
435262306a36Sopenharmony_ci			    struct ieee80211_key_conf *key,
435362306a36Sopenharmony_ci			    struct ieee80211_key_seq *seq);
435462306a36Sopenharmony_ci	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
435562306a36Sopenharmony_ci	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
435662306a36Sopenharmony_ci	int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
435762306a36Sopenharmony_ci		       struct ieee80211_sta *sta);
435862306a36Sopenharmony_ci	int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
435962306a36Sopenharmony_ci			  struct ieee80211_sta *sta);
436062306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_DEBUGFS
436162306a36Sopenharmony_ci	void (*link_add_debugfs)(struct ieee80211_hw *hw,
436262306a36Sopenharmony_ci				 struct ieee80211_vif *vif,
436362306a36Sopenharmony_ci				 struct ieee80211_bss_conf *link_conf,
436462306a36Sopenharmony_ci				 struct dentry *dir);
436562306a36Sopenharmony_ci	void (*sta_add_debugfs)(struct ieee80211_hw *hw,
436662306a36Sopenharmony_ci				struct ieee80211_vif *vif,
436762306a36Sopenharmony_ci				struct ieee80211_sta *sta,
436862306a36Sopenharmony_ci				struct dentry *dir);
436962306a36Sopenharmony_ci	void (*link_sta_add_debugfs)(struct ieee80211_hw *hw,
437062306a36Sopenharmony_ci				     struct ieee80211_vif *vif,
437162306a36Sopenharmony_ci				     struct ieee80211_link_sta *link_sta,
437262306a36Sopenharmony_ci				     struct dentry *dir);
437362306a36Sopenharmony_ci#endif
437462306a36Sopenharmony_ci	void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
437562306a36Sopenharmony_ci			enum sta_notify_cmd, struct ieee80211_sta *sta);
437662306a36Sopenharmony_ci	int (*sta_set_txpwr)(struct ieee80211_hw *hw,
437762306a36Sopenharmony_ci			     struct ieee80211_vif *vif,
437862306a36Sopenharmony_ci			     struct ieee80211_sta *sta);
437962306a36Sopenharmony_ci	int (*sta_state)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
438062306a36Sopenharmony_ci			 struct ieee80211_sta *sta,
438162306a36Sopenharmony_ci			 enum ieee80211_sta_state old_state,
438262306a36Sopenharmony_ci			 enum ieee80211_sta_state new_state);
438362306a36Sopenharmony_ci	void (*sta_pre_rcu_remove)(struct ieee80211_hw *hw,
438462306a36Sopenharmony_ci				   struct ieee80211_vif *vif,
438562306a36Sopenharmony_ci				   struct ieee80211_sta *sta);
438662306a36Sopenharmony_ci	void (*sta_rc_update)(struct ieee80211_hw *hw,
438762306a36Sopenharmony_ci			      struct ieee80211_vif *vif,
438862306a36Sopenharmony_ci			      struct ieee80211_sta *sta,
438962306a36Sopenharmony_ci			      u32 changed);
439062306a36Sopenharmony_ci	void (*sta_rate_tbl_update)(struct ieee80211_hw *hw,
439162306a36Sopenharmony_ci				    struct ieee80211_vif *vif,
439262306a36Sopenharmony_ci				    struct ieee80211_sta *sta);
439362306a36Sopenharmony_ci	void (*sta_statistics)(struct ieee80211_hw *hw,
439462306a36Sopenharmony_ci			       struct ieee80211_vif *vif,
439562306a36Sopenharmony_ci			       struct ieee80211_sta *sta,
439662306a36Sopenharmony_ci			       struct station_info *sinfo);
439762306a36Sopenharmony_ci	int (*conf_tx)(struct ieee80211_hw *hw,
439862306a36Sopenharmony_ci		       struct ieee80211_vif *vif,
439962306a36Sopenharmony_ci		       unsigned int link_id, u16 ac,
440062306a36Sopenharmony_ci		       const struct ieee80211_tx_queue_params *params);
440162306a36Sopenharmony_ci	u64 (*get_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
440262306a36Sopenharmony_ci	void (*set_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
440362306a36Sopenharmony_ci			u64 tsf);
440462306a36Sopenharmony_ci	void (*offset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
440562306a36Sopenharmony_ci			   s64 offset);
440662306a36Sopenharmony_ci	void (*reset_tsf)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
440762306a36Sopenharmony_ci	int (*tx_last_beacon)(struct ieee80211_hw *hw);
440862306a36Sopenharmony_ci
440962306a36Sopenharmony_ci	/**
441062306a36Sopenharmony_ci	 * @ampdu_action:
441162306a36Sopenharmony_ci	 * Perform a certain A-MPDU action.
441262306a36Sopenharmony_ci	 * The RA/TID combination determines the destination and TID we want
441362306a36Sopenharmony_ci	 * the ampdu action to be performed for. The action is defined through
441462306a36Sopenharmony_ci	 * ieee80211_ampdu_mlme_action.
441562306a36Sopenharmony_ci	 * When the action is set to %IEEE80211_AMPDU_TX_OPERATIONAL the driver
441662306a36Sopenharmony_ci	 * may neither send aggregates containing more subframes than @buf_size
441762306a36Sopenharmony_ci	 * nor send aggregates in a way that lost frames would exceed the
441862306a36Sopenharmony_ci	 * buffer size. If just limiting the aggregate size, this would be
441962306a36Sopenharmony_ci	 * possible with a buf_size of 8:
442062306a36Sopenharmony_ci	 *
442162306a36Sopenharmony_ci	 * - ``TX: 1.....7``
442262306a36Sopenharmony_ci	 * - ``RX:  2....7`` (lost frame #1)
442362306a36Sopenharmony_ci	 * - ``TX:        8..1...``
442462306a36Sopenharmony_ci	 *
442562306a36Sopenharmony_ci	 * which is invalid since #1 was now re-transmitted well past the
442662306a36Sopenharmony_ci	 * buffer size of 8. Correct ways to retransmit #1 would be:
442762306a36Sopenharmony_ci	 *
442862306a36Sopenharmony_ci	 * - ``TX:        1   or``
442962306a36Sopenharmony_ci	 * - ``TX:        18  or``
443062306a36Sopenharmony_ci	 * - ``TX:        81``
443162306a36Sopenharmony_ci	 *
443262306a36Sopenharmony_ci	 * Even ``189`` would be wrong since 1 could be lost again.
443362306a36Sopenharmony_ci	 *
443462306a36Sopenharmony_ci	 * Returns a negative error code on failure. The driver may return
443562306a36Sopenharmony_ci	 * %IEEE80211_AMPDU_TX_START_IMMEDIATE for %IEEE80211_AMPDU_TX_START
443662306a36Sopenharmony_ci	 * if the session can start immediately.
443762306a36Sopenharmony_ci	 *
443862306a36Sopenharmony_ci	 * The callback can sleep.
443962306a36Sopenharmony_ci	 */
444062306a36Sopenharmony_ci	int (*ampdu_action)(struct ieee80211_hw *hw,
444162306a36Sopenharmony_ci			    struct ieee80211_vif *vif,
444262306a36Sopenharmony_ci			    struct ieee80211_ampdu_params *params);
444362306a36Sopenharmony_ci	int (*get_survey)(struct ieee80211_hw *hw, int idx,
444462306a36Sopenharmony_ci		struct survey_info *survey);
444562306a36Sopenharmony_ci	void (*rfkill_poll)(struct ieee80211_hw *hw);
444662306a36Sopenharmony_ci	void (*set_coverage_class)(struct ieee80211_hw *hw, s16 coverage_class);
444762306a36Sopenharmony_ci#ifdef CONFIG_NL80211_TESTMODE
444862306a36Sopenharmony_ci	int (*testmode_cmd)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
444962306a36Sopenharmony_ci			    void *data, int len);
445062306a36Sopenharmony_ci	int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb,
445162306a36Sopenharmony_ci			     struct netlink_callback *cb,
445262306a36Sopenharmony_ci			     void *data, int len);
445362306a36Sopenharmony_ci#endif
445462306a36Sopenharmony_ci	void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
445562306a36Sopenharmony_ci		      u32 queues, bool drop);
445662306a36Sopenharmony_ci	void (*flush_sta)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
445762306a36Sopenharmony_ci			  struct ieee80211_sta *sta);
445862306a36Sopenharmony_ci	void (*channel_switch)(struct ieee80211_hw *hw,
445962306a36Sopenharmony_ci			       struct ieee80211_vif *vif,
446062306a36Sopenharmony_ci			       struct ieee80211_channel_switch *ch_switch);
446162306a36Sopenharmony_ci	int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
446262306a36Sopenharmony_ci	int (*get_antenna)(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
446362306a36Sopenharmony_ci
446462306a36Sopenharmony_ci	int (*remain_on_channel)(struct ieee80211_hw *hw,
446562306a36Sopenharmony_ci				 struct ieee80211_vif *vif,
446662306a36Sopenharmony_ci				 struct ieee80211_channel *chan,
446762306a36Sopenharmony_ci				 int duration,
446862306a36Sopenharmony_ci				 enum ieee80211_roc_type type);
446962306a36Sopenharmony_ci	int (*cancel_remain_on_channel)(struct ieee80211_hw *hw,
447062306a36Sopenharmony_ci					struct ieee80211_vif *vif);
447162306a36Sopenharmony_ci	int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx);
447262306a36Sopenharmony_ci	void (*get_ringparam)(struct ieee80211_hw *hw,
447362306a36Sopenharmony_ci			      u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max);
447462306a36Sopenharmony_ci	bool (*tx_frames_pending)(struct ieee80211_hw *hw);
447562306a36Sopenharmony_ci	int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
447662306a36Sopenharmony_ci				const struct cfg80211_bitrate_mask *mask);
447762306a36Sopenharmony_ci	void (*event_callback)(struct ieee80211_hw *hw,
447862306a36Sopenharmony_ci			       struct ieee80211_vif *vif,
447962306a36Sopenharmony_ci			       const struct ieee80211_event *event);
448062306a36Sopenharmony_ci
448162306a36Sopenharmony_ci	void (*allow_buffered_frames)(struct ieee80211_hw *hw,
448262306a36Sopenharmony_ci				      struct ieee80211_sta *sta,
448362306a36Sopenharmony_ci				      u16 tids, int num_frames,
448462306a36Sopenharmony_ci				      enum ieee80211_frame_release_type reason,
448562306a36Sopenharmony_ci				      bool more_data);
448662306a36Sopenharmony_ci	void (*release_buffered_frames)(struct ieee80211_hw *hw,
448762306a36Sopenharmony_ci					struct ieee80211_sta *sta,
448862306a36Sopenharmony_ci					u16 tids, int num_frames,
448962306a36Sopenharmony_ci					enum ieee80211_frame_release_type reason,
449062306a36Sopenharmony_ci					bool more_data);
449162306a36Sopenharmony_ci
449262306a36Sopenharmony_ci	int	(*get_et_sset_count)(struct ieee80211_hw *hw,
449362306a36Sopenharmony_ci				     struct ieee80211_vif *vif, int sset);
449462306a36Sopenharmony_ci	void	(*get_et_stats)(struct ieee80211_hw *hw,
449562306a36Sopenharmony_ci				struct ieee80211_vif *vif,
449662306a36Sopenharmony_ci				struct ethtool_stats *stats, u64 *data);
449762306a36Sopenharmony_ci	void	(*get_et_strings)(struct ieee80211_hw *hw,
449862306a36Sopenharmony_ci				  struct ieee80211_vif *vif,
449962306a36Sopenharmony_ci				  u32 sset, u8 *data);
450062306a36Sopenharmony_ci
450162306a36Sopenharmony_ci	void	(*mgd_prepare_tx)(struct ieee80211_hw *hw,
450262306a36Sopenharmony_ci				  struct ieee80211_vif *vif,
450362306a36Sopenharmony_ci				  struct ieee80211_prep_tx_info *info);
450462306a36Sopenharmony_ci	void	(*mgd_complete_tx)(struct ieee80211_hw *hw,
450562306a36Sopenharmony_ci				   struct ieee80211_vif *vif,
450662306a36Sopenharmony_ci				   struct ieee80211_prep_tx_info *info);
450762306a36Sopenharmony_ci
450862306a36Sopenharmony_ci	void	(*mgd_protect_tdls_discover)(struct ieee80211_hw *hw,
450962306a36Sopenharmony_ci					     struct ieee80211_vif *vif);
451062306a36Sopenharmony_ci
451162306a36Sopenharmony_ci	int (*add_chanctx)(struct ieee80211_hw *hw,
451262306a36Sopenharmony_ci			   struct ieee80211_chanctx_conf *ctx);
451362306a36Sopenharmony_ci	void (*remove_chanctx)(struct ieee80211_hw *hw,
451462306a36Sopenharmony_ci			       struct ieee80211_chanctx_conf *ctx);
451562306a36Sopenharmony_ci	void (*change_chanctx)(struct ieee80211_hw *hw,
451662306a36Sopenharmony_ci			       struct ieee80211_chanctx_conf *ctx,
451762306a36Sopenharmony_ci			       u32 changed);
451862306a36Sopenharmony_ci	int (*assign_vif_chanctx)(struct ieee80211_hw *hw,
451962306a36Sopenharmony_ci				  struct ieee80211_vif *vif,
452062306a36Sopenharmony_ci				  struct ieee80211_bss_conf *link_conf,
452162306a36Sopenharmony_ci				  struct ieee80211_chanctx_conf *ctx);
452262306a36Sopenharmony_ci	void (*unassign_vif_chanctx)(struct ieee80211_hw *hw,
452362306a36Sopenharmony_ci				     struct ieee80211_vif *vif,
452462306a36Sopenharmony_ci				     struct ieee80211_bss_conf *link_conf,
452562306a36Sopenharmony_ci				     struct ieee80211_chanctx_conf *ctx);
452662306a36Sopenharmony_ci	int (*switch_vif_chanctx)(struct ieee80211_hw *hw,
452762306a36Sopenharmony_ci				  struct ieee80211_vif_chanctx_switch *vifs,
452862306a36Sopenharmony_ci				  int n_vifs,
452962306a36Sopenharmony_ci				  enum ieee80211_chanctx_switch_mode mode);
453062306a36Sopenharmony_ci
453162306a36Sopenharmony_ci	void (*reconfig_complete)(struct ieee80211_hw *hw,
453262306a36Sopenharmony_ci				  enum ieee80211_reconfig_type reconfig_type);
453362306a36Sopenharmony_ci
453462306a36Sopenharmony_ci#if IS_ENABLED(CONFIG_IPV6)
453562306a36Sopenharmony_ci	void (*ipv6_addr_change)(struct ieee80211_hw *hw,
453662306a36Sopenharmony_ci				 struct ieee80211_vif *vif,
453762306a36Sopenharmony_ci				 struct inet6_dev *idev);
453862306a36Sopenharmony_ci#endif
453962306a36Sopenharmony_ci	void (*channel_switch_beacon)(struct ieee80211_hw *hw,
454062306a36Sopenharmony_ci				      struct ieee80211_vif *vif,
454162306a36Sopenharmony_ci				      struct cfg80211_chan_def *chandef);
454262306a36Sopenharmony_ci	int (*pre_channel_switch)(struct ieee80211_hw *hw,
454362306a36Sopenharmony_ci				  struct ieee80211_vif *vif,
454462306a36Sopenharmony_ci				  struct ieee80211_channel_switch *ch_switch);
454562306a36Sopenharmony_ci
454662306a36Sopenharmony_ci	int (*post_channel_switch)(struct ieee80211_hw *hw,
454762306a36Sopenharmony_ci				   struct ieee80211_vif *vif);
454862306a36Sopenharmony_ci	void (*abort_channel_switch)(struct ieee80211_hw *hw,
454962306a36Sopenharmony_ci				     struct ieee80211_vif *vif);
455062306a36Sopenharmony_ci	void (*channel_switch_rx_beacon)(struct ieee80211_hw *hw,
455162306a36Sopenharmony_ci					 struct ieee80211_vif *vif,
455262306a36Sopenharmony_ci					 struct ieee80211_channel_switch *ch_switch);
455362306a36Sopenharmony_ci
455462306a36Sopenharmony_ci	int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
455562306a36Sopenharmony_ci	void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
455662306a36Sopenharmony_ci	u32 (*get_expected_throughput)(struct ieee80211_hw *hw,
455762306a36Sopenharmony_ci				       struct ieee80211_sta *sta);
455862306a36Sopenharmony_ci	int (*get_txpower)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
455962306a36Sopenharmony_ci			   int *dbm);
456062306a36Sopenharmony_ci
456162306a36Sopenharmony_ci	int (*tdls_channel_switch)(struct ieee80211_hw *hw,
456262306a36Sopenharmony_ci				   struct ieee80211_vif *vif,
456362306a36Sopenharmony_ci				   struct ieee80211_sta *sta, u8 oper_class,
456462306a36Sopenharmony_ci				   struct cfg80211_chan_def *chandef,
456562306a36Sopenharmony_ci				   struct sk_buff *tmpl_skb, u32 ch_sw_tm_ie);
456662306a36Sopenharmony_ci	void (*tdls_cancel_channel_switch)(struct ieee80211_hw *hw,
456762306a36Sopenharmony_ci					   struct ieee80211_vif *vif,
456862306a36Sopenharmony_ci					   struct ieee80211_sta *sta);
456962306a36Sopenharmony_ci	void (*tdls_recv_channel_switch)(struct ieee80211_hw *hw,
457062306a36Sopenharmony_ci					 struct ieee80211_vif *vif,
457162306a36Sopenharmony_ci					 struct ieee80211_tdls_ch_sw_params *params);
457262306a36Sopenharmony_ci
457362306a36Sopenharmony_ci	void (*wake_tx_queue)(struct ieee80211_hw *hw,
457462306a36Sopenharmony_ci			      struct ieee80211_txq *txq);
457562306a36Sopenharmony_ci	void (*sync_rx_queues)(struct ieee80211_hw *hw);
457662306a36Sopenharmony_ci
457762306a36Sopenharmony_ci	int (*start_nan)(struct ieee80211_hw *hw,
457862306a36Sopenharmony_ci			 struct ieee80211_vif *vif,
457962306a36Sopenharmony_ci			 struct cfg80211_nan_conf *conf);
458062306a36Sopenharmony_ci	int (*stop_nan)(struct ieee80211_hw *hw,
458162306a36Sopenharmony_ci			struct ieee80211_vif *vif);
458262306a36Sopenharmony_ci	int (*nan_change_conf)(struct ieee80211_hw *hw,
458362306a36Sopenharmony_ci			       struct ieee80211_vif *vif,
458462306a36Sopenharmony_ci			       struct cfg80211_nan_conf *conf, u32 changes);
458562306a36Sopenharmony_ci	int (*add_nan_func)(struct ieee80211_hw *hw,
458662306a36Sopenharmony_ci			    struct ieee80211_vif *vif,
458762306a36Sopenharmony_ci			    const struct cfg80211_nan_func *nan_func);
458862306a36Sopenharmony_ci	void (*del_nan_func)(struct ieee80211_hw *hw,
458962306a36Sopenharmony_ci			    struct ieee80211_vif *vif,
459062306a36Sopenharmony_ci			    u8 instance_id);
459162306a36Sopenharmony_ci	bool (*can_aggregate_in_amsdu)(struct ieee80211_hw *hw,
459262306a36Sopenharmony_ci				       struct sk_buff *head,
459362306a36Sopenharmony_ci				       struct sk_buff *skb);
459462306a36Sopenharmony_ci	int (*get_ftm_responder_stats)(struct ieee80211_hw *hw,
459562306a36Sopenharmony_ci				       struct ieee80211_vif *vif,
459662306a36Sopenharmony_ci				       struct cfg80211_ftm_responder_stats *ftm_stats);
459762306a36Sopenharmony_ci	int (*start_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
459862306a36Sopenharmony_ci			  struct cfg80211_pmsr_request *request);
459962306a36Sopenharmony_ci	void (*abort_pmsr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
460062306a36Sopenharmony_ci			   struct cfg80211_pmsr_request *request);
460162306a36Sopenharmony_ci	int (*set_tid_config)(struct ieee80211_hw *hw,
460262306a36Sopenharmony_ci			      struct ieee80211_vif *vif,
460362306a36Sopenharmony_ci			      struct ieee80211_sta *sta,
460462306a36Sopenharmony_ci			      struct cfg80211_tid_config *tid_conf);
460562306a36Sopenharmony_ci	int (*reset_tid_config)(struct ieee80211_hw *hw,
460662306a36Sopenharmony_ci				struct ieee80211_vif *vif,
460762306a36Sopenharmony_ci				struct ieee80211_sta *sta, u8 tids);
460862306a36Sopenharmony_ci	void (*update_vif_offload)(struct ieee80211_hw *hw,
460962306a36Sopenharmony_ci				   struct ieee80211_vif *vif);
461062306a36Sopenharmony_ci	void (*sta_set_4addr)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
461162306a36Sopenharmony_ci			      struct ieee80211_sta *sta, bool enabled);
461262306a36Sopenharmony_ci	int (*set_sar_specs)(struct ieee80211_hw *hw,
461362306a36Sopenharmony_ci			     const struct cfg80211_sar_specs *sar);
461462306a36Sopenharmony_ci	void (*sta_set_decap_offload)(struct ieee80211_hw *hw,
461562306a36Sopenharmony_ci				      struct ieee80211_vif *vif,
461662306a36Sopenharmony_ci				      struct ieee80211_sta *sta, bool enabled);
461762306a36Sopenharmony_ci	void (*add_twt_setup)(struct ieee80211_hw *hw,
461862306a36Sopenharmony_ci			      struct ieee80211_sta *sta,
461962306a36Sopenharmony_ci			      struct ieee80211_twt_setup *twt);
462062306a36Sopenharmony_ci	void (*twt_teardown_request)(struct ieee80211_hw *hw,
462162306a36Sopenharmony_ci				     struct ieee80211_sta *sta, u8 flowid);
462262306a36Sopenharmony_ci	int (*set_radar_background)(struct ieee80211_hw *hw,
462362306a36Sopenharmony_ci				    struct cfg80211_chan_def *chandef);
462462306a36Sopenharmony_ci	int (*net_fill_forward_path)(struct ieee80211_hw *hw,
462562306a36Sopenharmony_ci				     struct ieee80211_vif *vif,
462662306a36Sopenharmony_ci				     struct ieee80211_sta *sta,
462762306a36Sopenharmony_ci				     struct net_device_path_ctx *ctx,
462862306a36Sopenharmony_ci				     struct net_device_path *path);
462962306a36Sopenharmony_ci	int (*change_vif_links)(struct ieee80211_hw *hw,
463062306a36Sopenharmony_ci				struct ieee80211_vif *vif,
463162306a36Sopenharmony_ci				u16 old_links, u16 new_links,
463262306a36Sopenharmony_ci				struct ieee80211_bss_conf *old[IEEE80211_MLD_MAX_NUM_LINKS]);
463362306a36Sopenharmony_ci	int (*change_sta_links)(struct ieee80211_hw *hw,
463462306a36Sopenharmony_ci				struct ieee80211_vif *vif,
463562306a36Sopenharmony_ci				struct ieee80211_sta *sta,
463662306a36Sopenharmony_ci				u16 old_links, u16 new_links);
463762306a36Sopenharmony_ci	int (*set_hw_timestamp)(struct ieee80211_hw *hw,
463862306a36Sopenharmony_ci				struct ieee80211_vif *vif,
463962306a36Sopenharmony_ci				struct cfg80211_set_hw_timestamp *hwts);
464062306a36Sopenharmony_ci	int (*net_setup_tc)(struct ieee80211_hw *hw,
464162306a36Sopenharmony_ci			    struct ieee80211_vif *vif,
464262306a36Sopenharmony_ci			    struct net_device *dev,
464362306a36Sopenharmony_ci			    enum tc_setup_type type,
464462306a36Sopenharmony_ci			    void *type_data);
464562306a36Sopenharmony_ci};
464662306a36Sopenharmony_ci
464762306a36Sopenharmony_ci/**
464862306a36Sopenharmony_ci * ieee80211_alloc_hw_nm - Allocate a new hardware device
464962306a36Sopenharmony_ci *
465062306a36Sopenharmony_ci * This must be called once for each hardware device. The returned pointer
465162306a36Sopenharmony_ci * must be used to refer to this device when calling other functions.
465262306a36Sopenharmony_ci * mac80211 allocates a private data area for the driver pointed to by
465362306a36Sopenharmony_ci * @priv in &struct ieee80211_hw, the size of this area is given as
465462306a36Sopenharmony_ci * @priv_data_len.
465562306a36Sopenharmony_ci *
465662306a36Sopenharmony_ci * @priv_data_len: length of private data
465762306a36Sopenharmony_ci * @ops: callbacks for this device
465862306a36Sopenharmony_ci * @requested_name: Requested name for this device.
465962306a36Sopenharmony_ci *	NULL is valid value, and means use the default naming (phy%d)
466062306a36Sopenharmony_ci *
466162306a36Sopenharmony_ci * Return: A pointer to the new hardware device, or %NULL on error.
466262306a36Sopenharmony_ci */
466362306a36Sopenharmony_cistruct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
466462306a36Sopenharmony_ci					   const struct ieee80211_ops *ops,
466562306a36Sopenharmony_ci					   const char *requested_name);
466662306a36Sopenharmony_ci
466762306a36Sopenharmony_ci/**
466862306a36Sopenharmony_ci * ieee80211_alloc_hw - Allocate a new hardware device
466962306a36Sopenharmony_ci *
467062306a36Sopenharmony_ci * This must be called once for each hardware device. The returned pointer
467162306a36Sopenharmony_ci * must be used to refer to this device when calling other functions.
467262306a36Sopenharmony_ci * mac80211 allocates a private data area for the driver pointed to by
467362306a36Sopenharmony_ci * @priv in &struct ieee80211_hw, the size of this area is given as
467462306a36Sopenharmony_ci * @priv_data_len.
467562306a36Sopenharmony_ci *
467662306a36Sopenharmony_ci * @priv_data_len: length of private data
467762306a36Sopenharmony_ci * @ops: callbacks for this device
467862306a36Sopenharmony_ci *
467962306a36Sopenharmony_ci * Return: A pointer to the new hardware device, or %NULL on error.
468062306a36Sopenharmony_ci */
468162306a36Sopenharmony_cistatic inline
468262306a36Sopenharmony_cistruct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
468362306a36Sopenharmony_ci					const struct ieee80211_ops *ops)
468462306a36Sopenharmony_ci{
468562306a36Sopenharmony_ci	return ieee80211_alloc_hw_nm(priv_data_len, ops, NULL);
468662306a36Sopenharmony_ci}
468762306a36Sopenharmony_ci
468862306a36Sopenharmony_ci/**
468962306a36Sopenharmony_ci * ieee80211_register_hw - Register hardware device
469062306a36Sopenharmony_ci *
469162306a36Sopenharmony_ci * You must call this function before any other functions in
469262306a36Sopenharmony_ci * mac80211. Note that before a hardware can be registered, you
469362306a36Sopenharmony_ci * need to fill the contained wiphy's information.
469462306a36Sopenharmony_ci *
469562306a36Sopenharmony_ci * @hw: the device to register as returned by ieee80211_alloc_hw()
469662306a36Sopenharmony_ci *
469762306a36Sopenharmony_ci * Return: 0 on success. An error code otherwise.
469862306a36Sopenharmony_ci */
469962306a36Sopenharmony_ciint ieee80211_register_hw(struct ieee80211_hw *hw);
470062306a36Sopenharmony_ci
470162306a36Sopenharmony_ci/**
470262306a36Sopenharmony_ci * struct ieee80211_tpt_blink - throughput blink description
470362306a36Sopenharmony_ci * @throughput: throughput in Kbit/sec
470462306a36Sopenharmony_ci * @blink_time: blink time in milliseconds
470562306a36Sopenharmony_ci *	(full cycle, ie. one off + one on period)
470662306a36Sopenharmony_ci */
470762306a36Sopenharmony_cistruct ieee80211_tpt_blink {
470862306a36Sopenharmony_ci	int throughput;
470962306a36Sopenharmony_ci	int blink_time;
471062306a36Sopenharmony_ci};
471162306a36Sopenharmony_ci
471262306a36Sopenharmony_ci/**
471362306a36Sopenharmony_ci * enum ieee80211_tpt_led_trigger_flags - throughput trigger flags
471462306a36Sopenharmony_ci * @IEEE80211_TPT_LEDTRIG_FL_RADIO: enable blinking with radio
471562306a36Sopenharmony_ci * @IEEE80211_TPT_LEDTRIG_FL_WORK: enable blinking when working
471662306a36Sopenharmony_ci * @IEEE80211_TPT_LEDTRIG_FL_CONNECTED: enable blinking when at least one
471762306a36Sopenharmony_ci *	interface is connected in some way, including being an AP
471862306a36Sopenharmony_ci */
471962306a36Sopenharmony_cienum ieee80211_tpt_led_trigger_flags {
472062306a36Sopenharmony_ci	IEEE80211_TPT_LEDTRIG_FL_RADIO		= BIT(0),
472162306a36Sopenharmony_ci	IEEE80211_TPT_LEDTRIG_FL_WORK		= BIT(1),
472262306a36Sopenharmony_ci	IEEE80211_TPT_LEDTRIG_FL_CONNECTED	= BIT(2),
472362306a36Sopenharmony_ci};
472462306a36Sopenharmony_ci
472562306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_LEDS
472662306a36Sopenharmony_ciconst char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw);
472762306a36Sopenharmony_ciconst char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw);
472862306a36Sopenharmony_ciconst char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw);
472962306a36Sopenharmony_ciconst char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw);
473062306a36Sopenharmony_ciconst char *
473162306a36Sopenharmony_ci__ieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw,
473262306a36Sopenharmony_ci				   unsigned int flags,
473362306a36Sopenharmony_ci				   const struct ieee80211_tpt_blink *blink_table,
473462306a36Sopenharmony_ci				   unsigned int blink_table_len);
473562306a36Sopenharmony_ci#endif
473662306a36Sopenharmony_ci/**
473762306a36Sopenharmony_ci * ieee80211_get_tx_led_name - get name of TX LED
473862306a36Sopenharmony_ci *
473962306a36Sopenharmony_ci * mac80211 creates a transmit LED trigger for each wireless hardware
474062306a36Sopenharmony_ci * that can be used to drive LEDs if your driver registers a LED device.
474162306a36Sopenharmony_ci * This function returns the name (or %NULL if not configured for LEDs)
474262306a36Sopenharmony_ci * of the trigger so you can automatically link the LED device.
474362306a36Sopenharmony_ci *
474462306a36Sopenharmony_ci * @hw: the hardware to get the LED trigger name for
474562306a36Sopenharmony_ci *
474662306a36Sopenharmony_ci * Return: The name of the LED trigger. %NULL if not configured for LEDs.
474762306a36Sopenharmony_ci */
474862306a36Sopenharmony_cistatic inline const char *ieee80211_get_tx_led_name(struct ieee80211_hw *hw)
474962306a36Sopenharmony_ci{
475062306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_LEDS
475162306a36Sopenharmony_ci	return __ieee80211_get_tx_led_name(hw);
475262306a36Sopenharmony_ci#else
475362306a36Sopenharmony_ci	return NULL;
475462306a36Sopenharmony_ci#endif
475562306a36Sopenharmony_ci}
475662306a36Sopenharmony_ci
475762306a36Sopenharmony_ci/**
475862306a36Sopenharmony_ci * ieee80211_get_rx_led_name - get name of RX LED
475962306a36Sopenharmony_ci *
476062306a36Sopenharmony_ci * mac80211 creates a receive LED trigger for each wireless hardware
476162306a36Sopenharmony_ci * that can be used to drive LEDs if your driver registers a LED device.
476262306a36Sopenharmony_ci * This function returns the name (or %NULL if not configured for LEDs)
476362306a36Sopenharmony_ci * of the trigger so you can automatically link the LED device.
476462306a36Sopenharmony_ci *
476562306a36Sopenharmony_ci * @hw: the hardware to get the LED trigger name for
476662306a36Sopenharmony_ci *
476762306a36Sopenharmony_ci * Return: The name of the LED trigger. %NULL if not configured for LEDs.
476862306a36Sopenharmony_ci */
476962306a36Sopenharmony_cistatic inline const char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw)
477062306a36Sopenharmony_ci{
477162306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_LEDS
477262306a36Sopenharmony_ci	return __ieee80211_get_rx_led_name(hw);
477362306a36Sopenharmony_ci#else
477462306a36Sopenharmony_ci	return NULL;
477562306a36Sopenharmony_ci#endif
477662306a36Sopenharmony_ci}
477762306a36Sopenharmony_ci
477862306a36Sopenharmony_ci/**
477962306a36Sopenharmony_ci * ieee80211_get_assoc_led_name - get name of association LED
478062306a36Sopenharmony_ci *
478162306a36Sopenharmony_ci * mac80211 creates a association LED trigger for each wireless hardware
478262306a36Sopenharmony_ci * that can be used to drive LEDs if your driver registers a LED device.
478362306a36Sopenharmony_ci * This function returns the name (or %NULL if not configured for LEDs)
478462306a36Sopenharmony_ci * of the trigger so you can automatically link the LED device.
478562306a36Sopenharmony_ci *
478662306a36Sopenharmony_ci * @hw: the hardware to get the LED trigger name for
478762306a36Sopenharmony_ci *
478862306a36Sopenharmony_ci * Return: The name of the LED trigger. %NULL if not configured for LEDs.
478962306a36Sopenharmony_ci */
479062306a36Sopenharmony_cistatic inline const char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw)
479162306a36Sopenharmony_ci{
479262306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_LEDS
479362306a36Sopenharmony_ci	return __ieee80211_get_assoc_led_name(hw);
479462306a36Sopenharmony_ci#else
479562306a36Sopenharmony_ci	return NULL;
479662306a36Sopenharmony_ci#endif
479762306a36Sopenharmony_ci}
479862306a36Sopenharmony_ci
479962306a36Sopenharmony_ci/**
480062306a36Sopenharmony_ci * ieee80211_get_radio_led_name - get name of radio LED
480162306a36Sopenharmony_ci *
480262306a36Sopenharmony_ci * mac80211 creates a radio change LED trigger for each wireless hardware
480362306a36Sopenharmony_ci * that can be used to drive LEDs if your driver registers a LED device.
480462306a36Sopenharmony_ci * This function returns the name (or %NULL if not configured for LEDs)
480562306a36Sopenharmony_ci * of the trigger so you can automatically link the LED device.
480662306a36Sopenharmony_ci *
480762306a36Sopenharmony_ci * @hw: the hardware to get the LED trigger name for
480862306a36Sopenharmony_ci *
480962306a36Sopenharmony_ci * Return: The name of the LED trigger. %NULL if not configured for LEDs.
481062306a36Sopenharmony_ci */
481162306a36Sopenharmony_cistatic inline const char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
481262306a36Sopenharmony_ci{
481362306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_LEDS
481462306a36Sopenharmony_ci	return __ieee80211_get_radio_led_name(hw);
481562306a36Sopenharmony_ci#else
481662306a36Sopenharmony_ci	return NULL;
481762306a36Sopenharmony_ci#endif
481862306a36Sopenharmony_ci}
481962306a36Sopenharmony_ci
482062306a36Sopenharmony_ci/**
482162306a36Sopenharmony_ci * ieee80211_create_tpt_led_trigger - create throughput LED trigger
482262306a36Sopenharmony_ci * @hw: the hardware to create the trigger for
482362306a36Sopenharmony_ci * @flags: trigger flags, see &enum ieee80211_tpt_led_trigger_flags
482462306a36Sopenharmony_ci * @blink_table: the blink table -- needs to be ordered by throughput
482562306a36Sopenharmony_ci * @blink_table_len: size of the blink table
482662306a36Sopenharmony_ci *
482762306a36Sopenharmony_ci * Return: %NULL (in case of error, or if no LED triggers are
482862306a36Sopenharmony_ci * configured) or the name of the new trigger.
482962306a36Sopenharmony_ci *
483062306a36Sopenharmony_ci * Note: This function must be called before ieee80211_register_hw().
483162306a36Sopenharmony_ci */
483262306a36Sopenharmony_cistatic inline const char *
483362306a36Sopenharmony_ciieee80211_create_tpt_led_trigger(struct ieee80211_hw *hw, unsigned int flags,
483462306a36Sopenharmony_ci				 const struct ieee80211_tpt_blink *blink_table,
483562306a36Sopenharmony_ci				 unsigned int blink_table_len)
483662306a36Sopenharmony_ci{
483762306a36Sopenharmony_ci#ifdef CONFIG_MAC80211_LEDS
483862306a36Sopenharmony_ci	return __ieee80211_create_tpt_led_trigger(hw, flags, blink_table,
483962306a36Sopenharmony_ci						  blink_table_len);
484062306a36Sopenharmony_ci#else
484162306a36Sopenharmony_ci	return NULL;
484262306a36Sopenharmony_ci#endif
484362306a36Sopenharmony_ci}
484462306a36Sopenharmony_ci
484562306a36Sopenharmony_ci/**
484662306a36Sopenharmony_ci * ieee80211_unregister_hw - Unregister a hardware device
484762306a36Sopenharmony_ci *
484862306a36Sopenharmony_ci * This function instructs mac80211 to free allocated resources
484962306a36Sopenharmony_ci * and unregister netdevices from the networking subsystem.
485062306a36Sopenharmony_ci *
485162306a36Sopenharmony_ci * @hw: the hardware to unregister
485262306a36Sopenharmony_ci */
485362306a36Sopenharmony_civoid ieee80211_unregister_hw(struct ieee80211_hw *hw);
485462306a36Sopenharmony_ci
485562306a36Sopenharmony_ci/**
485662306a36Sopenharmony_ci * ieee80211_free_hw - free hardware descriptor
485762306a36Sopenharmony_ci *
485862306a36Sopenharmony_ci * This function frees everything that was allocated, including the
485962306a36Sopenharmony_ci * private data for the driver. You must call ieee80211_unregister_hw()
486062306a36Sopenharmony_ci * before calling this function.
486162306a36Sopenharmony_ci *
486262306a36Sopenharmony_ci * @hw: the hardware to free
486362306a36Sopenharmony_ci */
486462306a36Sopenharmony_civoid ieee80211_free_hw(struct ieee80211_hw *hw);
486562306a36Sopenharmony_ci
486662306a36Sopenharmony_ci/**
486762306a36Sopenharmony_ci * ieee80211_restart_hw - restart hardware completely
486862306a36Sopenharmony_ci *
486962306a36Sopenharmony_ci * Call this function when the hardware was restarted for some reason
487062306a36Sopenharmony_ci * (hardware error, ...) and the driver is unable to restore its state
487162306a36Sopenharmony_ci * by itself. mac80211 assumes that at this point the driver/hardware
487262306a36Sopenharmony_ci * is completely uninitialised and stopped, it starts the process by
487362306a36Sopenharmony_ci * calling the ->start() operation. The driver will need to reset all
487462306a36Sopenharmony_ci * internal state that it has prior to calling this function.
487562306a36Sopenharmony_ci *
487662306a36Sopenharmony_ci * @hw: the hardware to restart
487762306a36Sopenharmony_ci */
487862306a36Sopenharmony_civoid ieee80211_restart_hw(struct ieee80211_hw *hw);
487962306a36Sopenharmony_ci
488062306a36Sopenharmony_ci/**
488162306a36Sopenharmony_ci * ieee80211_rx_list - receive frame and store processed skbs in a list
488262306a36Sopenharmony_ci *
488362306a36Sopenharmony_ci * Use this function to hand received frames to mac80211. The receive
488462306a36Sopenharmony_ci * buffer in @skb must start with an IEEE 802.11 header. In case of a
488562306a36Sopenharmony_ci * paged @skb is used, the driver is recommended to put the ieee80211
488662306a36Sopenharmony_ci * header of the frame on the linear part of the @skb to avoid memory
488762306a36Sopenharmony_ci * allocation and/or memcpy by the stack.
488862306a36Sopenharmony_ci *
488962306a36Sopenharmony_ci * This function may not be called in IRQ context. Calls to this function
489062306a36Sopenharmony_ci * for a single hardware must be synchronized against each other. Calls to
489162306a36Sopenharmony_ci * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
489262306a36Sopenharmony_ci * mixed for a single hardware. Must not run concurrently with
489362306a36Sopenharmony_ci * ieee80211_tx_status() or ieee80211_tx_status_ni().
489462306a36Sopenharmony_ci *
489562306a36Sopenharmony_ci * This function must be called with BHs disabled and RCU read lock
489662306a36Sopenharmony_ci *
489762306a36Sopenharmony_ci * @hw: the hardware this frame came in on
489862306a36Sopenharmony_ci * @sta: the station the frame was received from, or %NULL
489962306a36Sopenharmony_ci * @skb: the buffer to receive, owned by mac80211 after this call
490062306a36Sopenharmony_ci * @list: the destination list
490162306a36Sopenharmony_ci */
490262306a36Sopenharmony_civoid ieee80211_rx_list(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
490362306a36Sopenharmony_ci		       struct sk_buff *skb, struct list_head *list);
490462306a36Sopenharmony_ci
490562306a36Sopenharmony_ci/**
490662306a36Sopenharmony_ci * ieee80211_rx_napi - receive frame from NAPI context
490762306a36Sopenharmony_ci *
490862306a36Sopenharmony_ci * Use this function to hand received frames to mac80211. The receive
490962306a36Sopenharmony_ci * buffer in @skb must start with an IEEE 802.11 header. In case of a
491062306a36Sopenharmony_ci * paged @skb is used, the driver is recommended to put the ieee80211
491162306a36Sopenharmony_ci * header of the frame on the linear part of the @skb to avoid memory
491262306a36Sopenharmony_ci * allocation and/or memcpy by the stack.
491362306a36Sopenharmony_ci *
491462306a36Sopenharmony_ci * This function may not be called in IRQ context. Calls to this function
491562306a36Sopenharmony_ci * for a single hardware must be synchronized against each other. Calls to
491662306a36Sopenharmony_ci * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
491762306a36Sopenharmony_ci * mixed for a single hardware. Must not run concurrently with
491862306a36Sopenharmony_ci * ieee80211_tx_status() or ieee80211_tx_status_ni().
491962306a36Sopenharmony_ci *
492062306a36Sopenharmony_ci * This function must be called with BHs disabled.
492162306a36Sopenharmony_ci *
492262306a36Sopenharmony_ci * @hw: the hardware this frame came in on
492362306a36Sopenharmony_ci * @sta: the station the frame was received from, or %NULL
492462306a36Sopenharmony_ci * @skb: the buffer to receive, owned by mac80211 after this call
492562306a36Sopenharmony_ci * @napi: the NAPI context
492662306a36Sopenharmony_ci */
492762306a36Sopenharmony_civoid ieee80211_rx_napi(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
492862306a36Sopenharmony_ci		       struct sk_buff *skb, struct napi_struct *napi);
492962306a36Sopenharmony_ci
493062306a36Sopenharmony_ci/**
493162306a36Sopenharmony_ci * ieee80211_rx - receive frame
493262306a36Sopenharmony_ci *
493362306a36Sopenharmony_ci * Use this function to hand received frames to mac80211. The receive
493462306a36Sopenharmony_ci * buffer in @skb must start with an IEEE 802.11 header. In case of a
493562306a36Sopenharmony_ci * paged @skb is used, the driver is recommended to put the ieee80211
493662306a36Sopenharmony_ci * header of the frame on the linear part of the @skb to avoid memory
493762306a36Sopenharmony_ci * allocation and/or memcpy by the stack.
493862306a36Sopenharmony_ci *
493962306a36Sopenharmony_ci * This function may not be called in IRQ context. Calls to this function
494062306a36Sopenharmony_ci * for a single hardware must be synchronized against each other. Calls to
494162306a36Sopenharmony_ci * this function, ieee80211_rx_ni() and ieee80211_rx_irqsafe() may not be
494262306a36Sopenharmony_ci * mixed for a single hardware. Must not run concurrently with
494362306a36Sopenharmony_ci * ieee80211_tx_status() or ieee80211_tx_status_ni().
494462306a36Sopenharmony_ci *
494562306a36Sopenharmony_ci * In process context use instead ieee80211_rx_ni().
494662306a36Sopenharmony_ci *
494762306a36Sopenharmony_ci * @hw: the hardware this frame came in on
494862306a36Sopenharmony_ci * @skb: the buffer to receive, owned by mac80211 after this call
494962306a36Sopenharmony_ci */
495062306a36Sopenharmony_cistatic inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
495162306a36Sopenharmony_ci{
495262306a36Sopenharmony_ci	ieee80211_rx_napi(hw, NULL, skb, NULL);
495362306a36Sopenharmony_ci}
495462306a36Sopenharmony_ci
495562306a36Sopenharmony_ci/**
495662306a36Sopenharmony_ci * ieee80211_rx_irqsafe - receive frame
495762306a36Sopenharmony_ci *
495862306a36Sopenharmony_ci * Like ieee80211_rx() but can be called in IRQ context
495962306a36Sopenharmony_ci * (internally defers to a tasklet.)
496062306a36Sopenharmony_ci *
496162306a36Sopenharmony_ci * Calls to this function, ieee80211_rx() or ieee80211_rx_ni() may not
496262306a36Sopenharmony_ci * be mixed for a single hardware.Must not run concurrently with
496362306a36Sopenharmony_ci * ieee80211_tx_status() or ieee80211_tx_status_ni().
496462306a36Sopenharmony_ci *
496562306a36Sopenharmony_ci * @hw: the hardware this frame came in on
496662306a36Sopenharmony_ci * @skb: the buffer to receive, owned by mac80211 after this call
496762306a36Sopenharmony_ci */
496862306a36Sopenharmony_civoid ieee80211_rx_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb);
496962306a36Sopenharmony_ci
497062306a36Sopenharmony_ci/**
497162306a36Sopenharmony_ci * ieee80211_rx_ni - receive frame (in process context)
497262306a36Sopenharmony_ci *
497362306a36Sopenharmony_ci * Like ieee80211_rx() but can be called in process context
497462306a36Sopenharmony_ci * (internally disables bottom halves).
497562306a36Sopenharmony_ci *
497662306a36Sopenharmony_ci * Calls to this function, ieee80211_rx() and ieee80211_rx_irqsafe() may
497762306a36Sopenharmony_ci * not be mixed for a single hardware. Must not run concurrently with
497862306a36Sopenharmony_ci * ieee80211_tx_status() or ieee80211_tx_status_ni().
497962306a36Sopenharmony_ci *
498062306a36Sopenharmony_ci * @hw: the hardware this frame came in on
498162306a36Sopenharmony_ci * @skb: the buffer to receive, owned by mac80211 after this call
498262306a36Sopenharmony_ci */
498362306a36Sopenharmony_cistatic inline void ieee80211_rx_ni(struct ieee80211_hw *hw,
498462306a36Sopenharmony_ci				   struct sk_buff *skb)
498562306a36Sopenharmony_ci{
498662306a36Sopenharmony_ci	local_bh_disable();
498762306a36Sopenharmony_ci	ieee80211_rx(hw, skb);
498862306a36Sopenharmony_ci	local_bh_enable();
498962306a36Sopenharmony_ci}
499062306a36Sopenharmony_ci
499162306a36Sopenharmony_ci/**
499262306a36Sopenharmony_ci * ieee80211_sta_ps_transition - PS transition for connected sta
499362306a36Sopenharmony_ci *
499462306a36Sopenharmony_ci * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS
499562306a36Sopenharmony_ci * flag set, use this function to inform mac80211 about a connected station
499662306a36Sopenharmony_ci * entering/leaving PS mode.
499762306a36Sopenharmony_ci *
499862306a36Sopenharmony_ci * This function may not be called in IRQ context or with softirqs enabled.
499962306a36Sopenharmony_ci *
500062306a36Sopenharmony_ci * Calls to this function for a single hardware must be synchronized against
500162306a36Sopenharmony_ci * each other.
500262306a36Sopenharmony_ci *
500362306a36Sopenharmony_ci * @sta: currently connected sta
500462306a36Sopenharmony_ci * @start: start or stop PS
500562306a36Sopenharmony_ci *
500662306a36Sopenharmony_ci * Return: 0 on success. -EINVAL when the requested PS mode is already set.
500762306a36Sopenharmony_ci */
500862306a36Sopenharmony_ciint ieee80211_sta_ps_transition(struct ieee80211_sta *sta, bool start);
500962306a36Sopenharmony_ci
501062306a36Sopenharmony_ci/**
501162306a36Sopenharmony_ci * ieee80211_sta_ps_transition_ni - PS transition for connected sta
501262306a36Sopenharmony_ci *                                  (in process context)
501362306a36Sopenharmony_ci *
501462306a36Sopenharmony_ci * Like ieee80211_sta_ps_transition() but can be called in process context
501562306a36Sopenharmony_ci * (internally disables bottom halves). Concurrent call restriction still
501662306a36Sopenharmony_ci * applies.
501762306a36Sopenharmony_ci *
501862306a36Sopenharmony_ci * @sta: currently connected sta
501962306a36Sopenharmony_ci * @start: start or stop PS
502062306a36Sopenharmony_ci *
502162306a36Sopenharmony_ci * Return: Like ieee80211_sta_ps_transition().
502262306a36Sopenharmony_ci */
502362306a36Sopenharmony_cistatic inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta,
502462306a36Sopenharmony_ci						  bool start)
502562306a36Sopenharmony_ci{
502662306a36Sopenharmony_ci	int ret;
502762306a36Sopenharmony_ci
502862306a36Sopenharmony_ci	local_bh_disable();
502962306a36Sopenharmony_ci	ret = ieee80211_sta_ps_transition(sta, start);
503062306a36Sopenharmony_ci	local_bh_enable();
503162306a36Sopenharmony_ci
503262306a36Sopenharmony_ci	return ret;
503362306a36Sopenharmony_ci}
503462306a36Sopenharmony_ci
503562306a36Sopenharmony_ci/**
503662306a36Sopenharmony_ci * ieee80211_sta_pspoll - PS-Poll frame received
503762306a36Sopenharmony_ci * @sta: currently connected station
503862306a36Sopenharmony_ci *
503962306a36Sopenharmony_ci * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS flag set,
504062306a36Sopenharmony_ci * use this function to inform mac80211 that a PS-Poll frame from a
504162306a36Sopenharmony_ci * connected station was received.
504262306a36Sopenharmony_ci * This must be used in conjunction with ieee80211_sta_ps_transition()
504362306a36Sopenharmony_ci * and possibly ieee80211_sta_uapsd_trigger(); calls to all three must
504462306a36Sopenharmony_ci * be serialized.
504562306a36Sopenharmony_ci */
504662306a36Sopenharmony_civoid ieee80211_sta_pspoll(struct ieee80211_sta *sta);
504762306a36Sopenharmony_ci
504862306a36Sopenharmony_ci/**
504962306a36Sopenharmony_ci * ieee80211_sta_uapsd_trigger - (potential) U-APSD trigger frame received
505062306a36Sopenharmony_ci * @sta: currently connected station
505162306a36Sopenharmony_ci * @tid: TID of the received (potential) trigger frame
505262306a36Sopenharmony_ci *
505362306a36Sopenharmony_ci * When operating in AP mode with the %IEEE80211_HW_AP_LINK_PS flag set,
505462306a36Sopenharmony_ci * use this function to inform mac80211 that a (potential) trigger frame
505562306a36Sopenharmony_ci * from a connected station was received.
505662306a36Sopenharmony_ci * This must be used in conjunction with ieee80211_sta_ps_transition()
505762306a36Sopenharmony_ci * and possibly ieee80211_sta_pspoll(); calls to all three must be
505862306a36Sopenharmony_ci * serialized.
505962306a36Sopenharmony_ci * %IEEE80211_NUM_TIDS can be passed as the tid if the tid is unknown.
506062306a36Sopenharmony_ci * In this case, mac80211 will not check that this tid maps to an AC
506162306a36Sopenharmony_ci * that is trigger enabled and assume that the caller did the proper
506262306a36Sopenharmony_ci * checks.
506362306a36Sopenharmony_ci */
506462306a36Sopenharmony_civoid ieee80211_sta_uapsd_trigger(struct ieee80211_sta *sta, u8 tid);
506562306a36Sopenharmony_ci
506662306a36Sopenharmony_ci/*
506762306a36Sopenharmony_ci * The TX headroom reserved by mac80211 for its own tx_status functions.
506862306a36Sopenharmony_ci * This is enough for the radiotap header.
506962306a36Sopenharmony_ci */
507062306a36Sopenharmony_ci#define IEEE80211_TX_STATUS_HEADROOM	ALIGN(14, 4)
507162306a36Sopenharmony_ci
507262306a36Sopenharmony_ci/**
507362306a36Sopenharmony_ci * ieee80211_sta_set_buffered - inform mac80211 about driver-buffered frames
507462306a36Sopenharmony_ci * @sta: &struct ieee80211_sta pointer for the sleeping station
507562306a36Sopenharmony_ci * @tid: the TID that has buffered frames
507662306a36Sopenharmony_ci * @buffered: indicates whether or not frames are buffered for this TID
507762306a36Sopenharmony_ci *
507862306a36Sopenharmony_ci * If a driver buffers frames for a powersave station instead of passing
507962306a36Sopenharmony_ci * them back to mac80211 for retransmission, the station may still need
508062306a36Sopenharmony_ci * to be told that there are buffered frames via the TIM bit.
508162306a36Sopenharmony_ci *
508262306a36Sopenharmony_ci * This function informs mac80211 whether or not there are frames that are
508362306a36Sopenharmony_ci * buffered in the driver for a given TID; mac80211 can then use this data
508462306a36Sopenharmony_ci * to set the TIM bit (NOTE: This may call back into the driver's set_tim
508562306a36Sopenharmony_ci * call! Beware of the locking!)
508662306a36Sopenharmony_ci *
508762306a36Sopenharmony_ci * If all frames are released to the station (due to PS-poll or uAPSD)
508862306a36Sopenharmony_ci * then the driver needs to inform mac80211 that there no longer are
508962306a36Sopenharmony_ci * frames buffered. However, when the station wakes up mac80211 assumes
509062306a36Sopenharmony_ci * that all buffered frames will be transmitted and clears this data,
509162306a36Sopenharmony_ci * drivers need to make sure they inform mac80211 about all buffered
509262306a36Sopenharmony_ci * frames on the sleep transition (sta_notify() with %STA_NOTIFY_SLEEP).
509362306a36Sopenharmony_ci *
509462306a36Sopenharmony_ci * Note that technically mac80211 only needs to know this per AC, not per
509562306a36Sopenharmony_ci * TID, but since driver buffering will inevitably happen per TID (since
509662306a36Sopenharmony_ci * it is related to aggregation) it is easier to make mac80211 map the
509762306a36Sopenharmony_ci * TID to the AC as required instead of keeping track in all drivers that
509862306a36Sopenharmony_ci * use this API.
509962306a36Sopenharmony_ci */
510062306a36Sopenharmony_civoid ieee80211_sta_set_buffered(struct ieee80211_sta *sta,
510162306a36Sopenharmony_ci				u8 tid, bool buffered);
510262306a36Sopenharmony_ci
510362306a36Sopenharmony_ci/**
510462306a36Sopenharmony_ci * ieee80211_get_tx_rates - get the selected transmit rates for a packet
510562306a36Sopenharmony_ci *
510662306a36Sopenharmony_ci * Call this function in a driver with per-packet rate selection support
510762306a36Sopenharmony_ci * to combine the rate info in the packet tx info with the most recent
510862306a36Sopenharmony_ci * rate selection table for the station entry.
510962306a36Sopenharmony_ci *
511062306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
511162306a36Sopenharmony_ci * @sta: the receiver station to which this packet is sent.
511262306a36Sopenharmony_ci * @skb: the frame to be transmitted.
511362306a36Sopenharmony_ci * @dest: buffer for extracted rate/retry information
511462306a36Sopenharmony_ci * @max_rates: maximum number of rates to fetch
511562306a36Sopenharmony_ci */
511662306a36Sopenharmony_civoid ieee80211_get_tx_rates(struct ieee80211_vif *vif,
511762306a36Sopenharmony_ci			    struct ieee80211_sta *sta,
511862306a36Sopenharmony_ci			    struct sk_buff *skb,
511962306a36Sopenharmony_ci			    struct ieee80211_tx_rate *dest,
512062306a36Sopenharmony_ci			    int max_rates);
512162306a36Sopenharmony_ci
512262306a36Sopenharmony_ci/**
512362306a36Sopenharmony_ci * ieee80211_sta_set_expected_throughput - set the expected tpt for a station
512462306a36Sopenharmony_ci *
512562306a36Sopenharmony_ci * Call this function to notify mac80211 about a change in expected throughput
512662306a36Sopenharmony_ci * to a station. A driver for a device that does rate control in firmware can
512762306a36Sopenharmony_ci * call this function when the expected throughput estimate towards a station
512862306a36Sopenharmony_ci * changes. The information is used to tune the CoDel AQM applied to traffic
512962306a36Sopenharmony_ci * going towards that station (which can otherwise be too aggressive and cause
513062306a36Sopenharmony_ci * slow stations to starve).
513162306a36Sopenharmony_ci *
513262306a36Sopenharmony_ci * @pubsta: the station to set throughput for.
513362306a36Sopenharmony_ci * @thr: the current expected throughput in kbps.
513462306a36Sopenharmony_ci */
513562306a36Sopenharmony_civoid ieee80211_sta_set_expected_throughput(struct ieee80211_sta *pubsta,
513662306a36Sopenharmony_ci					   u32 thr);
513762306a36Sopenharmony_ci
513862306a36Sopenharmony_ci/**
513962306a36Sopenharmony_ci * ieee80211_tx_rate_update - transmit rate update callback
514062306a36Sopenharmony_ci *
514162306a36Sopenharmony_ci * Drivers should call this functions with a non-NULL pub sta
514262306a36Sopenharmony_ci * This function can be used in drivers that does not have provision
514362306a36Sopenharmony_ci * in updating the tx rate in data path.
514462306a36Sopenharmony_ci *
514562306a36Sopenharmony_ci * @hw: the hardware the frame was transmitted by
514662306a36Sopenharmony_ci * @pubsta: the station to update the tx rate for.
514762306a36Sopenharmony_ci * @info: tx status information
514862306a36Sopenharmony_ci */
514962306a36Sopenharmony_civoid ieee80211_tx_rate_update(struct ieee80211_hw *hw,
515062306a36Sopenharmony_ci			      struct ieee80211_sta *pubsta,
515162306a36Sopenharmony_ci			      struct ieee80211_tx_info *info);
515262306a36Sopenharmony_ci
515362306a36Sopenharmony_ci/**
515462306a36Sopenharmony_ci * ieee80211_tx_status - transmit status callback
515562306a36Sopenharmony_ci *
515662306a36Sopenharmony_ci * Call this function for all transmitted frames after they have been
515762306a36Sopenharmony_ci * transmitted. It is permissible to not call this function for
515862306a36Sopenharmony_ci * multicast frames but this can affect statistics.
515962306a36Sopenharmony_ci *
516062306a36Sopenharmony_ci * This function may not be called in IRQ context. Calls to this function
516162306a36Sopenharmony_ci * for a single hardware must be synchronized against each other. Calls
516262306a36Sopenharmony_ci * to this function, ieee80211_tx_status_ni() and ieee80211_tx_status_irqsafe()
516362306a36Sopenharmony_ci * may not be mixed for a single hardware. Must not run concurrently with
516462306a36Sopenharmony_ci * ieee80211_rx() or ieee80211_rx_ni().
516562306a36Sopenharmony_ci *
516662306a36Sopenharmony_ci * @hw: the hardware the frame was transmitted by
516762306a36Sopenharmony_ci * @skb: the frame that was transmitted, owned by mac80211 after this call
516862306a36Sopenharmony_ci */
516962306a36Sopenharmony_civoid ieee80211_tx_status(struct ieee80211_hw *hw,
517062306a36Sopenharmony_ci			 struct sk_buff *skb);
517162306a36Sopenharmony_ci
517262306a36Sopenharmony_ci/**
517362306a36Sopenharmony_ci * ieee80211_tx_status_ext - extended transmit status callback
517462306a36Sopenharmony_ci *
517562306a36Sopenharmony_ci * This function can be used as a replacement for ieee80211_tx_status
517662306a36Sopenharmony_ci * in drivers that may want to provide extra information that does not
517762306a36Sopenharmony_ci * fit into &struct ieee80211_tx_info.
517862306a36Sopenharmony_ci *
517962306a36Sopenharmony_ci * Calls to this function for a single hardware must be synchronized
518062306a36Sopenharmony_ci * against each other. Calls to this function, ieee80211_tx_status_ni()
518162306a36Sopenharmony_ci * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware.
518262306a36Sopenharmony_ci *
518362306a36Sopenharmony_ci * @hw: the hardware the frame was transmitted by
518462306a36Sopenharmony_ci * @status: tx status information
518562306a36Sopenharmony_ci */
518662306a36Sopenharmony_civoid ieee80211_tx_status_ext(struct ieee80211_hw *hw,
518762306a36Sopenharmony_ci			     struct ieee80211_tx_status *status);
518862306a36Sopenharmony_ci
518962306a36Sopenharmony_ci/**
519062306a36Sopenharmony_ci * ieee80211_tx_status_noskb - transmit status callback without skb
519162306a36Sopenharmony_ci *
519262306a36Sopenharmony_ci * This function can be used as a replacement for ieee80211_tx_status
519362306a36Sopenharmony_ci * in drivers that cannot reliably map tx status information back to
519462306a36Sopenharmony_ci * specific skbs.
519562306a36Sopenharmony_ci *
519662306a36Sopenharmony_ci * Calls to this function for a single hardware must be synchronized
519762306a36Sopenharmony_ci * against each other. Calls to this function, ieee80211_tx_status_ni()
519862306a36Sopenharmony_ci * and ieee80211_tx_status_irqsafe() may not be mixed for a single hardware.
519962306a36Sopenharmony_ci *
520062306a36Sopenharmony_ci * @hw: the hardware the frame was transmitted by
520162306a36Sopenharmony_ci * @sta: the receiver station to which this packet is sent
520262306a36Sopenharmony_ci *	(NULL for multicast packets)
520362306a36Sopenharmony_ci * @info: tx status information
520462306a36Sopenharmony_ci */
520562306a36Sopenharmony_cistatic inline void ieee80211_tx_status_noskb(struct ieee80211_hw *hw,
520662306a36Sopenharmony_ci					     struct ieee80211_sta *sta,
520762306a36Sopenharmony_ci					     struct ieee80211_tx_info *info)
520862306a36Sopenharmony_ci{
520962306a36Sopenharmony_ci	struct ieee80211_tx_status status = {
521062306a36Sopenharmony_ci		.sta = sta,
521162306a36Sopenharmony_ci		.info = info,
521262306a36Sopenharmony_ci	};
521362306a36Sopenharmony_ci
521462306a36Sopenharmony_ci	ieee80211_tx_status_ext(hw, &status);
521562306a36Sopenharmony_ci}
521662306a36Sopenharmony_ci
521762306a36Sopenharmony_ci/**
521862306a36Sopenharmony_ci * ieee80211_tx_status_ni - transmit status callback (in process context)
521962306a36Sopenharmony_ci *
522062306a36Sopenharmony_ci * Like ieee80211_tx_status() but can be called in process context.
522162306a36Sopenharmony_ci *
522262306a36Sopenharmony_ci * Calls to this function, ieee80211_tx_status() and
522362306a36Sopenharmony_ci * ieee80211_tx_status_irqsafe() may not be mixed
522462306a36Sopenharmony_ci * for a single hardware.
522562306a36Sopenharmony_ci *
522662306a36Sopenharmony_ci * @hw: the hardware the frame was transmitted by
522762306a36Sopenharmony_ci * @skb: the frame that was transmitted, owned by mac80211 after this call
522862306a36Sopenharmony_ci */
522962306a36Sopenharmony_cistatic inline void ieee80211_tx_status_ni(struct ieee80211_hw *hw,
523062306a36Sopenharmony_ci					  struct sk_buff *skb)
523162306a36Sopenharmony_ci{
523262306a36Sopenharmony_ci	local_bh_disable();
523362306a36Sopenharmony_ci	ieee80211_tx_status(hw, skb);
523462306a36Sopenharmony_ci	local_bh_enable();
523562306a36Sopenharmony_ci}
523662306a36Sopenharmony_ci
523762306a36Sopenharmony_ci/**
523862306a36Sopenharmony_ci * ieee80211_tx_status_irqsafe - IRQ-safe transmit status callback
523962306a36Sopenharmony_ci *
524062306a36Sopenharmony_ci * Like ieee80211_tx_status() but can be called in IRQ context
524162306a36Sopenharmony_ci * (internally defers to a tasklet.)
524262306a36Sopenharmony_ci *
524362306a36Sopenharmony_ci * Calls to this function, ieee80211_tx_status() and
524462306a36Sopenharmony_ci * ieee80211_tx_status_ni() may not be mixed for a single hardware.
524562306a36Sopenharmony_ci *
524662306a36Sopenharmony_ci * @hw: the hardware the frame was transmitted by
524762306a36Sopenharmony_ci * @skb: the frame that was transmitted, owned by mac80211 after this call
524862306a36Sopenharmony_ci */
524962306a36Sopenharmony_civoid ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
525062306a36Sopenharmony_ci				 struct sk_buff *skb);
525162306a36Sopenharmony_ci
525262306a36Sopenharmony_ci/**
525362306a36Sopenharmony_ci * ieee80211_report_low_ack - report non-responding station
525462306a36Sopenharmony_ci *
525562306a36Sopenharmony_ci * When operating in AP-mode, call this function to report a non-responding
525662306a36Sopenharmony_ci * connected STA.
525762306a36Sopenharmony_ci *
525862306a36Sopenharmony_ci * @sta: the non-responding connected sta
525962306a36Sopenharmony_ci * @num_packets: number of packets sent to @sta without a response
526062306a36Sopenharmony_ci */
526162306a36Sopenharmony_civoid ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets);
526262306a36Sopenharmony_ci
526362306a36Sopenharmony_ci#define IEEE80211_MAX_CNTDWN_COUNTERS_NUM 2
526462306a36Sopenharmony_ci
526562306a36Sopenharmony_ci/**
526662306a36Sopenharmony_ci * struct ieee80211_mutable_offsets - mutable beacon offsets
526762306a36Sopenharmony_ci * @tim_offset: position of TIM element
526862306a36Sopenharmony_ci * @tim_length: size of TIM element
526962306a36Sopenharmony_ci * @cntdwn_counter_offs: array of IEEE80211_MAX_CNTDWN_COUNTERS_NUM offsets
527062306a36Sopenharmony_ci *	to countdown counters.  This array can contain zero values which
527162306a36Sopenharmony_ci *	should be ignored.
527262306a36Sopenharmony_ci * @mbssid_off: position of the multiple bssid element
527362306a36Sopenharmony_ci */
527462306a36Sopenharmony_cistruct ieee80211_mutable_offsets {
527562306a36Sopenharmony_ci	u16 tim_offset;
527662306a36Sopenharmony_ci	u16 tim_length;
527762306a36Sopenharmony_ci
527862306a36Sopenharmony_ci	u16 cntdwn_counter_offs[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
527962306a36Sopenharmony_ci	u16 mbssid_off;
528062306a36Sopenharmony_ci};
528162306a36Sopenharmony_ci
528262306a36Sopenharmony_ci/**
528362306a36Sopenharmony_ci * ieee80211_beacon_get_template - beacon template generation function
528462306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
528562306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
528662306a36Sopenharmony_ci * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
528762306a36Sopenharmony_ci *	receive the offsets that may be updated by the driver.
528862306a36Sopenharmony_ci * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
528962306a36Sopenharmony_ci *	that is not associated with AP MLD).
529062306a36Sopenharmony_ci *
529162306a36Sopenharmony_ci * If the driver implements beaconing modes, it must use this function to
529262306a36Sopenharmony_ci * obtain the beacon template.
529362306a36Sopenharmony_ci *
529462306a36Sopenharmony_ci * This function should be used if the beacon frames are generated by the
529562306a36Sopenharmony_ci * device, and then the driver must use the returned beacon as the template
529662306a36Sopenharmony_ci * The driver or the device are responsible to update the DTIM and, when
529762306a36Sopenharmony_ci * applicable, the CSA count.
529862306a36Sopenharmony_ci *
529962306a36Sopenharmony_ci * The driver is responsible for freeing the returned skb.
530062306a36Sopenharmony_ci *
530162306a36Sopenharmony_ci * Return: The beacon template. %NULL on error.
530262306a36Sopenharmony_ci */
530362306a36Sopenharmony_cistruct sk_buff *
530462306a36Sopenharmony_ciieee80211_beacon_get_template(struct ieee80211_hw *hw,
530562306a36Sopenharmony_ci			      struct ieee80211_vif *vif,
530662306a36Sopenharmony_ci			      struct ieee80211_mutable_offsets *offs,
530762306a36Sopenharmony_ci			      unsigned int link_id);
530862306a36Sopenharmony_ci
530962306a36Sopenharmony_ci/**
531062306a36Sopenharmony_ci * ieee80211_beacon_get_template_ema_index - EMA beacon template generation
531162306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
531262306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
531362306a36Sopenharmony_ci * @offs: &struct ieee80211_mutable_offsets pointer to struct that will
531462306a36Sopenharmony_ci *	receive the offsets that may be updated by the driver.
531562306a36Sopenharmony_ci * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP).
531662306a36Sopenharmony_ci * @ema_index: index of the beacon in the EMA set.
531762306a36Sopenharmony_ci *
531862306a36Sopenharmony_ci * This function follows the same rules as ieee80211_beacon_get_template()
531962306a36Sopenharmony_ci * but returns a beacon template which includes multiple BSSID element at the
532062306a36Sopenharmony_ci * requested index.
532162306a36Sopenharmony_ci *
532262306a36Sopenharmony_ci * Return: The beacon template. %NULL indicates the end of EMA templates.
532362306a36Sopenharmony_ci */
532462306a36Sopenharmony_cistruct sk_buff *
532562306a36Sopenharmony_ciieee80211_beacon_get_template_ema_index(struct ieee80211_hw *hw,
532662306a36Sopenharmony_ci					struct ieee80211_vif *vif,
532762306a36Sopenharmony_ci					struct ieee80211_mutable_offsets *offs,
532862306a36Sopenharmony_ci					unsigned int link_id, u8 ema_index);
532962306a36Sopenharmony_ci
533062306a36Sopenharmony_ci/**
533162306a36Sopenharmony_ci * struct ieee80211_ema_beacons - List of EMA beacons
533262306a36Sopenharmony_ci * @cnt: count of EMA beacons.
533362306a36Sopenharmony_ci *
533462306a36Sopenharmony_ci * @bcn: array of EMA beacons.
533562306a36Sopenharmony_ci * @bcn.skb: the skb containing this specific beacon
533662306a36Sopenharmony_ci * @bcn.offs: &struct ieee80211_mutable_offsets pointer to struct that will
533762306a36Sopenharmony_ci *	receive the offsets that may be updated by the driver.
533862306a36Sopenharmony_ci */
533962306a36Sopenharmony_cistruct ieee80211_ema_beacons {
534062306a36Sopenharmony_ci	u8 cnt;
534162306a36Sopenharmony_ci	struct {
534262306a36Sopenharmony_ci		struct sk_buff *skb;
534362306a36Sopenharmony_ci		struct ieee80211_mutable_offsets offs;
534462306a36Sopenharmony_ci	} bcn[];
534562306a36Sopenharmony_ci};
534662306a36Sopenharmony_ci
534762306a36Sopenharmony_ci/**
534862306a36Sopenharmony_ci * ieee80211_beacon_get_template_ema_list - EMA beacon template generation
534962306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
535062306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
535162306a36Sopenharmony_ci * @link_id: the link id to which the beacon belongs (or 0 for a non-MLD AP)
535262306a36Sopenharmony_ci *
535362306a36Sopenharmony_ci * This function follows the same rules as ieee80211_beacon_get_template()
535462306a36Sopenharmony_ci * but allocates and returns a pointer to list of all beacon templates required
535562306a36Sopenharmony_ci * to cover all profiles in the multiple BSSID set. Each template includes only
535662306a36Sopenharmony_ci * one multiple BSSID element.
535762306a36Sopenharmony_ci *
535862306a36Sopenharmony_ci * Driver must call ieee80211_beacon_free_ema_list() to free the memory.
535962306a36Sopenharmony_ci *
536062306a36Sopenharmony_ci * Return: EMA beacon templates of type struct ieee80211_ema_beacons *.
536162306a36Sopenharmony_ci *	%NULL on error.
536262306a36Sopenharmony_ci */
536362306a36Sopenharmony_cistruct ieee80211_ema_beacons *
536462306a36Sopenharmony_ciieee80211_beacon_get_template_ema_list(struct ieee80211_hw *hw,
536562306a36Sopenharmony_ci				       struct ieee80211_vif *vif,
536662306a36Sopenharmony_ci				       unsigned int link_id);
536762306a36Sopenharmony_ci
536862306a36Sopenharmony_ci/**
536962306a36Sopenharmony_ci * ieee80211_beacon_free_ema_list - free an EMA beacon template list
537062306a36Sopenharmony_ci * @ema_beacons: list of EMA beacons of type &struct ieee80211_ema_beacons pointers.
537162306a36Sopenharmony_ci *
537262306a36Sopenharmony_ci * This function will free a list previously acquired by calling
537362306a36Sopenharmony_ci * ieee80211_beacon_get_template_ema_list()
537462306a36Sopenharmony_ci */
537562306a36Sopenharmony_civoid ieee80211_beacon_free_ema_list(struct ieee80211_ema_beacons *ema_beacons);
537662306a36Sopenharmony_ci
537762306a36Sopenharmony_ci/**
537862306a36Sopenharmony_ci * ieee80211_beacon_get_tim - beacon generation function
537962306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
538062306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
538162306a36Sopenharmony_ci * @tim_offset: pointer to variable that will receive the TIM IE offset.
538262306a36Sopenharmony_ci *	Set to 0 if invalid (in non-AP modes).
538362306a36Sopenharmony_ci * @tim_length: pointer to variable that will receive the TIM IE length,
538462306a36Sopenharmony_ci *	(including the ID and length bytes!).
538562306a36Sopenharmony_ci *	Set to 0 if invalid (in non-AP modes).
538662306a36Sopenharmony_ci * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
538762306a36Sopenharmony_ci *	that is not associated with AP MLD).
538862306a36Sopenharmony_ci *
538962306a36Sopenharmony_ci * If the driver implements beaconing modes, it must use this function to
539062306a36Sopenharmony_ci * obtain the beacon frame.
539162306a36Sopenharmony_ci *
539262306a36Sopenharmony_ci * If the beacon frames are generated by the host system (i.e., not in
539362306a36Sopenharmony_ci * hardware/firmware), the driver uses this function to get each beacon
539462306a36Sopenharmony_ci * frame from mac80211 -- it is responsible for calling this function exactly
539562306a36Sopenharmony_ci * once before the beacon is needed (e.g. based on hardware interrupt).
539662306a36Sopenharmony_ci *
539762306a36Sopenharmony_ci * The driver is responsible for freeing the returned skb.
539862306a36Sopenharmony_ci *
539962306a36Sopenharmony_ci * Return: The beacon template. %NULL on error.
540062306a36Sopenharmony_ci */
540162306a36Sopenharmony_cistruct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
540262306a36Sopenharmony_ci					 struct ieee80211_vif *vif,
540362306a36Sopenharmony_ci					 u16 *tim_offset, u16 *tim_length,
540462306a36Sopenharmony_ci					 unsigned int link_id);
540562306a36Sopenharmony_ci
540662306a36Sopenharmony_ci/**
540762306a36Sopenharmony_ci * ieee80211_beacon_get - beacon generation function
540862306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
540962306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
541062306a36Sopenharmony_ci * @link_id: the link id to which the beacon belongs (or 0 for an AP STA
541162306a36Sopenharmony_ci *	that is not associated with AP MLD).
541262306a36Sopenharmony_ci *
541362306a36Sopenharmony_ci * See ieee80211_beacon_get_tim().
541462306a36Sopenharmony_ci *
541562306a36Sopenharmony_ci * Return: See ieee80211_beacon_get_tim().
541662306a36Sopenharmony_ci */
541762306a36Sopenharmony_cistatic inline struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw,
541862306a36Sopenharmony_ci						   struct ieee80211_vif *vif,
541962306a36Sopenharmony_ci						   unsigned int link_id)
542062306a36Sopenharmony_ci{
542162306a36Sopenharmony_ci	return ieee80211_beacon_get_tim(hw, vif, NULL, NULL, link_id);
542262306a36Sopenharmony_ci}
542362306a36Sopenharmony_ci
542462306a36Sopenharmony_ci/**
542562306a36Sopenharmony_ci * ieee80211_beacon_update_cntdwn - request mac80211 to decrement the beacon countdown
542662306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
542762306a36Sopenharmony_ci *
542862306a36Sopenharmony_ci * The beacon counter should be updated after each beacon transmission.
542962306a36Sopenharmony_ci * This function is called implicitly when
543062306a36Sopenharmony_ci * ieee80211_beacon_get/ieee80211_beacon_get_tim are called, however if the
543162306a36Sopenharmony_ci * beacon frames are generated by the device, the driver should call this
543262306a36Sopenharmony_ci * function after each beacon transmission to sync mac80211's beacon countdown.
543362306a36Sopenharmony_ci *
543462306a36Sopenharmony_ci * Return: new countdown value
543562306a36Sopenharmony_ci */
543662306a36Sopenharmony_ciu8 ieee80211_beacon_update_cntdwn(struct ieee80211_vif *vif);
543762306a36Sopenharmony_ci
543862306a36Sopenharmony_ci/**
543962306a36Sopenharmony_ci * ieee80211_beacon_set_cntdwn - request mac80211 to set beacon countdown
544062306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
544162306a36Sopenharmony_ci * @counter: the new value for the counter
544262306a36Sopenharmony_ci *
544362306a36Sopenharmony_ci * The beacon countdown can be changed by the device, this API should be
544462306a36Sopenharmony_ci * used by the device driver to update csa counter in mac80211.
544562306a36Sopenharmony_ci *
544662306a36Sopenharmony_ci * It should never be used together with ieee80211_beacon_update_cntdwn(),
544762306a36Sopenharmony_ci * as it will cause a race condition around the counter value.
544862306a36Sopenharmony_ci */
544962306a36Sopenharmony_civoid ieee80211_beacon_set_cntdwn(struct ieee80211_vif *vif, u8 counter);
545062306a36Sopenharmony_ci
545162306a36Sopenharmony_ci/**
545262306a36Sopenharmony_ci * ieee80211_csa_finish - notify mac80211 about channel switch
545362306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
545462306a36Sopenharmony_ci *
545562306a36Sopenharmony_ci * After a channel switch announcement was scheduled and the counter in this
545662306a36Sopenharmony_ci * announcement hits 1, this function must be called by the driver to
545762306a36Sopenharmony_ci * notify mac80211 that the channel can be changed.
545862306a36Sopenharmony_ci */
545962306a36Sopenharmony_civoid ieee80211_csa_finish(struct ieee80211_vif *vif);
546062306a36Sopenharmony_ci
546162306a36Sopenharmony_ci/**
546262306a36Sopenharmony_ci * ieee80211_beacon_cntdwn_is_complete - find out if countdown reached 1
546362306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
546462306a36Sopenharmony_ci *
546562306a36Sopenharmony_ci * This function returns whether the countdown reached zero.
546662306a36Sopenharmony_ci */
546762306a36Sopenharmony_cibool ieee80211_beacon_cntdwn_is_complete(struct ieee80211_vif *vif);
546862306a36Sopenharmony_ci
546962306a36Sopenharmony_ci/**
547062306a36Sopenharmony_ci * ieee80211_color_change_finish - notify mac80211 about color change
547162306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
547262306a36Sopenharmony_ci *
547362306a36Sopenharmony_ci * After a color change announcement was scheduled and the counter in this
547462306a36Sopenharmony_ci * announcement hits 1, this function must be called by the driver to
547562306a36Sopenharmony_ci * notify mac80211 that the color can be changed
547662306a36Sopenharmony_ci */
547762306a36Sopenharmony_civoid ieee80211_color_change_finish(struct ieee80211_vif *vif);
547862306a36Sopenharmony_ci
547962306a36Sopenharmony_ci/**
548062306a36Sopenharmony_ci * ieee80211_proberesp_get - retrieve a Probe Response template
548162306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
548262306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
548362306a36Sopenharmony_ci *
548462306a36Sopenharmony_ci * Creates a Probe Response template which can, for example, be uploaded to
548562306a36Sopenharmony_ci * hardware. The destination address should be set by the caller.
548662306a36Sopenharmony_ci *
548762306a36Sopenharmony_ci * Can only be called in AP mode.
548862306a36Sopenharmony_ci *
548962306a36Sopenharmony_ci * Return: The Probe Response template. %NULL on error.
549062306a36Sopenharmony_ci */
549162306a36Sopenharmony_cistruct sk_buff *ieee80211_proberesp_get(struct ieee80211_hw *hw,
549262306a36Sopenharmony_ci					struct ieee80211_vif *vif);
549362306a36Sopenharmony_ci
549462306a36Sopenharmony_ci/**
549562306a36Sopenharmony_ci * ieee80211_pspoll_get - retrieve a PS Poll template
549662306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
549762306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
549862306a36Sopenharmony_ci *
549962306a36Sopenharmony_ci * Creates a PS Poll a template which can, for example, uploaded to
550062306a36Sopenharmony_ci * hardware. The template must be updated after association so that correct
550162306a36Sopenharmony_ci * AID, BSSID and MAC address is used.
550262306a36Sopenharmony_ci *
550362306a36Sopenharmony_ci * Note: Caller (or hardware) is responsible for setting the
550462306a36Sopenharmony_ci * &IEEE80211_FCTL_PM bit.
550562306a36Sopenharmony_ci *
550662306a36Sopenharmony_ci * Return: The PS Poll template. %NULL on error.
550762306a36Sopenharmony_ci */
550862306a36Sopenharmony_cistruct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
550962306a36Sopenharmony_ci				     struct ieee80211_vif *vif);
551062306a36Sopenharmony_ci
551162306a36Sopenharmony_ci/**
551262306a36Sopenharmony_ci * ieee80211_nullfunc_get - retrieve a nullfunc template
551362306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
551462306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
551562306a36Sopenharmony_ci * @link_id: If the vif is an MLD, get a frame with the link addresses
551662306a36Sopenharmony_ci *	for the given link ID. For a link_id < 0 you get a frame with
551762306a36Sopenharmony_ci *	MLD addresses, however useful that might be.
551862306a36Sopenharmony_ci * @qos_ok: QoS NDP is acceptable to the caller, this should be set
551962306a36Sopenharmony_ci *	if at all possible
552062306a36Sopenharmony_ci *
552162306a36Sopenharmony_ci * Creates a Nullfunc template which can, for example, uploaded to
552262306a36Sopenharmony_ci * hardware. The template must be updated after association so that correct
552362306a36Sopenharmony_ci * BSSID and address is used.
552462306a36Sopenharmony_ci *
552562306a36Sopenharmony_ci * If @qos_ndp is set and the association is to an AP with QoS/WMM, the
552662306a36Sopenharmony_ci * returned packet will be QoS NDP.
552762306a36Sopenharmony_ci *
552862306a36Sopenharmony_ci * Note: Caller (or hardware) is responsible for setting the
552962306a36Sopenharmony_ci * &IEEE80211_FCTL_PM bit as well as Duration and Sequence Control fields.
553062306a36Sopenharmony_ci *
553162306a36Sopenharmony_ci * Return: The nullfunc template. %NULL on error.
553262306a36Sopenharmony_ci */
553362306a36Sopenharmony_cistruct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
553462306a36Sopenharmony_ci				       struct ieee80211_vif *vif,
553562306a36Sopenharmony_ci				       int link_id, bool qos_ok);
553662306a36Sopenharmony_ci
553762306a36Sopenharmony_ci/**
553862306a36Sopenharmony_ci * ieee80211_probereq_get - retrieve a Probe Request template
553962306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
554062306a36Sopenharmony_ci * @src_addr: source MAC address
554162306a36Sopenharmony_ci * @ssid: SSID buffer
554262306a36Sopenharmony_ci * @ssid_len: length of SSID
554362306a36Sopenharmony_ci * @tailroom: tailroom to reserve at end of SKB for IEs
554462306a36Sopenharmony_ci *
554562306a36Sopenharmony_ci * Creates a Probe Request template which can, for example, be uploaded to
554662306a36Sopenharmony_ci * hardware.
554762306a36Sopenharmony_ci *
554862306a36Sopenharmony_ci * Return: The Probe Request template. %NULL on error.
554962306a36Sopenharmony_ci */
555062306a36Sopenharmony_cistruct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
555162306a36Sopenharmony_ci				       const u8 *src_addr,
555262306a36Sopenharmony_ci				       const u8 *ssid, size_t ssid_len,
555362306a36Sopenharmony_ci				       size_t tailroom);
555462306a36Sopenharmony_ci
555562306a36Sopenharmony_ci/**
555662306a36Sopenharmony_ci * ieee80211_rts_get - RTS frame generation function
555762306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
555862306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
555962306a36Sopenharmony_ci * @frame: pointer to the frame that is going to be protected by the RTS.
556062306a36Sopenharmony_ci * @frame_len: the frame length (in octets).
556162306a36Sopenharmony_ci * @frame_txctl: &struct ieee80211_tx_info of the frame.
556262306a36Sopenharmony_ci * @rts: The buffer where to store the RTS frame.
556362306a36Sopenharmony_ci *
556462306a36Sopenharmony_ci * If the RTS frames are generated by the host system (i.e., not in
556562306a36Sopenharmony_ci * hardware/firmware), the low-level driver uses this function to receive
556662306a36Sopenharmony_ci * the next RTS frame from the 802.11 code. The low-level is responsible
556762306a36Sopenharmony_ci * for calling this function before and RTS frame is needed.
556862306a36Sopenharmony_ci */
556962306a36Sopenharmony_civoid ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
557062306a36Sopenharmony_ci		       const void *frame, size_t frame_len,
557162306a36Sopenharmony_ci		       const struct ieee80211_tx_info *frame_txctl,
557262306a36Sopenharmony_ci		       struct ieee80211_rts *rts);
557362306a36Sopenharmony_ci
557462306a36Sopenharmony_ci/**
557562306a36Sopenharmony_ci * ieee80211_rts_duration - Get the duration field for an RTS frame
557662306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
557762306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
557862306a36Sopenharmony_ci * @frame_len: the length of the frame that is going to be protected by the RTS.
557962306a36Sopenharmony_ci * @frame_txctl: &struct ieee80211_tx_info of the frame.
558062306a36Sopenharmony_ci *
558162306a36Sopenharmony_ci * If the RTS is generated in firmware, but the host system must provide
558262306a36Sopenharmony_ci * the duration field, the low-level driver uses this function to receive
558362306a36Sopenharmony_ci * the duration field value in little-endian byteorder.
558462306a36Sopenharmony_ci *
558562306a36Sopenharmony_ci * Return: The duration.
558662306a36Sopenharmony_ci */
558762306a36Sopenharmony_ci__le16 ieee80211_rts_duration(struct ieee80211_hw *hw,
558862306a36Sopenharmony_ci			      struct ieee80211_vif *vif, size_t frame_len,
558962306a36Sopenharmony_ci			      const struct ieee80211_tx_info *frame_txctl);
559062306a36Sopenharmony_ci
559162306a36Sopenharmony_ci/**
559262306a36Sopenharmony_ci * ieee80211_ctstoself_get - CTS-to-self frame generation function
559362306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
559462306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
559562306a36Sopenharmony_ci * @frame: pointer to the frame that is going to be protected by the CTS-to-self.
559662306a36Sopenharmony_ci * @frame_len: the frame length (in octets).
559762306a36Sopenharmony_ci * @frame_txctl: &struct ieee80211_tx_info of the frame.
559862306a36Sopenharmony_ci * @cts: The buffer where to store the CTS-to-self frame.
559962306a36Sopenharmony_ci *
560062306a36Sopenharmony_ci * If the CTS-to-self frames are generated by the host system (i.e., not in
560162306a36Sopenharmony_ci * hardware/firmware), the low-level driver uses this function to receive
560262306a36Sopenharmony_ci * the next CTS-to-self frame from the 802.11 code. The low-level is responsible
560362306a36Sopenharmony_ci * for calling this function before and CTS-to-self frame is needed.
560462306a36Sopenharmony_ci */
560562306a36Sopenharmony_civoid ieee80211_ctstoself_get(struct ieee80211_hw *hw,
560662306a36Sopenharmony_ci			     struct ieee80211_vif *vif,
560762306a36Sopenharmony_ci			     const void *frame, size_t frame_len,
560862306a36Sopenharmony_ci			     const struct ieee80211_tx_info *frame_txctl,
560962306a36Sopenharmony_ci			     struct ieee80211_cts *cts);
561062306a36Sopenharmony_ci
561162306a36Sopenharmony_ci/**
561262306a36Sopenharmony_ci * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame
561362306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
561462306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
561562306a36Sopenharmony_ci * @frame_len: the length of the frame that is going to be protected by the CTS-to-self.
561662306a36Sopenharmony_ci * @frame_txctl: &struct ieee80211_tx_info of the frame.
561762306a36Sopenharmony_ci *
561862306a36Sopenharmony_ci * If the CTS-to-self is generated in firmware, but the host system must provide
561962306a36Sopenharmony_ci * the duration field, the low-level driver uses this function to receive
562062306a36Sopenharmony_ci * the duration field value in little-endian byteorder.
562162306a36Sopenharmony_ci *
562262306a36Sopenharmony_ci * Return: The duration.
562362306a36Sopenharmony_ci */
562462306a36Sopenharmony_ci__le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
562562306a36Sopenharmony_ci				    struct ieee80211_vif *vif,
562662306a36Sopenharmony_ci				    size_t frame_len,
562762306a36Sopenharmony_ci				    const struct ieee80211_tx_info *frame_txctl);
562862306a36Sopenharmony_ci
562962306a36Sopenharmony_ci/**
563062306a36Sopenharmony_ci * ieee80211_generic_frame_duration - Calculate the duration field for a frame
563162306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
563262306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
563362306a36Sopenharmony_ci * @band: the band to calculate the frame duration on
563462306a36Sopenharmony_ci * @frame_len: the length of the frame.
563562306a36Sopenharmony_ci * @rate: the rate at which the frame is going to be transmitted.
563662306a36Sopenharmony_ci *
563762306a36Sopenharmony_ci * Calculate the duration field of some generic frame, given its
563862306a36Sopenharmony_ci * length and transmission rate (in 100kbps).
563962306a36Sopenharmony_ci *
564062306a36Sopenharmony_ci * Return: The duration.
564162306a36Sopenharmony_ci */
564262306a36Sopenharmony_ci__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
564362306a36Sopenharmony_ci					struct ieee80211_vif *vif,
564462306a36Sopenharmony_ci					enum nl80211_band band,
564562306a36Sopenharmony_ci					size_t frame_len,
564662306a36Sopenharmony_ci					struct ieee80211_rate *rate);
564762306a36Sopenharmony_ci
564862306a36Sopenharmony_ci/**
564962306a36Sopenharmony_ci * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
565062306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw().
565162306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
565262306a36Sopenharmony_ci *
565362306a36Sopenharmony_ci * Function for accessing buffered broadcast and multicast frames. If
565462306a36Sopenharmony_ci * hardware/firmware does not implement buffering of broadcast/multicast
565562306a36Sopenharmony_ci * frames when power saving is used, 802.11 code buffers them in the host
565662306a36Sopenharmony_ci * memory. The low-level driver uses this function to fetch next buffered
565762306a36Sopenharmony_ci * frame. In most cases, this is used when generating beacon frame.
565862306a36Sopenharmony_ci *
565962306a36Sopenharmony_ci * Return: A pointer to the next buffered skb or NULL if no more buffered
566062306a36Sopenharmony_ci * frames are available.
566162306a36Sopenharmony_ci *
566262306a36Sopenharmony_ci * Note: buffered frames are returned only after DTIM beacon frame was
566362306a36Sopenharmony_ci * generated with ieee80211_beacon_get() and the low-level driver must thus
566462306a36Sopenharmony_ci * call ieee80211_beacon_get() first. ieee80211_get_buffered_bc() returns
566562306a36Sopenharmony_ci * NULL if the previous generated beacon was not DTIM, so the low-level driver
566662306a36Sopenharmony_ci * does not need to check for DTIM beacons separately and should be able to
566762306a36Sopenharmony_ci * use common code for all beacons.
566862306a36Sopenharmony_ci */
566962306a36Sopenharmony_cistruct sk_buff *
567062306a36Sopenharmony_ciieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
567162306a36Sopenharmony_ci
567262306a36Sopenharmony_ci/**
567362306a36Sopenharmony_ci * ieee80211_get_tkip_p1k_iv - get a TKIP phase 1 key for IV32
567462306a36Sopenharmony_ci *
567562306a36Sopenharmony_ci * This function returns the TKIP phase 1 key for the given IV32.
567662306a36Sopenharmony_ci *
567762306a36Sopenharmony_ci * @keyconf: the parameter passed with the set key
567862306a36Sopenharmony_ci * @iv32: IV32 to get the P1K for
567962306a36Sopenharmony_ci * @p1k: a buffer to which the key will be written, as 5 u16 values
568062306a36Sopenharmony_ci */
568162306a36Sopenharmony_civoid ieee80211_get_tkip_p1k_iv(struct ieee80211_key_conf *keyconf,
568262306a36Sopenharmony_ci			       u32 iv32, u16 *p1k);
568362306a36Sopenharmony_ci
568462306a36Sopenharmony_ci/**
568562306a36Sopenharmony_ci * ieee80211_get_tkip_p1k - get a TKIP phase 1 key
568662306a36Sopenharmony_ci *
568762306a36Sopenharmony_ci * This function returns the TKIP phase 1 key for the IV32 taken
568862306a36Sopenharmony_ci * from the given packet.
568962306a36Sopenharmony_ci *
569062306a36Sopenharmony_ci * @keyconf: the parameter passed with the set key
569162306a36Sopenharmony_ci * @skb: the packet to take the IV32 value from that will be encrypted
569262306a36Sopenharmony_ci *	with this P1K
569362306a36Sopenharmony_ci * @p1k: a buffer to which the key will be written, as 5 u16 values
569462306a36Sopenharmony_ci */
569562306a36Sopenharmony_cistatic inline void ieee80211_get_tkip_p1k(struct ieee80211_key_conf *keyconf,
569662306a36Sopenharmony_ci					  struct sk_buff *skb, u16 *p1k)
569762306a36Sopenharmony_ci{
569862306a36Sopenharmony_ci	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
569962306a36Sopenharmony_ci	const u8 *data = (u8 *)hdr + ieee80211_hdrlen(hdr->frame_control);
570062306a36Sopenharmony_ci	u32 iv32 = get_unaligned_le32(&data[4]);
570162306a36Sopenharmony_ci
570262306a36Sopenharmony_ci	ieee80211_get_tkip_p1k_iv(keyconf, iv32, p1k);
570362306a36Sopenharmony_ci}
570462306a36Sopenharmony_ci
570562306a36Sopenharmony_ci/**
570662306a36Sopenharmony_ci * ieee80211_get_tkip_rx_p1k - get a TKIP phase 1 key for RX
570762306a36Sopenharmony_ci *
570862306a36Sopenharmony_ci * This function returns the TKIP phase 1 key for the given IV32
570962306a36Sopenharmony_ci * and transmitter address.
571062306a36Sopenharmony_ci *
571162306a36Sopenharmony_ci * @keyconf: the parameter passed with the set key
571262306a36Sopenharmony_ci * @ta: TA that will be used with the key
571362306a36Sopenharmony_ci * @iv32: IV32 to get the P1K for
571462306a36Sopenharmony_ci * @p1k: a buffer to which the key will be written, as 5 u16 values
571562306a36Sopenharmony_ci */
571662306a36Sopenharmony_civoid ieee80211_get_tkip_rx_p1k(struct ieee80211_key_conf *keyconf,
571762306a36Sopenharmony_ci			       const u8 *ta, u32 iv32, u16 *p1k);
571862306a36Sopenharmony_ci
571962306a36Sopenharmony_ci/**
572062306a36Sopenharmony_ci * ieee80211_get_tkip_p2k - get a TKIP phase 2 key
572162306a36Sopenharmony_ci *
572262306a36Sopenharmony_ci * This function computes the TKIP RC4 key for the IV values
572362306a36Sopenharmony_ci * in the packet.
572462306a36Sopenharmony_ci *
572562306a36Sopenharmony_ci * @keyconf: the parameter passed with the set key
572662306a36Sopenharmony_ci * @skb: the packet to take the IV32/IV16 values from that will be
572762306a36Sopenharmony_ci *	encrypted with this key
572862306a36Sopenharmony_ci * @p2k: a buffer to which the key will be written, 16 bytes
572962306a36Sopenharmony_ci */
573062306a36Sopenharmony_civoid ieee80211_get_tkip_p2k(struct ieee80211_key_conf *keyconf,
573162306a36Sopenharmony_ci			    struct sk_buff *skb, u8 *p2k);
573262306a36Sopenharmony_ci
573362306a36Sopenharmony_ci/**
573462306a36Sopenharmony_ci * ieee80211_tkip_add_iv - write TKIP IV and Ext. IV to pos
573562306a36Sopenharmony_ci *
573662306a36Sopenharmony_ci * @pos: start of crypto header
573762306a36Sopenharmony_ci * @keyconf: the parameter passed with the set key
573862306a36Sopenharmony_ci * @pn: PN to add
573962306a36Sopenharmony_ci *
574062306a36Sopenharmony_ci * Returns: pointer to the octet following IVs (i.e. beginning of
574162306a36Sopenharmony_ci * the packet payload)
574262306a36Sopenharmony_ci *
574362306a36Sopenharmony_ci * This function writes the tkip IV value to pos (which should
574462306a36Sopenharmony_ci * point to the crypto header)
574562306a36Sopenharmony_ci */
574662306a36Sopenharmony_ciu8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key_conf *keyconf, u64 pn);
574762306a36Sopenharmony_ci
574862306a36Sopenharmony_ci/**
574962306a36Sopenharmony_ci * ieee80211_get_key_rx_seq - get key RX sequence counter
575062306a36Sopenharmony_ci *
575162306a36Sopenharmony_ci * @keyconf: the parameter passed with the set key
575262306a36Sopenharmony_ci * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
575362306a36Sopenharmony_ci *	the value on TID 0 is also used for non-QoS frames. For
575462306a36Sopenharmony_ci *	CMAC, only TID 0 is valid.
575562306a36Sopenharmony_ci * @seq: buffer to receive the sequence data
575662306a36Sopenharmony_ci *
575762306a36Sopenharmony_ci * This function allows a driver to retrieve the current RX IV/PNs
575862306a36Sopenharmony_ci * for the given key. It must not be called if IV checking is done
575962306a36Sopenharmony_ci * by the device and not by mac80211.
576062306a36Sopenharmony_ci *
576162306a36Sopenharmony_ci * Note that this function may only be called when no RX processing
576262306a36Sopenharmony_ci * can be done concurrently.
576362306a36Sopenharmony_ci */
576462306a36Sopenharmony_civoid ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
576562306a36Sopenharmony_ci			      int tid, struct ieee80211_key_seq *seq);
576662306a36Sopenharmony_ci
576762306a36Sopenharmony_ci/**
576862306a36Sopenharmony_ci * ieee80211_set_key_rx_seq - set key RX sequence counter
576962306a36Sopenharmony_ci *
577062306a36Sopenharmony_ci * @keyconf: the parameter passed with the set key
577162306a36Sopenharmony_ci * @tid: The TID, or -1 for the management frame value (CCMP/GCMP only);
577262306a36Sopenharmony_ci *	the value on TID 0 is also used for non-QoS frames. For
577362306a36Sopenharmony_ci *	CMAC, only TID 0 is valid.
577462306a36Sopenharmony_ci * @seq: new sequence data
577562306a36Sopenharmony_ci *
577662306a36Sopenharmony_ci * This function allows a driver to set the current RX IV/PNs for the
577762306a36Sopenharmony_ci * given key. This is useful when resuming from WoWLAN sleep and GTK
577862306a36Sopenharmony_ci * rekey may have been done while suspended. It should not be called
577962306a36Sopenharmony_ci * if IV checking is done by the device and not by mac80211.
578062306a36Sopenharmony_ci *
578162306a36Sopenharmony_ci * Note that this function may only be called when no RX processing
578262306a36Sopenharmony_ci * can be done concurrently.
578362306a36Sopenharmony_ci */
578462306a36Sopenharmony_civoid ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf,
578562306a36Sopenharmony_ci			      int tid, struct ieee80211_key_seq *seq);
578662306a36Sopenharmony_ci
578762306a36Sopenharmony_ci/**
578862306a36Sopenharmony_ci * ieee80211_remove_key - remove the given key
578962306a36Sopenharmony_ci * @keyconf: the parameter passed with the set key
579062306a36Sopenharmony_ci *
579162306a36Sopenharmony_ci * Remove the given key. If the key was uploaded to the hardware at the
579262306a36Sopenharmony_ci * time this function is called, it is not deleted in the hardware but
579362306a36Sopenharmony_ci * instead assumed to have been removed already.
579462306a36Sopenharmony_ci *
579562306a36Sopenharmony_ci * Note that due to locking considerations this function can (currently)
579662306a36Sopenharmony_ci * only be called during key iteration (ieee80211_iter_keys().)
579762306a36Sopenharmony_ci */
579862306a36Sopenharmony_civoid ieee80211_remove_key(struct ieee80211_key_conf *keyconf);
579962306a36Sopenharmony_ci
580062306a36Sopenharmony_ci/**
580162306a36Sopenharmony_ci * ieee80211_gtk_rekey_add - add a GTK key from rekeying during WoWLAN
580262306a36Sopenharmony_ci * @vif: the virtual interface to add the key on
580362306a36Sopenharmony_ci * @keyconf: new key data
580462306a36Sopenharmony_ci *
580562306a36Sopenharmony_ci * When GTK rekeying was done while the system was suspended, (a) new
580662306a36Sopenharmony_ci * key(s) will be available. These will be needed by mac80211 for proper
580762306a36Sopenharmony_ci * RX processing, so this function allows setting them.
580862306a36Sopenharmony_ci *
580962306a36Sopenharmony_ci * The function returns the newly allocated key structure, which will
581062306a36Sopenharmony_ci * have similar contents to the passed key configuration but point to
581162306a36Sopenharmony_ci * mac80211-owned memory. In case of errors, the function returns an
581262306a36Sopenharmony_ci * ERR_PTR(), use IS_ERR() etc.
581362306a36Sopenharmony_ci *
581462306a36Sopenharmony_ci * Note that this function assumes the key isn't added to hardware
581562306a36Sopenharmony_ci * acceleration, so no TX will be done with the key. Since it's a GTK
581662306a36Sopenharmony_ci * on managed (station) networks, this is true anyway. If the driver
581762306a36Sopenharmony_ci * calls this function from the resume callback and subsequently uses
581862306a36Sopenharmony_ci * the return code 1 to reconfigure the device, this key will be part
581962306a36Sopenharmony_ci * of the reconfiguration.
582062306a36Sopenharmony_ci *
582162306a36Sopenharmony_ci * Note that the driver should also call ieee80211_set_key_rx_seq()
582262306a36Sopenharmony_ci * for the new key for each TID to set up sequence counters properly.
582362306a36Sopenharmony_ci *
582462306a36Sopenharmony_ci * IMPORTANT: If this replaces a key that is present in the hardware,
582562306a36Sopenharmony_ci * then it will attempt to remove it during this call. In many cases
582662306a36Sopenharmony_ci * this isn't what you want, so call ieee80211_remove_key() first for
582762306a36Sopenharmony_ci * the key that's being replaced.
582862306a36Sopenharmony_ci */
582962306a36Sopenharmony_cistruct ieee80211_key_conf *
583062306a36Sopenharmony_ciieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
583162306a36Sopenharmony_ci			struct ieee80211_key_conf *keyconf);
583262306a36Sopenharmony_ci
583362306a36Sopenharmony_ci/**
583462306a36Sopenharmony_ci * ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying
583562306a36Sopenharmony_ci * @vif: virtual interface the rekeying was done on
583662306a36Sopenharmony_ci * @bssid: The BSSID of the AP, for checking association
583762306a36Sopenharmony_ci * @replay_ctr: the new replay counter after GTK rekeying
583862306a36Sopenharmony_ci * @gfp: allocation flags
583962306a36Sopenharmony_ci */
584062306a36Sopenharmony_civoid ieee80211_gtk_rekey_notify(struct ieee80211_vif *vif, const u8 *bssid,
584162306a36Sopenharmony_ci				const u8 *replay_ctr, gfp_t gfp);
584262306a36Sopenharmony_ci
584362306a36Sopenharmony_ci/**
584462306a36Sopenharmony_ci * ieee80211_key_mic_failure - increment MIC failure counter for the key
584562306a36Sopenharmony_ci *
584662306a36Sopenharmony_ci * Note: this is really only safe if no other RX function is called
584762306a36Sopenharmony_ci * at the same time.
584862306a36Sopenharmony_ci *
584962306a36Sopenharmony_ci * @keyconf: the key in question
585062306a36Sopenharmony_ci */
585162306a36Sopenharmony_civoid ieee80211_key_mic_failure(struct ieee80211_key_conf *keyconf);
585262306a36Sopenharmony_ci
585362306a36Sopenharmony_ci/**
585462306a36Sopenharmony_ci * ieee80211_key_replay - increment replay counter for the key
585562306a36Sopenharmony_ci *
585662306a36Sopenharmony_ci * Note: this is really only safe if no other RX function is called
585762306a36Sopenharmony_ci * at the same time.
585862306a36Sopenharmony_ci *
585962306a36Sopenharmony_ci * @keyconf: the key in question
586062306a36Sopenharmony_ci */
586162306a36Sopenharmony_civoid ieee80211_key_replay(struct ieee80211_key_conf *keyconf);
586262306a36Sopenharmony_ci
586362306a36Sopenharmony_ci/**
586462306a36Sopenharmony_ci * ieee80211_wake_queue - wake specific queue
586562306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw().
586662306a36Sopenharmony_ci * @queue: queue number (counted from zero).
586762306a36Sopenharmony_ci *
586862306a36Sopenharmony_ci * Drivers must use this function instead of netif_wake_queue.
586962306a36Sopenharmony_ci */
587062306a36Sopenharmony_civoid ieee80211_wake_queue(struct ieee80211_hw *hw, int queue);
587162306a36Sopenharmony_ci
587262306a36Sopenharmony_ci/**
587362306a36Sopenharmony_ci * ieee80211_stop_queue - stop specific queue
587462306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw().
587562306a36Sopenharmony_ci * @queue: queue number (counted from zero).
587662306a36Sopenharmony_ci *
587762306a36Sopenharmony_ci * Drivers must use this function instead of netif_stop_queue.
587862306a36Sopenharmony_ci */
587962306a36Sopenharmony_civoid ieee80211_stop_queue(struct ieee80211_hw *hw, int queue);
588062306a36Sopenharmony_ci
588162306a36Sopenharmony_ci/**
588262306a36Sopenharmony_ci * ieee80211_queue_stopped - test status of the queue
588362306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw().
588462306a36Sopenharmony_ci * @queue: queue number (counted from zero).
588562306a36Sopenharmony_ci *
588662306a36Sopenharmony_ci * Drivers must use this function instead of netif_queue_stopped.
588762306a36Sopenharmony_ci *
588862306a36Sopenharmony_ci * Return: %true if the queue is stopped. %false otherwise.
588962306a36Sopenharmony_ci */
589062306a36Sopenharmony_ci
589162306a36Sopenharmony_ciint ieee80211_queue_stopped(struct ieee80211_hw *hw, int queue);
589262306a36Sopenharmony_ci
589362306a36Sopenharmony_ci/**
589462306a36Sopenharmony_ci * ieee80211_stop_queues - stop all queues
589562306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw().
589662306a36Sopenharmony_ci *
589762306a36Sopenharmony_ci * Drivers must use this function instead of netif_tx_stop_all_queues.
589862306a36Sopenharmony_ci */
589962306a36Sopenharmony_civoid ieee80211_stop_queues(struct ieee80211_hw *hw);
590062306a36Sopenharmony_ci
590162306a36Sopenharmony_ci/**
590262306a36Sopenharmony_ci * ieee80211_wake_queues - wake all queues
590362306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw().
590462306a36Sopenharmony_ci *
590562306a36Sopenharmony_ci * Drivers must use this function instead of netif_tx_wake_all_queues.
590662306a36Sopenharmony_ci */
590762306a36Sopenharmony_civoid ieee80211_wake_queues(struct ieee80211_hw *hw);
590862306a36Sopenharmony_ci
590962306a36Sopenharmony_ci/**
591062306a36Sopenharmony_ci * ieee80211_scan_completed - completed hardware scan
591162306a36Sopenharmony_ci *
591262306a36Sopenharmony_ci * When hardware scan offload is used (i.e. the hw_scan() callback is
591362306a36Sopenharmony_ci * assigned) this function needs to be called by the driver to notify
591462306a36Sopenharmony_ci * mac80211 that the scan finished. This function can be called from
591562306a36Sopenharmony_ci * any context, including hardirq context.
591662306a36Sopenharmony_ci *
591762306a36Sopenharmony_ci * @hw: the hardware that finished the scan
591862306a36Sopenharmony_ci * @info: information about the completed scan
591962306a36Sopenharmony_ci */
592062306a36Sopenharmony_civoid ieee80211_scan_completed(struct ieee80211_hw *hw,
592162306a36Sopenharmony_ci			      struct cfg80211_scan_info *info);
592262306a36Sopenharmony_ci
592362306a36Sopenharmony_ci/**
592462306a36Sopenharmony_ci * ieee80211_sched_scan_results - got results from scheduled scan
592562306a36Sopenharmony_ci *
592662306a36Sopenharmony_ci * When a scheduled scan is running, this function needs to be called by the
592762306a36Sopenharmony_ci * driver whenever there are new scan results available.
592862306a36Sopenharmony_ci *
592962306a36Sopenharmony_ci * @hw: the hardware that is performing scheduled scans
593062306a36Sopenharmony_ci */
593162306a36Sopenharmony_civoid ieee80211_sched_scan_results(struct ieee80211_hw *hw);
593262306a36Sopenharmony_ci
593362306a36Sopenharmony_ci/**
593462306a36Sopenharmony_ci * ieee80211_sched_scan_stopped - inform that the scheduled scan has stopped
593562306a36Sopenharmony_ci *
593662306a36Sopenharmony_ci * When a scheduled scan is running, this function can be called by
593762306a36Sopenharmony_ci * the driver if it needs to stop the scan to perform another task.
593862306a36Sopenharmony_ci * Usual scenarios are drivers that cannot continue the scheduled scan
593962306a36Sopenharmony_ci * while associating, for instance.
594062306a36Sopenharmony_ci *
594162306a36Sopenharmony_ci * @hw: the hardware that is performing scheduled scans
594262306a36Sopenharmony_ci */
594362306a36Sopenharmony_civoid ieee80211_sched_scan_stopped(struct ieee80211_hw *hw);
594462306a36Sopenharmony_ci
594562306a36Sopenharmony_ci/**
594662306a36Sopenharmony_ci * enum ieee80211_interface_iteration_flags - interface iteration flags
594762306a36Sopenharmony_ci * @IEEE80211_IFACE_ITER_NORMAL: Iterate over all interfaces that have
594862306a36Sopenharmony_ci *	been added to the driver; However, note that during hardware
594962306a36Sopenharmony_ci *	reconfiguration (after restart_hw) it will iterate over a new
595062306a36Sopenharmony_ci *	interface and over all the existing interfaces even if they
595162306a36Sopenharmony_ci *	haven't been re-added to the driver yet.
595262306a36Sopenharmony_ci * @IEEE80211_IFACE_ITER_RESUME_ALL: During resume, iterate over all
595362306a36Sopenharmony_ci *	interfaces, even if they haven't been re-added to the driver yet.
595462306a36Sopenharmony_ci * @IEEE80211_IFACE_ITER_ACTIVE: Iterate only active interfaces (netdev is up).
595562306a36Sopenharmony_ci * @IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER: Skip any interfaces where SDATA
595662306a36Sopenharmony_ci *	is not in the driver.  This may fix crashes during firmware recovery
595762306a36Sopenharmony_ci *	for instance.
595862306a36Sopenharmony_ci */
595962306a36Sopenharmony_cienum ieee80211_interface_iteration_flags {
596062306a36Sopenharmony_ci	IEEE80211_IFACE_ITER_NORMAL	= 0,
596162306a36Sopenharmony_ci	IEEE80211_IFACE_ITER_RESUME_ALL	= BIT(0),
596262306a36Sopenharmony_ci	IEEE80211_IFACE_ITER_ACTIVE	= BIT(1),
596362306a36Sopenharmony_ci	IEEE80211_IFACE_SKIP_SDATA_NOT_IN_DRIVER	= BIT(2),
596462306a36Sopenharmony_ci};
596562306a36Sopenharmony_ci
596662306a36Sopenharmony_ci/**
596762306a36Sopenharmony_ci * ieee80211_iterate_interfaces - iterate interfaces
596862306a36Sopenharmony_ci *
596962306a36Sopenharmony_ci * This function iterates over the interfaces associated with a given
597062306a36Sopenharmony_ci * hardware and calls the callback for them. This includes active as well as
597162306a36Sopenharmony_ci * inactive interfaces. This function allows the iterator function to sleep.
597262306a36Sopenharmony_ci * Will iterate over a new interface during add_interface().
597362306a36Sopenharmony_ci *
597462306a36Sopenharmony_ci * @hw: the hardware struct of which the interfaces should be iterated over
597562306a36Sopenharmony_ci * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
597662306a36Sopenharmony_ci * @iterator: the iterator function to call
597762306a36Sopenharmony_ci * @data: first argument of the iterator function
597862306a36Sopenharmony_ci */
597962306a36Sopenharmony_civoid ieee80211_iterate_interfaces(struct ieee80211_hw *hw, u32 iter_flags,
598062306a36Sopenharmony_ci				  void (*iterator)(void *data, u8 *mac,
598162306a36Sopenharmony_ci						   struct ieee80211_vif *vif),
598262306a36Sopenharmony_ci				  void *data);
598362306a36Sopenharmony_ci
598462306a36Sopenharmony_ci/**
598562306a36Sopenharmony_ci * ieee80211_iterate_active_interfaces - iterate active interfaces
598662306a36Sopenharmony_ci *
598762306a36Sopenharmony_ci * This function iterates over the interfaces associated with a given
598862306a36Sopenharmony_ci * hardware that are currently active and calls the callback for them.
598962306a36Sopenharmony_ci * This function allows the iterator function to sleep, when the iterator
599062306a36Sopenharmony_ci * function is atomic @ieee80211_iterate_active_interfaces_atomic can
599162306a36Sopenharmony_ci * be used.
599262306a36Sopenharmony_ci * Does not iterate over a new interface during add_interface().
599362306a36Sopenharmony_ci *
599462306a36Sopenharmony_ci * @hw: the hardware struct of which the interfaces should be iterated over
599562306a36Sopenharmony_ci * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
599662306a36Sopenharmony_ci * @iterator: the iterator function to call
599762306a36Sopenharmony_ci * @data: first argument of the iterator function
599862306a36Sopenharmony_ci */
599962306a36Sopenharmony_cistatic inline void
600062306a36Sopenharmony_ciieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, u32 iter_flags,
600162306a36Sopenharmony_ci				    void (*iterator)(void *data, u8 *mac,
600262306a36Sopenharmony_ci						     struct ieee80211_vif *vif),
600362306a36Sopenharmony_ci				    void *data)
600462306a36Sopenharmony_ci{
600562306a36Sopenharmony_ci	ieee80211_iterate_interfaces(hw,
600662306a36Sopenharmony_ci				     iter_flags | IEEE80211_IFACE_ITER_ACTIVE,
600762306a36Sopenharmony_ci				     iterator, data);
600862306a36Sopenharmony_ci}
600962306a36Sopenharmony_ci
601062306a36Sopenharmony_ci/**
601162306a36Sopenharmony_ci * ieee80211_iterate_active_interfaces_atomic - iterate active interfaces
601262306a36Sopenharmony_ci *
601362306a36Sopenharmony_ci * This function iterates over the interfaces associated with a given
601462306a36Sopenharmony_ci * hardware that are currently active and calls the callback for them.
601562306a36Sopenharmony_ci * This function requires the iterator callback function to be atomic,
601662306a36Sopenharmony_ci * if that is not desired, use @ieee80211_iterate_active_interfaces instead.
601762306a36Sopenharmony_ci * Does not iterate over a new interface during add_interface().
601862306a36Sopenharmony_ci *
601962306a36Sopenharmony_ci * @hw: the hardware struct of which the interfaces should be iterated over
602062306a36Sopenharmony_ci * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
602162306a36Sopenharmony_ci * @iterator: the iterator function to call, cannot sleep
602262306a36Sopenharmony_ci * @data: first argument of the iterator function
602362306a36Sopenharmony_ci */
602462306a36Sopenharmony_civoid ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
602562306a36Sopenharmony_ci						u32 iter_flags,
602662306a36Sopenharmony_ci						void (*iterator)(void *data,
602762306a36Sopenharmony_ci						    u8 *mac,
602862306a36Sopenharmony_ci						    struct ieee80211_vif *vif),
602962306a36Sopenharmony_ci						void *data);
603062306a36Sopenharmony_ci
603162306a36Sopenharmony_ci/**
603262306a36Sopenharmony_ci * ieee80211_iterate_active_interfaces_mtx - iterate active interfaces
603362306a36Sopenharmony_ci *
603462306a36Sopenharmony_ci * This function iterates over the interfaces associated with a given
603562306a36Sopenharmony_ci * hardware that are currently active and calls the callback for them.
603662306a36Sopenharmony_ci * This version can only be used while holding the wiphy mutex.
603762306a36Sopenharmony_ci *
603862306a36Sopenharmony_ci * @hw: the hardware struct of which the interfaces should be iterated over
603962306a36Sopenharmony_ci * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
604062306a36Sopenharmony_ci * @iterator: the iterator function to call, cannot sleep
604162306a36Sopenharmony_ci * @data: first argument of the iterator function
604262306a36Sopenharmony_ci */
604362306a36Sopenharmony_civoid ieee80211_iterate_active_interfaces_mtx(struct ieee80211_hw *hw,
604462306a36Sopenharmony_ci					     u32 iter_flags,
604562306a36Sopenharmony_ci					     void (*iterator)(void *data,
604662306a36Sopenharmony_ci						u8 *mac,
604762306a36Sopenharmony_ci						struct ieee80211_vif *vif),
604862306a36Sopenharmony_ci					     void *data);
604962306a36Sopenharmony_ci
605062306a36Sopenharmony_ci/**
605162306a36Sopenharmony_ci * ieee80211_iterate_stations_atomic - iterate stations
605262306a36Sopenharmony_ci *
605362306a36Sopenharmony_ci * This function iterates over all stations associated with a given
605462306a36Sopenharmony_ci * hardware that are currently uploaded to the driver and calls the callback
605562306a36Sopenharmony_ci * function for them.
605662306a36Sopenharmony_ci * This function requires the iterator callback function to be atomic,
605762306a36Sopenharmony_ci *
605862306a36Sopenharmony_ci * @hw: the hardware struct of which the interfaces should be iterated over
605962306a36Sopenharmony_ci * @iterator: the iterator function to call, cannot sleep
606062306a36Sopenharmony_ci * @data: first argument of the iterator function
606162306a36Sopenharmony_ci */
606262306a36Sopenharmony_civoid ieee80211_iterate_stations_atomic(struct ieee80211_hw *hw,
606362306a36Sopenharmony_ci				       void (*iterator)(void *data,
606462306a36Sopenharmony_ci						struct ieee80211_sta *sta),
606562306a36Sopenharmony_ci				       void *data);
606662306a36Sopenharmony_ci/**
606762306a36Sopenharmony_ci * ieee80211_queue_work - add work onto the mac80211 workqueue
606862306a36Sopenharmony_ci *
606962306a36Sopenharmony_ci * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
607062306a36Sopenharmony_ci * This helper ensures drivers are not queueing work when they should not be.
607162306a36Sopenharmony_ci *
607262306a36Sopenharmony_ci * @hw: the hardware struct for the interface we are adding work for
607362306a36Sopenharmony_ci * @work: the work we want to add onto the mac80211 workqueue
607462306a36Sopenharmony_ci */
607562306a36Sopenharmony_civoid ieee80211_queue_work(struct ieee80211_hw *hw, struct work_struct *work);
607662306a36Sopenharmony_ci
607762306a36Sopenharmony_ci/**
607862306a36Sopenharmony_ci * ieee80211_queue_delayed_work - add work onto the mac80211 workqueue
607962306a36Sopenharmony_ci *
608062306a36Sopenharmony_ci * Drivers and mac80211 use this to queue delayed work onto the mac80211
608162306a36Sopenharmony_ci * workqueue.
608262306a36Sopenharmony_ci *
608362306a36Sopenharmony_ci * @hw: the hardware struct for the interface we are adding work for
608462306a36Sopenharmony_ci * @dwork: delayable work to queue onto the mac80211 workqueue
608562306a36Sopenharmony_ci * @delay: number of jiffies to wait before queueing
608662306a36Sopenharmony_ci */
608762306a36Sopenharmony_civoid ieee80211_queue_delayed_work(struct ieee80211_hw *hw,
608862306a36Sopenharmony_ci				  struct delayed_work *dwork,
608962306a36Sopenharmony_ci				  unsigned long delay);
609062306a36Sopenharmony_ci
609162306a36Sopenharmony_ci/**
609262306a36Sopenharmony_ci * ieee80211_refresh_tx_agg_session_timer - Refresh a tx agg session timer.
609362306a36Sopenharmony_ci * @sta: the station for which to start a BA session
609462306a36Sopenharmony_ci * @tid: the TID to BA on.
609562306a36Sopenharmony_ci *
609662306a36Sopenharmony_ci * This function allows low level driver to refresh tx agg session timer
609762306a36Sopenharmony_ci * to maintain BA session, the session level will still be managed by the
609862306a36Sopenharmony_ci * mac80211.
609962306a36Sopenharmony_ci *
610062306a36Sopenharmony_ci * Note: must be called in an RCU critical section.
610162306a36Sopenharmony_ci */
610262306a36Sopenharmony_civoid ieee80211_refresh_tx_agg_session_timer(struct ieee80211_sta *sta,
610362306a36Sopenharmony_ci					    u16 tid);
610462306a36Sopenharmony_ci
610562306a36Sopenharmony_ci/**
610662306a36Sopenharmony_ci * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
610762306a36Sopenharmony_ci * @sta: the station for which to start a BA session
610862306a36Sopenharmony_ci * @tid: the TID to BA on.
610962306a36Sopenharmony_ci * @timeout: session timeout value (in TUs)
611062306a36Sopenharmony_ci *
611162306a36Sopenharmony_ci * Return: success if addBA request was sent, failure otherwise
611262306a36Sopenharmony_ci *
611362306a36Sopenharmony_ci * Although mac80211/low level driver/user space application can estimate
611462306a36Sopenharmony_ci * the need to start aggregation on a certain RA/TID, the session level
611562306a36Sopenharmony_ci * will be managed by the mac80211.
611662306a36Sopenharmony_ci */
611762306a36Sopenharmony_ciint ieee80211_start_tx_ba_session(struct ieee80211_sta *sta, u16 tid,
611862306a36Sopenharmony_ci				  u16 timeout);
611962306a36Sopenharmony_ci
612062306a36Sopenharmony_ci/**
612162306a36Sopenharmony_ci * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
612262306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback
612362306a36Sopenharmony_ci * @ra: receiver address of the BA session recipient.
612462306a36Sopenharmony_ci * @tid: the TID to BA on.
612562306a36Sopenharmony_ci *
612662306a36Sopenharmony_ci * This function must be called by low level driver once it has
612762306a36Sopenharmony_ci * finished with preparations for the BA session. It can be called
612862306a36Sopenharmony_ci * from any context.
612962306a36Sopenharmony_ci */
613062306a36Sopenharmony_civoid ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
613162306a36Sopenharmony_ci				      u16 tid);
613262306a36Sopenharmony_ci
613362306a36Sopenharmony_ci/**
613462306a36Sopenharmony_ci * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
613562306a36Sopenharmony_ci * @sta: the station whose BA session to stop
613662306a36Sopenharmony_ci * @tid: the TID to stop BA.
613762306a36Sopenharmony_ci *
613862306a36Sopenharmony_ci * Return: negative error if the TID is invalid, or no aggregation active
613962306a36Sopenharmony_ci *
614062306a36Sopenharmony_ci * Although mac80211/low level driver/user space application can estimate
614162306a36Sopenharmony_ci * the need to stop aggregation on a certain RA/TID, the session level
614262306a36Sopenharmony_ci * will be managed by the mac80211.
614362306a36Sopenharmony_ci */
614462306a36Sopenharmony_ciint ieee80211_stop_tx_ba_session(struct ieee80211_sta *sta, u16 tid);
614562306a36Sopenharmony_ci
614662306a36Sopenharmony_ci/**
614762306a36Sopenharmony_ci * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
614862306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback
614962306a36Sopenharmony_ci * @ra: receiver address of the BA session recipient.
615062306a36Sopenharmony_ci * @tid: the desired TID to BA on.
615162306a36Sopenharmony_ci *
615262306a36Sopenharmony_ci * This function must be called by low level driver once it has
615362306a36Sopenharmony_ci * finished with preparations for the BA session tear down. It
615462306a36Sopenharmony_ci * can be called from any context.
615562306a36Sopenharmony_ci */
615662306a36Sopenharmony_civoid ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_vif *vif, const u8 *ra,
615762306a36Sopenharmony_ci				     u16 tid);
615862306a36Sopenharmony_ci
615962306a36Sopenharmony_ci/**
616062306a36Sopenharmony_ci * ieee80211_find_sta - find a station
616162306a36Sopenharmony_ci *
616262306a36Sopenharmony_ci * @vif: virtual interface to look for station on
616362306a36Sopenharmony_ci * @addr: station's address
616462306a36Sopenharmony_ci *
616562306a36Sopenharmony_ci * Return: The station, if found. %NULL otherwise.
616662306a36Sopenharmony_ci *
616762306a36Sopenharmony_ci * Note: This function must be called under RCU lock and the
616862306a36Sopenharmony_ci * resulting pointer is only valid under RCU lock as well.
616962306a36Sopenharmony_ci */
617062306a36Sopenharmony_cistruct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif,
617162306a36Sopenharmony_ci					 const u8 *addr);
617262306a36Sopenharmony_ci
617362306a36Sopenharmony_ci/**
617462306a36Sopenharmony_ci * ieee80211_find_sta_by_ifaddr - find a station on hardware
617562306a36Sopenharmony_ci *
617662306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
617762306a36Sopenharmony_ci * @addr: remote station's address
617862306a36Sopenharmony_ci * @localaddr: local address (vif->sdata->vif.addr). Use NULL for 'any'.
617962306a36Sopenharmony_ci *
618062306a36Sopenharmony_ci * Return: The station, if found. %NULL otherwise.
618162306a36Sopenharmony_ci *
618262306a36Sopenharmony_ci * Note: This function must be called under RCU lock and the
618362306a36Sopenharmony_ci * resulting pointer is only valid under RCU lock as well.
618462306a36Sopenharmony_ci *
618562306a36Sopenharmony_ci * NOTE: You may pass NULL for localaddr, but then you will just get
618662306a36Sopenharmony_ci *      the first STA that matches the remote address 'addr'.
618762306a36Sopenharmony_ci *      We can have multiple STA associated with multiple
618862306a36Sopenharmony_ci *      logical stations (e.g. consider a station connecting to another
618962306a36Sopenharmony_ci *      BSSID on the same AP hardware without disconnecting first).
619062306a36Sopenharmony_ci *      In this case, the result of this method with localaddr NULL
619162306a36Sopenharmony_ci *      is not reliable.
619262306a36Sopenharmony_ci *
619362306a36Sopenharmony_ci * DO NOT USE THIS FUNCTION with localaddr NULL if at all possible.
619462306a36Sopenharmony_ci */
619562306a36Sopenharmony_cistruct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw,
619662306a36Sopenharmony_ci					       const u8 *addr,
619762306a36Sopenharmony_ci					       const u8 *localaddr);
619862306a36Sopenharmony_ci
619962306a36Sopenharmony_ci/**
620062306a36Sopenharmony_ci * ieee80211_find_sta_by_link_addrs - find STA by link addresses
620162306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
620262306a36Sopenharmony_ci * @addr: remote station's link address
620362306a36Sopenharmony_ci * @localaddr: local link address, use %NULL for any (but avoid that)
620462306a36Sopenharmony_ci * @link_id: pointer to obtain the link ID if the STA is found,
620562306a36Sopenharmony_ci *	may be %NULL if the link ID is not needed
620662306a36Sopenharmony_ci *
620762306a36Sopenharmony_ci * Obtain the STA by link address, must use RCU protection.
620862306a36Sopenharmony_ci */
620962306a36Sopenharmony_cistruct ieee80211_sta *
621062306a36Sopenharmony_ciieee80211_find_sta_by_link_addrs(struct ieee80211_hw *hw,
621162306a36Sopenharmony_ci				 const u8 *addr,
621262306a36Sopenharmony_ci				 const u8 *localaddr,
621362306a36Sopenharmony_ci				 unsigned int *link_id);
621462306a36Sopenharmony_ci
621562306a36Sopenharmony_ci/**
621662306a36Sopenharmony_ci * ieee80211_sta_block_awake - block station from waking up
621762306a36Sopenharmony_ci * @hw: the hardware
621862306a36Sopenharmony_ci * @pubsta: the station
621962306a36Sopenharmony_ci * @block: whether to block or unblock
622062306a36Sopenharmony_ci *
622162306a36Sopenharmony_ci * Some devices require that all frames that are on the queues
622262306a36Sopenharmony_ci * for a specific station that went to sleep are flushed before
622362306a36Sopenharmony_ci * a poll response or frames after the station woke up can be
622462306a36Sopenharmony_ci * delivered to that it. Note that such frames must be rejected
622562306a36Sopenharmony_ci * by the driver as filtered, with the appropriate status flag.
622662306a36Sopenharmony_ci *
622762306a36Sopenharmony_ci * This function allows implementing this mode in a race-free
622862306a36Sopenharmony_ci * manner.
622962306a36Sopenharmony_ci *
623062306a36Sopenharmony_ci * To do this, a driver must keep track of the number of frames
623162306a36Sopenharmony_ci * still enqueued for a specific station. If this number is not
623262306a36Sopenharmony_ci * zero when the station goes to sleep, the driver must call
623362306a36Sopenharmony_ci * this function to force mac80211 to consider the station to
623462306a36Sopenharmony_ci * be asleep regardless of the station's actual state. Once the
623562306a36Sopenharmony_ci * number of outstanding frames reaches zero, the driver must
623662306a36Sopenharmony_ci * call this function again to unblock the station. That will
623762306a36Sopenharmony_ci * cause mac80211 to be able to send ps-poll responses, and if
623862306a36Sopenharmony_ci * the station queried in the meantime then frames will also
623962306a36Sopenharmony_ci * be sent out as a result of this. Additionally, the driver
624062306a36Sopenharmony_ci * will be notified that the station woke up some time after
624162306a36Sopenharmony_ci * it is unblocked, regardless of whether the station actually
624262306a36Sopenharmony_ci * woke up while blocked or not.
624362306a36Sopenharmony_ci */
624462306a36Sopenharmony_civoid ieee80211_sta_block_awake(struct ieee80211_hw *hw,
624562306a36Sopenharmony_ci			       struct ieee80211_sta *pubsta, bool block);
624662306a36Sopenharmony_ci
624762306a36Sopenharmony_ci/**
624862306a36Sopenharmony_ci * ieee80211_sta_eosp - notify mac80211 about end of SP
624962306a36Sopenharmony_ci * @pubsta: the station
625062306a36Sopenharmony_ci *
625162306a36Sopenharmony_ci * When a device transmits frames in a way that it can't tell
625262306a36Sopenharmony_ci * mac80211 in the TX status about the EOSP, it must clear the
625362306a36Sopenharmony_ci * %IEEE80211_TX_STATUS_EOSP bit and call this function instead.
625462306a36Sopenharmony_ci * This applies for PS-Poll as well as uAPSD.
625562306a36Sopenharmony_ci *
625662306a36Sopenharmony_ci * Note that just like with _tx_status() and _rx() drivers must
625762306a36Sopenharmony_ci * not mix calls to irqsafe/non-irqsafe versions, this function
625862306a36Sopenharmony_ci * must not be mixed with those either. Use the all irqsafe, or
625962306a36Sopenharmony_ci * all non-irqsafe, don't mix!
626062306a36Sopenharmony_ci *
626162306a36Sopenharmony_ci * NB: the _irqsafe version of this function doesn't exist, no
626262306a36Sopenharmony_ci *     driver needs it right now. Don't call this function if
626362306a36Sopenharmony_ci *     you'd need the _irqsafe version, look at the git history
626462306a36Sopenharmony_ci *     and restore the _irqsafe version!
626562306a36Sopenharmony_ci */
626662306a36Sopenharmony_civoid ieee80211_sta_eosp(struct ieee80211_sta *pubsta);
626762306a36Sopenharmony_ci
626862306a36Sopenharmony_ci/**
626962306a36Sopenharmony_ci * ieee80211_send_eosp_nullfunc - ask mac80211 to send NDP with EOSP
627062306a36Sopenharmony_ci * @pubsta: the station
627162306a36Sopenharmony_ci * @tid: the tid of the NDP
627262306a36Sopenharmony_ci *
627362306a36Sopenharmony_ci * Sometimes the device understands that it needs to close
627462306a36Sopenharmony_ci * the Service Period unexpectedly. This can happen when
627562306a36Sopenharmony_ci * sending frames that are filling holes in the BA window.
627662306a36Sopenharmony_ci * In this case, the device can ask mac80211 to send a
627762306a36Sopenharmony_ci * Nullfunc frame with EOSP set. When that happens, the
627862306a36Sopenharmony_ci * driver must have called ieee80211_sta_set_buffered() to
627962306a36Sopenharmony_ci * let mac80211 know that there are no buffered frames any
628062306a36Sopenharmony_ci * more, otherwise mac80211 will get the more_data bit wrong.
628162306a36Sopenharmony_ci * The low level driver must have made sure that the frame
628262306a36Sopenharmony_ci * will be sent despite the station being in power-save.
628362306a36Sopenharmony_ci * Mac80211 won't call allow_buffered_frames().
628462306a36Sopenharmony_ci * Note that calling this function, doesn't exempt the driver
628562306a36Sopenharmony_ci * from closing the EOSP properly, it will still have to call
628662306a36Sopenharmony_ci * ieee80211_sta_eosp when the NDP is sent.
628762306a36Sopenharmony_ci */
628862306a36Sopenharmony_civoid ieee80211_send_eosp_nullfunc(struct ieee80211_sta *pubsta, int tid);
628962306a36Sopenharmony_ci
629062306a36Sopenharmony_ci/**
629162306a36Sopenharmony_ci * ieee80211_sta_recalc_aggregates - recalculate aggregate data after a change
629262306a36Sopenharmony_ci * @pubsta: the station
629362306a36Sopenharmony_ci *
629462306a36Sopenharmony_ci * Call this function after changing a per-link aggregate data as referenced in
629562306a36Sopenharmony_ci * &struct ieee80211_sta_aggregates by accessing the agg field of
629662306a36Sopenharmony_ci * &struct ieee80211_link_sta.
629762306a36Sopenharmony_ci *
629862306a36Sopenharmony_ci * With non MLO the data in deflink will be referenced directly. In that case
629962306a36Sopenharmony_ci * there is no need to call this function.
630062306a36Sopenharmony_ci */
630162306a36Sopenharmony_civoid ieee80211_sta_recalc_aggregates(struct ieee80211_sta *pubsta);
630262306a36Sopenharmony_ci
630362306a36Sopenharmony_ci/**
630462306a36Sopenharmony_ci * ieee80211_sta_register_airtime - register airtime usage for a sta/tid
630562306a36Sopenharmony_ci *
630662306a36Sopenharmony_ci * Register airtime usage for a given sta on a given tid. The driver must call
630762306a36Sopenharmony_ci * this function to notify mac80211 that a station used a certain amount of
630862306a36Sopenharmony_ci * airtime. This information will be used by the TXQ scheduler to schedule
630962306a36Sopenharmony_ci * stations in a way that ensures airtime fairness.
631062306a36Sopenharmony_ci *
631162306a36Sopenharmony_ci * The reported airtime should as a minimum include all time that is spent
631262306a36Sopenharmony_ci * transmitting to the remote station, including overhead and padding, but not
631362306a36Sopenharmony_ci * including time spent waiting for a TXOP. If the time is not reported by the
631462306a36Sopenharmony_ci * hardware it can in some cases be calculated from the rate and known frame
631562306a36Sopenharmony_ci * composition. When possible, the time should include any failed transmission
631662306a36Sopenharmony_ci * attempts.
631762306a36Sopenharmony_ci *
631862306a36Sopenharmony_ci * The driver can either call this function synchronously for every packet or
631962306a36Sopenharmony_ci * aggregate, or asynchronously as airtime usage information becomes available.
632062306a36Sopenharmony_ci * TX and RX airtime can be reported together, or separately by setting one of
632162306a36Sopenharmony_ci * them to 0.
632262306a36Sopenharmony_ci *
632362306a36Sopenharmony_ci * @pubsta: the station
632462306a36Sopenharmony_ci * @tid: the TID to register airtime for
632562306a36Sopenharmony_ci * @tx_airtime: airtime used during TX (in usec)
632662306a36Sopenharmony_ci * @rx_airtime: airtime used during RX (in usec)
632762306a36Sopenharmony_ci */
632862306a36Sopenharmony_civoid ieee80211_sta_register_airtime(struct ieee80211_sta *pubsta, u8 tid,
632962306a36Sopenharmony_ci				    u32 tx_airtime, u32 rx_airtime);
633062306a36Sopenharmony_ci
633162306a36Sopenharmony_ci/**
633262306a36Sopenharmony_ci * ieee80211_txq_airtime_check - check if a txq can send frame to device
633362306a36Sopenharmony_ci *
633462306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw()
633562306a36Sopenharmony_ci * @txq: pointer obtained from station or virtual interface
633662306a36Sopenharmony_ci *
633762306a36Sopenharmony_ci * Return true if the AQL's airtime limit has not been reached and the txq can
633862306a36Sopenharmony_ci * continue to send more packets to the device. Otherwise return false.
633962306a36Sopenharmony_ci */
634062306a36Sopenharmony_cibool
634162306a36Sopenharmony_ciieee80211_txq_airtime_check(struct ieee80211_hw *hw, struct ieee80211_txq *txq);
634262306a36Sopenharmony_ci
634362306a36Sopenharmony_ci/**
634462306a36Sopenharmony_ci * ieee80211_iter_keys - iterate keys programmed into the device
634562306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw()
634662306a36Sopenharmony_ci * @vif: virtual interface to iterate, may be %NULL for all
634762306a36Sopenharmony_ci * @iter: iterator function that will be called for each key
634862306a36Sopenharmony_ci * @iter_data: custom data to pass to the iterator function
634962306a36Sopenharmony_ci *
635062306a36Sopenharmony_ci * This function can be used to iterate all the keys known to
635162306a36Sopenharmony_ci * mac80211, even those that weren't previously programmed into
635262306a36Sopenharmony_ci * the device. This is intended for use in WoWLAN if the device
635362306a36Sopenharmony_ci * needs reprogramming of the keys during suspend. Note that due
635462306a36Sopenharmony_ci * to locking reasons, it is also only safe to call this at few
635562306a36Sopenharmony_ci * spots since it must hold the RTNL and be able to sleep.
635662306a36Sopenharmony_ci *
635762306a36Sopenharmony_ci * The order in which the keys are iterated matches the order
635862306a36Sopenharmony_ci * in which they were originally installed and handed to the
635962306a36Sopenharmony_ci * set_key callback.
636062306a36Sopenharmony_ci */
636162306a36Sopenharmony_civoid ieee80211_iter_keys(struct ieee80211_hw *hw,
636262306a36Sopenharmony_ci			 struct ieee80211_vif *vif,
636362306a36Sopenharmony_ci			 void (*iter)(struct ieee80211_hw *hw,
636462306a36Sopenharmony_ci				      struct ieee80211_vif *vif,
636562306a36Sopenharmony_ci				      struct ieee80211_sta *sta,
636662306a36Sopenharmony_ci				      struct ieee80211_key_conf *key,
636762306a36Sopenharmony_ci				      void *data),
636862306a36Sopenharmony_ci			 void *iter_data);
636962306a36Sopenharmony_ci
637062306a36Sopenharmony_ci/**
637162306a36Sopenharmony_ci * ieee80211_iter_keys_rcu - iterate keys programmed into the device
637262306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw()
637362306a36Sopenharmony_ci * @vif: virtual interface to iterate, may be %NULL for all
637462306a36Sopenharmony_ci * @iter: iterator function that will be called for each key
637562306a36Sopenharmony_ci * @iter_data: custom data to pass to the iterator function
637662306a36Sopenharmony_ci *
637762306a36Sopenharmony_ci * This function can be used to iterate all the keys known to
637862306a36Sopenharmony_ci * mac80211, even those that weren't previously programmed into
637962306a36Sopenharmony_ci * the device. Note that due to locking reasons, keys of station
638062306a36Sopenharmony_ci * in removal process will be skipped.
638162306a36Sopenharmony_ci *
638262306a36Sopenharmony_ci * This function requires being called in an RCU critical section,
638362306a36Sopenharmony_ci * and thus iter must be atomic.
638462306a36Sopenharmony_ci */
638562306a36Sopenharmony_civoid ieee80211_iter_keys_rcu(struct ieee80211_hw *hw,
638662306a36Sopenharmony_ci			     struct ieee80211_vif *vif,
638762306a36Sopenharmony_ci			     void (*iter)(struct ieee80211_hw *hw,
638862306a36Sopenharmony_ci					  struct ieee80211_vif *vif,
638962306a36Sopenharmony_ci					  struct ieee80211_sta *sta,
639062306a36Sopenharmony_ci					  struct ieee80211_key_conf *key,
639162306a36Sopenharmony_ci					  void *data),
639262306a36Sopenharmony_ci			     void *iter_data);
639362306a36Sopenharmony_ci
639462306a36Sopenharmony_ci/**
639562306a36Sopenharmony_ci * ieee80211_iter_chan_contexts_atomic - iterate channel contexts
639662306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
639762306a36Sopenharmony_ci * @iter: iterator function
639862306a36Sopenharmony_ci * @iter_data: data passed to iterator function
639962306a36Sopenharmony_ci *
640062306a36Sopenharmony_ci * Iterate all active channel contexts. This function is atomic and
640162306a36Sopenharmony_ci * doesn't acquire any locks internally that might be held in other
640262306a36Sopenharmony_ci * places while calling into the driver.
640362306a36Sopenharmony_ci *
640462306a36Sopenharmony_ci * The iterator will not find a context that's being added (during
640562306a36Sopenharmony_ci * the driver callback to add it) but will find it while it's being
640662306a36Sopenharmony_ci * removed.
640762306a36Sopenharmony_ci *
640862306a36Sopenharmony_ci * Note that during hardware restart, all contexts that existed
640962306a36Sopenharmony_ci * before the restart are considered already present so will be
641062306a36Sopenharmony_ci * found while iterating, whether they've been re-added already
641162306a36Sopenharmony_ci * or not.
641262306a36Sopenharmony_ci */
641362306a36Sopenharmony_civoid ieee80211_iter_chan_contexts_atomic(
641462306a36Sopenharmony_ci	struct ieee80211_hw *hw,
641562306a36Sopenharmony_ci	void (*iter)(struct ieee80211_hw *hw,
641662306a36Sopenharmony_ci		     struct ieee80211_chanctx_conf *chanctx_conf,
641762306a36Sopenharmony_ci		     void *data),
641862306a36Sopenharmony_ci	void *iter_data);
641962306a36Sopenharmony_ci
642062306a36Sopenharmony_ci/**
642162306a36Sopenharmony_ci * ieee80211_ap_probereq_get - retrieve a Probe Request template
642262306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
642362306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
642462306a36Sopenharmony_ci *
642562306a36Sopenharmony_ci * Creates a Probe Request template which can, for example, be uploaded to
642662306a36Sopenharmony_ci * hardware. The template is filled with bssid, ssid and supported rate
642762306a36Sopenharmony_ci * information. This function must only be called from within the
642862306a36Sopenharmony_ci * .bss_info_changed callback function and only in managed mode. The function
642962306a36Sopenharmony_ci * is only useful when the interface is associated, otherwise it will return
643062306a36Sopenharmony_ci * %NULL.
643162306a36Sopenharmony_ci *
643262306a36Sopenharmony_ci * Return: The Probe Request template. %NULL on error.
643362306a36Sopenharmony_ci */
643462306a36Sopenharmony_cistruct sk_buff *ieee80211_ap_probereq_get(struct ieee80211_hw *hw,
643562306a36Sopenharmony_ci					  struct ieee80211_vif *vif);
643662306a36Sopenharmony_ci
643762306a36Sopenharmony_ci/**
643862306a36Sopenharmony_ci * ieee80211_beacon_loss - inform hardware does not receive beacons
643962306a36Sopenharmony_ci *
644062306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
644162306a36Sopenharmony_ci *
644262306a36Sopenharmony_ci * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER and
644362306a36Sopenharmony_ci * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the
644462306a36Sopenharmony_ci * hardware is not receiving beacons with this function.
644562306a36Sopenharmony_ci */
644662306a36Sopenharmony_civoid ieee80211_beacon_loss(struct ieee80211_vif *vif);
644762306a36Sopenharmony_ci
644862306a36Sopenharmony_ci/**
644962306a36Sopenharmony_ci * ieee80211_connection_loss - inform hardware has lost connection to the AP
645062306a36Sopenharmony_ci *
645162306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
645262306a36Sopenharmony_ci *
645362306a36Sopenharmony_ci * When beacon filtering is enabled with %IEEE80211_VIF_BEACON_FILTER, and
645462306a36Sopenharmony_ci * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver
645562306a36Sopenharmony_ci * needs to inform if the connection to the AP has been lost.
645662306a36Sopenharmony_ci * The function may also be called if the connection needs to be terminated
645762306a36Sopenharmony_ci * for some other reason, even if %IEEE80211_HW_CONNECTION_MONITOR isn't set.
645862306a36Sopenharmony_ci *
645962306a36Sopenharmony_ci * This function will cause immediate change to disassociated state,
646062306a36Sopenharmony_ci * without connection recovery attempts.
646162306a36Sopenharmony_ci */
646262306a36Sopenharmony_civoid ieee80211_connection_loss(struct ieee80211_vif *vif);
646362306a36Sopenharmony_ci
646462306a36Sopenharmony_ci/**
646562306a36Sopenharmony_ci * ieee80211_disconnect - request disconnection
646662306a36Sopenharmony_ci *
646762306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
646862306a36Sopenharmony_ci * @reconnect: immediate reconnect is desired
646962306a36Sopenharmony_ci *
647062306a36Sopenharmony_ci * Request disconnection from the current network and, if enabled, send a
647162306a36Sopenharmony_ci * hint to the higher layers that immediate reconnect is desired.
647262306a36Sopenharmony_ci */
647362306a36Sopenharmony_civoid ieee80211_disconnect(struct ieee80211_vif *vif, bool reconnect);
647462306a36Sopenharmony_ci
647562306a36Sopenharmony_ci/**
647662306a36Sopenharmony_ci * ieee80211_resume_disconnect - disconnect from AP after resume
647762306a36Sopenharmony_ci *
647862306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
647962306a36Sopenharmony_ci *
648062306a36Sopenharmony_ci * Instructs mac80211 to disconnect from the AP after resume.
648162306a36Sopenharmony_ci * Drivers can use this after WoWLAN if they know that the
648262306a36Sopenharmony_ci * connection cannot be kept up, for example because keys were
648362306a36Sopenharmony_ci * used while the device was asleep but the replay counters or
648462306a36Sopenharmony_ci * similar cannot be retrieved from the device during resume.
648562306a36Sopenharmony_ci *
648662306a36Sopenharmony_ci * Note that due to implementation issues, if the driver uses
648762306a36Sopenharmony_ci * the reconfiguration functionality during resume the interface
648862306a36Sopenharmony_ci * will still be added as associated first during resume and then
648962306a36Sopenharmony_ci * disconnect normally later.
649062306a36Sopenharmony_ci *
649162306a36Sopenharmony_ci * This function can only be called from the resume callback and
649262306a36Sopenharmony_ci * the driver must not be holding any of its own locks while it
649362306a36Sopenharmony_ci * calls this function, or at least not any locks it needs in the
649462306a36Sopenharmony_ci * key configuration paths (if it supports HW crypto).
649562306a36Sopenharmony_ci */
649662306a36Sopenharmony_civoid ieee80211_resume_disconnect(struct ieee80211_vif *vif);
649762306a36Sopenharmony_ci
649862306a36Sopenharmony_ci/**
649962306a36Sopenharmony_ci * ieee80211_hw_restart_disconnect - disconnect from AP after
650062306a36Sopenharmony_ci * hardware restart
650162306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
650262306a36Sopenharmony_ci *
650362306a36Sopenharmony_ci * Instructs mac80211 to disconnect from the AP after
650462306a36Sopenharmony_ci * hardware restart.
650562306a36Sopenharmony_ci */
650662306a36Sopenharmony_civoid ieee80211_hw_restart_disconnect(struct ieee80211_vif *vif);
650762306a36Sopenharmony_ci
650862306a36Sopenharmony_ci/**
650962306a36Sopenharmony_ci * ieee80211_cqm_rssi_notify - inform a configured connection quality monitoring
651062306a36Sopenharmony_ci *	rssi threshold triggered
651162306a36Sopenharmony_ci *
651262306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
651362306a36Sopenharmony_ci * @rssi_event: the RSSI trigger event type
651462306a36Sopenharmony_ci * @rssi_level: new RSSI level value or 0 if not available
651562306a36Sopenharmony_ci * @gfp: context flags
651662306a36Sopenharmony_ci *
651762306a36Sopenharmony_ci * When the %IEEE80211_VIF_SUPPORTS_CQM_RSSI is set, and a connection quality
651862306a36Sopenharmony_ci * monitoring is configured with an rssi threshold, the driver will inform
651962306a36Sopenharmony_ci * whenever the rssi level reaches the threshold.
652062306a36Sopenharmony_ci */
652162306a36Sopenharmony_civoid ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
652262306a36Sopenharmony_ci			       enum nl80211_cqm_rssi_threshold_event rssi_event,
652362306a36Sopenharmony_ci			       s32 rssi_level,
652462306a36Sopenharmony_ci			       gfp_t gfp);
652562306a36Sopenharmony_ci
652662306a36Sopenharmony_ci/**
652762306a36Sopenharmony_ci * ieee80211_cqm_beacon_loss_notify - inform CQM of beacon loss
652862306a36Sopenharmony_ci *
652962306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
653062306a36Sopenharmony_ci * @gfp: context flags
653162306a36Sopenharmony_ci */
653262306a36Sopenharmony_civoid ieee80211_cqm_beacon_loss_notify(struct ieee80211_vif *vif, gfp_t gfp);
653362306a36Sopenharmony_ci
653462306a36Sopenharmony_ci/**
653562306a36Sopenharmony_ci * ieee80211_radar_detected - inform that a radar was detected
653662306a36Sopenharmony_ci *
653762306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
653862306a36Sopenharmony_ci */
653962306a36Sopenharmony_civoid ieee80211_radar_detected(struct ieee80211_hw *hw);
654062306a36Sopenharmony_ci
654162306a36Sopenharmony_ci/**
654262306a36Sopenharmony_ci * ieee80211_chswitch_done - Complete channel switch process
654362306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
654462306a36Sopenharmony_ci * @success: make the channel switch successful or not
654562306a36Sopenharmony_ci *
654662306a36Sopenharmony_ci * Complete the channel switch post-process: set the new operational channel
654762306a36Sopenharmony_ci * and wake up the suspended queues.
654862306a36Sopenharmony_ci */
654962306a36Sopenharmony_civoid ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success);
655062306a36Sopenharmony_ci
655162306a36Sopenharmony_ci/**
655262306a36Sopenharmony_ci * ieee80211_channel_switch_disconnect - disconnect due to channel switch error
655362306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
655462306a36Sopenharmony_ci * @block_tx: if %true, do not send deauth frame.
655562306a36Sopenharmony_ci *
655662306a36Sopenharmony_ci * Instruct mac80211 to disconnect due to a channel switch error. The channel
655762306a36Sopenharmony_ci * switch can request to block the tx and so, we need to make sure we do not send
655862306a36Sopenharmony_ci * a deauth frame in this case.
655962306a36Sopenharmony_ci */
656062306a36Sopenharmony_civoid ieee80211_channel_switch_disconnect(struct ieee80211_vif *vif,
656162306a36Sopenharmony_ci					 bool block_tx);
656262306a36Sopenharmony_ci
656362306a36Sopenharmony_ci/**
656462306a36Sopenharmony_ci * ieee80211_request_smps - request SM PS transition
656562306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
656662306a36Sopenharmony_ci * @link_id: link ID for MLO, or 0
656762306a36Sopenharmony_ci * @smps_mode: new SM PS mode
656862306a36Sopenharmony_ci *
656962306a36Sopenharmony_ci * This allows the driver to request an SM PS transition in managed
657062306a36Sopenharmony_ci * mode. This is useful when the driver has more information than
657162306a36Sopenharmony_ci * the stack about possible interference, for example by bluetooth.
657262306a36Sopenharmony_ci */
657362306a36Sopenharmony_civoid ieee80211_request_smps(struct ieee80211_vif *vif, unsigned int link_id,
657462306a36Sopenharmony_ci			    enum ieee80211_smps_mode smps_mode);
657562306a36Sopenharmony_ci
657662306a36Sopenharmony_ci/**
657762306a36Sopenharmony_ci * ieee80211_ready_on_channel - notification of remain-on-channel start
657862306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
657962306a36Sopenharmony_ci */
658062306a36Sopenharmony_civoid ieee80211_ready_on_channel(struct ieee80211_hw *hw);
658162306a36Sopenharmony_ci
658262306a36Sopenharmony_ci/**
658362306a36Sopenharmony_ci * ieee80211_remain_on_channel_expired - remain_on_channel duration expired
658462306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
658562306a36Sopenharmony_ci */
658662306a36Sopenharmony_civoid ieee80211_remain_on_channel_expired(struct ieee80211_hw *hw);
658762306a36Sopenharmony_ci
658862306a36Sopenharmony_ci/**
658962306a36Sopenharmony_ci * ieee80211_stop_rx_ba_session - callback to stop existing BA sessions
659062306a36Sopenharmony_ci *
659162306a36Sopenharmony_ci * in order not to harm the system performance and user experience, the device
659262306a36Sopenharmony_ci * may request not to allow any rx ba session and tear down existing rx ba
659362306a36Sopenharmony_ci * sessions based on system constraints such as periodic BT activity that needs
659462306a36Sopenharmony_ci * to limit wlan activity (eg.sco or a2dp)."
659562306a36Sopenharmony_ci * in such cases, the intention is to limit the duration of the rx ppdu and
659662306a36Sopenharmony_ci * therefore prevent the peer device to use a-mpdu aggregation.
659762306a36Sopenharmony_ci *
659862306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
659962306a36Sopenharmony_ci * @ba_rx_bitmap: Bit map of open rx ba per tid
660062306a36Sopenharmony_ci * @addr: & to bssid mac address
660162306a36Sopenharmony_ci */
660262306a36Sopenharmony_civoid ieee80211_stop_rx_ba_session(struct ieee80211_vif *vif, u16 ba_rx_bitmap,
660362306a36Sopenharmony_ci				  const u8 *addr);
660462306a36Sopenharmony_ci
660562306a36Sopenharmony_ci/**
660662306a36Sopenharmony_ci * ieee80211_mark_rx_ba_filtered_frames - move RX BA window and mark filtered
660762306a36Sopenharmony_ci * @pubsta: station struct
660862306a36Sopenharmony_ci * @tid: the session's TID
660962306a36Sopenharmony_ci * @ssn: starting sequence number of the bitmap, all frames before this are
661062306a36Sopenharmony_ci *	assumed to be out of the window after the call
661162306a36Sopenharmony_ci * @filtered: bitmap of filtered frames, BIT(0) is the @ssn entry etc.
661262306a36Sopenharmony_ci * @received_mpdus: number of received mpdus in firmware
661362306a36Sopenharmony_ci *
661462306a36Sopenharmony_ci * This function moves the BA window and releases all frames before @ssn, and
661562306a36Sopenharmony_ci * marks frames marked in the bitmap as having been filtered. Afterwards, it
661662306a36Sopenharmony_ci * checks if any frames in the window starting from @ssn can now be released
661762306a36Sopenharmony_ci * (in case they were only waiting for frames that were filtered.)
661862306a36Sopenharmony_ci * (Only work correctly if @max_rx_aggregation_subframes <= 64 frames)
661962306a36Sopenharmony_ci */
662062306a36Sopenharmony_civoid ieee80211_mark_rx_ba_filtered_frames(struct ieee80211_sta *pubsta, u8 tid,
662162306a36Sopenharmony_ci					  u16 ssn, u64 filtered,
662262306a36Sopenharmony_ci					  u16 received_mpdus);
662362306a36Sopenharmony_ci
662462306a36Sopenharmony_ci/**
662562306a36Sopenharmony_ci * ieee80211_send_bar - send a BlockAckReq frame
662662306a36Sopenharmony_ci *
662762306a36Sopenharmony_ci * can be used to flush pending frames from the peer's aggregation reorder
662862306a36Sopenharmony_ci * buffer.
662962306a36Sopenharmony_ci *
663062306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
663162306a36Sopenharmony_ci * @ra: the peer's destination address
663262306a36Sopenharmony_ci * @tid: the TID of the aggregation session
663362306a36Sopenharmony_ci * @ssn: the new starting sequence number for the receiver
663462306a36Sopenharmony_ci */
663562306a36Sopenharmony_civoid ieee80211_send_bar(struct ieee80211_vif *vif, u8 *ra, u16 tid, u16 ssn);
663662306a36Sopenharmony_ci
663762306a36Sopenharmony_ci/**
663862306a36Sopenharmony_ci * ieee80211_manage_rx_ba_offl - helper to queue an RX BA work
663962306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback
664062306a36Sopenharmony_ci * @addr: station mac address
664162306a36Sopenharmony_ci * @tid: the rx tid
664262306a36Sopenharmony_ci */
664362306a36Sopenharmony_civoid ieee80211_manage_rx_ba_offl(struct ieee80211_vif *vif, const u8 *addr,
664462306a36Sopenharmony_ci				 unsigned int tid);
664562306a36Sopenharmony_ci
664662306a36Sopenharmony_ci/**
664762306a36Sopenharmony_ci * ieee80211_start_rx_ba_session_offl - start a Rx BA session
664862306a36Sopenharmony_ci *
664962306a36Sopenharmony_ci * Some device drivers may offload part of the Rx aggregation flow including
665062306a36Sopenharmony_ci * AddBa/DelBa negotiation but may otherwise be incapable of full Rx
665162306a36Sopenharmony_ci * reordering.
665262306a36Sopenharmony_ci *
665362306a36Sopenharmony_ci * Create structures responsible for reordering so device drivers may call here
665462306a36Sopenharmony_ci * when they complete AddBa negotiation.
665562306a36Sopenharmony_ci *
665662306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback
665762306a36Sopenharmony_ci * @addr: station mac address
665862306a36Sopenharmony_ci * @tid: the rx tid
665962306a36Sopenharmony_ci */
666062306a36Sopenharmony_cistatic inline void ieee80211_start_rx_ba_session_offl(struct ieee80211_vif *vif,
666162306a36Sopenharmony_ci						      const u8 *addr, u16 tid)
666262306a36Sopenharmony_ci{
666362306a36Sopenharmony_ci	if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
666462306a36Sopenharmony_ci		return;
666562306a36Sopenharmony_ci	ieee80211_manage_rx_ba_offl(vif, addr, tid);
666662306a36Sopenharmony_ci}
666762306a36Sopenharmony_ci
666862306a36Sopenharmony_ci/**
666962306a36Sopenharmony_ci * ieee80211_stop_rx_ba_session_offl - stop a Rx BA session
667062306a36Sopenharmony_ci *
667162306a36Sopenharmony_ci * Some device drivers may offload part of the Rx aggregation flow including
667262306a36Sopenharmony_ci * AddBa/DelBa negotiation but may otherwise be incapable of full Rx
667362306a36Sopenharmony_ci * reordering.
667462306a36Sopenharmony_ci *
667562306a36Sopenharmony_ci * Destroy structures responsible for reordering so device drivers may call here
667662306a36Sopenharmony_ci * when they complete DelBa negotiation.
667762306a36Sopenharmony_ci *
667862306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback
667962306a36Sopenharmony_ci * @addr: station mac address
668062306a36Sopenharmony_ci * @tid: the rx tid
668162306a36Sopenharmony_ci */
668262306a36Sopenharmony_cistatic inline void ieee80211_stop_rx_ba_session_offl(struct ieee80211_vif *vif,
668362306a36Sopenharmony_ci						     const u8 *addr, u16 tid)
668462306a36Sopenharmony_ci{
668562306a36Sopenharmony_ci	if (WARN_ON(tid >= IEEE80211_NUM_TIDS))
668662306a36Sopenharmony_ci		return;
668762306a36Sopenharmony_ci	ieee80211_manage_rx_ba_offl(vif, addr, tid + IEEE80211_NUM_TIDS);
668862306a36Sopenharmony_ci}
668962306a36Sopenharmony_ci
669062306a36Sopenharmony_ci/**
669162306a36Sopenharmony_ci * ieee80211_rx_ba_timer_expired - stop a Rx BA session due to timeout
669262306a36Sopenharmony_ci *
669362306a36Sopenharmony_ci * Some device drivers do not offload AddBa/DelBa negotiation, but handle rx
669462306a36Sopenharmony_ci * buffer reording internally, and therefore also handle the session timer.
669562306a36Sopenharmony_ci *
669662306a36Sopenharmony_ci * Trigger the timeout flow, which sends a DelBa.
669762306a36Sopenharmony_ci *
669862306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback
669962306a36Sopenharmony_ci * @addr: station mac address
670062306a36Sopenharmony_ci * @tid: the rx tid
670162306a36Sopenharmony_ci */
670262306a36Sopenharmony_civoid ieee80211_rx_ba_timer_expired(struct ieee80211_vif *vif,
670362306a36Sopenharmony_ci				   const u8 *addr, unsigned int tid);
670462306a36Sopenharmony_ci
670562306a36Sopenharmony_ci/* Rate control API */
670662306a36Sopenharmony_ci
670762306a36Sopenharmony_ci/**
670862306a36Sopenharmony_ci * struct ieee80211_tx_rate_control - rate control information for/from RC algo
670962306a36Sopenharmony_ci *
671062306a36Sopenharmony_ci * @hw: The hardware the algorithm is invoked for.
671162306a36Sopenharmony_ci * @sband: The band this frame is being transmitted on.
671262306a36Sopenharmony_ci * @bss_conf: the current BSS configuration
671362306a36Sopenharmony_ci * @skb: the skb that will be transmitted, the control information in it needs
671462306a36Sopenharmony_ci *	to be filled in
671562306a36Sopenharmony_ci * @reported_rate: The rate control algorithm can fill this in to indicate
671662306a36Sopenharmony_ci *	which rate should be reported to userspace as the current rate and
671762306a36Sopenharmony_ci *	used for rate calculations in the mesh network.
671862306a36Sopenharmony_ci * @rts: whether RTS will be used for this frame because it is longer than the
671962306a36Sopenharmony_ci *	RTS threshold
672062306a36Sopenharmony_ci * @short_preamble: whether mac80211 will request short-preamble transmission
672162306a36Sopenharmony_ci *	if the selected rate supports it
672262306a36Sopenharmony_ci * @rate_idx_mask: user-requested (legacy) rate mask
672362306a36Sopenharmony_ci * @rate_idx_mcs_mask: user-requested MCS rate mask (NULL if not in use)
672462306a36Sopenharmony_ci * @bss: whether this frame is sent out in AP or IBSS mode
672562306a36Sopenharmony_ci */
672662306a36Sopenharmony_cistruct ieee80211_tx_rate_control {
672762306a36Sopenharmony_ci	struct ieee80211_hw *hw;
672862306a36Sopenharmony_ci	struct ieee80211_supported_band *sband;
672962306a36Sopenharmony_ci	struct ieee80211_bss_conf *bss_conf;
673062306a36Sopenharmony_ci	struct sk_buff *skb;
673162306a36Sopenharmony_ci	struct ieee80211_tx_rate reported_rate;
673262306a36Sopenharmony_ci	bool rts, short_preamble;
673362306a36Sopenharmony_ci	u32 rate_idx_mask;
673462306a36Sopenharmony_ci	u8 *rate_idx_mcs_mask;
673562306a36Sopenharmony_ci	bool bss;
673662306a36Sopenharmony_ci};
673762306a36Sopenharmony_ci
673862306a36Sopenharmony_ci/**
673962306a36Sopenharmony_ci * enum rate_control_capabilities - rate control capabilities
674062306a36Sopenharmony_ci */
674162306a36Sopenharmony_cienum rate_control_capabilities {
674262306a36Sopenharmony_ci	/**
674362306a36Sopenharmony_ci	 * @RATE_CTRL_CAPA_VHT_EXT_NSS_BW:
674462306a36Sopenharmony_ci	 * Support for extended NSS BW support (dot11VHTExtendedNSSCapable)
674562306a36Sopenharmony_ci	 * Note that this is only looked at if the minimum number of chains
674662306a36Sopenharmony_ci	 * that the AP uses is < the number of TX chains the hardware has,
674762306a36Sopenharmony_ci	 * otherwise the NSS difference doesn't bother us.
674862306a36Sopenharmony_ci	 */
674962306a36Sopenharmony_ci	RATE_CTRL_CAPA_VHT_EXT_NSS_BW = BIT(0),
675062306a36Sopenharmony_ci	/**
675162306a36Sopenharmony_ci	 * @RATE_CTRL_CAPA_AMPDU_TRIGGER:
675262306a36Sopenharmony_ci	 * mac80211 should start A-MPDU sessions on tx
675362306a36Sopenharmony_ci	 */
675462306a36Sopenharmony_ci	RATE_CTRL_CAPA_AMPDU_TRIGGER = BIT(1),
675562306a36Sopenharmony_ci};
675662306a36Sopenharmony_ci
675762306a36Sopenharmony_cistruct rate_control_ops {
675862306a36Sopenharmony_ci	unsigned long capa;
675962306a36Sopenharmony_ci	const char *name;
676062306a36Sopenharmony_ci	void *(*alloc)(struct ieee80211_hw *hw);
676162306a36Sopenharmony_ci	void (*add_debugfs)(struct ieee80211_hw *hw, void *priv,
676262306a36Sopenharmony_ci			    struct dentry *debugfsdir);
676362306a36Sopenharmony_ci	void (*free)(void *priv);
676462306a36Sopenharmony_ci
676562306a36Sopenharmony_ci	void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp);
676662306a36Sopenharmony_ci	void (*rate_init)(void *priv, struct ieee80211_supported_band *sband,
676762306a36Sopenharmony_ci			  struct cfg80211_chan_def *chandef,
676862306a36Sopenharmony_ci			  struct ieee80211_sta *sta, void *priv_sta);
676962306a36Sopenharmony_ci	void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
677062306a36Sopenharmony_ci			    struct cfg80211_chan_def *chandef,
677162306a36Sopenharmony_ci			    struct ieee80211_sta *sta, void *priv_sta,
677262306a36Sopenharmony_ci			    u32 changed);
677362306a36Sopenharmony_ci	void (*free_sta)(void *priv, struct ieee80211_sta *sta,
677462306a36Sopenharmony_ci			 void *priv_sta);
677562306a36Sopenharmony_ci
677662306a36Sopenharmony_ci	void (*tx_status_ext)(void *priv,
677762306a36Sopenharmony_ci			      struct ieee80211_supported_band *sband,
677862306a36Sopenharmony_ci			      void *priv_sta, struct ieee80211_tx_status *st);
677962306a36Sopenharmony_ci	void (*tx_status)(void *priv, struct ieee80211_supported_band *sband,
678062306a36Sopenharmony_ci			  struct ieee80211_sta *sta, void *priv_sta,
678162306a36Sopenharmony_ci			  struct sk_buff *skb);
678262306a36Sopenharmony_ci	void (*get_rate)(void *priv, struct ieee80211_sta *sta, void *priv_sta,
678362306a36Sopenharmony_ci			 struct ieee80211_tx_rate_control *txrc);
678462306a36Sopenharmony_ci
678562306a36Sopenharmony_ci	void (*add_sta_debugfs)(void *priv, void *priv_sta,
678662306a36Sopenharmony_ci				struct dentry *dir);
678762306a36Sopenharmony_ci
678862306a36Sopenharmony_ci	u32 (*get_expected_throughput)(void *priv_sta);
678962306a36Sopenharmony_ci};
679062306a36Sopenharmony_ci
679162306a36Sopenharmony_cistatic inline int rate_supported(struct ieee80211_sta *sta,
679262306a36Sopenharmony_ci				 enum nl80211_band band,
679362306a36Sopenharmony_ci				 int index)
679462306a36Sopenharmony_ci{
679562306a36Sopenharmony_ci	return (sta == NULL || sta->deflink.supp_rates[band] & BIT(index));
679662306a36Sopenharmony_ci}
679762306a36Sopenharmony_ci
679862306a36Sopenharmony_cistatic inline s8
679962306a36Sopenharmony_cirate_lowest_index(struct ieee80211_supported_band *sband,
680062306a36Sopenharmony_ci		  struct ieee80211_sta *sta)
680162306a36Sopenharmony_ci{
680262306a36Sopenharmony_ci	int i;
680362306a36Sopenharmony_ci
680462306a36Sopenharmony_ci	for (i = 0; i < sband->n_bitrates; i++)
680562306a36Sopenharmony_ci		if (rate_supported(sta, sband->band, i))
680662306a36Sopenharmony_ci			return i;
680762306a36Sopenharmony_ci
680862306a36Sopenharmony_ci	/* warn when we cannot find a rate. */
680962306a36Sopenharmony_ci	WARN_ON_ONCE(1);
681062306a36Sopenharmony_ci
681162306a36Sopenharmony_ci	/* and return 0 (the lowest index) */
681262306a36Sopenharmony_ci	return 0;
681362306a36Sopenharmony_ci}
681462306a36Sopenharmony_ci
681562306a36Sopenharmony_cistatic inline
681662306a36Sopenharmony_cibool rate_usable_index_exists(struct ieee80211_supported_band *sband,
681762306a36Sopenharmony_ci			      struct ieee80211_sta *sta)
681862306a36Sopenharmony_ci{
681962306a36Sopenharmony_ci	unsigned int i;
682062306a36Sopenharmony_ci
682162306a36Sopenharmony_ci	for (i = 0; i < sband->n_bitrates; i++)
682262306a36Sopenharmony_ci		if (rate_supported(sta, sband->band, i))
682362306a36Sopenharmony_ci			return true;
682462306a36Sopenharmony_ci	return false;
682562306a36Sopenharmony_ci}
682662306a36Sopenharmony_ci
682762306a36Sopenharmony_ci/**
682862306a36Sopenharmony_ci * rate_control_set_rates - pass the sta rate selection to mac80211/driver
682962306a36Sopenharmony_ci *
683062306a36Sopenharmony_ci * When not doing a rate control probe to test rates, rate control should pass
683162306a36Sopenharmony_ci * its rate selection to mac80211. If the driver supports receiving a station
683262306a36Sopenharmony_ci * rate table, it will use it to ensure that frames are always sent based on
683362306a36Sopenharmony_ci * the most recent rate control module decision.
683462306a36Sopenharmony_ci *
683562306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
683662306a36Sopenharmony_ci * @pubsta: &struct ieee80211_sta pointer to the target destination.
683762306a36Sopenharmony_ci * @rates: new tx rate set to be used for this station.
683862306a36Sopenharmony_ci */
683962306a36Sopenharmony_ciint rate_control_set_rates(struct ieee80211_hw *hw,
684062306a36Sopenharmony_ci			   struct ieee80211_sta *pubsta,
684162306a36Sopenharmony_ci			   struct ieee80211_sta_rates *rates);
684262306a36Sopenharmony_ci
684362306a36Sopenharmony_ciint ieee80211_rate_control_register(const struct rate_control_ops *ops);
684462306a36Sopenharmony_civoid ieee80211_rate_control_unregister(const struct rate_control_ops *ops);
684562306a36Sopenharmony_ci
684662306a36Sopenharmony_cistatic inline bool
684762306a36Sopenharmony_ciconf_is_ht20(struct ieee80211_conf *conf)
684862306a36Sopenharmony_ci{
684962306a36Sopenharmony_ci	return conf->chandef.width == NL80211_CHAN_WIDTH_20;
685062306a36Sopenharmony_ci}
685162306a36Sopenharmony_ci
685262306a36Sopenharmony_cistatic inline bool
685362306a36Sopenharmony_ciconf_is_ht40_minus(struct ieee80211_conf *conf)
685462306a36Sopenharmony_ci{
685562306a36Sopenharmony_ci	return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
685662306a36Sopenharmony_ci	       conf->chandef.center_freq1 < conf->chandef.chan->center_freq;
685762306a36Sopenharmony_ci}
685862306a36Sopenharmony_ci
685962306a36Sopenharmony_cistatic inline bool
686062306a36Sopenharmony_ciconf_is_ht40_plus(struct ieee80211_conf *conf)
686162306a36Sopenharmony_ci{
686262306a36Sopenharmony_ci	return conf->chandef.width == NL80211_CHAN_WIDTH_40 &&
686362306a36Sopenharmony_ci	       conf->chandef.center_freq1 > conf->chandef.chan->center_freq;
686462306a36Sopenharmony_ci}
686562306a36Sopenharmony_ci
686662306a36Sopenharmony_cistatic inline bool
686762306a36Sopenharmony_ciconf_is_ht40(struct ieee80211_conf *conf)
686862306a36Sopenharmony_ci{
686962306a36Sopenharmony_ci	return conf->chandef.width == NL80211_CHAN_WIDTH_40;
687062306a36Sopenharmony_ci}
687162306a36Sopenharmony_ci
687262306a36Sopenharmony_cistatic inline bool
687362306a36Sopenharmony_ciconf_is_ht(struct ieee80211_conf *conf)
687462306a36Sopenharmony_ci{
687562306a36Sopenharmony_ci	return (conf->chandef.width != NL80211_CHAN_WIDTH_5) &&
687662306a36Sopenharmony_ci		(conf->chandef.width != NL80211_CHAN_WIDTH_10) &&
687762306a36Sopenharmony_ci		(conf->chandef.width != NL80211_CHAN_WIDTH_20_NOHT);
687862306a36Sopenharmony_ci}
687962306a36Sopenharmony_ci
688062306a36Sopenharmony_cistatic inline enum nl80211_iftype
688162306a36Sopenharmony_ciieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p)
688262306a36Sopenharmony_ci{
688362306a36Sopenharmony_ci	if (p2p) {
688462306a36Sopenharmony_ci		switch (type) {
688562306a36Sopenharmony_ci		case NL80211_IFTYPE_STATION:
688662306a36Sopenharmony_ci			return NL80211_IFTYPE_P2P_CLIENT;
688762306a36Sopenharmony_ci		case NL80211_IFTYPE_AP:
688862306a36Sopenharmony_ci			return NL80211_IFTYPE_P2P_GO;
688962306a36Sopenharmony_ci		default:
689062306a36Sopenharmony_ci			break;
689162306a36Sopenharmony_ci		}
689262306a36Sopenharmony_ci	}
689362306a36Sopenharmony_ci	return type;
689462306a36Sopenharmony_ci}
689562306a36Sopenharmony_ci
689662306a36Sopenharmony_cistatic inline enum nl80211_iftype
689762306a36Sopenharmony_ciieee80211_vif_type_p2p(struct ieee80211_vif *vif)
689862306a36Sopenharmony_ci{
689962306a36Sopenharmony_ci	return ieee80211_iftype_p2p(vif->type, vif->p2p);
690062306a36Sopenharmony_ci}
690162306a36Sopenharmony_ci
690262306a36Sopenharmony_ci/**
690362306a36Sopenharmony_ci * ieee80211_get_he_iftype_cap_vif - return HE capabilities for sband/vif
690462306a36Sopenharmony_ci * @sband: the sband to search for the iftype on
690562306a36Sopenharmony_ci * @vif: the vif to get the iftype from
690662306a36Sopenharmony_ci *
690762306a36Sopenharmony_ci * Return: pointer to the struct ieee80211_sta_he_cap, or %NULL is none found
690862306a36Sopenharmony_ci */
690962306a36Sopenharmony_cistatic inline const struct ieee80211_sta_he_cap *
691062306a36Sopenharmony_ciieee80211_get_he_iftype_cap_vif(const struct ieee80211_supported_band *sband,
691162306a36Sopenharmony_ci				struct ieee80211_vif *vif)
691262306a36Sopenharmony_ci{
691362306a36Sopenharmony_ci	return ieee80211_get_he_iftype_cap(sband, ieee80211_vif_type_p2p(vif));
691462306a36Sopenharmony_ci}
691562306a36Sopenharmony_ci
691662306a36Sopenharmony_ci/**
691762306a36Sopenharmony_ci * ieee80211_get_he_6ghz_capa_vif - return HE 6 GHz capabilities
691862306a36Sopenharmony_ci * @sband: the sband to search for the STA on
691962306a36Sopenharmony_ci * @vif: the vif to get the iftype from
692062306a36Sopenharmony_ci *
692162306a36Sopenharmony_ci * Return: the 6GHz capabilities
692262306a36Sopenharmony_ci */
692362306a36Sopenharmony_cistatic inline __le16
692462306a36Sopenharmony_ciieee80211_get_he_6ghz_capa_vif(const struct ieee80211_supported_band *sband,
692562306a36Sopenharmony_ci			       struct ieee80211_vif *vif)
692662306a36Sopenharmony_ci{
692762306a36Sopenharmony_ci	return ieee80211_get_he_6ghz_capa(sband, ieee80211_vif_type_p2p(vif));
692862306a36Sopenharmony_ci}
692962306a36Sopenharmony_ci
693062306a36Sopenharmony_ci/**
693162306a36Sopenharmony_ci * ieee80211_get_eht_iftype_cap_vif - return ETH capabilities for sband/vif
693262306a36Sopenharmony_ci * @sband: the sband to search for the iftype on
693362306a36Sopenharmony_ci * @vif: the vif to get the iftype from
693462306a36Sopenharmony_ci *
693562306a36Sopenharmony_ci * Return: pointer to the struct ieee80211_sta_eht_cap, or %NULL is none found
693662306a36Sopenharmony_ci */
693762306a36Sopenharmony_cistatic inline const struct ieee80211_sta_eht_cap *
693862306a36Sopenharmony_ciieee80211_get_eht_iftype_cap_vif(const struct ieee80211_supported_band *sband,
693962306a36Sopenharmony_ci				 struct ieee80211_vif *vif)
694062306a36Sopenharmony_ci{
694162306a36Sopenharmony_ci	return ieee80211_get_eht_iftype_cap(sband, ieee80211_vif_type_p2p(vif));
694262306a36Sopenharmony_ci}
694362306a36Sopenharmony_ci
694462306a36Sopenharmony_ci/**
694562306a36Sopenharmony_ci * ieee80211_update_mu_groups - set the VHT MU-MIMO groud data
694662306a36Sopenharmony_ci *
694762306a36Sopenharmony_ci * @vif: the specified virtual interface
694862306a36Sopenharmony_ci * @link_id: the link ID for MLO, otherwise 0
694962306a36Sopenharmony_ci * @membership: 64 bits array - a bit is set if station is member of the group
695062306a36Sopenharmony_ci * @position: 2 bits per group id indicating the position in the group
695162306a36Sopenharmony_ci *
695262306a36Sopenharmony_ci * Note: This function assumes that the given vif is valid and the position and
695362306a36Sopenharmony_ci * membership data is of the correct size and are in the same byte order as the
695462306a36Sopenharmony_ci * matching GroupId management frame.
695562306a36Sopenharmony_ci * Calls to this function need to be serialized with RX path.
695662306a36Sopenharmony_ci */
695762306a36Sopenharmony_civoid ieee80211_update_mu_groups(struct ieee80211_vif *vif, unsigned int link_id,
695862306a36Sopenharmony_ci				const u8 *membership, const u8 *position);
695962306a36Sopenharmony_ci
696062306a36Sopenharmony_civoid ieee80211_enable_rssi_reports(struct ieee80211_vif *vif,
696162306a36Sopenharmony_ci				   int rssi_min_thold,
696262306a36Sopenharmony_ci				   int rssi_max_thold);
696362306a36Sopenharmony_ci
696462306a36Sopenharmony_civoid ieee80211_disable_rssi_reports(struct ieee80211_vif *vif);
696562306a36Sopenharmony_ci
696662306a36Sopenharmony_ci/**
696762306a36Sopenharmony_ci * ieee80211_ave_rssi - report the average RSSI for the specified interface
696862306a36Sopenharmony_ci *
696962306a36Sopenharmony_ci * @vif: the specified virtual interface
697062306a36Sopenharmony_ci *
697162306a36Sopenharmony_ci * Note: This function assumes that the given vif is valid.
697262306a36Sopenharmony_ci *
697362306a36Sopenharmony_ci * Return: The average RSSI value for the requested interface, or 0 if not
697462306a36Sopenharmony_ci * applicable.
697562306a36Sopenharmony_ci */
697662306a36Sopenharmony_ciint ieee80211_ave_rssi(struct ieee80211_vif *vif);
697762306a36Sopenharmony_ci
697862306a36Sopenharmony_ci/**
697962306a36Sopenharmony_ci * ieee80211_report_wowlan_wakeup - report WoWLAN wakeup
698062306a36Sopenharmony_ci * @vif: virtual interface
698162306a36Sopenharmony_ci * @wakeup: wakeup reason(s)
698262306a36Sopenharmony_ci * @gfp: allocation flags
698362306a36Sopenharmony_ci *
698462306a36Sopenharmony_ci * See cfg80211_report_wowlan_wakeup().
698562306a36Sopenharmony_ci */
698662306a36Sopenharmony_civoid ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
698762306a36Sopenharmony_ci				    struct cfg80211_wowlan_wakeup *wakeup,
698862306a36Sopenharmony_ci				    gfp_t gfp);
698962306a36Sopenharmony_ci
699062306a36Sopenharmony_ci/**
699162306a36Sopenharmony_ci * ieee80211_tx_prepare_skb - prepare an 802.11 skb for transmission
699262306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
699362306a36Sopenharmony_ci * @vif: virtual interface
699462306a36Sopenharmony_ci * @skb: frame to be sent from within the driver
699562306a36Sopenharmony_ci * @band: the band to transmit on
699662306a36Sopenharmony_ci * @sta: optional pointer to get the station to send the frame to
699762306a36Sopenharmony_ci *
699862306a36Sopenharmony_ci * Note: must be called under RCU lock
699962306a36Sopenharmony_ci */
700062306a36Sopenharmony_cibool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
700162306a36Sopenharmony_ci			      struct ieee80211_vif *vif, struct sk_buff *skb,
700262306a36Sopenharmony_ci			      int band, struct ieee80211_sta **sta);
700362306a36Sopenharmony_ci
700462306a36Sopenharmony_ci/**
700562306a36Sopenharmony_ci * ieee80211_parse_tx_radiotap - Sanity-check and parse the radiotap header
700662306a36Sopenharmony_ci *				 of injected frames.
700762306a36Sopenharmony_ci *
700862306a36Sopenharmony_ci * To accurately parse and take into account rate and retransmission fields,
700962306a36Sopenharmony_ci * you must initialize the chandef field in the ieee80211_tx_info structure
701062306a36Sopenharmony_ci * of the skb before calling this function.
701162306a36Sopenharmony_ci *
701262306a36Sopenharmony_ci * @skb: packet injected by userspace
701362306a36Sopenharmony_ci * @dev: the &struct device of this 802.11 device
701462306a36Sopenharmony_ci */
701562306a36Sopenharmony_cibool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
701662306a36Sopenharmony_ci				 struct net_device *dev);
701762306a36Sopenharmony_ci
701862306a36Sopenharmony_ci/**
701962306a36Sopenharmony_ci * struct ieee80211_noa_data - holds temporary data for tracking P2P NoA state
702062306a36Sopenharmony_ci *
702162306a36Sopenharmony_ci * @next_tsf: TSF timestamp of the next absent state change
702262306a36Sopenharmony_ci * @has_next_tsf: next absent state change event pending
702362306a36Sopenharmony_ci *
702462306a36Sopenharmony_ci * @absent: descriptor bitmask, set if GO is currently absent
702562306a36Sopenharmony_ci *
702662306a36Sopenharmony_ci * private:
702762306a36Sopenharmony_ci *
702862306a36Sopenharmony_ci * @count: count fields from the NoA descriptors
702962306a36Sopenharmony_ci * @desc: adjusted data from the NoA
703062306a36Sopenharmony_ci */
703162306a36Sopenharmony_cistruct ieee80211_noa_data {
703262306a36Sopenharmony_ci	u32 next_tsf;
703362306a36Sopenharmony_ci	bool has_next_tsf;
703462306a36Sopenharmony_ci
703562306a36Sopenharmony_ci	u8 absent;
703662306a36Sopenharmony_ci
703762306a36Sopenharmony_ci	u8 count[IEEE80211_P2P_NOA_DESC_MAX];
703862306a36Sopenharmony_ci	struct {
703962306a36Sopenharmony_ci		u32 start;
704062306a36Sopenharmony_ci		u32 duration;
704162306a36Sopenharmony_ci		u32 interval;
704262306a36Sopenharmony_ci	} desc[IEEE80211_P2P_NOA_DESC_MAX];
704362306a36Sopenharmony_ci};
704462306a36Sopenharmony_ci
704562306a36Sopenharmony_ci/**
704662306a36Sopenharmony_ci * ieee80211_parse_p2p_noa - initialize NoA tracking data from P2P IE
704762306a36Sopenharmony_ci *
704862306a36Sopenharmony_ci * @attr: P2P NoA IE
704962306a36Sopenharmony_ci * @data: NoA tracking data
705062306a36Sopenharmony_ci * @tsf: current TSF timestamp
705162306a36Sopenharmony_ci *
705262306a36Sopenharmony_ci * Return: number of successfully parsed descriptors
705362306a36Sopenharmony_ci */
705462306a36Sopenharmony_ciint ieee80211_parse_p2p_noa(const struct ieee80211_p2p_noa_attr *attr,
705562306a36Sopenharmony_ci			    struct ieee80211_noa_data *data, u32 tsf);
705662306a36Sopenharmony_ci
705762306a36Sopenharmony_ci/**
705862306a36Sopenharmony_ci * ieee80211_update_p2p_noa - get next pending P2P GO absent state change
705962306a36Sopenharmony_ci *
706062306a36Sopenharmony_ci * @data: NoA tracking data
706162306a36Sopenharmony_ci * @tsf: current TSF timestamp
706262306a36Sopenharmony_ci */
706362306a36Sopenharmony_civoid ieee80211_update_p2p_noa(struct ieee80211_noa_data *data, u32 tsf);
706462306a36Sopenharmony_ci
706562306a36Sopenharmony_ci/**
706662306a36Sopenharmony_ci * ieee80211_tdls_oper_request - request userspace to perform a TDLS operation
706762306a36Sopenharmony_ci * @vif: virtual interface
706862306a36Sopenharmony_ci * @peer: the peer's destination address
706962306a36Sopenharmony_ci * @oper: the requested TDLS operation
707062306a36Sopenharmony_ci * @reason_code: reason code for the operation, valid for TDLS teardown
707162306a36Sopenharmony_ci * @gfp: allocation flags
707262306a36Sopenharmony_ci *
707362306a36Sopenharmony_ci * See cfg80211_tdls_oper_request().
707462306a36Sopenharmony_ci */
707562306a36Sopenharmony_civoid ieee80211_tdls_oper_request(struct ieee80211_vif *vif, const u8 *peer,
707662306a36Sopenharmony_ci				 enum nl80211_tdls_operation oper,
707762306a36Sopenharmony_ci				 u16 reason_code, gfp_t gfp);
707862306a36Sopenharmony_ci
707962306a36Sopenharmony_ci/**
708062306a36Sopenharmony_ci * ieee80211_reserve_tid - request to reserve a specific TID
708162306a36Sopenharmony_ci *
708262306a36Sopenharmony_ci * There is sometimes a need (such as in TDLS) for blocking the driver from
708362306a36Sopenharmony_ci * using a specific TID so that the FW can use it for certain operations such
708462306a36Sopenharmony_ci * as sending PTI requests. To make sure that the driver doesn't use that TID,
708562306a36Sopenharmony_ci * this function must be called as it flushes out packets on this TID and marks
708662306a36Sopenharmony_ci * it as blocked, so that any transmit for the station on this TID will be
708762306a36Sopenharmony_ci * redirected to the alternative TID in the same AC.
708862306a36Sopenharmony_ci *
708962306a36Sopenharmony_ci * Note that this function blocks and may call back into the driver, so it
709062306a36Sopenharmony_ci * should be called without driver locks held. Also note this function should
709162306a36Sopenharmony_ci * only be called from the driver's @sta_state callback.
709262306a36Sopenharmony_ci *
709362306a36Sopenharmony_ci * @sta: the station to reserve the TID for
709462306a36Sopenharmony_ci * @tid: the TID to reserve
709562306a36Sopenharmony_ci *
709662306a36Sopenharmony_ci * Returns: 0 on success, else on failure
709762306a36Sopenharmony_ci */
709862306a36Sopenharmony_ciint ieee80211_reserve_tid(struct ieee80211_sta *sta, u8 tid);
709962306a36Sopenharmony_ci
710062306a36Sopenharmony_ci/**
710162306a36Sopenharmony_ci * ieee80211_unreserve_tid - request to unreserve a specific TID
710262306a36Sopenharmony_ci *
710362306a36Sopenharmony_ci * Once there is no longer any need for reserving a certain TID, this function
710462306a36Sopenharmony_ci * should be called, and no longer will packets have their TID modified for
710562306a36Sopenharmony_ci * preventing use of this TID in the driver.
710662306a36Sopenharmony_ci *
710762306a36Sopenharmony_ci * Note that this function blocks and acquires a lock, so it should be called
710862306a36Sopenharmony_ci * without driver locks held. Also note this function should only be called
710962306a36Sopenharmony_ci * from the driver's @sta_state callback.
711062306a36Sopenharmony_ci *
711162306a36Sopenharmony_ci * @sta: the station
711262306a36Sopenharmony_ci * @tid: the TID to unreserve
711362306a36Sopenharmony_ci */
711462306a36Sopenharmony_civoid ieee80211_unreserve_tid(struct ieee80211_sta *sta, u8 tid);
711562306a36Sopenharmony_ci
711662306a36Sopenharmony_ci/**
711762306a36Sopenharmony_ci * ieee80211_tx_dequeue - dequeue a packet from a software tx queue
711862306a36Sopenharmony_ci *
711962306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
712062306a36Sopenharmony_ci * @txq: pointer obtained from station or virtual interface, or from
712162306a36Sopenharmony_ci *	ieee80211_next_txq()
712262306a36Sopenharmony_ci *
712362306a36Sopenharmony_ci * Returns the skb if successful, %NULL if no frame was available.
712462306a36Sopenharmony_ci *
712562306a36Sopenharmony_ci * Note that this must be called in an rcu_read_lock() critical section,
712662306a36Sopenharmony_ci * which can only be released after the SKB was handled. Some pointers in
712762306a36Sopenharmony_ci * skb->cb, e.g. the key pointer, are protected by RCU and thus the
712862306a36Sopenharmony_ci * critical section must persist not just for the duration of this call
712962306a36Sopenharmony_ci * but for the duration of the frame handling.
713062306a36Sopenharmony_ci * However, also note that while in the wake_tx_queue() method,
713162306a36Sopenharmony_ci * rcu_read_lock() is already held.
713262306a36Sopenharmony_ci *
713362306a36Sopenharmony_ci * softirqs must also be disabled when this function is called.
713462306a36Sopenharmony_ci * In process context, use ieee80211_tx_dequeue_ni() instead.
713562306a36Sopenharmony_ci */
713662306a36Sopenharmony_cistruct sk_buff *ieee80211_tx_dequeue(struct ieee80211_hw *hw,
713762306a36Sopenharmony_ci				     struct ieee80211_txq *txq);
713862306a36Sopenharmony_ci
713962306a36Sopenharmony_ci/**
714062306a36Sopenharmony_ci * ieee80211_tx_dequeue_ni - dequeue a packet from a software tx queue
714162306a36Sopenharmony_ci * (in process context)
714262306a36Sopenharmony_ci *
714362306a36Sopenharmony_ci * Like ieee80211_tx_dequeue() but can be called in process context
714462306a36Sopenharmony_ci * (internally disables bottom halves).
714562306a36Sopenharmony_ci *
714662306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
714762306a36Sopenharmony_ci * @txq: pointer obtained from station or virtual interface, or from
714862306a36Sopenharmony_ci *	ieee80211_next_txq()
714962306a36Sopenharmony_ci */
715062306a36Sopenharmony_cistatic inline struct sk_buff *ieee80211_tx_dequeue_ni(struct ieee80211_hw *hw,
715162306a36Sopenharmony_ci						      struct ieee80211_txq *txq)
715262306a36Sopenharmony_ci{
715362306a36Sopenharmony_ci	struct sk_buff *skb;
715462306a36Sopenharmony_ci
715562306a36Sopenharmony_ci	local_bh_disable();
715662306a36Sopenharmony_ci	skb = ieee80211_tx_dequeue(hw, txq);
715762306a36Sopenharmony_ci	local_bh_enable();
715862306a36Sopenharmony_ci
715962306a36Sopenharmony_ci	return skb;
716062306a36Sopenharmony_ci}
716162306a36Sopenharmony_ci
716262306a36Sopenharmony_ci/**
716362306a36Sopenharmony_ci * ieee80211_handle_wake_tx_queue - mac80211 handler for wake_tx_queue callback
716462306a36Sopenharmony_ci *
716562306a36Sopenharmony_ci * @hw: pointer as obtained from wake_tx_queue() callback().
716662306a36Sopenharmony_ci * @txq: pointer as obtained from wake_tx_queue() callback().
716762306a36Sopenharmony_ci *
716862306a36Sopenharmony_ci * Drivers can use this function for the mandatory mac80211 wake_tx_queue
716962306a36Sopenharmony_ci * callback in struct ieee80211_ops. They should not call this function.
717062306a36Sopenharmony_ci */
717162306a36Sopenharmony_civoid ieee80211_handle_wake_tx_queue(struct ieee80211_hw *hw,
717262306a36Sopenharmony_ci				    struct ieee80211_txq *txq);
717362306a36Sopenharmony_ci
717462306a36Sopenharmony_ci/**
717562306a36Sopenharmony_ci * ieee80211_next_txq - get next tx queue to pull packets from
717662306a36Sopenharmony_ci *
717762306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
717862306a36Sopenharmony_ci * @ac: AC number to return packets from.
717962306a36Sopenharmony_ci *
718062306a36Sopenharmony_ci * Returns the next txq if successful, %NULL if no queue is eligible. If a txq
718162306a36Sopenharmony_ci * is returned, it should be returned with ieee80211_return_txq() after the
718262306a36Sopenharmony_ci * driver has finished scheduling it.
718362306a36Sopenharmony_ci */
718462306a36Sopenharmony_cistruct ieee80211_txq *ieee80211_next_txq(struct ieee80211_hw *hw, u8 ac);
718562306a36Sopenharmony_ci
718662306a36Sopenharmony_ci/**
718762306a36Sopenharmony_ci * ieee80211_txq_schedule_start - start new scheduling round for TXQs
718862306a36Sopenharmony_ci *
718962306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
719062306a36Sopenharmony_ci * @ac: AC number to acquire locks for
719162306a36Sopenharmony_ci *
719262306a36Sopenharmony_ci * Should be called before ieee80211_next_txq() or ieee80211_return_txq().
719362306a36Sopenharmony_ci * The driver must not call multiple TXQ scheduling rounds concurrently.
719462306a36Sopenharmony_ci */
719562306a36Sopenharmony_civoid ieee80211_txq_schedule_start(struct ieee80211_hw *hw, u8 ac);
719662306a36Sopenharmony_ci
719762306a36Sopenharmony_ci/* (deprecated) */
719862306a36Sopenharmony_cistatic inline void ieee80211_txq_schedule_end(struct ieee80211_hw *hw, u8 ac)
719962306a36Sopenharmony_ci{
720062306a36Sopenharmony_ci}
720162306a36Sopenharmony_ci
720262306a36Sopenharmony_civoid __ieee80211_schedule_txq(struct ieee80211_hw *hw,
720362306a36Sopenharmony_ci			      struct ieee80211_txq *txq, bool force);
720462306a36Sopenharmony_ci
720562306a36Sopenharmony_ci/**
720662306a36Sopenharmony_ci * ieee80211_schedule_txq - schedule a TXQ for transmission
720762306a36Sopenharmony_ci *
720862306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
720962306a36Sopenharmony_ci * @txq: pointer obtained from station or virtual interface
721062306a36Sopenharmony_ci *
721162306a36Sopenharmony_ci * Schedules a TXQ for transmission if it is not already scheduled,
721262306a36Sopenharmony_ci * even if mac80211 does not have any packets buffered.
721362306a36Sopenharmony_ci *
721462306a36Sopenharmony_ci * The driver may call this function if it has buffered packets for
721562306a36Sopenharmony_ci * this TXQ internally.
721662306a36Sopenharmony_ci */
721762306a36Sopenharmony_cistatic inline void
721862306a36Sopenharmony_ciieee80211_schedule_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq)
721962306a36Sopenharmony_ci{
722062306a36Sopenharmony_ci	__ieee80211_schedule_txq(hw, txq, true);
722162306a36Sopenharmony_ci}
722262306a36Sopenharmony_ci
722362306a36Sopenharmony_ci/**
722462306a36Sopenharmony_ci * ieee80211_return_txq - return a TXQ previously acquired by ieee80211_next_txq()
722562306a36Sopenharmony_ci *
722662306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
722762306a36Sopenharmony_ci * @txq: pointer obtained from station or virtual interface
722862306a36Sopenharmony_ci * @force: schedule txq even if mac80211 does not have any buffered packets.
722962306a36Sopenharmony_ci *
723062306a36Sopenharmony_ci * The driver may set force=true if it has buffered packets for this TXQ
723162306a36Sopenharmony_ci * internally.
723262306a36Sopenharmony_ci */
723362306a36Sopenharmony_cistatic inline void
723462306a36Sopenharmony_ciieee80211_return_txq(struct ieee80211_hw *hw, struct ieee80211_txq *txq,
723562306a36Sopenharmony_ci		     bool force)
723662306a36Sopenharmony_ci{
723762306a36Sopenharmony_ci	__ieee80211_schedule_txq(hw, txq, force);
723862306a36Sopenharmony_ci}
723962306a36Sopenharmony_ci
724062306a36Sopenharmony_ci/**
724162306a36Sopenharmony_ci * ieee80211_txq_may_transmit - check whether TXQ is allowed to transmit
724262306a36Sopenharmony_ci *
724362306a36Sopenharmony_ci * This function is used to check whether given txq is allowed to transmit by
724462306a36Sopenharmony_ci * the airtime scheduler, and can be used by drivers to access the airtime
724562306a36Sopenharmony_ci * fairness accounting without going using the scheduling order enfored by
724662306a36Sopenharmony_ci * next_txq().
724762306a36Sopenharmony_ci *
724862306a36Sopenharmony_ci * Returns %true if the airtime scheduler thinks the TXQ should be allowed to
724962306a36Sopenharmony_ci * transmit, and %false if it should be throttled. This function can also have
725062306a36Sopenharmony_ci * the side effect of rotating the TXQ in the scheduler rotation, which will
725162306a36Sopenharmony_ci * eventually bring the deficit to positive and allow the station to transmit
725262306a36Sopenharmony_ci * again.
725362306a36Sopenharmony_ci *
725462306a36Sopenharmony_ci * The API ieee80211_txq_may_transmit() also ensures that TXQ list will be
725562306a36Sopenharmony_ci * aligned against driver's own round-robin scheduler list. i.e it rotates
725662306a36Sopenharmony_ci * the TXQ list till it makes the requested node becomes the first entry
725762306a36Sopenharmony_ci * in TXQ list. Thus both the TXQ list and driver's list are in sync. If this
725862306a36Sopenharmony_ci * function returns %true, the driver is expected to schedule packets
725962306a36Sopenharmony_ci * for transmission, and then return the TXQ through ieee80211_return_txq().
726062306a36Sopenharmony_ci *
726162306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
726262306a36Sopenharmony_ci * @txq: pointer obtained from station or virtual interface
726362306a36Sopenharmony_ci */
726462306a36Sopenharmony_cibool ieee80211_txq_may_transmit(struct ieee80211_hw *hw,
726562306a36Sopenharmony_ci				struct ieee80211_txq *txq);
726662306a36Sopenharmony_ci
726762306a36Sopenharmony_ci/**
726862306a36Sopenharmony_ci * ieee80211_txq_get_depth - get pending frame/byte count of given txq
726962306a36Sopenharmony_ci *
727062306a36Sopenharmony_ci * The values are not guaranteed to be coherent with regard to each other, i.e.
727162306a36Sopenharmony_ci * txq state can change half-way of this function and the caller may end up
727262306a36Sopenharmony_ci * with "new" frame_cnt and "old" byte_cnt or vice-versa.
727362306a36Sopenharmony_ci *
727462306a36Sopenharmony_ci * @txq: pointer obtained from station or virtual interface
727562306a36Sopenharmony_ci * @frame_cnt: pointer to store frame count
727662306a36Sopenharmony_ci * @byte_cnt: pointer to store byte count
727762306a36Sopenharmony_ci */
727862306a36Sopenharmony_civoid ieee80211_txq_get_depth(struct ieee80211_txq *txq,
727962306a36Sopenharmony_ci			     unsigned long *frame_cnt,
728062306a36Sopenharmony_ci			     unsigned long *byte_cnt);
728162306a36Sopenharmony_ci
728262306a36Sopenharmony_ci/**
728362306a36Sopenharmony_ci * ieee80211_nan_func_terminated - notify about NAN function termination.
728462306a36Sopenharmony_ci *
728562306a36Sopenharmony_ci * This function is used to notify mac80211 about NAN function termination.
728662306a36Sopenharmony_ci * Note that this function can't be called from hard irq.
728762306a36Sopenharmony_ci *
728862306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
728962306a36Sopenharmony_ci * @inst_id: the local instance id
729062306a36Sopenharmony_ci * @reason: termination reason (one of the NL80211_NAN_FUNC_TERM_REASON_*)
729162306a36Sopenharmony_ci * @gfp: allocation flags
729262306a36Sopenharmony_ci */
729362306a36Sopenharmony_civoid ieee80211_nan_func_terminated(struct ieee80211_vif *vif,
729462306a36Sopenharmony_ci				   u8 inst_id,
729562306a36Sopenharmony_ci				   enum nl80211_nan_func_term_reason reason,
729662306a36Sopenharmony_ci				   gfp_t gfp);
729762306a36Sopenharmony_ci
729862306a36Sopenharmony_ci/**
729962306a36Sopenharmony_ci * ieee80211_nan_func_match - notify about NAN function match event.
730062306a36Sopenharmony_ci *
730162306a36Sopenharmony_ci * This function is used to notify mac80211 about NAN function match. The
730262306a36Sopenharmony_ci * cookie inside the match struct will be assigned by mac80211.
730362306a36Sopenharmony_ci * Note that this function can't be called from hard irq.
730462306a36Sopenharmony_ci *
730562306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
730662306a36Sopenharmony_ci * @match: match event information
730762306a36Sopenharmony_ci * @gfp: allocation flags
730862306a36Sopenharmony_ci */
730962306a36Sopenharmony_civoid ieee80211_nan_func_match(struct ieee80211_vif *vif,
731062306a36Sopenharmony_ci			      struct cfg80211_nan_match_params *match,
731162306a36Sopenharmony_ci			      gfp_t gfp);
731262306a36Sopenharmony_ci
731362306a36Sopenharmony_ci/**
731462306a36Sopenharmony_ci * ieee80211_calc_rx_airtime - calculate estimated transmission airtime for RX.
731562306a36Sopenharmony_ci *
731662306a36Sopenharmony_ci * This function calculates the estimated airtime usage of a frame based on the
731762306a36Sopenharmony_ci * rate information in the RX status struct and the frame length.
731862306a36Sopenharmony_ci *
731962306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
732062306a36Sopenharmony_ci * @status: &struct ieee80211_rx_status containing the transmission rate
732162306a36Sopenharmony_ci *          information.
732262306a36Sopenharmony_ci * @len: frame length in bytes
732362306a36Sopenharmony_ci */
732462306a36Sopenharmony_ciu32 ieee80211_calc_rx_airtime(struct ieee80211_hw *hw,
732562306a36Sopenharmony_ci			      struct ieee80211_rx_status *status,
732662306a36Sopenharmony_ci			      int len);
732762306a36Sopenharmony_ci
732862306a36Sopenharmony_ci/**
732962306a36Sopenharmony_ci * ieee80211_calc_tx_airtime - calculate estimated transmission airtime for TX.
733062306a36Sopenharmony_ci *
733162306a36Sopenharmony_ci * This function calculates the estimated airtime usage of a frame based on the
733262306a36Sopenharmony_ci * rate information in the TX info struct and the frame length.
733362306a36Sopenharmony_ci *
733462306a36Sopenharmony_ci * @hw: pointer as obtained from ieee80211_alloc_hw()
733562306a36Sopenharmony_ci * @info: &struct ieee80211_tx_info of the frame.
733662306a36Sopenharmony_ci * @len: frame length in bytes
733762306a36Sopenharmony_ci */
733862306a36Sopenharmony_ciu32 ieee80211_calc_tx_airtime(struct ieee80211_hw *hw,
733962306a36Sopenharmony_ci			      struct ieee80211_tx_info *info,
734062306a36Sopenharmony_ci			      int len);
734162306a36Sopenharmony_ci/**
734262306a36Sopenharmony_ci * ieee80211_set_hw_80211_encap - enable hardware encapsulation offloading.
734362306a36Sopenharmony_ci *
734462306a36Sopenharmony_ci * This function is used to notify mac80211 that a vif can be passed raw 802.3
734562306a36Sopenharmony_ci * frames. The driver needs to then handle the 802.11 encapsulation inside the
734662306a36Sopenharmony_ci * hardware or firmware.
734762306a36Sopenharmony_ci *
734862306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
734962306a36Sopenharmony_ci * @enable: indicate if the feature should be turned on or off
735062306a36Sopenharmony_ci */
735162306a36Sopenharmony_cibool ieee80211_set_hw_80211_encap(struct ieee80211_vif *vif, bool enable);
735262306a36Sopenharmony_ci
735362306a36Sopenharmony_ci/**
735462306a36Sopenharmony_ci * ieee80211_get_fils_discovery_tmpl - Get FILS discovery template.
735562306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
735662306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
735762306a36Sopenharmony_ci *
735862306a36Sopenharmony_ci * The driver is responsible for freeing the returned skb.
735962306a36Sopenharmony_ci *
736062306a36Sopenharmony_ci * Return: FILS discovery template. %NULL on error.
736162306a36Sopenharmony_ci */
736262306a36Sopenharmony_cistruct sk_buff *ieee80211_get_fils_discovery_tmpl(struct ieee80211_hw *hw,
736362306a36Sopenharmony_ci						  struct ieee80211_vif *vif);
736462306a36Sopenharmony_ci
736562306a36Sopenharmony_ci/**
736662306a36Sopenharmony_ci * ieee80211_get_unsol_bcast_probe_resp_tmpl - Get unsolicited broadcast
736762306a36Sopenharmony_ci *	probe response template.
736862306a36Sopenharmony_ci * @hw: pointer obtained from ieee80211_alloc_hw().
736962306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
737062306a36Sopenharmony_ci *
737162306a36Sopenharmony_ci * The driver is responsible for freeing the returned skb.
737262306a36Sopenharmony_ci *
737362306a36Sopenharmony_ci * Return: Unsolicited broadcast probe response template. %NULL on error.
737462306a36Sopenharmony_ci */
737562306a36Sopenharmony_cistruct sk_buff *
737662306a36Sopenharmony_ciieee80211_get_unsol_bcast_probe_resp_tmpl(struct ieee80211_hw *hw,
737762306a36Sopenharmony_ci					  struct ieee80211_vif *vif);
737862306a36Sopenharmony_ci
737962306a36Sopenharmony_ci/**
738062306a36Sopenharmony_ci * ieee80211_obss_color_collision_notify - notify userland about a BSS color
738162306a36Sopenharmony_ci * collision.
738262306a36Sopenharmony_ci *
738362306a36Sopenharmony_ci * @vif: &struct ieee80211_vif pointer from the add_interface callback.
738462306a36Sopenharmony_ci * @color_bitmap: a 64 bit bitmap representing the colors that the local BSS is
738562306a36Sopenharmony_ci *	aware of.
738662306a36Sopenharmony_ci * @gfp: allocation flags
738762306a36Sopenharmony_ci */
738862306a36Sopenharmony_civoid
738962306a36Sopenharmony_ciieee80211_obss_color_collision_notify(struct ieee80211_vif *vif,
739062306a36Sopenharmony_ci				      u64 color_bitmap, gfp_t gfp);
739162306a36Sopenharmony_ci
739262306a36Sopenharmony_ci/**
739362306a36Sopenharmony_ci * ieee80211_is_tx_data - check if frame is a data frame
739462306a36Sopenharmony_ci *
739562306a36Sopenharmony_ci * The function is used to check if a frame is a data frame. Frames with
739662306a36Sopenharmony_ci * hardware encapsulation enabled are data frames.
739762306a36Sopenharmony_ci *
739862306a36Sopenharmony_ci * @skb: the frame to be transmitted.
739962306a36Sopenharmony_ci */
740062306a36Sopenharmony_cistatic inline bool ieee80211_is_tx_data(struct sk_buff *skb)
740162306a36Sopenharmony_ci{
740262306a36Sopenharmony_ci	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
740362306a36Sopenharmony_ci	struct ieee80211_hdr *hdr = (void *) skb->data;
740462306a36Sopenharmony_ci
740562306a36Sopenharmony_ci	return info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP ||
740662306a36Sopenharmony_ci	       ieee80211_is_data(hdr->frame_control);
740762306a36Sopenharmony_ci}
740862306a36Sopenharmony_ci
740962306a36Sopenharmony_ci/**
741062306a36Sopenharmony_ci * ieee80211_set_active_links - set active links in client mode
741162306a36Sopenharmony_ci * @vif: interface to set active links on
741262306a36Sopenharmony_ci * @active_links: the new active links bitmap
741362306a36Sopenharmony_ci *
741462306a36Sopenharmony_ci * This changes the active links on an interface. The interface
741562306a36Sopenharmony_ci * must be in client mode (in AP mode, all links are always active),
741662306a36Sopenharmony_ci * and @active_links must be a subset of the vif's valid_links.
741762306a36Sopenharmony_ci *
741862306a36Sopenharmony_ci * If a link is switched off and another is switched on at the same
741962306a36Sopenharmony_ci * time (e.g. active_links going from 0x1 to 0x10) then you will get
742062306a36Sopenharmony_ci * a sequence of calls like
742162306a36Sopenharmony_ci *  - change_vif_links(0x11)
742262306a36Sopenharmony_ci *  - unassign_vif_chanctx(link_id=0)
742362306a36Sopenharmony_ci *  - change_sta_links(0x11) for each affected STA (the AP)
742462306a36Sopenharmony_ci *    (TDLS connections on now inactive links should be torn down)
742562306a36Sopenharmony_ci *  - remove group keys on the old link (link_id 0)
742662306a36Sopenharmony_ci *  - add new group keys (GTK/IGTK/BIGTK) on the new link (link_id 4)
742762306a36Sopenharmony_ci *  - change_sta_links(0x10) for each affected STA (the AP)
742862306a36Sopenharmony_ci *  - assign_vif_chanctx(link_id=4)
742962306a36Sopenharmony_ci *  - change_vif_links(0x10)
743062306a36Sopenharmony_ci *
743162306a36Sopenharmony_ci * Note: This function acquires some mac80211 locks and must not
743262306a36Sopenharmony_ci *	 be called with any driver locks held that could cause a
743362306a36Sopenharmony_ci *	 lock dependency inversion. Best call it without locks.
743462306a36Sopenharmony_ci */
743562306a36Sopenharmony_ciint ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links);
743662306a36Sopenharmony_ci
743762306a36Sopenharmony_ci/**
743862306a36Sopenharmony_ci * ieee80211_set_active_links_async - asynchronously set active links
743962306a36Sopenharmony_ci * @vif: interface to set active links on
744062306a36Sopenharmony_ci * @active_links: the new active links bitmap
744162306a36Sopenharmony_ci *
744262306a36Sopenharmony_ci * See ieee80211_set_active_links() for more information, the only
744362306a36Sopenharmony_ci * difference here is that the link change is triggered async and
744462306a36Sopenharmony_ci * can be called in any context, but the link switch will only be
744562306a36Sopenharmony_ci * completed after it returns.
744662306a36Sopenharmony_ci */
744762306a36Sopenharmony_civoid ieee80211_set_active_links_async(struct ieee80211_vif *vif,
744862306a36Sopenharmony_ci				      u16 active_links);
744962306a36Sopenharmony_ci
745062306a36Sopenharmony_ci#endif /* MAC80211_H */
7451