diff options
Diffstat (limited to 'drivers/staging/rtl8192u')
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/dot11d.c | 6 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211.h | 6 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c | 3 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c | 4 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 92 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c | 49 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 1 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 26 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 79 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c | 8 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c | 14 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/r8190_rtl8256.c | 24 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/r8192U_core.c | 45 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/r8192U_dm.c | 65 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/r8192U_wx.c | 38 | ||||
-rw-r--r-- | drivers/staging/rtl8192u/r819xU_phy.c | 3 |
16 files changed, 255 insertions, 208 deletions
diff --git a/drivers/staging/rtl8192u/ieee80211/dot11d.c b/drivers/staging/rtl8192u/ieee80211/dot11d.c index 82d60380b..00b6052fb 100644 --- a/drivers/staging/rtl8192u/ieee80211/dot11d.c +++ b/drivers/staging/rtl8192u/ieee80211/dot11d.c @@ -103,7 +103,7 @@ u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 Channel) PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); u8 MaxTxPwrInDbm = 255; - if (MAX_CHANNEL_NUMBER < Channel) { + if (Channel > MAX_CHANNEL_NUMBER) { netdev_err(dev->dev, "DOT11D_GetMaxTxPwrInDbm(): Invalid Channel\n"); return MaxTxPwrInDbm; } @@ -139,7 +139,7 @@ int IsLegalChannel(struct ieee80211_device *dev, u8 channel) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); - if (MAX_CHANNEL_NUMBER < channel) { + if (channel > MAX_CHANNEL_NUMBER) { netdev_err(dev->dev, "IsLegalChannel(): Invalid Channel\n"); return 0; } @@ -162,7 +162,7 @@ int ToLegalChannel(struct ieee80211_device *dev, u8 channel) } } - if (MAX_CHANNEL_NUMBER < channel) { + if (channel > MAX_CHANNEL_NUMBER) { netdev_err(dev->dev, "IsLegalChannel(): Invalid Channel\n"); return default_chn; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211.h b/drivers/staging/rtl8192u/ieee80211/ieee80211.h index 967ef9a98..68931e5ec 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211.h @@ -238,8 +238,6 @@ typedef struct cb_desc { #define ieee80211_tkip_null ieee80211_tkip_null_rsl -#define ieee80211_wep_null ieee80211_wep_null_rsl - #define free_ieee80211 free_ieee80211_rsl #define alloc_ieee80211 alloc_ieee80211_rsl @@ -329,9 +327,6 @@ typedef struct ieee_param { // linux under 2.6.9 release may not support it, so modify it for common use -#define MSECS(t) msecs_to_jiffies(t) -#define msleep_interruptible_rsl msleep_interruptible - #define IEEE80211_DATA_LEN 2304 /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section 6.2.1.1.2. @@ -2260,7 +2255,6 @@ void softmac_mgmt_xmit(struct sk_buff *skb, struct ieee80211_device *ieee); /* ieee80211_crypt_ccmp&tkip&wep.c */ void ieee80211_tkip_null(void); -void ieee80211_wep_null(void); void ieee80211_ccmp_null(void); int ieee80211_crypto_init(void); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c index 3995620b3..9cf90d040 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt.c @@ -176,8 +176,7 @@ struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name) if (found_alg) return found_alg->ops; - else - return NULL; + return NULL; } diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c index 27ce4817f..2dc25cc2c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c @@ -242,7 +242,7 @@ static int ieee80211_ccmp_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ccmp_init_blocks(key->tfm, hdr, key->tx_pn, data_len, b0, b, s0); - blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; + blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); last = data_len % AES_BLOCK_LEN; for (i = 1; i <= blocks; i++) { @@ -331,7 +331,7 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ccmp_init_blocks(key->tfm, hdr, pn, data_len, b0, a, b); xor_block(mic, b, CCMP_MIC_LEN); - blocks = (data_len + AES_BLOCK_LEN - 1) / AES_BLOCK_LEN; + blocks = DIV_ROUND_UP(data_len, AES_BLOCK_LEN); last = data_len % AES_BLOCK_LEN; for (i = 1; i <= blocks; i++) { diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index 908bc2eb4..6fa96d57d 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -21,7 +21,8 @@ #include "ieee80211.h" -#include <linux/crypto.h> +#include <crypto/hash.h> +#include <crypto/skcipher.h> #include <linux/scatterlist.h> #include <linux/crc32.h> @@ -52,10 +53,10 @@ struct ieee80211_tkip_data { int key_idx; - struct crypto_blkcipher *rx_tfm_arc4; - struct crypto_hash *rx_tfm_michael; - struct crypto_blkcipher *tx_tfm_arc4; - struct crypto_hash *tx_tfm_michael; + struct crypto_skcipher *rx_tfm_arc4; + struct crypto_ahash *rx_tfm_michael; + struct crypto_skcipher *tx_tfm_arc4; + struct crypto_ahash *tx_tfm_michael; /* scratch buffers for virt_to_page() (crypto API) */ u8 rx_hdr[16], tx_hdr[16]; @@ -70,7 +71,7 @@ static void *ieee80211_tkip_init(int key_idx) goto fail; priv->key_idx = key_idx; - priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, + priv->tx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_arc4)) { printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " @@ -79,7 +80,7 @@ static void *ieee80211_tkip_init(int key_idx) goto fail; } - priv->tx_tfm_michael = crypto_alloc_hash("michael_mic", 0, + priv->tx_tfm_michael = crypto_alloc_ahash("michael_mic", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm_michael)) { printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " @@ -88,7 +89,7 @@ static void *ieee80211_tkip_init(int key_idx) goto fail; } - priv->rx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, + priv->rx_tfm_arc4 = crypto_alloc_skcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm_arc4)) { printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " @@ -97,7 +98,7 @@ static void *ieee80211_tkip_init(int key_idx) goto fail; } - priv->rx_tfm_michael = crypto_alloc_hash("michael_mic", 0, + priv->rx_tfm_michael = crypto_alloc_ahash("michael_mic", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm_michael)) { printk(KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " @@ -110,14 +111,10 @@ static void *ieee80211_tkip_init(int key_idx) fail: if (priv) { - if (priv->tx_tfm_michael) - crypto_free_hash(priv->tx_tfm_michael); - if (priv->tx_tfm_arc4) - crypto_free_blkcipher(priv->tx_tfm_arc4); - if (priv->rx_tfm_michael) - crypto_free_hash(priv->rx_tfm_michael); - if (priv->rx_tfm_arc4) - crypto_free_blkcipher(priv->rx_tfm_arc4); + crypto_free_ahash(priv->tx_tfm_michael); + crypto_free_skcipher(priv->tx_tfm_arc4); + crypto_free_ahash(priv->rx_tfm_michael); + crypto_free_skcipher(priv->rx_tfm_arc4); kfree(priv); } @@ -130,14 +127,10 @@ static void ieee80211_tkip_deinit(void *priv) struct ieee80211_tkip_data *_priv = priv; if (_priv) { - if (_priv->tx_tfm_michael) - crypto_free_hash(_priv->tx_tfm_michael); - if (_priv->tx_tfm_arc4) - crypto_free_blkcipher(_priv->tx_tfm_arc4); - if (_priv->rx_tfm_michael) - crypto_free_hash(_priv->rx_tfm_michael); - if (_priv->rx_tfm_arc4) - crypto_free_blkcipher(_priv->rx_tfm_arc4); + crypto_free_ahash(_priv->tx_tfm_michael); + crypto_free_skcipher(_priv->tx_tfm_arc4); + crypto_free_ahash(_priv->rx_tfm_michael); + crypto_free_skcipher(_priv->rx_tfm_arc4); } kfree(priv); } @@ -312,7 +305,6 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 *pos; struct rtl_80211_hdr_4addr *hdr; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - struct blkcipher_desc desc = {.tfm = tkey->tx_tfm_arc4}; int ret = 0; u8 rc4key[16], *icv; u32 crc; @@ -357,15 +349,21 @@ static int ieee80211_tkip_encrypt(struct sk_buff *skb, int hdr_len, void *priv) *pos++ = (tkey->tx_iv32 >> 24) & 0xff; if (!tcb_desc->bHwSec) { + SKCIPHER_REQUEST_ON_STACK(req, tkey->tx_tfm_arc4); + icv = skb_put(skb, 4); crc = ~crc32_le(~0, pos, len); icv[0] = crc; icv[1] = crc >> 8; icv[2] = crc >> 16; icv[3] = crc >> 24; - crypto_blkcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); + crypto_skcipher_setkey(tkey->tx_tfm_arc4, rc4key, 16); sg_init_one(&sg, pos, len+4); - ret = crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); + skcipher_request_set_tfm(req, tkey->tx_tfm_arc4); + skcipher_request_set_callback(req, 0, NULL, NULL); + skcipher_request_set_crypt(req, &sg, &sg, len + 4, NULL); + ret = crypto_skcipher_encrypt(req); + skcipher_request_zero(req); } tkey->tx_iv16++; @@ -390,12 +388,12 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u16 iv16; struct rtl_80211_hdr_4addr *hdr; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - struct blkcipher_desc desc = {.tfm = tkey->rx_tfm_arc4}; u8 rc4key[16]; u8 icv[4]; u32 crc; struct scatterlist sg; int plen; + int err; if (skb->len < hdr_len + 8 + 4) return -1; @@ -429,6 +427,8 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) pos += 8; if (!tcb_desc->bHwSec) { + SKCIPHER_REQUEST_ON_STACK(req, tkey->rx_tfm_arc4); + if (iv32 < tkey->rx_iv32 || (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) { if (net_ratelimit()) { @@ -449,10 +449,16 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) plen = skb->len - hdr_len - 12; - crypto_blkcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); + crypto_skcipher_setkey(tkey->rx_tfm_arc4, rc4key, 16); sg_init_one(&sg, pos, plen+4); - if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) { + skcipher_request_set_tfm(req, tkey->rx_tfm_arc4); + skcipher_request_set_callback(req, 0, NULL, NULL); + skcipher_request_set_crypt(req, &sg, &sg, plen + 4, NULL); + + err = crypto_skcipher_decrypt(req); + skcipher_request_zero(req); + if (err) { if (net_ratelimit()) { printk(KERN_DEBUG ": TKIP: failed to decrypt " "received packet from %pM\n", @@ -501,11 +507,12 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) return keyidx; } -static int michael_mic(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, +static int michael_mic(struct crypto_ahash *tfm_michael, u8 *key, u8 *hdr, u8 *data, size_t data_len, u8 *mic) { - struct hash_desc desc; + AHASH_REQUEST_ON_STACK(req, tfm_michael); struct scatterlist sg[2]; + int err; if (tfm_michael == NULL) { printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n"); @@ -516,12 +523,15 @@ static int michael_mic(struct crypto_hash *tfm_michael, u8 *key, u8 *hdr, sg_set_buf(&sg[0], hdr, 16); sg_set_buf(&sg[1], data, data_len); - if (crypto_hash_setkey(tfm_michael, key, 8)) + if (crypto_ahash_setkey(tfm_michael, key, 8)) return -1; - desc.tfm = tfm_michael; - desc.flags = 0; - return crypto_hash_digest(&desc, sg, data_len + 16, mic); + ahash_request_set_tfm(req, tfm_michael); + ahash_request_set_callback(req, 0, NULL, NULL); + ahash_request_set_crypt(req, sg, mic, data_len + 16); + err = crypto_ahash_digest(req); + ahash_request_zero(req); + return err; } static void michael_mic_hdr(struct sk_buff *skb, u8 *hdr) @@ -660,10 +670,10 @@ static int ieee80211_tkip_set_key(void *key, int len, u8 *seq, void *priv) { struct ieee80211_tkip_data *tkey = priv; int keyidx; - struct crypto_hash *tfm = tkey->tx_tfm_michael; - struct crypto_blkcipher *tfm2 = tkey->tx_tfm_arc4; - struct crypto_hash *tfm3 = tkey->rx_tfm_michael; - struct crypto_blkcipher *tfm4 = tkey->rx_tfm_arc4; + struct crypto_ahash *tfm = tkey->tx_tfm_michael; + struct crypto_skcipher *tfm2 = tkey->tx_tfm_arc4; + struct crypto_ahash *tfm3 = tkey->rx_tfm_michael; + struct crypto_skcipher *tfm4 = tkey->rx_tfm_arc4; keyidx = tkey->key_idx; memset(tkey, 0, sizeof(*tkey)); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c index 681611dc9..1999bc5cb 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_wep.c @@ -18,7 +18,7 @@ #include "ieee80211.h" -#include <linux/crypto.h> +#include <crypto/skcipher.h> #include <linux/scatterlist.h> #include <linux/crc32.h> @@ -32,8 +32,8 @@ struct prism2_wep_data { u8 key[WEP_KEY_LEN + 1]; u8 key_len; u8 key_idx; - struct crypto_blkcipher *tx_tfm; - struct crypto_blkcipher *rx_tfm; + struct crypto_skcipher *tx_tfm; + struct crypto_skcipher *rx_tfm; }; @@ -46,10 +46,10 @@ static void *prism2_wep_init(int keyidx) return NULL; priv->key_idx = keyidx; - priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); + priv->tx_tfm = crypto_alloc_skcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->tx_tfm)) goto free_priv; - priv->rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); + priv->rx_tfm = crypto_alloc_skcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(priv->rx_tfm)) goto free_tx; @@ -58,7 +58,7 @@ static void *prism2_wep_init(int keyidx) return priv; free_tx: - crypto_free_blkcipher(priv->tx_tfm); + crypto_free_skcipher(priv->tx_tfm); free_priv: kfree(priv); return NULL; @@ -70,10 +70,8 @@ static void prism2_wep_deinit(void *priv) struct prism2_wep_data *_priv = priv; if (_priv) { - if (_priv->tx_tfm) - crypto_free_blkcipher(_priv->tx_tfm); - if (_priv->rx_tfm) - crypto_free_blkcipher(_priv->rx_tfm); + crypto_free_skcipher(_priv->tx_tfm); + crypto_free_skcipher(_priv->rx_tfm); } kfree(priv); } @@ -91,10 +89,10 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 key[WEP_KEY_LEN + 3]; u8 *pos; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - struct blkcipher_desc desc = {.tfm = wep->tx_tfm}; u32 crc; u8 *icv; struct scatterlist sg; + int err; if (skb_headroom(skb) < 4 || skb_tailroom(skb) < 4 || skb->len < hdr_len) @@ -129,6 +127,8 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) memcpy(key + 3, wep->key, wep->key_len); if (!tcb_desc->bHwSec) { + SKCIPHER_REQUEST_ON_STACK(req, wep->tx_tfm); + /* Append little-endian CRC32 and encrypt it to produce ICV */ crc = ~crc32_le(~0, pos, len); icv = skb_put(skb, 4); @@ -137,10 +137,16 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) icv[2] = crc >> 16; icv[3] = crc >> 24; - crypto_blkcipher_setkey(wep->tx_tfm, key, klen); + crypto_skcipher_setkey(wep->tx_tfm, key, klen); sg_init_one(&sg, pos, len+4); - return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); + skcipher_request_set_tfm(req, wep->tx_tfm); + skcipher_request_set_callback(req, 0, NULL, NULL); + skcipher_request_set_crypt(req, &sg, &sg, len + 4, NULL); + + err = crypto_skcipher_encrypt(req); + skcipher_request_zero(req); + return err; } return 0; @@ -161,10 +167,10 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) u8 key[WEP_KEY_LEN + 3]; u8 keyidx, *pos; cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - struct blkcipher_desc desc = {.tfm = wep->rx_tfm}; u32 crc; u8 icv[4]; struct scatterlist sg; + int err; if (skb->len < hdr_len + 8) return -1; @@ -186,10 +192,18 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) plen = skb->len - hdr_len - 8; if (!tcb_desc->bHwSec) { - crypto_blkcipher_setkey(wep->rx_tfm, key, klen); + SKCIPHER_REQUEST_ON_STACK(req, wep->rx_tfm); + + crypto_skcipher_setkey(wep->rx_tfm, key, klen); sg_init_one(&sg, pos, plen+4); - if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) + skcipher_request_set_tfm(req, wep->rx_tfm); + skcipher_request_set_callback(req, 0, NULL, NULL); + skcipher_request_set_crypt(req, &sg, &sg, plen + 4, NULL); + + err = crypto_skcipher_decrypt(req); + skcipher_request_zero(req); + if (err) return -7; crc = ~crc32_le(~0, pos, plen); @@ -274,6 +288,3 @@ void __exit ieee80211_crypto_wep_exit(void) ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); } -void ieee80211_wep_null(void) -{ -} diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index 425b2ddfc..30fff6c56 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -177,7 +177,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) /* These function were added to load crypte module autoly */ ieee80211_tkip_null(); - ieee80211_wep_null(); ieee80211_ccmp_null(); return dev; diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index 130c852ff..f18fc0b67 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -460,10 +460,8 @@ static int is_duplicate_packet(struct ieee80211_device *ieee, // if (memcmp(entry->mac, mac, ETH_ALEN)){ 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"); + if (!entry) return 0; - } memcpy(entry->mac, mac, ETH_ALEN); entry->seq_num[tid] = seq; entry->frag_num[tid] = frag; @@ -594,12 +592,18 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, { PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; PRX_REORDER_ENTRY pReorderEntry = NULL; - struct ieee80211_rxb *prxbIndicateArray[REORDER_WIN_SIZE]; + struct ieee80211_rxb **prxbIndicateArray; u8 WinSize = pHTInfo->RxReorderWinSize; u16 WinEnd = (pTS->RxIndicateSeq + WinSize -1)%4096; u8 index = 0; bool bMatchWinStart = false, bPktInBuf = false; IEEE80211_DEBUG(IEEE80211_DL_REORDER,"%s(): Seq is %d,pTS->RxIndicateSeq is %d, WinSize is %d\n",__func__,SeqNum,pTS->RxIndicateSeq,WinSize); + + prxbIndicateArray = kmalloc(sizeof(struct ieee80211_rxb *) * + REORDER_WIN_SIZE, GFP_KERNEL); + if (!prxbIndicateArray) + return; + /* Rx Reorder initialize condition.*/ if (pTS->RxIndicateSeq == 0xffff) { pTS->RxIndicateSeq = SeqNum; @@ -618,6 +622,8 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, kfree(prxb); prxb = NULL; } + + kfree(prxbIndicateArray); return; } @@ -741,6 +747,7 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, // Indicate packets if(index>REORDER_WIN_SIZE){ IEEE80211_DEBUG(IEEE80211_DL_ERR, "RxReorderIndicatePacket(): Rx Reorer buffer full!! \n"); + kfree(prxbIndicateArray); return; } ieee80211_indicate_packets(ieee, prxbIndicateArray, index); @@ -752,9 +759,12 @@ static void RxReorderIndicatePacket(struct ieee80211_device *ieee, pTS->RxTimeoutIndicateSeq = pTS->RxIndicateSeq; if(timer_pending(&pTS->RxPktPendingTimer)) del_timer_sync(&pTS->RxPktPendingTimer); - pTS->RxPktPendingTimer.expires = jiffies + MSECS(pHTInfo->RxReorderPendingTime); + pTS->RxPktPendingTimer.expires = jiffies + + msecs_to_jiffies(pHTInfo->RxReorderPendingTime); add_timer(&pTS->RxPktPendingTimer); } + + kfree(prxbIndicateArray); } static u8 parse_subframe(struct sk_buff *skb, @@ -897,7 +907,6 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, //added by amy for reorder #ifdef NOT_YET struct net_device *wds = NULL; - struct sk_buff *skb2 = NULL; struct net_device *wds = NULL; int from_assoc_ap = 0; void *sta = NULL; @@ -1277,11 +1286,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, payload = skb->data + hdrlen; //ethertype = (payload[6] << 8) | payload[7]; rxb = kmalloc(sizeof(struct ieee80211_rxb), GFP_ATOMIC); - if (rxb == NULL) - { - IEEE80211_DEBUG(IEEE80211_DL_ERR,"%s(): kmalloc rxb error\n",__func__); + if (!rxb) goto rx_dropped; - } /* to parse amsdu packets */ /* qos data packets & reserved bit is 1 */ if (parse_subframe(skb, rx_stats, rxb, src, dst) == 0) { diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 38c3eb780..ae1274cfb 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -103,12 +103,12 @@ static void ieee80211_WMM_Info(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = MFIE_TYPE_GENERIC; /* 0 */ *tag++ = 7; *tag++ = 0x00; *tag++ = 0x50; *tag++ = 0xf2; - *tag++ = 0x02;//5 + *tag++ = 0x02; /* 5 */ *tag++ = 0x00; *tag++ = 0x01; #ifdef SUPPORT_USPD @@ -128,12 +128,12 @@ static void ieee80211_TURBO_Info(struct ieee80211_device *ieee, u8 **tag_p) { u8 *tag = *tag_p; - *tag++ = MFIE_TYPE_GENERIC; //0 + *tag++ = MFIE_TYPE_GENERIC; /* 0 */ *tag++ = 7; *tag++ = 0x00; *tag++ = 0xe0; *tag++ = 0x4c; - *tag++ = 0x01;//5 + *tag++ = 0x01; /* 5 */ *tag++ = 0x02; *tag++ = 0x11; *tag++ = 0x00; @@ -186,14 +186,14 @@ static u8 MgntQuery_MgntFrameTxRate(struct ieee80211_device *ieee) PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; u8 rate; - // 2008/01/25 MH For broadcom, MGNT frame set as OFDM 6M. + /* 2008/01/25 MH For broadcom, MGNT frame set as OFDM 6M. */ if(pHTInfo->IOTAction & HT_IOT_ACT_MGNT_USE_CCK_6M) rate = 0x0c; else rate = ieee->basic_rate & 0x7f; if (rate == 0) { - // 2005.01.26, by rcnjko. + /* 2005.01.26, by rcnjko. */ if(ieee->mode == IEEE_A|| ieee->mode== IEEE_N_5G|| (ieee->mode== IEEE_N_24G&&!pHTInfo->bCurSuppCCK)) @@ -340,11 +340,11 @@ inline struct sk_buff *ieee80211_probe_req(struct ieee80211_device *ieee) req = (struct ieee80211_probe_request *) skb_put(skb,sizeof(struct ieee80211_probe_request)); req->header.frame_ctl = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ); - req->header.duration_id = 0; //FIXME: is this OK ? + req->header.duration_id = 0; /* FIXME: is this OK? */ - memset(req->header.addr1, 0xff, ETH_ALEN); + eth_broadcast_addr(req->header.addr1); memcpy(req->header.addr2, ieee->dev->dev_addr, ETH_ALEN); - memset(req->header.addr3, 0xff, ETH_ALEN); + eth_broadcast_addr(req->header.addr3); tag = (u8 *) skb_put(skb,len+2+rate_len); @@ -380,7 +380,8 @@ static void ieee80211_send_beacon(struct ieee80211_device *ieee) if (ieee->beacon_txing && ieee->ieee_up) { // if(!timer_pending(&ieee->beacon_timer)) // add_timer(&ieee->beacon_timer); - mod_timer(&ieee->beacon_timer,jiffies+(MSECS(ieee->current_network.beacon_interval-5))); + mod_timer(&ieee->beacon_timer, + jiffies + msecs_to_jiffies(ieee->current_network.beacon_interval-5)); } //spin_unlock_irqrestore(&ieee->beacon_lock,flags); } @@ -468,7 +469,7 @@ void ieee80211_softmac_scan_syncro(struct ieee80211_device *ieee) if (ieee->state >= IEEE80211_LINKED && ieee->sync_scan_hurryup) goto out; - msleep_interruptible_rsl(IEEE80211_SOFTMAC_SCAN_TIME); + msleep_interruptible(IEEE80211_SOFTMAC_SCAN_TIME); } out: @@ -487,7 +488,7 @@ EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); static void ieee80211_softmac_scan_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, softmac_scan_wq); static short watchdog; u8 channel_map[MAX_CHANNEL_NUMBER+1]; @@ -514,7 +515,7 @@ static void ieee80211_softmac_scan_wq(struct work_struct *work) ieee80211_send_probe_requests(ieee); - queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); + schedule_delayed_work(&ieee->softmac_scan_wq, IEEE80211_SOFTMAC_SCAN_TIME); up(&ieee->scan_sem); return; @@ -613,7 +614,7 @@ static void ieee80211_start_scan(struct ieee80211_device *ieee) if (ieee->softmac_features & IEEE_SOFTMAC_SCAN){ if (ieee->scanning == 0) { ieee->scanning = 1; - queue_delayed_work(ieee->wq, &ieee->softmac_scan_wq, 0); + schedule_delayed_work(&ieee->softmac_scan_wq, 0); } }else ieee->start_scan(ieee->dev); @@ -672,7 +673,7 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be else if(ieee->auth_mode == 1) auth->algorithm = cpu_to_le16(WLAN_AUTH_SHARED_KEY); else if(ieee->auth_mode == 2) - auth->algorithm = WLAN_AUTH_OPEN;//0x80; + auth->algorithm = WLAN_AUTH_OPEN; /* 0x80; */ printk("=================>%s():auth->algorithm is %d\n",__func__,auth->algorithm); auth->transaction = cpu_to_le16(ieee->associate_seq); ieee->associate_seq++; @@ -727,7 +728,7 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); - //HT ralated element + /* HT ralated element */ tmp_ht_cap_buf =(u8 *) &(ieee->pHTInfo->SelfHTCap); tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); tmp_ht_info_buf =(u8 *) &(ieee->pHTInfo->SelfHTInfo); @@ -765,13 +766,13 @@ static struct sk_buff *ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d memcpy (beacon_buf->header.addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy (beacon_buf->header.addr3, ieee->current_network.bssid, ETH_ALEN); - beacon_buf->header.duration_id = 0; //FIXME + beacon_buf->header.duration_id = 0; /* FIXME */ beacon_buf->beacon_interval = cpu_to_le16(ieee->current_network.beacon_interval); beacon_buf->capability = cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_IBSS); beacon_buf->capability |= - cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE); //add short preamble here + cpu_to_le16(ieee->current_network.capability & WLAN_CAPABILITY_SHORT_PREAMBLE); /* add short preamble here */ if(ieee->short_slot && (ieee->current_network.capability & WLAN_CAPABILITY_SHORT_SLOT)) beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT); @@ -1012,7 +1013,7 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco crypt = ieee->crypt[ieee->tx_keyidx]; encrypt = ieee->host_encrypt && crypt && crypt->ops && ((0 == strcmp(crypt->ops->name,"WEP") || wpa_ie_len)); - //Include High Throuput capability && Realtek proprietary + /* Include High Throuput capability && Realtek proprietary */ if (ieee->pHTInfo->bCurrentHTSupport&&ieee->pHTInfo->bEnableHT) { ht_cap_buf = (u8 *)&(ieee->pHTInfo->SelfHTCap); @@ -1044,8 +1045,8 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco #ifdef THOMAS_TURBO len = sizeof(struct ieee80211_assoc_request_frame)+ 2 - + beacon->ssid_len//essid tagged val - + rate_len//rates tagged val + + beacon->ssid_len /* essid tagged val */ + + rate_len /* rates tagged val */ + wpa_ie_len + wmm_info_len + turbo_info_len @@ -1057,8 +1058,8 @@ inline struct sk_buff *ieee80211_association_req(struct ieee80211_network *beaco + ieee->tx_headroom; #else len = sizeof(struct ieee80211_assoc_request_frame)+ 2 - + beacon->ssid_len//essid tagged val - + rate_len//rates tagged val + + beacon->ssid_len /* essid tagged val */ + + rate_len /* rates tagged val */ + wpa_ie_len + wmm_info_len + ht_cap_len @@ -1240,7 +1241,7 @@ void ieee80211_associate_abort(struct ieee80211_device *ieee) ieee->state = IEEE80211_ASSOCIATING_RETRY; - queue_delayed_work(ieee->wq, &ieee->associate_retry_wq, \ + schedule_delayed_work(&ieee->associate_retry_wq, \ IEEE80211_SOFTMAC_ASSOC_RETRY_TIME); spin_unlock_irqrestore(&ieee->lock, flags); @@ -1381,7 +1382,7 @@ static void ieee80211_associate_complete(struct ieee80211_device *ieee) ieee->state = IEEE80211_LINKED; //ieee->UpdateHalRATRTableHandler(dev, ieee->dot11HTOperationalRateSet); - queue_work(ieee->wq, &ieee->associate_complete_wq); + schedule_work(&ieee->associate_complete_wq); } static void ieee80211_associate_procedure_wq(struct work_struct *work) @@ -1482,7 +1483,7 @@ inline void ieee80211_softmac_new_net(struct ieee80211_device *ieee, struct ieee } ieee->state = IEEE80211_ASSOCIATING; - queue_work(ieee->wq, &ieee->associate_procedure_wq); + schedule_work(&ieee->associate_procedure_wq); }else{ if(ieee80211_is_54g(&ieee->current_network) && (ieee->modulation & IEEE80211_OFDM_MODULATION)){ @@ -1735,10 +1736,12 @@ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, if(dtim & ((IEEE80211_DTIM_UCAST | IEEE80211_DTIM_MBCAST)& ieee->ps)) return 2; - if(!time_after(jiffies, ieee->dev->trans_start + MSECS(timeout))) + if(!time_after(jiffies, + ieee->dev->trans_start + msecs_to_jiffies(timeout))) return 0; - if(!time_after(jiffies, ieee->last_rx_ps_time + MSECS(timeout))) + if(!time_after(jiffies, + ieee->last_rx_ps_time + msecs_to_jiffies(timeout))) return 0; if((ieee->softmac_features & IEEE_SOFTMAC_SINGLE_QUEUE ) && @@ -2041,7 +2044,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, "Association response status code 0x%x\n", errcode); if(ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) { - queue_work(ieee->wq, &ieee->associate_procedure_wq); + schedule_work(&ieee->associate_procedure_wq); } else { ieee80211_associate_abort(ieee); } @@ -2097,7 +2100,7 @@ ieee80211_rx_frame_softmac(struct ieee80211_device *ieee, struct sk_buff *skb, notify_wx_assoc_event(ieee); //HTSetConnectBwMode(ieee, HT_CHANNEL_WIDTH_20, HT_EXTCHNL_OFFSET_NO_EXT); RemovePeerTS(ieee, header->addr2); - queue_work(ieee->wq, &ieee->associate_procedure_wq); + schedule_work(&ieee->associate_procedure_wq); } break; case IEEE80211_STYPE_MANAGE_ACT: @@ -2284,12 +2287,6 @@ void ieee80211_stop_queue(struct ieee80211_device *ieee) } EXPORT_SYMBOL(ieee80211_stop_queue); -inline void ieee80211_randomize_cell(struct ieee80211_device *ieee) -{ - - random_ether_addr(ieee->current_network.bssid); -} - /* called in user context only */ void ieee80211_start_master_bss(struct ieee80211_device *ieee) { @@ -2330,7 +2327,7 @@ static void ieee80211_start_monitor_mode(struct ieee80211_device *ieee) static void ieee80211_start_ibss_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, start_ibss_wq); /* iwconfig mode ad-hoc will schedule this and return * on the other hand this will block further iwconfig SET @@ -2379,7 +2376,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work) if (ieee->state == IEEE80211_NOLINK) { printk("creating new IBSS cell\n"); if(!ieee->wap_set) - ieee80211_randomize_cell(ieee); + random_ether_addr(ieee->current_network.bssid); if(ieee->modulation & IEEE80211_CCK_MODULATION){ @@ -2439,7 +2436,7 @@ static void ieee80211_start_ibss_wq(struct work_struct *work) inline void ieee80211_start_ibss(struct ieee80211_device *ieee) { - queue_delayed_work(ieee->wq, &ieee->start_ibss_wq, 150); + schedule_delayed_work(&ieee->start_ibss_wq, 150); } /* this is called only in user context, with wx_sem held */ @@ -2504,7 +2501,7 @@ EXPORT_SYMBOL(ieee80211_disassociate); static void ieee80211_associate_retry_wq(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct ieee80211_device *ieee = container_of(dwork, struct ieee80211_device, associate_retry_wq); unsigned long flags; @@ -2722,7 +2719,6 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee) setup_timer(&ieee->beacon_timer, ieee80211_send_beacon_cb, (unsigned long)ieee); - ieee->wq = create_workqueue(DRV_NAME); INIT_DELAYED_WORK(&ieee->start_ibss_wq, ieee80211_start_ibss_wq); INIT_WORK(&ieee->associate_complete_wq, ieee80211_associate_complete_wq); @@ -2752,7 +2748,6 @@ void ieee80211_softmac_free(struct ieee80211_device *ieee) del_timer_sync(&ieee->associate_timer); cancel_delayed_work(&ieee->associate_retry_wq); - destroy_workqueue(ieee->wq); up(&ieee->wx_sem); } diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c index 3bde74460..28737ec65 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_BAProc.c @@ -19,7 +19,7 @@ static void ActivateBAEntry(struct ieee80211_device *ieee, PBA_RECORD pBA, u16 T { pBA->bValid = true; if(Time != 0) - mod_timer(&pBA->Timer, jiffies + MSECS(Time)); + mod_timer(&pBA->Timer, jiffies + msecs_to_jiffies(Time)); } /******************************************************************************************************************** @@ -254,7 +254,7 @@ static struct sk_buff *ieee80211_DELBA( static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA) { - struct sk_buff *skb = NULL; + struct sk_buff *skb; skb = ieee80211_ADDBA(ieee, dst, pBA, 0, ACT_ADDBAREQ); //construct ACT_ADDBAREQ frames so set statuscode zero. if (skb) @@ -282,7 +282,7 @@ static void ieee80211_send_ADDBAReq(struct ieee80211_device *ieee, static void ieee80211_send_ADDBARsp(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA, u16 StatusCode) { - struct sk_buff *skb = NULL; + struct sk_buff *skb; skb = ieee80211_ADDBA(ieee, dst, pBA, StatusCode, ACT_ADDBARSP); //construct ACT_ADDBARSP frames if (skb) { @@ -311,7 +311,7 @@ static void ieee80211_send_DELBA(struct ieee80211_device *ieee, u8 *dst, PBA_RECORD pBA, TR_SELECT TxRxSelect, u16 ReasonCode) { - struct sk_buff *skb = NULL; + struct sk_buff *skb; skb = ieee80211_DELBA(ieee, dst, pBA, TxRxSelect, ReasonCode); //construct ACT_ADDBARSP frames if (skb) { diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c index f33c74342..148d0d455 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TSProc.c @@ -35,9 +35,7 @@ static void RxPktPendingTimeout(unsigned long data) u8 index = 0; bool bPktInBuf = false; - spin_lock_irqsave(&(ieee->reorder_spinlock), flags); - //PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); IEEE80211_DEBUG(IEEE80211_DL_REORDER,"==================>%s()\n",__func__); if(pRxTs->RxTimeoutIndicateSeq != 0xffff) { @@ -87,10 +85,10 @@ static void RxPktPendingTimeout(unsigned long data) if(bPktInBuf && (pRxTs->RxTimeoutIndicateSeq==0xffff)) { pRxTs->RxTimeoutIndicateSeq = pRxTs->RxIndicateSeq; - mod_timer(&pRxTs->RxPktPendingTimer, jiffies + MSECS(ieee->pHTInfo->RxReorderPendingTime)); + mod_timer(&pRxTs->RxPktPendingTimer, + jiffies + msecs_to_jiffies(ieee->pHTInfo->RxReorderPendingTime)); } spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); - //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); } /******************************************************************************************************************** @@ -212,7 +210,8 @@ static void AdmitTS(struct ieee80211_device *ieee, del_timer_sync(&pTsCommonInfo->InactTimer); if(InactTime!=0) - mod_timer(&pTsCommonInfo->InactTimer, jiffies + MSECS(InactTime)); + mod_timer(&pTsCommonInfo->InactTimer, + jiffies + msecs_to_jiffies(InactTime)); } @@ -469,7 +468,6 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, PTS_COMMON_INFO pTs, while(!list_empty(&pRxTS->RxPendingPktList)) { - // PlatformAcquireSpinLock(Adapter, RT_RX_SPINLOCK); spin_lock_irqsave(&(ieee->reorder_spinlock), flags); //pRxReorderEntry = list_entry(&pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); pRxReorderEntry = (PRX_REORDER_ENTRY)list_entry(pRxTS->RxPendingPktList.prev,RX_REORDER_ENTRY,List); @@ -489,7 +487,6 @@ static void RemoveTsEntry(struct ieee80211_device *ieee, PTS_COMMON_INFO pTs, prxb = NULL; } list_add_tail(&pRxReorderEntry->List,&ieee->RxReorder_Unused_List); - //PlatformReleaseSpinLock(Adapter, RT_RX_SPINLOCK); spin_unlock_irqrestore(&(ieee->reorder_spinlock), flags); } @@ -590,7 +587,8 @@ void TsStartAddBaProcess(struct ieee80211_device *ieee, PTX_TS_RECORD pTxTS) if(pTxTS->bAddBaReqDelayed) { IEEE80211_DEBUG(IEEE80211_DL_BA, "TsStartAddBaProcess(): Delayed Start ADDBA after 60 sec!!\n"); - mod_timer(&pTxTS->TsAddBaTimer, jiffies + MSECS(TS_ADDBA_DELAY)); + mod_timer(&pTxTS->TsAddBaTimer, + jiffies + msecs_to_jiffies(TS_ADDBA_DELAY)); } else { diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c index e00032947..5c3bb3be2 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.c +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -1,12 +1,11 @@ /* - This is part of the rtl8192 driver - released under the GPL (See file COPYING for details). - - This files contains programming code for the rtl8256 - radio frontend. - - *Many* thanks to Realtek Corp. for their great support! - +* This is part of the rtl8192 driver +* released under the GPL (See file COPYING for details). +* +* This files contains programming code for the rtl8256 +* radio frontend. +* +* *Many* thanks to Realtek Corp. for their great support! */ #include "r8192U.h" @@ -22,7 +21,8 @@ * Output: NONE * Return: NONE * Note: 8226 support both 20M and 40 MHz - *---------------------------------------------------------------------------*/ + *-------------------------------------------------------------------------- + */ void PHY_SetRF8256Bandwidth(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth) { u8 eRFPath; @@ -83,7 +83,8 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth) * Input: struct net_device* dev * Output: NONE * Return: NONE - *---------------------------------------------------------------------------*/ + *-------------------------------------------------------------------------- + */ void PHY_RF8256_Config(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -100,7 +101,8 @@ void PHY_RF8256_Config(struct net_device *dev) * Input: struct net_device* dev * Output: NONE * Return: NONE - *---------------------------------------------------------------------------*/ + *-------------------------------------------------------------------------- + */ void phy_RF8256_Config_ParaFile(struct net_device *dev) { u32 u4RegValue = 0; diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index f4a4eae72..849a95ef7 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1092,10 +1092,17 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) static void rtl8192_tx_isr(struct urb *tx_urb) { struct sk_buff *skb = (struct sk_buff *)tx_urb->context; - struct net_device *dev = (struct net_device *)(skb->cb); + struct net_device *dev; struct r8192_priv *priv = NULL; - cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - u8 queue_index = tcb_desc->queue_index; + cb_desc *tcb_desc; + u8 queue_index; + + if (!skb) + return; + + dev = (struct net_device *)(skb->cb); + tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); + queue_index = tcb_desc->queue_index; priv = ieee80211_priv(dev); @@ -1113,11 +1120,9 @@ static void rtl8192_tx_isr(struct urb *tx_urb) } /* free skb and tx_urb */ - if (skb != NULL) { - dev_kfree_skb_any(skb); - usb_free_urb(tx_urb); - atomic_dec(&priv->tx_pending[queue_index]); - } + dev_kfree_skb_any(skb); + usb_free_urb(tx_urb); + atomic_dec(&priv->tx_pending[queue_index]); /* * Handle HW Beacon: @@ -1371,7 +1376,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) */ static u8 MapHwQueueToFirmwareQueue(u8 QueueID) { - u8 QueueSelect = 0x0; /* defualt set to */ + u8 QueueSelect = 0x0; /* default set to */ switch (QueueID) { case BE_QUEUE: @@ -1727,7 +1732,7 @@ static short rtl8192_usb_initendpoints(struct net_device *dev) priv->rx_urb = kmalloc(sizeof(struct urb *) * (MAX_RX_URB + 1), GFP_KERNEL); - if (priv->rx_urb == NULL) + if (!priv->rx_urb) return -ENOMEM; #ifndef JACKSON_NEW_RX @@ -1957,7 +1962,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, network->qos_data.param_count)) { network->qos_data.old_param_count = network->qos_data.param_count; - queue_work(priv->priv_wq, &priv->qos_activate); + schedule_work(&priv->qos_activate); RT_TRACE(COMP_QOS, "QoS parameters change call qos_activate\n"); } @@ -1966,7 +1971,7 @@ static int rtl8192_qos_handle_probe_response(struct r8192_priv *priv, &def_qos_parameters, size); if ((network->qos_data.active == 1) && (active_network == 1)) { - queue_work(priv->priv_wq, &priv->qos_activate); + schedule_work(&priv->qos_activate); RT_TRACE(COMP_QOS, "QoS was disabled call qos_activate\n"); } @@ -1985,7 +1990,7 @@ static int rtl8192_handle_beacon(struct net_device *dev, struct r8192_priv *priv = ieee80211_priv(dev); rtl8192_qos_handle_probe_response(priv, 1, network); - queue_delayed_work(priv->priv_wq, &priv->update_beacon_wq, 0); + schedule_delayed_work(&priv->update_beacon_wq, 0); return 0; } @@ -2037,7 +2042,7 @@ static int rtl8192_qos_association_resp(struct r8192_priv *priv, network->flags, priv->ieee80211->current_network.qos_data.active); if (set_qos_param == 1) - queue_work(priv->priv_wq, &priv->qos_activate); + schedule_work(&priv->qos_activate); return 0; @@ -2382,7 +2387,6 @@ static void rtl8192_init_priv_task(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); - priv->priv_wq = create_workqueue(DRV_NAME); INIT_WORK(&priv->reset_wq, rtl8192_restart); @@ -3436,8 +3440,7 @@ static void rtl819x_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, static void rtl819x_watchdog_wqcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, - struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, watch_dog_wq); struct net_device *dev = priv->ieee80211->dev; @@ -3514,7 +3517,7 @@ static void watch_dog_timer_callback(unsigned long data) { struct r8192_priv *priv = ieee80211_priv((struct net_device *)data); - queue_delayed_work(priv->priv_wq, &priv->watch_dog_wq, 0); + schedule_delayed_work(&priv->watch_dog_wq, 0); mod_timer(&priv->watch_dog_timer, jiffies + msecs_to_jiffies(IEEE80211_WATCH_DOG_TIME)); } @@ -4297,7 +4300,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, if (is_cck_rate) { /* (1)Hardware does not provide RSSI for CCK */ - /* (2)PWDB, Average PWDB cacluated by hardware + /* (2)PWDB, Average PWDB calculated by hardware * (for rate adaptive) */ u8 report; @@ -4398,7 +4401,7 @@ static void rtl8192_query_rxphystatus(struct r8192_priv *priv, } - /* (2)PWDB, Average PWDB cacluated by hardware + /* (2)PWDB, Average PWDB calculated by hardware * (for rate adaptive) */ rx_pwr_all = (((pofdm_buf->pwdb_all) >> 1) & 0x7f) - 106; @@ -5018,7 +5021,6 @@ fail2: kfree(priv->pFirmware); priv->pFirmware = NULL; rtl8192_usb_deleteendpoints(dev); - destroy_workqueue(priv->priv_wq); mdelay(10); fail: free_ieee80211(dev); @@ -5056,7 +5058,6 @@ static void rtl8192_usb_disconnect(struct usb_interface *intf) kfree(priv->pFirmware); priv->pFirmware = NULL; rtl8192_usb_deleteendpoints(dev); - destroy_workqueue(priv->priv_wq); mdelay(10); } free_ieee80211(dev); diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192u/r8192U_dm.c index 375ec96b9..1e0e53c9c 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -767,7 +767,7 @@ static void dm_TXPowerTrackingCallback_ThermalMeter(struct net_device *dev) void dm_txpower_trackingcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, txpower_tracking_wq); struct net_device *dev = priv->ieee80211->dev; @@ -1628,47 +1628,75 @@ static void dm_bb_initialgain_backup(struct net_device *dev) void dm_change_dynamic_initgain_thresh(struct net_device *dev, u32 dm_type, u32 dm_value) { - if (dm_type == DIG_TYPE_THRESH_HIGH) { + switch (dm_type) { + case DIG_TYPE_THRESH_HIGH: dm_digtable.rssi_high_thresh = dm_value; - } else if (dm_type == DIG_TYPE_THRESH_LOW) { + break; + + case DIG_TYPE_THRESH_LOW: dm_digtable.rssi_low_thresh = dm_value; - } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_HIGH) { + break; + + case DIG_TYPE_THRESH_HIGHPWR_HIGH: dm_digtable.rssi_high_power_highthresh = dm_value; - } else if (dm_type == DIG_TYPE_THRESH_HIGHPWR_LOW) { + break; + + case DIG_TYPE_THRESH_HIGHPWR_LOW: dm_digtable.rssi_high_power_lowthresh = dm_value; - } else if (dm_type == DIG_TYPE_ENABLE) { + break; + + case DIG_TYPE_ENABLE: dm_digtable.dig_state = DM_STA_DIG_MAX; dm_digtable.dig_enable_flag = true; - } else if (dm_type == DIG_TYPE_DISABLE) { + break; + + case DIG_TYPE_DISABLE: dm_digtable.dig_state = DM_STA_DIG_MAX; dm_digtable.dig_enable_flag = false; - } else if (dm_type == DIG_TYPE_DBG_MODE) { + break; + + case DIG_TYPE_DBG_MODE: if (dm_value >= DM_DBG_MAX) dm_value = DM_DBG_OFF; dm_digtable.dbg_mode = (u8)dm_value; - } else if (dm_type == DIG_TYPE_RSSI) { + break; + + case DIG_TYPE_RSSI: if (dm_value > 100) dm_value = 30; dm_digtable.rssi_val = (long)dm_value; - } else if (dm_type == DIG_TYPE_ALGORITHM) { + break; + + case DIG_TYPE_ALGORITHM: if (dm_value >= DIG_ALGO_MAX) dm_value = DIG_ALGO_BY_FALSE_ALARM; if (dm_digtable.dig_algorithm != (u8)dm_value) dm_digtable.dig_algorithm_switch = 1; dm_digtable.dig_algorithm = (u8)dm_value; - } else if (dm_type == DIG_TYPE_BACKOFF) { + break; + + case DIG_TYPE_BACKOFF: if (dm_value > 30) dm_value = 30; dm_digtable.backoff_val = (u8)dm_value; - } else if (dm_type == DIG_TYPE_RX_GAIN_MIN) { + break; + + case DIG_TYPE_RX_GAIN_MIN: if (dm_value == 0) dm_value = 0x1; dm_digtable.rx_gain_range_min = (u8)dm_value; - } else if (dm_type == DIG_TYPE_RX_GAIN_MAX) { + break; + + case DIG_TYPE_RX_GAIN_MAX: if (dm_value > 0x50) dm_value = 0x50; dm_digtable.rx_gain_range_max = (u8)dm_value; + break; + + default: + break; } + } /* DM_ChangeDynamicInitGainThresh */ /*----------------------------------------------------------------------------- @@ -2412,7 +2440,7 @@ static void dm_check_pbc_gpio(struct net_device *dev) *---------------------------------------------------------------------------*/ void dm_rf_pathcheck_workitemcallback(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, rfpath_check_wq); struct net_device *dev = priv->ieee80211->dev; /*bool bactually_set = false;*/ @@ -2769,12 +2797,14 @@ void dm_fsync_timer_callback(unsigned long data) if (bDoubleTimeInterval) { if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval*priv->ieee80211->fsync_multiple_timeinterval); + priv->fsync_timer.expires = jiffies + + msecs_to_jiffies(priv->ieee80211->fsync_time_interval*priv->ieee80211->fsync_multiple_timeinterval); add_timer(&priv->fsync_timer); } else { if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval); + priv->fsync_timer.expires = jiffies + + msecs_to_jiffies(priv->ieee80211->fsync_time_interval); add_timer(&priv->fsync_timer); } } else { @@ -2847,7 +2877,8 @@ static void dm_StartSWFsync(struct net_device *dev) } if (timer_pending(&priv->fsync_timer)) del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires = jiffies + MSECS(priv->ieee80211->fsync_time_interval); + priv->fsync_timer.expires = jiffies + + msecs_to_jiffies(priv->ieee80211->fsync_time_interval); add_timer(&priv->fsync_timer); write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c index 4911fef2e..f828e6441 100644 --- a/drivers/staging/rtl8192u/r8192U_wx.c +++ b/drivers/staging/rtl8192u/r8192U_wx.c @@ -1,21 +1,23 @@ -/* - This file contains wireless extension handlers. - - This is part of rtl8180 OpenSource driver. - Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> - Released under the terms of GPL (General Public Licence) - - Parts of this driver are based on the GPL part - of the official realtek driver. - - Parts of this driver are based on the rtl8180 driver skeleton - from Patric Schenke & Andres Salomon. - - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. - - We want to thank the Authors of those projects and the Ndiswrapper - project Authors. -*/ +/****************************************************************************** + * + * This file contains wireless extension handlers. + * + * This is part of rtl8180 OpenSource driver. + * Copyright (C) Andrea Merello 2004-2005 <andrea.merello@gmail.com> + * Released under the terms of GPL (General Public Licence) + * + * Parts of this driver are based on the GPL part + * of the official realtek driver. + * + * Parts of this driver are based on the rtl8180 driver skeleton + * from Patric Schenke & Andres Salomon. + * + * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. + * + * We want to thank the Authors of those projects and the Ndiswrapper + * project Authors. + * + *****************************************************************************/ #include <linux/string.h> #include "r8192U.h" diff --git a/drivers/staging/rtl8192u/r819xU_phy.c b/drivers/staging/rtl8192u/r819xU_phy.c index f264d8836..696df3440 100644 --- a/drivers/staging/rtl8192u/r819xU_phy.c +++ b/drivers/staging/rtl8192u/r819xU_phy.c @@ -1683,8 +1683,7 @@ void InitialGain819xUsb(struct net_device *dev, u8 Operation) void InitialGainOperateWorkItemCallBack(struct work_struct *work) { - struct delayed_work *dwork = container_of(work, struct delayed_work, - work); + struct delayed_work *dwork = to_delayed_work(work); struct r8192_priv *priv = container_of(dwork, struct r8192_priv, initialgain_operate_wq); struct net_device *dev = priv->ieee80211->dev; |