18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright 2002-2005, Instant802 Networks, Inc.
48c2ecf20Sopenharmony_ci * Copyright 2005, Devicescape Software, Inc.
58c2ecf20Sopenharmony_ci * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
68c2ecf20Sopenharmony_ci * Copyright 2007-2010	Johannes Berg <johannes@sipsolutions.net>
78c2ecf20Sopenharmony_ci * Copyright 2013-2015  Intel Mobile Communications GmbH
88c2ecf20Sopenharmony_ci * Copyright (C) 2018-2020 Intel Corporation
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#ifndef IEEE80211_I_H
128c2ecf20Sopenharmony_ci#define IEEE80211_I_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/kernel.h>
158c2ecf20Sopenharmony_ci#include <linux/device.h>
168c2ecf20Sopenharmony_ci#include <linux/if_ether.h>
178c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
188c2ecf20Sopenharmony_ci#include <linux/list.h>
198c2ecf20Sopenharmony_ci#include <linux/netdevice.h>
208c2ecf20Sopenharmony_ci#include <linux/skbuff.h>
218c2ecf20Sopenharmony_ci#include <linux/workqueue.h>
228c2ecf20Sopenharmony_ci#include <linux/types.h>
238c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
248c2ecf20Sopenharmony_ci#include <linux/etherdevice.h>
258c2ecf20Sopenharmony_ci#include <linux/leds.h>
268c2ecf20Sopenharmony_ci#include <linux/idr.h>
278c2ecf20Sopenharmony_ci#include <linux/rhashtable.h>
288c2ecf20Sopenharmony_ci#include <net/ieee80211_radiotap.h>
298c2ecf20Sopenharmony_ci#include <net/cfg80211.h>
308c2ecf20Sopenharmony_ci#include <net/mac80211.h>
318c2ecf20Sopenharmony_ci#include <net/fq.h>
328c2ecf20Sopenharmony_ci#include "key.h"
338c2ecf20Sopenharmony_ci#include "sta_info.h"
348c2ecf20Sopenharmony_ci#include "debug.h"
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciextern const struct cfg80211_ops mac80211_config_ops;
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_cistruct ieee80211_local;
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci/* Maximum number of broadcast/multicast frames to buffer when some of the
418c2ecf20Sopenharmony_ci * associated stations are using power saving. */
428c2ecf20Sopenharmony_ci#define AP_MAX_BC_BUFFER 128
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/* Maximum number of frames buffered to all STAs, including multicast frames.
458c2ecf20Sopenharmony_ci * Note: increasing this limit increases the potential memory requirement. Each
468c2ecf20Sopenharmony_ci * frame can be up to about 2 kB long. */
478c2ecf20Sopenharmony_ci#define TOTAL_MAX_TX_BUFFER 512
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* Required encryption head and tailroom */
508c2ecf20Sopenharmony_ci#define IEEE80211_ENCRYPT_HEADROOM 8
518c2ecf20Sopenharmony_ci#define IEEE80211_ENCRYPT_TAILROOM 18
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/* power level hasn't been configured (or set to automatic) */
548c2ecf20Sopenharmony_ci#define IEEE80211_UNSET_POWER_LEVEL	INT_MIN
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/*
578c2ecf20Sopenharmony_ci * Some APs experience problems when working with U-APSD. Decreasing the
588c2ecf20Sopenharmony_ci * probability of that happening by using legacy mode for all ACs but VO isn't
598c2ecf20Sopenharmony_ci * enough.
608c2ecf20Sopenharmony_ci *
618c2ecf20Sopenharmony_ci * Cisco 4410N originally forced us to enable VO by default only because it
628c2ecf20Sopenharmony_ci * treated non-VO ACs as legacy.
638c2ecf20Sopenharmony_ci *
648c2ecf20Sopenharmony_ci * However some APs (notably Netgear R7000) silently reclassify packets to
658c2ecf20Sopenharmony_ci * different ACs. Since u-APSD ACs require trigger frames for frame retrieval
668c2ecf20Sopenharmony_ci * clients would never see some frames (e.g. ARP responses) or would fetch them
678c2ecf20Sopenharmony_ci * accidentally after a long time.
688c2ecf20Sopenharmony_ci *
698c2ecf20Sopenharmony_ci * It makes little sense to enable u-APSD queues by default because it needs
708c2ecf20Sopenharmony_ci * userspace applications to be aware of it to actually take advantage of the
718c2ecf20Sopenharmony_ci * possible additional powersavings. Implicitly depending on driver autotrigger
728c2ecf20Sopenharmony_ci * frame support doesn't make much sense.
738c2ecf20Sopenharmony_ci */
748c2ecf20Sopenharmony_ci#define IEEE80211_DEFAULT_UAPSD_QUEUES 0
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci#define IEEE80211_DEFAULT_MAX_SP_LEN		\
778c2ecf20Sopenharmony_ci	IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ciextern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci#define IEEE80211_DEAUTH_FRAME_LEN	(24 /* hdr */ + 2 /* reason */)
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci#define IEEE80211_MAX_NAN_INSTANCE_ID 255
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_cistruct ieee80211_bss {
868c2ecf20Sopenharmony_ci	u32 device_ts_beacon, device_ts_presp;
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci	bool wmm_used;
898c2ecf20Sopenharmony_ci	bool uapsd_supported;
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define IEEE80211_MAX_SUPP_RATES 32
928c2ecf20Sopenharmony_ci	u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
938c2ecf20Sopenharmony_ci	size_t supp_rates_len;
948c2ecf20Sopenharmony_ci	struct ieee80211_rate *beacon_rate;
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci	u32 vht_cap_info;
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci	/*
998c2ecf20Sopenharmony_ci	 * During association, we save an ERP value from a probe response so
1008c2ecf20Sopenharmony_ci	 * that we can feed ERP info to the driver when handling the
1018c2ecf20Sopenharmony_ci	 * association completes. these fields probably won't be up-to-date
1028c2ecf20Sopenharmony_ci	 * otherwise, you probably don't want to use them.
1038c2ecf20Sopenharmony_ci	 */
1048c2ecf20Sopenharmony_ci	bool has_erp_value;
1058c2ecf20Sopenharmony_ci	u8 erp_value;
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci	/* Keep track of the corruption of the last beacon/probe response. */
1088c2ecf20Sopenharmony_ci	u8 corrupt_data;
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ci	/* Keep track of what bits of information we have valid info for. */
1118c2ecf20Sopenharmony_ci	u8 valid_data;
1128c2ecf20Sopenharmony_ci};
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/**
1158c2ecf20Sopenharmony_ci * enum ieee80211_corrupt_data_flags - BSS data corruption flags
1168c2ecf20Sopenharmony_ci * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted
1178c2ecf20Sopenharmony_ci * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted
1188c2ecf20Sopenharmony_ci *
1198c2ecf20Sopenharmony_ci * These are bss flags that are attached to a bss in the
1208c2ecf20Sopenharmony_ci * @corrupt_data field of &struct ieee80211_bss.
1218c2ecf20Sopenharmony_ci */
1228c2ecf20Sopenharmony_cienum ieee80211_bss_corrupt_data_flags {
1238c2ecf20Sopenharmony_ci	IEEE80211_BSS_CORRUPT_BEACON		= BIT(0),
1248c2ecf20Sopenharmony_ci	IEEE80211_BSS_CORRUPT_PROBE_RESP	= BIT(1)
1258c2ecf20Sopenharmony_ci};
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci/**
1288c2ecf20Sopenharmony_ci * enum ieee80211_valid_data_flags - BSS valid data flags
1298c2ecf20Sopenharmony_ci * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE
1308c2ecf20Sopenharmony_ci * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE
1318c2ecf20Sopenharmony_ci * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE
1328c2ecf20Sopenharmony_ci *
1338c2ecf20Sopenharmony_ci * These are bss flags that are attached to a bss in the
1348c2ecf20Sopenharmony_ci * @valid_data field of &struct ieee80211_bss.  They show which parts
1358c2ecf20Sopenharmony_ci * of the data structure were received as a result of an un-corrupted
1368c2ecf20Sopenharmony_ci * beacon/probe response.
1378c2ecf20Sopenharmony_ci */
1388c2ecf20Sopenharmony_cienum ieee80211_bss_valid_data_flags {
1398c2ecf20Sopenharmony_ci	IEEE80211_BSS_VALID_WMM			= BIT(1),
1408c2ecf20Sopenharmony_ci	IEEE80211_BSS_VALID_RATES		= BIT(2),
1418c2ecf20Sopenharmony_ci	IEEE80211_BSS_VALID_ERP			= BIT(3)
1428c2ecf20Sopenharmony_ci};
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_citypedef unsigned __bitwise ieee80211_tx_result;
1458c2ecf20Sopenharmony_ci#define TX_CONTINUE	((__force ieee80211_tx_result) 0u)
1468c2ecf20Sopenharmony_ci#define TX_DROP		((__force ieee80211_tx_result) 1u)
1478c2ecf20Sopenharmony_ci#define TX_QUEUED	((__force ieee80211_tx_result) 2u)
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci#define IEEE80211_TX_UNICAST		BIT(1)
1508c2ecf20Sopenharmony_ci#define IEEE80211_TX_PS_BUFFERED	BIT(2)
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_cistruct ieee80211_tx_data {
1538c2ecf20Sopenharmony_ci	struct sk_buff *skb;
1548c2ecf20Sopenharmony_ci	struct sk_buff_head skbs;
1558c2ecf20Sopenharmony_ci	struct ieee80211_local *local;
1568c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data *sdata;
1578c2ecf20Sopenharmony_ci	struct sta_info *sta;
1588c2ecf20Sopenharmony_ci	struct ieee80211_key *key;
1598c2ecf20Sopenharmony_ci	struct ieee80211_tx_rate rate;
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci	unsigned int flags;
1628c2ecf20Sopenharmony_ci};
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_citypedef unsigned __bitwise ieee80211_rx_result;
1668c2ecf20Sopenharmony_ci#define RX_CONTINUE		((__force ieee80211_rx_result) 0u)
1678c2ecf20Sopenharmony_ci#define RX_DROP_UNUSABLE	((__force ieee80211_rx_result) 1u)
1688c2ecf20Sopenharmony_ci#define RX_DROP_MONITOR		((__force ieee80211_rx_result) 2u)
1698c2ecf20Sopenharmony_ci#define RX_QUEUED		((__force ieee80211_rx_result) 3u)
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/**
1728c2ecf20Sopenharmony_ci * enum ieee80211_packet_rx_flags - packet RX flags
1738c2ecf20Sopenharmony_ci * @IEEE80211_RX_AMSDU: a-MSDU packet
1748c2ecf20Sopenharmony_ci * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
1758c2ecf20Sopenharmony_ci * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
1768c2ecf20Sopenharmony_ci *
1778c2ecf20Sopenharmony_ci * These are per-frame flags that are attached to a frame in the
1788c2ecf20Sopenharmony_ci * @rx_flags field of &struct ieee80211_rx_status.
1798c2ecf20Sopenharmony_ci */
1808c2ecf20Sopenharmony_cienum ieee80211_packet_rx_flags {
1818c2ecf20Sopenharmony_ci	IEEE80211_RX_AMSDU			= BIT(3),
1828c2ecf20Sopenharmony_ci	IEEE80211_RX_MALFORMED_ACTION_FRM	= BIT(4),
1838c2ecf20Sopenharmony_ci	IEEE80211_RX_DEFERRED_RELEASE		= BIT(5),
1848c2ecf20Sopenharmony_ci};
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci/**
1878c2ecf20Sopenharmony_ci * enum ieee80211_rx_flags - RX data flags
1888c2ecf20Sopenharmony_ci *
1898c2ecf20Sopenharmony_ci * @IEEE80211_RX_CMNTR: received on cooked monitor already
1908c2ecf20Sopenharmony_ci * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
1918c2ecf20Sopenharmony_ci *	to cfg80211_report_obss_beacon().
1928c2ecf20Sopenharmony_ci *
1938c2ecf20Sopenharmony_ci * These flags are used across handling multiple interfaces
1948c2ecf20Sopenharmony_ci * for a single frame.
1958c2ecf20Sopenharmony_ci */
1968c2ecf20Sopenharmony_cienum ieee80211_rx_flags {
1978c2ecf20Sopenharmony_ci	IEEE80211_RX_CMNTR		= BIT(0),
1988c2ecf20Sopenharmony_ci	IEEE80211_RX_BEACON_REPORTED	= BIT(1),
1998c2ecf20Sopenharmony_ci};
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_cistruct ieee80211_rx_data {
2028c2ecf20Sopenharmony_ci	struct list_head *list;
2038c2ecf20Sopenharmony_ci	struct sk_buff *skb;
2048c2ecf20Sopenharmony_ci	struct ieee80211_local *local;
2058c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data *sdata;
2068c2ecf20Sopenharmony_ci	struct sta_info *sta;
2078c2ecf20Sopenharmony_ci	struct ieee80211_key *key;
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci	unsigned int flags;
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci	/*
2128c2ecf20Sopenharmony_ci	 * Index into sequence numbers array, 0..16
2138c2ecf20Sopenharmony_ci	 * since the last (16) is used for non-QoS,
2148c2ecf20Sopenharmony_ci	 * will be 16 on non-QoS frames.
2158c2ecf20Sopenharmony_ci	 */
2168c2ecf20Sopenharmony_ci	int seqno_idx;
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci	/*
2198c2ecf20Sopenharmony_ci	 * Index into the security IV/PN arrays, 0..16
2208c2ecf20Sopenharmony_ci	 * since the last (16) is used for CCMP-encrypted
2218c2ecf20Sopenharmony_ci	 * management frames, will be set to 16 on mgmt
2228c2ecf20Sopenharmony_ci	 * frames and 0 on non-QoS frames.
2238c2ecf20Sopenharmony_ci	 */
2248c2ecf20Sopenharmony_ci	int security_idx;
2258c2ecf20Sopenharmony_ci
2268c2ecf20Sopenharmony_ci	union {
2278c2ecf20Sopenharmony_ci		struct {
2288c2ecf20Sopenharmony_ci			u32 iv32;
2298c2ecf20Sopenharmony_ci			u16 iv16;
2308c2ecf20Sopenharmony_ci		} tkip;
2318c2ecf20Sopenharmony_ci		struct {
2328c2ecf20Sopenharmony_ci			u8 pn[IEEE80211_CCMP_PN_LEN];
2338c2ecf20Sopenharmony_ci		} ccm_gcm;
2348c2ecf20Sopenharmony_ci	};
2358c2ecf20Sopenharmony_ci};
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_cistruct ieee80211_csa_settings {
2388c2ecf20Sopenharmony_ci	const u16 *counter_offsets_beacon;
2398c2ecf20Sopenharmony_ci	const u16 *counter_offsets_presp;
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci	int n_counter_offsets_beacon;
2428c2ecf20Sopenharmony_ci	int n_counter_offsets_presp;
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci	u8 count;
2458c2ecf20Sopenharmony_ci};
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_cistruct beacon_data {
2488c2ecf20Sopenharmony_ci	u8 *head, *tail;
2498c2ecf20Sopenharmony_ci	int head_len, tail_len;
2508c2ecf20Sopenharmony_ci	struct ieee80211_meshconf_ie *meshconf;
2518c2ecf20Sopenharmony_ci	u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
2528c2ecf20Sopenharmony_ci	u8 cntdwn_current_counter;
2538c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
2548c2ecf20Sopenharmony_ci};
2558c2ecf20Sopenharmony_ci
2568c2ecf20Sopenharmony_cistruct probe_resp {
2578c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
2588c2ecf20Sopenharmony_ci	int len;
2598c2ecf20Sopenharmony_ci	u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
2608c2ecf20Sopenharmony_ci	u8 data[];
2618c2ecf20Sopenharmony_ci};
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_cistruct fils_discovery_data {
2648c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
2658c2ecf20Sopenharmony_ci	int len;
2668c2ecf20Sopenharmony_ci	u8 data[];
2678c2ecf20Sopenharmony_ci};
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_cistruct unsol_bcast_probe_resp_data {
2708c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
2718c2ecf20Sopenharmony_ci	int len;
2728c2ecf20Sopenharmony_ci	u8 data[];
2738c2ecf20Sopenharmony_ci};
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_cistruct ps_data {
2768c2ecf20Sopenharmony_ci	/* yes, this looks ugly, but guarantees that we can later use
2778c2ecf20Sopenharmony_ci	 * bitmap_empty :)
2788c2ecf20Sopenharmony_ci	 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
2798c2ecf20Sopenharmony_ci	u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]
2808c2ecf20Sopenharmony_ci			__aligned(__alignof__(unsigned long));
2818c2ecf20Sopenharmony_ci	struct sk_buff_head bc_buf;
2828c2ecf20Sopenharmony_ci	atomic_t num_sta_ps; /* number of stations in PS mode */
2838c2ecf20Sopenharmony_ci	int dtim_count;
2848c2ecf20Sopenharmony_ci	bool dtim_bc_mc;
2858c2ecf20Sopenharmony_ci};
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_cistruct ieee80211_if_ap {
2888c2ecf20Sopenharmony_ci	struct beacon_data __rcu *beacon;
2898c2ecf20Sopenharmony_ci	struct probe_resp __rcu *probe_resp;
2908c2ecf20Sopenharmony_ci	struct fils_discovery_data __rcu *fils_discovery;
2918c2ecf20Sopenharmony_ci	struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp;
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ci	/* to be used after channel switch. */
2948c2ecf20Sopenharmony_ci	struct cfg80211_beacon_data *next_beacon;
2958c2ecf20Sopenharmony_ci	struct list_head vlans; /* write-protected with RTNL and local->mtx */
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci	struct ps_data ps;
2988c2ecf20Sopenharmony_ci	atomic_t num_mcast_sta; /* number of stations receiving multicast */
2998c2ecf20Sopenharmony_ci
3008c2ecf20Sopenharmony_ci	bool multicast_to_unicast;
3018c2ecf20Sopenharmony_ci};
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_cistruct ieee80211_if_wds {
3048c2ecf20Sopenharmony_ci	struct sta_info *sta;
3058c2ecf20Sopenharmony_ci	u8 remote_addr[ETH_ALEN];
3068c2ecf20Sopenharmony_ci};
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_cistruct ieee80211_if_vlan {
3098c2ecf20Sopenharmony_ci	struct list_head list; /* write-protected with RTNL and local->mtx */
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci	/* used for all tx if the VLAN is configured to 4-addr mode */
3128c2ecf20Sopenharmony_ci	struct sta_info __rcu *sta;
3138c2ecf20Sopenharmony_ci	atomic_t num_mcast_sta; /* number of stations receiving multicast */
3148c2ecf20Sopenharmony_ci};
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_cistruct mesh_stats {
3178c2ecf20Sopenharmony_ci	__u32 fwded_mcast;		/* Mesh forwarded multicast frames */
3188c2ecf20Sopenharmony_ci	__u32 fwded_unicast;		/* Mesh forwarded unicast frames */
3198c2ecf20Sopenharmony_ci	__u32 fwded_frames;		/* Mesh total forwarded frames */
3208c2ecf20Sopenharmony_ci	__u32 dropped_frames_ttl;	/* Not transmitted since mesh_ttl == 0*/
3218c2ecf20Sopenharmony_ci	__u32 dropped_frames_no_route;	/* Not transmitted, no route found */
3228c2ecf20Sopenharmony_ci	__u32 dropped_frames_congestion;/* Not forwarded due to congestion */
3238c2ecf20Sopenharmony_ci};
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci#define PREQ_Q_F_START		0x1
3268c2ecf20Sopenharmony_ci#define PREQ_Q_F_REFRESH	0x2
3278c2ecf20Sopenharmony_cistruct mesh_preq_queue {
3288c2ecf20Sopenharmony_ci	struct list_head list;
3298c2ecf20Sopenharmony_ci	u8 dst[ETH_ALEN];
3308c2ecf20Sopenharmony_ci	u8 flags;
3318c2ecf20Sopenharmony_ci};
3328c2ecf20Sopenharmony_ci
3338c2ecf20Sopenharmony_cistruct ieee80211_roc_work {
3348c2ecf20Sopenharmony_ci	struct list_head list;
3358c2ecf20Sopenharmony_ci
3368c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data *sdata;
3378c2ecf20Sopenharmony_ci
3388c2ecf20Sopenharmony_ci	struct ieee80211_channel *chan;
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci	bool started, abort, hw_begun, notified;
3418c2ecf20Sopenharmony_ci	bool on_channel;
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci	unsigned long start_time;
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci	u32 duration, req_duration;
3468c2ecf20Sopenharmony_ci	struct sk_buff *frame;
3478c2ecf20Sopenharmony_ci	u64 cookie, mgmt_tx_cookie;
3488c2ecf20Sopenharmony_ci	enum ieee80211_roc_type type;
3498c2ecf20Sopenharmony_ci};
3508c2ecf20Sopenharmony_ci
3518c2ecf20Sopenharmony_ci/* flags used in struct ieee80211_if_managed.flags */
3528c2ecf20Sopenharmony_cienum ieee80211_sta_flags {
3538c2ecf20Sopenharmony_ci	IEEE80211_STA_CONNECTION_POLL	= BIT(1),
3548c2ecf20Sopenharmony_ci	IEEE80211_STA_CONTROL_PORT	= BIT(2),
3558c2ecf20Sopenharmony_ci	IEEE80211_STA_DISABLE_HT	= BIT(4),
3568c2ecf20Sopenharmony_ci	IEEE80211_STA_MFP_ENABLED	= BIT(6),
3578c2ecf20Sopenharmony_ci	IEEE80211_STA_UAPSD_ENABLED	= BIT(7),
3588c2ecf20Sopenharmony_ci	IEEE80211_STA_NULLFUNC_ACKED	= BIT(8),
3598c2ecf20Sopenharmony_ci	IEEE80211_STA_RESET_SIGNAL_AVE	= BIT(9),
3608c2ecf20Sopenharmony_ci	IEEE80211_STA_DISABLE_40MHZ	= BIT(10),
3618c2ecf20Sopenharmony_ci	IEEE80211_STA_DISABLE_VHT	= BIT(11),
3628c2ecf20Sopenharmony_ci	IEEE80211_STA_DISABLE_80P80MHZ	= BIT(12),
3638c2ecf20Sopenharmony_ci	IEEE80211_STA_DISABLE_160MHZ	= BIT(13),
3648c2ecf20Sopenharmony_ci	IEEE80211_STA_DISABLE_WMM	= BIT(14),
3658c2ecf20Sopenharmony_ci	IEEE80211_STA_ENABLE_RRM	= BIT(15),
3668c2ecf20Sopenharmony_ci	IEEE80211_STA_DISABLE_HE	= BIT(16),
3678c2ecf20Sopenharmony_ci};
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_cistruct ieee80211_mgd_auth_data {
3708c2ecf20Sopenharmony_ci	struct cfg80211_bss *bss;
3718c2ecf20Sopenharmony_ci	unsigned long timeout;
3728c2ecf20Sopenharmony_ci	int tries;
3738c2ecf20Sopenharmony_ci	u16 algorithm, expected_transaction;
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ci	u8 key[WLAN_KEY_LEN_WEP104];
3768c2ecf20Sopenharmony_ci	u8 key_len, key_idx;
3778c2ecf20Sopenharmony_ci	bool done, waiting;
3788c2ecf20Sopenharmony_ci	bool peer_confirmed;
3798c2ecf20Sopenharmony_ci	bool timeout_started;
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_ci	u16 sae_trans, sae_status;
3828c2ecf20Sopenharmony_ci	size_t data_len;
3838c2ecf20Sopenharmony_ci	u8 data[];
3848c2ecf20Sopenharmony_ci};
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_cistruct ieee80211_mgd_assoc_data {
3878c2ecf20Sopenharmony_ci	struct cfg80211_bss *bss;
3888c2ecf20Sopenharmony_ci	const u8 *supp_rates;
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ci	unsigned long timeout;
3918c2ecf20Sopenharmony_ci	int tries;
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ci	u16 capability;
3948c2ecf20Sopenharmony_ci	u8 prev_bssid[ETH_ALEN];
3958c2ecf20Sopenharmony_ci	u8 ssid[IEEE80211_MAX_SSID_LEN];
3968c2ecf20Sopenharmony_ci	u8 ssid_len;
3978c2ecf20Sopenharmony_ci	u8 supp_rates_len;
3988c2ecf20Sopenharmony_ci	bool wmm, uapsd;
3998c2ecf20Sopenharmony_ci	bool need_beacon;
4008c2ecf20Sopenharmony_ci	bool synced;
4018c2ecf20Sopenharmony_ci	bool timeout_started;
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci	u8 ap_ht_param;
4048c2ecf20Sopenharmony_ci
4058c2ecf20Sopenharmony_ci	struct ieee80211_vht_cap ap_vht_cap;
4068c2ecf20Sopenharmony_ci
4078c2ecf20Sopenharmony_ci	u8 fils_nonces[2 * FILS_NONCE_LEN];
4088c2ecf20Sopenharmony_ci	u8 fils_kek[FILS_MAX_KEK_LEN];
4098c2ecf20Sopenharmony_ci	size_t fils_kek_len;
4108c2ecf20Sopenharmony_ci
4118c2ecf20Sopenharmony_ci	size_t ie_len;
4128c2ecf20Sopenharmony_ci	u8 ie[];
4138c2ecf20Sopenharmony_ci};
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_cistruct ieee80211_sta_tx_tspec {
4168c2ecf20Sopenharmony_ci	/* timestamp of the first packet in the time slice */
4178c2ecf20Sopenharmony_ci	unsigned long time_slice_start;
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci	u32 admitted_time; /* in usecs, unlike over the air */
4208c2ecf20Sopenharmony_ci	u8 tsid;
4218c2ecf20Sopenharmony_ci	s8 up; /* signed to be able to invalidate with -1 during teardown */
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci	/* consumed TX time in microseconds in the time slice */
4248c2ecf20Sopenharmony_ci	u32 consumed_tx_time;
4258c2ecf20Sopenharmony_ci	enum {
4268c2ecf20Sopenharmony_ci		TX_TSPEC_ACTION_NONE = 0,
4278c2ecf20Sopenharmony_ci		TX_TSPEC_ACTION_DOWNGRADE,
4288c2ecf20Sopenharmony_ci		TX_TSPEC_ACTION_STOP_DOWNGRADE,
4298c2ecf20Sopenharmony_ci	} action;
4308c2ecf20Sopenharmony_ci	bool downgraded;
4318c2ecf20Sopenharmony_ci};
4328c2ecf20Sopenharmony_ci
4338c2ecf20Sopenharmony_ciDECLARE_EWMA(beacon_signal, 4, 4)
4348c2ecf20Sopenharmony_ci
4358c2ecf20Sopenharmony_cistruct ieee80211_if_managed {
4368c2ecf20Sopenharmony_ci	struct timer_list timer;
4378c2ecf20Sopenharmony_ci	struct timer_list conn_mon_timer;
4388c2ecf20Sopenharmony_ci	struct timer_list bcn_mon_timer;
4398c2ecf20Sopenharmony_ci	struct timer_list chswitch_timer;
4408c2ecf20Sopenharmony_ci	struct work_struct monitor_work;
4418c2ecf20Sopenharmony_ci	struct work_struct chswitch_work;
4428c2ecf20Sopenharmony_ci	struct work_struct beacon_connection_loss_work;
4438c2ecf20Sopenharmony_ci	struct work_struct csa_connection_drop_work;
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci	unsigned long beacon_timeout;
4468c2ecf20Sopenharmony_ci	unsigned long probe_timeout;
4478c2ecf20Sopenharmony_ci	int probe_send_count;
4488c2ecf20Sopenharmony_ci	bool nullfunc_failed;
4498c2ecf20Sopenharmony_ci	bool connection_loss;
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci	struct cfg80211_bss *associated;
4528c2ecf20Sopenharmony_ci	struct ieee80211_mgd_auth_data *auth_data;
4538c2ecf20Sopenharmony_ci	struct ieee80211_mgd_assoc_data *assoc_data;
4548c2ecf20Sopenharmony_ci
4558c2ecf20Sopenharmony_ci	u8 bssid[ETH_ALEN] __aligned(2);
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_ci	bool powersave; /* powersave requested for this iface */
4588c2ecf20Sopenharmony_ci	bool broken_ap; /* AP is broken -- turn off powersave */
4598c2ecf20Sopenharmony_ci	bool have_beacon;
4608c2ecf20Sopenharmony_ci	u8 dtim_period;
4618c2ecf20Sopenharmony_ci	enum ieee80211_smps_mode req_smps, /* requested smps mode */
4628c2ecf20Sopenharmony_ci				 driver_smps_mode; /* smps mode request */
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci	struct work_struct request_smps_work;
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci	unsigned int flags;
4678c2ecf20Sopenharmony_ci
4688c2ecf20Sopenharmony_ci	bool csa_waiting_bcn;
4698c2ecf20Sopenharmony_ci	bool csa_ignored_same_chan;
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_ci	bool beacon_crc_valid;
4728c2ecf20Sopenharmony_ci	u32 beacon_crc;
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_ci	bool status_acked;
4758c2ecf20Sopenharmony_ci	bool status_received;
4768c2ecf20Sopenharmony_ci	__le16 status_fc;
4778c2ecf20Sopenharmony_ci
4788c2ecf20Sopenharmony_ci	enum {
4798c2ecf20Sopenharmony_ci		IEEE80211_MFP_DISABLED,
4808c2ecf20Sopenharmony_ci		IEEE80211_MFP_OPTIONAL,
4818c2ecf20Sopenharmony_ci		IEEE80211_MFP_REQUIRED
4828c2ecf20Sopenharmony_ci	} mfp; /* management frame protection */
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_ci	/*
4858c2ecf20Sopenharmony_ci	 * Bitmask of enabled u-apsd queues,
4868c2ecf20Sopenharmony_ci	 * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
4878c2ecf20Sopenharmony_ci	 * to take effect.
4888c2ecf20Sopenharmony_ci	 */
4898c2ecf20Sopenharmony_ci	unsigned int uapsd_queues;
4908c2ecf20Sopenharmony_ci
4918c2ecf20Sopenharmony_ci	/*
4928c2ecf20Sopenharmony_ci	 * Maximum number of buffered frames AP can deliver during a
4938c2ecf20Sopenharmony_ci	 * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
4948c2ecf20Sopenharmony_ci	 * Needs a new association to take effect.
4958c2ecf20Sopenharmony_ci	 */
4968c2ecf20Sopenharmony_ci	unsigned int uapsd_max_sp_len;
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci	int wmm_last_param_set;
4998c2ecf20Sopenharmony_ci	int mu_edca_last_param_set;
5008c2ecf20Sopenharmony_ci
5018c2ecf20Sopenharmony_ci	u8 use_4addr;
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci	s16 p2p_noa_index;
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci	struct ewma_beacon_signal ave_beacon_signal;
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ci	/*
5088c2ecf20Sopenharmony_ci	 * Number of Beacon frames used in ave_beacon_signal. This can be used
5098c2ecf20Sopenharmony_ci	 * to avoid generating less reliable cqm events that would be based
5108c2ecf20Sopenharmony_ci	 * only on couple of received frames.
5118c2ecf20Sopenharmony_ci	 */
5128c2ecf20Sopenharmony_ci	unsigned int count_beacon_signal;
5138c2ecf20Sopenharmony_ci
5148c2ecf20Sopenharmony_ci	/* Number of times beacon loss was invoked. */
5158c2ecf20Sopenharmony_ci	unsigned int beacon_loss_count;
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci	/*
5188c2ecf20Sopenharmony_ci	 * Last Beacon frame signal strength average (ave_beacon_signal / 16)
5198c2ecf20Sopenharmony_ci	 * that triggered a cqm event. 0 indicates that no event has been
5208c2ecf20Sopenharmony_ci	 * generated for the current association.
5218c2ecf20Sopenharmony_ci	 */
5228c2ecf20Sopenharmony_ci	int last_cqm_event_signal;
5238c2ecf20Sopenharmony_ci
5248c2ecf20Sopenharmony_ci	/*
5258c2ecf20Sopenharmony_ci	 * State variables for keeping track of RSSI of the AP currently
5268c2ecf20Sopenharmony_ci	 * connected to and informing driver when RSSI has gone
5278c2ecf20Sopenharmony_ci	 * below/above a certain threshold.
5288c2ecf20Sopenharmony_ci	 */
5298c2ecf20Sopenharmony_ci	int rssi_min_thold, rssi_max_thold;
5308c2ecf20Sopenharmony_ci	int last_ave_beacon_signal;
5318c2ecf20Sopenharmony_ci
5328c2ecf20Sopenharmony_ci	struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
5338c2ecf20Sopenharmony_ci	struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
5348c2ecf20Sopenharmony_ci	struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */
5358c2ecf20Sopenharmony_ci	struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */
5368c2ecf20Sopenharmony_ci	struct ieee80211_s1g_cap s1g_capa; /* configured S1G overrides */
5378c2ecf20Sopenharmony_ci	struct ieee80211_s1g_cap s1g_capa_mask; /* valid s1g_capa bits */
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci	/* TDLS support */
5408c2ecf20Sopenharmony_ci	u8 tdls_peer[ETH_ALEN] __aligned(2);
5418c2ecf20Sopenharmony_ci	struct delayed_work tdls_peer_del_work;
5428c2ecf20Sopenharmony_ci	struct sk_buff *orig_teardown_skb; /* The original teardown skb */
5438c2ecf20Sopenharmony_ci	struct sk_buff *teardown_skb; /* A copy to send through the AP */
5448c2ecf20Sopenharmony_ci	spinlock_t teardown_lock; /* To lock changing teardown_skb */
5458c2ecf20Sopenharmony_ci	bool tdls_chan_switch_prohibited;
5468c2ecf20Sopenharmony_ci	bool tdls_wider_bw_prohibited;
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci	/* WMM-AC TSPEC support */
5498c2ecf20Sopenharmony_ci	struct ieee80211_sta_tx_tspec tx_tspec[IEEE80211_NUM_ACS];
5508c2ecf20Sopenharmony_ci	/* Use a separate work struct so that we can do something here
5518c2ecf20Sopenharmony_ci	 * while the sdata->work is flushing the queues, for example.
5528c2ecf20Sopenharmony_ci	 * otherwise, in scenarios where we hardly get any traffic out
5538c2ecf20Sopenharmony_ci	 * on the BE queue, but there's a lot of VO traffic, we might
5548c2ecf20Sopenharmony_ci	 * get stuck in a downgraded situation and flush takes forever.
5558c2ecf20Sopenharmony_ci	 */
5568c2ecf20Sopenharmony_ci	struct delayed_work tx_tspec_wk;
5578c2ecf20Sopenharmony_ci
5588c2ecf20Sopenharmony_ci	/* Information elements from the last transmitted (Re)Association
5598c2ecf20Sopenharmony_ci	 * Request frame.
5608c2ecf20Sopenharmony_ci	 */
5618c2ecf20Sopenharmony_ci	u8 *assoc_req_ies;
5628c2ecf20Sopenharmony_ci	size_t assoc_req_ies_len;
5638c2ecf20Sopenharmony_ci};
5648c2ecf20Sopenharmony_ci
5658c2ecf20Sopenharmony_cistruct ieee80211_if_ibss {
5668c2ecf20Sopenharmony_ci	struct timer_list timer;
5678c2ecf20Sopenharmony_ci	struct work_struct csa_connection_drop_work;
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci	unsigned long last_scan_completed;
5708c2ecf20Sopenharmony_ci
5718c2ecf20Sopenharmony_ci	u32 basic_rates;
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci	bool fixed_bssid;
5748c2ecf20Sopenharmony_ci	bool fixed_channel;
5758c2ecf20Sopenharmony_ci	bool privacy;
5768c2ecf20Sopenharmony_ci
5778c2ecf20Sopenharmony_ci	bool control_port;
5788c2ecf20Sopenharmony_ci	bool userspace_handles_dfs;
5798c2ecf20Sopenharmony_ci
5808c2ecf20Sopenharmony_ci	u8 bssid[ETH_ALEN] __aligned(2);
5818c2ecf20Sopenharmony_ci	u8 ssid[IEEE80211_MAX_SSID_LEN];
5828c2ecf20Sopenharmony_ci	u8 ssid_len, ie_len;
5838c2ecf20Sopenharmony_ci	u8 *ie;
5848c2ecf20Sopenharmony_ci	struct cfg80211_chan_def chandef;
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci	unsigned long ibss_join_req;
5878c2ecf20Sopenharmony_ci	/* probe response/beacon for IBSS */
5888c2ecf20Sopenharmony_ci	struct beacon_data __rcu *presp;
5898c2ecf20Sopenharmony_ci
5908c2ecf20Sopenharmony_ci	struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
5918c2ecf20Sopenharmony_ci	struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
5928c2ecf20Sopenharmony_ci
5938c2ecf20Sopenharmony_ci	spinlock_t incomplete_lock;
5948c2ecf20Sopenharmony_ci	struct list_head incomplete_stations;
5958c2ecf20Sopenharmony_ci
5968c2ecf20Sopenharmony_ci	enum {
5978c2ecf20Sopenharmony_ci		IEEE80211_IBSS_MLME_SEARCH,
5988c2ecf20Sopenharmony_ci		IEEE80211_IBSS_MLME_JOINED,
5998c2ecf20Sopenharmony_ci	} state;
6008c2ecf20Sopenharmony_ci};
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_ci/**
6038c2ecf20Sopenharmony_ci * struct ieee80211_if_ocb - OCB mode state
6048c2ecf20Sopenharmony_ci *
6058c2ecf20Sopenharmony_ci * @housekeeping_timer: timer for periodic invocation of a housekeeping task
6068c2ecf20Sopenharmony_ci * @wrkq_flags: OCB deferred task action
6078c2ecf20Sopenharmony_ci * @incomplete_lock: delayed STA insertion lock
6088c2ecf20Sopenharmony_ci * @incomplete_stations: list of STAs waiting for delayed insertion
6098c2ecf20Sopenharmony_ci * @joined: indication if the interface is connected to an OCB network
6108c2ecf20Sopenharmony_ci */
6118c2ecf20Sopenharmony_cistruct ieee80211_if_ocb {
6128c2ecf20Sopenharmony_ci	struct timer_list housekeeping_timer;
6138c2ecf20Sopenharmony_ci	unsigned long wrkq_flags;
6148c2ecf20Sopenharmony_ci
6158c2ecf20Sopenharmony_ci	spinlock_t incomplete_lock;
6168c2ecf20Sopenharmony_ci	struct list_head incomplete_stations;
6178c2ecf20Sopenharmony_ci
6188c2ecf20Sopenharmony_ci	bool joined;
6198c2ecf20Sopenharmony_ci};
6208c2ecf20Sopenharmony_ci
6218c2ecf20Sopenharmony_ci/**
6228c2ecf20Sopenharmony_ci * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface
6238c2ecf20Sopenharmony_ci *
6248c2ecf20Sopenharmony_ci * these declarations define the interface, which enables
6258c2ecf20Sopenharmony_ci * vendor-specific mesh synchronization
6268c2ecf20Sopenharmony_ci *
6278c2ecf20Sopenharmony_ci */
6288c2ecf20Sopenharmony_cistruct ieee802_11_elems;
6298c2ecf20Sopenharmony_cistruct ieee80211_mesh_sync_ops {
6308c2ecf20Sopenharmony_ci	void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata,
6318c2ecf20Sopenharmony_ci			     u16 stype,
6328c2ecf20Sopenharmony_ci			     struct ieee80211_mgmt *mgmt,
6338c2ecf20Sopenharmony_ci			     struct ieee802_11_elems *elems,
6348c2ecf20Sopenharmony_ci			     struct ieee80211_rx_status *rx_status);
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci	/* should be called with beacon_data under RCU read lock */
6378c2ecf20Sopenharmony_ci	void (*adjust_tsf)(struct ieee80211_sub_if_data *sdata,
6388c2ecf20Sopenharmony_ci			   struct beacon_data *beacon);
6398c2ecf20Sopenharmony_ci	/* add other framework functions here */
6408c2ecf20Sopenharmony_ci};
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_cistruct mesh_csa_settings {
6438c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
6448c2ecf20Sopenharmony_ci	struct cfg80211_csa_settings settings;
6458c2ecf20Sopenharmony_ci};
6468c2ecf20Sopenharmony_ci
6478c2ecf20Sopenharmony_ci/**
6488c2ecf20Sopenharmony_ci * struct mesh_table
6498c2ecf20Sopenharmony_ci *
6508c2ecf20Sopenharmony_ci * @known_gates: list of known mesh gates and their mpaths by the station. The
6518c2ecf20Sopenharmony_ci * gate's mpath may or may not be resolved and active.
6528c2ecf20Sopenharmony_ci * @gates_lock: protects updates to known_gates
6538c2ecf20Sopenharmony_ci * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr
6548c2ecf20Sopenharmony_ci * @walk_head: linked list containing all mesh_path objects
6558c2ecf20Sopenharmony_ci * @walk_lock: lock protecting walk_head
6568c2ecf20Sopenharmony_ci * @entries: number of entries in the table
6578c2ecf20Sopenharmony_ci */
6588c2ecf20Sopenharmony_cistruct mesh_table {
6598c2ecf20Sopenharmony_ci	struct hlist_head known_gates;
6608c2ecf20Sopenharmony_ci	spinlock_t gates_lock;
6618c2ecf20Sopenharmony_ci	struct rhashtable rhead;
6628c2ecf20Sopenharmony_ci	struct hlist_head walk_head;
6638c2ecf20Sopenharmony_ci	spinlock_t walk_lock;
6648c2ecf20Sopenharmony_ci	atomic_t entries;		/* Up to MAX_MESH_NEIGHBOURS */
6658c2ecf20Sopenharmony_ci};
6668c2ecf20Sopenharmony_ci
6678c2ecf20Sopenharmony_cistruct ieee80211_if_mesh {
6688c2ecf20Sopenharmony_ci	struct timer_list housekeeping_timer;
6698c2ecf20Sopenharmony_ci	struct timer_list mesh_path_timer;
6708c2ecf20Sopenharmony_ci	struct timer_list mesh_path_root_timer;
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci	unsigned long wrkq_flags;
6738c2ecf20Sopenharmony_ci	unsigned long mbss_changed;
6748c2ecf20Sopenharmony_ci
6758c2ecf20Sopenharmony_ci	bool userspace_handles_dfs;
6768c2ecf20Sopenharmony_ci
6778c2ecf20Sopenharmony_ci	u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
6788c2ecf20Sopenharmony_ci	size_t mesh_id_len;
6798c2ecf20Sopenharmony_ci	/* Active Path Selection Protocol Identifier */
6808c2ecf20Sopenharmony_ci	u8 mesh_pp_id;
6818c2ecf20Sopenharmony_ci	/* Active Path Selection Metric Identifier */
6828c2ecf20Sopenharmony_ci	u8 mesh_pm_id;
6838c2ecf20Sopenharmony_ci	/* Congestion Control Mode Identifier */
6848c2ecf20Sopenharmony_ci	u8 mesh_cc_id;
6858c2ecf20Sopenharmony_ci	/* Synchronization Protocol Identifier */
6868c2ecf20Sopenharmony_ci	u8 mesh_sp_id;
6878c2ecf20Sopenharmony_ci	/* Authentication Protocol Identifier */
6888c2ecf20Sopenharmony_ci	u8 mesh_auth_id;
6898c2ecf20Sopenharmony_ci	/* Local mesh Sequence Number */
6908c2ecf20Sopenharmony_ci	u32 sn;
6918c2ecf20Sopenharmony_ci	/* Last used PREQ ID */
6928c2ecf20Sopenharmony_ci	u32 preq_id;
6938c2ecf20Sopenharmony_ci	atomic_t mpaths;
6948c2ecf20Sopenharmony_ci	/* Timestamp of last SN update */
6958c2ecf20Sopenharmony_ci	unsigned long last_sn_update;
6968c2ecf20Sopenharmony_ci	/* Time when it's ok to send next PERR */
6978c2ecf20Sopenharmony_ci	unsigned long next_perr;
6988c2ecf20Sopenharmony_ci	/* Timestamp of last PREQ sent */
6998c2ecf20Sopenharmony_ci	unsigned long last_preq;
7008c2ecf20Sopenharmony_ci	struct mesh_rmc *rmc;
7018c2ecf20Sopenharmony_ci	spinlock_t mesh_preq_queue_lock;
7028c2ecf20Sopenharmony_ci	struct mesh_preq_queue preq_queue;
7038c2ecf20Sopenharmony_ci	int preq_queue_len;
7048c2ecf20Sopenharmony_ci	struct mesh_stats mshstats;
7058c2ecf20Sopenharmony_ci	struct mesh_config mshcfg;
7068c2ecf20Sopenharmony_ci	atomic_t estab_plinks;
7078c2ecf20Sopenharmony_ci	u32 mesh_seqnum;
7088c2ecf20Sopenharmony_ci	bool accepting_plinks;
7098c2ecf20Sopenharmony_ci	int num_gates;
7108c2ecf20Sopenharmony_ci	struct beacon_data __rcu *beacon;
7118c2ecf20Sopenharmony_ci	const u8 *ie;
7128c2ecf20Sopenharmony_ci	u8 ie_len;
7138c2ecf20Sopenharmony_ci	enum {
7148c2ecf20Sopenharmony_ci		IEEE80211_MESH_SEC_NONE = 0x0,
7158c2ecf20Sopenharmony_ci		IEEE80211_MESH_SEC_AUTHED = 0x1,
7168c2ecf20Sopenharmony_ci		IEEE80211_MESH_SEC_SECURED = 0x2,
7178c2ecf20Sopenharmony_ci	} security;
7188c2ecf20Sopenharmony_ci	bool user_mpm;
7198c2ecf20Sopenharmony_ci	/* Extensible Synchronization Framework */
7208c2ecf20Sopenharmony_ci	const struct ieee80211_mesh_sync_ops *sync_ops;
7218c2ecf20Sopenharmony_ci	s64 sync_offset_clockdrift_max;
7228c2ecf20Sopenharmony_ci	spinlock_t sync_offset_lock;
7238c2ecf20Sopenharmony_ci	/* mesh power save */
7248c2ecf20Sopenharmony_ci	enum nl80211_mesh_power_mode nonpeer_pm;
7258c2ecf20Sopenharmony_ci	int ps_peers_light_sleep;
7268c2ecf20Sopenharmony_ci	int ps_peers_deep_sleep;
7278c2ecf20Sopenharmony_ci	struct ps_data ps;
7288c2ecf20Sopenharmony_ci	/* Channel Switching Support */
7298c2ecf20Sopenharmony_ci	struct mesh_csa_settings __rcu *csa;
7308c2ecf20Sopenharmony_ci	enum {
7318c2ecf20Sopenharmony_ci		IEEE80211_MESH_CSA_ROLE_NONE,
7328c2ecf20Sopenharmony_ci		IEEE80211_MESH_CSA_ROLE_INIT,
7338c2ecf20Sopenharmony_ci		IEEE80211_MESH_CSA_ROLE_REPEATER,
7348c2ecf20Sopenharmony_ci	} csa_role;
7358c2ecf20Sopenharmony_ci	u8 chsw_ttl;
7368c2ecf20Sopenharmony_ci	u16 pre_value;
7378c2ecf20Sopenharmony_ci
7388c2ecf20Sopenharmony_ci	/* offset from skb->data while building IE */
7398c2ecf20Sopenharmony_ci	int meshconf_offset;
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_ci	struct mesh_table mesh_paths;
7428c2ecf20Sopenharmony_ci	struct mesh_table mpp_paths; /* Store paths for MPP&MAP */
7438c2ecf20Sopenharmony_ci	int mesh_paths_generation;
7448c2ecf20Sopenharmony_ci	int mpp_paths_generation;
7458c2ecf20Sopenharmony_ci};
7468c2ecf20Sopenharmony_ci
7478c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_MESH
7488c2ecf20Sopenharmony_ci#define IEEE80211_IFSTA_MESH_CTR_INC(msh, name)	\
7498c2ecf20Sopenharmony_ci	do { (msh)->mshstats.name++; } while (0)
7508c2ecf20Sopenharmony_ci#else
7518c2ecf20Sopenharmony_ci#define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
7528c2ecf20Sopenharmony_ci	do { } while (0)
7538c2ecf20Sopenharmony_ci#endif
7548c2ecf20Sopenharmony_ci
7558c2ecf20Sopenharmony_ci/**
7568c2ecf20Sopenharmony_ci * enum ieee80211_sub_if_data_flags - virtual interface flags
7578c2ecf20Sopenharmony_ci *
7588c2ecf20Sopenharmony_ci * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
7598c2ecf20Sopenharmony_ci * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
7608c2ecf20Sopenharmony_ci * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
7618c2ecf20Sopenharmony_ci *	associated stations and deliver multicast frames both
7628c2ecf20Sopenharmony_ci *	back to wireless media and to the local net stack.
7638c2ecf20Sopenharmony_ci * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
7648c2ecf20Sopenharmony_ci * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
7658c2ecf20Sopenharmony_ci */
7668c2ecf20Sopenharmony_cienum ieee80211_sub_if_data_flags {
7678c2ecf20Sopenharmony_ci	IEEE80211_SDATA_ALLMULTI		= BIT(0),
7688c2ecf20Sopenharmony_ci	IEEE80211_SDATA_OPERATING_GMODE		= BIT(2),
7698c2ecf20Sopenharmony_ci	IEEE80211_SDATA_DONT_BRIDGE_PACKETS	= BIT(3),
7708c2ecf20Sopenharmony_ci	IEEE80211_SDATA_DISCONNECT_RESUME	= BIT(4),
7718c2ecf20Sopenharmony_ci	IEEE80211_SDATA_IN_DRIVER		= BIT(5),
7728c2ecf20Sopenharmony_ci};
7738c2ecf20Sopenharmony_ci
7748c2ecf20Sopenharmony_ci/**
7758c2ecf20Sopenharmony_ci * enum ieee80211_sdata_state_bits - virtual interface state bits
7768c2ecf20Sopenharmony_ci * @SDATA_STATE_RUNNING: virtual interface is up & running; this
7778c2ecf20Sopenharmony_ci *	mirrors netif_running() but is separate for interface type
7788c2ecf20Sopenharmony_ci *	change handling while the interface is up
7798c2ecf20Sopenharmony_ci * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
7808c2ecf20Sopenharmony_ci *	mode, so queues are stopped
7818c2ecf20Sopenharmony_ci * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due
7828c2ecf20Sopenharmony_ci *	to offchannel, reset when offchannel returns
7838c2ecf20Sopenharmony_ci */
7848c2ecf20Sopenharmony_cienum ieee80211_sdata_state_bits {
7858c2ecf20Sopenharmony_ci	SDATA_STATE_RUNNING,
7868c2ecf20Sopenharmony_ci	SDATA_STATE_OFFCHANNEL,
7878c2ecf20Sopenharmony_ci	SDATA_STATE_OFFCHANNEL_BEACON_STOPPED,
7888c2ecf20Sopenharmony_ci};
7898c2ecf20Sopenharmony_ci
7908c2ecf20Sopenharmony_ci/**
7918c2ecf20Sopenharmony_ci * enum ieee80211_chanctx_mode - channel context configuration mode
7928c2ecf20Sopenharmony_ci *
7938c2ecf20Sopenharmony_ci * @IEEE80211_CHANCTX_SHARED: channel context may be used by
7948c2ecf20Sopenharmony_ci *	multiple interfaces
7958c2ecf20Sopenharmony_ci * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used
7968c2ecf20Sopenharmony_ci *	only by a single interface. This can be used for example for
7978c2ecf20Sopenharmony_ci *	non-fixed channel IBSS.
7988c2ecf20Sopenharmony_ci */
7998c2ecf20Sopenharmony_cienum ieee80211_chanctx_mode {
8008c2ecf20Sopenharmony_ci	IEEE80211_CHANCTX_SHARED,
8018c2ecf20Sopenharmony_ci	IEEE80211_CHANCTX_EXCLUSIVE
8028c2ecf20Sopenharmony_ci};
8038c2ecf20Sopenharmony_ci
8048c2ecf20Sopenharmony_ci/**
8058c2ecf20Sopenharmony_ci * enum ieee80211_chanctx_replace_state - channel context replacement state
8068c2ecf20Sopenharmony_ci *
8078c2ecf20Sopenharmony_ci * This is used for channel context in-place reservations that require channel
8088c2ecf20Sopenharmony_ci * context switch/swap.
8098c2ecf20Sopenharmony_ci *
8108c2ecf20Sopenharmony_ci * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place
8118c2ecf20Sopenharmony_ci * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced
8128c2ecf20Sopenharmony_ci *	by a (not yet registered) channel context pointed by %replace_ctx.
8138c2ecf20Sopenharmony_ci * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context
8148c2ecf20Sopenharmony_ci *	replaces an existing channel context pointed to by %replace_ctx.
8158c2ecf20Sopenharmony_ci */
8168c2ecf20Sopenharmony_cienum ieee80211_chanctx_replace_state {
8178c2ecf20Sopenharmony_ci	IEEE80211_CHANCTX_REPLACE_NONE,
8188c2ecf20Sopenharmony_ci	IEEE80211_CHANCTX_WILL_BE_REPLACED,
8198c2ecf20Sopenharmony_ci	IEEE80211_CHANCTX_REPLACES_OTHER,
8208c2ecf20Sopenharmony_ci};
8218c2ecf20Sopenharmony_ci
8228c2ecf20Sopenharmony_cistruct ieee80211_chanctx {
8238c2ecf20Sopenharmony_ci	struct list_head list;
8248c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
8258c2ecf20Sopenharmony_ci
8268c2ecf20Sopenharmony_ci	struct list_head assigned_vifs;
8278c2ecf20Sopenharmony_ci	struct list_head reserved_vifs;
8288c2ecf20Sopenharmony_ci
8298c2ecf20Sopenharmony_ci	enum ieee80211_chanctx_replace_state replace_state;
8308c2ecf20Sopenharmony_ci	struct ieee80211_chanctx *replace_ctx;
8318c2ecf20Sopenharmony_ci
8328c2ecf20Sopenharmony_ci	enum ieee80211_chanctx_mode mode;
8338c2ecf20Sopenharmony_ci	bool driver_present;
8348c2ecf20Sopenharmony_ci
8358c2ecf20Sopenharmony_ci	struct ieee80211_chanctx_conf conf;
8368c2ecf20Sopenharmony_ci};
8378c2ecf20Sopenharmony_ci
8388c2ecf20Sopenharmony_cistruct mac80211_qos_map {
8398c2ecf20Sopenharmony_ci	struct cfg80211_qos_map qos_map;
8408c2ecf20Sopenharmony_ci	struct rcu_head rcu_head;
8418c2ecf20Sopenharmony_ci};
8428c2ecf20Sopenharmony_ci
8438c2ecf20Sopenharmony_cienum txq_info_flags {
8448c2ecf20Sopenharmony_ci	IEEE80211_TXQ_STOP,
8458c2ecf20Sopenharmony_ci	IEEE80211_TXQ_AMPDU,
8468c2ecf20Sopenharmony_ci	IEEE80211_TXQ_NO_AMSDU,
8478c2ecf20Sopenharmony_ci	IEEE80211_TXQ_STOP_NETIF_TX,
8488c2ecf20Sopenharmony_ci};
8498c2ecf20Sopenharmony_ci
8508c2ecf20Sopenharmony_ci/**
8518c2ecf20Sopenharmony_ci * struct txq_info - per tid queue
8528c2ecf20Sopenharmony_ci *
8538c2ecf20Sopenharmony_ci * @tin: contains packets split into multiple flows
8548c2ecf20Sopenharmony_ci * @def_flow: used as a fallback flow when a packet destined to @tin hashes to
8558c2ecf20Sopenharmony_ci *	a fq_flow which is already owned by a different tin
8568c2ecf20Sopenharmony_ci * @def_cvars: codel vars for @def_flow
8578c2ecf20Sopenharmony_ci * @frags: used to keep fragments created after dequeue
8588c2ecf20Sopenharmony_ci * @schedule_order: used with ieee80211_local->active_txqs
8598c2ecf20Sopenharmony_ci * @schedule_round: counter to prevent infinite loops on TXQ scheduling
8608c2ecf20Sopenharmony_ci */
8618c2ecf20Sopenharmony_cistruct txq_info {
8628c2ecf20Sopenharmony_ci	struct fq_tin tin;
8638c2ecf20Sopenharmony_ci	struct fq_flow def_flow;
8648c2ecf20Sopenharmony_ci	struct codel_vars def_cvars;
8658c2ecf20Sopenharmony_ci	struct codel_stats cstats;
8668c2ecf20Sopenharmony_ci	struct sk_buff_head frags;
8678c2ecf20Sopenharmony_ci	struct list_head schedule_order;
8688c2ecf20Sopenharmony_ci	u16 schedule_round;
8698c2ecf20Sopenharmony_ci	unsigned long flags;
8708c2ecf20Sopenharmony_ci
8718c2ecf20Sopenharmony_ci	/* keep last! */
8728c2ecf20Sopenharmony_ci	struct ieee80211_txq txq;
8738c2ecf20Sopenharmony_ci};
8748c2ecf20Sopenharmony_ci
8758c2ecf20Sopenharmony_cistruct ieee80211_if_mntr {
8768c2ecf20Sopenharmony_ci	u32 flags;
8778c2ecf20Sopenharmony_ci	u8 mu_follow_addr[ETH_ALEN] __aligned(2);
8788c2ecf20Sopenharmony_ci
8798c2ecf20Sopenharmony_ci	struct list_head list;
8808c2ecf20Sopenharmony_ci};
8818c2ecf20Sopenharmony_ci
8828c2ecf20Sopenharmony_ci/**
8838c2ecf20Sopenharmony_ci * struct ieee80211_if_nan - NAN state
8848c2ecf20Sopenharmony_ci *
8858c2ecf20Sopenharmony_ci * @conf: current NAN configuration
8868c2ecf20Sopenharmony_ci * @func_ids: a bitmap of available instance_id's
8878c2ecf20Sopenharmony_ci */
8888c2ecf20Sopenharmony_cistruct ieee80211_if_nan {
8898c2ecf20Sopenharmony_ci	struct cfg80211_nan_conf conf;
8908c2ecf20Sopenharmony_ci
8918c2ecf20Sopenharmony_ci	/* protects function_inst_ids */
8928c2ecf20Sopenharmony_ci	spinlock_t func_lock;
8938c2ecf20Sopenharmony_ci	struct idr function_inst_ids;
8948c2ecf20Sopenharmony_ci};
8958c2ecf20Sopenharmony_ci
8968c2ecf20Sopenharmony_cistruct ieee80211_sub_if_data {
8978c2ecf20Sopenharmony_ci	struct list_head list;
8988c2ecf20Sopenharmony_ci
8998c2ecf20Sopenharmony_ci	struct wireless_dev wdev;
9008c2ecf20Sopenharmony_ci
9018c2ecf20Sopenharmony_ci	/* keys */
9028c2ecf20Sopenharmony_ci	struct list_head key_list;
9038c2ecf20Sopenharmony_ci
9048c2ecf20Sopenharmony_ci	/* count for keys needing tailroom space allocation */
9058c2ecf20Sopenharmony_ci	int crypto_tx_tailroom_needed_cnt;
9068c2ecf20Sopenharmony_ci	int crypto_tx_tailroom_pending_dec;
9078c2ecf20Sopenharmony_ci	struct delayed_work dec_tailroom_needed_wk;
9088c2ecf20Sopenharmony_ci
9098c2ecf20Sopenharmony_ci	struct net_device *dev;
9108c2ecf20Sopenharmony_ci	struct ieee80211_local *local;
9118c2ecf20Sopenharmony_ci
9128c2ecf20Sopenharmony_ci	unsigned int flags;
9138c2ecf20Sopenharmony_ci
9148c2ecf20Sopenharmony_ci	unsigned long state;
9158c2ecf20Sopenharmony_ci
9168c2ecf20Sopenharmony_ci	char name[IFNAMSIZ];
9178c2ecf20Sopenharmony_ci
9188c2ecf20Sopenharmony_ci	struct ieee80211_fragment_cache frags;
9198c2ecf20Sopenharmony_ci
9208c2ecf20Sopenharmony_ci	/* TID bitmap for NoAck policy */
9218c2ecf20Sopenharmony_ci	u16 noack_map;
9228c2ecf20Sopenharmony_ci
9238c2ecf20Sopenharmony_ci	/* bit field of ACM bits (BIT(802.1D tag)) */
9248c2ecf20Sopenharmony_ci	u8 wmm_acm;
9258c2ecf20Sopenharmony_ci
9268c2ecf20Sopenharmony_ci	struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS +
9278c2ecf20Sopenharmony_ci					 NUM_DEFAULT_MGMT_KEYS +
9288c2ecf20Sopenharmony_ci					 NUM_DEFAULT_BEACON_KEYS];
9298c2ecf20Sopenharmony_ci	struct ieee80211_key __rcu *default_unicast_key;
9308c2ecf20Sopenharmony_ci	struct ieee80211_key __rcu *default_multicast_key;
9318c2ecf20Sopenharmony_ci	struct ieee80211_key __rcu *default_mgmt_key;
9328c2ecf20Sopenharmony_ci	struct ieee80211_key __rcu *default_beacon_key;
9338c2ecf20Sopenharmony_ci
9348c2ecf20Sopenharmony_ci	u16 sequence_number;
9358c2ecf20Sopenharmony_ci	__be16 control_port_protocol;
9368c2ecf20Sopenharmony_ci	bool control_port_no_encrypt;
9378c2ecf20Sopenharmony_ci	bool control_port_no_preauth;
9388c2ecf20Sopenharmony_ci	bool control_port_over_nl80211;
9398c2ecf20Sopenharmony_ci	int encrypt_headroom;
9408c2ecf20Sopenharmony_ci
9418c2ecf20Sopenharmony_ci	atomic_t num_tx_queued;
9428c2ecf20Sopenharmony_ci	struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
9438c2ecf20Sopenharmony_ci	struct mac80211_qos_map __rcu *qos_map;
9448c2ecf20Sopenharmony_ci
9458c2ecf20Sopenharmony_ci	struct work_struct csa_finalize_work;
9468c2ecf20Sopenharmony_ci	bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
9478c2ecf20Sopenharmony_ci	struct cfg80211_chan_def csa_chandef;
9488c2ecf20Sopenharmony_ci
9498c2ecf20Sopenharmony_ci	struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
9508c2ecf20Sopenharmony_ci	struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */
9518c2ecf20Sopenharmony_ci
9528c2ecf20Sopenharmony_ci	/* context reservation -- protected with chanctx_mtx */
9538c2ecf20Sopenharmony_ci	struct ieee80211_chanctx *reserved_chanctx;
9548c2ecf20Sopenharmony_ci	struct cfg80211_chan_def reserved_chandef;
9558c2ecf20Sopenharmony_ci	bool reserved_radar_required;
9568c2ecf20Sopenharmony_ci	bool reserved_ready;
9578c2ecf20Sopenharmony_ci
9588c2ecf20Sopenharmony_ci	/* used to reconfigure hardware SM PS */
9598c2ecf20Sopenharmony_ci	struct work_struct recalc_smps;
9608c2ecf20Sopenharmony_ci
9618c2ecf20Sopenharmony_ci	struct work_struct work;
9628c2ecf20Sopenharmony_ci	struct sk_buff_head skb_queue;
9638c2ecf20Sopenharmony_ci
9648c2ecf20Sopenharmony_ci	u8 needed_rx_chains;
9658c2ecf20Sopenharmony_ci	enum ieee80211_smps_mode smps_mode;
9668c2ecf20Sopenharmony_ci
9678c2ecf20Sopenharmony_ci	int user_power_level; /* in dBm */
9688c2ecf20Sopenharmony_ci	int ap_power_level; /* in dBm */
9698c2ecf20Sopenharmony_ci
9708c2ecf20Sopenharmony_ci	bool radar_required;
9718c2ecf20Sopenharmony_ci	struct delayed_work dfs_cac_timer_work;
9728c2ecf20Sopenharmony_ci
9738c2ecf20Sopenharmony_ci	/*
9748c2ecf20Sopenharmony_ci	 * AP this belongs to: self in AP mode and
9758c2ecf20Sopenharmony_ci	 * corresponding AP in VLAN mode, NULL for
9768c2ecf20Sopenharmony_ci	 * all others (might be needed later in IBSS)
9778c2ecf20Sopenharmony_ci	 */
9788c2ecf20Sopenharmony_ci	struct ieee80211_if_ap *bss;
9798c2ecf20Sopenharmony_ci
9808c2ecf20Sopenharmony_ci	/* bitmap of allowed (non-MCS) rate indexes for rate control */
9818c2ecf20Sopenharmony_ci	u32 rc_rateidx_mask[NUM_NL80211_BANDS];
9828c2ecf20Sopenharmony_ci
9838c2ecf20Sopenharmony_ci	bool rc_has_mcs_mask[NUM_NL80211_BANDS];
9848c2ecf20Sopenharmony_ci	u8  rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN];
9858c2ecf20Sopenharmony_ci
9868c2ecf20Sopenharmony_ci	bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS];
9878c2ecf20Sopenharmony_ci	u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX];
9888c2ecf20Sopenharmony_ci
9898c2ecf20Sopenharmony_ci	/* Beacon frame (non-MCS) rate (as a bitmap) */
9908c2ecf20Sopenharmony_ci	u32 beacon_rateidx_mask[NUM_NL80211_BANDS];
9918c2ecf20Sopenharmony_ci	bool beacon_rate_set;
9928c2ecf20Sopenharmony_ci
9938c2ecf20Sopenharmony_ci	union {
9948c2ecf20Sopenharmony_ci		struct ieee80211_if_ap ap;
9958c2ecf20Sopenharmony_ci		struct ieee80211_if_wds wds;
9968c2ecf20Sopenharmony_ci		struct ieee80211_if_vlan vlan;
9978c2ecf20Sopenharmony_ci		struct ieee80211_if_managed mgd;
9988c2ecf20Sopenharmony_ci		struct ieee80211_if_ibss ibss;
9998c2ecf20Sopenharmony_ci		struct ieee80211_if_mesh mesh;
10008c2ecf20Sopenharmony_ci		struct ieee80211_if_ocb ocb;
10018c2ecf20Sopenharmony_ci		struct ieee80211_if_mntr mntr;
10028c2ecf20Sopenharmony_ci		struct ieee80211_if_nan nan;
10038c2ecf20Sopenharmony_ci	} u;
10048c2ecf20Sopenharmony_ci
10058c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_DEBUGFS
10068c2ecf20Sopenharmony_ci	struct {
10078c2ecf20Sopenharmony_ci		struct dentry *subdir_stations;
10088c2ecf20Sopenharmony_ci		struct dentry *default_unicast_key;
10098c2ecf20Sopenharmony_ci		struct dentry *default_multicast_key;
10108c2ecf20Sopenharmony_ci		struct dentry *default_mgmt_key;
10118c2ecf20Sopenharmony_ci		struct dentry *default_beacon_key;
10128c2ecf20Sopenharmony_ci	} debugfs;
10138c2ecf20Sopenharmony_ci#endif
10148c2ecf20Sopenharmony_ci
10158c2ecf20Sopenharmony_ci	/* must be last, dynamically sized area in this! */
10168c2ecf20Sopenharmony_ci	struct ieee80211_vif vif;
10178c2ecf20Sopenharmony_ci};
10188c2ecf20Sopenharmony_ci
10198c2ecf20Sopenharmony_cistatic inline
10208c2ecf20Sopenharmony_cistruct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
10218c2ecf20Sopenharmony_ci{
10228c2ecf20Sopenharmony_ci	return container_of(p, struct ieee80211_sub_if_data, vif);
10238c2ecf20Sopenharmony_ci}
10248c2ecf20Sopenharmony_ci
10258c2ecf20Sopenharmony_cistatic inline void sdata_lock(struct ieee80211_sub_if_data *sdata)
10268c2ecf20Sopenharmony_ci	__acquires(&sdata->wdev.mtx)
10278c2ecf20Sopenharmony_ci{
10288c2ecf20Sopenharmony_ci	mutex_lock(&sdata->wdev.mtx);
10298c2ecf20Sopenharmony_ci	__acquire(&sdata->wdev.mtx);
10308c2ecf20Sopenharmony_ci}
10318c2ecf20Sopenharmony_ci
10328c2ecf20Sopenharmony_cistatic inline void sdata_unlock(struct ieee80211_sub_if_data *sdata)
10338c2ecf20Sopenharmony_ci	__releases(&sdata->wdev.mtx)
10348c2ecf20Sopenharmony_ci{
10358c2ecf20Sopenharmony_ci	mutex_unlock(&sdata->wdev.mtx);
10368c2ecf20Sopenharmony_ci	__release(&sdata->wdev.mtx);
10378c2ecf20Sopenharmony_ci}
10388c2ecf20Sopenharmony_ci
10398c2ecf20Sopenharmony_ci#define sdata_dereference(p, sdata) \
10408c2ecf20Sopenharmony_ci	rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx))
10418c2ecf20Sopenharmony_ci
10428c2ecf20Sopenharmony_cistatic inline void
10438c2ecf20Sopenharmony_cisdata_assert_lock(struct ieee80211_sub_if_data *sdata)
10448c2ecf20Sopenharmony_ci{
10458c2ecf20Sopenharmony_ci	lockdep_assert_held(&sdata->wdev.mtx);
10468c2ecf20Sopenharmony_ci}
10478c2ecf20Sopenharmony_ci
10488c2ecf20Sopenharmony_cistatic inline int
10498c2ecf20Sopenharmony_ciieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef)
10508c2ecf20Sopenharmony_ci{
10518c2ecf20Sopenharmony_ci	switch (chandef->width) {
10528c2ecf20Sopenharmony_ci	case NL80211_CHAN_WIDTH_5:
10538c2ecf20Sopenharmony_ci		return 2;
10548c2ecf20Sopenharmony_ci	case NL80211_CHAN_WIDTH_10:
10558c2ecf20Sopenharmony_ci		return 1;
10568c2ecf20Sopenharmony_ci	default:
10578c2ecf20Sopenharmony_ci		return 0;
10588c2ecf20Sopenharmony_ci	}
10598c2ecf20Sopenharmony_ci}
10608c2ecf20Sopenharmony_ci
10618c2ecf20Sopenharmony_cistatic inline int
10628c2ecf20Sopenharmony_ciieee80211_vif_get_shift(struct ieee80211_vif *vif)
10638c2ecf20Sopenharmony_ci{
10648c2ecf20Sopenharmony_ci	struct ieee80211_chanctx_conf *chanctx_conf;
10658c2ecf20Sopenharmony_ci	int shift = 0;
10668c2ecf20Sopenharmony_ci
10678c2ecf20Sopenharmony_ci	rcu_read_lock();
10688c2ecf20Sopenharmony_ci	chanctx_conf = rcu_dereference(vif->chanctx_conf);
10698c2ecf20Sopenharmony_ci	if (chanctx_conf)
10708c2ecf20Sopenharmony_ci		shift = ieee80211_chandef_get_shift(&chanctx_conf->def);
10718c2ecf20Sopenharmony_ci	rcu_read_unlock();
10728c2ecf20Sopenharmony_ci
10738c2ecf20Sopenharmony_ci	return shift;
10748c2ecf20Sopenharmony_ci}
10758c2ecf20Sopenharmony_ci
10768c2ecf20Sopenharmony_cienum {
10778c2ecf20Sopenharmony_ci	IEEE80211_RX_MSG	= 1,
10788c2ecf20Sopenharmony_ci	IEEE80211_TX_STATUS_MSG	= 2,
10798c2ecf20Sopenharmony_ci};
10808c2ecf20Sopenharmony_ci
10818c2ecf20Sopenharmony_cienum queue_stop_reason {
10828c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_DRIVER,
10838c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_PS,
10848c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_CSA,
10858c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
10868c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_SUSPEND,
10878c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
10888c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL,
10898c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_FLUSH,
10908c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN,
10918c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_RESERVE_TID,
10928c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE,
10938c2ecf20Sopenharmony_ci
10948c2ecf20Sopenharmony_ci	IEEE80211_QUEUE_STOP_REASONS,
10958c2ecf20Sopenharmony_ci};
10968c2ecf20Sopenharmony_ci
10978c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_LEDS
10988c2ecf20Sopenharmony_cistruct tpt_led_trigger {
10998c2ecf20Sopenharmony_ci	char name[32];
11008c2ecf20Sopenharmony_ci	const struct ieee80211_tpt_blink *blink_table;
11018c2ecf20Sopenharmony_ci	unsigned int blink_table_len;
11028c2ecf20Sopenharmony_ci	struct timer_list timer;
11038c2ecf20Sopenharmony_ci	struct ieee80211_local *local;
11048c2ecf20Sopenharmony_ci	unsigned long prev_traffic;
11058c2ecf20Sopenharmony_ci	unsigned long tx_bytes, rx_bytes;
11068c2ecf20Sopenharmony_ci	unsigned int active, want;
11078c2ecf20Sopenharmony_ci	bool running;
11088c2ecf20Sopenharmony_ci};
11098c2ecf20Sopenharmony_ci#endif
11108c2ecf20Sopenharmony_ci
11118c2ecf20Sopenharmony_ci/**
11128c2ecf20Sopenharmony_ci * mac80211 scan flags - currently active scan mode
11138c2ecf20Sopenharmony_ci *
11148c2ecf20Sopenharmony_ci * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
11158c2ecf20Sopenharmony_ci *	well be on the operating channel
11168c2ecf20Sopenharmony_ci * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
11178c2ecf20Sopenharmony_ci *	determine if we are on the operating channel or not
11188c2ecf20Sopenharmony_ci * @SCAN_ONCHANNEL_SCANNING:  Do a software scan on only the current operating
11198c2ecf20Sopenharmony_ci *	channel. This should not interrupt normal traffic.
11208c2ecf20Sopenharmony_ci * @SCAN_COMPLETED: Set for our scan work function when the driver reported
11218c2ecf20Sopenharmony_ci *	that the scan completed.
11228c2ecf20Sopenharmony_ci * @SCAN_ABORTED: Set for our scan work function when the driver reported
11238c2ecf20Sopenharmony_ci *	a scan complete for an aborted scan.
11248c2ecf20Sopenharmony_ci * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being
11258c2ecf20Sopenharmony_ci *	cancelled.
11268c2ecf20Sopenharmony_ci * @SCAN_BEACON_WAIT: Set whenever we're passive scanning because of radar/no-IR
11278c2ecf20Sopenharmony_ci *	and could send a probe request after receiving a beacon.
11288c2ecf20Sopenharmony_ci * @SCAN_BEACON_DONE: Beacon received, we can now send a probe request
11298c2ecf20Sopenharmony_ci */
11308c2ecf20Sopenharmony_cienum {
11318c2ecf20Sopenharmony_ci	SCAN_SW_SCANNING,
11328c2ecf20Sopenharmony_ci	SCAN_HW_SCANNING,
11338c2ecf20Sopenharmony_ci	SCAN_ONCHANNEL_SCANNING,
11348c2ecf20Sopenharmony_ci	SCAN_COMPLETED,
11358c2ecf20Sopenharmony_ci	SCAN_ABORTED,
11368c2ecf20Sopenharmony_ci	SCAN_HW_CANCELLED,
11378c2ecf20Sopenharmony_ci	SCAN_BEACON_WAIT,
11388c2ecf20Sopenharmony_ci	SCAN_BEACON_DONE,
11398c2ecf20Sopenharmony_ci};
11408c2ecf20Sopenharmony_ci
11418c2ecf20Sopenharmony_ci/**
11428c2ecf20Sopenharmony_ci * enum mac80211_scan_state - scan state machine states
11438c2ecf20Sopenharmony_ci *
11448c2ecf20Sopenharmony_ci * @SCAN_DECISION: Main entry point to the scan state machine, this state
11458c2ecf20Sopenharmony_ci *	determines if we should keep on scanning or switch back to the
11468c2ecf20Sopenharmony_ci *	operating channel
11478c2ecf20Sopenharmony_ci * @SCAN_SET_CHANNEL: Set the next channel to be scanned
11488c2ecf20Sopenharmony_ci * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
11498c2ecf20Sopenharmony_ci * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
11508c2ecf20Sopenharmony_ci *	send out data
11518c2ecf20Sopenharmony_ci * @SCAN_RESUME: Resume the scan and scan the next channel
11528c2ecf20Sopenharmony_ci * @SCAN_ABORT: Abort the scan and go back to operating channel
11538c2ecf20Sopenharmony_ci */
11548c2ecf20Sopenharmony_cienum mac80211_scan_state {
11558c2ecf20Sopenharmony_ci	SCAN_DECISION,
11568c2ecf20Sopenharmony_ci	SCAN_SET_CHANNEL,
11578c2ecf20Sopenharmony_ci	SCAN_SEND_PROBE,
11588c2ecf20Sopenharmony_ci	SCAN_SUSPEND,
11598c2ecf20Sopenharmony_ci	SCAN_RESUME,
11608c2ecf20Sopenharmony_ci	SCAN_ABORT,
11618c2ecf20Sopenharmony_ci};
11628c2ecf20Sopenharmony_ci
11638c2ecf20Sopenharmony_cistruct ieee80211_local {
11648c2ecf20Sopenharmony_ci	/* embed the driver visible part.
11658c2ecf20Sopenharmony_ci	 * don't cast (use the static inlines below), but we keep
11668c2ecf20Sopenharmony_ci	 * it first anyway so they become a no-op */
11678c2ecf20Sopenharmony_ci	struct ieee80211_hw hw;
11688c2ecf20Sopenharmony_ci
11698c2ecf20Sopenharmony_ci	struct fq fq;
11708c2ecf20Sopenharmony_ci	struct codel_vars *cvars;
11718c2ecf20Sopenharmony_ci	struct codel_params cparams;
11728c2ecf20Sopenharmony_ci
11738c2ecf20Sopenharmony_ci	/* protects active_txqs and txqi->schedule_order */
11748c2ecf20Sopenharmony_ci	spinlock_t active_txq_lock[IEEE80211_NUM_ACS];
11758c2ecf20Sopenharmony_ci	struct list_head active_txqs[IEEE80211_NUM_ACS];
11768c2ecf20Sopenharmony_ci	u16 schedule_round[IEEE80211_NUM_ACS];
11778c2ecf20Sopenharmony_ci
11788c2ecf20Sopenharmony_ci	u16 airtime_flags;
11798c2ecf20Sopenharmony_ci	u32 aql_txq_limit_low[IEEE80211_NUM_ACS];
11808c2ecf20Sopenharmony_ci	u32 aql_txq_limit_high[IEEE80211_NUM_ACS];
11818c2ecf20Sopenharmony_ci	u32 aql_threshold;
11828c2ecf20Sopenharmony_ci	atomic_t aql_total_pending_airtime;
11838c2ecf20Sopenharmony_ci
11848c2ecf20Sopenharmony_ci	const struct ieee80211_ops *ops;
11858c2ecf20Sopenharmony_ci
11868c2ecf20Sopenharmony_ci	/*
11878c2ecf20Sopenharmony_ci	 * private workqueue to mac80211. mac80211 makes this accessible
11888c2ecf20Sopenharmony_ci	 * via ieee80211_queue_work()
11898c2ecf20Sopenharmony_ci	 */
11908c2ecf20Sopenharmony_ci	struct workqueue_struct *workqueue;
11918c2ecf20Sopenharmony_ci
11928c2ecf20Sopenharmony_ci	unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
11938c2ecf20Sopenharmony_ci	int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS];
11948c2ecf20Sopenharmony_ci	/* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
11958c2ecf20Sopenharmony_ci	spinlock_t queue_stop_reason_lock;
11968c2ecf20Sopenharmony_ci
11978c2ecf20Sopenharmony_ci	int open_count;
11988c2ecf20Sopenharmony_ci	int monitors, cooked_mntrs;
11998c2ecf20Sopenharmony_ci	/* number of interfaces with corresponding FIF_ flags */
12008c2ecf20Sopenharmony_ci	int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
12018c2ecf20Sopenharmony_ci	    fif_probe_req;
12028c2ecf20Sopenharmony_ci	bool probe_req_reg;
12038c2ecf20Sopenharmony_ci	bool rx_mcast_action_reg;
12048c2ecf20Sopenharmony_ci	unsigned int filter_flags; /* FIF_* */
12058c2ecf20Sopenharmony_ci
12068c2ecf20Sopenharmony_ci	bool wiphy_ciphers_allocated;
12078c2ecf20Sopenharmony_ci
12088c2ecf20Sopenharmony_ci	bool use_chanctx;
12098c2ecf20Sopenharmony_ci
12108c2ecf20Sopenharmony_ci	/* protects the aggregated multicast list and filter calls */
12118c2ecf20Sopenharmony_ci	spinlock_t filter_lock;
12128c2ecf20Sopenharmony_ci
12138c2ecf20Sopenharmony_ci	/* used for uploading changed mc list */
12148c2ecf20Sopenharmony_ci	struct work_struct reconfig_filter;
12158c2ecf20Sopenharmony_ci
12168c2ecf20Sopenharmony_ci	/* aggregated multicast list */
12178c2ecf20Sopenharmony_ci	struct netdev_hw_addr_list mc_list;
12188c2ecf20Sopenharmony_ci
12198c2ecf20Sopenharmony_ci	bool tim_in_locked_section; /* see ieee80211_beacon_get() */
12208c2ecf20Sopenharmony_ci
12218c2ecf20Sopenharmony_ci	/*
12228c2ecf20Sopenharmony_ci	 * suspended is true if we finished all the suspend _and_ we have
12238c2ecf20Sopenharmony_ci	 * not yet come up from resume. This is to be used by mac80211
12248c2ecf20Sopenharmony_ci	 * to ensure driver sanity during suspend and mac80211's own
12258c2ecf20Sopenharmony_ci	 * sanity. It can eventually be used for WoW as well.
12268c2ecf20Sopenharmony_ci	 */
12278c2ecf20Sopenharmony_ci	bool suspended;
12288c2ecf20Sopenharmony_ci
12298c2ecf20Sopenharmony_ci	/*
12308c2ecf20Sopenharmony_ci	 * Resuming is true while suspended, but when we're reprogramming the
12318c2ecf20Sopenharmony_ci	 * hardware -- at that time it's allowed to use ieee80211_queue_work()
12328c2ecf20Sopenharmony_ci	 * again even though some other parts of the stack are still suspended
12338c2ecf20Sopenharmony_ci	 * and we still drop received frames to avoid waking the stack.
12348c2ecf20Sopenharmony_ci	 */
12358c2ecf20Sopenharmony_ci	bool resuming;
12368c2ecf20Sopenharmony_ci
12378c2ecf20Sopenharmony_ci	/*
12388c2ecf20Sopenharmony_ci	 * quiescing is true during the suspend process _only_ to
12398c2ecf20Sopenharmony_ci	 * ease timer cancelling etc.
12408c2ecf20Sopenharmony_ci	 */
12418c2ecf20Sopenharmony_ci	bool quiescing;
12428c2ecf20Sopenharmony_ci
12438c2ecf20Sopenharmony_ci	/* device is started */
12448c2ecf20Sopenharmony_ci	bool started;
12458c2ecf20Sopenharmony_ci
12468c2ecf20Sopenharmony_ci	/* device is during a HW reconfig */
12478c2ecf20Sopenharmony_ci	bool in_reconfig;
12488c2ecf20Sopenharmony_ci
12498c2ecf20Sopenharmony_ci	/* wowlan is enabled -- don't reconfig on resume */
12508c2ecf20Sopenharmony_ci	bool wowlan;
12518c2ecf20Sopenharmony_ci
12528c2ecf20Sopenharmony_ci	struct work_struct radar_detected_work;
12538c2ecf20Sopenharmony_ci
12548c2ecf20Sopenharmony_ci	/* number of RX chains the hardware has */
12558c2ecf20Sopenharmony_ci	u8 rx_chains;
12568c2ecf20Sopenharmony_ci
12578c2ecf20Sopenharmony_ci	/* bitmap of which sbands were copied */
12588c2ecf20Sopenharmony_ci	u8 sband_allocated;
12598c2ecf20Sopenharmony_ci
12608c2ecf20Sopenharmony_ci	int tx_headroom; /* required headroom for hardware/radiotap */
12618c2ecf20Sopenharmony_ci
12628c2ecf20Sopenharmony_ci	/* Tasklet and skb queue to process calls from IRQ mode. All frames
12638c2ecf20Sopenharmony_ci	 * added to skb_queue will be processed, but frames in
12648c2ecf20Sopenharmony_ci	 * skb_queue_unreliable may be dropped if the total length of these
12658c2ecf20Sopenharmony_ci	 * queues increases over the limit. */
12668c2ecf20Sopenharmony_ci#define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
12678c2ecf20Sopenharmony_ci	struct tasklet_struct tasklet;
12688c2ecf20Sopenharmony_ci	struct sk_buff_head skb_queue;
12698c2ecf20Sopenharmony_ci	struct sk_buff_head skb_queue_unreliable;
12708c2ecf20Sopenharmony_ci
12718c2ecf20Sopenharmony_ci	spinlock_t rx_path_lock;
12728c2ecf20Sopenharmony_ci
12738c2ecf20Sopenharmony_ci	/* Station data */
12748c2ecf20Sopenharmony_ci	/*
12758c2ecf20Sopenharmony_ci	 * The mutex only protects the list, hash table and
12768c2ecf20Sopenharmony_ci	 * counter, reads are done with RCU.
12778c2ecf20Sopenharmony_ci	 */
12788c2ecf20Sopenharmony_ci	struct mutex sta_mtx;
12798c2ecf20Sopenharmony_ci	spinlock_t tim_lock;
12808c2ecf20Sopenharmony_ci	unsigned long num_sta;
12818c2ecf20Sopenharmony_ci	struct list_head sta_list;
12828c2ecf20Sopenharmony_ci	struct rhltable sta_hash;
12838c2ecf20Sopenharmony_ci	struct timer_list sta_cleanup;
12848c2ecf20Sopenharmony_ci	int sta_generation;
12858c2ecf20Sopenharmony_ci
12868c2ecf20Sopenharmony_ci	struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
12878c2ecf20Sopenharmony_ci	struct tasklet_struct tx_pending_tasklet;
12888c2ecf20Sopenharmony_ci	struct tasklet_struct wake_txqs_tasklet;
12898c2ecf20Sopenharmony_ci
12908c2ecf20Sopenharmony_ci	atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
12918c2ecf20Sopenharmony_ci
12928c2ecf20Sopenharmony_ci	/* number of interfaces with allmulti RX */
12938c2ecf20Sopenharmony_ci	atomic_t iff_allmultis;
12948c2ecf20Sopenharmony_ci
12958c2ecf20Sopenharmony_ci	struct rate_control_ref *rate_ctrl;
12968c2ecf20Sopenharmony_ci
12978c2ecf20Sopenharmony_ci	struct arc4_ctx wep_tx_ctx;
12988c2ecf20Sopenharmony_ci	struct arc4_ctx wep_rx_ctx;
12998c2ecf20Sopenharmony_ci	u32 wep_iv;
13008c2ecf20Sopenharmony_ci
13018c2ecf20Sopenharmony_ci	/* see iface.c */
13028c2ecf20Sopenharmony_ci	struct list_head interfaces;
13038c2ecf20Sopenharmony_ci	struct list_head mon_list; /* only that are IFF_UP && !cooked */
13048c2ecf20Sopenharmony_ci	struct mutex iflist_mtx;
13058c2ecf20Sopenharmony_ci
13068c2ecf20Sopenharmony_ci	/*
13078c2ecf20Sopenharmony_ci	 * Key mutex, protects sdata's key_list and sta_info's
13088c2ecf20Sopenharmony_ci	 * key pointers and ptk_idx (write access, they're RCU.)
13098c2ecf20Sopenharmony_ci	 */
13108c2ecf20Sopenharmony_ci	struct mutex key_mtx;
13118c2ecf20Sopenharmony_ci
13128c2ecf20Sopenharmony_ci	/* mutex for scan and work locking */
13138c2ecf20Sopenharmony_ci	struct mutex mtx;
13148c2ecf20Sopenharmony_ci
13158c2ecf20Sopenharmony_ci	/* Scanning and BSS list */
13168c2ecf20Sopenharmony_ci	unsigned long scanning;
13178c2ecf20Sopenharmony_ci	struct cfg80211_ssid scan_ssid;
13188c2ecf20Sopenharmony_ci	struct cfg80211_scan_request *int_scan_req;
13198c2ecf20Sopenharmony_ci	struct cfg80211_scan_request __rcu *scan_req;
13208c2ecf20Sopenharmony_ci	struct ieee80211_scan_request *hw_scan_req;
13218c2ecf20Sopenharmony_ci	struct cfg80211_chan_def scan_chandef;
13228c2ecf20Sopenharmony_ci	enum nl80211_band hw_scan_band;
13238c2ecf20Sopenharmony_ci	int scan_channel_idx;
13248c2ecf20Sopenharmony_ci	int scan_ies_len;
13258c2ecf20Sopenharmony_ci	int hw_scan_ies_bufsize;
13268c2ecf20Sopenharmony_ci	struct cfg80211_scan_info scan_info;
13278c2ecf20Sopenharmony_ci
13288c2ecf20Sopenharmony_ci	struct work_struct sched_scan_stopped_work;
13298c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data __rcu *sched_scan_sdata;
13308c2ecf20Sopenharmony_ci	struct cfg80211_sched_scan_request __rcu *sched_scan_req;
13318c2ecf20Sopenharmony_ci	u8 scan_addr[ETH_ALEN];
13328c2ecf20Sopenharmony_ci
13338c2ecf20Sopenharmony_ci	unsigned long leave_oper_channel_time;
13348c2ecf20Sopenharmony_ci	enum mac80211_scan_state next_scan_state;
13358c2ecf20Sopenharmony_ci	struct delayed_work scan_work;
13368c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data __rcu *scan_sdata;
13378c2ecf20Sopenharmony_ci	/* For backward compatibility only -- do not use */
13388c2ecf20Sopenharmony_ci	struct cfg80211_chan_def _oper_chandef;
13398c2ecf20Sopenharmony_ci
13408c2ecf20Sopenharmony_ci	/* Temporary remain-on-channel for off-channel operations */
13418c2ecf20Sopenharmony_ci	struct ieee80211_channel *tmp_channel;
13428c2ecf20Sopenharmony_ci
13438c2ecf20Sopenharmony_ci	/* channel contexts */
13448c2ecf20Sopenharmony_ci	struct list_head chanctx_list;
13458c2ecf20Sopenharmony_ci	struct mutex chanctx_mtx;
13468c2ecf20Sopenharmony_ci
13478c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_LEDS
13488c2ecf20Sopenharmony_ci	struct led_trigger tx_led, rx_led, assoc_led, radio_led;
13498c2ecf20Sopenharmony_ci	struct led_trigger tpt_led;
13508c2ecf20Sopenharmony_ci	atomic_t tx_led_active, rx_led_active, assoc_led_active;
13518c2ecf20Sopenharmony_ci	atomic_t radio_led_active, tpt_led_active;
13528c2ecf20Sopenharmony_ci	struct tpt_led_trigger *tpt_led_trigger;
13538c2ecf20Sopenharmony_ci#endif
13548c2ecf20Sopenharmony_ci
13558c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
13568c2ecf20Sopenharmony_ci	/* SNMP counters */
13578c2ecf20Sopenharmony_ci	/* dot11CountersTable */
13588c2ecf20Sopenharmony_ci	u32 dot11TransmittedFragmentCount;
13598c2ecf20Sopenharmony_ci	u32 dot11MulticastTransmittedFrameCount;
13608c2ecf20Sopenharmony_ci	u32 dot11FailedCount;
13618c2ecf20Sopenharmony_ci	u32 dot11RetryCount;
13628c2ecf20Sopenharmony_ci	u32 dot11MultipleRetryCount;
13638c2ecf20Sopenharmony_ci	u32 dot11FrameDuplicateCount;
13648c2ecf20Sopenharmony_ci	u32 dot11ReceivedFragmentCount;
13658c2ecf20Sopenharmony_ci	u32 dot11MulticastReceivedFrameCount;
13668c2ecf20Sopenharmony_ci	u32 dot11TransmittedFrameCount;
13678c2ecf20Sopenharmony_ci
13688c2ecf20Sopenharmony_ci	/* TX/RX handler statistics */
13698c2ecf20Sopenharmony_ci	unsigned int tx_handlers_drop;
13708c2ecf20Sopenharmony_ci	unsigned int tx_handlers_queued;
13718c2ecf20Sopenharmony_ci	unsigned int tx_handlers_drop_wep;
13728c2ecf20Sopenharmony_ci	unsigned int tx_handlers_drop_not_assoc;
13738c2ecf20Sopenharmony_ci	unsigned int tx_handlers_drop_unauth_port;
13748c2ecf20Sopenharmony_ci	unsigned int rx_handlers_drop;
13758c2ecf20Sopenharmony_ci	unsigned int rx_handlers_queued;
13768c2ecf20Sopenharmony_ci	unsigned int rx_handlers_drop_nullfunc;
13778c2ecf20Sopenharmony_ci	unsigned int rx_handlers_drop_defrag;
13788c2ecf20Sopenharmony_ci	unsigned int tx_expand_skb_head;
13798c2ecf20Sopenharmony_ci	unsigned int tx_expand_skb_head_cloned;
13808c2ecf20Sopenharmony_ci	unsigned int rx_expand_skb_head_defrag;
13818c2ecf20Sopenharmony_ci	unsigned int rx_handlers_fragments;
13828c2ecf20Sopenharmony_ci	unsigned int tx_status_drop;
13838c2ecf20Sopenharmony_ci#define I802_DEBUG_INC(c) (c)++
13848c2ecf20Sopenharmony_ci#else /* CONFIG_MAC80211_DEBUG_COUNTERS */
13858c2ecf20Sopenharmony_ci#define I802_DEBUG_INC(c) do { } while (0)
13868c2ecf20Sopenharmony_ci#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
13878c2ecf20Sopenharmony_ci
13888c2ecf20Sopenharmony_ci
13898c2ecf20Sopenharmony_ci	int total_ps_buffered; /* total number of all buffered unicast and
13908c2ecf20Sopenharmony_ci				* multicast packets for power saving stations
13918c2ecf20Sopenharmony_ci				*/
13928c2ecf20Sopenharmony_ci
13938c2ecf20Sopenharmony_ci	bool pspolling;
13948c2ecf20Sopenharmony_ci	/*
13958c2ecf20Sopenharmony_ci	 * PS can only be enabled when we have exactly one managed
13968c2ecf20Sopenharmony_ci	 * interface (and monitors) in PS, this then points there.
13978c2ecf20Sopenharmony_ci	 */
13988c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data *ps_sdata;
13998c2ecf20Sopenharmony_ci	struct work_struct dynamic_ps_enable_work;
14008c2ecf20Sopenharmony_ci	struct work_struct dynamic_ps_disable_work;
14018c2ecf20Sopenharmony_ci	struct timer_list dynamic_ps_timer;
14028c2ecf20Sopenharmony_ci	struct notifier_block ifa_notifier;
14038c2ecf20Sopenharmony_ci	struct notifier_block ifa6_notifier;
14048c2ecf20Sopenharmony_ci
14058c2ecf20Sopenharmony_ci	/*
14068c2ecf20Sopenharmony_ci	 * The dynamic ps timeout configured from user space via WEXT -
14078c2ecf20Sopenharmony_ci	 * this will override whatever chosen by mac80211 internally.
14088c2ecf20Sopenharmony_ci	 */
14098c2ecf20Sopenharmony_ci	int dynamic_ps_forced_timeout;
14108c2ecf20Sopenharmony_ci
14118c2ecf20Sopenharmony_ci	int user_power_level; /* in dBm, for all interfaces */
14128c2ecf20Sopenharmony_ci
14138c2ecf20Sopenharmony_ci	enum ieee80211_smps_mode smps_mode;
14148c2ecf20Sopenharmony_ci
14158c2ecf20Sopenharmony_ci	struct work_struct restart_work;
14168c2ecf20Sopenharmony_ci
14178c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_DEBUGFS
14188c2ecf20Sopenharmony_ci	struct local_debugfsdentries {
14198c2ecf20Sopenharmony_ci		struct dentry *rcdir;
14208c2ecf20Sopenharmony_ci		struct dentry *keys;
14218c2ecf20Sopenharmony_ci	} debugfs;
14228c2ecf20Sopenharmony_ci	bool force_tx_status;
14238c2ecf20Sopenharmony_ci#endif
14248c2ecf20Sopenharmony_ci
14258c2ecf20Sopenharmony_ci	/*
14268c2ecf20Sopenharmony_ci	 * Remain-on-channel support
14278c2ecf20Sopenharmony_ci	 */
14288c2ecf20Sopenharmony_ci	struct delayed_work roc_work;
14298c2ecf20Sopenharmony_ci	struct list_head roc_list;
14308c2ecf20Sopenharmony_ci	struct work_struct hw_roc_start, hw_roc_done;
14318c2ecf20Sopenharmony_ci	unsigned long hw_roc_start_time;
14328c2ecf20Sopenharmony_ci	u64 roc_cookie_counter;
14338c2ecf20Sopenharmony_ci
14348c2ecf20Sopenharmony_ci	struct idr ack_status_frames;
14358c2ecf20Sopenharmony_ci	spinlock_t ack_status_lock;
14368c2ecf20Sopenharmony_ci
14378c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data __rcu *p2p_sdata;
14388c2ecf20Sopenharmony_ci
14398c2ecf20Sopenharmony_ci	/* virtual monitor interface */
14408c2ecf20Sopenharmony_ci	struct ieee80211_sub_if_data __rcu *monitor_sdata;
14418c2ecf20Sopenharmony_ci	struct cfg80211_chan_def monitor_chandef;
14428c2ecf20Sopenharmony_ci
14438c2ecf20Sopenharmony_ci	/* extended capabilities provided by mac80211 */
14448c2ecf20Sopenharmony_ci	u8 ext_capa[8];
14458c2ecf20Sopenharmony_ci
14468c2ecf20Sopenharmony_ci	/* TDLS channel switch */
14478c2ecf20Sopenharmony_ci	struct work_struct tdls_chsw_work;
14488c2ecf20Sopenharmony_ci	struct sk_buff_head skb_queue_tdls_chsw;
14498c2ecf20Sopenharmony_ci};
14508c2ecf20Sopenharmony_ci
14518c2ecf20Sopenharmony_cistatic inline struct ieee80211_sub_if_data *
14528c2ecf20Sopenharmony_ciIEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
14538c2ecf20Sopenharmony_ci{
14548c2ecf20Sopenharmony_ci	return netdev_priv(dev);
14558c2ecf20Sopenharmony_ci}
14568c2ecf20Sopenharmony_ci
14578c2ecf20Sopenharmony_cistatic inline struct ieee80211_sub_if_data *
14588c2ecf20Sopenharmony_ciIEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev)
14598c2ecf20Sopenharmony_ci{
14608c2ecf20Sopenharmony_ci	return container_of(wdev, struct ieee80211_sub_if_data, wdev);
14618c2ecf20Sopenharmony_ci}
14628c2ecf20Sopenharmony_ci
14638c2ecf20Sopenharmony_cistatic inline struct ieee80211_supported_band *
14648c2ecf20Sopenharmony_ciieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
14658c2ecf20Sopenharmony_ci{
14668c2ecf20Sopenharmony_ci	struct ieee80211_local *local = sdata->local;
14678c2ecf20Sopenharmony_ci	struct ieee80211_chanctx_conf *chanctx_conf;
14688c2ecf20Sopenharmony_ci	enum nl80211_band band;
14698c2ecf20Sopenharmony_ci
14708c2ecf20Sopenharmony_ci	rcu_read_lock();
14718c2ecf20Sopenharmony_ci	chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
14728c2ecf20Sopenharmony_ci
14738c2ecf20Sopenharmony_ci	if (!chanctx_conf) {
14748c2ecf20Sopenharmony_ci		rcu_read_unlock();
14758c2ecf20Sopenharmony_ci		return NULL;
14768c2ecf20Sopenharmony_ci	}
14778c2ecf20Sopenharmony_ci
14788c2ecf20Sopenharmony_ci	band = chanctx_conf->def.chan->band;
14798c2ecf20Sopenharmony_ci	rcu_read_unlock();
14808c2ecf20Sopenharmony_ci
14818c2ecf20Sopenharmony_ci	return local->hw.wiphy->bands[band];
14828c2ecf20Sopenharmony_ci}
14838c2ecf20Sopenharmony_ci
14848c2ecf20Sopenharmony_ci/* this struct holds the value parsing from channel switch IE  */
14858c2ecf20Sopenharmony_cistruct ieee80211_csa_ie {
14868c2ecf20Sopenharmony_ci	struct cfg80211_chan_def chandef;
14878c2ecf20Sopenharmony_ci	u8 mode;
14888c2ecf20Sopenharmony_ci	u8 count;
14898c2ecf20Sopenharmony_ci	u8 ttl;
14908c2ecf20Sopenharmony_ci	u16 pre_value;
14918c2ecf20Sopenharmony_ci	u16 reason_code;
14928c2ecf20Sopenharmony_ci	u32 max_switch_time;
14938c2ecf20Sopenharmony_ci};
14948c2ecf20Sopenharmony_ci
14958c2ecf20Sopenharmony_ci/* Parsed Information Elements */
14968c2ecf20Sopenharmony_cistruct ieee802_11_elems {
14978c2ecf20Sopenharmony_ci	const u8 *ie_start;
14988c2ecf20Sopenharmony_ci	size_t total_len;
14998c2ecf20Sopenharmony_ci
15008c2ecf20Sopenharmony_ci	/* pointers to IEs */
15018c2ecf20Sopenharmony_ci	const struct ieee80211_tdls_lnkie *lnk_id;
15028c2ecf20Sopenharmony_ci	const struct ieee80211_ch_switch_timing *ch_sw_timing;
15038c2ecf20Sopenharmony_ci	const u8 *ext_capab;
15048c2ecf20Sopenharmony_ci	const u8 *ssid;
15058c2ecf20Sopenharmony_ci	const u8 *supp_rates;
15068c2ecf20Sopenharmony_ci	const u8 *ds_params;
15078c2ecf20Sopenharmony_ci	const struct ieee80211_tim_ie *tim;
15088c2ecf20Sopenharmony_ci	const u8 *rsn;
15098c2ecf20Sopenharmony_ci	const u8 *rsnx;
15108c2ecf20Sopenharmony_ci	const u8 *erp_info;
15118c2ecf20Sopenharmony_ci	const u8 *ext_supp_rates;
15128c2ecf20Sopenharmony_ci	const u8 *wmm_info;
15138c2ecf20Sopenharmony_ci	const u8 *wmm_param;
15148c2ecf20Sopenharmony_ci	const struct ieee80211_ht_cap *ht_cap_elem;
15158c2ecf20Sopenharmony_ci	const struct ieee80211_ht_operation *ht_operation;
15168c2ecf20Sopenharmony_ci	const struct ieee80211_vht_cap *vht_cap_elem;
15178c2ecf20Sopenharmony_ci	const struct ieee80211_vht_operation *vht_operation;
15188c2ecf20Sopenharmony_ci	const struct ieee80211_meshconf_ie *mesh_config;
15198c2ecf20Sopenharmony_ci	const u8 *he_cap;
15208c2ecf20Sopenharmony_ci	const struct ieee80211_he_operation *he_operation;
15218c2ecf20Sopenharmony_ci	const struct ieee80211_he_spr *he_spr;
15228c2ecf20Sopenharmony_ci	const struct ieee80211_mu_edca_param_set *mu_edca_param_set;
15238c2ecf20Sopenharmony_ci	const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
15248c2ecf20Sopenharmony_ci	const u8 *uora_element;
15258c2ecf20Sopenharmony_ci	const u8 *mesh_id;
15268c2ecf20Sopenharmony_ci	const u8 *peering;
15278c2ecf20Sopenharmony_ci	const __le16 *awake_window;
15288c2ecf20Sopenharmony_ci	const u8 *preq;
15298c2ecf20Sopenharmony_ci	const u8 *prep;
15308c2ecf20Sopenharmony_ci	const u8 *perr;
15318c2ecf20Sopenharmony_ci	const struct ieee80211_rann_ie *rann;
15328c2ecf20Sopenharmony_ci	const struct ieee80211_channel_sw_ie *ch_switch_ie;
15338c2ecf20Sopenharmony_ci	const struct ieee80211_ext_chansw_ie *ext_chansw_ie;
15348c2ecf20Sopenharmony_ci	const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
15358c2ecf20Sopenharmony_ci	const u8 *max_channel_switch_time;
15368c2ecf20Sopenharmony_ci	const u8 *country_elem;
15378c2ecf20Sopenharmony_ci	const u8 *pwr_constr_elem;
15388c2ecf20Sopenharmony_ci	const u8 *cisco_dtpc_elem;
15398c2ecf20Sopenharmony_ci	const struct ieee80211_timeout_interval_ie *timeout_int;
15408c2ecf20Sopenharmony_ci	const u8 *opmode_notif;
15418c2ecf20Sopenharmony_ci	const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
15428c2ecf20Sopenharmony_ci	struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie;
15438c2ecf20Sopenharmony_ci	const struct ieee80211_bss_max_idle_period_ie *max_idle_period_ie;
15448c2ecf20Sopenharmony_ci	const struct ieee80211_multiple_bssid_configuration *mbssid_config_ie;
15458c2ecf20Sopenharmony_ci	const struct ieee80211_bssid_index *bssid_index;
15468c2ecf20Sopenharmony_ci	u8 max_bssid_indicator;
15478c2ecf20Sopenharmony_ci	u8 dtim_count;
15488c2ecf20Sopenharmony_ci	u8 dtim_period;
15498c2ecf20Sopenharmony_ci	const struct ieee80211_addba_ext_ie *addba_ext_ie;
15508c2ecf20Sopenharmony_ci	const struct ieee80211_s1g_cap *s1g_capab;
15518c2ecf20Sopenharmony_ci	const struct ieee80211_s1g_oper_ie *s1g_oper;
15528c2ecf20Sopenharmony_ci	const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat;
15538c2ecf20Sopenharmony_ci	const struct ieee80211_aid_response_ie *aid_resp;
15548c2ecf20Sopenharmony_ci
15558c2ecf20Sopenharmony_ci	/* length of them, respectively */
15568c2ecf20Sopenharmony_ci	u8 ext_capab_len;
15578c2ecf20Sopenharmony_ci	u8 ssid_len;
15588c2ecf20Sopenharmony_ci	u8 supp_rates_len;
15598c2ecf20Sopenharmony_ci	u8 tim_len;
15608c2ecf20Sopenharmony_ci	u8 rsn_len;
15618c2ecf20Sopenharmony_ci	u8 rsnx_len;
15628c2ecf20Sopenharmony_ci	u8 ext_supp_rates_len;
15638c2ecf20Sopenharmony_ci	u8 wmm_info_len;
15648c2ecf20Sopenharmony_ci	u8 wmm_param_len;
15658c2ecf20Sopenharmony_ci	u8 he_cap_len;
15668c2ecf20Sopenharmony_ci	u8 mesh_id_len;
15678c2ecf20Sopenharmony_ci	u8 peering_len;
15688c2ecf20Sopenharmony_ci	u8 preq_len;
15698c2ecf20Sopenharmony_ci	u8 prep_len;
15708c2ecf20Sopenharmony_ci	u8 perr_len;
15718c2ecf20Sopenharmony_ci	u8 country_elem_len;
15728c2ecf20Sopenharmony_ci	u8 bssid_index_len;
15738c2ecf20Sopenharmony_ci
15748c2ecf20Sopenharmony_ci	void *nontx_profile;
15758c2ecf20Sopenharmony_ci
15768c2ecf20Sopenharmony_ci	/* whether a parse error occurred while retrieving these elements */
15778c2ecf20Sopenharmony_ci	bool parse_error;
15788c2ecf20Sopenharmony_ci};
15798c2ecf20Sopenharmony_ci
15808c2ecf20Sopenharmony_cistatic inline struct ieee80211_local *hw_to_local(
15818c2ecf20Sopenharmony_ci	struct ieee80211_hw *hw)
15828c2ecf20Sopenharmony_ci{
15838c2ecf20Sopenharmony_ci	return container_of(hw, struct ieee80211_local, hw);
15848c2ecf20Sopenharmony_ci}
15858c2ecf20Sopenharmony_ci
15868c2ecf20Sopenharmony_cistatic inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
15878c2ecf20Sopenharmony_ci{
15888c2ecf20Sopenharmony_ci	return container_of(txq, struct txq_info, txq);
15898c2ecf20Sopenharmony_ci}
15908c2ecf20Sopenharmony_ci
15918c2ecf20Sopenharmony_cistatic inline bool txq_has_queue(struct ieee80211_txq *txq)
15928c2ecf20Sopenharmony_ci{
15938c2ecf20Sopenharmony_ci	struct txq_info *txqi = to_txq_info(txq);
15948c2ecf20Sopenharmony_ci
15958c2ecf20Sopenharmony_ci	return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets);
15968c2ecf20Sopenharmony_ci}
15978c2ecf20Sopenharmony_ci
15988c2ecf20Sopenharmony_cistatic inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
15998c2ecf20Sopenharmony_ci{
16008c2ecf20Sopenharmony_ci	return ether_addr_equal(raddr, addr) ||
16018c2ecf20Sopenharmony_ci	       is_broadcast_ether_addr(raddr);
16028c2ecf20Sopenharmony_ci}
16038c2ecf20Sopenharmony_ci
16048c2ecf20Sopenharmony_cistatic inline bool
16058c2ecf20Sopenharmony_ciieee80211_have_rx_timestamp(struct ieee80211_rx_status *status)
16068c2ecf20Sopenharmony_ci{
16078c2ecf20Sopenharmony_ci	WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START &&
16088c2ecf20Sopenharmony_ci		     status->flag & RX_FLAG_MACTIME_END);
16098c2ecf20Sopenharmony_ci	if (status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END))
16108c2ecf20Sopenharmony_ci		return true;
16118c2ecf20Sopenharmony_ci	/* can't handle non-legacy preamble yet */
16128c2ecf20Sopenharmony_ci	if (status->flag & RX_FLAG_MACTIME_PLCP_START &&
16138c2ecf20Sopenharmony_ci	    status->encoding == RX_ENC_LEGACY)
16148c2ecf20Sopenharmony_ci		return true;
16158c2ecf20Sopenharmony_ci	return false;
16168c2ecf20Sopenharmony_ci}
16178c2ecf20Sopenharmony_ci
16188c2ecf20Sopenharmony_civoid ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata);
16198c2ecf20Sopenharmony_civoid ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata);
16208c2ecf20Sopenharmony_ci
16218c2ecf20Sopenharmony_ci/* This function returns the number of multicast stations connected to this
16228c2ecf20Sopenharmony_ci * interface. It returns -1 if that number is not tracked, that is for netdevs
16238c2ecf20Sopenharmony_ci * not in AP or AP_VLAN mode or when using 4addr.
16248c2ecf20Sopenharmony_ci */
16258c2ecf20Sopenharmony_cistatic inline int
16268c2ecf20Sopenharmony_ciieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata)
16278c2ecf20Sopenharmony_ci{
16288c2ecf20Sopenharmony_ci	if (sdata->vif.type == NL80211_IFTYPE_AP)
16298c2ecf20Sopenharmony_ci		return atomic_read(&sdata->u.ap.num_mcast_sta);
16308c2ecf20Sopenharmony_ci	if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
16318c2ecf20Sopenharmony_ci		return atomic_read(&sdata->u.vlan.num_mcast_sta);
16328c2ecf20Sopenharmony_ci	return -1;
16338c2ecf20Sopenharmony_ci}
16348c2ecf20Sopenharmony_ci
16358c2ecf20Sopenharmony_ciu64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
16368c2ecf20Sopenharmony_ci				     struct ieee80211_rx_status *status,
16378c2ecf20Sopenharmony_ci				     unsigned int mpdu_len,
16388c2ecf20Sopenharmony_ci				     unsigned int mpdu_offset);
16398c2ecf20Sopenharmony_ciint ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
16408c2ecf20Sopenharmony_civoid ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
16418c2ecf20Sopenharmony_civoid ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
16428c2ecf20Sopenharmony_ci				      u32 changed);
16438c2ecf20Sopenharmony_civoid ieee80211_configure_filter(struct ieee80211_local *local);
16448c2ecf20Sopenharmony_ciu32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
16458c2ecf20Sopenharmony_ci
16468c2ecf20Sopenharmony_ciu64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local);
16478c2ecf20Sopenharmony_ciint ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
16488c2ecf20Sopenharmony_ci			     u64 *cookie, gfp_t gfp);
16498c2ecf20Sopenharmony_ci
16508c2ecf20Sopenharmony_civoid ieee80211_check_fast_rx(struct sta_info *sta);
16518c2ecf20Sopenharmony_civoid __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
16528c2ecf20Sopenharmony_civoid ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
16538c2ecf20Sopenharmony_civoid ieee80211_clear_fast_rx(struct sta_info *sta);
16548c2ecf20Sopenharmony_ci
16558c2ecf20Sopenharmony_ci/* STA code */
16568c2ecf20Sopenharmony_civoid ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
16578c2ecf20Sopenharmony_ciint ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
16588c2ecf20Sopenharmony_ci		       struct cfg80211_auth_request *req);
16598c2ecf20Sopenharmony_ciint ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
16608c2ecf20Sopenharmony_ci			struct cfg80211_assoc_request *req);
16618c2ecf20Sopenharmony_ciint ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
16628c2ecf20Sopenharmony_ci			 struct cfg80211_deauth_request *req);
16638c2ecf20Sopenharmony_ciint ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
16648c2ecf20Sopenharmony_ci			   struct cfg80211_disassoc_request *req);
16658c2ecf20Sopenharmony_civoid ieee80211_send_pspoll(struct ieee80211_local *local,
16668c2ecf20Sopenharmony_ci			   struct ieee80211_sub_if_data *sdata);
16678c2ecf20Sopenharmony_civoid ieee80211_recalc_ps(struct ieee80211_local *local);
16688c2ecf20Sopenharmony_civoid ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
16698c2ecf20Sopenharmony_ciint ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
16708c2ecf20Sopenharmony_civoid ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
16718c2ecf20Sopenharmony_civoid ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
16728c2ecf20Sopenharmony_ci				  struct sk_buff *skb);
16738c2ecf20Sopenharmony_civoid ieee80211_sta_rx_queued_ext(struct ieee80211_sub_if_data *sdata,
16748c2ecf20Sopenharmony_ci				 struct sk_buff *skb);
16758c2ecf20Sopenharmony_civoid ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
16768c2ecf20Sopenharmony_civoid ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
16778c2ecf20Sopenharmony_civoid ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata);
16788c2ecf20Sopenharmony_civoid ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata,
16798c2ecf20Sopenharmony_ci				  __le16 fc, bool acked);
16808c2ecf20Sopenharmony_civoid ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata);
16818c2ecf20Sopenharmony_civoid ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
16828c2ecf20Sopenharmony_civoid ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data *sdata);
16838c2ecf20Sopenharmony_ci
16848c2ecf20Sopenharmony_ci/* IBSS code */
16858c2ecf20Sopenharmony_civoid ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
16868c2ecf20Sopenharmony_civoid ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
16878c2ecf20Sopenharmony_civoid ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
16888c2ecf20Sopenharmony_ci			      const u8 *bssid, const u8 *addr, u32 supp_rates);
16898c2ecf20Sopenharmony_ciint ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
16908c2ecf20Sopenharmony_ci			struct cfg80211_ibss_params *params);
16918c2ecf20Sopenharmony_ciint ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
16928c2ecf20Sopenharmony_civoid ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
16938c2ecf20Sopenharmony_civoid ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
16948c2ecf20Sopenharmony_ci				   struct sk_buff *skb);
16958c2ecf20Sopenharmony_ciint ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
16968c2ecf20Sopenharmony_ci			      struct cfg80211_csa_settings *csa_settings);
16978c2ecf20Sopenharmony_ciint ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata);
16988c2ecf20Sopenharmony_civoid ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata);
16998c2ecf20Sopenharmony_ci
17008c2ecf20Sopenharmony_ci/* OCB code */
17018c2ecf20Sopenharmony_civoid ieee80211_ocb_work(struct ieee80211_sub_if_data *sdata);
17028c2ecf20Sopenharmony_civoid ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata,
17038c2ecf20Sopenharmony_ci			     const u8 *bssid, const u8 *addr, u32 supp_rates);
17048c2ecf20Sopenharmony_civoid ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data *sdata);
17058c2ecf20Sopenharmony_ciint ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
17068c2ecf20Sopenharmony_ci		       struct ocb_setup *setup);
17078c2ecf20Sopenharmony_ciint ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata);
17088c2ecf20Sopenharmony_ci
17098c2ecf20Sopenharmony_ci/* mesh code */
17108c2ecf20Sopenharmony_civoid ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
17118c2ecf20Sopenharmony_civoid ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
17128c2ecf20Sopenharmony_ci				   struct sk_buff *skb);
17138c2ecf20Sopenharmony_ciint ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
17148c2ecf20Sopenharmony_ci			      struct cfg80211_csa_settings *csa_settings);
17158c2ecf20Sopenharmony_ciint ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata);
17168c2ecf20Sopenharmony_ci
17178c2ecf20Sopenharmony_ci/* scan/BSS handling */
17188c2ecf20Sopenharmony_civoid ieee80211_scan_work(struct work_struct *work);
17198c2ecf20Sopenharmony_ciint ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
17208c2ecf20Sopenharmony_ci				const u8 *ssid, u8 ssid_len,
17218c2ecf20Sopenharmony_ci				struct ieee80211_channel **channels,
17228c2ecf20Sopenharmony_ci				unsigned int n_channels,
17238c2ecf20Sopenharmony_ci				enum nl80211_bss_scan_width scan_width);
17248c2ecf20Sopenharmony_ciint ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
17258c2ecf20Sopenharmony_ci			   struct cfg80211_scan_request *req);
17268c2ecf20Sopenharmony_civoid ieee80211_scan_cancel(struct ieee80211_local *local);
17278c2ecf20Sopenharmony_civoid ieee80211_run_deferred_scan(struct ieee80211_local *local);
17288c2ecf20Sopenharmony_civoid ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb);
17298c2ecf20Sopenharmony_ci
17308c2ecf20Sopenharmony_civoid ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
17318c2ecf20Sopenharmony_cistruct ieee80211_bss *
17328c2ecf20Sopenharmony_ciieee80211_bss_info_update(struct ieee80211_local *local,
17338c2ecf20Sopenharmony_ci			  struct ieee80211_rx_status *rx_status,
17348c2ecf20Sopenharmony_ci			  struct ieee80211_mgmt *mgmt,
17358c2ecf20Sopenharmony_ci			  size_t len,
17368c2ecf20Sopenharmony_ci			  struct ieee80211_channel *channel);
17378c2ecf20Sopenharmony_civoid ieee80211_rx_bss_put(struct ieee80211_local *local,
17388c2ecf20Sopenharmony_ci			  struct ieee80211_bss *bss);
17398c2ecf20Sopenharmony_ci
17408c2ecf20Sopenharmony_ci/* scheduled scan handling */
17418c2ecf20Sopenharmony_ciint
17428c2ecf20Sopenharmony_ci__ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
17438c2ecf20Sopenharmony_ci				     struct cfg80211_sched_scan_request *req);
17448c2ecf20Sopenharmony_ciint ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
17458c2ecf20Sopenharmony_ci				       struct cfg80211_sched_scan_request *req);
17468c2ecf20Sopenharmony_ciint ieee80211_request_sched_scan_stop(struct ieee80211_local *local);
17478c2ecf20Sopenharmony_civoid ieee80211_sched_scan_end(struct ieee80211_local *local);
17488c2ecf20Sopenharmony_civoid ieee80211_sched_scan_stopped_work(struct work_struct *work);
17498c2ecf20Sopenharmony_ci
17508c2ecf20Sopenharmony_ci/* off-channel/mgmt-tx */
17518c2ecf20Sopenharmony_civoid ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
17528c2ecf20Sopenharmony_civoid ieee80211_offchannel_return(struct ieee80211_local *local);
17538c2ecf20Sopenharmony_civoid ieee80211_roc_setup(struct ieee80211_local *local);
17548c2ecf20Sopenharmony_civoid ieee80211_start_next_roc(struct ieee80211_local *local);
17558c2ecf20Sopenharmony_civoid ieee80211_roc_purge(struct ieee80211_local *local,
17568c2ecf20Sopenharmony_ci			 struct ieee80211_sub_if_data *sdata);
17578c2ecf20Sopenharmony_ciint ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
17588c2ecf20Sopenharmony_ci				struct ieee80211_channel *chan,
17598c2ecf20Sopenharmony_ci				unsigned int duration, u64 *cookie);
17608c2ecf20Sopenharmony_ciint ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
17618c2ecf20Sopenharmony_ci				       struct wireless_dev *wdev, u64 cookie);
17628c2ecf20Sopenharmony_ciint ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
17638c2ecf20Sopenharmony_ci		      struct cfg80211_mgmt_tx_params *params, u64 *cookie);
17648c2ecf20Sopenharmony_ciint ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
17658c2ecf20Sopenharmony_ci				  struct wireless_dev *wdev, u64 cookie);
17668c2ecf20Sopenharmony_ci
17678c2ecf20Sopenharmony_ci/* channel switch handling */
17688c2ecf20Sopenharmony_civoid ieee80211_csa_finalize_work(struct work_struct *work);
17698c2ecf20Sopenharmony_ciint ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
17708c2ecf20Sopenharmony_ci			     struct cfg80211_csa_settings *params);
17718c2ecf20Sopenharmony_ci
17728c2ecf20Sopenharmony_ci/* interface handling */
17738c2ecf20Sopenharmony_ci#define MAC80211_SUPPORTED_FEATURES_TX	(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
17748c2ecf20Sopenharmony_ci					 NETIF_F_HW_CSUM | NETIF_F_SG | \
17758c2ecf20Sopenharmony_ci					 NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE)
17768c2ecf20Sopenharmony_ci#define MAC80211_SUPPORTED_FEATURES_RX	(NETIF_F_RXCSUM)
17778c2ecf20Sopenharmony_ci#define MAC80211_SUPPORTED_FEATURES	(MAC80211_SUPPORTED_FEATURES_TX | \
17788c2ecf20Sopenharmony_ci					 MAC80211_SUPPORTED_FEATURES_RX)
17798c2ecf20Sopenharmony_ci
17808c2ecf20Sopenharmony_ciint ieee80211_iface_init(void);
17818c2ecf20Sopenharmony_civoid ieee80211_iface_exit(void);
17828c2ecf20Sopenharmony_ciint ieee80211_if_add(struct ieee80211_local *local, const char *name,
17838c2ecf20Sopenharmony_ci		     unsigned char name_assign_type,
17848c2ecf20Sopenharmony_ci		     struct wireless_dev **new_wdev, enum nl80211_iftype type,
17858c2ecf20Sopenharmony_ci		     struct vif_params *params);
17868c2ecf20Sopenharmony_ciint ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
17878c2ecf20Sopenharmony_ci			     enum nl80211_iftype type);
17888c2ecf20Sopenharmony_civoid ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
17898c2ecf20Sopenharmony_civoid ieee80211_remove_interfaces(struct ieee80211_local *local);
17908c2ecf20Sopenharmony_ciu32 ieee80211_idle_off(struct ieee80211_local *local);
17918c2ecf20Sopenharmony_civoid ieee80211_recalc_idle(struct ieee80211_local *local);
17928c2ecf20Sopenharmony_civoid ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
17938c2ecf20Sopenharmony_ci				    const int offset);
17948c2ecf20Sopenharmony_ciint ieee80211_do_open(struct wireless_dev *wdev, bool coming_up);
17958c2ecf20Sopenharmony_civoid ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata);
17968c2ecf20Sopenharmony_ciint ieee80211_add_virtual_monitor(struct ieee80211_local *local);
17978c2ecf20Sopenharmony_civoid ieee80211_del_virtual_monitor(struct ieee80211_local *local);
17988c2ecf20Sopenharmony_ci
17998c2ecf20Sopenharmony_cibool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
18008c2ecf20Sopenharmony_civoid ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata,
18018c2ecf20Sopenharmony_ci			      bool update_bss);
18028c2ecf20Sopenharmony_civoid ieee80211_recalc_offload(struct ieee80211_local *local);
18038c2ecf20Sopenharmony_ci
18048c2ecf20Sopenharmony_cistatic inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
18058c2ecf20Sopenharmony_ci{
18068c2ecf20Sopenharmony_ci	return test_bit(SDATA_STATE_RUNNING, &sdata->state);
18078c2ecf20Sopenharmony_ci}
18088c2ecf20Sopenharmony_ci
18098c2ecf20Sopenharmony_ci/* tx handling */
18108c2ecf20Sopenharmony_civoid ieee80211_clear_tx_pending(struct ieee80211_local *local);
18118c2ecf20Sopenharmony_civoid ieee80211_tx_pending(unsigned long data);
18128c2ecf20Sopenharmony_cinetdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
18138c2ecf20Sopenharmony_ci					 struct net_device *dev);
18148c2ecf20Sopenharmony_cinetdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
18158c2ecf20Sopenharmony_ci				       struct net_device *dev);
18168c2ecf20Sopenharmony_cinetdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
18178c2ecf20Sopenharmony_ci					    struct net_device *dev);
18188c2ecf20Sopenharmony_civoid __ieee80211_subif_start_xmit(struct sk_buff *skb,
18198c2ecf20Sopenharmony_ci				  struct net_device *dev,
18208c2ecf20Sopenharmony_ci				  u32 info_flags,
18218c2ecf20Sopenharmony_ci				  u32 ctrl_flags,
18228c2ecf20Sopenharmony_ci				  u64 *cookie);
18238c2ecf20Sopenharmony_civoid ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
18248c2ecf20Sopenharmony_ci			      struct sk_buff_head *skbs);
18258c2ecf20Sopenharmony_cistruct sk_buff *
18268c2ecf20Sopenharmony_ciieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
18278c2ecf20Sopenharmony_ci			      struct sk_buff *skb, u32 info_flags);
18288c2ecf20Sopenharmony_civoid ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
18298c2ecf20Sopenharmony_ci			  struct ieee80211_supported_band *sband,
18308c2ecf20Sopenharmony_ci			  int retry_count, int shift, bool send_to_cooked,
18318c2ecf20Sopenharmony_ci			  struct ieee80211_tx_status *status);
18328c2ecf20Sopenharmony_ci
18338c2ecf20Sopenharmony_civoid ieee80211_check_fast_xmit(struct sta_info *sta);
18348c2ecf20Sopenharmony_civoid ieee80211_check_fast_xmit_all(struct ieee80211_local *local);
18358c2ecf20Sopenharmony_civoid ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata);
18368c2ecf20Sopenharmony_civoid ieee80211_clear_fast_xmit(struct sta_info *sta);
18378c2ecf20Sopenharmony_ciint ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
18388c2ecf20Sopenharmony_ci			      const u8 *buf, size_t len,
18398c2ecf20Sopenharmony_ci			      const u8 *dest, __be16 proto, bool unencrypted,
18408c2ecf20Sopenharmony_ci			      u64 *cookie);
18418c2ecf20Sopenharmony_ciint ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
18428c2ecf20Sopenharmony_ci			      const u8 *buf, size_t len);
18438c2ecf20Sopenharmony_ci
18448c2ecf20Sopenharmony_ci/* HT */
18458c2ecf20Sopenharmony_civoid ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
18468c2ecf20Sopenharmony_ci				     struct ieee80211_sta_ht_cap *ht_cap);
18478c2ecf20Sopenharmony_cibool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
18488c2ecf20Sopenharmony_ci				       struct ieee80211_supported_band *sband,
18498c2ecf20Sopenharmony_ci				       const struct ieee80211_ht_cap *ht_cap_ie,
18508c2ecf20Sopenharmony_ci				       struct sta_info *sta);
18518c2ecf20Sopenharmony_civoid ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
18528c2ecf20Sopenharmony_ci			  const u8 *da, u16 tid,
18538c2ecf20Sopenharmony_ci			  u16 initiator, u16 reason_code);
18548c2ecf20Sopenharmony_ciint ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
18558c2ecf20Sopenharmony_ci			       enum ieee80211_smps_mode smps, const u8 *da,
18568c2ecf20Sopenharmony_ci			       const u8 *bssid);
18578c2ecf20Sopenharmony_civoid ieee80211_request_smps_ap_work(struct work_struct *work);
18588c2ecf20Sopenharmony_civoid ieee80211_request_smps_mgd_work(struct work_struct *work);
18598c2ecf20Sopenharmony_cibool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old,
18608c2ecf20Sopenharmony_ci				   enum ieee80211_smps_mode smps_mode_new);
18618c2ecf20Sopenharmony_ci
18628c2ecf20Sopenharmony_civoid ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
18638c2ecf20Sopenharmony_ci				     u16 initiator, u16 reason, bool stop);
18648c2ecf20Sopenharmony_civoid __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
18658c2ecf20Sopenharmony_ci				    u16 initiator, u16 reason, bool stop);
18668c2ecf20Sopenharmony_civoid ___ieee80211_start_rx_ba_session(struct sta_info *sta,
18678c2ecf20Sopenharmony_ci				      u8 dialog_token, u16 timeout,
18688c2ecf20Sopenharmony_ci				      u16 start_seq_num, u16 ba_policy, u16 tid,
18698c2ecf20Sopenharmony_ci				      u16 buf_size, bool tx, bool auto_seq,
18708c2ecf20Sopenharmony_ci				      const struct ieee80211_addba_ext_ie *addbaext);
18718c2ecf20Sopenharmony_civoid ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
18728c2ecf20Sopenharmony_ci					 enum ieee80211_agg_stop_reason reason);
18738c2ecf20Sopenharmony_civoid ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
18748c2ecf20Sopenharmony_ci			     struct sta_info *sta,
18758c2ecf20Sopenharmony_ci			     struct ieee80211_mgmt *mgmt, size_t len);
18768c2ecf20Sopenharmony_civoid ieee80211_process_addba_resp(struct ieee80211_local *local,
18778c2ecf20Sopenharmony_ci				  struct sta_info *sta,
18788c2ecf20Sopenharmony_ci				  struct ieee80211_mgmt *mgmt,
18798c2ecf20Sopenharmony_ci				  size_t len);
18808c2ecf20Sopenharmony_civoid ieee80211_process_addba_request(struct ieee80211_local *local,
18818c2ecf20Sopenharmony_ci				     struct sta_info *sta,
18828c2ecf20Sopenharmony_ci				     struct ieee80211_mgmt *mgmt,
18838c2ecf20Sopenharmony_ci				     size_t len);
18848c2ecf20Sopenharmony_ci
18858c2ecf20Sopenharmony_ciint __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
18868c2ecf20Sopenharmony_ci				   enum ieee80211_agg_stop_reason reason);
18878c2ecf20Sopenharmony_ciint ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
18888c2ecf20Sopenharmony_ci				    enum ieee80211_agg_stop_reason reason);
18898c2ecf20Sopenharmony_civoid ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid,
18908c2ecf20Sopenharmony_ci			      struct tid_ampdu_tx *tid_tx);
18918c2ecf20Sopenharmony_civoid ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid,
18928c2ecf20Sopenharmony_ci			     struct tid_ampdu_tx *tid_tx);
18938c2ecf20Sopenharmony_civoid ieee80211_ba_session_work(struct work_struct *work);
18948c2ecf20Sopenharmony_civoid ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
18958c2ecf20Sopenharmony_civoid ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
18968c2ecf20Sopenharmony_ci
18978c2ecf20Sopenharmony_ciu8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs);
18988c2ecf20Sopenharmony_cienum nl80211_smps_mode
18998c2ecf20Sopenharmony_ciieee80211_smps_mode_to_smps_mode(enum ieee80211_smps_mode smps);
19008c2ecf20Sopenharmony_ci
19018c2ecf20Sopenharmony_ci/* VHT */
19028c2ecf20Sopenharmony_civoid
19038c2ecf20Sopenharmony_ciieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
19048c2ecf20Sopenharmony_ci				    struct ieee80211_supported_band *sband,
19058c2ecf20Sopenharmony_ci				    const struct ieee80211_vht_cap *vht_cap_ie,
19068c2ecf20Sopenharmony_ci				    struct sta_info *sta);
19078c2ecf20Sopenharmony_cienum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta);
19088c2ecf20Sopenharmony_cienum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta);
19098c2ecf20Sopenharmony_civoid ieee80211_sta_set_rx_nss(struct sta_info *sta);
19108c2ecf20Sopenharmony_cienum ieee80211_sta_rx_bandwidth
19118c2ecf20Sopenharmony_ciieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width);
19128c2ecf20Sopenharmony_cienum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta);
19138c2ecf20Sopenharmony_civoid ieee80211_sta_set_rx_nss(struct sta_info *sta);
19148c2ecf20Sopenharmony_civoid ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
19158c2ecf20Sopenharmony_ci				 struct ieee80211_mgmt *mgmt);
19168c2ecf20Sopenharmony_ciu32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
19178c2ecf20Sopenharmony_ci                                  struct sta_info *sta, u8 opmode,
19188c2ecf20Sopenharmony_ci				  enum nl80211_band band);
19198c2ecf20Sopenharmony_civoid ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
19208c2ecf20Sopenharmony_ci				 struct sta_info *sta, u8 opmode,
19218c2ecf20Sopenharmony_ci				 enum nl80211_band band);
19228c2ecf20Sopenharmony_civoid ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
19238c2ecf20Sopenharmony_ci				      struct ieee80211_sta_vht_cap *vht_cap);
19248c2ecf20Sopenharmony_civoid ieee80211_get_vht_mask_from_cap(__le16 vht_cap,
19258c2ecf20Sopenharmony_ci				     u16 vht_mask[NL80211_VHT_NSS_MAX]);
19268c2ecf20Sopenharmony_cienum nl80211_chan_width
19278c2ecf20Sopenharmony_ciieee80211_sta_rx_bw_to_chan_width(struct sta_info *sta);
19288c2ecf20Sopenharmony_ci
19298c2ecf20Sopenharmony_ci/* HE */
19308c2ecf20Sopenharmony_civoid
19318c2ecf20Sopenharmony_ciieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
19328c2ecf20Sopenharmony_ci				  struct ieee80211_supported_band *sband,
19338c2ecf20Sopenharmony_ci				  const u8 *he_cap_ie, u8 he_cap_len,
19348c2ecf20Sopenharmony_ci				  const struct ieee80211_he_6ghz_capa *he_6ghz_capa,
19358c2ecf20Sopenharmony_ci				  struct sta_info *sta);
19368c2ecf20Sopenharmony_civoid
19378c2ecf20Sopenharmony_ciieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif,
19388c2ecf20Sopenharmony_ci				const struct ieee80211_he_spr *he_spr_ie_elem);
19398c2ecf20Sopenharmony_ci
19408c2ecf20Sopenharmony_civoid
19418c2ecf20Sopenharmony_ciieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif,
19428c2ecf20Sopenharmony_ci			const struct ieee80211_he_operation *he_op_ie_elem);
19438c2ecf20Sopenharmony_ci
19448c2ecf20Sopenharmony_ci/* S1G */
19458c2ecf20Sopenharmony_civoid ieee80211_s1g_sta_rate_init(struct sta_info *sta);
19468c2ecf20Sopenharmony_ci
19478c2ecf20Sopenharmony_ci/* Spectrum management */
19488c2ecf20Sopenharmony_civoid ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
19498c2ecf20Sopenharmony_ci				       struct ieee80211_mgmt *mgmt,
19508c2ecf20Sopenharmony_ci				       size_t len);
19518c2ecf20Sopenharmony_ci/**
19528c2ecf20Sopenharmony_ci * ieee80211_parse_ch_switch_ie - parses channel switch IEs
19538c2ecf20Sopenharmony_ci * @sdata: the sdata of the interface which has received the frame
19548c2ecf20Sopenharmony_ci * @elems: parsed 802.11 elements received with the frame
19558c2ecf20Sopenharmony_ci * @current_band: indicates the current band
19568c2ecf20Sopenharmony_ci * @vht_cap_info: VHT capabilities of the transmitter
19578c2ecf20Sopenharmony_ci * @sta_flags: contains information about own capabilities and restrictions
19588c2ecf20Sopenharmony_ci *	to decide which channel switch announcements can be accepted. Only the
19598c2ecf20Sopenharmony_ci *	following subset of &enum ieee80211_sta_flags are evaluated:
19608c2ecf20Sopenharmony_ci *	%IEEE80211_STA_DISABLE_HT, %IEEE80211_STA_DISABLE_VHT,
19618c2ecf20Sopenharmony_ci *	%IEEE80211_STA_DISABLE_40MHZ, %IEEE80211_STA_DISABLE_80P80MHZ,
19628c2ecf20Sopenharmony_ci *	%IEEE80211_STA_DISABLE_160MHZ.
19638c2ecf20Sopenharmony_ci * @bssid: the currently connected bssid (for reporting)
19648c2ecf20Sopenharmony_ci * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl.
19658c2ecf20Sopenharmony_ci	All of them will be filled with if success only.
19668c2ecf20Sopenharmony_ci * Return: 0 on success, <0 on error and >0 if there is nothing to parse.
19678c2ecf20Sopenharmony_ci */
19688c2ecf20Sopenharmony_ciint ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
19698c2ecf20Sopenharmony_ci				 struct ieee802_11_elems *elems,
19708c2ecf20Sopenharmony_ci				 enum nl80211_band current_band,
19718c2ecf20Sopenharmony_ci				 u32 vht_cap_info,
19728c2ecf20Sopenharmony_ci				 u32 sta_flags, u8 *bssid,
19738c2ecf20Sopenharmony_ci				 struct ieee80211_csa_ie *csa_ie);
19748c2ecf20Sopenharmony_ci
19758c2ecf20Sopenharmony_ci/* Suspend/resume and hw reconfiguration */
19768c2ecf20Sopenharmony_ciint ieee80211_reconfig(struct ieee80211_local *local);
19778c2ecf20Sopenharmony_civoid ieee80211_stop_device(struct ieee80211_local *local);
19788c2ecf20Sopenharmony_ci
19798c2ecf20Sopenharmony_ciint __ieee80211_suspend(struct ieee80211_hw *hw,
19808c2ecf20Sopenharmony_ci			struct cfg80211_wowlan *wowlan);
19818c2ecf20Sopenharmony_ci
19828c2ecf20Sopenharmony_cistatic inline int __ieee80211_resume(struct ieee80211_hw *hw)
19838c2ecf20Sopenharmony_ci{
19848c2ecf20Sopenharmony_ci	struct ieee80211_local *local = hw_to_local(hw);
19858c2ecf20Sopenharmony_ci
19868c2ecf20Sopenharmony_ci	WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) &&
19878c2ecf20Sopenharmony_ci	     !test_bit(SCAN_COMPLETED, &local->scanning),
19888c2ecf20Sopenharmony_ci		"%s: resume with hardware scan still in progress\n",
19898c2ecf20Sopenharmony_ci		wiphy_name(hw->wiphy));
19908c2ecf20Sopenharmony_ci
19918c2ecf20Sopenharmony_ci	return ieee80211_reconfig(hw_to_local(hw));
19928c2ecf20Sopenharmony_ci}
19938c2ecf20Sopenharmony_ci
19948c2ecf20Sopenharmony_ci/* utility functions/constants */
19958c2ecf20Sopenharmony_ciextern const void *const mac80211_wiphy_privid; /* for wiphy privid */
19968c2ecf20Sopenharmony_ciint ieee80211_frame_duration(enum nl80211_band band, size_t len,
19978c2ecf20Sopenharmony_ci			     int rate, int erp, int short_preamble,
19988c2ecf20Sopenharmony_ci			     int shift);
19998c2ecf20Sopenharmony_civoid ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,
20008c2ecf20Sopenharmony_ci					   struct ieee80211_tx_queue_params *qparam,
20018c2ecf20Sopenharmony_ci					   int ac);
20028c2ecf20Sopenharmony_civoid ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
20038c2ecf20Sopenharmony_ci			       bool bss_notify, bool enable_qos);
20048c2ecf20Sopenharmony_civoid ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
20058c2ecf20Sopenharmony_ci		    struct sta_info *sta, struct sk_buff *skb);
20068c2ecf20Sopenharmony_ci
20078c2ecf20Sopenharmony_civoid __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
20088c2ecf20Sopenharmony_ci				 struct sk_buff *skb, int tid,
20098c2ecf20Sopenharmony_ci				 enum nl80211_band band);
20108c2ecf20Sopenharmony_ci
20118c2ecf20Sopenharmony_ci/* sta_out needs to be checked for ERR_PTR() before using */
20128c2ecf20Sopenharmony_ciint ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
20138c2ecf20Sopenharmony_ci			    struct sk_buff *skb,
20148c2ecf20Sopenharmony_ci			    struct sta_info **sta_out);
20158c2ecf20Sopenharmony_ci
20168c2ecf20Sopenharmony_cistatic inline void
20178c2ecf20Sopenharmony_ciieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
20188c2ecf20Sopenharmony_ci			  struct sk_buff *skb, int tid,
20198c2ecf20Sopenharmony_ci			  enum nl80211_band band)
20208c2ecf20Sopenharmony_ci{
20218c2ecf20Sopenharmony_ci	rcu_read_lock();
20228c2ecf20Sopenharmony_ci	__ieee80211_tx_skb_tid_band(sdata, skb, tid, band);
20238c2ecf20Sopenharmony_ci	rcu_read_unlock();
20248c2ecf20Sopenharmony_ci}
20258c2ecf20Sopenharmony_ci
20268c2ecf20Sopenharmony_cistatic inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
20278c2ecf20Sopenharmony_ci					struct sk_buff *skb, int tid)
20288c2ecf20Sopenharmony_ci{
20298c2ecf20Sopenharmony_ci	struct ieee80211_chanctx_conf *chanctx_conf;
20308c2ecf20Sopenharmony_ci
20318c2ecf20Sopenharmony_ci	rcu_read_lock();
20328c2ecf20Sopenharmony_ci	chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
20338c2ecf20Sopenharmony_ci	if (WARN_ON(!chanctx_conf)) {
20348c2ecf20Sopenharmony_ci		rcu_read_unlock();
20358c2ecf20Sopenharmony_ci		kfree_skb(skb);
20368c2ecf20Sopenharmony_ci		return;
20378c2ecf20Sopenharmony_ci	}
20388c2ecf20Sopenharmony_ci
20398c2ecf20Sopenharmony_ci	__ieee80211_tx_skb_tid_band(sdata, skb, tid,
20408c2ecf20Sopenharmony_ci				    chanctx_conf->def.chan->band);
20418c2ecf20Sopenharmony_ci	rcu_read_unlock();
20428c2ecf20Sopenharmony_ci}
20438c2ecf20Sopenharmony_ci
20448c2ecf20Sopenharmony_cistatic inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
20458c2ecf20Sopenharmony_ci				    struct sk_buff *skb)
20468c2ecf20Sopenharmony_ci{
20478c2ecf20Sopenharmony_ci	/* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
20488c2ecf20Sopenharmony_ci	ieee80211_tx_skb_tid(sdata, skb, 7);
20498c2ecf20Sopenharmony_ci}
20508c2ecf20Sopenharmony_ci
20518c2ecf20Sopenharmony_ciu32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
20528c2ecf20Sopenharmony_ci			       struct ieee802_11_elems *elems,
20538c2ecf20Sopenharmony_ci			       u64 filter, u32 crc, u8 *transmitter_bssid,
20548c2ecf20Sopenharmony_ci			       u8 *bss_bssid);
20558c2ecf20Sopenharmony_cistatic inline void ieee802_11_parse_elems(const u8 *start, size_t len,
20568c2ecf20Sopenharmony_ci					  bool action,
20578c2ecf20Sopenharmony_ci					  struct ieee802_11_elems *elems,
20588c2ecf20Sopenharmony_ci					  u8 *transmitter_bssid,
20598c2ecf20Sopenharmony_ci					  u8 *bss_bssid)
20608c2ecf20Sopenharmony_ci{
20618c2ecf20Sopenharmony_ci	ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0,
20628c2ecf20Sopenharmony_ci				   transmitter_bssid, bss_bssid);
20638c2ecf20Sopenharmony_ci}
20648c2ecf20Sopenharmony_ci
20658c2ecf20Sopenharmony_ci
20668c2ecf20Sopenharmony_ciextern const int ieee802_1d_to_ac[8];
20678c2ecf20Sopenharmony_ci
20688c2ecf20Sopenharmony_cistatic inline int ieee80211_ac_from_tid(int tid)
20698c2ecf20Sopenharmony_ci{
20708c2ecf20Sopenharmony_ci	return ieee802_1d_to_ac[tid & 7];
20718c2ecf20Sopenharmony_ci}
20728c2ecf20Sopenharmony_ci
20738c2ecf20Sopenharmony_civoid ieee80211_dynamic_ps_enable_work(struct work_struct *work);
20748c2ecf20Sopenharmony_civoid ieee80211_dynamic_ps_disable_work(struct work_struct *work);
20758c2ecf20Sopenharmony_civoid ieee80211_dynamic_ps_timer(struct timer_list *t);
20768c2ecf20Sopenharmony_civoid ieee80211_send_nullfunc(struct ieee80211_local *local,
20778c2ecf20Sopenharmony_ci			     struct ieee80211_sub_if_data *sdata,
20788c2ecf20Sopenharmony_ci			     bool powersave);
20798c2ecf20Sopenharmony_civoid ieee80211_send_4addr_nullfunc(struct ieee80211_local *local,
20808c2ecf20Sopenharmony_ci				   struct ieee80211_sub_if_data *sdata);
20818c2ecf20Sopenharmony_civoid ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
20828c2ecf20Sopenharmony_ci			     struct ieee80211_hdr *hdr, bool ack, u16 tx_time);
20838c2ecf20Sopenharmony_ci
20848c2ecf20Sopenharmony_civoid ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
20858c2ecf20Sopenharmony_ci				     unsigned long queues,
20868c2ecf20Sopenharmony_ci				     enum queue_stop_reason reason,
20878c2ecf20Sopenharmony_ci				     bool refcounted);
20888c2ecf20Sopenharmony_civoid ieee80211_stop_vif_queues(struct ieee80211_local *local,
20898c2ecf20Sopenharmony_ci			       struct ieee80211_sub_if_data *sdata,
20908c2ecf20Sopenharmony_ci			       enum queue_stop_reason reason);
20918c2ecf20Sopenharmony_civoid ieee80211_wake_vif_queues(struct ieee80211_local *local,
20928c2ecf20Sopenharmony_ci			       struct ieee80211_sub_if_data *sdata,
20938c2ecf20Sopenharmony_ci			       enum queue_stop_reason reason);
20948c2ecf20Sopenharmony_civoid ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
20958c2ecf20Sopenharmony_ci				     unsigned long queues,
20968c2ecf20Sopenharmony_ci				     enum queue_stop_reason reason,
20978c2ecf20Sopenharmony_ci				     bool refcounted);
20988c2ecf20Sopenharmony_civoid ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
20998c2ecf20Sopenharmony_ci				    enum queue_stop_reason reason,
21008c2ecf20Sopenharmony_ci				    bool refcounted);
21018c2ecf20Sopenharmony_civoid ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
21028c2ecf20Sopenharmony_ci				    enum queue_stop_reason reason,
21038c2ecf20Sopenharmony_ci				    bool refcounted);
21048c2ecf20Sopenharmony_civoid ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue);
21058c2ecf20Sopenharmony_civoid ieee80211_add_pending_skb(struct ieee80211_local *local,
21068c2ecf20Sopenharmony_ci			       struct sk_buff *skb);
21078c2ecf20Sopenharmony_civoid ieee80211_add_pending_skbs(struct ieee80211_local *local,
21088c2ecf20Sopenharmony_ci				struct sk_buff_head *skbs);
21098c2ecf20Sopenharmony_civoid ieee80211_flush_queues(struct ieee80211_local *local,
21108c2ecf20Sopenharmony_ci			    struct ieee80211_sub_if_data *sdata, bool drop);
21118c2ecf20Sopenharmony_civoid __ieee80211_flush_queues(struct ieee80211_local *local,
21128c2ecf20Sopenharmony_ci			      struct ieee80211_sub_if_data *sdata,
21138c2ecf20Sopenharmony_ci			      unsigned int queues, bool drop);
21148c2ecf20Sopenharmony_ci
21158c2ecf20Sopenharmony_cistatic inline bool ieee80211_can_run_worker(struct ieee80211_local *local)
21168c2ecf20Sopenharmony_ci{
21178c2ecf20Sopenharmony_ci	/*
21188c2ecf20Sopenharmony_ci	 * It's unsafe to try to do any work during reconfigure flow.
21198c2ecf20Sopenharmony_ci	 * When the flow ends the work will be requeued.
21208c2ecf20Sopenharmony_ci	 */
21218c2ecf20Sopenharmony_ci	if (local->in_reconfig)
21228c2ecf20Sopenharmony_ci		return false;
21238c2ecf20Sopenharmony_ci
21248c2ecf20Sopenharmony_ci	/*
21258c2ecf20Sopenharmony_ci	 * If quiescing is set, we are racing with __ieee80211_suspend.
21268c2ecf20Sopenharmony_ci	 * __ieee80211_suspend flushes the workers after setting quiescing,
21278c2ecf20Sopenharmony_ci	 * and we check quiescing / suspended before enqueing new workers.
21288c2ecf20Sopenharmony_ci	 * We should abort the worker to avoid the races below.
21298c2ecf20Sopenharmony_ci	 */
21308c2ecf20Sopenharmony_ci	if (local->quiescing)
21318c2ecf20Sopenharmony_ci		return false;
21328c2ecf20Sopenharmony_ci
21338c2ecf20Sopenharmony_ci	/*
21348c2ecf20Sopenharmony_ci	 * We might already be suspended if the following scenario occurs:
21358c2ecf20Sopenharmony_ci	 * __ieee80211_suspend		Control path
21368c2ecf20Sopenharmony_ci	 *
21378c2ecf20Sopenharmony_ci	 *				if (local->quiescing)
21388c2ecf20Sopenharmony_ci	 *					return;
21398c2ecf20Sopenharmony_ci	 * local->quiescing = true;
21408c2ecf20Sopenharmony_ci	 * flush_workqueue();
21418c2ecf20Sopenharmony_ci	 *				queue_work(...);
21428c2ecf20Sopenharmony_ci	 * local->suspended = true;
21438c2ecf20Sopenharmony_ci	 * local->quiescing = false;
21448c2ecf20Sopenharmony_ci	 *				worker starts running...
21458c2ecf20Sopenharmony_ci	 */
21468c2ecf20Sopenharmony_ci	if (local->suspended)
21478c2ecf20Sopenharmony_ci		return false;
21488c2ecf20Sopenharmony_ci
21498c2ecf20Sopenharmony_ci	return true;
21508c2ecf20Sopenharmony_ci}
21518c2ecf20Sopenharmony_ci
21528c2ecf20Sopenharmony_ciint ieee80211_txq_setup_flows(struct ieee80211_local *local);
21538c2ecf20Sopenharmony_civoid ieee80211_txq_set_params(struct ieee80211_local *local);
21548c2ecf20Sopenharmony_civoid ieee80211_txq_teardown_flows(struct ieee80211_local *local);
21558c2ecf20Sopenharmony_civoid ieee80211_txq_init(struct ieee80211_sub_if_data *sdata,
21568c2ecf20Sopenharmony_ci			struct sta_info *sta,
21578c2ecf20Sopenharmony_ci			struct txq_info *txq, int tid);
21588c2ecf20Sopenharmony_civoid ieee80211_txq_purge(struct ieee80211_local *local,
21598c2ecf20Sopenharmony_ci			 struct txq_info *txqi);
21608c2ecf20Sopenharmony_civoid ieee80211_txq_remove_vlan(struct ieee80211_local *local,
21618c2ecf20Sopenharmony_ci			       struct ieee80211_sub_if_data *sdata);
21628c2ecf20Sopenharmony_civoid ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats,
21638c2ecf20Sopenharmony_ci			      struct txq_info *txqi);
21648c2ecf20Sopenharmony_civoid ieee80211_wake_txqs(unsigned long data);
21658c2ecf20Sopenharmony_civoid ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
21668c2ecf20Sopenharmony_ci			 u16 transaction, u16 auth_alg, u16 status,
21678c2ecf20Sopenharmony_ci			 const u8 *extra, size_t extra_len, const u8 *bssid,
21688c2ecf20Sopenharmony_ci			 const u8 *da, const u8 *key, u8 key_len, u8 key_idx,
21698c2ecf20Sopenharmony_ci			 u32 tx_flags);
21708c2ecf20Sopenharmony_civoid ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
21718c2ecf20Sopenharmony_ci				    const u8 *da, const u8 *bssid,
21728c2ecf20Sopenharmony_ci				    u16 stype, u16 reason,
21738c2ecf20Sopenharmony_ci				    bool send_frame, u8 *frame_buf);
21748c2ecf20Sopenharmony_ci
21758c2ecf20Sopenharmony_cienum {
21768c2ecf20Sopenharmony_ci	IEEE80211_PROBE_FLAG_DIRECTED		= BIT(0),
21778c2ecf20Sopenharmony_ci	IEEE80211_PROBE_FLAG_MIN_CONTENT	= BIT(1),
21788c2ecf20Sopenharmony_ci	IEEE80211_PROBE_FLAG_RANDOM_SN		= BIT(2),
21798c2ecf20Sopenharmony_ci};
21808c2ecf20Sopenharmony_ci
21818c2ecf20Sopenharmony_ciint ieee80211_build_preq_ies(struct ieee80211_sub_if_data *sdata, u8 *buffer,
21828c2ecf20Sopenharmony_ci			     size_t buffer_len,
21838c2ecf20Sopenharmony_ci			     struct ieee80211_scan_ies *ie_desc,
21848c2ecf20Sopenharmony_ci			     const u8 *ie, size_t ie_len,
21858c2ecf20Sopenharmony_ci			     u8 bands_used, u32 *rate_masks,
21868c2ecf20Sopenharmony_ci			     struct cfg80211_chan_def *chandef,
21878c2ecf20Sopenharmony_ci			     u32 flags);
21888c2ecf20Sopenharmony_cistruct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
21898c2ecf20Sopenharmony_ci					  const u8 *src, const u8 *dst,
21908c2ecf20Sopenharmony_ci					  u32 ratemask,
21918c2ecf20Sopenharmony_ci					  struct ieee80211_channel *chan,
21928c2ecf20Sopenharmony_ci					  const u8 *ssid, size_t ssid_len,
21938c2ecf20Sopenharmony_ci					  const u8 *ie, size_t ie_len,
21948c2ecf20Sopenharmony_ci					  u32 flags);
21958c2ecf20Sopenharmony_ciu32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
21968c2ecf20Sopenharmony_ci			    struct ieee802_11_elems *elems,
21978c2ecf20Sopenharmony_ci			    enum nl80211_band band, u32 *basic_rates);
21988c2ecf20Sopenharmony_ciint __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
21998c2ecf20Sopenharmony_ci				 enum ieee80211_smps_mode smps_mode);
22008c2ecf20Sopenharmony_civoid ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata);
22018c2ecf20Sopenharmony_civoid ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata);
22028c2ecf20Sopenharmony_ci
22038c2ecf20Sopenharmony_cisize_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
22048c2ecf20Sopenharmony_ciu8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
22058c2ecf20Sopenharmony_ci			      u16 cap);
22068c2ecf20Sopenharmony_ciu8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
22078c2ecf20Sopenharmony_ci			       const struct cfg80211_chan_def *chandef,
22088c2ecf20Sopenharmony_ci			       u16 prot_mode, bool rifs_mode);
22098c2ecf20Sopenharmony_civoid ieee80211_ie_build_wide_bw_cs(u8 *pos,
22108c2ecf20Sopenharmony_ci				   const struct cfg80211_chan_def *chandef);
22118c2ecf20Sopenharmony_ciu8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
22128c2ecf20Sopenharmony_ci			       u32 cap);
22138c2ecf20Sopenharmony_ciu8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
22148c2ecf20Sopenharmony_ci				const struct cfg80211_chan_def *chandef);
22158c2ecf20Sopenharmony_ciu8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype);
22168c2ecf20Sopenharmony_ciu8 *ieee80211_ie_build_he_cap(u8 *pos,
22178c2ecf20Sopenharmony_ci			      const struct ieee80211_sta_he_cap *he_cap,
22188c2ecf20Sopenharmony_ci			      u8 *end);
22198c2ecf20Sopenharmony_civoid ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
22208c2ecf20Sopenharmony_ci				    struct sk_buff *skb);
22218c2ecf20Sopenharmony_ciu8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef);
22228c2ecf20Sopenharmony_ciint ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
22238c2ecf20Sopenharmony_ci			     const struct ieee80211_supported_band *sband,
22248c2ecf20Sopenharmony_ci			     const u8 *srates, int srates_len, u32 *rates);
22258c2ecf20Sopenharmony_ciint ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
22268c2ecf20Sopenharmony_ci			    struct sk_buff *skb, bool need_basic,
22278c2ecf20Sopenharmony_ci			    enum nl80211_band band);
22288c2ecf20Sopenharmony_ciint ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
22298c2ecf20Sopenharmony_ci				struct sk_buff *skb, bool need_basic,
22308c2ecf20Sopenharmony_ci				enum nl80211_band band);
22318c2ecf20Sopenharmony_ciu8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
22328c2ecf20Sopenharmony_civoid ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata,
22338c2ecf20Sopenharmony_ci				struct ieee80211_sta_s1g_cap *caps,
22348c2ecf20Sopenharmony_ci				struct sk_buff *skb);
22358c2ecf20Sopenharmony_civoid ieee80211_add_aid_request_ie(struct ieee80211_sub_if_data *sdata,
22368c2ecf20Sopenharmony_ci				  struct sk_buff *skb);
22378c2ecf20Sopenharmony_ci
22388c2ecf20Sopenharmony_ci/* channel management */
22398c2ecf20Sopenharmony_cibool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
22408c2ecf20Sopenharmony_ci			       struct cfg80211_chan_def *chandef);
22418c2ecf20Sopenharmony_cibool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info,
22428c2ecf20Sopenharmony_ci				const struct ieee80211_vht_operation *oper,
22438c2ecf20Sopenharmony_ci				const struct ieee80211_ht_operation *htop,
22448c2ecf20Sopenharmony_ci				struct cfg80211_chan_def *chandef);
22458c2ecf20Sopenharmony_cibool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
22468c2ecf20Sopenharmony_ci				    const struct ieee80211_he_operation *he_oper,
22478c2ecf20Sopenharmony_ci				    struct cfg80211_chan_def *chandef);
22488c2ecf20Sopenharmony_cibool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper,
22498c2ecf20Sopenharmony_ci				struct cfg80211_chan_def *chandef);
22508c2ecf20Sopenharmony_ciu32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c);
22518c2ecf20Sopenharmony_ci
22528c2ecf20Sopenharmony_ciint __must_check
22538c2ecf20Sopenharmony_ciieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
22548c2ecf20Sopenharmony_ci			  const struct cfg80211_chan_def *chandef,
22558c2ecf20Sopenharmony_ci			  enum ieee80211_chanctx_mode mode);
22568c2ecf20Sopenharmony_ciint __must_check
22578c2ecf20Sopenharmony_ciieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
22588c2ecf20Sopenharmony_ci			      const struct cfg80211_chan_def *chandef,
22598c2ecf20Sopenharmony_ci			      enum ieee80211_chanctx_mode mode,
22608c2ecf20Sopenharmony_ci			      bool radar_required);
22618c2ecf20Sopenharmony_ciint __must_check
22628c2ecf20Sopenharmony_ciieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata);
22638c2ecf20Sopenharmony_ciint ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata);
22648c2ecf20Sopenharmony_ci
22658c2ecf20Sopenharmony_ciint __must_check
22668c2ecf20Sopenharmony_ciieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
22678c2ecf20Sopenharmony_ci			       const struct cfg80211_chan_def *chandef,
22688c2ecf20Sopenharmony_ci			       u32 *changed);
22698c2ecf20Sopenharmony_civoid ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
22708c2ecf20Sopenharmony_civoid ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata);
22718c2ecf20Sopenharmony_civoid ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,
22728c2ecf20Sopenharmony_ci					 bool clear);
22738c2ecf20Sopenharmony_ciint ieee80211_chanctx_refcount(struct ieee80211_local *local,
22748c2ecf20Sopenharmony_ci			       struct ieee80211_chanctx *ctx);
22758c2ecf20Sopenharmony_ci
22768c2ecf20Sopenharmony_civoid ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
22778c2ecf20Sopenharmony_ci				   struct ieee80211_chanctx *chanctx);
22788c2ecf20Sopenharmony_civoid ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
22798c2ecf20Sopenharmony_ci				      struct ieee80211_chanctx *ctx);
22808c2ecf20Sopenharmony_cibool ieee80211_is_radar_required(struct ieee80211_local *local);
22818c2ecf20Sopenharmony_ci
22828c2ecf20Sopenharmony_civoid ieee80211_dfs_cac_timer(unsigned long data);
22838c2ecf20Sopenharmony_civoid ieee80211_dfs_cac_timer_work(struct work_struct *work);
22848c2ecf20Sopenharmony_civoid ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
22858c2ecf20Sopenharmony_civoid ieee80211_dfs_radar_detected_work(struct work_struct *work);
22868c2ecf20Sopenharmony_ciint ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
22878c2ecf20Sopenharmony_ci			      struct cfg80211_csa_settings *csa_settings);
22888c2ecf20Sopenharmony_ci
22898c2ecf20Sopenharmony_cibool ieee80211_cs_valid(const struct ieee80211_cipher_scheme *cs);
22908c2ecf20Sopenharmony_cibool ieee80211_cs_list_valid(const struct ieee80211_cipher_scheme *cs, int n);
22918c2ecf20Sopenharmony_ciconst struct ieee80211_cipher_scheme *
22928c2ecf20Sopenharmony_ciieee80211_cs_get(struct ieee80211_local *local, u32 cipher,
22938c2ecf20Sopenharmony_ci		 enum nl80211_iftype iftype);
22948c2ecf20Sopenharmony_ciint ieee80211_cs_headroom(struct ieee80211_local *local,
22958c2ecf20Sopenharmony_ci			  struct cfg80211_crypto_settings *crypto,
22968c2ecf20Sopenharmony_ci			  enum nl80211_iftype iftype);
22978c2ecf20Sopenharmony_civoid ieee80211_recalc_dtim(struct ieee80211_local *local,
22988c2ecf20Sopenharmony_ci			   struct ieee80211_sub_if_data *sdata);
22998c2ecf20Sopenharmony_ciint ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
23008c2ecf20Sopenharmony_ci				 const struct cfg80211_chan_def *chandef,
23018c2ecf20Sopenharmony_ci				 enum ieee80211_chanctx_mode chanmode,
23028c2ecf20Sopenharmony_ci				 u8 radar_detect);
23038c2ecf20Sopenharmony_ciint ieee80211_max_num_channels(struct ieee80211_local *local);
23048c2ecf20Sopenharmony_cienum nl80211_chan_width ieee80211_get_sta_bw(struct ieee80211_sta *sta);
23058c2ecf20Sopenharmony_civoid ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
23068c2ecf20Sopenharmony_ci				       struct ieee80211_chanctx *ctx);
23078c2ecf20Sopenharmony_ci
23088c2ecf20Sopenharmony_ci/* TDLS */
23098c2ecf20Sopenharmony_ciint ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
23108c2ecf20Sopenharmony_ci			const u8 *peer, u8 action_code, u8 dialog_token,
23118c2ecf20Sopenharmony_ci			u16 status_code, u32 peer_capability,
23128c2ecf20Sopenharmony_ci			bool initiator, const u8 *extra_ies,
23138c2ecf20Sopenharmony_ci			size_t extra_ies_len);
23148c2ecf20Sopenharmony_ciint ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
23158c2ecf20Sopenharmony_ci			const u8 *peer, enum nl80211_tdls_operation oper);
23168c2ecf20Sopenharmony_civoid ieee80211_tdls_peer_del_work(struct work_struct *wk);
23178c2ecf20Sopenharmony_ciint ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev,
23188c2ecf20Sopenharmony_ci				  const u8 *addr, u8 oper_class,
23198c2ecf20Sopenharmony_ci				  struct cfg80211_chan_def *chandef);
23208c2ecf20Sopenharmony_civoid ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
23218c2ecf20Sopenharmony_ci					  struct net_device *dev,
23228c2ecf20Sopenharmony_ci					  const u8 *addr);
23238c2ecf20Sopenharmony_civoid ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata);
23248c2ecf20Sopenharmony_civoid ieee80211_tdls_chsw_work(struct work_struct *wk);
23258c2ecf20Sopenharmony_civoid ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
23268c2ecf20Sopenharmony_ci				      const u8 *peer, u16 reason);
23278c2ecf20Sopenharmony_ciconst char *ieee80211_get_reason_code_string(u16 reason_code);
23288c2ecf20Sopenharmony_ciu16 ieee80211_encode_usf(int val);
23298c2ecf20Sopenharmony_ciu8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
23308c2ecf20Sopenharmony_ci			enum nl80211_iftype type);
23318c2ecf20Sopenharmony_ci
23328c2ecf20Sopenharmony_ciextern const struct ethtool_ops ieee80211_ethtool_ops;
23338c2ecf20Sopenharmony_ci
23348c2ecf20Sopenharmony_ciu32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
23358c2ecf20Sopenharmony_ci				       struct ieee80211_vif *vif,
23368c2ecf20Sopenharmony_ci				       struct ieee80211_sta *pubsta,
23378c2ecf20Sopenharmony_ci				       int len, bool ampdu);
23388c2ecf20Sopenharmony_ci#ifdef CONFIG_MAC80211_NOINLINE
23398c2ecf20Sopenharmony_ci#define debug_noinline noinline
23408c2ecf20Sopenharmony_ci#else
23418c2ecf20Sopenharmony_ci#define debug_noinline
23428c2ecf20Sopenharmony_ci#endif
23438c2ecf20Sopenharmony_ci
23448c2ecf20Sopenharmony_civoid ieee80211_init_frag_cache(struct ieee80211_fragment_cache *cache);
23458c2ecf20Sopenharmony_civoid ieee80211_destroy_frag_cache(struct ieee80211_fragment_cache *cache);
23468c2ecf20Sopenharmony_ci
23478c2ecf20Sopenharmony_ci#endif /* IEEE80211_I_H */
2348