static int writeRsnKeyMic(v_U32_t cryptHandle, tAniPacket *eapolFrame, tAniEapolRsnKeyDesc *rsnDesc, v_U8_t *micKey, v_U32_t micKeyLen) { int retVal = ANI_OK; int len; v_U8_t *ptr = NULL; v_U8_t *micPos = NULL; v_U8_t result[VOS_DIGEST_SHA1_SIZE]; // Larger of the two // Sanity check the arguments and return if no MIC generation is // needed if (micKey != NULL) { if (micKeyLen == 0 || !rsnDesc->info.micFlag) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp MIC key provided but micKeyLen or micFlag is not set!\n"); VOS_ASSERT( 0 ); return ANI_E_ILLEGAL_ARG; } } else { if (rsnDesc->info.micFlag) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp micFlag is set but MIC key not provided!\n"); VOS_ASSERT( 0 ); return ANI_E_ILLEGAL_ARG; } // Normal condition where MIC is not desired by the caller return ANI_OK; } len = aniAsfPacketGetBytes(eapolFrame, &ptr); if( !ANI_IS_STATUS_SUCCESS( len ) ) { return len; } micPos = ptr + ANI_SSM_RSN_KEY_MIC_OFFSET + SNAP_HEADER_SIZE; // Clear the MIC field in the packet before the MIC computation vos_mem_zero( micPos, VOS_DIGEST_MD5_SIZE); // Skip to the EAPOL version field for MIC computation ptr += EAPOL_VERSION_POS + SNAP_HEADER_SIZE; len -= (EAPOL_VERSION_POS + SNAP_HEADER_SIZE); if (rsnDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES) { if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, ptr, len, micKey, micKeyLen, result) ) ) { retVal = ANI_OK; } else { retVal = ANI_ERROR; } } else { VOS_ASSERT( 0 ); retVal = ANI_E_ILLEGAL_ARG; } if (retVal == ANI_OK) { // Copy only 16B which is the smaller of the two and the same as // ANI_EAPOL_KEY_RSN_MIC_SIZE vos_mem_copy(micPos, result, VOS_DIGEST_MD5_SIZE); } return retVal; }
/**--------------------------------------------------------------------------- \brief epping_driver_init() - End point ping driver Init Function This is the driver entry point - called in different timeline depending on whether the driver is statically or dynamically linked \param - con_mode connection mode \return - 0 for success, negative for failure ----------------------------------------------------------------------------*/ int epping_driver_init(int con_mode, vos_wake_lock_t *g_wake_lock, char *pwlan_module_name) { int ret = 0; unsigned long rc; epping_context_t *pEpping_ctx = NULL; VOS_STATUS status = VOS_STATUS_SUCCESS; EPPING_LOG(VOS_TRACE_LEVEL_INFO_HIGH, "%s: Enter", __func__); #ifdef TIMER_MANAGER vos_timer_manager_init(); #endif #ifdef MEMORY_DEBUG vos_mem_init(); adf_net_buf_debug_init(); #endif pEpping_ctx = vos_mem_malloc(sizeof(epping_context_t)); if (pEpping_ctx == NULL) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: No memory", __func__); ret = -ENOMEM; goto error1; } vos_mem_zero(pEpping_ctx, sizeof(epping_context_t)); pEpping_ctx->g_wake_lock = g_wake_lock; pEpping_ctx->con_mode = con_mode; pEpping_ctx->pwlan_module_name = pwlan_module_name; status = vos_preOpen(&pEpping_ctx->pVosContext); if (!VOS_IS_STATUS_SUCCESS(status)) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: Failed to preOpen VOSS", __func__); ret = -1; goto error1; } /* save epping_context in VOSS */ ((VosContextType *)(pEpping_ctx->pVosContext))->pHDDContext = (v_VOID_t*)pEpping_ctx; #ifdef HIF_SDIO #define WLAN_WAIT_TIME_WLANSTART 10000 #else #define WLAN_WAIT_TIME_WLANSTART 2000 #endif init_completion(&pEpping_ctx->wlan_start_comp); ret = hif_register_driver(); if (!ret) { rc = wait_for_completion_timeout( &pEpping_ctx->wlan_start_comp, msecs_to_jiffies(WLAN_WAIT_TIME_WLANSTART)); if (!rc) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: timed-out waiting for hif_register_driver", __func__); ret = -1; } else ret = 0; } if (ret) { EPPING_LOG(VOS_TRACE_LEVEL_FATAL, "%s: %s driver Initialization failed", __func__, pEpping_ctx->pwlan_module_name); hif_unregister_driver(); vos_preClose(&pEpping_ctx->pVosContext); ret = -ENODEV; vos_mem_free(pEpping_ctx); #ifdef MEMORY_DEBUG adf_net_buf_debug_exit(); vos_mem_exit(); #endif #ifdef TIMER_MANAGER vos_timer_exit(); #endif return ret; } else { pr_info("%s: %s driver loaded\n", __func__, pEpping_ctx->pwlan_module_name); return 0; } error1: if (pEpping_ctx) { vos_mem_free(pEpping_ctx); pEpping_ctx = NULL; } #ifdef MEMORY_DEBUG adf_net_buf_debug_exit(); vos_mem_exit(); #endif #ifdef TIMER_MANAGER vos_timer_exit(); #endif return ret; }
/** * authRsnFsmCreate * * FUNCTION * Allocates and initializes the state of an RSN key FSM instance for * the given STA context. * * @parm staCtx the STA context whose instance is being created * @param pskBased pass in eANI_BOOLEAN_TRUE is this STA is to be * authenticated based on a pre-shared key as opposed to EAP. * * @return ANI_OK if the operation succeeds */ int authRsnFsmCreate(tBtampContext *ctx) { int retVal = ANI_OK; tAuthRsnFsm *fsm = &ctx->uFsm.authFsm; // First, clear everything out vos_mem_zero( fsm, sizeof(tAuthRsnFsm)); if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterTxRxCallbacks( authRsnTxCompleteHandler, authRsnRxFrameHandler ) ) ) { return ANI_ERROR; } if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterRxCallback( ctx->pvosGCtx ) ) ) { return ANI_ERROR; } // Allocate the station context fsm->staCtx = (tStaContext *)vos_mem_malloc( sizeof(tStaContext) ); if (fsm->staCtx == NULL) { retVal = ANI_E_MALLOC_FAILED; VOS_ASSERT( 0 ); goto error; } // Clear out the station context vos_mem_zero( fsm->staCtx, sizeof(tStaContext) ); fsm->ctx = ctx; fsm->staCtx->authRsnFsm = fsm; //Only support CCMP fsm->staCtx->pwCipherType = eCSR_ENCRYPT_TYPE_AES; if( !VOS_IS_STATUS_SUCCESS( vos_timer_init( &fsm->msg2Timer, VOS_TIMER_TYPE_SW, msg2TimerCallback, fsm ) ) ) { retVal = ANI_E_MALLOC_FAILED; VOS_ASSERT( 0 ); goto error; } if( !VOS_IS_STATUS_SUCCESS( vos_timer_init( &fsm->msg4Timer, VOS_TIMER_TYPE_SW, msg4TimerCallback, fsm ) ) ) { retVal = ANI_E_MALLOC_FAILED; VOS_ASSERT( 0 ); goto error; } retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol, RSN_MAX_PACKET_SIZE, EAPOL_TX_HEADER_SIZE ); if (retVal != ANI_OK) { VOS_ASSERT( 0 ); goto error; } aniAsfPacketAllocate(&fsm->staCtx->pmk); if (fsm->staCtx->pmk == NULL) { retVal = ANI_E_MALLOC_FAILED; VOS_ASSERT( 0 ); goto error; } aniAsfPacketAllocateExplicit(&fsm->staCtx->ieSta, RSN_IE_MAX_PACKET_SIZE, RSN_IE_HEADER_SIZE ); if (fsm->staCtx->ieSta == NULL) { retVal = ANI_E_MALLOC_FAILED; VOS_ASSERT( 0 ); goto error; } fsm->cryptHandle = 0; if( !VOS_IS_STATUS_SUCCESS( vos_crypto_init( &fsm->cryptHandle ) ) ) { retVal = ANI_E_FAILED; VOS_ASSERT( 0 ); goto error; } fsm->currentState = INITIALIZE; gotoStateInit(fsm); //We can call this function here because it is connected at this time authRsnFsmProcessEvent( fsm, RSN_FSM_AUTH_START, NULL ); return ANI_OK; error: authRsnFsmFree(ctx); return retVal; }
/*--------------------------------------------------------------------------- wpalMemoryZero - Zero memory Param: buf - address of buffer to be zero size - number of bytes to zero Return: None ---------------------------------------------------------------------------*/ void wpalMemoryZero(void *buf, wpt_uint32 size) { vos_mem_zero( buf, size ); }
int iw_set_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ; hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); tCsrScanRequest scanRequest; v_U32_t scanId = 0; eHalStatus status = eHAL_STATUS_SUCCESS; struct iw_scan_req *scanReq = (struct iw_scan_req *)extra; ENTER(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__); #ifdef WLAN_BTAMP_FEATURE if( VOS_TRUE == WLANBAP_AmpSessionOn() ) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__); return eHAL_STATUS_SUCCESS; } #endif if(pHddCtx->scan_info.mScanPending == TRUE) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:mScanPending is TRUE !!!",__func__); return eHAL_STATUS_SUCCESS; } if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); return eHAL_STATUS_SUCCESS; } vos_mem_zero( &scanRequest, sizeof(scanRequest)); if (NULL != wrqu->data.pointer) { if ((IW_SCAN_TYPE_ACTIVE == scanReq->scan_type) || (eSIR_ACTIVE_SCAN == pHddCtx->scan_info.scan_mode)) { scanRequest.scanType = eSIR_ACTIVE_SCAN; } else { scanRequest.scanType = eSIR_PASSIVE_SCAN; } vos_mem_copy(scanRequest.bssid, &scanReq->bssid.sa_data, sizeof(scanRequest.bssid) ); if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { if(scanReq->essid_len) { scanRequest.SSIDs.numOfSSIDs = 1; scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(sizeof(tCsrSSIDInfo)); if(scanRequest.SSIDs.SSIDList) { scanRequest.SSIDs.SSIDList->SSID.length = scanReq->essid_len; vos_mem_copy(scanRequest.SSIDs.SSIDList-> SSID.ssId,scanReq->essid,scanReq->essid_len); } else { scanRequest.SSIDs.numOfSSIDs = 0; VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Unable to allocate memory",__func__); VOS_ASSERT(0); } } } scanRequest.minChnTime = scanReq->min_channel_time; scanRequest.maxChnTime = scanReq->max_channel_time; } else { if(pHddCtx->scan_info.scan_mode == eSIR_ACTIVE_SCAN) { scanRequest.scanType = eSIR_ACTIVE_SCAN; } else { scanRequest.scanType = eSIR_PASSIVE_SCAN; } vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff ); scanRequest.minChnTime = 0; scanRequest.maxChnTime = 0; } scanRequest.BSSType = eCSR_BSS_TYPE_ANY; scanRequest.ChannelInfo.numOfChannels = 0; scanRequest.ChannelInfo.ChannelList = NULL; scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; if (0 != pwextBuf->genIE.length) { memset( &pHddCtx->scan_info.scanAddIE, 0, sizeof(pHddCtx->scan_info.scanAddIE) ); memcpy( pHddCtx->scan_info.scanAddIE.addIEdata, pwextBuf->genIE.addIEdata, pwextBuf->genIE.length ); pHddCtx->scan_info.scanAddIE.length = pwextBuf->genIE.length; if (SIR_MAC_MAX_IE_LENGTH >= pwextBuf->genIE.length) { memcpy( pwextBuf->roamProfile.addIEScan, pHddCtx->scan_info.scanAddIE.addIEdata, pHddCtx->scan_info.scanAddIE.length); pwextBuf->roamProfile.nAddIEScanLength = pHddCtx->scan_info.scanAddIE.length; } else { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "Invalid ScanIE, Length is %d", pwextBuf->genIE.length); } memset( &pwextBuf->genIE, 0, sizeof(pwextBuf->genIE) ); } if (pHddCtx->scan_info.scanAddIE.addIEdata && pHddCtx->scan_info.scanAddIE.length) { scanRequest.uIEFieldLen = pHddCtx->scan_info.scanAddIE.length; scanRequest.pIEField = pHddCtx->scan_info.scanAddIE.addIEdata; } status = sme_ScanRequest( (WLAN_HDD_GET_CTX(pAdapter))->hHal, pAdapter->sessionId,&scanRequest, &scanId, &hdd_ScanRequestCallback, dev ); if (!HAL_STATUS_SUCCESS(status)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:sme_ScanRequest fail %d!!!",__func__, status); goto error; } pHddCtx->scan_info.mScanPending = TRUE; pHddCtx->scan_info.scanId = scanId; error: if ((wrqu->data.flags & IW_SCAN_THIS_ESSID) && (scanReq->essid_len)) vos_mem_free(scanRequest.SSIDs.SSIDList); EXIT(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__); return status; }
static int gotoStateStaKeyStart(tSuppRsnFsm *fsm, tAniEapolKeyAvailEventData *data, v_BOOL_t retransmit) { int retVal; tAniEapolRsnKeyDesc txDesc; tAniEapolRsnKeyDesc *rxDesc; static v_U8_t btampRSNIE[] = {0x30, 0x14, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x04, 0x01, 0x00, 0x00, 0x0f, 0xac, 0x02, 0x00, 0x00 }; fsm->currentState = STA_KEY_START; // Create a new EAPOL frame if we don't have to retransmit // if (!retransmit) //{ rxDesc = data->keyDesc; if( NULL == rxDesc) { return ANI_E_NULL_VALUE; } aniAsfPacketEmptyExplicit( fsm->lastEapol, EAPOL_TX_HEADER_SIZE ); retVal = derivePtk(fsm, data); if( !ANI_IS_STATUS_SUCCESS( retVal ) ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp derivePtk failed with code %d!\n", retVal); return retVal; } vos_mem_zero( &txDesc, sizeof(txDesc) ); // The Key Information bits... if (fsm->suppCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) { txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; } txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE; txDesc.info.micFlag = eANI_BOOLEAN_TRUE; txDesc.keyLen = 0; //RSN_80211_KEY_LEN; // Send back the same replayCtr that the authenticator sent vos_mem_copy(txDesc.replayCounter, rxDesc->replayCounter, sizeof(txDesc.replayCounter)); vos_mem_copy(txDesc.keyNonce, fsm->sNonce, sizeof(txDesc.keyNonce)); txDesc.keyDataLen = sizeof(btampRSNIE);//aniAsfPacketGetBytes(fsm->suppCtx->ieBp, //&txDesc.keyData); txDesc.keyData = btampRSNIE; retVal = aniEapolWriteKey(fsm->cryptHandle, fsm->lastEapol, fsm->suppCtx->authMac, fsm->suppCtx->suppMac, ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, &txDesc, fsm->suppCtx->ptk, CSR_AES_KEY_LEN); if( !ANI_IS_STATUS_SUCCESS( retVal ) ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp gotoStateStaKeyStart fail to write key %d\n", retVal); return retVal; } //} if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) { retVal = ANI_OK; } else { retVal = ANI_ERROR; } return retVal; }
static int gotoStateGroupKeySet(tSuppRsnFsm *fsm, tAniEapolKeyAvailEventData *data) { int retVal; tAniEapolRsnKeyDesc txDesc; tAniEapolRsnKeyDesc *rxDesc; int groupKeyLen; fsm->currentState = GROUP_KEY_SET; do { rxDesc = (tAniEapolRsnKeyDesc *) data->keyDesc; if( NULL == rxDesc) { retVal = ANI_E_NULL_VALUE; break; } if (rxDesc->keyDataLen == 0 || rxDesc->keyData == NULL) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp: AP sent no group key in group EAPOL-Key message!\n" ); retVal = ANI_E_ILLEGAL_ARG; break; } if ( rxDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES ) { groupKeyLen = rxDesc->keyDataLen - ANI_SSM_AES_KEY_WRAP_BLOCK_SIZE; if( groupKeyLen <= 0 ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp: AP sent GTK too short\n" ); retVal = ANI_E_ILLEGAL_ARG; break; } } else { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp: AP sent unsupported keyDescVer %d!\n", rxDesc->info.keyDescVers ); retVal = ANI_E_ILLEGAL_ARG; break; } // Always create a new EAPOL frame aniAsfPacketEmptyExplicit( fsm->lastEapol, EAPOL_TX_HEADER_SIZE ); vos_mem_zero( &txDesc, sizeof(txDesc) ); // The Key Information bits... if (fsm->suppCtx->grpCipherType == eCSR_ENCRYPT_TYPE_AES) { txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; } txDesc.info.unicastFlag = eANI_BOOLEAN_FALSE; txDesc.info.keyId = rxDesc->info.keyId; txDesc.info.micFlag = eANI_BOOLEAN_TRUE; txDesc.info.secureFlag = eANI_BOOLEAN_TRUE; txDesc.keyLen = RSN_80211_KEY_LEN; // Send back the same replayCtr that the authenticator sent vos_mem_copy(txDesc.replayCounter, rxDesc->replayCounter, sizeof(txDesc.replayCounter)); retVal = aniEapolWriteKey(fsm->cryptHandle, fsm->lastEapol, fsm->suppCtx->authMac, fsm->suppCtx->suppMac, ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, &txDesc, fsm->suppCtx->ptk, CSR_AES_KEY_LEN); if( !ANI_IS_STATUS_SUCCESS( retVal ) ) break; if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) { retVal = ANI_ERROR; VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp could not send eapol. Disconnect\n" ); break; } //FIX_RSN there is no need to set GTK retVal = setGtk(fsm->suppCtx, rxDesc->keyRecvSeqCounter); // This is never retransmitted aniAsfPacketEmptyExplicit( fsm->lastEapol, EAPOL_TX_HEADER_SIZE ); checkTransition(fsm, NULL); // UCT rule }while( 0 ); return retVal; }
static VOS_STATUS bapRsnTxCompleteCallback( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus ) { int retVal; ptBtampContext btampContext; // use btampContext value tCsrRoamSetKey setKeyInfo; tSuppRsnFsm *fsm; if (NULL == pvosGCtx) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "pvosGCtx is NULL in %s", __func__); return VOS_STATUS_E_FAULT; } btampContext = VOS_GET_BAP_CB(pvosGCtx); if (NULL == btampContext) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "btampContext is NULL in %s", __func__); return VOS_STATUS_E_FAULT; } fsm = &btampContext->uFsm.suppFsm; if (NULL == fsm) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "fsm is NULL in %s", __func__); return VOS_STATUS_E_FAULT; } //If we get a disconect from upper layer before getting the pkt from TL the //bapRsnFsmTxCmpHandler could be NULL //VOS_ASSERT( bapRsnFsmTxCmpHandler ); if( bapRsnFsmTxCmpHandler ) { //Change the state //Call auth or supp FSM's handler bapRsnFsmTxCmpHandler( pvosGCtx, pPacket, retStatus ); } else { vos_pkt_return_packet( pPacket ); return (VOS_STATUS_SUCCESS ); } //fsm->suppCtx->ptk contains the 3 16-bytes keys. We need the last one. /* We will move the Set key to EAPOL Completion handler. We found a race condition betweem sending EAPOL frame and setting Key */ if (BAP_SET_RSN_KEY == gReadToSetKey) { vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) ); setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES; setKeyInfo.keyDirection = eSIR_TX_RX; vos_mem_copy( setKeyInfo.peerMac, fsm->suppCtx->authMac, sizeof( tAniMacAddr ) ); setKeyInfo.paeRole = 0; //this is a supplicant setKeyInfo.keyId = 0; //always setKeyInfo.keyLength = CSR_AES_KEY_LEN; vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->suppCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN ); if( !VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, " Supp: gotoStateStaKeySet fail to set key\n" ); retVal = ANI_ERROR; } gReadToSetKey = BAP_RESET_RSN_KEY; } return (VOS_STATUS_SUCCESS ); }
VOS_STATUS vos_start( v_CONTEXT_t vosContext ) { VOS_STATUS vStatus = VOS_STATUS_SUCCESS; tSirRetStatus sirStatus = eSIR_SUCCESS; pVosContextType pVosContext = (pVosContextType)vosContext; tHalMacStartParameters halStartParams; VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "%s: Starting Libra SW", __func__); if (gpVosContext != pVosContext) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: mismatch in context", __func__); return VOS_STATUS_E_FAILURE; } if (( pVosContext->pWDAContext == NULL) || ( pVosContext->pMACContext == NULL) || ( pVosContext->pTLContext == NULL)) { if (pVosContext->pWDAContext == NULL) VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: WDA NULL context", __func__); else if (pVosContext->pMACContext == NULL) VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: MAC NULL context", __func__); else VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: TL NULL context", __func__); return VOS_STATUS_E_FAILURE; } vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); vStatus = WDA_NVDownload_Start(pVosContext); if ( vStatus != VOS_STATUS_SUCCESS ) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Failed to start NV Download", __func__); return VOS_STATUS_E_FAILURE; } vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), VOS_WDA_TIMEOUT ); if ( vStatus != VOS_STATUS_SUCCESS ) { if ( vStatus == VOS_STATUS_E_TIMEOUT ) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Timeout occurred before WDA_NVDownload_start complete", __func__); } else { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: WDA_NVDownload_start reporting other error", __func__); } VOS_ASSERT(0); vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); if (vos_is_logp_in_progress(VOS_MODULE_ID_VOSS, NULL)) { VOS_BUG(0); } WDA_setNeedShutdown(vosContext); return VOS_STATUS_E_FAILURE; } VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "%s: WDA_NVDownload_start correctly started", __func__); vStatus = WDA_start(pVosContext); if ( vStatus != VOS_STATUS_SUCCESS ) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Failed to start WDA", __func__); return VOS_STATUS_E_FAILURE; } VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "%s: WDA correctly started", __func__); vos_mem_zero((v_PVOID_t)&halStartParams, sizeof(tHalMacStartParameters)); sirStatus = macStart(pVosContext->pMACContext,(v_PVOID_t)&halStartParams); if (eSIR_SUCCESS != sirStatus) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to start MAC", __func__); goto err_wda_stop; } VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "%s: MAC correctly started", __func__); vStatus = sme_Start(pVosContext->pMACContext); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to start SME", __func__); goto err_mac_stop; } VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "%s: SME correctly started", __func__); vStatus = WLANTL_Start(pVosContext); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Failed to start TL", __func__); goto err_sme_stop; } VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "TL correctly started"); VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO, "%s: VOSS Start is successful!!", __func__); return VOS_STATUS_SUCCESS; err_sme_stop: sme_Stop(pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET); err_mac_stop: macStop( pVosContext->pMACContext, HAL_STOP_TYPE_SYS_RESET ); err_wda_stop: vos_event_reset( &(gpVosContext->wdaCompleteEvent) ); vStatus = WDA_stop( pVosContext, HAL_STOP_TYPE_RF_KILL); if (!VOS_IS_STATUS_SUCCESS(vStatus)) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Failed to stop WDA", __func__); VOS_ASSERT( VOS_IS_STATUS_SUCCESS( vStatus ) ); WDA_setNeedShutdown(vosContext); } else { vStatus = vos_wait_single_event( &(gpVosContext->wdaCompleteEvent), VOS_WDA_TIMEOUT ); if( vStatus != VOS_STATUS_SUCCESS ) { if( vStatus == VOS_STATUS_E_TIMEOUT ) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: Timeout occurred before WDA_stop complete", __func__); } else { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_FATAL, "%s: WDA_stop reporting other error", __func__); } VOS_ASSERT( 0 ); WDA_setNeedShutdown(vosContext); } } return VOS_STATUS_E_FAILURE; }
/*========================================================================== FUNCTION WDA_DS_BuildTxPacketInfo DESCRIPTION Build TX meta info for integrated SOC. Same function calls HAL for reserve BD header space into VOS packet and HAL function to fill it. DEPENDENCIES PARAMETERS IN pvosGCtx VOS context vosDataBuff vos data buffer pvDestMacAddr destination MAC address ponter ucDisableFrmXtl Is frame xtl disabled? ucQosEnabled Is QoS enabled? ucWDSEnabled Is WDS enabled? extraHeadSpace Extra head bytes. If it's not 0 due to 4 bytes align of BD header. typeSubtype typeSubtype from MAC header or TX metainfo/BD pAddr2 address 2 uTid tid txFlag timeStamp ucIsEapol ucUP OUT *pusPktLen Packet length RETURN VALUE VOS_STATUS_E_FAULT: pointer is NULL and other errors VOS_STATUS_SUCCESS: Everything is good :) SIDE EFFECTS ============================================================================*/ VOS_STATUS WDA_DS_BuildTxPacketInfo ( v_PVOID_t pvosGCtx, vos_pkt_t* vosDataBuff, v_MACADDR_t* pvDestMacAddr, v_U8_t ucDisableFrmXtl, v_U16_t* pusPktLen, v_U8_t ucQosEnabled, v_U8_t ucWDSEnabled, v_U8_t extraHeadSpace, v_U8_t typeSubtype, v_PVOID_t pAddr2, v_U8_t uTid, v_U8_t txFlag, v_U32_t timeStamp, v_U8_t ucIsEapol, v_U8_t ucUP ) { VOS_STATUS vosStatus; WDI_DS_TxMetaInfoType* pTxMetaInfo = NULL; v_SIZE_t usMacAddrSize; wpt_FrameCtrl *pFrameControl; /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ /*------------------------------------------------------------------------ Sanity check Extract TL control block ------------------------------------------------------------------------*/ if ( ( NULL == pvosGCtx ) || ( NULL == vosDataBuff ) || ( NULL == pvDestMacAddr ) ) { VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_ERROR, "WDA:Invalid parameter sent on WDA_DS_BuildTxPacketInfo" ); return VOS_STATUS_E_FAULT; } /*------------------------------------------------------------------------ Extract TX Meta Info pointer from PAL packet ------------------------------------------------------------------------*/ pTxMetaInfo = WDI_DS_ExtractTxMetaData( VOS_TO_WPAL_PKT(vosDataBuff) ); if ( NULL == pTxMetaInfo ) { VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WLAN TL:Invalid RxMetaInfo pointer from PAL packet on WLANTL_RxFrames"); VOS_ASSERT( 0 ); return VOS_STATUS_E_FAULT; } /* Zero out memeory */ vos_mem_zero( pTxMetaInfo, sizeof( WDI_DS_TxMetaInfoType ) ); /* Fill the TX Meta info */ pTxMetaInfo->txFlags = txFlag; pTxMetaInfo->qosEnabled = ucQosEnabled; pTxMetaInfo->fenableWDS = ucWDSEnabled; pTxMetaInfo->ac = ucUP; pTxMetaInfo->fUP = uTid; pTxMetaInfo->isEapol = ucIsEapol; pTxMetaInfo->fdisableFrmXlt = ucDisableFrmXtl; pTxMetaInfo->frmType = ( ( typeSubtype & 0x30 ) >> 4 ); pTxMetaInfo->typeSubtype = typeSubtype; /* Length = MAC header + payload */ vos_pkt_get_packet_length( vosDataBuff, pusPktLen); pTxMetaInfo->fPktlen = *pusPktLen; /* For management frames, peek into Frame Control field to get value of Protected Frame bit */ pTxMetaInfo->fProtMgmtFrame = 0; if ( WDA_TLI_MGMT_FRAME_TYPE == pTxMetaInfo->frmType ) { if ( 1 == ucDisableFrmXtl ) /* should be 802.11, but check */ { vosStatus = vos_pkt_peek_data( vosDataBuff, 0, (v_PVOID_t)&pFrameControl, sizeof( wpt_FrameCtrl )); if ( VOS_STATUS_SUCCESS != vosStatus ) { VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WDA: Failed while attempting to extract Protect Bit in " "Frame Control, status %d", vosStatus ); VOS_ASSERT( 0 ); return VOS_STATUS_E_FAULT; } pTxMetaInfo->fProtMgmtFrame = pFrameControl->wep; VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, "WLAN TL: fProtMgmtFrame:%d", pTxMetaInfo->fProtMgmtFrame ); } } // Dst address usMacAddrSize = VOS_MAC_ADDR_SIZE; vosStatus = vos_pkt_extract_data( vosDataBuff, WLANTL_MAC_ADDR_ALIGN( ucDisableFrmXtl ), (v_PVOID_t)pvDestMacAddr, &usMacAddrSize ); if ((VOS_STATUS_SUCCESS != vosStatus) || (usMacAddrSize != VOS_MAC_ADDR_SIZE)) { VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_ERROR, "WDA:Failed while attempting to extract MAC Addr %d", vosStatus ); VOS_ASSERT( 0 ); return VOS_STATUS_E_FAULT; } vos_copy_macaddr( (v_MACADDR_t*)pTxMetaInfo->fSTAMACAddress, pvDestMacAddr ); // ADDR2 vos_copy_macaddr( (v_MACADDR_t*)pTxMetaInfo->addr2MACAddress, pAddr2 ); /* Dump TX meta infro for debugging */ VOS_TRACE( VOS_MODULE_ID_TL, VOS_TRACE_LEVEL_INFO_LOW, "WLAN TL: Dump TX meta info: " "txFlags:%d, qosEnabled:%d, ac:%d, " "isEapol:%d, fdisableFrmXlt:%d, frmType:%d", pTxMetaInfo->txFlags, ucQosEnabled, pTxMetaInfo->ac, pTxMetaInfo->isEapol, pTxMetaInfo->fdisableFrmXlt, pTxMetaInfo->frmType ); return VOS_STATUS_SUCCESS; }
int iw_set_oem_data_req( struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { int rc = 0; eHalStatus status = eHAL_STATUS_SUCCESS; struct iw_oem_data_req *pOemDataReq = NULL; tOemDataReqConfig oemDataReqConfig; tANI_U32 oemDataReqID = 0; hdd_adapter_t *pAdapter = (netdev_priv(dev)); hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); return -EBUSY; } do { if (NULL != wrqu->data.pointer) { pOemDataReq = (struct iw_oem_data_req *)wrqu->data.pointer; } if (pOemDataReq == NULL) { hddLog(LOGE, "in %s oemDataReq == NULL", __func__); rc = -EIO; break; } vos_mem_zero(&oemDataReqConfig, sizeof(tOemDataReqConfig)); if (copy_from_user((&oemDataReqConfig)->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: copy_from_user() failed!", __func__); rc = -EFAULT; break; } status = sme_OemDataReq(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, &oemDataReqConfig, &oemDataReqID, &hdd_OemDataReqCallback, dev); if (status != eHAL_STATUS_SUCCESS) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: sme_OemDataReq status %d", __func__, status); rc = -EFAULT; break; } pwextBuf->oemDataReqID = oemDataReqID; pwextBuf->oemDataReqInProgress = TRUE; } while(0); return rc; }
void vos_log_submit(v_VOID_t *plog_hdr_ptr) { log_hdr_type *pHdr = (log_hdr_type*) plog_hdr_ptr; tAniHdr *wmsg = NULL; v_U8_t *pBuf; struct hdd_context_s *pHddCtx; v_CONTEXT_t pVosContext= NULL; v_U16_t data_len; v_U16_t total_len; /*Get the global context */ pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); /*Get the Hdd Context */ pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext; if ((pHddCtx->isLoadInProgress) || (pHddCtx->isUnloadInProgress)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Unloading/Loading in Progress. Ignore!!!", __func__); return; } /* Send the log data to the ptt app only if it is registered with the wlan driver*/ if(pHddCtx->ptt_pid) { data_len = pHdr->len; total_len = sizeof(tAniHdr)+sizeof(v_U32_t)+data_len; pBuf = (v_U8_t*)vos_mem_malloc(total_len); if(!pBuf) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed"); return; } vos_mem_zero((v_VOID_t*)pBuf,total_len); wmsg = (tAniHdr*)pBuf; wmsg->type = PTT_MSG_DIAG_CMDS_TYPE; wmsg->length = total_len; wmsg->length = DIAG_SWAP16(wmsg->length); pBuf += sizeof(tAniHdr); /* Diag Type events or log */ *(v_U32_t*)pBuf = DIAG_TYPE_LOGS; pBuf += sizeof(v_U32_t); memcpy(pBuf, pHdr,data_len); if(pHddCtx->ptt_pid != INVALID_PID) { if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pHddCtx->ptt_pid) < 0) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!")); vos_mem_free((v_VOID_t *)wmsg); pHddCtx->ptt_pid = INVALID_PID; return; } } vos_mem_free((v_VOID_t*)wmsg); } return; }
/*=========================================================================== FUNCTION WLANBAP_TxLinkSupervision DESCRIPTION This API will be called to process Link Supervision Request received PARAMETERS btampHandle: The BT-AMP PAL handle returned in WLANBAP_GetNewHndl. pucAC: Pointer to return the access category vosDataBuff: The data buffer containing the 802.3 frame to be translated to BT HCI Data Packet RETURN VALUE The result code associated with performing the operation VOS_STATUS_E_INVAL: Input parameters are invalid VOS_STATUS_E_FAULT: BAP handle is NULL VOS_STATUS_SUCCESS: Everything is good :) SIDE EFFECTS ============================================================================*/ VOS_STATUS WLANBAP_TxLinkSupervision ( ptBtampHandle btampHandle, v_U8_t phy_link_handle, /* Used by BAP to indentify the WLAN assoc. (StaId) */ vos_pkt_t *pPacket, v_U16_t protoType ) { ptBtampContext pBtampCtx = (ptBtampContext)btampHandle; VOS_STATUS vosStatus = VOS_STATUS_E_FAILURE; v_PVOID_t pvosGCtx; v_U8_t ucSTAId; /* The StaId (used by TL, PE, and HAL) */ v_PVOID_t pHddHdl; /* Handle to return BSL context in */ WLANTL_MetaInfoType metaInfo; VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "In : %s protoType=%x", __FUNCTION__,protoType); // Retrieve the VOSS context pvosGCtx = pBtampCtx->pvosGCtx; /* Lookup the StaId using the phy_link_handle and the BAP context */ vosStatus = WLANBAP_GetStaIdFromLinkCtx ( btampHandle, /* btampHandle value in */ phy_link_handle, /* phy_link_handle value in */ &ucSTAId, /* The StaId (used by TL, PE, and HAL) */ &pHddHdl); /* Handle to return BSL context */ if ( VOS_STATUS_SUCCESS != vosStatus ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Unable to retrieve STA Id from BAP context and phy_link_handle in WLANBAP_TxLinKSupervisionReq"); return VOS_STATUS_E_FAULT; } vos_mem_zero( &metaInfo, sizeof( WLANTL_MetaInfoType ) ); metaInfo.ucTID = 0x00 ; metaInfo.ucUP = 0x00; metaInfo.ucIsEapol = VOS_FALSE;//Notify TL that this is NOT an EAPOL frame metaInfo.ucDisableFrmXtl = VOS_FALSE; metaInfo.ucType = 0x00; pBtampCtx->metaInfo = metaInfo; vosStatus = WLANTL_TxBAPFrm( pvosGCtx, pPacket, &metaInfo, WLANBAP_TxLinkSupervisionCB ); if( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Tx: Packet rejected by TL in WLANBAP_TxLinkSupervisionReq"); return vosStatus; } if(protoType == WLANTL_BT_AMP_TYPE_LS_REQ) { pBtampCtx->lsReqPktPending = TRUE; pBtampCtx->retries++; } if (pBtampCtx->bapLinkSupervisionTimerInterval) { /* Restart the LS timer */ WLANBAP_StopLinkSupervisionTimer(pBtampCtx); vosStatus = WLANBAP_StartLinkSupervisionTimer (pBtampCtx, pBtampCtx->bapLinkSupervisionTimerInterval * WLANBAP_BREDR_BASEBAND_SLOT_TIME); } if( !VOS_IS_STATUS_SUCCESS( vosStatus ) ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "WLANBAP_TxLinkSupervisionReq failed to Start LinkSupervision Timer\n" ); return vosStatus; } return vosStatus; } /* WLANBAP_RxLinkSupervisionReq */
/** * pe_reset_protection_callback() - resets protection structs so that when an AP * causing use of protection goes away, corresponding protection bit can be * reset * @ptr: pointer to pSessionEntry * * This function resets protection structs so that when an AP causing use of * protection goes away, corresponding protection bit can be reset. This allowes * protection bits to be reset once legacy overlapping APs are gone. * * Return: void */ void pe_reset_protection_callback(void *ptr) { tpPESession pe_session_entry = (tpPESession)ptr; tpAniSirGlobal mac_ctx = (tpAniSirGlobal)pe_session_entry->mac_ctx; int8_t i = 0; tUpdateBeaconParams beacon_params; tANI_U16 current_protection_state = 0; tpDphHashNode station_hash_node = NULL; if (pe_session_entry->valid == false) { VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("session already deleted. exiting timer callback")); return; } current_protection_state |= pe_session_entry->gLimOverlap11gParams.protectionEnabled | pe_session_entry->gLimOverlap11aParams.protectionEnabled << 1 | pe_session_entry->gLimOverlapHt20Params.protectionEnabled << 2 | pe_session_entry->gLimOverlapNonGfParams.protectionEnabled << 3 ; VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, FL("old protection state: 0x%04X, " "new protection state: 0x%04X\n"), pe_session_entry->old_protection_state, current_protection_state); vos_mem_zero(&pe_session_entry->gLimOverlap11gParams, sizeof(pe_session_entry->gLimOverlap11gParams)); vos_mem_zero(&pe_session_entry->gLimOverlap11aParams, sizeof(pe_session_entry->gLimOverlap11aParams)); vos_mem_zero(&pe_session_entry->gLimOverlapHt20Params, sizeof(pe_session_entry->gLimOverlapHt20Params)); vos_mem_zero(&pe_session_entry->gLimOverlapNonGfParams, sizeof(pe_session_entry->gLimOverlapNonGfParams)); vos_mem_zero(&pe_session_entry->beaconParams, sizeof(pe_session_entry->beaconParams)); /* index 0, is self node, peers start from 1 */ for(i = 1 ; i < mac_ctx->lim.gLimAssocStaLimit ; i++) { station_hash_node = dphGetHashEntry(mac_ctx, i, &pe_session_entry->dph.dphHashTable); if (NULL == station_hash_node) continue; limDecideApProtection(mac_ctx, station_hash_node->staAddr, &beacon_params, pe_session_entry); } if ((current_protection_state != pe_session_entry->old_protection_state) && (VOS_FALSE == mac_ctx->sap.SapDfsInfo.is_dfs_cac_timer_running)) { VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO, FL("protection changed, update beacon template\n")); /* update beacon fix params and send update to FW */ vos_mem_zero(&beacon_params, sizeof(tUpdateBeaconParams)); beacon_params.bssIdx = pe_session_entry->bssIdx; beacon_params.fShortPreamble = pe_session_entry->beaconParams.fShortPreamble; beacon_params.beaconInterval = pe_session_entry->beaconParams.beaconInterval; beacon_params.llaCoexist = pe_session_entry->beaconParams.llaCoexist; beacon_params.llbCoexist = pe_session_entry->beaconParams.llbCoexist; beacon_params.llgCoexist = pe_session_entry->beaconParams.llgCoexist; beacon_params.ht20MhzCoexist = pe_session_entry->beaconParams.ht20Coexist; beacon_params.llnNonGFCoexist = pe_session_entry->beaconParams.llnNonGFCoexist; beacon_params.fLsigTXOPProtectionFullSupport = pe_session_entry->beaconParams.fLsigTXOPProtectionFullSupport; beacon_params.fRIFSMode = pe_session_entry->beaconParams.fRIFSMode; beacon_params.smeSessionId = pe_session_entry->smeSessionId; schSetFixedBeaconFields(mac_ctx, pe_session_entry); limSendBeaconParams(mac_ctx, &beacon_params, pe_session_entry); } pe_session_entry->old_protection_state = current_protection_state; if (VOS_STATUS_SUCCESS != vos_timer_start( &pe_session_entry->protection_fields_reset_timer, SCH_PROTECTION_RESET_TIME)) { VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("cannot create or start protectionFieldsResetTimer\n")); } }
/* * 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 ; vos_mem_zero(&tdlsSendMgmtCmd->u.tdlsCmd, sizeof(tTdlsCmd)); 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 ; smsLog( pMac, LOG1, FL("Successfully posted tdlsSendMgmtCmd to SME")); } } return status ; }
VOS_STATUS vos_alloc_context( v_VOID_t *pVosContext, VOS_MODULE_ID moduleID, v_VOID_t **ppModuleContext, v_SIZE_t size ) { v_VOID_t ** pGpModContext = NULL; if ( pVosContext == NULL) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: vos context is null", __func__); return VOS_STATUS_E_FAILURE; } if (( gpVosContext != pVosContext) || ( ppModuleContext == NULL)) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: context mismatch or null param passed", __func__); return VOS_STATUS_E_FAILURE; } switch(moduleID) { case VOS_MODULE_ID_TL: { pGpModContext = &(gpVosContext->pTLContext); break; } #ifdef WLAN_BTAMP_FEATURE case VOS_MODULE_ID_BAP: { pGpModContext = &(gpVosContext->pBAPContext); break; } #endif case VOS_MODULE_ID_SAP: { pGpModContext = &(gpVosContext->pSAPContext); break; } case VOS_MODULE_ID_WDA: { pGpModContext = &(gpVosContext->pWDAContext); break; } case VOS_MODULE_ID_SME: case VOS_MODULE_ID_PE: case VOS_MODULE_ID_PMC: case VOS_MODULE_ID_HDD: case VOS_MODULE_ID_HDD_SOFTAP: default: { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i " "does not have its context allocated by VOSS", __func__, moduleID); VOS_ASSERT(0); return VOS_STATUS_E_INVAL; } } if ( NULL != *pGpModContext) { VOS_TRACE( VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR, "%s: Module ID %i context has already been allocated", __func__, moduleID); return VOS_STATUS_E_EXISTS; } *ppModuleContext = kmalloc(size, GFP_KERNEL); if ( *ppModuleContext == NULL) { VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,"%s: Failed to " "allocate Context for module ID %i", __func__, moduleID); VOS_ASSERT(0); return VOS_STATUS_E_NOMEM; } if (moduleID==VOS_MODULE_ID_TL) { vos_mem_zero(*ppModuleContext, size); } *pGpModContext = *ppModuleContext; return VOS_STATUS_SUCCESS; }
/** * suppRsnFsmCreate * * FUNCTION * Allocates and initializes the state of an RSN key FSM instance for * the given BP context. * * @parm ctx the BP context whose instance is being created * @param pskBased pass in eANI_BOOLEAN_TRUE is this BP is to be * authenticated based on a pre-shared key as opposed to EAP. * * @return ANI_OK if the operation succeeds */ int suppRsnFsmCreate(tBtampContext *ctx) { int retVal = ANI_OK; tSuppRsnFsm *fsm = &ctx->uFsm.suppFsm; // First, clear everything out vos_mem_zero( fsm, sizeof(tSuppRsnFsm)); if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterTxRxCallbacks( suppRsnTxCompleteHandler, suppRsnRxFrameHandler ) ) ) { return ANI_ERROR; } if( !VOS_IS_STATUS_SUCCESS( bapRsnRegisterRxCallback( ctx->pvosGCtx ) ) ) { return ANI_ERROR; } // Allocate the supplicant context fsm->suppCtx = (tSuppContext *)vos_mem_malloc( sizeof(tSuppContext) ); if (fsm->suppCtx == NULL) { retVal = ANI_E_MALLOC_FAILED; VOS_ASSERT( 0 ); goto error; } // Clear out the supplicant context vos_mem_zero( fsm->suppCtx, sizeof(tSuppContext)); fsm->ctx = ctx; //Only support CCMP fsm->suppCtx->pwCipherType = eCSR_ENCRYPT_TYPE_AES; retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol, RSN_MAX_PACKET_SIZE, EAPOL_TX_HEADER_SIZE); if (retVal != ANI_OK) { VOS_ASSERT( 0 ); goto error; } aniAsfPacketAllocate(&fsm->suppCtx->pmk); if (fsm->suppCtx->pmk == NULL) { retVal = ANI_E_MALLOC_FAILED; VOS_ASSERT( 0 ); goto error; } fsm->suppCtx->ieAp = NULL; fsm->cryptHandle = 0; if( !VOS_IS_STATUS_SUCCESS( vos_crypto_init( &fsm->cryptHandle ) ) ) { retVal = ANI_E_FAILED; VOS_ASSERT( 0 ); } fsm->currentState = INITIALIZE; gotoStateInit(fsm); suppRsnFsmProcessEvent( fsm, RSN_FSM_AUTH_START, NULL ); return ANI_OK; error: suppRsnFsmFree( ctx ); return retVal; }
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( LOGE, "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( LOGE, "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 */ hddLog( LOGE, "hdd_IndicateScanResult: no space for SIOCGIWFREQ"); 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_MASTER; } 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( LOGE, "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( LOGE, "hdd_IndicateScanResult: no space for SIOCGIWESSID"); return -E2BIG; } } if( hdd_GetWPARSNIEs( ( tANI_U8 *) descriptor->ieFields, ie_length, &last_event, ¤t_event, scanInfo ) < 0 ) { hddLog( LOGE, "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( LOGE, "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 */ hddLog( LOGE, "hdd_IndicateScanResult: no space for SIOCGIWENCODE"); 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, VOS_MAC_ADDR_SIZE))) { 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( LOGE, "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( LOGE, "hdd_IndicateScanResult: no space for IWEVCUSTOM (age)"); return -E2BIG; } scanInfo->start = current_event; return 0; }
static int gotoStateStaKeySet(tSuppRsnFsm *fsm, tAniEapolKeyAvailEventData *data, v_BOOL_t retransmit) { int retVal=0; tAniEapolRsnKeyDesc txDesc; tAniEapolRsnKeyDesc *rxDesc = NULL; fsm->currentState = STA_KEY_SET; if (data == NULL) { // We don't need to do anything return ANI_OK; } // Create a new EAPOL frame if we don't have to retransmit if (!retransmit) { // First check the IE that the AP sent retVal = checkInfoElement(fsm, data); if (retVal != ANI_OK) { //FIX_RSN aagSetSuppFailureAndCleanup(fsm->suppCtx); // FSM does not exist after this... return retVal; } // Create a new EAPOL frame rxDesc = data->keyDesc; if( NULL == rxDesc ) return ANI_E_NULL_VALUE; aniAsfPacketEmptyExplicit(fsm->lastEapol, EAPOL_TX_HEADER_SIZE ); vos_mem_zero( &txDesc, sizeof(txDesc) ); // The Key Information bits... if (fsm->suppCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) { txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; } txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE; txDesc.info.micFlag = eANI_BOOLEAN_TRUE; txDesc.info.secureFlag = eANI_BOOLEAN_TRUE; txDesc.keyLen = 0; //RSN_80211_KEY_LEN; // Send back the same replayCtr that the authenticator sent vos_mem_copy(txDesc.replayCounter, rxDesc->replayCounter, sizeof(txDesc.replayCounter)); retVal = aniEapolWriteKey(fsm->cryptHandle, fsm->lastEapol, fsm->suppCtx->authMac, fsm->suppCtx->suppMac, ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, &txDesc, fsm->suppCtx->ptk, CSR_AES_KEY_LEN); if( !ANI_IS_STATUS_SUCCESS( retVal ) ) { return retVal; } } gReadToSetKey = BAP_SET_RSN_KEY; if( !VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) { /* making it global to access in bapTxRx file */ #if 0 tCsrRoamSetKey setKeyInfo; vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) ); setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES; setKeyInfo.keyDirection = eSIR_TX_RX; vos_mem_copy( setKeyInfo.peerMac, fsm->suppCtx->authMac, sizeof( tAniMacAddr ) ); setKeyInfo.paeRole = 0; //this is a supplicant setKeyInfo.keyId = 0; //always setKeyInfo.keyLength = CSR_AES_KEY_LEN; vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->suppCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN ); //fsm->suppCtx->ptk contains the 3 16-bytes keys. We need the last one. /* We will move the Set key to EAPOL Completion handler. We found a race condition betweem sending EAPOL frame and setting Key */ if( !VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, " Supp: gotoStateStaKeySet fail to set key\n" ); retVal = ANI_ERROR; } #endif gReadToSetKey = BAP_RESET_RSN_KEY; retVal = ANI_ERROR; } return retVal; }
int iw_set_scan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ; hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); tCsrScanRequest scanRequest; v_U32_t scanId = 0; eHalStatus status = eHAL_STATUS_SUCCESS; struct iw_scan_req *scanReq = (struct iw_scan_req *)extra; hdd_adapter_t *con_sap_adapter; uint16_t con_dfs_ch; ENTER(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__); #ifdef WLAN_BTAMP_FEATURE //Scan not supported when AMP traffic is on. if( VOS_TRUE == WLANBAP_AmpSessionOn() ) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__); return eHAL_STATUS_SUCCESS; } #endif /* Block All Scan during DFS operation and send null scan result */ con_sap_adapter = hdd_get_con_sap_adapter(pAdapter); if (con_sap_adapter) { con_dfs_ch = con_sap_adapter->sessionCtx.ap.sapConfig.channel; if (con_dfs_ch == AUTO_CHANNEL_SELECT) con_dfs_ch = con_sap_adapter->sessionCtx.ap.operatingChannel; if (VOS_IS_DFS_CH(con_dfs_ch)) { hddLog(LOGW, "%s:##In DFS Master mode. Scan aborted", __func__); return -EOPNOTSUPP; } } if(pAdapter->scan_info.mScanPending == TRUE) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:mScanPending is TRUE !!!",__func__); return eHAL_STATUS_SUCCESS; } if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); return eHAL_STATUS_SUCCESS; } vos_mem_zero( &scanRequest, sizeof(scanRequest)); if (NULL != wrqu->data.pointer) { /* set scanType, active or passive */ if ((IW_SCAN_TYPE_ACTIVE == scanReq->scan_type) || (eSIR_ACTIVE_SCAN == pHddCtx->ioctl_scan_mode)) { scanRequest.scanType = eSIR_ACTIVE_SCAN; } else { scanRequest.scanType = eSIR_PASSIVE_SCAN; } /* set bssid using sockaddr from iw_scan_req */ vos_mem_copy(scanRequest.bssid, &scanReq->bssid.sa_data, sizeof(scanRequest.bssid) ); if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { if(scanReq->essid_len) { scanRequest.SSIDs.numOfSSIDs = 1; scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(sizeof(tCsrSSIDInfo)); if(scanRequest.SSIDs.SSIDList) { scanRequest.SSIDs.SSIDList->SSID.length = scanReq->essid_len; vos_mem_copy(scanRequest.SSIDs.SSIDList-> SSID.ssId,scanReq->essid,scanReq->essid_len); } else { scanRequest.SSIDs.numOfSSIDs = 0; VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: Unable to allocate memory",__func__); VOS_ASSERT(0); } } } /* set min and max channel time */ scanRequest.minChnTime = scanReq->min_channel_time; scanRequest.maxChnTime = scanReq->max_channel_time; } else { if (pHddCtx->ioctl_scan_mode == eSIR_ACTIVE_SCAN) { /* set the scan type to active */ scanRequest.scanType = eSIR_ACTIVE_SCAN; } else { scanRequest.scanType = eSIR_PASSIVE_SCAN; } vos_mem_set( scanRequest.bssid, sizeof( tCsrBssid ), 0xff ); /* set min and max channel time to zero */ scanRequest.minChnTime = 0; scanRequest.maxChnTime = 0; } /* set BSSType to default type */ scanRequest.BSSType = eCSR_BSS_TYPE_ANY; /*Scan all the channels */ scanRequest.ChannelInfo.numOfChannels = 0; scanRequest.ChannelInfo.ChannelList = NULL; /* set requestType to full scan */ scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; /* if previous genIE is not NULL, update ScanIE */ if (0 != pwextBuf->genIE.length) { memset( &pAdapter->scan_info.scanAddIE, 0, sizeof(pAdapter->scan_info.scanAddIE) ); memcpy( pAdapter->scan_info.scanAddIE.addIEdata, pwextBuf->genIE.addIEdata, pwextBuf->genIE.length ); pAdapter->scan_info.scanAddIE.length = pwextBuf->genIE.length; pwextBuf->roamProfile.pAddIEScan = pAdapter->scan_info.scanAddIE.addIEdata; pwextBuf->roamProfile.nAddIEScanLength = pAdapter->scan_info.scanAddIE.length; /* clear previous genIE after use it */ memset( &pwextBuf->genIE, 0, sizeof(pwextBuf->genIE) ); } /* push addIEScan in scanRequset if exist */ if (pAdapter->scan_info.scanAddIE.addIEdata && pAdapter->scan_info.scanAddIE.length) { scanRequest.uIEFieldLen = pAdapter->scan_info.scanAddIE.length; scanRequest.pIEField = pAdapter->scan_info.scanAddIE.addIEdata; } status = sme_ScanRequest((WLAN_HDD_GET_CTX(pAdapter))->hHal, pAdapter->sessionId, &scanRequest, &scanId, &hdd_ScanRequestCallback, dev); if (!HAL_STATUS_SUCCESS(status)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:sme_ScanRequest fail %d!!!",__func__, status); goto error; } pAdapter->scan_info.mScanPending = TRUE; pAdapter->scan_info.scanId = scanId; error: if ((wrqu->data.flags & IW_SCAN_THIS_ESSID) && (scanReq->essid_len)) vos_mem_free(scanRequest.SSIDs.SSIDList); EXIT(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__); return status; }
void vos_log_submit(v_VOID_t *plog_hdr_ptr) { log_hdr_type *pHdr = (log_hdr_type*) plog_hdr_ptr; tAniHdr *wmsg = NULL; v_U8_t *pBuf; struct hdd_context_s *pHddCtx; v_CONTEXT_t pVosContext= NULL; v_U16_t data_len; v_U16_t total_len; /*Get the global context */ pVosContext = vos_get_global_context(VOS_MODULE_ID_SYS, NULL); /*Get the Hdd Context */ pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext; if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: Unloading/Loading in Progress. Ignore!!!", __func__); return; } #ifdef WLAN_KD_READY_NOTIFIER /* NL is not ready yet, WLAN KO started first */ if ((pHddCtx->kd_nl_init) && (!pHddCtx->ptt_pid)) { nl_srv_nl_ready_indication(); } #endif /* WLAN_KD_READY_NOTIFIER */ /* Send the log data to the ptt app only if it is registered with the wlan driver*/ if(pHddCtx->ptt_pid) { data_len = pHdr->len; total_len = sizeof(tAniHdr)+sizeof(v_U32_t)+data_len; pBuf = (v_U8_t*)vos_mem_malloc(total_len); if(!pBuf) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "vos_mem_malloc failed\n"); return; } vos_mem_zero((v_VOID_t*)pBuf,total_len); wmsg = (tAniHdr*)pBuf; wmsg->type = PTT_MSG_DIAG_CMDS_TYPE; wmsg->length = total_len; wmsg->length = DIAG_SWAP16(wmsg->length); pBuf += sizeof(tAniHdr); /* Diag Type events or log */ *(v_U32_t*)pBuf = DIAG_TYPE_LOGS; pBuf += sizeof(v_U32_t); memcpy(pBuf, pHdr,data_len); if(pHddCtx->ptt_pid) { if( ptt_sock_send_msg_to_app(wmsg, 0, ANI_NL_MSG_PUMAC, pHddCtx->ptt_pid) < 0) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, ("Ptt Socket error sending message to the app!!\n")); vos_mem_free((v_VOID_t *)wmsg); return; } } vos_mem_free((v_VOID_t*)wmsg); } return; }
static int writeRsnKeyMic(v_U32_t cryptHandle, tAniPacket *eapolFrame, tAniEapolRsnKeyDesc *rsnDesc, v_U8_t *micKey, v_U32_t micKeyLen) { int retVal = ANI_OK; int len; v_U8_t *ptr = NULL; v_U8_t *micPos = NULL; v_U8_t result[VOS_DIGEST_SHA1_SIZE]; if (micKey != NULL) { if (micKeyLen == 0 || !rsnDesc->info.micFlag) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp MIC key provided but micKeyLen or micFlag is not set!\n"); VOS_ASSERT( 0 ); return ANI_E_ILLEGAL_ARG; } } else { if (rsnDesc->info.micFlag) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "Supp micFlag is set but MIC key not provided!\n"); VOS_ASSERT( 0 ); return ANI_E_ILLEGAL_ARG; } return ANI_OK; } len = aniAsfPacketGetBytes(eapolFrame, &ptr); if( !ANI_IS_STATUS_SUCCESS( len ) ) { return len; } micPos = ptr + ANI_SSM_RSN_KEY_MIC_OFFSET + SNAP_HEADER_SIZE; vos_mem_zero( micPos, VOS_DIGEST_MD5_SIZE); ptr += EAPOL_VERSION_POS + SNAP_HEADER_SIZE; len -= (EAPOL_VERSION_POS + SNAP_HEADER_SIZE); if (rsnDesc->info.keyDescVers == ANI_EAPOL_KEY_DESC_VERS_AES) { if( VOS_IS_STATUS_SUCCESS( vos_sha1_hmac_str(cryptHandle, ptr, len, micKey, micKeyLen, result) ) ) { retVal = ANI_OK; } else { retVal = ANI_ERROR; } } else { VOS_ASSERT( 0 ); retVal = ANI_E_ILLEGAL_ARG; } if (retVal == ANI_OK) { vos_mem_copy(micPos, result, VOS_DIGEST_MD5_SIZE); } return retVal; }
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 %02x:%02x:%02x:%02x:%02x:%02x", descriptor->bssId[0], descriptor->bssId[1], descriptor->bssId[2], descriptor->bssId[3], descriptor->bssId[4], descriptor->bssId[5]); error = 0; last_event = current_event; vos_mem_zero(&event, sizeof (event)); 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) { hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWAP "); return -E2BIG; } last_event = current_event; vos_mem_zero(&event, sizeof (struct iw_event)); 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) { hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWNAME"); return -E2BIG; } last_event = current_event; vos_mem_zero( &event, sizeof (struct iw_event)); 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) { return -E2BIG; } last_event = current_event; vos_mem_zero( &event, sizeof (struct iw_event)); 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 { 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) { hddLog( LOGW, "hdd_IndicateScanResult: no space for SIOCGIWMODE"); return -E2BIG; } ie_length = GET_IE_LEN_IN_BSS( descriptor->length ); if (ie_length > 0) { 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) { 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)); 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; 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) { 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) { return -E2BIG; } } last_event = current_event; vos_mem_zero( &event, sizeof (struct iw_event)); event.cmd = IWEVQUAL; event.u.qual.qual = descriptor->rssi; event.u.qual.noise = descriptor->sinr; 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) { hddLog( LOGW, "hdd_IndicateScanResult: no space for IWEVQUAL"); return -E2BIG; } 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) { hddLog( LOGW, "hdd_IndicateScanResult: no space for IWEVCUSTOM (age)"); return -E2BIG; } scanInfo->start = current_event; return 0; }
static VOS_STATUS bapRsnTxCompleteCallback( v_PVOID_t pvosGCtx, vos_pkt_t *pPacket, VOS_STATUS retStatus ) { int retVal; ptBtampContext btampContext; // tCsrRoamSetKey setKeyInfo; tSuppRsnFsm *fsm; if (NULL == pvosGCtx) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "pvosGCtx is NULL in %s", __func__); return VOS_STATUS_E_FAULT; } btampContext = VOS_GET_BAP_CB(pvosGCtx); if (NULL == btampContext) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "btampContext is NULL in %s", __func__); return VOS_STATUS_E_FAULT; } fsm = &btampContext->uFsm.suppFsm; if (NULL == fsm) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, "fsm is NULL in %s", __func__); return VOS_STATUS_E_FAULT; } // // // if( bapRsnFsmTxCmpHandler ) { // // bapRsnFsmTxCmpHandler( pvosGCtx, pPacket, retStatus ); } else { vos_pkt_return_packet( pPacket ); return (VOS_STATUS_SUCCESS ); } // /* */ if (BAP_SET_RSN_KEY == gReadToSetKey) { vos_mem_zero( &setKeyInfo, sizeof( tCsrRoamSetKey ) ); setKeyInfo.encType = eCSR_ENCRYPT_TYPE_AES; setKeyInfo.keyDirection = eSIR_TX_RX; vos_mem_copy( setKeyInfo.peerMac, fsm->suppCtx->authMac, sizeof( tAniMacAddr ) ); setKeyInfo.paeRole = 0; // setKeyInfo.keyId = 0; // setKeyInfo.keyLength = CSR_AES_KEY_LEN; vos_mem_copy( setKeyInfo.Key, (v_U8_t *)fsm->suppCtx->ptk + (2 * CSR_AES_KEY_LEN ), CSR_AES_KEY_LEN ); if( !VOS_IS_STATUS_SUCCESS( bapSetKey( fsm->ctx->pvosGCtx, &setKeyInfo ) ) ) { VOS_TRACE( VOS_MODULE_ID_BAP, VOS_TRACE_LEVEL_ERROR, " Supp: gotoStateStaKeySet fail to set key\n" ); retVal = ANI_ERROR; } gReadToSetKey = BAP_RESET_RSN_KEY; } return (VOS_STATUS_SUCCESS ); }
int iw_set_cscan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ; hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); tCsrScanRequest scanRequest; v_U32_t scanId = 0; eHalStatus status = eHAL_STATUS_SUCCESS; v_U8_t channelIdx; ENTER(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__); #ifdef WLAN_BTAMP_FEATURE if( VOS_TRUE == WLANBAP_AmpSessionOn() ) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__); return eHAL_STATUS_SUCCESS; } #endif if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); return eHAL_STATUS_SUCCESS; } vos_mem_zero( &scanRequest, sizeof(scanRequest)); if (NULL != wrqu->data.pointer) { char *str_ptr = NULL; tCsrSSIDInfo *SsidInfo = NULL; int num_ssid = 0; int i, j, ssid_start; hdd_scan_pending_option_e scanPendingOption = WEXT_SCAN_PENDING_GIVEUP; str_ptr = extra; i = WEXT_CSCAN_HEADER_SIZE; if( WEXT_CSCAN_PENDING_SECTION == str_ptr[i] ) { scanPendingOption = (hdd_scan_pending_option_e)str_ptr[++i]; ++i; } pHddCtx->scan_info.scan_pending_option = scanPendingOption; if(pHddCtx->scan_info.mScanPending == TRUE) { hddLog(LOG1,"%s: mScanPending is TRUE",__func__); if(WEXT_SCAN_PENDING_GIVEUP == scanPendingOption) { pHddCtx->scan_info.waitScanResult = FALSE; return eHAL_STATUS_SUCCESS; } else if(WEXT_SCAN_PENDING_DELAY == scanPendingOption) { pHddCtx->scan_info.waitScanResult = TRUE; vos_event_reset(&pHddCtx->scan_info.scan_finished_event); if(vos_wait_single_event(&pHddCtx->scan_info.scan_finished_event, WEXT_CSCAN_SCAN_DONE_WAIT_TIME)) { hddLog(LOG1,"%s: Previous SCAN does not finished on time",__func__); return eHAL_STATUS_SUCCESS; } } else if(WEXT_SCAN_PENDING_PIGGYBACK == scanPendingOption) { pHddCtx->scan_info.waitScanResult = TRUE; return eHAL_STATUS_SUCCESS; } } pHddCtx->scan_info.waitScanResult = FALSE; while( WEXT_CSCAN_SSID_SECTION == str_ptr[i] ) { if(str_ptr[++i] != WEXT_CSCAN_CHANNEL_SECTION) { num_ssid++; i += str_ptr[i] + 1; } } VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: numSsid %d !!!",__func__, num_ssid); if( num_ssid ) { scanRequest.SSIDs.numOfSSIDs = num_ssid; SsidInfo = scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(num_ssid*sizeof(tCsrSSIDInfo)); if(NULL == scanRequest.SSIDs.SSIDList) { hddLog(VOS_TRACE_LEVEL_ERROR, "memory alloc failed SSIDInfo buffer"); return -ENOMEM; } ssid_start = WEXT_CSCAN_HEADER_SIZE + 1; for(j = 0; j < num_ssid; j++) { if( SIR_MAC_MAX_SSID_LENGTH < str_ptr[ssid_start]){ scanRequest.SSIDs.numOfSSIDs -= 1; } else{ SsidInfo->SSID.length = str_ptr[ssid_start++]; vos_mem_copy(SsidInfo->SSID.ssId, &str_ptr[ssid_start], SsidInfo->SSID.length); hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "SSID number %d: %s\n", j, SsidInfo->SSID.ssId); } ssid_start += str_ptr[ssid_start - 1] + 1; SsidInfo++; } } if ( WEXT_CSCAN_CHANNEL_SECTION == str_ptr[i]) { if( str_ptr[++i] == 0 ) { scanRequest.ChannelInfo.numOfChannels = 0; scanRequest.ChannelInfo.ChannelList = NULL; i++; } else { scanRequest.ChannelInfo.numOfChannels = str_ptr[i++]; scanRequest.ChannelInfo.ChannelList = vos_mem_malloc(scanRequest.ChannelInfo.numOfChannels * sizeof(v_U8_t)); if(NULL == scanRequest.ChannelInfo.ChannelList) { hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "memory alloc failed for channel list creation"); status = -ENOMEM; goto exit_point; } for(channelIdx = 0; channelIdx < scanRequest.ChannelInfo.numOfChannels; channelIdx++) { scanRequest.ChannelInfo.ChannelList[channelIdx] = (v_U8_t)str_ptr[i]; i += sizeof(v_U16_t); } } } scanRequest.scanType = eSIR_ACTIVE_SCAN; scanRequest.minChnTime = 0; scanRequest.maxChnTime = 0; if( WEXT_CSCAN_PASV_DWELL_SECTION == (str_ptr[i]) ) { if (!num_ssid || (eSIR_PASSIVE_SCAN == pHddCtx->scan_info.scan_mode)) { scanRequest.scanType = eSIR_PASSIVE_SCAN; scanRequest.minChnTime = (v_U8_t)str_ptr[++i]; scanRequest.maxChnTime = (v_U8_t)str_ptr[++i]; i++; } else { i += 3; } } if( WEXT_CSCAN_HOME_DWELL_SECTION == (str_ptr[i]) ) { if (num_ssid || (eSIR_ACTIVE_SCAN == pHddCtx->scan_info.scan_mode)) { scanRequest.scanType = eSIR_ACTIVE_SCAN; scanRequest.minChnTime = str_ptr[++i]; scanRequest.maxChnTime = str_ptr[++i]; i++; } else { i +=3; } } scanRequest.BSSType = eCSR_BSS_TYPE_ANY; scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; pHddCtx->scan_info.mScanPending = TRUE; if(0 != pwextBuf->genIE.length) { memset( &pHddCtx->scan_info.scanAddIE, 0, sizeof(pHddCtx->scan_info.scanAddIE) ); memcpy( pHddCtx->scan_info.scanAddIE.addIEdata, pwextBuf->genIE.addIEdata, pwextBuf->genIE.length ); pHddCtx->scan_info.scanAddIE.length = pwextBuf->genIE.length; if (SIR_MAC_MAX_IE_LENGTH >= pwextBuf->genIE.length) { memcpy( pwextBuf->roamProfile.addIEScan, pHddCtx->scan_info.scanAddIE.addIEdata, pHddCtx->scan_info.scanAddIE.length); pwextBuf->roamProfile.nAddIEScanLength = pHddCtx->scan_info.scanAddIE.length; } else { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "Invalid ScanIE, Length is %d", pwextBuf->genIE.length); } memset( &pwextBuf->genIE, 0, sizeof(pwextBuf->genIE) ); } if (pHddCtx->scan_info.scanAddIE.addIEdata && pHddCtx->scan_info.scanAddIE.length) { scanRequest.uIEFieldLen = pHddCtx->scan_info.scanAddIE.length; scanRequest.pIEField = pHddCtx->scan_info.scanAddIE.addIEdata; } status = sme_ScanRequest( (WLAN_HDD_GET_CTX(pAdapter))->hHal, pAdapter->sessionId,&scanRequest, &scanId, &hdd_ScanRequestCallback, dev ); if( !HAL_STATUS_SUCCESS(status) ) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: SME scan fail status %d !!!",__func__, status); pHddCtx->scan_info.mScanPending = FALSE; status = -EINVAL; goto exit_point; } pHddCtx->scan_info.scanId = scanId; } else { status = -1; } exit_point: if (scanRequest.SSIDs.SSIDList) { vos_mem_free(scanRequest.SSIDs.SSIDList); } if(scanRequest.ChannelInfo.ChannelList) { vos_mem_free((void*)scanRequest.ChannelInfo.ChannelList); } EXIT(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__); return status; }
int iw_set_cscan(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) { hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev) ; hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter); tCsrScanRequest scanRequest; v_U32_t scanId = 0; eHalStatus status = eHAL_STATUS_SUCCESS; v_U8_t channelIdx; ENTER(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: enter !!!",__func__); #ifdef WLAN_BTAMP_FEATURE //Scan not supported when AMP traffic is on. if( VOS_TRUE == WLANBAP_AmpSessionOn() ) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, "%s: No scanning when AMP is on",__func__); return eHAL_STATUS_SUCCESS; } #endif if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__); return eHAL_STATUS_SUCCESS; } vos_mem_zero( &scanRequest, sizeof(scanRequest)); if (NULL != wrqu->data.pointer) { char *str_ptr = NULL; tCsrSSIDInfo *SsidInfo = NULL; int num_ssid = 0; int i, j, ssid_start; hdd_scan_pending_option_e scanPendingOption = WEXT_SCAN_PENDING_GIVEUP; str_ptr = extra; i = WEXT_CSCAN_HEADER_SIZE; if( WEXT_CSCAN_PENDING_SECTION == str_ptr[i] ) { scanPendingOption = (hdd_scan_pending_option_e)str_ptr[++i]; ++i; } pHddCtx->scan_info.scan_pending_option = scanPendingOption; if(pHddCtx->scan_info.mScanPending == TRUE) { hddLog(LOG1,"%s: mScanPending is TRUE",__func__); /* If any scan is pending, just giveup this scan request */ if(WEXT_SCAN_PENDING_GIVEUP == scanPendingOption) { pHddCtx->scan_info.waitScanResult = FALSE; return eHAL_STATUS_SUCCESS; } /* If any scan pending, wait till finish current scan, and try this scan request when previous scan finish */ else if(WEXT_SCAN_PENDING_DELAY == scanPendingOption) { pHddCtx->scan_info.waitScanResult = TRUE; vos_event_reset(&pHddCtx->scan_info.scan_finished_event); if(vos_wait_single_event(&pHddCtx->scan_info.scan_finished_event, WEXT_CSCAN_SCAN_DONE_WAIT_TIME)) { hddLog(LOG1,"%s: Previous SCAN does not finished on time",__func__); return eHAL_STATUS_SUCCESS; } } /* Piggyback previous scan result */ else if(WEXT_SCAN_PENDING_PIGGYBACK == scanPendingOption) { pHddCtx->scan_info.waitScanResult = TRUE; return eHAL_STATUS_SUCCESS; } } pHddCtx->scan_info.waitScanResult = FALSE; /* Check for scan IE */ while( WEXT_CSCAN_SSID_SECTION == str_ptr[i] ) { /* ssid_len */ if(str_ptr[++i] != WEXT_CSCAN_CHANNEL_SECTION) { /* total number of ssid's */ num_ssid++; /* increment length filed */ i += str_ptr[i] + 1; } /* i should be saved and it will be pointing to 'C' */ } VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: numSsid %d !!!",__func__, num_ssid); if( num_ssid ) { /* To be fixed in SME and PE: override the number of ssid with 1, * as SME and PE does not handle multiple SSID in scan request * */ scanRequest.SSIDs.numOfSSIDs = num_ssid; /* Allocate num_ssid tCsrSSIDInfo structure */ SsidInfo = scanRequest.SSIDs.SSIDList =( tCsrSSIDInfo *)vos_mem_malloc(num_ssid*sizeof(tCsrSSIDInfo)); if(NULL == scanRequest.SSIDs.SSIDList) { hddLog(VOS_TRACE_LEVEL_ERROR, "memory alloc failed SSIDInfo buffer"); return -ENOMEM; } /* copy all the ssid's and their length */ ssid_start = WEXT_CSCAN_HEADER_SIZE + 1;/* skipping 'S' */ for(j = 0; j < num_ssid; j++) { if( SIR_MAC_MAX_SSID_LENGTH < str_ptr[ssid_start]){ scanRequest.SSIDs.numOfSSIDs -= 1; } else{ /* get the ssid length */ SsidInfo->SSID.length = str_ptr[ssid_start++]; vos_mem_copy(SsidInfo->SSID.ssId, &str_ptr[ssid_start], SsidInfo->SSID.length); hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "SSID number %d: %s", j, SsidInfo->SSID.ssId); } /* skipping length */ ssid_start += str_ptr[ssid_start - 1] + 1; /* Store next ssid info */ SsidInfo++; } } /* Check for Channel IE */ if ( WEXT_CSCAN_CHANNEL_SECTION == str_ptr[i]) { if( str_ptr[++i] == 0 ) { scanRequest.ChannelInfo.numOfChannels = 0; scanRequest.ChannelInfo.ChannelList = NULL; i++; } else { /* increment the counter */ scanRequest.ChannelInfo.numOfChannels = str_ptr[i++]; /* store temp channel list */ /* SME expects 1 byte channel content */ scanRequest.ChannelInfo.ChannelList = vos_mem_malloc(scanRequest.ChannelInfo.numOfChannels * sizeof(v_U8_t)); if(NULL == scanRequest.ChannelInfo.ChannelList) { hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "memory alloc failed for channel list creation"); status = -ENOMEM; goto exit_point; } for(channelIdx = 0; channelIdx < scanRequest.ChannelInfo.numOfChannels; channelIdx++) { /* SCAN request from upper layer has 2 bytes channel */ scanRequest.ChannelInfo.ChannelList[channelIdx] = (v_U8_t)str_ptr[i]; i += sizeof(v_U16_t); } } } /* Set default */ scanRequest.scanType = eSIR_ACTIVE_SCAN; scanRequest.minChnTime = 0; scanRequest.maxChnTime = 0; /* Now i is pointing to passive dwell dwell time */ /* 'P',min dwell time, max dwell time */ /* next two offsets contain min and max channel time */ if( WEXT_CSCAN_PASV_DWELL_SECTION == (str_ptr[i]) ) { /* No SSID specified, num_ssid == 0, then start paasive scan */ if (!num_ssid || (eSIR_PASSIVE_SCAN == pHddCtx->scan_info.scan_mode)) { scanRequest.scanType = eSIR_PASSIVE_SCAN; scanRequest.minChnTime = (v_U8_t)str_ptr[++i];//scanReq->min_channel_time; scanRequest.maxChnTime = (v_U8_t)str_ptr[++i];//scanReq->max_channel_time; i++; } else { i += 3; } } /* H indicates active channel time */ if( WEXT_CSCAN_HOME_DWELL_SECTION == (str_ptr[i]) ) { if (num_ssid || (eSIR_ACTIVE_SCAN == pHddCtx->scan_info.scan_mode)) { scanRequest.scanType = eSIR_ACTIVE_SCAN; scanRequest.minChnTime = str_ptr[++i];//scanReq->min_channel_time; scanRequest.maxChnTime = str_ptr[++i];//scanReq->max_channel_time; i++; } else { i +=3; } } scanRequest.BSSType = eCSR_BSS_TYPE_ANY; /* set requestType to full scan */ scanRequest.requestType = eCSR_SCAN_REQUEST_FULL_SCAN; pHddCtx->scan_info.mScanPending = TRUE; /* if previous genIE is not NULL, update ScanIE */ if(0 != pwextBuf->genIE.length) { memset( &pHddCtx->scan_info.scanAddIE, 0, sizeof(pHddCtx->scan_info.scanAddIE) ); memcpy( pHddCtx->scan_info.scanAddIE.addIEdata, pwextBuf->genIE.addIEdata, pwextBuf->genIE.length ); pHddCtx->scan_info.scanAddIE.length = pwextBuf->genIE.length; pwextBuf->roamProfile.pAddIEScan = pHddCtx->scan_info.scanAddIE.addIEdata; pwextBuf->roamProfile.nAddIEScanLength = pHddCtx->scan_info.scanAddIE.length; /* clear previous genIE after use it */ memset( &pwextBuf->genIE, 0, sizeof(pwextBuf->genIE) ); } /* push addIEScan in scanRequset if exist */ if (pHddCtx->scan_info.scanAddIE.addIEdata && pHddCtx->scan_info.scanAddIE.length) { scanRequest.uIEFieldLen = pHddCtx->scan_info.scanAddIE.length; scanRequest.pIEField = pHddCtx->scan_info.scanAddIE.addIEdata; } status = sme_ScanRequest( (WLAN_HDD_GET_CTX(pAdapter))->hHal, pAdapter->sessionId,&scanRequest, &scanId, &hdd_ScanRequestCallback, dev ); if( !HAL_STATUS_SUCCESS(status) ) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s: SME scan fail status %d !!!",__func__, status); pHddCtx->scan_info.mScanPending = FALSE; status = -EINVAL; goto exit_point; } pHddCtx->scan_info.scanId = scanId; } //end of data->pointer else { status = -1; } exit_point: /* free ssidlist */ if (scanRequest.SSIDs.SSIDList) { vos_mem_free(scanRequest.SSIDs.SSIDList); } /* free the channel list */ if(scanRequest.ChannelInfo.ChannelList) { vos_mem_free((void*)scanRequest.ChannelInfo.ChannelList); } EXIT(); VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO, "%s: exit !!!",__func__); return status; }
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; } 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 ); 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; } vos_mem_copy( (pFrame + (sizeof( tSirMacMgmtHdr ))), pPublicVendorSpecific, sizeof(publicVendorSpecific) ); 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, limTxComplete, pFrame, txFlag ); if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) { limLog( pMac, LOGE, FL("could not send marker frame for" " remain on channel!" )); nSirStatus = eSIR_FAILURE; goto end; } nSirStatus = eSIR_SUCCESS; end: vos_mem_free( pPublicVendorSpecific ); return nSirStatus; }
/* * TDLS request API, called from HDD to modify an existing TDLS peer */ eHalStatus csrTdlsChangePeerSta(tHalHandle hHal, tANI_U8 sessionId, tSirMacAddr peerMac, tCsrStaParams *pstaParams) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); tSmeCmd *tdlsAddStaCmd ; eHalStatus status = eHAL_STATUS_FAILURE ; if (NULL == pstaParams) return status; //If connected and in Infra. Only then allow this if (CSR_IS_SESSION_VALID( pMac, sessionId ) && csrIsConnStateConnectedInfra( pMac, sessionId ) && (NULL != peerMac)){ tdlsAddStaCmd = csrGetCommandBuffer(pMac) ; if (tdlsAddStaCmd) { tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = &tdlsAddStaCmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; vos_mem_zero(&tdlsAddStaCmd->u.tdlsCmd, sizeof(tTdlsCmd)); tdlsAddStaCmdInfo->tdlsAddOper = TDLS_OPER_UPDATE; tdlsAddStaCmd->sessionId = sessionId; vos_mem_copy(tdlsAddStaCmdInfo->peerMac, peerMac, sizeof(tSirMacAddr)) ; tdlsAddStaCmdInfo->capability = pstaParams->capability; tdlsAddStaCmdInfo->uapsdQueues = pstaParams->uapsd_queues; tdlsAddStaCmdInfo->maxSp = pstaParams->max_sp; vos_mem_copy(tdlsAddStaCmdInfo->extnCapability, pstaParams->extn_capability, sizeof(pstaParams->extn_capability)); tdlsAddStaCmdInfo->htcap_present = pstaParams->htcap_present; if(pstaParams->htcap_present) vos_mem_copy( &tdlsAddStaCmdInfo->HTCap, &pstaParams->HTCap, sizeof(pstaParams->HTCap)); else vos_mem_set(&tdlsAddStaCmdInfo->HTCap, sizeof(pstaParams->HTCap), 0); tdlsAddStaCmdInfo->vhtcap_present = pstaParams->vhtcap_present; if(pstaParams->vhtcap_present) vos_mem_copy( &tdlsAddStaCmdInfo->VHTCap, &pstaParams->VHTCap, sizeof(pstaParams->VHTCap)); else vos_mem_set(&tdlsAddStaCmdInfo->VHTCap, sizeof(pstaParams->VHTCap), 0); tdlsAddStaCmdInfo->supportedRatesLen = pstaParams->supported_rates_len; if (0 != pstaParams->supported_rates_len) vos_mem_copy( &tdlsAddStaCmdInfo->supportedRates, pstaParams->supported_rates, pstaParams->supported_rates_len); tdlsAddStaCmd->command = eSmeCommandTdlsAddPeer; tdlsAddStaCmd->u.tdlsCmd.size = sizeof(tTdlsAddStaCmdInfo) ; smePushCommand(pMac, tdlsAddStaCmd, FALSE) ; smsLog( pMac, LOG1, FL("Successfully posted tdlsAddStaCmd to SME to modify peer ")); status = eHAL_STATUS_SUCCESS ; } } return status ; }
static int gotoStatePtkStart(tAuthRsnFsm *fsm) { tAniEapolRsnKeyDesc txDesc; int retVal; fsm->msg2TimeOut = VOS_FALSE; fsm->currentState = PTK_START; // Create a new packet if we don't have one to retransmit //if (aniAsfPacketGetLen(fsm->lastEapol) == 0) #if 0 if( fsm->lastEapol ) { aniAsfPacketFree( fsm->lastEapol ); fsm->lastEapol = NULL; retVal = aniAsfPacketAllocateExplicit(&fsm->lastEapol, RSN_MAX_PACKET_SIZE, EAPOL_TX_HEADER_SIZE ); #endif aniAsfPacketEmptyExplicit(fsm->lastEapol, EAPOL_TX_HEADER_SIZE); //} // if (1) //{ vos_mem_zero( &txDesc, sizeof(txDesc) ); // The Key Information bits... if (fsm->staCtx->pwCipherType == eCSR_ENCRYPT_TYPE_AES) { txDesc.info.keyDescVers = ANI_EAPOL_KEY_DESC_VERS_AES; } else { return ANI_E_ILLEGAL_ARG; } txDesc.info.unicastFlag = eANI_BOOLEAN_TRUE; txDesc.info.ackFlag = eANI_BOOLEAN_TRUE; // The other fields... txDesc.keyLen = aagGetKeyMaterialLen(fsm->staCtx->pwCipherType); aniSsmReplayCtrNext(fsm->staCtx->localReplayCtr, txDesc.replayCounter); vos_mem_copy(txDesc.keyNonce, fsm->aNonce, sizeof(txDesc.keyNonce)); retVal = aniEapolWriteKey(fsm->cryptHandle, fsm->lastEapol, fsm->staCtx->suppMac, fsm->staCtx->authMac, ANI_EAPOL_KEY_DESC_TYPE_RSN_NEW, &txDesc, NULL, 0); if( !ANI_IS_STATUS_SUCCESS( retVal ) ) { return retVal; } #if 0 } else { retransmit = eANI_BOOLEAN_TRUE; } #endif if( VOS_IS_STATUS_SUCCESS( bapRsnSendEapolFrame( fsm->ctx->pvosGCtx, fsm->lastEapol ) ) ) { retVal = ANI_OK; } else { //we fail to send the eapol frame disconnect bapAuthDisconnect( fsm->ctx ); retVal = ANI_ERROR; } return retVal; }
int wlan_logging_sock_activate_svc(int log_fe_to_console, int num_buf) { int i = 0; unsigned long irq_flag; pr_info("%s: Initalizing FEConsoleLog = %d NumBuff = %d\n", __func__, log_fe_to_console, num_buf); gapp_pid = INVALID_PID; gplog_msg = (struct log_msg *) vmalloc( num_buf * sizeof(struct log_msg)); if (!gplog_msg) { pr_err("%s: Could not allocate memory\n", __func__); return -ENOMEM; } vos_mem_zero(gplog_msg, (num_buf * sizeof(struct log_msg))); gwlan_logging.log_fe_to_console = !!log_fe_to_console; gwlan_logging.num_buf = num_buf; spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag); INIT_LIST_HEAD(&gwlan_logging.free_list); INIT_LIST_HEAD(&gwlan_logging.filled_list); for (i = 0; i < num_buf; i++) { list_add(&gplog_msg[i].node, &gwlan_logging.free_list); gplog_msg[i].index = i; } gwlan_logging.pcur_node = (struct log_msg *) (gwlan_logging.free_list.next); list_del_init(gwlan_logging.free_list.next); spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag); init_waitqueue_head(&gwlan_logging.wait_queue); gwlan_logging.exit = false; clear_bit(HOST_LOG_DRIVER_MSG, &gwlan_logging.eventFlag); clear_bit(HOST_LOG_PER_PKT_STATS, &gwlan_logging.eventFlag); clear_bit(HOST_LOG_FW_FLUSH_COMPLETE, &gwlan_logging.eventFlag); init_completion(&gwlan_logging.shutdown_comp); gwlan_logging.thread = kthread_create(wlan_logging_thread, NULL, "wlan_logging_thread"); if (IS_ERR(gwlan_logging.thread)) { pr_err("%s: Could not Create LogMsg Thread Controller", __func__); spin_lock_irqsave(&gwlan_logging.spin_lock, irq_flag); gwlan_logging.pcur_node = NULL; spin_unlock_irqrestore(&gwlan_logging.spin_lock, irq_flag); vfree(gplog_msg); gplog_msg = NULL; return -ENOMEM; } wake_up_process(gwlan_logging.thread); gwlan_logging.is_active = true; gwlan_logging.is_flush_complete = false; nl_srv_register(ANI_NL_MSG_LOG, wlan_logging_proc_sock_rx_msg); pr_info("%s: Activated wlan_logging svc\n", __func__); return 0; }