/*-------------------------------------------------------------------------- * * 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"), *ric_ies_length); #endif sme_ReleaseGlobalLock( &pMac->sme ); return; }
/*-------------------------------------------------------------------------- * * 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; }
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; }
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; }
/* --------------------------------------------------------------------------- \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; }
/*-------------------------------------------------------------------------- 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 ); }
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; }
eHalStatus sme_FTUpdateKey(tHalHandle hHal, tANI_U32 sessionId, tCsrRoamSetKey * pFTKeyInfo ) { 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 eHAL_STATUS_FAILURE; } if (pFTKeyInfo == NULL) { smsLog( pMac, LOGE, "%s: pFTKeyInfo is NULL", __func__); return eHAL_STATUS_FAILURE; } status = sme_AcquireGlobalLock( &pMac->sme ); if (!( HAL_STATUS_SUCCESS( status ))) { return eHAL_STATUS_FAILURE; } #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, "sme_FTUpdateKey is received in state %d", pSession->ftSmeContext.FTState); #endif // Global Station FT State switch(pSession->ftSmeContext.FTState) { case eFT_SET_KEY_WAIT: if (sme_GetFTPreAuthState(hHal, sessionId) == TRUE) { status = sme_FTSendUpdateKeyInd(pMac, sessionId, pFTKeyInfo); if (status != 0 ) { smsLog( pMac, LOGE, "%s: Key set failure %d", __func__, status); pSession->ftSmeContext.setFTPTKState = FALSE; status = eHAL_STATUS_FT_PREAUTH_KEY_FAILED; } else { pSession->ftSmeContext.setFTPTKState = TRUE; status = eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS; smsLog( pMac, LOG1, "%s: Key set success", __func__); } sme_SetFTPreAuthState(hHal, sessionId, FALSE); } pSession->ftSmeContext.FTState = eFT_START_READY; #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, "%s: state changed to %d status %d", __func__, pSession->ftSmeContext.FTState, status); #endif break; default: smsLog( pMac, LOGW, "%s: Unhandled state=%d", __func__, pSession->ftSmeContext.FTState); status = eHAL_STATUS_FAILURE; break; } sme_ReleaseGlobalLock( &pMac->sme ); return status; }