blob: 006486b267261fa3f18b6dc3e1bb8f53f7e46efb [file] [log] [blame]
Jiri Bencf0706e822007-05-05 11:45:53 -07001/*
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 Berg571ecf62007-07-27 15:43:22 +020024#include <linux/etherdevice.h>
Jiri Bencf0706e822007-05-05 11:45:53 -070025#include <net/wireless.h>
Johannes Berg2c8dccc2008-04-08 15:14:40 -040026#include "key.h"
Jiri Bencf0706e822007-05-05 11:45:53 -070027#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
Johannes Berg9cfb0002008-04-03 15:17:31 +020038#define IEEE80211_FC(type, subtype) cpu_to_le16(type | subtype)
Jiri Bencf0706e822007-05-05 11:45:53 -070039
Johannes Berg9cfb0002008-04-03 15:17:31 +020040struct ieee80211_local;
Jiri Bencf0706e822007-05-05 11:45:53 -070041
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
61struct 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
73struct ieee80211_sta_bss {
74 struct list_head list;
75 struct ieee80211_sta_bss *hnext;
Johannes Berg056cdd52008-03-26 23:21:47 +010076 size_t ssid_len;
77
Jiri Bencf0706e822007-05-05 11:45:53 -070078 atomic_t users;
79
80 u8 bssid[ETH_ALEN];
81 u8 ssid[IEEE80211_MAX_SSID_LEN];
Jiri Bencf0706e822007-05-05 11:45:53 -070082 u16 capability; /* host byte order */
Johannes Berg8318d782008-01-24 19:38:38 +010083 enum ieee80211_band band;
Jiri Bencf0706e822007-05-05 11:45:53 -070084 int freq;
85 int rssi, signal, noise;
86 u8 *wpa_ie;
87 size_t wpa_ie_len;
88 u8 *rsn_ie;
89 size_t rsn_ie_len;
90 u8 *wmm_ie;
91 size_t wmm_ie_len;
Ron Rindjunskyc7153502007-11-26 16:14:31 +020092 u8 *ht_ie;
93 size_t ht_ie_len;
Luis Carlos Coboee385852008-02-23 15:17:11 +010094#ifdef CONFIG_MAC80211_MESH
95 u8 *mesh_id;
96 size_t mesh_id_len;
John W. Linville24736702008-04-08 14:15:46 -040097 u8 *mesh_cfg;
Johannes Berg902acc72008-02-23 15:17:19 +010098#endif
Jiri Bencf0706e822007-05-05 11:45:53 -070099#define IEEE80211_MAX_SUPP_RATES 32
100 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
101 size_t supp_rates_len;
Jiri Bencf0706e822007-05-05 11:45:53 -0700102 u64 timestamp;
Johannes Berg056cdd52008-03-26 23:21:47 +0100103 int beacon_int;
Jiri Bencf0706e822007-05-05 11:45:53 -0700104
Johannes Berg30b89b02008-04-16 17:43:20 +0200105 bool probe_resp;
Jiri Bencf0706e822007-05-05 11:45:53 -0700106 unsigned long last_update;
107
Daniel Drake56282212007-07-10 19:32:10 +0200108 /* during assocation, we save an ERP value from a probe response so
109 * that we can feed ERP info to the driver when handling the
110 * association completes. these fields probably won't be up-to-date
111 * otherwise, you probably don't want to use them. */
112 int has_erp_value;
113 u8 erp_value;
Jiri Bencf0706e822007-05-05 11:45:53 -0700114};
115
John W. Linville24736702008-04-08 14:15:46 -0400116static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss)
Johannes Berg902acc72008-02-23 15:17:19 +0100117{
118#ifdef CONFIG_MAC80211_MESH
119 return bss->mesh_cfg;
120#endif
121 return NULL;
122}
123
124static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss)
125{
126#ifdef CONFIG_MAC80211_MESH
127 return bss->mesh_id;
128#endif
129 return NULL;
130}
131
132static inline u8 bss_mesh_id_len(struct ieee80211_sta_bss *bss)
133{
134#ifdef CONFIG_MAC80211_MESH
135 return bss->mesh_id_len;
136#endif
137 return 0;
138}
139
Jiri Bencf0706e822007-05-05 11:45:53 -0700140
Johannes Berg9ae54c82008-01-31 19:48:20 +0100141typedef unsigned __bitwise__ ieee80211_tx_result;
142#define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
143#define TX_DROP ((__force ieee80211_tx_result) 1u)
144#define TX_QUEUED ((__force ieee80211_tx_result) 2u)
145
Johannes Berg5cf121c2008-02-25 16:27:43 +0100146#define IEEE80211_TX_FRAGMENTED BIT(0)
147#define IEEE80211_TX_UNICAST BIT(1)
148#define IEEE80211_TX_PS_BUFFERED BIT(2)
149#define IEEE80211_TX_PROBE_LAST_FRAG BIT(3)
150#define IEEE80211_TX_INJECTED BIT(4)
Johannes Berg9ae54c82008-01-31 19:48:20 +0100151
Johannes Berg5cf121c2008-02-25 16:27:43 +0100152struct ieee80211_tx_data {
Jiri Bencf0706e822007-05-05 11:45:53 -0700153 struct sk_buff *skb;
154 struct net_device *dev;
155 struct ieee80211_local *local;
156 struct ieee80211_sub_if_data *sdata;
157 struct sta_info *sta;
Jiri Bencf0706e822007-05-05 11:45:53 -0700158 struct ieee80211_key *key;
Jiri Bencf0706e822007-05-05 11:45:53 -0700159
Johannes Berg5cf121c2008-02-25 16:27:43 +0100160 struct ieee80211_tx_control *control;
161 struct ieee80211_channel *channel;
162 struct ieee80211_rate *rate;
163 /* use this rate (if set) for last fragment; rate can
164 * be set to lower rate for the first fragments, e.g.,
165 * when using CTS protection with IEEE 802.11g. */
166 struct ieee80211_rate *last_frag_rate;
167
168 /* Extra fragments (in addition to the first fragment
169 * in skb) */
Johannes Berg5cf121c2008-02-25 16:27:43 +0100170 struct sk_buff **extra_frag;
Johannes Berg056cdd52008-03-26 23:21:47 +0100171 int num_extra_frag;
172
173 u16 fc, ethertype;
174 unsigned int flags;
Johannes Berg5cf121c2008-02-25 16:27:43 +0100175};
176
177
178typedef unsigned __bitwise__ ieee80211_rx_result;
179#define RX_CONTINUE ((__force ieee80211_rx_result) 0u)
180#define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
181#define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
182#define RX_QUEUED ((__force ieee80211_rx_result) 3u)
183
184#define IEEE80211_RX_IN_SCAN BIT(0)
185/* frame is destined to interface currently processed (incl. multicast frames) */
186#define IEEE80211_RX_RA_MATCH BIT(1)
187#define IEEE80211_RX_AMSDU BIT(2)
188#define IEEE80211_RX_CMNTR_REPORTED BIT(3)
189#define IEEE80211_RX_FRAGMENTED BIT(4)
190
191struct ieee80211_rx_data {
192 struct sk_buff *skb;
193 struct net_device *dev;
194 struct ieee80211_local *local;
195 struct ieee80211_sub_if_data *sdata;
196 struct sta_info *sta;
Johannes Berg5cf121c2008-02-25 16:27:43 +0100197 struct ieee80211_key *key;
Johannes Berg5cf121c2008-02-25 16:27:43 +0100198 struct ieee80211_rx_status *status;
199 struct ieee80211_rate *rate;
Johannes Berg056cdd52008-03-26 23:21:47 +0100200
201 u16 fc, ethertype;
202 unsigned int flags;
Johannes Berg5cf121c2008-02-25 16:27:43 +0100203 int sent_ps_buffered;
204 int queue;
205 int load;
206 u32 tkip_iv32;
207 u16 tkip_iv16;
Jiri Bencf0706e822007-05-05 11:45:53 -0700208};
209
Jiri Slabye8bf9642007-08-28 17:01:54 -0400210/* flags used in struct ieee80211_tx_packet_data.flags */
211#define IEEE80211_TXPD_REQ_TX_STATUS BIT(0)
212#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1)
213#define IEEE80211_TXPD_REQUEUE BIT(2)
Johannes Berg678f5f72007-12-19 01:31:23 +0100214#define IEEE80211_TXPD_EAPOL_FRAME BIT(3)
Ron Rindjunsky9e723492008-01-28 14:07:18 +0200215#define IEEE80211_TXPD_AMPDU BIT(4)
Jiri Bencf0706e822007-05-05 11:45:53 -0700216/* Stored in sk_buff->cb */
217struct ieee80211_tx_packet_data {
218 int ifindex;
219 unsigned long jiffies;
Jiri Slabye8bf9642007-08-28 17:01:54 -0400220 unsigned int flags;
221 u8 queue;
Jiri Bencf0706e822007-05-05 11:45:53 -0700222};
223
224struct ieee80211_tx_stored_packet {
225 struct ieee80211_tx_control control;
226 struct sk_buff *skb;
Jiri Bencf0706e822007-05-05 11:45:53 -0700227 struct sk_buff **extra_frag;
Jiri Bencf0706e822007-05-05 11:45:53 -0700228 struct ieee80211_rate *last_frag_rate;
Johannes Berg056cdd52008-03-26 23:21:47 +0100229 int num_extra_frag;
Jiri Slabybadffb72007-08-28 17:01:54 -0400230 unsigned int last_frag_rate_ctrl_probe;
Jiri Bencf0706e822007-05-05 11:45:53 -0700231};
232
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100233struct beacon_data {
234 u8 *head, *tail;
235 int head_len, tail_len;
236 int dtim_period;
237};
238
Jiri Bencf0706e822007-05-05 11:45:53 -0700239struct ieee80211_if_ap {
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100240 struct beacon_data *beacon;
Jiri Bencf0706e822007-05-05 11:45:53 -0700241
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400242 struct list_head vlans;
243
Jiri Bencf0706e822007-05-05 11:45:53 -0700244 u8 ssid[IEEE80211_MAX_SSID_LEN];
245 size_t ssid_len;
Jiri Bencf0706e822007-05-05 11:45:53 -0700246
247 /* yes, this looks ugly, but guarantees that we can later use
248 * bitmap_empty :)
Johannes Berg004c8722008-02-20 11:21:35 +0100249 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
Jiri Bencf0706e822007-05-05 11:45:53 -0700250 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
Jiri Bencf0706e822007-05-05 11:45:53 -0700251 struct sk_buff_head ps_bc_buf;
Johannes Berg056cdd52008-03-26 23:21:47 +0100252 atomic_t num_sta_ps; /* number of stations in PS mode */
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100253 int dtim_count;
Jiri Bencf0706e822007-05-05 11:45:53 -0700254 int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
255 int max_ratectrl_rateidx; /* max TX rateidx for rate control */
256 int num_beacons; /* number of TXed beacon frames for this BSS */
257};
258
259struct ieee80211_if_wds {
Jiri Bencf0706e822007-05-05 11:45:53 -0700260 struct sta_info *sta;
Johannes Berg056cdd52008-03-26 23:21:47 +0100261 u8 remote_addr[ETH_ALEN];
Jiri Bencf0706e822007-05-05 11:45:53 -0700262};
263
264struct ieee80211_if_vlan {
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400265 struct ieee80211_sub_if_data *ap;
266 struct list_head list;
Jiri Bencf0706e822007-05-05 11:45:53 -0700267};
268
Luis Carlos Coboee385852008-02-23 15:17:11 +0100269struct mesh_stats {
270 __u32 fwded_frames; /* Mesh forwarded frames */
271 __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/
272 __u32 dropped_frames_no_route; /* Not transmitted, no route found */
273 atomic_t estab_plinks;
274};
275
276#define PREQ_Q_F_START 0x1
277#define PREQ_Q_F_REFRESH 0x2
278struct mesh_preq_queue {
279 struct list_head list;
280 u8 dst[ETH_ALEN];
281 u8 flags;
282};
283
Luis Carlos Coboee385852008-02-23 15:17:11 +0100284struct mesh_config {
285 /* Timeouts in ms */
286 /* Mesh plink management parameters */
287 u16 dot11MeshRetryTimeout;
288 u16 dot11MeshConfirmTimeout;
289 u16 dot11MeshHoldingTimeout;
290 u16 dot11MeshMaxPeerLinks;
291 u8 dot11MeshMaxRetries;
292 u8 dot11MeshTTL;
293 bool auto_open_plinks;
294 /* HWMP parameters */
Luis Carlos Coboee385852008-02-23 15:17:11 +0100295 u8 dot11MeshHWMPmaxPREQretries;
296 u32 path_refresh_time;
297 u16 min_discovery_timeout;
Johannes Berg056cdd52008-03-26 23:21:47 +0100298 u32 dot11MeshHWMPactivePathTimeout;
299 u16 dot11MeshHWMPpreqMinInterval;
300 u16 dot11MeshHWMPnetDiameterTraversalTime;
Luis Carlos Coboee385852008-02-23 15:17:11 +0100301};
Johannes Berg902acc72008-02-23 15:17:19 +0100302
Luis Carlos Coboee385852008-02-23 15:17:11 +0100303
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400304/* flags used in struct ieee80211_if_sta.flags */
305#define IEEE80211_STA_SSID_SET BIT(0)
306#define IEEE80211_STA_BSSID_SET BIT(1)
307#define IEEE80211_STA_PREV_BSSID_SET BIT(2)
308#define IEEE80211_STA_AUTHENTICATED BIT(3)
309#define IEEE80211_STA_ASSOCIATED BIT(4)
310#define IEEE80211_STA_PROBEREQ_POLL BIT(5)
311#define IEEE80211_STA_CREATE_IBSS BIT(6)
312#define IEEE80211_STA_MIXED_CELL BIT(7)
313#define IEEE80211_STA_WMM_ENABLED BIT(8)
314#define IEEE80211_STA_AUTO_SSID_SEL BIT(10)
315#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)
316#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000317#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
Jiri Bencf0706e822007-05-05 11:45:53 -0700318struct ieee80211_if_sta {
Johannes Berg056cdd52008-03-26 23:21:47 +0100319 struct timer_list timer;
320 struct work_struct work;
321 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
322 u8 ssid[IEEE80211_MAX_SSID_LEN];
Jiri Bencf0706e822007-05-05 11:45:53 -0700323 enum {
324 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
325 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
Luis Carlos Coboee385852008-02-23 15:17:11 +0100326 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED,
327 IEEE80211_MESH_UP
Jiri Bencf0706e822007-05-05 11:45:53 -0700328 } state;
Jiri Bencf0706e822007-05-05 11:45:53 -0700329 size_t ssid_len;
Helmut Schaaa0af5f12007-11-09 16:25:08 +0100330 u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
331 size_t scan_ssid_len;
Luis Carlos Coboee385852008-02-23 15:17:11 +0100332#ifdef CONFIG_MAC80211_MESH
333 struct timer_list mesh_path_timer;
334 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
Luis Carlos Coboee385852008-02-23 15:17:11 +0100335 size_t mesh_id_len;
336 /* Active Path Selection Protocol Identifier */
337 u8 mesh_pp_id[4];
338 /* Active Path Selection Metric Identifier */
339 u8 mesh_pm_id[4];
340 /* Congestion Control Mode Identifier */
341 u8 mesh_cc_id[4];
342 /* Local mesh Destination Sequence Number */
343 u32 dsn;
344 /* Last used PREQ ID */
345 u32 preq_id;
346 atomic_t mpaths;
347 /* Timestamp of last DSN update */
348 unsigned long last_dsn_update;
349 /* Timestamp of last DSN sent */
350 unsigned long last_preq;
351 struct mesh_rmc *rmc;
352 spinlock_t mesh_preq_queue_lock;
353 struct mesh_preq_queue preq_queue;
354 int preq_queue_len;
355 struct mesh_stats mshstats;
356 struct mesh_config mshcfg;
Luis Carlos Cobo51cedda2008-04-23 12:15:29 -0700357 u32 mesh_seqnum;
Johannes Berg056cdd52008-03-26 23:21:47 +0100358 bool accepting_plinks;
Luis Carlos Coboee385852008-02-23 15:17:11 +0100359#endif
Jiri Bencf0706e822007-05-05 11:45:53 -0700360 u16 aid;
361 u16 ap_capab, capab;
362 u8 *extra_ie; /* to be added to the end of AssocReq */
363 size_t extra_ie_len;
364
365 /* The last AssocReq/Resp IEs */
366 u8 *assocreq_ies, *assocresp_ies;
367 size_t assocreq_ies_len, assocresp_ies_len;
368
Johannes Berg056cdd52008-03-26 23:21:47 +0100369 struct sk_buff_head skb_queue;
370
Jiri Bencf0706e822007-05-05 11:45:53 -0700371 int auth_tries, assoc_tries;
372
Johannes Berg056cdd52008-03-26 23:21:47 +0100373 unsigned long request;
374
375 unsigned long last_probe;
376
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400377 unsigned int flags;
Jiri Bencf0706e822007-05-05 11:45:53 -0700378#define IEEE80211_STA_REQ_SCAN 0
379#define IEEE80211_STA_REQ_AUTH 1
380#define IEEE80211_STA_REQ_RUN 2
Jiri Bencf0706e822007-05-05 11:45:53 -0700381
382#define IEEE80211_AUTH_ALG_OPEN BIT(0)
383#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
384#define IEEE80211_AUTH_ALG_LEAP BIT(2)
385 unsigned int auth_algs; /* bitfield of allowed auth algs */
386 int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
387 int auth_transaction;
388
389 unsigned long ibss_join_req;
390 struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
Johannes Berg8318d782008-01-24 19:38:38 +0100391 u32 supp_rates_bits[IEEE80211_NUM_BANDS];
Jiri Bencf0706e822007-05-05 11:45:53 -0700392
393 int wmm_last_param_set;
Luis Carlos Coboee385852008-02-23 15:17:11 +0100394 int num_beacons; /* number of TXed beacon frames by this STA */
Jiri Bencf0706e822007-05-05 11:45:53 -0700395};
396
Johannes Berg902acc72008-02-23 15:17:19 +0100397static inline void ieee80211_if_sta_set_mesh_id(struct ieee80211_if_sta *ifsta,
398 u8 mesh_id_len, u8 *mesh_id)
399{
400#ifdef CONFIG_MAC80211_MESH
401 ifsta->mesh_id_len = mesh_id_len;
402 memcpy(ifsta->mesh_id, mesh_id, mesh_id_len);
403#endif
404}
405
406#ifdef CONFIG_MAC80211_MESH
407#define IEEE80211_IFSTA_MESH_CTR_INC(sta, name) \
408 do { (sta)->mshstats.name++; } while (0)
409#else
410#define IEEE80211_IFSTA_MESH_CTR_INC(sta, name) \
411 do { } while (0)
412#endif
Jiri Bencf0706e822007-05-05 11:45:53 -0700413
Jiri Slaby13262ff2007-08-28 17:01:54 -0400414/* flags used in struct ieee80211_sub_if_data.flags */
415#define IEEE80211_SDATA_ALLMULTI BIT(0)
416#define IEEE80211_SDATA_PROMISC BIT(1)
Johannes Berg471b3ef2007-12-28 14:32:58 +0100417#define IEEE80211_SDATA_USERSPACE_MLME BIT(2)
Johannes Berg8318d782008-01-24 19:38:38 +0100418#define IEEE80211_SDATA_OPERATING_GMODE BIT(3)
Jiri Bencf0706e822007-05-05 11:45:53 -0700419struct ieee80211_sub_if_data {
420 struct list_head list;
Jiri Bencf0706e822007-05-05 11:45:53 -0700421
422 struct wireless_dev wdev;
423
Johannes Berg11a843b2007-08-28 17:01:55 -0400424 /* keys */
425 struct list_head key_list;
426
Jiri Bencf0706e822007-05-05 11:45:53 -0700427 struct net_device *dev;
428 struct ieee80211_local *local;
429
Jiri Slaby13262ff2007-08-28 17:01:54 -0400430 unsigned int flags;
Daniel Drake7e9ed182007-07-27 15:43:24 +0200431
Jiri Bencf0706e822007-05-05 11:45:53 -0700432 int drop_unencrypted;
Jiri Bencf0706e822007-05-05 11:45:53 -0700433
Johannes Berg8318d782008-01-24 19:38:38 +0100434 /*
435 * basic rates of this AP or the AP we're associated to
436 */
437 u64 basic_rates;
438
Jiri Bencf0706e822007-05-05 11:45:53 -0700439 u16 sequence;
440
441 /* Fragment table for host-based reassembly */
442 struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
443 unsigned int fragment_next;
444
445#define NUM_DEFAULT_KEYS 4
446 struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
447 struct ieee80211_key *default_key;
448
Johannes Berg471b3ef2007-12-28 14:32:58 +0100449 /*
450 * BSS configuration for this interface.
451 *
452 * FIXME: I feel bad putting this here when we already have a
453 * bss pointer, but the bss pointer is just wrong when
454 * you have multiple virtual STA mode interfaces...
455 * This needs to be fixed.
456 */
457 struct ieee80211_bss_conf bss_conf;
Jiri Bencf0706e822007-05-05 11:45:53 -0700458 struct ieee80211_if_ap *bss; /* BSS that this device belongs to */
459
460 union {
461 struct ieee80211_if_ap ap;
462 struct ieee80211_if_wds wds;
463 struct ieee80211_if_vlan vlan;
464 struct ieee80211_if_sta sta;
Michael Wu8cc9a732008-01-31 19:48:23 +0100465 u32 mntr_flags;
Jiri Bencf0706e822007-05-05 11:45:53 -0700466 } u;
467 int channel_use;
468 int channel_use_raw;
Jiri Bence9f207f2007-05-05 11:46:38 -0700469
470#ifdef CONFIG_MAC80211_DEBUGFS
471 struct dentry *debugfsdir;
472 union {
473 struct {
474 struct dentry *channel_use;
475 struct dentry *drop_unencrypted;
Jiri Bence9f207f2007-05-05 11:46:38 -0700476 struct dentry *state;
477 struct dentry *bssid;
478 struct dentry *prev_bssid;
479 struct dentry *ssid_len;
480 struct dentry *aid;
481 struct dentry *ap_capab;
482 struct dentry *capab;
483 struct dentry *extra_ie_len;
484 struct dentry *auth_tries;
485 struct dentry *assoc_tries;
486 struct dentry *auth_algs;
487 struct dentry *auth_alg;
488 struct dentry *auth_transaction;
489 struct dentry *flags;
Luis Carlos Coboee385852008-02-23 15:17:11 +0100490 struct dentry *num_beacons_sta;
Jiri Bence9f207f2007-05-05 11:46:38 -0700491 } sta;
492 struct {
493 struct dentry *channel_use;
494 struct dentry *drop_unencrypted;
Jiri Bence9f207f2007-05-05 11:46:38 -0700495 struct dentry *num_sta_ps;
Jiri Bence9f207f2007-05-05 11:46:38 -0700496 struct dentry *dtim_count;
497 struct dentry *num_beacons;
498 struct dentry *force_unicast_rateidx;
499 struct dentry *max_ratectrl_rateidx;
500 struct dentry *num_buffered_multicast;
Jiri Bence9f207f2007-05-05 11:46:38 -0700501 } ap;
502 struct {
503 struct dentry *channel_use;
504 struct dentry *drop_unencrypted;
Jiri Bence9f207f2007-05-05 11:46:38 -0700505 struct dentry *peer;
506 } wds;
507 struct {
508 struct dentry *channel_use;
509 struct dentry *drop_unencrypted;
Jiri Bence9f207f2007-05-05 11:46:38 -0700510 } vlan;
511 struct {
512 struct dentry *mode;
513 } monitor;
514 struct dentry *default_key;
515 } debugfs;
Luis Carlos Coboee385852008-02-23 15:17:11 +0100516
517#ifdef CONFIG_MAC80211_MESH
518 struct dentry *mesh_stats_dir;
519 struct {
520 struct dentry *fwded_frames;
521 struct dentry *dropped_frames_ttl;
522 struct dentry *dropped_frames_no_route;
523 struct dentry *estab_plinks;
Johannes Berg902acc72008-02-23 15:17:19 +0100524 struct timer_list mesh_path_timer;
Luis Carlos Coboee385852008-02-23 15:17:11 +0100525 } mesh_stats;
526
527 struct dentry *mesh_config_dir;
528 struct {
529 struct dentry *dot11MeshRetryTimeout;
530 struct dentry *dot11MeshConfirmTimeout;
531 struct dentry *dot11MeshHoldingTimeout;
532 struct dentry *dot11MeshMaxRetries;
533 struct dentry *dot11MeshTTL;
534 struct dentry *auto_open_plinks;
535 struct dentry *dot11MeshMaxPeerLinks;
536 struct dentry *dot11MeshHWMPactivePathTimeout;
537 struct dentry *dot11MeshHWMPpreqMinInterval;
538 struct dentry *dot11MeshHWMPnetDiameterTraversalTime;
539 struct dentry *dot11MeshHWMPmaxPREQretries;
540 struct dentry *path_refresh_time;
541 struct dentry *min_discovery_timeout;
542 } mesh_config;
543#endif
544
Jiri Bence9f207f2007-05-05 11:46:38 -0700545#endif
Johannes Berg32bfd352007-12-19 01:31:26 +0100546 /* must be last, dynamically sized area in this! */
547 struct ieee80211_vif vif;
Jiri Bencf0706e822007-05-05 11:45:53 -0700548};
549
Johannes Berg32bfd352007-12-19 01:31:26 +0100550static inline
551struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
552{
553 return container_of(p, struct ieee80211_sub_if_data, vif);
554}
555
Jiri Bencf0706e822007-05-05 11:45:53 -0700556#define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)
557
558enum {
559 IEEE80211_RX_MSG = 1,
560 IEEE80211_TX_STATUS_MSG = 2,
Ron Rindjunskyeadc8d92008-01-28 14:07:17 +0200561 IEEE80211_DELBA_MSG = 3,
562 IEEE80211_ADDBA_MSG = 4,
Jiri Bencf0706e822007-05-05 11:45:53 -0700563};
564
565struct ieee80211_local {
566 /* embed the driver visible part.
567 * don't cast (use the static inlines below), but we keep
568 * it first anyway so they become a no-op */
569 struct ieee80211_hw hw;
570
571 const struct ieee80211_ops *ops;
572
Jiri Bencf0706e822007-05-05 11:45:53 -0700573 struct net_device *mdev; /* wmaster# - "master" 802.11 device */
Jiri Bencf0706e822007-05-05 11:45:53 -0700574 int open_count;
Michael Wu3d30d942008-01-31 19:48:27 +0100575 int monitors, cooked_mntrs;
Michael Wu8cc9a732008-01-31 19:48:23 +0100576 /* number of interfaces with corresponding FIF_ flags */
577 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss;
Johannes Berg4150c572007-09-17 01:29:23 -0400578 unsigned int filter_flags; /* FIF_* */
Jiri Bencf0706e822007-05-05 11:45:53 -0700579 struct iw_statistics wstats;
580 u8 wstats_flags;
Johannes Bergd0709a62008-02-25 16:27:46 +0100581 bool tim_in_locked_section; /* see ieee80211_beacon_get() */
Johannes Bergb306f452007-07-10 19:32:08 +0200582 int tx_headroom; /* required headroom for hardware/radiotap */
Jiri Bencf0706e822007-05-05 11:45:53 -0700583
584 enum {
585 IEEE80211_DEV_UNINITIALIZED = 0,
586 IEEE80211_DEV_REGISTERED,
587 IEEE80211_DEV_UNREGISTERED,
588 } reg_state;
589
590 /* Tasklet and skb queue to process calls from IRQ mode. All frames
591 * added to skb_queue will be processed, but frames in
592 * skb_queue_unreliable may be dropped if the total length of these
593 * queues increases over the limit. */
594#define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
595 struct tasklet_struct tasklet;
596 struct sk_buff_head skb_queue;
597 struct sk_buff_head skb_queue_unreliable;
598
Johannes Bergd0709a62008-02-25 16:27:46 +0100599 /* Station data */
600 /*
601 * The lock only protects the list, hash, timer and counter
602 * against manipulation, reads are done in RCU. Additionally,
Johannes Bergb16bd152008-04-11 21:40:35 +0200603 * the lock protects each BSS's TIM bitmap.
Johannes Bergd0709a62008-02-25 16:27:46 +0100604 */
605 spinlock_t sta_lock;
606 unsigned long num_sta;
Jiri Bencf0706e822007-05-05 11:45:53 -0700607 struct list_head sta_list;
Johannes Bergdc6676b2008-03-31 19:23:03 +0200608 struct list_head sta_flush_list;
609 struct work_struct sta_flush_work;
Jiri Bencf0706e822007-05-05 11:45:53 -0700610 struct sta_info *sta_hash[STA_HASH_SIZE];
611 struct timer_list sta_cleanup;
612
Ron Rindjunsky9e723492008-01-28 14:07:18 +0200613 unsigned long state[NUM_TX_DATA_QUEUES_AMPDU];
614 struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES_AMPDU];
Jiri Bencf0706e822007-05-05 11:45:53 -0700615 struct tasklet_struct tx_pending_tasklet;
616
Johannes Berg53918992007-09-26 15:19:47 +0200617 /* number of interfaces with corresponding IFF_ flags */
618 atomic_t iff_allmultis, iff_promiscs;
Jiri Bencf0706e822007-05-05 11:45:53 -0700619
620 struct rate_control_ref *rate_ctrl;
621
Jiri Bencf0706e822007-05-05 11:45:53 -0700622 int rts_threshold;
Jiri Bencf0706e822007-05-05 11:45:53 -0700623 int fragmentation_threshold;
624 int short_retry_limit; /* dot11ShortRetryLimit */
625 int long_retry_limit; /* dot11LongRetryLimit */
Jiri Bencf0706e822007-05-05 11:45:53 -0700626
627 struct crypto_blkcipher *wep_tx_tfm;
628 struct crypto_blkcipher *wep_rx_tfm;
629 u32 wep_iv;
Jiri Bencf0706e822007-05-05 11:45:53 -0700630
631 int bridge_packets; /* bridge packets between associated stations and
632 * deliver multicast frames both back to wireless
633 * media and to the local net stack */
634
Johannes Berg79010422007-09-18 17:29:21 -0400635 struct list_head interfaces;
636
Johannes Bergb16bd152008-04-11 21:40:35 +0200637 /*
638 * Key lock, protects sdata's key_list and sta_info's
639 * key pointers (write access, they're RCU.)
640 */
641 spinlock_t key_lock;
642
643
Zhu Yiece8edd2007-11-22 10:53:21 +0800644 bool sta_sw_scanning;
645 bool sta_hw_scanning;
Jiri Bencf0706e822007-05-05 11:45:53 -0700646 int scan_channel_idx;
Johannes Berg8318d782008-01-24 19:38:38 +0100647 enum ieee80211_band scan_band;
648
Jiri Bencf0706e822007-05-05 11:45:53 -0700649 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
650 unsigned long last_scan_completed;
651 struct delayed_work scan_work;
652 struct net_device *scan_dev;
653 struct ieee80211_channel *oper_channel, *scan_channel;
Jiri Bencf0706e822007-05-05 11:45:53 -0700654 u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
655 size_t scan_ssid_len;
656 struct list_head sta_bss_list;
657 struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
658 spinlock_t sta_bss_lock;
Jiri Bencf0706e822007-05-05 11:45:53 -0700659
660 /* SNMP counters */
661 /* dot11CountersTable */
662 u32 dot11TransmittedFragmentCount;
663 u32 dot11MulticastTransmittedFrameCount;
664 u32 dot11FailedCount;
665 u32 dot11RetryCount;
666 u32 dot11MultipleRetryCount;
667 u32 dot11FrameDuplicateCount;
668 u32 dot11ReceivedFragmentCount;
669 u32 dot11MulticastReceivedFrameCount;
670 u32 dot11TransmittedFrameCount;
671 u32 dot11WEPUndecryptableCount;
672
673#ifdef CONFIG_MAC80211_LEDS
674 int tx_led_counter, rx_led_counter;
Ivo van Doorncdcb0062008-01-07 19:45:24 +0100675 struct led_trigger *tx_led, *rx_led, *assoc_led, *radio_led;
676 char tx_led_name[32], rx_led_name[32],
677 assoc_led_name[32], radio_led_name[32];
Jiri Bencf0706e822007-05-05 11:45:53 -0700678#endif
679
680 u32 channel_use;
681 u32 channel_use_raw;
Jiri Bencf0706e822007-05-05 11:45:53 -0700682
Jiri Bence9f207f2007-05-05 11:46:38 -0700683#ifdef CONFIG_MAC80211_DEBUGFS
684 struct work_struct sta_debugfs_add;
685#endif
686
Jiri Bencf0706e822007-05-05 11:45:53 -0700687#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
688 /* TX/RX handler statistics */
689 unsigned int tx_handlers_drop;
690 unsigned int tx_handlers_queued;
691 unsigned int tx_handlers_drop_unencrypted;
692 unsigned int tx_handlers_drop_fragment;
693 unsigned int tx_handlers_drop_wep;
694 unsigned int tx_handlers_drop_not_assoc;
695 unsigned int tx_handlers_drop_unauth_port;
696 unsigned int rx_handlers_drop;
697 unsigned int rx_handlers_queued;
698 unsigned int rx_handlers_drop_nullfunc;
699 unsigned int rx_handlers_drop_defrag;
700 unsigned int rx_handlers_drop_short;
701 unsigned int rx_handlers_drop_passive_scan;
702 unsigned int tx_expand_skb_head;
703 unsigned int tx_expand_skb_head_cloned;
704 unsigned int rx_expand_skb_head;
705 unsigned int rx_expand_skb_head2;
706 unsigned int rx_handlers_fragments;
707 unsigned int tx_status_drop;
708 unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
709 unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
710#define I802_DEBUG_INC(c) (c)++
711#else /* CONFIG_MAC80211_DEBUG_COUNTERS */
712#define I802_DEBUG_INC(c) do { } while (0)
713#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
714
715
Jiri Bencf0706e822007-05-05 11:45:53 -0700716 int total_ps_buffered; /* total number of all buffered unicast and
717 * multicast packets for power saving stations
718 */
Jiri Bencf0706e822007-05-05 11:45:53 -0700719 int wifi_wme_noack_test;
720 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
721
Jiri Bence9f207f2007-05-05 11:46:38 -0700722#ifdef CONFIG_MAC80211_DEBUGFS
723 struct local_debugfsdentries {
Jiri Bence9f207f2007-05-05 11:46:38 -0700724 struct dentry *frequency;
Jiri Bence9f207f2007-05-05 11:46:38 -0700725 struct dentry *antenna_sel_tx;
726 struct dentry *antenna_sel_rx;
727 struct dentry *bridge_packets;
Jiri Bence9f207f2007-05-05 11:46:38 -0700728 struct dentry *rts_threshold;
729 struct dentry *fragmentation_threshold;
730 struct dentry *short_retry_limit;
731 struct dentry *long_retry_limit;
732 struct dentry *total_ps_buffered;
Jiri Bence9f207f2007-05-05 11:46:38 -0700733 struct dentry *wep_iv;
Jiri Bence9f207f2007-05-05 11:46:38 -0700734 struct dentry *statistics;
735 struct local_debugfsdentries_statsdentries {
736 struct dentry *transmitted_fragment_count;
737 struct dentry *multicast_transmitted_frame_count;
738 struct dentry *failed_count;
739 struct dentry *retry_count;
740 struct dentry *multiple_retry_count;
741 struct dentry *frame_duplicate_count;
742 struct dentry *received_fragment_count;
743 struct dentry *multicast_received_frame_count;
744 struct dentry *transmitted_frame_count;
745 struct dentry *wep_undecryptable_count;
746 struct dentry *num_scans;
747#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
748 struct dentry *tx_handlers_drop;
749 struct dentry *tx_handlers_queued;
750 struct dentry *tx_handlers_drop_unencrypted;
751 struct dentry *tx_handlers_drop_fragment;
752 struct dentry *tx_handlers_drop_wep;
753 struct dentry *tx_handlers_drop_not_assoc;
754 struct dentry *tx_handlers_drop_unauth_port;
755 struct dentry *rx_handlers_drop;
756 struct dentry *rx_handlers_queued;
757 struct dentry *rx_handlers_drop_nullfunc;
758 struct dentry *rx_handlers_drop_defrag;
759 struct dentry *rx_handlers_drop_short;
760 struct dentry *rx_handlers_drop_passive_scan;
761 struct dentry *tx_expand_skb_head;
762 struct dentry *tx_expand_skb_head_cloned;
763 struct dentry *rx_expand_skb_head;
764 struct dentry *rx_expand_skb_head2;
765 struct dentry *rx_handlers_fragments;
766 struct dentry *tx_status_drop;
767 struct dentry *wme_tx_queue;
768 struct dentry *wme_rx_queue;
769#endif
770 struct dentry *dot11ACKFailureCount;
771 struct dentry *dot11RTSFailureCount;
772 struct dentry *dot11FCSErrorCount;
773 struct dentry *dot11RTSSuccessCount;
774 } stats;
775 struct dentry *stations;
776 struct dentry *keys;
777 } debugfs;
778#endif
Jiri Bencf0706e822007-05-05 11:45:53 -0700779};
780
Ron Rindjunskyeadc8d92008-01-28 14:07:17 +0200781/* this struct represents 802.11n's RA/TID combination */
782struct ieee80211_ra_tid {
783 u8 ra[ETH_ALEN];
784 u16 tid;
785};
786
Luis Carlos Coboee385852008-02-23 15:17:11 +0100787/* Parsed Information Elements */
788struct ieee802_11_elems {
789 /* pointers to IEs */
790 u8 *ssid;
791 u8 *supp_rates;
792 u8 *fh_params;
793 u8 *ds_params;
794 u8 *cf_params;
795 u8 *tim;
796 u8 *ibss_params;
797 u8 *challenge;
798 u8 *wpa;
799 u8 *rsn;
800 u8 *erp_info;
801 u8 *ext_supp_rates;
802 u8 *wmm_info;
803 u8 *wmm_param;
804 u8 *ht_cap_elem;
805 u8 *ht_info_elem;
806 u8 *mesh_config;
807 u8 *mesh_id;
808 u8 *peer_link;
809 u8 *preq;
810 u8 *prep;
811 u8 *perr;
812
813 /* length of them, respectively */
814 u8 ssid_len;
815 u8 supp_rates_len;
816 u8 fh_params_len;
817 u8 ds_params_len;
818 u8 cf_params_len;
819 u8 tim_len;
820 u8 ibss_params_len;
821 u8 challenge_len;
822 u8 wpa_len;
823 u8 rsn_len;
824 u8 erp_info_len;
825 u8 ext_supp_rates_len;
826 u8 wmm_info_len;
827 u8 wmm_param_len;
828 u8 ht_cap_elem_len;
829 u8 ht_info_elem_len;
830 u8 mesh_config_len;
831 u8 mesh_id_len;
832 u8 peer_link_len;
833 u8 preq_len;
834 u8 prep_len;
835 u8 perr_len;
836};
837
Jiri Bencf0706e822007-05-05 11:45:53 -0700838static inline struct ieee80211_local *hw_to_local(
839 struct ieee80211_hw *hw)
840{
841 return container_of(hw, struct ieee80211_local, hw);
842}
843
844static inline struct ieee80211_hw *local_to_hw(
845 struct ieee80211_local *local)
846{
847 return &local->hw;
848}
849
850enum ieee80211_link_state_t {
851 IEEE80211_LINK_STATE_XOFF = 0,
852 IEEE80211_LINK_STATE_PENDING,
853};
854
855struct sta_attribute {
856 struct attribute attr;
857 ssize_t (*show)(const struct sta_info *, char *buf);
858 ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
859};
860
Johannes Berg571ecf62007-07-27 15:43:22 +0200861static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
862{
863 return compare_ether_addr(raddr, addr) == 0 ||
864 is_broadcast_ether_addr(raddr);
865}
866
867
Jiri Bencf0706e822007-05-05 11:45:53 -0700868/* ieee80211.c */
869int ieee80211_hw_config(struct ieee80211_local *local);
870int ieee80211_if_config(struct net_device *dev);
871int ieee80211_if_config_beacon(struct net_device *dev);
Johannes Berg5cf121c2008-02-25 16:27:43 +0100872void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
Jiri Bencf0706e822007-05-05 11:45:53 -0700873void ieee80211_if_setup(struct net_device *dev);
Tomas Winkler38668c02008-03-28 16:33:32 -0700874u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
875 struct ieee80211_ht_info *req_ht_cap,
876 struct ieee80211_ht_bss_info *req_bss_cap);
Jiri Bencf0706e822007-05-05 11:45:53 -0700877
878/* ieee80211_ioctl.c */
879extern const struct iw_handler_def ieee80211_iw_handler_def;
880
Jiri Bencf0706e822007-05-05 11:45:53 -0700881
882/* Least common multiple of the used rates (in 100 kbps). This is used to
883 * calculate rate_inv values for each rate so that only integers are needed. */
884#define CHAN_UTIL_RATE_LCM 95040
885/* 1 usec is 1/8 * (95040/10) = 1188 */
886#define CHAN_UTIL_PER_USEC 1188
887/* Amount of bits to shift the result right to scale the total utilization
888 * to values that will not wrap around 32-bit integers. */
889#define CHAN_UTIL_SHIFT 9
890/* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1):
891 * (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the
892 * raw value with about 23 should give utilization in 10th of a percentage
893 * (1/1000). However, utilization is only estimated and not all intervals
894 * between frames etc. are calculated. 18 seems to give numbers that are closer
895 * to the real maximum. */
896#define CHAN_UTIL_PER_10MS 18
897#define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC)
898#define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC)
899
900
901/* ieee80211_ioctl.c */
Assaf Kraussbe038b32008-06-05 19:55:21 +0300902int ieee80211_set_freq(struct net_device *dev, int freq);
Jiri Bencf0706e822007-05-05 11:45:53 -0700903/* ieee80211_sta.c */
904void ieee80211_sta_timer(unsigned long data);
905void ieee80211_sta_work(struct work_struct *work);
906void ieee80211_sta_scan_work(struct work_struct *work);
907void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
908 struct ieee80211_rx_status *rx_status);
909int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len);
910int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len);
911int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid);
912int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
913void ieee80211_sta_req_auth(struct net_device *dev,
914 struct ieee80211_if_sta *ifsta);
915int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
Johannes Berg9ae54c82008-01-31 19:48:20 +0100916ieee80211_rx_result ieee80211_sta_rx_scan(
917 struct net_device *dev, struct sk_buff *skb,
918 struct ieee80211_rx_status *rx_status);
Jiri Bencf0706e822007-05-05 11:45:53 -0700919void ieee80211_rx_bss_list_init(struct net_device *dev);
920void ieee80211_rx_bss_list_deinit(struct net_device *dev);
921int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
922struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
923 struct sk_buff *skb, u8 *bssid,
924 u8 *addr);
925int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
926int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
Johannes Berg471b3ef2007-12-28 14:32:58 +0100927void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
928 u32 changed);
Daniel Draked9430a32007-07-27 15:43:24 +0200929void ieee80211_reset_erp_info(struct net_device *dev);
Ron Rindjunskyc7153502007-11-26 16:14:31 +0200930int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
931 struct ieee80211_ht_info *ht_info);
932int ieee80211_ht_addt_info_ie_to_ht_bss_info(
933 struct ieee80211_ht_addt_info *ht_add_info_ie,
934 struct ieee80211_ht_bss_info *bss_info);
Ron Rindjunskyeadc8d92008-01-28 14:07:17 +0200935void ieee80211_send_addba_request(struct net_device *dev, const u8 *da,
936 u16 tid, u8 dialog_token, u16 start_seq_num,
937 u16 agg_size, u16 timeout);
938void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid,
939 u16 initiator, u16 reason_code);
Ron Rindjunsky85249e52008-03-18 15:00:32 -0700940
Ron Rindjunsky07db2182007-12-25 17:00:33 +0200941void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da,
942 u16 tid, u16 initiator, u16 reason);
943void sta_rx_agg_session_timer_expired(unsigned long data);
Ron Rindjunskyeadc8d92008-01-28 14:07:17 +0200944void sta_addba_resp_timer_expired(unsigned long data);
Ron Rindjunsky85249e52008-03-18 15:00:32 -0700945void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr);
Luis Carlos Coboee385852008-02-23 15:17:11 +0100946u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
947 struct ieee802_11_elems *elems,
948 enum ieee80211_band band);
Luis Carlos Coboee385852008-02-23 15:17:11 +0100949void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb,
950 int encrypt);
951void ieee802_11_parse_elems(u8 *start, size_t len,
952 struct ieee802_11_elems *elems);
953
Johannes Berg902acc72008-02-23 15:17:19 +0100954#ifdef CONFIG_MAC80211_MESH
955void ieee80211_start_mesh(struct net_device *dev);
956#else
957static inline void ieee80211_start_mesh(struct net_device *dev)
958{}
959#endif
Luis Carlos Coboee385852008-02-23 15:17:11 +0100960
Jiri Bencf0706e822007-05-05 11:45:53 -0700961/* ieee80211_iface.c */
962int ieee80211_if_add(struct net_device *dev, const char *name,
Luis Carlos Coboee385852008-02-23 15:17:11 +0100963 struct net_device **new_dev, int type,
964 struct vif_params *params);
Jiri Bencf0706e822007-05-05 11:45:53 -0700965void ieee80211_if_set_type(struct net_device *dev, int type);
966void ieee80211_if_reinit(struct net_device *dev);
967void __ieee80211_if_del(struct ieee80211_local *local,
968 struct ieee80211_sub_if_data *sdata);
969int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
970void ieee80211_if_free(struct net_device *dev);
971void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
Jiri Bencf0706e822007-05-05 11:45:53 -0700972
Johannes Berge2ebc742007-07-27 15:43:22 +0200973/* tx handling */
Johannes Berge2ebc742007-07-27 15:43:22 +0200974void ieee80211_clear_tx_pending(struct ieee80211_local *local);
975void ieee80211_tx_pending(unsigned long data);
976int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);
977int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
978int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
Johannes Berge2ebc742007-07-27 15:43:22 +0200979
Johannes Bergc2d15602007-07-27 15:43:23 +0200980/* utility functions/constants */
981extern void *mac80211_wiphy_privid; /* for wiphy privid */
982extern const unsigned char rfc1042_header[6];
983extern const unsigned char bridge_tunnel_header[6];
Ron Rindjunsky71364712007-12-25 17:00:36 +0200984u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
985 enum ieee80211_if_types type);
Johannes Bergc2d15602007-07-27 15:43:23 +0200986int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
987 int rate, int erp, int short_preamble);
Johannes Bergeb063c12007-08-28 17:01:53 -0400988void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx,
989 struct ieee80211_hdr *hdr);
Jiri Bencf0706e822007-05-05 11:45:53 -0700990
991#endif /* IEEE80211_I_H */