Commit f61fb935 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Greg Kroah-Hartman

Staging: rtl8192u: make it compile

Add it to staging Kbuild and fixes some API differences that prevents
compilation.

It seems that the ieee80211 stack is very close to rtl8192su one.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8fc8598e
...@@ -77,6 +77,8 @@ source "drivers/staging/rtl8187se/Kconfig" ...@@ -77,6 +77,8 @@ source "drivers/staging/rtl8187se/Kconfig"
source "drivers/staging/rtl8192su/Kconfig" source "drivers/staging/rtl8192su/Kconfig"
source "drivers/staging/rtl8192u/Kconfig"
source "drivers/staging/rtl8192e/Kconfig" source "drivers/staging/rtl8192e/Kconfig"
source "drivers/staging/mimio/Kconfig" source "drivers/staging/mimio/Kconfig"
......
...@@ -21,6 +21,7 @@ obj-$(CONFIG_PANEL) += panel/ ...@@ -21,6 +21,7 @@ obj-$(CONFIG_PANEL) += panel/
obj-$(CONFIG_ALTERA_PCIE_CHDMA) += altpciechdma/ obj-$(CONFIG_ALTERA_PCIE_CHDMA) += altpciechdma/
obj-$(CONFIG_R8187SE) += rtl8187se/ obj-$(CONFIG_R8187SE) += rtl8187se/
obj-$(CONFIG_RTL8192SU) += rtl8192su/ obj-$(CONFIG_RTL8192SU) += rtl8192su/
obj-$(CONFIG_RTL8192U) += rtl8192u/
obj-$(CONFIG_RTL8192E) += rtl8192e/ obj-$(CONFIG_RTL8192E) += rtl8192e/
obj-$(CONFIG_INPUT_MIMIO) += mimio/ obj-$(CONFIG_INPUT_MIMIO) += mimio/
obj-$(CONFIG_TRANZPORT) += frontier/ obj-$(CONFIG_TRANZPORT) += frontier/
......
...@@ -10,6 +10,7 @@ EXTRA_CFLAGS += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO ...@@ -10,6 +10,7 @@ EXTRA_CFLAGS += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO
#EXTRA_CFLAGS += -DUSB_RX_AGGREGATION_SUPPORT #EXTRA_CFLAGS += -DUSB_RX_AGGREGATION_SUPPORT
EXTRA_CFLAGS += -DUSE_ONE_PIPE EXTRA_CFLAGS += -DUSE_ONE_PIPE
EXTRA_CFLAGS += -DENABLE_DOT11D EXTRA_CFLAGS += -DENABLE_DOT11D
EXTRA_CFLAGS += -Idrivers/staging/rtl8192u/ieee80211
r8192u_usb-objs := r8192U_core.o r8180_93cx6.o r8192U_wx.o \ r8192u_usb-objs := r8192U_core.o r8180_93cx6.o r8192U_wx.o \
r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \ r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \
......
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/wireless.h> #include <linux/wireless.h>
#include "../../ieee80211/rtl819x_HT.h" #include "ieee80211/rtl819x_HT.h"
#include "../../ieee80211/rtl819x_BA.h" #include "ieee80211/rtl819x_BA.h"
#include "../../ieee80211/rtl819x_TS.h" #include "ieee80211/rtl819x_TS.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
#ifndef bool #ifndef bool
......
...@@ -53,14 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee, ...@@ -53,14 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
list_del(ptr); list_del(ptr);
if (entry->ops) { if (entry->ops)
entry->ops->deinit(entry->priv); entry->ops->deinit(entry->priv);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
module_put(entry->ops->owner);
#else
__MOD_DEC_USE_COUNT(entry->ops->owner);
#endif
}
kfree(entry); kfree(entry);
} }
} }
...@@ -208,8 +202,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = { ...@@ -208,8 +202,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
int __init ieee80211_crypto_init(void)
static int __init ieee80211_crypto_init(void)
{ {
int ret = -ENOMEM; int ret = -ENOMEM;
...@@ -230,8 +223,7 @@ static int __init ieee80211_crypto_init(void) ...@@ -230,8 +223,7 @@ static int __init ieee80211_crypto_init(void)
return ret; return ret;
} }
void __exit ieee80211_crypto_deinit(void)
static void __exit ieee80211_crypto_deinit(void)
{ {
struct list_head *ptr, *n; struct list_head *ptr, *n;
...@@ -250,24 +242,3 @@ static void __exit ieee80211_crypto_deinit(void) ...@@ -250,24 +242,3 @@ static void __exit ieee80211_crypto_deinit(void)
kfree(hcrypt); kfree(hcrypt);
} }
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_crypt_deinit_entries);
EXPORT_SYMBOL(ieee80211_crypt_deinit_handler);
EXPORT_SYMBOL(ieee80211_crypt_delayed_deinit);
EXPORT_SYMBOL(ieee80211_register_crypto_ops);
EXPORT_SYMBOL(ieee80211_unregister_crypto_ops);
EXPORT_SYMBOL(ieee80211_get_crypto_ops);
#else
EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_entries);
EXPORT_SYMBOL_NOVERS(ieee80211_crypt_deinit_handler);
EXPORT_SYMBOL_NOVERS(ieee80211_crypt_delayed_deinit);
EXPORT_SYMBOL_NOVERS(ieee80211_register_crypto_ops);
EXPORT_SYMBOL_NOVERS(ieee80211_unregister_crypto_ops);
EXPORT_SYMBOL_NOVERS(ieee80211_get_crypto_ops);
#endif
module_init(ieee80211_crypto_init);
module_exit(ieee80211_crypto_deinit);
...@@ -24,27 +24,13 @@ ...@@ -24,27 +24,13 @@
#include "ieee80211.h" #include "ieee80211.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "rtl_crypto.h"
#else
#include <linux/crypto.h> #include <linux/crypto.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <asm/scatterlist.h>
#else
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#endif
//#include <asm/scatterlist.h>
MODULE_AUTHOR("Jouni Malinen"); MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP"); MODULE_DESCRIPTION("Host AP crypt: CCMP");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifndef OPENSUSE_SLED
#define OPENSUSE_SLED 0
#endif
#define AES_BLOCK_LEN 16 #define AES_BLOCK_LEN 16
#define CCMP_HDR_LEN 8 #define CCMP_HDR_LEN 8
#define CCMP_MIC_LEN 8 #define CCMP_MIC_LEN 8
...@@ -75,21 +61,7 @@ struct ieee80211_ccmp_data { ...@@ -75,21 +61,7 @@ struct ieee80211_ccmp_data {
void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm, void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16]) const u8 pt[16], u8 ct[16])
{ {
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
struct scatterlist src, dst;
src.page = virt_to_page(pt);
src.offset = offset_in_page(pt);
src.length = AES_BLOCK_LEN;
dst.page = virt_to_page(ct);
dst.offset = offset_in_page(ct);
dst.length = AES_BLOCK_LEN;
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
#else
crypto_cipher_encrypt_one((void*)tfm, ct, pt); crypto_cipher_encrypt_one((void*)tfm, ct, pt);
#endif
} }
static void * ieee80211_ccmp_init(int key_idx) static void * ieee80211_ccmp_init(int key_idx)
...@@ -102,14 +74,6 @@ static void * ieee80211_ccmp_init(int key_idx) ...@@ -102,14 +74,6 @@ static void * ieee80211_ccmp_init(int key_idx)
memset(priv, 0, sizeof(*priv)); memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx; priv->key_idx = key_idx;
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
#else
priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) { if (IS_ERR(priv->tfm)) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate " printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
...@@ -117,17 +81,13 @@ static void * ieee80211_ccmp_init(int key_idx) ...@@ -117,17 +81,13 @@ static void * ieee80211_ccmp_init(int key_idx)
priv->tfm = NULL; priv->tfm = NULL;
goto fail; goto fail;
} }
#endif
return priv; return priv;
fail: fail:
if (priv) { if (priv) {
if (priv->tfm) if (priv->tfm)
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
crypto_free_tfm(priv->tfm);
#else
crypto_free_cipher((void*)priv->tfm); crypto_free_cipher((void*)priv->tfm);
#endif
kfree(priv); kfree(priv);
} }
...@@ -138,12 +98,9 @@ static void * ieee80211_ccmp_init(int key_idx) ...@@ -138,12 +98,9 @@ static void * ieee80211_ccmp_init(int key_idx)
static void ieee80211_ccmp_deinit(void *priv) static void ieee80211_ccmp_deinit(void *priv)
{ {
struct ieee80211_ccmp_data *_priv = priv; struct ieee80211_ccmp_data *_priv = priv;
if (_priv && _priv->tfm) if (_priv && _priv->tfm)
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
crypto_free_tfm(_priv->tfm);
#else
crypto_free_cipher((void*)_priv->tfm); crypto_free_cipher((void*)_priv->tfm);
#endif
kfree(priv); kfree(priv);
} }
...@@ -512,23 +469,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = { ...@@ -512,23 +469,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
int __init ieee80211_crypto_ccmp_init(void)
static int __init ieee80211_crypto_ccmp_init(void)
{ {
return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp); return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
} }
void __exit ieee80211_crypto_ccmp_exit(void)
static void __exit ieee80211_crypto_ccmp_exit(void)
{ {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp); ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
} }
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_ccmp_null);
#else
EXPORT_SYMBOL_NOVERS(ieee80211_ccmp_null);
#endif
module_init(ieee80211_crypto_ccmp_init);
module_exit(ieee80211_crypto_ccmp_exit);
...@@ -20,41 +20,13 @@ ...@@ -20,41 +20,13 @@
#include "ieee80211.h" #include "ieee80211.h"
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
//#include "crypto_compat.h"
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "rtl_crypto.h"
#else
#include <linux/crypto.h> #include <linux/crypto.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <asm/scatterlist.h>
#else
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
#endif
//#include <asm/scatterlist.h>
#include <linux/crc32.h> #include <linux/crc32.h>
//
/*
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "rtl_crypto.h"
#else
#include <linux/crypto.h>
#endif
#include <asm/scatterlist.h>
#include <linux/crc32.h>
*/
MODULE_AUTHOR("Jouni Malinen"); MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: WEP"); MODULE_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifndef OPENSUSE_SLED
#define OPENSUSE_SLED 0
#endif
struct prism2_wep_data { struct prism2_wep_data {
u32 iv; u32 iv;
...@@ -62,12 +34,8 @@ struct prism2_wep_data { ...@@ -62,12 +34,8 @@ struct prism2_wep_data {
u8 key[WEP_KEY_LEN + 1]; u8 key[WEP_KEY_LEN + 1];
u8 key_len; u8 key_len;
u8 key_idx; u8 key_idx;
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
struct crypto_tfm *tfm;
#else
struct crypto_blkcipher *tx_tfm; struct crypto_blkcipher *tx_tfm;
struct crypto_blkcipher *rx_tfm; struct crypto_blkcipher *rx_tfm;
#endif
}; };
...@@ -81,14 +49,6 @@ static void * prism2_wep_init(int keyidx) ...@@ -81,14 +49,6 @@ static void * prism2_wep_init(int keyidx)
memset(priv, 0, sizeof(*priv)); memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx; priv->key_idx = keyidx;
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
#else
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tx_tfm)) { if (IS_ERR(priv->tx_tfm)) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate " printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
...@@ -103,7 +63,6 @@ static void * prism2_wep_init(int keyidx) ...@@ -103,7 +63,6 @@ static void * prism2_wep_init(int keyidx)
priv->rx_tfm = NULL; priv->rx_tfm = NULL;
goto fail; goto fail;
} }
#endif
/* start WEP IV from a random value */ /* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4); get_random_bytes(&priv->iv, 4);
...@@ -111,13 +70,6 @@ static void * prism2_wep_init(int keyidx) ...@@ -111,13 +70,6 @@ static void * prism2_wep_init(int keyidx)
return priv; return priv;
fail: fail:
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
if (priv) {
if (priv->tfm)
crypto_free_tfm(priv->tfm);
kfree(priv);
}
#else
if (priv) { if (priv) {
if (priv->tx_tfm) if (priv->tx_tfm)
crypto_free_blkcipher(priv->tx_tfm); crypto_free_blkcipher(priv->tx_tfm);
...@@ -125,7 +77,7 @@ static void * prism2_wep_init(int keyidx) ...@@ -125,7 +77,7 @@ static void * prism2_wep_init(int keyidx)
crypto_free_blkcipher(priv->rx_tfm); crypto_free_blkcipher(priv->rx_tfm);
kfree(priv); kfree(priv);
} }
#endif
return NULL; return NULL;
} }
...@@ -133,17 +85,13 @@ static void * prism2_wep_init(int keyidx) ...@@ -133,17 +85,13 @@ static void * prism2_wep_init(int keyidx)
static void prism2_wep_deinit(void *priv) static void prism2_wep_deinit(void *priv)
{ {
struct prism2_wep_data *_priv = priv; struct prism2_wep_data *_priv = priv;
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
#else
if (_priv) { if (_priv) {
if (_priv->tx_tfm) if (_priv->tx_tfm)
crypto_free_blkcipher(_priv->tx_tfm); crypto_free_blkcipher(_priv->tx_tfm);
if (_priv->rx_tfm) if (_priv->rx_tfm)
crypto_free_blkcipher(_priv->rx_tfm); crypto_free_blkcipher(_priv->rx_tfm);
} }
#endif
kfree(priv); kfree(priv);
} }
...@@ -160,9 +108,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -160,9 +108,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
u8 key[WEP_KEY_LEN + 3]; u8 key[WEP_KEY_LEN + 3];
u8 *pos; u8 *pos;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
#if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
struct blkcipher_desc desc = {.tfm = wep->tx_tfm}; struct blkcipher_desc desc = {.tfm = wep->tx_tfm};
#endif
u32 crc; u32 crc;
u8 *icv; u8 *icv;
struct scatterlist sg; struct scatterlist sg;
...@@ -201,35 +147,17 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -201,35 +147,17 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
{ {
/* Append little-endian CRC32 and encrypt it to produce ICV */ /* Append little-endian CRC32 and encrypt it to produce ICV */
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
crc = ~crc32_le(~0, pos, len); crc = ~crc32_le(~0, pos, len);
#else
crc = ~ether_crc_le(len, pos);
#endif
icv = skb_put(skb, 4); icv = skb_put(skb, 4);
icv[0] = crc; icv[0] = crc;
icv[1] = crc >> 8; icv[1] = crc >> 8;
icv[2] = crc >> 16; icv[2] = crc >> 16;
icv[3] = crc >> 24; icv[3] = crc >> 24;
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
crypto_cipher_setkey(wep->tfm, key, klen);
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
#else
crypto_blkcipher_setkey(wep->tx_tfm, key, klen); crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
#else
sg_init_one(&sg, pos, len+4); sg_init_one(&sg, pos, len+4);
#endif
return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4); return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
#endif
} }
return 0; return 0;
...@@ -250,9 +178,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -250,9 +178,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
u8 key[WEP_KEY_LEN + 3]; u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos; u8 keyidx, *pos;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
#if((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED))
struct blkcipher_desc desc = {.tfm = wep->rx_tfm}; struct blkcipher_desc desc = {.tfm = wep->rx_tfm};
#endif
u32 crc; u32 crc;
u8 icv[4]; u8 icv[4];
struct scatterlist sg; struct scatterlist sg;
...@@ -277,29 +203,13 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv) ...@@ -277,29 +203,13 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
if (!tcb_desc->bHwSec) if (!tcb_desc->bHwSec)
{ {
#if((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED))
crypto_cipher_setkey(wep->tfm, key, klen);
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
#else
crypto_blkcipher_setkey(wep->rx_tfm, key, klen); crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
#else
sg_init_one(&sg, pos, plen+4); sg_init_one(&sg, pos, plen+4);
#endif
if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4)) if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
return -7; return -7;
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
crc = ~crc32_le(~0, pos, plen); crc = ~crc32_le(~0, pos, plen);
#else
crc = ~ether_crc_le(plen, pos);
#endif
icv[0] = crc; icv[0] = crc;
icv[1] = crc >> 8; icv[1] = crc >> 8;
icv[2] = crc >> 16; icv[2] = crc >> 16;
...@@ -370,14 +280,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = { ...@@ -370,14 +280,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
int __init ieee80211_crypto_wep_init(void)
static int __init ieee80211_crypto_wep_init(void)
{ {
return ieee80211_register_crypto_ops(&ieee80211_crypt_wep); return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
} }
void __exit ieee80211_crypto_wep_exit(void)
static void __exit ieee80211_crypto_wep_exit(void)
{ {
ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep); ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
} }
...@@ -387,11 +295,3 @@ void ieee80211_wep_null(void) ...@@ -387,11 +295,3 @@ void ieee80211_wep_null(void)
// printk("============>%s()\n", __FUNCTION__); // printk("============>%s()\n", __FUNCTION__);
return; return;
} }
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(ieee80211_wep_null);
#else
EXPORT_SYMBOL_NOVERS(ieee80211_wep_null);
#endif
module_init(ieee80211_crypto_wep_init);
module_exit(ieee80211_crypto_wep_exit);
...@@ -113,13 +113,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ...@@ -113,13 +113,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
goto failed; goto failed;
} }
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
ieee = netdev_priv(dev); ieee = netdev_priv(dev);
#else
ieee = (struct ieee80211_device *)dev->priv;
#endif
dev->hard_start_xmit = ieee80211_xmit;
memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv);
ieee->dev = dev; ieee->dev = dev;
...@@ -167,12 +161,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ...@@ -167,12 +161,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
ieee80211_softmac_init(ieee); ieee80211_softmac_init(ieee);
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
#else
ieee->pHTInfo = (RT_HIGH_THROUGHPUT*)kmalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL);
memset(ieee->pHTInfo,0,sizeof(RT_HIGH_THROUGHPUT));
#endif
if (ieee->pHTInfo == NULL) if (ieee->pHTInfo == NULL)
{ {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n"); IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n");
...@@ -181,13 +170,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ...@@ -181,13 +170,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
HTUpdateDefaultSetting(ieee); HTUpdateDefaultSetting(ieee);
HTInitializeHTInfo(ieee); //may move to other place. HTInitializeHTInfo(ieee); //may move to other place.
TSInitialize(ieee); TSInitialize(ieee);
#if 0
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq);
#else
INIT_WORK(&ieee->ht_onAssRsp, (void(*)(void*)) HTOnAssocRsp_wq, ieee);
#endif
#endif
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]); INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
...@@ -206,22 +189,15 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ...@@ -206,22 +189,15 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
failed: failed:
if (dev) if (dev)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
free_netdev(dev); free_netdev(dev);
#else
kfree(dev);
#endif
return NULL; return NULL;
} }
void free_ieee80211(struct net_device *dev) void free_ieee80211(struct net_device *dev)
{ {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
struct ieee80211_device *ieee = netdev_priv(dev); struct ieee80211_device *ieee = netdev_priv(dev);
#else
struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
#endif
int i; int i;
//struct list_head *p, *q; //struct list_head *p, *q;
// del_timer_sync(&ieee->SwBwTimer); // del_timer_sync(&ieee->SwBwTimer);
...@@ -240,34 +216,15 @@ void free_ieee80211(struct net_device *dev) ...@@ -240,34 +216,15 @@ void free_ieee80211(struct net_device *dev)
for (i = 0; i < WEP_KEYS; i++) { for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i]; struct ieee80211_crypt_data *crypt = ieee->crypt[i];
if (crypt) { if (crypt) {
if (crypt->ops) { if (crypt->ops)
crypt->ops->deinit(crypt->priv); crypt->ops->deinit(crypt->priv);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
module_put(crypt->ops->owner);
#else
__MOD_DEC_USE_COUNT(crypt->ops->owner);
#endif
}
kfree(crypt); kfree(crypt);
ieee->crypt[i] = NULL; ieee->crypt[i] = NULL;
} }
} }
ieee80211_networks_free(ieee); ieee80211_networks_free(ieee);
#if 0
for (i = 0; i < IEEE_IBSS_MAC_HASH_SIZE; i++) {
list_for_each_safe(p, q, &ieee->ibss_mac_hash[i]) {
kfree(list_entry(p, struct ieee_ibss_seq, list));
list_del(p);
}
}
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
free_netdev(dev); free_netdev(dev);
#else
kfree(dev);
#endif
} }
#ifdef CONFIG_IEEE80211_DEBUG #ifdef CONFIG_IEEE80211_DEBUG
...@@ -305,7 +262,7 @@ static int store_debug_level(struct file *file, const char *buffer, ...@@ -305,7 +262,7 @@ static int store_debug_level(struct file *file, const char *buffer,
unsigned long count, void *data) unsigned long count, void *data)
{ {
char buf[] = "0x00000000"; char buf[] = "0x00000000";
unsigned long len = min(sizeof(buf) - 1, (u32)count); unsigned long len = min(sizeof(buf) - 1, count);
char *p = (char *)buf; char *p = (char *)buf;
unsigned long val; unsigned long val;
...@@ -328,16 +285,13 @@ static int store_debug_level(struct file *file, const char *buffer, ...@@ -328,16 +285,13 @@ static int store_debug_level(struct file *file, const char *buffer,
return strnlen(buf, count); return strnlen(buf, count);
} }
static int __init ieee80211_init(void) int __init ieee80211_debug_init(void)
{ {
struct proc_dir_entry *e; struct proc_dir_entry *e;
ieee80211_debug_level = debug; ieee80211_debug_level = debug;
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, proc_net);
#else
ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net); ieee80211_proc = create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net);
#endif
if (ieee80211_proc == NULL) { if (ieee80211_proc == NULL) {
IEEE80211_ERROR("Unable to create " DRV_NAME IEEE80211_ERROR("Unable to create " DRV_NAME
" proc directory\n"); " proc directory\n");
...@@ -346,11 +300,7 @@ static int __init ieee80211_init(void) ...@@ -346,11 +300,7 @@ static int __init ieee80211_init(void)
e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR, e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR,
ieee80211_proc); ieee80211_proc);
if (!e) { if (!e) {
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
remove_proc_entry(DRV_NAME, proc_net);
#else
remove_proc_entry(DRV_NAME, init_net.proc_net); remove_proc_entry(DRV_NAME, init_net.proc_net);
#endif
ieee80211_proc = NULL; ieee80211_proc = NULL;
return -EIO; return -EIO;
} }
...@@ -361,34 +311,16 @@ static int __init ieee80211_init(void) ...@@ -361,34 +311,16 @@ static int __init ieee80211_init(void)
return 0; return 0;
} }
static void __exit ieee80211_exit(void) void __exit ieee80211_debug_exit(void)
{ {
if (ieee80211_proc) { if (ieee80211_proc) {
remove_proc_entry("debug_level", ieee80211_proc); remove_proc_entry("debug_level", ieee80211_proc);
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
remove_proc_entry(DRV_NAME, proc_net);
#else
remove_proc_entry(DRV_NAME, init_net.proc_net); remove_proc_entry(DRV_NAME, init_net.proc_net);
#endif
ieee80211_proc = NULL; ieee80211_proc = NULL;
} }
} }
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
module_param(debug, int, 0444); module_param(debug, int, 0444);
MODULE_PARM_DESC(debug, "debug output mask"); MODULE_PARM_DESC(debug, "debug output mask");
module_exit(ieee80211_exit);
module_init(ieee80211_init);
#endif
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
EXPORT_SYMBOL(alloc_ieee80211);
EXPORT_SYMBOL(free_ieee80211);
#else
EXPORT_SYMBOL_NOVERS(alloc_ieee80211);
EXPORT_SYMBOL_NOVERS(free_ieee80211);
#endif #endif
...@@ -1175,18 +1175,14 @@ static int rtl8192_rx_initiate(struct net_device*dev) ...@@ -1175,18 +1175,14 @@ static int rtl8192_rx_initiate(struct net_device*dev)
} }
// printk("nomal packet IN request!\n"); // printk("nomal packet IN request!\n");
usb_fill_bulk_urb(entry, priv->udev, usb_fill_bulk_urb(entry, priv->udev,
usb_rcvbulkpipe(priv->udev, 3), skb->tail, usb_rcvbulkpipe(priv->udev, 3), skb_tail_pointer(skb),
RX_URB_SIZE, rtl8192_rx_isr, skb); RX_URB_SIZE, rtl8192_rx_isr, skb);
info = (struct rtl8192_rx_info *) skb->cb; info = (struct rtl8192_rx_info *) skb->cb;
info->urb = entry; info->urb = entry;
info->dev = dev; info->dev = dev;
info->out_pipe = 3; //denote rx normal packet queue info->out_pipe = 3; //denote rx normal packet queue
skb_queue_tail(&priv->rx_queue, skb); skb_queue_tail(&priv->rx_queue, skb);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
usb_submit_urb(entry, GFP_KERNEL); usb_submit_urb(entry, GFP_KERNEL);
#else
usb_submit_urb(entry);
#endif
} }
/* command packet rx procedure */ /* command packet rx procedure */
...@@ -1205,18 +1201,14 @@ static int rtl8192_rx_initiate(struct net_device*dev) ...@@ -1205,18 +1201,14 @@ static int rtl8192_rx_initiate(struct net_device*dev)
break; break;
} }
usb_fill_bulk_urb(entry, priv->udev, usb_fill_bulk_urb(entry, priv->udev,
usb_rcvbulkpipe(priv->udev, 9), skb->tail, usb_rcvbulkpipe(priv->udev, 9), skb_tail_pointer(skb),
RX_URB_SIZE, rtl8192_rx_isr, skb); RX_URB_SIZE, rtl8192_rx_isr, skb);
info = (struct rtl8192_rx_info *) skb->cb; info = (struct rtl8192_rx_info *) skb->cb;
info->urb = entry; info->urb = entry;
info->dev = dev; info->dev = dev;
info->out_pipe = 9; //denote rx cmd packet queue info->out_pipe = 9; //denote rx cmd packet queue
skb_queue_tail(&priv->rx_queue, skb); skb_queue_tail(&priv->rx_queue, skb);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
usb_submit_urb(entry, GFP_KERNEL); usb_submit_urb(entry, GFP_KERNEL);
#else
usb_submit_urb(entry);
#endif
} }
return 0; return 0;
...@@ -1586,7 +1578,7 @@ static void rtl8192_rx_isr(struct urb *urb) ...@@ -1586,7 +1578,7 @@ static void rtl8192_rx_isr(struct urb *urb)
} }
usb_fill_bulk_urb(urb, priv->udev, usb_fill_bulk_urb(urb, priv->udev,
usb_rcvbulkpipe(priv->udev, out_pipe), skb->tail, usb_rcvbulkpipe(priv->udev, out_pipe), skb_tail_pointer(skb),
RX_URB_SIZE, rtl8192_rx_isr, skb); RX_URB_SIZE, rtl8192_rx_isr, skb);
info = (struct rtl8192_rx_info *) skb->cb; info = (struct rtl8192_rx_info *) skb->cb;
...@@ -1594,14 +1586,10 @@ static void rtl8192_rx_isr(struct urb *urb) ...@@ -1594,14 +1586,10 @@ static void rtl8192_rx_isr(struct urb *urb)
info->dev = dev; info->dev = dev;
info->out_pipe = out_pipe; info->out_pipe = out_pipe;
urb->transfer_buffer = skb->tail; urb->transfer_buffer = skb_tail_pointer(skb);
urb->context = skb; urb->context = skb;
skb_queue_tail(&priv->rx_queue, skb); skb_queue_tail(&priv->rx_queue, skb);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
err = usb_submit_urb(urb, GFP_ATOMIC); err = usb_submit_urb(urb, GFP_ATOMIC);
#else
err = usb_submit_urb(urb);
#endif
if(err && err != EPERM) if(err && err != EPERM)
printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status); printk("can not submit rxurb, err is %x,URB status is %x\n",err,urb->status);
} }
...@@ -2953,25 +2941,21 @@ short rtl8192_usb_initendpoints(struct net_device *dev) ...@@ -2953,25 +2941,21 @@ short rtl8192_usb_initendpoints(struct net_device *dev)
#ifdef THOMAS_BEACON #ifdef THOMAS_BEACON
{ {
int align = 0; long align = 0;
u32 oldaddr,newaddr; void *oldaddr, *newaddr;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL); priv->rx_urb[16] = usb_alloc_urb(0, GFP_KERNEL);
#else
priv->rx_urb[16] = usb_alloc_urb(0);
#endif
priv->oldaddr = kmalloc(16, GFP_KERNEL); priv->oldaddr = kmalloc(16, GFP_KERNEL);
oldaddr = (u32)priv->oldaddr; oldaddr = priv->oldaddr;
align = oldaddr&3; align = ((long)oldaddr) & 3;
if(align != 0 ){ if (align) {
newaddr = oldaddr + 4 - align; newaddr = oldaddr + 4 - align;
priv->rx_urb[16]->transfer_buffer_length = 16-4+align; priv->rx_urb[16]->transfer_buffer_length = 16 - 4 + align;
} } else {
else{
newaddr = oldaddr; newaddr = oldaddr;
priv->rx_urb[16]->transfer_buffer_length = 16; priv->rx_urb[16]->transfer_buffer_length = 16;
} }
priv->rx_urb[16]->transfer_buffer = (u32*)newaddr; priv->rx_urb[16]->transfer_buffer = newaddr;
} }
#endif #endif
...@@ -6831,6 +6815,18 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv) ...@@ -6831,6 +6815,18 @@ void rtl8192_irq_rx_tasklet(struct r8192_priv *priv)
} }
} }
static const struct net_device_ops rtl8192_netdev_ops = {
.ndo_open = rtl8192_open,
.ndo_stop = rtl8192_close,
.ndo_get_stats = rtl8192_stats,
.ndo_tx_timeout = tx_timeout,
.ndo_do_ioctl = rtl8192_ioctl,
.ndo_set_multicast_list = r8192_set_multicast,
.ndo_set_mac_address = r8192_set_mac_adr,
.ndo_validate_addr = eth_validate_addr,
.ndo_change_mtu = eth_change_mtu,
.ndo_start_xmit = ieee80211_xmit,
};
/**************************************************************************** /****************************************************************************
...@@ -6872,15 +6868,7 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, ...@@ -6872,15 +6868,7 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev,
#endif #endif
priv->udev=udev; priv->udev=udev;
dev->open = rtl8192_open; dev->netdev_ops = &rtl8192_netdev_ops;
dev->stop = rtl8192_close;
//dev->hard_start_xmit = rtl8192_8023_hard_start_xmit;
dev->tx_timeout = tx_timeout;
//dev->wireless_handlers = &r8192_wx_handlers_def;
dev->do_ioctl = rtl8192_ioctl;
dev->set_multicast_list = r8192_set_multicast;
dev->set_mac_address = r8192_set_mac_adr;
dev->get_stats = rtl8192_stats;
//DMESG("Oops: i'm coming\n"); //DMESG("Oops: i'm coming\n");
#if WIRELESS_EXT >= 12 #if WIRELESS_EXT >= 12
...@@ -7000,9 +6988,55 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr) ...@@ -7000,9 +6988,55 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
RT_TRACE(COMP_DOWN, "wlan driver removed\n"); RT_TRACE(COMP_DOWN, "wlan driver removed\n");
} }
/* fun with the built-in ieee80211 stack... */
extern int ieee80211_debug_init(void);
extern void ieee80211_debug_exit(void);
extern int ieee80211_crypto_init(void);
extern void ieee80211_crypto_deinit(void);
extern int ieee80211_crypto_tkip_init(void);
extern void ieee80211_crypto_tkip_exit(void);
extern int ieee80211_crypto_ccmp_init(void);
extern void ieee80211_crypto_ccmp_exit(void);
extern int ieee80211_crypto_wep_init(void);
extern void ieee80211_crypto_wep_exit(void);
static int __init rtl8192_usb_module_init(void) static int __init rtl8192_usb_module_init(void)
{ {
int ret;
#ifdef CONFIG_IEEE80211_DEBUG
ret = ieee80211_debug_init();
if (ret) {
printk(KERN_ERR "ieee80211_debug_init() failed %d\n", ret);
return ret;
}
#endif
ret = ieee80211_crypto_init();
if (ret) {
printk(KERN_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);
return ret;
}
ret = ieee80211_crypto_ccmp_init();
if (ret) {
printk(KERN_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);
return ret;
}
printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n"); printk(KERN_INFO "\nLinux kernel driver for RTL8192 based WLAN cards\n");
printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n"); printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan\n");
RT_TRACE(COMP_INIT, "Initializing module"); RT_TRACE(COMP_INIT, "Initializing module");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment