~ubuntu-branches/ubuntu/hardy/linux-backports-modules-2.6.24/hardy-security

« back to all changes in this revision

Viewing changes to updates/wireless/iwlwifi/mac80211/modified/net/mac80211/ieee80211_i.h

  • Committer: Bazaar Package Importer
  • Author(s): , Ben Collins
  • Date: 2008-04-02 06:59:04 UTC
  • Revision ID: james.westby@ubuntu.com-20080402065904-e5knh2gn2hms3xbb
Tags: 2.6.24-14.11
[Ben Collins]

* iwlwifi: Update to iwlwifi-1.2.25 and mac80211-10.0.4
  - LP: #200950
* ubuntu: Slight cleanups to module hiearchy and Makefiles
* mac80211: Enable LED triggers
* iwlwifi: Add LED trigger support (rx and tx only)
  - LP: #176090

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>
 
24
#include <net/wireless.h>
 
25
#include "ieee80211_key.h"
 
26
#include "sta_info.h"
 
27
 
 
28
/* ieee80211.o internal definitions, etc. These are not included into
 
29
 * low-level drivers. */
 
30
 
 
31
#ifndef ETH_P_PAE
 
32
#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */
 
33
#endif /* ETH_P_PAE */
 
34
 
 
35
#define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)
 
36
 
 
37
struct ieee80211_local;
 
38
 
 
39
 
 
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
/* Minimum and Maximum TSID used by EDCA. EDCA uses 0~7; HCCA uses 8~15 */
 
62
#define EDCA_TSID_MIN 0
 
63
#define EDCA_TSID_MAX 7
 
64
 
 
65
struct ieee80211_fragment_entry {
 
66
        unsigned long first_frag_time;
 
67
        unsigned int seq;
 
68
        unsigned int rx_queue;
 
69
        unsigned int last_frag;
 
70
        unsigned int extra_len;
 
71
        struct sk_buff_head skb_list;
 
72
        int ccmp; /* Whether fragments were encrypted with CCMP */
 
73
        u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
 
74
};
 
75
 
 
76
 
 
77
struct ieee80211_sta_bss {
 
78
        struct list_head list;
 
79
        struct ieee80211_sta_bss *hnext;
 
80
        atomic_t users;
 
81
 
 
82
        u8 bssid[ETH_ALEN];
 
83
        u8 ssid[IEEE80211_MAX_SSID_LEN];
 
84
        size_t ssid_len;
 
85
        u16 capability; /* host byte order */
 
86
        int hw_mode;
 
87
        int channel;
 
88
        int freq;
 
89
        int rssi, signal, noise;
 
90
        u8 *wpa_ie;
 
91
        size_t wpa_ie_len;
 
92
        u8 *rsn_ie;
 
93
        size_t rsn_ie_len;
 
94
        u8 *wmm_ie;
 
95
        size_t wmm_ie_len;
 
96
        u8 *ht_ie;
 
97
        size_t ht_ie_len;
 
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
 
 
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;
 
113
};
 
114
 
 
115
 
 
116
typedef enum {
 
117
        TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED
 
118
} ieee80211_txrx_result;
 
119
 
 
120
struct ieee80211_txrx_data {
 
121
        struct sk_buff *skb;
 
122
        struct net_device *dev;
 
123
        struct ieee80211_local *local;
 
124
        struct ieee80211_sub_if_data *sdata;
 
125
        struct sta_info *sta;
 
126
        u16 fc, ethertype;
 
127
        struct ieee80211_key *key;
 
128
        unsigned int fragmented:1; /* whether the MSDU was fragmented */
 
129
        union {
 
130
                struct {
 
131
                        struct ieee80211_tx_control *control;
 
132
                        unsigned int unicast:1;
 
133
                        unsigned int ps_buffered:1;
 
134
                        unsigned int short_preamble:1;
 
135
                        unsigned int probe_last_frag:1;
 
136
                        struct ieee80211_hw_mode *mode;
 
137
                        struct ieee80211_rate *rate;
 
138
                        /* use this rate (if set) for last fragment; rate can
 
139
                         * be set to lower rate for the first fragments, e.g.,
 
140
                         * when using CTS protection with IEEE 802.11g. */
 
141
                        struct ieee80211_rate *last_frag_rate;
 
142
                        int last_frag_hwrate;
 
143
                        int mgmt_interface;
 
144
 
 
145
                        /* Extra fragments (in addition to the first fragment
 
146
                         * in skb) */
 
147
                        int num_extra_frag;
 
148
                        struct sk_buff **extra_frag;
 
149
                } tx;
 
150
                struct {
 
151
                        struct ieee80211_rx_status *status;
 
152
                        int sent_ps_buffered;
 
153
                        int queue;
 
154
                        int load;
 
155
                        u16 qos_control;
 
156
                        unsigned int in_scan:1;
 
157
                        /* frame is destined to interface currently processed
 
158
                         * (including multicast frames) */
 
159
                        unsigned int ra_match:1;
 
160
                        unsigned int is_agg_frame:1;
 
161
                } rx;
 
162
        } u;
 
163
};
 
164
 
 
165
/* Stored in sk_buff->cb */
 
166
struct ieee80211_tx_packet_data {
 
167
        int ifindex;
 
168
        unsigned long jiffies;
 
169
        unsigned int req_tx_status:1;
 
170
        unsigned int do_not_encrypt:1;
 
171
        unsigned int requeue:1;
 
172
        unsigned int mgmt_iface:1;
 
173
        unsigned int queue:4;
 
174
        unsigned int ht_queue:1;
 
175
};
 
