/* * 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 ; }
/* * commands received from CSR */ eHalStatus csrTdlsProcessCmd(tpAniSirGlobal pMac, tSmeCmd *cmd) { eSmeCommandType cmdType = cmd->command ; #ifdef FEATURE_WLAN_TDLS_INTERNAL tTdlsCmd tdlsCmd = cmd->u.tdlsCmd ; #endif 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; #ifdef FEATURE_WLAN_TDLS_INTERNAL case eSmeCommandTdlsDiscovery: { tTdlsDisReqCmdinfo *disReqCmdInfo = &tdlsCmd.u.tdlsDisReqCmdInfo ; tSirTdlsDisReq *disReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); disReq = vos_mem_malloc(sizeof(tSirTdlsDisReq)); if ( NULL == disReq ) status = eHAL_STATUS_FAILURE; else status = eHAL_STATUS_SUCCESS; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, "dis Req alloc failed " ); VOS_ASSERT(0) ; break ; } disReq->sessionId = cmd->sessionId; disReq->transactionId = 0; /* TODO ? */ disReq->reqType = disReqCmdInfo->tdlsDisType ; vos_mem_copy( disReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); vos_mem_copy( disReq->peerMac, disReqCmdInfo->peerMac, sizeof(tSirMacAddr)) ; smsLog( pMac, LOGE, "sending TDLS discovery to PE " ); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_DISCOVERY_START_REQ, (void *)disReq , sizeof(tSirTdlsDisReq)) ; if(HAL_STATUS_SUCCESS( status ) ) { status = eANI_BOOLEAN_FALSE ; } /* TODO: Add error handling */ break ; } case eSmeCommandTdlsLinkSetup: { tTdlsLinkSetupReqCmdinfo *linkSetupReqCmdInfo = &tdlsCmd.u.tdlsLinkSetupReqCmdInfo ; tSirTdlsSetupReq *setupReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); setupReq = vos_mem_malloc(sizeof(tSirTdlsSetupReq)); if ( NULL == setupReq ) status = eHAL_STATUS_FAILURE; else status = eHAL_STATUS_SUCCESS; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, "dis Req alloc failed " ); VOS_ASSERT(0) ; break ; } setupReq->sessionId = cmd->sessionId; setupReq->transactionId = 0; /* TODO ? */ vos_mem_copy( setupReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); vos_mem_copy( setupReq->peerMac, linkSetupReqCmdInfo->peerMac, sizeof(tSirMacAddr)) ; VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, ("sending TDLS link setup to PE ")); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_LINK_START_REQ, (void *)setupReq , sizeof(tSirTdlsSetupReq) ) ; if(HAL_STATUS_SUCCESS( status ) ) { status = eANI_BOOLEAN_FALSE ; } /* TODO: Add error handling */ break ; } case eSmeCommandTdlsLinkTear: { tTdlsLinkTeardownCmdinfo *linkTeardownCmdInfo = &tdlsCmd.u.tdlsLinkTeardownCmdInfo ; tSirTdlsTeardownReq *teardownReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); teardownReq = vos_mem_malloc(sizeof(tSirTdlsTeardownReq)); if ( NULL == teardownReq ) status = eHAL_STATUS_FAILURE; else status = eHAL_STATUS_SUCCESS; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, "teardown Req alloc failed " ); VOS_ASSERT(0) ; break ; } teardownReq->sessionId = cmd->sessionId; teardownReq->transactionId = 0; /* TODO ? */ vos_mem_copy( teardownReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); vos_mem_copy( &teardownReq->peerMac, linkTeardownCmdInfo->peerMac, sizeof(tSirMacAddr)) ; VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO, ("teardown request..")) ; status = tdlsSendMessage(pMac, eWNI_SME_TDLS_TEARDOWN_REQ, (void *)teardownReq , sizeof(tSirTdlsTeardownReq)) ; if(HAL_STATUS_SUCCESS( status ) ) { status = eANI_BOOLEAN_FALSE ; } /* TODO: Add error handling */ break ; } #endif default: { /* TODO: Add defualt handling */ break ; } } return status ; }