diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 20:18:17 (GMT) |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-09 20:18:17 (GMT) |
commit | 12e55508921865aefdd80fd17afe70c191afbd1b (patch) | |
tree | 476b3226fd9602b36bed0934409959bdd24a7eb5 /drivers/staging/rtl8192e | |
parent | 55b81e6f2795484ea8edf5805c95c007cacfa736 (diff) | |
parent | 4d447c9a6ebc0142d320f075c5bac6d202a79fd4 (diff) | |
download | linux-fsl-qoriq-12e55508921865aefdd80fd17afe70c191afbd1b.tar.xz |
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (466 commits)
net/hyperv: Add support for jumbo frame up to 64KB
net/hyperv: Add NETVSP protocol version negotiation
net/hyperv: Remove unnecessary kmap_atomic in netvsc driver
staging/rtl8192e: Register against lib80211
staging/rtl8192e: Convert to lib80211_crypt_info
staging/rtl8192e: Convert to lib80211_crypt_data and lib80211_crypt_ops
staging/rtl8192e: Add lib80211.h to rtllib.h
staging/mei: add watchdog device registration wrappers
drm/omap: GEM, deal with cache
staging: vt6656: int.c, int.h: Change return of function to void
staging: usbip: removed unused definitions from header
staging: usbip: removed dead code from receive function
staging:iio: Drop {mark,unmark}_in_use callbacks
staging:iio: Drop buffer mark_param_change callback
staging:iio: Drop the unused buffer enable() and is_enabled() callbacks
staging:iio: Drop buffer busy flag
staging:iio: Make sure a device is only opened once at a time
staging:iio: Disallow modifying buffer size when buffer is enabled
staging:iio: Disallow changing scan elements in all buffered modes
staging:iio: Use iio_buffer_enabled instead of open coding it
...
Fix up conflict in drivers/staging/iio/adc/ad799x_core.c (removal of
module_init due to using module_i2c_driver() helper, next to removal of
MODULE_ALIAS due to using MODULE_DEVICE_TABLE instead).
Diffstat (limited to 'drivers/staging/rtl8192e')
-rw-r--r-- | drivers/staging/rtl8192e/Kconfig | 50 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/Makefile | 46 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/dot11d.c | 4 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/dot11d.h | 2 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/Kconfig | 9 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/Makefile | 21 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8190P_def.h (renamed from drivers/staging/rtl8192e/r8190P_def.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c (renamed from drivers/staging/rtl8192e/r8190P_rtl8256.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h (renamed from drivers/staging/rtl8192e/r8190P_rtl8256.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c (renamed from drivers/staging/rtl8192e/r8192E_cmdpkt.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h (renamed from drivers/staging/rtl8192e/r8192E_cmdpkt.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c (renamed from drivers/staging/rtl8192e/r8192E_dev.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h (renamed from drivers/staging/rtl8192e/r8192E_dev.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c (renamed from drivers/staging/rtl8192e/r8192E_firmware.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h (renamed from drivers/staging/rtl8192e/r8192E_firmware.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h (renamed from drivers/staging/rtl8192e/r8192E_hw.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c (renamed from drivers/staging/rtl8192e/r8192E_hwimg.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h (renamed from drivers/staging/rtl8192e/r8192E_hwimg.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c (renamed from drivers/staging/rtl8192e/r8192E_phy.c) | 3 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h (renamed from drivers/staging/rtl8192e/r8192E_phy.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h (renamed from drivers/staging/rtl8192e/r8192E_phyreg.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h (renamed from drivers/staging/rtl8192e/r819xE_phyreg.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_cam.c (renamed from drivers/staging/rtl8192e/rtl_cam.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_cam.h (renamed from drivers/staging/rtl8192e/rtl_cam.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_core.c (renamed from drivers/staging/rtl8192e/rtl_core.c) | 68 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_core.h (renamed from drivers/staging/rtl8192e/rtl_core.h) | 53 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h (renamed from drivers/staging/rtl8192e/rtl_crypto.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_debug.c (renamed from drivers/staging/rtl8192e/rtl_debug.c) | 79 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_dm.c (renamed from drivers/staging/rtl8192e/rtl_dm.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_dm.h (renamed from drivers/staging/rtl8192e/rtl_dm.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c (renamed from drivers/staging/rtl8192e/rtl_eeprom.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h (renamed from drivers/staging/rtl8192e/rtl_eeprom.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c (renamed from drivers/staging/rtl8192e/rtl_ethtool.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_pci.c (renamed from drivers/staging/rtl8192e/rtl_pci.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_pci.h (renamed from drivers/staging/rtl8192e/rtl_pci.h) | 1 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_pm.c (renamed from drivers/staging/rtl8192e/rtl_pm.c) | 2 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_pm.h (renamed from drivers/staging/rtl8192e/rtl_pm.h) | 4 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_ps.c (renamed from drivers/staging/rtl8192e/rtl_ps.c) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_ps.h (renamed from drivers/staging/rtl8192e/rtl_ps.h) | 2 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_wx.c (renamed from drivers/staging/rtl8192e/rtl_wx.c) | 3 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl8192e/rtl_wx.h (renamed from drivers/staging/rtl8192e/rtl_wx.h) | 0 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl819x_BAProc.c | 1 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl819x_HTProc.c | 5 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl819x_TSProc.c | 1 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtl_debug.h | 299 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib.h | 113 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_crypt.c | 80 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_crypt.h | 64 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_crypt_ccmp.c | 26 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 38 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_crypt_wep.c | 25 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_debug.h | 86 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_module.c | 38 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_rx.c | 21 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_softmac.c | 96 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_softmac_wx.c | 19 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_tx.c | 19 | ||||
-rw-r--r-- | drivers/staging/rtl8192e/rtllib_wx.c | 109 |
58 files changed, 465 insertions, 922 deletions
diff --git a/drivers/staging/rtl8192e/Kconfig b/drivers/staging/rtl8192e/Kconfig index 750c347..f87e211 100644 --- a/drivers/staging/rtl8192e/Kconfig +++ b/drivers/staging/rtl8192e/Kconfig @@ -1,9 +1,43 @@ -config RTL8192E - tristate "RealTek RTL8192E Wireless LAN NIC driver" - depends on PCI && WLAN - depends on m - select WIRELESS_EXT - select WEXT_PRIV - select CRYPTO - default N +config RTLLIB + tristate "Support for rtllib wireless devices" + depends on WLAN && m + default n + select LIB80211 ---help--- + If you have a wireless card that uses rtllib, say + Y. Currently the only card is the rtl8192e. + + If unsure, say N. + +if RTLLIB + +config RTLLIB_CRYPTO_CCMP + tristate "Support for rtllib CCMP crypto" + depends on RTLLIB + default y + ---help--- + CCMP crypto driver for rtllib. + + If you enabled RTLLIB, you want this. + +config RTLLIB_CRYPTO_TKIP + tristate "Support for rtllib TKIP crypto" + depends on RTLLIB + default y + ---help--- + TKIP crypto driver for rtllib. + + If you enabled RTLLIB, you want this. + +config RTLLIB_CRYPTO_WEP + tristate "Support for rtllib WEP crypto" + depends on RTLLIB + default y + ---help--- + TKIP crypto driver for rtllib. + + If you enabled RTLLIB, you want this. + +source "drivers/staging/rtl8192e/rtl8192e/Kconfig" + +endif diff --git a/drivers/staging/rtl8192e/Makefile b/drivers/staging/rtl8192e/Makefile index a66a9ad..cb18db7 100644 --- a/drivers/staging/rtl8192e/Makefile +++ b/drivers/staging/rtl8192e/Makefile @@ -1,41 +1,21 @@ -ccflags-y += -DUSE_FW_SOURCE_IMG_FILE -ccflags-y += -DCONFIG_PM_RTL -ccflags-y += -DCONFIG_PM -ccflags-y += -DHAVE_NET_DEVICE_OPS -ccflags-y += -DENABLE_DOT11D - -r8192e_pci-objs := \ - rtl_core.o \ - rtl_eeprom.o \ - rtl_ps.o \ - rtl_wx.o \ - rtl_cam.o \ - rtl_dm.o \ - rtl_pm.o \ - rtl_pci.o \ - rtl_debug.o \ - rtl_ethtool.o \ - r8192E_dev.o \ - r8192E_phy.o \ - r8192E_firmware.o \ - r8192E_cmdpkt.o \ - r8192E_hwimg.o \ - r8190P_rtl8256.o \ +rtllib-objs := \ + dot11d.o \ + rtllib_module.o \ rtllib_rx.o \ - rtllib_softmac.o \ rtllib_tx.o \ rtllib_wx.o \ - rtllib_module.o \ + rtllib_softmac.o \ rtllib_softmac_wx.o \ - rtl819x_HTProc.o \ - rtl819x_TSProc.o \ rtl819x_BAProc.o \ - dot11d.o \ - rtllib_crypt.o \ - rtllib_crypt_tkip.o \ - rtllib_crypt_ccmp.o \ - rtllib_crypt_wep.o + rtl819x_HTProc.o \ + rtl819x_TSProc.o + +obj-$(CONFIG_RTLLIB) += rtllib.o + +obj-$(CONFIG_RTLLIB_CRYPTO_CCMP) += rtllib_crypt_ccmp.o +obj-$(CONFIG_RTLLIB_CRYPTO_TKIP) += rtllib_crypt_tkip.o +obj-$(CONFIG_RTLLIB_CRYPTO_WEP) += rtllib_crypt_wep.o -obj-$(CONFIG_RTL8192E) += r8192e_pci.o +obj-$(CONFIG_RTL8192E) += rtl8192e/ ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/staging/rtl8192e/dot11d.c b/drivers/staging/rtl8192e/dot11d.c index ee0381e..f7b14f8 100644 --- a/drivers/staging/rtl8192e/dot11d.c +++ b/drivers/staging/rtl8192e/dot11d.c @@ -46,7 +46,7 @@ static struct channel_list ChannelPlan[] = { 56, 60, 64}, 21} }; -void Dot11d_Init(struct rtllib_device *ieee) +void dot11d_init(struct rtllib_device *ieee) { struct rt_dot11d_info *pDot11dInfo = GET_DOT11D_INFO(ieee); pDot11dInfo->bEnabled = false; @@ -58,6 +58,7 @@ void Dot11d_Init(struct rtllib_device *ieee) RESET_CIE_WATCHDOG(ieee); } +EXPORT_SYMBOL(dot11d_init); void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee) { @@ -99,6 +100,7 @@ void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee) break; } } +EXPORT_SYMBOL(Dot11d_Channelmap); void Dot11d_Reset(struct rtllib_device *ieee) diff --git a/drivers/staging/rtl8192e/dot11d.h b/drivers/staging/rtl8192e/dot11d.h index 032f700..71f4549 100644 --- a/drivers/staging/rtl8192e/dot11d.h +++ b/drivers/staging/rtl8192e/dot11d.h @@ -93,7 +93,7 @@ static inline void cpMacAddr(unsigned char *des, unsigned char *src) #define IS_DOT11D_STATE_DONE(__pIeeeDev) \ (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE) -void Dot11d_Init(struct rtllib_device *dev); +void dot11d_init(struct rtllib_device *dev); void Dot11d_Channelmap(u8 channel_plan, struct rtllib_device *ieee); void Dot11d_Reset(struct rtllib_device *dev); void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, diff --git a/drivers/staging/rtl8192e/rtl8192e/Kconfig b/drivers/staging/rtl8192e/rtl8192e/Kconfig new file mode 100644 index 0000000..50e0d91 --- /dev/null +++ b/drivers/staging/rtl8192e/rtl8192e/Kconfig @@ -0,0 +1,9 @@ +config RTL8192E + tristate "RealTek RTL8192E Wireless LAN NIC driver" + depends on PCI && WLAN && RTLLIB + depends on m + select WIRELESS_EXT + select WEXT_PRIV + select CRYPTO + default N + ---help--- diff --git a/drivers/staging/rtl8192e/rtl8192e/Makefile b/drivers/staging/rtl8192e/rtl8192e/Makefile new file mode 100644 index 0000000..313a92e --- /dev/null +++ b/drivers/staging/rtl8192e/rtl8192e/Makefile @@ -0,0 +1,21 @@ +r8192e_pci-objs := \ + r8192E_dev.o \ + r8192E_phy.o \ + r8192E_firmware.o \ + r8192E_cmdpkt.o \ + r8192E_hwimg.o \ + r8190P_rtl8256.o \ + rtl_cam.o \ + rtl_core.o \ + rtl_debug.o \ + rtl_dm.o \ + rtl_eeprom.o \ + rtl_ethtool.o \ + rtl_pci.o \ + rtl_pm.o \ + rtl_ps.o \ + rtl_wx.o \ + +obj-$(CONFIG_RTL8192E) += r8192e_pci.o + +ccflags-y += -D__CHECK_ENDIAN__ diff --git a/drivers/staging/rtl8192e/r8190P_def.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h index b7bb71f..b7bb71f 100644 --- a/drivers/staging/rtl8192e/r8190P_def.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_def.h diff --git a/drivers/staging/rtl8192e/r8190P_rtl8256.c b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c index 0da56c8..0da56c8 100644 --- a/drivers/staging/rtl8192e/r8190P_rtl8256.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.c diff --git a/drivers/staging/rtl8192e/r8190P_rtl8256.h b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h index 64e831d..64e831d 100644 --- a/drivers/staging/rtl8192e/r8190P_rtl8256.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8190P_rtl8256.h diff --git a/drivers/staging/rtl8192e/r8192E_cmdpkt.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c index 58d044e..58d044e 100644 --- a/drivers/staging/rtl8192e/r8192E_cmdpkt.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.c diff --git a/drivers/staging/rtl8192e/r8192E_cmdpkt.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h index 23219e1..23219e1 100644 --- a/drivers/staging/rtl8192e/r8192E_cmdpkt.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_cmdpkt.h diff --git a/drivers/staging/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 808aab6..808aab6 100644 --- a/drivers/staging/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c diff --git a/drivers/staging/rtl8192e/r8192E_dev.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h index b9b3b52..b9b3b52 100644 --- a/drivers/staging/rtl8192e/r8192E_dev.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.h diff --git a/drivers/staging/rtl8192e/r8192E_firmware.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c index 3771985..3771985 100644 --- a/drivers/staging/rtl8192e/r8192E_firmware.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.c diff --git a/drivers/staging/rtl8192e/r8192E_firmware.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h index caa8788..caa8788 100644 --- a/drivers/staging/rtl8192e/r8192E_firmware.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_firmware.h diff --git a/drivers/staging/rtl8192e/r8192E_hw.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h index 43c3fb8..43c3fb8 100644 --- a/drivers/staging/rtl8192e/r8192E_hw.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hw.h diff --git a/drivers/staging/rtl8192e/r8192E_hwimg.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c index 08e7dbb..08e7dbb 100644 --- a/drivers/staging/rtl8192e/r8192E_hwimg.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.c diff --git a/drivers/staging/rtl8192e/r8192E_hwimg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h index 019836b..019836b 100644 --- a/drivers/staging/rtl8192e/r8192E_hwimg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_hwimg.h diff --git a/drivers/staging/rtl8192e/r8192E_phy.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c index 7fe69a3..3e705ef 100644 --- a/drivers/staging/rtl8192e/r8192E_phy.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c @@ -23,7 +23,6 @@ #include "r8190P_rtl8256.h" #include "r8192E_phy.h" #include "rtl_dm.h" -#include "dot11d.h" #include "r8192E_hwimg.h" @@ -859,7 +858,7 @@ static u8 rtl8192_phy_SwChnlStepByStep(struct net_device *dev, u8 channel, RT_TRACE(COMP_TRACE, "====>%s()====stage:%d, step:%d, channel:%d\n", __func__, *stage, *step, channel); - if (!IsLegalChannel(priv->rtllib, channel)) { + if (!rtllib_legal_channel(priv->rtllib, channel)) { RT_TRACE(COMP_ERR, "=============>set to illegal channel:%d\n", channel); return true; diff --git a/drivers/staging/rtl8192e/r8192E_phy.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h index 7318f88..7318f88 100644 --- a/drivers/staging/rtl8192e/r8192E_phy.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phy.h diff --git a/drivers/staging/rtl8192e/r8192E_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h index 7899dd5..7899dd5 100644 --- a/drivers/staging/rtl8192e/r8192E_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_phyreg.h diff --git a/drivers/staging/rtl8192e/r819xE_phyreg.h b/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h index d5de279..d5de279 100644 --- a/drivers/staging/rtl8192e/r819xE_phyreg.h +++ b/drivers/staging/rtl8192e/rtl8192e/r819xE_phyreg.h diff --git a/drivers/staging/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c index baf3b63..baf3b63 100644 --- a/drivers/staging/rtl8192e/rtl_cam.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c diff --git a/drivers/staging/rtl8192e/rtl_cam.h b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h index fa607f9..fa607f9 100644 --- a/drivers/staging/rtl8192e/rtl_cam.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.h diff --git a/drivers/staging/rtl8192e/rtl_core.c b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c index 5ad9664..71adb6b 100644 --- a/drivers/staging/rtl8192e/rtl_core.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.c @@ -53,9 +53,7 @@ #include "rtl_wx.h" #include "rtl_dm.h" -#ifdef CONFIG_PM_RTL #include "rtl_pm.h" -#endif int hwwep = 1; static int channels = 0x3fff; @@ -581,7 +579,7 @@ static void rtl8192_update_beacon(void *data) struct rtllib_network *net = &ieee->current_network; if (ieee->pHTInfo->bCurrentHTSupport) - HTUpdateSelfAndPeerSetting(ieee, net); + HT_update_self_and_peer_setting(ieee, net); ieee->pHTInfo->bCurrentRT2RTLongSlotTime = net->bssht.bdRT2RTLongSlotTime; ieee->pHTInfo->RT2RT_HT_Mode = net->bssht.RT2RT_HT_Mode; @@ -1289,7 +1287,7 @@ static short rtl8192_get_channel_map(struct net_device *dev) priv->ChannelPlan = COUNTRY_CODE_FCC; } RT_TRACE(COMP_INIT, "Channel plan is %d\n", priv->ChannelPlan); - Dot11d_Init(priv->rtllib); + dot11d_init(priv->rtllib); Dot11d_Channelmap(priv->ChannelPlan, priv->rtllib); for (i = 1; i <= 11; i++) (priv->rtllib->active_channel_map)[i] = 1; @@ -1305,7 +1303,6 @@ static short rtl8192_init(struct net_device *dev) memset(&(priv->stats), 0, sizeof(struct rt_stats)); - rtl8192_dbgp_flag_init(dev); rtl8192_init_priv_handler(dev); rtl8192_init_priv_constant(dev); rtl8192_init_priv_variable(dev); @@ -2839,7 +2836,6 @@ done: /**************************************************************************** ---------------------------- PCI_STUFF--------------------------- *****************************************************************************/ -#ifdef HAVE_NET_DEVICE_OPS static const struct net_device_ops rtl8192_netdev_ops = { .ndo_open = rtl8192_open, .ndo_stop = rtl8192_close, @@ -2851,7 +2847,6 @@ static const struct net_device_ops rtl8192_netdev_ops = { .ndo_change_mtu = eth_change_mtu, .ndo_start_xmit = rtllib_xmit, }; -#endif static int __devinit rtl8192_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) @@ -2938,17 +2933,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev, dev->irq = pdev->irq; priv->irq = 0; -#ifdef HAVE_NET_DEVICE_OPS dev->netdev_ops = &rtl8192_netdev_ops; -#else - dev->open = rtl8192_open; - dev->stop = rtl8192_close; - dev->tx_timeout = rtl8192_tx_timeout; - dev->do_ioctl = rtl8192_ioctl; - dev->set_multicast_list = r8192_set_multicast; - dev->set_mac_address = r8192_set_mac_adr; - dev->hard_start_xmit = rtllib_xmit; -#endif dev->wireless_handlers = (struct iw_handler_def *) &r8192_wx_handlers_def; @@ -2974,10 +2959,7 @@ static int __devinit rtl8192_pci_probe(struct pci_dev *pdev, register_netdev(dev); RT_TRACE(COMP_INIT, "dev name: %s\n", dev->name); - err = rtl_debug_module_init(priv, dev->name); - if (err) - RT_TRACE(COMP_DBG, "failed to create debugfs files. Ignoring " - "error: %d\n", err); + rtl8192_proc_init_one(dev); if (priv->polling_timer_on == 0) @@ -3015,7 +2997,6 @@ static void __devexit rtl8192_pci_disconnect(struct pci_dev *pdev) del_timer_sync(&priv->gpio_polling_timer); cancel_delayed_work(&priv->gpio_change_rf_wq); priv->polling_timer_on = 0; - rtl_debug_module_remove(priv); rtl8192_proc_remove_one(dev); rtl8192_down(dev, true); deinit_hal_dm(dev); @@ -3103,43 +3084,9 @@ bool NicIFDisableNIC(struct net_device *dev) static int __init rtl8192_pci_module_init(void) { - int ret; - int error; - - ret = rtllib_init(); - if (ret) { - printk(KERN_ERR "rtllib_init() failed %d\n", ret); - return ret; - } - ret = rtllib_crypto_init(); - if (ret) { - printk(KERN_ERR "rtllib_crypto_init() failed %d\n", ret); - return ret; - } - ret = rtllib_crypto_tkip_init(); - if (ret) { - printk(KERN_ERR "rtllib_crypto_tkip_init() failed %d\n", ret); - return ret; - } - ret = rtllib_crypto_ccmp_init(); - if (ret) { - printk(KERN_ERR "rtllib_crypto_ccmp_init() failed %d\n", ret); - return ret; - } - ret = rtllib_crypto_wep_init(); - if (ret) { - printk(KERN_ERR "rtllib_crypto_wep_init() failed %d\n", ret); - return ret; - } printk(KERN_INFO "\nLinux kernel driver for RTL8192E WLAN cards\n"); printk(KERN_INFO "Copyright (c) 2007-2008, Realsil Wlan Driver\n"); - error = rtl_create_debugfs_root(); - if (error) { - RT_TRACE(COMP_DBG, "Create debugfs root fail: %d\n", error); - goto err_out; - } - rtl8192_proc_module_init(); if (0 != pci_register_driver(&rtl8192_pci_driver)) { DMESG("No device found"); @@ -3147,9 +3094,6 @@ static int __init rtl8192_pci_module_init(void) return -ENODEV; } return 0; -err_out: - return error; - } static void __exit rtl8192_pci_module_exit(void) @@ -3158,12 +3102,6 @@ static void __exit rtl8192_pci_module_exit(void) RT_TRACE(COMP_DOWN, "Exiting"); rtl8192_proc_module_remove(); - rtl_remove_debugfs_root(); - rtllib_crypto_tkip_exit(); - rtllib_crypto_ccmp_exit(); - rtllib_crypto_wep_exit(); - rtllib_crypto_deinit(); - rtllib_exit(); } void check_rfctrl_gpio_timer(unsigned long data) diff --git a/drivers/staging/rtl8192e/rtl_core.h b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h index f9af515..2a2519c 100644 --- a/drivers/staging/rtl8192e/rtl_core.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_core.h @@ -44,11 +44,14 @@ #include <linux/proc_fs.h> #include <linux/if_arp.h> #include <linux/random.h> -#include <linux/version.h> #include <linux/io.h> -#include "rtllib.h" -#include "dot11d.h" +/* Need this defined before including local include files */ +#define DRV_NAME "rtl819xE" + +#include "../rtllib.h" + +#include "../dot11d.h" #include "r8192E_firmware.h" #include "r8192E_hw.h" @@ -56,7 +59,6 @@ #include "r8190P_def.h" #include "r8192E_dev.h" -#include "rtl_debug.h" #include "rtl_eeprom.h" #include "rtl_ps.h" #include "rtl_pci.h" @@ -67,8 +69,6 @@ #define DRV_AUTHOR "<wlanfae@realtek.com>" #define DRV_VERSION "0014.0401.2010" -#define DRV_NAME "rtl819xE" - #define IS_HARDWARE_TYPE_819xP(_priv) \ ((((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8190P) || \ (((struct r8192_priv *)rtllib_priv(dev))->card_8192 == NIC_8192E)) @@ -215,41 +215,6 @@ enum RTL819x_PHY_PARAM { RTL819X_EFUSE_MAP = 19, }; -enum RTL_DEBUG { - COMP_TRACE = BIT0, - COMP_DBG = BIT1, - COMP_INIT = BIT2, - COMP_RECV = BIT3, - COMP_SEND = BIT4, - COMP_CMD = BIT5, - COMP_POWER = BIT6, - COMP_EPROM = BIT7, - COMP_SWBW = BIT8, - COMP_SEC = BIT9, - COMP_LPS = BIT10, - COMP_QOS = BIT11, - COMP_RATE = BIT12, - COMP_RXDESC = BIT13, - COMP_PHY = BIT14, - COMP_DIG = BIT15, - COMP_TXAGC = BIT16, - COMP_HALDM = BIT17, - COMP_POWER_TRACKING = BIT18, - COMP_CH = BIT19, - COMP_RF = BIT20, - COMP_FIRMWARE = BIT21, - COMP_HT = BIT22, - COMP_RESET = BIT23, - COMP_CMDPKT = BIT24, - COMP_SCAN = BIT25, - COMP_PS = BIT26, - COMP_DOWN = BIT27, - COMP_INTR = BIT28, - COMP_LED = BIT29, - COMP_MLME = BIT30, - COMP_ERR = BIT31 -}; - enum nic_t { NIC_UNKNOWN = 0, NIC_8192E = 1, @@ -1121,4 +1086,10 @@ void ActUpdateChannelAccessSetting(struct net_device *dev, enum wireless_mode WirelessMode, struct channel_access_setting *ChnlAccessSetting); +/* proc stuff from rtl_debug.c */ +void rtl8192_proc_init_one(struct net_device *dev); +void rtl8192_proc_remove_one(struct net_device *dev); +void rtl8192_proc_module_init(void); +void rtl8192_proc_module_remove(void); + #endif diff --git a/drivers/staging/rtl8192e/rtl_crypto.h b/drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h index ee57c0f..ee57c0f 100644 --- a/drivers/staging/rtl8192e/rtl_crypto.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_crypto.h diff --git a/drivers/staging/rtl8192e/rtl_debug.c b/drivers/staging/rtl8192e/rtl8192e/rtl_debug.c index 22bc2dd..c19b14c 100644 --- a/drivers/staging/rtl8192e/rtl_debug.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_debug.c @@ -22,91 +22,12 @@ * Contact Information: * wlanfae <wlanfae@realtek.com> ******************************************************************************/ -#include "rtl_debug.h" #include "rtl_core.h" #include "r8192E_phy.h" #include "r8192E_phyreg.h" #include "r8190P_rtl8256.h" /* RTL8225 Radio frontend */ #include "r8192E_cmdpkt.h" -u32 rt_global_debug_component = \ - COMP_ERR ; - -/*------------------Declare variable-----------------------*/ -u32 DBGP_Type[DBGP_TYPE_MAX]; - -/*----------------------------------------------------------------------------- - * Function: DBGP_Flag_Init - * - * Overview: Refresh all debug print control flag content to zero. - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * When Who Remark - * 10/20/2006 MHC Create Version 0. - * - *---------------------------------------------------------------------------*/ -void rtl8192_dbgp_flag_init(struct net_device *dev) -{ - u8 i; - - for (i = 0; i < DBGP_TYPE_MAX; i++) - DBGP_Type[i] = 0; - - -} /* DBGP_Flag_Init */ - -/* this is only for debugging */ -void print_buffer(u32 *buffer, int len) -{ - int i; - u8 *buf = (u8 *)buffer; - - printk(KERN_INFO "ASCII BUFFER DUMP (len: %x):\n", len); - - for (i = 0; i < len; i++) - printk(KERN_INFO "%c", buf[i]); - - printk(KERN_INFO "\nBINARY BUFFER DUMP (len: %x):\n", len); - - for (i = 0; i < len; i++) - printk(KERN_INFO "%x", buf[i]); - - printk(KERN_INFO "\n"); -} - -/* this is only for debug */ -void dump_eprom(struct net_device *dev) -{ - int i; - - for (i = 0; i < 0xff; i++) - RT_TRACE(COMP_INIT, "EEPROM addr %x : %x", i, - eprom_read(dev, i)); -} - -/* this is only for debug */ -void rtl8192_dump_reg(struct net_device *dev) -{ - int i; - int n; - int max = 0x5ff; - - RT_TRACE(COMP_INIT, "Dumping NIC register map"); - - for (n = 0; n <= max; ) { - printk(KERN_INFO "\nD: %2x> ", n); - for (i = 0; i < 16 && n <= max; i++, n++) - printk(KERN_INFO "%2x ", read_nic_byte(dev, n)); - } - printk(KERN_INFO "\n"); -} - /**************************************************************************** -----------------------------PROCFS STUFF------------------------- *****************************************************************************/ diff --git a/drivers/staging/rtl8192e/rtl_dm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c index a7fa9aa..a7fa9aa 100644 --- a/drivers/staging/rtl8192e/rtl_dm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.c diff --git a/drivers/staging/rtl8192e/rtl_dm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h index ab44a9a..ab44a9a 100644 --- a/drivers/staging/rtl8192e/rtl_dm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_dm.h diff --git a/drivers/staging/rtl8192e/rtl_eeprom.c b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c index c1ccff4..c1ccff4 100644 --- a/drivers/staging/rtl8192e/rtl_eeprom.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.c diff --git a/drivers/staging/rtl8192e/rtl_eeprom.h b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h index 9452e16..9452e16 100644 --- a/drivers/staging/rtl8192e/rtl_eeprom.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_eeprom.h diff --git a/drivers/staging/rtl8192e/rtl_ethtool.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c index 36452fb..36452fb 100644 --- a/drivers/staging/rtl8192e/rtl_ethtool.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ethtool.c diff --git a/drivers/staging/rtl8192e/rtl_pci.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c index ddadcc3..ddadcc3 100644 --- a/drivers/staging/rtl8192e/rtl_pci.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.c diff --git a/drivers/staging/rtl8192e/rtl_pci.h b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h index 7ea5a47..28c7da6 100644 --- a/drivers/staging/rtl8192e/rtl_pci.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pci.h @@ -27,7 +27,6 @@ #include <linux/types.h> #include <linux/pci.h> -#include "rtllib.h" static inline void NdisRawWritePortUlong(u32 port, u32 val) { diff --git a/drivers/staging/rtl8192e/rtl_pm.c b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c index 92e2fde..8e1a5d5 100644 --- a/drivers/staging/rtl8192e/rtl_pm.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.c @@ -17,7 +17,6 @@ * wlanfae <wlanfae@realtek.com> ******************************************************************************/ -#ifdef CONFIG_PM_RTL #include "rtl_core.h" #include "r8192E_hw.h" #include "r8190P_rtl8256.h" @@ -133,4 +132,3 @@ int rtl8192E_enable_wake(struct pci_dev *dev, pm_message_t state, int enable) return -EAGAIN; } -#endif diff --git a/drivers/staging/rtl8192e/rtl_pm.h b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h index 4d7f406..e5299fc 100644 --- a/drivers/staging/rtl8192e/rtl_pm.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_pm.h @@ -17,8 +17,6 @@ * wlanfae <wlanfae@realtek.com> ******************************************************************************/ -#ifdef CONFIG_PM_RTL - #ifndef R8192E_PM_H #define R8192E_PM_H @@ -31,5 +29,3 @@ int rtl8192E_resume(struct pci_dev *dev); int rtl8192E_enable_wake(struct pci_dev *dev, pm_message_t state, int enable); #endif - -#endif diff --git a/drivers/staging/rtl8192e/rtl_ps.c b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c index c9a7c56..c9a7c56 100644 --- a/drivers/staging/rtl8192e/rtl_ps.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.c diff --git a/drivers/staging/rtl8192e/rtl_ps.h b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h index a9c2d79..df79d6c 100644 --- a/drivers/staging/rtl8192e/rtl_ps.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_ps.h @@ -26,7 +26,7 @@ #define _RTL_PS_H #include <linux/types.h> -#include "rtllib.h" + struct net_device; #define RT_CHECK_FOR_HANG_PERIOD 2 diff --git a/drivers/staging/rtl8192e/rtl_wx.c b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c index 93b1edb..4e93669 100644 --- a/drivers/staging/rtl8192e/rtl_wx.c +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.c @@ -19,7 +19,6 @@ #include <linux/string.h> #include "rtl_core.h" -#include "dot11d.h" #define RATE_COUNT 12 static u32 rtl8192_rates[] = { @@ -803,7 +802,7 @@ static int r8192_wx_set_enc(struct net_device *dev, switch (wrqu->encoding.flags & IW_ENCODE_INDEX) { case 0: - key_idx = ieee->tx_keyidx; + key_idx = ieee->crypt_info.tx_keyidx; break; case 1: key_idx = 0; diff --git a/drivers/staging/rtl8192e/rtl_wx.h b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.h index 6a51a25..6a51a25 100644 --- a/drivers/staging/rtl8192e/rtl_wx.h +++ b/drivers/staging/rtl8192e/rtl8192e/rtl_wx.h diff --git a/drivers/staging/rtl8192e/rtl819x_BAProc.c b/drivers/staging/rtl8192e/rtl819x_BAProc.c index 8b9d85c..32fbbc9 100644 --- a/drivers/staging/rtl8192e/rtl819x_BAProc.c +++ b/drivers/staging/rtl8192e/rtl819x_BAProc.c @@ -18,7 +18,6 @@ ******************************************************************************/ #include "rtllib.h" #include "rtl819x_BA.h" -#include "rtl_core.h" static void ActivateBAEntry(struct rtllib_device *ieee, struct ba_record *pBA, u16 Time) diff --git a/drivers/staging/rtl8192e/rtl819x_HTProc.c b/drivers/staging/rtl8192e/rtl819x_HTProc.c index b1c0c56..8b74129 100644 --- a/drivers/staging/rtl8192e/rtl819x_HTProc.c +++ b/drivers/staging/rtl8192e/rtl819x_HTProc.c @@ -943,8 +943,8 @@ void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee, } } -void HTUpdateSelfAndPeerSetting(struct rtllib_device *ieee, - struct rtllib_network *pNetwork) +void HT_update_self_and_peer_setting(struct rtllib_device *ieee, + struct rtllib_network *pNetwork) { struct rt_hi_throughput *pHTInfo = ieee->pHTInfo; struct ht_info_ele *pPeerHTInfo = @@ -955,6 +955,7 @@ void HTUpdateSelfAndPeerSetting(struct rtllib_device *ieee, pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode; } } +EXPORT_SYMBOL(HT_update_self_and_peer_setting); void HTUseDefaultSetting(struct rtllib_device *ieee) { diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 09a602f..711a096 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -497,6 +497,7 @@ void RemovePeerTS(struct rtllib_device *ieee, u8 *Addr) } } } +EXPORT_SYMBOL(RemovePeerTS); void RemoveAllTS(struct rtllib_device *ieee) { diff --git a/drivers/staging/rtl8192e/rtl_debug.h b/drivers/staging/rtl8192e/rtl_debug.h deleted file mode 100644 index 50fb9a9..0000000 --- a/drivers/staging/rtl8192e/rtl_debug.h +++ /dev/null @@ -1,299 +0,0 @@ -/****************************************************************************** - * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. - * - * Based on the r8180 driver, which is: - * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * wlanfae <wlanfae@realtek.com> -******************************************************************************/ -#ifndef _RTL_DEBUG_H -#define _RTL_DEBUG_H -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/version.h> -#include <linux/debugfs.h> - -struct r8192_priv; -struct _tx_desc_8192se; -struct _TX_DESC_8192CE; -struct net_device; - -#define DBG_LOUD 4 - -#define RT_ASSERT(_Exp, Fmt) \ - if (!(_Exp)) { \ - printk("Rtl819x: "); \ - printk Fmt; \ - } - -enum dbgp_flag { - FQoS = 0, - FTX = 1, - FRX = 2, - FSEC = 3, - FMGNT = 4, - FMLME = 5, - FRESOURCE = 6, - FBEACON = 7, - FISR = 8, - FPHY = 9, - FMP = 10, - FEEPROM = 11, - FPWR = 12, - FDM = 13, - FDBGCtrl = 14, - FC2H = 15, - FBT = 16, - FINIT = 17, - FIOCTL = 18, - DBGP_TYPE_MAX -}; - -#define QoS_INIT BIT0 -#define QoS_VISTA BIT1 - -#define TX_DESC BIT0 -#define TX_DESC_TID BIT1 - -#define RX_DATA BIT0 -#define RX_PHY_STS BIT1 -#define RX_PHY_SS BIT2 -#define RX_PHY_SQ BIT3 -#define RX_PHY_ASTS BIT4 -#define RX_ERR_LEN BIT5 -#define RX_DEFRAG BIT6 -#define RX_ERR_RATE BIT7 - - - -#define MEDIA_STS BIT0 -#define LINK_STS BIT1 - -#define OS_CHK BIT0 - -#define BCN_SHOW BIT0 -#define BCN_PEER BIT1 - -#define ISR_CHK BIT0 - -#define PHY_BBR BIT0 -#define PHY_BBW BIT1 -#define PHY_RFR BIT2 -#define PHY_RFW BIT3 -#define PHY_MACR BIT4 -#define PHY_MACW BIT5 -#define PHY_ALLR BIT6 -#define PHY_ALLW BIT7 -#define PHY_TXPWR BIT8 -#define PHY_PWRDIFF BIT9 - -#define MP_RX BIT0 -#define MP_SWICH_CH BIT1 - -#define EEPROM_W BIT0 -#define EFUSE_PG BIT1 -#define EFUSE_READ_ALL BIT2 - -#define LPS BIT0 -#define IPS BIT1 -#define PWRSW BIT2 -#define PWRHW BIT3 -#define PWRHAL BIT4 - -#define WA_IOT BIT0 -#define DM_PWDB BIT1 -#define DM_Monitor BIT2 -#define DM_DIG BIT3 -#define DM_EDCA_Turbo BIT4 - -#define DbgCtrl_Trace BIT0 -#define DbgCtrl_InbandNoise BIT1 - -#define BT_TRACE BIT0 -#define BT_RFPoll BIT1 - -#define C2H_Summary BIT0 -#define C2H_PacketData BIT1 -#define C2H_ContentData BIT2 -#define BT_TRACE BIT0 -#define BT_RFPoll BIT1 - -#define INIT_EEPROM BIT0 -#define INIT_TxPower BIT1 -#define INIT_IQK BIT2 -#define INIT_RF BIT3 - -#define IOCTL_TRACE BIT0 -#define IOCTL_BT_EVENT BIT1 -#define IOCTL_BT_EVENT_DETAIL BIT2 -#define IOCTL_BT_TX_ACLDATA BIT3 -#define IOCTL_BT_TX_ACLDATA_DETAIL BIT4 -#define IOCTL_BT_RX_ACLDATA BIT5 -#define IOCTL_BT_RX_ACLDATA_DETAIL BIT6 -#define IOCTL_BT_HCICMD BIT7 -#define IOCTL_BT_HCICMD_DETAIL BIT8 -#define IOCTL_IRP BIT9 -#define IOCTL_IRP_DETAIL BIT10 -#define IOCTL_CALLBACK_FUN BIT11 -#define IOCTL_STATE BIT12 -#define IOCTL_BT_TP BIT13 -#define IOCTL_BT_LOGO BIT14 - -/* 2007/07/13 MH ------For DeBuG Print modeue------*/ -/*------------------------------Define structure----------------------------*/ - - -/*------------------------Export Marco Definition---------------------------*/ -#define DEBUG_PRINT 1 - -#if (DEBUG_PRINT == 1) -#define RTPRINT(dbgtype, dbgflag, printstr) \ -{ \ - if (DBGP_Type[dbgtype] & dbgflag) { \ - printk printstr; \ - } \ -} - -#define RTPRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) \ -{ \ - if (DBGP_Type[dbgtype] & dbgflag) { \ - int __i; \ - u8 *ptr = (u8 *)_Ptr; \ - printk printstr; \ - printk(" "); \ - for (__i = 0; __i < 6; __i++) \ - printk("%02X%s", ptr[__i], \ - (__i == 5) ? "" : "-"); \ - printk("\n"); \ - } \ -} - -#define RTPRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)\ -{ \ - if (DBGP_Type[dbgtype] & dbgflag) { \ - int __i; \ - u8 *ptr = (u8 *)_HexData; \ - printk(_TitleString); \ - for (__i = 0; __i < (int)_HexDataLen; __i++) { \ - printk("%02X%s", ptr[__i], (((__i + 1) \ - % 4) == 0) ? " " : " "); \ - if (((__i + 1) % 16) == 0) \ - printk("\n"); \ - } \ - printk("\n"); \ - } \ -} -#else -#define RTPRINT(dbgtype, dbgflag, printstr) -#define RTPRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) -#define RTPRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen) -#endif - -extern u32 DBGP_Type[DBGP_TYPE_MAX]; - -#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \ -do {\ - if (((_Comp) & rt_global_debug_component) && \ - (_Level <= rt_global_debug_component)) { \ - int __i; \ - u8* ptr = (u8 *)_HexData; \ - printk(KERN_INFO "Rtl819x: "); \ - printk(_TitleString); \ - for (__i = 0; __i < (int)_HexDataLen; __i++) { \ - printk("%02X%s", ptr[__i], (((__i + 1) % \ - 4) == 0) ? " " : " "); \ - if (((__i + 1) % 16) == 0) \ - printk("\n"); \ - } \ - printk("\n"); \ - } \ -} while (0); - -#define DMESG(x, a...) -#define DMESGW(x, a...) -#define DMESGE(x, a...) -extern u32 rt_global_debug_component; -#define RT_TRACE(component, x, args...) \ -do { \ - if (rt_global_debug_component & component) \ - printk(KERN_DEBUG DRV_NAME ":" x "\n" , \ - ##args);\ -} while (0); - -#define assert(expr) \ - if (!(expr)) { \ - printk(KERN_INFO "Assertion failed! %s,%s,%s,line=%d\n", \ - #expr, __FILE__, __func__, __LINE__); \ - } -#define RT_DEBUG_DATA(level, data, datalen) \ - do { \ - if ((rt_global_debug_component & (level)) == (level)) {\ - int _i; \ - u8 *_pdata = (u8 *)data; \ - printk(KERN_DEBUG DRV_NAME ": %s()\n", __func__); \ - for (_i = 0; _i < (int)(datalen); _i++) { \ - printk(KERN_INFO "%2x ", _pdata[_i]); \ - if ((_i+1) % 16 == 0) \ - printk("\n"); \ - } \ - printk(KERN_INFO "\n"); \ - } \ - } while (0) - -struct rtl_fs_debug { - const char *name; - struct dentry *dir_drv; - struct dentry *debug_register; - u32 hw_type; - u32 hw_offset; - bool hw_holding; -}; - -void print_buffer(u32 *buffer, int len); -void dump_eprom(struct net_device *dev); -void rtl8192_dump_reg(struct net_device *dev); - -/* debugfs stuff */ -static inline int rtl_debug_module_init(struct r8192_priv *priv, - const char *name) -{ - return 0; -} - -static inline void rtl_debug_module_remove(struct r8192_priv *priv) -{ -} - -static inline int rtl_create_debugfs_root(void) -{ - return 0; -} - -static inline void rtl_remove_debugfs_root(void) -{ -} - -/* proc stuff */ -void rtl8192_proc_init_one(struct net_device *dev); -void rtl8192_proc_remove_one(struct net_device *dev); -void rtl8192_proc_module_init(void); -void rtl8192_proc_module_remove(void); -void rtl8192_dbgp_flag_init(struct net_device *dev); - -#endif diff --git a/drivers/staging/rtl8192e/rtllib.h b/drivers/staging/rtl8192e/rtllib.h index de25975..e26aec8 100644 --- a/drivers/staging/rtl8192e/rtllib.h +++ b/drivers/staging/rtl8192e/rtllib.h @@ -25,7 +25,6 @@ #define RTLLIB_H #include <linux/if_ether.h> /* ETH_ALEN */ #include <linux/kernel.h> /* ARRAY_SIZE */ -#include <linux/version.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/jiffies.h> @@ -36,12 +35,14 @@ #include <linux/delay.h> #include <linux/wireless.h> +#include "rtllib_debug.h" #include "rtl819x_HT.h" #include "rtl819x_BA.h" #include "rtl819x_TS.h" #include <linux/netdevice.h> #include <linux/if_arp.h> /* ARPHRD_ETHER */ +#include <net/lib80211.h> #define MAX_PRECMD_CNT 16 #define MAX_RFDEPENDCMD_CNT 16 @@ -870,69 +871,6 @@ enum _REG_PREAMBLE_MODE { #define WLAN_ERP_USE_PROTECTION (1<<1) #define WLAN_ERP_BARKER_PREAMBLE (1<<2) -/* Status codes */ -enum rtllib_statuscode { - WLAN_STATUS_SUCCESS = 0, - WLAN_STATUS_UNSPECIFIED_FAILURE = 1, - WLAN_STATUS_CAPS_UNSUPPORTED = 10, - WLAN_STATUS_REASSOC_NO_ASSOC = 11, - WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12, - WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13, - WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14, - WLAN_STATUS_CHALLENGE_FAIL = 15, - WLAN_STATUS_AUTH_TIMEOUT = 16, - WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17, - WLAN_STATUS_ASSOC_DENIED_RATES = 18, - /* 802.11b */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19, - WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20, - WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21, - /* 802.11h */ - WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22, - WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23, - WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24, - /* 802.11g */ - WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25, - WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26, - /* 802.11i */ - WLAN_STATUS_INVALID_IE = 40, - WLAN_STATUS_INVALID_GROUP_CIPHER = 41, - WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42, - WLAN_STATUS_INVALID_AKMP = 43, - WLAN_STATUS_UNSUPP_RSN_VERSION = 44, - WLAN_STATUS_INVALID_RSN_IE_CAP = 45, - WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, -}; - -/* Reason codes */ -enum rtllib_reasoncode { - WLAN_REASON_UNSPECIFIED = 1, - WLAN_REASON_PREV_AUTH_NOT_VALID = 2, - WLAN_REASON_DEAUTH_LEAVING = 3, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, - WLAN_REASON_DISASSOC_AP_BUSY = 5, - WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, - WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, - WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, - WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, - /* 802.11h */ - WLAN_REASON_DISASSOC_BAD_POWER = 10, - WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, - /* 802.11i */ - WLAN_REASON_INVALID_IE = 13, - WLAN_REASON_MIC_FAILURE = 14, - WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, - WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, - WLAN_REASON_IE_DIFFERENT = 17, - WLAN_REASON_INVALID_GROUP_CIPHER = 18, - WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, - WLAN_REASON_INVALID_AKMP = 20, - WLAN_REASON_UNSUPP_RSN_VERSION = 21, - WLAN_REASON_INVALID_RSN_IE_CAP = 22, - WLAN_REASON_IEEE8021X_FAILED = 23, - WLAN_REASON_CIPHER_SUITE_REJECTED = 24, -}; - #define RTLLIB_STATMASK_SIGNAL (1<<0) #define RTLLIB_STATMASK_RSSI (1<<1) #define RTLLIB_STATMASK_NOISE (1<<2) @@ -1122,8 +1060,6 @@ struct rtllib_stats { struct rtllib_device; -#include "rtllib_crypt.h" - #define SEC_KEY_1 (1<<0) #define SEC_KEY_2 (1<<1) #define SEC_KEY_3 (1<<2) @@ -1146,7 +1082,6 @@ struct rtllib_device; #define SEC_ALG_TKIP 2 #define SEC_ALG_CCMP 4 -#define WEP_KEYS 4 #define WEP_KEY_LEN 13 #define SCM_KEY_LEN 32 #define SCM_TEMPORAL_KEY_LENGTH 16 @@ -1158,8 +1093,8 @@ struct rtllib_security { auth_algo:4, unicast_uses_group:1, encrypt:1; - u8 key_sizes[WEP_KEYS]; - u8 keys[WEP_KEYS][SCM_KEY_LEN]; + u8 key_sizes[NUM_WEP_KEYS]; + u8 keys[NUM_WEP_KEYS][SCM_KEY_LEN]; u8 level; u16 flags; } __packed; @@ -2251,14 +2186,10 @@ struct rtllib_device { u8 ap_mac_addr[6]; u16 pairwise_key_type; u16 group_key_type; - struct list_head crypt_deinit_list; - struct rtllib_crypt_data *crypt[WEP_KEYS]; - int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ - struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY]; - struct timer_list crypt_deinit_timer; - int crypt_quiesced; + struct lib80211_crypt_info crypt_info; + struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY]; int bcrx_sta_key; /* use individual keys to override default keys even * with RX of broad/multicast frames */ @@ -2774,7 +2705,7 @@ extern void rtllib_rx_mgt(struct rtllib_device *ieee, struct rtllib_rx_stats *stats); extern void rtllib_rx_probe_rq(struct rtllib_device *ieee, struct sk_buff *skb); -extern int IsLegalChannel(struct rtllib_device *rtllib, u8 channel); +extern int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel); /* rtllib_wx.c */ extern int rtllib_wx_get_scan(struct rtllib_device *ieee, @@ -2804,7 +2735,7 @@ extern int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len); /* rtllib_softmac.c */ extern short rtllib_is_54g(struct rtllib_network *net); -extern short rtllib_is_shortslot(struct rtllib_network net); +extern short rtllib_is_shortslot(const struct rtllib_network *net); extern int rtllib_rx_frame_softmac(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats, u16 type, @@ -2971,8 +2902,8 @@ extern void HTInitializeHTInfo(struct rtllib_device *ieee); extern void HTInitializeBssDesc(struct bss_ht *pBssHT); extern void HTResetSelfAndSavePeerSetting(struct rtllib_device *ieee, struct rtllib_network *pNetwork); -extern void HTUpdateSelfAndPeerSetting(struct rtllib_device *ieee, - struct rtllib_network *pNetwork); +extern void HT_update_self_and_peer_setting(struct rtllib_device *ieee, + struct rtllib_network *pNetwork); extern u8 HTGetHighestMCSRate(struct rtllib_device *ieee, u8 *pMCSRateSet, u8 *pMCSFilter); extern u8 MCS_FILTER_ALL[]; @@ -3052,21 +2983,6 @@ static inline const char *escape_essid(const char *essid, u8 essid_len) (HTMcsToDataRate(_ieee, (u8)_MGN_RATE))) /* fun with the built-in rtllib stack... */ -int rtllib_init(void); -void rtllib_exit(void); -int rtllib_crypto_init(void); -void rtllib_crypto_deinit(void); -int rtllib_crypto_tkip_init(void); -void rtllib_crypto_tkip_exit(void); -int rtllib_crypto_ccmp_init(void); -void rtllib_crypto_ccmp_exit(void); -int rtllib_crypto_wep_init(void); -void rtllib_crypto_wep_exit(void); - -void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib); -void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, u8 *asSta, - u8 asRsn); -void rtllib_MgntDisconnectAP(struct rtllib_device *rtllib, u8 asRsn); bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn); @@ -3133,12 +3049,5 @@ extern void rtllib_TURBO_Info(struct rtllib_device *ieee, u8 **tag_p); #define MUTEX_LOCK_PRIV(pmutex) mutex_lock(pmutex) #define MUTEX_UNLOCK_PRIV(pmutex) mutex_unlock(pmutex) #endif -static inline void dump_buf(u8 *buf, u32 len) -{ - u32 i; - printk(KERN_INFO "-----------------Len %d----------------\n", len); - for (i = 0; i < len; i++) - printk("%2.2x-", *(buf+i)); - printk("\n"); -} + #endif /* RTLLIB_H */ diff --git a/drivers/staging/rtl8192e/rtllib_crypt.c b/drivers/staging/rtl8192e/rtllib_crypt.c index acda37b..86152d0 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.c +++ b/drivers/staging/rtl8192e/rtllib_crypt.c @@ -11,7 +11,6 @@ * */ -#include <linux/version.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> @@ -22,7 +21,7 @@ struct rtllib_crypto_alg { struct list_head list; - struct rtllib_crypto_ops *ops; + struct lib80211_crypto_ops *ops; }; @@ -33,15 +32,15 @@ struct rtllib_crypto { static struct rtllib_crypto *hcrypt; -void rtllib_crypt_deinit_entries(struct rtllib_device *ieee, +void rtllib_crypt_deinit_entries(struct lib80211_crypt_info *info, int force) { struct list_head *ptr, *n; - struct rtllib_crypt_data *entry; + struct lib80211_crypt_data *entry; - for (ptr = ieee->crypt_deinit_list.next, n = ptr->next; - ptr != &ieee->crypt_deinit_list; ptr = n, n = ptr->next) { - entry = list_entry(ptr, struct rtllib_crypt_data, list); + for (ptr = info->crypt_deinit_list.next, n = ptr->next; + ptr != &info->crypt_deinit_list; ptr = n, n = ptr->next) { + entry = list_entry(ptr, struct lib80211_crypt_data, list); if (atomic_read(&entry->refcnt) != 0 && !force) continue; @@ -53,28 +52,30 @@ void rtllib_crypt_deinit_entries(struct rtllib_device *ieee, kfree(entry); } } +EXPORT_SYMBOL(rtllib_crypt_deinit_entries); void rtllib_crypt_deinit_handler(unsigned long data) { - struct rtllib_device *ieee = (struct rtllib_device *)data; + struct lib80211_crypt_info *info = (struct lib80211_crypt_info *)data; unsigned long flags; - spin_lock_irqsave(&ieee->lock, flags); - rtllib_crypt_deinit_entries(ieee, 0); - if (!list_empty(&ieee->crypt_deinit_list)) { + spin_lock_irqsave(info->lock, flags); + rtllib_crypt_deinit_entries(info, 0); + if (!list_empty(&info->crypt_deinit_list)) { printk(KERN_DEBUG "%s: entries remaining in delayed crypt " - "deletion list\n", ieee->dev->name); - ieee->crypt_deinit_timer.expires = jiffies + HZ; - add_timer(&ieee->crypt_deinit_timer); + "deletion list\n", info->name); + info->crypt_deinit_timer.expires = jiffies + HZ; + add_timer(&info->crypt_deinit_timer); } - spin_unlock_irqrestore(&ieee->lock, flags); + spin_unlock_irqrestore(info->lock, flags); } +EXPORT_SYMBOL(rtllib_crypt_deinit_handler); -void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, - struct rtllib_crypt_data **crypt) +void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info, + struct lib80211_crypt_data **crypt) { - struct rtllib_crypt_data *tmp; + struct lib80211_crypt_data *tmp; unsigned long flags; if (*crypt == NULL) @@ -87,16 +88,17 @@ void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, * decrypt operations. Use a list of delayed deinits to avoid needing * locking. */ - spin_lock_irqsave(&ieee->lock, flags); - list_add(&tmp->list, &ieee->crypt_deinit_list); - if (!timer_pending(&ieee->crypt_deinit_timer)) { - ieee->crypt_deinit_timer.expires = jiffies + HZ; - add_timer(&ieee->crypt_deinit_timer); + spin_lock_irqsave(info->lock, flags); + list_add(&tmp->list, &info->crypt_deinit_list); + if (!timer_pending(&info->crypt_deinit_timer)) { + info->crypt_deinit_timer.expires = jiffies + HZ; + add_timer(&info->crypt_deinit_timer); } - spin_unlock_irqrestore(&ieee->lock, flags); + spin_unlock_irqrestore(info->lock, flags); } +EXPORT_SYMBOL(rtllib_crypt_delayed_deinit); -int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops) +int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops) { unsigned long flags; struct rtllib_crypto_alg *alg; @@ -104,11 +106,10 @@ int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops) if (hcrypt == NULL) return -1; - alg = kmalloc(sizeof(*alg), GFP_KERNEL); + alg = kzalloc(sizeof(*alg), GFP_KERNEL); if (alg == NULL) return -ENOMEM; - memset(alg, 0, sizeof(*alg)); alg->ops = ops; spin_lock_irqsave(&hcrypt->lock, flags); @@ -120,8 +121,9 @@ int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops) return 0; } +EXPORT_SYMBOL(rtllib_register_crypto_ops); -int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops) +int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops) { unsigned long flags; struct list_head *ptr; @@ -150,9 +152,10 @@ int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops) return del_alg ? 0 : -1; } +EXPORT_SYMBOL(rtllib_unregister_crypto_ops); -struct rtllib_crypto_ops *rtllib_get_crypto_ops(const char *name) +struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name) { unsigned long flags; struct list_head *ptr; @@ -177,12 +180,13 @@ struct rtllib_crypto_ops *rtllib_get_crypto_ops(const char *name) else return NULL; } +EXPORT_SYMBOL(rtllib_get_crypto_ops); static void * rtllib_crypt_null_init(int keyidx) { return (void *) 1; } static void rtllib_crypt_null_deinit(void *priv) {} -static struct rtllib_crypto_ops rtllib_crypt_null = { +static struct lib80211_crypto_ops rtllib_crypt_null = { .name = "NULL", .init = rtllib_crypt_null_init, .deinit = rtllib_crypt_null_deinit, @@ -192,8 +196,10 @@ static struct rtllib_crypto_ops rtllib_crypt_null = { .decrypt_msdu = NULL, .set_key = NULL, .get_key = NULL, - .extra_prefix_len = 0, - .extra_postfix_len = 0, + .extra_mpdu_prefix_len = 0, + .extra_mpdu_postfix_len = 0, + .extra_msdu_prefix_len = 0, + .extra_msdu_postfix_len = 0, .owner = THIS_MODULE, }; @@ -202,15 +208,14 @@ int __init rtllib_crypto_init(void) { int ret = -ENOMEM; - hcrypt = kmalloc(sizeof(*hcrypt), GFP_KERNEL); + hcrypt = kzalloc(sizeof(*hcrypt), GFP_KERNEL); if (!hcrypt) goto out; - memset(hcrypt, 0, sizeof(*hcrypt)); INIT_LIST_HEAD(&hcrypt->algs); spin_lock_init(&hcrypt->lock); - ret = rtllib_register_crypto_ops(&rtllib_crypt_null); + ret = lib80211_register_crypto_ops(&rtllib_crypt_null); if (ret < 0) { kfree(hcrypt); hcrypt = NULL; @@ -239,3 +244,8 @@ void __exit rtllib_crypto_deinit(void) kfree(hcrypt); } + +module_init(rtllib_crypto_init); +module_exit(rtllib_crypto_deinit); + +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/rtl8192e/rtllib_crypt.h b/drivers/staging/rtl8192e/rtllib_crypt.h index 49b90b7..e177c92 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt.h +++ b/drivers/staging/rtl8192e/rtllib_crypt.h @@ -25,61 +25,11 @@ #include <linux/skbuff.h> -struct rtllib_crypto_ops { - const char *name; - - /* init new crypto context (e.g., allocate private data space, - * select IV, etc.); returns NULL on failure or pointer to allocated - * private data on success */ - void * (*init)(int keyidx); - - /* deinitialize crypto context and free allocated private data */ - void (*deinit)(void *priv); - - /* encrypt/decrypt return < 0 on error or >= 0 on success. The return - * value from decrypt_mpdu is passed as the keyidx value for - * decrypt_msdu. skb must have enough head and tail room for the - * encryption; if not, error will be returned; these functions are - * called for all MPDUs (i.e., fragments). - */ - int (*encrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); - int (*decrypt_mpdu)(struct sk_buff *skb, int hdr_len, void *priv); - - /* These functions are called for full MSDUs, i.e. full frames. - * These can be NULL if full MSDU operations are not needed. */ - int (*encrypt_msdu)(struct sk_buff *skb, int hdr_len, void *priv); - int (*decrypt_msdu)(struct sk_buff *skb, int keyidx, int hdr_len, - void *priv, struct rtllib_device* ieee); - - int (*set_key)(void *key, int len, u8 *seq, void *priv); - int (*get_key)(void *key, int len, u8 *seq, void *priv); - - /* procfs handler for printing out key information and possible - * statistics */ - char * (*print_stats)(char *p, void *priv); - - /* maximum number of bytes added by encryption; encrypt buf is - * allocated with extra_prefix_len bytes, copy of in_buf, and - * extra_postfix_len; encrypt need not use all this space, but - * the result must start at the beginning of the struct buffer and - * correct length must be returned */ - int extra_prefix_len, extra_postfix_len; - - struct module *owner; -}; - -struct rtllib_crypt_data { - struct list_head list; /* delayed deletion list */ - struct rtllib_crypto_ops *ops; - void *priv; - atomic_t refcnt; -}; - -int rtllib_register_crypto_ops(struct rtllib_crypto_ops *ops); -int rtllib_unregister_crypto_ops(struct rtllib_crypto_ops *ops); -struct rtllib_crypto_ops *rtllib_get_crypto_ops(const char *name); -void rtllib_crypt_deinit_entries(struct rtllib_device *, int); -void rtllib_crypt_deinit_handler(unsigned long); -void rtllib_crypt_delayed_deinit(struct rtllib_device *ieee, - struct rtllib_crypt_data **crypt); +int rtllib_register_crypto_ops(struct lib80211_crypto_ops *ops); +int rtllib_unregister_crypto_ops(struct lib80211_crypto_ops *ops); +struct lib80211_crypto_ops *rtllib_get_crypto_ops(const char *name); +void rtllib_crypt_deinit_entries(struct lib80211_crypt_info *info, int force); +void rtllib_crypt_deinit_handler(unsigned long data); +void rtllib_crypt_delayed_deinit(struct lib80211_crypt_info *info, + struct lib80211_crypt_data **crypt); #endif diff --git a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c index 6196b9a..4217b88 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_ccmp.c @@ -9,7 +9,6 @@ * more details. */ -#include <linux/version.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> @@ -63,10 +62,9 @@ static void *rtllib_ccmp_init(int key_idx) { struct rtllib_ccmp_data *priv; - priv = kmalloc(sizeof(*priv), GFP_ATOMIC); + priv = kzalloc(sizeof(*priv), GFP_ATOMIC); if (priv == NULL) goto fail; - memset(priv, 0, sizeof(*priv)); priv->key_idx = key_idx; priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC); @@ -429,13 +427,8 @@ static char *rtllib_ccmp_print_stats(char *p, void *priv) return p; } -void rtllib_ccmp_null(void) -{ - return; -} - -static struct rtllib_crypto_ops rtllib_crypt_ccmp = { - .name = "CCMP", +static struct lib80211_crypto_ops rtllib_crypt_ccmp = { + .name = "R-CCMP", .init = rtllib_ccmp_init, .deinit = rtllib_ccmp_deinit, .encrypt_mpdu = rtllib_ccmp_encrypt, @@ -445,19 +438,24 @@ static struct rtllib_crypto_ops rtllib_crypt_ccmp = { .set_key = rtllib_ccmp_set_key, .get_key = rtllib_ccmp_get_key, .print_stats = rtllib_ccmp_print_stats, - .extra_prefix_len = CCMP_HDR_LEN, - .extra_postfix_len = CCMP_MIC_LEN, + .extra_mpdu_prefix_len = CCMP_HDR_LEN, + .extra_mpdu_postfix_len = CCMP_MIC_LEN, .owner = THIS_MODULE, }; int __init rtllib_crypto_ccmp_init(void) { - return rtllib_register_crypto_ops(&rtllib_crypt_ccmp); + return lib80211_register_crypto_ops(&rtllib_crypt_ccmp); } void __exit rtllib_crypto_ccmp_exit(void) { - rtllib_unregister_crypto_ops(&rtllib_crypt_ccmp); + lib80211_unregister_crypto_ops(&rtllib_crypt_ccmp); } + +module_init(rtllib_crypto_ccmp_init); +module_exit(rtllib_crypto_ccmp_exit); + +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c index 6a0c878..8009250 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c @@ -9,7 +9,6 @@ * more details. */ -#include <linux/version.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> @@ -60,10 +59,9 @@ static void *rtllib_tkip_init(int key_idx) { struct rtllib_tkip_data *priv; - priv = kmalloc(sizeof(*priv), GFP_ATOMIC); + priv = kzalloc(sizeof(*priv), GFP_ATOMIC); if (priv == NULL) goto fail; - memset(priv, 0, sizeof(*priv)); priv->key_idx = key_idx; priv->tx_tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); @@ -598,8 +596,7 @@ static void rtllib_michael_mic_failure(struct net_device *dev, } static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, - int hdr_len, void *priv, - struct rtllib_device *ieee) + int hdr_len, void *priv) { struct rtllib_tkip_data *tkey = priv; u8 mic[8]; @@ -618,23 +615,20 @@ static int rtllib_michael_mic_verify(struct sk_buff *skb, int keyidx, skb->data + hdr_len, skb->len - 8 - hdr_len, mic)) return -1; - if ((memcmp(mic, skb->data + skb->len - 8, 8) != 0) || - (ieee->force_mic_error)) { + if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { struct rtllib_hdr_4addr *hdr; hdr = (struct rtllib_hdr_4addr *) skb->data; printk(KERN_DEBUG "%s: Michael MIC verification failed for " "MSDU from %pM keyidx=%d\n", skb->dev ? skb->dev->name : "N/A", hdr->addr2, keyidx); - printk(KERN_DEBUG "%d, force_mic_error = %d\n", - (memcmp(mic, skb->data + skb->len - 8, 8) != 0),\ - ieee->force_mic_error); + printk(KERN_DEBUG "%d\n", + memcmp(mic, skb->data + skb->len - 8, 8) != 0); if (skb->dev) { printk(KERN_INFO "skb->dev != NULL\n"); rtllib_michael_mic_failure(skb->dev, hdr, keyidx); } tkey->dot11RSNAStatsTKIPLocalMICFailures++; - ieee->force_mic_error = false; return -1; } @@ -740,9 +734,8 @@ static char *rtllib_tkip_print_stats(char *p, void *priv) return p; } - -static struct rtllib_crypto_ops rtllib_crypt_tkip = { - .name = "TKIP", +static struct lib80211_crypto_ops rtllib_crypt_tkip = { + .name = "R-TKIP", .init = rtllib_tkip_init, .deinit = rtllib_tkip_deinit, .encrypt_mpdu = rtllib_tkip_encrypt, @@ -752,24 +745,25 @@ static struct rtllib_crypto_ops rtllib_crypt_tkip = { .set_key = rtllib_tkip_set_key, .get_key = rtllib_tkip_get_key, .print_stats = rtllib_tkip_print_stats, - .extra_prefix_len = 4 + 4, /* IV + ExtIV */ - .extra_postfix_len = 8 + 4, /* MIC + ICV */ + .extra_mpdu_prefix_len = 4 + 4, /* IV + ExtIV */ + .extra_mpdu_postfix_len = 4, /* ICV */ + .extra_msdu_postfix_len = 8, /* MIC */ .owner = THIS_MODULE, }; int __init rtllib_crypto_tkip_init(void) { - return rtllib_register_crypto_ops(&rtllib_crypt_tkip); + return lib80211_register_crypto_ops(&rtllib_crypt_tkip); } void __exit rtllib_crypto_tkip_exit(void) { - rtllib_unregister_crypto_ops(&rtllib_crypt_tkip); + lib80211_unregister_crypto_ops(&rtllib_crypt_tkip); } -void rtllib_tkip_null(void) -{ - return; -} +module_init(rtllib_crypto_tkip_init); +module_exit(rtllib_crypto_tkip_exit); + +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/rtl8192e/rtllib_crypt_wep.c b/drivers/staging/rtl8192e/rtllib_crypt_wep.c index c59bf10..8cdf389 100644 --- a/drivers/staging/rtl8192e/rtllib_crypt_wep.c +++ b/drivers/staging/rtl8192e/rtllib_crypt_wep.c @@ -9,7 +9,6 @@ * more details. */ -#include <linux/version.h> #include <linux/module.h> #include <linux/init.h> #include <linux/slab.h> @@ -38,10 +37,9 @@ static void *prism2_wep_init(int keyidx) { struct prism2_wep_data *priv; - priv = kmalloc(sizeof(*priv), GFP_ATOMIC); + priv = kzalloc(sizeof(*priv), GFP_ATOMIC); if (priv == NULL) goto fail; - memset(priv, 0, sizeof(*priv)); priv->key_idx = keyidx; priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC); @@ -257,9 +255,8 @@ static char *prism2_wep_print_stats(char *p, void *priv) return p; } - -static struct rtllib_crypto_ops rtllib_crypt_wep = { - .name = "WEP", +static struct lib80211_crypto_ops rtllib_crypt_wep = { + .name = "R-WEP", .init = prism2_wep_init, .deinit = prism2_wep_deinit, .encrypt_mpdu = prism2_wep_encrypt, @@ -269,24 +266,24 @@ static struct rtllib_crypto_ops rtllib_crypt_wep = { .set_key = prism2_wep_set_key, .get_key = prism2_wep_get_key, .print_stats = prism2_wep_print_stats, - .extra_prefix_len = 4, /* IV */ - .extra_postfix_len = 4, /* ICV */ + .extra_mpdu_prefix_len = 4, /* IV */ + .extra_mpdu_postfix_len = 4, /* ICV */ .owner = THIS_MODULE, }; int __init rtllib_crypto_wep_init(void) { - return rtllib_register_crypto_ops(&rtllib_crypt_wep); + return lib80211_register_crypto_ops(&rtllib_crypt_wep); } void __exit rtllib_crypto_wep_exit(void) { - rtllib_unregister_crypto_ops(&rtllib_crypt_wep); + lib80211_unregister_crypto_ops(&rtllib_crypt_wep); } -void rtllib_wep_null(void) -{ - return; -} +module_init(rtllib_crypto_wep_init); +module_exit(rtllib_crypto_wep_exit); + +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/rtl8192e/rtllib_debug.h b/drivers/staging/rtl8192e/rtllib_debug.h new file mode 100644 index 0000000..2bfc115 --- /dev/null +++ b/drivers/staging/rtl8192e/rtllib_debug.h @@ -0,0 +1,86 @@ +/****************************************************************************** + * Copyright(c) 2008 - 2010 Realtek Corporation. All rights reserved. + * + * Based on the r8180 driver, which is: + * Copyright 2004-2005 Andrea Merello <andreamrl@tiscali.it>, et al. + * This program is free software; you can redistribute it and/or modify it + * under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA + * + * The full GNU General Public License is included in this distribution in the + * file called LICENSE. + * + * Contact Information: + * wlanfae <wlanfae@realtek.com> +******************************************************************************/ +#ifndef _RTL_DEBUG_H +#define _RTL_DEBUG_H + +/* Allow files to override DRV_NAME */ +#ifndef DRV_NAME +#define DRV_NAME "rtllib_92e" +#endif + +#define DMESG(x, a...) + +extern u32 rt_global_debug_component; + +/* These are the defines for rt_global_debug_component */ +enum RTL_DEBUG { + COMP_TRACE = (1 << 0), + COMP_DBG = (1 << 1), + COMP_INIT = (1 << 2), + COMP_RECV = (1 << 3), + COMP_SEND = (1 << 4), + COMP_CMD = (1 << 5), + COMP_POWER = (1 << 6), + COMP_EPROM = (1 << 7), + COMP_SWBW = (1 << 8), + COMP_SEC = (1 << 9), + COMP_LPS = (1 << 10), + COMP_QOS = (1 << 11), + COMP_RATE = (1 << 12), + COMP_RXDESC = (1 << 13), + COMP_PHY = (1 << 14), + COMP_DIG = (1 << 15), + COMP_TXAGC = (1 << 16), + COMP_HALDM = (1 << 17), + COMP_POWER_TRACKING = (1 << 18), + COMP_CH = (1 << 19), + COMP_RF = (1 << 20), + COMP_FIRMWARE = (1 << 21), + COMP_HT = (1 << 22), + COMP_RESET = (1 << 23), + COMP_CMDPKT = (1 << 24), + COMP_SCAN = (1 << 25), + COMP_PS = (1 << 26), + COMP_DOWN = (1 << 27), + COMP_INTR = (1 << 28), + COMP_LED = (1 << 29), + COMP_MLME = (1 << 30), + COMP_ERR = (1 << 31) +}; + +#define RT_TRACE(component, x, args...) \ +do { \ + if (rt_global_debug_component & component) \ + printk(KERN_DEBUG DRV_NAME ":" x "\n" , \ + ##args);\ +} while (0); + +#define assert(expr) \ + if (!(expr)) { \ + printk(KERN_INFO "Assertion failed! %s,%s,%s,line=%d\n", \ + #expr, __FILE__, __func__, __LINE__); \ + } + +#endif diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index c36a140..f9dae95 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -45,7 +45,6 @@ #include <linux/slab.h> #include <linux/tcp.h> #include <linux/types.h> -#include <linux/version.h> #include <linux/wireless.h> #include <linux/etherdevice.h> #include <linux/uaccess.h> @@ -54,7 +53,9 @@ #include "rtllib.h" -#define DRV_NAME "rtllib_92e" +u32 rt_global_debug_component = COMP_ERR; +EXPORT_SYMBOL(rt_global_debug_component); + void _setup_timer(struct timer_list *ptimer, void *fun, unsigned long data) { @@ -135,10 +136,6 @@ struct net_device *alloc_rtllib(int sizeof_priv) ieee->host_decrypt = 1; ieee->ieee802_1x = 1; /* Default to supporting 802.1x */ - INIT_LIST_HEAD(&ieee->crypt_deinit_list); - _setup_timer(&ieee->crypt_deinit_timer, - rtllib_crypt_deinit_handler, - (unsigned long) ieee); ieee->rtllib_ap_sec_type = rtllib_ap_sec_type; spin_lock_init(&ieee->lock); @@ -148,6 +145,9 @@ struct net_device *alloc_rtllib(int sizeof_priv) atomic_set(&(ieee->atm_chnlop), 0); atomic_set(&(ieee->atm_swbw), 0); + /* SAM FIXME */ + lib80211_crypt_info_init(&ieee->crypt_info, "RTLLIB", &ieee->lock); + ieee->bHalfNMode = false; ieee->wpa_enabled = 0; ieee->tkip_countermeasures = 0; @@ -177,10 +177,6 @@ struct net_device *alloc_rtllib(int sizeof_priv) ieee->last_packet_time[i] = 0; } - rtllib_tkip_null(); - rtllib_wep_null(); - rtllib_ccmp_null(); - return dev; failed: @@ -188,32 +184,23 @@ struct net_device *alloc_rtllib(int sizeof_priv) free_netdev(dev); return NULL; } +EXPORT_SYMBOL(alloc_rtllib); void free_rtllib(struct net_device *dev) { struct rtllib_device *ieee = (struct rtllib_device *) netdev_priv_rsl(dev); - int i; kfree(ieee->pHTInfo); ieee->pHTInfo = NULL; rtllib_softmac_free(ieee); - del_timer_sync(&ieee->crypt_deinit_timer); - rtllib_crypt_deinit_entries(ieee, 1); - - for (i = 0; i < WEP_KEYS; i++) { - struct rtllib_crypt_data *crypt = ieee->crypt[i]; - if (crypt) { - if (crypt->ops) - crypt->ops->deinit(crypt->priv); - kfree(crypt); - ieee->crypt[i] = NULL; - } - } + + lib80211_crypt_info_free(&ieee->crypt_info); rtllib_networks_free(ieee); free_netdev(dev); } +EXPORT_SYMBOL(free_rtllib); u32 rtllib_debug_level; static int debug = \ @@ -287,3 +274,8 @@ void __exit rtllib_exit(void) rtllib_proc = NULL; } } + +module_init(rtllib_init); +module_exit(rtllib_exit); + +MODULE_LICENSE("GPL"); diff --git a/drivers/staging/rtl8192e/rtllib_rx.c b/drivers/staging/rtl8192e/rtllib_rx.c index 8d0af5e..6c5061f 100644 --- a/drivers/staging/rtl8192e/rtllib_rx.c +++ b/drivers/staging/rtl8192e/rtllib_rx.c @@ -36,7 +36,6 @@ #include <linux/slab.h> #include <linux/tcp.h> #include <linux/types.h> -#include <linux/version.h> #include <linux/wireless.h> #include <linux/etherdevice.h> #include <linux/uaccess.h> @@ -281,7 +280,7 @@ static int rtllib_is_eapol_frame(struct rtllib_device *ieee, /* Called only as a tasklet (software IRQ), by rtllib_rx */ static inline int rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, - struct rtllib_crypt_data *crypt) + struct lib80211_crypt_data *crypt) { struct rtllib_hdr_4addr *hdr; int res, hdrlen; @@ -322,7 +321,7 @@ rtllib_rx_frame_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, /* Called only as a tasklet (software IRQ), by rtllib_rx */ static inline int rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, - int keyidx, struct rtllib_crypt_data *crypt) + int keyidx, struct lib80211_crypt_data *crypt) { struct rtllib_hdr_4addr *hdr; int res, hdrlen; @@ -341,7 +340,7 @@ rtllib_rx_frame_decrypt_msdu(struct rtllib_device *ieee, struct sk_buff *skb, hdrlen = rtllib_get_hdrlen(le16_to_cpu(hdr->frame_ctl)); atomic_inc(&crypt->refcnt); - res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv, ieee); + res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv); atomic_dec(&crypt->refcnt); if (res < 0) { printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed" @@ -1010,7 +1009,7 @@ static int rtllib_rx_data_filter(struct rtllib_device *ieee, u16 fc, } static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, - struct rtllib_crypt_data **crypt, size_t hdrlen) + struct lib80211_crypt_data **crypt, size_t hdrlen) { struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data; u16 fc = le16_to_cpu(hdr->frame_ctl); @@ -1020,7 +1019,7 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, if (skb->len >= hdrlen + 3) idx = skb->data[hdrlen + 3] >> 6; - *crypt = ieee->crypt[idx]; + *crypt = ieee->crypt_info.crypt[idx]; /* allow NULL decrypt to indicate an station specific override * for default encryption */ if (*crypt && ((*crypt)->ops == NULL || @@ -1045,7 +1044,7 @@ static int rtllib_rx_get_crypt(struct rtllib_device *ieee, struct sk_buff *skb, static int rtllib_rx_decrypt(struct rtllib_device *ieee, struct sk_buff *skb, struct rtllib_rx_stats *rx_stats, - struct rtllib_crypt_data *crypt, size_t hdrlen) + struct lib80211_crypt_data *crypt, size_t hdrlen) { struct rtllib_hdr_4addr *hdr; int keyidx = 0; @@ -1253,7 +1252,7 @@ static int rtllib_rx_InfraAdhoc(struct rtllib_device *ieee, struct sk_buff *skb, { struct net_device *dev = ieee->dev; struct rtllib_hdr_4addr *hdr = (struct rtllib_hdr_4addr *)skb->data; - struct rtllib_crypt_data *crypt = NULL; + struct lib80211_crypt_data *crypt = NULL; struct rtllib_rxb *rxb = NULL; struct rx_ts_record *pTS = NULL; u16 fc, sc, SeqNum = 0; @@ -1497,6 +1496,7 @@ int rtllib_rx(struct rtllib_device *ieee, struct sk_buff *skb, ieee->stats.rx_dropped++; return 0; } +EXPORT_SYMBOL(rtllib_rx); static u8 qos_oui[QOS_OUI_LEN] = { 0x00, 0x50, 0xF2 }; @@ -2492,7 +2492,7 @@ static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) return 0; } -int IsLegalChannel(struct rtllib_device *rtllib, u8 channel) +int rtllib_legal_channel(struct rtllib_device *rtllib, u8 channel) { if (MAX_CHANNEL_NUMBER < channel) { printk(KERN_INFO "%s(): Invalid Channel\n", __func__); @@ -2503,6 +2503,7 @@ int IsLegalChannel(struct rtllib_device *rtllib, u8 channel) return 0; } +EXPORT_SYMBOL(rtllib_legal_channel); static inline void rtllib_process_probe_response( struct rtllib_device *ieee, @@ -2553,7 +2554,7 @@ static inline void rtllib_process_probe_response( } - if (!IsLegalChannel(ieee, network->channel)) + if (!rtllib_legal_channel(ieee, network->channel)) goto free_network; if (WLAN_FC_GET_STYPE(beacon->header.frame_ctl) == diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index b508685..1637f11 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -15,11 +15,9 @@ #include "rtllib.h" -#include "rtl_core.h" #include <linux/random.h> #include <linux/delay.h> -#include <linux/version.h> #include <linux/uaccess.h> #include "dot11d.h" @@ -28,9 +26,9 @@ short rtllib_is_54g(struct rtllib_network *net) return (net->rates_ex_len > 0) || (net->rates_len > 4); } -short rtllib_is_shortslot(struct rtllib_network net) +short rtllib_is_shortslot(const struct rtllib_network *net) { - return net.capability & WLAN_CAPABILITY_SHORT_SLOT_TIME; + return net->capability & WLAN_CAPABILITY_SHORT_SLOT_TIME; } /* returns the total length needed for pleacing the RATE MFIE @@ -468,6 +466,7 @@ void rtllib_EnableIntelPromiscuousMode(struct net_device *dev, ieee->bNetPromiscuousMode = true; } +EXPORT_SYMBOL(rtllib_EnableIntelPromiscuousMode); /* @@ -490,6 +489,7 @@ void rtllib_DisableIntelPromiscuousMode(struct net_device *dev, ieee->bNetPromiscuousMode = false; } +EXPORT_SYMBOL(rtllib_DisableIntelPromiscuousMode); static void rtllib_send_probe(struct rtllib_device *ieee, u8 is_mesh) { @@ -685,6 +685,7 @@ void rtllib_stop_send_beacons(struct rtllib_device *ieee) if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) rtllib_beacons_stop(ieee); } +EXPORT_SYMBOL(rtllib_stop_send_beacons); void rtllib_start_send_beacons(struct rtllib_device *ieee) @@ -694,6 +695,7 @@ void rtllib_start_send_beacons(struct rtllib_device *ieee) if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) rtllib_beacons_start(ieee); } +EXPORT_SYMBOL(rtllib_start_send_beacons); static void rtllib_softmac_stop_scan(struct rtllib_device *ieee) @@ -719,6 +721,7 @@ void rtllib_stop_scan(struct rtllib_device *ieee) ieee->rtllib_stop_hw_scan(ieee->dev); } } +EXPORT_SYMBOL(rtllib_stop_scan); void rtllib_stop_scan_syncro(struct rtllib_device *ieee) { @@ -729,6 +732,7 @@ void rtllib_stop_scan_syncro(struct rtllib_device *ieee) ieee->rtllib_stop_hw_scan(ieee->dev); } } +EXPORT_SYMBOL(rtllib_stop_scan_syncro); bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan) { @@ -741,6 +745,7 @@ bool rtllib_act_scanning(struct rtllib_device *ieee, bool sync_scan) return test_bit(STATUS_SCANNING, &ieee->status); } } +EXPORT_SYMBOL(rtllib_act_scanning); /* called with ieee->lock held */ static void rtllib_start_scan(struct rtllib_device *ieee) @@ -781,6 +786,7 @@ void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh) ieee->rtllib_start_hw_scan(ieee->dev); } } +EXPORT_SYMBOL(rtllib_start_scan_syncro); inline struct sk_buff *rtllib_authentication_req(struct rtllib_network *beacon, struct rtllib_device *ieee, int challengelen, u8 *daddr) @@ -830,7 +836,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) struct sk_buff *skb = NULL; int encrypt; int atim_len, erp_len; - struct rtllib_crypt_data *crypt; + struct lib80211_crypt_data *crypt; char *ssid = ieee->current_network.ssid; int ssid_len = ieee->current_network.ssid_len; @@ -865,9 +871,9 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) } else erp_len = 0; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; encrypt = ieee->host_encrypt && crypt && crypt->ops && - ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); + ((0 == strcmp(crypt->ops->name, "R-WEP") || wpa_ie_len)); if (ieee->pHTInfo->bCurrentHTSupport) { tmp_ht_cap_buf = (u8 *) &(ieee->pHTInfo->SelfHTCap); tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); @@ -917,7 +923,7 @@ static struct sk_buff *rtllib_probe_resp(struct rtllib_device *ieee, u8 *dest) cpu_to_le16((beacon_buf->capability |= WLAN_CAPABILITY_SHORT_SLOT_TIME)); - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (encrypt) beacon_buf->capability |= cpu_to_le16(WLAN_CAPABILITY_PRIVACY); @@ -976,7 +982,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest) struct sk_buff *skb; u8 *tag; - struct rtllib_crypt_data *crypt; + struct lib80211_crypt_data *crypt; struct rtllib_assoc_response_frame *assoc; short encrypt; @@ -1007,7 +1013,7 @@ static struct sk_buff *rtllib_assoc_resp(struct rtllib_device *ieee, u8 *dest) cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME); if (ieee->host_encrypt) - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; else crypt = NULL; @@ -1172,7 +1178,7 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, unsigned int ckip_ie_len = 0; unsigned int ccxrm_ie_len = 0; unsigned int cxvernum_ie_len = 0; - struct rtllib_crypt_data *crypt; + struct lib80211_crypt_data *crypt; int encrypt; int PMKCacheIdx; @@ -1185,10 +1191,10 @@ inline struct sk_buff *rtllib_association_req(struct rtllib_network *beacon, unsigned int turbo_info_len = beacon->Turbo_Enable ? 9 : 0; int len = 0; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (crypt != NULL) encrypt = ieee->host_encrypt && crypt && crypt->ops && - ((0 == strcmp(crypt->ops->name, "WEP") || + ((0 == strcmp(crypt->ops->name, "R-WEP") || wpa_ie_len)); else encrypt = 0; @@ -1956,6 +1962,7 @@ void rtllib_sta_ps_send_null_frame(struct rtllib_device *ieee, short pwr) if (buf) softmac_ps_mgmt_xmit(buf, ieee); } +EXPORT_SYMBOL(rtllib_sta_ps_send_null_frame); void rtllib_sta_ps_send_pspoll_frame(struct rtllib_device *ieee) { @@ -2168,6 +2175,7 @@ void rtllib_ps_tx_ack(struct rtllib_device *ieee, short success) } spin_unlock_irqrestore(&ieee->lock, flags); } +EXPORT_SYMBOL(rtllib_ps_tx_ack); static void rtllib_process_action(struct rtllib_device *ieee, struct sk_buff *skb) { @@ -2540,6 +2548,7 @@ void rtllib_reset_queue(struct rtllib_device *ieee) spin_unlock_irqrestore(&ieee->lock, flags); } +EXPORT_SYMBOL(rtllib_reset_queue); void rtllib_wake_queue(struct rtllib_device *ieee) { @@ -2928,6 +2937,7 @@ struct sk_buff *rtllib_get_beacon(struct rtllib_device *ieee) return skb; } +EXPORT_SYMBOL(rtllib_get_beacon); void rtllib_softmac_stop_protocol(struct rtllib_device *ieee, u8 mesh_flag, u8 shutdown) @@ -2937,6 +2947,7 @@ void rtllib_softmac_stop_protocol(struct rtllib_device *ieee, u8 mesh_flag, rtllib_stop_protocol(ieee, shutdown); up(&ieee->wx_sem); } +EXPORT_SYMBOL(rtllib_softmac_stop_protocol); void rtllib_stop_protocol(struct rtllib_device *ieee, u8 shutdown) @@ -2985,6 +2996,7 @@ void rtllib_softmac_start_protocol(struct rtllib_device *ieee, u8 mesh_flag) rtllib_start_protocol(ieee); up(&ieee->wx_sem); } +EXPORT_SYMBOL(rtllib_softmac_start_protocol); void rtllib_start_protocol(struct rtllib_device *ieee) { @@ -3048,10 +3060,9 @@ void rtllib_softmac_init(struct rtllib_device *ieee) ieee->state = RTLLIB_NOLINK; for (i = 0; i < 5; i++) ieee->seq_ctrl[i] = 0; - ieee->pDot11dInfo = kmalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC); + ieee->pDot11dInfo = kzalloc(sizeof(struct rt_dot11d_info), GFP_ATOMIC); if (!ieee->pDot11dInfo) RTLLIB_DEBUG(RTLLIB_DL_ERR, "can't alloc memory for DOT11D\n"); - memset(ieee->pDot11dInfo, 0, sizeof(struct rt_dot11d_info)); ieee->LinkDetectInfo.SlotIndex = 0; ieee->LinkDetectInfo.SlotNum = 2; ieee->LinkDetectInfo.NumRecvBcnInPeriod = 0; @@ -3207,11 +3218,11 @@ static int rtllib_wpa_set_wpa_ie(struct rtllib_device *ieee, return -EINVAL; if (param->u.wpa_ie.len) { - buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL); + buf = kmemdup(param->u.wpa_ie.data, param->u.wpa_ie.len, + GFP_KERNEL); if (buf == NULL) return -ENOMEM; - memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len); kfree(ieee->wpa_ie); ieee->wpa_ie = buf; ieee->wpa_ie_len = param->u.wpa_ie.len; @@ -3334,8 +3345,8 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, u8 is_mesh) { int ret = 0; - struct rtllib_crypto_ops *ops; - struct rtllib_crypt_data **crypt; + struct lib80211_crypto_ops *ops; + struct lib80211_crypt_data **crypt; struct rtllib_security sec = { .flags = 0, @@ -3354,9 +3365,9 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, if (param->sta_addr[0] == 0xff && param->sta_addr[1] == 0xff && param->sta_addr[2] == 0xff && param->sta_addr[3] == 0xff && param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { - if (param->u.crypt.idx >= WEP_KEYS) + if (param->u.crypt.idx >= NUM_WEP_KEYS) return -EINVAL; - crypt = &ieee->crypt[param->u.crypt.idx]; + crypt = &ieee->crypt_info.crypt[param->u.crypt.idx]; } else { return -EINVAL; } @@ -3366,7 +3377,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, sec.enabled = 0; sec.level = SEC_LEVEL_0; sec.flags |= SEC_ENABLED | SEC_LEVEL; - rtllib_crypt_delayed_deinit(ieee, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } goto done; } @@ -3375,19 +3386,19 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, /* IPW HW cannot build TKIP MIC, host decryption still needed. */ if (!(ieee->host_encrypt || ieee->host_decrypt) && - strcmp(param->u.crypt.alg, "TKIP")) + strcmp(param->u.crypt.alg, "R-TKIP")) goto skip_host_crypt; - ops = rtllib_get_crypto_ops(param->u.crypt.alg); - if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { + ops = lib80211_get_crypto_ops(param->u.crypt.alg); + if (ops == NULL && strcmp(param->u.crypt.alg, "R-WEP") == 0) { request_module("rtllib_crypt_wep"); - ops = rtllib_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { + ops = lib80211_get_crypto_ops(param->u.crypt.alg); + } else if (ops == NULL && strcmp(param->u.crypt.alg, "R-TKIP") == 0) { request_module("rtllib_crypt_tkip"); - ops = rtllib_get_crypto_ops(param->u.crypt.alg); - } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { + ops = lib80211_get_crypto_ops(param->u.crypt.alg); + } else if (ops == NULL && strcmp(param->u.crypt.alg, "R-CCMP") == 0) { request_module("rtllib_crypt_ccmp"); - ops = rtllib_get_crypto_ops(param->u.crypt.alg); + ops = lib80211_get_crypto_ops(param->u.crypt.alg); } if (ops == NULL) { printk(KERN_INFO "unknown crypto alg '%s'\n", @@ -3397,17 +3408,17 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, goto done; } if (*crypt == NULL || (*crypt)->ops != ops) { - struct rtllib_crypt_data *new_crypt; + struct lib80211_crypt_data *new_crypt; - rtllib_crypt_delayed_deinit(ieee, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - new_crypt = (struct rtllib_crypt_data *) + new_crypt = (struct lib80211_crypt_data *) kmalloc(sizeof(*new_crypt), GFP_KERNEL); if (new_crypt == NULL) { ret = -ENOMEM; goto done; } - memset(new_crypt, 0, sizeof(struct rtllib_crypt_data)); + memset(new_crypt, 0, sizeof(struct lib80211_crypt_data)); new_crypt->ops = ops; if (new_crypt->ops) new_crypt->priv = @@ -3435,7 +3446,7 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, skip_host_crypt: if (param->u.crypt.set_tx) { - ieee->tx_keyidx = param->u.crypt.idx; + ieee->crypt_info.tx_keyidx = param->u.crypt.idx; sec.active_key = param->u.crypt.idx; sec.flags |= SEC_ACTIVE_KEY; } else @@ -3448,13 +3459,13 @@ static int rtllib_wpa_set_encryption(struct rtllib_device *ieee, sec.key_sizes[param->u.crypt.idx] = param->u.crypt.key_len; sec.flags |= (1 << param->u.crypt.idx); - if (strcmp(param->u.crypt.alg, "WEP") == 0) { + if (strcmp(param->u.crypt.alg, "R-WEP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_1; - } else if (strcmp(param->u.crypt.alg, "TKIP") == 0) { + } else if (strcmp(param->u.crypt.alg, "R-TKIP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_2; - } else if (strcmp(param->u.crypt.alg, "CCMP") == 0) { + } else if (strcmp(param->u.crypt.alg, "R-CCMP") == 0) { sec.flags |= SEC_LEVEL; sec.level = SEC_LEVEL_3; } @@ -3551,13 +3562,13 @@ u8 rtllib_ap_sec_type(struct rtllib_device *ieee) static u8 ccmp_ie[4] = {0x00, 0x50, 0xf2, 0x04}; static u8 ccmp_rsn_ie[4] = {0x00, 0x0f, 0xac, 0x04}; int wpa_ie_len = ieee->wpa_ie_len; - struct rtllib_crypt_data *crypt; + struct lib80211_crypt_data *crypt; int encrypt; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; encrypt = (ieee->current_network.capability & WLAN_CAPABILITY_PRIVACY) || (ieee->host_encrypt && crypt && crypt->ops && - (0 == strcmp(crypt->ops->name, "WEP"))); + (0 == strcmp(crypt->ops->name, "R-WEP"))); /* simply judge */ if (encrypt && (wpa_ie_len == 0)) { @@ -3634,6 +3645,7 @@ out: return ret; } +EXPORT_SYMBOL(rtllib_wpa_supplicant_ioctl); void rtllib_MgntDisconnectIBSS(struct rtllib_device *rtllib) { @@ -3719,6 +3731,7 @@ bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn) return true; } +EXPORT_SYMBOL(rtllib_MgntDisconnect); void notify_wx_assoc_event(struct rtllib_device *ieee) { @@ -3739,3 +3752,4 @@ void notify_wx_assoc_event(struct rtllib_device *ieee) } wireless_send_event(ieee->dev, SIOCGIWAP, &wrqu, NULL); } +EXPORT_SYMBOL(notify_wx_assoc_event); diff --git a/drivers/staging/rtl8192e/rtllib_softmac_wx.c b/drivers/staging/rtl8192e/rtllib_softmac_wx.c index 22988fb..1523bc7 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac_wx.c +++ b/drivers/staging/rtl8192e/rtllib_softmac_wx.c @@ -15,7 +15,6 @@ #include "rtllib.h" -#include "rtl_core.h" #include "dot11d.h" /* FIXME: add A freqs */ @@ -25,6 +24,7 @@ const long rtllib_wlan_frequencies[] = { 2452, 2457, 2462, 2467, 2472, 2484 }; +EXPORT_SYMBOL(rtllib_wlan_frequencies); int rtllib_wx_set_freq(struct rtllib_device *ieee, struct iw_request_info *a, @@ -82,6 +82,7 @@ out: up(&ieee->wx_sem); return ret; } +EXPORT_SYMBOL(rtllib_wx_set_freq); int rtllib_wx_get_freq(struct rtllib_device *ieee, @@ -97,6 +98,7 @@ int rtllib_wx_get_freq(struct rtllib_device *ieee, fwrq->e = 1; return 0; } +EXPORT_SYMBOL(rtllib_wx_get_freq); int rtllib_wx_get_wap(struct rtllib_device *ieee, struct iw_request_info *info, @@ -125,6 +127,7 @@ int rtllib_wx_get_wap(struct rtllib_device *ieee, return 0; } +EXPORT_SYMBOL(rtllib_wx_get_wap); int rtllib_wx_set_wap(struct rtllib_device *ieee, @@ -184,6 +187,7 @@ out: up(&ieee->wx_sem); return ret; } +EXPORT_SYMBOL(rtllib_wx_set_wap); int rtllib_wx_get_essid(struct rtllib_device *ieee, struct iw_request_info *a, union iwreq_data *wrqu, char *b) @@ -220,6 +224,7 @@ out: return ret; } +EXPORT_SYMBOL(rtllib_wx_get_essid); int rtllib_wx_set_rate(struct rtllib_device *ieee, struct iw_request_info *info, @@ -231,6 +236,7 @@ int rtllib_wx_set_rate(struct rtllib_device *ieee, ieee->rate = target_rate/100000; return 0; } +EXPORT_SYMBOL(rtllib_wx_set_rate); int rtllib_wx_get_rate(struct rtllib_device *ieee, struct iw_request_info *info, @@ -243,6 +249,7 @@ int rtllib_wx_get_rate(struct rtllib_device *ieee, return 0; } +EXPORT_SYMBOL(rtllib_wx_get_rate); int rtllib_wx_set_rts(struct rtllib_device *ieee, @@ -259,6 +266,7 @@ int rtllib_wx_set_rts(struct rtllib_device *ieee, } return 0; } +EXPORT_SYMBOL(rtllib_wx_set_rts); int rtllib_wx_get_rts(struct rtllib_device *ieee, struct iw_request_info *info, @@ -269,6 +277,7 @@ int rtllib_wx_get_rts(struct rtllib_device *ieee, wrqu->rts.disabled = (wrqu->rts.value == DEFAULT_RTS_THRESHOLD); return 0; } +EXPORT_SYMBOL(rtllib_wx_get_rts); int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a, union iwreq_data *wrqu, char *b) @@ -314,6 +323,7 @@ out: up(&ieee->wx_sem); return set_mode_status; } +EXPORT_SYMBOL(rtllib_wx_set_mode); void rtllib_wx_sync_scan_wq(void *data) { @@ -428,6 +438,7 @@ out: up(&ieee->wx_sem); return ret; } +EXPORT_SYMBOL(rtllib_wx_set_scan); int rtllib_wx_set_essid(struct rtllib_device *ieee, struct iw_request_info *a, @@ -490,6 +501,7 @@ out: up(&ieee->wx_sem); return ret; } +EXPORT_SYMBOL(rtllib_wx_set_essid); int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a, union iwreq_data *wrqu, char *b) @@ -497,6 +509,7 @@ int rtllib_wx_get_mode(struct rtllib_device *ieee, struct iw_request_info *a, wrqu->mode = ieee->iw_mode; return 0; } +EXPORT_SYMBOL(rtllib_wx_get_mode); int rtllib_wx_set_rawtx(struct rtllib_device *ieee, struct iw_request_info *info, @@ -533,6 +546,7 @@ int rtllib_wx_set_rawtx(struct rtllib_device *ieee, return 0; } +EXPORT_SYMBOL(rtllib_wx_set_rawtx); int rtllib_wx_get_name(struct rtllib_device *ieee, struct iw_request_info *info, @@ -548,6 +562,7 @@ int rtllib_wx_get_name(struct rtllib_device *ieee, strcat(wrqu->name, "n"); return 0; } +EXPORT_SYMBOL(rtllib_wx_get_name); /* this is mostly stolen from hostap */ @@ -605,6 +620,7 @@ exit: return ret; } +EXPORT_SYMBOL(rtllib_wx_set_power); /* this is stolen from hostap */ int rtllib_wx_get_power(struct rtllib_device *ieee, @@ -643,3 +659,4 @@ exit: return ret; } +EXPORT_SYMBOL(rtllib_wx_get_power); diff --git a/drivers/staging/rtl8192e/rtllib_tx.c b/drivers/staging/rtl8192e/rtllib_tx.c index 44e8006..f451bfc 100644 --- a/drivers/staging/rtl8192e/rtllib_tx.c +++ b/drivers/staging/rtl8192e/rtllib_tx.c @@ -46,7 +46,6 @@ #include <linux/slab.h> #include <linux/tcp.h> #include <linux/types.h> -#include <linux/version.h> #include <linux/wireless.h> #include <linux/etherdevice.h> #include <linux/uaccess.h> @@ -180,10 +179,10 @@ inline int rtllib_put_snap(u8 *data, u16 h_proto) int rtllib_encrypt_fragment(struct rtllib_device *ieee, struct sk_buff *frag, int hdr_len) { - struct rtllib_crypt_data *crypt = NULL; + struct lib80211_crypt_data *crypt = NULL; int res; - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; if (!(crypt && crypt->ops)) { printk(KERN_INFO "=========>%s(), crypt is null\n", __func__); @@ -569,7 +568,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) }; u8 dest[ETH_ALEN], src[ETH_ALEN]; int qos_actived = ieee->current_network.qos_data.active; - struct rtllib_crypt_data *crypt = NULL; + struct lib80211_crypt_data *crypt = NULL; struct cb_desc *tcb_desc; u8 bIsMulticast = false; u8 IsAmsdu = false; @@ -646,7 +645,7 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) } skb->priority = rtllib_classify(skb, IsAmsdu); - crypt = ieee->crypt[ieee->tx_keyidx]; + crypt = ieee->crypt_info.crypt[ieee->crypt_info.tx_keyidx]; encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && ieee->host_encrypt && crypt && crypt->ops; if (!encrypt && ieee->ieee802_1x && @@ -742,8 +741,10 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) /* Each fragment may need to have room for encryptiong * pre/postfix */ if (encrypt) { - bytes_per_frag -= crypt->ops->extra_prefix_len + - crypt->ops->extra_postfix_len; + bytes_per_frag -= crypt->ops->extra_mpdu_prefix_len + + crypt->ops->extra_mpdu_postfix_len + + crypt->ops->extra_msdu_prefix_len + + crypt->ops->extra_msdu_postfix_len; } /* Number of fragments is the total bytes_per_frag / * payload_per_fragment */ @@ -791,7 +792,8 @@ int rtllib_xmit_inter(struct sk_buff *skb, struct net_device *dev) else tcb_desc->bHwSec = 0; skb_reserve(skb_frag, - crypt->ops->extra_prefix_len); + crypt->ops->extra_mpdu_prefix_len + + crypt->ops->extra_msdu_prefix_len); } else { tcb_desc->bHwSec = 0; } @@ -965,3 +967,4 @@ int rtllib_xmit(struct sk_buff *skb, struct net_device *dev) memset(skb->cb, 0, sizeof(skb->cb)); return rtllib_xmit_inter(skb, dev); } +EXPORT_SYMBOL(rtllib_xmit); diff --git a/drivers/staging/rtl8192e/rtllib_wx.c b/drivers/staging/rtl8192e/rtllib_wx.c index 8cea4a6..c27ff7e 100644 --- a/drivers/staging/rtl8192e/rtllib_wx.c +++ b/drivers/staging/rtl8192e/rtllib_wx.c @@ -30,7 +30,6 @@ ******************************************************************************/ #include <linux/wireless.h> -#include <linux/version.h> #include <linux/kmod.h> #include <linux/module.h> @@ -295,6 +294,7 @@ int rtllib_wx_get_scan(struct rtllib_device *ieee, return err; } +EXPORT_SYMBOL(rtllib_wx_get_scan); int rtllib_wx_set_encode(struct rtllib_device *ieee, struct iw_request_info *info, @@ -306,44 +306,44 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, .flags = 0 }; int i, key, key_provided, len; - struct rtllib_crypt_data **crypt; + struct lib80211_crypt_data **crypt; RTLLIB_DEBUG_WX("SET_ENCODE\n"); key = erq->flags & IW_ENCODE_INDEX; if (key) { - if (key > WEP_KEYS) + if (key > NUM_WEP_KEYS) return -EINVAL; key--; key_provided = 1; } else { key_provided = 0; - key = ieee->tx_keyidx; + key = ieee->crypt_info.tx_keyidx; } RTLLIB_DEBUG_WX("Key: %d [%s]\n", key, key_provided ? "provided" : "default"); - crypt = &ieee->crypt[key]; + crypt = &ieee->crypt_info.crypt[key]; if (erq->flags & IW_ENCODE_DISABLED) { if (key_provided && *crypt) { RTLLIB_DEBUG_WX("Disabling encryption on key %d.\n", key); - rtllib_crypt_delayed_deinit(ieee, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } else RTLLIB_DEBUG_WX("Disabling encryption.\n"); /* Check all the keys to see if any are still configured, * and if no key index was provided, de-init them all */ - for (i = 0; i < WEP_KEYS; i++) { - if (ieee->crypt[i] != NULL) { + for (i = 0; i < NUM_WEP_KEYS; i++) { + if (ieee->crypt_info.crypt[i] != NULL) { if (key_provided) break; - rtllib_crypt_delayed_deinit(ieee, - &ieee->crypt[i]); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, + &ieee->crypt_info.crypt[i]); } } - if (i == WEP_KEYS) { + if (i == NUM_WEP_KEYS) { sec.enabled = 0; sec.level = SEC_LEVEL_0; sec.flags |= SEC_ENABLED | SEC_LEVEL; @@ -358,25 +358,24 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, sec.flags |= SEC_ENABLED; if (*crypt != NULL && (*crypt)->ops != NULL && - strcmp((*crypt)->ops->name, "WEP") != 0) { + strcmp((*crypt)->ops->name, "R-WEP") != 0) { /* changing to use WEP; deinit previously used algorithm * on this key */ - rtllib_crypt_delayed_deinit(ieee, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); } if (*crypt == NULL) { - struct rtllib_crypt_data *new_crypt; + struct lib80211_crypt_data *new_crypt; /* take WEP into use */ - new_crypt = kmalloc(sizeof(struct rtllib_crypt_data), + new_crypt = kzalloc(sizeof(struct lib80211_crypt_data), GFP_KERNEL); if (new_crypt == NULL) return -ENOMEM; - memset(new_crypt, 0, sizeof(struct rtllib_crypt_data)); - new_crypt->ops = rtllib_get_crypto_ops("WEP"); + new_crypt->ops = lib80211_get_crypto_ops("R-WEP"); if (!new_crypt->ops) { request_module("rtllib_crypt_wep"); - new_crypt->ops = rtllib_get_crypto_ops("WEP"); + new_crypt->ops = lib80211_get_crypto_ops("R-WEP"); } if (new_crypt->ops) @@ -412,7 +411,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, * explicitely set */ if (key == sec.active_key) sec.flags |= SEC_ACTIVE_KEY; - ieee->tx_keyidx = key; + ieee->crypt_info.tx_keyidx = key; } else { len = (*crypt)->ops->get_key(sec.keys[key], WEP_KEY_LEN, @@ -435,7 +434,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, if (key_provided) { RTLLIB_DEBUG_WX( "Setting key %d to default Tx key.\n", key); - ieee->tx_keyidx = key; + ieee->crypt_info.tx_keyidx = key; sec.active_key = key; sec.flags |= SEC_ACTIVE_KEY; } @@ -470,6 +469,7 @@ int rtllib_wx_set_encode(struct rtllib_device *ieee, } return 0; } +EXPORT_SYMBOL(rtllib_wx_set_encode); int rtllib_wx_get_encode(struct rtllib_device *ieee, struct iw_request_info *info, @@ -477,7 +477,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee, { struct iw_point *erq = &(wrqu->encoding); int len, key; - struct rtllib_crypt_data *crypt; + struct lib80211_crypt_data *crypt; RTLLIB_DEBUG_WX("GET_ENCODE\n"); @@ -486,13 +486,13 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee, key = erq->flags & IW_ENCODE_INDEX; if (key) { - if (key > WEP_KEYS) + if (key > NUM_WEP_KEYS) return -EINVAL; key--; } else { - key = ieee->tx_keyidx; + key = ieee->crypt_info.tx_keyidx; } - crypt = ieee->crypt[key]; + crypt = ieee->crypt_info.crypt[key]; erq->flags = key + 1; @@ -513,6 +513,7 @@ int rtllib_wx_get_encode(struct rtllib_device *ieee, return 0; } +EXPORT_SYMBOL(rtllib_wx_get_encode); int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, struct iw_request_info *info, @@ -525,29 +526,29 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, int i, idx; int group_key = 0; const char *alg, *module; - struct rtllib_crypto_ops *ops; - struct rtllib_crypt_data **crypt; + struct lib80211_crypto_ops *ops; + struct lib80211_crypt_data **crypt; struct rtllib_security sec = { .flags = 0, }; idx = encoding->flags & IW_ENCODE_INDEX; if (idx) { - if (idx < 1 || idx > WEP_KEYS) + if (idx < 1 || idx > NUM_WEP_KEYS) return -EINVAL; idx--; } else{ - idx = ieee->tx_keyidx; + idx = ieee->crypt_info.tx_keyidx; } if (ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) { - crypt = &ieee->crypt[idx]; + crypt = &ieee->crypt_info.crypt[idx]; group_key = 1; } else { /* some Cisco APs use idx>0 for unicast in dynamic WEP */ if (idx != 0 && ext->alg != IW_ENCODE_ALG_WEP) return -EINVAL; if (ieee->iw_mode == IW_MODE_INFRA) - crypt = &ieee->crypt[idx]; + crypt = &ieee->crypt_info.crypt[idx]; else return -EINVAL; } @@ -556,13 +557,13 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, if ((encoding->flags & IW_ENCODE_DISABLED) || ext->alg == IW_ENCODE_ALG_NONE) { if (*crypt) - rtllib_crypt_delayed_deinit(ieee, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); - for (i = 0; i < WEP_KEYS; i++) { - if (ieee->crypt[i] != NULL) + for (i = 0; i < NUM_WEP_KEYS; i++) { + if (ieee->crypt_info.crypt[i] != NULL) break; } - if (i == WEP_KEYS) { + if (i == NUM_WEP_KEYS) { sec.enabled = 0; sec.level = SEC_LEVEL_0; sec.flags |= SEC_LEVEL; @@ -573,15 +574,15 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, sec.enabled = 1; switch (ext->alg) { case IW_ENCODE_ALG_WEP: - alg = "WEP"; + alg = "R-WEP"; module = "rtllib_crypt_wep"; break; case IW_ENCODE_ALG_TKIP: - alg = "TKIP"; + alg = "R-TKIP"; module = "rtllib_crypt_tkip"; break; case IW_ENCODE_ALG_CCMP: - alg = "CCMP"; + alg = "R-CCMP"; module = "rtllib_crypt_ccmp"; break; default: @@ -592,14 +593,14 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, } printk(KERN_INFO "alg name:%s\n", alg); - ops = rtllib_get_crypto_ops(alg); + ops = lib80211_get_crypto_ops(alg); if (ops == NULL) { char tempbuf[100]; memset(tempbuf, 0x00, 100); sprintf(tempbuf, "%s", module); request_module("%s", tempbuf); - ops = rtllib_get_crypto_ops(alg); + ops = lib80211_get_crypto_ops(alg); } if (ops == NULL) { RTLLIB_DEBUG_WX("%s: unknown crypto alg %d\n", @@ -610,9 +611,9 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, } if (*crypt == NULL || (*crypt)->ops != ops) { - struct rtllib_crypt_data *new_crypt; + struct lib80211_crypt_data *new_crypt; - rtllib_crypt_delayed_deinit(ieee, crypt); + lib80211_crypt_delayed_deinit(&ieee->crypt_info, crypt); new_crypt = kzalloc(sizeof(*new_crypt), GFP_KERNEL); if (new_crypt == NULL) { @@ -641,7 +642,7 @@ int rtllib_wx_set_encode_ext(struct rtllib_device *ieee, goto done; } if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { - ieee->tx_keyidx = idx; + ieee->crypt_info.tx_keyidx = idx; sec.active_key = idx; sec.flags |= SEC_ACTIVE_KEY; } @@ -674,6 +675,7 @@ done: } return ret; } +EXPORT_SYMBOL(rtllib_wx_set_encode_ext); int rtllib_wx_get_encode_ext(struct rtllib_device *ieee, struct iw_request_info *info, @@ -681,7 +683,7 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee, { struct iw_point *encoding = &wrqu->encoding; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; - struct rtllib_crypt_data *crypt; + struct lib80211_crypt_data *crypt; int idx, max_key_len; max_key_len = encoding->length - sizeof(*ext); @@ -690,18 +692,18 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee, idx = encoding->flags & IW_ENCODE_INDEX; if (idx) { - if (idx < 1 || idx > WEP_KEYS) + if (idx < 1 || idx > NUM_WEP_KEYS) return -EINVAL; idx--; } else { - idx = ieee->tx_keyidx; + idx = ieee->crypt_info.tx_keyidx; } if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) && (ext->alg != IW_ENCODE_ALG_WEP)) if (idx != 0 || (ieee->iw_mode != IW_MODE_INFRA)) return -EINVAL; - crypt = ieee->crypt[idx]; + crypt = ieee->crypt_info.crypt[idx]; encoding->flags = idx + 1; memset(ext, 0, sizeof(*ext)); @@ -711,11 +713,11 @@ int rtllib_wx_get_encode_ext(struct rtllib_device *ieee, ext->key_len = 0; encoding->flags |= IW_ENCODE_DISABLED; } else { - if (strcmp(crypt->ops->name, "WEP") == 0) + if (strcmp(crypt->ops->name, "R-WEP") == 0) ext->alg = IW_ENCODE_ALG_WEP; - else if (strcmp(crypt->ops->name, "TKIP")) + else if (strcmp(crypt->ops->name, "R-TKIP")) ext->alg = IW_ENCODE_ALG_TKIP; - else if (strcmp(crypt->ops->name, "CCMP")) + else if (strcmp(crypt->ops->name, "R-CCMP")) ext->alg = IW_ENCODE_ALG_CCMP; else return -EINVAL; @@ -778,6 +780,7 @@ int rtllib_wx_set_mlme(struct rtllib_device *ieee, return 0; } +EXPORT_SYMBOL(rtllib_wx_set_mlme); int rtllib_wx_set_auth(struct rtllib_device *ieee, struct iw_request_info *info, @@ -830,6 +833,7 @@ int rtllib_wx_set_auth(struct rtllib_device *ieee, } return 0; } +EXPORT_SYMBOL(rtllib_wx_set_auth); int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len) { @@ -846,10 +850,9 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len) ieee->wps_ie_len = (len < MAX_WZC_IE_LEN) ? (len) : (MAX_WZC_IE_LEN); - buf = kmalloc(ieee->wps_ie_len, GFP_KERNEL); + buf = kmemdup(ie, ieee->wps_ie_len, GFP_KERNEL); if (buf == NULL) return -ENOMEM; - memcpy(buf, ie, ieee->wps_ie_len); ieee->wps_ie = buf; return 0; } @@ -860,10 +863,9 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len) if (len) { if (len != ie[1]+2) return -EINVAL; - buf = kmalloc(len, GFP_KERNEL); + buf = kmemdup(ie, len, GFP_KERNEL); if (buf == NULL) return -ENOMEM; - memcpy(buf, ie, len); kfree(ieee->wpa_ie); ieee->wpa_ie = buf; ieee->wpa_ie_len = len; @@ -874,3 +876,4 @@ int rtllib_wx_set_gen_ie(struct rtllib_device *ieee, u8 *ie, size_t len) } return 0; } +EXPORT_SYMBOL(rtllib_wx_set_gen_ie); |