aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/ieee80211_i.h
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/ieee80211_i.h')
-rw-r--r--net/mac80211/ieee80211_i.h525
1 files changed, 345 insertions, 180 deletions
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 72ecbf7bf962..8e53ce7ed444 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -23,7 +23,7 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/etherdevice.h> 24#include <linux/etherdevice.h>
25#include <net/wireless.h> 25#include <net/wireless.h>
26#include "ieee80211_key.h" 26#include "key.h"
27#include "sta_info.h" 27#include "sta_info.h"
28 28
29/* ieee80211.o internal definitions, etc. These are not included into 29/* ieee80211.o internal definitions, etc. These are not included into
@@ -35,9 +35,9 @@
35 35
36#define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08) 36#define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
37 37
38struct ieee80211_local; 38#define IEEE80211_FC(type, subtype) cpu_to_le16(type | subtype)
39 39
40#define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3) 40struct ieee80211_local;
41 41
42/* Maximum number of broadcast/multicast frames to buffer when some of the 42/* Maximum number of broadcast/multicast frames to buffer when some of the
43 * associated stations are using power saving. */ 43 * associated stations are using power saving. */
@@ -73,14 +73,14 @@ struct ieee80211_fragment_entry {
73struct ieee80211_sta_bss { 73struct ieee80211_sta_bss {
74 struct list_head list; 74 struct list_head list;
75 struct ieee80211_sta_bss *hnext; 75 struct ieee80211_sta_bss *hnext;
76 size_t ssid_len;
77
76 atomic_t users; 78 atomic_t users;
77 79
78 u8 bssid[ETH_ALEN]; 80 u8 bssid[ETH_ALEN];
79 u8 ssid[IEEE80211_MAX_SSID_LEN]; 81 u8 ssid[IEEE80211_MAX_SSID_LEN];
80 size_t ssid_len;
81 u16 capability; /* host byte order */ 82 u16 capability; /* host byte order */
82 int hw_mode; 83 enum ieee80211_band band;
83 int channel;
84 int freq; 84 int freq;
85 int rssi, signal, noise; 85 int rssi, signal, noise;
86 u8 *wpa_ie; 86 u8 *wpa_ie;
@@ -91,13 +91,18 @@ struct ieee80211_sta_bss {
91 size_t wmm_ie_len; 91 size_t wmm_ie_len;
92 u8 *ht_ie; 92 u8 *ht_ie;
93 size_t ht_ie_len; 93 size_t ht_ie_len;
94#ifdef CONFIG_MAC80211_MESH
95 u8 *mesh_id;
96 size_t mesh_id_len;
97 u8 *mesh_cfg;
98#endif
94#define IEEE80211_MAX_SUPP_RATES 32 99#define IEEE80211_MAX_SUPP_RATES 32
95 u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 100 u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
96 size_t supp_rates_len; 101 size_t supp_rates_len;
97 int beacon_int;
98 u64 timestamp; 102 u64 timestamp;
103 int beacon_int;
99 104
100 int probe_resp; 105 bool probe_resp;
101 unsigned long last_update; 106 unsigned long last_update;
102 107
103 /* during assocation, we save an ERP value from a probe response so 108 /* during assocation, we save an ERP value from a probe response so
@@ -108,56 +113,98 @@ struct ieee80211_sta_bss {
108 u8 erp_value; 113 u8 erp_value;
109}; 114};
110 115
116static inline u8 *bss_mesh_cfg(struct ieee80211_sta_bss *bss)
117{
118#ifdef CONFIG_MAC80211_MESH
119 return bss->mesh_cfg;
120#endif
121 return NULL;
122}
111 123
112typedef enum { 124static inline u8 *bss_mesh_id(struct ieee80211_sta_bss *bss)
113 TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED 125{
114} ieee80211_txrx_result; 126#ifdef CONFIG_MAC80211_MESH
127 return bss->mesh_id;
128#endif
129 return NULL;
130}
115 131
116/* flags used in struct ieee80211_txrx_data.flags */ 132static inline u8 bss_mesh_id_len(struct ieee80211_sta_bss *bss)
117/* whether the MSDU was fragmented */ 133{
118#define IEEE80211_TXRXD_FRAGMENTED BIT(0) 134#ifdef CONFIG_MAC80211_MESH
119#define IEEE80211_TXRXD_TXUNICAST BIT(1) 135 return bss->mesh_id_len;
120#define IEEE80211_TXRXD_TXPS_BUFFERED BIT(2) 136#endif
121#define IEEE80211_TXRXD_TXPROBE_LAST_FRAG BIT(3) 137 return 0;
122#define IEEE80211_TXRXD_RXIN_SCAN BIT(4) 138}
123/* frame is destined to interface currently processed (incl. multicast frames) */ 139
124#define IEEE80211_TXRXD_RXRA_MATCH BIT(5) 140
125#define IEEE80211_TXRXD_TX_INJECTED BIT(6) 141typedef unsigned __bitwise__ ieee80211_tx_result;
126#define IEEE80211_TXRXD_RX_AMSDU BIT(7) 142#define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
127struct ieee80211_txrx_data { 143#define TX_DROP ((__force ieee80211_tx_result) 1u)
144#define TX_QUEUED ((__force ieee80211_tx_result) 2u)
145
146#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)
151
152struct ieee80211_tx_data {
128 struct sk_buff *skb; 153 struct sk_buff *skb;
129 struct net_device *dev; 154 struct net_device *dev;
130 struct ieee80211_local *local; 155 struct ieee80211_local *local;
131 struct ieee80211_sub_if_data *sdata; 156 struct ieee80211_sub_if_data *sdata;
132 struct sta_info *sta; 157 struct sta_info *sta;
158 struct ieee80211_key *key;
159
160 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) */
170 struct sk_buff **extra_frag;
171 int num_extra_frag;
172
133 u16 fc, ethertype; 173 u16 fc, ethertype;
174 unsigned int flags;
175};
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;
134 struct ieee80211_key *key; 197 struct ieee80211_key *key;
198 struct ieee80211_rx_status *status;
199 struct ieee80211_rate *rate;
200
201 u16 fc, ethertype;
135 unsigned int flags; 202 unsigned int flags;
136 union { 203 int sent_ps_buffered;
137 struct { 204 int queue;
138 struct ieee80211_tx_control *control; 205 int load;
139 struct ieee80211_hw_mode *mode; 206 u32 tkip_iv32;
140 struct ieee80211_rate *rate; 207 u16 tkip_iv16;
141 /* use this rate (if set) for last fragment; rate can
142 * be set to lower rate for the first fragments, e.g.,
143 * when using CTS protection with IEEE 802.11g. */
144 struct ieee80211_rate *last_frag_rate;
145 int last_frag_hwrate;
146
147 /* Extra fragments (in addition to the first fragment
148 * in skb) */
149 int num_extra_frag;
150 struct sk_buff **extra_frag;
151 } tx;
152 struct {
153 struct ieee80211_rx_status *status;
154 int sent_ps_buffered;
155 int queue;
156 int load;
157 u32 tkip_iv32;
158 u16 tkip_iv16;
159 } rx;
160 } u;
161}; 208};
162 209
163/* flags used in struct ieee80211_tx_packet_data.flags */ 210/* flags used in struct ieee80211_tx_packet_data.flags */
@@ -165,6 +212,7 @@ struct ieee80211_txrx_data {
165#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1) 212#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1)
166#define IEEE80211_TXPD_REQUEUE BIT(2) 213#define IEEE80211_TXPD_REQUEUE BIT(2)
167#define IEEE80211_TXPD_EAPOL_FRAME BIT(3) 214#define IEEE80211_TXPD_EAPOL_FRAME BIT(3)
215#define IEEE80211_TXPD_AMPDU BIT(4)
168/* Stored in sk_buff->cb */ 216/* Stored in sk_buff->cb */
169struct ieee80211_tx_packet_data { 217struct ieee80211_tx_packet_data {
170 int ifindex; 218 int ifindex;
@@ -176,20 +224,12 @@ struct ieee80211_tx_packet_data {
176struct ieee80211_tx_stored_packet { 224struct ieee80211_tx_stored_packet {
177 struct ieee80211_tx_control control; 225 struct ieee80211_tx_control control;
178 struct sk_buff *skb; 226 struct sk_buff *skb;
179 int num_extra_frag;
180 struct sk_buff **extra_frag; 227 struct sk_buff **extra_frag;
181 int last_frag_rateidx;
182 int last_frag_hwrate;
183 struct ieee80211_rate *last_frag_rate; 228 struct ieee80211_rate *last_frag_rate;
229 int num_extra_frag;
184 unsigned int last_frag_rate_ctrl_probe; 230 unsigned int last_frag_rate_ctrl_probe;
185}; 231};
186 232
187typedef ieee80211_txrx_result (*ieee80211_tx_handler)
188(struct ieee80211_txrx_data *tx);
189
190typedef ieee80211_txrx_result (*ieee80211_rx_handler)
191(struct ieee80211_txrx_data *rx);
192
193struct beacon_data { 233struct beacon_data {
194 u8 *head, *tail; 234 u8 *head, *tail;
195 int head_len, tail_len; 235 int head_len, tail_len;
@@ -206,10 +246,10 @@ struct ieee80211_if_ap {
206 246
207 /* yes, this looks ugly, but guarantees that we can later use 247 /* yes, this looks ugly, but guarantees that we can later use
208 * bitmap_empty :) 248 * bitmap_empty :)
209 * NB: don't ever use set_bit, use bss_tim_set/bss_tim_clear! */ 249 * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
210 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; 250 u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
211 atomic_t num_sta_ps; /* number of stations in PS mode */
212 struct sk_buff_head ps_bc_buf; 251 struct sk_buff_head ps_bc_buf;
252 atomic_t num_sta_ps; /* number of stations in PS mode */
213 int dtim_count; 253 int dtim_count;
214 int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ 254 int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
215 int max_ratectrl_rateidx; /* max TX rateidx for rate control */ 255 int max_ratectrl_rateidx; /* max TX rateidx for rate control */
@@ -217,8 +257,8 @@ struct ieee80211_if_ap {
217}; 257};
218 258
219struct ieee80211_if_wds { 259struct ieee80211_if_wds {
220 u8 remote_addr[ETH_ALEN];
221 struct sta_info *sta; 260 struct sta_info *sta;
261 u8 remote_addr[ETH_ALEN];
222}; 262};
223 263
224struct ieee80211_if_vlan { 264struct ieee80211_if_vlan {
@@ -226,6 +266,41 @@ struct ieee80211_if_vlan {
226 struct list_head list; 266 struct list_head list;
227}; 267};
228 268
269struct 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
284struct 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 */
295 u8 dot11MeshHWMPmaxPREQretries;
296 u32 path_refresh_time;
297 u16 min_discovery_timeout;
298 u32 dot11MeshHWMPactivePathTimeout;
299 u16 dot11MeshHWMPpreqMinInterval;
300 u16 dot11MeshHWMPnetDiameterTraversalTime;
301};
302
303
229/* flags used in struct ieee80211_if_sta.flags */ 304/* flags used in struct ieee80211_if_sta.flags */
230#define IEEE80211_STA_SSID_SET BIT(0) 305#define IEEE80211_STA_SSID_SET BIT(0)
231#define IEEE80211_STA_BSSID_SET BIT(1) 306#define IEEE80211_STA_BSSID_SET BIT(1)
@@ -241,18 +316,47 @@ struct ieee80211_if_vlan {
241#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12) 316#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
242#define IEEE80211_STA_PRIVACY_INVOKED BIT(13) 317#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)
243struct ieee80211_if_sta { 318struct ieee80211_if_sta {
244 enum {
245 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
246 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
247 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED
248 } state;
249 struct timer_list timer; 319 struct timer_list timer;
250 struct work_struct work; 320 struct work_struct work;
251 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; 321 u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
252 u8 ssid[IEEE80211_MAX_SSID_LEN]; 322 u8 ssid[IEEE80211_MAX_SSID_LEN];
323 enum {
324 IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
325 IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
326 IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED,
327 IEEE80211_MESH_UP
328 } state;
253 size_t ssid_len; 329 size_t ssid_len;
254 u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; 330 u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
255 size_t scan_ssid_len; 331 size_t scan_ssid_len;
332#ifdef CONFIG_MAC80211_MESH
333 struct timer_list mesh_path_timer;
334 u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
335 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;
357 u8 mesh_seqnum[3];
358 bool accepting_plinks;
359#endif
256 u16 aid; 360 u16 aid;
257 u16 ap_capab, capab; 361 u16 ap_capab, capab;
258 u8 *extra_ie; /* to be added to the end of AssocReq */ 362 u8 *extra_ie; /* to be added to the end of AssocReq */
@@ -262,16 +366,18 @@ struct ieee80211_if_sta {
262 u8 *assocreq_ies, *assocresp_ies; 366 u8 *assocreq_ies, *assocresp_ies;
263 size_t assocreq_ies_len, assocresp_ies_len; 367 size_t assocreq_ies_len, assocresp_ies_len;
264 368
369 struct sk_buff_head skb_queue;
370
265 int auth_tries, assoc_tries; 371 int auth_tries, assoc_tries;
266 372
373 unsigned long request;
374
375 unsigned long last_probe;
376
267 unsigned int flags; 377 unsigned int flags;
268#define IEEE80211_STA_REQ_SCAN 0 378#define IEEE80211_STA_REQ_SCAN 0
269#define IEEE80211_STA_REQ_AUTH 1 379#define IEEE80211_STA_REQ_AUTH 1
270#define IEEE80211_STA_REQ_RUN 2 380#define IEEE80211_STA_REQ_RUN 2
271 unsigned long request;
272 struct sk_buff_head skb_queue;
273
274 unsigned long last_probe;
275 381
276#define IEEE80211_AUTH_ALG_OPEN BIT(0) 382#define IEEE80211_AUTH_ALG_OPEN BIT(0)
277#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1) 383#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
@@ -282,16 +388,34 @@ struct ieee80211_if_sta {
282 388
283 unsigned long ibss_join_req; 389 unsigned long ibss_join_req;
284 struct sk_buff *probe_resp; /* ProbeResp template for IBSS */ 390 struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
285 u32 supp_rates_bits; 391 u32 supp_rates_bits[IEEE80211_NUM_BANDS];
286 392
287 int wmm_last_param_set; 393 int wmm_last_param_set;
394 int num_beacons; /* number of TXed beacon frames by this STA */
288}; 395};
289 396
397static 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
290 413
291/* flags used in struct ieee80211_sub_if_data.flags */ 414/* flags used in struct ieee80211_sub_if_data.flags */
292#define IEEE80211_SDATA_ALLMULTI BIT(0) 415#define IEEE80211_SDATA_ALLMULTI BIT(0)
293#define IEEE80211_SDATA_PROMISC BIT(1) 416#define IEEE80211_SDATA_PROMISC BIT(1)
294#define IEEE80211_SDATA_USERSPACE_MLME BIT(2) 417#define IEEE80211_SDATA_USERSPACE_MLME BIT(2)
418#define IEEE80211_SDATA_OPERATING_GMODE BIT(3)
295struct ieee80211_sub_if_data { 419struct ieee80211_sub_if_data {
296 struct list_head list; 420 struct list_head list;
297 421
@@ -306,11 +430,11 @@ struct ieee80211_sub_if_data {
306 unsigned int flags; 430 unsigned int flags;
307 431
308 int drop_unencrypted; 432 int drop_unencrypted;
433
309 /* 434 /*
310 * IEEE 802.1X Port access control in effect, 435 * basic rates of this AP or the AP we're associated to
311 * drop packets to/from unauthorized port
312 */ 436 */
313 int ieee802_1x_pac; 437 u64 basic_rates;
314 438
315 u16 sequence; 439 u16 sequence;
316 440
@@ -338,6 +462,7 @@ struct ieee80211_sub_if_data {
338 struct ieee80211_if_wds wds; 462 struct ieee80211_if_wds wds;
339 struct ieee80211_if_vlan vlan; 463 struct ieee80211_if_vlan vlan;
340 struct ieee80211_if_sta sta; 464 struct ieee80211_if_sta sta;
465 u32 mntr_flags;
341 } u; 466 } u;
342 int channel_use; 467 int channel_use;
343 int channel_use_raw; 468 int channel_use_raw;
@@ -348,7 +473,6 @@ struct ieee80211_sub_if_data {
348 struct { 473 struct {
349 struct dentry *channel_use; 474 struct dentry *channel_use;
350 struct dentry *drop_unencrypted; 475 struct dentry *drop_unencrypted;
351 struct dentry *ieee802_1x_pac;
352 struct dentry *state; 476 struct dentry *state;
353 struct dentry *bssid; 477 struct dentry *bssid;
354 struct dentry *prev_bssid; 478 struct dentry *prev_bssid;
@@ -363,11 +487,11 @@ struct ieee80211_sub_if_data {
363 struct dentry *auth_alg; 487 struct dentry *auth_alg;
364 struct dentry *auth_transaction; 488 struct dentry *auth_transaction;
365 struct dentry *flags; 489 struct dentry *flags;
490 struct dentry *num_beacons_sta;
366 } sta; 491 } sta;
367 struct { 492 struct {
368 struct dentry *channel_use; 493 struct dentry *channel_use;
369 struct dentry *drop_unencrypted; 494 struct dentry *drop_unencrypted;
370 struct dentry *ieee802_1x_pac;
371 struct dentry *num_sta_ps; 495 struct dentry *num_sta_ps;
372 struct dentry *dtim_count; 496 struct dentry *dtim_count;
373 struct dentry *num_beacons; 497 struct dentry *num_beacons;
@@ -378,19 +502,46 @@ struct ieee80211_sub_if_data {
378 struct { 502 struct {
379 struct dentry *channel_use; 503 struct dentry *channel_use;
380 struct dentry *drop_unencrypted; 504 struct dentry *drop_unencrypted;
381 struct dentry *ieee802_1x_pac;
382 struct dentry *peer; 505 struct dentry *peer;
383 } wds; 506 } wds;
384 struct { 507 struct {
385 struct dentry *channel_use; 508 struct dentry *channel_use;
386 struct dentry *drop_unencrypted; 509 struct dentry *drop_unencrypted;
387 struct dentry *ieee802_1x_pac;
388 } vlan; 510 } vlan;
389 struct { 511 struct {
390 struct dentry *mode; 512 struct dentry *mode;
391 } monitor; 513 } monitor;
392 struct dentry *default_key; 514 struct dentry *default_key;
393 } debugfs; 515 } debugfs;
516
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;
524 struct timer_list mesh_path_timer;
525 } 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
394#endif 545#endif
395 /* must be last, dynamically sized area in this! */ 546 /* must be last, dynamically sized area in this! */
396 struct ieee80211_vif vif; 547 struct ieee80211_vif vif;
@@ -407,6 +558,8 @@ struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
407enum { 558enum {
408 IEEE80211_RX_MSG = 1, 559 IEEE80211_RX_MSG = 1,
409 IEEE80211_TX_STATUS_MSG = 2, 560 IEEE80211_TX_STATUS_MSG = 2,
561 IEEE80211_DELBA_MSG = 3,
562 IEEE80211_ADDBA_MSG = 4,
410}; 563};
411 564
412struct ieee80211_local { 565struct ieee80211_local {
@@ -417,15 +570,15 @@ struct ieee80211_local {
417 570
418 const struct ieee80211_ops *ops; 571 const struct ieee80211_ops *ops;
419 572
420 /* List of registered struct ieee80211_hw_mode */
421 struct list_head modes_list;
422
423 struct net_device *mdev; /* wmaster# - "master" 802.11 device */ 573 struct net_device *mdev; /* wmaster# - "master" 802.11 device */
424 int open_count; 574 int open_count;
425 int monitors; 575 int monitors, cooked_mntrs;
576 /* number of interfaces with corresponding FIF_ flags */
577 int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss;
426 unsigned int filter_flags; /* FIF_* */ 578 unsigned int filter_flags; /* FIF_* */
427 struct iw_statistics wstats; 579 struct iw_statistics wstats;
428 u8 wstats_flags; 580 u8 wstats_flags;
581 bool tim_in_locked_section; /* see ieee80211_beacon_get() */
429 int tx_headroom; /* required headroom for hardware/radiotap */ 582 int tx_headroom; /* required headroom for hardware/radiotap */
430 583
431 enum { 584 enum {
@@ -443,15 +596,22 @@ struct ieee80211_local {
443 struct sk_buff_head skb_queue; 596 struct sk_buff_head skb_queue;
444 struct sk_buff_head skb_queue_unreliable; 597 struct sk_buff_head skb_queue_unreliable;
445 598
446 /* Station data structures */ 599 /* Station data */
447 rwlock_t sta_lock; /* protects STA data structures */ 600 /*
448 int num_sta; /* number of stations in sta_list */ 601 * The lock only protects the list, hash, timer and counter
602 * against manipulation, reads are done in RCU. Additionally,
603 * the lock protects each BSS's TIM bitmap.
604 */
605 spinlock_t sta_lock;
606 unsigned long num_sta;
449 struct list_head sta_list; 607 struct list_head sta_list;
608 struct list_head sta_flush_list;
609 struct work_struct sta_flush_work;
450 struct sta_info *sta_hash[STA_HASH_SIZE]; 610 struct sta_info *sta_hash[STA_HASH_SIZE];
451 struct timer_list sta_cleanup; 611 struct timer_list sta_cleanup;
452 612
453 unsigned long state[NUM_TX_DATA_QUEUES]; 613 unsigned long state[NUM_TX_DATA_QUEUES_AMPDU];
454 struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES]; 614 struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES_AMPDU];
455 struct tasklet_struct tx_pending_tasklet; 615 struct tasklet_struct tx_pending_tasklet;
456 616
457 /* number of interfaces with corresponding IFF_ flags */ 617 /* number of interfaces with corresponding IFF_ flags */
@@ -459,11 +619,6 @@ struct ieee80211_local {
459 619
460 struct rate_control_ref *rate_ctrl; 620 struct rate_control_ref *rate_ctrl;
461 621
462 /* Supported and basic rate filters for different modes. These are
463 * pointers to -1 terminated lists and rates in 100 kbps units. */
464 int *supp_rates[NUM_IEEE80211_MODES];
465 int *basic_rates[NUM_IEEE80211_MODES];
466
467 int rts_threshold; 622 int rts_threshold;
468 int fragmentation_threshold; 623 int fragmentation_threshold;
469 int short_retry_limit; /* dot11ShortRetryLimit */ 624 int short_retry_limit; /* dot11ShortRetryLimit */
@@ -477,21 +632,25 @@ struct ieee80211_local {
477 * deliver multicast frames both back to wireless 632 * deliver multicast frames both back to wireless
478 * media and to the local net stack */ 633 * media and to the local net stack */
479 634
480 ieee80211_rx_handler *rx_pre_handlers;
481 ieee80211_rx_handler *rx_handlers;
482 ieee80211_tx_handler *tx_handlers;
483
484 struct list_head interfaces; 635 struct list_head interfaces;
485 636
637 /*
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
486 bool sta_sw_scanning; 644 bool sta_sw_scanning;
487 bool sta_hw_scanning; 645 bool sta_hw_scanning;
488 int scan_channel_idx; 646 int scan_channel_idx;
647 enum ieee80211_band scan_band;
648
489 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state; 649 enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
490 unsigned long last_scan_completed; 650 unsigned long last_scan_completed;
491 struct delayed_work scan_work; 651 struct delayed_work scan_work;
492 struct net_device *scan_dev; 652 struct net_device *scan_dev;
493 struct ieee80211_channel *oper_channel, *scan_channel; 653 struct ieee80211_channel *oper_channel, *scan_channel;
494 struct ieee80211_hw_mode *oper_hw_mode, *scan_hw_mode;
495 u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; 654 u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
496 size_t scan_ssid_len; 655 size_t scan_ssid_len;
497 struct list_head sta_bss_list; 656 struct list_head sta_bss_list;
@@ -560,14 +719,8 @@ struct ieee80211_local {
560 int wifi_wme_noack_test; 719 int wifi_wme_noack_test;
561 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */ 720 unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
562 721
563 unsigned int enabled_modes; /* bitfield of allowed modes;
564 * (1 << MODE_*) */
565 unsigned int hw_modes; /* bitfield of supported hardware modes;
566 * (1 << MODE_*) */
567
568#ifdef CONFIG_MAC80211_DEBUGFS 722#ifdef CONFIG_MAC80211_DEBUGFS
569 struct local_debugfsdentries { 723 struct local_debugfsdentries {
570 struct dentry *channel;
571 struct dentry *frequency; 724 struct dentry *frequency;
572 struct dentry *antenna_sel_tx; 725 struct dentry *antenna_sel_tx;
573 struct dentry *antenna_sel_rx; 726 struct dentry *antenna_sel_rx;
@@ -577,9 +730,7 @@ struct ieee80211_local {
577 struct dentry *short_retry_limit; 730 struct dentry *short_retry_limit;
578 struct dentry *long_retry_limit; 731 struct dentry *long_retry_limit;
579 struct dentry *total_ps_buffered; 732 struct dentry *total_ps_buffered;
580 struct dentry *mode;
581 struct dentry *wep_iv; 733 struct dentry *wep_iv;
582 struct dentry *modes;
583 struct dentry *statistics; 734 struct dentry *statistics;
584 struct local_debugfsdentries_statsdentries { 735 struct local_debugfsdentries_statsdentries {
585 struct dentry *transmitted_fragment_count; 736 struct dentry *transmitted_fragment_count;
@@ -627,6 +778,63 @@ struct ieee80211_local {
627#endif 778#endif
628}; 779};
629 780
781/* this struct represents 802.11n's RA/TID combination */
782struct ieee80211_ra_tid {
783 u8 ra[ETH_ALEN];
784 u16 tid;
785};
786
787/* 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
630static inline struct ieee80211_local *hw_to_local( 838static inline struct ieee80211_local *hw_to_local(
631 struct ieee80211_hw *hw) 839 struct ieee80211_hw *hw)
632{ 840{
@@ -650,57 +858,6 @@ struct sta_attribute {
650 ssize_t (*store)(struct sta_info *, const char *buf, size_t count); 858 ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
651}; 859};
652 860
653static inline void __bss_tim_set(struct ieee80211_if_ap *bss, u16 aid)
654{
655 /*
656 * This format has been mandated by the IEEE specifications,
657 * so this line may not be changed to use the __set_bit() format.
658 */
659 bss->tim[aid / 8] |= (1 << (aid % 8));
660}
661
662static inline void bss_tim_set(struct ieee80211_local *local,
663 struct ieee80211_if_ap *bss, u16 aid)
664{
665 read_lock_bh(&local->sta_lock);
666 __bss_tim_set(bss, aid);
667 read_unlock_bh(&local->sta_lock);
668}
669
670static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, u16 aid)
671{
672 /*
673 * This format has been mandated by the IEEE specifications,
674 * so this line may not be changed to use the __clear_bit() format.
675 */
676 bss->tim[aid / 8] &= ~(1 << (aid % 8));
677}
678
679static inline void bss_tim_clear(struct ieee80211_local *local,
680 struct ieee80211_if_ap *bss, u16 aid)
681{
682 read_lock_bh(&local->sta_lock);
683 __bss_tim_clear(bss, aid);
684 read_unlock_bh(&local->sta_lock);
685}
686
687/**
688 * ieee80211_is_erp_rate - Check if a rate is an ERP rate
689 * @phymode: The PHY-mode for this rate (MODE_IEEE80211...)
690 * @rate: Transmission rate to check, in 100 kbps
691 *
692 * Check if a given rate is an Extended Rate PHY (ERP) rate.
693 */
694static inline int ieee80211_is_erp_rate(int phymode, int rate)
695{
696 if (phymode == MODE_IEEE80211G) {
697 if (rate != 10 && rate != 20 &&
698 rate != 55 && rate != 110)
699 return 1;
700 }
701 return 0;
702}
703
704static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr) 861static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
705{ 862{
706 return compare_ether_addr(raddr, addr) == 0 || 863 return compare_ether_addr(raddr, addr) == 0 ||
@@ -712,16 +869,11 @@ static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
712int ieee80211_hw_config(struct ieee80211_local *local); 869int ieee80211_hw_config(struct ieee80211_local *local);
713int ieee80211_if_config(struct net_device *dev); 870int ieee80211_if_config(struct net_device *dev);
714int ieee80211_if_config_beacon(struct net_device *dev); 871int ieee80211_if_config_beacon(struct net_device *dev);
715void ieee80211_prepare_rates(struct ieee80211_local *local, 872void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
716 struct ieee80211_hw_mode *mode);
717void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
718int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
719void ieee80211_if_setup(struct net_device *dev); 873void ieee80211_if_setup(struct net_device *dev);
720struct ieee80211_rate *ieee80211_get_rate(struct ieee80211_local *local, 874u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
721 int phymode, int hwrate); 875 struct ieee80211_ht_info *req_ht_cap,
722int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht, 876 struct ieee80211_ht_bss_info *req_bss_cap);
723 struct ieee80211_ht_info *req_ht_cap,
724 struct ieee80211_ht_bss_info *req_bss_cap);
725 877
726/* ieee80211_ioctl.c */ 878/* ieee80211_ioctl.c */
727extern const struct iw_handler_def ieee80211_iw_handler_def; 879extern const struct iw_handler_def ieee80211_iw_handler_def;
@@ -747,9 +899,7 @@ extern const struct iw_handler_def ieee80211_iw_handler_def;
747 899
748 900
749/* ieee80211_ioctl.c */ 901/* ieee80211_ioctl.c */
750int ieee80211_set_compression(struct ieee80211_local *local, 902int ieee80211_set_freq(struct ieee80211_local *local, int freq);
751 struct net_device *dev, struct sta_info *sta);
752int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq);
753/* ieee80211_sta.c */ 903/* ieee80211_sta.c */
754void ieee80211_sta_timer(unsigned long data); 904void ieee80211_sta_timer(unsigned long data);
755void ieee80211_sta_work(struct work_struct *work); 905void ieee80211_sta_work(struct work_struct *work);
@@ -763,9 +913,9 @@ int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
763void ieee80211_sta_req_auth(struct net_device *dev, 913void ieee80211_sta_req_auth(struct net_device *dev,
764 struct ieee80211_if_sta *ifsta); 914 struct ieee80211_if_sta *ifsta);
765int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len); 915int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
766ieee80211_txrx_result ieee80211_sta_rx_scan(struct net_device *dev, 916ieee80211_rx_result ieee80211_sta_rx_scan(
767 struct sk_buff *skb, 917 struct net_device *dev, struct sk_buff *skb,
768 struct ieee80211_rx_status *rx_status); 918 struct ieee80211_rx_status *rx_status);
769void ieee80211_rx_bss_list_init(struct net_device *dev); 919void ieee80211_rx_bss_list_init(struct net_device *dev);
770void ieee80211_rx_bss_list_deinit(struct net_device *dev); 920void ieee80211_rx_bss_list_deinit(struct net_device *dev);
771int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len); 921int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
@@ -782,12 +932,36 @@ int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
782int ieee80211_ht_addt_info_ie_to_ht_bss_info( 932int ieee80211_ht_addt_info_ie_to_ht_bss_info(
783 struct ieee80211_ht_addt_info *ht_add_info_ie, 933 struct ieee80211_ht_addt_info *ht_add_info_ie,
784 struct ieee80211_ht_bss_info *bss_info); 934 struct ieee80211_ht_bss_info *bss_info);
935void 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);
940
785void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da, 941void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da,
786 u16 tid, u16 initiator, u16 reason); 942 u16 tid, u16 initiator, u16 reason);
787void sta_rx_agg_session_timer_expired(unsigned long data); 943void sta_rx_agg_session_timer_expired(unsigned long data);
944void sta_addba_resp_timer_expired(unsigned long data);
945void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr);
946u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
947 struct ieee802_11_elems *elems,
948 enum ieee80211_band band);
949void 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
954#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
960
788/* ieee80211_iface.c */ 961/* ieee80211_iface.c */
789int ieee80211_if_add(struct net_device *dev, const char *name, 962int ieee80211_if_add(struct net_device *dev, const char *name,
790 struct net_device **new_dev, int type); 963 struct net_device **new_dev, int type,
964 struct vif_params *params);
791void ieee80211_if_set_type(struct net_device *dev, int type); 965void ieee80211_if_set_type(struct net_device *dev, int type);
792void ieee80211_if_reinit(struct net_device *dev); 966void ieee80211_if_reinit(struct net_device *dev);
793void __ieee80211_if_del(struct ieee80211_local *local, 967void __ieee80211_if_del(struct ieee80211_local *local,
@@ -796,16 +970,7 @@ int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
796void ieee80211_if_free(struct net_device *dev); 970void ieee80211_if_free(struct net_device *dev);
797void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata); 971void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
798 972
799/* regdomain.c */
800void ieee80211_regdomain_init(void);
801void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode);
802
803/* rx handling */
804extern ieee80211_rx_handler ieee80211_rx_pre_handlers[];
805extern ieee80211_rx_handler ieee80211_rx_handlers[];
806
807/* tx handling */ 973/* tx handling */
808extern ieee80211_tx_handler ieee80211_tx_handlers[];
809void ieee80211_clear_tx_pending(struct ieee80211_local *local); 974void ieee80211_clear_tx_pending(struct ieee80211_local *local);
810void ieee80211_tx_pending(unsigned long data); 975void ieee80211_tx_pending(unsigned long data);
811int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev); 976int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev);