~ubuntu-branches/ubuntu/natty/linux-backports-modules-2.6.38/natty-proposed

« back to all changes in this revision

Viewing changes to updates/cw-2.6.39/drivers/net/wireless/ipw2x00/libipw.h

  • Committer: Bazaar Package Importer
  • Author(s): Tim Gardner, Tim Gardner
  • Date: 2011-06-08 10:44:09 UTC
  • Revision ID: james.westby@ubuntu.com-20110608104409-fnl8carkdo15bwsz
Tags: 2.6.38-10.6
[ Tim Gardner ]

Shorten compat-wireless package name to cw to accomodate
CDROM file name length restrictions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Merged with mainline ieee80211.h in Aug 2004.  Original ieee802_11
 
3
 * remains copyright by the original authors
 
4
 *
 
5
 * Portions of the merged code are based on Host AP (software wireless
 
6
 * LAN access point) driver for Intersil Prism2/2.5/3.
 
7
 *
 
8
 * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
 
9
 * <j@w1.fi>
 
10
 * Copyright (c) 2002-2003, Jouni Malinen <j@w1.fi>
 
11
 *
 
12
 * Adaption to a generic IEEE 802.11 stack by James Ketrenos
 
13
 * <jketreno@linux.intel.com>
 
14
 * Copyright (c) 2004-2005, Intel Corporation
 
15
 *
 
16
 * This program is free software; you can redistribute it and/or modify
 
17
 * it under the terms of the GNU General Public License version 2 as
 
18
 * published by the Free Software Foundation. See README and COPYING for
 
19
 * more details.
 
20
 *
 
21
 * API Version History
 
22
 * 1.0.x -- Initial version
 
23
 * 1.1.x -- Added radiotap, QoS, TIM, libipw_geo APIs,
 
24
 *          various structure changes, and crypto API init method
 
25
 */
 
26
#ifndef LIBIPW_H
 
27
#define LIBIPW_H
 
28
#include <linux/if_ether.h>     /* ETH_ALEN */
 
29
#include <linux/kernel.h>       /* ARRAY_SIZE */
 
30
#include <linux/wireless.h>
 
31
#include <linux/ieee80211.h>
 
32
 
 
33
#include <net/lib80211.h>
 
34
#include <net/cfg80211.h>
 
35
 
 
36
#define LIBIPW_VERSION "git-1.1.13"
 
37
 
 
38
#define LIBIPW_DATA_LEN         2304
 
39
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
 
40
   6.2.1.1.2.
 
41
 
 
42
   The figure in section 7.1.2 suggests a body size of up to 2312
 
43
   bytes is allowed, which is a bit confusing, I suspect this
 
44
   represents the 2304 bytes of real data, plus a possible 8 bytes of
 
45
   WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
 
46
 
 
47
#define LIBIPW_1ADDR_LEN 10
 
48
#define LIBIPW_2ADDR_LEN 16
 
49
#define LIBIPW_3ADDR_LEN 24
 
50
#define LIBIPW_4ADDR_LEN 30
 
51
#define LIBIPW_FCS_LEN    4
 
52
#define LIBIPW_HLEN                     (LIBIPW_4ADDR_LEN)
 
53
#define LIBIPW_FRAME_LEN                (LIBIPW_DATA_LEN + LIBIPW_HLEN)
 
54
 
 
55
#define MIN_FRAG_THRESHOLD     256U
 
56
#define MAX_FRAG_THRESHOLD     2346U
 
57
 
 
58
/* QOS control */
 
59
#define LIBIPW_QCTL_TID         0x000F
 
60
 
 
61
/* debug macros */
 
62
 
 
63
#ifdef CONFIG_LIBIPW_DEBUG
 
64
extern u32 libipw_debug_level;
 
65
#define LIBIPW_DEBUG(level, fmt, args...) \
 
66
do { if (libipw_debug_level & (level)) \
 
67
  printk(KERN_DEBUG "libipw: %c %s " fmt, \
 
68
         in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
 
69
static inline bool libipw_ratelimit_debug(u32 level)
 
70
{
 
71
        return (libipw_debug_level & level) && net_ratelimit();
 
72
}
 
73
#else
 
74
#define LIBIPW_DEBUG(level, fmt, args...) do {} while (0)
 
75
static inline bool libipw_ratelimit_debug(u32 level)
 
76
{
 
77
        return false;
 
78
}
 
79
#endif                          /* CONFIG_LIBIPW_DEBUG */
 
80
 
 
81
/*
 
82
 * To use the debug system:
 
83
 *
 
84
 * If you are defining a new debug classification, simply add it to the #define
 
85
 * list here in the form of:
 
86
 *
 
87
 * #define LIBIPW_DL_xxxx VALUE
 
88
 *
 
89
 * shifting value to the left one bit from the previous entry.  xxxx should be
 
90
 * the name of the classification (for example, WEP)
 
91
 *
 
92
 * You then need to either add a LIBIPW_xxxx_DEBUG() macro definition for your
 
93
 * classification, or use LIBIPW_DEBUG(LIBIPW_DL_xxxx, ...) whenever you want
 
94
 * to send output to that classification.
 
95
 *
 
96
 * To add your debug level to the list of levels seen when you perform
 
97
 *
 
98
 * % cat /proc/net/ieee80211/debug_level
 
99
 *
 
100
 * you simply need to add your entry to the libipw_debug_level array.
 
101
 *
 
102
 * If you do not see debug_level in /proc/net/ieee80211 then you do not have
 
103
 * CONFIG_LIBIPW_DEBUG defined in your kernel configuration
 
104
 *
 
105
 */
 
106
 
 
107
#define LIBIPW_DL_INFO          (1<<0)
 
108
#define LIBIPW_DL_WX            (1<<1)
 
109
#define LIBIPW_DL_SCAN          (1<<2)
 
110
#define LIBIPW_DL_STATE         (1<<3)
 
111
#define LIBIPW_DL_MGMT          (1<<4)
 
112
#define LIBIPW_DL_FRAG          (1<<5)
 
113
#define LIBIPW_DL_DROP          (1<<7)
 
114
 
 
115
#define LIBIPW_DL_TX            (1<<8)
 
116
#define LIBIPW_DL_RX            (1<<9)
 
117
#define LIBIPW_DL_QOS           (1<<31)
 
118
 
 
119
#define LIBIPW_ERROR(f, a...) printk(KERN_ERR "libipw: " f, ## a)
 
120
#define LIBIPW_WARNING(f, a...) printk(KERN_WARNING "libipw: " f, ## a)
 
121
#define LIBIPW_DEBUG_INFO(f, a...)   LIBIPW_DEBUG(LIBIPW_DL_INFO, f, ## a)
 
122
 
 
123
#define LIBIPW_DEBUG_WX(f, a...)     LIBIPW_DEBUG(LIBIPW_DL_WX, f, ## a)
 
124
#define LIBIPW_DEBUG_SCAN(f, a...)   LIBIPW_DEBUG(LIBIPW_DL_SCAN, f, ## a)
 
125
#define LIBIPW_DEBUG_STATE(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_STATE, f, ## a)
 
126
#define LIBIPW_DEBUG_MGMT(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_MGMT, f, ## a)
 
127
#define LIBIPW_DEBUG_FRAG(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_FRAG, f, ## a)
 
128
#define LIBIPW_DEBUG_DROP(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_DROP, f, ## a)
 
129
#define LIBIPW_DEBUG_TX(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_TX, f, ## a)
 
130
#define LIBIPW_DEBUG_RX(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_RX, f, ## a)
 
131
#define LIBIPW_DEBUG_QOS(f, a...)  LIBIPW_DEBUG(LIBIPW_DL_QOS, f, ## a)
 
132
#include <linux/netdevice.h>
 
133
#include <linux/if_arp.h>       /* ARPHRD_ETHER */
 
134
 
 
135
#ifndef WIRELESS_SPY
 
136
#define WIRELESS_SPY            /* enable iwspy support */
 
137
#endif
 
138
#include <net/iw_handler.h>     /* new driver API */
 
139
 
 
140
#define ETH_P_PREAUTH 0x88C7    /* IEEE 802.11i pre-authentication */
 
141
 
 
142
#ifndef ETH_P_80211_RAW
 
143
#define ETH_P_80211_RAW (ETH_P_ECONET + 1)
 
144
#endif
 
145
 
 
146
/* IEEE 802.11 defines */
 
147
 
 
148
#define P80211_OUI_LEN 3
 
149
 
 
150
struct libipw_snap_hdr {
 
151
 
 
152
        u8 dsap;                /* always 0xAA */
 
153
        u8 ssap;                /* always 0xAA */
 
154
        u8 ctrl;                /* always 0x03 */
 
155
        u8 oui[P80211_OUI_LEN]; /* organizational universal id */
 
156
 
 
157
} __packed;
 
158
 
 
159
#define SNAP_SIZE sizeof(struct libipw_snap_hdr)
 
160
 
 
161
#define WLAN_FC_GET_VERS(fc) ((fc) & IEEE80211_FCTL_VERS)
 
162
#define WLAN_FC_GET_TYPE(fc) ((fc) & IEEE80211_FCTL_FTYPE)
 
163
#define WLAN_FC_GET_STYPE(fc) ((fc) & IEEE80211_FCTL_STYPE)
 
164
 
 
165
#define WLAN_GET_SEQ_FRAG(seq) ((seq) & IEEE80211_SCTL_FRAG)
 
166
#define WLAN_GET_SEQ_SEQ(seq)  (((seq) & IEEE80211_SCTL_SEQ) >> 4)
 
167
 
 
168
#define LIBIPW_STATMASK_SIGNAL (1<<0)
 
169
#define LIBIPW_STATMASK_RSSI (1<<1)
 
170
#define LIBIPW_STATMASK_NOISE (1<<2)
 
171
#define LIBIPW_STATMASK_RATE (1<<3)
 
172
#define LIBIPW_STATMASK_WEMASK 0x7
 
173
 
 
174
#define LIBIPW_CCK_MODULATION    (1<<0)
 
175
#define LIBIPW_OFDM_MODULATION   (1<<1)
 
176
 
 
177
#define LIBIPW_24GHZ_BAND     (1<<0)
 
178
#define LIBIPW_52GHZ_BAND     (1<<1)
 
179
 
 
180
#define LIBIPW_CCK_RATE_1MB                     0x02
 
181
#define LIBIPW_CCK_RATE_2MB                     0x04
 
182
#define LIBIPW_CCK_RATE_5MB                     0x0B
 
183
#define LIBIPW_CCK_RATE_11MB                    0x16
 
184
#define LIBIPW_OFDM_RATE_6MB                    0x0C
 
185
#define LIBIPW_OFDM_RATE_9MB                    0x12
 
186
#define LIBIPW_OFDM_RATE_12MB           0x18
 
187
#define LIBIPW_OFDM_RATE_18MB           0x24
 
188
#define LIBIPW_OFDM_RATE_24MB           0x30
 
189
#define LIBIPW_OFDM_RATE_36MB           0x48
 
190
#define LIBIPW_OFDM_RATE_48MB           0x60
 
191
#define LIBIPW_OFDM_RATE_54MB           0x6C
 
192
#define LIBIPW_BASIC_RATE_MASK          0x80
 
193
 
 
194
#define LIBIPW_CCK_RATE_1MB_MASK                (1<<0)
 
195
#define LIBIPW_CCK_RATE_2MB_MASK                (1<<1)
 
196
#define LIBIPW_CCK_RATE_5MB_MASK                (1<<2)
 
197
#define LIBIPW_CCK_RATE_11MB_MASK               (1<<3)
 
198
#define LIBIPW_OFDM_RATE_6MB_MASK               (1<<4)
 
199
#define LIBIPW_OFDM_RATE_9MB_MASK               (1<<5)
 
200
#define LIBIPW_OFDM_RATE_12MB_MASK              (1<<6)
 
201
#define LIBIPW_OFDM_RATE_18MB_MASK              (1<<7)
 
202
#define LIBIPW_OFDM_RATE_24MB_MASK              (1<<8)
 
203
#define LIBIPW_OFDM_RATE_36MB_MASK              (1<<9)
 
204
#define LIBIPW_OFDM_RATE_48MB_MASK              (1<<10)
 
205
#define LIBIPW_OFDM_RATE_54MB_MASK              (1<<11)
 
206
 
 
207
#define LIBIPW_CCK_RATES_MASK           0x0000000F
 
208
#define LIBIPW_CCK_BASIC_RATES_MASK     (LIBIPW_CCK_RATE_1MB_MASK | \
 
209
        LIBIPW_CCK_RATE_2MB_MASK)
 
210
#define LIBIPW_CCK_DEFAULT_RATES_MASK   (LIBIPW_CCK_BASIC_RATES_MASK | \
 
211
        LIBIPW_CCK_RATE_5MB_MASK | \
 
212
        LIBIPW_CCK_RATE_11MB_MASK)
 
213
 
 
214
#define LIBIPW_OFDM_RATES_MASK          0x00000FF0
 
215
#define LIBIPW_OFDM_BASIC_RATES_MASK    (LIBIPW_OFDM_RATE_6MB_MASK | \
 
216
        LIBIPW_OFDM_RATE_12MB_MASK | \
 
217
        LIBIPW_OFDM_RATE_24MB_MASK)
 
218
#define LIBIPW_OFDM_DEFAULT_RATES_MASK  (LIBIPW_OFDM_BASIC_RATES_MASK | \
 
219
        LIBIPW_OFDM_RATE_9MB_MASK  | \
 
220
        LIBIPW_OFDM_RATE_18MB_MASK | \
 
221
        LIBIPW_OFDM_RATE_36MB_MASK | \
 
222
        LIBIPW_OFDM_RATE_48MB_MASK | \
 
223
        LIBIPW_OFDM_RATE_54MB_MASK)
 
224
#define LIBIPW_DEFAULT_RATES_MASK (LIBIPW_OFDM_DEFAULT_RATES_MASK | \
 
225
                                LIBIPW_CCK_DEFAULT_RATES_MASK)
 
226
 
 
227
#define LIBIPW_NUM_OFDM_RATES       8
 
228
#define LIBIPW_NUM_CCK_RATES                4
 
229
#define LIBIPW_OFDM_SHIFT_MASK_A         4
 
230
 
 
231
/* NOTE: This data is for statistical purposes; not all hardware provides this
 
232
 *       information for frames received.
 
233
 *       For libipw_rx_mgt, you need to set at least the 'len' parameter.
 
234
 */
 
235
struct libipw_rx_stats {
 
236
        u32 mac_time;
 
237
        s8 rssi;
 
238
        u8 signal;
 
239
        u8 noise;
 
240
        u16 rate;               /* in 100 kbps */
 
241
        u8 received_channel;
 
242
        u8 control;
 
243
        u8 mask;
 
244
        u8 freq;
 
245
        u16 len;
 
246
        u64 tsf;
 
247
        u32 beacon_time;
 
248
};
 
249
 
 
250
/* IEEE 802.11 requires that STA supports concurrent reception of at least
 
251
 * three fragmented frames. This define can be increased to support more
 
252
 * concurrent frames, but it should be noted that each entry can consume about
 
253
 * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
 
254
#define LIBIPW_FRAG_CACHE_LEN 4
 
255
 
 
256
struct libipw_frag_entry {
 
257
        unsigned long first_frag_time;
 
258
        unsigned int seq;
 
259
        unsigned int last_frag;
 
260
        struct sk_buff *skb;
 
261
        u8 src_addr[ETH_ALEN];
 
262
        u8 dst_addr[ETH_ALEN];
 
263
};
 
264
 
 
265
struct libipw_stats {
 
266
        unsigned int tx_unicast_frames;
 
267
        unsigned int tx_multicast_frames;
 
268
        unsigned int tx_fragments;
 
269
        unsigned int tx_unicast_octets;
 
270
        unsigned int tx_multicast_octets;
 
271
        unsigned int tx_deferred_transmissions;
 
272
        unsigned int tx_single_retry_frames;
 
273
        unsigned int tx_multiple_retry_frames;
 
274
        unsigned int tx_retry_limit_exceeded;
 
275
        unsigned int tx_discards;
 
276
        unsigned int rx_unicast_frames;
 
277
        unsigned int rx_multicast_frames;
 
278
        unsigned int rx_fragments;
 
279
        unsigned int rx_unicast_octets;
 
280
        unsigned int rx_multicast_octets;
 
281
        unsigned int rx_fcs_errors;
 
282
        unsigned int rx_discards_no_buffer;
 
283
        unsigned int tx_discards_wrong_sa;
 
284
        unsigned int rx_discards_undecryptable;
 
285
        unsigned int rx_message_in_msg_fragments;
 
286
        unsigned int rx_message_in_bad_msg_fragments;
 
287
};
 
288
 
 
289
struct libipw_device;
 
290
 
 
291
#define SEC_KEY_1               (1<<0)
 
292
#define SEC_KEY_2               (1<<1)
 
293
#define SEC_KEY_3               (1<<2)
 
294
#define SEC_KEY_4               (1<<3)
 
295
#define SEC_ACTIVE_KEY          (1<<4)
 
296
#define SEC_AUTH_MODE           (1<<5)
 
297
#define SEC_UNICAST_GROUP       (1<<6)
 
298
#define SEC_LEVEL               (1<<7)
 
299
#define SEC_ENABLED             (1<<8)
 
300
#define SEC_ENCRYPT             (1<<9)
 
301
 
 
302
#define SEC_LEVEL_0             0       /* None */
 
303
#define SEC_LEVEL_1             1       /* WEP 40 and 104 bit */
 
304
#define SEC_LEVEL_2             2       /* Level 1 + TKIP */
 
305
#define SEC_LEVEL_2_CKIP        3       /* Level 1 + CKIP */
 
306
#define SEC_LEVEL_3             4       /* Level 2 + CCMP */
 
307
 
 
308
#define SEC_ALG_NONE            0
 
309
#define SEC_ALG_WEP             1
 
310
#define SEC_ALG_TKIP            2
 
311
#define SEC_ALG_CCMP            3
 
312
 
 
313
#define WEP_KEYS                4
 
314
#define WEP_KEY_LEN             13
 
315
#define SCM_KEY_LEN             32
 
316
#define SCM_TEMPORAL_KEY_LENGTH 16
 
317
 
 
318
struct libipw_security {
 
319
        u16 active_key:2, enabled:1, unicast_uses_group:1, encrypt:1;
 
320
        u8 auth_mode;
 
321
        u8 encode_alg[WEP_KEYS];
 
322
        u8 key_sizes[WEP_KEYS];
 
323
        u8 keys[WEP_KEYS][SCM_KEY_LEN];
 
324
        u8 level;
 
325
        u16 flags;
 
326
} __packed;
 
327
 
 
328
/*
 
329
 
 
330
 802.11 data frame from AP
 
331
 
 
332
      ,-------------------------------------------------------------------.
 
333
Bytes |  2   |  2   |    6    |    6    |    6    |  2   | 0..2312 |   4  |
 
334
      |------|------|---------|---------|---------|------|---------|------|
 
335
Desc. | ctrl | dura |  DA/RA  |   TA    |    SA   | Sequ |  frame  |  fcs |
 
336
      |      | tion | (BSSID) |         |         | ence |  data   |      |
 
337
      `-------------------------------------------------------------------'
 
338
 
 
339
Total: 28-2340 bytes
 
340
 
 
341
*/
 
342
 
 
343
#define BEACON_PROBE_SSID_ID_POSITION 12
 