176
 
 
177
struct ieee80211_tx_stored_packet {
 
178
        struct ieee80211_tx_control control;
 
179
        struct sk_buff *skb;
 
180
        int num_extra_frag;
 
181
        struct sk_buff **extra_frag;
 
182
        int last_frag_rateidx;
 
183
        int last_frag_hwrate;
 
184
        struct ieee80211_rate *last_frag_rate;
 
185
        unsigned int last_frag_rate_ctrl_probe:1;
 
186
};
 
187
 
 
188
struct sta_ts_data {
 
189
        enum {
 
190
                TS_STATUS_UNUSED        = 0,
 
191
                TS_STATUS_ACTIVE        = 1,
 
192
                TS_STATUS_INACTIVE      = 2,
 
193
                TS_STATUS_THROTTLING    = 3,
 
194
        } status;
 
195
        u8 dialog_token;
 
196
        u8 up;
 
197
        u32 admitted_time_usec;
 
198
        u32 used_time_usec;
 
199
};
 
200
 
 
201
typedef ieee80211_txrx_result (*ieee80211_tx_handler)
 
202
(struct ieee80211_txrx_data *tx);
 
203
 
 
204
typedef ieee80211_txrx_result (*ieee80211_rx_handler)
 
205
(struct ieee80211_txrx_data *rx);
 
206
 
 
207
struct ieee80211_if_ap {
 
208
        u8 *beacon_head, *beacon_tail;
 
209
        int beacon_head_len, beacon_tail_len;
 
210
 
 
211
        u8 ssid[IEEE80211_MAX_SSID_LEN];
 
212
        size_t ssid_len;
 
213
        u8 *generic_elem;
 
214
        size_t generic_elem_len;
 
215
 
 
216
        /* yes, this looks ugly, but guarantees that we can later use
 
217
         * bitmap_empty :)
 
218
         * NB: don't ever use set_bit, use bss_tim_set/bss_tim_clear! */
 
219
        u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)];
 
220
        atomic_t num_sta_ps; /* number of stations in PS mode */
 
221
        struct sk_buff_head ps_bc_buf;
 
222
        int dtim_period, dtim_count;
 
223
        int force_unicast_rateidx; /* forced TX rateidx for unicast frames */
 
224
        int max_ratectrl_rateidx; /* max TX rateidx for rate control */
 
225
        int num_beacons; /* number of TXed beacon frames for this BSS */
 
226
};
 
227
 
 
228
struct ieee80211_if_wds {
 
229
        u8 remote_addr[ETH_ALEN];
 
230
        struct sta_info *sta;
 
231
};
 
232
 
 
233
struct ieee80211_if_vlan {
 
234
        u8 id;
 
235
};
 
236
 
 
237
struct ieee80211_if_sta {
 
238
        enum {
 
239
                IEEE80211_DISABLED, IEEE80211_AUTHENTICATE,
 
240
                IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED,
 
241
                IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED,
 
242
                IEEE80211_CHANNEL_SWITCH
 
243
        } state;
 
244
        struct timer_list timer;
 
245
        struct work_struct work;
 
246
        struct timer_list admit_timer; /* Recompute EDCA admitted time */
 
247
        u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
 
248
        u8 ssid[IEEE80211_MAX_SSID_LEN];
 
249
        size_t ssid_len;
 
250
        u16 aid;
 
251
        u16 ap_capab, capab;
 
252
        u8 *extra_ie; /* to be added to the end of AssocReq */
 
253
        size_t extra_ie_len;
 
254
        u8 nick[IW_ESSID_MAX_SIZE];
 
255
 
 
256
        /* The last AssocReq/Resp IEs */
 
257
        u8 *assocreq_ies, *assocresp_ies;
 
258
        size_t assocreq_ies_len, assocresp_ies_len;
 
259
 
 
260
        int auth_tries, assoc_tries;
 
261
 
 
262
        unsigned int ssid_set:1;
 
263
        unsigned int bssid_set:1;
 
264
        unsigned int prev_bssid_set:1;
 
265
        unsigned int authenticated:1;
 
266
        unsigned int associated:1;
 
267
        unsigned int probereq_poll:1;
 
268
        unsigned int create_ibss:1;
 
269
        unsigned int mixed_cell:1;
 
270
        unsigned int wmm_enabled:1;
 
271
        unsigned int ht_enabled:1;
 
272
        unsigned int auto_ssid_sel:1;
 
273
        unsigned int auto_bssid_sel:1;
 
274
        unsigned int auto_channel_sel:1;
 
275
#define IEEE80211_STA_REQ_SCAN 0
 
276
#define IEEE80211_STA_REQ_AUTH 1
 
277
#define IEEE80211_STA_REQ_RUN  2
 
278
        unsigned long request;
 
279
        struct sk_buff_head skb_queue;
 
280
 
 
281
        int key_mgmt;
 
282
        unsigned long last_probe;
 
283
 
 
284
#define IEEE80211_AUTH_ALG_OPEN BIT(0)
 
285
#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)
 
286
#define IEEE80211_AUTH_ALG_LEAP BIT(2)
 
287
        unsigned int auth_algs; /* bitfield of allowed auth algs */
 
288
        int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
 
289
        int auth_transaction;
 
290
 
 
291
        unsigned long ibss_join_req;
 
292
        struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
 
293
        u32 supp_rates_bits;
 
294
 
 
295
        u32 last_rate; /* last tx data rate value. management and multi cast frame
 
296
                        * wont be used. */
 
297
 
 
298
        int wmm_last_param_set;
 
299
 
 
300
        u32 dot11EDCAAveragingPeriod;
 
301
        u32 MPDUExchangeTime;
 
302
#define STA_TSID_NUM   16
 
303
#define STA_TSDIR_NUM  2
 
304
        /* EDCA: 0~7, HCCA: 8~15 */
 
305
        struct sta_ts_data ts_data[STA_TSID_NUM][STA_TSDIR_NUM];
 
306
#ifdef CONFIG_MAC80211_DEBUGFS
 
307
        struct ieee80211_elem_tspec tspec;
 
308
        u8 dls_mac[ETH_ALEN];
 
309
#endif
 
310
        struct ieee80211_channel *switch_channel;
 
311
};
 
312
 
 
313
 
 
314
struct ieee80211_sub_if_data {
 
315
        struct list_head list;
 
316
        unsigned int type;
 
317
 
 
318
        struct wireless_dev wdev;
 
319
 
 
320
        struct net_device *dev;
 
321
        struct ieee80211_local *local;
 
322
 
 
323
        int mc_count;
 
324
        unsigned int allmulti:1;
 
325
        unsigned int promisc:1;
 
326
        unsigned int use_protection:1; /* CTS protect ERP frames */
 
327
 
 
328
        struct net_device_stats stats;
 
329
        int drop_unencrypted;
 
330
        int eapol; /* 0 = process EAPOL frames as normal data frames,
 
331
                    * 1 = send EAPOL frames through wlan#ap to hostapd
 
332
                    *     (default) */
 
333
        int ieee802_1x; /* IEEE 802.1X PAE - drop packet to/from unauthorized
 
334
                         * port */
 
335
 
 
336
        u16 sequence;
 
337
 
 
338
        /* Fragment table for host-based reassembly */
 
339
        struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
 
340
        unsigned int fragment_next;
 
341
 
 
342
#define NUM_DEFAULT_KEYS 4
 
343
        struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
 
344
        struct ieee80211_key *default_key;
 
345
 
 
346
        struct ieee80211_if_ap *bss; /* BSS that this device belongs to */
 
347
 
 
348
        union {
 
349
                struct ieee80211_if_ap ap;
 
350
                struct ieee80211_if_wds wds;
 
351
                struct ieee80211_if_vlan vlan;
 
352
                struct ieee80211_if_sta sta;
 
353
        } u;
 
354
        int channel_use;
 
355
        int channel_use_raw;
 
356
 
 
357
#ifdef CONFIG_MAC80211_DEBUGFS
 
358
        struct dentry *debugfsdir;
 
359
        union {
 
360
                struct {
 
361
                        struct dentry *channel_use;
 
362
                        struct dentry *drop_unencrypted;
 
363
                        struct dentry *eapol;
 
364
                        struct dentry *ieee8021_x;
 
365
                        struct dentry *state;
 
366
                        struct dentry *bssid;
 
367
                        struct dentry *prev_bssid;
 
368
                        struct dentry *ssid_len;
 
369
                        struct dentry *aid;
 
370
                        struct dentry *ap_capab;
 
371
                        struct dentry *capab;
 
372
                        struct dentry *extra_ie_len;
 
373
                        struct dentry *auth_tries;
 
374
                        struct dentry *assoc_tries;
 
375
                        struct dentry *auth_algs;
 
376
                        struct dentry *auth_alg;
 
377
                        struct dentry *auth_transaction;
 
378
                        struct dentry *flags;
 
379
                        struct dentry *qos_dir;
 
380
                        struct {
 
381
                                struct dentry *addts_11e;
 
382
                                struct dentry *addts_wmm;
 
383
                                struct dentry *delts_11e;
 
384
                                struct dentry *delts_wmm;
 
385
                                struct dentry *dls_mac;
 
386
                                struct dentry *dls_op;
 
387
                        } qos;
 
388
                        struct dentry *tsinfo_dir;
 
389
                        struct {
 
390
                                struct dentry *tsid;
 
391
                                struct dentry *direction;
 
392
                                struct dentry *up;
 
393
                        } tsinfo;
 
394
                        struct dentry *tspec_dir;
 
395
                        struct {
 
396
                                struct dentry *nominal_msdu_size;
 
397
                                struct dentry *max_msdu_size;
 
398
                                struct dentry *min_service_interval;
 
399
                                struct dentry *max_service_interval;
 
400
                                struct dentry *inactivity_interval;
 
401
                                struct dentry *suspension_interval;
 
402
                                struct dentry *service_start_time;
 
403
                                struct dentry *min_data_rate;
 
404
                                struct dentry *mean_data_rate;
 
405
                                struct dentry *peak_data_rate;
 
406
                                struct dentry *burst_size;
 
407
                                struct dentry *delay_bound;
 
408
                                struct dentry *min_phy_rate;
 
409
                                struct dentry *surplus_band_allow;
 
410
                                struct dentry *medium_time;
 
411
                        } tspec;
 
412
                } sta;
 
413
                struct {
 
414
                        struct dentry *channel_use;
 
415
                        struct dentry *drop_unencrypted;
 
416
                        struct dentry *eapol;
 
417
                        struct dentry *ieee8021_x;
 
418
                        struct dentry *num_sta_ps;
 
419
                        struct dentry *dtim_period;
 
420
                        struct dentry *dtim_count;
 
421
                        struct dentry *num_beacons;
 
422
                        struct dentry *force_unicast_rateidx;
 
423
                        struct dentry *max_ratectrl_rateidx;
 
424
                        struct dentry *num_buffered_multicast;
 
425
                        struct dentry *beacon_head_len;
 
426
                        struct dentry *beacon_tail_len;
 
427
                } ap;
 
428
                struct {
 
429
                        struct dentry *channel_use;
 
430
                        struct dentry *drop_unencrypted;
 
431
                        struct dentry *eapol;
 
432
                        struct dentry *ieee8021_x;
 
433
                        struct dentry *peer;
 
434
                } wds;
 
435
                struct {
 
436
                        struct dentry *channel_use;
 
437
                        struct dentry *drop_unencrypted;
 
438
                        struct dentry *eapol;
 
439
                        struct dentry *ieee8021_x;
 
440
                        struct dentry *vlan_id;
 
441
                } vlan;
 
442
                struct {
 
443
                        struct dentry *mode;
 
444
                } monitor;
 
445
                struct dentry *default_key;
 
446
        } debugfs;
 
447
#endif
 
448
};
 
