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 5f5a30223d56..8fc9f588b056 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) return ((struct ieee80211_device *)netdev_priv(dev))->priv; } -extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) +static inline int ieee80211_is_empty_essid(const char *essid, int essid_len) { /* Single white space is for Linksys APs */ if (essid_len == 1 && essid[0] == ' ') @@ -1237,7 +1237,7 @@ extern inline int ieee80211_is_empty_essid(const char *essid, int essid_len) return 1; } -extern inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) +static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode) { /* * 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 return 0; } -extern inline int ieee80211_get_hdrlen(u16 fc) +static inline int ieee80211_get_hdrlen(u16 fc) { int hdrlen = 24; diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c index b3882ae9d974..694eae3d4fda 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c @@ -11,12 +11,14 @@ * */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + //#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> -#include <asm/string.h> -#include <asm/errno.h> +#include <linux/string.h> +#include <linux/errno.h> #include "ieee80211.h" @@ -66,8 +68,7 @@ void ieee80211_crypt_deinit_handler(unsigned long data) spin_lock_irqsave(&ieee->lock, flags); ieee80211_crypt_deinit_entries(ieee, 0); if (!list_empty(&ieee->crypt_deinit_list)) { - printk(KERN_DEBUG "%s: entries remaining in delayed crypt " - "deletion list\n", ieee->dev->name); + pr_debug("entries remaining in delayed crypt deletion list\n"); ieee->crypt_deinit_timer.expires = jiffies + HZ; add_timer(&ieee->crypt_deinit_timer); } @@ -118,8 +119,7 @@ int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops) list_add(&alg->list, &hcrypt->algs); spin_unlock_irqrestore(&hcrypt->lock, flags); - printk(KERN_DEBUG "ieee80211_crypt: registered algorithm '%s'\n", - ops->name); + pr_debug("registered algorithm '%s'\n", ops->name); return 0; } @@ -146,8 +146,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) spin_unlock_irqrestore(&hcrypt->lock, flags); if (del_alg) { - printk(KERN_DEBUG "ieee80211_crypt: unregistered algorithm " - "'%s'\n", ops->name); + pr_debug("unregistered algorithm '%s'\n", ops->name); kfree(del_alg); } @@ -155,7 +154,7 @@ int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops) } -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) +struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) { unsigned long flags; struct list_head *ptr; @@ -182,7 +181,7 @@ struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name) } -static void * ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } +static void *ieee80211_crypt_null_init(int keyidx) { return (void *) 1; } static void ieee80211_crypt_null_deinit(void *priv) {} static struct ieee80211_crypto_ops ieee80211_crypt_null = { @@ -234,9 +233,8 @@ void ieee80211_crypto_deinit(void) alg = list_entry(ptr, struct ieee80211_crypto_alg, list); if (alg) { list_del(ptr); - printk(KERN_DEBUG - "ieee80211_crypt: unregistered algorithm '%s' (deinit)\n", - alg->ops->name); + pr_debug("unregistered algorithm '%s' (deinit)\n", + alg->ops->name); kfree(alg); } } diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h index b58a3bcc0dc0..0b4ea431982d 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 { int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); -struct ieee80211_crypto_ops * ieee80211_get_crypto_ops(const char *name); +struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); void ieee80211_crypt_deinit_entries(struct ieee80211_device *, int); void ieee80211_crypt_deinit_handler(unsigned long); 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 6aaaa2fd57f4..f5949e89e5c2 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c @@ -9,6 +9,8 @@ * more details. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + //#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> @@ -18,7 +20,7 @@ #include <linux/netdevice.h> #include <linux/if_ether.h> #include <linux/if_arp.h> -#include <asm/string.h> +#include <linux/string.h> #include <linux/wireless.h> #include "ieee80211.h" @@ -64,7 +66,7 @@ void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, crypto_cipher_encrypt_one((void *)tfm, ct, pt); } -static void * ieee80211_ccmp_init(int key_idx) +static void *ieee80211_ccmp_init(int key_idx) { struct ieee80211_ccmp_data *priv; @@ -75,8 +77,7 @@ static void * ieee80211_ccmp_init(int key_idx) priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " - "crypto API aes\n"); + pr_debug("could not allocate crypto API aes\n"); priv->tfm = NULL; goto fail; } @@ -128,7 +129,7 @@ static void ccmp_init_blocks(struct crypto_tfm *tfm, /* qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x08)); - */ + */ // fixed by David :2006.9.6 qc_included = ((WLAN_FC_GET_TYPE(fc) == IEEE80211_FTYPE_DATA) && (WLAN_FC_GET_STYPE(fc) & 0x80)); @@ -282,23 +283,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) keyidx = pos[3]; if (!(keyidx & (1 << 5))) { if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: received packet without ExtIV" - " flag from %pM\n", hdr->addr2); + pr_debug("received packet without ExtIV flag from %pM\n", + hdr->addr2); } key->dot11RSNAStatsCCMPFormatErrors++; return -2; } keyidx >>= 6; if (key->key_idx != keyidx) { - printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame " - "keyidx=%d priv=%p\n", key->key_idx, keyidx, priv); + pr_debug("RX tkey->key_idx=%d frame keyidx=%d priv=%p\n", + key->key_idx, keyidx, priv); return -6; } if (!key->key_set) { if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: received packet from %pM" - " with keyid=%d that does not have a configured" - " key\n", hdr->addr2, keyidx); + pr_debug("received packet from %pM with keyid=%d that does not have a configured key\n", + hdr->addr2, keyidx); } return -3; } @@ -313,9 +313,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) { if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: replay detected: STA=%pM" - " previous PN %pm received PN %pm\n", - hdr->addr2, key->rx_pn, pn); + pr_debug("replay detected: STA=%pM previous PN %pm received PN %pm\n", + hdr->addr2, key->rx_pn, pn); } key->dot11RSNAStatsCCMPReplays++; return -4; @@ -341,10 +340,9 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) } if (memcmp(mic, a, CCMP_MIC_LEN) != 0) { - if (net_ratelimit()) { - printk(KERN_DEBUG "CCMP: decrypt failed: STA=" - "%pM\n", hdr->addr2); - } + if (net_ratelimit()) + pr_debug("decrypt failed: STA=%pM\n", hdr->addr2); + key->dot11RSNAStatsCCMPDecryptErrors++; return -5; } @@ -415,7 +413,7 @@ static int ieee80211_ccmp_get_key(void *key, int len, u8 *seq, void *priv) } -static char * ieee80211_ccmp_print_stats(char *p, void *priv) +static char *ieee80211_ccmp_print_stats(char *p, void *priv) { struct ieee80211_ccmp_data *ccmp = priv; 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 58f3eeb2143e..bba77141d9a3 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c @@ -9,13 +9,15 @@ * more details. */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + //#include <linux/config.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/random.h> #include <linux/skbuff.h> -#include <asm/string.h> +#include <linux/string.h> #include "ieee80211.h" @@ -40,7 +42,7 @@ struct prism2_wep_data { }; -static void * prism2_wep_init(int keyidx) +static void *prism2_wep_init(int keyidx) { struct prism2_wep_data *priv; @@ -50,15 +52,13 @@ static void * prism2_wep_init(int keyidx) priv->key_idx = keyidx; priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " - "crypto API arc4\n"); + pr_debug("could not allocate crypto API arc4\n"); priv->tx_tfm = NULL; goto fail; } priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm)) { - printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " - "crypto API arc4\n"); + pr_debug("could not allocate crypto API arc4\n"); priv->rx_tfm = NULL; goto fail; } @@ -217,7 +217,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) memmove(skb->data + 4, skb->data, hdr_len); skb_pull(skb, 4); skb_trim(skb, skb->len - 4); - return 0; + return 0; } @@ -248,7 +248,7 @@ static int prism2_wep_get_key(void *key, int len, u8 *seq, void *priv) } -static char * prism2_wep_print_stats(char *p, void *priv) +static char *prism2_wep_print_stats(char *p, void *priv) { struct prism2_wep_data *wep = priv; p += sprintf(p, "key[%d] alg=WEP len=%d\n", @@ -289,5 +289,5 @@ void ieee80211_crypto_wep_exit(void) void ieee80211_wep_null(void) { // printk("============>%s()\n", __func__); - return; + return; } diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c index 9422573bfeaa..4358c4b0ca60 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_module.c @@ -48,7 +48,7 @@ #include <linux/types.h> #include <linux/wireless.h> #include <linux/etherdevice.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <net/arp.h> #include <net/net_namespace.h> @@ -69,8 +69,7 @@ static inline int ieee80211_networks_allocate(struct ieee80211_device *ieee) MAX_NETWORK_COUNT, sizeof(struct ieee80211_network), GFP_KERNEL); if (!ieee->networks) { - printk(KERN_WARNING "%s: Out of memory allocating beacons\n", - ieee->dev->name); + netdev_warn(ieee->dev, "Out of memory allocating beacons\n"); return -ENOMEM; } @@ -100,7 +99,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) { struct ieee80211_device *ieee; struct net_device *dev; - int i,err; + int i, err; IEEE80211_DEBUG_INFO("Initializing...\n"); @@ -140,11 +139,11 @@ struct net_device *alloc_ieee80211(int sizeof_priv) spin_lock_init(&ieee->wpax_suitlist_lock); ieee->wpax_type_set = 0; - ieee->wpa_enabled = 0; - ieee->tkip_countermeasures = 0; - ieee->drop_unencrypted = 0; - ieee->privacy_invoked = 0; - ieee->ieee802_1x = 1; + ieee->wpa_enabled = 0; + ieee->tkip_countermeasures = 0; + ieee->drop_unencrypted = 0; + ieee->privacy_invoked = 0; + ieee->ieee802_1x = 1; ieee->raw_tx = 0; ieee80211_softmac_init(ieee); @@ -153,9 +152,9 @@ struct net_device *alloc_ieee80211(int sizeof_priv) INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); for (i = 0; i < 17; i++) { - ieee->last_rxseq_num[i] = -1; - ieee->last_rxfrag_num[i] = -1; - ieee->last_packet_time[i] = 0; + ieee->last_rxseq_num[i] = -1; + ieee->last_rxfrag_num[i] = -1; + ieee->last_packet_time[i] = 0; } //These function were added to load crypte module autoly ieee80211_tkip_null(); diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c index 3a724496e748..446f15ec6396 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c @@ -39,7 +39,7 @@ #include <linux/types.h> #include <linux/wireless.h> #include <linux/etherdevice.h> -#include <asm/uaccess.h> +#include <linux/uaccess.h> #include <linux/ctype.h> #include "ieee80211.h" @@ -65,7 +65,7 @@ static inline void ieee80211_monitor_rx(struct ieee80211_device *ieee, /* Called only as a tasklet (software IRQ) */ static struct ieee80211_frag_entry * ieee80211_frag_cache_find(struct ieee80211_device *ieee, unsigned int seq, - unsigned int frag, u8 tid,u8 *src, u8 *dst) + unsigned int frag, u8 tid, u8 *src, u8 *dst) { struct ieee80211_frag_entry *entry; int i; @@ -107,18 +107,18 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, struct ieee80211_hdr_4addrqos *hdr_4addrqos; u8 tid; - if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; - tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; - tid = UP2AC(tid); - tid ++; + if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { + hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; + tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; + tid = UP2AC(tid); + tid++; } else if (IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; - tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; - tid = UP2AC(tid); - tid ++; + hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; + tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; + tid = UP2AC(tid); + tid++; } else { - tid = 0; + tid = 0; } if (frag == 0) { @@ -129,7 +129,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, 2 /* alignment */ + 8 /* WEP */ + ETH_ALEN /* WDS */ + - (IEEE80211_QOS_HAS_SEQ(fc)?2:0) /* QOS Control */); + (IEEE80211_QOS_HAS_SEQ(fc) ? 2 : 0) /* QOS Control */); if (skb == NULL) return NULL; @@ -150,7 +150,7 @@ ieee80211_frag_cache_get(struct ieee80211_device *ieee, } else { /* received a fragment of a frame for which the head fragment * should have already been received */ - entry = ieee80211_frag_cache_find(ieee, seq, frag, tid,hdr->addr2, + entry = ieee80211_frag_cache_find(ieee, seq, frag, tid, hdr->addr2, hdr->addr1); if (entry != NULL) { entry->last_frag = frag; @@ -174,21 +174,21 @@ static int ieee80211_frag_cache_invalidate(struct ieee80211_device *ieee, struct ieee80211_hdr_4addrqos *hdr_4addrqos; u8 tid; - if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; - tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; - tid = UP2AC(tid); - tid ++; + if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { + hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)hdr; + tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; + tid = UP2AC(tid); + tid++; } else if (IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; - tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; - tid = UP2AC(tid); - tid ++; + hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)hdr; + tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; + tid = UP2AC(tid); + tid++; } else { - tid = 0; + tid = 0; } - entry = ieee80211_frag_cache_find(ieee, seq, -1, tid,hdr->addr2, + entry = ieee80211_frag_cache_find(ieee, seq, -1, tid, hdr->addr2, hdr->addr1); if (entry == NULL) { @@ -227,7 +227,7 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, ieee80211_rx_mgt(ieee, (struct ieee80211_hdr_4addr *)skb->data, rx_stats); - if((ieee->state == IEEE80211_LINKED)&&(memcmp(hdr->addr3,ieee->current_network.bssid,ETH_ALEN))) { + if ((ieee->state == IEEE80211_LINKED) && (memcmp(hdr->addr3, ieee->current_network.bssid, ETH_ALEN))) { dev_kfree_skb_any(skb); return 0; } @@ -244,11 +244,9 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb, /* See IEEE 802.1H for LLC/SNAP encapsulation/decapsulation */ /* Ethernet-II snap header (RFC1042 for most EtherTypes) */ -static unsigned char rfc1042_header[] = -{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; +static unsigned char rfc1042_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; /* Bridge-Tunnel header (for EtherTypes ETH_P_AARP and ETH_P_IPX) */ -static unsigned char bridge_tunnel_header[] = -{ 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; +static unsigned char bridge_tunnel_header[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 }; /* No encapsulation header if EtherType < 0x600 (=length) */ /* Called by ieee80211_rx_frame_decrypt */ @@ -294,7 +292,7 @@ static int ieee80211_is_eapol_frame(struct ieee80211_device *ieee, /* Called only as a tasklet (software IRQ), by ieee80211_rx */ static inline int -ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, +ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_crypt_data *crypt) { struct ieee80211_hdr_4addr *hdr; @@ -310,9 +308,9 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, if (ieee->tkip_countermeasures && strcmp(crypt->ops->name, "TKIP") == 0) { if (net_ratelimit()) { - printk(KERN_DEBUG "%s: TKIP countermeasures: dropped " - "received packet from %pM\n", - ieee->dev->name, hdr->addr2); + netdev_dbg(ieee->dev, + "TKIP countermeasures: dropped received packet from %pM\n", + ieee->dev->name, hdr->addr2); } return -1; } @@ -339,7 +337,7 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device* ieee, struct sk_buff *skb, /* Called only as a tasklet (software IRQ), by ieee80211_rx */ static inline int -ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *skb, +ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *skb, int keyidx, struct ieee80211_crypt_data *crypt) { struct ieee80211_hdr_4addr *hdr; @@ -355,9 +353,9 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device* ieee, struct sk_buff *s res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); atomic_dec(&crypt->refcnt); if (res < 0) { - printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" - " (SA=%pM keyidx=%d)\n", - ieee->dev->name, hdr->addr2, keyidx); + netdev_dbg(ieee->dev, + "MSDU decryption/MIC verification failed (SA=%pM keyidx=%d)\n", + hdr->addr2, keyidx); return -1; } @@ -381,18 +379,18 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, u8 tid; //TO2DS and QoS - if(((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS)&&IEEE80211_QOS_HAS_SEQ(fc)) { - hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)header; - tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; - tid = UP2AC(tid); - tid ++; - } else if(IEEE80211_QOS_HAS_SEQ(fc)) { //QoS - hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)header; - tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; - tid = UP2AC(tid); - tid ++; + if (((fc & IEEE80211_FCTL_DSTODS) == IEEE80211_FCTL_DSTODS) && IEEE80211_QOS_HAS_SEQ(fc)) { + hdr_4addrqos = (struct ieee80211_hdr_4addrqos *)header; + tid = le16_to_cpu(hdr_4addrqos->qos_ctl) & IEEE80211_QOS_TID; + tid = UP2AC(tid); + tid++; + } else if (IEEE80211_QOS_HAS_SEQ(fc)) { //QoS + hdr_3addrqos = (struct ieee80211_hdr_3addrqos *)header; + tid = le16_to_cpu(hdr_3addrqos->qos_ctl) & IEEE80211_QOS_TID; + tid = UP2AC(tid); + tid++; } else { // no QoS - tid = 0; + tid = 0; } switch (ieee->iw_mode) { case IW_MODE_ADHOC: @@ -411,7 +409,8 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, if (p == &ieee->ibss_mac_hash[index]) { entry = kmalloc(sizeof(struct ieee_ibss_seq), GFP_ATOMIC); if (!entry) { - printk(KERN_WARNING "Cannot malloc new mac entry\n"); + netdev_warn(ieee->dev, + "Cannot malloc new mac entry\n"); return 0; } memcpy(entry->mac, mac, ETH_ALEN); @@ -442,7 +441,7 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, // } if ((*last_seq == seq) && time_after(*last_time + IEEE_PACKET_RETRY_TIME, jiffies)) { - if (*last_frag == frag){ + if (*last_frag == frag) { //printk(KERN_WARNING "[1] go drop!\n"); goto drop; @@ -493,8 +492,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, stats = &ieee->stats; if (skb->len < 10) { - printk(KERN_INFO "%s: SKB length < 10\n", - dev->name); + netdev_info(ieee->dev, "SKB length < 10\n"); goto rx_dropped; } @@ -506,19 +504,12 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, frag = WLAN_GET_SEQ_FRAG(sc); //YJ,add,080828,for keep alive - if((fc & IEEE80211_FCTL_TODS) != IEEE80211_FCTL_TODS) - { - if(!memcmp(hdr->addr1,dev->dev_addr, ETH_ALEN)) - { + if ((fc & IEEE80211_FCTL_TODS) != IEEE80211_FCTL_TODS) { + if (!memcmp(hdr->addr1, dev->dev_addr, ETH_ALEN)) ieee->NumRxUnicast++; - } - } - else - { - if(!memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) - { + } else { + if (!memcmp(hdr->addr3, dev->dev_addr, ETH_ALEN)) ieee->NumRxUnicast++; - } } //YJ,add,080828,for keep alive,end @@ -577,12 +568,12 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, case IEEE80211_FCTL_FROMDS: memcpy(dst, hdr->addr1, ETH_ALEN); memcpy(src, hdr->addr3, ETH_ALEN); - memcpy(bssid,hdr->addr2,ETH_ALEN); + memcpy(bssid, hdr->addr2, ETH_ALEN); break; case IEEE80211_FCTL_TODS: memcpy(dst, hdr->addr3, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN); - memcpy(bssid,hdr->addr1,ETH_ALEN); + memcpy(bssid, hdr->addr1, ETH_ALEN); break; case IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS: if (skb->len < IEEE80211_DATA_HDR4_LEN) @@ -594,7 +585,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, case 0: memcpy(dst, hdr->addr1, ETH_ALEN); memcpy(src, hdr->addr2, ETH_ALEN); - memcpy(bssid,hdr->addr3,ETH_ALEN); + memcpy(bssid, hdr->addr3, ETH_ALEN); break; } @@ -607,7 +598,7 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, if (stype != IEEE80211_STYPE_DATA && stype != IEEE80211_STYPE_DATA_CFACK && stype != IEEE80211_STYPE_DATA_CFPOLL && - stype != IEEE80211_STYPE_DATA_CFACKPOLL&& + stype != IEEE80211_STYPE_DATA_CFACKPOLL && stype != IEEE80211_STYPE_QOS_DATA//add by David,2006.8.4 ) { if (stype != IEEE80211_STYPE_NULLFUNC) @@ -618,9 +609,8 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, type, stype, skb->len); goto rx_dropped; } - if(memcmp(bssid,ieee->current_network.bssid,ETH_ALEN)) { + if (memcmp(bssid, ieee->current_network.bssid, ETH_ALEN)) goto rx_dropped; - } ieee->NumRxDataInPeriod++; ieee->NumRxOkTotal++; @@ -653,9 +643,8 @@ int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb, flen -= hdrlen; if (frag_skb->tail + flen > frag_skb->end) { - printk(KERN_WARNING "%s: host decrypted and " - "reassembled frame did not fit skb\n", - dev->name); + netdev_warn(ieee->dev, + "host decrypted and reassembled frame did not fit skb\n"); ieee80211_frag_cache_invalidate(ieee, hdr); goto rx_dropped; } @@ -804,7 +793,7 @@ static inline int ieee80211_is_ofdm_rate(u8 rate) case IEEE80211_OFDM_RATE_54MB: return 1; } - return 0; + return 0; } static inline int ieee80211_SignalStrengthTranslate( @@ -814,46 +803,27 @@ static inline int ieee80211_SignalStrengthTranslate( int RetSS; // Step 1. Scale mapping. - if(CurrSS >= 71 && CurrSS <= 100) - { + if (CurrSS >= 71 && CurrSS <= 100) RetSS = 90 + ((CurrSS - 70) / 3); - } - else if(CurrSS >= 41 && CurrSS <= 70) - { + else if (CurrSS >= 41 && CurrSS <= 70) RetSS = 78 + ((CurrSS - 40) / 3); - } - else if(CurrSS >= 31 && CurrSS <= 40) - { + else if (CurrSS >= 31 && CurrSS <= 40) RetSS = 66 + (CurrSS - 30); - } - else if(CurrSS >= 21 && CurrSS <= 30) - { + else if (CurrSS >= 21 && CurrSS <= 30) RetSS = 54 + (CurrSS - 20); - } - else if(CurrSS >= 5 && CurrSS <= 20) - { + else if (CurrSS >= 5 && CurrSS <= 20) RetSS = 42 + (((CurrSS - 5) * 2) / 3); - } - else if(CurrSS == 4) - { + else if (CurrSS == 4) RetSS = 36; - } - else if(CurrSS == 3) - { + else if (CurrSS == 3) RetSS = 27; - } - else if(CurrSS == 2) - { + else if (CurrSS == 2) RetSS = 18; - } - else if(CurrSS == 1) - { + else if (CurrSS == 1) RetSS = 9; - } else - { RetSS = CurrSS; - } + //RT_TRACE(COMP_DBG, DBG_LOUD, ("##### After Mapping: LastSS: %d, CurrSS: %d, RetSS: %d\n", LastSS, CurrSS, RetSS)); // Step 2. Smoothing. @@ -867,20 +837,16 @@ static inline void ieee80211_extract_country_ie( struct ieee80211_device *ieee, struct ieee80211_info_element *info_element, struct ieee80211_network *network, - u8 * addr2 + u8 *addr2 ) { - if(IS_DOT11D_ENABLE(ieee)) - { - if(info_element->len!= 0) - { + if (IS_DOT11D_ENABLE(ieee)) { + if (info_element->len != 0) { memcpy(network->CountryIeBuf, info_element->data, info_element->len); network->CountryIeLen = info_element->len; - if(!IS_COUNTRY_IE_VALID(ieee)) - { + if (!IS_COUNTRY_IE_VALID(ieee)) Dot11d_UpdateCountryIe(ieee, addr2, info_element->len, info_element->data); - } } // @@ -888,10 +854,8 @@ static inline void ieee80211_extract_country_ie( // some AP (e.g. Cisco 1242) don't include country IE in their // probe response frame. // - if(IS_EQUAL_CIE_SRC(ieee, addr2) ) - { + if (IS_EQUAL_CIE_SRC(ieee, addr2)) UPDATE_CIE_WATCHDOG(ieee); - } } } @@ -920,10 +884,10 @@ inline int ieee80211_network_init( char *p; #endif struct ieee80211_info_element *info_element; - u16 left; + u16 left; u8 i; short offset; - u8 curRate = 0,hOpRate = 0,curRate_ex = 0; + u8 curRate = 0, hOpRate = 0, curRate_ex = 0; /* Pull out fixed field data */ memcpy(network->bssid, beacon->header.addr3, ETH_ALEN); @@ -953,10 +917,10 @@ inline int ieee80211_network_init( } else network->flags |= NETWORK_HAS_CCK; - network->wpa_ie_len = 0; - network->rsn_ie_len = 0; + network->wpa_ie_len = 0; + network->rsn_ie_len = 0; - info_element = &beacon->info_element; + info_element = &beacon->info_element; left = stats->len - ((void *)info_element - (void *)beacon); while (left >= sizeof(struct ieee80211_info_element_hdr)) { if (sizeof(struct ieee80211_info_element_hdr) + info_element->len > left) { @@ -964,7 +928,7 @@ inline int ieee80211_network_init( info_element->len + sizeof(struct ieee80211_info_element), left); return 1; - } + } switch (info_element->id) { case MFIE_TYPE_SSID: @@ -977,8 +941,8 @@ inline int ieee80211_network_init( network->ssid_len = min(info_element->len, (u8)IW_ESSID_MAX_SIZE); memcpy(network->ssid, info_element->data, network->ssid_len); - if (network->ssid_len < IW_ESSID_MAX_SIZE) - memset(network->ssid + network->ssid_len, 0, + if (network->ssid_len < IW_ESSID_MAX_SIZE) + memset(network->ssid + network->ssid_len, 0, IW_ESSID_MAX_SIZE - network->ssid_len); IEEE80211_DEBUG_SCAN("MFIE_TYPE_SSID: '%s' len=%d.\n", @@ -993,7 +957,7 @@ inline int ieee80211_network_init( for (i = 0; i < network->rates_len; i++) { network->rates[i] = info_element->data[i]; curRate = network->rates[i] & 0x7f; - if( hOpRate < curRate ) + if (hOpRate < curRate) hOpRate = curRate; #ifdef CONFIG_IEEE80211_DEBUG p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); @@ -1019,7 +983,7 @@ inline int ieee80211_network_init( for (i = 0; i < network->rates_ex_len; i++) { network->rates_ex[i] = info_element->data[i]; curRate_ex = network->rates_ex[i] & 0x7f; - if( hOpRate < curRate_ex ) + if (hOpRate < curRate_ex) hOpRate = curRate_ex; #ifdef CONFIG_IEEE80211_DEBUG p += snprintf(p, sizeof(rates_str) - (p - rates_str), "%02X ", network->rates[i]); @@ -1038,14 +1002,14 @@ inline int ieee80211_network_init( break; case MFIE_TYPE_DS_SET: - IEEE80211_DEBUG_SCAN("MFIE_TYPE_DS_SET: %d\n", + IEEE80211_DEBUG_SCAN("MFIE_TYPE_DS_SET: %d\n", info_element->data[0]); if (stats->freq == IEEE80211_24GHZ_BAND) network->channel = info_element->data[0]; break; - case MFIE_TYPE_FH_SET: - IEEE80211_DEBUG_SCAN("MFIE_TYPE_FH_SET: ignored\n"); + case MFIE_TYPE_FH_SET: + IEEE80211_DEBUG_SCAN("MFIE_TYPE_FH_SET: ignored\n"); break; case MFIE_TYPE_CF_SET: @@ -1054,12 +1018,12 @@ inline int ieee80211_network_init( case MFIE_TYPE_TIM: - if(info_element->len < 4) + if (info_element->len < 4) break; network->dtim_period = info_element->data[1]; - if(ieee->state != IEEE80211_LINKED) + if (ieee->state != IEEE80211_LINKED) break; network->last_dtim_sta_time[0] = jiffies; @@ -1067,10 +1031,10 @@ inline int ieee80211_network_init( network->dtim_data = IEEE80211_DTIM_VALID; - if(info_element->data[0] != 0) + if (info_element->data[0] != 0) break; - if(info_element->data[2] & 1) + if (info_element->data[2] & 1) network->dtim_data |= IEEE80211_DTIM_MBCAST; offset = (info_element->data[2] >> 1)*2; @@ -1078,8 +1042,8 @@ inline int ieee80211_network_init( //printk("offset1:%x aid:%x\n",offset, ieee->assoc_id); /* add and modified for ps 2008.1.22 */ - if(ieee->assoc_id < 8*offset || - ieee->assoc_id > 8*(offset + info_element->len -3)) { + if (ieee->assoc_id < 8*offset || + ieee->assoc_id > 8*(offset + info_element->len - 3)) { break; } @@ -1089,9 +1053,9 @@ inline int ieee80211_network_init( // info_element->data[3+offset] , // info_element->data[3+offset] & (1<<(ieee->assoc_id%8))); - if(info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) { + if (info_element->data[3+offset] & (1<<(ieee->assoc_id%8))) network->dtim_data |= IEEE80211_DTIM_UCAST; - } + break; case MFIE_TYPE_IBSS_SET: @@ -1125,9 +1089,8 @@ inline int ieee80211_network_init( info_element->data[4] == 0x02) { network->Turbo_Enable = 1; } - if (1 == stats->nic_type) {//nic 87 + if (1 == stats->nic_type) //nic 87 break; - } if (info_element->len >= 5 && info_element->data[0] == 0x00 && @@ -1152,7 +1115,7 @@ inline int ieee80211_network_init( //printk(KERN_WARNING "wmm info¶m updated: %x\n", info_element->data[6]); network->wmm_info = info_element->data[6]; //WMM Parameter Element - memcpy(network->wmm_param, (u8 *)(info_element->data + 8),(info_element->len - 8)); + memcpy(network->wmm_param, (u8 *)(info_element->data + 8), (info_element->len - 8)); network->QoS_Enable = 1; } break; @@ -1174,14 +1137,14 @@ inline int ieee80211_network_init( default: IEEE80211_DEBUG_SCAN("unsupported IE %d\n", info_element->id); - break; - } + break; + } left -= sizeof(struct ieee80211_info_element_hdr) + info_element->len; info_element = (struct ieee80211_info_element *) - &info_element->data[info_element->len]; - } + &info_element->data[info_element->len]; + } //by amy 080312 network->HighestOperaRate = hOpRate; //by amy 080312 @@ -1217,7 +1180,7 @@ inline int ieee80211_network_init( static inline int is_same_network(struct ieee80211_network *src, struct ieee80211_network *dst, - struct ieee80211_device * ieee) + struct ieee80211_device *ieee) { /* A network is only a duplicate if the channel, BSSID, ESSID * and the capability field (in particular IBSS and BSS) all match. @@ -1241,12 +1204,11 @@ inline void update_network(struct ieee80211_network *dst, unsigned char quality = src->stats.signalstrength; unsigned char signal = 0; unsigned char noise = 0; - if(dst->stats.signalstrength > 0) { - quality = (dst->stats.signalstrength * 5 + src->stats.signalstrength + 5)/6; - } + if (dst->stats.signalstrength > 0) + quality = (dst->stats.signalstrength * 5 + src->stats.signalstrength + 5)/6; signal = ieee80211_TranslateToDbm(quality); //noise = signal - src->stats.noise; - if(dst->stats.noise > 0) + if (dst->stats.noise > 0) noise = (dst->stats.noise * 5 + src->stats.noise)/6; //if(strcmp(dst->ssid, "linksys_lzm000") == 0) // printk("ssid:%s, quality:%d, signal:%d\n", dst->ssid, quality, signal); @@ -1262,12 +1224,11 @@ inline void update_network(struct ieee80211_network *dst, dst->rates_len = src->rates_len; memcpy(dst->rates_ex, src->rates_ex, src->rates_ex_len); dst->rates_ex_len = src->rates_ex_len; - dst->HighestOperaRate= src->HighestOperaRate; + dst->HighestOperaRate = src->HighestOperaRate; //printk("==========>in %s: src->ssid is %s,chan is %d\n",__func__,src->ssid,src->channel); //YJ,add,080819,for hidden ap - if(src->ssid_len > 0) - { + if (src->ssid_len > 0) { //if(src->ssid_len == 13) // printk("=====================>>>>>>>> Dst ssid: %s Src ssid: %s\n", dst->ssid, src->ssid); memset(dst->ssid, 0, dst->ssid_len); @@ -1305,11 +1266,11 @@ inline void update_network(struct ieee80211_network *dst, memcpy(dst->wmm_param, src->wmm_param, IEEE80211_AC_PRAM_LEN); } */ - if(src->wmm_param[0].ac_aci_acm_aifsn|| \ - src->wmm_param[1].ac_aci_acm_aifsn|| \ - src->wmm_param[2].ac_aci_acm_aifsn|| \ + if (src->wmm_param[0].ac_aci_acm_aifsn || \ + src->wmm_param[1].ac_aci_acm_aifsn || \ + src->wmm_param[2].ac_aci_acm_aifsn || \ src->wmm_param[3].ac_aci_acm_aifsn) { - memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); + memcpy(dst->wmm_param, src->wmm_param, WME_AC_PRAM_LEN); } dst->QoS_Enable = src->QoS_Enable; #else @@ -1336,7 +1297,7 @@ inline void ieee80211_process_probe_response( unsigned long flags; short renew; u8 wmm_info; - u8 is_beacon = (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_BEACON)? 1:0; //YJ,add,080819,for hidden ap + u8 is_beacon = (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_BEACON) ? 1 : 0; //YJ,add,080819,for hidden ap memset(&network, 0, sizeof(struct ieee80211_network)); @@ -1378,48 +1339,36 @@ inline void ieee80211_process_probe_response( // (2) If there is no any country code in beacon, // then wireless adapter should do active scan from ch1~11 and // passive scan from ch12~14 - if(ieee->bGlobalDomain) - { - if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) - { + if (ieee->bGlobalDomain) { + if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == IEEE80211_STYPE_PROBE_RESP) { // Case 1: Country code - if(IS_COUNTRY_IE_VALID(ieee) ) - { - if( !IsLegalChannel(ieee, network.channel) ) - { + if (IS_COUNTRY_IE_VALID(ieee)) { + if (!IsLegalChannel(ieee, network.channel)) { printk("GetScanInfo(): For Country code, filter probe response at channel(%d).\n", network.channel); return; } } // Case 2: No any country code. - else - { + else { // Filter over channel ch12~14 - if(network.channel > 11) - { + if (network.channel > 11) { printk("GetScanInfo(): For Global Domain, filter probe response at channel(%d).\n", network.channel); return; } } - } - else - { + } else { // Case 1: Country code - if(IS_COUNTRY_IE_VALID(ieee) ) - { - if( !IsLegalChannel(ieee, network.channel) ) - { - printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n",network.channel); + if (IS_COUNTRY_IE_VALID(ieee)) { + if (!IsLegalChannel(ieee, network.channel)) { + printk("GetScanInfo(): For Country code, filter beacon at channel(%d).\n", network.channel); return; } } // Case 2: No any country code. - else - { + else { // Filter over channel ch12~14 - if(network.channel > 14) - { - printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n",network.channel); + if (network.channel > 14) { + printk("GetScanInfo(): For Global Domain, filter beacon at channel(%d).\n", network.channel); return; } } @@ -1437,12 +1386,12 @@ inline void ieee80211_process_probe_response( spin_lock_irqsave(&ieee->lock, flags); - if(is_same_network(&ieee->current_network, &network, ieee)) { + if (is_same_network(&ieee->current_network, &network, ieee)) { wmm_info = ieee->current_network.wmm_info; //YJ,add,080819,for hidden ap - if(is_beacon == 0) + if (is_beacon == 0) network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & ieee->current_network.flags); - else if(ieee->state == IEEE80211_LINKED) + else if (ieee->state == IEEE80211_LINKED) ieee->NumRxBcnInPeriod++; //YJ,add,080819,for hidden ap,end //printk("====>network.ssid=%s cur_ssid=%s\n", network.ssid, ieee->current_network.ssid); @@ -1504,13 +1453,13 @@ inline void ieee80211_process_probe_response( */ renew = !time_after(target->last_scanned + ieee->scan_age, jiffies); //YJ,add,080819,for hidden ap - if(is_beacon == 0) + if (is_beacon == 0) network.flags = (~NETWORK_EMPTY_ESSID & network.flags)|(NETWORK_EMPTY_ESSID & target->flags); //if(strncmp(network.ssid, "linksys-c",9) == 0) // printk("====>2 network.ssid=%s FLAG=%d target.ssid=%s FLAG=%d\n", network.ssid, network.flags, target->ssid, target->flags); - if(((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ + if (((network.flags & NETWORK_EMPTY_ESSID) == NETWORK_EMPTY_ESSID) \ && (((network.ssid_len > 0) && (strncmp(target->ssid, network.ssid, network.ssid_len)))\ - ||((ieee->current_network.ssid_len == network.ssid_len)&&(strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0)&&(ieee->state == IEEE80211_NOLINK)))) + || ((ieee->current_network.ssid_len == network.ssid_len) && (strncmp(ieee->current_network.ssid, network.ssid, network.ssid_len) == 0) && (ieee->state == IEEE80211_NOLINK)))) renew = 1; //YJ,add,080819,for hidden ap,end 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 1ef8fd612732..d9add5305e29 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 union iwreq_data *wrqu, char *b) { int ret; - struct iw_freq *fwrq = & wrqu->freq; + struct iw_freq *fwrq = &wrqu->freq; // printk("in %s\n",__func__); down(&ieee->wx_sem); - if(ieee->iw_mode == IW_MODE_INFRA){ + if (ieee->iw_mode == IW_MODE_INFRA) { ret = -EOPNOTSUPP; goto out; } @@ -57,21 +57,20 @@ int ieee80211_wx_set_freq(struct ieee80211_device *ieee, struct iw_request_info } } - if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1 ){ + if (fwrq->e > 0 || fwrq->m > 14 || fwrq->m < 1) { ret = -EOPNOTSUPP; goto out; - }else { /* Set the channel */ + } else { /* Set the channel */ ieee->current_network.channel = fwrq->m; ieee->set_chan(ieee->dev, ieee->current_network.channel); - if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) - if(ieee->state == IEEE80211_LINKED){ - - ieee80211_stop_send_beacons(ieee); - ieee80211_start_send_beacons(ieee); + if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) + if (ieee->state == IEEE80211_LINKED) { + ieee80211_stop_send_beacons(ieee); + ieee80211_start_send_beacons(ieee); } } @@ -86,7 +85,7 @@ int ieee80211_wx_get_freq(struct ieee80211_device *ieee, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { - struct iw_freq *fwrq = & wrqu->freq; + struct iw_freq *fwrq = &wrqu->freq; if (ieee->current_network.channel == 0) return -1; @@ -143,12 +142,12 @@ int ieee80211_wx_set_wap(struct ieee80211_device *ieee, down(&ieee->wx_sem); /* use ifconfig hw ether */ - if (ieee->iw_mode == IW_MODE_MASTER){ + if (ieee->iw_mode == IW_MODE_MASTER) { ret = -1; goto out; } - if (temp->sa_family != ARPHRD_ETHER){ + if (temp->sa_family != ARPHRD_ETHER) { ret = -EINVAL; goto out; } @@ -175,9 +174,10 @@ out: return ret; } - int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a,union iwreq_data *wrqu,char *b) +int ieee80211_wx_get_essid(struct ieee80211_device *ieee, struct iw_request_info *a, + union iwreq_data *wrqu, char *b) { - int len,ret = 0; + int len, ret = 0; unsigned long flags; if (ieee->iw_mode == IW_MODE_MONITOR) @@ -200,7 +200,7 @@ out: } len = ieee->current_network.ssid_len; wrqu->essid.length = len; - strncpy(b,ieee->current_network.ssid,len); + strncpy(b, ieee->current_network.ssid, len); wrqu->essid.flags = 1; out: @@ -218,11 +218,11 @@ int ieee80211_wx_set_rate(struct ieee80211_device *ieee, u32 target_rate = wrqu->bitrate.value; //added by lizhaoming for auto mode - if(target_rate == -1){ - ieee->rate = 110; - } else { - ieee->rate = target_rate/100000; - } + if (target_rate == -1) + ieee->rate = 110; + else + ieee->rate = target_rate/100000; + //FIXME: we might want to limit rate also in management protocols. return 0; } @@ -250,16 +250,14 @@ int ieee80211_wx_set_mode(struct ieee80211_device *ieee, struct iw_request_info if (wrqu->mode == ieee->iw_mode) goto out; - if (wrqu->mode == IW_MODE_MONITOR){ - + if (wrqu->mode == IW_MODE_MONITOR) ieee->dev->type = ARPHRD_IEEE80211; - }else{ + else ieee->dev->type = ARPHRD_ETHER; - } - if (!ieee->proto_started){ + if (!ieee->proto_started) { ieee->iw_mode = wrqu->mode; - }else{ + } else { ieee80211_stop_protocol(ieee); ieee->iw_mode = wrqu->mode; ieee80211_start_protocol(ieee); @@ -296,7 +294,7 @@ void ieee80211_wx_sync_scan_wq(struct work_struct *work) if (ieee->data_hard_resume) ieee->data_hard_resume(ieee->dev); - if(ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) + if (ieee->iw_mode == IW_MODE_ADHOC || ieee->iw_mode == IW_MODE_MASTER) ieee80211_start_send_beacons(ieee); //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 down(&ieee->wx_sem); - if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)){ + if (ieee->iw_mode == IW_MODE_MONITOR || !(ieee->proto_started)) { ret = -1; goto out; } @@ -323,7 +321,7 @@ int ieee80211_wx_set_scan(struct ieee80211_device *ieee, struct iw_request_info //ieee80211_sta_ps_send_null_frame(ieee, true); //YJ,add,080828,end - if ( ieee->state == IEEE80211_LINKED){ + if (ieee->state == IEEE80211_LINKED) { queue_work(ieee->wq, &ieee->wx_sync_scan_wq); /* intentionally forget to up sem */ return 0; @@ -339,7 +337,7 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { - int ret=0,len; + int ret = 0, len; short proto_started; unsigned long flags; @@ -349,17 +347,17 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, proto_started = ieee->proto_started; - if (wrqu->essid.length > IW_ESSID_MAX_SIZE){ - ret= -E2BIG; + if (wrqu->essid.length > IW_ESSID_MAX_SIZE) { + ret = -E2BIG; goto out; } - if (ieee->iw_mode == IW_MODE_MONITOR){ - ret= -1; + if (ieee->iw_mode == IW_MODE_MONITOR) { + ret = -1; goto out; } - if(proto_started) + if (proto_started) ieee80211_stop_protocol(ieee); /* this is just to be sure that the GET wx callback @@ -377,13 +375,12 @@ int ieee80211_wx_set_essid(struct ieee80211_device *ieee, //YJ,modified,080819,end //YJ,add,080819,for hidden ap - if(len == 0){ + if (len == 0) { memset(ieee->current_network.bssid, 0, ETH_ALEN); ieee->current_network.capability = 0; } //YJ,add,080819,for hidden ap,end - } - else{ + } else { ieee->ssid_set = 0; ieee->current_network.ssid[0] = '\0'; ieee->current_network.ssid_len = 0; @@ -398,7 +395,7 @@ out: return ret; } - int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, +int ieee80211_wx_get_mode(struct ieee80211_device *ieee, struct iw_request_info *a, union iwreq_data *wrqu, char *b) { @@ -406,7 +403,7 @@ out: return 0; } - int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, +int ieee80211_wx_set_rawtx(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { @@ -417,24 +414,23 @@ out: down(&ieee->wx_sem); - if(enable) + if (enable) ieee->raw_tx = 1; else ieee->raw_tx = 0; - printk(KERN_INFO"raw TX is %s\n", - ieee->raw_tx ? "enabled" : "disabled"); + netdev_info(ieee->dev, "raw TX is %s\n", + ieee->raw_tx ? "enabled" : "disabled"); - if(ieee->iw_mode == IW_MODE_MONITOR) - { - if(prev == 0 && ieee->raw_tx){ + if (ieee->iw_mode == IW_MODE_MONITOR) { + if (prev == 0 && ieee->raw_tx) { if (ieee->data_hard_resume) ieee->data_hard_resume(ieee->dev); netif_carrier_on(ieee->dev); } - if(prev && ieee->raw_tx == 1) + if (prev && ieee->raw_tx == 1) netif_carrier_off(ieee->dev); } @@ -448,18 +444,18 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, union iwreq_data *wrqu, char *extra) { strlcpy(wrqu->name, "802.11", IFNAMSIZ); - if(ieee->modulation & IEEE80211_CCK_MODULATION){ + if (ieee->modulation & IEEE80211_CCK_MODULATION) { strlcat(wrqu->name, "b", IFNAMSIZ); - if(ieee->modulation & IEEE80211_OFDM_MODULATION) + if (ieee->modulation & IEEE80211_OFDM_MODULATION) strlcat(wrqu->name, "/g", IFNAMSIZ); - }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) + } else if (ieee->modulation & IEEE80211_OFDM_MODULATION) strlcat(wrqu->name, "g", IFNAMSIZ); - if((ieee->state == IEEE80211_LINKED) || + if ((ieee->state == IEEE80211_LINKED) || (ieee->state == IEEE80211_LINKED_SCANNING)) - strlcat(wrqu->name," link", IFNAMSIZ); - else if(ieee->state != IEEE80211_NOLINK) - strlcat(wrqu->name," .....", IFNAMSIZ); + strlcat(wrqu->name, " link", IFNAMSIZ); + else if (ieee->state != IEEE80211_NOLINK) + strlcat(wrqu->name, " .....", IFNAMSIZ); return 0; @@ -473,11 +469,10 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, { int ret = 0; - if( - (!ieee->sta_wake_up) || - (!ieee->ps_request_tx_ack) || - (!ieee->enter_sleep_state) || - (!ieee->ps_is_queue_empty)){ + if ((!ieee->sta_wake_up) || + (!ieee->ps_request_tx_ack) || + (!ieee->enter_sleep_state) || + (!ieee->ps_is_queue_empty)) { printk("ERROR. PS mode tried to be use but driver missed a callback\n\n"); @@ -486,7 +481,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, down(&ieee->wx_sem); - if (wrqu->power.disabled){ + if (wrqu->power.disabled) { ieee->ps = IEEE80211_PS_DISABLED; goto exit; @@ -512,7 +507,7 @@ int ieee80211_wx_set_power(struct ieee80211_device *ieee, if (wrqu->power.flags & IW_POWER_TIMEOUT) { ieee->ps_timeout = wrqu->power.value / 1000; - printk("Timeout %d\n",ieee->ps_timeout); + printk("Timeout %d\n", ieee->ps_timeout); } if (wrqu->power.flags & IW_POWER_PERIOD) { @@ -533,11 +528,11 @@ int ieee80211_wx_get_power(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { - int ret =0; + int ret = 0; down(&ieee->wx_sem); - if(ieee->ps == IEEE80211_PS_DISABLED){ + if (ieee->ps == IEEE80211_PS_DISABLED) { wrqu->power.disabled = 1; goto exit; } |