summaryrefslogtreecommitdiff
path: root/drivers/staging/rtl8187se
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/rtl8187se')
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211.h6
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c24
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.h2
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_ccmp.c38
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_crypt_wep.c18
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_module.c23
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c321
-rw-r--r--drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c121
-rw-r--r--drivers/staging/rtl8187se/r8180.h28
-rw-r--r--drivers/staging/rtl8187se/r8180_core.c496
-rw-r--r--drivers/staging/rtl8187se/r8180_dm.h4
-rw-r--r--drivers/staging/rtl8187se/r8180_rtl8225.h4
-rw-r--r--drivers/staging/rtl8187se/r8180_rtl8225z2.c229
-rw-r--r--drivers/staging/rtl8187se/r8180_wx.c2
-rw-r--r--drivers/staging/rtl8187se/r8185b_init.c239
15 files changed, 380 insertions, 1175 deletions
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
index 5f5a3022..8fc9f58 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 b3882ae..694eae3 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 b58a3bc..0b4ea43 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 6aaaa2f..f5949e8 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 58f3eeb..bba7714 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 9422573..4358c4b 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 3a72449..446f15e 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&param 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 1ef8fd6..d9add53 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;
}
diff --git a/drivers/staging/rtl8187se/r8180.h b/drivers/staging/rtl8187se/r8180.h
index 2682afb..70ea414 100644
--- a/drivers/staging/rtl8187se/r8180.h
+++ b/drivers/staging/rtl8187se/r8180.h
@@ -327,12 +327,8 @@ typedef struct r8180_priv
int irq;
struct ieee80211_device *ieee80211;
- short phy_ver; /* meaningful for rtl8225 1:A 2:B 3:C */
- short enable_gpio0;
- short hw_plcp_len;
short plcp_preamble_mode; // 0:auto 1:short 2:long
- spinlock_t irq_lock;
spinlock_t irq_th_lock;
spinlock_t tx_lock;
spinlock_t ps_lock;
@@ -350,7 +346,6 @@ typedef struct r8180_priv
u8 channel_plan; // it's the channel plan index
short up;
short crcmon; //if 1 allow bad crc frame reception in monitor mode
- short prism_hdr;
struct timer_list scan_timer;
/*short scanpending;
@@ -359,14 +354,11 @@ typedef struct r8180_priv
u8 active_probe;
//u8 active_scan_num;
struct semaphore wx_sem;
- struct semaphore rf_state;
short hw_wep;
short digphy;
short antb;
short diversity;
- u8 cs_treshold;
- short rcr_csense;
u32 key0[4];
short (*rf_set_sens)(struct net_device *dev,short sens);
void (*rf_set_chan)(struct net_device *dev,short ch);
@@ -491,7 +483,6 @@ typedef struct r8180_priv
RT_RF_POWER_STATE eRFPowerState;
u32 RfOffReason;
bool RFChangeInProgress;
- bool bInHctTest;
bool SetRFPowerStateInProgress;
u8 RFProgType;
bool bLeisurePs;
@@ -618,17 +609,11 @@ typedef struct r8180_priv
// struct workqueue_struct *workqueue;
struct work_struct reset_wq;
struct work_struct watch_dog_wq;
- struct work_struct tx_irq_wq;
short ack_tx_to_ieee;
- u8 PowerProfile;
- u32 CSMethod;
- u8 cck_txpwr_base;
- u8 ofdm_txpwr_base;
u8 dma_poll_stop_mask;
//u8 RegThreeWireMode;
- u8 MWIEnable;
u16 ShortRetryLimit;
u16 LongRetryLimit;
u16 EarlyRxThreshold;
@@ -667,35 +652,22 @@ void write_nic_dword(struct net_device *dev, int x,u32 y);
void force_pci_posting(struct net_device *dev);
void rtl8180_rtx_disable(struct net_device *);
-void rtl8180_rx_enable(struct net_device *);
-void rtl8180_tx_enable(struct net_device *);
-void rtl8180_start_scanning(struct net_device *dev);
-void rtl8180_start_scanning_s(struct net_device *dev);
-void rtl8180_stop_scanning(struct net_device *dev);
-void rtl8180_disassociate(struct net_device *dev);
-//void fix_rx_fifo(struct net_device *dev);
void rtl8180_set_anaparam(struct net_device *dev,u32 a);
void rtl8185_set_anaparam2(struct net_device *dev,u32 a);
void rtl8180_set_hw_wep(struct net_device *dev);
void rtl8180_no_hw_wep(struct net_device *dev);
void rtl8180_update_msr(struct net_device *dev);
-//void rtl8180_BSS_create(struct net_device *dev);
void rtl8180_beacon_tx_disable(struct net_device *dev);
void rtl8180_beacon_rx_disable(struct net_device *dev);
-void rtl8180_conttx_enable(struct net_device *dev);
-void rtl8180_conttx_disable(struct net_device *dev);
int rtl8180_down(struct net_device *dev);
int rtl8180_up(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
void rtl8180_set_chan(struct net_device *dev,short ch);
-void rtl8180_set_master_essid(struct net_device *dev,char *essid);
-void rtl8180_update_beacon_security(struct net_device *dev);
void write_phy(struct net_device *dev, u8 adr, u8 data);
void write_phy_cck(struct net_device *dev, u8 adr, u32 data);
void write_phy_ofdm(struct net_device *dev, u8 adr, u32 data);
void rtl8185_tx_antenna(struct net_device *dev, u8 ant);
void rtl8185_rf_pins_enable(struct net_device *dev);
-void IBSS_randomize_cell(struct net_device *dev);
void IPSEnter(struct net_device *dev);
void IPSLeave(struct net_device *dev);
int get_curr_tx_free_desc(struct net_device *dev, int priority);
diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
index 20e5fb5..ae38475 100644
--- a/drivers/staging/rtl8187se/r8180_core.c
+++ b/drivers/staging/rtl8187se/r8180_core.c
@@ -27,6 +27,8 @@
Written by Mariusz Matuszek.
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#undef RX_DONT_PASS_UL
#undef DUMMY_RX
@@ -44,7 +46,7 @@
#include "ieee80211/dot11d.h"
-static struct pci_device_id rtl8180_pci_id_tbl[] __devinitdata = {
+static struct pci_device_id rtl8180_pci_id_tbl[] = {
{
.vendor = PCI_VENDOR_ID_REALTEK,
.device = 0x8199,
@@ -61,33 +63,23 @@ static struct pci_device_id rtl8180_pci_id_tbl[] __devinitdata = {
}
};
-
static char ifname[IFNAMSIZ] = "wlan%d";
-static int hwseqnum = 0;
-static int hwwep = 0;
-static int channels = 0x3fff;
+static int hwwep;
MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(pci, rtl8180_pci_id_tbl);
MODULE_AUTHOR("Andrea Merello <andreamrl@tiscali.it>");
-MODULE_DESCRIPTION("Linux driver for Realtek RTL8180 / RTL8185 WiFi cards");
-
+MODULE_DESCRIPTION("Linux driver for Realtek RTL8187SE WiFi cards");
module_param_string(ifname, ifname, sizeof(ifname), S_IRUGO|S_IWUSR);
-module_param(hwseqnum, int, S_IRUGO|S_IWUSR);
module_param(hwwep, int, S_IRUGO|S_IWUSR);
-module_param(channels, int, S_IRUGO|S_IWUSR);
-MODULE_PARM_DESC(devname, " Net interface name, wlan%d=default");
-MODULE_PARM_DESC(hwseqnum, " Try to use hardware 802.11 header sequence numbers. Zero=default");
MODULE_PARM_DESC(hwwep, " Try to use hardware WEP support. Still broken and not available on all cards");
-MODULE_PARM_DESC(channels, " Channel bitmask for specific locales. NYI");
-
-static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
+static int rtl8180_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id);
-static void __devexit rtl8180_pci_remove(struct pci_dev *pdev);
+static void rtl8180_pci_remove(struct pci_dev *pdev);
static void rtl8180_shutdown(struct pci_dev *pdev)
{
@@ -126,8 +118,7 @@ static int rtl8180_resume(struct pci_dev *pdev)
err = pci_enable_device(pdev);
if (err) {
- printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
- dev->name);
+ dev_err(&pdev->dev, "pci_enable_device failed on resume\n");
return err;
}
@@ -159,7 +150,7 @@ static struct pci_driver rtl8180_pci_driver = {
.name = RTL8180_MODULE_NAME,
.id_table = rtl8180_pci_id_tbl,
.probe = rtl8180_pci_probe,
- .remove = __devexit_p(rtl8180_pci_remove),
+ .remove = rtl8180_pci_remove,
.suspend = rtl8180_suspend,
.resume = rtl8180_resume,
.shutdown = rtl8180_shutdown,
@@ -211,7 +202,7 @@ static struct net_device_stats *rtl8180_stats(struct net_device *dev);
void rtl8180_commit(struct net_device *dev);
void rtl8180_start_tx_beacon(struct net_device *dev);
-static struct proc_dir_entry *rtl8180_proc = NULL;
+static struct proc_dir_entry *rtl8180_proc;
static int proc_get_registers(char *page, char **start,
off_t offset, int count,
@@ -323,7 +314,6 @@ void rtl8180_proc_remove_one(struct net_device *dev)
remove_proc_entry("stats-tx", priv->dir_dev);
remove_proc_entry("stats-rx", priv->dir_dev);
remove_proc_entry("registers", priv->dir_dev);
- remove_proc_entry(dev->name, rtl8180_proc);
priv->dir_dev = NULL;
}
}
@@ -444,24 +434,6 @@ void buffer_free(struct net_device *dev, struct buffer **buffer, int len, short
*buffer = NULL;
}
-void print_buffer(u32 *buffer, int len)
-{
- int i;
- u8 *buf = (u8 *)buffer;
-
- printk("ASCII BUFFER DUMP (len: %x):\n", len);
-
- for (i = 0; i < len; i++)
- printk("%c", buf[i]);
-
- printk("\nBINARY BUFFER DUMP (len: %x):\n", len);
-
- for (i = 0; i < len; i++)
- printk("%02x", buf[i]);
-
- printk("\n");
-}
-
int get_curr_tx_free_desc(struct net_device *dev, int priority)
{
struct r8180_priv *priv = ieee80211_priv(dev);
@@ -635,74 +607,6 @@ void fix_rx_fifo(struct net_device *dev)
set_nic_rxring(dev);
}
-unsigned char QUALITY_MAP[] = {
- 0x64, 0x64, 0x64, 0x63, 0x63, 0x62, 0x62, 0x61,
- 0x61, 0x60, 0x60, 0x5f, 0x5f, 0x5e, 0x5d, 0x5c,
- 0x5b, 0x5a, 0x59, 0x57, 0x56, 0x54, 0x52, 0x4f,
- 0x4c, 0x49, 0x45, 0x41, 0x3c, 0x37, 0x31, 0x29,
- 0x24, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22,
- 0x22, 0x22, 0x21, 0x21, 0x21, 0x21, 0x21, 0x20,
- 0x20, 0x20, 0x20, 0x1f, 0x1f, 0x1e, 0x1e, 0x1e,
- 0x1d, 0x1d, 0x1c, 0x1c, 0x1b, 0x1a, 0x19, 0x19,
- 0x18, 0x17, 0x16, 0x15, 0x14, 0x12, 0x11, 0x0f,
- 0x0e, 0x0c, 0x0a, 0x08, 0x06, 0x04, 0x01, 0x00
-};
-
-unsigned char STRENGTH_MAP[] = {
- 0x64, 0x64, 0x63, 0x62, 0x61, 0x60, 0x5f, 0x5e,
- 0x5d, 0x5c, 0x5b, 0x5a, 0x57, 0x54, 0x52, 0x50,
- 0x4e, 0x4c, 0x4a, 0x48, 0x46, 0x44, 0x41, 0x3f,
- 0x3c, 0x3a, 0x37, 0x36, 0x36, 0x1c, 0x1c, 0x1b,
- 0x1b, 0x1a, 0x1a, 0x19, 0x19, 0x18, 0x18, 0x17,
- 0x17, 0x16, 0x16, 0x15, 0x15, 0x14, 0x14, 0x13,
- 0x13, 0x12, 0x12, 0x11, 0x11, 0x10, 0x10, 0x0f,
- 0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b,
- 0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07,
- 0x07, 0x06, 0x06, 0x05, 0x04, 0x03, 0x02, 0x00
-};
-
-void rtl8180_RSSI_calc(struct net_device *dev, u8 *rssi, u8 *qual)
-{
- u32 temp;
- u32 temp2;
- u32 q;
- u32 orig_qual;
- u8 _rssi;
-
- q = *qual;
- orig_qual = *qual;
- _rssi = 0; /* avoid gcc complains.. */
-
- if (q <= 0x4e) {
- temp = QUALITY_MAP[q];
- } else {
- if (q & 0x80)
- temp = 0x32;
- else
- temp = 1;
- }
-
- *qual = temp;
- temp2 = *rssi;
-
- if (_rssi < 0x64) {
- if (_rssi == 0)
- *rssi = 1;
- } else {
- *rssi = 0x64;
- }
-
- return;
-}
-
-void rtl8180_irq_enable(struct net_device *dev)
-{
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- priv->irq_enabled = 1;
- write_nic_word(dev, INTA_MASK, priv->irq_mask);
-}
-
void rtl8180_irq_disable(struct net_device *dev)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -724,7 +628,6 @@ void rtl8180_set_mode(struct net_device *dev, int mode)
write_nic_byte(dev, EPROM_CMD, ecmd);
}
-void rtl8180_adapter_start(struct net_device *dev);
void rtl8180_beacon_tx_enable(struct net_device *dev);
void rtl8180_update_msr(struct net_device *dev)
@@ -771,57 +674,6 @@ void rtl8180_set_chan(struct net_device *dev, short ch)
priv->rf_set_chan(dev, priv->chan);
}
-void rtl8180_rx_enable(struct net_device *dev)
-{
- u8 cmd;
- u32 rxconf;
- /* for now we accept data, management & ctl frame*/
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- rxconf = read_nic_dword(dev, RX_CONF);
- rxconf = rxconf & ~MAC_FILTER_MASK;
- rxconf = rxconf | (1<<ACCEPT_MNG_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_DATA_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_BCAST_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_MCAST_FRAME_SHIFT);
- if (dev->flags & IFF_PROMISC)
- DMESG("NIC in promisc mode");
-
- if (priv->ieee80211->iw_mode == IW_MODE_MONITOR || \
- dev->flags & IFF_PROMISC) {
- rxconf = rxconf | (1<<ACCEPT_ALLMAC_FRAME_SHIFT);
- } else {
- rxconf = rxconf | (1<<ACCEPT_NICMAC_FRAME_SHIFT);
- }
-
- if (priv->ieee80211->iw_mode == IW_MODE_MONITOR) {
- rxconf = rxconf | (1<<ACCEPT_CTL_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_ICVERR_FRAME_SHIFT);
- rxconf = rxconf | (1<<ACCEPT_PWR_FRAME_SHIFT);
- }
-
- if (priv->crcmon == 1 && priv->ieee80211->iw_mode == IW_MODE_MONITOR)
- rxconf = rxconf | (1<<ACCEPT_CRCERR_FRAME_SHIFT);
-
- rxconf = rxconf & ~RX_FIFO_THRESHOLD_MASK;
- rxconf = rxconf | (RX_FIFO_THRESHOLD_NONE << RX_FIFO_THRESHOLD_SHIFT);
-
- rxconf = rxconf | (1<<RX_AUTORESETPHY_SHIFT);
- rxconf = rxconf & ~MAX_RX_DMA_MASK;
- rxconf = rxconf | (MAX_RX_DMA_2048<<MAX_RX_DMA_SHIFT);
-
- rxconf = rxconf | RCR_ONLYERLPKT;
-
- rxconf = rxconf & ~RCR_CS_MASK;
-
- write_nic_dword(dev, RX_CONF, rxconf);
-
- fix_rx_fifo(dev);
-
- cmd = read_nic_byte(dev, CMD);
- write_nic_byte(dev, CMD, cmd | (1<<CMD_RX_ENABLE_SHIFT));
-}
-
void set_nic_txring(struct net_device *dev)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -835,80 +687,6 @@ void set_nic_txring(struct net_device *dev)
write_nic_dword(dev, TX_BEACON_RING_ADDR, priv->txbeaconringdma);
}
-void rtl8180_conttx_enable(struct net_device *dev)
-{
- u32 txconf;
-
- txconf = read_nic_dword(dev, TX_CONF);
- txconf = txconf & ~TX_LOOPBACK_MASK;
- txconf = txconf | (TX_LOOPBACK_CONTINUE<<TX_LOOPBACK_SHIFT);
- write_nic_dword(dev, TX_CONF, txconf);
-}
-
-void rtl8180_conttx_disable(struct net_device *dev)
-{
- u32 txconf;
-
- txconf = read_nic_dword(dev, TX_CONF);
- txconf = txconf & ~TX_LOOPBACK_MASK;
- txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
- write_nic_dword(dev, TX_CONF, txconf);
-}
-
-void rtl8180_tx_enable(struct net_device *dev)
-{
- u8 cmd;
- u8 tx_agc_ctl;
- u8 byte;
- u32 txconf;
- struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
-
- txconf = read_nic_dword(dev, TX_CONF);
-
- byte = read_nic_byte(dev, CW_CONF);
- byte &= ~(1<<CW_CONF_PERPACKET_CW_SHIFT);
- byte &= ~(1<<CW_CONF_PERPACKET_RETRY_SHIFT);
- write_nic_byte(dev, CW_CONF, byte);
-
- tx_agc_ctl = read_nic_byte(dev, TX_AGC_CTL);
- tx_agc_ctl &= ~(1<<TX_AGC_CTL_PERPACKET_GAIN_SHIFT);
- tx_agc_ctl &= ~(1<<TX_AGC_CTL_PERPACKET_ANTSEL_SHIFT);
- tx_agc_ctl |= (1<<TX_AGC_CTL_FEEDBACK_ANT);
- write_nic_byte(dev, TX_AGC_CTL, tx_agc_ctl);
- write_nic_byte(dev, 0xec, 0x3f); /* Disable early TX */
-
- txconf = txconf & ~(1<<TCR_PROBE_NOTIMESTAMP_SHIFT);
-
- txconf = txconf & ~TX_LOOPBACK_MASK;
- txconf = txconf | (TX_LOOPBACK_NONE<<TX_LOOPBACK_SHIFT);
- txconf = txconf & ~TCR_DPRETRY_MASK;
- txconf = txconf & ~TCR_RTSRETRY_MASK;
- txconf = txconf | (priv->retry_data<<TX_DPRETRY_SHIFT);
- txconf = txconf | (priv->retry_rts<<TX_RTSRETRY_SHIFT);
- txconf = txconf & ~(1<<TX_NOCRC_SHIFT);
-
- if (priv->hw_plcp_len)
- txconf = txconf & ~TCR_PLCP_LEN;
- else
- txconf = txconf | TCR_PLCP_LEN;
-
- txconf = txconf & ~TCR_MXDMA_MASK;
- txconf = txconf | (TCR_MXDMA_2048<<TCR_MXDMA_SHIFT);
- txconf = txconf | TCR_CWMIN;
- txconf = txconf | TCR_DISCW;
-
- txconf = txconf | (1 << TX_NOICV_SHIFT);
-
- write_nic_dword(dev, TX_CONF, txconf);
-
- fix_tx_fifo(dev);
-
- cmd = read_nic_byte(dev, CMD);
- write_nic_byte(dev, CMD, cmd | (1<<CMD_TX_ENABLE_SHIFT));
-
- write_nic_dword(dev, TX_CONF, txconf);
-}
-
void rtl8180_beacon_tx_enable(struct net_device *dev)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -936,8 +714,8 @@ void rtl8180_rtx_disable(struct net_device *dev)
struct r8180_priv *priv = ieee80211_priv(dev);
cmd = read_nic_byte(dev, CMD);
- write_nic_byte(dev, CMD, cmd & ~\
- ((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
+ write_nic_byte(dev, CMD, cmd &
+ ~((1<<CMD_RX_ENABLE_SHIFT)|(1<<CMD_TX_ENABLE_SHIFT)));
force_pci_posting(dev);
mdelay(10);
@@ -1481,8 +1259,7 @@ void rtl8180_rx(struct net_device *dev)
pci_dma_sync_single_for_cpu(priv->pdev,
priv->rxbuffer->dma,
- priv->rxbuffersize * \
- sizeof(u8),
+ priv->rxbuffersize * sizeof(u8),
PCI_DMA_FROMDEVICE);
first = *(priv->rxringtail) & (1<<29) ? 1 : 0;
@@ -1660,14 +1437,9 @@ void rtl8180_rx(struct net_device *dev)
dev_kfree_skb_any(priv->rx_skb);
priv->stats.rxnolast++;
}
- /* support for prism header has been originally added by Christian */
- if (priv->prism_hdr && priv->ieee80211->iw_mode == IW_MODE_MONITOR) {
-
- } else {
- priv->rx_skb = dev_alloc_skb(len+2);
- if (!priv->rx_skb)
- goto drop;
- }
+ priv->rx_skb = dev_alloc_skb(len+2);
+ if (!priv->rx_skb)
+ goto drop;
priv->rx_skb_complete = 0;
priv->rx_skb->dev = dev;
@@ -1718,8 +1490,7 @@ void rtl8180_rx(struct net_device *dev)
pci_dma_sync_single_for_device(priv->pdev,
priv->rxbuffer->dma,
- priv->rxbuffersize * \
- sizeof(u8),
+ priv->rxbuffersize * sizeof(u8),
PCI_DMA_FROMDEVICE);
drop: /* this is used when we have not enough mem */
@@ -1929,7 +1700,7 @@ void rtl8180_prepare_beacon(struct net_device *dev)
* descriptor in the ring buffer, copyes the frame in a TX buffer
* and kicks the NIC to ensure it does the DMA transfer.
*/
-short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, int priority,
+short rtl8180_tx(struct net_device *dev, u8 *txbuf, int len, int priority,
short morefrag, short descfrag, int rate)
{
struct r8180_priv *priv = ieee80211_priv(dev);
@@ -1940,8 +1711,6 @@ short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, int priority,
int remain;
int buflen;
int count;
- u16 duration;
- short ext;
struct buffer *buflist;
struct ieee80211_hdr_3addr *frag_hdr = (struct ieee80211_hdr_3addr *)txbuf;
u8 dest[ETH_ALEN];
@@ -2137,15 +1906,6 @@ short rtl8180_tx(struct net_device *dev, u8* txbuf, int len, int priority,
*tail = *tail | ((rate&0xf) << 24);
- /* hw_plcp_len is not used for rtl8180 chip */
- /* FIXME */
- if (!priv->hw_plcp_len) {
- duration = rtl8180_len2duration(len, rate, &ext);
- *(tail+1) = *(tail+1) | ((duration & 0x7fff)<<16);
- if (ext)
- *(tail+1) = *(tail+1) | (1<<31); /* plcp length extension */
- }
-
if (morefrag)
*tail = (*tail) | (1<<17); /* more fragment */
if (!remain)
@@ -2223,10 +1983,10 @@ void rtl8180_link_change(struct net_device *dev)
write_nic_dword(dev, BSSID, ((u32 *)net->bssid)[0]);
write_nic_word(dev, BSSID+4, ((u16 *)net->bssid)[2]);
- beacon_interval = read_nic_dword(dev, BEACON_INTERVAL);
+ beacon_interval = read_nic_word(dev, BEACON_INTERVAL);
beacon_interval &= ~BEACON_INTERVAL_MASK;
beacon_interval |= net->beacon_interval;
- write_nic_dword(dev, BEACON_INTERVAL, beacon_interval);
+ write_nic_word(dev, BEACON_INTERVAL, beacon_interval);
rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
@@ -2279,8 +2039,6 @@ short rtl8180_is_tx_queue_empty(struct net_device *dev)
return 0;
return 1;
}
-/* FIXME FIXME 5msecs is random */
-#define HW_WAKE_DELAY 5
void rtl8180_hw_wakeup(struct net_device *dev)
{
@@ -2397,7 +2155,8 @@ void rtl8180_wmm_param_update(struct work_struct *work)
write_nic_dword(dev, AC_VO_PARAM, u4bAcParam);
break;
default:
- printk(KERN_WARNING "SetHwReg8185():invalid ACI: %d!\n", eACI);
+ pr_warn("SetHwReg8185():invalid ACI: %d!\n",
+ eACI);
break;
}
}
@@ -2436,7 +2195,8 @@ void rtl8180_wmm_param_update(struct work_struct *work)
write_nic_dword(dev, AC_VO_PARAM, u4bAcParam);
break;
default:
- printk(KERN_WARNING "SetHwReg8185(): invalid ACI: %d !\n", eACI);
+ pr_warn("SetHwReg8185(): invalid ACI: %d !\n",
+ eACI);
break;
}
}
@@ -2444,7 +2204,6 @@ void rtl8180_wmm_param_update(struct work_struct *work)
}
}
-void rtl8180_tx_irq_wq(struct work_struct *work);
void rtl8180_restart_wq(struct work_struct *work);
/* void rtl8180_rq_tx_ack(struct work_struct *work); */
void rtl8180_watch_dog_wq(struct work_struct *work);
@@ -2455,7 +2214,7 @@ void rtl8180_watch_dog(struct net_device *dev);
void watch_dog_adaptive(unsigned long data)
{
- struct r8180_priv* priv = ieee80211_priv((struct net_device *)data);
+ struct r8180_priv *priv = ieee80211_priv((struct net_device *)data);
if (!priv->up) {
DMESG("<----watch_dog_adaptive():driver is not up!\n");
@@ -2601,8 +2360,7 @@ short rtl8180_init(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
u16 word;
- u16 version;
- u32 usValue;
+ u16 usValue;
u16 tmpu16;
int i, j;
struct eeprom_93cx6 eeprom;
@@ -2634,7 +2392,6 @@ short rtl8180_init(struct net_device *dev)
priv->RFChangeInProgress = false;
priv->SetRFPowerStateInProgress = false;
priv->RFProgType = 0;
- priv->bInHctTest = false;
priv->irq_enabled = 0;
@@ -2658,14 +2415,12 @@ short rtl8180_init(struct net_device *dev)
priv->ieee80211->ps_is_queue_empty = rtl8180_is_tx_queue_empty;
priv->hw_wep = hwwep;
- priv->prism_hdr = 0;
priv->dev = dev;
priv->retry_rts = DEFAULT_RETRY_RTS;
priv->retry_data = DEFAULT_RETRY_DATA;
priv->RFChangeInProgress = false;
priv->SetRFPowerStateInProgress = false;
priv->RFProgType = 0;
- priv->bInHctTest = false;
priv->bInactivePs = true; /* false; */
priv->ieee80211->bInactivePs = priv->bInactivePs;
priv->bSwRfProcessing = false;
@@ -2726,7 +2481,6 @@ short rtl8180_init(struct net_device *dev)
priv->NumTxOkTotal = 0;
priv->NumTxUnicast = 0;
priv->keepAliveLevel = DEFAULT_KEEP_ALIVE_LEVEL;
- priv->PowerProfile = POWER_PROFILE_AC;
priv->CurrRetryCnt = 0;
priv->LastRetryCnt = 0;
priv->LastTxokCnt = 0;
@@ -2748,15 +2502,12 @@ short rtl8180_init(struct net_device *dev)
priv->RegBModeGainStage = 1;
priv->promisc = (dev->flags & IFF_PROMISC) ? 1 : 0;
- spin_lock_init(&priv->irq_lock);
spin_lock_init(&priv->irq_th_lock);
spin_lock_init(&priv->tx_lock);
spin_lock_init(&priv->ps_lock);
spin_lock_init(&priv->rf_ps_lock);
sema_init(&priv->wx_sem, 1);
- sema_init(&priv->rf_state, 1);
INIT_WORK(&priv->reset_wq, (void *)rtl8180_restart_wq);
- INIT_WORK(&priv->tx_irq_wq, (void *)rtl8180_tx_irq_wq);
INIT_DELAYED_WORK(&priv->ieee80211->hw_wakeup_wq,
(void *)rtl8180_hw_wakeup_wq);
INIT_DELAYED_WORK(&priv->ieee80211->hw_sleep_wq,
@@ -2798,19 +2549,14 @@ short rtl8180_init(struct net_device *dev)
priv->ieee80211->stop_send_beacons = rtl8180_beacon_tx_disable;
priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD;
- priv->MWIEnable = 0;
-
priv->ShortRetryLimit = 7;
priv->LongRetryLimit = 7;
priv->EarlyRxThreshold = 7;
- priv->CSMethod = (0x01 << 29);
-
- priv->TransmitConfig = TCR_DurProcMode_OFFSET |
+ priv->TransmitConfig = (1<<TCR_DurProcMode_OFFSET) |
(7<<TCR_MXDMA_OFFSET) |
(priv->ShortRetryLimit<<TCR_SRL_OFFSET) |
- (priv->LongRetryLimit<<TCR_LRL_OFFSET) |
- (0 ? TCR_SAT : 0);
+ (priv->LongRetryLimit<<TCR_LRL_OFFSET);
priv->ReceiveConfig = RCR_AMF | RCR_ADF | RCR_ACF |
RCR_AB | RCR_AM | RCR_APM |
@@ -2832,47 +2578,35 @@ short rtl8180_init(struct net_device *dev)
priv->InitialGain = 6;
DMESG("MAC controller is a RTL8187SE b/g");
- priv->phy_ver = 2;
priv->ieee80211->modulation |= IEEE80211_OFDM_MODULATION;
priv->ieee80211->short_slot = 1;
- /* just for sync 85 */
- priv->enable_gpio0 = 0;
-
- eeprom_93cx6_read(&eeprom, EEPROM_SW_REVD_OFFSET, &eeprom_val);
- usValue = eeprom_val;
- DMESG("usValue is 0x%x\n", usValue);
+ eeprom_93cx6_read(&eeprom, EEPROM_SW_REVD_OFFSET, &usValue);
+ DMESG("usValue is %#hx\n", usValue);
/* 3Read AntennaDiversity */
/* SW Antenna Diversity. */
- if ((usValue & EEPROM_SW_AD_MASK) != EEPROM_SW_AD_ENABLE)
- priv->EEPROMSwAntennaDiversity = false;
- else
- priv->EEPROMSwAntennaDiversity = true;
+ priv->EEPROMSwAntennaDiversity = (usValue & EEPROM_SW_AD_MASK) ==
+ EEPROM_SW_AD_ENABLE;
/* Default Antenna to use. */
- if ((usValue & EEPROM_DEF_ANT_MASK) != EEPROM_DEF_ANT_1)
- priv->EEPROMDefaultAntenna1 = false;
- else
- priv->EEPROMDefaultAntenna1 = true;
+ priv->EEPROMDefaultAntenna1 = (usValue & EEPROM_DEF_ANT_MASK) ==
+ EEPROM_DEF_ANT_1;
if (priv->RegSwAntennaDiversityMechanism == 0) /* Auto */
/* 0: default from EEPROM. */
priv->bSwAntennaDiverity = priv->EEPROMSwAntennaDiversity;
else
/* 1:disable antenna diversity, 2: enable antenna diversity. */
- priv->bSwAntennaDiverity = ((priv->RegSwAntennaDiversityMechanism == 1) ? false : true);
+ priv->bSwAntennaDiverity = priv->RegSwAntennaDiversityMechanism == 2;
if (priv->RegDefaultAntenna == 0)
/* 0: default from EEPROM. */
priv->bDefaultAntenna1 = priv->EEPROMDefaultAntenna1;
else
/* 1: main, 2: aux. */
- priv->bDefaultAntenna1 = ((priv->RegDefaultAntenna == 2) ? true : false);
-
- /* rtl8185 can calc plcp len in HW. */
- priv->hw_plcp_len = 1;
+ priv->bDefaultAntenna1 = priv->RegDefaultAntenna == 2;
priv->plcp_preamble_mode = 2;
/* the eeprom type is stored in RCR register bit #6 */
@@ -2909,18 +2643,6 @@ short rtl8180_init(struct net_device *dev)
if ((tmpu16 & EEPROM_THERMAL_METER_ENABLE) >> 13)
priv->bTxPowerTrack = true;
- eeprom_93cx6_read(&eeprom, EPROM_TXPW_BASE, &word);
- priv->cck_txpwr_base = word & 0xf;
- priv->ofdm_txpwr_base = (word>>4) & 0xf;
-
- eeprom_93cx6_read(&eeprom, EPROM_VERSION, &version);
- DMESG("EEPROM version %x", version);
- priv->rcr_csense = 3;
-
- eeprom_93cx6_read(&eeprom, ENERGY_TRESHOLD, &eeprom_val);
- priv->cs_treshold = (eeprom_val & 0xff00) >> 8;
-
- eeprom_93cx6_read(&eeprom, RFCHIPID, &eeprom_val);
priv->rf_sleep = rtl8225z4_rf_sleep;
priv->rf_wakeup = rtl8225z4_rf_wakeup;
DMESGW("**PLEASE** REPORT SUCCESSFUL/UNSUCCESSFUL TO Realtek!");
@@ -3084,100 +2806,6 @@ void write_phy_cck(struct net_device *dev, u8 adr, u32 data)
rtl8185_write_phy(dev, adr, data | 0x10000);
}
-void rtl8185_set_rate(struct net_device *dev)
-{
- int i;
- u16 word;
- int basic_rate, min_rr_rate, max_rr_rate;
-
- basic_rate = ieeerate2rtlrate(240);
- min_rr_rate = ieeerate2rtlrate(60);
- max_rr_rate = ieeerate2rtlrate(240);
-
- write_nic_byte(dev, RESP_RATE,
- max_rr_rate<<MAX_RESP_RATE_SHIFT |
- min_rr_rate<<MIN_RESP_RATE_SHIFT);
-
- word = read_nic_word(dev, BRSR);
- word &= ~BRSR_MBR_8185;
-
- for (i = 0; i <= basic_rate; i++)
- word |= (1<<i);
-
- write_nic_word(dev, BRSR, word);
-}
-
-void rtl8180_adapter_start(struct net_device *dev)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
-
- rtl8180_rtx_disable(dev);
- rtl8180_reset(dev);
-
- /* enable beacon timeout, beacon TX ok and err
- * LP tx ok and err, HP TX ok and err, NP TX ok and err,
- * RX ok and ERR, and GP timer
- */
- priv->irq_mask = 0x6fcf;
-
- priv->dma_poll_mask = 0;
-
- rtl8180_beacon_tx_disable(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
- write_nic_dword(dev, MAC0, ((u32 *)dev->dev_addr)[0]);
- write_nic_word(dev, MAC4, ((u32 *)dev->dev_addr)[1] & 0xffff);
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
- rtl8180_update_msr(dev);
-
- /* These might be unnecessary since we do in rx_enable / tx_enable */
- fix_rx_fifo(dev);
- fix_tx_fifo(dev);
-
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
-
- /*
- * The following is very strange. seems to be that 1 means test mode,
- * but we need to acknowledges the nic when a packet is ready
- * although we set it to 0
- */
-
- write_nic_byte(dev,
- CONFIG2, read_nic_byte(dev, CONFIG2) & ~\
- (1<<CONFIG2_DMA_POLLING_MODE_SHIFT));
- /* ^the nic isn't in test mode */
- write_nic_byte(dev,
- CONFIG2, read_nic_byte(dev, CONFIG2)|(1<<4));
-
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
- write_nic_dword(dev, INT_TIMEOUT, 0);
-
- write_nic_byte(dev, WPA_CONFIG, 0);
-
- rtl8180_no_hw_wep(dev);
-
- rtl8185_set_rate(dev);
- write_nic_byte(dev, RATE_FALLBACK, 0x81);
-
- write_nic_byte(dev, GP_ENABLE, read_nic_byte(dev, GP_ENABLE) & ~(1<<6));
-
- /* FIXME cfg 3 ClkRun enable - isn't it ReadOnly ? */
- rtl8180_set_mode(dev, EPROM_CMD_CONFIG);
- write_nic_byte(dev, CONFIG3, read_nic_byte(dev, CONFIG3)
- | (1 << CONFIG3_CLKRUN_SHIFT));
- rtl8180_set_mode(dev, EPROM_CMD_NORMAL);
-
- priv->rf_init(dev);
-
- if (priv->rf_set_sens != NULL)
- priv->rf_set_sens(dev, priv->sens);
- rtl8180_irq_enable(dev);
-
- netif_start_queue(dev);
-}
-
/*
* This configures registers for beacon tx and enables it via
* rtl8180_beacon_tx_enable(). rtl8180_beacon_tx_disable() might
@@ -3299,8 +2927,6 @@ static void MgntLinkKeepAlive(struct r8180_priv *priv)
}
}
-static u8 read_acadapter_file(char *filename);
-
void rtl8180_watch_dog(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
@@ -3333,12 +2959,7 @@ void rtl8180_watch_dog(struct net_device *dev)
MgntLinkKeepAlive(priv);
/* YJ,add,080828,for LPS */
- if (priv->PowerProfile == POWER_PROFILE_BATTERY)
- priv->bLeisurePs = true;
- else if (priv->PowerProfile == POWER_PROFILE_AC) {
- LeisurePSLeave(priv);
- priv->bLeisurePs = false;
- }
+ LeisurePSLeave(priv);
if (priv->ieee80211->state == IEEE80211_LINKED) {
priv->link_detect.NumRxOkInPeriod = priv->ieee80211->NumRxDataInPeriod;
@@ -3555,7 +3176,7 @@ static const struct net_device_ops rtl8180_netdev_ops = {
.ndo_start_xmit = ieee80211_rtl_xmit,
};
-static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
+static int rtl8180_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *id)
{
unsigned long ioaddr = 0;
@@ -3638,7 +3259,8 @@ static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
netif_carrier_off(dev);
- register_netdev(dev);
+ if (register_netdev(dev))
+ goto fail1;
rtl8180_proc_init_one(dev);
@@ -3667,7 +3289,7 @@ fail_free:
return ret;
}
-static void __devexit rtl8180_pci_remove(struct pci_dev *pdev)
+static void rtl8180_pci_remove(struct pci_dev *pdev)
{
struct r8180_priv *priv;
struct net_device *dev = pci_get_drvdata(pdev);
@@ -3721,27 +3343,27 @@ static int __init rtl8180_pci_module_init(void)
ret = ieee80211_crypto_init();
if (ret) {
- printk(KERN_ERR "ieee80211_crypto_init() failed %d\n", ret);
+ pr_err("ieee80211_crypto_init() failed %d\n", ret);
return ret;
}
ret = ieee80211_crypto_tkip_init();
if (ret) {
- printk(KERN_ERR "ieee80211_crypto_tkip_init() failed %d\n", ret);
+ pr_err("ieee80211_crypto_tkip_init() failed %d\n", ret);
return ret;
}
ret = ieee80211_crypto_ccmp_init();
if (ret) {
- printk(KERN_ERR "ieee80211_crypto_ccmp_init() failed %d\n", ret);
+ pr_err("ieee80211_crypto_ccmp_init() failed %d\n", ret);
return ret;
}
ret = ieee80211_crypto_wep_init();
if (ret) {
- printk(KERN_ERR "ieee80211_crypto_wep_init() failed %d\n", ret);
+ pr_err("ieee80211_crypto_wep_init() failed %d\n", ret);
return ret;
}
- printk(KERN_INFO "\nLinux kernel driver for RTL8180 / RTL8185 based WLAN cards\n");
- printk(KERN_INFO "Copyright (c) 2004-2005, Andrea Merello\n");
+ pr_info("\nLinux kernel driver for RTL8180 / RTL8185 based WLAN cards\n");
+ pr_info("Copyright (c) 2004-2005, Andrea Merello\n");
DMESG("Initializing module");
DMESG("Wireless extensions version %d", WIRELESS_EXT);
rtl8180_proc_module_init();
@@ -3844,7 +3466,7 @@ void rtl8180_tx_isr(struct net_device *dev, int pri, short error)
return ;
}
- nicv = (u32 *)((nic - nicbegin) + (u8*)begin);
+ nicv = (u32 *)((nic - nicbegin) + (u8 *)begin);
if ((head <= tail && (nicv > tail || nicv < head)) ||
(head > tail && (nicv > tail && nicv < head))) {
DMESGW("nic has lost pointer");
@@ -3932,15 +3554,6 @@ void rtl8180_tx_isr(struct net_device *dev, int pri, short error)
spin_unlock_irqrestore(&priv->tx_lock, flag);
}
-void rtl8180_tx_irq_wq(struct work_struct *work)
-{
- struct delayed_work *dwork = to_delayed_work(work);
- struct ieee80211_device * ieee = (struct ieee80211_device *)
- container_of(dwork, struct ieee80211_device, watch_dog_wq);
- struct net_device *dev = ieee->dev;
-
- rtl8180_tx_isr(dev, MANAGE_PRIORITY, 0);
-}
irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs)
{
struct net_device *dev = (struct net_device *) netdev;
@@ -4013,7 +3626,7 @@ irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs)
priv->stats.txbkperr++;
priv->ieee80211->stats.tx_errors++;
rtl8180_tx_isr(dev, BK_PRIORITY, 1);
- rtl8180_try_wake_queue(dev, BE_PRIORITY);
+ rtl8180_try_wake_queue(dev, BK_PRIORITY);
}
if (inta & ISR_TBEDER) { /* corresponding to BE_PRIORITY */
@@ -4067,6 +3680,7 @@ irqreturn_t rtl8180_interrupt(int irq, void *netdev, struct pt_regs *regs)
priv->link_detect.NumTxOkInPeriod++; /* YJ,add,080828 */
priv->stats.txnpokint++;
rtl8180_tx_isr(dev, NORM_PRIORITY, 0);
+ rtl8180_try_wake_queue(dev, NORM_PRIORITY);
}
if (inta & ISR_TLPDOK) { /* Low priority tx ok */
@@ -4113,10 +3727,7 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work)
char *argv[3];
static char *RadioPowerPath = "/etc/acpi/events/RadioPower.sh";
static char *envp[] = {"HOME=/", "TERM=linux", "PATH=/usr/bin:/bin", NULL};
- static int readf_count = 0;
-
- if (readf_count % 10 == 0)
- priv->PowerProfile = read_acadapter_file("/proc/acpi/ac_adapter/AC0/state");
+ static int readf_count;
readf_count = (readf_count+1)%0xffff;
/* We should turn off LED before polling FF51[4]. */
@@ -4162,10 +3773,5 @@ void GPIOChangeRFWorkItemCallBack(struct work_struct *work)
}
}
-static u8 read_acadapter_file(char *filename)
-{
- return 0;
-}
-
module_init(rtl8180_pci_module_init);
module_exit(rtl8180_pci_module_exit);
diff --git a/drivers/staging/rtl8187se/r8180_dm.h b/drivers/staging/rtl8187se/r8180_dm.h
index b775825..732c06a 100644
--- a/drivers/staging/rtl8187se/r8180_dm.h
+++ b/drivers/staging/rtl8187se/r8180_dm.h
@@ -13,10 +13,10 @@ bool CheckDig(struct net_device *dev);
bool CheckHighPower(struct net_device *dev);
void rtl8180_hw_dig_wq(struct work_struct *work);
void rtl8180_tx_pw_wq(struct work_struct *work);
-void rtl8180_rate_adapter(struct work_struct * work);
+void rtl8180_rate_adapter(struct work_struct *work);
void TxPwrTracking87SE(struct net_device *dev);
bool CheckTxPwrTracking(struct net_device *dev);
-void rtl8180_rate_adapter(struct work_struct * work);
+void rtl8180_rate_adapter(struct work_struct *work);
void timer_rate_adaptive(unsigned long data);
diff --git a/drivers/staging/rtl8187se/r8180_rtl8225.h b/drivers/staging/rtl8187se/r8180_rtl8225.h
index 494ea86..c6f2128 100644
--- a/drivers/staging/rtl8187se/r8180_rtl8225.h
+++ b/drivers/staging/rtl8187se/r8180_rtl8225.h
@@ -23,8 +23,8 @@ void rtl8225z2_rf_init(struct net_device *dev);
void rtl8225z2_rf_set_chan(struct net_device *dev, short ch);
void rtl8225z2_rf_close(struct net_device *dev);
-void RF_WriteReg(struct net_device *dev, u8 offset, u32 data);
-u32 RF_ReadReg(struct net_device *dev, u8 offset);
+void RF_WriteReg(struct net_device *dev, u8 offset, u16 data);
+u16 RF_ReadReg(struct net_device *dev, u8 offset);
void rtl8180_set_mode(struct net_device *dev, int mode);
void rtl8180_set_mode(struct net_device *dev, int mode);
diff --git a/drivers/staging/rtl8187se/r8180_rtl8225z2.c b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
index d28c1d9..c592f79 100644
--- a/drivers/staging/rtl8187se/r8180_rtl8225z2.c
+++ b/drivers/staging/rtl8187se/r8180_rtl8225z2.c
@@ -15,7 +15,6 @@
#include "ieee80211/dot11d.h"
-
static void write_rtl8225(struct net_device *dev, u8 adr, u16 data)
{
int i;
@@ -76,22 +75,6 @@ static void write_rtl8225(struct net_device *dev, u8 adr, u16 data)
rtl8185_rf_pins_enable(dev);
}
-static const u16 rtl8225bcd_rxgain[] = {
- 0x0400, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0408, 0x0409,
- 0x040a, 0x040b, 0x0502, 0x0503, 0x0504, 0x0505, 0x0540, 0x0541,
- 0x0542, 0x0543, 0x0544, 0x0545, 0x0580, 0x0581, 0x0582, 0x0583,
- 0x0584, 0x0585, 0x0588, 0x0589, 0x058a, 0x058b, 0x0643, 0x0644,
- 0x0645, 0x0680, 0x0681, 0x0682, 0x0683, 0x0684, 0x0685, 0x0688,
- 0x0689, 0x068a, 0x068b, 0x068c, 0x0742, 0x0743, 0x0744, 0x0745,
- 0x0780, 0x0781, 0x0782, 0x0783, 0x0784, 0x0785, 0x0788, 0x0789,
- 0x078a, 0x078b, 0x078c, 0x078d, 0x0790, 0x0791, 0x0792, 0x0793,
- 0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
- 0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
- 0x07aa, 0x07ab, 0x07ac, 0x07ad, 0x07b0, 0x07b1, 0x07b2, 0x07b3,
- 0x07b4, 0x07b5, 0x07b8, 0x07b9, 0x07ba, 0x07bb, 0x07bb
-
-};
-
static const u8 rtl8225_agc[] = {
0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e,
0x9d, 0x9c, 0x9b, 0x9a, 0x99, 0x98, 0x97, 0x96,
@@ -111,122 +94,12 @@ static const u8 rtl8225_agc[] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
};
-static const u8 rtl8225_gain[] = {
- 0x23, 0x88, 0x7c, 0xa5, /* -82dBm */
- 0x23, 0x88, 0x7c, 0xb5, /* -82dBm */
- 0x23, 0x88, 0x7c, 0xc5, /* -82dBm */
- 0x33, 0x80, 0x79, 0xc5, /* -78dBm */
- 0x43, 0x78, 0x76, 0xc5, /* -74dBm */
- 0x53, 0x60, 0x73, 0xc5, /* -70dBm */
- 0x63, 0x58, 0x70, 0xc5, /* -66dBm */
-};
-
-static const u8 rtl8225_tx_gain_cck_ofdm[] = {
- 0x02, 0x06, 0x0e, 0x1e, 0x3e, 0x7e
-};
-
-static const u8 rtl8225_tx_power_cck[] = {
- 0x18, 0x17, 0x15, 0x11, 0x0c, 0x08, 0x04, 0x02,
- 0x1b, 0x1a, 0x17, 0x13, 0x0e, 0x09, 0x04, 0x02,
- 0x1f, 0x1e, 0x1a, 0x15, 0x10, 0x0a, 0x05, 0x02,
- 0x22, 0x21, 0x1d, 0x18, 0x11, 0x0b, 0x06, 0x02,
- 0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03,
- 0x2b, 0x2a, 0x25, 0x1e, 0x16, 0x0e, 0x07, 0x03
-};
-
-static const u8 rtl8225_tx_power_cck_ch14[] = {
- 0x18, 0x17, 0x15, 0x0c, 0x00, 0x00, 0x00, 0x00,
- 0x1b, 0x1a, 0x17, 0x0e, 0x00, 0x00, 0x00, 0x00,
- 0x1f, 0x1e, 0x1a, 0x0f, 0x00, 0x00, 0x00, 0x00,
- 0x22, 0x21, 0x1d, 0x11, 0x00, 0x00, 0x00, 0x00,
- 0x26, 0x25, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00,
- 0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
-};
-
-static const u8 rtl8225_tx_power_ofdm[] = {
- 0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
-};
-
static const u32 rtl8225_chan[] = {
0,
0x0080, 0x0100, 0x0180, 0x0200, 0x0280, 0x0300, 0x0380,
0x0400, 0x0480, 0x0500, 0x0580, 0x0600, 0x0680, 0x074A,
};
-static void rtl8225_SetTXPowerLevel(struct net_device *dev, short ch)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- int GainIdx;
- int GainSetting;
- int i;
- u8 power;
- const u8 *cck_power_table;
- u8 max_cck_power_level;
- u8 max_ofdm_power_level;
- u8 min_ofdm_power_level;
- u8 cck_power_level = 0xff & priv->chtxpwr[ch];
- u8 ofdm_power_level = 0xff & priv->chtxpwr_ofdm[ch];
-
- max_cck_power_level = 35;
- max_ofdm_power_level = 35;
- min_ofdm_power_level = 0;
-
- if (cck_power_level > max_cck_power_level)
- cck_power_level = max_cck_power_level;
-
- GainIdx = cck_power_level % 6;
- GainSetting = cck_power_level / 6;
-
- if (ch == 14)
- cck_power_table = rtl8225_tx_power_cck_ch14;
- else
- cck_power_table = rtl8225_tx_power_cck;
-
- write_nic_byte(dev, TX_GAIN_CCK,
- rtl8225_tx_gain_cck_ofdm[GainSetting] >> 1);
-
- for (i = 0; i < 8; i++) {
- power = cck_power_table[GainIdx * 8 + i];
- write_phy_cck(dev, 0x44 + i, power);
- }
-
- /* FIXME Is this delay really needed ? */
- force_pci_posting(dev);
- mdelay(1);
-
- if (ofdm_power_level > (max_ofdm_power_level - min_ofdm_power_level))
- ofdm_power_level = max_ofdm_power_level;
- else
- ofdm_power_level += min_ofdm_power_level;
-
- if (ofdm_power_level > 35)
- ofdm_power_level = 35;
-
- GainIdx = ofdm_power_level % 6;
- GainSetting = ofdm_power_level / 6;
-
- rtl8185_set_anaparam2(dev, RTL8225_ANAPARAM2_ON);
-
- write_phy_ofdm(dev, 2, 0x42);
- write_phy_ofdm(dev, 6, 0x00);
- write_phy_ofdm(dev, 8, 0x00);
-
- write_nic_byte(dev, TX_GAIN_OFDM,
- rtl8225_tx_gain_cck_ofdm[GainSetting] >> 1);
-
- power = rtl8225_tx_power_ofdm[GainIdx];
-
- write_phy_ofdm(dev, 5, power);
- write_phy_ofdm(dev, 7, power);
-
- force_pci_posting(dev);
- mdelay(1);
-}
-
-static const u8 rtl8225z2_threshold[] = {
- 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd,
-};
-
static const u8 rtl8225z2_gain_bg[] = {
0x23, 0x15, 0xa5, /* -82-1dBm */
0x23, 0x15, 0xb5, /* -82-2dBm */
@@ -259,29 +132,8 @@ static const u16 rtl8225z2_rxgain[] = {
0x0794, 0x0795, 0x0798, 0x0799, 0x079a, 0x079b, 0x079c, 0x079d,
0x07a0, 0x07a1, 0x07a2, 0x07a3, 0x07a4, 0x07a5, 0x07a8, 0x07a9,
0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03b0, 0x03b1, 0x03b2, 0x03b3,
- 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bb
-
-};
+ 0x03b4, 0x03b5, 0x03b8, 0x03b9, 0x03ba, 0x03bb
-static const u8 ZEBRA2_CCK_OFDM_GAIN_SETTING[] = {
- 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
- 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
- 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
- 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
- 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
-};
-
-static const u8 rtl8225z2_tx_power_ofdm[] = {
- 0x42, 0x00, 0x40, 0x00, 0x40
-};
-
-static const u8 rtl8225z2_tx_power_cck_ch14[] = {
- 0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00
-};
-
-static const u8 rtl8225z2_tx_power_cck[] = {
- 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04
};
void rtl8225z2_set_gain(struct net_device *dev, short gain)
@@ -412,22 +264,6 @@ static u32 read_rtl8225(struct net_device *dev, u8 adr)
return dataRead;
}
-short rtl8225_is_V_z2(struct net_device *dev)
-{
- short vz2 = 1;
-
- if (read_rtl8225(dev, 8) != 0x588)
- vz2 = 0;
- else /* reg 9 pg 1 = 24 */
- if (read_rtl8225(dev, 9) != 0x700)
- vz2 = 0;
-
- /* sw back to pg 0 */
- write_rtl8225(dev, 0, 0xb7);
-
- return vz2;
-}
-
void rtl8225z2_rf_close(struct net_device *dev)
{
RF_WriteReg(dev, 0x4, 0x1f);
@@ -524,8 +360,7 @@ void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
if (cck_power_level > 35)
cck_power_level = 35;
- write_nic_byte(dev, CCK_TXAGC,
- (ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)cck_power_level]));
+ write_nic_byte(dev, CCK_TXAGC, cck_power_level);
force_pci_posting(dev);
mdelay(1);
@@ -540,8 +375,7 @@ void rtl8225z2_SetTXPowerLevel(struct net_device *dev, short ch)
write_phy_ofdm(dev, 8, 0x40);
}
- write_nic_byte(dev, OFDM_TXAGC,
- ZEBRA2_CCK_OFDM_GAIN_SETTING[(u8)ofdm_power_level]);
+ write_nic_byte(dev, OFDM_TXAGC, ofdm_power_level);
if (ofdm_power_level <= 11) {
write_phy_ofdm(dev, 0x07, 0x5c);
@@ -592,50 +426,13 @@ static void rtl8225_host_pci_init(struct net_device *dev)
write_nic_word(dev, GP_ENABLE, 0xff & (~(1 << 6)));
}
-static void rtl8225_rf_set_chan(struct net_device *dev, short ch)
-{
- struct r8180_priv *priv = ieee80211_priv(dev);
- short gset = (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_54g(&priv->ieee80211->current_network)) ||
- priv->ieee80211->iw_mode == IW_MODE_MONITOR;
-
- rtl8225_SetTXPowerLevel(dev, ch);
-
- write_rtl8225(dev, 0x7, rtl8225_chan[ch]);
-
- force_pci_posting(dev);
- mdelay(10);
-
- if (gset) {
- write_nic_byte(dev, SIFS, 0x22);
- write_nic_byte(dev, DIFS, 0x14);
- } else {
- write_nic_byte(dev, SIFS, 0x44);
- write_nic_byte(dev, DIFS, 0x24);
- }
-
- if (priv->ieee80211->state == IEEE80211_LINKED &&
- ieee80211_is_shortslot(&priv->ieee80211->current_network))
- write_nic_byte(dev, SLOT, 0x9);
- else
- write_nic_byte(dev, SLOT, 0x14);
-
- if (gset) {
- write_nic_byte(dev, EIFS, 81);
- write_nic_byte(dev, CW_VAL, 0x73);
- } else {
- write_nic_byte(dev, EIFS, 81);
- write_nic_byte(dev, CW_VAL, 0xa5);
- }
-}
-
void rtl8225z2_rf_init(struct net_device *dev)
{
struct r8180_priv *priv = ieee80211_priv(dev);
int i;
short channel = 1;
- u16 brsr;
- u32 data, addr;
+ u16 brsr;
+ u32 data;
priv->chan = channel;
@@ -676,8 +473,8 @@ void rtl8225z2_rf_init(struct net_device *dev)
write_rtl8225(dev, 0x0, 0x1b7);
- for (i = 0; i < 95; i++) {
- write_rtl8225(dev, 0x1, (u8)(i + 1));
+ for (i = 0; i < ARRAY_SIZE(rtl8225z2_rxgain); i++) {
+ write_rtl8225(dev, 0x1, i + 1);
write_rtl8225(dev, 0x2, rtl8225z2_rxgain[i]);
}
@@ -707,14 +504,12 @@ void rtl8225z2_rf_init(struct net_device *dev)
write_rtl8225(dev, 0x0, 0x2bf);
- for (i = 0; i < 128; i++) {
- data = rtl8225_agc[i];
-
- addr = i + 0x80; /* enable writing AGC table */
- write_phy_ofdm(dev, 0xb, data);
+ for (i = 0; i < ARRAY_SIZE(rtl8225_agc); i++) {
+ write_phy_ofdm(dev, 0xb, rtl8225_agc[i]);
mdelay(1);
- write_phy_ofdm(dev, 0xa, addr);
+ /* enable writing AGC table */
+ write_phy_ofdm(dev, 0xa, i + 0x80);
mdelay(1);
}
@@ -808,7 +603,7 @@ void rtl8225z2_rf_init(struct net_device *dev)
write_nic_dword(dev, 0x94, 0x15c00002);
rtl8185_rf_pins_enable(dev);
- rtl8225_rf_set_chan(dev, priv->chan);
+ rtl8225z2_rf_set_chan(dev, priv->chan);
}
void rtl8225z2_rf_set_mode(struct net_device *dev)
diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c
index 52f63d7..156b758 100644
--- a/drivers/staging/rtl8187se/r8180_wx.c
+++ b/drivers/staging/rtl8187se/r8180_wx.c
@@ -59,8 +59,6 @@ int r8180_wx_set_key(struct net_device *dev, struct iw_request_info *info,
if (priv->ieee80211->bHwRadioOff)
return 0;
- if (erq->flags & IW_ENCODE_DISABLED)
-
if (erq->length > 0) {
u32* tkey = (u32*) key;
priv->key0[0] = tkey[0];
diff --git a/drivers/staging/rtl8187se/r8185b_init.c b/drivers/staging/rtl8187se/r8185b_init.c
index bf34319..f1db9e4 100644
--- a/drivers/staging/rtl8187se/r8185b_init.c
+++ b/drivers/staging/rtl8187se/r8185b_init.c
@@ -207,156 +207,84 @@ void SetOutputEnableOfRfPins(struct net_device *dev)
write_nic_word(dev, RFPinsEnable, 0x1bff);
}
-static int HwHSSIThreeWire(struct net_device *dev,
- u8 *pDataBuf,
- u8 nDataBufBitCnt,
- int bSI,
- int bWrite)
+static bool HwHSSIThreeWire(struct net_device *dev,
+ u8 *pDataBuf,
+ bool write)
{
- int bResult = 1;
u8 TryCnt;
u8 u1bTmp;
- do {
- /* Check if WE and RE are cleared. */
- for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) {
- u1bTmp = read_nic_byte(dev, SW_3W_CMD1);
- if ((u1bTmp & (SW_3W_CMD1_RE|SW_3W_CMD1_WE)) == 0)
- break;
-
- udelay(10);
- }
- if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) {
- printk(KERN_ERR "rtl8187se: HwThreeWire(): CmdReg:"
- " %#X RE|WE bits are not clear!!\n", u1bTmp);
- dump_stack();
- return 0;
- }
-
- /* RTL8187S HSSI Read/Write Function */
- u1bTmp = read_nic_byte(dev, RF_SW_CONFIG);
-
- if (bSI)
- u1bTmp |= RF_SW_CFG_SI; /* reg08[1]=1 Serial Interface(SI) */
-
- else
- u1bTmp &= ~RF_SW_CFG_SI; /* reg08[1]=0 Parallel Interface(PI) */
-
-
- write_nic_byte(dev, RF_SW_CONFIG, u1bTmp);
-
- if (bSI) {
- /* jong: HW SI read must set reg84[3]=0. */
- u1bTmp = read_nic_byte(dev, RFPinsSelect);
- u1bTmp &= ~BIT3;
- write_nic_byte(dev, RFPinsSelect, u1bTmp);
- }
- /* Fill up data buffer for write operation. */
-
- if (bWrite) {
- if (nDataBufBitCnt == 16) {
- write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf));
- } else if (nDataBufBitCnt == 64) {
- /* RTL8187S shouldn't enter this case */
- write_nic_dword(dev, SW_3W_DB0, *((u32 *)pDataBuf));
- write_nic_dword(dev, SW_3W_DB1, *((u32 *)(pDataBuf + 4)));
- } else {
- int idx;
- int ByteCnt = nDataBufBitCnt / 8;
- /* printk("%d\n",nDataBufBitCnt); */
- if ((nDataBufBitCnt % 8) != 0) {
- printk(KERN_ERR "rtl8187se: "
- "HwThreeWire(): nDataBufBitCnt(%d)"
- " should be multiple of 8!!!\n",
- nDataBufBitCnt);
- dump_stack();
- nDataBufBitCnt += 8;
- nDataBufBitCnt &= ~7;
- }
-
- if (nDataBufBitCnt > 64) {
- printk(KERN_ERR "rtl8187se: HwThreeWire():"
- " nDataBufBitCnt(%d) should <= 64!!!\n",
- nDataBufBitCnt);
- dump_stack();
- nDataBufBitCnt = 64;
- }
+ /* Check if WE and RE are cleared. */
+ for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) {
+ u1bTmp = read_nic_byte(dev, SW_3W_CMD1);
+ if ((u1bTmp & (SW_3W_CMD1_RE|SW_3W_CMD1_WE)) == 0)
+ break;
- for (idx = 0; idx < ByteCnt; idx++)
- write_nic_byte(dev, (SW_3W_DB0+idx), *(pDataBuf+idx));
+ udelay(10);
+ }
+ if (TryCnt == TC_3W_POLL_MAX_TRY_CNT) {
+ netdev_err(dev,
+ "HwThreeWire(): CmdReg: %#X RE|WE bits are not clear!!\n",
+ u1bTmp);
+ return false;
+ }
- }
- } else { /* read */
- if (bSI) {
- /* SI - reg274[3:0] : RF register's Address */
- write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf));
- } else {
- /* PI - reg274[15:12] : RF register's Address */
- write_nic_word(dev, SW_3W_DB0, (*((u16 *)pDataBuf)) << 12);
- }
- }
+ /* RTL8187S HSSI Read/Write Function */
+ u1bTmp = read_nic_byte(dev, RF_SW_CONFIG);
+ u1bTmp |= RF_SW_CFG_SI; /* reg08[1]=1 Serial Interface(SI) */
+ write_nic_byte(dev, RF_SW_CONFIG, u1bTmp);
- /* Set up command: WE or RE. */
- if (bWrite)
- write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_WE);
+ /* jong: HW SI read must set reg84[3]=0. */
+ u1bTmp = read_nic_byte(dev, RFPinsSelect);
+ u1bTmp &= ~BIT3;
+ write_nic_byte(dev, RFPinsSelect, u1bTmp);
+ /* Fill up data buffer for write operation. */
- else
- write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_RE);
+ /* SI - reg274[3:0] : RF register's Address */
+ if (write)
+ write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf));
+ else
+ write_nic_word(dev, SW_3W_DB0, *((u16 *)pDataBuf));
+ /* Set up command: WE or RE. */
+ if (write)
+ write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_WE);
+ else
+ write_nic_byte(dev, SW_3W_CMD1, SW_3W_CMD1_RE);
- /* Check if DONE is set. */
- for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) {
- u1bTmp = read_nic_byte(dev, SW_3W_CMD1);
- if ((u1bTmp & SW_3W_CMD1_DONE) != 0)
- break;
- udelay(10);
- }
+ /* Check if DONE is set. */
+ for (TryCnt = 0; TryCnt < TC_3W_POLL_MAX_TRY_CNT; TryCnt++) {
+ u1bTmp = read_nic_byte(dev, SW_3W_CMD1);
+ if (u1bTmp & SW_3W_CMD1_DONE)
+ break;
- write_nic_byte(dev, SW_3W_CMD1, 0);
+ udelay(10);
+ }
- /* Read back data for read operation. */
- if (bWrite == 0) {
- if (bSI) {
- /* Serial Interface : reg363_362[11:0] */
- *((u16 *)pDataBuf) = read_nic_word(dev, SI_DATA_READ) ;
- } else {
- /* Parallel Interface : reg361_360[11:0] */
- *((u16 *)pDataBuf) = read_nic_word(dev, PI_DATA_READ);
- }
+ write_nic_byte(dev, SW_3W_CMD1, 0);
- *((u16 *)pDataBuf) &= 0x0FFF;
- }
-
- } while (0);
+ /* Read back data for read operation. */
+ if (!write) {
+ /* Serial Interface : reg363_362[11:0] */
+ *((u16 *)pDataBuf) = read_nic_word(dev, SI_DATA_READ);
+ *((u16 *)pDataBuf) &= 0x0FFF;
+ }
- return bResult;
+ return true;
}
-void RF_WriteReg(struct net_device *dev, u8 offset, u32 data)
+void RF_WriteReg(struct net_device *dev, u8 offset, u16 data)
{
- u32 data2Write;
- u8 len;
-
- /* Pure HW 3-wire. */
- data2Write = (data << 4) | (u32)(offset & 0x0f);
- len = 16;
-
- HwHSSIThreeWire(dev, (u8 *)(&data2Write), len, 1, 1);
+ u16 reg = (data << 4) | (offset & 0x0f);
+ HwHSSIThreeWire(dev, (u8 *)&reg, true);
}
-u32 RF_ReadReg(struct net_device *dev, u8 offset)
+u16 RF_ReadReg(struct net_device *dev, u8 offset)
{
- u32 data2Write;
- u8 wlen;
- u32 dataRead;
-
- data2Write = ((u32)(offset & 0x0f));
- wlen = 16;
- HwHSSIThreeWire(dev, (u8 *)(&data2Write), wlen, 1, 0);
- dataRead = data2Write;
-
- return dataRead;
+ u16 reg = offset & 0x0f;
+ HwHSSIThreeWire(dev, (u8 *)&reg, false);
+ return reg;
}
@@ -472,7 +400,8 @@ void ZEBRA_Config_85BASIC_HardCode(struct net_device *dev)
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
u32 i;
u32 addr, data;
- u32 u4bRegOffset, u4bRegValue, u4bRF23, u4bRF24;
+ u32 u4bRegOffset, u4bRegValue;
+ u16 u4bRF23, u4bRF24;
u8 u1b24E;
int d_cut = 0;
@@ -491,7 +420,7 @@ void ZEBRA_Config_85BASIC_HardCode(struct net_device *dev)
if (u4bRF23 == 0x818 && u4bRF24 == 0x70C) {
d_cut = 1;
- printk(KERN_INFO "rtl8187se: card type changed from C- to D-cut\n");
+ netdev_info(dev, "card type changed from C- to D-cut\n");
}
/* Page0 : reg0-reg15 */
@@ -930,10 +859,7 @@ static void MacConfig_85BASIC(struct net_device *dev)
u8 GetSupportedWirelessMode8185(struct net_device *dev)
{
- u8 btSupportedWirelessMode = 0;
-
- btSupportedWirelessMode = (WIRELESS_MODE_B | WIRELESS_MODE_G);
- return btSupportedWirelessMode;
+ return WIRELESS_MODE_B | WIRELESS_MODE_G;
}
void ActUpdateChannelAccessSetting(struct net_device *dev,
@@ -1130,13 +1056,13 @@ void ActSetWirelessMode8185(struct net_device *dev, u8 btWirelessMode)
ieee->mode = (WIRELESS_MODE)btWirelessMode;
/* 3. Change related setting. */
- if( ieee->mode == WIRELESS_MODE_A ) {
+ if (ieee->mode == WIRELESS_MODE_A)
DMESG("WIRELESS_MODE_A\n");
- } else if( ieee->mode == WIRELESS_MODE_B ) {
+ else if (ieee->mode == WIRELESS_MODE_B)
DMESG("WIRELESS_MODE_B\n");
- } else if( ieee->mode == WIRELESS_MODE_G ) {
+ else if (ieee->mode == WIRELESS_MODE_G)
DMESG("WIRELESS_MODE_G\n");
- }
+
ActUpdateChannelAccessSetting( dev, ieee->mode, &priv->ChannelAccessSetting);
}
@@ -1148,18 +1074,11 @@ void rtl8185b_irq_enable(struct net_device *dev)
write_nic_dword(dev, IMR, priv->IntrMask);
}
-void DrvIFIndicateDisassociation(struct net_device *dev, u16 reason)
-{
- /* nothing is needed after disassociation request. */
-}
-
void MgntDisconnectIBSS(struct net_device *dev)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
u8 i;
- DrvIFIndicateDisassociation(dev, unspec_reason);
-
for (i = 0; i < 6 ; i++)
priv->ieee80211->current_network.bssid[i] = 0x55;
@@ -1190,8 +1109,6 @@ void MlmeDisassociateRequest(struct net_device *dev, u8 *asSta, u8 asRsn)
if (memcmp(priv->ieee80211->current_network.bssid, asSta, 6) == 0) {
/* ShuChen TODO: change media status. */
- /* ShuChen TODO: What to do when disassociate. */
- DrvIFIndicateDisassociation(dev, unspec_reason);
for (i = 0; i < 6; i++)
priv->ieee80211->current_network.bssid[i] = 0x22;
@@ -1267,14 +1184,6 @@ bool SetRFPowerState(struct net_device *dev, RT_RF_POWER_STATE eRFPowerState)
return bResult;
}
-void HalEnableRx8185Dummy(struct net_device *dev)
-{
-}
-
-void HalDisableRx8185Dummy(struct net_device *dev)
-{
-}
-
bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u32 ChangeSource)
{
struct r8180_priv *priv = (struct r8180_priv *)ieee80211_priv(dev);
@@ -1323,11 +1232,9 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u
priv->RfOffReason = 0;
bActionAllowed = true;
- if (rtState == eRfOff && ChangeSource >= RF_CHANGE_BY_HW && !priv->bInHctTest)
+ if (rtState == eRfOff && ChangeSource >= RF_CHANGE_BY_HW)
bConnectBySSID = true;
-
- } else
- ;
+ }
break;
case eRfOff:
@@ -1359,18 +1266,6 @@ bool MgntActSet_RF_State(struct net_device *dev, RT_RF_POWER_STATE StateToSet, u
if (bActionAllowed) {
/* Config HW to the specified mode. */
SetRFPowerState(dev, StateToSet);
-
- /* Turn on RF. */
- if (StateToSet == eRfOn) {
- HalEnableRx8185Dummy(dev);
- if (bConnectBySSID) {
- /* by amy not supported */
- }
- }
- /* Turn off RF. */
- else if (StateToSet == eRfOff)
- HalDisableRx8185Dummy(dev);
-
}
/* Release RF spinlock */