449
 
 
450
#define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)
 
451
 
 
452
enum {
 
453
        IEEE80211_RX_MSG        = 1,
 
454
        IEEE80211_TX_STATUS_MSG = 2,
 
455
};
 
456
 
 
457
struct ieee80211_local {
 
458
        /* embed the driver visible part.
 
459
         * don't cast (use the static inlines below), but we keep
 
460
         * it first anyway so they become a no-op */
 
461
        struct ieee80211_hw hw;
 
462
 
 
463
        const struct ieee80211_ops *ops;
 
464
 
 
465
        /* List of registered struct ieee80211_hw_mode */
 
466
        struct list_head modes_list;
 
467
 
 
468
        struct net_device *mdev; /* wmaster# - "master" 802.11 device */
 
469
        struct net_device *apdev; /* wlan#ap - management frames (hostapd) */
 
470
        int open_count;
 
471
        int monitors;
 
472
        struct iw_statistics wstats;
 
473
        u8 wstats_flags;
 
474
        int tx_headroom; /* required headroom for hardware/radiotap */
 
475
 
 
476
        enum {
 
477
                IEEE80211_DEV_UNINITIALIZED = 0,
 
478
                IEEE80211_DEV_REGISTERED,
 
479
                IEEE80211_DEV_UNREGISTERED,
 
480
        } reg_state;
 
481
 
 
482
        /* Tasklet and skb queue to process calls from IRQ mode. All frames
 
483
         * added to skb_queue will be processed, but frames in
 
484
         * skb_queue_unreliable may be dropped if the total length of these
 
485
         * queues increases over the limit. */
 
486
#define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
 
487
        struct tasklet_struct tasklet;
 
488
        struct sk_buff_head skb_queue;
 
489
        struct sk_buff_head skb_queue_unreliable;
 
490
 
 
491
        /* Station data structures */
 
492
        spinlock_t sta_lock; /* mutex for STA data structures */
 
493
        int num_sta; /* number of stations in sta_list */
 
494
        struct list_head sta_list;
 
495
        struct list_head deleted_sta_list;
 
496
        struct sta_info *sta_hash[STA_HASH_SIZE];
 
497
        struct timer_list sta_cleanup;
 
498
 
 
499
        unsigned long state[NUM_TX_DATA_QUEUES_11N];
 
500
        struct ieee80211_tx_stored_packet pending_packet[NUM_TX_DATA_QUEUES_11N];
 
501
        struct tasklet_struct tx_pending_tasklet;
 
502
 
 
503
        int mc_count;   /* total count of multicast entries in all interfaces */
 
504
        int iff_allmultis, iff_promiscs;
 
505
                        /* number of interfaces with corresponding IFF_ flags */
 
506
 
 
507
        struct rate_control_ref *rate_ctrl;
 
508
 
 
509
        int next_mode; /* MODE_IEEE80211*
 
510
                        * The mode preference for next channel change. This is
 
511
                        * used to select .11g vs. .11b channels (or 4.9 GHz vs.
 
512
                        * .11a) when the channel number is not unique. */
 
513
 
 
514
        /* Supported and basic rate filters for different modes. These are
 
515
         * pointers to -1 terminated lists and rates in 100 kbps units. */
 
516
        int *supp_rates[NUM_IEEE80211_MODES];
 
517
        int *basic_rates[NUM_IEEE80211_MODES];
 
518
 
 
519
        int rts_threshold;
 
520
        int fragmentation_threshold;
 
521
        int short_retry_limit; /* dot11ShortRetryLimit */
 
522
        int long_retry_limit; /* dot11LongRetryLimit */
 
523
        int short_preamble; /* use short preamble with IEEE 802.11b */
 
524
 
 
525
        struct crypto_blkcipher *wep_tx_tfm;
 
526
        struct crypto_blkcipher *wep_rx_tfm;
 
527
        u32 wep_iv;
 
528
        int key_tx_rx_threshold; /* number of times any key can be used in TX
 
529
                                  * or RX before generating a rekey
 
530
                                  * notification; 0 = notification disabled. */
 
531
 
 
532
        int bridge_packets; /* bridge packets between associated stations and
 
533
                             * deliver multicast frames both back to wireless
 
534
                             * media and to the local net stack */
 
535
 
 
536
        ieee80211_rx_handler *rx_pre_handlers;
 
537
        ieee80211_rx_handler *rx_handlers;
 
538
        ieee80211_tx_handler *tx_handlers;
 
539
 
 
540
        rwlock_t sub_if_lock; /* Protects sub_if_list. Cannot be taken under
 
541
                               * sta_bss_lock or sta_lock. */
 
542
        struct list_head sub_if_list;
 
543
        int sta_sw_scanning;
 
544
        int sta_hw_scanning;
 
545
        int scan_channel_idx;
 
546
        enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
 
547
        unsigned long last_scan_completed;
 
548
        struct delayed_work scan_work;
 
549
        struct net_device *scan_dev;
 
550
        struct ieee80211_channel *oper_channel, *scan_channel;
 
551
        struct ieee80211_hw_mode *oper_hw_mode, *scan_hw_mode;
 
552
        u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
 
553
        size_t scan_ssid_len;
 
554
#define IEEE80211_MAX_TXPOWER 50
 
555
        u8 user_txpow;
 
556
        struct list_head sta_bss_list;
 
557
        struct ieee80211_sta_bss *sta_bss_hash[STA_HASH_SIZE];
 
558
        spinlock_t sta_bss_lock;
 
559
#define IEEE80211_SCAN_MATCH_SSID BIT(0)
 
560
#define IEEE80211_SCAN_WPA_ONLY BIT(1)
 
561
#define IEEE80211_SCAN_EXTRA_INFO BIT(2)
 
562
        int scan_flags;
 
563
 
 
564
        /* SNMP counters */
 
565
        /* dot11CountersTable */
 
566
        u32 dot11TransmittedFragmentCount;
 
567
        u32 dot11MulticastTransmittedFrameCount;
 
568
        u32 dot11FailedCount;
 
569
        u32 dot11RetryCount;
 
570
        u32 dot11MultipleRetryCount;
 
571
        u32 dot11FrameDuplicateCount;
 
572
        u32 dot11ReceivedFragmentCount;
 
573
        u32 dot11MulticastReceivedFrameCount;
 
574
        u32 dot11TransmittedFrameCount;
 
575
        u32 dot11WEPUndecryptableCount;
 
576
 
 
577
#ifdef CONFIG_MAC80211_LEDS
 
578
        int tx_led_counter, rx_led_counter;
 
579
        struct led_trigger *tx_led, *rx_led;
 
580
        char tx_led_name[32], rx_led_name[32];
 
581
#endif
 
582
 
 
583
        u32 channel_use;
 
584
        u32 channel_use_raw;
 
585
        u32 stat_time;
 
586
        struct timer_list stat_timer;
 
587
 
 
588
#ifdef CONFIG_MAC80211_DEBUGFS
 
589
        struct work_struct sta_debugfs_add;
 
590
#endif
 
591
 
 
592
        enum {
 
593
                STA_ANTENNA_SEL_AUTO = 0,
 
594
                STA_ANTENNA_SEL_SW_CTRL = 1,
 
595
                STA_ANTENNA_SEL_SW_CTRL_DEBUG = 2
 
596
        } sta_antenna_sel;
 
597
 
 
598
#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
 
599
        /* TX/RX handler statistics */
 
600
        unsigned int tx_handlers_drop;
 
601
        unsigned int tx_handlers_queued;
 
602
        unsigned int tx_handlers_drop_unencrypted;
 
603
        unsigned int tx_handlers_drop_fragment;
 
604
        unsigned int tx_handlers_drop_wep;
 
605
        unsigned int tx_handlers_drop_not_assoc;
 
606
        unsigned int tx_handlers_drop_unauth_port;
 
607
        unsigned int rx_handlers_drop;
 
608
        unsigned int rx_handlers_queued;
 
609
        unsigned int rx_handlers_drop_nullfunc;
 
610
        unsigned int rx_handlers_drop_defrag;
 
611
        unsigned int rx_handlers_drop_short;
 
612
        unsigned int rx_handlers_drop_passive_scan;
 
613
        unsigned int tx_expand_skb_head;
 
614
        unsigned int tx_expand_skb_head_cloned;
 
615
        unsigned int rx_expand_skb_head;
 
616
        unsigned int rx_expand_skb_head2;
 
617
        unsigned int rx_handlers_fragments;
 
618
        unsigned int tx_status_drop;
 
619
        unsigned int wme_rx_queue[NUM_RX_DATA_QUEUES];
 
620
        unsigned int wme_tx_queue[NUM_RX_DATA_QUEUES];
 
621
#define I802_DEBUG_INC(c) (c)++
 
622
#else /* CONFIG_MAC80211_DEBUG_COUNTERS */
 
623
#define I802_DEBUG_INC(c) do { } while (0)
 
624
#endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
 
625
 
 
626
 
 
627
        int default_wep_only; /* only default WEP keys are used with this
 
628
                               * interface; this is used to decide when hwaccel
 
629
                               * can be used with default keys */
 
630
        int total_ps_buffered; /* total number of all buffered unicast and
 
631
                                * multicast packets for power saving stations
 
632
                                */
 
633
        int allow_broadcast_always; /* whether to allow TX of broadcast frames
 
634
                                     * even when there are no associated STAs
 
635
                                     */
 
636
 
 
637
        int wifi_wme_noack_test;
 
638
        unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
 
639
 
 
640
        unsigned int enabled_modes; /* bitfield of allowed modes;
 
641
                                      * (1 << MODE_*) */
 
642
        unsigned int hw_modes; /* bitfield of supported hardware modes;
 
643
                                * (1 << MODE_*) */
 
644
 
 
645
        int user_space_mlme;
 
646
 
 
647
#ifdef CONFIG_MAC80211_DEBUGFS
 
648
        struct local_debugfsdentries {
 
649
                struct dentry *channel;
 
650
                struct dentry *frequency;
 
651
                struct dentry *radar_detect;
 
652
                struct dentry *antenna_sel_tx;
 
653
                struct dentry *antenna_sel_rx;
 
654
                struct dentry *bridge_packets;
 
655
                struct dentry *key_tx_rx_threshold;
 
656
                struct dentry *rts_threshold;
 
657
                struct dentry *fragmentation_threshold;
 
658
                struct dentry *short_retry_limit;
 
659
                struct dentry *long_retry_limit;
 
660
                struct dentry *total_ps_buffered;
 
661
                struct dentry *mode;
 
662
                struct dentry *wep_iv;
 
663
                struct dentry *tx_power_reduction;
 
664
                struct dentry *modes;
 
665
                struct dentry *statistics;
 
666
                struct local_debugfsdentries_statsdentries {
 
667
                        struct dentry *transmitted_fragment_count;
 
668
                        struct dentry *multicast_transmitted_frame_count;
 
669
                        struct dentry *failed_count;
 
670
                        struct dentry *retry_count;
 
671
                        struct dentry *multiple_retry_count;
 
672
                        struct dentry *frame_duplicate_count;
 
673
                        struct dentry *received_fragment_count;
 
674
                        struct dentry *multicast_received_frame_count;
 
675
                        struct dentry *transmitted_frame_count;
 
676
                        struct dentry *wep_undecryptable_count;
 
677
                        struct dentry *num_scans;
 
678
#ifdef CONFIG_MAC80211_DEBUG_COUNTERS
 
679
                        struct dentry *tx_handlers_drop;
 
680
                        struct dentry *tx_handlers_queued;
 
681
                        struct dentry *tx_handlers_drop_unencrypted;
 
682
                        struct dentry *tx_handlers_drop_fragment;
 
683
                        struct dentry *tx_handlers_drop_wep;
 
684
                        struct dentry *tx_handlers_drop_not_assoc;
 
685
                        struct dentry *tx_handlers_drop_unauth_port;
 
686
                        struct dentry *rx_handlers_drop;
 
687
                        struct dentry *rx_handlers_queued;
 
688
                        struct dentry *rx_handlers_drop_nullfunc;
 
689
                        struct dentry *rx_handlers_drop_defrag;
 
690
                        struct dentry *rx_handlers_drop_short;
 
691
                        struct dentry *rx_handlers_drop_passive_scan;
 
692
                        struct dentry *tx_expand_skb_head;
 
693
                        struct dentry *tx_expand_skb_head_cloned;
 
694
                        struct dentry *rx_expand_skb_head;
 
695
                        struct dentry *rx_expand_skb_head2;
 
696
                        struct dentry *rx_handlers_fragments;
 
697
                        struct dentry *tx_status_drop;
 
698
                        struct dentry *wme_tx_queue;
 
699
                        struct dentry *wme_rx_queue;
 
700
#endif
 
701
                        struct dentry *dot11ACKFailureCount;
 
702
                        struct dentry *dot11RTSFailureCount;
 
703
                        struct dentry *dot11FCSErrorCount;
 
704
                        struct dentry *dot11RTSSuccessCount;
 
705
                } stats;
 
706
                struct dentry *stations;
 
707
                struct dentry *keys;
 
708
        } debugfs;
 
709
#endif
 
710
};
 