344
 
 
345
struct libipw_hdr_1addr {
 
346
        __le16 frame_ctl;
 
347
        __le16 duration_id;
 
348
        u8 addr1[ETH_ALEN];
 
349
        u8 payload[0];
 
350
} __packed;
 
351
 
 
352
struct libipw_hdr_2addr {
 
353
        __le16 frame_ctl;
 
354
        __le16 duration_id;
 
355
        u8 addr1[ETH_ALEN];
 
356
        u8 addr2[ETH_ALEN];
 
357
        u8 payload[0];
 
358
} __packed;
 
359
 
 
360
struct libipw_hdr_3addr {
 
361
        __le16 frame_ctl;
 
362
        __le16 duration_id;
 
363
        u8 addr1[ETH_ALEN];
 
364
        u8 addr2[ETH_ALEN];
 
365
        u8 addr3[ETH_ALEN];
 
366
        __le16 seq_ctl;
 
367
        u8 payload[0];
 
368
} __packed;
 
369
 
 
370
struct libipw_hdr_4addr {
 
371
        __le16 frame_ctl;
 
372
        __le16 duration_id;
 
373
        u8 addr1[ETH_ALEN];
 
374
        u8 addr2[ETH_ALEN];
 
375
        u8 addr3[ETH_ALEN];
 
376
        __le16 seq_ctl;
 
377
        u8 addr4[ETH_ALEN];
 
378
        u8 payload[0];
 
379
} __packed;
 
380
 
 
381
struct libipw_hdr_3addrqos {
 
382
        __le16 frame_ctl;
 
383
        __le16 duration_id;
 
384
        u8 addr1[ETH_ALEN];
 
385
        u8 addr2[ETH_ALEN];
 
386
        u8 addr3[ETH_ALEN];
 
387
        __le16 seq_ctl;
 
388
        u8 payload[0];
 
389
        __le16 qos_ctl;
 
390
} __packed;
 
391
 
 
392
struct libipw_info_element {
 
393
        u8 id;
 
394
        u8 len;
 
395
        u8 data[0];
 
396
} __packed;
 
397
 
 
398
/*
 
399
 * These are the data types that can make up management packets
 
400
 *
 
401
        u16 auth_algorithm;
 
402
        u16 auth_sequence;
 
403
        u16 beacon_interval;
 
404
        u16 capability;
 
405
        u8 current_ap[ETH_ALEN];
 
406
        u16 listen_interval;
 
407
        struct {
 
408
                u16 association_id:14, reserved:2;
 
409
        } __packed;
 
410
        u32 time_stamp[2];
 
411
        u16 reason;
 
412
        u16 status;
 
413
*/
 
414
 
 
415
struct libipw_auth {
 
416
        struct libipw_hdr_3addr header;
 
417
        __le16 algorithm;
 
418
        __le16 transaction;
 
419
        __le16 status;
 
420
        /* challenge */
 
421
        struct libipw_info_element info_element[0];
 
422
} __packed;
 
423
 
 
424
struct libipw_channel_switch {
 
425
        u8 id;
 
426
        u8 len;
 
427
        u8 mode;
 
428
        u8 channel;
 
429
        u8 count;
 
430
} __packed;
 
431
 
 
432
struct libipw_action {
 
433
        struct libipw_hdr_3addr header;
 
434
        u8 category;
 
435
        u8 action;
 
436
        union {
 
437
                struct libipw_action_exchange {
 
438
                        u8 token;
 
439
                        struct libipw_info_element info_element[0];
 
440
                } exchange;
 
441
                struct libipw_channel_switch channel_switch;
 
442
 
 
443
        } format;
 
444
} __packed;
 
445
 
 
446
struct libipw_disassoc {
 
447
        struct libipw_hdr_3addr header;
 
448
        __le16 reason;
 
449
} __packed;
 
450
 
 
451
/* Alias deauth for disassoc */
 
452
#define libipw_deauth libipw_disassoc
 
453
 
 
454
struct libipw_probe_request {
 
455
        struct libipw_hdr_3addr header;
 
456
        /* SSID, supported rates */
 
457
        struct libipw_info_element info_element[0];
 
458
} __packed;
 
459
 
 
460
struct libipw_probe_response {
 
461
        struct libipw_hdr_3addr header;
 
462
        __le32 time_stamp[2];
 
463
        __le16 beacon_interval;
 
464
        __le16 capability;
 
465
        /* SSID, supported rates, FH params, DS params,
 
466
         * CF params, IBSS params, TIM (if beacon), RSN */
 
467
        struct libipw_info_element info_element[0];
 
468
} __packed;
 
469
 
 
470
/* Alias beacon for probe_response */
 
471
#define libipw_beacon libipw_probe_response
 
472
 
 
473
struct libipw_assoc_request {
 
474
        struct libipw_hdr_3addr header;
 
475
        __le16 capability;
 
476
        __le16 listen_interval;
 
477
        /* SSID, supported rates, RSN */
 
478
        struct libipw_info_element info_element[0];
 
479
} __packed;
 
480
 
 
481
struct libipw_reassoc_request {
 
482
        struct libipw_hdr_3addr header;
 
483
        __le16 capability;
 
484
        __le16 listen_interval;
 
485
        u8 current_ap[ETH_ALEN];
 
486
        struct libipw_info_element info_element[0];
 
487
} __packed;
 
488
 
 
489
struct libipw_assoc_response {
 
490
        struct libipw_hdr_3addr header;
 
491
        __le16 capability;
 
492
        __le16 status;
 
493
        __le16 aid;
 
494
        /* supported rates */
 
495
        struct libipw_info_element info_element[0];
 
496
} __packed;
 
497
 
 
498
struct libipw_txb {
 
499
        u8 nr_frags;
 
500
        u8 encrypted;
 
501
        u8 rts_included;
 
502
        u8 reserved;
 
503
        u16 frag_size;
 
504
        u16 payload_size;
 
505
        struct sk_buff *fragments[0];
 
506
};
 
507
 
 
508
/* SWEEP TABLE ENTRIES NUMBER */
 
509
#define MAX_SWEEP_TAB_ENTRIES             42
 
510
#define MAX_SWEEP_TAB_ENTRIES_PER_PACKET  7
 
511
/* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
 
512
 * only use 8, and then use extended rates for the remaining supported
 
513
 * rates.  Other APs, however, stick all of their supported rates on the
 
514
 * main rates information element... */
 
515
#define MAX_RATES_LENGTH                  ((u8)12)
 
516
#define MAX_RATES_EX_LENGTH               ((u8)16)
 
517
#define MAX_NETWORK_COUNT                  128
 
518
 
 
519
#define CRC_LENGTH                 4U
 
