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 5612d3952fSFelix Fietkau #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) 5712d3952fSFelix Fietkau #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) 5820ad19d0SJohannes Berg 591ea6f9c0SJohannes Berg /* power level hasn't been configured (or set to automatic) */ 601ea6f9c0SJohannes Berg #define IEEE80211_UNSET_POWER_LEVEL INT_MIN 611ea6f9c0SJohannes Berg 62d6a4ed6fSArik Nemtsov /* 63d6a4ed6fSArik Nemtsov * Some APs experience problems when working with U-APSD. Decrease the 64d6a4ed6fSArik Nemtsov * probability of that happening by using legacy mode for all ACs but VO. 65d6a4ed6fSArik Nemtsov * The AP that caused us trouble was a Cisco 4410N. It ignores our 66d6a4ed6fSArik Nemtsov * setting, and always treats non-VO ACs as legacy. 67d6a4ed6fSArik Nemtsov */ 68ab13315aSKalle Valo #define IEEE80211_DEFAULT_UAPSD_QUEUES \ 69d6a4ed6fSArik Nemtsov IEEE80211_WMM_IE_STA_QOSINFO_AC_VO 70ab13315aSKalle Valo 71ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN \ 72ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 73ab13315aSKalle Valo 746ae16775SAntonio Quartulli #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */) 756ae16775SAntonio Quartulli 76f0706e82SJiri Benc struct ieee80211_fragment_entry { 77f0706e82SJiri Benc unsigned long first_frag_time; 78f0706e82SJiri Benc unsigned int seq; 79f0706e82SJiri Benc unsigned int rx_queue; 80f0706e82SJiri Benc unsigned int last_frag; 81f0706e82SJiri Benc unsigned int extra_len; 82f0706e82SJiri Benc struct sk_buff_head skb_list; 83f0706e82SJiri Benc int ccmp; /* Whether fragments were encrypted with CCMP */ 84f0706e82SJiri Benc u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ 85f0706e82SJiri Benc }; 86f0706e82SJiri Benc 87f0706e82SJiri Benc 88c2b13452SJohannes Berg struct ieee80211_bss { 89ef429dadSJohannes Berg u32 device_ts_beacon, device_ts_presp; 908c358bcdSJohannes Berg 9143ac2ca3SJouni Malinen bool wmm_used; 92ab13315aSKalle Valo bool uapsd_supported; 9300d3f14cSJohannes Berg 94f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32 95f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 96f0706e82SJiri Benc size_t supp_rates_len; 97817cee76SAlexander Bondar struct ieee80211_rate *beacon_rate; 98f0706e82SJiri Benc 9900d3f14cSJohannes Berg /* 10025985edcSLucas De Marchi * During association, we save an ERP value from a probe response so 1015628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 1025628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 10300d3f14cSJohannes Berg * otherwise, you probably don't want to use them. 10400d3f14cSJohannes Berg */ 10500d3f14cSJohannes Berg bool has_erp_value; 1065628221cSDaniel Drake u8 erp_value; 107fcff4f10SPaul Stewart 108fcff4f10SPaul Stewart /* Keep track of the corruption of the last beacon/probe response. */ 109fcff4f10SPaul Stewart u8 corrupt_data; 110fcff4f10SPaul Stewart 111fcff4f10SPaul Stewart /* Keep track of what bits of information we have valid info for. */ 112fcff4f10SPaul Stewart u8 valid_data; 113fcff4f10SPaul Stewart }; 114fcff4f10SPaul Stewart 115fcff4f10SPaul Stewart /** 116fcff4f10SPaul Stewart * enum ieee80211_corrupt_data_flags - BSS data corruption flags 117fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted 118fcff4f10SPaul Stewart * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted 119fcff4f10SPaul Stewart * 120fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 121fcff4f10SPaul Stewart * @corrupt_data field of &struct ieee80211_bss. 122fcff4f10SPaul Stewart */ 123fcff4f10SPaul Stewart enum ieee80211_bss_corrupt_data_flags { 124fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_BEACON = BIT(0), 125fcff4f10SPaul Stewart IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1) 126fcff4f10SPaul Stewart }; 127fcff4f10SPaul Stewart 128fcff4f10SPaul Stewart /** 129fcff4f10SPaul Stewart * enum ieee80211_valid_data_flags - BSS valid data flags 130fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE 131fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE 132fcff4f10SPaul Stewart * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE 133fcff4f10SPaul Stewart * 134fcff4f10SPaul Stewart * These are bss flags that are attached to a bss in the 135fcff4f10SPaul Stewart * @valid_data field of &struct ieee80211_bss. They show which parts 136fcff4f10SPaul Stewart * of the data structure were recieved as a result of an un-corrupted 137fcff4f10SPaul Stewart * beacon/probe response. 138fcff4f10SPaul Stewart */ 139fcff4f10SPaul Stewart enum ieee80211_bss_valid_data_flags { 140fcff4f10SPaul Stewart IEEE80211_BSS_VALID_WMM = BIT(1), 141fcff4f10SPaul Stewart IEEE80211_BSS_VALID_RATES = BIT(2), 142fcff4f10SPaul Stewart IEEE80211_BSS_VALID_ERP = BIT(3) 143f0706e82SJiri Benc }; 144f0706e82SJiri Benc 1459ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result; 1469ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1479ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1489ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1499ae54c84SJohannes Berg 1505cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1515cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1529ae54c84SJohannes Berg 1535cf121c3SJohannes Berg struct ieee80211_tx_data { 154f0706e82SJiri Benc struct sk_buff *skb; 155252b86c4SJohannes Berg struct sk_buff_head skbs; 156f0706e82SJiri Benc struct ieee80211_local *local; 157f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 158f0706e82SJiri Benc struct sta_info *sta; 159f0706e82SJiri Benc struct ieee80211_key *key; 1600d528d85SFelix Fietkau struct ieee80211_tx_rate rate; 1615cf121c3SJohannes Berg 162056cdd59SJohannes Berg unsigned int flags; 1635cf121c3SJohannes Berg }; 1645cf121c3SJohannes Berg 1655cf121c3SJohannes Berg 1665cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result; 1675cf121c3SJohannes Berg #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 1685cf121c3SJohannes Berg #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 1695cf121c3SJohannes Berg #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 1705cf121c3SJohannes Berg #define RX_QUEUED ((__force ieee80211_rx_result) 3u) 1715cf121c3SJohannes Berg 172554891e6SJohannes Berg /** 173554891e6SJohannes Berg * enum ieee80211_packet_rx_flags - packet RX flags 174554891e6SJohannes Berg * @IEEE80211_RX_RA_MATCH: frame is destined to interface currently processed 175554891e6SJohannes Berg * (incl. multicast frames) 176554891e6SJohannes Berg * @IEEE80211_RX_FRAGMENTED: fragmented frame 177554891e6SJohannes Berg * @IEEE80211_RX_AMSDU: a-MSDU packet 178554891e6SJohannes Berg * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed 1794cfda47bSChristian Lamparter * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering 180554891e6SJohannes Berg * 181554891e6SJohannes Berg * These are per-frame flags that are attached to a frame in the 182554891e6SJohannes Berg * @rx_flags field of &struct ieee80211_rx_status. 183554891e6SJohannes Berg */ 184554891e6SJohannes Berg enum ieee80211_packet_rx_flags { 185554891e6SJohannes Berg IEEE80211_RX_RA_MATCH = BIT(1), 186554891e6SJohannes Berg IEEE80211_RX_FRAGMENTED = BIT(2), 187554891e6SJohannes Berg IEEE80211_RX_AMSDU = BIT(3), 188554891e6SJohannes Berg IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4), 1894cfda47bSChristian Lamparter IEEE80211_RX_DEFERRED_RELEASE = BIT(5), 190554891e6SJohannes Berg }; 191554891e6SJohannes Berg 192554891e6SJohannes Berg /** 193554891e6SJohannes Berg * enum ieee80211_rx_flags - RX data flags 194554891e6SJohannes Berg * 195554891e6SJohannes Berg * @IEEE80211_RX_CMNTR: received on cooked monitor already 196ee971924SJohannes Berg * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported 197ee971924SJohannes Berg * to cfg80211_report_obss_beacon(). 198554891e6SJohannes Berg * 199554891e6SJohannes Berg * These flags are used across handling multiple interfaces 200554891e6SJohannes Berg * for a single frame. 201554891e6SJohannes Berg */ 202554891e6SJohannes Berg enum ieee80211_rx_flags { 203554891e6SJohannes Berg IEEE80211_RX_CMNTR = BIT(0), 204ee971924SJohannes Berg IEEE80211_RX_BEACON_REPORTED = BIT(1), 205554891e6SJohannes Berg }; 2065cf121c3SJohannes Berg 2075cf121c3SJohannes Berg struct ieee80211_rx_data { 2085cf121c3SJohannes Berg struct sk_buff *skb; 2095cf121c3SJohannes Berg struct ieee80211_local *local; 2105cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 2115cf121c3SJohannes Berg struct sta_info *sta; 2125cf121c3SJohannes Berg struct ieee80211_key *key; 213056cdd59SJohannes Berg 214056cdd59SJohannes Berg unsigned int flags; 2159e26297aSJohannes Berg 2169e26297aSJohannes Berg /* 2179e26297aSJohannes Berg * Index into sequence numbers array, 0..16 2189e26297aSJohannes Berg * since the last (16) is used for non-QoS, 2199e26297aSJohannes Berg * will be 16 on non-QoS frames. 2209e26297aSJohannes Berg */ 2219e26297aSJohannes Berg int seqno_idx; 2229e26297aSJohannes Berg 2239e26297aSJohannes Berg /* 2249e26297aSJohannes Berg * Index into the security IV/PN arrays, 0..16 2259e26297aSJohannes Berg * since the last (16) is used for CCMP-encrypted 2269e26297aSJohannes Berg * management frames, will be set to 16 on mgmt 2279e26297aSJohannes Berg * frames and 0 on non-QoS frames. 2289e26297aSJohannes Berg */ 2299e26297aSJohannes Berg int security_idx; 2309e26297aSJohannes Berg 23150741ae0SJohannes Berg u32 tkip_iv32; 23250741ae0SJohannes Berg u16 tkip_iv16; 233f0706e82SJiri Benc }; 234f0706e82SJiri Benc 2355dfdaf58SJohannes Berg struct beacon_data { 2365dfdaf58SJohannes Berg u8 *head, *tail; 2375dfdaf58SJohannes Berg int head_len, tail_len; 2388860020eSJohannes Berg struct rcu_head rcu_head; 2395dfdaf58SJohannes Berg }; 2405dfdaf58SJohannes Berg 241aa7a0080SEyal Shapira struct probe_resp { 242aa7a0080SEyal Shapira struct rcu_head rcu_head; 243aa7a0080SEyal Shapira int len; 244aa7a0080SEyal Shapira u8 data[0]; 245aa7a0080SEyal Shapira }; 246aa7a0080SEyal Shapira 247d012a605SMarco Porsch struct ps_data { 248d012a605SMarco Porsch /* yes, this looks ugly, but guarantees that we can later use 249d012a605SMarco Porsch * bitmap_empty :) 250d012a605SMarco Porsch * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 251d012a605SMarco Porsch u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; 252d012a605SMarco Porsch struct sk_buff_head bc_buf; 253d012a605SMarco Porsch atomic_t num_sta_ps; /* number of stations in PS mode */ 254d012a605SMarco Porsch int dtim_count; 255d012a605SMarco Porsch bool dtim_bc_mc; 256d012a605SMarco Porsch }; 257d012a605SMarco Porsch 258f0706e82SJiri Benc struct ieee80211_if_ap { 25940b275b6SJohannes Berg struct beacon_data __rcu *beacon; 260aa7a0080SEyal Shapira struct probe_resp __rcu *probe_resp; 261f0706e82SJiri Benc 2620ec3ca44SJohannes Berg struct list_head vlans; 2630ec3ca44SJohannes Berg 264d012a605SMarco Porsch struct ps_data ps; 265030ef8f8SFelix Fietkau atomic_t num_mcast_sta; /* number of stations receiving multicast */ 266f0706e82SJiri Benc }; 267f0706e82SJiri Benc 268f0706e82SJiri Benc struct ieee80211_if_wds { 269f0706e82SJiri Benc struct sta_info *sta; 270056cdd59SJohannes Berg u8 remote_addr[ETH_ALEN]; 271f0706e82SJiri Benc }; 272f0706e82SJiri Benc 273f0706e82SJiri Benc struct ieee80211_if_vlan { 2740ec3ca44SJohannes Berg struct list_head list; 275f14543eeSFelix Fietkau 276f14543eeSFelix Fietkau /* used for all tx if the VLAN is configured to 4-addr mode */ 27740b275b6SJohannes Berg struct sta_info __rcu *sta; 278f0706e82SJiri Benc }; 279f0706e82SJiri Benc 280ee385855SLuis Carlos Cobo struct mesh_stats { 281c8a61a7dSDaniel Walker __u32 fwded_mcast; /* Mesh forwarded multicast frames */ 282c8a61a7dSDaniel Walker __u32 fwded_unicast; /* Mesh forwarded unicast frames */ 283c8a61a7dSDaniel Walker __u32 fwded_frames; /* Mesh total forwarded frames */ 284ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 285ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 286cfee66b0SJavier Cardona __u32 dropped_frames_congestion;/* Not forwarded due to congestion */ 287ee385855SLuis Carlos Cobo }; 288ee385855SLuis Carlos Cobo 289ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 290ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 291ee385855SLuis Carlos Cobo struct mesh_preq_queue { 292ee385855SLuis Carlos Cobo struct list_head list; 293ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 294ee385855SLuis Carlos Cobo u8 flags; 295ee385855SLuis Carlos Cobo }; 296ee385855SLuis Carlos Cobo 2972eb278e0SJohannes Berg #if HZ/100 == 0 2982eb278e0SJohannes Berg #define IEEE80211_ROC_MIN_LEFT 1 2992eb278e0SJohannes Berg #else 3002eb278e0SJohannes Berg #define IEEE80211_ROC_MIN_LEFT (HZ/100) 3012eb278e0SJohannes Berg #endif 30277fdaa12SJohannes Berg 3032eb278e0SJohannes Berg struct ieee80211_roc_work { 30477fdaa12SJohannes Berg struct list_head list; 3052eb278e0SJohannes Berg struct list_head dependents; 306f679f65dSJohannes Berg 3072eb278e0SJohannes Berg struct delayed_work work; 308af6b6374SJohannes Berg 309af6b6374SJohannes Berg struct ieee80211_sub_if_data *sdata; 310af6b6374SJohannes Berg 311f679f65dSJohannes Berg struct ieee80211_channel *chan; 312af6b6374SJohannes Berg 3132eb278e0SJohannes Berg bool started, abort, hw_begun, notified; 3143fbd45caSJohannes Berg bool to_be_freed; 315f679f65dSJohannes Berg 3162eb278e0SJohannes Berg unsigned long hw_start_time; 317e4da8c37SJohannes Berg 3182eb278e0SJohannes Berg u32 duration, req_duration; 319f30221e4SJohannes Berg struct sk_buff *frame; 32050febf6aSJohannes Berg u64 cookie, mgmt_tx_cookie; 321d339d5caSIlan Peer enum ieee80211_roc_type type; 32277fdaa12SJohannes Berg }; 32377fdaa12SJohannes Berg 32446900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */ 325ab1faeadSJohannes Berg enum ieee80211_sta_flags { 326b291ba11SJohannes Berg IEEE80211_STA_BEACON_POLL = BIT(0), 327b291ba11SJohannes Berg IEEE80211_STA_CONNECTION_POLL = BIT(1), 328b291ba11SJohannes Berg IEEE80211_STA_CONTROL_PORT = BIT(2), 329a8243b72SJohannes Berg IEEE80211_STA_DISABLE_HT = BIT(4), 330b291ba11SJohannes Berg IEEE80211_STA_CSA_RECEIVED = BIT(5), 331b291ba11SJohannes Berg IEEE80211_STA_MFP_ENABLED = BIT(6), 332ab13315aSKalle Valo IEEE80211_STA_UAPSD_ENABLED = BIT(7), 333375177bfSVivek Natarajan IEEE80211_STA_NULLFUNC_ACKED = BIT(8), 33417e4ec14SJouni Malinen IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), 33524398e39SJohannes Berg IEEE80211_STA_DISABLE_40MHZ = BIT(10), 336d545dabaSMahesh Palivela IEEE80211_STA_DISABLE_VHT = BIT(11), 337f2d9d270SJohannes Berg IEEE80211_STA_DISABLE_80P80MHZ = BIT(12), 338f2d9d270SJohannes Berg IEEE80211_STA_DISABLE_160MHZ = BIT(13), 339ab1faeadSJohannes Berg }; 340ab1faeadSJohannes Berg 34166e67e41SJohannes Berg struct ieee80211_mgd_auth_data { 34266e67e41SJohannes Berg struct cfg80211_bss *bss; 34366e67e41SJohannes Berg unsigned long timeout; 34466e67e41SJohannes Berg int tries; 34566e67e41SJohannes Berg u16 algorithm, expected_transaction; 34666e67e41SJohannes Berg 34766e67e41SJohannes Berg u8 key[WLAN_KEY_LEN_WEP104]; 34866e67e41SJohannes Berg u8 key_len, key_idx; 34966e67e41SJohannes Berg bool done; 35089afe614SJohannes Berg bool timeout_started; 35166e67e41SJohannes Berg 3526b8ece3aSJouni Malinen u16 sae_trans, sae_status; 3536b8ece3aSJouni Malinen size_t data_len; 3546b8ece3aSJouni Malinen u8 data[]; 35566e67e41SJohannes Berg }; 35666e67e41SJohannes Berg 35766e67e41SJohannes Berg struct ieee80211_mgd_assoc_data { 35866e67e41SJohannes Berg struct cfg80211_bss *bss; 35966e67e41SJohannes Berg const u8 *supp_rates; 36066e67e41SJohannes Berg 36166e67e41SJohannes Berg unsigned long timeout; 36266e67e41SJohannes Berg int tries; 36366e67e41SJohannes Berg 36466e67e41SJohannes Berg u16 capability; 36566e67e41SJohannes Berg u8 prev_bssid[ETH_ALEN]; 36666e67e41SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 36766e67e41SJohannes Berg u8 ssid_len; 36866e67e41SJohannes Berg u8 supp_rates_len; 36976f0303dSJohannes Berg bool wmm, uapsd; 370989c6505SAlexander Bondar bool need_beacon; 37166e67e41SJohannes Berg bool synced; 37289afe614SJohannes Berg bool timeout_started; 37366e67e41SJohannes Berg 3749dde6423SJohannes Berg u8 ap_ht_param; 3759dde6423SJohannes Berg 376b08fbbd8SJohannes Berg struct ieee80211_vht_cap ap_vht_cap; 377b08fbbd8SJohannes Berg 37866e67e41SJohannes Berg size_t ie_len; 37966e67e41SJohannes Berg u8 ie[]; 38066e67e41SJohannes Berg }; 38166e67e41SJohannes Berg 38246900298SJohannes Berg struct ieee80211_if_managed { 383056cdd59SJohannes Berg struct timer_list timer; 384b291ba11SJohannes Berg struct timer_list conn_mon_timer; 385b291ba11SJohannes Berg struct timer_list bcn_mon_timer; 386c481ec97SSujith struct timer_list chswitch_timer; 387b291ba11SJohannes Berg struct work_struct monitor_work; 388c481ec97SSujith struct work_struct chswitch_work; 3891e4dcd01SJuuso Oikarinen struct work_struct beacon_connection_loss_work; 390882a7c69SJohannes Berg struct work_struct csa_connection_drop_work; 39146900298SJohannes Berg 3927ccc8bd7SFelix Fietkau unsigned long beacon_timeout; 393b291ba11SJohannes Berg unsigned long probe_timeout; 394a43abf29SMaxim Levitsky int probe_send_count; 39504ac3c0eSFelix Fietkau bool nullfunc_failed; 396682bd38bSJohannes Berg bool connection_loss; 397b291ba11SJohannes Berg 3980c1ad2caSJohannes Berg struct cfg80211_bss *associated; 39966e67e41SJohannes Berg struct ieee80211_mgd_auth_data *auth_data; 40066e67e41SJohannes Berg struct ieee80211_mgd_assoc_data *assoc_data; 40146900298SJohannes Berg 40277fdaa12SJohannes Berg u8 bssid[ETH_ALEN]; 40346900298SJohannes Berg 404f0706e82SJiri Benc u16 aid; 405f0706e82SJiri Benc 406965bedadSJohannes Berg bool powersave; /* powersave requested for this iface */ 40705cb9108SJohannes Berg bool broken_ap; /* AP is broken -- turn off powersave */ 408989c6505SAlexander Bondar bool have_beacon; 409826262c3SJohannes Berg u8 dtim_period; 4100f78231bSJohannes Berg enum ieee80211_smps_mode req_smps, /* requested smps mode */ 411d1f5b7a3SJohannes Berg driver_smps_mode; /* smps mode request */ 412d1f5b7a3SJohannes Berg 413d1f5b7a3SJohannes Berg struct work_struct request_smps_work; 414965bedadSJohannes Berg 415d6f2da5bSJiri Slaby unsigned int flags; 416f0706e82SJiri Benc 417d8ec4433SJuuso Oikarinen bool beacon_crc_valid; 418d91f36dbSJohannes Berg u32 beacon_crc; 419d91f36dbSJohannes Berg 4201672c0e3SJohannes Berg bool status_acked; 4211672c0e3SJohannes Berg bool status_received; 4221672c0e3SJohannes Berg __le16 status_fc; 4231672c0e3SJohannes Berg 424fdfacf0aSJouni Malinen enum { 425fdfacf0aSJouni Malinen IEEE80211_MFP_DISABLED, 426fdfacf0aSJouni Malinen IEEE80211_MFP_OPTIONAL, 427fdfacf0aSJouni Malinen IEEE80211_MFP_REQUIRED 428fdfacf0aSJouni Malinen } mfp; /* management frame protection */ 429fdfacf0aSJouni Malinen 430dc41e4d4SEliad Peller /* 431dc41e4d4SEliad Peller * Bitmask of enabled u-apsd queues, 432dc41e4d4SEliad Peller * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association 433dc41e4d4SEliad Peller * to take effect. 434dc41e4d4SEliad Peller */ 435dc41e4d4SEliad Peller unsigned int uapsd_queues; 436dc41e4d4SEliad Peller 437dc41e4d4SEliad Peller /* 438dc41e4d4SEliad Peller * Maximum number of buffered frames AP can deliver during a 439dc41e4d4SEliad Peller * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar. 440dc41e4d4SEliad Peller * Needs a new association to take effect. 441dc41e4d4SEliad Peller */ 442dc41e4d4SEliad Peller unsigned int uapsd_max_sp_len; 443dc41e4d4SEliad Peller 444f0706e82SJiri Benc int wmm_last_param_set; 4459bc383deSJohannes Berg 4469bc383deSJohannes Berg u8 use_4addr; 44717e4ec14SJouni Malinen 44867baf663SJanusz Dziedzic s16 p2p_noa_index; 449488dd7b5SJohannes Berg 45017e4ec14SJouni Malinen /* Signal strength from the last Beacon frame in the current BSS. */ 45117e4ec14SJouni Malinen int last_beacon_signal; 45217e4ec14SJouni Malinen 45317e4ec14SJouni Malinen /* 45417e4ec14SJouni Malinen * Weighted average of the signal strength from Beacon frames in the 45517e4ec14SJouni Malinen * current BSS. This is in units of 1/16 of the signal unit to maintain 45617e4ec14SJouni Malinen * accuracy and to speed up calculations, i.e., the value need to be 45717e4ec14SJouni Malinen * divided by 16 to get the actual value. 45817e4ec14SJouni Malinen */ 45917e4ec14SJouni Malinen int ave_beacon_signal; 46017e4ec14SJouni Malinen 46117e4ec14SJouni Malinen /* 462391a200aSJouni Malinen * Number of Beacon frames used in ave_beacon_signal. This can be used 463391a200aSJouni Malinen * to avoid generating less reliable cqm events that would be based 464391a200aSJouni Malinen * only on couple of received frames. 465391a200aSJouni Malinen */ 466391a200aSJouni Malinen unsigned int count_beacon_signal; 467391a200aSJouni Malinen 468391a200aSJouni Malinen /* 46917e4ec14SJouni Malinen * Last Beacon frame signal strength average (ave_beacon_signal / 16) 47017e4ec14SJouni Malinen * that triggered a cqm event. 0 indicates that no event has been 47117e4ec14SJouni Malinen * generated for the current association. 47217e4ec14SJouni Malinen */ 47317e4ec14SJouni Malinen int last_cqm_event_signal; 474615f7b9bSMeenakshi Venkataraman 475615f7b9bSMeenakshi Venkataraman /* 476615f7b9bSMeenakshi Venkataraman * State variables for keeping track of RSSI of the AP currently 477615f7b9bSMeenakshi Venkataraman * connected to and informing driver when RSSI has gone 478615f7b9bSMeenakshi Venkataraman * below/above a certain threshold. 479615f7b9bSMeenakshi Venkataraman */ 480615f7b9bSMeenakshi Venkataraman int rssi_min_thold, rssi_max_thold; 481615f7b9bSMeenakshi Venkataraman int last_ave_beacon_signal; 482ef96a842SBen Greear 483ef96a842SBen Greear struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 484ef96a842SBen Greear struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 485dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */ 486dd5ecfeaSJohannes Berg struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */ 487f0706e82SJiri Benc }; 488f0706e82SJiri Benc 48946900298SJohannes Berg struct ieee80211_if_ibss { 49046900298SJohannes Berg struct timer_list timer; 49146900298SJohannes Berg 492af8cdcd8SJohannes Berg unsigned long last_scan_completed; 4935bb644a0SJohannes Berg 494fbd2c8dcSTeemu Paasikivi u32 basic_rates; 495fbd2c8dcSTeemu Paasikivi 496af8cdcd8SJohannes Berg bool fixed_bssid; 497af8cdcd8SJohannes Berg bool fixed_channel; 498fffd0934SJohannes Berg bool privacy; 49946900298SJohannes Berg 500267335d6SAntonio Quartulli bool control_port; 501267335d6SAntonio Quartulli 5024d196e4bSFelix Fietkau u8 bssid[ETH_ALEN] __aligned(2); 503af8cdcd8SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 504af8cdcd8SJohannes Berg u8 ssid_len, ie_len; 505af8cdcd8SJohannes Berg u8 *ie; 5063aede78aSSimon Wunderlich struct cfg80211_chan_def chandef; 50746900298SJohannes Berg 50846900298SJohannes Berg unsigned long ibss_join_req; 509af8cdcd8SJohannes Berg /* probe response/beacon for IBSS */ 510c3ffeab4SJohannes Berg struct beacon_data __rcu *presp; 51146900298SJohannes Berg 512822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */ 513822854b0SSimon Wunderlich struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */ 514822854b0SSimon Wunderlich 5158bf11d8dSJohannes Berg spinlock_t incomplete_lock; 5168bf11d8dSJohannes Berg struct list_head incomplete_stations; 5178bf11d8dSJohannes Berg 51846900298SJohannes Berg enum { 51946900298SJohannes Berg IEEE80211_IBSS_MLME_SEARCH, 52046900298SJohannes Berg IEEE80211_IBSS_MLME_JOINED, 52146900298SJohannes Berg } state; 52246900298SJohannes Berg }; 52346900298SJohannes Berg 524dbf498fbSJavier Cardona /** 525dbf498fbSJavier Cardona * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface 526dbf498fbSJavier Cardona * 527dbf498fbSJavier Cardona * these declarations define the interface, which enables 528dbf498fbSJavier Cardona * vendor-specific mesh synchronization 529dbf498fbSJavier Cardona * 530dbf498fbSJavier Cardona */ 531dbf498fbSJavier Cardona struct ieee802_11_elems; 532dbf498fbSJavier Cardona struct ieee80211_mesh_sync_ops { 533dbf498fbSJavier Cardona void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata, 534dbf498fbSJavier Cardona u16 stype, 535dbf498fbSJavier Cardona struct ieee80211_mgmt *mgmt, 536dbf498fbSJavier Cardona struct ieee802_11_elems *elems, 537dbf498fbSJavier Cardona struct ieee80211_rx_status *rx_status); 538dbf498fbSJavier Cardona void (*adjust_tbtt)(struct ieee80211_sub_if_data *sdata); 539dbf498fbSJavier Cardona /* add other framework functions here */ 540dbf498fbSJavier Cardona }; 541dbf498fbSJavier Cardona 542472dbc45SJohannes Berg struct ieee80211_if_mesh { 543472dbc45SJohannes Berg struct timer_list housekeeping_timer; 544472dbc45SJohannes Berg struct timer_list mesh_path_timer; 545e304bfd3SRui Paulo struct timer_list mesh_path_root_timer; 546472dbc45SJohannes Berg 54718889231SJavier Cardona unsigned long wrkq_flags; 548f81a9dedSThomas Pedersen unsigned long mbss_changed; 549472dbc45SJohannes Berg 550472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 551472dbc45SJohannes Berg size_t mesh_id_len; 552472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */ 5533491707aSRui Paulo u8 mesh_pp_id; 554472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */ 5553491707aSRui Paulo u8 mesh_pm_id; 556472dbc45SJohannes Berg /* Congestion Control Mode Identifier */ 5573491707aSRui Paulo u8 mesh_cc_id; 5589e03fdfdSJavier Cardona /* Synchronization Protocol Identifier */ 5593491707aSRui Paulo u8 mesh_sp_id; 5609e03fdfdSJavier Cardona /* Authentication Protocol Identifier */ 5613491707aSRui Paulo u8 mesh_auth_id; 562d19b3bf6SRui Paulo /* Local mesh Sequence Number */ 563d19b3bf6SRui Paulo u32 sn; 564472dbc45SJohannes Berg /* Last used PREQ ID */ 565472dbc45SJohannes Berg u32 preq_id; 566472dbc45SJohannes Berg atomic_t mpaths; 567d19b3bf6SRui Paulo /* Timestamp of last SN update */ 568d19b3bf6SRui Paulo unsigned long last_sn_update; 569dca7e943SThomas Pedersen /* Time when it's ok to send next PERR */ 570dca7e943SThomas Pedersen unsigned long next_perr; 571dca7e943SThomas Pedersen /* Timestamp of last PREQ sent */ 572472dbc45SJohannes Berg unsigned long last_preq; 573472dbc45SJohannes Berg struct mesh_rmc *rmc; 574472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock; 575472dbc45SJohannes Berg struct mesh_preq_queue preq_queue; 576472dbc45SJohannes Berg int preq_queue_len; 577472dbc45SJohannes Berg struct mesh_stats mshstats; 578472dbc45SJohannes Berg struct mesh_config mshcfg; 5791258d976SAshok Nagarajan atomic_t estab_plinks; 580472dbc45SJohannes Berg u32 mesh_seqnum; 581472dbc45SJohannes Berg bool accepting_plinks; 5825ee68e5bSJavier Cardona int num_gates; 5832b5e1967SThomas Pedersen struct beacon_data __rcu *beacon; 584581a8b0fSJavier Cardona const u8 *ie; 585581a8b0fSJavier Cardona u8 ie_len; 586b130e5ceSJavier Cardona enum { 587b130e5ceSJavier Cardona IEEE80211_MESH_SEC_NONE = 0x0, 588b130e5ceSJavier Cardona IEEE80211_MESH_SEC_AUTHED = 0x1, 589b130e5ceSJavier Cardona IEEE80211_MESH_SEC_SECURED = 0x2, 590b130e5ceSJavier Cardona } security; 591a6dad6a2SThomas Pedersen bool user_mpm; 592dbf498fbSJavier Cardona /* Extensible Synchronization Framework */ 5938ba7acf3SJohannes Berg const struct ieee80211_mesh_sync_ops *sync_ops; 594dbf498fbSJavier Cardona s64 sync_offset_clockdrift_max; 595dbf498fbSJavier Cardona spinlock_t sync_offset_lock; 596dbf498fbSJavier Cardona bool adjusting_tbtt; 5973f52b7e3SMarco Porsch /* mesh power save */ 5983f52b7e3SMarco Porsch enum nl80211_mesh_power_mode nonpeer_pm; 5993f52b7e3SMarco Porsch int ps_peers_light_sleep; 6003f52b7e3SMarco Porsch int ps_peers_deep_sleep; 6013f52b7e3SMarco Porsch struct ps_data ps; 602472dbc45SJohannes Berg }; 603902acc78SJohannes Berg 604902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 605472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 606472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0) 607902acc78SJohannes Berg #else 608472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 609902acc78SJohannes Berg do { } while (0) 610902acc78SJohannes Berg #endif 611f0706e82SJiri Benc 612213cd118SJohannes Berg /** 613213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags 614213cd118SJohannes Berg * 615213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets 616213cd118SJohannes Berg * @IEEE80211_SDATA_PROMISC: interface is promisc 617213cd118SJohannes Berg * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode 618213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between 619213cd118SJohannes Berg * associated stations and deliver multicast frames both 620213cd118SJohannes Berg * back to wireless media and to the local net stack. 62195acac61SJohannes Berg * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume. 6227b7eab6fSJohannes Berg * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver 623213cd118SJohannes Berg */ 624213cd118SJohannes Berg enum ieee80211_sub_if_data_flags { 625213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0), 626213cd118SJohannes Berg IEEE80211_SDATA_PROMISC = BIT(1), 6277986cf95SJohannes Berg IEEE80211_SDATA_OPERATING_GMODE = BIT(2), 6287986cf95SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), 62995acac61SJohannes Berg IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4), 6307b7eab6fSJohannes Berg IEEE80211_SDATA_IN_DRIVER = BIT(5), 631213cd118SJohannes Berg }; 632213cd118SJohannes Berg 63334d4bc4dSJohannes Berg /** 63434d4bc4dSJohannes Berg * enum ieee80211_sdata_state_bits - virtual interface state bits 63534d4bc4dSJohannes Berg * @SDATA_STATE_RUNNING: virtual interface is up & running; this 63634d4bc4dSJohannes Berg * mirrors netif_running() but is separate for interface type 63734d4bc4dSJohannes Berg * change handling while the interface is up 6385b714c6aSJohannes Berg * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel 6395b714c6aSJohannes Berg * mode, so queues are stopped 640d6a83228SJohannes Berg * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due 641d6a83228SJohannes Berg * to offchannel, reset when offchannel returns 64234d4bc4dSJohannes Berg */ 64334d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits { 64434d4bc4dSJohannes Berg SDATA_STATE_RUNNING, 6455b714c6aSJohannes Berg SDATA_STATE_OFFCHANNEL, 646d6a83228SJohannes Berg SDATA_STATE_OFFCHANNEL_BEACON_STOPPED, 64734d4bc4dSJohannes Berg }; 64834d4bc4dSJohannes Berg 649d01a1e65SMichal Kazior /** 650d01a1e65SMichal Kazior * enum ieee80211_chanctx_mode - channel context configuration mode 651d01a1e65SMichal Kazior * 652d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_SHARED: channel context may be used by 653d01a1e65SMichal Kazior * multiple interfaces 654d01a1e65SMichal Kazior * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used 655d01a1e65SMichal Kazior * only by a single interface. This can be used for example for 656d01a1e65SMichal Kazior * non-fixed channel IBSS. 657d01a1e65SMichal Kazior */ 658d01a1e65SMichal Kazior enum ieee80211_chanctx_mode { 659d01a1e65SMichal Kazior IEEE80211_CHANCTX_SHARED, 660d01a1e65SMichal Kazior IEEE80211_CHANCTX_EXCLUSIVE 661d01a1e65SMichal Kazior }; 662d01a1e65SMichal Kazior 663d01a1e65SMichal Kazior struct ieee80211_chanctx { 664d01a1e65SMichal Kazior struct list_head list; 665d01a1e65SMichal Kazior struct rcu_head rcu_head; 666d01a1e65SMichal Kazior 667d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode; 668d01a1e65SMichal Kazior int refcount; 6698a61af65SJohannes Berg bool driver_present; 670d01a1e65SMichal Kazior 671d01a1e65SMichal Kazior struct ieee80211_chanctx_conf conf; 672d01a1e65SMichal Kazior }; 673d01a1e65SMichal Kazior 674f0706e82SJiri Benc struct ieee80211_sub_if_data { 675f0706e82SJiri Benc struct list_head list; 676f0706e82SJiri Benc 677f0706e82SJiri Benc struct wireless_dev wdev; 678f0706e82SJiri Benc 67911a843b7SJohannes Berg /* keys */ 68011a843b7SJohannes Berg struct list_head key_list; 68111a843b7SJohannes Berg 6823bff1865SYogesh Ashok Powar /* count for keys needing tailroom space allocation */ 6833bff1865SYogesh Ashok Powar int crypto_tx_tailroom_needed_cnt; 6848d1f7ecdSJohannes Berg int crypto_tx_tailroom_pending_dec; 6858d1f7ecdSJohannes Berg struct delayed_work dec_tailroom_needed_wk; 6863bff1865SYogesh Ashok Powar 687f0706e82SJiri Benc struct net_device *dev; 688f0706e82SJiri Benc struct ieee80211_local *local; 689f0706e82SJiri Benc 69013262ffdSJiri Slaby unsigned int flags; 6917e9ed188SDaniel Drake 69234d4bc4dSJohannes Berg unsigned long state; 69334d4bc4dSJohannes Berg 694f0706e82SJiri Benc int drop_unencrypted; 695f0706e82SJiri Benc 69647846c9bSJohannes Berg char name[IFNAMSIZ]; 69747846c9bSJohannes Berg 698f0706e82SJiri Benc /* Fragment table for host-based reassembly */ 699f0706e82SJiri Benc struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; 700f0706e82SJiri Benc unsigned int fragment_next; 701f0706e82SJiri Benc 702b53be792SSimon Wunderlich /* TID bitmap for NoAck policy */ 703b53be792SSimon Wunderlich u16 noack_map; 704b53be792SSimon Wunderlich 70500e96decSYoni Divinsky /* bit field of ACM bits (BIT(802.1D tag)) */ 70600e96decSYoni Divinsky u8 wmm_acm; 70700e96decSYoni Divinsky 70840b275b6SJohannes Berg struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; 70940b275b6SJohannes Berg struct ieee80211_key __rcu *default_unicast_key; 71040b275b6SJohannes Berg struct ieee80211_key __rcu *default_multicast_key; 71140b275b6SJohannes Berg struct ieee80211_key __rcu *default_mgmt_key; 712f0706e82SJiri Benc 71394778280SJohannes Berg u16 sequence_number; 714a621fa4dSJohannes Berg __be16 control_port_protocol; 715a621fa4dSJohannes Berg bool control_port_no_encrypt; 71694778280SJohannes Berg 71754bcbc69SJohannes Berg struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS]; 718f6f3def3SEliad Peller 71904ecd257SJohannes Berg /* used to reconfigure hardware SM PS */ 72004ecd257SJohannes Berg struct work_struct recalc_smps; 72104ecd257SJohannes Berg 72264592c8fSJohannes Berg struct work_struct work; 72335f20c14SJohannes Berg struct sk_buff_head skb_queue; 72435f20c14SJohannes Berg 72504ecd257SJohannes Berg u8 needed_rx_chains; 72604ecd257SJohannes Berg enum ieee80211_smps_mode smps_mode; 72704ecd257SJohannes Berg 7281ea6f9c0SJohannes Berg int user_power_level; /* in dBm */ 7291ea6f9c0SJohannes Berg int ap_power_level; /* in dBm */ 7301ea6f9c0SJohannes Berg 731164eb02dSSimon Wunderlich bool radar_required; 732164eb02dSSimon Wunderlich struct delayed_work dfs_cac_timer_work; 733164eb02dSSimon Wunderlich 7343e122be0SJohannes Berg /* 7353e122be0SJohannes Berg * AP this belongs to: self in AP mode and 7363e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 7373e122be0SJohannes Berg * all others (might be needed later in IBSS) 7383e122be0SJohannes Berg */ 7393e122be0SJohannes Berg struct ieee80211_if_ap *bss; 7403e122be0SJohannes Berg 74137eb0b16SJouni Malinen /* bitmap of allowed (non-MCS) rate indexes for rate control */ 74237eb0b16SJouni Malinen u32 rc_rateidx_mask[IEEE80211_NUM_BANDS]; 7432ffbe6d3SFelix Fietkau 7442ffbe6d3SFelix Fietkau bool rc_has_mcs_mask[IEEE80211_NUM_BANDS]; 74519468413SSimon Wunderlich u8 rc_rateidx_mcs_mask[IEEE80211_NUM_BANDS][IEEE80211_HT_MCS_MASK_LEN]; 746f0706e82SJiri Benc 747f0706e82SJiri Benc union { 748f0706e82SJiri Benc struct ieee80211_if_ap ap; 749f0706e82SJiri Benc struct ieee80211_if_wds wds; 750f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 75146900298SJohannes Berg struct ieee80211_if_managed mgd; 75246900298SJohannes Berg struct ieee80211_if_ibss ibss; 753472dbc45SJohannes Berg struct ieee80211_if_mesh mesh; 7548cc9a739SMichael Wu u32 mntr_flags; 755f0706e82SJiri Benc } u; 756e9f207f0SJiri Benc 75797f97b1fSJohannes Berg spinlock_t cleanup_stations_lock; 75897f97b1fSJohannes Berg struct list_head cleanup_stations; 75997f97b1fSJohannes Berg struct work_struct cleanup_stations_wk; 76097f97b1fSJohannes Berg 761e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 762e9f207f0SJiri Benc struct { 763295bafb4SBen Greear struct dentry *subdir_stations; 764f7e0104cSJohannes Berg struct dentry *default_unicast_key; 765f7e0104cSJohannes Berg struct dentry *default_multicast_key; 7663cfcf6acSJouni Malinen struct dentry *default_mgmt_key; 7677bcfaf2fSJohannes Berg } debugfs; 768e9f207f0SJiri Benc #endif 769529ba6e9SJohannes Berg 77032bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */ 77132bfd35dSJohannes Berg struct ieee80211_vif vif; 772f0706e82SJiri Benc }; 773f0706e82SJiri Benc 77432bfd35dSJohannes Berg static inline 77532bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 77632bfd35dSJohannes Berg { 77732bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif); 77832bfd35dSJohannes Berg } 77932bfd35dSJohannes Berg 7808d61ffa5SJohannes Berg static inline void sdata_lock(struct ieee80211_sub_if_data *sdata) 7818d61ffa5SJohannes Berg __acquires(&sdata->wdev.mtx) 7828d61ffa5SJohannes Berg { 7838d61ffa5SJohannes Berg mutex_lock(&sdata->wdev.mtx); 7848d61ffa5SJohannes Berg __acquire(&sdata->wdev.mtx); 7858d61ffa5SJohannes Berg } 7868d61ffa5SJohannes Berg 7878d61ffa5SJohannes Berg static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata) 7888d61ffa5SJohannes Berg __releases(&sdata->wdev.mtx) 7898d61ffa5SJohannes Berg { 7908d61ffa5SJohannes Berg mutex_unlock(&sdata->wdev.mtx); 7918d61ffa5SJohannes Berg __release(&sdata->wdev.mtx); 7928d61ffa5SJohannes Berg } 7938d61ffa5SJohannes Berg 7948d61ffa5SJohannes Berg static inline void 7958d61ffa5SJohannes Berg sdata_assert_lock(struct ieee80211_sub_if_data *sdata) 7968d61ffa5SJohannes Berg { 7978d61ffa5SJohannes Berg lockdep_assert_held(&sdata->wdev.mtx); 7988d61ffa5SJohannes Berg } 7998d61ffa5SJohannes Berg 80055de908aSJohannes Berg static inline enum ieee80211_band 80155de908aSJohannes Berg ieee80211_get_sdata_band(struct ieee80211_sub_if_data *sdata) 80255de908aSJohannes Berg { 80355de908aSJohannes Berg enum ieee80211_band band = IEEE80211_BAND_2GHZ; 80455de908aSJohannes Berg struct ieee80211_chanctx_conf *chanctx_conf; 80555de908aSJohannes Berg 80655de908aSJohannes Berg rcu_read_lock(); 80755de908aSJohannes Berg chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 80855de908aSJohannes Berg if (!WARN_ON(!chanctx_conf)) 8094bf88530SJohannes Berg band = chanctx_conf->def.chan->band; 81055de908aSJohannes Berg rcu_read_unlock(); 81155de908aSJohannes Berg 81255de908aSJohannes Berg return band; 81355de908aSJohannes Berg } 81455de908aSJohannes Berg 815438b61b7SSimon Wunderlich static inline int 816438b61b7SSimon Wunderlich ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef) 817438b61b7SSimon Wunderlich { 818438b61b7SSimon Wunderlich switch (chandef->width) { 819438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_5: 820438b61b7SSimon Wunderlich return 2; 821438b61b7SSimon Wunderlich case NL80211_CHAN_WIDTH_10: 822438b61b7SSimon Wunderlich return 1; 823438b61b7SSimon Wunderlich default: 824438b61b7SSimon Wunderlich return 0; 825438b61b7SSimon Wunderlich } 826438b61b7SSimon Wunderlich } 827438b61b7SSimon Wunderlich 828438b61b7SSimon Wunderlich static inline int 829438b61b7SSimon Wunderlich ieee80211_vif_get_shift(struct ieee80211_vif *vif) 830438b61b7SSimon Wunderlich { 831438b61b7SSimon Wunderlich struct ieee80211_chanctx_conf *chanctx_conf; 832438b61b7SSimon Wunderlich int shift = 0; 833438b61b7SSimon Wunderlich 834438b61b7SSimon Wunderlich rcu_read_lock(); 835438b61b7SSimon Wunderlich chanctx_conf = rcu_dereference(vif->chanctx_conf); 836438b61b7SSimon Wunderlich if (chanctx_conf) 837438b61b7SSimon Wunderlich shift = ieee80211_chandef_get_shift(&chanctx_conf->def); 838438b61b7SSimon Wunderlich rcu_read_unlock(); 839438b61b7SSimon Wunderlich 840438b61b7SSimon Wunderlich return shift; 841438b61b7SSimon Wunderlich } 842438b61b7SSimon Wunderlich 843c1475ca9SJohannes Berg enum sdata_queue_type { 844c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0, 845c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_AGG_START = 1, 846c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_AGG_STOP = 2, 847c1475ca9SJohannes Berg }; 848c1475ca9SJohannes Berg 849f0706e82SJiri Benc enum { 850f0706e82SJiri Benc IEEE80211_RX_MSG = 1, 851f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2, 852f0706e82SJiri Benc }; 853f0706e82SJiri Benc 854ce7c9111SKalle Valo enum queue_stop_reason { 855ce7c9111SKalle Valo IEEE80211_QUEUE_STOP_REASON_DRIVER, 856520eb820SKalle Valo IEEE80211_QUEUE_STOP_REASON_PS, 85796f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_CSA, 85896f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_AGGREGATION, 85925420604SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SUSPEND, 8608f77f384SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 8616c17b77bSSeth Forshee IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL, 862445ea4e8SJohannes Berg IEEE80211_QUEUE_STOP_REASON_FLUSH, 863ce7c9111SKalle Valo }; 864ce7c9111SKalle Valo 86565a6538aSLuciano Coelho #ifdef CONFIG_MAC80211_LEDS 866e1e54068SJohannes Berg struct tpt_led_trigger { 867e1e54068SJohannes Berg struct led_trigger trig; 868e1e54068SJohannes Berg char name[32]; 869e1e54068SJohannes Berg const struct ieee80211_tpt_blink *blink_table; 870e1e54068SJohannes Berg unsigned int blink_table_len; 871e1e54068SJohannes Berg struct timer_list timer; 872e1e54068SJohannes Berg unsigned long prev_traffic; 873e1e54068SJohannes Berg unsigned long tx_bytes, rx_bytes; 87467408c8cSJohannes Berg unsigned int active, want; 87567408c8cSJohannes Berg bool running; 876e1e54068SJohannes Berg }; 87765a6538aSLuciano Coelho #endif 878e1e54068SJohannes Berg 879142b9f50SHelmut Schaa /** 880142b9f50SHelmut Schaa * mac80211 scan flags - currently active scan mode 881142b9f50SHelmut Schaa * 882142b9f50SHelmut Schaa * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as 883142b9f50SHelmut Schaa * well be on the operating channel 884142b9f50SHelmut Schaa * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to 885142b9f50SHelmut Schaa * determine if we are on the operating channel or not 8868a690674SBen Greear * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating 8878a690674SBen Greear * channel. This should not interrupt normal traffic. 8888789d459SJohannes Berg * @SCAN_COMPLETED: Set for our scan work function when the driver reported 8898789d459SJohannes Berg * that the scan completed. 8908789d459SJohannes Berg * @SCAN_ABORTED: Set for our scan work function when the driver reported 8918789d459SJohannes Berg * a scan complete for an aborted scan. 892142b9f50SHelmut Schaa */ 893fbe9c429SHelmut Schaa enum { 894fbe9c429SHelmut Schaa SCAN_SW_SCANNING, 895142b9f50SHelmut Schaa SCAN_HW_SCANNING, 8968a690674SBen Greear SCAN_ONCHANNEL_SCANNING, 8978789d459SJohannes Berg SCAN_COMPLETED, 8988789d459SJohannes Berg SCAN_ABORTED, 899142b9f50SHelmut Schaa }; 900142b9f50SHelmut Schaa 901142b9f50SHelmut Schaa /** 902142b9f50SHelmut Schaa * enum mac80211_scan_state - scan state machine states 903142b9f50SHelmut Schaa * 904142b9f50SHelmut Schaa * @SCAN_DECISION: Main entry point to the scan state machine, this state 905142b9f50SHelmut Schaa * determines if we should keep on scanning or switch back to the 906142b9f50SHelmut Schaa * operating channel 907142b9f50SHelmut Schaa * @SCAN_SET_CHANNEL: Set the next channel to be scanned 908142b9f50SHelmut Schaa * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses 90907ef03eeSJohannes Berg * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to 91007ef03eeSJohannes Berg * send out data 91107ef03eeSJohannes Berg * @SCAN_RESUME: Resume the scan and scan the next channel 912cd2bb512SSam Leffler * @SCAN_ABORT: Abort the scan and go back to operating channel 913142b9f50SHelmut Schaa */ 914142b9f50SHelmut Schaa enum mac80211_scan_state { 915142b9f50SHelmut Schaa SCAN_DECISION, 916142b9f50SHelmut Schaa SCAN_SET_CHANNEL, 917142b9f50SHelmut Schaa SCAN_SEND_PROBE, 91807ef03eeSJohannes Berg SCAN_SUSPEND, 91907ef03eeSJohannes Berg SCAN_RESUME, 920cd2bb512SSam Leffler SCAN_ABORT, 921fbe9c429SHelmut Schaa }; 922fbe9c429SHelmut Schaa 923f0706e82SJiri Benc struct ieee80211_local { 924f0706e82SJiri Benc /* embed the driver visible part. 925f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 926f0706e82SJiri Benc * it first anyway so they become a no-op */ 927f0706e82SJiri Benc struct ieee80211_hw hw; 928f0706e82SJiri Benc 929f0706e82SJiri Benc const struct ieee80211_ops *ops; 930f0706e82SJiri Benc 93142935ecaSLuis R. Rodriguez /* 93242935ecaSLuis R. Rodriguez * private workqueue to mac80211. mac80211 makes this accessible 93342935ecaSLuis R. Rodriguez * via ieee80211_queue_work() 93442935ecaSLuis R. Rodriguez */ 93542935ecaSLuis R. Rodriguez struct workqueue_struct *workqueue; 93642935ecaSLuis R. Rodriguez 937e4e72fb4SJohannes Berg unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; 93896f5e66eSJohannes Berg /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ 939ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock; 94096f5e66eSJohannes Berg 941f0706e82SJiri Benc int open_count; 9423d30d949SMichael Wu int monitors, cooked_mntrs; 9438cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 9447be5086dSJohannes Berg int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, 9457be5086dSJohannes Berg fif_probe_req; 9467be5086dSJohannes Berg int probe_req_reg; 9474150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 9483b8d81e0SJohannes Berg 9493ffc2a90SJohannes Berg bool wiphy_ciphers_allocated; 9503ffc2a90SJohannes Berg 951fe57d9f5SJohannes Berg bool use_chanctx; 952fe57d9f5SJohannes Berg 9533b8d81e0SJohannes Berg /* protects the aggregated multicast list and filter calls */ 9543b8d81e0SJohannes Berg spinlock_t filter_lock; 9553b8d81e0SJohannes Berg 9563ac64beeSJohannes Berg /* used for uploading changed mc list */ 9573ac64beeSJohannes Berg struct work_struct reconfig_filter; 9583ac64beeSJohannes Berg 9593b8d81e0SJohannes Berg /* aggregated multicast list */ 96022bedad3SJiri Pirko struct netdev_hw_addr_list mc_list; 9613b8d81e0SJohannes Berg 962d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 9635bb644a0SJohannes Berg 9645bb644a0SJohannes Berg /* 9655bb644a0SJohannes Berg * suspended is true if we finished all the suspend _and_ we have 9665bb644a0SJohannes Berg * not yet come up from resume. This is to be used by mac80211 9675bb644a0SJohannes Berg * to ensure driver sanity during suspend and mac80211's own 9685bb644a0SJohannes Berg * sanity. It can eventually be used for WoW as well. 9695bb644a0SJohannes Berg */ 9705bb644a0SJohannes Berg bool suspended; 9715bb644a0SJohannes Berg 9725bb644a0SJohannes Berg /* 973ceb99fe0SJohannes Berg * Resuming is true while suspended, but when we're reprogramming the 974ceb99fe0SJohannes Berg * hardware -- at that time it's allowed to use ieee80211_queue_work() 975ceb99fe0SJohannes Berg * again even though some other parts of the stack are still suspended 976ceb99fe0SJohannes Berg * and we still drop received frames to avoid waking the stack. 977ceb99fe0SJohannes Berg */ 978ceb99fe0SJohannes Berg bool resuming; 979ceb99fe0SJohannes Berg 980ceb99fe0SJohannes Berg /* 9815bb644a0SJohannes Berg * quiescing is true during the suspend process _only_ to 9825bb644a0SJohannes Berg * ease timer cancelling etc. 9835bb644a0SJohannes Berg */ 9845bb644a0SJohannes Berg bool quiescing; 9855bb644a0SJohannes Berg 986ea77f12fSJohannes Berg /* device is started */ 987ea77f12fSJohannes Berg bool started; 988ea77f12fSJohannes Berg 98904800adaSArik Nemtsov /* device is during a HW reconfig */ 99004800adaSArik Nemtsov bool in_reconfig; 99104800adaSArik Nemtsov 992eecc4800SJohannes Berg /* wowlan is enabled -- don't reconfig on resume */ 993eecc4800SJohannes Berg bool wowlan; 994eecc4800SJohannes Berg 995164eb02dSSimon Wunderlich /* DFS/radar detection is enabled */ 996164eb02dSSimon Wunderlich bool radar_detect_enabled; 997164eb02dSSimon Wunderlich struct work_struct radar_detected_work; 998164eb02dSSimon Wunderlich 99904ecd257SJohannes Berg /* number of RX chains the hardware has */ 100004ecd257SJohannes Berg u8 rx_chains; 100104ecd257SJohannes Berg 1002b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 1003f0706e82SJiri Benc 1004f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 1005f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 1006f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 1007f0706e82SJiri Benc * queues increases over the limit. */ 1008f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 1009f0706e82SJiri Benc struct tasklet_struct tasklet; 1010f0706e82SJiri Benc struct sk_buff_head skb_queue; 1011f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 1012f0706e82SJiri Benc 1013f9e124fbSChristian Lamparter spinlock_t rx_path_lock; 101424a8fdadSChristian Lamparter 1015d0709a65SJohannes Berg /* Station data */ 1016d0709a65SJohannes Berg /* 10174d33960bSJohannes Berg * The mutex only protects the list, hash table and 10184d33960bSJohannes Berg * counter, reads are done with RCU. 1019d0709a65SJohannes Berg */ 102034e89507SJohannes Berg struct mutex sta_mtx; 10214d33960bSJohannes Berg spinlock_t tim_lock; 1022d0709a65SJohannes Berg unsigned long num_sta; 10234d33960bSJohannes Berg struct list_head sta_list; 102440b275b6SJohannes Berg struct sta_info __rcu *sta_hash[STA_HASH_SIZE]; 1025f0706e82SJiri Benc struct timer_list sta_cleanup; 1026f5ea9120SJohannes Berg int sta_generation; 1027f0706e82SJiri Benc 10282a577d98SJohannes Berg struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; 1029f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 1030f0706e82SJiri Benc 1031a6a67db2SJohannes Berg atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; 1032cd8ffc80SJohannes Berg 1033f0706e82SJiri Benc /* number of interfaces with corresponding IFF_ flags */ 103453918994SJohannes Berg atomic_t iff_allmultis, iff_promiscs; 1035f0706e82SJiri Benc 1036f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 1037f0706e82SJiri Benc 10385f9f1812SFelix Fietkau struct crypto_cipher *wep_tx_tfm; 10395f9f1812SFelix Fietkau struct crypto_cipher *wep_rx_tfm; 1040f0706e82SJiri Benc u32 wep_iv; 1041f0706e82SJiri Benc 1042c771c9d8SJohannes Berg /* see iface.c */ 104379010420SJohannes Berg struct list_head interfaces; 1044c771c9d8SJohannes Berg struct mutex iflist_mtx; 104579010420SJohannes Berg 1046b16bd15cSJohannes Berg /* 1047ad0e2b5aSJohannes Berg * Key mutex, protects sdata's key_list and sta_info's 1048b16bd15cSJohannes Berg * key pointers (write access, they're RCU.) 1049b16bd15cSJohannes Berg */ 1050ad0e2b5aSJohannes Berg struct mutex key_mtx; 1051b16bd15cSJohannes Berg 1052a1699b75SJohannes Berg /* mutex for scan and work locking */ 1053a1699b75SJohannes Berg struct mutex mtx; 1054b16bd15cSJohannes Berg 1055c2b13452SJohannes Berg /* Scanning and BSS list */ 1056fbe9c429SHelmut Schaa unsigned long scanning; 10572a519311SJohannes Berg struct cfg80211_ssid scan_ssid; 10585ba63533SJohannes Berg struct cfg80211_scan_request *int_scan_req; 10594d36ec58SJohannes Berg struct cfg80211_scan_request *scan_req, *hw_scan_req; 10602a519311SJohannes Berg struct ieee80211_channel *scan_channel; 10614d36ec58SJohannes Berg enum ieee80211_band hw_scan_band; 1062f0706e82SJiri Benc int scan_channel_idx; 1063de95a54bSJohannes Berg int scan_ies_len; 1064c604b9f2SJohannes Berg int hw_scan_ies_bufsize; 10658318d78aSJohannes Berg 106685a9994aSLuciano Coelho struct work_struct sched_scan_stopped_work; 10675260a5b2SJohannes Berg struct ieee80211_sub_if_data __rcu *sched_scan_sdata; 106879f460caSLuciano Coelho 1069df13cce5SHelmut Schaa unsigned long leave_oper_channel_time; 1070977923b0SHelmut Schaa enum mac80211_scan_state next_scan_state; 1071f0706e82SJiri Benc struct delayed_work scan_work; 1072e2fd5dbcSJohannes Berg struct ieee80211_sub_if_data __rcu *scan_sdata; 107385220d71SJohannes Berg struct cfg80211_chan_def csa_chandef; 107455de908aSJohannes Berg /* For backward compatibility only -- do not use */ 1075675a0b04SKarl Beldan struct cfg80211_chan_def _oper_chandef; 1076f0706e82SJiri Benc 1077b8bc4b0aSJohannes Berg /* Temporary remain-on-channel for off-channel operations */ 1078b8bc4b0aSJohannes Berg struct ieee80211_channel *tmp_channel; 1079b8bc4b0aSJohannes Berg 1080d01a1e65SMichal Kazior /* channel contexts */ 1081d01a1e65SMichal Kazior struct list_head chanctx_list; 1082d01a1e65SMichal Kazior struct mutex chanctx_mtx; 1083d01a1e65SMichal Kazior 1084f0706e82SJiri Benc /* SNMP counters */ 1085f0706e82SJiri Benc /* dot11CountersTable */ 1086f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 1087f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 1088f0706e82SJiri Benc u32 dot11FailedCount; 1089f0706e82SJiri Benc u32 dot11RetryCount; 1090f0706e82SJiri Benc u32 dot11MultipleRetryCount; 1091f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 1092f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 1093f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 1094f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 1095f0706e82SJiri Benc 1096f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS 1097f0706e82SJiri Benc int tx_led_counter, rx_led_counter; 1098cdcb006fSIvo van Doorn struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; 1099e1e54068SJohannes Berg struct tpt_led_trigger *tpt_led_trigger; 1100cdcb006fSIvo van Doorn char tx_led_name[32], rx_led_name[32], 1101cdcb006fSIvo van Doorn assoc_led_name[32], radio_led_name[32]; 1102f0706e82SJiri Benc #endif 1103f0706e82SJiri Benc 1104f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 1105f0706e82SJiri Benc /* TX/RX handler statistics */ 1106f0706e82SJiri Benc unsigned int tx_handlers_drop; 1107f0706e82SJiri Benc unsigned int tx_handlers_queued; 1108f0706e82SJiri Benc unsigned int tx_handlers_drop_unencrypted; 1109f0706e82SJiri Benc unsigned int tx_handlers_drop_fragment; 1110f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 1111f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 1112f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 1113f0706e82SJiri Benc unsigned int rx_handlers_drop; 1114f0706e82SJiri Benc unsigned int rx_handlers_queued; 1115f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 1116f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 1117f0706e82SJiri Benc unsigned int rx_handlers_drop_short; 1118f0706e82SJiri Benc unsigned int tx_expand_skb_head; 1119f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 1120f0706e82SJiri Benc unsigned int rx_expand_skb_head; 1121f0706e82SJiri Benc unsigned int rx_expand_skb_head2; 1122f0706e82SJiri Benc unsigned int rx_handlers_fragments; 1123f0706e82SJiri Benc unsigned int tx_status_drop; 1124f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 1125f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1126f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 1127f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 1128f0706e82SJiri Benc 1129f0706e82SJiri Benc 1130f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 1131f0706e82SJiri Benc * multicast packets for power saving stations 1132f0706e82SJiri Benc */ 1133520eb820SKalle Valo 1134572e0012SKalle Valo bool pspolling; 1135b203ffc3SJouni Malinen bool offchannel_ps_enabled; 1136965bedadSJohannes Berg /* 1137965bedadSJohannes Berg * PS can only be enabled when we have exactly one managed 1138965bedadSJohannes Berg * interface (and monitors) in PS, this then points there. 1139965bedadSJohannes Berg */ 1140965bedadSJohannes Berg struct ieee80211_sub_if_data *ps_sdata; 1141520eb820SKalle Valo struct work_struct dynamic_ps_enable_work; 1142520eb820SKalle Valo struct work_struct dynamic_ps_disable_work; 1143520eb820SKalle Valo struct timer_list dynamic_ps_timer; 114410f644a4SJohannes Berg struct notifier_block network_latency_notifier; 11452b2c009eSJuuso Oikarinen struct notifier_block ifa_notifier; 1146a65240c1SJohannes Berg struct notifier_block ifa6_notifier; 1147f0706e82SJiri Benc 1148ff616381SJuuso Oikarinen /* 1149ff616381SJuuso Oikarinen * The dynamic ps timeout configured from user space via WEXT - 1150ff616381SJuuso Oikarinen * this will override whatever chosen by mac80211 internally. 1151ff616381SJuuso Oikarinen */ 1152ff616381SJuuso Oikarinen int dynamic_ps_forced_timeout; 1153ff616381SJuuso Oikarinen 11541ea6f9c0SJohannes Berg int user_power_level; /* in dBm, for all interfaces */ 11552bf30fabSJohannes Berg 11560f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode; 11570f78231bSJohannes Berg 1158f2753ddbSJohannes Berg struct work_struct restart_work; 1159f2753ddbSJohannes Berg 1160e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 1161e9f207f0SJiri Benc struct local_debugfsdentries { 11624b7679a5SJohannes Berg struct dentry *rcdir; 1163e9f207f0SJiri Benc struct dentry *keys; 1164e9f207f0SJiri Benc } debugfs; 1165e9f207f0SJiri Benc #endif 11664e6cbfd0SJohn W. Linville 11672eb278e0SJohannes Berg /* 11682eb278e0SJohannes Berg * Remain-on-channel support 11692eb278e0SJohannes Berg */ 11702eb278e0SJohannes Berg struct list_head roc_list; 117121f83589SJohannes Berg struct work_struct hw_roc_start, hw_roc_done; 11722eb278e0SJohannes Berg unsigned long hw_roc_start_time; 117350febf6aSJohannes Berg u64 roc_cookie_counter; 117421f83589SJohannes Berg 1175a729cff8SJohannes Berg struct idr ack_status_frames; 1176a729cff8SJohannes Berg spinlock_t ack_status_lock; 1177a729cff8SJohannes Berg 1178f142c6b9SJohannes Berg struct ieee80211_sub_if_data __rcu *p2p_sdata; 1179f142c6b9SJohannes Berg 11804b6f1dd6SJohannes Berg /* virtual monitor interface */ 11814b6f1dd6SJohannes Berg struct ieee80211_sub_if_data __rcu *monitor_sdata; 11824bf88530SJohannes Berg struct cfg80211_chan_def monitor_chandef; 1183f0706e82SJiri Benc }; 1184f0706e82SJiri Benc 11853e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 11863e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) 11873e122be0SJohannes Berg { 11883e122be0SJohannes Berg return netdev_priv(dev); 11893e122be0SJohannes Berg } 11903e122be0SJohannes Berg 119171bbc994SJohannes Berg static inline struct ieee80211_sub_if_data * 119271bbc994SJohannes Berg IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev) 119371bbc994SJohannes Berg { 119471bbc994SJohannes Berg return container_of(wdev, struct ieee80211_sub_if_data, wdev); 119571bbc994SJohannes Berg } 119671bbc994SJohannes Berg 1197c1475ca9SJohannes Berg /* this struct represents 802.11n's RA/TID combination */ 1198eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid { 1199eadc8d9eSRon Rindjunsky u8 ra[ETH_ALEN]; 1200eadc8d9eSRon Rindjunsky u16 tid; 1201eadc8d9eSRon Rindjunsky }; 1202eadc8d9eSRon Rindjunsky 1203dd76986bSJohannes Berg /* Parsed Information Elements */ 1204dd76986bSJohannes Berg struct ieee802_11_elems { 12054a3cb702SJohannes Berg const u8 *ie_start; 1206dd76986bSJohannes Berg size_t total_len; 1207dd76986bSJohannes Berg 1208dd76986bSJohannes Berg /* pointers to IEs */ 12094a3cb702SJohannes Berg const u8 *ssid; 12104a3cb702SJohannes Berg const u8 *supp_rates; 12114a3cb702SJohannes Berg const u8 *ds_params; 12124a3cb702SJohannes Berg const struct ieee80211_tim_ie *tim; 12134a3cb702SJohannes Berg const u8 *challenge; 12144a3cb702SJohannes Berg const u8 *rsn; 12154a3cb702SJohannes Berg const u8 *erp_info; 12164a3cb702SJohannes Berg const u8 *ext_supp_rates; 12174a3cb702SJohannes Berg const u8 *wmm_info; 12184a3cb702SJohannes Berg const u8 *wmm_param; 12194a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_elem; 12204a3cb702SJohannes Berg const struct ieee80211_ht_operation *ht_operation; 12214a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_elem; 12224a3cb702SJohannes Berg const struct ieee80211_vht_operation *vht_operation; 12234a3cb702SJohannes Berg const struct ieee80211_meshconf_ie *mesh_config; 12244a3cb702SJohannes Berg const u8 *mesh_id; 12254a3cb702SJohannes Berg const u8 *peering; 12264a3cb702SJohannes Berg const __le16 *awake_window; 12274a3cb702SJohannes Berg const u8 *preq; 12284a3cb702SJohannes Berg const u8 *prep; 12294a3cb702SJohannes Berg const u8 *perr; 12304a3cb702SJohannes Berg const struct ieee80211_rann_ie *rann; 12314a3cb702SJohannes Berg const struct ieee80211_channel_sw_ie *ch_switch_ie; 1232b4f286a1SJohannes Berg const struct ieee80211_ext_chansw_ie *ext_chansw_ie; 1233b2e506bfSJohannes Berg const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie; 12344a3cb702SJohannes Berg const u8 *country_elem; 12354a3cb702SJohannes Berg const u8 *pwr_constr_elem; 123679ba1d89SJohannes Berg const struct ieee80211_timeout_interval_ie *timeout_int; 12374a3cb702SJohannes Berg const u8 *opmode_notif; 123885220d71SJohannes Berg const struct ieee80211_sec_chan_offs_ie *sec_chan_offs; 1239dd76986bSJohannes Berg 1240dd76986bSJohannes Berg /* length of them, respectively */ 1241dd76986bSJohannes Berg u8 ssid_len; 1242dd76986bSJohannes Berg u8 supp_rates_len; 1243dd76986bSJohannes Berg u8 tim_len; 1244dd76986bSJohannes Berg u8 challenge_len; 1245dd76986bSJohannes Berg u8 rsn_len; 1246dd76986bSJohannes Berg u8 ext_supp_rates_len; 1247dd76986bSJohannes Berg u8 wmm_info_len; 1248dd76986bSJohannes Berg u8 wmm_param_len; 1249dd76986bSJohannes Berg u8 mesh_id_len; 1250dd76986bSJohannes Berg u8 peering_len; 1251dd76986bSJohannes Berg u8 preq_len; 1252dd76986bSJohannes Berg u8 prep_len; 1253dd76986bSJohannes Berg u8 perr_len; 1254dd76986bSJohannes Berg u8 country_elem_len; 1255fcff4f10SPaul Stewart 1256fcff4f10SPaul Stewart /* whether a parse error occurred while retrieving these elements */ 1257fcff4f10SPaul Stewart bool parse_error; 1258dd76986bSJohannes Berg }; 1259dd76986bSJohannes Berg 1260f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 1261f0706e82SJiri Benc struct ieee80211_hw *hw) 1262f0706e82SJiri Benc { 1263f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 1264f0706e82SJiri Benc } 1265f0706e82SJiri Benc 1266f0706e82SJiri Benc 1267571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) 1268571ecf67SJohannes Berg { 1269b203ca39SJoe Perches return ether_addr_equal(raddr, addr) || 1270571ecf67SJohannes Berg is_broadcast_ether_addr(raddr); 1271571ecf67SJohannes Berg } 1272571ecf67SJohannes Berg 1273f4bda337SThomas Pedersen static inline bool 1274f4bda337SThomas Pedersen ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status) 1275f4bda337SThomas Pedersen { 1276f4bda337SThomas Pedersen WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START && 1277f4bda337SThomas Pedersen status->flag & RX_FLAG_MACTIME_END); 1278f4bda337SThomas Pedersen return status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END); 1279f4bda337SThomas Pedersen } 1280571ecf67SJohannes Berg 1281f4bda337SThomas Pedersen u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local, 1282f4bda337SThomas Pedersen struct ieee80211_rx_status *status, 1283f4bda337SThomas Pedersen unsigned int mpdu_len, 1284f4bda337SThomas Pedersen unsigned int mpdu_offset); 1285e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 12865cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 12879c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 12889c6bd790SJohannes Berg u32 changed); 12890d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local); 129046900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 1291f0706e82SJiri Benc 129246900298SJohannes Berg /* STA code */ 12939c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 129477fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, 129577fdaa12SJohannes Berg struct cfg80211_auth_request *req); 129677fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 129777fdaa12SJohannes Berg struct cfg80211_assoc_request *req); 129877fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, 129963c9c5e7SJohannes Berg struct cfg80211_deauth_request *req); 130077fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 130163c9c5e7SJohannes Berg struct cfg80211_disassoc_request *req); 1302572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local, 1303572e0012SKalle Valo struct ieee80211_sub_if_data *sdata); 130410f644a4SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); 1305ab095877SEliad Peller void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata); 130610f644a4SJohannes Berg int ieee80211_max_network_latency(struct notifier_block *nb, 130710f644a4SJohannes Berg unsigned long data, void *dummy); 13082b2c009eSJuuso Oikarinen int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); 13091fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); 13101fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 13111fa57d01SJohannes Berg struct sk_buff *skb); 1312d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); 1313be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); 1314afa762f6SEliad Peller void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata); 13151672c0e3SJohannes Berg void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata, 13161672c0e3SJohannes Berg __le16 fc, bool acked); 1317b8360ab8SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); 13189c6bd790SJohannes Berg 131946900298SJohannes Berg /* IBSS code */ 132046900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); 132146900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); 13228bf11d8dSJohannes Berg void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata, 13238bf11d8dSJohannes Berg const u8 *bssid, const u8 *addr, u32 supp_rates); 1324af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 1325af8cdcd8SJohannes Berg struct cfg80211_ibss_params *params); 1326af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); 13271fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata); 13281fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 13291fa57d01SJohannes Berg struct sk_buff *skb); 13301fa57d01SJohannes Berg 13311fa57d01SJohannes Berg /* mesh code */ 13321fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata); 13331fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 13341fa57d01SJohannes Berg struct sk_buff *skb); 133546900298SJohannes Berg 13369c6bd790SJohannes Berg /* scan/BSS handling */ 133746900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work); 133834bcf715SStanislaw Gruszka int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata, 1339be4a4b6aSJohannes Berg const u8 *ssid, u8 ssid_len, 1340be4a4b6aSJohannes Berg struct ieee80211_channel *chan); 1341c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 13422a519311SJohannes Berg struct cfg80211_scan_request *req); 13435bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local); 1344133d40f9SStanislaw Gruszka void ieee80211_run_deferred_scan(struct ieee80211_local *local); 1345d48b2968SJohannes Berg void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb); 13469c6bd790SJohannes Berg 13470a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 1348c2b13452SJohannes Berg struct ieee80211_bss * 134998c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local, 135098c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status, 135198c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt, 135298c8fccfSJohannes Berg size_t len, 135398c8fccfSJohannes Berg struct ieee802_11_elems *elems, 1354d45c4172SEmmanuel Grumbach struct ieee80211_channel *channel); 135598c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local, 1356c2b13452SJohannes Berg struct ieee80211_bss *bss); 1357ee385855SLuis Carlos Cobo 135879f460caSLuciano Coelho /* scheduled scan handling */ 135979f460caSLuciano Coelho int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, 136079f460caSLuciano Coelho struct cfg80211_sched_scan_request *req); 136185a9994aSLuciano Coelho int ieee80211_request_sched_scan_stop(struct ieee80211_sub_if_data *sdata); 136285a9994aSLuciano Coelho void ieee80211_sched_scan_stopped_work(struct work_struct *work); 136379f460caSLuciano Coelho 1364b203ffc3SJouni Malinen /* off-channel helpers */ 1365aacde9eeSStanislaw Gruszka void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local); 1366aacde9eeSStanislaw Gruszka void ieee80211_offchannel_return(struct ieee80211_local *local); 13672eb278e0SJohannes Berg void ieee80211_roc_setup(struct ieee80211_local *local); 13682eb278e0SJohannes Berg void ieee80211_start_next_roc(struct ieee80211_local *local); 1369c8f994eeSJohannes Berg void ieee80211_roc_purge(struct ieee80211_local *local, 1370c8f994eeSJohannes Berg struct ieee80211_sub_if_data *sdata); 13713fbd45caSJohannes Berg void ieee80211_roc_notify_destroy(struct ieee80211_roc_work *roc, bool free); 13722eb278e0SJohannes Berg void ieee80211_sw_roc_work(struct work_struct *work); 13732eb278e0SJohannes Berg void ieee80211_handle_roc_started(struct ieee80211_roc_work *roc); 1374b203ffc3SJouni Malinen 13753e122be0SJohannes Berg /* interface handling */ 137647846c9bSJohannes Berg int ieee80211_iface_init(void); 137747846c9bSJohannes Berg void ieee80211_iface_exit(void); 13783e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 137984efbb84SJohannes Berg struct wireless_dev **new_wdev, enum nl80211_iftype type, 1380ee385855SLuis Carlos Cobo struct vif_params *params); 1381f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 138205c914feSJohannes Berg enum nl80211_iftype type); 1383f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 138475636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 1385382a103bSJohannes Berg u32 ieee80211_idle_off(struct ieee80211_local *local); 13865cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local); 138785416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, 138885416a4fSChristian Lamparter const int offset); 1389f142c6b9SJohannes Berg int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up); 1390f142c6b9SJohannes Berg void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata); 13913c3e21e7SJohannes Berg int ieee80211_add_virtual_monitor(struct ieee80211_local *local); 13923c3e21e7SJohannes Berg void ieee80211_del_virtual_monitor(struct ieee80211_local *local); 1393f0706e82SJiri Benc 13941ea6f9c0SJohannes Berg bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 13951ea6f9c0SJohannes Berg void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata); 13961ea6f9c0SJohannes Berg 13979607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) 13989607e6b6SJohannes Berg { 139934d4bc4dSJohannes Berg return test_bit(SDATA_STATE_RUNNING, &sdata->state); 14009607e6b6SJohannes Berg } 14019607e6b6SJohannes Berg 1402e2ebc74dSJohannes Berg /* tx handling */ 1403e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 1404e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data); 1405d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1406d0cf9c0dSStephen Hemminger struct net_device *dev); 1407d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, 1408d0cf9c0dSStephen Hemminger struct net_device *dev); 14091f98ab7fSFelix Fietkau void ieee80211_purge_tx_queue(struct ieee80211_hw *hw, 14101f98ab7fSFelix Fietkau struct sk_buff_head *skbs); 1411e2ebc74dSJohannes Berg 1412de1ede7aSJohannes Berg /* HT */ 1413ef96a842SBen Greear void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, 1414ef96a842SBen Greear struct ieee80211_sta_ht_cap *ht_cap); 1415e1a0c6b3SJohannes Berg bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata, 1416ef96a842SBen Greear struct ieee80211_supported_band *sband, 14174a3cb702SJohannes Berg const struct ieee80211_ht_cap *ht_cap_ie, 1418e1a0c6b3SJohannes Berg struct sta_info *sta); 1419b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, 1420b8695a8fSJohannes Berg const u8 *da, u16 tid, 1421b8695a8fSJohannes Berg u16 initiator, u16 reason_code); 14220f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, 14230f78231bSJohannes Berg enum ieee80211_smps_mode smps, const u8 *da, 14240f78231bSJohannes Berg const u8 *bssid); 1425d1f5b7a3SJohannes Berg void ieee80211_request_smps_work(struct work_struct *work); 1426de1ede7aSJohannes Berg 14277c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 142853f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1429849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 143053f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1431c82c4a80SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, 1432c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 1433de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, 1434de1ede7aSJohannes Berg struct sta_info *sta, 1435de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len); 1436de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local, 1437de1ede7aSJohannes Berg struct sta_info *sta, 1438de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1439de1ede7aSJohannes Berg size_t len); 1440de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local, 1441de1ede7aSJohannes Berg struct sta_info *sta, 1442de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1443de1ede7aSJohannes Berg size_t len); 1444de1ede7aSJohannes Berg 1445849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1446c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 144767c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1448c82c4a80SJohannes Berg enum ieee80211_agg_stop_reason reason); 14495d22c89bSJohannes Berg void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); 14505d22c89bSJohannes Berg void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); 145167c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work); 145267c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); 14532bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid); 1454849b7967SJohannes Berg 145504ecd257SJohannes Berg u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs); 145604ecd257SJohannes Berg 1457818255eaSMahesh Palivela /* VHT */ 14584a3cb702SJohannes Berg void 14594a3cb702SJohannes Berg ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata, 1460818255eaSMahesh Palivela struct ieee80211_supported_band *sband, 14614a3cb702SJohannes Berg const struct ieee80211_vht_cap *vht_cap_ie, 14624a34215eSJohannes Berg struct sta_info *sta); 1463e1a0c6b3SJohannes Berg enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta); 14648921d04eSJohannes Berg void ieee80211_sta_set_rx_nss(struct sta_info *sta); 14650af83d3dSJohannes Berg void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata, 14660af83d3dSJohannes Berg struct sta_info *sta, u8 opmode, 1467bee7f586SJohannes Berg enum ieee80211_band band, bool nss_only); 1468dd5ecfeaSJohannes Berg void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata, 1469dd5ecfeaSJohannes Berg struct ieee80211_sta_vht_cap *vht_cap); 14704a34215eSJohannes Berg 147139192c0bSJohannes Berg /* Spectrum management */ 147239192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 147339192c0bSJohannes Berg struct ieee80211_mgmt *mgmt, 147439192c0bSJohannes Berg size_t len); 147539192c0bSJohannes Berg 1476f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */ 1477f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local); 147884f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local); 1479f2753ddbSJohannes Berg 1480eecc4800SJohannes Berg int __ieee80211_suspend(struct ieee80211_hw *hw, 1481eecc4800SJohannes Berg struct cfg80211_wowlan *wowlan); 1482f2753ddbSJohannes Berg 1483f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 1484f2753ddbSJohannes Berg { 148585f72bc8SJohn W. Linville struct ieee80211_local *local = hw_to_local(hw); 148685f72bc8SJohn W. Linville 148785f72bc8SJohn W. Linville WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), 148885f72bc8SJohn W. Linville "%s: resume with hardware scan still in progress\n", 148985f72bc8SJohn W. Linville wiphy_name(hw->wiphy)); 149085f72bc8SJohn W. Linville 1491f2753ddbSJohannes Berg return ieee80211_reconfig(hw_to_local(hw)); 1492f2753ddbSJohannes Berg } 1493665af4fcSBob Copeland 1494c2d1560aSJohannes Berg /* utility functions/constants */ 1495c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */ 149671364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 149705c914feSJohannes Berg enum nl80211_iftype type); 14984ee73f33SMichal Kazior int ieee80211_frame_duration(enum ieee80211_band band, size_t len, 1499438b61b7SSimon Wunderlich int rate, int erp, int short_preamble, 1500438b61b7SSimon Wunderlich int shift); 1501f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 1502e6d6e342SJohannes Berg struct ieee80211_hdr *hdr, const u8 *tsc, 1503e6d6e342SJohannes Berg gfp_t gfp); 15043abead59SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata, 15053abead59SJohannes Berg bool bss_notify); 150655de908aSJohannes Berg void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 150755de908aSJohannes Berg enum ieee80211_band band); 1508cf6bb79aSHelmut Schaa 150955de908aSJohannes Berg void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 151055de908aSJohannes Berg struct sk_buff *skb, int tid, 151155de908aSJohannes Berg enum ieee80211_band band); 151255de908aSJohannes Berg 151355de908aSJohannes Berg static inline void 151455de908aSJohannes Berg ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 151555de908aSJohannes Berg struct sk_buff *skb, int tid, 151655de908aSJohannes Berg enum ieee80211_band band) 151755de908aSJohannes Berg { 151855de908aSJohannes Berg rcu_read_lock(); 151955de908aSJohannes Berg __ieee80211_tx_skb_tid_band(sdata, skb, tid, band); 152055de908aSJohannes Berg rcu_read_unlock(); 152155de908aSJohannes Berg } 152255de908aSJohannes Berg 152355de908aSJohannes Berg static inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, 152455de908aSJohannes Berg struct sk_buff *skb, int tid) 152555de908aSJohannes Berg { 152655de908aSJohannes Berg struct ieee80211_chanctx_conf *chanctx_conf; 152755de908aSJohannes Berg 152855de908aSJohannes Berg rcu_read_lock(); 152955de908aSJohannes Berg chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 153055de908aSJohannes Berg if (WARN_ON(!chanctx_conf)) { 153155de908aSJohannes Berg rcu_read_unlock(); 153255de908aSJohannes Berg kfree_skb(skb); 153355de908aSJohannes Berg return; 153455de908aSJohannes Berg } 153555de908aSJohannes Berg 153655de908aSJohannes Berg __ieee80211_tx_skb_tid_band(sdata, skb, tid, 15374bf88530SJohannes Berg chanctx_conf->def.chan->band); 153855de908aSJohannes Berg rcu_read_unlock(); 153955de908aSJohannes Berg } 154055de908aSJohannes Berg 154155de908aSJohannes Berg static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, 1542cf6bb79aSHelmut Schaa struct sk_buff *skb) 1543cf6bb79aSHelmut Schaa { 1544cf6bb79aSHelmut Schaa /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */ 1545cf6bb79aSHelmut Schaa ieee80211_tx_skb_tid(sdata, skb, 7); 1546cf6bb79aSHelmut Schaa } 1547cf6bb79aSHelmut Schaa 154835d865afSJohannes Berg u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action, 1549d91f36dbSJohannes Berg struct ieee802_11_elems *elems, 1550d91f36dbSJohannes Berg u64 filter, u32 crc); 155135d865afSJohannes Berg static inline void ieee802_11_parse_elems(const u8 *start, size_t len, 155235d865afSJohannes Berg bool action, 1553ddc4db2eSJohannes Berg struct ieee802_11_elems *elems) 1554ddc4db2eSJohannes Berg { 1555b2e506bfSJohannes Berg ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0); 1556ddc4db2eSJohannes Berg } 1557ddc4db2eSJohannes Berg 1558520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 1559520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 1560520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data); 1561a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local, 1562a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata, 1563a97b77b9SVivek Natarajan int powersave); 15643cf335d5SKalle Valo void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, 15653cf335d5SKalle Valo struct ieee80211_hdr *hdr); 15664e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 156704ac3c0eSFelix Fietkau struct ieee80211_hdr *hdr, bool ack); 1568520eb820SKalle Valo 1569ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 1570445ea4e8SJohannes Berg unsigned long queues, 1571ce7c9111SKalle Valo enum queue_stop_reason reason); 1572ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 1573445ea4e8SJohannes Berg unsigned long queues, 1574ce7c9111SKalle Valo enum queue_stop_reason reason); 157596f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 157696f5e66eSJohannes Berg enum queue_stop_reason reason); 157796f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, 157896f5e66eSJohannes Berg enum queue_stop_reason reason); 15793a25a8c8SJohannes Berg void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue); 15808f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local, 15818f77f384SJohannes Berg struct sk_buff *skb); 1582b0b97a8aSJohannes Berg void ieee80211_add_pending_skbs_fn(struct ieee80211_local *local, 158350a9432dSJohannes Berg struct sk_buff_head *skbs, 158450a9432dSJohannes Berg void (*fn)(void *data), void *data); 158578307daaSJohannes Berg static inline void ieee80211_add_pending_skbs(struct ieee80211_local *local, 158678307daaSJohannes Berg struct sk_buff_head *skbs) 158778307daaSJohannes Berg { 158878307daaSJohannes Berg ieee80211_add_pending_skbs_fn(local, skbs, NULL, NULL); 158978307daaSJohannes Berg } 159039ecc01dSJohannes Berg void ieee80211_flush_queues(struct ieee80211_local *local, 159139ecc01dSJohannes Berg struct ieee80211_sub_if_data *sdata); 1592ce7c9111SKalle Valo 159346900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 1594700e8ea6SJouni Malinen u16 transaction, u16 auth_alg, u16 status, 15954a3cb702SJohannes Berg const u8 *extra, size_t extra_len, const u8 *bssid, 15961672c0e3SJohannes Berg const u8 *da, const u8 *key, u8 key_len, u8 key_idx, 15971672c0e3SJohannes Berg u32 tx_flags); 15986ae16775SAntonio Quartulli void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata, 15996ae16775SAntonio Quartulli const u8 *bssid, u16 stype, u16 reason, 16006ae16775SAntonio Quartulli bool send_frame, u8 *frame_buf); 1601de95a54bSJohannes Berg int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, 1602c604b9f2SJohannes Berg size_t buffer_len, const u8 *ie, size_t ie_len, 1603651b5225SJouni Malinen enum ieee80211_band band, u32 rate_mask, 1604651b5225SJouni Malinen u8 channel); 1605a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 160685a237feSJohannes Berg u8 *dst, u32 ratemask, 16076b77863bSJohannes Berg struct ieee80211_channel *chan, 1608a619a4c0SJuuso Oikarinen const u8 *ssid, size_t ssid_len, 1609a806c558SPaul Stewart const u8 *ie, size_t ie_len, 1610a806c558SPaul Stewart bool directed); 161146900298SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, 1612de95a54bSJohannes Berg const u8 *ssid, size_t ssid_len, 1613a806c558SPaul Stewart const u8 *ie, size_t ie_len, 16141672c0e3SJohannes Berg u32 ratemask, bool directed, u32 tx_flags, 161555de908aSJohannes Berg struct ieee80211_channel *channel, bool scan); 161646900298SJohannes Berg 161746900298SJohannes Berg void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, 161846900298SJohannes Berg const size_t supp_rates_len, 161946900298SJohannes Berg const u8 *supp_rates); 162046900298SJohannes Berg u32 ieee80211_sta_get_rates(struct ieee80211_local *local, 162146900298SJohannes Berg struct ieee802_11_elems *elems, 16229ebb61a2SAshok Nagarajan enum ieee80211_band band, u32 *basic_rates); 16230f78231bSJohannes Berg int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, 16240f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode); 162504ecd257SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata); 162646900298SJohannes Berg 16278e664fb3SJohannes Berg size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 16288e664fb3SJohannes Berg const u8 *ids, int n_ids, size_t offset); 16298e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset); 1630ef96a842SBen Greear u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 163142e7aa77SAlexander Simon u16 cap); 1632074d46d1SJohannes Berg u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap, 16334bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 1634431e3154SAshok Nagarajan u16 prot_mode); 1635ba0afa2fSMahesh Palivela u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap, 1636ba0afa2fSMahesh Palivela u32 cap); 1637fc8a7321SJohannes Berg int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, 16386b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 16396b77863bSJohannes Berg enum ieee80211_band band); 1640fc8a7321SJohannes Berg int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, 16416b77863bSJohannes Berg struct sk_buff *skb, bool need_basic, 16426b77863bSJohannes Berg enum ieee80211_band band); 16438e664fb3SJohannes Berg 1644f444de05SJohannes Berg /* channel management */ 16454bf88530SJohannes Berg void ieee80211_ht_oper_to_chandef(struct ieee80211_channel *control_chan, 16464a3cb702SJohannes Berg const struct ieee80211_ht_operation *ht_oper, 16474bf88530SJohannes Berg struct cfg80211_chan_def *chandef); 1648f444de05SJohannes Berg 1649d01a1e65SMichal Kazior int __must_check 1650d01a1e65SMichal Kazior ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata, 16514bf88530SJohannes Berg const struct cfg80211_chan_def *chandef, 1652d01a1e65SMichal Kazior enum ieee80211_chanctx_mode mode); 16532c9b7359SJohannes Berg int __must_check 16542c9b7359SJohannes Berg ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata, 16552c9b7359SJohannes Berg const struct cfg80211_chan_def *chandef, 16562c9b7359SJohannes Berg u32 *changed); 1657d01a1e65SMichal Kazior void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata); 16584d76d21bSJohannes Berg void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata); 16591f4ac5a6SJohannes Berg void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata, 16601f4ac5a6SJohannes Berg bool clear); 1661d01a1e65SMichal Kazior 166204ecd257SJohannes Berg void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local, 166304ecd257SJohannes Berg struct ieee80211_chanctx *chanctx); 1664164eb02dSSimon Wunderlich void ieee80211_recalc_radar_chanctx(struct ieee80211_local *local, 1665164eb02dSSimon Wunderlich struct ieee80211_chanctx *chanctx); 1666164eb02dSSimon Wunderlich 1667164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer(unsigned long data); 1668164eb02dSSimon Wunderlich void ieee80211_dfs_cac_timer_work(struct work_struct *work); 1669164eb02dSSimon Wunderlich void ieee80211_dfs_cac_cancel(struct ieee80211_local *local); 1670164eb02dSSimon Wunderlich void ieee80211_dfs_radar_detected_work(struct work_struct *work); 167104ecd257SJohannes Berg 1672f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 1673d9e8a70fSJohannes Berg #define debug_noinline noinline 1674d9e8a70fSJohannes Berg #else 1675d9e8a70fSJohannes Berg #define debug_noinline 1676d9e8a70fSJohannes Berg #endif 1677d9e8a70fSJohannes Berg 1678f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 1679