/** * * * \b Description: * * This function is called once SwitchChannel command was received and the SCR * request returned with reason RUN. * In this case perform the following: * Set CMD to FW * * \b ARGS: * * I - pData - pointer to the SwitchChannel SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * *************************************************************************/ static TI_STATUS switchChannel_smStartSwitchChannelCmd(void *pData) { switchChannel_t *pSwitchChannel = (switchChannel_t *)pData; TSwitchChannelParams pSwitchChannelCmd; TI_UINT32 switchChannelTimeDuration; paramInfo_t param; if (pSwitchChannel == NULL) { return TI_NOK; } param.paramType = SITE_MGR_BEACON_INTERVAL_PARAM; siteMgr_getParam(pSwitchChannel->hSiteMgr, ¶m); switchChannelTimeDuration = pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount * param.content.beaconInterval * 1024 / 1000; if ( (switchChannelTimeDuration!=0) && ((os_timeStampMs(pSwitchChannel->hOs) - pSwitchChannel->SCRRequestTimestamp) >= switchChannelTimeDuration )) { /* There's no time to perfrom the SCC, set the Count to 1 */ pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount = 1; } apConn_indicateSwitchChannelInProgress(pSwitchChannel->hApConn); pSwitchChannelCmd.channelNumber = pSwitchChannel->curChannelSwitchCmdParams.channelNumber; pSwitchChannelCmd.switchTime = pSwitchChannel->curChannelSwitchCmdParams.channelSwitchCount; pSwitchChannelCmd.txFlag = pSwitchChannel->curChannelSwitchCmdParams.channelSwitchMode; pSwitchChannelCmd.flush = 0; TWD_CmdSwitchChannel (pSwitchChannel->hTWD, &pSwitchChannelCmd); return TI_OK; }
static TI_STATUS JoinWait_to_mlmeWait(void *pData) { TI_STATUS status; paramInfo_t *pParam; conn_t *pConn = (conn_t *)pData; pParam = (paramInfo_t *)os_memoryAlloc(pConn->hOs, sizeof(paramInfo_t)); if (!pParam) { return TI_NOK; } /* Set the BA session policies to the FW */ qosMngr_SetBaPolicies(pConn->hQosMngr); pParam->paramType = SITE_MGR_CURRENT_CHANNEL_PARAM; siteMgr_getParam(pConn->hSiteMgr, pParam); pParam->paramType = REGULATORY_DOMAIN_TX_POWER_AFTER_SELECTION_PARAM; pParam->content.channel = pParam->content.siteMgrCurrentChannel; regulatoryDomain_setParam(pConn->hRegulatoryDomain, pParam); pParam->paramType = RX_DATA_PORT_STATUS_PARAM; pParam->content.rxDataPortStatus = OPEN_NOTIFY; status = rxData_setParam(pConn->hRxData, pParam); if (status != TI_OK) { TRACE1( pConn->hReport, REPORT_SEVERITY_FATAL_ERROR, "JoinWait_to_mlmeWait: rxData_setParam return 0x%x.\n", status); os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); return status; } /* Update TxMgmtQueue SM to open Tx path only for Mgmt packets. */ txMgmtQ_SetConnState (((conn_t *)pData)->hTxMgmtQ, TX_CONN_STATE_MGMT); /* * Set the reassociation flag in the association logic. */ pParam->paramType = MLME_RE_ASSOC_PARAM; if( pConn->connType == CONN_TYPE_ROAM ) { pParam->content.mlmeReAssoc = TI_TRUE; } else { pParam->content.mlmeReAssoc = TI_FALSE; } status = mlme_setParam(pConn->hMlme, pParam); if (status != TI_OK) { TRACE1( pConn->hReport, REPORT_SEVERITY_FATAL_ERROR, "JoinWait_to_mlmeWait: mlme_setParam return 0x%x.\n", status); } os_memoryFree(pConn->hOs, pParam, sizeof(paramInfo_t)); /* TODO - YD - check the association type and then start mlme */ return mlme_start(pConn->hMlme, pConn->connType); }
/** * \fn mlme_assocSSIDBuild * \brief builds the SSID IE of assoc request * * builds the SSID IE of assoc request according to the mlme params * * \param pCtx - pointer to mlme_t * \param pSSID - <output> pointer to the built SSID buffer * \param ssidLen - <output> length of the built SSID buffer * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_assocRequestMsgBuild */ TI_STATUS mlme_assocSSIDBuild(mlme_t *pCtx, TI_UINT8 *pSSID, TI_UINT32 *ssidLen) { paramInfo_t param; TI_STATUS status; dot11_SSID_t *pDot11Ssid; pDot11Ssid = (dot11_SSID_t*)pSSID; /* set SSID element id */ pDot11Ssid->hdr[0] = SSID_IE_ID; /* get SSID */ param.paramType = SME_DESIRED_SSID_ACT_PARAM; status = sme_GetParam(pCtx->hSme, ¶m); if (status != TI_OK) { return status; } /* check for ANY ssid */ if (param.content.smeDesiredSSID.len != 0) { pDot11Ssid->hdr[1] = param.content.smeDesiredSSID.len; os_memoryCopy(pCtx->hOs, (void *)pDot11Ssid->serviceSetId, (void *)param.content.smeDesiredSSID.str, param.content.smeDesiredSSID.len); } else { /* if ANY ssid is configured, use the current SSID */ param.paramType = SITE_MGR_CURRENT_SSID_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status != TI_OK) { return status; } pDot11Ssid->hdr[1] = param.content.siteMgrCurrentSSID.len; os_memoryCopy(pCtx->hOs, (void *)pDot11Ssid->serviceSetId, (void *)param.content.siteMgrCurrentSSID.str, param.content.siteMgrCurrentSSID.len); } *ssidLen = pDot11Ssid->hdr[1] + sizeof(dot11_eleHdr_t); return TI_OK; }
/** * * * \b Description: * * This function is called when the station becomes connected. * update the current channel. * * \b ARGS: * * I - pData - pointer to the SwitchChannel SM context \n * * \b RETURNS: * * TI_OK if successful, TI_NOK otherwise. * * *************************************************************************/ static TI_STATUS switchChannel_smStart(void *pData) { switchChannel_t *pSwitchChannel = (switchChannel_t*)pData; paramInfo_t param; if (pSwitchChannel == NULL) { return TI_NOK; } /* get the current channel number */ param.paramType = SITE_MGR_CURRENT_CHANNEL_PARAM; siteMgr_getParam(pSwitchChannel->hSiteMgr, ¶m); pSwitchChannel->currentChannel = param.content.siteMgrCurrentChannel; return TI_OK; }
/** * Checks whether the given measurement request is valid. * * @param hMeasurementMgr A handle to the Measurement Manager module. * @param pRequestArr The measurement request. * @param numOfRequest Number of type requests * * @return True iff the request is valid * * @date 01-Jan-2006 */ static TI_BOOL measurementMgr_isRequestValid(TI_HANDLE hMeasurementMgr, MeasurementRequest_t *pRequestArr[], TI_UINT8 numOfRequest) { measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) hMeasurementMgr; TI_UINT8 requestIndex; paramInfo_t param; /* Checking validity of the measured channel number */ param.content.channel = pRequestArr[0]->channelNumber; param.paramType = REGULATORY_DOMAIN_IS_CHANNEL_SUPPORTED; regulatoryDomain_getParam(pMeasurementMgr->hRegulatoryDomain, ¶m); if ( !param.content.bIsChannelSupprted ) { if (pMeasurementMgr->currentFrameType == MSR_FRAME_TYPE_UNICAST) pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequest, MSR_REJECT_INVALID_CHANNEL); return TI_FALSE; } /* Check Validity of each request */ for (requestIndex = 0; requestIndex < numOfRequest; requestIndex++) { /* Checking validity of the Request Type */ if (pMeasurementMgr->isTypeValid(hMeasurementMgr, pRequestArr[requestIndex]->Type, pRequestArr[requestIndex]->ScanMode) == TI_FALSE) { if(pMeasurementMgr->currentFrameType == MSR_FRAME_TYPE_UNICAST) pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequest, MSR_REJECT_INVALID_MEASUREMENT_TYPE); return TI_FALSE; } /* For measurement types different than Beacon Table */ if ((pRequestArr[requestIndex]->Type != MSR_TYPE_BEACON_MEASUREMENT) || (pRequestArr[requestIndex]->ScanMode != MSR_SCAN_MODE_BEACON_TABLE)) { /* Checking Measurement request's duration only when request is on a non-serving channel */ if (pMeasurementMgr->servingChannelID != pRequestArr[requestIndex]->channelNumber) { TI_UINT8 dtimPeriod; TI_UINT32 beaconInterval; TI_UINT32 dtimDuration; /* Checking duration doesn't exceed given max duration */ if (pRequestArr[requestIndex]->DurationTime > pMeasurementMgr->maxDurationOnNonServingChannel) { if (pMeasurementMgr->currentFrameType == MSR_FRAME_TYPE_UNICAST) pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequest, MSR_REJECT_DURATION_EXCEED_MAX_DURATION); return TI_FALSE; } /* Checking DTIM */ /* Getting the DTIM count */ param.paramType = SITE_MGR_DTIM_PERIOD_PARAM; siteMgr_getParam(pMeasurementMgr->hSiteMgr, ¶m); dtimPeriod = param.content.siteMgrDtimPeriod; /* Getting the beacon Interval */ param.paramType = SITE_MGR_BEACON_INTERVAL_PARAM; siteMgr_getParam(pMeasurementMgr->hSiteMgr, ¶m); beaconInterval = param.content.beaconInterval; dtimDuration = beaconInterval * MEASUREMENT_BEACON_INTERVAL_IN_MICRO_SEC/MEASUREMENT_MSEC_IN_MICRO*dtimPeriod; if (pRequestArr[requestIndex]->DurationTime > dtimDuration) { if (pMeasurementMgr->currentFrameType == MSR_FRAME_TYPE_UNICAST) pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequest, MSR_REJECT_DTIM_OVERLAP); return TI_FALSE; } } } } return TI_TRUE; }
/** * \fn mlme_assocCapBuild * \brief builds capabilties of assoc request * * builds capabilties of assoc request according to the mlme params * * \param pCtx - pointer to mlme_t * \param cap - <output> pointer to the built capablities * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_assocRequestMsgBuild */ TI_STATUS mlme_assocCapBuild(mlme_t *pCtx, TI_UINT16 *cap) { paramInfo_t param; TI_STATUS status; EDot11Mode mode; TI_UINT32 rateSuppMask, rateBasicMask; TI_UINT8 ratesBuf[DOT11_MAX_SUPPORTED_RATES]; TI_UINT32 len = 0, ofdmIndex = 0; TI_BOOL b11nEnable, bWmeEnable; *cap = 0; /* Bss type */ param.paramType = CTRL_DATA_CURRENT_BSS_TYPE_PARAM; status = ctrlData_getParam(pCtx->hCtrlData, ¶m); if (status == TI_OK) { if (param.content.ctrlDataCurrentBssType == BSS_INFRASTRUCTURE) { *cap |= DOT11_CAPS_ESS; } else { *cap |= DOT11_CAPS_IBSS; } } else { return TI_NOK; } /* Privacy */ param.paramType = RSN_ENCRYPTION_STATUS_PARAM; status = rsn_getParam(pCtx->hRsn, ¶m); if (status == TI_OK) { if (param.content.rsnEncryptionStatus != TWD_CIPHER_NONE) { *cap |= DOT11_CAPS_PRIVACY; } } else { return TI_NOK; } /* Preamble */ param.paramType = SITE_MGR_DESIRED_PREAMBLE_TYPE_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status == TI_OK) { if (param.content.siteMgrCurrentPreambleType == PREAMBLE_SHORT) *cap |= DOT11_CAPS_SHORT_PREAMBLE; } else { return TI_NOK; } /* Pbcc */ param.paramType = SITE_MGR_CURRENT_RATE_PAIR_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status == TI_OK) { if(param.content.siteMgrCurrentRateMask.supportedRateMask & DRV_RATE_MASK_22_PBCC) *cap |= DOT11_CAPS_PBCC; } else { return TI_NOK; } /* Checking if the station supports Spectrum Management (802.11h) */ param.paramType = REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM; status = regulatoryDomain_getParam(pCtx->hRegulatoryDomain, ¶m); if (status == TI_OK ) { if( param.content.spectrumManagementEnabled) *cap |= DOT11_SPECTRUM_MANAGEMENT; } else { return TI_NOK; } /* slot time */ param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if(status == TI_OK) { mode = param.content.siteMgrDot11OperationalMode; } else return TI_NOK; if(mode == DOT11_G_MODE) { /* new requirement: the short slot time should be set only if the AP's modulation is OFDM (highest rate) */ /* get Rates */ param.paramType = SITE_MGR_CURRENT_RATE_PAIR_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status == TI_OK) { rateBasicMask = param.content.siteMgrCurrentRateMask.basicRateMask; rateSuppMask = param.content.siteMgrCurrentRateMask.supportedRateMask; } else { return TI_NOK; } /* convert the bit map to the rates array */ rate_DrvBitmapToNetStr (rateSuppMask, rateBasicMask, ratesBuf, &len, &ofdmIndex); if(ofdmIndex < len) *cap |= DOT11_CAPS_SHORT_SLOT_TIME; /* param.paramType = SITE_MGR_CURRENT_MODULATION_TYPE_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if(param.content.siteMgrCurrentModulationType == DRV_MODULATION_OFDM) *cap |= DOT11_CAPS_SHORT_SLOT_TIME; */ } /* Primary Site support HT ? */ param.paramType = SITE_MGR_PRIMARY_SITE_HT_SUPPORT; siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (param.content.bPrimarySiteHtSupport == TI_TRUE) { /* Immediate Block Ack subfield - (is WME on?) AND (is HT Enable?) */ /* verify 11n_Enable and Chip type */ StaCap_IsHtEnable (pCtx->hStaCap, &b11nEnable); /* verify that WME flag enable */ qosMngr_GetWmeEnableFlag (pCtx->hQosMngr, &bWmeEnable); if ((b11nEnable != TI_FALSE) && (bWmeEnable != TI_FALSE)) { *cap |= DOT11_CAPS_IMMEDIATE_BA; } } return TI_OK; }
/** * \fn mlme_assocRequestMsgBuild * \brief buils association request * * The function builds the association request according to the given parames * * \param pCtx - pointer to mlme_t * \param reqBuf - <output> pointer to built assoc request buffer * \param reqLen - <output> length of built assoc request buffer * * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_sendAssocRequest */ TI_STATUS mlme_assocRequestMsgBuild(mlme_t *pCtx, TI_UINT8* reqBuf, TI_UINT32* reqLen) { TI_STATUS status; TI_UINT8 *pRequest; TI_UINT32 len; paramInfo_t param; TTwdParamInfo tTwdParam; TI_UINT16 capabilities; TI_BOOL spectrumManagementEnabled; ECipherSuite eCipherSuite = TWD_CIPHER_NONE; /* To be used for checking whether AP supports HT rates and TKIP */ pRequest = reqBuf; *reqLen = 0; /* insert capabilities */ status = mlme_assocCapBuild(pCtx, &capabilities); if (status == TI_OK) { *(TI_UINT16*)pRequest = ENDIAN_HANDLE_WORD(capabilities); } else { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build assoc Capa\n"); return TI_NOK; } pRequest += sizeof(TI_UINT16); *reqLen += sizeof(TI_UINT16); /* insert listen interval */ tTwdParam.paramType = TWD_LISTEN_INTERVAL_PARAM_ID; status = TWD_GetParam (pCtx->hTWD, &tTwdParam); if (status == TI_OK) { *(TI_UINT16*)pRequest = ENDIAN_HANDLE_WORD((TI_UINT16)tTwdParam.content.halCtrlListenInterval); } else { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to get listen interval\n"); return TI_NOK; } pRequest += sizeof(TI_UINT16); *reqLen += sizeof(TI_UINT16); if (pCtx->reAssoc) { /* Insert currentAPAddress element only in reassoc request*/ param.paramType = SITE_MGR_PREV_SITE_BSSID_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status == TI_OK) { MAC_COPY (pRequest, param.content.siteMgrDesiredBSSID); TRACE6(pCtx->hReport, REPORT_SEVERITY_INFORMATION, "ASSOC_SM: ASSOC_REQ - prev AP = %x-%x-%x-%x-%x-%x\n", param.content.siteMgrDesiredBSSID[0], param.content.siteMgrDesiredBSSID[1], param.content.siteMgrDesiredBSSID[2], param.content.siteMgrDesiredBSSID[3], param.content.siteMgrDesiredBSSID[4], param.content.siteMgrDesiredBSSID[5]); pRequest += MAC_ADDR_LEN; *reqLen += MAC_ADDR_LEN; } else { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: ASSOC_REQ - No prev AP \n"); return status; } } /* insert SSID element */ status = mlme_assocSSIDBuild(pCtx, pRequest, &len); if (status != TI_OK) { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build SSID IE\n"); return TI_NOK; } pRequest += len; *reqLen += len; /* insert Rates element */ status = mlme_assocRatesBuild(pCtx, pRequest, &len); if (status != TI_OK) { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build rates IE\n"); return TI_NOK; } pRequest += len; *reqLen += len; /* Checking if the station supports Spectrum Management (802.11h) */ param.paramType = REGULATORY_DOMAIN_MANAGEMENT_CAPABILITY_ENABLED_PARAM; status = regulatoryDomain_getParam(pCtx->hRegulatoryDomain,¶m); spectrumManagementEnabled = param.content.spectrumManagementEnabled; /* Checking the selected AP capablities */ param.paramType = SITE_MGR_SITE_CAPABILITY_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr,¶m); if (status == TI_OK && spectrumManagementEnabled && param.content.siteMgrSiteCapability & (DOT11_SPECTRUM_MANAGEMENT != 0)) { /* insert Power capability element */ status = mlme_assocPowerCapabilityBuild(pCtx, pRequest, &len); if (status != TI_OK) { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build Power IE\n"); return TI_NOK; } pRequest += len; *reqLen += len; } #ifdef XCC_MODULE_INCLUDED status = rsn_getXCCExtendedInfoElement(pCtx->hRsn, pRequest, (TI_UINT8*)&len); if (status != TI_OK) { return TI_NOK; } pRequest += len; *reqLen += len; if (pCtx->reAssoc) { /* insert CCKM information element only in reassoc */ status = XCCMngr_getCckmInfoElement(pCtx->hXCCMngr, pRequest, (TI_UINT8*)&len); if (status != TI_OK) { return TI_NOK; } pRequest += len; *reqLen += len; } status = XCCMngr_getXCCVersionInfoElement(pCtx->hXCCMngr, pRequest, (TI_UINT8*)&len); if (status != TI_OK) { return TI_NOK; } pRequest += len; *reqLen += len; /* Insert Radio Mngt Capability IE */ status = measurementMgr_radioMngtCapabilityBuild(pCtx->hMeasurementMgr, pRequest, (TI_UINT8*)&len); if (status != TI_OK) { return TI_NOK; } pRequest += len; *reqLen += len; #endif /* Get Simple-Config state */ param.paramType = SITE_MGR_SIMPLE_CONFIG_MODE; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (param.content.siteMgrWSCMode.WSCMode == TIWLN_SIMPLE_CONFIG_OFF) { /* insert RSN information elements */ status = rsn_getInfoElement(pCtx->hRsn, pRequest, &len); if (status != TI_OK) { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build RSN IE\n"); return TI_NOK; } pRequest += len; *reqLen += len; } /* Privacy - Used later on HT */ param.paramType = RSN_ENCRYPTION_STATUS_PARAM; status = rsn_getParam(pCtx->hRsn, ¶m); if(status == TI_OK) { eCipherSuite = param.content.rsnEncryptionStatus; } /* insert QoS capability information element */ status = qosMngr_getQosCapabiltyInfeElement(pCtx->hQosMngr,pRequest,&len); if (status != TI_OK) { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build QoS capa IE\n"); return TI_NOK; } pRequest += len; *reqLen += len; /* Primary Site support HT ? */ param.paramType = SITE_MGR_PRIMARY_SITE_HT_SUPPORT; siteMgr_getParam(pCtx->hSiteMgr, ¶m); /* Disallow TKIP with HT Rates: If this is the case - discard HT rates from Association Request */ if((TI_TRUE == param.content.bPrimarySiteHtSupport) && (eCipherSuite != TWD_CIPHER_TKIP)) { status = StaCap_GetHtCapabilitiesIe (pCtx->hStaCap, pRequest, &len); if (status != TI_OK) { return TI_NOK; } pRequest += len; *reqLen += len; } status = qosMngr_assocReqBuild(pCtx->hQosMngr,pRequest,&len); if (status != TI_OK) { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build QoS IE\n"); return TI_NOK; } pRequest += len; *reqLen += len; status = apConn_getVendorSpecificIE(pCtx->hApConn, pRequest, &len); if (status != TI_OK) { TRACE0(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build vendor IE\n"); return TI_NOK; } pRequest += len; *reqLen += len; if (*reqLen>=MAX_ASSOC_MSG_LENGTH) { TRACE1(pCtx->hReport, REPORT_SEVERITY_ERROR, "mlme_assocRequestMsgBuild: failed to build, reqLen = %u\n", *reqLen); return TI_NOK; } return TI_OK; }
/** * \fn mlme_assocRatesBuild * \brief builds the rates IE of assoc request * * builds the rates IE of assoc request according to the mlme params * * \param pCtx - pointer to mlme_t * \param pRates - <output> pointer to the built rates buffer * \param ratesLen - <output> length of the built rates buffer * \return TI_OK if auth send successfully * TI_NOK otherwise * * \sa mlme_assocRequestMsgBuild */ TI_STATUS mlme_assocRatesBuild(mlme_t *pCtx, TI_UINT8 *pRates, TI_UINT32 *ratesLen) { paramInfo_t param; TI_STATUS status; TI_UINT32 rateSuppMask, rateBasicMask; dot11_RATES_t *pDot11Rates; TI_UINT32 len = 0, ofdmIndex = 0; TI_UINT8 ratesBuf[DOT11_MAX_SUPPORTED_RATES]; EDot11Mode mode; TI_UINT32 suppRatesLen, extSuppRatesLen, i; pDot11Rates = (dot11_RATES_t*)pRates; /* get Rates */ param.paramType = SITE_MGR_CURRENT_RATE_PAIR_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if (status == TI_OK) { rateBasicMask = param.content.siteMgrCurrentRateMask.basicRateMask; rateSuppMask = param.content.siteMgrCurrentRateMask.supportedRateMask; } else { return TI_NOK; } /* get operational mode */ param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM; status = siteMgr_getParam(pCtx->hSiteMgr, ¶m); if(status == TI_OK) mode = param.content.siteMgrDot11OperationalMode; else return TI_NOK; /* convert the bit map to the rates array */ /* remove MCS rates from Extended Supported Rates IE */ rateSuppMask &= ~(DRV_RATE_MASK_MCS_0_OFDM | DRV_RATE_MASK_MCS_1_OFDM | DRV_RATE_MASK_MCS_2_OFDM | DRV_RATE_MASK_MCS_3_OFDM | DRV_RATE_MASK_MCS_4_OFDM | DRV_RATE_MASK_MCS_5_OFDM | DRV_RATE_MASK_MCS_6_OFDM | DRV_RATE_MASK_MCS_7_OFDM ); rate_DrvBitmapToNetStr (rateSuppMask, rateBasicMask, ratesBuf, &len, &ofdmIndex); if(mode != DOT11_G_MODE || ofdmIndex == len ) { pDot11Rates->hdr[0] = SUPPORTED_RATES_IE_ID; pDot11Rates->hdr[1] = len; os_memoryCopy(NULL, (void *)pDot11Rates->rates, ratesBuf, len); *ratesLen = pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); } else { /* fill in the supported rates */ pDot11Rates->hdr[0] = SUPPORTED_RATES_IE_ID; pDot11Rates->hdr[1] = ofdmIndex; os_memoryCopy(NULL, (void *)pDot11Rates->rates, ratesBuf, pDot11Rates->hdr[1]); suppRatesLen = pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); /* fill in the extended supported rates */ pDot11Rates = (dot11_RATES_t*)(pRates + suppRatesLen); pDot11Rates->hdr[0] = EXT_SUPPORTED_RATES_IE_ID; pDot11Rates->hdr[1] = len - ofdmIndex; os_memoryCopy(NULL, (void *)pDot11Rates->rates, &ratesBuf[ofdmIndex], pDot11Rates->hdr[1]); extSuppRatesLen = pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t); *ratesLen = suppRatesLen + extSuppRatesLen; } TRACE3(pCtx->hReport, REPORT_SEVERITY_INFORMATION, "ASSOC_SM: ASSOC_REQ - bitmapSupp= 0x%X,bitMapBasic = 0x%X, len = %d\n", rateSuppMask,rateBasicMask,len); for(i=0; i<len; i++) { TRACE2(pCtx->hReport, REPORT_SEVERITY_INFORMATION, "ASSOC_SM: ASSOC_REQ - ratesBuf[%d] = 0x%X\n", i, ratesBuf[i]); } return TI_OK; }
/** * \fn scanResultTable_UpdateSiteData * \brief Update a site entry data from a received frame (beacon or probe response) * * Update a site entry data from a received frame (beacon or probe response) * * \param hScanResultTable - handle to the scan result table object * \param pSite - the site entry to update * \param pFrame - the received frame information * \return None */ void scanResultTable_UpdateSiteData (TI_HANDLE hScanResultTable, TSiteEntry *pSite, TScanFrameInfo *pFrame) { TScanResultTable *pScanResultTable = (TScanResultTable*)hScanResultTable; paramInfo_t param; UPDATE_BSSID (pSite, pFrame); UPDATE_BAND (pSite, pFrame); UPDATE_BEACON_INTERVAL (pSite, pFrame); UPDATE_CAPABILITIES (pSite, pFrame); UPDATE_SSID (pScanResultTable, pSite, pFrame); UPDATE_PRIVACY (pSite, pFrame); UPDATE_RSN_IE (pScanResultTable, pSite, pFrame->parsedIEs->content.iePacket.pRsnIe, pFrame->parsedIEs->content.iePacket.rsnIeLen); UPDATE_APSD (pSite, pFrame); UPDATE_PREAMBLE (pSite, pFrame); UPDATE_AGILITY (pSite, pFrame); UPDATE_RSSI (pSite, pFrame); UPDATE_SNR (pSite, pFrame); UPDATE_RATE (pSite, pFrame); UPDATE_UNKOWN_IE(pScanResultTable, pSite, pFrame->parsedIEs->content.iePacket.pUnknownIe, pFrame->parsedIEs->content.iePacket.unknownIeLen ); param.paramType = SITE_MGR_OPERATIONAL_MODE_PARAM; siteMgr_getParam (pScanResultTable->hSiteMgr, ¶m); if (param.content.siteMgrDot11OperationalMode == DOT11_G_MODE) { UPDATE_SLOT_TIME (pSite, pFrame); UPDATE_PROTECTION (pSite, pFrame); } scanResultTable_updateRates (hScanResultTable, pSite, pFrame); if ((pFrame->parsedIEs->content.iePacket.pDSParamsSet != NULL) && (pFrame->parsedIEs->content.iePacket.pDSParamsSet->currChannel != pFrame->channel)) { } else UPDATE_CHANNEL (pSite, pFrame , pFrame->channel); UPDATE_BSS_TYPE (pSite, pFrame); UPDATE_ATIM_WINDOW (pSite, pFrame); UPDATE_AP_TX_POWER (pSite, pFrame); UPDATE_QOS (pSite, pFrame); UPDATE_BEACON_TIMESTAMP (pScanResultTable, pSite, pFrame); scanResultTable_UpdateWSCParams (pSite, pFrame); siteMgr_UpdatHtParams (pScanResultTable->hSiteMgr, pSite, pFrame->parsedIEs); if (BEACON == pFrame->parsedIEs->subType) { /* DTIM is only available in beacons */ if (pSite->bssType == BSS_INFRASTRUCTURE) { UPDATE_DTIM_PERIOD (pSite, pFrame); } UPDATE_BEACON_MODULATION (pSite, pFrame); /* If the BSS type is independent, the beacon & probe modulation are equal, It is important to update this field here for dynamic PBCC algorithm compatibility */ if (pSite->bssType == BSS_INDEPENDENT) { UPDATE_PROBE_MODULATION (pSite, pFrame); } UPDATE_BEACON_RECV (pSite); UPDATE_FRAME_BUFFER (pScanResultTable, (pSite->beaconBuffer), (pSite->beaconLength), pFrame); } else if (PROBE_RESPONSE == pFrame->parsedIEs->subType) { UPDATE_PROBE_MODULATION (pSite, pFrame); /* If the BSS type is independent, the beacon & probe modulation are equal, It is important to update this field here for dynamic PBCC algorithm compatibility */ if (pSite->bssType == BSS_INDEPENDENT) UPDATE_BEACON_MODULATION (pSite, pFrame); UPDATE_PROBE_RECV (pSite); UPDATE_FRAME_BUFFER (pScanResultTable, (pSite->probeRespBuffer), (pSite->probeRespLength), pFrame); } }
/** * Called when the SM is in an idle state and we receive a new measurement frame. * * @date 05-Jan-2006 */ static TI_STATUS measurementMgrSM_acFrameReceived_fromIdle(void * pData) { measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) pData; TI_UINT16 activationDelay; TI_STATUS status; paramInfo_t param; TI_UINT16 tbtt; /* handle frame request only if we're connected and measurement is enabled */ if (pMeasurementMgr->Connected == TI_FALSE || pMeasurementMgr->Enabled == TI_FALSE) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_ERROR, ": Frame received while SM is in disconnected/disabled state\n"); return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState), MEASUREMENTMGR_EVENT_ABORT, pMeasurementMgr); } /* Setting the frame Type */ pMeasurementMgr->currentFrameType = pMeasurementMgr->newFrameRequest.frameType; TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Frame Type = %d\n", pMeasurementMgr->currentFrameType); /* Getting the Beacon Interval from the Site Mgr */ param.paramType = SITE_MGR_BEACON_INTERVAL_PARAM; status = siteMgr_getParam(pMeasurementMgr->hSiteMgr, ¶m); if (status != TI_OK) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_ERROR, ": Failed to retrieve beacon interval - not connected?\n"); return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState), MEASUREMENTMGR_EVENT_ABORT, pMeasurementMgr); } /* converting beacon interval to msec */ tbtt = (param.content.beaconInterval * 1024) / 1000; /* from TU to msec */ /* Initializing Activation Delay Time */ activationDelay = pMeasurementMgr->newFrameRequest.hdr->activatioDelay; activationDelay *= tbtt; /* Adding the Measurement Offset to the activation delay */ activationDelay += pMeasurementMgr->newFrameRequest.hdr->measurementOffset; /* Inserting all received measurement requests into the queue */ status = requestHandler_insertRequests(pMeasurementMgr->hRequestH, pMeasurementMgr->Mode, pMeasurementMgr->newFrameRequest); /* Clean New Frame Params */ os_memoryZero(pMeasurementMgr->hOs, &pMeasurementMgr->newFrameRequest, sizeof(TMeasurementFrameRequest)); if (status != TI_OK) { pMeasurementMgr->currentFrameType = MSR_FRAME_TYPE_NO_ACTIVE; TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_ERROR, ": Could not insert request into the queue\n"); return measurementMgrSM_event((TI_UINT8 *) &(pMeasurementMgr->currentState), MEASUREMENTMGR_EVENT_ABORT, pMeasurementMgr); } TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": New frame has been inserted into the queue\n"); /* If frame type isn't Unicast add to Activation Delay a random delay */ if ((pMeasurementMgr->currentFrameType != MSR_FRAME_TYPE_UNICAST) && (activationDelay > 0)) { activationDelay += ((os_timeStampMs(pMeasurementMgr->hOs) % MSR_ACTIVATION_DELAY_RANDOM) + MSR_ACTIVATION_DELAY_OFFSET); } TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Activation Delay in ms = %d\n", activationDelay); if (activationDelay > 0) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Going to wait for activation delay timer callback\n"); /* Starting the Activation Delay Timer */ tmr_StartTimer (pMeasurementMgr->hActivationDelayTimer, measurementMgrSM_uponActivationDelayTimeout, (TI_HANDLE)pMeasurementMgr, activationDelay, TI_FALSE); return TI_OK; } else { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Activating the next request immediately without waiting for callback\n"); /* Calling to schedule the first waiting request */ return measurementMgr_activateNextRequest(pData); } }
/** * Performs the required action when the Measurement Manager module has * been advised that the station has connected to an AP. * * @date 05-Jan-2006 */ static TI_STATUS measurementMgrSM_acConnected(void * pData) { measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) pData; paramInfo_t param; #ifdef XCC_MODULE_INCLUDED iappParsingRegistrationTable_t iappParsingRegistration; #endif /* do nothing if we're already in connected mode */ if (pMeasurementMgr->Connected) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Connected flag already set\n"); return TI_OK; } pMeasurementMgr->Connected = TI_TRUE; TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Connected flag has been set\n"); /* get the current serving channel */ param.paramType = SITE_MGR_CURRENT_CHANNEL_PARAM; siteMgr_getParam(pMeasurementMgr->hSiteMgr, ¶m); pMeasurementMgr->servingChannelID = param.content.siteMgrCurrentChannel; #ifdef XCC_MODULE_INCLUDED if(pMeasurementMgr->Mode == MSR_MODE_XCC) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": MeasurementMgr set to XCC mode\n"); if(pMeasurementMgr->isModuleRegistered == TI_FALSE) { /* Registering to the XCCMngr */ iappParsingRegistration.handler = pMeasurementMgr; iappParsingRegistration.iappParsingRegistrationProcedure = measurementMgr_XCCParse; if (XCCMngr_registerForRecvIappPacket(pMeasurementMgr->hXCCMngr, iappParsingRegistration, IAPP_RADIO_MEASUREMENT) != TI_OK) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_WARNING, ": Could not register to receive IAPP packets\n"); return TI_NOK; } pMeasurementMgr->isModuleRegistered = TI_TRUE; } pMeasurementMgr->parserFrameReq = measurementMgr_XCCParseFrameReq; pMeasurementMgr->isTypeValid = measurementMgr_XCCIsTypeValid; pMeasurementMgr->buildReport = measurementMgr_XCCBuildReport; pMeasurementMgr->buildRejectReport = measurementMgr_XCCBuildRejectReport; pMeasurementMgr->sendReportAndCleanObj = measurementMgr_XCCSendReportAndCleanObject; requestHandler_setRequestParserFunction(pMeasurementMgr->hRequestH, measurementMgr_XCCParseRequestIEHdr); } else #endif { if(pMeasurementMgr->Mode == MSR_MODE_SPECTRUM_MANAGEMENT) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": MeasurementMgr set to Spectrum Management mode\n"); /* NOTE: These 5 functions need to be corrected to fit the 802.11h standered */ pMeasurementMgr->parserFrameReq = measurementMgr_dot11hParseFrameReq; pMeasurementMgr->isTypeValid = measurementMgr_dot11hIsTypeValid; pMeasurementMgr->buildReport = measurementMgr_dot11hBuildReport; pMeasurementMgr->buildRejectReport = measurementMgr_dot11hBuildRejectReport; pMeasurementMgr->sendReportAndCleanObj = measurementMgr_dot11hSendReportAndCleanObject; requestHandler_setRequestParserFunction(pMeasurementMgr->hRequestH, measurementMgr_dot11hParseRequestIEHdr); } } return TI_OK; }
/** * \fn smeSm_PreConnect * \brief Initiates the connection process * * Initiates the connection process - for automatic mode, start scan, for manual mode - triggers connection * * \param hSme - handle to the SME object * \return None * \sa smeSm_Connect, smeSm_ConnectSuccess */ void smeSm_PreConnect (TI_HANDLE hSme) { TSme *pSme = (TSme *)hSme; paramInfo_t *pParam; /* set the connection mode with which this connection attempt is starting */ pSme->eLastConnectMode = pSme->eConnectMode; /* mark that no authentication/assocaition was yet sent */ pSme->bAuthSent = TI_FALSE; /* try to find a connection candidate (manual mode have already performed scann */ pSme->pCandidate = sme_Select (hSme); if (NULL != pSme->pCandidate) { /* candidate is available - attempt connection */ sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } /* no candidate */ else { if (CONNECT_MODE_AUTO == pSme->eConnectMode) { /* automatic mode - start scanning */ if (TI_OK != sme_StartScan (hSme)) { pSme->bRadioOn = TI_FALSE; sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } /* update scan count counter */ if (pSme->uScanCount < PERIODIC_SCAN_MAX_INTERVAL_NUM) { pSme->uScanCount++; } } else { /* Manual mode */ /* for IBSS or any, if no entries where found, add the self site */ if (pSme->eBssType == BSS_INFRASTRUCTURE) { /* makr whether we need to stop the attempt connection in manual mode */ pSme->bConnectRequired = TI_FALSE; /* manual mode and no connection candidate is available - connection failed */ sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } else { /* IBSS */ TI_UINT8 uDesiredChannel; TI_BOOL channelValidity; pSme->bConnectRequired = TI_FALSE; pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); if (!pParam) { return; } pParam->paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; siteMgr_getParam(pSme->hSiteMgr, pParam); uDesiredChannel = pParam->content.siteMgrDesiredChannel; if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN) { pParam->content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ; } else { pParam->content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ; } /* update the regulatory domain with the selected band */ /* Check if the selected channel is valid according to regDomain */ pParam->paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES; pParam->content.channelCapabilityReq.scanOption = ACTIVE_SCANNING; pParam->content.channelCapabilityReq.channelNum = uDesiredChannel; regulatoryDomain_getParam (pSme->hRegDomain, pParam); channelValidity = pParam->content.channelCapabilityRet.channelValidity; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); if (!channelValidity) { sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); return; } pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr); if (pSme->pCandidate == NULL) { sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); return; } /* a connection candidate is available, send a connect event */ sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } } } }
/** * \fn sme_ScanResultCB * \brief Callback function from scan concentrator for results and scan complete indications * * Callback function from scan concentrator for results and scan complete indications * * \param hSme - handle to the SME object * \param eStatus - the reason for calling the CB * \param pFrameInfo - frame information (if the CB is called due to received frame) * \param uSPSStatus - SPS attened channels (if the CB is called to inidcate an SPS scan complete) * \return None */ void sme_ScanResultCB (TI_HANDLE hSme, EScanCncnResultStatus eStatus, TScanFrameInfo* pFrameInfo, TI_UINT16 uSPSStatus) { TSme *pSme = (TSme*)hSme; paramInfo_t param; switch (eStatus) { /* a frame was received - update the scan result table */ case SCAN_CRS_RECEIVED_FRAME: TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received frame from BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); /* * in auto mode in order to find country IE only !!! * filter frames according to desired SSID, in case we are also trying to find * country IE in passive scan, to avoid a table overflow (in manual mode, the SME table must be equal to the app * table, the app is responsible to decide which SSIDs to use for scan) */ if (CONNECT_MODE_AUTO == pSme->eConnectMode) { if (SSID_TYPE_SPECIFIC == pSme->eSsidType) { #ifndef XCC_MODULE_INCLUDED if ((pSme->tSsid.len == pFrameInfo->parsedIEs->content.iePacket.pSsid->hdr[ 1 ]) && (0 == os_memoryCompare (pSme->hOS, &(pSme->tSsid.str[ 0 ]), &(pFrameInfo->parsedIEs->content.iePacket.pSsid->serviceSetId[ 0 ]), pSme->tSsid.len))) #endif { if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update specific enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } } else { if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x because table is full\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } } else /* manual mode */ { if (TI_OK != scanResultTable_UpdateEntry (pSme->hScanResultTable, pFrameInfo->bssId, pFrameInfo)) { TRACE6(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: unable to update application scan enrty for BSSID %02x:%02x:%02x:%02x:%02x:%02x\n", (*pFrameInfo->bssId)[ 0 ], (*pFrameInfo->bssId)[ 1 ], (*pFrameInfo->bssId)[ 2 ], (*pFrameInfo->bssId)[ 3 ], (*pFrameInfo->bssId)[ 4 ], (*pFrameInfo->bssId)[ 5 ]); } } break; /* scan was completed successfully */ case SCAN_CRS_SCAN_COMPLETE_OK: /* an error occured, try selecting a site anyway */ case SCAN_CRS_SCAN_ABORTED_FW_RESET: case SCAN_CRS_SCAN_ABORTED_HIGHER_PRIORITY: case SCAN_CRS_SCAN_FAILED: case SCAN_CRS_TSF_ERROR: TRACE1(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received scan complete indication with status %d\n", eStatus); /* stablizie the scan result table - delete its contenst if no results were recived during last scan */ scanResultTable_SetStableState (pSme->hScanResultTable); if (CONNECT_MODE_AUTO == pSme->eConnectMode) { /* try to select a site */ pSme->pCandidate = sme_Select (hSme); /* if no matching site was found */ if (NULL == pSme->pCandidate) { /* for IBSS or any, if no entries where found, add the self site */ if (pSme->eBssType == BSS_INFRASTRUCTURE) { TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: No candidate available, sending connect failure\n"); genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; } { TI_UINT8 uDesiredChannel; param.paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; siteMgr_getParam(pSme->hSiteMgr, ¶m); uDesiredChannel = param.content.siteMgrDesiredChannel; if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN) { param.content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ; } else { param.content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ; } /* update the regulatory domain with the selected band */ /* Check if the selected channel is valid according to regDomain */ param.paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES; param.content.channelCapabilityReq.scanOption = ACTIVE_SCANNING; param.content.channelCapabilityReq.channelNum = uDesiredChannel; regulatoryDomain_getParam (pSme->hRegDomain,¶m); if (!param.content.channelCapabilityRet.channelValidity) { TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "IBSS SELECT FAILURE - No channel !!!\n\n"); genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; } pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr); if (pSme->pCandidate == NULL) { TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "IBSS SELECT FAILURE - could not open self site !!!\n\n"); genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; } #ifdef REPORT_LOG TRACE6(pSme->hReport, REPORT_SEVERITY_CONSOLE,"%%%%%%%%%%%%%% SELF SELECT SUCCESS, bssid: %X-%X-%X-%X-%X-%X %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]); WLAN_OS_REPORT (("%%%%%%%%%%%%%% SELF SELECT SUCCESS, bssid: %02x.%02x.%02x.%02x.%02x.%02x %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5])); #endif } } /* a connection candidate is available, send a connect event */ genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } break; /* * scan was stopped according to SME request (should happen when moving to disconnecting from scanning), send a * connect failure event to move out of disconnecting */ case SCAN_CRS_SCAN_STOPPED: TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_ScanResultCB: received scan stopped indication\n"); genSM_Event (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); break; default: TRACE1(pSme->hReport, REPORT_SEVERITY_ERROR , "sme_ScanResultCB: received unrecognized status %d\n", eStatus); break; } }
/** * Checks whether the given measurement request is valid. * * @param hMeasurementMgr A handle to the Measurement Manager module. * @param pRequestArr The measurement request. * @param numOfRequest Number of type requests * * @return True iff the request is valid * * @date 01-Jan-2006 */ static TI_BOOL measurementMgr_isRequestValid(TI_HANDLE hMeasurementMgr, MeasurementRequest_t *pRequestArr[], TI_UINT8 numOfRequest) { measurementMgr_t * pMeasurementMgr = (measurementMgr_t *) hMeasurementMgr; TI_UINT8 requestIndex; paramInfo_t param; /* Checking validity of the measured channel number */ param.content.channel = pRequestArr[0]->channelNumber; param.paramType = REGULATORY_DOMAIN_IS_CHANNEL_SUPPORTED; regulatoryDomain_getParam(pMeasurementMgr->hRegulatoryDomain, ¶m); if ( !param.content.bIsChannelSupprted ) { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Request rejected due to invalid channel\n"); if (pMeasurementMgr->currentFrameType == MSR_FRAME_TYPE_UNICAST) pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequest, MSR_REJECT_INVALID_CHANNEL); return TI_FALSE; } else { TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Request channel is Valid\n"); } TRACE0(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Starting to check each request:\n"); /* Check Validity of each request */ for (requestIndex = 0; requestIndex < numOfRequest; requestIndex++) { TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Checking request #%d:\n", requestIndex+1); /* Checking validity of the Request Type */ if (pMeasurementMgr->isTypeValid(hMeasurementMgr, pRequestArr[requestIndex]->Type, pRequestArr[requestIndex]->ScanMode) == TI_FALSE) { TRACE2(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Request rejected due to invalid measurement type of request #%d (type = %d)\n", requestIndex+1, pRequestArr[requestIndex]->Type); if(pMeasurementMgr->currentFrameType == MSR_FRAME_TYPE_UNICAST) pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequest, MSR_REJECT_INVALID_MEASUREMENT_TYPE); return TI_FALSE; } else { TRACE2(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Measurement type of request #%d is supported (type = %d)\n", requestIndex+1, pRequestArr[requestIndex]->Type); } /* For measurement types different than Beacon Table */ if ((pRequestArr[requestIndex]->Type != MSR_TYPE_BEACON_MEASUREMENT) || (pRequestArr[requestIndex]->ScanMode != MSR_SCAN_MODE_BEACON_TABLE)) { /* Checking Measurement request's duration only when request is on a non-serving channel */ if (pMeasurementMgr->servingChannelID != pRequestArr[requestIndex]->channelNumber) { TI_UINT8 dtimPeriod; TI_UINT32 beaconInterval; TI_UINT32 dtimDuration; /* Checking duration doesn't exceed given max duration */ if (pRequestArr[requestIndex]->DurationTime > pMeasurementMgr->maxDurationOnNonServingChannel) { TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Request #%d rejected because duration exceeds maximum duration\n", requestIndex+1); TRACE2(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Duration = %d, MaxDurationOnNonServingChannel = %d\n", pRequestArr[requestIndex]->DurationTime, pMeasurementMgr->maxDurationOnNonServingChannel); if (pMeasurementMgr->currentFrameType == MSR_FRAME_TYPE_UNICAST) pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequest, MSR_REJECT_DURATION_EXCEED_MAX_DURATION); return TI_FALSE; } else { TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": Duration of request #%d doesn't exceed max duration\n", requestIndex+1); } /* Checking DTIM */ /* Getting the DTIM count */ param.paramType = SITE_MGR_DTIM_PERIOD_PARAM; siteMgr_getParam(pMeasurementMgr->hSiteMgr, ¶m); dtimPeriod = param.content.siteMgrDtimPeriod; /* Getting the beacon Interval */ param.paramType = SITE_MGR_BEACON_INTERVAL_PARAM; siteMgr_getParam(pMeasurementMgr->hSiteMgr, ¶m); beaconInterval = param.content.beaconInterval; dtimDuration = beaconInterval * MEASUREMENT_BEACON_INTERVAL_IN_MICRO_SEC/MEASUREMENT_MSEC_IN_MICRO*dtimPeriod; if (pRequestArr[requestIndex]->DurationTime > dtimDuration) { TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_WARNING, ": Request rejected due to DTIM overlap of request #%d\n", requestIndex+1); TRACE2(pMeasurementMgr->hReport, REPORT_SEVERITY_WARNING, ": Duration = %d, DTIM Duration = %d\n", pRequestArr[requestIndex]->DurationTime, dtimDuration); if (pMeasurementMgr->currentFrameType == MSR_FRAME_TYPE_UNICAST) pMeasurementMgr->buildRejectReport(pMeasurementMgr, pRequestArr, numOfRequest, MSR_REJECT_DTIM_OVERLAP); return TI_FALSE; } else { TRACE1(pMeasurementMgr->hReport, REPORT_SEVERITY_INFORMATION, ": DTIM of request #%d doesn't overlap\n", requestIndex+1); } } } } return TI_TRUE; }
/** * \fn sme_Select * \brief Select a connection candidate from the scan result table * * Select a connection candidate from the scan result table. * * Connection candidate must match SSID, BSSID, BSS type, RSN and WSC settings, has the best * RSSI level from all matching sites, and connection was not attempted to it in this SME cycle * (since last scan was completed) * * \param hSme - handle to the SME object * \return A pointer to the selected site, NULL if no site macthes the selection criteria */ TSiteEntry *sme_Select (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; TSiteEntry *pCurrentSite, *pSelectedSite = NULL; TI_INT8 iSelectedSiteRssi = -127; /* minimum RSSI */ TI_BOOL bWscPbAbort, pWscPbApFound = TI_FALSE; int apFoundCtr =0; TIWLN_SIMPLE_CONFIG_MODE eWscMode; TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select called\n"); /* on SG avalanche, select is not needed, send connect event automatically */ if (TI_TRUE == pSme->bReselect) { paramInfo_t *pParam; TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: reselect flag is on, reselecting the current site\n"); pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); if (!pParam) { return NULL; } pSme->bReselect = TI_FALSE; /* Get Primary Site */ pParam->paramType = SITE_MGR_GET_PRIMARY_SITE; siteMgr_getParam(pSme->hSiteMgr, pParam); pCurrentSite = pParam->content.pPrimarySite; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); return pCurrentSite; } /* get the first site from the scan result table */ pCurrentSite = scanResultTable_GetFirst (pSme->hScanResultTable); /* check all sites */ while (NULL != pCurrentSite) { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: considering BSSID: %02x:%02x:%02x:%02x:%02x:%02x for selection\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); /* if this site was previously selected in the current SME connection attempt, and conn mode is auto */ if (TI_TRUE == pCurrentSite->bConsideredForSelect) { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x was selected previously\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* check if site matches */ /* first check SSID match */ if (TI_FALSE == sme_SelectSsidMatch (hSme, &(pCurrentSite->ssid), &(pSme->tSsid), pSme->eSsidType)) /* site doesn't match */ { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match SSID\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* Now check BSSID match */ if (TI_FALSE == sme_SelectBssidMatch (&(pCurrentSite->bssid), &(pSme->tBssid))) /* site doesn't match */ { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match SSID\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* and BSS type match */ if (TI_FALSE == sme_SelectBssTypeMatch (pCurrentSite->bssType, pSme->eBssType)) /* site doesn't match */ { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match BSS type\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } if (pCurrentSite->WSCSiteMode == TIWLN_SIMPLE_CONFIG_PBC_METHOD) { apFoundCtr++; } if (apFoundCtr > 1) { pWscPbApFound = TI_TRUE; } /* and simple config match */ if (TI_FALSE == sme_SelectWscMatch (hSme, pCurrentSite, &bWscPbAbort, &pWscPbApFound)) /* site doesn't match */ { /* also check if abort was indicated */ if (TI_TRUE == bWscPbAbort) { /* send event to user mode to indicate this */ EvHandlerSendEvent (pSme->hEvHandler, IPC_EVENT_WPS_SESSION_OVERLAP, NULL, 0); /* select failed - will rescan in time */ return NULL; } TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match WSC\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* and security match */ siteMgr_getParamWSC(pSme->hSiteMgr, &eWscMode); /* we don't need to check RSN match while WSC is active */ if ((pCurrentSite->WSCSiteMode == TIWLN_SIMPLE_CONFIG_OFF) || (pCurrentSite->WSCSiteMode != eWscMode)) { if (TI_FALSE == sme_SelectRsnMatch (hSme, pCurrentSite)) /* site doesn't match */ { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match RSN\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } } /* and rate match */ if (TI_FALSE == siteMgr_SelectRateMatch (pSme->hSiteMgr, pCurrentSite)) /* site doesn't match */ { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x doesn't match rates\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } if (TI_TRUE == pCurrentSite->bChannelSwitchAnnoncIEFound) { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x has channel switch IE so ignore it \n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* if this site RSSI is higher than current maximum, select it */ if (pCurrentSite->rssi > iSelectedSiteRssi) { TRACE6(pSme->hReport, REPORT_SEVERITY_INFORMATION , "sme_Select: BSSID: %02x:%02x:%02x:%02x:%02x:%02x match and has highest RSSI so far!\n", pCurrentSite->bssid[ 0 ], pCurrentSite->bssid[ 1 ], pCurrentSite->bssid[ 2 ], pCurrentSite->bssid[ 3 ], pCurrentSite->bssid[ 4 ], pCurrentSite->bssid[ 5 ]); pSelectedSite = pCurrentSite; iSelectedSiteRssi = pCurrentSite->rssi; } /* and continue to the next site */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); } /* if a matching site was found */ if (NULL != pSelectedSite) { /* mark that a connection to this site was (actually is) attempted */ pSelectedSite->bConsideredForSelect = TI_TRUE; /* hope this is the correct place for siteMgr_changeBandParams */ siteMgr_changeBandParams (pSme->hSiteMgr, pSelectedSite->eBand); /* * Coordinate between SME module site table and Site module site Table * copy candidate AP to Site module site Table. */ siteMgr_CopyToPrimarySite(pSme->hSiteMgr, pSelectedSite); /* copy the result, rather than returning a pointer to the entry in the scan result table. * This is done since the table might change durring the connection process, and the pointer * will point to the wrong entry in the table, causing connection/disconnection problems */ os_memoryCopy(pSme->hOS, &(pSme->tCandidate), pSelectedSite, sizeof(TSiteEntry)); return &(pSme->tCandidate); } /* return NULL if no site was selected */ return NULL; }
/** * \fn scanCncnOsSm_ActionStartAScan * \brief Scan concentartor OS state machine start scan on A action function * * Scan concentartor OS state machine start scan on A action function. * Starts a sacn on A using all allowed channels * * \param hScanCncn - handle to the scan concentartor object * \return None */ void scanCncnOsSm_ActionStartAScan (TI_HANDLE hScanCncn) { TScanCncn *pScanCncn = (TScanCncn*)hScanCncn; paramInfo_t tParam; TI_UINT32 uValidChannelsCount; TI_BOOL bRegulatoryDomainEnabled; /* if the STA is not configured for G band or dual band, send a scan complete event to the SM */ tParam.paramType = SITE_MGR_DESIRED_DOT11_MODE_PARAM; siteMgr_getParam (pScanCncn->hSiteManager, &tParam); if ((DOT11_A_MODE != tParam.content.siteMgrDot11Mode) && (DOT11_DUAL_MODE != tParam.content.siteMgrDot11Mode)) { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_INFORMATION , "scanCncnOsSm_ActionStartAScan: STA does not work on 5.0 GHz, quitting\n"); genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); return; } /* build scan command header */ pScanCncn->tOsScanParams.band = RADIO_BAND_5_0_GHZ; pScanCncn->tOsScanParams.Tid = 0; /* query the regulatory domain if 802.11d is in use */ tParam.paramType = REGULATORY_DOMAIN_ENABLED_PARAM; regulatoryDomain_getParam (pScanCncn->hRegulatoryDomain, &tParam ); bRegulatoryDomainEnabled = tParam.content.regulatoryDomainEnabled; /* Get country code status */ tParam.paramType = REGULATORY_DOMAIN_IS_COUNTRY_FOUND; tParam.content.eRadioBand = RADIO_BAND_5_0_GHZ; regulatoryDomain_getParam (pScanCncn->hRegulatoryDomain, &tParam); /* scan type is passive if 802.11d is enabled and country IE was not yet found, active otherwise */ if (((TI_TRUE == bRegulatoryDomainEnabled) && (TI_FALSE == tParam.content.bIsCountryFound)) || SCAN_TYPE_TRIGGERED_PASSIVE == pScanCncn->tOsScanParams.scanType) { pScanCncn->tOsScanParams.scanType = SCAN_TYPE_TRIGGERED_PASSIVE; } /* All paramters in the func are hard coded, due to that we set to active if not passive */ else { pScanCncn->tOsScanParams.scanType = SCAN_TYPE_TRIGGERED_ACTIVE; /* also set number and rate of probe requests */ pScanCncn->tOsScanParams.probeReqNumber = SCAN_OID_DEFAULT_PROBE_REQUEST_NUMBER_A; pScanCncn->tOsScanParams.probeRequestRate = (ERateMask)SCAN_OID_DEFAULT_PROBE_REQUEST_RATE_A; } /* add supported channels on G */ if (SCAN_TYPE_NORMAL_PASSIVE == pScanCncn->tOsScanParams.scanType ) { uValidChannelsCount = scanCncnOsSm_FillAllAvailableChannels (hScanCncn, RADIO_BAND_5_0_GHZ, SCAN_TYPE_NORMAL_PASSIVE, &(pScanCncn->tOsScanParams.channelEntry[0]), SCAN_OID_DEFAULT_MAX_DWELL_TIME_PASSIVE_A, SCAN_OID_DEFAULT_MIN_DWELL_TIME_PASSIVE_A, SCAN_OID_DEFAULT_EARLY_TERMINATION_EVENT_PASSIVE_A, SCAN_OID_DEFAULT_EARLY_TERMINATION_COUNT_PASSIVE_A ); } else { uValidChannelsCount = scanCncnOsSm_FillAllAvailableChannels (hScanCncn, RADIO_BAND_5_0_GHZ, SCAN_TYPE_NORMAL_ACTIVE, &(pScanCncn->tOsScanParams.channelEntry[0]), SCAN_OID_DEFAULT_MAX_DWELL_TIME_ACTIVE_A, SCAN_OID_DEFAULT_MIN_DWELL_TIME_ACTIVE_A, SCAN_OID_DEFAULT_EARLY_TERMINATION_EVENT_ACTIVE_A, SCAN_OID_DEFAULT_EARLY_TERMINATION_COUNT_ACTIVE_A ); } pScanCncn->tOsScanParams.numOfChannels = uValidChannelsCount; /* check that some channels are available */ if ( uValidChannelsCount > 0 ) { EScanCncnResultStatus eResult; /* send command to scan concentrator APP SM */ eResult = scanCncn_Start1ShotScan (hScanCncn, SCAN_SCC_APP_ONE_SHOT, &(pScanCncn->tOsScanParams)); /* if scan failed, send scan complete event to the SM */ if (SCAN_CRS_SCAN_RUNNING != eResult) { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnOsSm_ActionStartAScan: scan failed on 5.0 GHz, quitting\n"); genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } } else { TRACE0(pScanCncn->hReport, REPORT_SEVERITY_ERROR , "scanCncnOsSm_ActionStartGScan: no valid cahnnels on 5.0 GHz, quitting\n"); /* no channels to scan, send a scan complete event */ genSM_Event (pScanCncn->hOSScanSm, SCAN_CNCN_OS_SM_EVENT_SCAN_COMPLETE, hScanCncn); } }
/** * \fn sme_Select * \brief Select a connection candidate from the scan result table * * Select a connection candidate from the scan result table. * * Connection candidate must match SSID, BSSID, BSS type, RSN and WSC settings, has the best * RSSI level from all matching sites, and connection was not attempted to it in this SME cycle * (since last scan was completed) * * \param hSme - handle to the SME object * \return A pointer to the selected site, NULL if no site macthes the selection criteria */ TSiteEntry *sme_Select (TI_HANDLE hSme) { TSme *pSme = (TSme*)hSme; TSiteEntry *pCurrentSite, *pSelectedSite = NULL; TI_INT8 iSelectedSiteRssi = -127; /* minimum RSSI */ TI_BOOL bWscPbAbort, pWscPbApFound = TI_FALSE; int apFoundCtr =0; /* on SG avalanche, select is not needed, send connect event automatically */ if (TI_TRUE == pSme->bReselect) { paramInfo_t *pParam; pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); if (!pParam) { return NULL; } pSme->bReselect = TI_FALSE; /* Get Primary Site */ pParam->paramType = SITE_MGR_GET_PRIMARY_SITE; siteMgr_getParam(pSme->hSiteMgr, pParam); pCurrentSite = pParam->content.pPrimarySite; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); return pCurrentSite; } /* get the first site from the scan result table */ pCurrentSite = scanResultTable_GetFirst (pSme->hScanResultTable); /* check all sites */ while (NULL != pCurrentSite) { /* if this site was previously selected in the current SME connection attempt, and conn mode is auto */ if ((TI_TRUE == pCurrentSite->bConsideredForSelect) && (CONNECT_MODE_AUTO == pSme->eConnectMode)) { /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* check if site matches */ /* first check SSID match */ if (TI_FALSE == sme_SelectSsidMatch (hSme, &(pCurrentSite->ssid), &(pSme->tSsid), pSme->eSsidType)) /* site doesn't match */ { pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* Now check BSSID match */ if (TI_FALSE == sme_SelectBssidMatch (&(pCurrentSite->bssid), &(pSme->tBssid))) /* site doesn't match */ { pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* and BSS type match */ if (TI_FALSE == sme_SelectBssTypeMatch (pCurrentSite->bssType, pSme->eBssType)) /* site doesn't match */ { pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } if (pCurrentSite->WSCSiteMode == TIWLN_SIMPLE_CONFIG_PBC_METHOD) { apFoundCtr++; } if (apFoundCtr > 1) { pWscPbApFound = TI_TRUE; } /* and simple config match */ if (TI_FALSE == sme_SelectWscMatch (hSme, pCurrentSite, &bWscPbAbort, &pWscPbApFound)) /* site doesn't match */ { /* also check if abort was indicated */ if (TI_TRUE == bWscPbAbort) { /* send event to user mode to indicate this */ EvHandlerSendEvent (pSme->hEvHandler, IPC_EVENT_WPS_SESSION_OVERLAP, NULL, 0); /* select failed - will rescan in time */ return NULL; } pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* and security match */ if (pCurrentSite->WSCSiteMode == TIWLN_SIMPLE_CONFIG_OFF) /* we don't need to check RSN match while WSC is active */ { if (TI_FALSE == sme_SelectRsnMatch (hSme, pCurrentSite)) /* site doesn't match */ { pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } } /* and rate match */ if (TI_FALSE == siteMgr_SelectRateMatch (pSme->hSiteMgr, pCurrentSite)) /* site doesn't match */ { pCurrentSite->bConsideredForSelect = TI_TRUE; /* don't try this site again */ /* get the next site and continue the loop */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); continue; } /* if this site RSSI is higher than current maximum, select it */ if (pCurrentSite->rssi > iSelectedSiteRssi) { pSelectedSite = pCurrentSite; iSelectedSiteRssi = pCurrentSite->rssi; } /* and continue to the next site */ pCurrentSite = scanResultTable_GetNext (pSme->hScanResultTable); } /* if a matching site was found */ if (NULL != pSelectedSite) { /* mark that a connection to this site was (actually is) attempted */ pSelectedSite->bConsideredForSelect = TI_TRUE; /* hope this is the correct place for siteMgr_changeBandParams */ siteMgr_changeBandParams (pSme->hSiteMgr, pSelectedSite->eBand); /* * Coordinate between SME module site table and Site module site Table * copy candidate AP to Site module site Table. */ siteMgr_CopyToPrimarySite(pSme->hSiteMgr, pSelectedSite); } /* return the selected site (or NULL, if no site was selected) */ return pSelectedSite; }
/** * \fn smeSm_PreConnect * \brief Initiates the connection process * * Initiates the connection process - for automatic mode, start scan, for manual mode - triggers connection * * \param hSme - handle to the SME object * \return None * \sa smeSm_Connect, smeSm_ConnectSuccess */ void smeSm_PreConnect (TI_HANDLE hSme) { TSme *pSme = (TSme *)hSme; paramInfo_t *pParam; //joetest TRACE0(pSme->hReport, REPORT_SEVERITY_SM , "smeSm_PreConnect: !!!\n"); /* set the connection mode with which this connection attempt is starting */ pSme->eLastConnectMode = pSme->eConnectMode; /* mark that no authentication/assocaition was yet sent */ pSme->bAuthSent = TI_FALSE; /* try to find a connection candidate (manual mode have already performed scann */ pSme->pCandidate = sme_Select (hSme); if (NULL != pSme->pCandidate) { /* candidate is available - attempt connection */ sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } /* no candidate */ else { if (CONNECT_MODE_AUTO == pSme->eConnectMode) { /* automatic mode - start scanning */ if (TI_OK != sme_StartScan (hSme)) { TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "smeSm_PreConnect: unable to start scan, stopping the SME\n"); pSme->bRadioOn = TI_FALSE; sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); } /* update scan count counter */ if(pSme->uScanCount < PERIODIC_SCAN_MAX_INTERVAL_NUM) { pSme->uScanCount++; } } else /* Manual mode */ { /* for IBSS or any, if no entries where found, add the self site */ if (pSme->eBssType == BSS_INFRASTRUCTURE) { /* makr whether we need to stop the attempt connection in manual mode */ pSme->bConnectRequired = TI_FALSE; TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "smeSm_PreConnect: No candidate available, sending connect failure\n"); /* manual mode and no connection candidate is available - connection failed */ //joetest TRACE0(pSme->hReport, REPORT_SEVERITY_SM , "smeSm_PreConnect!!!\n"); } else /* IBSS */ { TI_UINT8 uDesiredChannel; TI_BOOL channelValidity; pSme->bConnectRequired = TI_FALSE; pParam = (paramInfo_t *)os_memoryAlloc(pSme->hOS, sizeof(paramInfo_t)); if (!pParam) { return; } pParam->paramType = SITE_MGR_DESIRED_CHANNEL_PARAM; siteMgr_getParam(pSme->hSiteMgr, pParam); uDesiredChannel = pParam->content.siteMgrDesiredChannel; if (uDesiredChannel >= SITE_MGR_CHANNEL_A_MIN) { pParam->content.channelCapabilityReq.band = RADIO_BAND_5_0_GHZ; } else { pParam->content.channelCapabilityReq.band = RADIO_BAND_2_4_GHZ; } /* update the regulatory domain with the selected band */ /* Check if the selected channel is valid according to regDomain */ pParam->paramType = REGULATORY_DOMAIN_GET_SCAN_CAPABILITIES; pParam->content.channelCapabilityReq.scanOption = ACTIVE_SCANNING; pParam->content.channelCapabilityReq.channelNum = uDesiredChannel; regulatoryDomain_getParam (pSme->hRegDomain,pParam); channelValidity = pParam->content.channelCapabilityRet.channelValidity; os_memoryFree(pSme->hOS, pParam, sizeof(paramInfo_t)); if (!channelValidity) { TRACE0(pSme->hReport, REPORT_SEVERITY_INFORMATION , "IBSS SELECT FAILURE - No channel !!!\n\n"); sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); return; } pSme->pCandidate = (TSiteEntry *)addSelfSite(pSme->hSiteMgr); if (pSme->pCandidate == NULL) { TRACE0(pSme->hReport, REPORT_SEVERITY_ERROR , "IBSS SELECT FAILURE - could not open self site !!!\n\n"); sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT_FAILURE, hSme); return; } #ifdef REPORT_LOG TRACE6(pSme->hReport, REPORT_SEVERITY_CONSOLE,"%%%%%%%%%%%%%% SELF SELECT SUCCESS, bssid: %X-%X-%X-%X-%X-%X %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5]); WLAN_OS_REPORT (("%%%%%%%%%%%%%% SELF SELECT SUCCESS, bssid: %02x.%02x.%02x.%02x.%02x.%02x %%%%%%%%%%%%%%\n\n", pSme->pCandidate->bssid[0], pSme->pCandidate->bssid[1], pSme->pCandidate->bssid[2], pSme->pCandidate->bssid[3], pSme->pCandidate->bssid[4], pSme->pCandidate->bssid[5])); #endif /* a connection candidate is available, send a connect event */ sme_SmEvent (pSme->hSmeSm, SME_SM_EVENT_CONNECT, hSme); } } } }