520
 
 
521
#define MAX_WPA_IE_LEN 64
 
522
 
 
523
#define NETWORK_HAS_OFDM       (1<<1)
 
524
#define NETWORK_HAS_CCK        (1<<2)
 
525
 
 
526
/* QoS structure */
 
527
#define NETWORK_HAS_QOS_PARAMETERS      (1<<3)
 
528
#define NETWORK_HAS_QOS_INFORMATION     (1<<4)
 
529
#define NETWORK_HAS_QOS_MASK            (NETWORK_HAS_QOS_PARAMETERS | \
 
530
                                         NETWORK_HAS_QOS_INFORMATION)
 
531
 
 
532
/* 802.11h */
 
533
#define NETWORK_HAS_POWER_CONSTRAINT    (1<<5)
 
534
#define NETWORK_HAS_CSA                 (1<<6)
 
535
#define NETWORK_HAS_QUIET               (1<<7)
 
536
#define NETWORK_HAS_IBSS_DFS            (1<<8)
 
537
#define NETWORK_HAS_TPC_REPORT          (1<<9)
 
538
 
 
539
#define NETWORK_HAS_ERP_VALUE           (1<<10)
 
540
 
 
541
#define QOS_QUEUE_NUM                   4
 
542
#define QOS_OUI_LEN                     3
 
543
#define QOS_OUI_TYPE                    2
 
544
#define QOS_ELEMENT_ID                  221
 
545
#define QOS_OUI_INFO_SUB_TYPE           0
 
546
#define QOS_OUI_PARAM_SUB_TYPE          1
 
547
#define QOS_VERSION_1                   1
 
548
#define QOS_AIFSN_MIN_VALUE             2
 
549
 
 
550
struct libipw_qos_information_element {
 
551
        u8 elementID;
 
552
        u8 length;
 
553
        u8 qui[QOS_OUI_LEN];
 
554
        u8 qui_type;
 
555
        u8 qui_subtype;
 
556
        u8 version;
 
557
        u8 ac_info;
 
558
} __packed;
 
559
 
 
560
struct libipw_qos_ac_parameter {
 
561
        u8 aci_aifsn;
 
562
        u8 ecw_min_max;
 
563
        __le16 tx_op_limit;
 
564
} __packed;
 
565
 
 
566
struct libipw_qos_parameter_info {
 
567
        struct libipw_qos_information_element info_element;
 
568
        u8 reserved;
 
569
        struct libipw_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM];
 
570
} __packed;
 
571
 
 
572
struct libipw_qos_parameters {
 
573
        __le16 cw_min[QOS_QUEUE_NUM];
 
574
        __le16 cw_max[QOS_QUEUE_NUM];
 
575
        u8 aifs[QOS_QUEUE_NUM];
 
576
        u8 flag[QOS_QUEUE_NUM];
 
577
        __le16 tx_op_limit[QOS_QUEUE_NUM];
 
578
} __packed;
 
579
 
 
580
struct libipw_qos_data {
 
581
        struct libipw_qos_parameters parameters;
 
582
        int active;
 
583
        int supported;
 
584
        u8 param_count;
 
585
        u8 old_param_count;
 
586
};
 
587
 
 
588
struct libipw_tim_parameters {
 
589
        u8 tim_count;
 
590
        u8 tim_period;
 
591
} __packed;
 
592
 
 
593
/*******************************************************/
 
594
 
 
595
enum {                          /* libipw_basic_report.map */
 
596
        LIBIPW_BASIC_MAP_BSS = (1 << 0),
 
597
        LIBIPW_BASIC_MAP_OFDM = (1 << 1),
 
598
        LIBIPW_BASIC_MAP_UNIDENTIFIED = (1 << 2),
 
599
        LIBIPW_BASIC_MAP_RADAR = (1 << 3),
 
600
        LIBIPW_BASIC_MAP_UNMEASURED = (1 << 4),
 
601
        /* Bits 5-7 are reserved */
 
602
 
 
603
};
 
604
struct libipw_basic_report {
 
605
        u8 channel;
 
606
        __le64 start_time;
 
607
        __le16 duration;
 
608
        u8 map;
 
609
} __packed;
 
610
 
 
611
enum {                          /* libipw_measurement_request.mode */
 
612
        /* Bit 0 is reserved */
 
613
        LIBIPW_MEASUREMENT_ENABLE = (1 << 1),
 
614
        LIBIPW_MEASUREMENT_REQUEST = (1 << 2),
 
615
        LIBIPW_MEASUREMENT_REPORT = (1 << 3),
 
616
        /* Bits 4-7 are reserved */
 
617
};
 
618
 
 
619
enum {
 
620
        LIBIPW_REPORT_BASIC = 0,        /* required */
 
621
        LIBIPW_REPORT_CCA = 1,  /* optional */
 
622
        LIBIPW_REPORT_RPI = 2,  /* optional */
 
623
        /* 3-255 reserved */
 
624
};
 
625
 
 
626
struct libipw_measurement_params {
 
627
        u8 channel;
 
628
        __le64 start_time;
 
629
        __le16 duration;
 
630
} __packed;
 
631
 
 
632
struct libipw_measurement_request {
 
633
        struct libipw_info_element ie;
 
634
        u8 token;
 
635
        u8 mode;
 
636
        u8 type;
 
637
        struct libipw_measurement_params params[0];
 
638
} __packed;
 
639
 
 
640
struct libipw_measurement_report {
 
641
        struct libipw_info_element ie;
 
642
        u8 token;
 
643
        u8 mode;
 
644
        u8 type;
 
645
        union {
 
646
                struct libipw_basic_report basic[0];
 
647
        } u;
 
648
} __packed;
 
649
 
 
650
struct libipw_tpc_report {
 
651
        u8 transmit_power;
 
652
        u8 link_margin;
 
653
} __packed;
 
654
 
 
655
struct libipw_channel_map {
 
656
        u8 channel;
 
657
        u8 map;
 
658
} __packed;
 
659
 
 
660
struct libipw_ibss_dfs {
 
661
        struct libipw_info_element ie;
 
662
        u8 owner[ETH_ALEN];
 
663
        u8 recovery_interval;
 
664
        struct libipw_channel_map channel_map[0];
 
665
};
 
666
 
 
667
struct libipw_csa {
 
668
        u8 mode;
 
669
        u8 channel;
 
670
        u8 count;
 
671
} __packed;
 
672
 
 
673
struct libipw_quiet {
 
674
        u8 count;
 
675
        u8 period;
 
676
        u8 duration;
 
677
        u8 offset;
 
678
} __packed;
 
