diff options
author | David S. Miller <davem@davemloft.net> | 2010-03-15 23:23:54 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-03-15 23:23:54 (GMT) |
commit | 4961e02f1999e1c3468c09b2669c94d7c3ae82a8 (patch) | |
tree | 44c15abb09d7ba5e17a9aba95ee246648b1c1a8a /drivers/staging/rtl8192e/r8192E_wx.c | |
parent | d14a0ebda7d3daede1a99c01527affb9ceaa4c22 (diff) | |
parent | a3d3203e4bb40f253b1541e310dc0f9305be7c84 (diff) | |
download | linux-fsl-qoriq-4961e02f1999e1c3468c09b2669c94d7c3ae82a8.tar.xz |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Diffstat (limited to 'drivers/staging/rtl8192e/r8192E_wx.c')
-rw-r--r-- | drivers/staging/rtl8192e/r8192E_wx.c | 212 |
1 files changed, 142 insertions, 70 deletions
diff --git a/drivers/staging/rtl8192e/r8192E_wx.c b/drivers/staging/rtl8192e/r8192E_wx.c index d1eb892..0b0f39c 100644 --- a/drivers/staging/rtl8192e/r8192E_wx.c +++ b/drivers/staging/rtl8192e/r8192E_wx.c @@ -22,7 +22,7 @@ #include "r8192E_hw.h" #include "r8192E_wx.h" #ifdef ENABLE_DOT11D -#include "dot11d.h" +#include "ieee80211/dot11d.h" #endif #define RATE_COUNT 12 @@ -70,6 +70,9 @@ static int r8192_wx_set_rate(struct net_device *dev, int ret; struct r8192_priv *priv = ieee80211_priv(dev); + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); ret = ieee80211_wx_set_rate(priv->ieee80211,info,wrqu,extra); @@ -87,6 +90,9 @@ static int r8192_wx_set_rts(struct net_device *dev, int ret; struct r8192_priv *priv = ieee80211_priv(dev); + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); ret = ieee80211_wx_set_rts(priv->ieee80211,info,wrqu,extra); @@ -111,6 +117,9 @@ static int r8192_wx_set_power(struct net_device *dev, int ret; struct r8192_priv *priv = ieee80211_priv(dev); + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); ret = ieee80211_wx_set_power(priv->ieee80211,info,wrqu,extra); @@ -290,6 +299,9 @@ static int r8192_wx_set_rawtx(struct net_device *dev, struct r8192_priv *priv = ieee80211_priv(dev); int ret; + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); ret = ieee80211_wx_set_rawtx(priv->ieee80211, info, wrqu, extra); @@ -325,6 +337,9 @@ static int r8192_wx_set_crcmon(struct net_device *dev, int enable = (parms[0] > 0); short prev = priv->crcmon; + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); if(enable) @@ -352,6 +367,9 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, RT_RF_POWER_STATE rtState; int ret; + if(priv->bHwRadioOff == true) + return 0; + rtState = priv->ieee80211->eRFPowerState; down(&priv->wx_sem); #ifdef ENABLE_IPS @@ -366,8 +384,10 @@ static int r8192_wx_set_mode(struct net_device *dev, struct iw_request_info *a, return -1; } else{ - printk("=========>%s(): IPSLeave\n",__FUNCTION__); + RT_TRACE(COMP_ERR, "%s(): IPSLeave\n",__FUNCTION__); + down(&priv->ieee80211->ips_sem); IPSLeave(dev); + up(&priv->ieee80211->ips_sem); } } } @@ -425,7 +445,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, */ /* ~5 Mb/s real (802.11b) */ - range->throughput = 5 * 1000 * 1000; + range->throughput = 130 * 1000 * 1000; // TODO: Not used in 802.11b? // range->min_nwid; /* Minimal NWID we are able to set */ @@ -468,7 +488,7 @@ static int rtl8180_wx_get_range(struct net_device *dev, range->pmt_flags = IW_POWER_TIMEOUT; range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R; range->we_version_compiled = WIRELESS_EXT; - range->we_version_source = 16; + range->we_version_source = 18; // range->retry_capa; /* What retry options are supported */ // range->retry_flags; /* How to decode max/min retry limit */ @@ -517,7 +537,12 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, struct ieee80211_device* ieee = priv->ieee80211; RT_RF_POWER_STATE rtState; int ret; + + if(priv->bHwRadioOff == true) + return 0; + rtState = priv->ieee80211->eRFPowerState; + if(!priv->up) return -ENETDOWN; if (priv->ieee80211->LinkDetectInfo.bBusyTraffic == true) return -EAGAIN; @@ -547,8 +572,10 @@ static int r8192_wx_set_scan(struct net_device *dev, struct iw_request_info *a, return -1; } else{ - printk("=========>%s(): IPSLeave\n",__FUNCTION__); + //RT_TRACE(COMP_PS, "%s(): IPSLeave\n",__FUNCTION__); + down(&priv->ieee80211->ips_sem); IPSLeave(dev); + up(&priv->ieee80211->ips_sem); } } } @@ -580,6 +607,9 @@ static int r8192_wx_get_scan(struct net_device *dev, struct iw_request_info *a, int ret; struct r8192_priv *priv = ieee80211_priv(dev); + if(priv->bHwRadioOff == true) + return 0; + if(!priv->up) return -ENETDOWN; down(&priv->wx_sem); @@ -599,23 +629,16 @@ static int r8192_wx_set_essid(struct net_device *dev, RT_RF_POWER_STATE rtState; int ret; + if(priv->bHwRadioOff == true) + return 0; + rtState = priv->ieee80211->eRFPowerState; down(&priv->wx_sem); + #ifdef ENABLE_IPS - if(priv->ieee80211->PowerSaveControl.bInactivePs){ - if(rtState == eRfOff){ - if(priv->ieee80211->RfOffReason > RF_CHANGE_BY_IPS) - { - RT_TRACE(COMP_ERR, "%s(): RF is OFF.\n",__FUNCTION__); - up(&priv->wx_sem); - return -1; - } - else{ - printk("=========>%s(): IPSLeave\n",__FUNCTION__); - IPSLeave(dev); - } - } - } + down(&priv->ieee80211->ips_sem); + IPSLeave(dev); + up(&priv->ieee80211->ips_sem); #endif ret = ieee80211_wx_set_essid(priv->ieee80211,a,wrqu,b); @@ -650,6 +673,9 @@ static int r8192_wx_set_freq(struct net_device *dev, struct iw_request_info *a, int ret; struct r8192_priv *priv = ieee80211_priv(dev); + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); ret = ieee80211_wx_set_freq(priv->ieee80211, a, wrqu, b); @@ -673,6 +699,9 @@ static int r8192_wx_set_frag(struct net_device *dev, { struct r8192_priv *priv = ieee80211_priv(dev); + if(priv->bHwRadioOff == true) + return 0; + if (wrqu->frag.disabled) priv->ieee80211->fts = DEFAULT_FRAG_THRESHOLD; else { @@ -711,8 +740,16 @@ static int r8192_wx_set_wap(struct net_device *dev, struct r8192_priv *priv = ieee80211_priv(dev); // struct sockaddr *temp = (struct sockaddr *)awrq; + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); +#ifdef ENABLE_IPS + down(&priv->ieee80211->ips_sem); + IPSLeave(dev); + up(&priv->ieee80211->ips_sem); +#endif ret = ieee80211_wx_set_wap(priv->ieee80211,info,awrq,extra); up(&priv->wx_sem); @@ -753,14 +790,24 @@ static int r8192_wx_set_enc(struct net_device *dev, u32 hwkey[4]={0,0,0,0}; u8 mask=0xff; 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,0x02}, {0x00,0x00,0x00,0x00,0x00,0x03} }; int i; + if(priv->bHwRadioOff == true) + return 0; + if(!priv->up) return -ENETDOWN; + priv->ieee80211->wx_set_enc = 1; +#ifdef ENABLE_IPS + down(&priv->ieee80211->ips_sem); + IPSLeave(dev); + up(&priv->ieee80211->ips_sem); +#endif + down(&priv->wx_sem); RT_TRACE(COMP_SEC, "Setting SW wep key"); @@ -768,7 +815,6 @@ static int r8192_wx_set_enc(struct net_device *dev, up(&priv->wx_sem); - //sometimes, the length is zero while we do not type key value if(wrqu->encoding.length!=0){ @@ -868,6 +914,8 @@ static int r8192_wx_set_enc(struct net_device *dev, } #endif + priv->ieee80211->wx_set_enc = 0; + return ret; } @@ -893,6 +941,9 @@ static int r8192_wx_set_retry(struct net_device *dev, struct r8192_priv *priv = ieee80211_priv(dev); int err = 0; + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); if (wrqu->retry.flags & IW_RETRY_LIFETIME || @@ -985,6 +1036,10 @@ static int r8192_wx_set_sens(struct net_device *dev, struct r8192_priv *priv = ieee80211_priv(dev); short err = 0; + + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); //DMESG("attempt to set sensivity to %ddb",wrqu->sens.value); if(priv->rf_set_sens == NULL) { @@ -1011,7 +1066,19 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, struct r8192_priv *priv = ieee80211_priv(dev); struct ieee80211_device* ieee = priv->ieee80211; + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); + + priv->ieee80211->wx_set_enc = 1; + +#ifdef ENABLE_IPS + down(&priv->ieee80211->ips_sem); + IPSLeave(dev); + up(&priv->ieee80211->ips_sem); +#endif + ret = ieee80211_wx_set_encode_ext(ieee, info, wrqu, extra); { @@ -1091,6 +1158,7 @@ static int r8192_wx_set_enc_ext(struct net_device *dev, } end_hw_sec: + priv->ieee80211->wx_set_enc = 0; up(&priv->wx_sem); return ret; @@ -1102,6 +1170,10 @@ static int r8192_wx_set_auth(struct net_device *dev, int ret=0; //printk("====>%s()\n", __FUNCTION__); struct r8192_priv *priv = ieee80211_priv(dev); + + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); ret = ieee80211_wx_set_auth(priv->ieee80211, info, &(data->param), extra); up(&priv->wx_sem); @@ -1116,6 +1188,10 @@ static int r8192_wx_set_mlme(struct net_device *dev, int ret=0; struct r8192_priv *priv = ieee80211_priv(dev); + + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); ret = ieee80211_wx_set_mlme(priv->ieee80211, info, wrqu, extra); up(&priv->wx_sem); @@ -1129,6 +1205,10 @@ static int r8192_wx_set_gen_ie(struct net_device *dev, //printk("====>%s(), len:%d\n", __FUNCTION__, data->length); int ret=0; struct r8192_priv *priv = ieee80211_priv(dev); + + if(priv->bHwRadioOff == true) + return 0; + down(&priv->wx_sem); ret = ieee80211_wx_set_gen_ie(priv->ieee80211, extra, data->data.length); up(&priv->wx_sem); @@ -1142,6 +1222,42 @@ static int dummy(struct net_device *dev, struct iw_request_info *a, return -1; } +// check ac/dc status with the help of user space application */ +static int r8192_wx_adapter_power_status(struct net_device *dev, + struct iw_request_info *info, + union iwreq_data *wrqu, char *extra) +{ + struct r8192_priv *priv = ieee80211_priv(dev); +#ifdef ENABLE_LPS + PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->ieee80211->PowerSaveControl)); + struct ieee80211_device* ieee = priv->ieee80211; +#endif + down(&priv->wx_sem); + +#ifdef ENABLE_LPS + RT_TRACE(COMP_POWER, "%s(): %s\n",__FUNCTION__, (*extra == 6)?"DC power":"AC power"); + // ieee->ps shall not be set under DC mode, otherwise it conflict + // with Leisure power save mode setting. + // + if(*extra || priv->force_lps) { + priv->ps_force = false; + pPSC->bLeisurePs = true; + } else { + //LZM for PS-Poll AID issue. 090429 + if(priv->ieee80211->state == IEEE80211_LINKED) + LeisurePSLeave(dev); + + priv->ps_force = true; + pPSC->bLeisurePs = false; + ieee->ps = *extra; + } + +#endif + up(&priv->wx_sem); + return 0; + +} + static iw_handler r8192_wx_handlers[] = { @@ -1231,72 +1347,28 @@ static const struct iw_priv_args r8192_private_args[] = { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "rawtx" } -#ifdef JOHN_IOCTL , { SIOCIWFIRSTPRIV + 0x3, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readRF" + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" + } , { SIOCIWFIRSTPRIV + 0x4, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeRF" - } - , - { - SIOCIWFIRSTPRIV + 0x5, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readBB" - } - , - { - SIOCIWFIRSTPRIV + 0x6, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writeBB" - } - , - { - SIOCIWFIRSTPRIV + 0x7, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "readnicb" - } - , - { - SIOCIWFIRSTPRIV + 0x8, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "writenicb" - } - , - { - SIOCIWFIRSTPRIV + 0x9, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo" - } - -#endif - , - { - SIOCIWFIRSTPRIV + 0x3, - IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "forcereset" - + IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED|1, IW_PRIV_TYPE_NONE, + "set_power" } }; static iw_handler r8192_private_handler[] = { -// r8192_wx_set_monitor, /* SIOCIWFIRSTPRIV */ r8192_wx_set_crcmon, /*SIOCIWSECONDPRIV*/ -// r8192_wx_set_forceassociate, -// r8192_wx_set_beaconinterval, -// r8192_wx_set_monitor_type, r8192_wx_set_scan_type, r8192_wx_set_rawtx, -#ifdef JOHN_IOCTL - r8192_wx_read_regs, - r8192_wx_write_regs, - r8192_wx_read_bb, - r8192_wx_write_bb, - r8192_wx_read_nicb, - r8192_wx_write_nicb, - r8192_wx_get_ap_status -#endif r8192_wx_force_reset, + r8192_wx_adapter_power_status, }; //#if WIRELESS_EXT >= 17 |