void Dot11d_UpdateCountryIe(struct rtllib_device *dev, u8 *pTaddr, u16 CoutryIeLen, u8* pCoutryIe) { PRT_DOT11D_INFO pDot11dInfo = GET_DOT11D_INFO(dev); #if defined CONFIG_CRDA && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30) #else u8 i, j, NumTriples, MaxChnlNum; PCHNL_TXPOWER_TRIPLE pTriple; memset(pDot11dInfo->channel_map, 0, MAX_CHANNEL_NUMBER+1); memset(pDot11dInfo->MaxTxPwrDbmList, 0xFF, MAX_CHANNEL_NUMBER+1); MaxChnlNum = 0; NumTriples = (CoutryIeLen - 3) / 3; pTriple = (PCHNL_TXPOWER_TRIPLE)(pCoutryIe + 3); for(i = 0; i < NumTriples; i++) { if(MaxChnlNum >= pTriple->FirstChnl) { printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........1\n"); return; } if(MAX_CHANNEL_NUMBER < (pTriple->FirstChnl + pTriple->NumChnls)) { printk("Dot11d_UpdateCountryIe(): Invalid country IE, skip it........2\n"); return; } for(j = 0 ; j < pTriple->NumChnls; j++) { pDot11dInfo->channel_map[pTriple->FirstChnl + j] = 1; pDot11dInfo->MaxTxPwrDbmList[pTriple->FirstChnl + j] = pTriple->MaxTxPowerInDbm; MaxChnlNum = pTriple->FirstChnl + j; } pTriple = (PCHNL_TXPOWER_TRIPLE)((u8*)pTriple + 3); } #if 0 printk("Channel List:"); for(i=1; i<= MAX_CHANNEL_NUMBER; i++) if(pDot11dInfo->channel_map[i] > 0) printk(" %d", i); printk("\n"); #endif #endif UPDATE_CIE_SRC(dev, pTaddr); pDot11dInfo->CountryIeLen = CoutryIeLen; memcpy(pDot11dInfo->CountryIeBuf, pCoutryIe,CoutryIeLen); pDot11dInfo->State = DOT11D_STATE_LEARNED; #if defined CONFIG_CRDA && LINUX_VERSION_CODE > KERNEL_VERSION(2,6,30) queue_delayed_work_rsl(dev->wq, &dev->softmac_hint11d_wq, 0); #endif }
void rtl8192_hw_wakeup(struct net_device* dev) { struct r8192_priv *priv = rtllib_priv(dev); unsigned long flags = 0; u8 queue_index = 0; unsigned long queue_len = 0; struct sk_buff* skb = NULL; #ifdef CONFIG_ASPM_OR_D3 PRT_POWER_SAVE_CONTROL pPSC = (PRT_POWER_SAVE_CONTROL)(&(priv->rtllib->PowerSaveControl)); #endif spin_lock_irqsave(&priv->rf_ps_lock,flags); if (priv->RFChangeInProgress) { spin_unlock_irqrestore(&priv->rf_ps_lock,flags); RT_TRACE(COMP_RF, "rtl8192_hw_wakeup(): RF Change in progress! \n"); printk("rtl8192_hw_wakeup(): RF Change in progress! schedule wake up task again\n"); queue_delayed_work_rsl(priv->rtllib->wq,&priv->rtllib->hw_wakeup_wq,MSECS(10)); return; } spin_unlock_irqrestore(&priv->rf_ps_lock,flags); #ifdef CONFIG_ASPM_OR_D3 if (pPSC->RegRfPsLevel & RT_RF_LPS_LEVEL_ASPM) { RT_DISABLE_ASPM(dev); RT_CLEAR_PS_LEVEL(pPSC, RT_RF_LPS_LEVEL_ASPM); } #endif RT_TRACE(COMP_PS, "%s()============>come to wake up\n", __FUNCTION__); MgntActSet_RF_State(dev, eRfOn, RF_CHANGE_BY_PS,false); for (queue_index=0; queue_index<=VO_QUEUE; queue_index++){ queue_len = skb_queue_len(&priv->rtllib->skb_waitQ[queue_index]); if (queue_len) { printk("=====>%s(): no need to ps,wake up!! %d queue is not empty\n", __FUNCTION__,queue_index); skb = skb_dequeue(&priv->rtllib->skb_waitQ[queue_index]); if (skb == NULL) { RT_TRACE(COMP_ERR,"rtl8192_hw_wakeup():skb is NULL\n"); return; } if ((priv->rtllib->b4ac_Uapsd & 0x0f) !=0) { if ( IsMgntQosData(skb->data) || IsMgntQosNull(skb->data) ) { if(!priv->rtllib->bin_service_period && get_qos_queueID_maskAPSD(queue_index, priv->rtllib->b4ac_Uapsd)) { RT_TRACE(COMP_PS, "rtl8192_hw_wakeup(): >>>>>>>>>> Enter APSD service period >>>>>>>>>>\n"); printk("rtl8192_hw_wakeup(): >>>>>>>>>> Enter APSD service period >>>>>>>>>>\n"); priv->rtllib->bin_service_period = true; } } } priv->rtllib->softmac_data_hard_start_xmit(skb,dev,0/* rate useless now*/); } } }
int rtl8192se_send_scan_cmd(struct net_device *dev, bool start) { struct r8192_priv *priv = rtllib_priv(dev); if(start){ priv->rtllib->scan_watch_dog =0; #if 0 queue_delayed_work_rsl(priv->priv_wq,&priv->hw_scan_simu_wq,0); #else rtl8192se_set_scan_cmd(dev, start); #endif } else { #if 0 rtl8192se_rx_surveydone_cmd(dev); #else rtl8192se_set_scan_cmd(dev, start); #endif } return true; }
void rtl8192_hw_to_sleep(struct net_device *dev, u32 th, u32 tl) { #ifdef _RTL8192_EXT_PATCH_ struct r8192_priv *priv = rtllib_priv(dev); u32 rb = jiffies, sleep_cost = MSECS(8+16+7), delta = 0; unsigned long flags; if((tl > rb) && (th > 0)) return; spin_lock_irqsave(&priv->ps_lock,flags); if (tl >= sleep_cost) tl -= sleep_cost; else if (th > 0) { tl = 0xffffffff - sleep_cost + tl; th--; } else { spin_unlock_irqrestore(&priv->ps_lock,flags); return; } if (tl > rb) { delta = tl - rb; } else if (th > 0) { delta = 0xffffffff - rb + tl; th --; } else { spin_unlock_irqrestore(&priv->ps_lock,flags); return; } if (delta <= MSECS(MIN_SLEEP_TIME)) { spin_unlock_irqrestore(&priv->ps_lock,flags); printk("too short to sleep::%x, %x, %lx\n",tl, rb, MSECS(MIN_SLEEP_TIME)); return; } if(delta > MSECS(MAX_SLEEP_TIME)) { spin_unlock_irqrestore(&priv->ps_lock,flags); printk("========>too long to sleep:%x, %x, %lx\n", tl, rb, MSECS(MAX_SLEEP_TIME)); return; } RT_TRACE(COMP_LPS, "==============>%s(): wake up time is %d,%d\n",__FUNCTION__,delta,jiffies_to_msecs(delta)); queue_delayed_work_rsl(priv->rtllib->wq,&priv->rtllib->hw_wakeup_wq,delta); queue_delayed_work_rsl(priv->rtllib->wq, (void *)&priv->rtllib->hw_sleep_wq,0); spin_unlock_irqrestore(&priv->ps_lock,flags); #else struct r8192_priv *priv = rtllib_priv(dev); u32 rb = jiffies; unsigned long flags; spin_lock_irqsave(&priv->ps_lock,flags); tl -= MSECS(8+16+7); if(((tl>=rb)&& (tl-rb) <= MSECS(MIN_SLEEP_TIME)) ||((rb>tl)&& (rb-tl) < MSECS(MIN_SLEEP_TIME))) { spin_unlock_irqrestore(&priv->ps_lock,flags); printk("too short to sleep::%x, %x, %lx\n",tl, rb, MSECS(MIN_SLEEP_TIME)); return; } if(((tl > rb) && ((tl-rb) > MSECS(MAX_SLEEP_TIME)))|| ((tl < rb) && (tl>MSECS(69)) && ((rb-tl) > MSECS(MAX_SLEEP_TIME)))|| ((tl<rb)&&(tl<MSECS(69))&&((tl+0xffffffff-rb)>MSECS(MAX_SLEEP_TIME)))) { printk("========>too long to sleep:%x, %x, %lx\n", tl, rb, MSECS(MAX_SLEEP_TIME)); spin_unlock_irqrestore(&priv->ps_lock,flags); return; } { u32 tmp = (tl>rb)?(tl-rb):(rb-tl); queue_delayed_work_rsl(priv->rtllib->wq, &priv->rtllib->hw_wakeup_wq,tmp); } queue_delayed_work_rsl(priv->rtllib->wq, (void *)&priv->rtllib->hw_sleep_wq,0); spin_unlock_irqrestore(&priv->ps_lock,flags); #endif }