📄 bssdb.c
字号:
pMgmt->sNodeDBTable[*puNodeIndex].uRatePollTimeout = FALLBACK_POLL_SECOND; // for AP mode PS queue skb_queue_head_init(&pMgmt->sNodeDBTable[*puNodeIndex].sTxPSQueue); pMgmt->sNodeDBTable[*puNodeIndex].byAuthSequence = 0; pMgmt->sNodeDBTable[*puNodeIndex].wEnQueueCnt = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii); return;}; /*+ * * Routine Description: * Remove Node by NodeIndex * * * Return Value: * None *-*/VOIDBSSvRemoveOneNode( IN HANDLE hDeviceContext, IN UINT uNodeIndex ){ PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); BYTE byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; struct sk_buff *skb; while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL) dev_kfree_skb(skb); // clear context memset(&pMgmt->sNodeDBTable[uNodeIndex], 0, sizeof(KnownNodeDB)); // clear tx bit map pMgmt->abyPSTxMap[pMgmt->sNodeDBTable[uNodeIndex].wAID >> 3] &= ~byMask[pMgmt->sNodeDBTable[uNodeIndex].wAID & 7]; return;}; /*+ * * Routine Description: * Update AP Node content in Index 0 of KnownNodeDB * * * Return Value: * None *-*/VOIDBSSvUpdateAPNode( IN HANDLE hDeviceContext, IN PWORD pwCapInfo, IN PWLAN_IE_SUPP_RATES pSuppRates, IN PWLAN_IE_SUPP_RATES pExtSuppRates ){ PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); UINT uRateLen = WLAN_RATES_MAXLEN; memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); pMgmt->sNodeDBTable[0].bActive = TRUE; if (pDevice->byBBType == BB_TYPE_11B) { uRateLen = WLAN_RATES_MAXLEN_11B; } pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, uRateLen); pMgmt->abyCurrExtSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pExtSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, uRateLen); RATEvParseMaxRate((PVOID) pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, TRUE, &(pMgmt->sNodeDBTable[0].wMaxBasicRate), &(pMgmt->sNodeDBTable[0].wMaxSuppRate), &(pMgmt->sNodeDBTable[0].wSuppRate), &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate) ); memcpy(pMgmt->sNodeDBTable[0].abyMACAddr, pMgmt->abyCurrBSSID, WLAN_ADDR_LEN); pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxSuppRate; pMgmt->sNodeDBTable[0].bShortPreamble = WLAN_GET_CAP_INFO_SHORTPREAMBLE(*pwCapInfo); pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; // Auto rate fallback function initiation. // RATEbInit(pDevice); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pMgmt->sNodeDBTable[0].wTxDataRate = %d \n", pMgmt->sNodeDBTable[0].wTxDataRate); };/*+ * * Routine Description: * Add Multicast Node content in Index 0 of KnownNodeDB * * * Return Value: * None *-*/VOIDBSSvAddMulticastNode( IN HANDLE hDeviceContext ){ PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); if (!pDevice->bEnableHostWEP) memset(&pMgmt->sNodeDBTable[0], 0, sizeof(KnownNodeDB)); memset(pMgmt->sNodeDBTable[0].abyMACAddr, 0xff, WLAN_ADDR_LEN); pMgmt->sNodeDBTable[0].bActive = TRUE; pMgmt->sNodeDBTable[0].bPSEnable = FALSE; skb_queue_head_init(&pMgmt->sNodeDBTable[0].sTxPSQueue); RATEvParseMaxRate((PVOID) pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrExtSuppRates, TRUE, &(pMgmt->sNodeDBTable[0].wMaxBasicRate), &(pMgmt->sNodeDBTable[0].wMaxSuppRate), &(pMgmt->sNodeDBTable[0].wSuppRate), &(pMgmt->sNodeDBTable[0].byTopCCKBasicRate), &(pMgmt->sNodeDBTable[0].byTopOFDMBasicRate) ); pMgmt->sNodeDBTable[0].wTxDataRate = pMgmt->sNodeDBTable[0].wMaxBasicRate; pMgmt->sNodeDBTable[0].uRatePollTimeout = FALLBACK_POLL_SECOND; };/*+ * * Routine Description: * * * Second call back function to update Node DB info & AP link status * * * Return Value: * none. *-*/VOIDBSSvSecondCallBack( IN HANDLE hDeviceContext ){ PSDevice pDevice = (PSDevice)hDeviceContext; PSMgmtObject pMgmt = &(pDevice->sMgmtObj); UINT ii; PWLAN_IE_SSID pItemSSID, pCurrSSID; UINT uSleepySTACnt = 0; UINT uNonShortSlotSTACnt = 0; UINT uLongPreambleSTACnt = 0; long sdBm; //DavidWang viawget_wpa_header *wpahdr; //DavidWang spin_lock_irq(&pDevice->lock); pDevice->uAssocCount = 0; //Power Saving Mode Tx Burst if ( pDevice->bEnablePSMode == TRUE ) { pDevice->ulPSModeWaitTx++; if ( pDevice->ulPSModeWaitTx >= 2 ) { pDevice->ulPSModeWaitTx = 0; pDevice->bPSModeTxBurst = FALSE; } } pDevice->byERPFlag &= ~(WLAN_SET_ERP_BARKER_MODE(1) | WLAN_SET_ERP_NONERP_PRESENT(1)); if (pDevice->wUseProtectCntDown > 0) { pDevice->wUseProtectCntDown --; } else { // disable protect mode pDevice->byERPFlag &= ~(WLAN_SET_ERP_USE_PROTECTION(1)); } #ifdef Calcu_LinkQual s_uCalculateLinkQual((HANDLE)pDevice);#endif#ifdef SndEvt_ToAPI if( pDevice->bLinkPass != TRUE) //only notify under link fail condition? evt_notify(pDevice,0,pMgmt->eCurrState); else { if((pDevice->ulNTYcount == 0) || //notify only not less than one time or signalstren&linkqulity changed (pDevice->ItemInforPool.LinkQuality != pDevice->scStatistic.LinkQuality) || (pDevice->ItemInforPool.SignalStren != pDevice->scStatistic.SignalStren)) evt_notify(pDevice,0,WMAC_STATE_ASSOC); }#endif for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { if (pMgmt->sNodeDBTable[ii].bActive) { // Increase in-activity counter pMgmt->sNodeDBTable[ii].uInActiveCount++; if (ii > 0) { if (pMgmt->sNodeDBTable[ii].uInActiveCount > MAX_INACTIVE_COUNT) { BSSvRemoveOneNode(pDevice, ii); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Inactive timeout [%d] sec, STA index = [%d] remove\n", MAX_INACTIVE_COUNT, ii); continue; } if (pMgmt->sNodeDBTable[ii].eNodeState >= NODE_ASSOC) { pDevice->uAssocCount++; // check if Non ERP exist if (pMgmt->sNodeDBTable[ii].uInActiveCount < ERP_RECOVER_COUNT) { if (!pMgmt->sNodeDBTable[ii].bShortPreamble) { pDevice->byERPFlag |= WLAN_SET_ERP_BARKER_MODE(1); uLongPreambleSTACnt ++; } if (!pMgmt->sNodeDBTable[ii].bERPExist) { pDevice->byERPFlag |= WLAN_SET_ERP_NONERP_PRESENT(1); pDevice->byERPFlag |= WLAN_SET_ERP_USE_PROTECTION(1); } if (!pMgmt->sNodeDBTable[ii].bShortSlotTime) uNonShortSlotSTACnt++; } } // check if any STA in PS mode if (pMgmt->sNodeDBTable[ii].bPSEnable) uSleepySTACnt++; } // Rate fallback check if (!pDevice->bFixRate) {/* if ((pMgmt->eCurrMode == WMAC_MODE_ESS_STA) && (ii == 0)) RATEvTxRateFallBack(pDevice, &(pMgmt->sNodeDBTable[ii]));*/ if (ii > 0) { // ii = 0 for multicast node (AP & Adhoc) RATEvTxRateFallBack((PVOID)pDevice, &(pMgmt->sNodeDBTable[ii])); } else { // ii = 0 reserved for unicast AP node (Infra STA) if (pMgmt->eCurrMode == WMAC_MODE_ESS_STA) RATEvTxRateFallBack((PVOID)pDevice, &(pMgmt->sNodeDBTable[ii])); } } // check if pending PS queue if (pMgmt->sNodeDBTable[ii].wEnQueueCnt != 0) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Index= %d, Queue = %d pending \n", ii, pMgmt->sNodeDBTable[ii].wEnQueueCnt); if ((ii >0) && (pMgmt->sNodeDBTable[ii].wEnQueueCnt > 15)) { BSSvRemoveOneNode(pDevice, ii); DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Pending many queues PS STA Index = %d remove \n", ii); continue; } } } } if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->byBBType == BB_TYPE_11G)) { // on/off protect mode if (WLAN_GET_ERP_USE_PROTECTION(pDevice->byERPFlag)) { if (!pDevice->bProtectMode) { MACvEnableProtectMD(pDevice); pDevice->bProtectMode = TRUE; } } else { if (pDevice->bProtectMode) { MACvDisableProtectMD(pDevice); pDevice->bProtectMode = FALSE; } } // on/off short slot time if (uNonShortSlotSTACnt > 0) { if (pDevice->bShortSlotTime) { pDevice->bShortSlotTime = FALSE; BBvSetShortSlotTime(pDevice); vUpdateIFS((PVOID)pDevice); } } else { if (!pDevice->bShortSlotTime) { pDevice->bShortSlotTime = TRUE; BBvSetShortSlotTime(pDevice); vUpdateIFS((PVOID)pDevice); } } // on/off barker long preamble mode if (uLongPreambleSTACnt > 0) { if (!pDevice->bBarkerPreambleMd) { MACvEnableBarkerPreambleMd(pDevice); pDevice->bBarkerPreambleMd = TRUE; } } else { if (pDevice->bBarkerPreambleMd) { MACvDisableBarkerPreambleMd(pDevice); pDevice->bBarkerPreambleMd = FALSE; } } } // Check if any STA in PS mode, enable DTIM multicast deliver if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (uSleepySTACnt > 0) pMgmt->sNodeDBTable[0].bPSEnable = TRUE; else pMgmt->sNodeDBTable[0].bPSEnable = FALSE; } pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID; pCurrSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID; if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) || (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) { if (pMgmt->sNodeDBTable[0].bActive) { // Assoc with BSS // DBG_PRT(MSG_LEVEL_INFO, KERN_INFO "Callback inactive Count = [%d]\n", pMgmt->sNodeDBTable[0].uInActiveCount); if (pDevice->bUpdateBBVGA) { // s_vCheckSensitivity((HANDLE) pDevice); s_vCheckPreEDThreshold((HANDLE)pDevice); } if ((pMgmt->sNodeDBTable[0].uInActiveCount >= (LOST_BEACON_COUNT/2)) && (pDevice->byBBVGACurrent != pDevice->abyBBVGA[0]) ) { pDevice->byBBVGANew = pDevice->abyBBVGA[0]; bScheduleCommand((HANDLE) pDevice, WLAN_CMD_CHANGE_BBSENSITIVITY, NULL); } //DavidWang#ifdef CCX_Fast_Roaming RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &sdBm); if ((pDevice->bEnableRoaming == TRUE)&&(!(pMgmt->Cisco_cckm))) {// if ((pDevice->uIsroamingTime >= 15)&&(sdBm+(pMgmt->Roam_dbm)<0)&&( pDevice->bIsRoaming == FALSE)) {DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming1 %d, !\n", pDevice->bIsRoaming ); if ((sdBm+(pMgmt->Roam_dbm)<0)&&( pDevice->bIsRoaming == FALSE)) { pMgmt->sNodeDBTable[0].bActive = FALSE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrState = WMAC_STATE_IDLE; netif_stop_queue(pDevice->dev); pDevice->bLinkPass = FALSE; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); pDevice->bRoaming = TRUE; pDevice->bIsRoaming = TRUE; pDevice->bSameBSSCurNum = 0; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Not CCKM start roam !\n"); } else if ((pDevice->bRoaming == FALSE)&&(pDevice->bIsRoaming == TRUE)) { pDevice->uIsroamingTime++; if (pDevice->uIsroamingTime >= 20) pDevice->bIsRoaming = FALSE; }}#endif//DavidWang if (pMgmt->sNodeDBTable[0].uInActiveCount >= LOST_BEACON_COUNT) { pMgmt->sNodeDBTable[0].bActive = FALSE; pMgmt->eCurrMode = WMAC_MODE_STANDBY; pMgmt->eCurrState = WMAC_STATE_IDLE; netif_stop_queue(pDevice->dev); pDevice->bLinkPass = FALSE; ControlvMaskByte(pDevice,MESSAGE_REQUEST_MACREG,MAC_REG_PAPEDELAY,LEDSTS_STS,LEDSTS_SLOW); pDevice->bRoaming = TRUE; pDevice->bIsRoaming = FALSE; #ifdef SndEvt_ToAPI evt_notify(pDevice,0,WMAC_STATE_IDLE); #endif DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "Lost AP beacon [%d] sec, disconnected !\n", pMgmt->sNodeDBTable[0].uInActiveCount); } } else if (pItemSSID->len != 0) {//Davidwang if ((pDevice->bEnableRoaming == TRUE)&&(!(pMgmt->Cisco_cckm))) {DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bRoaming %d, !\n", pDevice->bRoaming );DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "bIsRoaming %d, !\n", pDevice->bIsRoaming ); if ((pDevice->bRoaming == TRUE)&&(pDevice->bIsRoaming == TRUE)){ DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fast Roaming ...\n"); BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass); bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID); bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID); pDevice->uAutoReConnectTime = 0; pDevice->uIsroamingTime = 0; pDevice->bRoaming = FALSE; // if ((pDevice->bWPADevEnable) && (pDevice->skb != NULL)) { wpahdr = (viawget_wpa_header *)pDevice->skb->data; wpahdr->type = VIAWGET_CCKM_ROAM_MSG; wpahdr->resp_ie_len = 0; wpahdr->req_ie_len = 0; skb_put(pDevice->skb, sizeof(viawget_wpa_header)); pDevice->skb->dev = pDevice->wpadev;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -