Commit cb762154 authored by Mike McCormack's avatar Mike McCormack Committed by Larry Finger

rtl8192e: Remove extra ifdefs

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarMike McCormack <mikem@ring3k.org>
parent 1ec3e2f2
......@@ -19,12 +19,8 @@
#include <linux/highmem.h>
#include <linux/init.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12))
#include <asm/hardirq.h>
#else
#include <linux/hardirq.h>
#include <linux/sched.h>
#endif
#include <asm/kmap_types.h>
#ifdef BUILT_IN_CRYPTO
......@@ -37,23 +33,6 @@
#endif
#endif /* BUILT_IN_CRYPTO */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,20))
#define list_for_each_entry(pos, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
prefetch(pos->member.next); \
&pos->member != (head); \
pos = list_entry(pos->member.next, typeof(*pos), member), \
prefetch(pos->member.next))
static inline void cond_resched(void)
{
if (need_resched()) {
set_current_state(TASK_RUNNING);
schedule();
}
}
#endif
extern enum km_type crypto_km_types[];
static inline enum km_type crypto_kmap_type(int out)
......
......@@ -114,57 +114,37 @@ cmpk_count_txstatistic(
pAdapter->HalFunc.GetHwRegHandler(pAdapter, HW_VAR_RF_STATE, (pu1Byte)(&rtState));
if (rtState == eRfOff)
{
return;
}
#endif
#ifdef TODO
if (pAdapter->bInHctTest)
return;
#endif
if (pstx_fb->tok)
{
if (pstx_fb->tok) {
priv->stats.txfeedbackok++;
priv->stats.txoktotal++;
priv->stats.txokbytestotal += pstx_fb->pkt_length;
priv->stats.txokinperiod++;
if (pstx_fb->pkt_type == PACKET_MULTICAST)
{
if (pstx_fb->pkt_type == PACKET_MULTICAST) {
priv->stats.txmulticast++;
priv->stats.txbytesmulticast += pstx_fb->pkt_length;
}
else if (pstx_fb->pkt_type == PACKET_BROADCAST)
{
} else if (pstx_fb->pkt_type == PACKET_BROADCAST) {
priv->stats.txbroadcast++;
priv->stats.txbytesbroadcast += pstx_fb->pkt_length;
}
else
{
} else {
priv->stats.txunicast++;
priv->stats.txbytesunicast += pstx_fb->pkt_length;
}
}
else
{
} else {
priv->stats.txfeedbackfail++;
priv->stats.txerrtotal++;
priv->stats.txerrbytestotal += pstx_fb->pkt_length;
if (pstx_fb->pkt_type == PACKET_MULTICAST)
{
priv->stats.txerrmulticast++;
}
else if (pstx_fb->pkt_type == PACKET_BROADCAST)
{
priv->stats.txerrbroadcast++;
}
else
{
priv->stats.txerrunicast++;
}
}
priv->stats.txretrycount += pstx_fb->retry_cnt;
priv->stats.txfeedbackretry += pstx_fb->retry_cnt;
......
......@@ -17,19 +17,11 @@
* wlanfae <wlanfae@realtek.com>
******************************************************************************/
#if (defined(RTL8192E) || defined(RTL8190P))
#include "rtl_core.h"
#include "r8192E_hw.h"
#ifdef RTL8190P
#include "r8190P_hwimg.h"
#elif defined RTL8192E
#include "r8192E_hwimg.h"
#endif
#include "r8192E_firmware.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#include <linux/firmware.h>
#endif
extern void firmware_init_param(struct net_device *dev)
{
......@@ -308,17 +300,12 @@ bool init_firmware(struct net_device *dev)
RT_TRACE(COMP_FIRMWARE, "PlatformInitFirmware: undefined firmware state\n");
}
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) && defined(USE_FW_SOURCE_IMG_FILE)
priv->firmware_source = FW_SOURCE_IMG_FILE;
#else
priv->firmware_source = FW_SOURCE_HEADER_FILE;
#endif
for (init_step = starting_state; init_step <= FW_INIT_STEP2_DATA; init_step++) {
if (rst_opt == OPT_SYSTEM_RESET) {
switch (priv->firmware_source) {
case FW_SOURCE_IMG_FILE:
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) && defined(USE_FW_SOURCE_IMG_FILE)
if (pfirmware->firmware_buf_size[init_step] == 0) {
const char *fw_name[3] = { "RTL8192E/boot.img",
"RTL8192E/main.img",
......@@ -352,7 +339,6 @@ bool init_firmware(struct net_device *dev)
}
mapped_file = pfirmware->firmware_buf[init_step];
file_length = pfirmware->firmware_buf_size[init_step];
#endif
break;
}
case FW_SOURCE_HEADER_FILE:
......@@ -393,4 +379,3 @@ bool init_firmware(struct net_device *dev)
return rt_status;
}
#endif
......@@ -815,83 +815,7 @@ void rtl8192_phy_setTxPower(struct net_device* dev, u8 channel)
(bXBTxAGC|bXCTxAGC|bXDTxAGC), u4RegValue);
}
}
#ifdef TODO
if ( pMgntInfo->OpMode == RT_OP_MODE_INFRASTRUCTURE &&
pMgntInfo->bWithCcxCellPwr &&
channel == pMgntInfo->dot11CurrentChannelNumber)
{
u8 CckCellPwrIdx = DbmToTxPwrIdx(dev, WIRELESS_MODE_B, pMgntInfo->CcxCellPwr);
u8 LegacyOfdmCellPwrIdx = DbmToTxPwrIdx(dev, WIRELESS_MODE_G, pMgntInfo->CcxCellPwr);
u8 OfdmCellPwrIdx = DbmToTxPwrIdx(dev, WIRELESS_MODE_N_24G, pMgntInfo->CcxCellPwr);
RT_TRACE(COMP_TXAGC, DBG_LOUD,
("CCX Cell Limit: %d dbm => CCK Tx power index : %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n",
pMgntInfo->CcxCellPwr, CckCellPwrIdx, LegacyOfdmCellPwrIdx, OfdmCellPwrIdx));
RT_TRACE(COMP_TXAGC, DBG_LOUD,
("EEPROM channel(%d) => CCK Tx power index: %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n",
channel, powerlevel, powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff, powerlevelOFDM24G));
if (powerlevel > CckCellPwrIdx)
powerlevel = CckCellPwrIdx;
if (powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff > OfdmCellPwrIdx)
{
if ((OfdmCellPwrIdx - pHalData->LegacyHTTxPowerDiff) > 0)
{
powerlevelOFDM24G = OfdmCellPwrIdx - pHalData->LegacyHTTxPowerDiff;
}
else
{
LegacyOfdmCellPwrIdx = 0;
}
}
RT_TRACE(COMP_TXAGC, DBG_LOUD,
("Altered CCK Tx power index : %d, Legacy OFDM Tx power index: %d, OFDM Tx power index: %d\n",
powerlevel, powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff, powerlevelOFDM24G));
}
pHalData->CurrentCckTxPwrIdx = powerlevel;
pHalData->CurrentOfdm24GTxPwrIdx = powerlevelOFDM24G;
RtActChannelList(Adapter, RT_CHNL_LIST_ACTION_GET_CHANNEL, &channel, &pChannelInfo);
if (pChannelInfo)
{
if (pChannelInfo->MaxTxPwrDbm != UNSPECIFIED_PWR_DBM)
{
u1Byte CckMaxPwrIdx = DbmToTxPwrIdx(Adapter, WIRELESS_MODE_B, pChannelInfo->MaxTxPwrDbm);
u1Byte LegacyOfdmMaxPwrIdx = DbmToTxPwrIdx(Adapter, WIRELESS_MODE_G, pChannelInfo->MaxTxPwrDbm);
u1Byte OfdmMaxPwrIdx = DbmToTxPwrIdx(Adapter, WIRELESS_MODE_N_24G, pChannelInfo->MaxTxPwrDbm);
RT_TRACE(COMP_TXAGC, DBG_LOUD,
("CCX Cell Limit: %ld dbm => CCK Tx power index : %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n",
pChannelInfo->MaxTxPwrDbm, CckMaxPwrIdx, LegacyOfdmMaxPwrIdx, OfdmMaxPwrIdx));
RT_TRACE(COMP_TXAGC, DBG_LOUD,
("EEPROM channel(%d) => CCK Tx power index: %d, Legacy OFDM Tx power index : %d, OFDM Tx power index: %d\n",
channel, powerlevel, powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff, powerlevelOFDM24G));
if (powerlevel > CckMaxPwrIdx)
powerlevel = CckMaxPwrIdx;
if (powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff > OfdmMaxPwrIdx)
{
if ((OfdmMaxPwrIdx - pHalData->LegacyHTTxPowerDiff) > 0)
{
powerlevelOFDM24G = OfdmMaxPwrIdx - pHalData->LegacyHTTxPowerDiff;
}
else
{
LegacyOfdmMaxPwrIdx = 0;
}
}
RT_TRACE(COMP_TXAGC, DBG_LOUD,
("Altered CCK Tx power index : %d, Legacy OFDM Tx power index: %d, OFDM Tx power index: %d\n",
powerlevel, powerlevelOFDM24G + pHalData->LegacyHTTxPowerDiff, powerlevelOFDM24G));
}
}
#endif
switch (priv->rf_chip)
{
switch (priv->rf_chip) {
case RF_8225:
break;
case RF_8256:
......
......@@ -958,14 +958,6 @@ void HTConstructRT2RTAggElement(struct rtllib_device* ieee, u8* posRT2RTAgg, u8*
*len = 6 + 2;
return;
#ifdef TODO
posRT2RTAgg->Length = 6;
#endif
}
u8 HT_PickMCSRate(struct rtllib_device* ieee, u8* pOperateMCS)
......@@ -1410,8 +1402,7 @@ void HTUseDefaultSetting(struct rtllib_device* ieee)
{
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
if (pHTInfo->bEnableHT)
{
if (pHTInfo->bEnableHT) {
pHTInfo->bCurrentHTSupport = true;
pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK;
......@@ -1434,27 +1425,15 @@ void HTUseDefaultSetting(struct rtllib_device* ieee)
HTFilterMCSRate(ieee, ieee->Regdot11TxHTOperationalRateSet, ieee->dot11HTOperationalRateSet);
#ifdef TODO
Adapter->HalFunc.InitHalRATRTableHandler( Adapter, &pMgntInfo->dot11OperationalRateSet, pMgntInfo->dot11HTOperationalRateSet);
#endif
ieee->HTHighestOperaRate = HTGetHighestMCSRate(ieee, ieee->dot11HTOperationalRateSet, MCS_FILTER_ALL);
ieee->HTCurrentOperaRate = ieee->HTHighestOperaRate;
#if (defined RTL8192SE || defined RTL8192SU || defined RTL8192CE)
if (ieee->SetHwRegHandler != NULL) {
ieee->SetHwRegHandler( ieee->dev, HW_VAR_SHORTGI_DENSITY, (u8*)(&ieee->MaxMssDensity));
ieee->SetHwRegHandler(ieee->dev, HW_VAR_AMPDU_FACTOR, &pHTInfo->CurrentAMPDUFactor);
ieee->SetHwRegHandler(ieee->dev, HW_VAR_AMPDU_MIN_SPACE, &pHTInfo->CurrentMPDUDensity);
}
#endif
}
else
{
} else {
pHTInfo->bCurrentHTSupport = false;
}
return;
}
u8 HTCCheck(struct rtllib_device* ieee, u8* pFrame)
{
if (ieee->pHTInfo->bCurrentHTSupport)
......
......@@ -54,14 +54,6 @@
#define BIT30 0x40000000
#define BIT31 0x80000000
#ifndef RTK_DMP_PLATFORM
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
#ifndef bool
typedef enum{false = 0, true} bool;
#endif
#endif
#endif
typedef union _QOS_TSINFO{
u8 charData[3];
struct {
......
......@@ -20,13 +20,7 @@
#include <linux/etherdevice.h>
#include "rtl819x_TS.h"
extern void _setup_timer( struct timer_list*, void*, unsigned long);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
#define list_for_each_entry_safe(pos, n, head, member) \
for (pos = list_entry((head)->next, typeof(*pos), member), \
n = list_entry(pos->member.next, typeof(*pos), member); \
&pos->member != (head); \
pos = n, n = list_entry(n->member.next, typeof(*n), member))
#endif
void TsSetupTimeOut(unsigned long data)
{
}
......
......@@ -170,9 +170,7 @@ void setKey(struct net_device *dev,
if (KeyContent != NULL) {
write_nic_dword(dev, WCAMI, (u32)(*(KeyContent+i-2)) );
write_nic_dword(dev, RWCAM, TargetCommand);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31))
udelay(100);
#endif
}
}
}
......
This diff is collapsed.
......@@ -46,9 +46,6 @@
#include <linux/random.h>
#include <linux/version.h>
#include <asm/io.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27))
#include <asm/semaphore.h>
#endif
#include "rtllib.h"
#ifdef ENABLE_DOT11D
......@@ -95,31 +92,8 @@
.driver_data = (kernel_ulong_t)&(cfg)
typedef irqreturn_t irqreturn_type;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
#if !defined(PCI_CAP_ID_EXP)
#define PCI_CAP_ID_EXP 0x10
#endif
#if !defined(PCI_EXP_LNKCTL)
#define PCI_EXP_LNKCTL 0x10
#endif
typedef int __bitwise pci_power_t;
#define PCI_D0 ((pci_power_t __force) 0)
#define PCI_D1 ((pci_power_t __force) 1)
#define PCI_D2 ((pci_power_t __force) 2)
#define PCI_D3hot ((pci_power_t __force) 3)
#define PCI_D3cold ((pci_power_t __force) 4)
#define PCI_UNKNOWN ((pci_power_t __force) 5)
#define PCI_POWER_ERROR ((pci_power_t __force) -1)
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
#define rtl8192_interrupt(x,y,z) rtl8192_interrupt_rsl(x,y,z)
#else
#define rtl8192_interrupt(x,y,z) rtl8192_interrupt_rsl(x,y)
#endif
#define rtl8192_interrupt(x,y,z) rtl8192_interrupt_rsl(x,y)
#define RTL_MAX_SCAN_SIZE 128
......@@ -592,10 +566,6 @@ typedef struct r8192_priv
struct pci_dev *pdev;
struct pci_dev *bridge_pdev;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
u32 pci_state;
#endif
bool bfirst_init;
bool bfirst_after_down;
bool initialized_at_probe;
......@@ -684,11 +654,7 @@ typedef struct r8192_priv
struct semaphore wx_sem;
struct semaphore rf_sem;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16))
struct semaphore mutex;
#else
struct mutex mutex;
#endif
struct Stats stats;
struct iw_statistics wstats;
......
......@@ -243,12 +243,7 @@ int rtl_debug_module_init(struct r8192_priv *priv, const char *name)
if (!rtl_debugfs_root)
return -ENOENT;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
debug = kzalloc(sizeof(rtl_fs_debug), GFP_KERNEL);
#else
rtl_fs_debug = kmalloc(sizeof(*rtl_fs_debug), GFP_KERNEL);
memset(rtl_fs_debug,0,sizeof(*rtl_fs_debug));
#endif
if (!debug) {
ret = -ENOMEM;
goto err;
......@@ -1086,21 +1081,13 @@ static int proc_get_stats_rx(char *page, char **start,
void rtl8192_proc_module_init(void)
{
RT_TRACE(COMP_INIT, "Initializing proc filesystem");
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
rtl8192_proc=create_proc_entry(DRV_NAME, S_IFDIR, proc_net);
#else
rtl8192_proc=create_proc_entry(DRV_NAME, S_IFDIR, init_net.proc_net);
#endif
}
void rtl8192_proc_module_remove(void)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
remove_proc_entry(DRV_NAME, proc_net);
#else
remove_proc_entry(DRV_NAME, init_net.proc_net);
#endif
}
......
......@@ -27,9 +27,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/version.h>
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,9))
#include <linux/debugfs.h>
#endif
struct r8192_priv;
struct _tx_desc_8192se;
......@@ -272,11 +270,7 @@ typedef struct _rtl_fs_debug
struct dentry *debug_register;
u32 hw_type;
u32 hw_offset;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
bool hw_holding;
#else
u8 hw_holding;
#endif
} rtl_fs_debug;
void print_buffer(u32 *buffer, int len);
......
This diff is collapsed.
......@@ -29,7 +29,6 @@
#include "rtl_core.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
static void rtl819x_ethtool_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
......@@ -37,10 +36,6 @@ static void rtl819x_ethtool_get_drvinfo(struct net_device *dev,
strcpy(info->driver, DRV_NAME);
strcpy(info->version, DRV_VERSION);
#if defined RTL8192SE
snprintf(info->fw_version, sizeof(info->fw_version), "%d",
priv->pFirmware->FirmwareVersion);
#endif
strcpy(info->bus_info, pci_name(priv->pdev));
}
......@@ -56,4 +51,3 @@ const struct ethtool_ops rtl819x_ethtool_ops = {
.get_drvinfo = rtl819x_ethtool_get_drvinfo,
.get_link = rtl819x_ethtool_get_link,
};
#endif
This diff is collapsed.
......@@ -34,9 +34,7 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
{
struct net_device *dev = pci_get_drvdata(pdev);
struct r8192_priv *priv = rtllib_priv(dev);
#if !(defined RTL8192SE || defined RTL8192CE)
u32 ulRegRead;
#endif
RT_TRACE(COMP_POWER, "============> r8192E suspend call.\n");
printk("============> r8192E suspend call.\n");
......@@ -59,7 +57,6 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
#endif
netif_device_detach(dev);
#if !(defined RTL8192SE || defined RTL8192CE)
if (!priv->rtllib->bSupportRemoteWakeUp) {
MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT,true);
ulRegRead = read_nic_dword(dev, CPU_GEN);
......@@ -69,18 +66,9 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
write_nic_dword(dev, WFCRC0, 0xffffffff);
write_nic_dword(dev, WFCRC1, 0xffffffff);
write_nic_dword(dev, WFCRC2, 0xffffffff);
#ifdef RTL8190P
{
u8 ucRegRead;
ucRegRead = read_nic_byte(dev, GPO);
ucRegRead |= BIT0;
write_nic_byte(dev, GPO, ucRegRead);
}
#endif
write_nic_byte(dev, PMR, 0x5);
write_nic_byte(dev, MacBlkCtrl, 0xa);
}
#endif
out_pci_suspend:
RT_TRACE(COMP_POWER, "r8192E support WOL call??????????????????????\n");
printk("r8192E support WOL call??????????????????????\n");
......@@ -101,9 +89,7 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
int rtl8192E_resume (struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
#if defined ENABLE_GPIO_RADIO_CTL || !(defined RTL8192SE || defined RTL8192CE)
struct r8192_priv *priv = rtllib_priv(dev);
#endif
int err;
u32 val;
......@@ -146,11 +132,9 @@ int rtl8192E_resume (struct pci_dev *pdev)
dev->open(dev);
#endif
#if !(defined RTL8192SE || defined RTL8192CE)
if (!priv->rtllib->bSupportRemoteWakeUp) {
MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT,true);
}
#endif
out:
RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
......
......@@ -25,10 +25,6 @@
#include <linux/types.h>
#include <linux/pci.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
#define pm_message_t u32
#endif
int rtl8192E_save_state (struct pci_dev *dev, pm_message_t state);
int rtl8192E_suspend (struct pci_dev *dev, pm_message_t state);
int rtl8192E_resume (struct pci_dev *dev);
......
......@@ -156,13 +156,6 @@ void InactivePsWorkItemCallback(struct net_device *dev)
RT_DISABLE_ASPM(dev);
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
}
#ifdef TODO
else if ((pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3) && RT_IN_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3))
{
RT_LEAVE_D3(dev, false);
RT_CLEAR_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
}
#endif
}
#endif
MgntActSet_RF_State(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS,false);
......@@ -175,13 +168,6 @@ void InactivePsWorkItemCallback(struct net_device *dev)
RT_ENABLE_ASPM(dev);
RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_ASPM);
}
#ifdef TODO
else if (pPSC->RegRfPsLevel & RT_RF_OFF_LEVL_PCI_D3)
{
RT_ENTER_D3(dev, false);
RT_SET_PS_LEVEL(pPSC, RT_RF_OFF_LEVL_PCI_D3);
}
#endif
}
#endif
......@@ -466,18 +452,6 @@ bool PlatformSwitchClkReq(struct net_device *dev, u8 value)
pci_write_config_byte(priv->pdev,0x81,value);
bResult = true;
#ifdef TODO
if (Buffer) {
priv->ClkReqState = true;
} else {
priv->ClkReqState = false;
}
#endif
#ifdef RTL8192SE
udelay(100);
#endif
return bResult;
}
......@@ -542,15 +516,6 @@ void PlatformEnableASPM(struct net_device *dev)
return;
}
#ifdef RTL8192SE
if (priv->NdisAdapter.PciBridgeVendor != PCI_BRIDGE_VENDOR_INTEL )
{
RT_TRACE(COMP_POWER, "%s(): Dont modify ASPM for non intel chipset. For Bridge Vendor %d.\n"
,__func__,priv->NdisAdapter.PciBridgeVendor);
return;
}
#endif
ASPMLevel |= priv->RegDevicePciASPMSetting;
uDeviceASPMSetting = priv->NdisAdapter.LinkCtrlReg;
......@@ -586,34 +551,6 @@ bool PlatformSetPMCSR(struct net_device *dev,u8 value,bool bTempSetting)
Buffer= value;
spin_lock_irqsave(&priv->D3_lock,flag);
#ifdef TODO
if (bTempSetting)
{
if (Buffer==0x00)
{
priv->LeaveD3Cnt++;
{
bActuallySet =true;
}
}
else
{
priv->LeaveD3Cnt--;
if (priv->LeaveD3Cnt == 0)
{
bActuallySet=true;
}
}
}
else
{
priv->LeaveD3Cnt=0;
bActuallySet=true;
bSetFunc=true;
}
#endif
if (bActuallySet) {
if (Buffer) {
PlatformSwitchClkReq(dev, 0x01);
......
......@@ -28,12 +28,7 @@
#include <linux/version.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#include <linux/jiffies.h>
#else
#include <linux/jffs.h>
#include <linux/tqueue.h>
#endif
#include <linux/timer.h>
#include <linux/sched.h>
......@@ -73,27 +68,6 @@
#define IW_CUSTOM_MAX 256 /* In bytes */
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#define jiffies_to_msecs(t) ((t) * 1000 / HZ)
#ifndef __bitwise
#define __bitwise __attribute__((bitwise))
#endif
typedef __u16 __le16;
#if (WIRELESS_EXT < 16)
struct iw_spy_data{
/* --- Standard spy support --- */
int spy_number;
u_char spy_address[IW_MAX_SPY][ETH_ALEN];
struct iw_quality spy_stat[IW_MAX_SPY];
/* --- Enhanced spy support (event) */
struct iw_quality spy_thr_low; /* Low threshold */
struct iw_quality spy_thr_high; /* High threshold */
u_char spy_thr_under[IW_MAX_SPY];
};
#endif
#endif
#ifndef container_of
/**
* container_of - cast a member of a structure out to the containing structure
......@@ -108,115 +82,32 @@ struct iw_spy_data{
(type *)( (char *)__mptr - offsetof(type,member) );})
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18))
#define skb_tail_pointer_rsl(skb) skb_tail_pointer(skb)
#else
#define skb_tail_pointer_rsl(skb) skb->tail
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x)
#else
#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL_NOVERS(x)
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
static inline void tq_init(struct tq_struct * task, void(*func)(void *), void *data)
{
task->routine = func;
task->data = data;
INIT_LIST_HEAD(&task->list);
task->sync = 0;
}
#endif
#define EXPORT_SYMBOL_RSL(x) EXPORT_SYMBOL(x)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
static inline void setup_timer(struct timer_list * timer, void(*function)(unsigned long), unsigned long data)
{
timer->function = function;
timer->data = data;
}
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
typedef struct delayed_work delayed_work_struct_rsl;
#define queue_delayed_work_rsl(x,y,z) queue_delayed_work(x,y,z)
#define INIT_DELAYED_WORK_RSL(x,y,z) INIT_DELAYED_WORK(x,y)
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
typedef struct tq_struct delayed_work_struct_rsl;
#define queue_delayed_work_rsl(x,y,z) schedule_task(y)
#define INIT_DELAYED_WORK_RSL(x,y,z) tq_init(x,y,z)
#else
typedef struct work_struct delayed_work_struct_rsl;
#define queue_delayed_work_rsl(x,y,z) queue_delayed_work(x,y,z)
#define INIT_DELAYED_WORK_RSL(x,y,z) INIT_WORK(x,y,z)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
typedef struct work_struct work_struct_rsl;
#define queue_work_rsl(x,y) queue_work(x,y)
#define INIT_WORK_RSL(x,y,z) INIT_WORK(x,y)
#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
typedef struct tq_struct work_struct_rsl;
#define queue_work_rsl(x,y) schedule_task(y)
#define INIT_WORK_RSL(x,y,z) tq_init(x,y,z)
#else
typedef struct work_struct work_struct_rsl;
#define queue_work_rsl(x,y) queue_work(x,y)
#define INIT_WORK_RSL(x,y,z) INIT_WORK(x,y,z)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
#define container_of_work_rsl(x,y,z) container_of(x,y,z)
#define container_of_dwork_rsl(x,y,z) container_of(container_of(x, struct delayed_work, work), y, z)
#else
#define container_of_work_rsl(x,y,z) (x)
#define container_of_dwork_rsl(x,y,z) (x)
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,4,20)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
static inline char *
iwe_stream_add_event_rsl(struct iw_request_info *info,
char * stream, /* Stream of events */
char * ends, /* End of stream */
struct iw_event *iwe, /* Payload */
int event_len) /* Real size of payload */
{
/* Check if it's possible */
if ((stream + event_len) < ends) {
iwe->len = event_len;
ndelay(1);
memcpy(stream, (char *) iwe, event_len);
stream += event_len;
}
return stream;
}
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
#define iwe_stream_add_event_rsl(info,start,stop,iwe,len) iwe_stream_add_event(info,start,stop,iwe,len)
#else
#define iwe_stream_add_event_rsl(info,start,stop,iwe,len) iwe_stream_add_event(start,stop,iwe,len)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)
#define iwe_stream_add_point_rsl(info,start,stop,iwe,p) iwe_stream_add_point(info,start,stop,iwe,p)
#else
#define iwe_stream_add_point_rsl(info,start,stop,iwe,p) iwe_stream_add_point(start,stop,iwe,p)
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#define usb_alloc_urb_rsl(x,y) usb_alloc_urb(x,y)
#define usb_submit_urb_rsl(x,y) usb_submit_urb(x,y)
#else
#define usb_alloc_urb_rsl(x,y) usb_alloc_urb(x)
#define usb_submit_urb_rsl(x,y) usb_submit_urb(x)
#endif
static inline void *netdev_priv_rsl(struct net_device *dev)
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
return netdev_priv(dev);
#else
return dev->priv;
#endif
}
#define KEY_TYPE_NA 0x0
......@@ -645,34 +536,8 @@ typedef struct ieee_param {
#define IW_QUAL_NOISE_UPDATED 0x4
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9))
#define MSECS(t) (HZ * ((t) / 1000) + (HZ * ((t) % 1000)) / 1000)
static inline unsigned long msleep_interruptible_rsl(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
while (timeout) {
set_current_state(TASK_INTERRUPTIBLE);
timeout = schedule_timeout(timeout);
}
return timeout;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
static inline void msleep(unsigned int msecs)
{
unsigned long timeout = MSECS(msecs) + 1;
while (timeout) {
set_current_state(TASK_UNINTERRUPTIBLE);
timeout = schedule_timeout(timeout);
}
}
#endif
#else
#define MSECS(t) msecs_to_jiffies(t)
#define msleep_interruptible_rsl msleep_interruptible
#endif
#define RTLLIB_DATA_LEN 2304
/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
......@@ -1572,11 +1437,7 @@ typedef union _frameqos {
* main rates information element... */
#define MAX_RATES_LENGTH ((u8)12)
#define MAX_RATES_EX_LENGTH ((u8)16)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#define MAX_NETWORK_COUNT 16
#else
#define MAX_NETWORK_COUNT 96
#endif
#define MAX_CHANNEL_NUMBER 161
#define RTLLIB_SOFTMAC_SCAN_TIME 100
......@@ -1980,21 +1841,6 @@ enum rtllib_state {
#define RTLLIB_52GHZ_MAX_CHANNEL 165
#define RTLLIB_52GHZ_CHANNELS (RTLLIB_52GHZ_MAX_CHANNEL - \
RTLLIB_52GHZ_MIN_CHANNEL + 1)
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11))
extern inline int is_multicast_ether_addr(const u8 *addr)
{
return ((addr[0] != 0xff) && (0x01 & addr[0]));
}
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13))
extern inline int is_broadcast_ether_addr(const u8 *addr)
{
return ((addr[0] == 0xff) && (addr[1] == 0xff) && (addr[2] == 0xff) && \
(addr[3] == 0xff) && (addr[4] == 0xff) && (addr[5] == 0xff));
}
#endif
#ifndef eqMacAddr
#define eqMacAddr(a,b) ( ((a)[0]==(b)[0] && (a)[1]==(b)[1] && (a)[2]==(b)[2] && (a)[3]==(b)[3] && (a)[4]==(b)[4] && (a)[5]==(b)[5]) ? 1:0 )
#endif
......@@ -3080,17 +2926,6 @@ static inline int rtllib_is_cck_rate(u8 rate)
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10))
static inline unsigned compare_ether_addr(const u8 *addr1, const u8 *addr2)
{
const u16 *a = (const u16 *) addr1;
const u16 *b = (const u16 *) addr2;
BUILD_BUG_ON(ETH_ALEN != 6);
return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2])) != 0;
}
#endif
/* rtllib.c */
extern void free_rtllib(struct net_device *dev);
extern struct net_device *alloc_rtllib(int sizeof_priv);
......
......@@ -82,12 +82,4 @@ 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);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,31))
#define crypto_alloc_tfm crypto_alloc_tfm_rsl
#define crypto_free_tfm crypto_free_tfm_rsl
#endif
#endif
......@@ -22,17 +22,9 @@
#include <linux/wireless.h>
#include "rtllib.h"
#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "rtl_crypto.h"
#else
#include <linux/crypto.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <asm/scatterlist.h>
#else
#include <linux/scatterlist.h>
#endif
#include <linux/scatterlist.h>
#define AES_BLOCK_LEN 16
#define CCMP_HDR_LEN 8
......@@ -64,27 +56,7 @@ struct rtllib_ccmp_data {
void rtllib_ccmp_aes_encrypt(struct crypto_tfm *tfm,
const u8 pt[16], u8 ct[16])
{
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
struct scatterlist src, dst;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
src.page = virt_to_page(pt);
src.offset = offset_in_page(pt);
src.length = AES_BLOCK_LEN;
dst.page = virt_to_page(ct);
dst.offset = offset_in_page(ct);
dst.length = AES_BLOCK_LEN;
#else
sg_init_one(&src, pt, AES_BLOCK_LEN);
sg_init_one(&dst, ct, AES_BLOCK_LEN);
#endif
crypto_cipher_encrypt(tfm, &dst, &src, AES_BLOCK_LEN);
#else
crypto_cipher_encrypt_one((void*)tfm, ct, pt);
#endif
}
static void * rtllib_ccmp_init(int key_idx)
......@@ -97,14 +69,6 @@ static void * rtllib_ccmp_init(int key_idx)
memset(priv, 0, sizeof(*priv));
priv->key_idx = key_idx;
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
priv->tfm = crypto_alloc_tfm("aes", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "rtllib_crypt_ccmp: could not allocate "
"crypto API aes\n");
goto fail;
}
#else
priv->tfm = (void*)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tfm)) {
printk(KERN_DEBUG "rtllib_crypt_ccmp: could not allocate "
......@@ -112,17 +76,12 @@ static void * rtllib_ccmp_init(int key_idx)
priv->tfm = NULL;
goto fail;
}
#endif
return priv;
fail:
if (priv) {
if (priv->tfm)
#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
crypto_free_tfm(priv->tfm);
#else
crypto_free_cipher((void*)priv->tfm);
#endif
kfree(priv);
}
......@@ -134,11 +93,7 @@ static void rtllib_ccmp_deinit(void *priv)
{
struct rtllib_ccmp_data *_priv = priv;
if (_priv && _priv->tfm)
#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
crypto_free_tfm(_priv->tfm);
#else
crypto_free_cipher((void*)_priv->tfm);
#endif
kfree(priv);
}
......
......@@ -18,44 +18,19 @@
#include <asm/string.h>
#include "rtllib.h"
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,20))
#endif
#if defined(BUILT_IN_CRYPTO) || (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "rtl_crypto.h"
#else
#include <linux/crypto.h>
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <asm/scatterlist.h>
#else
#include <linux/scatterlist.h>
#endif
#include <linux/scatterlist.h>
#include <linux/crc32.h>
/*
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include "rtl_crypto.h"
#else
#include <linux/crypto.h>
#endif
#include <asm/scatterlist.h>
#include <linux/crc32.h>
*/
struct prism2_wep_data {
u32 iv;
#define WEP_KEY_LEN 13
u8 key[WEP_KEY_LEN + 1];
u8 key_len;
u8 key_idx;
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
struct crypto_tfm *tfm;
#else
struct crypto_blkcipher *tx_tfm;
struct crypto_blkcipher *rx_tfm;
#endif
};
......@@ -69,14 +44,6 @@ static void * prism2_wep_init(int keyidx)
memset(priv, 0, sizeof(*priv));
priv->key_idx = keyidx;
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
priv->tfm = crypto_alloc_tfm("arc4", 0);
if (priv->tfm == NULL) {
printk(KERN_DEBUG "rtllib_crypt_wep: could not allocate "
"crypto API arc4\n");
goto fail;
}
#else
priv->tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0, CRYPTO_ALG_ASYNC);
if (IS_ERR(priv->tx_tfm)) {
printk(KERN_DEBUG "rtllib_crypt_wep: could not allocate "
......@@ -91,7 +58,6 @@ static void * prism2_wep_init(int keyidx)
priv->rx_tfm = NULL;
goto fail;
}
#endif
/* start WEP IV from a random value */
get_random_bytes(&priv->iv, 4);
......@@ -99,13 +65,6 @@ static void * prism2_wep_init(int keyidx)
return priv;
fail:
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
if (priv) {
if (priv->tfm)
crypto_free_tfm(priv->tfm);
kfree(priv);
}
#else
if (priv) {
if (priv->tx_tfm)
crypto_free_blkcipher(priv->tx_tfm);
......@@ -113,7 +72,6 @@ static void * prism2_wep_init(int keyidx)
crypto_free_blkcipher(priv->rx_tfm);
kfree(priv);
}
#endif
return NULL;
}
......@@ -121,17 +79,13 @@ static void * prism2_wep_init(int keyidx)
static void prism2_wep_deinit(void *priv)
{
struct prism2_wep_data *_priv = priv;
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
if (_priv && _priv->tfm)
crypto_free_tfm(_priv->tfm);
#else
if (_priv) {
if (_priv->tx_tfm)
crypto_free_blkcipher(_priv->tx_tfm);
if (_priv->rx_tfm)
crypto_free_blkcipher(_priv->rx_tfm);
}
#endif
kfree(priv);
}
......@@ -148,9 +102,7 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
u8 key[WEP_KEY_LEN + 3];
u8 *pos;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
#if ( !defined(BUILT_IN_CRYPTO) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) )
struct blkcipher_desc desc = {.tfm = wep->tx_tfm};
#endif
u32 crc;
u8 *icv;
struct scatterlist sg;
......@@ -186,36 +138,19 @@ static int prism2_wep_encrypt(struct sk_buff *skb, int hdr_len, void *priv)
/* Copy rest of the WEP key (the secret part) */
memcpy(key + 3, wep->key, wep->key_len);
if (!tcb_desc->bHwSec)
{
if (!tcb_desc->bHwSec) {
/* Append little-endian CRC32 and encrypt it to produce ICV */
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
crc = ~crc32_le(~0, pos, len);
#else
crc = ~ether_crc_le(len, pos);
#endif
icv = skb_put(skb, 4);
icv[0] = crc;
icv[1] = crc >> 8;
icv[2] = crc >> 16;
icv[3] = crc >> 24;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = len + 4;
#else
sg_init_one(&sg, pos, len+4);
#endif
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
crypto_cipher_setkey(wep->tfm, key, klen);
crypto_cipher_encrypt(wep->tfm, &sg, &sg, len + 4);
return 0;
#else
crypto_blkcipher_setkey(wep->tx_tfm, key, klen);
return crypto_blkcipher_encrypt(&desc, &sg, &sg, len + 4);
#endif
}
return 0;
......@@ -236,9 +171,7 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
u8 key[WEP_KEY_LEN + 3];
u8 keyidx, *pos;
cb_desc *tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE);
#if ( !defined(BUILT_IN_CRYPTO) && ((LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21)) || (OPENSUSE_SLED)) )
struct blkcipher_desc desc = {.tfm = wep->rx_tfm};
#endif
u32 crc;
u8 icv[4];
struct scatterlist sg;
......@@ -261,28 +194,12 @@ static int prism2_wep_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
/* Apply RC4 to data and compute CRC32 over decrypted data */
plen = skb->len - hdr_len - 8;
if (!tcb_desc->bHwSec)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
sg.page = virt_to_page(pos);
sg.offset = offset_in_page(pos);
sg.length = plen + 4;
#else
if (!tcb_desc->bHwSec) {
sg_init_one(&sg, pos, plen+4);
#endif
#if ( defined(BUILT_IN_CRYPTO) || ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && (!OPENSUSE_SLED)) )
crypto_cipher_setkey(wep->tfm, key, klen);
crypto_cipher_decrypt(wep->tfm, &sg, &sg, plen + 4);
#else
crypto_blkcipher_setkey(wep->rx_tfm, key, klen);
if (crypto_blkcipher_decrypt(&desc, &sg, &sg, plen + 4))
return -7;
#endif
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
crc = ~crc32_le(~0, pos, plen);
#else
crc = ~ether_crc_le(plen, pos);
#endif
icv[0] = crc;
icv[1] = crc >> 8;
icv[2] = crc >> 16;
......
......@@ -47,10 +47,6 @@
#include "dot11d.h"
#endif
#if defined(RTLLIB_RADIOTAP) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
#include <net/ieee80211_radiotap.h>
#endif
#if defined CONFIG_CFG_80211
#include <linux/crc32.h>
......@@ -321,140 +317,17 @@ void ieee80211_scan_rx(struct rtllib_device *ieee, struct sk_buff *skb, struct r
}
#endif
#if defined(RTLLIB_RADIOTAP) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
static int rtllib_rx_radiotap_len(struct rtllib_device *ieee, struct rtllib_rx_stats *rx_status)
{
int len;
/* always present fields */
len = sizeof(struct ieee80211_radiotap_header) +
8 + /* TSFT */
1 + /* FLAGS */
1 + /* RATE */
2 + /* CHANNEL IN MHZ */
2 + /* CHANNEL BITFIELD */
1 + /* HW SIGNAL DBM */
1 + /* HW NOISE DBM */
1; /* ANTENNA NUMBER */
if (len & 1) /* padding for RX_FLAGS if necessary */
len++;
/* make sure radiotap starts at a naturally aligned address */
if (len % 8)
len = roundup(len, 8);
return len;
}
static void rtllib_add_rx_radiotap_header(struct rtllib_device *ieee,
struct sk_buff *skb, int rtap_len, struct rtllib_rx_stats *rx_status)
{
struct ieee80211_radiotap_header *rthdr;
unsigned char *pos;
printk("add header!\n");
rthdr = (struct ieee80211_radiotap_header *)skb_push(skb, rtap_len);
memset(rthdr, 0, rtap_len);
rthdr->it_version = PKTHDR_RADIOTAP_VERSION;
rthdr->it_pad = 0;
rthdr->it_len = cpu_to_le16(rtap_len);
/* radiotap header, set always present flags */
rthdr->it_present = cpu_to_le32(
(1 << IEEE80211_RADIOTAP_TSFT) |
(1 << IEEE80211_RADIOTAP_FLAGS) |
(1 << IEEE80211_RADIOTAP_RATE) |
(1 << IEEE80211_RADIOTAP_CHANNEL) |
(1 << IEEE80211_RADIOTAP_DBM_ANTSIGNAL) |
(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) |
(1 << IEEE80211_RADIOTAP_ANTENNA));
pos = (unsigned char *)(rthdr+1);
/* the order of the following fields is important */
/* IEEE80211_RADIOTAP_TSFT */
*(__le64 *)pos = cpu_to_le64(rx_status->TimeStampLow);
pos += 8;
/* IEEE80211_RADIOTAP_FLAGS */
if (rx_status->bCRC)
*pos |= IEEE80211_RADIOTAP_F_BADFCS;
if (rx_status->bShortPreamble)
*pos |= IEEE80211_RADIOTAP_F_SHORTPRE;
pos++;
/* IEEE80211_RADIOTAP_RATE */
*pos = rx_status->rate / 5;
pos++;
/* IEEE80211_RADIOTAP_CHANNEL */
*(__le16 *)pos = cpu_to_le16(rx_status->received_channel);
pos += 2;
pos += 2;
/* IEEE80211_RADIOTAP_DBM_ANTSIGNAL */
*pos = rx_status->RxPower;
pos++;
/* IEEE80211_RADIOTAP_DBM_ANTNOISE */
*pos = rx_status->noise;
pos++;
/* IEEE80211_RADIOTAP_ANTENNA */
*pos = rx_status->Antenna;
pos++;
/* IEEE80211_RADIOTAP_DB_ANTNOISE is not used */
/* IEEE80211_RADIOTAP_RX_FLAGS */
/* ensure 2 byte alignment for the 2 byte field as required */
}
#endif
static inline void rtllib_monitor_rx(struct rtllib_device *ieee,
struct sk_buff *skb,struct rtllib_rx_stats *rx_status,
size_t hdr_length)
{
#if defined(RTLLIB_RADIOTAP) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
int needed_headroom = 0;
struct sk_buff *radiotap_skb;
needed_headroom = rtllib_rx_radiotap_len(ieee, rx_status);
printk("needed_headroom = %d\n", needed_headroom);
radiotap_skb = skb_copy_expand(skb, needed_headroom, 0, GFP_ATOMIC);
dev_kfree_skb(skb);
if (!radiotap_skb) {
return;
}
rtllib_add_rx_radiotap_header(ieee, radiotap_skb, needed_headroom, rx_status);
radiotap_skb->dev = ieee->dev;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
skb_reset_mac_header(radiotap_skb);
#else
radiotap_skb->mac.raw = radiotap_skb->data;
#endif
radiotap_skb->ip_summed = CHECKSUM_UNNECESSARY;
radiotap_skb->pkt_type = PACKET_OTHERHOST;
radiotap_skb->protocol = htons(ETH_P_802_2);
memset(radiotap_skb->cb, 0, sizeof(radiotap_skb->cb));
netif_rx(radiotap_skb);
#else
skb->dev = ieee->dev;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22)
skb_reset_mac_header(skb);
#else
skb->mac.raw = skb->data;
#endif
skb_pull(skb, hdr_length);
skb->pkt_type = PACKET_OTHERHOST;
skb->protocol = __constant_htons(ETH_P_80211_RAW);
memset(skb->cb, 0, sizeof(skb->cb));
netif_rx(skb);
#endif
}
/* Called only as a tasklet (software IRQ) */
......@@ -3252,12 +3125,10 @@ int rtllib_parse_info_param(struct rtllib_device *ieee,
{
RTLLIB_DEBUG_MGMT("MFIE_TYPE_WZC: %d bytes\n",
info_element->len);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
network->wzc_ie_len = min(info_element->len+2,
MAX_WZC_IE_LEN);
memcpy(network->wzc_ie, info_element,
network->wzc_ie_len);
#endif
}
break;
......@@ -3489,9 +3360,7 @@ static inline int rtllib_network_init(
network->wpa_ie_len = 0;
network->rsn_ie_len = 0;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
network->wzc_ie_len = 0;
#endif
if (rtllib_parse_info_param(ieee,
beacon->info_element,
......@@ -3624,10 +3493,8 @@ static inline void update_network(struct rtllib_network *dst,
dst->wpa_ie_len = src->wpa_ie_len;
memcpy(dst->rsn_ie, src->rsn_ie, src->rsn_ie_len);
dst->rsn_ie_len = src->rsn_ie_len;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
memcpy(dst->wzc_ie, src->wzc_ie, src->wzc_ie_len);
dst->wzc_ie_len = src->wzc_ie_len;
#endif
dst->last_scanned = jiffies;
/* qos related parameters */
......@@ -3945,16 +3812,10 @@ static inline void rtllib_process_probe_response(
#endif
unsigned long flags;
short renew;
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,13))
struct rtllib_network *network = kzalloc(sizeof(struct rtllib_network), GFP_ATOMIC);
#else
struct rtllib_network *network = kmalloc(sizeof(*network), GFP_ATOMIC);
memset(network,0,sizeof(*network));
#endif
if (!network) {
if (!network)
return;
}
RTLLIB_DEBUG_SCAN(
"'%s' (" MAC_FMT "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
......
......@@ -754,21 +754,13 @@ void rtllib_start_send_beacons(struct rtllib_device *ieee)
void rtllib_softmac_stop_scan(struct rtllib_device *ieee)
{
down(&ieee->scan_sem);
ieee->scan_watch_dog = 0;
if (ieee->scanning_continue == 1){
if (ieee->scanning_continue == 1) {
ieee->scanning_continue = 0;
ieee->actscanning = 0;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,40)
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,67)
cancel_delayed_work(&ieee->softmac_scan_wq);
#endif
#else
del_timer_sync(&ieee->scan_timer);
#endif
}
up(&ieee->scan_sem);
......@@ -837,18 +829,6 @@ void rtllib_start_scan(struct rtllib_device *ieee)
}
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
void rtllib_softmac_scan_cb(unsigned long _dev)
{
unsigned long flags;
struct rtllib_device *ieee = (struct rtllib_device *)_dev;
spin_lock_irqsave(&ieee->lock, flags);
rtllib_start_scan(ieee);
spin_unlock_irqrestore(&ieee->lock, flags);
}
#endif
/* called with wx_sem held */
void rtllib_start_scan_syncro(struct rtllib_device *ieee, u8 is_mesh)
{
......@@ -2903,28 +2883,16 @@ void rtllib_stop_queue(struct rtllib_device *ieee)
void rtllib_stop_all_queues(struct rtllib_device *ieee)
{
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30)
unsigned int i;
for (i=0; i < ieee->dev->num_tx_queues; i++)
netdev_get_tx_queue(ieee->dev,i)->trans_start = jiffies;
#else
ieee->dev->trans_start = jiffies;
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
netif_carrier_off(ieee->dev);
#else
netif_tx_stop_all_queues(ieee->dev);
#endif
}
void rtllib_wake_all_queues(struct rtllib_device *ieee)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
netif_carrier_on(ieee->dev);
#else
netif_tx_wake_all_queues(ieee->dev);
#endif
}
inline void rtllib_randomize_cell(struct rtllib_device *ieee)
......@@ -3436,11 +3404,6 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
ieee->sta_edca_param[3] = 0x002F3262;
ieee->aggregation = true;
ieee->enable_rx_imm_BA = 1;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,40)
_setup_timer(&ieee->scan_timer,
rtllib_softmac_scan_cb,
(unsigned long) ieee);
#endif
ieee->tx_pending.txb = NULL;
_setup_timer(&ieee->associate_timer,
......@@ -3451,18 +3414,11 @@ void rtllib_softmac_init(struct rtllib_device *ieee)
rtllib_send_beacon_cb,
(unsigned long) ieee);
#if defined(RTL8192U) || defined(RTL8192SU) || defined(RTL8192SE)
_setup_timer(&ieee->ibss_wait_timer,
rtllib_ibss_wait_timeout,
(unsigned long) ieee);
#endif
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#ifdef PF_SYNCTHREAD
ieee->wq = create_workqueue(DRV_NAME,0);
#else
ieee->wq = create_workqueue(DRV_NAME);
#endif
#endif
INIT_DELAYED_WORK_RSL(&ieee->link_change_wq,(void*)rtllib_link_change_wq,ieee);
......@@ -3499,11 +3455,8 @@ void rtllib_softmac_free(struct rtllib_device *ieee)
#endif
del_timer_sync(&ieee->associate_timer);
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
cancel_delayed_work(&ieee->associate_retry_wq);
destroy_workqueue(ieee->wq);
#endif
up(&ieee->wx_sem);
}
......
......@@ -311,13 +311,8 @@ int rtllib_wx_set_mode(struct rtllib_device *ieee, struct iw_request_info *a,
goto out;
if (wrqu->mode == IW_MODE_MONITOR) {
#if defined(RTLLIB_RADIOTAP) && (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,10))
ieee->dev->type = ARPHRD_IEEE80211_RADIOTAP;
#else
ieee->dev->type = ARPHRD_IEEE80211;
#endif
rtllib_EnableNetMonitorMode(ieee->dev,false);
} else {
ieee->dev->type = ARPHRD_ETHER;
if (ieee->iw_mode == IW_MODE_MONITOR)
......@@ -461,11 +456,7 @@ int rtllib_wx_set_essid(struct rtllib_device *ieee,
proto_started = ieee->proto_started;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
len = ((wrqu->essid.length-1) < IW_ESSID_MAX_SIZE) ? (wrqu->essid.length-1) : IW_ESSID_MAX_SIZE;
#else
len = (wrqu->essid.length < IW_ESSID_MAX_SIZE) ? wrqu->essid.length : IW_ESSID_MAX_SIZE;
#endif
if (len > IW_ESSID_MAX_SIZE){
ret= -E2BIG;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment