static void Log_getCfg(tpAniSirGlobal pMac, tANI_U16 cfgId) { #define CFG_CTL_INT 0x00080000 if ((pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_INT) != 0) { tANI_U32 val; // Get integer parameter if (wlan_cfgGetInt(pMac, (tANI_U16)cfgId, &val) != eHAL_STATUS_SUCCESS) { sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId); } else { sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d 0x%x) = %ld\n"), gCfgParamName[cfgId], cfgId, cfgId, val ); } } else { tANI_U8 buf[CFG_MAX_STR_LEN] = {0} ; tANI_U32 valueLen ; // Get string parameter valueLen = CFG_MAX_STR_LEN ; if (wlan_cfgGetStr(pMac, cfgId, buf, &valueLen) != eSIR_SUCCESS) { sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId); } else { sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d 0x%x) len=%ld\n"), gCfgParamName[cfgId], cfgId, cfgId, valueLen ); sirDumpBuf(pMac, SIR_WDA_MODULE_ID, LOGW, buf, valueLen) ; } } return; }
tANI_U8 limDecryptAuthFrame(tpAniSirGlobal pMac, tANI_U8 *pKey, tANI_U8 *pEncrBody, tANI_U8 *pPlainBody, tANI_U32 keyLength, tANI_U16 frameLen) { tANI_U8 seed[LIM_SEED_LENGTH], icv[SIR_MAC_WEP_ICV_LENGTH]; int i; keyLength += 3; // Bytes 0-2 of seed is received IV vos_mem_copy((tANI_U8 *) seed, pEncrBody, SIR_MAC_WEP_IV_LENGTH - 1); // Bytes 3-7 of seed is key vos_mem_copy((tANI_U8 *) &seed[3], pKey, keyLength - 3); // Run RC4 on encrypted text with the seed limRC4(pPlainBody, pEncrBody + SIR_MAC_WEP_IV_LENGTH, seed, keyLength, frameLen); PELOG4(limLog(pMac, LOG4, FL("plainbody is ")); sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pPlainBody, frameLen);)
eHalStatus limCollectBssDescription(tpAniSirGlobal pMac, tSirBssDescription *pBssDescr, tpSirProbeRespBeacon pBPR, tANI_U8 *pRxPacketInfo) #endif { tANI_U8 *pBody; tANI_U32 ieLen = 0; tpSirMacMgmtHdr pHdr; tANI_U8 channelNum; tANI_U8 rxChannel; tANI_U8 rfBand = 0; pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); if (SIR_MAC_B_PR_SSID_OFFSET > WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo)) { VOS_ASSERT(WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) >= SIR_MAC_B_PR_SSID_OFFSET); return eHAL_STATUS_FAILURE; } ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIR_MAC_B_PR_SSID_OFFSET; rxChannel = WDA_GET_RX_CH(pRxPacketInfo); pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); rfBand = WDA_GET_RX_RFBAND(pRxPacketInfo); /** * Drop all the beacons and probe response without P2P IE during P2P search */ if ((NULL != pMac->lim.gpLimMlmScanReq && pMac->lim.gpLimMlmScanReq->p2pSearch) || (pMac->fScanOffload && pMac->lim.fOffloadScanPending && (pMac->lim.fOffloadScanP2PSearch || pMac->lim.fOffloadScanP2PListen))) { if (NULL == limGetP2pIEPtr(pMac, (pBody + SIR_MAC_B_PR_SSID_OFFSET), ieLen)) { limLog( pMac, LOG3, MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pHdr->bssId)); return eHAL_STATUS_FAILURE; } } /** * Length of BSS desription is without length of * length itself and length of pointer * that holds the next BSS description */ pBssDescr->length = (tANI_U16)( sizeof(tSirBssDescription) - sizeof(tANI_U16) - sizeof(tANI_U32) + ieLen); // Copy BSS Id vos_mem_copy((tANI_U8 *) &pBssDescr->bssId, (tANI_U8 *) pHdr->bssId, sizeof(tSirMacAddr)); // Copy Timestamp, Beacon Interval and Capability Info pBssDescr->scanSysTimeMsec = vos_timer_get_system_time(); pBssDescr->timeStamp[0] = pBPR->timeStamp[0]; pBssDescr->timeStamp[1] = pBPR->timeStamp[1]; pBssDescr->beaconInterval = pBPR->beaconInterval; pBssDescr->capabilityInfo = limGetU16((tANI_U8 *) &pBPR->capabilityInfo); if(!pBssDescr->beaconInterval ) { limLog(pMac, LOGW, FL("Beacon Interval is ZERO, making it to default 100 " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->bssId)); pBssDescr->beaconInterval= 100; } /* * There is a narrow window after Channel Switch msg is sent to HAL and before the AGC is shut * down and beacons/Probe Rsps can trickle in and we may report the incorrect channel in 5Ghz * band, so not relying on the 'last Scanned Channel' stored in LIM. * Instead use the value returned by RXP in BD. This the the same value which HAL programs into * RXP before every channel switch. * Right now there is a problem in 5Ghz, where we are receiving beacons from a channel different from * the currently scanned channel. so incorrect channel is reported to CSR and association does not happen. * So for now we keep on looking for the channel info in the beacon (DSParamSet IE OR HT Info IE), and only if it * is not present in the beacon, we go for the channel info present in RXP. * This fix will work for 5Ghz 11n devices, but for 11a devices, we have to rely on RXP routing flag to get the correct channel. * So The problem of incorrect channel reporting in 5Ghz will still remain for 11a devices. */ pBssDescr->channelId = limGetChannelFromBeacon(pMac, pBPR); if (pBssDescr->channelId == 0) { /* If the channel Id is not retrieved from Beacon, extract the channel from BD */ /* Unmapped the channel.This We have to do since we have done mapping in the hal to overcome the limitation of RXBD of not able to accomodate the bigger channel number.*/ if ((!rfBand) || IS_5G_BAND(rfBand)) { rxChannel = limUnmapChannel(rxChannel); } if (!rxChannel) { rxChannel = pMac->lim.gLimCurrentScanChannelId; } pBssDescr->channelId = rxChannel; } pBssDescr->channelIdSelf = pBssDescr->channelId; //set the network type in bss description channelNum = pBssDescr->channelId; pBssDescr->nwType = limGetNwType(pMac, channelNum, SIR_MAC_MGMT_FRAME, pBPR); // Copy RSSI & SINR from BD PELOG4(limLog(pMac, LOG4, "***********BSS Description for BSSID:*********** "); sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pBssDescr->bssId, 6 ); sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG4, (tANI_U8*)pRxPacketInfo, 36 );)
void limCollectBssDescription(tpAniSirGlobal pMac, tSirBssDescription *pBssDescr, tpSirProbeRespBeacon pBPR, tANI_U8 *pRxPacketInfo) #endif { tANI_U8 *pBody; tANI_U32 ieLen = 0; tpSirMacMgmtHdr pHdr; tANI_U8 channelNum; tANI_U8 rxChannel; pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo); ieLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIR_MAC_B_PR_SSID_OFFSET; rxChannel = WDA_GET_RX_CH(pRxPacketInfo); pBody = WDA_GET_RX_MPDU_DATA(pRxPacketInfo); /** * Length of BSS desription is without length of * length itself and length of pointer * that holds the next BSS description */ pBssDescr->length = (tANI_U16)( sizeof(tSirBssDescription) - sizeof(tANI_U16) - sizeof(tANI_U32) + ieLen); // Copy BSS Id palCopyMemory( pMac->hHdd, (tANI_U8 *) &pBssDescr->bssId, (tANI_U8 *) pHdr->bssId, sizeof(tSirMacAddr)); // Copy Timestamp, Beacon Interval and Capability Info pBssDescr->scanSysTimeMsec = vos_timer_get_system_time(); pBssDescr->timeStamp[0] = pBPR->timeStamp[0]; pBssDescr->timeStamp[1] = pBPR->timeStamp[1]; pBssDescr->beaconInterval = pBPR->beaconInterval; pBssDescr->capabilityInfo = limGetU16((tANI_U8 *) &pBPR->capabilityInfo); /* * There is a narrow window after Channel Switch msg is sent to HAL and before the AGC is shut * down and beacons/Probe Rsps can trickle in and we may report the incorrect channel in 5Ghz * band, so not relying on the 'last Scanned Channel' stored in LIM. * Instead use the value returned by RXP in BD. This the the same value which HAL programs into * RXP before every channel switch. * Right now there is a problem in 5Ghz, where we are receiving beacons from a channel different from * the currently scanned channel. so incorrect channel is reported to CSR and association does not happen. * So for now we keep on looking for the channel info in the beacon (DSParamSet IE OR HT Info IE), and only if it * is not present in the beacon, we go for the channel info present in RXP. * This fix will work for 5Ghz 11n devices, but for 11a devices, we have to rely on RXP routing flag to get the correct channel. * So The problem of incorrect channel reporting in 5Ghz will still remain for 11a devices. */ pBssDescr->channelId = limGetChannelFromBeacon(pMac, pBPR); if (pBssDescr->channelId == 0) { /* If the channel Id is not retrieved from Beacon, extract the channel from BD */ /* Unmapped the channel.This We have to do since we have done mapping in the hal to overcome the limitation of RXBD of not able to accomodate the bigger channel number.*/ if (!( rxChannel = limUnmapChannel(rxChannel))) { rxChannel = pMac->lim.gLimCurrentScanChannelId; } pBssDescr->channelId = rxChannel; } pBssDescr->channelIdSelf = rxChannel; //set the network type in bss description channelNum = pBssDescr->channelId; pBssDescr->nwType = limGetNwType(pMac, channelNum, SIR_MAC_MGMT_FRAME, pBPR); pBssDescr->aniIndicator = pBPR->propIEinfo.aniIndicator; // Copy RSSI & SINR from BD PELOG4(limLog(pMac, LOG4, "***********BSS Description for BSSID:*********** "); sirDumpBuf(pMac, SIR_LIM_MODULE_ID, LOG4, pBssDescr->bssId, 6 ); sirDumpBuf( pMac, SIR_LIM_MODULE_ID, LOG4, (tANI_U8*)pRxPacketInfo, 36 );)
/** * 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; }