static tANI_U8 limIsRSNieValidInSmeReqMessage(tpAniSirGlobal pMac, tpSirRSNie pRSNie) { tANI_U8 startPos = 0; tANI_U32 privacy, val; int len; if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &privacy) != eSIR_SUCCESS) { limLog(pMac, LOGP, FL("Unable to retrieve POI from CFG")); } if (wlan_cfgGetInt(pMac, WNI_CFG_RSN_ENABLED, &val) != eSIR_SUCCESS) { limLog(pMac, LOGP, FL("Unable to retrieve RSN_ENABLED from CFG")); } if (pRSNie->length && (!privacy || !val)) { // Privacy & RSN not enabled in CFG. /** * In order to allow mixed mode for Guest access * allow BSS creation/join with no Privacy capability * yet advertising WPA IE */ PELOG1(limLog(pMac, LOG1, FL("RSN ie len %d but PRIVACY %d RSN %d"), pRSNie->length, privacy, val);) }
/** ---------------------------------------------------------------------- \fn limSelectsBackgroundScanMode() \brief This function is called by limIsBackgroundScanAllowed(). \ Here LIM decides whether we shall enforce this background \ scan or let HAL decide whether to proceed with the background \ scan as HAL sees fits. LIM shall enforce background scan if: \ 1) station is not in link established state \ 2) station is in link established state, but there has been \ max number of consecutive background scan failure. \ \param tpAniSirGlobal pMac \return none \ ------------------------------------------------------------------------- */ tSirBackgroundScanMode limSelectsBackgroundScanMode(tpAniSirGlobal pMac) { tANI_U32 cfgVal; if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE, &cfgVal) != eSIR_SUCCESS) { limLog(pMac, LOGP, FL("Fail to get WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE value\n")); return eSIR_NORMAL_BACKGROUND_SCAN; } if (cfgVal == 0) return eSIR_NORMAL_BACKGROUND_SCAN; /* If the "number of consecutive background scan failure" * exceeds the maximum allowed, then LIM shall trigger an * aggressive background scan. */ if (pMac->lim.gLimNumOfConsecutiveBkgndScanFailure >= cfgVal) { pMac->lim.gLimNumOfForcedBkgndScan += 1; limLog(pMac, LOGE, FL("Had %d consec scan fail(when expect < %d). Trigger AGGRESSIVE bkgnd scan.\n"), pMac->lim.gLimNumOfConsecutiveBkgndScanFailure, cfgVal); return eSIR_AGGRESSIVE_BACKGROUND_SCAN; } return eSIR_NORMAL_BACKGROUND_SCAN; }
static void __limInitAssocVars(tpAniSirGlobal pMac) { tANI_U32 val; #if 0 vos_mem_set(pMac->lim.gpLimAIDpool, sizeof(*pMac->lim.gpLimAIDpool) * (WNI_CFG_ASSOC_STA_LIMIT_STAMAX+1), 0); pMac->lim.freeAidHead = 0; pMac->lim.freeAidTail = 0; #endif if(wlan_cfgGetInt(pMac, WNI_CFG_ASSOC_STA_LIMIT, &val) != eSIR_SUCCESS) { limLog( pMac, LOGP, FL( "cfg get assoc sta limit failed" )); } pMac->lim.gLimAssocStaLimit = val; pMac->lim.gpLimMlmAuthReq = NULL; //pMac->lim.gpLimMlmJoinReq = NULL; pMac->lim.gLimPreAuthChannelNumber = 0; pMac->lim.gLimPreAuthType = eSIR_OPEN_SYSTEM; vos_mem_set(&pMac->lim.gLimPreAuthPeerAddr, sizeof(tSirMacAddr), 0); pMac->lim.gLimNumPreAuthContexts = 0; vos_mem_set(&pMac->lim.gLimPreAuthTimerTable, sizeof(tLimPreAuthTable), 0); pMac->lim.gLimDeauthReasonCode = 0; pMac->lim.pLimPreAuthList = NULL; pMac->lim.gLimDisassocFrameThreshold = LIM_SEND_DISASSOC_FRAME_THRESHOLD; pMac->lim.gLimDisassocFrameCredit = 0; vos_mem_set(pMac->lim.protStaOverlapCache, sizeof(tCacheParams) * LIM_PROT_STA_OVERLAP_CACHE_SIZE, 0); vos_mem_set(pMac->lim.protStaCache, sizeof(tCacheParams) * LIM_PROT_STA_CACHE_SIZE, 0); #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR) pMac->lim.pSessionEntry = NULL; pMac->lim.reAssocRetryAttempt = 0; #endif }
static tSirRetStatus __limInitConfig( tpAniSirGlobal pMac ) { tANI_U32 val1, val2, val3; tANI_U16 val16; tANI_U8 val8; tSirMacHTCapabilityInfo *pHTCapabilityInfo; tSirMacHTInfoField1 *pHTInfoField1; tpSirPowerSaveCfg pPowerSaveConfig; tSirMacHTParametersInfo *pAmpduParamInfo; if(wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &val1) != eSIR_SUCCESS) { PELOGE(limLog(pMac, LOGE, FL("could not retrieve HT Cap CFG"));) return eSIR_FAILURE;
eHalStatus ccmCfgGetInt(tHalHandle hHal, tANI_U32 cfgId, tANI_U32 *pValue) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); eHalStatus status = eHAL_STATUS_SUCCESS ; tCfgReq *req = pMac->ccm.comp[cfgId] ; if (req && req->state == eCCM_REQ_DONE) { *pValue = req->ccmValue ; } else { if (wlan_cfgGetInt(pMac, (tANI_U16)cfgId, pValue) != eSIR_SUCCESS) status = eHAL_STATUS_FAILURE; } return status ; }
static void Log_getCfg(tpAniSirGlobal pMac, tANI_U16 cfgId) { #define CFG_CTL_INT 0x00080000 if ((pMac->cfg.gCfgEntry[cfgId].control & CFG_CTL_INT) != 0) { tANI_U32 val; // Get integer parameter if (wlan_cfgGetInt(pMac, (tANI_U16)cfgId, &val) != eSIR_SUCCESS) { sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId); } else { sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d 0x%x) = %ld\n"), gCfgParamName[cfgId], cfgId, cfgId, val ); } } else { tANI_U8 buf[CFG_MAX_STR_LEN] = {0} ; tANI_U32 valueLen ; // Get string parameter valueLen = CFG_MAX_STR_LEN ; if (wlan_cfgGetStr(pMac, cfgId, buf, &valueLen) != eSIR_SUCCESS) { sysLog(pMac, LOGE, FL("Get cfgId 0x%x failed\n"), cfgId); } else { sysLog( pMac, LOGE, FL("WNI_CFG_%s(%d 0x%x) len=%ld\n"), gCfgParamName[cfgId], cfgId, cfgId, valueLen ); sirDumpBuf(pMac, SIR_WDA_MODULE_ID, LOG1, buf, valueLen) ; } } return; }
tSirBackgroundScanMode limSelectsBackgroundScanMode(tpAniSirGlobal pMac) { tANI_U32 cfgVal; if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE, &cfgVal) != eSIR_SUCCESS) { limLog(pMac, LOGP, FL("Fail to get WNI_CFG_MAX_CONSECUTIVE_BACKGROUND_SCAN_FAILURE value")); return eSIR_NORMAL_BACKGROUND_SCAN; } if (cfgVal == 0) return eSIR_NORMAL_BACKGROUND_SCAN; if (pMac->lim.gLimNumOfConsecutiveBkgndScanFailure >= cfgVal) { pMac->lim.gLimNumOfForcedBkgndScan += 1; limLog(pMac, LOGE, FL("Had %d consec scan fail(when expect < %d). Trigger AGGRESSIVE bkgnd scan."), pMac->lim.gLimNumOfConsecutiveBkgndScanFailure, cfgVal); return eSIR_AGGRESSIVE_BACKGROUND_SCAN; } return eSIR_NORMAL_BACKGROUND_SCAN; }
/** * limIsAuthAlgoSupported() * *FUNCTION: * This function is called in various places within LIM code * to determine whether passed authentication algorithm is enabled * or not * *LOGIC: * *ASSUMPTIONS: * NA * *NOTE: * NA * * @param authType Indicates MAC based authentication type * (eSIR_OPEN_SYSTEM or eSIR_SHARED_KEY) * If Shared Key authentication to be used, * 'Privacy Option Implemented' flag is also * checked. * * @return true if passed authType is enabled else false */ tANI_U8 limIsAuthAlgoSupported(tpAniSirGlobal pMac, tAniAuthType authType, tpPESession psessionEntry) { tANI_U32 algoEnable, privacyOptImp; if (authType == eSIR_OPEN_SYSTEM) { if(psessionEntry->limSystemRole == eLIM_AP_ROLE) { if((psessionEntry->authType == eSIR_OPEN_SYSTEM) || (psessionEntry->authType == eSIR_AUTO_SWITCH)) return true; else return false; } if (wlan_cfgGetInt(pMac, WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE, &algoEnable) != eSIR_SUCCESS) { /** * Could not get AuthAlgo1 Enable value * from CFG. Log error. */ limLog(pMac, LOGE, FL("could not retrieve AuthAlgo1 Enable value")); return false; } else return ( (algoEnable > 0 ? true : false) ); } else { if(psessionEntry->limSystemRole == eLIM_AP_ROLE) { if((psessionEntry->authType == eSIR_SHARED_KEY) || (psessionEntry->authType == eSIR_AUTO_SWITCH)) algoEnable = true; else algoEnable = false; } else if (wlan_cfgGetInt(pMac, WNI_CFG_SHARED_KEY_AUTH_ENABLE, &algoEnable) != eSIR_SUCCESS) { /** * Could not get AuthAlgo2 Enable value * from CFG. Log error. */ limLog(pMac, LOGE, FL("could not retrieve AuthAlgo2 Enable value")); return false; } if(psessionEntry->limSystemRole == eLIM_AP_ROLE) { privacyOptImp = psessionEntry->privacy; } else if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &privacyOptImp) != eSIR_SUCCESS) { /** * Could not get PrivacyOptionImplemented value * from CFG. Log error. */ limLog(pMac, LOGE, FL("could not retrieve PrivacyOptImplemented value")); return false; } return (algoEnable && privacyOptImp); } } /****** end limIsAuthAlgoSupported() ******/
/** * @function : limUpdateAssocStaDatas * * @brief : This function is called to Update the Station Descriptor (dph) Details from * Association / ReAssociation Response Frame * *LOGIC: * *ASSUMPTIONS: * *NOTE: * * @param pMac - Pointer to Global MAC structure * @param pStaDs - Station Descriptor in DPH * @param pAssocRsp - Pointer to Association Response Structure * * @return None */ void limUpdateAssocStaDatas(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpSirAssocRsp pAssocRsp,tpPESession psessionEntry) { tANI_U32 prop; tANI_U32 phyMode; tANI_U32 val; //tpSirBoardCapabilities pBoardCaps; tANI_BOOLEAN qosMode; tANI_U16 rxHighestRate = 0; limGetPhyMode(pMac, &phyMode, psessionEntry); pStaDs->staType= STA_ENTRY_SELF; limGetQosMode(psessionEntry, &qosMode); // set the ani peer bit, if self mode is one of the proprietary modes if(IS_DOT11_MODE_PROPRIETARY(psessionEntry->dot11mode)) { wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &prop); if (prop) { pStaDs->aniPeer = eHAL_SET; pStaDs->propCapability = pAssocRsp->propIEinfo.capability; } } //pMac->lim.gLimMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; pStaDs->mlmStaContext.authType = psessionEntry->limCurrentAuthType; // Add capabilities information, rates and AID pStaDs->mlmStaContext.capabilityInfo = pAssocRsp->capabilityInfo; pStaDs->shortPreambleEnabled= (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble; //Update HT Capabilites only when the self mode supports HT if(IS_DOT11_MODE_HT(psessionEntry->dot11mode)) { pStaDs->mlmStaContext.htCapability = pAssocRsp->HTCaps.present; if ( pAssocRsp->HTCaps.present ) { pStaDs->htGreenfield = ( tANI_U8 ) pAssocRsp->HTCaps.greenField; pStaDs->htSupportedChannelWidthSet = ( tANI_U8 ) (pAssocRsp->HTCaps.supportedChannelWidthSet ? pAssocRsp->HTInfo.recommendedTxWidthSet : pAssocRsp->HTCaps.supportedChannelWidthSet ); pStaDs->htLsigTXOPProtection = ( tANI_U8 ) pAssocRsp->HTCaps.lsigTXOPProtection; pStaDs->htMIMOPSState = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave; pStaDs->htMaxAmsduLength = ( tANI_U8 ) pAssocRsp->HTCaps.maximalAMSDUsize; pStaDs->htAMpduDensity = pAssocRsp->HTCaps.mpduDensity; pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz; pStaDs->htShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz; pStaDs->htShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz; pStaDs->htMaxRxAMpduFactor = pAssocRsp->HTCaps.maxRxAMPDUFactor; limFillRxHighestSupportedRate(pMac, &rxHighestRate, pAssocRsp->HTCaps.supportedMCSSet); pStaDs->supportedRates.rxHighestDataRate = rxHighestRate; /* This is for AP as peer STA and we are INFRA STA. We will put APs offset in dph node which is peer STA */ pStaDs->htSecondaryChannelOffset = (tANI_U8)pAssocRsp->HTInfo.secondaryChannelOffset; //FIXME_AMPDU // In the future, may need to check for "assoc.HTCaps.delayedBA" // For now, it is IMMEDIATE BA only on ALL TID's pStaDs->baPolicyFlag = 0xFF; } } #ifdef WLAN_FEATURE_11AC if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode)) { pStaDs->mlmStaContext.vhtCapability = pAssocRsp->VHTCaps.present; } if (limPopulatePeerRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry , &pAssocRsp->VHTCaps) != eSIR_SUCCESS) #else if (limPopulatePeerRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry) != eSIR_SUCCESS) #endif { limLog(pMac, LOGP, FL("could not get rateset and extended rate set")); return; } //If one of the rates is 11g rates, set the ERP mode. if ((phyMode == WNI_CFG_PHY_MODE_11G) && sirIsArate(pStaDs->supportedRates.llaRates[0] & 0x7f)) pStaDs->erpEnabled = eHAL_SET; val = WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET_LEN; if (wlan_cfgGetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, (tANI_U8 *) &pStaDs->mlmStaContext.propRateSet.propRate, &val) != eSIR_SUCCESS) { /// Could not get prop rateset from CFG. Log error. limLog(pMac, LOGP, FL("could not retrieve prop rateset")); return; } pStaDs->mlmStaContext.propRateSet.numPropRates = (tANI_U8) val; pStaDs->qosMode = 0; pStaDs->lleEnabled = 0; // update TSID to UP mapping //if (pMac->lim.gLimQosEnabled) if (qosMode) { if (pAssocRsp->edcaPresent) { tSirRetStatus status; status = schBeaconEdcaProcess(pMac,&pAssocRsp->edca, psessionEntry); PELOG2(limLog(pMac, LOG2, "Edca set update based on AssocRsp: status %d", status);) if (status != eSIR_SUCCESS) { PELOGE(limLog(pMac, LOGE, FL("Edca error in AssocResp "));) } else { // update default tidmap based on ACM
tSirRetStatus schAppendAddnIE(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 *pFrame, tANI_U32 maxBeaconSize, tANI_U32 *nBytes) { tSirRetStatus status = eSIR_FAILURE; tANI_U32 present, len; tANI_U8 addIE[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN]; if((status = wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, &present)) != eSIR_SUCCESS) { schLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG")); return status; } if(present) { if((status = wlan_cfgGetStrLen(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &len)) != eSIR_SUCCESS) { schLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA length")); return status; } if(len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN && len && ((len + *nBytes) <= maxBeaconSize)) { if((status = wlan_cfgGetStr(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addIE[0], &len)) == eSIR_SUCCESS) { tANI_U8* pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], len); if(pP2pIe != NULL) { tANI_U8 noaLen = 0; tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); if(noaLen) { if(noaLen + len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN) { vos_mem_copy(&addIE[len], noaStream, noaLen); len += noaLen; pP2pIe[1] += noaLen; } else { schLog(pMac, LOGE, FL("Not able to insert NoA because of length constraint")); } } } vos_mem_copy(pFrame, &addIE[0], len); *nBytes = *nBytes + len; } } } return status; }