1d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2f0706e82SJiri Benc /*
3f0706e82SJiri Benc * Copyright 2002-2005, Instant802 Networks, Inc.
4f0706e82SJiri Benc * Copyright 2005, Devicescape Software, Inc.
5f0706e82SJiri Benc * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
6026331c4SJouni Malinen * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
742bd20d9SAviya Erenfeld * Copyright 2013-2015 Intel Mobile Communications GmbH
823a5f0afSJohannes Berg * Copyright (C) 2018-2022 Intel Corporation
9f0706e82SJiri Benc */
10f0706e82SJiri Benc
11f0706e82SJiri Benc #ifndef IEEE80211_I_H
12f0706e82SJiri Benc #define IEEE80211_I_H
13f0706e82SJiri Benc
14f0706e82SJiri Benc #include <linux/kernel.h>
15f0706e82SJiri Benc #include <linux/device.h>
16f0706e82SJiri Benc #include <linux/if_ether.h>
17f0706e82SJiri Benc #include <linux/interrupt.h>
18f0706e82SJiri Benc #include <linux/list.h>
19f0706e82SJiri Benc #include <linux/netdevice.h>
20f0706e82SJiri Benc #include <linux/skbuff.h>
21f0706e82SJiri Benc #include <linux/workqueue.h>
22f0706e82SJiri Benc #include <linux/types.h>
23f0706e82SJiri Benc #include <linux/spinlock.h>
24571ecf67SJohannes Berg #include <linux/etherdevice.h>
25e1e54068SJohannes Berg #include <linux/leds.h>
26a729cff8SJohannes Berg #include <linux/idr.h>
277bedd0cfSJohannes Berg #include <linux/rhashtable.h>
28779969e3SJohannes Berg #include <linux/rbtree.h>
29fe7a5d5cSJohannes Berg #include <net/ieee80211_radiotap.h>
3093da9cc1Scolin@cozybit.com #include <net/cfg80211.h>
3151cb6db0SDavid S. Miller #include <net/mac80211.h>
32fa962b92SMichal Kazior #include <net/fq.h>
332c8dccc7SJohannes Berg #include "key.h"
34f0706e82SJiri Benc #include "sta_info.h"
35bdcbd8e0SJohannes Berg #include "debug.h"
36baa951a1SJohannes Berg #include "drop.h"
37f0706e82SJiri Benc
383beea351SJohannes Berg extern const struct cfg80211_ops mac80211_config_ops;
393beea351SJohannes Berg
409cfb0009SJohannes Berg struct ieee80211_local;
41d5edb9aeSFelix Fietkau struct ieee80211_mesh_fast_tx;
42f0706e82SJiri Benc
43f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the
44f0706e82SJiri Benc * associated stations are using power saving. */
45f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128
46f0706e82SJiri Benc
47f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames.
48f0706e82SJiri Benc * Note: increasing this limit increases the potential memory requirement. Each
49f0706e82SJiri Benc * frame can be up to about 2 kB long. */
50f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512
51f0706e82SJiri Benc
52f0706e82SJiri Benc /* Required encryption head and tailroom */
53f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8
54765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18
55f0706e82SJiri Benc
561ea6f9c0SJohannes Berg /* power level hasn't been configured (or set to automatic) */
571ea6f9c0SJohannes Berg #define IEEE80211_UNSET_POWER_LEVEL INT_MIN
581ea6f9c0SJohannes Berg
59d6a4ed6fSArik Nemtsov /*
60aa75ebc2SMichal Kazior * Some APs experience problems when working with U-APSD. Decreasing the
61aa75ebc2SMichal Kazior * probability of that happening by using legacy mode for all ACs but VO isn't
62aa75ebc2SMichal Kazior * enough.
63aa75ebc2SMichal Kazior *
64aa75ebc2SMichal Kazior * Cisco 4410N originally forced us to enable VO by default only because it
65aa75ebc2SMichal Kazior * treated non-VO ACs as legacy.
66aa75ebc2SMichal Kazior *
67aa75ebc2SMichal Kazior * However some APs (notably Netgear R7000) silently reclassify packets to
68aa75ebc2SMichal Kazior * different ACs. Since u-APSD ACs require trigger frames for frame retrieval
69aa75ebc2SMichal Kazior * clients would never see some frames (e.g. ARP responses) or would fetch them
70aa75ebc2SMichal Kazior * accidentally after a long time.
71aa75ebc2SMichal Kazior *
72aa75ebc2SMichal Kazior * It makes little sense to enable u-APSD queues by default because it needs
73aa75ebc2SMichal Kazior * userspace applications to be aware of it to actually take advantage of the
74aa75ebc2SMichal Kazior * possible additional powersavings. Implicitly depending on driver autotrigger
75aa75ebc2SMichal Kazior * frame support doesn't make much sense.
76d6a4ed6fSArik Nemtsov */
77aa75ebc2SMichal Kazior #define IEEE80211_DEFAULT_UAPSD_QUEUES 0
78ab13315aSKalle Valo
79ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN \
80ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
81ab13315aSKalle Valo
82f438ceb8SEmmanuel Grumbach extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
83f438ceb8SEmmanuel Grumbach
846ae16775SAntonio Quartulli #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
856ae16775SAntonio Quartulli
86167e33f4SAyala Beker #define IEEE80211_MAX_NAN_INSTANCE_ID 255
87167e33f4SAyala Beker
888ccc0702SFelix Fietkau
898ccc0702SFelix Fietkau /*
908ccc0702SFelix Fietkau * Keep a station's queues on the active list for deficit accounting purposes
918ccc0702SFelix Fietkau * if it was active or queued during the last 100ms
928ccc0702SFelix Fietkau */
938ccc0702SFelix Fietkau #define AIRTIME_ACTIVE_DURATION (HZ / 10)
948ccc0702SFelix Fietkau
95c2b13452SJohannes Berg struct ieee80211_bss {
96ef429dadSJohannes Berg u32 device_ts_beacon, device_ts_presp;
978c358bcdSJohannes Berg
9843ac2ca3SJouni Malinen bool wmm_used;
99ab13315aSKalle Valo bool uapsd_supported;
10000d3f14cSJohannes Berg
101f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32
102f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
103f0706e82SJiri Benc size_t supp_rates_len;
104817cee76SAlexander Bondar struct ieee80211_rate *beacon_rate;
105f0706e82SJiri Benc
1062a333a0dSJohannes Berg u32 vht_cap_info;
1072a333a0dSJohannes Berg
10800d3f14cSJohannes Berg /*
10925985edcSLucas De Marchi * During association, we save an ERP value from a probe response so
1105628221cSDaniel Drake * that we can feed ERP info to the driver when handling the
1115628221cSDaniel Drake * association completes. these fields probably won't be up-to-date
11200d3f14cSJohannes Berg * otherwise, you probably don't want to use them.
11300d3f14cSJohannes Berg */
11400d3f14cSJohannes Berg bool has_erp_value;
1155628221cSDaniel Drake u8 erp_value;
116fcff4f10SPaul Stewart
117fcff4f10SPaul Stewart /* Keep track of the corruption of the last beacon/probe response. */
118fcff4f10SPaul Stewart u8 corrupt_data;
119fcff4f10SPaul Stewart
120fcff4f10SPaul Stewart /* Keep track of what bits of information we have valid info for. */
121fcff4f10SPaul Stewart u8 valid_data;
122fcff4f10SPaul Stewart };
123fcff4f10SPaul Stewart
124fcff4f10SPaul Stewart /**
125954a654aSJeff Johnson * enum ieee80211_bss_corrupt_data_flags - BSS data corruption flags
126fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted
127fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted
128fcff4f10SPaul Stewart *
129fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the
130fcff4f10SPaul Stewart * @corrupt_data field of &struct ieee80211_bss.
131fcff4f10SPaul Stewart */
132fcff4f10SPaul Stewart enum ieee80211_bss_corrupt_data_flags {
133fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_BEACON = BIT(0),
134fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1)
135fcff4f10SPaul Stewart };
136fcff4f10SPaul Stewart
137fcff4f10SPaul Stewart /**
138954a654aSJeff Johnson * enum ieee80211_bss_valid_data_flags - BSS valid data flags
139fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE
140fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE
141fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE
142fcff4f10SPaul Stewart *
143fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the
144fcff4f10SPaul Stewart * @valid_data field of &struct ieee80211_bss. They show which parts
145d070f913SStephen Hemminger * of the data structure were received as a result of an un-corrupted
146fcff4f10SPaul Stewart * beacon/probe response.
147fcff4f10SPaul Stewart */
148fcff4f10SPaul Stewart enum ieee80211_bss_valid_data_flags {
149fcff4f10SPaul Stewart IEEE80211_BSS_VALID_WMM = BIT(1),
150fcff4f10SPaul Stewart IEEE80211_BSS_VALID_RATES = BIT(2),
151fcff4f10SPaul Stewart IEEE80211_BSS_VALID_ERP = BIT(3)
152f0706e82SJiri Benc };
153f0706e82SJiri Benc
1549efeccacSMichael S. Tsirkin typedef unsigned __bitwise ieee80211_tx_result;
1559ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
1569ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u)
1579ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u)
1589ae54c84SJohannes Berg
1595cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1)
1605cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2)
1619ae54c84SJohannes Berg
1625cf121c3SJohannes Berg struct ieee80211_tx_data {
163f0706e82SJiri Benc struct sk_buff *skb;
164252b86c4SJohannes Berg struct sk_buff_head skbs;
165f0706e82SJiri Benc struct ieee80211_local *local;
166f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata;
167f0706e82SJiri Benc struct sta_info *sta;
168f0706e82SJiri Benc struct ieee80211_key *key;
1690d528d85SFelix Fietkau struct ieee80211_tx_rate rate;
1705cf121c3SJohannes Berg
171056cdd59SJohannes Berg unsigned int flags;
1725cf121c3SJohannes Berg };
1735cf121c3SJohannes Berg
174554891e6SJohannes Berg /**
175554891e6SJohannes Berg * enum ieee80211_packet_rx_flags - packet RX flags
176554891e6SJohannes Berg * @IEEE80211_RX_AMSDU: a-MSDU packet
177554891e6SJohannes Berg * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
1784cfda47bSChristian Lamparter * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
179554891e6SJohannes Berg *
180554891e6SJohannes Berg * These are per-frame flags that are attached to a frame in the
181554891e6SJohannes Berg * @rx_flags field of &struct ieee80211_rx_status.
182554891e6SJohannes Berg */
183554891e6SJohannes Berg enum ieee80211_packet_rx_flags {
184554891e6SJohannes Berg IEEE80211_RX_AMSDU = BIT(3),
185554891e6SJohannes Berg IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4),
1864cfda47bSChristian Lamparter IEEE80211_RX_DEFERRED_RELEASE = BIT(5),
187554891e6SJohannes Berg };
188554891e6SJohannes Berg
189554891e6SJohannes Berg /**
190554891e6SJohannes Berg * enum ieee80211_rx_flags - RX data flags
191554891e6SJohannes Berg *
192554891e6SJohannes Berg * @IEEE80211_RX_CMNTR: received on cooked monitor already
193ee971924SJohannes Berg * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
194ee971924SJohannes Berg * to cfg80211_report_obss_beacon().
195554891e6SJohannes Berg *
196554891e6SJohannes Berg * These flags are used across handling multiple interfaces
197554891e6SJohannes Berg * for a single frame.
198554891e6SJohannes Berg */
199554891e6SJohannes Berg enum ieee80211_rx_flags {
200554891e6SJohannes Berg IEEE80211_RX_CMNTR = BIT(0),
201ee971924SJohannes Berg IEEE80211_RX_BEACON_REPORTED = BIT(1),
202554891e6SJohannes Berg };
2035cf121c3SJohannes Berg
2045cf121c3SJohannes Berg struct ieee80211_rx_data {
205c5d1686bSFelix Fietkau struct list_head *list;
2065cf121c3SJohannes Berg struct sk_buff *skb;
2075cf121c3SJohannes Berg struct ieee80211_local *local;
2085cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata;
20956057da4SJohannes Berg struct ieee80211_link_data *link;
2105cf121c3SJohannes Berg struct sta_info *sta;
211ccdde7c7SJohannes Berg struct link_sta_info *link_sta;
2125cf121c3SJohannes Berg struct ieee80211_key *key;
213056cdd59SJohannes Berg
214056cdd59SJohannes Berg unsigned int flags;
2159e26297aSJohannes Berg
2169e26297aSJohannes Berg /*
2179e26297aSJohannes Berg * Index into sequence numbers array, 0..16
2189e26297aSJohannes Berg * since the last (16) is used for non-QoS,
2199e26297aSJohannes Berg * will be 16 on non-QoS frames.
2209e26297aSJohannes Berg */
2219e26297aSJohannes Berg int seqno_idx;
2229e26297aSJohannes Berg
2239e26297aSJohannes Berg /*
2249e26297aSJohannes Berg * Index into the security IV/PN arrays, 0..16
2259e26297aSJohannes Berg * since the last (16) is used for CCMP-encrypted
2269e26297aSJohannes Berg * management frames, will be set to 16 on mgmt
2279e26297aSJohannes Berg * frames and 0 on non-QoS frames.
2289e26297aSJohannes Berg */
2299e26297aSJohannes Berg int security_idx;
2309e26297aSJohannes Berg
231892b3bceSJohannes Berg int link_id;
232892b3bceSJohannes Berg
233bf30ca92SJohannes Berg union {
234bf30ca92SJohannes Berg struct {
235bf30ca92SJohannes Berg u32 iv32;
236bf30ca92SJohannes Berg u16 iv16;
237bf30ca92SJohannes Berg } tkip;
238bf30ca92SJohannes Berg struct {
239bf30ca92SJohannes Berg u8 pn[IEEE80211_CCMP_PN_LEN];
240bf30ca92SJohannes Berg } ccm_gcm;
241bf30ca92SJohannes Berg };
242f0706e82SJiri Benc };
243f0706e82SJiri Benc
244af296bdbSMichal Kazior struct ieee80211_csa_settings {
245af296bdbSMichal Kazior const u16 *counter_offsets_beacon;
246af296bdbSMichal Kazior const u16 *counter_offsets_presp;
247af296bdbSMichal Kazior
248af296bdbSMichal Kazior int n_counter_offsets_beacon;
249af296bdbSMichal Kazior int n_counter_offsets_presp;
250af296bdbSMichal Kazior
251af296bdbSMichal Kazior u8 count;
252af296bdbSMichal Kazior };
253af296bdbSMichal Kazior
2545f9404abSJohn Crispin struct ieee80211_color_change_settings {
2555f9404abSJohn Crispin u16 counter_offset_beacon;
2565f9404abSJohn Crispin u16 counter_offset_presp;
2575f9404abSJohn Crispin u8 count;
2585f9404abSJohn Crispin };
2595f9404abSJohn Crispin
2605dfdaf58SJohannes Berg struct beacon_data {
2615dfdaf58SJohannes Berg u8 *head, *tail;
2625dfdaf58SJohannes Berg int head_len, tail_len;
26343552be1SThomas Pedersen struct ieee80211_meshconf_ie *meshconf;
2648552a434SJohn Crispin u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
2658552a434SJohn Crispin u8 cntdwn_current_counter;
2662b3171c6SLorenzo Bianconi struct cfg80211_mbssid_elems *mbssid_ies;
26768b9bea2SAloka Dixit struct cfg80211_rnr_elems *rnr_ies;
2688860020eSJohannes Berg struct rcu_head rcu_head;
2695dfdaf58SJohannes Berg };
2705dfdaf58SJohannes Berg
271aa7a0080SEyal Shapira struct probe_resp {
272aa7a0080SEyal Shapira struct rcu_head rcu_head;
273aa7a0080SEyal Shapira int len;
2748552a434SJohn Crispin u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM];
2753c23215bSGustavo A. R. Silva u8 data[];
276aa7a0080SEyal Shapira };
277aa7a0080SEyal Shapira
278295b02c4SAloka Dixit struct fils_discovery_data {
279295b02c4SAloka Dixit struct rcu_head rcu_head;
280295b02c4SAloka Dixit int len;
281295b02c4SAloka Dixit u8 data[];
282295b02c4SAloka Dixit };
283295b02c4SAloka Dixit
284632189a0SAloka Dixit struct unsol_bcast_probe_resp_data {
285632189a0SAloka Dixit struct rcu_head rcu_head;
286632189a0SAloka Dixit int len;
287632189a0SAloka Dixit u8 data[];
288632189a0SAloka Dixit };
289632189a0SAloka Dixit
290d012a605SMarco Porsch struct ps_data {
291d012a605SMarco Porsch /* yes, this looks ugly, but guarantees that we can later use
292d012a605SMarco Porsch * bitmap_empty :)
293d012a605SMarco Porsch * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
2945fe2bb86SJoe Perches u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]
2955fe2bb86SJoe Perches __aligned(__alignof__(unsigned long));
296d012a605SMarco Porsch struct sk_buff_head bc_buf;
297d012a605SMarco Porsch atomic_t num_sta_ps; /* number of stations in PS mode */
298d012a605SMarco Porsch int dtim_count;
299d012a605SMarco Porsch bool dtim_bc_mc;
300d012a605SMarco Porsch };
301d012a605SMarco Porsch
302f0706e82SJiri Benc struct ieee80211_if_ap {
3034e141dadSMichal Kazior struct list_head vlans; /* write-protected with RTNL and local->mtx */
3040ec3ca44SJohannes Berg
305d012a605SMarco Porsch struct ps_data ps;
306030ef8f8SFelix Fietkau atomic_t num_mcast_sta; /* number of stations receiving multicast */
307687da132SEmmanuel Grumbach
308ebceec86SMichael Braun bool multicast_to_unicast;
309bfd8403aSJohannes Berg bool active;
310f0706e82SJiri Benc };
311f0706e82SJiri Benc
312f0706e82SJiri Benc struct ieee80211_if_vlan {
3134e141dadSMichal Kazior struct list_head list; /* write-protected with RTNL and local->mtx */
314f14543eeSFelix Fietkau
315f14543eeSFelix Fietkau /* used for all tx if the VLAN is configured to 4-addr mode */
31640b275b6SJohannes Berg struct sta_info __rcu *sta;
31772f15d53SMichael Braun atomic_t num_mcast_sta; /* number of stations receiving multicast */
318f0706e82SJiri Benc };
319f0706e82SJiri Benc
320ee385855SLuis Carlos Cobo struct mesh_stats {
321c8a61a7dSDaniel Walker __u32 fwded_mcast; /* Mesh forwarded multicast frames */
322c8a61a7dSDaniel Walker __u32 fwded_unicast; /* Mesh forwarded unicast frames */
323c8a61a7dSDaniel Walker __u32 fwded_frames; /* Mesh total forwarded frames */
324ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/
325ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */
326ee385855SLuis Carlos Cobo };
327ee385855SLuis Carlos Cobo
328ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1
329ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2
330ee385855SLuis Carlos Cobo struct mesh_preq_queue {
331ee385855SLuis Carlos Cobo struct list_head list;
332ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN];
333ee385855SLuis Carlos Cobo u8 flags;
334ee385855SLuis Carlos Cobo };
335ee385855SLuis Carlos Cobo
3362eb278e0SJohannes Berg struct ieee80211_roc_work {
33777fdaa12SJohannes Berg struct list_head list;
338af6b6374SJohannes Berg
339af6b6374SJohannes Berg struct ieee80211_sub_if_data *sdata;
340af6b6374SJohannes Berg
341f679f65dSJohannes Berg struct ieee80211_channel *chan;
342af6b6374SJohannes Berg
3432eb278e0SJohannes Berg bool started, abort, hw_begun, notified;
344b4b177a5SJohannes Berg bool on_channel;
345f679f65dSJohannes Berg
346aaa016ccSJohannes Berg unsigned long start_time;
347e4da8c37SJohannes Berg
3482eb278e0SJohannes Berg u32 duration, req_duration;
349f30221e4SJohannes Berg struct sk_buff *frame;
35050febf6aSJohannes Berg u64 cookie, mgmt_tx_cookie;
351d339d5caSIlan Peer enum ieee80211_roc_type type;
35277fdaa12SJohannes Berg };
35377fdaa12SJohannes Berg
35446900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */
355ab1faeadSJohannes Berg enum ieee80211_sta_flags {
356b291ba11SJohannes Berg IEEE80211_STA_CONNECTION_POLL = BIT(1),
357b291ba11SJohannes Berg IEEE80211_STA_CONTROL_PORT = BIT(2),
358b291ba11SJohannes Berg IEEE80211_STA_MFP_ENABLED = BIT(6),
359ab13315aSKalle Valo IEEE80211_STA_UAPSD_ENABLED = BIT(7),
360375177bfSVivek Natarajan IEEE80211_STA_NULLFUNC_ACKED = BIT(8),
361cd2f5dd7SAssaf Krauss IEEE80211_STA_ENABLE_RRM = BIT(15),
362ba323e29SJohannes Berg };
363ba323e29SJohannes Berg
364ba323e29SJohannes Berg typedef u32 __bitwise ieee80211_conn_flags_t;
365ba323e29SJohannes Berg
366ba323e29SJohannes Berg enum ieee80211_conn_flags {
367ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_HT = (__force ieee80211_conn_flags_t)BIT(0),
368ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_40MHZ = (__force ieee80211_conn_flags_t)BIT(1),
369ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_VHT = (__force ieee80211_conn_flags_t)BIT(2),
370ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_80P80MHZ = (__force ieee80211_conn_flags_t)BIT(3),
371ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_160MHZ = (__force ieee80211_conn_flags_t)BIT(4),
372ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_HE = (__force ieee80211_conn_flags_t)BIT(5),
373ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_EHT = (__force ieee80211_conn_flags_t)BIT(6),
374ba323e29SJohannes Berg IEEE80211_CONN_DISABLE_320MHZ = (__force ieee80211_conn_flags_t)BIT(7),
375ab1faeadSJohannes Berg };
376ab1faeadSJohannes Berg
37766e67e41SJohannes Berg struct ieee80211_mgd_auth_data {
37866e67e41SJohannes Berg struct cfg80211_bss *bss;
37966e67e41SJohannes Berg unsigned long timeout;
38066e67e41SJohannes Berg int tries;
38166e67e41SJohannes Berg u16 algorithm, expected_transaction;
38266e67e41SJohannes Berg
38366e67e41SJohannes Berg u8 key[WLAN_KEY_LEN_WEP104];
38466e67e41SJohannes Berg u8 key_len, key_idx;
38594d9864cSJohannes Berg bool done, waiting;
386efb543e6SJouni Malinen bool peer_confirmed;
38789afe614SJohannes Berg bool timeout_started;
38885176a3fSJohannes Berg int link_id;
38966e67e41SJohannes Berg
39081151ce4SJohannes Berg u8 ap_addr[ETH_ALEN] __aligned(2);
39181151ce4SJohannes Berg
3926b8ece3aSJouni Malinen u16 sae_trans, sae_status;
3936b8ece3aSJouni Malinen size_t data_len;
3946b8ece3aSJouni Malinen u8 data[];
39566e67e41SJohannes Berg };
39666e67e41SJohannes Berg
39766e67e41SJohannes Berg struct ieee80211_mgd_assoc_data {
39881151ce4SJohannes Berg struct {
39966e67e41SJohannes Berg struct cfg80211_bss *bss;
40066e67e41SJohannes Berg
40181151ce4SJohannes Berg u8 addr[ETH_ALEN] __aligned(2);
40266e67e41SJohannes Berg
4039dde6423SJohannes Berg u8 ap_ht_param;
4049dde6423SJohannes Berg
405b08fbbd8SJohannes Berg struct ieee80211_vht_cap ap_vht_cap;
406b08fbbd8SJohannes Berg
40781151ce4SJohannes Berg size_t elems_len;
40881151ce4SJohannes Berg u8 *elems; /* pointing to inside ie[] below */
40981151ce4SJohannes Berg
41081151ce4SJohannes Berg ieee80211_conn_flags_t conn_flags;
411c2d052a3SIlan Peer
412c2d052a3SIlan Peer u16 status;
4136d543b34SIlan Peer
4146d543b34SIlan Peer bool disabled;
41581151ce4SJohannes Berg } link[IEEE80211_MLD_MAX_NUM_LINKS];
41681151ce4SJohannes Berg
41781151ce4SJohannes Berg u8 ap_addr[ETH_ALEN] __aligned(2);
41881151ce4SJohannes Berg
41981151ce4SJohannes Berg /* this is for a workaround, so we use it only for non-MLO */
42081151ce4SJohannes Berg const u8 *supp_rates;
42181151ce4SJohannes Berg u8 supp_rates_len;
42281151ce4SJohannes Berg
42381151ce4SJohannes Berg unsigned long timeout;
42481151ce4SJohannes Berg int tries;
42581151ce4SJohannes Berg
42681151ce4SJohannes Berg u8 prev_ap_addr[ETH_ALEN];
42781151ce4SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN];
42881151ce4SJohannes Berg u8 ssid_len;
42981151ce4SJohannes Berg bool wmm, uapsd;
43081151ce4SJohannes Berg bool need_beacon;
43181151ce4SJohannes Berg bool synced;
43281151ce4SJohannes Berg bool timeout_started;
43381151ce4SJohannes Berg bool s1g;
43481151ce4SJohannes Berg
43581151ce4SJohannes Berg unsigned int assoc_link_id;
43681151ce4SJohannes Berg
43739404feeSJouni Malinen u8 fils_nonces[2 * FILS_NONCE_LEN];
43839404feeSJouni Malinen u8 fils_kek[FILS_MAX_KEK_LEN];
43939404feeSJouni Malinen size_t fils_kek_len;
44039404feeSJouni Malinen
44166e67e41SJohannes Berg size_t ie_len;
44281151ce4SJohannes Berg u8 *ie_pos; /* used to fill ie[] with link[].elems */
44366e67e41SJohannes Berg u8 ie[];
44466e67e41SJohannes Berg };
44566e67e41SJohannes Berg
44602219b3aSJohannes Berg struct ieee80211_sta_tx_tspec {
44702219b3aSJohannes Berg /* timestamp of the first packet in the time slice */
44802219b3aSJohannes Berg unsigned long time_slice_start;
44902219b3aSJohannes Berg
45002219b3aSJohannes Berg u32 admitted_time; /* in usecs, unlike over the air */
45102219b3aSJohannes Berg u8 tsid;
45202219b3aSJohannes Berg s8 up; /* signed to be able to invalidate with -1 during teardown */
45302219b3aSJohannes Berg
45402219b3aSJohannes Berg /* consumed TX time in microseconds in the time slice */
45502219b3aSJohannes Berg u32 consumed_tx_time;
45602219b3aSJohannes Berg enum {
45702219b3aSJohannes Berg TX_TSPEC_ACTION_NONE = 0,
45802219b3aSJohannes Berg TX_TSPEC_ACTION_DOWNGRADE,
45902219b3aSJohannes Berg TX_TSPEC_ACTION_STOP_DOWNGRADE,
46002219b3aSJohannes Berg } action;
46102219b3aSJohannes Berg bool downgraded;
46202219b3aSJohannes Berg };
46302219b3aSJohannes Berg
464eb1e011aSJohannes Berg DECLARE_EWMA(beacon_signal, 4, 4)
465338c17aeSJohannes Berg
46646900298SJohannes Berg struct ieee80211_if_managed {
467056cdd59SJohannes Berg struct timer_list timer;
468b291ba11SJohannes Berg struct timer_list conn_mon_timer;
469b291ba11SJohannes Berg struct timer_list bcn_mon_timer;
470b291ba11SJohannes Berg struct work_struct monitor_work;
4714b8d43f1SJohannes Berg struct wiphy_work beacon_connection_loss_work;
4724b8d43f1SJohannes Berg struct wiphy_work csa_connection_drop_work;
47346900298SJohannes Berg
4747ccc8bd7SFelix Fietkau unsigned long beacon_timeout;
475b291ba11SJohannes Berg unsigned long probe_timeout;
476a43abf29SMaxim Levitsky int probe_send_count;
47704ac3c0eSFelix Fietkau bool nullfunc_failed;
4783f8a39ffSJohannes Berg u8 connection_loss:1,
4793f8a39ffSJohannes Berg driver_disconnect:1,
4805dfad108SJohannes Berg reconnect:1,
4815dfad108SJohannes Berg associated:1;
482b291ba11SJohannes Berg
48366e67e41SJohannes Berg struct ieee80211_mgd_auth_data *auth_data;
48466e67e41SJohannes Berg struct ieee80211_mgd_assoc_data *assoc_data;
48546900298SJohannes Berg
486965bedadSJohannes Berg bool powersave; /* powersave requested for this iface */
48705cb9108SJohannes Berg bool broken_ap; /* AP is broken -- turn off powersave */
488965bedadSJohannes Berg
489d6f2da5bSJiri Slaby unsigned int flags;
490f0706e82SJiri Benc
4911672c0e3SJohannes Berg bool status_acked;
4921672c0e3SJohannes Berg bool status_received;
4931672c0e3SJohannes Berg __le16 status_fc;
4941672c0e3SJohannes Berg
495fdfacf0aSJouni Malinen enum {
496fdfacf0aSJouni Malinen IEEE80211_MFP_DISABLED,
497fdfacf0aSJouni Malinen IEEE80211_MFP_OPTIONAL,
498fdfacf0aSJouni Malinen IEEE80211_MFP_REQUIRED
499fdfacf0aSJouni Malinen } mfp; /* management frame protection */
500fdfacf0aSJouni Malinen
501dc41e4d4SEliad Peller /*
502dc41e4d4SEliad Peller * Bitmask of enabled u-apsd queues,
503dc41e4d4SEliad Peller * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
504dc41e4d4SEliad Peller * to take effect.
505dc41e4d4SEliad Peller */
506dc41e4d4SEliad Peller unsigned int uapsd_queues;
507dc41e4d4SEliad Peller
508dc41e4d4SEliad Peller /*
509dc41e4d4SEliad Peller * Maximum number of buffered frames AP can deliver during a
510dc41e4d4SEliad Peller * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
511dc41e4d4SEliad Peller * Needs a new association to take effect.
512dc41e4d4SEliad Peller */
513dc41e4d4SEliad Peller unsigned int uapsd_max_sp_len;
514dc41e4d4SEliad Peller
5159bc383deSJohannes Berg u8 use_4addr;
51617e4ec14SJouni Malinen
517615f7b9bSMeenakshi Venkataraman /*
518615f7b9bSMeenakshi Venkataraman * State variables for keeping track of RSSI of the AP currently
519615f7b9bSMeenakshi Venkataraman * connected to and informing driver when RSSI has gone
520615f7b9bSMeenakshi Venkataraman * below/above a certain threshold.
521615f7b9bSMeenakshi Venkataraman */
522615f7b9bSMeenakshi Venkataraman int rssi_min_thold, rssi_max_thold;
523ef96a842SBen Greear
524ef96a842SBen Greear struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
525ef96a842SBen Greear struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
526dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */
527dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */
5287957c6c8SThomas Pedersen struct ieee80211_s1g_cap s1g_capa; /* configured S1G overrides */
5297957c6c8SThomas Pedersen struct ieee80211_s1g_cap s1g_capa_mask; /* valid s1g_capa bits */
53081dd2b88SArik Nemtsov
5311277b4a9SLiad Kaufman /* TDLS support */
53281dd2b88SArik Nemtsov u8 tdls_peer[ETH_ALEN] __aligned(2);
53381dd2b88SArik Nemtsov struct delayed_work tdls_peer_del_work;
5341277b4a9SLiad Kaufman struct sk_buff *orig_teardown_skb; /* The original teardown skb */
5351277b4a9SLiad Kaufman struct sk_buff *teardown_skb; /* A copy to send through the AP */
5361277b4a9SLiad Kaufman spinlock_t teardown_lock; /* To lock changing teardown_skb */
53782c0cc90SArik Nemtsov bool tdls_wider_bw_prohibited;
53802219b3aSJohannes Berg
53902219b3aSJohannes Berg /* WMM-AC TSPEC support */
54002219b3aSJohannes Berg struct ieee80211_sta_tx_tspec tx_tspec[IEEE80211_NUM_ACS];
54102219b3aSJohannes Berg /* Use a separate work struct so that we can do something here
54202219b3aSJohannes Berg * while the sdata->work is flushing the queues, for example.
54302219b3aSJohannes Berg * otherwise, in scenarios where we hardly get any traffic out
54402219b3aSJohannes Berg * on the BE queue, but there's a lot of VO traffic, we might
54502219b3aSJohannes Berg * get stuck in a downgraded situation and flush takes forever.
54602219b3aSJohannes Berg */
54702219b3aSJohannes Berg struct delayed_work tx_tspec_wk;
5484d9ec73dSJouni Malinen
5494d9ec73dSJouni Malinen /* Information elements from the last transmitted (Re)Association
5504d9ec73dSJouni Malinen * Request frame.
5514d9ec73dSJouni Malinen */
5524d9ec73dSJouni Malinen u8 *assoc_req_ies;
5534d9ec73dSJouni Malinen size_t assoc_req_ies_len;
5548eb8dd2fSIlan Peer
5558eb8dd2fSIlan Peer struct wiphy_delayed_work ml_reconf_work;
5568eb8dd2fSIlan Peer u16 removed_links;
557f0706e82SJiri Benc };
558f0706e82SJiri Benc
55946900298SJohannes Berg struct ieee80211_if_ibss {
56046900298SJohannes Berg struct timer_list timer;
56187351d09SJohannes Berg struct wiphy_work csa_connection_drop_work;
56246900298SJohannes Berg
563af8cdcd8SJohannes Berg unsigned long last_scan_completed;
5645bb644a0SJohannes Berg
565fbd2c8dcSTeemu Paasikivi u32 basic_rates;
566fbd2c8dcSTeemu Paasikivi
567af8cdcd8SJohannes Berg bool fixed_bssid;
568af8cdcd8SJohannes Berg bool fixed_channel;
569fffd0934SJohannes Berg bool privacy;
57046900298SJohannes Berg
571267335d6SAntonio Quartulli bool control_port;
5728e8d347dSSimon Wunderlich bool userspace_handles_dfs;
573267335d6SAntonio Quartulli
5744d196e4bSFelix Fietkau u8 bssid[ETH_ALEN] __aligned(2);
575af8cdcd8SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN];
576af8cdcd8SJohannes Berg u8 ssid_len, ie_len;
577af8cdcd8SJohannes Berg u8 *ie;
5783aede78aSSimon Wunderlich struct cfg80211_chan_def chandef;
57946900298SJohannes Berg
58046900298SJohannes Berg unsigned long ibss_join_req;
581af8cdcd8SJohannes Berg /* probe response/beacon for IBSS */
582c3ffeab4SJohannes Berg struct beacon_data __rcu *presp;
58346900298SJohannes Berg
584822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
585822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
586822854b0SSimon Wunderlich
5878bf11d8dSJohannes Berg spinlock_t incomplete_lock;
5888bf11d8dSJohannes Berg struct list_head incomplete_stations;
5898bf11d8dSJohannes Berg
59046900298SJohannes Berg enum {
59146900298SJohannes Berg IEEE80211_IBSS_MLME_SEARCH,
59246900298SJohannes Berg IEEE80211_IBSS_MLME_JOINED,
59346900298SJohannes Berg } state;
59446900298SJohannes Berg };
59546900298SJohannes Berg
596dbf498fbSJavier Cardona /**
597239281f8SRostislav Lisovy * struct ieee80211_if_ocb - OCB mode state
598239281f8SRostislav Lisovy *
599239281f8SRostislav Lisovy * @housekeeping_timer: timer for periodic invocation of a housekeeping task
600239281f8SRostislav Lisovy * @wrkq_flags: OCB deferred task action
601239281f8SRostislav Lisovy * @incomplete_lock: delayed STA insertion lock
602239281f8SRostislav Lisovy * @incomplete_stations: list of STAs waiting for delayed insertion
603239281f8SRostislav Lisovy * @joined: indication if the interface is connected to an OCB network
604239281f8SRostislav Lisovy */
605239281f8SRostislav Lisovy struct ieee80211_if_ocb {
606239281f8SRostislav Lisovy struct timer_list housekeeping_timer;
607239281f8SRostislav Lisovy unsigned long wrkq_flags;
608239281f8SRostislav Lisovy
609239281f8SRostislav Lisovy spinlock_t incomplete_lock;
610239281f8SRostislav Lisovy struct list_head incomplete_stations;
611239281f8SRostislav Lisovy
612239281f8SRostislav Lisovy bool joined;
613239281f8SRostislav Lisovy };
614239281f8SRostislav Lisovy
615239281f8SRostislav Lisovy /**
616dbf498fbSJavier Cardona * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface
617dbf498fbSJavier Cardona *
618dbf498fbSJavier Cardona * these declarations define the interface, which enables
619dbf498fbSJavier Cardona * vendor-specific mesh synchronization
620dbf498fbSJavier Cardona *
621dbf498fbSJavier Cardona */
622dbf498fbSJavier Cardona struct ieee802_11_elems;
623dbf498fbSJavier Cardona struct ieee80211_mesh_sync_ops {
624a5b983c6SJohannes Berg void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata, u16 stype,
625a5b983c6SJohannes Berg struct ieee80211_mgmt *mgmt, unsigned int len,
626a5b983c6SJohannes Berg const struct ieee80211_meshconf_ie *mesh_cfg,
627dbf498fbSJavier Cardona struct ieee80211_rx_status *rx_status);
62843552be1SThomas Pedersen
62943552be1SThomas Pedersen /* should be called with beacon_data under RCU read lock */
630445cd452SMasashi Honma void (*adjust_tsf)(struct ieee80211_sub_if_data *sdata,
63143552be1SThomas Pedersen struct beacon_data *beacon);
632dbf498fbSJavier Cardona /* add other framework functions here */
633dbf498fbSJavier Cardona };
634dbf498fbSJavier Cardona
635b8456a14SChun-Yeow Yeoh struct mesh_csa_settings {
636b8456a14SChun-Yeow Yeoh struct rcu_head rcu_head;
637b8456a14SChun-Yeow Yeoh struct cfg80211_csa_settings settings;
638b8456a14SChun-Yeow Yeoh };
639b8456a14SChun-Yeow Yeoh
6408b5cb7e4SPavel Skripkin /**
6418b5cb7e4SPavel Skripkin * struct mesh_table
6428b5cb7e4SPavel Skripkin *
6438b5cb7e4SPavel Skripkin * @known_gates: list of known mesh gates and their mpaths by the station. The
6448b5cb7e4SPavel Skripkin * gate's mpath may or may not be resolved and active.
6458b5cb7e4SPavel Skripkin * @gates_lock: protects updates to known_gates
6468b5cb7e4SPavel Skripkin * @rhead: the rhashtable containing struct mesh_paths, keyed by dest addr
6478b5cb7e4SPavel Skripkin * @walk_head: linked list containing all mesh_path objects
6488b5cb7e4SPavel Skripkin * @walk_lock: lock protecting walk_head
6498b5cb7e4SPavel Skripkin * @entries: number of entries in the table
6508b5cb7e4SPavel Skripkin */
6518b5cb7e4SPavel Skripkin struct mesh_table {
6528b5cb7e4SPavel Skripkin struct hlist_head known_gates;
6538b5cb7e4SPavel Skripkin spinlock_t gates_lock;
6548b5cb7e4SPavel Skripkin struct rhashtable rhead;
6558b5cb7e4SPavel Skripkin struct hlist_head walk_head;
6568b5cb7e4SPavel Skripkin spinlock_t walk_lock;
6578b5cb7e4SPavel Skripkin atomic_t entries; /* Up to MAX_MESH_NEIGHBOURS */
6588b5cb7e4SPavel Skripkin };
6598b5cb7e4SPavel Skripkin
660d5edb9aeSFelix Fietkau /**
661d5edb9aeSFelix Fietkau * struct mesh_tx_cache - mesh fast xmit header cache
662d5edb9aeSFelix Fietkau *
663d5edb9aeSFelix Fietkau * @rht: hash table containing struct ieee80211_mesh_fast_tx, using skb DA as key
664d5edb9aeSFelix Fietkau * @walk_head: linked list containing all ieee80211_mesh_fast_tx objects
665d5edb9aeSFelix Fietkau * @walk_lock: lock protecting walk_head and rht
666d5edb9aeSFelix Fietkau */
667d5edb9aeSFelix Fietkau struct mesh_tx_cache {
668d5edb9aeSFelix Fietkau struct rhashtable rht;
669d5edb9aeSFelix Fietkau struct hlist_head walk_head;
670d5edb9aeSFelix Fietkau spinlock_t walk_lock;
671d5edb9aeSFelix Fietkau };
672d5edb9aeSFelix Fietkau
673472dbc45SJohannes Berg struct ieee80211_if_mesh {
674472dbc45SJohannes Berg struct timer_list housekeeping_timer;
675472dbc45SJohannes Berg struct timer_list mesh_path_timer;
676e304bfd3SRui Paulo struct timer_list mesh_path_root_timer;
677472dbc45SJohannes Berg
67818889231SJavier Cardona unsigned long wrkq_flags;
6796e48ebffSFelix Fietkau unsigned long mbss_changed[64 / BITS_PER_LONG];
680472dbc45SJohannes Berg
6810ab2e55dSBenjamin Berg bool userspace_handles_dfs;
6820ab2e55dSBenjamin Berg
683472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
684472dbc45SJohannes Berg size_t mesh_id_len;
685472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */
6863491707aSRui Paulo u8 mesh_pp_id;
687472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */
6883491707aSRui Paulo u8 mesh_pm_id;
689472dbc45SJohannes Berg /* Congestion Control Mode Identifier */
6903491707aSRui Paulo u8 mesh_cc_id;
6919e03fdfdSJavier Cardona /* Synchronization Protocol Identifier */
6923491707aSRui Paulo u8 mesh_sp_id;
6939e03fdfdSJavier Cardona /* Authentication Protocol Identifier */
6943491707aSRui Paulo u8 mesh_auth_id;
695d19b3bf6SRui Paulo /* Local mesh Sequence Number */
696d19b3bf6SRui Paulo u32 sn;
697472dbc45SJohannes Berg /* Last used PREQ ID */
698472dbc45SJohannes Berg u32 preq_id;
699472dbc45SJohannes Berg atomic_t mpaths;
700d19b3bf6SRui Paulo /* Timestamp of last SN update */
701d19b3bf6SRui Paulo unsigned long last_sn_update;
702dca7e943SThomas Pedersen /* Time when it's ok to send next PERR */
703dca7e943SThomas Pedersen unsigned long next_perr;
704dca7e943SThomas Pedersen /* Timestamp of last PREQ sent */
705472dbc45SJohannes Berg unsigned long last_preq;
706472dbc45SJohannes Berg struct mesh_rmc *rmc;
707472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock;
708472dbc45SJohannes Berg struct mesh_preq_queue preq_queue;
709472dbc45SJohannes Berg int preq_queue_len;
710472dbc45SJohannes Berg struct mesh_stats mshstats;
711472dbc45SJohannes Berg struct mesh_config mshcfg;
7121258d976SAshok Nagarajan atomic_t estab_plinks;
713e626dad9SFelix Fietkau atomic_t mesh_seqnum;
714472dbc45SJohannes Berg bool accepting_plinks;
7155ee68e5bSJavier Cardona int num_gates;
7162b5e1967SThomas Pedersen struct beacon_data __rcu *beacon;
717581a8b0fSJavier Cardona const u8 *ie;
718581a8b0fSJavier Cardona u8 ie_len;
719b130e5ceSJavier Cardona enum {
720b130e5ceSJavier Cardona IEEE80211_MESH_SEC_NONE = 0x0,
721b130e5ceSJavier Cardona IEEE80211_MESH_SEC_AUTHED = 0x1,
722b130e5ceSJavier Cardona IEEE80211_MESH_SEC_SECURED = 0x2,
723b130e5ceSJavier Cardona } security;
724a6dad6a2SThomas Pedersen bool user_mpm;
725dbf498fbSJavier Cardona /* Extensible Synchronization Framework */
7268ba7acf3SJohannes Berg const struct ieee80211_mesh_sync_ops *sync_ops;
727dbf498fbSJavier Cardona s64 sync_offset_clockdrift_max;
728dbf498fbSJavier Cardona spinlock_t sync_offset_lock;
7293f52b7e3SMarco Porsch /* mesh power save */
7303f52b7e3SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm;
7313f52b7e3SMarco Porsch int ps_peers_light_sleep;
7323f52b7e3SMarco Porsch int ps_peers_deep_sleep;
7333f52b7e3SMarco Porsch struct ps_data ps;
7348f2535b9SChun-Yeow Yeoh /* Channel Switching Support */
735b8456a14SChun-Yeow Yeoh struct mesh_csa_settings __rcu *csa;
7360cb4d4dcSLuciano Coelho enum {
7370cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_NONE,
7380cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_INIT,
7390cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_REPEATER,
7400cb4d4dcSLuciano Coelho } csa_role;
741b8456a14SChun-Yeow Yeoh u8 chsw_ttl;
7428f2535b9SChun-Yeow Yeoh u16 pre_value;
74343552be1SThomas Pedersen
74443552be1SThomas Pedersen /* offset from skb->data while building IE */
74543552be1SThomas Pedersen int meshconf_offset;
7462bdaf386SBob Copeland
7478b5cb7e4SPavel Skripkin struct mesh_table mesh_paths;
7488b5cb7e4SPavel Skripkin struct mesh_table mpp_paths; /* Store paths for MPP&MAP */
7492bdaf386SBob Copeland int mesh_paths_generation;
7502bdaf386SBob Copeland int mpp_paths_generation;
751d5edb9aeSFelix Fietkau struct mesh_tx_cache tx_cache;
752472dbc45SJohannes Berg };
753902acc78SJohannes Berg
754902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH
755472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
756472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0)
757902acc78SJohannes Berg #else
758472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
759902acc78SJohannes Berg do { } while (0)
760902acc78SJohannes Berg #endif
761f0706e82SJiri Benc
762213cd118SJohannes Berg /**
763213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags
764213cd118SJohannes Berg *
765213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
766213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
767213cd118SJohannes Berg * associated stations and deliver multicast frames both
768213cd118SJohannes Berg * back to wireless media and to the local net stack.
76995acac61SJohannes Berg * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
7707b7eab6fSJohannes Berg * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
7717d352ccfSYoughandhar Chintala * @IEEE80211_SDATA_DISCONNECT_HW_RESTART: Disconnect after hardware restart
7727d352ccfSYoughandhar Chintala * recovery
773213cd118SJohannes Berg */
774213cd118SJohannes Berg enum ieee80211_sub_if_data_flags {
775213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0),
7767986cf95SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
77795acac61SJohannes Berg IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4),
7787b7eab6fSJohannes Berg IEEE80211_SDATA_IN_DRIVER = BIT(5),
7797d352ccfSYoughandhar Chintala IEEE80211_SDATA_DISCONNECT_HW_RESTART = BIT(6),
780213cd118SJohannes Berg };
781213cd118SJohannes Berg
78234d4bc4dSJohannes Berg /**
78334d4bc4dSJohannes Berg * enum ieee80211_sdata_state_bits - virtual interface state bits
78434d4bc4dSJohannes Berg * @SDATA_STATE_RUNNING: virtual interface is up & running; this
78534d4bc4dSJohannes Berg * mirrors netif_running() but is separate for interface type
78634d4bc4dSJohannes Berg * change handling while the interface is up
7875b714c6aSJohannes Berg * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
7885b714c6aSJohannes Berg * mode, so queues are stopped
789d6a83228SJohannes Berg * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due
790d6a83228SJohannes Berg * to offchannel, reset when offchannel returns
79134d4bc4dSJohannes Berg */
79234d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits {
79334d4bc4dSJohannes Berg SDATA_STATE_RUNNING,
7945b714c6aSJohannes Berg SDATA_STATE_OFFCHANNEL,
795d6a83228SJohannes Berg SDATA_STATE_OFFCHANNEL_BEACON_STOPPED,
79634d4bc4dSJohannes Berg };
79734d4bc4dSJohannes Berg
798d01a1e65SMichal Kazior /**
799d01a1e65SMichal Kazior * enum ieee80211_chanctx_mode - channel context configuration mode
800d01a1e65SMichal Kazior *
801d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_SHARED: channel context may be used by
802d01a1e65SMichal Kazior * multiple interfaces
803d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used
804d01a1e65SMichal Kazior * only by a single interface. This can be used for example for
805d01a1e65SMichal Kazior * non-fixed channel IBSS.
806d01a1e65SMichal Kazior */
807d01a1e65SMichal Kazior enum ieee80211_chanctx_mode {
808d01a1e65SMichal Kazior IEEE80211_CHANCTX_SHARED,
809d01a1e65SMichal Kazior IEEE80211_CHANCTX_EXCLUSIVE
810d01a1e65SMichal Kazior };
811d01a1e65SMichal Kazior
8125bcae31dSMichal Kazior /**
8135bcae31dSMichal Kazior * enum ieee80211_chanctx_replace_state - channel context replacement state
8145bcae31dSMichal Kazior *
8155bcae31dSMichal Kazior * This is used for channel context in-place reservations that require channel
8165bcae31dSMichal Kazior * context switch/swap.
8175bcae31dSMichal Kazior *
8185bcae31dSMichal Kazior * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place
8195bcae31dSMichal Kazior * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced
8205bcae31dSMichal Kazior * by a (not yet registered) channel context pointed by %replace_ctx.
8215bcae31dSMichal Kazior * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context
8225bcae31dSMichal Kazior * replaces an existing channel context pointed to by %replace_ctx.
8235bcae31dSMichal Kazior */
8245bcae31dSMichal Kazior enum ieee80211_chanctx_replace_state {
8255bcae31dSMichal Kazior IEEE80211_CHANCTX_REPLACE_NONE,
8265bcae31dSMichal Kazior IEEE80211_CHANCTX_WILL_BE_REPLACED,
8275bcae31dSMichal Kazior IEEE80211_CHANCTX_REPLACES_OTHER,
8285bcae31dSMichal Kazior };
8295bcae31dSMichal Kazior
830d01a1e65SMichal Kazior struct ieee80211_chanctx {
831d01a1e65SMichal Kazior struct list_head list;
832d01a1e65SMichal Kazior struct rcu_head rcu_head;
833d01a1e65SMichal Kazior
834b4f85443SJohannes Berg struct list_head assigned_links;
835b4f85443SJohannes Berg struct list_head reserved_links;
836484298adSMichal Kazior
8375bcae31dSMichal Kazior enum ieee80211_chanctx_replace_state replace_state;
8385bcae31dSMichal Kazior struct ieee80211_chanctx *replace_ctx;
8395bcae31dSMichal Kazior
840d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode;
8418a61af65SJohannes Berg bool driver_present;
842d01a1e65SMichal Kazior
843d01a1e65SMichal Kazior struct ieee80211_chanctx_conf conf;
844d01a1e65SMichal Kazior };
845d01a1e65SMichal Kazior
84632db6b54SKyeyoon Park struct mac80211_qos_map {
84732db6b54SKyeyoon Park struct cfg80211_qos_map qos_map;
84832db6b54SKyeyoon Park struct rcu_head rcu_head;
84932db6b54SKyeyoon Park };
85032db6b54SKyeyoon Park
851ba8c3d6fSFelix Fietkau enum txq_info_flags {
852ba8c3d6fSFelix Fietkau IEEE80211_TXQ_STOP,
853ba8c3d6fSFelix Fietkau IEEE80211_TXQ_AMPDU,
8546e0456b5SFelix Fietkau IEEE80211_TXQ_NO_AMSDU,
8554444bc21SAlexander Wetzel IEEE80211_TXQ_DIRTY,
856ba8c3d6fSFelix Fietkau };
857ba8c3d6fSFelix Fietkau
858fa962b92SMichal Kazior /**
859fa962b92SMichal Kazior * struct txq_info - per tid queue
860fa962b92SMichal Kazior *
861fa962b92SMichal Kazior * @tin: contains packets split into multiple flows
862fa962b92SMichal Kazior * @def_flow: used as a fallback flow when a packet destined to @tin hashes to
863fa962b92SMichal Kazior * a fq_flow which is already owned by a different tin
8645caa328eSMichal Kazior * @def_cvars: codel vars for @def_flow
8652433647bSToke Høiland-Jørgensen * @frags: used to keep fragments created after dequeue
866942741daSFelix Fietkau * @schedule_order: used with ieee80211_local->active_txqs
867942741daSFelix Fietkau * @schedule_round: counter to prevent infinite loops on TXQ scheduling
868fa962b92SMichal Kazior */
869ba8c3d6fSFelix Fietkau struct txq_info {
870fa962b92SMichal Kazior struct fq_tin tin;
8715caa328eSMichal Kazior struct codel_vars def_cvars;
8728d51dbb8SToke Høiland-Jørgensen struct codel_stats cstats;
873942741daSFelix Fietkau
874942741daSFelix Fietkau u16 schedule_round;
875942741daSFelix Fietkau struct list_head schedule_order;
876c74025f4SJohannes Berg
877c74025f4SJohannes Berg struct sk_buff_head frags;
878942741daSFelix Fietkau
879ba8c3d6fSFelix Fietkau unsigned long flags;
880ba8c3d6fSFelix Fietkau
881ba8c3d6fSFelix Fietkau /* keep last! */
882ba8c3d6fSFelix Fietkau struct ieee80211_txq txq;
883ba8c3d6fSFelix Fietkau };
884ba8c3d6fSFelix Fietkau
885d8212184SAviya Erenfeld struct ieee80211_if_mntr {
886d8212184SAviya Erenfeld u32 flags;
88742bd20d9SAviya Erenfeld u8 mu_follow_addr[ETH_ALEN] __aligned(2);
888f64331d5SJohannes Berg
889f64331d5SJohannes Berg struct list_head list;
890d8212184SAviya Erenfeld };
891d8212184SAviya Erenfeld
8925953ff6dSAyala Beker /**
8935953ff6dSAyala Beker * struct ieee80211_if_nan - NAN state
8945953ff6dSAyala Beker *
8955953ff6dSAyala Beker * @conf: current NAN configuration
896167e33f4SAyala Beker * @func_ids: a bitmap of available instance_id's
8975953ff6dSAyala Beker */
8985953ff6dSAyala Beker struct ieee80211_if_nan {
8995953ff6dSAyala Beker struct cfg80211_nan_conf conf;
900167e33f4SAyala Beker
901167e33f4SAyala Beker /* protects function_inst_ids */
902167e33f4SAyala Beker spinlock_t func_lock;
903167e33f4SAyala Beker struct idr function_inst_ids;
9045953ff6dSAyala Beker };
9055953ff6dSAyala Beker
906bfd8403aSJohannes Berg struct ieee80211_link_data_managed {
907bfd8403aSJohannes Berg u8 bssid[ETH_ALEN] __aligned(2);
908bfd8403aSJohannes Berg
909bfd8403aSJohannes Berg u8 dtim_period;
910bfd8403aSJohannes Berg enum ieee80211_smps_mode req_smps, /* requested smps mode */
911bfd8403aSJohannes Berg driver_smps_mode; /* smps mode request */
912bfd8403aSJohannes Berg
913ba323e29SJohannes Berg ieee80211_conn_flags_t conn_flags;
914ba323e29SJohannes Berg
915bfd8403aSJohannes Berg s16 p2p_noa_index;
916bfd8403aSJohannes Berg
917ab3a830dSJohannes Berg bool tdls_chan_switch_prohibited;
918ab3a830dSJohannes Berg
919bfd8403aSJohannes Berg bool have_beacon;
92042ed6748SJohannes Berg bool tracking_signal_avg;
9216359598dSJohannes Berg bool disable_wmm_tracking;
92239eac2deSJohannes Berg bool operating_11g_mode;
923bfd8403aSJohannes Berg
924bfd8403aSJohannes Berg bool csa_waiting_bcn;
925bfd8403aSJohannes Berg bool csa_ignored_same_chan;
926ec3252bfSJohannes Berg struct wiphy_delayed_work chswitch_work;
927bfd8403aSJohannes Berg
9281444f589SJohannes Berg struct wiphy_work request_smps_work;
929bfd8403aSJohannes Berg bool beacon_crc_valid;
930bfd8403aSJohannes Berg u32 beacon_crc;
931bfd8403aSJohannes Berg struct ewma_beacon_signal ave_beacon_signal;
932bfd8403aSJohannes Berg int last_ave_beacon_signal;
933bfd8403aSJohannes Berg
934bfd8403aSJohannes Berg /*
935bfd8403aSJohannes Berg * Number of Beacon frames used in ave_beacon_signal. This can be used
936bfd8403aSJohannes Berg * to avoid generating less reliable cqm events that would be based
937bfd8403aSJohannes Berg * only on couple of received frames.
938bfd8403aSJohannes Berg */
939bfd8403aSJohannes Berg unsigned int count_beacon_signal;
940bfd8403aSJohannes Berg
941bfd8403aSJohannes Berg /* Number of times beacon loss was invoked. */
942bfd8403aSJohannes Berg unsigned int beacon_loss_count;
943bfd8403aSJohannes Berg
944bfd8403aSJohannes Berg /*
945bfd8403aSJohannes Berg * Last Beacon frame signal strength average (ave_beacon_signal / 16)
946bfd8403aSJohannes Berg * that triggered a cqm event. 0 indicates that no event has been
947bfd8403aSJohannes Berg * generated for the current association.
948bfd8403aSJohannes Berg */
949bfd8403aSJohannes Berg int last_cqm_event_signal;
950bfd8403aSJohannes Berg
951bfd8403aSJohannes Berg int wmm_last_param_set;
952bfd8403aSJohannes Berg int mu_edca_last_param_set;
953bfd8403aSJohannes Berg
9545c1f9753SJohannes Berg u8 bss_param_ch_cnt;
9555c1f9753SJohannes Berg
956bfd8403aSJohannes Berg struct cfg80211_bss *bss;
957bfd8403aSJohannes Berg };
958bfd8403aSJohannes Berg
959bfd8403aSJohannes Berg struct ieee80211_link_data_ap {
960bfd8403aSJohannes Berg struct beacon_data __rcu *beacon;
961bfd8403aSJohannes Berg struct probe_resp __rcu *probe_resp;
962bfd8403aSJohannes Berg struct fils_discovery_data __rcu *fils_discovery;
963bfd8403aSJohannes Berg struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp;
964bfd8403aSJohannes Berg
965bfd8403aSJohannes Berg /* to be used after channel switch. */
966bfd8403aSJohannes Berg struct cfg80211_beacon_data *next_beacon;
967bfd8403aSJohannes Berg };
968bfd8403aSJohannes Berg
969bfd8403aSJohannes Berg struct ieee80211_link_data {
970b4f85443SJohannes Berg struct ieee80211_sub_if_data *sdata;
971b4f85443SJohannes Berg unsigned int link_id;
972b4f85443SJohannes Berg
973b4f85443SJohannes Berg struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
974b4f85443SJohannes Berg struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */
975b4f85443SJohannes Berg
976bfd8403aSJohannes Berg /* multicast keys only */
977bfd8403aSJohannes Berg struct ieee80211_key __rcu *gtk[NUM_DEFAULT_KEYS +
978bfd8403aSJohannes Berg NUM_DEFAULT_MGMT_KEYS +
979bfd8403aSJohannes Berg NUM_DEFAULT_BEACON_KEYS];
980bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_multicast_key;
981bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_mgmt_key;
982bfd8403aSJohannes Berg struct ieee80211_key __rcu *default_beacon_key;
983bfd8403aSJohannes Berg
984bfd8403aSJohannes Berg struct work_struct csa_finalize_work;
985bfd8403aSJohannes Berg bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
98639eac2deSJohannes Berg
98739eac2deSJohannes Berg bool operating_11g_mode;
98839eac2deSJohannes Berg
989bfd8403aSJohannes Berg struct cfg80211_chan_def csa_chandef;
990bfd8403aSJohannes Berg
991bfd8403aSJohannes Berg struct work_struct color_change_finalize_work;
99292881884SLorenzo Bianconi struct delayed_work color_collision_detect_work;
99392881884SLorenzo Bianconi u64 color_bitmap;
994bfd8403aSJohannes Berg
995bfd8403aSJohannes Berg /* context reservation -- protected with chanctx_mtx */
996bfd8403aSJohannes Berg struct ieee80211_chanctx *reserved_chanctx;
997bfd8403aSJohannes Berg struct cfg80211_chan_def reserved_chandef;
998bfd8403aSJohannes Berg bool reserved_radar_required;
999bfd8403aSJohannes Berg bool reserved_ready;
1000bfd8403aSJohannes Berg
1001bfd8403aSJohannes Berg u8 needed_rx_chains;
1002bfd8403aSJohannes Berg enum ieee80211_smps_mode smps_mode;
1003bfd8403aSJohannes Berg
1004bfd8403aSJohannes Berg int user_power_level; /* in dBm */
1005bfd8403aSJohannes Berg int ap_power_level; /* in dBm */
1006bfd8403aSJohannes Berg
1007bfd8403aSJohannes Berg bool radar_required;
1008bfd8403aSJohannes Berg struct delayed_work dfs_cac_timer_work;
1009bfd8403aSJohannes Berg
1010bfd8403aSJohannes Berg union {
1011bfd8403aSJohannes Berg struct ieee80211_link_data_managed mgd;
1012bfd8403aSJohannes Berg struct ieee80211_link_data_ap ap;
1013bfd8403aSJohannes Berg } u;
1014d8675a63SJohannes Berg
1015b3e2130bSJohannes Berg struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
1016b3e2130bSJohannes Berg
1017d8675a63SJohannes Berg struct ieee80211_bss_conf *conf;
1018170cd6a6SBenjamin Berg
1019170cd6a6SBenjamin Berg #ifdef CONFIG_MAC80211_DEBUGFS
1020170cd6a6SBenjamin Berg struct dentry *debugfs_dir;
1021170cd6a6SBenjamin Berg #endif
1022bfd8403aSJohannes Berg };
1023bfd8403aSJohannes Berg
1024f0706e82SJiri Benc struct ieee80211_sub_if_data {
1025f0706e82SJiri Benc struct list_head list;
1026f0706e82SJiri Benc
1027f0706e82SJiri Benc struct wireless_dev wdev;
1028f0706e82SJiri Benc
102911a843b7SJohannes Berg /* keys */
103011a843b7SJohannes Berg struct list_head key_list;
103111a843b7SJohannes Berg
10323bff1865SYogesh Ashok Powar /* count for keys needing tailroom space allocation */
10333bff1865SYogesh Ashok Powar int crypto_tx_tailroom_needed_cnt;
10348d1f7ecdSJohannes Berg int crypto_tx_tailroom_pending_dec;
10358d1f7ecdSJohannes Berg struct delayed_work dec_tailroom_needed_wk;
10363bff1865SYogesh Ashok Powar
1037f0706e82SJiri Benc struct net_device *dev;
1038f0706e82SJiri Benc struct ieee80211_local *local;
1039f0706e82SJiri Benc
104013262ffdSJiri Slaby unsigned int flags;
10417e9ed188SDaniel Drake
104234d4bc4dSJohannes Berg unsigned long state;
104334d4bc4dSJohannes Berg
104447846c9bSJohannes Berg char name[IFNAMSIZ];
104547846c9bSJohannes Berg
10463a11ce08SJohannes Berg struct ieee80211_fragment_cache frags;
1047f0706e82SJiri Benc
1048b53be792SSimon Wunderlich /* TID bitmap for NoAck policy */
1049b53be792SSimon Wunderlich u16 noack_map;
1050b53be792SSimon Wunderlich
105100e96decSYoni Divinsky /* bit field of ACM bits (BIT(802.1D tag)) */
105200e96decSYoni Divinsky u8 wmm_acm;
105300e96decSYoni Divinsky
1054bfd8403aSJohannes Berg struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS];
105540b275b6SJohannes Berg struct ieee80211_key __rcu *default_unicast_key;
1056f0706e82SJiri Benc
105794778280SJohannes Berg u16 sequence_number;
1058963d0e8dSJohannes Berg u16 mld_mcast_seq;
1059a621fa4dSJohannes Berg __be16 control_port_protocol;
1060a621fa4dSJohannes Berg bool control_port_no_encrypt;
10617f3f96ceSMarkus Theil bool control_port_no_preauth;
1062018f6fbfSDenis Kenzior bool control_port_over_nl80211;
106394778280SJohannes Berg
106480a83cfcSMichal Kazior atomic_t num_tx_queued;
106532db6b54SKyeyoon Park struct mac80211_qos_map __rcu *qos_map;
1066f6f3def3SEliad Peller
106704ecd257SJohannes Berg /* used to reconfigure hardware SM PS */
106804ecd257SJohannes Berg struct work_struct recalc_smps;
106904ecd257SJohannes Berg
107016114496SJohannes Berg struct wiphy_work work;
107135f20c14SJohannes Berg struct sk_buff_head skb_queue;
1072f5a4c24eSLorenzo Bianconi struct sk_buff_head status_queue;
107335f20c14SJohannes Berg
10743e122be0SJohannes Berg /*
10753e122be0SJohannes Berg * AP this belongs to: self in AP mode and
10763e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for
10773e122be0SJohannes Berg * all others (might be needed later in IBSS)
10783e122be0SJohannes Berg */
10793e122be0SJohannes Berg struct ieee80211_if_ap *bss;
10803e122be0SJohannes Berg
108137eb0b16SJouni Malinen /* bitmap of allowed (non-MCS) rate indexes for rate control */
108257fbcce3SJohannes Berg u32 rc_rateidx_mask[NUM_NL80211_BANDS];
10832ffbe6d3SFelix Fietkau
108457fbcce3SJohannes Berg bool rc_has_mcs_mask[NUM_NL80211_BANDS];
108557fbcce3SJohannes Berg u8 rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN];
1086f0706e82SJiri Benc
108757fbcce3SJohannes Berg bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS];
108857fbcce3SJohannes Berg u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX];
1089b119ad6eSLorenzo Bianconi
109008fad438SJouni Malinen /* Beacon frame (non-MCS) rate (as a bitmap) */
109108fad438SJouni Malinen u32 beacon_rateidx_mask[NUM_NL80211_BANDS];
109208fad438SJouni Malinen bool beacon_rate_set;
109308fad438SJouni Malinen
1094f0706e82SJiri Benc union {
1095f0706e82SJiri Benc struct ieee80211_if_ap ap;
1096f0706e82SJiri Benc struct ieee80211_if_vlan vlan;
109746900298SJohannes Berg struct ieee80211_if_managed mgd;
109846900298SJohannes Berg struct ieee80211_if_ibss ibss;
1099472dbc45SJohannes Berg struct ieee80211_if_mesh mesh;
1100239281f8SRostislav Lisovy struct ieee80211_if_ocb ocb;
1101d8212184SAviya Erenfeld struct ieee80211_if_mntr mntr;
11025953ff6dSAyala Beker struct ieee80211_if_nan nan;
1103f0706e82SJiri Benc } u;
1104e9f207f0SJiri Benc
1105bfd8403aSJohannes Berg struct ieee80211_link_data deflink;
1106d8675a63SJohannes Berg struct ieee80211_link_data __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
1107bfd8403aSJohannes Berg
11083d901102SJohannes Berg /* for ieee80211_set_active_links_async() */
11093d901102SJohannes Berg struct work_struct activate_links_work;
11103d901102SJohannes Berg u16 desired_active_links;
11113d901102SJohannes Berg
1112e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
1113e9f207f0SJiri Benc struct {
1114295bafb4SBen Greear struct dentry *subdir_stations;
1115f7e0104cSJohannes Berg struct dentry *default_unicast_key;
1116f7e0104cSJohannes Berg struct dentry *default_multicast_key;
11173cfcf6acSJouni Malinen struct dentry *default_mgmt_key;
1118e5473e80SJouni Malinen struct dentry *default_beacon_key;
11197bcfaf2fSJohannes Berg } debugfs;
1120e9f207f0SJiri Benc #endif
1121529ba6e9SJohannes Berg
112232bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */
112332bfd35dSJohannes Berg struct ieee80211_vif vif;
1124f0706e82SJiri Benc };
1125f0706e82SJiri Benc
112632bfd35dSJohannes Berg static inline
vif_to_sdata(struct ieee80211_vif * p)112732bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
112832bfd35dSJohannes Berg {
112932bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif);
113032bfd35dSJohannes Berg }
113132bfd35dSJohannes Berg
sdata_lock(struct ieee80211_sub_if_data * sdata)11328d61ffa5SJohannes Berg static inline void sdata_lock(struct ieee80211_sub_if_data *sdata)
11338d61ffa5SJohannes Berg __acquires(&sdata->wdev.mtx)
11348d61ffa5SJohannes Berg {
11358d61ffa5SJohannes Berg mutex_lock(&sdata->wdev.mtx);
11368d61ffa5SJohannes Berg __acquire(&sdata->wdev.mtx);
11378d61ffa5SJohannes Berg }
11388d61ffa5SJohannes Berg
sdata_unlock(struct ieee80211_sub_if_data * sdata)11398d61ffa5SJohannes Berg static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata)
11408d61ffa5SJohannes Berg __releases(&sdata->wdev.mtx)
11418d61ffa5SJohannes Berg {
11428d61ffa5SJohannes Berg mutex_unlock(&sdata->wdev.mtx);
11438d61ffa5SJohannes Berg __release(&sdata->wdev.mtx);
11448d61ffa5SJohannes Berg }
11458d61ffa5SJohannes Berg
11467ca133bcSSimon Wunderlich #define sdata_dereference(p, sdata) \
11477ca133bcSSimon Wunderlich rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx))
11487ca133bcSSimon Wunderlich
11498d61ffa5SJohannes Berg static inline void
sdata_assert_lock(struct ieee80211_sub_if_data * sdata)11508d61ffa5SJohannes Berg sdata_assert_lock(struct ieee80211_sub_if_data *sdata)
11518d61ffa5SJohannes Berg {
11528d61ffa5SJohannes Berg lockdep_assert_held(&sdata->wdev.mtx);
11538d61ffa5SJohannes Berg }
11548d61ffa5SJohannes Berg
1155438b61b7SSimon Wunderlich static inline int
ieee80211_chanwidth_get_shift(enum nl80211_chan_width width)11563dc05935SJohannes Berg ieee80211_chanwidth_get_shift(enum nl80211_chan_width width)
1157438b61b7SSimon Wunderlich {
11583dc05935SJohannes Berg switch (width) {
1159438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_5:
1160438b61b7SSimon Wunderlich return 2;
1161438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_10:
1162438b61b7SSimon Wunderlich return 1;
1163438b61b7SSimon Wunderlich default:
1164438b61b7SSimon Wunderlich return 0;
1165438b61b7SSimon Wunderlich }
1166438b61b7SSimon Wunderlich }
1167438b61b7SSimon Wunderlich
1168438b61b7SSimon Wunderlich static inline int
ieee80211_chandef_get_shift(struct cfg80211_chan_def * chandef)11693dc05935SJohannes Berg ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef)
11703dc05935SJohannes Berg {
11713dc05935SJohannes Berg return ieee80211_chanwidth_get_shift(chandef->width);
11723dc05935SJohannes Berg }
11733dc05935SJohannes Berg
11743dc05935SJohannes Berg static inline int
ieee80211_vif_get_shift(struct ieee80211_vif * vif)1175438b61b7SSimon Wunderlich ieee80211_vif_get_shift(struct ieee80211_vif *vif)
1176438b61b7SSimon Wunderlich {
1177438b61b7SSimon Wunderlich struct ieee80211_chanctx_conf *chanctx_conf;
1178438b61b7SSimon Wunderlich int shift = 0;
1179438b61b7SSimon Wunderlich
1180438b61b7SSimon Wunderlich rcu_read_lock();
1181d0a9123eSJohannes Berg chanctx_conf = rcu_dereference(vif->bss_conf.chanctx_conf);
1182438b61b7SSimon Wunderlich if (chanctx_conf)
1183438b61b7SSimon Wunderlich shift = ieee80211_chandef_get_shift(&chanctx_conf->def);
1184438b61b7SSimon Wunderlich rcu_read_unlock();
1185438b61b7SSimon Wunderlich
1186438b61b7SSimon Wunderlich return shift;
1187438b61b7SSimon Wunderlich }
1188438b61b7SSimon Wunderlich
11892b3171c6SLorenzo Bianconi static inline int
ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems * elems,struct cfg80211_rnr_elems * rnr_elems,u8 i)119068b9bea2SAloka Dixit ieee80211_get_mbssid_beacon_len(struct cfg80211_mbssid_elems *elems,
119168b9bea2SAloka Dixit struct cfg80211_rnr_elems *rnr_elems,
119268b9bea2SAloka Dixit u8 i)
11932b3171c6SLorenzo Bianconi {
1194bd54f3c2SAloka Dixit int len = 0;
11952b3171c6SLorenzo Bianconi
1196bd54f3c2SAloka Dixit if (!elems || !elems->cnt || i > elems->cnt)
11972b3171c6SLorenzo Bianconi return 0;
11982b3171c6SLorenzo Bianconi
119968b9bea2SAloka Dixit if (i < elems->cnt) {
120068b9bea2SAloka Dixit len = elems->elem[i].len;
120168b9bea2SAloka Dixit if (rnr_elems) {
120268b9bea2SAloka Dixit len += rnr_elems->elem[i].len;
120368b9bea2SAloka Dixit for (i = elems->cnt; i < rnr_elems->cnt; i++)
120468b9bea2SAloka Dixit len += rnr_elems->elem[i].len;
120568b9bea2SAloka Dixit }
120668b9bea2SAloka Dixit return len;
120768b9bea2SAloka Dixit }
1208bd54f3c2SAloka Dixit
1209bd54f3c2SAloka Dixit /* i == elems->cnt, calculate total length of all MBSSID elements */
12102b3171c6SLorenzo Bianconi for (i = 0; i < elems->cnt; i++)
12112b3171c6SLorenzo Bianconi len += elems->elem[i].len;
12122b3171c6SLorenzo Bianconi
121368b9bea2SAloka Dixit if (rnr_elems) {
121468b9bea2SAloka Dixit for (i = 0; i < rnr_elems->cnt; i++)
121568b9bea2SAloka Dixit len += rnr_elems->elem[i].len;
121668b9bea2SAloka Dixit }
121768b9bea2SAloka Dixit
12182b3171c6SLorenzo Bianconi return len;
12192b3171c6SLorenzo Bianconi }
12202b3171c6SLorenzo Bianconi
1221f0706e82SJiri Benc enum {
1222f0706e82SJiri Benc IEEE80211_RX_MSG = 1,
1223f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2,
1224f0706e82SJiri Benc };
1225f0706e82SJiri Benc
1226ce7c9111SKalle Valo enum queue_stop_reason {
1227ce7c9111SKalle Valo IEEE80211_QUEUE_STOP_REASON_DRIVER,
1228520eb820SKalle Valo IEEE80211_QUEUE_STOP_REASON_PS,
122996f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_CSA,
123096f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
123125420604SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SUSPEND,
12328f77f384SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
12336c17b77bSSeth Forshee IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL,
1234445ea4e8SJohannes Berg IEEE80211_QUEUE_STOP_REASON_FLUSH,
1235db67d661SArik Nemtsov IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN,
1236b6da911bSLiad Kaufman IEEE80211_QUEUE_STOP_REASON_RESERVE_TID,
1237054c9939SJohannes Berg IEEE80211_QUEUE_STOP_REASON_IFTYPE_CHANGE,
1238cca07b00SLuciano Coelho
1239cca07b00SLuciano Coelho IEEE80211_QUEUE_STOP_REASONS,
1240ce7c9111SKalle Valo };
1241ce7c9111SKalle Valo
124265a6538aSLuciano Coelho #ifdef CONFIG_MAC80211_LEDS
1243e1e54068SJohannes Berg struct tpt_led_trigger {
1244e1e54068SJohannes Berg char name[32];
1245e1e54068SJohannes Berg const struct ieee80211_tpt_blink *blink_table;
1246e1e54068SJohannes Berg unsigned int blink_table_len;
1247e1e54068SJohannes Berg struct timer_list timer;
124834f11cd3SKees Cook struct ieee80211_local *local;
1249e1e54068SJohannes Berg unsigned long prev_traffic;
1250e1e54068SJohannes Berg unsigned long tx_bytes, rx_bytes;
125167408c8cSJohannes Berg unsigned int active, want;
125267408c8cSJohannes Berg bool running;
1253e1e54068SJohannes Berg };
125465a6538aSLuciano Coelho #endif
1255e1e54068SJohannes Berg
1256142b9f50SHelmut Schaa /**
1257142b9f50SHelmut Schaa * mac80211 scan flags - currently active scan mode
1258142b9f50SHelmut Schaa *
1259142b9f50SHelmut Schaa * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
1260142b9f50SHelmut Schaa * well be on the operating channel
1261142b9f50SHelmut Schaa * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
1262142b9f50SHelmut Schaa * determine if we are on the operating channel or not
12638a690674SBen Greear * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating
12648a690674SBen Greear * channel. This should not interrupt normal traffic.
12658789d459SJohannes Berg * @SCAN_COMPLETED: Set for our scan work function when the driver reported
12668789d459SJohannes Berg * that the scan completed.
12678789d459SJohannes Berg * @SCAN_ABORTED: Set for our scan work function when the driver reported
12688789d459SJohannes Berg * a scan complete for an aborted scan.
1269a754055aSEmmanuel Grumbach * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being
1270a754055aSEmmanuel Grumbach * cancelled.
1271b041b7b9SFelix Fietkau * @SCAN_BEACON_WAIT: Set whenever we're passive scanning because of radar/no-IR
1272b041b7b9SFelix Fietkau * and could send a probe request after receiving a beacon.
1273b041b7b9SFelix Fietkau * @SCAN_BEACON_DONE: Beacon received, we can now send a probe request
1274142b9f50SHelmut Schaa */
1275fbe9c429SHelmut Schaa enum {
1276fbe9c429SHelmut Schaa SCAN_SW_SCANNING,
1277142b9f50SHelmut Schaa SCAN_HW_SCANNING,
12788a690674SBen Greear SCAN_ONCHANNEL_SCANNING,
12798789d459SJohannes Berg SCAN_COMPLETED,
12808789d459SJohannes Berg SCAN_ABORTED,
1281a754055aSEmmanuel Grumbach SCAN_HW_CANCELLED,
1282b041b7b9SFelix Fietkau SCAN_BEACON_WAIT,
1283b041b7b9SFelix Fietkau SCAN_BEACON_DONE,
1284142b9f50SHelmut Schaa };
1285142b9f50SHelmut Schaa
1286142b9f50SHelmut Schaa /**
1287142b9f50SHelmut Schaa * enum mac80211_scan_state - scan state machine states
1288142b9f50SHelmut Schaa *
1289142b9f50SHelmut Schaa * @SCAN_DECISION: Main entry point to the scan state machine, this state
1290142b9f50SHelmut Schaa * determines if we should keep on scanning or switch back to the
1291142b9f50SHelmut Schaa * operating channel
1292142b9f50SHelmut Schaa * @SCAN_SET_CHANNEL: Set the next channel to be scanned
1293142b9f50SHelmut Schaa * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
129407ef03eeSJohannes Berg * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
129507ef03eeSJohannes Berg * send out data
129607ef03eeSJohannes Berg * @SCAN_RESUME: Resume the scan and scan the next channel
1297cd2bb512SSam Leffler * @SCAN_ABORT: Abort the scan and go back to operating channel
1298142b9f50SHelmut Schaa */
1299142b9f50SHelmut Schaa enum mac80211_scan_state {
1300142b9f50SHelmut Schaa SCAN_DECISION,
1301142b9f50SHelmut Schaa SCAN_SET_CHANNEL,
1302142b9f50SHelmut Schaa SCAN_SEND_PROBE,
130307ef03eeSJohannes Berg SCAN_SUSPEND,
130407ef03eeSJohannes Berg SCAN_RESUME,
1305cd2bb512SSam Leffler SCAN_ABORT,
1306fbe9c429SHelmut Schaa };
1307fbe9c429SHelmut Schaa
1308e908435eSLorenzo Bianconi DECLARE_STATIC_KEY_FALSE(aql_disable);
1309e908435eSLorenzo Bianconi
1310f0706e82SJiri Benc struct ieee80211_local {
1311f0706e82SJiri Benc /* embed the driver visible part.
1312f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep
1313f0706e82SJiri Benc * it first anyway so they become a no-op */
1314f0706e82SJiri Benc struct ieee80211_hw hw;
1315f0706e82SJiri Benc
1316fa962b92SMichal Kazior struct fq fq;
13175caa328eSMichal Kazior struct codel_vars *cvars;
13185caa328eSMichal Kazior struct codel_params cparams;
1319fa962b92SMichal Kazior
132018667600SToke Høiland-Jørgensen /* protects active_txqs and txqi->schedule_order */
1321942741daSFelix Fietkau spinlock_t active_txq_lock[IEEE80211_NUM_ACS];
1322942741daSFelix Fietkau struct list_head active_txqs[IEEE80211_NUM_ACS];
1323942741daSFelix Fietkau u16 schedule_round[IEEE80211_NUM_ACS];
1324942741daSFelix Fietkau
1325007ae9b2SAlexander Wetzel /* serializes ieee80211_handle_wake_tx_queue */
1326007ae9b2SAlexander Wetzel spinlock_t handle_wake_tx_queue_lock;
1327007ae9b2SAlexander Wetzel
1328b4809e94SToke Høiland-Jørgensen u16 airtime_flags;
1329942741daSFelix Fietkau u32 aql_txq_limit_low[IEEE80211_NUM_ACS];
1330942741daSFelix Fietkau u32 aql_txq_limit_high[IEEE80211_NUM_ACS];
13313ace10f5SKan Yan u32 aql_threshold;
13323ace10f5SKan Yan atomic_t aql_total_pending_airtime;
13338e4bac06SFelix Fietkau atomic_t aql_ac_pending_airtime[IEEE80211_NUM_ACS];
1334b4809e94SToke Høiland-Jørgensen
1335f0706e82SJiri Benc const struct ieee80211_ops *ops;
1336f0706e82SJiri Benc
133742935ecaSLuis R. Rodriguez /*
133842935ecaSLuis R. Rodriguez * private workqueue to mac80211. mac80211 makes this accessible
133942935ecaSLuis R. Rodriguez * via ieee80211_queue_work()
134042935ecaSLuis R. Rodriguez */
134142935ecaSLuis R. Rodriguez struct workqueue_struct *workqueue;
134242935ecaSLuis R. Rodriguez
1343e4e72fb4SJohannes Berg unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
1344cca07b00SLuciano Coelho int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS];
134596f5e66eSJohannes Berg /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
1346ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock;
134796f5e66eSJohannes Berg
1348f0706e82SJiri Benc int open_count;
13493d30d949SMichael Wu int monitors, cooked_mntrs;
13508cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */
13517be5086dSJohannes Berg int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
13527be5086dSJohannes Berg fif_probe_req;
13536cd536feSJohannes Berg bool probe_req_reg;
1354873b1cf6SJouni Malinen bool rx_mcast_action_reg;
13554150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */
13563b8d81e0SJohannes Berg
13573ffc2a90SJohannes Berg bool wiphy_ciphers_allocated;
13583ffc2a90SJohannes Berg
1359fe57d9f5SJohannes Berg bool use_chanctx;
1360fe57d9f5SJohannes Berg
13613b8d81e0SJohannes Berg /* protects the aggregated multicast list and filter calls */
13623b8d81e0SJohannes Berg spinlock_t filter_lock;
13633b8d81e0SJohannes Berg
13643ac64beeSJohannes Berg /* used for uploading changed mc list */
13653ac64beeSJohannes Berg struct work_struct reconfig_filter;
13663ac64beeSJohannes Berg
13673b8d81e0SJohannes Berg /* aggregated multicast list */
136822bedad3SJiri Pirko struct netdev_hw_addr_list mc_list;
13693b8d81e0SJohannes Berg
1370d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */
13715bb644a0SJohannes Berg
13725bb644a0SJohannes Berg /*
13735bb644a0SJohannes Berg * suspended is true if we finished all the suspend _and_ we have
13745bb644a0SJohannes Berg * not yet come up from resume. This is to be used by mac80211
13755bb644a0SJohannes Berg * to ensure driver sanity during suspend and mac80211's own
13765bb644a0SJohannes Berg * sanity. It can eventually be used for WoW as well.
13775bb644a0SJohannes Berg */
13785bb644a0SJohannes Berg bool suspended;
13795bb644a0SJohannes Berg
1380b33fb28cSLoic Poulain /* suspending is true during the whole suspend process */
1381b33fb28cSLoic Poulain bool suspending;
1382b33fb28cSLoic Poulain
13835bb644a0SJohannes Berg /*
1384ceb99fe0SJohannes Berg * Resuming is true while suspended, but when we're reprogramming the
1385ceb99fe0SJohannes Berg * hardware -- at that time it's allowed to use ieee80211_queue_work()
1386ceb99fe0SJohannes Berg * again even though some other parts of the stack are still suspended
1387ceb99fe0SJohannes Berg * and we still drop received frames to avoid waking the stack.
1388ceb99fe0SJohannes Berg */
1389ceb99fe0SJohannes Berg bool resuming;
1390ceb99fe0SJohannes Berg
1391ceb99fe0SJohannes Berg /*
13925bb644a0SJohannes Berg * quiescing is true during the suspend process _only_ to
13935bb644a0SJohannes Berg * ease timer cancelling etc.
13945bb644a0SJohannes Berg */
13955bb644a0SJohannes Berg bool quiescing;
13965bb644a0SJohannes Berg
1397ea77f12fSJohannes Berg /* device is started */
1398ea77f12fSJohannes Berg bool started;
1399ea77f12fSJohannes Berg
140004800adaSArik Nemtsov /* device is during a HW reconfig */
140104800adaSArik Nemtsov bool in_reconfig;
140204800adaSArik Nemtsov
1403c4fdb081SJohannes Berg /* reconfiguration failed ... suppress some warnings etc. */
1404c4fdb081SJohannes Berg bool reconfig_failure;
1405c4fdb081SJohannes Berg
1406eecc4800SJohannes Berg /* wowlan is enabled -- don't reconfig on resume */
1407eecc4800SJohannes Berg bool wowlan;
1408eecc4800SJohannes Berg
140974d64f0aSJohannes Berg struct wiphy_work radar_detected_work;
1410164eb02dSSimon Wunderlich
141104ecd257SJohannes Berg /* number of RX chains the hardware has */
141204ecd257SJohannes Berg u8 rx_chains;
141304ecd257SJohannes Berg
141409b4a4faSJohannes Berg /* bitmap of which sbands were copied */
141509b4a4faSJohannes Berg u8 sband_allocated;
141609b4a4faSJohannes Berg
1417b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */
1418f0706e82SJiri Benc
1419f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames
1420f0706e82SJiri Benc * added to skb_queue will be processed, but frames in
1421f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these
1422f0706e82SJiri Benc * queues increases over the limit. */
1423f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
1424f0706e82SJiri Benc struct tasklet_struct tasklet;
1425f0706e82SJiri Benc struct sk_buff_head skb_queue;
1426f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable;
1427f0706e82SJiri Benc
1428f9e124fbSChristian Lamparter spinlock_t rx_path_lock;
142924a8fdadSChristian Lamparter
1430d0709a65SJohannes Berg /* Station data */
1431d0709a65SJohannes Berg /*
14324d33960bSJohannes Berg * The mutex only protects the list, hash table and
14334d33960bSJohannes Berg * counter, reads are done with RCU.
1434d0709a65SJohannes Berg */
143534e89507SJohannes Berg struct mutex sta_mtx;
14364d33960bSJohannes Berg spinlock_t tim_lock;
1437d0709a65SJohannes Berg unsigned long num_sta;
14384d33960bSJohannes Berg struct list_head sta_list;
143983e7e4ceSHerbert Xu struct rhltable sta_hash;
1440ba6ddab9SJohannes Berg struct rhltable link_sta_hash;
1441f0706e82SJiri Benc struct timer_list sta_cleanup;
1442f5ea9120SJohannes Berg int sta_generation;
1443f0706e82SJiri Benc
14442a577d98SJohannes Berg struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
1445f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet;
144621a5d4c3SManikanta Pubbisetty struct tasklet_struct wake_txqs_tasklet;
1447f0706e82SJiri Benc
1448a6a67db2SJohannes Berg atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
1449cd8ffc80SJohannes Berg
1450df140465SJohannes Berg /* number of interfaces with allmulti RX */
1451df140465SJohannes Berg atomic_t iff_allmultis;
1452f0706e82SJiri Benc
1453f0706e82SJiri Benc struct rate_control_ref *rate_ctrl;
1454f0706e82SJiri Benc
14555fdb3735SArd Biesheuvel struct arc4_ctx wep_tx_ctx;
14565fdb3735SArd Biesheuvel struct arc4_ctx wep_rx_ctx;
1457f0706e82SJiri Benc u32 wep_iv;
1458f0706e82SJiri Benc
1459c771c9d8SJohannes Berg /* see iface.c */
146079010420SJohannes Berg struct list_head interfaces;
1461f64331d5SJohannes Berg struct list_head mon_list; /* only that are IFF_UP && !cooked */
1462c771c9d8SJohannes Berg struct mutex iflist_mtx;
146379010420SJohannes Berg
1464b16bd15cSJohannes Berg /*
1465ad0e2b5aSJohannes Berg * Key mutex, protects sdata's key_list and sta_info's
146696fc6efbSAlexander Wetzel * key pointers and ptk_idx (write access, they're RCU.)
1467b16bd15cSJohannes Berg */
1468ad0e2b5aSJohannes Berg struct mutex key_mtx;
1469b16bd15cSJohannes Berg
1470a1699b75SJohannes Berg /* mutex for scan and work locking */
1471a1699b75SJohannes Berg struct mutex mtx;
1472b16bd15cSJohannes Berg
1473c2b13452SJohannes Berg /* Scanning and BSS list */
1474fbe9c429SHelmut Schaa unsigned long scanning;
14752a519311SJohannes Berg struct cfg80211_ssid scan_ssid;
14765ba63533SJohannes Berg struct cfg80211_scan_request *int_scan_req;
14776ea0a69cSJohannes Berg struct cfg80211_scan_request __rcu *scan_req;
1478c56ef672SDavid Spinadel struct ieee80211_scan_request *hw_scan_req;
14797ca15a0aSSimon Wunderlich struct cfg80211_chan_def scan_chandef;
148057fbcce3SJohannes Berg enum nl80211_band hw_scan_band;
1481f0706e82SJiri Benc int scan_channel_idx;
1482de95a54bSJohannes Berg int scan_ies_len;
1483c604b9f2SJohannes Berg int hw_scan_ies_bufsize;
14847947d3e0SAvraham Stern struct cfg80211_scan_info scan_info;
14858318d78aSJohannes Berg
1486e114cad7SJohannes Berg struct wiphy_work sched_scan_stopped_work;
14875260a5b2SJohannes Berg struct ieee80211_sub_if_data __rcu *sched_scan_sdata;
14886ea0a69cSJohannes Berg struct cfg80211_sched_scan_request __rcu *sched_scan_req;
1489a344d677SJohannes Berg u8 scan_addr[ETH_ALEN];
149079f460caSLuciano Coelho
1491df13cce5SHelmut Schaa unsigned long leave_oper_channel_time;
1492977923b0SHelmut Schaa enum mac80211_scan_state next_scan_state;
1493d69c7a4eSJohannes Berg struct wiphy_delayed_work scan_work;
1494e2fd5dbcSJohannes Berg struct ieee80211_sub_if_data __rcu *scan_sdata;
149555de908aSJohannes Berg /* For backward compatibility only -- do not use */
1496675a0b04SKarl Beldan struct cfg80211_chan_def _oper_chandef;
1497f0706e82SJiri Benc
1498b8bc4b0aSJohannes Berg /* Temporary remain-on-channel for off-channel operations */
1499b8bc4b0aSJohannes Berg struct ieee80211_channel *tmp_channel;
1500b8bc4b0aSJohannes Berg
1501d01a1e65SMichal Kazior /* channel contexts */
1502d01a1e65SMichal Kazior struct list_head chanctx_list;
1503d01a1e65SMichal Kazior struct mutex chanctx_mtx;
1504d01a1e65SMichal Kazior
1505c206ca67SJohannes Berg #ifdef CONFIG_MAC80211_LEDS
15068d5c2585SJohannes Berg struct led_trigger tx_led, rx_led, assoc_led, radio_led;
15078d5c2585SJohannes Berg struct led_trigger tpt_led;
15088d5c2585SJohannes Berg atomic_t tx_led_active, rx_led_active, assoc_led_active;
15098d5c2585SJohannes Berg atomic_t radio_led_active, tpt_led_active;
1510c206ca67SJohannes Berg struct tpt_led_trigger *tpt_led_trigger;
1511c206ca67SJohannes Berg #endif
1512c206ca67SJohannes Berg
1513c206ca67SJohannes Berg #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
1514f0706e82SJiri Benc /* SNMP counters */
1515f0706e82SJiri Benc /* dot11CountersTable */
1516f0706e82SJiri Benc u32 dot11TransmittedFragmentCount;
1517f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount;
1518f0706e82SJiri Benc u32 dot11FailedCount;
1519f0706e82SJiri Benc u32 dot11RetryCount;
1520f0706e82SJiri Benc u32 dot11MultipleRetryCount;
1521f0706e82SJiri Benc u32 dot11FrameDuplicateCount;
1522f0706e82SJiri Benc u32 dot11ReceivedFragmentCount;
1523f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount;
1524f0706e82SJiri Benc u32 dot11TransmittedFrameCount;
1525f0706e82SJiri Benc
1526f0706e82SJiri Benc /* TX/RX handler statistics */
1527f0706e82SJiri Benc unsigned int tx_handlers_drop;
1528f0706e82SJiri Benc unsigned int tx_handlers_queued;
1529f0706e82SJiri Benc unsigned int tx_handlers_drop_wep;
1530f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc;
1531f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port;
1532f0706e82SJiri Benc unsigned int rx_handlers_drop;
1533f0706e82SJiri Benc unsigned int rx_handlers_queued;
1534f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc;
1535f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag;
1536f0706e82SJiri Benc unsigned int tx_expand_skb_head;
1537f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned;
1538f1160434SJohannes Berg unsigned int rx_expand_skb_head_defrag;
1539f0706e82SJiri Benc unsigned int rx_handlers_fragments;
1540f0706e82SJiri Benc unsigned int tx_status_drop;
1541f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++
1542f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
1543f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0)
1544f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
1545f0706e82SJiri Benc
1546f0706e82SJiri Benc
1547f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and
1548f0706e82SJiri Benc * multicast packets for power saving stations
1549f0706e82SJiri Benc */
1550520eb820SKalle Valo
1551572e0012SKalle Valo bool pspolling;
1552965bedadSJohannes Berg /*
1553965bedadSJohannes Berg * PS can only be enabled when we have exactly one managed
1554965bedadSJohannes Berg * interface (and monitors) in PS, this then points there.
1555965bedadSJohannes Berg */
1556965bedadSJohannes Berg struct ieee80211_sub_if_data *ps_sdata;
1557520eb820SKalle Valo struct work_struct dynamic_ps_enable_work;
1558520eb820SKalle Valo struct work_struct dynamic_ps_disable_work;
1559520eb820SKalle Valo struct timer_list dynamic_ps_timer;
15602b2c009eSJuuso Oikarinen struct notifier_block ifa_notifier;
1561a65240c1SJohannes Berg struct notifier_block ifa6_notifier;
1562f0706e82SJiri Benc
1563ff616381SJuuso Oikarinen /*
1564ff616381SJuuso Oikarinen * The dynamic ps timeout configured from user space via WEXT -
1565ff616381SJuuso Oikarinen * this will override whatever chosen by mac80211 internally.
1566ff616381SJuuso Oikarinen */
1567ff616381SJuuso Oikarinen int dynamic_ps_forced_timeout;
1568ff616381SJuuso Oikarinen
15691ea6f9c0SJohannes Berg int user_power_level; /* in dBm, for all interfaces */
15702bf30fabSJohannes Berg
15710f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode;
15720f78231bSJohannes Berg
1573f2753ddbSJohannes Berg struct work_struct restart_work;
1574f2753ddbSJohannes Berg
1575e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS
1576e9f207f0SJiri Benc struct local_debugfsdentries {
15774b7679a5SJohannes Berg struct dentry *rcdir;
1578e9f207f0SJiri Benc struct dentry *keys;
1579e9f207f0SJiri Benc } debugfs;
1580276d9e82SJulius Niedworok bool force_tx_status;
1581e9f207f0SJiri Benc #endif
15824e6cbfd0SJohn W. Linville
15832eb278e0SJohannes Berg /*
15842eb278e0SJohannes Berg * Remain-on-channel support
15852eb278e0SJohannes Berg */
158656dd205fSJohannes Berg struct wiphy_delayed_work roc_work;
15872eb278e0SJohannes Berg struct list_head roc_list;
158856dd205fSJohannes Berg struct wiphy_work hw_roc_start, hw_roc_done;
15892eb278e0SJohannes Berg unsigned long hw_roc_start_time;
159050febf6aSJohannes Berg u64 roc_cookie_counter;
159121f83589SJohannes Berg
1592a729cff8SJohannes Berg struct idr ack_status_frames;
1593a729cff8SJohannes Berg spinlock_t ack_status_lock;
1594a729cff8SJohannes Berg
1595f142c6b9SJohannes Berg struct ieee80211_sub_if_data __rcu *p2p_sdata;
1596f142c6b9SJohannes Berg
15974b6f1dd6SJohannes Berg /* virtual monitor interface */
15984b6f1dd6SJohannes Berg struct ieee80211_sub_if_data __rcu *monitor_sdata;
15994bf88530SJohannes Berg struct cfg80211_chan_def monitor_chandef;
1600e9a21949SLuciano Coelho
1601e9a21949SLuciano Coelho /* extended capabilities provided by mac80211 */
1602e9a21949SLuciano Coelho u8 ext_capa[8];
1603f0706e82SJiri Benc };
1604f0706e82SJiri Benc
16053e122be0SJohannes Berg static inline struct ieee80211_sub_if_data *
IEEE80211_DEV_TO_SUB_IF(const struct net_device * dev)1606d787a3e3SFelix Fietkau IEEE80211_DEV_TO_SUB_IF(const struct net_device *dev)
16073e122be0SJohannes Berg {
16083e122be0SJohannes Berg return netdev_priv(dev);
16093e122be0SJohannes Berg }
16103e122be0SJohannes Berg
161171bbc994SJohannes Berg static inline struct ieee80211_sub_if_data *
IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev * wdev)161271bbc994SJohannes Berg IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev)
161371bbc994SJohannes Berg {
161471bbc994SJohannes Berg return container_of(wdev, struct ieee80211_sub_if_data, wdev);
161571bbc994SJohannes Berg }
161671bbc994SJohannes Berg
161721a8e9ddSMohammed Shafi Shajakhan static inline struct ieee80211_supported_band *
ieee80211_get_sband(struct ieee80211_sub_if_data * sdata)161821a8e9ddSMohammed Shafi Shajakhan ieee80211_get_sband(struct ieee80211_sub_if_data *sdata)
161921a8e9ddSMohammed Shafi Shajakhan {
162021a8e9ddSMohammed Shafi Shajakhan struct ieee80211_local *local = sdata->local;
162121a8e9ddSMohammed Shafi Shajakhan struct ieee80211_chanctx_conf *chanctx_conf;
162221a8e9ddSMohammed Shafi Shajakhan enum nl80211_band band;
162321a8e9ddSMohammed Shafi Shajakhan
1624f1871abdSIlan Peer WARN_ON(ieee80211_vif_is_mld(&sdata->vif));
16251dd0f31cSJohannes Berg
162621a8e9ddSMohammed Shafi Shajakhan rcu_read_lock();
1627d0a9123eSJohannes Berg chanctx_conf = rcu_dereference(sdata->vif.bss_conf.chanctx_conf);
162821a8e9ddSMohammed Shafi Shajakhan
16290ee4d555SJohannes Berg if (!chanctx_conf) {
163021a8e9ddSMohammed Shafi Shajakhan rcu_read_unlock();
163121a8e9ddSMohammed Shafi Shajakhan return NULL;
163221a8e9ddSMohammed Shafi Shajakhan }
163321a8e9ddSMohammed Shafi Shajakhan
163421a8e9ddSMohammed Shafi Shajakhan band = chanctx_conf->def.chan->band;
163521a8e9ddSMohammed Shafi Shajakhan rcu_read_unlock();
163621a8e9ddSMohammed Shafi Shajakhan
163721a8e9ddSMohammed Shafi Shajakhan return local->hw.wiphy->bands[band];
163821a8e9ddSMohammed Shafi Shajakhan }
163921a8e9ddSMohammed Shafi Shajakhan
1640f91cb507SShaul Triebitz static inline struct ieee80211_supported_band *
ieee80211_get_link_sband(struct ieee80211_link_data * link)1641d8675a63SJohannes Berg ieee80211_get_link_sband(struct ieee80211_link_data *link)
1642f91cb507SShaul Triebitz {
1643d8675a63SJohannes Berg struct ieee80211_local *local = link->sdata->local;
1644f91cb507SShaul Triebitz struct ieee80211_chanctx_conf *chanctx_conf;
1645f91cb507SShaul Triebitz enum nl80211_band band;
1646f91cb507SShaul Triebitz
1647f91cb507SShaul Triebitz rcu_read_lock();
1648d8675a63SJohannes Berg chanctx_conf = rcu_dereference(link->conf->chanctx_conf);
1649f91cb507SShaul Triebitz if (!chanctx_conf) {
1650f91cb507SShaul Triebitz rcu_read_unlock();
1651f91cb507SShaul Triebitz return NULL;
1652f91cb507SShaul Triebitz }
1653f91cb507SShaul Triebitz
1654f91cb507SShaul Triebitz band = chanctx_conf->def.chan->band;
1655f91cb507SShaul Triebitz rcu_read_unlock();
1656f91cb507SShaul Triebitz
1657f91cb507SShaul Triebitz return local->hw.wiphy->bands[band];
1658f91cb507SShaul Triebitz }
1659f91cb507SShaul Triebitz
1660c0f17eb9SChun-Yeow Yeoh /* this struct holds the value parsing from channel switch IE */
1661c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie {
1662c0f17eb9SChun-Yeow Yeoh struct cfg80211_chan_def chandef;
1663c0f17eb9SChun-Yeow Yeoh u8 mode;
1664c0f17eb9SChun-Yeow Yeoh u8 count;
1665c0f17eb9SChun-Yeow Yeoh u8 ttl;
16663f718fd8SChun-Yeow Yeoh u16 pre_value;
16675d55371bSBenjamin Berg u16 reason_code;
1668ee145775SSara Sharon u32 max_switch_time;
1669c0f17eb9SChun-Yeow Yeoh };
1670c0f17eb9SChun-Yeow Yeoh
1671dd76986bSJohannes Berg /* Parsed Information Elements */
1672dd76986bSJohannes Berg struct ieee802_11_elems {
16734a3cb702SJohannes Berg const u8 *ie_start;
1674dd76986bSJohannes Berg size_t total_len;
1675c6e37ed4SJohannes Berg u32 crc;
1676dd76986bSJohannes Berg
1677dd76986bSJohannes Berg /* pointers to IEs */
167853837584SArik Nemtsov const struct ieee80211_tdls_lnkie *lnk_id;
167953837584SArik Nemtsov const struct ieee80211_ch_switch_timing *ch_sw_timing;
16809041c1faSArik Nemtsov const u8 *ext_capab;
16814a3cb702SJohannes Berg const u8 *ssid;
16824a3cb702SJohannes Berg const u8 *supp_rates;
16834a3cb702SJohannes Berg const u8 *ds_params;
16844a3cb702SJohannes Berg const struct ieee80211_tim_ie *tim;
16854a3cb702SJohannes Berg const u8 *rsn;
1686c0058df7SShaul Triebitz const u8 *rsnx;
16874a3cb702SJohannes Berg const u8 *erp_info;
16884a3cb702SJohannes Berg const u8 *ext_supp_rates;
16894a3cb702SJohannes Berg const u8 *wmm_info;
16904a3cb702SJohannes Berg const u8 *wmm_param;
16914a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_elem;
16924a3cb702SJohannes Berg const struct ieee80211_ht_operation *ht_operation;
16934a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_elem;
16944a3cb702SJohannes Berg const struct ieee80211_vht_operation *vht_operation;
16954a3cb702SJohannes Berg const struct ieee80211_meshconf_ie *mesh_config;
169641cbb0f5SLuca Coelho const u8 *he_cap;
169741cbb0f5SLuca Coelho const struct ieee80211_he_operation *he_operation;
1698ef11a931SJohn Crispin const struct ieee80211_he_spr *he_spr;
169941cbb0f5SLuca Coelho const struct ieee80211_mu_edca_param_set *mu_edca_param_set;
1700a6cf28e0SRajkumar Manoharan const struct ieee80211_he_6ghz_capa *he_6ghz_capa;
1701b0345850SWen Gong const struct ieee80211_tx_pwr_env *tx_pwr_env[IEEE80211_TPE_MAX_IE_COUNT];
170241cbb0f5SLuca Coelho const u8 *uora_element;
17034a3cb702SJohannes Berg const u8 *mesh_id;
17044a3cb702SJohannes Berg const u8 *peering;
17054a3cb702SJohannes Berg const __le16 *awake_window;
17064a3cb702SJohannes Berg const u8 *preq;
17074a3cb702SJohannes Berg const u8 *prep;
17084a3cb702SJohannes Berg const u8 *perr;
17094a3cb702SJohannes Berg const struct ieee80211_rann_ie *rann;
17104a3cb702SJohannes Berg const struct ieee80211_channel_sw_ie *ch_switch_ie;
1711b4f286a1SJohannes Berg const struct ieee80211_ext_chansw_ie *ext_chansw_ie;
1712b2e506bfSJohannes Berg const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
1713ee145775SSara Sharon const u8 *max_channel_switch_time;
17144a3cb702SJohannes Berg const u8 *country_elem;
17154a3cb702SJohannes Berg const u8 *pwr_constr_elem;
1716c8d65917SSteinar H. Gunderson const u8 *cisco_dtpc_elem;
171779ba1d89SJohannes Berg const struct ieee80211_timeout_interval_ie *timeout_int;
17184a3cb702SJohannes Berg const u8 *opmode_notif;
171985220d71SJohannes Berg const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
1720c4de37eeSPeter Oh struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie;
1721e38a017bSAvraham Stern const struct ieee80211_bss_max_idle_period_ie *max_idle_period_ie;
172278ac51f8SSara Sharon const struct ieee80211_multiple_bssid_configuration *mbssid_config_ie;
172378ac51f8SSara Sharon const struct ieee80211_bssid_index *bssid_index;
172478ac51f8SSara Sharon u8 max_bssid_indicator;
172578ac51f8SSara Sharon u8 dtim_count;
172678ac51f8SSara Sharon u8 dtim_period;
17272aa485e1SJohn Crispin const struct ieee80211_addba_ext_ie *addba_ext_ie;
1728cd418ba6SThomas Pedersen const struct ieee80211_s1g_cap *s1g_capab;
1729cd418ba6SThomas Pedersen const struct ieee80211_s1g_oper_ie *s1g_oper;
1730cd418ba6SThomas Pedersen const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat;
17311d00ce80SThomas Pedersen const struct ieee80211_aid_response_ie *aid_resp;
1732f0e6bea8SIlan Peer const struct ieee80211_eht_cap_elem *eht_cap;
1733f0e6bea8SIlan Peer const struct ieee80211_eht_operation *eht_operation;
1734a286de1aSIlan Peer const struct ieee80211_multi_link_elem *ml_basic;
1735cf36cdefSIlan Peer const struct ieee80211_multi_link_elem *ml_reconf;
1736dd76986bSJohannes Berg
1737dd76986bSJohannes Berg /* length of them, respectively */
17389041c1faSArik Nemtsov u8 ext_capab_len;
1739dd76986bSJohannes Berg u8 ssid_len;
1740dd76986bSJohannes Berg u8 supp_rates_len;
1741dd76986bSJohannes Berg u8 tim_len;
1742dd76986bSJohannes Berg u8 rsn_len;
1743c0058df7SShaul Triebitz u8 rsnx_len;
1744dd76986bSJohannes Berg u8 ext_supp_rates_len;
1745dd76986bSJohannes Berg u8 wmm_info_len;
1746dd76986bSJohannes Berg u8 wmm_param_len;
174741cbb0f5SLuca Coelho u8 he_cap_len;
1748dd76986bSJohannes Berg u8 mesh_id_len;
1749dd76986bSJohannes Berg u8 peering_len;
1750dd76986bSJohannes Berg u8 preq_len;
1751dd76986bSJohannes Berg u8 prep_len;
1752dd76986bSJohannes Berg u8 perr_len;
1753dd76986bSJohannes Berg u8 country_elem_len;
175478ac51f8SSara Sharon u8 bssid_index_len;
1755b0345850SWen Gong u8 tx_pwr_env_len[IEEE80211_TPE_MAX_IE_COUNT];
1756b0345850SWen Gong u8 tx_pwr_env_num;
1757f0e6bea8SIlan Peer u8 eht_cap_len;
1758fcff4f10SPaul Stewart
175945ebac4fSIlan Peer /* mult-link element can be de-fragmented and thus u8 is not sufficient */
1760a286de1aSIlan Peer size_t ml_basic_len;
1761cf36cdefSIlan Peer size_t ml_reconf_len;
1762a286de1aSIlan Peer
1763a286de1aSIlan Peer /* The basic Multi-Link element in the original IEs */
1764a286de1aSIlan Peer const struct element *ml_basic_elem;
176545ebac4fSIlan Peer
1766cf36cdefSIlan Peer /* The reconfiguration Multi-Link element in the original IEs */
1767cf36cdefSIlan Peer const struct element *ml_reconf_elem;
1768cf36cdefSIlan Peer
176945ebac4fSIlan Peer /*
177045ebac4fSIlan Peer * store the per station profile pointer and length in case that the
177145ebac4fSIlan Peer * parsing also handled Multi-Link element parsing for a specific link
177245ebac4fSIlan Peer * ID.
177345ebac4fSIlan Peer */
177445ebac4fSIlan Peer struct ieee80211_mle_per_sta_profile *prof;
177545ebac4fSIlan Peer size_t sta_prof_len;
177645ebac4fSIlan Peer
1777fcff4f10SPaul Stewart /* whether a parse error occurred while retrieving these elements */
1778fcff4f10SPaul Stewart bool parse_error;
177945ebac4fSIlan Peer
178045ebac4fSIlan Peer /*
178145ebac4fSIlan Peer * scratch buffer that can be used for various element parsing related
178245ebac4fSIlan Peer * tasks, e.g., element de-fragmentation etc.
178345ebac4fSIlan Peer */
178445ebac4fSIlan Peer size_t scratch_len;
178545ebac4fSIlan Peer u8 *scratch_pos;
178645ebac4fSIlan Peer u8 scratch[];
1787dd76986bSJohannes Berg };
1788dd76986bSJohannes Berg
hw_to_local(struct ieee80211_hw * hw)1789f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local(
1790f0706e82SJiri Benc struct ieee80211_hw *hw)
1791f0706e82SJiri Benc {
1792f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw);
1793f0706e82SJiri Benc }
1794f0706e82SJiri Benc
to_txq_info(struct ieee80211_txq * txq)1795ba8c3d6fSFelix Fietkau static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
1796ba8c3d6fSFelix Fietkau {
1797ba8c3d6fSFelix Fietkau return container_of(txq, struct txq_info, txq);
1798ba8c3d6fSFelix Fietkau }
1799f0706e82SJiri Benc
txq_has_queue(struct ieee80211_txq * txq)1800bb42f2d1SToke Høiland-Jørgensen static inline bool txq_has_queue(struct ieee80211_txq *txq)
1801bb42f2d1SToke Høiland-Jørgensen {
1802bb42f2d1SToke Høiland-Jørgensen struct txq_info *txqi = to_txq_info(txq);
1803bb42f2d1SToke Høiland-Jørgensen
1804bb42f2d1SToke Høiland-Jørgensen return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets);
1805bb42f2d1SToke Høiland-Jørgensen }
1806bb42f2d1SToke Høiland-Jørgensen
1807f4bda337SThomas Pedersen static inline bool
ieee80211_have_rx_timestamp(struct ieee80211_rx_status * status)1808f4bda337SThomas Pedersen ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status)
1809f4bda337SThomas Pedersen {
1810f4bda337SThomas Pedersen WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START &&
1811f4bda337SThomas Pedersen status->flag & RX_FLAG_MACTIME_END);
1812da388233SAvraham Stern return !!(status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END |
1813da388233SAvraham Stern RX_FLAG_MACTIME_PLCP_START));
1814f4bda337SThomas Pedersen }
1815571ecf67SJohannes Berg
181672f15d53SMichael Braun void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata);
181772f15d53SMichael Braun void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata);
181872f15d53SMichael Braun
181972f15d53SMichael Braun /* This function returns the number of multicast stations connected to this
182072f15d53SMichael Braun * interface. It returns -1 if that number is not tracked, that is for netdevs
182172f15d53SMichael Braun * not in AP or AP_VLAN mode or when using 4addr.
182272f15d53SMichael Braun */
182372f15d53SMichael Braun static inline int
ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data * sdata)182472f15d53SMichael Braun ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata)
182572f15d53SMichael Braun {
182672f15d53SMichael Braun if (sdata->vif.type == NL80211_IFTYPE_AP)
182772f15d53SMichael Braun return atomic_read(&sdata->u.ap.num_mcast_sta);
182872f15d53SMichael Braun if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
182972f15d53SMichael Braun return atomic_read(&sdata->u.vlan.num_mcast_sta);
183072f15d53SMichael Braun return -1;
183172f15d53SMichael Braun }
183272f15d53SMichael Braun
1833f4bda337SThomas Pedersen u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
1834f4bda337SThomas Pedersen struct ieee80211_rx_status *status,
1835f4bda337SThomas Pedersen unsigned int mpdu_len,
1836f4bda337SThomas Pedersen unsigned int mpdu_offset);
1837e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
18385cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
18399c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
18407b7090b4SJohannes Berg u64 changed);
18417b7090b4SJohannes Berg void ieee80211_vif_cfg_change_notify(struct ieee80211_sub_if_data *sdata,
18427b7090b4SJohannes Berg u64 changed);
18437b7090b4SJohannes Berg void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata,
1844d8675a63SJohannes Berg struct ieee80211_link_data *link,
1845d8675a63SJohannes Berg u64 changed);
18460d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local);
184715ddba5fSAnjaneyulu u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
1848f0706e82SJiri Benc
184992df1422SJohannes Berg void ieee80211_handle_queued_frames(struct ieee80211_local *local);
185092df1422SJohannes Berg
1851a2fcfccbSJohannes Berg u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local);
18525ee00dbdSJohannes Berg int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
18535ee00dbdSJohannes Berg u64 *cookie, gfp_t gfp);
1854a2fcfccbSJohannes Berg
185549ddf8e6SJohannes Berg void ieee80211_check_fast_rx(struct sta_info *sta);
185649ddf8e6SJohannes Berg void __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
185749ddf8e6SJohannes Berg void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
185849ddf8e6SJohannes Berg void ieee80211_clear_fast_rx(struct sta_info *sta);
185949ddf8e6SJohannes Berg
18600d5891e3SAndrei Otcheretianski bool ieee80211_is_our_addr(struct ieee80211_sub_if_data *sdata,
18610d5891e3SAndrei Otcheretianski const u8 *addr, int *out_link_id);
18620d5891e3SAndrei Otcheretianski
186346900298SJohannes Berg /* STA code */
18649c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
186577fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
186677fdaa12SJohannes Berg struct cfg80211_auth_request *req);
186777fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
186877fdaa12SJohannes Berg struct cfg80211_assoc_request *req);
186977fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
187063c9c5e7SJohannes Berg struct cfg80211_deauth_request *req);
187177fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
187263c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req);
1873572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local,
1874572e0012SKalle Valo struct ieee80211_sub_if_data *sdata);
18754a733ef1SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local);
1876ab095877SEliad Peller void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
18771fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
18781fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
18791fa57d01SJohannes Berg struct sk_buff *skb);
188009a740ceSThomas Pedersen void ieee80211_sta_rx_queued_ext(struct ieee80211_sub_if_data *sdata,
188109a740ceSThomas Pedersen struct sk_buff *skb);
1882d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
1883be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
1884afa762f6SEliad Peller void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata);
18851672c0e3SJohannes Berg void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata,
18861672c0e3SJohannes Berg __le16 fc, bool acked);
18871a1cb744SJohannes Berg void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata);
1888b8360ab8SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
188902219b3aSJohannes Berg void ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data *sdata);
18907dd231ebSNaftali Goldstein void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,
189153da4c45SJohannes Berg u8 reason, bool tx);
1892b2e8434fSJohannes Berg void ieee80211_mgd_setup_link(struct ieee80211_link_data *link);
1893b2e8434fSJohannes Berg void ieee80211_mgd_stop_link(struct ieee80211_link_data *link);
18947e415d0cSJohannes Berg void ieee80211_mgd_set_link_qos_params(struct ieee80211_link_data *link);
18959c6bd790SJohannes Berg
189646900298SJohannes Berg /* IBSS code */
189746900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
189846900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
18998bf11d8dSJohannes Berg void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
19008bf11d8dSJohannes Berg const u8 *bssid, const u8 *addr, u32 supp_rates);
1901af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
1902af8cdcd8SJohannes Berg struct cfg80211_ibss_params *params);
1903af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
19041fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
19051fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
19061fa57d01SJohannes Berg struct sk_buff *skb);
1907cd7760e6SSimon Wunderlich int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
190815ddba5fSAnjaneyulu struct cfg80211_csa_settings *csa_settings,
190915ddba5fSAnjaneyulu u64 *changed);
191015ddba5fSAnjaneyulu int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata,
191115ddba5fSAnjaneyulu u64 *changed);
1912cd7760e6SSimon Wunderlich void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata);
19131fa57d01SJohannes Berg
1914239281f8SRostislav Lisovy /* OCB code */
1915239281f8SRostislav Lisovy void ieee80211_ocb_work(struct ieee80211_sub_if_data *sdata);
1916239281f8SRostislav Lisovy void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata,
1917239281f8SRostislav Lisovy const u8 *bssid, const u8 *addr, u32 supp_rates);
1918239281f8SRostislav Lisovy void ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data *sdata);
1919239281f8SRostislav Lisovy int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
1920239281f8SRostislav Lisovy struct ocb_setup *setup);
1921239281f8SRostislav Lisovy int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata);
1922239281f8SRostislav Lisovy
19231fa57d01SJohannes Berg /* mesh code */
19241fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
19251fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
19261fa57d01SJohannes Berg struct sk_buff *skb);
1927b8456a14SChun-Yeow Yeoh int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
192815ddba5fSAnjaneyulu struct cfg80211_csa_settings *csa_settings,
192915ddba5fSAnjaneyulu u64 *changed);
193015ddba5fSAnjaneyulu int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata,
193115ddba5fSAnjaneyulu u64 *changed);
193246900298SJohannes Berg
19339c6bd790SJohannes Berg /* scan/BSS handling */
1934d69c7a4eSJohannes Berg void ieee80211_scan_work(struct wiphy *wiphy, struct wiphy_work *work);
193534bcf715SStanislaw Gruszka int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
1936be4a4b6aSJohannes Berg const u8 *ssid, u8 ssid_len,
193776bed0f4SJanusz.Dziedzic@tieto.com struct ieee80211_channel **channels,
193876bed0f4SJanusz.Dziedzic@tieto.com unsigned int n_channels,
19397ca15a0aSSimon Wunderlich enum nl80211_bss_scan_width scan_width);
1940c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
19412a519311SJohannes Berg struct cfg80211_scan_request *req);
19425bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local);
1943133d40f9SStanislaw Gruszka void ieee80211_run_deferred_scan(struct ieee80211_local *local);
1944d48b2968SJohannes Berg void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb);
19459c6bd790SJohannes Berg
1946108d2022SBenjamin Berg void ieee80211_inform_bss(struct wiphy *wiphy, struct cfg80211_bss *bss,
1947108d2022SBenjamin Berg const struct cfg80211_bss_ies *ies, void *data);
1948108d2022SBenjamin Berg
19490a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
1950c2b13452SJohannes Berg struct ieee80211_bss *
195198c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local,
195298c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status,
195398c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt,
195498c8fccfSJohannes Berg size_t len,
1955d45c4172SEmmanuel Grumbach struct ieee80211_channel *channel);
195698c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local,
1957c2b13452SJohannes Berg struct ieee80211_bss *bss);
1958ee385855SLuis Carlos Cobo
195979f460caSLuciano Coelho /* scheduled scan handling */
1960d43c6b6eSDavid Spinadel int
1961d43c6b6eSDavid Spinadel __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
1962d43c6b6eSDavid Spinadel struct cfg80211_sched_scan_request *req);
196379f460caSLuciano Coelho int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
196479f460caSLuciano Coelho struct cfg80211_sched_scan_request *req);
19650d440ea2SEliad Peller int ieee80211_request_sched_scan_stop(struct ieee80211_local *local);
1966f6837ba8SJohannes Berg void ieee80211_sched_scan_end(struct ieee80211_local *local);
1967e114cad7SJohannes Berg void ieee80211_sched_scan_stopped_work(struct wiphy *wiphy,
1968e114cad7SJohannes Berg struct wiphy_work *work);
196979f460caSLuciano Coelho
1970a2fcfccbSJohannes Berg /* off-channel/mgmt-tx */
1971aacde9eeSStanislaw Gruszka void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
1972aacde9eeSStanislaw Gruszka void ieee80211_offchannel_return(struct ieee80211_local *local);
19732eb278e0SJohannes Berg void ieee80211_roc_setup(struct ieee80211_local *local);
19742eb278e0SJohannes Berg void ieee80211_start_next_roc(struct ieee80211_local *local);
1975c8f994eeSJohannes Berg void ieee80211_roc_purge(struct ieee80211_local *local,
1976c8f994eeSJohannes Berg struct ieee80211_sub_if_data *sdata);
1977a2fcfccbSJohannes Berg int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
1978a2fcfccbSJohannes Berg struct ieee80211_channel *chan,
1979a2fcfccbSJohannes Berg unsigned int duration, u64 *cookie);
1980a2fcfccbSJohannes Berg int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
1981a2fcfccbSJohannes Berg struct wireless_dev *wdev, u64 cookie);
1982a2fcfccbSJohannes Berg int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
1983a2fcfccbSJohannes Berg struct cfg80211_mgmt_tx_params *params, u64 *cookie);
1984a2fcfccbSJohannes Berg int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
1985a2fcfccbSJohannes Berg struct wireless_dev *wdev, u64 cookie);
1986b203ffc3SJouni Malinen
198773da7d5bSSimon Wunderlich /* channel switch handling */
198873da7d5bSSimon Wunderlich void ieee80211_csa_finalize_work(struct work_struct *work);
198982a8e17dSLuciano Coelho int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
199082a8e17dSLuciano Coelho struct cfg80211_csa_settings *params);
199173da7d5bSSimon Wunderlich
19925f9404abSJohn Crispin /* color change handling */
19935f9404abSJohn Crispin void ieee80211_color_change_finalize_work(struct work_struct *work);
199492881884SLorenzo Bianconi void ieee80211_color_collision_detection_work(struct work_struct *work);
19955f9404abSJohn Crispin
19963e122be0SJohannes Berg /* interface handling */
199707b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
199807b83d2eSJohannes Berg NETIF_F_HW_CSUM | NETIF_F_SG | \
199961587f15SFelix Fietkau NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE | \
200061587f15SFelix Fietkau NETIF_F_HW_TC)
200107b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM)
200207b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \
200307b83d2eSJohannes Berg MAC80211_SUPPORTED_FEATURES_RX)
200407b83d2eSJohannes Berg
200547846c9bSJohannes Berg int ieee80211_iface_init(void);
200647846c9bSJohannes Berg void ieee80211_iface_exit(void);
20073e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name,
20086bab2e19STom Gundersen unsigned char name_assign_type,
200984efbb84SJohannes Berg struct wireless_dev **new_wdev, enum nl80211_iftype type,
2010ee385855SLuis Carlos Cobo struct vif_params *params);
2011f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
201205c914feSJohannes Berg enum nl80211_iftype type);
2013f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
201475636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local);
2015382a103bSJohannes Berg u32 ieee80211_idle_off(struct ieee80211_local *local);
20165cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local);
201785416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
201885416a4fSChristian Lamparter const int offset);
2019f142c6b9SJohannes Berg int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up);
2020f142c6b9SJohannes Berg void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata);
20213c3e21e7SJohannes Berg int ieee80211_add_virtual_monitor(struct ieee80211_local *local);
20223c3e21e7SJohannes Berg void ieee80211_del_virtual_monitor(struct ieee80211_local *local);
2023f0706e82SJiri Benc
20241ea6f9c0SJohannes Berg bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
2025db82d8a9SLorenzo Bianconi void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata,
2026db82d8a9SLorenzo Bianconi bool update_bss);
20276aea26ceSFelix Fietkau void ieee80211_recalc_offload(struct ieee80211_local *local);
20281ea6f9c0SJohannes Berg
ieee80211_sdata_running(struct ieee80211_sub_if_data * sdata)20299607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
20309607e6b6SJohannes Berg {
203134d4bc4dSJohannes Berg return test_bit(SDATA_STATE_RUNNING, &sdata->state);
20329607e6b6SJohannes Berg }
20339607e6b6SJohannes Berg
2034e73b5e51SJohannes Berg /* link handling */
2035e73b5e51SJohannes Berg void ieee80211_link_setup(struct ieee80211_link_data *link);
2036e73b5e51SJohannes Berg void ieee80211_link_init(struct ieee80211_sub_if_data *sdata,
2037e73b5e51SJohannes Berg int link_id,
2038e73b5e51SJohannes Berg struct ieee80211_link_data *link,
2039e73b5e51SJohannes Berg struct ieee80211_bss_conf *link_conf);
2040e73b5e51SJohannes Berg void ieee80211_link_stop(struct ieee80211_link_data *link);
2041e73b5e51SJohannes Berg int ieee80211_vif_set_links(struct ieee80211_sub_if_data *sdata,
20426d543b34SIlan Peer u16 new_links, u16 dormant_links);
2043e73b5e51SJohannes Berg void ieee80211_vif_clear_links(struct ieee80211_sub_if_data *sdata);
204479973d5cSBenjamin Berg int __ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links);
2045e73b5e51SJohannes Berg
2046e2ebc74dSJohannes Berg /* tx handling */
2047e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local);
2048da1cad73SAllen Pais void ieee80211_tx_pending(struct tasklet_struct *t);
2049d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
2050d0cf9c0dSStephen Hemminger struct net_device *dev);
2051d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
2052d0cf9c0dSStephen Hemminger struct net_device *dev);
205350ff477aSJohn Crispin netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb,
205450ff477aSJohn Crispin struct net_device *dev);
205524d342c5SLiad Kaufman void __ieee80211_subif_start_xmit(struct sk_buff *skb,
205624d342c5SLiad Kaufman struct net_device *dev,
205706016772SRajkumar Manoharan u32 info_flags,
2058a7528198SMarkus Theil u32 ctrl_flags,
2059a7528198SMarkus Theil u64 *cookie);
20607528ec57SJohannes Berg struct sk_buff *
20617528ec57SJohannes Berg ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
20627528ec57SJohannes Berg struct sk_buff *skb, u32 info_flags);
20634dc792b8SHelmut Schaa void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
2064b7b2e8caSJohn Crispin int retry_count, int shift, bool send_to_cooked,
2065b7b2e8caSJohn Crispin struct ieee80211_tx_status *status);
2066e2ebc74dSJohannes Berg
206717c18bf8SJohannes Berg void ieee80211_check_fast_xmit(struct sta_info *sta);
206817c18bf8SJohannes Berg void ieee80211_check_fast_xmit_all(struct ieee80211_local *local);
206917c18bf8SJohannes Berg void ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata);
207017c18bf8SJohannes Berg void ieee80211_clear_fast_xmit(struct sta_info *sta);
207191180649SDenis Kenzior int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev,
207291180649SDenis Kenzior const u8 *buf, size_t len,
2073dca9ca2dSMarkus Theil const u8 *dest, __be16 proto, bool unencrypted,
207467207babSAndrei Otcheretianski int link_id, u64 *cookie);
20758828f81aSRajkumar Manoharan int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev,
20768828f81aSRajkumar Manoharan const u8 *buf, size_t len);
2077d5edb9aeSFelix Fietkau void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
2078d5edb9aeSFelix Fietkau struct sta_info *sta,
2079d5edb9aeSFelix Fietkau struct ieee80211_fast_tx *fast_tx,
2080d5edb9aeSFelix Fietkau struct sk_buff *skb, bool ampdu,
2081d5edb9aeSFelix Fietkau const u8 *da, const u8 *sa);
20828b0f5cb6SFelix Fietkau void ieee80211_aggr_check(struct ieee80211_sub_if_data *sdata,
20838b0f5cb6SFelix Fietkau struct sta_info *sta, struct sk_buff *skb);
208417c18bf8SJohannes Berg
2085de1ede7aSJohannes Berg /* HT */
2086ef96a842SBen Greear void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
2087ef96a842SBen Greear struct ieee80211_sta_ht_cap *ht_cap);
2088e1a0c6b3SJohannes Berg bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
2089ef96a842SBen Greear struct ieee80211_supported_band *sband,
20904a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_ie,
2091c71420dbSJohannes Berg struct link_sta_info *link_sta);
2092b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
2093b8695a8fSJohannes Berg const u8 *da, u16 tid,
2094b8695a8fSJohannes Berg u16 initiator, u16 reason_code);
20950f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
20960f78231bSJohannes Berg enum ieee80211_smps_mode smps, const u8 *da,
20970f78231bSJohannes Berg const u8 *bssid);
2098687da132SEmmanuel Grumbach bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old,
2099687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode_new);
2100de1ede7aSJohannes Berg
21017c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
210253f73c09SJohannes Berg u16 initiator, u16 reason, bool stop);
2103849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
210453f73c09SJohannes Berg u16 initiator, u16 reason, bool stop);
2105bde59c47SJohannes Berg void ___ieee80211_start_rx_ba_session(struct sta_info *sta,
2106bde59c47SJohannes Berg u8 dialog_token, u16 timeout,
2107bde59c47SJohannes Berg u16 start_seq_num, u16 ba_policy, u16 tid,
21082ab45876SJohn Crispin u16 buf_size, bool tx, bool auto_seq,
21092ab45876SJohn Crispin const struct ieee80211_addba_ext_ie *addbaext);
2110c82c4a80SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
2111c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason);
2112de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
2113de1ede7aSJohannes Berg struct sta_info *sta,
2114de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len);
2115de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local,
2116de1ede7aSJohannes Berg struct sta_info *sta,
2117de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt,
2118de1ede7aSJohannes Berg size_t len);
2119de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local,
2120de1ede7aSJohannes Berg struct sta_info *sta,
2121de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt,
2122de1ede7aSJohannes Berg size_t len);
2123de1ede7aSJohannes Berg
2124849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
2125c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason);
212667c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
2127c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason);
21287a7c0a64SJohannes Berg void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid,
21297a7c0a64SJohannes Berg struct tid_ampdu_tx *tid_tx);
21307a7c0a64SJohannes Berg void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid,
21317a7c0a64SJohannes Berg struct tid_ampdu_tx *tid_tx);
213267c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work);
213367c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
21342bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
2135849b7967SJohannes Berg
213604ecd257SJohannes Berg u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs);
213757566b20Stamizhr@codeaurora.org enum nl80211_smps_mode
213857566b20Stamizhr@codeaurora.org ieee80211_smps_mode_to_smps_mode(enum ieee80211_smps_mode smps);
213904ecd257SJohannes Berg
2140818255eaSMahesh Palivela /* VHT */
21414a3cb702SJohannes Berg void
21424a3cb702SJohannes Berg ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
2143818255eaSMahesh Palivela struct ieee80211_supported_band *sband,
21444a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_ie,
2145084cf2aeSJohannes Berg const struct ieee80211_vht_cap *vht_cap_ie2,
2146c71420dbSJohannes Berg struct link_sta_info *link_sta);
2147c71420dbSJohannes Berg enum ieee80211_sta_rx_bandwidth
2148c71420dbSJohannes Berg ieee80211_sta_cap_rx_bw(struct link_sta_info *link_sta);
2149c71420dbSJohannes Berg enum ieee80211_sta_rx_bandwidth
2150c71420dbSJohannes Berg ieee80211_sta_cur_vht_bw(struct link_sta_info *link_sta);
2151*86e7bdc5SJohannes Berg void ieee80211_sta_init_nss(struct link_sta_info *link_sta);
215259021c67SArik Nemtsov enum ieee80211_sta_rx_bandwidth
215359021c67SArik Nemtsov ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width);
2154c71420dbSJohannes Berg enum nl80211_chan_width
2155c71420dbSJohannes Berg ieee80211_sta_cap_chan_bw(struct link_sta_info *link_sta);
215623a1f8d4SSara Sharon void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
2157d8675a63SJohannes Berg struct ieee80211_link_data *link,
215823a1f8d4SSara Sharon struct ieee80211_mgmt *mgmt);
2159b1bce14aSMarek Kwaczynski u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
2160c71420dbSJohannes Berg struct link_sta_info *sta,
2161afe0d181SJohannes Berg u8 opmode, enum nl80211_band band);
21620af83d3dSJohannes Berg void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
2163c71420dbSJohannes Berg struct link_sta_info *sta,
2164afe0d181SJohannes Berg u8 opmode, enum nl80211_band band);
2165dd5ecfeaSJohannes Berg void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
2166dd5ecfeaSJohannes Berg struct ieee80211_sta_vht_cap *vht_cap);
2167b119ad6eSLorenzo Bianconi void ieee80211_get_vht_mask_from_cap(__le16 vht_cap,
2168b119ad6eSLorenzo Bianconi u16 vht_mask[NL80211_VHT_NSS_MAX]);
216997f5f425Stamizhr@codeaurora.org enum nl80211_chan_width
2170c71420dbSJohannes Berg ieee80211_sta_rx_bw_to_chan_width(struct link_sta_info *sta);
21714a34215eSJohannes Berg
217241cbb0f5SLuca Coelho /* HE */
217341cbb0f5SLuca Coelho void
217441cbb0f5SLuca Coelho ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,
217541cbb0f5SLuca Coelho struct ieee80211_supported_band *sband,
217641cbb0f5SLuca Coelho const u8 *he_cap_ie, u8 he_cap_len,
21771bb9a8a4SJohannes Berg const struct ieee80211_he_6ghz_capa *he_6ghz_capa,
2178c71420dbSJohannes Berg struct link_sta_info *link_sta);
21791ced169cSJohn Crispin void
21801ced169cSJohn Crispin ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif,
21811ced169cSJohn Crispin const struct ieee80211_he_spr *he_spr_ie_elem);
218241cbb0f5SLuca Coelho
2183697f6c50SJohn Crispin void
2184697f6c50SJohn Crispin ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif,
2185697f6c50SJohn Crispin const struct ieee80211_he_operation *he_op_ie_elem);
2186697f6c50SJohn Crispin
218712bf8fadSThomas Pedersen /* S1G */
218812bf8fadSThomas Pedersen void ieee80211_s1g_sta_rate_init(struct sta_info *sta);
2189f5a4c24eSLorenzo Bianconi bool ieee80211_s1g_is_twt_setup(struct sk_buff *skb);
2190f5a4c24eSLorenzo Bianconi void ieee80211_s1g_rx_twt_action(struct ieee80211_sub_if_data *sdata,
2191f5a4c24eSLorenzo Bianconi struct sk_buff *skb);
2192f5a4c24eSLorenzo Bianconi void ieee80211_s1g_status_twt_action(struct ieee80211_sub_if_data *sdata,
2193f5a4c24eSLorenzo Bianconi struct sk_buff *skb);
219412bf8fadSThomas Pedersen
219539192c0bSJohannes Berg /* Spectrum management */
219639192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
219739192c0bSJohannes Berg struct ieee80211_mgmt *mgmt,
219839192c0bSJohannes Berg size_t len);
2199e6b7cde4SSimon Wunderlich /**
2200e6b7cde4SSimon Wunderlich * ieee80211_parse_ch_switch_ie - parses channel switch IEs
2201e6b7cde4SSimon Wunderlich * @sdata: the sdata of the interface which has received the frame
2202e6b7cde4SSimon Wunderlich * @elems: parsed 802.11 elements received with the frame
2203e6b7cde4SSimon Wunderlich * @current_band: indicates the current band
22042a333a0dSJohannes Berg * @vht_cap_info: VHT capabilities of the transmitter
2205ba323e29SJohannes Berg * @conn_flags: contains information about own capabilities and restrictions
2206ba323e29SJohannes Berg * to decide which channel switch announcements can be accepted, using
2207ba323e29SJohannes Berg * flags from &enum ieee80211_conn_flags.
2208e6b7cde4SSimon Wunderlich * @bssid: the currently connected bssid (for reporting)
2209c0f17eb9SChun-Yeow Yeoh * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl.
2210c0f17eb9SChun-Yeow Yeoh All of them will be filled with if success only.
2211e6b7cde4SSimon Wunderlich * Return: 0 on success, <0 on error and >0 if there is nothing to parse.
2212e6b7cde4SSimon Wunderlich */
2213e6b7cde4SSimon Wunderlich int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
221484469a45SLuciano Coelho struct ieee802_11_elems *elems,
221557fbcce3SJohannes Berg enum nl80211_band current_band,
22162a333a0dSJohannes Berg u32 vht_cap_info,
2217ba323e29SJohannes Berg ieee80211_conn_flags_t conn_flags, u8 *bssid,
2218c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie *csa_ie);
221939192c0bSJohannes Berg
2220f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */
2221f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local);
222284f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local);
2223f2753ddbSJohannes Berg
2224eecc4800SJohannes Berg int __ieee80211_suspend(struct ieee80211_hw *hw,
2225eecc4800SJohannes Berg struct cfg80211_wowlan *wowlan);
2226f2753ddbSJohannes Berg
__ieee80211_resume(struct ieee80211_hw * hw)2227f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw)
2228f2753ddbSJohannes Berg {
222985f72bc8SJohn W. Linville struct ieee80211_local *local = hw_to_local(hw);
223085f72bc8SJohn W. Linville
22319120d94eSLuciano Coelho WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) &&
22329120d94eSLuciano Coelho !test_bit(SCAN_COMPLETED, &local->scanning),
223385f72bc8SJohn W. Linville "%s: resume with hardware scan still in progress\n",
223485f72bc8SJohn W. Linville wiphy_name(hw->wiphy));
223585f72bc8SJohn W. Linville
2236f2753ddbSJohannes Berg return ieee80211_reconfig(hw_to_local(hw));
2237f2753ddbSJohannes Berg }
2238665af4fcSBob Copeland
2239c2d1560aSJohannes Berg /* utility functions/constants */
22408a47cea7SJohannes Berg extern const void *const mac80211_wiphy_privid; /* for wiphy privid */
224157fbcce3SJohannes Berg int ieee80211_frame_duration(enum nl80211_band band, size_t len,
2242438b61b7SSimon Wunderlich int rate, int erp, int short_preamble,
2243438b61b7SSimon Wunderlich int shift);
2244e552af05SHaim Dreyfuss void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata,
2245e552af05SHaim Dreyfuss struct ieee80211_tx_queue_params *qparam,
2246e552af05SHaim Dreyfuss int ac);
2247b3e2130bSJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_link_data *link,
2248cec66283SJohannes Berg bool bss_notify, bool enable_qos);
22497c10770fSJohannes Berg void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
225008aca29aSMathy Vanhoef struct sta_info *sta, struct sk_buff *skb);
2251cf6bb79aSHelmut Schaa
225255de908aSJohannes Berg void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
2253e1e68b14SJohannes Berg struct sk_buff *skb, int tid, int link_id,
225408aca29aSMathy Vanhoef enum nl80211_band band);
225555de908aSJohannes Berg
225650ff477aSJohn Crispin /* sta_out needs to be checked for ERR_PTR() before using */
225750ff477aSJohn Crispin int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata,
225850ff477aSJohn Crispin struct sk_buff *skb,
225950ff477aSJohn Crispin struct sta_info **sta_out);
226050ff477aSJohn Crispin
226155de908aSJohannes Berg static inline void
ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data * sdata,struct sk_buff * skb,int tid,enum nl80211_band band)226255de908aSJohannes Berg ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
226355de908aSJohannes Berg struct sk_buff *skb, int tid,
226408aca29aSMathy Vanhoef enum nl80211_band band)
226555de908aSJohannes Berg {
226655de908aSJohannes Berg rcu_read_lock();
2267e1e68b14SJohannes Berg __ieee80211_tx_skb_tid_band(sdata, skb, tid, -1, band);
226855de908aSJohannes Berg rcu_read_unlock();
226955de908aSJohannes Berg }
227055de908aSJohannes Berg
2271eef25a66SJohannes Berg void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
2272e1e68b14SJohannes Berg struct sk_buff *skb, int tid, int link_id);
227355de908aSJohannes Berg
ieee80211_tx_skb(struct ieee80211_sub_if_data * sdata,struct sk_buff * skb)227455de908aSJohannes Berg static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
2275cf6bb79aSHelmut Schaa struct sk_buff *skb)
2276cf6bb79aSHelmut Schaa {
2277cf6bb79aSHelmut Schaa /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
2278e1e68b14SJohannes Berg ieee80211_tx_skb_tid(sdata, skb, 7, -1);
2279cf6bb79aSHelmut Schaa }
2280cf6bb79aSHelmut Schaa
2281fd17bf04SJohannes Berg /**
2282fd17bf04SJohannes Berg * struct ieee80211_elems_parse_params - element parsing parameters
2283fd17bf04SJohannes Berg * @start: pointer to the elements
2284fd17bf04SJohannes Berg * @len: length of the elements
2285fd17bf04SJohannes Berg * @action: %true if the elements came from an action frame
2286fd17bf04SJohannes Berg * @filter: bitmap of element IDs to filter out while calculating
2287fd17bf04SJohannes Berg * the element CRC
2288fd17bf04SJohannes Berg * @crc: CRC starting value
228938c6aa29SJohannes Berg * @bss: the BSS to parse this as, for multi-BSSID cases this can
229038c6aa29SJohannes Berg * represent a non-transmitting BSS in which case the data
229138c6aa29SJohannes Berg * for that non-transmitting BSS is returned
2292425f4b5fSJohannes Berg * @link_id: the link ID to parse elements for, if a STA profile
229345ebac4fSIlan Peer * is present in the multi-link element, or -1 to ignore;
229445ebac4fSIlan Peer * note that the code currently assumes parsing an association
229545ebac4fSIlan Peer * (or re-association) response frame if this is given
2296ea5cba26SJohannes Berg * @from_ap: frame is received from an AP (currently used only
2297ea5cba26SJohannes Berg * for EHT capabilities parsing)
2298fd17bf04SJohannes Berg */
2299fd17bf04SJohannes Berg struct ieee80211_elems_parse_params {
2300fd17bf04SJohannes Berg const u8 *start;
2301fd17bf04SJohannes Berg size_t len;
2302fd17bf04SJohannes Berg bool action;
2303fd17bf04SJohannes Berg u64 filter;
2304fd17bf04SJohannes Berg u32 crc;
230538c6aa29SJohannes Berg struct cfg80211_bss *bss;
2306425f4b5fSJohannes Berg int link_id;
2307ea5cba26SJohannes Berg bool from_ap;
2308fd17bf04SJohannes Berg };
2309fd17bf04SJohannes Berg
2310fd17bf04SJohannes Berg struct ieee802_11_elems *
2311fd17bf04SJohannes Berg ieee802_11_parse_elems_full(struct ieee80211_elems_parse_params *params);
2312fd17bf04SJohannes Berg
2313fd17bf04SJohannes Berg static inline struct ieee802_11_elems *
ieee802_11_parse_elems_crc(const u8 * start,size_t len,bool action,u64 filter,u32 crc,struct cfg80211_bss * bss)2314fd17bf04SJohannes Berg ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
23155d24828dSJohannes Berg u64 filter, u32 crc,
231638c6aa29SJohannes Berg struct cfg80211_bss *bss)
2317fd17bf04SJohannes Berg {
2318fd17bf04SJohannes Berg struct ieee80211_elems_parse_params params = {
2319fd17bf04SJohannes Berg .start = start,
2320fd17bf04SJohannes Berg .len = len,
2321fd17bf04SJohannes Berg .action = action,
2322fd17bf04SJohannes Berg .filter = filter,
2323fd17bf04SJohannes Berg .crc = crc,
232438c6aa29SJohannes Berg .bss = bss,
2325425f4b5fSJohannes Berg .link_id = -1,
2326fd17bf04SJohannes Berg };
2327fd17bf04SJohannes Berg
2328fd17bf04SJohannes Berg return ieee802_11_parse_elems_full(¶ms);
2329fd17bf04SJohannes Berg }
2330fd17bf04SJohannes Berg
23315d24828dSJohannes Berg static inline struct ieee802_11_elems *
ieee802_11_parse_elems(const u8 * start,size_t len,bool action,struct cfg80211_bss * bss)23325d24828dSJohannes Berg ieee802_11_parse_elems(const u8 *start, size_t len, bool action,
233338c6aa29SJohannes Berg struct cfg80211_bss *bss)
2334ddc4db2eSJohannes Berg {
233538c6aa29SJohannes Berg return ieee802_11_parse_elems_crc(start, len, action, 0, 0, bss);
2336ddc4db2eSJohannes Berg }
2337ddc4db2eSJohannes Berg
2338d094482cSBenjamin Berg void ieee80211_fragment_element(struct sk_buff *skb, u8 *len_pos, u8 frag_id);
233983eb935eSMichal Kazior
234002219b3aSJohannes Berg extern const int ieee802_1d_to_ac[8];
234102219b3aSJohannes Berg
ieee80211_ac_from_tid(int tid)234202219b3aSJohannes Berg static inline int ieee80211_ac_from_tid(int tid)
234302219b3aSJohannes Berg {
234402219b3aSJohannes Berg return ieee802_1d_to_ac[tid & 7];
234502219b3aSJohannes Berg }
234602219b3aSJohannes Berg
2347520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
2348520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
234934f11cd3SKees Cook void ieee80211_dynamic_ps_timer(struct timer_list *t);
2350a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local,
2351a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata,
2352076cdcb1SJohannes Berg bool powersave);
2353a5d3cbdbSFelix Fietkau void ieee80211_send_4addr_nullfunc(struct ieee80211_local *local,
2354a5d3cbdbSFelix Fietkau struct ieee80211_sub_if_data *sdata);
23554e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
235602219b3aSJohannes Berg struct ieee80211_hdr *hdr, bool ack, u16 tx_time);
2357520eb820SKalle Valo
2358ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
2359445ea4e8SJohannes Berg unsigned long queues,
2360cca07b00SLuciano Coelho enum queue_stop_reason reason,
2361cca07b00SLuciano Coelho bool refcounted);
236226da23b6SLuciano Coelho void ieee80211_stop_vif_queues(struct ieee80211_local *local,
236326da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata,
236426da23b6SLuciano Coelho enum queue_stop_reason reason);
236526da23b6SLuciano Coelho void ieee80211_wake_vif_queues(struct ieee80211_local *local,
236626da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata,
236726da23b6SLuciano Coelho enum queue_stop_reason reason);
2368ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
2369445ea4e8SJohannes Berg unsigned long queues,
2370cca07b00SLuciano Coelho enum queue_stop_reason reason,
2371cca07b00SLuciano Coelho bool refcounted);
237296f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
2373cca07b00SLuciano Coelho enum queue_stop_reason reason,
2374cca07b00SLuciano Coelho bool refcounted);
237596f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
2376cca07b00SLuciano Coelho enum queue_stop_reason reason,
2377cca07b00SLuciano Coelho bool refcounted);
23788f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local,
23798f77f384SJohannes Berg struct sk_buff *skb);
2380e3685e03SJohannes Berg void ieee80211_add_pending_skbs(struct ieee80211_local *local,
2381e3685e03SJohannes Berg struct sk_buff_head *skbs);
238239ecc01dSJohannes Berg void ieee80211_flush_queues(struct ieee80211_local *local,
23833b24f4c6SEmmanuel Grumbach struct ieee80211_sub_if_data *sdata, bool drop);
23844f9610d5SLiad Kaufman void __ieee80211_flush_queues(struct ieee80211_local *local,
23854f9610d5SLiad Kaufman struct ieee80211_sub_if_data *sdata,
23863b24f4c6SEmmanuel Grumbach unsigned int queues, bool drop);
2387ce7c9111SKalle Valo
ieee80211_can_run_worker(struct ieee80211_local * local)23884afaff17SEmmanuel Grumbach static inline bool ieee80211_can_run_worker(struct ieee80211_local *local)
23894afaff17SEmmanuel Grumbach {
23904afaff17SEmmanuel Grumbach /*
2391f8891461SNaftali Goldstein * It's unsafe to try to do any work during reconfigure flow.
2392f8891461SNaftali Goldstein * When the flow ends the work will be requeued.
2393f8891461SNaftali Goldstein */
2394f8891461SNaftali Goldstein if (local->in_reconfig)
2395f8891461SNaftali Goldstein return false;
2396f8891461SNaftali Goldstein
2397f8891461SNaftali Goldstein /*
23984afaff17SEmmanuel Grumbach * If quiescing is set, we are racing with __ieee80211_suspend.
23994afaff17SEmmanuel Grumbach * __ieee80211_suspend flushes the workers after setting quiescing,
24004afaff17SEmmanuel Grumbach * and we check quiescing / suspended before enqueing new workers.
24014afaff17SEmmanuel Grumbach * We should abort the worker to avoid the races below.
24024afaff17SEmmanuel Grumbach */
24034afaff17SEmmanuel Grumbach if (local->quiescing)
24044afaff17SEmmanuel Grumbach return false;
24054afaff17SEmmanuel Grumbach
24064afaff17SEmmanuel Grumbach /*
24074afaff17SEmmanuel Grumbach * We might already be suspended if the following scenario occurs:
24084afaff17SEmmanuel Grumbach * __ieee80211_suspend Control path
24094afaff17SEmmanuel Grumbach *
24104afaff17SEmmanuel Grumbach * if (local->quiescing)
24114afaff17SEmmanuel Grumbach * return;
24124afaff17SEmmanuel Grumbach * local->quiescing = true;
24134afaff17SEmmanuel Grumbach * flush_workqueue();
24144afaff17SEmmanuel Grumbach * queue_work(...);
24154afaff17SEmmanuel Grumbach * local->suspended = true;
24164afaff17SEmmanuel Grumbach * local->quiescing = false;
24174afaff17SEmmanuel Grumbach * worker starts running...
24184afaff17SEmmanuel Grumbach */
24194afaff17SEmmanuel Grumbach if (local->suspended)
24204afaff17SEmmanuel Grumbach return false;
24214afaff17SEmmanuel Grumbach
24224afaff17SEmmanuel Grumbach return true;
24234afaff17SEmmanuel Grumbach }
24244afaff17SEmmanuel Grumbach
2425fa962b92SMichal Kazior int ieee80211_txq_setup_flows(struct ieee80211_local *local);
24262fe4a29aSToke Høiland-Jørgensen void ieee80211_txq_set_params(struct ieee80211_local *local);
2427fa962b92SMichal Kazior void ieee80211_txq_teardown_flows(struct ieee80211_local *local);
2428fa962b92SMichal Kazior void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata,
2429ba8c3d6fSFelix Fietkau struct sta_info *sta,
2430ba8c3d6fSFelix Fietkau struct txq_info *txq, int tid);
2431fa962b92SMichal Kazior void ieee80211_txq_purge(struct ieee80211_local *local,
2432fa962b92SMichal Kazior struct txq_info *txqi);
24332a9e2579SJohannes Berg void ieee80211_txq_remove_vlan(struct ieee80211_local *local,
24342a9e2579SJohannes Berg struct ieee80211_sub_if_data *sdata);
24352fe4a29aSToke Høiland-Jørgensen void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats,
24362fe4a29aSToke Høiland-Jørgensen struct txq_info *txqi);
2437da1cad73SAllen Pais void ieee80211_wake_txqs(struct tasklet_struct *t);
243846900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
2439700e8ea6SJouni Malinen u16 transaction, u16 auth_alg, u16 status,
24404a3cb702SJohannes Berg const u8 *extra, size_t extra_len, const u8 *bssid,
24411672c0e3SJohannes Berg const u8 *da, const u8 *key, u8 key_len, u8 key_idx,
24421672c0e3SJohannes Berg u32 tx_flags);
24436ae16775SAntonio Quartulli void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
24444b08d1b6SJohannes Berg const u8 *da, const u8 *bssid,
24454b08d1b6SJohannes Berg u16 stype, u16 reason,
24466ae16775SAntonio Quartulli bool send_frame, u8 *frame_buf);
244771b3b7acSAbhishek Naik u8 *ieee80211_write_he_6ghz_cap(u8 *pos, __le16 cap, u8 *end);
244800387f32SJohannes Berg
244900387f32SJohannes Berg enum {
245000387f32SJohannes Berg IEEE80211_PROBE_FLAG_DIRECTED = BIT(0),
2451b9771d41SJohannes Berg IEEE80211_PROBE_FLAG_MIN_CONTENT = BIT(1),
2452b9771d41SJohannes Berg IEEE80211_PROBE_FLAG_RANDOM_SN = BIT(2),
245300387f32SJohannes Berg };
245400387f32SJohannes Berg
24552ad2274cSIlan Peer int ieee80211_build_preq_ies(struct ieee80211_sub_if_data *sdata, u8 *buffer,
2456c56ef672SDavid Spinadel size_t buffer_len,
2457c56ef672SDavid Spinadel struct ieee80211_scan_ies *ie_desc,
2458c56ef672SDavid Spinadel const u8 *ie, size_t ie_len,
2459c56ef672SDavid Spinadel u8 bands_used, u32 *rate_masks,
246000387f32SJohannes Berg struct cfg80211_chan_def *chandef,
246100387f32SJohannes Berg u32 flags);
2462a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
2463a344d677SJohannes Berg const u8 *src, const u8 *dst,
2464a344d677SJohannes Berg u32 ratemask,
24656b77863bSJohannes Berg struct ieee80211_channel *chan,
2466a619a4c0SJuuso Oikarinen const u8 *ssid, size_t ssid_len,
2467a806c558SPaul Stewart const u8 *ie, size_t ie_len,
246800387f32SJohannes Berg u32 flags);
24692103dec1SSimon Wunderlich u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
247046900298SJohannes Berg struct ieee802_11_elems *elems,
247157fbcce3SJohannes Berg enum nl80211_band band, u32 *basic_rates);
2472687da132SEmmanuel Grumbach int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
2473d8675a63SJohannes Berg struct ieee80211_link_data *link,
2474687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode);
2475e9aac179SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata,
2476d8675a63SJohannes Berg struct ieee80211_link_data *link);
24770cbf348aSAndrei Otcheretianski void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata,
24780cbf348aSAndrei Otcheretianski int link_id);
247946900298SJohannes Berg
24808e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
2481ef96a842SBen Greear u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
248242e7aa77SAlexander Simon u16 cap);
2483074d46d1SJohannes Berg u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
24844bf88530SJohannes Berg const struct cfg80211_chan_def *chandef,
248557f255f5SArik Nemtsov u16 prot_mode, bool rifs_mode);
248675d627d5SSimon Wunderlich void ieee80211_ie_build_wide_bw_cs(u8 *pos,
248775d627d5SSimon Wunderlich const struct cfg80211_chan_def *chandef);
2488ba0afa2fSMahesh Palivela u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
2489ba0afa2fSMahesh Palivela u32 cap);
2490fb28ec0cSArik Nemtsov u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
2491fb28ec0cSArik Nemtsov const struct cfg80211_chan_def *chandef);
249260ad72daSSven Eckelmann u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype);
2493ba323e29SJohannes Berg u8 *ieee80211_ie_build_he_cap(ieee80211_conn_flags_t disable_flags, u8 *pos,
249441cbb0f5SLuca Coelho const struct ieee80211_sta_he_cap *he_cap,
249541cbb0f5SLuca Coelho u8 *end);
249624a2042cSRajkumar Manoharan void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata,
2497abd27d06SJohannes Berg enum ieee80211_smps_mode smps_mode,
249824a2042cSRajkumar Manoharan struct sk_buff *skb);
2499d1b7524bSRajkumar Manoharan u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef);
2500df1875c4SRyder Lee u8 *ieee80211_ie_build_eht_oper(u8 *pos, struct cfg80211_chan_def *chandef,
2501df1875c4SRyder Lee const struct ieee80211_sta_eht_cap *eht_cap);
25023dc05935SJohannes Berg int ieee80211_parse_bitrates(enum nl80211_chan_width width,
25032103dec1SSimon Wunderlich const struct ieee80211_supported_band *sband,
25042103dec1SSimon Wunderlich const u8 *srates, int srates_len, u32 *rates);
2505fc8a7321SJohannes Berg int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
25066b77863bSJohannes Berg struct sk_buff *skb, bool need_basic,
250757fbcce3SJohannes Berg enum nl80211_band band);
2508fc8a7321SJohannes Berg int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
25096b77863bSJohannes Berg struct sk_buff *skb, bool need_basic,
251057fbcce3SJohannes Berg enum nl80211_band band);
251140b861a0SArik Nemtsov u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
25127957c6c8SThomas Pedersen void ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata,
25137957c6c8SThomas Pedersen struct ieee80211_sta_s1g_cap *caps,
25147957c6c8SThomas Pedersen struct sk_buff *skb);
25151d00ce80SThomas Pedersen void ieee80211_add_aid_request_ie(struct ieee80211_sub_if_data *sdata,
25161d00ce80SThomas Pedersen struct sk_buff *skb);
25170333a81bSKieran Frewen u8 *ieee80211_ie_build_s1g_cap(u8 *pos, struct ieee80211_sta_s1g_cap *s1g_cap);
25188e664fb3SJohannes Berg
2519f444de05SJohannes Berg /* channel management */
25208ac3c704SJohannes Berg bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
25214bf88530SJohannes Berg struct cfg80211_chan_def *chandef);
25222a333a0dSJohannes Berg bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info,
25237eb26df2SJohannes Berg const struct ieee80211_vht_operation *oper,
25247eb26df2SJohannes Berg const struct ieee80211_ht_operation *htop,
2525abcff6efSJanusz.Dziedzic@tieto.com struct cfg80211_chan_def *chandef);
2526774e00c2SJohannes Berg void ieee80211_chandef_eht_oper(const struct ieee80211_eht_operation *eht_oper,
25271e0b3b0bSIlan Peer bool support_160, bool support_320,
25281e0b3b0bSIlan Peer struct cfg80211_chan_def *chandef);
252957fa5e85SJohannes Berg bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
253057fa5e85SJohannes Berg const struct ieee80211_he_operation *he_oper,
25315dca295dSIlan Peer const struct ieee80211_eht_operation *eht_oper,
253257fa5e85SJohannes Berg struct cfg80211_chan_def *chandef);
25331d00ce80SThomas Pedersen bool ieee80211_chandef_s1g_oper(const struct ieee80211_s1g_oper_ie *oper,
25341d00ce80SThomas Pedersen struct cfg80211_chan_def *chandef);
2535ba323e29SJohannes Berg ieee80211_conn_flags_t ieee80211_chandef_downgrade(struct cfg80211_chan_def *c);
2536f444de05SJohannes Berg
2537d01a1e65SMichal Kazior int __must_check
2538b4f85443SJohannes Berg ieee80211_link_use_channel(struct ieee80211_link_data *link,
25394bf88530SJohannes Berg const struct cfg80211_chan_def *chandef,
2540d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode);
25412c9b7359SJohannes Berg int __must_check
2542b4f85443SJohannes Berg ieee80211_link_reserve_chanctx(struct ieee80211_link_data *link,
254311335a55SLuciano Coelho const struct cfg80211_chan_def *chandef,
254409332481SMichal Kazior enum ieee80211_chanctx_mode mode,
254509332481SMichal Kazior bool radar_required);
254611335a55SLuciano Coelho int __must_check
2547b4f85443SJohannes Berg ieee80211_link_use_reserved_context(struct ieee80211_link_data *link);
2548b4f85443SJohannes Berg int ieee80211_link_unreserve_chanctx(struct ieee80211_link_data *link);
254911335a55SLuciano Coelho
255011335a55SLuciano Coelho int __must_check
2551b4f85443SJohannes Berg ieee80211_link_change_bandwidth(struct ieee80211_link_data *link,
25522c9b7359SJohannes Berg const struct cfg80211_chan_def *chandef,
2553aa87cd8bSJohannes Berg u64 *changed);
2554b4f85443SJohannes Berg void ieee80211_link_release_channel(struct ieee80211_link_data *link);
2555b4f85443SJohannes Berg void ieee80211_link_vlan_copy_chanctx(struct ieee80211_link_data *link);
2556b4f85443SJohannes Berg void ieee80211_link_copy_chanctx_to_vlans(struct ieee80211_link_data *link,
25571f4ac5a6SJohannes Berg bool clear);
2558c0166da9SMichal Kazior int ieee80211_chanctx_refcount(struct ieee80211_local *local,
2559c0166da9SMichal Kazior struct ieee80211_chanctx *ctx);
2560d01a1e65SMichal Kazior
256104ecd257SJohannes Berg void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
256204ecd257SJohannes Berg struct ieee80211_chanctx *chanctx);
256321f659bfSEliad Peller void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
2564b72a455aSJohannes Berg struct ieee80211_chanctx *ctx,
2565b72a455aSJohannes Berg struct ieee80211_link_data *rsvd_for);
25665cbc95a7SEliad Peller bool ieee80211_is_radar_required(struct ieee80211_local *local);
2567164eb02dSSimon Wunderlich
2568164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer_work(struct work_struct *work);
2569164eb02dSSimon Wunderlich void ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
257074d64f0aSJohannes Berg void ieee80211_dfs_radar_detected_work(struct wiphy *wiphy,
257174d64f0aSJohannes Berg struct wiphy_work *work);
2572c6da674aSChun-Yeow Yeoh int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
2573c6da674aSChun-Yeow Yeoh struct cfg80211_csa_settings *csa_settings);
257404ecd257SJohannes Berg
2575057d5f4bSThomas Pedersen void ieee80211_recalc_dtim(struct ieee80211_local *local,
2576057d5f4bSThomas Pedersen struct ieee80211_sub_if_data *sdata);
257773de86a3SLuciano Coelho int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
257873de86a3SLuciano Coelho const struct cfg80211_chan_def *chandef,
257973de86a3SLuciano Coelho enum ieee80211_chanctx_mode chanmode,
258073de86a3SLuciano Coelho u8 radar_detect);
25816fa001bcSMichal Kazior int ieee80211_max_num_channels(struct ieee80211_local *local);
25820fabfaafSArik Nemtsov void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
25830fabfaafSArik Nemtsov struct ieee80211_chanctx *ctx);
25842475b1ccSMax Stepanov
258595224fe8SArik Nemtsov /* TDLS */
258695224fe8SArik Nemtsov int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
2587c6112046SMukesh Sisodiya const u8 *peer, int link_id,
2588c6112046SMukesh Sisodiya u8 action_code, u8 dialog_token, u16 status_code,
2589c6112046SMukesh Sisodiya u32 peer_capability, bool initiator,
2590c6112046SMukesh Sisodiya const u8 *extra_ies, size_t extra_ies_len);
259195224fe8SArik Nemtsov int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
25923b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper);
2593c10a1993SJohannes Berg void ieee80211_tdls_peer_del_work(struct work_struct *wk);
2594a7a6bdd0SArik Nemtsov int ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev,
2595a7a6bdd0SArik Nemtsov const u8 *addr, u8 oper_class,
2596a7a6bdd0SArik Nemtsov struct cfg80211_chan_def *chandef);
2597a7a6bdd0SArik Nemtsov void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
2598a7a6bdd0SArik Nemtsov struct net_device *dev,
2599a7a6bdd0SArik Nemtsov const u8 *addr);
2600d51c2ea3SArik Nemtsov void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata);
260179c92ca4SYu Wang void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata,
260279c92ca4SYu Wang const u8 *peer, u16 reason);
2603f057d140SJohannes Berg void
2604f057d140SJohannes Berg ieee80211_process_tdls_channel_switch(struct ieee80211_sub_if_data *sdata,
2605f057d140SJohannes Berg struct sk_buff *skb);
2606f057d140SJohannes Berg
2607f057d140SJohannes Berg
260879c92ca4SYu Wang const char *ieee80211_get_reason_code_string(u16 reason_code);
260905d10957SThomas Pedersen u16 ieee80211_encode_usf(int val);
261009a740ceSThomas Pedersen u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
261109a740ceSThomas Pedersen enum nl80211_iftype type);
261295224fe8SArik Nemtsov
2613b7ffbd7eSJohannes Berg extern const struct ethtool_ops ieee80211_ethtool_ops;
2614b7ffbd7eSJohannes Berg
2615db3e1c40SToke Høiland-Jørgensen u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
2616db3e1c40SToke Høiland-Jørgensen struct ieee80211_vif *vif,
2617db3e1c40SToke Høiland-Jørgensen struct ieee80211_sta *pubsta,
26183ff901cbSFelix Fietkau int len, bool ampdu);
2619f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE
2620d9e8a70fSJohannes Berg #define debug_noinline noinline
2621d9e8a70fSJohannes Berg #else
2622d9e8a70fSJohannes Berg #define debug_noinline
2623d9e8a70fSJohannes Berg #endif
2624d9e8a70fSJohannes Berg
26253a11ce08SJohannes Berg void ieee80211_init_frag_cache(struct ieee80211_fragment_cache *cache);
26263a11ce08SJohannes Berg void ieee80211_destroy_frag_cache(struct ieee80211_fragment_cache *cache);
26273a11ce08SJohannes Berg
2628820acc81SIlan Peer u8 ieee80211_ie_len_eht_cap(struct ieee80211_sub_if_data *sdata, u8 iftype);
2629820acc81SIlan Peer u8 *ieee80211_ie_build_eht_cap(u8 *pos,
2630820acc81SIlan Peer const struct ieee80211_sta_he_cap *he_cap,
2631820acc81SIlan Peer const struct ieee80211_sta_eht_cap *eht_cap,
2632ea5cba26SJohannes Berg u8 *end,
2633ea5cba26SJohannes Berg bool for_ap);
2634a1de6407SIlan Peer
2635a1de6407SIlan Peer void
2636a1de6407SIlan Peer ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
2637a1de6407SIlan Peer struct ieee80211_supported_band *sband,
2638a1de6407SIlan Peer const u8 *he_cap_ie, u8 he_cap_len,
2639a1de6407SIlan Peer const struct ieee80211_eht_cap_elem *eht_cap_ie_elem,
2640c71420dbSJohannes Berg u8 eht_cap_len,
2641c71420dbSJohannes Berg struct link_sta_info *link_sta);
2642f0706e82SJiri Benc #endif /* IEEE80211_I_H */
2643