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> 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 5320ad19d0SJohannes Berg #define TU_TO_EXP_TIME(x) (jiffies + usecs_to_jiffies((x) * 1024)) 5420ad19d0SJohannes Berg 55ab13315aSKalle Valo #define IEEE80211_DEFAULT_UAPSD_QUEUES \ 56ab13315aSKalle Valo (IEEE80211_WMM_IE_STA_QOSINFO_AC_BK | \ 57ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_AC_BE | \ 58ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_AC_VI | \ 59ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_AC_VO) 60ab13315aSKalle Valo 61ab13315aSKalle Valo #define IEEE80211_DEFAULT_MAX_SP_LEN \ 62ab13315aSKalle Valo IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 63ab13315aSKalle Valo 64f0706e82SJiri Benc struct ieee80211_fragment_entry { 65f0706e82SJiri Benc unsigned long first_frag_time; 66f0706e82SJiri Benc unsigned int seq; 67f0706e82SJiri Benc unsigned int rx_queue; 68f0706e82SJiri Benc unsigned int last_frag; 69f0706e82SJiri Benc unsigned int extra_len; 70f0706e82SJiri Benc struct sk_buff_head skb_list; 71f0706e82SJiri Benc int ccmp; /* Whether fragments were encrypted with CCMP */ 72f0706e82SJiri Benc u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ 73f0706e82SJiri Benc }; 74f0706e82SJiri Benc 75f0706e82SJiri Benc 76c2b13452SJohannes Berg struct ieee80211_bss { 7700d3f14cSJohannes Berg /* don't want to look up all the time */ 78056cdd59SJohannes Berg size_t ssid_len; 79f0706e82SJiri Benc u8 ssid[IEEE80211_MAX_SSID_LEN]; 8000d3f14cSJohannes Berg 8198f7dfd8SEmmanuel Grumbach u8 dtim_period; 8200d3f14cSJohannes Berg 8343ac2ca3SJouni Malinen bool wmm_used; 84ab13315aSKalle Valo bool uapsd_supported; 8500d3f14cSJohannes Berg 8600d3f14cSJohannes Berg unsigned long last_probe_resp; 8700d3f14cSJohannes Berg 88ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH 89ee385855SLuis Carlos Cobo u8 *mesh_id; 90ee385855SLuis Carlos Cobo size_t mesh_id_len; 9124736701SJohn W. Linville u8 *mesh_cfg; 92902acc78SJohannes Berg #endif 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; 97f0706e82SJiri Benc 9800d3f14cSJohannes Berg /* 9900d3f14cSJohannes Berg * During assocation, we save an ERP value from a probe response so 1005628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 1015628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 10200d3f14cSJohannes Berg * otherwise, you probably don't want to use them. 10300d3f14cSJohannes Berg */ 10400d3f14cSJohannes Berg bool has_erp_value; 1055628221cSDaniel Drake u8 erp_value; 106f0706e82SJiri Benc }; 107f0706e82SJiri Benc 108c2b13452SJohannes Berg static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss) 109902acc78SJohannes Berg { 110902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 111902acc78SJohannes Berg return bss->mesh_cfg; 112902acc78SJohannes Berg #endif 113902acc78SJohannes Berg return NULL; 114902acc78SJohannes Berg } 115902acc78SJohannes Berg 116c2b13452SJohannes Berg static inline u8 *bss_mesh_id(struct ieee80211_bss *bss) 117902acc78SJohannes Berg { 118902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 119902acc78SJohannes Berg return bss->mesh_id; 120902acc78SJohannes Berg #endif 121902acc78SJohannes Berg return NULL; 122902acc78SJohannes Berg } 123902acc78SJohannes Berg 124c2b13452SJohannes Berg static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss) 125902acc78SJohannes Berg { 126902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 127902acc78SJohannes Berg return bss->mesh_id_len; 128902acc78SJohannes Berg #endif 129902acc78SJohannes Berg return 0; 130902acc78SJohannes Berg } 131902acc78SJohannes Berg 132f0706e82SJiri Benc 1339ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result; 1349ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1359ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1369ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1379ae54c84SJohannes Berg 1385cf121c3SJohannes Berg #define IEEE80211_TX_FRAGMENTED BIT(0) 1395cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1405cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1419ae54c84SJohannes Berg 1425cf121c3SJohannes Berg struct ieee80211_tx_data { 143f0706e82SJiri Benc struct sk_buff *skb; 144f0706e82SJiri Benc struct ieee80211_local *local; 145f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 146f0706e82SJiri Benc struct sta_info *sta; 147f0706e82SJiri Benc struct ieee80211_key *key; 1485cf121c3SJohannes Berg 1498318d78aSJohannes Berg struct ieee80211_channel *channel; 150f0706e82SJiri Benc 151a4b7d7bdSHarvey Harrison u16 ethertype; 152056cdd59SJohannes Berg unsigned int flags; 1535cf121c3SJohannes Berg }; 1545cf121c3SJohannes Berg 1555cf121c3SJohannes Berg 1565cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result; 1575cf121c3SJohannes Berg #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 1585cf121c3SJohannes Berg #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 1595cf121c3SJohannes Berg #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 1605cf121c3SJohannes Berg #define RX_QUEUED ((__force ieee80211_rx_result) 3u) 1615cf121c3SJohannes Berg 162554891e6SJohannes Berg /** 163554891e6SJohannes Berg * enum ieee80211_packet_rx_flags - packet RX flags 164554891e6SJohannes Berg * @IEEE80211_RX_RA_MATCH: frame is destined to interface currently processed 165554891e6SJohannes Berg * (incl. multicast frames) 166554891e6SJohannes Berg * @IEEE80211_RX_IN_SCAN: received while scanning 167554891e6SJohannes Berg * @IEEE80211_RX_FRAGMENTED: fragmented frame 168554891e6SJohannes Berg * @IEEE80211_RX_AMSDU: a-MSDU packet 169554891e6SJohannes Berg * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed 170*4cfda47bSChristian Lamparter * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering 171554891e6SJohannes Berg * 172554891e6SJohannes Berg * These are per-frame flags that are attached to a frame in the 173554891e6SJohannes Berg * @rx_flags field of &struct ieee80211_rx_status. 174554891e6SJohannes Berg */ 175554891e6SJohannes Berg enum ieee80211_packet_rx_flags { 176554891e6SJohannes Berg IEEE80211_RX_IN_SCAN = BIT(0), 177554891e6SJohannes Berg IEEE80211_RX_RA_MATCH = BIT(1), 178554891e6SJohannes Berg IEEE80211_RX_FRAGMENTED = BIT(2), 179554891e6SJohannes Berg IEEE80211_RX_AMSDU = BIT(3), 180554891e6SJohannes Berg IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4), 181*4cfda47bSChristian Lamparter IEEE80211_RX_DEFERRED_RELEASE = BIT(5), 182554891e6SJohannes Berg }; 183554891e6SJohannes Berg 184554891e6SJohannes Berg /** 185554891e6SJohannes Berg * enum ieee80211_rx_flags - RX data flags 186554891e6SJohannes Berg * 187554891e6SJohannes Berg * @IEEE80211_RX_CMNTR: received on cooked monitor already 188554891e6SJohannes Berg * 189554891e6SJohannes Berg * These flags are used across handling multiple interfaces 190554891e6SJohannes Berg * for a single frame. 191554891e6SJohannes Berg */ 192554891e6SJohannes Berg enum ieee80211_rx_flags { 193554891e6SJohannes Berg IEEE80211_RX_CMNTR = BIT(0), 194554891e6SJohannes Berg }; 1955cf121c3SJohannes Berg 1965cf121c3SJohannes Berg struct ieee80211_rx_data { 1975cf121c3SJohannes Berg struct sk_buff *skb; 1985cf121c3SJohannes Berg struct ieee80211_local *local; 1995cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 2005cf121c3SJohannes Berg struct sta_info *sta; 2015cf121c3SJohannes Berg struct ieee80211_key *key; 202056cdd59SJohannes Berg 203056cdd59SJohannes Berg unsigned int flags; 204f0706e82SJiri Benc int queue; 20550741ae0SJohannes Berg u32 tkip_iv32; 20650741ae0SJohannes Berg u16 tkip_iv16; 207f0706e82SJiri Benc }; 208f0706e82SJiri Benc 2095dfdaf58SJohannes Berg struct beacon_data { 2105dfdaf58SJohannes Berg u8 *head, *tail; 2115dfdaf58SJohannes Berg int head_len, tail_len; 2125dfdaf58SJohannes Berg int dtim_period; 2135dfdaf58SJohannes Berg }; 2145dfdaf58SJohannes Berg 215f0706e82SJiri Benc struct ieee80211_if_ap { 2165dfdaf58SJohannes Berg struct beacon_data *beacon; 217f0706e82SJiri Benc 2180ec3ca44SJohannes Berg struct list_head vlans; 2190ec3ca44SJohannes Berg 220f0706e82SJiri Benc /* yes, this looks ugly, but guarantees that we can later use 221f0706e82SJiri Benc * bitmap_empty :) 222004c872eSJohannes Berg * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 223f0706e82SJiri Benc u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; 224f0706e82SJiri Benc struct sk_buff_head ps_bc_buf; 225056cdd59SJohannes Berg atomic_t num_sta_ps; /* number of stations in PS mode */ 2265dfdaf58SJohannes Berg int dtim_count; 227f0706e82SJiri Benc }; 228f0706e82SJiri Benc 229f0706e82SJiri Benc struct ieee80211_if_wds { 230f0706e82SJiri Benc struct sta_info *sta; 231056cdd59SJohannes Berg u8 remote_addr[ETH_ALEN]; 232f0706e82SJiri Benc }; 233f0706e82SJiri Benc 234f0706e82SJiri Benc struct ieee80211_if_vlan { 2350ec3ca44SJohannes Berg struct list_head list; 236f14543eeSFelix Fietkau 237f14543eeSFelix Fietkau /* used for all tx if the VLAN is configured to 4-addr mode */ 238f14543eeSFelix Fietkau struct sta_info *sta; 239f0706e82SJiri Benc }; 240f0706e82SJiri Benc 241ee385855SLuis Carlos Cobo struct mesh_stats { 242c8a61a7dSDaniel Walker __u32 fwded_mcast; /* Mesh forwarded multicast frames */ 243c8a61a7dSDaniel Walker __u32 fwded_unicast; /* Mesh forwarded unicast frames */ 244c8a61a7dSDaniel Walker __u32 fwded_frames; /* Mesh total forwarded frames */ 245ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 246ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 247ee385855SLuis Carlos Cobo atomic_t estab_plinks; 248ee385855SLuis Carlos Cobo }; 249ee385855SLuis Carlos Cobo 250ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 251ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 252ee385855SLuis Carlos Cobo struct mesh_preq_queue { 253ee385855SLuis Carlos Cobo struct list_head list; 254ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 255ee385855SLuis Carlos Cobo u8 flags; 256ee385855SLuis Carlos Cobo }; 257ee385855SLuis Carlos Cobo 258f679f65dSJohannes Berg enum ieee80211_work_type { 259b8bc4b0aSJohannes Berg IEEE80211_WORK_ABORT, 260af6b6374SJohannes Berg IEEE80211_WORK_DIRECT_PROBE, 261f679f65dSJohannes Berg IEEE80211_WORK_AUTH, 262e5b900d2SJohannes Berg IEEE80211_WORK_ASSOC_BEACON_WAIT, 263f679f65dSJohannes Berg IEEE80211_WORK_ASSOC, 264b8bc4b0aSJohannes Berg IEEE80211_WORK_REMAIN_ON_CHANNEL, 265f30221e4SJohannes Berg IEEE80211_WORK_OFFCHANNEL_TX, 26677fdaa12SJohannes Berg }; 26777fdaa12SJohannes Berg 268af6b6374SJohannes Berg /** 269af6b6374SJohannes Berg * enum work_done_result - indicates what to do after work was done 270af6b6374SJohannes Berg * 271af6b6374SJohannes Berg * @WORK_DONE_DESTROY: This work item is no longer needed, destroy. 272af6b6374SJohannes Berg * @WORK_DONE_REQUEUE: This work item was reset to be reused, and 273af6b6374SJohannes Berg * should be requeued. 274af6b6374SJohannes Berg */ 275af6b6374SJohannes Berg enum work_done_result { 276af6b6374SJohannes Berg WORK_DONE_DESTROY, 277af6b6374SJohannes Berg WORK_DONE_REQUEUE, 278af6b6374SJohannes Berg }; 279af6b6374SJohannes Berg 280f679f65dSJohannes Berg struct ieee80211_work { 28177fdaa12SJohannes Berg struct list_head list; 282f679f65dSJohannes Berg 283af6b6374SJohannes Berg struct rcu_head rcu_head; 284af6b6374SJohannes Berg 285af6b6374SJohannes Berg struct ieee80211_sub_if_data *sdata; 286af6b6374SJohannes Berg 287af6b6374SJohannes Berg enum work_done_result (*done)(struct ieee80211_work *wk, 288af6b6374SJohannes Berg struct sk_buff *skb); 289af6b6374SJohannes Berg 290f679f65dSJohannes Berg struct ieee80211_channel *chan; 291e4da8c37SJohannes Berg enum nl80211_channel_type chan_type; 292af6b6374SJohannes Berg 293f679f65dSJohannes Berg unsigned long timeout; 294f679f65dSJohannes Berg enum ieee80211_work_type type; 295f679f65dSJohannes Berg 296af6b6374SJohannes Berg u8 filter_ta[ETH_ALEN]; 297af6b6374SJohannes Berg 298e4da8c37SJohannes Berg bool started; 299e4da8c37SJohannes Berg 300f679f65dSJohannes Berg union { 301f679f65dSJohannes Berg struct { 302f679f65dSJohannes Berg int tries; 303f679f65dSJohannes Berg u16 algorithm, transaction; 30477fdaa12SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 30577fdaa12SJohannes Berg u8 ssid_len; 306fffd0934SJohannes Berg u8 key[WLAN_KEY_LEN_WEP104]; 307fffd0934SJohannes Berg u8 key_len, key_idx; 308f679f65dSJohannes Berg bool privacy; 309af6b6374SJohannes Berg } probe_auth; 310f679f65dSJohannes Berg struct { 3110c1ad2caSJohannes Berg struct cfg80211_bss *bss; 312f679f65dSJohannes Berg const u8 *supp_rates; 313f679f65dSJohannes Berg const u8 *ht_information_ie; 314af6b6374SJohannes Berg enum ieee80211_smps_mode smps; 315f679f65dSJohannes Berg int tries; 316f679f65dSJohannes Berg u16 capability; 317af6b6374SJohannes Berg u8 prev_bssid[ETH_ALEN]; 318f679f65dSJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 319f679f65dSJohannes Berg u8 ssid_len; 320f679f65dSJohannes Berg u8 supp_rates_len; 321ab13315aSKalle Valo bool wmm_used, use_11n, uapsd_used; 322f679f65dSJohannes Berg } assoc; 323b8bc4b0aSJohannes Berg struct { 324e4da8c37SJohannes Berg u32 duration; 325b8bc4b0aSJohannes Berg } remain; 326f30221e4SJohannes Berg struct { 327f30221e4SJohannes Berg struct sk_buff *frame; 328f30221e4SJohannes Berg u32 wait; 329f30221e4SJohannes Berg } offchan_tx; 330f679f65dSJohannes Berg }; 331fffd0934SJohannes Berg 332f679f65dSJohannes Berg int ie_len; 33377fdaa12SJohannes Berg /* must be last */ 334f679f65dSJohannes Berg u8 ie[0]; 33577fdaa12SJohannes Berg }; 33677fdaa12SJohannes Berg 33746900298SJohannes Berg /* flags used in struct ieee80211_if_managed.flags */ 338ab1faeadSJohannes Berg enum ieee80211_sta_flags { 339b291ba11SJohannes Berg IEEE80211_STA_BEACON_POLL = BIT(0), 340b291ba11SJohannes Berg IEEE80211_STA_CONNECTION_POLL = BIT(1), 341b291ba11SJohannes Berg IEEE80211_STA_CONTROL_PORT = BIT(2), 342b291ba11SJohannes Berg IEEE80211_STA_DISABLE_11N = BIT(4), 343b291ba11SJohannes Berg IEEE80211_STA_CSA_RECEIVED = BIT(5), 344b291ba11SJohannes Berg IEEE80211_STA_MFP_ENABLED = BIT(6), 345ab13315aSKalle Valo IEEE80211_STA_UAPSD_ENABLED = BIT(7), 346375177bfSVivek Natarajan IEEE80211_STA_NULLFUNC_ACKED = BIT(8), 34717e4ec14SJouni Malinen IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9), 348ab1faeadSJohannes Berg }; 349ab1faeadSJohannes Berg 35046900298SJohannes Berg struct ieee80211_if_managed { 351056cdd59SJohannes Berg struct timer_list timer; 352b291ba11SJohannes Berg struct timer_list conn_mon_timer; 353b291ba11SJohannes Berg struct timer_list bcn_mon_timer; 354c481ec97SSujith struct timer_list chswitch_timer; 355b291ba11SJohannes Berg struct work_struct monitor_work; 356c481ec97SSujith struct work_struct chswitch_work; 3571e4dcd01SJuuso Oikarinen struct work_struct beacon_connection_loss_work; 35846900298SJohannes Berg 3597ccc8bd7SFelix Fietkau unsigned long beacon_timeout; 360b291ba11SJohannes Berg unsigned long probe_timeout; 361a43abf29SMaxim Levitsky int probe_send_count; 36204ac3c0eSFelix Fietkau bool nullfunc_failed; 363b291ba11SJohannes Berg 36477fdaa12SJohannes Berg struct mutex mtx; 3650c1ad2caSJohannes Berg struct cfg80211_bss *associated; 36646900298SJohannes Berg 36777fdaa12SJohannes Berg u8 bssid[ETH_ALEN]; 36846900298SJohannes Berg 369f0706e82SJiri Benc u16 aid; 370f0706e82SJiri Benc 3715bb644a0SJohannes Berg unsigned long timers_running; /* used for quiesce/restart */ 372965bedadSJohannes Berg bool powersave; /* powersave requested for this iface */ 3730f78231bSJohannes Berg enum ieee80211_smps_mode req_smps, /* requested smps mode */ 374d1f5b7a3SJohannes Berg ap_smps, /* smps mode AP thinks we're in */ 375d1f5b7a3SJohannes Berg driver_smps_mode; /* smps mode request */ 376d1f5b7a3SJohannes Berg 377d1f5b7a3SJohannes Berg struct work_struct request_smps_work; 378965bedadSJohannes Berg 379d6f2da5bSJiri Slaby unsigned int flags; 380f0706e82SJiri Benc 381d8ec4433SJuuso Oikarinen bool beacon_crc_valid; 382d91f36dbSJohannes Berg u32 beacon_crc; 383d91f36dbSJohannes Berg 384fdfacf0aSJouni Malinen enum { 385fdfacf0aSJouni Malinen IEEE80211_MFP_DISABLED, 386fdfacf0aSJouni Malinen IEEE80211_MFP_OPTIONAL, 387fdfacf0aSJouni Malinen IEEE80211_MFP_REQUIRED 388fdfacf0aSJouni Malinen } mfp; /* management frame protection */ 389fdfacf0aSJouni Malinen 390f0706e82SJiri Benc int wmm_last_param_set; 3919bc383deSJohannes Berg 3929bc383deSJohannes Berg u8 use_4addr; 39317e4ec14SJouni Malinen 39417e4ec14SJouni Malinen /* Signal strength from the last Beacon frame in the current BSS. */ 39517e4ec14SJouni Malinen int last_beacon_signal; 39617e4ec14SJouni Malinen 39717e4ec14SJouni Malinen /* 39817e4ec14SJouni Malinen * Weighted average of the signal strength from Beacon frames in the 39917e4ec14SJouni Malinen * current BSS. This is in units of 1/16 of the signal unit to maintain 40017e4ec14SJouni Malinen * accuracy and to speed up calculations, i.e., the value need to be 40117e4ec14SJouni Malinen * divided by 16 to get the actual value. 40217e4ec14SJouni Malinen */ 40317e4ec14SJouni Malinen int ave_beacon_signal; 40417e4ec14SJouni Malinen 40517e4ec14SJouni Malinen /* 406391a200aSJouni Malinen * Number of Beacon frames used in ave_beacon_signal. This can be used 407391a200aSJouni Malinen * to avoid generating less reliable cqm events that would be based 408391a200aSJouni Malinen * only on couple of received frames. 409391a200aSJouni Malinen */ 410391a200aSJouni Malinen unsigned int count_beacon_signal; 411391a200aSJouni Malinen 412391a200aSJouni Malinen /* 41317e4ec14SJouni Malinen * Last Beacon frame signal strength average (ave_beacon_signal / 16) 41417e4ec14SJouni Malinen * that triggered a cqm event. 0 indicates that no event has been 41517e4ec14SJouni Malinen * generated for the current association. 41617e4ec14SJouni Malinen */ 41717e4ec14SJouni Malinen int last_cqm_event_signal; 418f0706e82SJiri Benc }; 419f0706e82SJiri Benc 42046900298SJohannes Berg struct ieee80211_if_ibss { 42146900298SJohannes Berg struct timer_list timer; 42246900298SJohannes Berg 4237a17a33cSJohannes Berg struct mutex mtx; 4247a17a33cSJohannes Berg 425af8cdcd8SJohannes Berg unsigned long last_scan_completed; 4265bb644a0SJohannes Berg 427fbd2c8dcSTeemu Paasikivi u32 basic_rates; 428fbd2c8dcSTeemu Paasikivi 4295bb644a0SJohannes Berg bool timer_running; 4305bb644a0SJohannes Berg 431af8cdcd8SJohannes Berg bool fixed_bssid; 432af8cdcd8SJohannes Berg bool fixed_channel; 433fffd0934SJohannes Berg bool privacy; 43446900298SJohannes Berg 43546900298SJohannes Berg u8 bssid[ETH_ALEN]; 436af8cdcd8SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 437af8cdcd8SJohannes Berg u8 ssid_len, ie_len; 438af8cdcd8SJohannes Berg u8 *ie; 439af8cdcd8SJohannes Berg struct ieee80211_channel *channel; 44046900298SJohannes Berg 44146900298SJohannes Berg unsigned long ibss_join_req; 442af8cdcd8SJohannes Berg /* probe response/beacon for IBSS */ 443af8cdcd8SJohannes Berg struct sk_buff *presp, *skb; 44446900298SJohannes Berg 44546900298SJohannes Berg enum { 44646900298SJohannes Berg IEEE80211_IBSS_MLME_SEARCH, 44746900298SJohannes Berg IEEE80211_IBSS_MLME_JOINED, 44846900298SJohannes Berg } state; 44946900298SJohannes Berg }; 45046900298SJohannes Berg 451472dbc45SJohannes Berg struct ieee80211_if_mesh { 452472dbc45SJohannes Berg struct timer_list housekeeping_timer; 453472dbc45SJohannes Berg struct timer_list mesh_path_timer; 454e304bfd3SRui Paulo struct timer_list mesh_path_root_timer; 455472dbc45SJohannes Berg 4565bb644a0SJohannes Berg unsigned long timers_running; 4575bb644a0SJohannes Berg 45818889231SJavier Cardona unsigned long wrkq_flags; 459472dbc45SJohannes Berg 460472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 461472dbc45SJohannes Berg size_t mesh_id_len; 462472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */ 4633491707aSRui Paulo u8 mesh_pp_id; 464472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */ 4653491707aSRui Paulo u8 mesh_pm_id; 466472dbc45SJohannes Berg /* Congestion Control Mode Identifier */ 4673491707aSRui Paulo u8 mesh_cc_id; 4689e03fdfdSJavier Cardona /* Synchronization Protocol Identifier */ 4693491707aSRui Paulo u8 mesh_sp_id; 4709e03fdfdSJavier Cardona /* Authentication Protocol Identifier */ 4713491707aSRui Paulo u8 mesh_auth_id; 472d19b3bf6SRui Paulo /* Local mesh Sequence Number */ 473d19b3bf6SRui Paulo u32 sn; 474472dbc45SJohannes Berg /* Last used PREQ ID */ 475472dbc45SJohannes Berg u32 preq_id; 476472dbc45SJohannes Berg atomic_t mpaths; 477d19b3bf6SRui Paulo /* Timestamp of last SN update */ 478d19b3bf6SRui Paulo unsigned long last_sn_update; 479d19b3bf6SRui Paulo /* Timestamp of last SN sent */ 480472dbc45SJohannes Berg unsigned long last_preq; 481472dbc45SJohannes Berg struct mesh_rmc *rmc; 482472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock; 483472dbc45SJohannes Berg struct mesh_preq_queue preq_queue; 484472dbc45SJohannes Berg int preq_queue_len; 485472dbc45SJohannes Berg struct mesh_stats mshstats; 486472dbc45SJohannes Berg struct mesh_config mshcfg; 487472dbc45SJohannes Berg u32 mesh_seqnum; 488472dbc45SJohannes Berg bool accepting_plinks; 489c80d545dSJavier Cardona const u8 *vendor_ie; 490c80d545dSJavier Cardona u8 vendor_ie_len; 491472dbc45SJohannes Berg }; 492902acc78SJohannes Berg 493902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 494472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 495472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0) 496902acc78SJohannes Berg #else 497472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 498902acc78SJohannes Berg do { } while (0) 499902acc78SJohannes Berg #endif 500f0706e82SJiri Benc 501213cd118SJohannes Berg /** 502213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags 503213cd118SJohannes Berg * 504213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets 505213cd118SJohannes Berg * @IEEE80211_SDATA_PROMISC: interface is promisc 506213cd118SJohannes Berg * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode 507213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between 508213cd118SJohannes Berg * associated stations and deliver multicast frames both 509213cd118SJohannes Berg * back to wireless media and to the local net stack. 510213cd118SJohannes Berg */ 511213cd118SJohannes Berg enum ieee80211_sub_if_data_flags { 512213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0), 513213cd118SJohannes Berg IEEE80211_SDATA_PROMISC = BIT(1), 5147986cf95SJohannes Berg IEEE80211_SDATA_OPERATING_GMODE = BIT(2), 5157986cf95SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3), 516213cd118SJohannes Berg }; 517213cd118SJohannes Berg 51834d4bc4dSJohannes Berg /** 51934d4bc4dSJohannes Berg * enum ieee80211_sdata_state_bits - virtual interface state bits 52034d4bc4dSJohannes Berg * @SDATA_STATE_RUNNING: virtual interface is up & running; this 52134d4bc4dSJohannes Berg * mirrors netif_running() but is separate for interface type 52234d4bc4dSJohannes Berg * change handling while the interface is up 5235b714c6aSJohannes Berg * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel 5245b714c6aSJohannes Berg * mode, so queues are stopped 52534d4bc4dSJohannes Berg */ 52634d4bc4dSJohannes Berg enum ieee80211_sdata_state_bits { 52734d4bc4dSJohannes Berg SDATA_STATE_RUNNING, 5285b714c6aSJohannes Berg SDATA_STATE_OFFCHANNEL, 52934d4bc4dSJohannes Berg }; 53034d4bc4dSJohannes Berg 531f0706e82SJiri Benc struct ieee80211_sub_if_data { 532f0706e82SJiri Benc struct list_head list; 533f0706e82SJiri Benc 534f0706e82SJiri Benc struct wireless_dev wdev; 535f0706e82SJiri Benc 53611a843b7SJohannes Berg /* keys */ 53711a843b7SJohannes Berg struct list_head key_list; 53811a843b7SJohannes Berg 539f0706e82SJiri Benc struct net_device *dev; 540f0706e82SJiri Benc struct ieee80211_local *local; 541f0706e82SJiri Benc 54213262ffdSJiri Slaby unsigned int flags; 5437e9ed188SDaniel Drake 54434d4bc4dSJohannes Berg unsigned long state; 54534d4bc4dSJohannes Berg 546f0706e82SJiri Benc int drop_unencrypted; 547f0706e82SJiri Benc 54847846c9bSJohannes Berg char name[IFNAMSIZ]; 54947846c9bSJohannes Berg 550413ad50aSJohannes Berg /* 551413ad50aSJohannes Berg * keep track of whether the HT opmode (stored in 552413ad50aSJohannes Berg * vif.bss_info.ht_operation_mode) is valid. 553413ad50aSJohannes Berg */ 554413ad50aSJohannes Berg bool ht_opmode_valid; 555413ad50aSJohannes Berg 5567da7cc1dSJohannes Berg /* to detect idle changes */ 5577da7cc1dSJohannes Berg bool old_idle; 5587da7cc1dSJohannes Berg 559f0706e82SJiri Benc /* Fragment table for host-based reassembly */ 560f0706e82SJiri Benc struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; 561f0706e82SJiri Benc unsigned int fragment_next; 562f0706e82SJiri Benc 5633cfcf6acSJouni Malinen struct ieee80211_key *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS]; 564f7e0104cSJohannes Berg struct ieee80211_key *default_unicast_key, *default_multicast_key; 5653cfcf6acSJouni Malinen struct ieee80211_key *default_mgmt_key; 566f0706e82SJiri Benc 56794778280SJohannes Berg u16 sequence_number; 568a621fa4dSJohannes Berg __be16 control_port_protocol; 569a621fa4dSJohannes Berg bool control_port_no_encrypt; 57094778280SJohannes Berg 57164592c8fSJohannes Berg struct work_struct work; 57235f20c14SJohannes Berg struct sk_buff_head skb_queue; 57335f20c14SJohannes Berg 57468542962SJuuso Oikarinen bool arp_filter_state; 57568542962SJuuso Oikarinen 5763e122be0SJohannes Berg /* 5773e122be0SJohannes Berg * AP this belongs to: self in AP mode and 5783e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 5793e122be0SJohannes Berg * all others (might be needed later in IBSS) 5803e122be0SJohannes Berg */ 5813e122be0SJohannes Berg struct ieee80211_if_ap *bss; 5823e122be0SJohannes Berg 58337eb0b16SJouni Malinen /* bitmap of allowed (non-MCS) rate indexes for rate control */ 58437eb0b16SJouni Malinen u32 rc_rateidx_mask[IEEE80211_NUM_BANDS]; 585f0706e82SJiri Benc 586f0706e82SJiri Benc union { 587f0706e82SJiri Benc struct ieee80211_if_ap ap; 588f0706e82SJiri Benc struct ieee80211_if_wds wds; 589f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 59046900298SJohannes Berg struct ieee80211_if_managed mgd; 59146900298SJohannes Berg struct ieee80211_if_ibss ibss; 592472dbc45SJohannes Berg struct ieee80211_if_mesh mesh; 5938cc9a739SMichael Wu u32 mntr_flags; 594f0706e82SJiri Benc } u; 595e9f207f0SJiri Benc 596e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 597e9f207f0SJiri Benc struct { 5987bcfaf2fSJohannes Berg struct dentry *dir; 599295bafb4SBen Greear struct dentry *subdir_stations; 600f7e0104cSJohannes Berg struct dentry *default_unicast_key; 601f7e0104cSJohannes Berg struct dentry *default_multicast_key; 6023cfcf6acSJouni Malinen struct dentry *default_mgmt_key; 6037bcfaf2fSJohannes Berg } debugfs; 604e9f207f0SJiri Benc #endif 60532bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */ 60632bfd35dSJohannes Berg struct ieee80211_vif vif; 607f0706e82SJiri Benc }; 608f0706e82SJiri Benc 60932bfd35dSJohannes Berg static inline 61032bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 61132bfd35dSJohannes Berg { 61232bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif); 61332bfd35dSJohannes Berg } 61432bfd35dSJohannes Berg 615c1475ca9SJohannes Berg enum sdata_queue_type { 616c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0, 617c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_AGG_START = 1, 618c1475ca9SJohannes Berg IEEE80211_SDATA_QUEUE_AGG_STOP = 2, 619c1475ca9SJohannes Berg }; 620c1475ca9SJohannes Berg 621f0706e82SJiri Benc enum { 622f0706e82SJiri Benc IEEE80211_RX_MSG = 1, 623f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2, 624f0706e82SJiri Benc }; 625f0706e82SJiri Benc 626ce7c9111SKalle Valo enum queue_stop_reason { 627ce7c9111SKalle Valo IEEE80211_QUEUE_STOP_REASON_DRIVER, 628520eb820SKalle Valo IEEE80211_QUEUE_STOP_REASON_PS, 62996f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_CSA, 63096f5e66eSJohannes Berg IEEE80211_QUEUE_STOP_REASON_AGGREGATION, 63125420604SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SUSPEND, 6328f77f384SJohannes Berg IEEE80211_QUEUE_STOP_REASON_SKB_ADD, 633ce7c9111SKalle Valo }; 634ce7c9111SKalle Valo 635142b9f50SHelmut Schaa /** 636142b9f50SHelmut Schaa * mac80211 scan flags - currently active scan mode 637142b9f50SHelmut Schaa * 638142b9f50SHelmut Schaa * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as 639142b9f50SHelmut Schaa * well be on the operating channel 640142b9f50SHelmut Schaa * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to 641142b9f50SHelmut Schaa * determine if we are on the operating channel or not 642142b9f50SHelmut Schaa * @SCAN_OFF_CHANNEL: We're off our operating channel for scanning, 643142b9f50SHelmut Schaa * gets only set in conjunction with SCAN_SW_SCANNING 6448789d459SJohannes Berg * @SCAN_COMPLETED: Set for our scan work function when the driver reported 6458789d459SJohannes Berg * that the scan completed. 6468789d459SJohannes Berg * @SCAN_ABORTED: Set for our scan work function when the driver reported 6478789d459SJohannes Berg * a scan complete for an aborted scan. 648142b9f50SHelmut Schaa */ 649fbe9c429SHelmut Schaa enum { 650fbe9c429SHelmut Schaa SCAN_SW_SCANNING, 651142b9f50SHelmut Schaa SCAN_HW_SCANNING, 652142b9f50SHelmut Schaa SCAN_OFF_CHANNEL, 6538789d459SJohannes Berg SCAN_COMPLETED, 6548789d459SJohannes Berg SCAN_ABORTED, 655142b9f50SHelmut Schaa }; 656142b9f50SHelmut Schaa 657142b9f50SHelmut Schaa /** 658142b9f50SHelmut Schaa * enum mac80211_scan_state - scan state machine states 659142b9f50SHelmut Schaa * 660142b9f50SHelmut Schaa * @SCAN_DECISION: Main entry point to the scan state machine, this state 661142b9f50SHelmut Schaa * determines if we should keep on scanning or switch back to the 662142b9f50SHelmut Schaa * operating channel 663142b9f50SHelmut Schaa * @SCAN_SET_CHANNEL: Set the next channel to be scanned 664142b9f50SHelmut Schaa * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses 665142b9f50SHelmut Schaa * @SCAN_LEAVE_OPER_CHANNEL: Leave the operating channel, notify the AP 666142b9f50SHelmut Schaa * about us leaving the channel and stop all associated STA interfaces 667142b9f50SHelmut Schaa * @SCAN_ENTER_OPER_CHANNEL: Enter the operating channel again, notify the 668142b9f50SHelmut Schaa * AP about us being back and restart all associated STA interfaces 669142b9f50SHelmut Schaa */ 670142b9f50SHelmut Schaa enum mac80211_scan_state { 671142b9f50SHelmut Schaa SCAN_DECISION, 672142b9f50SHelmut Schaa SCAN_SET_CHANNEL, 673142b9f50SHelmut Schaa SCAN_SEND_PROBE, 674142b9f50SHelmut Schaa SCAN_LEAVE_OPER_CHANNEL, 675142b9f50SHelmut Schaa SCAN_ENTER_OPER_CHANNEL, 676fbe9c429SHelmut Schaa }; 677fbe9c429SHelmut Schaa 678f0706e82SJiri Benc struct ieee80211_local { 679f0706e82SJiri Benc /* embed the driver visible part. 680f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 681f0706e82SJiri Benc * it first anyway so they become a no-op */ 682f0706e82SJiri Benc struct ieee80211_hw hw; 683f0706e82SJiri Benc 684f0706e82SJiri Benc const struct ieee80211_ops *ops; 685f0706e82SJiri Benc 68642935ecaSLuis R. Rodriguez /* 687af6b6374SJohannes Berg * work stuff, potentially off-channel (in the future) 688af6b6374SJohannes Berg */ 689af6b6374SJohannes Berg struct list_head work_list; 690af6b6374SJohannes Berg struct timer_list work_timer; 691af6b6374SJohannes Berg struct work_struct work_work; 692af6b6374SJohannes Berg struct sk_buff_head work_skb_queue; 693af6b6374SJohannes Berg 694af6b6374SJohannes Berg /* 69542935ecaSLuis R. Rodriguez * private workqueue to mac80211. mac80211 makes this accessible 69642935ecaSLuis R. Rodriguez * via ieee80211_queue_work() 69742935ecaSLuis R. Rodriguez */ 69842935ecaSLuis R. Rodriguez struct workqueue_struct *workqueue; 69942935ecaSLuis R. Rodriguez 700e4e72fb4SJohannes Berg unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; 70196f5e66eSJohannes Berg /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */ 702ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock; 70396f5e66eSJohannes Berg 704f0706e82SJiri Benc int open_count; 7053d30d949SMichael Wu int monitors, cooked_mntrs; 7068cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 7077be5086dSJohannes Berg int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll, 7087be5086dSJohannes Berg fif_probe_req; 7097be5086dSJohannes Berg int probe_req_reg; 7104150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 7113b8d81e0SJohannes Berg 7123ffc2a90SJohannes Berg bool wiphy_ciphers_allocated; 7133ffc2a90SJohannes Berg 7143b8d81e0SJohannes Berg /* protects the aggregated multicast list and filter calls */ 7153b8d81e0SJohannes Berg spinlock_t filter_lock; 7163b8d81e0SJohannes Berg 7173ac64beeSJohannes Berg /* used for uploading changed mc list */ 7183ac64beeSJohannes Berg struct work_struct reconfig_filter; 7193ac64beeSJohannes Berg 7200f78231bSJohannes Berg /* used to reconfigure hardware SM PS */ 7210f78231bSJohannes Berg struct work_struct recalc_smps; 7220f78231bSJohannes Berg 7233b8d81e0SJohannes Berg /* aggregated multicast list */ 72422bedad3SJiri Pirko struct netdev_hw_addr_list mc_list; 7253b8d81e0SJohannes Berg 726d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 7275bb644a0SJohannes Berg 7285bb644a0SJohannes Berg /* 7295bb644a0SJohannes Berg * suspended is true if we finished all the suspend _and_ we have 7305bb644a0SJohannes Berg * not yet come up from resume. This is to be used by mac80211 7315bb644a0SJohannes Berg * to ensure driver sanity during suspend and mac80211's own 7325bb644a0SJohannes Berg * sanity. It can eventually be used for WoW as well. 7335bb644a0SJohannes Berg */ 7345bb644a0SJohannes Berg bool suspended; 7355bb644a0SJohannes Berg 7365bb644a0SJohannes Berg /* 737ceb99fe0SJohannes Berg * Resuming is true while suspended, but when we're reprogramming the 738ceb99fe0SJohannes Berg * hardware -- at that time it's allowed to use ieee80211_queue_work() 739ceb99fe0SJohannes Berg * again even though some other parts of the stack are still suspended 740ceb99fe0SJohannes Berg * and we still drop received frames to avoid waking the stack. 741ceb99fe0SJohannes Berg */ 742ceb99fe0SJohannes Berg bool resuming; 743ceb99fe0SJohannes Berg 744ceb99fe0SJohannes Berg /* 7455bb644a0SJohannes Berg * quiescing is true during the suspend process _only_ to 7465bb644a0SJohannes Berg * ease timer cancelling etc. 7475bb644a0SJohannes Berg */ 7485bb644a0SJohannes Berg bool quiescing; 7495bb644a0SJohannes Berg 750ea77f12fSJohannes Berg /* device is started */ 751ea77f12fSJohannes Berg bool started; 752ea77f12fSJohannes Berg 753b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 754f0706e82SJiri Benc 755f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 756f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 757f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 758f0706e82SJiri Benc * queues increases over the limit. */ 759f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 760f0706e82SJiri Benc struct tasklet_struct tasklet; 761f0706e82SJiri Benc struct sk_buff_head skb_queue; 762f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 763f0706e82SJiri Benc 764d0709a65SJohannes Berg /* Station data */ 765d0709a65SJohannes Berg /* 76634e89507SJohannes Berg * The mutex only protects the list and counter, 76734e89507SJohannes Berg * reads are done in RCU. 76834e89507SJohannes Berg * Additionally, the lock protects the hash table, 76934e89507SJohannes Berg * the pending list and each BSS's TIM bitmap. 770d0709a65SJohannes Berg */ 77134e89507SJohannes Berg struct mutex sta_mtx; 772d0709a65SJohannes Berg spinlock_t sta_lock; 773d0709a65SJohannes Berg unsigned long num_sta; 77434e89507SJohannes Berg struct list_head sta_list, sta_pending_list; 775f0706e82SJiri Benc struct sta_info *sta_hash[STA_HASH_SIZE]; 776f0706e82SJiri Benc struct timer_list sta_cleanup; 77734e89507SJohannes Berg struct work_struct sta_finish_work; 778f5ea9120SJohannes Berg int sta_generation; 779f0706e82SJiri Benc 7802a577d98SJohannes Berg struct sk_buff_head pending[IEEE80211_MAX_QUEUES]; 781f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 782f0706e82SJiri Benc 783a6a67db2SJohannes Berg atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES]; 784cd8ffc80SJohannes Berg 785f0706e82SJiri Benc /* number of interfaces with corresponding IFF_ flags */ 78653918994SJohannes Berg atomic_t iff_allmultis, iff_promiscs; 787f0706e82SJiri Benc 788f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 789f0706e82SJiri Benc 790f0706e82SJiri Benc struct crypto_blkcipher *wep_tx_tfm; 791f0706e82SJiri Benc struct crypto_blkcipher *wep_rx_tfm; 792f0706e82SJiri Benc u32 wep_iv; 793f0706e82SJiri Benc 794c771c9d8SJohannes Berg /* see iface.c */ 79579010420SJohannes Berg struct list_head interfaces; 796c771c9d8SJohannes Berg struct mutex iflist_mtx; 79779010420SJohannes Berg 798b16bd15cSJohannes Berg /* 799ad0e2b5aSJohannes Berg * Key mutex, protects sdata's key_list and sta_info's 800b16bd15cSJohannes Berg * key pointers (write access, they're RCU.) 801b16bd15cSJohannes Berg */ 802ad0e2b5aSJohannes Berg struct mutex key_mtx; 803b16bd15cSJohannes Berg 804a1699b75SJohannes Berg /* mutex for scan and work locking */ 805a1699b75SJohannes Berg struct mutex mtx; 806b16bd15cSJohannes Berg 807c2b13452SJohannes Berg /* Scanning and BSS list */ 808fbe9c429SHelmut Schaa unsigned long scanning; 8092a519311SJohannes Berg struct cfg80211_ssid scan_ssid; 8105ba63533SJohannes Berg struct cfg80211_scan_request *int_scan_req; 8114d36ec58SJohannes Berg struct cfg80211_scan_request *scan_req, *hw_scan_req; 8122a519311SJohannes Berg struct ieee80211_channel *scan_channel; 8134d36ec58SJohannes Berg enum ieee80211_band hw_scan_band; 814f0706e82SJiri Benc int scan_channel_idx; 815de95a54bSJohannes Berg int scan_ies_len; 8168318d78aSJohannes Berg 817df13cce5SHelmut Schaa unsigned long leave_oper_channel_time; 818977923b0SHelmut Schaa enum mac80211_scan_state next_scan_state; 819f0706e82SJiri Benc struct delayed_work scan_work; 820491775a5SJohannes Berg struct ieee80211_sub_if_data *scan_sdata; 8210aaffa9bSJohannes Berg enum nl80211_channel_type _oper_channel_type; 8222a519311SJohannes Berg struct ieee80211_channel *oper_channel, *csa_channel; 823f0706e82SJiri Benc 824b8bc4b0aSJohannes Berg /* Temporary remain-on-channel for off-channel operations */ 825b8bc4b0aSJohannes Berg struct ieee80211_channel *tmp_channel; 826b8bc4b0aSJohannes Berg enum nl80211_channel_type tmp_channel_type; 827b8bc4b0aSJohannes Berg 828f0706e82SJiri Benc /* SNMP counters */ 829f0706e82SJiri Benc /* dot11CountersTable */ 830f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 831f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 832f0706e82SJiri Benc u32 dot11FailedCount; 833f0706e82SJiri Benc u32 dot11RetryCount; 834f0706e82SJiri Benc u32 dot11MultipleRetryCount; 835f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 836f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 837f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 838f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 839f0706e82SJiri Benc 840f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS 841f0706e82SJiri Benc int tx_led_counter, rx_led_counter; 842cdcb006fSIvo van Doorn struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; 843cdcb006fSIvo van Doorn char tx_led_name[32], rx_led_name[32], 844cdcb006fSIvo van Doorn assoc_led_name[32], radio_led_name[32]; 845f0706e82SJiri Benc #endif 846f0706e82SJiri Benc 847f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 848f0706e82SJiri Benc /* TX/RX handler statistics */ 849f0706e82SJiri Benc unsigned int tx_handlers_drop; 850f0706e82SJiri Benc unsigned int tx_handlers_queued; 851f0706e82SJiri Benc unsigned int tx_handlers_drop_unencrypted; 852f0706e82SJiri Benc unsigned int tx_handlers_drop_fragment; 853f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 854f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 855f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 856f0706e82SJiri Benc unsigned int rx_handlers_drop; 857f0706e82SJiri Benc unsigned int rx_handlers_queued; 858f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 859f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 860f0706e82SJiri Benc unsigned int rx_handlers_drop_short; 861f0706e82SJiri Benc unsigned int rx_handlers_drop_passive_scan; 862f0706e82SJiri Benc unsigned int tx_expand_skb_head; 863f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 864f0706e82SJiri Benc unsigned int rx_expand_skb_head; 865f0706e82SJiri Benc unsigned int rx_expand_skb_head2; 866f0706e82SJiri Benc unsigned int rx_handlers_fragments; 867f0706e82SJiri Benc unsigned int tx_status_drop; 868f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 869f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 870f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 871f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 872f0706e82SJiri Benc 873f0706e82SJiri Benc 874f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 875f0706e82SJiri Benc * multicast packets for power saving stations 876f0706e82SJiri Benc */ 877f0706e82SJiri Benc int wifi_wme_noack_test; 878f0706e82SJiri Benc unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ 879520eb820SKalle Valo 88050ae0cf1SKalle Valo /* 88150ae0cf1SKalle Valo * Bitmask of enabled u-apsd queues, 88250ae0cf1SKalle Valo * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association 88350ae0cf1SKalle Valo * to take effect. 88450ae0cf1SKalle Valo */ 88550ae0cf1SKalle Valo unsigned int uapsd_queues; 88650ae0cf1SKalle Valo 88750ae0cf1SKalle Valo /* 88850ae0cf1SKalle Valo * Maximum number of buffered frames AP can deliver during a 88950ae0cf1SKalle Valo * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar. 89050ae0cf1SKalle Valo * Needs a new association to take effect. 89150ae0cf1SKalle Valo */ 89250ae0cf1SKalle Valo unsigned int uapsd_max_sp_len; 89350ae0cf1SKalle Valo 894572e0012SKalle Valo bool pspolling; 895b203ffc3SJouni Malinen bool offchannel_ps_enabled; 896965bedadSJohannes Berg /* 897965bedadSJohannes Berg * PS can only be enabled when we have exactly one managed 898965bedadSJohannes Berg * interface (and monitors) in PS, this then points there. 899965bedadSJohannes Berg */ 900965bedadSJohannes Berg struct ieee80211_sub_if_data *ps_sdata; 901520eb820SKalle Valo struct work_struct dynamic_ps_enable_work; 902520eb820SKalle Valo struct work_struct dynamic_ps_disable_work; 903520eb820SKalle Valo struct timer_list dynamic_ps_timer; 90410f644a4SJohannes Berg struct notifier_block network_latency_notifier; 9052b2c009eSJuuso Oikarinen struct notifier_block ifa_notifier; 906f0706e82SJiri Benc 907ff616381SJuuso Oikarinen /* 908ff616381SJuuso Oikarinen * The dynamic ps timeout configured from user space via WEXT - 909ff616381SJuuso Oikarinen * this will override whatever chosen by mac80211 internally. 910ff616381SJuuso Oikarinen */ 911ff616381SJuuso Oikarinen int dynamic_ps_forced_timeout; 912f90754c1SJuuso Oikarinen int dynamic_ps_user_timeout; 913f90754c1SJuuso Oikarinen bool disable_dynamic_ps; 914ff616381SJuuso Oikarinen 9152bf30fabSJohannes Berg int user_power_level; /* in dBm */ 916a8302de9SVasanthakumar Thiagarajan int power_constr_level; /* in dBm */ 9172bf30fabSJohannes Berg 9180f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode; 9190f78231bSJohannes Berg 920f2753ddbSJohannes Berg struct work_struct restart_work; 921f2753ddbSJohannes Berg 922e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 923e9f207f0SJiri Benc struct local_debugfsdentries { 9244b7679a5SJohannes Berg struct dentry *rcdir; 925e9f207f0SJiri Benc struct dentry *keys; 926e9f207f0SJiri Benc } debugfs; 927e9f207f0SJiri Benc #endif 9284e6cbfd0SJohn W. Linville 9294e6cbfd0SJohn W. Linville /* dummy netdev for use w/ NAPI */ 9304e6cbfd0SJohn W. Linville struct net_device napi_dev; 9314e6cbfd0SJohn W. Linville 9324e6cbfd0SJohn W. Linville struct napi_struct napi; 933f0706e82SJiri Benc }; 934f0706e82SJiri Benc 9353e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 9363e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) 9373e122be0SJohannes Berg { 9383e122be0SJohannes Berg return netdev_priv(dev); 9393e122be0SJohannes Berg } 9403e122be0SJohannes Berg 941c1475ca9SJohannes Berg /* this struct represents 802.11n's RA/TID combination */ 942eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid { 943eadc8d9eSRon Rindjunsky u8 ra[ETH_ALEN]; 944eadc8d9eSRon Rindjunsky u16 tid; 945eadc8d9eSRon Rindjunsky }; 946eadc8d9eSRon Rindjunsky 947ee385855SLuis Carlos Cobo /* Parsed Information Elements */ 948ee385855SLuis Carlos Cobo struct ieee802_11_elems { 94943ac2ca3SJouni Malinen u8 *ie_start; 95043ac2ca3SJouni Malinen size_t total_len; 95143ac2ca3SJouni Malinen 952ee385855SLuis Carlos Cobo /* pointers to IEs */ 953ee385855SLuis Carlos Cobo u8 *ssid; 954ee385855SLuis Carlos Cobo u8 *supp_rates; 955ee385855SLuis Carlos Cobo u8 *fh_params; 956ee385855SLuis Carlos Cobo u8 *ds_params; 957ee385855SLuis Carlos Cobo u8 *cf_params; 958e7ec86f5SJohannes Berg struct ieee80211_tim_ie *tim; 959ee385855SLuis Carlos Cobo u8 *ibss_params; 960ee385855SLuis Carlos Cobo u8 *challenge; 961ee385855SLuis Carlos Cobo u8 *wpa; 962ee385855SLuis Carlos Cobo u8 *rsn; 963ee385855SLuis Carlos Cobo u8 *erp_info; 964ee385855SLuis Carlos Cobo u8 *ext_supp_rates; 965ee385855SLuis Carlos Cobo u8 *wmm_info; 966ee385855SLuis Carlos Cobo u8 *wmm_param; 96709914813SJohannes Berg struct ieee80211_ht_cap *ht_cap_elem; 968d9fe60deSJohannes Berg struct ieee80211_ht_info *ht_info_elem; 969136cfa28SRui Paulo struct ieee80211_meshconf_ie *mesh_config; 970ee385855SLuis Carlos Cobo u8 *mesh_id; 971ee385855SLuis Carlos Cobo u8 *peer_link; 972ee385855SLuis Carlos Cobo u8 *preq; 973ee385855SLuis Carlos Cobo u8 *prep; 974ee385855SLuis Carlos Cobo u8 *perr; 97590a5e169SRui Paulo struct ieee80211_rann_ie *rann; 976f2df3859SAssaf Krauss u8 *ch_switch_elem; 977f2df3859SAssaf Krauss u8 *country_elem; 978f2df3859SAssaf Krauss u8 *pwr_constr_elem; 979f2df3859SAssaf Krauss u8 *quiet_elem; /* first quite element */ 980f797eb7eSJouni Malinen u8 *timeout_int; 981ee385855SLuis Carlos Cobo 982ee385855SLuis Carlos Cobo /* length of them, respectively */ 983ee385855SLuis Carlos Cobo u8 ssid_len; 984ee385855SLuis Carlos Cobo u8 supp_rates_len; 985ee385855SLuis Carlos Cobo u8 fh_params_len; 986ee385855SLuis Carlos Cobo u8 ds_params_len; 987ee385855SLuis Carlos Cobo u8 cf_params_len; 988ee385855SLuis Carlos Cobo u8 tim_len; 989ee385855SLuis Carlos Cobo u8 ibss_params_len; 990ee385855SLuis Carlos Cobo u8 challenge_len; 991ee385855SLuis Carlos Cobo u8 wpa_len; 992ee385855SLuis Carlos Cobo u8 rsn_len; 993ee385855SLuis Carlos Cobo u8 erp_info_len; 994ee385855SLuis Carlos Cobo u8 ext_supp_rates_len; 995ee385855SLuis Carlos Cobo u8 wmm_info_len; 996ee385855SLuis Carlos Cobo u8 wmm_param_len; 997ee385855SLuis Carlos Cobo u8 mesh_id_len; 998ee385855SLuis Carlos Cobo u8 peer_link_len; 999ee385855SLuis Carlos Cobo u8 preq_len; 1000ee385855SLuis Carlos Cobo u8 prep_len; 1001ee385855SLuis Carlos Cobo u8 perr_len; 1002f2df3859SAssaf Krauss u8 ch_switch_elem_len; 1003f2df3859SAssaf Krauss u8 country_elem_len; 1004f2df3859SAssaf Krauss u8 pwr_constr_elem_len; 1005f2df3859SAssaf Krauss u8 quiet_elem_len; 1006f2df3859SAssaf Krauss u8 num_of_quiet_elem; /* can be more the one */ 1007f797eb7eSJouni Malinen u8 timeout_int_len; 1008ee385855SLuis Carlos Cobo }; 1009ee385855SLuis Carlos Cobo 1010f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 1011f0706e82SJiri Benc struct ieee80211_hw *hw) 1012f0706e82SJiri Benc { 1013f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 1014f0706e82SJiri Benc } 1015f0706e82SJiri Benc 1016f0706e82SJiri Benc static inline struct ieee80211_hw *local_to_hw( 1017f0706e82SJiri Benc struct ieee80211_local *local) 1018f0706e82SJiri Benc { 1019f0706e82SJiri Benc return &local->hw; 1020f0706e82SJiri Benc } 1021f0706e82SJiri Benc 1022f0706e82SJiri Benc 1023571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) 1024571ecf67SJohannes Berg { 1025571ecf67SJohannes Berg return compare_ether_addr(raddr, addr) == 0 || 1026571ecf67SJohannes Berg is_broadcast_ether_addr(raddr); 1027571ecf67SJohannes Berg } 1028571ecf67SJohannes Berg 1029571ecf67SJohannes Berg 1030e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 10315cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 10329c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 10339c6bd790SJohannes Berg u32 changed); 10340d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local); 103546900298SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 1036f0706e82SJiri Benc 1037f38fd12fSJohannes Berg extern bool ieee80211_disable_40mhz_24ghz; 1038f38fd12fSJohannes Berg 103946900298SJohannes Berg /* STA code */ 10409c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 104177fdaa12SJohannes Berg int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata, 104277fdaa12SJohannes Berg struct cfg80211_auth_request *req); 104377fdaa12SJohannes Berg int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 104477fdaa12SJohannes Berg struct cfg80211_assoc_request *req); 104577fdaa12SJohannes Berg int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, 1046667503ddSJohannes Berg struct cfg80211_deauth_request *req, 1047667503ddSJohannes Berg void *cookie); 104877fdaa12SJohannes Berg int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, 1049667503ddSJohannes Berg struct cfg80211_disassoc_request *req, 1050667503ddSJohannes Berg void *cookie); 1051572e0012SKalle Valo void ieee80211_send_pspoll(struct ieee80211_local *local, 1052572e0012SKalle Valo struct ieee80211_sub_if_data *sdata); 105310f644a4SJohannes Berg void ieee80211_recalc_ps(struct ieee80211_local *local, s32 latency); 105410f644a4SJohannes Berg int ieee80211_max_network_latency(struct notifier_block *nb, 105510f644a4SJohannes Berg unsigned long data, void *dummy); 10562b2c009eSJuuso Oikarinen int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata); 1057cc32abd4SJohannes Berg void ieee80211_sta_process_chanswitch(struct ieee80211_sub_if_data *sdata, 1058cc32abd4SJohannes Berg struct ieee80211_channel_sw_ie *sw_elem, 10595ce6e438SJohannes Berg struct ieee80211_bss *bss, 10605ce6e438SJohannes Berg u64 timestamp); 10615bb644a0SJohannes Berg void ieee80211_sta_quiesce(struct ieee80211_sub_if_data *sdata); 10625bb644a0SJohannes Berg void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata); 10631fa57d01SJohannes Berg void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata); 10641fa57d01SJohannes Berg void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 10651fa57d01SJohannes Berg struct sk_buff *skb); 1066d3a910a8SLuis R. Rodriguez void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata); 1067be099e82SLuis R. Rodriguez void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata); 10689c6bd790SJohannes Berg 106946900298SJohannes Berg /* IBSS code */ 107046900298SJohannes Berg void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local); 107146900298SJohannes Berg void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata); 107246900298SJohannes Berg struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, 107334e89507SJohannes Berg u8 *bssid, u8 *addr, u32 supp_rates, 107434e89507SJohannes Berg gfp_t gfp); 1075af8cdcd8SJohannes Berg int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, 1076af8cdcd8SJohannes Berg struct cfg80211_ibss_params *params); 1077af8cdcd8SJohannes Berg int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata); 10785bb644a0SJohannes Berg void ieee80211_ibss_quiesce(struct ieee80211_sub_if_data *sdata); 10795bb644a0SJohannes Berg void ieee80211_ibss_restart(struct ieee80211_sub_if_data *sdata); 10801fa57d01SJohannes Berg void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata); 10811fa57d01SJohannes Berg void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 10821fa57d01SJohannes Berg struct sk_buff *skb); 10831fa57d01SJohannes Berg 10841fa57d01SJohannes Berg /* mesh code */ 10851fa57d01SJohannes Berg void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata); 10861fa57d01SJohannes Berg void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata, 10871fa57d01SJohannes Berg struct sk_buff *skb); 108846900298SJohannes Berg 10899c6bd790SJohannes Berg /* scan/BSS handling */ 109046900298SJohannes Berg void ieee80211_scan_work(struct work_struct *work); 1091f3b85252SJohannes Berg int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, 1092be4a4b6aSJohannes Berg const u8 *ssid, u8 ssid_len, 1093be4a4b6aSJohannes Berg struct ieee80211_channel *chan); 1094c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 10952a519311SJohannes Berg struct cfg80211_scan_request *req); 10965bb644a0SJohannes Berg void ieee80211_scan_cancel(struct ieee80211_local *local); 1097c2b13452SJohannes Berg ieee80211_rx_result 1098f1d58c25SJohannes Berg ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 10999c6bd790SJohannes Berg 11000a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 1101c2b13452SJohannes Berg struct ieee80211_bss * 110298c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local, 110398c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status, 110498c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt, 110598c8fccfSJohannes Berg size_t len, 110698c8fccfSJohannes Berg struct ieee802_11_elems *elems, 11072a519311SJohannes Berg struct ieee80211_channel *channel, 11082a519311SJohannes Berg bool beacon); 1109c2b13452SJohannes Berg struct ieee80211_bss * 11105484e237SJohannes Berg ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, 11115484e237SJohannes Berg u8 *ssid, u8 ssid_len); 111298c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local, 1113c2b13452SJohannes Berg struct ieee80211_bss *bss); 1114ee385855SLuis Carlos Cobo 1115b203ffc3SJouni Malinen /* off-channel helpers */ 1116b203ffc3SJouni Malinen void ieee80211_offchannel_stop_beaconing(struct ieee80211_local *local); 1117b203ffc3SJouni Malinen void ieee80211_offchannel_stop_station(struct ieee80211_local *local); 1118b203ffc3SJouni Malinen void ieee80211_offchannel_return(struct ieee80211_local *local, 1119b203ffc3SJouni Malinen bool enable_beaconing); 1120b203ffc3SJouni Malinen 11213e122be0SJohannes Berg /* interface handling */ 112247846c9bSJohannes Berg int ieee80211_iface_init(void); 112347846c9bSJohannes Berg void ieee80211_iface_exit(void); 11243e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 112505c914feSJohannes Berg struct net_device **new_dev, enum nl80211_iftype type, 1126ee385855SLuis Carlos Cobo struct vif_params *params); 1127f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 112805c914feSJohannes Berg enum nl80211_iftype type); 1129f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 113075636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 11315cff20e6SJohannes Berg u32 __ieee80211_recalc_idle(struct ieee80211_local *local); 11325cff20e6SJohannes Berg void ieee80211_recalc_idle(struct ieee80211_local *local); 113385416a4fSChristian Lamparter void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, 113485416a4fSChristian Lamparter const int offset); 1135f0706e82SJiri Benc 11369607e6b6SJohannes Berg static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata) 11379607e6b6SJohannes Berg { 113834d4bc4dSJohannes Berg return test_bit(SDATA_STATE_RUNNING, &sdata->state); 11399607e6b6SJohannes Berg } 11409607e6b6SJohannes Berg 1141e2ebc74dSJohannes Berg /* tx handling */ 1142e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 1143e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data); 1144d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1145d0cf9c0dSStephen Hemminger struct net_device *dev); 1146d0cf9c0dSStephen Hemminger netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, 1147d0cf9c0dSStephen Hemminger struct net_device *dev); 1148e2ebc74dSJohannes Berg 1149fe7a5d5cSJohannes Berg /* 1150fe7a5d5cSJohannes Berg * radiotap header for status frames 1151fe7a5d5cSJohannes Berg */ 1152fe7a5d5cSJohannes Berg struct ieee80211_tx_status_rtap_hdr { 1153fe7a5d5cSJohannes Berg struct ieee80211_radiotap_header hdr; 1154fe7a5d5cSJohannes Berg u8 rate; 1155fe7a5d5cSJohannes Berg u8 padding_for_rate; 1156fe7a5d5cSJohannes Berg __le16 tx_flags; 1157fe7a5d5cSJohannes Berg u8 data_retries; 1158bc10502dSEric Dumazet } __packed; 1159fe7a5d5cSJohannes Berg 1160fe7a5d5cSJohannes Berg 1161de1ede7aSJohannes Berg /* HT */ 1162ae5eb026SJohannes Berg void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, 1163ae5eb026SJohannes Berg struct ieee80211_ht_cap *ht_cap_ie, 1164d9fe60deSJohannes Berg struct ieee80211_sta_ht_cap *ht_cap); 1165de1ede7aSJohannes Berg void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); 1166b8695a8fSJohannes Berg void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, 1167b8695a8fSJohannes Berg const u8 *da, u16 tid, 1168b8695a8fSJohannes Berg u16 initiator, u16 reason_code); 11690f78231bSJohannes Berg int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata, 11700f78231bSJohannes Berg enum ieee80211_smps_mode smps, const u8 *da, 11710f78231bSJohannes Berg const u8 *bssid); 1172d1f5b7a3SJohannes Berg void ieee80211_request_smps_work(struct work_struct *work); 1173de1ede7aSJohannes Berg 11747c3b1dd8SJohannes Berg void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 117553f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 1176849b7967SJohannes Berg void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid, 117753f73c09SJohannes Berg u16 initiator, u16 reason, bool stop); 117853f73c09SJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta, bool tx); 1179de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, 1180de1ede7aSJohannes Berg struct sta_info *sta, 1181de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len); 1182de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local, 1183de1ede7aSJohannes Berg struct sta_info *sta, 1184de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1185de1ede7aSJohannes Berg size_t len); 1186de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local, 1187de1ede7aSJohannes Berg struct sta_info *sta, 1188de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 1189de1ede7aSJohannes Berg size_t len); 1190de1ede7aSJohannes Berg 1191849b7967SJohannes Berg int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 119253f73c09SJohannes Berg enum ieee80211_back_parties initiator, 119353f73c09SJohannes Berg bool tx); 119467c282c0SJohannes Berg int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid, 119553f73c09SJohannes Berg enum ieee80211_back_parties initiator, 119653f73c09SJohannes Berg bool tx); 11975d22c89bSJohannes Berg void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid); 11985d22c89bSJohannes Berg void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid); 119967c282c0SJohannes Berg void ieee80211_ba_session_work(struct work_struct *work); 120067c282c0SJohannes Berg void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid); 12012bff8ebfSChristian Lamparter void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid); 1202849b7967SJohannes Berg 120339192c0bSJohannes Berg /* Spectrum management */ 120439192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 120539192c0bSJohannes Berg struct ieee80211_mgmt *mgmt, 120639192c0bSJohannes Berg size_t len); 120739192c0bSJohannes Berg 1208f2753ddbSJohannes Berg /* Suspend/resume and hw reconfiguration */ 1209f2753ddbSJohannes Berg int ieee80211_reconfig(struct ieee80211_local *local); 121084f6a01cSJohannes Berg void ieee80211_stop_device(struct ieee80211_local *local); 1211f2753ddbSJohannes Berg 1212827b1fb4SJohannes Berg #ifdef CONFIG_PM 1213665af4fcSBob Copeland int __ieee80211_suspend(struct ieee80211_hw *hw); 1214f2753ddbSJohannes Berg 1215f2753ddbSJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 1216f2753ddbSJohannes Berg { 121785f72bc8SJohn W. Linville struct ieee80211_local *local = hw_to_local(hw); 121885f72bc8SJohn W. Linville 121985f72bc8SJohn W. Linville WARN(test_bit(SCAN_HW_SCANNING, &local->scanning), 122085f72bc8SJohn W. Linville "%s: resume with hardware scan still in progress\n", 122185f72bc8SJohn W. Linville wiphy_name(hw->wiphy)); 122285f72bc8SJohn W. Linville 1223f2753ddbSJohannes Berg return ieee80211_reconfig(hw_to_local(hw)); 1224f2753ddbSJohannes Berg } 1225827b1fb4SJohannes Berg #else 1226827b1fb4SJohannes Berg static inline int __ieee80211_suspend(struct ieee80211_hw *hw) 1227827b1fb4SJohannes Berg { 1228827b1fb4SJohannes Berg return 0; 1229827b1fb4SJohannes Berg } 1230f2753ddbSJohannes Berg 1231827b1fb4SJohannes Berg static inline int __ieee80211_resume(struct ieee80211_hw *hw) 1232827b1fb4SJohannes Berg { 1233827b1fb4SJohannes Berg return 0; 1234827b1fb4SJohannes Berg } 1235827b1fb4SJohannes Berg #endif 1236665af4fcSBob Copeland 1237c2d1560aSJohannes Berg /* utility functions/constants */ 1238c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */ 123971364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 124005c914feSJohannes Berg enum nl80211_iftype type); 1241c2d1560aSJohannes Berg int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, 1242c2d1560aSJohannes Berg int rate, int erp, int short_preamble); 1243f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 1244e6d6e342SJohannes Berg struct ieee80211_hdr *hdr, const u8 *tsc, 1245e6d6e342SJohannes Berg gfp_t gfp); 12465825fe10SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata); 124762ae67beSJohannes Berg void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb); 12489c6bd790SJohannes Berg void ieee802_11_parse_elems(u8 *start, size_t len, 12499c6bd790SJohannes Berg struct ieee802_11_elems *elems); 1250d91f36dbSJohannes Berg u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, 1251d91f36dbSJohannes Berg struct ieee802_11_elems *elems, 1252d91f36dbSJohannes Berg u64 filter, u32 crc); 1253881d948cSJohannes Berg u32 ieee80211_mandatory_rates(struct ieee80211_local *local, 125496dd22acSJohannes Berg enum ieee80211_band band); 1255f0706e82SJiri Benc 1256520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 1257520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 1258520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data); 1259a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local, 1260a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata, 1261a97b77b9SVivek Natarajan int powersave); 12623cf335d5SKalle Valo void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, 12633cf335d5SKalle Valo struct ieee80211_hdr *hdr); 12644e5ff376SFelix Fietkau void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, 126504ac3c0eSFelix Fietkau struct ieee80211_hdr *hdr, bool ack); 12661e4dcd01SJuuso Oikarinen void ieee80211_beacon_connection_loss_work(struct work_struct *work); 1267520eb820SKalle Valo 1268ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 1269ce7c9111SKalle Valo enum queue_stop_reason reason); 1270ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 1271ce7c9111SKalle Valo enum queue_stop_reason reason); 127296f5e66eSJohannes Berg void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue, 127396f5e66eSJohannes Berg enum queue_stop_reason reason); 127496f5e66eSJohannes Berg void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue, 127596f5e66eSJohannes Berg enum queue_stop_reason reason); 12768f77f384SJohannes Berg void ieee80211_add_pending_skb(struct ieee80211_local *local, 12778f77f384SJohannes Berg struct sk_buff *skb); 12788f77f384SJohannes Berg int ieee80211_add_pending_skbs(struct ieee80211_local *local, 12798f77f384SJohannes Berg struct sk_buff_head *skbs); 128050a9432dSJohannes Berg int ieee80211_add_pending_skbs_fn(struct ieee80211_local *local, 128150a9432dSJohannes Berg struct sk_buff_head *skbs, 128250a9432dSJohannes Berg void (*fn)(void *data), void *data); 1283ce7c9111SKalle Valo 128446900298SJohannes Berg void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, 128546900298SJohannes Berg u16 transaction, u16 auth_alg, 1286fffd0934SJohannes Berg u8 *extra, size_t extra_len, const u8 *bssid, 1287fffd0934SJohannes Berg const u8 *key, u8 key_len, u8 key_idx); 1288de95a54bSJohannes Berg int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, 12894d36ec58SJohannes Berg const u8 *ie, size_t ie_len, 1290651b5225SJouni Malinen enum ieee80211_band band, u32 rate_mask, 1291651b5225SJouni Malinen u8 channel); 1292a619a4c0SJuuso Oikarinen struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 1293a619a4c0SJuuso Oikarinen u8 *dst, 1294a619a4c0SJuuso Oikarinen const u8 *ssid, size_t ssid_len, 1295a619a4c0SJuuso Oikarinen const u8 *ie, size_t ie_len); 129646900298SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, 1297de95a54bSJohannes Berg const u8 *ssid, size_t ssid_len, 1298de95a54bSJohannes Berg const u8 *ie, size_t ie_len); 129946900298SJohannes Berg 130046900298SJohannes Berg void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata, 130146900298SJohannes Berg const size_t supp_rates_len, 130246900298SJohannes Berg const u8 *supp_rates); 130346900298SJohannes Berg u32 ieee80211_sta_get_rates(struct ieee80211_local *local, 130446900298SJohannes Berg struct ieee802_11_elems *elems, 130546900298SJohannes Berg enum ieee80211_band band); 13060f78231bSJohannes Berg int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, 13070f78231bSJohannes Berg enum ieee80211_smps_mode smps_mode); 1308025e6be2SJohannes Berg void ieee80211_recalc_smps(struct ieee80211_local *local); 130946900298SJohannes Berg 13108e664fb3SJohannes Berg size_t ieee80211_ie_split(const u8 *ies, size_t ielen, 13118e664fb3SJohannes Berg const u8 *ids, int n_ids, size_t offset); 13128e664fb3SJohannes Berg size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset); 13138e664fb3SJohannes Berg 1314af6b6374SJohannes Berg /* internal work items */ 1315af6b6374SJohannes Berg void ieee80211_work_init(struct ieee80211_local *local); 1316af6b6374SJohannes Berg void ieee80211_add_work(struct ieee80211_work *wk); 1317af6b6374SJohannes Berg void free_work(struct ieee80211_work *wk); 1318af6b6374SJohannes Berg void ieee80211_work_purge(struct ieee80211_sub_if_data *sdata); 1319af6b6374SJohannes Berg ieee80211_rx_result ieee80211_work_rx_mgmt(struct ieee80211_sub_if_data *sdata, 1320af6b6374SJohannes Berg struct sk_buff *skb); 1321b8bc4b0aSJohannes Berg int ieee80211_wk_remain_on_channel(struct ieee80211_sub_if_data *sdata, 1322b8bc4b0aSJohannes Berg struct ieee80211_channel *chan, 1323b8bc4b0aSJohannes Berg enum nl80211_channel_type channel_type, 1324b8bc4b0aSJohannes Berg unsigned int duration, u64 *cookie); 1325b8bc4b0aSJohannes Berg int ieee80211_wk_cancel_remain_on_channel( 1326b8bc4b0aSJohannes Berg struct ieee80211_sub_if_data *sdata, u64 cookie); 1327af6b6374SJohannes Berg 1328f444de05SJohannes Berg /* channel management */ 1329f444de05SJohannes Berg enum ieee80211_chan_mode { 1330f444de05SJohannes Berg CHAN_MODE_UNDEFINED, 1331f444de05SJohannes Berg CHAN_MODE_HOPPING, 1332f444de05SJohannes Berg CHAN_MODE_FIXED, 1333f444de05SJohannes Berg }; 1334f444de05SJohannes Berg 1335f444de05SJohannes Berg enum ieee80211_chan_mode 1336f444de05SJohannes Berg ieee80211_get_channel_mode(struct ieee80211_local *local, 1337f444de05SJohannes Berg struct ieee80211_sub_if_data *ignore); 13380aaffa9bSJohannes Berg bool ieee80211_set_channel_type(struct ieee80211_local *local, 13390aaffa9bSJohannes Berg struct ieee80211_sub_if_data *sdata, 13400aaffa9bSJohannes Berg enum nl80211_channel_type chantype); 1341f444de05SJohannes Berg 1342f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 1343d9e8a70fSJohannes Berg #define debug_noinline noinline 1344d9e8a70fSJohannes Berg #else 1345d9e8a70fSJohannes Berg #define debug_noinline 1346d9e8a70fSJohannes Berg #endif 1347d9e8a70fSJohannes Berg 1348f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 1349