Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2002-2005, Instant802 Networks, Inc. |
| 3 | * Copyright 2005, Devicescape Software, Inc. |
| 4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #ifndef IEEE80211_I_H |
| 12 | #define IEEE80211_I_H |
| 13 | |
| 14 | #include <linux/kernel.h> |
| 15 | #include <linux/device.h> |
| 16 | #include <linux/if_ether.h> |
| 17 | #include <linux/interrupt.h> |
| 18 | #include <linux/list.h> |
| 19 | #include <linux/netdevice.h> |
| 20 | #include <linux/skbuff.h> |
| 21 | #include <linux/workqueue.h> |
| 22 | #include <linux/types.h> |
| 23 | #include <linux/spinlock.h> |
Johannes Berg | 571ecf6 | 2007-07-27 15:43:22 +0200 | [diff] [blame] | 24 | #include <linux/etherdevice.h> |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 25 | #include <net/wireless.h> |
| 26 | #include "ieee80211_key.h" |
| 27 | #include "sta_info.h" |
| 28 | |
| 29 | /* ieee80211.o internal definitions, etc. These are not included into |
| 30 | * low-level drivers. */ |
| 31 | |
| 32 | #ifndef ETH_P_PAE |
| 33 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ |
| 34 | #endif /* ETH_P_PAE */ |
| 35 | |
| 36 | #define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08) |
| 37 | |
| 38 | struct ieee80211_local; |
| 39 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 40 | #define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3) |
| 41 | |
| 42 | /* Maximum number of broadcast/multicast frames to buffer when some of the |
| 43 | * associated stations are using power saving. */ |
| 44 | #define AP_MAX_BC_BUFFER 128 |
| 45 | |
| 46 | /* Maximum number of frames buffered to all STAs, including multicast frames. |
| 47 | * Note: increasing this limit increases the potential memory requirement. Each |
| 48 | * frame can be up to about 2 kB long. */ |
| 49 | #define TOTAL_MAX_TX_BUFFER 512 |
| 50 | |
| 51 | /* Required encryption head and tailroom */ |
| 52 | #define IEEE80211_ENCRYPT_HEADROOM 8 |
| 53 | #define IEEE80211_ENCRYPT_TAILROOM 12 |
| 54 | |
| 55 | /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent |
| 56 | * reception of at least three fragmented frames. This limit can be increased |
| 57 | * by changing this define, at the cost of slower frame reassembly and |
| 58 | * increased memory use (about 2 kB of RAM per entry). */ |
| 59 | #define IEEE80211_FRAGMENT_MAX 4 |
| 60 | |
| 61 | struct ieee80211_fragment_entry { |
| 62 | unsigned long first_frag_time; |
| 63 | unsigned int seq; |
| 64 | unsigned int rx_queue; |
| 65 | unsigned int last_frag; |
| 66 | unsigned int extra_len; |
| 67 | struct sk_buff_head skb_list; |
| 68 | int ccmp; /* Whether fragments were encrypted with CCMP */ |
| 69 | u8 last_pn[6]; /* PN of the last fragment if CCMP was used */ |
| 70 | }; |
| 71 | |
| 72 | |
| 73 | struct ieee80211_sta_bss { |
| 74 | struct list_head list; |
| 75 | struct ieee80211_sta_bss *hnext; |
| 76 | atomic_t users; |
| 77 | |
| 78 | u8 bssid[ETH_ALEN]; |
| 79 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| 80 | size_t ssid_len; |
| 81 | u16 capability; /* host byte order */ |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 82 | enum ieee80211_band band; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 83 | int freq; |
| 84 | int rssi, signal, noise; |
| 85 | u8 *wpa_ie; |
| 86 | size_t wpa_ie_len; |
| 87 | u8 *rsn_ie; |
| 88 | size_t rsn_ie_len; |
| 89 | u8 *wmm_ie; |
| 90 | size_t wmm_ie_len; |
Ron Rindjunsky | c715350 | 2007-11-26 16:14:31 +0200 | [diff] [blame] | 91 | u8 *ht_ie; |
| 92 | size_t ht_ie_len; |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 93 | #ifdef CONFIG_MAC80211_MESH |
| 94 | u8 *mesh_id; |
| 95 | size_t mesh_id_len; |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 96 | u8 *mesh_cfg; |
Johannes Berg | 902acc7 | 2008-02-23 15:17:19 +0100 | [diff] [blame] | 97 | #endif |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 98 | #define IEEE80211_MAX_SUPP_RATES 32 |
| 99 | u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; |
| 100 | size_t supp_rates_len; |
| 101 | int beacon_int; |
| 102 | u64 timestamp; |
| 103 | |
| 104 | int probe_resp; |
| 105 | unsigned long last_update; |
| 106 | |
Daniel Drake | 5628221 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 107 | /* during assocation, we save an ERP value from a probe response so |
| 108 | * that we can feed ERP info to the driver when handling the |
| 109 | * association completes. these fields probably won't be up-to-date |
| 110 | * otherwise, you probably don't want to use them. */ |
| 111 | int has_erp_value; |
| 112 | u8 erp_value; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 113 | }; |
| 114 | |
Johannes Berg | 902acc7 | 2008-02-23 15:17:19 +0100 | [diff] [blame] | 115 | static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss) |
| 116 | { |
| 117 | #ifdef CONFIG_MAC80211_MESH |
| 118 | return bss->mesh_cfg; |
| 119 | #endif |
| 120 | return NULL; |
| 121 | } |
| 122 | |
| 123 | static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss) |
| 124 | { |
| 125 | #ifdef CONFIG_MAC80211_MESH |
| 126 | return bss->mesh_id; |
| 127 | #endif |
| 128 | return NULL; |
| 129 | } |
| 130 | |
| 131 | static inline u8 bss_mesh_id_len(struct ieee80211_sta_bss *bss) |
| 132 | { |
| 133 | #ifdef CONFIG_MAC80211_MESH |
| 134 | return bss->mesh_id_len; |
| 135 | #endif |
| 136 | return 0; |
| 137 | } |
| 138 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 139 | |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 140 | typedef unsigned __bitwise__ ieee80211_tx_result; |
| 141 | #define TX_CONTINUE ((__force ieee80211_tx_result) 0u) |
| 142 | #define TX_DROP ((__force ieee80211_tx_result) 1u) |
| 143 | #define TX_QUEUED ((__force ieee80211_tx_result) 2u) |
| 144 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 145 | #define IEEE80211_TX_FRAGMENTED BIT(0) |
| 146 | #define IEEE80211_TX_UNICAST BIT(1) |
| 147 | #define IEEE80211_TX_PS_BUFFERED BIT(2) |
| 148 | #define IEEE80211_TX_PROBE_LAST_FRAG BIT(3) |
| 149 | #define IEEE80211_TX_INJECTED BIT(4) |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 150 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 151 | struct ieee80211_tx_data { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 152 | struct sk_buff *skb; |
| 153 | struct net_device *dev; |
| 154 | struct ieee80211_local *local; |
| 155 | struct ieee80211_sub_if_data *sdata; |
| 156 | struct sta_info *sta; |
| 157 | u16 fc, ethertype; |
| 158 | struct ieee80211_key *key; |
Jiri Slaby | badffb7 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 159 | unsigned int flags; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 160 | |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 161 | struct ieee80211_tx_control *control; |
| 162 | struct ieee80211_channel *channel; |
| 163 | struct ieee80211_rate *rate; |
| 164 | /* use this rate (if set) for last fragment; rate can |
| 165 | * be set to lower rate for the first fragments, e.g., |
| 166 | * when using CTS protection with IEEE 802.11g. */ |
| 167 | struct ieee80211_rate *last_frag_rate; |
| 168 | |
| 169 | /* Extra fragments (in addition to the first fragment |
| 170 | * in skb) */ |
| 171 | int num_extra_frag; |
| 172 | struct sk_buff **extra_frag; |
| 173 | }; |
| 174 | |
| 175 | |
| 176 | typedef unsigned __bitwise__ ieee80211_rx_result; |
| 177 | #define RX_CONTINUE ((__force ieee80211_rx_result) 0u) |
| 178 | #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u) |
| 179 | #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u) |
| 180 | #define RX_QUEUED ((__force ieee80211_rx_result) 3u) |
| 181 | |
| 182 | #define IEEE80211_RX_IN_SCAN BIT(0) |
| 183 | /* frame is destined to interface currently processed (incl. multicast frames) */ |
| 184 | #define IEEE80211_RX_RA_MATCH BIT(1) |
| 185 | #define IEEE80211_RX_AMSDU BIT(2) |
| 186 | #define IEEE80211_RX_CMNTR_REPORTED BIT(3) |
| 187 | #define IEEE80211_RX_FRAGMENTED BIT(4) |
| 188 | |
| 189 | struct ieee80211_rx_data { |
| 190 | struct sk_buff *skb; |
| 191 | struct net_device *dev; |
| 192 | struct ieee80211_local *local; |
| 193 | struct ieee80211_sub_if_data *sdata; |
| 194 | struct sta_info *sta; |
| 195 | u16 fc, ethertype; |
| 196 | struct ieee80211_key *key; |
| 197 | unsigned int flags; |
| 198 | |
| 199 | struct ieee80211_rx_status *status; |
| 200 | struct ieee80211_rate *rate; |
| 201 | int sent_ps_buffered; |
| 202 | int queue; |
| 203 | int load; |
| 204 | u32 tkip_iv32; |
| 205 | u16 tkip_iv16; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 206 | }; |
| 207 | |
Jiri Slaby | e8bf964 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 208 | /* flags used in struct ieee80211_tx_packet_data.flags */ |
| 209 | #define IEEE80211_TXPD_REQ_TX_STATUS BIT(0) |
| 210 | #define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1) |
| 211 | #define IEEE80211_TXPD_REQUEUE BIT(2) |
Johannes Berg | 678f5f71 | 2007-12-19 01:31:23 +0100 | [diff] [blame] | 212 | #define IEEE80211_TXPD_EAPOL_FRAME BIT(3) |
Ron Rindjunsky | 9e72349 | 2008-01-28 14:07:18 +0200 | [diff] [blame] | 213 | #define IEEE80211_TXPD_AMPDU BIT(4) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 214 | /* Stored in sk_buff->cb */ |
| 215 | struct ieee80211_tx_packet_data { |
| 216 | int ifindex; |
| 217 | unsigned long jiffies; |
Jiri Slaby | e8bf964 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 218 | unsigned int flags; |
| 219 | u8 queue; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | struct ieee80211_tx_stored_packet { |
| 223 | struct ieee80211_tx_control control; |
| 224 | struct sk_buff *skb; |
| 225 | int num_extra_frag; |
| 226 | struct sk_buff **extra_frag; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 227 | struct ieee80211_rate *last_frag_rate; |
Jiri Slaby | badffb7 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 228 | unsigned int last_frag_rate_ctrl_probe; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 229 | }; |
| 230 | |
Johannes Berg | 5dfdaf5 | 2007-12-19 02:03:33 +0100 | [diff] [blame] | 231 | struct beacon_data { |
| 232 | u8 *head, *tail; |
| 233 | int head_len, tail_len; |
| 234 | int dtim_period; |
| 235 | }; |
| 236 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 237 | struct ieee80211_if_ap { |
Johannes Berg | 5dfdaf5 | 2007-12-19 02:03:33 +0100 | [diff] [blame] | 238 | struct beacon_data *beacon; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 239 | |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 240 | struct list_head vlans; |
| 241 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 242 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| 243 | size_t ssid_len; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 244 | |
| 245 | /* yes, this looks ugly, but guarantees that we can later use |
| 246 | * bitmap_empty :) |
Johannes Berg | 004c872 | 2008-02-20 11:21:35 +0100 | [diff] [blame] | 247 | * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 248 | u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; |
| 249 | atomic_t num_sta_ps; /* number of stations in PS mode */ |
| 250 | struct sk_buff_head ps_bc_buf; |
Johannes Berg | 5dfdaf5 | 2007-12-19 02:03:33 +0100 | [diff] [blame] | 251 | int dtim_count; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 252 | int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ |
| 253 | int max_ratectrl_rateidx; /* max TX rateidx for rate control */ |
| 254 | int num_beacons; /* number of TXed beacon frames for this BSS */ |
| 255 | }; |
| 256 | |
| 257 | struct ieee80211_if_wds { |
| 258 | u8 remote_addr[ETH_ALEN]; |
| 259 | struct sta_info *sta; |
| 260 | }; |
| 261 | |
| 262 | struct ieee80211_if_vlan { |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 263 | struct ieee80211_sub_if_data *ap; |
| 264 | struct list_head list; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 265 | }; |
| 266 | |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 267 | struct mesh_stats { |
| 268 | __u32 fwded_frames; /* Mesh forwarded frames */ |
| 269 | __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/ |
| 270 | __u32 dropped_frames_no_route; /* Not transmitted, no route found */ |
| 271 | atomic_t estab_plinks; |
| 272 | }; |
| 273 | |
| 274 | #define PREQ_Q_F_START 0x1 |
| 275 | #define PREQ_Q_F_REFRESH 0x2 |
| 276 | struct mesh_preq_queue { |
| 277 | struct list_head list; |
| 278 | u8 dst[ETH_ALEN]; |
| 279 | u8 flags; |
| 280 | }; |
| 281 | |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 282 | struct mesh_config { |
| 283 | /* Timeouts in ms */ |
| 284 | /* Mesh plink management parameters */ |
| 285 | u16 dot11MeshRetryTimeout; |
| 286 | u16 dot11MeshConfirmTimeout; |
| 287 | u16 dot11MeshHoldingTimeout; |
| 288 | u16 dot11MeshMaxPeerLinks; |
| 289 | u8 dot11MeshMaxRetries; |
| 290 | u8 dot11MeshTTL; |
| 291 | bool auto_open_plinks; |
| 292 | /* HWMP parameters */ |
| 293 | u32 dot11MeshHWMPactivePathTimeout; |
| 294 | u16 dot11MeshHWMPpreqMinInterval; |
| 295 | u16 dot11MeshHWMPnetDiameterTraversalTime; |
| 296 | u8 dot11MeshHWMPmaxPREQretries; |
| 297 | u32 path_refresh_time; |
| 298 | u16 min_discovery_timeout; |
| 299 | }; |
Johannes Berg | 902acc7 | 2008-02-23 15:17:19 +0100 | [diff] [blame] | 300 | |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 301 | |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 302 | /* flags used in struct ieee80211_if_sta.flags */ |
| 303 | #define IEEE80211_STA_SSID_SET BIT(0) |
| 304 | #define IEEE80211_STA_BSSID_SET BIT(1) |
| 305 | #define IEEE80211_STA_PREV_BSSID_SET BIT(2) |
| 306 | #define IEEE80211_STA_AUTHENTICATED BIT(3) |
| 307 | #define IEEE80211_STA_ASSOCIATED BIT(4) |
| 308 | #define IEEE80211_STA_PROBEREQ_POLL BIT(5) |
| 309 | #define IEEE80211_STA_CREATE_IBSS BIT(6) |
| 310 | #define IEEE80211_STA_MIXED_CELL BIT(7) |
| 311 | #define IEEE80211_STA_WMM_ENABLED BIT(8) |
| 312 | #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) |
| 313 | #define IEEE80211_STA_AUTO_BSSID_SEL BIT(11) |
| 314 | #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 315 | #define IEEE80211_STA_PRIVACY_INVOKED BIT(13) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 316 | struct ieee80211_if_sta { |
| 317 | enum { |
| 318 | IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, |
| 319 | IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED, |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 320 | IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED, |
| 321 | IEEE80211_MESH_UP |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 322 | } state; |
| 323 | struct timer_list timer; |
| 324 | struct work_struct work; |
| 325 | u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; |
| 326 | u8 ssid[IEEE80211_MAX_SSID_LEN]; |
| 327 | size_t ssid_len; |
Helmut Schaa | a0af5f1 | 2007-11-09 16:25:08 +0100 | [diff] [blame] | 328 | u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; |
| 329 | size_t scan_ssid_len; |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 330 | #ifdef CONFIG_MAC80211_MESH |
| 331 | struct timer_list mesh_path_timer; |
| 332 | u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN]; |
| 333 | bool accepting_plinks; |
| 334 | size_t mesh_id_len; |
| 335 | /* Active Path Selection Protocol Identifier */ |
| 336 | u8 mesh_pp_id[4]; |
| 337 | /* Active Path Selection Metric Identifier */ |
| 338 | u8 mesh_pm_id[4]; |
| 339 | /* Congestion Control Mode Identifier */ |
| 340 | u8 mesh_cc_id[4]; |
| 341 | /* Local mesh Destination Sequence Number */ |
| 342 | u32 dsn; |
| 343 | /* Last used PREQ ID */ |
| 344 | u32 preq_id; |
| 345 | atomic_t mpaths; |
| 346 | /* Timestamp of last DSN update */ |
| 347 | unsigned long last_dsn_update; |
| 348 | /* Timestamp of last DSN sent */ |
| 349 | unsigned long last_preq; |
| 350 | struct mesh_rmc *rmc; |
| 351 | spinlock_t mesh_preq_queue_lock; |
| 352 | struct mesh_preq_queue preq_queue; |
| 353 | int preq_queue_len; |
| 354 | struct mesh_stats mshstats; |
| 355 | struct mesh_config mshcfg; |
| 356 | u8 mesh_seqnum[3]; |
| 357 | #endif |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 358 | u16 aid; |
| 359 | u16 ap_capab, capab; |
| 360 | u8 *extra_ie; /* to be added to the end of AssocReq */ |
| 361 | size_t extra_ie_len; |
| 362 | |
| 363 | /* The last AssocReq/Resp IEs */ |
| 364 | u8 *assocreq_ies, *assocresp_ies; |
| 365 | size_t assocreq_ies_len, assocresp_ies_len; |
| 366 | |
| 367 | int auth_tries, assoc_tries; |
| 368 | |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 369 | unsigned int flags; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 370 | #define IEEE80211_STA_REQ_SCAN 0 |
| 371 | #define IEEE80211_STA_REQ_AUTH 1 |
| 372 | #define IEEE80211_STA_REQ_RUN 2 |
| 373 | unsigned long request; |
| 374 | struct sk_buff_head skb_queue; |
| 375 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 376 | unsigned long last_probe; |
| 377 | |
| 378 | #define IEEE80211_AUTH_ALG_OPEN BIT(0) |
| 379 | #define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1) |
| 380 | #define IEEE80211_AUTH_ALG_LEAP BIT(2) |
| 381 | unsigned int auth_algs; /* bitfield of allowed auth algs */ |
| 382 | int auth_alg; /* currently used IEEE 802.11 authentication algorithm */ |
| 383 | int auth_transaction; |
| 384 | |
| 385 | unsigned long ibss_join_req; |
| 386 | struct sk_buff *probe_resp; /* ProbeResp template for IBSS */ |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 387 | u32 supp_rates_bits[IEEE80211_NUM_BANDS]; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 388 | |
| 389 | int wmm_last_param_set; |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 390 | int num_beacons; /* number of TXed beacon frames by this STA */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 391 | }; |
| 392 | |
Johannes Berg | 902acc7 | 2008-02-23 15:17:19 +0100 | [diff] [blame] | 393 | static inline void ieee80211_if_sta_set_mesh_id(struct ieee80211_if_sta *ifsta, |
| 394 | u8 mesh_id_len, u8 *mesh_id) |
| 395 | { |
| 396 | #ifdef CONFIG_MAC80211_MESH |
| 397 | ifsta->mesh_id_len = mesh_id_len; |
| 398 | memcpy(ifsta->mesh_id, mesh_id, mesh_id_len); |
| 399 | #endif |
| 400 | } |
| 401 | |
| 402 | #ifdef CONFIG_MAC80211_MESH |
| 403 | #define IEEE80211_IFSTA_MESH_CTR_INC(sta, name) \ |
| 404 | do { (sta)->mshstats.name++; } while (0) |
| 405 | #else |
| 406 | #define IEEE80211_IFSTA_MESH_CTR_INC(sta, name) \ |
| 407 | do { } while (0) |
| 408 | #endif |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 409 | |
Jiri Slaby | 13262ff | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 410 | /* flags used in struct ieee80211_sub_if_data.flags */ |
| 411 | #define IEEE80211_SDATA_ALLMULTI BIT(0) |
| 412 | #define IEEE80211_SDATA_PROMISC BIT(1) |
Johannes Berg | 471b3ef | 2007-12-28 14:32:58 +0100 | [diff] [blame] | 413 | #define IEEE80211_SDATA_USERSPACE_MLME BIT(2) |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 414 | #define IEEE80211_SDATA_OPERATING_GMODE BIT(3) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 415 | struct ieee80211_sub_if_data { |
| 416 | struct list_head list; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 417 | |
| 418 | struct wireless_dev wdev; |
| 419 | |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 420 | /* keys */ |
| 421 | struct list_head key_list; |
| 422 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 423 | struct net_device *dev; |
| 424 | struct ieee80211_local *local; |
| 425 | |
Jiri Slaby | 13262ff | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 426 | unsigned int flags; |
Daniel Drake | 7e9ed18 | 2007-07-27 15:43:24 +0200 | [diff] [blame] | 427 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 428 | int drop_unencrypted; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 429 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 430 | /* |
| 431 | * basic rates of this AP or the AP we're associated to |
| 432 | */ |
| 433 | u64 basic_rates; |
| 434 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 435 | u16 sequence; |
| 436 | |
| 437 | /* Fragment table for host-based reassembly */ |
| 438 | struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; |
| 439 | unsigned int fragment_next; |
| 440 | |
| 441 | #define NUM_DEFAULT_KEYS 4 |
| 442 | struct ieee80211_key *keys[NUM_DEFAULT_KEYS]; |
| 443 | struct ieee80211_key *default_key; |
| 444 | |
Johannes Berg | 471b3ef | 2007-12-28 14:32:58 +0100 | [diff] [blame] | 445 | /* |
| 446 | * BSS configuration for this interface. |
| 447 | * |
| 448 | * FIXME: I feel bad putting this here when we already have a |
| 449 | * bss pointer, but the bss pointer is just wrong when |
| 450 | * you have multiple virtual STA mode interfaces... |
| 451 | * This needs to be fixed. |
| 452 | */ |
| 453 | struct ieee80211_bss_conf bss_conf; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 454 | struct ieee80211_if_ap *bss; /* BSS that this device belongs to */ |
| 455 | |
| 456 | union { |
| 457 | struct ieee80211_if_ap ap; |
| 458 | struct ieee80211_if_wds wds; |
| 459 | struct ieee80211_if_vlan vlan; |
| 460 | struct ieee80211_if_sta sta; |
Michael Wu | 8cc9a73 | 2008-01-31 19:48:23 +0100 | [diff] [blame] | 461 | u32 mntr_flags; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 462 | } u; |
| 463 | int channel_use; |
| 464 | int channel_use_raw; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 465 | |
| 466 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 467 | struct dentry *debugfsdir; |
| 468 | union { |
| 469 | struct { |
| 470 | struct dentry *channel_use; |
| 471 | struct dentry *drop_unencrypted; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 472 | struct dentry *state; |
| 473 | struct dentry *bssid; |
| 474 | struct dentry *prev_bssid; |
| 475 | struct dentry *ssid_len; |
| 476 | struct dentry *aid; |
| 477 | struct dentry *ap_capab; |
| 478 | struct dentry *capab; |
| 479 | struct dentry *extra_ie_len; |
| 480 | struct dentry *auth_tries; |
| 481 | struct dentry *assoc_tries; |
| 482 | struct dentry *auth_algs; |
| 483 | struct dentry *auth_alg; |
| 484 | struct dentry *auth_transaction; |
| 485 | struct dentry *flags; |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 486 | struct dentry *num_beacons_sta; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 487 | } sta; |
| 488 | struct { |
| 489 | struct dentry *channel_use; |
| 490 | struct dentry *drop_unencrypted; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 491 | struct dentry *num_sta_ps; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 492 | struct dentry *dtim_count; |
| 493 | struct dentry *num_beacons; |
| 494 | struct dentry *force_unicast_rateidx; |
| 495 | struct dentry *max_ratectrl_rateidx; |
| 496 | struct dentry *num_buffered_multicast; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 497 | } ap; |
| 498 | struct { |
| 499 | struct dentry *channel_use; |
| 500 | struct dentry *drop_unencrypted; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 501 | struct dentry *peer; |
| 502 | } wds; |
| 503 | struct { |
| 504 | struct dentry *channel_use; |
| 505 | struct dentry *drop_unencrypted; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 506 | } vlan; |
| 507 | struct { |
| 508 | struct dentry *mode; |
| 509 | } monitor; |
| 510 | struct dentry *default_key; |
| 511 | } debugfs; |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 512 | |
| 513 | #ifdef CONFIG_MAC80211_MESH |
| 514 | struct dentry *mesh_stats_dir; |
| 515 | struct { |
| 516 | struct dentry *fwded_frames; |
| 517 | struct dentry *dropped_frames_ttl; |
| 518 | struct dentry *dropped_frames_no_route; |
| 519 | struct dentry *estab_plinks; |
Johannes Berg | 902acc7 | 2008-02-23 15:17:19 +0100 | [diff] [blame] | 520 | struct timer_list mesh_path_timer; |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 521 | } mesh_stats; |
| 522 | |
| 523 | struct dentry *mesh_config_dir; |
| 524 | struct { |
| 525 | struct dentry *dot11MeshRetryTimeout; |
| 526 | struct dentry *dot11MeshConfirmTimeout; |
| 527 | struct dentry *dot11MeshHoldingTimeout; |
| 528 | struct dentry *dot11MeshMaxRetries; |
| 529 | struct dentry *dot11MeshTTL; |
| 530 | struct dentry *auto_open_plinks; |
| 531 | struct dentry *dot11MeshMaxPeerLinks; |
| 532 | struct dentry *dot11MeshHWMPactivePathTimeout; |
| 533 | struct dentry *dot11MeshHWMPpreqMinInterval; |
| 534 | struct dentry *dot11MeshHWMPnetDiameterTraversalTime; |
| 535 | struct dentry *dot11MeshHWMPmaxPREQretries; |
| 536 | struct dentry *path_refresh_time; |
| 537 | struct dentry *min_discovery_timeout; |
| 538 | } mesh_config; |
| 539 | #endif |
| 540 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 541 | #endif |
Johannes Berg | 32bfd35 | 2007-12-19 01:31:26 +0100 | [diff] [blame] | 542 | /* must be last, dynamically sized area in this! */ |
| 543 | struct ieee80211_vif vif; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 544 | }; |
| 545 | |
Johannes Berg | 32bfd35 | 2007-12-19 01:31:26 +0100 | [diff] [blame] | 546 | static inline |
| 547 | struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p) |
| 548 | { |
| 549 | return container_of(p, struct ieee80211_sub_if_data, vif); |
| 550 | } |
| 551 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 552 | #define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev) |
| 553 | |
| 554 | enum { |
| 555 | IEEE80211_RX_MSG = 1, |
| 556 | IEEE80211_TX_STATUS_MSG = 2, |
Ron Rindjunsky | eadc8d9 | 2008-01-28 14:07:17 +0200 | [diff] [blame] | 557 | IEEE80211_DELBA_MSG = 3, |
| 558 | IEEE80211_ADDBA_MSG = 4, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 559 | }; |
| 560 | |
| 561 | struct ieee80211_local { |
| 562 | /* embed the driver visible part. |
| 563 | * don't cast (use the static inlines below), but we keep |
| 564 | * it first anyway so they become a no-op */ |
| 565 | struct ieee80211_hw hw; |
| 566 | |
| 567 | const struct ieee80211_ops *ops; |
| 568 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 569 | struct net_device *mdev; /* wmaster# - "master" 802.11 device */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 570 | int open_count; |
Michael Wu | 3d30d94 | 2008-01-31 19:48:27 +0100 | [diff] [blame] | 571 | int monitors, cooked_mntrs; |
Michael Wu | 8cc9a73 | 2008-01-31 19:48:23 +0100 | [diff] [blame] | 572 | /* number of interfaces with corresponding FIF_ flags */ |
| 573 | int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 574 | unsigned int filter_flags; /* FIF_* */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 575 | struct iw_statistics wstats; |
| 576 | u8 wstats_flags; |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 577 | bool tim_in_locked_section; /* see ieee80211_beacon_get() */ |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 578 | int tx_headroom; /* required headroom for hardware/radiotap */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 579 | |
| 580 | enum { |
| 581 | IEEE80211_DEV_UNINITIALIZED = 0, |
| 582 | IEEE80211_DEV_REGISTERED, |
| 583 | IEEE80211_DEV_UNREGISTERED, |
| 584 | } reg_state; |
| 585 | |
| 586 | /* Tasklet and skb queue to process calls from IRQ mode. All frames |
| 587 | * added to skb_queue will be processed, but frames in |
| 588 | * skb_queue_unreliable may be dropped if the total length of these |
| 589 | * queues increases over the limit. */ |
| 590 | #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128 |
| 591 | struct tasklet_struct tasklet; |
| 592 | struct sk_buff_head skb_queue; |
| 593 | struct sk_buff_head skb_queue_unreliable; |
| 594 | |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 595 | /* Station data */ |
| 596 | /* |
| 597 | * The lock only protects the list, hash, timer and counter |
| 598 | * against manipulation, reads are done in RCU. Additionally, |
| 599 | * the lock protects each BSS's TIM bitmap and a few items |
| 600 | * in a STA info structure. |
| 601 | */ |
| 602 | spinlock_t sta_lock; |
| 603 | unsigned long num_sta; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 604 | struct list_head sta_list; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 605 | struct sta_info *sta_hash[STA_HASH_SIZE]; |
| 606 | struct timer_list sta_cleanup; |
| 607 | |
Ron Rindjunsky | 9e72349 | 2008-01-28 14:07:18 +0200 | [diff] [blame] | 608 | unsigned long state[NUM_TX_DATA_QUEUES_AMPDU]; |
| 609 | struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES_AMPDU]; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 610 | struct tasklet_struct tx_pending_tasklet; |
| 611 | |
Johannes Berg | 5391899 | 2007-09-26 15:19:47 +0200 | [diff] [blame] | 612 | /* number of interfaces with corresponding IFF_ flags */ |
| 613 | atomic_t iff_allmultis, iff_promiscs; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 614 | |
| 615 | struct rate_control_ref *rate_ctrl; |
| 616 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 617 | int rts_threshold; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 618 | int fragmentation_threshold; |
| 619 | int short_retry_limit; /* dot11ShortRetryLimit */ |
| 620 | int long_retry_limit; /* dot11LongRetryLimit */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 621 | |
| 622 | struct crypto_blkcipher *wep_tx_tfm; |
| 623 | struct crypto_blkcipher *wep_rx_tfm; |
| 624 | u32 wep_iv; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 625 | |
| 626 | int bridge_packets; /* bridge packets between associated stations and |
| 627 | * deliver multicast frames both back to wireless |
| 628 | * media and to the local net stack */ |
| 629 | |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 630 | struct list_head interfaces; |
| 631 | |
Zhu Yi | ece8edd | 2007-11-22 10:53:21 +0800 | [diff] [blame] | 632 | bool sta_sw_scanning; |
| 633 | bool sta_hw_scanning; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 634 | int scan_channel_idx; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 635 | enum ieee80211_band scan_band; |
| 636 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 637 | enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state; |
| 638 | unsigned long last_scan_completed; |
| 639 | struct delayed_work scan_work; |
| 640 | struct net_device *scan_dev; |
| 641 | struct ieee80211_channel *oper_channel, *scan_channel; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 642 | u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; |
| 643 | size_t scan_ssid_len; |
| 644 | struct list_head sta_bss_list; |
| 645 | struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE]; |
| 646 | spinlock_t sta_bss_lock; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 647 | |
| 648 | /* SNMP counters */ |
| 649 | /* dot11CountersTable */ |
| 650 | u32 dot11TransmittedFragmentCount; |
| 651 | u32 dot11MulticastTransmittedFrameCount; |
| 652 | u32 dot11FailedCount; |
| 653 | u32 dot11RetryCount; |
| 654 | u32 dot11MultipleRetryCount; |
| 655 | u32 dot11FrameDuplicateCount; |
| 656 | u32 dot11ReceivedFragmentCount; |
| 657 | u32 dot11MulticastReceivedFrameCount; |
| 658 | u32 dot11TransmittedFrameCount; |
| 659 | u32 dot11WEPUndecryptableCount; |
| 660 | |
| 661 | #ifdef CONFIG_MAC80211_LEDS |
| 662 | int tx_led_counter, rx_led_counter; |
Ivo van Doorn | cdcb006f | 2008-01-07 19:45:24 +0100 | [diff] [blame] | 663 | struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led; |
| 664 | char tx_led_name[32], rx_led_name[32], |
| 665 | assoc_led_name[32], radio_led_name[32]; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 666 | #endif |
| 667 | |
| 668 | u32 channel_use; |
| 669 | u32 channel_use_raw; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 670 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 671 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 672 | struct work_struct sta_debugfs_add; |
| 673 | #endif |
| 674 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 675 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS |
| 676 | /* TX/RX handler statistics */ |
| 677 | unsigned int tx_handlers_drop; |
| 678 | unsigned int tx_handlers_queued; |
| 679 | unsigned int tx_handlers_drop_unencrypted; |
| 680 | unsigned int tx_handlers_drop_fragment; |
| 681 | unsigned int tx_handlers_drop_wep; |
| 682 | unsigned int tx_handlers_drop_not_assoc; |
| 683 | unsigned int tx_handlers_drop_unauth_port; |
| 684 | unsigned int rx_handlers_drop; |
| 685 | unsigned int rx_handlers_queued; |
| 686 | unsigned int rx_handlers_drop_nullfunc; |
| 687 | unsigned int rx_handlers_drop_defrag; |
| 688 | unsigned int rx_handlers_drop_short; |
| 689 | unsigned int rx_handlers_drop_passive_scan; |
| 690 | unsigned int tx_expand_skb_head; |
| 691 | unsigned int tx_expand_skb_head_cloned; |
| 692 | unsigned int rx_expand_skb_head; |
| 693 | unsigned int rx_expand_skb_head2; |
| 694 | unsigned int rx_handlers_fragments; |
| 695 | unsigned int tx_status_drop; |
| 696 | unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES]; |
| 697 | unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES]; |
| 698 | #define I802_DEBUG_INC(c) (c)++ |
| 699 | #else /* CONFIG_MAC80211_DEBUG_COUNTERS */ |
| 700 | #define I802_DEBUG_INC(c) do { } while (0) |
| 701 | #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */ |
| 702 | |
| 703 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 704 | int total_ps_buffered; /* total number of all buffered unicast and |
| 705 | * multicast packets for power saving stations |
| 706 | */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 707 | int wifi_wme_noack_test; |
| 708 | unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ |
| 709 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 710 | #ifdef CONFIG_MAC80211_DEBUGFS |
| 711 | struct local_debugfsdentries { |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 712 | struct dentry *frequency; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 713 | struct dentry *antenna_sel_tx; |
| 714 | struct dentry *antenna_sel_rx; |
| 715 | struct dentry *bridge_packets; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 716 | struct dentry *rts_threshold; |
| 717 | struct dentry *fragmentation_threshold; |
| 718 | struct dentry *short_retry_limit; |
| 719 | struct dentry *long_retry_limit; |
| 720 | struct dentry *total_ps_buffered; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 721 | struct dentry *wep_iv; |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 722 | struct dentry *statistics; |
| 723 | struct local_debugfsdentries_statsdentries { |
| 724 | struct dentry *transmitted_fragment_count; |
| 725 | struct dentry *multicast_transmitted_frame_count; |
| 726 | struct dentry *failed_count; |
| 727 | struct dentry *retry_count; |
| 728 | struct dentry *multiple_retry_count; |
| 729 | struct dentry *frame_duplicate_count; |
| 730 | struct dentry *received_fragment_count; |
| 731 | struct dentry *multicast_received_frame_count; |
| 732 | struct dentry *transmitted_frame_count; |
| 733 | struct dentry *wep_undecryptable_count; |
| 734 | struct dentry *num_scans; |
| 735 | #ifdef CONFIG_MAC80211_DEBUG_COUNTERS |
| 736 | struct dentry *tx_handlers_drop; |
| 737 | struct dentry *tx_handlers_queued; |
| 738 | struct dentry *tx_handlers_drop_unencrypted; |
| 739 | struct dentry *tx_handlers_drop_fragment; |
| 740 | struct dentry *tx_handlers_drop_wep; |
| 741 | struct dentry *tx_handlers_drop_not_assoc; |
| 742 | struct dentry *tx_handlers_drop_unauth_port; |
| 743 | struct dentry *rx_handlers_drop; |
| 744 | struct dentry *rx_handlers_queued; |
| 745 | struct dentry *rx_handlers_drop_nullfunc; |
| 746 | struct dentry *rx_handlers_drop_defrag; |
| 747 | struct dentry *rx_handlers_drop_short; |
| 748 | struct dentry *rx_handlers_drop_passive_scan; |
| 749 | struct dentry *tx_expand_skb_head; |
| 750 | struct dentry *tx_expand_skb_head_cloned; |
| 751 | struct dentry *rx_expand_skb_head; |
| 752 | struct dentry *rx_expand_skb_head2; |
| 753 | struct dentry *rx_handlers_fragments; |
| 754 | struct dentry *tx_status_drop; |
| 755 | struct dentry *wme_tx_queue; |
| 756 | struct dentry *wme_rx_queue; |
| 757 | #endif |
| 758 | struct dentry *dot11ACKFailureCount; |
| 759 | struct dentry *dot11RTSFailureCount; |
| 760 | struct dentry *dot11FCSErrorCount; |
| 761 | struct dentry *dot11RTSSuccessCount; |
| 762 | } stats; |
| 763 | struct dentry *stations; |
| 764 | struct dentry *keys; |
| 765 | } debugfs; |
| 766 | #endif |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 767 | }; |
| 768 | |
Ron Rindjunsky | eadc8d9 | 2008-01-28 14:07:17 +0200 | [diff] [blame] | 769 | /* this struct represents 802.11n's RA/TID combination */ |
| 770 | struct ieee80211_ra_tid { |
| 771 | u8 ra[ETH_ALEN]; |
| 772 | u16 tid; |
| 773 | }; |
| 774 | |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 775 | /* Parsed Information Elements */ |
| 776 | struct ieee802_11_elems { |
| 777 | /* pointers to IEs */ |
| 778 | u8 *ssid; |
| 779 | u8 *supp_rates; |
| 780 | u8 *fh_params; |
| 781 | u8 *ds_params; |
| 782 | u8 *cf_params; |
| 783 | u8 *tim; |
| 784 | u8 *ibss_params; |
| 785 | u8 *challenge; |
| 786 | u8 *wpa; |
| 787 | u8 *rsn; |
| 788 | u8 *erp_info; |
| 789 | u8 *ext_supp_rates; |
| 790 | u8 *wmm_info; |
| 791 | u8 *wmm_param; |
| 792 | u8 *ht_cap_elem; |
| 793 | u8 *ht_info_elem; |
| 794 | u8 *mesh_config; |
| 795 | u8 *mesh_id; |
| 796 | u8 *peer_link; |
| 797 | u8 *preq; |
| 798 | u8 *prep; |
| 799 | u8 *perr; |
| 800 | |
| 801 | /* length of them, respectively */ |
| 802 | u8 ssid_len; |
| 803 | u8 supp_rates_len; |
| 804 | u8 fh_params_len; |
| 805 | u8 ds_params_len; |
| 806 | u8 cf_params_len; |
| 807 | u8 tim_len; |
| 808 | u8 ibss_params_len; |
| 809 | u8 challenge_len; |
| 810 | u8 wpa_len; |
| 811 | u8 rsn_len; |
| 812 | u8 erp_info_len; |
| 813 | u8 ext_supp_rates_len; |
| 814 | u8 wmm_info_len; |
| 815 | u8 wmm_param_len; |
| 816 | u8 ht_cap_elem_len; |
| 817 | u8 ht_info_elem_len; |
| 818 | u8 mesh_config_len; |
| 819 | u8 mesh_id_len; |
| 820 | u8 peer_link_len; |
| 821 | u8 preq_len; |
| 822 | u8 prep_len; |
| 823 | u8 perr_len; |
| 824 | }; |
| 825 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 826 | static inline struct ieee80211_local *hw_to_local( |
| 827 | struct ieee80211_hw *hw) |
| 828 | { |
| 829 | return container_of(hw, struct ieee80211_local, hw); |
| 830 | } |
| 831 | |
| 832 | static inline struct ieee80211_hw *local_to_hw( |
| 833 | struct ieee80211_local *local) |
| 834 | { |
| 835 | return &local->hw; |
| 836 | } |
| 837 | |
| 838 | enum ieee80211_link_state_t { |
| 839 | IEEE80211_LINK_STATE_XOFF = 0, |
| 840 | IEEE80211_LINK_STATE_PENDING, |
| 841 | }; |
| 842 | |
| 843 | struct sta_attribute { |
| 844 | struct attribute attr; |
| 845 | ssize_t (*show)(const struct sta_info *, char *buf); |
| 846 | ssize_t (*store)(struct sta_info *, const char *buf, size_t count); |
| 847 | }; |
| 848 | |
Johannes Berg | 571ecf6 | 2007-07-27 15:43:22 +0200 | [diff] [blame] | 849 | static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) |
| 850 | { |
| 851 | return compare_ether_addr(raddr, addr) == 0 || |
| 852 | is_broadcast_ether_addr(raddr); |
| 853 | } |
| 854 | |
| 855 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 856 | /* ieee80211.c */ |
| 857 | int ieee80211_hw_config(struct ieee80211_local *local); |
| 858 | int ieee80211_if_config(struct net_device *dev); |
| 859 | int ieee80211_if_config_beacon(struct net_device *dev); |
Johannes Berg | 5cf121c | 2008-02-25 16:27:43 +0100 | [diff] [blame] | 860 | void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 861 | void ieee80211_if_setup(struct net_device *dev); |
Ron Rindjunsky | d3c990f | 2007-11-26 16:14:34 +0200 | [diff] [blame] | 862 | int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht, |
| 863 | struct ieee80211_ht_info *req_ht_cap, |
| 864 | struct ieee80211_ht_bss_info *req_bss_cap); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 865 | |
| 866 | /* ieee80211_ioctl.c */ |
| 867 | extern const struct iw_handler_def ieee80211_iw_handler_def; |
| 868 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 869 | |
| 870 | /* Least common multiple of the used rates (in 100 kbps). This is used to |
| 871 | * calculate rate_inv values for each rate so that only integers are needed. */ |
| 872 | #define CHAN_UTIL_RATE_LCM 95040 |
| 873 | /* 1 usec is 1/8 * (95040/10) = 1188 */ |
| 874 | #define CHAN_UTIL_PER_USEC 1188 |
| 875 | /* Amount of bits to shift the result right to scale the total utilization |
| 876 | * to values that will not wrap around 32-bit integers. */ |
| 877 | #define CHAN_UTIL_SHIFT 9 |
| 878 | /* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1): |
| 879 | * (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the |
| 880 | * raw value with about 23 should give utilization in 10th of a percentage |
| 881 | * (1/1000). However, utilization is only estimated and not all intervals |
| 882 | * between frames etc. are calculated. 18 seems to give numbers that are closer |
| 883 | * to the real maximum. */ |
| 884 | #define CHAN_UTIL_PER_10MS 18 |
| 885 | #define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC) |
| 886 | #define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC) |
| 887 | |
| 888 | |
| 889 | /* ieee80211_ioctl.c */ |
| 890 | int ieee80211_set_compression(struct ieee80211_local *local, |
| 891 | struct net_device *dev, struct sta_info *sta); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 892 | int ieee80211_set_freq(struct ieee80211_local *local, int freq); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 893 | /* ieee80211_sta.c */ |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 894 | #define IEEE80211_FC(type, stype) cpu_to_le16(type | stype) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 895 | void ieee80211_sta_timer(unsigned long data); |
| 896 | void ieee80211_sta_work(struct work_struct *work); |
| 897 | void ieee80211_sta_scan_work(struct work_struct *work); |
| 898 | void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, |
| 899 | struct ieee80211_rx_status *rx_status); |
| 900 | int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len); |
| 901 | int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len); |
| 902 | int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid); |
| 903 | int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len); |
| 904 | void ieee80211_sta_req_auth(struct net_device *dev, |
| 905 | struct ieee80211_if_sta *ifsta); |
| 906 | int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len); |
Johannes Berg | 9ae54c8 | 2008-01-31 19:48:20 +0100 | [diff] [blame] | 907 | ieee80211_rx_result ieee80211_sta_rx_scan( |
| 908 | struct net_device *dev, struct sk_buff *skb, |
| 909 | struct ieee80211_rx_status *rx_status); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 910 | void ieee80211_rx_bss_list_init(struct net_device *dev); |
| 911 | void ieee80211_rx_bss_list_deinit(struct net_device *dev); |
| 912 | int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len); |
| 913 | struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev, |
| 914 | struct sk_buff *skb, u8 *bssid, |
| 915 | u8 *addr); |
| 916 | int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason); |
| 917 | int ieee80211_sta_disassociate(struct net_device *dev, u16 reason); |
Johannes Berg | 471b3ef | 2007-12-28 14:32:58 +0100 | [diff] [blame] | 918 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, |
| 919 | u32 changed); |
Daniel Drake | d9430a3 | 2007-07-27 15:43:24 +0200 | [diff] [blame] | 920 | void ieee80211_reset_erp_info(struct net_device *dev); |
Ron Rindjunsky | c715350 | 2007-11-26 16:14:31 +0200 | [diff] [blame] | 921 | int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, |
| 922 | struct ieee80211_ht_info *ht_info); |
| 923 | int ieee80211_ht_addt_info_ie_to_ht_bss_info( |
| 924 | struct ieee80211_ht_addt_info *ht_add_info_ie, |
| 925 | struct ieee80211_ht_bss_info *bss_info); |
Ron Rindjunsky | eadc8d9 | 2008-01-28 14:07:17 +0200 | [diff] [blame] | 926 | void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, |
| 927 | u16 tid, u8 dialog_token, u16 start_seq_num, |
| 928 | u16 agg_size, u16 timeout); |
| 929 | void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, |
| 930 | u16 initiator, u16 reason_code); |
Ron Rindjunsky | 85249e5 | 2008-03-18 15:00:32 -0700 | [diff] [blame^] | 931 | |
Ron Rindjunsky | 07db218 | 2007-12-25 17:00:33 +0200 | [diff] [blame] | 932 | void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da, |
| 933 | u16 tid, u16 initiator, u16 reason); |
| 934 | void sta_rx_agg_session_timer_expired(unsigned long data); |
Ron Rindjunsky | eadc8d9 | 2008-01-28 14:07:17 +0200 | [diff] [blame] | 935 | void sta_addba_resp_timer_expired(unsigned long data); |
Ron Rindjunsky | 85249e5 | 2008-03-18 15:00:32 -0700 | [diff] [blame^] | 936 | void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr); |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 937 | u64 ieee80211_sta_get_rates(struct ieee80211_local *local, |
| 938 | struct ieee802_11_elems *elems, |
| 939 | enum ieee80211_band band); |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 940 | void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb, |
| 941 | int encrypt); |
| 942 | void ieee802_11_parse_elems(u8 *start, size_t len, |
| 943 | struct ieee802_11_elems *elems); |
| 944 | |
Johannes Berg | 902acc7 | 2008-02-23 15:17:19 +0100 | [diff] [blame] | 945 | #ifdef CONFIG_MAC80211_MESH |
| 946 | void ieee80211_start_mesh(struct net_device *dev); |
| 947 | #else |
| 948 | static inline void ieee80211_start_mesh(struct net_device *dev) |
| 949 | {} |
| 950 | #endif |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 951 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 952 | /* ieee80211_iface.c */ |
| 953 | int ieee80211_if_add(struct net_device *dev, const char *name, |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 954 | struct net_device **new_dev, int type, |
| 955 | struct vif_params *params); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 956 | void ieee80211_if_set_type(struct net_device *dev, int type); |
| 957 | void ieee80211_if_reinit(struct net_device *dev); |
| 958 | void __ieee80211_if_del(struct ieee80211_local *local, |
| 959 | struct ieee80211_sub_if_data *sdata); |
| 960 | int ieee80211_if_remove(struct net_device *dev, const char *name, int id); |
| 961 | void ieee80211_if_free(struct net_device *dev); |
| 962 | void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 963 | |
Johannes Berg | e2ebc74 | 2007-07-27 15:43:22 +0200 | [diff] [blame] | 964 | /* tx handling */ |
Johannes Berg | e2ebc74 | 2007-07-27 15:43:22 +0200 | [diff] [blame] | 965 | void ieee80211_clear_tx_pending(struct ieee80211_local *local); |
| 966 | void ieee80211_tx_pending(unsigned long data); |
| 967 | int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev); |
| 968 | int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev); |
| 969 | int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); |
Johannes Berg | e2ebc74 | 2007-07-27 15:43:22 +0200 | [diff] [blame] | 970 | |
Johannes Berg | c2d1560 | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 971 | /* utility functions/constants */ |
| 972 | extern void *mac80211_wiphy_privid; /* for wiphy privid */ |
| 973 | extern const unsigned char rfc1042_header[6]; |
| 974 | extern const unsigned char bridge_tunnel_header[6]; |
Ron Rindjunsky | 7136471 | 2007-12-25 17:00:36 +0200 | [diff] [blame] | 975 | u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, |
| 976 | enum ieee80211_if_types type); |
Johannes Berg | c2d1560 | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 977 | int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, |
| 978 | int rate, int erp, int short_preamble); |
Johannes Berg | eb063c1 | 2007-08-28 17:01:53 -0400 | [diff] [blame] | 979 | void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, |
| 980 | struct ieee80211_hdr *hdr); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 981 | |
| 982 | #endif /* IEEE80211_I_H */ |