679
 
 
680
struct libipw_network {
 
681
        /* These entries are used to identify a unique network */
 
682
        u8 bssid[ETH_ALEN];
 
683
        u8 channel;
 
684
        /* Ensure null-terminated for any debug msgs */
 
685
        u8 ssid[IW_ESSID_MAX_SIZE + 1];
 
686
        u8 ssid_len;
 
687
 
 
688
        struct libipw_qos_data qos_data;
 
689
 
 
690
        /* These are network statistics */
 
691
        struct libipw_rx_stats stats;
 
692
        u16 capability;
 
693
        u8 rates[MAX_RATES_LENGTH];
 
694
        u8 rates_len;
 
695
        u8 rates_ex[MAX_RATES_EX_LENGTH];
 
696
        u8 rates_ex_len;
 
697
        unsigned long last_scanned;
 
698
        u8 mode;
 
699
        u32 flags;
 
700
        u32 last_associate;
 
701
        u32 time_stamp[2];
 
702
        u16 beacon_interval;
 
703
        u16 listen_interval;
 
704
        u16 atim_window;
 
705
        u8 erp_value;
 
706
        u8 wpa_ie[MAX_WPA_IE_LEN];
 
707
        size_t wpa_ie_len;
 
708
        u8 rsn_ie[MAX_WPA_IE_LEN];
 
709
        size_t rsn_ie_len;
 
710
        struct libipw_tim_parameters tim;
 
711
 
 
712
        /* 802.11h info */
 
713
 
 
714
        /* Power Constraint - mandatory if spctrm mgmt required */
 
715
        u8 power_constraint;
 
716
 
 
717
        /* TPC Report - mandatory if spctrm mgmt required */
 
718
        struct libipw_tpc_report tpc_report;
 
719
 
 
720
        /* IBSS DFS - mandatory if spctrm mgmt required and IBSS
 
721
         * NOTE: This is variable length and so must be allocated dynamically */
 
722
        struct libipw_ibss_dfs *ibss_dfs;
 
723
 
 
724
        /* Channel Switch Announcement - optional if spctrm mgmt required */
 
725
        struct libipw_csa csa;
 
726
 
 
727
        /* Quiet - optional if spctrm mgmt required */
 
728
        struct libipw_quiet quiet;
 
729
 
 
730
        struct list_head list;
 
731
};
 
732
 
 
733
enum libipw_state {
 
734
        LIBIPW_UNINITIALIZED = 0,
 
735
        LIBIPW_INITIALIZED,
 
736
        LIBIPW_ASSOCIATING,
 
737
        LIBIPW_ASSOCIATED,
 
738
        LIBIPW_AUTHENTICATING,
 
739
        LIBIPW_AUTHENTICATED,
 
740
        LIBIPW_SHUTDOWN
 
741
};
 
742
 
 
743
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
 
744
#define DEFAULT_FTS 2346
 
745
 
 
746
#define CFG_LIBIPW_RESERVE_FCS (1<<0)
 
747
#define CFG_LIBIPW_COMPUTE_FCS (1<<1)
 
748
#define CFG_LIBIPW_RTS (1<<2)
 
749
 
 
750
#define LIBIPW_24GHZ_MIN_CHANNEL 1
 
751
#define LIBIPW_24GHZ_MAX_CHANNEL 14
 
752
#define LIBIPW_24GHZ_CHANNELS (LIBIPW_24GHZ_MAX_CHANNEL - \
 
753
                                  LIBIPW_24GHZ_MIN_CHANNEL + 1)
 
754
 
 
755
#define LIBIPW_52GHZ_MIN_CHANNEL 34
 
756
#define LIBIPW_52GHZ_MAX_CHANNEL 165
 
757
#define LIBIPW_52GHZ_CHANNELS (LIBIPW_52GHZ_MAX_CHANNEL - \
 
758
                                  LIBIPW_52GHZ_MIN_CHANNEL + 1)
 
759
 
 
760
enum {
 
761
        LIBIPW_CH_PASSIVE_ONLY = (1 << 0),
 
762
        LIBIPW_CH_80211H_RULES = (1 << 1),
 
763
        LIBIPW_CH_B_ONLY = (1 << 2),
 
764
        LIBIPW_CH_NO_IBSS = (1 << 3),
 
765
        LIBIPW_CH_UNIFORM_SPREADING = (1 << 4),
 
766
        LIBIPW_CH_RADAR_DETECT = (1 << 5),
 
767
        LIBIPW_CH_INVALID = (1 << 6),
 
768
};
 
769
 
 
770
struct libipw_channel {
 
771
        u32 freq;       /* in MHz */
 
772
        u8 channel;
 
773
        u8 flags;
 
774
        u8 max_power;   /* in dBm */
 
775
};
 
776
 
 
777
struct libipw_geo {
 
778
        u8 name[4];
 
779
        u8 bg_channels;
 
780
        u8 a_channels;
 
781
        struct libipw_channel bg[LIBIPW_24GHZ_CHANNELS];
 
782
        struct libipw_channel a[LIBIPW_52GHZ_CHANNELS];
 
783
};
 
