Commit 08d348a0 authored by Larry Finger's avatar Larry Finger Committed by Greg Kroah-Hartman

staging: rtl8192e: Cleanup checkpatch -f warnings and errors - Part XVIII

Signed-off-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 62f27cc4
...@@ -23,42 +23,38 @@ ...@@ -23,42 +23,38 @@
#include "r8190P_rtl8256.h" #include "r8190P_rtl8256.h"
#include "rtl_pm.h" #include "rtl_pm.h"
int rtl8192E_save_state (struct pci_dev *dev, pm_message_t state) int rtl8192E_save_state(struct pci_dev *dev, pm_message_t state)
{ {
printk(KERN_NOTICE "r8192E save state call (state %u).\n", state.event); printk(KERN_NOTICE "r8192E save state call (state %u).\n", state.event);
return(-EAGAIN); return -EAGAIN;
} }
int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state) int rtl8192E_suspend(struct pci_dev *pdev, pm_message_t state)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
u32 ulRegRead; u32 ulRegRead;
RT_TRACE(COMP_POWER, "============> r8192E suspend call.\n"); printk(KERN_INFO "============> r8192E suspend call.\n");
printk("============> r8192E suspend call.\n");
del_timer_sync(&priv->gpio_polling_timer); del_timer_sync(&priv->gpio_polling_timer);
cancel_delayed_work(&priv->gpio_change_rf_wq); cancel_delayed_work(&priv->gpio_change_rf_wq);
priv->polling_timer_on = 0; priv->polling_timer_on = 0;
if (!netif_running(dev)){ if (!netif_running(dev)) {
printk("RTL819XE:UI is open out of suspend function\n"); printk(KERN_INFO "RTL819XE:UI is open out of suspend "
"function\n");
goto out_pci_suspend; goto out_pci_suspend;
} }
#ifdef HAVE_NET_DEVICE_OPS
if (dev->netdev_ops->ndo_stop) if (dev->netdev_ops->ndo_stop)
dev->netdev_ops->ndo_stop(dev); dev->netdev_ops->ndo_stop(dev);
#else
dev->stop(dev);
#endif
netif_device_detach(dev); netif_device_detach(dev);
if (!priv->rtllib->bSupportRemoteWakeUp) { if (!priv->rtllib->bSupportRemoteWakeUp) {
MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT,true); MgntActSet_RF_State(dev, eRfOff, RF_CHANGE_BY_INIT, true);
ulRegRead = read_nic_dword(dev, CPU_GEN); ulRegRead = read_nic_dword(dev, CPU_GEN);
ulRegRead|=CPU_GEN_SYSTEM_RESET; ulRegRead |= CPU_GEN_SYSTEM_RESET;
write_nic_dword(dev, CPU_GEN, ulRegRead); write_nic_dword(dev, CPU_GEN, ulRegRead);
} else { } else {
write_nic_dword(dev, WFCRC0, 0xffffffff); write_nic_dword(dev, WFCRC0, 0xffffffff);
...@@ -68,31 +64,29 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state) ...@@ -68,31 +64,29 @@ int rtl8192E_suspend (struct pci_dev *pdev, pm_message_t state)
write_nic_byte(dev, MacBlkCtrl, 0xa); write_nic_byte(dev, MacBlkCtrl, 0xa);
} }
out_pci_suspend: out_pci_suspend:
RT_TRACE(COMP_POWER, "r8192E support WOL call??????????????????????\n");
printk("r8192E support WOL call??????????????????????\n"); printk("r8192E support WOL call??????????????????????\n");
if (priv->rtllib->bSupportRemoteWakeUp) { if (priv->rtllib->bSupportRemoteWakeUp)
RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!!!!!!!!!!!!.\n"); RT_TRACE(COMP_POWER, "r8192E support WOL call!!!!!!!"
} "!!!!!!!!!!!.\n");
pci_save_state(pdev); pci_save_state(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
pci_enable_wake(pdev, pci_choose_state(pdev,state),\ pci_enable_wake(pdev, pci_choose_state(pdev, state),
priv->rtllib->bSupportRemoteWakeUp?1:0); priv->rtllib->bSupportRemoteWakeUp ? 1 : 0);
pci_set_power_state(pdev,pci_choose_state(pdev,state)); pci_set_power_state(pdev, pci_choose_state(pdev, state));
mdelay(20); mdelay(20);
return 0; return 0;
} }
int rtl8192E_resume (struct pci_dev *pdev) int rtl8192E_resume(struct pci_dev *pdev)
{ {
struct net_device *dev = pci_get_drvdata(pdev); struct net_device *dev = pci_get_drvdata(pdev);
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
int err; int err;
u32 val; u32 val;
RT_TRACE(COMP_POWER, "================>r8192E resume call."); printk(KERN_INFO "================>r8192E resume call.\n");
printk("================>r8192E resume call.\n");
pci_set_power_state(pdev, PCI_D0); pci_set_power_state(pdev, PCI_D0);
...@@ -105,32 +99,26 @@ int rtl8192E_resume (struct pci_dev *pdev) ...@@ -105,32 +99,26 @@ int rtl8192E_resume (struct pci_dev *pdev)
pci_restore_state(pdev); pci_restore_state(pdev);
pci_read_config_dword(pdev, 0x40, &val); pci_read_config_dword(pdev, 0x40, &val);
if ((val & 0x0000ff00) != 0) { if ((val & 0x0000ff00) != 0)
pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
}
pci_enable_wake(pdev, PCI_D0, 0); pci_enable_wake(pdev, PCI_D0, 0);
if (priv->polling_timer_on == 0){ if (priv->polling_timer_on == 0)
check_rfctrl_gpio_timer((unsigned long)dev); check_rfctrl_gpio_timer((unsigned long)dev);
}
if (!netif_running(dev)){ if (!netif_running(dev)) {
printk("RTL819XE:UI is open out of resume function\n"); printk(KERN_INFO "RTL819XE:UI is open out of resume "
"function\n");
goto out; goto out;
} }
netif_device_attach(dev); netif_device_attach(dev);
#ifdef HAVE_NET_DEVICE_OPS
if (dev->netdev_ops->ndo_open) if (dev->netdev_ops->ndo_open)
dev->netdev_ops->ndo_open(dev); dev->netdev_ops->ndo_open(dev);
#else
dev->open(dev);
#endif
if (!priv->rtllib->bSupportRemoteWakeUp) { if (!priv->rtllib->bSupportRemoteWakeUp)
MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT,true); MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_INIT, true);
}
out: out:
RT_TRACE(COMP_POWER, "<================r8192E resume call.\n"); RT_TRACE(COMP_POWER, "<================r8192E resume call.\n");
...@@ -138,11 +126,11 @@ int rtl8192E_resume (struct pci_dev *pdev) ...@@ -138,11 +126,11 @@ int rtl8192E_resume (struct pci_dev *pdev)
} }
int rtl8192E_enable_wake (struct pci_dev *dev, pm_message_t state, int enable) int rtl8192E_enable_wake(struct pci_dev *dev, pm_message_t state, int enable)
{ {
printk(KERN_NOTICE "r8192E enable wake call (state %u, enable %d).\n", printk(KERN_NOTICE "r8192E enable wake call (state %u, enable %d).\n",
state.event, enable); state.event, enable);
return(-EAGAIN); return -EAGAIN;
} }
#endif #endif
...@@ -25,10 +25,10 @@ ...@@ -25,10 +25,10 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/pci.h> #include <linux/pci.h>
int rtl8192E_save_state (struct pci_dev *dev, pm_message_t state); 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_suspend(struct pci_dev *dev, pm_message_t state);
int rtl8192E_resume (struct pci_dev *dev); int rtl8192E_resume(struct pci_dev *dev);
int rtl8192E_enable_wake (struct pci_dev *dev, pm_message_t state, int enable); int rtl8192E_enable_wake(struct pci_dev *dev, pm_message_t state, int enable);
#endif #endif
......
...@@ -33,44 +33,49 @@ void rtl8192_hw_sleep_down(struct net_device *dev) ...@@ -33,44 +33,49 @@ void rtl8192_hw_sleep_down(struct net_device *dev)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
unsigned long flags = 0; unsigned long flags = 0;
spin_lock_irqsave(&priv->rf_ps_lock,flags); spin_lock_irqsave(&priv->rf_ps_lock, flags);
if (priv->RFChangeInProgress) { if (priv->RFChangeInProgress) {
spin_unlock_irqrestore(&priv->rf_ps_lock,flags); spin_unlock_irqrestore(&priv->rf_ps_lock, flags);
RT_TRACE(COMP_DBG, "rtl8192_hw_sleep_down(): RF Change in progress! \n"); RT_TRACE(COMP_DBG, "rtl8192_hw_sleep_down(): RF Change in "
"progress!\n");
return; return;
} }
spin_unlock_irqrestore(&priv->rf_ps_lock,flags); spin_unlock_irqrestore(&priv->rf_ps_lock, flags);
RT_TRACE(COMP_DBG, "%s()============>come to sleep down\n", __func__); RT_TRACE(COMP_DBG, "%s()============>come to sleep down\n", __func__);
MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS,false); MgntActSet_RF_State(dev, eRfSleep, RF_CHANGE_BY_PS, false);
} }
void rtl8192_hw_sleep_wq(void *data) void rtl8192_hw_sleep_wq(void *data)
{ {
struct rtllib_device *ieee = container_of_dwork_rsl(data,struct rtllib_device,hw_sleep_wq); struct rtllib_device *ieee = container_of_dwork_rsl(data,
struct rtllib_device, hw_sleep_wq);
struct net_device *dev = ieee->dev; struct net_device *dev = ieee->dev;
rtl8192_hw_sleep_down(dev); rtl8192_hw_sleep_down(dev);
} }
void rtl8192_hw_wakeup(struct net_device* dev) void rtl8192_hw_wakeup(struct net_device *dev)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
unsigned long flags = 0; unsigned long flags = 0;
spin_lock_irqsave(&priv->rf_ps_lock,flags); spin_lock_irqsave(&priv->rf_ps_lock, flags);
if (priv->RFChangeInProgress) { if (priv->RFChangeInProgress) {
spin_unlock_irqrestore(&priv->rf_ps_lock,flags); spin_unlock_irqrestore(&priv->rf_ps_lock, flags);
RT_TRACE(COMP_DBG, "rtl8192_hw_wakeup(): RF Change in progress! \n"); RT_TRACE(COMP_DBG, "rtl8192_hw_wakeup(): RF Change in "
queue_delayed_work_rsl(priv->rtllib->wq,&priv->rtllib->hw_wakeup_wq,MSECS(10)); "progress!\n");
queue_delayed_work_rsl(priv->rtllib->wq,
&priv->rtllib->hw_wakeup_wq, MSECS(10));
return; return;
} }
spin_unlock_irqrestore(&priv->rf_ps_lock,flags); spin_unlock_irqrestore(&priv->rf_ps_lock, flags);
RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __func__); RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __func__);
MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS,false); MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS, false);
} }
void rtl8192_hw_wakeup_wq(void *data) void rtl8192_hw_wakeup_wq(void *data)
{ {
struct rtllib_device *ieee = container_of_dwork_rsl(data,struct rtllib_device,hw_wakeup_wq); struct rtllib_device *ieee = container_of_dwork_rsl(data,
struct rtllib_device, hw_wakeup_wq);
struct net_device *dev = ieee->dev; struct net_device *dev = ieee->dev;
rtl8192_hw_wakeup(dev); rtl8192_hw_wakeup(dev);
...@@ -85,12 +90,12 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) ...@@ -85,12 +90,12 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time)
u32 tmp; u32 tmp;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->ps_lock,flags); spin_lock_irqsave(&priv->ps_lock, flags);
time -= MSECS(8+16+7); time -= MSECS(8+16+7);
if ((time - jiffies) <= MSECS(MIN_SLEEP_TIME)) { if ((time - jiffies) <= MSECS(MIN_SLEEP_TIME)) {
spin_unlock_irqrestore(&priv->ps_lock,flags); spin_unlock_irqrestore(&priv->ps_lock, flags);
printk(KERN_INFO "too short to sleep::%lld < %ld\n", printk(KERN_INFO "too short to sleep::%lld < %ld\n",
time - jiffies, MSECS(MIN_SLEEP_TIME)); time - jiffies, MSECS(MIN_SLEEP_TIME));
return; return;
...@@ -99,48 +104,48 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time) ...@@ -99,48 +104,48 @@ void rtl8192_hw_to_sleep(struct net_device *dev, u64 time)
if ((time - jiffies) > MSECS(MAX_SLEEP_TIME)) { if ((time - jiffies) > MSECS(MAX_SLEEP_TIME)) {
printk(KERN_INFO "========>too long to sleep:%lld > %ld\n", printk(KERN_INFO "========>too long to sleep:%lld > %ld\n",
time - jiffies, MSECS(MAX_SLEEP_TIME)); time - jiffies, MSECS(MAX_SLEEP_TIME));
spin_unlock_irqrestore(&priv->ps_lock,flags); spin_unlock_irqrestore(&priv->ps_lock, flags);
return; return;
} }
tmp = time - jiffies; tmp = time - jiffies;
queue_delayed_work_rsl(priv->rtllib->wq, queue_delayed_work_rsl(priv->rtllib->wq,
&priv->rtllib->hw_wakeup_wq,tmp); &priv->rtllib->hw_wakeup_wq, tmp);
queue_delayed_work_rsl(priv->rtllib->wq, queue_delayed_work_rsl(priv->rtllib->wq,
(void *)&priv->rtllib->hw_sleep_wq,0); (void *)&priv->rtllib->hw_sleep_wq, 0);
spin_unlock_irqrestore(&priv->ps_lock,flags); spin_unlock_irqrestore(&priv->ps_lock, flags);
} }
void InactivePsWorkItemCallback(struct net_device *dev) void InactivePsWorkItemCallback(struct net_device *dev)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
&(priv->rtllib->PowerSaveControl);
RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() ---------> \n"); RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() --------->\n");
pPSC->bSwRfProcessing = true; pPSC->bSwRfProcessing = true;
RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n", \ RT_TRACE(COMP_PS, "InactivePsWorkItemCallback(): Set RF to %s.\n",
pPSC->eInactivePowerState == eRfOff?"OFF":"ON"); pPSC->eInactivePowerState == eRfOff ? "OFF" : "ON");
MgntActSet_RF_State(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS,false); MgntActSet_RF_State(dev, pPSC->eInactivePowerState, RF_CHANGE_BY_IPS,
false);
pPSC->bSwRfProcessing = false; pPSC->bSwRfProcessing = false;
RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <--------- \n"); RT_TRACE(COMP_PS, "InactivePsWorkItemCallback() <---------\n");
} }
void void IPSEnter(struct net_device *dev)
IPSEnter(struct net_device *dev)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
&(priv->rtllib->PowerSaveControl);
enum rt_rf_power_state rtState; enum rt_rf_power_state rtState;
if (pPSC->bInactivePs) if (pPSC->bInactivePs) {
{
rtState = priv->rtllib->eRFPowerState; rtState = priv->rtllib->eRFPowerState;
if (rtState == eRfOn && !pPSC->bSwRfProcessing &&\ if (rtState == eRfOn && !pPSC->bSwRfProcessing &&
(priv->rtllib->state != RTLLIB_LINKED)&&\ (priv->rtllib->state != RTLLIB_LINKED) &&
(priv->rtllib->iw_mode != IW_MODE_MASTER)) (priv->rtllib->iw_mode != IW_MODE_MASTER)) {
{ RT_TRACE(COMP_PS, "IPSEnter(): Turn off RF.\n");
RT_TRACE(COMP_PS,"IPSEnter(): Turn off RF.\n");
pPSC->eInactivePowerState = eRfOff; pPSC->eInactivePowerState = eRfOff;
priv->isRFOff = true; priv->isRFOff = true;
priv->bInPowerSaveMode = true; priv->bInPowerSaveMode = true;
...@@ -149,18 +154,17 @@ IPSEnter(struct net_device *dev) ...@@ -149,18 +154,17 @@ IPSEnter(struct net_device *dev)
} }
} }
void void IPSLeave(struct net_device *dev)
IPSLeave(struct net_device *dev)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
&(priv->rtllib->PowerSaveControl);
enum rt_rf_power_state rtState; enum rt_rf_power_state rtState;
if (pPSC->bInactivePs) if (pPSC->bInactivePs) {
{
rtState = priv->rtllib->eRFPowerState; rtState = priv->rtllib->eRFPowerState;
if (rtState != eRfOn && !pPSC->bSwRfProcessing && priv->rtllib->RfOffReason <= RF_CHANGE_BY_IPS) if (rtState != eRfOn && !pPSC->bSwRfProcessing &&
{ priv->rtllib->RfOffReason <= RF_CHANGE_BY_IPS) {
RT_TRACE(COMP_PS, "IPSLeave(): Turn on RF.\n"); RT_TRACE(COMP_PS, "IPSLeave(): Turn on RF.\n");
pPSC->eInactivePowerState = eRfOn; pPSC->eInactivePowerState = eRfOn;
priv->bInPowerSaveMode = false; priv->bInPowerSaveMode = false;
...@@ -168,9 +172,11 @@ IPSLeave(struct net_device *dev) ...@@ -168,9 +172,11 @@ IPSLeave(struct net_device *dev)
} }
} }
} }
void IPSLeave_wq(void *data) void IPSLeave_wq(void *data)
{ {
struct rtllib_device *ieee = container_of_work_rsl(data,struct rtllib_device,ips_leave_wq); struct rtllib_device *ieee = container_of_work_rsl(data,
struct rtllib_device, ips_leave_wq);
struct net_device *dev = ieee->dev; struct net_device *dev = ieee->dev;
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
down(&priv->rtllib->ips_sem); down(&priv->rtllib->ips_sem);
...@@ -184,20 +190,22 @@ void rtllib_ips_leave_wq(struct net_device *dev) ...@@ -184,20 +190,22 @@ void rtllib_ips_leave_wq(struct net_device *dev)
enum rt_rf_power_state rtState; enum rt_rf_power_state rtState;
rtState = priv->rtllib->eRFPowerState; rtState = priv->rtllib->eRFPowerState;
if (priv->rtllib->PowerSaveControl.bInactivePs){ if (priv->rtllib->PowerSaveControl.bInactivePs) {
if (rtState == eRfOff){ if (rtState == eRfOff) {
if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) {
{ RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__func__); __func__);
return; return;
} } else {
else{ printk(KERN_INFO "=========>%s(): IPSLeave\n",
printk("=========>%s(): IPSLeave\n",__func__); __func__);
queue_work_rsl(priv->rtllib->wq,&priv->rtllib->ips_leave_wq); queue_work_rsl(priv->rtllib->wq,
&priv->rtllib->ips_leave_wq);
} }
} }
} }
} }
void rtllib_ips_leave(struct net_device *dev) void rtllib_ips_leave(struct net_device *dev)
{ {
struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev);
...@@ -213,11 +221,11 @@ bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, u8 rtPsMode) ...@@ -213,11 +221,11 @@ bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, u8 rtPsMode)
if (priv->rtllib->iw_mode == IW_MODE_ADHOC) if (priv->rtllib->iw_mode == IW_MODE_ADHOC)
return false; return false;
RT_TRACE(COMP_LPS,"%s(): set ieee->ps = %x\n",__func__,rtPsMode); RT_TRACE(COMP_LPS, "%s(): set ieee->ps = %x\n", __func__, rtPsMode);
if (!priv->ps_force) { if (!priv->ps_force)
priv->rtllib->ps = rtPsMode; priv->rtllib->ps = rtPsMode;
} if (priv->rtllib->sta_sleep != LPS_IS_WAKE &&
if (priv->rtllib->sta_sleep != LPS_IS_WAKE && rtPsMode == RTLLIB_PS_DISABLED) { rtPsMode == RTLLIB_PS_DISABLED) {
unsigned long flags; unsigned long flags;
rtl8192_hw_wakeup(dev); rtl8192_hw_wakeup(dev);
...@@ -233,18 +241,22 @@ bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, u8 rtPsMode) ...@@ -233,18 +241,22 @@ bool MgntActSet_802_11_PowerSaveMode(struct net_device *dev, u8 rtPsMode)
return true; return true;
} }
void LeisurePSEnter(struct net_device *dev) void LeisurePSEnter(struct net_device *dev)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
&(priv->rtllib->PowerSaveControl);
RT_TRACE(COMP_PS, "LeisurePSEnter()...\n"); RT_TRACE(COMP_PS, "LeisurePSEnter()...\n");
RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdleCount is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n", RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d,pPSC->LpsIdle"
pPSC->bLeisurePs, priv->rtllib->ps,pPSC->LpsIdleCount,RT_CHECK_FOR_HANG_PERIOD); "Count is %d,RT_CHECK_FOR_HANG_PERIOD is %d\n",
pPSC->bLeisurePs, priv->rtllib->ps, pPSC->LpsIdleCount,
if (!((priv->rtllib->iw_mode == IW_MODE_INFRA) && (priv->rtllib->state == RTLLIB_LINKED)) RT_CHECK_FOR_HANG_PERIOD);
|| (priv->rtllib->iw_mode == IW_MODE_ADHOC) || (priv->rtllib->iw_mode == IW_MODE_MASTER))
if (!((priv->rtllib->iw_mode == IW_MODE_INFRA) &&
(priv->rtllib->state == RTLLIB_LINKED))
|| (priv->rtllib->iw_mode == IW_MODE_ADHOC) ||
(priv->rtllib->iw_mode == IW_MODE_MASTER))
return; return;
if (pPSC->bLeisurePs) { if (pPSC->bLeisurePs) {
...@@ -252,43 +264,45 @@ void LeisurePSEnter(struct net_device *dev) ...@@ -252,43 +264,45 @@ void LeisurePSEnter(struct net_device *dev)
if (priv->rtllib->ps == RTLLIB_PS_DISABLED) { if (priv->rtllib->ps == RTLLIB_PS_DISABLED) {
RT_TRACE(COMP_LPS, "LeisurePSEnter(): Enter 802.11 power save mode...\n"); RT_TRACE(COMP_LPS, "LeisurePSEnter(): Enter "
"802.11 power save mode...\n");
if (!pPSC->bFwCtrlLPS) { if (!pPSC->bFwCtrlLPS) {
if (priv->rtllib->SetFwCmdHandler) if (priv->rtllib->SetFwCmdHandler)
priv->rtllib->SetFwCmdHandler(dev, FW_CMD_LPS_ENTER); priv->rtllib->SetFwCmdHandler(
dev, FW_CMD_LPS_ENTER);
} }
MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_MBCAST|RTLLIB_PS_UNICAST); MgntActSet_802_11_PowerSaveMode(dev,
RTLLIB_PS_MBCAST |
RTLLIB_PS_UNICAST);
} }
} else } else
pPSC->LpsIdleCount++; pPSC->LpsIdleCount++;
} }
} }
void LeisurePSLeave(struct net_device *dev) void LeisurePSLeave(struct net_device *dev)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
&(priv->rtllib->PowerSaveControl);
RT_TRACE(COMP_PS, "LeisurePSLeave()...\n"); RT_TRACE(COMP_PS, "LeisurePSLeave()...\n");
RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d\n", RT_TRACE(COMP_PS, "pPSC->bLeisurePs = %d, ieee->ps = %d\n",
pPSC->bLeisurePs, priv->rtllib->ps); pPSC->bLeisurePs, priv->rtllib->ps);
if (pPSC->bLeisurePs) if (pPSC->bLeisurePs) {
{ if (priv->rtllib->ps != RTLLIB_PS_DISABLED) {
if (priv->rtllib->ps != RTLLIB_PS_DISABLED) RT_TRACE(COMP_LPS, "LeisurePSLeave(): Busy Traffic , "
{ "Leave 802.11 power save..\n");
RT_TRACE(COMP_LPS, "LeisurePSLeave(): Busy Traffic , Leave 802.11 power save..\n"); MgntActSet_802_11_PowerSaveMode(dev,
MgntActSet_802_11_PowerSaveMode(dev, RTLLIB_PS_DISABLED); RTLLIB_PS_DISABLED);
if (!pPSC->bFwCtrlLPS) if (!pPSC->bFwCtrlLPS) {
{
if (priv->rtllib->SetFwCmdHandler) if (priv->rtllib->SetFwCmdHandler)
{ priv->rtllib->SetFwCmdHandler(dev,
priv->rtllib->SetFwCmdHandler(dev, FW_CMD_LPS_LEAVE); FW_CMD_LPS_LEAVE);
}
} }
} }
} }
......
...@@ -36,7 +36,7 @@ void rtl8192_hw_wakeup(struct net_device *dev); ...@@ -36,7 +36,7 @@ void rtl8192_hw_wakeup(struct net_device *dev);
void rtl8192_hw_to_sleep(struct net_device *dev, u64 time); void rtl8192_hw_to_sleep(struct net_device *dev, u64 time);
void rtllib_ips_leave_wq(struct net_device *dev); void rtllib_ips_leave_wq(struct net_device *dev);
void rtllib_ips_leave(struct net_device *dev); void rtllib_ips_leave(struct net_device *dev);
void IPSLeave_wq (void *data); void IPSLeave_wq(void *data);
void IPSEnter(struct net_device *dev); void IPSEnter(struct net_device *dev);
void IPSLeave(struct net_device *dev); void IPSLeave(struct net_device *dev);
......
...@@ -22,14 +22,14 @@ ...@@ -22,14 +22,14 @@
#include "dot11d.h" #include "dot11d.h"
#define RATE_COUNT 12 #define RATE_COUNT 12
u32 rtl8192_rates[] = {1000000,2000000,5500000,11000000, u32 rtl8192_rates[] = {
6000000,9000000,12000000,18000000,24000000,36000000,48000000,54000000}; 1000000, 2000000, 5500000, 11000000, 6000000, 9000000, 12000000,
18000000, 24000000, 36000000, 48000000, 54000000
};
#ifndef ENETDOWN #ifndef ENETDOWN
#define ENETDOWN 1 #define ENETDOWN 1
#endif #endif
extern int hwwep;
static int r8192_wx_get_freq(struct net_device *dev, static int r8192_wx_get_freq(struct net_device *dev,
struct iw_request_info *a, struct iw_request_info *a,
...@@ -37,16 +37,16 @@ static int r8192_wx_get_freq(struct net_device *dev, ...@@ -37,16 +37,16 @@ static int r8192_wx_get_freq(struct net_device *dev,
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
return rtllib_wx_get_freq(priv->rtllib,a,wrqu,b); return rtllib_wx_get_freq(priv->rtllib, a, wrqu, b);
} }
static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a, static int r8192_wx_get_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b) union iwreq_data *wrqu, char *b)
{ {
struct r8192_priv *priv=rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
return rtllib_wx_get_mode(priv->rtllib,a,wrqu,b); return rtllib_wx_get_mode(priv->rtllib, a, wrqu, b);
} }
static int r8192_wx_get_rate(struct net_device *dev, static int r8192_wx_get_rate(struct net_device *dev,
...@@ -54,7 +54,7 @@ static int r8192_wx_get_rate(struct net_device *dev, ...@@ -54,7 +54,7 @@ static int r8192_wx_get_rate(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
return rtllib_wx_get_rate(priv->rtllib,info,wrqu,extra); return rtllib_wx_get_rate(priv->rtllib, info, wrqu, extra);
} }
...@@ -71,7 +71,7 @@ static int r8192_wx_set_rate(struct net_device *dev, ...@@ -71,7 +71,7 @@ static int r8192_wx_set_rate(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
ret = rtllib_wx_set_rate(priv->rtllib,info,wrqu,extra); ret = rtllib_wx_set_rate(priv->rtllib, info, wrqu, extra);
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -91,7 +91,7 @@ static int r8192_wx_set_rts(struct net_device *dev, ...@@ -91,7 +91,7 @@ static int r8192_wx_set_rts(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
ret = rtllib_wx_set_rts(priv->rtllib,info,wrqu,extra); ret = rtllib_wx_set_rts(priv->rtllib, info, wrqu, extra);
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -103,7 +103,7 @@ static int r8192_wx_get_rts(struct net_device *dev, ...@@ -103,7 +103,7 @@ static int r8192_wx_get_rts(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
return rtllib_wx_get_rts(priv->rtllib,info,wrqu,extra); return rtllib_wx_get_rts(priv->rtllib, info, wrqu, extra);
} }
static int r8192_wx_set_power(struct net_device *dev, static int r8192_wx_set_power(struct net_device *dev,
...@@ -113,13 +113,14 @@ static int r8192_wx_set_power(struct net_device *dev, ...@@ -113,13 +113,14 @@ static int r8192_wx_set_power(struct net_device *dev,
int ret; int ret;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
if (priv->bHwRadioOff == true){ if (priv->bHwRadioOff == true) {
RT_TRACE(COMP_ERR,"%s():Hw is Radio Off, we can't set Power,return\n",__func__); RT_TRACE(COMP_ERR, "%s():Hw is Radio Off, we can't set "
"Power,return\n", __func__);
return 0; return 0;
} }
down(&priv->wx_sem); down(&priv->wx_sem);
ret = rtllib_wx_set_power(priv->rtllib,info,wrqu,extra); ret = rtllib_wx_set_power(priv->rtllib, info, wrqu, extra);
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -131,7 +132,7 @@ static int r8192_wx_get_power(struct net_device *dev, ...@@ -131,7 +132,7 @@ static int r8192_wx_get_power(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
return rtllib_wx_get_power(priv->rtllib,info,wrqu,extra); return rtllib_wx_get_power(priv->rtllib, info, wrqu, extra);
} }
static int r8192_wx_set_rawtx(struct net_device *dev, static int r8192_wx_set_rawtx(struct net_device *dev,
...@@ -162,7 +163,8 @@ static int r8192_wx_force_reset(struct net_device *dev, ...@@ -162,7 +163,8 @@ static int r8192_wx_force_reset(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
RT_TRACE(COMP_DBG, "%s(): force reset ! extra is %d\n", __func__, *extra); RT_TRACE(COMP_DBG, "%s(): force reset ! extra is %d\n",
__func__, *extra);
priv->force_reset = *extra; priv->force_reset = *extra;
up(&priv->wx_sem); up(&priv->wx_sem);
return 0; return 0;
...@@ -174,11 +176,11 @@ static int r8192_wx_force_mic_error(struct net_device *dev, ...@@ -174,11 +176,11 @@ static int r8192_wx_force_mic_error(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
down(&priv->wx_sem); down(&priv->wx_sem);
RT_TRACE(COMP_DBG, "%s(): force mic error ! \n", __func__); RT_TRACE(COMP_DBG, "%s(): force mic error !\n", __func__);
ieee->force_mic_error = true; ieee->force_mic_error = true;
up(&priv->wx_sem); up(&priv->wx_sem);
return 0; return 0;
...@@ -216,12 +218,14 @@ static int r8192_wx_adapter_power_status(struct net_device *dev, ...@@ -216,12 +218,14 @@ static int r8192_wx_adapter_power_status(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
struct rtllib_device* ieee = priv->rtllib; (&(priv->rtllib->PowerSaveControl));
struct rtllib_device *ieee = priv->rtllib;
down(&priv->wx_sem); down(&priv->wx_sem);
RT_TRACE(COMP_POWER, "%s(): %s\n",__func__, (*extra == 6)?"DC power":"AC power"); RT_TRACE(COMP_POWER, "%s(): %s\n", __func__, (*extra == 6) ?
"DC power" : "AC power");
if (*extra || priv->force_lps) { if (*extra || priv->force_lps) {
priv->ps_force = false; priv->ps_force = false;
pPSC->bLeisurePs = true; pPSC->bLeisurePs = true;
...@@ -247,10 +251,10 @@ static int r8192se_wx_set_radio(struct net_device *dev, ...@@ -247,10 +251,10 @@ static int r8192se_wx_set_radio(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
printk("%s(): set radio ! extra is %d\n",__func__, *extra); printk(KERN_INFO "%s(): set radio ! extra is %d\n", __func__, *extra);
if ((*extra != 0) && (*extra != 1)) if ((*extra != 0) && (*extra != 1)) {
{ RT_TRACE(COMP_ERR, "%s(): set radio an err value,must 0(radio "
RT_TRACE(COMP_ERR, "%s(): set radio an err value,must 0(radio off) or 1(radio on)\n",__func__); "off) or 1(radio on)\n", __func__);
return -1; return -1;
} }
priv->sw_radio_on = *extra; priv->sw_radio_on = *extra;
...@@ -264,16 +268,17 @@ static int r8192se_wx_set_lps_awake_interval(struct net_device *dev, ...@@ -264,16 +268,17 @@ static int r8192se_wx_set_lps_awake_interval(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)(&(priv->rtllib->PowerSaveControl)); struct rt_pwr_save_ctrl *pPSC = (struct rt_pwr_save_ctrl *)
(&(priv->rtllib->PowerSaveControl));
down(&priv->wx_sem); down(&priv->wx_sem);
printk("%s(): set lps awake interval ! extra is %d\n",__func__, *extra); printk(KERN_INFO "%s(): set lps awake interval ! extra is %d\n",
__func__, *extra);
pPSC->RegMaxLPSAwakeIntvl = *extra; pPSC->RegMaxLPSAwakeIntvl = *extra;
up(&priv->wx_sem); up(&priv->wx_sem);
return 0; return 0;
} }
static int r8192se_wx_set_force_lps(struct net_device *dev, static int r8192se_wx_set_force_lps(struct net_device *dev,
...@@ -284,7 +289,8 @@ static int r8192se_wx_set_force_lps(struct net_device *dev, ...@@ -284,7 +289,8 @@ static int r8192se_wx_set_force_lps(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
printk("%s(): force LPS ! extra is %d (1 is open 0 is close)\n",__func__, *extra); printk(KERN_INFO "%s(): force LPS ! extra is %d (1 is open 0 is "
"close)\n", __func__, *extra);
priv->force_lps = *extra; priv->force_lps = *extra;
up(&priv->wx_sem); up(&priv->wx_sem);
return 0; return 0;
...@@ -301,12 +307,12 @@ static int r8192_wx_set_debugflag(struct net_device *dev, ...@@ -301,12 +307,12 @@ static int r8192_wx_set_debugflag(struct net_device *dev,
if (priv->bHwRadioOff == true) if (priv->bHwRadioOff == true)
return 0; return 0;
printk("=====>%s(), *extra:%x, debugflag:%x\n", __func__, *extra, rt_global_debug_component); printk(KERN_INFO "=====>%s(), *extra:%x, debugflag:%x\n", __func__,
if (c > 0) { *extra, rt_global_debug_component);
if (c > 0)
rt_global_debug_component |= (1<<c); rt_global_debug_component |= (1<<c);
} else { else
rt_global_debug_component &= BIT31; rt_global_debug_component &= BIT31;
}
return 0; return 0;
} }
...@@ -314,7 +320,7 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, ...@@ -314,7 +320,7 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b) union iwreq_data *wrqu, char *b)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device* ieee = netdev_priv_rsl(dev); struct rtllib_device *ieee = netdev_priv_rsl(dev);
enum rt_rf_power_state rtState; enum rt_rf_power_state rtState;
int ret; int ret;
...@@ -323,18 +329,19 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, ...@@ -323,18 +329,19 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
return 0; return 0;
rtState = priv->rtllib->eRFPowerState; rtState = priv->rtllib->eRFPowerState;
down(&priv->wx_sem); down(&priv->wx_sem);
if (wrqu->mode == IW_MODE_ADHOC || wrqu->mode == IW_MODE_MONITOR if (wrqu->mode == IW_MODE_ADHOC || wrqu->mode == IW_MODE_MONITOR ||
|| ieee->bNetPromiscuousMode ) ieee->bNetPromiscuousMode) {
{ if (priv->rtllib->PowerSaveControl.bInactivePs) {
if (priv->rtllib->PowerSaveControl.bInactivePs){ if (rtState == eRfOff) {
if (rtState == eRfOff){ if (priv->rtllib->RfOffReason >
if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS) RF_CHANGE_BY_IPS) {
{ RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__func__); __func__);
up(&priv->wx_sem); up(&priv->wx_sem);
return -1; return -1;
} else { } else {
printk("=========>%s(): IPSLeave\n",__func__); printk(KERN_INFO "=========>%s(): "
"IPSLeave\n", __func__);
down(&priv->rtllib->ips_sem); down(&priv->rtllib->ips_sem);
IPSLeave(dev); IPSLeave(dev);
up(&priv->rtllib->ips_sem); up(&priv->rtllib->ips_sem);
...@@ -342,14 +349,13 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, ...@@ -342,14 +349,13 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a,
} }
} }
} }
ret = rtllib_wx_set_mode(priv->rtllib,a,wrqu,b); ret = rtllib_wx_set_mode(priv->rtllib, a, wrqu, b);
up(&priv->wx_sem); up(&priv->wx_sem);
return ret; return ret;
} }
struct iw_range_with_scan_capa struct iw_range_with_scan_capa {
{
/* Informative stuff (to choose between different interface) */ /* Informative stuff (to choose between different interface) */
__u32 throughput; /* To give an idea... */ __u32 throughput; /* To give an idea... */
/* In theory this value should be the maximum benchmarked /* In theory this value should be the maximum benchmarked
...@@ -386,8 +392,10 @@ static int rtl8192_wx_get_range(struct net_device *dev, ...@@ -386,8 +392,10 @@ static int rtl8192_wx_get_range(struct net_device *dev,
/* ~130 Mb/s real (802.11n) */ /* ~130 Mb/s real (802.11n) */
range->throughput = 130 * 1000 * 1000; range->throughput = 130 * 1000 * 1000;
if (priv->rf_set_sens != NULL) if (priv->rf_set_sens != NULL) {
range->sensitivity = priv->max_sens; /* signal level threshold range */ /* signal level threshold range */
range->sensitivity = priv->max_sens;
}
range->max_qual.qual = 100; range->max_qual.qual = 100;
range->max_qual.level = 0; range->max_qual.level = 0;
...@@ -401,9 +409,8 @@ static int rtl8192_wx_get_range(struct net_device *dev, ...@@ -401,9 +409,8 @@ static int rtl8192_wx_get_range(struct net_device *dev,
range->num_bitrates = min(RATE_COUNT, IW_MAX_BITRATES); range->num_bitrates = min(RATE_COUNT, IW_MAX_BITRATES);
for (i = 0; i < range->num_bitrates; i++) { for (i = 0; i < range->num_bitrates; i++)
range->bitrate[i] = rtl8192_rates[i]; range->bitrate[i] = rtl8192_rates[i];
}
range->max_rts = DEFAULT_RTS_THRESHOLD; range->max_rts = DEFAULT_RTS_THRESHOLD;
range->min_frag = MIN_FRAG_THRESHOLD; range->min_frag = MIN_FRAG_THRESHOLD;
...@@ -422,10 +429,10 @@ static int rtl8192_wx_get_range(struct net_device *dev, ...@@ -422,10 +429,10 @@ static int rtl8192_wx_get_range(struct net_device *dev,
for (i = 0, val = 0; i < 14; i++) { for (i = 0, val = 0; i < 14; i++) {
if ((priv->rtllib->active_channel_map)[i+1]) { if ((priv->rtllib->active_channel_map)[i+1]) {
range->freq[val].i = i + 1; range->freq[val].i = i + 1;
range->freq[val].m = rtllib_wlan_frequencies[i] * 100000; range->freq[val].m = rtllib_wlan_frequencies[i] *
100000;
range->freq[val].e = 1; range->freq[val].e = 1;
val++; val++;
} else {
} }
if (val == IW_MAX_FREQUENCIES) if (val == IW_MAX_FREQUENCIES)
...@@ -446,35 +453,36 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, ...@@ -446,35 +453,36 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
union iwreq_data *wrqu, char *b) union iwreq_data *wrqu, char *b)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
enum rt_rf_power_state rtState; enum rt_rf_power_state rtState;
int ret; int ret;
if (!(ieee->softmac_features & IEEE_SOFTMAC_SCAN)){ if (!(ieee->softmac_features & IEEE_SOFTMAC_SCAN)) {
if ((ieee->state >= RTLLIB_ASSOCIATING) && (ieee->state <= RTLLIB_ASSOCIATING_AUTHENTICATED)){ if ((ieee->state >= RTLLIB_ASSOCIATING) &&
(ieee->state <= RTLLIB_ASSOCIATING_AUTHENTICATED))
return 0; return 0;
} if ((priv->rtllib->state == RTLLIB_LINKED) &&
if ((priv->rtllib->state == RTLLIB_LINKED) && (priv->rtllib->CntAfterLink<2)){ (priv->rtllib->CntAfterLink < 2))
return 0; return 0;
} }
}
if (priv->bHwRadioOff == true){ if (priv->bHwRadioOff == true) {
printk("================>%s(): hwradio off\n",__func__); printk(KERN_INFO "================>%s(): hwradio off\n",
__func__);
return 0; return 0;
} }
rtState = priv->rtllib->eRFPowerState; rtState = priv->rtllib->eRFPowerState;
if (!priv->up) return -ENETDOWN; if (!priv->up)
return -ENETDOWN;
if (priv->rtllib->LinkDetectInfo.bBusyTraffic == true) if (priv->rtllib->LinkDetectInfo.bBusyTraffic == true)
return -EAGAIN; return -EAGAIN;
if (wrqu->data.flags & IW_SCAN_THIS_ESSID) if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
{ struct iw_scan_req *req = (struct iw_scan_req *)b;
struct iw_scan_req* req = (struct iw_scan_req*)b; if (req->essid_len) {
if (req->essid_len)
{
ieee->current_network.ssid_len = req->essid_len; ieee->current_network.ssid_len = req->essid_len;
memcpy(ieee->current_network.ssid, req->essid, req->essid_len); memcpy(ieee->current_network.ssid, req->essid,
req->essid_len);
} }
} }
...@@ -482,15 +490,18 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, ...@@ -482,15 +490,18 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
priv->rtllib->FirstIe_InScan = true; priv->rtllib->FirstIe_InScan = true;
if (priv->rtllib->state != RTLLIB_LINKED){ if (priv->rtllib->state != RTLLIB_LINKED) {
if (priv->rtllib->PowerSaveControl.bInactivePs){ if (priv->rtllib->PowerSaveControl.bInactivePs) {
if (rtState == eRfOff){ if (rtState == eRfOff) {
if (priv->rtllib->RfOffReason > RF_CHANGE_BY_IPS){ if (priv->rtllib->RfOffReason >
RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__func__); RF_CHANGE_BY_IPS) {
RT_TRACE(COMP_ERR, "%s(): RF is "
"OFF.\n", __func__);
up(&priv->wx_sem); up(&priv->wx_sem);
return -1; return -1;
}else{ } else {
RT_TRACE(COMP_PS, "=========>%s(): IPSLeave\n",__func__); RT_TRACE(COMP_PS, "=========>%s(): "
"IPSLeave\n", __func__);
down(&priv->rtllib->ips_sem); down(&priv->rtllib->ips_sem);
IPSLeave(dev); IPSLeave(dev);
up(&priv->rtllib->ips_sem); up(&priv->rtllib->ips_sem);
...@@ -499,23 +510,26 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, ...@@ -499,23 +510,26 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
} }
rtllib_stop_scan(priv->rtllib); rtllib_stop_scan(priv->rtllib);
if (priv->rtllib->LedControlHandler) if (priv->rtllib->LedControlHandler)
priv->rtllib->LedControlHandler(dev, LED_CTL_SITE_SURVEY); priv->rtllib->LedControlHandler(dev,
LED_CTL_SITE_SURVEY);
if (priv->rtllib->eRFPowerState != eRfOff){ if (priv->rtllib->eRFPowerState != eRfOff) {
priv->rtllib->actscanning = true; priv->rtllib->actscanning = true;
if (ieee->ScanOperationBackupHandler) if (ieee->ScanOperationBackupHandler)
ieee->ScanOperationBackupHandler(ieee->dev,SCAN_OPT_BACKUP); ieee->ScanOperationBackupHandler(ieee->dev,
SCAN_OPT_BACKUP);
rtllib_start_scan_syncro(priv->rtllib, 0); rtllib_start_scan_syncro(priv->rtllib, 0);
if (ieee->ScanOperationBackupHandler) if (ieee->ScanOperationBackupHandler)
ieee->ScanOperationBackupHandler(ieee->dev,SCAN_OPT_RESTORE); ieee->ScanOperationBackupHandler(ieee->dev,
SCAN_OPT_RESTORE);
} }
ret = 0; ret = 0;
} else { } else {
priv->rtllib->actscanning = true; priv->rtllib->actscanning = true;
ret = rtllib_wx_set_scan(priv->rtllib,a,wrqu,b); ret = rtllib_wx_set_scan(priv->rtllib, a, wrqu, b);
} }
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -530,7 +544,8 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a, ...@@ -530,7 +544,8 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
int ret; int ret;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
if (!priv->up) return -ENETDOWN; if (!priv->up)
return -ENETDOWN;
if (priv->bHwRadioOff == true) if (priv->bHwRadioOff == true)
return 0; return 0;
...@@ -538,7 +553,7 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a, ...@@ -538,7 +553,7 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a,
down(&priv->wx_sem); down(&priv->wx_sem);
ret = rtllib_wx_get_scan(priv->rtllib,a,wrqu,b); ret = rtllib_wx_get_scan(priv->rtllib, a, wrqu, b);
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -552,15 +567,17 @@ static int r8192_wx_set_essid(struct net_device *dev, ...@@ -552,15 +567,17 @@ static int r8192_wx_set_essid(struct net_device *dev,
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
int ret; int ret;
if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){ if ((rtllib_act_scanning(priv->rtllib, false)) &&
; !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) {
; /* TODO - get rid of if */
} }
if (priv->bHwRadioOff == true){ if (priv->bHwRadioOff == true) {
printk("=========>%s():hw radio off,or Rf state is eRfOff, return\n",__func__); printk(KERN_INFO "=========>%s():hw radio off,or Rf state is "
"eRfOff, return\n", __func__);
return 0; return 0;
} }
down(&priv->wx_sem); down(&priv->wx_sem);
ret = rtllib_wx_set_essid(priv->rtllib,a,wrqu,b); ret = rtllib_wx_set_essid(priv->rtllib, a, wrqu, b);
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -682,12 +699,12 @@ static int r8192_wx_set_wap(struct net_device *dev, ...@@ -682,12 +699,12 @@ static int r8192_wx_set_wap(struct net_device *dev,
union iwreq_data *awrq, union iwreq_data *awrq,
char *extra) char *extra)
{ {
int ret; int ret;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){ if ((rtllib_act_scanning(priv->rtllib, false)) &&
; !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)) {
; /* TODO - get rid of if */
} }
if (priv->bHwRadioOff == true) if (priv->bHwRadioOff == true)
...@@ -695,7 +712,7 @@ static int r8192_wx_set_wap(struct net_device *dev, ...@@ -695,7 +712,7 @@ static int r8192_wx_set_wap(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
ret = rtllib_wx_set_wap(priv->rtllib,info,awrq,extra); ret = rtllib_wx_set_wap(priv->rtllib, info, awrq, extra);
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -710,7 +727,7 @@ static int r8192_wx_get_wap(struct net_device *dev, ...@@ -710,7 +727,7 @@ static int r8192_wx_get_wap(struct net_device *dev,
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
return rtllib_wx_get_wap(priv->rtllib,info,wrqu,extra); return rtllib_wx_get_wap(priv->rtllib, info, wrqu, extra);
} }
...@@ -731,22 +748,23 @@ static int r8192_wx_set_enc(struct net_device *dev, ...@@ -731,22 +748,23 @@ static int r8192_wx_set_enc(struct net_device *dev,
int ret; int ret;
struct rtllib_device *ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
u32 hwkey[4]={0,0,0,0}; u32 hwkey[4] = {0, 0, 0, 0};
u8 mask=0xff; u8 mask = 0xff;
u32 key_idx=0; u32 key_idx = 0;
u8 zero_addr[4][6] ={ {0x00,0x00,0x00,0x00,0x00,0x00}, u8 zero_addr[4][6] = {{0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00,0x00,0x00,0x00,0x00,0x01}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x01},
{0x00,0x00,0x00,0x00,0x00,0x02}, {0x00, 0x00, 0x00, 0x00, 0x00, 0x02},
{0x00,0x00,0x00,0x00,0x00,0x03} }; {0x00, 0x00, 0x00, 0x00, 0x00, 0x03} };
int i; int i;
if ((rtllib_act_scanning(priv->rtllib, false)) && !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN)){ if ((rtllib_act_scanning(priv->rtllib, false)) &&
; !(priv->rtllib->softmac_features & IEEE_SOFTMAC_SCAN))
} ; /* TODO - get rid of if */
if (priv->bHwRadioOff == true) if (priv->bHwRadioOff == true)
return 0; return 0;
if (!priv->up) return -ENETDOWN; if (!priv->up)
return -ENETDOWN;
priv->rtllib->wx_set_enc = 1; priv->rtllib->wx_set_enc = 1;
down(&priv->rtllib->ips_sem); down(&priv->rtllib->ips_sem);
...@@ -755,63 +773,66 @@ static int r8192_wx_set_enc(struct net_device *dev, ...@@ -755,63 +773,66 @@ static int r8192_wx_set_enc(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
RT_TRACE(COMP_SEC, "Setting SW wep key"); RT_TRACE(COMP_SEC, "Setting SW wep key");
ret = rtllib_wx_set_encode(priv->rtllib,info,wrqu,key); ret = rtllib_wx_set_encode(priv->rtllib, info, wrqu, key);
up(&priv->wx_sem); up(&priv->wx_sem);
if (wrqu->encoding.flags & IW_ENCODE_DISABLED) { if (wrqu->encoding.flags & IW_ENCODE_DISABLED) {
ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA; ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA;
CamResetAllEntry(dev); CamResetAllEntry(dev);
memset(priv->rtllib->swcamtable,0,sizeof(struct sw_cam_table)*32); memset(priv->rtllib->swcamtable, 0,
sizeof(struct sw_cam_table) * 32);
goto end_hw_sec; goto end_hw_sec;
} }
if (wrqu->encoding.length!=0){ if (wrqu->encoding.length != 0) {
for (i=0 ; i<4 ; i++){ for (i = 0; i < 4; i++) {
hwkey[i] |= key[4*i+0]&mask; hwkey[i] |= key[4*i+0]&mask;
if (i==1&&(4*i+1)==wrqu->encoding.length) mask=0x00; if (i == 1 && (4 * i + 1) == wrqu->encoding.length)
if (i==3&&(4*i+1)==wrqu->encoding.length) mask=0x00; mask = 0x00;
hwkey[i] |= (key[4*i+1]&mask)<<8; if (i == 3 && (4 * i + 1) == wrqu->encoding.length)
hwkey[i] |= (key[4*i+2]&mask)<<16; mask = 0x00;
hwkey[i] |= (key[4*i+3]&mask)<<24; hwkey[i] |= (key[4 * i + 1] & mask) << 8;
hwkey[i] |= (key[4 * i + 2] & mask) << 16;
hwkey[i] |= (key[4 * i + 3] & mask) << 24;
} }
#define CONF_WEP40 0x4 #define CONF_WEP40 0x4
#define CONF_WEP104 0x14 #define CONF_WEP104 0x14
switch (wrqu->encoding.flags & IW_ENCODE_INDEX){ switch (wrqu->encoding.flags & IW_ENCODE_INDEX) {
case 0: key_idx = ieee->tx_keyidx; break; case 0:
case 1: key_idx = 0; break; key_idx = ieee->tx_keyidx;
case 2: key_idx = 1; break; break;
case 3: key_idx = 2; break; case 1:
case 4: key_idx = 3; break; key_idx = 0;
default: break; break;
case 2:
key_idx = 1;
break;
case 3:
key_idx = 2;
break;
case 4:
key_idx = 3;
break;
default:
break;
} }
if (wrqu->encoding.length==0x5){ if (wrqu->encoding.length == 0x5) {
ieee->pairwise_key_type = KEY_TYPE_WEP40; ieee->pairwise_key_type = KEY_TYPE_WEP40;
EnableHWSecurityConfig8192(dev); EnableHWSecurityConfig8192(dev);
} }
else if (wrqu->encoding.length==0xd){ else if (wrqu->encoding.length == 0xd) {
ieee->pairwise_key_type = KEY_TYPE_WEP104; ieee->pairwise_key_type = KEY_TYPE_WEP104;
EnableHWSecurityConfig8192(dev); EnableHWSecurityConfig8192(dev);
setKey( dev, setKey(dev, key_idx, key_idx, KEY_TYPE_WEP104,
key_idx, zero_addr[key_idx], 0, hwkey);
key_idx, set_swcam(dev, key_idx, key_idx, KEY_TYPE_WEP104,
KEY_TYPE_WEP104, zero_addr[key_idx], 0, hwkey, 0);
zero_addr[key_idx],
0,
hwkey);
set_swcam( dev,
key_idx,
key_idx,
KEY_TYPE_WEP104,
zero_addr[key_idx],
0,
hwkey,
0);
} else { } else {
printk("wrong type in WEP, not WEP40 and WEP104\n"); printk(KERN_INFO "wrong type in WEP, not WEP40 and WEP104\n");
} }
} }
...@@ -820,13 +841,13 @@ static int r8192_wx_set_enc(struct net_device *dev, ...@@ -820,13 +841,13 @@ static int r8192_wx_set_enc(struct net_device *dev,
return ret; return ret;
} }
static int r8192_wx_set_scan_type(struct net_device *dev,
static int r8192_wx_set_scan_type(struct net_device *dev, struct iw_request_info *aa, union struct iw_request_info *aa,
iwreq_data *wrqu, char *p){ union iwreq_data *wrqu, char *p)
{
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
int *parms=(int*)p; int *parms = (int *)p;
int mode=parms[0]; int mode = parms[0];
if (priv->bHwRadioOff == true) if (priv->bHwRadioOff == true)
return 0; return 0;
...@@ -852,38 +873,32 @@ static int r8192_wx_set_retry(struct net_device *dev, ...@@ -852,38 +873,32 @@ static int r8192_wx_set_retry(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
if (wrqu->retry.flags & IW_RETRY_LIFETIME || if (wrqu->retry.flags & IW_RETRY_LIFETIME ||
wrqu->retry.disabled){ wrqu->retry.disabled) {
err = -EINVAL; err = -EINVAL;
goto exit; goto exit;
} }
if (!(wrqu->retry.flags & IW_RETRY_LIMIT)){ if (!(wrqu->retry.flags & IW_RETRY_LIMIT)) {
err = -EINVAL; err = -EINVAL;
goto exit; goto exit;
} }
if (wrqu->retry.value > R8192_MAX_RETRY){ if (wrqu->retry.value > R8192_MAX_RETRY) {
err= -EINVAL; err = -EINVAL;
goto exit; goto exit;
} }
if (wrqu->retry.flags & IW_RETRY_MAX) { if (wrqu->retry.flags & IW_RETRY_MAX) {
priv->retry_rts = wrqu->retry.value; priv->retry_rts = wrqu->retry.value;
DMESG("Setting retry for RTS/CTS data to %d", wrqu->retry.value); DMESG("Setting retry for RTS/CTS data to %d",
wrqu->retry.value);
}else { } else {
priv->retry_data = wrqu->retry.value; priv->retry_data = wrqu->retry.value;
DMESG("Setting retry for non RTS/CTS data to %d", wrqu->retry.value); DMESG("Setting retry for non RTS/CTS data to %d",
wrqu->retry.value);
} }
rtl8192_commit(dev); rtl8192_commit(dev);
/*
if (priv->up){
rtl8180_halt_adapter(dev);
rtl8180_rx_enable(dev);
rtl8180_tx_enable(dev);
}
*/
exit: exit:
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -910,8 +925,6 @@ static int r8192_wx_get_retry(struct net_device *dev, ...@@ -910,8 +925,6 @@ static int r8192_wx_get_retry(struct net_device *dev,
wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN; wrqu->retry.flags = IW_RETRY_LIMIT & IW_RETRY_MIN;
wrqu->retry.value = priv->retry_data; wrqu->retry.value = priv->retry_data;
} }
return 0; return 0;
} }
...@@ -941,13 +954,13 @@ static int r8192_wx_set_sens(struct net_device *dev, ...@@ -941,13 +954,13 @@ static int r8192_wx_set_sens(struct net_device *dev,
down(&priv->wx_sem); down(&priv->wx_sem);
if (priv->rf_set_sens == NULL) { if (priv->rf_set_sens == NULL) {
err= -1; /* we have not this support for this radio */ err = -1; /* we have not this support for this radio */
goto exit; goto exit;
} }
if (priv->rf_set_sens(dev, wrqu->sens.value) == 0) if (priv->rf_set_sens(dev, wrqu->sens.value) == 0)
priv->sens = wrqu->sens.value; priv->sens = wrqu->sens.value;
else else
err= -EINVAL; err = -EINVAL;
exit: exit:
up(&priv->wx_sem); up(&priv->wx_sem);
...@@ -959,9 +972,9 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, ...@@ -959,9 +972,9 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
int ret=0; int ret = 0;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
if (priv->bHwRadioOff == true) if (priv->bHwRadioOff == true)
return 0; return 0;
...@@ -974,96 +987,56 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, ...@@ -974,96 +987,56 @@ static int r8192_wx_set_enc_ext(struct net_device *dev,
up(&priv->rtllib->ips_sem); up(&priv->rtllib->ips_sem);
ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra); ret = rtllib_wx_set_encode_ext(ieee, info, wrqu, extra);
{ {
u8 broadcast_addr[6] = {0xff,0xff,0xff,0xff,0xff,0xff}; u8 broadcast_addr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
u8 zero[6] = {0}; u8 zero[6] = {0};
u32 key[4] = {0}; u32 key[4] = {0};
struct iw_encode_ext *ext = (struct iw_encode_ext *)extra; struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
struct iw_point *encoding = &wrqu->encoding; struct iw_point *encoding = &wrqu->encoding;
u8 idx = 0, alg = 0, group = 0; u8 idx = 0, alg = 0, group = 0;
if ((encoding->flags & IW_ENCODE_DISABLED) || if ((encoding->flags & IW_ENCODE_DISABLED) ||
ext->alg == IW_ENCODE_ALG_NONE) ext->alg == IW_ENCODE_ALG_NONE) {
{ ieee->pairwise_key_type = ieee->group_key_type
ieee->pairwise_key_type = ieee->group_key_type = KEY_TYPE_NA; = KEY_TYPE_NA;
CamResetAllEntry(dev); CamResetAllEntry(dev);
memset(priv->rtllib->swcamtable,0,sizeof(struct sw_cam_table)*32); memset(priv->rtllib->swcamtable, 0,
sizeof(struct sw_cam_table) * 32);
goto end_hw_sec; goto end_hw_sec;
} }
alg = (ext->alg == IW_ENCODE_ALG_CCMP)?KEY_TYPE_CCMP:ext->alg; alg = (ext->alg == IW_ENCODE_ALG_CCMP) ? KEY_TYPE_CCMP :
ext->alg;
idx = encoding->flags & IW_ENCODE_INDEX; idx = encoding->flags & IW_ENCODE_INDEX;
if (idx) if (idx)
idx --; idx--;
group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY; group = ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY;
if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) || (alg == KEY_TYPE_WEP40)) if ((!group) || (IW_MODE_ADHOC == ieee->iw_mode) ||
{ (alg == KEY_TYPE_WEP40)) {
if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40) ) if ((ext->key_len == 13) && (alg == KEY_TYPE_WEP40))
alg = KEY_TYPE_WEP104; alg = KEY_TYPE_WEP104;
ieee->pairwise_key_type = alg; ieee->pairwise_key_type = alg;
EnableHWSecurityConfig8192(dev); EnableHWSecurityConfig8192(dev);
} }
memcpy((u8*)key, ext->key, 16); memcpy((u8 *)key, ext->key, 16);
if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode !=2) ) if ((alg & KEY_TYPE_WEP40) && (ieee->auth_mode != 2)) {
{
if (ext->key_len == 13) if (ext->key_len == 13)
ieee->pairwise_key_type = alg = KEY_TYPE_WEP104; ieee->pairwise_key_type = alg = KEY_TYPE_WEP104;
setKey( dev, setKey(dev, idx, idx, alg, zero, 0, key);
idx, set_swcam(dev, idx, idx, alg, zero, 0, key, 0);
idx, } else if (group) {
alg,
zero,
0,
key);
set_swcam( dev,
idx,
idx,
alg,
zero,
0,
key,
0);
}
else if (group)
{
ieee->group_key_type = alg; ieee->group_key_type = alg;
setKey( dev, setKey(dev, idx, idx, alg, broadcast_addr, 0, key);
idx, set_swcam(dev, idx, idx, alg, broadcast_addr, 0,
idx, key, 0);
alg, } else {
broadcast_addr, if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) &&
0, ieee->pHTInfo->bCurrentHTSupport)
key);
set_swcam( dev,
idx,
idx,
alg,
broadcast_addr,
0,
key,
0);
}
else
{
if ((ieee->pairwise_key_type == KEY_TYPE_CCMP) && ieee->pHTInfo->bCurrentHTSupport){
write_nic_byte(dev, 0x173, 1); write_nic_byte(dev, 0x173, 1);
} setKey(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr,
setKey( dev, 0, key);
4, set_swcam(dev, 4, idx, alg, (u8 *)ieee->ap_mac_addr,
idx, 0, key, 0);
alg,
(u8*)ieee->ap_mac_addr,
0,
key);
set_swcam( dev,
4,
idx,
alg,
(u8*)ieee->ap_mac_addr,
0,
key,
0);
} }
...@@ -1079,7 +1052,7 @@ static int r8192_wx_set_auth(struct net_device *dev, ...@@ -1079,7 +1052,7 @@ static int r8192_wx_set_auth(struct net_device *dev,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *data, char *extra) union iwreq_data *data, char *extra)
{ {
int ret=0; int ret = 0;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
...@@ -1097,7 +1070,7 @@ static int r8192_wx_set_mlme(struct net_device *dev, ...@@ -1097,7 +1070,7 @@ static int r8192_wx_set_mlme(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
int ret=0; int ret = 0;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
...@@ -1133,16 +1106,15 @@ static int r8192_wx_get_gen_ie(struct net_device *dev, ...@@ -1133,16 +1106,15 @@ static int r8192_wx_get_gen_ie(struct net_device *dev,
{ {
int ret = 0; int ret = 0;
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) { if (ieee->wpa_ie_len == 0 || ieee->wpa_ie == NULL) {
data->data.length = 0; data->data.length = 0;
return 0; return 0;
} }
if (data->data.length < ieee->wpa_ie_len) { if (data->data.length < ieee->wpa_ie_len)
return -E2BIG; return -E2BIG;
}
data->data.length = ieee->wpa_ie_len; data->data.length = ieee->wpa_ie_len;
memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len); memcpy(extra, ieee->wpa_ie, ieee->wpa_ie_len);
...@@ -1156,26 +1128,25 @@ static int r8192_wx_set_PromiscuousMode(struct net_device *dev, ...@@ -1156,26 +1128,25 @@ static int r8192_wx_set_PromiscuousMode(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
u32 *info_buf = (u32*)(wrqu->data.pointer); u32 *info_buf = (u32 *)(wrqu->data.pointer);
u32 oid = info_buf[0]; u32 oid = info_buf[0];
u32 bPromiscuousOn = info_buf[1]; u32 bPromiscuousOn = info_buf[1];
u32 bFilterSourceStationFrame = info_buf[2]; u32 bFilterSourceStationFrame = info_buf[2];
if (OID_RT_INTEL_PROMISCUOUS_MODE == oid) if (OID_RT_INTEL_PROMISCUOUS_MODE == oid) {
{
ieee->IntelPromiscuousModeInfo.bPromiscuousOn = ieee->IntelPromiscuousModeInfo.bPromiscuousOn =
(bPromiscuousOn)? (true) : (false); (bPromiscuousOn) ? (true) : (false);
ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame = ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame =
(bFilterSourceStationFrame)? (true) : (false); (bFilterSourceStationFrame) ? (true) : (false);
(bPromiscuousOn) ?
(bPromiscuousOn) ? (rtllib_EnableIntelPromiscuousMode(dev, false)) : (rtllib_EnableIntelPromiscuousMode(dev, false)) :
(rtllib_DisableIntelPromiscuousMode(dev, false)); (rtllib_DisableIntelPromiscuousMode(dev, false));
printk("=======>%s(), on = %d, filter src sta = %d\n", __func__, printk(KERN_INFO "=======>%s(), on = %d, filter src sta = %d\n",
bPromiscuousOn, bFilterSourceStationFrame); __func__, bPromiscuousOn, bFilterSourceStationFrame);
} else { } else {
return -1; return -1;
} }
...@@ -1189,12 +1160,12 @@ static int r8192_wx_get_PromiscuousMode(struct net_device *dev, ...@@ -1189,12 +1160,12 @@ static int r8192_wx_get_PromiscuousMode(struct net_device *dev,
union iwreq_data *wrqu, char *extra) union iwreq_data *wrqu, char *extra)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
down(&priv->wx_sem); down(&priv->wx_sem);
snprintf(extra, 45, "PromiscuousMode:%d, FilterSrcSTAFrame:%d",\ snprintf(extra, 45, "PromiscuousMode:%d, FilterSrcSTAFrame:%d",
ieee->IntelPromiscuousModeInfo.bPromiscuousOn,\ ieee->IntelPromiscuousModeInfo.bPromiscuousOn,
ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame); ieee->IntelPromiscuousModeInfo.bFilterSourceStationFrame);
wrqu->data.length = strlen(extra) + 1; wrqu->data.length = strlen(extra) + 1;
...@@ -1205,8 +1176,7 @@ static int r8192_wx_get_PromiscuousMode(struct net_device *dev, ...@@ -1205,8 +1176,7 @@ static int r8192_wx_get_PromiscuousMode(struct net_device *dev,
#define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT] #define IW_IOCTL(x) [(x)-SIOCSIWCOMMIT]
static iw_handler r8192_wx_handlers[] = static iw_handler r8192_wx_handlers[] = {
{
IW_IOCTL(SIOCGIWNAME) = r8192_wx_get_name, IW_IOCTL(SIOCGIWNAME) = r8192_wx_get_name,
IW_IOCTL(SIOCSIWFREQ) = r8192_wx_set_freq, IW_IOCTL(SIOCSIWFREQ) = r8192_wx_set_freq,
IW_IOCTL(SIOCGIWFREQ) = r8192_wx_get_freq, IW_IOCTL(SIOCGIWFREQ) = r8192_wx_get_freq,
...@@ -1251,69 +1221,47 @@ static const struct iw_priv_args r8192_private_args[] = { ...@@ -1251,69 +1221,47 @@ static const struct iw_priv_args r8192_private_args[] = {
{ {
SIOCIWFIRSTPRIV + 0x0, SIOCIWFIRSTPRIV + 0x0,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_debugflag" IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_debugflag"
}, }, {
{
SIOCIWFIRSTPRIV + 0x1, SIOCIWFIRSTPRIV + 0x1,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan" IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "activescan"
}, }, {
{
SIOCIWFIRSTPRIV + 0x2, SIOCIWFIRSTPRIV + 0x2,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx"
} }, {
,
{
SIOCIWFIRSTPRIV + 0x3, SIOCIWFIRSTPRIV + 0x3,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset"
} }, {
,
{
SIOCIWFIRSTPRIV + 0x4, SIOCIWFIRSTPRIV + 0x4,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "force_mic_error" IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "force_mic_error"
} }, {
,
{
SIOCIWFIRSTPRIV + 0x5, SIOCIWFIRSTPRIV + 0x5,
IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT|IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT|IW_PRIV_SIZE_FIXED|1,
"firm_ver" "firm_ver"
} }, {
,
{
SIOCIWFIRSTPRIV + 0x6, SIOCIWFIRSTPRIV + 0x6,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE,
"set_power" "set_power"
} }, {
,
{
SIOCIWFIRSTPRIV + 0x9, SIOCIWFIRSTPRIV + 0x9,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE,
"radio" "radio"
} }, {
,
{
SIOCIWFIRSTPRIV + 0xa, SIOCIWFIRSTPRIV + 0xa,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE,
"lps_interv" "lps_interv"
} }, {
,
{
SIOCIWFIRSTPRIV + 0xb, SIOCIWFIRSTPRIV + 0xb,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE,
"lps_force" "lps_force"
} }, {
,
{
SIOCIWFIRSTPRIV + 0xc, SIOCIWFIRSTPRIV + 0xc,
0, IW_PRIV_TYPE_CHAR|2047, "adhoc_peer_list" 0, IW_PRIV_TYPE_CHAR|2047, "adhoc_peer_list"
} }, {
,
{
SIOCIWFIRSTPRIV + 0x16, SIOCIWFIRSTPRIV + 0x16,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "setpromisc" IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 3, 0, "setpromisc"
} }, {
,
{
SIOCIWFIRSTPRIV + 0x17, SIOCIWFIRSTPRIV + 0x17,
0,IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 45, "getpromisc" 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 45, "getpromisc"
} }
}; };
...@@ -1348,13 +1296,12 @@ static iw_handler r8192_private_handler[] = { ...@@ -1348,13 +1296,12 @@ static iw_handler r8192_private_handler[] = {
struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
{ {
struct r8192_priv *priv = rtllib_priv(dev); struct r8192_priv *priv = rtllib_priv(dev);
struct rtllib_device* ieee = priv->rtllib; struct rtllib_device *ieee = priv->rtllib;
struct iw_statistics* wstats = &priv->wstats; struct iw_statistics *wstats = &priv->wstats;
int tmp_level = 0; int tmp_level = 0;
int tmp_qual = 0; int tmp_qual = 0;
int tmp_noise = 0; int tmp_noise = 0;
if (ieee->state < RTLLIB_LINKED) if (ieee->state < RTLLIB_LINKED) {
{
wstats->qual.qual = 10; wstats->qual.qual = 10;
wstats->qual.level = 0; wstats->qual.level = 0;
wstats->qual.noise = -100; wstats->qual.noise = -100;
...@@ -1373,12 +1320,13 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev) ...@@ -1373,12 +1320,13 @@ struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev)
return wstats; return wstats;
} }
struct iw_handler_def r8192_wx_handlers_def={ struct iw_handler_def r8192_wx_handlers_def = {
.standard = r8192_wx_handlers, .standard = r8192_wx_handlers,
.num_standard = sizeof(r8192_wx_handlers) / sizeof(iw_handler), .num_standard = sizeof(r8192_wx_handlers) / sizeof(iw_handler),
.private = r8192_private_handler, .private = r8192_private_handler,
.num_private = sizeof(r8192_private_handler) / sizeof(iw_handler), .num_private = sizeof(r8192_private_handler) / sizeof(iw_handler),
.num_private_args = sizeof(r8192_private_args) / sizeof(struct iw_priv_args), .num_private_args = sizeof(r8192_private_args) /
sizeof(struct iw_priv_args),
.get_wireless_stats = r8192_get_wireless_stats, .get_wireless_stats = r8192_get_wireless_stats,
.private_args = (struct iw_priv_args *)r8192_private_args, .private_args = (struct iw_priv_args *)r8192_private_args,
}; };
...@@ -26,6 +26,6 @@ struct iw_statistics; ...@@ -26,6 +26,6 @@ struct iw_statistics;
extern struct iw_handler_def r8192_wx_handlers_def; extern struct iw_handler_def r8192_wx_handlers_def;
struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev); struct iw_statistics *r8192_get_wireless_stats(struct net_device *dev);
u16 rtl8192_11n_user_show_rates(struct net_device* dev); u16 rtl8192_11n_user_show_rates(struct net_device *dev);
#endif #endif
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