711
 
 
712
enum sta_link_direction {
 
713
        STA_TS_UPLINK = 0,
 
714
        STA_TS_DOWNLINK = 1,
 
715
};
 
716
 
 
717
static inline struct ieee80211_local *hw_to_local(
 
718
        struct ieee80211_hw *hw)
 
719
{
 
720
        return container_of(hw, struct ieee80211_local, hw);
 
721
}
 
722
 
 
723
static inline struct ieee80211_hw *local_to_hw(
 
724
        struct ieee80211_local *local)
 
725
{
 
726
        return &local->hw;
 
727
}
 
728
 
 
729
enum ieee80211_link_state_t {
 
730
        IEEE80211_LINK_STATE_XOFF = 0,
 
731
        IEEE80211_LINK_STATE_PENDING,
 
732
        IEEE80211_LINK_STATE_AGGREGATED,
 
733
};
 
734
 
 
735
struct sta_attribute {
 
736
        struct attribute attr;
 
737
        ssize_t (*show)(const struct sta_info *, char *buf);
 
738
        ssize_t (*store)(struct sta_info *, const char *buf, size_t count);
 
739
};
 
740
 
 
741
static inline void __bss_tim_set(struct ieee80211_if_ap *bss, int aid)
 
742
{
 
743
        /*
 
744
         * This format has ben mandated by the IEEE specifications,
 
745
         * so this line may not be changed to use the __set_bit() format.
 
746
         */
 
747
        bss->tim[(aid)/8] |= 1<<((aid) % 8);
 
748
}
 
749
 
 
750
static inline void bss_tim_set(struct ieee80211_local *local,
 
751
                               struct ieee80211_if_ap *bss, int aid)
 
752
{
 
753
        spin_lock_bh(&local->sta_lock);
 
754
        __bss_tim_set(bss, aid);
 
755
        spin_unlock_bh(&local->sta_lock);
 
756
}
 
757
 
 
758
static inline void __bss_tim_clear(struct ieee80211_if_ap *bss, int aid)
 
759
{
 
760
        /*
 
761
         * This format has ben mandated by the IEEE specifications,
 
762
         * so this line may not be changed to use the __clear_bit() format.
 
763
         */
 
764
        bss->tim[(aid)/8] &= !(1<<((aid) % 8));
 
765
}
 
766
 
 
767
static inline void bss_tim_clear(struct ieee80211_local *local,
 
768
                                 struct ieee80211_if_ap *bss, int aid)
 
769
{
 
770
        spin_lock_bh(&local->sta_lock);
 
771
        __bss_tim_clear(bss, aid);
 
772
        spin_unlock_bh(&local->sta_lock);
 
773
}
 
774
 
 
775
/**
 
776
 * ieee80211_is_erp_rate - Check if a rate is an ERP rate
 
777
 * @phymode: The PHY-mode for this rate (MODE_IEEE80211...)
 
778
 * @rate: Transmission rate to check, in 100 kbps
 
779
 *
 
780
 * Check if a given rate is an Extended Rate PHY (ERP) rate.
 
781
 */
 
