/* * bit31: Rx message defferred or not * bit 0-15: message ID: */ void macTraceMsgRx(tpAniSirGlobal pMac, tANI_U8 session, tANI_U32 data) { tANI_U16 msgId = (tANI_U16)MAC_TRACE_GET_MSG_ID(data); tANI_U8 moduleId = (tANI_U8)MAC_TRACE_GET_MODULE_ID(data); switch(moduleId) { case SIR_LIM_MODULE_ID: if(msgId >= SIR_LIM_ITC_MSG_TYPES_BEGIN) macTrace(pMac, TRACE_CODE_RX_LIM_MSG, session, data); else macTrace(pMac, TRACE_CODE_RX_SME_MSG, session, data); break; case SIR_WDA_MODULE_ID: macTrace(pMac, TRACE_CODE_RX_WDA_MSG, session, data); break; case SIR_CFG_MODULE_ID: macTrace(pMac, TRACE_CODE_RX_CFG_MSG, session, data); break; default: macTrace(pMac, moduleId, session, data); break; } }
tANI_U32 limDeactivateMinChannelTimerDuringScan(tpAniSirGlobal pMac) { if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) && (pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE)) { /** * Beacon/Probe Response is received during active scanning. * Deactivate MIN channel timer if running. */ limDeactivateAndChangeTimer(pMac,eLIM_MIN_CHANNEL_TIMER); MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_MAX_CHANNEL_TIMER)); if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer) == TX_TIMER_ERROR) { /// Could not activate max channel timer. // Log error limLog(pMac,LOGP, FL("could not activate max channel timer")); limCompleteMlmScan(pMac, eSIR_SME_RESOURCES_UNAVAILABLE); return TX_TIMER_ERROR; } } return eSIR_SUCCESS; } /*** end limDeactivateMinChannelTimerDuringScan() ***/
void limReleasePreAuthNode(tpAniSirGlobal pMac, tpLimPreAuthNode pAuthNode) { pAuthNode->fFree = 1; MTRACE(macTrace(pMac, TRACE_CODE_TIMER_DEACTIVATE, NO_SESSION, eLIM_PRE_AUTH_CLEANUP_TIMER)); tx_timer_deactivate(&pAuthNode->timer); pMac->lim.gLimNumPreAuthContexts--; } /*** end limReleasePreAuthNode() ***/
static void __limInitStates(tpAniSirGlobal pMac) { pMac->lim.gLimHBfailureCntInLinkEstState = 0; pMac->lim.gLimProbeFailureAfterHBfailedCnt = 0; pMac->lim.gLimHBfailureCntInOtherStates = 0; pMac->lim.gLimRspReqd = 0; pMac->lim.gLimPrevSmeState = eLIM_SME_OFFLINE_STATE; MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, eLIM_MLM_IDLE_STATE)); pMac->lim.gLimMlmState = eLIM_MLM_IDLE_STATE; pMac->lim.gLimPrevMlmState = eLIM_MLM_OFFLINE_STATE; #ifdef GEN4_SCAN pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; #endif pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE; vos_mem_set(&pMac->lim.gLimOverlap11gParams, sizeof(tLimProtStaParams), 0); vos_mem_set(&pMac->lim.gLimOverlap11aParams, sizeof(tLimProtStaParams), 0); vos_mem_set(&pMac->lim.gLimOverlapHt20Params, sizeof(tLimProtStaParams), 0); vos_mem_set(&pMac->lim.gLimOverlapNonGfParams, sizeof(tLimProtStaParams), 0); vos_mem_set(&pMac->lim.gLimNoShortParams, sizeof(tLimNoShortParams), 0); vos_mem_set(&pMac->lim.gLimNoShortSlotParams, sizeof(tLimNoShortSlotParams), 0); pMac->lim.gLimPhyMode = 0; pMac->lim.scanStartTime = 0; vos_mem_set(pMac->lim.gLimMyMacAddr, sizeof(pMac->lim.gLimMyMacAddr), 0); pMac->lim.ackPolicy = 0; #if 0 pMac->lim.gLimQosEnabled = 0; pMac->lim.gLimWmeEnabled = 0; pMac->lim.gLimWsmEnabled = 0; pMac->lim.gLimHcfEnabled = 0; pMac->lim.gLim11dEnabled = 0; #endif pMac->lim.gLimProbeRespDisableFlag = 0; }
void limRestoreFromAuthState(tpAniSirGlobal pMac, tSirResultCodes resultCode, tANI_U16 protStatusCode,tpPESession sessionEntry) { tSirMacAddr currentBssId; tLimMlmAuthCnf mlmAuthCnf; vos_mem_copy( (tANI_U8 *) &mlmAuthCnf.peerMacAddr, (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr, sizeof(tSirMacAddr)); mlmAuthCnf.authType = pMac->lim.gpLimMlmAuthReq->authType; mlmAuthCnf.resultCode = resultCode; mlmAuthCnf.protStatusCode = protStatusCode; /* Update PE session ID*/ mlmAuthCnf.sessionId = sessionEntry->peSessionId; /// Free up buffer allocated /// for pMac->lim.gLimMlmAuthReq vos_mem_free(pMac->lim.gpLimMlmAuthReq); pMac->lim.gpLimMlmAuthReq = NULL; sessionEntry->limMlmState = sessionEntry->limPrevMlmState; MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, sessionEntry->peSessionId, sessionEntry->limMlmState)); // 'Change' timer for future activations limDeactivateAndChangeTimer(pMac, eLIM_AUTH_FAIL_TIMER); #if 0 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != eSIR_SUCCESS) { /// Could not get BSSID from CFG. Log error. limLog(pMac, LOGP, FL("could not retrieve BSSID")); } #endif //TO SUPPORT BT-AMP sirCopyMacAddr(currentBssId,sessionEntry->bssId); if (sessionEntry->limSmeState == eLIM_SME_WT_PRE_AUTH_STATE) { pMac->lim.gLimPreAuthChannelNumber = 0; } limPostSmeMessage(pMac, LIM_MLM_AUTH_CNF, (tANI_U32 *) &mlmAuthCnf); } /*** end limRestoreFromAuthState() ***/
void limProcessBeaconFrame(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo,tpPESession psessionEntry) { tpSirMacMgmtHdr pHdr; tSchBeaconStruct *pBeacon; pMac->lim.gLimNumBeaconsRcvd++; /* here is it required to increment session specific heartBeat beacon counter */ pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); limLog(pMac, LOG2, FL("Received Beacon frame with length=%d from "), WDA_GET_RX_MPDU_LEN(pRxPacketInfo)); limPrintMacAddr(pMac, pHdr->sa, LOG2); if (!pMac->fScanOffload) { if (limDeactivateMinChannelTimerDuringScan(pMac) != eSIR_SUCCESS) return; } /** * Expect Beacon only when * 1. STA is in Scan mode waiting for Beacon/Probe response or * 2. STA is waiting for Beacon/Probe Respose Frame * to announce join success. * 3. STA/AP is in Learn mode */ if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) || (pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) || (pMac->lim.gLimMlmState == eLIM_MLM_LEARN_STATE) || (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE) || pMac->fScanOffload ) { pBeacon = vos_mem_malloc(sizeof(tSchBeaconStruct)); if ( NULL == pBeacon ) { limLog(pMac, LOGE, FL("Unable to allocate memory in limProcessBeaconFrame") ); return; } // Parse received Beacon if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, pBeacon) != eSIR_SUCCESS) { // Received wrongly formatted/invalid Beacon. // Ignore it and move on. limLog(pMac, LOGW, FL("Received invalid Beacon in state %d"), psessionEntry->limMlmState); limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState); if ((!psessionEntry->currentBssBeaconCnt) && (sirCompareMacAddr( psessionEntry->bssId, pHdr->sa))) limParseBeaconForTim(pMac, (tANI_U8 *) pRxPacketInfo, psessionEntry); vos_mem_free(pBeacon); return; } /*during scanning, when any session is active, and beacon/Pr belongs to one of the session, fill up the following, TBD - HB couter */ if ((!psessionEntry->lastBeaconDtimPeriod) && (sirCompareMacAddr( psessionEntry->bssId, pBeacon->bssid))) { vos_mem_copy(( tANI_U8* )&psessionEntry->lastBeaconTimeStamp, ( tANI_U8* )pBeacon->timeStamp, sizeof(tANI_U64) ); psessionEntry->lastBeaconDtimCount = pBeacon->tim.dtimCount; psessionEntry->lastBeaconDtimPeriod= pBeacon->tim.dtimPeriod; psessionEntry->currentBssBeaconCnt++; } MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, 0, pBeacon->timeStamp[0]);)
/** * sysBbtProcessMessageCore * * FUNCTION: * Process BBT messages * * LOGIC: * * ASSUMPTIONS: * * NOTE: * * @param tpAniSirGlobal A pointer to MAC params instance * @param pMsg message pointer * @param tANI_U32 type * @param tANI_U32 sub type * @return None */ tSirRetStatus sysBbtProcessMessageCore(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tANI_U32 type, tANI_U32 subType) { tANI_U32 framecount; tSirRetStatus ret; void* pBd; tMgmtFrmDropReason dropReason; vos_pkt_t *pVosPkt = (vos_pkt_t *)pMsg->bodyptr; VOS_STATUS vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&pBd, VOS_FALSE ); pMac->sys.gSysBbtReceived++; if ( !VOS_IS_STATUS_SUCCESS(vosStatus) ) { goto fail; } sysLog(pMac, LOG3, FL("Rx Mgmt Frame Subtype: %d\n"), subType); sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, (tANI_U8 *)WDA_GET_RX_MAC_HEADER(pBd), WDA_GET_RX_MPDU_LEN(pBd)); sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, WDA_GET_RX_MPDU_DATA(pBd), WDA_GET_RX_PAYLOAD_LEN(pBd)); pMac->sys.gSysFrameCount[type][subType]++; framecount = pMac->sys.gSysFrameCount[type][subType]; if(type == SIR_MAC_MGMT_FRAME) { tpSirMacMgmtHdr mac_hdr; /* * Drop beacon frames in deferred state to avoid VOSS run out of * message wrappers. */ if ((subType == SIR_MAC_MGMT_BEACON) && (!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) && !pMac->lim.gLimSystemInScanLearnMode) { sysLog(pMac, LOG1, FL("dropping received beacon in deffered state")); goto fail; } dropReason = limIsPktCandidateForDrop(pMac, pBd, subType); if (dropReason != eMGMT_DROP_NO_DROP) { sysLog(pMac, LOG1, FL("Mgmt Frame %d being dropped, reason: %d\n"), subType, dropReason); MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_DROP, NO_SESSION, dropReason)); goto fail; } mac_hdr = WDA_GET_RX_MAC_HEADER(pBd); if (subType == SIR_MAC_MGMT_ASSOC_REQ) { sysLog(pMac, LOG1, FL("ASSOC REQ frame allowed: da: " MAC_ADDRESS_STR ", sa: " MAC_ADDRESS_STR ", bssid: " MAC_ADDRESS_STR ", Assoc Req count so far: %d\n"), MAC_ADDR_ARRAY(mac_hdr->da), MAC_ADDR_ARRAY(mac_hdr->sa), MAC_ADDR_ARRAY(mac_hdr->bssId), pMac->sys.gSysFrameCount[type][subType]); } if (subType == SIR_MAC_MGMT_DEAUTH) { sysLog(pMac, LOG1, FL("DEAUTH frame allowed: da: " MAC_ADDRESS_STR ", sa: " MAC_ADDRESS_STR ", bssid: " MAC_ADDRESS_STR ", DEAUTH count so far: %d\n"), MAC_ADDR_ARRAY(mac_hdr->da), MAC_ADDR_ARRAY(mac_hdr->sa), MAC_ADDR_ARRAY(mac_hdr->bssId), pMac->sys.gSysFrameCount[type][subType]); } if (subType == SIR_MAC_MGMT_DISASSOC) { sysLog(pMac, LOG1, FL("DISASSOC frame allowed: da: " MAC_ADDRESS_STR ", sa: " MAC_ADDRESS_STR ", bssid: " MAC_ADDRESS_STR ", DISASSOC count so far: %d\n"), MAC_ADDR_ARRAY(mac_hdr->da), MAC_ADDR_ARRAY(mac_hdr->sa), MAC_ADDR_ARRAY(mac_hdr->bssId), pMac->sys.gSysFrameCount[type][subType]); } //Post the message to PE Queue ret = (tSirRetStatus) limPostMsgApi(pMac, pMsg); if (ret != eSIR_SUCCESS) { /* Print only one debug failure out of 512 failure messages */ if(pMac->sys.gSysBbtReceived & 0x0200) sysLog(pMac, LOGE, FL("posting to LIM2 failed, ret %d"), ret); goto fail; } pMac->sys.gSysBbtPostedToLim++; } else if (type == SIR_MAC_DATA_FRAME) { #ifdef FEATURE_WLAN_ESE sysLog(pMac, LOGW, FL("IAPP Frame...\n")); //Post the message to PE Queue ret = (tSirRetStatus) limPostMsgApi(pMac, pMsg); if (ret != eSIR_SUCCESS) { sysLog(pMac, LOGE, FL("posting to LIM2 failed, ret %d\n"), ret); goto fail; } pMac->sys.gSysBbtPostedToLim++; #endif } else { sysLog(pMac, LOG3, "BBT received Invalid type %d subType %d " "LIM state %X. BD dump is:\n", type, subType, limGetSmeState(pMac)); sirDumpBuf(pMac, SIR_SYS_MODULE_ID, LOG3, (tANI_U8 *) pBd, WLANHAL_RX_BD_HEADER_SIZE); goto fail; } return eSIR_SUCCESS; fail: pMac->sys.gSysBbtDropped++; return eSIR_FAILURE; }