VOID PeerPublicAction(RTMP_ADAPTER *pAd, MLME_QUEUE_ELEM *Elem) { UCHAR Action = Elem->Msg[LENGTH_802_11+1]; #if defined(CONFIG_HOTSPOT) && defined(CONFIG_AP_SUPPORT) if (!HotSpotEnable(pAd, Elem, ACTION_STATE_MESSAGES)) #endif if ((Elem->Wcid >= MAX_LEN_OF_MAC_TABLE) ) return; switch(Action) { #ifdef DOT11_N_SUPPORT #ifdef DOT11N_DRAFT3 case ACTION_BSS_2040_COEXIST: /* Format defined in IEEE 7.4.7a.1 in 11n Draf3.03*/ { /*UCHAR BssCoexist;*/ BSS_2040_COEXIST_ELEMENT *pCoexistInfo; BSS_2040_COEXIST_IE *pBssCoexistIe; BSS_2040_INTOLERANT_CH_REPORT *pIntolerantReport = NULL; if (Elem->MsgLen <= (LENGTH_802_11 + sizeof(BSS_2040_COEXIST_ELEMENT)) ) { DBGPRINT(RT_DEBUG_ERROR, ("ACTION - 20/40 BSS Coexistence Management Frame length too short! len = %ld!\n", Elem->MsgLen)); break; } DBGPRINT(RT_DEBUG_TRACE, ("ACTION - 20/40 BSS Coexistence Management action----> \n")); hex_dump("CoexistenceMgmtFrame", Elem->Msg, Elem->MsgLen); pCoexistInfo = (BSS_2040_COEXIST_ELEMENT *) &Elem->Msg[LENGTH_802_11+2]; /*hex_dump("CoexistInfo", (PUCHAR)pCoexistInfo, sizeof(BSS_2040_COEXIST_ELEMENT));*/ if (Elem->MsgLen >= (LENGTH_802_11 + sizeof(BSS_2040_COEXIST_ELEMENT) + sizeof(BSS_2040_INTOLERANT_CH_REPORT))) { pIntolerantReport = (BSS_2040_INTOLERANT_CH_REPORT *)((PUCHAR)pCoexistInfo + sizeof(BSS_2040_COEXIST_ELEMENT)); } /*hex_dump("IntolerantReport ", (PUCHAR)pIntolerantReport, sizeof(BSS_2040_INTOLERANT_CH_REPORT));*/ if(pAd->CommonCfg.bBssCoexEnable == FALSE || (pAd->CommonCfg.bForty_Mhz_Intolerant == TRUE)) { DBGPRINT(RT_DEBUG_TRACE, ("20/40 BSS CoexMgmt=%d, bForty_Mhz_Intolerant=%d, ignore this action!!\n", pAd->CommonCfg.bBssCoexEnable, pAd->CommonCfg.bForty_Mhz_Intolerant)); break; } pBssCoexistIe = (BSS_2040_COEXIST_IE *)(&pCoexistInfo->BssCoexistIe); #ifdef CONFIG_AP_SUPPORT IF_DEV_CONFIG_OPMODE_ON_AP(pAd) { BOOLEAN bNeedFallBack = FALSE; /*ApPublicAction(pAd, Elem);*/ if ((pBssCoexistIe->field.BSS20WidthReq ==1) || (pBssCoexistIe->field.Intolerant40 == 1)) { bNeedFallBack = TRUE; DBGPRINT(RT_DEBUG_TRACE, ("BSS_2040_COEXIST: BSS20WidthReq=%d, Intolerant40=%d!\n", pBssCoexistIe->field.BSS20WidthReq, pBssCoexistIe->field.Intolerant40)); } else if ((pIntolerantReport) && (pIntolerantReport->Len > 1) /*&& (pIntolerantReport->RegulatoryClass == get_regulatory_class(pAd))*/) { int i; UCHAR *ptr; INT retVal; BSS_COEX_CH_RANGE coexChRange; ptr = pIntolerantReport->ChList; bNeedFallBack = TRUE; DBGPRINT(RT_DEBUG_TRACE, ("The pIntolerantReport len = %d, chlist=", pIntolerantReport->Len)); for(i =0 ; i < (pIntolerantReport->Len -1); i++, ptr++) { DBGPRINT(RT_DEBUG_TRACE, ("%d,", *ptr)); } DBGPRINT(RT_DEBUG_TRACE, ("\n")); retVal = GetBssCoexEffectedChRange(pAd, &coexChRange); if (retVal == TRUE) { ptr = pIntolerantReport->ChList; bNeedFallBack = FALSE; DBGPRINT(RT_DEBUG_TRACE, ("Check IntolerantReport Channel List in our effectedChList(%d~%d)\n", pAd->ChannelList[coexChRange.effectChStart].Channel, pAd->ChannelList[coexChRange.effectChEnd].Channel)); for(i =0 ; i < (pIntolerantReport->Len -1); i++, ptr++) { UCHAR chEntry; chEntry = *ptr; if (chEntry >= pAd->ChannelList[coexChRange.effectChStart].Channel && chEntry <= pAd->ChannelList[coexChRange.effectChEnd].Channel) { DBGPRINT(RT_DEBUG_TRACE, ("Found Intolerant channel in effect range=%d!\n", *ptr)); bNeedFallBack = TRUE; break; } } DBGPRINT(RT_DEBUG_TRACE, ("After CoexChRange Check, bNeedFallBack=%d!\n", bNeedFallBack)); } if (bNeedFallBack) { pBssCoexistIe->field.Intolerant40 = 1; pBssCoexistIe->field.BSS20WidthReq = 1; } } if (bNeedFallBack) { int apidx; NdisMoveMemory((PUCHAR)&pAd->CommonCfg.LastBSSCoexist2040, (PUCHAR)pBssCoexistIe, sizeof(BSS_2040_COEXIST_IE)); pAd->CommonCfg.Bss2040CoexistFlag |= BSS_2040_COEXIST_INFO_SYNC; if (!(pAd->CommonCfg.Bss2040CoexistFlag & BSS_2040_COEXIST_TIMER_FIRED)) { DBGPRINT(RT_DEBUG_TRACE, ("Fire the Bss2040CoexistTimer with timeout=%ld!\n", pAd->CommonCfg.Dot11BssWidthChanTranDelay)); pAd->CommonCfg.Bss2040CoexistFlag |= BSS_2040_COEXIST_TIMER_FIRED; /* More 5 sec for the scan report of STAs.*/ RTMPSetTimer(&pAd->CommonCfg.Bss2040CoexistTimer, (pAd->CommonCfg.Dot11BssWidthChanTranDelay + 5) * 1000); } else { DBGPRINT(RT_DEBUG_TRACE, ("Already fallback to 20MHz, Extend the timeout of Bss2040CoexistTimer!\n")); /* More 5 sec for the scan report of STAs.*/ RTMPModTimer(&pAd->CommonCfg.Bss2040CoexistTimer, (pAd->CommonCfg.Dot11BssWidthChanTranDelay + 5) * 1000); } apidx = pAd->MacTab.Content[Elem->Wcid].apidx; for (apidx = 0; apidx < pAd->ApCfg.BssidNum; apidx++) SendBSS2040CoexistMgmtAction(pAd, MCAST_WCID, apidx, 0); } } #endif /* CONFIG_AP_SUPPORT */ } break; #endif /* DOT11N_DRAFT3 */ #endif /* DOT11_N_SUPPORT */ #if defined(CONFIG_HOTSPOT) && defined(CONFIG_AP_SUPPORT) case ACTION_GAS_INIT_REQ: if (HotSpotEnable(pAd, Elem, ACTION_STATE_MESSAGES)) ReceiveGASInitReq(pAd, Elem); break; case ACTION_GAS_CB_REQ: if (HotSpotEnable(pAd, Elem, ACTION_STATE_MESSAGES)) ReceiveGASCBReq(pAd, Elem); break; #endif case ACTION_WIFI_DIRECT: break; default: break; } }
VOID PeriodicPollingModeDetect( IN PVOID SystemSpecific1, IN PVOID FunctionContext, IN PVOID SystemSpecific2, IN PVOID SystemSpecific3){ unsigned long irqFlags; UCHAR modem_status=0; RTMP_ADAPTER *pAd = (RTMP_ADAPTER *)FunctionContext; POS_COOKIE _pObj = (POS_COOKIE)(pAd->OS_Cookie); os_TCIfQuery(0x0002, &modem_status, NULL); if ((modem_status==0x08)||(modem_status==0x10)) { if(!(dslStateChg & (1<<0))){ // printk("Detect DSL status:0x%02x into polling mode!!\r\n", modem_status); RTMP_INT_LOCK(&pAd->irq_lock, irqFlags); dslStateChg|=(1<<0); RTMP_INT_UNLOCK(&pAd->irq_lock, irqFlags); // disable enterrupt tc3162_disable_irq(_pObj->pci_dev->irq); } schedule_work(&pAd->Pollingmode.PollingDataBH); //slow down the POLLING MODE DETECT while the dmt in wait init state //pAd->PollingModeDetect.expires = jiffies + POLLING_MODE_DETECT_INTV; RTMPModTimer(&pAd->Pollingmode.PollingModeDetect, 10); pAd->Pollingmode.PollingModeDetectRunning = TRUE; return; } else{ if(dslStateChg & (1<<0)){ tc3162_enable_irq(_pObj->pci_dev->irq); // printk("Detect DSL status:0x%02x into INT mode!!\r\n", modem_status); RTMP_INT_LOCK(&pAd->irq_lock, irqFlags); dslStateChg &=~(1<<0); RTMP_INT_UNLOCK(&pAd->irq_lock, irqFlags); } } RTMPModTimer(&pAd->Pollingmode.PollingModeDetect, POLLING_MODE_DETECT_INTV); pAd->Pollingmode.PollingModeDetectRunning = TRUE; #ifdef WSC_AP_SUPPORT { static int lastWscStatus=0; PWSC_CTRL pWscControl= &pAd->ApCfg.MBSSID[MAIN_MBSSID].WscControl; wscTimerRunning=pWscControl->Wsc2MinsTimerRunning; wscStatus=pWscControl->WscStatus; if((wscStatus==STATUS_WSC_CONFIGURED)&&(lastWscStatus!=STATUS_WSC_CONFIGURED)){ #ifndef LED_WPSSPEC_COMPLY wsc_done = 10; #else wsc_done = 600; #endif //ledTurnOff(LED_WLAN_WPS_ACT_STATUS);//xyyou??? //ledTurnOn(LED_WLAN_WPS_STATUS); //ledTurnOn(LED_WLAN_WPS_NOACT_STATUS); } lastWscStatus=wscStatus; } #endif return; }