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> 26f0706e82SJiri Benc #include <net/wireless.h> 27ccc58057SDavid S. Miller #include <net/iw_handler.h> 2851cb6db0SDavid S. Miller #include <net/mac80211.h> 292c8dccc7SJohannes Berg #include "key.h" 30f0706e82SJiri Benc #include "sta_info.h" 31f0706e82SJiri Benc 32f0706e82SJiri Benc /* ieee80211.o internal definitions, etc. These are not included into 33f0706e82SJiri Benc * low-level drivers. */ 34f0706e82SJiri Benc 359cfb0009SJohannes Berg struct ieee80211_local; 36f0706e82SJiri Benc 37f0706e82SJiri Benc /* Maximum number of broadcast/multicast frames to buffer when some of the 38f0706e82SJiri Benc * associated stations are using power saving. */ 39f0706e82SJiri Benc #define AP_MAX_BC_BUFFER 128 40f0706e82SJiri Benc 41f0706e82SJiri Benc /* Maximum number of frames buffered to all STAs, including multicast frames. 42f0706e82SJiri Benc * Note: increasing this limit increases the potential memory requirement. Each 43f0706e82SJiri Benc * frame can be up to about 2 kB long. */ 44f0706e82SJiri Benc #define TOTAL_MAX_TX_BUFFER 512 45f0706e82SJiri Benc 46f0706e82SJiri Benc /* Required encryption head and tailroom */ 47f0706e82SJiri Benc #define IEEE80211_ENCRYPT_HEADROOM 8 48f0706e82SJiri Benc #define IEEE80211_ENCRYPT_TAILROOM 12 49f0706e82SJiri Benc 50f0706e82SJiri Benc /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent 51f0706e82SJiri Benc * reception of at least three fragmented frames. This limit can be increased 52f0706e82SJiri Benc * by changing this define, at the cost of slower frame reassembly and 53f0706e82SJiri Benc * increased memory use (about 2 kB of RAM per entry). */ 54f0706e82SJiri Benc #define IEEE80211_FRAGMENT_MAX 4 55f0706e82SJiri Benc 56f0706e82SJiri Benc struct ieee80211_fragment_entry { 57f0706e82SJiri Benc unsigned long first_frag_time; 58f0706e82SJiri Benc unsigned int seq; 59f0706e82SJiri Benc unsigned int rx_queue; 60f0706e82SJiri Benc unsigned int last_frag; 61f0706e82SJiri Benc unsigned int extra_len; 62f0706e82SJiri Benc struct sk_buff_head skb_list; 63f0706e82SJiri Benc int ccmp; /* Whether fragments were encrypted with CCMP */ 64f0706e82SJiri Benc u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ 65f0706e82SJiri Benc }; 66f0706e82SJiri Benc 67f0706e82SJiri Benc 68f0706e82SJiri Benc struct ieee80211_sta_bss { 69f0706e82SJiri Benc struct list_head list; 70f0706e82SJiri Benc struct ieee80211_sta_bss *hnext; 71056cdd59SJohannes Berg size_t ssid_len; 72056cdd59SJohannes Berg 73f0706e82SJiri Benc atomic_t users; 74f0706e82SJiri Benc 75f0706e82SJiri Benc u8 bssid[ETH_ALEN]; 76f0706e82SJiri Benc u8 ssid[IEEE80211_MAX_SSID_LEN]; 7798f7dfd8SEmmanuel Grumbach u8 dtim_period; 78f0706e82SJiri Benc u16 capability; /* host byte order */ 798318d78aSJohannes Berg enum ieee80211_band band; 80f0706e82SJiri Benc int freq; 81566bfe5aSBruno Randolf int signal, noise, qual; 82f0706e82SJiri Benc u8 *wpa_ie; 83f0706e82SJiri Benc size_t wpa_ie_len; 84f0706e82SJiri Benc u8 *rsn_ie; 85f0706e82SJiri Benc size_t rsn_ie_len; 86f0706e82SJiri Benc u8 *wmm_ie; 87f0706e82SJiri Benc size_t wmm_ie_len; 88c7153508SRon Rindjunsky u8 *ht_ie; 89c7153508SRon Rindjunsky size_t ht_ie_len; 909306102eSEmmanuel Grumbach u8 *ht_add_ie; 919306102eSEmmanuel Grumbach size_t ht_add_ie_len; 92ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH 93ee385855SLuis Carlos Cobo u8 *mesh_id; 94ee385855SLuis Carlos Cobo size_t mesh_id_len; 9524736701SJohn W. Linville u8 *mesh_cfg; 96902acc78SJohannes Berg #endif 97f0706e82SJiri Benc #define IEEE80211_MAX_SUPP_RATES 32 98f0706e82SJiri Benc u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 99f0706e82SJiri Benc size_t supp_rates_len; 100f0706e82SJiri Benc u64 timestamp; 101056cdd59SJohannes Berg int beacon_int; 102f0706e82SJiri Benc 1039859b81eSRon Rindjunsky unsigned long last_probe_resp; 104f0706e82SJiri Benc unsigned long last_update; 105f0706e82SJiri Benc 1065628221cSDaniel Drake /* during assocation, we save an ERP value from a probe response so 1075628221cSDaniel Drake * that we can feed ERP info to the driver when handling the 1085628221cSDaniel Drake * association completes. these fields probably won't be up-to-date 1095628221cSDaniel Drake * otherwise, you probably don't want to use them. */ 1105628221cSDaniel Drake int has_erp_value; 1115628221cSDaniel Drake u8 erp_value; 112f0706e82SJiri Benc }; 113f0706e82SJiri Benc 11424736701SJohn W. Linville static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss) 115902acc78SJohannes Berg { 116902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 117902acc78SJohannes Berg return bss->mesh_cfg; 118902acc78SJohannes Berg #endif 119902acc78SJohannes Berg return NULL; 120902acc78SJohannes Berg } 121902acc78SJohannes Berg 122902acc78SJohannes Berg static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss) 123902acc78SJohannes Berg { 124902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 125902acc78SJohannes Berg return bss->mesh_id; 126902acc78SJohannes Berg #endif 127902acc78SJohannes Berg return NULL; 128902acc78SJohannes Berg } 129902acc78SJohannes Berg 130902acc78SJohannes Berg static inline u8 bss_mesh_id_len(struct ieee80211_sta_bss *bss) 131902acc78SJohannes Berg { 132902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 133902acc78SJohannes Berg return bss->mesh_id_len; 134902acc78SJohannes Berg #endif 135902acc78SJohannes Berg return 0; 136902acc78SJohannes Berg } 137902acc78SJohannes Berg 138f0706e82SJiri Benc 1399ae54c84SJohannes Berg typedef unsigned __bitwise__ ieee80211_tx_result; 1409ae54c84SJohannes Berg #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) 1419ae54c84SJohannes Berg #define TX_DROP ((__force ieee80211_tx_result) 1u) 1429ae54c84SJohannes Berg #define TX_QUEUED ((__force ieee80211_tx_result) 2u) 1439ae54c84SJohannes Berg 1445cf121c3SJohannes Berg #define IEEE80211_TX_FRAGMENTED BIT(0) 1455cf121c3SJohannes Berg #define IEEE80211_TX_UNICAST BIT(1) 1465cf121c3SJohannes Berg #define IEEE80211_TX_PS_BUFFERED BIT(2) 1475cf121c3SJohannes Berg #define IEEE80211_TX_PROBE_LAST_FRAG BIT(3) 1489ae54c84SJohannes Berg 1495cf121c3SJohannes Berg struct ieee80211_tx_data { 150f0706e82SJiri Benc struct sk_buff *skb; 151f0706e82SJiri Benc struct net_device *dev; 152f0706e82SJiri Benc struct ieee80211_local *local; 153f0706e82SJiri Benc struct ieee80211_sub_if_data *sdata; 154f0706e82SJiri Benc struct sta_info *sta; 155f0706e82SJiri Benc struct ieee80211_key *key; 1565cf121c3SJohannes Berg 1578318d78aSJohannes Berg struct ieee80211_channel *channel; 1582e92e6f2SJohannes Berg s8 rate_idx; 159f0706e82SJiri Benc /* use this rate (if set) for last fragment; rate can 160f0706e82SJiri Benc * be set to lower rate for the first fragments, e.g., 161f0706e82SJiri Benc * when using CTS protection with IEEE 802.11g. */ 1622e92e6f2SJohannes Berg s8 last_frag_rate_idx; 163f0706e82SJiri Benc 164f0706e82SJiri Benc /* Extra fragments (in addition to the first fragment 165f0706e82SJiri Benc * in skb) */ 166f0706e82SJiri Benc struct sk_buff **extra_frag; 167056cdd59SJohannes Berg int num_extra_frag; 168056cdd59SJohannes Berg 169a4b7d7bdSHarvey Harrison u16 ethertype; 170056cdd59SJohannes Berg unsigned int flags; 1715cf121c3SJohannes Berg }; 1725cf121c3SJohannes Berg 1735cf121c3SJohannes Berg 1745cf121c3SJohannes Berg typedef unsigned __bitwise__ ieee80211_rx_result; 1755cf121c3SJohannes Berg #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) 1765cf121c3SJohannes Berg #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) 1775cf121c3SJohannes Berg #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) 1785cf121c3SJohannes Berg #define RX_QUEUED ((__force ieee80211_rx_result) 3u) 1795cf121c3SJohannes Berg 1805cf121c3SJohannes Berg #define IEEE80211_RX_IN_SCAN BIT(0) 1815cf121c3SJohannes Berg /* frame is destined to interface currently processed (incl. multicast frames) */ 1825cf121c3SJohannes Berg #define IEEE80211_RX_RA_MATCH BIT(1) 1835cf121c3SJohannes Berg #define IEEE80211_RX_AMSDU BIT(2) 1845cf121c3SJohannes Berg #define IEEE80211_RX_CMNTR_REPORTED BIT(3) 1855cf121c3SJohannes Berg #define IEEE80211_RX_FRAGMENTED BIT(4) 1865cf121c3SJohannes Berg 1875cf121c3SJohannes Berg struct ieee80211_rx_data { 1885cf121c3SJohannes Berg struct sk_buff *skb; 1895cf121c3SJohannes Berg struct net_device *dev; 1905cf121c3SJohannes Berg struct ieee80211_local *local; 1915cf121c3SJohannes Berg struct ieee80211_sub_if_data *sdata; 1925cf121c3SJohannes Berg struct sta_info *sta; 1935cf121c3SJohannes Berg struct ieee80211_key *key; 194f0706e82SJiri Benc struct ieee80211_rx_status *status; 1958318d78aSJohannes Berg struct ieee80211_rate *rate; 196056cdd59SJohannes Berg 197a4b7d7bdSHarvey Harrison u16 ethertype; 198056cdd59SJohannes Berg unsigned int flags; 199f0706e82SJiri Benc int sent_ps_buffered; 200f0706e82SJiri Benc int queue; 20150741ae0SJohannes Berg u32 tkip_iv32; 20250741ae0SJohannes Berg u16 tkip_iv16; 203f0706e82SJiri Benc }; 204f0706e82SJiri Benc 205f0706e82SJiri Benc struct ieee80211_tx_stored_packet { 206f0706e82SJiri Benc struct sk_buff *skb; 207f0706e82SJiri Benc struct sk_buff **extra_frag; 2082e92e6f2SJohannes Berg s8 last_frag_rate_idx; 209056cdd59SJohannes Berg int num_extra_frag; 2102e92e6f2SJohannes Berg bool last_frag_rate_ctrl_probe; 211f0706e82SJiri Benc }; 212f0706e82SJiri Benc 2135dfdaf58SJohannes Berg struct beacon_data { 2145dfdaf58SJohannes Berg u8 *head, *tail; 2155dfdaf58SJohannes Berg int head_len, tail_len; 2165dfdaf58SJohannes Berg int dtim_period; 2175dfdaf58SJohannes Berg }; 2185dfdaf58SJohannes Berg 219f0706e82SJiri Benc struct ieee80211_if_ap { 2205dfdaf58SJohannes Berg struct beacon_data *beacon; 221f0706e82SJiri Benc 2220ec3ca44SJohannes Berg struct list_head vlans; 2230ec3ca44SJohannes Berg 224f0706e82SJiri Benc u8 ssid[IEEE80211_MAX_SSID_LEN]; 225f0706e82SJiri Benc size_t ssid_len; 226f0706e82SJiri Benc 227f0706e82SJiri Benc /* yes, this looks ugly, but guarantees that we can later use 228f0706e82SJiri Benc * bitmap_empty :) 229004c872eSJohannes Berg * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ 230f0706e82SJiri Benc u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; 231f0706e82SJiri Benc struct sk_buff_head ps_bc_buf; 232056cdd59SJohannes Berg atomic_t num_sta_ps; /* number of stations in PS mode */ 2335dfdaf58SJohannes Berg int dtim_count; 234f0706e82SJiri Benc int num_beacons; /* number of TXed beacon frames for this BSS */ 235f0706e82SJiri Benc }; 236f0706e82SJiri Benc 237f0706e82SJiri Benc struct ieee80211_if_wds { 238f0706e82SJiri Benc struct sta_info *sta; 239056cdd59SJohannes Berg u8 remote_addr[ETH_ALEN]; 240f0706e82SJiri Benc }; 241f0706e82SJiri Benc 242f0706e82SJiri Benc struct ieee80211_if_vlan { 2430ec3ca44SJohannes Berg struct list_head list; 244f0706e82SJiri Benc }; 245f0706e82SJiri Benc 246ee385855SLuis Carlos Cobo struct mesh_stats { 247ee385855SLuis Carlos Cobo __u32 fwded_frames; /* Mesh forwarded frames */ 248ee385855SLuis Carlos Cobo __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ 249ee385855SLuis Carlos Cobo __u32 dropped_frames_no_route; /* Not transmitted, no route found */ 250ee385855SLuis Carlos Cobo atomic_t estab_plinks; 251ee385855SLuis Carlos Cobo }; 252ee385855SLuis Carlos Cobo 253ee385855SLuis Carlos Cobo #define PREQ_Q_F_START 0x1 254ee385855SLuis Carlos Cobo #define PREQ_Q_F_REFRESH 0x2 255ee385855SLuis Carlos Cobo struct mesh_preq_queue { 256ee385855SLuis Carlos Cobo struct list_head list; 257ee385855SLuis Carlos Cobo u8 dst[ETH_ALEN]; 258ee385855SLuis Carlos Cobo u8 flags; 259ee385855SLuis Carlos Cobo }; 260ee385855SLuis Carlos Cobo 261ee385855SLuis Carlos Cobo struct mesh_config { 262ee385855SLuis Carlos Cobo /* Timeouts in ms */ 263ee385855SLuis Carlos Cobo /* Mesh plink management parameters */ 264ee385855SLuis Carlos Cobo u16 dot11MeshRetryTimeout; 265ee385855SLuis Carlos Cobo u16 dot11MeshConfirmTimeout; 266ee385855SLuis Carlos Cobo u16 dot11MeshHoldingTimeout; 267ee385855SLuis Carlos Cobo u16 dot11MeshMaxPeerLinks; 268ee385855SLuis Carlos Cobo u8 dot11MeshMaxRetries; 269ee385855SLuis Carlos Cobo u8 dot11MeshTTL; 270ee385855SLuis Carlos Cobo bool auto_open_plinks; 271ee385855SLuis Carlos Cobo /* HWMP parameters */ 272ee385855SLuis Carlos Cobo u8 dot11MeshHWMPmaxPREQretries; 273ee385855SLuis Carlos Cobo u32 path_refresh_time; 274ee385855SLuis Carlos Cobo u16 min_discovery_timeout; 275056cdd59SJohannes Berg u32 dot11MeshHWMPactivePathTimeout; 276056cdd59SJohannes Berg u16 dot11MeshHWMPpreqMinInterval; 277056cdd59SJohannes Berg u16 dot11MeshHWMPnetDiameterTraversalTime; 278ee385855SLuis Carlos Cobo }; 279902acc78SJohannes Berg 280ee385855SLuis Carlos Cobo 281d6f2da5bSJiri Slaby /* flags used in struct ieee80211_if_sta.flags */ 282d6f2da5bSJiri Slaby #define IEEE80211_STA_SSID_SET BIT(0) 283d6f2da5bSJiri Slaby #define IEEE80211_STA_BSSID_SET BIT(1) 284d6f2da5bSJiri Slaby #define IEEE80211_STA_PREV_BSSID_SET BIT(2) 285d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTHENTICATED BIT(3) 286d6f2da5bSJiri Slaby #define IEEE80211_STA_ASSOCIATED BIT(4) 287d6f2da5bSJiri Slaby #define IEEE80211_STA_PROBEREQ_POLL BIT(5) 288d6f2da5bSJiri Slaby #define IEEE80211_STA_CREATE_IBSS BIT(6) 289d6f2da5bSJiri Slaby #define IEEE80211_STA_MIXED_CELL BIT(7) 290d6f2da5bSJiri Slaby #define IEEE80211_STA_WMM_ENABLED BIT(8) 291d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) 292d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) 293d6f2da5bSJiri Slaby #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) 2945b98b1f7SJohannes Berg #define IEEE80211_STA_PRIVACY_INVOKED BIT(13) 29548c2fc59STomas Winkler /* flags for MLME request*/ 29648c2fc59STomas Winkler #define IEEE80211_STA_REQ_SCAN 0 2979859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_DIRECT_PROBE 1 2989859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_AUTH 2 2999859b81eSRon Rindjunsky #define IEEE80211_STA_REQ_RUN 3 30048c2fc59STomas Winkler 30148c2fc59STomas Winkler /* flags used for setting mlme state */ 30248c2fc59STomas Winkler enum ieee80211_sta_mlme_state { 30348c2fc59STomas Winkler IEEE80211_STA_MLME_DISABLED, 3049859b81eSRon Rindjunsky IEEE80211_STA_MLME_DIRECT_PROBE, 30548c2fc59STomas Winkler IEEE80211_STA_MLME_AUTHENTICATE, 30648c2fc59STomas Winkler IEEE80211_STA_MLME_ASSOCIATE, 30748c2fc59STomas Winkler IEEE80211_STA_MLME_ASSOCIATED, 30848c2fc59STomas Winkler IEEE80211_STA_MLME_IBSS_SEARCH, 30948c2fc59STomas Winkler IEEE80211_STA_MLME_IBSS_JOINED, 31048c2fc59STomas Winkler IEEE80211_STA_MLME_MESH_UP 31148c2fc59STomas Winkler }; 31248c2fc59STomas Winkler 31348c2fc59STomas Winkler /* bitfield of allowed auth algs */ 31448c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_OPEN BIT(0) 31548c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1) 31648c2fc59STomas Winkler #define IEEE80211_AUTH_ALG_LEAP BIT(2) 31748c2fc59STomas Winkler 318f0706e82SJiri Benc struct ieee80211_if_sta { 319056cdd59SJohannes Berg struct timer_list timer; 320056cdd59SJohannes Berg struct work_struct work; 321056cdd59SJohannes Berg u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 322056cdd59SJohannes Berg u8 ssid[IEEE80211_MAX_SSID_LEN]; 32348c2fc59STomas Winkler enum ieee80211_sta_mlme_state state; 324f0706e82SJiri Benc size_t ssid_len; 325a0af5f14SHelmut Schaa u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; 326a0af5f14SHelmut Schaa size_t scan_ssid_len; 327ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH 328ee385855SLuis Carlos Cobo struct timer_list mesh_path_timer; 329ee385855SLuis Carlos Cobo u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; 330ee385855SLuis Carlos Cobo size_t mesh_id_len; 331ee385855SLuis Carlos Cobo /* Active Path Selection Protocol Identifier */ 332ee385855SLuis Carlos Cobo u8 mesh_pp_id[4]; 333ee385855SLuis Carlos Cobo /* Active Path Selection Metric Identifier */ 334ee385855SLuis Carlos Cobo u8 mesh_pm_id[4]; 335ee385855SLuis Carlos Cobo /* Congestion Control Mode Identifier */ 336ee385855SLuis Carlos Cobo u8 mesh_cc_id[4]; 337ee385855SLuis Carlos Cobo /* Local mesh Destination Sequence Number */ 338ee385855SLuis Carlos Cobo u32 dsn; 339ee385855SLuis Carlos Cobo /* Last used PREQ ID */ 340ee385855SLuis Carlos Cobo u32 preq_id; 341ee385855SLuis Carlos Cobo atomic_t mpaths; 342ee385855SLuis Carlos Cobo /* Timestamp of last DSN update */ 343ee385855SLuis Carlos Cobo unsigned long last_dsn_update; 344ee385855SLuis Carlos Cobo /* Timestamp of last DSN sent */ 345ee385855SLuis Carlos Cobo unsigned long last_preq; 346ee385855SLuis Carlos Cobo struct mesh_rmc *rmc; 347ee385855SLuis Carlos Cobo spinlock_t mesh_preq_queue_lock; 348ee385855SLuis Carlos Cobo struct mesh_preq_queue preq_queue; 349ee385855SLuis Carlos Cobo int preq_queue_len; 350ee385855SLuis Carlos Cobo struct mesh_stats mshstats; 351ee385855SLuis Carlos Cobo struct mesh_config mshcfg; 35251ceddadSLuis Carlos Cobo u32 mesh_seqnum; 353056cdd59SJohannes Berg bool accepting_plinks; 354ee385855SLuis Carlos Cobo #endif 355f0706e82SJiri Benc u16 aid; 356f0706e82SJiri Benc u16 ap_capab, capab; 357f0706e82SJiri Benc u8 *extra_ie; /* to be added to the end of AssocReq */ 358f0706e82SJiri Benc size_t extra_ie_len; 359f0706e82SJiri Benc 360f0706e82SJiri Benc /* The last AssocReq/Resp IEs */ 361f0706e82SJiri Benc u8 *assocreq_ies, *assocresp_ies; 362f0706e82SJiri Benc size_t assocreq_ies_len, assocresp_ies_len; 363f0706e82SJiri Benc 364056cdd59SJohannes Berg struct sk_buff_head skb_queue; 365056cdd59SJohannes Berg 3666042a3e3SRon Rindjunsky int assoc_scan_tries; /* number of scans done pre-association */ 3679859b81eSRon Rindjunsky int direct_probe_tries; /* retries for direct probes */ 3686042a3e3SRon Rindjunsky int auth_tries; /* retries for auth req */ 3696042a3e3SRon Rindjunsky int assoc_tries; /* retries for assoc req */ 370f0706e82SJiri Benc 371056cdd59SJohannes Berg unsigned long request; 372056cdd59SJohannes Berg 373056cdd59SJohannes Berg unsigned long last_probe; 374056cdd59SJohannes Berg 375d6f2da5bSJiri Slaby unsigned int flags; 376f0706e82SJiri Benc 377f0706e82SJiri Benc unsigned int auth_algs; /* bitfield of allowed auth algs */ 378f0706e82SJiri Benc int auth_alg; /* currently used IEEE 802.11 authentication algorithm */ 379f0706e82SJiri Benc int auth_transaction; 380f0706e82SJiri Benc 381f0706e82SJiri Benc unsigned long ibss_join_req; 382f0706e82SJiri Benc struct sk_buff *probe_resp; /* ProbeResp template for IBSS */ 3838318d78aSJohannes Berg u32 supp_rates_bits[IEEE80211_NUM_BANDS]; 384f0706e82SJiri Benc 385f0706e82SJiri Benc int wmm_last_param_set; 386ee385855SLuis Carlos Cobo int num_beacons; /* number of TXed beacon frames by this STA */ 387f0706e82SJiri Benc }; 388f0706e82SJiri Benc 389902acc78SJohannes Berg static inline void ieee80211_if_sta_set_mesh_id(struct ieee80211_if_sta *ifsta, 390902acc78SJohannes Berg u8 mesh_id_len, u8 *mesh_id) 391902acc78SJohannes Berg { 392902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 393902acc78SJohannes Berg ifsta->mesh_id_len = mesh_id_len; 394902acc78SJohannes Berg memcpy(ifsta->mesh_id, mesh_id, mesh_id_len); 395902acc78SJohannes Berg #endif 396902acc78SJohannes Berg } 397902acc78SJohannes Berg 398902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 399902acc78SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(sta, name) \ 400902acc78SJohannes Berg do { (sta)->mshstats.name++; } while (0) 401902acc78SJohannes Berg #else 402902acc78SJohannes Berg #define IEEE80211_IFSTA_MESH_CTR_INC(sta, name) \ 403902acc78SJohannes Berg do { } while (0) 404902acc78SJohannes Berg #endif 405f0706e82SJiri Benc 40613262ffdSJiri Slaby /* flags used in struct ieee80211_sub_if_data.flags */ 40713262ffdSJiri Slaby #define IEEE80211_SDATA_ALLMULTI BIT(0) 40813262ffdSJiri Slaby #define IEEE80211_SDATA_PROMISC BIT(1) 409471b3efdSJohannes Berg #define IEEE80211_SDATA_USERSPACE_MLME BIT(2) 4108318d78aSJohannes Berg #define IEEE80211_SDATA_OPERATING_GMODE BIT(3) 411f0706e82SJiri Benc struct ieee80211_sub_if_data { 412f0706e82SJiri Benc struct list_head list; 413f0706e82SJiri Benc 414f0706e82SJiri Benc struct wireless_dev wdev; 415f0706e82SJiri Benc 41611a843b7SJohannes Berg /* keys */ 41711a843b7SJohannes Berg struct list_head key_list; 41811a843b7SJohannes Berg 419f0706e82SJiri Benc struct net_device *dev; 420f0706e82SJiri Benc struct ieee80211_local *local; 421f0706e82SJiri Benc 42213262ffdSJiri Slaby unsigned int flags; 4237e9ed188SDaniel Drake 424f0706e82SJiri Benc int drop_unencrypted; 425f0706e82SJiri Benc 4268318d78aSJohannes Berg /* 4278318d78aSJohannes Berg * basic rates of this AP or the AP we're associated to 4288318d78aSJohannes Berg */ 4298318d78aSJohannes Berg u64 basic_rates; 4308318d78aSJohannes Berg 431f0706e82SJiri Benc /* Fragment table for host-based reassembly */ 432f0706e82SJiri Benc struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; 433f0706e82SJiri Benc unsigned int fragment_next; 434f0706e82SJiri Benc 435f0706e82SJiri Benc #define NUM_DEFAULT_KEYS 4 436f0706e82SJiri Benc struct ieee80211_key *keys[NUM_DEFAULT_KEYS]; 437f0706e82SJiri Benc struct ieee80211_key *default_key; 438f0706e82SJiri Benc 4393e122be0SJohannes Berg /* BSS configuration for this interface. */ 440471b3efdSJohannes Berg struct ieee80211_bss_conf bss_conf; 4413e122be0SJohannes Berg 4423e122be0SJohannes Berg /* 4433e122be0SJohannes Berg * AP this belongs to: self in AP mode and 4443e122be0SJohannes Berg * corresponding AP in VLAN mode, NULL for 4453e122be0SJohannes Berg * all others (might be needed later in IBSS) 4463e122be0SJohannes Berg */ 4473e122be0SJohannes Berg struct ieee80211_if_ap *bss; 4483e122be0SJohannes Berg 4493e122be0SJohannes Berg int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ 4503e122be0SJohannes Berg int max_ratectrl_rateidx; /* max TX rateidx for rate control */ 451f0706e82SJiri Benc 452f0706e82SJiri Benc union { 453f0706e82SJiri Benc struct ieee80211_if_ap ap; 454f0706e82SJiri Benc struct ieee80211_if_wds wds; 455f0706e82SJiri Benc struct ieee80211_if_vlan vlan; 456f0706e82SJiri Benc struct ieee80211_if_sta sta; 4578cc9a739SMichael Wu u32 mntr_flags; 458f0706e82SJiri Benc } u; 459e9f207f0SJiri Benc 460e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 461e9f207f0SJiri Benc struct dentry *debugfsdir; 462e9f207f0SJiri Benc union { 463e9f207f0SJiri Benc struct { 464e9f207f0SJiri Benc struct dentry *drop_unencrypted; 465e9f207f0SJiri Benc struct dentry *state; 466e9f207f0SJiri Benc struct dentry *bssid; 467e9f207f0SJiri Benc struct dentry *prev_bssid; 468e9f207f0SJiri Benc struct dentry *ssid_len; 469e9f207f0SJiri Benc struct dentry *aid; 470e9f207f0SJiri Benc struct dentry *ap_capab; 471e9f207f0SJiri Benc struct dentry *capab; 472e9f207f0SJiri Benc struct dentry *extra_ie_len; 473e9f207f0SJiri Benc struct dentry *auth_tries; 474e9f207f0SJiri Benc struct dentry *assoc_tries; 475e9f207f0SJiri Benc struct dentry *auth_algs; 476e9f207f0SJiri Benc struct dentry *auth_alg; 477e9f207f0SJiri Benc struct dentry *auth_transaction; 478e9f207f0SJiri Benc struct dentry *flags; 479ee385855SLuis Carlos Cobo struct dentry *num_beacons_sta; 480e9f207f0SJiri Benc } sta; 481e9f207f0SJiri Benc struct { 482e9f207f0SJiri Benc struct dentry *drop_unencrypted; 483e9f207f0SJiri Benc struct dentry *num_sta_ps; 484e9f207f0SJiri Benc struct dentry *dtim_count; 485e9f207f0SJiri Benc struct dentry *num_beacons; 486e9f207f0SJiri Benc struct dentry *force_unicast_rateidx; 487e9f207f0SJiri Benc struct dentry *max_ratectrl_rateidx; 488e9f207f0SJiri Benc struct dentry *num_buffered_multicast; 489e9f207f0SJiri Benc } ap; 490e9f207f0SJiri Benc struct { 491e9f207f0SJiri Benc struct dentry *drop_unencrypted; 492e9f207f0SJiri Benc struct dentry *peer; 493e9f207f0SJiri Benc } wds; 494e9f207f0SJiri Benc struct { 495e9f207f0SJiri Benc struct dentry *drop_unencrypted; 496e9f207f0SJiri Benc } vlan; 497e9f207f0SJiri Benc struct { 498e9f207f0SJiri Benc struct dentry *mode; 499e9f207f0SJiri Benc } monitor; 500e9f207f0SJiri Benc struct dentry *default_key; 501e9f207f0SJiri Benc } debugfs; 502ee385855SLuis Carlos Cobo 503ee385855SLuis Carlos Cobo #ifdef CONFIG_MAC80211_MESH 504ee385855SLuis Carlos Cobo struct dentry *mesh_stats_dir; 505ee385855SLuis Carlos Cobo struct { 506ee385855SLuis Carlos Cobo struct dentry *fwded_frames; 507ee385855SLuis Carlos Cobo struct dentry *dropped_frames_ttl; 508ee385855SLuis Carlos Cobo struct dentry *dropped_frames_no_route; 509ee385855SLuis Carlos Cobo struct dentry *estab_plinks; 510ee385855SLuis Carlos Cobo struct timer_list mesh_path_timer; 511ee385855SLuis Carlos Cobo } mesh_stats; 512ee385855SLuis Carlos Cobo 513ee385855SLuis Carlos Cobo struct dentry *mesh_config_dir; 514ee385855SLuis Carlos Cobo struct { 515ee385855SLuis Carlos Cobo struct dentry *dot11MeshRetryTimeout; 516ee385855SLuis Carlos Cobo struct dentry *dot11MeshConfirmTimeout; 517ee385855SLuis Carlos Cobo struct dentry *dot11MeshHoldingTimeout; 518ee385855SLuis Carlos Cobo struct dentry *dot11MeshMaxRetries; 519ee385855SLuis Carlos Cobo struct dentry *dot11MeshTTL; 520ee385855SLuis Carlos Cobo struct dentry *auto_open_plinks; 521ee385855SLuis Carlos Cobo struct dentry *dot11MeshMaxPeerLinks; 522ee385855SLuis Carlos Cobo struct dentry *dot11MeshHWMPactivePathTimeout; 523ee385855SLuis Carlos Cobo struct dentry *dot11MeshHWMPpreqMinInterval; 524ee385855SLuis Carlos Cobo struct dentry *dot11MeshHWMPnetDiameterTraversalTime; 525ee385855SLuis Carlos Cobo struct dentry *dot11MeshHWMPmaxPREQretries; 526ee385855SLuis Carlos Cobo struct dentry *path_refresh_time; 527ee385855SLuis Carlos Cobo struct dentry *min_discovery_timeout; 528ee385855SLuis Carlos Cobo } mesh_config; 529ee385855SLuis Carlos Cobo #endif 530ee385855SLuis Carlos Cobo 531e9f207f0SJiri Benc #endif 53232bfd35dSJohannes Berg /* must be last, dynamically sized area in this! */ 53332bfd35dSJohannes Berg struct ieee80211_vif vif; 534f0706e82SJiri Benc }; 535f0706e82SJiri Benc 53632bfd35dSJohannes Berg static inline 53732bfd35dSJohannes Berg struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) 53832bfd35dSJohannes Berg { 53932bfd35dSJohannes Berg return container_of(p, struct ieee80211_sub_if_data, vif); 54032bfd35dSJohannes Berg } 54132bfd35dSJohannes Berg 542f0706e82SJiri Benc enum { 543f0706e82SJiri Benc IEEE80211_RX_MSG = 1, 544f0706e82SJiri Benc IEEE80211_TX_STATUS_MSG = 2, 545eadc8d9eSRon Rindjunsky IEEE80211_DELBA_MSG = 3, 546eadc8d9eSRon Rindjunsky IEEE80211_ADDBA_MSG = 4, 547f0706e82SJiri Benc }; 548f0706e82SJiri Benc 54951cb6db0SDavid S. Miller /* maximum number of hardware queues we support. */ 55051cb6db0SDavid S. Miller #define QD_MAX_QUEUES (IEEE80211_MAX_AMPDU_QUEUES + IEEE80211_MAX_QUEUES) 55151cb6db0SDavid S. Miller 552f0706e82SJiri Benc struct ieee80211_local { 553f0706e82SJiri Benc /* embed the driver visible part. 554f0706e82SJiri Benc * don't cast (use the static inlines below), but we keep 555f0706e82SJiri Benc * it first anyway so they become a no-op */ 556f0706e82SJiri Benc struct ieee80211_hw hw; 557f0706e82SJiri Benc 558f0706e82SJiri Benc const struct ieee80211_ops *ops; 559f0706e82SJiri Benc 56051cb6db0SDavid S. Miller unsigned long queue_pool[BITS_TO_LONGS(QD_MAX_QUEUES)]; 56151cb6db0SDavid S. Miller 562f0706e82SJiri Benc struct net_device *mdev; /* wmaster# - "master" 802.11 device */ 563f0706e82SJiri Benc int open_count; 5643d30d949SMichael Wu int monitors, cooked_mntrs; 5658cc9a739SMichael Wu /* number of interfaces with corresponding FIF_ flags */ 5668cc9a739SMichael Wu int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss; 5674150c572SJohannes Berg unsigned int filter_flags; /* FIF_* */ 568f0706e82SJiri Benc struct iw_statistics wstats; 569f0706e82SJiri Benc u8 wstats_flags; 570d0709a65SJohannes Berg bool tim_in_locked_section; /* see ieee80211_beacon_get() */ 571b306f453SJohannes Berg int tx_headroom; /* required headroom for hardware/radiotap */ 572f0706e82SJiri Benc 573f0706e82SJiri Benc /* Tasklet and skb queue to process calls from IRQ mode. All frames 574f0706e82SJiri Benc * added to skb_queue will be processed, but frames in 575f0706e82SJiri Benc * skb_queue_unreliable may be dropped if the total length of these 576f0706e82SJiri Benc * queues increases over the limit. */ 577f0706e82SJiri Benc #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 578f0706e82SJiri Benc struct tasklet_struct tasklet; 579f0706e82SJiri Benc struct sk_buff_head skb_queue; 580f0706e82SJiri Benc struct sk_buff_head skb_queue_unreliable; 581f0706e82SJiri Benc 582d0709a65SJohannes Berg /* Station data */ 583d0709a65SJohannes Berg /* 584d0709a65SJohannes Berg * The lock only protects the list, hash, timer and counter 585d0709a65SJohannes Berg * against manipulation, reads are done in RCU. Additionally, 586b16bd15cSJohannes Berg * the lock protects each BSS's TIM bitmap. 587d0709a65SJohannes Berg */ 588d0709a65SJohannes Berg spinlock_t sta_lock; 589d0709a65SJohannes Berg unsigned long num_sta; 590f0706e82SJiri Benc struct list_head sta_list; 591dc6676b7SJohannes Berg struct list_head sta_flush_list; 592dc6676b7SJohannes Berg struct work_struct sta_flush_work; 593f0706e82SJiri Benc struct sta_info *sta_hash[STA_HASH_SIZE]; 594f0706e82SJiri Benc struct timer_list sta_cleanup; 595f0706e82SJiri Benc 596e2530083SJohannes Berg unsigned long queues_pending[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)]; 597f8e79dddSTomas Winkler unsigned long queues_pending_run[BITS_TO_LONGS(IEEE80211_MAX_QUEUES)]; 598eefce91aSJohannes Berg struct ieee80211_tx_stored_packet pending_packet[IEEE80211_MAX_QUEUES]; 599f0706e82SJiri Benc struct tasklet_struct tx_pending_tasklet; 600f0706e82SJiri Benc 601f0706e82SJiri Benc /* number of interfaces with corresponding IFF_ flags */ 60253918994SJohannes Berg atomic_t iff_allmultis, iff_promiscs; 603f0706e82SJiri Benc 604f0706e82SJiri Benc struct rate_control_ref *rate_ctrl; 605f0706e82SJiri Benc 606f0706e82SJiri Benc int rts_threshold; 607f0706e82SJiri Benc int fragmentation_threshold; 608f0706e82SJiri Benc int short_retry_limit; /* dot11ShortRetryLimit */ 609f0706e82SJiri Benc int long_retry_limit; /* dot11LongRetryLimit */ 610f0706e82SJiri Benc 611f0706e82SJiri Benc struct crypto_blkcipher *wep_tx_tfm; 612f0706e82SJiri Benc struct crypto_blkcipher *wep_rx_tfm; 613f0706e82SJiri Benc u32 wep_iv; 614f0706e82SJiri Benc 615f0706e82SJiri Benc int bridge_packets; /* bridge packets between associated stations and 616f0706e82SJiri Benc * deliver multicast frames both back to wireless 617f0706e82SJiri Benc * media and to the local net stack */ 618f0706e82SJiri Benc 61979010420SJohannes Berg struct list_head interfaces; 62079010420SJohannes Berg 621b16bd15cSJohannes Berg /* 622b16bd15cSJohannes Berg * Key lock, protects sdata's key_list and sta_info's 623b16bd15cSJohannes Berg * key pointers (write access, they're RCU.) 624b16bd15cSJohannes Berg */ 625b16bd15cSJohannes Berg spinlock_t key_lock; 626b16bd15cSJohannes Berg 627b16bd15cSJohannes Berg 628ece8edddSZhu Yi bool sta_sw_scanning; 629ece8edddSZhu Yi bool sta_hw_scanning; 630f0706e82SJiri Benc int scan_channel_idx; 6318318d78aSJohannes Berg enum ieee80211_band scan_band; 6328318d78aSJohannes Berg 633f0706e82SJiri Benc enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state; 634f0706e82SJiri Benc unsigned long last_scan_completed; 635f0706e82SJiri Benc struct delayed_work scan_work; 636f0706e82SJiri Benc struct net_device *scan_dev; 637f0706e82SJiri Benc struct ieee80211_channel *oper_channel, *scan_channel; 638f0706e82SJiri Benc u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; 639f0706e82SJiri Benc size_t scan_ssid_len; 640f0706e82SJiri Benc struct list_head sta_bss_list; 641f0706e82SJiri Benc struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE]; 642f0706e82SJiri Benc spinlock_t sta_bss_lock; 643f0706e82SJiri Benc 644f0706e82SJiri Benc /* SNMP counters */ 645f0706e82SJiri Benc /* dot11CountersTable */ 646f0706e82SJiri Benc u32 dot11TransmittedFragmentCount; 647f0706e82SJiri Benc u32 dot11MulticastTransmittedFrameCount; 648f0706e82SJiri Benc u32 dot11FailedCount; 649f0706e82SJiri Benc u32 dot11RetryCount; 650f0706e82SJiri Benc u32 dot11MultipleRetryCount; 651f0706e82SJiri Benc u32 dot11FrameDuplicateCount; 652f0706e82SJiri Benc u32 dot11ReceivedFragmentCount; 653f0706e82SJiri Benc u32 dot11MulticastReceivedFrameCount; 654f0706e82SJiri Benc u32 dot11TransmittedFrameCount; 655f0706e82SJiri Benc u32 dot11WEPUndecryptableCount; 656f0706e82SJiri Benc 657f0706e82SJiri Benc #ifdef CONFIG_MAC80211_LEDS 658f0706e82SJiri Benc int tx_led_counter, rx_led_counter; 659cdcb006fSIvo van Doorn struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; 660cdcb006fSIvo van Doorn char tx_led_name[32], rx_led_name[32], 661cdcb006fSIvo van Doorn assoc_led_name[32], radio_led_name[32]; 662f0706e82SJiri Benc #endif 663f0706e82SJiri Benc 664e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 665e9f207f0SJiri Benc struct work_struct sta_debugfs_add; 666e9f207f0SJiri Benc #endif 667e9f207f0SJiri Benc 668f0706e82SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 669f0706e82SJiri Benc /* TX/RX handler statistics */ 670f0706e82SJiri Benc unsigned int tx_handlers_drop; 671f0706e82SJiri Benc unsigned int tx_handlers_queued; 672f0706e82SJiri Benc unsigned int tx_handlers_drop_unencrypted; 673f0706e82SJiri Benc unsigned int tx_handlers_drop_fragment; 674f0706e82SJiri Benc unsigned int tx_handlers_drop_wep; 675f0706e82SJiri Benc unsigned int tx_handlers_drop_not_assoc; 676f0706e82SJiri Benc unsigned int tx_handlers_drop_unauth_port; 677f0706e82SJiri Benc unsigned int rx_handlers_drop; 678f0706e82SJiri Benc unsigned int rx_handlers_queued; 679f0706e82SJiri Benc unsigned int rx_handlers_drop_nullfunc; 680f0706e82SJiri Benc unsigned int rx_handlers_drop_defrag; 681f0706e82SJiri Benc unsigned int rx_handlers_drop_short; 682f0706e82SJiri Benc unsigned int rx_handlers_drop_passive_scan; 683f0706e82SJiri Benc unsigned int tx_expand_skb_head; 684f0706e82SJiri Benc unsigned int tx_expand_skb_head_cloned; 685f0706e82SJiri Benc unsigned int rx_expand_skb_head; 686f0706e82SJiri Benc unsigned int rx_expand_skb_head2; 687f0706e82SJiri Benc unsigned int rx_handlers_fragments; 688f0706e82SJiri Benc unsigned int tx_status_drop; 689f0706e82SJiri Benc #define I802_DEBUG_INC(c) (c)++ 690f0706e82SJiri Benc #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ 691f0706e82SJiri Benc #define I802_DEBUG_INC(c) do { } while (0) 692f0706e82SJiri Benc #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ 693f0706e82SJiri Benc 694f0706e82SJiri Benc 695f0706e82SJiri Benc int total_ps_buffered; /* total number of all buffered unicast and 696f0706e82SJiri Benc * multicast packets for power saving stations 697f0706e82SJiri Benc */ 698f0706e82SJiri Benc int wifi_wme_noack_test; 699f0706e82SJiri Benc unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ 700f0706e82SJiri Benc 701e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUGFS 702e9f207f0SJiri Benc struct local_debugfsdentries { 703e9f207f0SJiri Benc struct dentry *frequency; 704e9f207f0SJiri Benc struct dentry *antenna_sel_tx; 705e9f207f0SJiri Benc struct dentry *antenna_sel_rx; 706e9f207f0SJiri Benc struct dentry *bridge_packets; 707e9f207f0SJiri Benc struct dentry *rts_threshold; 708e9f207f0SJiri Benc struct dentry *fragmentation_threshold; 709e9f207f0SJiri Benc struct dentry *short_retry_limit; 710e9f207f0SJiri Benc struct dentry *long_retry_limit; 711e9f207f0SJiri Benc struct dentry *total_ps_buffered; 712e9f207f0SJiri Benc struct dentry *wep_iv; 713e9f207f0SJiri Benc struct dentry *statistics; 714e9f207f0SJiri Benc struct local_debugfsdentries_statsdentries { 715e9f207f0SJiri Benc struct dentry *transmitted_fragment_count; 716e9f207f0SJiri Benc struct dentry *multicast_transmitted_frame_count; 717e9f207f0SJiri Benc struct dentry *failed_count; 718e9f207f0SJiri Benc struct dentry *retry_count; 719e9f207f0SJiri Benc struct dentry *multiple_retry_count; 720e9f207f0SJiri Benc struct dentry *frame_duplicate_count; 721e9f207f0SJiri Benc struct dentry *received_fragment_count; 722e9f207f0SJiri Benc struct dentry *multicast_received_frame_count; 723e9f207f0SJiri Benc struct dentry *transmitted_frame_count; 724e9f207f0SJiri Benc struct dentry *wep_undecryptable_count; 725e9f207f0SJiri Benc struct dentry *num_scans; 726e9f207f0SJiri Benc #ifdef CONFIG_MAC80211_DEBUG_COUNTERS 727e9f207f0SJiri Benc struct dentry *tx_handlers_drop; 728e9f207f0SJiri Benc struct dentry *tx_handlers_queued; 729e9f207f0SJiri Benc struct dentry *tx_handlers_drop_unencrypted; 730e9f207f0SJiri Benc struct dentry *tx_handlers_drop_fragment; 731e9f207f0SJiri Benc struct dentry *tx_handlers_drop_wep; 732e9f207f0SJiri Benc struct dentry *tx_handlers_drop_not_assoc; 733e9f207f0SJiri Benc struct dentry *tx_handlers_drop_unauth_port; 734e9f207f0SJiri Benc struct dentry *rx_handlers_drop; 735e9f207f0SJiri Benc struct dentry *rx_handlers_queued; 736e9f207f0SJiri Benc struct dentry *rx_handlers_drop_nullfunc; 737e9f207f0SJiri Benc struct dentry *rx_handlers_drop_defrag; 738e9f207f0SJiri Benc struct dentry *rx_handlers_drop_short; 739e9f207f0SJiri Benc struct dentry *rx_handlers_drop_passive_scan; 740e9f207f0SJiri Benc struct dentry *tx_expand_skb_head; 741e9f207f0SJiri Benc struct dentry *tx_expand_skb_head_cloned; 742e9f207f0SJiri Benc struct dentry *rx_expand_skb_head; 743e9f207f0SJiri Benc struct dentry *rx_expand_skb_head2; 744e9f207f0SJiri Benc struct dentry *rx_handlers_fragments; 745e9f207f0SJiri Benc struct dentry *tx_status_drop; 746e9f207f0SJiri Benc #endif 747e9f207f0SJiri Benc struct dentry *dot11ACKFailureCount; 748e9f207f0SJiri Benc struct dentry *dot11RTSFailureCount; 749e9f207f0SJiri Benc struct dentry *dot11FCSErrorCount; 750e9f207f0SJiri Benc struct dentry *dot11RTSSuccessCount; 751e9f207f0SJiri Benc } stats; 752e9f207f0SJiri Benc struct dentry *stations; 753e9f207f0SJiri Benc struct dentry *keys; 754e9f207f0SJiri Benc } debugfs; 755e9f207f0SJiri Benc #endif 756f0706e82SJiri Benc }; 757f0706e82SJiri Benc 7583e122be0SJohannes Berg static inline struct ieee80211_sub_if_data * 7593e122be0SJohannes Berg IEEE80211_DEV_TO_SUB_IF(struct net_device *dev) 7603e122be0SJohannes Berg { 7613e122be0SJohannes Berg struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 7623e122be0SJohannes Berg 7633e122be0SJohannes Berg BUG_ON(!local || local->mdev == dev); 7643e122be0SJohannes Berg 7653e122be0SJohannes Berg return netdev_priv(dev); 7663e122be0SJohannes Berg } 7673e122be0SJohannes Berg 768eadc8d9eSRon Rindjunsky /* this struct represents 802.11n's RA/TID combination */ 769eadc8d9eSRon Rindjunsky struct ieee80211_ra_tid { 770eadc8d9eSRon Rindjunsky u8 ra[ETH_ALEN]; 771eadc8d9eSRon Rindjunsky u16 tid; 772eadc8d9eSRon Rindjunsky }; 773eadc8d9eSRon Rindjunsky 774ee385855SLuis Carlos Cobo /* Parsed Information Elements */ 775ee385855SLuis Carlos Cobo struct ieee802_11_elems { 776ee385855SLuis Carlos Cobo /* pointers to IEs */ 777ee385855SLuis Carlos Cobo u8 *ssid; 778ee385855SLuis Carlos Cobo u8 *supp_rates; 779ee385855SLuis Carlos Cobo u8 *fh_params; 780ee385855SLuis Carlos Cobo u8 *ds_params; 781ee385855SLuis Carlos Cobo u8 *cf_params; 782ee385855SLuis Carlos Cobo u8 *tim; 783ee385855SLuis Carlos Cobo u8 *ibss_params; 784ee385855SLuis Carlos Cobo u8 *challenge; 785ee385855SLuis Carlos Cobo u8 *wpa; 786ee385855SLuis Carlos Cobo u8 *rsn; 787ee385855SLuis Carlos Cobo u8 *erp_info; 788ee385855SLuis Carlos Cobo u8 *ext_supp_rates; 789ee385855SLuis Carlos Cobo u8 *wmm_info; 790ee385855SLuis Carlos Cobo u8 *wmm_param; 791ee385855SLuis Carlos Cobo u8 *ht_cap_elem; 792ee385855SLuis Carlos Cobo u8 *ht_info_elem; 793ee385855SLuis Carlos Cobo u8 *mesh_config; 794ee385855SLuis Carlos Cobo u8 *mesh_id; 795ee385855SLuis Carlos Cobo u8 *peer_link; 796ee385855SLuis Carlos Cobo u8 *preq; 797ee385855SLuis Carlos Cobo u8 *prep; 798ee385855SLuis Carlos Cobo u8 *perr; 799f2df3859SAssaf Krauss u8 *ch_switch_elem; 800f2df3859SAssaf Krauss u8 *country_elem; 801f2df3859SAssaf Krauss u8 *pwr_constr_elem; 802f2df3859SAssaf Krauss u8 *quiet_elem; /* first quite element */ 803ee385855SLuis Carlos Cobo 804ee385855SLuis Carlos Cobo /* length of them, respectively */ 805ee385855SLuis Carlos Cobo u8 ssid_len; 806ee385855SLuis Carlos Cobo u8 supp_rates_len; 807ee385855SLuis Carlos Cobo u8 fh_params_len; 808ee385855SLuis Carlos Cobo u8 ds_params_len; 809ee385855SLuis Carlos Cobo u8 cf_params_len; 810ee385855SLuis Carlos Cobo u8 tim_len; 811ee385855SLuis Carlos Cobo u8 ibss_params_len; 812ee385855SLuis Carlos Cobo u8 challenge_len; 813ee385855SLuis Carlos Cobo u8 wpa_len; 814ee385855SLuis Carlos Cobo u8 rsn_len; 815ee385855SLuis Carlos Cobo u8 erp_info_len; 816ee385855SLuis Carlos Cobo u8 ext_supp_rates_len; 817ee385855SLuis Carlos Cobo u8 wmm_info_len; 818ee385855SLuis Carlos Cobo u8 wmm_param_len; 819ee385855SLuis Carlos Cobo u8 ht_cap_elem_len; 820ee385855SLuis Carlos Cobo u8 ht_info_elem_len; 821ee385855SLuis Carlos Cobo u8 mesh_config_len; 822ee385855SLuis Carlos Cobo u8 mesh_id_len; 823ee385855SLuis Carlos Cobo u8 peer_link_len; 824ee385855SLuis Carlos Cobo u8 preq_len; 825ee385855SLuis Carlos Cobo u8 prep_len; 826ee385855SLuis Carlos Cobo u8 perr_len; 827f2df3859SAssaf Krauss u8 ch_switch_elem_len; 828f2df3859SAssaf Krauss u8 country_elem_len; 829f2df3859SAssaf Krauss u8 pwr_constr_elem_len; 830f2df3859SAssaf Krauss u8 quiet_elem_len; 831f2df3859SAssaf Krauss u8 num_of_quiet_elem; /* can be more the one */ 832ee385855SLuis Carlos Cobo }; 833ee385855SLuis Carlos Cobo 834f0706e82SJiri Benc static inline struct ieee80211_local *hw_to_local( 835f0706e82SJiri Benc struct ieee80211_hw *hw) 836f0706e82SJiri Benc { 837f0706e82SJiri Benc return container_of(hw, struct ieee80211_local, hw); 838f0706e82SJiri Benc } 839f0706e82SJiri Benc 840f0706e82SJiri Benc static inline struct ieee80211_hw *local_to_hw( 841f0706e82SJiri Benc struct ieee80211_local *local) 842f0706e82SJiri Benc { 843f0706e82SJiri Benc return &local->hw; 844f0706e82SJiri Benc } 845f0706e82SJiri Benc 846f0706e82SJiri Benc struct sta_attribute { 847f0706e82SJiri Benc struct attribute attr; 848f0706e82SJiri Benc ssize_t (*show)(const struct sta_info *, char *buf); 849f0706e82SJiri Benc ssize_t (*store)(struct sta_info *, const char *buf, size_t count); 850f0706e82SJiri Benc }; 851f0706e82SJiri Benc 852571ecf67SJohannes Berg static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) 853571ecf67SJohannes Berg { 854571ecf67SJohannes Berg return compare_ether_addr(raddr, addr) == 0 || 855571ecf67SJohannes Berg is_broadcast_ether_addr(raddr); 856571ecf67SJohannes Berg } 857571ecf67SJohannes Berg 858571ecf67SJohannes Berg 859f0706e82SJiri Benc /* ieee80211.c */ 860f0706e82SJiri Benc int ieee80211_hw_config(struct ieee80211_local *local); 8619d139c81SJohannes Berg int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed); 8625cf121c3SJohannes Berg void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); 86338668c05STomas Winkler u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, 864d3c990fbSRon Rindjunsky struct ieee80211_ht_info *req_ht_cap, 865d3c990fbSRon Rindjunsky struct ieee80211_ht_bss_info *req_bss_cap); 866f0706e82SJiri Benc 867f0706e82SJiri Benc /* ieee80211_ioctl.c */ 868f0706e82SJiri Benc extern const struct iw_handler_def ieee80211_iw_handler_def; 869f698d856SJasper Bryant-Greene int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq); 87065b53e4cSDavid S. Miller 871f0706e82SJiri Benc /* ieee80211_sta.c */ 872f0706e82SJiri Benc void ieee80211_sta_timer(unsigned long data); 873f0706e82SJiri Benc void ieee80211_sta_work(struct work_struct *work); 874f0706e82SJiri Benc void ieee80211_sta_scan_work(struct work_struct *work); 875f698d856SJasper Bryant-Greene void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 876f0706e82SJiri Benc struct ieee80211_rx_status *rx_status); 877f698d856SJasper Bryant-Greene int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len); 878f698d856SJasper Bryant-Greene int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len); 879f698d856SJasper Bryant-Greene int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid); 880f698d856SJasper Bryant-Greene int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len); 881f698d856SJasper Bryant-Greene void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata, 882f0706e82SJiri Benc struct ieee80211_if_sta *ifsta); 883f698d856SJasper Bryant-Greene int ieee80211_sta_scan_results(struct ieee80211_local *local, 884ccc58057SDavid S. Miller struct iw_request_info *info, 885ccc58057SDavid S. Miller char *buf, size_t len); 8869ae54c84SJohannes Berg ieee80211_rx_result ieee80211_sta_rx_scan( 887f698d856SJasper Bryant-Greene struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 888f0706e82SJiri Benc struct ieee80211_rx_status *rx_status); 8893e122be0SJohannes Berg void ieee80211_rx_bss_list_init(struct ieee80211_local *local); 8903e122be0SJohannes Berg void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local); 891f698d856SJasper Bryant-Greene int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len); 892f698d856SJasper Bryant-Greene struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata, 893f0706e82SJiri Benc struct sk_buff *skb, u8 *bssid, 89487291c02SVladimir Koutny u8 *addr, u64 supp_rates); 895f698d856SJasper Bryant-Greene int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason); 896f698d856SJasper Bryant-Greene int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason); 897471b3efdSJohannes Berg void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, 898471b3efdSJohannes Berg u32 changed); 899f698d856SJasper Bryant-Greene u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata); 900c7153508SRon Rindjunsky int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, 901c7153508SRon Rindjunsky struct ieee80211_ht_info *ht_info); 902c7153508SRon Rindjunsky int ieee80211_ht_addt_info_ie_to_ht_bss_info( 903c7153508SRon Rindjunsky struct ieee80211_ht_addt_info *ht_add_info_ie, 904c7153508SRon Rindjunsky struct ieee80211_ht_bss_info *bss_info); 905f698d856SJasper Bryant-Greene void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, const u8 *da, 906eadc8d9eSRon Rindjunsky u16 tid, u8 dialog_token, u16 start_seq_num, 907eadc8d9eSRon Rindjunsky u16 agg_size, u16 timeout); 908f698d856SJasper Bryant-Greene void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, const u8 *da, u16 tid, 909eadc8d9eSRon Rindjunsky u16 initiator, u16 reason_code); 910f698d856SJasper Bryant-Greene void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); 91185249e5fSRon Rindjunsky 912f698d856SJasper Bryant-Greene void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da, 91307db2183SRon Rindjunsky u16 tid, u16 initiator, u16 reason); 914eadc8d9eSRon Rindjunsky void sta_addba_resp_timer_expired(unsigned long data); 915f698d856SJasper Bryant-Greene void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr); 916ee385855SLuis Carlos Cobo u64 ieee80211_sta_get_rates(struct ieee80211_local *local, 917ee385855SLuis Carlos Cobo struct ieee802_11_elems *elems, 918ee385855SLuis Carlos Cobo enum ieee80211_band band); 919f698d856SJasper Bryant-Greene void ieee80211_sta_tx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 920ee385855SLuis Carlos Cobo int encrypt); 921ee385855SLuis Carlos Cobo void ieee802_11_parse_elems(u8 *start, size_t len, 922ee385855SLuis Carlos Cobo struct ieee802_11_elems *elems); 923ee385855SLuis Carlos Cobo 924902acc78SJohannes Berg #ifdef CONFIG_MAC80211_MESH 925f698d856SJasper Bryant-Greene void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata); 926902acc78SJohannes Berg #else 927f698d856SJasper Bryant-Greene static inline void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata) 928902acc78SJohannes Berg {} 929902acc78SJohannes Berg #endif 930ee385855SLuis Carlos Cobo 9313e122be0SJohannes Berg /* interface handling */ 93275636525SJohannes Berg void ieee80211_if_setup(struct net_device *dev); 9333e122be0SJohannes Berg int ieee80211_if_add(struct ieee80211_local *local, const char *name, 93475636525SJohannes Berg struct net_device **new_dev, enum ieee80211_if_types type, 935ee385855SLuis Carlos Cobo struct vif_params *params); 936f3947e2dSJohannes Berg int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, 93775636525SJohannes Berg enum ieee80211_if_types type); 938f698d856SJasper Bryant-Greene void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata); 93975636525SJohannes Berg void ieee80211_remove_interfaces(struct ieee80211_local *local); 940f0706e82SJiri Benc 941e2ebc74dSJohannes Berg /* tx handling */ 942e2ebc74dSJohannes Berg void ieee80211_clear_tx_pending(struct ieee80211_local *local); 943e2ebc74dSJohannes Berg void ieee80211_tx_pending(unsigned long data); 944e2ebc74dSJohannes Berg int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev); 945e2ebc74dSJohannes Berg int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev); 946e2ebc74dSJohannes Berg int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); 947e2ebc74dSJohannes Berg 948c2d1560aSJohannes Berg /* utility functions/constants */ 949c2d1560aSJohannes Berg extern void *mac80211_wiphy_privid; /* for wiphy privid */ 950c2d1560aSJohannes Berg extern const unsigned char rfc1042_header[6]; 951c2d1560aSJohannes Berg extern const unsigned char bridge_tunnel_header[6]; 95271364716SRon Rindjunsky u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, 95371364716SRon Rindjunsky enum ieee80211_if_types type); 954c2d1560aSJohannes Berg int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, 955c2d1560aSJohannes Berg int rate, int erp, int short_preamble); 956f698d856SJasper Bryant-Greene void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx, 957eb063c17SJohannes Berg struct ieee80211_hdr *hdr); 958f0706e82SJiri Benc 959f4ea83ddSJohannes Berg #ifdef CONFIG_MAC80211_NOINLINE 960d9e8a70fSJohannes Berg #define debug_noinline noinline 961d9e8a70fSJohannes Berg #else 962d9e8a70fSJohannes Berg #define debug_noinline 963d9e8a70fSJohannes Berg #endif 964d9e8a70fSJohannes Berg 965f0706e82SJiri Benc #endif /* IEEE80211_I_H */ 966