diff options
Diffstat (limited to 'drivers/staging/rtl8187se/ieee80211')
8 files changed, 246 insertions, 307 deletions
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h index 5f5a30223d5..8fc9f588b05 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h | |||
@@ -1221,7 +1221,7 @@ static inline void *ieee80211_priv(struct net_device *dev) | |||
1221 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; | 1221 | return ((struct ieee80211_device *)netdev_priv(dev))->priv; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) | 1224 | static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) |
1225 | { | 1225 | { |
1226 | /* Single white space is for Linksys APs */ | 1226 | /* Single white space is for Linksys APs */ |
1227 | if (essid_len == 1 && essid[0] == ' ') | 1227 | if (essid_len == 1 && essid[0] == ' ') |
@@ -1237,7 +1237,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) | |||
1237 | return 1; | 1237 | return 1; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) | 1240 | static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) |
1241 | { | 1241 | { |
1242 | /* | 1242 | /* |
1243 | * It is possible for both access points and our device to support | 1243 | * It is possible for both access points and our device to support |
@@ -1263,7 +1263,7 @@ extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mod | |||
1263 | return 0; | 1263 | return 0; |
1264 | } | 1264 | } |
1265 | 1265 | ||
1266 | extern inline int ieee80211_get_hdrlen(u16 fc) | 1266 | static inline int ieee80211_get_hdrlen(u16 fc) |
1267 | { | 1267 | { |
1268 | int hdrlen = 24; | 1268 | int hdrlen = 24; |
1269 | 1269 | ||
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c index b3882ae9d97..694eae3d4fd 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c | |||
@@ -11,12 +11,14 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
15 | |||
14 | //#include <linux/config.h> | 16 | //#include <linux/config.h> |
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/init.h> | 18 | #include <linux/init.h> |
17 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
18 | #include <asm/string.h> | 20 | #include <linux/string.h> |
19 | #include <asm/errno.h> | 21 | #include <linux/errno.h> |
20 | 22 | ||
21 | #include "ieee80211.h" | 23 | #include "ieee80211.h" |
22 | 24 | ||
@@ -66,8 +68,7 @@ void ieee80211_crypt_deinit_handler(unsigned long data) | |||
66 | spin_lock_irqsave(&ieee->lock, flags); | 68 | spin_lock_irqsave(&ieee->lock, flags); |
67 | ieee80211_crypt_deinit_entries(ieee, 0); | 69 | ieee80211_crypt_deinit_entries(ieee, 0); |
68 | if (!list_empty(&ieee->crypt_deinit_list)) { | 70 | if (!list_empty(&ieee->crypt_deinit_list)) { |
69 | printk(KERN_DEBUG "%s: entries remaining in delayed crypt " | 71 | pr_debug("entries remaining in delayed crypt deletion list\n"); |
70 | "deletion list\n", ieee->dev->name); | ||
71 | ieee->crypt_deinit_timer.expires = jiffies + HZ; | 72 | ieee->crypt_deinit_timer.expires = jiffies + HZ; |
72 | add_timer(&ieee->crypt_deinit_timer); | 73 | add_timer(&ieee->crypt_deinit_timer); |
73 | } | 74 | } |
@@ -118,8 +119,7 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
118 | list_add(&alg->list, &hcrypt->algs); | 119 | list_add(&alg->list, &hcrypt->algs); |
119 | spin_unlock_irqrestore(&hcrypt->lock, flags); | 120 | spin_unlock_irqrestore(&hcrypt->lock, flags); |
120 | 121 | ||
121 | printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", | 122 | pr_debug("registered algorithm '%s'\n", ops->name); |
122 | ops->name); | ||
123 | 123 | ||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
@@ -146,8 +146,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
146 | spin_unlock_irqrestore(&hcrypt->lock, flags); | 146 | spin_unlock_irqrestore(&hcrypt->lock, flags); |
147 | 147 | ||
148 | if (del_alg) { | 148 | if (del_alg) { |
149 | printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " | 149 | pr_debug("unregistered algorithm '%s'\n", ops->name); |
150 | "'%s'\n", ops->name); | ||
151 | kfree(del_alg); | 150 | kfree(del_alg); |
152 | } | 151 | } |
153 | 152 | ||
@@ -155,7 +154,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) | |||
155 | } | 154 | } |
156 | 155 | ||
157 | 156 | ||
158 | struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) | 157 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) |
159 | { | 158 | { |
160 | unsigned long flags; | 159 | unsigned long flags; |
161 | struct list_head *ptr; | 160 | struct list_head *ptr; |
@@ -182,7 +181,7 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) | |||
182 | } | 181 | } |
183 | 182 | ||
184 | 183 | ||
185 | static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } | 184 | static void *ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } |
186 | static void ieee80211_crypt_null_deinit(void *priv) {} | 185 | static void ieee80211_crypt_null_deinit(void *priv) {} |
187 | 186 | ||
188 | static struct ieee80211_crypto_ops ieee80211_crypt_null = { | 187 | static struct ieee80211_crypto_ops ieee80211_crypt_null = { |
@@ -234,9 +233,8 @@ void ieee80211_crypto_deinit(void) | |||
234 | alg = list_entry(ptr, struct ieee80211_crypto_alg, list); | 233 | alg = list_entry(ptr, struct ieee80211_crypto_alg, list); |
235 | if (alg) { | 234 | if (alg) { |
236 | list_del(ptr); | 235 | list_del(ptr); |
237 | printk(KERN_DEBUG | 236 | pr_debug("unregistered algorithm '%s' (deinit)\n", |
238 | "ieee80211_crypt: unregistered algorithm '%s' (deinit)\n", | 237 | alg->ops->name); |
239 | alg->ops->name); | ||
240 | kfree(alg); | 238 | kfree(alg); |
241 | } | 239 | } |
242 | } | 240 | } |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h index b58a3bcc0dc..0b4ea431982 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h | |||
@@ -77,7 +77,7 @@ struct ieee80211_crypt_data { | |||
77 | 77 | ||
78 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); | 78 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); |
79 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); | 79 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); |
80 | struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); | 80 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); |
81 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); | 81 | void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); |
82 | void ieee80211_crypt_deinit_handler(unsigned long); | 82 | void ieee80211_crypt_deinit_handler(unsigned long); |
83 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, | 83 | void ieee80211_crypt_delayed_deinit(struct ieee80211_device *ieee, |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c index 6aaaa2fd57f..f5949e89e5c 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * more details. | 9 | * more details. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
12 | //#include <linux/config.h> | 14 | //#include <linux/config.h> |
13 | #include <linux/module.h> | 15 | #include <linux/module.h> |
14 | #include <linux/init.h> | 16 | #include <linux/init.h> |
@@ -18,7 +20,7 @@ | |||
18 | #include <linux/netdevice.h> | 20 | #include <linux/netdevice.h> |
19 | #include <linux/if_ether.h> | 21 | #include <linux/if_ether.h> |
20 | #include <linux/if_arp.h> | 22 | #include <linux/if_arp.h> |
21 | #include <asm/string.h> | 23 | #include <linux/string.h> |
22 | #include <linux/wireless.h> | 24 | #include <linux/wireless.h> |
23 | 25 | ||
24 | #include "ieee80211.h" | 26 | #include "ieee80211.h" |
@@ -64,7 +66,7 @@ void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, | |||
64 | crypto_cipher_encrypt_one((void *)tfm, ct, pt); | 66 | crypto_cipher_encrypt_one((void *)tfm, ct, pt); |
65 | } | 67 | } |
66 | 68 | ||
67 | static void * ieee80211_ccmp_init(int key_idx) | 69 | static void *ieee80211_ccmp_init(int key_idx) |
68 | { | 70 | { |
69 | struct ieee80211_ccmp_data *priv; | 71 | struct ieee80211_ccmp_data *priv; |
70 | 72 | ||
@@ -75,8 +77,7 @@ static void * ieee80211_ccmp_init(int key_idx) | |||
75 | 77 | ||
76 | priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); | 78 | priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); |
77 | if (IS_ERR(priv->tfm)) { | 79 | if (IS_ERR(priv->tfm)) { |
78 | printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " | 80 | pr_debug("could not allocate crypto API aes\n"); |
79 | "crypto API aes\n"); | ||
80 | priv->tfm = NULL; | 81 | priv->tfm = NULL; |
81 | goto fail; | 82 | goto fail; |
82 | } | 83 | } |
@@ -128,7 +129,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, | |||
128 | /* | 129 | /* |
129 | qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && | 130 | qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && |
130 | (WLAN_FC_GET_STYPE(fc) & 0x08)); | 131 | (WLAN_FC_GET_STYPE(fc) & 0x08)); |
131 | */ | 132 | */ |
132 | // fixed by David :2006.9.6 | 133 | // fixed by David :2006.9.6 |
133 | qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && | 134 | qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && |
134 | (WLAN_FC_GET_STYPE(fc) & 0x80)); | 135 | (WLAN_FC_GET_STYPE(fc) & 0x80)); |
@@ -282,23 +283,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
282 | keyidx = pos[3]; | 283 | keyidx = pos[3]; |
283 | if (!(keyidx & (1 << 5))) { | 284 | if (!(keyidx & (1 << 5))) { |
284 | if (net_ratelimit()) { | 285 | if (net_ratelimit()) { |
285 | printk(KERN_DEBUG "CCMP: received packet without ExtIV" | 286 | pr_debug("received packet without ExtIV flag from %pM\n", |
286 | " flag from %pM\n", hdr->addr2); | 287 | hdr->addr2); |
287 | } | 288 | } |
288 | key->dot11RSNAStatsCCMPFormatErrors++; | 289 | key->dot11RSNAStatsCCMPFormatErrors++; |
289 | return -2; | 290 | return -2; |
290 | } | 291 | } |
291 | keyidx >>= 6; | 292 | keyidx >>= 6; |
292 | if (key->key_idx != keyidx) { | 293 | if (key->key_idx != keyidx) { |
293 | printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame " | 294 | pr_debug("RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", |
294 | "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv); | 295 | key->key_idx, keyidx, priv); |
295 | return -6; | 296 | return -6; |
296 | } | 297 | } |
297 | if (!key->key_set) { | 298 | if (!key->key_set) { |
298 | if (net_ratelimit()) { | 299 | if (net_ratelimit()) { |
299 | printk(KERN_DEBUG "CCMP: received packet from %pM" | 300 | pr_debug("received packet from %pM with keyid=%d that does not have a configured key\n", |
300 | " with keyid=%d that does not have a configured" | 301 | hdr->addr2, keyidx); |
301 | " key\n", hdr->addr2, keyidx); | ||
302 | } | 302 | } |
303 | return -3; | 303 | return -3; |
304 | } | 304 | } |
@@ -313,9 +313,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
313 | 313 | ||
314 | if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) { | 314 | if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) { |
315 | if (net_ratelimit()) { | 315 | if (net_ratelimit()) { |
316 | printk(KERN_DEBUG "CCMP: replay detected: STA=%pM" | 316 | pr_debug("replay detected: STA=%pM previous PN %pm received PN %pm\n", |
317 | " previous PN %pm received PN %pm\n", | 317 | hdr->addr2, key->rx_pn, pn); |
318 | hdr->addr2, key->rx_pn, pn); | ||
319 | } | 318 | } |
320 | key->dot11RSNAStatsCCMPReplays++; | 319 | key->dot11RSNAStatsCCMPReplays++; |
321 | return -4; | 320 | return -4; |
@@ -341,10 +340,9 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
341 | } | 340 | } |
342 | 341 | ||
343 | if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { | 342 | if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { |
344 | if (net_ratelimit()) { | 343 | if (net_ratelimit()) |
345 | printk(KERN_DEBUG "CCMP: decrypt failed: STA=" | 344 | pr_debug("decrypt failed: STA=%pM\n", hdr->addr2); |
346 | "%pM\n", hdr->addr2); | 345 | |
347 | } | ||
348 | key->dot11RSNAStatsCCMPDecryptErrors++; | 346 | key->dot11RSNAStatsCCMPDecryptErrors++; |
349 | return -5; | 347 | return -5; |
350 | } | 348 | } |
@@ -415,7 +413,7 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) | |||
415 | } | 413 | } |
416 | 414 | ||
417 | 415 | ||
418 | static char * ieee80211_ccmp_print_stats(char *p, void *priv) | 416 | static char *ieee80211_ccmp_print_stats(char *p, void *priv) |
419 | { | 417 | { |
420 | struct ieee80211_ccmp_data *ccmp = priv; | 418 | struct ieee80211_ccmp_data *ccmp = priv; |
421 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " | 419 | p += sprintf(p, "key[%d] alg=CCMP key_set=%d " |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c index 58f3eeb2143..bba77141d9a 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c | |||
@@ -9,13 +9,15 @@ | |||
9 | * more details. | 9 | * more details. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
13 | |||
12 | //#include <linux/config.h> | 14 | //#include <linux/config.h> |
13 | #include <linux/module.h> | 15 | #include <linux/module.h> |
14 | #include <linux/init.h> | 16 | #include <linux/init.h> |
15 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
16 | #include <linux/random.h> | 18 | #include <linux/random.h> |
17 | #include <linux/skbuff.h> | 19 | #include <linux/skbuff.h> |
18 | #include <asm/string.h> | 20 | #include <linux/string.h> |
19 | 21 | ||
20 | #include "ieee80211.h" | 22 | #include "ieee80211.h" |
21 | 23 | ||
@@ -40,7 +42,7 @@ struct prism2_wep_data { | |||
40 | }; | 42 | }; |
41 | 43 | ||
42 | 44 | ||
43 | static void * prism2_wep_init(int keyidx) | 45 | static void *prism2_wep_init(int keyidx) |
44 | { | 46 | { |
45 | struct prism2_wep_data *priv; | 47 | struct prism2_wep_data *priv; |
46 | 48 | ||
@@ -50,15 +52,13 @@ static void * prism2_wep_init(int keyidx) | |||
50 | priv->key_idx = keyidx; | 52 | priv->key_idx = keyidx; |
51 | priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); | 53 | priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
52 | if (IS_ERR(priv->tx_tfm)) { | 54 | if (IS_ERR(priv->tx_tfm)) { |
53 | printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " | 55 | pr_debug("could not allocate crypto API arc4\n"); |
54 | "crypto API arc4\n"); | ||
55 | priv->tx_tfm = NULL; | 56 | priv->tx_tfm = NULL; |
56 | goto fail; | 57 | goto fail; |
57 | } | 58 | } |
58 | priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); | 59 | priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); |
59 | if (IS_ERR(priv->rx_tfm)) { | 60 | if (IS_ERR(priv->rx_tfm)) { |
60 | printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " | 61 | pr_debug("could not allocate crypto API arc4\n"); |
61 | "crypto API arc4\n"); | ||
62 | priv->rx_tfm = NULL; | 62 | priv->rx_tfm = NULL; |
63 | goto fail; | 63 | goto fail; |
64 | } | 64 | } |
@@ -217,7 +217,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) | |||
217 | memmove(skb->data + 4, skb->data, hdr_len); | 217 | memmove(skb->data + 4, skb->data, hdr_len); |
218 | skb_pull(skb, 4); | 218 | skb_pull(skb, 4); |
219 | skb_trim(skb, skb->len - 4); | 219 | skb_trim(skb, skb->len - 4); |
220 | return 0; | 220 | return 0; |
221 | } | 221 | } |
222 | 222 | ||
223 | 223 | ||
@@ -248,7 +248,7 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) | |||
248 | } | 248 | } |
249 | 249 | ||
250 | 250 | ||
251 | static char * prism2_wep_print_stats(char *p, void *priv) | 251 | static char *prism2_wep_print_stats(char *p, void *priv) |
252 | { | 252 | { |
253 | struct prism2_wep_data *wep = priv; | 253 | struct prism2_wep_data *wep = priv; |
254 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", | 254 | p += sprintf(p, "key[%d] alg=WEP len=%d\n", |
@@ -289,5 +289,5 @@ void ieee80211_crypto_wep_exit(void) | |||
289 | void ieee80211_wep_null(void) | 289 | void ieee80211_wep_null(void) |
290 | { | 290 | { |
291 | // printk("============>%s()\n", __func__); | 291 | // printk("============>%s()\n", __func__); |
292 | return; | 292 | return; |
293 | } | 293 | } |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c index 9422573bfea..4358c4b0ca6 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c | |||
@@ -48,7 +48,7 @@ | |||
48 | #include <linux/types.h> | 48 | #include <linux/types.h> |
49 | #include <linux/wireless.h> | 49 | #include <linux/wireless.h> |
50 | #include <linux/etherdevice.h> | 50 | #include <linux/etherdevice.h> |
51 | #include <asm/uaccess.h> | 51 | #include <linux/uaccess.h> |
52 | #include <net/arp.h> | 52 | #include <net/arp.h> |
53 | #include <net/net_namespace.h> | 53 | #include <net/net_namespace.h> |
54 | 54 | ||
@@ -69,8 +69,7 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) | |||
69 | MAX_NETWORK_COUNT, sizeof(struct ieee80211_network), | 69 | MAX_NETWORK_COUNT, sizeof(struct ieee80211_network), |
70 | GFP_KERNEL); | 70 | GFP_KERNEL); |
71 | if (!ieee->networks) { | 71 | if (!ieee->networks) { |
72 | printk(KERN_WARNING "%s: Out of memory allocating beacons\n", | 72 | netdev_warn(ieee->dev, "Out of memory allocating beacons\n"); |
73 | ieee->dev->name); | ||
74 | return -ENOMEM; | 73 | return -ENOMEM; |
75 | } | 74 | } |
76 | 75 | ||
@@ -100,7 +99,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
100 | { | 99 | { |
101 | struct ieee80211_device *ieee; | 100 | struct ieee80211_device *ieee; |
102 | struct net_device *dev; | 101 | struct net_device *dev; |
103 | int i,err; | 102 | int i, err; |
104 | 103 | ||
105 | IEEE80211_DEBUG_INFO("Initializing...\n"); | 104 | IEEE80211_DEBUG_INFO("Initializing...\n"); |
106 | 105 | ||
@@ -140,11 +139,11 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
140 | spin_lock_init(&ieee->wpax_suitlist_lock); | 139 | spin_lock_init(&ieee->wpax_suitlist_lock); |
141 | 140 | ||
142 | ieee->wpax_type_set = 0; | 141 | ieee->wpax_type_set = 0; |
143 | ieee->wpa_enabled = 0; | 142 | ieee->wpa_enabled = 0; |
144 | ieee->tkip_countermeasures = 0; | 143 | ieee->tkip_countermeasures = 0; |
145 | ieee->drop_unencrypted = 0; | 144 | ieee->drop_unencrypted = 0; |
146 | ieee->privacy_invoked = 0; | 145 | ieee->privacy_invoked = 0; |
147 | ieee->ieee802_1x = 1; | 146 | ieee->ieee802_1x = 1; |
148 | ieee->raw_tx = 0; | 147 | ieee->raw_tx = 0; |
149 | 148 | ||
150 | ieee80211_softmac_init(ieee); | 149 | ieee80211_softmac_init(ieee); |
@@ -153,9 +152,9 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
153 | INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); | 152 | INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); |
154 | 153 | ||
155 | for (i = 0; i < 17; i++) { | 154 | for (i = 0; i < 17; i++) { |
156 | ieee->last_rxseq_num[i] = -1; | 155 | ieee->last_rxseq_num[i] = -1; |
157 | ieee->last_rxfrag_num[i] = -1; | 156 | ieee->last_rxfrag_num[i] = -1; |
158 | ieee->last_packet_time[i] = 0; | 157 | ieee->last_packet_time[i] = 0; |
159 | } | 158 | } |
160 | //These function were added to load crypte module autoly | 159 | //These function were added to load crypte module autoly |
161 | ieee80211_tkip_null(); | 160 | ieee80211_tkip_null(); |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c index 3a724496e74..446f15ec639 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include <linux/types.h> | 39 | #include <linux/types.h> |
40 | #include <linux/wireless.h> | 40 | #include <linux/wireless.h> |
41 | #include <linux/etherdevice.h> | 41 | #include <linux/etherdevice.h> |
42 | #include <asm/uaccess.h> | 42 | #include <linux/uaccess.h> |
43 | #include <linux/ctype.h> | 43 | #include <linux/ctype.h> |
44 | 44 | ||
45 | #include "ieee80211.h" | 45 | #include "ieee80211.h" |
@@ -65,7 +65,7 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, | |||
65 | /* Called only as a tasklet (software IRQ) */ | 65 | /* Called only as a tasklet (software IRQ) */ |
66 | static struct ieee80211_frag_entry * | 66 | static struct ieee80211_frag_entry * |
67 | ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, | 67 | ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, |
68 | unsigned int frag, u8 tid,u8 *src, u8 *dst) | 68 | unsigned int frag, u8 tid, u8 *src, u8 *dst) |
69 | { | 69 | { |
70 | struct ieee80211_frag_entry *entry; | 70 | struct ieee80211_frag_entry *entry; |
71 | int i; | 71 | int i; |
@@ -107,18 +107,18 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, | |||
107 | struct ieee80211_hdr_4addrqos *hdr_4addrqos; | 107 | struct ieee80211_hdr_4addrqos *hdr_4addrqos; |
108 | u8 tid; | 108 | u8 tid; |
109 | 109 | ||
110 | if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { | 110 | if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { |
111 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; | 111 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; |
112 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; | 112 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; |
113 | tid = UP2AC(tid); | 113 | tid = UP2AC(tid); |
114 | tid ++; | 114 | tid++; |
115 | } else if (IEEE80211_QOS_HAS_SEQ(fc)) { | 115 | } else if (IEEE80211_QOS_HAS_SEQ(fc)) { |
116 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; | 116 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; |
117 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; | 117 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; |
118 | tid = UP2AC(tid); | 118 | tid = UP2AC(tid); |
119 | tid ++; | 119 | tid++; |
120 | } else { | 120 | } else { |
121 | tid = 0; | 121 | tid = 0; |
122 | } | 122 | } |
123 | 123 | ||
124 | if (frag == 0) { | 124 | if (frag == 0) { |
@@ -129,7 +129,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, | |||
129 | 2 /* alignment */ + | 129 | 2 /* alignment */ + |
130 | 8 /* WEP */ + | 130 | 8 /* WEP */ + |
131 | ETH_ALEN /* WDS */ + | 131 | ETH_ALEN /* WDS */ + |
132 | (IEEE80211_QOS_HAS_SEQ(fc)?2:0) /* QOS Control */); | 132 | (IEEE80211_QOS_HAS_SEQ(fc) ? 2 : 0) /* QOS Control */); |
133 | if (skb == NULL) | 133 | if (skb == NULL) |
134 | return NULL; | 134 | return NULL; |
135 | 135 | ||
@@ -150,7 +150,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, | |||
150 | } else { | 150 | } else { |
151 | /* received a fragment of a frame for which the head fragment | 151 | /* received a fragment of a frame for which the head fragment |
152 | * should have already been received */ | 152 | * should have already been received */ |
153 | entry = ieee80211_frag_cache_find(ieee, seq, frag, tid,hdr->addr2, | 153 | entry = ieee80211_frag_cache_find(ieee, seq, frag, tid, hdr->addr2, |
154 | hdr->addr1); | 154 | hdr->addr1); |
155 | if (entry != NULL) { | 155 | if (entry != NULL) { |
156 | entry->last_frag = frag; | 156 | entry->last_frag = frag; |
@@ -174,21 +174,21 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, | |||
174 | struct ieee80211_hdr_4addrqos *hdr_4addrqos; | 174 | struct ieee80211_hdr_4addrqos *hdr_4addrqos; |
175 | u8 tid; | 175 | u8 tid; |
176 | 176 | ||
177 | if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { | 177 | if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { |
178 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; | 178 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; |
179 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; | 179 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; |
180 | tid = UP2AC(tid); | 180 | tid = UP2AC(tid); |
181 | tid ++; | 181 | tid++; |
182 | } else if (IEEE80211_QOS_HAS_SEQ(fc)) { | 182 | } else if (IEEE80211_QOS_HAS_SEQ(fc)) { |
183 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; | 183 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; |
184 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; | 184 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; |
185 | tid = UP2AC(tid); | 185 | tid = UP2AC(tid); |
186 | tid ++; | 186 | tid++; |
187 | } else { | 187 | } else { |
188 | tid = 0; | 188 | tid = 0; |
189 | } | 189 | } |
190 | 190 | ||
191 | entry = ieee80211_frag_cache_find(ieee, seq, -1, tid,hdr->addr2, | 191 | entry = ieee80211_frag_cache_find(ieee, seq, -1, tid, hdr->addr2, |
192 | hdr->addr1); | 192 | hdr->addr1); |
193 | 193 | ||
194 | if (entry == NULL) { | 194 | if (entry == NULL) { |
@@ -227,7 +227,7 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
227 | ieee80211_rx_mgt(ieee, (struct ieee80211_hdr_4addr *)skb->data, | 227 | ieee80211_rx_mgt(ieee, (struct ieee80211_hdr_4addr *)skb->data, |
228 | rx_stats); | 228 | rx_stats); |
229 | 229 | ||
230 | if((ieee->state == IEEE80211_LINKED)&&(memcmp(hdr->addr3,ieee->current_network.bssid,ETH_ALEN))) { | 230 | if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) { |
231 | dev_kfree_skb_any(skb); | 231 | dev_kfree_skb_any(skb); |
232 | return 0; | 232 | return 0; |
233 | } | 233 | } |
@@ -244,11 +244,9 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
244 | 244 | ||
245 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ | 245 | /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ |
246 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ | 246 | /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ |
247 | static unsigned char rfc1042_header[] = | 247 | static unsigned char rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; |
248 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; | ||
249 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ | 248 | /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ |
250 | static unsigned char bridge_tunnel_header[] = | 249 | static unsigned char bridge_tunnel_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; |
251 | { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; | ||
252 | /* No encapsulation header if EtherType < 0x600 (=length) */ | 250 | /* No encapsulation header if EtherType < 0x600 (=length) */ |
253 | 251 | ||
254 | /* Called by ieee80211_rx_frame_decrypt */ | 252 | /* Called by ieee80211_rx_frame_decrypt */ |
@@ -294,7 +292,7 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, | |||
294 | 292 | ||
295 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ | 293 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ |
296 | static inline int | 294 | static inline int |
297 | ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, | 295 | ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, |
298 | struct ieee80211_crypt_data *crypt) | 296 | struct ieee80211_crypt_data *crypt) |
299 | { | 297 | { |
300 | struct ieee80211_hdr_4addr *hdr; | 298 | struct ieee80211_hdr_4addr *hdr; |
@@ -310,9 +308,9 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, | |||
310 | if (ieee->tkip_countermeasures && | 308 | if (ieee->tkip_countermeasures && |
311 | strcmp(crypt->ops->name, "TKIP") == 0) { | 309 | strcmp(crypt->ops->name, "TKIP") == 0) { |
312 | if (net_ratelimit()) { | 310 | if (net_ratelimit()) { |
313 | printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " | 311 | netdev_dbg(ieee->dev, |
314 | "received packet from %pM\n", | 312 | "TKIP countermeasures: dropped received packet from %pM\n", |
315 | ieee->dev->name, hdr->addr2); | 313 | ieee->dev->name, hdr->addr2); |
316 | } | 314 | } |
317 | return -1; | 315 | return -1; |
318 | } | 316 | } |
@@ -339,7 +337,7 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, | |||
339 | 337 | ||
340 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ | 338 | /* Called only as a tasklet (software IRQ), by ieee80211_rx */ |
341 | static inline int | 339 | static inline int |
342 | ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb, | 340 | ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *skb, |
343 | int keyidx, struct ieee80211_crypt_data *crypt) | 341 | int keyidx, struct ieee80211_crypt_data *crypt) |
344 | { | 342 | { |
345 | struct ieee80211_hdr_4addr *hdr; | 343 | struct ieee80211_hdr_4addr *hdr; |
@@ -355,9 +353,9 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *s | |||
355 | res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); | 353 | res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); |
356 | atomic_dec(&crypt->refcnt); | 354 | atomic_dec(&crypt->refcnt); |
357 | if (res < 0) { | 355 | if (res < 0) { |
358 | printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" | 356 | netdev_dbg(ieee->dev, |
359 | " (SA=%pM keyidx=%d)\n", | 357 | "MSDU decryption/MIC verification failed (SA=%pM keyidx=%d)\n", |
360 | ieee->dev->name, hdr->addr2, keyidx); | 358 | hdr->addr2, keyidx); |
361 | return -1; | 359 | return -1; |
362 | } | 360 | } |
363 | 361 | ||
@@ -381,18 +379,18 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, | |||
381 | u8 tid; | 379 | u8 tid; |
382 | 380 | ||
383 | //TO2DS and QoS | 381 | //TO2DS and QoS |
384 | if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { | 382 | if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { |
385 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)header; | 383 | hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)header; |
386 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; | 384 | tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; |
387 | tid = UP2AC(tid); | 385 | tid = UP2AC(tid); |
388 | tid ++; | 386 | tid++; |
389 | } else if(IEEE80211_QOS_HAS_SEQ(fc)) { //QoS | 387 | } else if (IEEE80211_QOS_HAS_SEQ(fc)) { //QoS |
390 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)header; | 388 | hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)header; |
391 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; | 389 | tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; |
392 | tid = UP2AC(tid); | 390 | tid = UP2AC(tid); |
393 | tid ++; | 391 | tid++; |
394 | } else { // no QoS | 392 | } else { // no QoS |
395 | tid = 0; | 393 | tid = 0; |
396 | } | 394 | } |
397 | switch (ieee->iw_mode) { | 395 | switch (ieee->iw_mode) { |
398 | case IW_MODE_ADHOC: | 396 | case IW_MODE_ADHOC: |
@@ -411,7 +409,8 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, | |||
411 | if (p == &ieee->ibss_mac_hash[index]) { | 409 | if (p == &ieee->ibss_mac_hash[index]) { |
412 | entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); | 410 | entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); |
413 | if (!entry) { | 411 | if (!entry) { |
414 | printk(KERN_WARNING "Cannot malloc new mac entry\n"); | 412 | netdev_warn(ieee->dev, |
413 | "Cannot malloc new mac entry\n"); | ||
415 | return 0; | 414 | return 0; |
416 | } | 415 | } |
417 | memcpy(entry->mac, mac, ETH_ALEN); | 416 | memcpy(entry->mac, mac, ETH_ALEN); |
@@ -442,7 +441,7 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, | |||
442 | // } | 441 | // } |
443 | if ((*last_seq == seq) && | 442 | if ((*last_seq == seq) && |
444 | time_after(*last_time + IEEE_PACKET_RETRY_TIME, jiffies)) { | 443 | time_after(*last_time + IEEE_PACKET_RETRY_TIME, jiffies)) { |
445 | if (*last_frag == frag){ | 444 | if (*last_frag == frag) { |
446 | //printk(KERN_WARNING "[1] go drop!\n"); | 445 | //printk(KERN_WARNING "[1] go drop!\n"); |
447 | goto drop; | 446 | goto drop; |
448 | 447 | ||
@@ -493,8 +492,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
493 | stats = &ieee->stats; | 492 | stats = &ieee->stats; |
494 | 493 | ||
495 | if (skb->len < 10) { | 494 | if (skb->len < 10) { |
496 | printk(KERN_INFO "%s: SKB length < 10\n", | 495 | netdev_info(ieee->dev, "SKB length < 10\n"); |
497 | dev->name); | ||
498 | goto rx_dropped; | 496 | goto rx_dropped; |
499 | } | 497 | } |
500 | 498 | ||
@@ -506,19 +504,12 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
506 | frag = WLAN_GET_SEQ_FRAG(sc); | 504 | frag = WLAN_GET_SEQ_FRAG(sc); |
507 | 505 | ||
508 | //YJ,add,080828,for keep alive | 506 | //YJ,add,080828,for keep alive |
509 | if((fc & IEEE80211_FCTL_TODS) != IEEE80211_FCTL_TODS) | 507 | if ((fc & IEEE80211_FCTL_TODS) != IEEE80211_FCTL_TODS) { |
510 | { | 508 | if (!memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) |
511 | if(!memcmp(hdr->addr1,dev->dev_addr, ETH_ALEN)) | ||
512 | { | ||
513 | ieee->NumRxUnicast++; | 509 | ieee->NumRxUnicast++; |
514 | } | 510 | } else { |
515 | } | 511 | if (!memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) |
516 | else | ||
517 | { | ||
518 | if(!memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) | ||
519 | { | ||
520 | ieee->NumRxUnicast++; | 512 | ieee->NumRxUnicast++; |
521 | } | ||
522 | } | 513 | } |
523 | //YJ,add,080828,for keep alive,end | 514 | //YJ,add,080828,for keep alive,end |
524 | 515 | ||
@@ -577,12 +568,12 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
577 | case IEEE80211_FCTL_FROMDS: | 568 | case IEEE80211_FCTL_FROMDS: |
578 | memcpy(dst, hdr->addr1, ETH_ALEN); | 569 | memcpy(dst, hdr->addr1, ETH_ALEN); |
579 | memcpy(src, hdr->addr3, ETH_ALEN); | 570 | memcpy(src, hdr->addr3, ETH_ALEN); |
580 | memcpy(bssid,hdr->addr2,ETH_ALEN); | 571 | memcpy(bssid, hdr->addr2, ETH_ALEN); |
581 | break; | 572 | break; |
582 | case IEEE80211_FCTL_TODS: | 573 | case IEEE80211_FCTL_TODS: |
583 | memcpy(dst, hdr->addr3, ETH_ALEN); | 574 | memcpy(dst, hdr->addr3, ETH_ALEN); |
584 | memcpy(src, hdr->addr2, ETH_ALEN); | 575 | memcpy(src, hdr->addr2, ETH_ALEN); |
585 | memcpy(bssid,hdr->addr1,ETH_ALEN); | 576 | memcpy(bssid, hdr->addr1, ETH_ALEN); |
586 | break; | 577 | break; |
587 | case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: | 578 | case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: |
588 | if (skb->len < IEEE80211_DATA_HDR4_LEN) | 579 | if (skb->len < IEEE80211_DATA_HDR4_LEN) |
@@ -594,7 +585,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
594 | case 0: | 585 | case 0: |
595 | memcpy(dst, hdr->addr1, ETH_ALEN); | 586 | memcpy(dst, hdr->addr1, ETH_ALEN); |
596 | memcpy(src, hdr->addr2, ETH_ALEN); | 587 | memcpy(src, hdr->addr2, ETH_ALEN); |
597 | memcpy(bssid,hdr->addr3,ETH_ALEN); | 588 | memcpy(bssid, hdr->addr3, ETH_ALEN); |
598 | break; | 589 | break; |
599 | } | 590 | } |
600 | 591 | ||
@@ -607,7 +598,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
607 | if (stype != IEEE80211_STYPE_DATA && | 598 | if (stype != IEEE80211_STYPE_DATA && |
608 | stype != IEEE80211_STYPE_DATA_CFACK && | 599 | stype != IEEE80211_STYPE_DATA_CFACK && |
609 | stype != IEEE80211_STYPE_DATA_CFPOLL && | 600 | stype != IEEE80211_STYPE_DATA_CFPOLL && |
610 | stype != IEEE80211_STYPE_DATA_CFACKPOLL&& | 601 | stype != IEEE80211_STYPE_DATA_CFACKPOLL && |
611 | stype != IEEE80211_STYPE_QOS_DATA//add by David,2006.8.4 | 602 | stype != IEEE80211_STYPE_QOS_DATA//add by David,2006.8.4 |
612 | ) { | 603 | ) { |
613 | if (stype != IEEE80211_STYPE_NULLFUNC) | 604 | if (stype != IEEE80211_STYPE_NULLFUNC) |
@@ -618,9 +609,8 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
618 | type, stype, skb->len); | 609 | type, stype, skb->len); |
619 | goto rx_dropped; | 610 | goto rx_dropped; |
620 | } | 611 | } |
621 | if(memcmp(bssid,ieee->current_network.bssid,ETH_ALEN)) { | 612 | if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN)) |
622 | goto rx_dropped; | 613 | goto rx_dropped; |
623 | } | ||
624 | 614 | ||
625 | ieee->NumRxDataInPeriod++; | 615 | ieee->NumRxDataInPeriod++; |
626 | ieee->NumRxOkTotal++; | 616 | ieee->NumRxOkTotal++; |
@@ -653,9 +643,8 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
653 | flen -= hdrlen; | 643 | flen -= hdrlen; |
654 | 644 | ||
655 | if (frag_skb->tail + flen > frag_skb->end) { | 645 | if (frag_skb->tail + flen > frag_skb->end) { |
656 | printk(KERN_WARNING "%s: host decrypted and " | 646 | netdev_warn(ieee->dev, |
657 | "reassembled frame did not fit skb\n", | 647 | "host decrypted and reassembled frame did not fit skb\n"); |
658 | dev->name); | ||
659 | ieee80211_frag_cache_invalidate(ieee, hdr); | 648 | ieee80211_frag_cache_invalidate(ieee, hdr); |
660 | goto rx_dropped; | 649 | goto rx_dropped; |
661 | } | 650 | } |
@@ -804,7 +793,7 @@ static inline int ieee80211_is_ofdm_rate(u8 rate) | |||
804 | case IEEE80211_OFDM_RATE_54MB: | 793 | case IEEE80211_OFDM_RATE_54MB: |
805 | return 1; | 794 | return 1; |
806 | } | 795 | } |
807 | return 0; | 796 | return 0; |
808 | } | 797 | } |
809 | 798 | ||
810 | static inline int ieee80211_SignalStrengthTranslate( | 799 | static inline int ieee80211_SignalStrengthTranslate( |
@@ -814,46 +803,27 @@ static inline int ieee80211_SignalStrengthTranslate( | |||
814 | int RetSS; | 803 | int RetSS; |
815 | 804 | ||
816 | // Step 1. Scale mapping. | 805 | // Step 1. Scale mapping. |
817 | if(CurrSS >= 71 && CurrSS <= 100) | 806 | if (CurrSS >= 71 && CurrSS <= 100) |
818 | { | ||
819 | RetSS = 90 + ((CurrSS - 70) / 3); | 807 | RetSS = 90 + ((CurrSS - 70) / 3); |
820 | } | 808 | else if (CurrSS >= 41 && CurrSS <= 70) |
821 | else if(CurrSS >= 41 && CurrSS <= 70) | ||
822 | { | ||
823 | RetSS = 78 + ((CurrSS - 40) / 3); | 809 | RetSS = 78 + ((CurrSS - 40) / 3); |
824 | } | 810 | else if (CurrSS >= 31 && CurrSS <= 40) |
825 | else if(CurrSS >= 31 && CurrSS <= 40) | ||
826 | { | ||
827 | RetSS = 66 + (CurrSS - 30); | 811 | RetSS = 66 + (CurrSS - 30); |
828 | } | 812 | else if (CurrSS >= 21 && CurrSS <= 30) |
829 | else if(CurrSS >= 21 && CurrSS <= 30) | ||
830 | { | ||
831 | RetSS = 54 + (CurrSS - 20); | 813 | RetSS = 54 + (CurrSS - 20); |
832 | } | 814 | else if (CurrSS >= 5 && CurrSS <= 20) |
833 | else if(CurrSS >= 5 && CurrSS <= 20) | ||
834 | { | ||
835 | RetSS = 42 + (((CurrSS - 5) * 2) / 3); | 815 | RetSS = 42 + (((CurrSS - 5) * 2) / 3); |
836 | } | 816 | else if (CurrSS == 4) |
837 | else if(CurrSS == 4) | ||
838 | { | ||
839 | RetSS = 36; | 817 | RetSS = 36; |
840 | } | 818 | else if (CurrSS == 3) |
841 | else if(CurrSS == 3) | ||
842 | { | ||
843 | RetSS = 27; | 819 | RetSS = 27; |
844 | } | 820 | else if (CurrSS == 2) |
845 | else if(CurrSS == 2) | ||
846 | { | ||
847 | RetSS = 18; | 821 | RetSS = 18; |
848 | } | 822 | else if (CurrSS == 1) |
849 | else if(CurrSS == 1) | ||
850 | { | ||
851 | RetSS = 9; | 823 | RetSS = 9; |
852 | } | ||
853 | else | 824 | else |
854 | { | ||
855 | RetSS = CurrSS; | 825 | RetSS = CurrSS; |
856 | } | 826 | |
857 | //RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); | 827 | //RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); |
858 | 828 | ||
859 | // Step 2. Smoothing. | 829 | // Step 2. Smoothing. |
@@ -867,20 +837,16 @@ static inline void ieee80211_extract_country_ie( | |||
867 | struct ieee80211_device *ieee, | 837 | struct ieee80211_device *ieee, |
868 | struct ieee80211_info_element *info_element, | 838 | struct ieee80211_info_element *info_element, |
869 | struct ieee80211_network *network, | 839 | struct ieee80211_network *network, |
870 | u8 * addr2 | 840 | u8 *addr2 |
871 | ) | 841 | ) |
872 | { | 842 | { |
873 | if(IS_DOT11D_ENABLE(ieee)) | 843 | if (IS_DOT11D_ENABLE(ieee)) { |
874 | { | 844 | if (info_element->len != 0) { |
875 | if(info_element->len!= 0) | ||
876 | { | ||
877 | memcpy(network->CountryIeBuf, info_element->data, info_element->len); | 845 | memcpy(network->CountryIeBuf, info_element->data, info_element->len); |
878 | network->CountryIeLen = info_element->len; | 846 | network->CountryIeLen = info_element->len; |
879 | 847 | ||
880 | if(!IS_COUNTRY_IE_VALID(ieee)) | 848 | if (!IS_COUNTRY_IE_VALID(ieee)) |
881 | { | ||
882 | Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); | 849 | Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); |
883 | } | ||
884 | } | 850 | } |
885 | 851 | ||
886 | // | 852 | // |
@@ -888,10 +854,8 @@ static inline void ieee80211_extract_country_ie( | |||
888 | // some AP (e.g. Cisco 1242) don't include country IE in their | 854 | // some AP (e.g. Cisco 1242) don't include country IE in their |
889 | // probe response frame. | 855 | // probe response frame. |
890 | // | 856 | // |
891 | if(IS_EQUAL_CIE_SRC(ieee, addr2) ) | 857 | if (IS_EQUAL_CIE_SRC(ieee, addr2)) |
892 | { | ||
893 | UPDATE_CIE_WATCHDOG(ieee); | 858 | UPDATE_CIE_WATCHDOG(ieee); |
894 | } | ||
895 | } | 859 | } |
896 | 860 | ||
897 | } | 861 | } |
@@ -920,10 +884,10 @@ inline int ieee80211_network_init( | |||
920 | char *p; | 884 | char *p; |
921 | #endif | 885 | #endif |
922 | struct ieee80211_info_element *info_element; | 886 | struct ieee80211_info_element *info_element; |
923 | u16 left; | 887 | u16 left; |
924 | u8 i; | 888 | u8 i; |
925 | short offset; | 889 | short offset; |
926 | u8 curRate = 0,hOpRate = 0,curRate_ex = 0; | 890 | u8 curRate = 0, hOpRate = 0, curRate_ex = 0; |
927 | 891 | ||
928 | /* Pull out fixed field data */ | 892 | /* Pull out fixed field data */ |
929 | memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); | 893 | memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); |
@@ -953,10 +917,10 @@ inline int ieee80211_network_init( | |||
953 | } else | 917 | } else |
954 | network->flags |= NETWORK_HAS_CCK; | 918 | network->flags |= NETWORK_HAS_CCK; |
955 | 919 | ||
956 | network->wpa_ie_len = 0; | 920 | network->wpa_ie_len = 0; |
957 | network->rsn_ie_len = 0; | 921 | network->rsn_ie_len = 0; |
958 | 922 | ||
959 | info_element = &beacon->info_element; | 923 | info_element = &beacon->info_element; |
960 | left = stats->len - ((void *)info_element - (void *)beacon); | 924 | left = stats->len - ((void *)info_element - (void *)beacon); |
961 | while (left >= sizeof(struct ieee80211_info_element_hdr)) { | 925 | while (left >= sizeof(struct ieee80211_info_element_hdr)) { |
962 | if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) { | 926 | if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) { |
@@ -964,7 +928,7 @@ inline int ieee80211_network_init( | |||
964 | info_element->len + sizeof(struct ieee80211_info_element), | 928 | info_element->len + sizeof(struct ieee80211_info_element), |
965 | left); | 929 | left); |
966 | return 1; | 930 | return 1; |
967 | } | 931 | } |
968 | 932 | ||
969 | switch (info_element->id) { | 933 | switch (info_element->id) { |
970 | case MFIE_TYPE_SSID: | 934 | case MFIE_TYPE_SSID: |
@@ -977,8 +941,8 @@ inline int ieee80211_network_init( | |||
977 | network->ssid_len = min(info_element->len, | 941 | network->ssid_len = min(info_element->len, |
978 | (u8)IW_ESSID_MAX_SIZE); | 942 | (u8)IW_ESSID_MAX_SIZE); |
979 | memcpy(network->ssid, info_element->data, network->ssid_len); | 943 | memcpy(network->ssid, info_element->data, network->ssid_len); |
980 | if (network->ssid_len < IW_ESSID_MAX_SIZE) | 944 | if (network->ssid_len < IW_ESSID_MAX_SIZE) |
981 | memset(network->ssid + network->ssid_len, 0, | 945 | memset(network->ssid + network->ssid_len, 0, |
982 | IW_ESSID_MAX_SIZE - network->ssid_len); | 946 | IW_ESSID_MAX_SIZE - network->ssid_len); |
983 | 947 | ||
984 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_SSID: '%s' len=%d.\n", | 948 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_SSID: '%s' len=%d.\n", |
@@ -993,7 +957,7 @@ inline int ieee80211_network_init( | |||
993 | for (i = 0; i < network->rates_len; i++) { | 957 | for (i = 0; i < network->rates_len; i++) { |
994 | network->rates[i] = info_element->data[i]; | 958 | network->rates[i] = info_element->data[i]; |
995 | curRate = network->rates[i] & 0x7f; | 959 | curRate = network->rates[i] & 0x7f; |
996 | if( hOpRate < curRate ) | 960 | if (hOpRate < curRate) |
997 | hOpRate = curRate; | 961 | hOpRate = curRate; |
998 | #ifdef CONFIG_IEEE80211_DEBUG | 962 | #ifdef CONFIG_IEEE80211_DEBUG |
999 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); | 963 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); |
@@ -1019,7 +983,7 @@ inline int ieee80211_network_init( | |||
1019 | for (i = 0; i < network->rates_ex_len; i++) { | 983 | for (i = 0; i < network->rates_ex_len; i++) { |
1020 | network->rates_ex[i] = info_element->data[i]; | 984 | network->rates_ex[i] = info_element->data[i]; |
1021 | curRate_ex = network->rates_ex[i] & 0x7f; | 985 | curRate_ex = network->rates_ex[i] & 0x7f; |
1022 | if( hOpRate < curRate_ex ) | 986 | if (hOpRate < curRate_ex) |
1023 | hOpRate = curRate_ex; | 987 | hOpRate = curRate_ex; |
1024 | #ifdef CONFIG_IEEE80211_DEBUG | 988 | #ifdef CONFIG_IEEE80211_DEBUG |
1025 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); | 989 | p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); |
@@ -1038,14 +1002,14 @@ inline int ieee80211_network_init( | |||
1038 | break; | 1002 | break; |
1039 | 1003 | ||
1040 | case MFIE_TYPE_DS_SET: | 1004 | case MFIE_TYPE_DS_SET: |
1041 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_DS_SET: %d\n", | 1005 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_DS_SET: %d\n", |
1042 | info_element->data[0]); | 1006 | info_element->data[0]); |
1043 | if (stats->freq == IEEE80211_24GHZ_BAND) | 1007 | if (stats->freq == IEEE80211_24GHZ_BAND) |
1044 | network->channel = info_element->data[0]; | 1008 | network->channel = info_element->data[0]; |
1045 | break; | 1009 | break; |
1046 | 1010 | ||
1047 | case MFIE_TYPE_FH_SET: | 1011 | case MFIE_TYPE_FH_SET: |
1048 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_FH_SET: ignored\n"); | 1012 | IEEE80211_DEBUG_SCAN("MFIE_TYPE_FH_SET: ignored\n"); |
1049 | break; | 1013 | break; |
1050 | 1014 | ||
1051 | case MFIE_TYPE_CF_SET: | 1015 | case MFIE_TYPE_CF_SET: |
@@ -1054,12 +1018,12 @@ inline int ieee80211_network_init( | |||
1054 | 1018 | ||
1055 | case MFIE_TYPE_TIM: | 1019 | case MFIE_TYPE_TIM: |
1056 | 1020 | ||
1057 | if(info_element->len < 4) | 1021 | if (info_element->len < 4) |
1058 | break; | 1022 | break; |
1059 | 1023 | ||
1060 | network->dtim_period = info_element->data[1]; | 1024 | network->dtim_period = info_element->data[1]; |
1061 | 1025 | ||
1062 | if(ieee->state != IEEE80211_LINKED) | 1026 | if (ieee->state != IEEE80211_LINKED) |
1063 | break; | 1027 | break; |
1064 | 1028 | ||
1065 | network->last_dtim_sta_time[0] = jiffies; | 1029 | network->last_dtim_sta_time[0] = jiffies; |
@@ -1067,10 +1031,10 @@ inline int ieee80211_network_init( | |||
1067 | 1031 | ||
1068 | network->dtim_data = IEEE80211_DTIM_VALID; | 1032 | network->dtim_data = IEEE80211_DTIM_VALID; |
1069 | 1033 | ||
1070 | if(info_element->data[0] != 0) | 1034 | if (info_element->data[0] != 0) |
1071 | break; | 1035 | break; |
1072 | 1036 | ||
1073 | if(info_element->data[2] & 1) | 1037 | if (info_element->data[2] & 1) |
1074 | network->dtim_data |= IEEE80211_DTIM_MBCAST; | 1038 | network->dtim_data |= IEEE80211_DTIM_MBCAST; |
1075 | 1039 | ||
1076 | offset = (info_element->data[2] >> 1)*2; | 1040 | offset = (info_element->data[2] >> 1)*2; |
@@ -1078,8 +1042,8 @@ inline int ieee80211_network_init( | |||
1078 | //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); | 1042 | //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); |
1079 | 1043 | ||
1080 | /* add and modified for ps 2008.1.22 */ | 1044 | /* add and modified for ps 2008.1.22 */ |
1081 | if(ieee->assoc_id < 8*offset || | 1045 | if (ieee->assoc_id < 8*offset || |
1082 | ieee->assoc_id > 8*(offset + info_element->len -3)) { | 1046 | ieee->assoc_id > 8*(offset + info_element->len - 3)) { |
1083 | break; | 1047 | break; |
1084 | } | 1048 | } |
1085 | 1049 | ||
@@ -1089,9 +1053,9 @@ inline int ieee80211_network_init( | |||
1089 | // info_element->data[3+offset] , | 1053 | // info_element->data[3+offset] , |
1090 | // info_element->data[3+offset] & (1<<(ieee->assoc_id%8))); | 1054 | // info_element->data[3+offset] & (1<<(ieee->assoc_id%8))); |
1091 | 1055 | ||
1092 | if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) { | 1056 | if (info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) |
1093 | network->dtim_data |= IEEE80211_DTIM_UCAST; | 1057 | network->dtim_data |= IEEE80211_DTIM_UCAST; |
1094 | } | 1058 | |
1095 | break; | 1059 | break; |
1096 | 1060 | ||
1097 | case MFIE_TYPE_IBSS_SET: | 1061 | case MFIE_TYPE_IBSS_SET: |
@@ -1125,9 +1089,8 @@ inline int ieee80211_network_init( | |||
1125 | info_element->data[4] == 0x02) { | 1089 | info_element->data[4] == 0x02) { |
1126 | network->Turbo_Enable = 1; | 1090 | network->Turbo_Enable = 1; |
1127 | } | 1091 | } |
1128 | if (1 == stats->nic_type) {//nic 87 | 1092 | if (1 == stats->nic_type) //nic 87 |
1129 | break; | 1093 | break; |
1130 | } | ||
1131 | 1094 | ||
1132 | if (info_element->len >= 5 && | 1095 | if (info_element->len >= 5 && |
1133 | info_element->data[0] == 0x00 && | 1096 | info_element->data[0] == 0x00 && |
@@ -1152,7 +1115,7 @@ inline int ieee80211_network_init( | |||
1152 | //printk(KERN_WARNING "wmm info¶m updated: %x\n", info_element->data[6]); | 1115 | //printk(KERN_WARNING "wmm info¶m updated: %x\n", info_element->data[6]); |
1153 | network->wmm_info = info_element->data[6]; | 1116 | network->wmm_info = info_element->data[6]; |
1154 | //WMM Parameter Element | 1117 | //WMM Parameter Element |
1155 | memcpy(network->wmm_param, (u8 *)(info_element->data + 8),(info_element->len - 8)); | 1118 | memcpy(network->wmm_param, (u8 *)(info_element->data + 8), (info_element->len - 8)); |
1156 | network->QoS_Enable = 1; | 1119 | network->QoS_Enable = 1; |
1157 | } | 1120 | } |
1158 | break; | 1121 | break; |
@@ -1174,14 +1137,14 @@ inline int ieee80211_network_init( | |||
1174 | default: | 1137 | default: |
1175 | IEEE80211_DEBUG_SCAN("unsupported IE %d\n", | 1138 | IEEE80211_DEBUG_SCAN("unsupported IE %d\n", |
1176 | info_element->id); | 1139 | info_element->id); |
1177 | break; | 1140 | break; |
1178 | } | 1141 | } |
1179 | 1142 | ||
1180 | left -= sizeof(struct ieee80211_info_element_hdr) + | 1143 | left -= sizeof(struct ieee80211_info_element_hdr) + |
1181 | info_element->len; | 1144 | info_element->len; |
1182 | info_element = (struct ieee80211_info_element *) | 1145 | info_element = (struct ieee80211_info_element *) |
1183 | &info_element->data[info_element->len]; | 1146 | &info_element->data[info_element->len]; |
1184 | } | 1147 | } |
1185 | //by amy 080312 | 1148 | //by amy 080312 |
1186 | network->HighestOperaRate = hOpRate; | 1149 | network->HighestOperaRate = hOpRate; |
1187 | //by amy 080312 | 1150 | //by amy 080312 |
@@ -1217,7 +1180,7 @@ inline int ieee80211_network_init( | |||
1217 | 1180 | ||
1218 | static inline int is_same_network(struct ieee80211_network *src, | 1181 | static inline int is_same_network(struct ieee80211_network *src, |
1219 | struct ieee80211_network *dst, | 1182 | struct ieee80211_network *dst, |
1220 | struct ieee80211_device * ieee) | 1183 | struct ieee80211_device *ieee) |
1221 | { | 1184 | { |
1222 | /* A network is only a duplicate if the channel, BSSID, ESSID | 1185 | /* A network is only a duplicate if the channel, BSSID, ESSID |
1223 | * and the capability field (in particular IBSS and BSS) all match. | 1186 | * and the capability field (in particular IBSS and BSS) all match. |
@@ -1241,12 +1204,11 @@ inline void update_network(struct ieee80211_network *dst, | |||
1241 | unsigned char quality = src->stats.signalstrength; | 1204 | unsigned char quality = src->stats.signalstrength; |
1242 | unsigned char signal = 0; | 1205 | unsigned char signal = 0; |
1243 | unsigned char noise = 0; | 1206 | unsigned char noise = 0; |
1244 | if(dst->stats.signalstrength > 0) { | 1207 | if (dst->stats.signalstrength > 0) |
1245 | quality = (dst->stats.signalstrength * 5 + src->stats.signalstrength + 5)/6; | 1208 | quality = (dst->stats.signalstrength * 5 + src->stats.signalstrength + 5)/6; |
1246 | } | ||
1247 | signal = ieee80211_TranslateToDbm(quality); | 1209 | signal = ieee80211_TranslateToDbm(quality); |
1248 | //noise = signal - src->stats.noise; | 1210 | //noise = signal - src->stats.noise; |
1249 | if(dst->stats.noise > 0) | 1211 | if (dst->stats.noise > 0) |
1250 | noise = (dst->stats.noise * 5 + src->stats.noise)/6; | 1212 | noise = (dst->stats.noise * 5 + src->stats.noise)/6; |
1251 | //if(strcmp(dst->ssid, "linksys_lzm000") == 0) | 1213 | //if(strcmp(dst->ssid, "linksys_lzm000") == 0) |
1252 | // printk("ssid:%s, quality:%d, signal:%d\n", dst->ssid, quality, signal); | 1214 | // printk("ssid:%s, quality:%d, signal:%d\n", dst->ssid, quality, signal); |
@@ -1262,12 +1224,11 @@ inline void update_network(struct ieee80211_network *dst, | |||
1262 | dst->rates_len = src->rates_len; | 1224 | dst->rates_len = src->rates_len; |
1263 | memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); | 1225 | memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); |
1264 | dst->rates_ex_len = src->rates_ex_len; | 1226 | dst->rates_ex_len = src->rates_ex_len; |
1265 | dst->HighestOperaRate= src->HighestOperaRate; | 1227 | dst->HighestOperaRate = src->HighestOperaRate; |
1266 | //printk("==========>in %s: src->ssid is %s,chan is %d\n",__func__,src->ssid,src->channel); | 1228 | //printk("==========>in %s: src->ssid is %s,chan is %d\n",__func__,src->ssid,src->channel); |
1267 | 1229 | ||
1268 | //YJ,add,080819,for hidden ap | 1230 | //YJ,add,080819,for hidden ap |
1269 | if(src->ssid_len > 0) | 1231 | if (src->ssid_len > 0) { |
1270 | { | ||
1271 | //if(src->ssid_len == 13) | 1232 | //if(src->ssid_len == 13) |
1272 | // printk("=====================>>>>>>>> Dst ssid: %s Src ssid: %s\n", dst->ssid, src->ssid); | 1233 | // printk("=====================>>>>>>>> Dst ssid: %s Src ssid: %s\n", dst->ssid, src->ssid); |
1273 | memset(dst->ssid, 0, dst->ssid_len); | 1234 | memset(dst->ssid, 0, dst->ssid_len); |
@@ -1305,11 +1266,11 @@ inline void update_network(struct ieee80211_network *dst, | |||
1305 | memcpy(dst->wmm_param, src->wmm_param, IEEE80211_AC_PRAM_LEN); | 1266 | memcpy(dst->wmm_param, src->wmm_param, IEEE80211_AC_PRAM_LEN); |
1306 | } | 1267 | } |
1307 | */ | 1268 | */ |
1308 | if(src->wmm_param[0].ac_aci_acm_aifsn|| \ | 1269 | if (src->wmm_param[0].ac_aci_acm_aifsn || \ |
1309 | src->wmm_param[1].ac_aci_acm_aifsn|| \ | 1270 | src->wmm_param[1].ac_aci_acm_aifsn || \ |
1310 | src->wmm_param[2].ac_aci_acm_aifsn|| \ | 1271 | src->wmm_param[2].ac_aci_acm_aifsn || \ |
1311 | src->wmm_param[3].ac_aci_acm_aifsn) { | 1272 | src->wmm_param[3].ac_aci_acm_aifsn) { |
1312 | memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); | 1273 | memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); |
1313 | } | 1274 | } |
1314 | dst->QoS_Enable = src->QoS_Enable; | 1275 | dst->QoS_Enable = src->QoS_Enable; |
1315 | #else | 1276 | #else |
@@ -1336,7 +1297,7 @@ inline void ieee80211_process_probe_response( | |||
1336 | unsigned long flags; | 1297 | unsigned long flags; |
1337 | short renew; | 1298 | short renew; |
1338 | u8 wmm_info; | 1299 | u8 wmm_info; |
1339 | u8 is_beacon = (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_BEACON)? 1:0; //YJ,add,080819,for hidden ap | 1300 | u8 is_beacon = (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_BEACON) ? 1 : 0; //YJ,add,080819,for hidden ap |
1340 | 1301 | ||
1341 | memset(&network, 0, sizeof(struct ieee80211_network)); | 1302 | memset(&network, 0, sizeof(struct ieee80211_network)); |
1342 | 1303 | ||
@@ -1378,48 +1339,36 @@ inline void ieee80211_process_probe_response( | |||
1378 | // (2) If there is no any country code in beacon, | 1339 | // (2) If there is no any country code in beacon, |
1379 | // then wireless adapter should do active scan from ch1~11 and | 1340 | // then wireless adapter should do active scan from ch1~11 and |
1380 | // passive scan from ch12~14 | 1341 | // passive scan from ch12~14 |
1381 | if(ieee->bGlobalDomain) | 1342 | if (ieee->bGlobalDomain) { |
1382 | { | 1343 | if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) { |
1383 | if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) | ||
1384 | { | ||
1385 | // Case 1: Country code | 1344 | // Case 1: Country code |
1386 | if(IS_COUNTRY_IE_VALID(ieee) ) | 1345 | if (IS_COUNTRY_IE_VALID(ieee)) { |
1387 | { | 1346 | if (!IsLegalChannel(ieee, network.channel)) { |
1388 | if( !IsLegalChannel(ieee, network.channel) ) | ||
1389 | { | ||
1390 | printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network.channel); | 1347 | printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network.channel); |
1391 | return; | 1348 | return; |
1392 | } | 1349 | } |
1393 | } | 1350 | } |
1394 | // Case 2: No any country code. | 1351 | // Case 2: No any country code. |
1395 | else | 1352 | else { |
1396 | { | ||
1397 | // Filter over channel ch12~14 | 1353 | // Filter over channel ch12~14 |
1398 | if(network.channel > 11) | 1354 | if (network.channel > 11) { |
1399 | { | ||
1400 | printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); | 1355 | printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); |
1401 | return; | 1356 | return; |
1402 | } | 1357 | } |
1403 | } | 1358 | } |
1404 | } | 1359 | } else { |
1405 | else | ||
1406 | { | ||
1407 | // Case 1: Country code | 1360 | // Case 1: Country code |
1408 | if(IS_COUNTRY_IE_VALID(ieee) ) | 1361 | if (IS_COUNTRY_IE_VALID(ieee)) { |
1409 | { | 1362 | if (!IsLegalChannel(ieee, network.channel)) { |
1410 | if( !IsLegalChannel(ieee, network.channel) ) | 1363 | printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n", network.channel); |
1411 | { | ||
1412 | printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n",network.channel); | ||
1413 | return; | 1364 | return; |
1414 | } | 1365 | } |
1415 | } | 1366 | } |
1416 | // Case 2: No any country code. | 1367 | // Case 2: No any country code. |
1417 | else | 1368 | else { |
1418 | { | ||
1419 | // Filter over channel ch12~14 | 1369 | // Filter over channel ch12~14 |
1420 | if(network.channel > 14) | 1370 | if (network.channel > 14) { |
1421 | { | 1371 | printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n", network.channel); |
1422 | printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",network.channel); | ||
1423 | return; | 1372 | return; |
1424 | } | 1373 | } |
1425 | } | 1374 | } |
@@ -1437,12 +1386,12 @@ inline void ieee80211_process_probe_response( | |||
1437 | 1386 | ||
1438 | spin_lock_irqsave(&ieee->lock, flags); | 1387 | spin_lock_irqsave(&ieee->lock, flags); |
1439 | 1388 | ||
1440 | if(is_same_network(&ieee->current_network, &network, ieee)) { | 1389 | if (is_same_network(&ieee->current_network, &network, ieee)) { |
1441 | wmm_info = ieee->current_network.wmm_info; | 1390 | wmm_info = ieee->current_network.wmm_info; |
1442 | //YJ,add,080819,for hidden ap | 1391 | //YJ,add,080819,for hidden ap |
1443 | if(is_beacon == 0) | 1392 | if (is_beacon == 0) |
1444 | network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags); | 1393 | network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags); |
1445 | else if(ieee->state == IEEE80211_LINKED) | 1394 | else if (ieee->state == IEEE80211_LINKED) |
1446 | ieee->NumRxBcnInPeriod++; | 1395 | ieee->NumRxBcnInPeriod++; |
1447 | //YJ,add,080819,for hidden ap,end | 1396 | //YJ,add,080819,for hidden ap,end |
1448 | //printk("====>network.ssid=%s cur_ssid=%s\n", network.ssid, ieee->current_network.ssid); | 1397 | //printk("====>network.ssid=%s cur_ssid=%s\n", network.ssid, ieee->current_network.ssid); |
@@ -1504,13 +1453,13 @@ inline void ieee80211_process_probe_response( | |||
1504 | */ | 1453 | */ |
1505 | renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); | 1454 | renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); |
1506 | //YJ,add,080819,for hidden ap | 1455 | //YJ,add,080819,for hidden ap |
1507 | if(is_beacon == 0) | 1456 | if (is_beacon == 0) |
1508 | network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags); | 1457 | network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags); |
1509 | //if(strncmp(network.ssid, "linksys-c",9) == 0) | 1458 | //if(strncmp(network.ssid, "linksys-c",9) == 0) |
1510 | // printk("====>2 network.ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network.ssid, network.flags, target->ssid, target->flags); | 1459 | // printk("====>2 network.ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network.ssid, network.flags, target->ssid, target->flags); |
1511 | if(((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ | 1460 | if (((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ |
1512 | && (((network.ssid_len > 0) && (strncmp(target->ssid, network.ssid, network.ssid_len)))\ | 1461 | && (((network.ssid_len > 0) && (strncmp(target->ssid, network.ssid, network.ssid_len)))\ |
1513 | ||((ieee->current_network.ssid_len == network.ssid_len)&&(strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0)&&(ieee->state == IEEE80211_NOLINK)))) | 1462 | || ((ieee->current_network.ssid_len == network.ssid_len) && (strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0) && (ieee->state == IEEE80211_NOLINK)))) |
1514 | renew = 1; | 1463 | renew = 1; |
1515 | //YJ,add,080819,for hidden ap,end | 1464 | //YJ,add,080819,for hidden ap,end |
1516 | update_network(target, &network); | 1465 | update_network(target, &network); |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c index 1ef8fd61273..d9add5305e2 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c | |||
@@ -32,11 +32,11 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info | |||
32 | union iwreq_data *wrqu, char *b) | 32 | union iwreq_data *wrqu, char *b) |
33 | { | 33 | { |
34 | int ret; | 34 | int ret; |
35 | struct iw_freq *fwrq = & wrqu->freq; | 35 | struct iw_freq *fwrq = &wrqu->freq; |
36 | // printk("in %s\n",__func__); | 36 | // printk("in %s\n",__func__); |
37 | down(&ieee->wx_sem); | 37 | down(&ieee->wx_sem); |
38 | 38 | ||
39 | if(ieee->iw_mode == IW_MODE_INFRA){ | 39 | if (ieee->iw_mode == IW_MODE_INFRA) { |
40 | ret = -EOPNOTSUPP; | 40 | ret = -EOPNOTSUPP; |
41 | goto out; | 41 | goto out; |
42 | } | 42 | } |
@@ -57,21 +57,20 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info | |||
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
60 | if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ | 60 | if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1) { |
61 | ret = -EOPNOTSUPP; | 61 | ret = -EOPNOTSUPP; |
62 | goto out; | 62 | goto out; |
63 | 63 | ||
64 | }else { /* Set the channel */ | 64 | } else { /* Set the channel */ |
65 | 65 | ||
66 | 66 | ||
67 | ieee->current_network.channel = fwrq->m; | 67 | ieee->current_network.channel = fwrq->m; |
68 | ieee->set_chan(ieee->dev, ieee->current_network.channel); | 68 | ieee->set_chan(ieee->dev, ieee->current_network.channel); |
69 | 69 | ||
70 | if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) | 70 | if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) |
71 | if(ieee->state == IEEE80211_LINKED){ | 71 | if (ieee->state == IEEE80211_LINKED) { |
72 | 72 | ieee80211_stop_send_beacons(ieee); | |
73 | ieee80211_stop_send_beacons(ieee); | 73 | ieee80211_start_send_beacons(ieee); |
74 | ieee80211_start_send_beacons(ieee); | ||
75 | } | 74 | } |
76 | } | 75 | } |
77 | 76 | ||
@@ -86,7 +85,7 @@ int ieee80211_wx_get_freq(struct ieee80211_device *ieee, | |||
86 | struct iw_request_info *a, | 85 | struct iw_request_info *a, |
87 | union iwreq_data *wrqu, char *b) | 86 | union iwreq_data *wrqu, char *b) |
88 | { | 87 | { |
89 | struct iw_freq *fwrq = & wrqu->freq; | 88 | struct iw_freq *fwrq = &wrqu->freq; |
90 | 89 | ||
91 | if (ieee->current_network.channel == 0) | 90 | if (ieee->current_network.channel == 0) |
92 | return -1; | 91 | return -1; |
@@ -143,12 +142,12 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee, | |||
143 | 142 | ||
144 | down(&ieee->wx_sem); | 143 | down(&ieee->wx_sem); |
145 | /* use ifconfig hw ether */ | 144 | /* use ifconfig hw ether */ |
146 | if (ieee->iw_mode == IW_MODE_MASTER){ | 145 | if (ieee->iw_mode == IW_MODE_MASTER) { |
147 | ret = -1; | 146 | ret = -1; |
148 | goto out; | 147 | goto out; |
149 | } | 148 | } |
150 | 149 | ||
151 | if (temp->sa_family != ARPHRD_ETHER){ | 150 | if (temp->sa_family != ARPHRD_ETHER) { |
152 | ret = -EINVAL; | 151 | ret = -EINVAL; |
153 | goto out; | 152 | goto out; |
154 | } | 153 | } |
@@ -175,9 +174,10 @@ out: | |||
175 | return ret; | 174 | return ret; |
176 | } | 175 | } |
177 | 176 | ||
178 | int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) | 177 | int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a, |
178 | union iwreq_data *wrqu, char *b) | ||
179 | { | 179 | { |
180 | int len,ret = 0; | 180 | int len, ret = 0; |
181 | unsigned long flags; | 181 | unsigned long flags; |
182 | 182 | ||
183 | if (ieee->iw_mode == IW_MODE_MONITOR) | 183 | if (ieee->iw_mode == IW_MODE_MONITOR) |
@@ -200,7 +200,7 @@ out: | |||
200 | } | 200 | } |
201 | len = ieee->current_network.ssid_len; | 201 | len = ieee->current_network.ssid_len; |
202 | wrqu->essid.length = len; | 202 | wrqu->essid.length = len; |
203 | strncpy(b,ieee->current_network.ssid,len); | 203 | strncpy(b, ieee->current_network.ssid, len); |
204 | wrqu->essid.flags = 1; | 204 | wrqu->essid.flags = 1; |
205 | 205 | ||
206 | out: | 206 | out: |
@@ -218,11 +218,11 @@ int ieee80211_wx_set_rate(struct ieee80211_device *ieee, | |||
218 | u32 target_rate = wrqu->bitrate.value; | 218 | u32 target_rate = wrqu->bitrate.value; |
219 | 219 | ||
220 | //added by lizhaoming for auto mode | 220 | //added by lizhaoming for auto mode |
221 | if(target_rate == -1){ | 221 | if (target_rate == -1) |
222 | ieee->rate = 110; | 222 | ieee->rate = 110; |
223 | } else { | 223 | else |
224 | ieee->rate = target_rate/100000; | 224 | ieee->rate = target_rate/100000; |
225 | } | 225 | |
226 | //FIXME: we might want to limit rate also in management protocols. | 226 | //FIXME: we might want to limit rate also in management protocols. |
227 | return 0; | 227 | return 0; |
228 | } | 228 | } |
@@ -250,16 +250,14 @@ int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info | |||
250 | if (wrqu->mode == ieee->iw_mode) | 250 | if (wrqu->mode == ieee->iw_mode) |
251 | goto out; | 251 | goto out; |
252 | 252 | ||
253 | if (wrqu->mode == IW_MODE_MONITOR){ | 253 | if (wrqu->mode == IW_MODE_MONITOR) |
254 | |||
255 | ieee->dev->type = ARPHRD_IEEE80211; | 254 | ieee->dev->type = ARPHRD_IEEE80211; |
256 | }else{ | 255 | else |
257 | ieee->dev->type = ARPHRD_ETHER; | 256 | ieee->dev->type = ARPHRD_ETHER; |
258 | } | ||
259 | 257 | ||
260 | if (!ieee->proto_started){ | 258 | if (!ieee->proto_started) { |
261 | ieee->iw_mode = wrqu->mode; | 259 | ieee->iw_mode = wrqu->mode; |
262 | }else{ | 260 | } else { |
263 | ieee80211_stop_protocol(ieee); | 261 | ieee80211_stop_protocol(ieee); |
264 | ieee->iw_mode = wrqu->mode; | 262 | ieee->iw_mode = wrqu->mode; |
265 | ieee80211_start_protocol(ieee); | 263 | ieee80211_start_protocol(ieee); |
@@ -296,7 +294,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work) | |||
296 | if (ieee->data_hard_resume) | 294 | if (ieee->data_hard_resume) |
297 | ieee->data_hard_resume(ieee->dev); | 295 | ieee->data_hard_resume(ieee->dev); |
298 | 296 | ||
299 | if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) | 297 | if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) |
300 | ieee80211_start_send_beacons(ieee); | 298 | ieee80211_start_send_beacons(ieee); |
301 | 299 | ||
302 | //YJ,add,080828, In prevent of lossing ping packet during scanning | 300 | //YJ,add,080828, In prevent of lossing ping packet during scanning |
@@ -314,7 +312,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info | |||
314 | 312 | ||
315 | down(&ieee->wx_sem); | 313 | down(&ieee->wx_sem); |
316 | 314 | ||
317 | if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ | 315 | if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)) { |
318 | ret = -1; | 316 | ret = -1; |
319 | goto out; | 317 | goto out; |
320 | } | 318 | } |
@@ -323,7 +321,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info | |||
323 | //ieee80211_sta_ps_send_null_frame(ieee, true); | 321 | //ieee80211_sta_ps_send_null_frame(ieee, true); |
324 | //YJ,add,080828,end | 322 | //YJ,add,080828,end |
325 | 323 | ||
326 | if ( ieee->state == IEEE80211_LINKED){ | 324 | if (ieee->state == IEEE80211_LINKED) { |
327 | queue_work(ieee->wq, &ieee->wx_sync_scan_wq); | 325 | queue_work(ieee->wq, &ieee->wx_sync_scan_wq); |
328 | /* intentionally forget to up sem */ | 326 | /* intentionally forget to up sem */ |
329 | return 0; | 327 | return 0; |
@@ -339,7 +337,7 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, | |||
339 | union iwreq_data *wrqu, char *extra) | 337 | union iwreq_data *wrqu, char *extra) |
340 | { | 338 | { |
341 | 339 | ||
342 | int ret=0,len; | 340 | int ret = 0, len; |
343 | short proto_started; | 341 | short proto_started; |
344 | unsigned long flags; | 342 | unsigned long flags; |
345 | 343 | ||
@@ -349,17 +347,17 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, | |||
349 | 347 | ||
350 | proto_started = ieee->proto_started; | 348 | proto_started = ieee->proto_started; |
351 | 349 | ||
352 | if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ | 350 | if (wrqu->essid.length > IW_ESSID_MAX_SIZE) { |
353 | ret= -E2BIG; | 351 | ret = -E2BIG; |
354 | goto out; | 352 | goto out; |
355 | } | 353 | } |
356 | 354 | ||
357 | if (ieee->iw_mode == IW_MODE_MONITOR){ | 355 | if (ieee->iw_mode == IW_MODE_MONITOR) { |
358 | ret= -1; | 356 | ret = -1; |
359 | goto out; | 357 | goto out; |
360 | } | 358 | } |
361 | 359 | ||
362 | if(proto_started) | 360 | if (proto_started) |
363 | ieee80211_stop_protocol(ieee); | 361 | ieee80211_stop_protocol(ieee); |
364 | 362 | ||
365 | /* this is just to be sure that the GET wx callback | 363 | /* this is just to be sure that the GET wx callback |
@@ -377,13 +375,12 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, | |||
377 | //YJ,modified,080819,end | 375 | //YJ,modified,080819,end |
378 | 376 | ||
379 | //YJ,add,080819,for hidden ap | 377 | //YJ,add,080819,for hidden ap |
380 | if(len == 0){ | 378 | if (len == 0) { |
381 | memset(ieee->current_network.bssid, 0, ETH_ALEN); | 379 | memset(ieee->current_network.bssid, 0, ETH_ALEN); |
382 | ieee->current_network.capability = 0; | 380 | ieee->current_network.capability = 0; |
383 | } | 381 | } |
384 | //YJ,add,080819,for hidden ap,end | 382 | //YJ,add,080819,for hidden ap,end |
385 | } | 383 | } else { |
386 | else{ | ||
387 | ieee->ssid_set = 0; | 384 | ieee->ssid_set = 0; |
388 | ieee->current_network.ssid[0] = '\0'; | 385 | ieee->current_network.ssid[0] = '\0'; |
389 | ieee->current_network.ssid_len = 0; | 386 | ieee->current_network.ssid_len = 0; |
@@ -398,7 +395,7 @@ out: | |||
398 | return ret; | 395 | return ret; |
399 | } | 396 | } |
400 | 397 | ||
401 | int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, | 398 | int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, |
402 | union iwreq_data *wrqu, char *b) | 399 | union iwreq_data *wrqu, char *b) |
403 | { | 400 | { |
404 | 401 | ||
@@ -406,7 +403,7 @@ out: | |||
406 | return 0; | 403 | return 0; |
407 | } | 404 | } |
408 | 405 | ||
409 | int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, | 406 | int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, |
410 | struct iw_request_info *info, | 407 | struct iw_request_info *info, |
411 | union iwreq_data *wrqu, char *extra) | 408 | union iwreq_data *wrqu, char *extra) |
412 | { | 409 | { |
@@ -417,24 +414,23 @@ out: | |||
417 | 414 | ||
418 | down(&ieee->wx_sem); | 415 | down(&ieee->wx_sem); |
419 | 416 | ||
420 | if(enable) | 417 | if (enable) |
421 | ieee->raw_tx = 1; | 418 | ieee->raw_tx = 1; |
422 | else | 419 | else |
423 | ieee->raw_tx = 0; | 420 | ieee->raw_tx = 0; |
424 | 421 | ||
425 | printk(KERN_INFO"raw TX is %s\n", | 422 | netdev_info(ieee->dev, "raw TX is %s\n", |
426 | ieee->raw_tx ? "enabled" : "disabled"); | 423 | ieee->raw_tx ? "enabled" : "disabled"); |
427 | 424 | ||
428 | if(ieee->iw_mode == IW_MODE_MONITOR) | 425 | if (ieee->iw_mode == IW_MODE_MONITOR) { |
429 | { | 426 | if (prev == 0 && ieee->raw_tx) { |
430 | if(prev == 0 && ieee->raw_tx){ | ||
431 | if (ieee->data_hard_resume) | 427 | if (ieee->data_hard_resume) |
432 | ieee->data_hard_resume(ieee->dev); | 428 | ieee->data_hard_resume(ieee->dev); |
433 | 429 | ||
434 | netif_carrier_on(ieee->dev); | 430 | netif_carrier_on(ieee->dev); |
435 | } | 431 | } |
436 | 432 | ||
437 | if(prev && ieee->raw_tx == 1) | 433 | if (prev && ieee->raw_tx == 1) |
438 | netif_carrier_off(ieee->dev); | 434 | netif_carrier_off(ieee->dev); |
439 | } | 435 | } |
440 | 436 | ||
@@ -448,18 +444,18 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, | |||
448 | union iwreq_data *wrqu, char *extra) | 444 | union iwreq_data *wrqu, char *extra) |
449 | { | 445 | { |
450 | strlcpy(wrqu->name, "802.11", IFNAMSIZ); | 446 | strlcpy(wrqu->name, "802.11", IFNAMSIZ); |
451 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ | 447 | if (ieee->modulation & IEEE80211_CCK_MODULATION) { |
452 | strlcat(wrqu->name, "b", IFNAMSIZ); | 448 | strlcat(wrqu->name, "b", IFNAMSIZ); |
453 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 449 | if (ieee->modulation & IEEE80211_OFDM_MODULATION) |
454 | strlcat(wrqu->name, "/g", IFNAMSIZ); | 450 | strlcat(wrqu->name, "/g", IFNAMSIZ); |
455 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 451 | } else if (ieee->modulation & IEEE80211_OFDM_MODULATION) |
456 | strlcat(wrqu->name, "g", IFNAMSIZ); | 452 | strlcat(wrqu->name, "g", IFNAMSIZ); |
457 | 453 | ||
458 | if((ieee->state == IEEE80211_LINKED) || | 454 | if ((ieee->state == IEEE80211_LINKED) || |
459 | (ieee->state == IEEE80211_LINKED_SCANNING)) | 455 | (ieee->state == IEEE80211_LINKED_SCANNING)) |
460 | strlcat(wrqu->name," link", IFNAMSIZ); | 456 | strlcat(wrqu->name, " link", IFNAMSIZ); |
461 | else if(ieee->state != IEEE80211_NOLINK) | 457 | else if (ieee->state != IEEE80211_NOLINK) |
462 | strlcat(wrqu->name," .....", IFNAMSIZ); | 458 | strlcat(wrqu->name, " .....", IFNAMSIZ); |
463 | 459 | ||
464 | 460 | ||
465 | return 0; | 461 | return 0; |
@@ -473,11 +469,10 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, | |||
473 | { | 469 | { |
474 | int ret = 0; | 470 | int ret = 0; |
475 | 471 | ||
476 | if( | 472 | if ((!ieee->sta_wake_up) || |
477 | (!ieee->sta_wake_up) || | 473 | (!ieee->ps_request_tx_ack) || |
478 | (!ieee->ps_request_tx_ack) || | 474 | (!ieee->enter_sleep_state) || |
479 | (!ieee->enter_sleep_state) || | 475 | (!ieee->ps_is_queue_empty)) { |
480 | (!ieee->ps_is_queue_empty)){ | ||
481 | 476 | ||
482 | printk("ERROR. PS mode tried to be use but driver missed a callback\n\n"); | 477 | printk("ERROR. PS mode tried to be use but driver missed a callback\n\n"); |
483 | 478 | ||
@@ -486,7 +481,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, | |||
486 | 481 | ||
487 | down(&ieee->wx_sem); | 482 | down(&ieee->wx_sem); |
488 | 483 | ||
489 | if (wrqu->power.disabled){ | 484 | if (wrqu->power.disabled) { |
490 | ieee->ps = IEEE80211_PS_DISABLED; | 485 | ieee->ps = IEEE80211_PS_DISABLED; |
491 | 486 | ||
492 | goto exit; | 487 | goto exit; |
@@ -512,7 +507,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, | |||
512 | if (wrqu->power.flags & IW_POWER_TIMEOUT) { | 507 | if (wrqu->power.flags & IW_POWER_TIMEOUT) { |
513 | 508 | ||
514 | ieee->ps_timeout = wrqu->power.value / 1000; | 509 | ieee->ps_timeout = wrqu->power.value / 1000; |
515 | printk("Timeout %d\n",ieee->ps_timeout); | 510 | printk("Timeout %d\n", ieee->ps_timeout); |
516 | } | 511 | } |
517 | 512 | ||
518 | if (wrqu->power.flags & IW_POWER_PERIOD) { | 513 | if (wrqu->power.flags & IW_POWER_PERIOD) { |
@@ -533,11 +528,11 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee, | |||
533 | struct iw_request_info *info, | 528 | struct iw_request_info *info, |
534 | union iwreq_data *wrqu, char *extra) | 529 | union iwreq_data *wrqu, char *extra) |
535 | { | 530 | { |
536 | int ret =0; | 531 | int ret = 0; |
537 | 532 | ||
538 | down(&ieee->wx_sem); | 533 | down(&ieee->wx_sem); |
539 | 534 | ||
540 | if(ieee->ps == IEEE80211_PS_DISABLED){ | 535 | if (ieee->ps == IEEE80211_PS_DISABLED) { |
541 | wrqu->power.disabled = 1; | 536 | wrqu->power.disabled = 1; |
542 | goto exit; | 537 | goto exit; |
543 | } | 538 | } |