diff options
Diffstat (limited to 'include/net/ieee80211.h')
-rw-r--r-- | include/net/ieee80211.h | 525 |
1 files changed, 402 insertions, 123 deletions
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index dc36b1be6745..5e38dca1d082 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -11,19 +11,26 @@ | |||
11 | * | 11 | * |
12 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos | 12 | * Adaption to a generic IEEE 802.11 stack by James Ketrenos |
13 | * <jketreno@linux.intel.com> | 13 | * <jketreno@linux.intel.com> |
14 | * Copyright (c) 2004, Intel Corporation | 14 | * Copyright (c) 2004-2005, Intel Corporation |
15 | * | 15 | * |
16 | * This program is free software; you can redistribute it and/or modify | 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 | 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 | 18 | * published by the Free Software Foundation. See README and COPYING for |
19 | * more details. | 19 | * more details. |
20 | * | ||
21 | * API Version History | ||
22 | * 1.0.x -- Initial version | ||
23 | * 1.1.x -- Added radiotap, QoS, TIM, ieee80211_geo APIs, | ||
24 | * various structure changes, and crypto API init method | ||
20 | */ | 25 | */ |
21 | #ifndef IEEE80211_H | 26 | #ifndef IEEE80211_H |
22 | #define IEEE80211_H | 27 | #define IEEE80211_H |
23 | #include <linux/if_ether.h> /* ETH_ALEN */ | 28 | #include <linux/if_ether.h> /* ETH_ALEN */ |
24 | #include <linux/kernel.h> /* ARRAY_SIZE */ | 29 | #include <linux/kernel.h> /* ARRAY_SIZE */ |
25 | #include <linux/wireless.h> | 30 | #include <linux/wireless.h> |
26 | 31 | ||
32 | #define IEEE80211_VERSION "git-1.1.6" | ||
33 | |||
27 | #define IEEE80211_DATA_LEN 2304 | 34 | #define IEEE80211_DATA_LEN 2304 |
28 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | 35 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
29 | 6.2.1.1.2. | 36 | 6.2.1.1.2. |
@@ -33,34 +40,13 @@ | |||
33 | represents the 2304 bytes of real data, plus a possible 8 bytes of | 40 | represents the 2304 bytes of real data, plus a possible 8 bytes of |
34 | WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ | 41 | WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ |
35 | 42 | ||
36 | |||
37 | #define IEEE80211_HLEN 30 | ||
38 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
39 | |||
40 | struct ieee80211_hdr { | ||
41 | __le16 frame_ctl; | ||
42 | __le16 duration_id; | ||
43 | u8 addr1[ETH_ALEN]; | ||
44 | u8 addr2[ETH_ALEN]; | ||
45 | u8 addr3[ETH_ALEN]; | ||
46 | __le16 seq_ctl; | ||
47 | u8 addr4[ETH_ALEN]; | ||
48 | } __attribute__ ((packed)); | ||
49 | |||
50 | struct ieee80211_hdr_3addr { | ||
51 | __le16 frame_ctl; | ||
52 | __le16 duration_id; | ||
53 | u8 addr1[ETH_ALEN]; | ||
54 | u8 addr2[ETH_ALEN]; | ||
55 | u8 addr3[ETH_ALEN]; | ||
56 | __le16 seq_ctl; | ||
57 | } __attribute__ ((packed)); | ||
58 | |||
59 | #define IEEE80211_1ADDR_LEN 10 | 43 | #define IEEE80211_1ADDR_LEN 10 |
60 | #define IEEE80211_2ADDR_LEN 16 | 44 | #define IEEE80211_2ADDR_LEN 16 |
61 | #define IEEE80211_3ADDR_LEN 24 | 45 | #define IEEE80211_3ADDR_LEN 24 |
62 | #define IEEE80211_4ADDR_LEN 30 | 46 | #define IEEE80211_4ADDR_LEN 30 |
63 | #define IEEE80211_FCS_LEN 4 | 47 | #define IEEE80211_FCS_LEN 4 |
48 | #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) | ||
49 | #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) | ||
64 | 50 | ||
65 | #define MIN_FRAG_THRESHOLD 256U | 51 | #define MIN_FRAG_THRESHOLD 256U |
66 | #define MAX_FRAG_THRESHOLD 2346U | 52 | #define MAX_FRAG_THRESHOLD 2346U |
@@ -113,11 +99,11 @@ struct ieee80211_hdr_3addr { | |||
113 | #define IEEE80211_STYPE_CFACK 0x0050 | 99 | #define IEEE80211_STYPE_CFACK 0x0050 |
114 | #define IEEE80211_STYPE_CFPOLL 0x0060 | 100 | #define IEEE80211_STYPE_CFPOLL 0x0060 |
115 | #define IEEE80211_STYPE_CFACKPOLL 0x0070 | 101 | #define IEEE80211_STYPE_CFACKPOLL 0x0070 |
102 | #define IEEE80211_STYPE_QOS_DATA 0x0080 | ||
116 | 103 | ||
117 | #define IEEE80211_SCTL_FRAG 0x000F | 104 | #define IEEE80211_SCTL_FRAG 0x000F |
118 | #define IEEE80211_SCTL_SEQ 0xFFF0 | 105 | #define IEEE80211_SCTL_SEQ 0xFFF0 |
119 | 106 | ||
120 | |||
121 | /* debug macros */ | 107 | /* debug macros */ |
122 | 108 | ||
123 | #ifdef CONFIG_IEEE80211_DEBUG | 109 | #ifdef CONFIG_IEEE80211_DEBUG |
@@ -128,8 +114,7 @@ do { if (ieee80211_debug_level & (level)) \ | |||
128 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) | 114 | in_interrupt() ? 'I' : 'U', __FUNCTION__ , ## args); } while (0) |
129 | #else | 115 | #else |
130 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) | 116 | #define IEEE80211_DEBUG(level, fmt, args...) do {} while (0) |
131 | #endif /* CONFIG_IEEE80211_DEBUG */ | 117 | #endif /* CONFIG_IEEE80211_DEBUG */ |
132 | |||
133 | 118 | ||
134 | /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ | 119 | /* debug macros not dependent on CONFIG_IEEE80211_DEBUG */ |
135 | 120 | ||
@@ -140,7 +125,6 @@ do { if (ieee80211_debug_level & (level)) \ | |||
140 | * messages. It should never be used for passing essid to user space. */ | 125 | * messages. It should never be used for passing essid to user space. */ |
141 | const char *escape_essid(const char *essid, u8 essid_len); | 126 | const char *escape_essid(const char *essid, u8 essid_len); |
142 | 127 | ||
143 | |||
144 | /* | 128 | /* |
145 | * To use the debug system: | 129 | * To use the debug system: |
146 | * | 130 | * |
@@ -177,6 +161,7 @@ const char *escape_essid(const char *essid, u8 essid_len); | |||
177 | 161 | ||
178 | #define IEEE80211_DL_TX (1<<8) | 162 | #define IEEE80211_DL_TX (1<<8) |
179 | #define IEEE80211_DL_RX (1<<9) | 163 | #define IEEE80211_DL_RX (1<<9) |
164 | #define IEEE80211_DL_QOS (1<<31) | ||
180 | 165 | ||
181 | #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) | 166 | #define IEEE80211_ERROR(f, a...) printk(KERN_ERR "ieee80211: " f, ## a) |
182 | #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) | 167 | #define IEEE80211_WARNING(f, a...) printk(KERN_WARNING "ieee80211: " f, ## a) |
@@ -190,9 +175,10 @@ const char *escape_essid(const char *essid, u8 essid_len); | |||
190 | #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) | 175 | #define IEEE80211_DEBUG_DROP(f, a...) IEEE80211_DEBUG(IEEE80211_DL_DROP, f, ## a) |
191 | #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) | 176 | #define IEEE80211_DEBUG_TX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_TX, f, ## a) |
192 | #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) | 177 | #define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) |
178 | #define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) | ||
193 | #include <linux/netdevice.h> | 179 | #include <linux/netdevice.h> |
194 | #include <linux/wireless.h> | 180 | #include <linux/wireless.h> |
195 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ | 181 | #include <linux/if_arp.h> /* ARPHRD_ETHER */ |
196 | 182 | ||
197 | #ifndef WIRELESS_SPY | 183 | #ifndef WIRELESS_SPY |
198 | #define WIRELESS_SPY /* enable iwspy support */ | 184 | #define WIRELESS_SPY /* enable iwspy support */ |
@@ -200,10 +186,10 @@ const char *escape_essid(const char *essid, u8 essid_len); | |||
200 | #include <net/iw_handler.h> /* new driver API */ | 186 | #include <net/iw_handler.h> /* new driver API */ |
201 | 187 | ||
202 | #ifndef ETH_P_PAE | 188 | #ifndef ETH_P_PAE |
203 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ | 189 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ |
204 | #endif /* ETH_P_PAE */ | 190 | #endif /* ETH_P_PAE */ |
205 | 191 | ||
206 | #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ | 192 | #define ETH_P_PREAUTH 0x88C7 /* IEEE 802.11i pre-authentication */ |
207 | 193 | ||
208 | #ifndef ETH_P_80211_RAW | 194 | #ifndef ETH_P_80211_RAW |
209 | #define ETH_P_80211_RAW (ETH_P_ECONET + 1) | 195 | #define ETH_P_80211_RAW (ETH_P_ECONET + 1) |
@@ -215,10 +201,10 @@ const char *escape_essid(const char *essid, u8 essid_len); | |||
215 | 201 | ||
216 | struct ieee80211_snap_hdr { | 202 | struct ieee80211_snap_hdr { |
217 | 203 | ||
218 | u8 dsap; /* always 0xAA */ | 204 | u8 dsap; /* always 0xAA */ |
219 | u8 ssap; /* always 0xAA */ | 205 | u8 ssap; /* always 0xAA */ |
220 | u8 ctrl; /* always 0x03 */ | 206 | u8 ctrl; /* always 0x03 */ |
221 | u8 oui[P80211_OUI_LEN]; /* organizational universal id */ | 207 | u8 oui[P80211_OUI_LEN]; /* organizational universal id */ |
222 | 208 | ||
223 | } __attribute__ ((packed)); | 209 | } __attribute__ ((packed)); |
224 | 210 | ||
@@ -246,8 +232,9 @@ struct ieee80211_snap_hdr { | |||
246 | #define WLAN_CAPABILITY_PBCC (1<<6) | 232 | #define WLAN_CAPABILITY_PBCC (1<<6) |
247 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) | 233 | #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7) |
248 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) | 234 | #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8) |
235 | #define WLAN_CAPABILITY_QOS (1<<9) | ||
249 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) | 236 | #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10) |
250 | #define WLAN_CAPABILITY_OSSS_OFDM (1<<13) | 237 | #define WLAN_CAPABILITY_DSSS_OFDM (1<<13) |
251 | 238 | ||
252 | /* Status codes */ | 239 | /* Status codes */ |
253 | enum ieee80211_statuscode { | 240 | enum ieee80211_statuscode { |
@@ -312,14 +299,12 @@ enum ieee80211_reasoncode { | |||
312 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, | 299 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, |
313 | }; | 300 | }; |
314 | 301 | ||
315 | |||
316 | #define IEEE80211_STATMASK_SIGNAL (1<<0) | 302 | #define IEEE80211_STATMASK_SIGNAL (1<<0) |
317 | #define IEEE80211_STATMASK_RSSI (1<<1) | 303 | #define IEEE80211_STATMASK_RSSI (1<<1) |
318 | #define IEEE80211_STATMASK_NOISE (1<<2) | 304 | #define IEEE80211_STATMASK_NOISE (1<<2) |
319 | #define IEEE80211_STATMASK_RATE (1<<3) | 305 | #define IEEE80211_STATMASK_RATE (1<<3) |
320 | #define IEEE80211_STATMASK_WEMASK 0x7 | 306 | #define IEEE80211_STATMASK_WEMASK 0x7 |
321 | 307 | ||
322 | |||
323 | #define IEEE80211_CCK_MODULATION (1<<0) | 308 | #define IEEE80211_CCK_MODULATION (1<<0) |
324 | #define IEEE80211_OFDM_MODULATION (1<<1) | 309 | #define IEEE80211_OFDM_MODULATION (1<<1) |
325 | 310 | ||
@@ -377,9 +362,6 @@ enum ieee80211_reasoncode { | |||
377 | #define IEEE80211_NUM_CCK_RATES 4 | 362 | #define IEEE80211_NUM_CCK_RATES 4 |
378 | #define IEEE80211_OFDM_SHIFT_MASK_A 4 | 363 | #define IEEE80211_OFDM_SHIFT_MASK_A 4 |
379 | 364 | ||
380 | |||
381 | |||
382 | |||
383 | /* NOTE: This data is for statistical purposes; not all hardware provides this | 365 | /* NOTE: This data is for statistical purposes; not all hardware provides this |
384 | * information for frames received. Not setting these will not cause | 366 | * information for frames received. Not setting these will not cause |
385 | * any adverse affects. */ | 367 | * any adverse affects. */ |
@@ -388,7 +370,7 @@ struct ieee80211_rx_stats { | |||
388 | s8 rssi; | 370 | s8 rssi; |
389 | u8 signal; | 371 | u8 signal; |
390 | u8 noise; | 372 | u8 noise; |
391 | u16 rate; /* in 100 kbps */ | 373 | u16 rate; /* in 100 kbps */ |
392 | u8 received_channel; | 374 | u8 received_channel; |
393 | u8 control; | 375 | u8 control; |
394 | u8 mask; | 376 | u8 mask; |
@@ -439,38 +421,44 @@ struct ieee80211_device; | |||
439 | 421 | ||
440 | #include "ieee80211_crypt.h" | 422 | #include "ieee80211_crypt.h" |
441 | 423 | ||
442 | #define SEC_KEY_1 (1<<0) | 424 | #define SEC_KEY_1 (1<<0) |
443 | #define SEC_KEY_2 (1<<1) | 425 | #define SEC_KEY_2 (1<<1) |
444 | #define SEC_KEY_3 (1<<2) | 426 | #define SEC_KEY_3 (1<<2) |
445 | #define SEC_KEY_4 (1<<3) | 427 | #define SEC_KEY_4 (1<<3) |
446 | #define SEC_ACTIVE_KEY (1<<4) | 428 | #define SEC_ACTIVE_KEY (1<<4) |
447 | #define SEC_AUTH_MODE (1<<5) | 429 | #define SEC_AUTH_MODE (1<<5) |
448 | #define SEC_UNICAST_GROUP (1<<6) | 430 | #define SEC_UNICAST_GROUP (1<<6) |
449 | #define SEC_LEVEL (1<<7) | 431 | #define SEC_LEVEL (1<<7) |
450 | #define SEC_ENABLED (1<<8) | 432 | #define SEC_ENABLED (1<<8) |
451 | 433 | #define SEC_ENCRYPT (1<<9) | |
452 | #define SEC_LEVEL_0 0 /* None */ | 434 | |
453 | #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ | 435 | #define SEC_LEVEL_0 0 /* None */ |
454 | #define SEC_LEVEL_2 2 /* Level 1 + TKIP */ | 436 | #define SEC_LEVEL_1 1 /* WEP 40 and 104 bit */ |
455 | #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ | 437 | #define SEC_LEVEL_2 2 /* Level 1 + TKIP */ |
456 | #define SEC_LEVEL_3 4 /* Level 2 + CCMP */ | 438 | #define SEC_LEVEL_2_CKIP 3 /* Level 1 + CKIP */ |
457 | 439 | #define SEC_LEVEL_3 4 /* Level 2 + CCMP */ | |
458 | #define WEP_KEYS 4 | 440 | |
459 | #define WEP_KEY_LEN 13 | 441 | #define SEC_ALG_NONE 0 |
442 | #define SEC_ALG_WEP 1 | ||
443 | #define SEC_ALG_TKIP 2 | ||
444 | #define SEC_ALG_CCMP 3 | ||
445 | |||
446 | #define WEP_KEYS 4 | ||
447 | #define WEP_KEY_LEN 13 | ||
448 | #define SCM_KEY_LEN 32 | ||
449 | #define SCM_TEMPORAL_KEY_LENGTH 16 | ||
460 | 450 | ||
461 | struct ieee80211_security { | 451 | struct ieee80211_security { |
462 | u16 active_key:2, | 452 | u16 active_key:2, |
463 | enabled:1, | 453 | enabled:1, |
464 | auth_mode:2, | 454 | auth_mode:2, auth_algo:4, unicast_uses_group:1, encrypt:1; |
465 | auth_algo:4, | 455 | u8 encode_alg[WEP_KEYS]; |
466 | unicast_uses_group:1; | ||
467 | u8 key_sizes[WEP_KEYS]; | 456 | u8 key_sizes[WEP_KEYS]; |
468 | u8 keys[WEP_KEYS][WEP_KEY_LEN]; | 457 | u8 keys[WEP_KEYS][SCM_KEY_LEN]; |
469 | u8 level; | 458 | u8 level; |
470 | u16 flags; | 459 | u16 flags; |
471 | } __attribute__ ((packed)); | 460 | } __attribute__ ((packed)); |
472 | 461 | ||
473 | |||
474 | /* | 462 | /* |
475 | 463 | ||
476 | 802.11 data frame from AP | 464 | 802.11 data frame from AP |
@@ -494,7 +482,7 @@ enum ieee80211_mfie { | |||
494 | MFIE_TYPE_RATES = 1, | 482 | MFIE_TYPE_RATES = 1, |
495 | MFIE_TYPE_FH_SET = 2, | 483 | MFIE_TYPE_FH_SET = 2, |
496 | MFIE_TYPE_DS_SET = 3, | 484 | MFIE_TYPE_DS_SET = 3, |
497 | MFIE_TYPE_CF_SET = 4, | 485 | MFIE_TYPE_CF_SET = 4, |
498 | MFIE_TYPE_TIM = 5, | 486 | MFIE_TYPE_TIM = 5, |
499 | MFIE_TYPE_IBSS_SET = 6, | 487 | MFIE_TYPE_IBSS_SET = 6, |
500 | MFIE_TYPE_COUNTRY = 7, | 488 | MFIE_TYPE_COUNTRY = 7, |
@@ -516,11 +504,75 @@ enum ieee80211_mfie { | |||
516 | MFIE_TYPE_RSN = 48, | 504 | MFIE_TYPE_RSN = 48, |
517 | MFIE_TYPE_RATES_EX = 50, | 505 | MFIE_TYPE_RATES_EX = 50, |
518 | MFIE_TYPE_GENERIC = 221, | 506 | MFIE_TYPE_GENERIC = 221, |
507 | MFIE_TYPE_QOS_PARAMETER = 222, | ||
519 | }; | 508 | }; |
520 | 509 | ||
521 | struct ieee80211_info_element_hdr { | 510 | /* Minimal header; can be used for passing 802.11 frames with sufficient |
522 | u8 id; | 511 | * information to determine what type of underlying data type is actually |
523 | u8 len; | 512 | * stored in the data. */ |
513 | struct ieee80211_hdr { | ||
514 | __le16 frame_ctl; | ||
515 | __le16 duration_id; | ||
516 | u8 payload[0]; | ||
517 | } __attribute__ ((packed)); | ||
518 | |||
519 | struct ieee80211_hdr_1addr { | ||
520 | __le16 frame_ctl; | ||
521 | __le16 duration_id; | ||
522 | u8 addr1[ETH_ALEN]; | ||
523 | u8 payload[0]; | ||
524 | } __attribute__ ((packed)); | ||
525 | |||
526 | struct ieee80211_hdr_2addr { | ||
527 | __le16 frame_ctl; | ||
528 | __le16 duration_id; | ||
529 | u8 addr1[ETH_ALEN]; | ||
530 | u8 addr2[ETH_ALEN]; | ||
531 | u8 payload[0]; | ||
532 | } __attribute__ ((packed)); | ||
533 | |||
534 | struct ieee80211_hdr_3addr { | ||
535 | __le16 frame_ctl; | ||
536 | __le16 duration_id; | ||
537 | u8 addr1[ETH_ALEN]; | ||
538 | u8 addr2[ETH_ALEN]; | ||
539 | u8 addr3[ETH_ALEN]; | ||
540 | __le16 seq_ctl; | ||
541 | u8 payload[0]; | ||
542 | } __attribute__ ((packed)); | ||
543 | |||
544 | struct ieee80211_hdr_4addr { | ||
545 | __le16 frame_ctl; | ||
546 | __le16 duration_id; | ||
547 | u8 addr1[ETH_ALEN]; | ||
548 | u8 addr2[ETH_ALEN]; | ||
549 | u8 addr3[ETH_ALEN]; | ||
550 | __le16 seq_ctl; | ||
551 | u8 addr4[ETH_ALEN]; | ||
552 | u8 payload[0]; | ||
553 | } __attribute__ ((packed)); | ||
554 | |||
555 | struct ieee80211_hdr_3addrqos { | ||
556 | __le16 frame_ctl; | ||
557 | __le16 duration_id; | ||
558 | u8 addr1[ETH_ALEN]; | ||
559 | u8 addr2[ETH_ALEN]; | ||
560 | u8 addr3[ETH_ALEN]; | ||
561 | __le16 seq_ctl; | ||
562 | u8 payload[0]; | ||
563 | __le16 qos_ctl; | ||
564 | } __attribute__ ((packed)); | ||
565 | |||
566 | struct ieee80211_hdr_4addrqos { | ||
567 | __le16 frame_ctl; | ||
568 | __le16 duration_id; | ||
569 | u8 addr1[ETH_ALEN]; | ||
570 | u8 addr2[ETH_ALEN]; | ||
571 | u8 addr3[ETH_ALEN]; | ||
572 | __le16 seq_ctl; | ||
573 | u8 addr4[ETH_ALEN]; | ||
574 | u8 payload[0]; | ||
575 | __le16 qos_ctl; | ||
524 | } __attribute__ ((packed)); | 576 | } __attribute__ ((packed)); |
525 | 577 | ||
526 | struct ieee80211_info_element { | 578 | struct ieee80211_info_element { |
@@ -546,49 +598,77 @@ struct ieee80211_info_element { | |||
546 | u16 status; | 598 | u16 status; |
547 | */ | 599 | */ |
548 | 600 | ||
549 | struct ieee80211_authentication { | 601 | struct ieee80211_auth { |
550 | struct ieee80211_hdr_3addr header; | 602 | struct ieee80211_hdr_3addr header; |
551 | __le16 algorithm; | 603 | __le16 algorithm; |
552 | __le16 transaction; | 604 | __le16 transaction; |
553 | __le16 status; | 605 | __le16 status; |
554 | struct ieee80211_info_element info_element; | 606 | /* challenge */ |
607 | struct ieee80211_info_element info_element[0]; | ||
555 | } __attribute__ ((packed)); | 608 | } __attribute__ ((packed)); |
556 | 609 | ||
610 | struct ieee80211_disassoc { | ||
611 | struct ieee80211_hdr_3addr header; | ||
612 | __le16 reason; | ||
613 | } __attribute__ ((packed)); | ||
614 | |||
615 | /* Alias deauth for disassoc */ | ||
616 | #define ieee80211_deauth ieee80211_disassoc | ||
617 | |||
618 | struct ieee80211_probe_request { | ||
619 | struct ieee80211_hdr_3addr header; | ||
620 | /* SSID, supported rates */ | ||
621 | struct ieee80211_info_element info_element[0]; | ||
622 | } __attribute__ ((packed)); | ||
557 | 623 | ||
558 | struct ieee80211_probe_response { | 624 | struct ieee80211_probe_response { |
559 | struct ieee80211_hdr_3addr header; | 625 | struct ieee80211_hdr_3addr header; |
560 | u32 time_stamp[2]; | 626 | u32 time_stamp[2]; |
561 | __le16 beacon_interval; | 627 | __le16 beacon_interval; |
562 | __le16 capability; | 628 | __le16 capability; |
563 | struct ieee80211_info_element info_element; | 629 | /* SSID, supported rates, FH params, DS params, |
630 | * CF params, IBSS params, TIM (if beacon), RSN */ | ||
631 | struct ieee80211_info_element info_element[0]; | ||
564 | } __attribute__ ((packed)); | 632 | } __attribute__ ((packed)); |
565 | 633 | ||
566 | struct ieee80211_assoc_request_frame { | 634 | /* Alias beacon for probe_response */ |
635 | #define ieee80211_beacon ieee80211_probe_response | ||
636 | |||
637 | struct ieee80211_assoc_request { | ||
638 | struct ieee80211_hdr_3addr header; | ||
639 | __le16 capability; | ||
640 | __le16 listen_interval; | ||
641 | /* SSID, supported rates, RSN */ | ||
642 | struct ieee80211_info_element info_element[0]; | ||
643 | } __attribute__ ((packed)); | ||
644 | |||
645 | struct ieee80211_reassoc_request { | ||
646 | struct ieee80211_hdr_3addr header; | ||
567 | __le16 capability; | 647 | __le16 capability; |
568 | __le16 listen_interval; | 648 | __le16 listen_interval; |
569 | u8 current_ap[ETH_ALEN]; | 649 | u8 current_ap[ETH_ALEN]; |
570 | struct ieee80211_info_element info_element; | 650 | struct ieee80211_info_element info_element[0]; |
571 | } __attribute__ ((packed)); | 651 | } __attribute__ ((packed)); |
572 | 652 | ||
573 | struct ieee80211_assoc_response_frame { | 653 | struct ieee80211_assoc_response { |
574 | struct ieee80211_hdr_3addr header; | 654 | struct ieee80211_hdr_3addr header; |
575 | __le16 capability; | 655 | __le16 capability; |
576 | __le16 status; | 656 | __le16 status; |
577 | __le16 aid; | 657 | __le16 aid; |
578 | struct ieee80211_info_element info_element; /* supported rates */ | 658 | /* supported rates */ |
659 | struct ieee80211_info_element info_element[0]; | ||
579 | } __attribute__ ((packed)); | 660 | } __attribute__ ((packed)); |
580 | 661 | ||
581 | |||
582 | struct ieee80211_txb { | 662 | struct ieee80211_txb { |
583 | u8 nr_frags; | 663 | u8 nr_frags; |
584 | u8 encrypted; | 664 | u8 encrypted; |
585 | u16 reserved; | 665 | u8 rts_included; |
586 | u16 frag_size; | 666 | u8 reserved; |
587 | u16 payload_size; | 667 | __le16 frag_size; |
668 | __le16 payload_size; | ||
588 | struct sk_buff *fragments[0]; | 669 | struct sk_buff *fragments[0]; |
589 | }; | 670 | }; |
590 | 671 | ||
591 | |||
592 | /* SWEEP TABLE ENTRIES NUMBER */ | 672 | /* SWEEP TABLE ENTRIES NUMBER */ |
593 | #define MAX_SWEEP_TAB_ENTRIES 42 | 673 | #define MAX_SWEEP_TAB_ENTRIES 42 |
594 | #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 | 674 | #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET 7 |
@@ -604,9 +684,68 @@ struct ieee80211_txb { | |||
604 | 684 | ||
605 | #define MAX_WPA_IE_LEN 64 | 685 | #define MAX_WPA_IE_LEN 64 |
606 | 686 | ||
607 | #define NETWORK_EMPTY_ESSID (1<<0) | 687 | #define NETWORK_EMPTY_ESSID (1<<0) |
608 | #define NETWORK_HAS_OFDM (1<<1) | 688 | #define NETWORK_HAS_OFDM (1<<1) |
609 | #define NETWORK_HAS_CCK (1<<2) | 689 | #define NETWORK_HAS_CCK (1<<2) |
690 | |||
691 | /* QoS structure */ | ||
692 | #define NETWORK_HAS_QOS_PARAMETERS (1<<3) | ||
693 | #define NETWORK_HAS_QOS_INFORMATION (1<<4) | ||
694 | #define NETWORK_HAS_QOS_MASK (NETWORK_HAS_QOS_PARAMETERS | NETWORK_HAS_QOS_INFORMATION) | ||
695 | |||
696 | #define QOS_QUEUE_NUM 4 | ||
697 | #define QOS_OUI_LEN 3 | ||
698 | #define QOS_OUI_TYPE 2 | ||
699 | #define QOS_ELEMENT_ID 221 | ||
700 | #define QOS_OUI_INFO_SUB_TYPE 0 | ||
701 | #define QOS_OUI_PARAM_SUB_TYPE 1 | ||
702 | #define QOS_VERSION_1 1 | ||
703 | #define QOS_AIFSN_MIN_VALUE 2 | ||
704 | |||
705 | struct ieee80211_qos_information_element { | ||
706 | u8 elementID; | ||
707 | u8 length; | ||
708 | u8 qui[QOS_OUI_LEN]; | ||
709 | u8 qui_type; | ||
710 | u8 qui_subtype; | ||
711 | u8 version; | ||
712 | u8 ac_info; | ||
713 | } __attribute__ ((packed)); | ||
714 | |||
715 | struct ieee80211_qos_ac_parameter { | ||
716 | u8 aci_aifsn; | ||
717 | u8 ecw_min_max; | ||
718 | __le16 tx_op_limit; | ||
719 | } __attribute__ ((packed)); | ||
720 | |||
721 | struct ieee80211_qos_parameter_info { | ||
722 | struct ieee80211_qos_information_element info_element; | ||
723 | u8 reserved; | ||
724 | struct ieee80211_qos_ac_parameter ac_params_record[QOS_QUEUE_NUM]; | ||
725 | } __attribute__ ((packed)); | ||
726 | |||
727 | struct ieee80211_qos_parameters { | ||
728 | __le16 cw_min[QOS_QUEUE_NUM]; | ||
729 | __le16 cw_max[QOS_QUEUE_NUM]; | ||
730 | u8 aifs[QOS_QUEUE_NUM]; | ||
731 | u8 flag[QOS_QUEUE_NUM]; | ||
732 | __le16 tx_op_limit[QOS_QUEUE_NUM]; | ||
733 | } __attribute__ ((packed)); | ||
734 | |||
735 | struct ieee80211_qos_data { | ||
736 | struct ieee80211_qos_parameters parameters; | ||
737 | int active; | ||
738 | int supported; | ||
739 | u8 param_count; | ||
740 | u8 old_param_count; | ||
741 | }; | ||
742 | |||
743 | struct ieee80211_tim_parameters { | ||
744 | u8 tim_count; | ||
745 | u8 tim_period; | ||
746 | } __attribute__ ((packed)); | ||
747 | |||
748 | /*******************************************************/ | ||
610 | 749 | ||
611 | struct ieee80211_network { | 750 | struct ieee80211_network { |
612 | /* These entries are used to identify a unique network */ | 751 | /* These entries are used to identify a unique network */ |
@@ -616,6 +755,8 @@ struct ieee80211_network { | |||
616 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; | 755 | u8 ssid[IW_ESSID_MAX_SIZE + 1]; |
617 | u8 ssid_len; | 756 | u8 ssid_len; |
618 | 757 | ||
758 | struct ieee80211_qos_data qos_data; | ||
759 | |||
619 | /* These are network statistics */ | 760 | /* These are network statistics */ |
620 | struct ieee80211_rx_stats stats; | 761 | struct ieee80211_rx_stats stats; |
621 | u16 capability; | 762 | u16 capability; |
@@ -631,10 +772,12 @@ struct ieee80211_network { | |||
631 | u16 beacon_interval; | 772 | u16 beacon_interval; |
632 | u16 listen_interval; | 773 | u16 listen_interval; |
633 | u16 atim_window; | 774 | u16 atim_window; |
775 | u8 erp_value; | ||
634 | u8 wpa_ie[MAX_WPA_IE_LEN]; | 776 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
635 | size_t wpa_ie_len; | 777 | size_t wpa_ie_len; |
636 | u8 rsn_ie[MAX_WPA_IE_LEN]; | 778 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
637 | size_t rsn_ie_len; | 779 | size_t rsn_ie_len; |
780 | struct ieee80211_tim_parameters tim; | ||
638 | struct list_head list; | 781 | struct list_head list; |
639 | }; | 782 | }; |
640 | 783 | ||
@@ -651,17 +794,52 @@ enum ieee80211_state { | |||
651 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) | 794 | #define DEFAULT_MAX_SCAN_AGE (15 * HZ) |
652 | #define DEFAULT_FTS 2346 | 795 | #define DEFAULT_FTS 2346 |
653 | 796 | ||
654 | |||
655 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) | 797 | #define CFG_IEEE80211_RESERVE_FCS (1<<0) |
656 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) | 798 | #define CFG_IEEE80211_COMPUTE_FCS (1<<1) |
799 | #define CFG_IEEE80211_RTS (1<<2) | ||
800 | |||
801 | #define IEEE80211_24GHZ_MIN_CHANNEL 1 | ||
802 | #define IEEE80211_24GHZ_MAX_CHANNEL 14 | ||
803 | #define IEEE80211_24GHZ_CHANNELS 14 | ||
804 | |||
805 | #define IEEE80211_52GHZ_MIN_CHANNEL 36 | ||
806 | #define IEEE80211_52GHZ_MAX_CHANNEL 165 | ||
807 | #define IEEE80211_52GHZ_CHANNELS 32 | ||
808 | |||
809 | enum { | ||
810 | IEEE80211_CH_PASSIVE_ONLY = (1 << 0), | ||
811 | IEEE80211_CH_B_ONLY = (1 << 2), | ||
812 | IEEE80211_CH_NO_IBSS = (1 << 3), | ||
813 | IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), | ||
814 | IEEE80211_CH_RADAR_DETECT = (1 << 5), | ||
815 | IEEE80211_CH_INVALID = (1 << 6), | ||
816 | }; | ||
817 | |||
818 | struct ieee80211_channel { | ||
819 | u32 freq; | ||
820 | u8 channel; | ||
821 | u8 flags; | ||
822 | u8 max_power; | ||
823 | }; | ||
824 | |||
825 | struct ieee80211_geo { | ||
826 | u8 name[4]; | ||
827 | u8 bg_channels; | ||
828 | u8 a_channels; | ||
829 | struct ieee80211_channel bg[IEEE80211_24GHZ_CHANNELS]; | ||
830 | struct ieee80211_channel a[IEEE80211_52GHZ_CHANNELS]; | ||
831 | }; | ||
657 | 832 | ||
658 | struct ieee80211_device { | 833 | struct ieee80211_device { |
659 | struct net_device *dev; | 834 | struct net_device *dev; |
835 | struct ieee80211_security sec; | ||
660 | 836 | ||
661 | /* Bookkeeping structures */ | 837 | /* Bookkeeping structures */ |
662 | struct net_device_stats stats; | 838 | struct net_device_stats stats; |
663 | struct ieee80211_stats ieee_stats; | 839 | struct ieee80211_stats ieee_stats; |
664 | 840 | ||
841 | struct ieee80211_geo geo; | ||
842 | |||
665 | /* Probe / Beacon management */ | 843 | /* Probe / Beacon management */ |
666 | struct list_head network_free_list; | 844 | struct list_head network_free_list; |
667 | struct list_head network_list; | 845 | struct list_head network_list; |
@@ -669,62 +847,102 @@ struct ieee80211_device { | |||
669 | int scans; | 847 | int scans; |
670 | int scan_age; | 848 | int scan_age; |
671 | 849 | ||
672 | int iw_mode; /* operating mode (IW_MODE_*) */ | 850 | int iw_mode; /* operating mode (IW_MODE_*) */ |
851 | struct iw_spy_data spy_data; /* iwspy support */ | ||
673 | 852 | ||
674 | spinlock_t lock; | 853 | spinlock_t lock; |
675 | 854 | ||
676 | int tx_headroom; /* Set to size of any additional room needed at front | 855 | int tx_headroom; /* Set to size of any additional room needed at front |
677 | * of allocated Tx SKBs */ | 856 | * of allocated Tx SKBs */ |
678 | u32 config; | 857 | u32 config; |
679 | 858 | ||
680 | /* WEP and other encryption related settings at the device level */ | 859 | /* WEP and other encryption related settings at the device level */ |
681 | int open_wep; /* Set to 1 to allow unencrypted frames */ | 860 | int open_wep; /* Set to 1 to allow unencrypted frames */ |
682 | 861 | ||
683 | int reset_on_keychange; /* Set to 1 if the HW needs to be reset on | 862 | int reset_on_keychange; /* Set to 1 if the HW needs to be reset on |
684 | * WEP key changes */ | 863 | * WEP key changes */ |
685 | 864 | ||
686 | /* If the host performs {en,de}cryption, then set to 1 */ | 865 | /* If the host performs {en,de}cryption, then set to 1 */ |
687 | int host_encrypt; | 866 | int host_encrypt; |
867 | int host_encrypt_msdu; | ||
688 | int host_decrypt; | 868 | int host_decrypt; |
689 | int ieee802_1x; /* is IEEE 802.1X used */ | 869 | /* host performs multicast decryption */ |
870 | int host_mc_decrypt; | ||
871 | |||
872 | int host_open_frag; | ||
873 | int host_build_iv; | ||
874 | int ieee802_1x; /* is IEEE 802.1X used */ | ||
690 | 875 | ||
691 | /* WPA data */ | 876 | /* WPA data */ |
692 | int wpa_enabled; | 877 | int wpa_enabled; |
693 | int drop_unencrypted; | 878 | int drop_unencrypted; |
694 | int tkip_countermeasures; | ||
695 | int privacy_invoked; | 879 | int privacy_invoked; |
696 | size_t wpa_ie_len; | 880 | size_t wpa_ie_len; |
697 | u8 *wpa_ie; | 881 | u8 *wpa_ie; |
698 | 882 | ||
699 | struct list_head crypt_deinit_list; | 883 | struct list_head crypt_deinit_list; |
700 | struct ieee80211_crypt_data *crypt[WEP_KEYS]; | 884 | struct ieee80211_crypt_data *crypt[WEP_KEYS]; |
701 | int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ | 885 | int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ |
702 | struct timer_list crypt_deinit_timer; | 886 | struct timer_list crypt_deinit_timer; |
887 | int crypt_quiesced; | ||
703 | 888 | ||
704 | int bcrx_sta_key; /* use individual keys to override default keys even | 889 | int bcrx_sta_key; /* use individual keys to override default keys even |
705 | * with RX of broad/multicast frames */ | 890 | * with RX of broad/multicast frames */ |
706 | 891 | ||
707 | /* Fragmentation structures */ | 892 | /* Fragmentation structures */ |
708 | struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN]; | 893 | struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN]; |
709 | unsigned int frag_next_idx; | 894 | unsigned int frag_next_idx; |
710 | u16 fts; /* Fragmentation Threshold */ | 895 | u16 fts; /* Fragmentation Threshold */ |
896 | u16 rts; /* RTS threshold */ | ||
711 | 897 | ||
712 | /* Association info */ | 898 | /* Association info */ |
713 | u8 bssid[ETH_ALEN]; | 899 | u8 bssid[ETH_ALEN]; |
714 | 900 | ||
715 | enum ieee80211_state state; | 901 | enum ieee80211_state state; |
716 | 902 | ||
717 | int mode; /* A, B, G */ | 903 | int mode; /* A, B, G */ |
718 | int modulation; /* CCK, OFDM */ | 904 | int modulation; /* CCK, OFDM */ |
719 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ | 905 | int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ |
720 | int abg_ture; /* ABG flag */ | 906 | int abg_true; /* ABG flag */ |
907 | |||
908 | int perfect_rssi; | ||
909 | int worst_rssi; | ||
721 | 910 | ||
722 | /* Callback functions */ | 911 | /* Callback functions */ |
723 | void (*set_security)(struct net_device *dev, | 912 | void (*set_security) (struct net_device * dev, |
724 | struct ieee80211_security *sec); | 913 | struct ieee80211_security * sec); |
725 | int (*hard_start_xmit)(struct ieee80211_txb *txb, | 914 | int (*hard_start_xmit) (struct ieee80211_txb * txb, |
726 | struct net_device *dev); | 915 | struct net_device * dev, int pri); |
727 | int (*reset_port)(struct net_device *dev); | 916 | int (*reset_port) (struct net_device * dev); |
917 | int (*is_queue_full) (struct net_device * dev, int pri); | ||
918 | |||
919 | int (*handle_management) (struct net_device * dev, | ||
920 | struct ieee80211_network * network, u16 type); | ||
921 | |||
922 | /* Typical STA methods */ | ||
923 | int (*handle_auth) (struct net_device * dev, | ||
924 | struct ieee80211_auth * auth); | ||
925 | int (*handle_deauth) (struct net_device * dev, | ||
926 | struct ieee80211_auth * auth); | ||
927 | int (*handle_disassoc) (struct net_device * dev, | ||
928 | struct ieee80211_disassoc * assoc); | ||
929 | int (*handle_beacon) (struct net_device * dev, | ||
930 | struct ieee80211_beacon * beacon, | ||
931 | struct ieee80211_network * network); | ||
932 | int (*handle_probe_response) (struct net_device * dev, | ||
933 | struct ieee80211_probe_response * resp, | ||
934 | struct ieee80211_network * network); | ||
935 | int (*handle_probe_request) (struct net_device * dev, | ||
936 | struct ieee80211_probe_request * req, | ||
937 | struct ieee80211_rx_stats * stats); | ||
938 | int (*handle_assoc_response) (struct net_device * dev, | ||
939 | struct ieee80211_assoc_response * resp, | ||
940 | struct ieee80211_network * network); | ||
941 | |||
942 | /* Typical AP methods */ | ||
943 | int (*handle_assoc_request) (struct net_device * dev); | ||
944 | int (*handle_reassoc_request) (struct net_device * dev, | ||
945 | struct ieee80211_reassoc_request * req); | ||
728 | 946 | ||
729 | /* This must be the last item so that it points to the data | 947 | /* This must be the last item so that it points to the data |
730 | * allocated beyond this structure by alloc_ieee80211 */ | 948 | * allocated beyond this structure by alloc_ieee80211 */ |
@@ -736,12 +954,12 @@ struct ieee80211_device { | |||
736 | #define IEEE_G (1<<2) | 954 | #define IEEE_G (1<<2) |
737 | #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) | 955 | #define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G) |
738 | 956 | ||
739 | extern inline void *ieee80211_priv(struct net_device *dev) | 957 | static inline void *ieee80211_priv(struct net_device *dev) |
740 | { | 958 | { |
741 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; | 959 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; |
742 | } | 960 | } |
743 | 961 | ||
744 | extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) | 962 | static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) |
745 | { | 963 | { |
746 | /* Single white space is for Linksys APs */ | 964 | /* Single white space is for Linksys APs */ |
747 | if (essid_len == 1 && essid[0] == ' ') | 965 | if (essid_len == 1 && essid[0] == ' ') |
@@ -757,7 +975,8 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) | |||
757 | return 1; | 975 | return 1; |
758 | } | 976 | } |
759 | 977 | ||
760 | extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) | 978 | static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, |
979 | int mode) | ||
761 | { | 980 | { |
762 | /* | 981 | /* |
763 | * It is possible for both access points and our device to support | 982 | * It is possible for both access points and our device to support |
@@ -783,14 +1002,17 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod | |||
783 | return 0; | 1002 | return 0; |
784 | } | 1003 | } |
785 | 1004 | ||
786 | extern inline int ieee80211_get_hdrlen(u16 fc) | 1005 | static inline int ieee80211_get_hdrlen(u16 fc) |
787 | { | 1006 | { |
788 | int hdrlen = IEEE80211_3ADDR_LEN; | 1007 | int hdrlen = IEEE80211_3ADDR_LEN; |
1008 | u16 stype = WLAN_FC_GET_STYPE(fc); | ||
789 | 1009 | ||
790 | switch (WLAN_FC_GET_TYPE(fc)) { | 1010 | switch (WLAN_FC_GET_TYPE(fc)) { |
791 | case IEEE80211_FTYPE_DATA: | 1011 | case IEEE80211_FTYPE_DATA: |
792 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) | 1012 | if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) |
793 | hdrlen = IEEE80211_4ADDR_LEN; | 1013 | hdrlen = IEEE80211_4ADDR_LEN; |
1014 | if (stype & IEEE80211_STYPE_QOS_DATA) | ||
1015 | hdrlen += 2; | ||
794 | break; | 1016 | break; |
795 | case IEEE80211_FTYPE_CTL: | 1017 | case IEEE80211_FTYPE_CTL: |
796 | switch (WLAN_FC_GET_STYPE(fc)) { | 1018 | switch (WLAN_FC_GET_STYPE(fc)) { |
@@ -808,7 +1030,48 @@ extern inline int ieee80211_get_hdrlen(u16 fc) | |||
808 | return hdrlen; | 1030 | return hdrlen; |
809 | } | 1031 | } |
810 | 1032 | ||
1033 | static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr) | ||
1034 | { | ||
1035 | switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { | ||
1036 | case IEEE80211_1ADDR_LEN: | ||
1037 | return ((struct ieee80211_hdr_1addr *)hdr)->payload; | ||
1038 | case IEEE80211_2ADDR_LEN: | ||
1039 | return ((struct ieee80211_hdr_2addr *)hdr)->payload; | ||
1040 | case IEEE80211_3ADDR_LEN: | ||
1041 | return ((struct ieee80211_hdr_3addr *)hdr)->payload; | ||
1042 | case IEEE80211_4ADDR_LEN: | ||
1043 | return ((struct ieee80211_hdr_4addr *)hdr)->payload; | ||
1044 | } | ||
1045 | |||
1046 | } | ||
1047 | |||
1048 | static inline int ieee80211_is_ofdm_rate(u8 rate) | ||
1049 | { | ||
1050 | switch (rate & ~IEEE80211_BASIC_RATE_MASK) { | ||
1051 | case IEEE80211_OFDM_RATE_6MB: | ||
1052 | case IEEE80211_OFDM_RATE_9MB: | ||
1053 | case IEEE80211_OFDM_RATE_12MB: | ||
1054 | case IEEE80211_OFDM_RATE_18MB: | ||
1055 | case IEEE80211_OFDM_RATE_24MB: | ||
1056 | case IEEE80211_OFDM_RATE_36MB: | ||
1057 | case IEEE80211_OFDM_RATE_48MB: | ||
1058 | case IEEE80211_OFDM_RATE_54MB: | ||
1059 | return 1; | ||
1060 | } | ||
1061 | return 0; | ||
1062 | } | ||
811 | 1063 | ||
1064 | static inline int ieee80211_is_cck_rate(u8 rate) | ||
1065 | { | ||
1066 | switch (rate & ~IEEE80211_BASIC_RATE_MASK) { | ||
1067 | case IEEE80211_CCK_RATE_1MB: | ||
1068 | case IEEE80211_CCK_RATE_2MB: | ||
1069 | case IEEE80211_CCK_RATE_5MB: | ||
1070 | case IEEE80211_CCK_RATE_11MB: | ||
1071 | return 1; | ||
1072 | } | ||
1073 | return 0; | ||
1074 | } | ||
812 | 1075 | ||
813 | /* ieee80211.c */ | 1076 | /* ieee80211.c */ |
814 | extern void free_ieee80211(struct net_device *dev); | 1077 | extern void free_ieee80211(struct net_device *dev); |
@@ -817,18 +1080,30 @@ extern struct net_device *alloc_ieee80211(int sizeof_priv); | |||
817 | extern int ieee80211_set_encryption(struct ieee80211_device *ieee); | 1080 | extern int ieee80211_set_encryption(struct ieee80211_device *ieee); |
818 | 1081 | ||
819 | /* ieee80211_tx.c */ | 1082 | /* ieee80211_tx.c */ |
820 | extern int ieee80211_xmit(struct sk_buff *skb, | 1083 | extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev); |
821 | struct net_device *dev); | ||
822 | extern void ieee80211_txb_free(struct ieee80211_txb *); | 1084 | extern void ieee80211_txb_free(struct ieee80211_txb *); |
823 | 1085 | extern int ieee80211_tx_frame(struct ieee80211_device *ieee, | |
1086 | struct ieee80211_hdr *frame, int len); | ||
824 | 1087 | ||
825 | /* ieee80211_rx.c */ | 1088 | /* ieee80211_rx.c */ |
826 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | 1089 | extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, |
827 | struct ieee80211_rx_stats *rx_stats); | 1090 | struct ieee80211_rx_stats *rx_stats); |
828 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, | 1091 | extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, |
829 | struct ieee80211_hdr *header, | 1092 | struct ieee80211_hdr_4addr *header, |
830 | struct ieee80211_rx_stats *stats); | 1093 | struct ieee80211_rx_stats *stats); |
831 | 1094 | ||
1095 | /* ieee80211_geo.c */ | ||
1096 | extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device | ||
1097 | *ieee); | ||
1098 | extern int ieee80211_set_geo(struct ieee80211_device *ieee, | ||
1099 | const struct ieee80211_geo *geo); | ||
1100 | |||
1101 | extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee, | ||
1102 | u8 channel); | ||
1103 | extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, | ||
1104 | u8 channel); | ||
1105 | extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq); | ||
1106 | |||
832 | /* ieee80211_wx.c */ | 1107 | /* ieee80211_wx.c */ |
833 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, | 1108 | extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, |
834 | struct iw_request_info *info, | 1109 | struct iw_request_info *info, |
@@ -839,17 +1114,21 @@ extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, | |||
839 | extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, | 1114 | extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, |
840 | struct iw_request_info *info, | 1115 | struct iw_request_info *info, |
841 | union iwreq_data *wrqu, char *key); | 1116 | union iwreq_data *wrqu, char *key); |
842 | 1117 | extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee, | |
843 | 1118 | struct iw_request_info *info, | |
844 | extern inline void ieee80211_increment_scans(struct ieee80211_device *ieee) | 1119 | union iwreq_data *wrqu, char *extra); |
1120 | extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, | ||
1121 | struct iw_request_info *info, | ||
1122 | union iwreq_data *wrqu, char *extra); | ||
1123 | |||
1124 | static inline void ieee80211_increment_scans(struct ieee80211_device *ieee) | ||
845 | { | 1125 | { |
846 | ieee->scans++; | 1126 | ieee->scans++; |
847 | } | 1127 | } |
848 | 1128 | ||
849 | extern inline int ieee80211_get_scans(struct ieee80211_device *ieee) | 1129 | static inline int ieee80211_get_scans(struct ieee80211_device *ieee) |
850 | { | 1130 | { |
851 | return ieee->scans; | 1131 | return ieee->scans; |
852 | } | 1132 | } |
853 | 1133 | ||
854 | 1134 | #endif /* IEEE80211_H */ | |
855 | #endif /* IEEE80211_H */ | ||