1f0706e82SJiri Benc /* 2f0706e82SJiri Benc * Copyright 2002-2005, Instant802 Networks, Inc. 3f0706e82SJiri Benc * Copyright 2005, Devicescape Software, Inc. 4f0706e82SJiri Benc * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5026331c4SJouni Malinen * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net> 6f0706e82SJiri Benc * 7f0706e82SJiri Benc * This program is free software; you can redistribute it and/or modify 8f0706e82SJiri Benc * it under the terms of the GNU General Public License version 2 as 9f0706e82SJiri Benc * published by the Free Software Foundation. 10f0706e82SJiri Benc */ 11f0706e82SJiri Benc 12f0706e82SJiri Benc #ifndef IEEE80211_I_H 13f0706e82SJiri Benc #define IEEE80211_I_H 14f0706e82SJiri Benc 15f0706e82SJiri Benc #include <linux/kernel.h> 16f0706e82SJiri Benc #include <linux/device.h> 17f0706e82SJiri Benc #include <linux/if_ether.h> 18f0706e82SJiri Benc #include <linux/interrupt.h> 19f0706e82SJiri Benc #include <linux/list.h> 20f0706e82SJiri Benc #include <linux/netdevice.h> 21f0706e82SJiri Benc #include <linux/skbuff.h> 22f0706e82SJiri Benc #include <linux/workqueue.h> 23f0706e82SJiri Benc #include <linux/types.h> 24f0706e82SJiri Benc #include <linux/spinlock.h> 25571ecf67SJohannes Berg #include <linux/etherdevice.h> 26e1e54068SJohannes Berg #include <linux/leds.h> 27a729cff8SJohannes Berg #include <linux/idr.h> 28fe7a5d5cSJohannes Berg #include <net/ieee80211_radiotap.h> 2993da9cc1Scolin@cozybit.com #include <net/cfg80211.h> 3051cb6db0SDavid S. Miller #include <net/mac80211.h> 312c8dccc7SJohannes Berg #include "key.h" 32f0706e82SJiri Benc #include "sta_info.h" 33bdcbd8e0SJohannes Berg #include "debug.h" 34f0706e82SJiri Benc 359cfb0009SJohannes Berg struct ieee80211_local; 36f0706e82SJiri Benc 37f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the 38f0706e82SJiri Benc * associated stations are using power saving. */ 39f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128 40f0706e82SJiri Benc 41f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames. 42f0706e82SJiri Benc * Note: increasing this limit increases the potential memory requirement. Each 43f0706e82SJiri Benc * frame can be up to about 2 kB long. */ 44f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512 45f0706e82SJiri Benc 46f0706e82SJiri Benc /* Required encryption head and tailroom */ 47f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8 48765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18 49f0706e82SJiri Benc 50f0706e82SJiri Benc /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent 51f0706e82SJiri Benc * reception of at least three fragmented frames. This limit can be increased 52f0706e82SJiri Benc * by changing this define, at the cost of slower frame reassembly and 53f0706e82SJiri Benc * increased memory use (about 2 kB of RAM per entry). */ 54f0706e82SJiri Benc #define IEEE80211_FRAGMENT_MAX 4 55f0706e82SJiri Benc 561ea6f9c0SJohannes Berg /* power level hasn't been configured (or set to automatic) */ 571ea6f9c0SJohannes Berg #define IEEE80211_UNSET_POWER_LEVEL INT_MIN 581ea6f9c0SJohannes Berg 59d6a4ed6fSArik Nemtsov /* 60d6a4ed6fSArik Nemtsov * Some APs experience problems when working with U-APSD. Decrease the 61d6a4ed6fSArik Nemtsov * probability of that happening by using legacy mode for all ACs but VO. 62d6a4ed6fSArik Nemtsov * The AP that caused us trouble was a Cisco 4410N. It ignores our 63d6a4ed6fSArik Nemtsov * setting, and always treats non-VO ACs as legacy. 64d6a4ed6fSArik Nemtsov */ 65ab13315aSKalle Valo #define IEEE80211_DEFAULT_UAPSD_QUEUES \ 66d6a4ed6fSArik Nemtsov IEEE80211_WMM_IE_STA_QOSINFO_AC_VO 67ab13315aSKalle Valo 68ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN \ 69ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 70ab13315aSKalle Valo 716ae16775SAntonio Quartulli #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */) 726ae16775SAntonio Quartulli 73f0706e82SJiri Benc struct ieee80211_fragment_entry { 74f0706e82SJiri Benc unsigned long first_frag_time; 75f0706e82SJiri Benc unsigned int seq; 76f0706e82SJiri Benc unsigned int rx_queue; 77f0706e82SJiri Benc unsigned int last_frag; 78f0706e82SJiri Benc unsigned int extra_len; 79f0706e82SJiri Benc struct sk_buff_head skb_list; 80f0706e82SJiri Benc int ccmp; /* Whether fragments were encrypted with CCMP */ 81f0706e82SJiri Benc u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ 82f0706e82SJiri Benc }; 83f0706e82SJiri Benc 84f0706e82SJiri Benc 85c2b13452SJohannes Berg struct ieee80211_bss { 86ef429dadSJohannes Berg u32 device_ts_beacon, device_ts_presp; 878c358bcdSJohannes Berg 8843ac2ca3SJouni Malinen bool wmm_used; 89ab13315aSKalle Valo bool uapsd_supported; 9000d3f14cSJohannes Berg 91f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32 92f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 93f0706e82SJiri Benc size_t supp_rates_len; 94817cee76SAlexander Bondar struct ieee80211_rate *beacon_rate; 95f0706e82SJiri Benc 9600d3f14cSJohannes Berg /* 9725985edcSLucas De Marchi * During association, we save an ERP value from a probe response so 985628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 995628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 10000d3f14cSJohannes Berg * otherwise, you probably don't want to use them. 10100d3f14cSJohannes Berg */ 10200d3f14cSJohannes Berg bool has_erp_value; 1035628221cSDaniel Drake u8 erp_value; 104fcff4f10SPaul Stewart 105fcff4f10SPaul Stewart /* Keep track of the corruption of the last beacon/probe response. */ 106fcff4f10SPaul Stewart u8 corrupt_data; 107fcff4f10SPaul Stewart 108fcff4f10SPaul Stewart /* Keep track of what bits of information we have valid info for. */ 109fcff4f10SPaul Stewart u8 valid_data; 110fcff4f10SPaul Stewart }; 111fcff4f10SPaul Stewart 112fcff4f10SPaul Stewart /** 113fcff4f10SPaul Stewart * enum ieee80211_corrupt_data_flags - BSS data corruption flags 114fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted 115fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted 116fcff4f10SPaul Stewart * 117fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 118fcff4f10SPaul Stewart * @corrupt_data field of &struct ieee80211_bss. 119fcff4f10SPaul Stewart */ 120fcff4f10SPaul Stewart enum ieee80211_bss_corrupt_data_flags { 121fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_BEACON = BIT(0), 122fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1) 123fcff4f10SPaul Stewart }; 124fcff4f10SPaul Stewart 125fcff4f10SPaul Stewart /** 126fcff4f10SPaul Stewart * enum ieee80211_valid_data_flags - BSS valid data flags 127fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE 128fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE 129fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE 130fcff4f10SPaul Stewart * 131fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 132fcff4f10SPaul Stewart * @valid_data field of &struct ieee80211_bss. They show which parts 133fcff4f10SPaul Stewart * of the data structure were recieved as a result of an un-corrupted 134fcff4f10SPaul Stewart * beacon/probe response. 135fcff4f10SPaul Stewart */ 136fcff4f10SPaul Stewart enum ieee80211_bss_valid_data_flags { 137fcff4f10SPaul Stewart IEEE80211_BSS_VALID_WMM = BIT(1), 138fcff4f10SPaul Stewart IEEE80211_BSS_VALID_RATES = BIT(2), 139fcff4f10SPaul Stewart IEEE80211_BSS_VALID_ERP = BIT(3) 140f0706e82SJiri Benc }; 141f0706e82SJiri Benc 1429ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result; 1439ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1449ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1459ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1469ae54c84SJohannes Berg 1475cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1485cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1499ae54c84SJohannes Berg 1505cf121c3SJohannes Berg struct ieee80211_tx_data { 151f0706e82SJiri Benc struct sk_buff *skb; 152252b86c4SJohannes Berg struct sk_buff_head skbs; 153f0706e82SJiri Benc struct ieee80211_local *local; 154f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 155f0706e82SJiri Benc struct sta_info *sta; 156f0706e82SJiri Benc struct ieee80211_key *key; 1570d528d85SFelix Fietkau struct ieee80211_tx_rate rate; 1585cf121c3SJohannes Berg 159056cdd59SJohannes Berg unsigned int flags; 1605cf121c3SJohannes Berg }; 1615cf121c3SJohannes Berg 1625cf121c3SJohannes Berg 1635cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result; 1645cf121c3SJohannes Berg #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 1655cf121c3SJohannes Berg #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 1665cf121c3SJohannes Berg #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 1675cf121c3SJohannes Berg #define RX_QUEUED ((__force ieee80211_rx_result) 3u) 1685cf121c3SJohannes Berg 169554891e6SJohannes Berg /** 170554891e6SJohannes Berg * enum ieee80211_packet_rx_flags - packet RX flags 171554891e6SJohannes Berg * @IEEE80211_RX_RA_MATCH: frame is destined to interface currently processed 172554891e6SJohannes Berg * (incl. multicast frames) 173554891e6SJohannes Berg * @IEEE80211_RX_FRAGMENTED: fragmented frame 174554891e6SJohannes Berg * @IEEE80211_RX_AMSDU: a-MSDU packet 175554891e6SJohannes Berg * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed 1764cfda47bSChristian Lamparter * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering 177554891e6SJohannes Berg * 178554891e6SJohannes Berg * These are per-frame flags that are attached to a frame in the 179554891e6SJohannes Berg * @rx_flags field of &struct ieee80211_rx_status. 180554891e6SJohannes Berg */ 181554891e6SJohannes Berg enum ieee80211_packet_rx_flags { 182554891e6SJohannes Berg IEEE80211_RX_RA_MATCH = BIT(1), 183554891e6SJohannes Berg IEEE80211_RX_FRAGMENTED = BIT(2), 184554891e6SJohannes Berg IEEE80211_RX_AMSDU = BIT(3), 185554891e6SJohannes Berg IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4), 1864cfda47bSChristian Lamparter IEEE80211_RX_DEFERRED_RELEASE = BIT(5), 187554891e6SJohannes Berg }; 188554891e6SJohannes Berg 189554891e6SJohannes Berg /** 190554891e6SJohannes Berg * enum ieee80211_rx_flags - RX data flags 191554891e6SJohannes Berg * 192554891e6SJohannes Berg * @IEEE80211_RX_CMNTR: received on cooked monitor already 193ee971924SJohannes Berg * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported 194ee971924SJohannes Berg * to cfg80211_report_obss_beacon(). 195554891e6SJohannes Berg * 196554891e6SJohannes Berg * These flags are used across handling multiple interfaces 197554891e6SJohannes Berg * for a single frame. 198554891e6SJohannes Berg */ 199554891e6SJohannes Berg enum ieee80211_rx_flags { 200554891e6SJohannes Berg IEEE80211_RX_CMNTR = BIT(0), 201ee971924SJohannes Berg IEEE80211_RX_BEACON_REPORTED = BIT(1), 202554891e6SJohannes Berg }; 2035cf121c3SJohannes Berg 2045cf121c3SJohannes Berg struct ieee80211_rx_data { 2055cf121c3SJohannes Berg struct sk_buff *skb; 2065cf121c3SJohannes Berg struct ieee80211_local *local; 2075cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 2085cf121c3SJohannes Berg struct sta_info *sta; 2095cf121c3SJohannes Berg struct ieee80211_key *key; 210056cdd59SJohannes Berg 211056cdd59SJohannes Berg unsigned int flags; 2129e26297aSJohannes Berg 2139e26297aSJohannes Berg /* 2149e26297aSJohannes Berg * Index into sequence numbers array, 0..16 2159e26297aSJohannes Berg * since the last (16) is used for non-QoS, 2169e26297aSJohannes Berg * will be 16 on non-QoS frames. 2179e26297aSJohannes Berg */ 2189e26297aSJohannes Berg int seqno_idx; 2199e26297aSJohannes Berg 2209e26297aSJohannes Berg /* 2219e26297aSJohannes Berg * Index into the security IV/PN arrays, 0..16 2229e26297aSJohannes Berg * since the last (16) is used for CCMP-encrypted 2239e26297aSJohannes Berg * management frames, will be set to 16 on mgmt 2249e26297aSJohannes Berg * frames and 0 on non-QoS frames. 2259e26297aSJohannes Berg */ 2269e26297aSJohannes Berg int security_idx; 2279e26297aSJohannes Berg 22850741ae0SJohannes Berg u32 tkip_iv32; 22950741ae0SJohannes Berg u16 tkip_iv16; 230f0706e82SJiri Benc }; 231f0706e82SJiri Benc 232af296bdbSMichal Kazior struct ieee80211_csa_settings { 233af296bdbSMichal Kazior const u16 *counter_offsets_beacon; 234af296bdbSMichal Kazior const u16 *counter_offsets_presp; 235af296bdbSMichal Kazior 236af296bdbSMichal Kazior int n_counter_offsets_beacon; 237af296bdbSMichal Kazior int n_counter_offsets_presp; 238af296bdbSMichal Kazior 239af296bdbSMichal Kazior u8 count; 240af296bdbSMichal Kazior }; 241af296bdbSMichal Kazior 2425dfdaf58SJohannes Berg struct beacon_data { 2435dfdaf58SJohannes Berg u8 *head, *tail; 2445dfdaf58SJohannes Berg int head_len, tail_len; 24543552be1SThomas Pedersen struct ieee80211_meshconf_ie *meshconf; 246af296bdbSMichal Kazior u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM]; 247af296bdbSMichal Kazior u8 csa_current_counter; 2488860020eSJohannes Berg struct rcu_head rcu_head; 2495dfdaf58SJohannes Berg }; 2505dfdaf58SJohannes Berg 251aa7a0080SEyal Shapira struct probe_resp { 252aa7a0080SEyal Shapira struct rcu_head rcu_head; 253aa7a0080SEyal Shapira int len; 254af296bdbSMichal Kazior u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM]; 255aa7a0080SEyal Shapira u8 data[0]; 256aa7a0080SEyal Shapira }; 257aa7a0080SEyal Shapira 258d012a605SMarco Porsch struct ps_data { 259d012a605SMarco Porsch /* yes, this looks ugly, but guarantees that we can later use 260d012a605SMarco Porsch * bitmap_empty :) 261d012a605SMarco Porsch * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 2625fe2bb86SJoe Perches u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)] 2635fe2bb86SJoe Perches __aligned(__alignof__(unsigned long)); 264d012a605SMarco Porsch struct sk_buff_head bc_buf; 265d012a605SMarco Porsch atomic_t num_sta_ps; /* number of stations in PS mode */ 266d012a605SMarco Porsch int dtim_count; 267d012a605SMarco Porsch bool dtim_bc_mc; 268d012a605SMarco Porsch }; 269d012a605SMarco Porsch 270f0706e82SJiri Benc struct ieee80211_if_ap { 27140b275b6SJohannes Berg struct beacon_data __rcu *beacon; 272aa7a0080SEyal Shapira struct probe_resp __rcu *probe_resp; 273f0706e82SJiri Benc 27473da7d5bSSimon Wunderlich /* to be used after channel switch. */ 27573da7d5bSSimon Wunderlich struct cfg80211_beacon_data *next_beacon; 2764e141dadSMichal Kazior struct list_head vlans; /* write-protected with RTNL and local->mtx */ 2770ec3ca44SJohannes Berg 278d012a605SMarco Porsch struct ps_data ps; 279030ef8f8SFelix Fietkau atomic_t num_mcast_sta; /* number of stations receiving multicast */ 280687da132SEmmanuel Grumbach enum ieee80211_smps_mode req_smps, /* requested smps mode */ 281687da132SEmmanuel Grumbach driver_smps_mode; /* smps mode request */ 282687da132SEmmanuel Grumbach 283687da132SEmmanuel Grumbach struct work_struct request_smps_work; 284f0706e82SJiri Benc }; 285f0706e82SJiri Benc 286f0706e82SJiri Benc struct ieee80211_if_wds { 287f0706e82SJiri Benc struct sta_info *sta; 288056cdd59SJohannes Berg u8 remote_addr[ETH_ALEN]; 289f0706e82SJiri Benc }; 290f0706e82SJiri Benc 291f0706e82SJiri Benc struct ieee80211_if_vlan { 2924e141dadSMichal Kazior struct list_head list; /* write-protected with RTNL and local->mtx */ 293f14543eeSFelix Fietkau 294f14543eeSFelix Fietkau /* used for all tx if the VLAN is configured to 4-addr mode */ 29540b275b6SJohannes Berg struct sta_info __rcu *sta; 296f0706e82SJiri Benc }; 297f0706e82SJiri Benc 298ee385855SLuis Carlos Cobo struct mesh_stats { 299c8a61a7dSDaniel Walker __u32 fwded_mcast; /* Mesh forwarded multicast frames */ 300c8a61a7dSDaniel Walker __u32 fwded_unicast; /* Mesh forwarded unicast frames */ 301c8a61a7dSDaniel Walker __u32 fwded_frames; /* Mesh total forwarded frames */ 302ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 303ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 304cfee66b0SJavier Cardona __u32 dropped_frames_congestion;/* Not forwarded due to congestion */ 305ee385855SLuis Carlos Cobo }; 306ee385855SLuis Carlos Cobo 307ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 308ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 309ee385855SLuis Carlos Cobo struct mesh_preq_queue { 310ee385855SLuis Carlos Cobo struct list_head list; 311ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 312ee385855SLuis Carlos Cobo u8 flags; 313ee385855SLuis Carlos Cobo }; 314ee385855SLuis Carlos Cobo 3152eb278e0SJohannes Berg #if HZ/100 == 0 3162eb278e0SJohannes Berg #define IEEE80211_ROC_MIN_LEFT 1 3172eb278e0SJohannes Berg #else 3182eb278e0SJohannes Berg #define IEEE80211_ROC_MIN_LEFT (HZ/100) 3192eb278e0SJohannes Berg #endif 32077fdaa12SJohannes Berg 3212eb278e0SJohannes Berg struct ieee80211_roc_work { 32277fdaa12SJohannes Berg struct list_head list; 3232eb278e0SJohannes Berg struct list_head dependents; 324f679f65dSJohannes Berg 3252eb278e0SJohannes Berg struct delayed_work work; 326af6b6374SJohannes Berg 327af6b6374SJohannes Berg struct ieee80211_sub_if_data *sdata; 328af6b6374SJohannes Berg 329f679f65dSJohannes Berg struct ieee80211_channel *chan; 330af6b6374SJohannes Berg 3312eb278e0SJohannes Berg bool started, abort, hw_begun, notified; 3323fbd45caSJohannes Berg bool to_be_freed; 333b4b177a5SJohannes Berg bool on_channel; 334f679f65dSJohannes Berg 3352eb278e0SJohannes Berg unsigned long hw_start_time; 336e4da8c37SJohannes Berg 3372eb278e0SJohannes Berg u32 duration, req_duration; 338f30221e4SJohannes Berg struct sk_buff *frame; 33950febf6aSJohannes Berg u64 cookie, mgmt_tx_cookie; 340d339d5caSIlan Peer enum ieee80211_roc_type type; 34177fdaa12SJohannes Berg }; 34277fdaa12SJohannes Berg 34346900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */ 344ab1faeadSJohannes Berg enum ieee80211_sta_flags { 345b291ba11SJohannes Berg IEEE80211_STA_CONNECTION_POLL = BIT(1), 346b291ba11SJohannes Berg IEEE80211_STA_CONTROL_PORT = BIT(2), 347a8243b72SJohannes Berg IEEE80211_STA_DISABLE_HT = BIT(4), 348b291ba11SJohannes Berg IEEE80211_STA_CSA_RECEIVED = BIT(5), 349b291ba11SJohannes Berg IEEE80211_STA_MFP_ENABLED = BIT(6), 350ab13315aSKalle Valo IEEE80211_STA_UAPSD_ENABLED = BIT(7), 351375177bfSVivek Natarajan IEEE80211_STA_NULLFUNC_ACKED = BIT(8), 35217e4ec14SJouni Malinen IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), 35324398e39SJohannes Berg IEEE80211_STA_DISABLE_40MHZ = BIT(10), 354d545dabaSMahesh Palivela IEEE80211_STA_DISABLE_VHT = BIT(11), 355f2d9d270SJohannes Berg IEEE80211_STA_DISABLE_80P80MHZ = BIT(12), 356f2d9d270SJohannes Berg IEEE80211_STA_DISABLE_160MHZ = BIT(13), 357095d81ceSJohannes Berg IEEE80211_STA_DISABLE_WMM = BIT(14), 358ab1faeadSJohannes Berg }; 359ab1faeadSJohannes Berg 36066e67e41SJohannes Berg struct ieee80211_mgd_auth_data { 36166e67e41SJohannes Berg struct cfg80211_bss *bss; 36266e67e41SJohannes Berg unsigned long timeout; 36366e67e41SJohannes Berg int tries; 36466e67e41SJohannes Berg u16 algorithm, expected_transaction; 36566e67e41SJohannes Berg 36666e67e41SJohannes Berg u8 key[WLAN_KEY_LEN_WEP104]; 36766e67e41SJohannes Berg u8 key_len, key_idx; 36866e67e41SJohannes Berg bool done; 36989afe614SJohannes Berg bool timeout_started; 37066e67e41SJohannes Berg 3716b8ece3aSJouni Malinen u16 sae_trans, sae_status; 3726b8ece3aSJouni Malinen size_t data_len; 3736b8ece3aSJouni Malinen u8 data[]; 37466e67e41SJohannes Berg }; 37566e67e41SJohannes Berg 37666e67e41SJohannes Berg struct ieee80211_mgd_assoc_data { 37766e67e41SJohannes Berg struct cfg80211_bss *bss; 37866e67e41SJohannes Berg const u8 *supp_rates; 37966e67e41SJohannes Berg 38066e67e41SJohannes Berg unsigned long timeout; 38166e67e41SJohannes Berg int tries; 38266e67e41SJohannes Berg 38366e67e41SJohannes Berg u16 capability; 38466e67e41SJohannes Berg u8 prev_bssid[ETH_ALEN]; 38566e67e41SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 38666e67e41SJohannes Berg u8 ssid_len; 38766e67e41SJohannes Berg u8 supp_rates_len; 38876f0303dSJohannes Berg bool wmm, uapsd; 389989c6505SAlexander Bondar bool need_beacon; 39066e67e41SJohannes Berg bool synced; 39189afe614SJohannes Berg bool timeout_started; 39266e67e41SJohannes Berg 3939dde6423SJohannes Berg u8 ap_ht_param; 3949dde6423SJohannes Berg 395b08fbbd8SJohannes Berg struct ieee80211_vht_cap ap_vht_cap; 396b08fbbd8SJohannes Berg 39766e67e41SJohannes Berg size_t ie_len; 39866e67e41SJohannes Berg u8 ie[]; 39966e67e41SJohannes Berg }; 40066e67e41SJohannes Berg 40146900298SJohannes Berg struct ieee80211_if_managed { 402056cdd59SJohannes Berg struct timer_list timer; 403b291ba11SJohannes Berg struct timer_list conn_mon_timer; 404b291ba11SJohannes Berg struct timer_list bcn_mon_timer; 405c481ec97SSujith struct timer_list chswitch_timer; 406b291ba11SJohannes Berg struct work_struct monitor_work; 407c481ec97SSujith struct work_struct chswitch_work; 4081e4dcd01SJuuso Oikarinen struct work_struct beacon_connection_loss_work; 409882a7c69SJohannes Berg struct work_struct csa_connection_drop_work; 41046900298SJohannes Berg 4117ccc8bd7SFelix Fietkau unsigned long beacon_timeout; 412b291ba11SJohannes Berg unsigned long probe_timeout; 413a43abf29SMaxim Levitsky int probe_send_count; 41404ac3c0eSFelix Fietkau bool nullfunc_failed; 415682bd38bSJohannes Berg bool connection_loss; 416b291ba11SJohannes Berg 4170c1ad2caSJohannes Berg struct cfg80211_bss *associated; 41866e67e41SJohannes Berg struct ieee80211_mgd_auth_data *auth_data; 41966e67e41SJohannes Berg struct ieee80211_mgd_assoc_data *assoc_data; 42046900298SJohannes Berg 42177fdaa12SJohannes Berg u8 bssid[ETH_ALEN]; 42246900298SJohannes Berg 423f0706e82SJiri Benc u16 aid; 424f0706e82SJiri Benc 425965bedadSJohannes Berg bool powersave; /* powersave requested for this iface */ 42605cb9108SJohannes Berg bool broken_ap; /* AP is broken -- turn off powersave */ 427989c6505SAlexander Bondar bool have_beacon; 428826262c3SJohannes Berg u8 dtim_period; 4290f78231bSJohannes Berg enum ieee80211_smps_mode req_smps, /* requested smps mode */ 430d1f5b7a3SJohannes Berg driver_smps_mode; /* smps mode request */ 431d1f5b7a3SJohannes Berg 432d1f5b7a3SJohannes Berg struct work_struct request_smps_work; 433965bedadSJohannes Berg 434d6f2da5bSJiri Slaby unsigned int flags; 435f0706e82SJiri Benc 436d8ec4433SJuuso Oikarinen bool beacon_crc_valid; 437d91f36dbSJohannes Berg u32 beacon_crc; 438d91f36dbSJohannes Berg 4391672c0e3SJohannes Berg bool status_acked; 4401672c0e3SJohannes Berg bool status_received; 4411672c0e3SJohannes Berg __le16 status_fc; 4421672c0e3SJohannes Berg 443fdfacf0aSJouni Malinen enum { 444fdfacf0aSJouni Malinen IEEE80211_MFP_DISABLED, 445fdfacf0aSJouni Malinen IEEE80211_MFP_OPTIONAL, 446fdfacf0aSJouni Malinen IEEE80211_MFP_REQUIRED 447fdfacf0aSJouni Malinen } mfp; /* management frame protection */ 448fdfacf0aSJouni Malinen 449dc41e4d4SEliad Peller /* 450dc41e4d4SEliad Peller * Bitmask of enabled u-apsd queues, 451dc41e4d4SEliad Peller * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association 452dc41e4d4SEliad Peller * to take effect. 453dc41e4d4SEliad Peller */ 454dc41e4d4SEliad Peller unsigned int uapsd_queues; 455dc41e4d4SEliad Peller 456dc41e4d4SEliad Peller /* 457dc41e4d4SEliad Peller * Maximum number of buffered frames AP can deliver during a 458dc41e4d4SEliad Peller * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar. 459dc41e4d4SEliad Peller * Needs a new association to take effect. 460dc41e4d4SEliad Peller */ 461dc41e4d4SEliad Peller unsigned int uapsd_max_sp_len; 462dc41e4d4SEliad Peller 463f0706e82SJiri Benc int wmm_last_param_set; 4649bc383deSJohannes Berg 4659bc383deSJohannes Berg u8 use_4addr; 46617e4ec14SJouni Malinen 46767baf663SJanusz Dziedzic s16 p2p_noa_index; 468488dd7b5SJohannes Berg 46917e4ec14SJouni Malinen /* Signal strength from the last Beacon frame in the current BSS. */ 47017e4ec14SJouni Malinen int last_beacon_signal; 47117e4ec14SJouni Malinen 47217e4ec14SJouni Malinen /* 47317e4ec14SJouni Malinen * Weighted average of the signal strength from Beacon frames in the 47417e4ec14SJouni Malinen * current BSS. This is in units of 1/16 of the signal unit to maintain 47517e4ec14SJouni Malinen * accuracy and to speed up calculations, i.e., the value need to be 47617e4ec14SJouni Malinen * divided by 16 to get the actual value. 47717e4ec14SJouni Malinen */ 47817e4ec14SJouni Malinen int ave_beacon_signal; 47917e4ec14SJouni Malinen 48017e4ec14SJouni Malinen /* 481391a200aSJouni Malinen * Number of Beacon frames used in ave_beacon_signal. This can be used 482391a200aSJouni Malinen * to avoid generating less reliable cqm events that would be based 483391a200aSJouni Malinen * only on couple of received frames. 484391a200aSJouni Malinen */ 485391a200aSJouni Malinen unsigned int count_beacon_signal; 486391a200aSJouni Malinen 487391a200aSJouni Malinen /* 48817e4ec14SJouni Malinen * Last Beacon frame signal strength average (ave_beacon_signal / 16) 48917e4ec14SJouni Malinen * that triggered a cqm event. 0 indicates that no event has been 49017e4ec14SJouni Malinen * generated for the current association. 49117e4ec14SJouni Malinen */ 49217e4ec14SJouni Malinen int last_cqm_event_signal; 493615f7b9bSMeenakshi Venkataraman 494615f7b9bSMeenakshi Venkataraman /* 495615f7b9bSMeenakshi Venkataraman * State variables for keeping track of RSSI of the AP currently 496615f7b9bSMeenakshi Venkataraman * connected to and informing driver when RSSI has gone 497615f7b9bSMeenakshi Venkataraman * below/above a certain threshold. 498615f7b9bSMeenakshi Venkataraman */ 499615f7b9bSMeenakshi Venkataraman int rssi_min_thold, rssi_max_thold; 500615f7b9bSMeenakshi Venkataraman int last_ave_beacon_signal; 501ef96a842SBen Greear 502ef96a842SBen Greear struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 503ef96a842SBen Greear struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 504dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */ 505dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */ 506f0706e82SJiri Benc }; 507f0706e82SJiri Benc 50846900298SJohannes Berg struct ieee80211_if_ibss { 50946900298SJohannes Berg struct timer_list timer; 510cd7760e6SSimon Wunderlich struct work_struct csa_connection_drop_work; 51146900298SJohannes Berg 512af8cdcd8SJohannes Berg unsigned long last_scan_completed; 5135bb644a0SJohannes Berg 514fbd2c8dcSTeemu Paasikivi u32 basic_rates; 515fbd2c8dcSTeemu Paasikivi 516af8cdcd8SJohannes Berg bool fixed_bssid; 517af8cdcd8SJohannes Berg bool fixed_channel; 518fffd0934SJohannes Berg bool privacy; 51946900298SJohannes Berg 520267335d6SAntonio Quartulli bool control_port; 5218e8d347dSSimon Wunderlich bool userspace_handles_dfs; 522267335d6SAntonio Quartulli 5234d196e4bSFelix Fietkau u8 bssid[ETH_ALEN] __aligned(2); 524af8cdcd8SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 525af8cdcd8SJohannes Berg u8 ssid_len, ie_len; 526af8cdcd8SJohannes Berg u8 *ie; 5273aede78aSSimon Wunderlich struct cfg80211_chan_def chandef; 52846900298SJohannes Berg 52946900298SJohannes Berg unsigned long ibss_join_req; 530af8cdcd8SJohannes Berg /* probe response/beacon for IBSS */ 531c3ffeab4SJohannes Berg struct beacon_data __rcu *presp; 53246900298SJohannes Berg 533822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 534822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 535822854b0SSimon Wunderlich 5368bf11d8dSJohannes Berg spinlock_t incomplete_lock; 5378bf11d8dSJohannes Berg struct list_head incomplete_stations; 5388bf11d8dSJohannes Berg 53946900298SJohannes Berg enum { 54046900298SJohannes Berg IEEE80211_IBSS_MLME_SEARCH, 54146900298SJohannes Berg IEEE80211_IBSS_MLME_JOINED, 54246900298SJohannes Berg } state; 54346900298SJohannes Berg }; 54446900298SJohannes Berg 545dbf498fbSJavier Cardona /** 546dbf498fbSJavier Cardona * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface 547dbf498fbSJavier Cardona * 548dbf498fbSJavier Cardona * these declarations define the interface, which enables 549dbf498fbSJavier Cardona * vendor-specific mesh synchronization 550dbf498fbSJavier Cardona * 551dbf498fbSJavier Cardona */ 552dbf498fbSJavier Cardona struct ieee802_11_elems; 553dbf498fbSJavier Cardona struct ieee80211_mesh_sync_ops { 554dbf498fbSJavier Cardona void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata, 555dbf498fbSJavier Cardona u16 stype, 556dbf498fbSJavier Cardona struct ieee80211_mgmt *mgmt, 557dbf498fbSJavier Cardona struct ieee802_11_elems *elems, 558dbf498fbSJavier Cardona struct ieee80211_rx_status *rx_status); 55943552be1SThomas Pedersen 56043552be1SThomas Pedersen /* should be called with beacon_data under RCU read lock */ 56143552be1SThomas Pedersen void (*adjust_tbtt)(struct ieee80211_sub_if_data *sdata, 56243552be1SThomas Pedersen struct beacon_data *beacon); 563dbf498fbSJavier Cardona /* add other framework functions here */ 564dbf498fbSJavier Cardona }; 565dbf498fbSJavier Cardona 566b8456a14SChun-Yeow Yeoh struct mesh_csa_settings { 567b8456a14SChun-Yeow Yeoh struct rcu_head rcu_head; 568b8456a14SChun-Yeow Yeoh struct cfg80211_csa_settings settings; 569b8456a14SChun-Yeow Yeoh }; 570b8456a14SChun-Yeow Yeoh 571472dbc45SJohannes Berg struct ieee80211_if_mesh { 572472dbc45SJohannes Berg struct timer_list housekeeping_timer; 573472dbc45SJohannes Berg struct timer_list mesh_path_timer; 574e304bfd3SRui Paulo struct timer_list mesh_path_root_timer; 575472dbc45SJohannes Berg 57618889231SJavier Cardona unsigned long wrkq_flags; 577f81a9dedSThomas Pedersen unsigned long mbss_changed; 578472dbc45SJohannes Berg 579472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 580472dbc45SJohannes Berg size_t mesh_id_len; 581472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */ 5823491707aSRui Paulo u8 mesh_pp_id; 583472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */ 5843491707aSRui Paulo u8 mesh_pm_id; 585472dbc45SJohannes Berg /* Congestion Control Mode Identifier */ 5863491707aSRui Paulo u8 mesh_cc_id; 5879e03fdfdSJavier Cardona /* Synchronization Protocol Identifier */ 5883491707aSRui Paulo u8 mesh_sp_id; 5899e03fdfdSJavier Cardona /* Authentication Protocol Identifier */ 5903491707aSRui Paulo u8 mesh_auth_id; 591d19b3bf6SRui Paulo /* Local mesh Sequence Number */ 592d19b3bf6SRui Paulo u32 sn; 593472dbc45SJohannes Berg /* Last used PREQ ID */ 594472dbc45SJohannes Berg u32 preq_id; 595472dbc45SJohannes Berg atomic_t mpaths; 596d19b3bf6SRui Paulo /* Timestamp of last SN update */ 597d19b3bf6SRui Paulo unsigned long last_sn_update; 598dca7e943SThomas Pedersen /* Time when it's ok to send next PERR */ 599dca7e943SThomas Pedersen unsigned long next_perr; 600dca7e943SThomas Pedersen /* Timestamp of last PREQ sent */ 601472dbc45SJohannes Berg unsigned long last_preq; 602472dbc45SJohannes Berg struct mesh_rmc *rmc; 603472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock; 604472dbc45SJohannes Berg struct mesh_preq_queue preq_queue; 605472dbc45SJohannes Berg int preq_queue_len; 606472dbc45SJohannes Berg struct mesh_stats mshstats; 607472dbc45SJohannes Berg struct mesh_config mshcfg; 6081258d976SAshok Nagarajan atomic_t estab_plinks; 609472dbc45SJohannes Berg u32 mesh_seqnum; 610472dbc45SJohannes Berg bool accepting_plinks; 6115ee68e5bSJavier Cardona int num_gates; 6122b5e1967SThomas Pedersen struct beacon_data __rcu *beacon; 613581a8b0fSJavier Cardona const u8 *ie; 614581a8b0fSJavier Cardona u8 ie_len; 615b130e5ceSJavier Cardona enum { 616b130e5ceSJavier Cardona IEEE80211_MESH_SEC_NONE = 0x0, 617b130e5ceSJavier Cardona IEEE80211_MESH_SEC_AUTHED = 0x1, 618b130e5ceSJavier Cardona IEEE80211_MESH_SEC_SECURED = 0x2, 619b130e5ceSJavier Cardona } security; 620a6dad6a2SThomas Pedersen bool user_mpm; 621dbf498fbSJavier Cardona /* Extensible Synchronization Framework */ 6228ba7acf3SJohannes Berg const struct ieee80211_mesh_sync_ops *sync_ops; 623dbf498fbSJavier Cardona s64 sync_offset_clockdrift_max; 624dbf498fbSJavier Cardona spinlock_t sync_offset_lock; 625dbf498fbSJavier Cardona bool adjusting_tbtt; 6263f52b7e3SMarco Porsch /* mesh power save */ 6273f52b7e3SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 6283f52b7e3SMarco Porsch int ps_peers_light_sleep; 6293f52b7e3SMarco Porsch int ps_peers_deep_sleep; 6303f52b7e3SMarco Porsch struct ps_data ps; 6318f2535b9SChun-Yeow Yeoh /* Channel Switching Support */ 632b8456a14SChun-Yeow Yeoh struct mesh_csa_settings __rcu *csa; 6330cb4d4dcSLuciano Coelho enum { 6340cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_NONE, 6350cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_INIT, 6360cb4d4dcSLuciano Coelho IEEE80211_MESH_CSA_ROLE_REPEATER, 6370cb4d4dcSLuciano Coelho } csa_role; 638b8456a14SChun-Yeow Yeoh u8 chsw_ttl; 6398f2535b9SChun-Yeow Yeoh u16 pre_value; 64043552be1SThomas Pedersen 64143552be1SThomas Pedersen /* offset from skb->data while building IE */ 64243552be1SThomas Pedersen int meshconf_offset; 643472dbc45SJohannes Berg }; 644902acc78SJohannes Berg 645902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 646472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 647472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0) 648902acc78SJohannes Berg #else 649472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 650902acc78SJohannes Berg do { } while (0) 651902acc78SJohannes Berg #endif 652f0706e82SJiri Benc 653213cd118SJohannes Berg /** 654213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags 655213cd118SJohannes Berg * 656213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets 657213cd118SJohannes Berg * @IEEE80211_SDATA_PROMISC: interface is promisc 658213cd118SJohannes Berg * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode 659213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between 660213cd118SJohannes Berg * associated stations and deliver multicast frames both 661213cd118SJohannes Berg * back to wireless media and to the local net stack. 66295acac61SJohannes Berg * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume. 6637b7eab6fSJohannes Berg * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver 664213cd118SJohannes Berg */ 665213cd118SJohannes Berg enum ieee80211_sub_if_data_flags { 666213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0), 667213cd118SJohannes Berg IEEE80211_SDATA_PROMISC = BIT(1), 6687986cf95SJohannes Berg IEEE80211_SDATA_OPERATING_GMODE = BIT(2), 6697986cf95SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), 67095acac61SJohannes Berg IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4), 6717b7eab6fSJohannes Berg IEEE80211_SDATA_IN_DRIVER = BIT(5), 672213cd118SJohannes Berg }; 673213cd118SJohannes Berg 67434d4bc4dSJohannes Berg /** 67534d4bc4dSJohannes Berg * enum ieee80211_sdata_state_bits - virtual interface state bits 67634d4bc4dSJohannes Berg * @SDATA_STATE_RUNNING: virtual interface is up & running; this 67734d4bc4dSJohannes Berg * mirrors netif_running() but is separate for interface type 67834d4bc4dSJohannes Berg * change handling while the interface is up 6795b714c6aSJohannes Berg * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel 6805b714c6aSJohannes Berg * mode, so queues are stopped 681d6a83228SJohannes Berg * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due 682d6a83228SJohannes Berg * to offchannel, reset when offchannel returns 68334d4bc4dSJohannes Berg */ 68434d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits { 68534d4bc4dSJohannes Berg SDATA_STATE_RUNNING, 6865b714c6aSJohannes Berg SDATA_STATE_OFFCHANNEL, 687d6a83228SJohannes Berg SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, 68834d4bc4dSJohannes Berg }; 68934d4bc4dSJohannes Berg 690d01a1e65SMichal Kazior /** 691d01a1e65SMichal Kazior * enum ieee80211_chanctx_mode - channel context configuration mode 692d01a1e65SMichal Kazior * 693d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_SHARED: channel context may be used by 694d01a1e65SMichal Kazior * multiple interfaces 695d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used 696d01a1e65SMichal Kazior * only by a single interface. This can be used for example for 697d01a1e65SMichal Kazior * non-fixed channel IBSS. 698d01a1e65SMichal Kazior */ 699d01a1e65SMichal Kazior enum ieee80211_chanctx_mode { 700d01a1e65SMichal Kazior IEEE80211_CHANCTX_SHARED, 701d01a1e65SMichal Kazior IEEE80211_CHANCTX_EXCLUSIVE 702d01a1e65SMichal Kazior }; 703d01a1e65SMichal Kazior 704d01a1e65SMichal Kazior struct ieee80211_chanctx { 705d01a1e65SMichal Kazior struct list_head list; 706d01a1e65SMichal Kazior struct rcu_head rcu_head; 707d01a1e65SMichal Kazior 708484298adSMichal Kazior struct list_head assigned_vifs; 709e3afb920SMichal Kazior struct list_head reserved_vifs; 710484298adSMichal Kazior 711d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode; 7128a61af65SJohannes Berg bool driver_present; 713d01a1e65SMichal Kazior 714d01a1e65SMichal Kazior struct ieee80211_chanctx_conf conf; 715d01a1e65SMichal Kazior }; 716d01a1e65SMichal Kazior 71732db6b54SKyeyoon Park struct mac80211_qos_map { 71832db6b54SKyeyoon Park struct cfg80211_qos_map qos_map; 71932db6b54SKyeyoon Park struct rcu_head rcu_head; 72032db6b54SKyeyoon Park }; 72132db6b54SKyeyoon Park 722f0706e82SJiri Benc struct ieee80211_sub_if_data { 723f0706e82SJiri Benc struct list_head list; 724f0706e82SJiri Benc 725f0706e82SJiri Benc struct wireless_dev wdev; 726f0706e82SJiri Benc 72711a843b7SJohannes Berg /* keys */ 72811a843b7SJohannes Berg struct list_head key_list; 72911a843b7SJohannes Berg 7303bff1865SYogesh Ashok Powar /* count for keys needing tailroom space allocation */ 7313bff1865SYogesh Ashok Powar int crypto_tx_tailroom_needed_cnt; 7328d1f7ecdSJohannes Berg int crypto_tx_tailroom_pending_dec; 7338d1f7ecdSJohannes Berg struct delayed_work dec_tailroom_needed_wk; 7343bff1865SYogesh Ashok Powar 735f0706e82SJiri Benc struct net_device *dev; 736f0706e82SJiri Benc struct ieee80211_local *local; 737f0706e82SJiri Benc 73813262ffdSJiri Slaby unsigned int flags; 7397e9ed188SDaniel Drake 74034d4bc4dSJohannes Berg unsigned long state; 74134d4bc4dSJohannes Berg 742f0706e82SJiri Benc int drop_unencrypted; 743f0706e82SJiri Benc 74447846c9bSJohannes Berg char name[IFNAMSIZ]; 74547846c9bSJohannes Berg 746f0706e82SJiri Benc /* Fragment table for host-based reassembly */ 747f0706e82SJiri Benc struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; 748f0706e82SJiri Benc unsigned int fragment_next; 749f0706e82SJiri Benc 750b53be792SSimon Wunderlich /* TID bitmap for NoAck policy */ 751b53be792SSimon Wunderlich u16 noack_map; 752b53be792SSimon Wunderlich 75300e96decSYoni Divinsky /* bit field of ACM bits (BIT(802.1D tag)) */ 75400e96decSYoni Divinsky u8 wmm_acm; 75500e96decSYoni Divinsky 75640b275b6SJohannes Berg struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; 75740b275b6SJohannes Berg struct ieee80211_key __rcu *default_unicast_key; 75840b275b6SJohannes Berg struct ieee80211_key __rcu *default_multicast_key; 75940b275b6SJohannes Berg struct ieee80211_key __rcu *default_mgmt_key; 760f0706e82SJiri Benc 76194778280SJohannes Berg u16 sequence_number; 762a621fa4dSJohannes Berg __be16 control_port_protocol; 763a621fa4dSJohannes Berg bool control_port_no_encrypt; 7642475b1ccSMax Stepanov int encrypt_headroom; 76594778280SJohannes Berg 76654bcbc69SJohannes Berg struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; 76732db6b54SKyeyoon Park struct mac80211_qos_map __rcu *qos_map; 768f6f3def3SEliad Peller 76973da7d5bSSimon Wunderlich struct work_struct csa_finalize_work; 77073da7d5bSSimon Wunderlich bool csa_radar_required; 77159af6928SMichal Kazior bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */ 77233787fc4SLuciano Coelho struct cfg80211_chan_def csa_chandef; 77373da7d5bSSimon Wunderlich 774484298adSMichal Kazior struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */ 775e3afb920SMichal Kazior struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */ 776484298adSMichal Kazior 77711335a55SLuciano Coelho /* context reservation -- protected with chanctx_mtx */ 77811335a55SLuciano Coelho struct ieee80211_chanctx *reserved_chanctx; 77911335a55SLuciano Coelho struct cfg80211_chan_def reserved_chandef; 78009332481SMichal Kazior bool reserved_radar_required; 78111335a55SLuciano Coelho 78204ecd257SJohannes Berg /* used to reconfigure hardware SM PS */ 78304ecd257SJohannes Berg struct work_struct recalc_smps; 78404ecd257SJohannes Berg 78564592c8fSJohannes Berg struct work_struct work; 78635f20c14SJohannes Berg struct sk_buff_head skb_queue; 78735f20c14SJohannes Berg 78804ecd257SJohannes Berg u8 needed_rx_chains; 78904ecd257SJohannes Berg enum ieee80211_smps_mode smps_mode; 79004ecd257SJohannes Berg 7911ea6f9c0SJohannes Berg int user_power_level; /* in dBm */ 7921ea6f9c0SJohannes Berg int ap_power_level; /* in dBm */ 7931ea6f9c0SJohannes Berg 794164eb02dSSimon Wunderlich bool radar_required; 795164eb02dSSimon Wunderlich struct delayed_work dfs_cac_timer_work; 796164eb02dSSimon Wunderlich 797*17e6a59aSArik Nemtsov u8 tdls_peer[ETH_ALEN] __aligned(2); 798*17e6a59aSArik Nemtsov struct delayed_work tdls_peer_del_work; 799*17e6a59aSArik Nemtsov 8003e122be0SJohannes Berg /* 8013e122be0SJohannes Berg * AP this belongs to: self in AP mode and 8023e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 8033e122be0SJohannes Berg * all others (might be needed later in IBSS) 8043e122be0SJohannes Berg */ 8053e122be0SJohannes Berg struct ieee80211_if_ap *bss; 8063e122be0SJohannes Berg 80737eb0b16SJouni Malinen /* bitmap of allowed (non-MCS) rate indexes for rate control */ 80837eb0b16SJouni Malinen u32 rc_rateidx_mask[IEEE80211_NUM_BANDS]; 8092ffbe6d3SFelix Fietkau 8102ffbe6d3SFelix Fietkau bool rc_has_mcs_mask[IEEE80211_NUM_BANDS]; 81119468413SSimon Wunderlich u8 rc_rateidx_mcs_mask[IEEE80211_NUM_BANDS][IEEE80211_HT_MCS_MASK_LEN]; 812f0706e82SJiri Benc 813f0706e82SJiri Benc union { 814f0706e82SJiri Benc struct ieee80211_if_ap ap; 815f0706e82SJiri Benc struct ieee80211_if_wds wds; 816f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 81746900298SJohannes Berg struct ieee80211_if_managed mgd; 81846900298SJohannes Berg struct ieee80211_if_ibss ibss; 819472dbc45SJohannes Berg struct ieee80211_if_mesh mesh; 8208cc9a739SMichael Wu u32 mntr_flags; 821f0706e82SJiri Benc } u; 822e9f207f0SJiri Benc 823e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 824e9f207f0SJiri Benc struct { 825295bafb4SBen Greear struct dentry *subdir_stations; 826f7e0104cSJohannes Berg struct dentry *default_unicast_key; 827f7e0104cSJohannes Berg struct dentry *default_multicast_key; 8283cfcf6acSJouni Malinen struct dentry *default_mgmt_key; 8297bcfaf2fSJohannes Berg } debugfs; 830e9f207f0SJiri Benc #endif 831529ba6e9SJohannes Berg 83232bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */ 83332bfd35dSJohannes Berg struct ieee80211_vif vif; 834f0706e82SJiri Benc }; 835f0706e82SJiri Benc 83632bfd35dSJohannes Berg static inline 83732bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 83832bfd35dSJohannes Berg { 83932bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif); 84032bfd35dSJohannes Berg } 84132bfd35dSJohannes Berg 8428d61ffa5SJohannes Berg static inline void sdata_lock(struct ieee80211_sub_if_data *sdata) 8438d61ffa5SJohannes Berg __acquires(&sdata->wdev.mtx) 8448d61ffa5SJohannes Berg { 8458d61ffa5SJohannes Berg mutex_lock(&sdata->wdev.mtx); 8468d61ffa5SJohannes Berg __acquire(&sdata->wdev.mtx); 8478d61ffa5SJohannes Berg } 8488d61ffa5SJohannes Berg 8498d61ffa5SJohannes Berg static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata) 8508d61ffa5SJohannes Berg __releases(&sdata->wdev.mtx) 8518d61ffa5SJohannes Berg { 8528d61ffa5SJohannes Berg mutex_unlock(&sdata->wdev.mtx); 8538d61ffa5SJohannes Berg __release(&sdata->wdev.mtx); 8548d61ffa5SJohannes Berg } 8558d61ffa5SJohannes Berg 8567ca133bcSSimon Wunderlich #define sdata_dereference(p, sdata) \ 8577ca133bcSSimon Wunderlich rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx)) 8587ca133bcSSimon Wunderlich 8598d61ffa5SJohannes Berg static inline void 8608d61ffa5SJohannes Berg sdata_assert_lock(struct ieee80211_sub_if_data *sdata) 8618d61ffa5SJohannes Berg { 8628d61ffa5SJohannes Berg lockdep_assert_held(&sdata->wdev.mtx); 8638d61ffa5SJohannes Berg } 8648d61ffa5SJohannes Berg 86555de908aSJohannes Berg static inline enum ieee80211_band 86655de908aSJohannes Berg ieee80211_get_sdata_band(struct ieee80211_sub_if_data *sdata) 86755de908aSJohannes Berg { 86855de908aSJohannes Berg enum ieee80211_band band = IEEE80211_BAND_2GHZ; 86955de908aSJohannes Berg struct ieee80211_chanctx_conf *chanctx_conf; 87055de908aSJohannes Berg 87155de908aSJohannes Berg rcu_read_lock(); 87255de908aSJohannes Berg chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 87355de908aSJohannes Berg if (!WARN_ON(!chanctx_conf)) 8744bf88530SJohannes Berg band = chanctx_conf->def.chan->band; 87555de908aSJohannes Berg rcu_read_unlock(); 87655de908aSJohannes Berg 87755de908aSJohannes Berg return band; 87855de908aSJohannes Berg } 87955de908aSJohannes Berg 880438b61b7SSimon Wunderlich static inline int 881438b61b7SSimon Wunderlich ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef) 882438b61b7SSimon Wunderlich { 883438b61b7SSimon Wunderlich switch (chandef->width) { 884438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 885438b61b7SSimon Wunderlich return 2; 886438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 887438b61b7SSimon Wunderlich return 1; 888438b61b7SSimon Wunderlich default: 889438b61b7SSimon Wunderlich return 0; 890438b61b7SSimon Wunderlich } 891438b61b7SSimon Wunderlich } 892438b61b7SSimon Wunderlich 893438b61b7SSimon Wunderlich static inline int 894438b61b7SSimon Wunderlich ieee80211_vif_get_shift(struct ieee80211_vif *vif) 895438b61b7SSimon Wunderlich { 896438b61b7SSimon Wunderlich struct ieee80211_chanctx_conf *chanctx_conf; 897438b61b7SSimon Wunderlich int shift = 0; 898438b61b7SSimon Wunderlich 899438b61b7SSimon Wunderlich rcu_read_lock(); 900438b61b7SSimon Wunderlich chanctx_conf = rcu_dereference(vif->chanctx_conf); 901438b61b7SSimon Wunderlich if (chanctx_conf) 902438b61b7SSimon Wunderlich shift = ieee80211_chandef_get_shift(&chanctx_conf->def); 903438b61b7SSimon Wunderlich rcu_read_unlock(); 904438b61b7SSimon Wunderlich 905438b61b7SSimon Wunderlich return shift; 906438b61b7SSimon Wunderlich } 907438b61b7SSimon Wunderlich 908c1475ca9SJohannes Berg enum sdata_queue_type { 909c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0, 910c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_AGG_START = 1, 911c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_AGG_STOP = 2, 912c1475ca9SJohannes Berg }; 913c1475ca9SJohannes Berg 914f0706e82SJiri Benc enum { 915f0706e82SJiri Benc IEEE80211_RX_MSG = 1, 916f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2, 917f0706e82SJiri Benc }; 918f0706e82SJiri Benc 919ce7c9111SKalle Valo enum queue_stop_reason { 920ce7c9111SKalle Valo IEEE80211_QUEUE_STOP_REASON_DRIVER, 921520eb820SKalle Valo IEEE80211_QUEUE_STOP_REASON_PS, 92296f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_CSA, 92396f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_AGGREGATION, 92425420604SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SUSPEND, 9258f77f384SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 9266c17b77bSSeth Forshee IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL, 927445ea4e8SJohannes Berg IEEE80211_QUEUE_STOP_REASON_FLUSH, 928cca07b00SLuciano Coelho 929cca07b00SLuciano Coelho IEEE80211_QUEUE_STOP_REASONS, 930ce7c9111SKalle Valo }; 931ce7c9111SKalle Valo 93265a6538aSLuciano Coelho #ifdef CONFIG_MAC80211_LEDS 933e1e54068SJohannes Berg struct tpt_led_trigger { 934e1e54068SJohannes Berg struct led_trigger trig; 935e1e54068SJohannes Berg char name[32]; 936e1e54068SJohannes Berg const struct ieee80211_tpt_blink *blink_table; 937e1e54068SJohannes Berg unsigned int blink_table_len; 938e1e54068SJohannes Berg struct timer_list timer; 939e1e54068SJohannes Berg unsigned long prev_traffic; 940e1e54068SJohannes Berg unsigned long tx_bytes, rx_bytes; 94167408c8cSJohannes Berg unsigned int active, want; 94267408c8cSJohannes Berg bool running; 943e1e54068SJohannes Berg }; 94465a6538aSLuciano Coelho #endif 945e1e54068SJohannes Berg 946ad38bfc9SMatti Gottlieb /* 947ad38bfc9SMatti Gottlieb * struct ieee80211_tx_latency_bin_ranges - Tx latency statistics bins ranges 948ad38bfc9SMatti Gottlieb * 949ad38bfc9SMatti Gottlieb * Measuring Tx latency statistics. Counts how many Tx frames transmitted in a 950ad38bfc9SMatti Gottlieb * certain latency range (in Milliseconds). Each station that uses these 951ad38bfc9SMatti Gottlieb * ranges will have bins to count the amount of frames received in that range. 952ad38bfc9SMatti Gottlieb * The user can configure the ranges via debugfs. 953ad38bfc9SMatti Gottlieb * If ranges is NULL then Tx latency statistics bins are disabled for all 954ad38bfc9SMatti Gottlieb * stations. 955ad38bfc9SMatti Gottlieb * 956ad38bfc9SMatti Gottlieb * @n_ranges: number of ranges that are taken in account 957ad38bfc9SMatti Gottlieb * @ranges: the ranges that the user requested or NULL if disabled. 958ad38bfc9SMatti Gottlieb */ 959ad38bfc9SMatti Gottlieb struct ieee80211_tx_latency_bin_ranges { 960ad38bfc9SMatti Gottlieb int n_ranges; 961ad38bfc9SMatti Gottlieb u32 ranges[]; 962ad38bfc9SMatti Gottlieb }; 963ad38bfc9SMatti Gottlieb 964142b9f50SHelmut Schaa /** 965142b9f50SHelmut Schaa * mac80211 scan flags - currently active scan mode 966142b9f50SHelmut Schaa * 967142b9f50SHelmut Schaa * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as 968142b9f50SHelmut Schaa * well be on the operating channel 969142b9f50SHelmut Schaa * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to 970142b9f50SHelmut Schaa * determine if we are on the operating channel or not 9718a690674SBen Greear * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating 9728a690674SBen Greear * channel. This should not interrupt normal traffic. 9738789d459SJohannes Berg * @SCAN_COMPLETED: Set for our scan work function when the driver reported 9748789d459SJohannes Berg * that the scan completed. 9758789d459SJohannes Berg * @SCAN_ABORTED: Set for our scan work function when the driver reported 9768789d459SJohannes Berg * a scan complete for an aborted scan. 977a754055aSEmmanuel Grumbach * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being 978a754055aSEmmanuel Grumbach * cancelled. 979142b9f50SHelmut Schaa */ 980fbe9c429SHelmut Schaa enum { 981fbe9c429SHelmut Schaa SCAN_SW_SCANNING, 982142b9f50SHelmut Schaa SCAN_HW_SCANNING, 9838a690674SBen Greear SCAN_ONCHANNEL_SCANNING, 9848789d459SJohannes Berg SCAN_COMPLETED, 9858789d459SJohannes Berg SCAN_ABORTED, 986a754055aSEmmanuel Grumbach SCAN_HW_CANCELLED, 987142b9f50SHelmut Schaa }; 988142b9f50SHelmut Schaa 989142b9f50SHelmut Schaa /** 990142b9f50SHelmut Schaa * enum mac80211_scan_state - scan state machine states 991142b9f50SHelmut Schaa * 992142b9f50SHelmut Schaa * @SCAN_DECISION: Main entry point to the scan state machine, this state 993142b9f50SHelmut Schaa * determines if we should keep on scanning or switch back to the 994142b9f50SHelmut Schaa * operating channel 995142b9f50SHelmut Schaa * @SCAN_SET_CHANNEL: Set the next channel to be scanned 996142b9f50SHelmut Schaa * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses 99707ef03eeSJohannes Berg * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to 99807ef03eeSJohannes Berg * send out data 99907ef03eeSJohannes Berg * @SCAN_RESUME: Resume the scan and scan the next channel 1000cd2bb512SSam Leffler * @SCAN_ABORT: Abort the scan and go back to operating channel 1001142b9f50SHelmut Schaa */ 1002142b9f50SHelmut Schaa enum mac80211_scan_state { 1003142b9f50SHelmut Schaa SCAN_DECISION, 1004142b9f50SHelmut Schaa SCAN_SET_CHANNEL, 1005142b9f50SHelmut Schaa SCAN_SEND_PROBE, 100607ef03eeSJohannes Berg SCAN_SUSPEND, 100707ef03eeSJohannes Berg SCAN_RESUME, 1008cd2bb512SSam Leffler SCAN_ABORT, 1009fbe9c429SHelmut Schaa }; 1010fbe9c429SHelmut Schaa 1011f0706e82SJiri Benc struct ieee80211_local { 1012f0706e82SJiri Benc /* embed the driver visible part. 1013f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 1014f0706e82SJiri Benc * it first anyway so they become a no-op */ 1015f0706e82SJiri Benc struct ieee80211_hw hw; 1016f0706e82SJiri Benc 1017f0706e82SJiri Benc const struct ieee80211_ops *ops; 1018f0706e82SJiri Benc 101942935ecaSLuis R. Rodriguez /* 102042935ecaSLuis R. Rodriguez * private workqueue to mac80211. mac80211 makes this accessible 102142935ecaSLuis R. Rodriguez * via ieee80211_queue_work() 102242935ecaSLuis R. Rodriguez */ 102342935ecaSLuis R. Rodriguez struct workqueue_struct *workqueue; 102442935ecaSLuis R. Rodriguez 1025e4e72fb4SJohannes Berg unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; 1026cca07b00SLuciano Coelho int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS]; 102796f5e66eSJohannes Berg /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ 1028ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock; 102996f5e66eSJohannes Berg 1030f0706e82SJiri Benc int open_count; 10313d30d949SMichael Wu int monitors, cooked_mntrs; 10328cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 10337be5086dSJohannes Berg int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, 10347be5086dSJohannes Berg fif_probe_req; 10357be5086dSJohannes Berg int probe_req_reg; 10364150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 10373b8d81e0SJohannes Berg 10383ffc2a90SJohannes Berg bool wiphy_ciphers_allocated; 10393ffc2a90SJohannes Berg 1040fe57d9f5SJohannes Berg bool use_chanctx; 1041fe57d9f5SJohannes Berg 10423b8d81e0SJohannes Berg /* protects the aggregated multicast list and filter calls */ 10433b8d81e0SJohannes Berg spinlock_t filter_lock; 10443b8d81e0SJohannes Berg 10453ac64beeSJohannes Berg /* used for uploading changed mc list */ 10463ac64beeSJohannes Berg struct work_struct reconfig_filter; 10473ac64beeSJohannes Berg 10483b8d81e0SJohannes Berg /* aggregated multicast list */ 104922bedad3SJiri Pirko struct netdev_hw_addr_list mc_list; 10503b8d81e0SJohannes Berg 1051d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 10525bb644a0SJohannes Berg 10535bb644a0SJohannes Berg /* 10545bb644a0SJohannes Berg * suspended is true if we finished all the suspend _and_ we have 10555bb644a0SJohannes Berg * not yet come up from resume. This is to be used by mac80211 10565bb644a0SJohannes Berg * to ensure driver sanity during suspend and mac80211's own 10575bb644a0SJohannes Berg * sanity. It can eventually be used for WoW as well. 10585bb644a0SJohannes Berg */ 10595bb644a0SJohannes Berg bool suspended; 10605bb644a0SJohannes Berg 10615bb644a0SJohannes Berg /* 1062ceb99fe0SJohannes Berg * Resuming is true while suspended, but when we're reprogramming the 1063ceb99fe0SJohannes Berg * hardware -- at that time it's allowed to use ieee80211_queue_work() 1064ceb99fe0SJohannes Berg * again even though some other parts of the stack are still suspended 1065ceb99fe0SJohannes Berg * and we still drop received frames to avoid waking the stack. 1066ceb99fe0SJohannes Berg */ 1067ceb99fe0SJohannes Berg bool resuming; 1068ceb99fe0SJohannes Berg 1069ceb99fe0SJohannes Berg /* 10705bb644a0SJohannes Berg * quiescing is true during the suspend process _only_ to 10715bb644a0SJohannes Berg * ease timer cancelling etc. 10725bb644a0SJohannes Berg */ 10735bb644a0SJohannes Berg bool quiescing; 10745bb644a0SJohannes Berg 1075ea77f12fSJohannes Berg /* device is started */ 1076ea77f12fSJohannes Berg bool started; 1077ea77f12fSJohannes Berg 107804800adaSArik Nemtsov /* device is during a HW reconfig */ 107904800adaSArik Nemtsov bool in_reconfig; 108004800adaSArik Nemtsov 1081eecc4800SJohannes Berg /* wowlan is enabled -- don't reconfig on resume */ 1082eecc4800SJohannes Berg bool wowlan; 1083eecc4800SJohannes Berg 1084164eb02dSSimon Wunderlich /* DFS/radar detection is enabled */ 1085164eb02dSSimon Wunderlich bool radar_detect_enabled; 1086164eb02dSSimon Wunderlich struct work_struct radar_detected_work; 1087164eb02dSSimon Wunderlich 108804ecd257SJohannes Berg /* number of RX chains the hardware has */ 108904ecd257SJohannes Berg u8 rx_chains; 109004ecd257SJohannes Berg 1091b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 1092f0706e82SJiri Benc 1093f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 1094f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 1095f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 1096f0706e82SJiri Benc * queues increases over the limit. */ 1097f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 1098f0706e82SJiri Benc struct tasklet_struct tasklet; 1099f0706e82SJiri Benc struct sk_buff_head skb_queue; 1100f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 1101f0706e82SJiri Benc 1102f9e124fbSChristian Lamparter spinlock_t rx_path_lock; 110324a8fdadSChristian Lamparter 1104d0709a65SJohannes Berg /* Station data */ 1105d0709a65SJohannes Berg /* 11064d33960bSJohannes Berg * The mutex only protects the list, hash table and 11074d33960bSJohannes Berg * counter, reads are done with RCU. 1108d0709a65SJohannes Berg */ 110934e89507SJohannes Berg struct mutex sta_mtx; 11104d33960bSJohannes Berg spinlock_t tim_lock; 1111d0709a65SJohannes Berg unsigned long num_sta; 11124d33960bSJohannes Berg struct list_head sta_list; 111340b275b6SJohannes Berg struct sta_info __rcu *sta_hash[STA_HASH_SIZE]; 1114f0706e82SJiri Benc struct timer_list sta_cleanup; 1115f5ea9120SJohannes Berg int sta_generation; 1116f0706e82SJiri Benc 1117ad38bfc9SMatti Gottlieb /* 1118ad38bfc9SMatti Gottlieb * Tx latency statistics parameters for all stations. 1119ad38bfc9SMatti Gottlieb * Can enable via debugfs (NULL when disabled). 1120ad38bfc9SMatti Gottlieb */ 1121ad38bfc9SMatti Gottlieb struct ieee80211_tx_latency_bin_ranges __rcu *tx_latency; 1122ad38bfc9SMatti Gottlieb 11232a577d98SJohannes Berg struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; 1124f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 1125f0706e82SJiri Benc 1126a6a67db2SJohannes Berg atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; 1127cd8ffc80SJohannes Berg 1128f0706e82SJiri Benc /* number of interfaces with corresponding IFF_ flags */ 112953918994SJohannes Berg atomic_t iff_allmultis, iff_promiscs; 1130f0706e82SJiri Benc 1131f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 1132f0706e82SJiri Benc 11335f9f1812SFelix Fietkau struct crypto_cipher *wep_tx_tfm; 11345f9f1812SFelix Fietkau struct crypto_cipher *wep_rx_tfm; 1135f0706e82SJiri Benc u32 wep_iv; 1136f0706e82SJiri Benc 1137c771c9d8SJohannes Berg /* see iface.c */ 113879010420SJohannes Berg struct list_head interfaces; 1139c771c9d8SJohannes Berg struct mutex iflist_mtx; 114079010420SJohannes Berg 1141b16bd15cSJohannes Berg /* 1142ad0e2b5aSJohannes Berg * Key mutex, protects sdata's key_list and sta_info's 1143b16bd15cSJohannes Berg * key pointers (write access, they're RCU.) 1144b16bd15cSJohannes Berg */ 1145ad0e2b5aSJohannes Berg struct mutex key_mtx; 1146b16bd15cSJohannes Berg 1147a1699b75SJohannes Berg /* mutex for scan and work locking */ 1148a1699b75SJohannes Berg struct mutex mtx; 1149b16bd15cSJohannes Berg 1150c2b13452SJohannes Berg /* Scanning and BSS list */ 1151fbe9c429SHelmut Schaa unsigned long scanning; 11522a519311SJohannes Berg struct cfg80211_ssid scan_ssid; 11535ba63533SJohannes Berg struct cfg80211_scan_request *int_scan_req; 11544d36ec58SJohannes Berg struct cfg80211_scan_request *scan_req, *hw_scan_req; 11557ca15a0aSSimon Wunderlich struct cfg80211_chan_def scan_chandef; 11564d36ec58SJohannes Berg enum ieee80211_band hw_scan_band; 1157f0706e82SJiri Benc int scan_channel_idx; 1158de95a54bSJohannes Berg int scan_ies_len; 1159c604b9f2SJohannes Berg int hw_scan_ies_bufsize; 11608318d78aSJohannes Berg 116185a9994aSLuciano Coelho struct work_struct sched_scan_stopped_work; 11625260a5b2SJohannes Berg struct ieee80211_sub_if_data __rcu *sched_scan_sdata; 1163d43c6b6eSDavid Spinadel struct cfg80211_sched_scan_request *sched_scan_req; 116479f460caSLuciano Coelho 1165df13cce5SHelmut Schaa unsigned long leave_oper_channel_time; 1166977923b0SHelmut Schaa enum mac80211_scan_state next_scan_state; 1167f0706e82SJiri Benc struct delayed_work scan_work; 1168e2fd5dbcSJohannes Berg struct ieee80211_sub_if_data __rcu *scan_sdata; 116955de908aSJohannes Berg /* For backward compatibility only -- do not use */ 1170675a0b04SKarl Beldan struct cfg80211_chan_def _oper_chandef; 1171f0706e82SJiri Benc 1172b8bc4b0aSJohannes Berg /* Temporary remain-on-channel for off-channel operations */ 1173b8bc4b0aSJohannes Berg struct ieee80211_channel *tmp_channel; 1174b8bc4b0aSJohannes Berg 1175d01a1e65SMichal Kazior /* channel contexts */ 1176d01a1e65SMichal Kazior struct list_head chanctx_list; 1177d01a1e65SMichal Kazior struct mutex chanctx_mtx; 1178d01a1e65SMichal Kazior 1179f0706e82SJiri Benc /* SNMP counters */ 1180f0706e82SJiri Benc /* dot11CountersTable */ 1181f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 1182f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 1183f0706e82SJiri Benc u32 dot11FailedCount; 1184f0706e82SJiri Benc u32 dot11RetryCount; 1185f0706e82SJiri Benc u32 dot11MultipleRetryCount; 1186f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 1187f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 1188f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 1189f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 1190f0706e82SJiri Benc 1191f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS 1192cdcb006fSIvo van Doorn struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; 1193e1e54068SJohannes Berg struct tpt_led_trigger *tpt_led_trigger; 1194cdcb006fSIvo van Doorn char tx_led_name[32], rx_led_name[32], 1195cdcb006fSIvo van Doorn assoc_led_name[32], radio_led_name[32]; 1196f0706e82SJiri Benc #endif 1197f0706e82SJiri Benc 1198f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 1199f0706e82SJiri Benc /* TX/RX handler statistics */ 1200f0706e82SJiri Benc unsigned int tx_handlers_drop; 1201f0706e82SJiri Benc unsigned int tx_handlers_queued; 1202f0706e82SJiri Benc unsigned int tx_handlers_drop_unencrypted; 1203f0706e82SJiri Benc unsigned int tx_handlers_drop_fragment; 1204f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 1205f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 1206f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 1207f0706e82SJiri Benc unsigned int rx_handlers_drop; 1208f0706e82SJiri Benc unsigned int rx_handlers_queued; 1209f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 1210f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 1211f0706e82SJiri Benc unsigned int rx_handlers_drop_short; 1212f0706e82SJiri Benc unsigned int tx_expand_skb_head; 1213f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 1214f0706e82SJiri Benc unsigned int rx_expand_skb_head; 1215f0706e82SJiri Benc unsigned int rx_expand_skb_head2; 1216f0706e82SJiri Benc unsigned int rx_handlers_fragments; 1217f0706e82SJiri Benc unsigned int tx_status_drop; 1218f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 1219f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1220f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 1221f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1222f0706e82SJiri Benc 1223f0706e82SJiri Benc 1224f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 1225f0706e82SJiri Benc * multicast packets for power saving stations 1226f0706e82SJiri Benc */ 1227520eb820SKalle Valo 1228572e0012SKalle Valo bool pspolling; 1229b203ffc3SJouni Malinen bool offchannel_ps_enabled; 1230965bedadSJohannes Berg /* 1231965bedadSJohannes Berg * PS can only be enabled when we have exactly one managed 1232965bedadSJohannes Berg * interface (and monitors) in PS, this then points there. 1233965bedadSJohannes Berg */ 1234965bedadSJohannes Berg struct ieee80211_sub_if_data *ps_sdata; 1235520eb820SKalle Valo struct work_struct dynamic_ps_enable_work; 1236520eb820SKalle Valo struct work_struct dynamic_ps_disable_work; 1237520eb820SKalle Valo struct timer_list dynamic_ps_timer; 123810f644a4SJohannes Berg struct notifier_block network_latency_notifier; 12392b2c009eSJuuso Oikarinen struct notifier_block ifa_notifier; 1240a65240c1SJohannes Berg struct notifier_block ifa6_notifier; 1241f0706e82SJiri Benc 1242ff616381SJuuso Oikarinen /* 1243ff616381SJuuso Oikarinen * The dynamic ps timeout configured from user space via WEXT - 1244ff616381SJuuso Oikarinen * this will override whatever chosen by mac80211 internally. 1245ff616381SJuuso Oikarinen */ 1246ff616381SJuuso Oikarinen int dynamic_ps_forced_timeout; 1247ff616381SJuuso Oikarinen 12481ea6f9c0SJohannes Berg int user_power_level; /* in dBm, for all interfaces */ 12492bf30fabSJohannes Berg 12500f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode; 12510f78231bSJohannes Berg 1252f2753ddbSJohannes Berg struct work_struct restart_work; 1253f2753ddbSJohannes Berg 1254e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 1255e9f207f0SJiri Benc struct local_debugfsdentries { 12564b7679a5SJohannes Berg struct dentry *rcdir; 1257e9f207f0SJiri Benc struct dentry *keys; 1258e9f207f0SJiri Benc } debugfs; 1259e9f207f0SJiri Benc #endif 12604e6cbfd0SJohn W. Linville 12612eb278e0SJohannes Berg /* 12622eb278e0SJohannes Berg * Remain-on-channel support 12632eb278e0SJohannes Berg */ 12642eb278e0SJohannes Berg struct list_head roc_list; 126521f83589SJohannes Berg struct work_struct hw_roc_start, hw_roc_done; 12662eb278e0SJohannes Berg unsigned long hw_roc_start_time; 126750febf6aSJohannes Berg u64 roc_cookie_counter; 126821f83589SJohannes Berg 1269a729cff8SJohannes Berg struct idr ack_status_frames; 1270a729cff8SJohannes Berg spinlock_t ack_status_lock; 1271a729cff8SJohannes Berg 1272f142c6b9SJohannes Berg struct ieee80211_sub_if_data __rcu *p2p_sdata; 1273f142c6b9SJohannes Berg 127406d181a8SJohannes Berg struct napi_struct *napi; 127506d181a8SJohannes Berg 12764b6f1dd6SJohannes Berg /* virtual monitor interface */ 12774b6f1dd6SJohannes Berg struct ieee80211_sub_if_data __rcu *monitor_sdata; 12784bf88530SJohannes Berg struct cfg80211_chan_def monitor_chandef; 1279f0706e82SJiri Benc }; 1280f0706e82SJiri Benc 12813e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 12823e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) 12833e122be0SJohannes Berg { 12843e122be0SJohannes Berg return netdev_priv(dev); 12853e122be0SJohannes Berg } 12863e122be0SJohannes Berg 128771bbc994SJohannes Berg static inline struct ieee80211_sub_if_data * 128871bbc994SJohannes Berg IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev) 128971bbc994SJohannes Berg { 129071bbc994SJohannes Berg return container_of(wdev, struct ieee80211_sub_if_data, wdev); 129171bbc994SJohannes Berg } 129271bbc994SJohannes Berg 1293c1475ca9SJohannes Berg /* this struct represents 802.11n's RA/TID combination */ 1294eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid { 1295eadc8d9eSRon Rindjunsky u8 ra[ETH_ALEN]; 1296eadc8d9eSRon Rindjunsky u16 tid; 1297eadc8d9eSRon Rindjunsky }; 1298eadc8d9eSRon Rindjunsky 1299c0f17eb9SChun-Yeow Yeoh /* this struct holds the value parsing from channel switch IE */ 1300c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie { 1301c0f17eb9SChun-Yeow Yeoh struct cfg80211_chan_def chandef; 1302c0f17eb9SChun-Yeow Yeoh u8 mode; 1303c0f17eb9SChun-Yeow Yeoh u8 count; 1304c0f17eb9SChun-Yeow Yeoh u8 ttl; 13053f718fd8SChun-Yeow Yeoh u16 pre_value; 1306c0f17eb9SChun-Yeow Yeoh }; 1307c0f17eb9SChun-Yeow Yeoh 1308dd76986bSJohannes Berg /* Parsed Information Elements */ 1309dd76986bSJohannes Berg struct ieee802_11_elems { 13104a3cb702SJohannes Berg const u8 *ie_start; 1311dd76986bSJohannes Berg size_t total_len; 1312dd76986bSJohannes Berg 1313dd76986bSJohannes Berg /* pointers to IEs */ 13144a3cb702SJohannes Berg const u8 *ssid; 13154a3cb702SJohannes Berg const u8 *supp_rates; 13164a3cb702SJohannes Berg const u8 *ds_params; 13174a3cb702SJohannes Berg const struct ieee80211_tim_ie *tim; 13184a3cb702SJohannes Berg const u8 *challenge; 13194a3cb702SJohannes Berg const u8 *rsn; 13204a3cb702SJohannes Berg const u8 *erp_info; 13214a3cb702SJohannes Berg const u8 *ext_supp_rates; 13224a3cb702SJohannes Berg const u8 *wmm_info; 13234a3cb702SJohannes Berg const u8 *wmm_param; 13244a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_elem; 13254a3cb702SJohannes Berg const struct ieee80211_ht_operation *ht_operation; 13264a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_elem; 13274a3cb702SJohannes Berg const struct ieee80211_vht_operation *vht_operation; 13284a3cb702SJohannes Berg const struct ieee80211_meshconf_ie *mesh_config; 13294a3cb702SJohannes Berg const u8 *mesh_id; 13304a3cb702SJohannes Berg const u8 *peering; 13314a3cb702SJohannes Berg const __le16 *awake_window; 13324a3cb702SJohannes Berg const u8 *preq; 13334a3cb702SJohannes Berg const u8 *prep; 13344a3cb702SJohannes Berg const u8 *perr; 13354a3cb702SJohannes Berg const struct ieee80211_rann_ie *rann; 13364a3cb702SJohannes Berg const struct ieee80211_channel_sw_ie *ch_switch_ie; 1337b4f286a1SJohannes Berg const struct ieee80211_ext_chansw_ie *ext_chansw_ie; 1338b2e506bfSJohannes Berg const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie; 13394a3cb702SJohannes Berg const u8 *country_elem; 13404a3cb702SJohannes Berg const u8 *pwr_constr_elem; 134179ba1d89SJohannes Berg const struct ieee80211_timeout_interval_ie *timeout_int; 13424a3cb702SJohannes Berg const u8 *opmode_notif; 134385220d71SJohannes Berg const struct ieee80211_sec_chan_offs_ie *sec_chan_offs; 13448f2535b9SChun-Yeow Yeoh const struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie; 1345dd76986bSJohannes Berg 1346dd76986bSJohannes Berg /* length of them, respectively */ 1347dd76986bSJohannes Berg u8 ssid_len; 1348dd76986bSJohannes Berg u8 supp_rates_len; 1349dd76986bSJohannes Berg u8 tim_len; 1350dd76986bSJohannes Berg u8 challenge_len; 1351dd76986bSJohannes Berg u8 rsn_len; 1352dd76986bSJohannes Berg u8 ext_supp_rates_len; 1353dd76986bSJohannes Berg u8 wmm_info_len; 1354dd76986bSJohannes Berg u8 wmm_param_len; 1355dd76986bSJohannes Berg u8 mesh_id_len; 1356dd76986bSJohannes Berg u8 peering_len; 1357dd76986bSJohannes Berg u8 preq_len; 1358dd76986bSJohannes Berg u8 prep_len; 1359dd76986bSJohannes Berg u8 perr_len; 1360dd76986bSJohannes Berg u8 country_elem_len; 1361fcff4f10SPaul Stewart 1362fcff4f10SPaul Stewart /* whether a parse error occurred while retrieving these elements */ 1363fcff4f10SPaul Stewart bool parse_error; 1364dd76986bSJohannes Berg }; 1365dd76986bSJohannes Berg 1366f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 1367f0706e82SJiri Benc struct ieee80211_hw *hw) 1368f0706e82SJiri Benc { 1369f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 1370f0706e82SJiri Benc } 1371f0706e82SJiri Benc 1372f0706e82SJiri Benc 1373571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) 1374571ecf67SJohannes Berg { 1375b203ca39SJoe Perches return ether_addr_equal(raddr, addr) || 1376571ecf67SJohannes Berg is_broadcast_ether_addr(raddr); 1377571ecf67SJohannes Berg } 1378571ecf67SJohannes Berg 1379f4bda337SThomas Pedersen static inline bool 1380f4bda337SThomas Pedersen ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) 1381f4bda337SThomas Pedersen { 1382f4bda337SThomas Pedersen WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START && 1383f4bda337SThomas Pedersen status->flag & RX_FLAG_MACTIME_END); 1384f4bda337SThomas Pedersen return status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END); 1385f4bda337SThomas Pedersen } 1386571ecf67SJohannes Berg 1387f4bda337SThomas Pedersen u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, 1388f4bda337SThomas Pedersen struct ieee80211_rx_status *status, 1389f4bda337SThomas Pedersen unsigned int mpdu_len, 1390f4bda337SThomas Pedersen unsigned int mpdu_offset); 1391e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 13925cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 13939c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 13949c6bd790SJohannes Berg u32 changed); 13950d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local); 139646900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 1397f0706e82SJiri Benc 139846900298SJohannes Berg /* STA code */ 13999c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 140077fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, 140177fdaa12SJohannes Berg struct cfg80211_auth_request *req); 140277fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 140377fdaa12SJohannes Berg struct cfg80211_assoc_request *req); 140477fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, 140563c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 140677fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 140763c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 1408572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local, 1409572e0012SKalle Valo struct ieee80211_sub_if_data *sdata); 141010f644a4SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); 1411ab095877SEliad Peller void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata); 141210f644a4SJohannes Berg int ieee80211_max_network_latency(struct notifier_block *nb, 141310f644a4SJohannes Berg unsigned long data, void *dummy); 14142b2c009eSJuuso Oikarinen int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); 14151fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); 14161fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 14171fa57d01SJohannes Berg struct sk_buff *skb); 1418d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); 1419be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); 1420afa762f6SEliad Peller void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); 14211672c0e3SJohannes Berg void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata, 14221672c0e3SJohannes Berg __le16 fc, bool acked); 14231a1cb744SJohannes Berg void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata); 1424b8360ab8SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); 14259c6bd790SJohannes Berg 142646900298SJohannes Berg /* IBSS code */ 142746900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); 142846900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); 14298bf11d8dSJohannes Berg void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, 14308bf11d8dSJohannes Berg const u8 *bssid, const u8 *addr, u32 supp_rates); 1431af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 1432af8cdcd8SJohannes Berg struct cfg80211_ibss_params *params); 1433af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); 14341fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata); 14351fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 14361fa57d01SJohannes Berg struct sk_buff *skb); 1437cd7760e6SSimon Wunderlich int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata, 1438cd7760e6SSimon Wunderlich struct cfg80211_csa_settings *csa_settings); 1439cd7760e6SSimon Wunderlich int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata); 1440cd7760e6SSimon Wunderlich void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata); 14411fa57d01SJohannes Berg 14421fa57d01SJohannes Berg /* mesh code */ 14431fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata); 14441fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 14451fa57d01SJohannes Berg struct sk_buff *skb); 1446b8456a14SChun-Yeow Yeoh int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata, 144766e01cf9SLuciano Coelho struct cfg80211_csa_settings *csa_settings); 1448b8456a14SChun-Yeow Yeoh int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata); 144946900298SJohannes Berg 14509c6bd790SJohannes Berg /* scan/BSS handling */ 145146900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work); 145234bcf715SStanislaw Gruszka int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, 1453be4a4b6aSJohannes Berg const u8 *ssid, u8 ssid_len, 14547ca15a0aSSimon Wunderlich struct ieee80211_channel *chan, 14557ca15a0aSSimon Wunderlich enum nl80211_bss_scan_width scan_width); 1456c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 14572a519311SJohannes Berg struct cfg80211_scan_request *req); 14585bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local); 1459133d40f9SStanislaw Gruszka void ieee80211_run_deferred_scan(struct ieee80211_local *local); 1460d48b2968SJohannes Berg void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb); 14619c6bd790SJohannes Berg 14620a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 1463c2b13452SJohannes Berg struct ieee80211_bss * 146498c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local, 146598c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status, 146698c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt, 146798c8fccfSJohannes Berg size_t len, 146898c8fccfSJohannes Berg struct ieee802_11_elems *elems, 1469d45c4172SEmmanuel Grumbach struct ieee80211_channel *channel); 147098c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local, 1471c2b13452SJohannes Berg struct ieee80211_bss *bss); 1472ee385855SLuis Carlos Cobo 147379f460caSLuciano Coelho /* scheduled scan handling */ 1474d43c6b6eSDavid Spinadel int 1475d43c6b6eSDavid Spinadel __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 1476d43c6b6eSDavid Spinadel struct cfg80211_sched_scan_request *req); 147779f460caSLuciano Coelho int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 147879f460caSLuciano Coelho struct cfg80211_sched_scan_request *req); 147985a9994aSLuciano Coelho int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata); 1480f6837ba8SJohannes Berg void ieee80211_sched_scan_end(struct ieee80211_local *local); 148185a9994aSLuciano Coelho void ieee80211_sched_scan_stopped_work(struct work_struct *work); 148279f460caSLuciano Coelho 1483b203ffc3SJouni Malinen /* off-channel helpers */ 1484aacde9eeSStanislaw Gruszka void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local); 1485aacde9eeSStanislaw Gruszka void ieee80211_offchannel_return(struct ieee80211_local *local); 14862eb278e0SJohannes Berg void ieee80211_roc_setup(struct ieee80211_local *local); 14872eb278e0SJohannes Berg void ieee80211_start_next_roc(struct ieee80211_local *local); 1488c8f994eeSJohannes Berg void ieee80211_roc_purge(struct ieee80211_local *local, 1489c8f994eeSJohannes Berg struct ieee80211_sub_if_data *sdata); 14903fbd45caSJohannes Berg void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free); 14912eb278e0SJohannes Berg void ieee80211_sw_roc_work(struct work_struct *work); 14922eb278e0SJohannes Berg void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc); 1493b203ffc3SJouni Malinen 149473da7d5bSSimon Wunderlich /* channel switch handling */ 149573da7d5bSSimon Wunderlich void ieee80211_csa_finalize_work(struct work_struct *work); 149682a8e17dSLuciano Coelho int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev, 149782a8e17dSLuciano Coelho struct cfg80211_csa_settings *params); 149873da7d5bSSimon Wunderlich 14993e122be0SJohannes Berg /* interface handling */ 150047846c9bSJohannes Berg int ieee80211_iface_init(void); 150147846c9bSJohannes Berg void ieee80211_iface_exit(void); 15023e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 150384efbb84SJohannes Berg struct wireless_dev **new_wdev, enum nl80211_iftype type, 1504ee385855SLuis Carlos Cobo struct vif_params *params); 1505f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 150605c914feSJohannes Berg enum nl80211_iftype type); 1507f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 150875636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 1509382a103bSJohannes Berg u32 ieee80211_idle_off(struct ieee80211_local *local); 15105cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local); 151185416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, 151285416a4fSChristian Lamparter const int offset); 1513f142c6b9SJohannes Berg int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up); 1514f142c6b9SJohannes Berg void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); 15153c3e21e7SJohannes Berg int ieee80211_add_virtual_monitor(struct ieee80211_local *local); 15163c3e21e7SJohannes Berg void ieee80211_del_virtual_monitor(struct ieee80211_local *local); 1517f0706e82SJiri Benc 15181ea6f9c0SJohannes Berg bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 15191ea6f9c0SJohannes Berg void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 15201ea6f9c0SJohannes Berg 15219607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) 15229607e6b6SJohannes Berg { 152334d4bc4dSJohannes Berg return test_bit(SDATA_STATE_RUNNING, &sdata->state); 15249607e6b6SJohannes Berg } 15259607e6b6SJohannes Berg 1526e2ebc74dSJohannes Berg /* tx handling */ 1527e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 1528e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data); 1529d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1530d0cf9c0dSStephen Hemminger struct net_device *dev); 1531d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, 1532d0cf9c0dSStephen Hemminger struct net_device *dev); 15331f98ab7fSFelix Fietkau void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, 15341f98ab7fSFelix Fietkau struct sk_buff_head *skbs); 1535e2ebc74dSJohannes Berg 1536de1ede7aSJohannes Berg /* HT */ 1537ef96a842SBen Greear void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, 1538ef96a842SBen Greear struct ieee80211_sta_ht_cap *ht_cap); 1539e1a0c6b3SJohannes Berg bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, 1540ef96a842SBen Greear struct ieee80211_supported_band *sband, 15414a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_ie, 1542e1a0c6b3SJohannes Berg struct sta_info *sta); 1543b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, 1544b8695a8fSJohannes Berg const u8 *da, u16 tid, 1545b8695a8fSJohannes Berg u16 initiator, u16 reason_code); 15460f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, 15470f78231bSJohannes Berg enum ieee80211_smps_mode smps, const u8 *da, 15480f78231bSJohannes Berg const u8 *bssid); 1549687da132SEmmanuel Grumbach void ieee80211_request_smps_ap_work(struct work_struct *work); 1550687da132SEmmanuel Grumbach void ieee80211_request_smps_mgd_work(struct work_struct *work); 1551687da132SEmmanuel Grumbach bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old, 1552687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode_new); 1553de1ede7aSJohannes Berg 15547c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 155553f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1556849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 155753f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1558c82c4a80SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, 1559c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 1560de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, 1561de1ede7aSJohannes Berg struct sta_info *sta, 1562de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len); 1563de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local, 1564de1ede7aSJohannes Berg struct sta_info *sta, 1565de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1566de1ede7aSJohannes Berg size_t len); 1567de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local, 1568de1ede7aSJohannes Berg struct sta_info *sta, 1569de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1570de1ede7aSJohannes Berg size_t len); 1571de1ede7aSJohannes Berg 1572849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1573c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 157467c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1575c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 15765d22c89bSJohannes Berg void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); 15775d22c89bSJohannes Berg void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); 157867c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work); 157967c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); 15802bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid); 1581849b7967SJohannes Berg 158204ecd257SJohannes Berg u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs); 158304ecd257SJohannes Berg 1584818255eaSMahesh Palivela /* VHT */ 15854a3cb702SJohannes Berg void 15864a3cb702SJohannes Berg ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, 1587818255eaSMahesh Palivela struct ieee80211_supported_band *sband, 15884a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_ie, 15894a34215eSJohannes Berg struct sta_info *sta); 1590e1a0c6b3SJohannes Berg enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); 15918921d04eSJohannes Berg void ieee80211_sta_set_rx_nss(struct sta_info *sta); 1592b1bce14aSMarek Kwaczynski u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 1593b1bce14aSMarek Kwaczynski struct sta_info *sta, u8 opmode, 1594b1bce14aSMarek Kwaczynski enum ieee80211_band band, bool nss_only); 15950af83d3dSJohannes Berg void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 15960af83d3dSJohannes Berg struct sta_info *sta, u8 opmode, 1597bee7f586SJohannes Berg enum ieee80211_band band, bool nss_only); 1598dd5ecfeaSJohannes Berg void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, 1599dd5ecfeaSJohannes Berg struct ieee80211_sta_vht_cap *vht_cap); 16004a34215eSJohannes Berg 160139192c0bSJohannes Berg /* Spectrum management */ 160239192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 160339192c0bSJohannes Berg struct ieee80211_mgmt *mgmt, 160439192c0bSJohannes Berg size_t len); 1605e6b7cde4SSimon Wunderlich /** 1606e6b7cde4SSimon Wunderlich * ieee80211_parse_ch_switch_ie - parses channel switch IEs 1607e6b7cde4SSimon Wunderlich * @sdata: the sdata of the interface which has received the frame 1608e6b7cde4SSimon Wunderlich * @elems: parsed 802.11 elements received with the frame 1609e6b7cde4SSimon Wunderlich * @beacon: indicates if the frame was a beacon or probe response 1610e6b7cde4SSimon Wunderlich * @current_band: indicates the current band 1611e6b7cde4SSimon Wunderlich * @sta_flags: contains information about own capabilities and restrictions 1612e6b7cde4SSimon Wunderlich * to decide which channel switch announcements can be accepted. Only the 1613e6b7cde4SSimon Wunderlich * following subset of &enum ieee80211_sta_flags are evaluated: 1614e6b7cde4SSimon Wunderlich * %IEEE80211_STA_DISABLE_HT, %IEEE80211_STA_DISABLE_VHT, 1615e6b7cde4SSimon Wunderlich * %IEEE80211_STA_DISABLE_40MHZ, %IEEE80211_STA_DISABLE_80P80MHZ, 1616e6b7cde4SSimon Wunderlich * %IEEE80211_STA_DISABLE_160MHZ. 1617e6b7cde4SSimon Wunderlich * @bssid: the currently connected bssid (for reporting) 1618c0f17eb9SChun-Yeow Yeoh * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl. 1619c0f17eb9SChun-Yeow Yeoh All of them will be filled with if success only. 1620e6b7cde4SSimon Wunderlich * Return: 0 on success, <0 on error and >0 if there is nothing to parse. 1621e6b7cde4SSimon Wunderlich */ 1622e6b7cde4SSimon Wunderlich int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata, 1623e6b7cde4SSimon Wunderlich struct ieee802_11_elems *elems, bool beacon, 1624e6b7cde4SSimon Wunderlich enum ieee80211_band current_band, 1625c0f17eb9SChun-Yeow Yeoh u32 sta_flags, u8 *bssid, 1626c0f17eb9SChun-Yeow Yeoh struct ieee80211_csa_ie *csa_ie); 162739192c0bSJohannes Berg 1628f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */ 1629f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local); 163084f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local); 1631f2753ddbSJohannes Berg 1632eecc4800SJohannes Berg int __ieee80211_suspend(struct ieee80211_hw *hw, 1633eecc4800SJohannes Berg struct cfg80211_wowlan *wowlan); 1634f2753ddbSJohannes Berg 1635f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 1636f2753ddbSJohannes Berg { 163785f72bc8SJohn W. Linville struct ieee80211_local *local = hw_to_local(hw); 163885f72bc8SJohn W. Linville 163985f72bc8SJohn W. Linville WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), 164085f72bc8SJohn W. Linville "%s: resume with hardware scan still in progress\n", 164185f72bc8SJohn W. Linville wiphy_name(hw->wiphy)); 164285f72bc8SJohn W. Linville 1643f2753ddbSJohannes Berg return ieee80211_reconfig(hw_to_local(hw)); 1644f2753ddbSJohannes Berg } 1645665af4fcSBob Copeland 1646c2d1560aSJohannes Berg /* utility functions/constants */ 16478a47cea7SJohannes Berg extern const void *const mac80211_wiphy_privid; /* for wiphy privid */ 164871364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 164905c914feSJohannes Berg enum nl80211_iftype type); 16504ee73f33SMichal Kazior int ieee80211_frame_duration(enum ieee80211_band band, size_t len, 1651438b61b7SSimon Wunderlich int rate, int erp, int short_preamble, 1652438b61b7SSimon Wunderlich int shift); 1653f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 1654e6d6e342SJohannes Berg struct ieee80211_hdr *hdr, const u8 *tsc, 1655e6d6e342SJohannes Berg gfp_t gfp); 16563abead59SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, 16573abead59SJohannes Berg bool bss_notify); 165855de908aSJohannes Berg void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 165955de908aSJohannes Berg enum ieee80211_band band); 1660cf6bb79aSHelmut Schaa 166155de908aSJohannes Berg void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 166255de908aSJohannes Berg struct sk_buff *skb, int tid, 166355de908aSJohannes Berg enum ieee80211_band band); 166455de908aSJohannes Berg 166555de908aSJohannes Berg static inline void 166655de908aSJohannes Berg ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 166755de908aSJohannes Berg struct sk_buff *skb, int tid, 166855de908aSJohannes Berg enum ieee80211_band band) 166955de908aSJohannes Berg { 167055de908aSJohannes Berg rcu_read_lock(); 167155de908aSJohannes Berg __ieee80211_tx_skb_tid_band(sdata, skb, tid, band); 167255de908aSJohannes Berg rcu_read_unlock(); 167355de908aSJohannes Berg } 167455de908aSJohannes Berg 167555de908aSJohannes Berg static inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, 167655de908aSJohannes Berg struct sk_buff *skb, int tid) 167755de908aSJohannes Berg { 167855de908aSJohannes Berg struct ieee80211_chanctx_conf *chanctx_conf; 167955de908aSJohannes Berg 168055de908aSJohannes Berg rcu_read_lock(); 168155de908aSJohannes Berg chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 168255de908aSJohannes Berg if (WARN_ON(!chanctx_conf)) { 168355de908aSJohannes Berg rcu_read_unlock(); 168455de908aSJohannes Berg kfree_skb(skb); 168555de908aSJohannes Berg return; 168655de908aSJohannes Berg } 168755de908aSJohannes Berg 168855de908aSJohannes Berg __ieee80211_tx_skb_tid_band(sdata, skb, tid, 16894bf88530SJohannes Berg chanctx_conf->def.chan->band); 169055de908aSJohannes Berg rcu_read_unlock(); 169155de908aSJohannes Berg } 169255de908aSJohannes Berg 169355de908aSJohannes Berg static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, 1694cf6bb79aSHelmut Schaa struct sk_buff *skb) 1695cf6bb79aSHelmut Schaa { 1696cf6bb79aSHelmut Schaa /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */ 1697cf6bb79aSHelmut Schaa ieee80211_tx_skb_tid(sdata, skb, 7); 1698cf6bb79aSHelmut Schaa } 1699cf6bb79aSHelmut Schaa 170035d865afSJohannes Berg u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, 1701d91f36dbSJohannes Berg struct ieee802_11_elems *elems, 1702d91f36dbSJohannes Berg u64 filter, u32 crc); 170335d865afSJohannes Berg static inline void ieee802_11_parse_elems(const u8 *start, size_t len, 170435d865afSJohannes Berg bool action, 1705ddc4db2eSJohannes Berg struct ieee802_11_elems *elems) 1706ddc4db2eSJohannes Berg { 1707b2e506bfSJohannes Berg ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0); 1708ddc4db2eSJohannes Berg } 1709ddc4db2eSJohannes Berg 1710520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 1711520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 1712520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data); 1713a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local, 1714a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata, 1715a97b77b9SVivek Natarajan int powersave); 17163cf335d5SKalle Valo void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, 17173cf335d5SKalle Valo struct ieee80211_hdr *hdr); 17184e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 171904ac3c0eSFelix Fietkau struct ieee80211_hdr *hdr, bool ack); 1720520eb820SKalle Valo 1721ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 1722445ea4e8SJohannes Berg unsigned long queues, 1723cca07b00SLuciano Coelho enum queue_stop_reason reason, 1724cca07b00SLuciano Coelho bool refcounted); 172526da23b6SLuciano Coelho void ieee80211_stop_vif_queues(struct ieee80211_local *local, 172626da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata, 172726da23b6SLuciano Coelho enum queue_stop_reason reason); 172826da23b6SLuciano Coelho void ieee80211_wake_vif_queues(struct ieee80211_local *local, 172926da23b6SLuciano Coelho struct ieee80211_sub_if_data *sdata, 173026da23b6SLuciano Coelho enum queue_stop_reason reason); 1731ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 1732445ea4e8SJohannes Berg unsigned long queues, 1733cca07b00SLuciano Coelho enum queue_stop_reason reason, 1734cca07b00SLuciano Coelho bool refcounted); 173596f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 1736cca07b00SLuciano Coelho enum queue_stop_reason reason, 1737cca07b00SLuciano Coelho bool refcounted); 173896f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, 1739cca07b00SLuciano Coelho enum queue_stop_reason reason, 1740cca07b00SLuciano Coelho bool refcounted); 17413a25a8c8SJohannes Berg void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); 17428f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local, 17438f77f384SJohannes Berg struct sk_buff *skb); 1744e3685e03SJohannes Berg void ieee80211_add_pending_skbs(struct ieee80211_local *local, 1745e3685e03SJohannes Berg struct sk_buff_head *skbs); 174639ecc01dSJohannes Berg void ieee80211_flush_queues(struct ieee80211_local *local, 174739ecc01dSJohannes Berg struct ieee80211_sub_if_data *sdata); 1748ce7c9111SKalle Valo 174946900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 1750700e8ea6SJouni Malinen u16 transaction, u16 auth_alg, u16 status, 17514a3cb702SJohannes Berg const u8 *extra, size_t extra_len, const u8 *bssid, 17521672c0e3SJohannes Berg const u8 *da, const u8 *key, u8 key_len, u8 key_idx, 17531672c0e3SJohannes Berg u32 tx_flags); 17546ae16775SAntonio Quartulli void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, 17556ae16775SAntonio Quartulli const u8 *bssid, u16 stype, u16 reason, 17566ae16775SAntonio Quartulli bool send_frame, u8 *frame_buf); 1757de95a54bSJohannes Berg int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, 1758c604b9f2SJohannes Berg size_t buffer_len, const u8 *ie, size_t ie_len, 1759651b5225SJouni Malinen enum ieee80211_band band, u32 rate_mask, 17602103dec1SSimon Wunderlich struct cfg80211_chan_def *chandef); 1761a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 176285a237feSJohannes Berg u8 *dst, u32 ratemask, 17636b77863bSJohannes Berg struct ieee80211_channel *chan, 1764a619a4c0SJuuso Oikarinen const u8 *ssid, size_t ssid_len, 1765a806c558SPaul Stewart const u8 *ie, size_t ie_len, 1766a806c558SPaul Stewart bool directed); 176746900298SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, 1768de95a54bSJohannes Berg const u8 *ssid, size_t ssid_len, 1769a806c558SPaul Stewart const u8 *ie, size_t ie_len, 17701672c0e3SJohannes Berg u32 ratemask, bool directed, u32 tx_flags, 177155de908aSJohannes Berg struct ieee80211_channel *channel, bool scan); 177246900298SJohannes Berg 17732103dec1SSimon Wunderlich u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata, 177446900298SJohannes Berg struct ieee802_11_elems *elems, 17759ebb61a2SAshok Nagarajan enum ieee80211_band band, u32 *basic_rates); 1776687da132SEmmanuel Grumbach int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata, 1777687da132SEmmanuel Grumbach enum ieee80211_smps_mode smps_mode); 1778687da132SEmmanuel Grumbach int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata, 17790f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode); 178004ecd257SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata); 178121f659bfSEliad Peller void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata); 178246900298SJohannes Berg 17838e664fb3SJohannes Berg size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 17848e664fb3SJohannes Berg const u8 *ids, int n_ids, size_t offset); 17858e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset); 1786ef96a842SBen Greear u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 178742e7aa77SAlexander Simon u16 cap); 1788074d46d1SJohannes Berg u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 17894bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 1790431e3154SAshok Nagarajan u16 prot_mode); 1791ba0afa2fSMahesh Palivela u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, 1792ba0afa2fSMahesh Palivela u32 cap); 17932103dec1SSimon Wunderlich int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef, 17942103dec1SSimon Wunderlich const struct ieee80211_supported_band *sband, 17952103dec1SSimon Wunderlich const u8 *srates, int srates_len, u32 *rates); 1796fc8a7321SJohannes Berg int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, 17976b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 17986b77863bSJohannes Berg enum ieee80211_band band); 1799fc8a7321SJohannes Berg int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, 18006b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 18016b77863bSJohannes Berg enum ieee80211_band band); 18028e664fb3SJohannes Berg 1803f444de05SJohannes Berg /* channel management */ 18044bf88530SJohannes Berg void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan, 18054a3cb702SJohannes Berg const struct ieee80211_ht_operation *ht_oper, 18064bf88530SJohannes Berg struct cfg80211_chan_def *chandef); 1807e6b7cde4SSimon Wunderlich u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c); 1808f444de05SJohannes Berg 1809d01a1e65SMichal Kazior int __must_check 1810d01a1e65SMichal Kazior ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, 18114bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 1812d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode); 18132c9b7359SJohannes Berg int __must_check 181411335a55SLuciano Coelho ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata, 181511335a55SLuciano Coelho const struct cfg80211_chan_def *chandef, 181609332481SMichal Kazior enum ieee80211_chanctx_mode mode, 181709332481SMichal Kazior bool radar_required); 181811335a55SLuciano Coelho int __must_check 181911335a55SLuciano Coelho ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata, 182011335a55SLuciano Coelho u32 *changed); 182111335a55SLuciano Coelho int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata); 182211335a55SLuciano Coelho 182311335a55SLuciano Coelho int __must_check 18242c9b7359SJohannes Berg ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata, 18252c9b7359SJohannes Berg const struct cfg80211_chan_def *chandef, 18262c9b7359SJohannes Berg u32 *changed); 182773da7d5bSSimon Wunderlich /* NOTE: only use ieee80211_vif_change_channel() for channel switch */ 182873da7d5bSSimon Wunderlich int __must_check 182973da7d5bSSimon Wunderlich ieee80211_vif_change_channel(struct ieee80211_sub_if_data *sdata, 183073da7d5bSSimon Wunderlich u32 *changed); 1831d01a1e65SMichal Kazior void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata); 18324d76d21bSJohannes Berg void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata); 18331f4ac5a6SJohannes Berg void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, 18341f4ac5a6SJohannes Berg bool clear); 1835c0166da9SMichal Kazior int ieee80211_chanctx_refcount(struct ieee80211_local *local, 1836c0166da9SMichal Kazior struct ieee80211_chanctx *ctx); 1837d01a1e65SMichal Kazior 183804ecd257SJohannes Berg void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, 183904ecd257SJohannes Berg struct ieee80211_chanctx *chanctx); 184021f659bfSEliad Peller void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local, 184121f659bfSEliad Peller struct ieee80211_chanctx *ctx); 1842164eb02dSSimon Wunderlich 1843164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer(unsigned long data); 1844164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer_work(struct work_struct *work); 1845164eb02dSSimon Wunderlich void ieee80211_dfs_cac_cancel(struct ieee80211_local *local); 1846164eb02dSSimon Wunderlich void ieee80211_dfs_radar_detected_work(struct work_struct *work); 1847c6da674aSChun-Yeow Yeoh int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata, 1848c6da674aSChun-Yeow Yeoh struct cfg80211_csa_settings *csa_settings); 184904ecd257SJohannes Berg 18502475b1ccSMax Stepanov bool ieee80211_cs_valid(const struct ieee80211_cipher_scheme *cs); 18512475b1ccSMax Stepanov bool ieee80211_cs_list_valid(const struct ieee80211_cipher_scheme *cs, int n); 18522475b1ccSMax Stepanov const struct ieee80211_cipher_scheme * 18532475b1ccSMax Stepanov ieee80211_cs_get(struct ieee80211_local *local, u32 cipher, 18542475b1ccSMax Stepanov enum nl80211_iftype iftype); 18552475b1ccSMax Stepanov int ieee80211_cs_headroom(struct ieee80211_local *local, 18562475b1ccSMax Stepanov struct cfg80211_crypto_settings *crypto, 18572475b1ccSMax Stepanov enum nl80211_iftype iftype); 1858057d5f4bSThomas Pedersen void ieee80211_recalc_dtim(struct ieee80211_local *local, 1859057d5f4bSThomas Pedersen struct ieee80211_sub_if_data *sdata); 186073de86a3SLuciano Coelho int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata, 186173de86a3SLuciano Coelho const struct cfg80211_chan_def *chandef, 186273de86a3SLuciano Coelho enum ieee80211_chanctx_mode chanmode, 186373de86a3SLuciano Coelho u8 radar_detect); 18646fa001bcSMichal Kazior int ieee80211_max_num_channels(struct ieee80211_local *local); 18652475b1ccSMax Stepanov 186695224fe8SArik Nemtsov /* TDLS */ 186795224fe8SArik Nemtsov int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev, 18683b3a0162SJohannes Berg const u8 *peer, u8 action_code, u8 dialog_token, 186995224fe8SArik Nemtsov u16 status_code, u32 peer_capability, 187095224fe8SArik Nemtsov const u8 *extra_ies, size_t extra_ies_len); 187195224fe8SArik Nemtsov int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev, 18723b3a0162SJohannes Berg const u8 *peer, enum nl80211_tdls_operation oper); 187395224fe8SArik Nemtsov 187495224fe8SArik Nemtsov 1875b7ffbd7eSJohannes Berg extern const struct ethtool_ops ieee80211_ethtool_ops; 1876b7ffbd7eSJohannes Berg 1877f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 1878d9e8a70fSJohannes Berg #define debug_noinline noinline 1879d9e8a70fSJohannes Berg #else 1880d9e8a70fSJohannes Berg #define debug_noinline 1881d9e8a70fSJohannes Berg #endif 1882d9e8a70fSJohannes Berg 1883f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 1884*17e6a59aSArik Nemtsov void ieee80211_tdls_peer_del_work(struct work_struct *wk); 1885