static void traffic_status_watchdog(struct adapter *padapter) { u8 bEnterPS; u8 bBusyTraffic = false, bTxBusyTraffic = false, bRxBusyTraffic = false; u8 bHigherBusyTraffic = false, bHigherBusyRxTraffic = false, bHigherBusyTxTraffic = false; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); /* */ /* Determine if our traffic is busy now */ /* */ if (check_fwstate(pmlmepriv, _FW_LINKED)) { if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 100 || pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 100) { bBusyTraffic = true; if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) bRxBusyTraffic = true; else bTxBusyTraffic = true; } /* Higher Tx/Rx data. */ if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 || pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000) { bHigherBusyTraffic = true; if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) bHigherBusyRxTraffic = true; else bHigherBusyTxTraffic = true; } /* check traffic for powersaving. */ if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8) || (pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) bEnterPS = false; else bEnterPS = true; /* LeisurePS only work in infra mode. */ if (bEnterPS) LPS_Enter(padapter); else LPS_Leave(padapter); } else { LPS_Leave(padapter); } pmlmepriv->LinkDetectInfo.NumRxOkInPeriod = 0; pmlmepriv->LinkDetectInfo.NumTxOkInPeriod = 0; pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod = 0; pmlmepriv->LinkDetectInfo.bBusyTraffic = bBusyTraffic; pmlmepriv->LinkDetectInfo.bTxBusyTraffic = bTxBusyTraffic; pmlmepriv->LinkDetectInfo.bRxBusyTraffic = bRxBusyTraffic; pmlmepriv->LinkDetectInfo.bHigherBusyTraffic = bHigherBusyTraffic; pmlmepriv->LinkDetectInfo.bHigherBusyRxTraffic = bHigherBusyRxTraffic; pmlmepriv->LinkDetectInfo.bHigherBusyTxTraffic = bHigherBusyTxTraffic; }
static void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type) { struct pwrctrl_priv *pwrpriv = &padapter->pwrctrlpriv; struct mlme_priv *pmlmepriv = &(padapter->mlmepriv); u8 mstatus; if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) || (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) return; switch (lps_ctrl_type) { case LPS_CTRL_SCAN: if (check_fwstate(pmlmepriv, _FW_LINKED) == true) { /* connect */ LPS_Leave(padapter); } break; case LPS_CTRL_JOINBSS: LPS_Leave(padapter); break; case LPS_CTRL_CONNECT: mstatus = 1;/* connect */ /* Reset LPS Setting */ padapter->pwrctrlpriv.LpsIdleCount = 0; rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus)); break; case LPS_CTRL_DISCONNECT: mstatus = 0;/* disconnect */ LPS_Leave(padapter); rtw_hal_set_hwreg(padapter, HW_VAR_H2C_FW_JOINBSSRPT, (u8 *)(&mstatus)); break; case LPS_CTRL_SPECIAL_PACKET: /* DBG_88E("LPS_CTRL_SPECIAL_PACKET\n"); */ pwrpriv->DelayLPSLastTimeStamp = jiffies; LPS_Leave(padapter); break; case LPS_CTRL_LEAVE: LPS_Leave(padapter); break; default: break; } }
// // Description: Leave all power save mode: LPS, FwLPS, IPS if needed. // Move code to function by tynli. 2010.03.26. // void LeaveAllPowerSaveMode(IN PADAPTER Adapter) { struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv); u32 LPSLeaveTimeOut = 10000; //u32 IPSLeaveTimeOut = 10000; _func_enter_; //DBG_8192C("%s.....\n",__FUNCTION__); if (check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE) { //connect #ifdef CONFIG_P2P p2p_ps_wk_cmd(Adapter, P2P_PS_DISABLE, 0); #endif //CONFIG_P2P #ifdef CONFIG_LPS //DBG_8192C("==> leave LPS.......\n"); LPS_Leave(Adapter); if (Adapter->pwrctrlpriv.bLeisurePs) { BOOLEAN bAwake = _TRUE; Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bAwake)); while(!bAwake) { rtw_usleep_os(100); LPSLeaveTimeOut--; if(LPSLeaveTimeOut <= 0) { DBG_8192C("Wait for FW LPS leave too long!!! LPSLeaveTimeOut = %d\n", LPSLeaveTimeOut ); break; } Adapter->HalFunc.GetHwRegHandler(Adapter, HW_VAR_FWLPS_RF_ON, (u8 *)(&bAwake)); } } #endif } else { if(Adapter->pwrctrlpriv.rf_pwrstate== rf_off) { #ifdef CONFIG_AUTOSUSPEND if(Adapter->registrypriv.usbss_enable) { #if (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,35)) usb_disable_autosuspend(Adapter->dvobjpriv.pusbdev); #elif (LINUX_VERSION_CODE>=KERNEL_VERSION(2,6,22) && LINUX_VERSION_CODE<=KERNEL_VERSION(2,6,34)) Adapter->dvobjpriv.pusbdev->autosuspend_disabled = Adapter->bDisableAutosuspend;//autosuspend disabled by the user #endif } else #endif { /* #ifdef CONFIG_IPS if(_FALSE == ips_leave(Adapter)) { DBG_8192C("======> ips_leave fail.............\n"); } #endif */ } } } _func_exit_; }