782
static inline int ieee80211_is_erp_rate(int phymode, int rate)
 
783
{
 
784
        if (phymode == MODE_IEEE80211G) {
 
785
                if (rate != 10 && rate != 20 &&
 
786
                    rate != 55 && rate != 110)
 
787
                        return 1;
 
788
        }
 
789
        return 0;
 
790
}
 
791
 
 
792
/* ieee80211.c */
 
793
int ieee80211_hw_config(struct ieee80211_local *local);
 
794
int ieee80211_if_config(struct net_device *dev);
 
795
int ieee80211_if_config_beacon(struct net_device *dev);
 
796
struct ieee80211_key_conf *
 
797
ieee80211_key_data2conf(struct ieee80211_local *local,
 
798
                        const struct ieee80211_key *data);
 
799
struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
 
800
                                          int idx, size_t key_len, gfp_t flags);
 
801
void ieee80211_key_free(struct ieee80211_key *key);
 
802
void ieee80211_rx_mgmt(struct ieee80211_local *local, struct sk_buff *skb,
 
803
                       struct ieee80211_rx_status *status, u32 msg_type);
 
804
void ieee80211_prepare_rates(struct ieee80211_local *local,
 
805
                             struct ieee80211_hw_mode *mode);
 
806
void ieee80211_tx_set_iswep(struct ieee80211_txrx_data *tx);
 
807
int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr);
 
808
int ieee80211_monitor_start_xmit(struct sk_buff *skb, struct net_device *dev);
 
809
int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev);
 
810
void ieee80211_if_setup(struct net_device *dev);
 
811
void ieee80211_if_mgmt_setup(struct net_device *dev);
 
812
int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
 
813
                                 const char *name);
 
814
struct net_device_stats *ieee80211_dev_stats(struct net_device *dev);
 
815
 
 
816
/* ieee80211_ioctl.c */
 
817
extern const struct iw_handler_def ieee80211_iw_handler_def;
 
818
 
 
819
void ieee80211_update_default_wep_only(struct ieee80211_local *local);
 
820
 
 
821
 
 
822
/* Least common multiple of the used rates (in 100 kbps). This is used to
 
823
 * calculate rate_inv values for each rate so that only integers are needed. */
 
824
#define CHAN_UTIL_RATE_LCM 95040
 
825
/* 1 usec is 1/8 * (95040/10) = 1188 */
 
826
#define CHAN_UTIL_PER_USEC 1188
 
827
/* Amount of bits to shift the result right to scale the total utilization
 
828
 * to values that will not wrap around 32-bit integers. */
 
829
#define CHAN_UTIL_SHIFT 9
 
830
/* Theoretical maximum of channel utilization counter in 10 ms (stat_time=1):
 
831
 * (CHAN_UTIL_PER_USEC * 10000) >> CHAN_UTIL_SHIFT = 23203. So dividing the
 
832
 * raw value with about 23 should give utilization in 10th of a percentage
 
833
 * (1/1000). However, utilization is only estimated and not all intervals
 
834
 * between frames etc. are calculated. 18 seems to give numbers that are closer
 
835
 * to the real maximum. */
 
836
#define CHAN_UTIL_PER_10MS 18
 
837
#define CHAN_UTIL_HDR_LONG (202 * CHAN_UTIL_PER_USEC)
 
838
#define CHAN_UTIL_HDR_SHORT (40 * CHAN_UTIL_PER_USEC)
 
839
 
 
840
 
 
841
/* ieee80211_ioctl.c */
 
842
int ieee80211_set_compression(struct ieee80211_local *local,
 
843
                              struct net_device *dev, struct sta_info *sta);
 
