/* ======================================================================== Routine Description: Open a virtual network interface. Arguments: dev_p which WLAN network interface Return Value: 0: open successfully otherwise: open fail Note: ======================================================================== */ INT ApCli_VirtualIF_Open( IN PNET_DEV dev_p) { UCHAR ifIndex; PRTMP_ADAPTER pAd; pAd = RTMP_OS_NETDEV_GET_PRIV(dev_p); ASSERT(pAd); DBGPRINT(RT_DEBUG_TRACE, ("%s: ===> %s\n", __FUNCTION__, RTMP_OS_NETDEV_GET_DEVNAME(dev_p))); if (VIRTUAL_IF_UP(pAd) != 0) return -1; // increase MODULE use count RT_MOD_INC_USE_COUNT(); for (ifIndex = 0; ifIndex < MAX_APCLI_NUM; ifIndex++) { if (pAd->ApCfg.ApCliTab[ifIndex].dev == dev_p) { RTMP_OS_NETDEV_START_QUEUE(dev_p); ApCliIfUp(pAd); } } return 0; } /* End of ApCli_VirtualIF_Open */
/* ========================================================================== Description: This routine is executed every second - 1. Decide the overall channel quality 2. Check if need to upgrade the TX rate to any client 3. perform MAC table maintenance, including ageout no-traffic clients, and release packet buffer in PSQ is fail to TX in time. ========================================================================== */ VOID APMlmePeriodicExec( PRTMP_ADAPTER pAd) { /* Reqeust by David 2005/05/12 It make sense to disable Adjust Tx Power on AP mode, since we can't take care all of the client's situation ToDo: need to verify compatibility issue with WiFi product. */ #ifdef CARRIER_DETECTION_SUPPORT if (isCarrierDetectExist(pAd) == TRUE) { PCARRIER_DETECTION_STRUCT pCarrierDetect = &pAd->CommonCfg.CarrierDetect; if (pCarrierDetect->OneSecIntCount < pCarrierDetect->CarrierGoneThreshold) { pCarrierDetect->CD_State = CD_NORMAL; pCarrierDetect->recheck = pCarrierDetect->recheck1; if (pCarrierDetect->Debug != RT_DEBUG_TRACE) { DBGPRINT(RT_DEBUG_TRACE, ("Carrier gone\n")); /* start all TX actions. */ APMakeAllBssBeacon(pAd); APUpdateAllBeaconFrame(pAd); AsicEnableBssSync(pAd); } else { printk("Carrier gone\n"); } } pCarrierDetect->OneSecIntCount = 0; } #endif /* CARRIER_DETECTION_SUPPORT */ RTMP_CHIP_HIGH_POWER_TUNING(pAd, &pAd->ApCfg.RssiSample); /* Disable Adjust Tx Power for WPA WiFi-test. */ /* Because high TX power results in the abnormal disconnection of Intel BG-STA. */ /*#ifndef WIFI_TEST */ /* if (pAd->CommonCfg.bWiFiTest == FALSE) */ /* for SmartBit 64-byte stream test */ /* removed based on the decision of Ralink congress at 2011/7/06 */ /* if (pAd->MacTab.Size > 0) */ AsicAdjustTxPower(pAd); /*#endif // WIFI_TEST */ #ifdef RTMP_TEMPERATURE_COMPENSATION MT76x0_TemperatureCompensation(pAd); #endif /* RTMP_TEMPERATURE_COMPENSATION */ /* BBP TUNING: dynamic tune BBP R66 to find a balance between sensibility and noise isolation */ /* AsicBbpTuning2(pAd); */ /* walk through MAC table, see if switching TX rate is required */ /* MAC table maintenance */ if (pAd->Mlme.PeriodicRound % MLME_TASK_EXEC_MULTIPLE == 0) { /* one second timer */ MacTableMaintenance(pAd); #ifdef FPGA_MODE if (pAd->fpga_tr_stop) { UINT32 mac_val; /* enable/disable tx/rx*/ RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &mac_val); switch (pAd->fpga_tr_stop) { case 3: //stop tx + rx mac_val &= (~0xc); break; case 2: // stop rx mac_val &= (~0x8); break; case 1: // stop tx mac_val &= (~0x4); break; case 4: default: mac_val |= 0x0c; break; } RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, mac_val); } #endif /* FGPA_MODE */ RTMPMaintainPMKIDCache(pAd); #ifdef WDS_SUPPORT WdsTableMaintenance(pAd); #endif /* WDS_SUPPORT */ #ifdef CLIENT_WDS CliWds_ProxyTabMaintain(pAd); #endif /* CLIENT_WDS */ } APUpdateCapabilityAndErpIe(pAd); #ifdef APCLI_SUPPORT if (pAd->Mlme.OneSecPeriodicRound % 2 == 0) ApCliIfMonitor(pAd); if (pAd->Mlme.OneSecPeriodicRound % 2 == 1) ApCliIfUp(pAd); { INT loop; ULONG Now32; UINT32 MaxWcidNum = MAX_LEN_OF_MAC_TABLE; #ifdef MAC_REPEATER_SUPPORT if (pAd->ApCfg.bMACRepeaterEn) { MaxWcidNum = MAX_MAC_TABLE_SIZE_WITH_REPEATER; #ifdef APCLI_AUTO_CONNECT_SUPPORT RTMPRepeaterReconnectionCheck(pAd); #endif /* APCLI_AUTO_CONNECT_SUPPORT */ } #endif /* MAC_REPEATER_SUPPORT */ NdisGetSystemUpTime(&Now32); for (loop = 0; loop < MAX_APCLI_NUM; loop++) { PAPCLI_STRUCT pApCliEntry = &pAd->ApCfg.ApCliTab[loop]; if ((pApCliEntry->Valid == TRUE) && (pApCliEntry->MacTabWCID < MaxWcidNum)) { /* update channel quality for Roaming and UI LinkQuality display */ MlmeCalculateChannelQuality(pAd, &pAd->MacTab.Content[pApCliEntry->MacTabWCID], Now32); } } } #endif /* APCLI_SUPPORT */ #ifdef DOT11_N_SUPPORT if (pAd->CommonCfg.bHTProtect) { /*APUpdateCapabilityAndErpIe(pAd); */ APUpdateOperationMode(pAd); if (pAd->CommonCfg.IOTestParm.bRTSLongProtOn == FALSE) { AsicUpdateProtect(pAd, (USHORT)pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, pAd->MacTab.fAnyStationNonGF); } } #endif /* DOT11_N_SUPPORT */ #ifdef A_BAND_SUPPORT if ( (pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == 1) ) { #ifdef DFS_SUPPORT ApRadarDetectPeriodic(pAd); #else pAd->Dot11_H.InServiceMonitorCount++; if (pAd->Dot11_H.RDMode == RD_SILENCE_MODE) { if (pAd->Dot11_H.RDCount++ > pAd->Dot11_H.ChMovingTime) { AsicEnableBssSync(pAd); pAd->Dot11_H.RDMode = RD_NORMAL_MODE; } } #endif /* !DFS_SUPPORT */ } #endif /* A_BAND_SUPPORT */ /* resume Improved Scanning*/ if ((pAd->ApCfg.bImprovedScan) && (!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_BSS_SCAN_IN_PROGRESS)) && (pAd->Mlme.ApSyncMachine.CurrState == AP_SCAN_PENDING)) { MLME_SCAN_REQ_STRUCT ScanReq; AsicDisableSync(pAd); RTMPZeroMemory(ScanReq.Ssid, MAX_LEN_OF_SSID); ScanReq.SsidLen = pAd->MlmeAux.SsidLen; NdisMoveMemory(ScanReq.Ssid, pAd->MlmeAux.Ssid, ScanReq.SsidLen); ScanReq.BssType = BSS_ANY; #ifdef APCLI_CONNECTION_TRIAL ScanReq.ScanType = FAST_SCAN_ACTIVE; #else ScanReq.ScanType = SCAN_ACTIVE; #endif /* APCLI_CONNECTION_TRIAL */ MlmeEnqueue(pAd, AP_SYNC_STATE_MACHINE, APMT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq, 0); RTMP_MLME_HANDLER(pAd); DBGPRINT(RT_DEBUG_TRACE, ("bImprovedScan ............. Resume for bImprovedScan, SCAN_PENDING .............. \n")); } }
/* ========================================================================== Description: This routine is executed every second - 1. Decide the overall channel quality 2. Check if need to upgrade the TX rate to any client 3. perform MAC table maintenance, including ageout no-traffic clients, and release packet buffer in PSQ is fail to TX in time. ========================================================================== */ VOID APMlmePeriodicExec( PRTMP_ADAPTER pAd) { /* Reqeust by David 2005/05/12 It make sense to disable Adjust Tx Power on AP mode, since we can't take care all of the client's situation ToDo: need to verify compatibility issue with WiFi product. */ #ifdef CARRIER_DETECTION_SUPPORT if (isCarrierDetectExist(pAd) == TRUE) { PCARRIER_DETECTION_STRUCT pCarrierDetect = &pAd->CommonCfg.CarrierDetect; if (pCarrierDetect->OneSecIntCount < pCarrierDetect->CarrierGoneThreshold) { pCarrierDetect->CD_State = CD_NORMAL; pCarrierDetect->recheck = pCarrierDetect->recheck1; if (pCarrierDetect->Debug != RT_DEBUG_TRACE) { DBGPRINT(RT_DEBUG_TRACE, ("Carrier gone\n")); /* start all TX actions. */ APMakeAllBssBeacon(pAd); APUpdateAllBeaconFrame(pAd); AsicEnableBssSync(pAd, pAd->CommonCfg.BeaconPeriod); } else { DBGPRINT(RT_DEBUG_TRACE, ("Carrier gone\n")); } } pCarrierDetect->OneSecIntCount = 0; } #endif /* CARRIER_DETECTION_SUPPORT */ RTMP_CHIP_HIGH_POWER_TUNING(pAd, &pAd->ApCfg.RssiSample); /* Disable Adjust Tx Power for WPA WiFi-test. */ /* Because high TX power results in the abnormal disconnection of Intel BG-STA. */ /*#ifndef WIFI_TEST */ /* if (pAd->CommonCfg.bWiFiTest == FALSE) */ /* for SmartBit 64-byte stream test */ /* removed based on the decision of Ralink congress at 2011/7/06 */ /* if (pAd->MacTab.Size > 0) */ RTMP_CHIP_ASIC_ADJUST_TX_POWER(pAd); /*#endif // WIFI_TEST */ RTMP_CHIP_ASIC_TEMPERATURE_COMPENSATION(pAd); /* walk through MAC table, see if switching TX rate is required */ /* MAC table maintenance */ if (pAd->Mlme.PeriodicRound % MLME_TASK_EXEC_MULTIPLE == 0) { /* one second timer */ MacTableMaintenance(pAd); #ifdef CONFIG_FPGA_MODE if (pAd->fpga_ctl.fpga_tr_stop) { INT enable = FALSE, ctrl_type; /* enable/disable tx/rx*/ switch (pAd->fpga_ctl.fpga_tr_stop) { case 3: //stop tx + rx ctrl_type = ASIC_MAC_TXRX; break; case 2: // stop rx ctrl_type = ASIC_MAC_RX; break; case 1: // stop tx ctrl_type = ASIC_MAC_TX; break; case 4: default: enable = TRUE; ctrl_type = ASIC_MAC_TXRX; break; } AsicSetMacTxRx(pAd, ctrl_type, enable); } #endif /* CONFIG_FPGA_MODE */ RTMPMaintainPMKIDCache(pAd); #ifdef WDS_SUPPORT WdsTableMaintenance(pAd); #endif /* WDS_SUPPORT */ #ifdef CLIENT_WDS CliWds_ProxyTabMaintain(pAd); #endif /* CLIENT_WDS */ } #ifdef AP_SCAN_SUPPORT AutoChannelSelCheck(pAd); #endif /* AP_SCAN_SUPPORT */ APUpdateCapabilityAndErpIe(pAd); #ifdef APCLI_SUPPORT if (pAd->Mlme.OneSecPeriodicRound % 2 == 0) ApCliIfMonitor(pAd); if (pAd->Mlme.OneSecPeriodicRound % 2 == 1 #ifdef APCLI_AUTO_CONNECT_SUPPORT && (pAd->ApCfg.ApCliAutoConnectChannelSwitching == FALSE) #endif /* APCLI_AUTO_CONNECT_SUPPORT */ ) { ApCliIfUp(pAd); } { INT loop; ULONG Now32; #ifdef MAC_REPEATER_SUPPORT if (pAd->ApCfg.bMACRepeaterEn) { RTMPRepeaterReconnectionCheck(pAd); } #endif /* MAC_REPEATER_SUPPORT */ NdisGetSystemUpTime(&Now32); for (loop = 0; loop < MAX_APCLI_NUM; loop++) { PAPCLI_STRUCT pApCliEntry = &pAd->ApCfg.ApCliTab[loop]; if ((pApCliEntry->Valid == TRUE) && (pApCliEntry->MacTabWCID < MAX_LEN_OF_MAC_TABLE)) { /* update channel quality for Roaming and UI LinkQuality display */ MlmeCalculateChannelQuality(pAd, &pAd->MacTab.Content[pApCliEntry->MacTabWCID], Now32); } } } #endif /* APCLI_SUPPORT */ #ifdef DOT11_N_SUPPORT if (pAd->CommonCfg.bHTProtect) { /*APUpdateCapabilityAndErpIe(pAd); */ APUpdateOperationMode(pAd); if (pAd->CommonCfg.IOTestParm.bRTSLongProtOn == FALSE) AsicUpdateProtect(pAd, (USHORT)pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, pAd->MacTab.fAnyStationNonGF); } #endif /* DOT11_N_SUPPORT */ #ifdef A_BAND_SUPPORT if ( (pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == 1)) { #ifdef DFS_SUPPORT ApRadarDetectPeriodic(pAd); #else pAd->Dot11_H.InServiceMonitorCount++; if (pAd->Dot11_H.RDMode == RD_SILENCE_MODE) { if (pAd->Dot11_H.RDCount++ > pAd->Dot11_H.ChMovingTime) { AsicEnableBssSync(pAd, pAd->CommonCfg.BeaconPeriod); pAd->Dot11_H.RDMode = RD_NORMAL_MODE; } } #endif /* !DFS_SUPPORT */ } #endif /* A_BAND_SUPPORT */ }
/* ========================================================================== Description: This routine is executed every second - 1. Decide the overall channel quality 2. Check if need to upgrade the TX rate to any client 3. perform MAC table maintenance, including ageout no-traffic clients, and release packet buffer in PSQ is fail to TX in time. ========================================================================== */ VOID APMlmePeriodicExec( PRTMP_ADAPTER pAd) { /* Reqeust by David 2005/05/12 It make sense to disable Adjust Tx Power on AP mode, since we can't take care all of the client's situation ToDo: need to verify compatibility issue with WiFi product. */ /* We return here in ATE mode, because the statistics that ATE need are not collected via this routine. */ #ifdef RALINK_ATE if (ATE_ON(pAd)) return; #endif /* RALINK_ATE */ #ifdef CARRIER_DETECTION_SUPPORT if (isCarrierDetectExist(pAd) == TRUE) { if (pAd->CommonCfg.CarrierDetect.OneSecIntCount < pAd->CommonCfg.CarrierDetect.CarrierGoneThreshold) { pAd->CommonCfg.CarrierDetect.CD_State = CD_NORMAL; pAd->CommonCfg.CarrierDetect.recheck = pAd->CommonCfg.CarrierDetect.recheck1; if (pAd->CommonCfg.CarrierDetect.Debug != RT_DEBUG_TRACE) { DBGPRINT(RT_DEBUG_TRACE, ("Carrier gone\n")); /* start all TX actions. */ APMakeAllBssBeacon(pAd); APUpdateAllBeaconFrame(pAd); AsicEnableBssSync(pAd); } else { printk("Carrier gone\n"); } } } pAd->CommonCfg.CarrierDetect.OneSecIntCount = 0; #endif /* CARRIER_DETECTION_SUPPORT */ RTMP_CHIP_HIGH_POWER_TUNING(pAd, &pAd->ApCfg.RssiSample); /* Disable Adjust Tx Power for WPA WiFi-test. */ /* Because high TX power results in the abnormal disconnection of Intel BG-STA. */ /*#ifndef WIFI_TEST */ /* if (pAd->CommonCfg.bWiFiTest == FALSE) */ /* for SmartBit 64-byte stream test */ /* removed based on the decision of Ralink congress at 2011/7/06 */ /* if (pAd->MacTab.Size > 0) */ AsicAdjustTxPower(pAd); /*#endif // WIFI_TEST */ /* BBP TUNING: dynamic tune BBP R66 to find a balance between sensibility and noise isolation */ /* AsicBbpTuning2(pAd); */ /* walk through MAC table, see if switching TX rate is required */ /* MAC table maintenance */ if (pAd->Mlme.PeriodicRound % MLME_TASK_EXEC_MULTIPLE == 0) { /* one second timer */ MacTableMaintenance(pAd); RTMPMaintainPMKIDCache(pAd); #ifdef WDS_SUPPORT WdsTableMaintenance(pAd); #endif /* WDS_SUPPORT */ #ifdef CLIENT_WDS CliWds_ProxyTabMaintain(pAd); #endif /* CLIENT_WDS */ } APUpdateCapabilityAndErpIe(pAd); #ifdef APCLI_SUPPORT if (pAd->Mlme.OneSecPeriodicRound % 2 == 0) ApCliIfMonitor(pAd); if (pAd->Mlme.OneSecPeriodicRound % 2 == 1) ApCliIfUp(pAd); { INT loop; ULONG Now32; NdisGetSystemUpTime(&Now32); for (loop = 0; loop < MAX_APCLI_NUM; loop++) { PAPCLI_STRUCT pApCliEntry = &pAd->ApCfg.ApCliTab[loop]; if ((pApCliEntry->Valid == TRUE) && (pApCliEntry->MacTabWCID < MAX_LEN_OF_MAC_TABLE)) { /* update channel quality for Roaming and UI LinkQuality display */ MlmeCalculateChannelQuality(pAd, &pAd->MacTab.Content[pApCliEntry->MacTabWCID], Now32); } } } #endif /* APCLI_SUPPORT */ #ifdef DOT11_N_SUPPORT if (pAd->CommonCfg.bHTProtect) { /*APUpdateCapabilityAndErpIe(pAd); */ APUpdateOperationMode(pAd); if (pAd->CommonCfg.IOTestParm.bRTSLongProtOn == FALSE) { AsicUpdateProtect(pAd, (USHORT)pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, pAd->MacTab.fAnyStationNonGF); } } #endif /* DOT11_N_SUPPORT */ #ifdef A_BAND_SUPPORT if ( (pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == 1) ) { #ifdef DFS_SUPPORT ApRadarDetectPeriodic(pAd); #else pAd->CommonCfg.InServiceMonitorCount++; if (pAd->CommonCfg.RDMode == RD_SILENCE_MODE) { if (pAd->CommonCfg.RDCount++ > pAd->CommonCfg.ChMovingTime) { AsicEnableBssSync(pAd); pAd->CommonCfg.RDMode = RD_NORMAL_MODE; } } #endif /* DFS_SUPPORT */ } #endif /* A_BAND_SUPPORT */ }
/* ========================================================================== Description: This routine is executed every second - 1. Decide the overall channel quality 2. Check if need to upgrade the TX rate to any client 3. perform MAC table maintenance, including ageout no-traffic clients, and release packet buffer in PSQ is fail to TX in time. ========================================================================== */ VOID APMlmePeriodicExec( PRTMP_ADAPTER pAd) { /* Reqeust by David 2005/05/12 It make sense to disable Adjust Tx Power on AP mode, since we can't take care all of the client's situation ToDo: need to verify compatibility issue with WiFi product. */ #ifdef CARRIER_DETECTION_SUPPORT if (isCarrierDetectExist(pAd) == TRUE) { PCARRIER_DETECTION_STRUCT pCarrierDetect = &pAd->CommonCfg.CarrierDetect; if (pCarrierDetect->OneSecIntCount < pCarrierDetect->CarrierGoneThreshold) { pCarrierDetect->CD_State = CD_NORMAL; pCarrierDetect->recheck = pCarrierDetect->recheck1; if (pCarrierDetect->Debug != RT_DEBUG_TRACE) { DBGPRINT(RT_DEBUG_TRACE, ("Carrier gone\n")); /* start all TX actions. */ APMakeAllBssBeacon(pAd); APUpdateAllBeaconFrame(pAd); AsicEnableBssSync(pAd); } else { DBGPRINT(RT_DEBUG_TRACE, ("Carrier gone\n")); } } pCarrierDetect->OneSecIntCount = 0; } #endif /* CARRIER_DETECTION_SUPPORT */ RTMP_CHIP_HIGH_POWER_TUNING(pAd, &pAd->ApCfg.RssiSample); /* Disable Adjust Tx Power for WPA WiFi-test. */ /* Because high TX power results in the abnormal disconnection of Intel BG-STA. */ /*#ifndef WIFI_TEST */ /* if (pAd->CommonCfg.bWiFiTest == FALSE) */ /* for SmartBit 64-byte stream test */ /* removed based on the decision of Ralink congress at 2011/7/06 */ /* if (pAd->MacTab.Size > 0) */ #ifdef RT6352 if (IS_RT6352(pAd)) RT6352_AsicAdjustTxPower(pAd); else #endif /* RT6352 */ AsicAdjustTxPower(pAd); /*#endif // WIFI_TEST */ #ifdef THERMAL_PROTECT_SUPPORT thermal_protection(pAd); #endif /* THERMAL_PROTECT_SUPPORT */ RTMP_CHIP_ASIC_TEMPERATURE_COMPENSATION(pAd); /* walk through MAC table, see if switching TX rate is required */ /* MAC table maintenance */ if (pAd->Mlme.PeriodicRound % MLME_TASK_EXEC_MULTIPLE == 0) { /* one second timer */ MacTableMaintenance(pAd); #ifdef CONFIG_FPGA_MODE if (pAd->fpga_ctl.fpga_tr_stop) { UINT32 mac_val; /* enable/disable tx/rx*/ RTMP_IO_READ32(pAd, MAC_SYS_CTRL, &mac_val); switch (pAd->fpga_ctl.fpga_tr_stop) { case 3: //stop tx + rx mac_val &= (~0xc); break; case 2: // stop rx mac_val &= (~0x8); break; case 1: // stop tx mac_val &= (~0x4); break; case 4: default: mac_val |= 0x0c; break; } RTMP_IO_WRITE32(pAd, MAC_SYS_CTRL, mac_val); } #endif /* CONFIG_FPGA_MODE */ RTMPMaintainPMKIDCache(pAd); #ifdef WDS_SUPPORT WdsTableMaintenance(pAd); #endif /* WDS_SUPPORT */ #ifdef CLIENT_WDS CliWds_ProxyTabMaintain(pAd); #endif /* CLIENT_WDS */ } #ifdef AP_SCAN_SUPPORT AutoChannelSelCheck(pAd); #endif /* AP_SCAN_SUPPORT */ APUpdateCapabilityAndErpIe(pAd); #ifdef APCLI_SUPPORT if (pAd->Mlme.OneSecPeriodicRound % 2 == 0) ApCliIfMonitor(pAd); if (pAd->Mlme.OneSecPeriodicRound % 2 == 1) #ifdef APCLI_AUTO_CONNECT_SUPPORT if (pAd->ApCfg.ApCliAutoConnectChannelSwitching == FALSE) #endif /* APCLI_AUTO_CONNECT_SUPPORT */ ApCliIfUp(pAd); { INT loop; ULONG Now32; #ifdef APCLI_CERT_SUPPORT BOOLEAN IsUseBA = TRUE; #endif /* APCLI_CERT_SUPPORT */ #ifdef MAC_REPEATER_SUPPORT if (pAd->ApCfg.bMACRepeaterEn == TRUE) { #ifdef APCLI_AUTO_CONNECT_SUPPORT RTMPRepeaterReconnectionCheck(pAd); #endif /* APCLI_AUTO_CONNECT_SUPPORT */ } #endif /* MAC_REPEATER_SUPPORT */ NdisGetSystemUpTime(&Now32); for (loop = 0; loop < MAX_APCLI_NUM; loop++) { PAPCLI_STRUCT pApCliEntry = &pAd->ApCfg.ApCliTab[loop]; if (pAd->ApCfg.ApCliTab[loop].bBlockAssoc ==TRUE && pAd->ApCfg.ApCliTab[loop].bBlockAssoc && RTMP_TIME_AFTER(Now32, pAd->ApCfg.ApCliTab[loop].LastMicErrorTime + (60*OS_HZ))) pAd->ApCfg.ApCliTab[loop].bBlockAssoc = FALSE; if ((pApCliEntry->Valid == TRUE) && (pApCliEntry->MacTabWCID < MAX_LEN_OF_MAC_TABLE)) { /* update channel quality for Roaming and UI LinkQuality display */ MlmeCalculateChannelQuality(pAd, &pAd->MacTab.Content[pApCliEntry->MacTabWCID], Now32); /* WPA MIC error should block association attempt for 60 seconds*/ #ifdef APCLI_CERT_SUPPORT if (pAd->bApCliCertTest == TRUE) { PMAC_TABLE_ENTRY pEntry = &pAd->MacTab.Content[pApCliEntry->MacTabWCID]; struct wifi_dev *wdev = NULL; wdev = &pApCliEntry->wdev; if (pEntry->RXBAbitmap == 0 && pEntry->TXBAbitmap == 0) IsUseBA = FALSE; if( wdev->DesiredHtPhyInfo.bHtEnable && IsUseBA == FALSE ) { EDCA_AC_CFG_STRUC Ac2Cfg, Ac1Cfg; RTMP_IO_READ32(pAd, EDCA_AC2_CFG, &Ac2Cfg.word); RTMP_IO_READ32(pAd, EDCA_AC1_CFG, &Ac1Cfg.word); if ((pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VO] == 0) && (pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BK] >= 1000) && (pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VI] == 0)) { /*5.2.27 T7 */ if (Ac1Cfg.field.Aifsn!=0x1) { Ac1Cfg.field.Aifsn = 0x1; RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); printk("Change EDCA_AC1_CFG to %x \n", Ac1Cfg.word); } } else if ((pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VO] == 0) && (pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BK] == 0) && (pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VI] == 0) && (pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BE] < 10)) { /* restore default parameter of BK*/ if (Ac1Cfg.field.Aifsn!=0x7) { Ac1Cfg.field.Aifsn = 0x7; RTMP_IO_WRITE32(pAd, EDCA_AC1_CFG, Ac1Cfg.word); printk("Restore EDCA_AC1_CFG to %x \n", Ac1Cfg.word); } } pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BE] = 0; pAd->RalinkCounters.OneSecOsTxCount[QID_AC_BK] = 0; pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VI] = 0; pAd->RalinkCounters.OneSecOsTxCount[QID_AC_VO] = 0; } } #endif /* APCLI_CERT_SUPPORT */ } } } #endif /* APCLI_SUPPORT */ #ifdef DOT11_N_SUPPORT if (pAd->CommonCfg.bHTProtect) { /*APUpdateCapabilityAndErpIe(pAd); */ APUpdateOperationMode(pAd); if (pAd->CommonCfg.IOTestParm.bRTSLongProtOn == FALSE) { AsicUpdateProtect(pAd, (USHORT)pAd->CommonCfg.AddHTInfo.AddHtInfo2.OperaionMode, ALLN_SETPROTECT, FALSE, pAd->MacTab.fAnyStationNonGF); } } #endif /* DOT11_N_SUPPORT */ #ifdef A_BAND_SUPPORT if ( (pAd->CommonCfg.Channel > 14) && (pAd->CommonCfg.bIEEE80211H == 1) ) { #ifdef DFS_SUPPORT ApRadarDetectPeriodic(pAd); #else pAd->Dot11_H.InServiceMonitorCount++; if (pAd->Dot11_H.RDMode == RD_SILENCE_MODE) { if (pAd->Dot11_H.RDCount++ > pAd->Dot11_H.ChMovingTime) { AsicEnableBssSync(pAd); pAd->Dot11_H.RDMode = RD_NORMAL_MODE; } } #endif /* !DFS_SUPPORT */ } #endif /* A_BAND_SUPPORT */ #ifdef APCLI_SUPPORT #ifdef DOT11_N_SUPPORT #ifdef DOT11N_DRAFT3 #ifdef APCLI_CERT_SUPPORT /* Perform 20/40 BSS COEX scan every Dot11BssWidthTriggerScanInt */ if (APCLI_IF_UP_CHECK(pAd, 0) && (pAd->bApCliCertTest == TRUE)) { if ((OPSTATUS_TEST_FLAG(pAd, fOP_STATUS_SCAN_2040)) && (pAd->CommonCfg.Dot11BssWidthTriggerScanInt != 0) && ((pAd->Mlme.OneSecPeriodicRound % pAd->CommonCfg.Dot11BssWidthTriggerScanInt) == (pAd->CommonCfg.Dot11BssWidthTriggerScanInt-1))) { DBGPRINT(RT_DEBUG_TRACE, ("MMCHK - LastOneSecTotalTxCount/LastOneSecRxOkDataCnt = %d/%d \n", pAd->RalinkCounters.LastOneSecTotalTxCount, pAd->RalinkCounters.LastOneSecRxOkDataCnt)); /* Check last scan time at least 30 seconds from now. */ /* Check traffic is less than about 1.5~2Mbps.*/ /* it might cause data lost if we enqueue scanning.*/ /* This criteria needs to be considered*/ if ((pAd->RalinkCounters.LastOneSecTotalTxCount < 70) && (pAd->RalinkCounters.LastOneSecRxOkDataCnt < 70) /*&& ((pAd->StaCfg.LastScanTime + 10 * OS_HZ) < pAd->Mlme.Now32) */) { MLME_SCAN_REQ_STRUCT ScanReq; /* Fill out stuff for scan request and kick to scan*/ ScanParmFill(pAd, &ScanReq, ZeroSsid, 0, BSS_ANY, SCAN_2040_BSS_COEXIST); /* Before scan, reset trigger event table. */ TriEventInit(pAd); MlmeEnqueue(pAd, AP_SYNC_STATE_MACHINE, APMT2_MLME_SCAN_REQ, sizeof(MLME_SCAN_REQ_STRUCT), &ScanReq, 0); /* Set InfoReq = 1, So after scan , alwats sebd 20/40 Coexistence frame to AP*/ pAd->CommonCfg.BSSCoexist2040.field.InfoReq = 1; RTMP_MLME_HANDLER(pAd); } DBGPRINT(RT_DEBUG_TRACE, (" LastOneSecTotalTxCount/LastOneSecRxOkDataCnt = %d/%d \n", pAd->RalinkCounters.LastOneSecTotalTxCount, pAd->RalinkCounters.LastOneSecRxOkDataCnt)); } } #endif /* APCLI_CERT_SUPPORT */ #endif /* DOT11N_DRAFT3 */ #endif /* DOT11_N_SUPPORT */ #endif /* APCLI_SUPPORT */ }