784
 
 
785
struct libipw_device {
 
786
        struct net_device *dev;
 
787
        struct wireless_dev wdev;
 
788
        struct libipw_security sec;
 
789
 
 
790
        /* Bookkeeping structures */
 
791
        struct libipw_stats ieee_stats;
 
792
 
 
793
        struct libipw_geo geo;
 
794
        struct ieee80211_supported_band bg_band;
 
795
        struct ieee80211_supported_band a_band;
 
796
 
 
797
        /* Probe / Beacon management */
 
798
        struct list_head network_free_list;
 
799
        struct list_head network_list;
 
800
        struct libipw_network *networks[MAX_NETWORK_COUNT];
 
801
        int scans;
 
802
        int scan_age;
 
803
 
 
804
        int iw_mode;            /* operating mode (IW_MODE_*) */
 
805
        struct iw_spy_data spy_data;    /* iwspy support */
 
806
 
 
807
        spinlock_t lock;
 
808
 
 
809
        int tx_headroom;        /* Set to size of any additional room needed at front
 
810
                                 * of allocated Tx SKBs */
 
811
        u32 config;
 
812
 
 
813
        /* WEP and other encryption related settings at the device level */
 
814
        int open_wep;           /* Set to 1 to allow unencrypted frames */
 
815
 
 
816
        int reset_on_keychange; /* Set to 1 if the HW needs to be reset on
 
817
                                 * WEP key changes */
 
818
 
 
819
        /* If the host performs {en,de}cryption, then set to 1 */
 
820
        int host_encrypt;
 
821
        int host_encrypt_msdu;
 
822
        int host_decrypt;
 
823
        /* host performs multicast decryption */
 
824
        int host_mc_decrypt;
 
825
 
 
826
        /* host should strip IV and ICV from protected frames */
 
827
        /* meaningful only when hardware decryption is being used */
 
828
        int host_strip_iv_icv;
 
829
 
 
830
        int host_open_frag;
 
831
        int ieee802_1x;         /* is IEEE 802.1X used */
 
832
 
 
833
        /* WPA data */
 
834
        int wpa_enabled;
 
835
        int drop_unencrypted;
 
836
        int privacy_invoked;
 
837
        size_t wpa_ie_len;
 
838
        u8 *wpa_ie;
 
839
 
 
840
        struct lib80211_crypt_info crypt_info;
 
841
 
 
842
        int bcrx_sta_key;       /* use individual keys to override default keys even
 
843
                                 * with RX of broad/multicast frames */
 
844
 
 
845
        /* Fragmentation structures */
 
846
        struct libipw_frag_entry frag_cache[LIBIPW_FRAG_CACHE_LEN];
 
847
        unsigned int frag_next_idx;
 
848
        u16 fts;                /* Fragmentation Threshold */
 
849
        u16 rts;                /* RTS threshold */
 
850
 
 
851
        /* Association info */
 
852
        u8 bssid[ETH_ALEN];
 
853
 
 
854
        enum libipw_state state;
 
855
 
 
856
        int mode;               /* A, B, G */
 
857
        int modulation;         /* CCK, OFDM */
 
858
        int freq_band;          /* 2.4Ghz, 5.2Ghz, Mixed */
 
859
        int abg_true;           /* ABG flag              */
 
860
 
 
861
        int perfect_rssi;
 
862
        int worst_rssi;
 
863
 
 
864
        u16 prev_seq_ctl;       /* used to drop duplicate frames */
 
865
 
 
866
        /* Callback functions */
 
867
        void (*set_security) (struct net_device * dev,
 
868
                              struct libipw_security * sec);
 
869
        netdev_tx_t (*hard_start_xmit) (struct libipw_txb * txb,
 
870
                                        struct net_device * dev, int pri);
 
871
        int (*reset_port) (struct net_device * dev);
 
872
        int (*is_queue_full) (struct net_device * dev, int pri);
 
873
 
 
874
        int (*handle_management) (struct net_device * dev,
 
875
                                  struct libipw_network * network, u16 type);
 
876
        int (*is_qos_active) (struct net_device *dev, struct sk_buff *skb);
 
877
 
 
878
        /* Typical STA methods */
 
879
        int (*handle_auth) (struct net_device * dev,
 
880
                            struct libipw_auth * auth);
 
881
        int (*handle_deauth) (struct net_device * dev,
 
882
                              struct libipw_deauth * auth);
 
883
        int (*handle_action) (struct net_device * dev,
 
884
                              struct libipw_action * action,
 
885
                              struct libipw_rx_stats * stats);
 
886
        int (*handle_disassoc) (struct net_device * dev,
 
887
                                struct libipw_disassoc * assoc);
 
888
        int (*handle_beacon) (struct net_device * dev,
 
889
                              struct libipw_beacon * beacon,
 
890
                              struct libipw_network * network);
 
891
        int (*handle_probe_response) (struct net_device * dev,
 
892
                                      struct libipw_probe_response * resp,
 
893
                                      struct libipw_network * network);
 
894
        int (*handle_probe_request) (struct net_device * dev,
 
895
                                     struct libipw_probe_request * req,
 
896
                                     struct libipw_rx_stats * stats);
 
897
        int (*handle_assoc_response) (struct net_device * dev,
 
898
                                      struct libipw_assoc_response * resp,
 
899
                                      struct libipw_network * network);
 
900
 
 
901
        /* Typical AP methods */
 
902
        int (*handle_assoc_request) (struct net_device * dev);
 
903
        int (*handle_reassoc_request) (struct net_device * dev,
 
904
                                       struct libipw_reassoc_request * req);
 
905
 
 
906
        /* This must be the last item so that it points to the data
 
907
         * allocated beyond this structure by alloc_libipw */
 
908
        u8 priv[0];
 
909
};
 
910
 
 
911
#define IEEE_A            (1<<0)
 
912
#define IEEE_B            (1<<1)
 
913
#define IEEE_G            (1<<2)
 
914
#define IEEE_MODE_MASK    (IEEE_A|IEEE_B|IEEE_G)
 
915
 
 
916
static inline void *libipw_priv(struct net_device *dev)
 
917
{
 
918
        return ((struct libipw_device *)netdev_priv(dev))->priv;
 
919
}
 
920
 
 
921
static inline int libipw_is_valid_mode(struct libipw_device *ieee,
 
922
                                          int mode)
 
923
{
 
924
        /*
 
925
         * It is possible for both access points and our device to support
 
926
         * combinations of modes, so as long as there is one valid combination
 
927
         * of ap/device supported modes, then return success
 
928
         *
 
929
         */
 
930
        if ((mode & IEEE_A) &&
 
931
            (ieee->modulation & LIBIPW_OFDM_MODULATION) &&
 
932
            (ieee->freq_band & LIBIPW_52GHZ_BAND))
 
933
                return 1;
 
934
 
 
935
        if ((mode & IEEE_G) &&
 
936
            (ieee->modulation & LIBIPW_OFDM_MODULATION) &&
 
937
            (ieee->freq_band & LIBIPW_24GHZ_BAND))
 
938
                return 1;
 
939
 
 
940
        if ((mode & IEEE_B) &&
 
941
            (ieee->modulation & LIBIPW_CCK_MODULATION) &&
 
942
            (ieee->freq_band & LIBIPW_24GHZ_BAND))
 
943
                return 1;
 
944
 
 
945
        return 0;
 
946
}
 
947
 
 
948
static inline int libipw_get_hdrlen(u16 fc)
 
949
{
 
950
        int hdrlen = LIBIPW_3ADDR_LEN;
 
951
        u16 stype = WLAN_FC_GET_STYPE(fc);
 
952
 
 
953
        switch (WLAN_FC_GET_TYPE(fc)) {
 
954
        case IEEE80211_FTYPE_DATA:
 
955
                if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS))
 
956
                        hdrlen = LIBIPW_4ADDR_LEN;
 
957
                if (stype & IEEE80211_STYPE_QOS_DATA)
 
958
                        hdrlen += 2;
 
959
                break;
 
960
        case IEEE80211_FTYPE_CTL:
 