844
int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq);
 
845
/* ieee80211_sta.c */
 
846
void ieee80211_sta_timer(unsigned long data);
 
847
void ieee80211_sta_work(struct work_struct *work);
 
848
void ieee80211_admit_refresh(unsigned long ptr);
 
849
void ieee80211_sta_scan_work(struct work_struct *work);
 
850
void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb,
 
851
                           struct ieee80211_rx_status *rx_status);
 
852
int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len);
 
853
int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len);
 
854
int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid);
 
855
int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len);
 
856
void ieee80211_sta_req_auth(struct net_device *dev,
 
857
                            struct ieee80211_if_sta *ifsta);
 
858
int ieee80211_sta_scan_results(struct net_device *dev, char *buf, size_t len);
 
859
ieee80211_txrx_result ieee80211_sta_rx_scan(struct net_device *dev,
 
860
                                            struct sk_buff *skb,
 
861
                           struct ieee80211_rx_status *rx_status);
 
862
void ieee80211_rx_bss_list_init(struct net_device *dev);
 
863
void ieee80211_rx_bss_list_deinit(struct net_device *dev);
 
864
int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len);
 
865
struct sta_info * ieee80211_ibss_add_sta(struct net_device *dev,
 
866
                                         struct sk_buff *skb, u8 *bssid,
 
867
                                         u8 *addr);
 
868
int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason);
 
869
int ieee80211_sta_disassociate(struct net_device *dev, u16 reason);
 
870
void ieee80211_send_addba_request(struct net_device *dev, u8 *da, u16 tid,
 
871
                                        u8 dialog_token, u16 start_seq_num,
 
872
                                        u16 agg_size,u16 timeout);
 
873
void ieee80211_send_delba(struct net_device *dev, u8 *da, u16 tid,
 
874
                                u16 initiator, u16 reason_code);
 
875
void ieee80211_send_addts(struct net_device *dev,
 
876
                          struct ieee80211_if_sta *ifsta,
 
877
                          struct ieee80211_elem_tspec *tspec);
 
878
void wmm_send_addts(struct net_device *dev,
 
879
                    struct ieee80211_if_sta *ifsta,
 
880
                    struct ieee80211_elem_tspec *tspec);
 
881
void ieee80211_send_delts(struct net_device *dev,
 
882
                          struct ieee80211_if_sta *ifsta,
 
883
                          struct ieee80211_elem_tspec *tp);
 
884
void wmm_send_delts(struct net_device *dev,
 
885
                    struct ieee80211_if_sta *ifsta,
 
886
                    struct ieee80211_elem_tspec *tp);
 
887
void ieee80211_send_dls_req(struct net_device *dev,
 
888
                            struct ieee80211_if_sta *ifsta,
 
889
                            u8 *addr, u16 timeout);
 
890
void ieee80211_send_dls_teardown(struct net_device *dev,
 
891
                                 struct ieee80211_if_sta *ifsta,
 
892
                                 u8 *mac, u16 reason);
 
893
struct sta_info *dls_info_get(struct ieee80211_local *local, u8 *addr);
 
894
void dls_info_add(struct ieee80211_if_sta *ifsta, struct sta_info *dls);
 
895
void dls_info_stop(struct ieee80211_if_sta *ifsta);
 
896
int dls_link_status(struct ieee80211_local *local, u8 *addr);
 
897
void ieee80211_sta_stop_rx_BA_session(struct net_device *dev,u8 *da,
 
898
                                      u16 tid, u16 initiator, u16 reason);
 
899
ieee80211_txrx_result ieee80211_sta_manage_reorder_buf(struct ieee80211_hw *hw,
 
900
        struct ieee80211_txrx_data *rx, struct tid_ht_agg_info_rx *tid_rx_info,
 
901
        struct sk_buff *skb, u16 mpdu_seq_num, int bar_req);
 
902
 
 
903
 
 
904
void ieee80211_rx_mgmt_action(struct net_device *dev,
 
905
                        struct ieee80211_if_sta *ifsta,
 
906
                        struct ieee80211_mgmt *mgmt,
 
907
                        size_t len);
 
908
 
 
909
/* ieee80211_iface.c */
 
910
int ieee80211_if_add(struct net_device *dev, const char *name,
 
911
                     struct net_device **new_dev, int type);
 
912
void ieee80211_if_set_type(struct net_device *dev, int type);
 
913
void ieee80211_if_reinit(struct net_device *dev);
 
914
void __ieee80211_if_del(struct ieee80211_local *local,
 
915
                        struct ieee80211_sub_if_data *sdata);
 
916
int ieee80211_if_remove(struct net_device *dev, const char *name, int id);
 
917
void ieee80211_if_free(struct net_device *dev);
 
918
void ieee80211_if_sdata_init(struct ieee80211_sub_if_data *sdata);
 
919
int ieee80211_if_add_mgmt(struct ieee80211_local *local);
 
920
void ieee80211_if_del_mgmt(struct ieee80211_local *local);
 
921
 
 
922
/* regdomain.c */
 
923
void ieee80211_regdomain_init(void);
 
924
void ieee80211_set_default_regdomain(struct ieee80211_hw_mode *mode);
 
925
 
 
926
/* for wiphy privid */
 
927
extern void *mac80211_wiphy_privid;
 
928
 
 
929
#endif /* IEEE80211_I_H */