/* --------------------------------------------------------------------------- \fn oemData_SendMBOemDataReq \brief Request an OEM DATA REQ to be passed down to PE \param pMac: \param pOemDataReq: Pointer to the oem data request \return eHalStatus -------------------------------------------------------------------------------*/ eHalStatus oemData_SendMBOemDataReq(tpAniSirGlobal pMac, tOemDataReq *pOemDataReq) { eHalStatus status = eHAL_STATUS_SUCCESS; tSirOemDataReq* pMsg; tANI_U16 msgLen; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pOemDataReq->sessionId ); smsLog(pMac, LOGW, "OEM_DATA: entering Function %s", __func__); msgLen = (tANI_U16)(sizeof(tSirOemDataReq)); status = palAllocateMemory(pMac->hHdd, (void**)&pMsg, msgLen); if(HAL_STATUS_SUCCESS(status)) { palZeroMemory(pMac->hHdd, pMsg, msgLen); pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_OEM_DATA_REQ); palCopyMemory(pMac->hHdd, pMsg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr) ); status = palCopyMemory(pMac->hHdd, pMsg->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE); if(HAL_STATUS_SUCCESS(status)) { smsLog(pMac, LOGW, "OEM_DATA: sending message to pe%s", __func__); status = palSendMBMessage(pMac->hHdd, pMsg); } else { palFreeMemory(pMac->hHdd, pMsg); } } smsLog(pMac, LOGW, "OEM_DATA: exiting Function %s", __func__); return status; }
eHalStatus csrTdlsProcessAddSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = &cmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; tSirTdlsAddStaReq *tdlsAddStaReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = 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 **)&tdlsAddStaReq, (sizeof(tSirTdlsAddStaReq) ) ); if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("alloc failed") ); VOS_ASSERT(0) ; return status ; } tdlsAddStaReq->sessionId = cmd->sessionId; tdlsAddStaReq->tdlsAddOper = tdlsAddStaCmdInfo->tdlsAddOper; //Using dialog as transactionId. This can be used to match response with request tdlsAddStaReq->transactionId = 0; palCopyMemory(pMac->hHdd, tdlsAddStaReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); palCopyMemory(pMac->hHdd, tdlsAddStaReq->peerMac, tdlsAddStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ; tdlsAddStaReq->capability = tdlsAddStaCmdInfo->capability; tdlsAddStaReq->uapsd_queues = tdlsAddStaCmdInfo->uapsdQueues; tdlsAddStaReq->max_sp = tdlsAddStaCmdInfo->maxSp; palCopyMemory(pMac->hHdd, tdlsAddStaReq->extn_capability, tdlsAddStaCmdInfo->extnCapability, SIR_MAC_MAX_EXTN_CAP); tdlsAddStaReq->htcap_present = tdlsAddStaCmdInfo->htcap_present; palCopyMemory(pMac->hHdd, &tdlsAddStaReq->htCap, &tdlsAddStaCmdInfo->HTCap, sizeof(tdlsAddStaCmdInfo->HTCap)); tdlsAddStaReq->vhtcap_present = tdlsAddStaCmdInfo->vhtcap_present; palCopyMemory(pMac->hHdd, &tdlsAddStaReq->vhtCap, &tdlsAddStaCmdInfo->VHTCap, sizeof(tdlsAddStaCmdInfo->VHTCap)); tdlsAddStaReq->supported_rates_length = tdlsAddStaCmdInfo->supportedRatesLen; palCopyMemory(pMac->hHdd, &tdlsAddStaReq->supported_rates, tdlsAddStaCmdInfo->supportedRates, tdlsAddStaCmdInfo->supportedRatesLen); // Send the request to PE. smsLog( pMac, LOGE, "sending TDLS Add Sta req to PE " ); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_ADD_STA_REQ, (void *)tdlsAddStaReq , sizeof(tSirTdlsAddStaReq)) ; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC")); } return status; }
eHalStatus csrTdlsProcessSendMgmt( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsSendMgmtCmdInfo *tdlsSendMgmtCmdInfo = &cmd->u.tdlsCmd.u.tdlsSendMgmtCmdInfo ; tSirTdlsSendMgmtReq *tdlsSendMgmtReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = 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 **)&tdlsSendMgmtReq, (sizeof(tSirTdlsSendMgmtReq) + tdlsSendMgmtCmdInfo->len ) ); if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("alloc failed") ); VOS_ASSERT(0) ; return status ; } tdlsSendMgmtReq->sessionId = cmd->sessionId; //Using dialog as transactionId. This can be used to match response with request tdlsSendMgmtReq->transactionId = tdlsSendMgmtCmdInfo->dialog; tdlsSendMgmtReq->reqType = tdlsSendMgmtCmdInfo->frameType ; tdlsSendMgmtReq->dialog = tdlsSendMgmtCmdInfo->dialog ; tdlsSendMgmtReq->statusCode = tdlsSendMgmtCmdInfo->statusCode ; tdlsSendMgmtReq->responder = tdlsSendMgmtCmdInfo->responder; palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->peerMac, tdlsSendMgmtCmdInfo->peerMac, sizeof(tSirMacAddr)) ; if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf) { palCopyMemory(pMac->hHdd, tdlsSendMgmtReq->addIe, tdlsSendMgmtCmdInfo->buf, tdlsSendMgmtCmdInfo->len); } // Send the request to PE. smsLog( pMac, LOG1, "sending TDLS Mgmt Frame req to PE " ); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_SEND_MGMT_REQ, (void *)tdlsSendMgmtReq , sizeof(tSirTdlsSendMgmtReq)+tdlsSendMgmtCmdInfo->len) ; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC")); } if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf) { //Done with the buf. Free it. vos_mem_free( tdlsSendMgmtCmdInfo->buf ); tdlsSendMgmtCmdInfo->buf = NULL; tdlsSendMgmtCmdInfo->len = 0; } 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; } 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) { 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; //Using dialog as transactionId. This can be used to match response with request tdlsDelStaReq->transactionId = 0; palCopyMemory(pMac->hHdd, tdlsDelStaReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); palCopyMemory(pMac->hHdd, 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 %02x:%02x:%02x:%02x:%02x:%02x req to PE", tdlsDelStaCmdInfo->peerMac[0], tdlsDelStaCmdInfo->peerMac[1], tdlsDelStaCmdInfo->peerMac[2], tdlsDelStaCmdInfo->peerMac[3], tdlsDelStaCmdInfo->peerMac[4], tdlsDelStaCmdInfo->peerMac[5]); 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; }
/* * commands received from CSR */ eHalStatus csrTdlsProcessCmd(tpAniSirGlobal pMac, tSmeCmd *cmd) { eSmeCommandType cmdType = cmd->command ; tANI_BOOLEAN status = eANI_BOOLEAN_TRUE; switch(cmdType) { case eSmeCommandTdlsSendMgmt: { status = csrTdlsProcessSendMgmt( pMac, cmd ); if(HAL_STATUS_SUCCESS( status ) ) { status = eANI_BOOLEAN_FALSE ; } } break ; case eSmeCommandTdlsAddPeer: { status = csrTdlsProcessAddSta( pMac, cmd ); if(HAL_STATUS_SUCCESS( status ) ) { status = eANI_BOOLEAN_FALSE ; } } break; case eSmeCommandTdlsDelPeer: { status = csrTdlsProcessDelSta( pMac, cmd ); if(HAL_STATUS_SUCCESS( status ) ) { status = eANI_BOOLEAN_FALSE ; } } break; case eSmeCommandTdlsLinkEstablish: { status = csrTdlsProcessLinkEstablish( pMac, cmd ); if(HAL_STATUS_SUCCESS( status ) ) { status = eANI_BOOLEAN_FALSE ; } } break; default: { /* TODO: Add default handling */ break ; } } return status ; }
/* --------------------------------------------------------------------------- \fn oemData_ProcessOemDataReqCommand \brief This function is called by the smeProcessCommand when the case hits eSmeCommandOemDataReq \return eHalStatus -------------------------------------------------------------------------------*/ eHalStatus oemData_ProcessOemDataReqCommand(tpAniSirGlobal pMac, tSmeCmd *pOemDataReqCmd) { eHalStatus status = eHAL_STATUS_SUCCESS; //check if the system is in proper mode of operation for //oem data req/rsp to be functional. Currently, concurrency is not //supported and the driver must be operational only as //STA for oem data req/rsp to be functional. We return an invalid //mode flag if it is operational as any one of the following //in any of the active sessions //1. AP Mode //2. IBSS Mode //3. BTAMP Mode ... if(eHAL_STATUS_SUCCESS == oemData_IsOemDataReqAllowed(pMac)) { smsLog(pMac, LOG1, "%s: OEM_DATA REQ allowed in the current mode", __func__); pMac->oemData.oemDataReqActive = eANI_BOOLEAN_TRUE; status = oemData_SendMBOemDataReq(pMac, &(pOemDataReqCmd->u.oemDataCmd.oemDataReq)); } else { smsLog(pMac, LOG1, "%s: OEM_DATA REQ not allowed in the current mode", __func__); status = eHAL_STATUS_FAILURE; } if(!HAL_STATUS_SUCCESS(status)) { smsLog(pMac, LOG1, "%s: OEM_DATA Failure, Release command", __func__); oemData_ReleaseOemDataReqCommand(pMac, pOemDataReqCmd, eOEM_DATA_REQ_INVALID_MODE); pMac->oemData.oemDataReqActive = eANI_BOOLEAN_FALSE; } return status; }
/* --------------------------------------------------------------------------- \fn oemData_SendMBOemDataReq \brief Request an OEM DATA REQ to be passed down to PE \param pMac: \param pOemDataReq: Pointer to the oem data request \return eHalStatus -------------------------------------------------------------------------------*/ eHalStatus oemData_SendMBOemDataReq(tpAniSirGlobal pMac, tOemDataReq *pOemDataReq) { eHalStatus status = eHAL_STATUS_SUCCESS; tSirOemDataReq* pMsg; tANI_U16 msgLen; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, pOemDataReq->sessionId ); smsLog(pMac, LOGW, "OEM_DATA: entering Function %s", __func__); msgLen = (tANI_U16)(sizeof(tSirOemDataReq)); pMsg = vos_mem_malloc(msgLen); if ( NULL == pMsg ) status = eHAL_STATUS_FAILURE; else status = eHAL_STATUS_SUCCESS; if(HAL_STATUS_SUCCESS(status)) { vos_mem_set(pMsg, msgLen, 0); pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_OEM_DATA_REQ); pMsg->messageLen = pal_cpu_to_be16(msgLen); vos_mem_copy(pMsg->selfMacAddr, pSession->selfMacAddr, sizeof(tSirMacAddr) ); vos_mem_copy(pMsg->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE); smsLog(pMac, LOGW, "OEM_DATA: sending message to pe%s", __func__); status = palSendMBMessage(pMac->hHdd, pMsg); } smsLog(pMac, LOGW, "OEM_DATA: exiting Function %s", __func__); return status; }
static eHalStatus tdlsSaveTdlsPeerInfo(tpAniSirGlobal pMac, tSirTdlsPeerInfo *disPeerInfo) { tCsrTdlsPeerLinkinfo *peerInfo = NULL ; tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; eHalStatus status = eHAL_STATUS_FAILURE ; status = palAllocateMemory( pMac->hHdd, (void **)&peerInfo, sizeof(tCsrTdlsPeerLinkinfo)); if (HAL_STATUS_SUCCESS(status)) { palZeroMemory(pMac->hHdd, &peerInfo->tdlsDisPeerInfo, sizeof(tSirTdlsPeerInfo)); palCopyMemory(pMac->hHdd, &peerInfo->tdlsDisPeerInfo, disPeerInfo, sizeof(tSirTdlsPeerInfo)); disInfo->tdlsPeerCount++ ; csrLLInsertTail( &disInfo->tdlsPotentialPeerList, &peerInfo->tdlsPeerStaLink, LL_ACCESS_LOCK ); } return status ; }
/* * TDLS request API, called from HDD to send a TDLS frame * in SME/CSR and send message to PE to trigger TDLS discovery procedure. */ eHalStatus csrTdlsSendMgmtReq(tHalHandle hHal, tANI_U8 sessionId, tCsrTdlsSendMgmt *tdlsSendMgmt) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); tSmeCmd *tdlsSendMgmtCmd ; eHalStatus status = eHAL_STATUS_FAILURE ; //If connected and in Infra. Only then allow this if( CSR_IS_SESSION_VALID( pMac, sessionId ) && csrIsConnStateConnectedInfra( pMac, sessionId ) && (NULL != tdlsSendMgmt) ) { tdlsSendMgmtCmd = csrGetCommandBuffer(pMac) ; if(tdlsSendMgmtCmd) { tTdlsSendMgmtCmdInfo *tdlsSendMgmtCmdInfo = &tdlsSendMgmtCmd->u.tdlsCmd.u.tdlsSendMgmtCmdInfo ; tdlsSendMgmtCmd->sessionId = sessionId; tdlsSendMgmtCmdInfo->frameType = tdlsSendMgmt->frameType ; tdlsSendMgmtCmdInfo->dialog = tdlsSendMgmt->dialog ; tdlsSendMgmtCmdInfo->statusCode = tdlsSendMgmt->statusCode ; tdlsSendMgmtCmdInfo->responder = tdlsSendMgmt->responder; tdlsSendMgmtCmdInfo->peerCapability = tdlsSendMgmt->peerCapability; vos_mem_copy(tdlsSendMgmtCmdInfo->peerMac, tdlsSendMgmt->peerMac, sizeof(tSirMacAddr)) ; if( (0 != tdlsSendMgmt->len) && (NULL != tdlsSendMgmt->buf) ) { tdlsSendMgmtCmdInfo->buf = vos_mem_malloc(tdlsSendMgmt->len); if ( NULL == tdlsSendMgmtCmdInfo->buf ) 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 ; } vos_mem_copy(tdlsSendMgmtCmdInfo->buf, tdlsSendMgmt->buf, tdlsSendMgmt->len ); tdlsSendMgmtCmdInfo->len = tdlsSendMgmt->len; } else { tdlsSendMgmtCmdInfo->buf = NULL; tdlsSendMgmtCmdInfo->len = 0; } tdlsSendMgmtCmd->command = eSmeCommandTdlsSendMgmt ; tdlsSendMgmtCmd->u.tdlsCmd.size = sizeof(tTdlsSendMgmtCmdInfo) ; smePushCommand(pMac, tdlsSendMgmtCmd, FALSE) ; status = eHAL_STATUS_SUCCESS ; } } return status ; }
/*-------------------------------------------------------------------------- * * SME now sends the RIC IEs up to the supplicant. * The supplicant will then proceed to send down the * Reassoc Req. * *------------------------------------------------------------------------*/ void sme_GetRICIEs( tHalHandle hHal, tANI_U8 *ric_ies, tANI_U32 ric_ies_ip_len, tANI_U32 *ric_ies_length ) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); eHalStatus status = eHAL_STATUS_FAILURE; *ric_ies_length = 0; status = sme_AcquireGlobalLock( &pMac->sme ); if (!( HAL_STATUS_SUCCESS( status ))) return; /* All or nothing */ if (pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies_length > ric_ies_ip_len) { sme_ReleaseGlobalLock( &pMac->sme ); return; } vos_mem_copy(ric_ies, pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies, pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies_length); *ric_ies_length = pMac->ft.ftSmeContext.psavedFTPreAuthRsp->ric_ies_length; #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, FL(" Filled ric ies = %d\n"), *ric_ies_length); #endif sme_ReleaseGlobalLock( &pMac->sme ); return; }
eHalStatus csrTdlsProcessLinkEstablish( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsLinkEstablishCmdInfo *tdlsLinkEstablishCmdInfo = &cmd->u.tdlsCmd.u.tdlsLinkEstablishCmdInfo ; tSirTdlsLinkEstablishReq *tdlsLinkEstablishReq = NULL ; eHalStatus status = eHAL_STATUS_FAILURE; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); if (NULL == pSession) { smsLog( pMac, LOGE, FL("pSession is NULL")); return eHAL_STATUS_FAILURE; } status = palAllocateMemory( pMac->hHdd, (void **)&tdlsLinkEstablishReq, (sizeof(tSirTdlsLinkEstablishReq) ) ); if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("alloc failed \n") ); VOS_ASSERT(0) ; return status ; } tdlsLinkEstablishReq->sessionId = cmd->sessionId; tdlsLinkEstablishReq->transactionId = 0; palCopyMemory(pMac->hHdd, tdlsLinkEstablishReq->peerMac, tdlsLinkEstablishCmdInfo->peerMac, sizeof(tSirMacAddr)); palCopyMemory(pMac->hHdd, tdlsLinkEstablishReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); tdlsLinkEstablishReq->isBufSta = tdlsLinkEstablishCmdInfo->isBufSta; tdlsLinkEstablishReq->isResponder= tdlsLinkEstablishCmdInfo->isResponder; tdlsLinkEstablishReq->uapsdQueues= tdlsLinkEstablishCmdInfo->uapsdQueues; tdlsLinkEstablishReq->maxSp= tdlsLinkEstablishCmdInfo->maxSp; smsLog( pMac, LOGE, "sending TDLS Link Establish Request to PE \n" ); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_LINK_ESTABLISH_REQ, (void *)tdlsLinkEstablishReq, sizeof(tSirTdlsLinkEstablishReq)); if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC\n")); } return status; }
eHalStatus csrTdlsProcessLinkEstablish( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsLinkEstablishCmdInfo *tdlsLinkEstablishCmdInfo = &cmd->u.tdlsCmd.u.tdlsLinkEstablishCmdInfo ; tSirTdlsLinkEstablishReq *tdlsLinkEstablishReq = NULL ; eHalStatus status = eHAL_STATUS_FAILURE; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); if (NULL == pSession) { smsLog( pMac, LOGE, FL("pSession is NULL")); return eHAL_STATUS_FAILURE; } tdlsLinkEstablishReq = vos_mem_malloc(sizeof(tSirTdlsLinkEstablishReq)); if (tdlsLinkEstablishReq == NULL) { smsLog( pMac, LOGE, FL("alloc failed \n") ); VOS_ASSERT(0) ; return status ; } tdlsLinkEstablishReq->sessionId = cmd->sessionId; //Using dialog as transactionId. This can be used to match response with request tdlsLinkEstablishReq->transactionId = 0; vos_mem_copy(tdlsLinkEstablishReq->peerMac, tdlsLinkEstablishCmdInfo->peerMac, sizeof(tSirMacAddr)); vos_mem_copy(tdlsLinkEstablishReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); vos_mem_copy(tdlsLinkEstablishReq->supportedChannels, tdlsLinkEstablishCmdInfo->supportedChannels, tdlsLinkEstablishCmdInfo->supportedChannelsLen); tdlsLinkEstablishReq->supportedChannelsLen = tdlsLinkEstablishCmdInfo->supportedChannelsLen; vos_mem_copy(tdlsLinkEstablishReq->supportedOperClasses, tdlsLinkEstablishCmdInfo->supportedOperClasses, tdlsLinkEstablishCmdInfo->supportedOperClassesLen); tdlsLinkEstablishReq->supportedOperClassesLen = tdlsLinkEstablishCmdInfo->supportedOperClassesLen; tdlsLinkEstablishReq->isBufSta = tdlsLinkEstablishCmdInfo->isBufSta; tdlsLinkEstablishReq->isResponder= tdlsLinkEstablishCmdInfo->isResponder; tdlsLinkEstablishReq->uapsdQueues= tdlsLinkEstablishCmdInfo->uapsdQueues; tdlsLinkEstablishReq->maxSp= tdlsLinkEstablishCmdInfo->maxSp; tdlsLinkEstablishReq->isOffChannelSupported = tdlsLinkEstablishCmdInfo->isOffChannelSupported; // Send the request to PE. smsLog( pMac, LOGE, "sending TDLS Link Establish Request to PE \n" ); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_LINK_ESTABLISH_REQ, (void *)tdlsLinkEstablishReq, sizeof(tSirTdlsLinkEstablishReq)); if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC\n")); } return status; }
eHalStatus sme_p2pOpen( tHalHandle hHal ) { tpAniSirGlobal pMac = PMAC_STRUCT(hHal); eHalStatus status = eHAL_STATUS_SUCCESS; //If static structure is too big, Need to change this function to allocate memory dynamically vos_mem_zero(&pMac->p2pContext, sizeof( tp2pContext )); if(!HAL_STATUS_SUCCESS(status)) { sme_p2pClose(hHal); } return status; }
/*-------------------------------------------------------------------------- * * HDD Interface to SME. SME now sends the Auth 2 and RIC IEs up to the supplicant. * The supplicant will then proceed to send down the * Reassoc Req. * *------------------------------------------------------------------------*/ void sme_GetFTPreAuthResponse( tHalHandle hHal, tANI_U32 sessionId, tANI_U8 *ft_ies, tANI_U32 ft_ies_ip_len, tANI_U16 *ft_ies_length ) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; if (!pSession) { smsLog( pMac, LOGE, FL("pSession is NULL")); return; } *ft_ies_length = 0; status = sme_AcquireGlobalLock( &pMac->sme ); if (!( HAL_STATUS_SUCCESS( status ))) return; /* All or nothing - proceed only if both BSSID and FT IE fit */ if((ANI_MAC_ADDR_SIZE + pSession->ftSmeContext.psavedFTPreAuthRsp->ft_ies_length) > ft_ies_ip_len) { sme_ReleaseGlobalLock( &pMac->sme ); return; } // hdd needs to pack the bssid also along with the // auth response to supplicant vos_mem_copy(ft_ies, pSession->ftSmeContext.preAuthbssId, ANI_MAC_ADDR_SIZE); // Copy the auth resp FTIEs vos_mem_copy(&(ft_ies[ANI_MAC_ADDR_SIZE]), pSession->ftSmeContext.psavedFTPreAuthRsp->ft_ies, pSession->ftSmeContext.psavedFTPreAuthRsp->ft_ies_length); *ft_ies_length = ANI_MAC_ADDR_SIZE + pSession->ftSmeContext.psavedFTPreAuthRsp->ft_ies_length; pSession->ftSmeContext.FTState = eFT_REASSOC_REQ_WAIT; #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, FL(" Filled auth resp = %d"), *ft_ies_length); #endif sme_ReleaseGlobalLock( &pMac->sme ); return; }
tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams) { tSirRetStatus status = eSIR_SUCCESS; tpAniSirGlobal pMac = (tpAniSirGlobal) hHal; if (NULL == pMac) { VOS_ASSERT(0); status = eSIR_FAILURE; return status; } pMac->gDriverType = ((tHalMacStartParameters*)pHalMacStartParams)->driverType; sysLog(pMac, LOG2, FL("called\n")); do { #if defined(TRACE_RECORD) //Enable Tracing macTraceInit(pMac); #endif if (!HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, ((void *)&pMac->pResetMsg), sizeof(tSirMbMsg)))) { sysLog(pMac, LOGE, FL("pMac->pResetMsg is NULL\n")); status = eSIR_FAILURE; break; } else { palZeroMemory(pMac->hHdd, pMac->pResetMsg, sizeof(tSirMbMsg)); } if (pMac->gDriverType != eDRIVER_TYPE_MFG) { status = peStart(pMac); } } while(0); pMac->sys.abort = false; return status; }
/* * save TDLS peer info, this will be called after successfull completion * of TDLS discovery procedure. */ static eHalStatus tdlsSaveTdlsPeerInfo(tpAniSirGlobal pMac, tSirTdlsPeerInfo *disPeerInfo) { tCsrTdlsPeerLinkinfo *peerInfo = NULL ; tCsrTdlsCtxStruct *disInfo = &pMac->tdlsCtx ; eHalStatus status = eHAL_STATUS_FAILURE ; /* * Ok, allocate memory for peer info here * we allocate memory for each peer here and free his memory * at the time the peer node is getting deleted, possible case is * teardown */ peerInfo = vos_mem_malloc(sizeof(tCsrTdlsPeerLinkinfo)); if ( NULL = peerInfo ) status = eHAL_STATUS_FAILURE; else status = eHAL_STATUS_SUCCESS; /* * go ahead and copy peerInfo and insert this node info discovery rsp * database. */ if (HAL_STATUS_SUCCESS(status)) { vos_mem_set( &peerInfo->tdlsDisPeerInfo, sizeof(tSirTdlsPeerInfo), 0); vos_mem_copy( &peerInfo->tdlsDisPeerInfo, disPeerInfo, sizeof(tSirTdlsPeerInfo)); /* * update TDLS client count to indicate there is tdls client * in tdls potential peer list. */ disInfo->tdlsPeerCount++ ; /* * finally insert this tdls peer info into tdls potential peer list */ csrLLInsertTail( &disInfo->tdlsPotentialPeerList, &peerInfo->tdlsPeerStaLink, LL_ACCESS_LOCK ); } return status ; }
eHalStatus oemData_OemDataReqOpen(tHalHandle hHal) { eHalStatus status = eHAL_STATUS_SUCCESS; tpAniSirGlobal pMac = PMAC_STRUCT(hHal); do { //initialize all the variables to null vos_mem_set(&(pMac->oemData), sizeof(tOemDataStruct), 0); if(!HAL_STATUS_SUCCESS(status)) { smsLog(pMac, LOGE, "oemData_OemDataReqOpen: Cannot allocate memory for the timer function"); break; } } while(0); return status; }
static char * dump_csr( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p ) { static tCsrRoamProfile x; static tSirMacSSid ssid; //To be allocated for array of SSIDs static tANI_U8 sessionId; // Defined for fixed session ID vos_mem_set((void*)&x, sizeof(x), 0); x.SSIDs.numOfSSIDs=1 ; x.SSIDs.SSIDList[0].SSID = ssid ; ssid.length=6 ; vos_mem_copy(ssid.ssId, "AniNet", 6); if(HAL_STATUS_SUCCESS(sme_AcquireGlobalLock( &pMac->sme ))) { (void)csrRoamConnect(pMac, sessionId, &x, NULL, NULL); sme_ReleaseGlobalLock( &pMac->sme ); } return p; }
static char *dump_btcSetEvent( tpAniSirGlobal pMac, tANI_U32 arg1, tANI_U32 arg2, tANI_U32 arg3, tANI_U32 arg4, char *p ) { tSmeBtEvent btEvent; if( arg1 < BT_EVENT_TYPE_MAX ) { smsLog(pMac, LOGE, FL(" signal BT event (%d) handle (%d) 3rd param(%d)"), arg1, arg2, arg3); vos_mem_zero(&btEvent, sizeof(tSmeBtEvent)); btEvent.btEventType = arg1; switch( arg1 ) { case BT_EVENT_SYNC_CONNECTION_COMPLETE: case BT_EVENT_SYNC_CONNECTION_UPDATED: btEvent.uEventParam.btSyncConnection.connectionHandle = (v_U16_t)arg2; btEvent.uEventParam.btSyncConnection.status = (v_U8_t)arg3; break; case BT_EVENT_DISCONNECTION_COMPLETE: btEvent.uEventParam.btDisconnect.connectionHandle = (v_U16_t)arg2; break; case BT_EVENT_CREATE_ACL_CONNECTION: case BT_EVENT_ACL_CONNECTION_COMPLETE: btEvent.uEventParam.btAclConnection.connectionHandle = (v_U16_t)arg2; btEvent.uEventParam.btAclConnection.status = (v_U8_t)arg3; break; case BT_EVENT_MODE_CHANGED: btEvent.uEventParam.btAclModeChange.connectionHandle = (v_U16_t)arg2; break; default: break; } #ifndef WLAN_MDM_CODE_REDUCTION_OPT if(HAL_STATUS_SUCCESS(sme_AcquireGlobalLock( &pMac->sme ))) { btcSignalBTEvent(pMac, &btEvent); sme_ReleaseGlobalLock( &pMac->sme ); } #endif } else { smsLog(pMac, LOGE, FL(" invalid event (%d)"), arg1); } return p; }
// tdlsoffchan eHalStatus csrTdlsProcessChanSwitchReq( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsChanSwitchCmdInfo *tdlsChanSwitchCmdInfo = &cmd->u.tdlsCmd.u.tdlsChanSwitchCmdInfo ; tSirTdlsChanSwitch *tdlsChanSwitch = NULL ; eHalStatus status = eHAL_STATUS_FAILURE; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); if (NULL == pSession) { smsLog( pMac, LOGE, FL("pSession is NULL")); return eHAL_STATUS_FAILURE; } tdlsChanSwitch = vos_mem_malloc(sizeof(tSirTdlsChanSwitch)); if (tdlsChanSwitch == NULL) { smsLog( pMac, LOGE, FL("alloc failed \n") ); VOS_ASSERT(0) ; return status ; } tdlsChanSwitch->sessionId = cmd->sessionId; //Using dialog as transactionId. This can be used to match response with request tdlsChanSwitch->transactionId = 0; vos_mem_copy( tdlsChanSwitch->peerMac, tdlsChanSwitchCmdInfo->peerMac, sizeof(tSirMacAddr)); vos_mem_copy(tdlsChanSwitch->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); tdlsChanSwitch->tdlsOffCh = tdlsChanSwitchCmdInfo->tdlsOffCh; tdlsChanSwitch->tdlsOffChBwOffset = tdlsChanSwitchCmdInfo->tdlsOffChBwOffset; tdlsChanSwitch->tdlsSwMode = tdlsChanSwitchCmdInfo->tdlsSwMode; // Send the request to PE. smsLog( pMac, LOGE, "sending TDLS Channel Switch to PE \n" ); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_CHANNEL_SWITCH_REQ, (void *)tdlsChanSwitch, sizeof(tSirTdlsChanSwitch)); if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC\n")); } return status; }
eHalStatus sme_FTUpdateKey( tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo ) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); eHalStatus status = eHAL_STATUS_FAILURE; status = sme_AcquireGlobalLock( &pMac->sme ); if (!( HAL_STATUS_SUCCESS( status ))) { return eHAL_STATUS_FAILURE; } if (pFTKeyInfo == NULL) { smsLog( pMac, LOGE, "%s: pFTKeyInfo is NULL\n", __FUNCTION__); sme_ReleaseGlobalLock( &pMac->sme ); return eHAL_STATUS_FAILURE; } #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "sme_FTUpdateKey is received in state %d\n", pMac->ft.ftSmeContext.FTState); #endif // Global Station FT State switch(pMac->ft.ftSmeContext.FTState) { case eFT_SET_KEY_WAIT: status = sme_FTSendUpdateKeyInd( hHal, pFTKeyInfo ); pMac->ft.ftSmeContext.FTState = eFT_START_READY; break; default: smsLog( pMac, LOGE, "%s: Unhandled state=%d\n", __FUNCTION__, pMac->ft.ftSmeContext.FTState); status = eHAL_STATUS_FAILURE; break; } sme_ReleaseGlobalLock( &pMac->sme ); return status; }
eHalStatus oemData_OemDataReqClose(tHalHandle hHal) { eHalStatus status = eHAL_STATUS_SUCCESS; tpAniSirGlobal pMac = PMAC_STRUCT(hHal); do { if(!HAL_STATUS_SUCCESS(status)) { smsLog(pMac, LOGE, "oemData_OemDataReqClose: Failed in oemData_OemDataReqClose at StopTimers"); break; } if(pMac->oemData.pOemDataRsp != NULL) { vos_mem_free(pMac->oemData.pOemDataRsp); } //initialize all the variables to null vos_mem_set(&(pMac->oemData), sizeof(tOemDataStruct), 0); } while(0); return eHAL_STATUS_SUCCESS; }
/* --------------------------------------------------------------------------- \fn sme_HandleOemDataRsp \brief This function processes the oem data response obtained from the PE \param pMsg - Pointer to the pSirOemDataRsp \return eHalStatus -------------------------------------------------------------------------------*/ eHalStatus sme_HandleOemDataRsp(tHalHandle hHal, tANI_U8* pMsg) { eHalStatus status = eHAL_STATUS_SUCCESS; tpAniSirGlobal pMac; tListElem *pEntry = NULL; tSmeCmd *pCommand = NULL; tSirOemDataRsp* pOemDataRsp = NULL; pMac = PMAC_STRUCT(hHal); smsLog(pMac, LOG1, "%s: OEM_DATA Entering", __func__); do { if(pMsg == NULL) { smsLog(pMac, LOGE, "in %s msg ptr is NULL", __func__); status = eHAL_STATUS_FAILURE; break; } pEntry = csrLLPeekHead( &pMac->sme.smeCmdActiveList, LL_ACCESS_LOCK ); if(pEntry) { pCommand = GET_BASE_ADDR( pEntry, tSmeCmd, Link ); if(eSmeCommandOemDataReq == pCommand->command) { pOemDataRsp = (tSirOemDataRsp*)pMsg; //make sure to acquire the lock before modifying the data status = sme_AcquireGlobalLock(&pMac->sme); if(!HAL_STATUS_SUCCESS(status)) { break; } if(pMac->oemData.pOemDataRsp != NULL) { vos_mem_free(pMac->oemData.pOemDataRsp); } pMac->oemData.pOemDataRsp = (tOemDataRsp*)vos_mem_malloc(sizeof(tOemDataRsp)); if(pMac->oemData.pOemDataRsp == NULL) { sme_ReleaseGlobalLock(&pMac->sme); smsLog(pMac, LOGE, "in %s vos_mem_malloc failed for pMac->oemData.pOemDataRsp", __func__); status = eHAL_STATUS_FAILURE; break; } smsLog(pMac, LOGE, "Before memory copy"); vos_mem_copy((v_VOID_t*)(pMac->oemData.pOemDataRsp), (v_VOID_t*)(&pOemDataRsp->oemDataRsp), sizeof(tOemDataRsp)); smsLog(pMac, LOGE, "after memory copy"); sme_ReleaseGlobalLock(&pMac->sme); } else { smsLog(pMac, LOGE, "in %s eWNI_SME_OEM_DATA_RSP Received but NO REQs are ACTIVE ...", __func__); status = eHAL_STATUS_FAILURE; break; } } else { smsLog(pMac, LOGE, "in %s eWNI_SME_OEM_DATA_RSP Received but NO commands are ACTIVE ...", __func__); status = eHAL_STATUS_FAILURE; break; } oemData_ReleaseOemDataReqCommand(pMac, pCommand, eHAL_STATUS_SUCCESS); pMac->oemData.oemDataReqActive = eANI_BOOLEAN_FALSE; } while(0); return status; }
/* --------------------------------------------------------------------------- \fn oemData_OemDataReq \brief Request an OEM DATA RSP \param sessionId - Id of session to be used \param pOemDataReqID - pointer to an object to get back the request ID \param callback - a callback function that is called upon finish \param pContext - a pointer passed in for the callback \return eHalStatus -------------------------------------------------------------------------------*/ eHalStatus oemData_OemDataReq(tHalHandle hHal, tANI_U8 sessionId, tOemDataReqConfig *oemDataReqConfig, tANI_U32 *pOemDataReqID, oemData_OemDataReqCompleteCallback callback, void *pContext) { eHalStatus status = eHAL_STATUS_SUCCESS; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); tSmeCmd *pOemDataCmd = NULL; do { if( !CSR_IS_SESSION_VALID( pMac, sessionId ) ) { status = eHAL_STATUS_FAILURE; break; } pMac->oemData.oemDataReqConfig.sessionId = sessionId; pMac->oemData.callback = callback; pMac->oemData.pContext = pContext; pMac->oemData.oemDataReqID = *(pOemDataReqID); vos_mem_copy((v_VOID_t*)(pMac->oemData.oemDataReqConfig.oemDataReq), (v_VOID_t*)(oemDataReqConfig->oemDataReq), OEM_DATA_REQ_SIZE); pMac->oemData.oemDataReqActive = eANI_BOOLEAN_FALSE; pOemDataCmd = smeGetCommandBuffer(pMac); //fill up the command before posting it. if(pOemDataCmd) { pOemDataCmd->command = eSmeCommandOemDataReq; pOemDataCmd->u.oemDataCmd.callback = callback; pOemDataCmd->u.oemDataCmd.pContext = pContext; pOemDataCmd->u.oemDataCmd.oemDataReqID = pMac->oemData.oemDataReqID; //set the oem data request pOemDataCmd->u.oemDataCmd.oemDataReq.sessionId = pMac->oemData.oemDataReqConfig.sessionId; vos_mem_copy((v_VOID_t*)(pOemDataCmd->u.oemDataCmd.oemDataReq.oemDataReq), (v_VOID_t*)(pMac->oemData.oemDataReqConfig.oemDataReq), OEM_DATA_REQ_SIZE); } else { status = eHAL_STATUS_FAILURE; break; } //now queue this command in the sme command queue //Here since this is not interacting with the csr just push the command //into the sme queue. Also push this command with the normal priority smePushCommand(pMac, pOemDataCmd, eANI_BOOLEAN_FALSE); } while(0); if(!HAL_STATUS_SUCCESS(status) && pOemDataCmd) { oemData_ReleaseOemDataReqCommand(pMac, pOemDataCmd, eOEM_DATA_REQ_FAILURE); pMac->oemData.oemDataReqActive = eANI_BOOLEAN_FALSE; } return status; }
/*---------------------------------------------------------------------------- * * The function limSendRemainOnChannelDebugMarkerFrame, prepares Marker frame * for Start and End of remain on channel with RemainOnChannelMsg as Vendor * Specific information element of the frame. * *----------------------------------------------------------------------------*/ tSirRetStatus limSendRemainOnChannelDebugMarkerFrame(tpAniSirGlobal pMac, tANI_U8 *remainOnChannelMsg) { tSirMacAddr magicMacAddr= {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; tANI_U32 nBytes, nPayload; tSirRetStatus nSirStatus; tANI_U8 *pFrame; void *pPacket; eHalStatus halstatus; tANI_U8 txFlag = 0; publicVendorSpecific *pPublicVendorSpecific; pPublicVendorSpecific = vos_mem_malloc(sizeof(publicVendorSpecific)); if( pPublicVendorSpecific == NULL ) { limLog( pMac, LOGE, FL( "Unable to allocate memory for Vendor specific information" " element" ) ); return eSIR_MEM_ALLOC_FAILED; } // Assigning Action category code as unknown as this is debug marker frame pPublicVendorSpecific->category = REMAIN_ON_CHANNEL_UNKNOWN_ACTION_CATEGORY; pPublicVendorSpecific->elementid = VENDOR_SPECIFIC_ELEMENT_ID; pPublicVendorSpecific->length = strlen(remainOnChannelMsg); nPayload = sizeof(publicVendorSpecific) + pPublicVendorSpecific->length; nBytes = nPayload + sizeof( tSirMacMgmtHdr ); halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) { limLog( pMac, LOGE, FL("Failed to allocate %d bytes for a Remain" " on channel action frame."), nBytes ); nSirStatus = eSIR_MEM_ALLOC_FAILED; goto end; } vos_mem_zero( pFrame, nBytes ); // Populate frame with MAC header nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, SIR_MAC_MGMT_ACTION, magicMacAddr, pMac->lim.gSelfMacAddr); if ( eSIR_SUCCESS != nSirStatus ) { limLog( pMac, LOGE, FL("Failed to populate the buffer descriptor for a" " Action frame for remain on channel.") ); palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); goto end; } // Copy Public Vendor specific fields to frame's information element vos_mem_copy( (pFrame + (sizeof( tSirMacMgmtHdr ))), pPublicVendorSpecific, sizeof(publicVendorSpecific) ); // Copy Remain On channel message to Vendor Specific information field vos_mem_copy( (pFrame + (nBytes - pPublicVendorSpecific->length)), remainOnChannelMsg, pPublicVendorSpecific->length ); halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, limTxComplete, pFrame, txFlag ); if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) { limLog( pMac, LOGE, FL("could not send marker frame for" " remain on channel!" )); //Pkt will be freed up by the callback nSirStatus = eSIR_FAILURE; goto end; } nSirStatus = eSIR_SUCCESS; end: vos_mem_free( pPublicVendorSpecific ); return nSirStatus; }
eHalStatus sme_FTSendUpdateKeyInd(tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo) { tSirFTUpdateKeyInfo *pMsg; tANI_U16 msgLen; eHalStatus status = eHAL_STATUS_FAILURE; tAniEdType tmpEdType; tAniKeyDirection tmpDirection; //tANI_U8 *pBuf; tANI_U8 *p = NULL; tAniEdType edType; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); int i = 0; smsLog(pMac, LOGE, FL("keyLength %d\n"), pFTKeyInfo->keyLength); for(i=0; i<pFTKeyInfo->keyLength; i++) smsLog(pMac, LOGE, FL("%02x"), pFTKeyInfo->Key[i]); msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + sizeof( pMsg->keyMaterial.key ); status = palAllocateMemory(pMac->hHdd, (void **)&pMsg, msgLen); if ( !HAL_STATUS_SUCCESS(status) ) { return eHAL_STATUS_FAILURE; } palZeroMemory(pMac->hHdd, pMsg, msgLen); pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_FT_UPDATE_KEY); pMsg->length = pal_cpu_to_be16(msgLen); p = (tANI_U8 *)&pMsg->keyMaterial; // 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 ? p = pal_set_U16( p, pal_cpu_to_be16((tANI_U16)( sizeof( pMsg->keyMaterial.numKeys ) + ( pMsg->keyMaterial.numKeys * sizeof( pMsg->keyMaterial.key ) ) )) ); // set pMsg->keyMaterial.edType edType = csrTranslateEncryptTypeToEdType( pFTKeyInfo->encType ); tmpEdType = pal_cpu_to_be32(edType); palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpEdType, sizeof(tAniEdType) ); p += sizeof( pMsg->keyMaterial.edType ); // set the pMsg->keyMaterial.numKeys field *p = pMsg->keyMaterial.numKeys; p += sizeof( pMsg->keyMaterial.numKeys ); // set pSirKey->keyId = keyId; *p = pMsg->keyMaterial.key[ 0 ].keyId; p += sizeof( pMsg->keyMaterial.key[ 0 ].keyId ); // set pSirKey->unicast = (tANI_U8)fUnicast; *p = (tANI_U8)eANI_BOOLEAN_TRUE; p += sizeof( pMsg->keyMaterial.key[ 0 ].unicast ); // set pSirKey->keyDirection = aniKeyDirection; tmpDirection = pal_cpu_to_be32(pFTKeyInfo->keyDirection); palCopyMemory( pMac->hHdd, p, (tANI_U8 *)&tmpDirection, sizeof(tAniKeyDirection) ); p += sizeof(tAniKeyDirection); // pSirKey->keyRsc = ;; palCopyMemory( pMac->hHdd, p, pFTKeyInfo->keyRsc, CSR_MAX_RSC_LEN ); p += sizeof( pMsg->keyMaterial.key[ 0 ].keyRsc ); // set pSirKey->paeRole *p = pFTKeyInfo->paeRole; // 0 is Supplicant p++; // set pSirKey->keyLength = keyLength; p = pal_set_U16( p, pal_cpu_to_be16(pFTKeyInfo->keyLength) ); if ( pFTKeyInfo->keyLength && pFTKeyInfo->Key ) { palCopyMemory( pMac->hHdd, p, pFTKeyInfo->Key, pFTKeyInfo->keyLength ); if(pFTKeyInfo->keyLength == 16) { smsLog(pMac, LOGE, " SME Set keyIdx (%d) encType(%d) key = %02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X\n", pFTKeyInfo->keyId, edType, pFTKeyInfo->Key[0], pFTKeyInfo->Key[1], pFTKeyInfo->Key[2], pFTKeyInfo->Key[3], pFTKeyInfo->Key[4], pFTKeyInfo->Key[5], pFTKeyInfo->Key[6], pFTKeyInfo->Key[7], pFTKeyInfo->Key[8], pFTKeyInfo->Key[9], pFTKeyInfo->Key[10], pFTKeyInfo->Key[11], pFTKeyInfo->Key[12], pFTKeyInfo->Key[13], pFTKeyInfo->Key[14], pFTKeyInfo->Key[15]); } } status = palSendMBMessage(pMac->hHdd, pMsg); return( status ); }
/*-------------------------------------------------------------------------- Each time the supplicant sends down the FT IEs to the driver. This function is called in SME. This fucntion packages and sends the FT IEs to PE. ------------------------------------------------------------------------*/ void sme_SetFTIEs( tHalHandle hHal, tANI_U8 sessionId, tANI_U8 *ft_ies, tANI_U16 ft_ies_length ) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); eHalStatus status = eHAL_STATUS_FAILURE; status = sme_AcquireGlobalLock( &pMac->sme ); if (!( HAL_STATUS_SUCCESS( status ))) return; if (ft_ies == NULL) { smsLog( pMac, LOGE, FL(" ft ies is NULL\n")); sme_ReleaseGlobalLock( &pMac->sme ); return; } #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "FT IEs Req is received in state %d\n", pMac->ft.ftSmeContext.FTState); #endif // Global Station FT State switch(pMac->ft.ftSmeContext.FTState) { case eFT_START_READY: case eFT_AUTH_REQ_READY: if ((pMac->ft.ftSmeContext.auth_ft_ies) && (pMac->ft.ftSmeContext.auth_ft_ies_length)) { // Free the one we received last from the supplicant vos_mem_free(pMac->ft.ftSmeContext.auth_ft_ies); pMac->ft.ftSmeContext.auth_ft_ies_length = 0; } // Save the FT IEs pMac->ft.ftSmeContext.auth_ft_ies = vos_mem_malloc(ft_ies_length); if(pMac->ft.ftSmeContext.auth_ft_ies == NULL) { smsLog( pMac, LOGE, FL("Memory allocation failed for " "auth_ft_ies\n")); sme_ReleaseGlobalLock( &pMac->sme ); return; } pMac->ft.ftSmeContext.auth_ft_ies_length = ft_ies_length; vos_mem_copy((tANI_U8 *)pMac->ft.ftSmeContext.auth_ft_ies, ft_ies, ft_ies_length); pMac->ft.ftSmeContext.FTState = eFT_AUTH_REQ_READY; #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "ft_ies_length=%d\n", ft_ies_length); /* smsLog( pMac, LOGE, "%d: New Auth ft_ies_length=%02x%02x%02x\n", current->pid, pMac->ft.ftSmeContext.auth_ft_ies[0], pMac->ft.ftSmeContext.auth_ft_ies[1], pMac->ft.ftSmeContext.auth_ft_ies[2]); */ #endif break; case eFT_AUTH_COMPLETE: // We will need to re-start preauth. If we received FT IEs in // eFT_PRE_AUTH_DONE state, it implies there was a rekey in // our pre-auth state. Hence this implies we need Pre-auth again. // OK now inform SME we have no pre-auth list. // Delete the pre-auth node locally. Set your self back to restart pre-auth // TBD #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "Pre-auth done and now receiving---> AUTH REQ <---- in state %d\n", pMac->ft.ftSmeContext.FTState); smsLog( pMac, LOGE, "Unhandled reception of FT IES in state %d\n", pMac->ft.ftSmeContext.FTState); #endif break; case eFT_REASSOC_REQ_WAIT: // We are done with pre-auth, hence now waiting for // reassoc req. This is the new FT Roaming in place // At this juncture we are ready to start sending Re-Assoc Req. #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "New Reassoc Req=%p in state %d\n", ft_ies, pMac->ft.ftSmeContext.FTState); #endif if ((pMac->ft.ftSmeContext.reassoc_ft_ies) && (pMac->ft.ftSmeContext.reassoc_ft_ies_length)) { // Free the one we received last from the supplicant vos_mem_free(pMac->ft.ftSmeContext.reassoc_ft_ies); pMac->ft.ftSmeContext.reassoc_ft_ies_length = 0; } // Save the FT IEs pMac->ft.ftSmeContext.reassoc_ft_ies = vos_mem_malloc(ft_ies_length); if(pMac->ft.ftSmeContext.reassoc_ft_ies == NULL) { smsLog( pMac, LOGE, FL("Memory allocation failed for " "reassoc_ft_ies\n")); sme_ReleaseGlobalLock( &pMac->sme ); return; } pMac->ft.ftSmeContext.reassoc_ft_ies_length = ft_ies_length; vos_mem_copy((tANI_U8 *)pMac->ft.ftSmeContext.reassoc_ft_ies, ft_ies, ft_ies_length); pMac->ft.ftSmeContext.FTState = eFT_SET_KEY_WAIT; #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "ft_ies_length=%d state=%d\n", ft_ies_length, pMac->ft.ftSmeContext.FTState); /* smsLog( pMac, LOGE, "%d: New Auth ft_ies_length=%02x%02x%02x\n", current->pid, pMac->ft.ftSmeContext.reassoc_ft_ies[0], pMac->ft.ftSmeContext.reassoc_ft_ies[1], pMac->ft.ftSmeContext.reassoc_ft_ies[2]); */ #endif break; default: smsLog( pMac, LOGE, FL(" Unhandled state=%d\n"), pMac->ft.ftSmeContext.FTState); break; } sme_ReleaseGlobalLock( &pMac->sme ); }
/* Application Specific include files */ #include "halInternal.h" #include "halHddApis.h" #include "halDebug.h" #include "halMTU.h" #include "halRxp.h" #include "halPhyApi.h" //#ifdef ANI_OS_TYPE_LINUX #include "halCommonApi.h" // halCleanup #endif #include "cfgApi.h" // cfgCleanup #include "limApi.h" // limCleanup #include "sirTypes.h" #include "sysDebug.h" #include "sysEntryFunc.h" #include "macInitApi.h" #if defined(ANI_LOGDUMP) #include "logDump.h" #endif //#if defined(ANI_LOGDUMP) #ifdef TRACE_RECORD #include "macTrace.h" #endif extern tSirRetStatus halDoCfgInit(tpAniSirGlobal pMac); extern tSirRetStatus halProcessStartEvent(tpAniSirGlobal pMac); tSirRetStatus macReset(tpAniSirGlobal pMac, tANI_U32 rc); #ifdef FEATURE_WLAN_INTEGRATED_SOC tSirRetStatus macPreStart(tHalHandle hHal) { tSirRetStatus status = eSIR_SUCCESS; tANI_BOOLEAN memAllocFailed = eANI_BOOLEAN_FALSE; tpAniSirGlobal pMac = (tpAniSirGlobal) hHal; tANI_U8 i; for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++) { if(palAllocateMemory(pMac->hHdd, ((void *)&pMac->dumpTableEntry[i]), sizeof(tDumpModuleEntry)) != eHAL_STATUS_SUCCESS) { memAllocFailed = eANI_BOOLEAN_TRUE; break; } else { palZeroMemory(pMac->hHdd, pMac->dumpTableEntry[i], sizeof(tSirMbMsg)); } } if( memAllocFailed ) { while(i>0) { i--; palFreeMemory(pMac, pMac->dumpTableEntry[i]); } sysLog(pMac, LOGE, FL("pMac->dumpTableEntry is NULL\n")); status = eSIR_FAILURE; } #if defined(ANI_LOGDUMP) //logDumpInit must be called before any module starts logDumpInit(pMac); #endif //#if defined(ANI_LOGDUMP) return status; } tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams) { tSirRetStatus status = eSIR_SUCCESS; tpAniSirGlobal pMac = (tpAniSirGlobal) hHal; if (NULL == pMac) { VOS_ASSERT(0); status = eSIR_FAILURE; return status; } pMac->gDriverType = ((tHalMacStartParameters*)pHalMacStartParams)->driverType; sysLog(pMac, LOG2, FL("called\n")); do { #if defined(TRACE_RECORD) //Enable Tracing macTraceInit(pMac); #endif if (!HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, ((void *)&pMac->pResetMsg), sizeof(tSirMbMsg)))) { sysLog(pMac, LOGE, FL("pMac->pResetMsg is NULL\n")); status = eSIR_FAILURE; break; } else { palZeroMemory(pMac->hHdd, pMac->pResetMsg, sizeof(tSirMbMsg)); } if (pMac->gDriverType != eDRIVER_TYPE_MFG) { status = peStart(pMac); } } while(0); pMac->sys.abort = false; return status; } #else /* FEATURE_WLAN_INTEGRATED_SOC */ tSirRetStatus macStart(tHalHandle hHal, void* pHalMacStartParams) { tANI_U8 i; tSirRetStatus status = eSIR_SUCCESS; eHalStatus halStatus; tpAniSirGlobal pMac = (tpAniSirGlobal) hHal; tANI_BOOLEAN memAllocFailed = eANI_BOOLEAN_FALSE; if(NULL == pMac) { VOS_ASSERT(0); status = eSIR_FAILURE; return status; } pMac->gDriverType = ((tHalMacStartParameters *)pHalMacStartParams)->driverType; sysLog(pMac, LOG2, FL("called\n")); do { for(i=0; i<MAX_DUMP_TABLE_ENTRY; i++) { if(palAllocateMemory(pMac->hHdd, ((void **)&pMac->dumpTableEntry[i]), sizeof(tDumpModuleEntry)) != eHAL_STATUS_SUCCESS) { memAllocFailed = eANI_BOOLEAN_TRUE; break; } else { palZeroMemory(pMac->hHdd, pMac->dumpTableEntry[i], sizeof(tSirMbMsg)); } } if( memAllocFailed ) { while(i>0) { i--; palFreeMemory(pMac, pMac->dumpTableEntry[i]); } sysLog(pMac, LOGE, FL("pMac->dumpTableEntry is NULL\n")); status = eSIR_FAILURE; break; } else { #if defined(ANI_LOGDUMP) logDumpInit(pMac); #endif //#if defined(ANI_LOGDUMP) } #if defined(TRACE_RECORD) //Enable Tracing macTraceInit(pMac); #endif if (!HAL_STATUS_SUCCESS(palAllocateMemory(pMac->hHdd, ((void **)&pMac->pResetMsg), sizeof(tSirMbMsg)))) { sysLog(pMac, LOGE, FL("pMac->pResetMsg is NULL\n")); status = eSIR_FAILURE; break; } else { palZeroMemory(pMac->hHdd, pMac->pResetMsg, sizeof(tSirMbMsg)); } halStatus = halStart(hHal, (tHalMacStartParameters*)pHalMacStartParams ); if ( !HAL_STATUS_SUCCESS(halStatus) ) { sysLog(pMac,LOGE, FL("halStart failed with error code = %d\n"), halStatus); status = eSIR_FAILURE; } else if(pMac->gDriverType != eDRIVER_TYPE_MFG) { peStart(pMac); } }while(0); pMac->sys.abort = false; return status; }
eHalStatus sme_FTUpdateKey( tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo ) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); eHalStatus status = eHAL_STATUS_FAILURE; status = sme_AcquireGlobalLock( &pMac->sme ); if (!( HAL_STATUS_SUCCESS( status ))) { return eHAL_STATUS_FAILURE; } if (pFTKeyInfo == NULL) { smsLog( pMac, LOGE, "%s: pFTKeyInfo is NULL", __func__); sme_ReleaseGlobalLock( &pMac->sme ); return eHAL_STATUS_FAILURE; } #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, "sme_FTUpdateKey is received in state %d", pMac->ft.ftSmeContext.FTState); #endif // Global Station FT State switch(pMac->ft.ftSmeContext.FTState) { case eFT_SET_KEY_WAIT: #ifdef DEBUG_ROAM_DELAY //store the PTK send event vos_record_roam_event(e_HDD_SET_PTK_REQ, NULL, 0); #endif if (sme_GetFTPreAuthState (hHal) == TRUE) { status = sme_FTSendUpdateKeyInd(pMac, pFTKeyInfo); if (status != 0 ) { smsLog( pMac, LOGE, "%s: Key set failure %d", __func__, status); pMac->ft.ftSmeContext.setFTPTKState = FALSE; status = eHAL_STATUS_FT_PREAUTH_KEY_FAILED; } else { pMac->ft.ftSmeContext.setFTPTKState = TRUE; status = eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS; smsLog( pMac, LOG1, "%s: Key set success", __func__); } sme_SetFTPreAuthState(hHal, FALSE); } pMac->ft.ftSmeContext.FTState = eFT_START_READY; #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, "%s: state changed to %d status %d", __func__, pMac->ft.ftSmeContext.FTState, status); #endif break; default: smsLog( pMac, LOGE, "%s: Unhandled state=%d", __func__, pMac->ft.ftSmeContext.FTState); status = eHAL_STATUS_FAILURE; break; } sme_ReleaseGlobalLock( &pMac->sme ); return status; }