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 852b4810bSIlan Peer * Copyright (C) 2018-2020 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> 28fe7a5d5cSJohannes Berg #include <net/ieee80211_radiotap.h> 2993da9cc1Scolin@cozybit.com #include <net/cfg80211.h> 3051cb6db0SDavid S. Miller #include <net/mac80211.h> 31fa962b92SMichal Kazior #include <net/fq.h> 322c8dccc7SJohannes Berg #include "key.h" 33f0706e82SJiri Benc #include "sta_info.h" 34bdcbd8e0SJohannes Berg #include "debug.h" 35f0706e82SJiri Benc 363beea351SJohannes Berg extern const struct cfg80211_ops mac80211_config_ops; 373beea351SJohannes Berg 389cfb0009SJohannes Berg struct ieee80211_local; 39f0706e82SJiri Benc 40f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the 41f0706e82SJiri Benc * associated stations are using power saving. */ 42f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128 43f0706e82SJiri Benc 44f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames. 45f0706e82SJiri Benc * Note: increasing this limit increases the potential memory requirement. Each 46f0706e82SJiri Benc * frame can be up to about 2 kB long. */ 47f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512 48f0706e82SJiri Benc 49f0706e82SJiri Benc /* Required encryption head and tailroom */ 50f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8 51765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18 52f0706e82SJiri Benc 53f0706e82SJiri Benc /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent 54f0706e82SJiri Benc * reception of at least three fragmented frames. This limit can be increased 55f0706e82SJiri Benc * by changing this define, at the cost of slower frame reassembly and 56f0706e82SJiri Benc * increased memory use (about 2 kB of RAM per entry). */ 57f0706e82SJiri Benc #define IEEE80211_FRAGMENT_MAX 4 58f0706e82SJiri Benc 591ea6f9c0SJohannes Berg /* power level hasn't been configured (or set to automatic) */ 601ea6f9c0SJohannes Berg #define IEEE80211_UNSET_POWER_LEVEL INT_MIN 611ea6f9c0SJohannes Berg 62d6a4ed6fSArik Nemtsov /* 63aa75ebc2SMichal Kazior * Some APs experience problems when working with U-APSD. Decreasing the 64aa75ebc2SMichal Kazior * probability of that happening by using legacy mode for all ACs but VO isn't 65aa75ebc2SMichal Kazior * enough. 66aa75ebc2SMichal Kazior * 67aa75ebc2SMichal Kazior * Cisco 4410N originally forced us to enable VO by default only because it 68aa75ebc2SMichal Kazior * treated non-VO ACs as legacy. 69aa75ebc2SMichal Kazior * 70aa75ebc2SMichal Kazior * However some APs (notably Netgear R7000) silently reclassify packets to 71aa75ebc2SMichal Kazior * different ACs. Since u-APSD ACs require trigger frames for frame retrieval 72aa75ebc2SMichal Kazior * clients would never see some frames (e.g. ARP responses) or would fetch them 73aa75ebc2SMichal Kazior * accidentally after a long time. 74aa75ebc2SMichal Kazior * 75aa75ebc2SMichal Kazior * It makes little sense to enable u-APSD queues by default because it needs 76aa75ebc2SMichal Kazior * userspace applications to be aware of it to actually take advantage of the 77aa75ebc2SMichal Kazior * possible additional powersavings. Implicitly depending on driver autotrigger 78aa75ebc2SMichal Kazior * frame support doesn't make much sense. 79d6a4ed6fSArik Nemtsov */ 80aa75ebc2SMichal Kazior #define IEEE80211_DEFAULT_UAPSD_QUEUES 0 81ab13315aSKalle Valo 82ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN \ 83ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 84ab13315aSKalle Valo 85f438ceb8SEmmanuel Grumbach extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS]; 86f438ceb8SEmmanuel Grumbach 876ae16775SAntonio Quartulli #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */) 886ae16775SAntonio Quartulli 89167e33f4SAyala Beker #define IEEE80211_MAX_NAN_INSTANCE_ID 255 90167e33f4SAyala Beker 91f0706e82SJiri Benc struct ieee80211_fragment_entry { 92f0706e82SJiri Benc struct sk_buff_head skb_list; 9369f13223SJohannes Berg unsigned long first_frag_time; 9469f13223SJohannes Berg u16 seq; 9569f13223SJohannes Berg u16 extra_len; 9669f13223SJohannes Berg u16 last_frag; 9769f13223SJohannes Berg u8 rx_queue; 989acc54beSJohannes Berg bool check_sequential_pn; /* needed for CCMP/GCMP */ 99f0706e82SJiri Benc u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ 100f0706e82SJiri Benc }; 101f0706e82SJiri Benc 102f0706e82SJiri Benc 103c2b13452SJohannes Berg struct ieee80211_bss { 104ef429dadSJohannes Berg u32 device_ts_beacon, device_ts_presp; 1058c358bcdSJohannes Berg 10643ac2ca3SJouni Malinen bool wmm_used; 107ab13315aSKalle Valo bool uapsd_supported; 10800d3f14cSJohannes Berg 109f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32 110f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 111f0706e82SJiri Benc size_t supp_rates_len; 112817cee76SAlexander Bondar struct ieee80211_rate *beacon_rate; 113f0706e82SJiri Benc 1142a333a0dSJohannes Berg u32 vht_cap_info; 1152a333a0dSJohannes Berg 11600d3f14cSJohannes Berg /* 11725985edcSLucas De Marchi * During association, we save an ERP value from a probe response so 1185628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 1195628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 12000d3f14cSJohannes Berg * otherwise, you probably don't want to use them. 12100d3f14cSJohannes Berg */ 12200d3f14cSJohannes Berg bool has_erp_value; 1235628221cSDaniel Drake u8 erp_value; 124fcff4f10SPaul Stewart 125fcff4f10SPaul Stewart /* Keep track of the corruption of the last beacon/probe response. */ 126fcff4f10SPaul Stewart u8 corrupt_data; 127fcff4f10SPaul Stewart 128fcff4f10SPaul Stewart /* Keep track of what bits of information we have valid info for. */ 129fcff4f10SPaul Stewart u8 valid_data; 130fcff4f10SPaul Stewart }; 131fcff4f10SPaul Stewart 132fcff4f10SPaul Stewart /** 133fcff4f10SPaul Stewart * enum ieee80211_corrupt_data_flags - BSS data corruption flags 134fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted 135fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted 136fcff4f10SPaul Stewart * 137fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 138fcff4f10SPaul Stewart * @corrupt_data field of &struct ieee80211_bss. 139fcff4f10SPaul Stewart */ 140fcff4f10SPaul Stewart enum ieee80211_bss_corrupt_data_flags { 141fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_BEACON = BIT(0), 142fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1) 143fcff4f10SPaul Stewart }; 144fcff4f10SPaul Stewart 145fcff4f10SPaul Stewart /** 146fcff4f10SPaul Stewart * enum ieee80211_valid_data_flags - BSS valid data flags 147fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE 148fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE 149fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE 150fcff4f10SPaul Stewart * 151fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 152fcff4f10SPaul Stewart * @valid_data field of &struct ieee80211_bss. They show which parts 153d070f913SStephen Hemminger * of the data structure were received as a result of an un-corrupted 154fcff4f10SPaul Stewart * beacon/probe response. 155fcff4f10SPaul Stewart */ 156fcff4f10SPaul Stewart enum ieee80211_bss_valid_data_flags { 157fcff4f10SPaul Stewart IEEE80211_BSS_VALID_WMM = BIT(1), 158fcff4f10SPaul Stewart IEEE80211_BSS_VALID_RATES = BIT(2), 159fcff4f10SPaul Stewart IEEE80211_BSS_VALID_ERP = BIT(3) 160f0706e82SJiri Benc }; 161f0706e82SJiri Benc 1629efeccacSMichael S. Tsirkin typedef unsigned __bitwise ieee80211_tx_result; 1639ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1649ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1659ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1669ae54c84SJohannes Berg 1675cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1685cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1699ae54c84SJohannes Berg 1705cf121c3SJohannes Berg struct ieee80211_tx_data { 171f0706e82SJiri Benc struct sk_buff *skb; 172252b86c4SJohannes Berg struct sk_buff_head skbs; 173f0706e82SJiri Benc struct ieee80211_local *local; 174f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 175f0706e82SJiri Benc struct sta_info *sta; 176f0706e82SJiri Benc struct ieee80211_key *key; 1770d528d85SFelix Fietkau struct ieee80211_tx_rate rate; 1785cf121c3SJohannes Berg 179056cdd59SJohannes Berg unsigned int flags; 1805cf121c3SJohannes Berg }; 1815cf121c3SJohannes Berg 1825cf121c3SJohannes Berg 1839efeccacSMichael S. Tsirkin typedef unsigned __bitwise ieee80211_rx_result; 1845cf121c3SJohannes Berg #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 1855cf121c3SJohannes Berg #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 1865cf121c3SJohannes Berg #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 1875cf121c3SJohannes Berg #define RX_QUEUED ((__force ieee80211_rx_result) 3u) 1885cf121c3SJohannes Berg 189554891e6SJohannes Berg /** 190554891e6SJohannes Berg * enum ieee80211_packet_rx_flags - packet RX flags 191554891e6SJohannes Berg * @IEEE80211_RX_AMSDU: a-MSDU packet 192554891e6SJohannes Berg * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed 1934cfda47bSChristian Lamparter * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering 194554891e6SJohannes Berg * 195554891e6SJohannes Berg * These are per-frame flags that are attached to a frame in the 196554891e6SJohannes Berg * @rx_flags field of &struct ieee80211_rx_status. 197554891e6SJohannes Berg */ 198554891e6SJohannes Berg enum ieee80211_packet_rx_flags { 199554891e6SJohannes Berg IEEE80211_RX_AMSDU = BIT(3), 200554891e6SJohannes Berg IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4), 2014cfda47bSChristian Lamparter IEEE80211_RX_DEFERRED_RELEASE = BIT(5), 202554891e6SJohannes Berg }; 203554891e6SJohannes Berg 204554891e6SJohannes Berg /** 205554891e6SJohannes Berg * enum ieee80211_rx_flags - RX data flags 206554891e6SJohannes Berg * 207554891e6SJohannes Berg * @IEEE80211_RX_CMNTR: received on cooked monitor already 208ee971924SJohannes Berg * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported 209ee971924SJohannes Berg * to cfg80211_report_obss_beacon(). 210554891e6SJohannes Berg * 211554891e6SJohannes Berg * These flags are used across handling multiple interfaces 212554891e6SJohannes Berg * for a single frame. 213554891e6SJohannes Berg */ 214554891e6SJohannes Berg enum ieee80211_rx_flags { 215554891e6SJohannes Berg IEEE80211_RX_CMNTR = BIT(0), 216ee971924SJohannes Berg IEEE80211_RX_BEACON_REPORTED = BIT(1), 217554891e6SJohannes Berg }; 2185cf121c3SJohannes Berg 2195cf121c3SJohannes Berg struct ieee80211_rx_data { 220c5d1686bSFelix Fietkau struct list_head *list; 2215cf121c3SJohannes Berg struct sk_buff *skb; 2225cf121c3SJohannes Berg struct ieee80211_local *local; 2235cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 2245cf121c3SJohannes Berg struct sta_info *sta; 2255cf121c3SJohannes Berg struct ieee80211_key *key; 226056cdd59SJohannes Berg 227056cdd59SJohannes Berg unsigned int flags; 2289e26297aSJohannes Berg 2299e26297aSJohannes Berg /* 2309e26297aSJohannes Berg * Index into sequence numbers array, 0..16 2319e26297aSJohannes Berg * since the last (16) is used for non-QoS, 2329e26297aSJohannes Berg * will be 16 on non-QoS frames. 2339e26297aSJohannes Berg */ 2349e26297aSJohannes Berg int seqno_idx; 2359e26297aSJohannes Berg 2369e26297aSJohannes Berg /* 2379e26297aSJohannes Berg * Index into the security IV/PN arrays, 0..16 2389e26297aSJohannes Berg * since the last (16) is used for CCMP-encrypted 2399e26297aSJohannes Berg * management frames, will be set to 16 on mgmt 2409e26297aSJohannes Berg * frames and 0 on non-QoS frames. 2419e26297aSJohannes Berg */ 2429e26297aSJohannes Berg int security_idx; 2439e26297aSJohannes Berg 24450741ae0SJohannes Berg u32 tkip_iv32; 24550741ae0SJohannes Berg u16 tkip_iv16; 246f0706e82SJiri Benc }; 247f0706e82SJiri Benc 248af296bdbSMichal Kazior struct ieee80211_csa_settings { 249af296bdbSMichal Kazior const u16 *counter_offsets_beacon; 250af296bdbSMichal Kazior const u16 *counter_offsets_presp; 251af296bdbSMichal Kazior 252af296bdbSMichal Kazior int n_counter_offsets_beacon; 253af296bdbSMichal Kazior int n_counter_offsets_presp; 254af296bdbSMichal Kazior 255af296bdbSMichal Kazior u8 count; 256af296bdbSMichal Kazior }; 257af296bdbSMichal Kazior 2585dfdaf58SJohannes Berg struct beacon_data { 2595dfdaf58SJohannes Berg u8 *head, *tail; 2605dfdaf58SJohannes Berg int head_len, tail_len; 26143552be1SThomas Pedersen struct ieee80211_meshconf_ie *meshconf; 2628552a434SJohn Crispin u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; 2638552a434SJohn Crispin u8 cntdwn_current_counter; 2648860020eSJohannes Berg struct rcu_head rcu_head; 2655dfdaf58SJohannes Berg }; 2665dfdaf58SJohannes Berg 267aa7a0080SEyal Shapira struct probe_resp { 268aa7a0080SEyal Shapira struct rcu_head rcu_head; 269aa7a0080SEyal Shapira int len; 2708552a434SJohn Crispin u16 cntdwn_counter_offsets[IEEE80211_MAX_CNTDWN_COUNTERS_NUM]; 2713c23215bSGustavo A. R. Silva u8 data[]; 272aa7a0080SEyal Shapira }; 273aa7a0080SEyal Shapira 274295b02c4SAloka Dixit struct fils_discovery_data { 275295b02c4SAloka Dixit struct rcu_head rcu_head; 276295b02c4SAloka Dixit int len; 277295b02c4SAloka Dixit u8 data[]; 278295b02c4SAloka Dixit }; 279295b02c4SAloka Dixit 280632189a0SAloka Dixit struct unsol_bcast_probe_resp_data { 281632189a0SAloka Dixit struct rcu_head rcu_head; 282632189a0SAloka Dixit int len; 283632189a0SAloka Dixit u8 data[]; 284632189a0SAloka Dixit }; 285632189a0SAloka Dixit 286d012a605SMarco Porsch struct ps_data { 287d012a605SMarco Porsch /* yes, this looks ugly, but guarantees that we can later use 288d012a605SMarco Porsch * bitmap_empty :) 289d012a605SMarco Porsch * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 2905fe2bb86SJoe Perches u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)] 2915fe2bb86SJoe Perches __aligned(__alignof__(unsigned long)); 292d012a605SMarco Porsch struct sk_buff_head bc_buf; 293d012a605SMarco Porsch atomic_t num_sta_ps; /* number of stations in PS mode */ 294d012a605SMarco Porsch int dtim_count; 295d012a605SMarco Porsch bool dtim_bc_mc; 296d012a605SMarco Porsch }; 297d012a605SMarco Porsch 298f0706e82SJiri Benc struct ieee80211_if_ap { 29940b275b6SJohannes Berg struct beacon_data __rcu *beacon; 300aa7a0080SEyal Shapira struct probe_resp __rcu *probe_resp; 301295b02c4SAloka Dixit struct fils_discovery_data __rcu *fils_discovery; 302632189a0SAloka Dixit struct unsol_bcast_probe_resp_data __rcu *unsol_bcast_probe_resp; 303f0706e82SJiri Benc 30473da7d5bSSimon Wunderlich /* to be used after channel switch. */ 30573da7d5bSSimon Wunderlich struct cfg80211_beacon_data *next_beacon; 3064e141dadSMichal Kazior struct list_head vlans; /* write-protected with RTNL and local->mtx */ 3070ec3ca44SJohannes Berg 308d012a605SMarco Porsch struct ps_data ps; 309030ef8f8SFelix Fietkau atomic_t num_mcast_sta; /* number of stations receiving multicast */ 310687da132SEmmanuel Grumbach 311ebceec86SMichael Braun bool multicast_to_unicast; 312f0706e82SJiri Benc }; 313f0706e82SJiri Benc 314f0706e82SJiri Benc struct ieee80211_if_wds { 315f0706e82SJiri Benc struct sta_info *sta; 316056cdd59SJohannes Berg u8 remote_addr[ETH_ALEN]; 317f0706e82SJiri Benc }; 318f0706e82SJiri Benc 319f0706e82SJiri Benc struct ieee80211_if_vlan { 3204e141dadSMichal Kazior struct list_head list; /* write-protected with RTNL and local->mtx */ 321f14543eeSFelix Fietkau 322f14543eeSFelix Fietkau /* used for all tx if the VLAN is configured to 4-addr mode */ 32340b275b6SJohannes Berg struct sta_info __rcu *sta; 32472f15d53SMichael Braun atomic_t num_mcast_sta; /* number of stations receiving multicast */ 325f0706e82SJiri Benc }; 326f0706e82SJiri Benc 327ee385855SLuis Carlos Cobo struct mesh_stats { 328c8a61a7dSDaniel Walker __u32 fwded_mcast; /* Mesh forwarded multicast frames */ 329c8a61a7dSDaniel Walker __u32 fwded_unicast; /* Mesh forwarded unicast frames */ 330c8a61a7dSDaniel Walker __u32 fwded_frames; /* Mesh total forwarded frames */ 331ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 332ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 333cfee66b0SJavier Cardona __u32 dropped_frames_congestion;/* Not forwarded due to congestion */ 334ee385855SLuis Carlos Cobo }; 335ee385855SLuis Carlos Cobo 336ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 337ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 338ee385855SLuis Carlos Cobo struct mesh_preq_queue { 339ee385855SLuis Carlos Cobo struct list_head list; 340ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 341ee385855SLuis Carlos Cobo u8 flags; 342ee385855SLuis Carlos Cobo }; 343ee385855SLuis Carlos Cobo 3442eb278e0SJohannes Berg struct ieee80211_roc_work { 34577fdaa12SJohannes Berg struct list_head list; 346af6b6374SJohannes Berg 347af6b6374SJohannes Berg struct ieee80211_sub_if_data *sdata; 348af6b6374SJohannes Berg 349f679f65dSJohannes Berg struct ieee80211_channel *chan; 350af6b6374SJohannes Berg 3512eb278e0SJohannes Berg bool started, abort, hw_begun, notified; 352b4b177a5SJohannes Berg bool on_channel; 353f679f65dSJohannes Berg 354aaa016ccSJohannes Berg unsigned long start_time; 355e4da8c37SJohannes Berg 3562eb278e0SJohannes Berg u32 duration, req_duration; 357f30221e4SJohannes Berg struct sk_buff *frame; 35850febf6aSJohannes Berg u64 cookie, mgmt_tx_cookie; 359d339d5caSIlan Peer enum ieee80211_roc_type type; 36077fdaa12SJohannes Berg }; 36177fdaa12SJohannes Berg 36246900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */ 363ab1faeadSJohannes Berg enum ieee80211_sta_flags { 364b291ba11SJohannes Berg IEEE80211_STA_CONNECTION_POLL = BIT(1), 365b291ba11SJohannes Berg IEEE80211_STA_CONTROL_PORT = BIT(2), 366a8243b72SJohannes Berg IEEE80211_STA_DISABLE_HT = BIT(4), 367b291ba11SJohannes Berg IEEE80211_STA_MFP_ENABLED = BIT(6), 368ab13315aSKalle Valo IEEE80211_STA_UAPSD_ENABLED = BIT(7), 369375177bfSVivek Natarajan IEEE80211_STA_NULLFUNC_ACKED = BIT(8), 37017e4ec14SJouni Malinen IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), 37124398e39SJohannes Berg IEEE80211_STA_DISABLE_40MHZ = BIT(10), 372d545dabaSMahesh Palivela IEEE80211_STA_DISABLE_VHT = BIT(11), 373f2d9d270SJohannes Berg IEEE80211_STA_DISABLE_80P80MHZ = BIT(12), 374f2d9d270SJohannes Berg IEEE80211_STA_DISABLE_160MHZ = BIT(13), 375095d81ceSJohannes Berg IEEE80211_STA_DISABLE_WMM = BIT(14), 376cd2f5dd7SAssaf Krauss IEEE80211_STA_ENABLE_RRM = BIT(15), 37741cbb0f5SLuca Coelho IEEE80211_STA_DISABLE_HE = BIT(16), 378ab1faeadSJohannes Berg }; 379ab1faeadSJohannes Berg 38066e67e41SJohannes Berg struct ieee80211_mgd_auth_data { 38166e67e41SJohannes Berg struct cfg80211_bss *bss; 38266e67e41SJohannes Berg unsigned long timeout; 38366e67e41SJohannes Berg int tries; 38466e67e41SJohannes Berg u16 algorithm, expected_transaction; 38566e67e41SJohannes Berg 38666e67e41SJohannes Berg u8 key[WLAN_KEY_LEN_WEP104]; 38766e67e41SJohannes Berg u8 key_len, key_idx; 38866e67e41SJohannes Berg bool done; 389efb543e6SJouni Malinen bool peer_confirmed; 39089afe614SJohannes Berg bool timeout_started; 39166e67e41SJohannes 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 { 39866e67e41SJohannes Berg struct cfg80211_bss *bss; 39966e67e41SJohannes Berg const u8 *supp_rates; 40066e67e41SJohannes Berg 40166e67e41SJohannes Berg unsigned long timeout; 40266e67e41SJohannes Berg int tries; 40366e67e41SJohannes Berg 40466e67e41SJohannes Berg u16 capability; 40566e67e41SJohannes Berg u8 prev_bssid[ETH_ALEN]; 40666e67e41SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 40766e67e41SJohannes Berg u8 ssid_len; 40866e67e41SJohannes Berg u8 supp_rates_len; 40976f0303dSJohannes Berg bool wmm, uapsd; 410989c6505SAlexander Bondar bool need_beacon; 41166e67e41SJohannes Berg bool synced; 41289afe614SJohannes Berg bool timeout_started; 41366e67e41SJohannes Berg 4149dde6423SJohannes Berg u8 ap_ht_param; 4159dde6423SJohannes Berg 416b08fbbd8SJohannes Berg struct ieee80211_vht_cap ap_vht_cap; 417b08fbbd8SJohannes Berg 41839404feeSJouni Malinen u8 fils_nonces[2 * FILS_NONCE_LEN]; 41939404feeSJouni Malinen u8 fils_kek[FILS_MAX_KEK_LEN]; 42039404feeSJouni Malinen size_t fils_kek_len; 42139404feeSJouni Malinen 42266e67e41SJohannes Berg size_t ie_len; 42366e67e41SJohannes Berg u8 ie[]; 42466e67e41SJohannes Berg }; 42566e67e41SJohannes Berg 42602219b3aSJohannes Berg struct ieee80211_sta_tx_tspec { 42702219b3aSJohannes Berg /* timestamp of the first packet in the time slice */ 42802219b3aSJohannes Berg unsigned long time_slice_start; 42902219b3aSJohannes Berg 43002219b3aSJohannes Berg u32 admitted_time; /* in usecs, unlike over the air */ 43102219b3aSJohannes Berg u8 tsid; 43202219b3aSJohannes Berg s8 up; /* signed to be able to invalidate with -1 during teardown */ 43302219b3aSJohannes Berg 43402219b3aSJohannes Berg /* consumed TX time in microseconds in the time slice */ 43502219b3aSJohannes Berg u32 consumed_tx_time; 43602219b3aSJohannes Berg enum { 43702219b3aSJohannes Berg TX_TSPEC_ACTION_NONE = 0, 43802219b3aSJohannes Berg TX_TSPEC_ACTION_DOWNGRADE, 43902219b3aSJohannes Berg TX_TSPEC_ACTION_STOP_DOWNGRADE, 44002219b3aSJohannes Berg } action; 44102219b3aSJohannes Berg bool downgraded; 44202219b3aSJohannes Berg }; 44302219b3aSJohannes Berg 444eb1e011aSJohannes Berg DECLARE_EWMA(beacon_signal, 4, 4) 445338c17aeSJohannes Berg 44646900298SJohannes Berg struct ieee80211_if_managed { 447056cdd59SJohannes Berg struct timer_list timer; 448b291ba11SJohannes Berg struct timer_list conn_mon_timer; 449b291ba11SJohannes Berg struct timer_list bcn_mon_timer; 450c481ec97SSujith struct timer_list chswitch_timer; 451b291ba11SJohannes Berg struct work_struct monitor_work; 452c481ec97SSujith struct work_struct chswitch_work; 4531e4dcd01SJuuso Oikarinen struct work_struct beacon_connection_loss_work; 454882a7c69SJohannes Berg struct work_struct csa_connection_drop_work; 45546900298SJohannes Berg 4567ccc8bd7SFelix Fietkau unsigned long beacon_timeout; 457b291ba11SJohannes Berg unsigned long probe_timeout; 458a43abf29SMaxim Levitsky int probe_send_count; 45904ac3c0eSFelix Fietkau bool nullfunc_failed; 460682bd38bSJohannes Berg bool connection_loss; 461b291ba11SJohannes Berg 4620c1ad2caSJohannes Berg struct cfg80211_bss *associated; 46366e67e41SJohannes Berg struct ieee80211_mgd_auth_data *auth_data; 46466e67e41SJohannes Berg struct ieee80211_mgd_assoc_data *assoc_data; 46546900298SJohannes Berg 466a3e2f4b6SMichael Braun u8 bssid[ETH_ALEN] __aligned(2); 46746900298SJohannes Berg 468965bedadSJohannes Berg bool powersave; /* powersave requested for this iface */ 46905cb9108SJohannes Berg bool broken_ap; /* AP is broken -- turn off powersave */ 470989c6505SAlexander Bondar bool have_beacon; 471826262c3SJohannes Berg u8 dtim_period; 4720f78231bSJohannes Berg enum ieee80211_smps_mode req_smps, /* requested smps mode */ 473d1f5b7a3SJohannes Berg driver_smps_mode; /* smps mode request */ 474d1f5b7a3SJohannes Berg 475d1f5b7a3SJohannes Berg struct work_struct request_smps_work; 476965bedadSJohannes Berg 477d6f2da5bSJiri Slaby unsigned int flags; 478f0706e82SJiri Benc 4790c21e632SLuciano Coelho bool csa_waiting_bcn; 480f84eaa10SJohannes Berg bool csa_ignored_same_chan; 4810c21e632SLuciano Coelho 482d8ec4433SJuuso Oikarinen bool beacon_crc_valid; 483d91f36dbSJohannes Berg u32 beacon_crc; 484d91f36dbSJohannes Berg 4851672c0e3SJohannes Berg bool status_acked; 4861672c0e3SJohannes Berg bool status_received; 4871672c0e3SJohannes Berg __le16 status_fc; 4881672c0e3SJohannes Berg 489fdfacf0aSJouni Malinen enum { 490fdfacf0aSJouni Malinen IEEE80211_MFP_DISABLED, 491fdfacf0aSJouni Malinen IEEE80211_MFP_OPTIONAL, 492fdfacf0aSJouni Malinen IEEE80211_MFP_REQUIRED 493fdfacf0aSJouni Malinen } mfp; /* management frame protection */ 494fdfacf0aSJouni Malinen 495dc41e4d4SEliad Peller /* 496dc41e4d4SEliad Peller * Bitmask of enabled u-apsd queues, 497dc41e4d4SEliad Peller * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association 498dc41e4d4SEliad Peller * to take effect. 499dc41e4d4SEliad Peller */ 500dc41e4d4SEliad Peller unsigned int uapsd_queues; 501dc41e4d4SEliad Peller 502dc41e4d4SEliad Peller /* 503dc41e4d4SEliad Peller * Maximum number of buffered frames AP can deliver during a 504dc41e4d4SEliad Peller * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar. 505dc41e4d4SEliad Peller * Needs a new association to take effect. 506dc41e4d4SEliad Peller */ 507dc41e4d4SEliad Peller unsigned int uapsd_max_sp_len; 508dc41e4d4SEliad Peller 509f0706e82SJiri Benc int wmm_last_param_set; 5102e249fc3SShaul Triebitz int mu_edca_last_param_set; 5119bc383deSJohannes Berg 5129bc383deSJohannes Berg u8 use_4addr; 51317e4ec14SJouni Malinen 51467baf663SJanusz Dziedzic s16 p2p_noa_index; 515488dd7b5SJohannes Berg 516338c17aeSJohannes Berg struct ewma_beacon_signal ave_beacon_signal; 51717e4ec14SJouni Malinen 51817e4ec14SJouni Malinen /* 519391a200aSJouni Malinen * Number of Beacon frames used in ave_beacon_signal. This can be used 520391a200aSJouni Malinen * to avoid generating less reliable cqm events that would be based 521391a200aSJouni Malinen * only on couple of received frames. 522391a200aSJouni Malinen */ 523391a200aSJouni Malinen unsigned int count_beacon_signal; 524391a200aSJouni Malinen 525976bd9efSJohannes Berg /* Number of times beacon loss was invoked. */ 526976bd9efSJohannes Berg unsigned int beacon_loss_count; 527976bd9efSJohannes Berg 528391a200aSJouni Malinen /* 52917e4ec14SJouni Malinen * Last Beacon frame signal strength average (ave_beacon_signal / 16) 53017e4ec14SJouni Malinen * that triggered a cqm event. 0 indicates that no event has been 53117e4ec14SJouni Malinen * generated for the current association. 53217e4ec14SJouni Malinen */ 53317e4ec14SJouni Malinen int last_cqm_event_signal; 534615f7b9bSMeenakshi Venkataraman 535615f7b9bSMeenakshi Venkataraman /* 536615f7b9bSMeenakshi Venkataraman * State variables for keeping track of RSSI of the AP currently 537615f7b9bSMeenakshi Venkataraman * connected to and informing driver when RSSI has gone 538615f7b9bSMeenakshi Venkataraman * below/above a certain threshold. 539615f7b9bSMeenakshi Venkataraman */ 540615f7b9bSMeenakshi Venkataraman int rssi_min_thold, rssi_max_thold; 541615f7b9bSMeenakshi Venkataraman int last_ave_beacon_signal; 542ef96a842SBen Greear 543ef96a842SBen Greear struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 544ef96a842SBen Greear struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 545dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */ 546dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */ 5477957c6c8SThomas Pedersen struct ieee80211_s1g_cap s1g_capa; /* configured S1G overrides */ 5487957c6c8SThomas Pedersen struct ieee80211_s1g_cap s1g_capa_mask; /* valid s1g_capa bits */ 54981dd2b88SArik Nemtsov 5501277b4a9SLiad Kaufman /* TDLS support */ 55181dd2b88SArik Nemtsov u8 tdls_peer[ETH_ALEN] __aligned(2); 55281dd2b88SArik Nemtsov struct delayed_work tdls_peer_del_work; 5531277b4a9SLiad Kaufman struct sk_buff *orig_teardown_skb; /* The original teardown skb */ 5541277b4a9SLiad Kaufman struct sk_buff *teardown_skb; /* A copy to send through the AP */ 5551277b4a9SLiad Kaufman spinlock_t teardown_lock; /* To lock changing teardown_skb */ 5569041c1faSArik Nemtsov bool tdls_chan_switch_prohibited; 55782c0cc90SArik Nemtsov bool tdls_wider_bw_prohibited; 55802219b3aSJohannes Berg 55902219b3aSJohannes Berg /* WMM-AC TSPEC support */ 56002219b3aSJohannes Berg struct ieee80211_sta_tx_tspec tx_tspec[IEEE80211_NUM_ACS]; 56102219b3aSJohannes Berg /* Use a separate work struct so that we can do something here 56202219b3aSJohannes Berg * while the sdata->work is flushing the queues, for example. 56302219b3aSJohannes Berg * otherwise, in scenarios where we hardly get any traffic out 56402219b3aSJohannes Berg * on the BE queue, but there's a lot of VO traffic, we might 56502219b3aSJohannes Berg * get stuck in a downgraded situation and flush takes forever. 56602219b3aSJohannes Berg */ 56702219b3aSJohannes Berg struct delayed_work tx_tspec_wk; 5684d9ec73dSJouni Malinen 5694d9ec73dSJouni Malinen /* Information elements from the last transmitted (Re)Association 5704d9ec73dSJouni Malinen * Request frame. 5714d9ec73dSJouni Malinen */ 5724d9ec73dSJouni Malinen u8 *assoc_req_ies; 5734d9ec73dSJouni Malinen size_t assoc_req_ies_len; 574f0706e82SJiri Benc }; 575f0706e82SJiri Benc 57646900298SJohannes Berg struct ieee80211_if_ibss { 57746900298SJohannes Berg struct timer_list timer; 578cd7760e6SSimon Wunderlich struct work_struct csa_connection_drop_work; 57946900298SJohannes Berg 580af8cdcd8SJohannes Berg unsigned long last_scan_completed; 5815bb644a0SJohannes Berg 582fbd2c8dcSTeemu Paasikivi u32 basic_rates; 583fbd2c8dcSTeemu Paasikivi 584af8cdcd8SJohannes Berg bool fixed_bssid; 585af8cdcd8SJohannes Berg bool fixed_channel; 586fffd0934SJohannes Berg bool privacy; 58746900298SJohannes Berg 588267335d6SAntonio Quartulli bool control_port; 5898e8d347dSSimon Wunderlich bool userspace_handles_dfs; 590267335d6SAntonio Quartulli 5914d196e4bSFelix Fietkau u8 bssid[ETH_ALEN] __aligned(2); 592af8cdcd8SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 593af8cdcd8SJohannes Berg u8 ssid_len, ie_len; 594af8cdcd8SJohannes Berg u8 *ie; 5953aede78aSSimon Wunderlich struct cfg80211_chan_def chandef; 59646900298SJohannes Berg 59746900298SJohannes Berg unsigned long ibss_join_req; 598af8cdcd8SJohannes Berg /* probe response/beacon for IBSS */ 599c3ffeab4SJohannes Berg struct beacon_data __rcu *presp; 60046900298SJohannes Berg 601822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 602822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 603822854b0SSimon Wunderlich 6048bf11d8dSJohannes Berg spinlock_t incomplete_lock; 6058bf11d8dSJohannes Berg struct list_head incomplete_stations; 6068bf11d8dSJohannes Berg 60746900298SJohannes Berg enum { 60846900298SJohannes Berg IEEE80211_IBSS_MLME_SEARCH, 60946900298SJohannes Berg IEEE80211_IBSS_MLME_JOINED, 61046900298SJohannes Berg } state; 61146900298SJohannes Berg }; 61246900298SJohannes Berg 613dbf498fbSJavier Cardona /** 614239281f8SRostislav Lisovy * struct ieee80211_if_ocb - OCB mode state 615239281f8SRostislav Lisovy * 616239281f8SRostislav Lisovy * @housekeeping_timer: timer for periodic invocation of a housekeeping task 617239281f8SRostislav Lisovy * @wrkq_flags: OCB deferred task action 618239281f8SRostislav Lisovy * @incomplete_lock: delayed STA insertion lock 619239281f8SRostislav Lisovy * @incomplete_stations: list of STAs waiting for delayed insertion 620239281f8SRostislav Lisovy * @joined: indication if the interface is connected to an OCB network 621239281f8SRostislav Lisovy */ 622239281f8SRostislav Lisovy struct ieee80211_if_ocb { 623239281f8SRostislav Lisovy struct timer_list housekeeping_timer; 624239281f8SRostislav Lisovy unsigned long wrkq_flags; 625239281f8SRostislav Lisovy 626239281f8SRostislav Lisovy spinlock_t incomplete_lock; 627239281f8SRostislav Lisovy struct list_head incomplete_stations; 628239281f8SRostislav Lisovy 629239281f8SRostislav Lisovy bool joined; 630239281f8SRostislav Lisovy }; 631239281f8SRostislav Lisovy 632239281f8SRostislav Lisovy /** 633dbf498fbSJavier Cardona * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface 634dbf498fbSJavier Cardona * 635dbf498fbSJavier Cardona * these declarations define the interface, which enables 636dbf498fbSJavier Cardona * vendor-specific mesh synchronization 637dbf498fbSJavier Cardona * 638dbf498fbSJavier Cardona */ 639dbf498fbSJavier Cardona struct ieee802_11_elems; 640dbf498fbSJavier Cardona struct ieee80211_mesh_sync_ops { 641dbf498fbSJavier Cardona void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata, 642dbf498fbSJavier Cardona u16 stype, 643dbf498fbSJavier Cardona struct ieee80211_mgmt *mgmt, 644dbf498fbSJavier Cardona struct ieee802_11_elems *elems, 645dbf498fbSJavier Cardona struct ieee80211_rx_status *rx_status); 64643552be1SThomas Pedersen 64743552be1SThomas Pedersen /* should be called with beacon_data under RCU read lock */ 648445cd452SMasashi Honma void (*adjust_tsf)(struct ieee80211_sub_if_data *sdata, 64943552be1SThomas Pedersen struct beacon_data *beacon); 650dbf498fbSJavier Cardona /* add other framework functions here */ 651dbf498fbSJavier Cardona }; 652dbf498fbSJavier Cardona 653b8456a14SChun-Yeow Yeoh struct mesh_csa_settings { 654b8456a14SChun-Yeow Yeoh struct rcu_head rcu_head; 655b8456a14SChun-Yeow Yeoh struct cfg80211_csa_settings settings; 656b8456a14SChun-Yeow Yeoh }; 657b8456a14SChun-Yeow Yeoh 658472dbc45SJohannes Berg struct ieee80211_if_mesh { 659472dbc45SJohannes Berg struct timer_list housekeeping_timer; 660472dbc45SJohannes Berg struct timer_list mesh_path_timer; 661e304bfd3SRui Paulo struct timer_list mesh_path_root_timer; 662472dbc45SJohannes Berg 66318889231SJavier Cardona unsigned long wrkq_flags; 664f81a9dedSThomas Pedersen unsigned long mbss_changed; 665472dbc45SJohannes Berg 6660ab2e55dSBenjamin Berg bool userspace_handles_dfs; 6670ab2e55dSBenjamin Berg 668472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 669472dbc45SJohannes Berg size_t mesh_id_len; 670472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */ 6713491707aSRui Paulo u8 mesh_pp_id; 672472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */ 6733491707aSRui Paulo u8 mesh_pm_id; 674472dbc45SJohannes Berg /* Congestion Control Mode Identifier */ 6753491707aSRui Paulo u8 mesh_cc_id; 6769e03fdfdSJavier Cardona /* Synchronization Protocol Identifier */ 6773491707aSRui Paulo u8 mesh_sp_id; 6789e03fdfdSJavier Cardona /* Authentication Protocol Identifier */ 6793491707aSRui Paulo u8 mesh_auth_id; 680d19b3bf6SRui Paulo /* Local mesh Sequence Number */ 681d19b3bf6SRui Paulo u32 sn; 682472dbc45SJohannes Berg /* Last used PREQ ID */ 683472dbc45SJohannes Berg u32 preq_id; 684472dbc45SJohannes Berg atomic_t mpaths; 685d19b3bf6SRui Paulo /* Timestamp of last SN update */ 686d19b3bf6SRui Paulo unsigned long last_sn_update; 687dca7e943SThomas Pedersen /* Time when it's ok to send next PERR */ 688dca7e943SThomas Pedersen unsigned long next_perr; 689dca7e943SThomas Pedersen /* Timestamp of last PREQ sent */ 690472dbc45SJohannes Berg unsigned long last_preq; 691472dbc45SJohannes Berg struct mesh_rmc *rmc; 692472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock; 693472dbc45SJohannes Berg struct mesh_preq_queue preq_queue; 694472dbc45SJohannes Berg int preq_queue_len; 695472dbc45SJohannes Berg struct mesh_stats mshstats; 696472dbc45SJohannes Berg struct mesh_config mshcfg; 6971258d976SAshok Nagarajan atomic_t estab_plinks; 698472dbc45SJohannes Berg u32 mesh_seqnum; 699472dbc45SJohannes Berg bool accepting_plinks; 7005ee68e5bSJavier Cardona int num_gates; 7012b5e1967SThomas Pedersen struct beacon_data __rcu *beacon; 702581a8b0fSJavier Cardona const u8 *ie; 703581a8b0fSJavier Cardona u8 ie_len; 704b130e5ceSJavier Cardona enum { 705b130e5ceSJavier Cardona IEEE80211_MESH_SEC_NONE = 0x0, 706b130e5ceSJavier Cardona IEEE80211_MESH_SEC_AUTHED = 0x1, 707b130e5ceSJavier Cardona IEEE80211_MESH_SEC_SECURED = 0x2, 708b130e5ceSJavier Cardona } security; 709a6dad6a2SThomas Pedersen bool user_mpm; 710dbf498fbSJavier Cardona /* Extensible Synchronization Framework */ 7118ba7acf3SJohannes Berg const struct ieee80211_mesh_sync_ops *sync_ops; 712dbf498fbSJavier Cardona s64 sync_offset_clockdrift_max; 713dbf498fbSJavier Cardona spinlock_t sync_offset_lock; 7143f52b7e3SMarco Porsch /* mesh power save */ 7153f52b7e3SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 7163f52b7e3SMarco Porsch int ps_peers_light_sleep; 7173f52b7e3SMarco Porsch int ps_peers_deep_sleep; 7183f52b7e3SMarco Porsch struct ps_data ps; 7198f2535b9SChun-Yeow Yeoh /* Channel Switching Support */ 720b8456a14SChun-Yeow Yeoh struct mesh_csa_settings __rcu *csa; 7210cb4d4dcSLuciano Coelho enum { 7220cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_NONE, 7230cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_INIT, 7240cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_REPEATER, 7250cb4d4dcSLuciano Coelho } csa_role; 726b8456a14SChun-Yeow Yeoh u8 chsw_ttl; 7278f2535b9SChun-Yeow Yeoh u16 pre_value; 72843552be1SThomas Pedersen 72943552be1SThomas Pedersen /* offset from skb->data while building IE */ 73043552be1SThomas Pedersen int meshconf_offset; 7312bdaf386SBob Copeland 73260854fd9SBob Copeland struct mesh_table *mesh_paths; 73360854fd9SBob Copeland struct mesh_table *mpp_paths; /* Store paths for MPP&MAP */ 7342bdaf386SBob Copeland int mesh_paths_generation; 7352bdaf386SBob Copeland int mpp_paths_generation; 736472dbc45SJohannes Berg }; 737902acc78SJohannes Berg 738902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 739472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 740472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0) 741902acc78SJohannes Berg #else 742472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 743902acc78SJohannes Berg do { } while (0) 744902acc78SJohannes Berg #endif 745f0706e82SJiri Benc 746213cd118SJohannes Berg /** 747213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags 748213cd118SJohannes Berg * 749213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets 750213cd118SJohannes Berg * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode 751213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between 752213cd118SJohannes Berg * associated stations and deliver multicast frames both 753213cd118SJohannes Berg * back to wireless media and to the local net stack. 75495acac61SJohannes Berg * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume. 7557b7eab6fSJohannes Berg * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver 756213cd118SJohannes Berg */ 757213cd118SJohannes Berg enum ieee80211_sub_if_data_flags { 758213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0), 7597986cf95SJohannes Berg IEEE80211_SDATA_OPERATING_GMODE = BIT(2), 7607986cf95SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), 76195acac61SJohannes Berg IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4), 7627b7eab6fSJohannes Berg IEEE80211_SDATA_IN_DRIVER = BIT(5), 763213cd118SJohannes Berg }; 764213cd118SJohannes Berg 76534d4bc4dSJohannes Berg /** 76634d4bc4dSJohannes Berg * enum ieee80211_sdata_state_bits - virtual interface state bits 76734d4bc4dSJohannes Berg * @SDATA_STATE_RUNNING: virtual interface is up & running; this 76834d4bc4dSJohannes Berg * mirrors netif_running() but is separate for interface type 76934d4bc4dSJohannes Berg * change handling while the interface is up 7705b714c6aSJohannes Berg * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel 7715b714c6aSJohannes Berg * mode, so queues are stopped 772d6a83228SJohannes Berg * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due 773d6a83228SJohannes Berg * to offchannel, reset when offchannel returns 77434d4bc4dSJohannes Berg */ 77534d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits { 77634d4bc4dSJohannes Berg SDATA_STATE_RUNNING, 7775b714c6aSJohannes Berg SDATA_STATE_OFFCHANNEL, 778d6a83228SJohannes Berg SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, 77934d4bc4dSJohannes Berg }; 78034d4bc4dSJohannes Berg 781d01a1e65SMichal Kazior /** 782d01a1e65SMichal Kazior * enum ieee80211_chanctx_mode - channel context configuration mode 783d01a1e65SMichal Kazior * 784d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_SHARED: channel context may be used by 785d01a1e65SMichal Kazior * multiple interfaces 786d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used 787d01a1e65SMichal Kazior * only by a single interface. This can be used for example for 788d01a1e65SMichal Kazior * non-fixed channel IBSS. 789d01a1e65SMichal Kazior */ 790d01a1e65SMichal Kazior enum ieee80211_chanctx_mode { 791d01a1e65SMichal Kazior IEEE80211_CHANCTX_SHARED, 792d01a1e65SMichal Kazior IEEE80211_CHANCTX_EXCLUSIVE 793d01a1e65SMichal Kazior }; 794d01a1e65SMichal Kazior 7955bcae31dSMichal Kazior /** 7965bcae31dSMichal Kazior * enum ieee80211_chanctx_replace_state - channel context replacement state 7975bcae31dSMichal Kazior * 7985bcae31dSMichal Kazior * This is used for channel context in-place reservations that require channel 7995bcae31dSMichal Kazior * context switch/swap. 8005bcae31dSMichal Kazior * 8015bcae31dSMichal Kazior * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place 8025bcae31dSMichal Kazior * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced 8035bcae31dSMichal Kazior * by a (not yet registered) channel context pointed by %replace_ctx. 8045bcae31dSMichal Kazior * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context 8055bcae31dSMichal Kazior * replaces an existing channel context pointed to by %replace_ctx. 8065bcae31dSMichal Kazior */ 8075bcae31dSMichal Kazior enum ieee80211_chanctx_replace_state { 8085bcae31dSMichal Kazior IEEE80211_CHANCTX_REPLACE_NONE, 8095bcae31dSMichal Kazior IEEE80211_CHANCTX_WILL_BE_REPLACED, 8105bcae31dSMichal Kazior IEEE80211_CHANCTX_REPLACES_OTHER, 8115bcae31dSMichal Kazior }; 8125bcae31dSMichal Kazior 813d01a1e65SMichal Kazior struct ieee80211_chanctx { 814d01a1e65SMichal Kazior struct list_head list; 815d01a1e65SMichal Kazior struct rcu_head rcu_head; 816d01a1e65SMichal Kazior 817484298adSMichal Kazior struct list_head assigned_vifs; 818e3afb920SMichal Kazior struct list_head reserved_vifs; 819484298adSMichal Kazior 8205bcae31dSMichal Kazior enum ieee80211_chanctx_replace_state replace_state; 8215bcae31dSMichal Kazior struct ieee80211_chanctx *replace_ctx; 8225bcae31dSMichal Kazior 823d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode; 8248a61af65SJohannes Berg bool driver_present; 825d01a1e65SMichal Kazior 826d01a1e65SMichal Kazior struct ieee80211_chanctx_conf conf; 827d01a1e65SMichal Kazior }; 828d01a1e65SMichal Kazior 82932db6b54SKyeyoon Park struct mac80211_qos_map { 83032db6b54SKyeyoon Park struct cfg80211_qos_map qos_map; 83132db6b54SKyeyoon Park struct rcu_head rcu_head; 83232db6b54SKyeyoon Park }; 83332db6b54SKyeyoon Park 834ba8c3d6fSFelix Fietkau enum txq_info_flags { 835ba8c3d6fSFelix Fietkau IEEE80211_TXQ_STOP, 836ba8c3d6fSFelix Fietkau IEEE80211_TXQ_AMPDU, 8376e0456b5SFelix Fietkau IEEE80211_TXQ_NO_AMSDU, 83821a5d4c3SManikanta Pubbisetty IEEE80211_TXQ_STOP_NETIF_TX, 839ba8c3d6fSFelix Fietkau }; 840ba8c3d6fSFelix Fietkau 841fa962b92SMichal Kazior /** 842fa962b92SMichal Kazior * struct txq_info - per tid queue 843fa962b92SMichal Kazior * 844fa962b92SMichal Kazior * @tin: contains packets split into multiple flows 845fa962b92SMichal Kazior * @def_flow: used as a fallback flow when a packet destined to @tin hashes to 846fa962b92SMichal Kazior * a fq_flow which is already owned by a different tin 8475caa328eSMichal Kazior * @def_cvars: codel vars for @def_flow 848bb42f2d1SToke Høiland-Jørgensen * @frags: used to keep fragments created after dequeue 84918667600SToke Høiland-Jørgensen * @schedule_order: used with ieee80211_local->active_txqs 85018667600SToke Høiland-Jørgensen * @schedule_round: counter to prevent infinite loops on TXQ scheduling 851fa962b92SMichal Kazior */ 852ba8c3d6fSFelix Fietkau struct txq_info { 853fa962b92SMichal Kazior struct fq_tin tin; 854fa962b92SMichal Kazior struct fq_flow def_flow; 8555caa328eSMichal Kazior struct codel_vars def_cvars; 8568d51dbb8SToke Høiland-Jørgensen struct codel_stats cstats; 857bb42f2d1SToke Høiland-Jørgensen struct sk_buff_head frags; 85818667600SToke Høiland-Jørgensen struct list_head schedule_order; 85918667600SToke Høiland-Jørgensen u16 schedule_round; 860ba8c3d6fSFelix Fietkau unsigned long flags; 861ba8c3d6fSFelix Fietkau 862ba8c3d6fSFelix Fietkau /* keep last! */ 863ba8c3d6fSFelix Fietkau struct ieee80211_txq txq; 864ba8c3d6fSFelix Fietkau }; 865ba8c3d6fSFelix Fietkau 866d8212184SAviya Erenfeld struct ieee80211_if_mntr { 867d8212184SAviya Erenfeld u32 flags; 86842bd20d9SAviya Erenfeld u8 mu_follow_addr[ETH_ALEN] __aligned(2); 869f64331d5SJohannes Berg 870f64331d5SJohannes Berg struct list_head list; 871d8212184SAviya Erenfeld }; 872d8212184SAviya Erenfeld 8735953ff6dSAyala Beker /** 8745953ff6dSAyala Beker * struct ieee80211_if_nan - NAN state 8755953ff6dSAyala Beker * 8765953ff6dSAyala Beker * @conf: current NAN configuration 877167e33f4SAyala Beker * @func_ids: a bitmap of available instance_id's 8785953ff6dSAyala Beker */ 8795953ff6dSAyala Beker struct ieee80211_if_nan { 8805953ff6dSAyala Beker struct cfg80211_nan_conf conf; 881167e33f4SAyala Beker 882167e33f4SAyala Beker /* protects function_inst_ids */ 883167e33f4SAyala Beker spinlock_t func_lock; 884167e33f4SAyala Beker struct idr function_inst_ids; 8855953ff6dSAyala Beker }; 8865953ff6dSAyala Beker 887f0706e82SJiri Benc struct ieee80211_sub_if_data { 888f0706e82SJiri Benc struct list_head list; 889f0706e82SJiri Benc 890f0706e82SJiri Benc struct wireless_dev wdev; 891f0706e82SJiri Benc 89211a843b7SJohannes Berg /* keys */ 89311a843b7SJohannes Berg struct list_head key_list; 89411a843b7SJohannes Berg 8953bff1865SYogesh Ashok Powar /* count for keys needing tailroom space allocation */ 8963bff1865SYogesh Ashok Powar int crypto_tx_tailroom_needed_cnt; 8978d1f7ecdSJohannes Berg int crypto_tx_tailroom_pending_dec; 8988d1f7ecdSJohannes Berg struct delayed_work dec_tailroom_needed_wk; 8993bff1865SYogesh Ashok Powar 900f0706e82SJiri Benc struct net_device *dev; 901f0706e82SJiri Benc struct ieee80211_local *local; 902f0706e82SJiri Benc 90313262ffdSJiri Slaby unsigned int flags; 9047e9ed188SDaniel Drake 90534d4bc4dSJohannes Berg unsigned long state; 90634d4bc4dSJohannes Berg 90747846c9bSJohannes Berg char name[IFNAMSIZ]; 90847846c9bSJohannes Berg 909f0706e82SJiri Benc /* Fragment table for host-based reassembly */ 910f0706e82SJiri Benc struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; 911f0706e82SJiri Benc unsigned int fragment_next; 912f0706e82SJiri Benc 913b53be792SSimon Wunderlich /* TID bitmap for NoAck policy */ 914b53be792SSimon Wunderlich u16 noack_map; 915b53be792SSimon Wunderlich 91600e96decSYoni Divinsky /* bit field of ACM bits (BIT(802.1D tag)) */ 91700e96decSYoni Divinsky u8 wmm_acm; 91800e96decSYoni Divinsky 919e5473e80SJouni Malinen struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + 920e5473e80SJouni Malinen NUM_DEFAULT_MGMT_KEYS + 921e5473e80SJouni Malinen NUM_DEFAULT_BEACON_KEYS]; 92240b275b6SJohannes Berg struct ieee80211_key __rcu *default_unicast_key; 92340b275b6SJohannes Berg struct ieee80211_key __rcu *default_multicast_key; 92440b275b6SJohannes Berg struct ieee80211_key __rcu *default_mgmt_key; 925e5473e80SJouni Malinen struct ieee80211_key __rcu *default_beacon_key; 926f0706e82SJiri Benc 92794778280SJohannes Berg u16 sequence_number; 928a621fa4dSJohannes Berg __be16 control_port_protocol; 929a621fa4dSJohannes Berg bool control_port_no_encrypt; 9307f3f96ceSMarkus Theil bool control_port_no_preauth; 931018f6fbfSDenis Kenzior bool control_port_over_nl80211; 9322475b1ccSMax Stepanov int encrypt_headroom; 93394778280SJohannes Berg 93480a83cfcSMichal Kazior atomic_t num_tx_queued; 93554bcbc69SJohannes Berg struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; 93632db6b54SKyeyoon Park struct mac80211_qos_map __rcu *qos_map; 937f6f3def3SEliad Peller 93873da7d5bSSimon Wunderlich struct work_struct csa_finalize_work; 93959af6928SMichal Kazior bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ 94033787fc4SLuciano Coelho struct cfg80211_chan_def csa_chandef; 94173da7d5bSSimon Wunderlich 942484298adSMichal Kazior struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ 943e3afb920SMichal Kazior struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ 944484298adSMichal Kazior 94511335a55SLuciano Coelho /* context reservation -- protected with chanctx_mtx */ 94611335a55SLuciano Coelho struct ieee80211_chanctx *reserved_chanctx; 94711335a55SLuciano Coelho struct cfg80211_chan_def reserved_chandef; 94809332481SMichal Kazior bool reserved_radar_required; 9495bcae31dSMichal Kazior bool reserved_ready; 95011335a55SLuciano Coelho 95104ecd257SJohannes Berg /* used to reconfigure hardware SM PS */ 95204ecd257SJohannes Berg struct work_struct recalc_smps; 95304ecd257SJohannes Berg 95464592c8fSJohannes Berg struct work_struct work; 95535f20c14SJohannes Berg struct sk_buff_head skb_queue; 95635f20c14SJohannes Berg 95704ecd257SJohannes Berg u8 needed_rx_chains; 95804ecd257SJohannes Berg enum ieee80211_smps_mode smps_mode; 95904ecd257SJohannes Berg 9601ea6f9c0SJohannes Berg int user_power_level; /* in dBm */ 9611ea6f9c0SJohannes Berg int ap_power_level; /* in dBm */ 9621ea6f9c0SJohannes Berg 963164eb02dSSimon Wunderlich bool radar_required; 964164eb02dSSimon Wunderlich struct delayed_work dfs_cac_timer_work; 965164eb02dSSimon Wunderlich 9663e122be0SJohannes Berg /* 9673e122be0SJohannes Berg * AP this belongs to: self in AP mode and 9683e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 9693e122be0SJohannes Berg * all others (might be needed later in IBSS) 9703e122be0SJohannes Berg */ 9713e122be0SJohannes Berg struct ieee80211_if_ap *bss; 9723e122be0SJohannes Berg 97337eb0b16SJouni Malinen /* bitmap of allowed (non-MCS) rate indexes for rate control */ 97457fbcce3SJohannes Berg u32 rc_rateidx_mask[NUM_NL80211_BANDS]; 9752ffbe6d3SFelix Fietkau 97657fbcce3SJohannes Berg bool rc_has_mcs_mask[NUM_NL80211_BANDS]; 97757fbcce3SJohannes Berg u8 rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN]; 978f0706e82SJiri Benc 97957fbcce3SJohannes Berg bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS]; 98057fbcce3SJohannes Berg u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX]; 981b119ad6eSLorenzo Bianconi 98208fad438SJouni Malinen /* Beacon frame (non-MCS) rate (as a bitmap) */ 98308fad438SJouni Malinen u32 beacon_rateidx_mask[NUM_NL80211_BANDS]; 98408fad438SJouni Malinen bool beacon_rate_set; 98508fad438SJouni Malinen 986f0706e82SJiri Benc union { 987f0706e82SJiri Benc struct ieee80211_if_ap ap; 988f0706e82SJiri Benc struct ieee80211_if_wds wds; 989f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 99046900298SJohannes Berg struct ieee80211_if_managed mgd; 99146900298SJohannes Berg struct ieee80211_if_ibss ibss; 992472dbc45SJohannes Berg struct ieee80211_if_mesh mesh; 993239281f8SRostislav Lisovy struct ieee80211_if_ocb ocb; 994d8212184SAviya Erenfeld struct ieee80211_if_mntr mntr; 9955953ff6dSAyala Beker struct ieee80211_if_nan nan; 996f0706e82SJiri Benc } u; 997e9f207f0SJiri Benc 998e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 999e9f207f0SJiri Benc struct { 1000295bafb4SBen Greear struct dentry *subdir_stations; 1001f7e0104cSJohannes Berg struct dentry *default_unicast_key; 1002f7e0104cSJohannes Berg struct dentry *default_multicast_key; 10033cfcf6acSJouni Malinen struct dentry *default_mgmt_key; 1004e5473e80SJouni Malinen struct dentry *default_beacon_key; 10057bcfaf2fSJohannes Berg } debugfs; 1006e9f207f0SJiri Benc #endif 1007529ba6e9SJohannes Berg 100832bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */ 100932bfd35dSJohannes Berg struct ieee80211_vif vif; 1010f0706e82SJiri Benc }; 1011f0706e82SJiri Benc 101232bfd35dSJohannes Berg static inline 101332bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 101432bfd35dSJohannes Berg { 101532bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif); 101632bfd35dSJohannes Berg } 101732bfd35dSJohannes Berg 10188d61ffa5SJohannes Berg static inline void sdata_lock(struct ieee80211_sub_if_data *sdata) 10198d61ffa5SJohannes Berg __acquires(&sdata->wdev.mtx) 10208d61ffa5SJohannes Berg { 10218d61ffa5SJohannes Berg mutex_lock(&sdata->wdev.mtx); 10228d61ffa5SJohannes Berg __acquire(&sdata->wdev.mtx); 10238d61ffa5SJohannes Berg } 10248d61ffa5SJohannes Berg 10258d61ffa5SJohannes Berg static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata) 10268d61ffa5SJohannes Berg __releases(&sdata->wdev.mtx) 10278d61ffa5SJohannes Berg { 10288d61ffa5SJohannes Berg mutex_unlock(&sdata->wdev.mtx); 10298d61ffa5SJohannes Berg __release(&sdata->wdev.mtx); 10308d61ffa5SJohannes Berg } 10318d61ffa5SJohannes Berg 10327ca133bcSSimon Wunderlich #define sdata_dereference(p, sdata) \ 10337ca133bcSSimon Wunderlich rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx)) 10347ca133bcSSimon Wunderlich 10358d61ffa5SJohannes Berg static inline void 10368d61ffa5SJohannes Berg sdata_assert_lock(struct ieee80211_sub_if_data *sdata) 10378d61ffa5SJohannes Berg { 10388d61ffa5SJohannes Berg lockdep_assert_held(&sdata->wdev.mtx); 10398d61ffa5SJohannes Berg } 10408d61ffa5SJohannes Berg 1041438b61b7SSimon Wunderlich static inline int 1042438b61b7SSimon Wunderlich ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef) 1043438b61b7SSimon Wunderlich { 1044438b61b7SSimon Wunderlich switch (chandef->width) { 1045438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 1046438b61b7SSimon Wunderlich return 2; 1047438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 1048438b61b7SSimon Wunderlich return 1; 1049438b61b7SSimon Wunderlich default: 1050438b61b7SSimon Wunderlich return 0; 1051438b61b7SSimon Wunderlich } 1052438b61b7SSimon Wunderlich } 1053438b61b7SSimon Wunderlich 1054438b61b7SSimon Wunderlich static inline int 1055438b61b7SSimon Wunderlich ieee80211_vif_get_shift(struct ieee80211_vif *vif) 1056438b61b7SSimon Wunderlich { 1057438b61b7SSimon Wunderlich struct ieee80211_chanctx_conf *chanctx_conf; 1058438b61b7SSimon Wunderlich int shift = 0; 1059438b61b7SSimon Wunderlich 1060438b61b7SSimon Wunderlich rcu_read_lock(); 1061438b61b7SSimon Wunderlich chanctx_conf = rcu_dereference(vif->chanctx_conf); 1062438b61b7SSimon Wunderlich if (chanctx_conf) 1063438b61b7SSimon Wunderlich shift = ieee80211_chandef_get_shift(&chanctx_conf->def); 1064438b61b7SSimon Wunderlich rcu_read_unlock(); 1065438b61b7SSimon Wunderlich 1066438b61b7SSimon Wunderlich return shift; 1067438b61b7SSimon Wunderlich } 1068438b61b7SSimon Wunderlich 1069f0706e82SJiri Benc enum { 1070f0706e82SJiri Benc IEEE80211_RX_MSG = 1, 1071f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2, 1072f0706e82SJiri Benc }; 1073f0706e82SJiri Benc 1074ce7c9111SKalle Valo enum queue_stop_reason { 1075ce7c9111SKalle Valo IEEE80211_QUEUE_STOP_REASON_DRIVER, 1076520eb820SKalle Valo IEEE80211_QUEUE_STOP_REASON_PS, 107796f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_CSA, 107896f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_AGGREGATION, 107925420604SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SUSPEND, 10808f77f384SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 10816c17b77bSSeth Forshee IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL, 1082445ea4e8SJohannes Berg IEEE80211_QUEUE_STOP_REASON_FLUSH, 1083db67d661SArik Nemtsov IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN, 1084b6da911bSLiad Kaufman IEEE80211_QUEUE_STOP_REASON_RESERVE_TID, 1085cca07b00SLuciano Coelho 1086cca07b00SLuciano Coelho IEEE80211_QUEUE_STOP_REASONS, 1087ce7c9111SKalle Valo }; 1088ce7c9111SKalle Valo 108965a6538aSLuciano Coelho #ifdef CONFIG_MAC80211_LEDS 1090e1e54068SJohannes Berg struct tpt_led_trigger { 1091e1e54068SJohannes Berg char name[32]; 1092e1e54068SJohannes Berg const struct ieee80211_tpt_blink *blink_table; 1093e1e54068SJohannes Berg unsigned int blink_table_len; 1094e1e54068SJohannes Berg struct timer_list timer; 109534f11cd3SKees Cook struct ieee80211_local *local; 1096e1e54068SJohannes Berg unsigned long prev_traffic; 1097e1e54068SJohannes Berg unsigned long tx_bytes, rx_bytes; 109867408c8cSJohannes Berg unsigned int active, want; 109967408c8cSJohannes Berg bool running; 1100e1e54068SJohannes Berg }; 110165a6538aSLuciano Coelho #endif 1102e1e54068SJohannes Berg 1103142b9f50SHelmut Schaa /** 1104142b9f50SHelmut Schaa * mac80211 scan flags - currently active scan mode 1105142b9f50SHelmut Schaa * 1106142b9f50SHelmut Schaa * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as 1107142b9f50SHelmut Schaa * well be on the operating channel 1108142b9f50SHelmut Schaa * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to 1109142b9f50SHelmut Schaa * determine if we are on the operating channel or not 11108a690674SBen Greear * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating 11118a690674SBen Greear * channel. This should not interrupt normal traffic. 11128789d459SJohannes Berg * @SCAN_COMPLETED: Set for our scan work function when the driver reported 11138789d459SJohannes Berg * that the scan completed. 11148789d459SJohannes Berg * @SCAN_ABORTED: Set for our scan work function when the driver reported 11158789d459SJohannes Berg * a scan complete for an aborted scan. 1116a754055aSEmmanuel Grumbach * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being 1117a754055aSEmmanuel Grumbach * cancelled. 1118142b9f50SHelmut Schaa */ 1119fbe9c429SHelmut Schaa enum { 1120fbe9c429SHelmut Schaa SCAN_SW_SCANNING, 1121142b9f50SHelmut Schaa SCAN_HW_SCANNING, 11228a690674SBen Greear SCAN_ONCHANNEL_SCANNING, 11238789d459SJohannes Berg SCAN_COMPLETED, 11248789d459SJohannes Berg SCAN_ABORTED, 1125a754055aSEmmanuel Grumbach SCAN_HW_CANCELLED, 1126142b9f50SHelmut Schaa }; 1127142b9f50SHelmut Schaa 1128142b9f50SHelmut Schaa /** 1129142b9f50SHelmut Schaa * enum mac80211_scan_state - scan state machine states 1130142b9f50SHelmut Schaa * 1131142b9f50SHelmut Schaa * @SCAN_DECISION: Main entry point to the scan state machine, this state 1132142b9f50SHelmut Schaa * determines if we should keep on scanning or switch back to the 1133142b9f50SHelmut Schaa * operating channel 1134142b9f50SHelmut Schaa * @SCAN_SET_CHANNEL: Set the next channel to be scanned 1135142b9f50SHelmut Schaa * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses 113607ef03eeSJohannes Berg * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to 113707ef03eeSJohannes Berg * send out data 113807ef03eeSJohannes Berg * @SCAN_RESUME: Resume the scan and scan the next channel 1139cd2bb512SSam Leffler * @SCAN_ABORT: Abort the scan and go back to operating channel 1140142b9f50SHelmut Schaa */ 1141142b9f50SHelmut Schaa enum mac80211_scan_state { 1142142b9f50SHelmut Schaa SCAN_DECISION, 1143142b9f50SHelmut Schaa SCAN_SET_CHANNEL, 1144142b9f50SHelmut Schaa SCAN_SEND_PROBE, 114507ef03eeSJohannes Berg SCAN_SUSPEND, 114607ef03eeSJohannes Berg SCAN_RESUME, 1147cd2bb512SSam Leffler SCAN_ABORT, 1148fbe9c429SHelmut Schaa }; 1149fbe9c429SHelmut Schaa 1150f0706e82SJiri Benc struct ieee80211_local { 1151f0706e82SJiri Benc /* embed the driver visible part. 1152f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 1153f0706e82SJiri Benc * it first anyway so they become a no-op */ 1154f0706e82SJiri Benc struct ieee80211_hw hw; 1155f0706e82SJiri Benc 1156fa962b92SMichal Kazior struct fq fq; 11575caa328eSMichal Kazior struct codel_vars *cvars; 11585caa328eSMichal Kazior struct codel_params cparams; 1159fa962b92SMichal Kazior 116018667600SToke Høiland-Jørgensen /* protects active_txqs and txqi->schedule_order */ 116118667600SToke Høiland-Jørgensen spinlock_t active_txq_lock[IEEE80211_NUM_ACS]; 116218667600SToke Høiland-Jørgensen struct list_head active_txqs[IEEE80211_NUM_ACS]; 116318667600SToke Høiland-Jørgensen u16 schedule_round[IEEE80211_NUM_ACS]; 116418667600SToke Høiland-Jørgensen 1165b4809e94SToke Høiland-Jørgensen u16 airtime_flags; 11663ace10f5SKan Yan u32 aql_txq_limit_low[IEEE80211_NUM_ACS]; 11673ace10f5SKan Yan u32 aql_txq_limit_high[IEEE80211_NUM_ACS]; 11683ace10f5SKan Yan u32 aql_threshold; 11693ace10f5SKan Yan atomic_t aql_total_pending_airtime; 1170b4809e94SToke Høiland-Jørgensen 1171f0706e82SJiri Benc const struct ieee80211_ops *ops; 1172f0706e82SJiri Benc 117342935ecaSLuis R. Rodriguez /* 117442935ecaSLuis R. Rodriguez * private workqueue to mac80211. mac80211 makes this accessible 117542935ecaSLuis R. Rodriguez * via ieee80211_queue_work() 117642935ecaSLuis R. Rodriguez */ 117742935ecaSLuis R. Rodriguez struct workqueue_struct *workqueue; 117842935ecaSLuis R. Rodriguez 1179e4e72fb4SJohannes Berg unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; 1180cca07b00SLuciano Coelho int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS]; 118196f5e66eSJohannes Berg /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ 1182ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock; 118396f5e66eSJohannes Berg 1184f0706e82SJiri Benc int open_count; 11853d30d949SMichael Wu int monitors, cooked_mntrs; 11868cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 11877be5086dSJohannes Berg int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, 11887be5086dSJohannes Berg fif_probe_req; 11896cd536feSJohannes Berg bool probe_req_reg; 1190873b1cf6SJouni Malinen bool rx_mcast_action_reg; 11914150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 11923b8d81e0SJohannes Berg 11933ffc2a90SJohannes Berg bool wiphy_ciphers_allocated; 11943ffc2a90SJohannes Berg 1195fe57d9f5SJohannes Berg bool use_chanctx; 1196fe57d9f5SJohannes Berg 11973b8d81e0SJohannes Berg /* protects the aggregated multicast list and filter calls */ 11983b8d81e0SJohannes Berg spinlock_t filter_lock; 11993b8d81e0SJohannes Berg 12003ac64beeSJohannes Berg /* used for uploading changed mc list */ 12013ac64beeSJohannes Berg struct work_struct reconfig_filter; 12023ac64beeSJohannes Berg 12033b8d81e0SJohannes Berg /* aggregated multicast list */ 120422bedad3SJiri Pirko struct netdev_hw_addr_list mc_list; 12053b8d81e0SJohannes Berg 1206d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 12075bb644a0SJohannes Berg 12085bb644a0SJohannes Berg /* 12095bb644a0SJohannes Berg * suspended is true if we finished all the suspend _and_ we have 12105bb644a0SJohannes Berg * not yet come up from resume. This is to be used by mac80211 12115bb644a0SJohannes Berg * to ensure driver sanity during suspend and mac80211's own 12125bb644a0SJohannes Berg * sanity. It can eventually be used for WoW as well. 12135bb644a0SJohannes Berg */ 12145bb644a0SJohannes Berg bool suspended; 12155bb644a0SJohannes Berg 12165bb644a0SJohannes Berg /* 1217ceb99fe0SJohannes Berg * Resuming is true while suspended, but when we're reprogramming the 1218ceb99fe0SJohannes Berg * hardware -- at that time it's allowed to use ieee80211_queue_work() 1219ceb99fe0SJohannes Berg * again even though some other parts of the stack are still suspended 1220ceb99fe0SJohannes Berg * and we still drop received frames to avoid waking the stack. 1221ceb99fe0SJohannes Berg */ 1222ceb99fe0SJohannes Berg bool resuming; 1223ceb99fe0SJohannes Berg 1224ceb99fe0SJohannes Berg /* 12255bb644a0SJohannes Berg * quiescing is true during the suspend process _only_ to 12265bb644a0SJohannes Berg * ease timer cancelling etc. 12275bb644a0SJohannes Berg */ 12285bb644a0SJohannes Berg bool quiescing; 12295bb644a0SJohannes Berg 1230ea77f12fSJohannes Berg /* device is started */ 1231ea77f12fSJohannes Berg bool started; 1232ea77f12fSJohannes Berg 123304800adaSArik Nemtsov /* device is during a HW reconfig */ 123404800adaSArik Nemtsov bool in_reconfig; 123504800adaSArik Nemtsov 1236eecc4800SJohannes Berg /* wowlan is enabled -- don't reconfig on resume */ 1237eecc4800SJohannes Berg bool wowlan; 1238eecc4800SJohannes Berg 1239164eb02dSSimon Wunderlich struct work_struct radar_detected_work; 1240164eb02dSSimon Wunderlich 124104ecd257SJohannes Berg /* number of RX chains the hardware has */ 124204ecd257SJohannes Berg u8 rx_chains; 124304ecd257SJohannes Berg 124409b4a4faSJohannes Berg /* bitmap of which sbands were copied */ 124509b4a4faSJohannes Berg u8 sband_allocated; 124609b4a4faSJohannes Berg 1247b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 1248f0706e82SJiri Benc 1249f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 1250f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 1251f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 1252f0706e82SJiri Benc * queues increases over the limit. */ 1253f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 1254f0706e82SJiri Benc struct tasklet_struct tasklet; 1255f0706e82SJiri Benc struct sk_buff_head skb_queue; 1256f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 1257f0706e82SJiri Benc 1258f9e124fbSChristian Lamparter spinlock_t rx_path_lock; 125924a8fdadSChristian Lamparter 1260d0709a65SJohannes Berg /* Station data */ 1261d0709a65SJohannes Berg /* 12624d33960bSJohannes Berg * The mutex only protects the list, hash table and 12634d33960bSJohannes Berg * counter, reads are done with RCU. 1264d0709a65SJohannes Berg */ 126534e89507SJohannes Berg struct mutex sta_mtx; 12664d33960bSJohannes Berg spinlock_t tim_lock; 1267d0709a65SJohannes Berg unsigned long num_sta; 12684d33960bSJohannes Berg struct list_head sta_list; 126983e7e4ceSHerbert Xu struct rhltable sta_hash; 1270f0706e82SJiri Benc struct timer_list sta_cleanup; 1271f5ea9120SJohannes Berg int sta_generation; 1272f0706e82SJiri Benc 12732a577d98SJohannes Berg struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; 1274f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 127521a5d4c3SManikanta Pubbisetty struct tasklet_struct wake_txqs_tasklet; 1276f0706e82SJiri Benc 1277a6a67db2SJohannes Berg atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; 1278cd8ffc80SJohannes Berg 1279df140465SJohannes Berg /* number of interfaces with allmulti RX */ 1280df140465SJohannes Berg atomic_t iff_allmultis; 1281f0706e82SJiri Benc 1282f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 1283f0706e82SJiri Benc 12845fdb3735SArd Biesheuvel struct arc4_ctx wep_tx_ctx; 12855fdb3735SArd Biesheuvel struct arc4_ctx wep_rx_ctx; 1286f0706e82SJiri Benc u32 wep_iv; 1287f0706e82SJiri Benc 1288c771c9d8SJohannes Berg /* see iface.c */ 128979010420SJohannes Berg struct list_head interfaces; 1290f64331d5SJohannes Berg struct list_head mon_list; /* only that are IFF_UP && !cooked */ 1291c771c9d8SJohannes Berg struct mutex iflist_mtx; 129279010420SJohannes Berg 1293b16bd15cSJohannes Berg /* 1294ad0e2b5aSJohannes Berg * Key mutex, protects sdata's key_list and sta_info's 129596fc6efbSAlexander Wetzel * key pointers and ptk_idx (write access, they're RCU.) 1296b16bd15cSJohannes Berg */ 1297ad0e2b5aSJohannes Berg struct mutex key_mtx; 1298b16bd15cSJohannes Berg 1299a1699b75SJohannes Berg /* mutex for scan and work locking */ 1300a1699b75SJohannes Berg struct mutex mtx; 1301b16bd15cSJohannes Berg 1302c2b13452SJohannes Berg /* Scanning and BSS list */ 1303fbe9c429SHelmut Schaa unsigned long scanning; 13042a519311SJohannes Berg struct cfg80211_ssid scan_ssid; 13055ba63533SJohannes Berg struct cfg80211_scan_request *int_scan_req; 13066ea0a69cSJohannes Berg struct cfg80211_scan_request __rcu *scan_req; 1307c56ef672SDavid Spinadel struct ieee80211_scan_request *hw_scan_req; 13087ca15a0aSSimon Wunderlich struct cfg80211_chan_def scan_chandef; 130957fbcce3SJohannes Berg enum nl80211_band hw_scan_band; 1310f0706e82SJiri Benc int scan_channel_idx; 1311de95a54bSJohannes Berg int scan_ies_len; 1312c604b9f2SJohannes Berg int hw_scan_ies_bufsize; 13137947d3e0SAvraham Stern struct cfg80211_scan_info scan_info; 13148318d78aSJohannes Berg 131585a9994aSLuciano Coelho struct work_struct sched_scan_stopped_work; 13165260a5b2SJohannes Berg struct ieee80211_sub_if_data __rcu *sched_scan_sdata; 13176ea0a69cSJohannes Berg struct cfg80211_sched_scan_request __rcu *sched_scan_req; 1318a344d677SJohannes Berg u8 scan_addr[ETH_ALEN]; 131979f460caSLuciano Coelho 1320df13cce5SHelmut Schaa unsigned long leave_oper_channel_time; 1321977923b0SHelmut Schaa enum mac80211_scan_state next_scan_state; 1322f0706e82SJiri Benc struct delayed_work scan_work; 1323e2fd5dbcSJohannes Berg struct ieee80211_sub_if_data __rcu *scan_sdata; 132455de908aSJohannes Berg /* For backward compatibility only -- do not use */ 1325675a0b04SKarl Beldan struct cfg80211_chan_def _oper_chandef; 1326f0706e82SJiri Benc 1327b8bc4b0aSJohannes Berg /* Temporary remain-on-channel for off-channel operations */ 1328b8bc4b0aSJohannes Berg struct ieee80211_channel *tmp_channel; 1329b8bc4b0aSJohannes Berg 1330d01a1e65SMichal Kazior /* channel contexts */ 1331d01a1e65SMichal Kazior struct list_head chanctx_list; 1332d01a1e65SMichal Kazior struct mutex chanctx_mtx; 1333d01a1e65SMichal Kazior 1334c206ca67SJohannes Berg #ifdef CONFIG_MAC80211_LEDS 13358d5c2585SJohannes Berg struct led_trigger tx_led, rx_led, assoc_led, radio_led; 13368d5c2585SJohannes Berg struct led_trigger tpt_led; 13378d5c2585SJohannes Berg atomic_t tx_led_active, rx_led_active, assoc_led_active; 13388d5c2585SJohannes Berg atomic_t radio_led_active, tpt_led_active; 1339c206ca67SJohannes Berg struct tpt_led_trigger *tpt_led_trigger; 1340c206ca67SJohannes Berg #endif 1341c206ca67SJohannes Berg 1342c206ca67SJohannes Berg #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 1343f0706e82SJiri Benc /* SNMP counters */ 1344f0706e82SJiri Benc /* dot11CountersTable */ 1345f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 1346f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 1347f0706e82SJiri Benc u32 dot11FailedCount; 1348f0706e82SJiri Benc u32 dot11RetryCount; 1349f0706e82SJiri Benc u32 dot11MultipleRetryCount; 1350f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 1351f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 1352f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 1353f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 1354f0706e82SJiri Benc 1355f0706e82SJiri Benc /* TX/RX handler statistics */ 1356f0706e82SJiri Benc unsigned int tx_handlers_drop; 1357f0706e82SJiri Benc unsigned int tx_handlers_queued; 1358f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 1359f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 1360f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 1361f0706e82SJiri Benc unsigned int rx_handlers_drop; 1362f0706e82SJiri Benc unsigned int rx_handlers_queued; 1363f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 1364f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 1365f0706e82SJiri Benc unsigned int tx_expand_skb_head; 1366f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 1367f1160434SJohannes Berg unsigned int rx_expand_skb_head_defrag; 1368f0706e82SJiri Benc unsigned int rx_handlers_fragments; 1369f0706e82SJiri Benc unsigned int tx_status_drop; 1370f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 1371f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1372f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 1373f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1374f0706e82SJiri Benc 1375f0706e82SJiri Benc 1376f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 1377f0706e82SJiri Benc * multicast packets for power saving stations 1378f0706e82SJiri Benc */ 1379520eb820SKalle Valo 1380572e0012SKalle Valo bool pspolling; 1381965bedadSJohannes Berg /* 1382965bedadSJohannes Berg * PS can only be enabled when we have exactly one managed 1383965bedadSJohannes Berg * interface (and monitors) in PS, this then points there. 1384965bedadSJohannes Berg */ 1385965bedadSJohannes Berg struct ieee80211_sub_if_data *ps_sdata; 1386520eb820SKalle Valo struct work_struct dynamic_ps_enable_work; 1387520eb820SKalle Valo struct work_struct dynamic_ps_disable_work; 1388520eb820SKalle Valo struct timer_list dynamic_ps_timer; 13892b2c009eSJuuso Oikarinen struct notifier_block ifa_notifier; 1390a65240c1SJohannes Berg struct notifier_block ifa6_notifier; 1391f0706e82SJiri Benc 1392ff616381SJuuso Oikarinen /* 1393ff616381SJuuso Oikarinen * The dynamic ps timeout configured from user space via WEXT - 1394ff616381SJuuso Oikarinen * this will override whatever chosen by mac80211 internally. 1395ff616381SJuuso Oikarinen */ 1396ff616381SJuuso Oikarinen int dynamic_ps_forced_timeout; 1397ff616381SJuuso Oikarinen 13981ea6f9c0SJohannes Berg int user_power_level; /* in dBm, for all interfaces */ 13992bf30fabSJohannes Berg 14000f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode; 14010f78231bSJohannes Berg 1402f2753ddbSJohannes Berg struct work_struct restart_work; 1403f2753ddbSJohannes Berg 1404e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 1405e9f207f0SJiri Benc struct local_debugfsdentries { 14064b7679a5SJohannes Berg struct dentry *rcdir; 1407e9f207f0SJiri Benc struct dentry *keys; 1408e9f207f0SJiri Benc } debugfs; 1409276d9e82SJulius Niedworok bool force_tx_status; 1410e9f207f0SJiri Benc #endif 14114e6cbfd0SJohn W. Linville 14122eb278e0SJohannes Berg /* 14132eb278e0SJohannes Berg * Remain-on-channel support 14142eb278e0SJohannes Berg */ 1415aaa016ccSJohannes Berg struct delayed_work roc_work; 14162eb278e0SJohannes Berg struct list_head roc_list; 141721f83589SJohannes Berg struct work_struct hw_roc_start, hw_roc_done; 14182eb278e0SJohannes Berg unsigned long hw_roc_start_time; 141950febf6aSJohannes Berg u64 roc_cookie_counter; 142021f83589SJohannes Berg 1421a729cff8SJohannes Berg struct idr ack_status_frames; 1422a729cff8SJohannes Berg spinlock_t ack_status_lock; 1423a729cff8SJohannes Berg 1424f142c6b9SJohannes Berg struct ieee80211_sub_if_data __rcu *p2p_sdata; 1425f142c6b9SJohannes Berg 14264b6f1dd6SJohannes Berg /* virtual monitor interface */ 14274b6f1dd6SJohannes Berg struct ieee80211_sub_if_data __rcu *monitor_sdata; 14284bf88530SJohannes Berg struct cfg80211_chan_def monitor_chandef; 1429e9a21949SLuciano Coelho 1430e9a21949SLuciano Coelho /* extended capabilities provided by mac80211 */ 1431e9a21949SLuciano Coelho u8 ext_capa[8]; 1432c8ff71e6SArik Nemtsov 1433c8ff71e6SArik Nemtsov /* TDLS channel switch */ 1434c8ff71e6SArik Nemtsov struct work_struct tdls_chsw_work; 1435c8ff71e6SArik Nemtsov struct sk_buff_head skb_queue_tdls_chsw; 1436f0706e82SJiri Benc }; 1437f0706e82SJiri Benc 14383e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 14393e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) 14403e122be0SJohannes Berg { 14413e122be0SJohannes Berg return netdev_priv(dev); 14423e122be0SJohannes Berg } 14433e122be0SJohannes Berg 144471bbc994SJohannes Berg static inline struct ieee80211_sub_if_data * 144571bbc994SJohannes Berg IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev) 144671bbc994SJohannes Berg { 144771bbc994SJohannes Berg return container_of(wdev, struct ieee80211_sub_if_data, wdev); 144871bbc994SJohannes Berg } 144971bbc994SJohannes Berg 145021a8e9ddSMohammed Shafi Shajakhan static inline struct ieee80211_supported_band * 145121a8e9ddSMohammed Shafi Shajakhan ieee80211_get_sband(struct ieee80211_sub_if_data *sdata) 145221a8e9ddSMohammed Shafi Shajakhan { 145321a8e9ddSMohammed Shafi Shajakhan struct ieee80211_local *local = sdata->local; 145421a8e9ddSMohammed Shafi Shajakhan struct ieee80211_chanctx_conf *chanctx_conf; 145521a8e9ddSMohammed Shafi Shajakhan enum nl80211_band band; 145621a8e9ddSMohammed Shafi Shajakhan 145721a8e9ddSMohammed Shafi Shajakhan rcu_read_lock(); 145821a8e9ddSMohammed Shafi Shajakhan chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 145921a8e9ddSMohammed Shafi Shajakhan 146056357234SYibo Zhao if (WARN_ON_ONCE(!chanctx_conf)) { 146121a8e9ddSMohammed Shafi Shajakhan rcu_read_unlock(); 146221a8e9ddSMohammed Shafi Shajakhan return NULL; 146321a8e9ddSMohammed Shafi Shajakhan } 146421a8e9ddSMohammed Shafi Shajakhan 146521a8e9ddSMohammed Shafi Shajakhan band = chanctx_conf->def.chan->band; 146621a8e9ddSMohammed Shafi Shajakhan rcu_read_unlock(); 146721a8e9ddSMohammed Shafi Shajakhan 146821a8e9ddSMohammed Shafi Shajakhan return local->hw.wiphy->bands[band]; 146921a8e9ddSMohammed Shafi Shajakhan } 147021a8e9ddSMohammed Shafi Shajakhan 1471c0f17eb9SChun-Yeow Yeoh /* this struct holds the value parsing from channel switch IE */ 1472c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie { 1473c0f17eb9SChun-Yeow Yeoh struct cfg80211_chan_def chandef; 1474c0f17eb9SChun-Yeow Yeoh u8 mode; 1475c0f17eb9SChun-Yeow Yeoh u8 count; 1476c0f17eb9SChun-Yeow Yeoh u8 ttl; 14773f718fd8SChun-Yeow Yeoh u16 pre_value; 14785d55371bSBenjamin Berg u16 reason_code; 1479ee145775SSara Sharon u32 max_switch_time; 1480c0f17eb9SChun-Yeow Yeoh }; 1481c0f17eb9SChun-Yeow Yeoh 1482dd76986bSJohannes Berg /* Parsed Information Elements */ 1483dd76986bSJohannes Berg struct ieee802_11_elems { 14844a3cb702SJohannes Berg const u8 *ie_start; 1485dd76986bSJohannes Berg size_t total_len; 1486dd76986bSJohannes Berg 1487dd76986bSJohannes Berg /* pointers to IEs */ 148853837584SArik Nemtsov const struct ieee80211_tdls_lnkie *lnk_id; 148953837584SArik Nemtsov const struct ieee80211_ch_switch_timing *ch_sw_timing; 14909041c1faSArik Nemtsov const u8 *ext_capab; 14914a3cb702SJohannes Berg const u8 *ssid; 14924a3cb702SJohannes Berg const u8 *supp_rates; 14934a3cb702SJohannes Berg const u8 *ds_params; 14944a3cb702SJohannes Berg const struct ieee80211_tim_ie *tim; 14954a3cb702SJohannes Berg const u8 *challenge; 14964a3cb702SJohannes Berg const u8 *rsn; 1497c0058df7SShaul Triebitz const u8 *rsnx; 14984a3cb702SJohannes Berg const u8 *erp_info; 14994a3cb702SJohannes Berg const u8 *ext_supp_rates; 15004a3cb702SJohannes Berg const u8 *wmm_info; 15014a3cb702SJohannes Berg const u8 *wmm_param; 15024a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_elem; 15034a3cb702SJohannes Berg const struct ieee80211_ht_operation *ht_operation; 15044a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_elem; 15054a3cb702SJohannes Berg const struct ieee80211_vht_operation *vht_operation; 15064a3cb702SJohannes Berg const struct ieee80211_meshconf_ie *mesh_config; 150741cbb0f5SLuca Coelho const u8 *he_cap; 150841cbb0f5SLuca Coelho const struct ieee80211_he_operation *he_operation; 1509ef11a931SJohn Crispin const struct ieee80211_he_spr *he_spr; 151041cbb0f5SLuca Coelho const struct ieee80211_mu_edca_param_set *mu_edca_param_set; 1511a6cf28e0SRajkumar Manoharan const struct ieee80211_he_6ghz_capa *he_6ghz_capa; 151241cbb0f5SLuca Coelho const u8 *uora_element; 15134a3cb702SJohannes Berg const u8 *mesh_id; 15144a3cb702SJohannes Berg const u8 *peering; 15154a3cb702SJohannes Berg const __le16 *awake_window; 15164a3cb702SJohannes Berg const u8 *preq; 15174a3cb702SJohannes Berg const u8 *prep; 15184a3cb702SJohannes Berg const u8 *perr; 15194a3cb702SJohannes Berg const struct ieee80211_rann_ie *rann; 15204a3cb702SJohannes Berg const struct ieee80211_channel_sw_ie *ch_switch_ie; 1521b4f286a1SJohannes Berg const struct ieee80211_ext_chansw_ie *ext_chansw_ie; 1522b2e506bfSJohannes Berg const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie; 1523ee145775SSara Sharon const u8 *max_channel_switch_time; 15244a3cb702SJohannes Berg const u8 *country_elem; 15254a3cb702SJohannes Berg const u8 *pwr_constr_elem; 1526c8d65917SSteinar H. Gunderson const u8 *cisco_dtpc_elem; 152779ba1d89SJohannes Berg const struct ieee80211_timeout_interval_ie *timeout_int; 15284a3cb702SJohannes Berg const u8 *opmode_notif; 152985220d71SJohannes Berg const struct ieee80211_sec_chan_offs_ie *sec_chan_offs; 1530c4de37eeSPeter Oh struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie; 1531e38a017bSAvraham Stern const struct ieee80211_bss_max_idle_period_ie *max_idle_period_ie; 153278ac51f8SSara Sharon const struct ieee80211_multiple_bssid_configuration *mbssid_config_ie; 153378ac51f8SSara Sharon const struct ieee80211_bssid_index *bssid_index; 153478ac51f8SSara Sharon u8 max_bssid_indicator; 153578ac51f8SSara Sharon u8 dtim_count; 153678ac51f8SSara Sharon u8 dtim_period; 15372aa485e1SJohn Crispin const struct ieee80211_addba_ext_ie *addba_ext_ie; 1538*cd418ba6SThomas Pedersen const struct ieee80211_s1g_cap *s1g_capab; 1539*cd418ba6SThomas Pedersen const struct ieee80211_s1g_oper_ie *s1g_oper; 1540*cd418ba6SThomas Pedersen const struct ieee80211_s1g_bcn_compat_ie *s1g_bcn_compat; 1541dd76986bSJohannes Berg 1542dd76986bSJohannes Berg /* length of them, respectively */ 15439041c1faSArik Nemtsov u8 ext_capab_len; 1544dd76986bSJohannes Berg u8 ssid_len; 1545dd76986bSJohannes Berg u8 supp_rates_len; 1546dd76986bSJohannes Berg u8 tim_len; 1547dd76986bSJohannes Berg u8 challenge_len; 1548dd76986bSJohannes Berg u8 rsn_len; 1549c0058df7SShaul Triebitz u8 rsnx_len; 1550dd76986bSJohannes Berg u8 ext_supp_rates_len; 1551dd76986bSJohannes Berg u8 wmm_info_len; 1552dd76986bSJohannes Berg u8 wmm_param_len; 155341cbb0f5SLuca Coelho u8 he_cap_len; 1554dd76986bSJohannes Berg u8 mesh_id_len; 1555dd76986bSJohannes Berg u8 peering_len; 1556dd76986bSJohannes Berg u8 preq_len; 1557dd76986bSJohannes Berg u8 prep_len; 1558dd76986bSJohannes Berg u8 perr_len; 1559dd76986bSJohannes Berg u8 country_elem_len; 156078ac51f8SSara Sharon u8 bssid_index_len; 1561fcff4f10SPaul Stewart 1562fcff4f10SPaul Stewart /* whether a parse error occurred while retrieving these elements */ 1563fcff4f10SPaul Stewart bool parse_error; 1564dd76986bSJohannes Berg }; 1565dd76986bSJohannes Berg 1566f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 1567f0706e82SJiri Benc struct ieee80211_hw *hw) 1568f0706e82SJiri Benc { 1569f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 1570f0706e82SJiri Benc } 1571f0706e82SJiri Benc 1572ba8c3d6fSFelix Fietkau static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq) 1573ba8c3d6fSFelix Fietkau { 1574ba8c3d6fSFelix Fietkau return container_of(txq, struct txq_info, txq); 1575ba8c3d6fSFelix Fietkau } 1576f0706e82SJiri Benc 1577bb42f2d1SToke Høiland-Jørgensen static inline bool txq_has_queue(struct ieee80211_txq *txq) 1578bb42f2d1SToke Høiland-Jørgensen { 1579bb42f2d1SToke Høiland-Jørgensen struct txq_info *txqi = to_txq_info(txq); 1580bb42f2d1SToke Høiland-Jørgensen 1581bb42f2d1SToke Høiland-Jørgensen return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets); 1582bb42f2d1SToke Høiland-Jørgensen } 1583bb42f2d1SToke Høiland-Jørgensen 1584571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) 1585571ecf67SJohannes Berg { 1586b203ca39SJoe Perches return ether_addr_equal(raddr, addr) || 1587571ecf67SJohannes Berg is_broadcast_ether_addr(raddr); 1588571ecf67SJohannes Berg } 1589571ecf67SJohannes Berg 1590f4bda337SThomas Pedersen static inline bool 1591f4bda337SThomas Pedersen ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) 1592f4bda337SThomas Pedersen { 1593f4bda337SThomas Pedersen WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START && 1594f4bda337SThomas Pedersen status->flag & RX_FLAG_MACTIME_END); 1595f4a0f0c5SJohannes Berg if (status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END)) 1596f4a0f0c5SJohannes Berg return true; 1597da6a4352SJohannes Berg /* can't handle non-legacy preamble yet */ 1598f4a0f0c5SJohannes Berg if (status->flag & RX_FLAG_MACTIME_PLCP_START && 1599204a7dbcSAvraham Stern status->encoding == RX_ENC_LEGACY) 1600f4a0f0c5SJohannes Berg return true; 1601f4a0f0c5SJohannes Berg return false; 1602f4bda337SThomas Pedersen } 1603571ecf67SJohannes Berg 160472f15d53SMichael Braun void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata); 160572f15d53SMichael Braun void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata); 160672f15d53SMichael Braun 160772f15d53SMichael Braun /* This function returns the number of multicast stations connected to this 160872f15d53SMichael Braun * interface. It returns -1 if that number is not tracked, that is for netdevs 160972f15d53SMichael Braun * not in AP or AP_VLAN mode or when using 4addr. 161072f15d53SMichael Braun */ 161172f15d53SMichael Braun static inline int 161272f15d53SMichael Braun ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata) 161372f15d53SMichael Braun { 161472f15d53SMichael Braun if (sdata->vif.type == NL80211_IFTYPE_AP) 161572f15d53SMichael Braun return atomic_read(&sdata->u.ap.num_mcast_sta); 161672f15d53SMichael Braun if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta) 161772f15d53SMichael Braun return atomic_read(&sdata->u.vlan.num_mcast_sta); 161872f15d53SMichael Braun return -1; 161972f15d53SMichael Braun } 162072f15d53SMichael Braun 1621f4bda337SThomas Pedersen u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, 1622f4bda337SThomas Pedersen struct ieee80211_rx_status *status, 1623f4bda337SThomas Pedersen unsigned int mpdu_len, 1624f4bda337SThomas Pedersen unsigned int mpdu_offset); 1625e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 16265cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 16279c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 16289c6bd790SJohannes Berg u32 changed); 16290d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local); 163046900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 1631f0706e82SJiri Benc 1632a2fcfccbSJohannes Berg u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local); 16335ee00dbdSJohannes Berg int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb, 16345ee00dbdSJohannes Berg u64 *cookie, gfp_t gfp); 1635a2fcfccbSJohannes Berg 163649ddf8e6SJohannes Berg void ieee80211_check_fast_rx(struct sta_info *sta); 163749ddf8e6SJohannes Berg void __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata); 163849ddf8e6SJohannes Berg void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata); 163949ddf8e6SJohannes Berg void ieee80211_clear_fast_rx(struct sta_info *sta); 164049ddf8e6SJohannes Berg 164146900298SJohannes Berg /* STA code */ 16429c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 164377fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, 164477fdaa12SJohannes Berg struct cfg80211_auth_request *req); 164577fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 164677fdaa12SJohannes Berg struct cfg80211_assoc_request *req); 164777fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, 164863c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 164977fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 165063c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 1651572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local, 1652572e0012SKalle Valo struct ieee80211_sub_if_data *sdata); 16534a733ef1SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local); 1654ab095877SEliad Peller void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata); 16552b2c009eSJuuso Oikarinen int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); 16561fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); 16571fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 16581fa57d01SJohannes Berg struct sk_buff *skb); 1659d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); 1660be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); 1661afa762f6SEliad Peller void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); 16621672c0e3SJohannes Berg void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata, 16631672c0e3SJohannes Berg __le16 fc, bool acked); 16641a1cb744SJohannes Berg void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata); 1665b8360ab8SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); 166602219b3aSJohannes Berg void ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data *sdata); 16679c6bd790SJohannes Berg 166846900298SJohannes Berg /* IBSS code */ 166946900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); 167046900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); 16718bf11d8dSJohannes Berg void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, 16728bf11d8dSJohannes Berg const u8 *bssid, const u8 *addr, u32 supp_rates); 1673af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 1674af8cdcd8SJohannes Berg struct cfg80211_ibss_params *params); 1675af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); 16761fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata); 16771fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 16781fa57d01SJohannes Berg struct sk_buff *skb); 1679cd7760e6SSimon Wunderlich int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata, 1680cd7760e6SSimon Wunderlich struct cfg80211_csa_settings *csa_settings); 1681cd7760e6SSimon Wunderlich int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata); 1682cd7760e6SSimon Wunderlich void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata); 16831fa57d01SJohannes Berg 1684239281f8SRostislav Lisovy /* OCB code */ 1685239281f8SRostislav Lisovy void ieee80211_ocb_work(struct ieee80211_sub_if_data *sdata); 1686239281f8SRostislav Lisovy void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata, 1687239281f8SRostislav Lisovy const u8 *bssid, const u8 *addr, u32 supp_rates); 1688239281f8SRostislav Lisovy void ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data *sdata); 1689239281f8SRostislav Lisovy int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata, 1690239281f8SRostislav Lisovy struct ocb_setup *setup); 1691239281f8SRostislav Lisovy int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata); 1692239281f8SRostislav Lisovy 16931fa57d01SJohannes Berg /* mesh code */ 16941fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata); 16951fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 16961fa57d01SJohannes Berg struct sk_buff *skb); 1697b8456a14SChun-Yeow Yeoh int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata, 169866e01cf9SLuciano Coelho struct cfg80211_csa_settings *csa_settings); 1699b8456a14SChun-Yeow Yeoh int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata); 170046900298SJohannes Berg 17019c6bd790SJohannes Berg /* scan/BSS handling */ 170246900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work); 170334bcf715SStanislaw Gruszka int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, 1704be4a4b6aSJohannes Berg const u8 *ssid, u8 ssid_len, 170576bed0f4SJanusz.Dziedzic@tieto.com struct ieee80211_channel **channels, 170676bed0f4SJanusz.Dziedzic@tieto.com unsigned int n_channels, 17077ca15a0aSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 1708c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 17092a519311SJohannes Berg struct cfg80211_scan_request *req); 17105bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local); 1711133d40f9SStanislaw Gruszka void ieee80211_run_deferred_scan(struct ieee80211_local *local); 1712d48b2968SJohannes Berg void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb); 17139c6bd790SJohannes Berg 17140a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 1715c2b13452SJohannes Berg struct ieee80211_bss * 171698c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local, 171798c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status, 171898c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt, 171998c8fccfSJohannes Berg size_t len, 1720d45c4172SEmmanuel Grumbach struct ieee80211_channel *channel); 172198c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local, 1722c2b13452SJohannes Berg struct ieee80211_bss *bss); 1723ee385855SLuis Carlos Cobo 172479f460caSLuciano Coelho /* scheduled scan handling */ 1725d43c6b6eSDavid Spinadel int 1726d43c6b6eSDavid Spinadel __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 1727d43c6b6eSDavid Spinadel struct cfg80211_sched_scan_request *req); 172879f460caSLuciano Coelho int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 172979f460caSLuciano Coelho struct cfg80211_sched_scan_request *req); 17300d440ea2SEliad Peller int ieee80211_request_sched_scan_stop(struct ieee80211_local *local); 1731f6837ba8SJohannes Berg void ieee80211_sched_scan_end(struct ieee80211_local *local); 173285a9994aSLuciano Coelho void ieee80211_sched_scan_stopped_work(struct work_struct *work); 173379f460caSLuciano Coelho 1734a2fcfccbSJohannes Berg /* off-channel/mgmt-tx */ 1735aacde9eeSStanislaw Gruszka void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local); 1736aacde9eeSStanislaw Gruszka void ieee80211_offchannel_return(struct ieee80211_local *local); 17372eb278e0SJohannes Berg void ieee80211_roc_setup(struct ieee80211_local *local); 17382eb278e0SJohannes Berg void ieee80211_start_next_roc(struct ieee80211_local *local); 1739c8f994eeSJohannes Berg void ieee80211_roc_purge(struct ieee80211_local *local, 1740c8f994eeSJohannes Berg struct ieee80211_sub_if_data *sdata); 1741a2fcfccbSJohannes Berg int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev, 1742a2fcfccbSJohannes Berg struct ieee80211_channel *chan, 1743a2fcfccbSJohannes Berg unsigned int duration, u64 *cookie); 1744a2fcfccbSJohannes Berg int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy, 1745a2fcfccbSJohannes Berg struct wireless_dev *wdev, u64 cookie); 1746a2fcfccbSJohannes Berg int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev, 1747a2fcfccbSJohannes Berg struct cfg80211_mgmt_tx_params *params, u64 *cookie); 1748a2fcfccbSJohannes Berg int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy, 1749a2fcfccbSJohannes Berg struct wireless_dev *wdev, u64 cookie); 1750b203ffc3SJouni Malinen 175173da7d5bSSimon Wunderlich /* channel switch handling */ 175273da7d5bSSimon Wunderlich void ieee80211_csa_finalize_work(struct work_struct *work); 175382a8e17dSLuciano Coelho int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 175482a8e17dSLuciano Coelho struct cfg80211_csa_settings *params); 175573da7d5bSSimon Wunderlich 17563e122be0SJohannes Berg /* interface handling */ 175707b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \ 175807b83d2eSJohannes Berg NETIF_F_HW_CSUM | NETIF_F_SG | \ 175907b83d2eSJohannes Berg NETIF_F_HIGHDMA | NETIF_F_GSO_SOFTWARE) 176007b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES_RX (NETIF_F_RXCSUM) 176107b83d2eSJohannes Berg #define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \ 176207b83d2eSJohannes Berg MAC80211_SUPPORTED_FEATURES_RX) 176307b83d2eSJohannes Berg 176447846c9bSJohannes Berg int ieee80211_iface_init(void); 176547846c9bSJohannes Berg void ieee80211_iface_exit(void); 17663e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 17676bab2e19STom Gundersen unsigned char name_assign_type, 176884efbb84SJohannes Berg struct wireless_dev **new_wdev, enum nl80211_iftype type, 1769ee385855SLuis Carlos Cobo struct vif_params *params); 1770f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 177105c914feSJohannes Berg enum nl80211_iftype type); 1772f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 177375636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 1774382a103bSJohannes Berg u32 ieee80211_idle_off(struct ieee80211_local *local); 17755cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local); 177685416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, 177785416a4fSChristian Lamparter const int offset); 1778f142c6b9SJohannes Berg int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up); 1779f142c6b9SJohannes Berg void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); 17803c3e21e7SJohannes Berg int ieee80211_add_virtual_monitor(struct ieee80211_local *local); 17813c3e21e7SJohannes Berg void ieee80211_del_virtual_monitor(struct ieee80211_local *local); 1782f0706e82SJiri Benc 17831ea6f9c0SJohannes Berg bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 1784db82d8a9SLorenzo Bianconi void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata, 1785db82d8a9SLorenzo Bianconi bool update_bss); 17866aea26ceSFelix Fietkau void ieee80211_recalc_offload(struct ieee80211_local *local); 17871ea6f9c0SJohannes Berg 17889607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) 17899607e6b6SJohannes Berg { 179034d4bc4dSJohannes Berg return test_bit(SDATA_STATE_RUNNING, &sdata->state); 17919607e6b6SJohannes Berg } 17929607e6b6SJohannes Berg 1793e2ebc74dSJohannes Berg /* tx handling */ 1794e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 1795e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data); 1796d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1797d0cf9c0dSStephen Hemminger struct net_device *dev); 1798d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, 1799d0cf9c0dSStephen Hemminger struct net_device *dev); 180050ff477aSJohn Crispin netdev_tx_t ieee80211_subif_start_xmit_8023(struct sk_buff *skb, 180150ff477aSJohn Crispin struct net_device *dev); 180224d342c5SLiad Kaufman void __ieee80211_subif_start_xmit(struct sk_buff *skb, 180324d342c5SLiad Kaufman struct net_device *dev, 180406016772SRajkumar Manoharan u32 info_flags, 1805a7528198SMarkus Theil u32 ctrl_flags, 1806a7528198SMarkus Theil u64 *cookie); 18071f98ab7fSFelix Fietkau void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, 18081f98ab7fSFelix Fietkau struct sk_buff_head *skbs); 18097528ec57SJohannes Berg struct sk_buff * 18107528ec57SJohannes Berg ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, 18117528ec57SJohannes Berg struct sk_buff *skb, u32 info_flags); 18124dc792b8SHelmut Schaa void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb, 18134dc792b8SHelmut Schaa struct ieee80211_supported_band *sband, 1814b7b2e8caSJohn Crispin int retry_count, int shift, bool send_to_cooked, 1815b7b2e8caSJohn Crispin struct ieee80211_tx_status *status); 1816e2ebc74dSJohannes Berg 181717c18bf8SJohannes Berg void ieee80211_check_fast_xmit(struct sta_info *sta); 181817c18bf8SJohannes Berg void ieee80211_check_fast_xmit_all(struct ieee80211_local *local); 181917c18bf8SJohannes Berg void ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata); 182017c18bf8SJohannes Berg void ieee80211_clear_fast_xmit(struct sta_info *sta); 182191180649SDenis Kenzior int ieee80211_tx_control_port(struct wiphy *wiphy, struct net_device *dev, 182291180649SDenis Kenzior const u8 *buf, size_t len, 1823dca9ca2dSMarkus Theil const u8 *dest, __be16 proto, bool unencrypted, 1824dca9ca2dSMarkus Theil u64 *cookie); 18258828f81aSRajkumar Manoharan int ieee80211_probe_mesh_link(struct wiphy *wiphy, struct net_device *dev, 18268828f81aSRajkumar Manoharan const u8 *buf, size_t len); 182717c18bf8SJohannes Berg 1828de1ede7aSJohannes Berg /* HT */ 1829ef96a842SBen Greear void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, 1830ef96a842SBen Greear struct ieee80211_sta_ht_cap *ht_cap); 1831e1a0c6b3SJohannes Berg bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, 1832ef96a842SBen Greear struct ieee80211_supported_band *sband, 18334a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_ie, 1834e1a0c6b3SJohannes Berg struct sta_info *sta); 1835b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, 1836b8695a8fSJohannes Berg const u8 *da, u16 tid, 1837b8695a8fSJohannes Berg u16 initiator, u16 reason_code); 18380f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, 18390f78231bSJohannes Berg enum ieee80211_smps_mode smps, const u8 *da, 18400f78231bSJohannes Berg const u8 *bssid); 1841687da132SEmmanuel Grumbach void ieee80211_request_smps_ap_work(struct work_struct *work); 1842687da132SEmmanuel Grumbach void ieee80211_request_smps_mgd_work(struct work_struct *work); 1843687da132SEmmanuel Grumbach bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old, 1844687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode_new); 1845de1ede7aSJohannes Berg 18467c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 184753f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1848849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 184953f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1850bde59c47SJohannes Berg void ___ieee80211_start_rx_ba_session(struct sta_info *sta, 1851bde59c47SJohannes Berg u8 dialog_token, u16 timeout, 1852bde59c47SJohannes Berg u16 start_seq_num, u16 ba_policy, u16 tid, 18532ab45876SJohn Crispin u16 buf_size, bool tx, bool auto_seq, 18542ab45876SJohn Crispin const struct ieee80211_addba_ext_ie *addbaext); 1855c82c4a80SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, 1856c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 1857de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, 1858de1ede7aSJohannes Berg struct sta_info *sta, 1859de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len); 1860de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local, 1861de1ede7aSJohannes Berg struct sta_info *sta, 1862de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1863de1ede7aSJohannes Berg size_t len); 1864de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local, 1865de1ede7aSJohannes Berg struct sta_info *sta, 1866de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1867de1ede7aSJohannes Berg size_t len); 1868de1ede7aSJohannes Berg 1869849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1870c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 187167c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1872c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 18737a7c0a64SJohannes Berg void ieee80211_start_tx_ba_cb(struct sta_info *sta, int tid, 18747a7c0a64SJohannes Berg struct tid_ampdu_tx *tid_tx); 18757a7c0a64SJohannes Berg void ieee80211_stop_tx_ba_cb(struct sta_info *sta, int tid, 18767a7c0a64SJohannes Berg struct tid_ampdu_tx *tid_tx); 187767c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work); 187867c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); 18792bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid); 1880849b7967SJohannes Berg 188104ecd257SJohannes Berg u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs); 188257566b20Stamizhr@codeaurora.org enum nl80211_smps_mode 188357566b20Stamizhr@codeaurora.org ieee80211_smps_mode_to_smps_mode(enum ieee80211_smps_mode smps); 188404ecd257SJohannes Berg 1885818255eaSMahesh Palivela /* VHT */ 18864a3cb702SJohannes Berg void 18874a3cb702SJohannes Berg ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, 1888818255eaSMahesh Palivela struct ieee80211_supported_band *sband, 18894a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_ie, 18904a34215eSJohannes Berg struct sta_info *sta); 18911c45c5ceSEliad Peller enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta); 1892e1a0c6b3SJohannes Berg enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); 18938921d04eSJohannes Berg void ieee80211_sta_set_rx_nss(struct sta_info *sta); 189459021c67SArik Nemtsov enum ieee80211_sta_rx_bandwidth 189559021c67SArik Nemtsov ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width); 189659021c67SArik Nemtsov enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta); 189759021c67SArik Nemtsov void ieee80211_sta_set_rx_nss(struct sta_info *sta); 189823a1f8d4SSara Sharon void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata, 189923a1f8d4SSara Sharon struct ieee80211_mgmt *mgmt); 1900b1bce14aSMarek Kwaczynski u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 1901b1bce14aSMarek Kwaczynski struct sta_info *sta, u8 opmode, 190257fbcce3SJohannes Berg enum nl80211_band band); 19030af83d3dSJohannes Berg void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 19040af83d3dSJohannes Berg struct sta_info *sta, u8 opmode, 190557fbcce3SJohannes Berg enum nl80211_band band); 1906dd5ecfeaSJohannes Berg void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, 1907dd5ecfeaSJohannes Berg struct ieee80211_sta_vht_cap *vht_cap); 1908b119ad6eSLorenzo Bianconi void ieee80211_get_vht_mask_from_cap(__le16 vht_cap, 1909b119ad6eSLorenzo Bianconi u16 vht_mask[NL80211_VHT_NSS_MAX]); 191097f5f425Stamizhr@codeaurora.org enum nl80211_chan_width 191197f5f425Stamizhr@codeaurora.org ieee80211_sta_rx_bw_to_chan_width(struct sta_info *sta); 19124a34215eSJohannes Berg 191341cbb0f5SLuca Coelho /* HE */ 191441cbb0f5SLuca Coelho void 191541cbb0f5SLuca Coelho ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata, 191641cbb0f5SLuca Coelho struct ieee80211_supported_band *sband, 191741cbb0f5SLuca Coelho const u8 *he_cap_ie, u8 he_cap_len, 19181bb9a8a4SJohannes Berg const struct ieee80211_he_6ghz_capa *he_6ghz_capa, 191941cbb0f5SLuca Coelho struct sta_info *sta); 19201ced169cSJohn Crispin void 19211ced169cSJohn Crispin ieee80211_he_spr_ie_to_bss_conf(struct ieee80211_vif *vif, 19221ced169cSJohn Crispin const struct ieee80211_he_spr *he_spr_ie_elem); 192341cbb0f5SLuca Coelho 1924697f6c50SJohn Crispin void 1925697f6c50SJohn Crispin ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif, 1926697f6c50SJohn Crispin const struct ieee80211_he_operation *he_op_ie_elem); 1927697f6c50SJohn Crispin 192839192c0bSJohannes Berg /* Spectrum management */ 192939192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 193039192c0bSJohannes Berg struct ieee80211_mgmt *mgmt, 193139192c0bSJohannes Berg size_t len); 1932e6b7cde4SSimon Wunderlich /** 1933e6b7cde4SSimon Wunderlich * ieee80211_parse_ch_switch_ie - parses channel switch IEs 1934e6b7cde4SSimon Wunderlich * @sdata: the sdata of the interface which has received the frame 1935e6b7cde4SSimon Wunderlich * @elems: parsed 802.11 elements received with the frame 1936e6b7cde4SSimon Wunderlich * @current_band: indicates the current band 19372a333a0dSJohannes Berg * @vht_cap_info: VHT capabilities of the transmitter 1938e6b7cde4SSimon Wunderlich * @sta_flags: contains information about own capabilities and restrictions 1939e6b7cde4SSimon Wunderlich * to decide which channel switch announcements can be accepted. Only the 1940e6b7cde4SSimon Wunderlich * following subset of &enum ieee80211_sta_flags are evaluated: 1941e6b7cde4SSimon Wunderlich * %IEEE80211_STA_DISABLE_HT, %IEEE80211_STA_DISABLE_VHT, 1942e6b7cde4SSimon Wunderlich * %IEEE80211_STA_DISABLE_40MHZ, %IEEE80211_STA_DISABLE_80P80MHZ, 1943e6b7cde4SSimon Wunderlich * %IEEE80211_STA_DISABLE_160MHZ. 1944e6b7cde4SSimon Wunderlich * @bssid: the currently connected bssid (for reporting) 1945c0f17eb9SChun-Yeow Yeoh * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl. 1946c0f17eb9SChun-Yeow Yeoh All of them will be filled with if success only. 1947e6b7cde4SSimon Wunderlich * Return: 0 on success, <0 on error and >0 if there is nothing to parse. 1948e6b7cde4SSimon Wunderlich */ 1949e6b7cde4SSimon Wunderlich int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, 195084469a45SLuciano Coelho struct ieee802_11_elems *elems, 195157fbcce3SJohannes Berg enum nl80211_band current_band, 19522a333a0dSJohannes Berg u32 vht_cap_info, 1953c0f17eb9SChun-Yeow Yeoh u32 sta_flags, u8 *bssid, 1954c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie *csa_ie); 195539192c0bSJohannes Berg 1956f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */ 1957f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local); 195884f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local); 1959f2753ddbSJohannes Berg 1960eecc4800SJohannes Berg int __ieee80211_suspend(struct ieee80211_hw *hw, 1961eecc4800SJohannes Berg struct cfg80211_wowlan *wowlan); 1962f2753ddbSJohannes Berg 1963f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 1964f2753ddbSJohannes Berg { 196585f72bc8SJohn W. Linville struct ieee80211_local *local = hw_to_local(hw); 196685f72bc8SJohn W. Linville 19679120d94eSLuciano Coelho WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) && 19689120d94eSLuciano Coelho !test_bit(SCAN_COMPLETED, &local->scanning), 196985f72bc8SJohn W. Linville "%s: resume with hardware scan still in progress\n", 197085f72bc8SJohn W. Linville wiphy_name(hw->wiphy)); 197185f72bc8SJohn W. Linville 1972f2753ddbSJohannes Berg return ieee80211_reconfig(hw_to_local(hw)); 1973f2753ddbSJohannes Berg } 1974665af4fcSBob Copeland 1975c2d1560aSJohannes Berg /* utility functions/constants */ 19768a47cea7SJohannes Berg extern const void *const mac80211_wiphy_privid; /* for wiphy privid */ 197757fbcce3SJohannes Berg int ieee80211_frame_duration(enum nl80211_band band, size_t len, 1978438b61b7SSimon Wunderlich int rate, int erp, int short_preamble, 1979438b61b7SSimon Wunderlich int shift); 1980e552af05SHaim Dreyfuss void ieee80211_regulatory_limit_wmm_params(struct ieee80211_sub_if_data *sdata, 1981e552af05SHaim Dreyfuss struct ieee80211_tx_queue_params *qparam, 1982e552af05SHaim Dreyfuss int ac); 19833abead59SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, 1984cec66283SJohannes Berg bool bss_notify, bool enable_qos); 19857c10770fSJohannes Berg void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, 198608aca29aSMathy Vanhoef struct sta_info *sta, struct sk_buff *skb); 1987cf6bb79aSHelmut Schaa 198855de908aSJohannes Berg void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 198955de908aSJohannes Berg struct sk_buff *skb, int tid, 199008aca29aSMathy Vanhoef enum nl80211_band band); 199155de908aSJohannes Berg 199250ff477aSJohn Crispin /* sta_out needs to be checked for ERR_PTR() before using */ 199350ff477aSJohn Crispin int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, 199450ff477aSJohn Crispin struct sk_buff *skb, 199550ff477aSJohn Crispin struct sta_info **sta_out); 199650ff477aSJohn Crispin 199755de908aSJohannes Berg static inline void 199855de908aSJohannes Berg ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 199955de908aSJohannes Berg struct sk_buff *skb, int tid, 200008aca29aSMathy Vanhoef enum nl80211_band band) 200155de908aSJohannes Berg { 200255de908aSJohannes Berg rcu_read_lock(); 200308aca29aSMathy Vanhoef __ieee80211_tx_skb_tid_band(sdata, skb, tid, band); 200455de908aSJohannes Berg rcu_read_unlock(); 200555de908aSJohannes Berg } 200655de908aSJohannes Berg 200755de908aSJohannes Berg static inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, 200855de908aSJohannes Berg struct sk_buff *skb, int tid) 200955de908aSJohannes Berg { 201055de908aSJohannes Berg struct ieee80211_chanctx_conf *chanctx_conf; 201155de908aSJohannes Berg 201255de908aSJohannes Berg rcu_read_lock(); 201355de908aSJohannes Berg chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 201455de908aSJohannes Berg if (WARN_ON(!chanctx_conf)) { 201555de908aSJohannes Berg rcu_read_unlock(); 201655de908aSJohannes Berg kfree_skb(skb); 201755de908aSJohannes Berg return; 201855de908aSJohannes Berg } 201955de908aSJohannes Berg 202055de908aSJohannes Berg __ieee80211_tx_skb_tid_band(sdata, skb, tid, 202108aca29aSMathy Vanhoef chanctx_conf->def.chan->band); 202255de908aSJohannes Berg rcu_read_unlock(); 202355de908aSJohannes Berg } 202455de908aSJohannes Berg 202555de908aSJohannes Berg static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, 2026cf6bb79aSHelmut Schaa struct sk_buff *skb) 2027cf6bb79aSHelmut Schaa { 2028cf6bb79aSHelmut Schaa /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */ 2029cf6bb79aSHelmut Schaa ieee80211_tx_skb_tid(sdata, skb, 7); 2030cf6bb79aSHelmut Schaa } 2031cf6bb79aSHelmut Schaa 203235d865afSJohannes Berg u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, 2033d91f36dbSJohannes Berg struct ieee802_11_elems *elems, 20344abb52a4SSara Sharon u64 filter, u32 crc, u8 *transmitter_bssid, 20354abb52a4SSara Sharon u8 *bss_bssid); 203635d865afSJohannes Berg static inline void ieee802_11_parse_elems(const u8 *start, size_t len, 203735d865afSJohannes Berg bool action, 20384abb52a4SSara Sharon struct ieee802_11_elems *elems, 20394abb52a4SSara Sharon u8 *transmitter_bssid, 20404abb52a4SSara Sharon u8 *bss_bssid) 2041ddc4db2eSJohannes Berg { 20424abb52a4SSara Sharon ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0, 20434abb52a4SSara Sharon transmitter_bssid, bss_bssid); 2044ddc4db2eSJohannes Berg } 2045ddc4db2eSJohannes Berg 204683eb935eSMichal Kazior 204702219b3aSJohannes Berg extern const int ieee802_1d_to_ac[8]; 204802219b3aSJohannes Berg 204902219b3aSJohannes Berg static inline int ieee80211_ac_from_tid(int tid) 205002219b3aSJohannes Berg { 205102219b3aSJohannes Berg return ieee802_1d_to_ac[tid & 7]; 205202219b3aSJohannes Berg } 205302219b3aSJohannes Berg 2054520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 2055520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 205634f11cd3SKees Cook void ieee80211_dynamic_ps_timer(struct timer_list *t); 2057a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local, 2058a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata, 2059076cdcb1SJohannes Berg bool powersave); 20604e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 206102219b3aSJohannes Berg struct ieee80211_hdr *hdr, bool ack, u16 tx_time); 2062520eb820SKalle Valo 2063ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 2064445ea4e8SJohannes Berg unsigned long queues, 2065cca07b00SLuciano Coelho enum queue_stop_reason reason, 2066cca07b00SLuciano Coelho bool refcounted); 206726da23b6SLuciano Coelho void ieee80211_stop_vif_queues(struct ieee80211_local *local, 206826da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata, 206926da23b6SLuciano Coelho enum queue_stop_reason reason); 207026da23b6SLuciano Coelho void ieee80211_wake_vif_queues(struct ieee80211_local *local, 207126da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata, 207226da23b6SLuciano Coelho enum queue_stop_reason reason); 2073ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 2074445ea4e8SJohannes Berg unsigned long queues, 2075cca07b00SLuciano Coelho enum queue_stop_reason reason, 2076cca07b00SLuciano Coelho bool refcounted); 207796f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 2078cca07b00SLuciano Coelho enum queue_stop_reason reason, 2079cca07b00SLuciano Coelho bool refcounted); 208096f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, 2081cca07b00SLuciano Coelho enum queue_stop_reason reason, 2082cca07b00SLuciano Coelho bool refcounted); 20833a25a8c8SJohannes Berg void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); 20848f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local, 20858f77f384SJohannes Berg struct sk_buff *skb); 2086e3685e03SJohannes Berg void ieee80211_add_pending_skbs(struct ieee80211_local *local, 2087e3685e03SJohannes Berg struct sk_buff_head *skbs); 208839ecc01dSJohannes Berg void ieee80211_flush_queues(struct ieee80211_local *local, 20893b24f4c6SEmmanuel Grumbach struct ieee80211_sub_if_data *sdata, bool drop); 20904f9610d5SLiad Kaufman void __ieee80211_flush_queues(struct ieee80211_local *local, 20914f9610d5SLiad Kaufman struct ieee80211_sub_if_data *sdata, 20923b24f4c6SEmmanuel Grumbach unsigned int queues, bool drop); 2093ce7c9111SKalle Valo 20944afaff17SEmmanuel Grumbach static inline bool ieee80211_can_run_worker(struct ieee80211_local *local) 20954afaff17SEmmanuel Grumbach { 20964afaff17SEmmanuel Grumbach /* 2097f8891461SNaftali Goldstein * It's unsafe to try to do any work during reconfigure flow. 2098f8891461SNaftali Goldstein * When the flow ends the work will be requeued. 2099f8891461SNaftali Goldstein */ 2100f8891461SNaftali Goldstein if (local->in_reconfig) 2101f8891461SNaftali Goldstein return false; 2102f8891461SNaftali Goldstein 2103f8891461SNaftali Goldstein /* 21044afaff17SEmmanuel Grumbach * If quiescing is set, we are racing with __ieee80211_suspend. 21054afaff17SEmmanuel Grumbach * __ieee80211_suspend flushes the workers after setting quiescing, 21064afaff17SEmmanuel Grumbach * and we check quiescing / suspended before enqueing new workers. 21074afaff17SEmmanuel Grumbach * We should abort the worker to avoid the races below. 21084afaff17SEmmanuel Grumbach */ 21094afaff17SEmmanuel Grumbach if (local->quiescing) 21104afaff17SEmmanuel Grumbach return false; 21114afaff17SEmmanuel Grumbach 21124afaff17SEmmanuel Grumbach /* 21134afaff17SEmmanuel Grumbach * We might already be suspended if the following scenario occurs: 21144afaff17SEmmanuel Grumbach * __ieee80211_suspend Control path 21154afaff17SEmmanuel Grumbach * 21164afaff17SEmmanuel Grumbach * if (local->quiescing) 21174afaff17SEmmanuel Grumbach * return; 21184afaff17SEmmanuel Grumbach * local->quiescing = true; 21194afaff17SEmmanuel Grumbach * flush_workqueue(); 21204afaff17SEmmanuel Grumbach * queue_work(...); 21214afaff17SEmmanuel Grumbach * local->suspended = true; 21224afaff17SEmmanuel Grumbach * local->quiescing = false; 21234afaff17SEmmanuel Grumbach * worker starts running... 21244afaff17SEmmanuel Grumbach */ 21254afaff17SEmmanuel Grumbach if (local->suspended) 21264afaff17SEmmanuel Grumbach return false; 21274afaff17SEmmanuel Grumbach 21284afaff17SEmmanuel Grumbach return true; 21294afaff17SEmmanuel Grumbach } 21304afaff17SEmmanuel Grumbach 2131fa962b92SMichal Kazior int ieee80211_txq_setup_flows(struct ieee80211_local *local); 21322fe4a29aSToke Høiland-Jørgensen void ieee80211_txq_set_params(struct ieee80211_local *local); 2133fa962b92SMichal Kazior void ieee80211_txq_teardown_flows(struct ieee80211_local *local); 2134fa962b92SMichal Kazior void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata, 2135ba8c3d6fSFelix Fietkau struct sta_info *sta, 2136ba8c3d6fSFelix Fietkau struct txq_info *txq, int tid); 2137fa962b92SMichal Kazior void ieee80211_txq_purge(struct ieee80211_local *local, 2138fa962b92SMichal Kazior struct txq_info *txqi); 21392a9e2579SJohannes Berg void ieee80211_txq_remove_vlan(struct ieee80211_local *local, 21402a9e2579SJohannes Berg struct ieee80211_sub_if_data *sdata); 21412fe4a29aSToke Høiland-Jørgensen void ieee80211_fill_txq_stats(struct cfg80211_txq_stats *txqstats, 21422fe4a29aSToke Høiland-Jørgensen struct txq_info *txqi); 214321a5d4c3SManikanta Pubbisetty void ieee80211_wake_txqs(unsigned long data); 214446900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 2145700e8ea6SJouni Malinen u16 transaction, u16 auth_alg, u16 status, 21464a3cb702SJohannes Berg const u8 *extra, size_t extra_len, const u8 *bssid, 21471672c0e3SJohannes Berg const u8 *da, const u8 *key, u8 key_len, u8 key_idx, 21481672c0e3SJohannes Berg u32 tx_flags); 21496ae16775SAntonio Quartulli void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, 21504b08d1b6SJohannes Berg const u8 *da, const u8 *bssid, 21514b08d1b6SJohannes Berg u16 stype, u16 reason, 21526ae16775SAntonio Quartulli bool send_frame, u8 *frame_buf); 215300387f32SJohannes Berg 215400387f32SJohannes Berg enum { 215500387f32SJohannes Berg IEEE80211_PROBE_FLAG_DIRECTED = BIT(0), 2156b9771d41SJohannes Berg IEEE80211_PROBE_FLAG_MIN_CONTENT = BIT(1), 2157b9771d41SJohannes Berg IEEE80211_PROBE_FLAG_RANDOM_SN = BIT(2), 215800387f32SJohannes Berg }; 215900387f32SJohannes Berg 21602ad2274cSIlan Peer int ieee80211_build_preq_ies(struct ieee80211_sub_if_data *sdata, u8 *buffer, 2161c56ef672SDavid Spinadel size_t buffer_len, 2162c56ef672SDavid Spinadel struct ieee80211_scan_ies *ie_desc, 2163c56ef672SDavid Spinadel const u8 *ie, size_t ie_len, 2164c56ef672SDavid Spinadel u8 bands_used, u32 *rate_masks, 216500387f32SJohannes Berg struct cfg80211_chan_def *chandef, 216600387f32SJohannes Berg u32 flags); 2167a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 2168a344d677SJohannes Berg const u8 *src, const u8 *dst, 2169a344d677SJohannes Berg u32 ratemask, 21706b77863bSJohannes Berg struct ieee80211_channel *chan, 2171a619a4c0SJuuso Oikarinen const u8 *ssid, size_t ssid_len, 2172a806c558SPaul Stewart const u8 *ie, size_t ie_len, 217300387f32SJohannes Berg u32 flags); 21742103dec1SSimon Wunderlich u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, 217546900298SJohannes Berg struct ieee802_11_elems *elems, 217657fbcce3SJohannes Berg enum nl80211_band band, u32 *basic_rates); 2177687da132SEmmanuel Grumbach int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata, 2178687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode); 217904ecd257SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata); 218021f659bfSEliad Peller void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata); 218146900298SJohannes Berg 21828e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset); 2183ef96a842SBen Greear u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 218442e7aa77SAlexander Simon u16 cap); 2185074d46d1SJohannes Berg u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 21864bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 218757f255f5SArik Nemtsov u16 prot_mode, bool rifs_mode); 218875d627d5SSimon Wunderlich void ieee80211_ie_build_wide_bw_cs(u8 *pos, 218975d627d5SSimon Wunderlich const struct cfg80211_chan_def *chandef); 2190ba0afa2fSMahesh Palivela u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, 2191ba0afa2fSMahesh Palivela u32 cap); 2192fb28ec0cSArik Nemtsov u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, 2193fb28ec0cSArik Nemtsov const struct cfg80211_chan_def *chandef); 219460ad72daSSven Eckelmann u8 ieee80211_ie_len_he_cap(struct ieee80211_sub_if_data *sdata, u8 iftype); 219541cbb0f5SLuca Coelho u8 *ieee80211_ie_build_he_cap(u8 *pos, 219641cbb0f5SLuca Coelho const struct ieee80211_sta_he_cap *he_cap, 219741cbb0f5SLuca Coelho u8 *end); 219824a2042cSRajkumar Manoharan void ieee80211_ie_build_he_6ghz_cap(struct ieee80211_sub_if_data *sdata, 219924a2042cSRajkumar Manoharan struct sk_buff *skb); 2200d1b7524bSRajkumar Manoharan u8 *ieee80211_ie_build_he_oper(u8 *pos, struct cfg80211_chan_def *chandef); 22012103dec1SSimon Wunderlich int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, 22022103dec1SSimon Wunderlich const struct ieee80211_supported_band *sband, 22032103dec1SSimon Wunderlich const u8 *srates, int srates_len, u32 *rates); 2204fc8a7321SJohannes Berg int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, 22056b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 220657fbcce3SJohannes Berg enum nl80211_band band); 2207fc8a7321SJohannes Berg int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, 22086b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 220957fbcce3SJohannes Berg enum nl80211_band band); 221040b861a0SArik Nemtsov u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo); 22117957c6c8SThomas Pedersen void ieee80211_add_s1g_capab_ie(struct ieee80211_sub_if_data *sdata, 22127957c6c8SThomas Pedersen struct ieee80211_sta_s1g_cap *caps, 22137957c6c8SThomas Pedersen struct sk_buff *skb); 22148e664fb3SJohannes Berg 2215f444de05SJohannes Berg /* channel management */ 22168ac3c704SJohannes Berg bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper, 22174bf88530SJohannes Berg struct cfg80211_chan_def *chandef); 22182a333a0dSJohannes Berg bool ieee80211_chandef_vht_oper(struct ieee80211_hw *hw, u32 vht_cap_info, 22197eb26df2SJohannes Berg const struct ieee80211_vht_operation *oper, 22207eb26df2SJohannes Berg const struct ieee80211_ht_operation *htop, 2221abcff6efSJanusz.Dziedzic@tieto.com struct cfg80211_chan_def *chandef); 222257fa5e85SJohannes Berg bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata, 222357fa5e85SJohannes Berg const struct ieee80211_he_operation *he_oper, 222457fa5e85SJohannes Berg struct cfg80211_chan_def *chandef); 2225e6b7cde4SSimon Wunderlich u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c); 2226f444de05SJohannes Berg 2227d01a1e65SMichal Kazior int __must_check 2228d01a1e65SMichal Kazior ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, 22294bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 2230d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode); 22312c9b7359SJohannes Berg int __must_check 223211335a55SLuciano Coelho ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata, 223311335a55SLuciano Coelho const struct cfg80211_chan_def *chandef, 223409332481SMichal Kazior enum ieee80211_chanctx_mode mode, 223509332481SMichal Kazior bool radar_required); 223611335a55SLuciano Coelho int __must_check 22375bcae31dSMichal Kazior ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata); 223811335a55SLuciano Coelho int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata); 223911335a55SLuciano Coelho 224011335a55SLuciano Coelho int __must_check 22412c9b7359SJohannes Berg ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata, 22422c9b7359SJohannes Berg const struct cfg80211_chan_def *chandef, 22432c9b7359SJohannes Berg u32 *changed); 2244d01a1e65SMichal Kazior void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata); 22454d76d21bSJohannes Berg void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata); 22461f4ac5a6SJohannes Berg void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, 22471f4ac5a6SJohannes Berg bool clear); 2248c0166da9SMichal Kazior int ieee80211_chanctx_refcount(struct ieee80211_local *local, 2249c0166da9SMichal Kazior struct ieee80211_chanctx *ctx); 2250d01a1e65SMichal Kazior 225104ecd257SJohannes Berg void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, 225204ecd257SJohannes Berg struct ieee80211_chanctx *chanctx); 225321f659bfSEliad Peller void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 225421f659bfSEliad Peller struct ieee80211_chanctx *ctx); 22555cbc95a7SEliad Peller bool ieee80211_is_radar_required(struct ieee80211_local *local); 2256164eb02dSSimon Wunderlich 2257164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer(unsigned long data); 2258164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer_work(struct work_struct *work); 2259164eb02dSSimon Wunderlich void ieee80211_dfs_cac_cancel(struct ieee80211_local *local); 2260164eb02dSSimon Wunderlich void ieee80211_dfs_radar_detected_work(struct work_struct *work); 2261c6da674aSChun-Yeow Yeoh int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata, 2262c6da674aSChun-Yeow Yeoh struct cfg80211_csa_settings *csa_settings); 226304ecd257SJohannes Berg 22642475b1ccSMax Stepanov bool ieee80211_cs_valid(const struct ieee80211_cipher_scheme *cs); 22652475b1ccSMax Stepanov bool ieee80211_cs_list_valid(const struct ieee80211_cipher_scheme *cs, int n); 22662475b1ccSMax Stepanov const struct ieee80211_cipher_scheme * 22672475b1ccSMax Stepanov ieee80211_cs_get(struct ieee80211_local *local, u32 cipher, 22682475b1ccSMax Stepanov enum nl80211_iftype iftype); 22692475b1ccSMax Stepanov int ieee80211_cs_headroom(struct ieee80211_local *local, 22702475b1ccSMax Stepanov struct cfg80211_crypto_settings *crypto, 22712475b1ccSMax Stepanov enum nl80211_iftype iftype); 2272057d5f4bSThomas Pedersen void ieee80211_recalc_dtim(struct ieee80211_local *local, 2273057d5f4bSThomas Pedersen struct ieee80211_sub_if_data *sdata); 227473de86a3SLuciano Coelho int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, 227573de86a3SLuciano Coelho const struct cfg80211_chan_def *chandef, 227673de86a3SLuciano Coelho enum ieee80211_chanctx_mode chanmode, 227773de86a3SLuciano Coelho u8 radar_detect); 22786fa001bcSMichal Kazior int ieee80211_max_num_channels(struct ieee80211_local *local); 22790fabfaafSArik Nemtsov enum nl80211_chan_width ieee80211_get_sta_bw(struct ieee80211_sta *sta); 22800fabfaafSArik Nemtsov void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local, 22810fabfaafSArik Nemtsov struct ieee80211_chanctx *ctx); 22822475b1ccSMax Stepanov 228395224fe8SArik Nemtsov /* TDLS */ 228495224fe8SArik Nemtsov int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 22853b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 228695224fe8SArik Nemtsov u16 status_code, u32 peer_capability, 228731fa97c5SArik Nemtsov bool initiator, const u8 *extra_ies, 228831fa97c5SArik Nemtsov size_t extra_ies_len); 228995224fe8SArik Nemtsov int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, 22903b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 2291c10a1993SJohannes Berg void ieee80211_tdls_peer_del_work(struct work_struct *wk); 2292a7a6bdd0SArik Nemtsov int ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev, 2293a7a6bdd0SArik Nemtsov const u8 *addr, u8 oper_class, 2294a7a6bdd0SArik Nemtsov struct cfg80211_chan_def *chandef); 2295a7a6bdd0SArik Nemtsov void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy, 2296a7a6bdd0SArik Nemtsov struct net_device *dev, 2297a7a6bdd0SArik Nemtsov const u8 *addr); 2298d51c2ea3SArik Nemtsov void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata); 2299c8ff71e6SArik Nemtsov void ieee80211_tdls_chsw_work(struct work_struct *wk); 230079c92ca4SYu Wang void ieee80211_tdls_handle_disconnect(struct ieee80211_sub_if_data *sdata, 230179c92ca4SYu Wang const u8 *peer, u16 reason); 230279c92ca4SYu Wang const char *ieee80211_get_reason_code_string(u16 reason_code); 230395224fe8SArik Nemtsov 2304b7ffbd7eSJohannes Berg extern const struct ethtool_ops ieee80211_ethtool_ops; 2305b7ffbd7eSJohannes Berg 2306db3e1c40SToke Høiland-Jørgensen u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw, 2307db3e1c40SToke Høiland-Jørgensen struct ieee80211_vif *vif, 2308db3e1c40SToke Høiland-Jørgensen struct ieee80211_sta *pubsta, 23093ff901cbSFelix Fietkau int len, bool ampdu); 2310f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 2311d9e8a70fSJohannes Berg #define debug_noinline noinline 2312d9e8a70fSJohannes Berg #else 2313d9e8a70fSJohannes Berg #define debug_noinline 2314d9e8a70fSJohannes Berg #endif 2315d9e8a70fSJohannes Berg 2316f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 2317