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> 5e039fa4aSJohannes Berg * Copyright 2007-2008 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> 26fe7a5d5cSJohannes Berg #include <net/ieee80211_radiotap.h> 2793da9cc1Scolin@cozybit.com #include <net/cfg80211.h> 2851cb6db0SDavid S. Miller #include <net/mac80211.h> 292c8dccc7SJohannes Berg #include "key.h" 30f0706e82SJiri Benc #include "sta_info.h" 31f0706e82SJiri Benc 329cfb0009SJohannes Berg struct ieee80211_local; 33f0706e82SJiri Benc 34f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the 35f0706e82SJiri Benc * associated stations are using power saving. */ 36f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128 37f0706e82SJiri Benc 38f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames. 39f0706e82SJiri Benc * Note: increasing this limit increases the potential memory requirement. Each 40f0706e82SJiri Benc * frame can be up to about 2 kB long. */ 41f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512 42f0706e82SJiri Benc 43f0706e82SJiri Benc /* Required encryption head and tailroom */ 44f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8 45765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18 46f0706e82SJiri Benc 47f0706e82SJiri Benc /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent 48f0706e82SJiri Benc * reception of at least three fragmented frames. This limit can be increased 49f0706e82SJiri Benc * by changing this define, at the cost of slower frame reassembly and 50f0706e82SJiri Benc * increased memory use (about 2 kB of RAM per entry). */ 51f0706e82SJiri Benc #define IEEE80211_FRAGMENT_MAX 4 52f0706e82SJiri Benc 530a51b27eSJohannes Berg /* 540a51b27eSJohannes Berg * Time after which we ignore scan results and no longer report/use 550a51b27eSJohannes Berg * them in any way. 560a51b27eSJohannes Berg */ 570a51b27eSJohannes Berg #define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ) 580a51b27eSJohannes Berg 5920ad19d0SJohannes Berg #define TU_TO_EXP_TIME(x) (jiffies + usecs_to_jiffies((x) * 1024)) 6020ad19d0SJohannes Berg 61f0706e82SJiri Benc struct ieee80211_fragment_entry { 62f0706e82SJiri Benc unsigned long first_frag_time; 63f0706e82SJiri Benc unsigned int seq; 64f0706e82SJiri Benc unsigned int rx_queue; 65f0706e82SJiri Benc unsigned int last_frag; 66f0706e82SJiri Benc unsigned int extra_len; 67f0706e82SJiri Benc struct sk_buff_head skb_list; 68f0706e82SJiri Benc int ccmp; /* Whether fragments were encrypted with CCMP */ 69f0706e82SJiri Benc u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ 70f0706e82SJiri Benc }; 71f0706e82SJiri Benc 72f0706e82SJiri Benc 73c2b13452SJohannes Berg struct ieee80211_bss { 7400d3f14cSJohannes Berg /* don't want to look up all the time */ 75056cdd59SJohannes Berg size_t ssid_len; 76f0706e82SJiri Benc u8 ssid[IEEE80211_MAX_SSID_LEN]; 7700d3f14cSJohannes Berg 7898f7dfd8SEmmanuel Grumbach u8 dtim_period; 7900d3f14cSJohannes Berg 8043ac2ca3SJouni Malinen bool wmm_used; 8100d3f14cSJohannes Berg 8200d3f14cSJohannes Berg unsigned long last_probe_resp; 8300d3f14cSJohannes Berg 84ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH 85ee385855SLuis Carlos Cobo u8 *mesh_id; 86ee385855SLuis Carlos Cobo size_t mesh_id_len; 8724736701SJohn W. Linville u8 *mesh_cfg; 88902acc78SJohannes Berg #endif 8900d3f14cSJohannes Berg 90f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32 91f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 92f0706e82SJiri Benc size_t supp_rates_len; 93f0706e82SJiri Benc 9400d3f14cSJohannes Berg /* 9500d3f14cSJohannes Berg * During assocation, we save an ERP value from a probe response so 965628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 975628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 9800d3f14cSJohannes Berg * otherwise, you probably don't want to use them. 9900d3f14cSJohannes Berg */ 10000d3f14cSJohannes Berg bool has_erp_value; 1015628221cSDaniel Drake u8 erp_value; 102f0706e82SJiri Benc }; 103f0706e82SJiri Benc 104c2b13452SJohannes Berg static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss) 105902acc78SJohannes Berg { 106902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 107902acc78SJohannes Berg return bss->mesh_cfg; 108902acc78SJohannes Berg #endif 109902acc78SJohannes Berg return NULL; 110902acc78SJohannes Berg } 111902acc78SJohannes Berg 112c2b13452SJohannes Berg static inline u8 *bss_mesh_id(struct ieee80211_bss *bss) 113902acc78SJohannes Berg { 114902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 115902acc78SJohannes Berg return bss->mesh_id; 116902acc78SJohannes Berg #endif 117902acc78SJohannes Berg return NULL; 118902acc78SJohannes Berg } 119902acc78SJohannes Berg 120c2b13452SJohannes Berg static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss) 121902acc78SJohannes Berg { 122902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 123902acc78SJohannes Berg return bss->mesh_id_len; 124902acc78SJohannes Berg #endif 125902acc78SJohannes Berg return 0; 126902acc78SJohannes Berg } 127902acc78SJohannes Berg 128f0706e82SJiri Benc 1299ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result; 1309ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1319ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1329ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1339ae54c84SJohannes Berg 1345cf121c3SJohannes Berg #define IEEE80211_TX_FRAGMENTED BIT(0) 1355cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1365cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1379ae54c84SJohannes Berg 1385cf121c3SJohannes Berg struct ieee80211_tx_data { 139f0706e82SJiri Benc struct sk_buff *skb; 140f0706e82SJiri Benc struct ieee80211_local *local; 141f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 142f0706e82SJiri Benc struct sta_info *sta; 143f0706e82SJiri Benc struct ieee80211_key *key; 1445cf121c3SJohannes Berg 1458318d78aSJohannes Berg struct ieee80211_channel *channel; 146f0706e82SJiri Benc 147a4b7d7bdSHarvey Harrison u16 ethertype; 148056cdd59SJohannes Berg unsigned int flags; 1495cf121c3SJohannes Berg }; 1505cf121c3SJohannes Berg 1515cf121c3SJohannes Berg 1525cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result; 1535cf121c3SJohannes Berg #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 1545cf121c3SJohannes Berg #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 1555cf121c3SJohannes Berg #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 1565cf121c3SJohannes Berg #define RX_QUEUED ((__force ieee80211_rx_result) 3u) 1575cf121c3SJohannes Berg 1585cf121c3SJohannes Berg #define IEEE80211_RX_IN_SCAN BIT(0) 1595cf121c3SJohannes Berg /* frame is destined to interface currently processed (incl. multicast frames) */ 1605cf121c3SJohannes Berg #define IEEE80211_RX_RA_MATCH BIT(1) 1615cf121c3SJohannes Berg #define IEEE80211_RX_AMSDU BIT(2) 1628c0c709eSJohannes Berg #define IEEE80211_RX_FRAGMENTED BIT(3) 1632569a826SJohannes Berg /* only add flags here that do not change with subframes of an aMPDU */ 1645cf121c3SJohannes Berg 1655cf121c3SJohannes Berg struct ieee80211_rx_data { 1665cf121c3SJohannes Berg struct sk_buff *skb; 1675cf121c3SJohannes Berg struct ieee80211_local *local; 1685cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 1695cf121c3SJohannes Berg struct sta_info *sta; 1705cf121c3SJohannes Berg struct ieee80211_key *key; 171056cdd59SJohannes Berg 172056cdd59SJohannes Berg unsigned int flags; 173f0706e82SJiri Benc int queue; 17450741ae0SJohannes Berg u32 tkip_iv32; 17550741ae0SJohannes Berg u16 tkip_iv16; 176f0706e82SJiri Benc }; 177f0706e82SJiri Benc 1785dfdaf58SJohannes Berg struct beacon_data { 1795dfdaf58SJohannes Berg u8 *head, *tail; 1805dfdaf58SJohannes Berg int head_len, tail_len; 1815dfdaf58SJohannes Berg int dtim_period; 1825dfdaf58SJohannes Berg }; 1835dfdaf58SJohannes Berg 184f0706e82SJiri Benc struct ieee80211_if_ap { 1855dfdaf58SJohannes Berg struct beacon_data *beacon; 186f0706e82SJiri Benc 1870ec3ca44SJohannes Berg struct list_head vlans; 1880ec3ca44SJohannes Berg 189f0706e82SJiri Benc /* yes, this looks ugly, but guarantees that we can later use 190f0706e82SJiri Benc * bitmap_empty :) 191004c872eSJohannes Berg * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 192f0706e82SJiri Benc u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; 193f0706e82SJiri Benc struct sk_buff_head ps_bc_buf; 194056cdd59SJohannes Berg atomic_t num_sta_ps; /* number of stations in PS mode */ 1955dfdaf58SJohannes Berg int dtim_count; 196f0706e82SJiri Benc }; 197f0706e82SJiri Benc 198f0706e82SJiri Benc struct ieee80211_if_wds { 199f0706e82SJiri Benc struct sta_info *sta; 200056cdd59SJohannes Berg u8 remote_addr[ETH_ALEN]; 201f0706e82SJiri Benc }; 202f0706e82SJiri Benc 203f0706e82SJiri Benc struct ieee80211_if_vlan { 2040ec3ca44SJohannes Berg struct list_head list; 205f14543eeSFelix Fietkau 206f14543eeSFelix Fietkau /* used for all tx if the VLAN is configured to 4-addr mode */ 207f14543eeSFelix Fietkau struct sta_info *sta; 208f0706e82SJiri Benc }; 209f0706e82SJiri Benc 210ee385855SLuis Carlos Cobo struct mesh_stats { 211c8a61a7dSDaniel Walker __u32 fwded_mcast; /* Mesh forwarded multicast frames */ 212c8a61a7dSDaniel Walker __u32 fwded_unicast; /* Mesh forwarded unicast frames */ 213c8a61a7dSDaniel Walker __u32 fwded_frames; /* Mesh total forwarded frames */ 214ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 215ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 216ee385855SLuis Carlos Cobo atomic_t estab_plinks; 217ee385855SLuis Carlos Cobo }; 218ee385855SLuis Carlos Cobo 219ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 220ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 221ee385855SLuis Carlos Cobo struct mesh_preq_queue { 222ee385855SLuis Carlos Cobo struct list_head list; 223ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 224ee385855SLuis Carlos Cobo u8 flags; 225ee385855SLuis Carlos Cobo }; 226ee385855SLuis Carlos Cobo 227f679f65dSJohannes Berg enum ieee80211_work_type { 228b8bc4b0aSJohannes Berg IEEE80211_WORK_ABORT, 229af6b6374SJohannes Berg IEEE80211_WORK_DIRECT_PROBE, 230f679f65dSJohannes Berg IEEE80211_WORK_AUTH, 231f679f65dSJohannes Berg IEEE80211_WORK_ASSOC, 232b8bc4b0aSJohannes Berg IEEE80211_WORK_REMAIN_ON_CHANNEL, 23377fdaa12SJohannes Berg }; 23477fdaa12SJohannes Berg 235af6b6374SJohannes Berg /** 236af6b6374SJohannes Berg * enum work_done_result - indicates what to do after work was done 237af6b6374SJohannes Berg * 238af6b6374SJohannes Berg * @WORK_DONE_DESTROY: This work item is no longer needed, destroy. 239af6b6374SJohannes Berg * @WORK_DONE_REQUEUE: This work item was reset to be reused, and 240af6b6374SJohannes Berg * should be requeued. 241af6b6374SJohannes Berg */ 242af6b6374SJohannes Berg enum work_done_result { 243af6b6374SJohannes Berg WORK_DONE_DESTROY, 244af6b6374SJohannes Berg WORK_DONE_REQUEUE, 245af6b6374SJohannes Berg }; 246af6b6374SJohannes Berg 247f679f65dSJohannes Berg struct ieee80211_work { 24877fdaa12SJohannes Berg struct list_head list; 249f679f65dSJohannes Berg 250af6b6374SJohannes Berg struct rcu_head rcu_head; 251af6b6374SJohannes Berg 252af6b6374SJohannes Berg struct ieee80211_sub_if_data *sdata; 253af6b6374SJohannes Berg 254af6b6374SJohannes Berg enum work_done_result (*done)(struct ieee80211_work *wk, 255af6b6374SJohannes Berg struct sk_buff *skb); 256af6b6374SJohannes Berg 257f679f65dSJohannes Berg struct ieee80211_channel *chan; 258f679f65dSJohannes Berg /* XXX: chan type? -- right now not really needed */ 259af6b6374SJohannes Berg 260f679f65dSJohannes Berg unsigned long timeout; 261f679f65dSJohannes Berg enum ieee80211_work_type type; 262f679f65dSJohannes Berg 263af6b6374SJohannes Berg u8 filter_ta[ETH_ALEN]; 264af6b6374SJohannes Berg 265f679f65dSJohannes Berg union { 266f679f65dSJohannes Berg struct { 267f679f65dSJohannes Berg int tries; 268f679f65dSJohannes Berg u16 algorithm, transaction; 26977fdaa12SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 27077fdaa12SJohannes Berg u8 ssid_len; 271fffd0934SJohannes Berg u8 key[WLAN_KEY_LEN_WEP104]; 272fffd0934SJohannes Berg u8 key_len, key_idx; 273f679f65dSJohannes Berg bool privacy; 274af6b6374SJohannes Berg } probe_auth; 275f679f65dSJohannes Berg struct { 2760c1ad2caSJohannes Berg struct cfg80211_bss *bss; 277f679f65dSJohannes Berg const u8 *supp_rates; 278f679f65dSJohannes Berg const u8 *ht_information_ie; 279af6b6374SJohannes Berg enum ieee80211_smps_mode smps; 280f679f65dSJohannes Berg int tries; 281f679f65dSJohannes Berg u16 capability; 282af6b6374SJohannes Berg u8 prev_bssid[ETH_ALEN]; 283f679f65dSJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 284f679f65dSJohannes Berg u8 ssid_len; 285f679f65dSJohannes Berg u8 supp_rates_len; 286af6b6374SJohannes Berg bool wmm_used, use_11n; 287f679f65dSJohannes Berg } assoc; 288b8bc4b0aSJohannes Berg struct { 289b8bc4b0aSJohannes Berg unsigned long timeout; 290b8bc4b0aSJohannes Berg } remain; 291f679f65dSJohannes Berg }; 292fffd0934SJohannes Berg 293f679f65dSJohannes Berg int ie_len; 29477fdaa12SJohannes Berg /* must be last */ 295f679f65dSJohannes Berg u8 ie[0]; 29677fdaa12SJohannes Berg }; 29777fdaa12SJohannes Berg 29846900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */ 299ab1faeadSJohannes Berg enum ieee80211_sta_flags { 300b291ba11SJohannes Berg IEEE80211_STA_BEACON_POLL = BIT(0), 301b291ba11SJohannes Berg IEEE80211_STA_CONNECTION_POLL = BIT(1), 302b291ba11SJohannes Berg IEEE80211_STA_CONTROL_PORT = BIT(2), 303b291ba11SJohannes Berg IEEE80211_STA_DISABLE_11N = BIT(4), 304b291ba11SJohannes Berg IEEE80211_STA_CSA_RECEIVED = BIT(5), 305b291ba11SJohannes Berg IEEE80211_STA_MFP_ENABLED = BIT(6), 306ab1faeadSJohannes Berg }; 307ab1faeadSJohannes Berg 30846900298SJohannes Berg struct ieee80211_if_managed { 309056cdd59SJohannes Berg struct timer_list timer; 310b291ba11SJohannes Berg struct timer_list conn_mon_timer; 311b291ba11SJohannes Berg struct timer_list bcn_mon_timer; 312c481ec97SSujith struct timer_list chswitch_timer; 313056cdd59SJohannes Berg struct work_struct work; 314b291ba11SJohannes Berg struct work_struct monitor_work; 315c481ec97SSujith struct work_struct chswitch_work; 31604de8381SKalle Valo struct work_struct beacon_loss_work; 31746900298SJohannes Berg 318b291ba11SJohannes Berg unsigned long probe_timeout; 319a43abf29SMaxim Levitsky int probe_send_count; 320b291ba11SJohannes Berg 32177fdaa12SJohannes Berg struct mutex mtx; 3220c1ad2caSJohannes Berg struct cfg80211_bss *associated; 32346900298SJohannes Berg 32477fdaa12SJohannes Berg u8 bssid[ETH_ALEN]; 32546900298SJohannes Berg 326f0706e82SJiri Benc u16 aid; 327f0706e82SJiri Benc 328056cdd59SJohannes Berg struct sk_buff_head skb_queue; 329056cdd59SJohannes Berg 3305bb644a0SJohannes Berg unsigned long timers_running; /* used for quiesce/restart */ 331965bedadSJohannes Berg bool powersave; /* powersave requested for this iface */ 3320f78231bSJohannes Berg enum ieee80211_smps_mode req_smps, /* requested smps mode */ 3330f78231bSJohannes Berg ap_smps; /* smps mode AP thinks we're in */ 334965bedadSJohannes Berg 335d6f2da5bSJiri Slaby unsigned int flags; 336f0706e82SJiri Benc 337d91f36dbSJohannes Berg u32 beacon_crc; 338d91f36dbSJohannes Berg 339fdfacf0aSJouni Malinen enum { 340fdfacf0aSJouni Malinen IEEE80211_MFP_DISABLED, 341fdfacf0aSJouni Malinen IEEE80211_MFP_OPTIONAL, 342fdfacf0aSJouni Malinen IEEE80211_MFP_REQUIRED 343fdfacf0aSJouni Malinen } mfp; /* management frame protection */ 344fdfacf0aSJouni Malinen 345f0706e82SJiri Benc int wmm_last_param_set; 3469bc383deSJohannes Berg 3479bc383deSJohannes Berg u8 use_4addr; 348f0706e82SJiri Benc }; 349f0706e82SJiri Benc 35046900298SJohannes Berg enum ieee80211_ibss_request { 35146900298SJohannes Berg IEEE80211_IBSS_REQ_RUN = 0, 35246900298SJohannes Berg }; 35346900298SJohannes Berg 35446900298SJohannes Berg struct ieee80211_if_ibss { 35546900298SJohannes Berg struct timer_list timer; 35646900298SJohannes Berg struct work_struct work; 35746900298SJohannes Berg 35846900298SJohannes Berg struct sk_buff_head skb_queue; 35946900298SJohannes Berg 360af8cdcd8SJohannes Berg unsigned long request; 361af8cdcd8SJohannes Berg unsigned long last_scan_completed; 3625bb644a0SJohannes Berg 3635bb644a0SJohannes Berg bool timer_running; 3645bb644a0SJohannes Berg 365af8cdcd8SJohannes Berg bool fixed_bssid; 366af8cdcd8SJohannes Berg bool fixed_channel; 367fffd0934SJohannes Berg bool privacy; 36846900298SJohannes Berg 36946900298SJohannes Berg u8 bssid[ETH_ALEN]; 370af8cdcd8SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 371af8cdcd8SJohannes Berg u8 ssid_len, ie_len; 372af8cdcd8SJohannes Berg u8 *ie; 373af8cdcd8SJohannes Berg struct ieee80211_channel *channel; 37446900298SJohannes Berg 37546900298SJohannes Berg unsigned long ibss_join_req; 376af8cdcd8SJohannes Berg /* probe response/beacon for IBSS */ 377af8cdcd8SJohannes Berg struct sk_buff *presp, *skb; 37846900298SJohannes Berg 37946900298SJohannes Berg enum { 38046900298SJohannes Berg IEEE80211_IBSS_MLME_SEARCH, 38146900298SJohannes Berg IEEE80211_IBSS_MLME_JOINED, 38246900298SJohannes Berg } state; 38346900298SJohannes Berg }; 38446900298SJohannes Berg 385472dbc45SJohannes Berg struct ieee80211_if_mesh { 386472dbc45SJohannes Berg struct work_struct work; 387472dbc45SJohannes Berg struct timer_list housekeeping_timer; 388472dbc45SJohannes Berg struct timer_list mesh_path_timer; 389e304bfd3SRui Paulo struct timer_list mesh_path_root_timer; 390472dbc45SJohannes Berg struct sk_buff_head skb_queue; 391472dbc45SJohannes Berg 3925bb644a0SJohannes Berg unsigned long timers_running; 3935bb644a0SJohannes Berg 39418889231SJavier Cardona unsigned long wrkq_flags; 395472dbc45SJohannes Berg 396472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 397472dbc45SJohannes Berg size_t mesh_id_len; 398472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */ 3993491707aSRui Paulo u8 mesh_pp_id; 400472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */ 4013491707aSRui Paulo u8 mesh_pm_id; 402472dbc45SJohannes Berg /* Congestion Control Mode Identifier */ 4033491707aSRui Paulo u8 mesh_cc_id; 4049e03fdfdSJavier Cardona /* Synchronization Protocol Identifier */ 4053491707aSRui Paulo u8 mesh_sp_id; 4069e03fdfdSJavier Cardona /* Authentication Protocol Identifier */ 4073491707aSRui Paulo u8 mesh_auth_id; 408d19b3bf6SRui Paulo /* Local mesh Sequence Number */ 409d19b3bf6SRui Paulo u32 sn; 410472dbc45SJohannes Berg /* Last used PREQ ID */ 411472dbc45SJohannes Berg u32 preq_id; 412472dbc45SJohannes Berg atomic_t mpaths; 413d19b3bf6SRui Paulo /* Timestamp of last SN update */ 414d19b3bf6SRui Paulo unsigned long last_sn_update; 415d19b3bf6SRui Paulo /* Timestamp of last SN sent */ 416472dbc45SJohannes Berg unsigned long last_preq; 417472dbc45SJohannes Berg struct mesh_rmc *rmc; 418472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock; 419472dbc45SJohannes Berg struct mesh_preq_queue preq_queue; 420472dbc45SJohannes Berg int preq_queue_len; 421472dbc45SJohannes Berg struct mesh_stats mshstats; 422472dbc45SJohannes Berg struct mesh_config mshcfg; 423472dbc45SJohannes Berg u32 mesh_seqnum; 424472dbc45SJohannes Berg bool accepting_plinks; 425472dbc45SJohannes Berg }; 426902acc78SJohannes Berg 427902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 428472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 429472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0) 430902acc78SJohannes Berg #else 431472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 432902acc78SJohannes Berg do { } while (0) 433902acc78SJohannes Berg #endif 434f0706e82SJiri Benc 435213cd118SJohannes Berg /** 436213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags 437213cd118SJohannes Berg * 438213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets 439213cd118SJohannes Berg * @IEEE80211_SDATA_PROMISC: interface is promisc 440213cd118SJohannes Berg * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode 441213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between 442213cd118SJohannes Berg * associated stations and deliver multicast frames both 443213cd118SJohannes Berg * back to wireless media and to the local net stack. 444213cd118SJohannes Berg */ 445213cd118SJohannes Berg enum ieee80211_sub_if_data_flags { 446213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0), 447213cd118SJohannes Berg IEEE80211_SDATA_PROMISC = BIT(1), 4487986cf95SJohannes Berg IEEE80211_SDATA_OPERATING_GMODE = BIT(2), 4497986cf95SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), 450213cd118SJohannes Berg }; 451213cd118SJohannes Berg 452f0706e82SJiri Benc struct ieee80211_sub_if_data { 453f0706e82SJiri Benc struct list_head list; 454f0706e82SJiri Benc 455f0706e82SJiri Benc struct wireless_dev wdev; 456f0706e82SJiri Benc 45711a843b7SJohannes Berg /* keys */ 45811a843b7SJohannes Berg struct list_head key_list; 45911a843b7SJohannes Berg 460f0706e82SJiri Benc struct net_device *dev; 461f0706e82SJiri Benc struct ieee80211_local *local; 462f0706e82SJiri Benc 46313262ffdSJiri Slaby unsigned int flags; 4647e9ed188SDaniel Drake 465f0706e82SJiri Benc int drop_unencrypted; 466f0706e82SJiri Benc 46747846c9bSJohannes Berg char name[IFNAMSIZ]; 46847846c9bSJohannes Berg 469413ad50aSJohannes Berg /* 470413ad50aSJohannes Berg * keep track of whether the HT opmode (stored in 471413ad50aSJohannes Berg * vif.bss_info.ht_operation_mode) is valid. 472413ad50aSJohannes Berg */ 473413ad50aSJohannes Berg bool ht_opmode_valid; 474413ad50aSJohannes Berg 475f0706e82SJiri Benc /* Fragment table for host-based reassembly */ 476f0706e82SJiri Benc struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; 477f0706e82SJiri Benc unsigned int fragment_next; 478f0706e82SJiri Benc 479f0706e82SJiri Benc #define NUM_DEFAULT_KEYS 4 4803cfcf6acSJouni Malinen #define NUM_DEFAULT_MGMT_KEYS 2 4813cfcf6acSJouni Malinen struct ieee80211_key *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; 482f0706e82SJiri Benc struct ieee80211_key *default_key; 4833cfcf6acSJouni Malinen struct ieee80211_key *default_mgmt_key; 484f0706e82SJiri Benc 48594778280SJohannes Berg u16 sequence_number; 48694778280SJohannes Berg 4873e122be0SJohannes Berg /* 4883e122be0SJohannes Berg * AP this belongs to: self in AP mode and 4893e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 4903e122be0SJohannes Berg * all others (might be needed later in IBSS) 4913e122be0SJohannes Berg */ 4923e122be0SJohannes Berg struct ieee80211_if_ap *bss; 4933e122be0SJohannes Berg 4943e122be0SJohannes Berg int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ 4953e122be0SJohannes Berg int max_ratectrl_rateidx; /* max TX rateidx for rate control */ 496f0706e82SJiri Benc 497f0706e82SJiri Benc union { 498f0706e82SJiri Benc struct ieee80211_if_ap ap; 499f0706e82SJiri Benc struct ieee80211_if_wds wds; 500f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 50146900298SJohannes Berg struct ieee80211_if_managed mgd; 50246900298SJohannes Berg struct ieee80211_if_ibss ibss; 503472dbc45SJohannes Berg #ifdef CONFIG_MAC80211_MESH 504472dbc45SJohannes Berg struct ieee80211_if_mesh mesh; 505472dbc45SJohannes Berg #endif 5068cc9a739SMichael Wu u32 mntr_flags; 507f0706e82SJiri Benc } u; 508e9f207f0SJiri Benc 509e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 510e9f207f0SJiri Benc struct { 5117bcfaf2fSJohannes Berg struct dentry *dir; 5122b58b209SJouni Malinen struct dentry *default_key; 5133cfcf6acSJouni Malinen struct dentry *default_mgmt_key; 5147bcfaf2fSJohannes Berg } debugfs; 515e9f207f0SJiri Benc #endif 51632bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */ 51732bfd35dSJohannes Berg struct ieee80211_vif vif; 518f0706e82SJiri Benc }; 519f0706e82SJiri Benc 52032bfd35dSJohannes Berg static inline 52132bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 52232bfd35dSJohannes Berg { 52332bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif); 52432bfd35dSJohannes Berg } 52532bfd35dSJohannes Berg 526472dbc45SJohannes Berg static inline void 527472dbc45SJohannes Berg ieee80211_sdata_set_mesh_id(struct ieee80211_sub_if_data *sdata, 528472dbc45SJohannes Berg u8 mesh_id_len, u8 *mesh_id) 529472dbc45SJohannes Berg { 530472dbc45SJohannes Berg #ifdef CONFIG_MAC80211_MESH 531472dbc45SJohannes Berg struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 532472dbc45SJohannes Berg ifmsh->mesh_id_len = mesh_id_len; 533472dbc45SJohannes Berg memcpy(ifmsh->mesh_id, mesh_id, mesh_id_len); 534472dbc45SJohannes Berg #else 535472dbc45SJohannes Berg WARN_ON(1); 536472dbc45SJohannes Berg #endif 537472dbc45SJohannes Berg } 538472dbc45SJohannes Berg 539f0706e82SJiri Benc enum { 540f0706e82SJiri Benc IEEE80211_RX_MSG = 1, 541f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2, 542eadc8d9eSRon Rindjunsky IEEE80211_DELBA_MSG = 3, 543eadc8d9eSRon Rindjunsky IEEE80211_ADDBA_MSG = 4, 544f0706e82SJiri Benc }; 545f0706e82SJiri Benc 546ce7c9111SKalle Valo enum queue_stop_reason { 547ce7c9111SKalle Valo IEEE80211_QUEUE_STOP_REASON_DRIVER, 548520eb820SKalle Valo IEEE80211_QUEUE_STOP_REASON_PS, 54996f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_CSA, 55096f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_AGGREGATION, 55125420604SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SUSPEND, 5528f77f384SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 553ce7c9111SKalle Valo }; 554ce7c9111SKalle Valo 555142b9f50SHelmut Schaa /** 556142b9f50SHelmut Schaa * mac80211 scan flags - currently active scan mode 557142b9f50SHelmut Schaa * 558142b9f50SHelmut Schaa * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as 559142b9f50SHelmut Schaa * well be on the operating channel 560142b9f50SHelmut Schaa * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to 561142b9f50SHelmut Schaa * determine if we are on the operating channel or not 562142b9f50SHelmut Schaa * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning, 563142b9f50SHelmut Schaa * gets only set in conjunction with SCAN_SW_SCANNING 564142b9f50SHelmut Schaa */ 565fbe9c429SHelmut Schaa enum { 566fbe9c429SHelmut Schaa SCAN_SW_SCANNING, 567142b9f50SHelmut Schaa SCAN_HW_SCANNING, 568142b9f50SHelmut Schaa SCAN_OFF_CHANNEL, 569142b9f50SHelmut Schaa }; 570142b9f50SHelmut Schaa 571142b9f50SHelmut Schaa /** 572142b9f50SHelmut Schaa * enum mac80211_scan_state - scan state machine states 573142b9f50SHelmut Schaa * 574142b9f50SHelmut Schaa * @SCAN_DECISION: Main entry point to the scan state machine, this state 575142b9f50SHelmut Schaa * determines if we should keep on scanning or switch back to the 576142b9f50SHelmut Schaa * operating channel 577142b9f50SHelmut Schaa * @SCAN_SET_CHANNEL: Set the next channel to be scanned 578142b9f50SHelmut Schaa * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses 579142b9f50SHelmut Schaa * @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP 580142b9f50SHelmut Schaa * about us leaving the channel and stop all associated STA interfaces 581142b9f50SHelmut Schaa * @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the 582142b9f50SHelmut Schaa * AP about us being back and restart all associated STA interfaces 583142b9f50SHelmut Schaa */ 584142b9f50SHelmut Schaa enum mac80211_scan_state { 585142b9f50SHelmut Schaa SCAN_DECISION, 586142b9f50SHelmut Schaa SCAN_SET_CHANNEL, 587142b9f50SHelmut Schaa SCAN_SEND_PROBE, 588142b9f50SHelmut Schaa SCAN_LEAVE_OPER_CHANNEL, 589142b9f50SHelmut Schaa SCAN_ENTER_OPER_CHANNEL, 590fbe9c429SHelmut Schaa }; 591fbe9c429SHelmut Schaa 592f0706e82SJiri Benc struct ieee80211_local { 593f0706e82SJiri Benc /* embed the driver visible part. 594f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 595f0706e82SJiri Benc * it first anyway so they become a no-op */ 596f0706e82SJiri Benc struct ieee80211_hw hw; 597f0706e82SJiri Benc 598f0706e82SJiri Benc const struct ieee80211_ops *ops; 599f0706e82SJiri Benc 60042935ecaSLuis R. Rodriguez /* 601af6b6374SJohannes Berg * work stuff, potentially off-channel (in the future) 602af6b6374SJohannes Berg */ 603af6b6374SJohannes Berg struct mutex work_mtx; 604af6b6374SJohannes Berg struct list_head work_list; 605af6b6374SJohannes Berg struct timer_list work_timer; 606af6b6374SJohannes Berg struct work_struct work_work; 607af6b6374SJohannes Berg struct sk_buff_head work_skb_queue; 608af6b6374SJohannes Berg 609af6b6374SJohannes Berg /* 61042935ecaSLuis R. Rodriguez * private workqueue to mac80211. mac80211 makes this accessible 61142935ecaSLuis R. Rodriguez * via ieee80211_queue_work() 61242935ecaSLuis R. Rodriguez */ 61342935ecaSLuis R. Rodriguez struct workqueue_struct *workqueue; 61442935ecaSLuis R. Rodriguez 615e4e72fb4SJohannes Berg unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; 61696f5e66eSJohannes Berg /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ 617ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock; 61896f5e66eSJohannes Berg 619f0706e82SJiri Benc int open_count; 6203d30d949SMichael Wu int monitors, cooked_mntrs; 6218cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 622e3b90ca2SIgor Perminov int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll; 6234150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 6243b8d81e0SJohannes Berg 6253b8d81e0SJohannes Berg /* protects the aggregated multicast list and filter calls */ 6263b8d81e0SJohannes Berg spinlock_t filter_lock; 6273b8d81e0SJohannes Berg 6283ac64beeSJohannes Berg /* used for uploading changed mc list */ 6293ac64beeSJohannes Berg struct work_struct reconfig_filter; 6303ac64beeSJohannes Berg 6310f78231bSJohannes Berg /* used to reconfigure hardware SM PS */ 6320f78231bSJohannes Berg struct work_struct recalc_smps; 6330f78231bSJohannes Berg 6343b8d81e0SJohannes Berg /* aggregated multicast list */ 6353b8d81e0SJohannes Berg struct dev_addr_list *mc_list; 6363b8d81e0SJohannes Berg int mc_count; 6373b8d81e0SJohannes Berg 638d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 6395bb644a0SJohannes Berg 6405bb644a0SJohannes Berg /* 6415bb644a0SJohannes Berg * suspended is true if we finished all the suspend _and_ we have 6425bb644a0SJohannes Berg * not yet come up from resume. This is to be used by mac80211 6435bb644a0SJohannes Berg * to ensure driver sanity during suspend and mac80211's own 6445bb644a0SJohannes Berg * sanity. It can eventually be used for WoW as well. 6455bb644a0SJohannes Berg */ 6465bb644a0SJohannes Berg bool suspended; 6475bb644a0SJohannes Berg 6485bb644a0SJohannes Berg /* 649ceb99fe0SJohannes Berg * Resuming is true while suspended, but when we're reprogramming the 650ceb99fe0SJohannes Berg * hardware -- at that time it's allowed to use ieee80211_queue_work() 651ceb99fe0SJohannes Berg * again even though some other parts of the stack are still suspended 652ceb99fe0SJohannes Berg * and we still drop received frames to avoid waking the stack. 653ceb99fe0SJohannes Berg */ 654ceb99fe0SJohannes Berg bool resuming; 655ceb99fe0SJohannes Berg 656ceb99fe0SJohannes Berg /* 6575bb644a0SJohannes Berg * quiescing is true during the suspend process _only_ to 6585bb644a0SJohannes Berg * ease timer cancelling etc. 6595bb644a0SJohannes Berg */ 6605bb644a0SJohannes Berg bool quiescing; 6615bb644a0SJohannes Berg 662ea77f12fSJohannes Berg /* device is started */ 663ea77f12fSJohannes Berg bool started; 664ea77f12fSJohannes Berg 665b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 666f0706e82SJiri Benc 667f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 668f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 669f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 670f0706e82SJiri Benc * queues increases over the limit. */ 671f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 672f0706e82SJiri Benc struct tasklet_struct tasklet; 673f0706e82SJiri Benc struct sk_buff_head skb_queue; 674f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 675f0706e82SJiri Benc 676d0709a65SJohannes Berg /* Station data */ 677d0709a65SJohannes Berg /* 678d0709a65SJohannes Berg * The lock only protects the list, hash, timer and counter 679d0709a65SJohannes Berg * against manipulation, reads are done in RCU. Additionally, 680b16bd15cSJohannes Berg * the lock protects each BSS's TIM bitmap. 681d0709a65SJohannes Berg */ 682d0709a65SJohannes Berg spinlock_t sta_lock; 683d0709a65SJohannes Berg unsigned long num_sta; 684f0706e82SJiri Benc struct list_head sta_list; 685f0706e82SJiri Benc struct sta_info *sta_hash[STA_HASH_SIZE]; 686f0706e82SJiri Benc struct timer_list sta_cleanup; 687f5ea9120SJohannes Berg int sta_generation; 688f0706e82SJiri Benc 6892a577d98SJohannes Berg struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; 690f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 691f0706e82SJiri Benc 692cd8ffc80SJohannes Berg /* 693cd8ffc80SJohannes Berg * This lock is used to prevent concurrent A-MPDU 694cd8ffc80SJohannes Berg * session start/stop processing, this thus also 695cd8ffc80SJohannes Berg * synchronises the ->ampdu_action() callback to 696cd8ffc80SJohannes Berg * drivers and limits it to one at a time. 697cd8ffc80SJohannes Berg */ 698cd8ffc80SJohannes Berg spinlock_t ampdu_lock; 699cd8ffc80SJohannes Berg 700f0706e82SJiri Benc /* number of interfaces with corresponding IFF_ flags */ 70153918994SJohannes Berg atomic_t iff_allmultis, iff_promiscs; 702f0706e82SJiri Benc 703f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 704f0706e82SJiri Benc 705f0706e82SJiri Benc struct crypto_blkcipher *wep_tx_tfm; 706f0706e82SJiri Benc struct crypto_blkcipher *wep_rx_tfm; 707f0706e82SJiri Benc u32 wep_iv; 708f0706e82SJiri Benc 709c771c9d8SJohannes Berg /* see iface.c */ 71079010420SJohannes Berg struct list_head interfaces; 711c771c9d8SJohannes Berg struct mutex iflist_mtx; 71279010420SJohannes Berg 713b16bd15cSJohannes Berg /* 714b16bd15cSJohannes Berg * Key lock, protects sdata's key_list and sta_info's 715b16bd15cSJohannes Berg * key pointers (write access, they're RCU.) 716b16bd15cSJohannes Berg */ 717b16bd15cSJohannes Berg spinlock_t key_lock; 718b16bd15cSJohannes Berg 719b16bd15cSJohannes Berg 720c2b13452SJohannes Berg /* Scanning and BSS list */ 721f3b85252SJohannes Berg struct mutex scan_mtx; 722fbe9c429SHelmut Schaa unsigned long scanning; 7232a519311SJohannes Berg struct cfg80211_ssid scan_ssid; 7245ba63533SJohannes Berg struct cfg80211_scan_request *int_scan_req; 7254d36ec58SJohannes Berg struct cfg80211_scan_request *scan_req, *hw_scan_req; 7262a519311SJohannes Berg struct ieee80211_channel *scan_channel; 7274d36ec58SJohannes Berg enum ieee80211_band hw_scan_band; 728f0706e82SJiri Benc int scan_channel_idx; 729de95a54bSJohannes Berg int scan_ies_len; 7308318d78aSJohannes Berg 731977923b0SHelmut Schaa enum mac80211_scan_state next_scan_state; 732f0706e82SJiri Benc struct delayed_work scan_work; 733491775a5SJohannes Berg struct ieee80211_sub_if_data *scan_sdata; 734094d05dcSSujith enum nl80211_channel_type oper_channel_type; 7352a519311SJohannes Berg struct ieee80211_channel *oper_channel, *csa_channel; 736f0706e82SJiri Benc 737b8bc4b0aSJohannes Berg /* Temporary remain-on-channel for off-channel operations */ 738b8bc4b0aSJohannes Berg struct ieee80211_channel *tmp_channel; 739b8bc4b0aSJohannes Berg enum nl80211_channel_type tmp_channel_type; 740b8bc4b0aSJohannes Berg 741f0706e82SJiri Benc /* SNMP counters */ 742f0706e82SJiri Benc /* dot11CountersTable */ 743f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 744f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 745f0706e82SJiri Benc u32 dot11FailedCount; 746f0706e82SJiri Benc u32 dot11RetryCount; 747f0706e82SJiri Benc u32 dot11MultipleRetryCount; 748f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 749f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 750f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 751f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 752f0706e82SJiri Benc 753f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS 754f0706e82SJiri Benc int tx_led_counter, rx_led_counter; 755cdcb006fSIvo van Doorn struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; 756cdcb006fSIvo van Doorn char tx_led_name[32], rx_led_name[32], 757cdcb006fSIvo van Doorn assoc_led_name[32], radio_led_name[32]; 758f0706e82SJiri Benc #endif 759f0706e82SJiri Benc 760e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 761e9f207f0SJiri Benc struct work_struct sta_debugfs_add; 762e9f207f0SJiri Benc #endif 763e9f207f0SJiri Benc 764f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 765f0706e82SJiri Benc /* TX/RX handler statistics */ 766f0706e82SJiri Benc unsigned int tx_handlers_drop; 767f0706e82SJiri Benc unsigned int tx_handlers_queued; 768f0706e82SJiri Benc unsigned int tx_handlers_drop_unencrypted; 769f0706e82SJiri Benc unsigned int tx_handlers_drop_fragment; 770f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 771f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 772f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 773f0706e82SJiri Benc unsigned int rx_handlers_drop; 774f0706e82SJiri Benc unsigned int rx_handlers_queued; 775f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 776f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 777f0706e82SJiri Benc unsigned int rx_handlers_drop_short; 778f0706e82SJiri Benc unsigned int rx_handlers_drop_passive_scan; 779f0706e82SJiri Benc unsigned int tx_expand_skb_head; 780f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 781f0706e82SJiri Benc unsigned int rx_expand_skb_head; 782f0706e82SJiri Benc unsigned int rx_expand_skb_head2; 783f0706e82SJiri Benc unsigned int rx_handlers_fragments; 784f0706e82SJiri Benc unsigned int tx_status_drop; 785f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 786f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 787f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 788f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 789f0706e82SJiri Benc 790f0706e82SJiri Benc 791f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 792f0706e82SJiri Benc * multicast packets for power saving stations 793f0706e82SJiri Benc */ 794f0706e82SJiri Benc int wifi_wme_noack_test; 795f0706e82SJiri Benc unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ 796520eb820SKalle Valo 797572e0012SKalle Valo bool pspolling; 798b203ffc3SJouni Malinen bool offchannel_ps_enabled; 799965bedadSJohannes Berg /* 800965bedadSJohannes Berg * PS can only be enabled when we have exactly one managed 801965bedadSJohannes Berg * interface (and monitors) in PS, this then points there. 802965bedadSJohannes Berg */ 803965bedadSJohannes Berg struct ieee80211_sub_if_data *ps_sdata; 804520eb820SKalle Valo struct work_struct dynamic_ps_enable_work; 805520eb820SKalle Valo struct work_struct dynamic_ps_disable_work; 806520eb820SKalle Valo struct timer_list dynamic_ps_timer; 80710f644a4SJohannes Berg struct notifier_block network_latency_notifier; 808f0706e82SJiri Benc 8092bf30fabSJohannes Berg int user_power_level; /* in dBm */ 810a8302de9SVasanthakumar Thiagarajan int power_constr_level; /* in dBm */ 8112bf30fabSJohannes Berg 8120f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode; 8130f78231bSJohannes Berg 814f2753ddbSJohannes Berg struct work_struct restart_work; 815f2753ddbSJohannes Berg 816e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 817e9f207f0SJiri Benc struct local_debugfsdentries { 8184b7679a5SJohannes Berg struct dentry *rcdir; 819e9f207f0SJiri Benc struct dentry *stations; 820e9f207f0SJiri Benc struct dentry *keys; 821e9f207f0SJiri Benc } debugfs; 822e9f207f0SJiri Benc #endif 823f0706e82SJiri Benc }; 824f0706e82SJiri Benc 8253e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 8263e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) 8273e122be0SJohannes Berg { 8283e122be0SJohannes Berg return netdev_priv(dev); 8293e122be0SJohannes Berg } 8303e122be0SJohannes Berg 831c951ad35SJohannes Berg /* this struct represents 802.11n's RA/TID combination along with our vif */ 832eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid { 833c951ad35SJohannes Berg struct ieee80211_vif *vif; 834eadc8d9eSRon Rindjunsky u8 ra[ETH_ALEN]; 835eadc8d9eSRon Rindjunsky u16 tid; 836eadc8d9eSRon Rindjunsky }; 837eadc8d9eSRon Rindjunsky 838ee385855SLuis Carlos Cobo /* Parsed Information Elements */ 839ee385855SLuis Carlos Cobo struct ieee802_11_elems { 84043ac2ca3SJouni Malinen u8 *ie_start; 84143ac2ca3SJouni Malinen size_t total_len; 84243ac2ca3SJouni Malinen 843ee385855SLuis Carlos Cobo /* pointers to IEs */ 844ee385855SLuis Carlos Cobo u8 *ssid; 845ee385855SLuis Carlos Cobo u8 *supp_rates; 846ee385855SLuis Carlos Cobo u8 *fh_params; 847ee385855SLuis Carlos Cobo u8 *ds_params; 848ee385855SLuis Carlos Cobo u8 *cf_params; 849e7ec86f5SJohannes Berg struct ieee80211_tim_ie *tim; 850ee385855SLuis Carlos Cobo u8 *ibss_params; 851ee385855SLuis Carlos Cobo u8 *challenge; 852ee385855SLuis Carlos Cobo u8 *wpa; 853ee385855SLuis Carlos Cobo u8 *rsn; 854ee385855SLuis Carlos Cobo u8 *erp_info; 855ee385855SLuis Carlos Cobo u8 *ext_supp_rates; 856ee385855SLuis Carlos Cobo u8 *wmm_info; 857ee385855SLuis Carlos Cobo u8 *wmm_param; 85809914813SJohannes Berg struct ieee80211_ht_cap *ht_cap_elem; 859d9fe60deSJohannes Berg struct ieee80211_ht_info *ht_info_elem; 860136cfa28SRui Paulo struct ieee80211_meshconf_ie *mesh_config; 861ee385855SLuis Carlos Cobo u8 *mesh_id; 862ee385855SLuis Carlos Cobo u8 *peer_link; 863ee385855SLuis Carlos Cobo u8 *preq; 864ee385855SLuis Carlos Cobo u8 *prep; 865ee385855SLuis Carlos Cobo u8 *perr; 86690a5e169SRui Paulo struct ieee80211_rann_ie *rann; 867f2df3859SAssaf Krauss u8 *ch_switch_elem; 868f2df3859SAssaf Krauss u8 *country_elem; 869f2df3859SAssaf Krauss u8 *pwr_constr_elem; 870f2df3859SAssaf Krauss u8 *quiet_elem; /* first quite element */ 871f797eb7eSJouni Malinen u8 *timeout_int; 872ee385855SLuis Carlos Cobo 873ee385855SLuis Carlos Cobo /* length of them, respectively */ 874ee385855SLuis Carlos Cobo u8 ssid_len; 875ee385855SLuis Carlos Cobo u8 supp_rates_len; 876ee385855SLuis Carlos Cobo u8 fh_params_len; 877ee385855SLuis Carlos Cobo u8 ds_params_len; 878ee385855SLuis Carlos Cobo u8 cf_params_len; 879ee385855SLuis Carlos Cobo u8 tim_len; 880ee385855SLuis Carlos Cobo u8 ibss_params_len; 881ee385855SLuis Carlos Cobo u8 challenge_len; 882ee385855SLuis Carlos Cobo u8 wpa_len; 883ee385855SLuis Carlos Cobo u8 rsn_len; 884ee385855SLuis Carlos Cobo u8 erp_info_len; 885ee385855SLuis Carlos Cobo u8 ext_supp_rates_len; 886ee385855SLuis Carlos Cobo u8 wmm_info_len; 887ee385855SLuis Carlos Cobo u8 wmm_param_len; 888ee385855SLuis Carlos Cobo u8 mesh_id_len; 889ee385855SLuis Carlos Cobo u8 peer_link_len; 890ee385855SLuis Carlos Cobo u8 preq_len; 891ee385855SLuis Carlos Cobo u8 prep_len; 892ee385855SLuis Carlos Cobo u8 perr_len; 893f2df3859SAssaf Krauss u8 ch_switch_elem_len; 894f2df3859SAssaf Krauss u8 country_elem_len; 895f2df3859SAssaf Krauss u8 pwr_constr_elem_len; 896f2df3859SAssaf Krauss u8 quiet_elem_len; 897f2df3859SAssaf Krauss u8 num_of_quiet_elem; /* can be more the one */ 898f797eb7eSJouni Malinen u8 timeout_int_len; 899ee385855SLuis Carlos Cobo }; 900ee385855SLuis Carlos Cobo 901f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 902f0706e82SJiri Benc struct ieee80211_hw *hw) 903f0706e82SJiri Benc { 904f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 905f0706e82SJiri Benc } 906f0706e82SJiri Benc 907f0706e82SJiri Benc static inline struct ieee80211_hw *local_to_hw( 908f0706e82SJiri Benc struct ieee80211_local *local) 909f0706e82SJiri Benc { 910f0706e82SJiri Benc return &local->hw; 911f0706e82SJiri Benc } 912f0706e82SJiri Benc 913f0706e82SJiri Benc 914571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) 915571ecf67SJohannes Berg { 916571ecf67SJohannes Berg return compare_ether_addr(raddr, addr) == 0 || 917571ecf67SJohannes Berg is_broadcast_ether_addr(raddr); 918571ecf67SJohannes Berg } 919571ecf67SJohannes Berg 920571ecf67SJohannes Berg 921e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 9225cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 9239c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 9249c6bd790SJohannes Berg u32 changed); 9250d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local); 92646900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 927f0706e82SJiri Benc 928f38fd12fSJohannes Berg extern bool ieee80211_disable_40mhz_24ghz; 929f38fd12fSJohannes Berg 93046900298SJohannes Berg /* STA code */ 9319c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 93277fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, 93377fdaa12SJohannes Berg struct cfg80211_auth_request *req); 93477fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 93577fdaa12SJohannes Berg struct cfg80211_assoc_request *req); 93677fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, 937667503ddSJohannes Berg struct cfg80211_deauth_request *req, 938667503ddSJohannes Berg void *cookie); 93977fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 940667503ddSJohannes Berg struct cfg80211_disassoc_request *req, 941667503ddSJohannes Berg void *cookie); 94246900298SJohannes Berg ieee80211_rx_result ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, 943f1d58c25SJohannes Berg struct sk_buff *skb); 944572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local, 945572e0012SKalle Valo struct ieee80211_sub_if_data *sdata); 94610f644a4SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); 94710f644a4SJohannes Berg int ieee80211_max_network_latency(struct notifier_block *nb, 94810f644a4SJohannes Berg unsigned long data, void *dummy); 949cc32abd4SJohannes Berg void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, 950cc32abd4SJohannes Berg struct ieee80211_channel_sw_ie *sw_elem, 951cc32abd4SJohannes Berg struct ieee80211_bss *bss); 9525bb644a0SJohannes Berg void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata); 9535bb644a0SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); 9549c6bd790SJohannes Berg 95546900298SJohannes Berg /* IBSS code */ 95646900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); 95746900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); 95846900298SJohannes Berg ieee80211_rx_result 959f1d58c25SJohannes Berg ieee80211_ibss_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 96046900298SJohannes Berg struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, 96146900298SJohannes Berg u8 *bssid, u8 *addr, u32 supp_rates); 962af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 963af8cdcd8SJohannes Berg struct cfg80211_ibss_params *params); 964af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); 9655bb644a0SJohannes Berg void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata); 9665bb644a0SJohannes Berg void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata); 96746900298SJohannes Berg 9689c6bd790SJohannes Berg /* scan/BSS handling */ 96946900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work); 970f3b85252SJohannes Berg int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, 971f3b85252SJohannes Berg const u8 *ssid, u8 ssid_len); 972c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 9732a519311SJohannes Berg struct cfg80211_scan_request *req); 9745bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local); 975c2b13452SJohannes Berg ieee80211_rx_result 976f1d58c25SJohannes Berg ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 9779c6bd790SJohannes Berg 9780a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 979c2b13452SJohannes Berg struct ieee80211_bss * 98098c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local, 98198c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status, 98298c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt, 98398c8fccfSJohannes Berg size_t len, 98498c8fccfSJohannes Berg struct ieee802_11_elems *elems, 9852a519311SJohannes Berg struct ieee80211_channel *channel, 9862a519311SJohannes Berg bool beacon); 987c2b13452SJohannes Berg struct ieee80211_bss * 9885484e237SJohannes Berg ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, 9895484e237SJohannes Berg u8 *ssid, u8 ssid_len); 99098c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local, 991c2b13452SJohannes Berg struct ieee80211_bss *bss); 992ee385855SLuis Carlos Cobo 993b203ffc3SJouni Malinen /* off-channel helpers */ 994b203ffc3SJouni Malinen void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local); 995b203ffc3SJouni Malinen void ieee80211_offchannel_stop_station(struct ieee80211_local *local); 996b203ffc3SJouni Malinen void ieee80211_offchannel_return(struct ieee80211_local *local, 997b203ffc3SJouni Malinen bool enable_beaconing); 998b203ffc3SJouni Malinen 9993e122be0SJohannes Berg /* interface handling */ 100047846c9bSJohannes Berg int ieee80211_iface_init(void); 100147846c9bSJohannes Berg void ieee80211_iface_exit(void); 10023e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 100305c914feSJohannes Berg struct net_device **new_dev, enum nl80211_iftype type, 1004ee385855SLuis Carlos Cobo struct vif_params *params); 1005f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 100605c914feSJohannes Berg enum nl80211_iftype type); 1007f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 100875636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 10095cff20e6SJohannes Berg u32 __ieee80211_recalc_idle(struct ieee80211_local *local); 10105cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local); 1011f0706e82SJiri Benc 10129607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) 10139607e6b6SJohannes Berg { 10149607e6b6SJohannes Berg return netif_running(sdata->dev); 10159607e6b6SJohannes Berg } 10169607e6b6SJohannes Berg 1017e2ebc74dSJohannes Berg /* tx handling */ 1018e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 1019e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data); 1020d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1021d0cf9c0dSStephen Hemminger struct net_device *dev); 1022d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, 1023d0cf9c0dSStephen Hemminger struct net_device *dev); 1024e2ebc74dSJohannes Berg 1025fe7a5d5cSJohannes Berg /* 1026fe7a5d5cSJohannes Berg * radiotap header for status frames 1027fe7a5d5cSJohannes Berg */ 1028fe7a5d5cSJohannes Berg struct ieee80211_tx_status_rtap_hdr { 1029fe7a5d5cSJohannes Berg struct ieee80211_radiotap_header hdr; 1030fe7a5d5cSJohannes Berg u8 rate; 1031fe7a5d5cSJohannes Berg u8 padding_for_rate; 1032fe7a5d5cSJohannes Berg __le16 tx_flags; 1033fe7a5d5cSJohannes Berg u8 data_retries; 1034fe7a5d5cSJohannes Berg } __attribute__ ((packed)); 1035fe7a5d5cSJohannes Berg 1036fe7a5d5cSJohannes Berg 1037de1ede7aSJohannes Berg /* HT */ 1038ae5eb026SJohannes Berg void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, 1039ae5eb026SJohannes Berg struct ieee80211_ht_cap *ht_cap_ie, 1040d9fe60deSJohannes Berg struct ieee80211_sta_ht_cap *ht_cap); 1041de1ede7aSJohannes Berg void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); 1042b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, 1043b8695a8fSJohannes Berg const u8 *da, u16 tid, 1044b8695a8fSJohannes Berg u16 initiator, u16 reason_code); 10450f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, 10460f78231bSJohannes Berg enum ieee80211_smps_mode smps, const u8 *da, 10470f78231bSJohannes Berg const u8 *bssid); 1048de1ede7aSJohannes Berg 1049de1ede7aSJohannes Berg void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, 1050de1ede7aSJohannes Berg u16 tid, u16 initiator, u16 reason); 1051849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 1052849b7967SJohannes Berg u16 initiator, u16 reason); 10532dace10eSJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta); 1054de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, 1055de1ede7aSJohannes Berg struct sta_info *sta, 1056de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len); 1057de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local, 1058de1ede7aSJohannes Berg struct sta_info *sta, 1059de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1060de1ede7aSJohannes Berg size_t len); 1061de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local, 1062de1ede7aSJohannes Berg struct sta_info *sta, 1063de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1064de1ede7aSJohannes Berg size_t len); 1065de1ede7aSJohannes Berg 1066849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1067849b7967SJohannes Berg enum ieee80211_back_parties initiator); 1068827d42c9SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 1069827d42c9SJohannes Berg enum ieee80211_back_parties initiator); 1070849b7967SJohannes Berg 107139192c0bSJohannes Berg /* Spectrum management */ 107239192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 107339192c0bSJohannes Berg struct ieee80211_mgmt *mgmt, 107439192c0bSJohannes Berg size_t len); 107539192c0bSJohannes Berg 1076f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */ 1077f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local); 107884f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local); 1079f2753ddbSJohannes Berg 1080827b1fb4SJohannes Berg #ifdef CONFIG_PM 1081665af4fcSBob Copeland int __ieee80211_suspend(struct ieee80211_hw *hw); 1082f2753ddbSJohannes Berg 1083f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 1084f2753ddbSJohannes Berg { 1085f2753ddbSJohannes Berg return ieee80211_reconfig(hw_to_local(hw)); 1086f2753ddbSJohannes Berg } 1087827b1fb4SJohannes Berg #else 1088827b1fb4SJohannes Berg static inline int __ieee80211_suspend(struct ieee80211_hw *hw) 1089827b1fb4SJohannes Berg { 1090827b1fb4SJohannes Berg return 0; 1091827b1fb4SJohannes Berg } 1092f2753ddbSJohannes Berg 1093827b1fb4SJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 1094827b1fb4SJohannes Berg { 1095827b1fb4SJohannes Berg return 0; 1096827b1fb4SJohannes Berg } 1097827b1fb4SJohannes Berg #endif 1098665af4fcSBob Copeland 1099c2d1560aSJohannes Berg /* utility functions/constants */ 1100c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */ 110171364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 110205c914feSJohannes Berg enum nl80211_iftype type); 1103c2d1560aSJohannes Berg int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, 1104c2d1560aSJohannes Berg int rate, int erp, int short_preamble); 1105f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 1106e6d6e342SJohannes Berg struct ieee80211_hdr *hdr, const u8 *tsc, 1107e6d6e342SJohannes Berg gfp_t gfp); 11085825fe10SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata); 110962ae67beSJohannes Berg void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 11109c6bd790SJohannes Berg void ieee802_11_parse_elems(u8 *start, size_t len, 11119c6bd790SJohannes Berg struct ieee802_11_elems *elems); 1112d91f36dbSJohannes Berg u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, 1113d91f36dbSJohannes Berg struct ieee802_11_elems *elems, 1114d91f36dbSJohannes Berg u64 filter, u32 crc); 1115881d948cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_local *local, 111696dd22acSJohannes Berg enum ieee80211_band band); 1117f0706e82SJiri Benc 1118520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 1119520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 1120520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data); 1121a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local, 1122a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata, 1123a97b77b9SVivek Natarajan int powersave); 11243cf335d5SKalle Valo void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, 11253cf335d5SKalle Valo struct ieee80211_hdr *hdr); 112604de8381SKalle Valo void ieee80211_beacon_loss_work(struct work_struct *work); 1127520eb820SKalle Valo 1128ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 1129ce7c9111SKalle Valo enum queue_stop_reason reason); 1130ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 1131ce7c9111SKalle Valo enum queue_stop_reason reason); 113296f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 113396f5e66eSJohannes Berg enum queue_stop_reason reason); 113496f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, 113596f5e66eSJohannes Berg enum queue_stop_reason reason); 11368f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local, 11378f77f384SJohannes Berg struct sk_buff *skb); 11388f77f384SJohannes Berg int ieee80211_add_pending_skbs(struct ieee80211_local *local, 11398f77f384SJohannes Berg struct sk_buff_head *skbs); 1140ce7c9111SKalle Valo 114146900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 114246900298SJohannes Berg u16 transaction, u16 auth_alg, 1143fffd0934SJohannes Berg u8 *extra, size_t extra_len, const u8 *bssid, 1144fffd0934SJohannes Berg const u8 *key, u8 key_len, u8 key_idx); 1145de95a54bSJohannes Berg int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, 11464d36ec58SJohannes Berg const u8 *ie, size_t ie_len, 11474d36ec58SJohannes Berg enum ieee80211_band band); 114846900298SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, 1149de95a54bSJohannes Berg const u8 *ssid, size_t ssid_len, 1150de95a54bSJohannes Berg const u8 *ie, size_t ie_len); 115146900298SJohannes Berg 115246900298SJohannes Berg void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, 115346900298SJohannes Berg const size_t supp_rates_len, 115446900298SJohannes Berg const u8 *supp_rates); 115546900298SJohannes Berg u32 ieee80211_sta_get_rates(struct ieee80211_local *local, 115646900298SJohannes Berg struct ieee802_11_elems *elems, 115746900298SJohannes Berg enum ieee80211_band band); 11580f78231bSJohannes Berg int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, 11590f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode); 11600f78231bSJohannes Berg void ieee80211_recalc_smps(struct ieee80211_local *local, 11610f78231bSJohannes Berg struct ieee80211_sub_if_data *forsdata); 116246900298SJohannes Berg 11638e664fb3SJohannes Berg size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 11648e664fb3SJohannes Berg const u8 *ids, int n_ids, size_t offset); 11658e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset); 11668e664fb3SJohannes Berg 1167af6b6374SJohannes Berg /* internal work items */ 1168af6b6374SJohannes Berg void ieee80211_work_init(struct ieee80211_local *local); 1169af6b6374SJohannes Berg void ieee80211_add_work(struct ieee80211_work *wk); 1170af6b6374SJohannes Berg void free_work(struct ieee80211_work *wk); 1171af6b6374SJohannes Berg void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata); 1172af6b6374SJohannes Berg ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata, 1173af6b6374SJohannes Berg struct sk_buff *skb); 1174b8bc4b0aSJohannes Berg int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata, 1175b8bc4b0aSJohannes Berg struct ieee80211_channel *chan, 1176b8bc4b0aSJohannes Berg enum nl80211_channel_type channel_type, 1177b8bc4b0aSJohannes Berg unsigned int duration, u64 *cookie); 1178b8bc4b0aSJohannes Berg int ieee80211_wk_cancel_remain_on_channel( 1179b8bc4b0aSJohannes Berg struct ieee80211_sub_if_data *sdata, u64 cookie); 1180af6b6374SJohannes Berg 1181f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 1182d9e8a70fSJohannes Berg #define debug_noinline noinline 1183d9e8a70fSJohannes Berg #else 1184d9e8a70fSJohannes Berg #define debug_noinline 1185d9e8a70fSJohannes Berg #endif 1186d9e8a70fSJohannes Berg 1187f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 1188