blob: 8527c7cb1ff36ea489b3f1210263749e7f10c87b [file] [log] [blame]
/*
* Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file was originally distributed by Qualcomm Atheros, Inc.
* under proprietary terms before Copyright ownership was assigned
* to the Linux Foundation.
*/
/** ------------------------------------------------------------------------- *
------------------------------------------------------------------------- *
\file csrApiRoam.c
Implementation for the Common Roaming interfaces.
========================================================================== */
/*===========================================================================
EDIT HISTORY FOR FILE
This section contains comments describing changes made to the module.
Notice that changes are listed in reverse chronological order.
when who what, where, why
---------- --- --------------------------------------------------------
06/03/10 js Added support to hostapd driven
* deauth/disassoc/mic failure
===========================================================================*/
#include "aniGlobal.h" //for tpAniSirGlobal
#include "wlan_qct_wda.h"
#include "halMsgApi.h" //for HAL_STA_INVALID_IDX.
#include "palApi.h"
#include "csrInsideApi.h"
#include "smsDebug.h"
#include "sme_Trace.h"
#include "logDump.h"
#include "smeQosInternal.h"
#include "wlan_qct_tl.h"
#include "smeInside.h"
#include "vos_diag_core_event.h"
#include "vos_diag_core_log.h"
#include "csrApi.h"
#include "pmc.h"
#include "vos_nvitem.h"
#include "macTrace.h"
#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
#include "csrNeighborRoam.h"
#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
#include "csrEse.h"
#endif /* FEATURE_WLAN_ESE && !FEATURE_WLAN_ESE_UPLOAD */
#include "regdomain_common.h"
#include "vos_utils.h"
#include <wlan_logging_sock_svc.h>
#include "sme_nan_datapath.h"
#include "cfgApi.h"
#include "qdf_crypto.h"
#define MAX_PWR_FCC_CHAN_12 8
#define MAX_PWR_FCC_CHAN_13 2
#define CSR_NUM_IBSS_START_CHANNELS_50 4
#define CSR_NUM_IBSS_START_CHANNELS_24 3
/* 15 seconds, for WPA, WPA2, CCKM */
#define CSR_WAIT_FOR_KEY_TIMEOUT_PERIOD (15 * VOS_TIMER_TO_SEC_UNIT)
/* 120 seconds, for WPS */
#define CSR_WAIT_FOR_WPS_KEY_TIMEOUT_PERIOD (120 * VOS_TIMER_TO_SEC_UNIT)
/*---------------------------------------------------------------------------
OBIWAN recommends [8 10]% : pick 9%
---------------------------------------------------------------------------*/
#define CSR_VCC_UL_MAC_LOSS_THRESHOLD 9
/*---------------------------------------------------------------------------
OBIWAN recommends -85dBm
---------------------------------------------------------------------------*/
#define CSR_VCC_RSSI_THRESHOLD 80
#define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD 500 //ms
#define CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS 2000 //ms
#define CSR_MIN_TL_STAT_QUERY_PERIOD 500 //ms
//Flag to send/do not send disassoc frame over the air
#define CSR_DONT_SEND_DISASSOC_OVER_THE_AIR 1
#define RSSI_HACK_BMPS (-40)
#define MAX_CB_VALUE_IN_INI (2)
#define MAX_SOCIAL_CHANNELS 3
/* packet dump timer duration of 60 secs */
#define PKT_DUMP_TIMER_DURATION 60
int alloc_tfm(uint8_t *type);
#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
static tANI_BOOLEAN bRoamScanOffloadStarted = VOS_FALSE;
#endif
/*--------------------------------------------------------------------------
Static Type declarations
------------------------------------------------------------------------*/
static tCsrRoamSession csrRoamRoamSession[CSR_ROAM_SESSION_MAX];
/*--------------------------------------------------------------------------
Type declarations
------------------------------------------------------------------------*/
#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
int diagAuthTypeFromCSRType(eCsrAuthType authType)
{
int n = AUTH_OPEN;
switch(authType)
{
case eCSR_AUTH_TYPE_SHARED_KEY:
n = AUTH_SHARED;
break;
case eCSR_AUTH_TYPE_WPA:
n = AUTH_WPA_EAP;
break;
case eCSR_AUTH_TYPE_WPA_PSK:
n = AUTH_WPA_PSK;
break;
case eCSR_AUTH_TYPE_RSN:
#ifdef WLAN_FEATURE_11W
case eCSR_AUTH_TYPE_RSN_8021X_SHA256:
#endif
n = AUTH_WPA2_EAP;
break;
case eCSR_AUTH_TYPE_RSN_PSK:
#ifdef WLAN_FEATURE_11W
case eCSR_AUTH_TYPE_RSN_PSK_SHA256:
#endif
n = AUTH_WPA2_PSK;
break;
#ifdef FEATURE_WLAN_WAPI
case eCSR_AUTH_TYPE_WAPI_WAI_CERTIFICATE:
n = AUTH_WAPI_CERT;
break;
case eCSR_AUTH_TYPE_WAPI_WAI_PSK:
n = AUTH_WAPI_PSK;
break;
#endif /* FEATURE_WLAN_WAPI */
default:
break;
}
return (n);
}
int diagEncTypeFromCSRType(eCsrEncryptionType encType)
{
int n = ENC_MODE_OPEN;
switch(encType)
{
case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
case eCSR_ENCRYPT_TYPE_WEP40:
n = ENC_MODE_WEP40;
break;
case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
case eCSR_ENCRYPT_TYPE_WEP104:
n = ENC_MODE_WEP104;
break;
case eCSR_ENCRYPT_TYPE_TKIP:
n = ENC_MODE_TKIP;
break;
case eCSR_ENCRYPT_TYPE_AES:
n = ENC_MODE_AES;
break;
#ifdef FEATURE_WLAN_WAPI
case eCSR_ENCRYPT_TYPE_WPI:
n = ENC_MODE_SMS4;
break;
#endif /* FEATURE_WLAN_WAPI */
default:
break;
}
return (n);
}
#endif //#ifdef FEATURE_WLAN_DIAG_SUPPORT_CSR
static const tANI_U8 csrStartIbssChannels50[ CSR_NUM_IBSS_START_CHANNELS_50 ] = { 36, 40, 44, 48};
static const tANI_U8 csrStartIbssChannels24[ CSR_NUM_IBSS_START_CHANNELS_24 ] = { 1, 6, 11 };
static void initConfigParam(tpAniSirGlobal pMac);
static tANI_BOOLEAN csrRoamProcessResults( tpAniSirGlobal pMac, tSmeCmd *pCommand,
eCsrRoamCompleteResult Result, void *Context );
static eHalStatus csrRoamStartIbss( tpAniSirGlobal pMac, tANI_U32 sessionId,
tCsrRoamProfile *pProfile,
tANI_BOOLEAN *pfSameIbss );
static void csrRoamUpdateConnectedProfileFromNewBss( tpAniSirGlobal pMac, tANI_U32 sessionId, tSirSmeNewBssInfo *pNewBss );
static ePhyChanBondState csrGetCBModeFromIes(tpAniSirGlobal pMac, tANI_U8 primaryChn, tDot11fBeaconIEs *pIes);
eHalStatus csrInitGetChannels(tpAniSirGlobal pMac);
static void csrRoamingStateConfigCnfProcessor( tpAniSirGlobal pMac, tANI_U32 result );
eHalStatus csrRoamOpen(tpAniSirGlobal pMac);
eHalStatus csrRoamClose(tpAniSirGlobal pMac);
void csrRoamMICErrorTimerHandler(void *pv);
void csrRoamTKIPCounterMeasureTimerHandler(void *pv);
tANI_BOOLEAN csrRoamIsSameProfileKeys(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pConnProfile, tCsrRoamProfile *pProfile2);
static eHalStatus csrRoamStartRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId, tANI_U32 interval);
static eHalStatus csrRoamStopRoamingTimer(tpAniSirGlobal pMac, tANI_U32 sessionId);
static void csrRoamRoamingTimerHandler(void *pv);
eHalStatus csrRoamStartWaitForKeyTimer(tpAniSirGlobal pMac, tANI_U32 interval);
eHalStatus csrRoamStopWaitForKeyTimer(tpAniSirGlobal pMac);
static void csrRoamWaitForKeyTimeOutHandler(void *pv);
static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo);
static eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo);
static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo );
eHalStatus csrSendMBSetContextReqMsg( tpAniSirGlobal pMac, tANI_U32 sessionId,
tSirMacAddr peerMacAddr, tANI_U8 numKeys, tAniEdType edType,
tANI_BOOLEAN fUnicast, tAniKeyDirection aniKeyDirection,
tANI_U8 keyId, tANI_U8 keyLength, tANI_U8 *pKey, tANI_U8 paeRole,
tANI_U8 *pKeyRsc );
static eHalStatus csrRoamIssueReassociate( tpAniSirGlobal pMac, tANI_U32 sessionId,
tSirBssDescription *pSirBssDesc, tDot11fBeaconIEs *pIes,
tCsrRoamProfile *pProfile );
void csrRoamStatisticsTimerHandler(void *pv);
void csrRoamStatsGlobalClassDTimerHandler(void *pv);
static void csrRoamLinkUp(tpAniSirGlobal pMac, tCsrBssid bssid);
VOS_STATUS csrRoamVccTriggerRssiIndCallback(tHalHandle hHal,
v_U8_t rssiNotification,
void * context);
static void csrRoamLinkDown(tpAniSirGlobal pMac, tANI_U32 sessionId);
void csrRoamVccTrigger(tpAniSirGlobal pMac);
eHalStatus csrSendMBStatsReqMsg( tpAniSirGlobal pMac, tANI_U32 statsMask,
tANI_U8 staId, tANI_U8 sessionId);
/*
pStaEntry is no longer invalid upon the return of this function.
*/
static void csrRoamRemoveStatListEntry(tpAniSirGlobal pMac, tListElem *pEntry);
static eCsrCfgDot11Mode csrRoamGetPhyModeBandForBss( tpAniSirGlobal pMac, tCsrRoamProfile *pProfile,tANI_U8 operationChn, eCsrBand *pBand );
static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc);
tCsrStatsClientReqInfo * csrRoamInsertEntryIntoList( tpAniSirGlobal pMac,
tDblLinkList *pStaList,
tCsrStatsClientReqInfo *pStaEntry);
void csrRoamStatsClientTimerHandler(void *pv);
tCsrPeStatsReqInfo * csrRoamCheckPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask,
tANI_U32 periodicity,
tANI_BOOLEAN *pFound,
tANI_U8 staId,
tANI_U8 sessionId);
void csrRoamReportStatistics(tpAniSirGlobal pMac, tANI_U32 statsMask,
tCsrStatsCallback callback, tANI_U8 staId, void *pContext);
void csrRoamSaveStatsFromTl(tpAniSirGlobal pMac, WLANTL_TRANSFER_STA_TYPE *pTlStats);
void csrRoamTlStatsTimerHandler(void *pv);
void csrRoamPeStatsTimerHandler(void *pv);
tListElem * csrRoamCheckClientReqList(tpAniSirGlobal pMac, tANI_U32 statsMask);
void csrRoamRemoveEntryFromPeStatsReqList(tpAniSirGlobal pMac, tCsrPeStatsReqInfo *pPeStaEntry);
tListElem * csrRoamFindInPeStatsReqList(tpAniSirGlobal pMac, tANI_U32 statsMask);
eHalStatus csrRoamDeregStatisticsReq(tpAniSirGlobal pMac);
static tANI_U32 csrFindIbssSession( tpAniSirGlobal pMac );
static uint32_t csr_find_sap_session(tpAniSirGlobal pMac);
static uint32_t csr_find_p2pgo_session(tpAniSirGlobal pMac);
static bool csr_is_conn_allow_2g_band(tpAniSirGlobal pMac, uint32_t chnl);
static bool csr_is_conn_allow_5g_band(tpAniSirGlobal pMac, uint32_t chnl);
static eHalStatus csrRoamStartWds( tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamProfile *pProfile, tSirBssDescription *pBssDesc );
static void csrInitSession( tpAniSirGlobal pMac, tANI_U32 sessionId );
static eHalStatus csrRoamIssueSetKeyCommand( tpAniSirGlobal pMac, tANI_U32 sessionId,
tCsrRoamSetKey *pSetKey, tANI_U32 roamId );
static eHalStatus csrRoamGetQosInfoFromBss(tpAniSirGlobal pMac, tSirBssDescription *pBssDesc);
void csrRoamReissueRoamCommand(tpAniSirGlobal pMac);
extern void SysProcessMmhMsg(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
static void csrSerDesUnpackDiassocRsp(tANI_U8 *pBuf, tSirSmeDisassocRsp *pRsp);
void csrReinitPreauthCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand);
void csrInitOperatingClasses(tHalHandle hHal);
//Initialize global variables
static void csrRoamInitGlobals(tpAniSirGlobal pMac)
{
if(pMac)
{
vos_mem_zero(&csrRoamRoamSession, sizeof(csrRoamRoamSession));
pMac->roam.roamSession = csrRoamRoamSession;
}
return;
}
static void csrRoamDeInitGlobals(tpAniSirGlobal pMac)
{
if(pMac)
{
pMac->roam.roamSession = NULL;
}
return;
}
eHalStatus csrOpen(tpAniSirGlobal pMac)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tANI_U32 i;
do
{
/* Initialize CSR Roam Globals */
csrRoamInitGlobals(pMac);
for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
csrRoamStateChange( pMac, eCSR_ROAMING_STATE_STOP, i);
initConfigParam(pMac);
if(!HAL_STATUS_SUCCESS((status = csrScanOpen(pMac))))
break;
if(!HAL_STATUS_SUCCESS((status = csrRoamOpen(pMac))))
break;
pMac->roam.nextRoamId = 1; //Must not be 0
if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.statsClientReqList)))
break;
if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.peStatsReqList)))
break;
if(!HAL_STATUS_SUCCESS(csrLLOpen(pMac->hHdd, &pMac->roam.roamCmdPendingList)))
break;
}while(0);
return (status);
}
eHalStatus csr_init_chan_list(tpAniSirGlobal mac, v_U8_t *alpha2)
{
eHalStatus status;
v_REGDOMAIN_t reg_id;
v_CountryInfoSource_t source = COUNTRY_INIT;
mac->scan.countryCodeDefault[0] = alpha2[0];
mac->scan.countryCodeDefault[1] = alpha2[1];
mac->scan.countryCodeDefault[2] = alpha2[2];
smsLog(mac, LOGE, FL("init time country code %.2s"),
mac->scan.countryCodeDefault);
status = csrGetRegulatoryDomainForCountry(mac,
mac->scan.countryCodeDefault,
&reg_id, source);
if (status != eHAL_STATUS_SUCCESS)
{
smsLog(mac, LOGE, FL("csrGetRegulatoryDomainForCountry failed"));
return status;
}
if (vos_nv_setRegDomain(mac, reg_id, FALSE) != VOS_STATUS_SUCCESS)
{
smsLog(mac, LOGE, FL("vos_nv_setRegDomain failed"));
return eHAL_STATUS_FAILURE;
}
mac->scan.domainIdDefault = reg_id;
mac->scan.domainIdCurrent = mac->scan.domainIdDefault;
vos_mem_copy(mac->scan.countryCodeCurrent,
mac->scan.countryCodeDefault,
WNI_CFG_COUNTRY_CODE_LEN);
vos_mem_copy(mac->scan.countryCodeElected,
mac->scan.countryCodeDefault,
WNI_CFG_COUNTRY_CODE_LEN);
status = csrInitGetChannels(mac);
csrClearVotesForCountryInfo(mac);
return status;
}
eHalStatus csrSetRegInfo(tHalHandle hHal, tANI_U8 *apCntryCode)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
v_REGDOMAIN_t regId;
v_U8_t cntryCodeLength;
if(NULL == apCntryCode)
{
smsLog( pMac, LOGE, FL(" Invalid country Code Pointer") );
return eHAL_STATUS_FAILURE;
}
smsLog( pMac, LOG1, FL(" country Code %.2s"), apCntryCode );
/*
* To get correct Regulatory domain from NV table
* 2 character Country code should be used
* 3rd character is optional for indoor/outdoor setting
*/
cntryCodeLength = WNI_CFG_COUNTRY_CODE_LEN;
status = csrGetRegulatoryDomainForCountry(pMac, apCntryCode, &regId,
COUNTRY_USER);
if (status != eHAL_STATUS_SUCCESS)
{
smsLog( pMac, LOGE, FL(" fail to get regId for country Code %.2s"), apCntryCode );
return status;
}
status = WDA_SetRegDomain(hHal, regId, eSIR_TRUE);
if (status != eHAL_STATUS_SUCCESS)
{
smsLog( pMac, LOGE, FL(" fail to get regId for country Code %.2s"), apCntryCode );
return status;
}
pMac->scan.domainIdDefault = regId;
pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault;
/* Clear CC field */
vos_mem_set(pMac->scan.countryCodeDefault, WNI_CFG_COUNTRY_CODE_LEN, 0);
/* Copy 2 or 3 bytes country code */
vos_mem_copy(pMac->scan.countryCodeDefault, apCntryCode, cntryCodeLength);
/* If 2 bytes country code, 3rd byte must be filled with space */
if((WNI_CFG_COUNTRY_CODE_LEN - 1) == cntryCodeLength)
{
vos_mem_set(pMac->scan.countryCodeDefault + 2, 1, 0x20);
}
vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault,
WNI_CFG_COUNTRY_CODE_LEN);
status = csrInitGetChannels( pMac );
return status;
}
eHalStatus csrSetChannels(tHalHandle hHal, tCsrConfigParam *pParam )
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
tANI_U8 index = 0;
vos_mem_copy(pParam->Csr11dinfo.countryCode, pMac->scan.countryCodeCurrent,
WNI_CFG_COUNTRY_CODE_LEN);
for ( index = 0; index < pMac->scan.base20MHzChannels.numChannels ; index++)
{
pParam->Csr11dinfo.Channels.channelList[index] = pMac->scan.base20MHzChannels.channelList[ index ];
pParam->Csr11dinfo.ChnPower[index].firstChannel = pMac->scan.base20MHzChannels.channelList[ index ];
pParam->Csr11dinfo.ChnPower[index].numChannels = 1;
pParam->Csr11dinfo.ChnPower[index].maxtxPower = pMac->scan.defaultPowerTable[index].pwr;
}
pParam->Csr11dinfo.Channels.numChannels = pMac->scan.base20MHzChannels.numChannels;
return status;
}
eHalStatus csrClose(tpAniSirGlobal pMac)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
csrRoamClose(pMac);
csrScanClose(pMac);
csrLLClose(&pMac->roam.statsClientReqList);
csrLLClose(&pMac->roam.peStatsReqList);
csrLLClose(&pMac->roam.roamCmdPendingList);
/* DeInit Globals */
csrRoamDeInitGlobals(pMac);
return (status);
}
static tChannelPwrLimit csrFindChannelPwr(tChannelListWithPower * pdefaultPowerTable,
tANI_U8 ChannelNum)
{
tANI_U8 i;
// TODO: if defaultPowerTable is guaranteed to be in ascending
// order of channel numbers, we can employ binary search
for (i = 0; i < WNI_CFG_VALID_CHANNEL_LIST_LEN; i++)
{
if (pdefaultPowerTable[i].chanId == ChannelNum)
return pdefaultPowerTable[i].pwr;
}
/* Could not find the channel list in default list
this should not have occurred */
VOS_ASSERT(0);
return 0;
}
eHalStatus csrUpdateChannelList(tpAniSirGlobal pMac)
{
tSirUpdateChanList *pChanList;
tCsrScanStruct *pScan = &pMac->scan;
tANI_U8 numChan = pScan->base20MHzChannels.numChannels;
tANI_U8 num_channel = 0;
tANI_U32 bufLen;
vos_msg_t msg;
tANI_U8 i;
tANI_U8 channel_state;
uint16_t unsafe_chan[NUM_20MHZ_RF_CHANNELS];
uint16_t unsafe_chan_cnt = 0;
uint16_t cnt = 0;
uint8_t channel;
bool is_unsafe_chan;
#ifdef WLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY
int j, social_channel[MAX_SOCIAL_CHANNELS] = {1,6,11};
#endif
vos_get_wlan_unsafe_channel(unsafe_chan,
&unsafe_chan_cnt,
sizeof(unsafe_chan));
#ifdef WLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY
if (CSR_IS_5G_BAND_ONLY(pMac))
{
for (i = 0; i < MAX_SOCIAL_CHANNELS; i++)
{
/* Scan is not performed on DSRC channels*/
if (pScan->baseChannels.channelList[i] >= MIN_11P_CHANNEL)
continue;
if (vos_nv_getChannelEnabledState(social_channel[i])
== NV_CHANNEL_ENABLE)
numChan++;
}
}
#endif
bufLen = sizeof(tSirUpdateChanList) +
(sizeof(tSirUpdateChanParam) * (numChan));
csrInitOperatingClasses((tHalHandle)pMac);
pChanList = (tSirUpdateChanList *) vos_mem_malloc(bufLen);
if (!pChanList)
{
VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_ERROR,
"Failed to allocate memory for tSirUpdateChanList");
return eHAL_STATUS_FAILED_ALLOC;
}
vos_mem_zero(pChanList, bufLen);
for (i = 0; i < pScan->base20MHzChannels.numChannels; i++)
{
if (vos_is_dsrc_channel(vos_chan_to_freq(
pScan->base20MHzChannels.channelList[i])))
continue;
channel = pScan->base20MHzChannels.channelList[i];
channel_state =
vos_nv_getChannelEnabledState(channel);
if ((NV_CHANNEL_ENABLE == channel_state) ||
pMac->scan.fEnableDFSChnlScan)
{
if ((pMac->roam.configParam.sta_roam_policy.dfs_mode ==
CSR_STA_ROAM_POLICY_DFS_DISABLED) &&
(channel_state == NV_CHANNEL_DFS)) {
smsLog(pMac, LOG1, FL("skip dfs channel %d"), channel);
continue;
}
if (pMac->roam.configParam.sta_roam_policy.skip_unsafe_channels &&
unsafe_chan_cnt) {
is_unsafe_chan = false;
for (cnt = 0; cnt < unsafe_chan_cnt; cnt++) {
if (unsafe_chan[cnt] == channel) {
is_unsafe_chan = true;
break;
}
}
if ((is_unsafe_chan) && ((CSR_IS_CHANNEL_24GHZ(channel) &&
pMac->roam.configParam.sta_roam_policy.sap_operating_band ==
eCSR_BAND_24) ||
(CSR_IS_CHANNEL_5GHZ(channel) &&
pMac->roam.configParam.sta_roam_policy.sap_operating_band ==
eCSR_BAND_5G))) {
smsLog(pMac, LOG1,
FL("ignoring unsafe channel %d"), channel);
continue;
}
}
pChanList->chanParam[num_channel].chanId =
pScan->base20MHzChannels.channelList[i];
pChanList->chanParam[num_channel].pwr =
csrFindChannelPwr(pScan->defaultPowerTable,
pChanList->chanParam[num_channel].chanId);
if (pScan->fcc_constraint) {
if (pChanList->chanParam[num_channel].chanId == 12) {
pChanList->chanParam[num_channel].pwr =
MAX_PWR_FCC_CHAN_12;
smsLog(pMac, LOG1,
"fcc_constraint is set, txpower for channel 12 is 8db");
}
if (pChanList->chanParam[num_channel].chanId == 13) {
pChanList->chanParam[num_channel].pwr =
MAX_PWR_FCC_CHAN_13;
smsLog(pMac, LOG1,
"fcc_constraint is set, txpower for channel 13 is 2db");
}
}
if (NV_CHANNEL_ENABLE == channel_state)
pChanList->chanParam[num_channel].dfsSet = VOS_FALSE;
else
pChanList->chanParam[num_channel].dfsSet = VOS_TRUE;
if (pMac->sub20_channelwidth == SUB20_MODE_5MHZ)
pChanList->chanParam[num_channel].quarter_rate = VOS_TRUE;
else if (pMac->sub20_channelwidth == SUB20_MODE_10MHZ)
pChanList->chanParam[num_channel].half_rate = VOS_TRUE;
num_channel++;
}
}
#ifdef WLAN_ENABLE_SOCIAL_CHANNELS_5G_ONLY
if (CSR_IS_5G_BAND_ONLY(pMac))
{
for (j = 0; j < MAX_SOCIAL_CHANNELS; j++)
{
if (vos_nv_getChannelEnabledState(social_channel[j])
== NV_CHANNEL_ENABLE)
{
pChanList->chanParam[num_channel].chanId = social_channel[j];
pChanList->chanParam[num_channel].pwr =
csrFindChannelPwr(pScan->defaultPowerTable,
social_channel[j]);
pChanList->chanParam[num_channel].dfsSet = VOS_FALSE;
if (pMac->sub20_channelwidth == SUB20_MODE_5MHZ)
pChanList->chanParam[num_channel].quarter_rate =
VOS_TRUE;
else if (pMac->sub20_channelwidth == SUB20_MODE_10MHZ)
pChanList->chanParam[num_channel].half_rate =
VOS_TRUE;
num_channel++;
}
}
}
#endif
if ((pMac->roam.configParam.uCfgDot11Mode == eCSR_CFG_DOT11_MODE_AUTO) ||
(pMac->roam.configParam.uCfgDot11Mode ==
eCSR_CFG_DOT11_MODE_11AC) ||
(pMac->roam.configParam.uCfgDot11Mode ==
eCSR_CFG_DOT11_MODE_11AC_ONLY)) {
pChanList->vht_en = true;
if (pMac->roam.configParam.enableVhtFor24GHz)
pChanList->vht_24_en = true;
}
if ((pMac->roam.configParam.uCfgDot11Mode == eCSR_CFG_DOT11_MODE_AUTO) ||
(pMac->roam.configParam.uCfgDot11Mode ==
eCSR_CFG_DOT11_MODE_11N) ||
(pMac->roam.configParam.uCfgDot11Mode ==
eCSR_CFG_DOT11_MODE_11N_ONLY)) {
pChanList->ht_en = true;
}
msg.type = WDA_UPDATE_CHAN_LIST_REQ;
msg.reserved = 0;
msg.bodyptr = pChanList;
pChanList->numChan = num_channel;
MTRACE(vos_trace(VOS_MODULE_ID_SME, TRACE_CODE_SME_TX_WDA_MSG, NO_SESSION,
msg.type));
if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MODULE_ID_WDA, &msg))
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
"%s: Failed to post msg to WDA", __func__);
vos_mem_free(pChanList);
return eHAL_STATUS_FAILURE;
}
return eHAL_STATUS_SUCCESS;
}
eHalStatus csrStart(tpAniSirGlobal pMac)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tANI_U32 i;
do
{
//save the global vos context
pMac->roam.gVosContext = vos_get_global_context(VOS_MODULE_ID_SME, pMac);
for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
csrRoamStateChange( pMac, eCSR_ROAMING_STATE_IDLE, i );
status = csrRoamStart(pMac);
if(!HAL_STATUS_SUCCESS(status)) break;
pMac->scan.f11dInfoApplied = eANI_BOOLEAN_FALSE;
if(!pMac->psOffloadEnabled)
{
status = pmcRegisterPowerSaveCheck(pMac, csrCheckPSReady, pMac);
if(!HAL_STATUS_SUCCESS(status)) break;
}
else
{
for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
{
status = pmcOffloadRegisterPowerSaveCheck(pMac, i,
csrCheckPSOffloadReady, pMac);
if(!HAL_STATUS_SUCCESS(status))
{
smsLog(pMac, LOGE,
"csrStart: Register Power Check Failed Session Id %x", i);
return status;
}
}
}
pMac->roam.sPendingCommands = 0;
csrScanEnable(pMac);
#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
for (i = 0; i < CSR_ROAM_SESSION_MAX; i++)
status = csrNeighborRoamInit(pMac, i);
#endif /* WLAN_FEATURE_NEIGHBOR_ROAMING */
pMac->roam.tlStatsReqInfo.numClient = 0;
pMac->roam.tlStatsReqInfo.periodicity = 0;
pMac->roam.tlStatsReqInfo.timerRunning = FALSE;
//init the link quality indication also
pMac->roam.vccLinkQuality = eCSR_ROAM_LINK_QUAL_MIN_IND;
if(!HAL_STATUS_SUCCESS(status))
{
smsLog(pMac, LOGW, " csrStart: Couldn't Init HO control blk ");
break;
}
if (pMac->fScanOffload)
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
"Scan offload is enabled, update default chan list");
status = csrUpdateChannelList(pMac);
}
}while(0);
#if defined(ANI_LOGDUMP)
csrDumpInit(pMac);
#endif //#if defined(ANI_LOGDUMP)
return (status);
}
eHalStatus csrStop(tpAniSirGlobal pMac, tHalStopType stopType)
{
tANI_U32 sessionId;
for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
{
csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL);
}
csrScanDisable(pMac);
pMac->scan.fCancelIdleScan = eANI_BOOLEAN_FALSE;
pMac->scan.fRestartIdleScan = eANI_BOOLEAN_FALSE;
csrLLPurge( &pMac->roam.roamCmdPendingList, eANI_BOOLEAN_TRUE );
#if defined WLAN_FEATURE_NEIGHBOR_ROAMING
for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
csrNeighborRoamClose(pMac, sessionId);
#endif
for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
if (CSR_IS_SESSION_VALID(pMac, sessionId))
csrScanFlushResult(pMac, sessionId);
// deregister from PMC since we register during csrStart()
// (ignore status since there is nothing we can do if it fails)
if(!pMac->psOffloadEnabled)
{
(void) pmcDeregisterPowerSaveCheck(pMac, csrCheckPSReady);
}
else
{
for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
{
pmcOffloadDeregisterPowerSaveCheck(pMac, sessionId,
csrCheckPSOffloadReady);
}
}
/* Reset the domain back to the default */
pMac->scan.domainIdCurrent = pMac->scan.domainIdDefault;
for (sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++) {
csrRoamStateChange(pMac, eCSR_ROAMING_STATE_STOP, sessionId);
pMac->roam.curSubState[sessionId] = eCSR_ROAM_SUBSTATE_NONE;
}
#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
/* When HAL resets all the context information
* in HAL is lost, so we might need to send the
* scan offload request again when it comes
* out of reset for scan offload to be functional
*/
if (HAL_STOP_TYPE_SYS_RESET == stopType)
{
bRoamScanOffloadStarted = VOS_FALSE;
}
#endif
return (eHAL_STATUS_SUCCESS);
}
eHalStatus csrReady(tpAniSirGlobal pMac)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
csrScanGetSupportedChannels( pMac );
//WNI_CFG_VALID_CHANNEL_LIST should be set by this time
//use it to init the background scan list
csrInitBGScanChannelList(pMac);
status = csrInitChannelList( pMac );
if ( ! HAL_STATUS_SUCCESS( status ) )
{
smsLog( pMac, LOGE, "csrInitChannelList failed during csrReady with status=%d",
status );
}
return (status);
}
void csrSetDefaultDot11Mode( tpAniSirGlobal pMac )
{
v_U32_t wniDot11mode = 0;
wniDot11mode = csrTranslateToWNICfgDot11Mode(pMac,pMac->roam.configParam.uCfgDot11Mode);
ccmCfgSetInt(pMac, WNI_CFG_DOT11_MODE, wniDot11mode, NULL, eANI_BOOLEAN_FALSE);
}
void csrSetGlobalCfgs( tpAniSirGlobal pMac )
{
ccmCfgSetInt(pMac, WNI_CFG_FRAGMENTATION_THRESHOLD, csrGetFragThresh(pMac), NULL, eANI_BOOLEAN_FALSE);
ccmCfgSetInt(pMac, WNI_CFG_RTS_THRESHOLD, csrGetRTSThresh(pMac), NULL, eANI_BOOLEAN_FALSE);
ccmCfgSetInt(pMac, WNI_CFG_11D_ENABLED,
((pMac->roam.configParam.Is11hSupportEnabled) ? pMac->roam.configParam.Is11dSupportEnabled : pMac->roam.configParam.Is11dSupportEnabled),
NULL, eANI_BOOLEAN_FALSE);
ccmCfgSetInt(pMac, WNI_CFG_11H_ENABLED, pMac->roam.configParam.Is11hSupportEnabled, NULL, eANI_BOOLEAN_FALSE);
/* For now we will just use the 5GHz CB mode ini parameter to decide whether CB supported or not in Probes when there is no session
* Once session is established we will use the session related params stored in PE session for CB mode
*/
ccmCfgSetInt(pMac, WNI_CFG_CHANNEL_BONDING_MODE, !!(pMac->roam.configParam.channelBondingMode5GHz), NULL, eANI_BOOLEAN_FALSE);
ccmCfgSetInt(pMac, WNI_CFG_HEART_BEAT_THRESHOLD, pMac->roam.configParam.HeartbeatThresh24, NULL, eANI_BOOLEAN_FALSE);
//Update the operating mode to configured value during initialization,
//So that client can advertise full capabilities in Probe request frame.
csrSetDefaultDot11Mode( pMac );
}
/**
* csr_packetdump_timer_handler() - packet dump timer
* handler
* @pv: user data
*
* This function is used to handle packet dump timer
*
* Return: None
*
*/
static void csr_packetdump_timer_handler(void *pv)
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
"%s Invoking packetdump deregistration API", __func__);
wlan_deregister_txrx_packetdump();
}
/**
* csr_packetdump_timer_stop() - stops packet dump timer
*
* This function is used to stop packet dump timer
*
* Return: None
*
*/
void csr_packetdump_timer_stop(void)
{
eHalStatus status;
tHalHandle hal;
tpAniSirGlobal mac;
v_CONTEXT_t vos_ctx_ptr;
/* get the global voss context */
vos_ctx_ptr = vos_get_global_context(VOS_MODULE_ID_VOSS, NULL);
if (NULL == vos_ctx_ptr) {
VOS_ASSERT(0);
return;
}
hal = vos_get_context(VOS_MODULE_ID_SME, vos_ctx_ptr);
if (NULL == hal) {
VOS_ASSERT(0);
return;
}
mac = PMAC_STRUCT(hal);
status = vos_timer_stop(&mac->roam.packetdump_timer);
if (!HAL_STATUS_SUCCESS(status)) {
smsLog(mac, LOGE, FL("cannot stop packetdump timer"));
}
}
eHalStatus csrRoamOpen(tpAniSirGlobal pMac)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tANI_U32 i;
tCsrRoamSession *pSession;
do
{
for( i = 0; i < CSR_ROAM_SESSION_MAX; i++ )
{
pSession = CSR_GET_SESSION( pMac, i );
pSession->roamingTimerInfo.pMac = pMac;
pSession->roamingTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
}
pMac->roam.WaitForKeyTimerInfo.pMac = pMac;
pMac->roam.WaitForKeyTimerInfo.sessionId = CSR_SESSION_ID_INVALID;
status = vos_timer_init(&pMac->roam.hTimerWaitForKey, VOS_TIMER_TYPE_SW,
csrRoamWaitForKeyTimeOutHandler,
&pMac->roam.WaitForKeyTimerInfo);
if (!HAL_STATUS_SUCCESS(status))
{
smsLog(pMac, LOGE, FL("cannot allocate memory for WaitForKey time out timer"));
break;
}
status = vos_timer_init(&pMac->roam.packetdump_timer, VOS_TIMER_TYPE_SW,
csr_packetdump_timer_handler, pMac);
if (!HAL_STATUS_SUCCESS(status)) {
smsLog(pMac, LOGE, FL("cannot allocate memory for packetdump timer"));
break;
}
status = vos_timer_init(&pMac->roam.tlStatsReqInfo.hTlStatsTimer,
VOS_TIMER_TYPE_SW, csrRoamTlStatsTimerHandler, pMac);
if (!HAL_STATUS_SUCCESS(status))
{
smsLog(pMac, LOGE, FL("cannot allocate memory for summary Statistics timer"));
return eHAL_STATUS_FAILURE;
}
}while (0);
return (status);
}
eHalStatus csrRoamClose(tpAniSirGlobal pMac)
{
tANI_U32 sessionId;
for(sessionId = 0; sessionId < CSR_ROAM_SESSION_MAX; sessionId++)
{
csrRoamCloseSession(pMac, sessionId, TRUE, NULL, NULL);
}
vos_timer_stop(&pMac->roam.hTimerWaitForKey);
vos_timer_destroy(&pMac->roam.hTimerWaitForKey);
vos_timer_stop(&pMac->roam.tlStatsReqInfo.hTlStatsTimer);
vos_timer_destroy(&pMac->roam.tlStatsReqInfo.hTlStatsTimer);
vos_timer_stop(&pMac->roam.packetdump_timer);
vos_timer_destroy(&pMac->roam.packetdump_timer);
return (eHAL_STATUS_SUCCESS);
}
eHalStatus csrRoamStart(tpAniSirGlobal pMac)
{
(void)pMac;
return (eHAL_STATUS_SUCCESS);
}
void csrRoamStop(tpAniSirGlobal pMac, tANI_U32 sessionId)
{
csrRoamStopRoamingTimer(pMac, sessionId);
/* deregister the clients requesting stats from PE/TL & also stop the corresponding timers*/
csrRoamDeregStatisticsReq(pMac);
}
eHalStatus csrRoamGetConnectState(tpAniSirGlobal pMac, tANI_U32 sessionId, eCsrConnectState *pState)
{
eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
if ( CSR_IS_SESSION_VALID(pMac, sessionId) && (NULL != pState) )
{
status = eHAL_STATUS_SUCCESS;
*pState = pMac->roam.roamSession[sessionId].connectState;
}
return (status);
}
eHalStatus csrRoamCopyConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile)
{
eHalStatus status = eHAL_STATUS_FAILURE;
tANI_U32 size = 0;
tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId );
if(!pSession)
{
smsLog(pMac, LOGE, FL(" session %d not found "), sessionId);
return eHAL_STATUS_FAILURE;
}
if(pProfile)
{
if(pSession->pConnectBssDesc)
{
do
{
size = pSession->pConnectBssDesc->length + sizeof(pSession->pConnectBssDesc->length);
if(size)
{
pProfile->pBssDesc = vos_mem_malloc(size);
if ( NULL != pProfile->pBssDesc )
{
vos_mem_copy(pProfile->pBssDesc,
pSession->pConnectBssDesc, size);
status = eHAL_STATUS_SUCCESS;
}
else
break;
}
else
{
pProfile->pBssDesc = NULL;
}
pProfile->AuthType = pSession->connectedProfile.AuthType;
pProfile->EncryptionType = pSession->connectedProfile.EncryptionType;
pProfile->mcEncryptionType = pSession->connectedProfile.mcEncryptionType;
pProfile->BSSType = pSession->connectedProfile.BSSType;
pProfile->operationChannel = pSession->connectedProfile.operationChannel;
pProfile->CBMode = pSession->connectedProfile.CBMode;
vos_mem_copy(&pProfile->bssid, &pSession->connectedProfile.bssid,
sizeof(tCsrBssid));
vos_mem_copy(&pProfile->SSID, &pSession->connectedProfile.SSID,
sizeof(tSirMacSSid));
#ifdef WLAN_FEATURE_VOWIFI_11R
if (pSession->connectedProfile.MDID.mdiePresent)
{
pProfile->MDID.mdiePresent = 1;
pProfile->MDID.mobilityDomain = pSession->connectedProfile.MDID.mobilityDomain;
}
else
{
pProfile->MDID.mdiePresent = 0;
pProfile->MDID.mobilityDomain = 0;
}
#endif
#ifdef FEATURE_WLAN_ESE
pProfile->isESEAssoc = pSession->connectedProfile.isESEAssoc;
if (csrIsAuthTypeESE(pSession->connectedProfile.AuthType))
{
vos_mem_copy (pProfile->eseCckmInfo.krk,
pSession->connectedProfile.eseCckmInfo.krk,
SIR_KRK_KEY_LEN);
#ifdef WLAN_FEATURE_ROAM_OFFLOAD
vos_mem_copy (pProfile->eseCckmInfo.btk,
pSession->connectedProfile.eseCckmInfo.btk,
SIR_BTK_KEY_LEN);
#endif
pProfile->eseCckmInfo.reassoc_req_num=
pSession->connectedProfile.eseCckmInfo.reassoc_req_num;
pProfile->eseCckmInfo.krk_plumbed =
pSession->connectedProfile.eseCckmInfo.krk_plumbed;
}
#endif
}while(0);
}
}
return (status);
}
eHalStatus csrRoamGetConnectProfile(tpAniSirGlobal pMac, tANI_U32 sessionId, tCsrRoamConnectedProfile *pProfile)
{
eHalStatus status = eHAL_STATUS_FAILURE;
if((csrIsConnStateConnected(pMac, sessionId)) ||
(csrIsConnStateIbss(pMac, sessionId)))
{
if(pProfile)
{
status = csrRoamCopyConnectProfile(pMac, sessionId, pProfile);
}
}
return (status);
}
eHalStatus csrRoamFreeConnectProfile(tpAniSirGlobal pMac, tCsrRoamConnectedProfile *pProfile)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
if (pProfile->pBssDesc)
{
vos_mem_free(pProfile->pBssDesc);
}
if (pProfile->pAddIEAssoc)
{
vos_mem_free(pProfile->pAddIEAssoc);
}
vos_mem_set(pProfile, sizeof(tCsrRoamConnectedProfile), 0);
pProfile->AuthType = eCSR_AUTH_TYPE_UNKNOWN;
return (status);
}
static eHalStatus csrRoamFreeConnectedInfo( tpAniSirGlobal pMac, tCsrRoamConnectedInfo *pConnectedInfo )
{
eHalStatus status = eHAL_STATUS_SUCCESS;
if( pConnectedInfo->pbFrames )
{
vos_mem_free(pConnectedInfo->pbFrames);
pConnectedInfo->pbFrames = NULL;
}
pConnectedInfo->nBeaconLength = 0;
pConnectedInfo->nAssocReqLength = 0;
pConnectedInfo->nAssocRspLength = 0;
pConnectedInfo->staId = 0;
#ifdef WLAN_FEATURE_VOWIFI_11R
pConnectedInfo->nRICRspLength = 0;
#endif
#ifdef FEATURE_WLAN_ESE
pConnectedInfo->nTspecIeLength = 0;
#endif
return ( status );
}
void csrReleaseCommandPreauth(tpAniSirGlobal pMac, tSmeCmd *pCommand)
{
csrReinitPreauthCmd(pMac, pCommand);
csrReleaseCommand( pMac, pCommand );
}
void csrReleaseCommandRoam(tpAniSirGlobal pMac, tSmeCmd *pCommand)
{
csrReinitRoamCmd(pMac, pCommand);
csrReleaseCommand( pMac, pCommand );
}
void csrReleaseCommandScan(tpAniSirGlobal pMac, tSmeCmd *pCommand)
{
csrReinitScanCmd(pMac, pCommand);
csrReleaseCommand( pMac, pCommand );
}
void csrReleaseCommandWmStatusChange(tpAniSirGlobal pMac, tSmeCmd *pCommand)
{
csrReinitWmStatusChangeCmd(pMac, pCommand);
csrReleaseCommand( pMac, pCommand );
}
void csrReinitSetKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
{
vos_mem_set(&pCommand->u.setKeyCmd, sizeof(tSetKeyCmd), 0);
}
void csrReinitRemoveKeyCmd(tpAniSirGlobal pMac, tSmeCmd *pCommand)
{
vos_mem_set(&pCommand->u.removeKeyCmd, sizeof(tRemoveKeyCmd), 0);
}
void csrReleaseCommandSetKey(tpAniSirGlobal pMac, tSmeCmd *pCommand)
{
csrReinitSetKeyCmd(pMac, pCommand);
csrReleaseCommand( pMac, pCommand );
}
void csrReleaseCommandRemoveKey(tpAniSirGlobal pMac, tSmeCmd *pCommand)
{
csrReinitRemoveKeyCmd(pMac, pCommand);
csrReleaseCommand( pMac, pCommand );
}
void csrAbortCommand( tpAniSirGlobal pMac, tSmeCmd *pCommand, tANI_BOOLEAN fStopping )
{
if( eSmeCsrCommandMask & pCommand->command )
{
switch (pCommand->command)
{
case eSmeCommandScan:
// We need to inform the requester before dropping the scan command
smsLog( pMac, LOGW, "%s: Drop scan reason %d callback %pK",
__func__, pCommand->u.scanCmd.reason,
pCommand->u.scanCmd.callback);
if (NULL != pCommand->u.scanCmd.callback)
{
smsLog( pMac, LOGW, "%s callback scan requester", __func__);
csrScanCallCallback(pMac, pCommand, eCSR_SCAN_ABORT);
}
csrReleaseCommandScan( pMac, pCommand );
break;
case eSmeCommandRoam:
csrReleaseCommandRoam( pMac, pCommand );
break;
case eSmeCommandWmStatusChange:
csrReleaseCommandWmStatusChange( pMac, pCommand );
break;
case eSmeCommandSetKey:
csrReleaseCommandSetKey( pMac, pCommand );
break;
case eSmeCommandRemoveKey:
csrReleaseCommandRemoveKey( pMac, pCommand );
break;
case eSmeCommandNdpInitiatorRequest:
csr_release_ndp_initiator_req(pMac, pCommand);
break;
case eSmeCommandNdpResponderRequest:
csr_release_ndp_responder_req(pMac, pCommand);
break;
case eSmeCommandNdpDataEndInitiatorRequest:
csr_release_ndp_data_end_req(pMac, pCommand);
break;
default:
smsLog( pMac, LOGW, " CSR abort standard command %d", pCommand->command );
csrReleaseCommand( pMac, pCommand );
break;
}
}
}
void csrRoamSubstateChange( tpAniSirGlobal pMac, eCsrRoamSubState NewSubstate, tANI_U32 sessionId)
{
smsLog(pMac, LOG1, FL("CSR RoamSubstate: [ %s <== %s ]"),
macTraceGetcsrRoamSubState(NewSubstate),
macTraceGetcsrRoamSubState(pMac->roam.curSubState[sessionId]));
if(pMac->roam.curSubState[sessionId] == NewSubstate)
{
return;
}
pMac->roam.curSubState[sessionId] = NewSubstate;
}
eCsrRoamState csrRoamStateChange( tpAniSirGlobal pMac, eCsrRoamState NewRoamState, tANI_U8 sessionId)
{
eCsrRoamState PreviousState;
smsLog(pMac, LOG1, FL("CSR RoamState[%hu]: [ %s <== %s ]"), sessionId,
macTraceGetcsrRoamState(NewRoamState),
macTraceGetcsrRoamState(pMac->roam.curState[sessionId]));
PreviousState = pMac->roam.curState[sessionId];
if ( NewRoamState != pMac->roam.curState[sessionId] )
{
// Whenever we transition OUT of the Roaming state, clear the Roaming substate...
if ( CSR_IS_ROAM_JOINING(pMac, sessionId) )
{
csrRoamSubstateChange( pMac, eCSR_ROAM_SUBSTATE_NONE, sessionId );
}
pMac->roam.curState[sessionId] = NewRoamState;
}
return( PreviousState );
}
void csrAssignRssiForCategory(tpAniSirGlobal pMac, tANI_S8 bestApRssi, tANI_U8 catOffset)
{
int i;
smsLog(pMac, LOG2, FL("best AP RSSI:%d, cat offset:%d"), bestApRssi,
catOffset);
if(catOffset)
{
pMac->roam.configParam.bCatRssiOffset = catOffset;
for(i = 0; i < CSR_NUM_RSSI_CAT; i++)
{
pMac->roam.configParam.RSSICat[CSR_NUM_RSSI_CAT - i - 1] = (int)bestApRssi - pMac->roam.configParam.nSelect5GHzMargin - (int)(i * catOffset);
}
}
}
static void initConfigParam(tpAniSirGlobal pMac)
{
int i;
pMac->roam.configParam.agingCount = CSR_AGING_COUNT;
pMac->roam.configParam.channelBondingMode24GHz = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
pMac->roam.configParam.channelBondingMode5GHz = WNI_CFG_CHANNEL_BONDING_MODE_ENABLE;
pMac->roam.configParam.phyMode = eCSR_DOT11_MODE_AUTO;
pMac->roam.configParam.eBand = eCSR_BAND_ALL;
pMac->roam.configParam.uCfgDot11Mode = eCSR_CFG_DOT11_MODE_AUTO;
pMac->roam.configParam.FragmentationThreshold = eCSR_DOT11_FRAG_THRESH_DEFAULT;
pMac->roam.configParam.HeartbeatThresh24 = 40;
pMac->roam.configParam.HeartbeatThresh50 = 40;
pMac->roam.configParam.Is11dSupportEnabled = eANI_BOOLEAN_FALSE;
pMac->roam.configParam.Is11dSupportEnabledOriginal = eANI_BOOLEAN_FALSE;
pMac->roam.configParam.Is11eSupportEnabled = eANI_BOOLEAN_TRUE;
pMac->roam.configParam.Is11hSupportEnabled = eANI_BOOLEAN_TRUE;
pMac->roam.configParam.RTSThreshold = 2346;
pMac->roam.configParam.shortSlotTime = eANI_BOOLEAN_TRUE;
pMac->roam.configParam.WMMSupportMode = eCsrRoamWmmAuto;
pMac->roam.configParam.ProprietaryRatesEnabled = eANI_BOOLEAN_TRUE;
pMac->roam.configParam.TxRate = eCSR_TX_RATE_AUTO;
pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL;
pMac->roam.configParam.scanAgeTimeNCNPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_NO_PS;
pMac->roam.configParam.scanAgeTimeNCPS = CSR_SCAN_AGING_TIME_NOT_CONNECT_W_PS;
pMac->roam.configParam.scanAgeTimeCNPS = CSR_SCAN_AGING_TIME_CONNECT_NO_PS;
pMac->roam.configParam.scanAgeTimeCPS = CSR_SCAN_AGING_TIME_CONNECT_W_PS;
for(i = 0; i < CSR_NUM_RSSI_CAT; i++)
{
pMac->roam.configParam.BssPreferValue[i] = i;
}
csrAssignRssiForCategory(pMac, CSR_BEST_RSSI_VALUE, CSR_DEFAULT_RSSI_DB_GAP);
pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME;
pMac->roam.configParam.fEnforce11dChannels = eANI_BOOLEAN_FALSE;
pMac->roam.configParam.fSupplicantCountryCodeHasPriority = eANI_BOOLEAN_FALSE;
pMac->roam.configParam.fEnforceCountryCodeMatch = eANI_BOOLEAN_FALSE;
pMac->roam.configParam.fEnforceDefaultDomain = eANI_BOOLEAN_FALSE;
pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME;
pMac->roam.configParam.nActiveMinChnTime = CSR_ACTIVE_MIN_CHANNEL_TIME;
pMac->roam.configParam.nPassiveMaxChnTime = CSR_PASSIVE_MAX_CHANNEL_TIME;
pMac->roam.configParam.nPassiveMinChnTime = CSR_PASSIVE_MIN_CHANNEL_TIME;
pMac->roam.configParam.disableAggWithBtc = eANI_BOOLEAN_TRUE;
#ifdef WLAN_AP_STA_CONCURRENCY
pMac->roam.configParam.nActiveMaxChnTimeConc = CSR_ACTIVE_MAX_CHANNEL_TIME_CONC;
pMac->roam.configParam.nActiveMinChnTimeConc = CSR_ACTIVE_MIN_CHANNEL_TIME_CONC;
pMac->roam.configParam.nPassiveMaxChnTimeConc = CSR_PASSIVE_MAX_CHANNEL_TIME_CONC;
pMac->roam.configParam.nPassiveMinChnTimeConc = CSR_PASSIVE_MIN_CHANNEL_TIME_CONC;
pMac->roam.configParam.nRestTimeConc = CSR_REST_TIME_CONC;
pMac->roam.configParam.min_rest_time_conc = CSR_MIN_REST_TIME_CONC;
pMac->roam.configParam.idle_time_conc = CSR_IDLE_TIME_CONC;
#endif
pMac->roam.configParam.IsIdleScanEnabled = TRUE; //enable the idle scan by default
pMac->roam.configParam.nTxPowerCap = CSR_MAX_TX_POWER;
pMac->roam.configParam.allow_tpc_from_ap = TRUE;
pMac->roam.configParam.statsReqPeriodicity = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD;
pMac->roam.configParam.statsReqPeriodicityInPS = CSR_MIN_GLOBAL_STAT_QUERY_PERIOD_IN_BMPS;
#ifdef WLAN_FEATURE_VOWIFI_11R
pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported = 0;
#endif
#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries = 3;
pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold = 120;
pMac->roam.configParam.neighborRoamConfig.nOpportunisticThresholdDiff = 30;
pMac->roam.configParam.neighborRoamConfig.nRoamRescanRssiDiff = 5;
pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold = 125;
pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime = 20;
pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime = 40;
pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod = 200;
pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels = 3;
pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[0] = 1;
pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[1] = 6;
pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[2] = 11;
pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod = 20000; //20 seconds
pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod = 0;
pMac->roam.configParam.neighborRoamConfig.nRoamBmissFirstBcnt = 10;
pMac->roam.configParam.neighborRoamConfig.nRoamBmissFinalBcnt = 10;
pMac->roam.configParam.neighborRoamConfig.nRoamBeaconRssiWeight = 14;
#endif
#ifdef WLAN_FEATURE_11AC
pMac->roam.configParam.nVhtChannelWidth = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ + 1;
#endif
pMac->roam.configParam.addTSWhenACMIsOff = 0;
pMac->roam.configParam.fScanTwice = eANI_BOOLEAN_FALSE;
//Remove this code once SLM_Sessionization is supported
//BMPS_WORKAROUND_NOT_NEEDED
pMac->roam.configParam.doBMPSWorkaround = 0;
pMac->roam.configParam.nInitialDwellTime = 0;
pMac->roam.configParam.initial_scan_no_dfs_chnl = 0;
}
eCsrBand csrGetCurrentBand(tHalHandle hHal)
{
tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
return pMac->roam.configParam.bandCapability;
}
#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
/*
This function flushes the roam scan cache
*/
eHalStatus csrFlushRoamScanRoamChannelList(tpAniSirGlobal pMac,
tANI_U8 sessionId)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tpCsrNeighborRoamControlInfo pNeighborRoamInfo
= &pMac->roam.neighborRoamInfo[sessionId];
/* Free up the memory first (if required) */
if (NULL !=
pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList)
{
vos_mem_free(
pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList
);
pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.ChannelList
= NULL;
pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo.numOfChannels
= 0;
}
return status;
}
#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
/*
This function flushes the roam scan cache
*/
eHalStatus csrFlushCfgBgScanRoamChannelList(tpAniSirGlobal pMac,
tANI_U8 sessionId)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tpCsrNeighborRoamControlInfo pNeighborRoamInfo =
&pMac->roam.neighborRoamInfo[sessionId];
/* Free up the memory first (if required) */
if (NULL != pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
{
vos_mem_free(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList);
pNeighborRoamInfo->cfgParams.channelInfo.ChannelList = NULL;
pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0;
}
return status;
}
/*
This function flushes the roam scan cache and creates fresh cache
based on the input channel list
*/
eHalStatus csrCreateBgScanRoamChannelList(tpAniSirGlobal pMac,
tANI_U8 sessionId,
const tANI_U8 *pChannelList,
const tANI_U8 numChannels)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tpCsrNeighborRoamControlInfo pNeighborRoamInfo =
&pMac->roam.neighborRoamInfo[sessionId];
pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = numChannels;
pNeighborRoamInfo->cfgParams.channelInfo.ChannelList =
vos_mem_malloc(pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels);
if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
{
smsLog(pMac, LOGE, FL("Memory Allocation for CFG Channel List failed"));
pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels = 0;
return eHAL_STATUS_RESOURCES;
}
/* Update the roam global structure */
vos_mem_copy(pNeighborRoamInfo->cfgParams.channelInfo.ChannelList,
pChannelList,
pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels);
return status;
}
/* This function modifies the bgscan channel list set via config ini or
runtime, whenever the band changes.
if the band is auto, then no operation is performed on the channel list
if the band is 2.4G, then make sure channel list contains only 2.4G valid channels
if the band is 5G, then make sure channel list contains only 5G valid channels
*/
eHalStatus csrUpdateBgScanConfigIniChannelList(tpAniSirGlobal pMac,
tANI_U8 sessionId,
eCsrBand eBand)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tpCsrNeighborRoamControlInfo pNeighborRoamInfo =
&pMac->roam.neighborRoamInfo[sessionId];
tANI_U8 outNumChannels = 0;
tANI_U8 inNumChannels = 0;
tANI_U8 *inPtr = NULL;
tANI_U8 i = 0;
tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
if (NULL == pNeighborRoamInfo->cfgParams.channelInfo.ChannelList)
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
"No update required for channel list "
"either cfg.ini channel list is not set up or "
"auto band (Band %d)", eBand);
return status;
}
inNumChannels = pNeighborRoamInfo->cfgParams.channelInfo.numOfChannels;
inPtr = pNeighborRoamInfo->cfgParams.channelInfo.ChannelList;
if (eCSR_BAND_24 == eBand)
{
for (i = 0; i < inNumChannels; i++)
{
if (CSR_IS_CHANNEL_24GHZ(inPtr[i]) && csrRoamIsChannelValid(pMac, inPtr[i]))
{
ChannelList[outNumChannels++] = inPtr[i];
}
}
csrFlushCfgBgScanRoamChannelList(pMac, sessionId);
csrCreateBgScanRoamChannelList(pMac, sessionId, ChannelList,
outNumChannels);
}
else if (eCSR_BAND_5G == eBand)
{
for (i = 0; i < inNumChannels; i++)
{
/* Add 5G Non-DFS channel */
if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) &&
csrRoamIsChannelValid(pMac, inPtr[i]) &&
!CSR_IS_CHANNEL_DFS(inPtr[i]))
{
ChannelList[outNumChannels++] = inPtr[i];
}
}
csrFlushCfgBgScanRoamChannelList(pMac, sessionId);
csrCreateBgScanRoamChannelList(pMac, sessionId, ChannelList,
outNumChannels);
}
else if (eCSR_BAND_ALL == eBand)
{
for (i = 0; i < inNumChannels; i++)
{
if (csrRoamIsChannelValid(pMac, inPtr[i]) &&
!CSR_IS_CHANNEL_DFS(inPtr[i]))
{
ChannelList[outNumChannels++] = inPtr[i];
}
}
csrFlushCfgBgScanRoamChannelList(pMac, sessionId);
csrCreateBgScanRoamChannelList(pMac, sessionId, ChannelList,
outNumChannels);
}
else
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
"Invalid band, No operation carried out (Band %d)", eBand);
status = eHAL_STATUS_INVALID_PARAMETER;
}
return status;
}
#endif
#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
/*
* This function modifies the roam scan channel list as per AP neighbor
* report; AP neighbor report may be empty or may include only other AP
* channels; in any case, we merge the channel list with the learned occupied
* channels list.
* if the band is 2.4G, then make sure channel list contains only 2.4G
* valid channels if the band is 5G, then make sure channel list contains
* only 5G valid channels
*/
eHalStatus csrCreateRoamScanChannelList(tpAniSirGlobal pMac,
tANI_U8 sessionId,
tANI_U8 *pChannelList,
tANI_U8 numChannels,
const eCsrBand eBand)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tpCsrNeighborRoamControlInfo pNeighborRoamInfo
= &pMac->roam.neighborRoamInfo[sessionId];
tANI_U8 outNumChannels = 0;
tANI_U8 inNumChannels = numChannels;
tANI_U8 *inPtr = pChannelList;
tANI_U8 i = 0;
tANI_U8 ChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
tANI_U8 tmpChannelList[WNI_CFG_VALID_CHANNEL_LIST_LEN] = {0};
tANI_U8 mergedOutputNumOfChannels = 0;
tpCsrChannelInfo currChannelListInfo
= &pNeighborRoamInfo->roamChannelInfo.currentChannelListInfo;
/*
* Create a Union of occupied channel list learnt by the DUT along
* with the Neighbor report Channels. This increases the chances of
* the DUT to get a candidate AP while roaming even if the Neighbor
* Report is not able to provide sufficient information.
*/
if (pMac->scan.occupiedChannels[sessionId].numChannels)
{
csrNeighborRoamMergeChannelLists(pMac,
&pMac->scan.occupiedChannels[sessionId].channelList[0],
pMac->scan.occupiedChannels[sessionId].numChannels,
inPtr,
inNumChannels,
&mergedOutputNumOfChannels);
inNumChannels = mergedOutputNumOfChannels;
}
if (eCSR_BAND_24 == eBand)
{
for (i = 0; i < inNumChannels; i++)
{
if (CSR_IS_CHANNEL_24GHZ(inPtr[i])
&& csrRoamIsChannelValid(pMac, inPtr[i]))
{
ChannelList[outNumChannels++] = inPtr[i];
}
}
}
else if (eCSR_BAND_5G == eBand)
{
for (i = 0; i < inNumChannels; i++)
{
/* Add 5G Non-DFS channel */
if (CSR_IS_CHANNEL_5GHZ(inPtr[i]) &&
csrRoamIsChannelValid(pMac, inPtr[i]) &&
!CSR_IS_CHANNEL_DFS(inPtr[i]))
{
ChannelList[outNumChannels++] = inPtr[i];
}
}
}
else if (eCSR_BAND_ALL == eBand)
{
for (i = 0; i < inNumChannels; i++)
{
if (csrRoamIsChannelValid(pMac, inPtr[i]) &&
!CSR_IS_CHANNEL_DFS(inPtr[i]))
{
ChannelList[outNumChannels++] = inPtr[i];
}
}
}
else
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_WARN,
"Invalid band, No operation carried out (Band %d)", eBand);
return eHAL_STATUS_INVALID_PARAMETER;
}
/*
* if roaming within band is enabled, then select only the
* in band channels .
* This is required only if the band capability is set to ALL,
* E.g., if band capability is only 2.4G then all the channels in the
* list are already filtered for 2.4G channels, hence ignore this check
*/
if ((eCSR_BAND_ALL == eBand) && CSR_IS_ROAM_INTRA_BAND_ENABLED(pMac))
{
csrNeighborRoamChannelsFilterByCurrentBand(
pMac,
sessionId,
ChannelList,
outNumChannels,
tmpChannelList,
&outNumChannels);
vos_mem_copy(ChannelList,
tmpChannelList, outNumChannels);
}
/* Prepare final roam scan channel list */
if(outNumChannels)
{
/* Clear the channel list first */
if (NULL != currChannelListInfo->ChannelList)
{
vos_mem_free(currChannelListInfo->ChannelList);
currChannelListInfo->ChannelList = NULL;
currChannelListInfo->numOfChannels = 0;
}
currChannelListInfo->ChannelList
= vos_mem_malloc(outNumChannels * sizeof(tANI_U8));
if (NULL == currChannelListInfo->ChannelList)
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_FATAL,
"Failed to allocate memory for roam scan channel list");
currChannelListInfo->numOfChannels = 0;
return VOS_STATUS_E_RESOURCES;
}
vos_mem_copy(currChannelListInfo->ChannelList,
ChannelList, outNumChannels);
}
return status;
}
#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
eHalStatus csrSetBand(tHalHandle hHal, tANI_U8 sessionId, eCsrBand eBand)
{
tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
eHalStatus status = eHAL_STATUS_SUCCESS;
if (CSR_IS_PHY_MODE_A_ONLY(pMac) &&
(eBand == eCSR_BAND_24))
{
/* DOT11 mode configured to 11a only and received
request to change the band to 2.4 GHz */
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
"failed to set band cfg80211 = %u, band = %u",
pMac->roam.configParam.uCfgDot11Mode, eBand);
return eHAL_STATUS_INVALID_PARAMETER;
}
if ((CSR_IS_PHY_MODE_B_ONLY(pMac) ||
CSR_IS_PHY_MODE_G_ONLY(pMac)) &&
(eBand == eCSR_BAND_5G))
{
/* DOT11 mode configured to 11b/11g only and received
request to change the band to 5 GHz */
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
"failed to set band dot11mode = %u, band = %u",
pMac->roam.configParam.uCfgDot11Mode, eBand);
return eHAL_STATUS_INVALID_PARAMETER;
}
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_INFO,
"Band changed to %u (0 - ALL, 1 - 2.4 GHZ, 2 - 5GHZ)", eBand);
pMac->roam.configParam.eBand = eBand;
pMac->roam.configParam.bandCapability = eBand;
csrScanGetSupportedChannels( pMac );
#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
if (!csrRoamIsRoamOffloadScanEnabled(pMac))
#endif
csrUpdateBgScanConfigIniChannelList(pMac, sessionId, eBand);
#endif
status = csrInitGetChannels( pMac );
if (eHAL_STATUS_SUCCESS == status)
csrInitChannelList( hHal );
return status;
}
/* The function csrConvertCBIniValueToPhyCBState and
* csrConvertPhyCBStateToIniValue have been
* introduced to convert the ini value to the ENUM used in csr and MAC for CB state
* Ideally we should have kept the ini value and enum value same and representing the same
* cb values as in 11n standard i.e.
* Set to 1 (SCA) if the secondary channel is above the primary channel
* Set to 3 (SCB) if the secondary channel is below the primary channel
* Set to 0 (SCN) if no secondary channel is present
* However, since our driver is already distributed we will keep the ini definition as it is which is:
* 0 - secondary none
* 1 - secondary LOW
* 2 - secondary HIGH
* and convert to enum value used within the driver in
* csrChangeDefaultConfigParam using this function
* The enum values are as follows:
* PHY_SINGLE_CHANNEL_CENTERED = 0
* PHY_DOUBLE_CHANNEL_LOW_PRIMARY = 1
* PHY_DOUBLE_CHANNEL_HIGH_PRIMARY = 3
*/
ePhyChanBondState csrConvertCBIniValueToPhyCBState(v_U32_t cbIniValue)
{
ePhyChanBondState phyCbState;
switch (cbIniValue) {
// secondary none
case eCSR_INI_SINGLE_CHANNEL_CENTERED:
phyCbState = PHY_SINGLE_CHANNEL_CENTERED;
break;
// secondary LOW
case eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY:
phyCbState = PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
break;
// secondary HIGH
case eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY:
phyCbState = PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
break;
#ifdef WLAN_FEATURE_11AC
case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
break;
case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED;
break;
case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
break;
case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
break;
case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
break;
case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
break;
case eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
phyCbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
break;
#endif
default:
// If an invalid value is passed, disable CHANNEL BONDING
phyCbState = PHY_SINGLE_CHANNEL_CENTERED;
break;
}
return phyCbState;
}
v_U32_t csrConvertPhyCBStateToIniValue(ePhyChanBondState phyCbState)
{
v_U32_t cbIniValue;
switch (phyCbState) {
// secondary none
case PHY_SINGLE_CHANNEL_CENTERED:
cbIniValue = eCSR_INI_SINGLE_CHANNEL_CENTERED;
break;
// secondary LOW
case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
cbIniValue = eCSR_INI_DOUBLE_CHANNEL_HIGH_PRIMARY;
break;
// secondary HIGH
case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
cbIniValue = eCSR_INI_DOUBLE_CHANNEL_LOW_PRIMARY;
break;
#ifdef WLAN_FEATURE_11AC
case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED;
break;
case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED;
break;
case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED;
break;
case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW;
break;
case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW;
break;
case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH;
break;
case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
cbIniValue = eCSR_INI_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH;
break;
#endif
default:
// return some invalid value
cbIniValue = eCSR_INI_CHANNEL_BONDING_STATE_MAX;
break;
}
return cbIniValue;
}
eHalStatus csrChangeDefaultConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
if(pParam)
{
pMac->roam.configParam.pkt_err_disconn_th = pParam->pkt_err_disconn_th;
pMac->roam.configParam.WMMSupportMode = pParam->WMMSupportMode;
cfgSetInt(pMac, WNI_CFG_WME_ENABLED,
(pParam->WMMSupportMode == eCsrRoamWmmNoQos)? 0:1);
pMac->roam.configParam.Is11eSupportEnabled = pParam->Is11eSupportEnabled;
pMac->roam.configParam.FragmentationThreshold = pParam->FragmentationThreshold;
pMac->roam.configParam.Is11dSupportEnabled = pParam->Is11dSupportEnabled;
pMac->roam.configParam.Is11dSupportEnabledOriginal = pParam->Is11dSupportEnabled;
pMac->roam.configParam.Is11hSupportEnabled = pParam->Is11hSupportEnabled;
pMac->roam.configParam.fenableMCCMode = pParam->fEnableMCCMode;
pMac->roam.configParam.mcc_rts_cts_prot_enable =
pParam->mcc_rts_cts_prot_enable;
pMac->roam.configParam.mcc_bcast_prob_resp_enable =
pParam->mcc_bcast_prob_resp_enable;
pMac->roam.configParam.fAllowMCCGODiffBI = pParam->fAllowMCCGODiffBI;
/* channelBondingMode5GHz plays a dual role right now
* INFRA STA will use this non zero value as CB enabled and SOFTAP will use this non-zero value to determine the secondary channel offset
* This is how channelBondingMode5GHz works now and this is kept intact to avoid any cfg.ini change
*/
if (pParam->channelBondingMode24GHz > MAX_CB_VALUE_IN_INI)
{
smsLog( pMac, LOGW, "Invalid CB value from ini in 2.4GHz band %d, CB DISABLED", pParam->channelBondingMode24GHz);
}
pMac->roam.configParam.channelBondingMode24GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode24GHz);
if (pParam->channelBondingMode5GHz > MAX_CB_VALUE_IN_INI)
{
smsLog( pMac, LOGW, "Invalid CB value from ini in 5GHz band %d, CB DISABLED", pParam->channelBondingMode5GHz);
}
pMac->roam.configParam.stacbmode = pParam->stacbmode;
pMac->roam.configParam.channelBondingMode5GHz = csrConvertCBIniValueToPhyCBState(pParam->channelBondingMode5GHz);
pMac->roam.configParam.RTSThreshold = pParam->RTSThreshold;
pMac->roam.configParam.phyMode = pParam->phyMode;
pMac->roam.configParam.shortSlotTime = pParam->shortSlotTime;
pMac->roam.configParam.HeartbeatThresh24 = pParam->HeartbeatThresh24;
pMac->roam.configParam.HeartbeatThresh50 = pParam->HeartbeatThresh50;
pMac->roam.configParam.ProprietaryRatesEnabled = pParam->ProprietaryRatesEnabled;
pMac->roam.configParam.TxRate = pParam->TxRate;
pMac->roam.configParam.AdHocChannel24 = pParam->AdHocChannel24;
pMac->roam.configParam.AdHocChannel5G = pParam->AdHocChannel5G;
pMac->roam.configParam.bandCapability = pParam->bandCapability;
pMac->roam.configParam.cbChoice = pParam->cbChoice;
pMac->roam.configParam.bgScanInterval = pParam->bgScanInterval;
pMac->roam.configParam.disableAggWithBtc = pParam->disableAggWithBtc;
pMac->roam.configParam.neighborRoamConfig.delay_before_vdev_stop =
pParam->neighborRoamConfig.delay_before_vdev_stop;
//if HDD passed down non zero values then only update,
//otherwise keep using the defaults
if (pParam->initial_scan_no_dfs_chnl) {
pMac->roam.configParam.initial_scan_no_dfs_chnl =
pParam->initial_scan_no_dfs_chnl;
}
if (pParam->nInitialDwellTime)
{
pMac->roam.configParam.nInitialDwellTime =
pParam->nInitialDwellTime;
}
if (pParam->nActiveMaxChnTime)
{
pMac->roam.configParam.nActiveMaxChnTime = pParam->nActiveMaxChnTime;
cfgSetInt(pMac, WNI_CFG_ACTIVE_MAXIMUM_CHANNEL_TIME,
pParam->nActiveMaxChnTime);
}
if (pParam->nActiveMinChnTime)
{
pMac->roam.configParam.nActiveMinChnTime = pParam->nActiveMinChnTime;
cfgSetInt(pMac, WNI_CFG_ACTIVE_MINIMUM_CHANNEL_TIME,
pParam->nActiveMinChnTime);
}
if (pParam->nPassiveMaxChnTime)
{
pMac->roam.configParam.nPassiveMaxChnTime = pParam->nPassiveMaxChnTime;
cfgSetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME,
pParam->nPassiveMaxChnTime);
}
if (pParam->nPassiveMinChnTime)
{
pMac->roam.configParam.nPassiveMinChnTime = pParam->nPassiveMinChnTime;
cfgSetInt(pMac, WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME,
pParam->nPassiveMinChnTime);
}
#ifdef WLAN_AP_STA_CONCURRENCY
if (pParam->nActiveMaxChnTimeConc)
{
pMac->roam.configParam.nActiveMaxChnTimeConc = pParam->nActiveMaxChnTimeConc;
}
if (pParam->nActiveMinChnTimeConc)
{
pMac->roam.configParam.nActiveMinChnTimeConc = pParam->nActiveMinChnTimeConc;
}
if (pParam->nPassiveMaxChnTimeConc)
{
pMac->roam.configParam.nPassiveMaxChnTimeConc = pParam->nPassiveMaxChnTimeConc;
}
if (pParam->nPassiveMinChnTimeConc)
{
pMac->roam.configParam.nPassiveMinChnTimeConc = pParam->nPassiveMinChnTimeConc;
}
pMac->roam.configParam.nRestTimeConc = pParam->nRestTimeConc;
pMac->roam.configParam.min_rest_time_conc = pParam->min_rest_time_conc;
pMac->roam.configParam.idle_time_conc = pParam->idle_time_conc;
#endif
//if upper layer wants to disable idle scan altogether set it to 0
if (pParam->impsSleepTime)
{
//Change the unit from second to microsecond
tANI_U32 impsSleepTime =
pParam->impsSleepTime * VOS_TIMER_TO_SEC_UNIT;
if(CSR_IDLE_SCAN_NO_PS_INTERVAL_MIN <= impsSleepTime)
{
pMac->roam.configParam.impsSleepTime = impsSleepTime;
}
else
{
pMac->roam.configParam.impsSleepTime = CSR_IDLE_SCAN_NO_PS_INTERVAL;
}
}
else
{
pMac->roam.configParam.impsSleepTime = 0;
}
pMac->roam.configParam.eBand = pParam->eBand;
pMac->roam.configParam.uCfgDot11Mode = csrGetCfgDot11ModeFromCsrPhyMode(NULL, pMac->roam.configParam.phyMode,
pMac->roam.configParam.ProprietaryRatesEnabled);
//if HDD passed down non zero values for age params, then only update,
//otherwise keep using the defaults
if (pParam->nScanResultAgeCount)
{
pMac->roam.configParam.agingCount = pParam->nScanResultAgeCount;
}
if(pParam->scanAgeTimeNCNPS)
{
pMac->roam.configParam.scanAgeTimeNCNPS = pParam->scanAgeTimeNCNPS;
}
if(pParam->scanAgeTimeNCPS)
{
pMac->roam.configParam.scanAgeTimeNCPS = pParam->scanAgeTimeNCPS;
}
if(pParam->scanAgeTimeCNPS)
{
pMac->roam.configParam.scanAgeTimeCNPS = pParam->scanAgeTimeCNPS;
}
if(pParam->scanAgeTimeCPS)
{
pMac->roam.configParam.scanAgeTimeCPS = pParam->scanAgeTimeCPS;
}
pMac->first_scan_bucket_threshold =
pParam->first_scan_bucket_threshold;
csrAssignRssiForCategory(pMac, pMac->first_scan_bucket_threshold,
pParam->bCatRssiOffset);
pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime;
pMac->roam.configParam.fEnforce11dChannels = pParam->fEnforce11dChannels;
pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority;
pMac->roam.configParam.fEnforceCountryCodeMatch = pParam->fEnforceCountryCodeMatch;
pMac->roam.configParam.fEnforceDefaultDomain = pParam->fEnforceDefaultDomain;
pMac->roam.configParam.vccRssiThreshold = pParam->vccRssiThreshold;
pMac->roam.configParam.vccUlMacLossThreshold = pParam->vccUlMacLossThreshold;
pMac->roam.configParam.IsIdleScanEnabled = pParam->IsIdleScanEnabled;
pMac->roam.configParam.statsReqPeriodicity = pParam->statsReqPeriodicity;
pMac->roam.configParam.statsReqPeriodicityInPS = pParam->statsReqPeriodicityInPS;
//Assign this before calling CsrInit11dInfo
pMac->roam.configParam.nTxPowerCap = pParam->nTxPowerCap;
pMac->roam.configParam.allow_tpc_from_ap = pParam->allow_tpc_from_ap;
if( csrIs11dSupported( pMac ) )
{
status = CsrInit11dInfo(pMac, &pParam->Csr11dinfo);
}
else
{
pMac->scan.curScanType = eSIR_ACTIVE_SCAN;
}
/* Initialize the power + channel information if 11h is enabled.
If 11d is enabled this information has already been initialized */
if( csrIs11hSupported( pMac ) && !csrIs11dSupported( pMac ) )
{
csrInitChannelPowerList(pMac, &pParam->Csr11dinfo);
}
#ifdef WLAN_FEATURE_VOWIFI_11R
vos_mem_copy(&pMac->roam.configParam.csr11rConfig,
&pParam->csr11rConfig, sizeof(tCsr11rConfigParams));
smsLog( pMac, LOG1, "IsFTResourceReqSupp = %d", pMac->roam.configParam.csr11rConfig.IsFTResourceReqSupported);
#endif
#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
pMac->roam.configParam.isFastTransitionEnabled = pParam->isFastTransitionEnabled;
pMac->roam.configParam.RoamRssiDiff = pParam->RoamRssiDiff;
pMac->roam.configParam.nImmediateRoamRssiDiff = pParam->nImmediateRoamRssiDiff;
smsLog( pMac, LOG1, "nImmediateRoamRssiDiff = %d",
pMac->roam.configParam.nImmediateRoamRssiDiff );
pMac->roam.configParam.nRoamPrefer5GHz = pParam->nRoamPrefer5GHz;
pMac->roam.configParam.nRoamIntraBand = pParam->nRoamIntraBand;
pMac->roam.configParam.isWESModeEnabled = pParam->isWESModeEnabled;
pMac->roam.configParam.nProbes = pParam->nProbes;
pMac->roam.configParam.nRoamScanHomeAwayTime = pParam->nRoamScanHomeAwayTime;
#endif
#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
pMac->roam.configParam.isRoamOffloadScanEnabled = pParam->isRoamOffloadScanEnabled;
pMac->roam.configParam.bFastRoamInConIniFeatureEnabled = pParam->bFastRoamInConIniFeatureEnabled;
#endif
#ifdef FEATURE_WLAN_LFR
pMac->roam.configParam.isFastRoamIniFeatureEnabled = pParam->isFastRoamIniFeatureEnabled;
pMac->roam.configParam.MAWCEnabled = pParam->MAWCEnabled;
#endif
#ifdef FEATURE_WLAN_ESE
pMac->roam.configParam.isEseIniFeatureEnabled = pParam->isEseIniFeatureEnabled;
#endif
#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
vos_mem_copy(&pMac->roam.configParam.neighborRoamConfig,
&pParam->neighborRoamConfig, sizeof(tCsrNeighborRoamConfigParams));
smsLog( pMac, LOG1, "nNeighborScanTimerPerioid = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanTimerPeriod);
smsLog( pMac, LOG1, "nNeighborReassocRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborReassocRssiThreshold);
smsLog( pMac, LOG1, "nNeighborLookupRssiThreshold = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborLookupRssiThreshold);
smsLog( pMac, LOG1, "nOpportunisticThresholdDiff = %d", pMac->roam.configParam.neighborRoamConfig.nOpportunisticThresholdDiff);
smsLog( pMac, LOG1, "nRoamRescanRssiDiff = %d", pMac->roam.configParam.neighborRoamConfig.nRoamRescanRssiDiff);
smsLog( pMac, LOG1, "nNeighborScanMinChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMinChanTime);
smsLog( pMac, LOG1, "nNeighborScanMaxChanTime = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborScanMaxChanTime);
smsLog( pMac, LOG1, "nMaxNeighborRetries = %d", pMac->roam.configParam.neighborRoamConfig.nMaxNeighborRetries);
smsLog( pMac, LOG1, "nNeighborResultsRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nNeighborResultsRefreshPeriod);
smsLog( pMac, LOG1, "nEmptyScanRefreshPeriod = %d", pMac->roam.configParam.neighborRoamConfig.nEmptyScanRefreshPeriod);
{
int i;
smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++)
{
smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] );
}
}
smsLog( pMac, LOG1, "nRoamBmissFirstBcnt = %d", pMac->roam.configParam.neighborRoamConfig.nRoamBmissFirstBcnt);
smsLog( pMac, LOG1, "nRoamBmissFinalBcnt = %d", pMac->roam.configParam.neighborRoamConfig.nRoamBmissFinalBcnt);
smsLog( pMac, LOG1, "nRoamBeaconRssiWeight = %d", pMac->roam.configParam.neighborRoamConfig.nRoamBeaconRssiWeight);
#endif
pMac->roam.configParam.addTSWhenACMIsOff = pParam->addTSWhenACMIsOff;
pMac->scan.fValidateList = pParam->fValidateList;
pMac->scan.fEnableBypass11d = pParam->fEnableBypass11d;
pMac->scan.fEnableDFSChnlScan = pParam->fEnableDFSChnlScan;
pMac->scan.scanResultCfgAgingTime = pParam->scanCfgAgingTime;
pMac->roam.configParam.fScanTwice = pParam->fScanTwice;
pMac->scan.fFirstScanOnly2GChnl = pParam->fFirstScanOnly2GChnl;
pMac->scan.scanBandPreference = pParam->scanBandPreference;
/*
* This parameter is not available in cfg and not passed from upper
* layers. Instead it is initialized here. This parameter is used in
* concurrency to determine if there are concurrent active sessions.
* Is used as a temporary fix to disconnect all active sessions when
* BMPS enabled so the active session if Infra STA
* will automatically connect back and resume BMPS since resume BMPS is
* not working when moving from concurrent to single session
*/
//Remove this code once SLM_Sessionization is supported
//BMPS_WORKAROUND_NOT_NEEDED
pMac->roam.configParam.doBMPSWorkaround = 0;
#ifdef WLAN_FEATURE_11AC
pMac->roam.configParam.nVhtChannelWidth = pParam->nVhtChannelWidth;
pMac->roam.configParam.txBFEnable= pParam->enableTxBF;
pMac->roam.configParam.txBFCsnValue = pParam->txBFCsnValue;
pMac->roam.configParam.enable2x2= pParam->enable2x2;
pMac->roam.configParam.enableVhtFor24GHz = pParam->enableVhtFor24GHz;
pMac->roam.configParam.txMuBformee= pParam->enableMuBformee;
pMac->roam.configParam.enableVhtpAid = pParam->enableVhtpAid;
pMac->roam.configParam.enableVhtGid = pParam->enableVhtGid;
#endif
pMac->roam.configParam.enableAmpduPs = pParam->enableAmpduPs;
pMac->roam.configParam.enableHtSmps = pParam->enableHtSmps;
pMac->roam.configParam.htSmps= pParam->htSmps;
pMac->roam.configParam.txLdpcEnable = pParam->enableTxLdpc;
pMac->roam.configParam.max_amsdu_num = pParam->max_amsdu_num;
pMac->roam.configParam.nSelect5GHzMargin = pParam->nSelect5GHzMargin;
pMac->roam.configParam.ignorePeerErpInfo = pParam->ignorePeerErpInfo;
pMac->roam.configParam.isCoalesingInIBSSAllowed =
pParam->isCoalesingInIBSSAllowed;
#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
pMac->roam.configParam.cc_switch_mode = pParam->cc_switch_mode;
pMac->roam.configParam.band_switch_enable = pParam->band_switch_enable;
pMac->roam.configParam.ap_p2pgo_concurrency_enable =
pParam->ap_p2pgo_concurrency_enable;
pMac->roam.configParam.ap_p2pclient_concur_enable =
pParam->ap_p2pclient_concur_enable;
#endif
pMac->roam.configParam.allowDFSChannelRoam = pParam->allowDFSChannelRoam;
#ifdef WLAN_FEATURE_ROAM_OFFLOAD
pMac->roam.configParam.isRoamOffloadEnabled =
pParam->isRoamOffloadEnabled;
#endif
pMac->roam.configParam.ignore_peer_ht_opmode =
pParam->ignore_peer_ht_opmode;
pMac->roam.configParam.obssEnabled = pParam->obssEnabled;
pMac->roam.configParam.vendor_vht_for_24ghz_sap =
pParam->vendor_vht_for_24ghz_sap;
pMac->roam.configParam.conc_custom_rule1 =
pParam->conc_custom_rule1;
pMac->roam.configParam.conc_custom_rule2 =
pParam->conc_custom_rule2;
pMac->roam.configParam.is_sta_connection_in_5gz_enabled =
pParam->is_sta_connection_in_5gz_enabled;
pMac->enable_dot11p = pParam->enable_dot11p;
pMac->roam.configParam.sendDeauthBeforeCon =
pParam->sendDeauthBeforeCon;
pMac->roam.configParam.enable_fatal_event =
pParam->enable_fatal_event;
pMac->roam.configParam.tx_aggregation_size =
pParam->tx_aggregation_size;
pMac->roam.configParam.rx_aggregation_size =
pParam->rx_aggregation_size;
pMac->roam.configParam.gStaLocalEDCAEnable =
pParam->gStaLocalEDCAEnable;
pMac->roam.configParam.enable_edca_params =
pParam->enable_edca_params;
pMac->roam.configParam.edca_vo_cwmin = pParam->edca_vo_cwmin;
pMac->roam.configParam.edca_vi_cwmin = pParam->edca_vi_cwmin;
pMac->roam.configParam.edca_bk_cwmin = pParam->edca_bk_cwmin;
pMac->roam.configParam.edca_be_cwmin = pParam->edca_be_cwmin;
pMac->roam.configParam.edca_vo_cwmax = pParam->edca_vo_cwmax;
pMac->roam.configParam.edca_vi_cwmax = pParam->edca_vi_cwmax;
pMac->roam.configParam.edca_bk_cwmax = pParam->edca_bk_cwmax;
pMac->roam.configParam.edca_be_cwmax = pParam->edca_be_cwmax;
pMac->roam.configParam.edca_vo_aifs = pParam->edca_vo_aifs;
pMac->roam.configParam.edca_vi_aifs = pParam->edca_vi_aifs;
pMac->roam.configParam.edca_bk_aifs = pParam->edca_bk_aifs;
pMac->roam.configParam.edca_be_aifs = pParam->edca_be_aifs;
pMac->roam.configParam.sta_roam_policy.dfs_mode =
pParam->sta_roam_policy_params.dfs_mode;
pMac->roam.configParam.sta_roam_policy.skip_unsafe_channels =
pParam->sta_roam_policy_params.skip_unsafe_channels;
pMac->roam.configParam.sta_roam_policy.sap_operating_band =
pParam->sta_roam_policy_params.sap_operating_band;
}
return status;
}
eHalStatus csrGetConfigParam(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
{
eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
if(pParam)
{
pParam->WMMSupportMode = pMac->roam.configParam.WMMSupportMode;
pParam->Is11eSupportEnabled = pMac->roam.configParam.Is11eSupportEnabled;
pParam->FragmentationThreshold = pMac->roam.configParam.FragmentationThreshold;
pParam->Is11dSupportEnabled = pMac->roam.configParam.Is11dSupportEnabled;
pParam->Is11dSupportEnabledOriginal = pMac->roam.configParam.Is11dSupportEnabledOriginal;
pParam->Is11hSupportEnabled = pMac->roam.configParam.Is11hSupportEnabled;
pParam->channelBondingMode24GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode24GHz);
pParam->channelBondingMode5GHz = csrConvertPhyCBStateToIniValue(pMac->roam.configParam.channelBondingMode5GHz);
pParam->stacbmode = pMac->roam.configParam.stacbmode;
pParam->RTSThreshold = pMac->roam.configParam.RTSThreshold;
pParam->phyMode = pMac->roam.configParam.phyMode;
pParam->shortSlotTime = pMac->roam.configParam.shortSlotTime;
pParam->HeartbeatThresh24 = pMac->roam.configParam.HeartbeatThresh24;
pParam->HeartbeatThresh50 = pMac->roam.configParam.HeartbeatThresh50;
pParam->ProprietaryRatesEnabled = pMac->roam.configParam.ProprietaryRatesEnabled;
pParam->TxRate = pMac->roam.configParam.TxRate;
pParam->AdHocChannel24 = pMac->roam.configParam.AdHocChannel24;
pParam->AdHocChannel5G = pMac->roam.configParam.AdHocChannel5G;
pParam->bandCapability = pMac->roam.configParam.bandCapability;
pParam->cbChoice = pMac->roam.configParam.cbChoice;
pParam->bgScanInterval = pMac->roam.configParam.bgScanInterval;
pParam->nActiveMaxChnTime = pMac->roam.configParam.nActiveMaxChnTime;
pParam->nActiveMinChnTime = pMac->roam.configParam.nActiveMinChnTime;
pParam->nPassiveMaxChnTime = pMac->roam.configParam.nPassiveMaxChnTime;
pParam->nPassiveMinChnTime = pMac->roam.configParam.nPassiveMinChnTime;
pParam->disableAggWithBtc = pMac->roam.configParam.disableAggWithBtc;
#ifdef WLAN_AP_STA_CONCURRENCY
pParam->nActiveMaxChnTimeConc = pMac->roam.configParam.nActiveMaxChnTimeConc;
pParam->nActiveMinChnTimeConc = pMac->roam.configParam.nActiveMinChnTimeConc;
pParam->nPassiveMaxChnTimeConc = pMac->roam.configParam.nPassiveMaxChnTimeConc;
pParam->nPassiveMinChnTimeConc = pMac->roam.configParam.nPassiveMinChnTimeConc;
pParam->nRestTimeConc = pMac->roam.configParam.nRestTimeConc;
pParam->min_rest_time_conc = pMac->roam.configParam.min_rest_time_conc;
pParam->idle_time_conc = pMac->roam.configParam.idle_time_conc;
#endif
//Change the unit from microsecond to second
pParam->impsSleepTime =
pMac->roam.configParam.impsSleepTime / VOS_TIMER_TO_SEC_UNIT;
pParam->eBand = pMac->roam.configParam.eBand;
pParam->nScanResultAgeCount = pMac->roam.configParam.agingCount;
pParam->scanAgeTimeNCNPS = pMac->roam.configParam.scanAgeTimeNCNPS;
pParam->scanAgeTimeNCPS = pMac->roam.configParam.scanAgeTimeNCPS;
pParam->scanAgeTimeCNPS = pMac->roam.configParam.scanAgeTimeCNPS;
pParam->scanAgeTimeCPS = pMac->roam.configParam.scanAgeTimeCPS;
pParam->bCatRssiOffset = pMac->roam.configParam.bCatRssiOffset;
pParam->nRoamingTime = pMac->roam.configParam.nRoamingTime;
pParam->fEnforce11dChannels = pMac->roam.configParam.fEnforce11dChannels;
pParam->fSupplicantCountryCodeHasPriority = pMac->roam.configParam.fSupplicantCountryCodeHasPriority;
pParam->fEnforceCountryCodeMatch = pMac->roam.configParam.fEnforceCountryCodeMatch;
pParam->fEnforceDefaultDomain = pMac->roam.configParam.fEnforceDefaultDomain;
pParam->vccRssiThreshold = pMac->roam.configParam.vccRssiThreshold;
pParam->vccUlMacLossThreshold = pMac->roam.configParam.vccUlMacLossThreshold;
pParam->IsIdleScanEnabled = pMac->roam.configParam.IsIdleScanEnabled;
pParam->nTxPowerCap = pMac->roam.configParam.nTxPowerCap;
pParam->allow_tpc_from_ap = pMac->roam.configParam.allow_tpc_from_ap;
pParam->statsReqPeriodicity = pMac->roam.configParam.statsReqPeriodicity;
pParam->statsReqPeriodicityInPS = pMac->roam.configParam.statsReqPeriodicityInPS;
pParam->addTSWhenACMIsOff = pMac->roam.configParam.addTSWhenACMIsOff;
pParam->fValidateList = pMac->roam.configParam.fValidateList;
pParam->fEnableBypass11d = pMac->scan.fEnableBypass11d;
pParam->fEnableDFSChnlScan = pMac->scan.fEnableDFSChnlScan;
pParam->fScanTwice = pMac->roam.configParam.fScanTwice;
pParam->fFirstScanOnly2GChnl = pMac->scan.fFirstScanOnly2GChnl;
pParam->fEnableMCCMode = pMac->roam.configParam.fenableMCCMode;
pParam->fAllowMCCGODiffBI = pMac->roam.configParam.fAllowMCCGODiffBI;
pParam->scanCfgAgingTime = pMac->scan.scanResultCfgAgingTime;
pParam->scanBandPreference = pMac->scan.scanBandPreference;
#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
vos_mem_copy(&pParam->neighborRoamConfig,
&pMac->roam.configParam.neighborRoamConfig,
sizeof(tCsrNeighborRoamConfigParams));
#endif
#ifdef WLAN_FEATURE_11AC
pParam->nVhtChannelWidth = pMac->roam.configParam.nVhtChannelWidth;
pParam->enableTxBF = pMac->roam.configParam.txBFEnable;
pParam->txBFCsnValue = pMac->roam.configParam.txBFCsnValue;
pParam->enableMuBformee = pMac->roam.configParam.txMuBformee;
pParam->enableVhtFor24GHz = pMac->roam.configParam.enableVhtFor24GHz;
pParam->enable2x2 = pMac->roam.configParam.enable2x2;
pParam->enableVhtpAid = pMac->roam.configParam.enableVhtpAid;
pParam->enableVhtGid = pMac->roam.configParam.enableVhtGid;
#endif
#ifdef WLAN_FEATURE_VOWIFI_11R
vos_mem_copy(&pMac->roam.configParam.csr11rConfig,
&pParam->csr11rConfig, sizeof(tCsr11rConfigParams));
#endif
#if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
pParam->isFastTransitionEnabled = pMac->roam.configParam.isFastTransitionEnabled;
pParam->RoamRssiDiff = pMac->roam.configParam.RoamRssiDiff;
pParam->nImmediateRoamRssiDiff = pMac->roam.configParam.nImmediateRoamRssiDiff;
pParam->nRoamPrefer5GHz = pMac->roam.configParam.nRoamPrefer5GHz;
pParam->nRoamIntraBand = pMac->roam.configParam.nRoamIntraBand;
pParam->isWESModeEnabled = pMac->roam.configParam.isWESModeEnabled;
pParam->nProbes = pMac->roam.configParam.nProbes;
pParam->nRoamScanHomeAwayTime = pMac->roam.configParam.nRoamScanHomeAwayTime;
#endif
#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
pParam->isRoamOffloadScanEnabled = pMac->roam.configParam.isRoamOffloadScanEnabled;
pParam->bFastRoamInConIniFeatureEnabled = pMac->roam.configParam.bFastRoamInConIniFeatureEnabled;
#endif
#ifdef FEATURE_WLAN_LFR
pParam->isFastRoamIniFeatureEnabled = pMac->roam.configParam.isFastRoamIniFeatureEnabled;
pParam->MAWCEnabled = pMac->roam.configParam.MAWCEnabled;
#endif
#ifdef FEATURE_WLAN_ESE
pParam->isEseIniFeatureEnabled = pMac->roam.configParam.isEseIniFeatureEnabled;
#endif
#ifdef WLAN_FEATURE_NEIGHBOR_ROAMING
vos_mem_copy(&pParam->neighborRoamConfig,
&pMac->roam.configParam.neighborRoamConfig,
sizeof(tCsrNeighborRoamConfigParams));
{
int i;
smsLog( pMac, LOG1, FL("Num of Channels in CFG Channel List: %d"), pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels);
for( i=0; i< pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.numChannels; i++)
{
smsLog( pMac, LOG1, "%d ", pMac->roam.configParam.neighborRoamConfig.neighborScanChanList.channelList[i] );
}
}
#endif
#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
pParam->cc_switch_mode = pMac->roam.configParam.cc_switch_mode;
pParam->band_switch_enable = pMac->roam.configParam.band_switch_enable;
pParam->ap_p2pgo_concurrency_enable =
pMac->roam.configParam.ap_p2pgo_concurrency_enable;
pParam->ap_p2pclient_concur_enable =
pMac->roam.configParam.ap_p2pclient_concur_enable;
#endif
pParam->enableTxLdpc = pMac->roam.configParam.txLdpcEnable;
pParam->max_amsdu_num = pMac->roam.configParam.max_amsdu_num;
pParam->nSelect5GHzMargin = pMac->roam.configParam.nSelect5GHzMargin;
pParam->ignorePeerErpInfo = pMac->roam.configParam.ignorePeerErpInfo;
pParam->isCoalesingInIBSSAllowed =
pMac->roam.configParam.isCoalesingInIBSSAllowed;
pParam->allowDFSChannelRoam =
pMac->roam.configParam.allowDFSChannelRoam;
pParam->nInitialDwellTime =
pMac->roam.configParam.nInitialDwellTime;
pParam->initial_scan_no_dfs_chnl =
pMac->roam.configParam.initial_scan_no_dfs_chnl;
#ifdef WLAN_FEATURE_ROAM_OFFLOAD
pParam->isRoamOffloadEnabled =
pMac->roam.configParam.isRoamOffloadEnabled;
#endif
pParam->ignore_peer_ht_opmode =
pMac->roam.configParam.ignore_peer_ht_opmode;
pParam->enable_dot11p = pMac->enable_dot11p;
csrSetChannels(pMac, pParam);
pParam->obssEnabled = pMac->roam.configParam.obssEnabled;
pParam->vendor_vht_for_24ghz_sap =
pMac->roam.configParam.vendor_vht_for_24ghz_sap;
pParam->conc_custom_rule1 =
pMac->roam.configParam.conc_custom_rule1;
pParam->conc_custom_rule2 =
pMac->roam.configParam.conc_custom_rule2;
pParam->is_sta_connection_in_5gz_enabled =
pMac->roam.configParam.is_sta_connection_in_5gz_enabled;
pParam->sendDeauthBeforeCon =
pMac->roam.configParam.sendDeauthBeforeCon;
pParam->pkt_err_disconn_th = pMac->roam.configParam.pkt_err_disconn_th;
pParam->first_scan_bucket_threshold =
pMac->first_scan_bucket_threshold;
pParam->enableAmpduPs = pMac->roam.configParam.enableAmpduPs;
pParam->enableHtSmps = pMac->roam.configParam.enableHtSmps;
pParam->htSmps = pMac->roam.configParam.htSmps;
pParam->enable_fatal_event =
pMac->roam.configParam.enable_fatal_event;
pParam->enable_edca_params =
pMac->roam.configParam.enable_edca_params;
pParam->edca_vo_cwmin = pMac->roam.configParam.edca_vo_cwmin;
pParam->edca_vi_cwmin = pMac->roam.configParam.edca_vi_cwmin;
pParam->edca_bk_cwmin = pMac->roam.configParam.edca_bk_cwmin;
pParam->edca_be_cwmin = pMac->roam.configParam.edca_be_cwmin;
pParam->edca_vo_cwmax = pMac->roam.configParam.edca_vo_cwmax;
pParam->edca_vi_cwmax = pMac->roam.configParam.edca_vi_cwmax;
pParam->edca_bk_cwmax = pMac->roam.configParam.edca_bk_cwmax;
pParam->edca_be_cwmax = pMac->roam.configParam.edca_be_cwmax;
pParam->edca_vo_aifs = pMac->roam.configParam.edca_vo_aifs;
pParam->edca_vi_aifs = pMac->roam.configParam.edca_vi_aifs;
pParam->edca_bk_aifs = pMac->roam.configParam.edca_bk_aifs;
pParam->edca_be_aifs = pMac->roam.configParam.edca_be_aifs;
pParam->tx_aggregation_size =
pMac->roam.configParam.tx_aggregation_size;
pParam->rx_aggregation_size =
pMac->roam.configParam.rx_aggregation_size;
status = eHAL_STATUS_SUCCESS;
}
return (status);
}
eHalStatus csrSetPhyMode(tHalHandle hHal, tANI_U32 phyMode, eCsrBand eBand, tANI_BOOLEAN *pfRestartNeeded)
{
eHalStatus status = eHAL_STATUS_INVALID_PARAMETER;
tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
tANI_BOOLEAN fRestartNeeded = eANI_BOOLEAN_FALSE;
eCsrPhyMode newPhyMode = eCSR_DOT11_MODE_AUTO;
do
{
if(eCSR_BAND_24 == eBand)
{
if(CSR_IS_RADIO_A_ONLY(pMac)) break;
if(eCSR_DOT11_MODE_11a & phyMode) break;
}
if(eCSR_BAND_5G == eBand)
{
if(CSR_IS_RADIO_BG_ONLY(pMac)) break;
if((eCSR_DOT11_MODE_11b & phyMode) || (eCSR_DOT11_MODE_11b_ONLY & phyMode) ||
(eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11g_ONLY & phyMode)
)
{
break;
}
}
if (eCSR_DOT11_MODE_AUTO & phyMode) {
newPhyMode = eCSR_DOT11_MODE_AUTO;
} else {
//Check for dual band and higher capability first
if(eCSR_DOT11_MODE_11n_ONLY & phyMode)
{
if(eCSR_DOT11_MODE_11n_ONLY != phyMode) break;
newPhyMode = eCSR_DOT11_MODE_11n_ONLY;
}
else if(eCSR_DOT11_MODE_11g_ONLY & phyMode)
{
if(eCSR_DOT11_MODE_11g_ONLY != phyMode) break;
if(eCSR_BAND_5G == eBand) break;
newPhyMode = eCSR_DOT11_MODE_11g_ONLY;
eBand = eCSR_BAND_24;
}
else if(eCSR_DOT11_MODE_11b_ONLY & phyMode)
{
if(eCSR_DOT11_MODE_11b_ONLY != phyMode) break;
if(eCSR_BAND_5G == eBand) break;
newPhyMode = eCSR_DOT11_MODE_11b_ONLY;
eBand = eCSR_BAND_24;
}
else if(eCSR_DOT11_MODE_11n & phyMode)
{
newPhyMode = eCSR_DOT11_MODE_11n;
}
else if(eCSR_DOT11_MODE_abg & phyMode)
{
newPhyMode = eCSR_DOT11_MODE_abg;
}
else if(eCSR_DOT11_MODE_11a & phyMode)
{
if((eCSR_DOT11_MODE_11g & phyMode) || (eCSR_DOT11_MODE_11b & phyMode))
{
if(eCSR_BAND_ALL == eBand)
{
newPhyMode = eCSR_DOT11_MODE_abg;
}
else
{
//bad setting
break;
}
}
else
{
newPhyMode = eCSR_DOT11_MODE_11a;
eBand = eCSR_BAND_5G;
}
}
else if(eCSR_DOT11_MODE_11g & phyMode)
{
newPhyMode = eCSR_DOT11_MODE_11g;
eBand = eCSR_BAND_24;
}
else if(eCSR_DOT11_MODE_11b & phyMode)
{
newPhyMode = eCSR_DOT11_MODE_11b;
eBand = eCSR_BAND_24;
}
else
{
//We will never be here
smsLog( pMac, LOGE, FL(" cannot recognize the phy mode 0x%08X"), phyMode );
newPhyMode = eCSR_DOT11_MODE_AUTO;
}
}
//Done validating
status = eHAL_STATUS_SUCCESS;
//Now we need to check whether a restart is needed.
if(eBand != pMac->roam.configParam.eBand)
{
fRestartNeeded = eANI_BOOLEAN_TRUE;
break;
}
if(newPhyMode != pMac->roam.configParam.phyMode)
{
fRestartNeeded = eANI_BOOLEAN_TRUE;
break;
}
}while(0);
if(HAL_STATUS_SUCCESS(status))
{
pMac->roam.configParam.eBand = eBand;
pMac->roam.configParam.phyMode = newPhyMode;
if(pfRestartNeeded)
{
*pfRestartNeeded = fRestartNeeded;
}
}
return (status);
}
void csrPruneChannelListForMode( tpAniSirGlobal pMac, tCsrChannel *pChannelList )
{
tANI_U8 Index;
tANI_U8 cChannels;
// for dual band NICs, don't need to trim the channel list....
if ( !CSR_IS_OPEARTING_DUAL_BAND( pMac ) )
{
// 2.4 GHz band operation requires the channel list to be trimmed to
// the 2.4 GHz channels only...
if ( CSR_IS_24_BAND_ONLY( pMac ) )
{
for( Index = 0, cChannels = 0; Index < pChannelList->numChannels;
Index++ )
{
if ( CSR_IS_CHANNEL_24GHZ(pChannelList->channelList[ Index ]) )
{
pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ];
cChannels++;
}
}
/*
* Cleanup the rest of channels. Note we only need to clean up the
* channels if we had to trim the list.
* The amount of memory to clear is the number of channels that we
* trimmed (pChannelList->numChannels - cChannels) times the size
* of a channel in the structure.
*/
if ( pChannelList->numChannels > cChannels )
{
vos_mem_set(&pChannelList->channelList[ cChannels ],
sizeof( pChannelList->channelList[ 0 ] ) *
( pChannelList->numChannels - cChannels ), 0);
}
pChannelList->numChannels = cChannels;
}
else if ( CSR_IS_5G_BAND_ONLY( pMac ) )
{
for ( Index = 0, cChannels = 0; Index < pChannelList->numChannels; Index++ )
{
if ( CSR_IS_CHANNEL_5GHZ(pChannelList->channelList[ Index ]) )
{
pChannelList->channelList[ cChannels ] = pChannelList->channelList[ Index ];
cChannels++;
}
}
/*
* Cleanup the rest of channels. Note we only need to clean up the
* channels if we had to trim the list.
* The amount of memory to clear is the number of channels that we
* trimmed (pChannelList->numChannels - cChannels) times the size
* of a channel in the structure.
*/
if ( pChannelList->numChannels > cChannels )
{
vos_mem_set(&pChannelList->channelList[ cChannels ],
sizeof( pChannelList->channelList[ 0 ] ) *
( pChannelList->numChannels - cChannels ), 0);
}
pChannelList->numChannels = cChannels;
}
}
}
#define INFRA_AP_DEFAULT_CHANNEL 6
VOS_STATUS csrIsValidChannel(tpAniSirGlobal pMac, tANI_U8 chnNum)
{
tANI_U8 index= 0;
VOS_STATUS status = VOS_STATUS_E_NOSUPPORT;
/* regulatory check */
for (index=0; index < pMac->scan.base20MHzChannels.numChannels ;index++)
{
if(pMac->scan.base20MHzChannels.channelList[ index ] == chnNum){
status = VOS_STATUS_SUCCESS;
break;
}
}
if (status == VOS_STATUS_SUCCESS)
{
/* dfs nol */
for (index = 0;
index < pMac->sap.SapDfsInfo.numCurrentRegDomainDfsChannels;
index++)
{
tSapDfsNolInfo* dfsChan =
&pMac->sap.SapDfsInfo.sapDfsChannelNolList[index];
if ((dfsChan->dfs_channel_number == chnNum) &&
(dfsChan->radar_status_flag == eSAP_DFS_CHANNEL_UNAVAILABLE))
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
FL("channel %d is in dfs nol"),
chnNum);
status = VOS_STATUS_E_FAILURE;
break;
}
}
}
if (VOS_STATUS_SUCCESS != status)
{
VOS_TRACE(VOS_MODULE_ID_SME, VOS_TRACE_LEVEL_ERROR,
FL("channel %d is not available"),
chnNum);
}
return status;
}
eHalStatus csrInitGetChannels(tpAniSirGlobal pMac)
{
eHalStatus status = eHAL_STATUS_SUCCESS;
tANI_U8 num20MHzChannelsFound = 0;
VOS_STATUS vosStatus;
tANI_U8 Index = 0;
tANI_U8 num40MHzChannelsFound = 0;
//TODO: this interface changed to include the 40MHz channel list
// this needs to be tied into the adapter structure somehow and referenced appropriately for CB operation
// Read the scan channel list (including the power limit) from EEPROM
vosStatus = vos_nv_getChannelListWithPower( pMac->scan.defaultPowerTable, &num20MHzChannelsFound,
pMac->scan.defaultPowerTable40MHz, &num40MHzChannelsFound);
if ( (VOS_STATUS_SUCCESS != vosStatus) || (num20MHzChannelsFound == 0) )
{
smsLog( pMac, LOGE, FL("failed to get channels "));
status = eHAL_STATUS_FAILURE;
}
else
{
if ( num20MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN )
{
num20MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN;
}
pMac->scan.numChannelsDefault = num20MHzChannelsFound;
// Move the channel list to the global data
// structure -- this will be used as the scan list
for ( Index = 0; Index < num20MHzChannelsFound; Index++)
{
pMac->scan.base20MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable[ Index ].chanId;
}
pMac->scan.base20MHzChannels.numChannels = num20MHzChannelsFound;
if(num40MHzChannelsFound > WNI_CFG_VALID_CHANNEL_LIST_LEN)
{
num40MHzChannelsFound = WNI_CFG_VALID_CHANNEL_LIST_LEN;
}
for ( Index = 0; Index < num40MHzChannelsFound; Index++)
{
pMac->scan.base40MHzChannels.channelList[ Index ] = pMac->scan.defaultPowerTable40MHz[ Index ].chanId;
}
pMac->scan.base40MHzChannels.numChannels = num40MHzChannelsFound;
}
return (status);
}
eHalStatus csrInitChannelList( tHalHandle hHal )
{
tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
eHalStatus status = eHAL_STATUS_SUCCESS;
csrPruneChannelListForMode(pMac, &pMac->scan.baseChannels);
csrPruneChannelListForMode(pMac, &pMac->scan.base20MHzChannels);
csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_FALSE);
csrSaveChannelPowerForBand(pMac, eANI_BOOLEAN_TRUE);
// Apply the base channel list, power info, and set the Country code...
csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE );
csrInitOperatingClasses(hHal);
return (status);
}
eHalStatus csrChangeConfigParams(tpAniSirGlobal pMac,
tCsrUpdateConfigParam *pUpdateConfigParam)
{
eHalStatus status = eHAL_STATUS_FAILURE;
tCsr11dinfo *ps11dinfo = NULL;
ps11dinfo = &pUpdateConfigParam->Csr11dinfo;
status = CsrInit11dInfo(pMac, ps11dinfo);
return status;
}
static eHalStatus CsrInit11dInfo(tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo)
{
eHalStatus status = eHAL_STATUS_FAILURE;
tANI_U8 index;
tANI_U32 count=0;
tSirMacChanInfo *pChanInfo;
tSirMacChanInfo *pChanInfoStart;
tANI_BOOLEAN applyConfig = TRUE;
pMac->scan.currentCountryRSSI = -128;
if(!ps11dinfo)
{
return (status);
}
if ( ps11dinfo->Channels.numChannels && ( WNI_CFG_VALID_CHANNEL_LIST_LEN >= ps11dinfo->Channels.numChannels ) )
{
pMac->scan.base20MHzChannels.numChannels = ps11dinfo->Channels.numChannels;
vos_mem_copy(pMac->scan.base20MHzChannels.channelList,
ps11dinfo->Channels.channelList,
ps11dinfo->Channels.numChannels);
}
else
{
//No change
return (eHAL_STATUS_SUCCESS);
}
//legacy maintenance
vos_mem_copy(pMac->scan.countryCodeDefault, ps11dinfo->countryCode,
WNI_CFG_COUNTRY_CODE_LEN);
/* Tush: at csropen get this initialized with default, during csr reset if
this already set with some value no need initialize with default again */
if(0 == pMac->scan.countryCodeCurrent[0])
{
vos_mem_copy(pMac->scan.countryCodeCurrent, ps11dinfo->countryCode,
WNI_CFG_COUNTRY_CODE_LEN);
}
// need to add the max power channel list
pChanInfo = vos_mem_malloc(sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN);
if (pChanInfo != NULL)
{
vos_mem_set(pChanInfo,
sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN ,
0);
pChanInfoStart = pChanInfo;
for(index = 0; index < ps11dinfo->Channels.numChannels; index++)
{
pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel;
pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels;
pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap );
pChanInfo++;
count++;
}
if(count)
{
csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart );
}
vos_mem_free(pChanInfoStart);
}
//Only apply them to CFG when not in STOP state. Otherwise they will be applied later
if( HAL_STATUS_SUCCESS(status) )
{
for( index = 0; index < CSR_ROAM_SESSION_MAX; index++ )
{
if((CSR_IS_SESSION_VALID(pMac, index)) && CSR_IS_ROAM_STOP(pMac, index))
{
applyConfig = FALSE;
}
}
if(TRUE == applyConfig)
{
// Apply the base channel list, power info, and set the Country code...
csrApplyChannelPowerCountryInfo( pMac, &pMac->scan.base20MHzChannels, pMac->scan.countryCodeCurrent, eANI_BOOLEAN_TRUE );
}
}
return (status);
}
/* Initialize the Channel + Power List in the local cache and in the CFG */
eHalStatus csrInitChannelPowerList( tpAniSirGlobal pMac, tCsr11dinfo *ps11dinfo)
{
tANI_U8 index;
tANI_U32 count=0;
tSirMacChanInfo *pChanInfo;
tSirMacChanInfo *pChanInfoStart;
if(!ps11dinfo || !pMac)
{
return eHAL_STATUS_FAILURE;
}
pChanInfo = vos_mem_malloc(sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN);
if (pChanInfo != NULL)
{
vos_mem_set(pChanInfo,
sizeof(tSirMacChanInfo) * WNI_CFG_VALID_CHANNEL_LIST_LEN,
0);
pChanInfoStart = pChanInfo;
for(index = 0; index < ps11dinfo->Channels.numChannels; index++)
{
pChanInfo->firstChanNum = ps11dinfo->ChnPower[index].firstChannel;
pChanInfo->numChannels = ps11dinfo->ChnPower[index].numChannels;
pChanInfo->maxTxPower = CSR_ROAM_MIN( ps11dinfo->ChnPower[index].maxtxPower, pMac->roam.configParam.nTxPowerCap );
pChanInfo++;
count++;
}
if(count)
{
csrSaveToChannelPower2G_5G( pMac, count * sizeof(tSirMacChanInfo), pChanInfoStart );
}
vos_mem_free(pChanInfoStart);
}
return eHAL_STATUS_SUCCESS;
}
/**
* csr_roam_remove_duplicate_cmd_from_list()- Remove duplicate roam cmd from
* list
*
* @mac_ctx: pointer to global mac
* @session_id: session id for the cmd
* @list: pending list from which cmd needs to be removed
* @command: cmd to be removed, can be NULL
* @roam_reason: cmd with reason to be removed
*
* Remove duplicate command from the pending list.
*
* Return: void
*/
static void csr_roam_remove_duplicate_cmd_from_list(tpAniSirGlobal mac_ctx,
tANI_U32 session_id, tDblLinkList *list,
tSmeCmd *command, eCsrRoamReason roam_reason)
{
tListElem *entry, *next_entry;
tSmeCmd *dup_cmd;
tDblLinkList local_list;
vos_mem_zero(&local_list, sizeof(tDblLinkList));
if (!HAL_STATUS_SUCCESS(csrLLOpen(mac_ctx->hHdd, &local_list))) {
smsLog(mac_ctx, LOGE, FL(" failed to open list"));
return;
}
csrLLLock(list);
entry = csrLLPeekHead(list, LL_ACCESS_NOLOCK);
while (entry) {
next_entry = csrLLNext(list, entry, LL_ACCESS_NOLOCK);
dup_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link);
/*
* Remove the previous command if..
* - the new roam command is for the same RoamReason...
* - the new roam command is a NewProfileList.
* - the new roam command is a Forced Dissoc
* - the new roam command is from an 802.11 OID
* (OID_SSID or OID_BSSID).
*/
if ((command && (command->sessionId == dup_cmd->sessionId) &&
((command->command == dup_cmd->command) &&
/*
* This peermac check is requried for Softap/GO
* scenarios. For STA scenario below OR check will
* suffice as command will always be NULL for STA
* scenarios
*/
(vos_mem_compare(dup_cmd->u.roamCmd.peerMac,
command->u.roamCmd.peerMac,
sizeof(v_MACADDR_t))) &&
((command->u.roamCmd.roamReason ==
dup_cmd->u.roamCmd.roamReason) ||
(eCsrForcedDisassoc ==
command->u.roamCmd.roamReason) ||
(eCsrHddIssued ==
command->u.roamCmd.roamReason)))) ||
/* OR if pCommand is NULL */
((session_id == dup_cmd->sessionId) &&
(eSmeCommandRoam == dup_cmd->command) &&
((eCsrForcedDisassoc == roam_reason) ||
(eCsrHddIssued == roam_reason)))) {
smsLog(mac_ctx, LOGW, FL("RoamReason = %d"),
dup_cmd->u.roamCmd.roamReason);
/* Remove the roam command from the pending list */
if (csrLLRemoveEntry(list, entry, LL_ACCESS_NOLOCK))
csrLLInsertTail(&local_list,
entry, LL_ACCESS_NOLOCK);
}
entry = next_entry;
}
csrLLUnlock(list);
while ((entry = csrLLRemoveHead(&local_list, LL_ACCESS_NOLOCK))) {
dup_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link);
/* Tell caller that the command is cancelled */
csrRoamCallCallback(mac_ctx, dup_cmd->sessionId, NULL,
dup_cmd->u.roamCmd.roamId,
eCSR_ROAM_CANCELLED, eCSR_ROAM_RESULT_NONE);
csrReleaseCommandRoam(mac_ctx, dup_cmd);
}
csrLLClose(&local_list);
}
/**
* csrRoamRemoveDuplicateCommand()- Remove duplicate roam cmd
* from pending lists.
*
* @mac_ctx: pointer to global mac
* @session_id: session id for the cmd
* @command: cmd to be removed, can be null
* @roam_reason: cmd with reason to be removed
*
* Remove duplicate command from the sme and roam pending list.
*
* Return: void
*/
void csrRoamRemoveDuplicateCommand(tpAniSirGlobal mac_ctx,
tANI_U32 session_id, tSmeCmd *command,
eCsrRoamReason roam_reason)
{
/* Always lock active list before locking pending lists */