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"
source "drivers/staging/rtl8192su/Kconfig"
source "drivers/staging/rtl8192u/Kconfig"
source "drivers/staging/rtl8192e/Kconfig"
source "drivers/staging/mimio/Kconfig"
......
......@@ -21,6 +21,7 @@ obj-$(CONFIG_PANEL) += panel/
obj-$(CONFIG_ALTERA_PCIE_CHDMA) += altpciechdma/
obj-$(CONFIG_R8187SE) += rtl8187se/
obj-$(CONFIG_RTL8192SU) += rtl8192su/
obj-$(CONFIG_RTL8192U) += rtl8192u/
obj-$(CONFIG_RTL8192E) += rtl8192e/
obj-$(CONFIG_INPUT_MIMIO) += mimio/
obj-$(CONFIG_TRANZPORT) += frontier/
......
......@@ -10,6 +10,7 @@ EXTRA_CFLAGS += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO
#EXTRA_CFLAGS += -DUSB_RX_AGGREGATION_SUPPORT
EXTRA_CFLAGS += -DUSE_ONE_PIPE
EXTRA_CFLAGS += -DENABLE_DOT11D
EXTRA_CFLAGS += -Idrivers/staging/rtl8192u/ieee80211
r8192u_usb-objs := r8192U_core.o r8180_93cx6.o r8192U_wx.o \
r8190_rtl8256.o r819xU_phy.o r819xU_firmware.o \
......
......@@ -39,9 +39,9 @@
#include <linux/delay.h>
#include <linux/wireless.h>
#include "../../ieee80211/rtl819x_HT.h"
#include "../../ieee80211/rtl819x_BA.h"
#include "../../ieee80211/rtl819x_TS.h"
#include "ieee80211/rtl819x_HT.h"
#include "ieee80211/rtl819x_BA.h"
#include "ieee80211/rtl819x_TS.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
#ifndef bool
......
......@@ -53,14 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
list_del(ptr);
if (entry->ops) {
if (entry->ops)
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);
}
}
......@@ -208,8 +202,7 @@ static struct ieee80211_crypto_ops ieee80211_crypt_null = {
.owner = THIS_MODULE,
};
static int __init ieee80211_crypto_init(void)
int __init ieee80211_crypto_init(void)
{
int ret = -ENOMEM;
......@@ -230,8 +223,7 @@ static int __init ieee80211_crypto_init(void)
return ret;
}
static void __exit ieee80211_crypto_deinit(void)
void __exit ieee80211_crypto_deinit(void)
{
struct list_head *ptr, *n;
......@@ -250,24 +242,3 @@ static void __exit ieee80211_crypto_deinit(void)
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 @@
#include "ieee80211.h"
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "rtl_crypto.h"
#else
#include <linux/crypto.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <asm/scatterlist.h>
#else
#include <linux/scatterlist.h>
#endif
//#include <asm/scatterlist.h>
MODULE_AUTHOR("Jouni Malinen");
MODULE_DESCRIPTION("Host AP crypt: CCMP");
MODULE_LICENSE("GPL");
#ifndef OPENSUSE_SLED
#define OPENSUSE_SLED 0
#endif
#define AES_BLOCK_LEN 16
#define CCMP_HDR_LEN 8
#define CCMP_MIC_LEN 8
......@@ -75,21 +61,7 @@ struct ieee80211_ccmp_data {
void ieee80211_ccmp_aes_encrypt(struct crypto_tfm *tfm,
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);
#endif
}
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));
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);
if (IS_ERR(priv->tfm)) {
printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate "
......@@ -117,17 +81,13 @@ static void * ieee80211_ccmp_init(int key_idx)
priv->tfm = NULL;
goto fail;
}
#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
#if(LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
crypto_free_tfm(priv->tfm);
#else
crypto_free_cipher((void*)priv->tfm);
#endif
kfree(priv);
}
......@@ -138,12 +98,9 @@ static void * ieee80211_ccmp_init(int key_idx)
static void ieee80211_ccmp_deinit(void *priv)
{
struct ieee80211_ccmp_data *_priv = priv;
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);
#endif
kfree(priv);
}
......@@ -512,23 +469,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_ccmp = {
.owner = THIS_MODULE,
};
static int __init ieee80211_crypto_ccmp_init(void)
int __init ieee80211_crypto_ccmp_init(void)
{
return ieee80211_register_crypto_ops(&ieee80211_crypt_ccmp);
}
static void __exit ieee80211_crypto_ccmp_exit(void)
void __exit ieee80211_crypto_ccmp_exit(void)
{
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 @@
#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>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <asm/scatterlist.h>
#else
#include <linux/scatterlist.h>
#endif
//#include <asm/scatterlist.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_DESCRIPTION("Host AP crypt: WEP");
MODULE_LICENSE("GPL");
#ifndef OPENSUSE_SLED
#define OPENSUSE_SLED 0
#endif
struct prism2_wep_data {
u32 iv;
......@@ -62,12 +34,8 @@ struct prism2_wep_data {
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
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 *rx_tfm;
#endif
};
......@@ -81,14 +49,6 @@ static void * prism2_wep_init(int keyidx)
memset(priv, 0, sizeof(*priv));
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);
if (IS_ERR(priv->tx_tfm)) {
printk(KERN_DEBUG "ieee80211_crypt_wep: could not allocate "
......@@ -103,7 +63,6 @@ static void * prism2_wep_init(int keyidx)
priv->rx_tfm = NULL;
goto fail;
}
#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
......@@ -111,13 +70,6 @@ static void * prism2_wep_init(int keyidx)
return priv;
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->tx_tfm)
crypto_free_blkcipher(priv->tx_tfm);
......@@ -125,7 +77,7 @@ static void * prism2_wep_init(int keyidx)
crypto_free_blkcipher(priv->rx_tfm);
kfree(priv);
}
#endif
return NULL;
}
......@@ -133,17 +85,13 @@ static void * prism2_wep_init(int keyidx)
static void prism2_wep_deinit(void *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->tx_tfm)
crypto_free_blkcipher(_priv->tx_tfm);
if (_priv->rx_tfm)
crypto_free_blkcipher(_priv->rx_tfm);
}
#endif
kfree(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 *pos;
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};
#endif
u32 crc;
u8 *icv;
struct scatterlist sg;
......@@ -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 */
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
crc = ~crc32_le(~0, pos, len);
#else
crc = ~ether_crc_le(len, pos);
#endif
icv = skb_put(skb, 4);
icv[0] = crc;
icv[1] = crc >> 8;
icv[2] = crc >> 16;
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);
#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);
#endif
return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
#endif
}
return 0;
......@@ -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 keyidx, *pos;
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};
#endif
u32 crc;
u8 icv[4];
struct scatterlist sg;
......@@ -277,29 +203,13 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
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);
#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);
#endif
if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
return -7;
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
crc = ~crc32_le(~0, pos, plen);
#else
crc = ~ether_crc_le(plen, pos);
#endif
icv[0] = crc;
icv[1] = crc >> 8;
icv[2] = crc >> 16;
......@@ -370,14 +280,12 @@ static struct ieee80211_crypto_ops ieee80211_crypt_wep = {
.owner = THIS_MODULE,
};
static int __init ieee80211_crypto_wep_init(void)
int __init ieee80211_crypto_wep_init(void)
{
return ieee80211_register_crypto_ops(&ieee80211_crypt_wep);
}
static void __exit ieee80211_crypto_wep_exit(void)
void __exit ieee80211_crypto_wep_exit(void)
{
ieee80211_unregister_crypto_ops(&ieee80211_crypt_wep);
}
......@@ -387,11 +295,3 @@ void ieee80211_wep_null(void)
// printk("============>%s()\n", __FUNCTION__);
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)
goto failed;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
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);
ieee->dev = dev;
......@@ -167,12 +161,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
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);
#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)
{
IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n");
......@@ -181,13 +170,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
HTUpdateDefaultSetting(ieee);
HTInitializeHTInfo(ieee); //may move to other place.
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++)
INIT_LIST_HEAD(&ieee->ibss_mac_hash[i]);
......@@ -206,22 +189,15 @@ struct net_device *alloc_ieee80211(int sizeof_priv)
failed:
if (dev)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
free_netdev(dev);
#else
kfree(dev);
#endif
return NULL;
}
void free_ieee80211(struct net_device *dev)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
struct ieee80211_device *ieee = netdev_priv(dev);
#else
struct ieee80211_device *ieee = (struct ieee80211_device *)dev->priv;
#endif
int i;
//struct list_head *p, *q;
// del_timer_sync(&ieee->SwBwTimer);
......@@ -240,34 +216,15 @@ void free_ieee80211(struct net_device *dev)
for (i = 0; i < WEP_KEYS; i++) {
struct ieee80211_crypt_data *crypt = ieee->crypt[i];
if (crypt) {
if (crypt->ops) {
if (crypt->ops)
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);
ieee->crypt[i] = NULL;
}
}
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);
#else
kfree(dev);
#endif
}
#ifdef CONFIG_IEEE80211_DEBUG
......@@ -305,7 +262,7 @@ static int store_debug_level(struct file *file, const char *buffer,
unsigned long count, void *data)
{
char buf[] = "0x00000000";
unsigned long len = min(sizeof(buf) - 1, (u32)count);
unsigned long len = min(sizeof(buf) - 1, count);
char *p = (char *)buf;
unsigned long val;
......@@ -328,16 +285,13 @@ static int store_debug_level(struct file *file, const char *buffer,
return strnlen(buf, count);
}
static int __init ieee80211_init(void)
int __init ieee80211_debug_init(void)
{
struct proc_dir_entry *e;
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);
#endif
if (ieee80211_proc == NULL) {
IEEE80211_ERROR("Unable to create " DRV_NAME
" proc directory\n");
......@@ -346,11 +300,7 @@ static int __init ieee80211_init(void)
e = create_proc_entry("debug_level", S_IFREG | S_IRUGO | S_IWUSR,
ieee80211_proc);
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);
#endif
ieee80211_proc = NULL;
return -EIO;
}
......@@ -361,34 +311,16 @@ static int __init ieee80211_init(void)
return 0;
}
static void __exit ieee80211_exit(void)
void __exit ieee80211_debug_exit(void)
{
if (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);
#endif
ieee80211_proc = NULL;
}
}
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#include <linux/moduleparam.h>
module_param(debug, int, 0444);
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
......@@ -1175,18 +1175,14 @@ static int rtl8192_rx_initiate(struct net_device*dev)
}
// printk("nomal packet IN request!\n");
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);
info = (struct rtl8192_rx_info *) skb->cb;
info->urb = entry;
info->dev = dev;
info->out_pipe = 3; //denote rx normal packet queue
skb_queue_tail(&priv->rx_queue, skb);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
usb_submit_urb(entry, GFP_KERNEL);
#else
usb_submit_urb(entry);
#endif
}
/* command packet rx procedure */
......@@ -1205,18 +1201,14 @@ static int rtl8192_rx_initiate(struct net_device*dev)
break;
}
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);
info = (struct rtl8192_rx_info *) skb->cb;
info->urb = entry;
info->dev = dev;
info->out_pipe = 9; //denote rx cmd packet queue
skb_queue_tail(&priv->rx_queue, skb);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
usb_submit_urb(entry, GFP_KERNEL);
#else
usb_submit_urb(entry);
#endif
}
return 0;
......@@ -1586,7 +1578,7 @@ static void rtl8192_rx_isr(struct urb *urb)
}
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);
info = (struct rtl8192_rx_info *) skb->cb;
......@@ -1594,14 +1586,10 @@ static void rtl8192_rx_isr(struct urb *urb)
info->dev = dev;
info->out_pipe = out_pipe;
urb->transfer_buffer = skb->tail;
urb->transfer_buffer = skb_tail_pointer(skb);
urb->context = skb;
skb_queue_tail(&priv->rx_queue, skb);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
err = usb_submit_urb(urb, GFP_ATOMIC);
#else
err = usb_submit_urb(urb);
#endif
if(err && err != EPERM)
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)
#ifdef THOMAS_BEACON
{
int align = 0;
u32 oldaddr,newaddr;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
long align = 0;
void *oldaddr, *newaddr;
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);
oldaddr = (u32)priv->oldaddr;
align = oldaddr&3;
if(align != 0 ){
oldaddr = priv->oldaddr;
align = ((long)oldaddr) & 3;
if (align) {
newaddr = oldaddr + 4 - align;
priv->rx_urb[16]->transfer_buffer_length = 16-4+align;
}
else{
priv->rx_urb[16]->transfer_buffer_length = 16 - 4 + align;
} else {
newaddr = oldaddr;
priv->rx_urb[16]->transfer_buffer_length = 16;
}
priv->rx_urb[16]->transfer_buffer = (u32*)newaddr;
priv->rx_urb[16]->transfer_buffer = newaddr;
}
#endif
......@@ -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,
#endif
priv->udev=udev;
dev->open = rtl8192_open;
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;
dev->netdev_ops = &rtl8192_netdev_ops;
//DMESG("Oops: i'm coming\n");
#if WIRELESS_EXT >= 12
......@@ -7000,9 +6988,55 @@ static void __devexit rtl8192_usb_disconnect(struct usb_device *udev, void *ptr)
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)
{
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 "Copyright (c) 2007-2008, Realsil Wlan\n");
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