void limDeletePreAuthNode(tpAniSirGlobal pMac, tSirMacAddr macAddr) { struct tLimPreAuthNode *pPrevNode, *pTempNode; pTempNode = pPrevNode = pMac->lim.pLimPreAuthList; if (pTempNode == NULL) return; if (vos_mem_compare( (tANI_U8 *) macAddr, (tANI_U8 *) &pTempNode->peerMacAddr, sizeof(tSirMacAddr)) ) { // First node to be deleted pMac->lim.pLimPreAuthList = pTempNode->next; limLog(pMac, LOG1, FL(" first node to delete")); limLog(pMac, LOG1, FL(" Release data entry:%p idx %d peer: " MAC_ADDRESS_STR), pTempNode, pTempNode->authNodeIdx, MAC_ADDR_ARRAY(macAddr)); limReleasePreAuthNode(pMac, pTempNode); return; } pTempNode = pTempNode->next; while (pTempNode != NULL) { if (vos_mem_compare( (tANI_U8 *) macAddr, (tANI_U8 *) &pTempNode->peerMacAddr, sizeof(tSirMacAddr)) ) { // Found node to be deleted pPrevNode->next = pTempNode->next; limLog(pMac, LOG1, FL(" subsequent node to delete")); limLog(pMac, LOG1, FL("Release data entry: %p id %d peer: "MAC_ADDRESS_STR), pTempNode, pTempNode->authNodeIdx, MAC_ADDR_ARRAY(macAddr)); limReleasePreAuthNode(pMac, pTempNode); return; } pPrevNode = pTempNode; pTempNode = pTempNode->next; } // Should not be here // Log error limLog(pMac, LOGP, FL("peer not found in pre-auth list, addr= ")); limPrintMacAddr(pMac, macAddr, LOGP); } /*** end limDeletePreAuthNode() ***/
/** * adf_dp_display_proto_pkt() - display proto packet * @record: dptrace record * @index: index * * Return: none */ void adf_dp_display_proto_pkt(struct adf_dp_trace_record_s *record, uint16_t index) { struct adf_dp_trace_proto_buf *buf = (struct adf_dp_trace_proto_buf *)record->data; adf_os_print("DPT: %04d: %012llu: %s vdev_id %d\n", index, record->time, adf_dp_code_to_string(record->code), buf->vdev_id); adf_os_print("DPT: SA: " MAC_ADDRESS_STR " %s DA: " MAC_ADDRESS_STR " Type %s Subtype %s\n", MAC_ADDR_ARRAY(buf->sa.bytes), adf_dp_dir_to_str(buf->dir), MAC_ADDR_ARRAY(buf->da.bytes), adf_dp_type_to_str(buf->type), adf_dp_subtype_to_str(buf->subtype)); }
eHalStatus csrTdlsProcessDelSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsDelStaCmdInfo *tdlsDelStaCmdInfo = &cmd->u.tdlsCmd.u.tdlsDelStaCmdInfo ; tSirTdlsDelStaReq *tdlsDelStaReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; if (NULL == pSession) { smsLog( pMac, LOGE, FL("pSession is NULL")); return eHAL_STATUS_FAILURE; } if (NULL == pSession->pConnectBssDesc) { smsLog( pMac, LOGE, FL("BSS description is not present") ); return eHAL_STATUS_FAILURE; } tdlsDelStaReq = vos_mem_malloc(sizeof(tSirTdlsDelStaReq)); if ( NULL == tdlsDelStaReq ) status = eHAL_STATUS_FAILURE; else status = eHAL_STATUS_SUCCESS; if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("alloc failed") ); VOS_ASSERT(0) ; return status ; } tdlsDelStaReq->sessionId = cmd->sessionId; //Using dialog as transactionId. This can be used to match response with request tdlsDelStaReq->transactionId = 0; vos_mem_copy( tdlsDelStaReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); vos_mem_copy( tdlsDelStaReq->peerMac, tdlsDelStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ; // Send the request to PE. #ifdef WLAN_FEATURE_TDLS_DEBUG smsLog( pMac, LOGE, #else smsLog( pMac, LOG1, #endif "sending TDLS Del Sta "MAC_ADDRESS_STR" req to PE", MAC_ADDR_ARRAY(tdlsDelStaCmdInfo->peerMac)); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_DEL_STA_REQ, (void *)tdlsDelStaReq , sizeof(tSirTdlsDelStaReq)) ; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC")); } return status; }
eHalStatus csrTdlsProcessDelSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsDelStaCmdInfo *tdlsDelStaCmdInfo = &cmd->u.tdlsCmd.u.tdlsDelStaCmdInfo ; tSirTdlsDelStaReq *tdlsDelStaReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; if (NULL == pSession) { smsLog( pMac, LOGE, FL("pSession is NULL")); return eHAL_STATUS_FAILURE; } if (NULL == pSession->pConnectBssDesc) { smsLog( pMac, LOGE, FL("BSS description is not present") ); return eHAL_STATUS_FAILURE; } status = palAllocateMemory( pMac->hHdd, (void **)&tdlsDelStaReq, (sizeof(tSirTdlsDelStaReq) ) ); if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("alloc failed") ); VOS_ASSERT(0) ; return status ; } tdlsDelStaReq->sessionId = cmd->sessionId; tdlsDelStaReq->transactionId = 0; palCopyMemory(pMac->hHdd, tdlsDelStaReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); palCopyMemory(pMac->hHdd, tdlsDelStaReq->peerMac, tdlsDelStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ; #ifdef WLAN_FEATURE_TDLS_DEBUG smsLog( pMac, LOGE, #else smsLog( pMac, LOG1, #endif "sending TDLS Del Sta "MAC_ADDRESS_STR" req to PE", MAC_ADDR_ARRAY(tdlsDelStaCmdInfo->peerMac)); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_DEL_STA_REQ, (void *)tdlsDelStaReq , sizeof(tSirTdlsDelStaReq)) ; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC")); } return status; }
void pePrintActiveSession(tpAniSirGlobal pMac) { tANI_U8 i; for(i =0; i < pMac->lim.maxBssId; i++) { if(pMac->lim.gpSession[i].valid == TRUE) { limLog(pMac, LOGE, FL("Active sessionId: %d BSID: "MAC_ADDRESS_STR "opmode = %d bssIdx = %d"), i, MAC_ADDR_ARRAY(pMac->lim.gpSession[i].bssId), pMac->lim.gpSession[i].operMode, pMac->lim.gpSession[i].bssIdx); } } return; }
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 );)
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 );) pBssDescr->rssi = (tANI_S8)WDA_GET_RX_RSSI_NORMALIZED(pRxPacketInfo); pBssDescr->rssi_raw = (tANI_S8)WDA_GET_RX_RSSI_RAW(pRxPacketInfo); //SINR no longer reported by HW pBssDescr->sinr = 0; limLog(pMac, LOG3, FL(MAC_ADDRESS_STR " rssi: normalized = %d, absolute = %d"), MAC_ADDR_ARRAY(pHdr->bssId), pBssDescr->rssi, pBssDescr->rssi_raw); pBssDescr->nReceivedTime = (tANI_TIMESTAMP)palGetTickCount(pMac->hHdd); #if defined WLAN_FEATURE_VOWIFI if( fScanning ) { rrmGetStartTSF( pMac, pBssDescr->startTSF ); pBssDescr->parentTSF = WDA_GET_RX_TIMESTAMP(pRxPacketInfo); } #endif #ifdef WLAN_FEATURE_VOWIFI_11R // MobilityDomain pBssDescr->mdie[0] = 0; pBssDescr->mdie[1] = 0;
eHalStatus sme_FTSendUpdateKeyInd(tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo) { tSirFTUpdateKeyInfo *pMsg; tANI_U16 msgLen; eHalStatus status = eHAL_STATUS_FAILURE; tAniEdType tmpEdType; tSirKeyMaterial *keymaterial = NULL; tAniEdType edType; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG int i = 0; smsLog(pMac, LOG1, FL("keyLength %d"), pFTKeyInfo->keyLength); for (i=0; i<pFTKeyInfo->keyLength; i++) smsLog(pMac, LOG1, FL("%02x"), pFTKeyInfo->Key[i]); #endif msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + sizeof( pMsg->keyMaterial.key ); pMsg = vos_mem_malloc(msgLen); if ( NULL == pMsg ) { return eHAL_STATUS_FAILURE; } vos_mem_set(pMsg, msgLen, 0); pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_FT_UPDATE_KEY); pMsg->length = pal_cpu_to_be16(msgLen); keymaterial = &pMsg->keyMaterial; keymaterial->length = pFTKeyInfo->keyLength; edType = csrTranslateEncryptTypeToEdType( pFTKeyInfo->encType ); tmpEdType = pal_cpu_to_be32(edType); keymaterial->edType = tmpEdType; // Set the pMsg->keyMaterial.length field (this length is defined as all // data that follows the edType field // in the tSirKeyMaterial keyMaterial; field). // // !!NOTE: This keyMaterial.length contains the length of a MAX size key, // though the keyLength can be // shorter than this max size. Is LIM interpreting this ok ? keymaterial->numKeys = 1; keymaterial->key[ 0 ].keyId = pFTKeyInfo->keyId; keymaterial->key[ 0 ].unicast = (tANI_U8)eANI_BOOLEAN_TRUE; keymaterial->key[ 0 ].keyDirection = pFTKeyInfo->keyDirection; vos_mem_copy(&keymaterial->key[ 0 ].keyRsc, pFTKeyInfo->keyRsc, CSR_MAX_RSC_LEN); keymaterial->key[ 0 ].paeRole = pFTKeyInfo->paeRole; keymaterial->key[ 0 ].keyLength = pFTKeyInfo->keyLength; if ( pFTKeyInfo->keyLength && pFTKeyInfo->Key ) { vos_mem_copy(&keymaterial->key[ 0 ].key, pFTKeyInfo->Key, pFTKeyInfo->keyLength); if(pFTKeyInfo->keyLength == 16) { smsLog(pMac, LOG1, "SME Set Update Ind keyIdx (%d) encType(%d) key = " "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X", pMsg->keyMaterial.key[0].keyId, (tAniEdType)pMsg->keyMaterial.edType, pMsg->keyMaterial.key[0].key[0], pMsg->keyMaterial.key[0].key[1], pMsg->keyMaterial.key[0].key[2], pMsg->keyMaterial.key[0].key[3], pMsg->keyMaterial.key[0].key[4], pMsg->keyMaterial.key[0].key[5], pMsg->keyMaterial.key[0].key[6], pMsg->keyMaterial.key[0].key[7], pMsg->keyMaterial.key[0].key[8], pMsg->keyMaterial.key[0].key[9], pMsg->keyMaterial.key[0].key[10], pMsg->keyMaterial.key[0].key[11], pMsg->keyMaterial.key[0].key[12], pMsg->keyMaterial.key[0].key[13], pMsg->keyMaterial.key[0].key[14], pMsg->keyMaterial.key[0].key[15]); } } vos_mem_copy( &pMsg->bssId[ 0 ], &pFTKeyInfo->peerMac[ 0 ], sizeof(tCsrBssid) ); smsLog(pMac, LOG1, "BSSID = "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMsg->bssId)); status = palSendMBMessage(pMac->hHdd, pMsg); return( status ); }
/* * TDLS Message processor, will be called after TDLS message recieved from * PE */ eHalStatus tdlsMsgProcessor(tpAniSirGlobal pMac, v_U16_t msgType, void *pMsgBuf) { switch(msgType) { case eWNI_SME_TDLS_SEND_MGMT_RSP: { /* remove pending eSmeCommandTdlsDiscovery command */ csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsSendMgmt) ; } break; case eWNI_SME_TDLS_ADD_STA_RSP: { tSirTdlsAddStaRsp *addStaRsp = (tSirTdlsAddStaRsp *) pMsgBuf ; eCsrRoamResult roamResult ; tCsrRoamInfo roamInfo = {0} ; vos_mem_copy( &roamInfo.peerMac, addStaRsp->peerMac, sizeof(tSirMacAddr)) ; roamInfo.staId = addStaRsp->staId ; roamInfo.ucastSig = addStaRsp->ucastSig ; roamInfo.bcastSig = addStaRsp->bcastSig ; roamInfo.statusCode = addStaRsp->statusCode ; /* * register peer with TL, we have to go through HDD as this is * the only way to register any STA with TL. */ if (addStaRsp->tdlsAddOper == TDLS_OPER_ADD) roamResult = eCSR_ROAM_RESULT_ADD_TDLS_PEER; else /* addStaRsp->tdlsAddOper must be TDLS_OPER_UPDATE */ roamResult = eCSR_ROAM_RESULT_UPDATE_TDLS_PEER; csrRoamCallCallback(pMac, addStaRsp->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, roamResult); /* remove pending eSmeCommandTdlsDiscovery command */ csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsAddPeer) ; } break; case eWNI_SME_TDLS_DEL_STA_RSP: { tSirTdlsDelStaRsp *delStaRsp = (tSirTdlsDelStaRsp *) pMsgBuf ; tCsrRoamInfo roamInfo = {0} ; vos_mem_copy( &roamInfo.peerMac, delStaRsp->peerMac, sizeof(tSirMacAddr)) ; roamInfo.staId = delStaRsp->staId ; roamInfo.statusCode = delStaRsp->statusCode ; /* * register peer with TL, we have to go through HDD as this is * the only way to register any STA with TL. */ csrRoamCallCallback(pMac, delStaRsp->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_DELETE_TDLS_PEER); csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsDelPeer) ; } break; case eWNI_SME_TDLS_DEL_STA_IND: { tpSirTdlsDelStaInd pSirTdlsDelStaInd = (tpSirTdlsDelStaInd) pMsgBuf ; tCsrRoamInfo roamInfo = {0} ; vos_mem_copy( &roamInfo.peerMac, pSirTdlsDelStaInd->peerMac, sizeof(tSirMacAddr)) ; roamInfo.staId = pSirTdlsDelStaInd->staId ; roamInfo.reasonCode = pSirTdlsDelStaInd->reasonCode ; /* Sending the TEARDOWN indication to HDD. */ csrRoamCallCallback(pMac, pSirTdlsDelStaInd->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND); break ; } case eWNI_SME_TDLS_DEL_ALL_PEER_IND: { tpSirTdlsDelAllPeerInd pSirTdlsDelAllPeerInd = (tpSirTdlsDelAllPeerInd) pMsgBuf ; tCsrRoamInfo roamInfo = {0} ; /* Sending the TEARDOWN indication to HDD. */ csrRoamCallCallback(pMac, pSirTdlsDelAllPeerInd->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND); break ; } case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND: { tpSirMgmtTxCompletionInd pSirTdlsDelAllPeerInd = (tpSirMgmtTxCompletionInd) pMsgBuf ; tCsrRoamInfo roamInfo = {0} ; roamInfo.reasonCode = pSirTdlsDelAllPeerInd->txCompleteStatus; csrRoamCallCallback(pMac, pSirTdlsDelAllPeerInd->sessionId, &roamInfo, 0, eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND, 0); break; } case eWNI_SME_TDLS_LINK_ESTABLISH_RSP: { tSirTdlsLinkEstablishReqRsp *linkEstablishReqRsp = (tSirTdlsLinkEstablishReqRsp *) pMsgBuf ; tCsrRoamInfo roamInfo = {0} ; #if 0 vos_mem_copy(&roamInfo.peerMac, delStaRsp->peerMac, sizeof(tSirMacAddr)) ; roamInfo.staId = delStaRsp->staId ; roamInfo.statusCode = delStaRsp->statusCode ; #endif csrRoamCallCallback(pMac, linkEstablishReqRsp->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP); /* remove pending eSmeCommandTdlsLinkEstablish command */ csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsLinkEstablish); break; } #ifdef FEATURE_WLAN_TDLS_INTERNAL case eWNI_SME_TDLS_DISCOVERY_START_RSP: { /* remove pending eSmeCommandTdlsDiscovery command */ csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsDiscovery) ; } /* fall through .. */ case eWNI_SME_TDLS_DISCOVERY_START_IND: { tSirTdlsDisRsp *disRsp = (tSirTdlsDisRsp *)pMsgBuf ; if(eSIR_SME_SUCCESS == disRsp->statusCode) { tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; tANI_U16 disStaCount = disRsp->numDisSta ; tCsrTdlsPeerLinkinfo *peerLinkInfo = NULL ; tANI_U8 i = 0 ; VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, ("DIS START RSP/IND recieved sta count = %d"), disStaCount) ; for( ; i < disStaCount ; i++) { tSirTdlsPeerInfo *peerInfo = &disRsp->tdlsDisPeerInfo[i] ; VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, ("SME, peer MAC: "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerInfo->peerMac)); peerLinkInfo = findTdlsPeer(pMac, &disInfo->tdlsPotentialPeerList, peerInfo->peerMac) ; if(NULL == peerLinkInfo) { /* update discovery data base, if this is new entry */ tdlsSaveTdlsPeerInfo(pMac, peerInfo) ; } else { /* update RSSI of existing peer */ tSirTdlsPeerInfo *newPeerInfo = &peerLinkInfo->tdlsDisPeerInfo ; newPeerInfo->tdlsPeerRssi = peerInfo->tdlsPeerRssi ; } } if(0 == i) { smsLog( pMac, LOGW, "there is no tdls client \ discovered .." ) ; } } else {
static eHalStatus hdd_IndicateScanResult(hdd_scan_info_t *scanInfo, tCsrScanResultInfo *scan_result) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(scanInfo->dev) ; tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter); tSirBssDescription *descriptor = &scan_result->BssDescriptor; struct iw_event event; char *current_event = scanInfo->start; char *end = scanInfo->end; char *last_event; char *current_pad; v_U16_t ie_length = 0; v_U16_t capabilityInfo; char *modestr; int error; char custom[MAX_CUSTOM_LEN]; char *p; hddLog( LOG1, "hdd_IndicateScanResult " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(descriptor->bssId)); error = 0; last_event = current_event; vos_mem_zero(&event, sizeof (event)); /* BSSID */ event.cmd = SIOCGIWAP; event.u.ap_addr.sa_family = ARPHRD_ETHER; vos_mem_copy (event.u.ap_addr.sa_data, descriptor->bssId, sizeof (descriptor->bssId)); current_event = iwe_stream_add_event(scanInfo->info,current_event, end, &event, IW_EV_ADDR_LEN); if (last_event == current_event) { /* no space to add event */ /* Error code may be E2BIG */ hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWAP "); return -E2BIG; } last_event = current_event; vos_mem_zero(&event, sizeof (struct iw_event)); /* Protocol Name */ event.cmd = SIOCGIWNAME; switch (descriptor->nwType) { case eSIR_11A_NW_TYPE: modestr = "a"; break; case eSIR_11B_NW_TYPE: modestr = "b"; break; case eSIR_11G_NW_TYPE: modestr = "g"; break; case eSIR_11N_NW_TYPE: modestr = "n"; break; default: hddLog( LOGW, "%s: Unknown network type [%d]", __func__, descriptor->nwType); modestr = "?"; break; } snprintf(event.u.name, IFNAMSIZ, "IEEE 802.11%s", modestr); current_event = iwe_stream_add_event(scanInfo->info,current_event, end, &event, IW_EV_CHAR_LEN); if (last_event == current_event) { /* no space to add event */ hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWNAME"); /* Error code, may be E2BIG */ return -E2BIG; } last_event = current_event; vos_mem_zero( &event, sizeof (struct iw_event)); /*Freq*/ event.cmd = SIOCGIWFREQ; event.u.freq.m = descriptor->channelId; event.u.freq.e = 0; event.u.freq.i = 0; current_event = iwe_stream_add_event(scanInfo->info,current_event, end, &event, IW_EV_FREQ_LEN); if (last_event == current_event) { /* no space to add event */ return -E2BIG; } last_event = current_event; vos_mem_zero( &event, sizeof (struct iw_event)); /* BSS Mode */ event.cmd = SIOCGIWMODE; capabilityInfo = descriptor->capabilityInfo; if (SIR_MAC_GET_ESS(capabilityInfo)) { event.u.mode = IW_MODE_INFRA; } else if (SIR_MAC_GET_IBSS(capabilityInfo)) { event.u.mode = IW_MODE_ADHOC; } else { /* neither ESS or IBSS */ event.u.mode = IW_MODE_AUTO; } current_event = iwe_stream_add_event(scanInfo->info,current_event, end, &event, IW_EV_UINT_LEN); if (last_event == current_event) { /* no space to add event */ hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWMODE"); return -E2BIG; } /* To extract SSID */ ie_length = GET_IE_LEN_IN_BSS( descriptor->length ); if (ie_length > 0) { /* dot11BeaconIEs is a large struct, so we make it static to avoid stack overflow. This API is only invoked via ioctl, so it is serialized by the kernel rtnl_lock and hence does not need to be reentrant */ static tDot11fBeaconIEs dot11BeaconIEs; tDot11fIESSID *pDot11SSID; tDot11fIESuppRates *pDot11SuppRates; tDot11fIEExtSuppRates *pDot11ExtSuppRates; tDot11fIEHTCaps *pDot11IEHTCaps; int numBasicRates = 0; int maxNumRates = 0; pDot11IEHTCaps = NULL; dot11fUnpackBeaconIEs ((tpAniSirGlobal) hHal, (tANI_U8 *) descriptor->ieFields, ie_length, &dot11BeaconIEs); pDot11SSID = &dot11BeaconIEs.SSID; if (pDot11SSID->present ) { last_event = current_event; vos_mem_zero (&event, sizeof (struct iw_event)); event.cmd = SIOCGIWESSID; event.u.data.flags = 1; event.u.data.length = scan_result->ssId.length; current_event = iwe_stream_add_point (scanInfo->info,current_event, end, &event, (char *)scan_result->ssId.ssId); if(last_event == current_event) { /* no space to add event */ hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWESSID"); return -E2BIG; } } if( hdd_GetWPARSNIEs( ( tANI_U8 *) descriptor->ieFields, ie_length, &last_event, ¤t_event, scanInfo ) < 0 ) { hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWESSID"); return -E2BIG; } last_event = current_event; current_pad = current_event + IW_EV_LCP_LEN; vos_mem_zero( &event, sizeof (struct iw_event)); /*Rates*/ event.cmd = SIOCGIWRATE; pDot11SuppRates = &dot11BeaconIEs.SuppRates; if (pDot11SuppRates->present ) { int i; numBasicRates = pDot11SuppRates->num_rates; for (i=0; i<pDot11SuppRates->num_rates; i++) { if (0 != (pDot11SuppRates->rates[i] & 0x7F)) { event.u.bitrate.value = hdd_TranslateABGRateToMbpsRate ( &pDot11SuppRates->rates[i]); current_pad = iwe_stream_add_value (scanInfo->info,current_event, current_pad, end, &event, IW_EV_PARAM_LEN); } } } pDot11ExtSuppRates = &dot11BeaconIEs.ExtSuppRates; if (pDot11ExtSuppRates->present ) { int i,no_of_rates; maxNumRates = numBasicRates + pDot11ExtSuppRates->num_rates; /* Check to make sure the total number of rates doesn't exceed IW_MAX_BITRATES */ maxNumRates = VOS_MIN(maxNumRates , IW_MAX_BITRATES); if((maxNumRates - numBasicRates) > MAX_RATES) { no_of_rates = MAX_RATES; hddLog( LOGW, "Accessing array out of bound that array is pDot11ExtSuppRates->rates "); } else { no_of_rates = maxNumRates - numBasicRates; } for ( i=0; i< no_of_rates ; i++ ) { if (0 != (pDot11ExtSuppRates->rates[i] & 0x7F)) { event.u.bitrate.value = hdd_TranslateABGRateToMbpsRate ( &pDot11ExtSuppRates->rates[i]); current_pad = iwe_stream_add_value (scanInfo->info,current_event, current_pad, end, &event, IW_EV_PARAM_LEN); } } } if ((current_pad - current_event) >= IW_EV_LCP_LEN) { current_event = current_pad; } else { if (last_event == current_event) { /* no space to add event */ hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWRATE"); return -E2BIG; } } last_event = current_event; vos_mem_zero (&event, sizeof (struct iw_event)); event.cmd = SIOCGIWENCODE; if (SIR_MAC_GET_PRIVACY(capabilityInfo)) { event.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY; } else { event.u.data.flags = IW_ENCODE_DISABLED; } event.u.data.length = 0; current_event = iwe_stream_add_point(scanInfo->info,current_event, end, &event, (char *)pDot11SSID->ssid); if(last_event == current_event) { /* no space to add event Error code, may be E2BIG */ return -E2BIG; } } last_event = current_event; vos_mem_zero( &event, sizeof (struct iw_event)); /*RSSI*/ event.cmd = IWEVQUAL; event.u.qual.qual = descriptor->rssi; event.u.qual.noise = descriptor->sinr; /*To keep the rssi icon of the connected AP in the scan window *and the rssi icon of the wireless networks in sync */ if (( eConnectionState_Associated == pAdapter->sessionCtx.station.conn_info.connState ) && ( VOS_TRUE == vos_mem_compare(descriptor->bssId, pAdapter->sessionCtx.station.conn_info.bssId, WNI_CFG_BSSID_LEN))) { event.u.qual.level = pAdapter->rssi; } else { event.u.qual.level = VOS_MIN ((descriptor->rssi + descriptor->sinr), 0); } event.u.qual.updated = IW_QUAL_ALL_UPDATED; current_event = iwe_stream_add_event(scanInfo->info,current_event, end, &event, IW_EV_QUAL_LEN); if(last_event == current_event) { /* no space to add event */ hddLog( LOGW, "hdd_IndicateScanResult: no space for IWEVQUAL"); return -E2BIG; } /* AGE */ event.cmd = IWEVCUSTOM; p = custom; p += scnprintf(p, MAX_CUSTOM_LEN, " Age: %lu", vos_timer_get_system_ticks() - descriptor->nReceivedTime); event.u.data.length = p - custom; current_event = iwe_stream_add_point (scanInfo->info,current_event, end, &event, custom); if(last_event == current_event) { /* no space to add event */ hddLog( LOGW, "hdd_IndicateScanResult: no space for IWEVCUSTOM (age)"); return -E2BIG; } scanInfo->start = current_event; return 0; }
void lim_process_assoc_rsp_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info, uint8_t subtype, tpPESession session_entry) { uint8_t *body; uint16_t caps, ie_len; uint32_t frame_len; tSirMacAddr current_bssid; tpSirMacMgmtHdr hdr = NULL; tSirMacCapabilityInfo mac_capab; tpDphHashNode sta_ds; tpSirAssocRsp assoc_rsp; tLimMlmAssocCnf assoc_cnf; tSchBeaconStruct *beacon; #ifdef WLAN_FEATURE_ROAM_OFFLOAD uint8_t sme_sessionid = 0; #endif tCsrRoamSession *roam_session; /* Initialize status code to success. */ #ifdef WLAN_FEATURE_ROAM_OFFLOAD if (session_entry->bRoamSynchInProgress) hdr = (tpSirMacMgmtHdr) mac_ctx->roam.pReassocResp; else #endif hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); #ifdef WLAN_FEATURE_ROAM_OFFLOAD sme_sessionid = session_entry->smeSessionId; #endif assoc_cnf.resultCode = eSIR_SME_SUCCESS; /* Update PE session Id */ assoc_cnf.sessionId = session_entry->peSessionId; if (hdr == NULL) { lim_log(mac_ctx, LOGE, FL("LFR3: Reassoc response packet header is NULL")); return; } else if (hdr->sa == NULL) { lim_log(mac_ctx, LOGE, FL("LFR3: Reassoc resp packet source address is NULL")); return; } lim_log(mac_ctx, LOG1, FL("received Re/Assoc(%d) resp on sessionid: %d systemrole: %d" "and mlmstate: %d RSSI %d from " MAC_ADDRESS_STR), subtype, session_entry->peSessionId, GET_LIM_SYSTEM_ROLE(session_entry), session_entry->limMlmState, (uint) abs((int8_t) WMA_GET_RX_RSSI_DB(rx_pkt_info)), MAC_ADDR_ARRAY(hdr->sa)); beacon = cdf_mem_malloc(sizeof(tSchBeaconStruct)); if (NULL == beacon) { lim_log(mac_ctx, LOGE, FL("Unable to allocate memory")); return; } if (LIM_IS_AP_ROLE(session_entry) || LIM_IS_BT_AMP_AP_ROLE(session_entry)) { /* * Should not have received Re/Association * Response frame on AP. Log error */ lim_log(mac_ctx, LOGE, FL("Should not recieved Re/Assoc Response in role %d "), GET_LIM_SYSTEM_ROLE(session_entry)); cdf_mem_free(beacon); return; } #ifdef WLAN_FEATURE_ROAM_OFFLOAD if (session_entry->bRoamSynchInProgress) { hdr = (tpSirMacMgmtHdr) mac_ctx->roam.pReassocResp; frame_len = mac_ctx->roam.reassocRespLen - SIR_MAC_HDR_LEN_3A; } else { #endif hdr = WMA_GET_RX_MAC_HEADER(rx_pkt_info); frame_len = WMA_GET_RX_PAYLOAD_LEN(rx_pkt_info); #ifdef WLAN_FEATURE_ROAM_OFFLOAD } #endif if (((subtype == LIM_ASSOC) && (session_entry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE)) || ((subtype == LIM_REASSOC) && ((session_entry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE) #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) && (session_entry->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE) #endif ))) { /* Received unexpected Re/Association Response frame */ #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG lim_log(mac_ctx, LOG1, FL("Recieved Re/Assoc rsp in unexpected " "state %d on session=%d"), session_entry->limMlmState, session_entry->peSessionId); #endif if (!hdr->fc.retry) { if (!(mac_ctx->lim.retry_packet_cnt & 0xf)) { lim_log(mac_ctx, LOGE, FL("recvd Re/Assoc rsp:not a retry frame")); lim_print_mlm_state(mac_ctx, LOGE, session_entry->limMlmState); } else { mac_ctx->lim.retry_packet_cnt++; } } cdf_mem_free(beacon); return; } sir_copy_mac_addr(current_bssid, session_entry->bssId); if (subtype == LIM_ASSOC) { if (!cdf_mem_compare (hdr->sa, current_bssid, sizeof(tSirMacAddr))) { /* * Received Association Response frame from an entity * other than one to which request was initiated. * Ignore this and wait until Assoc Failure Timeout */ lim_log(mac_ctx, LOGW, FL("received AssocRsp from unexpected peer " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(hdr->sa)); cdf_mem_free(beacon); return; } } else { if (!cdf_mem_compare (hdr->sa, session_entry->limReAssocbssId, sizeof(tSirMacAddr))) { /* * Received Reassociation Response frame from an entity * other than one to which request was initiated. * Ignore this and wait until Reassoc Failure Timeout. */ lim_log(mac_ctx, LOGW, FL("received ReassocRsp from unexpected peer " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(hdr->sa)); cdf_mem_free(beacon); return; } } assoc_rsp = cdf_mem_malloc(sizeof(*assoc_rsp)); if (NULL == assoc_rsp) { lim_log(mac_ctx, LOGP, FL("Allocate Memory failed in AssocRsp")); cdf_mem_free(beacon); return; } /* Get pointer to Re/Association Response frame body */ #ifdef WLAN_FEATURE_ROAM_OFFLOAD if (session_entry->bRoamSynchInProgress) body = mac_ctx->roam.pReassocResp + SIR_MAC_HDR_LEN_3A; else #endif body = WMA_GET_RX_MPDU_DATA(rx_pkt_info); /* parse Re/Association Response frame. */ if (sir_convert_assoc_resp_frame2_struct(mac_ctx, body, frame_len, assoc_rsp) == eSIR_FAILURE) { cdf_mem_free(assoc_rsp); lim_log(mac_ctx, LOGE, FL("Parse error Assoc resp subtype %d," "length=%d"), frame_len, subtype); cdf_mem_free(beacon); return; } if (!assoc_rsp->suppRatesPresent) { lim_log(mac_ctx, LOGE, FL("assoc response does not have supported rate set")); cdf_mem_copy(&assoc_rsp->supportedRates, &session_entry->rateSet, sizeof(tSirMacRateSet)); } assoc_cnf.protStatusCode = assoc_rsp->statusCode; if (session_entry->assocRsp != NULL) { lim_log(mac_ctx, LOGW, FL("session_entry->assocRsp is not NULL freeing it " "and setting NULL")); cdf_mem_free(session_entry->assocRsp); session_entry->assocRsp = NULL; } session_entry->assocRsp = cdf_mem_malloc(frame_len); if (NULL == session_entry->assocRsp) { lim_log(mac_ctx, LOGE, FL("Unable to allocate memory for assoc res,len=%d"), frame_len); } else { /* * Store the Assoc response. This is sent * to csr/hdd in join cnf response. */ cdf_mem_copy(session_entry->assocRsp, body, frame_len); session_entry->assocRspLen = frame_len; } #ifdef WLAN_FEATURE_VOWIFI_11R lim_update_ric_data(mac_ctx, session_entry, assoc_rsp); #endif #ifdef WLAN_FEATURE_ROAM_OFFLOAD roam_session = &mac_ctx->roam.roamSession[sme_sessionid]; if (assoc_rsp->FTInfo.R0KH_ID.present) { roam_session->ftSmeContext.r0kh_id_len = assoc_rsp->FTInfo.R0KH_ID.num_PMK_R0_ID; cdf_mem_copy(roam_session->ftSmeContext.r0kh_id, assoc_rsp->FTInfo.R0KH_ID.PMK_R0_ID, roam_session->ftSmeContext.r0kh_id_len); } else { roam_session->ftSmeContext.r0kh_id_len = 0; cdf_mem_zero(roam_session->ftSmeContext.r0kh_id, SIR_ROAM_R0KH_ID_MAX_LEN); } #endif #ifdef FEATURE_WLAN_ESE lim_update_ese_tspec(mac_ctx, session_entry, assoc_rsp); #endif if (assoc_rsp->capabilityInfo.ibss) { /* * Received Re/Association Response from peer * with IBSS capability set. * Ignore the frame and wait until Re/assoc * failure timeout. */ lim_log(mac_ctx, LOGE, FL("received Re/AssocRsp frame with IBSS capability")); cdf_mem_free(assoc_rsp); cdf_mem_free(beacon); return; } if (cfg_get_capability_info(mac_ctx, &caps, session_entry) != eSIR_SUCCESS) { cdf_mem_free(assoc_rsp); cdf_mem_free(beacon); lim_log(mac_ctx, LOGP, FL("could not retrieve Capabilities ")); return; } lim_copy_u16((uint8_t *) &mac_capab, caps); /* Stop Association failure timer */ if (subtype == LIM_ASSOC) lim_deactivate_and_change_timer(mac_ctx, eLIM_ASSOC_FAIL_TIMER); else { /* Stop Reassociation failure timer */ #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) mac_ctx->lim.reAssocRetryAttempt = 0; if ((NULL != mac_ctx->lim.pSessionEntry) && (NULL != mac_ctx->lim.pSessionEntry->pLimMlmReassocRetryReq)) { cdf_mem_free( mac_ctx->lim.pSessionEntry->pLimMlmReassocRetryReq); mac_ctx->lim.pSessionEntry->pLimMlmReassocRetryReq = NULL; } #endif lim_deactivate_and_change_timer(mac_ctx, eLIM_REASSOC_FAIL_TIMER); } if (assoc_rsp->statusCode != eSIR_MAC_SUCCESS_STATUS #ifdef WLAN_FEATURE_11W && (session_entry->limRmfEnabled || assoc_rsp->statusCode != eSIR_MAC_TRY_AGAIN_LATER) #endif ) { /* *Re/Association response was received * either with failure code. */ lim_log(mac_ctx, LOGE, FL("received Re/AssocRsp frame failure code %d"), assoc_rsp->statusCode); /* * Need to update 'association failure' error counter * along with STATUS CODE * Return Assoc confirm to SME with received failure code */ assoc_cnf.resultCode = eSIR_SME_ASSOC_REFUSED; /* Delete Pre-auth context for the associated BSS */ if (lim_search_pre_auth_list(mac_ctx, hdr->sa)) lim_delete_pre_auth_node(mac_ctx, hdr->sa); goto assocReject; } else if ((assoc_rsp->aid & 0x3FFF) > 2007) { /* * Re/Association response was received * with invalid AID value */ lim_log(mac_ctx, LOGE, FL("received Re/AssocRsp frame with" "invalid aid %X"), assoc_rsp->aid); assoc_cnf.resultCode = eSIR_SME_INVALID_ASSOC_RSP_RXED; assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; /* Send advisory Disassociation frame to AP */ lim_send_disassoc_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_REASON, hdr->sa, session_entry, false); goto assocReject; } /* * Association Response received with success code * Set the link state to POSTASSOC now that we have received * assoc/reassoc response * NOTE: for BTAMP case, it is being handled in * lim_process_mlm_assoc_req */ #ifdef WLAN_FEATURE_11W if (session_entry->limRmfEnabled && assoc_rsp->statusCode == eSIR_MAC_TRY_AGAIN_LATER) { if (assoc_rsp->TimeoutInterval.present && (assoc_rsp->TimeoutInterval.timeoutType == SIR_MAC_TI_TYPE_ASSOC_COMEBACK)) { uint16_t timeout_value = assoc_rsp->TimeoutInterval.timeoutValue; if (timeout_value < 10) { /* * if this value is less than 10 then our timer * will fail to start and due to this we will * never re-attempt. Better modify the timer * value here. */ timeout_value = 10; } lim_log(mac_ctx, LOG1, FL("ASSOC res with eSIR_MAC_TRY_AGAIN_LATER " " recvd.Starting timer to wait timeout=%d."), timeout_value); if (CDF_STATUS_SUCCESS != cdf_mc_timer_start( &session_entry->pmfComebackTimer, timeout_value)) { lim_log(mac_ctx, LOGE, FL("Failed to start comeback timer.")); } } else { lim_log(mac_ctx, LOGW, FL("ASSOC resp with try again event recvd. " "But try again time interval IE is wrong.")); } cdf_mem_free(beacon); cdf_mem_free(assoc_rsp); return; } #endif if (!((session_entry->bssType == eSIR_BTAMP_STA_MODE) || ((session_entry->bssType == eSIR_BTAMP_AP_MODE) && LIM_IS_BT_AMP_STA_ROLE(session_entry)))) { if (lim_set_link_state (mac_ctx, eSIR_LINK_POSTASSOC_STATE, session_entry->bssId, session_entry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS) { lim_log(mac_ctx, LOGE, FL("Set link state to POSTASSOC failed")); cdf_mem_free(beacon); cdf_mem_free(assoc_rsp); return; } } if (subtype == LIM_REASSOC) { lim_log (mac_ctx, LOG1, FL("Successfully Reassociated with BSS")); #ifdef FEATURE_WLAN_DIAG_SUPPORT lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_ROAM_ASSOC_COMP_EVENT, session_entry, eSIR_SUCCESS, eSIR_SUCCESS); #endif #ifdef FEATURE_WLAN_ESE if (assoc_rsp->tsmPresent) lim_update_ese_tsm(mac_ctx, session_entry, assoc_rsp); #endif if (session_entry->pLimMlmJoinReq) { cdf_mem_free(session_entry->pLimMlmJoinReq); session_entry->pLimMlmJoinReq = NULL; } session_entry->limAssocResponseData = (void *)assoc_rsp; /* * Store the ReAssocRsp Frame in DphTable * to be used during processing DelSta and * DelBss to send AddBss again */ sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); if (!sta_ds) { lim_log(mac_ctx, LOGE, FL("could not get hash entry at DPH for")); lim_print_mac_addr(mac_ctx, hdr->sa, LOGE); assoc_cnf.resultCode = eSIR_SME_INVALID_ASSOC_RSP_RXED; assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; /* Send advisory Disassociation frame to AP */ lim_send_disassoc_mgmt_frame(mac_ctx, eSIR_MAC_UNSPEC_FAILURE_REASON, hdr->sa, session_entry, false); goto assocReject; } #if defined(WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) if (session_entry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE) { #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG lim_log(mac_ctx, LOG1, FL("Sending self sta")); #endif lim_update_assoc_sta_datas(mac_ctx, sta_ds, assoc_rsp, session_entry); /* Store assigned AID for TIM processing */ session_entry->limAID = assoc_rsp->aid & 0x3FFF; /* Downgrade the EDCA parameters if needed */ lim_set_active_edca_params(mac_ctx, session_entry->gLimEdcaParams, session_entry); /* Send the active EDCA parameters to HAL */ #ifdef WLAN_FEATURE_ROAM_OFFLOAD if (!session_entry->bRoamSynchInProgress) { #endif lim_send_edca_params(mac_ctx, session_entry->gLimEdcaParamsActive, sta_ds->bssId); #ifdef WLAN_FEATURE_ROAM_OFFLOAD } #endif lim_add_ft_sta_self(mac_ctx, (assoc_rsp->aid & 0x3FFF), session_entry); cdf_mem_free(beacon); return; } #endif /* WLAN_FEATURE_VOWIFI_11R */ /* * If we're re-associating to the same BSS, * we don't want to invoke delete STA, delete * BSS, as that would remove the already * established TSPEC. Just go ahead and re-add * the BSS, STA with new capability information. * However, if we're re-associating to a different * BSS, then follow thru with del STA, del BSS, * add BSS, add STA. */ if (sir_compare_mac_addr(session_entry->bssId, session_entry->limReAssocbssId)) lim_handle_add_bss_in_re_assoc_context(mac_ctx, sta_ds, session_entry); else { /* * reset the uapsd mask settings since * we're re-associating to new AP */ session_entry->gUapsdPerAcDeliveryEnableMask = 0; session_entry->gUapsdPerAcTriggerEnableMask = 0; if (lim_cleanup_rx_path(mac_ctx, sta_ds, session_entry) != eSIR_SUCCESS) { lim_log(mac_ctx, LOGE, FL("Could not cleanup the rx path")); goto assocReject; } } cdf_mem_free(beacon); return; } lim_log(mac_ctx, LOG1, FL("Successfully Associated with BSS " MAC_ADDRESS_STR), MAC_ADDR_ARRAY(hdr->sa)); #ifdef FEATURE_WLAN_ESE if (session_entry->eseContext.tsm.tsmInfo.state) session_entry->eseContext.tsm.tsmMetrics.RoamingCount = 0; #endif /* Store assigned AID for TIM processing */ session_entry->limAID = assoc_rsp->aid & 0x3FFF; /* STA entry was created during pre-assoc state. */ sta_ds = dph_get_hash_entry(mac_ctx, DPH_STA_HASH_INDEX_PEER, &session_entry->dph.dphHashTable); if (sta_ds == NULL) { /* Could not add hash table entry */ lim_log(mac_ctx, LOGE, FL("could not get hash entry at DPH ")); lim_print_mac_addr(mac_ctx, hdr->sa, LOGE); assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; assoc_cnf.protStatusCode = eSIR_SME_SUCCESS; lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, (uint32_t *) &assoc_cnf); cdf_mem_free(assoc_rsp); cdf_mem_free(beacon); return; } /* Delete Pre-auth context for the associated BSS */ if (lim_search_pre_auth_list(mac_ctx, hdr->sa)) lim_delete_pre_auth_node(mac_ctx, hdr->sa); lim_update_assoc_sta_datas(mac_ctx, sta_ds, assoc_rsp, session_entry); /* * Extract the AP capabilities from the beacon that * was received earlier */ ie_len = lim_get_ielen_from_bss_description( &session_entry->pLimJoinReq->bssDescription); lim_extract_ap_capabilities(mac_ctx, (uint8_t *) session_entry->pLimJoinReq->bssDescription.ieFields, ie_len, beacon); if (mac_ctx->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE) lim_decide_sta_protection_on_assoc(mac_ctx, beacon, session_entry); if (beacon->erpPresent) { if (beacon->erpIEInfo.barkerPreambleMode) session_entry->beaconParams.fShortPreamble = false; else session_entry->beaconParams.fShortPreamble = true; } #ifdef FEATURE_WLAN_DIAG_SUPPORT lim_diag_event_report(mac_ctx, WLAN_PE_DIAG_CONNECTED, session_entry, eSIR_SUCCESS, eSIR_SUCCESS); #endif if (assoc_rsp->QosMapSet.present) cdf_mem_copy(&session_entry->QosMapSet, &assoc_rsp->QosMapSet, sizeof(tSirQosMapSet)); else cdf_mem_zero(&session_entry->QosMapSet, sizeof(tSirQosMapSet)); lim_update_stads_ext_cap(mac_ctx, session_entry, assoc_rsp, sta_ds); /* Update the BSS Entry, this entry was added during preassoc. */ if (eSIR_SUCCESS == lim_sta_send_add_bss(mac_ctx, assoc_rsp, beacon, &session_entry->pLimJoinReq->bssDescription, true, session_entry)) { cdf_mem_free(assoc_rsp); cdf_mem_free(beacon); return; } else { lim_log(mac_ctx, LOGE, FL("could not update the bss entry")); assoc_cnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; assoc_cnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; } assocReject: if ((subtype == LIM_ASSOC) #ifdef WLAN_FEATURE_VOWIFI_11R || ((subtype == LIM_REASSOC) && (session_entry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE)) #endif ) { lim_log(mac_ctx, LOGE, FL("Assoc Rejected by the peer. " "mlmestate: %d sessionid %d Reason: %d MACADDR:" MAC_ADDRESS_STR), session_entry->limMlmState, session_entry->peSessionId, assoc_cnf.resultCode, MAC_ADDR_ARRAY(hdr->sa)); session_entry->limMlmState = eLIM_MLM_IDLE_STATE; MTRACE(mac_trace(mac_ctx, TRACE_CODE_MLM_STATE, session_entry->peSessionId, session_entry->limMlmState)); if (session_entry->pLimMlmJoinReq) { cdf_mem_free(session_entry->pLimMlmJoinReq); session_entry->pLimMlmJoinReq = NULL; } if (subtype == LIM_ASSOC) { lim_post_sme_message(mac_ctx, LIM_MLM_ASSOC_CNF, (uint32_t *) &assoc_cnf); } #ifdef WLAN_FEATURE_VOWIFI_11R else { assoc_cnf.resultCode = eSIR_SME_FT_REASSOC_FAILURE; lim_post_sme_message(mac_ctx, LIM_MLM_REASSOC_CNF, (uint32_t *)&assoc_cnf); } #endif } else { lim_restore_pre_reassoc_state(mac_ctx, eSIR_SME_REASSOC_REFUSED, assoc_cnf.protStatusCode, session_entry); } cdf_mem_free(beacon); cdf_mem_free(assoc_rsp); return; }
pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0; pMac->lim.gpSession[i].htSecondaryChannelOffset = 0; #ifdef FEATURE_WLAN_TDLS vos_mem_set(pMac->lim.gpSession[i].peerAIDBitmap, sizeof(pMac->lim.gpSession[i].peerAIDBitmap), 0); pMac->lim.gpSession[i].tdls_prohibited = false; pMac->lim.gpSession[i].tdls_chan_swit_prohibited = false; #endif pMac->lim.gpSession[i].fWaitForProbeRsp = 0; pMac->lim.gpSession[i].fIgnoreCapsChange = 0; VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_DEBUG, "Create a new PE session (%d) with BSSID: " MAC_ADDRESS_STR " Max No. of STA %d", pMac->lim.gpSession[i].peSessionId, MAC_ADDR_ARRAY(bssid), numSta); /* Initialize PMM Ps Offload Module */ if(pMac->psOffloadEnabled) { if(pmmPsOffloadOpen(pMac, &pMac->lim.gpSession[i]) != eHAL_STATUS_SUCCESS) { limLog(pMac, LOGE, FL("Failed to open ps offload for pe session %x\n"),i); } } if (eSIR_INFRA_AP_MODE == bssType || eSIR_IBSS_MODE == bssType || eSIR_BTAMP_AP_MODE == bssType)
/*-------------------------------------------------------------------------- \brief peDeleteSession() - deletes the PE session given the session ID. \param pMac - pointer to global adapter context \param sessionId -session ID of the session which needs to be deleted. \sa --------------------------------------------------------------------------*/ void peDeleteSession(tpAniSirGlobal pMac, tpPESession psessionEntry) { tANI_U16 i = 0; tANI_U16 n; TX_TIMER *timer_ptr; eHalStatus lock_status = eHAL_STATUS_SUCCESS; limLog(pMac, LOGW, FL("Trying to delete a session %d Opmode %d BssIdx %d" " BSSID: " MAC_ADDRESS_STR), psessionEntry->peSessionId, psessionEntry->operMode, psessionEntry->bssIdx, MAC_ADDR_ARRAY(psessionEntry->bssId)); for (n = 0; n < pMac->lim.maxStation; n++) { timer_ptr = &pMac->lim.limTimers.gpLimCnfWaitTimer[n]; if(psessionEntry->peSessionId == timer_ptr->sessionId) { if(VOS_TRUE == tx_timer_running(timer_ptr)) { tx_timer_deactivate(timer_ptr); } } } #ifdef WLAN_FEATURE_11AC /* Unblock the MuBF for other session if the MuBf session is deleted */ if(psessionEntry->txMuBformee) { pMac->isMuBfsessionexist = FALSE; } #endif if (psessionEntry->pLimStartBssReq != NULL) { vos_mem_free( psessionEntry->pLimStartBssReq ); psessionEntry->pLimStartBssReq = NULL; } if(psessionEntry->pLimJoinReq != NULL) { vos_mem_free( psessionEntry->pLimJoinReq ); psessionEntry->pLimJoinReq = NULL; } if(psessionEntry->pLimReAssocReq != NULL) { vos_mem_free( psessionEntry->pLimReAssocReq ); psessionEntry->pLimReAssocReq = NULL; } if(psessionEntry->pLimMlmJoinReq != NULL) { vos_mem_free( psessionEntry->pLimMlmJoinReq ); psessionEntry->pLimMlmJoinReq = NULL; } lock_status = pe_AcquireGlobalLock(&pMac->lim); if (eHAL_STATUS_SUCCESS == lock_status) { if (psessionEntry->dph.dphHashTable.pHashTable != NULL) { vos_mem_vfree(psessionEntry->dph.dphHashTable.pHashTable); psessionEntry->dph.dphHashTable.pHashTable = NULL; } } pe_ReleaseGlobalLock(&pMac->lim); if(psessionEntry->dph.dphHashTable.pDphNodeArray != NULL) { vos_mem_vfree(psessionEntry->dph.dphHashTable.pDphNodeArray); psessionEntry->dph.dphHashTable.pDphNodeArray = NULL; } if(psessionEntry->gpLimPeerIdxpool != NULL) { vos_mem_vfree(psessionEntry->gpLimPeerIdxpool); psessionEntry->gpLimPeerIdxpool = NULL; } if(psessionEntry->beacon != NULL) { vos_mem_free( psessionEntry->beacon); psessionEntry->beacon = NULL; } if(psessionEntry->assocReq != NULL) { vos_mem_free( psessionEntry->assocReq); psessionEntry->assocReq = NULL; } if(psessionEntry->assocRsp != NULL) { vos_mem_free( psessionEntry->assocRsp); psessionEntry->assocRsp = NULL; } if(psessionEntry->parsedAssocReq != NULL) { // Cleanup the individual allocation first for (i=0; i < psessionEntry->dph.dphHashTable.size; i++) { if ( psessionEntry->parsedAssocReq[i] != NULL ) { if( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame ) { vos_mem_free(((tpSirAssocReq) (psessionEntry->parsedAssocReq[i]))->assocReqFrame); ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrame = NULL; ((tpSirAssocReq)(psessionEntry->parsedAssocReq[i]))->assocReqFrameLength = 0; } vos_mem_free(psessionEntry->parsedAssocReq[i]); psessionEntry->parsedAssocReq[i] = NULL; } } // Cleanup the whole block vos_mem_free(psessionEntry->parsedAssocReq); psessionEntry->parsedAssocReq = NULL; } if (NULL != psessionEntry->limAssocResponseData) { vos_mem_free( psessionEntry->limAssocResponseData); psessionEntry->limAssocResponseData = NULL; } #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) if (NULL != psessionEntry->pLimMlmReassocRetryReq) { vos_mem_free( psessionEntry->pLimMlmReassocRetryReq); psessionEntry->pLimMlmReassocRetryReq = NULL; } #endif if (NULL != psessionEntry->pLimMlmReassocReq) { vos_mem_free( psessionEntry->pLimMlmReassocReq); psessionEntry->pLimMlmReassocReq = NULL; } #if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD) limCleanupEseCtxt(pMac, psessionEntry); #endif psessionEntry->valid = FALSE; return; }
/*-------------------------------------------------------------------------- \brief peCreateSession() - creates a new PE session given the BSSID This function returns the session context and the session ID if the session corresponding to the passed BSSID is found in the PE session table. \param pMac - pointer to global adapter context \param bssid - BSSID of the new session \param sessionId -session ID is returned here, if session is created. \return tpPESession - pointer to the session context or NULL if session can not be created. \sa --------------------------------------------------------------------------*/ tpPESession peCreateSession(tpAniSirGlobal pMac, tANI_U8 *bssid , tANI_U8* sessionId, tANI_U16 numSta) { tANI_U8 i; for(i =0; i < pMac->lim.maxBssId; i++) { /* Find first free room in session table */ if(pMac->lim.gpSession[i].valid == FALSE) { vos_mem_set((void*)&pMac->lim.gpSession[i], sizeof(tPESession), 0); //Allocate space for Station Table for this session. pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = vos_mem_vmalloc( sizeof(tpDphHashNode)*numSta); if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pHashTable ) { limLog(pMac, LOGE, FL("memory allocate for size %lu failed!"), (long unsigned int) sizeof(tpDphHashNode)*numSta); return NULL; } pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = vos_mem_vmalloc( sizeof(tDphHashNode)*numSta); if ( NULL == pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray ) { limLog(pMac, LOGE, FL("memory allocate failed for Node array" "of size %lu"), (long unsigned int) sizeof(tDphHashNode)*numSta); vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable); pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL; return NULL; } pMac->lim.gpSession[i].dph.dphHashTable.size = numSta; dphHashTableClassInit(pMac, &pMac->lim.gpSession[i].dph.dphHashTable); pMac->lim.gpSession[i].gpLimPeerIdxpool = vos_mem_vmalloc(sizeof( *pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1)); if ( NULL == pMac->lim.gpSession[i].gpLimPeerIdxpool ) { limLog(pMac, LOGE, FL("memory allocate failed " "for peerId pool of size %lu!"), (long unsigned int) sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1)); vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pHashTable); vos_mem_vfree(pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray); pMac->lim.gpSession[i].dph.dphHashTable.pHashTable = NULL; pMac->lim.gpSession[i].dph.dphHashTable.pDphNodeArray = NULL; return NULL; } vos_mem_set(pMac->lim.gpSession[i].gpLimPeerIdxpool, sizeof(*pMac->lim.gpSession[i].gpLimPeerIdxpool) * (numSta+1), 0); pMac->lim.gpSession[i].freePeerIdxHead = 0; pMac->lim.gpSession[i].freePeerIdxTail = 0; pMac->lim.gpSession[i].gLimNumOfCurrentSTAs = 0; /* Copy the BSSID to the session table */ sirCopyMacAddr(pMac->lim.gpSession[i].bssId, bssid); pMac->lim.gpSession[i].valid = TRUE; /* Intialize the SME and MLM states to IDLE */ pMac->lim.gpSession[i].limMlmState = eLIM_MLM_IDLE_STATE; pMac->lim.gpSession[i].limSmeState = eLIM_SME_IDLE_STATE; pMac->lim.gpSession[i].limCurrentAuthType = eSIR_OPEN_SYSTEM; peInitBeaconParams(pMac, &pMac->lim.gpSession[i]); #ifdef WLAN_FEATURE_VOWIFI_11R pMac->lim.gpSession[i].is11Rconnection = FALSE; #endif #ifdef FEATURE_WLAN_ESE pMac->lim.gpSession[i].isESEconnection = FALSE; #endif #if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR) pMac->lim.gpSession[i].isFastTransitionEnabled = FALSE; #endif #ifdef FEATURE_WLAN_LFR pMac->lim.gpSession[i].isFastRoamIniFeatureEnabled = FALSE; #endif *sessionId = i; pMac->lim.gpSession[i].gLimPhyMode = WNI_CFG_PHY_MODE_11G; //TODO :Check with the team what should be default mode /* Initialize CB mode variables when session is created */ pMac->lim.gpSession[i].htSupportedChannelWidthSet = 0; pMac->lim.gpSession[i].htRecommendedTxWidthSet = 0; pMac->lim.gpSession[i].htSecondaryChannelOffset = 0; #ifdef FEATURE_WLAN_TDLS vos_mem_set(pMac->lim.gpSession[i].peerAIDBitmap, sizeof(pMac->lim.gpSession[i].peerAIDBitmap), 0); pMac->lim.gpSession[i].tdlsChanSwitProhibited = 0; #endif pMac->lim.gpSession[i].fWaitForProbeRsp = 0; pMac->lim.gpSession[i].fIgnoreCapsChange = 0; limLog(pMac, LOG1, FL("Create a new sessionId (%d) with BSSID: " MAC_ADDRESS_STR " Max No. of STA %d"), pMac->lim.gpSession[i].peSessionId, MAC_ADDR_ARRAY(bssid), numSta); return(&pMac->lim.gpSession[i]); } } limLog(pMac, LOGE, FL("Session can not be created.. Reached Max permitted sessions ")); return NULL; }
/** * 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; }
/* * TDLS Message processor, will be called after TDLS message received from * PE */ eHalStatus tdlsMsgProcessor(tpAniSirGlobal pMac, v_U16_t msgType, void *pMsgBuf) { tCsrRoamInfo roamInfo = {0} ; switch(msgType) { case eWNI_SME_TDLS_SEND_MGMT_RSP: { /* remove pending eSmeCommandTdlsDiscovery command */ csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsSendMgmt) ; } break; case eWNI_SME_TDLS_ADD_STA_RSP: { tSirTdlsAddStaRsp *addStaRsp = (tSirTdlsAddStaRsp *) pMsgBuf ; eCsrRoamResult roamResult ; vos_mem_copy( &roamInfo.peerMac, addStaRsp->peerMac, sizeof(tSirMacAddr)) ; roamInfo.staId = addStaRsp->staId ; roamInfo.ucastSig = addStaRsp->ucastSig ; roamInfo.bcastSig = addStaRsp->bcastSig ; roamInfo.statusCode = addStaRsp->statusCode ; /* * register peer with TL, we have to go through HDD as this is * the only way to register any STA with TL. */ if (addStaRsp->tdlsAddOper == TDLS_OPER_ADD) roamResult = eCSR_ROAM_RESULT_ADD_TDLS_PEER; else /* addStaRsp->tdlsAddOper must be TDLS_OPER_UPDATE */ roamResult = eCSR_ROAM_RESULT_UPDATE_TDLS_PEER; csrRoamCallCallback(pMac, addStaRsp->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, roamResult); /* remove pending eSmeCommandTdlsDiscovery command */ csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsAddPeer) ; } break; case eWNI_SME_TDLS_DEL_STA_RSP: { tSirTdlsDelStaRsp *delStaRsp = (tSirTdlsDelStaRsp *) pMsgBuf ; vos_mem_copy( &roamInfo.peerMac, delStaRsp->peerMac, sizeof(tSirMacAddr)) ; roamInfo.staId = delStaRsp->staId ; roamInfo.statusCode = delStaRsp->statusCode ; /* * register peer with TL, we have to go through HDD as this is * the only way to register any STA with TL. */ csrRoamCallCallback(pMac, delStaRsp->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_DELETE_TDLS_PEER); csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsDelPeer) ; } break; case eWNI_SME_TDLS_DEL_STA_IND: { tpSirTdlsDelStaInd pSirTdlsDelStaInd = (tpSirTdlsDelStaInd) pMsgBuf ; vos_mem_copy( &roamInfo.peerMac, pSirTdlsDelStaInd->peerMac, sizeof(tSirMacAddr)) ; roamInfo.staId = pSirTdlsDelStaInd->staId ; roamInfo.reasonCode = pSirTdlsDelStaInd->reasonCode ; /* Sending the TEARDOWN indication to HDD. */ csrRoamCallCallback(pMac, pSirTdlsDelStaInd->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_TEARDOWN_TDLS_PEER_IND); break ; } case eWNI_SME_TDLS_DEL_ALL_PEER_IND: { tpSirTdlsDelAllPeerInd pSirTdlsDelAllPeerInd = (tpSirTdlsDelAllPeerInd) pMsgBuf ; /* Sending the TEARDOWN indication to HDD. */ csrRoamCallCallback(pMac, pSirTdlsDelAllPeerInd->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_DELETE_ALL_TDLS_PEER_IND); break ; } case eWNI_SME_MGMT_FRM_TX_COMPLETION_IND: { tpSirMgmtTxCompletionInd pSirTdlsDelAllPeerInd = (tpSirMgmtTxCompletionInd) pMsgBuf ; roamInfo.reasonCode = pSirTdlsDelAllPeerInd->txCompleteStatus; csrRoamCallCallback(pMac, pSirTdlsDelAllPeerInd->sessionId, &roamInfo, 0, eCSR_ROAM_RESULT_MGMT_TX_COMPLETE_IND, 0); break; } case eWNI_SME_TDLS_LINK_ESTABLISH_RSP: { tSirTdlsLinkEstablishReqRsp *linkEstablishReqRsp = (tSirTdlsLinkEstablishReqRsp *) pMsgBuf ; vos_mem_copy(&roamInfo.peerMac, linkEstablishReqRsp->peerMac, sizeof(tSirMacAddr)); roamInfo.staId = (uint8_t)linkEstablishReqRsp->sta_idx; roamInfo.statusCode = linkEstablishReqRsp->statusCode; csrRoamCallCallback(pMac, linkEstablishReqRsp->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_LINK_ESTABLISH_REQ_RSP); /* remove pending eSmeCommandTdlsLinkEstablish command */ csrTdlsRemoveSmeCmd(pMac, eSmeCommandTdlsLinkEstablish); break; } case eWNI_SME_TDLS_SHOULD_DISCOVER: { tSirTdlsEventNotify *tevent = (tSirTdlsEventNotify *) pMsgBuf; vos_mem_copy(&roamInfo.peerMac, tevent->peerMac, sizeof(tSirMacAddr)); roamInfo.reasonCode = tevent->peer_reason; VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: eWNI_SME_TDLS_SHOULD_DISCOVER for peer mac: " MAC_ADDRESS_STR " peer_reason: %d", __func__, MAC_ADDR_ARRAY(tevent->peerMac), tevent->peer_reason); csrRoamCallCallback(pMac, tevent->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_TDLS_SHOULD_DISCOVER); break; } case eWNI_SME_TDLS_SHOULD_TEARDOWN: { tSirTdlsEventNotify *tevent = (tSirTdlsEventNotify *) pMsgBuf; vos_mem_copy(&roamInfo.peerMac, tevent->peerMac, sizeof(tSirMacAddr)); roamInfo.reasonCode = tevent->peer_reason; VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: eWNI_SME_TDLS_SHOULD_TEARDOWN for peer mac: " MAC_ADDRESS_STR " peer_reason: %d", __func__, MAC_ADDR_ARRAY(tevent->peerMac), tevent->peer_reason); csrRoamCallCallback(pMac, tevent->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_TDLS_SHOULD_TEARDOWN); break; } case eWNI_SME_TDLS_PEER_DISCONNECTED: { tSirTdlsEventNotify *tevent = (tSirTdlsEventNotify *) pMsgBuf; vos_mem_copy(&roamInfo.peerMac, tevent->peerMac, sizeof(tSirMacAddr)); roamInfo.reasonCode = tevent->peer_reason; VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, "%s: eWNI_SME_TDLS_PEER_DISCONNECTED for peer mac: " MAC_ADDRESS_STR " peer_reason: %d", __func__, MAC_ADDR_ARRAY(tevent->peerMac), tevent->peer_reason); csrRoamCallCallback(pMac, tevent->sessionId, &roamInfo, 0, eCSR_ROAM_TDLS_STATUS_UPDATE, eCSR_ROAM_RESULT_TDLS_SHOULD_PEER_DISCONNECTED); break; } default: { break ; } } return eHAL_STATUS_SUCCESS ; }