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> 2693da9cc1Scolin@cozybit.com #include <net/cfg80211.h> 27f0706e82SJiri Benc #include <net/wireless.h> 28ccc58057SDavid S. Miller #include <net/iw_handler.h> 2951cb6db0SDavid S. Miller #include <net/mac80211.h> 302c8dccc7SJohannes Berg #include "key.h" 31f0706e82SJiri Benc #include "sta_info.h" 32f0706e82SJiri Benc 339cfb0009SJohannes Berg struct ieee80211_local; 34f0706e82SJiri Benc 35f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the 36f0706e82SJiri Benc * associated stations are using power saving. */ 37f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128 38f0706e82SJiri Benc 39f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames. 40f0706e82SJiri Benc * Note: increasing this limit increases the potential memory requirement. Each 41f0706e82SJiri Benc * frame can be up to about 2 kB long. */ 42f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512 43f0706e82SJiri Benc 44f0706e82SJiri Benc /* Required encryption head and tailroom */ 45f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8 46*765cb46aSJouni Malinen #define IEEE80211_ENCRYPT_TAILROOM 18 47f0706e82SJiri Benc 48f0706e82SJiri Benc /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent 49f0706e82SJiri Benc * reception of at least three fragmented frames. This limit can be increased 50f0706e82SJiri Benc * by changing this define, at the cost of slower frame reassembly and 51f0706e82SJiri Benc * increased memory use (about 2 kB of RAM per entry). */ 52f0706e82SJiri Benc #define IEEE80211_FRAGMENT_MAX 4 53f0706e82SJiri Benc 540a51b27eSJohannes Berg /* 550a51b27eSJohannes Berg * Time after which we ignore scan results and no longer report/use 560a51b27eSJohannes Berg * them in any way. 570a51b27eSJohannes Berg */ 580a51b27eSJohannes Berg #define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ) 590a51b27eSJohannes Berg 60f0706e82SJiri Benc struct ieee80211_fragment_entry { 61f0706e82SJiri Benc unsigned long first_frag_time; 62f0706e82SJiri Benc unsigned int seq; 63f0706e82SJiri Benc unsigned int rx_queue; 64f0706e82SJiri Benc unsigned int last_frag; 65f0706e82SJiri Benc unsigned int extra_len; 66f0706e82SJiri Benc struct sk_buff_head skb_list; 67f0706e82SJiri Benc int ccmp; /* Whether fragments were encrypted with CCMP */ 68f0706e82SJiri Benc u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ 69f0706e82SJiri Benc }; 70f0706e82SJiri Benc 71f0706e82SJiri Benc 72c2b13452SJohannes Berg struct ieee80211_bss { 73f0706e82SJiri Benc struct list_head list; 74c2b13452SJohannes Berg struct ieee80211_bss *hnext; 75056cdd59SJohannes Berg size_t ssid_len; 76056cdd59SJohannes Berg 77f0706e82SJiri Benc atomic_t users; 78f0706e82SJiri Benc 79f0706e82SJiri Benc u8 bssid[ETH_ALEN]; 80f0706e82SJiri Benc u8 ssid[IEEE80211_MAX_SSID_LEN]; 8198f7dfd8SEmmanuel Grumbach u8 dtim_period; 82f0706e82SJiri Benc u16 capability; /* host byte order */ 838318d78aSJohannes Berg enum ieee80211_band band; 84f0706e82SJiri Benc int freq; 85566bfe5aSBruno Randolf int signal, noise, qual; 8643ac2ca3SJouni Malinen u8 *ies; /* all information elements from the last Beacon or Probe 8743ac2ca3SJouni Malinen * Response frames; note Beacon frame is not allowed to 8843ac2ca3SJouni Malinen * override values from Probe Response */ 8943ac2ca3SJouni Malinen size_t ies_len; 9043ac2ca3SJouni Malinen bool wmm_used; 91ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH 92ee385855SLuis Carlos Cobo u8 *mesh_id; 93ee385855SLuis Carlos Cobo size_t mesh_id_len; 9424736701SJohn W. Linville u8 *mesh_cfg; 95902acc78SJohannes Berg #endif 96f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32 97f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 98f0706e82SJiri Benc size_t supp_rates_len; 99f0706e82SJiri Benc u64 timestamp; 100056cdd59SJohannes Berg int beacon_int; 101f0706e82SJiri Benc 1029859b81eSRon Rindjunsky unsigned long last_probe_resp; 103f0706e82SJiri Benc unsigned long last_update; 104f0706e82SJiri Benc 1055628221cSDaniel Drake /* during assocation, we save an ERP value from a probe response so 1065628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 1075628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 1085628221cSDaniel Drake * otherwise, you probably don't want to use them. */ 1095628221cSDaniel Drake int has_erp_value; 1105628221cSDaniel Drake u8 erp_value; 111f0706e82SJiri Benc }; 112f0706e82SJiri Benc 113c2b13452SJohannes Berg static inline u8 *bss_mesh_cfg(struct ieee80211_bss *bss) 114902acc78SJohannes Berg { 115902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 116902acc78SJohannes Berg return bss->mesh_cfg; 117902acc78SJohannes Berg #endif 118902acc78SJohannes Berg return NULL; 119902acc78SJohannes Berg } 120902acc78SJohannes Berg 121c2b13452SJohannes Berg static inline u8 *bss_mesh_id(struct ieee80211_bss *bss) 122902acc78SJohannes Berg { 123902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 124902acc78SJohannes Berg return bss->mesh_id; 125902acc78SJohannes Berg #endif 126902acc78SJohannes Berg return NULL; 127902acc78SJohannes Berg } 128902acc78SJohannes Berg 129c2b13452SJohannes Berg static inline u8 bss_mesh_id_len(struct ieee80211_bss *bss) 130902acc78SJohannes Berg { 131902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 132902acc78SJohannes Berg return bss->mesh_id_len; 133902acc78SJohannes Berg #endif 134902acc78SJohannes Berg return 0; 135902acc78SJohannes Berg } 136902acc78SJohannes Berg 137f0706e82SJiri Benc 1389ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result; 1399ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1409ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1419ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1429ae54c84SJohannes Berg 1435cf121c3SJohannes Berg #define IEEE80211_TX_FRAGMENTED BIT(0) 1445cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1455cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1469ae54c84SJohannes Berg 1475cf121c3SJohannes Berg struct ieee80211_tx_data { 148f0706e82SJiri Benc struct sk_buff *skb; 149f0706e82SJiri Benc struct net_device *dev; 150f0706e82SJiri Benc struct ieee80211_local *local; 151f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 152f0706e82SJiri Benc struct sta_info *sta; 153f0706e82SJiri Benc struct ieee80211_key *key; 1545cf121c3SJohannes Berg 1558318d78aSJohannes Berg struct ieee80211_channel *channel; 156f0706e82SJiri Benc 157f0706e82SJiri Benc /* Extra fragments (in addition to the first fragment 158f0706e82SJiri Benc * in skb) */ 159f0706e82SJiri Benc struct sk_buff **extra_frag; 160056cdd59SJohannes Berg int num_extra_frag; 161056cdd59SJohannes Berg 162a4b7d7bdSHarvey Harrison u16 ethertype; 163056cdd59SJohannes Berg unsigned int flags; 1645cf121c3SJohannes Berg }; 1655cf121c3SJohannes Berg 1665cf121c3SJohannes Berg 1675cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result; 1685cf121c3SJohannes Berg #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 1695cf121c3SJohannes Berg #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 1705cf121c3SJohannes Berg #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 1715cf121c3SJohannes Berg #define RX_QUEUED ((__force ieee80211_rx_result) 3u) 1725cf121c3SJohannes Berg 1735cf121c3SJohannes Berg #define IEEE80211_RX_IN_SCAN BIT(0) 1745cf121c3SJohannes Berg /* frame is destined to interface currently processed (incl. multicast frames) */ 1755cf121c3SJohannes Berg #define IEEE80211_RX_RA_MATCH BIT(1) 1765cf121c3SJohannes Berg #define IEEE80211_RX_AMSDU BIT(2) 1775cf121c3SJohannes Berg #define IEEE80211_RX_CMNTR_REPORTED BIT(3) 1785cf121c3SJohannes Berg #define IEEE80211_RX_FRAGMENTED BIT(4) 1795cf121c3SJohannes Berg 1805cf121c3SJohannes Berg struct ieee80211_rx_data { 1815cf121c3SJohannes Berg struct sk_buff *skb; 1825cf121c3SJohannes Berg struct net_device *dev; 1835cf121c3SJohannes Berg struct ieee80211_local *local; 1845cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 1855cf121c3SJohannes Berg struct sta_info *sta; 1865cf121c3SJohannes Berg struct ieee80211_key *key; 187f0706e82SJiri Benc struct ieee80211_rx_status *status; 1888318d78aSJohannes Berg struct ieee80211_rate *rate; 189056cdd59SJohannes Berg 190056cdd59SJohannes Berg unsigned int flags; 191f0706e82SJiri Benc int sent_ps_buffered; 192f0706e82SJiri Benc int queue; 19350741ae0SJohannes Berg u32 tkip_iv32; 19450741ae0SJohannes Berg u16 tkip_iv16; 195f0706e82SJiri Benc }; 196f0706e82SJiri Benc 197f0706e82SJiri Benc struct ieee80211_tx_stored_packet { 198f0706e82SJiri Benc struct sk_buff *skb; 199f0706e82SJiri Benc struct sk_buff **extra_frag; 200056cdd59SJohannes Berg int num_extra_frag; 201f0706e82SJiri Benc }; 202f0706e82SJiri Benc 2035dfdaf58SJohannes Berg struct beacon_data { 2045dfdaf58SJohannes Berg u8 *head, *tail; 2055dfdaf58SJohannes Berg int head_len, tail_len; 2065dfdaf58SJohannes Berg int dtim_period; 2075dfdaf58SJohannes Berg }; 2085dfdaf58SJohannes Berg 209f0706e82SJiri Benc struct ieee80211_if_ap { 2105dfdaf58SJohannes Berg struct beacon_data *beacon; 211f0706e82SJiri Benc 2120ec3ca44SJohannes Berg struct list_head vlans; 2130ec3ca44SJohannes Berg 214f0706e82SJiri Benc /* yes, this looks ugly, but guarantees that we can later use 215f0706e82SJiri Benc * bitmap_empty :) 216004c872eSJohannes Berg * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 217f0706e82SJiri Benc u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; 218f0706e82SJiri Benc struct sk_buff_head ps_bc_buf; 219056cdd59SJohannes Berg atomic_t num_sta_ps; /* number of stations in PS mode */ 2205dfdaf58SJohannes Berg int dtim_count; 221f0706e82SJiri Benc }; 222f0706e82SJiri Benc 223f0706e82SJiri Benc struct ieee80211_if_wds { 224f0706e82SJiri Benc struct sta_info *sta; 225056cdd59SJohannes Berg u8 remote_addr[ETH_ALEN]; 226f0706e82SJiri Benc }; 227f0706e82SJiri Benc 228f0706e82SJiri Benc struct ieee80211_if_vlan { 2290ec3ca44SJohannes Berg struct list_head list; 230f0706e82SJiri Benc }; 231f0706e82SJiri Benc 232ee385855SLuis Carlos Cobo struct mesh_stats { 233ee385855SLuis Carlos Cobo __u32 fwded_frames; /* Mesh forwarded frames */ 234ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 235ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 236ee385855SLuis Carlos Cobo atomic_t estab_plinks; 237ee385855SLuis Carlos Cobo }; 238ee385855SLuis Carlos Cobo 239ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 240ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 241ee385855SLuis Carlos Cobo struct mesh_preq_queue { 242ee385855SLuis Carlos Cobo struct list_head list; 243ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 244ee385855SLuis Carlos Cobo u8 flags; 245ee385855SLuis Carlos Cobo }; 246ee385855SLuis Carlos Cobo 247d6f2da5bSJiri Slaby /* flags used in struct ieee80211_if_sta.flags */ 248d6f2da5bSJiri Slaby #define IEEE80211_STA_SSID_SET BIT(0) 249d6f2da5bSJiri Slaby #define IEEE80211_STA_BSSID_SET BIT(1) 250d6f2da5bSJiri Slaby #define IEEE80211_STA_PREV_BSSID_SET BIT(2) 251d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTHENTICATED BIT(3) 252d6f2da5bSJiri Slaby #define IEEE80211_STA_ASSOCIATED BIT(4) 253d6f2da5bSJiri Slaby #define IEEE80211_STA_PROBEREQ_POLL BIT(5) 254d6f2da5bSJiri Slaby #define IEEE80211_STA_CREATE_IBSS BIT(6) 255d6f2da5bSJiri Slaby #define IEEE80211_STA_MIXED_CELL BIT(7) 256d6f2da5bSJiri Slaby #define IEEE80211_STA_WMM_ENABLED BIT(8) 257d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) 258d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) 259d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) 2605b98b1f7SJohannes Berg #define IEEE80211_STA_PRIVACY_INVOKED BIT(13) 261eb46936bSVasanthakumar Thiagarajan #define IEEE80211_STA_TKIP_WEP_USED BIT(14) 262c481ec97SSujith #define IEEE80211_STA_CSA_RECEIVED BIT(15) 2635394af4dSJouni Malinen #define IEEE80211_STA_MFP_ENABLED BIT(16) 26448c2fc59STomas Winkler /* flags for MLME request */ 26548c2fc59STomas Winkler #define IEEE80211_STA_REQ_SCAN 0 2669859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_DIRECT_PROBE 1 2679859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_AUTH 2 2689859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_RUN 3 26948c2fc59STomas Winkler 270ccd7b362SJohannes Berg /* STA/IBSS MLME states */ 27148c2fc59STomas Winkler enum ieee80211_sta_mlme_state { 27248c2fc59STomas Winkler IEEE80211_STA_MLME_DISABLED, 2739859b81eSRon Rindjunsky IEEE80211_STA_MLME_DIRECT_PROBE, 27448c2fc59STomas Winkler IEEE80211_STA_MLME_AUTHENTICATE, 27548c2fc59STomas Winkler IEEE80211_STA_MLME_ASSOCIATE, 27648c2fc59STomas Winkler IEEE80211_STA_MLME_ASSOCIATED, 27748c2fc59STomas Winkler IEEE80211_STA_MLME_IBSS_SEARCH, 27848c2fc59STomas Winkler IEEE80211_STA_MLME_IBSS_JOINED, 27948c2fc59STomas Winkler }; 28048c2fc59STomas Winkler 28148c2fc59STomas Winkler /* bitfield of allowed auth algs */ 28248c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_OPEN BIT(0) 28348c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1) 28448c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_LEAP BIT(2) 28548c2fc59STomas Winkler 286f0706e82SJiri Benc struct ieee80211_if_sta { 287056cdd59SJohannes Berg struct timer_list timer; 288c481ec97SSujith struct timer_list chswitch_timer; 289056cdd59SJohannes Berg struct work_struct work; 290c481ec97SSujith struct work_struct chswitch_work; 291056cdd59SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 292056cdd59SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 29348c2fc59STomas Winkler enum ieee80211_sta_mlme_state state; 294f0706e82SJiri Benc size_t ssid_len; 295a0af5f14SHelmut Schaa u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; 296a0af5f14SHelmut Schaa size_t scan_ssid_len; 297f0706e82SJiri Benc u16 aid; 298f0706e82SJiri Benc u16 ap_capab, capab; 299f0706e82SJiri Benc u8 *extra_ie; /* to be added to the end of AssocReq */ 300f0706e82SJiri Benc size_t extra_ie_len; 301f0706e82SJiri Benc 302f0706e82SJiri Benc /* The last AssocReq/Resp IEs */ 303f0706e82SJiri Benc u8 *assocreq_ies, *assocresp_ies; 304f0706e82SJiri Benc size_t assocreq_ies_len, assocresp_ies_len; 305f0706e82SJiri Benc 306056cdd59SJohannes Berg struct sk_buff_head skb_queue; 307056cdd59SJohannes Berg 3086042a3e3SRon Rindjunsky int assoc_scan_tries; /* number of scans done pre-association */ 3099859b81eSRon Rindjunsky int direct_probe_tries; /* retries for direct probes */ 3106042a3e3SRon Rindjunsky int auth_tries; /* retries for auth req */ 3116042a3e3SRon Rindjunsky int assoc_tries; /* retries for assoc req */ 312f0706e82SJiri Benc 313056cdd59SJohannes Berg unsigned long request; 314056cdd59SJohannes Berg 315056cdd59SJohannes Berg unsigned long last_probe; 316056cdd59SJohannes Berg 317d6f2da5bSJiri Slaby unsigned int flags; 318f0706e82SJiri Benc 319f0706e82SJiri Benc unsigned int auth_algs; /* bitfield of allowed auth algs */ 320f0706e82SJiri Benc int auth_alg; /* currently used IEEE 802.11 authentication algorithm */ 321f0706e82SJiri Benc int auth_transaction; 322f0706e82SJiri Benc 323f0706e82SJiri Benc unsigned long ibss_join_req; 324f0706e82SJiri Benc struct sk_buff *probe_resp; /* ProbeResp template for IBSS */ 3258318d78aSJohannes Berg u32 supp_rates_bits[IEEE80211_NUM_BANDS]; 326f0706e82SJiri Benc 327f0706e82SJiri Benc int wmm_last_param_set; 328f0706e82SJiri Benc }; 329f0706e82SJiri Benc 330472dbc45SJohannes Berg struct ieee80211_if_mesh { 331472dbc45SJohannes Berg struct work_struct work; 332472dbc45SJohannes Berg struct timer_list housekeeping_timer; 333472dbc45SJohannes Berg struct timer_list mesh_path_timer; 334472dbc45SJohannes Berg struct sk_buff_head skb_queue; 335472dbc45SJohannes Berg 336472dbc45SJohannes Berg bool housekeeping; 337472dbc45SJohannes Berg 338472dbc45SJohannes Berg u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 339472dbc45SJohannes Berg size_t mesh_id_len; 340472dbc45SJohannes Berg /* Active Path Selection Protocol Identifier */ 341472dbc45SJohannes Berg u8 mesh_pp_id[4]; 342472dbc45SJohannes Berg /* Active Path Selection Metric Identifier */ 343472dbc45SJohannes Berg u8 mesh_pm_id[4]; 344472dbc45SJohannes Berg /* Congestion Control Mode Identifier */ 345472dbc45SJohannes Berg u8 mesh_cc_id[4]; 346472dbc45SJohannes Berg /* Local mesh Destination Sequence Number */ 347472dbc45SJohannes Berg u32 dsn; 348472dbc45SJohannes Berg /* Last used PREQ ID */ 349472dbc45SJohannes Berg u32 preq_id; 350472dbc45SJohannes Berg atomic_t mpaths; 351472dbc45SJohannes Berg /* Timestamp of last DSN update */ 352472dbc45SJohannes Berg unsigned long last_dsn_update; 353472dbc45SJohannes Berg /* Timestamp of last DSN sent */ 354472dbc45SJohannes Berg unsigned long last_preq; 355472dbc45SJohannes Berg struct mesh_rmc *rmc; 356472dbc45SJohannes Berg spinlock_t mesh_preq_queue_lock; 357472dbc45SJohannes Berg struct mesh_preq_queue preq_queue; 358472dbc45SJohannes Berg int preq_queue_len; 359472dbc45SJohannes Berg struct mesh_stats mshstats; 360472dbc45SJohannes Berg struct mesh_config mshcfg; 361472dbc45SJohannes Berg u32 mesh_seqnum; 362472dbc45SJohannes Berg bool accepting_plinks; 363472dbc45SJohannes Berg }; 364902acc78SJohannes Berg 365902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 366472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 367472dbc45SJohannes Berg do { (msh)->mshstats.name++; } while (0) 368902acc78SJohannes Berg #else 369472dbc45SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \ 370902acc78SJohannes Berg do { } while (0) 371902acc78SJohannes Berg #endif 372f0706e82SJiri Benc 373213cd118SJohannes Berg /** 374213cd118SJohannes Berg * enum ieee80211_sub_if_data_flags - virtual interface flags 375213cd118SJohannes Berg * 376213cd118SJohannes Berg * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets 377213cd118SJohannes Berg * @IEEE80211_SDATA_PROMISC: interface is promisc 378213cd118SJohannes Berg * @IEEE80211_SDATA_USERSPACE_MLME: userspace MLME is active 379213cd118SJohannes Berg * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode 380213cd118SJohannes Berg * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between 381213cd118SJohannes Berg * associated stations and deliver multicast frames both 382213cd118SJohannes Berg * back to wireless media and to the local net stack. 383213cd118SJohannes Berg */ 384213cd118SJohannes Berg enum ieee80211_sub_if_data_flags { 385213cd118SJohannes Berg IEEE80211_SDATA_ALLMULTI = BIT(0), 386213cd118SJohannes Berg IEEE80211_SDATA_PROMISC = BIT(1), 387213cd118SJohannes Berg IEEE80211_SDATA_USERSPACE_MLME = BIT(2), 388213cd118SJohannes Berg IEEE80211_SDATA_OPERATING_GMODE = BIT(3), 389213cd118SJohannes Berg IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(4), 390213cd118SJohannes Berg }; 391213cd118SJohannes Berg 392f0706e82SJiri Benc struct ieee80211_sub_if_data { 393f0706e82SJiri Benc struct list_head list; 394f0706e82SJiri Benc 395f0706e82SJiri Benc struct wireless_dev wdev; 396f0706e82SJiri Benc 39711a843b7SJohannes Berg /* keys */ 39811a843b7SJohannes Berg struct list_head key_list; 39911a843b7SJohannes Berg 400f0706e82SJiri Benc struct net_device *dev; 401f0706e82SJiri Benc struct ieee80211_local *local; 402f0706e82SJiri Benc 40313262ffdSJiri Slaby unsigned int flags; 4047e9ed188SDaniel Drake 405f0706e82SJiri Benc int drop_unencrypted; 406f0706e82SJiri Benc 407f0706e82SJiri Benc /* Fragment table for host-based reassembly */ 408f0706e82SJiri Benc struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; 409f0706e82SJiri Benc unsigned int fragment_next; 410f0706e82SJiri Benc 411f0706e82SJiri Benc #define NUM_DEFAULT_KEYS 4 412f0706e82SJiri Benc struct ieee80211_key *keys[NUM_DEFAULT_KEYS]; 413f0706e82SJiri Benc struct ieee80211_key *default_key; 414f0706e82SJiri Benc 41594778280SJohannes Berg u16 sequence_number; 41694778280SJohannes Berg 4173e122be0SJohannes Berg /* 4183e122be0SJohannes Berg * AP this belongs to: self in AP mode and 4193e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 4203e122be0SJohannes Berg * all others (might be needed later in IBSS) 4213e122be0SJohannes Berg */ 4223e122be0SJohannes Berg struct ieee80211_if_ap *bss; 4233e122be0SJohannes Berg 4243e122be0SJohannes Berg int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ 4253e122be0SJohannes Berg int max_ratectrl_rateidx; /* max TX rateidx for rate control */ 426f0706e82SJiri Benc 427f0706e82SJiri Benc union { 428f0706e82SJiri Benc struct ieee80211_if_ap ap; 429f0706e82SJiri Benc struct ieee80211_if_wds wds; 430f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 431f0706e82SJiri Benc struct ieee80211_if_sta sta; 432472dbc45SJohannes Berg #ifdef CONFIG_MAC80211_MESH 433472dbc45SJohannes Berg struct ieee80211_if_mesh mesh; 434472dbc45SJohannes Berg #endif 4358cc9a739SMichael Wu u32 mntr_flags; 436f0706e82SJiri Benc } u; 437e9f207f0SJiri Benc 438e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 439e9f207f0SJiri Benc struct dentry *debugfsdir; 440e9f207f0SJiri Benc union { 441e9f207f0SJiri Benc struct { 442e9f207f0SJiri Benc struct dentry *drop_unencrypted; 443e9f207f0SJiri Benc struct dentry *state; 444e9f207f0SJiri Benc struct dentry *bssid; 445e9f207f0SJiri Benc struct dentry *prev_bssid; 446e9f207f0SJiri Benc struct dentry *ssid_len; 447e9f207f0SJiri Benc struct dentry *aid; 448e9f207f0SJiri Benc struct dentry *ap_capab; 449e9f207f0SJiri Benc struct dentry *capab; 450e9f207f0SJiri Benc struct dentry *extra_ie_len; 451e9f207f0SJiri Benc struct dentry *auth_tries; 452e9f207f0SJiri Benc struct dentry *assoc_tries; 453e9f207f0SJiri Benc struct dentry *auth_algs; 454e9f207f0SJiri Benc struct dentry *auth_alg; 455e9f207f0SJiri Benc struct dentry *auth_transaction; 456e9f207f0SJiri Benc struct dentry *flags; 45793015f0fSJouni Malinen struct dentry *force_unicast_rateidx; 45893015f0fSJouni Malinen struct dentry *max_ratectrl_rateidx; 459e9f207f0SJiri Benc } sta; 460e9f207f0SJiri Benc struct { 461e9f207f0SJiri Benc struct dentry *drop_unencrypted; 462e9f207f0SJiri Benc struct dentry *num_sta_ps; 463e9f207f0SJiri Benc struct dentry *dtim_count; 464e9f207f0SJiri Benc struct dentry *force_unicast_rateidx; 465e9f207f0SJiri Benc struct dentry *max_ratectrl_rateidx; 466e9f207f0SJiri Benc struct dentry *num_buffered_multicast; 467e9f207f0SJiri Benc } ap; 468e9f207f0SJiri Benc struct { 469e9f207f0SJiri Benc struct dentry *drop_unencrypted; 470e9f207f0SJiri Benc struct dentry *peer; 47193015f0fSJouni Malinen struct dentry *force_unicast_rateidx; 47293015f0fSJouni Malinen struct dentry *max_ratectrl_rateidx; 473e9f207f0SJiri Benc } wds; 474e9f207f0SJiri Benc struct { 475e9f207f0SJiri Benc struct dentry *drop_unencrypted; 47693015f0fSJouni Malinen struct dentry *force_unicast_rateidx; 47793015f0fSJouni Malinen struct dentry *max_ratectrl_rateidx; 478e9f207f0SJiri Benc } vlan; 479e9f207f0SJiri Benc struct { 480e9f207f0SJiri Benc struct dentry *mode; 481e9f207f0SJiri Benc } monitor; 482e9f207f0SJiri Benc } debugfs; 4832b58b209SJouni Malinen struct { 4842b58b209SJouni Malinen struct dentry *default_key; 4852b58b209SJouni Malinen } common_debugfs; 486ee385855SLuis Carlos Cobo 487ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH 488ee385855SLuis Carlos Cobo struct dentry *mesh_stats_dir; 489ee385855SLuis Carlos Cobo struct { 490ee385855SLuis Carlos Cobo struct dentry *fwded_frames; 491ee385855SLuis Carlos Cobo struct dentry *dropped_frames_ttl; 492ee385855SLuis Carlos Cobo struct dentry *dropped_frames_no_route; 493ee385855SLuis Carlos Cobo struct dentry *estab_plinks; 494ee385855SLuis Carlos Cobo struct timer_list mesh_path_timer; 495ee385855SLuis Carlos Cobo } mesh_stats; 496ee385855SLuis Carlos Cobo 497ee385855SLuis Carlos Cobo struct dentry *mesh_config_dir; 498ee385855SLuis Carlos Cobo struct { 499ee385855SLuis Carlos Cobo struct dentry *dot11MeshRetryTimeout; 500ee385855SLuis Carlos Cobo struct dentry *dot11MeshConfirmTimeout; 501ee385855SLuis Carlos Cobo struct dentry *dot11MeshHoldingTimeout; 502ee385855SLuis Carlos Cobo struct dentry *dot11MeshMaxRetries; 503ee385855SLuis Carlos Cobo struct dentry *dot11MeshTTL; 504ee385855SLuis Carlos Cobo struct dentry *auto_open_plinks; 505ee385855SLuis Carlos Cobo struct dentry *dot11MeshMaxPeerLinks; 506ee385855SLuis Carlos Cobo struct dentry *dot11MeshHWMPactivePathTimeout; 507ee385855SLuis Carlos Cobo struct dentry *dot11MeshHWMPpreqMinInterval; 508ee385855SLuis Carlos Cobo struct dentry *dot11MeshHWMPnetDiameterTraversalTime; 509ee385855SLuis Carlos Cobo struct dentry *dot11MeshHWMPmaxPREQretries; 510ee385855SLuis Carlos Cobo struct dentry *path_refresh_time; 511ee385855SLuis Carlos Cobo struct dentry *min_discovery_timeout; 512ee385855SLuis Carlos Cobo } mesh_config; 513ee385855SLuis Carlos Cobo #endif 514ee385855SLuis Carlos Cobo 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, 549c481ec97SSujith IEEE80211_QUEUE_STOP_REASON_CSA 550ce7c9111SKalle Valo }; 551ce7c9111SKalle Valo 55251cb6db0SDavid S. Miller /* maximum number of hardware queues we support. */ 55351cb6db0SDavid S. Miller #define QD_MAX_QUEUES (IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_QUEUES) 55451cb6db0SDavid S. Miller 555133b8226SJohannes Berg struct ieee80211_master_priv { 556133b8226SJohannes Berg struct ieee80211_local *local; 557133b8226SJohannes Berg }; 558133b8226SJohannes Berg 559f0706e82SJiri Benc struct ieee80211_local { 560f0706e82SJiri Benc /* embed the driver visible part. 561f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 562f0706e82SJiri Benc * it first anyway so they become a no-op */ 563f0706e82SJiri Benc struct ieee80211_hw hw; 564f0706e82SJiri Benc 565f0706e82SJiri Benc const struct ieee80211_ops *ops; 566f0706e82SJiri Benc 56751cb6db0SDavid S. Miller unsigned long queue_pool[BITS_TO_LONGS(QD_MAX_QUEUES)]; 568ce7c9111SKalle Valo unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES]; 569ce7c9111SKalle Valo spinlock_t queue_stop_reason_lock; 570f0706e82SJiri Benc struct net_device *mdev; /* wmaster# - "master" 802.11 device */ 571f0706e82SJiri Benc int open_count; 5723d30d949SMichael Wu int monitors, cooked_mntrs; 5738cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 5748cc9a739SMichael Wu int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss; 5754150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 576f0706e82SJiri Benc struct iw_statistics wstats; 577f0706e82SJiri Benc u8 wstats_flags; 578d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 579b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 580f0706e82SJiri Benc 581f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 582f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 583f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 584f0706e82SJiri Benc * queues increases over the limit. */ 585f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 586f0706e82SJiri Benc struct tasklet_struct tasklet; 587f0706e82SJiri Benc struct sk_buff_head skb_queue; 588f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 589f0706e82SJiri Benc 590d0709a65SJohannes Berg /* Station data */ 591d0709a65SJohannes Berg /* 592d0709a65SJohannes Berg * The lock only protects the list, hash, timer and counter 593d0709a65SJohannes Berg * against manipulation, reads are done in RCU. Additionally, 594b16bd15cSJohannes Berg * the lock protects each BSS's TIM bitmap. 595d0709a65SJohannes Berg */ 596d0709a65SJohannes Berg spinlock_t sta_lock; 597d0709a65SJohannes Berg unsigned long num_sta; 598f0706e82SJiri Benc struct list_head sta_list; 599dc6676b7SJohannes Berg struct list_head sta_flush_list; 600dc6676b7SJohannes Berg struct work_struct sta_flush_work; 601f0706e82SJiri Benc struct sta_info *sta_hash[STA_HASH_SIZE]; 602f0706e82SJiri Benc struct timer_list sta_cleanup; 603f0706e82SJiri Benc 604e2530083SJohannes Berg unsigned long queues_pending[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)]; 605f8e79dddSTomas Winkler unsigned long queues_pending_run[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)]; 606eefce91aSJohannes Berg struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES]; 607f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 608f0706e82SJiri Benc 609f0706e82SJiri Benc /* number of interfaces with corresponding IFF_ flags */ 61053918994SJohannes Berg atomic_t iff_allmultis, iff_promiscs; 611f0706e82SJiri Benc 612f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 613f0706e82SJiri Benc 614f0706e82SJiri Benc int rts_threshold; 615f0706e82SJiri Benc int fragmentation_threshold; 616f0706e82SJiri Benc 617f0706e82SJiri Benc struct crypto_blkcipher *wep_tx_tfm; 618f0706e82SJiri Benc struct crypto_blkcipher *wep_rx_tfm; 619f0706e82SJiri Benc u32 wep_iv; 620f0706e82SJiri Benc 62179010420SJohannes Berg struct list_head interfaces; 62279010420SJohannes Berg 623b16bd15cSJohannes Berg /* 624b16bd15cSJohannes Berg * Key lock, protects sdata's key_list and sta_info's 625b16bd15cSJohannes Berg * key pointers (write access, they're RCU.) 626b16bd15cSJohannes Berg */ 627b16bd15cSJohannes Berg spinlock_t key_lock; 628b16bd15cSJohannes Berg 629b16bd15cSJohannes Berg 630c2b13452SJohannes Berg /* Scanning and BSS list */ 631c2b13452SJohannes Berg bool sw_scanning, hw_scanning; 632f0706e82SJiri Benc int scan_channel_idx; 6338318d78aSJohannes Berg enum ieee80211_band scan_band; 6348318d78aSJohannes Berg 635f0706e82SJiri Benc enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state; 636f0706e82SJiri Benc unsigned long last_scan_completed; 637f0706e82SJiri Benc struct delayed_work scan_work; 638491775a5SJohannes Berg struct ieee80211_sub_if_data *scan_sdata; 639c481ec97SSujith struct ieee80211_channel *oper_channel, *scan_channel, *csa_channel; 640094d05dcSSujith enum nl80211_channel_type oper_channel_type; 641f0706e82SJiri Benc u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; 642f0706e82SJiri Benc size_t scan_ssid_len; 643c2b13452SJohannes Berg struct list_head bss_list; 644c2b13452SJohannes Berg struct ieee80211_bss *bss_hash[STA_HASH_SIZE]; 645c2b13452SJohannes Berg spinlock_t bss_lock; 646f0706e82SJiri Benc 647f0706e82SJiri Benc /* SNMP counters */ 648f0706e82SJiri Benc /* dot11CountersTable */ 649f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 650f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 651f0706e82SJiri Benc u32 dot11FailedCount; 652f0706e82SJiri Benc u32 dot11RetryCount; 653f0706e82SJiri Benc u32 dot11MultipleRetryCount; 654f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 655f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 656f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 657f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 658f0706e82SJiri Benc 659f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS 660f0706e82SJiri Benc int tx_led_counter, rx_led_counter; 661cdcb006fSIvo van Doorn struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; 662cdcb006fSIvo van Doorn char tx_led_name[32], rx_led_name[32], 663cdcb006fSIvo van Doorn assoc_led_name[32], radio_led_name[32]; 664f0706e82SJiri Benc #endif 665f0706e82SJiri Benc 666e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 667e9f207f0SJiri Benc struct work_struct sta_debugfs_add; 668e9f207f0SJiri Benc #endif 669e9f207f0SJiri Benc 670f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 671f0706e82SJiri Benc /* TX/RX handler statistics */ 672f0706e82SJiri Benc unsigned int tx_handlers_drop; 673f0706e82SJiri Benc unsigned int tx_handlers_queued; 674f0706e82SJiri Benc unsigned int tx_handlers_drop_unencrypted; 675f0706e82SJiri Benc unsigned int tx_handlers_drop_fragment; 676f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 677f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 678f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 679f0706e82SJiri Benc unsigned int rx_handlers_drop; 680f0706e82SJiri Benc unsigned int rx_handlers_queued; 681f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 682f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 683f0706e82SJiri Benc unsigned int rx_handlers_drop_short; 684f0706e82SJiri Benc unsigned int rx_handlers_drop_passive_scan; 685f0706e82SJiri Benc unsigned int tx_expand_skb_head; 686f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 687f0706e82SJiri Benc unsigned int rx_expand_skb_head; 688f0706e82SJiri Benc unsigned int rx_expand_skb_head2; 689f0706e82SJiri Benc unsigned int rx_handlers_fragments; 690f0706e82SJiri Benc unsigned int tx_status_drop; 691f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 692f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 693f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 694f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 695f0706e82SJiri Benc 696f0706e82SJiri Benc 697f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 698f0706e82SJiri Benc * multicast packets for power saving stations 699f0706e82SJiri Benc */ 700f0706e82SJiri Benc int wifi_wme_noack_test; 701f0706e82SJiri Benc unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ 702520eb820SKalle Valo 703e0cb686fSKalle Valo bool powersave; 704520eb820SKalle Valo struct work_struct dynamic_ps_enable_work; 705520eb820SKalle Valo struct work_struct dynamic_ps_disable_work; 706520eb820SKalle Valo struct timer_list dynamic_ps_timer; 707f0706e82SJiri Benc 7082bf30fabSJohannes Berg int user_power_level; /* in dBm */ 7092bf30fabSJohannes Berg 710e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 711e9f207f0SJiri Benc struct local_debugfsdentries { 7124b7679a5SJohannes Berg struct dentry *rcdir; 7134b7679a5SJohannes Berg struct dentry *rcname; 714e9f207f0SJiri Benc struct dentry *frequency; 715e9f207f0SJiri Benc struct dentry *rts_threshold; 716e9f207f0SJiri Benc struct dentry *fragmentation_threshold; 717e9f207f0SJiri Benc struct dentry *short_retry_limit; 718e9f207f0SJiri Benc struct dentry *long_retry_limit; 719e9f207f0SJiri Benc struct dentry *total_ps_buffered; 720e9f207f0SJiri Benc struct dentry *wep_iv; 721e9f207f0SJiri Benc struct dentry *statistics; 722e9f207f0SJiri Benc struct local_debugfsdentries_statsdentries { 723e9f207f0SJiri Benc struct dentry *transmitted_fragment_count; 724e9f207f0SJiri Benc struct dentry *multicast_transmitted_frame_count; 725e9f207f0SJiri Benc struct dentry *failed_count; 726e9f207f0SJiri Benc struct dentry *retry_count; 727e9f207f0SJiri Benc struct dentry *multiple_retry_count; 728e9f207f0SJiri Benc struct dentry *frame_duplicate_count; 729e9f207f0SJiri Benc struct dentry *received_fragment_count; 730e9f207f0SJiri Benc struct dentry *multicast_received_frame_count; 731e9f207f0SJiri Benc struct dentry *transmitted_frame_count; 732e9f207f0SJiri Benc struct dentry *wep_undecryptable_count; 733e9f207f0SJiri Benc struct dentry *num_scans; 734e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 735e9f207f0SJiri Benc struct dentry *tx_handlers_drop; 736e9f207f0SJiri Benc struct dentry *tx_handlers_queued; 737e9f207f0SJiri Benc struct dentry *tx_handlers_drop_unencrypted; 738e9f207f0SJiri Benc struct dentry *tx_handlers_drop_fragment; 739e9f207f0SJiri Benc struct dentry *tx_handlers_drop_wep; 740e9f207f0SJiri Benc struct dentry *tx_handlers_drop_not_assoc; 741e9f207f0SJiri Benc struct dentry *tx_handlers_drop_unauth_port; 742e9f207f0SJiri Benc struct dentry *rx_handlers_drop; 743e9f207f0SJiri Benc struct dentry *rx_handlers_queued; 744e9f207f0SJiri Benc struct dentry *rx_handlers_drop_nullfunc; 745e9f207f0SJiri Benc struct dentry *rx_handlers_drop_defrag; 746e9f207f0SJiri Benc struct dentry *rx_handlers_drop_short; 747e9f207f0SJiri Benc struct dentry *rx_handlers_drop_passive_scan; 748e9f207f0SJiri Benc struct dentry *tx_expand_skb_head; 749e9f207f0SJiri Benc struct dentry *tx_expand_skb_head_cloned; 750e9f207f0SJiri Benc struct dentry *rx_expand_skb_head; 751e9f207f0SJiri Benc struct dentry *rx_expand_skb_head2; 752e9f207f0SJiri Benc struct dentry *rx_handlers_fragments; 753e9f207f0SJiri Benc struct dentry *tx_status_drop; 754e9f207f0SJiri Benc #endif 755e9f207f0SJiri Benc struct dentry *dot11ACKFailureCount; 756e9f207f0SJiri Benc struct dentry *dot11RTSFailureCount; 757e9f207f0SJiri Benc struct dentry *dot11FCSErrorCount; 758e9f207f0SJiri Benc struct dentry *dot11RTSSuccessCount; 759e9f207f0SJiri Benc } stats; 760e9f207f0SJiri Benc struct dentry *stations; 761e9f207f0SJiri Benc struct dentry *keys; 762e9f207f0SJiri Benc } debugfs; 763e9f207f0SJiri Benc #endif 764f0706e82SJiri Benc }; 765f0706e82SJiri Benc 7663e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 7673e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) 7683e122be0SJohannes Berg { 7693e122be0SJohannes Berg struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 7703e122be0SJohannes Berg 7713e122be0SJohannes Berg BUG_ON(!local || local->mdev == dev); 7723e122be0SJohannes Berg 7733e122be0SJohannes Berg return netdev_priv(dev); 7743e122be0SJohannes Berg } 7753e122be0SJohannes Berg 776eadc8d9eSRon Rindjunsky /* this struct represents 802.11n's RA/TID combination */ 777eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid { 778eadc8d9eSRon Rindjunsky u8 ra[ETH_ALEN]; 779eadc8d9eSRon Rindjunsky u16 tid; 780eadc8d9eSRon Rindjunsky }; 781eadc8d9eSRon Rindjunsky 782ee385855SLuis Carlos Cobo /* Parsed Information Elements */ 783ee385855SLuis Carlos Cobo struct ieee802_11_elems { 78443ac2ca3SJouni Malinen u8 *ie_start; 78543ac2ca3SJouni Malinen size_t total_len; 78643ac2ca3SJouni Malinen 787ee385855SLuis Carlos Cobo /* pointers to IEs */ 788ee385855SLuis Carlos Cobo u8 *ssid; 789ee385855SLuis Carlos Cobo u8 *supp_rates; 790ee385855SLuis Carlos Cobo u8 *fh_params; 791ee385855SLuis Carlos Cobo u8 *ds_params; 792ee385855SLuis Carlos Cobo u8 *cf_params; 793ee385855SLuis Carlos Cobo u8 *tim; 794ee385855SLuis Carlos Cobo u8 *ibss_params; 795ee385855SLuis Carlos Cobo u8 *challenge; 796ee385855SLuis Carlos Cobo u8 *wpa; 797ee385855SLuis Carlos Cobo u8 *rsn; 798ee385855SLuis Carlos Cobo u8 *erp_info; 799ee385855SLuis Carlos Cobo u8 *ext_supp_rates; 800ee385855SLuis Carlos Cobo u8 *wmm_info; 801ee385855SLuis Carlos Cobo u8 *wmm_param; 80209914813SJohannes Berg struct ieee80211_ht_cap *ht_cap_elem; 803d9fe60deSJohannes Berg struct ieee80211_ht_info *ht_info_elem; 804ee385855SLuis Carlos Cobo u8 *mesh_config; 805ee385855SLuis Carlos Cobo u8 *mesh_id; 806ee385855SLuis Carlos Cobo u8 *peer_link; 807ee385855SLuis Carlos Cobo u8 *preq; 808ee385855SLuis Carlos Cobo u8 *prep; 809ee385855SLuis Carlos Cobo u8 *perr; 810f2df3859SAssaf Krauss u8 *ch_switch_elem; 811f2df3859SAssaf Krauss u8 *country_elem; 812f2df3859SAssaf Krauss u8 *pwr_constr_elem; 813f2df3859SAssaf Krauss u8 *quiet_elem; /* first quite element */ 814ee385855SLuis Carlos Cobo 815ee385855SLuis Carlos Cobo /* length of them, respectively */ 816ee385855SLuis Carlos Cobo u8 ssid_len; 817ee385855SLuis Carlos Cobo u8 supp_rates_len; 818ee385855SLuis Carlos Cobo u8 fh_params_len; 819ee385855SLuis Carlos Cobo u8 ds_params_len; 820ee385855SLuis Carlos Cobo u8 cf_params_len; 821ee385855SLuis Carlos Cobo u8 tim_len; 822ee385855SLuis Carlos Cobo u8 ibss_params_len; 823ee385855SLuis Carlos Cobo u8 challenge_len; 824ee385855SLuis Carlos Cobo u8 wpa_len; 825ee385855SLuis Carlos Cobo u8 rsn_len; 826ee385855SLuis Carlos Cobo u8 erp_info_len; 827ee385855SLuis Carlos Cobo u8 ext_supp_rates_len; 828ee385855SLuis Carlos Cobo u8 wmm_info_len; 829ee385855SLuis Carlos Cobo u8 wmm_param_len; 830ee385855SLuis Carlos Cobo u8 mesh_config_len; 831ee385855SLuis Carlos Cobo u8 mesh_id_len; 832ee385855SLuis Carlos Cobo u8 peer_link_len; 833ee385855SLuis Carlos Cobo u8 preq_len; 834ee385855SLuis Carlos Cobo u8 prep_len; 835ee385855SLuis Carlos Cobo u8 perr_len; 836f2df3859SAssaf Krauss u8 ch_switch_elem_len; 837f2df3859SAssaf Krauss u8 country_elem_len; 838f2df3859SAssaf Krauss u8 pwr_constr_elem_len; 839f2df3859SAssaf Krauss u8 quiet_elem_len; 840f2df3859SAssaf Krauss u8 num_of_quiet_elem; /* can be more the one */ 841ee385855SLuis Carlos Cobo }; 842ee385855SLuis Carlos Cobo 843f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 844f0706e82SJiri Benc struct ieee80211_hw *hw) 845f0706e82SJiri Benc { 846f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 847f0706e82SJiri Benc } 848f0706e82SJiri Benc 849f0706e82SJiri Benc static inline struct ieee80211_hw *local_to_hw( 850f0706e82SJiri Benc struct ieee80211_local *local) 851f0706e82SJiri Benc { 852f0706e82SJiri Benc return &local->hw; 853f0706e82SJiri Benc } 854f0706e82SJiri Benc 855f0706e82SJiri Benc 856571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) 857571ecf67SJohannes Berg { 858571ecf67SJohannes Berg return compare_ether_addr(raddr, addr) == 0 || 859571ecf67SJohannes Berg is_broadcast_ether_addr(raddr); 860571ecf67SJohannes Berg } 861571ecf67SJohannes Berg 862571ecf67SJohannes Berg 863e8975581SJohannes Berg int ieee80211_hw_config(struct ieee80211_local *local, u32 changed); 8649d139c81SJohannes Berg int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed); 8655cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 8669c6bd790SJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 8679c6bd790SJohannes Berg u32 changed); 8680d143fe1SJohannes Berg void ieee80211_configure_filter(struct ieee80211_local *local); 869f0706e82SJiri Benc 8709c6bd790SJohannes Berg /* wireless extensions */ 871f0706e82SJiri Benc extern const struct iw_handler_def ieee80211_iw_handler_def; 87265b53e4cSDavid S. Miller 8739c6bd790SJohannes Berg /* STA/IBSS code */ 8749c6bd790SJohannes Berg void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata); 875c2b13452SJohannes Berg void ieee80211_scan_work(struct work_struct *work); 876f698d856SJasper Bryant-Greene void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 877f0706e82SJiri Benc struct ieee80211_rx_status *rx_status); 878f698d856SJasper Bryant-Greene int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len); 879f698d856SJasper Bryant-Greene int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len); 880f698d856SJasper Bryant-Greene int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid); 881f698d856SJasper Bryant-Greene void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, 882f0706e82SJiri Benc struct ieee80211_if_sta *ifsta); 8839c6bd790SJohannes Berg struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, 884ab1f5c0bSRami Rosen u8 *bssid, u8 *addr, u64 supp_rates); 8859c6bd790SJohannes Berg int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason); 8869c6bd790SJohannes Berg int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason); 8879c6bd790SJohannes Berg u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 8889c6bd790SJohannes Berg u64 ieee80211_sta_get_rates(struct ieee80211_local *local, 8899c6bd790SJohannes Berg struct ieee802_11_elems *elems, 8909c6bd790SJohannes Berg enum ieee80211_band band); 8919c6bd790SJohannes Berg void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, 8929c6bd790SJohannes Berg u8 *ssid, size_t ssid_len); 8939c6bd790SJohannes Berg 8949c6bd790SJohannes Berg /* scan/BSS handling */ 895c2b13452SJohannes Berg int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata, 896c2b13452SJohannes Berg u8 *ssid, size_t ssid_len); 897c2b13452SJohannes Berg int ieee80211_scan_results(struct ieee80211_local *local, 898ccc58057SDavid S. Miller struct iw_request_info *info, 899ccc58057SDavid S. Miller char *buf, size_t len); 900c2b13452SJohannes Berg ieee80211_rx_result 901c2b13452SJohannes Berg ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, 902c2b13452SJohannes Berg struct sk_buff *skb, 903f0706e82SJiri Benc struct ieee80211_rx_status *rx_status); 9043e122be0SJohannes Berg void ieee80211_rx_bss_list_init(struct ieee80211_local *local); 9053e122be0SJohannes Berg void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local); 906c2b13452SJohannes Berg int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, 907c2b13452SJohannes Berg char *ie, size_t len); 9089c6bd790SJohannes Berg 9090a51b27eSJohannes Berg void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local); 910c2b13452SJohannes Berg int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata, 9110a51b27eSJohannes Berg u8 *ssid, size_t ssid_len); 912c2b13452SJohannes Berg struct ieee80211_bss * 91398c8fccfSJohannes Berg ieee80211_bss_info_update(struct ieee80211_local *local, 91498c8fccfSJohannes Berg struct ieee80211_rx_status *rx_status, 91598c8fccfSJohannes Berg struct ieee80211_mgmt *mgmt, 91698c8fccfSJohannes Berg size_t len, 91798c8fccfSJohannes Berg struct ieee802_11_elems *elems, 91898c8fccfSJohannes Berg int freq, bool beacon); 919c2b13452SJohannes Berg struct ieee80211_bss * 9205484e237SJohannes Berg ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq, 9215484e237SJohannes Berg u8 *ssid, u8 ssid_len); 922c2b13452SJohannes Berg struct ieee80211_bss * 9235484e237SJohannes Berg ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq, 9245484e237SJohannes Berg u8 *ssid, u8 ssid_len); 92598c8fccfSJohannes Berg void ieee80211_rx_bss_put(struct ieee80211_local *local, 926c2b13452SJohannes Berg struct ieee80211_bss *bss); 927ee385855SLuis Carlos Cobo 9283e122be0SJohannes Berg /* interface handling */ 9293e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 93005c914feSJohannes Berg struct net_device **new_dev, enum nl80211_iftype type, 931ee385855SLuis Carlos Cobo struct vif_params *params); 932f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 93305c914feSJohannes Berg enum nl80211_iftype type); 934f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 93575636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 936f0706e82SJiri Benc 937e2ebc74dSJohannes Berg /* tx handling */ 938e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 939e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data); 940e2ebc74dSJohannes Berg int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev); 941e2ebc74dSJohannes Berg int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev); 942e2ebc74dSJohannes Berg int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); 943e2ebc74dSJohannes Berg 944de1ede7aSJohannes Berg /* HT */ 945ae5eb026SJohannes Berg void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, 946ae5eb026SJohannes Berg struct ieee80211_ht_cap *ht_cap_ie, 947d9fe60deSJohannes Berg struct ieee80211_sta_ht_cap *ht_cap); 948ae5eb026SJohannes Berg u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, 949ae5eb026SJohannes Berg struct ieee80211_ht_info *hti, 950ae5eb026SJohannes Berg u16 ap_ht_cap_flags); 951de1ede7aSJohannes Berg void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); 952de1ede7aSJohannes Berg 953de1ede7aSJohannes Berg void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, 954de1ede7aSJohannes Berg u16 tid, u16 initiator, u16 reason); 955de1ede7aSJohannes Berg void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr); 956de1ede7aSJohannes Berg void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata, 957de1ede7aSJohannes Berg struct sta_info *sta, 958de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, size_t len); 959de1ede7aSJohannes Berg void ieee80211_process_addba_resp(struct ieee80211_local *local, 960de1ede7aSJohannes Berg struct sta_info *sta, 961de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 962de1ede7aSJohannes Berg size_t len); 963de1ede7aSJohannes Berg void ieee80211_process_addba_request(struct ieee80211_local *local, 964de1ede7aSJohannes Berg struct sta_info *sta, 965de1ede7aSJohannes Berg struct ieee80211_mgmt *mgmt, 966de1ede7aSJohannes Berg size_t len); 967de1ede7aSJohannes Berg 96839192c0bSJohannes Berg /* Spectrum management */ 96939192c0bSJohannes Berg void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata, 97039192c0bSJohannes Berg struct ieee80211_mgmt *mgmt, 97139192c0bSJohannes Berg size_t len); 972c481ec97SSujith void ieee80211_chswitch_timer(unsigned long data); 973c481ec97SSujith void ieee80211_chswitch_work(struct work_struct *work); 974c481ec97SSujith void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata, 975c481ec97SSujith struct ieee80211_channel_sw_ie *sw_elem, 976c481ec97SSujith struct ieee80211_bss *bss); 97739192c0bSJohannes Berg 978c2d1560aSJohannes Berg /* utility functions/constants */ 979c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */ 980c2d1560aSJohannes Berg extern const unsigned char rfc1042_header[6]; 981c2d1560aSJohannes Berg extern const unsigned char bridge_tunnel_header[6]; 98271364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 98305c914feSJohannes Berg enum nl80211_iftype type); 984c2d1560aSJohannes Berg int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, 985c2d1560aSJohannes Berg int rate, int erp, int short_preamble); 986f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 987eb063c17SJohannes Berg struct ieee80211_hdr *hdr); 9885825fe10SJohannes Berg void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata); 989e50db65cSJohannes Berg void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 990e50db65cSJohannes Berg int encrypt); 9919c6bd790SJohannes Berg void ieee802_11_parse_elems(u8 *start, size_t len, 9929c6bd790SJohannes Berg struct ieee802_11_elems *elems); 993e16751c3SJohannes Berg int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq); 99496dd22acSJohannes Berg u64 ieee80211_mandatory_rates(struct ieee80211_local *local, 99596dd22acSJohannes Berg enum ieee80211_band band); 996f0706e82SJiri Benc 997520eb820SKalle Valo void ieee80211_dynamic_ps_enable_work(struct work_struct *work); 998520eb820SKalle Valo void ieee80211_dynamic_ps_disable_work(struct work_struct *work); 999520eb820SKalle Valo void ieee80211_dynamic_ps_timer(unsigned long data); 1000a97b77b9SVivek Natarajan void ieee80211_send_nullfunc(struct ieee80211_local *local, 1001a97b77b9SVivek Natarajan struct ieee80211_sub_if_data *sdata, 1002a97b77b9SVivek Natarajan int powersave); 1003520eb820SKalle Valo 1004ce7c9111SKalle Valo void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw, 1005ce7c9111SKalle Valo enum queue_stop_reason reason); 1006ce7c9111SKalle Valo void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw, 1007ce7c9111SKalle Valo enum queue_stop_reason reason); 1008ce7c9111SKalle Valo 1009f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 1010d9e8a70fSJohannes Berg #define debug_noinline noinline 1011d9e8a70fSJohannes Berg #else 1012d9e8a70fSJohannes Berg #define debug_noinline 1013d9e8a70fSJohannes Berg #endif 1014d9e8a70fSJohannes Berg 1015f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 1016