961
                switch (WLAN_FC_GET_STYPE(fc)) {
 
962
                case IEEE80211_STYPE_CTS:
 
963
                case IEEE80211_STYPE_ACK:
 
964
                        hdrlen = LIBIPW_1ADDR_LEN;
 
965
                        break;
 
966
                default:
 
967
                        hdrlen = LIBIPW_2ADDR_LEN;
 
968
                        break;
 
969
                }
 
970
                break;
 
971
        }
 
972
 
 
973
        return hdrlen;
 
974
}
 
975
 
 
976
static inline u8 *libipw_get_payload(struct ieee80211_hdr *hdr)
 
977
{
 
978
        switch (libipw_get_hdrlen(le16_to_cpu(hdr->frame_control))) {
 
979
        case LIBIPW_1ADDR_LEN:
 
980
                return ((struct libipw_hdr_1addr *)hdr)->payload;
 
981
        case LIBIPW_2ADDR_LEN:
 
982
                return ((struct libipw_hdr_2addr *)hdr)->payload;
 
983
        case LIBIPW_3ADDR_LEN:
 
984
                return ((struct libipw_hdr_3addr *)hdr)->payload;
 
985
        case LIBIPW_4ADDR_LEN:
 
986
                return ((struct libipw_hdr_4addr *)hdr)->payload;
 
987
        }
 
988
        return NULL;
 
989
}
 
990
 
 
991
static inline int libipw_is_ofdm_rate(u8 rate)
 
992
{
 
993
        switch (rate & ~LIBIPW_BASIC_RATE_MASK) {
 
994
        case LIBIPW_OFDM_RATE_6MB:
 
995
        case LIBIPW_OFDM_RATE_9MB:
 
996
        case LIBIPW_OFDM_RATE_12MB:
 
997
        case LIBIPW_OFDM_RATE_18MB:
 
998
        case LIBIPW_OFDM_RATE_24MB:
 
999
        case LIBIPW_OFDM_RATE_36MB:
 
1000
        case LIBIPW_OFDM_RATE_48MB:
 
1001
        case LIBIPW_OFDM_RATE_54MB:
 
1002
                return 1;
 
1003
        }
 
1004
        return 0;
 
1005
}
 
1006
 
 
1007
static inline int libipw_is_cck_rate(u8 rate)
 
1008
{
 
1009
        switch (rate & ~LIBIPW_BASIC_RATE_MASK) {
 
1010
        case LIBIPW_CCK_RATE_1MB:
 
1011
        case LIBIPW_CCK_RATE_2MB:
 
1012
        case LIBIPW_CCK_RATE_5MB:
 
1013
        case LIBIPW_CCK_RATE_11MB:
 
1014
                return 1;
 
1015
        }
 
1016
        return 0;
 
1017
}
 
1018
 
 
1019
/* libipw.c */
 
1020
extern void free_libipw(struct net_device *dev, int monitor);
 
1021
extern struct net_device *alloc_libipw(int sizeof_priv, int monitor);
 
1022
extern int libipw_change_mtu(struct net_device *dev, int new_mtu);
 
1023
 
 
1024
extern void libipw_networks_age(struct libipw_device *ieee,
 
1025
                                   unsigned long age_secs);
 
1026
 
 
1027
extern int libipw_set_encryption(struct libipw_device *ieee);
 
1028
 
 
1029
/* libipw_tx.c */
 
1030
extern netdev_tx_t libipw_xmit(struct sk_buff *skb,
 
1031
                               struct net_device *dev);
 
1032
extern void libipw_txb_free(struct libipw_txb *);
 
1033
 
 
1034
/* libipw_rx.c */
 
1035
extern void libipw_rx_any(struct libipw_device *ieee,
 
1036
                     struct sk_buff *skb, struct libipw_rx_stats *stats);
 
1037
extern int libipw_rx(struct libipw_device *ieee, struct sk_buff *skb,
 
1038
                        struct libipw_rx_stats *rx_stats);
 
1039
/* make sure to set stats->len */
 
1040
extern void libipw_rx_mgt(struct libipw_device *ieee,
 
1041
                             struct libipw_hdr_4addr *header,
 
1042
                             struct libipw_rx_stats *stats);
 
1043
extern void libipw_network_reset(struct libipw_network *network);
 
1044
 
 
1045
/* libipw_geo.c */
 
1046
extern const struct libipw_geo *libipw_get_geo(struct libipw_device
 
1047
                                                     *ieee);
 
1048
extern int libipw_set_geo(struct libipw_device *ieee,
 
1049
                             const struct libipw_geo *geo);
 
1050
 
 
1051
extern int libipw_is_valid_channel(struct libipw_device *ieee,
 
1052
                                      u8 channel);
 
1053
extern int libipw_channel_to_index(struct libipw_device *ieee,
 
1054
                                      u8 channel);
 
1055
extern u8 libipw_freq_to_channel(struct libipw_device *ieee, u32 freq);
 
1056
extern u8 libipw_get_channel_flags(struct libipw_device *ieee,
 
1057
                                      u8 channel);
 
1058
extern const struct libipw_channel *libipw_get_channel(struct
 
1059
                                                             libipw_device
 
1060
                                                             *ieee, u8 channel);
 
1061
extern u32 libipw_channel_to_freq(struct libipw_device * ieee,
 
1062
                                      u8 channel);
 
1063
 
 
1064
/* libipw_wx.c */
 
1065
extern int libipw_wx_get_scan(struct libipw_device *ieee,
 
1066
                                 struct iw_request_info *info,
 
1067
                                 union iwreq_data *wrqu, char *key);
 
1068
extern int libipw_wx_set_encode(struct libipw_device *ieee,
 
1069
                                   struct iw_request_info *info,
 
1070
                                   union iwreq_data *wrqu, char *key);
 
1071
extern int libipw_wx_get_encode(struct libipw_device *ieee,
 
1072
                                   struct iw_request_info *info,
 
1073
                                   union iwreq_data *wrqu, char *key);
 
1074
extern int libipw_wx_set_encodeext(struct libipw_device *ieee,
 
1075
                                      struct iw_request_info *info,
 
1076
                                      union iwreq_data *wrqu, char *extra);
 
1077
extern int libipw_wx_get_encodeext(struct libipw_device *ieee,
 
1078
                                      struct iw_request_info *info,
 
1079
                                      union iwreq_data *wrqu, char *extra);
 
1080
 
 
1081
static inline void libipw_increment_scans(struct libipw_device *ieee)
 
1082
{
 
1083
        ieee->scans++;
 
1084
}
 
1085
 
 
1086
static inline int libipw_get_scans(struct libipw_device *ieee)
 
1087
{
 
1088
        return ieee->scans;
 
1089
}
 
1090
 
 
1091
#endif                          /* LIBIPW_H */